当前位置:网站首页>Assemble | find the maximum and minimum values
Assemble | find the maximum and minimum values
2022-07-24 08:06:00 【-Babbler-】
function : Bubble sort finds the maximum and minimum values
DATA SEGMENT
TABLE DB 1,2,10,20,5,7,6
NUM EQU ($-TABLE)-1 ; The number of bubble sorting is the number of elements n-1
DATA ENDS
CODE SEGMENT
ASSUME: CS:CODE, DS:DATA
START:MOV AX, DATA
MOV DS, AX
; Get ready
MOV CX, NUM ; The length of the memory ( The number of numbers )
LEA SI, TABLE ; Address of a pointer SI Point to TABLE First address of storage area
MOV BH, [SI] ; Put the first number in BH, Save the current maximum
MOV BL, [SI] ; Put the first number in BL, Save the current minimum
; Find the maximum and minimum
CALL FIND
; Show maximum
MOV AL, BH
CALL PRINT
; Show minimum
MOV AL, BL
CALL PRINT
; Back to the operating system
MOV AH, 4CH
INT 21H
; Find the maximum and minimum --- The results are stored in BH,BL in
FIND PROC NEAR
L: INC SI ; The pointer SI Move to the next number
MOV AL, [SI] ;AL -- Current number
CMP AL, BL ; And BL Compare
JB NEXT1 ;AL Less than BL --- BL Replace with a smaller value
CMP AL, BH ; And BH Compare
JB NEXT2 ;AL Less than BH --- Cycle down
MOV BH, AL ; otherwise BH Replace with a larger value
JMP NEXT2 ; Cycle down
NEXT1:MOV BL, AL ;BL Replace with a smaller value
JMP NEXT2
NEXT2:LOOP L ; Check whether the cycle stops
RET
FIND ENDP
; Displays the maximum and minimum values --- Show that the number exists AL in
PRINT PROC NEAR
PUSH DX
MOV DL,AL
CMP DL,9 ; Determine whether <=9
JLE ADD1 ; yes ---> ASCII Code plus 30H
JNLE ADD2 ; No ---> ASCII Code plus 37H
ADD1: ADD DL,30H
JMP PRI
ADD2: ADD DL,37H
PRI: ; Show
MOV AH,02H
INT 21H
; Carriage return
MOV DX,0DH
INT 21H
; Add line breaks
MOV DL,0AH
INT 21H
POP DX
RET
PRINT ENDP
CODE ENDS
END START边栏推荐
- Intelligent robots and intelligent systems (Professor Zhengzheng of Dalian University of Technology) -- 4. Autonomous robots
- Multiple optimization methods print prime numbers between 100 and 200
- Talk about compilers based on vscode
- Common DOS commands
- Markdown basic grammar learning
- As skillfully uses idea annotation to improve collaboration / development efficiency
- Recognition and storage of Graphs
- Hcip 13th day notes
- Debug No3 multi texture overlay
- Kubernetes: (I) basic concepts
猜你喜欢

My six months at Microsoft

Hcip 13th day notes

*Yolo5 learning * data experiment based on yolo5 face combined with attention model se
![Telecom Customer Churn Prediction challenge baseline [AI competition]](/img/ad/2cd108eaffce3a618525727d9b5034.png)
Telecom Customer Churn Prediction challenge baseline [AI competition]

QT | string generation QR code function

Solve the problem that Anaconda navigator cannot be opened

Implement a queue with two stacks.
![[target detection] IOU (intersection and combination ratio)](/img/16/d1bd89582e0e04a627e7909eb4f31d.png)
[target detection] IOU (intersection and combination ratio)

Vertex buffer and shader (the cherno + leranopongl) notes

Robot operation continuous learning thesis (1) original text reading and Translation -- primitive generation strategy learning without catastrophic forgetting in robot operation
随机推荐
Intelligent robots and intelligent systems (Professor Zhengzheng of Dalian University of Technology) -- 4. Autonomous robots
学习笔记总结篇(一)
Learning to track at 100 FPS with deep progression networks
JSON extractor use in JMeter
Kubernetes:(一)基本概念
[MySQL] installation tutorial and master-slave configuration
EZDML逆向工程导入数据库分析实操教程
MS SQL Server 2019 learning
[Beijiao] image processing: basic concepts, image enhancement, morphological processing, image segmentation
Introduction of some functions or methods in DGL Library
Have you seen the interview questions of VR major? Trust me, it's absolutely useful
*Project recurrence * project implementation of thesis based on contextbasedemotionrecognitionusingematicdataset
VIDAR team team exclusive interview: as we do, as you know
News topic classification task -- tochtext library for text classification
FPGA综合项目——图像边缘检测系统
基于thinkphp将execle表格上传并插入数据库
Hegong sky team vision training day4 - traditional vision, contour recognition
Use of animation expert motionlayout layout
图新地球:Revit建模的rvt格式BIM模型如何带着纹理精准匹配地图
Basic operation of queue