diff --git a/Makefile b/Makefile index a9c97fa..2cd503a 100644 --- a/Makefile +++ b/Makefile @@ -38,8 +38,9 @@ dsk: md asm cp res/WEEGUI build/ cp res/_FileInformation.txt build/ $(CADIUS) ADDFILE build/"$(DISK)" "/PITCH.DARK/" "build/GRUE.SYSTEM" - $(CADIUS) ADDFILE build/"$(DISK)" "/PITCH.DARK/" "build/PITCH.DARK" $(CADIUS) ADDFILE build/"$(DISK)" "/PITCH.DARK/" "build/ONBEYOND.SYSTEM" + $(CADIUS) ADDFILE build/"$(DISK)" "/PITCH.DARK/" "build/PITCH.DARK" + $(CADIUS) ADDFILE build/"$(DISK)" "/PITCH.DARK/" "res/PITCH.DARK.CONF" $(CADIUS) CREATEFOLDER build/"$(DISK)" "/PITCH.DARK/LIB/" $(CADIUS) ADDFILE build/"$(DISK)" "/PITCH.DARK/LIB/" "build/WEEGUI" $(CADIUS) ADDFILE build/"$(DISK)" "/PITCH.DARK/LIB/" "build/ONBEYONDZ3" diff --git a/res/Pitch Dark.master games collection.do.not.edit.2mg b/res/Pitch Dark.master games collection.do.not.edit.2mg index b1d7ffd..e9e19a1 100644 Binary files a/res/Pitch Dark.master games collection.do.not.edit.2mg and b/res/Pitch Dark.master games collection.do.not.edit.2mg differ diff --git a/res/_FileInformation.txt b/res/_FileInformation.txt index fa2e4f7..edcdb34 100644 --- a/res/_FileInformation.txt +++ b/res/_FileInformation.txt @@ -1,5 +1,6 @@ GRUE.SYSTEM=Type(FF),AuxType(2000),Access(C3) PITCH.DARK=Type(06),AuxType(6000),Access(C3) +PITCH.DARK.CONF=Type(04),AuxType(0000),Access(C3) ONBEYOND.SYSTEM=Type(FF),AuxType(2000),Access(C3) ONBEYONDZ3=Type(06),AuxType(3000),Access(C3) ONBEYONDZ4=Type(06),AuxType(3000),Access(C3) diff --git a/res/pitch.dark.conf b/res/pitch.dark.conf index be1e3d1..3a44ca9 100644 --- a/res/pitch.dark.conf +++ b/res/pitch.dark.conf @@ -1,5 +1,6 @@ # Pitch Dark preferences file -# do not edit by hand +# Do not edit by hand +# Or do -- I'm a comment, not a cop # value=0|1 FORCE40COLUMNS=0 diff --git a/res/prizm/amfv.z5#F58005 b/res/prizm/amfv.z5#F58005 new file mode 100644 index 0000000..d84dd94 Binary files /dev/null and b/res/prizm/amfv.z5#F58005 differ diff --git a/res/prizm/ballyhoo.z5#F58005 b/res/prizm/ballyhoo.z5#F58005 new file mode 100644 index 0000000..22b70e6 Binary files /dev/null and b/res/prizm/ballyhoo.z5#F58005 differ diff --git a/res/prizm/border.zone.z5#F58005 b/res/prizm/border.zone.z5#F58005 new file mode 100644 index 0000000..9840323 Binary files /dev/null and b/res/prizm/border.zone.z5#F58005 differ diff --git a/res/prizm/bureaucracy.z5#F58005 b/res/prizm/bureaucracy.z5#F58005 new file mode 100644 index 0000000..cb471d9 Binary files /dev/null and b/res/prizm/bureaucracy.z5#F58005 differ diff --git a/res/prizm/cutthroats.z5#F58005 b/res/prizm/cutthroats.z5#F58005 new file mode 100644 index 0000000..087f0d5 Binary files /dev/null and b/res/prizm/cutthroats.z5#F58005 differ diff --git a/res/prizm/deadline.z5#F58005 b/res/prizm/deadline.z5#F58005 new file mode 100644 index 0000000..7fb91c8 Binary files /dev/null and b/res/prizm/deadline.z5#F58005 differ diff --git a/res/prizm/enchanter.z5#F58005 b/res/prizm/enchanter.z5#F58005 new file mode 100644 index 0000000..b7b2bc1 Binary files /dev/null and b/res/prizm/enchanter.z5#F58005 differ diff --git a/res/prizm/hgttg.z5#F58005 b/res/prizm/hgttg.z5#F58005 new file mode 100644 index 0000000..d7ac156 Binary files /dev/null and b/res/prizm/hgttg.z5#F58005 differ diff --git a/res/prizm/hollywood.z5#F58005 b/res/prizm/hollywood.z5#F58005 new file mode 100644 index 0000000..a897fd8 Binary files /dev/null and b/res/prizm/hollywood.z5#F58005 differ diff --git a/res/prizm/infidel.z5#F58005 b/res/prizm/infidel.z5#F58005 new file mode 100644 index 0000000..a21fdce Binary files /dev/null and b/res/prizm/infidel.z5#F58005 differ diff --git a/res/prizm/lgop.z5#F58005 b/res/prizm/lgop.z5#F58005 new file mode 100644 index 0000000..b1f6248 Binary files /dev/null and b/res/prizm/lgop.z5#F58005 differ diff --git a/res/prizm/lurking.horror.z5#F58005 b/res/prizm/lurking.horror.z5#F58005 new file mode 100644 index 0000000..d12ecc6 Binary files /dev/null and b/res/prizm/lurking.horror.z5#F58005 differ diff --git a/res/prizm/moonmist.z5#F58005 b/res/prizm/moonmist.z5#F58005 new file mode 100644 index 0000000..2cda344 Binary files /dev/null and b/res/prizm/moonmist.z5#F58005 differ diff --git a/res/prizm/nord.and.bert.z5#F58005 b/res/prizm/nord.and.bert.z5#F58005 new file mode 100644 index 0000000..bcb5f40 Binary files /dev/null and b/res/prizm/nord.and.bert.z5#F58005 differ diff --git a/res/prizm/planetfall.z5#F58005 b/res/prizm/planetfall.z5#F58005 new file mode 100644 index 0000000..644e602 Binary files /dev/null and b/res/prizm/planetfall.z5#F58005 differ diff --git a/res/prizm/plundered.z5#F58005 b/res/prizm/plundered.z5#F58005 new file mode 100644 index 0000000..f38c07a Binary files /dev/null and b/res/prizm/plundered.z5#F58005 differ diff --git a/res/prizm/readme.txt b/res/prizm/readme.txt new file mode 100644 index 0000000..e6d11d2 --- /dev/null +++ b/res/prizm/readme.txt @@ -0,0 +1,17 @@ +Source: http://infodoc.plover.net/hints/ + +These help files were put together by Digby McWiggle and Steven Marsh as part of their PRIZM project, whose website is now defunct. They are a compilation of all the Invisiclues available for each of the games in one handy cross-platform file. + +Small patches were applied to each file to remove the warning that your screen is too small and you should make it wider if possible. Since this is not possible on the Apple II (and 80 columns is still too small), the subroutine responsible for this warning has been changed to immediately return without printing anything or waiting for a key. Here is the command I used, which finds the byte sequence "10 00 21 12 0d 01 00 0d 02 01" and replaces the first byte with B0, the "return true" opcode. + +for f in *.z5; do + xxd -p -c 256 "$f" | \ + tr -d '\n' | \ + sed "s/100021120d01000d0201/B00021120d01000d0201/g" | \ + xxd -r -p \ + > ../patched/"$f" +done + +-4am + +last modified: 2018-03-12 diff --git a/res/prizm/seastalker.z5#F58005 b/res/prizm/seastalker.z5#F58005 new file mode 100644 index 0000000..c866edb Binary files /dev/null and b/res/prizm/seastalker.z5#F58005 differ diff --git a/res/prizm/sherlock.z5#F58005 b/res/prizm/sherlock.z5#F58005 new file mode 100644 index 0000000..87b2d47 Binary files /dev/null and b/res/prizm/sherlock.z5#F58005 differ diff --git a/res/prizm/sorcerer.z5#F58005 b/res/prizm/sorcerer.z5#F58005 new file mode 100644 index 0000000..e157279 Binary files /dev/null and b/res/prizm/sorcerer.z5#F58005 differ diff --git a/res/prizm/spellbreaker.z5#F58005 b/res/prizm/spellbreaker.z5#F58005 new file mode 100644 index 0000000..8e3ba6e Binary files /dev/null and b/res/prizm/spellbreaker.z5#F58005 differ diff --git a/res/prizm/starcross.z5#F58005 b/res/prizm/starcross.z5#F58005 new file mode 100644 index 0000000..01b9b8f Binary files /dev/null and b/res/prizm/starcross.z5#F58005 differ diff --git a/res/prizm/stationfall.z5#F58005 b/res/prizm/stationfall.z5#F58005 new file mode 100644 index 0000000..97c9594 Binary files /dev/null and b/res/prizm/stationfall.z5#F58005 differ diff --git a/res/prizm/suspect.z5#F58005 b/res/prizm/suspect.z5#F58005 new file mode 100644 index 0000000..2917e90 Binary files /dev/null and b/res/prizm/suspect.z5#F58005 differ diff --git a/res/prizm/suspended.z5#F58005 b/res/prizm/suspended.z5#F58005 new file mode 100644 index 0000000..a97c3b2 Binary files /dev/null and b/res/prizm/suspended.z5#F58005 differ diff --git a/res/prizm/trinity.z5#F58005 b/res/prizm/trinity.z5#F58005 new file mode 100644 index 0000000..2501353 Binary files /dev/null and b/res/prizm/trinity.z5#F58005 differ diff --git a/res/prizm/wishbringer.z5#F58005 b/res/prizm/wishbringer.z5#F58005 new file mode 100644 index 0000000..9f6727a Binary files /dev/null and b/res/prizm/wishbringer.z5#F58005 differ diff --git a/res/prizm/witness.z5#F58005 b/res/prizm/witness.z5#F58005 new file mode 100644 index 0000000..e21fc9e Binary files /dev/null and b/res/prizm/witness.z5#F58005 differ diff --git a/res/prizm/zork.i.z5#F58005 b/res/prizm/zork.i.z5#F58005 new file mode 100644 index 0000000..dcfa80d Binary files /dev/null and b/res/prizm/zork.i.z5#F58005 differ diff --git a/res/prizm/zork.ii.z5#F58005 b/res/prizm/zork.ii.z5#F58005 new file mode 100644 index 0000000..f04d7e4 Binary files /dev/null and b/res/prizm/zork.ii.z5#F58005 differ diff --git a/res/prizm/zork.iii.z5#F58005 b/res/prizm/zork.iii.z5#F58005 new file mode 100644 index 0000000..fdebce3 Binary files /dev/null and b/res/prizm/zork.iii.z5#F58005 differ diff --git a/res/prizm/ztuu.z5#F58005 b/res/prizm/ztuu.z5#F58005 new file mode 100644 index 0000000..cfa6088 Binary files /dev/null and b/res/prizm/ztuu.z5#F58005 differ diff --git a/src/action.a b/src/action.a index 41c514c..aea8548 100644 --- a/src/action.a +++ b/src/action.a @@ -14,6 +14,12 @@ kGameRootDirectory ; length-prefixed pathname of where game subdirectories are stored !byte 2 !raw "Z/" +kHintsRootDirectory ; length-prefixed pathname of where game subdirectories are stored + !byte 5 + !raw "PRIZM/" +kHintsSuffix + !byte 3 + !raw ".Z5" kArtworkRootDirectory ; length-prefixed pathname of DHGR box art !byte 8 !raw "ARTWORK/" @@ -42,8 +48,6 @@ ID_SCROLLDOWN = $82 !byte $8A,ID_SCROLLDOWN ; down arrow .endkeys -BELL = $FF3A - ;------------------------------------------------------------------------------ ; HandleKey ; handle keypress to activate various UI elements @@ -58,15 +62,12 @@ HandleKey dex dex bpl - - rts + jmp SoftBell .foundKey lda .keys+1,x bpl .activateView - cmp #ID_SCROLLUP - beq .handleScrollUp cmp #ID_SCROLLDOWN beq .handleScrollDown - rts .handleScrollUp lda #$01 !byte $2C ; hide next LDA @@ -117,8 +118,7 @@ callback_next callback_versions rts -callback_clues - rts + callback_options jmp OptionsDialog @@ -166,22 +166,45 @@ callback_boxart sta $C051 rts .nope - jmp BELL + jmp SoftBell } !zone { +callback_clues + jsr SaveGlobalPreferences + jsr LoadInterpreter + bcs .nope +; change prefix to folder of file we want the interpreter to open + jsr ResetPath + lda #kHintsRootDirectory + jsr AddToPath + jsr SetPrefix + !word gPathname +; put just the filename at $2006 + jsr ResetPath + lda gCurrentGame + asl + tax + lda GAMES,x + ldy GAMES+1,x + jsr AddToPath ; hints filename = game filename + hints suffix + lda #kHintsSuffix + jsr AddToPath + lda #gPathname + jsr SetStartupPath +; shutdown WeeGUI and transfer control to interpreter + jsr ExitWeeGUI + jmp $2000 +.nope sec + rts + callback_play LaunchInterpreter jsr SaveGlobalPreferences - jsr ResetPath - lda #<.interpreterFilename - ldy #>.interpreterFilename - jsr AddToPath - jsr LoadFile ; load interpreter at $2000 - !word gPathname - !word $2000 - !word $2000 - !word kProDOSFileBuffer + jsr LoadInterpreter bcs .nope ; change prefix to folder of file we want the interpreter to open jsr ResetPath @@ -196,7 +219,7 @@ LaunchInterpreter jsr AddToPath jsr SetPrefix !word gPathname -; put .z3 filename at $2006 +; put just the filename at $2006 ldy #0 lda addrVersions sta $00 @@ -211,9 +234,20 @@ LaunchInterpreter bra - .doneBuildingFilename sty $2006 +; shut down WeeGUI and transfer control to interpreter jsr ExitWeeGUI jmp $2000 -.nope sec + +LoadInterpreter + jsr ResetPath + lda #<.interpreterFilename + ldy #>.interpreterFilename + jsr AddToPath + jsr LoadFile ; load interpreter at $2000 + !word gPathname + !word $2000 + !word $2000 + !word kProDOSFileBuffer rts .interpreterFilename !byte 15 diff --git a/src/config.a b/src/config.a index 9a3a8fc..a69f1be 100644 --- a/src/config.a +++ b/src/config.a @@ -16,8 +16,6 @@ !zone { kNumberOfGames = 33 -gCurrentGame - !byte $FD ; set at runtime kTextRootDirectory !byte 5 !raw "TEXT/" diff --git a/src/paintoptions.a b/src/paintoptions.a index 5ce5d6c..c3804d9 100644 --- a/src/paintoptions.a +++ b/src/paintoptions.a @@ -144,7 +144,7 @@ HandleOptionsKey dex dex bpl - - rts + jmp SoftBell .foundKey lda .keys+1,x ldx #WGSelectView diff --git a/src/path.a b/src/path.a index de95aaf..84ca4bb 100644 --- a/src/path.a +++ b/src/path.a @@ -6,6 +6,7 @@ ; Public functions ; - ResetPath ; - AddToPath +; - SetStartupPath ; ; Public variables ; - gPathname @@ -32,6 +33,7 @@ ResetPath ; $00/$01 clobbered ; gPathname updated with concatenated length-prefixed string ;------------------------------------------------------------------------------ +!zone { AddToPath sta $00 sty $01 @@ -48,6 +50,31 @@ AddToPath bcc - stx gPathname rts +} + +;------------------------------------------------------------------------------ +; SetStartupPath +; copy a length-prefixed string to $2006 (to pass it as the startup file when +; launching a .system file) +; +; in: A contains low byte of address of length-prefixed string to append +; Y contains high byte of address of length-prefixed string to append +; out: all registers and flags clobbered +; $00/$01 clobbered +;------------------------------------------------------------------------------ +!zone { +SetStartupPath + sta $00 + sty $01 + lda ($00) + tay +- lda ($00),y + and #$7F + sta $2006,y + dey + bpl - + rts +} gPathname !fill 65 ; enough zeroes for any ProDOS pathname diff --git a/src/pitchdark.a b/src/pitchdark.a index 10c5a63..a9f4455 100644 --- a/src/pitchdark.a +++ b/src/pitchdark.a @@ -16,8 +16,8 @@ !source "src/prodos.a" !source "src/ramdisk.a" !source "src/path.a" - !source "src/prefs.a" !source "src/config.a" + !source "src/prefs.a" !source "src/action.a" !source "src/paintcommon.a" !source "src/paint.a" @@ -69,3 +69,24 @@ ExitWeeGUI jsr WeeGUI ldx #WGExit ; clean up WeeGUI jmp WeeGUI + +WAIT = $FCA8 +SPEAKER = $C030 + +SoftBell + php + phx + pha + ldx #32 +- lda #2 + jsr WAIT + bit SPEAKER + lda #33 + jsr WAIT + bit SPEAKER + dex + bne - + pla + plx + plp + rts diff --git a/src/prefs.a b/src/prefs.a index 52c43d0..b6b459a 100644 --- a/src/prefs.a +++ b/src/prefs.a @@ -5,12 +5,30 @@ ; ; Public functions ; - LoadGlobalPreferences +; +; Public variables +; - gForce40 byte 0=false, 1=true +; - gForceUpper byte 0=false, 1=true +; - gSort byte 0=name, 1=year, 2=genre, 3=difficulty +; - gCurrentGame byte 0..kNumberOfGames-1 +; - gVersions[] array of fixed length records, each 16 bytes !zone { +TRUE = 1 +FALSE = 0 kDefaultGame = 29 ; Zork I -kPrefsRecord = $0800 -kPrefsLength = 1 -kPrefsCurrentGame = kPrefsRecord + 0 + +; global storage for parsed preference values +gForce40 + !byte 0 +gForceUpper + !byte 0 +gSort + !byte 0 +gCurrentGame + !byte 0 +gVersions + !fill kNumberOfGames*16,0 ;------------------------------------------------------------------------------ ; LoadGlobalPreferences @@ -19,35 +37,50 @@ kPrefsCurrentGame = kPrefsRecord + 0 ; out: all registers and flags clobbered ;------------------------------------------------------------------------------ LoadGlobalPreferences - jsr LoadFile ; load prefs file at $0800 - !word .globalPrefsFilename - !word kPrefsRecord - !word kPrefsLength - !word kProDOSFileBuffer - bcs .useDefaults - lda kPrefsCurrentGame - cmp #kNumberOfGames - bcs .useDefaults - sta gCurrentGame - rts -.useDefaults +; set defaults first in case prefs file is missing or incomplete + lda #FALSE + sta gForce40 + lda #FALSE + sta gForceUpper + lda #0 + sta gSort lda #kDefaultGame sta gCurrentGame + + bra .exit + ; TODO + jsr LoadFile ; load prefs file at $2000 + !word .globalPrefsFilename + !word $2000 + !word $2000 + !word kProDOSFileBuffer + bcs .exit +.exit rts SaveGlobalPreferences - lda gCurrentGame - sta kPrefsCurrentGame - jsr SaveFile - !word .globalPrefsFilename - !byte $06 - !word $0000 - !word kPrefsRecord - !word kPrefsLength - !word kProDOSFileBuffer + ; TODO rts .globalPrefsFilename !byte 15 !raw "PITCH.DARK.CONF" + +.globalPrefsKeys + !word .force40 + !word .forceupper + !word .sort + !word .lastplayed +.force40 + !byte 14 + !raw "FORCE40COLUMNS" +.forceupper + !byte 14 + !raw "FORCEUPPERCASE" +.sort + !byte 4 + !raw "SORT" +.lastplayed + !byte 10 + !raw "LASTPLAYED" }