2 // Virtual 6809 Header file
6 // (C) 1997, 2004 Underground Software
15 #define FLAG_E 0x80 // Entire
16 #define FLAG_F 0x40 // Fast IRQ
17 #define FLAG_H 0x20 // Half carry
18 #define FLAG_I 0x10 // IRQ
19 #define FLAG_N 0x08 // Negative
20 #define FLAG_Z 0x04 // Zero
21 #define FLAG_V 0x02 // oVerflow
22 #define FLAG_C 0x01 // Carry
24 #define V6809_LINE_RESET 0x0001 // v6809 RESET line
25 #define V6809_LINE_IRQ 0x0002 // v6809 IRQ line
26 #define V6809_LINE_FIRQ 0x0004 // v6809 FIRQ line
27 #define V6809_LINE_NMI 0x0008 // v6809 NMI line
28 #define V6809_STATE_SYNC 0x0010 // v6809 SYNC line
29 #define V6809_STATE_ILLEGAL_INST 0x0020 // Illegal instruction executed flag
30 //#define V6809_START_DEBUG_LOG EQU 0020h // Debug log go (temporary!)
36 uint16_t pc; // 6809 PC register
37 uint16_t x; // 6809 X index register
38 uint16_t y; // 6809 Y index register
39 uint16_t s; // 6809 System stack pointer
40 uint16_t u; // 6809 User stack pointer
41 uint8_t cc; // 6809 Condition Code register
42 uint8_t a; // 6809 A register
43 uint8_t b; // 6809 B register
44 uint8_t dp; // 6809 Direct Page register
45 uint64_t clock; // 6809 clock (@ 1 MHz, wraps at 570842 years)
46 uint8_t (* RdMem)(uint16_t); // Address of uint8 read routine
47 void (* WrMem)(uint16_t, uint8_t); // Address of uint8 write routine
48 uint32_t cpuFlags; // v6809 IRQ/RESET flags
49 uint32_t clockOverrun;
52 // Function prototypes
54 void Execute6809(V6809REGS *, uint32_t); // Function to execute 6809 instructions
55 uint64_t GetCurrentV6809Clock(void); // Get the clock of the currently executing CPU
56 uint16_t GetCurrentV6809PC(void); // Get the PC of the currently executing CPU
57 void SetLineOfCurrentV6809(uint32_t line); // Set a line of the currently executing CPU
58 void ClearLineOfCurrentV6809(uint32_t line); // Clear a line of the currently executing CPU