I am honestly so lost in my Assembly class. Would anyone be willing to walk me through how to go about this problem? I am to code in EBE. This is the problem:
Write an assembly language program to compute the distance squared between 2 points in the plane identified as 2 integer coordinates each, stored in memory.
I am completely unsure if I am going about this right, but so far this is what I have:
segment .data
a dq 5 ; one point
b dq 10 ; another point
segment .text
global main
main:
mov rax, [a] ; move a into rax
imul rax, rax ; a squared
mov rdx, [b] ; move b into rdx
imul rdx, rdx ; b squared
sub rax, rcx ; is rax 0?
xor rax, rax
ret
The formula would be like:
For example (untested):