当前位置:网站首页>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
边栏推荐
- Maximum common substring & regularity problem
- After MySQL 8 OCP (1z0-908), hand in your homework
- File management file system based on C #
- Memory management - dynamic partition allocation simulation
- 利用模m的原根存在性判断以及求解
- 解决C#跨线程调用窗体控件的问题
- [search topics] flood coverage of search questions after reading the inevitable meeting
- Study notes of automatic control principle -- dynamic model of feedback control system
- My meeting of OA project (meeting seating & submission for approval)
- [suggestions collection] summary of MySQL 30000 word essence - locking mechanism and performance tuning (IV) [suggestions collection]
猜你喜欢

In the first year of L2, the upgrade of arbitrum nitro brought a more compatible and efficient development experience
![[untitled]](/img/3e/fb7c4d901643e6ea88a7d90ead045c.png)
[untitled]

C Entry series (31) -- operator overloading

day06 作业---技能题7

数据库操作 题目二

Sub Chocolate & paint area

Memory management based on C language - Simulation of dynamic partition allocation

Registration of finite element learning knowledge points

数据库操作技能7

Maximum common substring & regularity problem
随机推荐
C Entry series (31) -- operator overloading
Web3 Games: current situation and future
CIS 2020 - alternative skills against cloud WAF (pyn3rd)
Pan micro e-cology8 foreground SQL injection POC
Memory management based on C language - Simulation of dynamic partition allocation
Vision Group Training Day5 - machine learning, image recognition project
Pxe原理和概念
[freeswitch development practice] use SIP client Yate to connect freeswitch for VoIP calls
My meeting of OA project (meeting seating & submission for approval)
Replication of SQL injection vulnerability in the foreground of Pan micro e-cology8
What are the differences in the performance of different usages such as count (*), count (primary key ID), count (field) and count (1)? That's more efficient
内存管理-动态分区分配方式模拟
基于C语言的内存管理-动态分区分配方式模拟
Regular expression: judge whether it conforms to USD format
[recommended collection] summary of MySQL 30000 word essence - partitions, tables, databases and master-slave replication (V)
IC's first global hacking bonus is up to US $6million, helping developers venture into web 3!
[search topics] flood coverage of search questions after reading the inevitable meeting
[database] gbase 8A MPP cluster v95 installation and uninstall
Oracle 19C OCP 1z0-082 certification examination question bank (51-60)
day06 作业--技能题1