-TARGET_LIST = platform-nc100 platform-micropack platform-pcw8256 platform-socz80 platform-spec3 platform-trs80 platform-z80pack platform-z80pack-lite
+TARGET_LIST = platform-nc100 platform-micropack platform-pcw8256 platform-socz80 platform-zx128 platform-trs80 platform-z80pack platform-z80pack-lite
-export TARGET= msx2
-export CPU = z80
-#export TARGET = 6809test
-#export CPU = 6809
+#export TARGET= zx128
+#export CPU = z80
+export TARGET = 6809test
+export CPU = 6809
#export TARGET = 6502test
#export CPU = 6502
export VERSION = "0.1"
#export CROSS_CCOPTS=-Wall -O2 -I$(ROOT_DIR)/cpu-6809 -I$(ROOT_DIR)/platform-$(TARGET) -I$(ROOT_DIR)/include
export CROSS_CCOPTS=-c -Wall -O2 -I$(ROOT_DIR)/cpu-6809 -I$(ROOT_DIR)/platform-$(TARGET) -I$(ROOT_DIR)/include
export ASOPTS=
+export BINEXT = .o
endif
ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
tools/binman uzi.tmp uzi.map fuzix.bin
$(MAKE) -C platform-$(TARGET) image
else
-uzi.bin: target $(OBJS)
+fuzix.bin: target $(OBJS)
$(MAKE) -C platform-$(TARGET) image
endif
bool validdev(uint16_t dev);
/* usermem.c */
-usize_t valaddr(char *base, usize_t size);
+usize_t valaddr(const char *base, usize_t size);
int uget(const void *userspace_source, void *dest, usize_t count);
int16_t ugetc(const void *userspace_source);
uint16_t ugetw(const void *userspace_source);
int stcpy(inoptr ino, char *buf);
bool rargs (char **userspace_argv, struct s_argblk *argbuf);
char **wargs(char *userspace_ptr, struct s_argblk *argbuf, int *cnt);
-extern int unlinki(inoptr ino, inoptr pino, char *fname);
+extern int16_t unlinki(inoptr ino, inoptr pino, char *fname);
/* timer.c */
void rdtime(time_t *tloc);
$(CROSS_CC) $(CROSS_CCOPTS) -c $<
$(AOBJS): %$(BINEXT): %.s
- $(CROSS_AS) $(ASOPTS) $< -o $*$(BINEXT)
+ $(CROSS_AS) $(ASOPTS) $< -o $*.o
clean:
rm -f $(OBJS) $(JUNK) core *~
image:
- $(CROSS_LD) -o uzi.bin --map uzi.map -nostdlib crt0.o commonmem.o \
+ $(CROSS_LD) -o ../fuzix.bin --map ../uzi.map -nostdlib crt0.o commonmem.o \
p6809.o ../start.o ../version.o ../lowlevel-6809.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 ../usermem.o ../syscall_fs2.o \
../usermem_std-6809.o devlpr.o devtty.o libc.o
#define BANK_KERNEL *((volatile uint8_t *)0xff91) |= 1
/* We use flexible 16K banks so use the helper */
#define CONFIG_BANK16
+#define CONFIG_BANKS 4
#define MAX_MAPS 16
/* And swapping */
#define SWAPDEV 6 /* FIXME */
#define PROGBASE ((char *)(0x0100)) /* also data base */
#define PROGTOP ((char *)(0xF000)) /* Top of program, base of U_DATA */
-#define BOOT_TTY 3 /* Set this to default device for stdio, stderr */
+#define BOOT_TTY (512 + 1) /* Set this to default device for stdio, stderr */
/* In this case, the default is the first TTY device */
/* Temp FIXME set to serial port for debug ease */
#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>
{
// 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;
}
-
void device_init(void)
{
}
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 */
return c & 1;
}
-void tty_putc(uint8_t minor, char c)
+void tty_putc(uint8_t minor, unsigned char c)
{
minor;
#if 0
*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();
pagemap_add(0x86);
}
+void map_init(void)
+{
+}
swapmap[swapptr++] = swap;
}
-static int swapread(uint16_t dev, blkno_t blkno, unsigned int nbytes, char *buf)
+static int swapread(uint16_t dev, blkno_t blkno, unsigned int nbytes,
+ uint8_t *buf)
{
swapbase = buf;
swapcnt = nbytes;
static int swapwrite(uint16_t dev, blkno_t blkno, unsigned int nbytes,
- char *buf)
+ uint8_t *buf)
{
swapbase = buf;
swapcnt = nbytes;
#include <printf.h>
/* This checks to see if a user-supplied address is legitimate */
-usize_t valaddr(char *base, usize_t size)
+usize_t valaddr(const char *base, usize_t size)
{
if (base < (char *)PROGBASE || base + size < base)
size = 0;
{
uint8_t tmp;
while(count--) {
- tmp = *source++
+ tmp = *source++;
BANK_PROCESS;
*user++ = tmp;
BANK_KERNEL;