Example TR-DOS Basic file
Jump to navigation
Jump to search
This is an example TR-DOS BASIC file an encoded on disk. the file listing is below.
Basic file listing
10 DIM a$(10(10.0),5(5.0)) 20 DIM b(2(2.0),3(3.0)) 30 FOR a=1(1.0) TO 10(10.0) 40 LET a$(a,3(3.0))="x" 50 LET a$(a,4(4.0))="y" 60 LET a$(a,5(5.0))="z" 70 NEXT a 80 LET x=10(10.0) 90 LET r$="test string" 100 RANDOMISE USR 15619(15619.0): REM : SAVE "basic" LINE 300 110 RANDOMISE USR 15619(15619.0): REM : SAVE "code" CODE 30000,2000 120 RANDOMISE USR 15619(15619.0): REM : SAVE "cdata" DATA a$() 130 RANDOMISE USR 15619(15619.0): REM : SAVE "ndata" DATA b() 140 REM RANDOMISE USR 15619: REM : FORMAT "testdisk"
This is the directory entry for a small basic program with variables defined in it when it was saved. The Raw dirent is as follows:
62 61 73 69 63 20 20 20 42 EF 01 68 01 02 00 01 basic B..h....
Offset (dec) | Offest (hex) | Bytes | Content | Description |
---|---|---|---|---|
0-7 | 00-07 | 62 61 73 69 63 20 20 20 | "basic " | Filename |
8 | 08 | 43 | "B" (Basic) | File type |
9-10 | 09-0A | EF 01 | 495 bytes | File size including variables area minus area at the end containing the line number. |
11-12 | 0a-0b | 68 01 | 360 bytes | Pointer to the start of the variables area in the file. |
13 | 0C | 08 | 8 sectors long | Number of sectors the file uses |
14 | 0D | 02 | Start sector 2 | Sector the file starts from (Note, sectors number from 0 regardless of the actual disk layout) |
15 | 0E | 01 | Start logical track 1 | Logical Track the file starts from. (Note, the tracks are encoded as CH, so for DS drives, track 0=C0H0, 1=C0H1, 2=C1H0, ect) |