forked from nonakap/xnp2
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcpumem.h
119 lines (89 loc) · 2.92 KB
/
cpumem.h
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
113
114
115
116
117
118
#pragma once
#ifndef MEMCALL
#define MEMCALL
#endif
#if defined(MEMORDERTYPE) && (MEMORDERTYPE != 0)
#error : MEMORDERTYPE != 0
#endif
// 000000-0fffff メインメモリ
// 100000-10ffef HMA
// 110000-193fff FONT-ROM/RAM
// 1a8000-1bffff VRAM1
// 1c0000-1c7fff ITF-ROM BAK
// 1c8000-1dffff EPSON RAM
// 1e0000-1e7fff VRAM1
// 1f8000-1fffff ITF-ROM
#define USE_HIMEM 0x110000
enum {
VRAM_STEP = 0x100000,
VRAM_B = 0x0a8000,
VRAM_R = 0x0b0000,
VRAM_G = 0x0b8000,
VRAM_E = 0x0e0000,
VRAM0_B = VRAM_B,
VRAM0_R = VRAM_R,
VRAM0_G = VRAM_G,
VRAM0_E = VRAM_E,
VRAM1_B = (VRAM_STEP + VRAM_B),
VRAM1_R = (VRAM_STEP + VRAM_R),
VRAM1_G = (VRAM_STEP + VRAM_G),
VRAM1_E = (VRAM_STEP + VRAM_E),
FONT_ADRS = 0x110000,
ITF_ADRS = 0x1f8000
};
#define VRAMADDRMASKEX(a) ((a) & (VRAM_STEP | 0x7fff))
#ifdef __cplusplus
extern "C" {
#endif
extern UINT8 mem[0x200000];
void MEMCALL i286_memorymap(UINT type);
void MEMCALL i286_vram_dispatch(UINT operate);
UINT8 MEMCALL i286_memoryread(UINT32 address);
UINT16 MEMCALL i286_memoryread_w(UINT32 address);
void MEMCALL i286_memorywrite(UINT32 address, UINT8 value);
void MEMCALL i286_memorywrite_w(UINT32 address, UINT16 value);
UINT8 MEMCALL i286_membyte_read(UINT seg, UINT off);
UINT16 MEMCALL i286_memword_read(UINT seg, UINT off);
void MEMCALL i286_membyte_write(UINT seg, UINT off, UINT8 value);
void MEMCALL i286_memword_write(UINT seg, UINT off, UINT16 value);
void MEMCALL i286_memstr_read(UINT seg, UINT off, void *dat, UINT leng);
void MEMCALL i286_memstr_write(UINT seg, UINT off,
const void *dat, UINT leng);
void MEMCALL i286_memx_read(UINT32 address, void *dat, UINT leng);
void MEMCALL i286_memx_write(UINT32 address, const void *dat, UINT leng);
#ifdef __cplusplus
}
#endif
// ---- Memory map
#define MEMM_ARCH(t) i286_memorymap(t)
#define MEMM_VRAM(o) i286_vram_dispatch(o)
// ---- Physical Space (DMA)
#define MEMP_READ8(addr) \
i286_memoryread((addr))
#define MEMP_WRITE8(addr, dat) \
i286_memorywrite((addr), (dat))
// ---- Logical Space (BIOS)
#define MEML_READ8(addr) \
i286_memoryread((addr))
#define MEML_READ16(addr) \
i286_memoryread_w((addr))
#define MEML_WRITE8(addr, dat) \
i286_memorywrite((addr), (dat))
#define MEML_WRITE16(addr, dat) \
i286_memorywrite_w((addr), (dat))
#define MEML_READS(addr, dat, leng) \
i286_memx_read((addr), (dat), (leng))
#define MEML_WRITES(addr, dat, leng) \
i286_memx_write((addr), (dat), (leng))
#define MEMR_READ8(seg, off) \
i286_membyte_read((seg), (off))
#define MEMR_READ16(seg, off) \
i286_memword_read((seg), (off))
#define MEMR_WRITE8(seg, off, dat) \
i286_membyte_write((seg), (off), (dat))
#define MEMR_WRITE16(seg, off, dat) \
i286_memword_write((seg), (off), (dat))
#define MEMR_READS(seg, off, dat, leng) \
i286_memstr_read((seg), (off), (dat), (leng))
#define MEMR_WRITES(seg, off, dat, leng) \
i286_memstr_write((seg), (off), (dat), (leng))