大家好,我是汇编语言的新手,我不知道如何创建一个程序来读取 3 个 16 位整数 a、b、c,然后让它计算判别式。(b^2-4ac) 谁能帮帮我?到目前为止,我开始尝试让程序将 a 和 c 相乘。
.data
Prompt BYTE "Enter a number ?" , 0
Message BYTE "The discriminant is: ", 0
b SDWORD ?
a SDWORD ?
cc SDWORD ?
discriminant SDWORD ?
.code
main PROC
mov edx, OFFSET Prompt ; EDX must have the string's offset
call WriteString ; Call the procedure to write a string
call ReadInt ; Call the procedure to read an integer
mov a, eax ; The integer is read into AL, AX or EAX
mov edx, OFFSET Prompt ; Read another integer
call WriteString
call ReadInt
mov cc, eax
mov eax, a ; AL AX or EAX must have the
; multiplicand
cdq ; Clear the EDX register
imul cc ; One operand - the multiplier
mov Product, eax ; The product is in AL, AX or EAX