初级汇编语言
2021-01-14 21:13
标签:int style 屏幕 sum nbsp jpg not store height 汇编调试程序DEBUG的常用命令和功能,DEBUG环境下调试程序的方法. 地址 数据 被加数 2000:0000 9FH 2000:0001 6BH 加数 2000:0002 5CH 2000:0003 42H 和 2000:0004 ~ 2000:0006 -e 2000:0000 9f 6b 5c 42 2.两个无符号数相减,将差存入指定地址单元。被减数,减数及差的存放地址及数据如下: 地址 数据 被减数 2000:0100 8C 2000:0101 42 减数 2000:0102 92 2000:0103 5A 差 2000:0104 2000:0105 -e 2000:0100 8c 42 92 5a 3.两个无符号数相乘,将积存入指定地址单元。被乘数,乘数及积存放的地址及数据如下: 地址 数据 被乘数 2000:1000 56 2000:1001 2C 乘数 2000:1002 3A 2000:1003 1C 积 2000:1004 ~ 2000:1007 -e 2000:0200 56 2C 3A 1C 4.两个无符号数相除,将商及余数存入指定的地址单元。被除数,除数,商及余数存放的地址及数据如下: 地址 数据 被除数 2000:0200 2A 2000:0201 3B 2000:0202 4C 2000:0203 5D 除数 2000:0204 7C 2000:0205 5D 商 2000:0206 2000:0207 余数 2000:0208 2000:0209 -e 2000:0200 2a 3b 4c 5d 7c 5d 屏幕显示计算机提问: Do you like this book ? 若用户回答N, 计算机回答: You may go to the next store. 若用户回答Y, 计算机回答: I think you will buy it. 屏幕显示计算机提问: Would you like tea or coffee? 用户用键盘输入回答,并显示出来. 初级汇编语言 标签:int style 屏幕 sum nbsp jpg not store height 原文地址:https://www.cnblogs.com/a-runner/p/12939357.html
-a 1000:0
mov ax,[0000H]
mov bx,[0002H]
add ax,bx
mov 2000:[0004],ax
-r cs
1000
-r ip
0
-t -t -t -t
-a 1000:0
mov ax,2000:[0100H]
mov bx,2000:[0102]
sub ax,bx
mov 2000:[0104],ax
-r cs
1000
-r ip
0
-t -t -t -t
-a 1000:0000
mov ax,2000:[1000]
mov bx,2000:[1002]
mul bx
mov 2000:[1004],ax
mov 20000:[1006],dx
-r cs
1000
-r ip
0
-t -t -t -t -t
-a 1000:0
mov ax,2000:[0200]
mov bx,2000:[0202]
div bx
mov 2000:[0206],ax
mov 2000:[0208],dx
-r cs
1000
-r ip
0
-t -t -t -t -tDATA SEGMENT
SEN1 DB 0DH,0AH,"Do you like this book ",0x3fh,0DH,0AH,"$"
SEN2 db 0DH,0AH,"You may go to the next store.",0DH,0AH,"$"
SEN3 DB 0DH,0AH,"I think you will buy it",0DH,0AH,"$"
SEN4 DB 0DH,0AH,"Please input a word(Y or N)",0DH,0AH,"$"
DATA ENDS
CODE SEGMENT
ASSUME DS:DATA,CS:CODE
START:MOV AX,DATA
MOV DS,AX
MOV Ah,2h
MOV BH,0
MOV DH,5
MOV DL,12
INT 10H
BEAGIN: MOV DX,OFFSET SEN1
MOV AH,09H
INT 21H
MOV AH,01H
INT 21H
MOV AH,09H
CMP AL,‘N‘
JE NOT
CMP AL,‘Y‘
JE OK
CMP AL,‘Q‘
JE END
JMP KEY
OK: MOV DX,OFFSET SEN2
INT 21H
JMP BEAGIN
NOT: MOV DX,OFFSET SEN3
INT 21H
JMP BEAGIN
KEY:MOV DX,OFFSET SEN4
INT 21H
JMP BEAGIN
END: NOP
MOV AH,4CH
INT 21H
CODE ENDS
END START
DATA SEGMENT
SEN DB 0dh,0ah,"Would you like tea or coffee",0x3fh,0dh,0ah,"$"
SEN2 DB 0dh,0ah,"Your input is:","$"
SEN3 DB 0DH,0AH,"$"
STRING DB 20,0,20 DUP(0)
DATA ENDS
CODE SEGMENT
ASSUME DS:DATA,CS:CODE
START:MOV AX,DATA
MOV DS,AX
MOV Ah,2h
MOV BH,0
MOV DH,5
MOV DL,12
INT 10H
MOV DX,OFFSET SEN
MOV AH,09H
INT 21H
MOV DX,OFFSET STRING
MOV AH,0AH
INT 21H
MOV CL,STRING+1
XOR CH,CH
ADD DX,CX
MOV BX,DX
MOV BYTE PTR[BX+2],‘$‘
MOV AH,09H
MOV DX,OFFSET SEN3
INT 21H
MOV DX,OFFSET STRING
ADD DX,2
INT 21H
MOV AH,4CH
INT 21H
CODE ENDS
END START
上一篇:SpringCloud的使用