2019-12-03 08:35:49 +11:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include "libz80/z80.h"
|
|
|
|
|
2019-12-03 09:44:54 +11:00
|
|
|
typedef byte (*IORD) ();
|
|
|
|
typedef void (*IOWR) (byte data);
|
2019-12-03 08:35:49 +11:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
Z80Context cpu;
|
2019-12-03 09:44:54 +11:00
|
|
|
byte mem[0x10000];
|
2019-12-03 08:35:49 +11:00
|
|
|
// Set to non-zero to specify where ROM ends. Any memory write attempt
|
|
|
|
// below ramstart will trigger a warning.
|
2019-12-03 09:44:54 +11:00
|
|
|
ushort ramstart;
|
|
|
|
// The minimum value reached by SP at any point during execution.
|
|
|
|
ushort minsp;
|
2019-12-03 08:35:49 +11:00
|
|
|
// Array of 0x100 function pointers to IO read and write routines. Leave to
|
|
|
|
// NULL when IO port is unhandled.
|
|
|
|
IORD iord[0x100];
|
|
|
|
IOWR iowr[0x100];
|
|
|
|
} Machine;
|
|
|
|
|
|
|
|
Machine* emul_init();
|
|
|
|
bool emul_step();
|
|
|
|
void emul_loop();
|
2019-12-03 09:44:54 +11:00
|
|
|
void emul_printdebug();
|