msx2: RAM fixup
authorAlan Cox <alan@etchedpixels.co.uk>
Mon, 3 Nov 2014 21:55:00 +0000 (21:55 +0000)
committerAlan Cox <alan@etchedpixels.co.uk>
Mon, 3 Nov 2014 21:55:00 +0000 (21:55 +0000)
Apparently RAM is added in the reverse order to tht expected - 3 is at 0x000
2 is at 0x4000 etc. Add them properly then add 0 so that init picks up the
initial 0xC000 bank for common and udata

Kernel/platform-msx2/main.c
Kernel/platform-msx2/msx2.s

index 57c2b4b..424870f 100644 (file)
@@ -25,10 +25,12 @@ void do_beep(void)
 void pagemap_init(void)
 {
     int i = /*FIXME*/ 16; /* in 16K banks */
-    /* Add all the RAM, except 0,1,2 , which is the kernel data/bss, add 3
+    /* 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 > 0)
+    while (i > 3)
         pagemap_add(i--);
+    /* Init will pick this up correctly as its common */
+    pagemap_add(0);
 }
 
 void map_init(void)
index 1609ecb..99ab0b0 100644 (file)
@@ -159,14 +159,13 @@ map_process:
 ;
 map_kernel:
            push af
-           xor a
+           ld a, #3
            out (0xFC), a
-           inc a
+           dec a
            out (0xFD), a
-           inc a
+           dec a
            out (0xFE), a
-           inc a
-           out (0xFF), a
+           ; and 0xFF is managed by task switches
            pop af
             ret
 map_process_2: