6502: unbitrot
authorAlan Cox <alan@etchedpixels.co.uk>
Tue, 11 Nov 2014 12:37:49 +0000 (12:37 +0000)
committerAlan Cox <alan@etchedpixels.co.uk>
Tue, 11 Nov 2014 12:37:49 +0000 (12:37 +0000)
Kernel/platform-6502test/Makefile
Kernel/platform-6502test/config.h
Kernel/platform-6502test/devices.c
Kernel/platform-6502test/devrd.c
Kernel/platform-6502test/devtty.c
Kernel/platform-6502test/main.c

index a3bec2e..4996fbc 100644 (file)
@@ -23,10 +23,10 @@ clean:
        rm -f $(OBJS) $(JUNK)  core *~ 
 
 image:
-       $(CROSS_LD) -o uzi.bin --mapfile uzi.map -C ld65.cfg crt0.o commonmem.o \
+       $(CROSS_LD) -o ../fuzix.bin --mapfile ../uzi.map -C ld65.cfg crt0.o commonmem.o \
        p6502.o ../start.o ../version.o ../lowlevel-6502.o \
        tricks.o main.o ../timer.o ../kdata.o devrd.o devices.o \
        ../devio.o ../filesys.o ../process.o ../inode.o ../syscall_fs.o \
        ../syscall_proc.o ../syscall_other.o ../mm.o ../swap.o ../bank16k.o \
-       ../tty.o ../devnull.o ../devzero.o ../devproc.o ../devmem.o \
+       ../tty.o ../devsys.o ../syscall_fs2.o ../syscall_exec.o \
        ../usermem.o devlpr.o devtty.o libc.o 
index 25532a8..b82b50c 100644 (file)
@@ -15,6 +15,7 @@
 /* TODO: these need to be defined as the code to flip the banks over */
 #define BANK_PROCESS
 #define BANK_KERNEL
+#define CONFIG_BANKS   1
 
 /* We use flexible 16K banks so use the helper */
 #define CONFIG_BANK16
index 4f9e16b..c4b5286 100644 (file)
@@ -2,10 +2,7 @@
 #include <version.h>
 #include <kdata.h>
 #include <devrd.h>
-#include <devmem.h>
-#include <devzero.h>
-#include <devnull.h>
-#include <devproc.h>
+#include <devsys.h>
 #include <devlpr.h>
 #include <tty.h>
 #include <devtty.h>
@@ -14,25 +11,25 @@ struct devsw dev_tab[] =  /* The device driver switch table */
 {
 // minor    open         close        read      write       ioctl
 // -----------------------------------------------------------------
-  /* Memory disk block devices  */
-  {  0,  rd_open,     no_close,    rd_read,   rd_write,   no_ioctl },   //   0   /dev/rd0
-
-  /* devices below here are not mountable (as per NDEVS) */
-  {  0, lpr_open,     lpr_close,   no_rdwr,   lpr_write,  no_ioctl  },  //  1   /dev/lp  
-  {  0, tty_open,     tty_close,   tty_read,  tty_write,  tty_ioctl },  //  2   /dev/tty
-  {  1, tty_open,     tty_close,   tty_read,  tty_write,  tty_ioctl },  //  3   /dev/tty1
-  {  2, tty_open,     tty_close,   tty_read,  tty_write,  tty_ioctl },  //  4   /dev/tty2
-  {  0, no_open,      no_close,    null_read, null_write, no_ioctl  },  //  5   /dev/null
-  {  0, no_open,      no_close,    zero_read, no_rdwr,    no_ioctl  },  //  6   /dev/zero
-  {  0, no_open,      no_close,    mem_read,  mem_write,  no_ioctl  },  //  7   /dev/kmem
-  {  0, no_open,      no_close,    proc_read, no_rdwr, proc_ioctl}      //  8  /dev/proc
-  /* Add more tty channels here if available, incrementing minor# */
+  /* 0: /dev/fd                Floppy disc block devices  */
+  {  rd_open,     no_close,    rd_read,   rd_write,   no_ioctl },
+  /* 1: /dev/hd                Hard disc block devices (absent) */
+  {  nxio_open,     no_close,    no_rdwr,   no_rdwr,   no_ioctl },
+  /* 2: /dev/tty       TTY devices */
+  {  tty_open,     tty_close,   tty_read,  tty_write,  tty_ioctl },
+  /* 3: /dev/lpr       Printer devices */
+  {  lpr_open,     lpr_close,   no_rdwr,   lpr_write,  no_ioctl  },
+  /* 4: /dev/mem etc   System devices (one offs) */
+  {  no_open,      no_close,    sys_read, sys_write, sys_ioctl  },
+  /* Pack to 7 with nxio if adding private devices and start at 8 */
 };
 
-bool validdev(uint8_t dev)
+bool validdev(uint16_t dev)
 {
-    if(dev >= (sizeof(dev_tab)/sizeof(struct devsw)))
-        return false;
+    /* This is a bit uglier than needed but the right hand side is
+       a constant this way */
+    if(dev > ((sizeof(dev_tab)/sizeof(struct devsw)) << 8) + 255)
+       return false;
     else
         return true;
 }
index d71fe08..ddbf8b3 100644 (file)
@@ -25,7 +25,7 @@ static int rd_transfer(bool is_read, uint8_t rawflag)
             udata.u_error = EIO;
             return -1;
         }
-        block = udata.u_offset.o_blkno;
+        block = udata.u_offset >> 9;
         block_xfer = dlen >> 9;
         map = 1;
     } else { /* rawflag == 0 */
index e217f60..2abb514 100644 (file)
@@ -23,10 +23,6 @@ struct s_queue ttyinq[NUM_DEV_TTY + 1] = {   /* ttyinq[0] is never used */
        PTY_QUEUES
 };
 
-static void nap(void)
-{
-}
-
 /* tty1 is the screen tty2 is the serial port */
 
 /* Output for the system console (kprintf etc) */
@@ -46,7 +42,7 @@ bool tty_writeready(uint8_t minor)
        return c & 1;
 }
 
-void tty_putc(uint8_t minor, char c)
+void tty_putc(uint8_t minor, unsigned char c)
 {
        minor;
 #if 0
@@ -58,6 +54,18 @@ void tty_putc(uint8_t minor, char c)
        *uarta = c;
 }
 
+void tty_setup(uint8_t minor)
+{
+    minor;
+}
+
+/* For the moment */
+int tty_carrier(uint8_t minor)
+{
+    minor;
+    return 1;
+}
+
 void platform_interrupt(void)
 {
        timer_interrupt();
index eb35695..75ccedb 100644 (file)
@@ -48,3 +48,6 @@ void pagemap_init(void)
     pagemap_add(0x86);
 }
 
+void map_init(void)
+{
+}