2021-10-18 05:04:17 +00:00
|
|
|
;license:MIT
|
2021-10-12 23:37:45 +00:00
|
|
|
;(c) 2018-2021 by 4am & qkumba
|
2019-01-15 00:06:58 +00:00
|
|
|
;
|
|
|
|
; Double hi-res slideshows
|
|
|
|
;
|
|
|
|
; Public functions
|
|
|
|
; - DHGRTitleSlideshow
|
2019-06-26 02:44:39 +00:00
|
|
|
; - DHGRActionSlideshow
|
|
|
|
; - DHGRSingle
|
2019-10-08 17:39:06 +00:00
|
|
|
; - BlankHGR
|
|
|
|
; - HGRMode
|
2020-04-01 15:57:21 +00:00
|
|
|
; - GRMode
|
|
|
|
; - ForceHGRMode
|
|
|
|
; - DrawGameTitleInActionSlideshow
|
2020-03-09 21:24:30 +00:00
|
|
|
; - RedrawForDHGR
|
2019-01-15 00:06:58 +00:00
|
|
|
;
|
|
|
|
|
2019-10-14 02:22:47 +00:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; DHGRTitleSlideshow
|
|
|
|
; execute a slideshow of double hi-res title screenshots
|
|
|
|
;
|
|
|
|
; safe to call if machine only has 64K (does nothing and exits)
|
|
|
|
;
|
|
|
|
; in: none
|
|
|
|
; out: everything clobbered
|
|
|
|
; graphics mode reset to display hi-res screen, which is blank
|
|
|
|
;------------------------------------------------------------------------------
|
2019-01-15 00:06:58 +00:00
|
|
|
DHGRTitleSlideshow
|
2019-06-27 13:51:17 +00:00
|
|
|
bit MachineStatus ; only run DHGR slideshow if we have 128K
|
2019-10-08 23:14:12 +00:00
|
|
|
bvc DHGRRTS
|
|
|
|
jsr LoadDHGRTransition ; load transition effect code at $6000
|
2019-01-15 00:06:58 +00:00
|
|
|
jsr BlankDHGR ; switch to DHGR mode with initial blank screen
|
|
|
|
jsr okvs_iter ; cycle through all listed DHGR files
|
|
|
|
!word gSlideshowStore
|
2019-10-08 03:47:36 +00:00
|
|
|
!word DHGRTitleCallback ; address of callback (called on each file)
|
2019-10-08 17:39:06 +00:00
|
|
|
beq BlankHGR ; switch back to HGR mode with initial blank screen on exit
|
2019-10-08 17:40:53 +00:00
|
|
|
; (always branches because Z=1 on exit of okvs_iter)
|
2019-01-15 00:06:58 +00:00
|
|
|
|
2019-10-14 02:22:47 +00:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; DHGRActionSlideshow
|
|
|
|
; execute a slideshow of double hi-res action screenshots
|
|
|
|
;
|
|
|
|
; safe to call if machine only has 64K (does nothing and exits)
|
|
|
|
;
|
|
|
|
; in: none
|
|
|
|
; out: everything clobbered
|
|
|
|
; graphics mode reset to display hi-res screen, which is blank
|
|
|
|
;------------------------------------------------------------------------------
|
2019-02-09 01:48:07 +00:00
|
|
|
DHGRActionSlideshow
|
2019-06-27 13:51:17 +00:00
|
|
|
bit MachineStatus ; only run DHGR slideshow if we have 128K
|
2019-10-08 18:53:27 +00:00
|
|
|
bvc DHGRRTS
|
2019-10-08 03:47:36 +00:00
|
|
|
jsr LoadDHGRTransition ; load transition effect code at $6000
|
2019-02-09 01:48:07 +00:00
|
|
|
jsr BlankDHGR ; switch to DHGR mode with initial blank screen
|
|
|
|
jsr okvs_iter ; cycle through all listed DHGR files
|
|
|
|
!word gSlideshowStore
|
2019-10-08 03:47:36 +00:00
|
|
|
!word DHGRActionCallback ; address of callback (called on each file)
|
2019-10-08 17:39:06 +00:00
|
|
|
beq BlankHGR ; switch back to HGR mode with initial blank screen on exit
|
2019-10-08 17:40:53 +00:00
|
|
|
; (always branches because Z=1 on exit of okvs_iter)
|
2019-02-09 01:48:07 +00:00
|
|
|
|
2019-10-14 02:22:47 +00:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; DHGRSingle
|
|
|
|
; display a single double hi-res screenshot, with transition effect
|
|
|
|
;
|
|
|
|
; safe to call if machine only has 64K (does nothing and exits)
|
|
|
|
;
|
|
|
|
; in: none
|
|
|
|
; out: everything clobbered
|
|
|
|
; graphics mode reset to display hi-res screen, which is blank
|
|
|
|
;------------------------------------------------------------------------------
|
2019-06-26 02:44:39 +00:00
|
|
|
DHGRSingle
|
2019-06-27 13:51:17 +00:00
|
|
|
bit MachineStatus ; only show DHGR screenshots if we have 128K
|
2019-10-08 18:53:27 +00:00
|
|
|
bvc DHGRRTS
|
2021-10-24 05:14:25 +00:00
|
|
|
+ST16 IndexedDHGRFilename
|
2019-06-27 02:51:34 +00:00
|
|
|
jsr BlankDHGR ; switch to DHGR mode with initial blank screen
|
2021-10-24 05:14:25 +00:00
|
|
|
jsr LoadIndexedDHGRFile ; load compressed DHGR screenshot at aux $3FF8
|
2020-03-12 19:36:01 +00:00
|
|
|
jsr DecompressDHGR
|
2019-10-08 03:47:36 +00:00
|
|
|
jsr LoadDHGRTransition ; load transition effect code at $6000
|
2019-10-10 02:21:46 +00:00
|
|
|
jsr ExecuteTransitionAt6000AndWait
|
2019-10-08 17:39:06 +00:00
|
|
|
; switch back to HGR mode with initial blank screen on exit
|
|
|
|
; /!\ execution falls through here to BlankHGR
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; BlankHGR
|
|
|
|
; clear and show HGR page 1 without flickering
|
|
|
|
;
|
|
|
|
; in: none
|
|
|
|
; out: text page clobbered (but screen holes preserved)
|
2019-10-08 23:31:56 +00:00
|
|
|
; A/X/Y=0 (guaranteed by ClearHGR1)
|
2019-10-08 17:39:06 +00:00
|
|
|
; $2000..$3FFF cleared
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
BlankHGR
|
|
|
|
jsr Home
|
|
|
|
jsr ClearHGR1 ; clear hi-res screen 1
|
|
|
|
bit PAGE1 ; show hi-res screen 1 (now blank)
|
2020-03-09 22:05:01 +00:00
|
|
|
lda #1
|
|
|
|
sta OffscreenPage
|
2019-10-08 17:39:06 +00:00
|
|
|
; /!\ execution falls through here to HGRMode
|
|
|
|
;------------------------------------------------------------------------------
|
2020-04-01 15:57:21 +00:00
|
|
|
; HGRMode / GRMode
|
|
|
|
; twiddles softswitches to set (H)GR mode (does not set page 1 or 2)
|
2019-10-08 17:39:06 +00:00
|
|
|
;
|
|
|
|
; in: none
|
|
|
|
; out: all registers preserved
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
HGRMode
|
|
|
|
bit $C057
|
2019-11-27 21:51:43 +00:00
|
|
|
GRMode
|
2019-10-08 17:39:06 +00:00
|
|
|
bit $C052
|
|
|
|
bit $C050
|
2019-10-08 23:14:12 +00:00
|
|
|
DHGRRTS rts
|
2019-06-26 02:44:39 +00:00
|
|
|
|
2020-03-17 01:58:05 +00:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; ForceHGRMode
|
|
|
|
; if machine is in DHGR mode, switch it back to HGR mode
|
|
|
|
; otherwise do nothing
|
|
|
|
;
|
|
|
|
; in: none
|
|
|
|
; out: see BlankHGR
|
|
|
|
;------------------------------------------------------------------------------
|
2020-03-09 22:05:01 +00:00
|
|
|
ForceHGRMode
|
|
|
|
gMachineInDHGRMode=*+1
|
2020-03-17 01:58:05 +00:00
|
|
|
lda #$00 ; SMC
|
2020-03-09 22:05:01 +00:00
|
|
|
bne BlankHGR
|
2021-10-08 06:28:11 +00:00
|
|
|
rts
|
2020-03-09 22:05:01 +00:00
|
|
|
|
2019-01-15 00:06:58 +00:00
|
|
|
;------------------------------------------------------------------------------
|
2019-10-08 03:47:36 +00:00
|
|
|
; LoadDHGRTransition [private]
|
2019-01-15 00:06:58 +00:00
|
|
|
; 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
|
|
|
|
;------------------------------------------------------------------------------
|
2019-10-08 03:47:36 +00:00
|
|
|
LoadDHGRTransition
|
2021-11-13 01:46:05 +00:00
|
|
|
jsr LoadIndexedFile ; load DHGR transition effects list into $6000
|
|
|
|
!word kTotalIndexFile
|
2021-10-12 23:37:45 +00:00
|
|
|
- !word $6000
|
2021-11-13 01:46:05 +00:00
|
|
|
!word kDFXIndexRecord
|
2019-01-15 00:06:58 +00:00
|
|
|
|
2019-09-16 16:36:10 +00:00
|
|
|
jsr pref_get ; get DHGR transition effect from prefs
|
2019-01-15 00:06:58 +00:00
|
|
|
!word kNextDFX
|
2021-10-12 23:37:45 +00:00
|
|
|
!word -
|
2021-10-13 22:04:56 +00:00
|
|
|
+ST16 @indexRecordPtr ; A/Y = filename (don't load file yet)
|
2020-03-24 20:30:14 +00:00
|
|
|
; $WINDEX = index of the transition in DFX store
|
2021-10-12 23:37:45 +00:00
|
|
|
+LDADDR -
|
2019-09-16 16:36:10 +00:00
|
|
|
jsr okvs_next ; get transition after this one
|
2020-03-24 20:30:14 +00:00
|
|
|
+ST16 +
|
2019-01-15 00:06:58 +00:00
|
|
|
|
2019-09-16 16:36:10 +00:00
|
|
|
jsr pref_set ; update prefs store and save to disk
|
2019-01-15 00:06:58 +00:00
|
|
|
!word kNextDFX
|
2019-09-16 16:36:10 +00:00
|
|
|
+ !word $FDFD ; SMC
|
2019-01-15 00:06:58 +00:00
|
|
|
|
2021-10-13 22:04:56 +00:00
|
|
|
jsr LoadIndexedFile
|
2021-11-09 18:05:33 +00:00
|
|
|
!word kTotalDataFile
|
2021-10-12 23:37:45 +00:00
|
|
|
!word $6000
|
2021-10-13 22:04:56 +00:00
|
|
|
@indexRecordPtr
|
|
|
|
!word $FDFD ; SMC
|
2021-10-12 23:37:45 +00:00
|
|
|
rts
|
2019-01-15 00:06:58 +00:00
|
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
2019-10-08 03:47:36 +00:00
|
|
|
; DHGRTitleCallback [private]
|
2019-01-15 00:06:58 +00:00
|
|
|
; callback called by okvs_iter on gSlideshowStore
|
|
|
|
; to load and display a single DHGR title screenshot
|
|
|
|
|
2019-07-15 15:42:05 +00:00
|
|
|
; in: A/Y contains address of filename (name only, path is always /TITLE.DHGR/)
|
2020-03-24 20:30:14 +00:00
|
|
|
; $WINDEX contains 0-based index of the current record in gSlideshowStore (word)
|
2019-01-15 00:06:58 +00:00
|
|
|
; 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
|
|
|
|
;------------------------------------------------------------------------------
|
2019-10-08 03:47:36 +00:00
|
|
|
DHGRTitleCallback
|
2019-09-10 02:38:17 +00:00
|
|
|
bit KBD
|
2019-10-08 23:14:12 +00:00
|
|
|
bmi DHGRRTS
|
2019-10-08 03:47:36 +00:00
|
|
|
|
2020-03-24 20:30:14 +00:00
|
|
|
+ST16 +
|
2021-11-03 01:49:41 +00:00
|
|
|
+ST16 gLastMegaAttractGame
|
2019-01-15 00:06:58 +00:00
|
|
|
|
2020-03-18 16:08:39 +00:00
|
|
|
jsr FindGame
|
2019-09-21 03:26:32 +00:00
|
|
|
; if game is not found (C will be set here), it means it can't be played on
|
|
|
|
; this machine due to memory or joystick requirements, so we don't display
|
|
|
|
; it in slideshows
|
2019-10-08 23:15:30 +00:00
|
|
|
bcs DHGRRTS
|
2020-03-24 20:30:14 +00:00
|
|
|
|
|
|
|
+LD16 WINDEX ; save game index in case user hits RETURN
|
|
|
|
+ST16 gGameToLaunch ; while it's visible (we'll launch it)
|
2019-07-08 19:03:25 +00:00
|
|
|
|
2019-01-15 00:06:58 +00:00
|
|
|
; load DHGR screenshot at $4000/main and $4000/aux
|
|
|
|
jsr LoadDHRFile
|
2019-09-10 02:38:17 +00:00
|
|
|
!word kDHGRTitleDirectory
|
2019-10-08 03:47:36 +00:00
|
|
|
+ !word $FDFD
|
2019-09-10 02:38:17 +00:00
|
|
|
|
2019-10-10 02:21:46 +00:00
|
|
|
jmp ExecuteTransitionAt6000AndWait
|
2019-01-15 00:06:58 +00:00
|
|
|
|
2019-02-09 01:48:07 +00:00
|
|
|
;------------------------------------------------------------------------------
|
2019-10-08 03:47:36 +00:00
|
|
|
; DHGRActionCallback [private]
|
2019-02-09 01:48:07 +00:00
|
|
|
; callback called by okvs_iter on gSlideshowStore
|
|
|
|
; to load and display a single DHGR action screenshot
|
|
|
|
|
2019-07-15 15:42:05 +00:00
|
|
|
; in: A/Y contains address of filename (name only, path is always /ACTION.DHGR/)
|
2020-03-24 20:30:14 +00:00
|
|
|
; $WINDEX contains 0-based index of the current record in gSlideshowStore (word)
|
2019-02-09 01:48:07 +00:00
|
|
|
; 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
|
|
|
|
;------------------------------------------------------------------------------
|
2019-10-08 03:47:36 +00:00
|
|
|
DHGRActionCallback
|
2019-09-10 02:38:17 +00:00
|
|
|
bit KBD
|
2019-10-08 23:14:12 +00:00
|
|
|
bmi DHGRRTS
|
2019-10-08 03:47:36 +00:00
|
|
|
|
2021-10-24 05:14:25 +00:00
|
|
|
+ST16 IndexedDHGRFilename
|
2019-02-09 01:48:07 +00:00
|
|
|
|
2020-03-18 16:08:39 +00:00
|
|
|
jsr FindGameInActionSlideshow
|
2019-09-21 03:26:32 +00:00
|
|
|
; if game name is not found (C will be set here), it means the game
|
|
|
|
; can't be played due to memory or joystick requirements, so we hide
|
|
|
|
; it from slideshows
|
2019-10-08 23:15:30 +00:00
|
|
|
bcs DHGRRTS
|
2019-07-08 19:03:25 +00:00
|
|
|
|
2021-10-24 05:14:25 +00:00
|
|
|
jsr LoadIndexedDHGRFile
|
2020-03-12 19:36:01 +00:00
|
|
|
jsr DecompressDHGR
|
2019-09-10 02:38:17 +00:00
|
|
|
|
2020-03-08 19:10:07 +00:00
|
|
|
lda #$EA ; NOP
|
|
|
|
+HIDE_NEXT_2_BYTES
|
2020-04-01 15:57:21 +00:00
|
|
|
; /!\ execution falls through here to DrawGameTitleInActionSlideshowHGR
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; DrawGameTitleInActionSlideshow
|
|
|
|
; draw the game title in the lower left corner of the screen
|
|
|
|
;
|
|
|
|
; /!\ exits via ExecuteTransitionAt6000AndWait, and the transition code must
|
|
|
|
; already be loaded at $6000
|
|
|
|
;
|
|
|
|
; in: none
|
|
|
|
; out: exits via ExecuteTransitionAt6000AndWait
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
DrawGameTitleInActionSlideshow
|
2020-03-08 19:10:07 +00:00
|
|
|
lda #$60 ; RTS
|
2020-03-09 21:24:30 +00:00
|
|
|
sta @fallthroughForDHGR
|
2020-03-08 19:10:07 +00:00
|
|
|
|
2020-03-08 02:06:49 +00:00
|
|
|
; display game name in the bottom-left corner
|
|
|
|
lda #22
|
|
|
|
sta VTAB
|
|
|
|
lda #0 ; solid horizontal bar character
|
|
|
|
jsr @resetline
|
2021-10-27 17:06:04 +00:00
|
|
|
lda (SAVE),y ; (SAVE) -> game display name, Y = 0, so A = display length
|
2020-03-08 02:06:49 +00:00
|
|
|
clc
|
2021-10-27 17:06:04 +00:00
|
|
|
adc #$03
|
2020-03-08 02:06:49 +00:00
|
|
|
sta gPathname
|
|
|
|
lda #7 ; top-right rounded corner character
|
|
|
|
jsr @drawline
|
|
|
|
|
|
|
|
lda #" "
|
|
|
|
jsr @resetline
|
2021-10-27 17:06:04 +00:00
|
|
|
lda (SAVE),y ; A = display length
|
2020-03-08 02:06:49 +00:00
|
|
|
tay
|
|
|
|
- lda (SAVE),y
|
|
|
|
sta gPathname+1,y
|
|
|
|
dey
|
|
|
|
bne -
|
|
|
|
lda #3 ; solid vertical bar character
|
|
|
|
jsr @drawline
|
|
|
|
|
|
|
|
jmp ExecuteTransitionAt6000AndWait
|
|
|
|
@resetline
|
|
|
|
ldy #40
|
|
|
|
- sta gPathname,y
|
|
|
|
dey
|
|
|
|
bne -
|
|
|
|
sty HTAB
|
|
|
|
rts
|
|
|
|
@drawline
|
|
|
|
ldy gPathname
|
|
|
|
sta gPathname,y
|
|
|
|
+LDADDR gPathname
|
|
|
|
sec
|
|
|
|
jsr DrawString
|
2020-03-09 21:24:30 +00:00
|
|
|
@fallthroughForDHGR
|
2020-03-08 19:10:07 +00:00
|
|
|
nop ; SMC
|
2020-03-09 21:24:30 +00:00
|
|
|
; /!\ execution sometimes falls through here to RedrawForDHGR
|
|
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; RedrawForDHGR
|
|
|
|
; After drawing text on HGR screen, this will transform the low-level bytes
|
|
|
|
; to display properly on the DHGR screen.
|
|
|
|
;
|
|
|
|
; /!\ must be called immediately after calling one of the font drawing routines
|
2021-10-18 04:33:34 +00:00
|
|
|
; (Draw40Chars, DrawCenteredString, DrawString)
|
2020-03-09 21:24:30 +00:00
|
|
|
;
|
|
|
|
; in: gPathname contains number of bytes to transform
|
2020-03-09 21:40:43 +00:00
|
|
|
; DBIRow0/LC2 contains address of first byte of first row to transform
|
|
|
|
; (this will be true if you just called DrawBufferInternal or
|
|
|
|
; something that calls it, see above)
|
|
|
|
; out: clobbers zero page $00,$01,$02,$26,$27,$F7
|
2020-03-09 21:24:30 +00:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
RedrawForDHGR
|
2020-03-08 19:10:07 +00:00
|
|
|
jsr SwitchToBank2
|
2020-03-24 20:30:14 +00:00
|
|
|
+LD16 DBIRow0+1
|
|
|
|
+ST16 $26
|
2020-03-08 19:48:58 +00:00
|
|
|
lda #8
|
|
|
|
sta i
|
|
|
|
-- ldy gPathname
|
|
|
|
dey
|
2020-03-09 21:40:43 +00:00
|
|
|
- lda ($26),y
|
|
|
|
+HGR_BYTE_TO_DHGR_BYTES
|
|
|
|
sta ($26),y
|
2020-03-08 19:48:58 +00:00
|
|
|
txa
|
2020-03-08 02:06:49 +00:00
|
|
|
sta WRITEAUXMEM
|
2020-03-09 21:40:43 +00:00
|
|
|
sta ($26),y
|
2020-03-08 02:06:49 +00:00
|
|
|
sta WRITEMAINMEM
|
2020-03-08 19:48:58 +00:00
|
|
|
dey
|
|
|
|
bpl -
|
2020-03-09 21:40:43 +00:00
|
|
|
lda $27
|
2020-03-08 19:48:58 +00:00
|
|
|
clc
|
|
|
|
adc #$04
|
2020-03-09 21:40:43 +00:00
|
|
|
sta $27
|
2020-03-08 19:48:58 +00:00
|
|
|
dec i
|
|
|
|
bne --
|
2020-03-08 02:06:49 +00:00
|
|
|
jmp SwitchToBank1
|
2021-10-24 05:14:25 +00:00
|
|
|
|
|
|
|
LoadIndexedDHGRFile
|
|
|
|
; in: caller has set IndexedDHGRFilename
|
|
|
|
; out: all flags & registers clobbered
|
2021-11-13 01:46:05 +00:00
|
|
|
jsr LoadIndexedFile ; load index file into $4000
|
|
|
|
!word kTotalIndexFile
|
2021-10-24 05:14:25 +00:00
|
|
|
- !word $4000
|
2021-11-13 01:46:05 +00:00
|
|
|
!word kDHGRActionIndexRecord
|
2021-10-24 05:14:25 +00:00
|
|
|
|
|
|
|
jsr okvs_find
|
|
|
|
!word -
|
|
|
|
IndexedDHGRFilename
|
|
|
|
!word $FDFD ; SMC
|
|
|
|
+ST16 @indexRecordPtr
|
|
|
|
|
|
|
|
jsr LoadAuxIndexedFile ; load compressed DHGR screenshot at aux $3FF8
|
2021-11-09 18:05:33 +00:00
|
|
|
!word kTotalDataFile
|
2021-10-24 05:14:25 +00:00
|
|
|
!word $3FF8
|
|
|
|
@indexRecordPtr
|
|
|
|
!word $FDFD ; SMC
|
|
|
|
rts
|