![](/media/cache/profiles/f93486bfff38ca69d76d85c089569a09.50x50_q85.jpg)
C1541-III mbed edition
D64_decoder.h@0:28557a4d2215, 2011-08-22 (annotated)
- Committer:
- gertk
- Date:
- Mon Aug 22 05:48:51 2011 +0000
- Revision:
- 0:28557a4d2215
very early test version, works only with FAT16 formatted sd cards
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gertk | 0:28557a4d2215 | 1 | #ifndef D64_DECODER_INCLUDED |
gertk | 0:28557a4d2215 | 2 | #define D64_DECODER_INCLUDED |
gertk | 0:28557a4d2215 | 3 | |
gertk | 0:28557a4d2215 | 4 | /* Description of the error-bytes at the end of some .D64 files: |
gertk | 0:28557a4d2215 | 5 | |
gertk | 0:28557a4d2215 | 6 | Code Error Type 1541 error description |
gertk | 0:28557a4d2215 | 7 | ---- ----- ---- ------------------------------ |
gertk | 0:28557a4d2215 | 8 | 01 00 N/A No error, sector ok. |
gertk | 0:28557a4d2215 | 9 | 02 20 Read Header block not found |
gertk | 0:28557a4d2215 | 10 | 03 21 Seek No sync character |
gertk | 0:28557a4d2215 | 11 | 04 22 Read Data block not present |
gertk | 0:28557a4d2215 | 12 | 05 23 Read Checksum error in data block |
gertk | 0:28557a4d2215 | 13 | 06 24 Write Write verify (on format) |
gertk | 0:28557a4d2215 | 14 | 07 25 Write Write verify error |
gertk | 0:28557a4d2215 | 15 | 08 26 Write Write protect on |
gertk | 0:28557a4d2215 | 16 | 09 27 Seek Checksum error in header block |
gertk | 0:28557a4d2215 | 17 | 0A 28 Write Write error |
gertk | 0:28557a4d2215 | 18 | 0B 29 Seek Disk ID mismatch |
gertk | 0:28557a4d2215 | 19 | 0F 74 Read Disk Not Ready (no device 1) |
gertk | 0:28557a4d2215 | 20 | */ |
gertk | 0:28557a4d2215 | 21 | |
gertk | 0:28557a4d2215 | 22 | struct directory_entry |
gertk | 0:28557a4d2215 | 23 | { |
gertk | 0:28557a4d2215 | 24 | unsigned char filetype; |
gertk | 0:28557a4d2215 | 25 | unsigned char track_first_block; |
gertk | 0:28557a4d2215 | 26 | unsigned char sector_first_block; |
gertk | 0:28557a4d2215 | 27 | unsigned char filename[16]; |
gertk | 0:28557a4d2215 | 28 | unsigned char track_first_block_relfile; |
gertk | 0:28557a4d2215 | 29 | unsigned char sector_first_block_relfile; |
gertk | 0:28557a4d2215 | 30 | unsigned char record_size_relfile; |
gertk | 0:28557a4d2215 | 31 | unsigned char unused_1[4]; |
gertk | 0:28557a4d2215 | 32 | unsigned char track_first_block_replacementfile; |
gertk | 0:28557a4d2215 | 33 | unsigned char sector_first_block_replacementfile; |
gertk | 0:28557a4d2215 | 34 | unsigned char blocksize_low_byte; |
gertk | 0:28557a4d2215 | 35 | unsigned char blocksize_high_byte; |
gertk | 0:28557a4d2215 | 36 | unsigned char unused_2[2]; |
gertk | 0:28557a4d2215 | 37 | }; |
gertk | 0:28557a4d2215 | 38 | |
gertk | 0:28557a4d2215 | 39 | |
gertk | 0:28557a4d2215 | 40 | /*routines*/ |
gertk | 0:28557a4d2215 | 41 | /*--------*/ |
gertk | 0:28557a4d2215 | 42 | void Clear_RAM_buffer(void); |
gertk | 0:28557a4d2215 | 43 | void D64ConvertBlockToTrackSector(unsigned int block, unsigned char *track, unsigned char *sector); |
gertk | 0:28557a4d2215 | 44 | unsigned int D64ConvertTrackSectorToBlock(unsigned char track, unsigned char sector); |
gertk | 0:28557a4d2215 | 45 | void D64ReadBAM(void); /*this routine only supports 35 track disks, since I lack the knowledge of 40 track size disks*/ |
gertk | 0:28557a4d2215 | 46 | void D64WriteBAM(void); /*this routine only supports 35 track disks, since I lack the knowledge of 40 track size disks*/ |
gertk | 0:28557a4d2215 | 47 | unsigned char D64ReadFreeBlocksPerTrack(unsigned char track); /*this routine only supports 35 track disks, since I lack the knowledge of 40 track size disks*/ |
gertk | 0:28557a4d2215 | 48 | unsigned char D64WriteFreeBlocksPerTrack(unsigned char track, unsigned char value); /*this routine only supports 35 track disks, since I lack the knowledge of 40 track size disks*/ |
gertk | 0:28557a4d2215 | 49 | unsigned char D64BAMFlagTest(unsigned char track, unsigned char sector); /*this routine only supports 35 track disks, since I lack the knowledge of 40 track size disks*/ |
gertk | 0:28557a4d2215 | 50 | void D64BAMFlagModify(unsigned char track, unsigned char sector, unsigned status); |
gertk | 0:28557a4d2215 | 51 | unsigned char D64SeekFreeBlock(unsigned char *track, unsigned char *sector); /*this routine only supports 35 track disks, since I lack the knowledge of 40 track size disks*/ |
gertk | 0:28557a4d2215 | 52 | unsigned char D64BlockAllocate(unsigned char track, unsigned char sector); |
gertk | 0:28557a4d2215 | 53 | unsigned char D64BlockFree(unsigned char track, unsigned char sector); |
gertk | 0:28557a4d2215 | 54 | void D64BlockWrite(unsigned char track, unsigned char sector); |
gertk | 0:28557a4d2215 | 55 | void D64BlockWrite_new(unsigned char buffer, unsigned char track, unsigned char sector); |
gertk | 0:28557a4d2215 | 56 | void D64BlockRead(unsigned char track, unsigned char sector); |
gertk | 0:28557a4d2215 | 57 | void D64BlockRead_new(unsigned char buffer, unsigned char track, unsigned char sector); |
gertk | 0:28557a4d2215 | 58 | unsigned char D64SeekDirEntry(unsigned char mode, unsigned char *track, unsigned char *sector, unsigned char *entry_cnt); |
gertk | 0:28557a4d2215 | 59 | unsigned char D64SeekNextBlock(unsigned char *track, unsigned char *sector); |
gertk | 0:28557a4d2215 | 60 | unsigned char D64AddDirEntry(unsigned char ftype, unsigned char tfblock, unsigned char sfblock, unsigned char *fname, unsigned int blocksize, unsigned char tfblock_rel, unsigned char sfblock_rel, unsigned char size_rel, unsigned char tfblock_replace, unsigned char sfblock_replace); |
gertk | 0:28557a4d2215 | 61 | unsigned char D64ScratchDirEntry(unsigned char dirtrack, unsigned char dirsector, unsigned char direntry); |
gertk | 0:28557a4d2215 | 62 | unsigned char D64RenameDirEntry(unsigned char *fname, unsigned char dirtrack, unsigned char dirsector, unsigned char direntry); |
gertk | 0:28557a4d2215 | 63 | |
gertk | 0:28557a4d2215 | 64 | unsigned char D64LoadFileNameSector(unsigned char mode, unsigned char *dirtrack, unsigned char *dirsector); |
gertk | 0:28557a4d2215 | 65 | unsigned int D64LoadFreeBlocks(void); |
gertk | 0:28557a4d2215 | 66 | unsigned char D64LoadFile_X_Bytes(struct file2TYPE *file, unsigned char track, unsigned char sector, unsigned char byte, unsigned int NmbrOfBytes); |
gertk | 0:28557a4d2215 | 67 | unsigned char D64SeekFile(unsigned char *filename, unsigned char *track, unsigned char *sector, unsigned int *blocksize, unsigned char *dirtrack, unsigned char *dirsector, unsigned char *direntry); |
gertk | 0:28557a4d2215 | 68 | |
gertk | 0:28557a4d2215 | 69 | #endif |