Answer the question
In order to leave comments, you need to log in
I can not solve the lab in assembler?
Topic: "Programming branching algorithms in Assembler".
I wrote a division with a remainder to the first function y1, I don’t understand how to branch from the condition if this condition does not satisfy.
mov al,x
cmp al,a
jg sled1
mov bl,a
jmp sled2
sled1: mov ah,1
int 21h
mov al,x
test bh,4
div bh
mov bl,ah
sled2: mov y1,bl
Answer the question
In order to leave comments, you need to log in
mov al,x cmp al,a jg sled1 mov bl,a ...
how to branch from a condition if that condition does not satisfy.
jg sled1
does not branch and you simply execute the instruction following it -- mov bl, a
. The branches and transitions in your code look correct.
It turned out something like this, it seems to even work and correctly fulfill the conditions when substituting numbers. Maybe someone will come in handy, I'm attaching the code.
I'll take it in for a check this week and report back.
usl1: cmp al,a
jg @true1
mov al,a
jmp short @Y1
@true1: mov al,x
mov bh,4
div bh
mov bl,ah
mov al,bl
@Y1: mov y1,al
usl2: mov ah,0
mov al,x
mov bl,a
div bl
mov al,bl
cmp al,3
jg @true2
mov al,x
jmp short @Y2
@true2: mov al,a
mov bl,x
mul bl
mov al,bl
@Y2: mov y2,al
mov al,y1
add al,y2
mov y,al
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question