-
-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathcrt0_msxbasic.asm
More file actions
52 lines (43 loc) · 974 Bytes
/
Copy pathcrt0_msxbasic.asm
File metadata and controls
52 lines (43 loc) · 974 Bytes
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
;--- crt0.asm for MSX-BASIC - by Konamiman, 1/2018
;
; Change the .org directive as appropriate for your program
;
; To assemble it:
; sdasz80 -o crt0_msxbasic.rel crt0_msxbasic.s
;
; Compile programs with --code-loc <org address + 32> --data-loc X
; X=0 -> global vars will be placed immediately after code
; X!=0 -> global vars will be placed at address X
.module crt0
.globl _main
.globl l__INITIALIZER
.globl s__INITIALIZED
.globl s__INITIALIZER
.area _HEADER (ABS)
.org 0xA000
.db 0xFE
.dw init
.dw end
.dw init
;--- Initialize globals and jump to "main"
init:
ld bc, #l__INITIALIZER
ld a, b
or a, c
jp z,_main
ld de, #s__INITIALIZED
ld hl, #s__INITIALIZER
ldir
jp _main
;; Ordering of segments for the linker.
.area _HOME
.area _CODE
.area _INITIALIZER
.area _GSINIT
.area _GSFINAL
.area _DATA
.area _INITIALIZED
.area _BSEG
.area _BSS
.area _HEAP
end: