Initializing the vector table from the PRM file allows you to initialize single entries in the table. The user can decide to initialize all the entries in the vector table or not.
The labels or functions, which should be inserted in the vector table, must be implemented in the assembly source file (Listing: Initializing the Vector table from a PRM File). All these labels must be published, otherwise they cannot be addressed in the linker PRM file.
XDEF IRQ1Func, SWIFunc, ResetFunc DataSec: SECTION Data: DS.W 5 ; Each interrupt increments an element ; of the table. CodeSec: SECTION ; Implementation of the interrupt functions. IRQ1Func: LDA #0 BRA int SWIFunc: LDA #4 BRA int ResetFunc: LDA #8 BRA entry int: PSHH LDHX #Data ; Load address of symbol Data in X ; X <- address of the appropriate element in the tab Ofset: TSTA BEQ Ofset3 Ofset2: AIX #$1 DECA BNE Ofset2 Ofset3: INC 0, X ; The table element is incremented PULH RTI entry: LDHX #$0E00 ; Init Stack Pointer to $E00-$1=$DFF TXS CLRX CLRH CLI ; Enables interrupts loop: BRA loop
The vector table is initialized using the linker VECTOR ADDRESS command, as listed in the following listing:
LINK test.abs NAMES test.o END SECTIONS MY_ROM = READ_ONLY 0x0800 TO 0x08FF; MY_RAM = READ_WRITE 0x0B00 TO 0x0CFF; MY_STACK = READ_WRITE 0x0D00 TO 0x0DFF; END PLACEMENT DEFAULT_RAM INTO MY_RAM; DEFAULT_ROM INTO MY_ROM; SSTACK INTO MY_STACK; END INIT ResetFunc VECTOR ADDRESS 0xFFF8 IRQ1Func VECTOR ADDRESS 0xFFFC SWIFunc VECTOR ADDRESS 0xFFFE ResetFunc