Created
June 12, 2018 17:28
-
-
Save mnaberez/7c602679af7bfd3c2ef2090dae42b380 to your computer and use it in GitHub Desktop.
CBM BASIC program that writes a D82 image to a real disk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;d82 write ==0801== | |
5 input"source unit";su | |
6 input"destination unit";du | |
7 input"image filename";f$ | |
30 open2,su,2,f$+",p,r" | |
35 open15,du,15 | |
40 open3,du,3,"#" | |
45 lt=154 | |
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 | |
91 if t>=78 and t<=116 then ls=28 | |
92 if t>=117 and t<=130 then ls=26 | |
93 if t>=131 and t<=141 then ls=24 | |
94 if t>=142 and t<=154 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 #2, b$ | |
145 gosub 1500 | |
150 if b$="" then b$=chr$(0) | |
160 print#3,b$; | |
170 next by | |
180 o$="u2":print#15,o$;3;0;t;s | |
185 gosub1000 | |
200 next s : next t | |
205 print f$;" restored 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