Re: Pointer at the start of a BASIC line: what good is it?

From: afachat_at_gmx.de
Date: Sat, 06 Nov 2021 19:50:21 +0100
Message-ID: <6035495.lOV4Wx5bFT_at_euler>
On Dienstag, 2. November 2021 18:57:11 CET Spiro Trikaliotis wrote:

>
> The "channel" 0 is for LOAD, channel "1" is for SAVE in the disk drives.
> These are handled differently than the other channels 2-14. 15 was
> special as command/error channel, as you already wrote.
>
> You see this difference if you want to read the dir of a floppy.
> OPEN 1,8,0,"$" will work, OPEN 1,8,2,"$" (or "$,P", "$,R" or similar)
> will NOT work.
>

One little known fact of Commodore DOS is, that if you do OPEN 1,8,2,"$,R"
you can actually read the contents of the directory "file".

I.e. you get the contents of sectors 18/00 (BAM), 18/01 (first directory block)
etc.

Just tried it with this program (80 column screen, or change "8" to "16" in
lines 310 and 320.


---
100 open 15,8,15
110 open 1,8,2,"$,r"
120 gosub 1000
200 l=0

210 i=0
220 print ":";
230 a=l/256:gosub 2000
240 a=l and 255:gosub 2000

250 a=0:get #1,a$:if len(a$)>0 then a=asc(a$)
260 s=st
270 print " ";
280 gosub 2000
290 if s > 0 then 400
300 i=i+1
310 if i<16 then 250
320 l=l+16
330 print
340 goto 210

400 close 1
410 print
420 gosub 1000
450 close 15

999 end

1000 input#15,a,b$,c,d
1010 print a "," b$ "," c "," d
1030 return

2000 d=a/16
2010 d=d and 15
2020 gosub 2050
2030 d=a and 15
2050 d$=chr$(48+d)
2060 if d>9 then d$=chr$(55+d)
2070 print d$;
2080 return

----
Received on 2021-11-06 20:01:33

Archive generated by hypermail 2.3.0.