I have the following code and I need to point the next input to [C1] and not [C0] but without hard coding this, the idea is that the user can type whatever they like. I tried INC BL but it causes an Illegal op code error. Thank you

    CLO     ; Close unwanted windows.
Rep:
    IN  00  ; Wait for key press - Store it in AL.
INC BL

    CMP AL,0D   ; Was it the Enter key? (ASCII 0D)

    MOV [C0],AL     
    MOV [BL],AL

    JNZ Rep ; No - jump back.  Yes - end.



END
有帮助吗?

解决方案

IN 00 does not read from keyboard. Use interrupt 21h (function 1) or interrupt 16h (function 0).

CLO is not necessary.

You don't initialize BX (that we can see).

In order to store something at an offset relative to C0, initialize BX with the offset of C0, then increase BX as you go along the loop. BL is a byte register - it doesn't hold a whole address.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top