From a09816b51441213e757c17eadba9547568766f29 Mon Sep 17 00:00:00 2001 From: 4am Date: Sun, 24 Oct 2021 01:29:48 -0400 Subject: [PATCH] shave some bytes --- src/constants.a | 2 +- src/ui.attract.hgr.a | 52 ++++++++++++++++++-------------------------- 2 files changed, 22 insertions(+), 32 deletions(-) diff --git a/src/constants.a b/src/constants.a index 3f86e6737..8fea09930 100644 --- a/src/constants.a +++ b/src/constants.a @@ -7,7 +7,7 @@ ; ; LC RAM BANK 1 ; D000..E7D2 - persistent data structures (gGlobalPrefsStore, gGamesListStore) -; E9E8..FFEE - main program code +; E9D5..FFEE - main program code ; FFEF..FFF9 - API functions and global constants available for main program ; code, prelaunchers, transition effects, &c. ; (LoadFileDirect, Wait/UnwaitForVBL, MockingboardStuff, MachineStatus) diff --git a/src/ui.attract.hgr.a b/src/ui.attract.hgr.a index 4296fc0cd..c727849d3 100644 --- a/src/ui.attract.hgr.a +++ b/src/ui.attract.hgr.a @@ -48,21 +48,8 @@ HGRActionSlideshow ; graphics mode still displaying hi-res screen with last picture visible ;------------------------------------------------------------------------------ HGRSingle - +ST16 @fname - - jsr LoadHGRActionIndex - - jsr okvs_find - !word HGRActionIndexPtr -@fname !word $FDFD ; SMC - +ST16 @indexRecordPtr - - jsr LoadIndexedFile ; load compressed HGR screenshot at $3FF8 - !word kHGRActionDataFile - !word $3FF8 -@indexRecordPtr - !word $FDFD ; SMC - + +ST16 IndexedHGRFilename + jsr LoadIndexedHGRFile jsr DecompressHGR jsr LoadHGRTransition ; load transition effect code at $6000 jmp ExecuteTransitionAt6000AndWait @@ -151,7 +138,7 @@ HGRActionCallback bit KBD bmi HGRRTS - +ST16 @fname + +ST16 IndexedHGRFilename jsr FindGameInActionSlideshow ; if game name is not found (C will be set here), it means the game @@ -165,24 +152,14 @@ HGRActionCallback +LD16 WINDEX ; save game index in case user hits RETURN +ST16 gGameToLaunch ; while it's visible (we'll launch it) - +LD16 @fname - jsr LoadHGRActionIndex - - jsr okvs_find - !word HGRActionIndexPtr -@fname !word $FDFD ; SMC - +ST16 @indexRecordPtr - - jsr LoadIndexedFile ; load compressed HGR screenshot at $3FF8 - !word kHGRActionDataFile - !word $3FF8 -@indexRecordPtr - !word $FDFD ; SMC - + jsr LoadIndexedHGRFile jsr DecompressHGR jmp DrawGameTitleInActionSlideshow -LoadHGRActionIndex +LoadIndexedHGRFile +; in: caller has set IndexedHGRFilename +; out: all flags & registers clobbered + +LD16 IndexedHGRFilename +ST16 PTR ldy #1 lda (PTR), y @@ -193,9 +170,22 @@ LoadHGRActionIndex clc adc #$30 ; A = "0".."6" (ASCII) sta gHGRActionIndexNumber ; part of kHGRActionIndexFile + jsr LoadFile ; load index file into $4000 !word kRootDirectory !word kHGRActionIndexFile HGRActionIndexPtr !word $4000 + + jsr okvs_find + !word HGRActionIndexPtr +IndexedHGRFilename + !word $FDFD ; SMC + +ST16 @indexRecordPtr + + jsr LoadIndexedFile ; load compressed HGR screenshot at $3FF8 + !word kHGRActionDataFile + !word $3FF8 +@indexRecordPtr + !word $FDFD ; SMC rts