pcw8256: further update/work
authorAlan Cox <alan@linux.intel.com>
Sun, 15 Apr 2018 13:47:10 +0000 (14:47 +0100)
committerAlan Cox <alan@linux.intel.com>
Sun, 15 Apr 2018 13:47:10 +0000 (14:47 +0100)
Still need to tackle the rest of the bootloader and the fork bug

Kernel/platform-pcw8256/Makefile
Kernel/platform-pcw8256/README
Kernel/platform-pcw8256/config.h
Kernel/platform-pcw8256/devinput.c
Kernel/platform-pcw8256/devtty.c
Kernel/platform-pcw8256/devtty.h
Kernel/platform-pcw8256/fuzix.lnk
Kernel/platform-pcw8256/kernel.def

index 98c16b7..f7af323 100644 (file)
@@ -5,6 +5,8 @@ CSRCS += devices.c main.c
 DSRCS = ../dev/devide.c ../dev/blkdev.c ../dev/mbr.c
 DISCARD_DSRCS = ../dev/devide_discard.c
 
+NSRCS = ../dev/net/net_native.c
+
 CROSS_CCOPTS += -I ../dev/
 
 ASRCS =  crt0.s commonmem.s pcw8256.s
@@ -14,8 +16,9 @@ COBJS = $(CSRCS:.c=.rel)
 AOBJS = $(ASRCS:.s=.rel)
 DISCARD_DOBJS = $(patsubst ../dev/%.c,%.rel, $(DISCARD_DSRCS))
 DOBJS = $(patsubst ../dev/%.c,%.rel, $(DSRCS))
+NOBJS = $(patsubst ../dev/net/%.c,%.rel, $(NSRCS))
 
-OBJS  = $(COBJS) $(AOBJS) $(DOBJS) $(DISCARD_DOBJS)
+OBJS  = $(COBJS) $(AOBJS) $(DOBJS) $(DISCARD_DOBJS) $(NOBJS)
 
 JUNK = $(CSRCS:.c=.lst) $(CSRCS:.c=.asm) $(CSRCS:.c=.sym) $(ASRCS:.s=.lst) $(ASRCS:.s=.sym) $(CSRCS:.c=.rst) $(ASRCS:.s=.rst)
 
@@ -33,6 +36,9 @@ $(DOBJS): %.rel: ../dev/%.c
 $(DISCARD_DOBJS): %.rel: ../dev/%.c
        $(CROSS_CC) $(CROSS_CCOPTS) $(CROSS_CC_SEGDISC) -c $<
 
+$(NOBJS): %.rel: ../dev/net/%.c
+       $(CROSS_CC) $(CROSS_CCOPTS) -c $<
+
 clean:
        rm -f $(OBJS) $(JUNK)  core *~ 
 
index 61c57e8..55f1471 100644 (file)
@@ -75,24 +75,19 @@ The roller RAM must also be within the low 128K and is 512 bytes.
 The keyboard magically replaces the top 16 bytes of bank 3.
 
 Our loader puts the screen into bank 4 and bank 5 (part of), then loads the
-OS into bank 0/1/2/3. We really need to rearrange this so we set the
-final kernel map as something like
+OS into bank 0/1/2/3.
 
-0 1 3 5 (4 is display in map)
+Other work needed here is to put the buffer cache at the end followed by the
+font data if we do it this way, then discard. At that point we can move the
+font into video mappings.
 
-except that means we must field a hole between BFF0 (keyboard) and Cxxx (
-display). We then end up with a map of
+Right now bank 0-3 are fully used if we do the buffer reclaim (which gets us
+a nice 12 or so extra buffers), bank 4 is all video and bank 5 would have
+5K left after the fonts.  An obvious use for that would be to go to 256
+byte tty queues and add ptys - (costing us about 3K)
 
-0000-0087      Boot loader
-0088-BFEF      Kernel image
-BFF0-BFFF      Keyboard
-C000-D9FF      Video (lower window)
-DA00-DBFF      Roller map
-DC00-E3FF      Font
-E400-...       Video
-... -FFFF      Common
+Other candidates would be the low level graphics rendering routines as we'll
+want those for a graphics mode (or we need to support an mmap like mode for
+direct mapping a 16K graphics window over the app memory)
 
-Whilst doing video we map over 8000-BFFF and rely upon the video and common
-mappings
 
-That leaves bank 2, 6+ for userspace (kernel + video costs us 80K)
index 7224adc..d88ceab 100644 (file)
 #define CONFIG_INPUT_GRABMAX 2 /* We could in theory do full up/down but later */
 #define MAX_BLKDEV     1       /* UIDE or FIDHD never both */
 #define CONFIG_IDE     /* Has an IDE controller - maybe anyway: UIDE */
+#define CONFIG_NET
 
 #define TICKSPERSEC 50   /* Ticks per second */
 #define PROGBASE    0x0000     /* memory base of program */
 #define PROGLOAD    0x0100     /* load base of program */
-#define PROGTOP     0xF000     /* Top of program, base of U_DATA */
+#define PROGTOP     0xF400     /* Top of program, base of U_DATA */
 
 #define SWAP_SIZE   0x80       /* 64K in blocks (we actually don't need all of it FIXME) */
 #define SWAPBASE    ((uint16_t)0x0000) /* We swap the lot in one, include the */
-#define SWAPTOP            0xF400      /* vectors. We have to swap 256 bytes of
+#define SWAPTOP            0xF800      /* vectors. We have to swap 256 bytes of
                                    common as well */
 
 #define BOOT_TTY       (512 + 1)
@@ -52,8 +53,6 @@
 
 /* Device parameters */
 #define NUM_DEV_TTY 3
-#define NDEVS    16       /* Devices 0..NDEVS-1 are capable of being mounted */
-                          /*  (add new mountable devices to beginning area.) */
 #define TTYDEV   BOOT_TTY /* Device used by kernel for messages, panics */
 #define SWAPDEV  5       /* Device for swapping. */
 #define NBUFS    6        /* Number of block buffers */
index 94c2162..64b9e62 100644 (file)
@@ -12,7 +12,9 @@ __sfr __at 0xD0 kemp_x;
 __sfr __at 0xD1 kemp_y;
 __sfr __at 0xD4 kemp_button;
 
-static uint8_t has_amx, has_kemp;
+__sfr __at 0x9F kemp_js;
+
+static uint8_t has_amx, has_kemp, has_kempjs;
 static uint8_t okx, oky;
 
 static char buf[32];
@@ -51,11 +53,11 @@ int platform_input_read(uint8_t *slot)
        return 2;
     }
     if (has_amx) {
-        *slot++ = MOUSE_REL|BUTTONS(2);
+        *slot++ = MOUSE_REL|BUTTON(3);
         r = amx_v;
         *slot++ = (r >> 4) - (r & 0x0F);
         *slot++ = (r & 0x0F) - (r >> 4);
-        *slot++ = amx_button & 3;
+        *slot++ = ~amx_button & 7;
         return 4;
     }
     if (has_kemp) {
@@ -66,11 +68,28 @@ int platform_input_read(uint8_t *slot)
         *slot++ = delta(oky, ky);
         /* Need to think about this eg 0xF0 -> 0x0F is a positive move
            of 0x1F while 0x0F->0xF0 is a negative move of 0x1F */
-        *slot++ = kemp_button;
+        *slot++ = ~kemp_button & 3;
         oky = ky;
         okx = kx;
         return 4;
     }
+    if (has_kempjs) {
+        uint8_t v = 0;
+        r = kemp_js;
+        if (r & 1)
+            v = STICK_DIGITAL_R;
+        if (r & 2)
+            v = STICK_DIGITAL_L;
+        if (r & 4)
+            v = STICK_DIGITAL_U;
+        if (r & 8)
+            v = STICK_DIGITAL_D;
+        if (r & 16)
+            v |= BUTTON(0);
+        *slot++ = STICK_DIGITAL;
+        *slot++ = v;
+        return 2;
+    }
     return 0;
 }
 
@@ -98,6 +117,7 @@ int platform_input_write(uint8_t flag)
 
 uint8_t platform_input_init(void)
 {
+    /* Kempston or AMS mice - don't support both at once */
     if (kemp_x != 0xFF || kemp_y != 0xFF || kemp_button != 0xFF)
         has_kemp = 1;
     else if (amx_ctrl != 0xFF && amx_button != 0x10) {
@@ -105,7 +125,10 @@ uint8_t platform_input_init(void)
         amx_button = 0xFF;
         amx_button = 0x00;
         has_amx = 1;
-    } else
-        return 0;
-    return 1;
+    }
+    /* Could also have a keymouse */
+    /* Kempston Joystick */
+    if ((kemp_js & 0x80) == 0)
+        has_kempjs = 1;
+    /* TODO: DkTronics sound card has a joystick port too */
 }
index 0940670..ed6f5a0 100644 (file)
@@ -200,7 +200,7 @@ static void keyproc(void)
        }
 }
 
-uint8_t keyboard[12][8] = {
+const uint8_t keyboard[12][8] = {
        {'2', '3', '6', '9', KEY_PASTE ,KEY_F1, '0', KEY_F3},
        {'1', '5', '4', '8', KEY_COPY, KEY_CUT, KEY_PRINT, KEY_EXIT},
        {KEY_PLUS, KEY_HALF, 0, '7', '#', 13, ']', KEY_DELR},
@@ -215,7 +215,7 @@ uint8_t keyboard[12][8] = {
        {0, 0, 0, 0, 0, 0, 0, 0}        /* FIXME: js 2 */
 };
 
-uint8_t shiftkeyboard[12][8] = {
+const uint8_t shiftkeyboard[12][8] = {
        {'2', '3', '6', '9', KEY_PASTE, KEY_F2, '0', KEY_F4},
        {'1', '5', '4', '8', KEY_COPY, KEY_CUT, KEY_PRINT, KEY_EXIT},
        {KEY_PLUS, '@', 0, '7', '>', 13, '}', KEY_DELR},
index 7bbe65c..35d6d3e 100644 (file)
@@ -8,7 +8,7 @@ void tty_irq(void);
 #define KEY_ROWS       12
 #define KEY_COLS       8
 extern uint8_t keymap[12];
-extern uint8_t keyboard[12][8];
-extern uint8_t shiftkeyboard[12][8];
+extern const uint8_t keyboard[12][8];
+extern const uint8_t shiftkeyboard[12][8];
 
 #endif
index 4fadff7..87f3e6b 100644 (file)
@@ -1,8 +1,8 @@
 -mwxuy
 -i fuzix.ihx
 -b _CODE=0x0000
--b _COMMONMEM=0xF000
--b _DISCARD=0xE000
+-b _COMMONMEM=0xF400
+-b _DISCARD=0xE800
 -l z80
 platform-pcw8256/crt0.rel
 platform-pcw8256/commonmem.rel
@@ -29,6 +29,7 @@ syscall_fs2.rel
 syscall_fs3.rel
 syscall_proc.rel
 syscall_other.rel
+syscall_net.rel
 tty.rel
 mm.rel
 bank16k.rel
@@ -46,5 +47,5 @@ platform-pcw8256/devide_discard.rel
 platform-pcw8256/devfhd.rel
 platform-pcw8256/fidhd.rel
 platform-pcw8256/devinput.rel
-
+platform-pcw8256/net_native.rel
 -e
index 11a5b6e..884b035 100644 (file)
@@ -1,6 +1,6 @@
 ; UZI mnemonics for memory addresses etc
 
-U_DATA                      .equ 0xF000       ; (this is struct u_data from kernel.h)
+U_DATA                      .equ 0xF400       ; (this is struct u_data from kernel.h)
 U_DATA__TOTALSIZE           .equ 0x300        ; 256+256+256 bytes.
 
 Z80_TYPE                   .equ 0            ; FIXME: check