annotate jagcpu.h @ 1860:bdca98187c9f

Reorder controllers based on which one receives player input first
author Michael Pavone <pavone@retrodev.com>
date Fri, 03 May 2019 18:40:13 -0700
parents c48d5191ddc9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1118
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1 #ifndef JAGCPU_H_
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2 #define JAGCPU_H_
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
3
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
4 enum {
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
5 JAG_ADD,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
6 JAG_ADDC,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
7 JAG_ADDQ,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
8 JAG_ADDQT,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
9 JAG_SUB,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
10 JAG_SUBC,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
11 JAG_SUBQ,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
12 JAG_SUBQT,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
13 JAG_NEG,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
14 JAG_AND,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
15 JAG_OR,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
16 JAG_XOR,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
17 JAG_NOT,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
18 JAG_BTST,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
19 JAG_BSET,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
20 JAG_BCLR,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
21 JAG_MULT,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
22 JAG_IMULT,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
23 JAG_IMULTN,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
24 JAG_RESMAC,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
25 JAG_IMACN,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
26 JAG_DIV,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
27 JAG_ABS,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
28 JAG_SH,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
29 JAG_SHLQ,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
30 JAG_SHRQ,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
31 JAG_SHA,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
32 JAG_SHARQ,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
33 JAG_ROR,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
34 JAG_RORQ,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
35 JAG_CMP,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
36 JAG_CMPQ,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
37 GPU_SAT8,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
38 DSP_SUBQMOD = GPU_SAT8,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
39 GPU_SAT16,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
40 DSP_SAT16S = GPU_SAT16,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
41 JAG_MOVE,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
42 JAG_MOVEQ,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
43 JAG_MOVETA,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
44 JAG_MOVEFA,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
45 JAG_MOVEI,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
46 JAG_LOADB,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
47 JAG_LOADW,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
48 JAG_LOAD,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
49 GPU_LOADP,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
50 DSP_SAT32S = GPU_LOADP,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
51 JAG_LOAD_R14_REL,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
52 JAG_LOAD_R15_REL,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
53 JAG_STOREB,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
54 JAG_STOREW,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
55 JAG_STORE,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
56 GPU_STOREP,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
57 DSP_MIRROR = GPU_STOREP,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
58 JAG_STORE_R14_REL,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
59 JAG_STORE_R15_REL,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
60 JAG_MOVE_PC,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
61 JAG_JUMP,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
62 JAG_JR,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
63 JAG_MMULT,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
64 JAG_MTOI,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
65 JAG_NORMI,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
66 JAG_NOP,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
67 JAG_LOAD_R14_INDEXED,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
68 JAG_LOAD_R15_INDEXED,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
69 JAG_STORE_R14_INDEXED,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
70 JAG_STORE_R15_INDEXED,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
71 GPU_SAT24,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
72 GPU_PACK,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
73 DSP_ADDQMOD = GPU_PACK,
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
74 GPU_UNPACK //virtual opcode, UNPACK is PACK with a reg1 field set to 1
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
75 };
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
76
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
77 #define JAGCPU_NOREG -1
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
78
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
79
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
80 typedef struct {
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
81 cpu_options gen;
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
82 int8_t regs[32];
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
83 int8_t result;
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
84 int8_t resultreg;
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
85 int8_t bankptr;
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
86 uint8_t is_gpu;
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
87 } jag_cpu_options;
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
88
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
89 typedef struct {
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
90 uint32_t read_high;
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
91 } jag_gpu;
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
92
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
93 typedef struct {
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
94 uint8_t mac_high;
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
95 uint8_t modulo;
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
96 } jag_dsp;
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
97
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
98 typedef struct {
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
99 uint32_t cycles;
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
100 uint32_t regs[64];
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
101 uint32_t *main;
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
102 uint32_t *alt;
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
103 uint32_t pc;
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
104 uint32_t result;
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
105 uint32_t flags;
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
106 uint32_t flags_pending;
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
107 uint32_t remainder;
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
108 union {
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
109 jag_gpu gpu;
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
110 jag_dsp dsp;
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
111 };
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
112 int8_t writeback;
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
113 int8_t resultreg;
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
114 uint8_t is_gpu;
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
115 } jag_cpu;
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
116
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
117 uint16_t jag_opcode(uint16_t inst, uint8_t is_gpu);
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
118 char * jag_cc(uint16_t inst);
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
119 uint16_t jag_reg2(uint16_t inst);
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
120 uint32_t jag_jr_dest(uint16_t inst, uint32_t address);
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
121 int jag_cpu_disasm(uint16_t **stream, uint32_t address, char *dst, uint8_t is_gpu, uint8_t labels);
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
122
c48d5191ddc9 Added Jaguar header missed in earlier commits
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
123 #endif