Search code examples
assemblyx86procedurefreestanding

Call assembly procedure from another assembly file?


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.


Solution

  • If both files are linked into the same executable, yes. Lookup EXTERN or EXTRN.