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.

35 lines
822B

  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. // Array of 0x100 function pointers to IO read and write routines. Leave to
  16. // NULL when IO port is unhandled.
  17. IORD iord[0x100];
  18. IOWR iowr[0x100];
  19. } Machine;
  20. typedef enum {
  21. TRI_HIGH,
  22. TRI_LOW,
  23. TRI_HIGHZ
  24. } Tristate;
  25. Machine* emul_init();
  26. bool emul_step();
  27. bool emul_steps(unsigned int steps);
  28. void emul_loop();
  29. void emul_trace(ushort addr);
  30. void emul_printdebug();