StupidOS/lib/c/ctype.asm

35 lines
378 B
NASM
Raw Normal View History

2024-04-28 06:41:36 +00:00
format COFF
use32
public isdigit
section '.code' code
;; Function: isdigit
;;
;; Parameters:
;;
;; [esp+8] - character
;;
;; Returns:
;;
;; eax - 1 if digit otherwhise 0
;;
isdigit:
push ebp
mov ebp, esp
mov al, '0'
mov cl, byte [esp+8]
cmp al, cl
jb @f
mov al, '9'
cmp al, cl
jg @f
mov eax, 1
jmp .end
@@:
xor eax, eax
.end:
leave
ret