Home » Personal collection » Acorn hard disk » apps » SCSI » !SCSIFORM/!RUNIMAGE

!SCSIFORM/!RUNIMAGE

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Personal collection » Acorn hard disk » apps » SCSI
Filename: !SCSIFORM/!RUNIMAGE
Read OK:
File size: 6880 bytes
Load address: 0000
Exec address: 0000
File contents
   10REM > !RunImage
   20REM Version 0.05 (Development) : 19-Jun-95
   30REM
   40REM Based on SCSIForm05
   50REM
   60ON ERROR ERROR EXT ERR, REPORT$+" at line "+STR$(ERL)
   70PROCinitialise
   80ON ERROR PROCerror
   90REPEAT
  100 SYS"Wimp_Poll",0,q1% TO r%
  110 CASE r% OF
  120 WHEN 0:     IFscsi_op%<>0 PROCpoll_scsi
  130 WHEN 2:     SYS"Wimp_OpenWindow",,q1%
  140 WHEN 3:     SYS"Wimp_CloseWindow",,q1%
  150             IF!q1%=main% PROCclosedown
  160 WHEN 6:     PROCmouseclick
  170 WHEN 17,18: PROCreceive
  180 ENDCASE
  190UNTIL FALSE
  200END
  210:
  220DEFPROCinitialise
  230LOCAL d%,i%
  240scsi_op%=0
  250started_formatting%=FALSE
  260PROCasm
  270:
  280REM icon number manifests
  290    drive_0%=26
  300    drive_1%=24
  310    drive_2%=25
  320REM drive_3% cannot exist, device 7 is the Scsi card
  330REM drive_4%=0
  340REM drive_5%=1
  350REM drive_6%=2
  360REM drive_7%=3
  370REM device_type_ident%=4
  380    device_type%=5
  390REM device_name_ident%=6
  400    device_name%=7
  410    write_protected%=8
  420    sector_size_256%=27
  430    sector_size_512%=9
  440    sector_size_1024%=11
  450    new_map%=10
  460    fast_format%=12
  470    old_map%=13
  480REM drive_ident%=14
  490    do_format%=15
  500REM status_ident%=16
  510    status%=17
  520REM lfau_ident%=18
  530    lfau_512%=19
  540    lfau_1024%=20
  550    lfau_2048%=21
  560    lfau_4096%=22
  570    skip_format%=23
  580:
  590REM Drive% is really Scsi DeviceID. EOR with 4 to give FileCore drive number
  600DIM iconfor%(6): REM use this array to give icon numbers
  610iconfor%(0)=0: iconfor%(1)=1: iconfor%(2)=2: iconfor%(3)=3
  620iconfor%(4)=drive_0%: iconfor%(5)=drive_1%: iconfor%(6)=drive_2%
  630:
  640REM stuff used by the remains of SCSIForm
  650Write%=2
  660AltDefectBit%=&10
  670DiscStruc%=&14
  680OldMapAdd%=0
  690OldMapSize%=&200
  700DirSize%=&800
  710REMBootAdd%=&C00
  720BootSize%=&200
  730MaxDefects%=(BootSize%-64-&10-4-4)DIV4
  740EndDefect%=1<<29
  750EndDefect2%=1<<30
  760BigSCSIFS%=FNBigSCSIFS
  770REM OldLWM% is dependant on the sector size
  780REM so it is now declared in the disc part of
  790REM the code
  800FreeLink%=1
  810CrossCheck%=3
  820BufSz%=&30000
  830DIM Buf% BufSz%
  840DIM DiscRec% BootSize%+64
  850DIM Defect% BootSize%
  860DIM DirMark% 5
  870Boot%=DiscRec%+64
  880BootRec%=Boot%+BootSize%-64
  890RootDirAdd%=&400
  900IndRootDirAdd%=RootDirAdd%
  910:
  920DIM q1% 256
  930DIM q2% 2048
  940DIM q3% 256
  950maxws%=780:DIM ws% maxws%:wsend%=ws%+maxws%
  960SYS"Wimp_Initialise",223,&4B534154,"SCSI formatter"
  970SYS"Wimp_OpenTemplate",,"<Obey$Dir>.Templates"
  980SYS"Wimp_LoadTemplate",,q2%,ws%,wsend%,-1,"main",0 TO ,,ws%
  990SYS"Wimp_CreateWindow",,q2% TO main%
 1000SYS"Wimp_CloseTemplate"
 1010PROCdisable_drive_icons:PROCenable_drive_icons
 1020FastFormat%=FALSE
 1030SkipFormat%=FALSE
 1040NewMap%=TRUE
 1050Drive%=0
 1060Log2Alloc%=11:PROCShareSizes(Log2Alloc%)
 1070PROCdeselect_icon(fast_format%)
 1080PROCset_drive_icon
 1090PROCset_map_icon
 1100PROCset_lfau_icon
 1110!q1%=main%:SYS"Wimp_GetWindowState",,q1%
 1120SYS"Wimp_OpenWindow",,q1%
 1130error_flag%=3
 1140:
 1150ENDPROC
 1160:
 1170DEFPROCclosedown
 1180IFscsi_op%<>0 SYS"SCSI_Control",1,Drive%,scsi_op%
 1190SYS"OS_Module",7,,RMA%
 1200SYS"Wimp_CloseDown"
 1210END
 1220ENDPROC
 1230:
 1240DEFPROCerror
 1250IFerror_flag%=3 THEN
 1260  PROCerrorbox("Unexpected error :- "+REPORT$+" ("+STR$(ERL)+")")
 1270  ELSE
 1280  PROCerrorbox(REPORT$)
 1290ENDIF
 1300error_flag%=3
 1310ENDPROC
 1320:
 1330DEFPROCok(e$)
 1340error_flag%=1
 1350ERROR 1,e$
 1360ENDPROC
 1370:
 1380DEFPROCfatal(e$)
 1390error_flag%=2
 1400ERROR 1,e$
 1410ENDPROC
 1420:
 1430DEFPROCerrorbox(r$)
 1440LOCAL r%
 1450!q1%=ERR:$(q1%+4)=r$+CHR$0
 1460SYS"Wimp_ReportError",q1%,error_flag%,"SCSI formatter" TO ,r%
 1470IFr%=2 PROCclosedown
 1480IFstarted_formatting% THEN
 1490 PROCenable_user_options
 1500 PROCenable_drive_icons
 1510 started_formatting%=FALSE
 1520 SYS"XOS_CLI","SCSI:Dismount "+STR$(Drive%+4)
 1530 PROCwrite_icon(status%,"Format aborted")
 1540ENDIF
 1550ENDPROC
 1560:
 1570DEFPROCreceive
 1580CASE q1%!16 OF
 1590WHEN0: PROCclosedown
 1600ENDCASE
 1610ENDPROC
 1620:
 1630DEFPROCmouseclick
 1640IFq1%!8 AND 5 THEN
 1650 IFq1%!12=main% THEN
 1660  CASE q1%!16 OF
 1670  WHEN 0          : Drive%=0:PROCset_drive_icon
 1680  WHEN 1          : Drive%=1:PROCset_drive_icon
 1690  WHEN 2          : Drive%=2:PROCset_drive_icon
 1700  WHEN 3          : Drive%=3:PROCset_drive_icon
 1710  WHEN drive_0%   : Drive%=4:PROCset_drive_icon
 1720  WHEN drive_1%   : Drive%=5:PROCset_drive_icon
 1730  WHEN drive_2%   : Drive%=6:PROCset_drive_icon
 1740  WHENfast_format%: FastFormat%=NOTFastFormat%
 1750  WHENskip_format%: SkipFormat%=NOTSkipFormat%
 1760  WHENnew_map%    : NewMap%=TRUE:PROCset_map_icon
 1770  WHENold_map%    : NewMap%=FALSE:PROCset_map_icon
 1780  WHENlfau_512%   : Log2Alloc%=9:PROCShareSizes(Log2Alloc%):PROCset_lfau_icon
 1790  WHENlfau_1024%  : Log2Alloc%=10:PROCShareSizes(Log2Alloc%):PROCset_lfau_icon
 1800  WHENlfau_2048%  : Log2Alloc%=11:PROCShareSizes(Log2Alloc%):PROCset_lfau_icon
 1810  WHENlfau_4096%  : Log2Alloc%=12:PROCShareSizes(Log2Alloc%):PROCset_lfau_icon
 1820  WHENdo_format%  : PROCformat_drive
 1830  ENDCASE
 1840 ENDIF
 1850ENDIF
 1860ENDPROC
 1870:
 1880DEFPROCset_map_icon
 1890IFNewMap% PROCselect_icon(new_map%):PROCenable_lfau ELSE PROCselect_icon(old_map%):PROCdisable_lfau
 1900ENDPROC
 1910:
 1920DEFPROCset_lfau_icon
 1930CASE Log2Alloc% OF
 1940WHEN  9: PROCselect_icon(lfau_512%)
 1950WHEN 10: PROCselect_icon(lfau_1024%)
 1960WHEN 11: PROCselect_icon(lfau_2048%)
 1970WHEN 12: PROCselect_icon(lfau_4096%)
 1980ENDCASE
 1990ENDPROC
 2000:
 2010DEFPROCset_drive_icon
 2020LOCAL f%,r0%
 2030PROCdevice_claim
 2040PROCselect_icon(iconfor%(Drive%))
 2050PROCwrite_icon(status%,"")
 2060SYS"XSCSI_Initialise",2,Drive%,q1% TO r0%;f%
 2070IFf% AND 1 THEN
 2080 PROCstatus_error(r0%)
 2090 IF!r0%<>&201C3 THEN
 2100  PROCwrite_icon(device_type%,FNdevice_type)
 2110  PROCwrite_icon(device_name%,FNdevice_ident)
 2120  PROCdeselect_icon(write_protected%)
 2130  PROCdeselect_icon(sector_size_256%)
 2140  PROCdeselect_icon(sector_size_512%)
 2150  PROCdeselect_icon(sector_size_1024%)
 2160  PROCdisable_icon(write_protected%)
 2170  PROCdisable_icon(sector_size_256%)
 2180  PROCdisable_icon(sector_size_512%)
 2190  PROCdisable_icon(sector_size_1024%)
 2200  PROCdisable_icon(old_map%)
 2210  PROCdisable_icon(new_map%)
 2220  PROCdisable_icon(fast_format%)
 2230  PROCdisable_icon(skip_format%)
 2240  PROCdisable_icon(lfau_512%)
 2250  PROCdisable_icon(lfau_1024%)
 2260  PROCdisable_icon(lfau_2048%)
 2270  PROCdisable_icon(lfau_4096%)
 2280  PROCdisable_icon(do_format%)
 2290  ENDPROC
 2300 ENDIF
 2310ENDIF
 2320PROCwrite_icon(device_type%,FNdevice_type)
 2330PROCenable_icon(write_protected%)
 2340PROCenable_icon(sector_size_256%)
 2350PROCenable_icon(sector_size_512%)
 2360PROCenable_icon(sector_size_1024%)
 2370CASE FNdevice_density OF
 2380  WHEN 256: PROCselect_icon(sector_size_256%)
 2390  WHEN 512: PROCselect_icon(sector_size_512%)
 2400  WHEN 1024:PROCselect_icon(sector_size_1024%)
 2410ENDCASE
 2420IFFNdevice_write_protected THEN
 2430 PROCdisable_user_options
 2440 PROCselect_icon(write_protected%)
 2450ELSE
 2460 PROCenable_user_options
 2470 PROCdeselect_icon(write_protected%)
 2480 IFSkipFormat% PROCselect_icon(skip_format%) ELSE PROCdeselect_icon(skip_format%)
 2490 IFFNdevice_ident<>"MaxOptix Tahiti 1" PROCdisable_icon(fast_format%)
 2500ENDIF
 2510PROCwrite_icon(device_name%,FNdevice_ident)
 2520ENDPROC
 2530:
 2540DEFPROCdisable_user_options
 2550PROCdisable_icon(old_map%)
 2560PROCdisable_icon(new_map%)
 2570PROCdisable_icon(fast_format%)
 2580PROCdisable_icon(skip_format%)
 2590PROCdisable_icon(lfau_512%)
 2600PROCdisable_icon(lfau_1024%)
 2610PROCdisable_icon(lfau_2048%)
 2620PROCdisable_icon(lfau_4096%)
 2630PROCdisable_icon(do_format%)
 2640ENDPROC
 2650:
 2660DEFPROCenable_user_options
 2670PROCenable_icon(old_map%)
 2680PROCenable_icon(new_map%)
 2690PROCenable_icon(fast_format%)
 2700PROCenable_icon(skip_format%)
 2710IFNewMap% PROCenable_lfau ELSE PROCdisable_lfau
 2720PROCenable_icon(do_format%)
 2730ENDPROC
 2740:
 2750DEFPROCdisable_lfau
 2760PROCdisable_icon(lfau_512%)
 2770PROCdisable_icon(lfau_1024%)
 2780PROCdisable_icon(lfau_2048%)
 2790PROCdisable_icon(lfau_4096%)
 2800ENDPROC
 2810:
 2820DEFPROCenable_lfau
 2830PROCenable_icon(lfau_512%)
 2840PROCenable_icon(lfau_1024%)
 2850PROCenable_icon(lfau_2048%)
 2860PROCenable_icon(lfau_4096%)
 2870ENDPROC
 2880:
 2890DEFPROCdisable_drive_icons
 2900LOCAL i%
 2910FORi%=0 TO 6
 2920 PROCdisable_icon(iconfor%(i%))
 2930NEXT
 2940ENDPROC
 2950:
 2960DEFPROCenable_drive_icons
 2970LOCAL i%,f%,h%
 2980SYS"SCSIFS_Drives" TO ,f%,h%
 2990IFf%<>0 THEN
 3000 FORi%=0 TO f%-1
 3010  PROCenable_icon(iconfor%(i%+4))
 3020 NEXT
 3030ENDIF
 3040IFh%<>0 THEN
 3050 FORi%=0 TO h%-1
 3060  PROCenable_icon(iconfor%(i%))
 3070 NEXT
 3080ENDIF
 3090ENDPROC
 3100:
 3110DEFFNdevice_type
 3120?q2%=&12
 3130q2%?1=0
 3140q2%?2=0
 3150q2%?3=0
 3160q2%?4=127
 3170q2%?5=0
 3180SYS"SCSI_Op",1<<24+Drive%,6,q2%,q1%,127
 3190CASE ?q1% OF
 3200WHEN 0: ="Direct access"
 3210WHEN 1: ="Sequential access"
 3220WHEN 2: ="Printer device"
 3230WHEN 3: ="Processor device"
 3240WHEN 4: ="WORM drive"
 3250WHEN 5: ="Read only"
 3260WHEN 7: ="Optical memory"
 3270WHEN&7F:="<Not present>"
 3280OTHERWISE:="Not known: &"+STR$~(?q1%)
 3290ENDCASE
 3300:
 3310DEFFNdevice_ident
 3320LOCAL s1$, s2$
 3330?q2%=&12
 3340q2%?1=0
 3350q2%?2=0
 3360q2%?3=0
 3370q2%?4=127
 3380q2%?5=0
 3390SYS"SCSI_Op",1<<24+Drive%,6,q2%,q1%,127
 3400q1%?32=13
 3410s1$=$(q1%+16):WHILE RIGHT$(s1$)=" " s1$=LEFT$(s1$):ENDWHILE
 3420q1%?16=13
 3430s2$=$(q1%+8):WHILE RIGHT$(s2$)=" " s2$=LEFT$(s2$):ENDWHILE
 3440=s2$+" "+s1$
 3450:
 3460DEFFNdevice_write_protected
 3470?q2%=&1A
 3480q2%?1=0
 3490q2%?2=0
 3500q2%?3=0
 3510q2%?4=4
 3520q2%?5=0
 3530SYS"SCSI_Op",1<<24+Drive%,6,q2%,q1%,127
 3540=((q1%?2 AND 128)<>0)
 3550:
 3560DEFFNdevice_density
 3570LOCAL size%
 3580?q2%=&1A
 3590q2%?1=0
 3600q2%?2=0
 3610q2%?3=0
 3620q2%?4=12
 3630q2%?5=0
 3640SYS"SCSI_Op",1<<24+Drive%,6,q2%,q1%,127
 3650size%=q1%?11+((q1%?10)<<8)+((q1%?9)<<16)
 3660CASE size% OF
 3670WHEN 256 :OldLWM%= &E00: =256
 3680WHEN 512 :OldLWM%= &E00: =512
 3690WHEN 1024:OldLWM%=&1000: =1024
 3700OTHERWISE: PROCfatal("Unsupported block size: "+STR$(size%))
 3710ENDCASE
 3720:
 3730DEFFNdevice_heads
 3740?q2%=&1A
 3750q2%?1=0
 3760q2%?2=4
 3770q2%?3=0
 3780q2%?4=32
 3790q2%?5=0
 3800SYS"SCSI_Op",1<<24+Drive%,6,q2%,q1%,127
 3810REMPROCerrorbox("Heads: "+STR$~q1%?17)
 3820=q1%?17
 3830:
 3840DEFFNdevice_cylinders
 3850?q2%=&1A
 3860q2%?1=0
 3870q2%?2=4
 3880q2%?3=0
 3890q2%?4=32
 3900q2%?5=0
 3910SYS"SCSI_Op",1<<24+Drive%,6,q2%,q1%,127
 3920PROCerrorbox("Cylinders: "+STR$~(q1%?16+((q1%?15)<<8)+((q1%?14)<<16)))
 3930=q1%?16+((q1%?15)<<8)+((q1%?14)<<16)
 3940:
 3950DEFFNdevice_last_block
 3960?q2%=&25
 3970q2%?1=0
 3980q2%!2=0
 3990q2%!6=0
 4000SYS"SCSI_Op",1<<24+Drive%,10,q2%,q1%,127
 4010=q1%?3+((q1%?2)<<8)+((q1%?1)<<16)+((?q1%)<<24)
 4020:
 4030DEFPROCset_device_fast_format
 4040LOCAL p%
 4050REM This procedure is *ONLY* called if we have a
 4060REM Maxtor Tahiti I drive and the user has toggled
 4070REM the Fast Format button.
 4080REM
 4090IFFNdevice_ident<>"MaxOptix Tahiti 1" ENDPROC
 4100REM Step 1. Read the mask for page 2A
 4110q2%?0=&1A
 4120q2%?1=0
 4130q2%?2=&2A+(1<<6)
 4140q2%?3=0
 4150q2%?4=25
 4160q2%?5=0
 4170SYS"SCSI_Op",1<<24+Drive%,6,q2%,q3%,127
 4180REM
 4190REM Step 2. Read the current settings for page 2A
 4200q2%?0=&1A
 4210q2%?1=0
 4220q2%?2=&2A
 4230q2%?3=0
 4240q2%?4=25
 4250q2%?5=0
 4260SYS"SCSI_Op",1<<24+Drive%,6,q2%,q1%,127
 4270REM
 4280REM Step 3. Clear the illegal parts of the page we've
 4290REM         just read
 4300FORp%=0 TO 24
 4310 q1%?p% = q1%?p% AND q3%?p%
 4320NEXT
 4330REM
 4340REM Step 4. Toggle the LNR bit as appropriate
 4350IFFastFormat% THEN
 4360 q1%?14=q1%?14 OR 2
 4370ELSE
 4380 q1%?14=q1%?14 AND NOT2
 4390ENDIF
 4400q1%?08=0
 4410q1%?09=3
 4420q1%?10=0
 4430q1%?11=0
 4440REM
 4450REM Step 5. Write page 2A back
 4460q2%?0=&15
 4470q2%?1=1<<4
 4480q2%?2=0
 4490q2%?3=0
 4500q2%?4=17:REM 25
 4510q2%?5=0
 4520error_flag%=1
 4530SYS"SCSI_Op",1<<25+Drive%,6,q2%,q1%+8,17
 4540error_flag%=3
 4550ENDPROC
 4560:
 4570DEFPROCreset_icon(i%)
 4580!q1%=main%:q1%!4=i%:q1%!8=0:q1%!12=0
 4590SYS"Wimp_SetIconState",,q1%
 4600ENDPROC
 4610:
 4620DEFPROCselect_icon(i%)
 4630!q1%=main%:q1%!4=i%:q1%!8=1<<21:q1%!12=1<<21
 4640SYS"Wimp_SetIconState",,q1%
 4650ENDPROC
 4660:
 4670DEFPROCdeselect_icon(i%)
 4680!q1%=main%:q1%!4=i%:q1%!8=0:q1%!12=1<<21
 4690SYS"Wimp_SetIconState",,q1%
 4700ENDPROC
 4710:
 4720DEFPROCdisable_icon(i%)
 4730!q1%=main%:q1%!4=i%:q1%!8=1<<22:q1%!12=1<<22
 4740SYS"Wimp_SetIconState",,q1%
 4750ENDPROC
 4760:
 4770DEFPROCenable_icon(i%)
 4780!q1%=main%:q1%!4=i%:q1%!8=0:q1%!12=1<<22
 4790SYS"Wimp_SetIconState",,q1%
 4800ENDPROC
 4810:
 4820DEFPROCwrite_icon(i%,s$)
 4830LOCAL p%
 4840!q1%=main%:q1%!4=i%
 4850SYS"Wimp_GetIconState",,q1%
 4860p%=!(q1%+8+20)
 4870$p%=s$
 4880PROCreset_icon(i%)
 4890ENDPROC
 4900:
 4910DEFPROCstatus_error(p%)
 4920LOCAL s$
 4930p%+=4
 4940WHILE ?p%<>0 AND ?p%<>13 AND ?p%<>10
 4950 s$+=CHR$?p%:p%+=1
 4960ENDWHILE
 4970PROCwrite_icon(status%,s$)
 4980ENDPROC
 4990:
 5000DEFPROCdevice_claim
 5010SYS"XSCSI_Reserve",1,Drive%  : REM Force ScsiFs to release drive
 5020SYS"SCSI_Reserve",2,Drive%   : REM But don't keep it ourselves
 5030SYS"SCSI_Control",3,Drive%,0 : REM No timeout
 5040SYS"SCSI_Control",4,Drive%,2 : REM Automatic error reporting
 5050ENDPROC
 5060:
 5070DEFPROCformat_drive
 5080LOCAL i%
 5090started_formatting%=TRUE
 5100PROCdisable_user_options
 5110PROCdisable_drive_icons
 5120PROCwrite_icon(status%,"Formatting. Please wait ...")
 5130SkipFormat%=TRUE
 5140IF SkipFormat% THEN
 5150 scsi_op%=1
 5160 !result=1
 5170ELSE
 5180 PROCset_device_fast_format
 5190 !result=0
 5200 ?q2%=4:q2%!1=0:q2%?5=0
 5210 SYS"SCSI_Op",1<<29+Drive%,6,q2%,q1%,0,0,RMA% TO scsi_op%
 5220ENDIF
 5230ENDPROC
 5240:
 5250DEFPROCpoll_scsi
 5260LOCAL i%
 5270IF!result<>0 THEN
 5280 scsi_op%=0
 5290 IF!result=1 THEN
 5300  PROCStructure
 5310  PROCenable_user_options
 5320  PROCenable_drive_icons
 5330  started_formatting%=FALSE
 5340  SYS"XOS_CLI","SCSI:Dismount "+STR$(Drive%+4)
 5350  PROCwrite_icon(status%,"Format completed")
 5360 ELSE
 5370  PROCstatus_error(!r0_block)
 5380 ENDIF
 5390ENDIF
 5400ENDPROC
 5410:
 5420DEFPROCasm
 5430LOCAL i%
 5440SYS"OS_Module",6,,,128 TO ,,RMA%
 5450FORi%=0 TO 2 STEP 2
 5460P%=RMA%
 5470[ OPT i%
 5480            STR   R0, r0_block
 5490            STR   R1, r1_block
 5500            STR   R2, r2_block
 5510            MOVVC R0, #1
 5520            MOVVS R0, #2
 5530            STR   R0, result
 5540            MOV   PC, R14
 5550.result     EQUD  0
 5560.r0_block   EQUD  0
 5570.r1_block   EQUD  0
 5580.r2_block   EQUD  0
 5590.NewCheck%
 5600            MOV   R0,#0
 5610            ADDS  R2,R1,R2  \C=0
 5620.loop%
 5630            LDR   R3,[R2,#-4]!
 5640            ADCS  R0,R0,R3
 5650            TEQS  R2,R1
 5660            BNE   loop%
 5670            AND   R3,R3,#&FF
 5680            SUB   R0,R0,R3
 5690            EOR   R0,R0,R0,LSR #16
 5700            EOR   R0,R0,R0,LSR #8
 5710            AND   R0,R0,#&FF
 5720            MOVS  PC,R14
 5730]
 5740NEXT
 5750ENDPROC
 5760:
 5770DEFPROCStructure
 5780PROCGetShape
 5790IF NewMap% THEN
 5800 PROCNewStructure
 5810ELSE
 5820 PROCOldStructure
 5830ENDIF
 5840ENDPROC
 5850:
 5860DEFPROCOldStructure
 5870PROCWriteDefectList
 5880PROCWriteOldFsMap
 5890PROCWriteRootDir
 5900ENDPROC
 5910:
 5920REM Calculate the number of map bits required
 5930DEF FNMapBits(Secs%,Lg%,Lg2SecSize%)
 5940    LOCAL Shift%
 5950    Shift%=Lg2SecSize%-Lg%
 5960    IF (Shift%>0) THEN
 5970        =Secs%<<Shift%
 5980    ELSE
 5990        =Secs%>>(-Shift%)
 6000    ENDIF
 6010
 6020DEF FNRoundSectors(Bits%,Lg%,Lg2SecSize%)
 6030    LOCAL Shift%
 6040    Shift%=Lg2SecSize%-Lg%
 6050    IF (Shift%>0) THEN
 6060        =Bits%>>(Shift%)
 6070    ELSE
 6080        =Bits%<<(-Shift%)
 6090    ENDIF
 6100
 6110DEF FNdoalloc(Verbose%)
 6120 Log2Alloc%=Log%:PROCShareSizes(Log2Alloc%)
 6130 MapBits%=FNMapBits(SectorsPerDisc%,Log2Alloc%,Log2SecSize%)
 6140 RoundSectors%=FNRoundSectors(MapBits%,Log2Alloc%,Log2SecSize%)
 6150 BestZones%=1 << 30      :REM init to rogue values
 6160 BestCylOff%=1 << 30
 6170 FOR DummySpare%=1 TO 1
 6180 FOR SpareBits% = 4*8 TO ZoneBits%-Zone0Bits%-8*8
 6190  PROCCalcZones
 6200  LinkBits%=15
 6210REM  REPEAT LinkBits%+=1
 6220   PROCCalcIds
 6230REM  UNTIL Ids%<=2^LinkBits%
 6240  IF SpareBits%-4*8>0 AND SpareBits%-4*8<=LinkBits% NEXT SpareBits%
 6250  IF OddBits%>0 AND OddBits%<=LinkBits% NEXT SpareBits%
 6260  IF LinkBits%>15 OR Zones%>127 THEN
 6270   IF Verbose% THEN PROCmessage_print_0("TooSmallAlloc")
 6280   Log2Alloc%+=1
 6290   NEXT DummySpare%
 6300   =FALSE  :REM restart alloc size loop
 6310  ENDIF
 6320  IF Zones% <= BestZones% THEN
 6330   Crucial%=FNRoundUpShare(Zones%*2)*SecSize%+DirSize%
 6340   IF MapZone%=0 Crucial%=BootAdd%*SecSize%+BootSize%
 6350   IF Crucial%<Alloc%*(LinkBits%+1) Crucial%=Alloc%*(LinkBits%+1)
 6360   CrucialEnd%=MapAdd%+Crucial%/SecSize%
 6370   defectlist%=0:REM We're in the first defect list
 6380   DefPtr%=Defect%
 6390   REPEAT
 6400    defect%=!DefPtr%
 6410    DefPtr%+=4
 6420    IF defect%>=EndDefect% AND defectlist%=0 AND BigDisc% THEN
 6430        defect%=!DefPtr%
 6440        DefPtr%+=4
 6450        defectlist%=1
 6460    ENDIF
 6470    IF defectlist%=0 AND defect%<EndDefect% THEN defect%=defect%/SecSize%
 6480   UNTIL defect%>=EndDefect% OR (defect%>=MapAdd% AND defect%<CrucialEnd%)
 6490   CylOff%=MapAdd% MOD (SecsPerTrk%*Heads%)
 6500   IF defect%>=EndDefect% AND CylOff%<BestCylOff% THEN
 6510    BestCylOff%=CylOff%
 6520    BestLinkBits%=LinkBits%
 6530    BestSpare%=SpareBits%
 6540    BestZones%=Zones%
 6550   ENDIF
 6560   IF BestCylOff% NEXT SpareBits%
 6570   NEXT DummySpare%
 6580  ELSE
 6590   NEXT DummySpare%
 6600  ENDIF
 6610IF BestZones%=(1<<30) AND Verbose%=TRUE THEN PROCmessage_print_0("InvalidAllocSize"):=FALSE
 6620=TRUE
 6630
 6640DEFPROCNewStructure
 6650Zone0Bits%=60*8
 6660ZoneBits%=SecSize%*8
 6670Log2Alloc%=9:PROCShareSizes(Log2Alloc%): REM requested by TCs ECR
 6680IF Log2Alloc%<8 OR Log2Alloc%>12 THEN Log2Alloc%=10:PROCShareSizes(Log2Alloc%)
 6690REM * check for sensible default
 6700Alloc%=2^Log2Alloc%:Log%=Log2Alloc%
 6710WHILE FNdoalloc(FALSE)=FALSE
 6720  Alloc%=2^Log2Alloc%:Log%=Log2Alloc%
 6730ENDWHILE
 6740PRINT
 6750REMREPEAT: REM allocation size loop
 6760REM Alloc%=FNAsk("AllocUnitAsk",2^Log2Alloc%,256)
 6770REM Log%=7
 6780REM REPEAT
 6790REM  Log%+=1
 6800REM UNTIL Alloc%=2^Log% OR Log%=13
 6810REM IF Log%=13 UNTIL FALSE:REM restart alloc size loop
 6820REMUNTIL FNdoalloc(TRUE)
 6830PROCerrorbox("Alloc: &"+STR$~Alloc%)
 6840PROCerrorbox("ShareSize: &"+STR$ShareSize%)
 6850PROCerrorbox("Size of Disc: &"+STR$~DiscSize2%+STR$~DiscSize%)
 6860PRINT
 6870LinkBits%=BestLinkBits%
 6880SpareBits%=BestSpare%
 6890PROCCalcZones
 6900PROCCalcIds
 6910Crucial%=FNRoundUpShare(Zones%*2)*SecSize%+DirSize%
 6920IF MapZone%=0 Crucial%=BootAdd%*SecSize%+BootSize%
 6930IF Crucial%<Alloc%*(LinkBits%+1) Crucial%=Alloc%*(LinkBits%+1)
 6940IF Crucial% MOD Alloc%<>0 Crucial%+=Alloc%-Crucial% MOD Alloc%
 6950IF MapZone%=0 THEN
 6960 RootDirAdd%=BootAdd%+BootSize%/SecSize%
 6970 IndRootDirAdd%=&200 + (BootAdd%*SecSize%+BootSize%) DIV SecSize% + 1
 6980ELSE
 6990 RootDirAdd%=MapAdd%+FNRoundUpShare((MapLen%*2)/SecSize%)
 7000 IndRootDirAdd%=&200+FNRoundUpShare(Zones%*2)/ShareSize%+1
 7010ENDIF
 7011PROCerrorbox("IndRootDirAdd% "+STR$~IndRootDirAdd%)
 7020DiscRec%?4=LinkBits%
 7030DiscRec%?5=Log2Alloc%
 7040REMDiscRec%?8=LowSector%
 7050DiscRec%?9=Zones%
 7060DiscRec%?&A=SpareBits% MOD 256
 7070DiscRec%?&B=SpareBits% DIV 256
 7080DiscRec%!&C=IndRootDirAdd%
 7090DiscRec%!&24=DiscSize2%
 7100DiscRec%!&28=Log2ShareSize%
 7110BootRec%!0=DiscRec%!0
 7120BootRec%!4=DiscRec%!4
 7130BootRec%!8=DiscRec%!8
 7140BootRec%!&C=DiscRec%!&C
 7150BootRec%!&10=DiscRec%!&10
 7160BootRec%!&14=DiscRec%!&14
 7170BootRec%!&24=DiscRec%!&24
 7180BootRec%!&28=DiscRec%!&28
 7190FOR I%=0 TO Zones%*SecSize%-4 STEP 4
 7200 Buf%!I%=0
 7210NEXT I%
 7220FOR I%=0 TO 60-4 STEP 4
 7230 Buf%!(I%+4)=DiscRec%!I%
 7240NEXT I%
 7250PROCWriteDefectList
 7260REMPROCmessage_print_0("CreatingMap")
 7270ptr%=0
 7280DefectStart%=0
 7290defectlist%=0
 7300DiscEndBit%=FNDiscToMap(SectorsPerDisc%)
 7310ZoneStart%=Buf%
 7320ZoneStartBit%=0
 7330FOR zone%=0 TO Zones%-1
 7340 !ZoneStart%=1<<(15+FreeLink%*8)
 7350 ZoneEndBit%=ZoneStartBit%+ZoneBits%
 7360 UsedZoneEndBit%=ZoneEndBit%-SpareBits%+4*8
 7370 IF UsedZoneEndBit%>DiscEndBit% THEN
 7380  UsedZoneEndBit%=DiscEndBit%
 7390 ENDIF
 7400 PreFree%=ZoneStartBit%+FreeLink%*8
 7410 ZoneBit%=ZoneStartBit%+4*8
 7420 IF zone%=0 THEN
 7430  ZoneBit%=ZoneBit%+Zone0Bits%
 7440  length%=(BootAdd%*SecSize%+BootSize%) DIV Alloc%
 7450  IF length%<LinkBits%+1 length%=LinkBits%+1
 7460  PROCWriteLink(ZoneBit%,2)
 7470  PROCWriteLength(ZoneBit%,length%)
 7480  ZoneBit%=ZoneBit%+length%
 7490 ELSE
 7500  IF zone%=MapZone% THEN
 7510   length%=Crucial% DIV Alloc%
 7520   PROCWriteLink(ZoneBit%,2)
 7530   PROCWriteLength(ZoneBit%,length%)
 7540   ZoneBit%=ZoneBit%+length%
 7550  ENDIF
 7560 ENDIF
 7570 REPEAT
 7580  IF ZoneBit%>DefectStart% THEN
 7590   IF defectlist%=0 THEN
 7600       IF Defect%!ptr%>=EndDefect% THEN
 7610           ptr%+=4
 7620           defectlist%=1
 7630           DefectStart%=FNDiscToMap(Defect%!ptr%)
 7640       ELSE
 7650           DefectStart%=FNDiscToMap((Defect%!ptr%)/SecSize%)
 7660       ENDIF
 7670   ELSE
 7680       DefectStart%=FNDiscToMap(Defect%!ptr%)
 7690   ENDIF
 7700   IF DefectStart%>=UsedZoneEndBit% THEN
 7710    DefectStart%=ZoneEndBit%
 7720   ELSE
 7730    DefectEnd%=DefectStart%+1
 7740    ptr%+=4
 7750    REPEAT
 7760     done1%=TRUE
 7770     REPEAT
 7780      done2%=TRUE
 7790      IF defectlist%=1 THEN
 7800          NextDefect%=FNDiscToMap(Defect%!ptr%)
 7810      ELSE
 7820          NextDefect%=FNDiscToMap((Defect%!ptr%)/SecSize%)
 7830      ENDIF
 7840      IF NextDefect%<UsedZoneEndBit% THEN
 7850       IF NextDefect%>ZoneEndBit%-(LinkBits%+1) THEN
 7860        NextDef%=ZoneEndBit%-(LinkBits%+1)
 7870       ELSE
 7880        NextDef%=NextDefect%
 7890       ENDIF
 7900       IF NextDef%-DefectEnd%<LinkBits%+1 THEN
 7910        IF NextDefect%+1>DefectEnd% THEN
 7920         DefectEnd%=NextDefect%+1
 7930        ENDIF
 7940        ptr%+=4
 7950        done2%=FALSE
 7960       ENDIF
 7970      ENDIF
 7980     UNTIL done2%
 7990     IF DefectEnd%-DefectStart%<LinkBits%+1 THEN
 8000      DefectEnd%=DefectStart%+LinkBits%+1
 8010      IF DefectEnd%>ZoneEndBit% THEN
 8020       DefectEnd%=ZoneEndBit%
 8030      ENDIF
 8040      done1%=FALSE
 8050     ENDIF
 8060     IF DefectEnd%>ZoneEndBit%-(LinkBits%+1) AND DefectEnd%<>ZoneEndBit% THEN
 8070      DefectEnd%=ZoneEndBit%
 8080      done1%=FALSE
 8090     ENDIF
 8100     IF DefectEnd%-DefectStart%<LinkBits%+1 THEN
 8110      DefectStart%=DefectEnd%-(LinkBits%+1)
 8120     ENDIF
 8130    UNTIL done1%
 8140   ENDIF
 8150  ENDIF
 8160  IF ZoneBit%>DefectStart% PROCmessage_print_0("ERROR1"):PROCfinish
 8170  IF DefectStart%-ZoneBit% <= LinkBits% THEN DefectStart%=ZoneBit%
 8180  IF DefectStart%>ZoneBit% THEN
 8190   PROCWriteLink(PreFree%,ZoneBit%-PreFree%)
 8200   IF DefectStart%>=UsedZoneEndBit% THEN
 8210    PROCWriteLength(ZoneBit%,UsedZoneEndBit%-ZoneBit%)
 8220    IF ZoneEndBit%>UsedZoneEndBit% THEN
 8230     PROCWriteLink(UsedZoneEndBit%,1)
 8240     PROCWriteLength(UsedZoneEndBit%,ZoneEndBit%-UsedZoneEndBit%)
 8250    ENDIF
 8260   ELSE
 8270    PROCWriteLength(ZoneBit%,DefectStart%-ZoneBit%)
 8280   ENDIF
 8290  PreFree%=ZoneBit%
 8300  ENDIF
 8310  IF DefectStart%<ZoneEndBit% THEN
 8320   IF DefectEnd%>UsedZoneEndBit%-(LinkBits%+1) THEN
 8330    DefectEnd%=ZoneEndBit%
 8340   ENDIF
 8350   PROCWriteLink(DefectStart%,1)
 8360   PROCWriteLength(DefectStart%,DefectEnd%-DefectStart%)
 8370   ZoneBit%=DefectEnd%
 8380  ELSE
 8390   ZoneBit%=ZoneEndBit%
 8400  ENDIF
 8410 UNTIL ZoneBit%=ZoneEndBit%
 8420 PROCWriteLink(PreFree%,0)
 8430 IF zone%=0 THEN
 8440  ZoneStart%?CrossCheck%=&FF
 8450 ELSE
 8460  ZoneStart%?CrossCheck%=0
 8470 ENDIF
 8480 ?ZoneStart%=FNNewMapCheck(ZoneStart%,SecSize%)
 8490 ZoneStart%=ZoneStart%+SecSize%
 8500 ZoneStartBit%=ZoneEndBit%
 8510NEXT zone%
 8520REMPROCmessage_print_0("WritingMap")
 8530PROCMoanOp(Write%,MapAdd%,Buf%,MapLen%)
 8540PROCMoanOp(Write%,MapAdd%+MapLen%/SecSize%,Buf%,MapLen%)
 8550PROCWriteRootDir
 8560ENDPROC
 8570:
 8580DEFPROCCalcZones
 8590UsedBits%=SecSize%*8-SpareBits%
 8600WholeZones%=(MapBits%+Zone0Bits%) DIV UsedBits%
 8610OddBits%=(MapBits%+Zone0Bits%) MOD UsedBits%
 8620IF OddBits% Zones%=WholeZones%+1 ELSE Zones%=WholeZones%
 8630MapZone%=Zones% DIV 2
 8640IF MapZone%=0 THEN
 8650     MapAdd%=0
 8660ELSE
 8670     IF (Alloc%>SecSize%) THEN
 8680         MapAdd%=(UsedBits%*MapZone%-Zone0Bits%)*(Alloc% DIV SecSize%)
 8690     ELSE
 8700         MapAdd%=(UsedBits%*MapZone%-Zone0Bits%) DIV (SecSize% DIV Alloc%)
 8710     ENDIF
 8720ENDIF
 8730REMPROCerrorbox("MapAdd: &"+STR$~MapAdd%)
 8740MapLen%=Zones%*SecSize%
 8750ENDPROC
 8760:
 8770DEFPROCCalcIds
 8780IdsPerZone%=UsedBits% DIV (LinkBits%+1)
 8790Ids%=IdsPerZone% * WholeZones% + OddBits% DIV (LinkBits%+1)
 8800ENDPROC
 8810:
 8820DEFFNDiscToMap(discadd%)
 8830LOCAL bit%,zone%
 8840IF (Alloc%>SecSize%)
 8850    bit%=(discadd% DIV (Alloc% DIV SecSize%))+Zone0Bits%
 8860ELSE
 8870    bit%=(discadd% * (SecSize% DIV Alloc%))+Zone0Bits%
 8880ENDIF
 8890zone%=bit% DIV UsedBits%
 8900bit%=bit%+(bit% DIV UsedBits%)*SpareBits%+4*8
 8910= bit%
 8920:
 8930DEFPROCWriteLink(off%,link%)
 8940IF link%>=2^LinkBits% PROCfatal("PROGRAM ERROR 2")
 8950LOCAL bit%,add%,mask%
 8960bit%=off% MOD 8
 8970add%=Buf%+off% DIV 8
 8980mask%=2^LinkBits%-1
 8990!add%=(!add% AND NOT (mask%<<bit%)) OR link%<<bit%
 9000ENDPROC
 9010:
 9020DEFPROCWriteLength(off%,len%)
 9030IF len%<=LinkBits% PROCfatal("PROGRAM ERROR 3")
 9040off%=off%+len%-1
 9050Buf%?(off%DIV8)+=2^(off%MOD8)
 9060ENDPROC
 9070:
 9080DEFPROCWriteDefectList
 9090REMPROCmessage_print_0("WritingDefects")
 9100ptr%=0
 9110check%=0
 9120WHILE Defect%!ptr%<EndDefect%
 9130 Boot%!ptr%=Defect%!ptr%
 9140 PROCCheckPut(Boot%!ptr%)
 9150 ptr%=ptr%+4
 9160ENDWHILE
 9170check%=check% EOR (check%>>>16)
 9180check%=(check% EOR (check%>>>8))AND &FF
 9190Boot%!ptr%=EndDefect% OR check%
 9200REM If we have a second defect list then do that too
 9210IF BigDisc%
 9220    ptr%+=4
 9230    check%=0
 9240    WHILE Defect%!ptr%<EndDefect%
 9250        Boot%!ptr%=Defect%!ptr%
 9260        PROCCheckPut(Boot%!ptr%)
 9270        ptr%=ptr%+4
 9280    ENDWHILE
 9290    check%=check% EOR (check%>>>16)
 9300    check%=(check% EOR (check%>>>8))AND &FF
 9310    Boot%!ptr%=EndDefect2% OR check%
 9320ENDIF
 9330REM zero out the remainder of the defect list
 9340WHILE ptr%<(MaxDefects%*4)
 9350 ptr%=ptr%+4
 9360 Boot%!ptr%=0
 9370ENDWHILE
 9380PROCSum(Boot%,BootSize%)
 9390PROCMoanOp(Write%,BootAdd%,Boot%,BootSize%)
 9400ENDPROC
 9410:
 9420DEFPROCCheckPut(I%)
 9430check%=(check% >>> 13) EOR ((check% AND (2^13-1)) << (32-13)) EOR I%
 9440ENDPROC
 9450:
 9460DEFPROCSum(base%,len%)
 9470base%?(len%-1)=FNsum(base%,len%)
 9480ENDPROC
 9490:
 9500DEFFNsum(base%,len%)
 9510LOCAL sum%,c%,I%
 9520sum%=0
 9530c%=0
 9540FOR I%=len%-2 TO 0 STEP-1
 9550 sum%=sum%+base%?I%+c%
 9560 IF sum%<&100 c%=0 ELSE sum%=sum% AND &FF:c%=1
 9570NEXT
 9580=sum%
 9590:
 9600DEFPROCMoanOp(b%, C%, D%, E%)
 9610LOCAL d%
 9620d%=Drive%+4
 9630IF BigSCSIFS% THEN
 9640    PROCerrorbox("MoanOp: large "+STR$~b%+" "+STR$~(C% OR d%<<29)+" "+STR$~D%+" "+STR$~E%)
 9650    SYS "SCSIFS_SectorDiscOp", 0, b% OR AltDefectBit% OR (DiscRec%<<6), C% OR d%<<29, D%, E%
 9660ELSE
 9670    PROCerrorbox("MoanOp: small "+STR$~b%+" "+STR$~(C% OR d%<<29)+" "+STR$~D%+" "+STR$~E%)
 9680    SYS "SCSIFS_DiscOp", 0, b% OR AltDefectBit% OR (DiscRec%<<6), (C%*SecSize%) OR d%<<29, D%, E%
 9690ENDIF
 9700ENDPROC
 9710:
 9720DEFPROCWriteOldFsMap
 9730LOCAL s%,I%
 9740PROCwrite_icon(status%,"Writing free space map")
 9750FOR I%=0 TO OldMapSize%-1:Buf%?I%=0:NEXT
 9760s%=OldMapSize% DIV 2
 9770!Buf%=OldLWM% DIV &100
 9780Buf%!s%=(DiscSize%-OldLWM%-Defects%*SecSize%) DIV &100
 9790!(Buf%+s%-4)=DiscSize% DIV &100
 9800!(Buf%+OldMapSize%-5)=RND(&10000)-1
 9810!(Buf%+OldMapSize%-2)=3
 9820PROCSum(Buf%,s%)
 9830PROCSum(Buf%+s%,s%)
 9840PROCMoanOp(Write%,OldMapAdd%,Buf%,OldMapSize%)
 9850ENDPROC
 9860:
 9870DEFPROCWriteRootDir
 9880LOCAL BF%,I%
 9890PROCwrite_icon(status%,"Writing root directory")
 9900FOR I%=0 TO DirSize%-1:Buf%?I%=0:NEXT
 9910$DirMark%="Hugo"
 9920Buf%!1=!DirMark%
 9930BF%=Buf%+DirSize%
 9940IF NewMap% THEN
 9950 BF%!-38=IndRootDirAdd%
 9960ELSE
 9970 BF%!-38=IndRootDirAdd% DIV &100
 9980ENDIF
 9990BF%?-35=ASC"$"
10000BF%?-16=ASC"$"
10010BF%!-5=!DirMark%
10020check%=0
10030PROCCheckPut(!Buf%)
10040PROCCheckPut(Buf%?4)
10050I%=BF%-40
10060WHILE I%AND3
10070 PROCCheckPut(?I%)
10080 I%=I%+1
10090ENDWHILE
10100WHILE I%<BF%-4
10110 PROCCheckPut(!I%)
10120 I%=I%+4
10130ENDWHILE
10140check%=check% EOR (check%>>>16)
10150check%=(check% EOR (check%>>>8))AND &FF
10160BF%?-1=check%
10170PROCMoanOp(Write%,RootDirAdd%,Buf%,DirSize%)
10180ENDPROC
10190:
10200DEFPROCGetShape
10210SecsPerTrk%=1
10220Heads%=FNdevice_heads
10230SecSize%=FNdevice_density
10240BootAdd%=&C00/SecSize%
10250SectorsPerDisc%=(FNdevice_last_block+1)
10260CASE SecSize% OF
10270 WHEN 256 : Log2SecSize%=8
10280 WHEN 512 : Log2SecSize%=9
10290 WHEN 1024: Log2SecSize%=10
10300 OTHERWISE ERROR 0,"Error, sector size must be 256,512 or 1024 bytes"
10310ENDCASE
10320PROCerrorbox("SectorsPerDisc: "+STR$~SectorsPerDisc%)
10330DiscSize%=(SectorsPerDisc% AND ((1<<(32-Log2SecSize%))-1))<<Log2SecSize%
10340PROCerrorbox("DiscSize: &"+STR$~DiscSize%)
10350DiscSize2%=(SectorsPerDisc%>>(32-Log2SecSize%))
10360PROCerrorbox("DiscSize2: &"+STR$~DiscSize2%)
10370IF (DiscSize%>=(512*1024*1024)) OR (DiscSize2%<>0) THEN
10380    BigDisc%=TRUE
10390ELSE
10400    BigDisc%=FALSE
10410ENDIF
10420PROCInitBootRec
10430PROCInitDiscRec
10440ENDPROC
10450:
10460DEFFNNewMapCheck(B%,C%)=USR(NewCheck%)
10470:
10480DEFPROCInitDiscRec
10490FOR I%=0 TO 63
10500 DiscRec%?I%=0
10510NEXT
10520CASE SecSize% OF
10530 WHEN 256 : Log2SecSize%=8
10540 WHEN 512 : Log2SecSize%=9
10550 WHEN 1024: Log2SecSize%=10
10560 OTHERWISE ERROR 0,"Error, sector size must be 256,512 or 1024 bytes"
10570ENDCASE
10580DiscRec%?0=Log2SecSize%
10590DiscRec%?1=SecsPerTrk%
10600DiscRec%?2=Heads%
10610DiscRec%!&C=IndRootDirAdd%
10620DiscRec%!&10=DiscSize%
10630DiscRec%!&24=DiscSize2%
10640DiscRec%!&28=Log2ShareSize%
10650DiscRec%!&14=RND(&10000)-1
10660$(DiscRec%+&16)="SCSIDisc"+STR$(Drive%+4)
10670DiscRec%?&22=(Drive%+4)
10680ENDPROC
10690:
10700DEFPROCInitBootRec
10710FOR I%=0 TO 511
10720 Boot%?I%=0
10730NEXT
10740!Boot%=EndDefect%
10750!Defect%=EndDefect%
10760Boot%!4=EndDefect2%
10770Defect%!4=EndDefect2%
10780Defects%=0
10790ENDPROC
10800
10810REM This function returns TRUE if ADFS is the big version, or FALSE if
10820REM it isn't
10830DEF FNBigSCSIFS
10840    LOCAL Misc_InfoPtr%
10850    LOCAL ERROR
10860    ON ERROR LOCAL:RESTORE ERROR:=FALSE
10870    SYS "SCSIFS_MiscOp",6 TO Misc_InfoPtr%
10880    RESTORE ERROR
10890    =((!Misc_InfoPtr%) AND &200)=&200
10900
10910DEF PROCShareSizes(L2A%)
10920IF L2A%<13 THEN
10930    Log2ShareSize%=0
10940ELSE
10950    Log2ShareSize%=L2A%-12
10960ENDIF
10970ShareSize%=1<<Log2ShareSize%
10980ENDPROC
10990
11000DEF FNRoundUpShare(Secs%)
11010IF Log2ShareSize%=0 THEN =Secs%
11020=((Secs%+ShareSize%-1)DIVShareSize%)*ShareSize%
11030

� > !RunImage
,� Version 0.05 (Development) : 19-Jun-95
�
(� Based on SCSIForm05
2�
<"� � � � �, �$+" at line "+�(�)
F�initialise
P� � �error
Z�
d ș"Wimp_Poll",0,q1% � r%
n Ȏ r% �
x% � 0:     �scsi_op%<>0 �poll_scsi
�& � 2:     ș"Wimp_OpenWindow",,q1%
�' � 3:     ș"Wimp_CloseWindow",,q1%
�'             �!q1%=main% �closedown
� � 6:     �mouseclick
� � 17,18: �receive
� �
�� �
��
�:
���initialise
�� d%,i%
�scsi_op%=0
�started_formatting%=�
�asm
:
� icon number manifests
"    drive_0%=26
,    drive_1%=24
6    drive_2%=25
@6� drive_3% cannot exist, device 7 is the Scsi card
J� drive_4%=0
T� drive_5%=1
^� drive_6%=2
h� drive_7%=3
r� device_type_ident%=4
|    device_type%=5
�� device_name_ident%=6
�    device_name%=7
�    write_protected%=8
�    sector_size_256%=27
�    sector_size_512%=9
�    sector_size_1024%=11
�    new_map%=10
�    fast_format%=12
�    old_map%=13
�� drive_ident%=14
�    do_format%=15
�� status_ident%=16
�    status%=17
� lfau_ident%=18
    lfau_512%=19
    lfau_1024%=20
&    lfau_2048%=21
0    lfau_4096%=22
:    skip_format%=23
D:
NN� Drive% is really Scsi DeviceID. EOR with 4 to give FileCore drive number
X8� iconfor%(6): � use this array to give icon numbers
b>iconfor%(0)=0: iconfor%(1)=1: iconfor%(2)=2: iconfor%(3)=3
lDiconfor%(4)=drive_0%: iconfor%(5)=drive_1%: iconfor%(6)=drive_2%
v:
�+� stuff used by the remains of SCSIForm
�Write%=2
�AltDefectBit%=&10
�DiscStruc%=&14
�OldMapAdd%=0
�OldMapSize%=&200
�DirSize%=&800
��BootAdd%=&C00
�BootSize%=&200
�(MaxDefects%=(BootSize%-64-&10-4-4)�4
�EndDefect%=1<<29
�EndDefect2%=1<<30
�BigSCSIFS%=�BigSCSIFS
-� OldLWM% is dependant on the sector size
/� so it is now declared in the disc part of
� the code
 FreeLink%=1
*CrossCheck%=3
4BufSz%=&30000
>� Buf% BufSz%
H� DiscRec% BootSize%+64
R� Defect% BootSize%
\� DirMark% 5
fBoot%=DiscRec%+64
pBootRec%=Boot%+BootSize%-64
zRootDirAdd%=&400
�IndRootDirAdd%=RootDirAdd%
�:
�
� q1% 256
�� q2% 2048
�
� q3% 256
�-maxws%=780:� ws% maxws%:wsend%=ws%+maxws%
�6ș"Wimp_Initialise",223,&4B534154,"SCSI formatter"
�1ș"Wimp_OpenTemplate",,"<Obey$Dir>.Templates"
�=ș"Wimp_LoadTemplate",,q2%,ws%,wsend%,-1,"main",0 � ,,ws%
�&ș"Wimp_CreateWindow",,q2% � main%
�ș"Wimp_CloseTemplate"
�,�disable_drive_icons:�enable_drive_icons
�FastFormat%=�
SkipFormat%=�

NewMap%=�
Drive%=0
$)Log2Alloc%=11:�ShareSizes(Log2Alloc%)
. �deselect_icon(fast_format%)
8�set_drive_icon
B�set_map_icon
L�set_lfau_icon
V+!q1%=main%:ș"Wimp_GetWindowState",,q1%
`ș"Wimp_OpenWindow",,q1%
jerror_flag%=3
t:
~�
�:
���closedown
�3�scsi_op%<>0 ș"SCSI_Control",1,Drive%,scsi_op%
�ș"OS_Module",7,,RMA%
�ș"Wimp_CloseDown"
��
��
�:
���error
��error_flag%=3 �
�8  �errorbox("Unexpected error :- "+�$+" ("+�(�)+")")
�  �
  �errorbox(�$)

�
error_flag%=3
�
(:
2��ok(e$)
<error_flag%=1
F
� 1,e$
P�
Z:
d��fatal(e$)
nerror_flag%=2
x
� 1,e$
��
�:
���errorbox(r$)
�� r%
�!q1%=�:$(q1%+4)=r$+�0
�?ș"Wimp_ReportError",q1%,error_flag%,"SCSI formatter" � ,r%
��r%=2 �closedown
��started_formatting% �
� �enable_user_options
� �enable_drive_icons
� started_formatting%=�
�- ș"XOS_CLI","SCSI:Dismount "+�(Drive%+4)
�* �write_icon(status%,"Format aborted")
�
�
:
"
��receive
,Ȏ q1%!16 �
6�0: �closedown
@�
J�
T:
^��mouseclick
h�q1%!8 � 5 �
r �q1%!12=main% �
|  Ȏ q1%!16 �
�-  � 0          : Drive%=0:�set_drive_icon
�-  � 1          : Drive%=1:�set_drive_icon
�-  � 2          : Drive%=2:�set_drive_icon
�-  � 3          : Drive%=3:�set_drive_icon
�-  � drive_0%   : Drive%=4:�set_drive_icon
�-  � drive_1%   : Drive%=5:�set_drive_icon
�-  � drive_2%   : Drive%=6:�set_drive_icon
�-  �fast_format%: FastFormat%=�FastFormat%
�-  �skip_format%: SkipFormat%=�SkipFormat%
�,  �new_map%    : NewMap%=�:�set_map_icon
�,  �old_map%    : NewMap%=�:�set_map_icon
�H  �lfau_512%   : Log2Alloc%=9:�ShareSizes(Log2Alloc%):�set_lfau_icon
�I  �lfau_1024%  : Log2Alloc%=10:�ShareSizes(Log2Alloc%):�set_lfau_icon
I  �lfau_2048%  : Log2Alloc%=11:�ShareSizes(Log2Alloc%):�set_lfau_icon
I  �lfau_4096%  : Log2Alloc%=12:�ShareSizes(Log2Alloc%):�set_lfau_icon
"  �do_format%  : �format_drive
&  �
0 �
:�
D�
N:
X��set_map_icon
bW�NewMap% �select_icon(new_map%):�enable_lfau � �select_icon(old_map%):�disable_lfau
l�
v:
���set_lfau_icon
�Ȏ Log2Alloc% �
�!�  9: �select_icon(lfau_512%)
�"� 10: �select_icon(lfau_1024%)
�"� 11: �select_icon(lfau_2048%)
�"� 12: �select_icon(lfau_4096%)
��
��
�:
���set_drive_icon
�� f%,r0%
��device_claim
�"�select_icon(iconfor%(Drive%))
�write_icon(status%,"")
.ș"XSCSI_Initialise",2,Drive%,q1% � r0%;f%

�f% � 1 �
  �status_error(r0%)
* �!r0%<>&201C3 �
4,  �write_icon(device_type%,�device_type)
>-  �write_icon(device_name%,�device_ident)
H&  �deselect_icon(write_protected%)
R&  �deselect_icon(sector_size_256%)
\&  �deselect_icon(sector_size_512%)
f'  �deselect_icon(sector_size_1024%)
p%  �disable_icon(write_protected%)
z%  �disable_icon(sector_size_256%)
�%  �disable_icon(sector_size_512%)
�&  �disable_icon(sector_size_1024%)
�  �disable_icon(old_map%)
�  �disable_icon(new_map%)
�!  �disable_icon(fast_format%)
�!  �disable_icon(skip_format%)
�  �disable_icon(lfau_512%)
�  �disable_icon(lfau_1024%)
�  �disable_icon(lfau_2048%)
�  �disable_icon(lfau_4096%)
�  �disable_icon(do_format%)
�  �
� �
	�
	*�write_icon(device_type%,�device_type)
	"�enable_icon(write_protected%)
	$"�enable_icon(sector_size_256%)
	."�enable_icon(sector_size_512%)
	8#�enable_icon(sector_size_1024%)
	BȎ �device_density �
	L+  � 256: �select_icon(sector_size_256%)
	V+  � 512: �select_icon(sector_size_512%)
	`,  � 1024:�select_icon(sector_size_1024%)
	j�
	t�device_write_protected �
	~ �disable_user_options
	�# �select_icon(write_protected%)
	��
	� �enable_user_options
	�% �deselect_icon(write_protected%)
	�K �SkipFormat% �select_icon(skip_format%) � �deselect_icon(skip_format%)
	�D �device_ident<>"MaxOptix Tahiti 1" �disable_icon(fast_format%)
	��
	�+�write_icon(device_name%,�device_ident)
	��
	�:
	���disable_user_options
	��disable_icon(old_map%)
�disable_icon(new_map%)

�disable_icon(fast_format%)
�disable_icon(skip_format%)
�disable_icon(lfau_512%)
(�disable_icon(lfau_1024%)
2�disable_icon(lfau_2048%)
<�disable_icon(lfau_4096%)
F�disable_icon(do_format%)
P�
Z:
d��enable_user_options
n�enable_icon(old_map%)
x�enable_icon(new_map%)
��enable_icon(fast_format%)
��enable_icon(skip_format%)
�)�NewMap% �enable_lfau � �disable_lfau
��enable_icon(do_format%)
��
�:
���disable_lfau
��disable_icon(lfau_512%)
��disable_icon(lfau_1024%)
��disable_icon(lfau_2048%)
��disable_icon(lfau_4096%)
��
�:
��enable_lfau
�enable_icon(lfau_512%)
�enable_icon(lfau_1024%)
"�enable_icon(lfau_2048%)
,�enable_icon(lfau_4096%)
6�
@:
J��disable_drive_icons
T� i%
^
�i%=0 � 6
h  �disable_icon(iconfor%(i%))
r�
|�
�:
���enable_drive_icons
�� i%,f%,h%
�ș"SCSIFS_Drives" � ,f%,h%
��f%<>0 �
� �i%=0 � f%-1
�"  �enable_icon(iconfor%(i%+4))
� �
��
��h%<>0 �
� �i%=0 � h%-1
�   �enable_icon(iconfor%(i%))
� �
�
�
:
&ݤdevice_type
0?q2%=&12
:q2%?1=0
Dq2%?2=0
Nq2%?3=0
X
q2%?4=127
bq2%?5=0
l*ș"SCSI_Op",1<<24+Drive%,6,q2%,q1%,127
v
Ȏ ?q1% �
�� 0: ="Direct access"
�� 1: ="Sequential access"
�� 2: ="Printer device"
�� 3: ="Processor device"
�� 4: ="WORM drive"
�� 5: ="Read only"
�� 7: ="Optical memory"
��&7F:="<Not present>"
�:="Not known: &"+�~(?q1%)
��
�:
�ݤdevice_ident
�� s1$, s2$

?q2%=&12

q2%?1=0

q2%?2=0

 q2%?3=0

*
q2%?4=127

4q2%?5=0

>*ș"SCSI_Op",1<<24+Drive%,6,q2%,q1%,127

H
q1%?32=13

R*s1$=$(q1%+16):ȕ �s1$)=" " s1$=�s1$):�

\
q1%?16=13

f)s2$=$(q1%+8):ȕ �s2$)=" " s2$=�s2$):�

p=s2$+" "+s1$

z:

�ݤdevice_write_protected

�?q2%=&1A

�q2%?1=0

�q2%?2=0

�q2%?3=0

�q2%?4=4

�q2%?5=0

�*ș"SCSI_Op",1<<24+Drive%,6,q2%,q1%,127

�=((q1%?2 � 128)<>0)

�:

�ݤdevice_density

�� size%

�?q2%=&1A
q2%?1=0
q2%?2=0
q2%?3=0
$q2%?4=12
.q2%?5=0
8*ș"SCSI_Op",1<<24+Drive%,6,q2%,q1%,127
B,size%=q1%?11+((q1%?10)<<8)+((q1%?9)<<16)
LȎ size% �
V� 256 :OldLWM%= &E00: =256
`� 512 :OldLWM%= &E00: =512
j� 1024:OldLWM%=&1000: =1024
t2: �fatal("Unsupported block size: "+�(size%))
~�
�:
�ݤdevice_heads
�?q2%=&1A
�q2%?1=0
�q2%?2=4
�q2%?3=0
�q2%?4=32
�q2%?5=0
�*ș"SCSI_Op",1<<24+Drive%,6,q2%,q1%,127
�(�PROCerrorbox("Heads: "+STR$~q1%?17)
�=q1%?17
�:
ݤdevice_cylinders

?q2%=&1A
q2%?1=0
q2%?2=4
(q2%?3=0
2q2%?4=32
<q2%?5=0
F*ș"SCSI_Op",1<<24+Drive%,6,q2%,q1%,127
PD�errorbox("Cylinders: "+�~(q1%?16+((q1%?15)<<8)+((q1%?14)<<16)))
Z(=q1%?16+((q1%?15)<<8)+((q1%?14)<<16)
d:
nݤdevice_last_block
x?q2%=&25
�q2%?1=0
�q2%!2=0
�q2%!6=0
�+ș"SCSI_Op",1<<24+Drive%,10,q2%,q1%,127
�2=q1%?3+((q1%?2)<<8)+((q1%?1)<<16)+((?q1%)<<24)
�:
���set_device_fast_format
�� p%
�2� This procedure is *ONLY* called if we have a
�4� Maxtor Tahiti I drive and the user has toggled
�� the Fast Format button.
��
�)�device_ident<>"MaxOptix Tahiti 1" �
'� Step 1. Read the mask for page 2A

q2%?0=&1A
q2%?1=0
"q2%?2=&2A+(1<<6)
,q2%?3=0
6q2%?4=25
@q2%?5=0
J*ș"SCSI_Op",1<<24+Drive%,6,q2%,q3%,127
T�
^3� Step 2. Read the current settings for page 2A
h
q2%?0=&1A
rq2%?1=0
|
q2%?2=&2A
�q2%?3=0
�q2%?4=25
�q2%?5=0
�*ș"SCSI_Op",1<<24+Drive%,6,q2%,q1%,127
��
�7� Step 3. Clear the illegal parts of the page we've
��         just read
��p%=0 � 24
� q1%?p% = q1%?p% � q3%?p%
��
��
�/� Step 4. Toggle the LNR bit as appropriate
��FastFormat% �
 q1%?14=q1%?14 � 2
�
 q1%?14=q1%?14 � �2
&�
0q1%?08=0
:q1%?09=3
Dq1%?10=0
Nq1%?11=0
X�
b � Step 5. Write page 2A back
l
q2%?0=&15
vq2%?1=1<<4
�q2%?2=0
�q2%?3=0
�q2%?4=17:� 25
�q2%?5=0
�error_flag%=1
�+ș"SCSI_Op",1<<25+Drive%,6,q2%,q1%+8,17
�error_flag%=3
��
�:
���reset_icon(i%)
�(!q1%=main%:q1%!4=i%:q1%!8=0:q1%!12=0
�ș"Wimp_SetIconState",,q1%
��
:
��select_icon(i%)
0!q1%=main%:q1%!4=i%:q1%!8=1<<21:q1%!12=1<<21
 ș"Wimp_SetIconState",,q1%
*�
4:
>��deselect_icon(i%)
H,!q1%=main%:q1%!4=i%:q1%!8=0:q1%!12=1<<21
Rș"Wimp_SetIconState",,q1%
\�
f:
p��disable_icon(i%)
z0!q1%=main%:q1%!4=i%:q1%!8=1<<22:q1%!12=1<<22
�ș"Wimp_SetIconState",,q1%
��
�:
���enable_icon(i%)
�,!q1%=main%:q1%!4=i%:q1%!8=0:q1%!12=1<<22
�ș"Wimp_SetIconState",,q1%
��
�:
���write_icon(i%,s$)
�� p%
�!q1%=main%:q1%!4=i%
�ș"Wimp_GetIconState",,q1%
�p%=!(q1%+8+20)

$p%=s$
�reset_icon(i%)
�
$:
.��status_error(p%)
8� s$
B	p%+=4
L!ȕ ?p%<>0 � ?p%<>13 � ?p%<>10
V s$+=�?p%:p%+=1
`�
j�write_icon(status%,s$)
t�
~:
���device_claim
�Aș"XSCSI_Reserve",1,Drive%  : � Force ScsiFs to release drive
�?ș"SCSI_Reserve",2,Drive%   : � But don't keep it ourselves
�.ș"SCSI_Control",3,Drive%,0 : � No timeout
�=ș"SCSI_Control",4,Drive%,2 : � Automatic error reporting
��
�:
���format_drive
�� i%
�started_formatting%=�
��disable_user_options
��disable_drive_icons
6�write_icon(status%,"Formatting. Please wait ...")

SkipFormat%=�
� SkipFormat% �
 scsi_op%=1
( !result=1
2�
< �set_device_fast_format
F !result=0
P ?q2%=4:q2%!1=0:q2%?5=0
Z; ș"SCSI_Op",1<<29+Drive%,6,q2%,q1%,0,0,RMA% � scsi_op%
d�
n�
x:
���poll_scsi
�� i%
��!result<>0 �
� scsi_op%=0
� �!result=1 �
�  �Structure
�  �enable_user_options
�  �enable_drive_icons
�  started_formatting%=�
�.  ș"XOS_CLI","SCSI:Dismount "+�(Drive%+4)
�-  �write_icon(status%,"Format completed")
� �
�  �status_error(!r0_block)
 �
�
�
":
,	��asm
6� i%
@"ș"OS_Module",6,,,128 � ,,RMA%
J�i%=0 � 2 � 2
TP%=RMA%
^[ OPT i%
h"            STR   R0, r0_block
r"            STR   R1, r1_block
|"            STR   R2, r2_block
�            MOVVC R0, #1
�            MOVVS R0, #2
�             STR   R0, result
�            MOV   PC, R14
�.result     EQUD  0
�.r0_block   EQUD  0
�.r1_block   EQUD  0
�.r2_block   EQUD  0
�.NewCheck%
�            MOV   R0,#0
�$            ADDS  R2,R1,R2  \C=0
�
.loop%
�"            LDR   R3,[R2,#-4]!
            ADCS  R0,R0,R3
            TEQS  R2,R1
            BNE   loop%
&            �   R3,R3,#&FF
0            SUB   R0,R0,R3
:$            �   R0,R0,R0,LSR #16
D#            �   R0,R0,R0,LSR #8
N            �   R0,R0,#&FF
X            MOVS  PC,R14
b]
l�
v�
�:
���Structure
�
�GetShape
�� NewMap% �
� �NewStructure
��
� �OldStructure
��
��
�:
���OldStructure
��WriteDefectList
��WriteOldFsMap
�WriteRootDir
�
:
 /� Calculate the number of map bits required
*%� �MapBits(Secs%,Lg%,Lg2SecSize%)
4    � Shift%
>    Shift%=Lg2SecSize%-Lg%
H    � (Shift%>0) �
R        =Secs%<<Shift%
\	    �
f        =Secs%>>(-Shift%)
p	    �
z
�*� �RoundSectors(Bits%,Lg%,Lg2SecSize%)
�    � Shift%
�    Shift%=Lg2SecSize%-Lg%
�    � (Shift%>0) �
�        =Bits%>>(Shift%)
�	    �
�        =Bits%<<(-Shift%)
�	    �
�
�� �doalloc(Verbose%)
�, Log2Alloc%=Log%:�ShareSizes(Log2Alloc%)
�? MapBits%=�MapBits(SectorsPerDisc%,Log2Alloc%,Log2SecSize%)
�B RoundSectors%=�RoundSectors(MapBits%,Log2Alloc%,Log2SecSize%)
4 BestZones%=1 << 30      :� init to rogue values
 BestCylOff%=1 << 30
 � DummySpare%=1 � 1
$2 � SpareBits% = 4*8 � ZoneBits%-Zone0Bits%-8*8
.  �CalcZones
8  LinkBits%=15
B�  REPEAT LinkBits%+=1
L   �CalcIds
V�  UNTIL Ids%<=2^LinkBits%
`A  � SpareBits%-4*8>0 � SpareBits%-4*8<=LinkBits% � SpareBits%
j5  � OddBits%>0 � OddBits%<=LinkBits% � SpareBits%
t#  � LinkBits%>15 � Zones%>127 �
~5   � Verbose% � �message_print_0("TooSmallAlloc")
�   Log2Alloc%+=1
�   � DummySpare%
�%   =�  :� restart alloc size loop
�  �
�  � Zones% <= BestZones% �
�9   Crucial%=�RoundUpShare(Zones%*2)*SecSize%+DirSize%
�8   � MapZone%=0 Crucial%=BootAdd%*SecSize%+BootSize%
�D   � Crucial%<Alloc%*(LinkBits%+1) Crucial%=Alloc%*(LinkBits%+1)
�,   CrucialEnd%=MapAdd%+Crucial%/SecSize%
�5   defectlist%=0:� We're in the first defect list
�   DefPtr%=Defect%
�   �
    defect%=!DefPtr%

    DefPtr%+=4
:    � defect%>=EndDefect% � defectlist%=0 � BigDisc% �
        defect%=!DefPtr%
(        DefPtr%+=4
2        defectlist%=1
<	    �
FG    � defectlist%=0 � defect%<EndDefect% � defect%=defect%/SecSize%
PG   � defect%>=EndDefect% � (defect%>=MapAdd% � defect%<CrucialEnd%)
Z-   CylOff%=MapAdd% � (SecsPerTrk%*Heads%)
d4   � defect%>=EndDefect% � CylOff%<BestCylOff% �
n    BestCylOff%=CylOff%
x    BestLinkBits%=LinkBits%
�    BestSpare%=SpareBits%
�    BestZones%=Zones%
�   �
�!   � BestCylOff% � SpareBits%
�   � DummySpare%
�  �
�   � DummySpare%
�  �
�O� BestZones%=(1<<30) � Verbose%=� � �message_print_0("InvalidAllocSize"):=�
�=�
�
���NewStructure
�Zone0Bits%=60*8
ZoneBits%=SecSize%*8
@Log2Alloc%=9:�ShareSizes(Log2Alloc%): � requested by TCs ECR
J� Log2Alloc%<8 � Log2Alloc%>12 � Log2Alloc%=10:�ShareSizes(Log2Alloc%)
""� * check for sensible default
,'Alloc%=2^Log2Alloc%:Log%=Log2Alloc%
6ȕ �doalloc(�)=�
@)  Alloc%=2^Log2Alloc%:Log%=Log2Alloc%
J�
T�
^%�REPEAT: REM allocation size loop
h3� Alloc%=FNAsk("AllocUnitAsk",2^Log2Alloc%,256)
r� Log%=7
|� REPEAT
��  Log%+=1
�$� UNTIL Alloc%=2^Log% OR Log%=13
�8� IF Log%=13 UNTIL FALSE:REM restart alloc size loop
��UNTIL FNdoalloc(TRUE)
�"�errorbox("Alloc: &"+�~Alloc%)
�)�errorbox("ShareSize: &"+�ShareSize%)
�9�errorbox("Size of Disc: &"+�~DiscSize2%+�~DiscSize%)
��
�LinkBits%=BestLinkBits%
�SpareBits%=BestSpare%
��CalcZones
��CalcIds
�6Crucial%=�RoundUpShare(Zones%*2)*SecSize%+DirSize%
5� MapZone%=0 Crucial%=BootAdd%*SecSize%+BootSize%
A� Crucial%<Alloc%*(LinkBits%+1) Crucial%=Alloc%*(LinkBits%+1)
=� Crucial% � Alloc%<>0 Crucial%+=Alloc%-Crucial% � Alloc%
&� MapZone%=0 �
0, RootDirAdd%=BootAdd%+BootSize%/SecSize%
:G IndRootDirAdd%=&200 + (BootAdd%*SecSize%+BootSize%) � SecSize% + 1
D�
N< RootDirAdd%=MapAdd%+�RoundUpShare((MapLen%*2)/SecSize%)
X= IndRootDirAdd%=&200+�RoundUpShare(Zones%*2)/ShareSize%+1
b�
c1�errorbox("IndRootDirAdd% "+�~IndRootDirAdd%)
lDiscRec%?4=LinkBits%
vDiscRec%?5=Log2Alloc%
��DiscRec%?8=LowSector%
�DiscRec%?9=Zones%
� DiscRec%?&A=SpareBits% � 256
� DiscRec%?&B=SpareBits% � 256
�DiscRec%!&C=IndRootDirAdd%
�DiscRec%!&24=DiscSize2%
�DiscRec%!&28=Log2ShareSize%
�BootRec%!0=DiscRec%!0
�BootRec%!4=DiscRec%!4
�BootRec%!8=DiscRec%!8
�BootRec%!&C=DiscRec%!&C
�BootRec%!&10=DiscRec%!&10
�BootRec%!&14=DiscRec%!&14
BootRec%!&24=DiscRec%!&24
BootRec%!&28=DiscRec%!&28
"� I%=0 � Zones%*SecSize%-4 � 4
  Buf%!I%=0
*� I%
4� I%=0 � 60-4 � 4
> Buf%!(I%+4)=DiscRec%!I%
H� I%
R�WriteDefectList
\'�PROCmessage_print_0("CreatingMap")
f
ptr%=0
pDefectStart%=0
zdefectlist%=0
�+DiscEndBit%=�DiscToMap(SectorsPerDisc%)
�ZoneStart%=Buf%
�ZoneStartBit%=0
�� zone%=0 � Zones%-1
�$ !ZoneStart%=1<<(15+FreeLink%*8)
�( ZoneEndBit%=ZoneStartBit%+ZoneBits%
�/ UsedZoneEndBit%=ZoneEndBit%-SpareBits%+4*8
�$ � UsedZoneEndBit%>DiscEndBit% �
�!  UsedZoneEndBit%=DiscEndBit%
� �
�' PreFree%=ZoneStartBit%+FreeLink%*8
� ZoneBit%=ZoneStartBit%+4*8
� � zone%=0 �
"  ZoneBit%=ZoneBit%+Zone0Bits%
4  length%=(BootAdd%*SecSize%+BootSize%) � Alloc%
/  � length%<LinkBits%+1 length%=LinkBits%+1
$  �WriteLink(ZoneBit%,2)
.$  �WriteLength(ZoneBit%,length%)
8  ZoneBit%=ZoneBit%+length%
B �
L  � zone%=MapZone% �
V    length%=Crucial% � Alloc%
`   �WriteLink(ZoneBit%,2)
j%   �WriteLength(ZoneBit%,length%)
t    ZoneBit%=ZoneBit%+length%
~  �
� �
� �
�  � ZoneBit%>DefectStart% �
�   � defectlist%=0 �
�'       � Defect%!ptr%>=EndDefect% �
�           ptr%+=4
�           defectlist%=1
�4           DefectStart%=�DiscToMap(Defect%!ptr%)
�       �
�?           DefectStart%=�DiscToMap((Defect%!ptr%)/SecSize%)
�       �
�   �
0       DefectStart%=�DiscToMap(Defect%!ptr%)

   �
(   � DefectStart%>=UsedZoneEndBit% �
     DefectStart%=ZoneEndBit%
(   �
2!    DefectEnd%=DefectStart%+1
<    ptr%+=4
F	    �
P     done1%=�
Z
     �
d      done2%=�
n      � defectlist%=1 �
x2          NextDefect%=�DiscToMap(Defect%!ptr%)
�      �
�=          NextDefect%=�DiscToMap((Defect%!ptr%)/SecSize%)
�      �
�)      � NextDefect%<UsedZoneEndBit% �
�4       � NextDefect%>ZoneEndBit%-(LinkBits%+1) �
�.        NextDef%=ZoneEndBit%-(LinkBits%+1)
�       �
�         NextDef%=NextDefect%
�       �
�.       � NextDef%-DefectEnd%<LinkBits%+1 �
�(        � NextDefect%+1>DefectEnd% �
�%         DefectEnd%=NextDefect%+1
�
        �
        ptr%+=4
        done2%=�
       �
"      �
,     � done2%
60     � DefectEnd%-DefectStart%<LinkBits%+1 �
@-      DefectEnd%=DefectStart%+LinkBits%+1
J$      � DefectEnd%>ZoneEndBit% �
T!       DefectEnd%=ZoneEndBit%
^      �
h      done1%=�
r
     �
|K     � DefectEnd%>ZoneEndBit%-(LinkBits%+1) � DefectEnd%<>ZoneEndBit% �
�       DefectEnd%=ZoneEndBit%
�      done1%=�
�
     �
�0     � DefectEnd%-DefectStart%<LinkBits%+1 �
�/      DefectStart%=DefectEnd%-(LinkBits%+1)
�
     �
�    � done1%
�   �
�  �
�@  � ZoneBit%>DefectStart% �message_print_0("ERROR1"):�finish
�B  � DefectStart%-ZoneBit% <= LinkBits% � DefectStart%=ZoneBit%
�  � DefectStart%>ZoneBit% �
�-   �WriteLink(PreFree%,ZoneBit%-PreFree%)
 (   � DefectStart%>=UsedZoneEndBit% �
 7    �WriteLength(ZoneBit%,UsedZoneEndBit%-ZoneBit%)
 '    � ZoneEndBit%>UsedZoneEndBit% �
 &&     �WriteLink(UsedZoneEndBit%,1)
 0B     �WriteLength(UsedZoneEndBit%,ZoneEndBit%-UsedZoneEndBit%)
 :	    �
 D   �
 N4    �WriteLength(ZoneBit%,DefectStart%-ZoneBit%)
 X   �
 b  PreFree%=ZoneBit%
 l  �
 v"  � DefectStart%<ZoneEndBit% �
 �3   � DefectEnd%>UsedZoneEndBit%-(LinkBits%+1) �
 �    DefectEnd%=ZoneEndBit%
 �   �
 �!   �WriteLink(DefectStart%,1)
 �9   �WriteLength(DefectStart%,DefectEnd%-DefectStart%)
 �   ZoneBit%=DefectEnd%
 �  �
 �   ZoneBit%=ZoneEndBit%
 �  �
 � � ZoneBit%=ZoneEndBit%
 � �WriteLink(PreFree%,0)
 � � zone%=0 �
 �   ZoneStart%?CrossCheck%=&FF
! �
!  ZoneStart%?CrossCheck%=0
! �
! 2 ?ZoneStart%=�NewMapCheck(ZoneStart%,SecSize%)
!*# ZoneStart%=ZoneStart%+SecSize%
!4 ZoneStartBit%=ZoneEndBit%
!>� zone%
!H&�PROCmessage_print_0("WritingMap")
!R(�MoanOp(Write%,MapAdd%,Buf%,MapLen%)
!\9�MoanOp(Write%,MapAdd%+MapLen%/SecSize%,Buf%,MapLen%)
!f�WriteRootDir
!p�
!z:
!���CalcZones
!�#UsedBits%=SecSize%*8-SpareBits%
!�1WholeZones%=(MapBits%+Zone0Bits%) � UsedBits%
!�.OddBits%=(MapBits%+Zone0Bits%) � UsedBits%
!�8� OddBits% Zones%=WholeZones%+1 � Zones%=WholeZones%
!�MapZone%=Zones% � 2
!�� MapZone%=0 �
!�     MapAdd%=0
!��
!�     � (Alloc%>SecSize%) �
!�H         MapAdd%=(UsedBits%*MapZone%-Zone0Bits%)*(Alloc% � SecSize%)
!�
     �
!�J         MapAdd%=(UsedBits%*MapZone%-Zone0Bits%) � (SecSize% � Alloc%)
"
     �
"�
"+�PROCerrorbox("MapAdd: &"+STR$~MapAdd%)
"$MapLen%=Zones%*SecSize%
".�
"8:
"B
��CalcIds
"L)IdsPerZone%=UsedBits% � (LinkBits%+1)
"V=Ids%=IdsPerZone% * WholeZones% + OddBits% � (LinkBits%+1)
"`�
"j:
"tݤDiscToMap(discadd%)
"~� bit%,zone%
"�� (Alloc%>SecSize%)
"�8    bit%=(discadd% � (Alloc% � SecSize%))+Zone0Bits%
"��
"�8    bit%=(discadd% * (SecSize% � Alloc%))+Zone0Bits%
"��
"�zone%=bit% � UsedBits%
"�/bit%=bit%+(bit% � UsedBits%)*SpareBits%+4*8
"�
= bit%
"�:
"���WriteLink(off%,link%)
"�2� link%>=2^LinkBits% �fatal("PROGRAM ERROR 2")
"�� bit%,add%,mask%
#bit%=off% � 8
#
add%=Buf%+off% � 8
#mask%=2^LinkBits%-1
#1!add%=(!add% � � (mask%<<bit%)) � link%<<bit%
#(�
#2:
#<��WriteLength(off%,len%)
#F/� len%<=LinkBits% �fatal("PROGRAM ERROR 3")
#Poff%=off%+len%-1
#ZBuf%?(off%�8)+=2^(off%�8)
#d�
#n:
#x��WriteDefectList
#�*�PROCmessage_print_0("WritingDefects")
#�
ptr%=0
#�check%=0
#�ȕ Defect%!ptr%<EndDefect%
#� Boot%!ptr%=Defect%!ptr%
#� �CheckPut(Boot%!ptr%)
#� ptr%=ptr%+4
#��
#�!check%=check% � (check%>>>16)
#�'check%=(check% � (check%>>>8))� &FF
#�"Boot%!ptr%=EndDefect% � check%
#�6� If we have a second defect list then do that too
#�� BigDisc%
$    ptr%+=4
$    check%=0
$"    ȕ Defect%!ptr%<EndDefect%
$"#        Boot%!ptr%=Defect%!ptr%
$,!        �CheckPut(Boot%!ptr%)
$6        ptr%=ptr%+4
$@	    �
$J%    check%=check% � (check%>>>16)
$T+    check%=(check% � (check%>>>8))� &FF
$^'    Boot%!ptr%=EndDefect2% � check%
$h�
$r/� zero out the remainder of the defect list
$|ȕ ptr%<(MaxDefects%*4)
$� ptr%=ptr%+4
$� Boot%!ptr%=0
$��
$��Sum(Boot%,BootSize%)
$�,�MoanOp(Write%,BootAdd%,Boot%,BootSize%)
$��
$�:
$���CheckPut(I%)
$�Bcheck%=(check% >>> 13) � ((check% � (2^13-1)) << (32-13)) � I%
$��
$�:
$���Sum(base%,len%)
$�#base%?(len%-1)=�sum(base%,len%)
%�
%:
%ݤsum(base%,len%)
%&� sum%,c%,I%
%0
sum%=0
%:c%=0
%D� I%=len%-2 � 0 �-1
%N sum%=sum%+base%?I%+c%
%X, � sum%<&100 c%=0 � sum%=sum% � &FF:c%=1
%b�
%l	=sum%
%v:
%���MoanOp(b%, C%, D%, E%)
%�� d%
%�d%=Drive%+4
%�� BigSCSIFS% �
%�N    �errorbox("MoanOp: large "+�~b%+" "+�~(C% � d%<<29)+" "+�~D%+" "+�~E%)
%�\    ș "SCSIFS_SectorDiscOp", 0, b% � AltDefectBit% � (DiscRec%<<6), C% � d%<<29, D%, E%
%��
%�N    �errorbox("MoanOp: small "+�~b%+" "+�~(C% � d%<<29)+" "+�~D%+" "+�~E%)
%�a    ș "SCSIFS_DiscOp", 0, b% � AltDefectBit% � (DiscRec%<<6), (C%*SecSize%) � d%<<29, D%, E%
%��
%��
%�:
%���WriteOldFsMap
&� s%,I%
&1�write_icon(status%,"Writing free space map")
&&� I%=0 � OldMapSize%-1:Buf%?I%=0:�
& s%=OldMapSize% � 2
&*!Buf%=OldLWM% � &100
&48Buf%!s%=(DiscSize%-OldLWM%-Defects%*SecSize%) � &100
&>!!(Buf%+s%-4)=DiscSize% � &100
&H%!(Buf%+OldMapSize%-5)=�(&10000)-1
&R!(Buf%+OldMapSize%-2)=3
&\�Sum(Buf%,s%)
&f�Sum(Buf%+s%,s%)
&p/�MoanOp(Write%,OldMapAdd%,Buf%,OldMapSize%)
&z�
&�:
&���WriteRootDir
&�� BF%,I%
&�1�write_icon(status%,"Writing root directory")
&�#� I%=0 � DirSize%-1:Buf%?I%=0:�
&�$DirMark%="Hugo"
&�Buf%!1=!DirMark%
&�BF%=Buf%+DirSize%
&�� NewMap% �
&� BF%!-38=IndRootDirAdd%
&��
&�" BF%!-38=IndRootDirAdd% � &100
&��
'BF%?-35=�"$"
'BF%?-16=�"$"
'BF%!-5=!DirMark%
'$check%=0
'.�CheckPut(!Buf%)
'8�CheckPut(Buf%?4)
'B
I%=BF%-40
'Lȕ I%�3
'V �CheckPut(?I%)
'` I%=I%+1
'j�
'tȕ I%<BF%-4
'~ �CheckPut(!I%)
'� I%=I%+4
'��
'�!check%=check% � (check%>>>16)
'�'check%=(check% � (check%>>>8))� &FF
'�BF%?-1=check%
'�-�MoanOp(Write%,RootDirAdd%,Buf%,DirSize%)
'��
'�:
'���GetShape
'�SecsPerTrk%=1
'�Heads%=�device_heads
'�SecSize%=�device_density
(BootAdd%=&C00/SecSize%
(
*SectorsPerDisc%=(�device_last_block+1)
(Ȏ SecSize% �
( � 256 : Log2SecSize%=8
(( � 512 : Log2SecSize%=9
(2 � 1024: Log2SecSize%=10
(<=  � 0,"Error, sector size must be 256,512 or 1024 bytes"
(F�
(P3�errorbox("SectorsPerDisc: "+�~SectorsPerDisc%)
(ZJDiscSize%=(SectorsPerDisc% � ((1<<(32-Log2SecSize%))-1))<<Log2SecSize%
(d(�errorbox("DiscSize: &"+�~DiscSize%)
(n3DiscSize2%=(SectorsPerDisc%>>(32-Log2SecSize%))
(x*�errorbox("DiscSize2: &"+�~DiscSize2%)
(�6� (DiscSize%>=(512*1024*1024)) � (DiscSize2%<>0) �
(�    BigDisc%=�
(��
(�    BigDisc%=�
(��
(��InitBootRec
(��InitDiscRec
(��
(�:
(�%ݤNewMapCheck(B%,C%)=�(NewCheck%)
(�:
(���InitDiscRec
(�� I%=0 � 63
) DiscRec%?I%=0
)�
)Ȏ SecSize% �
)" � 256 : Log2SecSize%=8
), � 512 : Log2SecSize%=9
)6 � 1024: Log2SecSize%=10
)@=  � 0,"Error, sector size must be 256,512 or 1024 bytes"
)J�
)TDiscRec%?0=Log2SecSize%
)^DiscRec%?1=SecsPerTrk%
)hDiscRec%?2=Heads%
)rDiscRec%!&C=IndRootDirAdd%
)|DiscRec%!&10=DiscSize%
)�DiscRec%!&24=DiscSize2%
)�DiscRec%!&28=Log2ShareSize%
)�DiscRec%!&14=�(&10000)-1
)�*$(DiscRec%+&16)="SCSIDisc"+�(Drive%+4)
)�DiscRec%?&22=(Drive%+4)
)��
)�:
)���InitBootRec
)�� I%=0 � 511
)� Boot%?I%=0
)��
)�!Boot%=EndDefect%
)�!Defect%=EndDefect%
*Boot%!4=EndDefect2%
*Defect%!4=EndDefect2%
*Defects%=0
*&�
*0
*:H� This function returns TRUE if ADFS is the big version, or FALSE if
*D� it isn't
*N� �BigSCSIFS
*X    � Misc_InfoPtr%
*b    � �
*l    � � �:� �:=�
*v,    ș "SCSIFS_MiscOp",6 � Misc_InfoPtr%
*�    � �
*�'    =((!Misc_InfoPtr%) � &200)=&200
*�
*�� �ShareSizes(L2A%)
*�� L2A%<13 �
*�    Log2ShareSize%=0
*��
*�    Log2ShareSize%=L2A%-12
*��
*� ShareSize%=1<<Log2ShareSize%
*��
*�
*�� �RoundUpShare(Secs%)
+� Log2ShareSize%=0 � =Secs%
+1=((Secs%+ShareSize%-1)�ShareSize%)*ShareSize%
+
�
00000000  0d 00 0a 11 f4 20 3e 20  21 52 75 6e 49 6d 61 67  |..... > !RunImag|
00000010  65 0d 00 14 2c f4 20 56  65 72 73 69 6f 6e 20 30  |e...,. Version 0|
00000020  2e 30 35 20 28 44 65 76  65 6c 6f 70 6d 65 6e 74  |.05 (Development|
00000030  29 20 3a 20 31 39 2d 4a  75 6e 2d 39 35 0d 00 1e  |) : 19-Jun-95...|
00000040  05 f4 0d 00 28 19 f4 20  42 61 73 65 64 20 6f 6e  |....(.. Based on|
00000050  20 53 43 53 49 46 6f 72  6d 30 35 0d 00 32 05 f4  | SCSIForm05..2..|
00000060  0d 00 3c 22 ee 20 85 20  85 20 a2 20 9f 2c 20 f6  |..<". . . . ., .|
00000070  24 2b 22 20 61 74 20 6c  69 6e 65 20 22 2b c3 28  |$+" at line "+.(|
00000080  9e 29 0d 00 46 0f f2 69  6e 69 74 69 61 6c 69 73  |.)..F..initialis|
00000090  65 0d 00 50 0e ee 20 85  20 f2 65 72 72 6f 72 0d  |e..P.. . .error.|
000000a0  00 5a 05 f5 0d 00 64 1d  20 c8 99 22 57 69 6d 70  |.Z....d. .."Wimp|
000000b0  5f 50 6f 6c 6c 22 2c 30  2c 71 31 25 20 b8 20 72  |_Poll",0,q1% . r|
000000c0  25 0d 00 6e 0c 20 c8 8e  20 72 25 20 ca 0d 00 78  |%..n. .. r% ...x|
000000d0  25 20 c9 20 30 3a 20 20  20 20 20 e7 73 63 73 69  |% . 0:     .scsi|
000000e0  5f 6f 70 25 3c 3e 30 20  f2 70 6f 6c 6c 5f 73 63  |_op%<>0 .poll_sc|
000000f0  73 69 0d 00 82 26 20 c9  20 32 3a 20 20 20 20 20  |si...& . 2:     |
00000100  c8 99 22 57 69 6d 70 5f  4f 70 65 6e 57 69 6e 64  |.."Wimp_OpenWind|
00000110  6f 77 22 2c 2c 71 31 25  0d 00 8c 27 20 c9 20 33  |ow",,q1%...' . 3|
00000120  3a 20 20 20 20 20 c8 99  22 57 69 6d 70 5f 43 6c  |:     .."Wimp_Cl|
00000130  6f 73 65 57 69 6e 64 6f  77 22 2c 2c 71 31 25 0d  |oseWindow",,q1%.|
00000140  00 96 27 20 20 20 20 20  20 20 20 20 20 20 20 20  |..'             |
00000150  e7 21 71 31 25 3d 6d 61  69 6e 25 20 f2 63 6c 6f  |.!q1%=main% .clo|
00000160  73 65 64 6f 77 6e 0d 00  a0 19 20 c9 20 36 3a 20  |sedown.... . 6: |
00000170  20 20 20 20 f2 6d 6f 75  73 65 63 6c 69 63 6b 0d  |    .mouseclick.|
00000180  00 aa 16 20 c9 20 31 37  2c 31 38 3a 20 f2 72 65  |... . 17,18: .re|
00000190  63 65 69 76 65 0d 00 b4  06 20 cb 0d 00 be 07 fd  |ceive.... ......|
000001a0  20 a3 0d 00 c8 05 e0 0d  00 d2 05 3a 0d 00 dc 10  | ..........:....|
000001b0  dd f2 69 6e 69 74 69 61  6c 69 73 65 0d 00 e6 0b  |..initialise....|
000001c0  ea 20 64 25 2c 69 25 0d  00 f0 0e 73 63 73 69 5f  |. d%,i%....scsi_|
000001d0  6f 70 25 3d 30 0d 00 fa  19 73 74 61 72 74 65 64  |op%=0....started|
000001e0  5f 66 6f 72 6d 61 74 74  69 6e 67 25 3d a3 0d 01  |_formatting%=...|
000001f0  04 08 f2 61 73 6d 0d 01  0e 05 3a 0d 01 18 1b f4  |...asm....:.....|
00000200  20 69 63 6f 6e 20 6e 75  6d 62 65 72 20 6d 61 6e  | icon number man|
00000210  69 66 65 73 74 73 0d 01  22 13 20 20 20 20 64 72  |ifests..".    dr|
00000220  69 76 65 5f 30 25 3d 32  36 0d 01 2c 13 20 20 20  |ive_0%=26..,.   |
00000230  20 64 72 69 76 65 5f 31  25 3d 32 34 0d 01 36 13  | drive_1%=24..6.|
00000240  20 20 20 20 64 72 69 76  65 5f 32 25 3d 32 35 0d  |    drive_2%=25.|
00000250  01 40 36 f4 20 64 72 69  76 65 5f 33 25 20 63 61  |.@6. drive_3% ca|
00000260  6e 6e 6f 74 20 65 78 69  73 74 2c 20 64 65 76 69  |nnot exist, devi|
00000270  63 65 20 37 20 69 73 20  74 68 65 20 53 63 73 69  |ce 7 is the Scsi|
00000280  20 63 61 72 64 0d 01 4a  10 f4 20 64 72 69 76 65  | card..J.. drive|
00000290  5f 34 25 3d 30 0d 01 54  10 f4 20 64 72 69 76 65  |_4%=0..T.. drive|
000002a0  5f 35 25 3d 31 0d 01 5e  10 f4 20 64 72 69 76 65  |_5%=1..^.. drive|
000002b0  5f 36 25 3d 32 0d 01 68  10 f4 20 64 72 69 76 65  |_6%=2..h.. drive|
000002c0  5f 37 25 3d 33 0d 01 72  1a f4 20 64 65 76 69 63  |_7%=3..r.. devic|
000002d0  65 5f 74 79 70 65 5f 69  64 65 6e 74 25 3d 34 0d  |e_type_ident%=4.|
000002e0  01 7c 16 20 20 20 20 64  65 76 69 63 65 5f 74 79  |.|.    device_ty|
000002f0  70 65 25 3d 35 0d 01 86  1a f4 20 64 65 76 69 63  |pe%=5..... devic|
00000300  65 5f 6e 61 6d 65 5f 69  64 65 6e 74 25 3d 36 0d  |e_name_ident%=6.|
00000310  01 90 16 20 20 20 20 64  65 76 69 63 65 5f 6e 61  |...    device_na|
00000320  6d 65 25 3d 37 0d 01 9a  1a 20 20 20 20 77 72 69  |me%=7....    wri|
00000330  74 65 5f 70 72 6f 74 65  63 74 65 64 25 3d 38 0d  |te_protected%=8.|
00000340  01 a4 1b 20 20 20 20 73  65 63 74 6f 72 5f 73 69  |...    sector_si|
00000350  7a 65 5f 32 35 36 25 3d  32 37 0d 01 ae 1a 20 20  |ze_256%=27....  |
00000360  20 20 73 65 63 74 6f 72  5f 73 69 7a 65 5f 35 31  |  sector_size_51|
00000370  32 25 3d 39 0d 01 b8 1c  20 20 20 20 73 65 63 74  |2%=9....    sect|
00000380  6f 72 5f 73 69 7a 65 5f  31 30 32 34 25 3d 31 31  |or_size_1024%=11|
00000390  0d 01 c2 13 20 20 20 20  6e 65 77 5f 6d 61 70 25  |....    new_map%|
000003a0  3d 31 30 0d 01 cc 17 20  20 20 20 66 61 73 74 5f  |=10....    fast_|
000003b0  66 6f 72 6d 61 74 25 3d  31 32 0d 01 d6 13 20 20  |format%=12....  |
000003c0  20 20 6f 6c 64 5f 6d 61  70 25 3d 31 33 0d 01 e0  |  old_map%=13...|
000003d0  15 f4 20 64 72 69 76 65  5f 69 64 65 6e 74 25 3d  |.. drive_ident%=|
000003e0  31 34 0d 01 ea 15 20 20  20 20 64 6f 5f 66 6f 72  |14....    do_for|
000003f0  6d 61 74 25 3d 31 35 0d  01 f4 16 f4 20 73 74 61  |mat%=15..... sta|
00000400  74 75 73 5f 69 64 65 6e  74 25 3d 31 36 0d 01 fe  |tus_ident%=16...|
00000410  12 20 20 20 20 73 74 61  74 75 73 25 3d 31 37 0d  |.    status%=17.|
00000420  02 08 14 f4 20 6c 66 61  75 5f 69 64 65 6e 74 25  |.... lfau_ident%|
00000430  3d 31 38 0d 02 12 14 20  20 20 20 6c 66 61 75 5f  |=18....    lfau_|
00000440  35 31 32 25 3d 31 39 0d  02 1c 15 20 20 20 20 6c  |512%=19....    l|
00000450  66 61 75 5f 31 30 32 34  25 3d 32 30 0d 02 26 15  |fau_1024%=20..&.|
00000460  20 20 20 20 6c 66 61 75  5f 32 30 34 38 25 3d 32  |    lfau_2048%=2|
00000470  31 0d 02 30 15 20 20 20  20 6c 66 61 75 5f 34 30  |1..0.    lfau_40|
00000480  39 36 25 3d 32 32 0d 02  3a 17 20 20 20 20 73 6b  |96%=22..:.    sk|
00000490  69 70 5f 66 6f 72 6d 61  74 25 3d 32 33 0d 02 44  |ip_format%=23..D|
000004a0  05 3a 0d 02 4e 4e f4 20  44 72 69 76 65 25 20 69  |.:..NN. Drive% i|
000004b0  73 20 72 65 61 6c 6c 79  20 53 63 73 69 20 44 65  |s really Scsi De|
000004c0  76 69 63 65 49 44 2e 20  45 4f 52 20 77 69 74 68  |viceID. EOR with|
000004d0  20 34 20 74 6f 20 67 69  76 65 20 46 69 6c 65 43  | 4 to give FileC|
000004e0  6f 72 65 20 64 72 69 76  65 20 6e 75 6d 62 65 72  |ore drive number|
000004f0  0d 02 58 38 de 20 69 63  6f 6e 66 6f 72 25 28 36  |..X8. iconfor%(6|
00000500  29 3a 20 f4 20 75 73 65  20 74 68 69 73 20 61 72  |): . use this ar|
00000510  72 61 79 20 74 6f 20 67  69 76 65 20 69 63 6f 6e  |ray to give icon|
00000520  20 6e 75 6d 62 65 72 73  0d 02 62 3e 69 63 6f 6e  | numbers..b>icon|
00000530  66 6f 72 25 28 30 29 3d  30 3a 20 69 63 6f 6e 66  |for%(0)=0: iconf|
00000540  6f 72 25 28 31 29 3d 31  3a 20 69 63 6f 6e 66 6f  |or%(1)=1: iconfo|
00000550  72 25 28 32 29 3d 32 3a  20 69 63 6f 6e 66 6f 72  |r%(2)=2: iconfor|
00000560  25 28 33 29 3d 33 0d 02  6c 44 69 63 6f 6e 66 6f  |%(3)=3..lDiconfo|
00000570  72 25 28 34 29 3d 64 72  69 76 65 5f 30 25 3a 20  |r%(4)=drive_0%: |
00000580  69 63 6f 6e 66 6f 72 25  28 35 29 3d 64 72 69 76  |iconfor%(5)=driv|
00000590  65 5f 31 25 3a 20 69 63  6f 6e 66 6f 72 25 28 36  |e_1%: iconfor%(6|
000005a0  29 3d 64 72 69 76 65 5f  32 25 0d 02 76 05 3a 0d  |)=drive_2%..v.:.|
000005b0  02 80 2b f4 20 73 74 75  66 66 20 75 73 65 64 20  |..+. stuff used |
000005c0  62 79 20 74 68 65 20 72  65 6d 61 69 6e 73 20 6f  |by the remains o|
000005d0  66 20 53 43 53 49 46 6f  72 6d 0d 02 8a 0c 57 72  |f SCSIForm....Wr|
000005e0  69 74 65 25 3d 32 0d 02  94 15 41 6c 74 44 65 66  |ite%=2....AltDef|
000005f0  65 63 74 42 69 74 25 3d  26 31 30 0d 02 9e 12 44  |ectBit%=&10....D|
00000600  69 73 63 53 74 72 75 63  25 3d 26 31 34 0d 02 a8  |iscStruc%=&14...|
00000610  10 4f 6c 64 4d 61 70 41  64 64 25 3d 30 0d 02 b2  |.OldMapAdd%=0...|
00000620  14 4f 6c 64 4d 61 70 53  69 7a 65 25 3d 26 32 30  |.OldMapSize%=&20|
00000630  30 0d 02 bc 11 44 69 72  53 69 7a 65 25 3d 26 38  |0....DirSize%=&8|
00000640  30 30 0d 02 c6 12 f4 42  6f 6f 74 41 64 64 25 3d  |00.....BootAdd%=|
00000650  26 43 30 30 0d 02 d0 12  42 6f 6f 74 53 69 7a 65  |&C00....BootSize|
00000660  25 3d 26 32 30 30 0d 02  da 28 4d 61 78 44 65 66  |%=&200...(MaxDef|
00000670  65 63 74 73 25 3d 28 42  6f 6f 74 53 69 7a 65 25  |ects%=(BootSize%|
00000680  2d 36 34 2d 26 31 30 2d  34 2d 34 29 81 34 0d 02  |-64-&10-4-4).4..|
00000690  e4 14 45 6e 64 44 65 66  65 63 74 25 3d 31 3c 3c  |..EndDefect%=1<<|
000006a0  32 39 0d 02 ee 15 45 6e  64 44 65 66 65 63 74 32  |29....EndDefect2|
000006b0  25 3d 31 3c 3c 33 30 0d  02 f8 19 42 69 67 53 43  |%=1<<30....BigSC|
000006c0  53 49 46 53 25 3d a4 42  69 67 53 43 53 49 46 53  |SIFS%=.BigSCSIFS|
000006d0  0d 03 02 2d f4 20 4f 6c  64 4c 57 4d 25 20 69 73  |...-. OldLWM% is|
000006e0  20 64 65 70 65 6e 64 61  6e 74 20 6f 6e 20 74 68  | dependant on th|
000006f0  65 20 73 65 63 74 6f 72  20 73 69 7a 65 0d 03 0c  |e sector size...|
00000700  2f f4 20 73 6f 20 69 74  20 69 73 20 6e 6f 77 20  |/. so it is now |
00000710  64 65 63 6c 61 72 65 64  20 69 6e 20 74 68 65 20  |declared in the |
00000720  64 69 73 63 20 70 61 72  74 20 6f 66 0d 03 16 0e  |disc part of....|
00000730  f4 20 74 68 65 20 63 6f  64 65 0d 03 20 0f 46 72  |. the code.. .Fr|
00000740  65 65 4c 69 6e 6b 25 3d  31 0d 03 2a 11 43 72 6f  |eeLink%=1..*.Cro|
00000750  73 73 43 68 65 63 6b 25  3d 33 0d 03 34 11 42 75  |ssCheck%=3..4.Bu|
00000760  66 53 7a 25 3d 26 33 30  30 30 30 0d 03 3e 11 de  |fSz%=&30000..>..|
00000770  20 42 75 66 25 20 42 75  66 53 7a 25 0d 03 48 1b  | Buf% BufSz%..H.|
00000780  de 20 44 69 73 63 52 65  63 25 20 42 6f 6f 74 53  |. DiscRec% BootS|
00000790  69 7a 65 25 2b 36 34 0d  03 52 17 de 20 44 65 66  |ize%+64..R.. Def|
000007a0  65 63 74 25 20 42 6f 6f  74 53 69 7a 65 25 0d 03  |ect% BootSize%..|
000007b0  5c 10 de 20 44 69 72 4d  61 72 6b 25 20 35 0d 03  |\.. DirMark% 5..|
000007c0  66 15 42 6f 6f 74 25 3d  44 69 73 63 52 65 63 25  |f.Boot%=DiscRec%|
000007d0  2b 36 34 0d 03 70 1f 42  6f 6f 74 52 65 63 25 3d  |+64..p.BootRec%=|
000007e0  42 6f 6f 74 25 2b 42 6f  6f 74 53 69 7a 65 25 2d  |Boot%+BootSize%-|
000007f0  36 34 0d 03 7a 14 52 6f  6f 74 44 69 72 41 64 64  |64..z.RootDirAdd|
00000800  25 3d 26 34 30 30 0d 03  84 1e 49 6e 64 52 6f 6f  |%=&400....IndRoo|
00000810  74 44 69 72 41 64 64 25  3d 52 6f 6f 74 44 69 72  |tDirAdd%=RootDir|
00000820  41 64 64 25 0d 03 8e 05  3a 0d 03 98 0d de 20 71  |Add%....:..... q|
00000830  31 25 20 32 35 36 0d 03  a2 0e de 20 71 32 25 20  |1% 256..... q2% |
00000840  32 30 34 38 0d 03 ac 0d  de 20 71 33 25 20 32 35  |2048..... q3% 25|
00000850  36 0d 03 b6 2d 6d 61 78  77 73 25 3d 37 38 30 3a  |6...-maxws%=780:|
00000860  de 20 77 73 25 20 6d 61  78 77 73 25 3a 77 73 65  |. ws% maxws%:wse|
00000870  6e 64 25 3d 77 73 25 2b  6d 61 78 77 73 25 0d 03  |nd%=ws%+maxws%..|
00000880  c0 36 c8 99 22 57 69 6d  70 5f 49 6e 69 74 69 61  |.6.."Wimp_Initia|
00000890  6c 69 73 65 22 2c 32 32  33 2c 26 34 42 35 33 34  |lise",223,&4B534|
000008a0  31 35 34 2c 22 53 43 53  49 20 66 6f 72 6d 61 74  |154,"SCSI format|
000008b0  74 65 72 22 0d 03 ca 31  c8 99 22 57 69 6d 70 5f  |ter"...1.."Wimp_|
000008c0  4f 70 65 6e 54 65 6d 70  6c 61 74 65 22 2c 2c 22  |OpenTemplate",,"|
000008d0  3c 4f 62 65 79 24 44 69  72 3e 2e 54 65 6d 70 6c  |<Obey$Dir>.Templ|
000008e0  61 74 65 73 22 0d 03 d4  3d c8 99 22 57 69 6d 70  |ates"...=.."Wimp|
000008f0  5f 4c 6f 61 64 54 65 6d  70 6c 61 74 65 22 2c 2c  |_LoadTemplate",,|
00000900  71 32 25 2c 77 73 25 2c  77 73 65 6e 64 25 2c 2d  |q2%,ws%,wsend%,-|
00000910  31 2c 22 6d 61 69 6e 22  2c 30 20 b8 20 2c 2c 77  |1,"main",0 . ,,w|
00000920  73 25 0d 03 de 26 c8 99  22 57 69 6d 70 5f 43 72  |s%...&.."Wimp_Cr|
00000930  65 61 74 65 57 69 6e 64  6f 77 22 2c 2c 71 32 25  |eateWindow",,q2%|
00000940  20 b8 20 6d 61 69 6e 25  0d 03 e8 1a c8 99 22 57  | . main%......"W|
00000950  69 6d 70 5f 43 6c 6f 73  65 54 65 6d 70 6c 61 74  |imp_CloseTemplat|
00000960  65 22 0d 03 f2 2c f2 64  69 73 61 62 6c 65 5f 64  |e"...,.disable_d|
00000970  72 69 76 65 5f 69 63 6f  6e 73 3a f2 65 6e 61 62  |rive_icons:.enab|
00000980  6c 65 5f 64 72 69 76 65  5f 69 63 6f 6e 73 0d 03  |le_drive_icons..|
00000990  fc 11 46 61 73 74 46 6f  72 6d 61 74 25 3d a3 0d  |..FastFormat%=..|
000009a0  04 06 11 53 6b 69 70 46  6f 72 6d 61 74 25 3d a3  |...SkipFormat%=.|
000009b0  0d 04 10 0d 4e 65 77 4d  61 70 25 3d b9 0d 04 1a  |....NewMap%=....|
000009c0  0c 44 72 69 76 65 25 3d  30 0d 04 24 29 4c 6f 67  |.Drive%=0..$)Log|
000009d0  32 41 6c 6c 6f 63 25 3d  31 31 3a f2 53 68 61 72  |2Alloc%=11:.Shar|
000009e0  65 53 69 7a 65 73 28 4c  6f 67 32 41 6c 6c 6f 63  |eSizes(Log2Alloc|
000009f0  25 29 0d 04 2e 20 f2 64  65 73 65 6c 65 63 74 5f  |%)... .deselect_|
00000a00  69 63 6f 6e 28 66 61 73  74 5f 66 6f 72 6d 61 74  |icon(fast_format|
00000a10  25 29 0d 04 38 13 f2 73  65 74 5f 64 72 69 76 65  |%)..8..set_drive|
00000a20  5f 69 63 6f 6e 0d 04 42  11 f2 73 65 74 5f 6d 61  |_icon..B..set_ma|
00000a30  70 5f 69 63 6f 6e 0d 04  4c 12 f2 73 65 74 5f 6c  |p_icon..L..set_l|
00000a40  66 61 75 5f 69 63 6f 6e  0d 04 56 2b 21 71 31 25  |fau_icon..V+!q1%|
00000a50  3d 6d 61 69 6e 25 3a c8  99 22 57 69 6d 70 5f 47  |=main%:.."Wimp_G|
00000a60  65 74 57 69 6e 64 6f 77  53 74 61 74 65 22 2c 2c  |etWindowState",,|
00000a70  71 31 25 0d 04 60 1c c8  99 22 57 69 6d 70 5f 4f  |q1%..`..."Wimp_O|
00000a80  70 65 6e 57 69 6e 64 6f  77 22 2c 2c 71 31 25 0d  |penWindow",,q1%.|
00000a90  04 6a 11 65 72 72 6f 72  5f 66 6c 61 67 25 3d 33  |.j.error_flag%=3|
00000aa0  0d 04 74 05 3a 0d 04 7e  05 e1 0d 04 88 05 3a 0d  |..t.:..~......:.|
00000ab0  04 92 0f dd f2 63 6c 6f  73 65 64 6f 77 6e 0d 04  |.....closedown..|
00000ac0  9c 33 e7 73 63 73 69 5f  6f 70 25 3c 3e 30 20 c8  |.3.scsi_op%<>0 .|
00000ad0  99 22 53 43 53 49 5f 43  6f 6e 74 72 6f 6c 22 2c  |."SCSI_Control",|
00000ae0  31 2c 44 72 69 76 65 25  2c 73 63 73 69 5f 6f 70  |1,Drive%,scsi_op|
00000af0  25 0d 04 a6 19 c8 99 22  4f 53 5f 4d 6f 64 75 6c  |%......"OS_Modul|
00000b00  65 22 2c 37 2c 2c 52 4d  41 25 0d 04 b0 16 c8 99  |e",7,,RMA%......|
00000b10  22 57 69 6d 70 5f 43 6c  6f 73 65 44 6f 77 6e 22  |"Wimp_CloseDown"|
00000b20  0d 04 ba 05 e0 0d 04 c4  05 e1 0d 04 ce 05 3a 0d  |..............:.|
00000b30  04 d8 0b dd f2 65 72 72  6f 72 0d 04 e2 14 e7 65  |.....error.....e|
00000b40  72 72 6f 72 5f 66 6c 61  67 25 3d 33 20 8c 0d 04  |rror_flag%=3 ...|
00000b50  ec 38 20 20 f2 65 72 72  6f 72 62 6f 78 28 22 55  |.8  .errorbox("U|
00000b60  6e 65 78 70 65 63 74 65  64 20 65 72 72 6f 72 20  |nexpected error |
00000b70  3a 2d 20 22 2b f6 24 2b  22 20 28 22 2b c3 28 9e  |:- "+.$+" ("+.(.|
00000b80  29 2b 22 29 22 29 0d 04  f6 07 20 20 cc 0d 05 00  |)+")")....  ....|
00000b90  13 20 20 f2 65 72 72 6f  72 62 6f 78 28 f6 24 29  |.  .errorbox(.$)|
00000ba0  0d 05 0a 05 cd 0d 05 14  11 65 72 72 6f 72 5f 66  |.........error_f|
00000bb0  6c 61 67 25 3d 33 0d 05  1e 05 e1 0d 05 28 05 3a  |lag%=3.......(.:|
00000bc0  0d 05 32 0c dd f2 6f 6b  28 65 24 29 0d 05 3c 11  |..2...ok(e$)..<.|
00000bd0  65 72 72 6f 72 5f 66 6c  61 67 25 3d 31 0d 05 46  |error_flag%=1..F|
00000be0  0a 85 20 31 2c 65 24 0d  05 50 05 e1 0d 05 5a 05  |.. 1,e$..P....Z.|
00000bf0  3a 0d 05 64 0f dd f2 66  61 74 61 6c 28 65 24 29  |:..d...fatal(e$)|
00000c00  0d 05 6e 11 65 72 72 6f  72 5f 66 6c 61 67 25 3d  |..n.error_flag%=|
00000c10  32 0d 05 78 0a 85 20 31  2c 65 24 0d 05 82 05 e1  |2..x.. 1,e$.....|
00000c20  0d 05 8c 05 3a 0d 05 96  12 dd f2 65 72 72 6f 72  |....:......error|
00000c30  62 6f 78 28 72 24 29 0d  05 a0 08 ea 20 72 25 0d  |box(r$)..... r%.|
00000c40  05 aa 19 21 71 31 25 3d  9f 3a 24 28 71 31 25 2b  |...!q1%=.:$(q1%+|
00000c50  34 29 3d 72 24 2b bd 30  0d 05 b4 3f c8 99 22 57  |4)=r$+.0...?.."W|
00000c60  69 6d 70 5f 52 65 70 6f  72 74 45 72 72 6f 72 22  |imp_ReportError"|
00000c70  2c 71 31 25 2c 65 72 72  6f 72 5f 66 6c 61 67 25  |,q1%,error_flag%|
00000c80  2c 22 53 43 53 49 20 66  6f 72 6d 61 74 74 65 72  |,"SCSI formatter|
00000c90  22 20 b8 20 2c 72 25 0d  05 be 14 e7 72 25 3d 32  |" . ,r%.....r%=2|
00000ca0  20 f2 63 6c 6f 73 65 64  6f 77 6e 0d 05 c8 1a e7  | .closedown.....|
00000cb0  73 74 61 72 74 65 64 5f  66 6f 72 6d 61 74 74 69  |started_formatti|
00000cc0  6e 67 25 20 8c 0d 05 d2  19 20 f2 65 6e 61 62 6c  |ng% ..... .enabl|
00000cd0  65 5f 75 73 65 72 5f 6f  70 74 69 6f 6e 73 0d 05  |e_user_options..|
00000ce0  dc 18 20 f2 65 6e 61 62  6c 65 5f 64 72 69 76 65  |.. .enable_drive|
00000cf0  5f 69 63 6f 6e 73 0d 05  e6 1a 20 73 74 61 72 74  |_icons.... start|
00000d00  65 64 5f 66 6f 72 6d 61  74 74 69 6e 67 25 3d a3  |ed_formatting%=.|
00000d10  0d 05 f0 2d 20 c8 99 22  58 4f 53 5f 43 4c 49 22  |...- .."XOS_CLI"|
00000d20  2c 22 53 43 53 49 3a 44  69 73 6d 6f 75 6e 74 20  |,"SCSI:Dismount |
00000d30  22 2b c3 28 44 72 69 76  65 25 2b 34 29 0d 05 fa  |"+.(Drive%+4)...|
00000d40  2a 20 f2 77 72 69 74 65  5f 69 63 6f 6e 28 73 74  |* .write_icon(st|
00000d50  61 74 75 73 25 2c 22 46  6f 72 6d 61 74 20 61 62  |atus%,"Format ab|
00000d60  6f 72 74 65 64 22 29 0d  06 04 05 cd 0d 06 0e 05  |orted").........|
00000d70  e1 0d 06 18 05 3a 0d 06  22 0d dd f2 72 65 63 65  |.....:.."...rece|
00000d80  69 76 65 0d 06 2c 0f c8  8e 20 71 31 25 21 31 36  |ive..,... q1%!16|
00000d90  20 ca 0d 06 36 12 c9 30  3a 20 f2 63 6c 6f 73 65  | ...6..0: .close|
00000da0  64 6f 77 6e 0d 06 40 05  cb 0d 06 4a 05 e1 0d 06  |down..@....J....|
00000db0  54 05 3a 0d 06 5e 10 dd  f2 6d 6f 75 73 65 63 6c  |T.:..^...mousecl|
00000dc0  69 63 6b 0d 06 68 10 e7  71 31 25 21 38 20 80 20  |ick..h..q1%!8 . |
00000dd0  35 20 8c 0d 06 72 14 20  e7 71 31 25 21 31 32 3d  |5 ...r. .q1%!12=|
00000de0  6d 61 69 6e 25 20 8c 0d  06 7c 11 20 20 c8 8e 20  |main% ...|.  .. |
00000df0  71 31 25 21 31 36 20 ca  0d 06 86 2d 20 20 c9 20  |q1%!16 ....-  . |
00000e00  30 20 20 20 20 20 20 20  20 20 20 3a 20 44 72 69  |0          : Dri|
00000e10  76 65 25 3d 30 3a f2 73  65 74 5f 64 72 69 76 65  |ve%=0:.set_drive|
00000e20  5f 69 63 6f 6e 0d 06 90  2d 20 20 c9 20 31 20 20  |_icon...-  . 1  |
00000e30  20 20 20 20 20 20 20 20  3a 20 44 72 69 76 65 25  |        : Drive%|
00000e40  3d 31 3a f2 73 65 74 5f  64 72 69 76 65 5f 69 63  |=1:.set_drive_ic|
00000e50  6f 6e 0d 06 9a 2d 20 20  c9 20 32 20 20 20 20 20  |on...-  . 2     |
00000e60  20 20 20 20 20 3a 20 44  72 69 76 65 25 3d 32 3a  |     : Drive%=2:|
00000e70  f2 73 65 74 5f 64 72 69  76 65 5f 69 63 6f 6e 0d  |.set_drive_icon.|
00000e80  06 a4 2d 20 20 c9 20 33  20 20 20 20 20 20 20 20  |..-  . 3        |
00000e90  20 20 3a 20 44 72 69 76  65 25 3d 33 3a f2 73 65  |  : Drive%=3:.se|
00000ea0  74 5f 64 72 69 76 65 5f  69 63 6f 6e 0d 06 ae 2d  |t_drive_icon...-|
00000eb0  20 20 c9 20 64 72 69 76  65 5f 30 25 20 20 20 3a  |  . drive_0%   :|
00000ec0  20 44 72 69 76 65 25 3d  34 3a f2 73 65 74 5f 64  | Drive%=4:.set_d|
00000ed0  72 69 76 65 5f 69 63 6f  6e 0d 06 b8 2d 20 20 c9  |rive_icon...-  .|
00000ee0  20 64 72 69 76 65 5f 31  25 20 20 20 3a 20 44 72  | drive_1%   : Dr|
00000ef0  69 76 65 25 3d 35 3a f2  73 65 74 5f 64 72 69 76  |ive%=5:.set_driv|
00000f00  65 5f 69 63 6f 6e 0d 06  c2 2d 20 20 c9 20 64 72  |e_icon...-  . dr|
00000f10  69 76 65 5f 32 25 20 20  20 3a 20 44 72 69 76 65  |ive_2%   : Drive|
00000f20  25 3d 36 3a f2 73 65 74  5f 64 72 69 76 65 5f 69  |%=6:.set_drive_i|
00000f30  63 6f 6e 0d 06 cc 2d 20  20 c9 66 61 73 74 5f 66  |con...-  .fast_f|
00000f40  6f 72 6d 61 74 25 3a 20  46 61 73 74 46 6f 72 6d  |ormat%: FastForm|
00000f50  61 74 25 3d ac 46 61 73  74 46 6f 72 6d 61 74 25  |at%=.FastFormat%|
00000f60  0d 06 d6 2d 20 20 c9 73  6b 69 70 5f 66 6f 72 6d  |...-  .skip_form|
00000f70  61 74 25 3a 20 53 6b 69  70 46 6f 72 6d 61 74 25  |at%: SkipFormat%|
00000f80  3d ac 53 6b 69 70 46 6f  72 6d 61 74 25 0d 06 e0  |=.SkipFormat%...|
00000f90  2c 20 20 c9 6e 65 77 5f  6d 61 70 25 20 20 20 20  |,  .new_map%    |
00000fa0  3a 20 4e 65 77 4d 61 70  25 3d b9 3a f2 73 65 74  |: NewMap%=.:.set|
00000fb0  5f 6d 61 70 5f 69 63 6f  6e 0d 06 ea 2c 20 20 c9  |_map_icon...,  .|
00000fc0  6f 6c 64 5f 6d 61 70 25  20 20 20 20 3a 20 4e 65  |old_map%    : Ne|
00000fd0  77 4d 61 70 25 3d a3 3a  f2 73 65 74 5f 6d 61 70  |wMap%=.:.set_map|
00000fe0  5f 69 63 6f 6e 0d 06 f4  48 20 20 c9 6c 66 61 75  |_icon...H  .lfau|
00000ff0  5f 35 31 32 25 20 20 20  3a 20 4c 6f 67 32 41 6c  |_512%   : Log2Al|
00001000  6c 6f 63 25 3d 39 3a f2  53 68 61 72 65 53 69 7a  |loc%=9:.ShareSiz|
00001010  65 73 28 4c 6f 67 32 41  6c 6c 6f 63 25 29 3a f2  |es(Log2Alloc%):.|
00001020  73 65 74 5f 6c 66 61 75  5f 69 63 6f 6e 0d 06 fe  |set_lfau_icon...|
00001030  49 20 20 c9 6c 66 61 75  5f 31 30 32 34 25 20 20  |I  .lfau_1024%  |
00001040  3a 20 4c 6f 67 32 41 6c  6c 6f 63 25 3d 31 30 3a  |: Log2Alloc%=10:|
00001050  f2 53 68 61 72 65 53 69  7a 65 73 28 4c 6f 67 32  |.ShareSizes(Log2|
00001060  41 6c 6c 6f 63 25 29 3a  f2 73 65 74 5f 6c 66 61  |Alloc%):.set_lfa|
00001070  75 5f 69 63 6f 6e 0d 07  08 49 20 20 c9 6c 66 61  |u_icon...I  .lfa|
00001080  75 5f 32 30 34 38 25 20  20 3a 20 4c 6f 67 32 41  |u_2048%  : Log2A|
00001090  6c 6c 6f 63 25 3d 31 31  3a f2 53 68 61 72 65 53  |lloc%=11:.ShareS|
000010a0  69 7a 65 73 28 4c 6f 67  32 41 6c 6c 6f 63 25 29  |izes(Log2Alloc%)|
000010b0  3a f2 73 65 74 5f 6c 66  61 75 5f 69 63 6f 6e 0d  |:.set_lfau_icon.|
000010c0  07 12 49 20 20 c9 6c 66  61 75 5f 34 30 39 36 25  |..I  .lfau_4096%|
000010d0  20 20 3a 20 4c 6f 67 32  41 6c 6c 6f 63 25 3d 31  |  : Log2Alloc%=1|
000010e0  32 3a f2 53 68 61 72 65  53 69 7a 65 73 28 4c 6f  |2:.ShareSizes(Lo|
000010f0  67 32 41 6c 6c 6f 63 25  29 3a f2 73 65 74 5f 6c  |g2Alloc%):.set_l|
00001100  66 61 75 5f 69 63 6f 6e  0d 07 1c 22 20 20 c9 64  |fau_icon..."  .d|
00001110  6f 5f 66 6f 72 6d 61 74  25 20 20 3a 20 f2 66 6f  |o_format%  : .fo|
00001120  72 6d 61 74 5f 64 72 69  76 65 0d 07 26 07 20 20  |rmat_drive..&.  |
00001130  cb 0d 07 30 06 20 cd 0d  07 3a 05 cd 0d 07 44 05  |...0. ...:....D.|
00001140  e1 0d 07 4e 05 3a 0d 07  58 12 dd f2 73 65 74 5f  |...N.:..X...set_|
00001150  6d 61 70 5f 69 63 6f 6e  0d 07 62 57 e7 4e 65 77  |map_icon..bW.New|
00001160  4d 61 70 25 20 f2 73 65  6c 65 63 74 5f 69 63 6f  |Map% .select_ico|
00001170  6e 28 6e 65 77 5f 6d 61  70 25 29 3a f2 65 6e 61  |n(new_map%):.ena|
00001180  62 6c 65 5f 6c 66 61 75  20 8b 20 f2 73 65 6c 65  |ble_lfau . .sele|
00001190  63 74 5f 69 63 6f 6e 28  6f 6c 64 5f 6d 61 70 25  |ct_icon(old_map%|
000011a0  29 3a f2 64 69 73 61 62  6c 65 5f 6c 66 61 75 0d  |):.disable_lfau.|
000011b0  07 6c 05 e1 0d 07 76 05  3a 0d 07 80 13 dd f2 73  |.l....v.:......s|
000011c0  65 74 5f 6c 66 61 75 5f  69 63 6f 6e 0d 07 8a 13  |et_lfau_icon....|
000011d0  c8 8e 20 4c 6f 67 32 41  6c 6c 6f 63 25 20 ca 0d  |.. Log2Alloc% ..|
000011e0  07 94 21 c9 20 20 39 3a  20 f2 73 65 6c 65 63 74  |..!.  9: .select|
000011f0  5f 69 63 6f 6e 28 6c 66  61 75 5f 35 31 32 25 29  |_icon(lfau_512%)|
00001200  0d 07 9e 22 c9 20 31 30  3a 20 f2 73 65 6c 65 63  |...". 10: .selec|
00001210  74 5f 69 63 6f 6e 28 6c  66 61 75 5f 31 30 32 34  |t_icon(lfau_1024|
00001220  25 29 0d 07 a8 22 c9 20  31 31 3a 20 f2 73 65 6c  |%)...". 11: .sel|
00001230  65 63 74 5f 69 63 6f 6e  28 6c 66 61 75 5f 32 30  |ect_icon(lfau_20|
00001240  34 38 25 29 0d 07 b2 22  c9 20 31 32 3a 20 f2 73  |48%)...". 12: .s|
00001250  65 6c 65 63 74 5f 69 63  6f 6e 28 6c 66 61 75 5f  |elect_icon(lfau_|
00001260  34 30 39 36 25 29 0d 07  bc 05 cb 0d 07 c6 05 e1  |4096%)..........|
00001270  0d 07 d0 05 3a 0d 07 da  14 dd f2 73 65 74 5f 64  |....:......set_d|
00001280  72 69 76 65 5f 69 63 6f  6e 0d 07 e4 0c ea 20 66  |rive_icon..... f|
00001290  25 2c 72 30 25 0d 07 ee  11 f2 64 65 76 69 63 65  |%,r0%.....device|
000012a0  5f 63 6c 61 69 6d 0d 07  f8 22 f2 73 65 6c 65 63  |_claim...".selec|
000012b0  74 5f 69 63 6f 6e 28 69  63 6f 6e 66 6f 72 25 28  |t_icon(iconfor%(|
000012c0  44 72 69 76 65 25 29 29  0d 08 02 1b f2 77 72 69  |Drive%)).....wri|
000012d0  74 65 5f 69 63 6f 6e 28  73 74 61 74 75 73 25 2c  |te_icon(status%,|
000012e0  22 22 29 0d 08 0c 2e c8  99 22 58 53 43 53 49 5f  |"")......"XSCSI_|
000012f0  49 6e 69 74 69 61 6c 69  73 65 22 2c 32 2c 44 72  |Initialise",2,Dr|
00001300  69 76 65 25 2c 71 31 25  20 b8 20 72 30 25 3b 66  |ive%,q1% . r0%;f|
00001310  25 0d 08 16 0d e7 66 25  20 80 20 31 20 8c 0d 08  |%.....f% . 1 ...|
00001320  20 17 20 f2 73 74 61 74  75 73 5f 65 72 72 6f 72  | . .status_error|
00001330  28 72 30 25 29 0d 08 2a  14 20 e7 21 72 30 25 3c  |(r0%)..*. .!r0%<|
00001340  3e 26 32 30 31 43 33 20  8c 0d 08 34 2c 20 20 f2  |>&201C3 ...4,  .|
00001350  77 72 69 74 65 5f 69 63  6f 6e 28 64 65 76 69 63  |write_icon(devic|
00001360  65 5f 74 79 70 65 25 2c  a4 64 65 76 69 63 65 5f  |e_type%,.device_|
00001370  74 79 70 65 29 0d 08 3e  2d 20 20 f2 77 72 69 74  |type)..>-  .writ|
00001380  65 5f 69 63 6f 6e 28 64  65 76 69 63 65 5f 6e 61  |e_icon(device_na|
00001390  6d 65 25 2c a4 64 65 76  69 63 65 5f 69 64 65 6e  |me%,.device_iden|
000013a0  74 29 0d 08 48 26 20 20  f2 64 65 73 65 6c 65 63  |t)..H&  .deselec|
000013b0  74 5f 69 63 6f 6e 28 77  72 69 74 65 5f 70 72 6f  |t_icon(write_pro|
000013c0  74 65 63 74 65 64 25 29  0d 08 52 26 20 20 f2 64  |tected%)..R&  .d|
000013d0  65 73 65 6c 65 63 74 5f  69 63 6f 6e 28 73 65 63  |eselect_icon(sec|
000013e0  74 6f 72 5f 73 69 7a 65  5f 32 35 36 25 29 0d 08  |tor_size_256%)..|
000013f0  5c 26 20 20 f2 64 65 73  65 6c 65 63 74 5f 69 63  |\&  .deselect_ic|
00001400  6f 6e 28 73 65 63 74 6f  72 5f 73 69 7a 65 5f 35  |on(sector_size_5|
00001410  31 32 25 29 0d 08 66 27  20 20 f2 64 65 73 65 6c  |12%)..f'  .desel|
00001420  65 63 74 5f 69 63 6f 6e  28 73 65 63 74 6f 72 5f  |ect_icon(sector_|
00001430  73 69 7a 65 5f 31 30 32  34 25 29 0d 08 70 25 20  |size_1024%)..p% |
00001440  20 f2 64 69 73 61 62 6c  65 5f 69 63 6f 6e 28 77  | .disable_icon(w|
00001450  72 69 74 65 5f 70 72 6f  74 65 63 74 65 64 25 29  |rite_protected%)|
00001460  0d 08 7a 25 20 20 f2 64  69 73 61 62 6c 65 5f 69  |..z%  .disable_i|
00001470  63 6f 6e 28 73 65 63 74  6f 72 5f 73 69 7a 65 5f  |con(sector_size_|
00001480  32 35 36 25 29 0d 08 84  25 20 20 f2 64 69 73 61  |256%)...%  .disa|
00001490  62 6c 65 5f 69 63 6f 6e  28 73 65 63 74 6f 72 5f  |ble_icon(sector_|
000014a0  73 69 7a 65 5f 35 31 32  25 29 0d 08 8e 26 20 20  |size_512%)...&  |
000014b0  f2 64 69 73 61 62 6c 65  5f 69 63 6f 6e 28 73 65  |.disable_icon(se|
000014c0  63 74 6f 72 5f 73 69 7a  65 5f 31 30 32 34 25 29  |ctor_size_1024%)|
000014d0  0d 08 98 1d 20 20 f2 64  69 73 61 62 6c 65 5f 69  |....  .disable_i|
000014e0  63 6f 6e 28 6f 6c 64 5f  6d 61 70 25 29 0d 08 a2  |con(old_map%)...|
000014f0  1d 20 20 f2 64 69 73 61  62 6c 65 5f 69 63 6f 6e  |.  .disable_icon|
00001500  28 6e 65 77 5f 6d 61 70  25 29 0d 08 ac 21 20 20  |(new_map%)...!  |
00001510  f2 64 69 73 61 62 6c 65  5f 69 63 6f 6e 28 66 61  |.disable_icon(fa|
00001520  73 74 5f 66 6f 72 6d 61  74 25 29 0d 08 b6 21 20  |st_format%)...! |
00001530  20 f2 64 69 73 61 62 6c  65 5f 69 63 6f 6e 28 73  | .disable_icon(s|
00001540  6b 69 70 5f 66 6f 72 6d  61 74 25 29 0d 08 c0 1e  |kip_format%)....|
00001550  20 20 f2 64 69 73 61 62  6c 65 5f 69 63 6f 6e 28  |  .disable_icon(|
00001560  6c 66 61 75 5f 35 31 32  25 29 0d 08 ca 1f 20 20  |lfau_512%)....  |
00001570  f2 64 69 73 61 62 6c 65  5f 69 63 6f 6e 28 6c 66  |.disable_icon(lf|
00001580  61 75 5f 31 30 32 34 25  29 0d 08 d4 1f 20 20 f2  |au_1024%)....  .|
00001590  64 69 73 61 62 6c 65 5f  69 63 6f 6e 28 6c 66 61  |disable_icon(lfa|
000015a0  75 5f 32 30 34 38 25 29  0d 08 de 1f 20 20 f2 64  |u_2048%)....  .d|
000015b0  69 73 61 62 6c 65 5f 69  63 6f 6e 28 6c 66 61 75  |isable_icon(lfau|
000015c0  5f 34 30 39 36 25 29 0d  08 e8 1f 20 20 f2 64 69  |_4096%)....  .di|
000015d0  73 61 62 6c 65 5f 69 63  6f 6e 28 64 6f 5f 66 6f  |sable_icon(do_fo|
000015e0  72 6d 61 74 25 29 0d 08  f2 07 20 20 e1 0d 08 fc  |rmat%)....  ....|
000015f0  06 20 cd 0d 09 06 05 cd  0d 09 10 2a f2 77 72 69  |. .........*.wri|
00001600  74 65 5f 69 63 6f 6e 28  64 65 76 69 63 65 5f 74  |te_icon(device_t|
00001610  79 70 65 25 2c a4 64 65  76 69 63 65 5f 74 79 70  |ype%,.device_typ|
00001620  65 29 0d 09 1a 22 f2 65  6e 61 62 6c 65 5f 69 63  |e)...".enable_ic|
00001630  6f 6e 28 77 72 69 74 65  5f 70 72 6f 74 65 63 74  |on(write_protect|
00001640  65 64 25 29 0d 09 24 22  f2 65 6e 61 62 6c 65 5f  |ed%)..$".enable_|
00001650  69 63 6f 6e 28 73 65 63  74 6f 72 5f 73 69 7a 65  |icon(sector_size|
00001660  5f 32 35 36 25 29 0d 09  2e 22 f2 65 6e 61 62 6c  |_256%)...".enabl|
00001670  65 5f 69 63 6f 6e 28 73  65 63 74 6f 72 5f 73 69  |e_icon(sector_si|
00001680  7a 65 5f 35 31 32 25 29  0d 09 38 23 f2 65 6e 61  |ze_512%)..8#.ena|
00001690  62 6c 65 5f 69 63 6f 6e  28 73 65 63 74 6f 72 5f  |ble_icon(sector_|
000016a0  73 69 7a 65 5f 31 30 32  34 25 29 0d 09 42 18 c8  |size_1024%)..B..|
000016b0  8e 20 a4 64 65 76 69 63  65 5f 64 65 6e 73 69 74  |. .device_densit|
000016c0  79 20 ca 0d 09 4c 2b 20  20 c9 20 32 35 36 3a 20  |y ...L+  . 256: |
000016d0  f2 73 65 6c 65 63 74 5f  69 63 6f 6e 28 73 65 63  |.select_icon(sec|
000016e0  74 6f 72 5f 73 69 7a 65  5f 32 35 36 25 29 0d 09  |tor_size_256%)..|
000016f0  56 2b 20 20 c9 20 35 31  32 3a 20 f2 73 65 6c 65  |V+  . 512: .sele|
00001700  63 74 5f 69 63 6f 6e 28  73 65 63 74 6f 72 5f 73  |ct_icon(sector_s|
00001710  69 7a 65 5f 35 31 32 25  29 0d 09 60 2c 20 20 c9  |ize_512%)..`,  .|
00001720  20 31 30 32 34 3a f2 73  65 6c 65 63 74 5f 69 63  | 1024:.select_ic|
00001730  6f 6e 28 73 65 63 74 6f  72 5f 73 69 7a 65 5f 31  |on(sector_size_1|
00001740  30 32 34 25 29 0d 09 6a  05 cb 0d 09 74 1e e7 a4  |024%)..j....t...|
00001750  64 65 76 69 63 65 5f 77  72 69 74 65 5f 70 72 6f  |device_write_pro|
00001760  74 65 63 74 65 64 20 8c  0d 09 7e 1a 20 f2 64 69  |tected ...~. .di|
00001770  73 61 62 6c 65 5f 75 73  65 72 5f 6f 70 74 69 6f  |sable_user_optio|
00001780  6e 73 0d 09 88 23 20 f2  73 65 6c 65 63 74 5f 69  |ns...# .select_i|
00001790  63 6f 6e 28 77 72 69 74  65 5f 70 72 6f 74 65 63  |con(write_protec|
000017a0  74 65 64 25 29 0d 09 92  05 cc 0d 09 9c 19 20 f2  |ted%)......... .|
000017b0  65 6e 61 62 6c 65 5f 75  73 65 72 5f 6f 70 74 69  |enable_user_opti|
000017c0  6f 6e 73 0d 09 a6 25 20  f2 64 65 73 65 6c 65 63  |ons...% .deselec|
000017d0  74 5f 69 63 6f 6e 28 77  72 69 74 65 5f 70 72 6f  |t_icon(write_pro|
000017e0  74 65 63 74 65 64 25 29  0d 09 b0 4b 20 e7 53 6b  |tected%)...K .Sk|
000017f0  69 70 46 6f 72 6d 61 74  25 20 f2 73 65 6c 65 63  |ipFormat% .selec|
00001800  74 5f 69 63 6f 6e 28 73  6b 69 70 5f 66 6f 72 6d  |t_icon(skip_form|
00001810  61 74 25 29 20 8b 20 f2  64 65 73 65 6c 65 63 74  |at%) . .deselect|
00001820  5f 69 63 6f 6e 28 73 6b  69 70 5f 66 6f 72 6d 61  |_icon(skip_forma|
00001830  74 25 29 0d 09 ba 44 20  e7 a4 64 65 76 69 63 65  |t%)...D ..device|
00001840  5f 69 64 65 6e 74 3c 3e  22 4d 61 78 4f 70 74 69  |_ident<>"MaxOpti|
00001850  78 20 54 61 68 69 74 69  20 31 22 20 f2 64 69 73  |x Tahiti 1" .dis|
00001860  61 62 6c 65 5f 69 63 6f  6e 28 66 61 73 74 5f 66  |able_icon(fast_f|
00001870  6f 72 6d 61 74 25 29 0d  09 c4 05 cd 0d 09 ce 2b  |ormat%)........+|
00001880  f2 77 72 69 74 65 5f 69  63 6f 6e 28 64 65 76 69  |.write_icon(devi|
00001890  63 65 5f 6e 61 6d 65 25  2c a4 64 65 76 69 63 65  |ce_name%,.device|
000018a0  5f 69 64 65 6e 74 29 0d  09 d8 05 e1 0d 09 e2 05  |_ident).........|
000018b0  3a 0d 09 ec 1a dd f2 64  69 73 61 62 6c 65 5f 75  |:......disable_u|
000018c0  73 65 72 5f 6f 70 74 69  6f 6e 73 0d 09 f6 1b f2  |ser_options.....|
000018d0  64 69 73 61 62 6c 65 5f  69 63 6f 6e 28 6f 6c 64  |disable_icon(old|
000018e0  5f 6d 61 70 25 29 0d 0a  00 1b f2 64 69 73 61 62  |_map%).....disab|
000018f0  6c 65 5f 69 63 6f 6e 28  6e 65 77 5f 6d 61 70 25  |le_icon(new_map%|
00001900  29 0d 0a 0a 1f f2 64 69  73 61 62 6c 65 5f 69 63  |).....disable_ic|
00001910  6f 6e 28 66 61 73 74 5f  66 6f 72 6d 61 74 25 29  |on(fast_format%)|
00001920  0d 0a 14 1f f2 64 69 73  61 62 6c 65 5f 69 63 6f  |.....disable_ico|
00001930  6e 28 73 6b 69 70 5f 66  6f 72 6d 61 74 25 29 0d  |n(skip_format%).|
00001940  0a 1e 1c f2 64 69 73 61  62 6c 65 5f 69 63 6f 6e  |....disable_icon|
00001950  28 6c 66 61 75 5f 35 31  32 25 29 0d 0a 28 1d f2  |(lfau_512%)..(..|
00001960  64 69 73 61 62 6c 65 5f  69 63 6f 6e 28 6c 66 61  |disable_icon(lfa|
00001970  75 5f 31 30 32 34 25 29  0d 0a 32 1d f2 64 69 73  |u_1024%)..2..dis|
00001980  61 62 6c 65 5f 69 63 6f  6e 28 6c 66 61 75 5f 32  |able_icon(lfau_2|
00001990  30 34 38 25 29 0d 0a 3c  1d f2 64 69 73 61 62 6c  |048%)..<..disabl|
000019a0  65 5f 69 63 6f 6e 28 6c  66 61 75 5f 34 30 39 36  |e_icon(lfau_4096|
000019b0  25 29 0d 0a 46 1d f2 64  69 73 61 62 6c 65 5f 69  |%)..F..disable_i|
000019c0  63 6f 6e 28 64 6f 5f 66  6f 72 6d 61 74 25 29 0d  |con(do_format%).|
000019d0  0a 50 05 e1 0d 0a 5a 05  3a 0d 0a 64 19 dd f2 65  |.P....Z.:..d...e|
000019e0  6e 61 62 6c 65 5f 75 73  65 72 5f 6f 70 74 69 6f  |nable_user_optio|
000019f0  6e 73 0d 0a 6e 1a f2 65  6e 61 62 6c 65 5f 69 63  |ns..n..enable_ic|
00001a00  6f 6e 28 6f 6c 64 5f 6d  61 70 25 29 0d 0a 78 1a  |on(old_map%)..x.|
00001a10  f2 65 6e 61 62 6c 65 5f  69 63 6f 6e 28 6e 65 77  |.enable_icon(new|
00001a20  5f 6d 61 70 25 29 0d 0a  82 1e f2 65 6e 61 62 6c  |_map%).....enabl|
00001a30  65 5f 69 63 6f 6e 28 66  61 73 74 5f 66 6f 72 6d  |e_icon(fast_form|
00001a40  61 74 25 29 0d 0a 8c 1e  f2 65 6e 61 62 6c 65 5f  |at%).....enable_|
00001a50  69 63 6f 6e 28 73 6b 69  70 5f 66 6f 72 6d 61 74  |icon(skip_format|
00001a60  25 29 0d 0a 96 29 e7 4e  65 77 4d 61 70 25 20 f2  |%)...).NewMap% .|
00001a70  65 6e 61 62 6c 65 5f 6c  66 61 75 20 8b 20 f2 64  |enable_lfau . .d|
00001a80  69 73 61 62 6c 65 5f 6c  66 61 75 0d 0a a0 1c f2  |isable_lfau.....|
00001a90  65 6e 61 62 6c 65 5f 69  63 6f 6e 28 64 6f 5f 66  |enable_icon(do_f|
00001aa0  6f 72 6d 61 74 25 29 0d  0a aa 05 e1 0d 0a b4 05  |ormat%).........|
00001ab0  3a 0d 0a be 12 dd f2 64  69 73 61 62 6c 65 5f 6c  |:......disable_l|
00001ac0  66 61 75 0d 0a c8 1c f2  64 69 73 61 62 6c 65 5f  |fau.....disable_|
00001ad0  69 63 6f 6e 28 6c 66 61  75 5f 35 31 32 25 29 0d  |icon(lfau_512%).|
00001ae0  0a d2 1d f2 64 69 73 61  62 6c 65 5f 69 63 6f 6e  |....disable_icon|
00001af0  28 6c 66 61 75 5f 31 30  32 34 25 29 0d 0a dc 1d  |(lfau_1024%)....|
00001b00  f2 64 69 73 61 62 6c 65  5f 69 63 6f 6e 28 6c 66  |.disable_icon(lf|
00001b10  61 75 5f 32 30 34 38 25  29 0d 0a e6 1d f2 64 69  |au_2048%).....di|
00001b20  73 61 62 6c 65 5f 69 63  6f 6e 28 6c 66 61 75 5f  |sable_icon(lfau_|
00001b30  34 30 39 36 25 29 0d 0a  f0 05 e1 0d 0a fa 05 3a  |4096%).........:|
00001b40  0d 0b 04 11 dd f2 65 6e  61 62 6c 65 5f 6c 66 61  |......enable_lfa|
00001b50  75 0d 0b 0e 1b f2 65 6e  61 62 6c 65 5f 69 63 6f  |u.....enable_ico|
00001b60  6e 28 6c 66 61 75 5f 35  31 32 25 29 0d 0b 18 1c  |n(lfau_512%)....|
00001b70  f2 65 6e 61 62 6c 65 5f  69 63 6f 6e 28 6c 66 61  |.enable_icon(lfa|
00001b80  75 5f 31 30 32 34 25 29  0d 0b 22 1c f2 65 6e 61  |u_1024%).."..ena|
00001b90  62 6c 65 5f 69 63 6f 6e  28 6c 66 61 75 5f 32 30  |ble_icon(lfau_20|
00001ba0  34 38 25 29 0d 0b 2c 1c  f2 65 6e 61 62 6c 65 5f  |48%)..,..enable_|
00001bb0  69 63 6f 6e 28 6c 66 61  75 5f 34 30 39 36 25 29  |icon(lfau_4096%)|
00001bc0  0d 0b 36 05 e1 0d 0b 40  05 3a 0d 0b 4a 19 dd f2  |..6....@.:..J...|
00001bd0  64 69 73 61 62 6c 65 5f  64 72 69 76 65 5f 69 63  |disable_drive_ic|
00001be0  6f 6e 73 0d 0b 54 08 ea  20 69 25 0d 0b 5e 0d e3  |ons..T.. i%..^..|
00001bf0  69 25 3d 30 20 b8 20 36  0d 0b 68 20 20 f2 64 69  |i%=0 . 6..h  .di|
00001c00  73 61 62 6c 65 5f 69 63  6f 6e 28 69 63 6f 6e 66  |sable_icon(iconf|
00001c10  6f 72 25 28 69 25 29 29  0d 0b 72 05 ed 0d 0b 7c  |or%(i%))..r....||
00001c20  05 e1 0d 0b 86 05 3a 0d  0b 90 18 dd f2 65 6e 61  |......:......ena|
00001c30  62 6c 65 5f 64 72 69 76  65 5f 69 63 6f 6e 73 0d  |ble_drive_icons.|
00001c40  0b 9a 0e ea 20 69 25 2c  66 25 2c 68 25 0d 0b a4  |.... i%,f%,h%...|
00001c50  1e c8 99 22 53 43 53 49  46 53 5f 44 72 69 76 65  |..."SCSIFS_Drive|
00001c60  73 22 20 b8 20 2c 66 25  2c 68 25 0d 0b ae 0c e7  |s" . ,f%,h%.....|
00001c70  66 25 3c 3e 30 20 8c 0d  0b b8 11 20 e3 69 25 3d  |f%<>0 ..... .i%=|
00001c80  30 20 b8 20 66 25 2d 31  0d 0b c2 22 20 20 f2 65  |0 . f%-1..."  .e|
00001c90  6e 61 62 6c 65 5f 69 63  6f 6e 28 69 63 6f 6e 66  |nable_icon(iconf|
00001ca0  6f 72 25 28 69 25 2b 34  29 29 0d 0b cc 06 20 ed  |or%(i%+4)).... .|
00001cb0  0d 0b d6 05 cd 0d 0b e0  0c e7 68 25 3c 3e 30 20  |..........h%<>0 |
00001cc0  8c 0d 0b ea 11 20 e3 69  25 3d 30 20 b8 20 68 25  |..... .i%=0 . h%|
00001cd0  2d 31 0d 0b f4 20 20 20  f2 65 6e 61 62 6c 65 5f  |-1...   .enable_|
00001ce0  69 63 6f 6e 28 69 63 6f  6e 66 6f 72 25 28 69 25  |icon(iconfor%(i%|
00001cf0  29 29 0d 0b fe 06 20 ed  0d 0c 08 05 cd 0d 0c 12  |)).... .........|
00001d00  05 e1 0d 0c 1c 05 3a 0d  0c 26 11 dd a4 64 65 76  |......:..&...dev|
00001d10  69 63 65 5f 74 79 70 65  0d 0c 30 0c 3f 71 32 25  |ice_type..0.?q2%|
00001d20  3d 26 31 32 0d 0c 3a 0b  71 32 25 3f 31 3d 30 0d  |=&12..:.q2%?1=0.|
00001d30  0c 44 0b 71 32 25 3f 32  3d 30 0d 0c 4e 0b 71 32  |.D.q2%?2=0..N.q2|
00001d40  25 3f 33 3d 30 0d 0c 58  0d 71 32 25 3f 34 3d 31  |%?3=0..X.q2%?4=1|
00001d50  32 37 0d 0c 62 0b 71 32  25 3f 35 3d 30 0d 0c 6c  |27..b.q2%?5=0..l|
00001d60  2a c8 99 22 53 43 53 49  5f 4f 70 22 2c 31 3c 3c  |*.."SCSI_Op",1<<|
00001d70  32 34 2b 44 72 69 76 65  25 2c 36 2c 71 32 25 2c  |24+Drive%,6,q2%,|
00001d80  71 31 25 2c 31 32 37 0d  0c 76 0d c8 8e 20 3f 71  |q1%,127..v... ?q|
00001d90  31 25 20 ca 0d 0c 80 19  c9 20 30 3a 20 3d 22 44  |1% ...... 0: ="D|
00001da0  69 72 65 63 74 20 61 63  63 65 73 73 22 0d 0c 8a  |irect access"...|
00001db0  1d c9 20 31 3a 20 3d 22  53 65 71 75 65 6e 74 69  |.. 1: ="Sequenti|
00001dc0  61 6c 20 61 63 63 65 73  73 22 0d 0c 94 1a c9 20  |al access"..... |
00001dd0  32 3a 20 3d 22 50 72 69  6e 74 65 72 20 64 65 76  |2: ="Printer dev|
00001de0  69 63 65 22 0d 0c 9e 1c  c9 20 33 3a 20 3d 22 50  |ice"..... 3: ="P|
00001df0  72 6f 63 65 73 73 6f 72  20 64 65 76 69 63 65 22  |rocessor device"|
00001e00  0d 0c a8 16 c9 20 34 3a  20 3d 22 57 4f 52 4d 20  |..... 4: ="WORM |
00001e10  64 72 69 76 65 22 0d 0c  b2 15 c9 20 35 3a 20 3d  |drive"..... 5: =|
00001e20  22 52 65 61 64 20 6f 6e  6c 79 22 0d 0c bc 1a c9  |"Read only".....|
00001e30  20 37 3a 20 3d 22 4f 70  74 69 63 61 6c 20 6d 65  | 7: ="Optical me|
00001e40  6d 6f 72 79 22 0d 0c c6  19 c9 26 37 46 3a 3d 22  |mory".....&7F:="|
00001e50  3c 4e 6f 74 20 70 72 65  73 65 6e 74 3e 22 0d 0c  |<Not present>"..|
00001e60  d0 1e 7f 3a 3d 22 4e 6f  74 20 6b 6e 6f 77 6e 3a  |...:="Not known:|
00001e70  20 26 22 2b c3 7e 28 3f  71 31 25 29 0d 0c da 05  | &"+.~(?q1%)....|
00001e80  cb 0d 0c e4 05 3a 0d 0c  ee 12 dd a4 64 65 76 69  |.....:......devi|
00001e90  63 65 5f 69 64 65 6e 74  0d 0c f8 0e ea 20 73 31  |ce_ident..... s1|
00001ea0  24 2c 20 73 32 24 0d 0d  02 0c 3f 71 32 25 3d 26  |$, s2$....?q2%=&|
00001eb0  31 32 0d 0d 0c 0b 71 32  25 3f 31 3d 30 0d 0d 16  |12....q2%?1=0...|
00001ec0  0b 71 32 25 3f 32 3d 30  0d 0d 20 0b 71 32 25 3f  |.q2%?2=0.. .q2%?|
00001ed0  33 3d 30 0d 0d 2a 0d 71  32 25 3f 34 3d 31 32 37  |3=0..*.q2%?4=127|
00001ee0  0d 0d 34 0b 71 32 25 3f  35 3d 30 0d 0d 3e 2a c8  |..4.q2%?5=0..>*.|
00001ef0  99 22 53 43 53 49 5f 4f  70 22 2c 31 3c 3c 32 34  |."SCSI_Op",1<<24|
00001f00  2b 44 72 69 76 65 25 2c  36 2c 71 32 25 2c 71 31  |+Drive%,6,q2%,q1|
00001f10  25 2c 31 32 37 0d 0d 48  0d 71 31 25 3f 33 32 3d  |%,127..H.q1%?32=|
00001f20  31 33 0d 0d 52 2a 73 31  24 3d 24 28 71 31 25 2b  |13..R*s1$=$(q1%+|
00001f30  31 36 29 3a c8 95 20 c2  73 31 24 29 3d 22 20 22  |16):.. .s1$)=" "|
00001f40  20 73 31 24 3d c0 73 31  24 29 3a ce 0d 0d 5c 0d  | s1$=.s1$):...\.|
00001f50  71 31 25 3f 31 36 3d 31  33 0d 0d 66 29 73 32 24  |q1%?16=13..f)s2$|
00001f60  3d 24 28 71 31 25 2b 38  29 3a c8 95 20 c2 73 32  |=$(q1%+8):.. .s2|
00001f70  24 29 3d 22 20 22 20 73  32 24 3d c0 73 32 24 29  |$)=" " s2$=.s2$)|
00001f80  3a ce 0d 0d 70 10 3d 73  32 24 2b 22 20 22 2b 73  |:...p.=s2$+" "+s|
00001f90  31 24 0d 0d 7a 05 3a 0d  0d 84 1c dd a4 64 65 76  |1$..z.:......dev|
00001fa0  69 63 65 5f 77 72 69 74  65 5f 70 72 6f 74 65 63  |ice_write_protec|
00001fb0  74 65 64 0d 0d 8e 0c 3f  71 32 25 3d 26 31 41 0d  |ted....?q2%=&1A.|
00001fc0  0d 98 0b 71 32 25 3f 31  3d 30 0d 0d a2 0b 71 32  |...q2%?1=0....q2|
00001fd0  25 3f 32 3d 30 0d 0d ac  0b 71 32 25 3f 33 3d 30  |%?2=0....q2%?3=0|
00001fe0  0d 0d b6 0b 71 32 25 3f  34 3d 34 0d 0d c0 0b 71  |....q2%?4=4....q|
00001ff0  32 25 3f 35 3d 30 0d 0d  ca 2a c8 99 22 53 43 53  |2%?5=0...*.."SCS|
00002000  49 5f 4f 70 22 2c 31 3c  3c 32 34 2b 44 72 69 76  |I_Op",1<<24+Driv|
00002010  65 25 2c 36 2c 71 32 25  2c 71 31 25 2c 31 32 37  |e%,6,q2%,q1%,127|
00002020  0d 0d d4 17 3d 28 28 71  31 25 3f 32 20 80 20 31  |....=((q1%?2 . 1|
00002030  32 38 29 3c 3e 30 29 0d  0d de 05 3a 0d 0d e8 14  |28)<>0)....:....|
00002040  dd a4 64 65 76 69 63 65  5f 64 65 6e 73 69 74 79  |..device_density|
00002050  0d 0d f2 0b ea 20 73 69  7a 65 25 0d 0d fc 0c 3f  |..... size%....?|
00002060  71 32 25 3d 26 31 41 0d  0e 06 0b 71 32 25 3f 31  |q2%=&1A....q2%?1|
00002070  3d 30 0d 0e 10 0b 71 32  25 3f 32 3d 30 0d 0e 1a  |=0....q2%?2=0...|
00002080  0b 71 32 25 3f 33 3d 30  0d 0e 24 0c 71 32 25 3f  |.q2%?3=0..$.q2%?|
00002090  34 3d 31 32 0d 0e 2e 0b  71 32 25 3f 35 3d 30 0d  |4=12....q2%?5=0.|
000020a0  0e 38 2a c8 99 22 53 43  53 49 5f 4f 70 22 2c 31  |.8*.."SCSI_Op",1|
000020b0  3c 3c 32 34 2b 44 72 69  76 65 25 2c 36 2c 71 32  |<<24+Drive%,6,q2|
000020c0  25 2c 71 31 25 2c 31 32  37 0d 0e 42 2c 73 69 7a  |%,q1%,127..B,siz|
000020d0  65 25 3d 71 31 25 3f 31  31 2b 28 28 71 31 25 3f  |e%=q1%?11+((q1%?|
000020e0  31 30 29 3c 3c 38 29 2b  28 28 71 31 25 3f 39 29  |10)<<8)+((q1%?9)|
000020f0  3c 3c 31 36 29 0d 0e 4c  0e c8 8e 20 73 69 7a 65  |<<16)..L... size|
00002100  25 20 ca 0d 0e 56 1e c9  20 32 35 36 20 3a 4f 6c  |% ...V.. 256 :Ol|
00002110  64 4c 57 4d 25 3d 20 26  45 30 30 3a 20 3d 32 35  |dLWM%= &E00: =25|
00002120  36 0d 0e 60 1e c9 20 35  31 32 20 3a 4f 6c 64 4c  |6..`.. 512 :OldL|
00002130  57 4d 25 3d 20 26 45 30  30 3a 20 3d 35 31 32 0d  |WM%= &E00: =512.|
00002140  0e 6a 1f c9 20 31 30 32  34 3a 4f 6c 64 4c 57 4d  |.j.. 1024:OldLWM|
00002150  25 3d 26 31 30 30 30 3a  20 3d 31 30 32 34 0d 0e  |%=&1000: =1024..|
00002160  74 32 7f 3a 20 f2 66 61  74 61 6c 28 22 55 6e 73  |t2.: .fatal("Uns|
00002170  75 70 70 6f 72 74 65 64  20 62 6c 6f 63 6b 20 73  |upported block s|
00002180  69 7a 65 3a 20 22 2b c3  28 73 69 7a 65 25 29 29  |ize: "+.(size%))|
00002190  0d 0e 7e 05 cb 0d 0e 88  05 3a 0d 0e 92 12 dd a4  |..~......:......|
000021a0  64 65 76 69 63 65 5f 68  65 61 64 73 0d 0e 9c 0c  |device_heads....|
000021b0  3f 71 32 25 3d 26 31 41  0d 0e a6 0b 71 32 25 3f  |?q2%=&1A....q2%?|
000021c0  31 3d 30 0d 0e b0 0b 71  32 25 3f 32 3d 34 0d 0e  |1=0....q2%?2=4..|
000021d0  ba 0b 71 32 25 3f 33 3d  30 0d 0e c4 0c 71 32 25  |..q2%?3=0....q2%|
000021e0  3f 34 3d 33 32 0d 0e ce  0b 71 32 25 3f 35 3d 30  |?4=32....q2%?5=0|
000021f0  0d 0e d8 2a c8 99 22 53  43 53 49 5f 4f 70 22 2c  |...*.."SCSI_Op",|
00002200  31 3c 3c 32 34 2b 44 72  69 76 65 25 2c 36 2c 71  |1<<24+Drive%,6,q|
00002210  32 25 2c 71 31 25 2c 31  32 37 0d 0e e2 28 f4 50  |2%,q1%,127...(.P|
00002220  52 4f 43 65 72 72 6f 72  62 6f 78 28 22 48 65 61  |ROCerrorbox("Hea|
00002230  64 73 3a 20 22 2b 53 54  52 24 7e 71 31 25 3f 31  |ds: "+STR$~q1%?1|
00002240  37 29 0d 0e ec 0b 3d 71  31 25 3f 31 37 0d 0e f6  |7)....=q1%?17...|
00002250  05 3a 0d 0f 00 16 dd a4  64 65 76 69 63 65 5f 63  |.:......device_c|
00002260  79 6c 69 6e 64 65 72 73  0d 0f 0a 0c 3f 71 32 25  |ylinders....?q2%|
00002270  3d 26 31 41 0d 0f 14 0b  71 32 25 3f 31 3d 30 0d  |=&1A....q2%?1=0.|
00002280  0f 1e 0b 71 32 25 3f 32  3d 34 0d 0f 28 0b 71 32  |...q2%?2=4..(.q2|
00002290  25 3f 33 3d 30 0d 0f 32  0c 71 32 25 3f 34 3d 33  |%?3=0..2.q2%?4=3|
000022a0  32 0d 0f 3c 0b 71 32 25  3f 35 3d 30 0d 0f 46 2a  |2..<.q2%?5=0..F*|
000022b0  c8 99 22 53 43 53 49 5f  4f 70 22 2c 31 3c 3c 32  |.."SCSI_Op",1<<2|
000022c0  34 2b 44 72 69 76 65 25  2c 36 2c 71 32 25 2c 71  |4+Drive%,6,q2%,q|
000022d0  31 25 2c 31 32 37 0d 0f  50 44 f2 65 72 72 6f 72  |1%,127..PD.error|
000022e0  62 6f 78 28 22 43 79 6c  69 6e 64 65 72 73 3a 20  |box("Cylinders: |
000022f0  22 2b c3 7e 28 71 31 25  3f 31 36 2b 28 28 71 31  |"+.~(q1%?16+((q1|
00002300  25 3f 31 35 29 3c 3c 38  29 2b 28 28 71 31 25 3f  |%?15)<<8)+((q1%?|
00002310  31 34 29 3c 3c 31 36 29  29 29 0d 0f 5a 28 3d 71  |14)<<16)))..Z(=q|
00002320  31 25 3f 31 36 2b 28 28  71 31 25 3f 31 35 29 3c  |1%?16+((q1%?15)<|
00002330  3c 38 29 2b 28 28 71 31  25 3f 31 34 29 3c 3c 31  |<8)+((q1%?14)<<1|
00002340  36 29 0d 0f 64 05 3a 0d  0f 6e 17 dd a4 64 65 76  |6)..d.:..n...dev|
00002350  69 63 65 5f 6c 61 73 74  5f 62 6c 6f 63 6b 0d 0f  |ice_last_block..|
00002360  78 0c 3f 71 32 25 3d 26  32 35 0d 0f 82 0b 71 32  |x.?q2%=&25....q2|
00002370  25 3f 31 3d 30 0d 0f 8c  0b 71 32 25 21 32 3d 30  |%?1=0....q2%!2=0|
00002380  0d 0f 96 0b 71 32 25 21  36 3d 30 0d 0f a0 2b c8  |....q2%!6=0...+.|
00002390  99 22 53 43 53 49 5f 4f  70 22 2c 31 3c 3c 32 34  |."SCSI_Op",1<<24|
000023a0  2b 44 72 69 76 65 25 2c  31 30 2c 71 32 25 2c 71  |+Drive%,10,q2%,q|
000023b0  31 25 2c 31 32 37 0d 0f  aa 32 3d 71 31 25 3f 33  |1%,127...2=q1%?3|
000023c0  2b 28 28 71 31 25 3f 32  29 3c 3c 38 29 2b 28 28  |+((q1%?2)<<8)+((|
000023d0  71 31 25 3f 31 29 3c 3c  31 36 29 2b 28 28 3f 71  |q1%?1)<<16)+((?q|
000023e0  31 25 29 3c 3c 32 34 29  0d 0f b4 05 3a 0d 0f be  |1%)<<24)....:...|
000023f0  1c dd f2 73 65 74 5f 64  65 76 69 63 65 5f 66 61  |...set_device_fa|
00002400  73 74 5f 66 6f 72 6d 61  74 0d 0f c8 08 ea 20 70  |st_format..... p|
00002410  25 0d 0f d2 32 f4 20 54  68 69 73 20 70 72 6f 63  |%...2. This proc|
00002420  65 64 75 72 65 20 69 73  20 2a 4f 4e 4c 59 2a 20  |edure is *ONLY* |
00002430  63 61 6c 6c 65 64 20 69  66 20 77 65 20 68 61 76  |called if we hav|
00002440  65 20 61 0d 0f dc 34 f4  20 4d 61 78 74 6f 72 20  |e a...4. Maxtor |
00002450  54 61 68 69 74 69 20 49  20 64 72 69 76 65 20 61  |Tahiti I drive a|
00002460  6e 64 20 74 68 65 20 75  73 65 72 20 68 61 73 20  |nd the user has |
00002470  74 6f 67 67 6c 65 64 0d  0f e6 1d f4 20 74 68 65  |toggled..... the|
00002480  20 46 61 73 74 20 46 6f  72 6d 61 74 20 62 75 74  | Fast Format but|
00002490  74 6f 6e 2e 0d 0f f0 05  f4 0d 0f fa 29 e7 a4 64  |ton.........)..d|
000024a0  65 76 69 63 65 5f 69 64  65 6e 74 3c 3e 22 4d 61  |evice_ident<>"Ma|
000024b0  78 4f 70 74 69 78 20 54  61 68 69 74 69 20 31 22  |xOptix Tahiti 1"|
000024c0  20 e1 0d 10 04 27 f4 20  53 74 65 70 20 31 2e 20  | ....'. Step 1. |
000024d0  52 65 61 64 20 74 68 65  20 6d 61 73 6b 20 66 6f  |Read the mask fo|
000024e0  72 20 70 61 67 65 20 32  41 0d 10 0e 0d 71 32 25  |r page 2A....q2%|
000024f0  3f 30 3d 26 31 41 0d 10  18 0b 71 32 25 3f 31 3d  |?0=&1A....q2%?1=|
00002500  30 0d 10 22 14 71 32 25  3f 32 3d 26 32 41 2b 28  |0..".q2%?2=&2A+(|
00002510  31 3c 3c 36 29 0d 10 2c  0b 71 32 25 3f 33 3d 30  |1<<6)..,.q2%?3=0|
00002520  0d 10 36 0c 71 32 25 3f  34 3d 32 35 0d 10 40 0b  |..6.q2%?4=25..@.|
00002530  71 32 25 3f 35 3d 30 0d  10 4a 2a c8 99 22 53 43  |q2%?5=0..J*.."SC|
00002540  53 49 5f 4f 70 22 2c 31  3c 3c 32 34 2b 44 72 69  |SI_Op",1<<24+Dri|
00002550  76 65 25 2c 36 2c 71 32  25 2c 71 33 25 2c 31 32  |ve%,6,q2%,q3%,12|
00002560  37 0d 10 54 05 f4 0d 10  5e 33 f4 20 53 74 65 70  |7..T....^3. Step|
00002570  20 32 2e 20 52 65 61 64  20 74 68 65 20 63 75 72  | 2. Read the cur|
00002580  72 65 6e 74 20 73 65 74  74 69 6e 67 73 20 66 6f  |rent settings fo|
00002590  72 20 70 61 67 65 20 32  41 0d 10 68 0d 71 32 25  |r page 2A..h.q2%|
000025a0  3f 30 3d 26 31 41 0d 10  72 0b 71 32 25 3f 31 3d  |?0=&1A..r.q2%?1=|
000025b0  30 0d 10 7c 0d 71 32 25  3f 32 3d 26 32 41 0d 10  |0..|.q2%?2=&2A..|
000025c0  86 0b 71 32 25 3f 33 3d  30 0d 10 90 0c 71 32 25  |..q2%?3=0....q2%|
000025d0  3f 34 3d 32 35 0d 10 9a  0b 71 32 25 3f 35 3d 30  |?4=25....q2%?5=0|
000025e0  0d 10 a4 2a c8 99 22 53  43 53 49 5f 4f 70 22 2c  |...*.."SCSI_Op",|
000025f0  31 3c 3c 32 34 2b 44 72  69 76 65 25 2c 36 2c 71  |1<<24+Drive%,6,q|
00002600  32 25 2c 71 31 25 2c 31  32 37 0d 10 ae 05 f4 0d  |2%,q1%,127......|
00002610  10 b8 37 f4 20 53 74 65  70 20 33 2e 20 43 6c 65  |..7. Step 3. Cle|
00002620  61 72 20 74 68 65 20 69  6c 6c 65 67 61 6c 20 70  |ar the illegal p|
00002630  61 72 74 73 20 6f 66 20  74 68 65 20 70 61 67 65  |arts of the page|
00002640  20 77 65 27 76 65 0d 10  c2 17 f4 20 20 20 20 20  | we've.....     |
00002650  20 20 20 20 6a 75 73 74  20 72 65 61 64 0d 10 cc  |    just read...|
00002660  0e e3 70 25 3d 30 20 b8  20 32 34 0d 10 d6 1d 20  |..p%=0 . 24.... |
00002670  71 31 25 3f 70 25 20 3d  20 71 31 25 3f 70 25 20  |q1%?p% = q1%?p% |
00002680  80 20 71 33 25 3f 70 25  0d 10 e0 05 ed 0d 10 ea  |. q3%?p%........|
00002690  05 f4 0d 10 f4 2f f4 20  53 74 65 70 20 34 2e 20  |...../. Step 4. |
000026a0  54 6f 67 67 6c 65 20 74  68 65 20 4c 4e 52 20 62  |Toggle the LNR b|
000026b0  69 74 20 61 73 20 61 70  70 72 6f 70 72 69 61 74  |it as appropriat|
000026c0  65 0d 10 fe 12 e7 46 61  73 74 46 6f 72 6d 61 74  |e.....FastFormat|
000026d0  25 20 8c 0d 11 08 16 20  71 31 25 3f 31 34 3d 71  |% ..... q1%?14=q|
000026e0  31 25 3f 31 34 20 84 20  32 0d 11 12 05 cc 0d 11  |1%?14 . 2.......|
000026f0  1c 17 20 71 31 25 3f 31  34 3d 71 31 25 3f 31 34  |.. q1%?14=q1%?14|
00002700  20 80 20 ac 32 0d 11 26  05 cd 0d 11 30 0c 71 31  | . .2..&....0.q1|
00002710  25 3f 30 38 3d 30 0d 11  3a 0c 71 31 25 3f 30 39  |%?08=0..:.q1%?09|
00002720  3d 33 0d 11 44 0c 71 31  25 3f 31 30 3d 30 0d 11  |=3..D.q1%?10=0..|
00002730  4e 0c 71 31 25 3f 31 31  3d 30 0d 11 58 05 f4 0d  |N.q1%?11=0..X...|
00002740  11 62 20 f4 20 53 74 65  70 20 35 2e 20 57 72 69  |.b . Step 5. Wri|
00002750  74 65 20 70 61 67 65 20  32 41 20 62 61 63 6b 0d  |te page 2A back.|
00002760  11 6c 0d 71 32 25 3f 30  3d 26 31 35 0d 11 76 0e  |.l.q2%?0=&15..v.|
00002770  71 32 25 3f 31 3d 31 3c  3c 34 0d 11 80 0b 71 32  |q2%?1=1<<4....q2|
00002780  25 3f 32 3d 30 0d 11 8a  0b 71 32 25 3f 33 3d 30  |%?2=0....q2%?3=0|
00002790  0d 11 94 11 71 32 25 3f  34 3d 31 37 3a f4 20 32  |....q2%?4=17:. 2|
000027a0  35 0d 11 9e 0b 71 32 25  3f 35 3d 30 0d 11 a8 11  |5....q2%?5=0....|
000027b0  65 72 72 6f 72 5f 66 6c  61 67 25 3d 31 0d 11 b2  |error_flag%=1...|
000027c0  2b c8 99 22 53 43 53 49  5f 4f 70 22 2c 31 3c 3c  |+.."SCSI_Op",1<<|
000027d0  32 35 2b 44 72 69 76 65  25 2c 36 2c 71 32 25 2c  |25+Drive%,6,q2%,|
000027e0  71 31 25 2b 38 2c 31 37  0d 11 bc 11 65 72 72 6f  |q1%+8,17....erro|
000027f0  72 5f 66 6c 61 67 25 3d  33 0d 11 c6 05 e1 0d 11  |r_flag%=3.......|
00002800  d0 05 3a 0d 11 da 14 dd  f2 72 65 73 65 74 5f 69  |..:......reset_i|
00002810  63 6f 6e 28 69 25 29 0d  11 e4 28 21 71 31 25 3d  |con(i%)...(!q1%=|
00002820  6d 61 69 6e 25 3a 71 31  25 21 34 3d 69 25 3a 71  |main%:q1%!4=i%:q|
00002830  31 25 21 38 3d 30 3a 71  31 25 21 31 32 3d 30 0d  |1%!8=0:q1%!12=0.|
00002840  11 ee 1e c8 99 22 57 69  6d 70 5f 53 65 74 49 63  |....."Wimp_SetIc|
00002850  6f 6e 53 74 61 74 65 22  2c 2c 71 31 25 0d 11 f8  |onState",,q1%...|
00002860  05 e1 0d 12 02 05 3a 0d  12 0c 15 dd f2 73 65 6c  |......:......sel|
00002870  65 63 74 5f 69 63 6f 6e  28 69 25 29 0d 12 16 30  |ect_icon(i%)...0|
00002880  21 71 31 25 3d 6d 61 69  6e 25 3a 71 31 25 21 34  |!q1%=main%:q1%!4|
00002890  3d 69 25 3a 71 31 25 21  38 3d 31 3c 3c 32 31 3a  |=i%:q1%!8=1<<21:|
000028a0  71 31 25 21 31 32 3d 31  3c 3c 32 31 0d 12 20 1e  |q1%!12=1<<21.. .|
000028b0  c8 99 22 57 69 6d 70 5f  53 65 74 49 63 6f 6e 53  |.."Wimp_SetIconS|
000028c0  74 61 74 65 22 2c 2c 71  31 25 0d 12 2a 05 e1 0d  |tate",,q1%..*...|
000028d0  12 34 05 3a 0d 12 3e 17  dd f2 64 65 73 65 6c 65  |.4.:..>...desele|
000028e0  63 74 5f 69 63 6f 6e 28  69 25 29 0d 12 48 2c 21  |ct_icon(i%)..H,!|
000028f0  71 31 25 3d 6d 61 69 6e  25 3a 71 31 25 21 34 3d  |q1%=main%:q1%!4=|
00002900  69 25 3a 71 31 25 21 38  3d 30 3a 71 31 25 21 31  |i%:q1%!8=0:q1%!1|
00002910  32 3d 31 3c 3c 32 31 0d  12 52 1e c8 99 22 57 69  |2=1<<21..R..."Wi|
00002920  6d 70 5f 53 65 74 49 63  6f 6e 53 74 61 74 65 22  |mp_SetIconState"|
00002930  2c 2c 71 31 25 0d 12 5c  05 e1 0d 12 66 05 3a 0d  |,,q1%..\....f.:.|
00002940  12 70 16 dd f2 64 69 73  61 62 6c 65 5f 69 63 6f  |.p...disable_ico|
00002950  6e 28 69 25 29 0d 12 7a  30 21 71 31 25 3d 6d 61  |n(i%)..z0!q1%=ma|
00002960  69 6e 25 3a 71 31 25 21  34 3d 69 25 3a 71 31 25  |in%:q1%!4=i%:q1%|
00002970  21 38 3d 31 3c 3c 32 32  3a 71 31 25 21 31 32 3d  |!8=1<<22:q1%!12=|
00002980  31 3c 3c 32 32 0d 12 84  1e c8 99 22 57 69 6d 70  |1<<22......"Wimp|
00002990  5f 53 65 74 49 63 6f 6e  53 74 61 74 65 22 2c 2c  |_SetIconState",,|
000029a0  71 31 25 0d 12 8e 05 e1  0d 12 98 05 3a 0d 12 a2  |q1%.........:...|
000029b0  15 dd f2 65 6e 61 62 6c  65 5f 69 63 6f 6e 28 69  |...enable_icon(i|
000029c0  25 29 0d 12 ac 2c 21 71  31 25 3d 6d 61 69 6e 25  |%)...,!q1%=main%|
000029d0  3a 71 31 25 21 34 3d 69  25 3a 71 31 25 21 38 3d  |:q1%!4=i%:q1%!8=|
000029e0  30 3a 71 31 25 21 31 32  3d 31 3c 3c 32 32 0d 12  |0:q1%!12=1<<22..|
000029f0  b6 1e c8 99 22 57 69 6d  70 5f 53 65 74 49 63 6f  |...."Wimp_SetIco|
00002a00  6e 53 74 61 74 65 22 2c  2c 71 31 25 0d 12 c0 05  |nState",,q1%....|
00002a10  e1 0d 12 ca 05 3a 0d 12  d4 17 dd f2 77 72 69 74  |.....:......writ|
00002a20  65 5f 69 63 6f 6e 28 69  25 2c 73 24 29 0d 12 de  |e_icon(i%,s$)...|
00002a30  08 ea 20 70 25 0d 12 e8  17 21 71 31 25 3d 6d 61  |.. p%....!q1%=ma|
00002a40  69 6e 25 3a 71 31 25 21  34 3d 69 25 0d 12 f2 1e  |in%:q1%!4=i%....|
00002a50  c8 99 22 57 69 6d 70 5f  47 65 74 49 63 6f 6e 53  |.."Wimp_GetIconS|
00002a60  74 61 74 65 22 2c 2c 71  31 25 0d 12 fc 12 70 25  |tate",,q1%....p%|
00002a70  3d 21 28 71 31 25 2b 38  2b 32 30 29 0d 13 06 0a  |=!(q1%+8+20)....|
00002a80  24 70 25 3d 73 24 0d 13  10 13 f2 72 65 73 65 74  |$p%=s$.....reset|
00002a90  5f 69 63 6f 6e 28 69 25  29 0d 13 1a 05 e1 0d 13  |_icon(i%).......|
00002aa0  24 05 3a 0d 13 2e 16 dd  f2 73 74 61 74 75 73 5f  |$.:......status_|
00002ab0  65 72 72 6f 72 28 70 25  29 0d 13 38 08 ea 20 73  |error(p%)..8.. s|
00002ac0  24 0d 13 42 09 70 25 2b  3d 34 0d 13 4c 21 c8 95  |$..B.p%+=4..L!..|
00002ad0  20 3f 70 25 3c 3e 30 20  80 20 3f 70 25 3c 3e 31  | ?p%<>0 . ?p%<>1|
00002ae0  33 20 80 20 3f 70 25 3c  3e 31 30 0d 13 56 13 20  |3 . ?p%<>10..V. |
00002af0  73 24 2b 3d bd 3f 70 25  3a 70 25 2b 3d 31 0d 13  |s$+=.?p%:p%+=1..|
00002b00  60 05 ce 0d 13 6a 1b f2  77 72 69 74 65 5f 69 63  |`....j..write_ic|
00002b10  6f 6e 28 73 74 61 74 75  73 25 2c 73 24 29 0d 13  |on(status%,s$)..|
00002b20  74 05 e1 0d 13 7e 05 3a  0d 13 88 12 dd f2 64 65  |t....~.:......de|
00002b30  76 69 63 65 5f 63 6c 61  69 6d 0d 13 92 41 c8 99  |vice_claim...A..|
00002b40  22 58 53 43 53 49 5f 52  65 73 65 72 76 65 22 2c  |"XSCSI_Reserve",|
00002b50  31 2c 44 72 69 76 65 25  20 20 3a 20 f4 20 46 6f  |1,Drive%  : . Fo|
00002b60  72 63 65 20 53 63 73 69  46 73 20 74 6f 20 72 65  |rce ScsiFs to re|
00002b70  6c 65 61 73 65 20 64 72  69 76 65 0d 13 9c 3f c8  |lease drive...?.|
00002b80  99 22 53 43 53 49 5f 52  65 73 65 72 76 65 22 2c  |."SCSI_Reserve",|
00002b90  32 2c 44 72 69 76 65 25  20 20 20 3a 20 f4 20 42  |2,Drive%   : . B|
00002ba0  75 74 20 64 6f 6e 27 74  20 6b 65 65 70 20 69 74  |ut don't keep it|
00002bb0  20 6f 75 72 73 65 6c 76  65 73 0d 13 a6 2e c8 99  | ourselves......|
00002bc0  22 53 43 53 49 5f 43 6f  6e 74 72 6f 6c 22 2c 33  |"SCSI_Control",3|
00002bd0  2c 44 72 69 76 65 25 2c  30 20 3a 20 f4 20 4e 6f  |,Drive%,0 : . No|
00002be0  20 74 69 6d 65 6f 75 74  0d 13 b0 3d c8 99 22 53  | timeout...=.."S|
00002bf0  43 53 49 5f 43 6f 6e 74  72 6f 6c 22 2c 34 2c 44  |CSI_Control",4,D|
00002c00  72 69 76 65 25 2c 32 20  3a 20 f4 20 41 75 74 6f  |rive%,2 : . Auto|
00002c10  6d 61 74 69 63 20 65 72  72 6f 72 20 72 65 70 6f  |matic error repo|
00002c20  72 74 69 6e 67 0d 13 ba  05 e1 0d 13 c4 05 3a 0d  |rting.........:.|
00002c30  13 ce 12 dd f2 66 6f 72  6d 61 74 5f 64 72 69 76  |.....format_driv|
00002c40  65 0d 13 d8 08 ea 20 69  25 0d 13 e2 19 73 74 61  |e..... i%....sta|
00002c50  72 74 65 64 5f 66 6f 72  6d 61 74 74 69 6e 67 25  |rted_formatting%|
00002c60  3d b9 0d 13 ec 19 f2 64  69 73 61 62 6c 65 5f 75  |=......disable_u|
00002c70  73 65 72 5f 6f 70 74 69  6f 6e 73 0d 13 f6 18 f2  |ser_options.....|
00002c80  64 69 73 61 62 6c 65 5f  64 72 69 76 65 5f 69 63  |disable_drive_ic|
00002c90  6f 6e 73 0d 14 00 36 f2  77 72 69 74 65 5f 69 63  |ons...6.write_ic|
00002ca0  6f 6e 28 73 74 61 74 75  73 25 2c 22 46 6f 72 6d  |on(status%,"Form|
00002cb0  61 74 74 69 6e 67 2e 20  50 6c 65 61 73 65 20 77  |atting. Please w|
00002cc0  61 69 74 20 2e 2e 2e 22  29 0d 14 0a 11 53 6b 69  |ait ...")....Ski|
00002cd0  70 46 6f 72 6d 61 74 25  3d b9 0d 14 14 13 e7 20  |pFormat%=...... |
00002ce0  53 6b 69 70 46 6f 72 6d  61 74 25 20 8c 0d 14 1e  |SkipFormat% ....|
00002cf0  0f 20 73 63 73 69 5f 6f  70 25 3d 31 0d 14 28 0e  |. scsi_op%=1..(.|
00002d00  20 21 72 65 73 75 6c 74  3d 31 0d 14 32 05 cc 0d  | !result=1..2...|
00002d10  14 3c 1c 20 f2 73 65 74  5f 64 65 76 69 63 65 5f  |.<. .set_device_|
00002d20  66 61 73 74 5f 66 6f 72  6d 61 74 0d 14 46 0e 20  |fast_format..F. |
00002d30  21 72 65 73 75 6c 74 3d  30 0d 14 50 1b 20 3f 71  |!result=0..P. ?q|
00002d40  32 25 3d 34 3a 71 32 25  21 31 3d 30 3a 71 32 25  |2%=4:q2%!1=0:q2%|
00002d50  3f 35 3d 30 0d 14 5a 3b  20 c8 99 22 53 43 53 49  |?5=0..Z; .."SCSI|
00002d60  5f 4f 70 22 2c 31 3c 3c  32 39 2b 44 72 69 76 65  |_Op",1<<29+Drive|
00002d70  25 2c 36 2c 71 32 25 2c  71 31 25 2c 30 2c 30 2c  |%,6,q2%,q1%,0,0,|
00002d80  52 4d 41 25 20 b8 20 73  63 73 69 5f 6f 70 25 0d  |RMA% . scsi_op%.|
00002d90  14 64 05 cd 0d 14 6e 05  e1 0d 14 78 05 3a 0d 14  |.d....n....x.:..|
00002da0  82 0f dd f2 70 6f 6c 6c  5f 73 63 73 69 0d 14 8c  |....poll_scsi...|
00002db0  08 ea 20 69 25 0d 14 96  11 e7 21 72 65 73 75 6c  |.. i%.....!resul|
00002dc0  74 3c 3e 30 20 8c 0d 14  a0 0f 20 73 63 73 69 5f  |t<>0 ..... scsi_|
00002dd0  6f 70 25 3d 30 0d 14 aa  11 20 e7 21 72 65 73 75  |op%=0.... .!resu|
00002de0  6c 74 3d 31 20 8c 0d 14  b4 10 20 20 f2 53 74 72  |lt=1 .....  .Str|
00002df0  75 63 74 75 72 65 0d 14  be 1a 20 20 f2 65 6e 61  |ucture....  .ena|
00002e00  62 6c 65 5f 75 73 65 72  5f 6f 70 74 69 6f 6e 73  |ble_user_options|
00002e10  0d 14 c8 19 20 20 f2 65  6e 61 62 6c 65 5f 64 72  |....  .enable_dr|
00002e20  69 76 65 5f 69 63 6f 6e  73 0d 14 d2 1b 20 20 73  |ive_icons....  s|
00002e30  74 61 72 74 65 64 5f 66  6f 72 6d 61 74 74 69 6e  |tarted_formattin|
00002e40  67 25 3d a3 0d 14 dc 2e  20 20 c8 99 22 58 4f 53  |g%=.....  .."XOS|
00002e50  5f 43 4c 49 22 2c 22 53  43 53 49 3a 44 69 73 6d  |_CLI","SCSI:Dism|
00002e60  6f 75 6e 74 20 22 2b c3  28 44 72 69 76 65 25 2b  |ount "+.(Drive%+|
00002e70  34 29 0d 14 e6 2d 20 20  f2 77 72 69 74 65 5f 69  |4)...-  .write_i|
00002e80  63 6f 6e 28 73 74 61 74  75 73 25 2c 22 46 6f 72  |con(status%,"For|
00002e90  6d 61 74 20 63 6f 6d 70  6c 65 74 65 64 22 29 0d  |mat completed").|
00002ea0  14 f0 06 20 cc 0d 14 fa  1e 20 20 f2 73 74 61 74  |... .....  .stat|
00002eb0  75 73 5f 65 72 72 6f 72  28 21 72 30 5f 62 6c 6f  |us_error(!r0_blo|
00002ec0  63 6b 29 0d 15 04 06 20  cd 0d 15 0e 05 cd 0d 15  |ck).... ........|
00002ed0  18 05 e1 0d 15 22 05 3a  0d 15 2c 09 dd f2 61 73  |.....".:..,...as|
00002ee0  6d 0d 15 36 08 ea 20 69  25 0d 15 40 22 c8 99 22  |m..6.. i%..@".."|
00002ef0  4f 53 5f 4d 6f 64 75 6c  65 22 2c 36 2c 2c 2c 31  |OS_Module",6,,,1|
00002f00  32 38 20 b8 20 2c 2c 52  4d 41 25 0d 15 4a 11 e3  |28 . ,,RMA%..J..|
00002f10  69 25 3d 30 20 b8 20 32  20 88 20 32 0d 15 54 0b  |i%=0 . 2 . 2..T.|
00002f20  50 25 3d 52 4d 41 25 0d  15 5e 0c 5b 20 4f 50 54  |P%=RMA%..^.[ OPT|
00002f30  20 69 25 0d 15 68 22 20  20 20 20 20 20 20 20 20  | i%..h"         |
00002f40  20 20 20 53 54 52 20 20  20 52 30 2c 20 72 30 5f  |   STR   R0, r0_|
00002f50  62 6c 6f 63 6b 0d 15 72  22 20 20 20 20 20 20 20  |block..r"       |
00002f60  20 20 20 20 20 53 54 52  20 20 20 52 31 2c 20 72  |     STR   R1, r|
00002f70  31 5f 62 6c 6f 63 6b 0d  15 7c 22 20 20 20 20 20  |1_block..|"     |
00002f80  20 20 20 20 20 20 20 53  54 52 20 20 20 52 32 2c  |       STR   R2,|
00002f90  20 72 32 5f 62 6c 6f 63  6b 0d 15 86 1c 20 20 20  | r2_block....   |
00002fa0  20 20 20 20 20 20 20 20  20 4d 4f 56 56 43 20 52  |         MOVVC R|
00002fb0  30 2c 20 23 31 0d 15 90  1c 20 20 20 20 20 20 20  |0, #1....       |
00002fc0  20 20 20 20 20 4d 4f 56  56 53 20 52 30 2c 20 23  |     MOVVS R0, #|
00002fd0  32 0d 15 9a 20 20 20 20  20 20 20 20 20 20 20 20  |2...            |
00002fe0  20 53 54 52 20 20 20 52  30 2c 20 72 65 73 75 6c  | STR   R0, resul|
00002ff0  74 0d 15 a4 1d 20 20 20  20 20 20 20 20 20 20 20  |t....           |
00003000  20 4d 4f 56 20 20 20 50  43 2c 20 52 31 34 0d 15  | MOV   PC, R14..|
00003010  ae 17 2e 72 65 73 75 6c  74 20 20 20 20 20 45 51  |...result     EQ|
00003020  55 44 20 20 30 0d 15 b8  17 2e 72 30 5f 62 6c 6f  |UD  0.....r0_blo|
00003030  63 6b 20 20 20 45 51 55  44 20 20 30 0d 15 c2 17  |ck   EQUD  0....|
00003040  2e 72 31 5f 62 6c 6f 63  6b 20 20 20 45 51 55 44  |.r1_block   EQUD|
00003050  20 20 30 0d 15 cc 17 2e  72 32 5f 62 6c 6f 63 6b  |  0.....r2_block|
00003060  20 20 20 45 51 55 44 20  20 30 0d 15 d6 0e 2e 4e  |   EQUD  0.....N|
00003070  65 77 43 68 65 63 6b 25  0d 15 e0 1b 20 20 20 20  |ewCheck%....    |
00003080  20 20 20 20 20 20 20 20  4d 4f 56 20 20 20 52 30  |        MOV   R0|
00003090  2c 23 30 0d 15 ea 24 20  20 20 20 20 20 20 20 20  |,#0...$         |
000030a0  20 20 20 41 44 44 53 20  20 52 32 2c 52 31 2c 52  |   ADDS  R2,R1,R|
000030b0  32 20 20 5c 43 3d 30 0d  15 f4 0a 2e 6c 6f 6f 70  |2  \C=0.....loop|
000030c0  25 0d 15 fe 22 20 20 20  20 20 20 20 20 20 20 20  |%..."           |
000030d0  20 4c 44 52 20 20 20 52  33 2c 5b 52 32 2c 23 2d  | LDR   R3,[R2,#-|
000030e0  34 5d 21 0d 16 08 1e 20  20 20 20 20 20 20 20 20  |4]!....         |
000030f0  20 20 20 41 44 43 53 20  20 52 30 2c 52 30 2c 52  |   ADCS  R0,R0,R|
00003100  33 0d 16 12 1b 20 20 20  20 20 20 20 20 20 20 20  |3....           |
00003110  20 54 45 51 53 20 20 52  32 2c 52 31 0d 16 1c 1b  | TEQS  R2,R1....|
00003120  20 20 20 20 20 20 20 20  20 20 20 20 42 4e 45 20  |            BNE |
00003130  20 20 6c 6f 6f 70 25 0d  16 26 1e 20 20 20 20 20  |  loop%..&.     |
00003140  20 20 20 20 20 20 20 80  20 20 20 52 33 2c 52 33  |       .   R3,R3|
00003150  2c 23 26 46 46 0d 16 30  1e 20 20 20 20 20 20 20  |,#&FF..0.       |
00003160  20 20 20 20 20 53 55 42  20 20 20 52 30 2c 52 30  |     SUB   R0,R0|
00003170  2c 52 33 0d 16 3a 24 20  20 20 20 20 20 20 20 20  |,R3..:$         |
00003180  20 20 20 82 20 20 20 52  30 2c 52 30 2c 52 30 2c  |   .   R0,R0,R0,|
00003190  4c 53 52 20 23 31 36 0d  16 44 23 20 20 20 20 20  |LSR #16..D#     |
000031a0  20 20 20 20 20 20 20 82  20 20 20 52 30 2c 52 30  |       .   R0,R0|
000031b0  2c 52 30 2c 4c 53 52 20  23 38 0d 16 4e 1e 20 20  |,R0,LSR #8..N.  |
000031c0  20 20 20 20 20 20 20 20  20 20 80 20 20 20 52 30  |          .   R0|
000031d0  2c 52 30 2c 23 26 46 46  0d 16 58 1c 20 20 20 20  |,R0,#&FF..X.    |
000031e0  20 20 20 20 20 20 20 20  4d 4f 56 53 20 20 50 43  |        MOVS  PC|
000031f0  2c 52 31 34 0d 16 62 05  5d 0d 16 6c 05 ed 0d 16  |,R14..b.]..l....|
00003200  76 05 e1 0d 16 80 05 3a  0d 16 8a 0f dd f2 53 74  |v......:......St|
00003210  72 75 63 74 75 72 65 0d  16 94 0d f2 47 65 74 53  |ructure.....GetS|
00003220  68 61 70 65 0d 16 9e 0f  e7 20 4e 65 77 4d 61 70  |hape..... NewMap|
00003230  25 20 8c 0d 16 a8 12 20  f2 4e 65 77 53 74 72 75  |% ..... .NewStru|
00003240  63 74 75 72 65 0d 16 b2  05 cc 0d 16 bc 12 20 f2  |cture......... .|
00003250  4f 6c 64 53 74 72 75 63  74 75 72 65 0d 16 c6 05  |OldStructure....|
00003260  cd 0d 16 d0 05 e1 0d 16  da 05 3a 0d 16 e4 12 dd  |..........:.....|
00003270  f2 4f 6c 64 53 74 72 75  63 74 75 72 65 0d 16 ee  |.OldStructure...|
00003280  14 f2 57 72 69 74 65 44  65 66 65 63 74 4c 69 73  |..WriteDefectLis|
00003290  74 0d 16 f8 12 f2 57 72  69 74 65 4f 6c 64 46 73  |t.....WriteOldFs|
000032a0  4d 61 70 0d 17 02 11 f2  57 72 69 74 65 52 6f 6f  |Map.....WriteRoo|
000032b0  74 44 69 72 0d 17 0c 05  e1 0d 17 16 05 3a 0d 17  |tDir.........:..|
000032c0  20 2f f4 20 43 61 6c 63  75 6c 61 74 65 20 74 68  | /. Calculate th|
000032d0  65 20 6e 75 6d 62 65 72  20 6f 66 20 6d 61 70 20  |e number of map |
000032e0  62 69 74 73 20 72 65 71  75 69 72 65 64 0d 17 2a  |bits required..*|
000032f0  25 dd 20 a4 4d 61 70 42  69 74 73 28 53 65 63 73  |%. .MapBits(Secs|
00003300  25 2c 4c 67 25 2c 4c 67  32 53 65 63 53 69 7a 65  |%,Lg%,Lg2SecSize|
00003310  25 29 0d 17 34 10 20 20  20 20 ea 20 53 68 69 66  |%)..4.    . Shif|
00003320  74 25 0d 17 3e 1e 20 20  20 20 53 68 69 66 74 25  |t%..>.    Shift%|
00003330  3d 4c 67 32 53 65 63 53  69 7a 65 25 2d 4c 67 25  |=Lg2SecSize%-Lg%|
00003340  0d 17 48 16 20 20 20 20  e7 20 28 53 68 69 66 74  |..H.    . (Shift|
00003350  25 3e 30 29 20 8c 0d 17  52 1a 20 20 20 20 20 20  |%>0) ...R.      |
00003360  20 20 3d 53 65 63 73 25  3c 3c 53 68 69 66 74 25  |  =Secs%<<Shift%|
00003370  0d 17 5c 09 20 20 20 20  cc 0d 17 66 1d 20 20 20  |..\.    ...f.   |
00003380  20 20 20 20 20 3d 53 65  63 73 25 3e 3e 28 2d 53  |     =Secs%>>(-S|
00003390  68 69 66 74 25 29 0d 17  70 09 20 20 20 20 cd 0d  |hift%)..p.    ..|
000033a0  17 7a 04 0d 17 84 2a dd  20 a4 52 6f 75 6e 64 53  |.z....*. .RoundS|
000033b0  65 63 74 6f 72 73 28 42  69 74 73 25 2c 4c 67 25  |ectors(Bits%,Lg%|
000033c0  2c 4c 67 32 53 65 63 53  69 7a 65 25 29 0d 17 8e  |,Lg2SecSize%)...|
000033d0  10 20 20 20 20 ea 20 53  68 69 66 74 25 0d 17 98  |.    . Shift%...|
000033e0  1e 20 20 20 20 53 68 69  66 74 25 3d 4c 67 32 53  |.    Shift%=Lg2S|
000033f0  65 63 53 69 7a 65 25 2d  4c 67 25 0d 17 a2 16 20  |ecSize%-Lg%.... |
00003400  20 20 20 e7 20 28 53 68  69 66 74 25 3e 30 29 20  |   . (Shift%>0) |
00003410  8c 0d 17 ac 1c 20 20 20  20 20 20 20 20 3d 42 69  |.....        =Bi|
00003420  74 73 25 3e 3e 28 53 68  69 66 74 25 29 0d 17 b6  |ts%>>(Shift%)...|
00003430  09 20 20 20 20 cc 0d 17  c0 1d 20 20 20 20 20 20  |.    .....      |
00003440  20 20 3d 42 69 74 73 25  3c 3c 28 2d 53 68 69 66  |  =Bits%<<(-Shif|
00003450  74 25 29 0d 17 ca 09 20  20 20 20 cd 0d 17 d4 04  |t%)....    .....|
00003460  0d 17 de 18 dd 20 a4 64  6f 61 6c 6c 6f 63 28 56  |..... .doalloc(V|
00003470  65 72 62 6f 73 65 25 29  0d 17 e8 2c 20 4c 6f 67  |erbose%)..., Log|
00003480  32 41 6c 6c 6f 63 25 3d  4c 6f 67 25 3a f2 53 68  |2Alloc%=Log%:.Sh|
00003490  61 72 65 53 69 7a 65 73  28 4c 6f 67 32 41 6c 6c  |areSizes(Log2All|
000034a0  6f 63 25 29 0d 17 f2 3f  20 4d 61 70 42 69 74 73  |oc%)...? MapBits|
000034b0  25 3d a4 4d 61 70 42 69  74 73 28 53 65 63 74 6f  |%=.MapBits(Secto|
000034c0  72 73 50 65 72 44 69 73  63 25 2c 4c 6f 67 32 41  |rsPerDisc%,Log2A|
000034d0  6c 6c 6f 63 25 2c 4c 6f  67 32 53 65 63 53 69 7a  |lloc%,Log2SecSiz|
000034e0  65 25 29 0d 17 fc 42 20  52 6f 75 6e 64 53 65 63  |e%)...B RoundSec|
000034f0  74 6f 72 73 25 3d a4 52  6f 75 6e 64 53 65 63 74  |tors%=.RoundSect|
00003500  6f 72 73 28 4d 61 70 42  69 74 73 25 2c 4c 6f 67  |ors(MapBits%,Log|
00003510  32 41 6c 6c 6f 63 25 2c  4c 6f 67 32 53 65 63 53  |2Alloc%,Log2SecS|
00003520  69 7a 65 25 29 0d 18 06  34 20 42 65 73 74 5a 6f  |ize%)...4 BestZo|
00003530  6e 65 73 25 3d 31 20 3c  3c 20 33 30 20 20 20 20  |nes%=1 << 30    |
00003540  20 20 3a f4 20 69 6e 69  74 20 74 6f 20 72 6f 67  |  :. init to rog|
00003550  75 65 20 76 61 6c 75 65  73 0d 18 10 18 20 42 65  |ue values.... Be|
00003560  73 74 43 79 6c 4f 66 66  25 3d 31 20 3c 3c 20 33  |stCylOff%=1 << 3|
00003570  30 0d 18 1a 18 20 e3 20  44 75 6d 6d 79 53 70 61  |0.... . DummySpa|
00003580  72 65 25 3d 31 20 b8 20  31 0d 18 24 32 20 e3 20  |re%=1 . 1..$2 . |
00003590  53 70 61 72 65 42 69 74  73 25 20 3d 20 34 2a 38  |SpareBits% = 4*8|
000035a0  20 b8 20 5a 6f 6e 65 42  69 74 73 25 2d 5a 6f 6e  | . ZoneBits%-Zon|
000035b0  65 30 42 69 74 73 25 2d  38 2a 38 0d 18 2e 10 20  |e0Bits%-8*8.... |
000035c0  20 f2 43 61 6c 63 5a 6f  6e 65 73 0d 18 38 12 20  | .CalcZones..8. |
000035d0  20 4c 69 6e 6b 42 69 74  73 25 3d 31 35 0d 18 42  | LinkBits%=15..B|
000035e0  1a f4 20 20 52 45 50 45  41 54 20 4c 69 6e 6b 42  |..  REPEAT LinkB|
000035f0  69 74 73 25 2b 3d 31 0d  18 4c 0f 20 20 20 f2 43  |its%+=1..L.   .C|
00003600  61 6c 63 49 64 73 0d 18  56 1e f4 20 20 55 4e 54  |alcIds..V..  UNT|
00003610  49 4c 20 49 64 73 25 3c  3d 32 5e 4c 69 6e 6b 42  |IL Ids%<=2^LinkB|
00003620  69 74 73 25 0d 18 60 41  20 20 e7 20 53 70 61 72  |its%..`A  . Spar|
00003630  65 42 69 74 73 25 2d 34  2a 38 3e 30 20 80 20 53  |eBits%-4*8>0 . S|
00003640  70 61 72 65 42 69 74 73  25 2d 34 2a 38 3c 3d 4c  |pareBits%-4*8<=L|
00003650  69 6e 6b 42 69 74 73 25  20 ed 20 53 70 61 72 65  |inkBits% . Spare|
00003660  42 69 74 73 25 0d 18 6a  35 20 20 e7 20 4f 64 64  |Bits%..j5  . Odd|
00003670  42 69 74 73 25 3e 30 20  80 20 4f 64 64 42 69 74  |Bits%>0 . OddBit|
00003680  73 25 3c 3d 4c 69 6e 6b  42 69 74 73 25 20 ed 20  |s%<=LinkBits% . |
00003690  53 70 61 72 65 42 69 74  73 25 0d 18 74 23 20 20  |SpareBits%..t#  |
000036a0  e7 20 4c 69 6e 6b 42 69  74 73 25 3e 31 35 20 84  |. LinkBits%>15 .|
000036b0  20 5a 6f 6e 65 73 25 3e  31 32 37 20 8c 0d 18 7e  | Zones%>127 ...~|
000036c0  35 20 20 20 e7 20 56 65  72 62 6f 73 65 25 20 8c  |5   . Verbose% .|
000036d0  20 f2 6d 65 73 73 61 67  65 5f 70 72 69 6e 74 5f  | .message_print_|
000036e0  30 28 22 54 6f 6f 53 6d  61 6c 6c 41 6c 6c 6f 63  |0("TooSmallAlloc|
000036f0  22 29 0d 18 88 14 20 20  20 4c 6f 67 32 41 6c 6c  |")....   Log2All|
00003700  6f 63 25 2b 3d 31 0d 18  92 14 20 20 20 ed 20 44  |oc%+=1....   . D|
00003710  75 6d 6d 79 53 70 61 72  65 25 0d 18 9c 25 20 20  |ummySpare%...%  |
00003720  20 3d a3 20 20 3a f4 20  72 65 73 74 61 72 74 20  | =.  :. restart |
00003730  61 6c 6c 6f 63 20 73 69  7a 65 20 6c 6f 6f 70 0d  |alloc size loop.|
00003740  18 a6 07 20 20 cd 0d 18  b0 1e 20 20 e7 20 5a 6f  |...  .....  . Zo|
00003750  6e 65 73 25 20 3c 3d 20  42 65 73 74 5a 6f 6e 65  |nes% <= BestZone|
00003760  73 25 20 8c 0d 18 ba 39  20 20 20 43 72 75 63 69  |s% ....9   Cruci|
00003770  61 6c 25 3d a4 52 6f 75  6e 64 55 70 53 68 61 72  |al%=.RoundUpShar|
00003780  65 28 5a 6f 6e 65 73 25  2a 32 29 2a 53 65 63 53  |e(Zones%*2)*SecS|
00003790  69 7a 65 25 2b 44 69 72  53 69 7a 65 25 0d 18 c4  |ize%+DirSize%...|
000037a0  38 20 20 20 e7 20 4d 61  70 5a 6f 6e 65 25 3d 30  |8   . MapZone%=0|
000037b0  20 43 72 75 63 69 61 6c  25 3d 42 6f 6f 74 41 64  | Crucial%=BootAd|
000037c0  64 25 2a 53 65 63 53 69  7a 65 25 2b 42 6f 6f 74  |d%*SecSize%+Boot|
000037d0  53 69 7a 65 25 0d 18 ce  44 20 20 20 e7 20 43 72  |Size%...D   . Cr|
000037e0  75 63 69 61 6c 25 3c 41  6c 6c 6f 63 25 2a 28 4c  |ucial%<Alloc%*(L|
000037f0  69 6e 6b 42 69 74 73 25  2b 31 29 20 43 72 75 63  |inkBits%+1) Cruc|
00003800  69 61 6c 25 3d 41 6c 6c  6f 63 25 2a 28 4c 69 6e  |ial%=Alloc%*(Lin|
00003810  6b 42 69 74 73 25 2b 31  29 0d 18 d8 2c 20 20 20  |kBits%+1)...,   |
00003820  43 72 75 63 69 61 6c 45  6e 64 25 3d 4d 61 70 41  |CrucialEnd%=MapA|
00003830  64 64 25 2b 43 72 75 63  69 61 6c 25 2f 53 65 63  |dd%+Crucial%/Sec|
00003840  53 69 7a 65 25 0d 18 e2  35 20 20 20 64 65 66 65  |Size%...5   defe|
00003850  63 74 6c 69 73 74 25 3d  30 3a f4 20 57 65 27 72  |ctlist%=0:. We'r|
00003860  65 20 69 6e 20 74 68 65  20 66 69 72 73 74 20 64  |e in the first d|
00003870  65 66 65 63 74 20 6c 69  73 74 0d 18 ec 16 20 20  |efect list....  |
00003880  20 44 65 66 50 74 72 25  3d 44 65 66 65 63 74 25  | DefPtr%=Defect%|
00003890  0d 18 f6 08 20 20 20 f5  0d 19 00 18 20 20 20 20  |....   .....    |
000038a0  64 65 66 65 63 74 25 3d  21 44 65 66 50 74 72 25  |defect%=!DefPtr%|
000038b0  0d 19 0a 12 20 20 20 20  44 65 66 50 74 72 25 2b  |....    DefPtr%+|
000038c0  3d 34 0d 19 14 3a 20 20  20 20 e7 20 64 65 66 65  |=4...:    . defe|
000038d0  63 74 25 3e 3d 45 6e 64  44 65 66 65 63 74 25 20  |ct%>=EndDefect% |
000038e0  80 20 64 65 66 65 63 74  6c 69 73 74 25 3d 30 20  |. defectlist%=0 |
000038f0  80 20 42 69 67 44 69 73  63 25 20 8c 0d 19 1e 1c  |. BigDisc% .....|
00003900  20 20 20 20 20 20 20 20  64 65 66 65 63 74 25 3d  |        defect%=|
00003910  21 44 65 66 50 74 72 25  0d 19 28 16 20 20 20 20  |!DefPtr%..(.    |
00003920  20 20 20 20 44 65 66 50  74 72 25 2b 3d 34 0d 19  |    DefPtr%+=4..|
00003930  32 19 20 20 20 20 20 20  20 20 64 65 66 65 63 74  |2.        defect|
00003940  6c 69 73 74 25 3d 31 0d  19 3c 09 20 20 20 20 cd  |list%=1..<.    .|
00003950  0d 19 46 47 20 20 20 20  e7 20 64 65 66 65 63 74  |..FG    . defect|
00003960  6c 69 73 74 25 3d 30 20  80 20 64 65 66 65 63 74  |list%=0 . defect|
00003970  25 3c 45 6e 64 44 65 66  65 63 74 25 20 8c 20 64  |%<EndDefect% . d|
00003980  65 66 65 63 74 25 3d 64  65 66 65 63 74 25 2f 53  |efect%=defect%/S|
00003990  65 63 53 69 7a 65 25 0d  19 50 47 20 20 20 fd 20  |ecSize%..PG   . |
000039a0  64 65 66 65 63 74 25 3e  3d 45 6e 64 44 65 66 65  |defect%>=EndDefe|
000039b0  63 74 25 20 84 20 28 64  65 66 65 63 74 25 3e 3d  |ct% . (defect%>=|
000039c0  4d 61 70 41 64 64 25 20  80 20 64 65 66 65 63 74  |MapAdd% . defect|
000039d0  25 3c 43 72 75 63 69 61  6c 45 6e 64 25 29 0d 19  |%<CrucialEnd%)..|
000039e0  5a 2d 20 20 20 43 79 6c  4f 66 66 25 3d 4d 61 70  |Z-   CylOff%=Map|
000039f0  41 64 64 25 20 83 20 28  53 65 63 73 50 65 72 54  |Add% . (SecsPerT|
00003a00  72 6b 25 2a 48 65 61 64  73 25 29 0d 19 64 34 20  |rk%*Heads%)..d4 |
00003a10  20 20 e7 20 64 65 66 65  63 74 25 3e 3d 45 6e 64  |  . defect%>=End|
00003a20  44 65 66 65 63 74 25 20  80 20 43 79 6c 4f 66 66  |Defect% . CylOff|
00003a30  25 3c 42 65 73 74 43 79  6c 4f 66 66 25 20 8c 0d  |%<BestCylOff% ..|
00003a40  19 6e 1b 20 20 20 20 42  65 73 74 43 79 6c 4f 66  |.n.    BestCylOf|
00003a50  66 25 3d 43 79 6c 4f 66  66 25 0d 19 78 1f 20 20  |f%=CylOff%..x.  |
00003a60  20 20 42 65 73 74 4c 69  6e 6b 42 69 74 73 25 3d  |  BestLinkBits%=|
00003a70  4c 69 6e 6b 42 69 74 73  25 0d 19 82 1d 20 20 20  |LinkBits%....   |
00003a80  20 42 65 73 74 53 70 61  72 65 25 3d 53 70 61 72  | BestSpare%=Spar|
00003a90  65 42 69 74 73 25 0d 19  8c 19 20 20 20 20 42 65  |eBits%....    Be|
00003aa0  73 74 5a 6f 6e 65 73 25  3d 5a 6f 6e 65 73 25 0d  |stZones%=Zones%.|
00003ab0  19 96 08 20 20 20 cd 0d  19 a0 21 20 20 20 e7 20  |...   ....!   . |
00003ac0  42 65 73 74 43 79 6c 4f  66 66 25 20 ed 20 53 70  |BestCylOff% . Sp|
00003ad0  61 72 65 42 69 74 73 25  0d 19 aa 14 20 20 20 ed  |areBits%....   .|
00003ae0  20 44 75 6d 6d 79 53 70  61 72 65 25 0d 19 b4 07  | DummySpare%....|
00003af0  20 20 cc 0d 19 be 14 20  20 20 ed 20 44 75 6d 6d  |  .....   . Dumm|
00003b00  79 53 70 61 72 65 25 0d  19 c8 07 20 20 cd 0d 19  |ySpare%....  ...|
00003b10  d2 4f e7 20 42 65 73 74  5a 6f 6e 65 73 25 3d 28  |.O. BestZones%=(|
00003b20  31 3c 3c 33 30 29 20 80  20 56 65 72 62 6f 73 65  |1<<30) . Verbose|
00003b30  25 3d b9 20 8c 20 f2 6d  65 73 73 61 67 65 5f 70  |%=. . .message_p|
00003b40  72 69 6e 74 5f 30 28 22  49 6e 76 61 6c 69 64 41  |rint_0("InvalidA|
00003b50  6c 6c 6f 63 53 69 7a 65  22 29 3a 3d a3 0d 19 dc  |llocSize"):=....|
00003b60  06 3d b9 0d 19 e6 04 0d  19 f0 12 dd f2 4e 65 77  |.=...........New|
00003b70  53 74 72 75 63 74 75 72  65 0d 19 fa 13 5a 6f 6e  |Structure....Zon|
00003b80  65 30 42 69 74 73 25 3d  36 30 2a 38 0d 1a 04 18  |e0Bits%=60*8....|
00003b90  5a 6f 6e 65 42 69 74 73  25 3d 53 65 63 53 69 7a  |ZoneBits%=SecSiz|
00003ba0  65 25 2a 38 0d 1a 0e 40  4c 6f 67 32 41 6c 6c 6f  |e%*8...@Log2Allo|
00003bb0  63 25 3d 39 3a f2 53 68  61 72 65 53 69 7a 65 73  |c%=9:.ShareSizes|
00003bc0  28 4c 6f 67 32 41 6c 6c  6f 63 25 29 3a 20 f4 20  |(Log2Alloc%): . |
00003bd0  72 65 71 75 65 73 74 65  64 20 62 79 20 54 43 73  |requested by TCs|
00003be0  20 45 43 52 0d 1a 18 4a  e7 20 4c 6f 67 32 41 6c  | ECR...J. Log2Al|
00003bf0  6c 6f 63 25 3c 38 20 84  20 4c 6f 67 32 41 6c 6c  |loc%<8 . Log2All|
00003c00  6f 63 25 3e 31 32 20 8c  20 4c 6f 67 32 41 6c 6c  |oc%>12 . Log2All|
00003c10  6f 63 25 3d 31 30 3a f2  53 68 61 72 65 53 69 7a  |oc%=10:.ShareSiz|
00003c20  65 73 28 4c 6f 67 32 41  6c 6c 6f 63 25 29 0d 1a  |es(Log2Alloc%)..|
00003c30  22 22 f4 20 2a 20 63 68  65 63 6b 20 66 6f 72 20  |"". * check for |
00003c40  73 65 6e 73 69 62 6c 65  20 64 65 66 61 75 6c 74  |sensible default|
00003c50  0d 1a 2c 27 41 6c 6c 6f  63 25 3d 32 5e 4c 6f 67  |..,'Alloc%=2^Log|
00003c60  32 41 6c 6c 6f 63 25 3a  4c 6f 67 25 3d 4c 6f 67  |2Alloc%:Log%=Log|
00003c70  32 41 6c 6c 6f 63 25 0d  1a 36 14 c8 95 20 a4 64  |2Alloc%..6... .d|
00003c80  6f 61 6c 6c 6f 63 28 a3  29 3d a3 0d 1a 40 29 20  |oalloc(.)=...@) |
00003c90  20 41 6c 6c 6f 63 25 3d  32 5e 4c 6f 67 32 41 6c  | Alloc%=2^Log2Al|
00003ca0  6c 6f 63 25 3a 4c 6f 67  25 3d 4c 6f 67 32 41 6c  |loc%:Log%=Log2Al|
00003cb0  6c 6f 63 25 0d 1a 4a 05  ce 0d 1a 54 05 f1 0d 1a  |loc%..J....T....|
00003cc0  5e 25 f4 52 45 50 45 41  54 3a 20 52 45 4d 20 61  |^%.REPEAT: REM a|
00003cd0  6c 6c 6f 63 61 74 69 6f  6e 20 73 69 7a 65 20 6c  |llocation size l|
00003ce0  6f 6f 70 0d 1a 68 33 f4  20 41 6c 6c 6f 63 25 3d  |oop..h3. Alloc%=|
00003cf0  46 4e 41 73 6b 28 22 41  6c 6c 6f 63 55 6e 69 74  |FNAsk("AllocUnit|
00003d00  41 73 6b 22 2c 32 5e 4c  6f 67 32 41 6c 6c 6f 63  |Ask",2^Log2Alloc|
00003d10  25 2c 32 35 36 29 0d 1a  72 0c f4 20 4c 6f 67 25  |%,256)..r.. Log%|
00003d20  3d 37 0d 1a 7c 0c f4 20  52 45 50 45 41 54 0d 1a  |=7..|.. REPEAT..|
00003d30  86 0e f4 20 20 4c 6f 67  25 2b 3d 31 0d 1a 90 24  |...  Log%+=1...$|
00003d40  f4 20 55 4e 54 49 4c 20  41 6c 6c 6f 63 25 3d 32  |. UNTIL Alloc%=2|
00003d50  5e 4c 6f 67 25 20 4f 52  20 4c 6f 67 25 3d 31 33  |^Log% OR Log%=13|
00003d60  0d 1a 9a 38 f4 20 49 46  20 4c 6f 67 25 3d 31 33  |...8. IF Log%=13|
00003d70  20 55 4e 54 49 4c 20 46  41 4c 53 45 3a 52 45 4d  | UNTIL FALSE:REM|
00003d80  20 72 65 73 74 61 72 74  20 61 6c 6c 6f 63 20 73  | restart alloc s|
00003d90  69 7a 65 20 6c 6f 6f 70  0d 1a a4 1a f4 55 4e 54  |ize loop.....UNT|
00003da0  49 4c 20 46 4e 64 6f 61  6c 6c 6f 63 28 54 52 55  |IL FNdoalloc(TRU|
00003db0  45 29 0d 1a ae 22 f2 65  72 72 6f 72 62 6f 78 28  |E)...".errorbox(|
00003dc0  22 41 6c 6c 6f 63 3a 20  26 22 2b c3 7e 41 6c 6c  |"Alloc: &"+.~All|
00003dd0  6f 63 25 29 0d 1a b8 29  f2 65 72 72 6f 72 62 6f  |oc%)...).errorbo|
00003de0  78 28 22 53 68 61 72 65  53 69 7a 65 3a 20 26 22  |x("ShareSize: &"|
00003df0  2b c3 53 68 61 72 65 53  69 7a 65 25 29 0d 1a c2  |+.ShareSize%)...|
00003e00  39 f2 65 72 72 6f 72 62  6f 78 28 22 53 69 7a 65  |9.errorbox("Size|
00003e10  20 6f 66 20 44 69 73 63  3a 20 26 22 2b c3 7e 44  | of Disc: &"+.~D|
00003e20  69 73 63 53 69 7a 65 32  25 2b c3 7e 44 69 73 63  |iscSize2%+.~Disc|
00003e30  53 69 7a 65 25 29 0d 1a  cc 05 f1 0d 1a d6 1b 4c  |Size%).........L|
00003e40  69 6e 6b 42 69 74 73 25  3d 42 65 73 74 4c 69 6e  |inkBits%=BestLin|
00003e50  6b 42 69 74 73 25 0d 1a  e0 19 53 70 61 72 65 42  |kBits%....SpareB|
00003e60  69 74 73 25 3d 42 65 73  74 53 70 61 72 65 25 0d  |its%=BestSpare%.|
00003e70  1a ea 0e f2 43 61 6c 63  5a 6f 6e 65 73 0d 1a f4  |....CalcZones...|
00003e80  0c f2 43 61 6c 63 49 64  73 0d 1a fe 36 43 72 75  |..CalcIds...6Cru|
00003e90  63 69 61 6c 25 3d a4 52  6f 75 6e 64 55 70 53 68  |cial%=.RoundUpSh|
00003ea0  61 72 65 28 5a 6f 6e 65  73 25 2a 32 29 2a 53 65  |are(Zones%*2)*Se|
00003eb0  63 53 69 7a 65 25 2b 44  69 72 53 69 7a 65 25 0d  |cSize%+DirSize%.|
00003ec0  1b 08 35 e7 20 4d 61 70  5a 6f 6e 65 25 3d 30 20  |..5. MapZone%=0 |
00003ed0  43 72 75 63 69 61 6c 25  3d 42 6f 6f 74 41 64 64  |Crucial%=BootAdd|
00003ee0  25 2a 53 65 63 53 69 7a  65 25 2b 42 6f 6f 74 53  |%*SecSize%+BootS|
00003ef0  69 7a 65 25 0d 1b 12 41  e7 20 43 72 75 63 69 61  |ize%...A. Crucia|
00003f00  6c 25 3c 41 6c 6c 6f 63  25 2a 28 4c 69 6e 6b 42  |l%<Alloc%*(LinkB|
00003f10  69 74 73 25 2b 31 29 20  43 72 75 63 69 61 6c 25  |its%+1) Crucial%|
00003f20  3d 41 6c 6c 6f 63 25 2a  28 4c 69 6e 6b 42 69 74  |=Alloc%*(LinkBit|
00003f30  73 25 2b 31 29 0d 1b 1c  3d e7 20 43 72 75 63 69  |s%+1)...=. Cruci|
00003f40  61 6c 25 20 83 20 41 6c  6c 6f 63 25 3c 3e 30 20  |al% . Alloc%<>0 |
00003f50  43 72 75 63 69 61 6c 25  2b 3d 41 6c 6c 6f 63 25  |Crucial%+=Alloc%|
00003f60  2d 43 72 75 63 69 61 6c  25 20 83 20 41 6c 6c 6f  |-Crucial% . Allo|
00003f70  63 25 0d 1b 26 12 e7 20  4d 61 70 5a 6f 6e 65 25  |c%..&.. MapZone%|
00003f80  3d 30 20 8c 0d 1b 30 2c  20 52 6f 6f 74 44 69 72  |=0 ...0, RootDir|
00003f90  41 64 64 25 3d 42 6f 6f  74 41 64 64 25 2b 42 6f  |Add%=BootAdd%+Bo|
00003fa0  6f 74 53 69 7a 65 25 2f  53 65 63 53 69 7a 65 25  |otSize%/SecSize%|
00003fb0  0d 1b 3a 47 20 49 6e 64  52 6f 6f 74 44 69 72 41  |..:G IndRootDirA|
00003fc0  64 64 25 3d 26 32 30 30  20 2b 20 28 42 6f 6f 74  |dd%=&200 + (Boot|
00003fd0  41 64 64 25 2a 53 65 63  53 69 7a 65 25 2b 42 6f  |Add%*SecSize%+Bo|
00003fe0  6f 74 53 69 7a 65 25 29  20 81 20 53 65 63 53 69  |otSize%) . SecSi|
00003ff0  7a 65 25 20 2b 20 31 0d  1b 44 05 cc 0d 1b 4e 3c  |ze% + 1..D....N<|
00004000  20 52 6f 6f 74 44 69 72  41 64 64 25 3d 4d 61 70  | RootDirAdd%=Map|
00004010  41 64 64 25 2b a4 52 6f  75 6e 64 55 70 53 68 61  |Add%+.RoundUpSha|
00004020  72 65 28 28 4d 61 70 4c  65 6e 25 2a 32 29 2f 53  |re((MapLen%*2)/S|
00004030  65 63 53 69 7a 65 25 29  0d 1b 58 3d 20 49 6e 64  |ecSize%)..X= Ind|
00004040  52 6f 6f 74 44 69 72 41  64 64 25 3d 26 32 30 30  |RootDirAdd%=&200|
00004050  2b a4 52 6f 75 6e 64 55  70 53 68 61 72 65 28 5a  |+.RoundUpShare(Z|
00004060  6f 6e 65 73 25 2a 32 29  2f 53 68 61 72 65 53 69  |ones%*2)/ShareSi|
00004070  7a 65 25 2b 31 0d 1b 62  05 cd 0d 1b 63 31 f2 65  |ze%+1..b....c1.e|
00004080  72 72 6f 72 62 6f 78 28  22 49 6e 64 52 6f 6f 74  |rrorbox("IndRoot|
00004090  44 69 72 41 64 64 25 20  22 2b c3 7e 49 6e 64 52  |DirAdd% "+.~IndR|
000040a0  6f 6f 74 44 69 72 41 64  64 25 29 0d 1b 6c 18 44  |ootDirAdd%)..l.D|
000040b0  69 73 63 52 65 63 25 3f  34 3d 4c 69 6e 6b 42 69  |iscRec%?4=LinkBi|
000040c0  74 73 25 0d 1b 76 19 44  69 73 63 52 65 63 25 3f  |ts%..v.DiscRec%?|
000040d0  35 3d 4c 6f 67 32 41 6c  6c 6f 63 25 0d 1b 80 1a  |5=Log2Alloc%....|
000040e0  f4 44 69 73 63 52 65 63  25 3f 38 3d 4c 6f 77 53  |.DiscRec%?8=LowS|
000040f0  65 63 74 6f 72 25 0d 1b  8a 15 44 69 73 63 52 65  |ector%....DiscRe|
00004100  63 25 3f 39 3d 5a 6f 6e  65 73 25 0d 1b 94 20 44  |c%?9=Zones%... D|
00004110  69 73 63 52 65 63 25 3f  26 41 3d 53 70 61 72 65  |iscRec%?&A=Spare|
00004120  42 69 74 73 25 20 83 20  32 35 36 0d 1b 9e 20 44  |Bits% . 256... D|
00004130  69 73 63 52 65 63 25 3f  26 42 3d 53 70 61 72 65  |iscRec%?&B=Spare|
00004140  42 69 74 73 25 20 81 20  32 35 36 0d 1b a8 1e 44  |Bits% . 256....D|
00004150  69 73 63 52 65 63 25 21  26 43 3d 49 6e 64 52 6f  |iscRec%!&C=IndRo|
00004160  6f 74 44 69 72 41 64 64  25 0d 1b b2 1b 44 69 73  |otDirAdd%....Dis|
00004170  63 52 65 63 25 21 26 32  34 3d 44 69 73 63 53 69  |cRec%!&24=DiscSi|
00004180  7a 65 32 25 0d 1b bc 1f  44 69 73 63 52 65 63 25  |ze2%....DiscRec%|
00004190  21 26 32 38 3d 4c 6f 67  32 53 68 61 72 65 53 69  |!&28=Log2ShareSi|
000041a0  7a 65 25 0d 1b c6 19 42  6f 6f 74 52 65 63 25 21  |ze%....BootRec%!|
000041b0  30 3d 44 69 73 63 52 65  63 25 21 30 0d 1b d0 19  |0=DiscRec%!0....|
000041c0  42 6f 6f 74 52 65 63 25  21 34 3d 44 69 73 63 52  |BootRec%!4=DiscR|
000041d0  65 63 25 21 34 0d 1b da  19 42 6f 6f 74 52 65 63  |ec%!4....BootRec|
000041e0  25 21 38 3d 44 69 73 63  52 65 63 25 21 38 0d 1b  |%!8=DiscRec%!8..|
000041f0  e4 1b 42 6f 6f 74 52 65  63 25 21 26 43 3d 44 69  |..BootRec%!&C=Di|
00004200  73 63 52 65 63 25 21 26  43 0d 1b ee 1d 42 6f 6f  |scRec%!&C....Boo|
00004210  74 52 65 63 25 21 26 31  30 3d 44 69 73 63 52 65  |tRec%!&10=DiscRe|
00004220  63 25 21 26 31 30 0d 1b  f8 1d 42 6f 6f 74 52 65  |c%!&10....BootRe|
00004230  63 25 21 26 31 34 3d 44  69 73 63 52 65 63 25 21  |c%!&14=DiscRec%!|
00004240  26 31 34 0d 1c 02 1d 42  6f 6f 74 52 65 63 25 21  |&14....BootRec%!|
00004250  26 32 34 3d 44 69 73 63  52 65 63 25 21 26 32 34  |&24=DiscRec%!&24|
00004260  0d 1c 0c 1d 42 6f 6f 74  52 65 63 25 21 26 32 38  |....BootRec%!&28|
00004270  3d 44 69 73 63 52 65 63  25 21 26 32 38 0d 1c 16  |=DiscRec%!&28...|
00004280  22 e3 20 49 25 3d 30 20  b8 20 5a 6f 6e 65 73 25  |". I%=0 . Zones%|
00004290  2a 53 65 63 53 69 7a 65  25 2d 34 20 88 20 34 0d  |*SecSize%-4 . 4.|
000042a0  1c 20 0e 20 42 75 66 25  21 49 25 3d 30 0d 1c 2a  |. . Buf%!I%=0..*|
000042b0  08 ed 20 49 25 0d 1c 34  15 e3 20 49 25 3d 30 20  |.. I%..4.. I%=0 |
000042c0  b8 20 36 30 2d 34 20 88  20 34 0d 1c 3e 1c 20 42  |. 60-4 . 4..>. B|
000042d0  75 66 25 21 28 49 25 2b  34 29 3d 44 69 73 63 52  |uf%!(I%+4)=DiscR|
000042e0  65 63 25 21 49 25 0d 1c  48 08 ed 20 49 25 0d 1c  |ec%!I%..H.. I%..|
000042f0  52 14 f2 57 72 69 74 65  44 65 66 65 63 74 4c 69  |R..WriteDefectLi|
00004300  73 74 0d 1c 5c 27 f4 50  52 4f 43 6d 65 73 73 61  |st..\'.PROCmessa|
00004310  67 65 5f 70 72 69 6e 74  5f 30 28 22 43 72 65 61  |ge_print_0("Crea|
00004320  74 69 6e 67 4d 61 70 22  29 0d 1c 66 0a 70 74 72  |tingMap")..f.ptr|
00004330  25 3d 30 0d 1c 70 12 44  65 66 65 63 74 53 74 61  |%=0..p.DefectSta|
00004340  72 74 25 3d 30 0d 1c 7a  11 64 65 66 65 63 74 6c  |rt%=0..z.defectl|
00004350  69 73 74 25 3d 30 0d 1c  84 2b 44 69 73 63 45 6e  |ist%=0...+DiscEn|
00004360  64 42 69 74 25 3d a4 44  69 73 63 54 6f 4d 61 70  |dBit%=.DiscToMap|
00004370  28 53 65 63 74 6f 72 73  50 65 72 44 69 73 63 25  |(SectorsPerDisc%|
00004380  29 0d 1c 8e 13 5a 6f 6e  65 53 74 61 72 74 25 3d  |)....ZoneStart%=|
00004390  42 75 66 25 0d 1c 98 13  5a 6f 6e 65 53 74 61 72  |Buf%....ZoneStar|
000043a0  74 42 69 74 25 3d 30 0d  1c a2 18 e3 20 7a 6f 6e  |tBit%=0..... zon|
000043b0  65 25 3d 30 20 b8 20 5a  6f 6e 65 73 25 2d 31 0d  |e%=0 . Zones%-1.|
000043c0  1c ac 24 20 21 5a 6f 6e  65 53 74 61 72 74 25 3d  |..$ !ZoneStart%=|
000043d0  31 3c 3c 28 31 35 2b 46  72 65 65 4c 69 6e 6b 25  |1<<(15+FreeLink%|
000043e0  2a 38 29 0d 1c b6 28 20  5a 6f 6e 65 45 6e 64 42  |*8)...( ZoneEndB|
000043f0  69 74 25 3d 5a 6f 6e 65  53 74 61 72 74 42 69 74  |it%=ZoneStartBit|
00004400  25 2b 5a 6f 6e 65 42 69  74 73 25 0d 1c c0 2f 20  |%+ZoneBits%.../ |
00004410  55 73 65 64 5a 6f 6e 65  45 6e 64 42 69 74 25 3d  |UsedZoneEndBit%=|
00004420  5a 6f 6e 65 45 6e 64 42  69 74 25 2d 53 70 61 72  |ZoneEndBit%-Spar|
00004430  65 42 69 74 73 25 2b 34  2a 38 0d 1c ca 24 20 e7  |eBits%+4*8...$ .|
00004440  20 55 73 65 64 5a 6f 6e  65 45 6e 64 42 69 74 25  | UsedZoneEndBit%|
00004450  3e 44 69 73 63 45 6e 64  42 69 74 25 20 8c 0d 1c  |>DiscEndBit% ...|
00004460  d4 21 20 20 55 73 65 64  5a 6f 6e 65 45 6e 64 42  |.!  UsedZoneEndB|
00004470  69 74 25 3d 44 69 73 63  45 6e 64 42 69 74 25 0d  |it%=DiscEndBit%.|
00004480  1c de 06 20 cd 0d 1c e8  27 20 50 72 65 46 72 65  |... ....' PreFre|
00004490  65 25 3d 5a 6f 6e 65 53  74 61 72 74 42 69 74 25  |e%=ZoneStartBit%|
000044a0  2b 46 72 65 65 4c 69 6e  6b 25 2a 38 0d 1c f2 1f  |+FreeLink%*8....|
000044b0  20 5a 6f 6e 65 42 69 74  25 3d 5a 6f 6e 65 53 74  | ZoneBit%=ZoneSt|
000044c0  61 72 74 42 69 74 25 2b  34 2a 38 0d 1c fc 10 20  |artBit%+4*8.... |
000044d0  e7 20 7a 6f 6e 65 25 3d  30 20 8c 0d 1d 06 22 20  |. zone%=0 ...." |
000044e0  20 5a 6f 6e 65 42 69 74  25 3d 5a 6f 6e 65 42 69  | ZoneBit%=ZoneBi|
000044f0  74 25 2b 5a 6f 6e 65 30  42 69 74 73 25 0d 1d 10  |t%+Zone0Bits%...|
00004500  34 20 20 6c 65 6e 67 74  68 25 3d 28 42 6f 6f 74  |4  length%=(Boot|
00004510  41 64 64 25 2a 53 65 63  53 69 7a 65 25 2b 42 6f  |Add%*SecSize%+Bo|
00004520  6f 74 53 69 7a 65 25 29  20 81 20 41 6c 6c 6f 63  |otSize%) . Alloc|
00004530  25 0d 1d 1a 2f 20 20 e7  20 6c 65 6e 67 74 68 25  |%.../  . length%|
00004540  3c 4c 69 6e 6b 42 69 74  73 25 2b 31 20 6c 65 6e  |<LinkBits%+1 len|
00004550  67 74 68 25 3d 4c 69 6e  6b 42 69 74 73 25 2b 31  |gth%=LinkBits%+1|
00004560  0d 1d 24 1c 20 20 f2 57  72 69 74 65 4c 69 6e 6b  |..$.  .WriteLink|
00004570  28 5a 6f 6e 65 42 69 74  25 2c 32 29 0d 1d 2e 24  |(ZoneBit%,2)...$|
00004580  20 20 f2 57 72 69 74 65  4c 65 6e 67 74 68 28 5a  |  .WriteLength(Z|
00004590  6f 6e 65 42 69 74 25 2c  6c 65 6e 67 74 68 25 29  |oneBit%,length%)|
000045a0  0d 1d 38 1f 20 20 5a 6f  6e 65 42 69 74 25 3d 5a  |..8.  ZoneBit%=Z|
000045b0  6f 6e 65 42 69 74 25 2b  6c 65 6e 67 74 68 25 0d  |oneBit%+length%.|
000045c0  1d 42 06 20 cc 0d 1d 4c  18 20 20 e7 20 7a 6f 6e  |.B. ...L.  . zon|
000045d0  65 25 3d 4d 61 70 5a 6f  6e 65 25 20 8c 0d 1d 56  |e%=MapZone% ...V|
000045e0  20 20 20 20 6c 65 6e 67  74 68 25 3d 43 72 75 63  |    length%=Cruc|
000045f0  69 61 6c 25 20 81 20 41  6c 6c 6f 63 25 0d 1d 60  |ial% . Alloc%..`|
00004600  1d 20 20 20 f2 57 72 69  74 65 4c 69 6e 6b 28 5a  |.   .WriteLink(Z|
00004610  6f 6e 65 42 69 74 25 2c  32 29 0d 1d 6a 25 20 20  |oneBit%,2)..j%  |
00004620  20 f2 57 72 69 74 65 4c  65 6e 67 74 68 28 5a 6f  | .WriteLength(Zo|
00004630  6e 65 42 69 74 25 2c 6c  65 6e 67 74 68 25 29 0d  |neBit%,length%).|
00004640  1d 74 20 20 20 20 5a 6f  6e 65 42 69 74 25 3d 5a  |.t    ZoneBit%=Z|
00004650  6f 6e 65 42 69 74 25 2b  6c 65 6e 67 74 68 25 0d  |oneBit%+length%.|
00004660  1d 7e 07 20 20 cd 0d 1d  88 06 20 cd 0d 1d 92 06  |.~.  ..... .....|
00004670  20 f5 0d 1d 9c 1f 20 20  e7 20 5a 6f 6e 65 42 69  | .....  . ZoneBi|
00004680  74 25 3e 44 65 66 65 63  74 53 74 61 72 74 25 20  |t%>DefectStart% |
00004690  8c 0d 1d a6 18 20 20 20  e7 20 64 65 66 65 63 74  |.....   . defect|
000046a0  6c 69 73 74 25 3d 30 20  8c 0d 1d b0 27 20 20 20  |list%=0 ....'   |
000046b0  20 20 20 20 e7 20 44 65  66 65 63 74 25 21 70 74  |    . Defect%!pt|
000046c0  72 25 3e 3d 45 6e 64 44  65 66 65 63 74 25 20 8c  |r%>=EndDefect% .|
000046d0  0d 1d ba 16 20 20 20 20  20 20 20 20 20 20 20 70  |....           p|
000046e0  74 72 25 2b 3d 34 0d 1d  c4 1c 20 20 20 20 20 20  |tr%+=4....      |
000046f0  20 20 20 20 20 64 65 66  65 63 74 6c 69 73 74 25  |     defectlist%|
00004700  3d 31 0d 1d ce 34 20 20  20 20 20 20 20 20 20 20  |=1...4          |
00004710  20 44 65 66 65 63 74 53  74 61 72 74 25 3d a4 44  | DefectStart%=.D|
00004720  69 73 63 54 6f 4d 61 70  28 44 65 66 65 63 74 25  |iscToMap(Defect%|
00004730  21 70 74 72 25 29 0d 1d  d8 0c 20 20 20 20 20 20  |!ptr%)....      |
00004740  20 cc 0d 1d e2 3f 20 20  20 20 20 20 20 20 20 20  | ....?          |
00004750  20 44 65 66 65 63 74 53  74 61 72 74 25 3d a4 44  | DefectStart%=.D|
00004760  69 73 63 54 6f 4d 61 70  28 28 44 65 66 65 63 74  |iscToMap((Defect|
00004770  25 21 70 74 72 25 29 2f  53 65 63 53 69 7a 65 25  |%!ptr%)/SecSize%|
00004780  29 0d 1d ec 0c 20 20 20  20 20 20 20 cd 0d 1d f6  |)....       ....|
00004790  08 20 20 20 cc 0d 1e 00  30 20 20 20 20 20 20 20  |.   ....0       |
000047a0  44 65 66 65 63 74 53 74  61 72 74 25 3d a4 44 69  |DefectStart%=.Di|
000047b0  73 63 54 6f 4d 61 70 28  44 65 66 65 63 74 25 21  |scToMap(Defect%!|
000047c0  70 74 72 25 29 0d 1e 0a  08 20 20 20 cd 0d 1e 14  |ptr%)....   ....|
000047d0  28 20 20 20 e7 20 44 65  66 65 63 74 53 74 61 72  |(   . DefectStar|
000047e0  74 25 3e 3d 55 73 65 64  5a 6f 6e 65 45 6e 64 42  |t%>=UsedZoneEndB|
000047f0  69 74 25 20 8c 0d 1e 1e  20 20 20 20 20 44 65 66  |it% ....     Def|
00004800  65 63 74 53 74 61 72 74  25 3d 5a 6f 6e 65 45 6e  |ectStart%=ZoneEn|
00004810  64 42 69 74 25 0d 1e 28  08 20 20 20 cc 0d 1e 32  |dBit%..(.   ...2|
00004820  21 20 20 20 20 44 65 66  65 63 74 45 6e 64 25 3d  |!    DefectEnd%=|
00004830  44 65 66 65 63 74 53 74  61 72 74 25 2b 31 0d 1e  |DefectStart%+1..|
00004840  3c 0f 20 20 20 20 70 74  72 25 2b 3d 34 0d 1e 46  |<.    ptr%+=4..F|
00004850  09 20 20 20 20 f5 0d 1e  50 11 20 20 20 20 20 64  |.    ...P.     d|
00004860  6f 6e 65 31 25 3d b9 0d  1e 5a 0a 20 20 20 20 20  |one1%=...Z.     |
00004870  f5 0d 1e 64 12 20 20 20  20 20 20 64 6f 6e 65 32  |...d.      done2|
00004880  25 3d b9 0d 1e 6e 1b 20  20 20 20 20 20 e7 20 64  |%=...n.      . d|
00004890  65 66 65 63 74 6c 69 73  74 25 3d 31 20 8c 0d 1e  |efectlist%=1 ...|
000048a0  78 32 20 20 20 20 20 20  20 20 20 20 4e 65 78 74  |x2          Next|
000048b0  44 65 66 65 63 74 25 3d  a4 44 69 73 63 54 6f 4d  |Defect%=.DiscToM|
000048c0  61 70 28 44 65 66 65 63  74 25 21 70 74 72 25 29  |ap(Defect%!ptr%)|
000048d0  0d 1e 82 0b 20 20 20 20  20 20 cc 0d 1e 8c 3d 20  |....      ....= |
000048e0  20 20 20 20 20 20 20 20  20 4e 65 78 74 44 65 66  |         NextDef|
000048f0  65 63 74 25 3d a4 44 69  73 63 54 6f 4d 61 70 28  |ect%=.DiscToMap(|
00004900  28 44 65 66 65 63 74 25  21 70 74 72 25 29 2f 53  |(Defect%!ptr%)/S|
00004910  65 63 53 69 7a 65 25 29  0d 1e 96 0b 20 20 20 20  |ecSize%)....    |
00004920  20 20 cd 0d 1e a0 29 20  20 20 20 20 20 e7 20 4e  |  ....)      . N|
00004930  65 78 74 44 65 66 65 63  74 25 3c 55 73 65 64 5a  |extDefect%<UsedZ|
00004940  6f 6e 65 45 6e 64 42 69  74 25 20 8c 0d 1e aa 34  |oneEndBit% ....4|
00004950  20 20 20 20 20 20 20 e7  20 4e 65 78 74 44 65 66  |       . NextDef|
00004960  65 63 74 25 3e 5a 6f 6e  65 45 6e 64 42 69 74 25  |ect%>ZoneEndBit%|
00004970  2d 28 4c 69 6e 6b 42 69  74 73 25 2b 31 29 20 8c  |-(LinkBits%+1) .|
00004980  0d 1e b4 2e 20 20 20 20  20 20 20 20 4e 65 78 74  |....        Next|
00004990  44 65 66 25 3d 5a 6f 6e  65 45 6e 64 42 69 74 25  |Def%=ZoneEndBit%|
000049a0  2d 28 4c 69 6e 6b 42 69  74 73 25 2b 31 29 0d 1e  |-(LinkBits%+1)..|
000049b0  be 0c 20 20 20 20 20 20  20 cc 0d 1e c8 20 20 20  |..       ....   |
000049c0  20 20 20 20 20 20 4e 65  78 74 44 65 66 25 3d 4e  |      NextDef%=N|
000049d0  65 78 74 44 65 66 65 63  74 25 0d 1e d2 0c 20 20  |extDefect%....  |
000049e0  20 20 20 20 20 cd 0d 1e  dc 2e 20 20 20 20 20 20  |     .....      |
000049f0  20 e7 20 4e 65 78 74 44  65 66 25 2d 44 65 66 65  | . NextDef%-Defe|
00004a00  63 74 45 6e 64 25 3c 4c  69 6e 6b 42 69 74 73 25  |ctEnd%<LinkBits%|
00004a10  2b 31 20 8c 0d 1e e6 28  20 20 20 20 20 20 20 20  |+1 ....(        |
00004a20  e7 20 4e 65 78 74 44 65  66 65 63 74 25 2b 31 3e  |. NextDefect%+1>|
00004a30  44 65 66 65 63 74 45 6e  64 25 20 8c 0d 1e f0 25  |DefectEnd% ....%|
00004a40  20 20 20 20 20 20 20 20  20 44 65 66 65 63 74 45  |         DefectE|
00004a50  6e 64 25 3d 4e 65 78 74  44 65 66 65 63 74 25 2b  |nd%=NextDefect%+|
00004a60  31 0d 1e fa 0d 20 20 20  20 20 20 20 20 cd 0d 1f  |1....        ...|
00004a70  04 13 20 20 20 20 20 20  20 20 70 74 72 25 2b 3d  |..        ptr%+=|
00004a80  34 0d 1f 0e 14 20 20 20  20 20 20 20 20 64 6f 6e  |4....        don|
00004a90  65 32 25 3d a3 0d 1f 18  0c 20 20 20 20 20 20 20  |e2%=.....       |
00004aa0  cd 0d 1f 22 0b 20 20 20  20 20 20 cd 0d 1f 2c 11  |...".      ...,.|
00004ab0  20 20 20 20 20 fd 20 64  6f 6e 65 32 25 0d 1f 36  |     . done2%..6|
00004ac0  30 20 20 20 20 20 e7 20  44 65 66 65 63 74 45 6e  |0     . DefectEn|
00004ad0  64 25 2d 44 65 66 65 63  74 53 74 61 72 74 25 3c  |d%-DefectStart%<|
00004ae0  4c 69 6e 6b 42 69 74 73  25 2b 31 20 8c 0d 1f 40  |LinkBits%+1 ...@|
00004af0  2d 20 20 20 20 20 20 44  65 66 65 63 74 45 6e 64  |-      DefectEnd|
00004b00  25 3d 44 65 66 65 63 74  53 74 61 72 74 25 2b 4c  |%=DefectStart%+L|
00004b10  69 6e 6b 42 69 74 73 25  2b 31 0d 1f 4a 24 20 20  |inkBits%+1..J$  |
00004b20  20 20 20 20 e7 20 44 65  66 65 63 74 45 6e 64 25  |    . DefectEnd%|
00004b30  3e 5a 6f 6e 65 45 6e 64  42 69 74 25 20 8c 0d 1f  |>ZoneEndBit% ...|
00004b40  54 21 20 20 20 20 20 20  20 44 65 66 65 63 74 45  |T!       DefectE|
00004b50  6e 64 25 3d 5a 6f 6e 65  45 6e 64 42 69 74 25 0d  |nd%=ZoneEndBit%.|
00004b60  1f 5e 0b 20 20 20 20 20  20 cd 0d 1f 68 12 20 20  |.^.      ...h.  |
00004b70  20 20 20 20 64 6f 6e 65  31 25 3d a3 0d 1f 72 0a  |    done1%=...r.|
00004b80  20 20 20 20 20 cd 0d 1f  7c 4b 20 20 20 20 20 e7  |     ...|K     .|
00004b90  20 44 65 66 65 63 74 45  6e 64 25 3e 5a 6f 6e 65  | DefectEnd%>Zone|
00004ba0  45 6e 64 42 69 74 25 2d  28 4c 69 6e 6b 42 69 74  |EndBit%-(LinkBit|
00004bb0  73 25 2b 31 29 20 80 20  44 65 66 65 63 74 45 6e  |s%+1) . DefectEn|
00004bc0  64 25 3c 3e 5a 6f 6e 65  45 6e 64 42 69 74 25 20  |d%<>ZoneEndBit% |
00004bd0  8c 0d 1f 86 20 20 20 20  20 20 20 44 65 66 65 63  |....       Defec|
00004be0  74 45 6e 64 25 3d 5a 6f  6e 65 45 6e 64 42 69 74  |tEnd%=ZoneEndBit|
00004bf0  25 0d 1f 90 12 20 20 20  20 20 20 64 6f 6e 65 31  |%....      done1|
00004c00  25 3d a3 0d 1f 9a 0a 20  20 20 20 20 cd 0d 1f a4  |%=.....     ....|
00004c10  30 20 20 20 20 20 e7 20  44 65 66 65 63 74 45 6e  |0     . DefectEn|
00004c20  64 25 2d 44 65 66 65 63  74 53 74 61 72 74 25 3c  |d%-DefectStart%<|
00004c30  4c 69 6e 6b 42 69 74 73  25 2b 31 20 8c 0d 1f ae  |LinkBits%+1 ....|
00004c40  2f 20 20 20 20 20 20 44  65 66 65 63 74 53 74 61  |/      DefectSta|
00004c50  72 74 25 3d 44 65 66 65  63 74 45 6e 64 25 2d 28  |rt%=DefectEnd%-(|
00004c60  4c 69 6e 6b 42 69 74 73  25 2b 31 29 0d 1f b8 0a  |LinkBits%+1)....|
00004c70  20 20 20 20 20 cd 0d 1f  c2 10 20 20 20 20 fd 20  |     .....    . |
00004c80  64 6f 6e 65 31 25 0d 1f  cc 08 20 20 20 cd 0d 1f  |done1%....   ...|
00004c90  d6 07 20 20 cd 0d 1f e0  40 20 20 e7 20 5a 6f 6e  |..  ....@  . Zon|
00004ca0  65 42 69 74 25 3e 44 65  66 65 63 74 53 74 61 72  |eBit%>DefectStar|
00004cb0  74 25 20 f2 6d 65 73 73  61 67 65 5f 70 72 69 6e  |t% .message_prin|
00004cc0  74 5f 30 28 22 45 52 52  4f 52 31 22 29 3a f2 66  |t_0("ERROR1"):.f|
00004cd0  69 6e 69 73 68 0d 1f ea  42 20 20 e7 20 44 65 66  |inish...B  . Def|
00004ce0  65 63 74 53 74 61 72 74  25 2d 5a 6f 6e 65 42 69  |ectStart%-ZoneBi|
00004cf0  74 25 20 3c 3d 20 4c 69  6e 6b 42 69 74 73 25 20  |t% <= LinkBits% |
00004d00  8c 20 44 65 66 65 63 74  53 74 61 72 74 25 3d 5a  |. DefectStart%=Z|
00004d10  6f 6e 65 42 69 74 25 0d  1f f4 1f 20 20 e7 20 44  |oneBit%....  . D|
00004d20  65 66 65 63 74 53 74 61  72 74 25 3e 5a 6f 6e 65  |efectStart%>Zone|
00004d30  42 69 74 25 20 8c 0d 1f  fe 2d 20 20 20 f2 57 72  |Bit% ....-   .Wr|
00004d40  69 74 65 4c 69 6e 6b 28  50 72 65 46 72 65 65 25  |iteLink(PreFree%|
00004d50  2c 5a 6f 6e 65 42 69 74  25 2d 50 72 65 46 72 65  |,ZoneBit%-PreFre|
00004d60  65 25 29 0d 20 08 28 20  20 20 e7 20 44 65 66 65  |e%). .(   . Defe|
00004d70  63 74 53 74 61 72 74 25  3e 3d 55 73 65 64 5a 6f  |ctStart%>=UsedZo|
00004d80  6e 65 45 6e 64 42 69 74  25 20 8c 0d 20 12 37 20  |neEndBit% .. .7 |
00004d90  20 20 20 f2 57 72 69 74  65 4c 65 6e 67 74 68 28  |   .WriteLength(|
00004da0  5a 6f 6e 65 42 69 74 25  2c 55 73 65 64 5a 6f 6e  |ZoneBit%,UsedZon|
00004db0  65 45 6e 64 42 69 74 25  2d 5a 6f 6e 65 42 69 74  |eEndBit%-ZoneBit|
00004dc0  25 29 0d 20 1c 27 20 20  20 20 e7 20 5a 6f 6e 65  |%). .'    . Zone|
00004dd0  45 6e 64 42 69 74 25 3e  55 73 65 64 5a 6f 6e 65  |EndBit%>UsedZone|
00004de0  45 6e 64 42 69 74 25 20  8c 0d 20 26 26 20 20 20  |EndBit% .. &&   |
00004df0  20 20 f2 57 72 69 74 65  4c 69 6e 6b 28 55 73 65  |  .WriteLink(Use|
00004e00  64 5a 6f 6e 65 45 6e 64  42 69 74 25 2c 31 29 0d  |dZoneEndBit%,1).|
00004e10  20 30 42 20 20 20 20 20  f2 57 72 69 74 65 4c 65  | 0B     .WriteLe|
00004e20  6e 67 74 68 28 55 73 65  64 5a 6f 6e 65 45 6e 64  |ngth(UsedZoneEnd|
00004e30  42 69 74 25 2c 5a 6f 6e  65 45 6e 64 42 69 74 25  |Bit%,ZoneEndBit%|
00004e40  2d 55 73 65 64 5a 6f 6e  65 45 6e 64 42 69 74 25  |-UsedZoneEndBit%|
00004e50  29 0d 20 3a 09 20 20 20  20 cd 0d 20 44 08 20 20  |). :.    .. D.  |
00004e60  20 cc 0d 20 4e 34 20 20  20 20 f2 57 72 69 74 65  | .. N4    .Write|
00004e70  4c 65 6e 67 74 68 28 5a  6f 6e 65 42 69 74 25 2c  |Length(ZoneBit%,|
00004e80  44 65 66 65 63 74 53 74  61 72 74 25 2d 5a 6f 6e  |DefectStart%-Zon|
00004e90  65 42 69 74 25 29 0d 20  58 08 20 20 20 cd 0d 20  |eBit%). X.   .. |
00004ea0  62 17 20 20 50 72 65 46  72 65 65 25 3d 5a 6f 6e  |b.  PreFree%=Zon|
00004eb0  65 42 69 74 25 0d 20 6c  07 20 20 cd 0d 20 76 22  |eBit%. l.  .. v"|
00004ec0  20 20 e7 20 44 65 66 65  63 74 53 74 61 72 74 25  |  . DefectStart%|
00004ed0  3c 5a 6f 6e 65 45 6e 64  42 69 74 25 20 8c 0d 20  |<ZoneEndBit% .. |
00004ee0  80 33 20 20 20 e7 20 44  65 66 65 63 74 45 6e 64  |.3   . DefectEnd|
00004ef0  25 3e 55 73 65 64 5a 6f  6e 65 45 6e 64 42 69 74  |%>UsedZoneEndBit|
00004f00  25 2d 28 4c 69 6e 6b 42  69 74 73 25 2b 31 29 20  |%-(LinkBits%+1) |
00004f10  8c 0d 20 8a 1e 20 20 20  20 44 65 66 65 63 74 45  |.. ..    DefectE|
00004f20  6e 64 25 3d 5a 6f 6e 65  45 6e 64 42 69 74 25 0d  |nd%=ZoneEndBit%.|
00004f30  20 94 08 20 20 20 cd 0d  20 9e 21 20 20 20 f2 57  | ..   .. .!   .W|
00004f40  72 69 74 65 4c 69 6e 6b  28 44 65 66 65 63 74 53  |riteLink(DefectS|
00004f50  74 61 72 74 25 2c 31 29  0d 20 a8 39 20 20 20 f2  |tart%,1). .9   .|
00004f60  57 72 69 74 65 4c 65 6e  67 74 68 28 44 65 66 65  |WriteLength(Defe|
00004f70  63 74 53 74 61 72 74 25  2c 44 65 66 65 63 74 45  |ctStart%,DefectE|
00004f80  6e 64 25 2d 44 65 66 65  63 74 53 74 61 72 74 25  |nd%-DefectStart%|
00004f90  29 0d 20 b2 1a 20 20 20  5a 6f 6e 65 42 69 74 25  |). ..   ZoneBit%|
00004fa0  3d 44 65 66 65 63 74 45  6e 64 25 0d 20 bc 07 20  |=DefectEnd%. .. |
00004fb0  20 cc 0d 20 c6 1b 20 20  20 5a 6f 6e 65 42 69 74  | .. ..   ZoneBit|
00004fc0  25 3d 5a 6f 6e 65 45 6e  64 42 69 74 25 0d 20 d0  |%=ZoneEndBit%. .|
00004fd0  07 20 20 cd 0d 20 da 1b  20 fd 20 5a 6f 6e 65 42  |.  .. .. . ZoneB|
00004fe0  69 74 25 3d 5a 6f 6e 65  45 6e 64 42 69 74 25 0d  |it%=ZoneEndBit%.|
00004ff0  20 e4 1b 20 f2 57 72 69  74 65 4c 69 6e 6b 28 50  | .. .WriteLink(P|
00005000  72 65 46 72 65 65 25 2c  30 29 0d 20 ee 10 20 e7  |reFree%,0). .. .|
00005010  20 7a 6f 6e 65 25 3d 30  20 8c 0d 20 f8 20 20 20  | zone%=0 .. .   |
00005020  5a 6f 6e 65 53 74 61 72  74 25 3f 43 72 6f 73 73  |ZoneStart%?Cross|
00005030  43 68 65 63 6b 25 3d 26  46 46 0d 21 02 06 20 cc  |Check%=&FF.!.. .|
00005040  0d 21 0c 1e 20 20 5a 6f  6e 65 53 74 61 72 74 25  |.!..  ZoneStart%|
00005050  3f 43 72 6f 73 73 43 68  65 63 6b 25 3d 30 0d 21  |?CrossCheck%=0.!|
00005060  16 06 20 cd 0d 21 20 32  20 3f 5a 6f 6e 65 53 74  |.. ..! 2 ?ZoneSt|
00005070  61 72 74 25 3d a4 4e 65  77 4d 61 70 43 68 65 63  |art%=.NewMapChec|
00005080  6b 28 5a 6f 6e 65 53 74  61 72 74 25 2c 53 65 63  |k(ZoneStart%,Sec|
00005090  53 69 7a 65 25 29 0d 21  2a 23 20 5a 6f 6e 65 53  |Size%).!*# ZoneS|
000050a0  74 61 72 74 25 3d 5a 6f  6e 65 53 74 61 72 74 25  |tart%=ZoneStart%|
000050b0  2b 53 65 63 53 69 7a 65  25 0d 21 34 1e 20 5a 6f  |+SecSize%.!4. Zo|
000050c0  6e 65 53 74 61 72 74 42  69 74 25 3d 5a 6f 6e 65  |neStartBit%=Zone|
000050d0  45 6e 64 42 69 74 25 0d  21 3e 0b ed 20 7a 6f 6e  |EndBit%.!>.. zon|
000050e0  65 25 0d 21 48 26 f4 50  52 4f 43 6d 65 73 73 61  |e%.!H&.PROCmessa|
000050f0  67 65 5f 70 72 69 6e 74  5f 30 28 22 57 72 69 74  |ge_print_0("Writ|
00005100  69 6e 67 4d 61 70 22 29  0d 21 52 28 f2 4d 6f 61  |ingMap").!R(.Moa|
00005110  6e 4f 70 28 57 72 69 74  65 25 2c 4d 61 70 41 64  |nOp(Write%,MapAd|
00005120  64 25 2c 42 75 66 25 2c  4d 61 70 4c 65 6e 25 29  |d%,Buf%,MapLen%)|
00005130  0d 21 5c 39 f2 4d 6f 61  6e 4f 70 28 57 72 69 74  |.!\9.MoanOp(Writ|
00005140  65 25 2c 4d 61 70 41 64  64 25 2b 4d 61 70 4c 65  |e%,MapAdd%+MapLe|
00005150  6e 25 2f 53 65 63 53 69  7a 65 25 2c 42 75 66 25  |n%/SecSize%,Buf%|
00005160  2c 4d 61 70 4c 65 6e 25  29 0d 21 66 11 f2 57 72  |,MapLen%).!f..Wr|
00005170  69 74 65 52 6f 6f 74 44  69 72 0d 21 70 05 e1 0d  |iteRootDir.!p...|
00005180  21 7a 05 3a 0d 21 84 0f  dd f2 43 61 6c 63 5a 6f  |!z.:.!....CalcZo|
00005190  6e 65 73 0d 21 8e 23 55  73 65 64 42 69 74 73 25  |nes.!.#UsedBits%|
000051a0  3d 53 65 63 53 69 7a 65  25 2a 38 2d 53 70 61 72  |=SecSize%*8-Spar|
000051b0  65 42 69 74 73 25 0d 21  98 31 57 68 6f 6c 65 5a  |eBits%.!.1WholeZ|
000051c0  6f 6e 65 73 25 3d 28 4d  61 70 42 69 74 73 25 2b  |ones%=(MapBits%+|
000051d0  5a 6f 6e 65 30 42 69 74  73 25 29 20 81 20 55 73  |Zone0Bits%) . Us|
000051e0  65 64 42 69 74 73 25 0d  21 a2 2e 4f 64 64 42 69  |edBits%.!..OddBi|
000051f0  74 73 25 3d 28 4d 61 70  42 69 74 73 25 2b 5a 6f  |ts%=(MapBits%+Zo|
00005200  6e 65 30 42 69 74 73 25  29 20 83 20 55 73 65 64  |ne0Bits%) . Used|
00005210  42 69 74 73 25 0d 21 ac  38 e7 20 4f 64 64 42 69  |Bits%.!.8. OddBi|
00005220  74 73 25 20 5a 6f 6e 65  73 25 3d 57 68 6f 6c 65  |ts% Zones%=Whole|
00005230  5a 6f 6e 65 73 25 2b 31  20 8b 20 5a 6f 6e 65 73  |Zones%+1 . Zones|
00005240  25 3d 57 68 6f 6c 65 5a  6f 6e 65 73 25 0d 21 b6  |%=WholeZones%.!.|
00005250  17 4d 61 70 5a 6f 6e 65  25 3d 5a 6f 6e 65 73 25  |.MapZone%=Zones%|
00005260  20 81 20 32 0d 21 c0 12  e7 20 4d 61 70 5a 6f 6e  | . 2.!... MapZon|
00005270  65 25 3d 30 20 8c 0d 21  ca 12 20 20 20 20 20 4d  |e%=0 ..!..     M|
00005280  61 70 41 64 64 25 3d 30  0d 21 d4 05 cc 0d 21 de  |apAdd%=0.!....!.|
00005290  1e 20 20 20 20 20 e7 20  28 41 6c 6c 6f 63 25 3e  |.     . (Alloc%>|
000052a0  53 65 63 53 69 7a 65 25  29 20 8c 0d 21 e8 48 20  |SecSize%) ..!.H |
000052b0  20 20 20 20 20 20 20 20  4d 61 70 41 64 64 25 3d  |        MapAdd%=|
000052c0  28 55 73 65 64 42 69 74  73 25 2a 4d 61 70 5a 6f  |(UsedBits%*MapZo|
000052d0  6e 65 25 2d 5a 6f 6e 65  30 42 69 74 73 25 29 2a  |ne%-Zone0Bits%)*|
000052e0  28 41 6c 6c 6f 63 25 20  81 20 53 65 63 53 69 7a  |(Alloc% . SecSiz|
000052f0  65 25 29 0d 21 f2 0a 20  20 20 20 20 cc 0d 21 fc  |e%).!..     ..!.|
00005300  4a 20 20 20 20 20 20 20  20 20 4d 61 70 41 64 64  |J         MapAdd|
00005310  25 3d 28 55 73 65 64 42  69 74 73 25 2a 4d 61 70  |%=(UsedBits%*Map|
00005320  5a 6f 6e 65 25 2d 5a 6f  6e 65 30 42 69 74 73 25  |Zone%-Zone0Bits%|
00005330  29 20 81 20 28 53 65 63  53 69 7a 65 25 20 81 20  |) . (SecSize% . |
00005340  41 6c 6c 6f 63 25 29 0d  22 06 0a 20 20 20 20 20  |Alloc%)."..     |
00005350  cd 0d 22 10 05 cd 0d 22  1a 2b f4 50 52 4f 43 65  |.."....".+.PROCe|
00005360  72 72 6f 72 62 6f 78 28  22 4d 61 70 41 64 64 3a  |rrorbox("MapAdd:|
00005370  20 26 22 2b 53 54 52 24  7e 4d 61 70 41 64 64 25  | &"+STR$~MapAdd%|
00005380  29 0d 22 24 1b 4d 61 70  4c 65 6e 25 3d 5a 6f 6e  |)."$.MapLen%=Zon|
00005390  65 73 25 2a 53 65 63 53  69 7a 65 25 0d 22 2e 05  |es%*SecSize%."..|
000053a0  e1 0d 22 38 05 3a 0d 22  42 0d dd f2 43 61 6c 63  |.."8.:."B...Calc|
000053b0  49 64 73 0d 22 4c 29 49  64 73 50 65 72 5a 6f 6e  |Ids."L)IdsPerZon|
000053c0  65 25 3d 55 73 65 64 42  69 74 73 25 20 81 20 28  |e%=UsedBits% . (|
000053d0  4c 69 6e 6b 42 69 74 73  25 2b 31 29 0d 22 56 3d  |LinkBits%+1)."V=|
000053e0  49 64 73 25 3d 49 64 73  50 65 72 5a 6f 6e 65 25  |Ids%=IdsPerZone%|
000053f0  20 2a 20 57 68 6f 6c 65  5a 6f 6e 65 73 25 20 2b  | * WholeZones% +|
00005400  20 4f 64 64 42 69 74 73  25 20 81 20 28 4c 69 6e  | OddBits% . (Lin|
00005410  6b 42 69 74 73 25 2b 31  29 0d 22 60 05 e1 0d 22  |kBits%+1)."`..."|
00005420  6a 05 3a 0d 22 74 19 dd  a4 44 69 73 63 54 6f 4d  |j.:."t...DiscToM|
00005430  61 70 28 64 69 73 63 61  64 64 25 29 0d 22 7e 10  |ap(discadd%)."~.|
00005440  ea 20 62 69 74 25 2c 7a  6f 6e 65 25 0d 22 88 17  |. bit%,zone%."..|
00005450  e7 20 28 41 6c 6c 6f 63  25 3e 53 65 63 53 69 7a  |. (Alloc%>SecSiz|
00005460  65 25 29 0d 22 92 38 20  20 20 20 62 69 74 25 3d  |e%).".8    bit%=|
00005470  28 64 69 73 63 61 64 64  25 20 81 20 28 41 6c 6c  |(discadd% . (All|
00005480  6f 63 25 20 81 20 53 65  63 53 69 7a 65 25 29 29  |oc% . SecSize%))|
00005490  2b 5a 6f 6e 65 30 42 69  74 73 25 0d 22 9c 05 cc  |+Zone0Bits%."...|
000054a0  0d 22 a6 38 20 20 20 20  62 69 74 25 3d 28 64 69  |.".8    bit%=(di|
000054b0  73 63 61 64 64 25 20 2a  20 28 53 65 63 53 69 7a  |scadd% * (SecSiz|
000054c0  65 25 20 81 20 41 6c 6c  6f 63 25 29 29 2b 5a 6f  |e% . Alloc%))+Zo|
000054d0  6e 65 30 42 69 74 73 25  0d 22 b0 05 cd 0d 22 ba  |ne0Bits%."....".|
000054e0  1a 7a 6f 6e 65 25 3d 62  69 74 25 20 81 20 55 73  |.zone%=bit% . Us|
000054f0  65 64 42 69 74 73 25 0d  22 c4 2f 62 69 74 25 3d  |edBits%."./bit%=|
00005500  62 69 74 25 2b 28 62 69  74 25 20 81 20 55 73 65  |bit%+(bit% . Use|
00005510  64 42 69 74 73 25 29 2a  53 70 61 72 65 42 69 74  |dBits%)*SpareBit|
00005520  73 25 2b 34 2a 38 0d 22  ce 0a 3d 20 62 69 74 25  |s%+4*8."..= bit%|
00005530  0d 22 d8 05 3a 0d 22 e2  1b dd f2 57 72 69 74 65  |."..:."....Write|
00005540  4c 69 6e 6b 28 6f 66 66  25 2c 6c 69 6e 6b 25 29  |Link(off%,link%)|
00005550  0d 22 ec 32 e7 20 6c 69  6e 6b 25 3e 3d 32 5e 4c  |.".2. link%>=2^L|
00005560  69 6e 6b 42 69 74 73 25  20 f2 66 61 74 61 6c 28  |inkBits% .fatal(|
00005570  22 50 52 4f 47 52 41 4d  20 45 52 52 4f 52 20 32  |"PROGRAM ERROR 2|
00005580  22 29 0d 22 f6 15 ea 20  62 69 74 25 2c 61 64 64  |")."... bit%,add|
00005590  25 2c 6d 61 73 6b 25 0d  23 00 11 62 69 74 25 3d  |%,mask%.#..bit%=|
000055a0  6f 66 66 25 20 83 20 38  0d 23 0a 16 61 64 64 25  |off% . 8.#..add%|
000055b0  3d 42 75 66 25 2b 6f 66  66 25 20 81 20 38 0d 23  |=Buf%+off% . 8.#|
000055c0  14 17 6d 61 73 6b 25 3d  32 5e 4c 69 6e 6b 42 69  |..mask%=2^LinkBi|
000055d0  74 73 25 2d 31 0d 23 1e  31 21 61 64 64 25 3d 28  |ts%-1.#.1!add%=(|
000055e0  21 61 64 64 25 20 80 20  ac 20 28 6d 61 73 6b 25  |!add% . . (mask%|
000055f0  3c 3c 62 69 74 25 29 29  20 84 20 6c 69 6e 6b 25  |<<bit%)) . link%|
00005600  3c 3c 62 69 74 25 0d 23  28 05 e1 0d 23 32 05 3a  |<<bit%.#(...#2.:|
00005610  0d 23 3c 1c dd f2 57 72  69 74 65 4c 65 6e 67 74  |.#<...WriteLengt|
00005620  68 28 6f 66 66 25 2c 6c  65 6e 25 29 0d 23 46 2f  |h(off%,len%).#F/|
00005630  e7 20 6c 65 6e 25 3c 3d  4c 69 6e 6b 42 69 74 73  |. len%<=LinkBits|
00005640  25 20 f2 66 61 74 61 6c  28 22 50 52 4f 47 52 41  |% .fatal("PROGRA|
00005650  4d 20 45 52 52 4f 52 20  33 22 29 0d 23 50 14 6f  |M ERROR 3").#P.o|
00005660  66 66 25 3d 6f 66 66 25  2b 6c 65 6e 25 2d 31 0d  |ff%=off%+len%-1.|
00005670  23 5a 1d 42 75 66 25 3f  28 6f 66 66 25 81 38 29  |#Z.Buf%?(off%.8)|
00005680  2b 3d 32 5e 28 6f 66 66  25 83 38 29 0d 23 64 05  |+=2^(off%.8).#d.|
00005690  e1 0d 23 6e 05 3a 0d 23  78 15 dd f2 57 72 69 74  |..#n.:.#x...Writ|
000056a0  65 44 65 66 65 63 74 4c  69 73 74 0d 23 82 2a f4  |eDefectList.#.*.|
000056b0  50 52 4f 43 6d 65 73 73  61 67 65 5f 70 72 69 6e  |PROCmessage_prin|
000056c0  74 5f 30 28 22 57 72 69  74 69 6e 67 44 65 66 65  |t_0("WritingDefe|
000056d0  63 74 73 22 29 0d 23 8c  0a 70 74 72 25 3d 30 0d  |cts").#..ptr%=0.|
000056e0  23 96 0c 63 68 65 63 6b  25 3d 30 0d 23 a0 1e c8  |#..check%=0.#...|
000056f0  95 20 44 65 66 65 63 74  25 21 70 74 72 25 3c 45  |. Defect%!ptr%<E|
00005700  6e 64 44 65 66 65 63 74  25 0d 23 aa 1c 20 42 6f  |ndDefect%.#.. Bo|
00005710  6f 74 25 21 70 74 72 25  3d 44 65 66 65 63 74 25  |ot%!ptr%=Defect%|
00005720  21 70 74 72 25 0d 23 b4  1a 20 f2 43 68 65 63 6b  |!ptr%.#.. .Check|
00005730  50 75 74 28 42 6f 6f 74  25 21 70 74 72 25 29 0d  |Put(Boot%!ptr%).|
00005740  23 be 10 20 70 74 72 25  3d 70 74 72 25 2b 34 0d  |#.. ptr%=ptr%+4.|
00005750  23 c8 05 ce 0d 23 d2 21  63 68 65 63 6b 25 3d 63  |#....#.!check%=c|
00005760  68 65 63 6b 25 20 82 20  28 63 68 65 63 6b 25 3e  |heck% . (check%>|
00005770  3e 3e 31 36 29 0d 23 dc  27 63 68 65 63 6b 25 3d  |>>16).#.'check%=|
00005780  28 63 68 65 63 6b 25 20  82 20 28 63 68 65 63 6b  |(check% . (check|
00005790  25 3e 3e 3e 38 29 29 80  20 26 46 46 0d 23 e6 22  |%>>>8)). &FF.#."|
000057a0  42 6f 6f 74 25 21 70 74  72 25 3d 45 6e 64 44 65  |Boot%!ptr%=EndDe|
000057b0  66 65 63 74 25 20 84 20  63 68 65 63 6b 25 0d 23  |fect% . check%.#|
000057c0  f0 36 f4 20 49 66 20 77  65 20 68 61 76 65 20 61  |.6. If we have a|
000057d0  20 73 65 63 6f 6e 64 20  64 65 66 65 63 74 20 6c  | second defect l|
000057e0  69 73 74 20 74 68 65 6e  20 64 6f 20 74 68 61 74  |ist then do that|
000057f0  20 74 6f 6f 0d 23 fa 0e  e7 20 42 69 67 44 69 73  | too.#... BigDis|
00005800  63 25 0d 24 04 0f 20 20  20 20 70 74 72 25 2b 3d  |c%.$..    ptr%+=|
00005810  34 0d 24 0e 10 20 20 20  20 63 68 65 63 6b 25 3d  |4.$..    check%=|
00005820  30 0d 24 18 22 20 20 20  20 c8 95 20 44 65 66 65  |0.$."    .. Defe|
00005830  63 74 25 21 70 74 72 25  3c 45 6e 64 44 65 66 65  |ct%!ptr%<EndDefe|
00005840  63 74 25 0d 24 22 23 20  20 20 20 20 20 20 20 42  |ct%.$"#        B|
00005850  6f 6f 74 25 21 70 74 72  25 3d 44 65 66 65 63 74  |oot%!ptr%=Defect|
00005860  25 21 70 74 72 25 0d 24  2c 21 20 20 20 20 20 20  |%!ptr%.$,!      |
00005870  20 20 f2 43 68 65 63 6b  50 75 74 28 42 6f 6f 74  |  .CheckPut(Boot|
00005880  25 21 70 74 72 25 29 0d  24 36 17 20 20 20 20 20  |%!ptr%).$6.     |
00005890  20 20 20 70 74 72 25 3d  70 74 72 25 2b 34 0d 24  |   ptr%=ptr%+4.$|
000058a0  40 09 20 20 20 20 ce 0d  24 4a 25 20 20 20 20 63  |@.    ..$J%    c|
000058b0  68 65 63 6b 25 3d 63 68  65 63 6b 25 20 82 20 28  |heck%=check% . (|
000058c0  63 68 65 63 6b 25 3e 3e  3e 31 36 29 0d 24 54 2b  |check%>>>16).$T+|
000058d0  20 20 20 20 63 68 65 63  6b 25 3d 28 63 68 65 63  |    check%=(chec|
000058e0  6b 25 20 82 20 28 63 68  65 63 6b 25 3e 3e 3e 38  |k% . (check%>>>8|
000058f0  29 29 80 20 26 46 46 0d  24 5e 27 20 20 20 20 42  |)). &FF.$^'    B|
00005900  6f 6f 74 25 21 70 74 72  25 3d 45 6e 64 44 65 66  |oot%!ptr%=EndDef|
00005910  65 63 74 32 25 20 84 20  63 68 65 63 6b 25 0d 24  |ect2% . check%.$|
00005920  68 05 cd 0d 24 72 2f f4  20 7a 65 72 6f 20 6f 75  |h...$r/. zero ou|
00005930  74 20 74 68 65 20 72 65  6d 61 69 6e 64 65 72 20  |t the remainder |
00005940  6f 66 20 74 68 65 20 64  65 66 65 63 74 20 6c 69  |of the defect li|
00005950  73 74 0d 24 7c 1b c8 95  20 70 74 72 25 3c 28 4d  |st.$|... ptr%<(M|
00005960  61 78 44 65 66 65 63 74  73 25 2a 34 29 0d 24 86  |axDefects%*4).$.|
00005970  10 20 70 74 72 25 3d 70  74 72 25 2b 34 0d 24 90  |. ptr%=ptr%+4.$.|
00005980  11 20 42 6f 6f 74 25 21  70 74 72 25 3d 30 0d 24  |. Boot%!ptr%=0.$|
00005990  9a 05 ce 0d 24 a4 19 f2  53 75 6d 28 42 6f 6f 74  |....$...Sum(Boot|
000059a0  25 2c 42 6f 6f 74 53 69  7a 65 25 29 0d 24 ae 2c  |%,BootSize%).$.,|
000059b0  f2 4d 6f 61 6e 4f 70 28  57 72 69 74 65 25 2c 42  |.MoanOp(Write%,B|
000059c0  6f 6f 74 41 64 64 25 2c  42 6f 6f 74 25 2c 42 6f  |ootAdd%,Boot%,Bo|
000059d0  6f 74 53 69 7a 65 25 29  0d 24 b8 05 e1 0d 24 c2  |otSize%).$....$.|
000059e0  05 3a 0d 24 cc 12 dd f2  43 68 65 63 6b 50 75 74  |.:.$....CheckPut|
000059f0  28 49 25 29 0d 24 d6 42  63 68 65 63 6b 25 3d 28  |(I%).$.Bcheck%=(|
00005a00  63 68 65 63 6b 25 20 3e  3e 3e 20 31 33 29 20 82  |check% >>> 13) .|
00005a10  20 28 28 63 68 65 63 6b  25 20 80 20 28 32 5e 31  | ((check% . (2^1|
00005a20  33 2d 31 29 29 20 3c 3c  20 28 33 32 2d 31 33 29  |3-1)) << (32-13)|
00005a30  29 20 82 20 49 25 0d 24  e0 05 e1 0d 24 ea 05 3a  |) . I%.$....$..:|
00005a40  0d 24 f4 15 dd f2 53 75  6d 28 62 61 73 65 25 2c  |.$....Sum(base%,|
00005a50  6c 65 6e 25 29 0d 24 fe  23 62 61 73 65 25 3f 28  |len%).$.#base%?(|
00005a60  6c 65 6e 25 2d 31 29 3d  a4 73 75 6d 28 62 61 73  |len%-1)=.sum(bas|
00005a70  65 25 2c 6c 65 6e 25 29  0d 25 08 05 e1 0d 25 12  |e%,len%).%....%.|
00005a80  05 3a 0d 25 1c 15 dd a4  73 75 6d 28 62 61 73 65  |.:.%....sum(base|
00005a90  25 2c 6c 65 6e 25 29 0d  25 26 10 ea 20 73 75 6d  |%,len%).%&.. sum|
00005aa0  25 2c 63 25 2c 49 25 0d  25 30 0a 73 75 6d 25 3d  |%,c%,I%.%0.sum%=|
00005ab0  30 0d 25 3a 08 63 25 3d  30 0d 25 44 17 e3 20 49  |0.%:.c%=0.%D.. I|
00005ac0  25 3d 6c 65 6e 25 2d 32  20 b8 20 30 20 88 2d 31  |%=len%-2 . 0 .-1|
00005ad0  0d 25 4e 1a 20 73 75 6d  25 3d 73 75 6d 25 2b 62  |.%N. sum%=sum%+b|
00005ae0  61 73 65 25 3f 49 25 2b  63 25 0d 25 58 2c 20 e7  |ase%?I%+c%.%X, .|
00005af0  20 73 75 6d 25 3c 26 31  30 30 20 63 25 3d 30 20  | sum%<&100 c%=0 |
00005b00  8b 20 73 75 6d 25 3d 73  75 6d 25 20 80 20 26 46  |. sum%=sum% . &F|
00005b10  46 3a 63 25 3d 31 0d 25  62 05 ed 0d 25 6c 09 3d  |F:c%=1.%b...%l.=|
00005b20  73 75 6d 25 0d 25 76 05  3a 0d 25 80 1c dd f2 4d  |sum%.%v.:.%....M|
00005b30  6f 61 6e 4f 70 28 62 25  2c 20 43 25 2c 20 44 25  |oanOp(b%, C%, D%|
00005b40  2c 20 45 25 29 0d 25 8a  08 ea 20 64 25 0d 25 94  |, E%).%... d%.%.|
00005b50  0f 64 25 3d 44 72 69 76  65 25 2b 34 0d 25 9e 12  |.d%=Drive%+4.%..|
00005b60  e7 20 42 69 67 53 43 53  49 46 53 25 20 8c 0d 25  |. BigSCSIFS% ..%|
00005b70  a8 4e 20 20 20 20 f2 65  72 72 6f 72 62 6f 78 28  |.N    .errorbox(|
00005b80  22 4d 6f 61 6e 4f 70 3a  20 6c 61 72 67 65 20 22  |"MoanOp: large "|
00005b90  2b c3 7e 62 25 2b 22 20  22 2b c3 7e 28 43 25 20  |+.~b%+" "+.~(C% |
00005ba0  84 20 64 25 3c 3c 32 39  29 2b 22 20 22 2b c3 7e  |. d%<<29)+" "+.~|
00005bb0  44 25 2b 22 20 22 2b c3  7e 45 25 29 0d 25 b2 5c  |D%+" "+.~E%).%.\|
00005bc0  20 20 20 20 c8 99 20 22  53 43 53 49 46 53 5f 53  |    .. "SCSIFS_S|
00005bd0  65 63 74 6f 72 44 69 73  63 4f 70 22 2c 20 30 2c  |ectorDiscOp", 0,|
00005be0  20 62 25 20 84 20 41 6c  74 44 65 66 65 63 74 42  | b% . AltDefectB|
00005bf0  69 74 25 20 84 20 28 44  69 73 63 52 65 63 25 3c  |it% . (DiscRec%<|
00005c00  3c 36 29 2c 20 43 25 20  84 20 64 25 3c 3c 32 39  |<6), C% . d%<<29|
00005c10  2c 20 44 25 2c 20 45 25  0d 25 bc 05 cc 0d 25 c6  |, D%, E%.%....%.|
00005c20  4e 20 20 20 20 f2 65 72  72 6f 72 62 6f 78 28 22  |N    .errorbox("|
00005c30  4d 6f 61 6e 4f 70 3a 20  73 6d 61 6c 6c 20 22 2b  |MoanOp: small "+|
00005c40  c3 7e 62 25 2b 22 20 22  2b c3 7e 28 43 25 20 84  |.~b%+" "+.~(C% .|
00005c50  20 64 25 3c 3c 32 39 29  2b 22 20 22 2b c3 7e 44  | d%<<29)+" "+.~D|
00005c60  25 2b 22 20 22 2b c3 7e  45 25 29 0d 25 d0 61 20  |%+" "+.~E%).%.a |
00005c70  20 20 20 c8 99 20 22 53  43 53 49 46 53 5f 44 69  |   .. "SCSIFS_Di|
00005c80  73 63 4f 70 22 2c 20 30  2c 20 62 25 20 84 20 41  |scOp", 0, b% . A|
00005c90  6c 74 44 65 66 65 63 74  42 69 74 25 20 84 20 28  |ltDefectBit% . (|
00005ca0  44 69 73 63 52 65 63 25  3c 3c 36 29 2c 20 28 43  |DiscRec%<<6), (C|
00005cb0  25 2a 53 65 63 53 69 7a  65 25 29 20 84 20 64 25  |%*SecSize%) . d%|
00005cc0  3c 3c 32 39 2c 20 44 25  2c 20 45 25 0d 25 da 05  |<<29, D%, E%.%..|
00005cd0  cd 0d 25 e4 05 e1 0d 25  ee 05 3a 0d 25 f8 13 dd  |..%....%..:.%...|
00005ce0  f2 57 72 69 74 65 4f 6c  64 46 73 4d 61 70 0d 26  |.WriteOldFsMap.&|
00005cf0  02 0b ea 20 73 25 2c 49  25 0d 26 0c 31 f2 77 72  |... s%,I%.&.1.wr|
00005d00  69 74 65 5f 69 63 6f 6e  28 73 74 61 74 75 73 25  |ite_icon(status%|
00005d10  2c 22 57 72 69 74 69 6e  67 20 66 72 65 65 20 73  |,"Writing free s|
00005d20  70 61 63 65 20 6d 61 70  22 29 0d 26 16 26 e3 20  |pace map").&.&. |
00005d30  49 25 3d 30 20 b8 20 4f  6c 64 4d 61 70 53 69 7a  |I%=0 . OldMapSiz|
00005d40  65 25 2d 31 3a 42 75 66  25 3f 49 25 3d 30 3a ed  |e%-1:Buf%?I%=0:.|
00005d50  0d 26 20 16 73 25 3d 4f  6c 64 4d 61 70 53 69 7a  |.& .s%=OldMapSiz|
00005d60  65 25 20 81 20 32 0d 26  2a 18 21 42 75 66 25 3d  |e% . 2.&*.!Buf%=|
00005d70  4f 6c 64 4c 57 4d 25 20  81 20 26 31 30 30 0d 26  |OldLWM% . &100.&|
00005d80  34 38 42 75 66 25 21 73  25 3d 28 44 69 73 63 53  |48Buf%!s%=(DiscS|
00005d90  69 7a 65 25 2d 4f 6c 64  4c 57 4d 25 2d 44 65 66  |ize%-OldLWM%-Def|
00005da0  65 63 74 73 25 2a 53 65  63 53 69 7a 65 25 29 20  |ects%*SecSize%) |
00005db0  81 20 26 31 30 30 0d 26  3e 21 21 28 42 75 66 25  |. &100.&>!!(Buf%|
00005dc0  2b 73 25 2d 34 29 3d 44  69 73 63 53 69 7a 65 25  |+s%-4)=DiscSize%|
00005dd0  20 81 20 26 31 30 30 0d  26 48 25 21 28 42 75 66  | . &100.&H%!(Buf|
00005de0  25 2b 4f 6c 64 4d 61 70  53 69 7a 65 25 2d 35 29  |%+OldMapSize%-5)|
00005df0  3d b3 28 26 31 30 30 30  30 29 2d 31 0d 26 52 1b  |=.(&10000)-1.&R.|
00005e00  21 28 42 75 66 25 2b 4f  6c 64 4d 61 70 53 69 7a  |!(Buf%+OldMapSiz|
00005e10  65 25 2d 32 29 3d 33 0d  26 5c 11 f2 53 75 6d 28  |e%-2)=3.&\..Sum(|
00005e20  42 75 66 25 2c 73 25 29  0d 26 66 14 f2 53 75 6d  |Buf%,s%).&f..Sum|
00005e30  28 42 75 66 25 2b 73 25  2c 73 25 29 0d 26 70 2f  |(Buf%+s%,s%).&p/|
00005e40  f2 4d 6f 61 6e 4f 70 28  57 72 69 74 65 25 2c 4f  |.MoanOp(Write%,O|
00005e50  6c 64 4d 61 70 41 64 64  25 2c 42 75 66 25 2c 4f  |ldMapAdd%,Buf%,O|
00005e60  6c 64 4d 61 70 53 69 7a  65 25 29 0d 26 7a 05 e1  |ldMapSize%).&z..|
00005e70  0d 26 84 05 3a 0d 26 8e  12 dd f2 57 72 69 74 65  |.&..:.&....Write|
00005e80  52 6f 6f 74 44 69 72 0d  26 98 0c ea 20 42 46 25  |RootDir.&... BF%|
00005e90  2c 49 25 0d 26 a2 31 f2  77 72 69 74 65 5f 69 63  |,I%.&.1.write_ic|
00005ea0  6f 6e 28 73 74 61 74 75  73 25 2c 22 57 72 69 74  |on(status%,"Writ|
00005eb0  69 6e 67 20 72 6f 6f 74  20 64 69 72 65 63 74 6f  |ing root directo|
00005ec0  72 79 22 29 0d 26 ac 23  e3 20 49 25 3d 30 20 b8  |ry").&.#. I%=0 .|
00005ed0  20 44 69 72 53 69 7a 65  25 2d 31 3a 42 75 66 25  | DirSize%-1:Buf%|
00005ee0  3f 49 25 3d 30 3a ed 0d  26 b6 14 24 44 69 72 4d  |?I%=0:..&..$DirM|
00005ef0  61 72 6b 25 3d 22 48 75  67 6f 22 0d 26 c0 14 42  |ark%="Hugo".&..B|
00005f00  75 66 25 21 31 3d 21 44  69 72 4d 61 72 6b 25 0d  |uf%!1=!DirMark%.|
00005f10  26 ca 15 42 46 25 3d 42  75 66 25 2b 44 69 72 53  |&..BF%=Buf%+DirS|
00005f20  69 7a 65 25 0d 26 d4 0f  e7 20 4e 65 77 4d 61 70  |ize%.&... NewMap|
00005f30  25 20 8c 0d 26 de 1b 20  42 46 25 21 2d 33 38 3d  |% ..&.. BF%!-38=|
00005f40  49 6e 64 52 6f 6f 74 44  69 72 41 64 64 25 0d 26  |IndRootDirAdd%.&|
00005f50  e8 05 cc 0d 26 f2 22 20  42 46 25 21 2d 33 38 3d  |....&." BF%!-38=|
00005f60  49 6e 64 52 6f 6f 74 44  69 72 41 64 64 25 20 81  |IndRootDirAdd% .|
00005f70  20 26 31 30 30 0d 26 fc  05 cd 0d 27 06 10 42 46  | &100.&....'..BF|
00005f80  25 3f 2d 33 35 3d 97 22  24 22 0d 27 10 10 42 46  |%?-35=."$".'..BF|
00005f90  25 3f 2d 31 36 3d 97 22  24 22 0d 27 1a 14 42 46  |%?-16=."$".'..BF|
00005fa0  25 21 2d 35 3d 21 44 69  72 4d 61 72 6b 25 0d 27  |%!-5=!DirMark%.'|
00005fb0  24 0c 63 68 65 63 6b 25  3d 30 0d 27 2e 14 f2 43  |$.check%=0.'...C|
00005fc0  68 65 63 6b 50 75 74 28  21 42 75 66 25 29 0d 27  |heckPut(!Buf%).'|
00005fd0  38 15 f2 43 68 65 63 6b  50 75 74 28 42 75 66 25  |8..CheckPut(Buf%|
00005fe0  3f 34 29 0d 27 42 0d 49  25 3d 42 46 25 2d 34 30  |?4).'B.I%=BF%-40|
00005ff0  0d 27 4c 0b c8 95 20 49  25 80 33 0d 27 56 13 20  |.'L... I%.3.'V. |
00006000  f2 43 68 65 63 6b 50 75  74 28 3f 49 25 29 0d 27  |.CheckPut(?I%).'|
00006010  60 0c 20 49 25 3d 49 25  2b 31 0d 27 6a 05 ce 0d  |`. I%=I%+1.'j...|
00006020  27 74 0f c8 95 20 49 25  3c 42 46 25 2d 34 0d 27  |'t... I%<BF%-4.'|
00006030  7e 13 20 f2 43 68 65 63  6b 50 75 74 28 21 49 25  |~. .CheckPut(!I%|
00006040  29 0d 27 88 0c 20 49 25  3d 49 25 2b 34 0d 27 92  |).'.. I%=I%+4.'.|
00006050  05 ce 0d 27 9c 21 63 68  65 63 6b 25 3d 63 68 65  |...'.!check%=che|
00006060  63 6b 25 20 82 20 28 63  68 65 63 6b 25 3e 3e 3e  |ck% . (check%>>>|
00006070  31 36 29 0d 27 a6 27 63  68 65 63 6b 25 3d 28 63  |16).'.'check%=(c|
00006080  68 65 63 6b 25 20 82 20  28 63 68 65 63 6b 25 3e  |heck% . (check%>|
00006090  3e 3e 38 29 29 80 20 26  46 46 0d 27 b0 11 42 46  |>>8)). &FF.'..BF|
000060a0  25 3f 2d 31 3d 63 68 65  63 6b 25 0d 27 ba 2d f2  |%?-1=check%.'.-.|
000060b0  4d 6f 61 6e 4f 70 28 57  72 69 74 65 25 2c 52 6f  |MoanOp(Write%,Ro|
000060c0  6f 74 44 69 72 41 64 64  25 2c 42 75 66 25 2c 44  |otDirAdd%,Buf%,D|
000060d0  69 72 53 69 7a 65 25 29  0d 27 c4 05 e1 0d 27 ce  |irSize%).'....'.|
000060e0  05 3a 0d 27 d8 0e dd f2  47 65 74 53 68 61 70 65  |.:.'....GetShape|
000060f0  0d 27 e2 11 53 65 63 73  50 65 72 54 72 6b 25 3d  |.'..SecsPerTrk%=|
00006100  31 0d 27 ec 18 48 65 61  64 73 25 3d a4 64 65 76  |1.'..Heads%=.dev|
00006110  69 63 65 5f 68 65 61 64  73 0d 27 f6 1c 53 65 63  |ice_heads.'..Sec|
00006120  53 69 7a 65 25 3d a4 64  65 76 69 63 65 5f 64 65  |Size%=.device_de|
00006130  6e 73 69 74 79 0d 28 00  1a 42 6f 6f 74 41 64 64  |nsity.(..BootAdd|
00006140  25 3d 26 43 30 30 2f 53  65 63 53 69 7a 65 25 0d  |%=&C00/SecSize%.|
00006150  28 0a 2a 53 65 63 74 6f  72 73 50 65 72 44 69 73  |(.*SectorsPerDis|
00006160  63 25 3d 28 a4 64 65 76  69 63 65 5f 6c 61 73 74  |c%=(.device_last|
00006170  5f 62 6c 6f 63 6b 2b 31  29 0d 28 14 11 c8 8e 20  |_block+1).(.... |
00006180  53 65 63 53 69 7a 65 25  20 ca 0d 28 1e 1b 20 c9  |SecSize% ..(.. .|
00006190  20 32 35 36 20 3a 20 4c  6f 67 32 53 65 63 53 69  | 256 : Log2SecSi|
000061a0  7a 65 25 3d 38 0d 28 28  1b 20 c9 20 35 31 32 20  |ze%=8.((. . 512 |
000061b0  3a 20 4c 6f 67 32 53 65  63 53 69 7a 65 25 3d 39  |: Log2SecSize%=9|
000061c0  0d 28 32 1c 20 c9 20 31  30 32 34 3a 20 4c 6f 67  |.(2. . 1024: Log|
000061d0  32 53 65 63 53 69 7a 65  25 3d 31 30 0d 28 3c 3d  |2SecSize%=10.(<=|
000061e0  20 7f 20 85 20 30 2c 22  45 72 72 6f 72 2c 20 73  | . . 0,"Error, s|
000061f0  65 63 74 6f 72 20 73 69  7a 65 20 6d 75 73 74 20  |ector size must |
00006200  62 65 20 32 35 36 2c 35  31 32 20 6f 72 20 31 30  |be 256,512 or 10|
00006210  32 34 20 62 79 74 65 73  22 0d 28 46 05 cb 0d 28  |24 bytes".(F...(|
00006220  50 33 f2 65 72 72 6f 72  62 6f 78 28 22 53 65 63  |P3.errorbox("Sec|
00006230  74 6f 72 73 50 65 72 44  69 73 63 3a 20 22 2b c3  |torsPerDisc: "+.|
00006240  7e 53 65 63 74 6f 72 73  50 65 72 44 69 73 63 25  |~SectorsPerDisc%|
00006250  29 0d 28 5a 4a 44 69 73  63 53 69 7a 65 25 3d 28  |).(ZJDiscSize%=(|
00006260  53 65 63 74 6f 72 73 50  65 72 44 69 73 63 25 20  |SectorsPerDisc% |
00006270  80 20 28 28 31 3c 3c 28  33 32 2d 4c 6f 67 32 53  |. ((1<<(32-Log2S|
00006280  65 63 53 69 7a 65 25 29  29 2d 31 29 29 3c 3c 4c  |ecSize%))-1))<<L|
00006290  6f 67 32 53 65 63 53 69  7a 65 25 0d 28 64 28 f2  |og2SecSize%.(d(.|
000062a0  65 72 72 6f 72 62 6f 78  28 22 44 69 73 63 53 69  |errorbox("DiscSi|
000062b0  7a 65 3a 20 26 22 2b c3  7e 44 69 73 63 53 69 7a  |ze: &"+.~DiscSiz|
000062c0  65 25 29 0d 28 6e 33 44  69 73 63 53 69 7a 65 32  |e%).(n3DiscSize2|
000062d0  25 3d 28 53 65 63 74 6f  72 73 50 65 72 44 69 73  |%=(SectorsPerDis|
000062e0  63 25 3e 3e 28 33 32 2d  4c 6f 67 32 53 65 63 53  |c%>>(32-Log2SecS|
000062f0  69 7a 65 25 29 29 0d 28  78 2a f2 65 72 72 6f 72  |ize%)).(x*.error|
00006300  62 6f 78 28 22 44 69 73  63 53 69 7a 65 32 3a 20  |box("DiscSize2: |
00006310  26 22 2b c3 7e 44 69 73  63 53 69 7a 65 32 25 29  |&"+.~DiscSize2%)|
00006320  0d 28 82 36 e7 20 28 44  69 73 63 53 69 7a 65 25  |.(.6. (DiscSize%|
00006330  3e 3d 28 35 31 32 2a 31  30 32 34 2a 31 30 32 34  |>=(512*1024*1024|
00006340  29 29 20 84 20 28 44 69  73 63 53 69 7a 65 32 25  |)) . (DiscSize2%|
00006350  3c 3e 30 29 20 8c 0d 28  8c 12 20 20 20 20 42 69  |<>0) ..(..    Bi|
00006360  67 44 69 73 63 25 3d b9  0d 28 96 05 cc 0d 28 a0  |gDisc%=..(....(.|
00006370  12 20 20 20 20 42 69 67  44 69 73 63 25 3d a3 0d  |.    BigDisc%=..|
00006380  28 aa 05 cd 0d 28 b4 10  f2 49 6e 69 74 42 6f 6f  |(....(...InitBoo|
00006390  74 52 65 63 0d 28 be 10  f2 49 6e 69 74 44 69 73  |tRec.(...InitDis|
000063a0  63 52 65 63 0d 28 c8 05  e1 0d 28 d2 05 3a 0d 28  |cRec.(....(..:.(|
000063b0  dc 25 dd a4 4e 65 77 4d  61 70 43 68 65 63 6b 28  |.%..NewMapCheck(|
000063c0  42 25 2c 43 25 29 3d ba  28 4e 65 77 43 68 65 63  |B%,C%)=.(NewChec|
000063d0  6b 25 29 0d 28 e6 05 3a  0d 28 f0 11 dd f2 49 6e  |k%).(..:.(....In|
000063e0  69 74 44 69 73 63 52 65  63 0d 28 fa 0f e3 20 49  |itDiscRec.(... I|
000063f0  25 3d 30 20 b8 20 36 33  0d 29 04 12 20 44 69 73  |%=0 . 63.).. Dis|
00006400  63 52 65 63 25 3f 49 25  3d 30 0d 29 0e 05 ed 0d  |cRec%?I%=0.)....|
00006410  29 18 11 c8 8e 20 53 65  63 53 69 7a 65 25 20 ca  |).... SecSize% .|
00006420  0d 29 22 1b 20 c9 20 32  35 36 20 3a 20 4c 6f 67  |.)". . 256 : Log|
00006430  32 53 65 63 53 69 7a 65  25 3d 38 0d 29 2c 1b 20  |2SecSize%=8.),. |
00006440  c9 20 35 31 32 20 3a 20  4c 6f 67 32 53 65 63 53  |. 512 : Log2SecS|
00006450  69 7a 65 25 3d 39 0d 29  36 1c 20 c9 20 31 30 32  |ize%=9.)6. . 102|
00006460  34 3a 20 4c 6f 67 32 53  65 63 53 69 7a 65 25 3d  |4: Log2SecSize%=|
00006470  31 30 0d 29 40 3d 20 7f  20 85 20 30 2c 22 45 72  |10.)@= . . 0,"Er|
00006480  72 6f 72 2c 20 73 65 63  74 6f 72 20 73 69 7a 65  |ror, sector size|
00006490  20 6d 75 73 74 20 62 65  20 32 35 36 2c 35 31 32  | must be 256,512|
000064a0  20 6f 72 20 31 30 32 34  20 62 79 74 65 73 22 0d  | or 1024 bytes".|
000064b0  29 4a 05 cb 0d 29 54 1b  44 69 73 63 52 65 63 25  |)J...)T.DiscRec%|
000064c0  3f 30 3d 4c 6f 67 32 53  65 63 53 69 7a 65 25 0d  |?0=Log2SecSize%.|
000064d0  29 5e 1a 44 69 73 63 52  65 63 25 3f 31 3d 53 65  |)^.DiscRec%?1=Se|
000064e0  63 73 50 65 72 54 72 6b  25 0d 29 68 15 44 69 73  |csPerTrk%.)h.Dis|
000064f0  63 52 65 63 25 3f 32 3d  48 65 61 64 73 25 0d 29  |cRec%?2=Heads%.)|
00006500  72 1e 44 69 73 63 52 65  63 25 21 26 43 3d 49 6e  |r.DiscRec%!&C=In|
00006510  64 52 6f 6f 74 44 69 72  41 64 64 25 0d 29 7c 1a  |dRootDirAdd%.)|.|
00006520  44 69 73 63 52 65 63 25  21 26 31 30 3d 44 69 73  |DiscRec%!&10=Dis|
00006530  63 53 69 7a 65 25 0d 29  86 1b 44 69 73 63 52 65  |cSize%.)..DiscRe|
00006540  63 25 21 26 32 34 3d 44  69 73 63 53 69 7a 65 32  |c%!&24=DiscSize2|
00006550  25 0d 29 90 1f 44 69 73  63 52 65 63 25 21 26 32  |%.)..DiscRec%!&2|
00006560  38 3d 4c 6f 67 32 53 68  61 72 65 53 69 7a 65 25  |8=Log2ShareSize%|
00006570  0d 29 9a 1c 44 69 73 63  52 65 63 25 21 26 31 34  |.)..DiscRec%!&14|
00006580  3d b3 28 26 31 30 30 30  30 29 2d 31 0d 29 a4 2a  |=.(&10000)-1.).*|
00006590  24 28 44 69 73 63 52 65  63 25 2b 26 31 36 29 3d  |$(DiscRec%+&16)=|
000065a0  22 53 43 53 49 44 69 73  63 22 2b c3 28 44 72 69  |"SCSIDisc"+.(Dri|
000065b0  76 65 25 2b 34 29 0d 29  ae 1b 44 69 73 63 52 65  |ve%+4).)..DiscRe|
000065c0  63 25 3f 26 32 32 3d 28  44 72 69 76 65 25 2b 34  |c%?&22=(Drive%+4|
000065d0  29 0d 29 b8 05 e1 0d 29  c2 05 3a 0d 29 cc 11 dd  |).)....)..:.)...|
000065e0  f2 49 6e 69 74 42 6f 6f  74 52 65 63 0d 29 d6 10  |.InitBootRec.)..|
000065f0  e3 20 49 25 3d 30 20 b8  20 35 31 31 0d 29 e0 0f  |. I%=0 . 511.)..|
00006600  20 42 6f 6f 74 25 3f 49  25 3d 30 0d 29 ea 05 ed  | Boot%?I%=0.)...|
00006610  0d 29 f4 15 21 42 6f 6f  74 25 3d 45 6e 64 44 65  |.)..!Boot%=EndDe|
00006620  66 65 63 74 25 0d 29 fe  17 21 44 65 66 65 63 74  |fect%.)..!Defect|
00006630  25 3d 45 6e 64 44 65 66  65 63 74 25 0d 2a 08 17  |%=EndDefect%.*..|
00006640  42 6f 6f 74 25 21 34 3d  45 6e 64 44 65 66 65 63  |Boot%!4=EndDefec|
00006650  74 32 25 0d 2a 12 19 44  65 66 65 63 74 25 21 34  |t2%.*..Defect%!4|
00006660  3d 45 6e 64 44 65 66 65  63 74 32 25 0d 2a 1c 0e  |=EndDefect2%.*..|
00006670  44 65 66 65 63 74 73 25  3d 30 0d 2a 26 05 e1 0d  |Defects%=0.*&...|
00006680  2a 30 04 0d 2a 3a 48 f4  20 54 68 69 73 20 66 75  |*0..*:H. This fu|
00006690  6e 63 74 69 6f 6e 20 72  65 74 75 72 6e 73 20 54  |nction returns T|
000066a0  52 55 45 20 69 66 20 41  44 46 53 20 69 73 20 74  |RUE if ADFS is t|
000066b0  68 65 20 62 69 67 20 76  65 72 73 69 6f 6e 2c 20  |he big version, |
000066c0  6f 72 20 46 41 4c 53 45  20 69 66 0d 2a 44 0e f4  |or FALSE if.*D..|
000066d0  20 69 74 20 69 73 6e 27  74 0d 2a 4e 10 dd 20 a4  | it isn't.*N.. .|
000066e0  42 69 67 53 43 53 49 46  53 0d 2a 58 17 20 20 20  |BigSCSIFS.*X.   |
000066f0  20 ea 20 4d 69 73 63 5f  49 6e 66 6f 50 74 72 25  | . Misc_InfoPtr%|
00006700  0d 2a 62 0b 20 20 20 20  ea 20 85 0d 2a 6c 14 20  |.*b.    . ..*l. |
00006710  20 20 20 ee 20 85 20 ea  3a f7 20 85 3a 3d a3 0d  |   . . .:. .:=..|
00006720  2a 76 2c 20 20 20 20 c8  99 20 22 53 43 53 49 46  |*v,    .. "SCSIF|
00006730  53 5f 4d 69 73 63 4f 70  22 2c 36 20 b8 20 4d 69  |S_MiscOp",6 . Mi|
00006740  73 63 5f 49 6e 66 6f 50  74 72 25 0d 2a 80 0b 20  |sc_InfoPtr%.*.. |
00006750  20 20 20 f7 20 85 0d 2a  8a 27 20 20 20 20 3d 28  |   . ..*.'    =(|
00006760  28 21 4d 69 73 63 5f 49  6e 66 6f 50 74 72 25 29  |(!Misc_InfoPtr%)|
00006770  20 80 20 26 32 30 30 29  3d 26 32 30 30 0d 2a 94  | . &200)=&200.*.|
00006780  04 0d 2a 9e 17 dd 20 f2  53 68 61 72 65 53 69 7a  |..*... .ShareSiz|
00006790  65 73 28 4c 32 41 25 29  0d 2a a8 0f e7 20 4c 32  |es(L2A%).*... L2|
000067a0  41 25 3c 31 33 20 8c 0d  2a b2 18 20 20 20 20 4c  |A%<13 ..*..    L|
000067b0  6f 67 32 53 68 61 72 65  53 69 7a 65 25 3d 30 0d  |og2ShareSize%=0.|
000067c0  2a bc 05 cc 0d 2a c6 1e  20 20 20 20 4c 6f 67 32  |*....*..    Log2|
000067d0  53 68 61 72 65 53 69 7a  65 25 3d 4c 32 41 25 2d  |ShareSize%=L2A%-|
000067e0  31 32 0d 2a d0 05 cd 0d  2a da 20 53 68 61 72 65  |12.*....*. Share|
000067f0  53 69 7a 65 25 3d 31 3c  3c 4c 6f 67 32 53 68 61  |Size%=1<<Log2Sha|
00006800  72 65 53 69 7a 65 25 0d  2a e4 05 e1 0d 2a ee 04  |reSize%.*....*..|
00006810  0d 2a f8 1a dd 20 a4 52  6f 75 6e 64 55 70 53 68  |.*... .RoundUpSh|
00006820  61 72 65 28 53 65 63 73  25 29 0d 2b 02 1f e7 20  |are(Secs%).+... |
00006830  4c 6f 67 32 53 68 61 72  65 53 69 7a 65 25 3d 30  |Log2ShareSize%=0|
00006840  20 8c 20 3d 53 65 63 73  25 0d 2b 0c 31 3d 28 28  | . =Secs%.+.1=((|
00006850  53 65 63 73 25 2b 53 68  61 72 65 53 69 7a 65 25  |Secs%+ShareSize%|
00006860  2d 31 29 81 53 68 61 72  65 53 69 7a 65 25 29 2a  |-1).ShareSize%)*|
00006870  53 68 61 72 65 53 69 7a  65 25 0d 2b 16 04 0d ff  |ShareSize%.+....|
00006880