-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1541.hdr.asm
More file actions
63 lines (59 loc) · 4.66 KB
/
1541.hdr.asm
File metadata and controls
63 lines (59 loc) · 4.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
; -------------------------------------------------------------------------------------------------------------- ;
; VIC 1541 - HEADER Block
; -------------------------------------------------------------------------------------------------------------- ;
; The HEADER block is written ONLY once during FORMAT
; -------------------------------------------------------------------------------------------------------------- ;
HDR_SYNC = $00 ; indicates HEADER is coming
HDR_SYNC_VAL = $ff ; 10 ore more 1-bits
HDR_SYNC_COUNT = $05 ; NUMSYN
; -------------------------------------------------------------------------------------------------------------- ;
; -------------------------------------------------------------------------------------------------------------- ;
; HDR_BLOCK on Disk is GCR encoded to avoid two subesquent 0-bits and more than 9 subsequent 1-bits (SYNC)
; -------------------------------------------------------------------------------------------------------------- ;
; the original 8 8-bit bytes are
; -------------------------------
; 1 header block ID char
; 1 header checksum
; 1 sector number
; 1 track number
; 2 disk id
; 2 off bytes
; -------------------------------
; 8 BIN bytes ---> 10 GCR bytes
; -------------------------------------------------------------------------------------------------------------- ;
HDR_BLOCK = $00 ;
; -------------------------------------------------------------------------------------------------------------- ;
HDR_BLOCK_ID = $00 ; flag: this is a HEADER block
HDR_BLOCK_ID_VAL = HBID_DFLT ; normally $08
; -------------------------------------------------------------------------------------------------------------- ;
; checksum: calculated by EORing HDR_BLOCK_TRACK / HDR_BLOCK_SECTOR / HDR_BLOCK_ID
; -------------------------------------------------------------------------------------------------------------- ;
HDR_BLOCK_CRC = $01 ; ensures that a HEADER block was read correctly
; -------------------------------------------------------------------------------------------------------------- ;
; the 1541 has no TRACK_00_DETECTOR (exception: 1541C)
; after powering up and getting a disk command the 1541 reads a SECTOR HEADER to find out where the head is positioned
; -------------------------------------------------------------------------------------------------------------- ;
HDR_BLOCK_SECTOR = $02 ; number of this particular SECTOR
HDR_BLOCK_TRACK = $03 ; number of this particular TRACK
; -------------------------------------------------------------------------------------------------------------- ;
; checked against Master Dik ID to ensure that Disks are not swapped
; -------------------------------------------------------------------------------------------------------------- ;
HDR_BLOCK_DISK_ID = $04 ; from the format CMD (N0:title,cc)
HDR_BLOCK_DISK_ID_CHR2 = $04 ; -------------------------------^
HDR_BLOCK_DISK_ID_CHR1 = $05 ; ------------------------------^
; -------------------------------------------------------------------------------------------------------------- ;
; $02 OFF bytes are used to complete $08 bytes
; a multiple of $04 bytes is needed to create a multiple of $05 GCR-bytes
; -------------------------------------------------------------------------------------------------------------- ;
HDR_BLOCK_OFF = $06 ; DOS padding bytes during initial format - never referenced again
HDR_BLOCK_OFF1 = $06 ;
HDR_BLOCK_OFF2 = $07 ;
HDR_BLOCK_OFF_VAL = $0f ;
; -------------------------------------------------------------------------------------------------------------- ;
; -------------------------------------------------------------------------------------------------------------- ;
; HEADER gap (GAP1)
; -------------------------------------------------------------------------------------------------------------- ;
HDR_GAP = $08 ; give DOS enough time to set-up for reading the following data block
HDR_GAP_VAL = $55 ;
HDR_GAP_COUNT = $09 ; fix GAP1 length
; -------------------------------------------------------------------------------------------------------------- ;