Question: Please help. Needs to be changed to operate in 64 bit mode. %include along32.inc default rel section .data msga db a = , 0 ;read

Please help. Needs to be changed to operate in 64 bit mode.

%include "along32.inc" default rel

section .data

msga db "a = ", 0 ;read a msgb db "b = ", 0 ;read b msgc db "c = ", 0 ;read c msg1 db "x = ", 0 ;x errmsg db "invalid arguments.", 10, 13, 0 ;wrong input a dq 0 ;initialize a b dq 0 ;initialize b c dq 0 ;initialize c

zero dq 0.0 ;0 valid two dq 2.0 ; decimal point valid negone dq -1.0 ;negative valid four dq 4.0 ;dec x1 dq 0 x2 dq 0

section .text

global main ;main

main:

mov edx, msga ;move a into rdx register call WriteString ;call writer call ReadFloat ;read floating points movdqu [a], xmm0 ;a == input1 mov edx, msgb ;move b to register rdx call WriteString ;call writer call ReadFloat ;read floating points movdqu [b], xmm0 ; b == input2 mov edx, msgc ;move c into rdx register call WriteString ;call writer call ReadFloat ;read floating points movdqu [c], xmm0 ; c == input3

movdqu xmm8, [zero] ;xmm8 = 0

movdqu xmm10, [b] ; xmm10 = b movdqu xmm7, [negone] ; xmm7 = -1 mulsd xmm10, xmm7 ; xmm10 = -b

movdqu xmm11, [b] ; xmm11 = b mulsd xmm11, xmm11 ; xmm11 = b^2

movdqu xmm12, [a] ; xmm12 = a movdqu xmm1, [c] ;xmm1 = c movdqu xmm7, [four] ; xmm7 = 4 mulsd xmm12, xmm7 ; xmm12 = 4a mulsd xmm12, xmm1 ; xmm12 = 4ac

subsd xmm11, xmm12 ; xmm11 = b^2 - 4ac

ucomisd xmm11, xmm8 ;unorder compared jnb good ;jump if inputs are correct error: mov edx, errmsg ;move error messga call WriteString ;string writer call ExitProc ;exit good: sqrtsd xmm11, xmm11 ; xmm11 = sqrt(b^2 - 4ac)

movdqu xmm13, [a] ; xmm13 = a movdqu xmm7, [two] ; xmm7 = 2 mulsd xmm13, xmm7 ; xmm13 = 2a ucomisd xmm13, xmm8 ;xmm13 = je zeroA

movsd xmm14, xmm10 ; xmm14 = -b addsd xmm14, xmm11 ; xmm14 = -b + sqrt(b^2-4ac) divsd xmm14, xmm13 ; xmm14 = xmm14 / 2a movdqu [x1], xmm14 ; x1 = xmm14

movsd xmm15, xmm10 ; xmm15 = -b subsd xmm15, xmm11 ; xmm15 = -b - sqrt(b^2-4ac) divsd xmm15, xmm13 ; xmm15 = xmm15 / 2a movdqu [x2], xmm15 ; x2 = xmm15

mov edx, msg1 ;move x call WriteString ; write "x = " movdqu xmm0, [x1] ; xmm0 = x1 call WriteFloat ; write x1 call Crlf ; reset cursor

call WriteString ; write "x = " movdqu xmm0, [x2] ; xmm0 = x2 call WriteFloat ; write x2 call Crlf ; reset cursor

call ExitProc ; exit program

zeroA: movdqu xmm10, [b] ;xmm10=b movdqu xmm11, [c] ;xmm11=c movdqu xmm12, [negone] ;register negative reader mulsd xmm11, xmm12 ;xmm11=xmm12 divsd xmm11, xmm10 ;xmm10=xmm10 movsd xmm0, xmm11 ;xmm0=xmm11 mov edx, msg1 ; print x call WriteString ;write string call WriteFloat ;write float call Crlf ;reset cursor call ExitProc ;exit

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!