> Cyl1to0 9 Move data from cylinder-1 based to cylinder-0 based : (3size%=(--2048)&FF00: mem% size%-1:off%=&100 27assm:?IDEcommand=&08:?IDEstatus<128: Initialise size%:len%=size%256 n@13;"Reading &";~ptr%+off%;:Read(mem%,len%,ptr%+off%,dev%) x713;"Writing &";~ptr%;:Write(mem%,len%,ptr%,dev%) 1ptr%=ptr%+len%:ptr%>=tot%:13;"Finished"10  : !Read(mem%,len%,lau%,dev%): v!addr%=mem%:sec%?2=lau%:sec%?1=(lau%&FF00)256:sec%?0=((lau%&FF0000)65536)(dev%*64):?num%=1:num%?1=sz%:A%=rd% 3mem%=mem%+256:len%=len%-1:lau%=lau%+1:len%<1: : "Write(mem%,len%,lau%,dev%): v!addr%=mem%:sec%?2=lau%:sec%?1=(lau%&FF00)256:sec%?0=((lau%&FF0000)65536)(dev%*64):?num%=1:num%?1=sz%:A%=wr% 3mem%=mem%+256:len%=len%-1:lau%=lau%+1:len%<1: : : #ݤh0(A%,N%)="0000000"+~A%,N%) "ݤd(A%,N%)=" "+A%,N%) :  id: A% "/ A%=0 255 4:mem%!A%=0:mem%!(A%+256)=0: ,+!addr%=mem%:Y%=dev%*16:num%?1=sz%: id% 6:big%=:mem%?&3A=0:big%=:mem%?&3A=mem%?&39:mem%?&39=0 @mem%?&101+mem%?&136+mem%?&139=0:mem%?&136=mem%?&3A:mem%?&139=mem%?&36:tot%=(256*mem%?&136+mem%?&36)*mem%?&37*mem%?&38:mem%?&101=(tot%((mem%?3)*(mem%?6)))256 J3tot%=(256*mem%?&136+mem%?&36)*mem%?&37*mem%?&38 T ^: hideInit:ideSize(64,3): rideSize(spt%,hds%) |?&FC42=spt%:?&FC43=spt% 2?&FC46=hds%:?&FC47=&91: Initialise parameters  :  assm mc%=mc%:mc%=0:mc% 511 addr%=&80:sec%=&85:num%=&88 ?IDEdata=&FC40:IDEerror=&FC41:IDEcount=&FC42:IDEsector=&FC43 DIDEcylinder=&FC44:IDEhead=&FC46:IDEstatus=&FC47:IDEcommand=&FC47  P=0 1 P%=mc%:[OPT P*2 .id% LDA &FF:BMI idescape LDA IDEstatus:BMI id% %TYA: #16:STA IDEhead :\ Device -LDA #&EC :STA IDEcommand :\ &EC=Identify LDY #0:LDX #1:STX num% &CLC:JMP TransferLoop 0 .idescape :RTS D: N.WaitForData X"LDA &FC47: #8:BEQ WaitForData bLDA &FC47:RTS l: v.WaitNotBusy 6PHP:JSR L806F :\ Get IDE status ; #&80:BNE WaitNotBusy+1:PLP :\ Wait for IDE not busy BIT &CC:RTS :  .L806F PHP:LDA &FC47:STA &8D !LDA &FC47:CMP &8D:BNE L806F+1  PLP:RTS : ..rd%:LDA #&08:STA &84:CLC:BCC CommandStart ..wr%:LDA #&0A:STA &84:SEC:BCS CommandStart : ;.CommandStart :\ C=R/W, &8E/F=>block 4LDA #&7F:STA &8E:LDA #0:STA &8F :\ &8E/F=>block  PHP:JSR SetGeometry:PLP .CommandLoop  LDX #2:.Twice *BJSR SetSector:LDY #0 :\ Set sector, count, command 4.TransferLoop >)JSR WaitForData: #&21:BNE TransError H\.TransferLoop R%BIT &CD:\BVS TransTube:BCC IORead \ .IOWrite f5LDA (&80),Y:STA &FC40:LDA num%+1:BEQ TransferByte p:INC &81:LDA (&80),Y:STA &FC48:DEC &81:BRA TransferByte z .IORead 5LDA &FC40:STA (&80),Y:LDA num%+1:BEQ TransferByte :INC &81:LDA &FC48:STA (&80),Y:DEC &81:BRA TransferByte : .TransferByte 5LDA &FC47: #8:BEQ TransError :\ Run out of data ;INY:BNE TransferLoop:\INC &81 :\ Loop for 256 bytes 3LDA &FC47: #&21:BNE TransError:\ Error occured DEX:BNE Twice 8INC &87:BNE TransCount :\ Increment sector "INC &86:BNE TransCount:INC &85 .TransCount CLC:LDA (&8E),Y: #63:ADC #1:STA &FC43 :\ Set sector b0-b5 ADEY:LDA (&8E),Y:ADC #0:STA &FC44 :\ Set sector b8-b15 EDEY:LDA (&8E),Y:PHA: #&3F:ADC #0:STA &FC45 :\ Set sector b16-b20 =PLA:ROL A:ROL A:ROL A:ROL A :\ Get Drive 0/1 >INY:INY: (&8E),Y: #&02: (&8E),Y :\ Merge Drive and Head FJSR SetDrive:DEY:DEY:DEY:LDA (&8E),Y :\ Get command &08 or &0A .SetCommand < #2:PHA: #2:LSR A:LSR A :\ Copy ~b1 into Cy KPLA:ASL A:ASL A:ASL A:A #&20 :\ Translate CS->&20 or CC->&30 FSTA &FC47:PLP:RTS :\ Set command &08 or &0A :  .SetDrive GROL A:ROL A:ROL A: #&13:STA &FC46:RTS :\ Set device + sector b6-b7  : ]: