shave some bytes

This commit is contained in:
4am 2019-10-07 23:47:36 -04:00
parent 0a6e9b90ff
commit 370ea947cd
5 changed files with 108 additions and 120 deletions

View File

@ -9,7 +9,7 @@
; D000..E611 - persistent data structures (per-game cheat categories,
; gGlobalPrefsStore, gGamesListStore)
; ...unused...
; EBE4..FFF9 - main program code
; EBEC..FFF9 - main program code
; FFFA..FFFF - NMI, reset, IRQ vectors
;
; LC RAM BANK 2

View File

@ -12,42 +12,39 @@
DHGRTitleSlideshow
bit MachineStatus ; only run DHGR slideshow if we have 128K
bvs +
rts
+ jsr .LoadDHGRTransition ; load transition effect code at $6000
- rts
+ 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
!word .DHGRTitleCallback ; address of callback (called on each file)
!word DHGRTitleCallback ; address of callback (called on each file)
jmp BlankHGR ; switch back to HGR mode with initial blank screen on exit
DHGRActionSlideshow
bit MachineStatus ; only run DHGR slideshow if we have 128K
bvs +
rts
+ jsr .LoadDHGRTransition ; load transition effect code at $6000
bvc -
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
!word .DHGRActionCallback ; address of callback (called on each file)
!word DHGRActionCallback ; address of callback (called on each file)
jmp BlankHGR ; switch back to HGR mode with initial blank screen on exit
DHGRSingle
bit MachineStatus ; only show DHGR screenshots if we have 128K
bvs +
rts
+
+STAY @fname
bvc -
+STAY +
jsr BlankDHGR ; switch to DHGR mode with initial blank screen
jsr LoadDHRFile ; load DHGR file at $4000/main and $4000/aux
!word kRootDirectory
@fname !word $FDFD ; SMC
+ jsr .LoadDHGRTransition ; load transition effect code at $6000
+ !word $FDFD ; SMC
jsr LoadDHGRTransition ; load transition effect code at $6000
+LDADDR $6000
jsr ExecuteTransitionAndWait
jmp BlankHGR ; switch back to HGR mode with initial blank screen on exit
;------------------------------------------------------------------------------
; .LoadDHGRTransition [private]
; LoadDHGRTransition [private]
; looks up name of next DHGR transition effect in DFX.CONF and loads that file
; at $6000
@ -56,7 +53,7 @@ DHGRSingle
; out: all registers and flags clobbered
; $6000..$BFFF/main contains transition effect code
;------------------------------------------------------------------------------
.LoadDHGRTransition
LoadDHGRTransition
jsr LoadFile ; load DHGR transition effects list into $8000
!word kRootDirectory
!word kDFXConfFile
@ -69,7 +66,7 @@ DHGRSingle
jsr pref_get ; get DHGR transition effect from prefs
!word kNextDFX
!word gDFXStore
+STAY @filename ; A/Y = filename (don't load file yet)
+STAY ++ ; A/Y = filename (don't load file yet)
; X = index of the transition in DFX store
+LDADDR gDFXStore
jsr okvs_next ; get transition after this one
@ -81,12 +78,12 @@ DHGRSingle
jsr LoadFile ; now load transition effect code into $6000
!word kFXDirectory
@filename !word $FDFD ; SMC
++ !word $FDFD ; SMC
!word $6000
rts
- rts
;------------------------------------------------------------------------------
; .DHGRTitleCallback [private]
; DHGRTitleCallback [private]
; callback called by okvs_iter on gSlideshowStore
; to load and display a single DHGR title screenshot
@ -97,30 +94,29 @@ DHGRSingle
; $2000..$BFFF clobbered by graphics data and transition code
; $2000..$5FFF/aux clobbered
;------------------------------------------------------------------------------
.DHGRTitleCallback
DHGRTitleCallback
bit KBD
bpl +
@exit rts
+
+STAY @tfname
bmi -
+STAY +
jsr GetGameDisplayName
; 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
bcs @exit
bcs -
stx gGameToLaunch
; load DHGR screenshot at $4000/main and $4000/aux
jsr LoadDHRFile
!word kDHGRTitleDirectory
@tfname !word $FDFD
+ !word $FDFD
+LDADDR $6000
jmp ExecuteTransitionAndWait
;------------------------------------------------------------------------------
; .DHGRActionCallback [private]
; DHGRActionCallback [private]
; callback called by okvs_iter on gSlideshowStore
; to load and display a single DHGR action screenshot
@ -131,25 +127,23 @@ DHGRSingle
; $2000..$BFFF clobbered by graphics data and transition code
; $2000..$5FFF/aux clobbered
;------------------------------------------------------------------------------
.DHGRActionCallback
DHGRActionCallback
bit KBD
bpl +
@actionExit
rts
+
+STAY @afname
bmi -
+STAY +
jsr GetGameDisplayNameInActionSlideshow
; 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
bcs @actionExit
bcs -
stx gGameToLaunch
; load DHGR screenshot at $4000/main and $4000/aux
jsr LoadDHRFile
!word kDHGRActionDirectory
@afname !word $FDFD
+ !word $FDFD
+LDADDR $6000
jmp ExecuteTransitionAndWait

View File

@ -65,7 +65,7 @@ BlankGR
!word kFXDirectory
!word kGRFizzleFile
!word $6400
rts
- rts
;------------------------------------------------------------------------------
; .GRActionCallback [private]
@ -81,22 +81,20 @@ BlankGR
;------------------------------------------------------------------------------
.GRActionCallback
bit KBD
bpl +
@actionExit
rts
+
+STAY @fname
bmi -
+STAY +
jsr GetGameDisplayNameInActionSlideshow
; 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
bcs @actionExit
bcs -
stx gGameToLaunch
jsr LoadFile ; load GR screenshot into $6000
!word kGRActionDirectory
@fname !word $FDFD ; SMC
+ !word $FDFD ; SMC
!word $6000
+LDADDR $6400

View File

@ -10,17 +10,17 @@
;
HGRTitleSlideshow
jsr .LoadHGRTransition ; load transition effect code at $6000
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)
!word HGRTitleCallback ; address of callback (called on each file)
rts ; exit with last picture still visible
HGRActionSlideshow
jsr .LoadHGRTransition ; load transition effect code at $6000
jsr LoadHGRTransition ; load transition effect code at $6000
jsr okvs_iter ; cycle through all listed HGR files
!word gSlideshowStore
!word .HGRActionCallback ; address of callback (called on each file)
!word HGRActionCallback ; address of callback (called on each file)
rts ; exit with last picture still visible
HGRSingle
@ -29,12 +29,50 @@ HGRSingle
!word kRootDirectory
@fname !word $FDFD ; SMC
!word $4000
jsr .LoadHGRTransition ; load transition effect code at $6000
jsr LoadHGRTransition ; load transition effect code at $6000
+LDADDR $6000
jmp ExecuteTransitionAndWait
;------------------------------------------------------------------------------
; .HGRTitleCallback [private]
; LoadHGRTransition [private]
; looks up name of next HGR transition effect in FX.CONF and loads that file
; at $6000
; in: gGlobalPrefsStore has been initialized
; out: all registers and flags clobbered
; $6000..$BFFF contains transition effect code
;------------------------------------------------------------------------------
LoadHGRTransition
jsr LoadFile ; load HGR transition effects list into $8000
!word kRootDirectory
!word kFXConfFile
- !word $8000
jsr ParseKeyValueList ; parse HGR transition effects list into $6000
!word gFXStore
!word -
!byte 0
jsr pref_get ; get HGR transition effect from prefs
!word kNextFX
!word gFXStore
+STAY ++ ; A/Y = filename (don't load file yet)
; X = index of the transition in FX store
+LDADDR gFXStore
jsr okvs_next ; get transition after this one
+STAY +
jsr pref_set ; update prefs store and save to disk
!word kNextFX
+ !word $FDFD ; SMC
jsr LoadFile ; now load transition effect code into $6000
!word kFXDirectory
++ !word $FDFD ; SMC
!word $6000
- rts
;------------------------------------------------------------------------------
; HGRTitleCallback [private]
; callback called by okvs_iter on gSlideshowStore
; to load and display a single HGR title screenshot
@ -44,30 +82,29 @@ HGRSingle
; $0800..$1EFF preserved (this contains the gSlideshowStore OKVS data)
; $2000..$BFFF clobbered by graphics data and transition code
;------------------------------------------------------------------------------
.HGRTitleCallback
HGRTitleCallback
bit KBD
bpl +
@exit rts
+
+STAY @tfname
bmi -
+STAY +
jsr GetGameDisplayName
; 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
bcs @exit
bcs -
stx gGameToLaunch
jsr LoadFile ; load HGR screenshot at $4000
!word kHGRTitleDirectory
@tfname !word $FDFD ; SMC
+ !word $FDFD ; SMC
!word $4000
+LDADDR $6000
jmp ExecuteTransitionAndWait
;------------------------------------------------------------------------------
; .HGRActionCallback [private]
; HGRActionCallback [private]
; callback called by okvs_iter on gSlideshowStore
; to load and display a single HGR action screenshot
@ -78,19 +115,17 @@ HGRSingle
; $0800..$1EFF preserved (this contains the gSlideshowStore OKVS data)
; $2000..$BFFF clobbered by graphics data and transition code
;------------------------------------------------------------------------------
.HGRActionCallback
HGRActionCallback
bit KBD
bpl +
@actionExit
rts
+
+STAY @afname
bmi -
+STAY +
jsr GetGameDisplayNameInActionSlideshow
; 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
bcs @actionExit
bcs -
; found the game
+STAY SAVE
@ -98,7 +133,7 @@ HGRSingle
jsr LoadFile ; load HGR screenshot at $4000
!word kHGRActionDirectory
@afname !word $FDFD ; SMC
+ !word $FDFD ; SMC
!word $4000
; display game name in the bottom-left corner
@ -140,41 +175,3 @@ HGRSingle
+LDADDR gPathname
sec
jmp DrawString
;------------------------------------------------------------------------------
; .LoadHGRTransition [private]
; looks up name of next HGR transition effect in FX.CONF and loads that file
; at $6000
; in: gGlobalPrefsStore has been initialized
; out: all registers and flags clobbered
; $6000..$BFFF contains transition effect code
;------------------------------------------------------------------------------
.LoadHGRTransition
jsr LoadFile ; load HGR transition effects list into $8000
!word kRootDirectory
!word kFXConfFile
- !word $8000
jsr ParseKeyValueList ; parse HGR transition effects list into $6000
!word gFXStore
!word -
!byte 0
jsr pref_get ; get HGR transition effect from prefs
!word kNextFX
!word gFXStore
+STAY @filename ; A/Y = filename (don't load file yet)
; X = index of the transition in FX store
+LDADDR gFXStore
jsr okvs_next ; get transition after this one
+STAY +
jsr pref_set ; update prefs store and save to disk
!word kNextFX
+ !word $FDFD ; SMC
jsr LoadFile ; now load transition effect code into $6000
!word kFXDirectory
@filename !word $FDFD ; SMC
!word $6000
rts

View File

@ -12,37 +12,36 @@ SHRSlideshow
lda MachineStatus ; only show SHR on IIgs or if we have a VidHD card
and #SUPPORTS_SHR
bne +
rts
+ jsr .LoadSHRTransition
- rts
+ jsr LoadSHRTransition
jsr okvs_iter
!word gSlideshowStore
!word .SHRArtworkCallback
!word SHRArtworkCallback
jmp BlankHGR
SHRSingle
+STAY @fname
+STAY +
lda MachineStatus ; only show SHR on IIgs or if we have a VidHD card
and #SUPPORTS_SHR
bne +
rts
+ jsr .BlankSHR
beq -
jsr BlankSHR
jsr LoadFile
!word kRootDirectory
@fname !word $FDFD ; SMC
+ !word $FDFD ; SMC
!word $2000
jsr .LoadSHRTransition
jsr LoadSHRTransition
+LDADDR $A000
jsr ExecuteTransitionAndWait
jmp BlankHGR
;------------------------------------------------------------------------------
; .LoadSHGRTransition [private]
; LoadSHGRTransition [private]
;
; in: none
; out: all registers and flags clobbered
; $A000..$BFFF/main contains transition effect code
;------------------------------------------------------------------------------
.LoadSHRTransition
LoadSHRTransition
jsr LoadFile
!word kFXDirectory
!word kSFXFizzleFile
@ -61,10 +60,10 @@ SHRSingle
; $2000..$BFFF clobbered by graphics data and transition code
; $2000..$5FFF/aux clobbered
;------------------------------------------------------------------------------
.SHRArtworkCallback
SHRArtworkCallback
bit KBD
bpl +
@exit rts
- rts
+
+STAY @sfname
@ -72,10 +71,10 @@ SHRSingle
; 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
bcs @exit
bcs -
stx gGameToLaunch
jsr .BlankSHR
jsr BlankSHR
; load SHR artwork at $2000/main (not aux)
jsr LoadFile
@ -98,7 +97,7 @@ SHRSingle
; out: text page clobbered (but screen holes preserved)
; $2000..$9FFF/aux cleared
;------------------------------------------------------------------------------
.BlankSHR
BlankSHR
jsr Home
lda NEWVIDEO ; set GS NEWVIDEO mode to turn on linearize