所以我有这个程序:
[BITS 16]
[ORG 7C00h]
JMP 0:start
start:
MOV AX, 0
MOV DS, AX
MOV ES, AX
MOV SS, AX
MOV SP, 7C00h
MOV SI, Hello
CALL _puts16
MOV AL, LogLvl1
INT 21h
CALL .getinput
.getinput:
MOV AH, 2h
MOV AL, Success ;Echo was successful
INT 21h
MOV AH, 1h ;Set AH to 1h, which means character input
INT 21h
MOV INPUT, AL ;Store the character in INPUT
MOV AH, 2h ;Change AH back to 2h, which means character output
MOV DL, Message ;Move Message to DL, which will be echoed
INT 21h
MOV DL, INPUT ;Move the inputed key to DL to be echoed
INT 21h
RET
;input= es:si -> string
_puts16:
PUSHA
.BEGIN:
LODSB ;Load a single byte
CMP AL, 0 ;Calculate if that byte is 0, or null
JE .END ;Jump to end if it is not 0
MOV AH, 0Eh ;Otherwise, set 24 bit graphics modes
INT 10h
JMP .BEGIN
.END:
POPA
RET
.define:
Hello DB "Enter a string: ",0
Message DB " Grats! You said",0
INPUT DB " ",0
LogLvl1 DB "Calling .getinput...\n",0
Success DB "Successful.\n",0
times 510 - ($ - $$) db 0
DW 0xAA55
我对汇编非常陌生,我需要将键入的密钥移动到 .define 中定义的字符串变量“INPUT”中,但是网络范围的汇编器给了我一个错误:
1.asm:24:错误:操作码和操作数的组合无效
我认为这意味着由于某种原因我无法将 AL 移动到 INPUT,但我不知道为什么。正如我所说,我是组装新手,所以这可能是一些明显的错误。我怎样才能解决这个问题?我需要将键入的字符或键存储在内存中,以便稍后在程序中回显它。