changeset 3195:6eb2edad80d8

L2: Introduce symbol KrnBlk to define kernel block number This is the block number that the kernel is loaded into. This is platform-specific, a function of the behaviour of the platform MMU/DAT. CRCs are unaffected by this change.
author Neal Crook <foofoobedoo@gmail.com>
date Thu, 01 Jun 2017 22:13:49 +0100
parents 2ecebda8716b
children 1021e0cdddd6
files defs/coco.d defs/mc09.d level2/modules/kernel/ccbkrn.asm level2/modules/kernel/krn.asm level2/modules/kernel/mc09krn.asm
diffstat 5 files changed, 17 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/defs/coco.d	Tue May 30 23:59:46 2017 +0100
+++ b/defs/coco.d	Thu Jun 01 22:13:49 2017 +0100
@@ -241,7 +241,10 @@
 
 HW.Page        SET       $07                 Device descriptor hardware page
 
+* The 8K RAM block that is mapped to $E000-$FFFF and holds
+* the kernel and I/O space. Always $3F for COCO
+KrnBlk         SET       $3F
+
                ENDC
-               
-               ENDC      
+               ENDC
 
--- a/defs/mc09.d	Tue May 30 23:59:46 2017 +0100
+++ b/defs/mc09.d	Thu Jun 01 22:13:49 2017 +0100
@@ -341,6 +341,9 @@
 
 HW.Page        SET       $07                 Device descriptor hardware page
 
-               ENDC
+* The 8K RAM block that is mapped to $E000-$FFFF and holds
+* the kernel and I/O space. Always $07 for mc09
+KrnBlk         SET       $07
 
                ENDC
+               ENDC
--- a/level2/modules/kernel/ccbkrn.asm	Tue May 30 23:59:46 2017 +0100
+++ b/level2/modules/kernel/ccbkrn.asm	Thu Jun 01 22:13:49 2017 +0100
@@ -302,7 +302,7 @@
         deca                    bump counter
         bne     L00EF           loop if not done
 
-        ldu     #$003F          Block $3F is in use, at the top of system DAT image
+        ldu     #KrnBlk         Block where the kernel will live
         stu     ,x
 
         ldx     <D.Tasks        Point to task user table
@@ -323,7 +323,7 @@
         * OS9Boot it can only be loaded into block x1 through x6 and 3f so
         * we should be safe.
         ldx     <D.BlkMap       get ptr to 8k block map
-        inc     <$3F,x          mark block $3F as used (kernel)
+        inc     <KrnBlk,x       mark block holding kernel as used
         IFNE    H6309
         ldq     #$00080100      e=Marker, D=Block # to check
 L0111   asld                    get next block #
@@ -461,7 +461,7 @@
         decb                    done?
         bne     L01E1           no, keep going
         ldx     <D.BlkMap       get pointer to start of block map
-        sta     <$3f,x          mark kernel block as RAMinUse, instead of ModInBlk
+        sta     <KrnBlk,x       mark kernel block as RAMinUse, instead of ModInBlk
 S.AltIRQ        rts             return
 
 * Link module pointed to by X
--- a/level2/modules/kernel/krn.asm	Tue May 30 23:59:46 2017 +0100
+++ b/level2/modules/kernel/krn.asm	Thu Jun 01 22:13:49 2017 +0100
@@ -282,7 +282,7 @@
         deca                    bump counter
         bne     L00EF           loop if not done
 
-        ldu     #$003F          Block $3F is in use, at the top of system DAT image
+        ldu     #KrnBlk         Block where the kernel will live
         stu     ,x
 
         ldx     <D.Tasks        Point to task user table
@@ -316,7 +316,7 @@
 * Deduce how many 8Kbyte blocks of physical memory are available and
 * update the memory block map end pointer (D.BlkMap+2) accordingly
         ldx     <D.BlkMap       get ptr to 8k block map
-        inc     <$3F,x          mark block $3F as used (kernel)
+        inc     <KrnBlk,x       mark block holding kernel as used
 * This memory sizing routine uses location at X (D.BlkMap) as
 * a scratch location. At exit, it leaves this location at 1 which
 * has the (until now) undocumented side-effect of marking block 0
@@ -417,7 +417,7 @@
         decb                    done?
         bne     L01E1           no, keep going
         ldx     <D.BlkMap       get pointer to start of block map
-        sta     <$3f,x          mark kernel block as RAMinUse, instead of ModInBlk
+        sta     <KrnBlk,x       mark kernel block as RAMinUse, instead of ModInBlk
 S.AltIRQ        rts             return
 
 * Link module pointed to by X
--- a/level2/modules/kernel/mc09krn.asm	Tue May 30 23:59:46 2017 +0100
+++ b/level2/modules/kernel/mc09krn.asm	Thu Jun 01 22:13:49 2017 +0100
@@ -39,9 +39,6 @@
 MName   fcs     /Krn/
         fcb     Edition
 
-* The 8K RAM block that is mapped to $E000-$FFFF and holds
-* the kernel and I/O space. $3f for COCO, $7 for mc09.
-KrnBlk  set     $7
 
 
 * Might as well have this here as just past the end of Kernel...
@@ -310,9 +307,7 @@
         deca                    bump counter
         bne     L00EF           loop if not done
 
-* [NAC HACK 2016Dec06] on the Coco, block $3F holds the I/O space so it cannot
-* be used for anything else. Future: We can remove that restriction for mc09
-        ldu     #KrnBlk         Block $3F is in use, at the top of system DAT image
+        ldu     #KrnBlk         Block where the kernel will live
         stu     ,x
 
         ldx     <D.Tasks        Point to task user table
@@ -346,7 +341,7 @@
 * Deduce how many 8Kbyte blocks of physical memory are available and
 * update the memory block map end pointer (D.BlkMap+2) accordingly
         ldx     <D.BlkMap       get ptr to 8k block map
-        inc     <KrnBlk,x       mark block $3F as used (kernel)
+        inc     <KrnBlk,x       mark block holding kernel as used
       IFNE  mc09
         inc     <$00,x          mark block $00 as used (global memory)
 * For mc09 memory size is 512Kbyte or 1MByte. For now, hard-wire