#include    <machine.h>
 
 #include    <_h_c_lib.h>
 
 //#include  <stddef.h>                  // Remove the comment when you use errno
 
 //#include  <stdlib.h>                  // Remove the comment when you use rand()
 
 #include    "typedefine.h"              // Define Types
 
 #include    "kernel.h"                  // Provided by RI600V4
 
 #include    "kernel_id.h"               // Generated by cfg600
 
 
 
 #if (((_RI_CLOCK_TIMER) >=0) && ((_RI_CLOCK_TIMER) <= 3))
 
 #include    "ri_cmt.h"   // Generated by cfg600
                       // Do comment-out when clock.timer is either NOTIMER or OTHER.
 #endif
 
 
 
 #ifdef __cplusplus
 
 extern "C" {
 #endif
 
 void PowerON_Reset_PC(void);
 
 void main(void);
 
 #ifdef __cplusplus
 
 }
 
 #endif
 
 
 
 //#ifdef __cplusplus                // Use SIM I/O
 
 //extern "C" {
 //#endif
 
 //extern void _INIT_IOLIB(void);
 
 //extern void _CLOSEALL(void);
 
 //#ifdef __cplusplus
 
 //}
 
 //#endif
 
 
 
 #define FPSW_init 0x00000000    // FPSW bit base pattern
 
 
 
 //extern void srand(_UINT);     // Remove the comment when you use rand()
 
 //extern _SBYTE *_s1ptr;        // Remove the comment when you use strtok()
 
 
 
 //#ifdef __cplusplus            // Use Hardware Setup
 
 //extern "C" {
 //#endif
 
 //extern void HardwareSetup(void);
 
 //#ifdef __cplusplus
 
 //}
 
 //#endif
 
    
 //#ifdef __cplusplus   // Remove the comment when you use global class object
 
 //extern "C" {         // Sections C$INIT and C$END will be generated
 //#endif
 
 //extern void _CALL_INIT(void);
 
 //extern void _CALL_END(void);
 
 //#ifdef __cplusplus
 
 //}
 
 //#endif
 
 #pragma section ResetPRG        // output PowerON_Reset to PResetPRG section
 
 
 
 /////////////////////////////////////////////////////////////////////////////
 
 // Boot processing
 
 /////////////////////////////////////////////////////////////////////////////
 
 #pragma entry PowerON_Reset_PC
 
 
 
 void PowerON_Reset_PC(void)
 
 { 
 
 
 #ifdef __ROZ                    // Initialize FPSW
 
 #define _ROUND 0x00000001           // Let FPSW RMbits=01 (round to zero)
 
 #else
 
 #define _ROUND 0x00000000           // Let FPSW RMbits=00 (round to nearest)
 
 #endif
 
 #ifdef __DOFF
 
 #define _DENOM 0x00000100           // Let FPSW DNbit=1 (denormal as zero)
 
 #else
 
 #define _DENOM 0x00000000           // Let FPSW DNbit=0 (denormal as is)
 
 #endif
 
 
 
 //    set_extb(__sectop("FIX_INTERRUPT_VECTOR"));// Initialize EXTB register
                                                  //  (only for RXv2 arch.)
 
 
     set_fpsw(FPSW_init | _ROUND | _DENOM);
 
 
     _INITSCT();
 
 
 //  _INIT_IOLIB();                  // Use SIM I/O
 
 
 
 //  errno=0;                        // Remove the comment when you use errno
 
 //  srand((_UINT)1);                // Remove the comment when you use rand()
 
 //  _s1ptr=NULL;                    // Remove the comment when you use strtok()
 
         
 //  HardwareSetup();                // Use Hardware Setup
 
     nop();
 
 
 //  set_fintv(<handler address>);   // Initialize FINTV register
 
 
 
 #if (((_RI_CLOCK_TIMER) >=0) && ((_RI_CLOCK_TIMER) <= 3))
 
     _RI_init_cmt();  // Initialize CMT for RI600V4
             // Do comment-out when clock.timer is either NOTIMER or OTHER.
 #endif
 
 
 
 //  _CALL_INIT();           // Remove the comment when you use global class object
 
 
 
     vsta_knl();                     // Start RI600V4
                                     // Never return from vsta_kn
 //  _CLOSEALL();                    // Use SIM I/O
 
     
 //  _CALL_END();            // Remove the comment when you use global class object
 
 
 
     brk();
 }
 
 /////////////////////////////////////////////////////////////////////////////
 
 // System down routine for RI600V4
 
 /////////////////////////////////////////////////////////////////////////////
 
 #pragma section P PRI_KERNEL
 
 #pragma section B BRI_RAM
 
 struct SYSDWN_INF{
     W   type;
     VW  inf1;
     VW  inf2;
     VW  inf3;
 };
 
 
 
 volatile struct SYSDWN_INF _RI_sysdwn_inf;
 
 void _RI_sys_dwn__( W type, VW inf1, VW inf2, VW inf3 )
 
 {
    // Now PSW.I=0 (all interrupts are masked.)
     _RI_sysdwn_inf.type = type;
     _RI_sysdwn_inf.inf1 = inf1;
     _RI_sysdwn_inf.inf2 = inf2;
     _RI_sysdwn_inf.inf3 = inf3;
 
 
    while(1)
    ;
 }
 
 
 
 /////////////////////////////////////////////////////////////////////////////
 
 // RI600V4 system data
 
 /////////////////////////////////////////////////////////////////////////////
 
 #include "kernel_ram.h"     // generated by cfg600
 
 #include "kernel_rom.h"     // generated by cfg600
 
 |