-
Notifications
You must be signed in to change notification settings - Fork 0
/
bmpswitch.asm
69 lines (55 loc) · 1.23 KB
/
bmpswitch.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
62
63
64
65
66
67
68
69
/*
*
* Copyright (c) 2023 Veit Wiessner <[email protected]>
* Published under MIT License (https://opensource.org/license/mit/)
*
* bmpswitch: switch bitmap mode on/off
* memory map: $c000-$c037
*
* Usage:
* sys49152
* first call will switch bitmap mode on, second call will switch it off
*
* syntax for Kick Assembler (http://www.theweb.dk/KickAssembler/Main.html#frontpage)
*
*/
#import "header.asm"
#importonce
.filenamespace bmpswitch
.segment code "bmpswitch"
.const VIC = $D000
.const VIC_CTRL = VIC+17
.const VIC_MEM_CTRL = VIC+24
.const VIC_CTRL_SWITCH = %00100000
.const VIC_MEM_CTRL_SWITCH = %00001000
//.watch $d011
bmpswitch:
lda BMP_ON
bne switchoff
switchon:
lda VIC_CTRL
sta VIC_CTRL_STORE
ora #VIC_CTRL_SWITCH
sta VIC_CTRL
lda VIC_MEM_CTRL
sta VIC_MEM_CTRL_STORE
ora #VIC_MEM_CTRL_SWITCH
sta VIC_MEM_CTRL
lda #$01
sta BMP_ON
jmp end
switchoff:
lda VIC_CTRL_STORE
sta VIC_CTRL
lda VIC_MEM_CTRL_STORE
sta VIC_MEM_CTRL
lda #$00
sta BMP_ON
end:
rts
VIC_CTRL_STORE:
.byte $00
VIC_MEM_CTRL_STORE:
.byte $00
BMP_ON:
.byte $00