ugBASIC 1.18
An isomorphic BASIC language compiler for retrocomputers
Loading...
Searching...
No Matches
d64.h
Go to the documentation of this file.
1#ifndef __UGBASIC_D64__
2#define __UGBASIC_D64__
3
4/*****************************************************************************
5 * ugBASIC - an isomorphic BASIC language compiler for retrocomputers *
6 *****************************************************************************
7 * Copyright 2021-2026 Marco Spedaletti (asimov@mclink.it)
8 *
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
12 *
13 * http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 *----------------------------------------------------------------------------
21 * Concesso in licenza secondo i termini della Licenza Apache, versione 2.0
22 * (la "Licenza"); è proibito usare questo file se non in conformità alla
23 * Licenza. Una copia della Licenza è disponibile all'indirizzo:
24 *
25 * http://www.apache.org/licenses/LICENSE-2.0
26 *
27 * Se non richiesto dalla legislazione vigente o concordato per iscritto,
28 * il software distribuito nei termini della Licenza è distribuito
29 * "COSì COM'è", SENZA GARANZIE O CONDIZIONI DI ALCUN TIPO, esplicite o
30 * implicite. Consultare la Licenza per il testo specifico che regola le
31 * autorizzazioni e le limitazioni previste dalla medesima.
32 ****************************************************************************/
33
34/****************************************************************************
35 * INCLUDE SECTION
36 ****************************************************************************/
37
38#include <stdio.h>
39#include <string.h>
40#include <stdlib.h>
41#include <limits.h>
42#include <unistd.h>
43#include <ctype.h>
44
45/****************************************************************************
46 * DATA TYPES AND STRUCTURES
47 ****************************************************************************/
48
49// Quoted from: https://vice-emu.sourceforge.io/vice_17.html
50
51// 17.5 The D64 disk image format
52
53// The advantage with using the 35 track D64 format, regardless of error bytes,
54// is that it can be converted directly back to a 1541 disk by either using the
55// proper cable and software on the PC, or send it down to the C64 and writing
56// it back to a 1541. It is the best documented format since it is also native
57// to the C64, with many books explaining the disk layout and the internals of the 1541.
58
59// First and foremost we have D64, which is basically a sector-for-sector copy
60// of a 1540/1541 disk. There are several versions of these which I will cover
61// shortly. The standard D64 is a 174848 byte file comprised of 256 byte
62// sectors arranged in 35 tracks with a varying number of sectors per track
63// for a total of 683 sectors. Track counting starts at 1, not 0, and goes
64// up to 35. Sector counting starts at 0, not 1, for the first sector,
65// therefore a track with 21 sectors will go from 0 to 20.
66//
67// The original media (a 5.25" disk) has the tracks laid out in circles,
68// with track 1 on the very outside of the disk (closest to the sides) to track
69// 35 being on the inside of the disk (closest to the inner hub ring).
70//
71// Commodore, in their infinite wisdom, varied the number of sectors per track
72// and data densities across the disk to optimize available storage, resulting in
73// the chart below. It shows the sectors/track for a standard D64. Since the
74// outside diameter of a circle is the largest (versus closer to the center),
75// the outside tracks have the largest amount of storage.
76// Tracks 36-40 apply to 40- and 42-track images only.
77// Tracks 41-42 apply to 42-track images only.
78
79// The directory track should be contained totally on track 18.
80// Sectors 1-18 contain the entries and sector 0 contains the BAM
81// (Block Availability Map) and disk name/ID. Since the directory is
82// only 18 sectors large (19 less one for the BAM), and each sector can
83// contain only 8 entries (32 bytes per entry), the maximum number of
84// directory entries is 18 * 8 = 144. The first directory sector is always
85// 18/1, even though the t/s pointer at 18/0 (first two bytes) might point
86// somewhere else. It then follows the same chain structure as a normal
87// file, using a sector interleave of 3. This makes the chain links go 18/1,
88// 18/4, 18/7 etc.
89
90// Note that you can extend the directory off of track 18, but only when reading
91// the disk or image. Attempting to write to a directory sector not on track 18
92// will cause directory corruption. Each directory sector has the following
93// layout (18/1 partial dump):
94
95// Used to represent the number of the track (1...42)
96typedef unsigned char D64Track;
97
98// Used to represent the number of the sector (1...35) or
99// total number of sectors, as well.
100typedef unsigned char D64Sector;
101
102// Used to represent the actual dos version for the disk.
103typedef unsigned char D64DosVersion;
104
105// Used to respresent a 1-byte length (0...255)
106typedef unsigned char D64ByteLength;
107
108// Used to respresent a 2-byte length (0...65535)
109typedef unsigned short D64WordLength;
110
111// Each filetype has its own unique properties, but most follow one simple structure.
112// The first file sector is pointed to by the directory and follows a t/s chain,
113// until the track value reaches $00. When this happens, the value in the sector
114// link location indicates how much of the sector is used. For example, the
115// following chain indicates a file 6 sectors long, and ends when we encounter the
116// $00/$34 chain. At this point the last sector occupies from bytes $02-$34.
117typedef enum _D64FileType {
118
119 // 0000 0 DEL
121
122 // 0001 1 SEQ
124
125 // 0010 2 PRG
127
128 // 0011 3 USR
130
131 // 0100 4 REL
133
135
136// This structure will take care of the attribute for the single file.
137typedef struct _D64Attribute {
138
139 // Bits Description
140 // 0-3 The actual file type (D64FileType)
141 // Values 5-15 are illegal, but if used will produce very strange results.
142 // The 1541 is inconsistent in how it treats these bits. Some routines use
143 // all 4 bits, others ignore bit 3, resulting in values from 0-7.
144 unsigned char type:4;
145
146 // 4 Unused
147 unsigned char unused:1;
148
149 // 5 Used only during SAVE-@ replacement
150 unsigned char saveReplacement:1;
151
152 // 6 Locked flag (Set produces ">" locked files)
153 unsigned char lockedFlag:1;
154
155 // 7 Closed flag (Not set produces "*", or "splat" files)
156 unsigned char closedFlag:1;
157
159
160// This structure will describe a single entry of the directory.
161typedef struct _D64DirectoryEntry {
162
163 // The first two bytes of the sector ($12/$04) indicate the location of the next
164 // track/sector of the directory (18/4). If the track is set to $00, then it is
165 // the last sector of the directory. It is possible, however unlikely, that the
166 // directory may *not* be competely on track 18 (some disks do exist like this).
167 // Just follow the chain anyhow.
168 // When the directory is done, the track value will be $00. The sector link
169 // should contain a value of $FF, meaning the whole sector is allocated, but
170 // the actual value doesn't matter. The drive will return all the available
171 // entries anyways.
172 // Track/Sector location of next directory sector ($00 $00 if not the first
173 // entry in the sector)
176
177 // File's attribute
179
180 // Track/sector location of first sector of file
183
184 // 16 character filename (in PETASCII, padded with $A0)
185 unsigned char filename[16];
186
187 // Track/Sector location of first side-sector block (REL file only)
190
191 // $17 REL file record length (REL file only, max. value 254)
193
194 // $18-$1D Unused (except with GEOS disks)
195 unsigned char unused[6];
196
197 // $1E-$1F File size in sectors, low/high byte order ($1E+$1F*256).
198 // The approx. filesize in bytes is <= #sectors * 254
200
202
203// This structure will allow to store the content of a directory sector.
204typedef struct _D64Directory {
205
206 // Entries of directory.
208
210
211// This structure can be used to store the content of a data sector.
212typedef struct _D64SectorData {
213
214 // Reference to the next track / sector. If this is the last
215 // data sector, the track will be set to zero (0) and sector
216 // will store the number of bytes used in this sector.
219
220 // The data.
221 unsigned char data[254];
222
224
225// The DISK ID.
226typedef unsigned short D64DiskId;
227
228// Files, on a standard 1541, are stored using an interleave of 10. Assuming a starting
229// track/sector of 17/0, the chain would run 17/0, 17/10, 17/20, 17/8, 17/18, etc.
230
231// 17.5.1 Non-Standard & Long Directories
232// Most Commdore floppy disk drives use a single dedicated directory track where all
233// filenames are stored. This limits the number of files stored on a disk based on
234// the number of sectors on the directory track. There are some disk images that contain
235// more files than would normally be allowed. This requires extending the directory off
236// the default directory track by changing the last directory sector pointer to a new
237// track, allocating the new sectors in the BAM, and manually placing (or moving existing)
238// file entries there. The directory of an extended disk can be read and the files that
239// reside there can be loaded without problems on a real drive. However, this is still a
240// very dangerous practice as writing to the extended portion of the directory will cause
241// directory corruption in the non-extended part. Many of the floppy drives core ROM
242// routines ignore the track value that the directory is on and assume the default
243// directory track for operations.
244
245// To explain: assume that the directory has been extended from track 18 to track
246// 19/6 and that the directory is full except for a few slots on 19/6. When saving
247// a new file, the drive DOS will find an empty file slot at 19/6 offset $40 and
248// correctly write the filename and a few other things into this slot. When the
249// file is done being saved the final file information will be written to 18/6
250// offset $40 instead of 19/6 causing some directory corruption to the entry at
251// 18/6. Also, the BAM entries for the sectors occupied by the new file will
252// not be saved and the new file will be left as a SPLAT (*) file.
253
254// Attempts to validate the disk will result in those files residing off the directory
255// track to not be allocated in the BAM, and could also send the drive into an endless
256// loop. The default directory track is assumed for all sector reads when validating
257// so if the directory goes to 19/6, then the validate code will read 18/6 instead.
258// If 18/6 is part of the normal directory chain then the validate routine will
259// loop endlessly.
260
261// 17.5.2 BAM layout
262// The layout of the BAM area (sector 18/0) is a bit more complicated...
263// Note: The BAM entries for SPEED, DOLPHIN and ProLogic DOS use the same layout as
264// standard BAM entries. One of the interesting things from the BAM sector is the byte
265// at offset $02, the DOS version byte. If it is set to anything other than $41 or $00,
266// then we have what is called "soft write protection". Any attempt to write to the disk
267// will return the "DOS Version" error code 73 ,"CBM DOS V 2.6 1541".
268// The 1541 is simply telling you that it thinks the disk format version is incorrect.
269// This message will normally come up when you first turn on the 1541 and read the
270// error channel. If you write a $00 or a $41 into 1541 memory location $00FF
271// (for device 0), then you can circumvent this type of write-protection, and change the
272// DOS version back to what it should be.
273
274// The BAM entries require a bit (no pun intended) more of a breakdown.
275typedef struct _D64BAMEntry {
276
277 // The first byte ($12) is the number of free sectors on that track.
279
280 // The next three bytes represent the bitmap of which sectors
281 // are used/free. Since it is 3 bytes (8 bits/byte) we have 24 bits of storage.
282 // Remember that at most, each track only has 21 sectors, so there are a
283 // few unused bits.
284 // These entries must be viewed in binary to make any sense.
285 // In order to make any sense from the binary notation, flip the bits around.
286 //
287 // 111111 11112222
288 // 01234567 89012345 67890123
289 // --------------------------
290 // 11100000 00000000 00000000
291 //
292 // If we are on the first track, we have 21 sectors, and only use up to
293 // the bit 20 position. If a bit is on (1), the sector is free.
294 // Therefore, track 1 has sectors 0, 1 and 2 free, all the rest are used.
295 // Any leftover bits that refer to sectors that don't exist, like bits 21-23
296 // in the above example, are set to allocated.
297 unsigned char bitmappedFree[3]; // 1 = free, 0 = occupied
298
300
301typedef struct _D64BAM {
302
303 // Track/Sector location of the first directory sector (should be set
304 // to 18/1 but it doesn't matter, and don't trust what is there, always
305 // go to 18/1 for first directory entry)
308
309 // Disk DOS version type (see note below) $41 ("A")
311
312 // Unused
313 unsigned char unused;
314
315 // BAM entries for each track, in groups of four bytes per track,
316 // starting on track 1 (see below for more details)
318
319 union {
320
321 struct {
322
323 // Disk Name (padded with $A0)
324 // PrologicDOS stored them right after the existing BAM entries from $90-A3.
325 // PrologicDOS also moves the disk label and ID forward from the standard location of
326 // $90 to $A4.
327 unsigned char diskName[16];
328
329 // Filled with $A0
330 unsigned char unused2[2];
331
332 // Disk ID
334
336
337 struct {
338
340
342
343 };
344
345 // Usually $A0
346 unsigned char unused3;
347
348 // DOS type, usually "2A"
349 unsigned char dosType[2];
350
351 // Filled with $A0
352 unsigned char unused4[4];
353
354 // Unused ($00)
355 unsigned char unused5;
356
357 // For DOLPHIN DOS track 36-40 BAM entries, otherwise unused ($00)
359
360 // For SPEED DOS track 36-40 BAM entries, otherwise unused ($00)
362
363 // Unused ($00)
364 unsigned char unused6[44];
365
367
368// 17.5.3 Variations on the D64 layout
369// These are some variations of the D64 layout:
370
371// 1. Standard 35 track layout but with 683 error bytes added on to the end
372// of the file. Each byte of the error info corresponds to a single sector
373// stored in the D64, indicating if the sector on the original disk
374// contained an error. The first byte is for track 1/0, and the last byte is
375// for track 35/16.
376
377// 2. A 40 track layout, following the same layout as a 35 track disk, but with
378// 5 extra tracks. These contain 17 sectors each, like tracks 31-35. Some
379// of the PC utilities do allow you to create and work with these files.
380// This can also have error bytes attached like variant #1.
381
382// 3. A 42 track layout, with two extra tracks of 17 sectors each. This is
383// extremely uncommon, since real drives often have problems with accessing
384// these tracks, software that uses them is very rare.
385
386// 4. The Commodore 128 allowed for "auto-boot" disks. With this, t/s 1/0
387// holds a specific byte sequence which the computer recognizes as boot code.
388
389typedef enum _D64Variants {
390
391 // 35 track, no errors 174848
393
394 // 1. Standard 35 track layout but with 683 error bytes added on to the end
395 // of the file. Each byte of the error info corresponds to a single sector
396 // stored in the D64, indicating if the sector on the original disk
397 // contained an error. The first byte is for track 1/0, and the last byte is
398 // for track 35/16.
399
400 // 35 track, 683 error bytes 175531
402
403 // 2. A 40 track layout, following the same layout as a 35 track disk, but with
404 // 5 extra tracks. These contain 17 sectors each, like tracks 31-35. Some
405 // of the PC utilities do allow you to create and work with these files.
406 // This can also have error bytes attached like variant #1.
407
408 // 40 track, no errors 196608
410
411 // 40 track, 768 error bytes 197376
413
414 // 3. A 42 track layout, with two extra tracks of 17 sectors each. This is
415 // extremely uncommon, since real drives often have problems with accessing
416 // these tracks, software that uses them is very rare.
417
418 // 42 track, no errors 205312
420
421 // 42 track, 802 error bytes 206114
423
424 // 4. The Commodore 128 allowed for "auto-boot" disks. With this, t/s 1/0
425 // holds a specific byte sequence which the computer recognizes as boot code.
426
428
429// The following table (provided by Wolfgang Moser) outlines the differences between the
430// standard 1541 DOS and the various "speeder" DOS's that exist. The 'header 7/8' category
431// is the 'fill bytes' as the end of the sector header of a real 1541 disk.
432
433typedef enum _D64Format {
434
435 // Original CBM DOS v2.6 35 $0f $0f "2A" $41/'A'
437
438 // *SpeedDOS+ 40 $0f $0f "2A" $41/'A'
440
441 // Professional DOS Initial 35 $0f $0f "2A" $41/'A'
443
444 // Professional DOS Version 1/Prototype 40 $0f $0f "2A" $41/'A'
446
447 // ProfDOS Release 40 $0f $0f "4A" $41/'A'
449
450 // Dolphin-DOS 2.0/3.0 35 $0f $0f "2A" $41/'A'
452
453 // Dolphin-DOS 2.0/3.0 40 $0d $0f "2A" $41/'A'
455
456 // PrologicDOS 1541 35 $0f $0f "2A" $41/'A'
458
459 // PrologicDOS 1541 40 $0f $0f "2P" $50/'P'
461
462 // ProSpeed 1571 2.0 35 $0f $0f "2A" $41/'A'
464
465 // ProSpeed 1571 2.0 40 $0f $0f "2P" $50/'P'
467
469
470// Note: There are also clones of SpeedDOS that exist, such as RoloDOS and DigiDOS.
471// Both are just a change of the DOS startup string.
472
473// 17.5.4 Error codes
474// Here is the meaning of the error bytes added onto the end of any extended D64.
475// The CODE is the same as that generated by the 1541 drive controller... it reports
476// these numbers, not the error code we usually see when an error occurs.
477// Some of what comes below is taken from Immers/Neufeld book "Inside Commodore DOS".
478// Note the descriptions are not completely accurate as to what the drive DOS is
479// actually doing to seek/read/decode/write sectors, but serve as simple examples only. The "type" field is where the error usually occurs, whether it's searching for any SYNC mark, any header ID, any valid header, or reading a sector.
480// These first errors are "seek" errors, where the disk controller is simply
481// reading headers and looking at descriptor bytes, checksums, format ID's and
482// reporting what errors it sees. These errors do *not* necessarily apply to the
483// exact sector being looked for. This fact makes duplication of these errors
484// very unreliable.
485
486typedef enum _D64ErrorCode {
487
488 // $01 00 N/A * No error.
489 // Code : $01 Error : 00 Type : N/A Message : No error.
490 // Self explanatory. No errors were detected in the reading and decoding of the sector.
492
493 // $02 20 Seek * Header block not found / Header descriptor byte not found
494 // Code : $02 Error : 20 Type : Seek Message : Header descriptor byte not found (HEX $08, GCR $52)
495 // Each sector is preceeded by an 8-byte GCR header block, which starts with the
496 // value $52 (GCR). If this value is not found after 90 attempts, this error is
497 // generated. Basically, what a track has is SYNC marks, and possibly valid data blocks,
498 // but no valid header descriptors.
499 // Code : $02 Error : 20 Type : Seek Message : Header block not found
500 // This error can be reported again when searching for the correct header block.
501 // An image of the header is built and searched for, but not found after 90 read
502 // attempts. Note the difference from the first occurance. The first one only
503 // searches for a valid ID, not the whole header. Note that error 20 occurs twice
504 // during this phase. The first time is when a header ID is being searched for,
505 // the second is when the proper header pattern for the sector being searched for
506 // is not found.
508
509 // $03 21 Seek * No SYNC sequence found
510 // Code : $03 Error : 21 Type : Seek Message : No SYNC sequence found.
511 // Each sector data block and header block are preceeded by SYNC marks.
512 // If *no* sync sequence is found within 20 milliseconds (only ~1/10 of a disk
513 // rotation!) then this error is generated. This error used to mean the entire
514 // track is bad, but it does not have to be the case. Only a small area of the
515 // track needs to be without a SYNC mark and this error will be generated.
516 // Converting this error to a D64 is very problematic because it depends on where
517 // the physical head is on the disk when a read attempt is made. If it is on valid
518 // header/sectors then it won't occur. If it happens over an area without SYNC
519 // marks, it will happen.
521
522 // $09 27 Seek * Checksum error in header block
523 // Code : $09 Error : 27 Type : Seek Message : Checksum error in header block
524 // The header block contains a checksum value, calculated by XOR'ing the TRACK,
525 // SECTOR, ID1 and ID2 values. If this checksum is wrong, this error is generated.
527
528 // $0B 29 Seek * Disk sector ID mismatch
529 // Code : $0B Error : 29 Type : Seek Message : Disk sector ID mismatch
530 // The ID's from the header block of the currently read sector are compared
531 // against the ones from the low-level header of 18/0. If there is a mismatch,
532 // this error is generated.
534
536
537 // From this point on, all the errors apply to the specific sector you are looking
538 // for. If a read passed all the previous checks, then we are at the sector
539 // being searched for. Note that the entire sector is read before these errors are
540 // detected. Therefore the data, checksum and off bytes are available.
541
542 // $04 22 Read * Data descriptor byte not found
543 // Code : $04 Error : 22 Type : Read Message : Data descriptor byte not found (HEX $07, GCR $55)
544 // Each sector data block is preceeded by the value $07, the "data block" descriptor.
545 // If this value is not there, this error is generated. Each encoded sector has actually 260 bytes. First is the descriptor byte, then follows the 256 bytes of data, a checksum, and two "off" bytes.
547
548 // $05 23 Read * Checksum error in data block
549 // Code : $05 Error : 23 Type : Read Message : Checksum error in data block
550 // The checksum of the data read of the disk is calculated, and compared against the
551 // one stored at the end of the sector. If there's a discrepancy, this error is
552 // generated.
554
555 // $06 24 Write Write verify on format (never occurs on 1541)
556 // Code : $06 Error : 24 Type : Write Message : Write verify (on format)
557 // Once the GCR-encoded sector is written out, the drive waits for the sector to
558 // come around again and verifies the whole 325-byte GCR block. Any errors
559 // encountered will generate this error.
561
562 // $07 25 Write Write verify error
563 // Code : $07 Error : 25 Type : Write Message : Write verify error
564 // Once the GCR-encoded sector is written out, the drive waits for the sector to
565 // come around again and verifies the whole 325-byte GCR block. Any errors
566 // encountered will generate this error.
568
569 // $08 26 Write Write protect on
570 // Code : $08 Error : 26 Type : Write Message : Write protect on
571 // Self explanatory. Remove the write-protect tab, and try again.
573
574 // $0A 28 Write Write error (never occurs on 1541)
575 // Code : $0A Error : 28 Type : Write Message : Write error
576 // In actual fact, this error never occurs, but it is included for completeness.
577 // This is not an error at all, but it gets reported when the read of a sector is ok.
578
580
581 // Codes $0 and $C to $E are unused and never occur.
582
583 // $0F 74 Read Drive Not Ready (no disk in drive or no device 1)
584 // Code : $0F Error : 74 Type : Read Message : Drive Not Ready (no disk in drive or no device 1)
585 // These errors only apply when writing to a disk. I don't see the usefulness
586 // of having these as they cannot be present when only *reading* a disk.
588
590
591// This is the opaque type used to represent a D64 disk image.
592typedef struct _D64Handle {
593
594 // Disk's format
596
597 // Number of tracks in the disk (35, 40, 42)
599
600 // Total numer of sectors
602
603 // Raw disk data
604 unsigned char * content;
605
606 // Snapshort disk data
607 unsigned char * snapshot;
608
609 // Raw disk data size
611
612 // Errors data (NULL if missing)
614
615 // Errors data size
617
618 //
620
622
623#define D64_BAM_TRACK 18
624#define D64_BAM_SECTOR 0
625#define D64_DIRECTORY_TRACK 18
626#define D64_DIRECTORY_SECTOR 1
627
628/****************************************************************************
629 * FUNCTION DECLARATION
630 ****************************************************************************/
631
632D64Handle * d64_create( D64Format _format );
633int d64_get_free_sectors( D64Handle * _handle );
634void d64_set_dos_version( D64Handle * _handle, D64DosVersion _version );
635void d64_set_disk_name( D64Handle * _handle, unsigned char * _disk_name );
636void d64_set_disk_id( D64Handle * _handle, D64DiskId _disk_id );
637void d64_set_dos_type( D64Handle * _handle, unsigned char * _dos_type );
638int d64_write_file( D64Handle * _handle, unsigned char * _filename, D64FileType _type, unsigned char * _buffer, int _size );
639void d64_output( D64Handle * _handle, unsigned char * _filename );
640void d64_free( D64Handle * _handle );
641
642#endif
void d64_set_disk_name(D64Handle *_handle, unsigned char *_disk_name)
Set the disk name for the given disk image.
Definition d64.c:714
struct _D64Attribute D64Attribute
_D64ErrorCode
Definition d64.h:486
@ DATA_DESCRIPTOR_BYTE_NOT_FOUND
Definition d64.h:546
@ CHECKSUM_ERROR_DATA_BLOCK
Definition d64.h:553
@ HEADER_BLOCK_NOT_FOUND
Definition d64.h:507
@ WRITE_PROTECT_ON
Definition d64.h:572
@ DRIVE_NOT_READY
Definition d64.h:587
@ WRITE_VERIFY_ON_FORMAT
Definition d64.h:560
@ CHECKSUM_ERROR_HEADER_BLOCK
Definition d64.h:526
@ NO_ERRORX
Definition d64.h:491
@ WRITE_ERROR
Definition d64.h:579
@ NO_SYNC_SEQUENCE_FOUND
Definition d64.h:520
@ DISK_SECTOR_ID_MISMATCH
Definition d64.h:533
@ WRITE_VERIFY_ERROR
Definition d64.h:567
struct _D64BAMEntry D64BAMEntry
enum _D64Variants D64Variants
D64Handle * d64_create(D64Format _format)
Create a new D64 disk image.
Definition d64.c:779
void d64_set_disk_id(D64Handle *_handle, D64DiskId _disk_id)
Set the disk id for the given disk image.
Definition d64.c:740
struct _D64BAM D64SectorBAM
_D64Variants
Definition d64.h:389
@ TRACKS42ERRORS
Definition d64.h:422
@ TRACKS40ERRORS
Definition d64.h:412
@ TRACKS35
Definition d64.h:392
@ TRACKS42
Definition d64.h:419
@ TRACKS35ERRORS
Definition d64.h:401
@ TRACKS40
Definition d64.h:409
void d64_output(D64Handle *_handle, unsigned char *_filename)
Definition d64.c:932
unsigned char D64Sector
Definition d64.h:100
unsigned char D64DosVersion
Definition d64.h:103
void d64_set_dos_version(D64Handle *_handle, D64DosVersion _version)
Set the DOS version for the given disk image.
Definition d64.c:698
_D64Format
Definition d64.h:433
@ DOLPHINDOS40
Definition d64.h:454
@ PROFESSIONALDOS35
Definition d64.h:442
@ SPEEDDOS40
Definition d64.h:439
@ DOLPHINDOS35
Definition d64.h:451
@ CBMDOS
Definition d64.h:436
@ PROLOGICDOS40
Definition d64.h:460
@ PROSPEED40
Definition d64.h:466
@ PROFESSIONALDOS40B
Definition d64.h:448
@ PROFESSIONALDOS40
Definition d64.h:445
@ PROSPEED35
Definition d64.h:463
@ PROLOGICDOS35
Definition d64.h:457
struct _D64SectorData D64SectorData
void d64_free(D64Handle *_handle)
Free the disk image resources.
Definition d64.c:924
enum _D64FileType D64FileType
int d64_write_file(D64Handle *_handle, unsigned char *_filename, D64FileType _type, unsigned char *_buffer, int _size)
Write a block of memory on a file on the D64 disk image.
Definition d64.c:802
unsigned char D64ByteLength
Definition d64.h:106
unsigned short D64DiskId
Definition d64.h:226
unsigned short D64WordLength
Definition d64.h:109
void d64_set_dos_type(D64Handle *_handle, unsigned char *_dos_type)
Set the DOS Type for the given disk image.
Definition d64.c:763
_D64FileType
Definition d64.h:117
@ FT_DEL
Definition d64.h:120
@ FT_USR
Definition d64.h:129
@ FT_PRG
Definition d64.h:126
@ FT_REL
Definition d64.h:132
@ FT_SEQ
Definition d64.h:123
enum _D64ErrorCode D64ErrorCode
struct _D64DirectoryEntry D64DirectoryEntry
enum _D64Format D64Format
struct _D64Handle D64Handle
struct _D64Directory D64SectorDirectory
int d64_get_free_sectors(D64Handle *_handle)
Definition d64.c:290
unsigned char D64Track
Definition d64.h:96
unsigned char saveReplacement
Definition d64.h:150
unsigned char closedFlag
Definition d64.h:156
unsigned char lockedFlag
Definition d64.h:153
unsigned char type
Definition d64.h:144
unsigned char unused
Definition d64.h:147
Definition d64.h:275
D64ByteLength freeSectors
Definition d64.h:278
unsigned char bitmappedFree[3]
Definition d64.h:297
Definition d64.h:301
D64DiskId diskId
Definition d64.h:333
struct _D64BAM::@256036255133227046226271146257246372060017123336::@271123314305046123343155131234272165152237056144 prologic
struct _D64BAM::@256036255133227046226271146257246372060017123336::@324076120047031363306223216253037144316004175331 standard
D64BAMEntry entries[35]
Definition d64.h:317
unsigned char unused6[44]
Definition d64.h:364
D64BAMEntry entriesSpeedDOS[5]
Definition d64.h:361
unsigned char unused4[4]
Definition d64.h:352
unsigned char unused2[2]
Definition d64.h:330
D64BAMEntry entriesPrologicDOS[5]
Definition d64.h:339
unsigned char unused5
Definition d64.h:355
D64DosVersion dosVersion
Definition d64.h:310
unsigned char diskName[16]
Definition d64.h:327
unsigned char dosType[2]
Definition d64.h:349
unsigned char unused3
Definition d64.h:346
unsigned char unused
Definition d64.h:313
D64BAMEntry entriesDolphinDOS[5]
Definition d64.h:358
D64Track firstDirectoryTrack
Definition d64.h:306
D64Sector firstDirectorySector
Definition d64.h:307
Definition d64.h:161
D64Attribute attribute
Definition d64.h:178
D64WordLength sizeSectors
Definition d64.h:199
D64Track trackFirstSector
Definition d64.h:181
D64ByteLength lengthREL
Definition d64.h:192
unsigned char unused[6]
Definition d64.h:195
unsigned char filename[16]
Definition d64.h:185
D64Sector sectorFirstSector
Definition d64.h:182
D64Sector sectorFirstSectorREL
Definition d64.h:189
D64Track trackFirstSectorREL
Definition d64.h:188
D64Track track
Definition d64.h:174
D64Sector sector
Definition d64.h:175
D64DirectoryEntry entries[8]
Definition d64.h:207
int contentSize
Definition d64.h:610
D64Track lastUsedTrack
Definition d64.h:619
D64Format format
Definition d64.h:595
D64ErrorCode * errors
Definition d64.h:613
unsigned char * content
Definition d64.h:604
D64Track tracks
Definition d64.h:598
D64Sector sectors
Definition d64.h:601
unsigned char * snapshot
Definition d64.h:607
int errorsSize
Definition d64.h:616
unsigned char data[254]
Definition d64.h:221
D64Track track
Definition d64.h:217
D64Sector sector
Definition d64.h:218