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
; D000..E82E - persistent data structures (gGlobalPrefsStore, gGamesListStore)
; ...unused...
; E917..FFF1 - main program code
; E91D..FFF1 - main program code
; FFF2..FFF9 - API functions and global constants available for main program
; code, prelaunchers, transition effects, &c.
; (Wait/UnwaitForVBL, MockingboardStuff, MachineStatus)

View File

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