- FAE/Client Login
- product registration
- > Download <
- Our products
- Support
- FAQs
- technical support
- Installation
- Application Notes
- Device List
- Hints and Tips
- C38 - Special Page Access
- C6805 - Filling Unused ROM
- C6805 - Setting Multiple MORs
- C6805 - Working with MMEVS05/MMDS05
- C6808 and Emulators
- COP8C - Executing Initialization Code
- COP8C - S Register Support
- Debugging: Using Macros to Monitor Program Flow
- Declaring SPECIAL Memory
- LCD Interface
- LOCAL Memory
- Low Cost, Low Speed A/D conversion for Embedded Systems
- MPC - Branch Islands on the PIC16C5x
- MPC - Constant ROM Arrays
- MPC - Named Address Space
- MPC - Setting Configuration Fuses
- Non-linear Data Transformations
- Using the CodeWright(TM) Editor
- Product-specific Notes
- Resources
- CODSupport
- Fixed Point
- Fuzzy Logic
- Publishing
- What's New
- About Us
- more information
COP8C - Executing Initialization Code
Byte Craft's COP8C compiler uses 5 bytes at 0x0000 for initialization. It calls the function __STARTUP() if it is defined, and then jumps to main().
If you want your own initialization code executed on reset instead, use the directive #pragma option NOINIT to turn off the default initialization, and place your own code at 0x0000.
/* INITCOP8 V1.0 IMPORTANT NOTES:
1. Your init code must be the FIRST code compiled
(after # directives, but before any functions).
2. You must call __STARTUP() (if used) and main() in
your init code.
3. The compiler always leaves room for its default
init code when it allocates ROM for C source. Your
init code must use inline assembly with an ORG to start
at 0x0000, but because it is compiled before other code,
you have an unlimited number of bytes for initialization.
This code may be adapted for any purpose when used with
the COP8C Code Development System. No warranty is implied
or given as to its usability for any purpose.
Copyright April 1996, 2001, Byte Craft Limited, All rights reserved.
Byte Craft Limited, Waterloo, Ontario, Canada N2J 4E4 */
/* Turn off default initialization */ #pragma option NOINIT;
#pragma memory ROM [0x00f0] @ 0;
#pragma memory RAM [112] @ 0;
#pragma memory RAM [0xc] @ 0xf0;
#pragma has 840;
/* Program status word */ #pragma portrw PSW @ 0xef;
/* Interrupt Enable Bit */ #define GIE 0
#asm
ORG 0 ;Start at 0000
RBIT GIE,PSW ;Turn off interrupts
JSRL __STARTUP ;Call startup function
JMPL main ;Jump to main()
#endasm
/* Optional startup init function */
void __STARTUP(void) { }
void main(void) {
/* ... */
} 
eTPU_C:
C6808: