From 54ea71cf1e47a8c120bd1d12b0e597c445c04817 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Fri, 7 Sep 2018 22:10:53 +0100 Subject: [PATCH] plato: Add a plato terminal implementation for Fuzix Lots of clean up needed from the hacked version of Thom's code --- Applications/plato/Makefile.r2k | 1 + Applications/plato/Makefile.z80 | 17 +++++-------- Applications/plato/NOTES | 9 +++---- Applications/plato/fuzix/keyboard.c | 1 + Applications/plato/io_base.c | 2 +- Applications/plato/screen_base.c | 38 ----------------------------- 6 files changed, 13 insertions(+), 55 deletions(-) create mode 100644 Applications/plato/Makefile.r2k diff --git a/Applications/plato/Makefile.r2k b/Applications/plato/Makefile.r2k new file mode 100644 index 00000000..218ab89e --- /dev/null +++ b/Applications/plato/Makefile.r2k @@ -0,0 +1 @@ + include Makefile.z80 diff --git a/Applications/plato/Makefile.z80 b/Applications/plato/Makefile.z80 index e1067968..dd2d980a 100644 --- a/Applications/plato/Makefile.z80 +++ b/Applications/plato/Makefile.z80 @@ -6,8 +6,8 @@ COPT = $(FUZIX_CCOPTS) SRCS = io_base.c keyboard_base.c plato.c protocol.c screen_base.c terminal.c \ touch_base.c -FSRCS = font.c io.c keyboard.c scale.c screen.c splash.c \ - terminal_char_load.c touch.c +FSRCS = fuzix/font.c fuzix/io.c fuzix/keyboard.c fuzix/scale.c fuzix/screen.c \ + fuzix/splash.c fuzix/terminal_char_load.c fuzix/touch.c INC = io.h keyboard.h plato_key.h protocol.h screen.h terminal.h touch.h @@ -17,19 +17,14 @@ OBJS = $(SRCS:.c=.rel) FOBJS = $(patsubst fuzix/%.c,%.rel, $(FSRCS)) plato: $(OBJS) $(FOBJS) - $(CC) -o plato --nostdio $(OBJS) $(FOBJS) + $(CC) -o plato $(OBJS) $(FOBJS) -$(OBJS):.c.rel: +$(OBJS): %.rel: %.c $(CC) $(COPT) $(CFLAGS) -c $< -o $@ -$(FOBJS):.c.rel: +$(FOBJS): %.rel: fuzix/%.c $(CC) $(COPT) $(CFLAGS) -c $< -o $@ - -$(OBJS) : $(INC) - -$(FOBJS) : $(INC) - clean: rm -f *.o *.rel *.lst *.sym *.asm *.map *.noi *.lk *.bin *~ plato - (cd fuzix; rm -f *.o *.rel *.lst *.sym *.asm *.map *.noi *.lk *.bin *~ ) \ No newline at end of file + (cd fuzix; rm -f *.o *.rel *.lst *.sym *.asm *.map *.noi *.lk *.bin *~ ) diff --git a/Applications/plato/NOTES b/Applications/plato/NOTES index 68a17660..3057702a 100644 --- a/Applications/plato/NOTES +++ b/Applications/plato/NOTES @@ -1,11 +1,10 @@ Implement -- Fix up our output code to buffer into a 256 byte buffer -- Keep shovelling every tick -- Set the tty up and atexit properly -- Block all the signals we don't want (inc PIPE) - Actually look up the address properly -- Get the splash screen off disk instead +- Get the splash screen off disk instead? +- A correct flash screen + +Make it a lot faster It would be nice to squash it to the point we can afford 576 byte I/O buffers diff --git a/Applications/plato/fuzix/keyboard.c b/Applications/plato/fuzix/keyboard.c index 43b8dc1c..16d47e47 100644 --- a/Applications/plato/fuzix/keyboard.c +++ b/Applications/plato/fuzix/keyboard.c @@ -31,6 +31,7 @@ void keyboard_main(void) { uint8_t ch; + fflush(stdout); switch (read(0, &ch, 1)) { case 0: return; diff --git a/Applications/plato/io_base.c b/Applications/plato/io_base.c index 00357453..9a2c5a70 100644 --- a/Applications/plato/io_base.c +++ b/Applications/plato/io_base.c @@ -54,7 +54,7 @@ void io_init(void) */ void io_main(void) { - char buf[256]; + char buf[576]; int l; /* The OS does our buffering (badly or not varies) */ diff --git a/Applications/plato/screen_base.c b/Applications/plato/screen_base.c index 133701f4..3fb6f8d6 100644 --- a/Applications/plato/screen_base.c +++ b/Applications/plato/screen_base.c @@ -22,10 +22,8 @@ uint8_t pal[2]; extern padBool FastText; /* protocol.c */ -#ifndef __ATARI__ extern unsigned short scalex[]; extern unsigned short scaley[]; -#endif extern uint8_t font[]; extern uint8_t fontm23[]; @@ -33,15 +31,6 @@ extern uint16_t fontptr[]; extern uint8_t FONT_SIZE_X; extern uint8_t FONT_SIZE_Y; -extern void (*io_recv_serial_flow_on)(void); -extern void (*io_recv_serial_flow_off)(void); - -// Atari uses fast frac multiplies to save memory -#ifdef __ATARI__ -extern uint16_t mul0625(uint16_t val); -extern uint16_t mul0375(uint16_t val); -#endif - /* * Silly functions to get us going */ @@ -76,7 +65,6 @@ static void tgi_setpixel(int x, int y) { printf("\033[%d;%dH%c", y, x, " #"[pen]); // printf("[%d,%d->%d]", x, y, pen); - fflush(stdout); } static void tgi_bar(int x1, int y1, int x2, int y2) @@ -91,7 +79,6 @@ static void tgi_bar(int x1, int y1, int x2, int y2) for(x = x1; x < x2; x++) putchar(' '); } - fflush(stdout); // printf("[R %d,%d,%d,%d->%d]", x1, y1, x2,y2, pen); } @@ -143,12 +130,7 @@ void screen_block_draw(padPt* Coord1, padPt* Coord2) else tgi_setcolor(1); -#ifdef __ATARI__ - tgi_bar(mul0625(Coord1->x),mul0375(Coord1->y^0x1FF),mul0625(Coord2->x),mul0375(Coord2->y^0x1FF)); -#else tgi_bar(scalex[Coord1->x],scaley[Coord1->y],scalex[Coord2->x],scaley[Coord2->y]); -#endif - } /** @@ -160,11 +142,7 @@ void screen_dot_draw(padPt* Coord) tgi_setcolor(0); else tgi_setcolor(1); -#ifdef __ATARI__ - tgi_setpixel(mul0625(Coord->x),mul0375(Coord->y^0x1FF)); -#else tgi_setpixel(scalex[Coord->x],scaley[Coord->y]); -#endif } /** @@ -172,17 +150,10 @@ void screen_dot_draw(padPt* Coord) */ void screen_line_draw(padPt* Coord1, padPt* Coord2) { -#ifdef __ATARI__ - uint16_t x1=mul0625(Coord1->x); - uint16_t x2=mul0625(Coord2->x); - uint16_t y1=mul0375(Coord1->y^0x1FF); - uint16_t y2=mul0375(Coord2->y^0x1FF); -#else uint16_t x1=scalex[Coord1->x]; uint16_t x2=scalex[Coord2->x]; uint16_t y1=scaley[Coord1->y]; uint16_t y2=scaley[Coord2->y]; -#endif if (CurMode==ModeErase || CurMode==ModeInverse) tgi_setcolor(0); @@ -251,13 +222,8 @@ void screen_char_draw(padPt* Coord, unsigned char* ch, unsigned char count) tgi_setcolor(mainColor); -#ifdef __ATARI__ - x=mul0625((Coord->x&0x1FF)); - y=mul0375((Coord->y+14^0x1FF)&0x1FF); -#else x=scalex[(Coord->x&0x1FF)]; y=scaley[(Coord->y)+14&0x1FF]; -#endif if (FastText==padF) { @@ -405,11 +371,7 @@ void screen_tty_char(padByte theChar) { TTYLoc.x -= CharWide; tgi_setcolor(0); -#ifdef __ATARI__ - tgi_bar(mul0625(TTYLoc.x),mul0375(TTYLoc.y^0x1FF),mul0625(TTYLoc.x+CharWide),mul0375(TTYLoc.y^0x1FF+CharHigh)); -#else tgi_bar(scalex[TTYLoc.x],scaley[TTYLoc.y],scalex[TTYLoc.x+CharWide],scaley[TTYLoc.y+CharHigh]); -#endif tgi_setcolor(1); } else if (theChar == 0x0A) /* line feed */ -- 2.34.1