mirror of
https://github.com/deater/tb1.git
synced 2024-06-06 14:29:37 +00:00
snes: add wait_until_keypressed routine
This commit is contained in:
parent
4bba2a0fd5
commit
db9e66cc86
|
@ -1,2 +1,2 @@
|
||||||
.word $3d2c ; Complement of checksum
|
.word $3851 ; Complement of checksum
|
||||||
.word $c2d3 ; Unsigned 16-bit sum of ROM
|
.word $c7ae ; Unsigned 16-bit sum of ROM
|
||||||
|
|
|
@ -168,35 +168,15 @@ opening_setup_video:
|
||||||
sta $2105 ; set Mode 3
|
sta $2105 ; set Mode 3
|
||||||
|
|
||||||
lda #$81 ; Enable NMI (VBlank Interrupt) and joypads
|
lda #$81 ; Enable NMI (VBlank Interrupt) and joypads
|
||||||
; lda #$01 ; enable joypad
|
|
||||||
sta $4200 ;
|
sta $4200 ;
|
||||||
|
|
||||||
|
|
||||||
jsr svmw_fade_in
|
jsr svmw_fade_in
|
||||||
|
|
||||||
|
jsr svmw_repeat_until_keypressed
|
||||||
|
|
||||||
;forever:
|
|
||||||
; bra forever
|
|
||||||
|
|
||||||
|
|
||||||
opening_joypad_read:
|
|
||||||
lda $4212 ; get joypad status
|
|
||||||
and #%00000001 ; if joy is not ready
|
|
||||||
bne opening_joypad_read ; wait
|
|
||||||
|
|
||||||
lda $4219 ; read joypad (BYSTudlr)
|
|
||||||
|
|
||||||
and #%11110000 ; see if a button pressed
|
|
||||||
|
|
||||||
beq opening_joypad_read
|
|
||||||
; if so, skip and don't move ball
|
|
||||||
|
|
||||||
jsr svmw_fade_out
|
jsr svmw_fade_out
|
||||||
|
|
||||||
; lda #$80
|
|
||||||
; sta $2100 ; Turn off screen
|
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -235,3 +235,38 @@ done_fade_out:
|
||||||
plp ; restore status
|
plp ; restore status
|
||||||
|
|
||||||
rts ; return
|
rts ; return
|
||||||
|
|
||||||
|
|
||||||
|
;========================
|
||||||
|
;========================
|
||||||
|
; repeat until keypressed
|
||||||
|
;========================
|
||||||
|
;========================
|
||||||
|
; this assumes auto-joypad read enabled
|
||||||
|
|
||||||
|
svmw_repeat_until_keypressed:
|
||||||
|
php ; save status register
|
||||||
|
|
||||||
|
sep #$20 ; set accumulator to 8 bit
|
||||||
|
.a8
|
||||||
|
|
||||||
|
wait_for_keypress:
|
||||||
|
wai ; wait until next interrupt
|
||||||
|
|
||||||
|
wait_for_joypad_ready:
|
||||||
|
lda $4212 ; get joypad status
|
||||||
|
and #$01 ; loop if joypad is not ready
|
||||||
|
bne wait_for_joypad_ready
|
||||||
|
|
||||||
|
lda $4219 ; read joypad (BYSTudlr)
|
||||||
|
bne found_keypress
|
||||||
|
|
||||||
|
lda $4218 ; read joypad (axlriiii)
|
||||||
|
bne found_keypress
|
||||||
|
|
||||||
|
bra wait_for_keypress
|
||||||
|
|
||||||
|
found_keypress:
|
||||||
|
|
||||||
|
plp ; restore status
|
||||||
|
rts
|
||||||
|
|
|
@ -109,27 +109,15 @@ title_setup_video:
|
||||||
sta $2100 ; Turn on screen, full Brightness
|
sta $2100 ; Turn on screen, full Brightness
|
||||||
|
|
||||||
|
|
||||||
; lda #$81 ; Enable NMI (VBlank Interrupt) and joypads
|
lda #$81 ; Enable NMI (VBlank Interrupt) and joypads
|
||||||
lda #$01 ; Enable joypad
|
|
||||||
; lda #$00
|
|
||||||
sta $4200 ;
|
sta $4200 ;
|
||||||
|
|
||||||
;big:
|
jsr svmw_fade_in
|
||||||
; bra big
|
|
||||||
|
|
||||||
title_joypad_read:
|
jsr svmw_repeat_until_keypressed
|
||||||
lda $4212 ; get joypad status
|
|
||||||
and #%00000001 ; if joy is not ready
|
|
||||||
bne title_joypad_read ; wait
|
|
||||||
|
|
||||||
lda $4219 ; read joypad (BYSTudlr)
|
jsr svmw_fade_out
|
||||||
|
|
||||||
and #%11110000 ; see if a button pressed
|
|
||||||
|
|
||||||
beq title_joypad_read
|
|
||||||
|
|
||||||
lda #$80
|
|
||||||
sta $2100 ; Turn off screen
|
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user