当前位置:网站首页>The largest number of statistical absolute values --- assembly language
The largest number of statistical absolute values --- assembly language
2022-07-26 08:50:00 【Miracle Fan】
Count the number with the largest absolute logarithm of a group of numbers
1. Realize the idea
Find out the maximum and minimum values of this group of numbers by cycling , Then compare the maximum and minimum values inversely , Get the maximum number of the final absolute value
2. Code implementation
2.1DATA Segment definition
Define arrays separately , Maximum , minimum value
DATA SEGMENT ; Find the maximum and minimum values in a group of numbers and compare the absolute values of the maximum and minimum values
ARR DB 12,-9,-56,-5,-100,18,-41,22,45,99
MAX DB ?
MIN DB ?
DATA ENDS
2.2 CODE paragraph
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START:
MOV AX,DATA
MOV DS,AX ; Initialization data segment
MOV BH,OFFSET ARR ; take ARR First address to BL
MOV CX,10 ; Set the number of cycles
; For the minimum
LOOP1:
MOV Al,[BX] ; By offset address , take ARR The first number of is sent to AL
CMP MAX,Al ; Compare the maximum with Max Compare
JGE LOWER ; If it is greater than or equal to, jump
MOV MAX,Al ; otherwise , take AL Send Max
LOWER:
INC BX
LOOP LOOP1
MOV CX,10
; For maximum
LOOP2: MOV AH,[BX]
CMP MIN,AH
JLE GREATER
MOV MIN,AH
GREATER:
DEC BX
LOOP LOOP2 ; Maximum
NEG MIN
MOV AH,MAX
MOV AL,MIN
CMP AH,AL
JGE BIG
XCHG AH,AL
BIG:
MOV MAX,AH
MOV AH,4CH
INT 21H
CODE ENDS
END START
边栏推荐
- General file upload vulnerability getshell of a digital campus system (penetration test -0day)
- Use index to optimize SQL query "suggestions collection"
- pl/sql之集合
- day06 作业---技能题7
- Kotlin properties and fields
- 23.2 customizing the banner control display hidden banner modify banner
- Oracle 19C OCP 1z0-082 certification examination question bank 1
- Neo eco technology monthly | help developers play smart contracts
- [recommended collection] MySQL 30000 word essence summary + 100 interview questions (I)
- Oracle 19C OCP 1z0-082 certification examination question bank (36-41)
猜你喜欢
pl/sql之集合
Okaleido launched the fusion mining mode, which is the only way for Oka to verify the current output
Kept dual machine hot standby
keepalived双机热备
基于C语言实现的人机交互软件
Vision Group Training Day5 - machine learning, image recognition project
【FreeSwitch开发实践】使用SIP客户端Yate连接FreeSwitch进行VoIP通话
day06 作业--增删改查
Okaleido上线聚变Mining模式,OKA通证当下产出的唯一方式
sklearn 机器学习基础(线性回归、欠拟合、过拟合、岭回归、模型加载保存)
随机推荐
【数据库 】GBase 8a MPP Cluster V95 安装和卸载
内存管理-动态分区分配方式模拟
[database] gbase 8A MPP cluster v95 installation and uninstall
Oracle 19C OCP certification examination software list
Why reserve a capacitor station on the clock output?
Oracle 19C OCP 1z0-083 question bank (1-6)
正则表达式:判断是否符合USD格式
In the first year of L2, the upgrade of arbitrum nitro brought a more compatible and efficient development experience
Analysis on the query method and efficiency of Oracle about date type
day06 作业---技能题7
[recommended collection] MySQL 30000 word essence summary index (II) [easy to understand]
pl/sql之动态sql与异常
Kept dual machine hot standby
1、 Redis data structure
Cadence (x) wiring skills and precautions
Please tell me if there is any way to increase the write out rate when the Flink SQL client is in the sink table. When synchronizing through sink table
Grid segmentation
2000年的教训。web3是否=第三次工业革命?
Espressif 玩转 编译环境
Excel find duplicate lines