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 493c825..19a9c7b 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/games.conf b/res/games.conf index 3d8d346..8e7511c 100644 --- a/res/games.conf +++ b/res/games.conf @@ -1 +1 @@ -# Pitch Dark games list # key=game directory, value=title AMFV=A MIND FOREVER VOYAGING BALLYHOO=BALLYHOO BEYOND.ZORK=BEYOND ZORK: THE COCONUT OF QUENDOR BORDER.ZONE=BORDER ZONE: A GAME OF INTRIGUE BUREAUCRACY=BUREAUCRACY: a paranoid fantasy CUTTHROATS=CUTTHROATS DEADLINE=DEADLINE: an Interlogic mystery ENCHANTER=ENCHANTER HGTTG=THE HITCHHIKER'S GUIDE TO THE GALAXY HOLLYWOOD=HOLLYWOOD HIJINX: a zany treasure hunt INFIDEL=INFIDEL LGOP=LEATHER GOODESSES OF PHOBOS: a racy space-age spoof LURKING.HORROR=THE LURKING HORROR MINI.ZORK=MINI-ZORK I: THE GREAT UNDERGROUND EMPIRE MOONMIST=MOONMIST NORD.AND.BERT=NORD AND BERT COULDN'T MAKE HEAD OR TAIL OF IT PLANETFALL=PLANETFALL PLUNDERED=PLUNDERED HEARTS SEASTALKER=SEASTALKER: AND THE ULTRAMARINE BIOCEPTOR SHERLOCK=SHERLOCK: THE RIDDLE OF THE CROWN JEWELS SORCERER=SORCERER SPELLBREAKER=SPELLBREAKER STARCROSS=STARCROSS STATIONFALL=STATIONFALL SUSPECT=SUSPECT SUSPENDED=SUSPENDED TRINITY=TRINITY WISHBRINGER=WISHBRINGER: THE MAGICK STONE OF DREAMS WITNESS=THE WITNESS: an Interlogic mystery ZORK.I=ZORK I: THE GREAT UNDERGROUND EMPIRE ZORK.II=ZORK II: THE WIZARD OF FROBOZZ ZORK.III=ZORK III: THE DUNGEON MASTER ZTUU=ZORK: THE UNDISCOVERED UNDERGROUND [eof] \ No newline at end of file +# Pitch Dark games list # key=game directory, value=title AMFV=A MIND FOREVER VOYAGING BALLYHOO=BALLYHOO BEYOND.ZORK=BEYOND ZORK: THE COCONUT OF QUENDOR BORDER.ZONE=BORDER ZONE: A GAME OF INTRIGUE BUREAUCRACY=BUREAUCRACY: a paranoid fantasy CUTTHROATS=CUTTHROATS DEADLINE=DEADLINE: an Interlogic mystery ENCHANTER=ENCHANTER HGTTG=THE HITCHHIKER'S GUIDE TO THE GALAXY HOLLYWOOD=HOLLYWOOD HIJINX: a zany treasure hunt INFIDEL=INFIDEL LGOP=LEATHER GOODESSES OF PHOBOS: a racy space-age spoof LURKING.HORROR=THE LURKING HORROR MINI.ZORK=MINI-ZORK I: THE GREAT UNDERGROUND EMPIRE MINI.ZORK.2=MINI-ZORK II: something something MOONMIST=MOONMIST NORD.AND.BERT=NORD AND BERT COULDN'T MAKE HEAD OR TAIL OF IT PLANETFALL=PLANETFALL PLUNDERED=PLUNDERED HEARTS SEASTALKER=SEASTALKER: AND THE ULTRAMARINE BIOCEPTOR SHERLOCK=SHERLOCK: THE RIDDLE OF THE CROWN JEWELS SORCERER=SORCERER SPELLBREAKER=SPELLBREAKER STARCROSS=STARCROSS STATIONFALL=STATIONFALL SUSPECT=SUSPECT SUSPENDED=SUSPENDED TRINITY=TRINITY WISHBRINGER=WISHBRINGER: THE MAGICK STONE OF DREAMS WITNESS=THE WITNESS: an Interlogic mystery ZORK.I=ZORK I: THE GREAT UNDERGROUND EMPIRE ZORK.II=ZORK II: THE WIZARD OF FROBOZZ ZORK.III=ZORK III: THE DUNGEON MASTER ZORK.ZERO=ZORK ZERO: something something ZTUU=ZORK: THE UNDISCOVERED UNDERGROUND [eof] \ No newline at end of file diff --git a/res/pitch.dark.conf b/res/pitch.dark.conf index 0cca03c..b69781b 100644 --- a/res/pitch.dark.conf +++ b/res/pitch.dark.conf @@ -1 +1 @@ -# Pitch Dark preferences file # Do not edit by hand. # Or do. I'm a comment, not a cop. # value=0|1 FORCE40COLUMNS=0 FORCEUPPERCASE=0 SCRIPTTOFILE=0 AUTOSCRIPT=0 # value=game directory LASTPLAYED=ZORK.I # key=game directory, value=filename of selected version AMFV=R79.DEPROT.Z4 BALLYHOO=R97.851218.Z3 BEYOND.ZORK=R57.871221.Z5 BORDER.ZONE=R9.871008.Z5 BUREAUCRACY=R116.DEPROT.Z4 CUTTHROATS=R23.DEPROT.Z3 DEADLINE=R27.831005.Z3 ENCHANTER=R29.860820.Z3 HGTTG=R59.851108.Z3 HOLLYWOOD=R37.861215.Z3 INFIDEL=R22.830916.Z3 LGOP=R59.860730.Z3 LURKING.HORROR=R221.DEPROT.Z3 MINI.ZORK=R34.871124.Z3 MOONMIST=R9.861022.Z3 NORD.AND.BERT=R19.870722.Z4 PLANETFALL=R37.851003.Z3 PLUNDERED=R26.870730.Z3 SEASTALKER=R16B.850603.Z3 SHERLOCK=R26.880127.Z5 SORCERER=R18.DEPROT.Z3 SPELLBREAKER=R87.DEPROT.Z3 STARCROSS=R17.DEPROT.Z3 STATIONFALL=R107.DEPROT.Z3 SUSPECT=R14.841005.Z3 SUSPENDED=R8B.840521.Z3 TRINITY=R12.860926.Z4 WISHBRINGER=R69.850920.Z3 WITNESS=R22.840924.Z3 ZORK.I=R88.840726.Z3 ZORK.II=R48.840904.Z3 ZORK.III=R17.840727.Z3 ZTUU=R16.970828.Z5 [eof] \ No newline at end of file +# Pitch Dark preferences file # Do not edit by hand. # Or do. I'm a comment, not a cop. # value=0|1 FORCE40COLUMNS=0 FORCEUPPERCASE=0 SCRIPTTOFILE=0 AUTOSCRIPT=0 # value=game directory LASTPLAYED=ZORK.I # key=game directory, value=filename of selected version AMFV=R79.DEPROT.Z4 BALLYHOO=R99.861014.Z3 BEYOND.ZORK=R60.880610.Z5 BORDER.ZONE=R9.871008.Z5 BUREAUCRACY=R160.DEPROT.Z4 CUTTHROATS=R25.DEPROT.Z3 DEADLINE=R28.850129.Z3 ENCHANTER=R29.860820.Z3 HGTTG=R60.861002.Z3 HOLLYWOOD=R37.861215.Z3 INFIDEL=R22.830916.Z3 LGOP=R59.860730.Z3 LURKING.HORROR=R221.DEPROT.Z3 MINI.ZORK=R34.871124.Z3 MINI.ZORK.2=R2.871123.Z3 MOONMIST=R13.880501.Z3 NORD.AND.BERT=R20.870722.Z4 PLANETFALL=R39.880501.Z3 PLUNDERED=R26.870730.Z3 SEASTALKER=R18.850919.Z3 SHERLOCK=R4.880324.Z5 SORCERER=R18.DEPROT.Z3 SPELLBREAKER=R87.DEPROT.Z3 STARCROSS=R18.DEPROT.Z3 STATIONFALL=R107.DEPROT.Z3 SUSPECT=R18.850222.Z3 SUSPENDED=R8.830521.Z3 TRINITY=R15.870628.Z4 WISHBRINGER=R69.850920.Z3 WITNESS=R23.840925.Z3 ZORK.I=R88.840726.Z3 ZORK.II=R48.840904.Z3 ZORK.III=R25.860811.Z3 ZORK.ZERO=R153.880510.Z5 ZTUU=R16.970828.Z5 [eof] \ No newline at end of file diff --git a/res/text/ballyhoo.txt b/res/text/ballyhoo.txt index 346df3e..ef887af 100644 --- a/res/text/ballyhoo.txt +++ b/res/text/ballyhoo.txt @@ -23,11 +23,12 @@ lot, trying to set you up for a permanent slot in the freak show. [versions] +R99.861014.Z3=Release 99 / Serial number 861014 R97.851218.Z3=Release 97 / Serial number 851218 [options] ARTWORK=1 CLUES=1 -VERSIONS=0 +VERSIONS=1 [eof] diff --git a/res/text/beyond.zork.txt b/res/text/beyond.zork.txt index daf56a3..9ae2eea 100644 --- a/res/text/beyond.zork.txt +++ b/res/text/beyond.zork.txt @@ -41,6 +41,7 @@ increases and their character grows in strength and power. [versions] +R60.880610.Z5=Release 60 / Serial number 880610 R57.871221.Z5=Release 57 / Serial number 871221 R51.870923.Z5=Release 51 / Serial number 870923 R49.870917.Z5=Release 49 / Serial number 870917 diff --git a/res/text/bureaucracy.txt b/res/text/bureaucracy.txt index 3ead979..afb5660 100644 --- a/res/text/bureaucracy.txt +++ b/res/text/bureaucracy.txt @@ -40,6 +40,7 @@ are in the paranoid's house, he will not ask you any questions. [versions] +R160.DEPROT.Z4=Release 160 / Licence number 880521 (patched) R116.DEPROT.Z4=Release 116 / Licence number 870602 (patched) R86.DEPROT.Z4=Release 86 / Licence number 870212 (patched) diff --git a/res/text/cutthroats.txt b/res/text/cutthroats.txt index 277564a..e2e2aa5 100644 --- a/res/text/cutthroats.txt +++ b/res/text/cutthroats.txt @@ -25,11 +25,12 @@ which item you are shown, you can visit either wreck. [versions] +R25.DEPROT.Z3=Release 25 / Serial number 840917 (patched) R23.DEPROT.Z3=Release 23 / Serial number 840809 (patched) [options] ARTWORK=1 CLUES=1 -VERSIONS=0 +VERSIONS=1 [eof] diff --git a/res/text/deadline.txt b/res/text/deadline.txt index 3ef9628..72dfbec 100644 --- a/res/text/deadline.txt +++ b/res/text/deadline.txt @@ -20,6 +20,7 @@ you in. [versions] +R28.850129.Z3=Release 28 / Serial number 850129 R27.831005.Z3=Release 27 / Serial number 831005 R26.821108.Z3=Release 26 / Serial number 821108 R22.820809.Z3=Release 22 / Serial number 820809 diff --git a/res/text/hgttg.txt b/res/text/hgttg.txt index 398aaac..597ee45 100644 --- a/res/text/hgttg.txt +++ b/res/text/hgttg.txt @@ -28,6 +28,7 @@ certainly end up getting misled. [versions] +R60.861002.Z3=Release 60 / Serial number 861002 R59.851108.Z3=Release 59 / Serial number 851108 R58.851002.Z3=Release 58 / Serial number 851002 R56.841221.Z3=Release 56 / Serial number 841221 diff --git a/res/text/mini.zork.2.txt b/res/text/mini.zork.2.txt new file mode 100644 index 0000000..8e714d0 --- /dev/null +++ b/res/text/mini.zork.2.txt @@ -0,0 +1,20 @@ +[info] + MINI-ZORK II: something something + by Dave Lebling and Marc Blank + Copyright sometime Infocom, Inc. + Genre: fantasy + Difficulty: ^^^&& + +[description] + + text + +[versions] +R2.871123.Z3=Release 2 / Serial number 871123 + +[options] +ARTWORK=0 +CLUES=0 +VERSIONS=0 + +[eof] diff --git a/res/text/mini.zork.txt b/res/text/mini.zork.txt index 01d7bc3..88dbbdd 100644 --- a/res/text/mini.zork.txt +++ b/res/text/mini.zork.txt @@ -19,10 +19,11 @@ [versions] R34.871124.Z3=Release 34 / Serial number 871124 +R2.840207.Z3=Release 2 / Serial number 840207 [options] ARTWORK=0 CLUES=0 -VERSIONS=0 +VERSIONS=1 [eof] diff --git a/res/text/moonmist.txt b/res/text/moonmist.txt index a9b4b3c..1089839 100644 --- a/res/text/moonmist.txt +++ b/res/text/moonmist.txt @@ -26,6 +26,7 @@ soundly. The next victim might be you. [versions] +R13.880501.Z3=Release 13 / Serial number 880501 R9.861022.Z3=Release 9 / Serial number 861022 R4.860918.Z3=Release 4 / Serial number 860918 diff --git a/res/text/nord.and.bert.txt b/res/text/nord.and.bert.txt index a9e70b0..45a9ff4 100644 --- a/res/text/nord.and.bert.txt +++ b/res/text/nord.and.bert.txt @@ -43,11 +43,12 @@ mind is constantly working on artful new turns of phrase. [versions] +R20.870722.Z4=Release 19 / Serial number 870722 R19.870722.Z4=Release 19 / Serial number 870722 [options] ARTWORK=1 CLUES=1 -VERSIONS=0 +VERSIONS=1 [eof] diff --git a/res/text/planetfall.txt b/res/text/planetfall.txt index 0488b4d..2f29ab5 100644 --- a/res/text/planetfall.txt +++ b/res/text/planetfall.txt @@ -22,6 +22,7 @@ the cosmic cookie crumbles. [versions] +R39.880501.Z3=Release 39 / Serial number 880501 R37.851003.Z3=Release 37 / Serial number 851003 R29.840118.Z3=Release 29 / Serial number 840118 R26.831014.Z3=Release 26 / Serial number 831014 diff --git a/res/text/seastalker.txt b/res/text/seastalker.txt index a210e5d..26709e2 100644 --- a/res/text/seastalker.txt +++ b/res/text/seastalker.txt @@ -22,10 +22,10 @@ shark bait! [versions] +R18.850919.Z3=Release 18 / Serial number 850919 R16B.850603.Z3=Release 16 / Serial number 850603 R16A.850515.Z3=Release 16 / Serial number 850515 -R15B.840522.Z3=Release 15 / Serial number 840522 -R15A.840501.Z3=Release 15 / Serial number 840501 +R15.840501.Z3=Release 15 / Serial number 840501 R86.840320.Z3=Release 86 / Serial number 840320 [options] diff --git a/res/text/sherlock.txt b/res/text/sherlock.txt index 098a961..372e091 100644 --- a/res/text/sherlock.txt +++ b/res/text/sherlock.txt @@ -48,7 +48,9 @@ And now, come, Watson! The game is afoot... [versions] +R4.880324.Z5=Release 4 / Serial number 880324 R26.880127.Z5=Release 26 / Serial number 880127 +R22.880112.Z5=Release 22 / Serial number 880112 R21.871214.Z5=Release 21 / Serial number 871214 [options] diff --git a/res/text/starcross.txt b/res/text/starcross.txt index 758fd2f..8e1d49b 100644 --- a/res/text/starcross.txt +++ b/res/text/starcross.txt @@ -21,6 +21,7 @@ course for a UM, you may enter any coordinates for R, THETA, and PHI. [versions] +R18.DEPROT.Z3=Release 18 / Serial number 830114 (patched) R17.DEPROT.Z3=Release 17 / Serial number 821021 (patched) R15.DEPROT.Z3=Release 15 / Serial number 820901 (patched) diff --git a/res/text/suspect.txt b/res/text/suspect.txt index e20a5e8..ae8afb2 100644 --- a/res/text/suspect.txt +++ b/res/text/suspect.txt @@ -23,6 +23,7 @@ invitation to the social event of the season. Then spoil it all. [versions] +R18.850222.Z3=Release 18 / Serial number 850222 R14.841005.Z3=Release 14 / Serial number 841005 [options] diff --git a/res/text/suspended.txt b/res/text/suspended.txt index 3d8fa6a..597d0c0 100644 --- a/res/text/suspended.txt +++ b/res/text/suspended.txt @@ -24,8 +24,7 @@ Good morning. [versions] -R8B.840521.Z3=Release 8 / Serial number 840521 -R8A.830521.Z3=Release 8 / Serial number 830521 +R8.830521.Z3=Release 8 / Serial number 830521 R7.830419.Z3=Release 7 / Serial number 830419 R5.830222.Z3=Release 5 / Serial number 830222 diff --git a/res/text/trinity.txt b/res/text/trinity.txt index 1e66c51..c0f289f 100644 --- a/res/text/trinity.txt +++ b/res/text/trinity.txt @@ -22,6 +22,7 @@ puts the course of history in your hands. [versions] +R15.870628.Z4=Release 15 / Serial number 870628 R12.860926.Z4=Release 12 / Serial number 860926 R11.860509.Z4=Release 11 / Serial number 860509 diff --git a/res/text/witness.txt b/res/text/witness.txt index 1295ce7..f6aaa20 100644 --- a/res/text/witness.txt +++ b/res/text/witness.txt @@ -23,6 +23,7 @@ because you are The Witness. [versions] +R23.840925.Z3=Release 23 / Serial number 840925 R22.840924.Z3=Release 22 / Serial number 840924 R21.831208.Z3=Release 21 / Serial number 831208 R20.831119.Z3=Release 20 / Serial number 831119 diff --git a/res/text/zork.iii.txt b/res/text/zork.iii.txt index 3e3bf82..ff41a63 100644 --- a/res/text/zork.iii.txt +++ b/res/text/zork.iii.txt @@ -22,6 +22,7 @@ all. [versions] +R25.860811.Z3=Release 25 / Serial number 860811 R17.840727.Z3=Release 17 / Serial number 840727 R16.830410.Z3=Release 16 / Serial number 830410 R15B.840518.Z3=Release 15 / Serial number 840518 diff --git a/res/text/zork.zero.txt b/res/text/zork.zero.txt new file mode 100644 index 0000000..ecb59d5 --- /dev/null +++ b/res/text/zork.zero.txt @@ -0,0 +1,20 @@ +[info] + ZORK ZERO: something something + by people + Copyright some time Infocom, Inc. + Genre: fantasy + Difficulty: ^^^&& + +[description] + + text + +[versions] +R153.880510.Z5=Release 153 / Serial number 880510 + +[options] +ARTWORK=0 +CLUES=0 +VERSIONS=0 + +[eof] diff --git a/src/constants.a b/src/constants.a index 37324a1..d7b8714 100644 --- a/src/constants.a +++ b/src/constants.a @@ -17,7 +17,7 @@ ;~7400...... - program data (approximate) ; -kPitchDarkBinaryAddress = $3F55 +kPitchDarkBinaryAddress = $3F2D kGameInfoBuffer = $0800 ; used by LoadGameInfo kProDOSFileBuffer = $1C00 ; 1K buffer for ProDOS MLI calls diff --git a/src/onbeyond/z4/z4.s b/src/onbeyond/z4/z4.s index de6855b..8938dc4 100644 --- a/src/onbeyond/z4/z4.s +++ b/src/onbeyond/z4/z4.s @@ -1,6 +1,6 @@ ;license:BSD-3-Clause ;extended open/read/write binary file in ProDOS filesystem, with random access -;copyright (c) Peter Ferrie 2013-18 +;copyright (c) Peter Ferrie 2013-19 ver_02 = 1 @@ -180,7 +180,6 @@ tmp = $8 init lda DEVNUM sta x80_parms + 1 - sta unrunit and #$70 pha ldx #1 @@ -200,6 +199,9 @@ init lda DEVNUM ;find current directory name in directory + sec + php + readblock jsr MLI !byte $80 !word x80_parms @@ -221,7 +223,8 @@ inextent ldy #0 ;match failed, move to next directory in this block, if possible - pla - clc + +skiphdr clc lda bloklo adc #ENTRY_SIZE sta bloklo @@ -250,7 +253,17 @@ ifoundname dex lda (namlo), y cmp #'/' bne - - tya + pla + and #$20 ;Volume Directory Header XOR subdirectory + beq adjpath + pla + clc + php + lsr + bcc skiphdr + inx + +adjpath tya eor #$ff adc sizelo sta sizelo @@ -258,9 +271,8 @@ ifoundname dex tya adc namlo sta namlo - pla - and #$20 ;Volume Directory Header XOR subdirectory - bne ++ + dex + beq ++ ;cache block number of current directory ;as starting position for subsequent searches @@ -276,22 +288,79 @@ ifoundname dex stx x80_parms + 5 ++ lda sizelo bne readblock + pla - ;unit to slot for SmartPort interface + ;unit to slot for ProDOS interface +++ pla lsr lsr lsr - tax - lsr - ora #$c0 - ldy DEVADR01HI, x - cpy #$c8 - bcs set_slot - tya -set_slot sta slot + 2 - sta unrentry + 1 + tay + ldx DEVADR01HI, y + cpx #$c8 + bcc set_slot + + ;find SmartPort device for basic MicroDrive support + + ldx #$c8 +- dex + stx blokhi + ldy #0 + sty bloklo + iny + lda (bloklo), y + cmp #$20 + bne - + iny + iny + lda (bloklo), y + bne - + iny + iny + lda (bloklo), y + cmp #3 + bne - + ldy #$ff + lda (bloklo), y + beq - + +set_slot stx slot + 2 + stx unrentry1 + 2 + stx unrentry3 + 2 + +slot ldx $cfff + + ;use SmartPort entrypoint instead + + inx + inx + inx + stx unrentry1 + 1 + stx unrentry3 + 1 + + ldx #2 + stx x80_parms + 4 + lda #0 + sta x80_parms + 5 + jsr MLI + !byte $80 + !word x80_parms + +iterunit inc unrunit2 + +unrentry1 jsr $d1d1 + !byte cmdread + !word unrpacket + bcs iterunit + + ldy #$0f +- lda readbuff + 4, y + cmp readbuff + $204, y + bne iterunit + dey + bpl - + !if load_aux = 1 { sta SETAUXWR + (load_banked * 4) ;SETAUXWR or SETAUXZP } ;load_aux @@ -330,8 +399,6 @@ yyy ;copy new RWTS and interpreter support routines -slot lda $cfff - sta unrentry ldy #0 - lda unrelochdd, y sta reloc, y @@ -1554,22 +1621,32 @@ hddreaddirsect sty adrhi hddseekrd ldy #cmdread !if (aligned_read + enable_write) > 1 { -hddseekrdwr sty command +hddseekrdwr sty pcommand } else { ;not (aligned_read or enable_write) - sty command + sty pcommand hddseekrdwr } ;aligned_read and enable_write - stx bloklo - sta blokhi + stx pblock + sta pblock + 1 hddcallsp -unrunit = unrelochdd + (* + 1 - reloc) - lda #$d1 - sta unit + lda adrhi + sta paddr + 1 + lda adrlo + sta paddr +unrentry3 = unrelochdd + (* - reloc) + jsr $d1d1 +pcommand !byte 0 + !word packet + rts -unrentry = unrelochdd + (* + 1 - reloc) - jmp $d1d1 +unrpacket = unrelochdd + (* - reloc) +packet !byte 3 +unrunit2 = unrelochdd + (* - reloc) + !byte 0 +paddr !word readbuff + $200 +pblock !byte 2, 0, 0 casemap ora #$80 @@ -1734,7 +1811,7 @@ hddsavetreehi = * + 1 lda hdddirbuf, y ora hdddirbuf + 256, y beq sparseblk - inc command + inc pcommand copyblock ldy #0 - lda $900, y @@ -1792,11 +1869,11 @@ sparseblk ldx #2 lda adrhi cmp #(>hddencbuf) + 2 bne -- - ldx bloklo + ldx pblock inx bne + - inc blokhi -+ lda blokhi + inc pblock + 1 ++ lda pblock + 1 dec ldrhi bne --- @@ -1825,7 +1902,7 @@ foundbit lda (adrlo), y jmp copyblock writeimm sta adrhi - inc command + inc pcommand jmp hddcallsp readpart lda istree diff --git a/src/onbeyond/z5/z5.s b/src/onbeyond/z5/z5.s index c2fe2ec..b6bcf89 100644 --- a/src/onbeyond/z5/z5.s +++ b/src/onbeyond/z5/z5.s @@ -1,6 +1,6 @@ ;license:BSD-3-Clause ;extended open/read/write binary file in ProDOS filesystem, with random access -;copyright (c) Peter Ferrie 2013-18 +;copyright (c) Peter Ferrie 2013-19 ver_02 = 1 @@ -180,7 +180,6 @@ tmp = $8 init lda DEVNUM sta x80_parms + 1 - sta unrunit and #$70 pha ldx #1 @@ -200,6 +199,9 @@ init lda DEVNUM ;find current directory name in directory + sec + php + readblock jsr MLI !byte $80 !word x80_parms @@ -221,7 +223,8 @@ inextent ldy #0 ;match failed, move to next directory in this block, if possible - pla - clc + +skiphdr clc lda bloklo adc #ENTRY_SIZE sta bloklo @@ -250,7 +253,17 @@ ifoundname dex lda (namlo), y cmp #'/' bne - - tya + pla + and #$20 ;Volume Directory Header XOR subdirectory + beq adjpath + pla + clc + php + lsr + bcc skiphdr + inx + +adjpath tya eor #$ff adc sizelo sta sizelo @@ -258,9 +271,8 @@ ifoundname dex tya adc namlo sta namlo - pla - and #$20 ;Volume Directory Header XOR subdirectory - bne ++ + dex + beq ++ ;cache block number of current directory ;as starting position for subsequent searches @@ -276,22 +288,79 @@ ifoundname dex stx x80_parms + 5 ++ lda sizelo bne readblock + pla - ;unit to slot for SmartPort interface + ;unit to slot for ProDOS interface +++ pla lsr lsr lsr - tax - lsr - ora #$c0 - ldy DEVADR01HI, x - cpy #$c8 - bcs set_slot - tya -set_slot sta slot + 2 - sta unrentry + 1 + tay + ldx DEVADR01HI, y + cpx #$c8 + bcc set_slot + + ;find SmartPort device for basic MicroDrive support + + ldx #$c8 +- dex + stx blokhi + ldy #0 + sty bloklo + iny + lda (bloklo), y + cmp #$20 + bne - + iny + iny + lda (bloklo), y + bne - + iny + iny + lda (bloklo), y + cmp #3 + bne - + ldy #$ff + lda (bloklo), y + beq - + +set_slot stx slot + 2 + stx unrentry1 + 2 + stx unrentry3 + 2 + +slot ldx $cfff + + ;use SmartPort entrypoint instead + + inx + inx + inx + stx unrentry1 + 1 + stx unrentry3 + 1 + + ldx #2 + stx x80_parms + 4 + lda #0 + sta x80_parms + 5 + jsr MLI + !byte $80 + !word x80_parms + +iterunit inc unrunit2 + +unrentry1 jsr $d1d1 + !byte cmdread + !word unrpacket + bcs iterunit + + ldy #$0f +- lda readbuff + 4, y + cmp readbuff + $204, y + bne iterunit + dey + bpl - + !if load_aux = 1 { sta SETAUXWR + (load_banked * 4) ;SETAUXWR or SETAUXZP } ;load_aux @@ -319,8 +388,6 @@ set_slot sta slot + 2 ;copy new RWTS and interpreter support routines -slot lda $cfff - sta unrentry ldy #0 - lda unrelochdd, y sta reloc, y @@ -1560,22 +1627,32 @@ hddreaddirsect sty adrhi hddseekrd ldy #cmdread !if (aligned_read + enable_write) > 1 { -hddseekrdwr sty command +hddseekrdwr sty pcommand } else { ;not (aligned_read or enable_write) - sty command + sty pcommand hddseekrdwr } ;aligned_read and enable_write - stx bloklo - sta blokhi + stx pblock + sta pblock + 1 hddcallsp -unrunit = unrelochdd + (* + 1 - reloc) - lda #$d1 - sta unit + lda adrhi + sta paddr + 1 + lda adrlo + sta paddr +unrentry3 = unrelochdd + (* - reloc) + jsr $d1d1 +pcommand !byte 0 + !word packet + rts -unrentry = unrelochdd + (* + 1 - reloc) - jmp $d1d1 +unrpacket = unrelochdd + (* - reloc) +packet !byte 3 +unrunit2 = unrelochdd + (* - reloc) + !byte 0 +paddr !word readbuff + $200 +pblock !byte 2, 0, 0 hddcodeend !if swap_zp = 1 { @@ -1746,7 +1823,7 @@ hddsavetreehi = * + 1 lda hdddirbuf, y ora hdddirbuf + 256, y beq sparseblk - inc command + inc pcommand copyblock ldy #0 - lda $a00, y @@ -1804,11 +1881,11 @@ sparseblk ldx #2 lda adrhi cmp #(>hddencbuf) + 2 bne -- - ldx bloklo + ldx pblock inx bne + - inc blokhi -+ lda blokhi + inc pblock + 1 ++ lda pblock + 1 dec ldrhi bne --- @@ -1837,7 +1914,7 @@ foundbit lda (adrlo), y jmp copyblock writeimm sta adrhi - inc command + inc pcommand jmp hddcallsp readpart lda istree diff --git a/src/onbeyond/z5u/z5u.s b/src/onbeyond/z5u/z5u.s index db2c0ae..fa382ea 100644 --- a/src/onbeyond/z5u/z5u.s +++ b/src/onbeyond/z5u/z5u.s @@ -1,6 +1,6 @@ ;license:BSD-3-Clause ;extended open/read/write binary file in ProDOS filesystem, with random access -;copyright (c) Peter Ferrie 2013-18 +;copyright (c) Peter Ferrie 2013-19 ver_02 = 1 @@ -180,7 +180,6 @@ tmp = $8 init lda DEVNUM sta x80_parms + 1 - sta unrunit and #$70 pha ldx #1 @@ -200,6 +199,9 @@ init lda DEVNUM ;find current directory name in directory + sec + php + readblock jsr MLI !byte $80 !word x80_parms @@ -221,7 +223,8 @@ inextent ldy #0 ;match failed, move to next directory in this block, if possible - pla - clc + +skiphdr clc lda bloklo adc #ENTRY_SIZE sta bloklo @@ -250,7 +253,17 @@ ifoundname dex lda (namlo), y cmp #'/' bne - - tya + pla + and #$20 ;Volume Directory Header XOR subdirectory + beq adjpath + pla + clc + php + lsr + bcc skiphdr + inx + +adjpath tya eor #$ff adc sizelo sta sizelo @@ -258,9 +271,8 @@ ifoundname dex tya adc namlo sta namlo - pla - and #$20 ;Volume Directory Header XOR subdirectory - bne ++ + dex + beq ++ ;cache block number of current directory ;as starting position for subsequent searches @@ -276,22 +288,79 @@ ifoundname dex stx x80_parms + 5 ++ lda sizelo bne readblock + pla - ;unit to slot for SmartPort interface + ;unit to slot for ProDOS interface +++ pla lsr lsr lsr - tax - lsr - ora #$c0 - ldy DEVADR01HI, x - cpy #$c8 - bcs set_slot - tya -set_slot sta slot + 2 - sta unrentry + 1 + tay + ldx DEVADR01HI, y + cpx #$c8 + bcc set_slot + + ;find SmartPort device for basic MicroDrive support + + ldx #$c8 +- dex + stx blokhi + ldy #0 + sty bloklo + iny + lda (bloklo), y + cmp #$20 + bne - + iny + iny + lda (bloklo), y + bne - + iny + iny + lda (bloklo), y + cmp #3 + bne - + ldy #$ff + lda (bloklo), y + beq - + +set_slot stx slot + 2 + stx unrentry1 + 2 + stx unrentry3 + 2 + +slot ldx $cfff + + ;use SmartPort entrypoint instead + + inx + inx + inx + stx unrentry1 + 1 + stx unrentry3 + 1 + + ldx #2 + stx x80_parms + 4 + lda #0 + sta x80_parms + 5 + jsr MLI + !byte $80 + !word x80_parms + +iterunit inc unrunit2 + +unrentry1 jsr $d1d1 + !byte cmdread + !word unrpacket + bcs iterunit + + ldy #$0f +- lda readbuff + 4, y + cmp readbuff + $204, y + bne iterunit + dey + bpl - + !if load_aux = 1 { sta SETAUXWR + (load_banked * 4) ;SETAUXWR or SETAUXZP } ;load_aux @@ -319,8 +388,6 @@ set_slot sta slot + 2 ;copy new RWTS and interpreter support routines -slot lda $cfff - sta unrentry ldy #0 - lda unrelochdd, y sta reloc, y @@ -1560,22 +1627,32 @@ hddreaddirsect sty adrhi hddseekrd ldy #cmdread !if (aligned_read + enable_write) > 1 { -hddseekrdwr sty command +hddseekrdwr sty pcommand } else { ;not (aligned_read or enable_write) - sty command + sty pcommand hddseekrdwr } ;aligned_read and enable_write - stx bloklo - sta blokhi + stx pblock + sta pblock + 1 hddcallsp -unrunit = unrelochdd + (* + 1 - reloc) - lda #$d1 - sta unit + lda adrhi + sta paddr + 1 + lda adrlo + sta paddr +unrentry3 = unrelochdd + (* - reloc) + jsr $d1d1 +pcommand !byte 0 + !word packet + rts -unrentry = unrelochdd + (* + 1 - reloc) - jmp $d1d1 +unrpacket = unrelochdd + (* - reloc) +packet !byte 3 +unrunit2 = unrelochdd + (* - reloc) + !byte 0 +paddr !word readbuff + $200 +pblock !byte 2, 0, 0 hddcodeend !if swap_zp = 1 { @@ -1746,7 +1823,7 @@ hddsavetreehi = * + 1 lda hdddirbuf, y ora hdddirbuf + 256, y beq sparseblk - inc command + inc pcommand copyblock ldy #0 - lda $a00, y @@ -1804,11 +1881,11 @@ sparseblk ldx #2 lda adrhi cmp #(>hddencbuf) + 2 bne -- - ldx bloklo + ldx pblock inx bne + - inc blokhi -+ lda blokhi + inc pblock + 1 ++ lda pblock + 1 dec ldrhi bne --- @@ -1837,7 +1914,7 @@ foundbit lda (adrlo), y jmp copyblock writeimm sta adrhi - inc command + inc pcommand jmp hddcallsp readpart lda istree @@ -1859,11 +1936,11 @@ readpart lda istree sta istree ldy lastblk rts -} +-} save_end hookkbd -!pseudopc $2b5 {;;-(callback_e-callback1) { +!pseudopc $2a7 {;;-(callback_e-callback1) { callback1 ldx #