Präprozessor - Assembler

Der im Luna-Assembler eingebaute Präprozessor ist ein sog. Makroprozessor.

Im Präprozessor werden folgende Teilbereiche bearbeitet:

Präprozessorfunktionen im Assembler-Code

Anweisungen

Command DescriptionExample
.equ create a constant .equ var = 123.45
.set create/assign a constant .set var = 123.45
.def Alias.def temp = R16
.device set the avr controller type.device atmega32
.import import a label.import _myLabel
.importClass1) import avr class. sets all defines and constants of the selected avr controller inclusive .device.importClass atmega32
.importObject2) import a library object .importObject Macro_Delay
.importUsedObjects3) auto-imports all in the source code used libraries objects.importUsedObjects
.cseg select flash segment.cseg
.dseg select sram segment.dseg
.eseg select eeprom segment.eseg
.org Sets the pointer of the actual active segment to a specific value .org intVectorSize
.error Display a error message. Break compile/assemble..error „message“
.warning Display a warning message..warning „message“
.message, .print Display a info message without line number and origin..message „message“
.regisr register a label to a interrupt vector „on the fly“ (used for Library Code).regisr vectorAddress,mylabel
.db (byte) 1 byte each value and strings, data block. 4).db „hello“,0x3b
.dw (word) 2 bytes each value, data block. 5).dw 0x3bda,0xcf01
.dt (triple) 3 bytes each value, data block. 6).dt 0xf0d1a4
.dl (long) 4 bytes each value, data block. 7).dl 0xff01ddca
.bin (file) data block from file byte-wise. 8).bin „filepath“
.odb (byte) 1 byte each value and strings, object data block.odb „hello“,0x3b
.odw (word) 2 bytes each value, object data block. 9).odw 0x3bda,0xcf01
.odt (triple) 3 bytes each value, object data block. 10).odt 0xf0d1a4
.odl (long) 4 bytes each value, object data block. 11).odl 0xff01ddca
.obin (file) data block from file byte-wise. 12).obin „filepath“
.dobjend endmark for object data block with .odb, .odw, … 13))).dobjend label
Beispiel für Objekt-Datenblock
classServiceudpdDatagram:
.odb		"this is a message from the luna udpd server",0x0D,0x0A
.odb		"build with lavrc version ","2013.r6.7",0x0D,0x0A
.odb		0x0D,0x0A
.dobjend	classServiceudpdDatagram

Funktionen

Die Präprozessorfunktionen können nur mit Konstanten verwendet werden.

Funktionen aus dem Luna-Befehlssatz, abgebildet im Präprozessor.
Sonderfunktionen, nur im Präprozessor.
1) , 2) , 3) only used by the compiler
4) , 5) , 6) , 7) , 8) Note: End of block auto-aligned/padding to even address!
9) , 10) , 11) , 12) Note: No auto-alignment/padding
13) Initiates the auto-alignment/padding to even address over the complete data set.