1
0
mirror of https://github.com/simh/simh.git synced 2026-01-26 04:01:38 +00:00

Bug fixes for various video code. (#80)

* VIDEO: Fix bug: vid_ready can be used uninitialized.

* VIDEO: Not all events come with a valid windowID.

* PDP11: Fix NG SET TYPE.

The sense of MATCH_CMD is reversed.

* display: Fix bug in NG display controller.

There should be a separate state for each of the eight displays.

* display: Symbolic constant for number of displays.
This commit is contained in:
Lars Brinkhoff
2022-10-23 10:42:00 -05:00
committed by Mark Pizzolato
parent fb20442ffd
commit 35678bafd5
2 changed files with 36 additions and 26 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018 Lars Brinkhoff
* Copyright (c) 2018, 2022 Lars Brinkhoff
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -24,6 +24,8 @@
* from the authors.
*/
#include <string.h>
#include <assert.h>
#include "display.h" /* XY plot interface */
#include "ng.h"
@@ -33,6 +35,8 @@
#define TKGO 010000
#define TKSTOP 020000
/* Number of displays. */
#define DISPLAYS 8
static void *ng_dptr;
static int ng_dbit;
@@ -51,12 +55,12 @@ extern void _sim_debug_device (unsigned int dbits, DEVICE* dptr, const char* fmt
int ng_type = 0;
int ng_scale = PIX_SCALE;
static uint16 status = 0;
static uint16 status[DISPLAYS];
static int reloc = 0;
static int console = 0;
static int dpc[8];
static int x[8];
static int y[8];
static int dpc[DISPLAYS];
static int x[DISPLAYS];
static int y[DISPLAYS];
static unsigned char sync_period = 0;
static unsigned char time_out = 0;
@@ -66,14 +70,15 @@ ng_get_csr(void)
{
if (ng_type == TYPE_DAZZLE) {
DEBUGF("[%d] Get CSR: ", 0);
if (status & TKRUN)
if (status[console] & TKRUN)
DEBUGF("running\n");
else
DEBUGF("stopped\n");
return status[console];
} else if (ng_type == TYPE_LOGO) {
DEBUGF("Get CSR: %06o\n", status);
DEBUGF("Get CSR: %06o\n", status[0]);
return status[0];
}
return status;
}
int32
@@ -90,19 +95,19 @@ ng_set_csr(uint16 d)
if (d & TKGO) {
DEBUGF("[%d] Set CSR: GO\n", console);
if ((status & TKRUN) == 0)
if ((status[console] & TKRUN) == 0)
dpc[console] = 2*console;
status |= TKRUN;
status[console] = TKRUN | console;
}
if (d & TKSTOP) {
DEBUGF("[%d] Set CSR: STOP\n", console);
status &= ~TKRUN;
status[console] = console;
}
} else if (ng_type == TYPE_LOGO) {
DEBUGF("Set CSR: %06o\n", d);
if ((status & 1) == 0 && (d & 1))
if ((status[0] & 1) == 0 && (d & 1))
dpc[0] = 2*0;
status = d;
status[0] = d;
}
}
@@ -116,8 +121,12 @@ ng_set_reloc(uint16 d)
int
ng_init(void *dev, int debug)
{
/* Don't change this number. */
assert (DISPLAYS == 8);
ng_dptr = dev;
ng_dbit = debug;
memset (status, 0, sizeof status);
return display_init(DIS_NG, ng_scale, ng_dptr);
}
@@ -217,7 +226,7 @@ void stop (void)
{
DEBUGF("[%d] STOP\n", console);
if (ng_type == TYPE_DAZZLE)
status &= ~TKRUN;
status[console] &= ~TKRUN;
else if (ng_type == TYPE_LOGO)
dpc[0] = 2*0;
}
@@ -298,6 +307,7 @@ ng_cycle(int us, int slowdown)
static uint32 usec = 0;
static uint32 msec = 0;
uint32 new_msec;
int saved;
new_msec = (usec += us) / 1000;
@@ -307,20 +317,21 @@ ng_cycle(int us, int slowdown)
msec = new_msec;
if (ng_type == TYPE_DAZZLE) {
if ((status & TKRUN) == 0)
if (ng_type == TYPE_LOGO) {
DEBUGF("LOGO/STATUS %06o\n", status[0]);
if ((status[0] & 1) == 0)
goto age_ret;
} else if (ng_type == TYPE_LOGO) {
DEBUGF("STATUS %06o\n", status);
if ((status & 1) == 0)
goto age_ret;
} else
} else if (ng_type != TYPE_DAZZLE)
return 1;
if (sync_period)
goto age_ret;
saved = console;
for (console = 0; console < 1; console++) {
if (ng_type == TYPE_DAZZLE && (status[console] & TKRUN) == 0)
continue;
time_out = fetch(dpc[console], &inst);
DEBUGF("[%d] PC %06o, INSTR %06o\n", console, dpc[console], inst);
dpc[console] += 2;
@@ -339,6 +350,7 @@ ng_cycle(int us, int slowdown)
break;
}
}
console = saved;
age_ret:
display_age(us, slowdown);