// Virtual 6809 Header file
//
// 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
#define FLAG_V 0x02 // oVerflow
#define FLAG_C 0x01 // Carry
-#define V6809_ASSERT_LINE_RESET 0x0001 // v6809 RESET line
-#define V6809_ASSERT_LINE_IRQ 0x0002 // v6809 IRQ line
-#define V6809_ASSERT_LINE_FIRQ 0x0004 // v6809 FIRQ line
-#define V6809_ASSERT_LINE_NMI 0x0008 // v6809 NMI line
+#define V6809_LINE_RESET 0x0001 // v6809 RESET line
+#define V6809_LINE_IRQ 0x0002 // v6809 IRQ line
+#define V6809_LINE_FIRQ 0x0004 // v6809 FIRQ line
+#define V6809_LINE_NMI 0x0008 // v6809 NMI line
#define V6809_STATE_SYNC 0x0010 // v6809 SYNC line
#define V6809_STATE_ILLEGAL_INST 0x0020 // Illegal instruction executed flag
-
//#define V6809_START_DEBUG_LOG EQU 0020h // Debug log go (temporary!)
// Useful structs
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__