]> git.sur5r.net Git - cc65/blob - libsrc/pce/color.s
Add sample linker configurations for Atari binary output in C.
[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         .export         _textcolor, _bgcolor, _bordercolor
8         .export         colors
9
10         .import         return0
11
12         .include        "pce.inc"
13         .include        "extzp.inc"
14
15 _bordercolor    := return0              ; always black
16
17 _textcolor:
18         ldx     CHARCOLOR               ; get old value
19         sta     CHARCOLOR               ; set new value
20         txa
21         rts
22
23 _bgcolor:
24         and     #$0F
25         ldx     BGCOLOR                 ; get old value
26         sta     BGCOLOR                 ; set new value
27         asl     a
28         tay
29
30         stz     VCE_ADDR_LO
31         stz     VCE_ADDR_HI
32         lda     colors,y
33         sta     VCE_DATA_LO
34         lda     colors+1,y
35         sta     VCE_DATA_HI
36
37         txa
38         rts
39
40 .rodata
41
42         ;         G      R      B
43 colors: .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 violet
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