I don't understand how to use Interrupt 21, AH=0ah

前端 未结 3 883
轮回少年
轮回少年 2020-12-02 00:04

My information is coming from here. The assignment asks for a program that reads in no more than 20 characters, converts those characters to upper case, and then prints the

3条回答
  •  遥遥无期
    2020-12-02 00:52

    That DOS function retrieves a buffer with user input. See this table. It seems that program is using that call to pause execution waiting for the user to resume the program.

    Edit: I just reread the question. I thought you were only asking what the function call did in your given source. If you want to read input of no more than 20 characters, you first need memory to store it. Add something like this:

    bufferSize  db 21  ; 20 char + RETURN
    inputLength db 0   ; number of read characters
    buffer      db 21 DUP(0) ; actual buffer
    

    Then fill the buffer:

    mov ax, cs
    mov ds, ax ; ensure cs == ds
    mov dx, offset bufferSize ; load our pointer to the beginning of the structure
    mov ah, 0Ah ; GetLine function
    int 21h
    

    How to convert to uppercase is left to the reader.

提交回复
热议问题