DISPLAY: Added III display device.

This commit is contained in:
Richard Cornwell 2020-03-09 20:25:55 -04:00
parent 42411b2e18
commit c7d529c4db
4 changed files with 243 additions and 1 deletions

View file

@ -127,6 +127,10 @@ struct color color_p29 = { p29, ELEMENTS(p29), 25000 };
static struct phosphor p31[] = {{0.0, 1.0, 0.77, 0.5, .1}};
struct color color_p31 = { p31, ELEMENTS(p31), 25000 };
/* green phosphor for III */
static struct phosphor p39[] = {{0.2, 1.0, 0.0, 0.5, 0.01}};
struct color color_p39 = { p39, ELEMENTS(p39), 20000 };
static struct phosphor p40[] = {
/* P40 blue-white spot with yellow-green decay (.045s to 10%?) */
{0.4, 0.2, 0.924, 0.5, 0.0135},
@ -241,7 +245,13 @@ static struct display displays[] = {
* 512x512, out of 800x600
* 0,0 at middle
*/
{ DIS_NG, "NG Display", &color_p31, NULL, 512, 512 }
{ DIS_NG, "NG Display", &color_p31, NULL, 512, 512 },
/*
* III display
* on PDP-10
*/
{ DIS_III, "III Display", &color_p39, NULL, 1024, 1024 }
};
/*

View file

@ -47,6 +47,7 @@ enum display_type {
DIS_VR20 = 20,
DIS_TYPE30 = 30,
DIS_VR48 = 48,
DIS_III = 111,
DIS_TYPE340 = 340,
DIS_NG = 999,
};

192
display/iii.c Normal file
View file

@ -0,0 +1,192 @@
/* iii.c: Triple III display interface.
Copyright (c) 2020, Richard Cornwell (based on help from 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
RICHARD CORNWELL 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 Richard Cornwell shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from Richard Cornwell
*/
#include "display.h"
#include "iii.h"
#if defined(__cplusplus)
extern "C" {
#endif
int iii_init(void *dev, int debug)
{
return display_init(DIS_III, 1, dev);
}
void iii_point (int x, int y, int l)
{
display_point(x + 512, y + 512, l, 0);
}
int iii_cycle(int us, int slowdown)
{
return display_age(us, slowdown);
}
/* Draw a line between two points */
void
iii_draw_line(int x1, int y1, int x2, int y2, int l)
{
int dx, ax;
int dy;
int i, j;
int pu, pd, ws, et;
int ipc, fpc;
/* Origin us to 0 */
x1 += 512;
y1 += 512;
x2 += 512;
y2 += 512;
/* Always draw top to bottom */
if (y1 > y2) {
int temp;
temp = y1;
y1 = y2;
y2 = temp;
temp = x1;
x1 = x2;
x2 = temp;
}
/* Figure out distances */
dx = x2 - x1;
dy = y2 - y1;
/* Figure out whether we're going left or right */
if (dx < 0) {
ax = -1;
dx = -dx;
} else {
ax = 1;
}
/* Vertical line */
if (dx == 0) {
for (i = 1; i < dy; i++) {
display_point(x1, y1, l, 0);
y1++;
}
return;
}
/* Horizontal line */
if (dy == 0) {
for (i = 1; i < dx; i++) {
display_point(x1, y1, l, 0);
x1+=ax;
}
return;
}
/* Diagnonal line */
if (dx == dy) {
for (i = 1; i < dx; i++) {
display_point(x1, y1, l, 0);
x1 += ax;
y1 ++;
}
return;
}
/* Determine whether the line is X or Y major */
if (dx >= dy) {
/* X major line */
ws = dx / dy;
/* Adjust for each y by 1 step */
pu = (dx % dy) * 2;
/* Overrun error */
pd = dy * 2;
et = (dx % dy) - (dy * 2);
ipc = (ws / 2) + 1;
fpc = ipc;
if ((pu == 0) && (ws & 1) == 0)
ipc--;
if ((ws & 1) != 0)
et += dy;
/* Draw run in x direction */
for (j = 0; j < ipc; j++) {
display_point(x1, y1, l, 0);
x1 += ax;
}
y1++;
/* Draw rest */
for (i = 0; i< (dy-1); i++) {
int rl = ws;
if ((et += pu) > 0) {
rl++;
et -= pd;
}
for (j = 0; j < rl; j++) {
display_point(x1, y1, l, 0);
x1 += ax;
}
y1++;
}
for (j = 0; j < fpc; j++) {
display_point(x1, y1, l, 0);
x1 += ax;
}
} else {
ws = dy / dx;
pu = (dy % dx) * 2;
pd = dx * 2;
et = (dy % dx) - (dx * 2);
ipc = (ws / 2) + 1;
fpc = ipc;
if ((pu == 0) && ((ws & 1) == 0))
ipc--;
if ((ws & 1) != 0)
et += dx;
/* Draw run in y direction */
for (j = 0; j < ipc; j++) {
display_point(x1, y1, l, 0);
y1 ++;
}
x1 += ax;
/* Draw rest */
for (i = 0; i< (dx-1); i++) {
int rl = ws;
if ((et += pu) > 0) {
rl++;
et -= pd;
}
for (j = 0; j < rl; j++) {
display_point(x1, y1, l, 0);
y1 ++;
}
x1 += ax;
}
for (j = 0; j < fpc; j++) {
display_point(x1, y1, l, 0);
y1 ++;
}
}
}
#if defined(__cplusplus)
}
#endif

39
display/iii.h Normal file
View file

@ -0,0 +1,39 @@
/* iii.c: Triple III display interface.
Copyright (c) 2020, Richard Cornwell.
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
RICHARD CORNWELL 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 Richard Cornwell shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from Richard Cornwell
*/
#if defined(__cplusplus)
extern "C" {
#endif
extern int iii_init(void *, int);
extern int iii_cycle(int, int);
extern void iii_point(int, int, int);
extern void iii_draw_line(int x1, int y1, int x2, int y2, int l);
#if defined(__cplusplus)
}
#endif