1

How can I read number from keyboard(assume that the number can be from 0 to 65535) and put value in AX register using DOS interface? Result should be same as if we would just write MOV ax, 65535 for example. I tried to do it by myself, but it didn't worked out. I'd like to see a code as an answer

Daniel
  • 993
  • 2
  • 10
  • 23
  • Possible duplicate of [How to convert String to Number in 8086 assembly?](http://stackoverflow.com/questions/36979870/how-to-convert-string-to-number-in-8086-assembly) – Ped7g Oct 03 '16 at 11:38

1 Answers1

4

This isn't straightforward in assembly. You'll need to make use of routines provided by either the OS or the BIOS in order to read a character and then build on top of this.

You've tagged the question with emu8086 which claims to have a DOS interface. In that case you can use int 21h with ah set to either 1 or 7 to read a character. You'll then have to check it's a valid number character and then loop around reading more values until done. There's a int 21h reference here which should help.

Sean
  • 60,939
  • 11
  • 97
  • 136