From b8dd0b05bd7ca3a8a3dd46456ece966dfee5c0f1 Mon Sep 17 00:00:00 2001 From: 4am Date: Sat, 30 May 2020 11:14:04 -0400 Subject: [PATCH] shave some bytes --- src/constants.a | 2 +- src/glue.launch.a | 33 ++++++++++++++++----------------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/constants.a b/src/constants.a index 270d04731..10ad2d273 100644 --- a/src/constants.a +++ b/src/constants.a @@ -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) diff --git a/src/glue.launch.a b/src/glue.launch.a index 7ed82eba5..10664a9c7 100644 --- a/src/glue.launch.a +++ b/src/glue.launch.a @@ -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 ;------------------------------------------------------------------------------