summaryrefslogtreecommitdiff
path: root/crt0.asm
diff options
context:
space:
mode:
authorThomas Guillermo Albers Raviola <thomas@thomaslabs.org>2025-10-04 20:52:39 +0200
committerThomas Guillermo Albers Raviola <thomas@thomaslabs.org>2025-10-04 20:52:39 +0200
commit38427060c8f781589d7f78148cf6204b97f20d4b (patch)
treeb6ae2ceb4907a02bf7aaef814b539ffd4b421692 /crt0.asm
parent3c1c8415713f80cd0919f7bd5244d292f1c3cfe1 (diff)
Restructure projectHEADmaster
Diffstat (limited to 'crt0.asm')
-rw-r--r--crt0.asm93
1 files changed, 0 insertions, 93 deletions
diff --git a/crt0.asm b/crt0.asm
deleted file mode 100644
index 567ab47..0000000
--- a/crt0.asm
+++ /dev/null
@@ -1,93 +0,0 @@
-#include <zeta.h>
-
- .module crt0
- .globl _main
-
- .area _HEADER (ABS)
- ;; Reset vector
- .org 0x0000
- ld SP, #0x00
- xor A
- ld I, A
- jp init
- ;; ISR table
- .org 0x0010
-_ctc0_isr_ptr:
- .dw #0
-_ctc1_isr_ptr:
- .dw #0
-_ctc2_isr_ptr:
- .dw #0
- .globl _ctc3_isr_ptr
-_ctc3_isr_ptr:
- .dw #_ctc3_isr
- .globl _rx_isr_ptr
-_rx_isr_ptr:
- .dw #_rx_isr
- ;; Init code
-init:
- xor A
- ;; Enable extended memory
- out (WIN_0_CTRL), A
- ld A, #0b00100000
- out (WIN_1_CTRL), A
- ld A, #0b01000000
- out (WIN_2_CTRL), A
- ld A, #0b01100000
- out (WIN_3_CTRL), A
-
- ld A, #SREG_EXT_MEM
- out (SREG_CTRL), A
-
- call gsinit
- call _main
-1$:
- halt
- jr 1$
-
- ;; 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
-
- .area _CODE
-
- .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
-zeroed_data:
- ;; Explicitly initialized global variables.
- 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