blob: 5d67ac4ec0d2cc2b4cc1c25b2be9402f9c9ae2ab [file] [log] [blame]
PulkoMandy355605a2014-06-28 23:20:12 +02001;; File: crt0-prg.s
kthacker62e146c2006-04-17 15:11:35 +00002
3 .module crt0
4 .area _HEADER (ABS)
5 .area _HOME (REL)
6 .area _CODE (REL)
PulkoMandy91577e12014-06-29 10:38:36 +02007 .dw 0 ; Will be replaced with the address of the reloc. table by the linker.
8 .area _INITIALIZER (REL)
9izr::
PulkoMandy355605a2014-06-28 23:20:12 +020010 .area _GSINIT (REL)
11 .area _GSFINAL (REL)
PulkoMandy91577e12014-06-29 10:38:36 +020012 ;; relocation data will be inserted here. It is used at loading time,
13 ; then overriden by the initialization of the data area below.
PulkoMandy355605a2014-06-28 23:20:12 +020014
PulkoMandy91577e12014-06-29 10:38:36 +020015 .area _INITIALIZED (REL)
16izd::
PulkoMandy355605a2014-06-28 23:20:12 +020017 .area _DATA (REL)
PulkoMandy91577e12014-06-29 10:38:36 +020018dat::
PulkoMandy355605a2014-06-28 23:20:12 +020019 .area _BSEG
kthacker62e146c2006-04-17 15:11:35 +000020 .area _BSS (REL)
21 .area _HEAP (REL)
22
23 .area _GSINIT (REL)
24gsinit::
PulkoMandy355605a2014-06-28 23:20:12 +020025 ld bc, #l__INITIALIZER
26 ld a, b
27 or a, c
28 jr Z, gsinit_next
PulkoMandy91577e12014-06-29 10:38:36 +020029 ld hl, #izr
30 ld de, #izd
PulkoMandy355605a2014-06-28 23:20:12 +020031 ldir
32gsinit_next:
33; Clear BSS sections
PulkoMandy91577e12014-06-29 10:38:36 +020034 ld hl,#dat
PulkoMandy355605a2014-06-28 23:20:12 +020035 ld (hl),#0
PulkoMandy91577e12014-06-29 10:38:36 +020036 ld de,#dat
PulkoMandy355605a2014-06-28 23:20:12 +020037 inc de
38 ld bc,#l__DATA
39 ldir
40
41
kthacker62e146c2006-04-17 15:11:35 +000042 .area _GSFINAL (REL)
43 ret