From a8126a1c7582f8a6da855e3b711aa815df2447b6 Mon Sep 17 00:00:00 2001 From: Martin Haye Date: Wed, 18 Jan 2017 09:29:26 -0800 Subject: [PATCH] New disk polling code. --- Platform/Apple/tools/ProRWTS/PRORWTS2#4000 | Bin 1778 -> 1786 bytes Platform/Apple/tools/ProRWTS/prorwts2.s | 89 +++++++++++---------- 2 files changed, 45 insertions(+), 44 deletions(-) diff --git a/Platform/Apple/tools/ProRWTS/PRORWTS2#4000 b/Platform/Apple/tools/ProRWTS/PRORWTS2#4000 index 823f0c68f5b0d5ab7442fe3fa76b5a4609ebd4b1..32a4bac23612c35b882242f4107c0956f0105dff 100644 GIT binary patch delta 823 zcmZwFUr19?7y$5l@8)f;O$VFvD(VjApKXW?>>;TK=kBgDEGS+ghCk!xzcG#>evIbRH2;C-ac^(=Fn``t9^!Ai`Am1BD9m|;qNgZGo?=mW z=n-U(&_WBxX~9iLan4ZWi~yT?>vKwkYS2( zR3FN6z%Antcp6?b|gLfF$83OAQQIv>d;1axuQ?)j|o;5d_ zb^F7MZR&J`;;_$Ah=dWGYJD?FL5m3Duj z9zDlh_9oC!UpLg&(r8m7pym0yXiLIg=aaWgiJsDVm{~<@nE;w z;Tyf|^Rc#3heoHjJ6S7m$`jSAHl+-_%f|OWS}s@%*7#nmTOt(StW~{t%E~67VYPMu zcfzY$P!Z3C(6*?V{hFH2fh3G+PibG2l2vVE>w^QX+3aMqT;!;@R{c0~>Ei@7Dw?9y z9SA~Knaj4A4L?h6rR1Xd0F_p?i{-at-VaqzOoIQ+6 NPGLE<2CtB}{sL>$VPgOQ delta 720 zcmZwDZAcSw90%~b+jebpK7kL*ySYEh@&Suc5Cs*^-EQ*|4SH#W1cCUqT?yMjLD?MPa48URawI{dcxPA$lWY4zp2|WuTqDjNr%b>HF@pRsOB~5`f!a zbUWcpiDzBnD%(0FjxgdwM$9ncPsV2&7W>?$fOyj-zV3_{q)+aG^u}E%NcY^*Gq*%B zQY#}JXTrE(DG22NOTF^Ck{Gclkj|^xHO#qU8xxn?ENilN%@@oi*4gBjiMvP6n>(WHc3p>v6ycVdAxmh@py$RK$A zY*-({X4pv#rO~gvccU88__3-YOJLnm^i=SLi5Lck;04@jbC}IM)kGO**w)H;p?!wU zT1xFLFRjQF_1%FIZf$;%BytH|4)|4+OfRBEff8uJD(n{;B7{PqGNVjJ_klEgi#uv) zAgIwwxq@c|PlPBLqh`RvIRg#tgbkmBr-=@nhS!LC3zetlvE^B8#R$gX6hYzRaE=I= zfoepgRc@SbfxSBG;L(A+4L!k~Elr@&Mh~?ga@e&Q!*~w#sF_>ncSy(AgF&^8uhsg& z+5jr`C&m?LS-uNx<~j7e`wYtD(7G08;^@bHEvx#|AHw_$Nd)mUODvBmex1L|&%w_+ zy4k5l>sRe11IT7$JK(XJugllPb|Re$QQ{Wrw7*j=ZGs-?&|k!za6}I(rj`O|E2LW} z&L)8E#>uX=|ig!Y)z*8w`|AV}>UTPP>{7KGGo3{~=TGhG7@-efA&7 zVGZ&m9@G$Ru!cO)M3)ZB9-qwkVk+;^OqelW4Cgx|d$b>Bv5!Wu0{ch`Ux8Q1>wf`c C8Zt-# diff --git a/Platform/Apple/tools/ProRWTS/prorwts2.s b/Platform/Apple/tools/ProRWTS/prorwts2.s index aff6196a..771b6712 100755 --- a/Platform/Apple/tools/ProRWTS/prorwts2.s +++ b/Platform/Apple/tools/ProRWTS/prorwts2.s @@ -1,6 +1,6 @@ -;extended open/read/write binary file in ProDOS filesystem, with random access -;copyright (c) Peter Ferrie 2013-16 ;license:BSD-3-Clause +;extended open/read/write binary file in ProDOS filesystem, with random access +;copyright (c) Peter Ferrie 2013-17 !cpu 6502 *=$4000 @@ -96,13 +96,13 @@ blokhi = $47 ;ProDOS constant !if allow_trees = 1 { - treeidx = $1b ;(internal) index into tree block - istree = $1c ;(internal) flag to indicate tree file + treeidx = $13 ;(internal) index into tree block + istree = $14 ;(internal) flag to indicate tree file } ;allow_trees entries = $18 ;(internal) total number of entries in directory !if bounds_check = 1 { - bleftlo = $13 ;(internal) bytes left in file - blefthi = $14 ;(internal) bytes left in file + bleftlo = $1b ;(internal) bytes left in file + blefthi = $1c ;(internal) bytes left in file } ;bounds_check blkofflo = $19 ;(internal) offset within cache block blkoffhi = $1a ;(internal) offset within cache block @@ -111,11 +111,6 @@ tmptrk = $1e ;(internal) temporary copy of current track phase = $1f ;(internal) current phase for seek } ;enable_floppy -!if poll_drive = 1 { - retstk = $48 - failctlo = $49 - failcthi = $4A -} ;poll_drive ;constants cmdseek = 0 ;requires enable_seek=1 @@ -176,6 +171,9 @@ init jsr SETVID sta unrdrvoff2 + 1 tax inx ;MOTORON + !if poll_drive = 1 { + stx unrdrvon1 + 1 + } ;poll_drive stx unrdrvon2 + 1 inx ;DRV0EN !if allow_multi = 1 { @@ -183,10 +181,10 @@ init jsr SETVID } ;allow_multi inx inx ;Q6L - !if poll_drive = 1 { - stx unrread0 + 1 - } ;poll_drive stx unrread1 + 1 + !if poll_drive = 1 { + stx unrread2 + 1 + } ;poll_drive stx unrread4 + 1 stx unrread5 + 1 !if check_chksum = 1 { @@ -386,7 +384,7 @@ slot lda $cfff ;can't insert code during pass two because it breaks existing offsets !ifdef PASS2 { - !if >(hddcodeend - reloc) > 1 { + !if >(hddcodeend - reloc) > 0 { !set hack=$100 } ;hddcodeend } else { ;PASS2 @@ -420,10 +418,6 @@ rdwrpart jmp rdwrfile ;self-modified by init code opendir -!if poll_drive = 1 { - tsx - stx retstk -} ;poll_drive unrblocklo = unrelocdsk + (* - reloc) ldx #2 unrblockhi = unrelocdsk + (* - reloc) @@ -494,10 +488,6 @@ savetype } ;might_exist !if (might_exist + poll_drive) > 0 { nodisk - !if poll_drive = 1 { - ldx retstk - txs - } ;poll_drive unrdrvoff1=unrelocdsk+(*-reloc) lda MOTOROFF inc status @@ -642,7 +632,7 @@ foundname iny } ;allow_trees jsr readdirsect !if allow_subdir = 1 { - plp + plp } ;allow_subdir } ;allow_subdir @@ -1009,10 +999,6 @@ step1 !byte 1, $30, $28, $24, $20, $1e, $1d, $1c step2 !byte $70, $2c, $26, $22, $1f, $1e, $1d, $1c readadr - !if poll_drive { - lda #0 - sta failcthi - } ;poll_drive - jsr readd5aa cmp #$96 bne - @@ -1028,19 +1014,7 @@ readadr seekret rts readd5aa - !if poll_drive { -unrread0 = unrelocdsk + (* - reloc) --- lda Q6L - bmi + - inc failctlo - bne -- - inc failcthi - bne -- - jmp nodisk -+ - } else { -- jsr readnib - } - cmp #$d5 bne -- jsr readnib @@ -1054,6 +1028,14 @@ unrread1 = unrelocdsk + (* - reloc) bpl - rts + !if poll_drive = 1 { +checkpoll bcc pollinv ;it's enough to cover an entire sector +failpoll pla + pla + pla + jmp nodisk + } ;poll_drive + readdirsel ldy #0 sty adrlo @@ -1067,13 +1049,32 @@ unrdrvsel = unrelocdsk + (* - reloc) } ;allow_multi !if poll_drive = 1 { sty status - sty failctlo - sty failcthi + pha +unrdrvon1 = unrelocdsk + (* - reloc) + ldy MOTORON + clc ;mark pass 1 + !byte $24 ;mask sec +pollinv sec ;mark pass 2 + + ;watch for sequence of 3 prolog bytes in a row + +-- inc status + beq checkpoll ;loop max 510 times as worst-case + ldy #2 + +unrread2 = unrelocdsk + (* - reloc) +- lda Q6L + bpl - + eor prolog,y + bne -- + dey + bpl - + pla } ;poll_drive readdirsec !if allow_trees = 0 { -readdirsec0 +readdirsect } ;allow_trees ldy #>dirbuf !if allow_trees = 1 { @@ -1348,7 +1349,7 @@ unrhddblockhi = unrelochdd + (* - reloc) hddreaddir !if might_exist = 1 { - ldx hdddirbuf + FILE_COUNT + ldx hdddirbuf + FILE_COUNT ;assuming only 256 files per subdirectory inx stx entries } ;might_exist