diff options
author | Thomas Albers Raviola <thomas@thomaslabs.org> | 2025-02-12 01:27:44 +0100 |
---|---|---|
committer | Thomas Albers Raviola <thomas@thomaslabs.org> | 2025-02-12 01:27:44 +0100 |
commit | 779b9834e30de1ba0b4f0755388bebd0c45aa1dc (patch) | |
tree | 218edb656e329884e4b9cab7e84f4ba4b4af0c4a /boot/crt0.asm | |
parent | 8ac78b9953908d2a4ffece855296fb7597440cce (diff) |
Restructure rom image and use dependencies for makefiles
Diffstat (limited to 'boot/crt0.asm')
-rw-r--r-- | boot/crt0.asm | 88 |
1 files changed, 43 insertions, 45 deletions
diff --git a/boot/crt0.asm b/boot/crt0.asm index 09e4166..e7177ed 100644 --- a/boot/crt0.asm +++ b/boot/crt0.asm @@ -1,69 +1,67 @@ #include <hardware.h> - .module crt0 - .globl _main + .module crt0 + .globl _main .area _HEADER (ABS) - .org 0x8000 + .org 0x8000 start: - di - ld a, #0x80 - ld i, a - ld sp, #0x0000 - jr main - .org 0x8010 + ld a, #0x80 + ld i, a + ld sp, #0x0000 +main: + call gsinit + call _main +1$: + halt + jr 1$ + +;;; Interrupt table + .org 0x8020 _ctc0_isr_ptr:: - .dw #0 + .dw #0 _ctc1_isr_ptr:: - .dw #_ctc1_isr + .dw #0 _ctc2_isr_ptr:: - .dw #0 + .dw #0 _ctc3_isr_ptr:: - .dw #0 + .dw #0 _port_a_isr_ptr:: - .dw #0 + .dw #0 _port_b_isr_ptr:: - .dw #0 + .dw #0 _rx_isr_ptr:: - .dw #_rx_isr -main: - call gsinit - call _main -1$: - halt - jr 1$ + .dw #0 ;; Ordering of segments for the linker. .area _HOME .area _CODE .area _INITIALIZER - .area _GSINIT - .area _GSFINAL - + .area _GSINIT + .area _GSFINAL .area _DATA .area _INITIALIZED .area _BSEG - .area _BSS - .area _HEAP - - .area _CODE + .area _BSS + .area _HEAP + .area _CODE + .area _GSINIT - .area _GSINIT gsinit: ;; Default-initialized global variables. - ld bc, #l__DATA - ld a, b - or a, c - jr Z, zeroed_data - ld hl, #s__DATA - ld (hl), #0x00 - dec bc - ld a, b - or a, c - jr Z, zeroed_data - ld e, l - ld d, h - inc de - ldir + ld bc, #l__DATA + ld a, b + or a, c + jr Z, zeroed_data + ld hl, #s__DATA + ld (hl), #0x00 + dec bc + ld a, b + or a, c + jr Z, zeroed_data + ld e, l + ld d, h + inc de + ldir zeroed_data: ;; Explicitly initialized global variables. ld bc, #l__INITIALIZER @@ -75,5 +73,5 @@ zeroed_data: ldir gsinit_next: - .area _GSFINAL + .area _GSFINAL ret |