From 979cfc86358f0399c31de6e1208732288a276bb6 Mon Sep 17 00:00:00 2001 From: 4am Date: Fri, 30 Mar 2018 13:19:14 -0400 Subject: [PATCH] minor optimizations --- res/text/spellbreaker.txt | 2 +- src/launch.a | 29 +++++++++-------------------- src/parse.gameinfo.a | 1 - src/parse.gamelist.a | 1 - src/parse.prefs.a | 1 - src/path.a | 5 ++--- src/prodos.a | 16 ++++++---------- src/ui.main.keys.a | 1 - 8 files changed, 18 insertions(+), 38 deletions(-) diff --git a/res/text/spellbreaker.txt b/res/text/spellbreaker.txt index ed8ff16..a6348e5 100644 --- a/res/text/spellbreaker.txt +++ b/res/text/spellbreaker.txt @@ -26,7 +26,7 @@ it look easy." The answer is Barsap. [versions] -R87.DEPROT.Z3=Release elease 87 / Serial number 860904 +R87.DEPROT.Z3=Release 87 / Serial number 860904 R63.DEPROT.Z3=Release 63 / Serial number 850916 [options] diff --git a/src/launch.a b/src/launch.a index d8316bc..1ed10ff 100644 --- a/src/launch.a +++ b/src/launch.a @@ -84,7 +84,6 @@ LaunchInterpreter jsr LoadInterpreter bcs .playError -; change prefix to folder of file we want the interpreter to open jsr ResetPath +LDADDR kGameRootDirectory jsr AddToPath @@ -92,30 +91,21 @@ LaunchInterpreter jsr okvs_get !word gGlobalPrefsStore !word kLastPlayed + +STAY + jsr AddToPath - jsr SetPrefix + jsr SetPrefix ; set ProDOS prefix to game directory !word gPathname bcs .playError -; put just the filename at $2006 - +LDAY addrVersions - +STAY $00 - ldy #0 -- lda ($00),y - cmp #$BD ; '=' - beq .doneBuildingFilename - iny - and #$7F - sta $2006,y - bra - -.doneBuildingFilename - sty $2006 + jsr okvs_get + !word gGlobalPrefsStore ++ !word $FDFD ; SMC + jsr SetStartupPath ; store game filename at $2006 -; shut down WeeGUI and transfer control to interpreter - jsr ExitWeeGUI - jsr SetInterpreterOptions - jmp kSystemAddress + jsr ExitWeeGUI ; shut down WeeGUI + jsr SetInterpreterOptions ; set options struct at $300 + jmp kSystemAddress ; exit via interpreter LoadInterpreter jsr ResetPath @@ -125,7 +115,6 @@ LoadInterpreter jsr LoadFile !word gPathname !word kSystemAddress - !word $2000 !word kProDOSFileBuffer rts .interpreterFilename diff --git a/src/parse.gameinfo.a b/src/parse.gameinfo.a index 9cf9830..3c2eee9 100644 --- a/src/parse.gameinfo.a +++ b/src/parse.gameinfo.a @@ -53,7 +53,6 @@ LoadGameInfo jsr LoadFile !word gPathname !word $0800 - !word $1400 !word kProDOSFileBuffer lda #$FF diff --git a/src/parse.gamelist.a b/src/parse.gamelist.a index a8a72d0..42376ec 100644 --- a/src/parse.gamelist.a +++ b/src/parse.gamelist.a @@ -20,7 +20,6 @@ LoadGameList jsr LoadFile ; load prefs file at $2000 !word .gamesListFilename .handle !word $2000 - !word $2000 !word kProDOSFileBuffer jsr ParseKeyValueText ; parse contents into games list store diff --git a/src/parse.prefs.a b/src/parse.prefs.a index 6766d8c..c8ac39e 100644 --- a/src/parse.prefs.a +++ b/src/parse.prefs.a @@ -54,7 +54,6 @@ LoadGlobalPreferences jsr LoadFile ; load prefs file at $2000 !word .globalPrefsFilename .handle !word $2000 - !word $2000 !word kProDOSFileBuffer jsr ParseKeyValueText ; parse contents into global prefs store diff --git a/src/path.a b/src/path.a index add57e1..02537e4 100644 --- a/src/path.a +++ b/src/path.a @@ -12,6 +12,8 @@ ; - gPathname ; +gPathname = $3F00 + ;------------------------------------------------------------------------------ ; ResetPath ; reset gPathname to length 0 @@ -74,6 +76,3 @@ SetStartupPath bpl - rts } - -gPathname - !fill 65 ; enough zeroes for any ProDOS pathname diff --git a/src/prodos.a b/src/prodos.a index 7bbb49f..3221ec8 100644 --- a/src/prodos.a +++ b/src/prodos.a @@ -37,11 +37,10 @@ PRODOSMLI = $BF00 ; [callable] MLI entry point ; LoadFile ; load a file into memory all at once, using ProDOS MLI calls ; -; in: stack contains 8 bytes of parameters: +; in: stack contains 6 bytes of parameters: ; +1 address of pathname ; +3 address of data buffer (to receive file contents) -; +5 [word] maximum length of data to read -; +7 address of ProDOS file buffer +; +5 address of ProDOS file buffer ; out: if C set, load failed and A contains error code ; from open or read ; if C clear, load succeeded and ($02) contains @@ -52,7 +51,7 @@ PRODOSMLI = $BF00 ; [callable] MLI entry point ;------------------------------- !zone { LoadFile - +PARAMS_ON_STACK 8 + +PARAMS_ON_STACK 6 ldy #$01 lda (PARAM),y ; lo byte of pathname @@ -60,7 +59,7 @@ LoadFile iny lda (PARAM),y ; hi byte of pathname sta mliparam+2 - ldy #$07 + ldy #$05 lda (PARAM),y ; lo byte of ProDOS file buffer sta mliparam+3 iny @@ -77,11 +76,8 @@ LoadFile iny lda (PARAM),y ; hi address of data buffer sta mliparam+3 - iny - lda (PARAM),y ; lo data length - sta mliparam+4 - iny - lda (PARAM),y ; hi data length + lda #$FF + sta mliparam+4 ; max data length (unlimited, YOLO) sta mliparam+5 pla ; pull file reference number jsr _readfile diff --git a/src/ui.main.keys.a b/src/ui.main.keys.a index d90aa6d..3a30e0a 100644 --- a/src/ui.main.keys.a +++ b/src/ui.main.keys.a @@ -153,7 +153,6 @@ HandleKey jsr LoadFile !word gPathname !word kSystemAddress - !word $2000 !word kProDOSFileBuffer bcs .xyzzyError jsr ExitWeeGUI