MAIN.REL and HELLO.REL are your program relocatables. In this example I did it manually, but you can put this in your own script (this time it's appropriate to call it LINK.BAT) to avoid having to type all this every single time:
You'll also have the assembler source code in a. That's the assembled code for each part of your program in relocatable object format (this means that it's assembled code that can be linked on any memory address). (Again, I should have called this script ASSEMBLE.BAT instead of LINK.BAT)Īt this point you will have a couple of. That's the assembler code for the function.Ĥ) Assemble all the. If you want, remove also the line that removes the. Edit LINK.BAT and remove the linker command (L80) and anything that removes the. Make a copy of the MSXC.BAT script and call it LINK.BAT I should have called it ASSEMBLE.BAT or something like that) (note: I called this script LINK.BAT, but it doesn't actually do any linking. h of the external function (or functions).ģ) Create a new batch file that will compile and assemble without linking: h file, followed by the actual code of the function.Ģ) Your main program #includes the. h file that contains only the function declaration, plus any #includes that this function needs. Ok, here's how you compile a program by parts using MSX-C:ġ) Move into their own files the function(s) that you want to move out of your program. I've found tutorials to make libs using gcc, but this is not applicable to MSX-C. By this way, you could use in your projects "glibex.h" instead of "glib.h" in order to get extra features.