当前位置:网站首页>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
边栏推荐
- Oracle 19C OCP 1z0-082 certification examination question bank 1
- Install HR schema, example, and Scott schema on Oracle and MySQL
- day06 作业--技能题6
- Oracle 19C OCP certification examination software list
- Poor English, Oracle OCP or MySQL OCP exam can also get a high score of 80 points
- Introduction to AWD attack and defense competition
- uni-app 简易商城制作
- 内存管理-动态分区分配方式模拟
- Foundry tutorial: writing scalable smart contracts in various ways (Part 1)
- Super potential public chain dfinity -- the best time for DFI developers to enter
猜你喜欢

Human computer interaction software based on C language

SSH,NFS,FTP

数据库操作 技能6

Foundry tutorial: writing scalable smart contracts in various ways (Part 1)

day06 作业--技能题6

Xshell batch send command to multiple sessions

03异常处理,状态保持,请求钩子---04大型项目结构与蓝图

基于Raft共识协议的KV数据库

合工大苍穹战队视觉组培训Day5——机器学习,图像识别项目

Sub Chocolate & paint area
随机推荐
CIS 2020 - alternative skills against cloud WAF (pyn3rd)
2000年的教训。web3是否=第三次工业革命?
Dynamic SQL and exceptions of pl/sql
基于C语言设计的换乘指南打印系统
day06 作业--增删改查
uni-app 简易商城制作
File management file system based on C #
数据库操作技能7
利用模m的原根存在性判断以及求解
六、品达通用权限系统__pd-tools-log
Use index to optimize SQL query "suggestions collection"
[abstract base class inheritance, DOM, event - learning summary]
Oracle 19C OCP 1z0-082 certification examination question bank (7-12)
Implementation of Prometheus web authentication and alarm
My meeting of OA project (meeting seating & submission for approval)
Recurrence of SQL injection vulnerability in the foreground of a 60 terminal security management system
[suggestions collection] summary of MySQL 30000 word essence - locking mechanism and performance tuning (IV) [suggestions collection]
Vision Group Training Day5 - machine learning, image recognition project
Hegong sky team vision training Day6 - traditional vision, image processing
node-v下载与应用、ES6模块导入与导出