]> Shamusworld >> Repos - thunder/blob - src/v6809.h
Initial import (for historical reasons).
[thunder] / 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         WORD pc;                                        // 6809 PC register
39         WORD x;                                         // 6809 X index register
40         WORD y;                                         // 6809 Y index register
41         WORD s;                                         // 6809 System stack pointer
42         WORD u;                                         // 6809 User stack pointer
43         BYTE cc;                                        // 6809 Condition Code register
44         BYTE a;                                         // 6809 A register
45         BYTE b;                                         // 6809 B register
46         BYTE dp;                                        // 6809 Direct Page register
47         DWORD clock;                            // 6809 clock
48 //DWORD _reserved;//    BYTE (* Fetch)(WORD&);          // Address of BYTE fetch routine
49         BYTE (* RdMem)(WORD);           // Address of BYTE read routine
50         void (* WrMem)(WORD, BYTE);     // Address of BYTE write routine
51         DWORD cpuFlags;                         // v6809 IRQ/RESET flags
52 };
53
54 // Function prototypes
55
56 void Execute6809(V6809REGS *, DWORD);                                   // Function to execute 6809 instructions
57
58 #endif  // __V6809_H__