From 479b2316c9455421d16129a3f42bb049943bcda4 Mon Sep 17 00:00:00 2001 From: 4am Date: Mon, 26 Mar 2018 13:17:35 -0400 Subject: [PATCH] . --- res/pitch.dark.conf | 7 +- res/text/border.zone.txt | 2 +- res/text/bureaucracy.txt | 2 +- res/text/nord.and.bert.txt | 2 +- res/text/sherlock.txt | 2 +- res/text/trinity.txt | 2 +- src/action.a | 42 +++++++---- src/config.a | 144 ----------------------------------- src/gamelist.a | 151 +++++++++++++++++++++++++++++++++++++ src/paint.a | 1 - src/pitchdark.a | 3 +- src/prefs.a | 59 +++++++-------- 12 files changed, 218 insertions(+), 199 deletions(-) create mode 100644 src/gamelist.a diff --git a/res/pitch.dark.conf b/res/pitch.dark.conf index 4cbe63e..a30488c 100644 --- a/res/pitch.dark.conf +++ b/res/pitch.dark.conf @@ -8,8 +8,11 @@ FORCE40COLUMNS=0 # value=0|1 FORCEUPPERCASE=0 -# value=NAME|YEAR|GENRE|DIFFICULTY -SORT=NAME +# value=0|1 +SCRIPTTOFILE=1 + +# value=0|1 +AUTOSCRIPT=0 # value=game directory LASTPLAYED=ZORK.I diff --git a/res/text/border.zone.txt b/res/text/border.zone.txt index c6d59f3..384a661 100644 --- a/res/text/border.zone.txt +++ b/res/text/border.zone.txt @@ -4,7 +4,7 @@ Copyright 1987 Infocom, Inc. Genre: espionage Difficulty: ^^^^& - Release 9 / Serial number 871008 / Interpreter 2 Version F + Release 9 / Serial number 871008 [description] diff --git a/res/text/bureaucracy.txt b/res/text/bureaucracy.txt index 312438a..cb34ce1 100644 --- a/res/text/bureaucracy.txt +++ b/res/text/bureaucracy.txt @@ -4,7 +4,7 @@ Copyright 1987 Infocom, Inc. Genre: comedy Difficulty: ^^^^& - Release 116 / Licence Number 870602 / Interpreter 2 Version H + Release 116 / Licence Number 870602 [description] diff --git a/res/text/nord.and.bert.txt b/res/text/nord.and.bert.txt index 67c6e72..20d4676 100644 --- a/res/text/nord.and.bert.txt +++ b/res/text/nord.and.bert.txt @@ -4,7 +4,7 @@ Copyright 1987 Infocom, Inc. Genre: comedy Difficulty: ^^^^^ - Release 19 / Serial number 870722 / Interpreter 2 Version H + Release 19 / Serial number 870722 [description] diff --git a/res/text/sherlock.txt b/res/text/sherlock.txt index 7d10725..c2932f5 100644 --- a/res/text/sherlock.txt +++ b/res/text/sherlock.txt @@ -4,7 +4,7 @@ Copyright 1987 Infocom, Inc. Genre: mystery Difficulty: ^^^&& - Release 26 / Serial Number 880127 / Interpreter 2 Version F + Release 26 / Serial Number 880127 [description] diff --git a/res/text/trinity.txt b/res/text/trinity.txt index 6094f5d..471f470 100644 --- a/res/text/trinity.txt +++ b/res/text/trinity.txt @@ -4,7 +4,7 @@ Copyright 1986 Infocom, Inc. Genre: fantasy Difficulty: ^^^&& - Release 12 / Serial Number 860926 / Interpreter 2 Version H + Release 12 / Serial Number 860926 [description] diff --git a/src/action.a b/src/action.a index cc0a047..c0380a8 100644 --- a/src/action.a +++ b/src/action.a @@ -185,6 +185,16 @@ callback_next bcc + lda #0 + sta gCurrentGame + asl + tax + lda GAMES,x + sta .gameptr + lda GAMES+1,x + sta .gameptr+1 + jsr okvs_update + !word gPrefsStore + !word kLastPlayed +.gameptr !word $FDFD ; set at runtime .loadNewGameInfoAndRepaint jsr LoadGameInfo jmp RepaintSomeViews @@ -202,11 +212,9 @@ callback_boxart lda #kArtworkRootDirectory jsr AddToPath - lda gCurrentGame - asl - tax - lda GAMES, x - ldy GAMES+1, x + jsr okvs_get + !word gPrefsStore + !word kLastPlayed jsr AddToPath lda #0 ; set Z flag always @@ -256,12 +264,11 @@ callback_clues jsr SetPrefix !word gPathname bcs .cluesError + ; put just the filename at $2006 - lda gCurrentGame - asl - tax - lda GAMES,x - ldy GAMES+1,x + jsr okvs_get + !word gPrefsStore + !word kLastPlayed jsr SetStartupPath ; shutdown WeeGUI and transfer control to interpreter jsr ExitWeeGUI @@ -281,15 +288,16 @@ LaunchInterpreter lda #kGameRootDirectory jsr AddToPath - lda gCurrentGame - asl - tax - lda GAMES,x - ldy GAMES+1,x + + jsr okvs_get + !word gPrefsStore + !word kLastPlayed jsr AddToPath + jsr SetPrefix !word gPathname bcs .playError + ; put just the filename at $2006 ldy #0 lda addrVersions @@ -305,6 +313,7 @@ LaunchInterpreter bra - .doneBuildingFilename sty $2006 + ; shut down WeeGUI and transfer control to interpreter jsr ExitWeeGUI jmp kSystemAddress @@ -316,7 +325,8 @@ LoadInterpreter lda #<.interpreterFilename ldy #>.interpreterFilename jsr AddToPath - jsr LoadFile ; load interpreter at $2000 + + jsr LoadFile !word gPathname !word kSystemAddress !word $2000 diff --git a/src/config.a b/src/config.a index 0a28b18..5c75e6c 100644 --- a/src/config.a +++ b/src/config.a @@ -6,155 +6,11 @@ ; Public functions ; - LoadGameInfo ; -; Public constants -; - kNumberOfGames -; - GAMES -; !zone { -kNumberOfGames = 34 kTextRootDirectory !byte 5 !raw "TEXT/" -GAMES ; length of this array must = kNumberOfGames, there is no range checking - !word .adventure - !word .amfv - !word .ballyhoo - !word .beyondzork - !word .borderzone - !word .bureaucracy - !word .cutthroats - !word .deadline - !word .enchanter - !word .hgttg - !word .hollywoodhijinx - !word .infidel - !word .leathergoddesses - !word .lurkinghorror - !word .minizork - !word .moonmist - !word .nordandbert - !word .planetfall - !word .plunderedhearts - !word .seastalker - !word .sherlock - !word .sorcerer - !word .spellbreaker - !word .starcross - !word .stationfall - !word .suspect - !word .suspended - !word .trinity - !word .wishbringer - !word .witness - !word .zorki - !word .zorkii - !word .zorkiii - !word .ztuu - -; length-prefixed names of each subdirectory in game directory, 1 per game -.adventure - !byte 9 - !raw "ADVENTURE" -.amfv - !byte 4 - !raw "AMFV" -.ballyhoo - !byte 8 - !raw "BALLYHOO" -.beyondzork - !byte 11 - !raw "BEYOND.ZORK" -.borderzone - !byte 11 - !raw "BORDER.ZONE" -.bureaucracy - !byte 11 - !raw "BUREAUCRACY" -.cutthroats - !byte 10 - !raw "CUTTHROATS" -.deadline - !byte 8 - !raw "DEADLINE" -.enchanter - !byte 9 - !raw "ENCHANTER" -.hgttg - !byte 5 - !raw "HGTTG" -.hollywoodhijinx - !byte 9 - !raw "HOLLYWOOD" -.infidel - !byte 7 - !raw "INFIDEL" -.leathergoddesses - !byte 4 - !raw "LGOP" -.lurkinghorror - !byte 14 - !raw "LURKING.HORROR" -.minizork - !byte 9 - !raw "MINI.ZORK" -.moonmist - !byte 8 - !raw "MOONMIST" -.nordandbert - !byte 13 - !raw "NORD.AND.BERT" -.planetfall - !byte 10 - !raw "PLANETFALL" -.plunderedhearts - !byte 9 - !raw "PLUNDERED" -.seastalker - !byte 10 - !raw "SEASTALKER" -.sherlock - !byte 8 - !raw "SHERLOCK" -.sorcerer - !byte 8 - !raw "SORCERER" -.spellbreaker - !byte 12 - !raw "SPELLBREAKER" -.starcross - !byte 9 - !raw "STARCROSS" -.stationfall - !byte 11 - !raw "STATIONFALL" -.suspect - !byte 7 - !raw "SUSPECT" -.suspended - !byte 9 - !raw "SUSPENDED" -.trinity - !byte 7 - !raw "TRINITY" -.wishbringer - !byte 11 - !raw "WISHBRINGER" -.witness - !byte 7 - !raw "WITNESS" -.zorki - !byte 6 - !raw "ZORK.I" -.zorkii - !byte 7 - !raw "ZORK.II" -.zorkiii - !byte 8 - !raw "ZORK.III" -.ztuu - !byte 4 - !raw "ZTUU" sectionPointers ; array of pointers to start of each section addrEOF diff --git a/src/gamelist.a b/src/gamelist.a new file mode 100644 index 0000000..4d08092 --- /dev/null +++ b/src/gamelist.a @@ -0,0 +1,151 @@ +;license:MIT +;(c) 2018 by 4am +; +; Game directory and filenames +; +; Public constants +; - kNumberOfGames +; - GAMES +; + +kNumberOfGames = 34 + +GAMES ; length of this array must = kNumberOfGames, there is no range checking + !word .adventure + !word .amfv + !word .ballyhoo + !word .beyondzork + !word .borderzone + !word .bureaucracy + !word .cutthroats + !word .deadline + !word .enchanter + !word .hgttg + !word .hollywoodhijinx + !word .infidel + !word .leathergoddesses + !word .lurkinghorror + !word .minizork + !word .moonmist + !word .nordandbert + !word .planetfall + !word .plunderedhearts + !word .seastalker + !word .sherlock + !word .sorcerer + !word .spellbreaker + !word .starcross + !word .stationfall + !word .suspect + !word .suspended + !word .trinity + !word .wishbringer + !word .witness + !word .zorki + !word .zorkii + !word .zorkiii + !word .ztuu + +; length-prefixed names of each subdirectory in game directory, 1 per game +.adventure + !byte 9 + !raw "ADVENTURE" +.amfv + !byte 4 + !raw "AMFV" +.ballyhoo + !byte 8 + !raw "BALLYHOO" +.beyondzork + !byte 11 + !raw "BEYOND.ZORK" +.borderzone + !byte 11 + !raw "BORDER.ZONE" +.bureaucracy + !byte 11 + !raw "BUREAUCRACY" +.cutthroats + !byte 10 + !raw "CUTTHROATS" +.deadline + !byte 8 + !raw "DEADLINE" +.enchanter + !byte 9 + !raw "ENCHANTER" +.hgttg + !byte 5 + !raw "HGTTG" +.hollywoodhijinx + !byte 9 + !raw "HOLLYWOOD" +.infidel + !byte 7 + !raw "INFIDEL" +.leathergoddesses + !byte 4 + !raw "LGOP" +.lurkinghorror + !byte 14 + !raw "LURKING.HORROR" +.minizork + !byte 9 + !raw "MINI.ZORK" +.moonmist + !byte 8 + !raw "MOONMIST" +.nordandbert + !byte 13 + !raw "NORD.AND.BERT" +.planetfall + !byte 10 + !raw "PLANETFALL" +.plunderedhearts + !byte 9 + !raw "PLUNDERED" +.seastalker + !byte 10 + !raw "SEASTALKER" +.sherlock + !byte 8 + !raw "SHERLOCK" +.sorcerer + !byte 8 + !raw "SORCERER" +.spellbreaker + !byte 12 + !raw "SPELLBREAKER" +.starcross + !byte 9 + !raw "STARCROSS" +.stationfall + !byte 11 + !raw "STATIONFALL" +.suspect + !byte 7 + !raw "SUSPECT" +.suspended + !byte 9 + !raw "SUSPENDED" +.trinity + !byte 7 + !raw "TRINITY" +.wishbringer + !byte 11 + !raw "WISHBRINGER" +.witness + !byte 7 + !raw "WITNESS" +.zorki + !byte 6 + !raw "ZORK.I" +.zorkii + !byte 7 + !raw "ZORK.II" +.zorkiii + !byte 8 + !raw "ZORK.III" +.ztuu + !byte 4 + !raw "ZTUU" diff --git a/src/paint.a b/src/paint.a index 167c21f..89d934d 100644 --- a/src/paint.a +++ b/src/paint.a @@ -110,7 +110,6 @@ PaintAllViews ; ; in: WeeGUI loaded and initialized ; CreateViews has been called -; gCurrentGame has new game index ; LoadGameInfo has been called to load new game description text ; out: all registers clobbered ; all flags clobbered diff --git a/src/pitchdark.a b/src/pitchdark.a index 716ec53..d3aba5e 100644 --- a/src/pitchdark.a +++ b/src/pitchdark.a @@ -12,13 +12,14 @@ !raw "LIB/WEEGUI" !source "src/macros.a" + !source "src/gamelist.a" !source "src/WeeGUI_MLI.s" !source "src/memory.a" !source "src/okvs.a" !source "src/prodos.a" !source "src/ramdisk.a" !source "src/path.a" - !source "src/config.a" + !source "src/gameinfoparser.a" !source "src/prefs.a" !source "src/action.a" !source "src/paintcommon.a" diff --git a/src/prefs.a b/src/prefs.a index 2884e83..0e0ac9e 100644 --- a/src/prefs.a +++ b/src/prefs.a @@ -19,7 +19,6 @@ !zone { kDefaultGame = 30 ; Zork I -; global storage for parsed preference values gCurrentGame !byte 0 @@ -29,9 +28,12 @@ kForce40 kForceUpper !byte 14 !raw "FORCEUPPERCASE" -kSort - !byte 4 - !raw "SORT" +kScriptToFile + !byte 12 + !raw "SCRIPTTOFILE" +kAutoScript + !byte 10 + !raw "AUTOSCRIPT" kLastPlayed !byte 10 !raw "LASTPLAYED" @@ -49,6 +51,19 @@ LoadGlobalPreferences jsr okvs_init !word gPrefsStore + lda gCurrentGame + asl + tax + lda GAMES,x + sta .gameptr + lda GAMES+1,x + sta .gameptr+1 + jsr okvs_append + !word gPrefsStore + !word kLastPlayed +.gameptr !word $FDFD ; set at runtime + !byte 16 + jsr okvs_append !word gPrefsStore !word kForce40 @@ -63,22 +78,15 @@ LoadGlobalPreferences jsr okvs_append !word gPrefsStore - !word kSort - !word .debugsortvalue - !byte 11 + !word kScriptToFile + !word .debug1 + !byte 0 jsr okvs_append !word gPrefsStore - !word kLastPlayed - !word .debuglastplayed - !byte 16 - - jsr okvs_update - !word gPrefsStore - !word kSort - !word kByDifficulty - bcs .exit - ;jmp $ff59 + !word kAutoScript + !word .debug0 + !byte 0 bra .exit ; TODO @@ -101,17 +109,8 @@ SaveGlobalPreferences .debug0 !byte 1 - !raw "0" - -.debugsortvalue - !byte 4 - !raw "NAME" - -.debuglastplayed - !byte 6 - !raw "ZORK.I" - -kByDifficulty - !byte 10 - !raw "DIFFICULTY" + !byte 0 +.debug1 + !byte 1 + !byte 1 }