;
; Execution begins with us correctly mapped and at 0x0x100
;
+; We assume here that the kernel packs below 48K for now we've got a few
+; KBytes free but revisit as needed
+;
start: di
+ ld a, #4 ; 0 holds 8K of stuff we might want
+ out (0xff), a ; if we go the OS route, so use 4
+ ; plus "0" is magic so this saves
+ ; shifting them all by one.
; Debug port
ld a, #0x23
out (0x2e), a
#endif
-void platform_interrupt(void)
+void tty_interrupt(void)
{
#if 0
uint8_t a = irqmap;
int i = msxmaps - 1;
/* Add all the RAM, except 0,1,2,3 which is the kernel data/bss, add 0
last to become the common for init */
- while (i > 3)
+ while (i > 4)
pagemap_add(i--);
/* Init will pick this up correctly as its common */
- pagemap_add(0);
+ pagemap_add(4);
}
void map_init(void)
{
}
+
+
+void platform_interrupt(void)
+{
+ timer_interrupt();
+}
;
map_process_always:
push hl
- push af
ld hl, #U_DATA__U_PAGE
call map_process_2
- pop af
pop hl
ret
;
or l
jr nz, map_process_2
;
-; Map in the kernel below the current common, all registers preserved
-; This maps 0-3 but I guess we should save the map from the boot
-; somehow and use that?
+; Map in the kernel below the current common, go via the helper
+; so our cached copy is correct.
;
map_kernel:
- push af
- ld a, #3
- out (0xFC), a
- dec a
- out (0xFD), a
- dec a
- out (0xFE), a
- ; and 0xFF is managed by task switches
- pop af
- ret
+ push hl
+ ld hl, #map_kernel_data
+ call map_process_2
+ pop hl
+ ret
map_process_2:
push de
+ push af
ld de, #map_table ; Write only so cache in RAM
ld a, (hl)
ld (de), a
ld a, (hl) ; Next 16K. Leave the common for the task
out (0xFE), a ; switcher
ld (de), a
+ pop af
pop de
- ; NOTE: map_restore relies on the HL for
- ; exit of this
ret
;
; Restore a saved mapping. We are guaranteed that we won't switch
;
map_restore:
push hl
- push af
ld hl,#map_savearea
call map_process_2 ; Put the mapper back right
- pop af
pop hl
ret
;
.db 0,0,0,0
map_savearea:
.db 0,0,0,0
+map_kernel_data:
+ .db 3,2,1,4
; emulator debug port for now
outchar:
.globl _vdpport
.globl vdpinit
+ .globl platform_interrupt_all
.area _CODE
;
.area _DATA
cursorpos: .dw 0
cursorpeek: .db 0
+
+ .area _COMMONMEM
+
+;
+; FIXME: should use vdpport, but right now vdpport is in data not
+; common space.
+;
+platform_interrupt_all:
+ ld c, #0x99
+ in a, (c)
+ ret