Hello. I have an assignment where I have to calculate the determinant of a matrix on Intel x86 with NASM, but I have to take the elements of the matrix and show the final result using C.
My problem: I (and all my classmates) started from 0 with NASM, and all we have is Paul Carter's PC Assembly book.
I managed to do an incredible poor .asm where I ask for 4 inputs, store each one of them on 4 variables declared on the .bss section and then do the math (as if those for numbers where the elements of a 2x2 matrix).
Carter's book goes from easy to hard in no time. I can not do a simple program where I ask for 2 numbers in C (using scanf("%d %d", &num1, &num2)), add them on NASM and return the value to C to show it.
My C code is simple:
#include <stdio.h>
void calc_sum(int, int, int*) __attribute__((cdecl));
int main(void)
{
int num1, num2, sum;
printf("Input two numbers: ");
scanf("%d %d", &num1, &num2);
calc_sum(num1, num2, &sum); // here the .asm does result = num1 + num2 and returns the result
printf("Sum is %d\n", sum);
}
(if there is a typo is because I'm retyping it from my VM with Ubuntu 18.04 to Windows)
Someone knows of a guide o a place with basics examples, or can help me with this (not the determinant, but implementing this C code in a .asm)?