Assembly how to check empty string?

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 5K views
naja
Messages
3
Reaction score
0
I am asking user to enter a number if user hits enter key instead of entering a value then i need to exit the program. see code below

Code:
 ; i put the value into eax
 cmp AL,0 ;i compare is al reg is empty
 je exitProgram
 ; some instructions
 exitProgram:
 Invoke ExitProcess,0
 Public _start
 END
 
Physics news on Phys.org
You need to show what function you are reading a string of characters or if reading one character at at time. The function may depend on what operating system you are running on. For example for MSDOS, to get a line of input from the user, you could use

mov ah,00ah
mov dx,offset buffer
int 021h
...
 
Last edited: