]> git.sur5r.net Git - cc65/blob - libsrc/c64/soft80_kplot.s
initial commit of soft80 implementation
[cc65] / libsrc / c64 / soft80_kplot.s
1
2         .export         soft80_kplot
3         .export         soft80_plotinit
4
5         .include        "c64.inc"
6         .include        "soft80.inc"
7
8 soft80_kplot:
9         bcs     @getpos
10
11         ; calc pointer to bitmap
12         lda     _bitmaplo,x
13         clc
14         adc     _bitmapxlo,y
15         sta     SCREEN_PTR
16         lda     _bitmaphi,x
17         adc     _bitmapxhi,y
18         sta     SCREEN_PTR+1
19
20         ; calc pointer to vram
21         tya
22         lsr     a
23         clc
24         adc     _vramlo,x
25         sta     CRAM_PTR
26         lda     #0
27         adc     _vramhi,x
28         sta     CRAM_PTR+1
29
30 @getpos:
31         ldx     CURS_Y
32         ldy     CURS_X
33         rts
34
35         ; FIXME: perhaps just include the respective tables directly?
36 soft80_plotinit:
37         ; create screen-rows base tables (bitmap)
38         lda     #<soft80_bitmap
39         sta     SCREEN_PTR
40         lda     #>soft80_bitmap
41         sta     SCREEN_PTR+1
42
43         ldx     #$00
44 l1:
45         lda     SCREEN_PTR
46         sta     _bitmaplo,x
47         clc
48         adc     #<(40*8)
49         sta     SCREEN_PTR
50         lda     SCREEN_PTR+1
51         sta     _bitmaphi,x
52         adc     #>(40*8)
53         sta     SCREEN_PTR+1
54         inx
55         cpx     #25
56         bne     l1
57
58         ; create screen-rows base tables (colorram)
59
60         lda     #<soft80_vram
61         sta     CRAM_PTR
62         lda     #>soft80_vram
63         sta     CRAM_PTR+1
64
65         ldx     #$00
66 l1b:
67         lda     CRAM_PTR
68         sta     _vramlo,x
69         clc
70         adc     #<(40)
71         sta     CRAM_PTR
72         lda     CRAM_PTR+1
73         sta     _vramhi,x
74         adc     #>(40)
75         sta     CRAM_PTR+1
76         inx
77         cpx     #25
78         bne     l1b
79
80         rts
81
82 _bitmapxlo:
83         .repeat 80,col1
84         .byte <((col1/2)*8)
85         .endrepeat
86
87 _bitmapxhi:
88         .repeat 80,col
89         .byte >((col/2)*8)
90         .endrepeat
91
92         .bss
93 _vramlo:
94         .res 25
95 _vramhi:
96         .res 25
97 _bitmaplo:
98         .res 25
99 _bitmaphi:
100         .res 25
101