]> git.sur5r.net Git - cc65/blob - libsrc/pce/color.s
0ff991a2e38519d240ac95d179070a0a1a45fb40
[cc65] / libsrc / pce / color.s
1 ;
2 ; unsigned char __fastcall__ textcolor (unsigned char color);
3 ; unsigned char __fastcall__ bgcolor (unsigned char color);
4 ; unsigned char __fastcall__ bordercolor (unsigned char color);
5 ;
6
7
8         .export     _textcolor, _bgcolor, _bordercolor
9
10         .include        "pce.inc"
11         .include        "extzp.inc"
12
13 _textcolor:
14         ldx     CHARCOLOR       ; get old value
15         sta     CHARCOLOR       ; set new value
16         txa
17         rts
18
19 _bgcolor:
20         ldx     BGCOLOR         ; get old value
21         sta     BGCOLOR         ; set new value
22         asl     a
23         tay
24
25         stz     VCE_ADDR_LO
26         stz     VCE_ADDR_HI
27         lda     colors,y
28         sta     VCE_DATA_LO
29         lda     colors+1,y
30         sta     VCE_DATA_HI
31
32         txa
33         rts
34
35 _bordercolor:
36         lda     #0
37         tax
38         rts
39
40         .rodata
41         .export colors
42
43 colors:
44         ;       G      R      B
45         .word ((0<<6)+(0<<3)+(0))       ; 0 black
46         .word ((7<<6)+(7<<3)+(7))       ; 1 white
47         .word ((0<<6)+(7<<3)+(0))       ; 2 red
48         .word ((7<<6)+(0<<3)+(7))       ; 3 cyan
49         .word ((0<<6)+(5<<3)+(7))       ; 4 violett
50         .word ((7<<6)+(0<<3)+(0))       ; 5 green
51         .word ((0<<6)+(0<<3)+(7))       ; 6 blue
52         .word ((7<<6)+(7<<3)+(0))       ; 7 yellow
53         .word ((5<<6)+(7<<3)+(0))       ; 8 orange
54         .word ((3<<6)+(4<<3)+(3))       ; 9 brown
55         .word ((4<<6)+(7<<3)+(4))       ; a light red
56         .word ((3<<6)+(3<<3)+(3))       ; b dark grey
57         .word ((4<<6)+(4<<3)+(4))       ; c middle grey
58         .word ((7<<6)+(4<<3)+(4))       ; d light green
59         .word ((4<<6)+(4<<3)+(7))       ; e light blue
60         .word ((6<<6)+(6<<3)+(6))       ; f light gray
61
62 ;-------------------------------------------------------------------------------
63 ; force the init constructor to be imported
64
65         .import initconio
66 conio_init      = initconio