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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
|
;--------------------------------------------------------
; File Created by SDCC : free open source ANSI-C Compiler
; Version 3.5.0 #9253 (Mar 24 2016) (Linux)
; This file was generated Wed Aug 23 21:44:59 2017
;--------------------------------------------------------
.module memory
.optsdcc -mz80
;--------------------------------------------------------
; Public variables in this module
;--------------------------------------------------------
.globl _pages_table
.globl _mmu_write_table
.globl _page_map
.globl _page_unmap
;--------------------------------------------------------
; special function registers
;--------------------------------------------------------
;--------------------------------------------------------
; ram data
;--------------------------------------------------------
.area _DATA
_pages_table::
.ds 192
;--------------------------------------------------------
; ram data
;--------------------------------------------------------
.area _INITIALIZED
;--------------------------------------------------------
; absolute external ram data
;--------------------------------------------------------
.area _DABS (ABS)
;--------------------------------------------------------
; global & static initialisations
;--------------------------------------------------------
.area _HOME
.area _GSINIT
.area _GSFINAL
.area _GSINIT
;--------------------------------------------------------
; Home
;--------------------------------------------------------
.area _HOME
.area _HOME
;--------------------------------------------------------
; code
;--------------------------------------------------------
.area _CODE
;kernel/memory.c:5: int mmu_write_table(void)
; ---------------------------------
; Function mmu_write_table
; ---------------------------------
_mmu_write_table::
;kernel/memory.c:9: for (i = 0; i < PAGES_MAX_COUNT; i++) {
ld hl,#0x0000
00102$:
inc hl
ld a,l
sub a, #0x20
ld a,h
rla
ccf
rra
sbc a, #0x80
jr C,00102$
;kernel/memory.c:15: return 0;
ld hl,#0x0000
ret
;kernel/memory.c:18: int page_map(int page, int pid, uint16_t addr)
; ---------------------------------
; Function page_map
; ---------------------------------
_page_map::
push ix
ld ix,#0
add ix,sp
;kernel/memory.c:20: if (page >= PAGES_MAX_COUNT)
ld a,4 (ix)
sub a, #0x20
ld a,5 (ix)
rla
ccf
rra
sbc a, #0x80
jr C,00102$
;kernel/memory.c:21: return -1;
ld hl,#0xFFFF
jr 00105$
00102$:
;kernel/memory.c:23: if (pages_table[page].used)
ld de,#_pages_table+0
ld c,4 (ix)
ld b,5 (ix)
ld l, c
ld h, b
add hl, hl
add hl, bc
add hl, hl
add hl,de
ld c,l
ld b,h
ld a,(hl)
and a,#0x01
jr Z,00104$
;kernel/memory.c:24: return -2;
ld hl,#0xFFFE
jr 00105$
00104$:
;kernel/memory.c:26: pages_table[page].addr = addr;
ld e, c
ld d, b
inc de
inc de
push bc
ld hl, #0x000A
add hl, sp
ld bc, #0x0004
ldir
pop bc
;kernel/memory.c:27: pages_table[page].pid = pid;
ld l, c
ld h, b
inc hl
ld a,6 (ix)
ld (hl),a
;kernel/memory.c:29: pages_table[page].used = 1;
ld a,(bc)
or a,#0x01
ld (bc),a
;kernel/memory.c:30: return 0;
ld hl,#0x0000
00105$:
pop ix
ret
;kernel/memory.c:33: int page_unmap(int page)
; ---------------------------------
; Function page_unmap
; ---------------------------------
_page_unmap::
push ix
ld ix,#0
add ix,sp
;kernel/memory.c:35: if (page >= PAGES_MAX_COUNT)
ld a,4 (ix)
sub a, #0x20
ld a,5 (ix)
rla
ccf
rra
sbc a, #0x80
jr C,00102$
;kernel/memory.c:36: return -1;
ld hl,#0xFFFF
jr 00105$
00102$:
;kernel/memory.c:38: if (pages_table[page].used == 0)
ld de,#_pages_table+0
ld c,4 (ix)
ld b,5 (ix)
ld l, c
ld h, b
add hl, hl
add hl, bc
add hl, hl
add hl,de
ld e,l
ld d,h
ld a,(hl)
and a,#0x01
jr NZ,00104$
;kernel/memory.c:39: return -2;
ld hl,#0xFFFE
jr 00105$
00104$:
;kernel/memory.c:41: pages_table[page].used = 0;
ld a,(de)
and a,#0xFE
ld (de),a
;kernel/memory.c:42: return 0;
ld hl,#0x0000
00105$:
pop ix
ret
.area _CODE
.area _INITIALIZER
.area _CABS (ABS)
|