-
Notifications
You must be signed in to change notification settings - Fork 0
/
cga.asm
92 lines (87 loc) · 2.66 KB
/
cga.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
.ifndef CGA
CGA = 1
.include "x16.inc"
cgapalette:
jmp @load ; jump ahead of palette data to load routine
@data:
.word $000,$00A,$0A0,$0AA ; full 16-color palette
.word $A00,$A0A,$A50,$AAA
.word $555,$55F,$5F5,$5FF
.word $F55,$F5F,$FF5,$FFF
.word $000,$0A0,$A00,$A50 ; MODE 4, PALETTE 0, LOW INTENSITY
.word $000,$000,$000,$000
.word $000,$000,$000,$000
.word $000,$000,$000,$000
.word $000,$5F5,$F55,$FF5 ; MODE 4, PALETTE 0, HIGH INTENSITY
.word $000,$000,$000,$000
.word $000,$000,$000,$000
.word $000,$000,$000,$000
.word $000,$0AA,$A0A,$AAA ; MODE 4, PALETTE 1, LOW INTENSITY
.word $000,$000,$000,$000
.word $000,$000,$000,$000
.word $000,$000,$000,$000
.word $000,$5FF,$F5F,$FFF ; MODE 4, PALETTE 1, HIGH INTENSITY
.word $000,$000,$000,$000
.word $000,$000,$000,$000
.word $000,$000,$000,$000
.word $000,$0AA,$A00,$AAA ; MODE 5, LOW INTENSITY, COLOR
.word $000,$000,$000,$000
.word $000,$000,$000,$000
.word $000,$000,$000,$000
.word $000,$5FF,$F55,$FFF ; MODE 5, HIGH INTENSITY, COLOR
.word $000,$000,$000,$000
.word $000,$000,$000,$000
.word $000,$000,$000,$000
.word $000,$030,$070,$0A0 ; MODE 5, LOW INTENSITY, GREEN
.word $000,$000,$000,$000
.word $000,$000,$000,$000
.word $000,$000,$000,$000
.word $000,$050,$0A0,$0F0 ; MODE 5, HIGH INTENSITY, GREEN
.word $000,$000,$000,$000
.word $000,$000,$000,$000
.word $000,$000,$000,$000
.word $000,$740,$A61,$A93 ; MODE 5, LOW INTENSITY, AMBER
.word $000,$000,$000,$000
.word $000,$000,$000,$000
.word $000,$000,$000,$000
.word $000,$C60,$FA1,$FF5 ; MODE 5, HIGH INTENSITY, AMBER
.word $000,$000,$000,$000
.word $000,$000,$000,$000
.word $000,$000,$000,$000
.word $000,$000,$000,$000 ; offset 11 - spare
.word $000,$000,$000,$000
.word $000,$000,$000,$000
.word $000,$000,$000,$000
.word $000,$000,$000,$000 ; offset 12 - spare
.word $000,$000,$000,$000
.word $000,$000,$000,$000
.word $000,$000,$000,$000
.word $000,$000,$000,$000 ; offset 13 - spare
.word $000,$000,$000,$000
.word $000,$000,$000,$000
.word $000,$000,$000,$000
.word $000,$000,$000,$000 ; offset 14 - spare
.word $000,$000,$000,$000
.word $000,$000,$000,$000
.word $000,$000,$000,$000
.word $000,$000,$000,$000 ; offset 15 - spare
.word $000,$000,$000,$000
.word $000,$000,$000,$000
.word $000,$000,$000,$000
@load:
lda #0 ; select VERA port 0
sta VERA_ctrl
VERA_SET_ADDR VRAM_palette, 1
ldx #0 ; start with first half of palette
@loop1:
lda @data,x
sta VERA_data ; store byte to VRAM
inx
bne @loop1 ; loop until index rolls over
@loop2:
lda @data+256,x ; load second half of palette
sta VERA_data ; store byte to VRAM
inx
bne @loop2 ; loop until index rolls over
rts
.endif