JCXZ (jump if cx=0)
Simple Program that show the use of Jcxz.
.model small
.data
msg db"counter is zero$"
msg1 db"not zero$"
.code
mov ax,@data
mov ds,ax
mov cx,0
jcxz A //if cx=0 then jump to label A and then B and program exit
mov ah,09h //if cx!=0 then print msg1 then jump to label b and exit
mov dx,offset msg1
int 21h
jmp B
A:
mov ah,09h
mov dx,offset msg
int 21h
B:
.exit
end
OUTPUT:
Simple Program that show the use of Jcxz.
.model small
.data
msg db"counter is zero$"
msg1 db"not zero$"
.code
mov ax,@data
mov ds,ax
mov cx,0
jcxz A //if cx=0 then jump to label A and then B and program exit
mov ah,09h //if cx!=0 then print msg1 then jump to label b and exit
mov dx,offset msg1
int 21h
jmp B
A:
mov ah,09h
mov dx,offset msg
int 21h
B:
.exit
end
OUTPUT: