mirror of
https://github.com/deater/tb1.git
synced 2025-04-12 04:37:03 +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 $c2d3 ; Unsigned 16-bit sum of ROM
|
||||
.word $3851 ; Complement of checksum
|
||||
.word $c7ae ; Unsigned 16-bit sum of ROM
|
||||
|
@ -168,35 +168,15 @@ opening_setup_video:
|
||||
sta $2105 ; set Mode 3
|
||||
|
||||
lda #$81 ; Enable NMI (VBlank Interrupt) and joypads
|
||||
; lda #$01 ; enable joypad
|
||||
sta $4200 ;
|
||||
|
||||
|
||||
jsr svmw_fade_in
|
||||
|
||||
|
||||
|
||||
;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_repeat_until_keypressed
|
||||
|
||||
jsr svmw_fade_out
|
||||
|
||||
; lda #$80
|
||||
; sta $2100 ; Turn off screen
|
||||
|
||||
rts
|
||||
|
||||
|
||||
|
@ -235,3 +235,38 @@ done_fade_out:
|
||||
plp ; restore status
|
||||
|
||||
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
|
||||
|
||||
|
||||
; lda #$81 ; Enable NMI (VBlank Interrupt) and joypads
|
||||
lda #$01 ; Enable joypad
|
||||
; lda #$00
|
||||
lda #$81 ; Enable NMI (VBlank Interrupt) and joypads
|
||||
sta $4200 ;
|
||||
|
||||
;big:
|
||||
; bra big
|
||||
jsr svmw_fade_in
|
||||
|
||||
title_joypad_read:
|
||||
lda $4212 ; get joypad status
|
||||
and #%00000001 ; if joy is not ready
|
||||
bne title_joypad_read ; wait
|
||||
jsr svmw_repeat_until_keypressed
|
||||
|
||||
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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user