0 Replies - 394 Views - Last Post: 18 March 2015 - 10:07 PM

#1 jch053  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 6
  • View blog
  • Posts: 28
  • Joined: 20-December 14

How can I store user-input data to bx register?

Posted 18 March 2015 - 10:07 PM

I am unsure of how to actually store user-input data to a register. I would like to prompt the user for a signed base-10 integer, then store that integer to the bx register. What I have does not seem to be actually storing any data from what I can tell:
;get user input

   mov   ah, 0Ah
   int   21h

    mov   bx, ax        ;save char to bx
    cmp   ax, 13        ;is char = carriage return?
    jmp   endwhile      ;if so, we're done
    int   21h           ;get another char
    loop  while
    ret                 ;end loop

;print data stored in bx to console

    mov   ah, 09
    mov   dx, [bx]
    int   21h

Anything in particular sticking out that I'm doing wrong?
I have crossposted this on StackOverflow as well: http://stackoverflow...r-to-a-register

Is This A Good Question/Topic? 1
  • +

Page 1 of 1