]> Shamusworld >> Repos - apple2/blob - src/v65c02.h
Miscellaneous bugfixes.
[apple2] / src / v65c02.h
1 //
2 // Virtual 65C02 Header file
3 //
4 // by James Hammons
5 // (c) 2005-2018 Underground Software
6 //
7
8 #ifndef __V65C02_H__
9 #define __V65C02_H__
10
11 #include <stdint.h>
12
13 // Useful defines
14
15 #define FLAG_N          0x80            // Negative
16 #define FLAG_V          0x40            // oVerflow
17 #define FLAG_UNK        0x20            // ??? (always set when read?)
18 #define FLAG_B          0x10            // Break
19 #define FLAG_D          0x08            // Decimal
20 #define FLAG_I          0x04            // Interrupt
21 #define FLAG_Z          0x02            // Zero
22 #define FLAG_C          0x01            // Carry
23
24 #define V65C02_ASSERT_LINE_RESET        0x0001          // v65C02 RESET line
25 #define V65C02_ASSERT_LINE_IRQ          0x0002          // v65C02 IRQ line
26 #define V65C02_ASSERT_LINE_NMI          0x0004          // v65C02 NMI line
27 #define V65C02_STATE_ILLEGAL_INST       0x0008          // Illegal instruction executed flag
28 //#define V65C02_START_DEBUG_LOG                0x0020          // Debug log go (temporary!)
29
30 // Useful structs
31
32 struct V65C02REGS
33 {
34         uint16_t pc;                            // 65C02 PC register
35         uint8_t cc;                                     // 65C02 Condition Code register
36         uint8_t sp;                                     // 65C02 System stack pointer (bound to $01xx)
37         uint8_t a;                                      // 65C02 A register
38         uint8_t x;                                      // 65C02 X index register
39         uint8_t y;                                      // 65C02 Y register
40         uint64_t clock;                         // 65C02 clock (@1 MHz, wraps at 570,842 years)
41         uint8_t (* RdMem)(uint16_t);    // Address of BYTE read routine
42         void (* WrMem)(uint16_t, uint8_t);      // Address of BYTE write routine
43         void (* Timer)(uint16_t);       // Address of Timer routine
44         uint16_t cpuFlags;                      // v65C02 IRQ/RESET flags
45         uint64_t overflow;                      // # of cycles we went over last time through
46 };
47
48 // Global variables (exported)
49
50 extern bool dumpDis;
51
52 // Exported functions
53
54 void Execute65C02(V65C02REGS *, uint32_t);
55
56 #endif  // __V65C02_H__
57