Xunhua Guo

program counter & reset vector

Discussion created by Xunhua Guo on Aug 25, 2007
Latest reply on Aug 25, 2007 by Xunhua Guo
Hi,
   I am a HC08 beginner.  I wonder how the contents of Program Counter and RESET Vector ($FFFE,$FFFF) are set at the beging of a program.  Below is where the question stems from.
 
   I created a project with CW. In the automatic created file " INCLUDE 'derivative.inc" has this code:
        ROMStart:           equ   $00008000
        INT_RESET:       equ   $0000FFFE
 
   in the automatic created main.asm has this code:
 
      ; Include derivative-specific definitions
         INCLUDE 'derivative.inc'
      ; export symbols
            XDEF _Startup
            ABSENTRY _Startup
 
      ; variable/data section
           ORG    RAMStart         ; Insert your data definition here
           ExampleVar: DS.B   1
           TEMP1: EQU $0040

           ; code section
             ORG    ROMStart
_Startup:
             LDHX   #RAMEnd+1        ; initialize the stack pointer
            TXS
            CLI                     ; enable interrupts
mainLoop:
           
            ; Insert your code here
            NOP
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
When simulating this program in CW, I found that both the contents of PC (program counter) and $FFFE,$FFFF are 8000.  I wonder how each content of the two is set?
 
Thanks!
zen
  

Outcomes