Hello,
it works like this :
*** Memory Definitions****************************************************
ROM equ $8000 ;start of Flash mem
RAM equ $80 ;start of RAM mem
VectorStart equ $FFDC ; Interrupt Vectors
Set your Rom Adress
set your starting adress for the code
*** MAIN ROUTINE *********************************************************
ORG ROM ; start am annfang des FLASH ROMs
lda InitConfig1 ; Configregister Schreiben
sta CONFIG1
here comes the rest of your code
then set your vectors
**************************************************************
* Vectors *
* *
**************************************************************
org VectorStart
dw dummy_isr ; Time Base Vector
dw dummy_isr ; ADC Conversion Complete
dw dummy_isr ; Keyboard Vector
dw dummy_isr ; SCI Transmit Vector
dw dummy_isr ; SCI Receive Vector
dw dummy_isr ; SCI Error Vector
dw dummy_isr ; SPI Transmit Vector
dw dummy_isr ; SPI Receive Vector
dw dummy_isr ; TIM2 Overflow Vector
dw dummy_isr ; TIM2 Channel 1 Vector
dw dummy_isr ; TIM2 Channel 0 Vector
dw dummy_isr ; TIM1 Overflow Vector
dw dummy_isr ; TIM1 Channel 1 Vector
dw dummy_isr ; TIM1 Channel 0 Vector
dw dummy_isr ; PLL Vector
dw dummy_isr ; IRQ1 Vector
dw dummy_isr ; SWI Vector
dw ROM ; Reset Vector
The reset vector points to the rom entry which is your Program start.
Eckhard
Hi pele,
No, not quite!
ORG means origin, it simply means place the following code at this starting address. You can use it as many times as you like.
The reset vector defines the "entry point" and often is an address that has been used in an ORG statement but not necessarily.
You can see Eckard's example used it twice!
Regards David
Hello Pele,
Your understanding is correct - the contents of all vectors are simply program counter values to represent the beginning of a specific section of code. However, it would be more usual to identify the start of the program with a meaningful label. For example,
org ROM+$100
START: ; Commence initialisation code here
Within the vector table:
dc.w START ; Reset vector
In this case, the label START is more meaningful than ROM+$100. Note that I have used dc.w rather than dw, for compatibility with Code Warrior.
Regards,
Mac