1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
#ifndef V810_MEM_H
#define V810_MEM_H
// Memory Structure for the VIP Reg (Could have done it with an array
// but this is pretier...)
typedef struct {
HWORD INTPND;
HWORD INTENB;
HWORD INTCLR;
HWORD DPSTTS;
HWORD DPCTRL;
HWORD BRTA;
HWORD BRTB;
HWORD BRTC;
HWORD REST;
HWORD FRMCYC;
HWORD CTA;
HWORD XPSTTS;
HWORD XPCTRL;
HWORD tFrame; //not publicly visible
HWORD VER;
HWORD SPT[4];
HWORD GPLT[4];
HWORD JPLT[4];
HWORD BKCOL;
} V810_VIPREGDAT;
typedef struct {
BYTE SCR; //Serial Controll Reg, 0x02000028
BYTE WCR; //Wait Controll Reg, 0x02000024
BYTE TCR; //Timer Controll Reg, 0x02000020
BYTE THB; //Timer Higher Byte, 0x0200001C
BYTE TLB; //Timer Lower Byte, 0x02000018
HWORD tTHW; //Timer TempHWord, not publicly visible
WORD tTRC; //Timer TempResolutionCount, not publicly visible
HWORD tCount; //Timer Counter register, not publicly visible
BYTE tReset; //Timer Reset register, not publicly visible
BYTE SHB; //Serial Higher Byte, 0x02000014 //Read Only
BYTE SLB; //Serial Lower Byte, 0x02000010 //Read Only
BYTE CDRR; //Com Recv Data Reg, 0x0200000C //Read Only
BYTE CDTR; //Com Trans Data Reg, 0x02000008
BYTE CCSR; //Com Cnt Stat Reg, 0x02000004
BYTE CCR; //Com Controll Reg, 0x02000000
} V810_HREGDAT;
//Export some data structs...
extern V810_MEMORYFETCH V810_ROM1; // US Games
extern V810_MEMORYFETCH V810_DISPLAY_RAM;
extern V810_MEMORYFETCH V810_SOUND_RAM;
extern V810_MEMORYFETCH V810_VB_RAM;
extern V810_MEMORYFETCH V810_GAME_RAM;
extern V810_VIPREGDAT tVIPREG;
extern V810_HREGDAT tHReg;
//////////////////////////////////////////////////////////
// Global CPU Objects
V810_MEMORYFETCH V810_ROM1; // US Games
V810_MEMORYFETCH V810_DISPLAY_RAM;
V810_MEMORYFETCH V810_SOUND_RAM;
V810_MEMORYFETCH V810_VB_RAM;
V810_MEMORYFETCH V810_GAME_RAM;
V810_REGFETCH V810_VIPCREG;
V810_REGFETCH V810_HCREG;
V810_VIPREGDAT tVIPREG;
V810_HREGDAT tHReg;
extern int is_sram; //Flag if writes to sram...
// Memory read functions
BYTE mem_rbyte(WORD addr);
HWORD mem_rhword(WORD addr);
WORD mem_rword(WORD addr);
// Memory write functions
void mem_wbyte(WORD addr, BYTE data);
void mem_whword(WORD addr, HWORD data);
void mem_wword(WORD addr, WORD data);
// Hardware control register read functions
BYTE hcreg_rbyte(WORD addr);
HWORD hcreg_rhword(WORD addr);
WORD hcreg_rword(WORD addr);
// Hardware control register write functions
void hcreg_wbyte(WORD addr, BYTE data);
void hcreg_whword(WORD addr, HWORD data);
void hcreg_wword(WORD addr, WORD data);
// Port read functions
BYTE port_rbyte(WORD addr);
HWORD port_rhword(WORD addr);
WORD port_rword(WORD addr);
// Port write functions
void port_wbyte(WORD addr, BYTE data);
void port_whword(WORD addr, HWORD data);
void port_wword(WORD addr, WORD data);
// Register I/O read functions
BYTE vipcreg_rbyte(WORD addr);
HWORD vipcreg_rhword(WORD addr);
WORD vipcreg_rword(WORD addr);
// Register I/O write functions
void vipcreg_wbyte(WORD addr, BYTE data);
void vipcreg_whword(WORD addr, HWORD data);
void vipcreg_wword(WORD addr, WORD data);
#endif
|