Well this is not so much of a need, but i really want to learn how to do error handling assembly language[TASM]
Basically if the user just types or presses enter the code will go back to the same question with probably a message box or writing stating that they must put at least one letter.
Example:
Enter string: (user just presses enter)
(message box or ill just print error message)[cuz im not sure if there is message box in ASM or not haha]
Enter string: A [this is still considered string so its accepted]
you entered: A
TITLE error handling
DOSSEG
.model SMALL
.stack 100h
.data
PINPUT db "Enter String: $"
SINPUT db 14 dup("$")
CRLF db 13,10,"$"
PENTER db "You Entered: $"
UERROR db "Error must enter something! $"
.code
BEGIN: mov ax, @data
mov ds, ax
mov es, ax
mov al, 03h ; clear screen
mov ah, 00h
int 10h
names: mov dx, OFFSET PINPUT ; Print Enter String:
mov ah, 09h ; DOS screen output function call
int 21h ; universal DOS function call
mov byte ptr SINPUT, 11
mov dx, OFFSET SINPUT ; scan Input
mov ah, 0Ah
int 21h
cmp SINPUT, 21h ;because 21h starts characters
jl Erroring ; jump if something below 21h is entered
jmp Prnt ; skip error and print user entered value
Erroring:
mov dx, OFFSET UERROR ; print error message
mov ah, 09h
int 21h
mov dx, OFFSET CRLF ; print \n
mov ah, 09h
int 21h
jmp names
Prnt:
mov dx, OFFSET CRLF ; print \n
mov ah, 09h
int 21h
mov dx, OFFSET PENTER ; print You entered:
mov ah, 09h
int 21h
mov SI, 0002
lea DX, SINPUT[SI] ; Print string entered
mov ah, 09h
int 21h
mov ah, 4ch
int 21h
end BEGIN