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.

38 lines
890B

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