]> Shamusworld >> Repos - stargem2/blob - src/v6808.h
a3d6d9041efa80fb99a94c82703756195df8684f
[stargem2] / src / v6808.h
1 //
2 // Virtual 6808 Header file
3 //
4 // by James L. Hammons
5 //
6 // (c) 2004 Underground Software
7 //
8
9 #ifndef __V6808_H__
10 #define __V6808_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
19 #define FLAG_H          0x20            // Half carry
20 #define FLAG_I          0x10            // IRQ
21 #define FLAG_N          0x08            // Negative
22 #define FLAG_Z          0x04            // Zero
23 #define FLAG_V          0x02            // oVerflow
24 #define FLAG_C          0x01            // Carry
25
26 #define V6808_ASSERT_LINE_RESET         0x0001          // v6808 RESET line
27 #define V6808_ASSERT_LINE_IRQ           0x0002          // v6808 IRQ line
28 #define V6808_ASSERT_LINE_NMI           0x0004          // v6808 NMI line
29 #define V6808_STATE_SYNC                        0x0008          // ??? v6808 SYNC line ???
30 #define V6808_STATE_ILLEGAL_INST        0x0010          // Illegal instruction executed flag
31 //#define V6809_START_DEBUG_LOG         0x0020          // Debug log go (temporary!)
32
33 // Useful structs
34
35 struct V6808REGS
36 {
37         uint16 pc;                                              // 6808 PC register
38         uint16 x;                                               // 6808 X index register
39         uint16 s;                                               // 6808 System stack pointer
40         uint8 cc;                                               // 6808 Condition Code register
41         uint8 a;                                                // 6808 A register
42         uint8 b;                                                // 6808 B register
43         uint32 clock;                                   // 6808 clock
44 //uint32 _reserved;//   uint8 (* Fetch)(uint16&);               // Address of uint8 fetch routine
45         uint8 (* RdMem)(uint16);                // Address of uint8 read routine
46         void (* WrMem)(uint16, uint8);  // Address of uint8 write routine
47         uint32 cpuFlags;                                // v6808 IRQ/RESET flags
48 };
49
50 // Function prototypes
51
52 void Execute6808(V6808REGS *, uint32);    // Function to execute 6808 instructions
53 uint32 GetCurrentV6808Clock(void);              // Get the clock of the currently executing CPU
54
55 #endif  // __V6808_H__