;
.export soft80_textcolor, soft80_bgcolor, soft80_bordercolor
- .export __textcolor, __bgcolor
+ .import soft80_internal_textcolor, soft80_internal_bgcolor
.importzp tmp1, tmp2
.include "soft80.inc"
soft80_textcolor:
- ldx __textcolor ; get old value
- sta __textcolor ; set new value
+ ldx soft80_internal_textcolor ; get old value
+ sta soft80_internal_textcolor ; set new value
jsr mkcharcolor
rts
soft80_bgcolor:
- ldx __bgcolor ; get old value
+ ldx soft80_internal_bgcolor ; get old value
stx tmp2 ; save old value
- sta __bgcolor ; set new value
+ sta soft80_internal_bgcolor ; set new value
jsr mkcharcolor
and #$0f
cmp tmp2 ; old bg color
bne @sk1
- lda __bgcolor ; new bg color
+ lda soft80_internal_bgcolor ; new bg color
sta soft80_colram+(page*250),x
@sk1:
.endscope
and #$0f
cmp tmp2 ; old bg color
bne @sk2
- lda __bgcolor ; new bg color
+ lda soft80_internal_bgcolor ; new bg color
@sk2:
ora tmp1 ; new bg color (high nibble)
sta soft80_vram+(page*250),x
rts
mkcharcolor:
- lda __bgcolor
+ lda soft80_internal_bgcolor
asl a
asl a
asl a
asl a
sta tmp1 ; remember new bg color (high nibble)
- ora __textcolor
+ ora soft80_internal_textcolor
sta CHARCOLOR ; text/bg combo for new chars
rts
txa
rts
- .bss
-__textcolor:
- .res 1
-__bgcolor:
- .res 1
-
;-------------------------------------------------------------------------------
; force the init constructor to be imported
.destructor soft80_shutdown
.import soft80_kclrscr, soft80_charset
- .import __textcolor, __bgcolor
+ .export soft80_internal_textcolor, soft80_internal_bgcolor
.importzp ptr1, ptr2, ptr3
lda 646 ; use current textcolor
and #$0f
- sta __textcolor
+ sta soft80_internal_textcolor
lda VIC_BG_COLOR0 ; use current bgcolor
and #$0f
- sta __bgcolor
+ sta soft80_internal_bgcolor
asl a
asl a
asl a
asl a
- ora __textcolor
+ ora soft80_internal_textcolor
sta CHARCOLOR
jmp soft80_kclrscr
sta VIC_VIDEO_ADR
rts
+;-------------------------------------------------------------------------------
+; FIXME: when the code is fixed to use the "init" segment, these variables must
+; be moved into a section other than .bss so they survive after the init
+; code has been run.
+
+ .bss
+soft80_internal_textcolor:
+ .res 1
+soft80_internal_bgcolor:
+ .res 1
+
.import popa, _gotoxy
.import xsize
.import soft80_kplot
- .import __bgcolor, __textcolor
+ .import soft80_internal_bgcolor, soft80_internal_textcolor
.importzp tmp4,tmp3
and #$7F
L10:
+ ; entry point for direct output of a character. the value passed in
+ ; akku must match the offset in the charset.
+ ; - the following may not modify tmp1
soft80_cputdirect:
jsr soft80_putchar ; Write the character to the screen
sty CURS_X
jmp soft80_plot
+ ; - the following may not modify tmp1
soft80_newline:
lda SCREEN_PTR
jmp _back
.endif
-; output a character
-
+ ; entry point for outputting one character in internal encoding
+ ; without advancing cursor position
+ ; - the following may not modify tmp1
soft80_putchar:
sta tmp3 ; remember charcode
; immediately.
lda (CRAM_PTR),y ; vram (textcolor)
and #$0f
- cmp __bgcolor
+ cmp soft80_internal_bgcolor
beq @sk1 ; yes, vram==bgcolor
; now check if the textcolor in color ram is equal the background color,
lda (CRAM_PTR),y ; colram (2nd textcolor)
stx $01 ; $34
and #$0f
- cmp __bgcolor
+ cmp soft80_internal_bgcolor
beq @sk2 ; yes, colram==bgcolor
; two characters in the current cell, of which one will get removed
sta (CRAM_PTR),y ; vram
@sk3:
; colram = bgcolor
- lda __bgcolor
+ lda soft80_internal_bgcolor
inc $01 ; $35
sta (CRAM_PTR),y ; colram
stx $01 ; $34
; vram (textcolor) = bgcolor
lda (CRAM_PTR),y ; vram
and #$f0
- ora __bgcolor
+ ora soft80_internal_bgcolor
sta (CRAM_PTR),y ; vram
@sk1:
rts
lda (CRAM_PTR),y ; vram
and #$0f
- cmp __bgcolor
+ cmp soft80_internal_bgcolor
beq @sk1 ; vram==bgcolor => first char in cell
; vram!=bgcolor => second char in cell
lda (CRAM_PTR),y ; colram
stx $01 ; $34
and #$0f
- cmp __bgcolor
+ cmp soft80_internal_bgcolor
beq @l2s ; colram==bgcolor -> second char in cell
; botch characters in the cell are used
beq @sk3 ; jump if even xpos
@sk2:
; colram = textcol
- lda __textcolor
+ lda soft80_internal_textcolor
inc $01 ; $35
sta (CRAM_PTR),y ; colram
stx $01 ; $34
.export soft80_kclrscr
.import soft80_kplot
- .import __bgcolor
+ .import soft80_internal_bgcolor
.importzp ptr1
.include "c64.inc"
bne @lp3
.if SOFT80COLORVOODOO = 1
- lda __bgcolor
+ lda soft80_internal_bgcolor
jsr clear ; clear color ram
.endif
lda CHARCOLOR
and #$f0
- ora __bgcolor
+ ora soft80_internal_bgcolor
jsr clear ; clear vram
sty $01