]> Shamusworld >> Repos - stargem2/blob - src/v6808.h
Finally fixed problems with demo mode.
[stargem2] / src / v6808.h
1 //
2 // Virtual 6808 Header file
3 //
4 // by James Hammons
5 //
6 // (C) 2006 Underground Software
7 //
8 #ifndef __V6808_H__
9 #define __V6808_H__
10
11 #include <stdint.h>
12
13 // Useful defines
14
15 #define FLAG_E          0x80            // ??? Entire ??? [No.]
16 #define FLAG_F          0x40            // ??? Fast IRQ ??? [No.]
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
23
24 #define V6808_LINE_RESET                        0x0001  // v6808 RESET line
25 #define V6808_LINE_IRQ                          0x0002  // v6808 IRQ line
26 #define V6808_LINE_NMI                          0x0004  // v6808 NMI line
27 #define V6808_STATE_WAI                         0x0008  // v6808 wait for IRQ line
28 #define V6808_STATE_ILLEGAL_INST        0x0010  // Illegal instruction executed flag
29 //#define V6809_START_DEBUG_LOG         0x0020  // Debug log go (temporary!)
30
31 // Useful structs
32
33 struct V6808REGS
34 {
35         uint16_t pc;                                    // 6808 PC register
36         uint16_t x;                                             // 6808 X index register
37         uint16_t s;                                             // 6808 System stack pointer
38         uint8_t cc;                                             // 6808 Condition Code register
39         uint8_t a;                                              // 6808 A register
40         uint8_t b;                                              // 6808 B register
41         uint64_t clock;                                 // 6808 clock
42         uint8_t (* RdMem)(uint16_t);    // Address of uint8 read routine
43         void (* WrMem)(uint16_t, uint8_t);      // Address of uint8 write routine
44         uint32_t cpuFlags;                              // v6808 IRQ/RESET flags
45         uint32_t clockOverrun;                  // Amount of overflow between runs
46 };
47
48 // Function prototypes
49
50 void Execute6808(V6808REGS *, uint32_t);        // Function to execute 6808 instructions
51 uint64_t GetCurrentV6808Clock(void);            // Get the clock of the currently executing CPU
52 //uint8 GetCCRegister(void);                            // Hmm.
53
54 #endif  // __V6808_H__
55