04-10-2012, 12:43 PM
britlion Wrote:Not yet :oops:boriel Wrote:I
The asm directive for this is #require "file.asm", which will include the file ONCE at the end of the compilation (include once does it in place).
That's a new one for me. Huh.
Is there a list of these compiler directives somewhere?
Anyway, it's safe to use include once always. But some times you want a library to be "included once later". Let's suppose we have the following files:
file1.asm
Code:
...
call SUB_ASM
ld a, 5
jp _FILE2
; Continue on file2.asm routine
#include once "SUB.asm"
Code:
_FILE2:
rla ; a = a * 2
...
...
file1.asm
Code:
#require "SUB.asm"
..
call SUB_ASM
ld a, 5
; jp _FILE2 ;; removed; goes directly to _FILE2:
; Continue on file2.asm routine
Code:
; Ensures file1.asm goes here
#include once "file1.asm"
_FILE2:
rla ; a = a * 2
...
...