Skip to content

Instantly share code, notes, and snippets.

@mnaberez
Created June 12, 2018 17:34
Show Gist options
  • Save mnaberez/a6e653d5e8a22c87cb7165de1c913ffd to your computer and use it in GitHub Desktop.
Save mnaberez/a6e653d5e8a22c87cb7165de1c913ffd to your computer and use it in GitHub Desktop.
CBM BASIC program that reads a real disk and creates a D80 image
;d80 read ==0801==
5 input"source unit";su
6 input"destination unit";du
7 input"image filename";f$
30 open2,du,2,f$+",p,w"
35 open15,su,15
40 open3,su,3,"#"
45 lt=77
50 for t=1 to lt
60 if t>=1 and t<=39 then ls=28
70 if t>=40 and t<=53 then ls=26
80 if t>=54 and t<=64 then ls=24
90 if t>=65 and t<=77 then ls=22
100 for s=0 to ls:print"{down}t";t;"s";s
110 o$="u1":print#15,o$;3;0;t;s
115 gosub1000
120 o$="b-p":print#15,o$;3;0
125 gosub1000
130 for by=0 to 255
140 get #3, b$
145 gosub 1500
150 if b$="" then b$=chr$(0)
160 print#2,b$;
170 next by
200 next s : next t
205 print f$;" written to unit";du
210 goto 2000
1000 rem check error
1005 input#15,en$,em$,et$,es$
1010 print" "o$" "en$" "em$" "et$" "es$
1020 if en$<>"00" then end
1025 return
1500 rem check status
1501 return:rem disabled
1505 ok=0
1510 if t=lt and s=ls then ok=64
1515 if st<>ok then print"st: expected";ok;" got";st : goto 2000
1520 return
2000 rem done
2005 close2:close3
2006 print#15,"i0":close15
2007 end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment