1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-07-24 00:20:19 +10:00
collapseos/tools/emul/emul.h
Virgil Dupras 66dacd1816 tools/emul: add "Min SP" debug value
This gives the maximum size of the stack at any given moment during the
execution of the program. It's useful to figure out if the stack gets
dangerously close to the heap.
2019-12-02 17:44:54 -05:00

26 lines
673 B
C

#include <stdint.h>
#include <stdbool.h>
#include "libz80/z80.h"
typedef byte (*IORD) ();
typedef void (*IOWR) (byte data);
typedef struct {
Z80Context cpu;
byte mem[0x10000];
// Set to non-zero to specify where ROM ends. Any memory write attempt
// below ramstart will trigger a warning.
ushort ramstart;
// The minimum value reached by SP at any point during execution.
ushort minsp;
// 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();
void emul_printdebug();