diff options
Diffstat (limited to 'src/isnum.s')
| -rw-r--r-- | src/isnum.s | 18 |
1 files changed, 18 insertions, 0 deletions
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 |
