maintain lsb of cursor x position internally, saves some bytes and some cycles too :)
This commit is contained in:
parent
2a0f6c420b
commit
21732e3c5b
5 changed files with 39 additions and 25 deletions
|
@ -5,6 +5,7 @@
|
||||||
;
|
;
|
||||||
|
|
||||||
.export soft80_cgetc
|
.export soft80_cgetc
|
||||||
|
.import soft80_internal_cursorxlsb
|
||||||
.import cursor
|
.import cursor
|
||||||
.importzp tmp1
|
.importzp tmp1
|
||||||
|
|
||||||
|
@ -45,9 +46,10 @@ invertcursor:
|
||||||
ldy #$00
|
ldy #$00
|
||||||
jsr setcolor
|
jsr setcolor
|
||||||
|
|
||||||
lda CURS_X
|
;lda CURS_X
|
||||||
and #$01
|
;and #$01
|
||||||
tax
|
;tax
|
||||||
|
ldx soft80_internal_cursorxlsb
|
||||||
@lp1:
|
@lp1:
|
||||||
lda (SCREEN_PTR),y
|
lda (SCREEN_PTR),y
|
||||||
eor nibble,x
|
eor nibble,x
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
.import soft80_kclrscr, soft80_charset
|
.import soft80_kclrscr, soft80_charset
|
||||||
.export soft80_internal_textcolor, soft80_internal_bgcolor
|
.export soft80_internal_textcolor, soft80_internal_bgcolor
|
||||||
|
.export soft80_internal_cursorxlsb
|
||||||
|
|
||||||
.importzp ptr1, ptr2, ptr3
|
.importzp ptr1, ptr2, ptr3
|
||||||
|
|
||||||
|
@ -104,4 +105,6 @@ soft80_internal_textcolor:
|
||||||
.res 1
|
.res 1
|
||||||
soft80_internal_bgcolor:
|
soft80_internal_bgcolor:
|
||||||
.res 1
|
.res 1
|
||||||
|
soft80_internal_cursorxlsb:
|
||||||
|
.res 1
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
.import xsize
|
.import xsize
|
||||||
.import soft80_kplot
|
.import soft80_kplot
|
||||||
.import soft80_internal_bgcolor, soft80_internal_textcolor
|
.import soft80_internal_bgcolor, soft80_internal_textcolor
|
||||||
|
.import soft80_internal_cursorxlsb
|
||||||
|
|
||||||
.importzp tmp4,tmp3
|
.importzp tmp4,tmp3
|
||||||
|
|
||||||
|
@ -86,6 +87,7 @@ advance:
|
||||||
sty CURS_X
|
sty CURS_X
|
||||||
tya
|
tya
|
||||||
and #$01
|
and #$01
|
||||||
|
sta soft80_internal_cursorxlsb
|
||||||
bne @L5
|
bne @L5
|
||||||
|
|
||||||
lda SCREEN_PTR
|
lda SCREEN_PTR
|
||||||
|
@ -146,8 +148,9 @@ _space:
|
||||||
.endif
|
.endif
|
||||||
;ldy #$00 ; is still $00
|
;ldy #$00 ; is still $00
|
||||||
|
|
||||||
lda CURS_X
|
;lda CURS_X
|
||||||
and #$01
|
;and #$01
|
||||||
|
lda soft80_internal_cursorxlsb
|
||||||
bne @l1
|
bne @l1
|
||||||
|
|
||||||
.repeat 8,line
|
.repeat 8,line
|
||||||
|
@ -182,8 +185,9 @@ _spaceinvers:
|
||||||
sta (CRAM_PTR),y ; vram
|
sta (CRAM_PTR),y ; vram
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
lda CURS_X
|
;lda CURS_X
|
||||||
and #$01
|
;and #$01
|
||||||
|
lda soft80_internal_cursorxlsb
|
||||||
bne @l1
|
bne @l1
|
||||||
|
|
||||||
.repeat 8,line
|
.repeat 8,line
|
||||||
|
@ -240,8 +244,9 @@ soft80_putchar:
|
||||||
lda RVS
|
lda RVS
|
||||||
jne _invers
|
jne _invers
|
||||||
|
|
||||||
lda CURS_X
|
;lda CURS_X
|
||||||
and #$01
|
;and #$01
|
||||||
|
lda soft80_internal_cursorxlsb
|
||||||
bne @l1
|
bne @l1
|
||||||
|
|
||||||
.repeat 8,line
|
.repeat 8,line
|
||||||
|
@ -279,8 +284,9 @@ _back:
|
||||||
; output inverted character
|
; output inverted character
|
||||||
_invers:
|
_invers:
|
||||||
|
|
||||||
lda CURS_X
|
;lda CURS_X
|
||||||
and #$01
|
;and #$01
|
||||||
|
lda soft80_internal_cursorxlsb
|
||||||
bne @l1
|
bne @l1
|
||||||
|
|
||||||
.repeat 8,line
|
.repeat 8,line
|
||||||
|
@ -366,8 +372,9 @@ remcolor:
|
||||||
;and #$0f
|
;and #$0f
|
||||||
sta tmp3 ; A contains colram
|
sta tmp3 ; A contains colram
|
||||||
|
|
||||||
lda CURS_X
|
;lda CURS_X
|
||||||
and #$01
|
;and #$01
|
||||||
|
lda soft80_internal_cursorxlsb
|
||||||
bne @sk3
|
bne @sk3
|
||||||
|
|
||||||
; vram = colram
|
; vram = colram
|
||||||
|
@ -436,8 +443,9 @@ soft80_putcolor:
|
||||||
|
|
||||||
; botch characters in the cell are used
|
; botch characters in the cell are used
|
||||||
|
|
||||||
lda CURS_X
|
;lda CURS_X
|
||||||
and #$01
|
;and #$01
|
||||||
|
lda soft80_internal_cursorxlsb
|
||||||
bne @sk2 ; jump if odd xpos
|
bne @sk2 ; jump if odd xpos
|
||||||
|
|
||||||
; vram = textcol
|
; vram = textcol
|
||||||
|
@ -450,8 +458,9 @@ soft80_putcolor:
|
||||||
jsr soft80_checkchar
|
jsr soft80_checkchar
|
||||||
bcs @sk1 ; char at current position => overwrite 1st
|
bcs @sk1 ; char at current position => overwrite 1st
|
||||||
|
|
||||||
lda CURS_X
|
;lda CURS_X
|
||||||
and #$01
|
;and #$01
|
||||||
|
lda soft80_internal_cursorxlsb
|
||||||
beq @sk3 ; jump if even xpos
|
beq @sk3 ; jump if even xpos
|
||||||
@sk2:
|
@sk2:
|
||||||
; colram = textcol
|
; colram = textcol
|
||||||
|
@ -481,8 +490,9 @@ soft80_checkchar:
|
||||||
|
|
||||||
;ldy #$00 ; is still $00
|
;ldy #$00 ; is still $00
|
||||||
|
|
||||||
lda CURS_X
|
;lda CURS_X
|
||||||
and #$01
|
;and #$01
|
||||||
|
lda soft80_internal_cursorxlsb
|
||||||
jne @l1a
|
jne @l1a
|
||||||
|
|
||||||
.repeat 8,line
|
.repeat 8,line
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
;
|
;
|
||||||
|
|
||||||
.export soft80_kplot
|
.export soft80_kplot
|
||||||
|
.import soft80_internal_cursorxlsb
|
||||||
|
|
||||||
.include "c64.inc"
|
.include "c64.inc"
|
||||||
.include "soft80.inc"
|
.include "soft80.inc"
|
||||||
|
@ -25,6 +26,10 @@ soft80_kplot:
|
||||||
adc _bitmapxhi,y
|
adc _bitmapxhi,y
|
||||||
sta SCREEN_PTR+1
|
sta SCREEN_PTR+1
|
||||||
|
|
||||||
|
tya
|
||||||
|
and #1
|
||||||
|
sta soft80_internal_cursorxlsb
|
||||||
|
|
||||||
; calc pointer to vram
|
; calc pointer to vram
|
||||||
tya
|
tya
|
||||||
lsr a ; NOTE: we can save 2 cycles here at the expense of
|
lsr a ; NOTE: we can save 2 cycles here at the expense of
|
||||||
|
|
|
@ -12,9 +12,3 @@ soft80_screensize:
|
||||||
ldy #screenrows
|
ldy #screenrows
|
||||||
ldx #charsperline
|
ldx #charsperline
|
||||||
rts
|
rts
|
||||||
|
|
||||||
;-------------------------------------------------------------------------------
|
|
||||||
; force the init constructor to be imported
|
|
||||||
|
|
||||||
.import soft80_init
|
|
||||||
conio_init = soft80_init
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue