CRT0MSX.S

Txinto Vaz, 09/09/2013 07:43 PM

Download (861 Bytes)

 
1
	;; Generic crt0.s for a Z80
2
	.globl	_main
3

    
4
	.area _HEADER (ABS)
5
	;; Reset vector
6
        .org    0x4000
7
        .db     0x41
8
        .db     0x42 ; "AB" HEADER
9
        .dw     init
10
        .dw     0x0000
11
        .dw     0x0000
12
        .dw     0x0000
13
        .dw     0x0000
14
        .dw     0x0000
15
        .dw     0x0000
16

    
17
init:
18
	;; Stack at the top of memory.
19
        ld      sp,(0xfc4a)        
20

    
21
        ;; Initialise global variables
22
        call    gsinit
23
	call	_main
24
	jp	_exit
25

    
26
	;; Ordering of segments for the linker.
27
	.area	_CODE
28
        .area   _GSINIT
29
        .area   _GSFINAL
30
        
31
	.area	_DATA
32
        .area   _BSS
33

    
34
        .area   _CODE
35

    
36
        ;; Special RLE decoder used for initing global data
37
;;__initrleblock::
38
;;        ret
39

    
40
        .area   _GSINIT
41
gsinit::	
42

    
43
        .area   _GSFINAL
44
        ret