-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreset_program.asm
More file actions
166 lines (136 loc) · 4.63 KB
/
Copy pathreset_program.asm
File metadata and controls
166 lines (136 loc) · 4.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
/***************************************************************/
/* */
/* PROJECT NAME : Valduino */
/* FILE : reset_program.asm */
/* DESCRIPTION : Reset Program */
/* CPU SERIES : RL78 - F14 */
/* CPU TYPE : R5F10PPJ */
/* */
/* This file is generated by e2 studio. */
/* */
/***************************************************************/
/************************************************************************/
/* File Version: V1.04 */
/* Date Generated: 06/05/2015 */
/************************************************************************/
/*reset_program.asm*/
.list
.global _PowerON_Reset /*! global Start routine */
.short _PowerON_Reset
#ifdef CPPAPP
___dso_handle:
.global ___dso_handle
#endif
.extern _HardwareSetup /*! external Sub-routine to initialise Hardware*/
.extern _data
.extern _mdata
.extern _ebss
.extern _bss
.extern _edata
.extern _main
.extern _stack
.extern _exit
/* ;; HL = start of list
;; DE = end of list
;; BC = step direction (+2 or -2)
*/
.text
/* call to _PowerON_Reset */
_PowerON_Reset:
/* initialise user stack pointer */
movw sp,#_stack /* Set stack pointer */
/* load data section from ROM to RAM */
;; block move to initialize .data
;; we're copying from 00:[_romdatastart] to 0F:[_datastart]
;; and our data is not in the mirrored area.
mov es, #0
#ifndef __RL78_G10__
sel rb0 /* ;;bank 0 */
#endif
movw de, #_mdata /* src ROM address of data section in de */
movw hl, #_data /* dest start RAM address of data section in hl */
#ifndef __RL78_G10__
sel rb1 /* bank 1 */
movw hl, #_data /* dest start RAM address of data section in hl */
#endif
movw ax, #_edata /* ;; size of romdata section in ax */
subw ax,hl /* store data size */
shrw ax,1
1:
cmpw ax, #0 /* check if end of data */
bz $1f
decw ax
#ifdef __RL78_G10__
movw bc, ax /* save ax value in bc */
#endif
#ifndef __RL78_G10__
sel rb0 /* bank 0 */
#endif
movw ax, es:[de]
movw [hl], ax
incw de
incw de
incw hl
incw hl
#ifndef __RL78_G10__
sel rb1 /* bank 1 - compare and decrement*/
#endif
#ifdef __RL78_G10__
movw ax, bc /* restore ax value */
#endif
br $1b
1:
/* bss initialisation : zero out bss */
#ifndef __RL78_G10__
sel rb0 /* bank 0 */
movw ax, #0 /* load AX reg with zero */
sel rb1 /* bank 1 */
movw ax, #_ebss /* store the end address (size of) bss section in ax */
movw hl, #_bss /* store the start address of bss in hl */
subw ax,hl ;; store data size
shrw ax,1
#endif
#ifdef __RL78_G10__
movw hl, #_bss /* store the start address of bss in hl */
movw ax, #_ebss /* store the end address (size of) bss section in ax */
subw ax,hl ;; store data size
shrw ax,1
#endif
1:
cmpw ax, #0
bz $1f
decw ax
#ifdef __RL78_G10__
movw bc, ax /* save ax value in bc */
movw ax, #0
#endif
#ifndef __RL78_G10__
sel rb0 /* bank 0 */
#endif
movw [hl], ax
incw hl
incw hl
#ifdef __RL78_G10__
movw ax, bc /* restore ax value */
#endif
#ifndef __RL78_G10__
sel rb1
#endif
br $1b
1:
#ifndef __RL78_G10__
sel rb0 /* bank 0 */
#endif
/* call the hardware initialiser */
call !!_HardwareSetup
nop
/* start user program */
movw ax, #0
push ax /* envp */
push ax /* argv */
push ax /* argc */
call !!_main
/* call to exit*/
_exit:
br $_exit
.end