From 3c1c92dc30641d7b6851c5ae05c36c91bde45b98 Mon Sep 17 00:00:00 2001 From: Lars Brinkhoff Date: Mon, 29 Mar 2021 09:28:01 +0200 Subject: [PATCH] TT2500: Call display library directly; use new display_line API. --- Visual Studio Projects/tt2500.vcproj | 8 -- display/tt2500.c | 115 --------------------------- display/tt2500.h | 37 --------- makefile | 3 +- tt2500/tt2500_crt.c | 7 +- tt2500/tt2500_tv.c | 1 - 6 files changed, 4 insertions(+), 167 deletions(-) delete mode 100644 display/tt2500.c delete mode 100644 display/tt2500.h diff --git a/Visual Studio Projects/tt2500.vcproj b/Visual Studio Projects/tt2500.vcproj index 09cbb1ba..88912928 100644 --- a/Visual Studio Projects/tt2500.vcproj +++ b/Visual Studio Projects/tt2500.vcproj @@ -266,10 +266,6 @@ RelativePath="..\display\sim_ws.c" > - - @@ -363,10 +359,6 @@ RelativePath="..\sim_video.h" > - - diff --git a/display/tt2500.c b/display/tt2500.c deleted file mode 100644 index 6faadb64..00000000 --- a/display/tt2500.c +++ /dev/null @@ -1,115 +0,0 @@ -/* tt2500.c: TT2500 display interface. - - Copyright (c) 2020, Lars Brinkhoff - - Permission is hereby granted, free of charge, to any person obtaining a - copy of this software and associated documentation files (the "Software"), - to deal in the Software without restriction, including without limitation - the rights to use, copy, modify, merge, publish, distribute, sublicense, - and/or sell copies of the Software, and to permit persons to whom the - Software is furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - LARS BRINKHOFF BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - Except as contained in this notice, the name of Lars Brinkhoff shall not be - used in advertising or otherwise to promote the sale, use or other dealings - in this Software without prior written authorization from Lars Brinkhoff - -*/ - -#include "display.h" -#include "tt2500.h" - -#if defined(__cplusplus) -extern "C" { -#endif - -int tt2500_init(void *dev, int debug) -{ - return display_init (DIS_TT2500, 1, dev); -} - -static void tt2500_point (int x, int y, int i) -{ - if (i < 7) - display_point (x, y, DISPLAY_INT_MAX*(7-i)/7, 0); -} - -int tt2500_cycle(int us, int slowdown) -{ - return display_age (us, slowdown); -} - -#define ABS(_X) ((_X) >= 0 ? (_X) : -(_X)) -#define SIGN(_X) ((_X) >= 0 ? 1 : -1) - -static void -xline (int x, int y, int x2, int dx, int dy, int i) -{ - int ix = SIGN(dx); - int iy = SIGN(dy); - int ay; - - dx = ABS(dx); - dy = ABS(dy); - - ay = dy/2; - for (;;) { - tt2500_point (x, y, i); - if (x == x2) - break; - if (ay > 0) { - y += iy; - ay -= dx; - } - ay += dy; - x += ix; - } -} - -static void -yline (int x, int y, int y2, int dx, int dy, int i) -{ - int ix = SIGN(dx); - int iy = SIGN(dy); - int ax; - - dx = ABS(dx); - dy = ABS(dy); - - ax = dx/2; - for (;;) { - tt2500_point (x, y, i); - if (y == y2) - break; - if (ax > 0) { - x += ix; - ax -= dy; - } - ax += dx; - y += iy; - } -} - -void -tt2500_line (int x1, int y1, int x2, int y2, int i) -{ - int dx = x2 - x1; - int dy = y2 - y1; - if (ABS (dx) > ABS(dy)) - xline (x1, y1, x2, dx, dy, i); - else - yline (x1, y1, y2, dx, dy, i); -} - -#if defined(__cplusplus) -} -#endif diff --git a/display/tt2500.h b/display/tt2500.h deleted file mode 100644 index f422a0b2..00000000 --- a/display/tt2500.h +++ /dev/null @@ -1,37 +0,0 @@ -/* tt2500.h: TT2500 display interface. - - Copyright (c) 2020, Lars Brinkhoff. - - Permission is hereby granted, free of charge, to any person obtaining a - copy of this software and associated documentation files (the "Software"), - to deal in the Software without restriction, including without limitation - the rights to use, copy, modify, merge, publish, distribute, sublicense, - and/or sell copies of the Software, and to permit persons to whom the - Software is furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - LARS BRINKHOFF BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - Except as contained in this notice, the name of Lars Brinkhoff shall not be - used in advertising or otherwise to promote the sale, use or other dealings - in this Software without prior written authorization from Lars Brinkhoff -*/ - -#if defined(__cplusplus) -extern "C" { -#endif - -extern int tt2500_init(void *, int); -extern int tt2500_cycle(int, int); -extern void tt2500_line(int x1, int y1, int x2, int y2, int i); - -#if defined(__cplusplus) -} -#endif diff --git a/makefile b/makefile index 09e28d36..96a02b3c 100644 --- a/makefile +++ b/makefile @@ -635,7 +635,6 @@ ifeq (${WIN32},) #*nix Environments (&& cygwin) DISPLAY340 = ${DISPLAYD}/type340.c DISPLAYNG = ${DISPLAYD}/ng.c DISPLAYIII = ${DISPLAYD}/iii.c - DISPLAYTT2500 = ${DISPLAYD}/tt2500.c DISPLAY_OPT += -DUSE_DISPLAY $(VIDEO_CCDEFS) $(VIDEO_LDFLAGS) $(info using libSDL2: $(call find_include,SDL2/SDL)) ifeq (Darwin,$(OSTYPE)) @@ -1559,7 +1558,7 @@ TT2500D = ${SIMHD}/tt2500 TT2500 = ${TT2500D}/tt2500_sys.c ${TT2500D}/tt2500_cpu.c \ ${TT2500D}/tt2500_dpy.c ${TT2500D}/tt2500_crt.c ${TT2500D}/tt2500_tv.c \ ${TT2500D}/tt2500_key.c ${TT2500D}/tt2500_uart.c ${TT2500D}/tt2500_rom.c \ - ${DISPLAYL} ${DISPLAYTT2500} + ${DISPLAYL} TT2500_OPT = -I ${TT2500D} ${DISPLAY_OPT} diff --git a/tt2500/tt2500_crt.c b/tt2500/tt2500_crt.c index 9f694161..ac25c445 100644 --- a/tt2500/tt2500_crt.c +++ b/tt2500/tt2500_crt.c @@ -26,7 +26,6 @@ #include "tt2500_defs.h" #include "sim_video.h" -#include "display/tt2500.h" #include "display/display.h" /* Function declaration. */ @@ -65,7 +64,7 @@ static t_stat crt_svc(UNIT *uptr) { #ifdef USE_DISPLAY - tt2500_cycle (100, 0); + display_age (100, 0); if (!display_is_blank ()) sim_activate_after (uptr, 100); if (dpy_quit) { @@ -85,7 +84,7 @@ crt_reset (DEVICE *dptr) sim_cancel (&crt_unit); } else { display_reset (); - tt2500_init (dptr, 1); + display_init (DIS_TT2500, 1, dptr); vid_register_quit_callback (&dpy_quit_callback); } #endif @@ -101,6 +100,6 @@ crt_line (uint16 x1, uint16 y1, uint16 x2, uint16 y2, uint16 i) sim_activate_abs (&crt_unit, 0); if (crt_dev.flags & DEV_DIS) return; - tt2500_line (x1, y1, x2, y2, i); + display_line (x1, y1, x2, y2, DISPLAY_INT_MAX*(7-i)/7); #endif } diff --git a/tt2500/tt2500_tv.c b/tt2500/tt2500_tv.c index b03eb2b4..360b8117 100644 --- a/tt2500/tt2500_tv.c +++ b/tt2500/tt2500_tv.c @@ -26,7 +26,6 @@ #include "tt2500_defs.h" #include "sim_video.h" -#include "display/tt2500.h" #include "display/display.h" /* Function declaration. */