我在8086大会上有一个非常简单的程序用于大学目的。主要组件正在工作,但是当我想显示2个或更多字符串时,我有一些特殊的字符,无法理解输出。这些是我在装配中的第一次尝试,因此可能出现很多错误,但我无法弄清楚这一点。
程序非常简单:首先显示消息"欢迎使用我的三角区计算器!"然后显示"你想再试一次吗?是 - 是n - 否"并且根据按下的键,您可以重试或完成程序。这是我的代码:
DATA SEGMENT PARA PUBLIC 'DATA'
WELCOME DB "Welcome to my triangle area calculator!$";welcome message
CONTINUE DB "Do you want another try? y-yes n-no$";other message
DATA ENDS
CODE SEGMENT PARA PUBLIC 'CODE'
ASSUME CS:CODE, DS:DATA
MAIN PROC FAR
MOV DX,OFFSET WELCOME;load the address of the welcome message in dx
MOV AH,09H; instruction for display
INT 21H; interrupt for display
XOR DX,DX; putting dx back to 0
XOR AX,AX; the same for ax
START:;loop label
MOV DX,OFFSET CONTINUE;loads the address of the other message into dx
MOV AH,09H; display intruction
INT 21H; interrupt for display
MOV AH,01H; character input instruction
INT 21H; interrupt for input
CMP AL,79H; comparison if the inputted character is y
JZ START; jump zero if it is
CMP AL,6EH; comparison if the inputted character is n
JZ FINISHPROGRAM; jump zero to finish the program
FINISHPROGRAM:
MOV AH,4CH; dos program ending
INT 21H
RET
MAIN ENDP
CODE ENDS
END MAIN
答案 0 :(得分:0)
试试这个......
.model small
.data
welcome db 10,13,"Welcome to my triangle area calculator!$"
continue db 10,13,"Do you want another try? y-yes n-no$"
.code
mov dx,@data
mov ds,dx
start: lea dx,welcome
mov ah,09h
int 21h
lea dx,continue
mov ah,09h
int 21h
mov ah,01h
int 21h
cmp al,'y'
je start
mov ah,4ch
int 21h
end