msx2: various platform side and vdp fixes
authorAlan Cox <alan@etchedpixels.co.uk>
Thu, 6 Nov 2014 00:29:17 +0000 (00:29 +0000)
committerAlan Cox <alan@etchedpixels.co.uk>
Thu, 6 Nov 2014 00:29:17 +0000 (00:29 +0000)
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
Kernel/platform-msx2/devtty.c
Kernel/platform-msx2/main.c
Kernel/platform-msx2/msx2.s
Kernel/platform-msx2/vdp.s

index 14bd2a2..fc95c4f 100644 (file)
 ;
 ; 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
index 6ff554e..d045d55 100644 (file)
@@ -161,7 +161,7 @@ static void keydecode(void)
 
 #endif
 
-void platform_interrupt(void)
+void tty_interrupt(void)
 {
 #if 0
        uint8_t a = irqmap;
index b99dbcf..3ffb499 100644 (file)
@@ -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();
+}
index 53bc378..556c958 100644 (file)
@@ -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:
index 7bb0c5b..dcac1ca 100644 (file)
@@ -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