Conio: 65c02 optimisations

cputc: -2 cycles per char, -2 cycles per carriage return
cputs: -5 cycles per char, -3 cycles on cputsxy
vcprintf: -6 cycles per char
This commit is contained in:
Colin Leroy-Mira
2023-09-02 11:08:15 +02:00
parent d70c902a02
commit 8a140e6503
3 changed files with 69 additions and 24 deletions

View File

@@ -10,7 +10,7 @@
.importzp sp, ptr1, ptr2, ptr3, tmp1
.macpack generic
.macpack cpu
.data
@@ -74,21 +74,40 @@ out: jsr popax ; count
; Loop outputting characters
.if (.cpu .bitand CPU_ISET_65SC02)
@L1: dec outdesc+6
beq @L4
@L2: ldy tmp1
lda (ptr1),y
iny
bne @L3
inc ptr1+1
@L3: sty tmp1
jsr _cputc
jmp @L1
@L2: lda (ptr1) ; (5)
inc ptr1 ; (10)
bne @L3 ; (12)
inc ptr1+1 ; (17)
@L3: jsr _cputc ; (23)
bra @L1 ; (26)
@L4: dec outdesc+7
bne @L2
rts
.else
@L1: dec outdesc+6
beq @L4
@L2: ldy tmp1 ; (3)
lda (ptr1),y ; (8)
iny ; (10)
bne @L3 ; (12)
inc ptr1+1 ; (17)
@L3: sty tmp1 ; (20)
jsr _cputc ; (26)
jmp @L1 ; (32)
@L4: dec outdesc+7
bne @L2
rts
.endif
; ----------------------------------------------------------------------------
; vcprintf - formatted console i/o
;