Unknown Year, 5.2L MC68HC16Z2 Initialization Code Overview
From JTEC_PCM
- Reset Vector = 0x0
- First byte of reset vector = PK (Program Counter Extension)
- Second byte of reset vector = SK (Stack Pointer Extension)
- Third byte of reset vector = ZK (Index Z Extension)
- PK = 0x01
- SK = 0xFF
- ZK = 0xFF
- Initial PC = 0x0 | PK = (0x10000)
- 0x10000 Jump to 0x20000
- 0x20002 Wrote 0xFF to SK
- 0x20004 Wrote 0xFF to ZK
- 0x20006 Wrote 0xF8FE to SP
- 0x2000A Wrote 0xF800 to Z
- 0x20010 Wrote 0x00 to EK, XK, & YK
- 0x2001E Write 0xB4 to SYPCR
- Enabled Watchdog
- Turned off scaling
- Set timeout to 2 to the 15th
- 0x20024 Wrote 0x55 to SWSR
- 0x2002A Wrote 0xAA to SWSR
- Writing 0x55 then 0xAA to SWSR pets the watchdog
- 0x20032 Wrote 0xFF to RAMBAH
- 0x2003A Wrote 0x8000 to RAMBAL
- This set RAM to start at 0xF8000
- 0x2003E cleared RAMMCR
- Took RAM out of low power mode and enabled it.
- Allowed writes to RAM from IMB
- 0x2004C ORed 0x8100 to SIMCR
- Turned off external clock
- Set external bus master to have direct access to IMB
- 0x20052 Wrote 0x30 to PEPAR
- Port E Pin Assignment
- Set PEPA5 as Address Strobe
- Set PEPA4 as Data Strobe
- 0x20056 Wrote 0x30 to DDRE
- Port E Pin Direction
- Set DDE5 & DDE4 as outputs