Relocated monitor to top 16k

This commit is contained in:
Joppe Blondel
2026-09-28 13:54:52 +02:00
parent bedcbfdd24
commit 53b44adcef
3 changed files with 71 additions and 24 deletions
+30 -11
View File
@@ -1,5 +1,7 @@
STACK_TOP = 0xFFFF
DELAY_LOOPS_PER_MS = 40
MONITOR_BASE = 0xC000
MONITOR_ROM_SOURCE = 0x0080
.globl _main
.globl _delay_ms
@@ -8,33 +10,49 @@ DELAY_LOOPS_PER_MS = 40
.globl _enable_interrupts
.globl _disable_interrupts
.globl _jump_to
.globl monitor_image_end
.globl s__DATA
.globl l__DATA
.globl s__INITIALIZER
.globl s__INITIALIZED
.globl l__INITIALIZER
.area _ITABLE (ABS)
.area _BOOT (ABS)
.org 0x00
jp init
jp boot_copy
.org 0x08
boot_copy:
di
ld sp, #STACK_TOP
ld hl, #MONITOR_ROM_SOURCE
ld de, #MONITOR_BASE
ld bc, #(monitor_image_end - MONITOR_BASE)
ldir
jp init
.area _ITABLE (ABS)
; The executable vector page is part of the image copied to high RAM.
.org MONITOR_BASE
jp init
.org MONITOR_BASE + 0x08
reti
.org 0x10
.org MONITOR_BASE + 0x10
reti
.org 0x18
.org MONITOR_BASE + 0x18
reti
.org 0x20
.org MONITOR_BASE + 0x20
reti
.org 0x28
.org MONITOR_BASE + 0x28
reti
.org 0x30
.org MONITOR_BASE + 0x30
reti
.org 0x38
.org MONITOR_BASE + 0x38
reti
; ITABLE
.org 0x40
; IM 2 table: the CTC supplies vectors 40, 42, 44, and 46.
.org MONITOR_BASE + 0x40
.dw ctc_isr ; CTC channel 0: vector 0x40
.dw ctc_isr ; CTC channel 1: vector 0x42
.dw ctc_isr ; CTC channel 2: vector 0x44
@@ -48,7 +66,7 @@ init:
call gsinit
; Setup interrupt mode 2
xor a
ld a, #0xC0
ld i, a
im 2
call _main
@@ -88,6 +106,7 @@ clear_loop:
gsinit_done:
.area _GSFINAL
ret
monitor_image_end:
.area _CODE