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, ; D000..E611 - persistent data structures (per-game cheat categories,
; gGlobalPrefsStore, gGamesListStore) ; gGlobalPrefsStore, gGamesListStore)
; ...unused... ; ...unused...
; EBE4..FFF9 - main program code ; EBEC..FFF9 - main program code
; FFFA..FFFF - NMI, reset, IRQ vectors ; FFFA..FFFF - NMI, reset, IRQ vectors
; ;
; LC RAM BANK 2 ; LC RAM BANK 2

View File

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

View File

@@ -65,7 +65,7 @@ BlankGR
!word kFXDirectory !word kFXDirectory
!word kGRFizzleFile !word kGRFizzleFile
!word $6400 !word $6400
rts - rts
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; .GRActionCallback [private] ; .GRActionCallback [private]
@@ -81,22 +81,20 @@ BlankGR
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
.GRActionCallback .GRActionCallback
bit KBD bit KBD
bpl + bmi -
@actionExit
rts +STAY +
+
+STAY @fname
jsr GetGameDisplayNameInActionSlideshow jsr GetGameDisplayNameInActionSlideshow
; if game name is not found (C will be set here), it means the game ; 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 ; can't be played due to memory or joystick requirements, so we hide
; it from slideshows ; it from slideshows
bcs @actionExit bcs -
stx gGameToLaunch stx gGameToLaunch
jsr LoadFile ; load GR screenshot into $6000 jsr LoadFile ; load GR screenshot into $6000
!word kGRActionDirectory !word kGRActionDirectory
@fname !word $FDFD ; SMC + !word $FDFD ; SMC
!word $6000 !word $6000
+LDADDR $6400 +LDADDR $6400

View File

@@ -10,17 +10,17 @@
; ;
HGRTitleSlideshow 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 jsr okvs_iter ; cycle through all listed HGR files
!word gSlideshowStore !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 rts ; exit with last picture still visible
HGRActionSlideshow 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 jsr okvs_iter ; cycle through all listed HGR files
!word gSlideshowStore !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 rts ; exit with last picture still visible
HGRSingle HGRSingle
@@ -29,12 +29,50 @@ HGRSingle
!word kRootDirectory !word kRootDirectory
@fname !word $FDFD ; SMC @fname !word $FDFD ; SMC
!word $4000 !word $4000
jsr .LoadHGRTransition ; load transition effect code at $6000 jsr LoadHGRTransition ; load transition effect code at $6000
+LDADDR $6000 +LDADDR $6000
jmp ExecuteTransitionAndWait 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 ; callback called by okvs_iter on gSlideshowStore
; to load and display a single HGR title screenshot ; to load and display a single HGR title screenshot
@@ -44,30 +82,29 @@ HGRSingle
; $0800..$1EFF preserved (this contains the gSlideshowStore OKVS data) ; $0800..$1EFF preserved (this contains the gSlideshowStore OKVS data)
; $2000..$BFFF clobbered by graphics data and transition code ; $2000..$BFFF clobbered by graphics data and transition code
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
.HGRTitleCallback HGRTitleCallback
bit KBD bit KBD
bpl + bmi -
@exit rts
+ +STAY +
+STAY @tfname
jsr GetGameDisplayName jsr GetGameDisplayName
; if game is not found (C will be set here), it means it can't be played on ; 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 ; this machine due to memory or joystick requirements, so we don't display
; it in slideshows ; it in slideshows
bcs @exit bcs -
stx gGameToLaunch stx gGameToLaunch
jsr LoadFile ; load HGR screenshot at $4000 jsr LoadFile ; load HGR screenshot at $4000
!word kHGRTitleDirectory !word kHGRTitleDirectory
@tfname !word $FDFD ; SMC + !word $FDFD ; SMC
!word $4000 !word $4000
+LDADDR $6000 +LDADDR $6000
jmp ExecuteTransitionAndWait jmp ExecuteTransitionAndWait
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; .HGRActionCallback [private] ; HGRActionCallback [private]
; callback called by okvs_iter on gSlideshowStore ; callback called by okvs_iter on gSlideshowStore
; to load and display a single HGR action screenshot ; to load and display a single HGR action screenshot
@@ -78,19 +115,17 @@ HGRSingle
; $0800..$1EFF preserved (this contains the gSlideshowStore OKVS data) ; $0800..$1EFF preserved (this contains the gSlideshowStore OKVS data)
; $2000..$BFFF clobbered by graphics data and transition code ; $2000..$BFFF clobbered by graphics data and transition code
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
.HGRActionCallback HGRActionCallback
bit KBD bit KBD
bpl + bmi -
@actionExit
rts +STAY +
+
+STAY @afname
jsr GetGameDisplayNameInActionSlideshow jsr GetGameDisplayNameInActionSlideshow
; if game name is not found (C will be set here), it means the game ; 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 ; can't be played due to memory or joystick requirements, so we hide
; it from slideshows ; it from slideshows
bcs @actionExit bcs -
; found the game ; found the game
+STAY SAVE +STAY SAVE
@@ -98,7 +133,7 @@ HGRSingle
jsr LoadFile ; load HGR screenshot at $4000 jsr LoadFile ; load HGR screenshot at $4000
!word kHGRActionDirectory !word kHGRActionDirectory
@afname !word $FDFD ; SMC + !word $FDFD ; SMC
!word $4000 !word $4000
; display game name in the bottom-left corner ; display game name in the bottom-left corner
@@ -140,41 +175,3 @@ HGRSingle
+LDADDR gPathname +LDADDR gPathname
sec sec
jmp DrawString 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 lda MachineStatus ; only show SHR on IIgs or if we have a VidHD card
and #SUPPORTS_SHR and #SUPPORTS_SHR
bne + bne +
rts - rts
+ jsr .LoadSHRTransition + jsr LoadSHRTransition
jsr okvs_iter jsr okvs_iter
!word gSlideshowStore !word gSlideshowStore
!word .SHRArtworkCallback !word SHRArtworkCallback
jmp BlankHGR jmp BlankHGR
SHRSingle SHRSingle
+STAY @fname +STAY +
lda MachineStatus ; only show SHR on IIgs or if we have a VidHD card lda MachineStatus ; only show SHR on IIgs or if we have a VidHD card
and #SUPPORTS_SHR and #SUPPORTS_SHR
bne + beq -
rts jsr BlankSHR
+ jsr .BlankSHR
jsr LoadFile jsr LoadFile
!word kRootDirectory !word kRootDirectory
@fname !word $FDFD ; SMC + !word $FDFD ; SMC
!word $2000 !word $2000
jsr .LoadSHRTransition jsr LoadSHRTransition
+LDADDR $A000 +LDADDR $A000
jsr ExecuteTransitionAndWait jsr ExecuteTransitionAndWait
jmp BlankHGR jmp BlankHGR
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; .LoadSHGRTransition [private] ; LoadSHGRTransition [private]
; ;
; in: none ; in: none
; out: all registers and flags clobbered ; out: all registers and flags clobbered
; $A000..$BFFF/main contains transition effect code ; $A000..$BFFF/main contains transition effect code
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
.LoadSHRTransition LoadSHRTransition
jsr LoadFile jsr LoadFile
!word kFXDirectory !word kFXDirectory
!word kSFXFizzleFile !word kSFXFizzleFile
@@ -61,10 +60,10 @@ SHRSingle
; $2000..$BFFF clobbered by graphics data and transition code ; $2000..$BFFF clobbered by graphics data and transition code
; $2000..$5FFF/aux clobbered ; $2000..$5FFF/aux clobbered
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
.SHRArtworkCallback SHRArtworkCallback
bit KBD bit KBD
bpl + bpl +
@exit rts - rts
+ +
+STAY @sfname +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 ; 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 ; this machine due to memory or joystick requirements, so we don't display
; it in slideshows ; it in slideshows
bcs @exit bcs -
stx gGameToLaunch stx gGameToLaunch
jsr .BlankSHR jsr BlankSHR
; load SHR artwork at $2000/main (not aux) ; load SHR artwork at $2000/main (not aux)
jsr LoadFile jsr LoadFile
@@ -98,7 +97,7 @@ SHRSingle
; out: text page clobbered (but screen holes preserved) ; out: text page clobbered (but screen holes preserved)
; $2000..$9FFF/aux cleared ; $2000..$9FFF/aux cleared
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
.BlankSHR BlankSHR
jsr Home jsr Home
lda NEWVIDEO ; set GS NEWVIDEO mode to turn on linearize lda NEWVIDEO ; set GS NEWVIDEO mode to turn on linearize