2018-11-07 23:56:39 +00:00
|
|
|
;license:MIT
|
|
|
|
;(c) 2018 by 4am
|
|
|
|
;
|
|
|
|
; Mega Attract Mode - cycle through slideshows and self-running demos
|
|
|
|
;
|
|
|
|
; Public functions
|
|
|
|
; - AttractMode
|
|
|
|
;
|
2018-11-17 14:43:20 +00:00
|
|
|
; Public variables
|
2018-11-17 14:54:55 +00:00
|
|
|
; - gAttractIndex ; [byte] numeric index of Mega-Attract Module
|
2018-11-17 14:43:20 +00:00
|
|
|
; - gFXIndex ; [byte] numeric index of HGR transition effect
|
|
|
|
; - gDFXIndex ; [byte] numeric index of DHGR transition effect
|
2018-11-07 23:56:39 +00:00
|
|
|
|
2018-12-29 18:29:17 +00:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; AttractMode
|
|
|
|
; main entry point for Mega Attract Mode, which cycles through modules listed
|
|
|
|
; in ATTRACT.CONF to provide pretty visual effects and snippets of self-running
|
|
|
|
; self-terminating game demos
|
|
|
|
;
|
|
|
|
; in: gGlobalPrefsStore must be initialized
|
|
|
|
; out: exits to caller (note that some attract mode modules never return but
|
|
|
|
; instead call |Reenter|, in which case this routine technically never
|
|
|
|
; returns)
|
|
|
|
; if this routine returns, everything is clobbered (zero page, main
|
|
|
|
; memory, unused portions of the stack page, all registers, all flags)
|
|
|
|
;------------------------------------------------------------------------------
|
2018-11-07 23:56:39 +00:00
|
|
|
AttractMode
|
2018-12-29 18:29:17 +00:00
|
|
|
jsr LoadFile ; load attract-mode configuration file at $8000
|
2018-12-28 20:08:36 +00:00
|
|
|
!word kAttractModeConfFile
|
2018-12-29 18:29:17 +00:00
|
|
|
jsr ParseKeyValueList ; parse attract-mode configuration into OKVS data structure at $6000
|
2018-12-28 20:08:36 +00:00
|
|
|
!word gAttractModeStore
|
2018-12-29 18:29:17 +00:00
|
|
|
!word ldrlo2 ; (ldrlo2) points to last load address, so $8000
|
2018-12-28 20:08:36 +00:00
|
|
|
!byte 0
|
|
|
|
|
|
|
|
jsr okvs_get ; get next attract-mode module from prefs
|
|
|
|
!word gGlobalPrefsStore
|
|
|
|
!word kNextAttract
|
|
|
|
bcs @noattract
|
|
|
|
+STAY @attract
|
|
|
|
jsr okvs_get
|
|
|
|
!word gAttractModeStore
|
|
|
|
@attract !word $FDFD ; SMC
|
|
|
|
bcc +
|
|
|
|
@noattract
|
|
|
|
ldx #0
|
|
|
|
+ stx gAttractIndex
|
|
|
|
|
2018-11-07 23:56:39 +00:00
|
|
|
jsr okvs_nth ; get filename of next attract-mode module
|
|
|
|
!word gAttractModeStore
|
2018-11-17 14:54:55 +00:00
|
|
|
gAttractIndex
|
|
|
|
!byte 0
|
2018-11-07 23:56:39 +00:00
|
|
|
+STAY @key
|
|
|
|
|
2018-11-17 14:54:55 +00:00
|
|
|
inc gAttractIndex ; increment module index for next time
|
2018-11-07 23:56:39 +00:00
|
|
|
jsr okvs_len
|
|
|
|
!word gAttractModeStore
|
2018-11-17 14:54:55 +00:00
|
|
|
cmp gAttractIndex
|
2018-11-07 23:56:39 +00:00
|
|
|
bne +
|
|
|
|
lda #0
|
2018-11-17 14:54:55 +00:00
|
|
|
sta gAttractIndex
|
2018-11-07 23:56:39 +00:00
|
|
|
+
|
2018-11-17 14:54:55 +00:00
|
|
|
lda gAttractIndex
|
|
|
|
sta @nexti
|
|
|
|
jsr okvs_nth ; get name of next attract-mode module
|
|
|
|
!word gAttractModeStore
|
|
|
|
@nexti !byte $FD ; SMC
|
|
|
|
+STAY @nextattract
|
|
|
|
|
|
|
|
jsr okvs_update ; save name of next attract-mode module in prefs store
|
|
|
|
!word gGlobalPrefsStore
|
|
|
|
!word kNextAttract
|
|
|
|
@nextattract
|
|
|
|
!word $FDFD ; SMC
|
|
|
|
|
|
|
|
; jsr SaveGlobalPreferences ; write prefs store to disk
|
|
|
|
|
2018-11-07 23:56:39 +00:00
|
|
|
jsr okvs_get
|
|
|
|
!word gAttractModeStore
|
2018-12-29 18:29:17 +00:00
|
|
|
@key !word $FDFD ; SMC
|
2018-11-07 23:56:39 +00:00
|
|
|
+STAY PTR
|
|
|
|
|
|
|
|
jsr @RunNextAttractModule
|
|
|
|
lda $C000
|
|
|
|
bpl AttractMode
|
|
|
|
rts
|
|
|
|
|
|
|
|
@RunNextAttractModule
|
|
|
|
ldy #1
|
|
|
|
lda (PTR),y
|
|
|
|
and #$0F
|
|
|
|
bne @Slideshow
|
|
|
|
|
2018-12-29 18:29:17 +00:00
|
|
|
; Self-running demos are loaded into main memory and executed.
|
|
|
|
; Each binary has been patched to quit on any key and jump back
|
|
|
|
; to the |Reenter| entry point.
|
|
|
|
; All demos are strictly 48K / main memory. No demo uses the
|
|
|
|
; language card or auxiliary memory.
|
2018-11-11 13:42:53 +00:00
|
|
|
|
|
|
|
jsr Home ; clear text screen and switch to it during loading
|
2018-12-29 18:29:17 +00:00
|
|
|
; to avoid seeing executable code load into the HGR page
|
2018-11-07 23:56:39 +00:00
|
|
|
+LOAD_PATH kDemoDirectory
|
|
|
|
ldy gPathname
|
|
|
|
iny
|
|
|
|
iny
|
|
|
|
sty ProDOS_prefix
|
|
|
|
- lda gPathname-2, y
|
|
|
|
sta ProDOS_prefix, y
|
|
|
|
dey
|
|
|
|
bne -
|
|
|
|
lda #'/'
|
|
|
|
sta ProDOS_prefix+1
|
|
|
|
lda #'X'
|
|
|
|
sta ProDOS_prefix+2
|
|
|
|
|
|
|
|
+LOAD_FILE_IMM @key
|
|
|
|
|
2018-11-26 19:43:39 +00:00
|
|
|
jsr SaveScreenHoles ; save screen hole contents in case game changes them
|
2018-11-11 13:42:53 +00:00
|
|
|
ldx #(End_Prelaunch-Prelaunch-1)
|
|
|
|
- lda Prelaunch,x ; copy pre-launch code to main memory
|
2018-11-07 23:56:39 +00:00
|
|
|
sta $100,x
|
|
|
|
dex
|
|
|
|
bpl -
|
|
|
|
ldx #(end_promote-promote-1)
|
2018-12-29 18:29:17 +00:00
|
|
|
- lda promote,x ; copy ProDOS shim to main memory
|
2018-11-07 23:56:39 +00:00
|
|
|
sta $bf00,x
|
|
|
|
dex
|
|
|
|
bpl -
|
|
|
|
jmp $106 ; jump to pre-launch code
|
|
|
|
|
|
|
|
@Slideshow ; HGR or DHGR slideshow
|
2018-12-29 18:29:17 +00:00
|
|
|
pha ; save module type (1=HGR title, 2=HGR action, 3=DHGR title)
|
2018-11-07 23:56:39 +00:00
|
|
|
|
2018-12-30 02:25:16 +00:00
|
|
|
; load slideshow configuration file at $4000
|
2018-11-07 23:56:39 +00:00
|
|
|
+LOAD_FILE kAttractModeSlideshowDirectory, @key
|
|
|
|
|
2018-12-30 02:25:16 +00:00
|
|
|
jsr ParseKeyValueList ; parse slideshow configuration into an OKVS data structure at $0800
|
2018-11-07 23:56:39 +00:00
|
|
|
!word gSlideshowStore
|
2018-12-30 02:25:16 +00:00
|
|
|
!word ldrlo2 ; (ldrlo2) points to address of last loaded file, so $4000
|
2018-11-11 13:42:53 +00:00
|
|
|
!byte 0
|
2018-11-11 18:56:00 +00:00
|
|
|
|
2018-11-07 23:56:39 +00:00
|
|
|
pla ; restore module type
|
|
|
|
cmp #$01
|
2018-12-29 18:29:17 +00:00
|
|
|
beq @HGRTitleSlideshow
|
|
|
|
cmp #$02
|
|
|
|
beq @HGRActionSlideshow
|
2018-11-07 23:56:39 +00:00
|
|
|
|
2018-12-29 18:29:17 +00:00
|
|
|
@DHGRTitleSlideshow
|
2018-11-17 14:02:43 +00:00
|
|
|
bit MachineStatus ; only run DHGR slideshow if we have 128K
|
2018-11-17 03:41:38 +00:00
|
|
|
bvc @exit
|
2018-11-07 23:56:39 +00:00
|
|
|
jsr LoadDHGRTransition ; load transition effect code at $6000
|
|
|
|
jsr BlankDHGR ; switch to DHGR mode with initial blank screen
|
|
|
|
jsr okvs_iter ; cycle through all listed DHGR files
|
|
|
|
!word gSlideshowStore
|
2018-12-29 18:29:17 +00:00
|
|
|
!word DHGRTitleCallback ; address of callback (called on each file)
|
|
|
|
jmp BlankHGR ; switch back to HGR mode with initial blank screen on exit
|
|
|
|
|
|
|
|
@HGRTitleSlideshow
|
|
|
|
jsr LoadHGRTransition ; load transition effect code at $6000
|
|
|
|
jsr okvs_iter ; cycle through all listed HGR files
|
|
|
|
!word gSlideshowStore
|
|
|
|
!word HGRTitleCallback ; address of callback (called on each file)
|
|
|
|
@exit rts ; exit with last picture still visible
|
2018-11-07 23:56:39 +00:00
|
|
|
|
2018-12-29 18:29:17 +00:00
|
|
|
@HGRActionSlideshow
|
|
|
|
jsr LoadHGRTransition ; load transition effect code at $6000
|
2018-11-07 23:56:39 +00:00
|
|
|
jsr okvs_iter ; cycle through all listed HGR files
|
|
|
|
!word gSlideshowStore
|
2018-12-29 18:29:17 +00:00
|
|
|
!word HGRActionCallback ; address of callback (called on each file)
|
|
|
|
rts ; exit with last picture still visible
|
|
|
|
|
2018-12-28 20:08:36 +00:00
|
|
|
kAttractModeConfFile
|
2018-12-29 18:29:17 +00:00
|
|
|
!byte @kAttractModeConfFile_e-*-1
|
2018-12-28 20:08:36 +00:00
|
|
|
!text "ATTRACT.CONF"
|
|
|
|
@kAttractModeConfFile_e
|
2018-11-07 23:56:39 +00:00
|
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; internal functions
|
|
|
|
|
2018-12-29 18:29:17 +00:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; HGRTitleCallback
|
|
|
|
; callback called by okvs_iter on gSlideshowStore
|
|
|
|
; to load and display a single HGR title screenshot
|
|
|
|
|
|
|
|
; in: A/Y contains address of filename (name only, path is always /HGR/)
|
|
|
|
; X contains 0-based index of the current record in gSlideshowStore
|
|
|
|
; out: all registers and flags clobbered
|
|
|
|
; $0800..$1EFF preserved (this contains the gSlideshowStore OKVS data)
|
|
|
|
; $2000..$BFFF clobbered by graphics data and transition code
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
HGRTitleCallback
|
2018-11-07 23:56:39 +00:00
|
|
|
ldx $C000
|
|
|
|
bpl +
|
|
|
|
rts
|
|
|
|
+
|
|
|
|
+STAY PTR
|
|
|
|
|
|
|
|
; load HGR screenshot at $4000
|
2018-12-29 18:29:17 +00:00
|
|
|
+LOAD_FILE kHGRTitleDirectory, PTR
|
2018-11-07 23:56:39 +00:00
|
|
|
|
2018-12-29 18:29:17 +00:00
|
|
|
jmp ExecuteTransition ; call transition effect code to display picture
|
2018-11-07 23:56:39 +00:00
|
|
|
|
2018-12-29 18:29:17 +00:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; HGRActionCallback
|
|
|
|
; callback called by okvs_iter on gSlideshowStore
|
|
|
|
; to load and display a single HGR action screenshot
|
|
|
|
|
|
|
|
; in: A/Y contains address of filename (name only, path is always /ACTION/)
|
|
|
|
; X contains 0-based index of the current record in gSlideshowStore
|
|
|
|
; gGamesListStore must be initialized
|
|
|
|
; out: all registers and flags clobbered
|
|
|
|
; $0800..$1EFF preserved (this contains the gSlideshowStore OKVS data)
|
|
|
|
; $2000..$BFFF clobbered by graphics data and transition code
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
HGRActionCallback
|
|
|
|
ldx $C000
|
|
|
|
bpl +
|
|
|
|
rts
|
|
|
|
+
|
|
|
|
+STAY PTR
|
|
|
|
+STAY @key
|
|
|
|
+STAY @key2
|
|
|
|
|
|
|
|
; load HGR screenshot at $4000
|
|
|
|
+LOAD_FILE kHGRActionDirectory, PTR
|
2018-11-11 18:56:00 +00:00
|
|
|
|
2018-12-29 18:29:17 +00:00
|
|
|
; try to get the human-readable name of this game from gGamesListStore
|
|
|
|
; and display it in the bottom-left corner
|
|
|
|
jsr okvs_get
|
|
|
|
!word gGamesListStore
|
|
|
|
@key !word $FDFD ; SMC
|
|
|
|
bcc @foundname
|
|
|
|
; if the key is not found, try getting the value of the current record
|
|
|
|
; from gSlideshowStore and using that instead
|
|
|
|
; (some games have multiple action screenshots)
|
|
|
|
jsr okvs_get
|
|
|
|
!word gSlideshowStore
|
|
|
|
@key2 !word $FDFD ; SMC
|
|
|
|
bcs @noname ; should never happen
|
|
|
|
+STAY @key3
|
|
|
|
jsr okvs_get
|
|
|
|
!word gGamesListStore
|
|
|
|
@key3 !word $FDFD ; SMC
|
|
|
|
bcs @noname ; should never happen
|
|
|
|
@foundname
|
|
|
|
+STAY PTR
|
|
|
|
ldx #0
|
|
|
|
stx HTAB
|
|
|
|
ldx #22
|
|
|
|
stx VTAB
|
|
|
|
ldy #0
|
|
|
|
lda (PTR),y
|
|
|
|
tax
|
|
|
|
+LDADDR @topline
|
|
|
|
sec
|
|
|
|
jsr DrawBuffer
|
|
|
|
ldx #3
|
|
|
|
+LDADDR @toprightcorner
|
|
|
|
sec
|
|
|
|
jsr DrawBuffer
|
|
|
|
inc VTAB
|
|
|
|
ldx #0
|
|
|
|
stx HTAB
|
|
|
|
inx
|
|
|
|
+LDADDR @rightline
|
|
|
|
sec
|
|
|
|
jsr DrawBuffer
|
|
|
|
+LDAY PTR
|
|
|
|
sec
|
|
|
|
jsr DrawString
|
|
|
|
ldx #2
|
|
|
|
+LDADDR @rightline
|
|
|
|
sec
|
|
|
|
jsr DrawBuffer
|
|
|
|
@noname
|
|
|
|
jmp ExecuteTransition
|
|
|
|
@topline
|
|
|
|
!byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
|
|
|
!byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
|
|
|
@toprightcorner
|
|
|
|
!byte 0,0,7
|
|
|
|
@rightline
|
|
|
|
!text " "
|
|
|
|
!byte 3
|
|
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; DHGRTitleCallback
|
|
|
|
; callback called by okvs_iter on gSlideshowStore
|
|
|
|
; to load and display a single DHGR title screenshot
|
|
|
|
|
|
|
|
; in: A/Y contains address of filename (name only, path is always /DHGR/)
|
|
|
|
; X contains 0-based index of the current record in gSlideshowStore
|
|
|
|
; gGamesListStore must be initialized
|
|
|
|
; out: all registers and flags clobbered
|
|
|
|
; $0800..$1EFF preserved (this contains the gSlideshowStore OKVS data)
|
|
|
|
; $2000..$BFFF clobbered by graphics data and transition code
|
|
|
|
; $2000..$5FFF/aux clobbered
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
DHGRTitleCallback
|
2018-11-07 23:56:39 +00:00
|
|
|
ldx $C000
|
|
|
|
bpl +
|
|
|
|
rts
|
|
|
|
+
|
|
|
|
; load DHGR screenshot at $4000/main and $4000/aux
|
|
|
|
+STAY PTR
|
|
|
|
jsr ResetPath
|
2018-12-29 18:29:17 +00:00
|
|
|
+LDADDR kDHGRTitleDirectory
|
2018-11-07 23:56:39 +00:00
|
|
|
jsr AddToPath
|
|
|
|
+LDADDR kPathSeparator
|
|
|
|
jsr AddToPath
|
|
|
|
+LDAY PTR
|
|
|
|
jsr AddToPath
|
|
|
|
jsr LoadDHRFile
|
|
|
|
!word gPathname
|
2018-12-29 18:29:17 +00:00
|
|
|
; execution falls through here
|
2018-11-07 23:56:39 +00:00
|
|
|
|
2018-12-29 18:29:17 +00:00
|
|
|
ExecuteTransition
|
2018-11-11 18:56:00 +00:00
|
|
|
jsr $6000 ; call transition effect code to display picture
|
2018-11-07 23:56:39 +00:00
|
|
|
|
2018-12-29 18:29:17 +00:00
|
|
|
ldx #$20 ; picture is already showing so just wait
|
2018-11-07 23:56:39 +00:00
|
|
|
- lda #0
|
|
|
|
jsr WaitForKeyWithTimeout
|
|
|
|
bmi +
|
|
|
|
dex
|
|
|
|
bpl -
|
|
|
|
+ rts
|
|
|
|
|
2018-12-29 18:29:17 +00:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; LoadHGRTransition
|
|
|
|
; looks up name of next HGR transition effect in FX.CONF and loads that file
|
|
|
|
; at $6000
|
|
|
|
|
|
|
|
; in: gFXStore has been initialized
|
|
|
|
; gGlobalPrefsStore has been initialized
|
|
|
|
; out: all registers and flags clobbered
|
|
|
|
; $6000..$BFFF contains transition effect code
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
LoadHGRTransition
|
2018-12-28 20:08:36 +00:00
|
|
|
jsr LoadFile ; load HGR transition effects list into $8000
|
2018-12-28 19:22:57 +00:00
|
|
|
!word kFXConfFile
|
2018-12-28 20:08:36 +00:00
|
|
|
jsr ParseKeyValueList ; parse HGR transition effects list into $6000
|
2018-12-28 19:22:57 +00:00
|
|
|
!word gFXStore
|
|
|
|
!word ldrlo2 ; (ldrlo2) points to last load address
|
|
|
|
!byte 0
|
|
|
|
|
2018-12-28 20:08:36 +00:00
|
|
|
jsr okvs_get ; get next HGR transition effect from prefs
|
|
|
|
!word gGlobalPrefsStore
|
|
|
|
!word kNextFX
|
|
|
|
bcs @nofx
|
|
|
|
+STAY @fx
|
|
|
|
jsr okvs_get
|
|
|
|
!word gFXStore
|
|
|
|
@fx !word $FDFD ; SMC
|
|
|
|
bcc +
|
|
|
|
@nofx ldx #0
|
|
|
|
+ stx gFXIndex
|
|
|
|
|
2018-11-07 23:56:39 +00:00
|
|
|
jsr okvs_nth ; get filename of transition effect code
|
|
|
|
!word gFXStore
|
2018-11-17 14:43:20 +00:00
|
|
|
gFXIndex
|
|
|
|
!byte 0
|
2018-11-07 23:56:39 +00:00
|
|
|
+STAY @fxkey
|
|
|
|
|
2018-11-17 14:43:20 +00:00
|
|
|
inc gFXIndex ; increment transition effect index
|
2018-11-07 23:56:39 +00:00
|
|
|
jsr okvs_len
|
|
|
|
!word gFXStore
|
2018-11-17 14:43:20 +00:00
|
|
|
cmp gFXIndex
|
2018-11-07 23:56:39 +00:00
|
|
|
bne +
|
|
|
|
lda #0
|
2018-11-17 14:43:20 +00:00
|
|
|
sta gFXIndex
|
2018-11-07 23:56:39 +00:00
|
|
|
+
|
2018-11-17 14:43:20 +00:00
|
|
|
lda gFXIndex
|
2018-11-17 14:02:43 +00:00
|
|
|
sta @nexti
|
2018-11-17 14:43:20 +00:00
|
|
|
jsr okvs_nth ; get name of next HGR transition
|
2018-11-17 14:02:43 +00:00
|
|
|
!word gFXStore
|
|
|
|
@nexti !byte $FD ; SMC
|
|
|
|
+STAY @nextfx
|
|
|
|
|
2018-11-17 14:43:20 +00:00
|
|
|
jsr okvs_update ; save name of next HGR transition in prefs store
|
2018-11-17 14:02:43 +00:00
|
|
|
!word gGlobalPrefsStore
|
|
|
|
!word kNextFX
|
|
|
|
@nextfx !word $FDFD ; SMC
|
|
|
|
|
2018-11-17 14:43:20 +00:00
|
|
|
; jsr SaveGlobalPreferences ; write prefs store to disk
|
2018-11-17 14:02:43 +00:00
|
|
|
|
2018-11-07 23:56:39 +00:00
|
|
|
; load transition effect code at $6000
|
|
|
|
+LOAD_FILE kFXDirectory, @fxkey
|
|
|
|
rts
|
|
|
|
@fxkey !word $FDFD
|
2018-12-28 19:22:57 +00:00
|
|
|
kFXConfFile
|
|
|
|
!byte @kFXConfFile_e-@kFXConfFile_b
|
|
|
|
@kFXConfFile_b
|
|
|
|
!text "FX.CONF"
|
|
|
|
@kFXConfFile_e
|
2018-11-07 23:56:39 +00:00
|
|
|
|
2018-12-29 18:29:17 +00:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; LoadDHGRTransition
|
|
|
|
; looks up name of next DHGR transition effect in DFX.CONF and loads that file
|
|
|
|
; at $6000
|
|
|
|
|
|
|
|
; in: gDFXStore has been initialized
|
|
|
|
; gGlobalPrefsStore has been initialized
|
|
|
|
; out: all registers and flags clobbered
|
|
|
|
; $6000..$BFFF/main contains transition effect code
|
|
|
|
;------------------------------------------------------------------------------
|
2018-11-07 23:56:39 +00:00
|
|
|
LoadDHGRTransition
|
2018-12-28 20:08:36 +00:00
|
|
|
jsr LoadFile ; load DHGR transition effects list into $8000
|
2018-12-28 19:22:57 +00:00
|
|
|
!word kDFXConfFile
|
2018-12-28 20:08:36 +00:00
|
|
|
jsr ParseKeyValueList ; parse DHGR transition effects list into $6000
|
2018-12-28 19:22:57 +00:00
|
|
|
!word gDFXStore
|
|
|
|
!word ldrlo2 ; (ldrlo2) points to last load address
|
|
|
|
!byte 0
|
|
|
|
|
2018-12-28 20:08:36 +00:00
|
|
|
jsr okvs_get ; get next DHGR transition effect from prefs
|
|
|
|
!word gGlobalPrefsStore
|
|
|
|
!word kNextDFX
|
|
|
|
bcs @nodfx
|
|
|
|
+STAY @dfx
|
|
|
|
jsr okvs_get
|
|
|
|
!word gDFXStore
|
|
|
|
@dfx !word $FDFD ; SMC
|
|
|
|
bcc +
|
|
|
|
@nodfx ldx #0
|
|
|
|
+ stx gDFXIndex
|
|
|
|
|
2018-11-17 14:43:20 +00:00
|
|
|
jsr okvs_nth ; get filename of DHGR transition effect code
|
2018-11-07 23:56:39 +00:00
|
|
|
!word gDFXStore
|
2018-11-17 14:43:20 +00:00
|
|
|
gDFXIndex
|
2018-11-07 23:56:39 +00:00
|
|
|
!byte 0
|
|
|
|
+STAY @dfxkey
|
|
|
|
|
2018-11-17 14:43:20 +00:00
|
|
|
inc gDFXIndex ; increment transition effect index for next time
|
2018-11-07 23:56:39 +00:00
|
|
|
jsr okvs_len
|
|
|
|
!word gDFXStore
|
2018-11-17 14:43:20 +00:00
|
|
|
cmp gDFXIndex
|
2018-11-07 23:56:39 +00:00
|
|
|
bne +
|
|
|
|
lda #0
|
2018-11-17 14:43:20 +00:00
|
|
|
sta gDFXIndex
|
2018-11-07 23:56:39 +00:00
|
|
|
+
|
2018-11-17 14:43:20 +00:00
|
|
|
lda gDFXIndex
|
|
|
|
sta @nexti
|
|
|
|
jsr okvs_nth ; get name of next DHGR transition
|
|
|
|
!word gDFXStore
|
|
|
|
@nexti !byte $FD ; SMC
|
|
|
|
+STAY @nextdfx
|
|
|
|
|
|
|
|
jsr okvs_update ; save name of next DHGR transition in prefs store
|
|
|
|
!word gGlobalPrefsStore
|
|
|
|
!word kNextDFX
|
|
|
|
@nextdfx !word $FDFD ; SMC
|
|
|
|
|
|
|
|
; jsr SaveGlobalPreferences ; write prefs store to disk
|
|
|
|
|
2018-11-07 23:56:39 +00:00
|
|
|
; load transition effect code at $6000
|
|
|
|
+LOAD_FILE kFXDirectory, @dfxkey
|
|
|
|
rts
|
|
|
|
@dfxkey !word $FDFD
|
2018-12-28 19:22:57 +00:00
|
|
|
kDFXConfFile
|
|
|
|
!byte @kDFXConfFile_e-@kDFXConfFile_b
|
|
|
|
@kDFXConfFile_b
|
|
|
|
!text "DFX.CONF"
|
|
|
|
@kDFXConfFile_e
|
2018-11-07 23:56:39 +00:00
|
|
|
|
2018-12-29 18:29:17 +00:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; BlankHGR
|
|
|
|
; clear and show HGR page 1 without flickering
|
|
|
|
;
|
|
|
|
; in: none
|
|
|
|
; out: text page clobbered (but screen holes preserved)
|
|
|
|
; $2000..$3FFF cleared
|
|
|
|
;------------------------------------------------------------------------------
|
2018-11-07 23:56:39 +00:00
|
|
|
BlankHGR
|
|
|
|
jsr Home
|
|
|
|
jsr ClearHGR1 ; clear hi-res screen 1
|
|
|
|
lda $c057 ; show hi-res screen 1 (now blank)
|
|
|
|
lda $c054
|
|
|
|
lda $c052
|
|
|
|
lda $c050
|
|
|
|
rts
|
2018-12-29 18:29:17 +00:00
|
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; BlankDHGR
|
|
|
|
; clear and show DHGR page 1 without flickering
|
|
|
|
;
|
|
|
|
; in: none
|
|
|
|
; out: text page clobbered (but screen holes preserved)
|
|
|
|
; $2000..$3FFF/main and /aux cleared
|
|
|
|
;------------------------------------------------------------------------------
|
2018-11-07 23:56:39 +00:00
|
|
|
BlankDHGR
|
|
|
|
jsr Home
|
|
|
|
jsr ClearHGR1 ; clear hi-res screen 1
|
|
|
|
sta $C005
|
|
|
|
jsr ClearHGR1 ; clear hi-res screen 1 in auxmem
|
|
|
|
sta $C004
|
|
|
|
sta $c00d
|
|
|
|
sta $c057
|
|
|
|
sta $c054
|
|
|
|
sta $c052
|
|
|
|
sta $c050
|
|
|
|
sta $c05e
|
|
|
|
rts
|
2018-12-29 18:29:17 +00:00
|
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; ClearHGR1
|
|
|
|
; clear $2000..$3FFF in current memory bank (main or auxmem)
|
|
|
|
;
|
|
|
|
; in: none
|
|
|
|
; out: $2000..$3FFF cleared
|
|
|
|
; A = 0
|
|
|
|
; X = 0
|
|
|
|
; Y = 0
|
|
|
|
; Z = 1
|
|
|
|
;------------------------------------------------------------------------------
|
2018-11-07 23:56:39 +00:00
|
|
|
ClearHGR1
|
2018-12-29 18:29:17 +00:00
|
|
|
ldx #$20
|
2018-11-07 23:56:39 +00:00
|
|
|
stx @a+2
|
|
|
|
lda #0
|
|
|
|
tay
|
|
|
|
@a sta $2000,y
|
|
|
|
iny
|
|
|
|
bne @a
|
|
|
|
inc @a+2
|
|
|
|
dex
|
|
|
|
bne @a
|
|
|
|
rts
|
2018-12-29 18:29:17 +00:00
|
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; Home
|
|
|
|
; clear and display text screen
|
|
|
|
;
|
|
|
|
; in: none
|
|
|
|
; out: $0100..$011F clobbered
|
|
|
|
;------------------------------------------------------------------------------
|
2018-11-07 23:56:39 +00:00
|
|
|
Home
|
|
|
|
ldx #(@end-@start-1)
|
|
|
|
- lda @start,x
|
2018-11-11 13:42:53 +00:00
|
|
|
sta $100,x
|
2018-11-07 23:56:39 +00:00
|
|
|
dex
|
|
|
|
bpl -
|
2018-11-11 13:42:53 +00:00
|
|
|
jmp $100
|
2018-11-07 23:56:39 +00:00
|
|
|
@start
|
|
|
|
; this will be run from main memory
|
|
|
|
+READ_ROM_NO_WRITE
|
|
|
|
sta $C00C ; get out of DHGR mode
|
|
|
|
sta $C05F ; get out of DHGR mode
|
|
|
|
jsr $FB2F ; TEXT
|
|
|
|
jsr $FC58 ; HOME
|
|
|
|
+READ_RAM1_WRITE_RAM1
|
|
|
|
rts
|
|
|
|
@end
|
2018-11-11 13:42:53 +00:00
|
|
|
|
2018-12-29 18:29:17 +00:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; Prelaunch
|
|
|
|
; code to set up machine for running a self-running, self-terminating game demo
|
|
|
|
; DO NOT CALL DIRECTLY
|
|
|
|
; must be run from main memory
|
|
|
|
; contains multiple entry points
|
|
|
|
;
|
|
|
|
; in: none
|
|
|
|
; out: exits via JMP (ldrlo2), which is expected to exit via JMP |Prelaunch|
|
|
|
|
; (not here, but wherever it was copied to in main memory) or by
|
|
|
|
; manually enabling LC RAM bank 1 then JMP |Reenter|
|
|
|
|
;------------------------------------------------------------------------------
|
2018-11-11 13:42:53 +00:00
|
|
|
Prelaunch ; this runs from main memory
|
2018-12-29 18:29:17 +00:00
|
|
|
; entry point used by some self-running demos
|
|
|
|
lda $C088
|
2018-11-11 13:42:53 +00:00
|
|
|
jmp Reenter
|
2018-12-29 18:29:17 +00:00
|
|
|
|
|
|
|
; entry point to launch game
|
|
|
|
+READ_ROM_NO_WRITE
|
|
|
|
jsr $FE89 ; initialize machine like a cold boot (many
|
|
|
|
jsr $FE93 ; games assume a 'clean slate' and rely on
|
|
|
|
jsr $FE84 ; zero page values set by these ROM routines)
|
2018-11-11 13:42:53 +00:00
|
|
|
sta $C000
|
|
|
|
sta $C002
|
|
|
|
sta $C004
|
|
|
|
sta $C00C
|
|
|
|
sta $C00E
|
|
|
|
jsr $FB2F
|
|
|
|
jsr $FC58
|
|
|
|
ldx #$FF
|
|
|
|
txs
|
|
|
|
jmp (ldrlo2) ; jump to game
|
|
|
|
End_Prelaunch
|