]> git.sur5r.net Git - cc65/blob - libsrc/c64/soft80_conio.s
added some more comments and -headers
[cc65] / libsrc / c64 / soft80_conio.s
1 ;
2 ; Groepaz/Hitmen, 11.10.2015
3 ;
4 ; Low level init code for soft80 screen output/console input
5 ;
6
7         .constructor    soft80_init
8         .destructor     soft80_shutdown
9
10         .import         soft80_kclrscr, soft80_charset
11         .import         __textcolor, __bgcolor
12
13         .importzp       ptr1, ptr2, ptr3
14
15         .include        "c64.inc"
16         .include        "soft80.inc"
17
18 soft80_init:
19         lda     #$3b
20         sta     VIC_CTRL1
21         lda     #$00
22         sta     CIA2_PRA
23         lda     #$68
24         sta     VIC_VIDEO_ADR
25         lda     #$c8
26         sta     VIC_CTRL2
27
28         ; copy charset to RAM under I/O
29         ; FIXME: move charset and this constructor into init segment
30         sei
31         lda     $01
32         pha
33         lda     #$34
34         sta     $01
35
36         lda     #>soft80_charset
37         sta     ptr1+1
38         lda     #<soft80_charset
39         sta     ptr1
40         lda     #>soft80_lo_charset
41         sta     ptr2+1
42         lda     #<soft80_lo_charset
43         sta     ptr2
44         lda     #>soft80_hi_charset
45         sta     ptr3+1
46         lda     #<soft80_hi_charset
47         sta     ptr3
48
49         ldx     #4
50 @l2:
51         ldy     #0
52 @l1:
53         lda     (ptr1),y
54         sta     (ptr2),y
55         asl     a
56         asl     a
57         asl     a
58         asl     a
59         sta     (ptr3),y
60         iny
61         bne     @l1
62         inc     ptr1+1
63         inc     ptr2+1
64         inc     ptr3+1
65         dex
66         bne     @l2
67
68         pla
69         sta     $01
70         cli
71
72         lda     646                     ; use current textcolor
73         and     #$0f
74         sta     __textcolor
75
76         lda     VIC_BG_COLOR0           ; use current bgcolor
77         and     #$0f
78         sta     __bgcolor
79         asl     a
80         asl     a
81         asl     a
82         asl     a
83         ora     __textcolor
84         sta     CHARCOLOR
85
86         jmp     soft80_kclrscr
87
88 soft80_shutdown:
89         lda     #$1b
90         sta     VIC_CTRL1
91         lda     #$03
92         sta     CIA2_PRA
93         lda     #$15
94         sta     VIC_VIDEO_ADR
95         rts
96