-
Notifications
You must be signed in to change notification settings - Fork 31
/
paging.asm
61 lines (52 loc) · 1.08 KB
/
paging.asm
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
;
; ZX Diagnostics - fixing ZX Spectrums in the 21st Century
; https://github.com/brendanalford/zx-diagnostics
;
; Original code by Dylan Smith
; Modifications and 128K support by Brendan Alford
;
; This code is free software; you can redistribute it and/or
; modify it under the terms of the GNU Lesser General Public
; License as published by the Free Software Foundation;
; version 2.1 of the License.
;
; This code is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
; Lesser General Public License for more details.
;
; paging.asm
;
;
; Pages the given RAM page into memory.
; Inputs: A=desired RAM page.
;
pagein
push bc
push af
ld bc, 0x7ffd
; Ensure nothing else apart from paging gets touched
and 0x7
out (c), a
pop af
pop bc
ret
;
; Pages the given ROM into ROM address space.
; Inputs: A=desired ROM page.
;
pagein_rom
push af
rla
and 0x04
ld bc, 0x1ffd
out (c), a
pop af
rla
rla
rla
rla
and 0x10
ld bc, 0x7ffd
out (c), a
ret