TT2500: Call display library directly; use new display_line API.
This commit is contained in:
parent
e9b083508b
commit
3c1c92dc30
6 changed files with 4 additions and 167 deletions
|
@ -266,10 +266,6 @@
|
|||
RelativePath="..\display\sim_ws.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\display\tt2500.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tt2500\tt2500_cpu.c"
|
||||
>
|
||||
|
@ -363,10 +359,6 @@
|
|||
RelativePath="..\sim_video.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\display\tt2500.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tt2500\tt2500_defs.h"
|
||||
>
|
||||
|
|
115
display/tt2500.c
115
display/tt2500.c
|
@ -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
|
|
@ -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
|
3
makefile
3
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}
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
|
||||
#include "tt2500_defs.h"
|
||||
#include "sim_video.h"
|
||||
#include "display/tt2500.h"
|
||||
#include "display/display.h"
|
||||
|
||||
/* Function declaration. */
|
||||
|
|
Loading…
Add table
Reference in a new issue