shicks / js65

Tool suite for assembling, linking, and smudging 6502 assembly code
Mozilla Public License 2.0
0 stars 1 forks source link

.incbin cannot be used in macros or defines #17

Open TheRealQuantam opened 4 days ago

TheRealQuantam commented 4 days ago

.incbin is currently processed by the preprocessor. This breaks in macros because the .incbin will be processed when defining the macro, prior to having any macro parameters to evaluate (and occurring regardless of whether the macro is actually used).

.incbin implementation should probably be moved into the assembler.

TheRealQuantam commented 4 days ago

Looks like it can't be used in .defines, either, though I'm less clear on why.

.define INC_ROM_PART(bank_idx, addr, size) .incbin "test.bin", (bank_idx) * $4000 + ((addr) & $3fff) + $10, (size)

INC_ROM_PART 0, $8001, 2

results in "Error: Unknown directive: .INCBIN", indicating the preprocessor is not evaluating the .incbin token and passing it to the assembler.