1
0
mirror of https://github.com/pevans/erc-c.git synced 2024-12-01 00:49:46 +00:00
erc-c/include/apple2.enc.h

70 lines
1.8 KiB
C
Raw Normal View History

2018-01-31 06:09:07 +00:00
#ifndef _APPLE2_ENC_H_
#define _APPLE2_ENC_H_
#include "vm_bits.h"
#include "vm_segment.h"
2018-01-31 21:58:57 +00:00
/*
* This is a magic number for the disk volume; I haven't experimented
* with using other values for it, and this one in particular is used in
* WinApple, so I went with it.
*/
2018-02-03 06:24:22 +00:00
#define ENC_VOLUME 0xfe
/*
* The number of tracks that a DOS 3.3 disk would have.
*/
#define ENC_NUM_TRACKS 35
/*
* The number of sectors within a single track of data for a DOS 3.3
* disk.
*/
#define ENC_NUM_SECTORS 16
/*
* A decoded sector is 256 bytes long
*/
#define ENC_DSECTOR 0x100
/*
* And a track--being composed of 16 sectors--is 4096 bytes long, or 4k
* bytes. (256 * 16 = 4096)
*/
#define ENC_DTRACK 0x1000
/*
* An encoded sector is 396 bytes long, and is comprised of a sector
2018-02-03 06:24:22 +00:00
* header plus padding bytes both before _and_ after the data field.
*/
#define ENC_ESECTOR 0x18c
2018-02-03 06:24:22 +00:00
/*
* An encoded track contains 16 sectors, as mentioned for ENC_DTRACK.
* But it also contains some additional padding (48 bytes-worth).
*/
2018-02-04 21:41:48 +00:00
#define ENC_ETRACK 0x18f0
2018-02-03 06:24:22 +00:00
/*
* A sector header consists of some byte markers--all byte markers in
* 6-and-2 encoding are 3 bytes long--and also some metadata, such as
* the track number, the sector number, the volume, and an XOR'd
* combination of all three.
*/
#define ENC_ESECTOR_HEADER 0x14
2018-02-03 06:24:22 +00:00
/*
* The track header (as mentioned for ENC_ETRACK) is 48 bytes of--well,
* nothing really, just padding.
*/
#define ENC_ETRACK_HEADER 0x30
2018-01-31 21:58:57 +00:00
2018-01-31 06:09:07 +00:00
extern int apple2_enc_4n4(vm_segment *, int, vm_8bit);
extern int apple2_enc_sector(vm_segment *, vm_segment *, int, int);
extern int apple2_enc_sector_header(vm_segment *, int, int, int);
extern int apple2_enc_track(int, vm_segment *, vm_segment *, int, int);
extern vm_segment *apple2_enc_dos(int, vm_segment *);
extern vm_segment *apple2_enc_nib(vm_segment *);
2018-01-31 06:09:07 +00:00
#endif