]> git.sur5r.net Git - cc65/blob - libsrc/c64/soft80mono_color.s
Added a blank line between .include statements and .import/.export statements
[cc65] / libsrc / c64 / soft80mono_color.s
1 ;
2 ; Groepaz/Hitmen, 19.10.2015
3 ;
4 ; high level implementation for the monochrome soft80 implementation
5 ;
6 ; unsigned char __fastcall__ textcolor (unsigned char color);
7 ; unsigned char __fastcall__ bgcolor (unsigned char color);
8 ;
9
10         .export         soft80mono_textcolor, soft80mono_bgcolor
11         .import         soft80mono_internal_cellcolor, soft80mono_internal_bgcolor
12
13         .importzp       tmp1
14
15         .include        "c64.inc"
16         .include        "soft80.inc"
17
18 soft80mono_textcolor:
19         ldx     CHARCOLOR                       ; get old value
20         stx     tmp1                            ; save old value
21         sta     CHARCOLOR                       ; set new value
22
23 mkcharcolor:
24         lda     soft80mono_internal_bgcolor
25         asl     a
26         asl     a
27         asl     a
28         asl     a
29         ora     CHARCOLOR
30         sta     soft80mono_internal_cellcolor   ; text/bg combo for new chars
31
32         sei
33         ldy     $01
34         lda     #$34                            ; enable RAM under I/O
35         sta     $01
36
37         lda     soft80mono_internal_cellcolor
38         ; clear loop for vram
39         ldx     #$00
40 @lp1:
41         sta     soft80_vram,x
42         sta     soft80_vram+$100,x
43         sta     soft80_vram+$200,x
44         sta     soft80_vram+$2e8,x
45         inx
46         bne     @lp1
47
48         sty     $01
49         cli
50
51         lda     tmp1                            ; get old value
52         rts
53
54 soft80mono_bgcolor:
55         ldx     soft80mono_internal_bgcolor     ; get old value
56         stx     tmp1                            ; save old value
57         sta     soft80mono_internal_bgcolor     ; set new value
58
59         jmp     mkcharcolor
60
61 ;-------------------------------------------------------------------------------
62 ; force the init constructor to be imported
63
64         .import soft80mono_init
65 conio_init      = soft80mono_init