HELP ME PLEASE !!
This is a routine to add two numbers but i have two problems, the code works ok, but i need that only admit numbers, in this moment this rutine admits letters, and the other problem is that the numbers only have a digit (0-9).
EX.
4+5=x --> OK
10 + 5=x --> NO --> print "10 it's not a 1 digit number"
Thanks :U
;«««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
.486
.model flat, stdcall
option casemap :none ; case sensitive
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
include \masm32\include\windows.inc
include \masm32\include\masm32.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\gdi32.inc
include \masm32\macros\macros.asm
includelib \masm32\lib\masm32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\gdi32.lib
main PROTO
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
.code
start:
call main
exit
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
main proc
LOCAL str1:DWORD
LOCAL str2:DWORD
LOCAL rslt:DWORD
LOCAL buffer1[32]:BYTE
LOCAL buffer2[32]:BYTE
mov str1, ptr$(buffer1)
mov str2, ptr$(buffer2)
cls
print cmd$(1)
loc 10, 6
print "RUTINA PARA LA SUMA DE VARIOS DIGITOS"
;Procedimiento para la captura de datos
loc 10, 8
mov str1, input("DIGITE PRIMER NUMERO Y PRESIONE ENTER: ")
loc 10, 10
mov str2, input("DIGTE SEGUNDO NUMERO Y PRESIONE ENTER: ")
;Procedimiento para la realización de la suma
push esi
mov esi, uval(str1)
add esi, uval(str2)
mov rslt, ustr$(esi)
pop esi
;Procedimiento para la impresión del resultado
loc 10, 12
print "Result = "
print rslt
loc 10, 20
mov str1, input(" - DIGITE ENTER PARA TERMINAR - ")
cls
ret
main endp
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
end start