add.asm

来自「一.输入7个个位数进行由小到大进行排序 要求: 1.键盘输入7个个位数并」· 汇编 代码 · 共 71 行

ASM
71
字号

SSEG SEGMENT PARA STACK 'stack'
	dw 100h dup(0) ;初始化堆栈大小为100
SSEG ENDS

DSEG SEGMENT
	;数据段:在此处添加程序所需的数据
	msg	db	' + $'
	equls	db	' = $'
DSEG ENDS

ESEG SEGMENT
	;附加段:在此处添加程序所需的数据
ESEG ENDS

CSEG SEGMENT
	assume  cs:CSEG, ds:DSEG, es:ESEG, ss:SSEG


	
MAIN PROC   	;主程序入口
	push ds
	mov ax,0
	push ax
	mov ax, dseg
	mov ds, ax
	mov es, ax

	
	;此处添加主程序代码
;输入第一个两位数
	mov ah,01
	int 21h
	mov bh,al
	mov ah,01
	int 21h
	mov bl,al
;显示加号
	mov ah,09
	mov dx,offset msg
	int 21h
;输入第二个两位数
	mov ah,01
	int 21h
	add bh,al
	mov ah,01
	int 21h
	add bl,al
;显示等于号
	mov ah,09
	mov dx,offset equls
	int 21h
;输出结果
	sub bh,30h
	sub bl,30h
	mov ah,02
	mov dl,bh
	int 21h
	mov ah,02
	mov dl,bl
	int 21h
;***************************************
	mov ah,07
	int 21h
	mov ax, 4c00h  ;程序结束,返回到操作系统系统
	int 21h
MAIN ENDP
	
CSEG ENDS

END MAIN

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?