mirror of
https://github.com/a2-4am/4cade.git
synced 2024-11-24 03:34:02 +00:00
refactor some HGR macros, make ResetInputTimeout internal to WaitForKeyFor30Seconds and clear the keyboard strobe explicitly before and/or after
This commit is contained in:
parent
e370dbfa93
commit
f40c8ebae6
@ -9,7 +9,7 @@
|
|||||||
; D000..E4E9 - persistent data structures (gGlobalPrefsStore, gGamesListStore)
|
; D000..E4E9 - persistent data structures (gGlobalPrefsStore, gGamesListStore)
|
||||||
; ...end of data and start of code are approximate, in between is unused...
|
; ...end of data and start of code are approximate, in between is unused...
|
||||||
; ...if they ever overlap, things will go boom...
|
; ...if they ever overlap, things will go boom...
|
||||||
; E9B8..FFF9 - main program code
|
; E9C4..FFF9 - main program code
|
||||||
; FFFA..FFFF - NMI, reset, IRQ vectors
|
; FFFA..FFFF - NMI, reset, IRQ vectors
|
||||||
;
|
;
|
||||||
; LC RAM BANK 2
|
; LC RAM BANK 2
|
||||||
|
14
src/macros.a
14
src/macros.a
@ -112,17 +112,3 @@
|
|||||||
and zpCharMask
|
and zpCharMask
|
||||||
+
|
+
|
||||||
}
|
}
|
||||||
|
|
||||||
; does not set page 1 or 2
|
|
||||||
!macro HGR_MODE {
|
|
||||||
bit $C057
|
|
||||||
bit $C052
|
|
||||||
bit $C050
|
|
||||||
}
|
|
||||||
|
|
||||||
; does not set page 1 or 2
|
|
||||||
!macro GR_MODE {
|
|
||||||
bit $C056
|
|
||||||
bit $C052
|
|
||||||
bit $C050
|
|
||||||
}
|
|
||||||
|
@ -49,7 +49,9 @@ BlankGR
|
|||||||
dex
|
dex
|
||||||
bne @loop
|
bne @loop
|
||||||
bit PAGE1
|
bit PAGE1
|
||||||
+GR_MODE
|
bit $C056 ; set GR mode
|
||||||
|
bit $C052
|
||||||
|
bit $C050
|
||||||
rts
|
rts
|
||||||
|
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
|
@ -25,7 +25,7 @@ BrowseMode
|
|||||||
|
|
||||||
.BrowseModeInputLoop
|
.BrowseModeInputLoop
|
||||||
jsr WaitForKeyFor30Seconds
|
jsr WaitForKeyFor30Seconds
|
||||||
jsr ResetInputTimeout
|
bit CLEARKBD
|
||||||
|
|
||||||
ldy #kNumBrowseKeys
|
ldy #kNumBrowseKeys
|
||||||
- dey
|
- dey
|
||||||
|
125
src/ui.common.a
125
src/ui.common.a
@ -1,4 +1,4 @@
|
|||||||
;license:MIT
|
;License:MIT
|
||||||
;(c) 2018-9 by 4am
|
;(c) 2018-9 by 4am
|
||||||
;
|
;
|
||||||
; common UI functions
|
; common UI functions
|
||||||
@ -9,15 +9,15 @@
|
|||||||
; - LoadTitleOffscreen
|
; - LoadTitleOffscreen
|
||||||
; - LoadCoverOffscreen
|
; - LoadCoverOffscreen
|
||||||
; - DrawSearchBarOffscreen
|
; - DrawSearchBarOffscreen
|
||||||
; - ClearOffscreen
|
|
||||||
; - ShowOtherPage
|
; - ShowOtherPage
|
||||||
; - ToggleOffscreenPage
|
; - ToggleOffscreenPage
|
||||||
; - CoverFade
|
; - CoverFade
|
||||||
; - ResetInputTimeout
|
|
||||||
; - SoftBell
|
; - SoftBell
|
||||||
; - Home
|
; - Home
|
||||||
; - BlankHGR
|
; - BlankHGR
|
||||||
; - BlankDHGR
|
; - BlankDHGR
|
||||||
|
; - ClearOffscreen
|
||||||
|
; - ExecuteTransitionAndWait
|
||||||
; - IsSearchKey
|
; - IsSearchKey
|
||||||
|
|
||||||
; Public variables
|
; Public variables
|
||||||
@ -126,6 +126,36 @@ DrawSearchBarOffscreen
|
|||||||
+LDADDR UILine2
|
+LDADDR UILine2
|
||||||
jmp Draw40Chars
|
jmp Draw40Chars
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; ClearOffscreen
|
||||||
|
; clear $2000..$3FFF or $4000..$5FFF, depending on which HGR page is not
|
||||||
|
; visible right now
|
||||||
|
; does not change HGR mode
|
||||||
|
;
|
||||||
|
; in: none
|
||||||
|
; out: $2000..$3FFF or $4000..$5FFF cleared
|
||||||
|
; A = 0
|
||||||
|
; X = 0
|
||||||
|
; Y = 0
|
||||||
|
; Z = 1
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
ClearOffscreen
|
||||||
|
jsr GetOffscreenAddress
|
||||||
|
+HIDE_NEXT_2_BYTES
|
||||||
|
.ClearHGR1
|
||||||
|
lda #$20
|
||||||
|
sta @a+2
|
||||||
|
ldx #$20
|
||||||
|
lda #$80
|
||||||
|
ldy #0
|
||||||
|
@a sta $2000,y
|
||||||
|
iny
|
||||||
|
bne @a
|
||||||
|
inc @a+2
|
||||||
|
dex
|
||||||
|
bne @a
|
||||||
|
rts
|
||||||
|
|
||||||
ShowOtherPage
|
ShowOtherPage
|
||||||
; in: none
|
; in: none
|
||||||
; out: A = new value of OffscreenPage
|
; out: A = new value of OffscreenPage
|
||||||
@ -146,16 +176,24 @@ ToggleOffscreenPage
|
|||||||
sta OffscreenPage
|
sta OffscreenPage
|
||||||
rts
|
rts
|
||||||
|
|
||||||
ResetInputTimeout
|
;------------------------------------------------------------------------------
|
||||||
; clobbers X, preserves A/Y
|
; WaitForKeyFor30Seconds
|
||||||
ldx #$16
|
; does what it says on the tin
|
||||||
stx Timeout
|
;
|
||||||
stx Timeout+1
|
; in: none
|
||||||
stx Timeout+2
|
; out: if user presses a key before the timer runs out, exits with A = key
|
||||||
bit CLEARKBD
|
; otherwise exits via MegaAttractMode
|
||||||
rts
|
; X/Y preserved
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
WaitForKeyFor30Seconds
|
WaitForKeyFor30Seconds
|
||||||
|
lda KBD
|
||||||
|
bmi @gotKey ; if we have a key on entry, exit with it in A
|
||||||
|
|
||||||
|
lda #$16 ; initialize timeout counters
|
||||||
|
sta Timeout
|
||||||
|
sta Timeout+1
|
||||||
|
sta Timeout+2
|
||||||
|
@loop
|
||||||
lda KBD
|
lda KBD
|
||||||
bmi @gotKey
|
bmi @gotKey
|
||||||
|
|
||||||
@ -164,11 +202,11 @@ WaitForKeyFor30Seconds
|
|||||||
inc RNDSEED ; seed)
|
inc RNDSEED ; seed)
|
||||||
+
|
+
|
||||||
dec Timeout ; these are a 3-byte timeout counter
|
dec Timeout ; these are a 3-byte timeout counter
|
||||||
bne WaitForKeyFor30Seconds; that counts down from a number set
|
bne @loop ; that counts down from a number set
|
||||||
dec Timeout+1 ; in .ResetInputTimeout and reset
|
dec Timeout+1 ; in .ResetInputTimeout and reset
|
||||||
bne WaitForKeyFor30Seconds; on every keypress (whether or not
|
bne @loop ; on every keypress (whether or not
|
||||||
dec Timeout+2 ; the key leads to an action)
|
dec Timeout+2 ; the key leads to an action)
|
||||||
bne WaitForKeyFor30Seconds
|
bne @loop
|
||||||
jsr CoverFade ; no input for ~30 seconds, switch to
|
jsr CoverFade ; no input for ~30 seconds, switch to
|
||||||
jmp MegaAttractMode ; mega-attract mode
|
jmp MegaAttractMode ; mega-attract mode
|
||||||
@gotKey rts
|
@gotKey rts
|
||||||
@ -255,8 +293,7 @@ BlankHGR
|
|||||||
jsr Home
|
jsr Home
|
||||||
jsr .ClearHGR1 ; clear hi-res screen 1
|
jsr .ClearHGR1 ; clear hi-res screen 1
|
||||||
bit PAGE1 ; show hi-res screen 1 (now blank)
|
bit PAGE1 ; show hi-res screen 1 (now blank)
|
||||||
+HGR_MODE
|
jmp HGRMode
|
||||||
rts
|
|
||||||
|
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
; BlankDHGR
|
; BlankDHGR
|
||||||
@ -273,11 +310,31 @@ BlankDHGR
|
|||||||
jsr .ClearHGR1 ; clear hi-res screen 1 in auxmem
|
jsr .ClearHGR1 ; clear hi-res screen 1 in auxmem
|
||||||
sta WRITEMAINMEM
|
sta WRITEMAINMEM
|
||||||
sta SET80VID
|
sta SET80VID
|
||||||
bit PAGE1
|
|
||||||
+HGR_MODE
|
|
||||||
sta DHIRESON
|
sta DHIRESON
|
||||||
|
bit PAGE1
|
||||||
|
jmp HGRMode
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; HGRMode
|
||||||
|
; twiddles softswitches to set HGR mode (does not set page 1 or 2)
|
||||||
|
;
|
||||||
|
; in: none
|
||||||
|
; out: all registers preserved
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
HGRMode
|
||||||
|
bit $C057
|
||||||
|
bit $C052
|
||||||
|
bit $C050
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; ExecuteTransitionAndWait
|
||||||
|
; call transition effect code (address passed in) and wait a period of time
|
||||||
|
; or until the user presses a key
|
||||||
|
;
|
||||||
|
; in: A/Y = address of transition effect code
|
||||||
|
; out: all flags and registers clobbered
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
ExecuteTransitionAndWait
|
ExecuteTransitionAndWait
|
||||||
+STAY @j+1
|
+STAY @j+1
|
||||||
@j jsr $FDFD ; SMC call transition effect code
|
@j jsr $FDFD ; SMC call transition effect code
|
||||||
@ -293,36 +350,6 @@ ExecuteTransitionAndWait
|
|||||||
bit CLEARKBD
|
bit CLEARKBD
|
||||||
+ rts
|
+ rts
|
||||||
|
|
||||||
;------------------------------------------------------------------------------
|
|
||||||
; ClearOffscreen
|
|
||||||
; clear $2000..$3FFF or $4000..$5FFF, depending on which HGR page is not
|
|
||||||
; visible right now
|
|
||||||
; does not change HGR mode
|
|
||||||
;
|
|
||||||
; in: none
|
|
||||||
; out: $2000..$3FFF or $4000..$5FFF cleared
|
|
||||||
; A = 0
|
|
||||||
; X = 0
|
|
||||||
; Y = 0
|
|
||||||
; Z = 1
|
|
||||||
;------------------------------------------------------------------------------
|
|
||||||
ClearOffscreen
|
|
||||||
jsr GetOffscreenAddress
|
|
||||||
+HIDE_NEXT_2_BYTES
|
|
||||||
.ClearHGR1
|
|
||||||
lda #$20
|
|
||||||
sta @a+2
|
|
||||||
ldx #$20
|
|
||||||
lda #$80
|
|
||||||
ldy #0
|
|
||||||
@a sta $2000,y
|
|
||||||
iny
|
|
||||||
bne @a
|
|
||||||
inc @a+2
|
|
||||||
dex
|
|
||||||
bne @a
|
|
||||||
rts
|
|
||||||
|
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
; IsSearchKey
|
; IsSearchKey
|
||||||
; test whether accumulator contains a key that might trigger a new textrank
|
; test whether accumulator contains a key that might trigger a new textrank
|
||||||
|
@ -24,11 +24,10 @@ SearchMode
|
|||||||
stx SelectedIndex ; $FF = no game selected
|
stx SelectedIndex ; $FF = no game selected
|
||||||
inx
|
inx
|
||||||
stx OffscreenPage ; $00 = currently showing HGR page 2
|
stx OffscreenPage ; $00 = currently showing HGR page 2
|
||||||
jsr Home ; clear screen
|
jsr Home ; clear screen (switches to text mode)
|
||||||
jsr .OnInputChanged ; draw UI on HGR page 1
|
jsr .OnInputChanged ; draw UI on HGR page 1
|
||||||
+HGR_MODE ; show HGR
|
jsr HGRMode ; show HGR screen
|
||||||
bit CLEARKBD
|
bit CLEARKBD
|
||||||
jsr ResetInputTimeout
|
|
||||||
|
|
||||||
.SearchModeInputLoop
|
.SearchModeInputLoop
|
||||||
jsr WaitForKeyFor30Seconds
|
jsr WaitForKeyFor30Seconds
|
||||||
@ -46,7 +45,7 @@ SearchMode
|
|||||||
@arrow ldx #kInputBrowse
|
@arrow ldx #kInputBrowse
|
||||||
bne @InputDispatch ; always branches
|
bne @InputDispatch ; always branches
|
||||||
@notArrow
|
@notArrow
|
||||||
jsr ResetInputTimeout
|
bit CLEARKBD
|
||||||
|
|
||||||
ldy #kNumBrowseKeys
|
ldy #kNumBrowseKeys
|
||||||
- dey
|
- dey
|
||||||
|
Loading…
Reference in New Issue
Block a user