]> git.sur5r.net Git - cc65/blob - libsrc/cbm510/color.s
04332121f514f1dc8dfd829280bb1a13d04baba4
[cc65] / libsrc / cbm510 / color.s
1 ;
2 ; Ullrich von Bassewitz, 13.09.2001
3 ;
4
5         .export         _textcolor, _bgcolor, _bordercolor
6         .import         sys_bank, restore_bank
7         .importzp       vic
8
9         .include        "zeropage.inc"
10         .include        "io.inc"
11
12
13 ; ------------------------------------------------------------------------
14 ; unsigned char __fastcall__ textcolor (unsigned char color);
15 ; /* Set the color for text output. The old color setting is returned. */
16 ;
17
18 .proc   _textcolor
19
20         ldx     CHARCOLOR       ; get old value
21         sta     CHARCOLOR       ; set new value
22         txa
23         rts
24
25 .endproc
26
27 ; ------------------------------------------------------------------------
28 ; unsigned char __fastcall__ bgcolor (unsigned char color);
29 ; /* Set the color for the background. The old color setting is returned. */
30 ;
31
32 .proc   _bgcolor
33
34         jsr     sys_bank                ; Switch to the system bank
35         pha                             ; Save new color
36         ldy     #VIC_BG_COLOR0
37         lda     (vic),y                 ; Get current color...
38         tax                             ; ...into X
39         pla                             ; Get new color
40         sta     (vic),y                 ; Set new color
41         txa                             ; Get old color into X
42         jmp     restore_bank            ; Restore the old color
43
44 .endproc
45
46 ; ------------------------------------------------------------------------
47 ; unsigned char __fastcall__ bordercolor (unsigned char color);
48 ; /* Set the color for the border. The old color setting is returned. */
49
50 .proc   _bordercolor
51
52         jsr     sys_bank                ; Switch to the system bank
53         pha                             ; Save new color
54         ldy     #VIC_BORDERCOLOR
55         lda     (vic),y                 ; Get current color...
56         tax                             ; ...into X
57         pla                             ; Get new color
58         sta     (vic),y                 ; Set new color
59         txa                             ; Get old color into X
60         jmp     restore_bank            ; Restore the old color
61
62 .endproc
63
64
65