当前位置:网站首页>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
边栏推荐
- From the perspective of Confucius Temple IP crossover, we can see how the six walnuts become "butterflies" for the second time
- yum源更新
- curl导入postman报错小记
- Basic introduction and core components of kubernetes
- 都说验证码是爬虫中的一道坎,看我只用五行代码就突破它。
- LabVIEW uses the visa read function to read USB interrupt data
- [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 ~
- Exception 0xc00000005 code occurred when LabVIEW called DLL
- MP框架基本操作(自用)
- [pyGame] stir up your brain and play the "24 o'clock" idea together ~ (awesome)
猜你喜欢
![[pyGame collection] memory killing -](/img/97/10a4333662b49ac35e5b7433a5e6a4.png)
[pyGame collection] memory killing - "Childhood Games", how many shots did you get? (attach five source codes for self access)

【Pygame合集】滴~穿越童年游戏指南 请查收:这里面有你玩过的游戏嘛?(附五款源码自取)

【无标题】

ASP. Net programming version C (notes along with learning progress)

【Pygame小游戏】《坦克大战》,那些童年的游戏你还记得几个呢?

【自动回复or提醒小助手】妈妈再也不用担心我漏掉消息了(10行代码系列)

Opencv实战之图像的基本操作:这效果出来惊艳了众人(附代码解析)

【Pygame小游戏】别找了,休闲游戏专题来了丨泡泡龙小程序——休闲游戏研发推荐
![[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~](/img/3b/2fcd5ff2ea08c4c63428899babd522.png)
[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~

LabVIEW prohibits other multi-core processing applications from executing on all cores
随机推荐
Method of converting file to multipartfile
Several common current transformer sampling circuits
The serial port in the visa test panel under LabVIEW or max does not work
LabVIEW get IMAQ get last event coordinates
OpenResty安装
Wireshake introduction learning notes
Read it once: talk about MySQL master-slave
LabVIEW obtains the information of all points found by the clamp function
安全生产月,黄埔开展燃气安全进商铺宣传活动
30 | how to reset the consumer group displacement?
选择排序
Openresty installation
How to check the variable waveform when debugging the program? Look here
LabVIEW programming specification
【Pygame小游戏】别找了,休闲游戏专题来了丨泡泡龙小程序——休闲游戏研发推荐
【Pygame小游戏】趣味益智游戏 :打地鼠,看一下能打多少只呢?(附源码)
[pyGame games] here it is. This Gobang game is super A. share it with your friends~
【自动回复小脚本】新年快乐,每一个字都是我亲自手打的,不是转发哦~
Easyrecovery15 simple and convenient data recovery tool
【Pygame小游戏】来了来了它来了——这款五子棋小游戏超A的,分享给你的小伙伴儿一起pk吧~