]> git.sur5r.net Git - cc65/blob - libsrc/nes/color.s
Removed (pretty inconsistently used) tab chars from source code base.
[cc65] / libsrc / nes / color.s
1 ;
2 ; Written by Groepaz/Hitmen <groepaz@gmx.net>
3 ; Cleanup by Ullrich von Bassewitz <uz@cc65.org>
4 ;
5 ; unsigned char __fastcall__ textcolor (unsigned char color);
6 ; unsigned char __fastcall__ bgcolor (unsigned char color);
7 ; unsigned char __fastcall__ bordercolor (unsigned char color);
8 ;
9
10
11         .export         _textcolor, _bgcolor, _bordercolor
12         .import         return0, ppubuf_put
13
14         .include        "nes.inc"
15
16 _textcolor      = return0
17 _bordercolor    = return0
18
19 .proc   _bgcolor
20
21         tax
22         lda     BGCOLOR         ; get old value
23         stx     BGCOLOR         ; set new value
24         pha
25
26         lda     colors,x
27         pha
28         ldy     #$3F
29         ldx     #0
30         jsr     ppubuf_put
31         pla
32         pha
33         ldy     #$3F
34         ldx     #4
35         jsr     ppubuf_put
36         pla
37         pha
38         ldy     #$3F
39         ldx     #8
40         jsr     ppubuf_put
41         pla
42         ldy     #$3F
43         ldx     #12
44         jsr     ppubuf_put
45
46         pla
47         rts
48
49 .endproc
50
51 .rodata
52
53 colors: .byte $0f       ; 0 black
54         .byte $3d       ; 1 white
55         .byte $04       ; 2 red
56         .byte $3b       ; 3 cyan
57         .byte $14       ; 4 violett
58         .byte $1a       ; 5 green
59         .byte $01       ; 6 blue
60         .byte $38       ; 7 yellow
61         .byte $18       ; 8 orange
62         .byte $08       ; 9 brown
63         .byte $35       ; a light red
64         .byte $2d       ; b dark grey
65         .byte $10       ; c middle grey
66         .byte $2b       ; d light green
67         .byte $22       ; e light blue
68         .byte $3d       ; f light gray
69