From e9b083508be40df3b008a1bedad13a50e2afb831 Mon Sep 17 00:00:00 2001 From: Lars Brinkhoff Date: Mon, 29 Mar 2021 08:53:22 +0200 Subject: [PATCH] IMLAC: Call display library directly; use new display_line API. --- Visual Studio Projects/imlac.vcproj | 8 -- display/imlac.c | 114 ---------------------------- display/imlac.h | 38 ---------- imlac/imlac_crt.c | 12 +-- makefile | 3 +- 5 files changed, 7 insertions(+), 168 deletions(-) delete mode 100644 display/imlac.c delete mode 100644 display/imlac.h diff --git a/Visual Studio Projects/imlac.vcproj b/Visual Studio Projects/imlac.vcproj index 16107eff..486af87b 100644 --- a/Visual Studio Projects/imlac.vcproj +++ b/Visual Studio Projects/imlac.vcproj @@ -195,10 +195,6 @@ RelativePath="..\display\display.c" > - - @@ -311,10 +307,6 @@ RelativePath="..\display\display.h" > - - diff --git a/display/imlac.c b/display/imlac.c deleted file mode 100644 index 91c6dfdb..00000000 --- a/display/imlac.c +++ /dev/null @@ -1,114 +0,0 @@ -/* imlac.c: Imlac 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 "imlac.h" - -#if defined(__cplusplus) -extern "C" { -#endif - -int imlac_init(void *dev, int debug) -{ - return display_init (DIS_IMLAC, 1, dev); -} - -void imlac_point (int x, int y) -{ - display_point (x, y, DISPLAY_INT_MAX, 0); -} - -int imlac_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 ix = SIGN(dx); - int iy = SIGN(dy); - int ay; - - dx = ABS(dx); - dy = ABS(dy); - - ay = dy/2; - for (;;) { - imlac_point (x, y); - 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 ix = SIGN(dx); - int iy = SIGN(dy); - int ax; - - dx = ABS(dx); - dy = ABS(dy); - - ax = dx/2; - for (;;) { - imlac_point (x, y); - if (y == y2) - break; - if (ax > 0) { - x += ix; - ax -= dy; - } - ax += dx; - y += iy; - } -} - -void -imlac_line (int x1, int y1, int x2, int y2) -{ - int dx = x2 - x1; - int dy = y2 - y1; - if (ABS (dx) > ABS(dy)) - xline (x1, y1, x2, dx, dy); - else - yline (x1, y1, y2, dx, dy); -} - -#if defined(__cplusplus) -} -#endif diff --git a/display/imlac.h b/display/imlac.h deleted file mode 100644 index 3bdc5562..00000000 --- a/display/imlac.h +++ /dev/null @@ -1,38 +0,0 @@ -/* imlac.h: Imlac 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 imlac_init(void *, int); -extern int imlac_cycle(int, int); -extern void imlac_point(int, int); -extern void imlac_line(int x1, int y1, int x2, int y2); - -#if defined(__cplusplus) -} -#endif diff --git a/imlac/imlac_crt.c b/imlac/imlac_crt.c index 59514a3b..1e037181 100644 --- a/imlac/imlac_crt.c +++ b/imlac/imlac_crt.c @@ -26,7 +26,6 @@ #include "imlac_defs.h" #include "sim_video.h" -#include "display/imlac.h" #include "display/display.h" /* Function declaration. */ @@ -66,7 +65,7 @@ static t_stat crt_svc(UNIT *uptr) { #ifdef USE_DISPLAY - imlac_cycle (100, 0); + display_age (100, 0); sim_activate_after (uptr, 100); if (crt_quit) { crt_quit = FALSE; @@ -90,7 +89,7 @@ crt_reset (DEVICE *dptr) sim_cancel (&crt_unit); } else { display_reset (); - imlac_init (dptr, 1); + display_init (DIS_IMLAC, 1, dptr); sim_activate_abs (&crt_unit, 0); vid_register_quit_callback (&crt_quit_callback); } @@ -105,7 +104,7 @@ crt_point (uint16 x, uint16 y) #ifdef USE_DISPLAY if (crt_dev.flags & DEV_DIS) return; - imlac_point ((x & 03777) >> 1, (y & 03777) >> 1); + display_point ((x & 03777) >> 1, (y & 03777) >> 1, DISPLAY_INT_MAX, 0); #endif } @@ -116,8 +115,9 @@ crt_line (uint16 x1, uint16 y1, uint16 x2, uint16 y2) #ifdef USE_DISPLAY if (crt_dev.flags & DEV_DIS) return; - imlac_line ((x1 & 03777) >> 1, (y1 & 03777) >> 1, - (x2 & 03777) >> 1, (y2 & 03777) >> 1); + display_line ((x1 & 03777) >> 1, (y1 & 03777) >> 1, + (x2 & 03777) >> 1, (y2 & 03777) >> 1, + DISPLAY_INT_MAX); #endif } diff --git a/makefile b/makefile index 819cafb1..09e28d36 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 - DISPLAYIMLAC = ${DISPLAYD}/imlac.c DISPLAYTT2500 = ${DISPLAYD}/tt2500.c DISPLAY_OPT += -DUSE_DISPLAY $(VIDEO_CCDEFS) $(VIDEO_LDFLAGS) $(info using libSDL2: $(call find_include,SDL2/SDL)) @@ -1552,7 +1551,7 @@ IMLACD = ${SIMHD}/imlac IMLAC = ${IMLACD}/imlac_sys.c ${IMLACD}/imlac_cpu.c \ ${IMLACD}/imlac_dp.c ${IMLACD}/imlac_crt.c ${IMLACD}/imlac_kbd.c \ ${IMLACD}/imlac_tty.c ${IMLACD}/imlac_pt.c ${IMLACD}/imlac_bel.c \ - ${DISPLAYL} ${DISPLAYIMLAC} + ${DISPLAYL} IMLAC_OPT = -I ${IMLACD} ${DISPLAY_OPT}