shave some bytes

This commit is contained in:
4am 2020-05-30 11:14:04 -04:00
parent 977df4c9f2
commit b8dd0b05bd
2 changed files with 17 additions and 18 deletions

View File

@ -8,7 +8,7 @@
; LC RAM BANK 1 ; LC RAM BANK 1
; D000..E82E - persistent data structures (gGlobalPrefsStore, gGamesListStore) ; D000..E82E - persistent data structures (gGlobalPrefsStore, gGamesListStore)
; ...unused... ; ...unused...
; E917..FFF1 - main program code ; E91D..FFF1 - main program code
; FFF2..FFF9 - API functions and global constants available for main program ; FFF2..FFF9 - API functions and global constants available for main program
; code, prelaunchers, transition effects, &c. ; code, prelaunchers, transition effects, &c.
; (Wait/UnwaitForVBL, MockingboardStuff, MachineStatus) ; (Wait/UnwaitForVBL, MockingboardStuff, MachineStatus)

View File

@ -30,10 +30,9 @@ gGameToLaunch
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
AnyGameSelected AnyGameSelected
+LD16 gGameToLaunch +LD16 gGameToLaunch
+CMP16 $FFFF ; CMP sets carry when equal +CMP16 $FFFF
beq + bne ForceGoodResult
clc rts ; CMP sets carry when equal
+ rts
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; GetGameToLaunch ; GetGameToLaunch
@ -46,12 +45,14 @@ AnyGameSelected
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
GetGameToLaunch GetGameToLaunch
jsr AnyGameSelected jsr AnyGameSelected
bcs @exit bcs _gameToLaunchExit
+ST16 WINDEX +ST16 WINDEX
+LDADDR gGamesListStore +LDADDR gGamesListStore
jsr okvs_nth jsr okvs_nth
ForceGoodResult
clc clc
@exit rts _gameToLaunchExit
rts
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; FindGame ; FindGame
@ -71,7 +72,7 @@ FindGame
jsr okvs_find jsr okvs_find
!word gGamesListStore !word gGamesListStore
@key !word $FDFD ; SMC @key !word $FDFD ; SMC
bcc @exit bcc GlueLaunchRTS
; Hack to allow self-running demos that don't correspond to a game ; Hack to allow self-running demos that don't correspond to a game
; filename. If the name ends in a '.', accept it unconditionally. ; filename. If the name ends in a '.', accept it unconditionally.
ldx #$FF ldx #$FF
@ -84,12 +85,10 @@ FindGame
tay tay
lda (PARAM),y lda (PARAM),y
cmp #"." cmp #"."
beq @forceGoodResult beq ForceGoodResult
sec sec
GlueLaunchRTS
rts rts
@forceGoodResult
clc
@exit rts
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; FindGameInActionSlideshow ; FindGameInActionSlideshow
@ -108,7 +107,7 @@ FindGame
FindGameInActionSlideshow FindGameInActionSlideshow
+ST16 @sskey +ST16 @sskey
jsr FindGame jsr FindGame
bcc + bcc GetGameDisplayName
; if the game was not found, try getting the value of the current record from ; if the game was not found, try getting the value of the current record from
; gSlideshowStore (some games have multiple action screenshots, in which case ; gSlideshowStore (some games have multiple action screenshots, in which case
; the key is only the screenshot filename, and the value is the actual game ; the key is only the screenshot filename, and the value is the actual game
@ -117,11 +116,8 @@ FindGameInActionSlideshow
!word gSlideshowStore !word gSlideshowStore
@sskey !word $FDFD ; SMC @sskey !word $FDFD ; SMC
jsr FindGame jsr FindGame
bcs @exit bcs GlueLaunchRTS
+ ; /!\ execution falls through here to GetGameDisplayName
jsr GetGameDisplayName
clc
@exit rts
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; GetGameDisplayName ; GetGameDisplayName
@ -134,6 +130,7 @@ FindGameInActionSlideshow
; out of thin air) ; out of thin air)
; gValLen possibly clobbered (up to gValLen+MaxInputLength) ; gValLen possibly clobbered (up to gValLen+MaxInputLength)
; X preserved ; X preserved
; C clear
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
GetGameDisplayName GetGameDisplayName
+ST16 SAVE +ST16 SAVE
@ -144,6 +141,7 @@ GetGameDisplayName
cmp #1 ; 1 means there's no title, just info bitfield (1 byte) cmp #1 ; 1 means there's no title, just info bitfield (1 byte)
beq + beq +
+LD16 PTR +LD16 PTR
clc
rts rts
+ ; game display name is truncated, we must expand it + ; game display name is truncated, we must expand it
iny ; Y = 1 iny ; Y = 1
@ -181,6 +179,7 @@ GetGameDisplayName
pla pla
sta gValLen, y sta gValLen, y
+LDADDR gValLen +LDADDR gValLen
clc
rts rts
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------