]> Shamusworld >> Repos - thunder/blob - src/v6808.h
Added v6808 CPUs, support files
[thunder] / src / v6808.h
1 //
2 // Virtual 6808 Header file
3 //
4 // by James L. Hammons
5 //
6 // (C) 2006 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 ??? [No.]
17 #define FLAG_F          0x40            // ??? Fast IRQ ??? [No.]
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 V6808_ASSERT_LINE_RESET         0x0001          // v6808 RESET line
26 #define V6808_ASSERT_LINE_IRQ           0x0002          // v6808 IRQ line
27 #define V6808_ASSERT_LINE_NMI           0x0004          // v6808 NMI line
28 #define V6808_STATE_WAI                         0x0008          // v6808 wait for IRQ line
29 #define V6808_STATE_ILLEGAL_INST        0x0010          // Illegal instruction executed flag
30 //#define V6809_START_DEBUG_LOG         0x0020          // Debug log go (temporary!)
31
32 // Useful structs
33
34 struct V6808REGS
35 {
36         uint16 pc;                                              // 6808 PC register
37         uint16 x;                                               // 6808 X index register
38         uint16 s;                                               // 6808 System stack pointer
39         uint8 cc;                                               // 6808 Condition Code register
40         uint8 a;                                                // 6808 A register
41         uint8 b;                                                // 6808 B register
42         uint64 clock;                                   // 6808 clock
43         uint8 (* RdMem)(uint16);                // Address of uint8 read routine
44         void (* WrMem)(uint16, uint8);  // Address of uint8 write routine
45         uint32 cpuFlags;                                // v6808 IRQ/RESET flags
46         uint32 clockOverrun;                    // Amount of overflow between runs
47 };
48
49 // Function prototypes
50
51 void Execute6808(V6808REGS *, uint32);  // Function to execute 6808 instructions
52 uint64 GetCurrentV6808Clock(void);              // Get the clock of the currently executing CPU
53 //uint8 GetCCRegister(void);                            // Hmm.
54
55 #endif  // __V6808_H__