diff options
author | Juan J. Martinez <jjm@usebox.net> | 2021-05-03 08:21:10 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2021-05-03 10:00:00 +0100 |
commit | c3b0fa04a663fe233765b83d3be41a42aa08c25d (patch) | |
tree | 0befda349001ef6ce306b39378f9c70ad917363e /crt0.s | |
download | return-of-traxtor-cpc-c3b0fa04a663fe233765b83d3be41a42aa08c25d.tar.gz return-of-traxtor-cpc-c3b0fa04a663fe233765b83d3be41a42aa08c25d.zip |
Diffstat (limited to 'crt0.s')
-rw-r--r-- | crt0.s | 55 |
1 files changed, 55 insertions, 0 deletions
@@ -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 |