Skip to content

Commit 1b4fa9f

Browse files
Added isAlphaNum
1 parent dc8cf30 commit 1b4fa9f

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

src/00/jumptable.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
streamReadBuffer
9191
streamReadToEnd
9292
getStreamInfo
93+
seek
9394

9495
# Graphics
9596
allocScreenBuffer
@@ -154,6 +155,7 @@
154155
getKernelCommitsSinceTag
155156
getKernelShortHash
156157
isKernelDirty
158+
isAlphaNum
157159

158160
# Strings
159161
strlen

src/00/util.asm

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,4 +470,32 @@ isKernelDirty:
470470
cp '+'
471471
pop bc
472472
ret
473+
474+
;; isAlphaNum [Miscellaneous]
475+
;; Tests if a character is a letter or a number.
476+
;; Inputs:
477+
;; A: character to test
478+
;; Outputs:
479+
;; C: set if the character is alphanumeric
480+
isAlphaNum:
481+
cp '9' + 1
482+
jr nc, .notNum
483+
cp '0'
484+
ccf
485+
ret
486+
.notNum:
487+
cp 'Z' + 1
488+
jr nc, .notUpperAlpha
489+
cp 'A'
490+
ccf
491+
ret
492+
.notUpperAlpha:
493+
cp 'z' + 1
494+
jr nc, .notLowerAlpha
495+
cp 'a'
496+
ccf
497+
ret
498+
.notLowerAlpha:
499+
or a
500+
ret
473501

0 commit comments

Comments
 (0)