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,24 @@
; ispunct.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 ispunct (int c);
;
.export _ispunct
.include "ctype.inc"
.import ctype_preprocessor
_ispunct:
cpx #>$0000 ; Char range OK?
bne @L1 ; Jump if no
tay
lda __ctype,y ; Get character classification
and #CT_NOT_PUNCT ; Mask relevant 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_NOT_PUNCT ; mask relevant bits
cmp #1 ; if false, then set "borrow" flag
lda #0
sbc #0 ; Invert logic
rts ; Return NOT (space | control | digit | alpha)
@L1: lda #<0 ; Return false
tax
rts
sbc #0 ; invert logic (return NOT (space | control | digit | alpha))
@L1: rts