Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
arithmetic expression: help me please!
hello. im new here.
i have a problem.
i cant get the exactly output for my code.
i should get this as my output:
Result for Expression 1 (X): -146
i got this:
Result for Expression 1 (X): -6
a DWORD 4
b DWORD 26
see SDWORD -6 ; see == c
y DWORD 23
ex1 SDWORD 0
ex1a SDWORD 0
ex2 SDWORD 0
resultX SDWORD 0
resultZ SDWORD 0
str1 BYTE "Before exchange: ", 0
str2 BYTE "Result for expression 1 (X): ",0
str3 BYTE "Result for expression 2 (Y): ",0
str4 BYTE "After exchange: ", 0
str5 BYTE "Result for X: ",0
str6 BYTE "Result for Y: ",0
mov edx,OFFSET str1
mov edx,OFFSET str2
; Expression 1: X = [(a) + (b*c)]-[(y+1)/ (-a)]
; bracket 1
mov eax, b ; eax = 0
imul see ; eax = 26d ; 1Ah
mov ebx, a ; eax = fffffff64h ;-156d
add ebx, eax ; ebx = 4h ; ebx = ffffff68h (jawapan ;bracket 1=ebx)
mov ecx, y ; ex1a = ffffff68h ; -152d
inc ecx ; ecx = 17h ; 23d
neg a ; ecx = 18h ; 24d
idiv ecx ; a = -4h ;-4d
;mov edx, ecx ; ecx = fffffffAh ; -6d
sub ecx, ebx ; edx = fffffffAh ;-6d(jawapan bracket 2=edx)
mov ex1, ecx ;ebx = (-152-(-6)) = -146d ;ffffff6Eh
;mov ebx, ex1
;mov ex1, eax