2 ; Groepaz/Hitmen, 11.10.2015
4 ; Low level init code for soft80 screen output/console input
7 .constructor soft80_init, 8
8 .destructor soft80_shutdown
10 .import soft80_kclrscr, soft80_charset
11 .export soft80_internal_bgcolor, soft80_internal_cellcolor
12 .export soft80_internal_cursorxlsb
14 .importzp ptr1, ptr2, ptr3
24 ; the "color voodoo" in other parts of the code relies on the vram and
25 ; colorram being set up as expected, which is why we cant use the
26 ; _bgcolor and _textcolor functions here.
28 lda CHARCOLOR ; use current textcolor
29 and #$0F ; make sure the upper nibble is 0s
32 lda VIC_BG_COLOR0 ; use current bgcolor
34 sta soft80_internal_bgcolor
40 sta soft80_internal_cellcolor
57 jmp $FF5B ; Initialize video I/O
61 ; copy charset to RAM under I/O
74 lda #<soft80_lo_charset
75 ldx #>soft80_lo_charset
78 lda #<soft80_hi_charset
79 ldx #>soft80_hi_charset
102 ; copy the kplot tables to ram under I/O
105 lda soft80_tables_data_start,x
106 sta soft80_bitmapxlo,x
107 lda soft80_tables_data_start + (soft80_tables_data_end - soft80_tables_data_start - $0100),x
108 sta soft80_bitmapxlo + (soft80_tables_data_end - soft80_tables_data_start - $0100),x
117 ; the following tables take up 267 bytes, used by kplot
118 soft80_tables_data_start:
120 soft80_bitmapxlo_data:
124 soft80_bitmapxhi_data:
130 .byte <(soft80_vram+(row*40))
132 .byte 0,0,0,0,0,0,0 ; padding to next page
135 .byte >(soft80_vram+(row*40))
137 soft80_bitmapylo_data:
139 .byte <(soft80_bitmap+(row*40*8))
141 soft80_bitmapyhi_data:
143 .byte >(soft80_bitmap+(row*40*8))
146 soft80_tables_data_end:
148 ;-------------------------------------------------------------------------------
150 soft80_internal_cellcolor:
152 soft80_internal_bgcolor:
154 soft80_internal_cursorxlsb:
159 .byte 0 ; flag to check first init, this really must be in .data