; ; player update code ; cool_down: .db 0 player_update: ld x, [sp + 2] ld a, [sp + 3] ; read controller 1 ld b, 0xf0 port b, b inc x bo inc a ; x coord ld y, [a : x] ; left bit b, 4 bz dec y ; right bit b, 5 bz inc y ld [a : x], y inc x bo inc a ; y coord ld y, [a : x] ; up bit b, 2 bz dec y ; down bit b, 3 bz inc y ld [a : x], y ; update frame inc x bo inc a ; base frame ld y, 0 push b ; both left and right and b, 48 cmp b, 48 bz jmp player_store_frame ; left bit b, 4 bz ld y, 2 ; right bit b, 5 bz ld y, 1 player_store_frame: ld [a : x], y pop b ; fire bit b, 0 bnz ret ld x, cool_down ld y, [a : x] cmp y, 0 bz jmp player_fire dec y ld [a : x], y ret player_fire: add y, 10 ld [a : x], y call bullet_player_new ret