Changes

Jump to: navigation, search

Tennis Cup 2 (cartridge)

2,014 bytes added, 17:58, 5 February 2010
/* Analog Joystick */
push bc
set 6,c
ld a,09h ;keyb.row 9 ; keyboard line for joy 0\ or c ; ld b,0f6h ; out (c),a ; read digital joystick 1 ld b,0f4h ; in a,(c) ; cpl ; ld (8082h),a ; ; store joy 01 ;/ push af ;push joy 1 ld a,06h ;keyb.row6 ; keyboard line for joy 1\ or c ; ld b,0f6h ; out (c),a ; read digital joystick 2 ld b,0f4h ; in a,(c) ; cpl ; ld (8083h),a ; ; store joy 12 ;/ pop de ;pop joy 1 ;\ or d ;merge joy 2 ; merge digital joystick 1+2 ld (8086h),a ;store both ;/ ld a,03h ;keyb.row3 ;\ or c ; read pause button ld b,0f6h ; (aka "P" key) out (c),a ; (row3.bit3) ld b,0f4h ; (bit3 still needs to be in a,(c) ; isolated elsewhere) cpl ; ld (8084h),a ; ; store pause? ;/
pop bc
ld a,82h
ld bc,7fb8h
out (c),c
ld c,00h ;digital-joystick-style bits ld a,(6808h) ;ADC0 ; analogue input channel 0+00h..+3Fh ;\ sub 1fh ;-1Fh..+20h ; cp 14h ; jp p,261fh261fh_RIGHT ;+14h..+20h ; cp 0ech ;-14h ; read analog joystick 1, jp m,2623h2623h_LEFT ;-1Fh..-15h ; X-axis (ADC0) jr 2625h2625h_X_DONE ;-14h..+13h ; 261f261f_RIGHT: ; set 3,c ;bit3=right (as on digital joy) ; convert to digital left/right jr 2625h2625h_X_DONE ; 26232623_LEFT: ; set 2,c ; ; bit2=left(as on digital joy) ; 26252625_X_DONE: ;/ ld a,(6809h) ;ADC0 ; analogue input channel 1+00h..+3Fh ;\ sub 1fh ;-1Fh..+20h ; cp 14h ; jp p,2639h2639h_DOWN ;+14h..+20h ; cp 0ech ;-14h ; read analog joystick 1, jp p,263bh263bh_Y_DONE ;-14h..+13h ; Y-axis (ADC1) 26342634h_UP: ;-1Fh..-15h ; set 0,c ;bit0=up (as on digital joy) ; convert to digital up/down jp 263bh263bh_Y_DONE ; 26392639h_DOWN: ; set 1,c ; ; bit1=down(as on digital joy) ; 263b263bh_Y_DONE: ;/ ld a,(8082h) ;joy1 ; joy 0 fire.\ and 10h ;joy1 fire ; use digital joystick 1 fire or c ; as analog joystick 1 fire ld (8085h),a;store A/D converted analog ;/
The keyboard is read to determine the state of the digital joysticks and the P button (pause button on gx4000 console).
6,388
edits