ctype size optimization

This commit is contained in:
IrgendwerA8
2020-01-02 18:57:03 +01:00
committed by Oliver Schmidt
parent dc5114b071
commit ce80624f62
43 changed files with 1491 additions and 3563 deletions

View File

@@ -1,25 +1,25 @@
; isgraph.s
;
; 1998-06-02, Ullrich von Bassewitz
; 2014-09-10, Greg King
; This file is part of
; cc65 - a freeware C compiler for 6502 based systems
;
; https://github.com/cc65/cc65
;
; See "LICENSE" file for legal information.
;
; int isgraph (int c);
;
.export _isgraph
.include "ctype.inc"
.import ctype_preprocessor
_isgraph:
cpx #>$0000 ; Char range OK?
bne @L1 ; Jump if no
tay
lda __ctype,y ; Get character classification
and #CT_CTRL_SPACE ; Mask character bits
cmp #1 ; If false, then set "borrow" flag
jsr ctype_preprocessor ; (clears always x)
bcs @L1 ; out of range? (everything already clear -> false)
and #CT_CTRL_SPACE ; mask character bits
cmp #1 ; if false, then set "borrow" flag
lda #0
sbc #0 ; Invert logic
rts ; Return NOT control and NOT space
@L1: lda #<0 ; Return false
tax
rts
sbc #0 ; invert logic (return NOT control and NOT space)
@L1: rts