Just a simple question:
Let's say I had the following two assembly programs:
1:
add10:
add eax, 10
ret
;call add5 from other file
2:
add5:
add eax, 5
ret
;call add10 from other file
Could I call add10
(declared in the first file) from the second file, or vice-versa? If so, how can it be done? (even if it isn't feasible)
NOTE: This will be running on bare metal, not on any fancy NT calls!
Thanks.
Edit: I'm using NASM on Windows.
If both files are linked into the same executable, yes. Lookup EXTERN or EXTRN.
Two files:
1:
2:
Assemble & link them together. I used as linker GoLink, other linkers are similar:
I named the sources "add5.asm" and "add10.asm". The assembler produces "add5.obj" and "add10.obj". The linker uses "add5.obj" and "add10.obj" and some system libraries (for 'printf' and 'ExitProcess'). The result is the executable "add10.exe". Look at the command lines to get the order of those names. The names are arbitrary.
HTH