Mirror of CollapseOS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 line
1.1KB

  1. #pragma once
  2. #include <stdint.h>
  3. #include <stdbool.h>
  4. #include "z80.h"
  5. typedef byte (*IORD) ();
  6. typedef void (*IOWR) (byte data);
  7. typedef byte (*EXCH) (byte data);
  8. typedef struct {
  9. Z80Context cpu;
  10. byte mem[0x10000];
  11. // Set to non-zero to specify where ROM ends. Any memory write attempt
  12. // below ramstart will trigger a warning.
  13. ushort ramstart;
  14. // The minimum value reached by SP at any point during execution.
  15. ushort minsp;
  16. // same principle for IX
  17. ushort maxix;
  18. // Array of 0x100 function pointers to IO read and write routines. Leave to
  19. // NULL when IO port is unhandled.
  20. IORD iord[0x100];
  21. IOWR iowr[0x100];
  22. } Machine;
  23. typedef enum {
  24. TRI_HIGH,
  25. TRI_LOW,
  26. TRI_HIGHZ
  27. } Tristate;
  28. Machine* emul_init();
  29. void emul_deinit();
  30. bool emul_step();
  31. bool emul_steps(unsigned int steps);
  32. void emul_loop();
  33. void emul_trace(ushort addr);
  34. void emul_memdump();
  35. void emul_debugstr(char *s);
  36. void emul_printdebug();
  37. // use when a port is a NOOP, but it's not an error to access it.
  38. byte iord_noop();
  39. void iowr_noop(byte val);