From c3b0fa04a663fe233765b83d3be41a42aa08c25d Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Mon, 3 May 2021 08:21:10 +0100 Subject: Initial import for public release --- crt0.s | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 crt0.s (limited to 'crt0.s') diff --git a/crt0.s b/crt0.s new file mode 100644 index 0000000..37c5fae --- /dev/null +++ b/crt0.s @@ -0,0 +1,55 @@ +.module crt0 +.globl _main +.globl _main_init + + .area _HOME + .area _CODE + .area _INITIALIZER + .area _GSINIT + .area _GSFINAL + + .area _DATA + .area _INITIALIZED + .area _BSEG + .area _BSS + .area _HEAP + + .area _CODE + +_main_init:: + + di + ; disable the firmware + ld hl, #0x38 + ld (hl), #0xfb + inc hl + ld (hl), #0xc9 + + ; disable upper/lower roms + ld bc, #0x7f8c + out (c), c + + ; put the stack as high as we can + ld sp, #0xc000 + ei + + call gsinit + call _main + +halt0: + halt + jr halt0 + + .area _GSINIT +gsinit:: + ld bc, #l__INITIALIZER + ld a, b + or a, c + jr Z, gsinit_next + ld de, #s__INITIALIZED + ld hl, #s__INITIALIZER + ldir +gsinit_next: + +.area _GSFINAL + ret -- cgit v1.2.3