Version 2.5.0 - partial includes
Now you can include not only the whole file, but only a part of file. This is achieved by the concept of “named block”.
Let’s have a file “library.a80”:
.block serout ; a routine for serial output @putchar: ... .endblock .block serin ;a routine for serial input @getchar ... .endblock
In your file, e.g. “main.a80”, you can include the whole file with
.include library.a80. Now you can include only the needed parts using a special naming convention file:block.
.include library.a80:serout call putchar: ...
It includes only the block “serout” (with a global label putchar, in our case). Other blocks will be omitted.
Include local block
You can reference the actual included file by the placeholder this. Let’s add a “serial init” to our library:
... .block serinit ;serial port init @uart_init: ... .endblock
Now you can add the “dependency” with a little bit modification of our library:
.block serout ; a routine for serial output .include this:serinit @putchar: ... .endblock .block serin ;a routine for serial input .include this:serinit @getchar: ... .endblock .block serinit ;serial port init @uart_init: ... .endblock
Don’t worry, the init code will be included only once! If you need include the block twice or more, you can overrule the check with the dual colon: