From f42e996ce245db8a558263f18761619a0b678f91 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Thu, 6 Nov 2014 00:29:17 +0000 Subject: [PATCH] msx2: various platform side and vdp fixes With these and the small core fixes to follow we blow up for reasons I don't yet understand in the uput() call in create_init. Presumably some kind of mapping setup bug. With that commented we hit the boot device request, at which point we have no keyboard. Display is still wonky. Guess it wants an MSXpert to figure out whats wrong with the 80x25 setup --- Kernel/platform-msx2/crt0.s | 7 +++++++ Kernel/platform-msx2/devtty.c | 2 +- Kernel/platform-msx2/main.c | 10 ++++++++-- Kernel/platform-msx2/msx2.s | 30 +++++++++++------------------- Kernel/platform-msx2/vdp.s | 12 ++++++++++++ 5 files changed, 39 insertions(+), 22 deletions(-) diff --git a/Kernel/platform-msx2/crt0.s b/Kernel/platform-msx2/crt0.s index 14bd2a2b..fc95c4fe 100644 --- a/Kernel/platform-msx2/crt0.s +++ b/Kernel/platform-msx2/crt0.s @@ -39,7 +39,14 @@ ; ; 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 diff --git a/Kernel/platform-msx2/devtty.c b/Kernel/platform-msx2/devtty.c index 6ff554ef..d045d553 100644 --- a/Kernel/platform-msx2/devtty.c +++ b/Kernel/platform-msx2/devtty.c @@ -161,7 +161,7 @@ static void keydecode(void) #endif -void platform_interrupt(void) +void tty_interrupt(void) { #if 0 uint8_t a = irqmap; diff --git a/Kernel/platform-msx2/main.c b/Kernel/platform-msx2/main.c index b99dbcff..3ffb499a 100644 --- a/Kernel/platform-msx2/main.c +++ b/Kernel/platform-msx2/main.c @@ -30,12 +30,18 @@ void pagemap_init(void) 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(); +} diff --git a/Kernel/platform-msx2/msx2.s b/Kernel/platform-msx2/msx2.s index 53bc3783..556c958c 100644 --- a/Kernel/platform-msx2/msx2.s +++ b/Kernel/platform-msx2/msx2.s @@ -237,10 +237,8 @@ _program_vectors: ; map_process_always: push hl - push af ld hl, #U_DATA__U_PAGE call map_process_2 - pop af pop hl ret ; @@ -251,23 +249,18 @@ map_process: 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 @@ -282,9 +275,8 @@ map_process_2: 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 @@ -292,10 +284,8 @@ map_process_2: ; map_restore: push hl - push af ld hl,#map_savearea call map_process_2 ; Put the mapper back right - pop af pop hl ret ; @@ -313,6 +303,8 @@ map_table: .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: diff --git a/Kernel/platform-msx2/vdp.s b/Kernel/platform-msx2/vdp.s index 7bb0c5b7..dcac1caf 100644 --- a/Kernel/platform-msx2/vdp.s +++ b/Kernel/platform-msx2/vdp.s @@ -16,6 +16,7 @@ .globl _vdpport .globl vdpinit + .globl platform_interrupt_all .area _CODE ; @@ -282,3 +283,14 @@ _cursor_off: .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 -- 2.34.1