From 019759db9d8377655eb266a26268509bae0ca1ce Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Sat, 1 Nov 2014 15:38:06 +0000 Subject: [PATCH] px4plus: Add initial (untested) video, and adjust memory maps etc Add an init.c for code we can discard. --- Kernel/platform-px4plus/Makefile | 18 +++++++++++++++--- Kernel/platform-px4plus/config.h | 15 ++++++++++++++- Kernel/platform-px4plus/crt0.s | 12 ++++++------ Kernel/platform-px4plus/devices.c | 8 -------- Kernel/platform-px4plus/devtty.c | 5 +++-- Kernel/platform-px4plus/init.c | 17 +++++++++++++++++ Kernel/platform-px4plus/px4plus.s | 2 ++ Kernel/platform-px4plus/uzi.lnk | 8 +++++++- 8 files changed, 64 insertions(+), 21 deletions(-) create mode 100644 Kernel/platform-px4plus/init.c diff --git a/Kernel/platform-px4plus/Makefile b/Kernel/platform-px4plus/Makefile index cdbf5301..068d17bd 100644 --- a/Kernel/platform-px4plus/Makefile +++ b/Kernel/platform-px4plus/Makefile @@ -1,13 +1,19 @@ CSRCS = devlpr.c devtty.c devfd.c -CSRCS += devices.c main.c +CSRCS += devices.c -ASRCS = crt0.s px4plus.s +CCSRCS = main.c + +CDSRCS = init.c + +ASRCS = crt0.s px4plus.s video.s ASRCS += tricks.s commonmem.s COBJS = $(CSRCS:.c=.rel) +CCOBJS = $(CCSRCS:.c=.rel) +CDOBJS = $(CDSRCS:.c=.rel) AOBJS = $(ASRCS:.s=.rel) -OBJS = $(COBJS) $(AOBJS) +OBJS = $(COBJS) $(CCOBJS) $(CDOBJS) $(AOBJS) JUNK = $(CSRCS:.c=.lst) $(CSRCS:.c=.asm) $(CSRCS:.c=.sym) $(ASRCS:.s=.lst) $(ASRCS:.s=.sym) $(CSRCS:.c=.rst) $(ASRCS:.s=.rst) @@ -16,6 +22,12 @@ all: $(OBJS) $(COBJS): %.rel: %.c $(CROSS_CC) $(CROSS_CCOPTS) -c $< +$(CCOBJS): %.rel: %.c + $(CROSS_CC) $(CROSS_CCOPTS) -c --codeseg COMMONMEM $< + +$(CDOBJS): %.rel: %.c + $(CROSS_CC) $(CROSS_CCOPTS) -c --codeseg DISCARD $< + $(AOBJS): %.rel: %.s $(CROSS_AS) $(ASOPTS) $< diff --git a/Kernel/platform-px4plus/config.h b/Kernel/platform-px4plus/config.h index 264ad1ab..bf0b80e6 100644 --- a/Kernel/platform-px4plus/config.h +++ b/Kernel/platform-px4plus/config.h @@ -8,6 +8,12 @@ #define CONFIG_MULTI /* Single tasking */ #undef CONFIG_SINGLETASK +/* Video terminal, not a serial tty */ +#define CONFIG_VT +/* We want the 8x8 font for now (actually we want 6x8) */ +#define CONFIG_FONT8X8 +/* And we only want 128 symbols of it (1K) for now */ +#define CONFIG_FONT8X8SMALL /* CP/M emulation */ #undef CONFIG_CPM_EMU /* Fixed banking */ @@ -26,7 +32,7 @@ timer available, so needs some tweaking */ #define TICKSPERSEC 100 /* Ticks per second */ #define PROGBASE ((char *)(0x0100)) /* also data base */ -#define PROGTOP ((char *)(0x7D00)) /* Top of program, base of U_DATA */ +#define PROGTOP ((char *)(0x4000)) /* Top of program for debug */ #define SWAP_SIZE 0x40 /* 32K in blocks (we actually don't need the low 256) */ #define SWAPBASE 0x0000 /* We swap the lot in one, include the */ @@ -47,3 +53,10 @@ #define NBUFS 6 /* Number of block buffers */ #define NMOUNTS 2 /* Number of mounts at a time */ +#define VT_WIDTH 30 +#define VT_HEIGHT 8 +#define VT_RIGHT 29 +#define VT_BOTTOM 7 + + +#define PFTABSIZE 4 /* All we have room for right now */ diff --git a/Kernel/platform-px4plus/crt0.s b/Kernel/platform-px4plus/crt0.s index 30dccdbb..d559e89e 100644 --- a/Kernel/platform-px4plus/crt0.s +++ b/Kernel/platform-px4plus/crt0.s @@ -15,22 +15,22 @@ .area _BSEG .area _BSS .area _HEAP - ; note that areas below here may be overwritten by the heap at runtime, so - ; put initialisation stuff in here - .area _INITIALIZER .area _GSINIT .area _GSFINAL .area _DISCARD .area _UDATA + ; This is fixed up by the compile tool but we need it somewhere + ; so the copier can fix it up ! + .area _INITIALIZER + + .area _FONT + .area _VIDEO ; imported symbols .globl _fuzix_main .globl init_early .globl init_hardware - .globl s__INITIALIZER - .globl s__COMMONMEM - .globl l__COMMONMEM .globl s__DATA .globl l__DATA .globl kstack_top diff --git a/Kernel/platform-px4plus/devices.c b/Kernel/platform-px4plus/devices.c index 2c004595..87a2f8bf 100644 --- a/Kernel/platform-px4plus/devices.c +++ b/Kernel/platform-px4plus/devices.c @@ -35,14 +35,6 @@ bool validdev(uint16_t dev) return true; } -void device_init(void) -{ - int i; - /* Add 4 swaps (128K) to use the entire RAM drive */ - for (i = 0; i < MAX_SWAPS; i++) - swapmap_add(i); -} - __sfr __at 0x19 ioctrlr; /* FIXME: find correct initial value */ diff --git a/Kernel/platform-px4plus/devtty.c b/Kernel/platform-px4plus/devtty.c index 074bfc3f..16cfe7a3 100644 --- a/Kernel/platform-px4plus/devtty.c +++ b/Kernel/platform-px4plus/devtty.c @@ -3,6 +3,7 @@ #include #include #include +#include #include /* Console is only port we provide, port 2 there but used for floppies */ @@ -31,8 +32,8 @@ static bool tty_writeready(uint8_t minor) void tty_putc(uint8_t minor, unsigned char c) { - minor;c; - /* Fixme: wire in VT code */ + minor; + vtoutput(&c, 1); } void tty_setup(uint8_t minor) diff --git a/Kernel/platform-px4plus/init.c b/Kernel/platform-px4plus/init.c new file mode 100644 index 00000000..b0c4623c --- /dev/null +++ b/Kernel/platform-px4plus/init.c @@ -0,0 +1,17 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void device_init(void) +{ + int i; + /* Add 4 swaps (128K) to use the entire RAM drive */ + for (i = 0; i < MAX_SWAPS; i++) + swapmap_add(i); +} diff --git a/Kernel/platform-px4plus/px4plus.s b/Kernel/platform-px4plus/px4plus.s index c5405348..6077976c 100644 --- a/Kernel/platform-px4plus/px4plus.s +++ b/Kernel/platform-px4plus/px4plus.s @@ -31,6 +31,7 @@ ; imported symbols .globl _ramsize .globl _procmem + .globl _vtinit .globl unix_syscall_entry .globl null_handler @@ -85,6 +86,7 @@ init_hardware: ld a, #0xB ; OVF (timer), RXRDY (gapnio), 7508 out (0x04), a + call _vtinit im 1 ; set CPU interrupt mode ret diff --git a/Kernel/platform-px4plus/uzi.lnk b/Kernel/platform-px4plus/uzi.lnk index 6923d9de..0a99a7b6 100644 --- a/Kernel/platform-px4plus/uzi.lnk +++ b/Kernel/platform-px4plus/uzi.lnk @@ -1,9 +1,11 @@ -mwxuy -i uzi.ihx --b _DISCARD=0x5000 +-b _DISCARD=0x4000 -b _UDATA=0xFD00 -b _CODE=0x6000 -b _DATA=0xE000 +-b _FONT=0x5000 +-b _INITIALIZER=0x3000 -k /usr/share/sdcc/lib/z80 -l z80 platform-px4plus/crt0.rel @@ -34,4 +36,8 @@ swap.rel devsys.rel platform-px4plus/devlpr.rel platform-px4plus/devtty.rel +vt.rel +font8x8.rel +platform-px4plus/video.rel +platform-px4plus/init.rel -e -- 2.34.1