Example program for the Cidco MailStation Z80 computer

crt0: Add gsinit from default sdcc crt0

+48 -29
+46 -25
lib/crt0.s
··· 20 20 21 21 .include "mailstation.inc" 22 22 .globl _main 23 + .globl l__INITIALIZER 24 + .globl s__INITIALIZER 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 + call gsinit 128 132 call find_shadows 129 133 call _main ; main c code 130 134 jp _exit 135 + 136 + 137 + .area _DATA 138 + 139 + ; shadow locations 140 + p2shadow: 141 + .dw #0xdba2 142 + p3shadow: 143 + .dw #0xdba3 144 + p28shadow: 145 + .dw #0xdba0 146 + delay_func: 147 + jp 0x0a5c 148 + 149 + _debug0:: 150 + .db #0 151 + _debug1:: 152 + .db #0 153 + _debug2:: 154 + .db #0 155 + _debug3:: 156 + .db #0 157 + _debug4:: 158 + .db #0 159 + 160 + 161 + .area _GSINIT 162 + gsinit: 163 + ld bc, #l__INITIALIZER 164 + ld a, b 165 + or a, c 166 + jr z, gsinit_next 167 + ld de, #s__INITIALIZED 168 + ld hl, #s__INITIALIZER 169 + ldir 170 + gsinit_next: 171 + 172 + .area _GSFINAL 173 + ret 174 + 175 + 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 - 179 - .area _DATA 180 - 181 - ; shadow locations 182 - p2shadow: 183 - .dw #0xdba2 184 - p3shadow: 185 - .dw #0xdba3 186 - p28shadow: 187 - .dw #0xdba0 188 - delay_func: 189 - jp 0x0a5c 190 - 191 - _debug0:: 192 - .db #0 193 - _debug1:: 194 - .db #0 195 - _debug2:: 196 - .db #0 197 - _debug3:: 198 - .db #0 199 - _debug4:: 200 - .db #0 201 - 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 - unsigned char lastkey; 24 + /* ignore first peekkey() if it returns power button */ 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 - /* ignore first peekkey() if it returns power button */ 33 - lastkey = KEY_POWER; 34 - 35 33 screen_init(); 36 34 37 35 wifi_init();