当前位置:网站首页>Assembly language (6) uses JCC instructions to construct branches and loops
Assembly language (6) uses JCC instructions to construct branches and loops
2022-06-25 17:24:00 【Day-3】
1 Use of data segments
Assembly language print string .
assume cs:code,ds:data
data segment
buffer db 0DH,0AH,'day3$'
data ends
code segment
main proc
mov ax,data
mov ds,ax
mov dx,offset buffer
mov ah,09H
int 21H
mov ah,07H
int 21H
mov ax,4C00H
int 21H
main endp
start:call main
code ends
end start
2 flag register
CMP OPRD1,OPRD1
SUB Influence flags
AX = 8
BX = 8
equal AX - BX = 0 ZF = 1
AX = 8
BX = 1
It's not equal AX - BX != 0 ZF = 0
AX < BX: Occurrence of borrowing
CF = 1
AX > BX: No borrowing
AX - BX = ?CF = 0 ZF = 0
AX <= BX:
AX - BX = ? CF = 1 || ZF = 1
AX >= BX:
AX - BX = ? CF = 0 || ZF = 1
A class JCC Instructions Jump
JMP address
JE Conditional transfer instructions Equal to jump ZF = 1
JNE If not, jump ZF = 0
JB Jump below CF = 1
JA Jump above CF = 0 && ZF = 0
JNA Less than or equal to, jump CF = 1 perhaps ZF = 1
JNB If it is greater than or equal to, jump to CF = 0
3 Jump
assume cs:code,ds:data
data segment
buffer db 0DH,0AH,'day3$'
buffer1 db 0DH,0AH,'day2$'
data ends
code segment
main proc
mov ax,data
mov ds,ax
mov dx,offset buffer
mov ah,09H
int 21H
jmp qq1
mov dx,offset buffer1
mov ah,09H
int 21H
qq1:
mov ah,07H
int 21H
mov ax,4C00H
int 21H
main endp
start:call main
code ends
end start
Create jump conditions
assume cs:code,ds:data
data segment
buffer db 0DH,0AH,'day3$'
buffer1 db 0DH,0AH,'day2$'
data ends
code segment
main proc
mov ax,data
mov ds,ax
mov dx,offset buffer
mov ah,09H
int 21H
mov ax,1
mov bx,2
cmp ax,bx
ja qq1
mov dx,offset buffer1
mov ah,09H
int 21H
qq1:
mov ah,07H
int 21H
mov ax,4C00H
int 21H
main endp
start:call main
code ends
end start
If multiple conditions need to be met, judge whether the conditions are met in turn .
loop
for(int i = 0; i <= 100; i ++)
mov cx,0
qq2:
cmp cx,100
ja qq
mov dx,offset buffer
mov ah,09H
int 21H
inc cx
jmp qq2
qq:
mov cx,0
qq2:
mov dx,offset buffer
mov ah,09H
int 21H
inc cx
cmp cx,100
jb qq2
边栏推荐
- 旧手机变废为宝,充当服务器使用
- Website arrangement of super all metal PBR multi-channel mapping materials
- 学习太极创客 — MQTT(二)MQTT 基本原理
- tasklet api使用
- "Podcast with relish" 386 Yuan Tang Hua Yuan Shi: who is not a "Mr. White character"?
- 剑指 Offer II 012. 左右两边子数组的和相等
- 通过深度可分离卷积神经网络对七种表情进行区分
- College Students' hot summer exchange, Rog star product phantom 16 flipped version / phantom 13 / phantom x appointment
- Batch --07--- breakpoint lifting
- 2022-06-17 advanced network engineering (x) is-is-general header, establishment of adjacency relationship, IIH message, DIS and pseudo node
猜你喜欢

Involution? Foam? Change? Ten questions directly hit the core puzzle of "meta universe" – the essence of "ask ta- Wang Lei about the time of the universe"

Create a new ar fashion experience with cheese and sugar beans

汇编语言(5)寄存器(内存访问)

Learning Tai Chi makers - mqtt (I) what is mqtt

WPF development essays Collection - ECG curve drawing

How did I get a salary increase of 13k+ after one year of employment?

Kotlin

Redis series - overview day1-1

【UVM实战 ===> Episode_1 】~ MCDF设计更新、AMBA标准接口、UVM验证环境更新

Difference between app test and web test
随机推荐
剑指 Offer II 014. 字符串中的变位词 滑动窗口
好胖子带你学Flink系列-Flink源码剖析第一集Standalone启动脚本分析
STM32硬件错误HardFault_Handler的处理方法
2022-06-17 advanced network engineering (IX) is-is- principle, NSAP, net, area division, network type, and overhead value
[Jianzhi offer II 091. painting the house]
国泰君安证券靠谱吗?是否合法?开股票账户安全吗?
SDN system method | 10 The future of SDN
中断操作:AbortController学习笔记
学习太极创客 — MQTT(三)连接MQTT服务端
XXIX - orbslam2 real-time 3D reconstruction using realsensed435
How does social e-commerce operate and promote?
社交电商如何运营推广?
Singleton mode application
心情
上线移动ERP系统有哪些步骤?环环紧扣很重要
Learning Tai Chi maker mqtt (II) basic principles of mqtt
Mathematical modeling - nonlinear programming
剑指 Offer II 035. 最小时间差
Sword finger offer II 010 Subarray prefix sum difference with sum K
Why are there few embedded system designers in the soft test?