If (A>B) OR (B<C) then
A = A + C
Else
B = C - A
For x = 1 to 10
A = A + x
Next x
if ((a>=b) AND (b==c)) OR (a<=c) then
a = b + c
else
a = b - c
include Irvine32.inc
.data
varA DWORD 1
varB DWORD 2
varC DWORD 2
varX DWORD 1
.code
main proc
Task1:
; If (A>B) OR (B<C) then
; A = A + C
; Else
; B = C - A
mov eax,varA
mov ebx,varB
mov ecx,varC
cmp eax,ebx
jg L1 ;If (A>B)->L1
cmp ebx,ecx ;if (B<C)->L1
jl L1
;else
sub ecx, eax ; C - A
mov varB, ecx ; B = C - A
jmp Task2
L1:
add varA, ecx ; A = A + C
Task2:
; For x = 1 to 10
; A = A + x
; Next x
mov eax, varA
for_:
add eax,varX ; A = A + x
inc varX ; next x
cmp varX,10
jle for_
mov varA,eax
Task3:
; if ((a>=b) AND (b==c)) OR (a<=c) then
; a = b + c
; else
; a = b - c
mov eax,varA
mov ebx,varB
mov ecx,varC
cmp eax,ebx
jge L2 ; if ((a>=b)->L2
cmp eax, ecx
jle res1 ; if (a<=c)->result_1
jmp res2
L2:
cmp ebx,ecx
je res1 ; if(b==c)->res1
cmp eax, ecx ;
jle res1 ; if (a<=c)->res1
jmp res2
res1:
add ebx,ecx
mov varA,ebx ; a = b + c
jmp _exit
res2:
sub ebx,ecx
mov varA, ebx ; a = b - c
_exit:
invoke ExitProcess,0 ; Exit program
main endp
end main
Comments
Leave a comment