当前位置:网站首页>Assembler 32-bit unsigned addition calculator
Assembler 32-bit unsigned addition calculator
2022-04-23 06:46:00 【Round moon】
assembly 32 Bit unsigned addition calculator
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://yzsam.com/2022/04/202204230549499271.html
边栏推荐
- Collection of practical tips for C language (continuously updated)
- 【UDS统一诊断服务】二、网络层协议(2)— 数据传输规则(单帧与多帧)
- TP download folder, compress folder and download
- Shell脚本 &&和||的使用
- Log writing method (with time)
- HDU-Memory Control
- 浮点数双精度,单精度以及半精度知识总结
- [UDS unified diagnostic service] IV. typical diagnostic service (5) - function / component test function unit (routine function unit 0x31)
- Shell脚本的通配符和特殊符号
- QT add qserialport class to realize serial port operation
猜你喜欢
Initialization of classes and objects (constructors and destructors)
进程管理命令
FOC SVPWM函数PWMC_SetPhaseVoltage解析
[UDS unified diagnosis service] i. diagnosis overview (1) - diagnosis overview
基于VGG对五种类别图片的迁移学习
JS高频面试题
Installation of GCC, G + +, GDB
[UDS unified diagnostic service] i. overview of diagnosis (4) - basic concepts and terms
[UDS unified diagnostic service] II. Network layer protocol (1) - overview and functions of network layer
基于VGG卷积神经网络的图像识别代码实现
随机推荐
Matching between class template with default template argument and template parameter
C语言实现memcpy、memset、strcpy、strncpy、strcmp、strncmp、strlen
[ThreadX] h743 + ThreadX + Filex migration record
sqlite编译
HDU-Tunnel Warfare
文件查看命令和用户管理命令
C51/C52 特殊功能寄存器表
【UDS统一诊断服务】四、诊断典型服务(1)— 诊断和通信管理功能单元
C语言结构体指定初始化
死区时间的分析与设置
Detailed explanation and application principle of token
[UDS unified diagnosis service] IV. typical diagnosis service (3) - read fault information function unit (storage data transmission function unit)
Multibyte and Unicode in VS
OpenCV使用 GenericIndex 进行 KNN 搜索
锚点定位——如何设置锚点居页面顶部距离,锚点定位并距离顶部一定偏移
Using printf in MFC
C语言 #和##的使用
C语言进阶要点笔记5
HDU-Tunnel Warfare
Round up a little detail of the round