//
// by James L. Hammons
//
-// (c) 1997, 2004 Underground Software
+// (C) 1997, 2004 Underground Software
//
#ifndef __V6809_H__
#define __V6809_H__
-#include "types.h"
+#include <stdint.h>
// Useful defines
struct V6809REGS
{
- WORD pc; // 6809 PC register
- WORD x; // 6809 X index register
- WORD y; // 6809 Y index register
- WORD s; // 6809 System stack pointer
- WORD u; // 6809 User stack pointer
- BYTE cc; // 6809 Condition Code register
- BYTE a; // 6809 A register
- BYTE b; // 6809 B register
- BYTE dp; // 6809 Direct Page register
- DWORD clock; // 6809 clock
-//DWORD _reserved;// BYTE (* Fetch)(WORD&); // Address of BYTE fetch routine
- BYTE (* RdMem)(WORD); // Address of BYTE read routine
- void (* WrMem)(WORD, BYTE); // Address of BYTE write routine
- DWORD cpuFlags; // v6809 IRQ/RESET flags
+ uint16_t pc; // 6809 PC register
+ uint16_t x; // 6809 X index register
+ uint16_t y; // 6809 Y index register
+ uint16_t s; // 6809 System stack pointer
+ uint16_t u; // 6809 User stack pointer
+ uint8_t cc; // 6809 Condition Code register
+ uint8_t a; // 6809 A register
+ uint8_t b; // 6809 B register
+ uint8_t dp; // 6809 Direct Page register
+ uint64_t clock; // 6809 clock (@ 1 MHz, wraps at 570842 years)
+ uint8_t (* RdMem)(uint16_t); // Address of uint8 read routine
+ void (* WrMem)(uint16_t, uint8_t); // Address of uint8 write routine
+ uint32_t cpuFlags; // v6809 IRQ/RESET flags
+ uint32_t clockOverrun;
};
// Function prototypes
-void Execute6809(V6809REGS *, DWORD); // Function to execute 6809 instructions
+void Execute6809(V6809REGS *, uint32_t); // Function to execute 6809 instructions
+uint64_t GetCurrentV6809Clock(void); // Get the clock of the currently executing CPU
+uint16_t GetCurrentV6809PC(void); // Get the PC of the currently executing CPU
+void SetLineOfCurrentV6809(uint32_t line); // Set a line of the currently executing CPU
+void ClearLineOfCurrentV6809(uint32_t line); // Clear a line of the currently executing CPU
#endif // __V6809_H__
+