TX;SAVE #D9:FMSVTOC.M65AREAD/WRITE DIRAX;&X; RDDIR/WRDIR READ/WRITE DIRECTORYX;$ RDDIR.,;;SET READ8 DDIRIOBX;L WRTDIRV;;;SET WRITE`X;j DIRIOt6;;SAVE READ WRITE~X;,QCDIRS;;CDIRS+3O>4SECVTOC ;; LSB of beginning of directory?;;needed in Y!8;; recover read/write request$>FILDIR,Q>FILDIR;;we want to read/write thisX;HDSYSIO;;GO DO SYSTEM I/OX;AREAD/WRITE VTOCAX;%X; RDVTOC/WRCTOC - READ/WRITE VTOC X; RDVTOC %>DVDWRQ($Q@VTOCPTR7;; need to write VTOC?20H:RWRTS;; yes...so don't read a new one now!<X;F.X; do we read normal vtoc or extended vtoc?PX;Z%ICDNOZ;; drive #d RAMDISKn$Q>DVDRTOP;; top of RAM disk vtocx)>;; is this a RAMDISK?F:RV3;; yesX;'DCBDRV;; for DHADR call"Q>DCBCST;; status request ('S)PDCBCMD;; also set up& DHADR;; call ROM disk I/O routine&Q>DVDVTOP;; assume 810 style drive%DHSTAT;; is it?I:RV3;; yesQ>DVDETOP;; MFM mode:RV3(%ICDNOZ;; once again, drv # (1 to 8),PDRVTBL8;; set vtoc top as drive type$PMAXVTOC;; same thing SETUP doesX;""X; now MAXVTOC is a useful flag,X;6"X; have to handle extended vtoc@,;; set up for readJ0 EVTOCIO;; read extended vtoc (ignore error)T& SAVEEV;; and save it for a moment^!X; (count on A=0 after SAVEEV)h)%>DVDWRQ;; 0-->flag...avoids problemsr+P@VTOCPTR7;; ...with reading junk VTOCs|X;,$ VTOCIO;; then read regular vtoc+ RESTOREEV;; and get extended vtoc back :RWRTS:'X;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;X;X; OPEN VTOCX; OPVTOC RDVTOC;;READ IT ;then fall thru to write it!X;'X;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;X;#X; WRVTOC -- write the full VTOC&X;0 WRTVTOC:Q>D%>DVDWRQ;; turn off flag:N)P@VTOCPTR7;; write no longer requiredX% SAVEEV;; then save extended VTOCb;l) VTOCIO;; while we write regular vtocv& RESTOREEV;; recover extended VTOC;&!EVTOCIO;; and write extended VTOCX;#X;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;X;-X; VTOCIO -- read/write (based on CLC/SEC)#X; primary VTOC sectorX;X; VTOCIO QVTOCPTR;; BUF ADDR, high$VTOCPTR;; and lowX;,%>4SECVTOC;; primary vtoc sector # (lsb) X;$X;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; X;*,X; DSYSIO -- read/write VTOC or DIRECTORY4.X; sector--buffer addr in X and A>,X; (lsb and msb), lsb of sectorH,X; number in Y (msb always $01)R DSYSIO\ 'DCBSECf%>5SECVTOCp)'DCBSEC;; form full sector addressz;fall thru to SECAXIOX;$X;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;X;)X; SECAXIO -- read/write (CLC/SEC) any/X; sector--buffer addr in X and A,X; (lsb and msb), sector number!X; already in DCBSECX; SECAXIOPDCBBUF;; address to DCB &DCBBUF BSIOR;;GO DO I/OI:EVRTS;; good status X; ")>DCBDER;; what kind of error? FDEAD;; data error$ ,!ERRIO;; serial I/O error...user handles. X;8 (DEAD@ERROR E.SYS;; tch tch, fatalB X;L *X;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;V !X; EVTOCIO -- extended vtoc IO` X;j EVTOCIOt 1QMAXVTOC;; does this disk have an ext'd vtoc?~ (I:EVRTS;; no...so don't try anything X; 6;; save READ/WRITE flag Q>4EVSECNUM "PDCBSEC;; set up sector number Q>5EVSECNUM PDCBSEC;; (both bytes) X; "QVTOCPTR;; (also called ZDRVA) , &O>EVOFFSET;;; adjust start of vtoc >;; lsb to X QVTOCPTR O>;; msb to A 8 '!SECAXIO;; do I/O via buffer at A/X X;( X;2 X;< )X;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;F X;P 6X; SAVEEV -- save the 44 bytes of the extended vtocZ 3X; which are also in regular vtoc aread SAVEEVn (%>DVDVTOP;; 1 byte past regular vtocx :SEV2 Q@VTOCPTR7 PFIXEDBITSDVDVTOP8 !Q>;; zero area as we save it P@VTOCPTR7 3 )>DVD2.5;; (144 bytes) H:SEV2 :EVRTS : X; ,X;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; X; %X; RESTOREEV -- the 44 bytes again X; RESTOREEV &%MAXVTOC;; any point in restoring?" )I:RERTS;; no...leave zero bytes alone, %>DVDVTOP6 :REV2@ QFIXEDBITSDVDVTOP8J P@VTOCPTR7T 3^ )>DVD2.5;; (144 bytes)h H:REV2r :RERTS| :