]> Shamusworld >> Repos - stargem2/blob - src/v6809.h
a34c1d1f1d974db8675b6a88e2a8b37766a0dd79
[stargem2] / src / v6809.h
1 //
2 // Virtual 6809 Header file
3 //
4 // by James L. Hammons
5 //
6 // (c) 1997, 2004 Underground Software
7 //
8
9 #ifndef __V6809_H__
10 #define __V6809_H__
11
12 #include "types.h"
13
14 // Useful defines
15
16 #define FLAG_E          0x80            // Entire
17 #define FLAG_F          0x40            // Fast IRQ
18 #define FLAG_H          0x20            // Half carry
19 #define FLAG_I          0x10            // IRQ
20 #define FLAG_N          0x08            // Negative
21 #define FLAG_Z          0x04            // Zero
22 #define FLAG_V          0x02            // oVerflow
23 #define FLAG_C          0x01            // Carry
24
25 #define V6809_ASSERT_LINE_RESET         0x0001          // v6809 RESET line
26 #define V6809_ASSERT_LINE_IRQ           0x0002          // v6809 IRQ line
27 #define V6809_ASSERT_LINE_FIRQ          0x0004          // v6809 FIRQ line
28 #define V6809_ASSERT_LINE_NMI           0x0008          // v6809 NMI line
29 #define V6809_STATE_SYNC                        0x0010          // v6809 SYNC line
30 #define V6809_STATE_ILLEGAL_INST        0x0020          // Illegal instruction executed flag
31
32 //#define V6809_START_DEBUG_LOG EQU     0020h           // Debug log go (temporary!)
33
34 // Useful structs
35
36 struct V6809REGS
37 {
38         uint16 pc;                                              // 6809 PC register
39         uint16 x;                                               // 6809 X index register
40         uint16 y;                                               // 6809 Y index register
41         uint16 s;                                               // 6809 System stack pointer
42         uint16 u;                                               // 6809 User stack pointer
43         uint8 cc;                                               // 6809 Condition Code register
44         uint8 a;                                                // 6809 A register
45         uint8 b;                                                // 6809 B register
46         uint8 dp;                                               // 6809 Direct Page register
47         uint32 clock;                                   // 6809 clock
48 //uint32 _reserved;//   uint8 (* Fetch)(uint16&);               // Address of uint8 fetch routine
49         uint8 (* RdMem)(uint16);                // Address of uint8 read routine
50         void (* WrMem)(uint16, uint8);  // Address of uint8 write routine
51         uint32 cpuFlags;                                // v6809 IRQ/RESET flags
52 };
53
54 // Function prototypes
55
56 void Execute6809(V6809REGS *, uint32);                  // Function to execute 6809 instructions
57 uint32 GetCurrentV6809Clock(void);                              // Get the clock of the currently executing CPU
58
59 #endif  // __V6809_H__