BITS 16
ORG 0x0100
SECTION .text
MAIN:
mov DI,array
call GetString
call Putln
call PutString
call Putln
mov SI,array
;jmp Next
;Next:
mov AX,4C00H
;mov AL,00H
int 21H
%INCLUDE 'STDIO.ASM'
SECTION .data
mesg db 'I','h','a','t','e','a','s','s','e','m','b','l','y' ;
SECTION .bss
array resb 256 ;reserve 256 bytes of space
Putch: ;outputs character in DL
push DI
mov AH,02H
int 21H
pop DI
ret
Getch: ;inputs a character into AL
push DI
; mov BH,AH
mov AH,08H
int 21H
; mov AH,BH
mov DL,AL
pop DI
ret
Putln: ;prints out a new line
mov AH,02H
mov DL,CR
int 21H
mov DL,LF
int 21H
ret
GetString:
call Getch
cmp DL,0DH
je End
call Putch
stosb
jmp GetString
End:
mov AL,00H
stosb
ret
PutString:
cld
lodsb
cmp AL,00H
jz End1
mov DL,AL
call Putch
jmp PutString
End1:
ret
SECTION .data
;mesg db 'I',' ','h','a','t','e',' ','a','s','s','e','m','b','l','y' ;
CR equ 0AH
LF equ 0AH
我试图从 8086 程序集中的数组中输出一个字符串,但是当我运行它时,即使我可以输入字符,当我按 Enter 时它也会给我符号。