Hey guys,
I need a quick basic prog that will do the BAM calculation of blocks free on a 1541 disk. I know that the 4th byte of the BAM (T18, S0), added up is supposed to give this value, but Im way off for some reason. On the test/demo disk for the 1541, i keep coming up with 492 blocks free, instead of the 558 that is presented by the Commodore 64/128.
If you can help, thanks in advance.
10 a=0:c=1
20 open 15,8,15
30 print#15,"I0"
40 input#15,EN$,EM$,ET$,ES$
50 if EN$<>"00" goto 170
60 open2,8,2,"#"
70 print#15,"U1;2;0;18;0
80 input#15,EN$,EM$,ET$,ES$
90 if EN$<>"00" goto 170
95 get#2,B$
100 for i=1to140
110 get#2,b$
120 if b$="" then b$=chr$(0)
130 if c=4 then a=a+asc(b$)
140 if i=72 then a=a-asc(b$)
150 c=c+1:if c=5 then c=1
160 next i
170 close2:close15
180 print a
quick and dirty but it does the job. you have to subtract track 18 from the total of all tracks, this is done in line 140.
Dude, you rock. Thank you very much!
Edit - running it, I get DOS error 70 ( NO CHANNEL AVAILABLE ). Im running it under VICE, so maybe that has something to do with it. If you have any edits, let me know, but thanks again
Originally I tested it on a C-128 in C-64 mode with a 1541-II drive. Just tried it on WinVice 1.22 with a 1541 test/demo D64 attached to drive and it worked perfectly. I used the 1541 test /demo D64 from here:
http://www.zimmers.net/anonftp/pub/cbm/demodisks/drives/index.html
Heh... suffice to say the program works... apparently my eyesight doesnt (user typing error)... Thanks again!