mirror of
https://codeberg.org/hkzlab/TK2048.git
synced 2025-12-25 14:42:16 +11:00
Implement (untested) code to draw joystick
This commit is contained in:
parent
d3d2207b4f
commit
28a1fbfc18
2 changed files with 82 additions and 0 deletions
|
|
@ -6,5 +6,6 @@
|
|||
void vdp_clear_gamegrid(void);
|
||||
void vdp_clear_dialog(void);
|
||||
uint8_t vdp_draw_numtile(uint8_t type, uint8_t x, uint8_t y);
|
||||
void vdp_draw_joystick(uint8_t position);
|
||||
|
||||
#endif /* _GAME_VDP_GRAPHICS_HEADER_ */
|
||||
|
|
|
|||
|
|
@ -10,6 +10,87 @@ NUM_TILE_OFFSET: .equ 0x14
|
|||
|
||||
.section code,text
|
||||
|
||||
vdp_draw_joystick:
|
||||
T_NT_IDX$: .equ _Zp+4
|
||||
P_POS$: .equ _Zp+2
|
||||
T_Y$: .equ _Zp+1
|
||||
T_X$: .equ _Zp+0
|
||||
|
||||
ldx #0
|
||||
stx zp:T_NT_IDX$
|
||||
pha
|
||||
|
||||
; Clear the table
|
||||
lda #29
|
||||
sta zp:T_X$
|
||||
lda #16
|
||||
sta zp:T_Y$
|
||||
jsr vdp_point_to_vram_xy
|
||||
lda #0
|
||||
sta VDP_MEM
|
||||
|
||||
lda #29
|
||||
sta zp:T_X$
|
||||
lda #18
|
||||
sta zp:T_Y$
|
||||
jsr vdp_point_to_vram_xy
|
||||
lda #0
|
||||
sta VDP_MEM
|
||||
|
||||
lda #28
|
||||
sta zp:T_X$
|
||||
lda #17
|
||||
sta zp:T_Y$
|
||||
jsr vdp_point_to_vram_xy
|
||||
lda #0
|
||||
sta VDP_MEM
|
||||
sta VDP_MEM
|
||||
sta VDP_MEM
|
||||
|
||||
; Jump to the correct code to handle joystick drawing
|
||||
pla
|
||||
asl a
|
||||
tax
|
||||
lda _draw_joystick_jumptable$,x
|
||||
sta zp:_Zp+0
|
||||
lda _draw_joystick_jumptable$+1,x
|
||||
sta zp:_Zp+1
|
||||
sec
|
||||
jmp (_Zp+0)
|
||||
|
||||
J_Center$:
|
||||
ldx #29
|
||||
ldy #18
|
||||
bcs J_Done$
|
||||
J_Up$:
|
||||
ldx #29
|
||||
ldy #17
|
||||
bcs J_Done$
|
||||
J_Down$:
|
||||
ldx #29
|
||||
ldy #19
|
||||
bcs J_Done$
|
||||
J_Left$:
|
||||
ldx #28
|
||||
ldy #18
|
||||
bcs J_Done$
|
||||
J_Right$:
|
||||
ldx #30
|
||||
ldy #18
|
||||
J_Done$:
|
||||
stx zp:T_X$
|
||||
sty zp:T_Y$
|
||||
jsr vdp_point_to_vram_xy
|
||||
lda #120
|
||||
sta VDP_MEM
|
||||
|
||||
rts
|
||||
_draw_joystick_jumptable$:
|
||||
.word J_Center$
|
||||
.word J_Up$
|
||||
.word J_Down$
|
||||
.word J_Left$
|
||||
.word J_Right$
|
||||
|
||||
vdp_clear_gamegrid:
|
||||
T_NT_IDX$: .equ _Zp+4
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue