a BIT of 65C02 optimisations

Use BIT immediate instead of AND when reloading A is required
afterwards.
Add an fread unit test as the optimisation touches fread.
Sprinkle a few zero page indexed while we're at it.
This commit is contained in:
Colin Leroy-Mira
2024-02-01 20:05:57 +01:00
parent 2a03e5d8c9
commit 1fab179cb4
5 changed files with 145 additions and 10 deletions

View File

@@ -12,6 +12,8 @@
.include "stdio.inc"
.include "_file.inc"
.macpack cpu
_fgetc:
sta ptr1
stx ptr1+1
@@ -20,11 +22,16 @@ _fgetc:
jsr checkferror
bne ret_eof
.if (.cpu .bitand ::CPU_ISET_65SC02)
bit #_FPUSHBACK ; Check for pushed back char
beq do_read
.else
tax
and #_FPUSHBACK ; Check for pushed back char
beq do_read
txa
.endif
and #<(~_FPUSHBACK) ; Reset flag
sta (ptr1),y