From 900eb9bca18f57531bc74d3a5f5b5e87870cd1ae Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Sun, 5 Apr 2026 19:59:30 -0400 Subject: Replace cc65 lib isdigit() and atoi() with less bloated isnum() and a2uint(). --- src/isnum.s | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/isnum.s (limited to 'src/isnum.s') diff --git a/src/isnum.s b/src/isnum.s new file mode 100644 index 0000000..7aa3251 --- /dev/null +++ b/src/isnum.s @@ -0,0 +1,18 @@ + + .export _isnum + + ; isdigit() replacement that avoids cc65's ctype bloat. + ; returns 0 in A/X for non-digit, non-zero for digit. + ; *also* when calling from asm, the Z flag is set for + ; non-digit, clear for digit. +_isnum: + cmp #'0' + bcc ret0 + cmp #'9'+1 + bcs ret0 + lda #1 + .byte $2c +ret0: + lda #0 + tax + rts -- cgit v1.2.3