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