-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
84 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
;License:MIT | ||
;(c) 2018-9 by 4am | ||
; | ||
; UI functions for doing things then waiting, or waiting then doing things | ||
; | ||
; - ExecuteTransitionAndWait | ||
; - WaitForKeyFor30Seconds | ||
; - CoverFade | ||
|
||
; /!\ execution falls through here from ui.attract.dhgr/DHGRActionCallback | ||
;------------------------------------------------------------------------------ | ||
; 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 | ||
+STAY @j+1 | ||
@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 | ||
bne ConvenientlyPlacedRTS | ||
bit CLEARKBD | ||
ConvenientlyPlacedRTS | ||
rts | ||
|
||
; /!\ keep this last in the file to ensure it doesn't cross a page boundary /!\ | ||
;------------------------------------------------------------------------------ | ||
; 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 | ||
bmi ConvenientlyPlacedRTS | ||
|
||
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 | ||
CoverFade | ||
jsr LoadCoverOffscreen | ||
jsr ShowOtherPage | ||
lda OffscreenPage | ||
bne + | ||
jsr LoadCoverOffscreen | ||
jsr ShowOtherPage | ||
+ jsr LoadFile ; load transition effect code at $6000 | ||
!word kFXDirectory | ||
!word kCoverFadeFile | ||
!word $6000 | ||
jsr $6000 ; call transition effect | ||
jmp MegaAttractMode ; exit via mega attract mode |