| 1 |
/****************************************************************** |
| 2 |
*** *** |
| 3 |
*** crt0 for __BELOW100__ attribute test with SID *** |
| 4 |
*** *** |
| 5 |
******************************************************************/ |
| 6 |
|
| 7 |
/*************************************/ |
| 8 |
/** Interrupt vectors at 0x8000 **/ |
| 9 |
/*************************************/ |
| 10 |
.section .int_vec,"ax" |
| 11 |
.global _start |
| 12 |
.align 1 |
| 13 |
_start: |
| 14 |
jmpf _int_reset |
| 15 |
//jmpf _int_basetimer |
| 16 |
//jmpf _int_timer0 |
| 17 |
//jmpf _int_timer1 |
| 18 |
//jmpf _int_irq_4 |
| 19 |
//jmpf _int_irq_5 |
| 20 |
//jmpf _int_port0 |
| 21 |
//jmpf _int_port1 |
| 22 |
//jmpf _int_irq_8 |
| 23 |
//jmpf _int_irq_9 |
| 24 |
//jmpf _int_irq_a |
| 25 |
//jmpf _int_irq_b |
| 26 |
//jmpf _int_irq_c |
| 27 |
//jmpf _int_irq_d |
| 28 |
//jmpf _int_irq_e |
| 29 |
//jmpf _int_irq_f |
| 30 |
/*************************************/ |
| 31 |
/** reset code **/ |
| 32 |
/*************************************/ |
| 33 |
.text |
| 34 |
_int_reset: |
| 35 |
/*************************************/ |
| 36 |
/** setup stack pointer **/ |
| 37 |
/*************************************/ |
| 38 |
mov sp,#__stack |
| 39 |
/*************************************/ |
| 40 |
/** zero .bss section **/ |
| 41 |
/*************************************/ |
| 42 |
mov r0,#__bss_start |
| 43 |
mov r1,#__bss_end |
| 44 |
mov r2,#0 |
| 45 |
1: mov.w (r0++),r2 |
| 46 |
blt r0,r1,1b |
| 47 |
/*************************************/ |
| 48 |
/** copy inital value for .data **/ |
| 49 |
/*************************************/ |
| 50 |
mov r1,#__data_start |
| 51 |
mov r3,#__data_end |
| 52 |
mov r0,#@lo(__rdata) |
| 53 |
mov r8,#@hi(__rdata) |
| 54 |
2: movf.w r2,(r0++) |
| 55 |
bnz r0,#0,3f |
| 56 |
add r8,#1 |
| 57 |
3: mov.w (r1++),r2 |
| 58 |
blt r1,r3,2b |
| 59 |
/*************************************/ |
| 60 |
/** call hardware init routine **/ |
| 61 |
/*************************************/ |
| 62 |
callf _hwinit |
| 63 |
/*************************************/ |
| 64 |
/** call initializaton routines **/ |
| 65 |
/*************************************/ |
| 66 |
callf _init |
| 67 |
/*************************************/ |
| 68 |
/** setup fini routines to be **/ |
| 69 |
/** called from exit **/ |
| 70 |
/*************************************/ |
| 71 |
mov r2,#@fptr(_fini) |
| 72 |
callf atexit |
| 73 |
/*************************************/ |
| 74 |
/** call main() with empty **/ |
| 75 |
/** argc/argv/envp **/ |
| 76 |
/*************************************/ |
| 77 |
mov r2,#0 |
| 78 |
mov r3,#0 |
| 79 |
mov r4,#0 |
| 80 |
callf main |
| 81 |
/*************************************/ |
| 82 |
/** return from main() **/ |
| 83 |
/*************************************/ |
| 84 |
callf exit |
| 85 |
/*************************************/ |
| 86 |
/** should never reach this code **/ |
| 87 |
/*************************************/ |
| 88 |
jmpf _start |
| 89 |
/*************************************/ |
| 90 |
/** default h/w initialize routine **/ |
| 91 |
/** and default _init/_finit for **/ |
| 92 |
/** -nostartfiles option **/ |
| 93 |
/*************************************/ |
| 94 |
.globl _hwinit |
| 95 |
.weak _hwinit |
| 96 |
_hwinit: |
| 97 |
.globl _init |
| 98 |
.weak _init |
| 99 |
_init: |
| 100 |
.globl _fini |
| 101 |
.weak _fini |
| 102 |
_fini: |
| 103 |
ret |
| 104 |
|
| 105 |
/****************************************************************** |
| 106 |
******************************************************************* |
| 107 |
*** *** |
| 108 |
*** Chip information data for LC59_32K *** |
| 109 |
*** Written by T.Matsukawa *** |
| 110 |
*** *** |
| 111 |
******************************************************************* |
| 112 |
******************************************************************/ |
| 113 |
|
| 114 |
/*************************************/ |
| 115 |
/** Define convenient macros **/ |
| 116 |
/*************************************/ |
| 117 |
#define BCD(x) (((x)/10)%10)*0x10+((x)%10) |
| 118 |
#define BCD4(x) BCD((x)/100),BCD(x) |
| 119 |
#define BCD6(x) BCD((x)/10000),BCD((x)/100),BCD(x) |
| 120 |
/*************************************/ |
| 121 |
/** Define memory sizes **/ |
| 122 |
/*************************************/ |
| 123 |
#define RAM_SIZE 0x7E00 |
| 124 |
#define ROM_SIZE 0x78000 |
| 125 |
#define VRAM_SIZE 0x0000 |
| 126 |
#define VRAM_ROW 0 |
| 127 |
#define VRAM_COLUMN 0 |
| 128 |
#define CGROM_SIZE 0x0000 |
| 129 |
#define PROTECT_SIZE 0x0000 |
| 130 |
|
| 131 |
/*************************************/ |
| 132 |
/** section ".chip_info" **/ |
| 133 |
/*************************************/ |
| 134 |
.section .chip_info,"a" |
| 135 |
.space 0xb8,0x00 |
| 136 |
/*************************************/ |
| 137 |
/** B8-BB : User option address **/ |
| 138 |
/*************************************/ |
| 139 |
.word 0x00000 |
| 140 |
.global __reset_vector |
| 141 |
#if 0x00000==0 |
| 142 |
.equ __reset_vector,0x08000 |
| 143 |
#else |
| 144 |
.equ __reset_vector,0x00000 |
| 145 |
#endif |
| 146 |
/*************************************/ |
| 147 |
/** BC-BF : Flash Protect address **/ |
| 148 |
/*************************************/ |
| 149 |
#if PROTECT_SIZE==0 |
| 150 |
.word 0x00000000 |
| 151 |
#else |
| 152 |
.word 0x08000+ROM_SIZE-PROTECT_SIZE |
| 153 |
#endif |
| 154 |
/*************************************/ |
| 155 |
/** C0-CF : Fixed string **/ |
| 156 |
/*************************************/ |
| 157 |
1: .ascii "CHIPINFORMATION" |
| 158 |
2: .space (0x10-(2b-1b)),0x00 |
| 159 |
/*************************************/ |
| 160 |
/** D0-DF : Chipname **/ |
| 161 |
/*************************************/ |
| 162 |
1: .ascii "LC59_32K" |
| 163 |
2: .space (0x10-(2b-1b)),0x00 |
| 164 |
/*************************************/ |
| 165 |
/** E0-E1 : Format version(BCD4) **/ |
| 166 |
/*************************************/ |
| 167 |
.byte 0x10, 0x00 |
| 168 |
.space 6, 0x00 |
| 169 |
/*************************************/ |
| 170 |
/** E8-F5 : Memory sizes **/ |
| 171 |
/*************************************/ |
| 172 |
.byte BCD4(ROM_SIZE/1024) |
| 173 |
.byte BCD6(RAM_SIZE) |
| 174 |
.byte BCD6(VRAM_SIZE) |
| 175 |
.byte BCD4(VRAM_ROW) |
| 176 |
.byte BCD4(VRAM_COLUMN) |
| 177 |
.byte BCD4(CGROM_SIZE/1024) |
| 178 |
.space 3, 0x00 |
| 179 |
/*************************************/ |
| 180 |
/** F9 : Package type **/ |
| 181 |
/*************************************/ |
| 182 |
.byte 0xff |
| 183 |
.space 6, 0x00 |
| 184 |
|
| 185 |
/*************************************/ |
| 186 |
/** In order to link BIOS in library**/ |
| 187 |
/*************************************/ |
| 188 |
.equ dummy,__bios_entry |