comparison src/cpu.h @ 43:6e7bfe83d2b0

Changed the design to vastly simplify the video hardware and support a 23-bit address space on the CPU
author Michael Pavone <pavone@retrodev.com>
date Sat, 27 Aug 2016 22:38:31 -0700
parents fb14515266f4
children 51672bd41cdd
comparison
equal deleted inserted replaced
42:a64e11e48a41 43:6e7bfe83d2b0
16 #define MEM_READ 1 16 #define MEM_READ 1
17 #define MEM_WRITE 2 17 #define MEM_WRITE 2
18 18
19 typedef struct { 19 typedef struct {
20 uint8_t *base; 20 uint8_t *base;
21 uint16_t start; 21 uint32_t start;
22 uint16_t end; 22 uint32_t end;
23 uint32_t mask;
23 uint8_t flags; 24 uint8_t flags;
24 } memory_region; 25 } memory_region;
25 26
26 27
27 struct cpu { 28 struct cpu {
31 uint32_t current_target; 32 uint32_t current_target;
32 uint32_t num_mem_regions; 33 uint32_t num_mem_regions;
33 uint16_t regs[16]; 34 uint16_t regs[16];
34 uint16_t exception; 35 uint16_t exception;
35 uint16_t exception_pc; 36 uint16_t exception_pc;
37 uint16_t exception_pch;
36 uint16_t exception_sr; 38 uint16_t exception_sr;
37 uint16_t exception_ur; 39 uint16_t exception_ur;
38 uint16_t vector_base; 40 uint16_t vector_base;
41 uint32_t pc_msb;
42 uint32_t data_low_msb;
43 uint32_t data_high_msb;
39 44
40 uint16_t prefetch; 45 uint16_t prefetch;
41 46
42 uint8_t state; 47 uint8_t state;
43 uint8_t pending_interrupts; 48 uint8_t pending_interrupts;
81 NEG, 86 NEG,
82 NOT, 87 NOT,
83 CMP, 88 CMP,
84 CALL, 89 CALL,
85 SWAP, 90 SWAP,
86 IN, 91 LONGJMP,
87 OUT,
88 INI, 92 INI,
89 OUTI, 93 OUTI,
90 ADDI, 94 ADDI,
91 ANDI, 95 ANDI,
92 ORI, 96 ORI,
97 XORI,
93 LSI, 98 LSI,
94 CMPI, 99 CMPI,
95 SINGLE_REG 100 SINGLE_REG
96 }; 101 };
97 102
98 enum { 103 enum {
99 RETI, 104 RETI,
100 TRAP,
101 TRAPI, 105 TRAPI,
102 GETEPC, 106 GETEPC,
103 SETEPC, 107 SETEPC,
108 GETEPCH,
109 SETEPCH,
104 GETESR, 110 GETESR,
105 SETESR, 111 SETESR,
106 GETEUR, 112 GETEUR,
107 SETEUR, 113 SETEUR,
108 GETENUM, 114 GETENUM,
109 SETENUM, 115 SETENUM,
110 GETVBR, 116 GETVBR,
111 SETVBR 117 SETVBR,
118 GETDATABANKS,
119 SETDATABANKS,
112 }; 120 };
113 121
114 enum { 122 enum {
115 COND_ALWAYS, 123 COND_ALWAYS,
116 COND_NEVER, 124 COND_NEVER,