0

This is the interrupt I use to input a number, however it does not allow me to input numbers greater than 9:

mov AH, 08h
int 21h

Is there a different interrupt which will allow me to input a 2-digit number as well?

Jens
  • 8,423
  • 9
  • 58
  • 78

1 Answers1

2

With 08h you are requesting a single character input, see documentation e.g. here or a tutorial here. Reading two digits will then take two int 21hs. Alternatively, you may take a look at using 0ah buffered input, but considering it's only two characters:

mov ah, 08h
int 21h
mov dl, al
int 21h
; now dl contains the first character, al the second
Jens
  • 8,423
  • 9
  • 58
  • 78
  • Isn't there a way to simply insert a 2-digit number with a single action? –  Jun 09 '15 at 16:48
  • It's not how hardware works. But as Jose points out in his comment, you can write yourself a helper function which wraps multi-character input for you. – Jens Jun 09 '15 at 16:49
  • 1
    @Steven1903 There's away to read an entire line. There's also away to read a certain number of characters, but when that number of characters is two, you might as well do what Jens suggests. – Ross Ridge Jun 09 '15 at 16:50
  • Is it possible to do the same with mov ah, 01h ?? – Soumya Kanti Naskar Sep 20 '16 at 15:38