当前位置:网站首页>Njupt South Post collection_ Experiment 1
Njupt South Post collection_ Experiment 1
2022-06-11 00:09:00 【Retreat drum ten level performer】
Assembly language grammar practice and code conversion
The experimental requirements : Write a program , Count the number of negative numbers , And find the maximum number and the minimum number .
Suppose the data segment has 8 Number :
NUM DB -19,+28,37,-46,+55,61,-74,+255
Design a program to complete :
(1)( Must do ) Count and display the number of negative numbers .
(2)( Choose to do ) Find the maximum and minimum number of truth values , And displayed on the screen in binary form . Display format is :
MAX=XXXXXXXXB; MIN=XXXXXXXXB.
DATAS SEGMENT
NUM DW -19,+28,37,-46,+55,61,-74,+255
MAX DW 0 ; Storage maximum
MIN DW 0 ; Storage minimum
STR1 DB 'MAX=$'
STR2 DB 'B;MIN=$'
DATAS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS
START:
MOV AX,DATAS
MOV DS,AX
MOV BX,OFFSET NUM
MOV CX,8
MOV DL,0 ;DL Keep statistics of the number of people
LAST:
CMP WORD PTR [BX],0
JGE NEXT ; Greater than or equal to 0 go to NEXT Instructions
INC DL ;DL+1->DL
NEXT:
INC BX ;NUM is WORD
INC BX
LOOP LAST
ADD DL,30H ;DL=0-9ASCII code
MOV AH,2
INT 21H
MOV DL,0DH
MOV AH,2
INT 21H
MOV DL,0AH
MOV AH,2
INT 21H ; Line break
MOV DI,OFFSET NUM
MOV AX,[DI]
MOV MIN,AX
MOV MAX,AX
MOV CX,7 ; Set the number of cycles
AGAIN:
INC DI
INC DI ; The font data pointer needs to move two units
MOV AX,[DI]
CMP AX,MAX
JG BRANCH1 ; If AX>MAX, Then the jump label name is BRANCH1 perform
JMP BRANCH2 ; otherwise , Jump BRANCHE2, Don't execute BRANCHE1
BRANCH1:
MOV MAX,AX ; Save the current maximum value into MAX
BRANCH2:
CMP AX,MIN
JLE BRANCH3
JMP LOOP1
BRANCH3:
MOV MIN,AX ; Save the current minimum value into MIN, Principle and MAX Same as
LOOP1:
LOOP AGAIN ;CX Greater than 0 Just keep cycling
MOV AH,9H
LEA DX,STR1
INT 21H
MOV AX,MAX
CALL PRINT ; Call subroutine
MOV AH,9H
LEA DX,STR2
INT 21H
MOV AX,MIN
CALL PRINT
MOV AH,2H
MOV DL,'B'
INT 21H
MOV AH,4CH
INT 21H
;-------------------------------------------------
PRINT PROC
PUSH BX; Data on the stack , Keep the value
PUSH DX
MOV DH,0; Used to count , in total 16 Time
BINARYAGAIN:
CMP DH,16
JE BINARYOVER; End of output , End of function reached
ROL AX,1; Move a bit
MOV BX,AX
AND AX,0001H
MOV DL,AL
ADD DL,48
MOV AH,2
INT 21H
INC DH
MOV AX,BX
JMP BINARYAGAIN
BINARYOVER:
POP DX
POP BX
RET
PRINT ENDP
CODES ENDS
END START
边栏推荐
- Exception 0xc00000005 code occurred when LabVIEW called DLL
- [pyGame games] story stream recommendation: what kind of games can you like? (devil lover, bully's wife version)
- 快速排序
- LabVIEW open other exe programs
- 对接请求方式
- 【Pygame小游戏】首月破亿下载 一款高度融合了「超休闲游戏特性」的佳作~
- 【Turtle表白合集】“海底月是天上月,眼前人是心上人。”余生多喜乐,长平安~(附3款源码)
- 【颜值检测神器】来,请拿出你们的绝活(这颜值,对得起观众么?)
- IGBT and third generation semiconductor SiC double pulse test scheme
- WinDriver compilation summary
猜你喜欢

It is said that the verification code is a barrier in the crawler. I can break through it with only five lines of code.

【 pygame Games 】 don't find, Leisure Games Theme come 丨 Bubble Dragon applet - - Leisure Games Development recommendation

LabVIEW error "memory full - Application stopped on node"
![[auto reply or remind assistant] Mom doesn't have to worry about me missing messages any more (10 Line Code Series)](/img/b3/64429247ee1b91a05d4faa1d78a1df.png)
[auto reply or remind assistant] Mom doesn't have to worry about me missing messages any more (10 Line Code Series)

The serial port in the visa test panel under LabVIEW or max does not work
![[pyGame games] here it is. This Gobang game is super A. share it with your friends~](/img/76/faea3558ed6fadff755c517922088b.png)
[pyGame games] here it is. This Gobang game is super A. share it with your friends~

LabVIEW phase locked loop (PLL)

【自动回复小脚本】新年快乐,每一个字都是我亲自手打的,不是转发哦~

Leetcode-15 sum of three numbers

都说验证码是爬虫中的一道坎,看我只用五行代码就突破它。
随机推荐
【Pygame小游戏】首月破亿下载 一款高度融合了「超休闲游戏特性」的佳作~
After deepin20 menu startup option, the self-test indicates that iwlwwifi is stopped
What is the workflow of dry goods MapReduce?
Typecho website speed optimization - Xingze V Club
From the perspective of Confucius Temple IP crossover, we can see how the six walnuts become "butterflies" for the second time
【AcWing】4. Multiple knapsack problem I
vtk. VTP download in JS
MultipartFile重命名上传
[auto reply or remind assistant] Mom doesn't have to worry about me missing messages any more (10 Line Code Series)
B 树的简单认识
[opencv practice] in cold winter, there will be a rainbow. Do you love this special effect?
The serial port in the visa test panel under LabVIEW or max does not work
Insert sort
[latex] latex vs Code Snippets
[MVC&Core]ASP.NET Core MVC 视图传值入门
[daily] robots Txt allow all search engines to include
[fireworks in the sky] it's beautiful to light up the night sky with gorgeous fireworks. A programmer brought a fireworks show to pay New Year's greetings to everyone~
[turtle confessions collection] "the moon at the bottom of the sea is the moon in the sky, and the person in front of us is the sweetheart." Be happy for the rest of your life, and be safe for ever ~
【Pygame合集】滴~穿越童年游戏指南 请查收:这里面有你玩过的游戏嘛?(附五款源码自取)
数据库表结构