tangled
alpha
login
or
join now
jcs.org
/
MailStation-Example
0
fork
atom
Example program for the Cidco MailStation Z80 computer
0
fork
atom
overview
issues
pulls
pipelines
crt0: Add gsinit from default sdcc crt0
jcs.org
4 years ago
8aa5ea61
c5ecb829
+48
-29
2 changed files
expand all
collapse all
unified
split
lib
crt0.s
main.c
+46
-25
lib/crt0.s
···
20
20
21
21
.include "mailstation.inc"
22
22
.globl _main
23
23
+
.globl l__INITIALIZER
24
24
+
.globl s__INITIALIZER
25
25
+
.globl s__INITIALIZED
23
26
24
27
.area _HEADER (ABS)
25
28
···
125
128
jp RUN_ADDR + (lojump - start)
126
129
127
130
lojump:
131
131
+
call gsinit
128
132
call find_shadows
129
133
call _main ; main c code
130
134
jp _exit
135
135
+
136
136
+
137
137
+
.area _DATA
138
138
+
139
139
+
; shadow locations
140
140
+
p2shadow:
141
141
+
.dw #0xdba2
142
142
+
p3shadow:
143
143
+
.dw #0xdba3
144
144
+
p28shadow:
145
145
+
.dw #0xdba0
146
146
+
delay_func:
147
147
+
jp 0x0a5c
148
148
+
149
149
+
_debug0::
150
150
+
.db #0
151
151
+
_debug1::
152
152
+
.db #0
153
153
+
_debug2::
154
154
+
.db #0
155
155
+
_debug3::
156
156
+
.db #0
157
157
+
_debug4::
158
158
+
.db #0
159
159
+
160
160
+
161
161
+
.area _GSINIT
162
162
+
gsinit:
163
163
+
ld bc, #l__INITIALIZER
164
164
+
ld a, b
165
165
+
or a, c
166
166
+
jr z, gsinit_next
167
167
+
ld de, #s__INITIALIZED
168
168
+
ld hl, #s__INITIALIZER
169
169
+
ldir
170
170
+
gsinit_next:
171
171
+
172
172
+
.area _GSFINAL
173
173
+
ret
174
174
+
175
175
+
176
176
+
.area _CODE
131
177
132
178
; set location of port shadow variables depending on firmware version
133
179
find_shadows:
···
175
221
ld hl, #p3shadow
176
222
ld (hl), #0xdba6
177
223
ret
178
178
-
179
179
-
.area _DATA
180
180
-
181
181
-
; shadow locations
182
182
-
p2shadow:
183
183
-
.dw #0xdba2
184
184
-
p3shadow:
185
185
-
.dw #0xdba3
186
186
-
p28shadow:
187
187
-
.dw #0xdba0
188
188
-
delay_func:
189
189
-
jp 0x0a5c
190
190
-
191
191
-
_debug0::
192
192
-
.db #0
193
193
-
_debug1::
194
194
-
.db #0
195
195
-
_debug2::
196
196
-
.db #0
197
197
-
_debug3::
198
198
-
.db #0
199
199
-
_debug4::
200
200
-
.db #0
201
201
-
202
202
-
.area _CODE
203
224
204
225
; exit handler, restart
205
226
_exit::
+2
-4
main.c
···
21
21
22
22
#include "lib/mailstation.h"
23
23
24
24
-
unsigned char lastkey;
24
24
+
/* ignore first peekkey() if it returns power button */
25
25
+
unsigned char lastkey = KEY_POWER;
25
26
26
27
int process_keyboard(void);
27
28
void process_input(unsigned char b);
···
29
30
int
30
31
main(void)
31
32
{
32
32
-
/* ignore first peekkey() if it returns power button */
33
33
-
lastkey = KEY_POWER;
34
34
-
35
33
screen_init();
36
34
37
35
wifi_init();