Laser DOS V1.0
--------------
The
Volume Table of Contents, VTOC, is always located at physical address track 17, sector 0. Tracks are formatted sequentially in ascending order.
This example is based on a disc containing a single Hello World style BASIC program.
Here is the sample VTOC
Code: Select all
0000EE00 00 11 0D 03 00 00 FE 00 00 00 00 00 00 00 00 00
0000EE10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0000EE20 00 00 00 00 00 00 00 7A 00 00 00 00 00 00 00 00
0000EE30 12 01 00 00 28 0E 00 01 00 00 00 00 FF FC 00 00
0000EE40 FF FC 00 00 FF FC 00 00 FF FC 00 00 FF FC 00 00
0000EE50 FF FC 00 00 FF FC 00 00 FF FC 00 00 FF FC 00 00
0000EE60 FF FC 00 00 FF FC 00 00 FF FC 00 00 FF FC 00 00
0000EE70 FF FC 00 00 FF FC 00 00 FF FC 00 00 00 00 00 00
0000EE80 3F FC 00 00 FF FC 00 00 FF FC 00 00 FF FC 00 00
0000EE90 FF FC 00 00 FF FC 00 00 FF FC 00 00 FF FC 00 00
0000EEA0 FF FC 00 00 FF FC 00 00 FF FC 00 00 FF FC 00 00
0000EEB0 FF FC 00 00 FF FC 00 00 FF FC 00 00 FF FC 00 00
0000EEC0 FF FC 00 00 FF FC 00 00 FF FC 00 00 FF FC 00 00
0000EED0 FF FC 00 00 FF FC 00 00 00 00 00 00 00 00 00 00
0000EEE0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0000EEF0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
This is completely "borrowed" from AppleDOS 3.3! The only difference is that AppleDOS 3.3 has 16 sectors, and LaserDOS has 14.
So much so, that track 0 is marked as in use - which is where AppleDOS resides!
Code: Select all
Offset Detail
-------------------
$00 Unused
$01 Track number of first directory entry [$11==17]
$02 Translated sector of first directory entry [$0D==13]
$03 DOS INIT version (hint $03 == AppleDOS 3.3 ;))
$04-$05 Unused
$06 Disc Volume number - always $FE==254, as formatted
$07-$26 Unused
$27 Number of track+sector pairs. ($7A==122 for 256 byte sectors)
$28-$2F Unused
$30 Last track sectors allocated ($12==18)
$31 Allocation direction (+1 or -1)
$32-$33 Unused
$34 Number of tracks per disc ($28==40)
$35 Number of sectors per track ($0E==14)
$36-$37 Little endian bytes per sectors ($100==256)
$38-$3B Sector allocation map for track 0
$3C-$3F Sector allocation map for track 1
...
$D4-$D7 Sector allocation map for track 39
$D8-$FF Unused
A few interesting things here. Laser DOS internally uses a lookup table to translate from physical sector address to Laser DOS sector address.
This is just an attempt to speed up disc access by skewing sectors to hopefully fall in line next.
The bitmap for sectors uses bit on to indicate available, bit off to indicate allocated. Sectors are allocated in a big endian format, starting from 0.
Code: Select all
Physical Sector 00 01 02 03 04 05 06 07 08 0A 0B 0C
Bitmap 80 40 20 10 08 04 02 01 80 40 20 10
The Laser DOS sector tranlsation is
Code: Select all
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D
00 0D 0B 09 07 05 03 01 02 0C 0A 08 06 04
Now the pointer to the first directory entry is calculated as Track 17 - Translated Sector 0D, which is physical sector 4.
The directory entry for this demo disc is
Code: Select all
0000F200 00 11 0C 00 00 00 00 00 00 00 00 12 0D 02 48 45 ..............HE
0000F210 4C 4C 4F 5E 5E 5E 5E 5E 5E 5E 5E 5E 5E 5E 5E 5E LLO^^^^^^^^^^^^^
0000F220 5E 5E 5E 5E 5E 5E 5E 5E 5E 5E 5E 5E 02 00 00 00 ^^^^^^^^^^^^....
0000F230 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0000F240 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0000F250 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0000F260 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0000F270 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0000F280 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0000F290 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0000F2A0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0000F2B0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0000F2C0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0000F2D0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0000F2E0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0000F2F0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
The details for this directory entry is
Code: Select all
Offset Details
---------------
$00 Unused
$01 Track number of next directory sector ($11==17)
$02 Translated sector number of next entry
$03-$0A Unused
$0B-$2D First file entry
...
$DD-$FF Seventh file entry
The file entry is detailed as
Code: Select all
Offset Details
---------------
$00 Track of first track+sector list ($12==18)
If this contains $FF this is a deleted entry
If this contains $00 this is an unused entry (which is why
track 0 is never used for data!)
$01 Translated sector of first track+sector list ($0C==12)
$02 File types
$00 TEXT file
$02 BASIC program file
$04 BINARY image file
+$80 Protected file
$03-$20 Filename padded with character $5E. This is Laser DOS only,
as it's the screen "space" fill character in BASIC
$21-$22 Length of file in sectors, little endian.
Still no sign of the program yet ... there's still further to go!
Using the Track+Sector list, you will get Track 18, physical sector 6. As the length is sectors is only 2 - it is assumed no track+sector list is needed - so it points to the actual short program
Code: Select all
00010200 39 00 24 50 0A 00 B2 20 54 48 49 53 20 49 53 20 9.$P... THIS IS
00010210 41 20 54 45 53 54 20 42 41 53 49 43 20 50 52 4F A TEST BASIC PRO
00010220 47 52 41 4D 00 38 50 14 00 BA 22 48 65 6C 6C 6F GRAM.8P..."Hello
00010230 20 57 6F 72 6C 64 21 22 00 00 00 FF 00 00 00 00 World!"........
00010240 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00010250 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00010260 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00010270 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00010280 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00010290 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000102A0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000102B0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000102C0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000102D0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000102E0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000102F0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
This is a normal BASIC program. The first word is the length of the program, here $0039. BASIC programs are loaded to $5001 - so the rest of the data s just copied there.
Next time - a look at a larger file with a track+sector list.