Abfolge Bibliotheks-Code
Der Compiler/Assembler bindet Inline-Code (den Source aus Inline-Methoden) direkt dort ein, wo er im Luna-Code textuell erscheint. Vor dem Einbinden werden Makros und Textersetzung bearbeitet.
Die Bibliotheks-Sourcen (Methoden und Subroutinen) werden in der Reihenfolge wie im Bibliothekseditor dargestellt zusammengefasst eingebunden. Hierbei werden unbenutzte Sourcen ausgeblendet.
avr.device = atmega328p avr.clock = 20000000 avr.stack = 64 uart0.baud = 19200 ' Baudrate uart0.Recv.enable ' Senden aktivieren uart0.Send.enable ' Empfangen aktivieren #library "library/mylib.interface" dim a as byte a = mylib.myconst a = mylib.Hello.Myproperty mylib.Hello.Myproperty = 100 mylib.Hello.myinline(200) mylib.Hello.mymethod(1,2) halt()
Der resultierende Assemblercode:
;{12}{ a = mylib.myconst } ---------------------------------------------
ldi _HA0,0x64 ; 0b01100100 0x64 100
sts dVarClassAvrA,_HA0
;{13}{ a = mylib.Hello.Myproperty } ------------------------------------
lds _HA0,_dVarMylibHellomyproperty
sts dVarClassAvrA,_HA0
;{15}{ mylib.Hello.Myproperty = 100 } ----------------------------------
ldi _HA0,0x64 ; 0b01100100 0x64 100
sts _dVarMylibHellomyproperty,_HA0
;{17}{ mylib.Hello.myinline(200) } -------------------------------------
ldi _HA0,0xC8 ; 0b11001000 0xC8 200
nop
nop
nop
;{18}{ mylib.Hello.mymethod(1,2) } -------------------------------------
ldi _HA0,0x02 ; 0b00000010 0x02 2
push _HA0
ldi _HA0,0x01 ; 0b00000001 0x01 1
rcall _MylibHelloMymethod
;{22}{ halt() } --------------------------------------------------------
__halt0:
rjmp __halt0
[...]
_MylibHelloMymethod:
pop _LA0
pop _LA1
pop _HB0
push _LA1
push _LA0
ret
[...]

