1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Assembly how to check empty string?

  1. Oct 12, 2012 #1
    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 (Text):

     ; 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
     
     
  2. jcsd
  3. Oct 12, 2012 #2

    rcgldr

    User Avatar
    Homework Helper

    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: Oct 12, 2012
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook