#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2007
    Posts
    47
    Rep Power
    0

    MASM Programming reading a single char from a given string.


    How do you go about reading a single character from a given string at a time? For example given the string 139*2-5/+ starting from left to right I want to read '1' and stick it into var1.
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2010
    Location
    Hampshire, UK
    Posts
    11
    Rep Power
    0
    Without knowing what var1 is ...
    Some assembler psuedo code:

    LD pointerRegister1, #String
    LD reg, [pointerRegister2]
    TEST reg,terminatorCharacter ; 0?
    JREQ Done
    LD [var1], reg ; store the character
    Done:

    There are also special instructions that can do all this in one go, just set up the source and destination registers and the count and off you go.

IMN logo majestic logo threadwatch logo seochat tools logo