Skip to content

Commit

Permalink
Added isAlphaNum
Browse files Browse the repository at this point in the history
  • Loading branch information
matrefeytontias committed Sep 9, 2014
1 parent dc8cf30 commit 1b4fa9f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/00/jumptable.config
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
streamReadBuffer
streamReadToEnd
getStreamInfo
seek

# Graphics
allocScreenBuffer
Expand Down Expand Up @@ -154,6 +155,7 @@
getKernelCommitsSinceTag
getKernelShortHash
isKernelDirty
isAlphaNum

# Strings
strlen
Expand Down
28 changes: 28 additions & 0 deletions src/00/util.asm
Original file line number Diff line number Diff line change
Expand Up @@ -470,4 +470,32 @@ isKernelDirty:
cp '+'
pop bc
ret
;; isAlphaNum [Miscellaneous]
;; Tests if a character is a letter or a number.
;; Inputs:
;; A: character to test
;; Outputs:
;; C: set if the character is alphanumeric
isAlphaNum:
cp '9' + 1
jr nc, .notNum
cp '0'
ccf
ret
.notNum:
cp 'Z' + 1
jr nc, .notUpperAlpha
cp 'A'
ccf
ret
.notUpperAlpha:
cp 'z' + 1
jr nc, .notLowerAlpha
cp 'a'
ccf
ret
.notLowerAlpha:
or a
ret

0 comments on commit 1b4fa9f

Please sign in to comment.