当前位置:网站首页>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
边栏推荐
- [pyGame collection] please check the game guide through childhood: are there any games you have played? (attach five source codes for self access)
- 什么是绝对和相对路径,有哪些优缺点?
- Opencv实战之图像的基本操作:这效果出来惊艳了众人(附代码解析)
- [pyGame games] I'm not afraid you can't walk the maze series: the ultimate AI walks the maze. After learning, it will take you to open the door to a new world ~ (with game source code)
- Lambda 学习记录
- 归并排序
- Is it safe for changtou school to open an account? Is it reliable?
- The same customized right-click menu beautification on this site - Xingze V Club
- SystemVerilog (x) - user defined type
- Collection delete element technique removeif
猜你喜欢
![[pyGame games] tank battle, how many childhood games do you remember?](/img/30/951fdbb944e026701af08c0c068cd8.png)
[pyGame games] tank battle, how many childhood games do you remember?

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

IGBT and third generation semiconductor SiC double pulse test scheme

How to check the variable waveform when debugging the program? Look here
![[pyGame games] I'm not afraid you can't walk the maze series: the ultimate AI walks the maze. After learning, it will take you to open the door to a new world ~ (with game source code)](/img/57/dcf291b044b5e5860a7fdc817076d5.jpg)
[pyGame games] I'm not afraid you can't walk the maze series: the ultimate AI walks the maze. After learning, it will take you to open the door to a new world ~ (with game source code)
![[pyGame games] interesting puzzle game: how many hamsters can you play? (source code attached)](/img/88/733cddca32491c4ac45102aa703815.jpg)
[pyGame games] interesting puzzle game: how many hamsters can you play? (source code attached)

LabVIEW pictures look bright or dark after being cast from 16 bits to 8 bits
![[opencv practice] this seal](/img/f4/c6a4529b8b24773bcb39b4d2c6e16f.png)
[opencv practice] this seal "artifact" is awesome, saving time and improving efficiency. It is powerful ~ (complete source code attached)

phpstudy的安装

示波器和频谱分析仪的区别
随机推荐
LabVIEW displays the time and date on the waveform chart or waveform chart
Compared with the "South-to-North Water Transfer", what will the "east to west" of the fire bring to cloud computing?
【Pygame小游戏】剧情流推荐:什么样的游戏才能获得大家的喜欢呢?(魔鬼恋人、霸总娇妻版)
How to handle the database query error with Emoji expression in Typecho- Xingze V Club
[pyGame] this classic bomber super game is online. Do you love it? (source code attached)
希尔排序
Is it safe for changtou school to open an account? Is it reliable?
【无标题】
[pyGame] this "groundhog" game is going to be popular (come on, come on)
【Pygame合集】回忆杀-“童年游戏”,看看你中几枪?(附五款源码自取)
选择排序
Create millisecond time id in LabVIEW
File转为MultipartFile的方法
LabVIEW change the shape or color of point ROI overlay
Why is the website snapshot hijacked and tampered with
Hyperleger fabric installation
Top ten information security principles
[untitled]
什么是绝对和相对路径,有哪些优缺点?
启牛学堂理财可靠吗,安全吗