当前位置:网站首页>汇编 32位无符号加法计算器
汇编 32位无符号加法计算器
2022-04-23 05:51:00 【Round moon】
汇编 32位无符号加法计算器
data segment
Num1L dw 0
Num1H dw 0
Num2L dw 0
Num2H dw 0
ANSL dw 0
ANSH dw 0
table db 30h,31h,32h,33h,34h,35h,36h,37h,38h,39h,41h,42h,43h,44h,45h,46h
Num dw 0
data ends
stack segment stack
dw 50 dup()
top label word
stack ends
code segment
main proc far
assume cs:code,ds:data,ss:stack
start:
mov ax,stack
mov ss,ax
mov sp,offset top
push ds
push 0
mov ax,data
mov ds,ax
call InputA
mov ah,02H
mov dl,10
int 21h
call InputB
mov bx,Num1L
mov ANSL,bx
mov bx,Num2L
mov cx,Num1H
mov ANSH,cx
mov cx,Num2H
add ANSL,bx
adc ANSH,cx
mov ah,02H
mov dl,10
int 21h
mov ax,ANSH
mov Num,ax
call Print
mov ax,ANSL
mov Num,ax
call Print
mov ah,02H
mov dl,10
int 21h
ret
main endp
InputA proc near
A:
mov ah,01h
int 21h
cmp al,0DH
jz endA
shl Num1H,4
mov bx,Num1L
and bx,0F000H
shr bx,12
add Num1H,bx
shl Num1L,4
mov ah,0
call deal
add Num1L,ax
jmp A
endA:
ret
InputA endp
InputB proc near
B:
mov ah,01h
int 21h
cmp al,0DH
jz endB
shl Num2H,4
mov bx,Num2L
and bx,0F000H
shr bx,12
add Num2H,bx
shl Num2L,4
mov ah,0
call deal
add Num2L,ax
jmp B
endB:
ret
InputB endp
deal proc near
cmp al,'9'
jbe Digt
jmp Word
Digt:
sub al,'0'
jmp ASCII
Word:
sub al,'A'-10
jmp ASCII
ASCII:
ret
deal endp
Print proc near
mov cx,4
NEW:
mov bx,Num
and bx,0F000H
shr bx,12
mov dl,table[bx]
mov ah,02H
int 21h
shl Num,4
loop NEW
ret
Print endp
code ends
end start
By-Round Moon
版权声明
本文为[Round moon]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_35339563/article/details/121482919
边栏推荐
猜你喜欢
[UDS unified diagnosis service] IV. typical diagnosis service (3) - read fault information function unit (storage data transmission function unit)
【UDS统一诊断服务】二、网络层协议(2)— 数据传输规则(单帧与多帧)
信息学一本通-小球
[UDS] unified diagnostic service (UDS)
【UDS统一诊断服务】四、诊断典型服务(6)— 输入输出控制单元(0x2F)
Swagger2 generates API documents
Programmers can also write novels
cv_bridge 与opencv 版本不匹配的解决
Qt 给应用程序加图标
深蓝学院激光slam 理论与实践 第三章激光雷达去畸变 作业习题
随机推荐
深蓝学院激光slam理论与实践 -第二章(里程计标定)作业
PN结、二极管原理详解与应用
TensorFlow张量介绍
C51/C52 特殊功能寄存器表
C语言的运算符
C#【文件操作篇】PDF文件和图片互相转换
Eigen 学习总结
搭建openstack平台
Tabbar implementation of dynamic bottom navigation bar in uniapp, authority management
Friend function, friend class, class template
声明为全局变量
友元函数,友元类,类模板
Figure guessing game
Wechat applet request encapsulation
POJ-The Unique MST
_findnext 报错
PM2 deploy nuxt project
【UDS统一诊断服务】一、诊断概述(3)— ISO 15765体系结构
类和对象
非参数化相机畸变模型简介