-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrambank.asm
38 lines (31 loc) · 890 Bytes
/
rambank.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
; B: new RAM page to put in $C000 - $FFFF
; Assumes interrupts are disabled
setrambank:
ld a, (23388) ;System var with the previous value
and $f8 ;Preserve the high bits
or b ;Set RAM page in B
ld bc, $7ffd ;Port to write to
ld (23388),a ;Update system var
out (c),a ;Go
ret
setrambank_with_di:
di
call setrambank
ei
ret
; Switch the visible screen
; Assumes interrupts are disabled
switchscreen:
ld a,(23388) ;System var with the previous value
xor 8 ;switch screen
ld bc,32765 ;Port to write to
ld (23388),a ;Update system var
out (c),a ;Switch
ret
setscreen0:
ld a,(23388) ;System var with the previous value
and $f7 ; leave bit 3 as 0
ld bc,32765 ;Port to write to
ld (23388),a ;Update system var
out (c),a ;Switch
ret