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

@@ -14,6 +14,8 @@
.include "apple2.inc"
.macpack cpu
.segment "ONCE"
.ifdef __APPLE2ENH__
@@ -51,8 +53,13 @@ cputdirect:
cmp WNDWDTH
bcc :+
jsr newline
left: lda #$00 ; Goto left edge of screen
left:
.if (.cpu .bitand CPU_ISET_65SC02)
stz CH ; Goto left edge of screen
.else
lda #$00 ; Goto left edge of screen
sta CH
.endif
: rts
newline:
@@ -78,17 +85,18 @@ mask: and INVFLG ; Apply normal, inverse, flash
putchardirect:
pha
ldy CH
.ifdef __APPLE2ENH__
lda CH
bit RD80VID ; In 80 column mode?
bpl put ; No, just go ahead
tya
lsr ; Div by 2
tay
bcs put ; Odd cols go in main memory
bit HISCR ; Assume SET80COL
put: tay
.else
ldy CH
.endif
put: lda (BASL),Y ; Get current character
lda (BASL),Y ; Get current character
tax ; Return old character for _cgetc
pla
sta (BASL),Y