|
In my assembler the code is broken into independent blocks which allows local labels and for the linker to dead-strip unused code. I had one style of anonymous labels, but have recently adopted a new style based on what I saw in some NES asm source. The similarities to C should be fairly obvious :)
#include "nes.h" ; insert text of file
extern main ; accessible to other files static nmi ; only visible in this file static irq
block { main: : lda $2002 bpl - ; previous unnamed label ; ... nmi: irq: rti }
block $FFFA { ; absolute placement dc.w nmi dc.w main dc.w irq }
The dead-stripping is feature is very useful as it allows common routines to be all in one file, in separate blocks, without having unnecessary ones linked in. When I had the assembler targeted for a PIC microcontroller with flash memory, I wrote a linker which only updated the flash memory with modified blocks. This sped up reprogramming and reduced the number of erase cycles.
|