forked from EtchedPixels/FUZIX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcrt0.s
59 lines (54 loc) · 1.36 KB
/
crt0.s
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
; Ordering of segments for the linker.
; WRS: Note we list all our segments here, even though
; we don't use them all, because their ordering is set
; when they are first seen.
.area _CODE
.area _CODE2
.area _VIDEO
.area _CONST
.area _DISCARD
.area _DATA
.area _INITIALIZED
.area _BSEG
.area _BSS
.area _HEAP
; note that areas below here may be overwritten by the heap at runtime, so
; put initialisation stuff in here
.area _INITIALIZER
.area _GSINIT
.area _GSFINAL
.area _COMMONMEM
; imported symbols
.globl _fuzix_main
.globl init_early
.globl init_hardware
.globl s__DATA
.globl l__DATA
.globl s__COMMONMEM
.globl l__COMMONMEM
.globl s__INITIALIZER
.globl kstack_top
; startup code @0
.area _CODE
;
; Execution begins with us correctly mapped and at 0x0x100
;
start: di
ld sp, #kstack_top
; move the common memory where it belongs
ld hl, #s__INITIALIZER
ld de, #s__COMMONMEM
ld bc, #l__COMMONMEM
ldir
; then zero the data area
ld hl, #s__DATA
ld de, #s__DATA + 1
ld bc, #l__DATA - 1
ld (hl), #0
ldir
call init_early
call init_hardware
call _fuzix_main
di
stop: halt
jr stop