> HDInit v1.16 J.G.Harston I&87:fx(0,1)<6:fx(130,0)=&FFFF"Must run on BBC I/O processor": fs%=fs:ver$="1.16" adfs%=:adfs%= adfs%:fs<>8:*FADFS hadfs%=:hadfs%= hadfs%:fs<>16:*HADFS fs%<>8:fs%<>16:fs%=8 ok%=:ok%= )ok%:"FX143,18,"+fs%:fs%=8:MOUNT 0 fs%=fs:hd%=(fs%-8)/2:init "err:end: ,&87:menu:end: @ end:: Tݤerr:::A%=(100):=-1 h init r0ctrl%31,mem%511,info%512:X%=ctrl%:Y%=X%256 |'safe%=:full%=:asm:info:*FX219,9   info Ebig%=0:hdsz%=0:rv%=0:A%=05114:info%!A%=0::dev$="IDE":hd%>3: "FADFS":Y%=?&DBC:!&F6=&BFFF:rv%=(&FFB9)255:!&F6=&8002:d4%=((&FFB9)128)/64+2:!&F6=&8008:A%=((&FFB9)6)/2:Y%=X%256:A%<>1:scsz%=256 /dev$="SCSIIDE --- MMC ",A%*4+1,4+(A%>0)):  ݤmenu EA$=" BBC "+dev$+"r"+~rv%,rv%>0)+" Hard Drive Initialiser "+ver$ #:A$'ĩA$+1,"=");8:DriveInfo .'"D: Select drive I: Investigate drive" *"S: Scan for size Z: Set drive size" G"F: Format drive W: Wipe data (";"on",safe%);"off",safe%);")" 4full%:safe%:17;full%:"R: Randomise data"; !full%:" Toggle width" $'6"Press a key or X to exit:"; &VA$=:9+"*DdIiFfWwRrSsXxZz",A$):13;32;13;:A$="*""*"A$:A$:A$="":A$="*" 0A$=(A$&DF) :A$="D":Drive:=0 DA$="F":Format:=0 NA$="I":Invest:=0 XA$="S":Scan:=0 bA$="W":safe%=safe%:=0 lA$="R":safe%:Random:=0 vA$="Z":SetSize:=0  A$=9:符-1:scsz%=768-scsz% A$=9:-1:full%=full%  =A$="X" DriveInfo (hd%<4:dev%=hd%d4%dev%=hd%8:d4%=4 9" Current drive: ";~hd%;" ("dev$" device ";dev%;")"; )'" Device width: ";scsz%32;" bits" @full%:" Model: "str(info%+54,20)'11;str(info%+74,20) )full%:" Firmware: "str(info%+46,8) *full%:" Serial: "str(info%+20,20) A'" Total sectors: &";h0(hdsz%,8)" (";(hdsz%/204.8)/10;"M)"  Q" Physical size: C:&";h0(info%!&02,4);" H:";d(info%?&06,2);" S:";info%?&0C Q" Logical size: C:&";h0(info%!&6C,4);" H:";d(info%?&6E,2);" S:";info%?&70  B" 8-bit Size: ";d(hdsz%4,8);"K (";(hdsz%/409.6)/10;"M)" *Jhd%<4:Info(hd%,16-d4%,&200000,"ADFS")Info(hd%,12,&1000000,"HADFS") 434+dev$,"="): H"Info(d%,m%,sz%,fs$):d%=d%m% R%" ";fs$;" drives:";:hsz%=hdsz%: \A%=sz%:hsz%"`":A$=(A$-32) ,"0123456789AB",A$):hd%=("&"+A$):info   Invest "A%=05114:mem%!A%=0::big%= dev$="SCSI":hd%<4:A%=scsi(&1A,mem%,22,0,hd%):info%?2=mem%?14:info%!3=mem%?13:info%?6=mem%?15:info%?12=33:info%!&6C=info%!2:info%!&6E=info%?6:info%!&70=info%?12:hdsz%=info%!2*info%?6*info%?12:"MOUNT": =dev$="IDE":!addr%=mem%:A%=dev%*16:nm%?1=scsz%256-1:id% AA%=0255:info%?(A%*2)=mem%?A%:info%?(A%*2+1)=mem%?(A%+256): info%?3+info%?109+info%?115=0:info%?109=info%?116:info%?115=info%?108:A%=(256*info%?109+info%?108)*info%?110*info%?112:info%?3=(A%((info%?6)*(info%?12)))256 7info%?&74=0:big%=:info%?&74=info%?&72:info%?&72=0 $info%?&79=0:info%?&79=info%?&6C $hdsz%=info%!&78 . B Scan L*"Scanning drive ";hd%:sec%=&800:info V0sec%=sec%+sec%:scan(sec%)<>0sec%>&1FFFFF `step%=sec%2:dir%=-1: j'sec%=sec%+step%*dir%:A%=scan(sec%) t&step%=step%2:A%=0:dir%=1dir%=-1 ~step%<1:hdsz%=sec%-1:  2ݤscan(sec%):13;"Drive size: ";sec%4;"K "; ,adfs%:=scsi(&08,mem%,1,sec%-1,hd%)=-1  SetSize F"Enter drive size, use , &, K or M :"A$ "info:big%=0:hdsz%=rdsz(A$): Format:hdsz%<1:Invest 1size%=hdsz%:max%=&200000:hd%>3:max%=&1000000 4d4%=2:A%=hd%=1hd%=3A%=hd%=1hd%=2hd%=3hd%>5 9A%:A%=hd%:size%=size%-max%:A%=A%-1:(A%3)=0A%=d4%  size%>max%:size%=max% 7size%<0:"No space for drive ";~hd%;:delay(200): /size%<&1000:"This appears to be a floppy" (B"Format ";"H",hd%>3);"ADFS drive ";~hd%;" to ";sz(size%);8 2QA$="":(hd%(7-d4%))=0:"Leave space for ";"H",hd%<4);"ADFS system? ";:""A$ hdsz%:part%=hdsz% FQpart%:hd%>3:"ADFS space (";sz(part%);"): ";:""A$:A$<>"":part%=rdsz(A$) PR"Format? Enter YES to confirm: "A$:A$<>"YES":"Not formatted";:delay(200): Zhd%<4:InitADFS d(hd%>3:InitHADFS:part%:hdsz%=part% n InitHADFS !X%=1:A%=14:&FFF1 ,A%=06:X%?A%=(X%?A%15)+10*(X%?A%16): !?X%<81:?X%=19+?X%?X%=?X%-81 1today%=(?X%16)+8*X%?2+256*X%?1+4096*(?X%15) 6start%=2:part%:start%=7:size%>&FFFF:start%=part% -dskID%=(65535):size%=&10000:size%=&FFFF  clear safe%:read(&46,hd%) $$mem%="IDEDISK"+~hd%+" " $(mem%+16)=0+"(C)JGH"+0 mem%!24=dskID% mem%!26=today% mem%!28=size% 7size%<&10000:mem%?30=&11:msz%=2mem%?31=&80:msz%=3 "-mem%!(32+0*msz%)=&02:mem%!(32+1*msz%)=&44 ,3mem%!(32+2*msz%)=&4A:mem%!(32+3*msz%)=size%-&4A 6+mem%!(32+4*msz%)=&00:mem%!(32+5*msz%)=0 @opart%:mem%?31=mem%?31&41:mem%!32=start%:mem%!(32+msz%)=size%-start%:mem%!(32+2*msz%)=0:mem%!(32+3*msz%)=0 Jwrite(&46,hd%) ^ clear hsafe%:read(&47,hd%) r$mem%="$ " |mem%!10=&47:mem%!14=0 mem%!16=dskID%:mem%!20=0 &FFFF:mem%!10=0:mem%!24=0:mem%!28=&47:mem%?12=&80 write(&47,hd%)  clear safe%:write(&48,hd%) safe%:write(&49,hd%) <"Drive ";~hd%;" initialised to ";sz(size%):delay(200)  InitADFS  clear  mem%!0=7 part%:mem%!3=&4A mem%!252=size% &mem%?255=0:mem%?255=sum 0write(0,hd%) D clear Nmem%!0=size%-7 X&part%:mem%!0=&3F:mem%!3=size%-&4A bmem%!251=(65535) lmem%?253=0 vmem%?254=3-3*(part%<>0) mem%?255=1:mem%?255=sum write(1,hd%) S%=26:clear (safe%:read(S%,hd%):clrdir(S%*4-3) "S%=2:$mem%=0+"Hugo":mem%?5=0 $S%=6:$(mem%+204)="$":mem%!214=2 (S%=6:$(mem%+217)="$":$(mem%+227)="" *S%=6:$(mem%+250)=0+"Hugo":mem%?255=0 write(S%,hd%): /"Drive ";hd%;" initialised to ";sz(size%) F"**WARNING** You *MUST* reset ADFS to"'"prevent disk corruption." delay(200): %clear:A%=02554:mem%!A%=0::  ,clrdir(O%):A%=O%25526:mem%?A%=0:: 4ݤsum:sum%:sum%=255 >GA%=2540-1:sum%=(sum%+sum%256)255:sum%=sum%+mem%?A%::=sum%255 R Random \+"Randomise contents of drive ";hd%;"?" fK"Enter YES to confirm: "A$:A$<>"YES":"Not randomised";:delay(200): p("Press ESCAPE to terminate "; z sec%=0:6,8);h0(sec%,6); /A%=0255:mem%?A%=(255)::write(sec%,hd%) sec%=sec%+1:0: Hwrite(sec%,drv%):cmd%=wr%:drv%<4:scsi(&0A,mem%,1,sec%,drv%)=0: Gread(sec%,drv%):cmd%=rd%:drv%<4:scsi(&08,mem%,1,sec%,drv%)=0: j!addr%=mem%:!sc%=sec%:A%=sc%?2:sc%?2=sc%?0:sc%?0=A%:?dv%=(d4%*32)128:?nm%=1:nm%?1=0:drv%>3:?dv%=drv% A%=cmd%:  delay(T%):T%=+T%:>T%: :ݤscsi(cmd%,addr%,num%,sect%,drv%):sect%>&1EFFFF:=&21 fs%:fs%=fs:fs%<>8:*FADFS DX%?0=0:X%!1=addr%:X%?5=cmd%:X%?6=drv%*32+((sect%&1F0000)65536) 9X%?7=((sect%&FF00)256):X%?8=sect%:X%!9=num%:X%!11=0 2A%=114:&FFF1:A%=?X%:fs%<>8:"FX143,18,"+fs% =A% . ݤfs:A%,Y%,E%:=(&FFDA)&FF 85ݤfx(A%,X%):Y%:Y%=X%256:=((&FFF4)&FFFF00)256 L#ݤh0(A%,N%)="0000000"+~A%,N%) V"ݤd(A%,N%)=" "+A%,N%) `ݤstr(A%,N%):A$: j"A%?1>31:A$=A$+A%?1A$=A$+"." t ?A%>31:A$=A$+?A%A$=A$+"." ~A%=A%+2:N%=N%-2:N%<1:=A$ +ݤsz(A%):=(A%4)+"K ("+(A%4096)+"M)" ݤrdsz(A$):A$,1)="&":=A$ !A$,1)="K"A$,1)="k":=A$*4 $A$,1)="M"A$,1)="m":=A$*4096 =A$256 asm:mc%=mc%:mc%: >mc%409:addr%=&80:dv%=&84:sc%=&85:nm%=&88:cmd%=&8A:tmp=&8B ?IDEdata=&FC40:IDEerror=&FC41:IDEcount=&FC42:IDEsector=&FC43 DIDEcylinder=&FC44:IDEhead=&FC46:IDEstatus=&FC47:IDEcommand=&FC47 ,scsz%=256:!IDEdata<>IDEdata!8:scsz%=512 dP=01:P%=mc%:[OPT P*2 n>.id%:TAY:.idlp:LDA &FF:BMI idescape:LDA IDEstatus:BMI idlp x0TYA:#16:STA IDEhead:LDA #&EC:STA IDEcommand