]> Shamusworld >> Repos - thunder/blob - src/v6808.h
Code cleanup.
[thunder] / src / v6808.h
1 //
2 // Virtual 6808 Header file
3 //
4 // by James Hammons
5 //
6 // (C) 2006 Underground Software
7 //
8
9 #ifndef __V6808_H__
10 #define __V6808_H__
11
12 #include <stdint.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_t pc;                                    // 6808 PC register
37         uint16_t x;                                             // 6808 X index register
38         uint16_t s;                                             // 6808 System stack pointer
39         uint8_t cc;                                             // 6808 Condition Code register
40         uint8_t a;                                              // 6808 A register
41         uint8_t b;                                              // 6808 B register
42         uint64_t clock;                                 // 6808 clock
43         uint8_t (* RdMem)(uint16_t);    // Address of uint8_t read routine
44         void (* WrMem)(uint16_t, uint8_t);      // Address of uint8_t write routine
45         uint32_t cpuFlags;                              // v6808 IRQ/RESET flags
46         uint32_t clockOverrun;                  // Amount of overflow between runs
47 };
48
49 // Function prototypes
50
51 void Execute6808(V6808REGS *, uint32_t);        // Function to execute 6808 instructions
52 uint64_t GetCurrentV6808Clock(void);            // Get the clock of the currently executing CPU
53 //uint8_t GetCCRegister(void);                          // Hmm.
54
55 #endif  // __V6808_H__
56