I must be missing something simple...
I have a relocatable assembly project. I have one main.asm file. It is 15,000 lines of code. I would like to take some of my subroutines and put them in their own files. I have a subroutine "_CheckBatt". Is uses one register "BATTERY", defined in direct page "BATTERY DS 1".
Why can I not just copy the entire subroutine, from "_CheckBatt:" to "RTS" into it's own .asm file? I tried putting "XREF BATTERY" and "XREFB BATTERY" at the top of "_CheckBatt.asm". I made sure to put "INCLUDE '_CheckBatt.asm'" at the top of "main.asm". I even tried putting "XDEF BATTERY" at the top of "main.asm". The compiler keeps saying something like "variable redefined".
Shouldn't using multiple files be simple?
Is it a matter of XDEF and XREF? Or maybe .asm vs .inc files? How about relocatable SECTION vs absolute ORG? As long as the registers are defined in RAM, why does it matter if it is ORG or not?
How about a simple example of two file, "main.asm" and "second.asm" (or "second.inc") that shows main defining a register "TEST DS 1", using a "JSR" instruction to jump into a subroutine in the "second" file, and that subroutine in the "second" files manipulates "TEST", and then calls "RTS"...
Thanks in advance!!!