当前位置:网站首页>Store a group of positive and negative numbers respectively, and count the number of 0 -- assembly language implementation
Store a group of positive and negative numbers respectively, and count the number of 0 -- assembly language implementation
2022-07-26 08:51:00 【Miracle Fan】
Store a group of positive and negative numbers separately , And statistics 0 The number of
1. Realize the idea
By giving positive numbers 、 Negative numbers allocate space for the length of a length digit group , Then send the first address of the two variables to the register , And then loop through , Combine numbers with 0 Judge , Branch in three ways , After execution, the statement .
2. Code implementation
DATA SEGMENT
ARY DB -7,9,-9,1,18,1,-4,6,-13,-1,0,-3,0,-9,0
CNT EQU $-ARY
PLUS DB CNT DUP(?)
MINUS DB CNT DUP(?)
CNT0 DB 0
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START:
MOV AX,DATA
MOV DS,AX
MOV BX,OFFSET ARY;ary The first address
MOV SI,OFFSET PLUS;PLUS The first address
MOV DI,OFFSET MINUS;MINUS The first address
MOV CL,0; Used to count , in total CNT individual
L1:
CMP CL,CNT; Whether the number of comparisons has reached the end
JE EXIT; Jump to the end plate
MOV DH,[BX]
CMP DH,0; The judgment is positive 、 Negative or 0
JE ZERO; It's zero
JNS POSITIVE; It means a positive number
JS NEGATIVE; A negative number
ZERO:
INC CNT0
INC BX
INC CL
JMP L1
POSITIVE:
MOV [SI],DH
INC BX
INC SI
INC CL
JMP L1
NEGATIVE:
MOV [DI],DH
INC BX
INC DI
INC CL
JMP L1
EXIT:
MOV AH,4CH
INT 21H
CODE ENDS
END START
边栏推荐
- Web3 Games: current situation and future
- sklearn 机器学习基础(线性回归、欠拟合、过拟合、岭回归、模型加载保存)
- 合工大苍穹战队视觉组培训Day5——机器学习,图像识别项目
- Mysql/mariadb (Galera multi master mode) cluster construction
- Cve-2021-3156 duplicate of sudo heap overflow privilege raising vulnerability
- Espressif 玩转 编译环境
- One click deployment of lamp and LNMP scripts is worth having
- Human computer interaction software based on C language
- MySQL 8.0 OCP 1z0-908 certification examination question bank 1
- C#入门系列(三十一) -- 运算符重载
猜你喜欢

基于C语言实现的人机交互软件

有限元学习知识点备案
![[search topics] flood coverage of search questions after reading the inevitable meeting](/img/54/ce672d21a4a67110ee629dde3cb9dc.png)
[search topics] flood coverage of search questions after reading the inevitable meeting

Grid segmentation

【FreeSwitch开发实践】自定义模块创建与使用

My meeting of OA project (meeting seating & submission for approval)

Study notes of automatic control principle --- stability analysis of control system

Set of pl/sql -2

解决C#跨线程调用窗体控件的问题

数据库操作技能7
随机推荐
tcp 解决short write问题
[abstract base class inheritance, DOM, event - learning summary]
SSH,NFS,FTP
[recommended collection] summary of MySQL 30000 word essence - partitions, tables, databases and master-slave replication (V)
23.8 using the applicationrunner or commandlinerunner to implement applicationrunner and commandlinerunner
C # use npoi to operate Excel
P1825 [USACO11OPEN]Corn Maze S
基于C#实现的文件管理文件系统
What are the contents of Oracle OCP and MySQL OCP certification exams?
Spark SQL common date functions
Web概述和B/S架构
内存管理-动态分区分配方式模拟
day06 作业--技能题1
Kept dual machine hot standby
Recurrence of SQL injection vulnerability in the foreground of a 60 terminal security management system
Oracle 19C OCP 1z0-082 certification examination question bank (30-35)
pl/sql之集合-2
基于C语言设计的换乘指南打印系统
Redis advanced
Mysql8 one master one slave +mycat2 read write separation