26#define SECTOR_BYTES 64
27#define DEFAULT_SECTORS 64
76 uint8_t *buf, uint16_t *len, uint16_t cap)
92 buf[n++] = (uint8_t)(sec[i] >> 4);
93 buf[n++] = (uint8_t)(sec[i] & 0x0F);
108 struct disk_ctx *d = calloc(1,
sizeof(*d));
124 FILE *f = fopen(image_path,
"rb");
128 ge_log(
LOG_PERI,
"disk: loaded %zu bytes from %s\n", got, image_path);
130 ge_log(
LOG_ERR,
"disk: cannot open %s (blank pack)\n", image_path);
int connector34_init(struct ge *ge)
int connector34_attach(struct ge *ge, struct ge_std_device *dev, uint8_t connector)
static std_reaction disk_command(struct ge *ge, void *opaque, struct std_unitname un, uint8_t order)
int disk_register(struct ge *ge, const char *image_path, uint8_t connector, uint8_t unit)
static int disk_claims(void *opaque, struct std_unitname un)
static std_reaction disk_transfer(struct ge *ge, void *opaque, struct std_unitname un, int dir, uint8_t *buf, uint16_t *len, uint16_t cap)
void ge_log(ge_log_type type, const char *format,...)
Log message.
@ LOG_ERR
Emulator unrecoverable condition.
@ LOG_PERI
Peripherals IO.
void(* tick)(struct ge *, void *ctx)
int(* claims)(void *ctx, struct std_unitname un)
std_reaction(* command)(struct ge *, void *ctx, struct std_unitname un, uint8_t order)
std_reaction(* transfer)(struct ge *, void *ctx, struct std_unitname un, int dir, uint8_t *buf, uint16_t *len, uint16_t cap)
The entire state of the emulated system, including registers, memory, peripherals and timings.