2019-10-08 17:31:41 +00:00
|
|
|
;License:MIT
|
2020-03-17 01:58:05 +00:00
|
|
|
;(c) 2018-2020 by 4am
|
2019-10-08 17:31:41 +00:00
|
|
|
;
|
|
|
|
; UI functions for doing things then waiting, or waiting then doing things
|
|
|
|
;
|
2019-10-14 02:22:47 +00:00
|
|
|
; - ExecuteTransitionAt6000AndWait
|
|
|
|
; - ExecuteTransitionAtA000AndWait
|
2019-10-08 17:31:41 +00:00
|
|
|
; - ExecuteTransitionAndWait
|
|
|
|
; - WaitForKeyFor30Seconds
|
|
|
|
; - CoverFade
|
|
|
|
|
2019-10-10 02:21:46 +00:00
|
|
|
ExecuteTransitionAt6000AndWait
|
|
|
|
ldy #$60
|
|
|
|
+HIDE_NEXT_2_BYTES
|
|
|
|
ExecuteTransitionAtA000AndWait
|
|
|
|
ldy #$A0
|
2019-10-14 02:22:47 +00:00
|
|
|
; /!\ execution falls through here to ExecuteTransitionAndWait
|
2019-10-08 17:31:41 +00:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; 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
|
2019-10-10 02:21:46 +00:00
|
|
|
lda #0
|
2020-03-24 20:30:14 +00:00
|
|
|
+ST16 @j+1
|
2019-10-08 17:31:41 +00:00
|
|
|
@j jsr $FDFD ; SMC call transition effect code
|
|
|
|
ldx #$20 ; picture is showing so now we wait
|
|
|
|
- lda #0
|
|
|
|
jsr WaitForKeyWithTimeout
|
|
|
|
bmi +
|
|
|
|
dex
|
|
|
|
bpl -
|
|
|
|
+ lda KBD
|
|
|
|
cmp #$95
|
2019-10-08 19:01:19 +00:00
|
|
|
bne WAITRTS
|
2019-10-08 17:31:41 +00:00
|
|
|
bit CLEARKBD
|
2019-10-08 19:01:19 +00:00
|
|
|
WAITRTS rts
|
2019-10-08 17:31:41 +00:00
|
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; WaitForKeyFor30Seconds
|
|
|
|
; does what it says on the tin
|
|
|
|
;
|
|
|
|
; in: none
|
|
|
|
; out: if user presses a key before the timer runs out, exits with A = key
|
|
|
|
; and X/Y preserved
|
|
|
|
; otherwise exits via MegaAttractMode and everything is clobbered
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
WaitForKeyFor30Seconds
|
|
|
|
lda #$16 ; initialize timeout counters
|
|
|
|
sta Timeout
|
|
|
|
sta Timeout+1
|
|
|
|
sta Timeout+2
|
|
|
|
@loop
|
|
|
|
lda KBD
|
2019-10-08 19:01:19 +00:00
|
|
|
bmi WAITRTS
|
2019-10-08 17:31:41 +00:00
|
|
|
|
|
|
|
inc RNDSEED+1 ; these are only ever incremented, never
|
|
|
|
bne + ; reset (may be used as a pseudorandom
|
|
|
|
inc RNDSEED ; seed)
|
|
|
|
+
|
|
|
|
dec Timeout
|
|
|
|
bne @loop
|
|
|
|
dec Timeout+1
|
|
|
|
bne @loop
|
|
|
|
dec Timeout+2
|
|
|
|
bne @loop
|
|
|
|
; /!\ execution falls through here to CoverFade
|
2019-10-14 02:22:47 +00:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; CoverFade
|
|
|
|
; load cover file and execute a specific transition effect on it
|
|
|
|
;
|
|
|
|
; in: none
|
|
|
|
; out: exits via MegaAttractMode and everything is clobbered
|
|
|
|
;------------------------------------------------------------------------------
|
2019-10-08 17:31:41 +00:00
|
|
|
CoverFade
|
2020-03-09 22:05:01 +00:00
|
|
|
jsr ForceHGRMode
|
2019-10-08 17:31:41 +00:00
|
|
|
jsr LoadCoverOffscreen
|
|
|
|
jsr ShowOtherPage
|
|
|
|
lda OffscreenPage
|
2019-11-27 21:51:43 +00:00
|
|
|
beq CoverFade
|
|
|
|
jsr LoadFile ; load transition effect code at $6000
|
2019-10-08 17:31:41 +00:00
|
|
|
!word kFXDirectory
|
|
|
|
!word kCoverFadeFile
|
|
|
|
!word $6000
|
|
|
|
jsr $6000 ; call transition effect
|
|
|
|
jmp MegaAttractMode ; exit via mega attract mode
|
2019-10-10 20:32:47 +00:00
|
|
|
!if (RELBASE != $2000) and (>WaitForKeyFor30Seconds != >*) {
|
|
|
|
!error "WaitForKeyFor30Seconds crossed a page (", WaitForKeyFor30Seconds, " to ", *
|
|
|
|
}
|