Table of Contents Previous topic Next topic
C COMPILER->Compiler Support Files->Startup Module
The startup module in the LIB68020.LIB library has been created from the assembler code shown in the following listing. This assembler code is supplied in file STARTUP.ASM and must be modified to suit the target system and then added to the run time library LIB68020.LIB.
If console i/o is required then putch() and getch() routines must also be written specifically for the target system. All other console i/o functions call these two target specific functions and so once these are written, then all of these will automatically work correctly too. Versions are included in the library (and are described later) but these must be re-written for your particular target board.
The following listing shows the startup routine that has been included in the library but this must be modified to suit your target board.* Example startup Routine xref _main,__initdata,__HP xdef __cstart,_exit section __STACK,data,high * Linker places this at * highest available ram location ds.w 1 * 1 word minimum to create section section __HEAP,data,postpone * Linker places this after * all ram sections except __STACK ds.w 1 * 1 word minimum to create section org 400600H * Lowest user ram location__cstart cmp.l #400600H,a7 * Test supervisor mode (by * looking at stack pointer) bge.s skip1 * Skip set user mode if already * set * In supervisor mode if here move sr,d0 * Get status register andi #$dfff,d0 * Clear S bit in status register move d0,sr * Set user modeskip1 movea.l #__STACK,a7 * Set user stack pointer move.l #__HEAP,__HP * Initialise heap pointers jsr __initdata jsr _main_exit trap #11 * Call monitor RENTER command dc.w 0 * Re-enter monitor
You should note the following points about this sample startup routine: