X;SAVE #D9:FMSFMT.M65ADEVICE DEPENDENT COMMANDAX;-X; DFMDDC - DEVICE DEPENDENT CMD EXECUTIONX; DFMDDC$ SETUP;;SET UP FOR EXECUTION.QICCOM9;;GET COMMAND8R>;;is it regular format?B%F:FMT1;;yes...go try for MFM modeL'R>;;what about forced density fmt?VF:FMT2;;yes...do it`X;jX; not a format request...t&X; ...try for one of the standard~X; FMS capabilities.X;R>MAXDDC;;TEST RANGEEDVDCER;;BR OUT OF RANGE;S> ;;SUBTRACT BASE OF CMDSDDVDCER;;BR OUT OF RANGET?? QDVDCVT85;;PUSH EXECUTION ADDRQDVDCVT85: X; DVDCVT XRENAME;; $20-RENAME( XDELETE;; $21-DELETE2 DVDCER;; $INVALID CMD< XLOCK;; $23-LOCKF XUNLOCK;; $24-UNLOCKP XPOINT;; $25-POINTZ XNOTE;; $26-NOTEdX;nMAXDDC';;MAX DVDC+1xX;DVDCER!ERDVDCX;A FORMAT DISKETTEAX;X; the format tables:1X; each table gives (1) number of vtoc bytes2X; for a given drive type, and (2) firstX; five bytes of vtocX; TYPETBL TYPE810 DVDVTOP;; 720 sectors ;; dos type3  = ;; max sectors, current sector cntX; TYPE1050" DVDETOP;; 1024 sectors, ;; dos type63 = ;; max sectors, current sector cnt@X;J TYPERAMT DVDRTOP;; 512 sectors^ ;; dos typeh3  = ;; max sectors, current sector cntrX;|X;!X; XFORMAT - FORMAT A DISKETTEX;!:FMT2 ;; New XIO 253 command(QICAUX19;; did user specify density?H:FMT2A;; yes)Q>DCBCFD;; no...assume single density :FMT2A$>;; used as flag F:FMTJNX;X;%:FMT1 ;; Original XIO 254 format$Q>DCBCFMFM;; start with MFM mode!>;; any non-zero value is flagX; fall thru&X;0 :FMTJN:*&WILDFLAG;; otherwise used only by REND XFORMATN+PDCBCMD;; set up for use by XIO vectorsX!QICDNOZ;; what device number?b2$>TYPERAMTYPETBL;; loc'n of RAMDISK size tbllR>;; ram disk?vF:NOSIO;; yes...no SIO callX;"QVTOCPTR;;MOVE VTOC BUF ADRPDCBBUF;;TO DCB QVTOCPTR PDCBBUF %>@;;TELL SIO RECIEVING DATA&QDSKTIM;;GET FORMAT TIME OUT VALUE, DSIO2;;GOTO LOCAL DISK HANDLER THEN SIOX;*I:FMTSIZE;;IF NO ERRORS CONT FORMATING*X; got an error from SIO format request)>E.NAK;; bad request?&H:OOPS;; no...has to be real error($WILDFLAG;; was this XIO 254 or 253? FXFERR;; 253...no retryX; 0Q>DCBCFD;; yes...what kind of format was it?*RDCBCMD;; standard FM type?4$HXFORMAT;; no...so try that now!>'X; either tried both types of formatH)X; or got error on single density typeR XFERR\!RETURN;; quit with errorfX;p*X; if here, got an error other than NAKzX; :OOPS&)>;;ELSE CK FOR DEVICE DONE ERRORHXFERR;;NO, THEN ERROR EXITX;(X; if DEVICE DONE error, there can be)X; several causes (no disk, door open,)X; write protect set, etc.), so we see'X; if reason for DEVICE DONE was bad"X; sectors found in formatting.X;!;ELSE CHK FOR BAD SECTOR INFO%>;;RETURNED BY CONTROLLER"Q>;; drive uses $FFFF to mark ;end of bad sector list in #;data returned from format call R@VTOCPTR7;; is list empty?$ /HXFBAD;;no...so there were some bad sectors. 38 +R@VTOCPTR7;;still trying for list emptyB $FXFERR;;aha! list is empty...soL 2XFBAD ;; ...DEVICE DONE is for another reasonV @ERROR E.DBAD;; sigh.` X;j 1X;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;t X;~ *X; format was ok...how big is the disk? X; :FMTSIZE .$>TYPE810TYPETBL;; assume single density "QDCBCMD;; which format worked? R>DCBCFD;; single density? !F:NOSIO;; yes...tbl ptr in X! 1$>TYPE1050TYPETBL;; no...assume MFM density X; *X; when here, X-reg is offset to proper X; VTOC set-up table... X; :NOSIO %X; first, we zero all of vtoc area Q> +%>DVD2.5;; max size of extended vtoc :ZLPP@VTOCPTR7( 12 H:ZLP< *X; we didn't change byte 0 of the vtoc,F (X; but that's okay becuz the tableP &X; changes first 5 bytes anyway!Z X;d X; when here, Y-reg is zeron #X; X-reg pts to a tblx X; %QTYPETBL9;; first byte from table 'PMAXVTOC;; is top of pertinent VTOC X; X; :VTSLP 2;; to next byte of tbl $QTYPETBL9;; a byte from table... 'P@VTOCPTR7;; sets up a byte in vtoc 3 )>;; did 5 bytes yet? H:VTSLP;; no X; (X; now, we have to set up the bit map X; X; %>DVDSMP;; start of map" Q>;; for first sector, :BITLP6 P@VTOCPTR7@ ,Q>;; all other sectors get all one bitsJ 3T -)MAXVTOC;; wasn't it nice we set this up?^ H:BITLPh X;r (X; we have to special case a few bits| X; $%>DVDSMP-;;DEALLOCATE MIDDLE 9 Q> P@VTOCPTR7;;FOR 3;;VTOC AND FILE DIR Q> P@VTOCPTR7 X; 1X; now, RAMDISK and regular VTOC are set up... !X; ...but what about MFM VTOC? X; %$MAXVTOC;; just to test the value I:FMTNX;; not extended X; extended! (%>DVDVTOP;; we deallocate sector 720 P@VTOCPTR7;; for safety X;& )%>DVDAUX;; where extended count goes!0 /Q>4 ;; # of sectors in extended area: P@VTOCPTR7;; LSB...D 3N Q>5 X P@VTOCPTR7;; ...and MSBb :FMTNXl X;v X; vtoc is ready to use  WRTVTOC;; so write it out! X; 2X; now, we need to ensure the directory sectors X; are filled with zero bytes X; Q>;; thusly... ? %XF3PFILDIR8;;USE FILE DIR BUFFER 3 IXF3 X; #Q>;;WRITE TO ALL 8 DIR SECTORS PCDIRS XF4 WRTDIR "CDIRS IXF4 X;*  DELDOS;;SET NO DOS4 X;> !FGREAT;;DONE