mirror of
https://github.com/simh/simh.git
synced 2026-05-05 15:33:34 +00:00
Imlac: Model X/Y MSB and LSB.
This commit is contained in:
committed by
Mark Pizzolato
parent
1c792f8309
commit
8e0b432f1a
@@ -35,7 +35,8 @@ static uint16 SP = 0;
|
|||||||
static uint16 ON = 0;
|
static uint16 ON = 0;
|
||||||
static uint16 HALT = 0;
|
static uint16 HALT = 0;
|
||||||
static uint16 MODE = 0;
|
static uint16 MODE = 0;
|
||||||
static uint16 XA, YA;
|
static uint16 XMSB, YMSB;
|
||||||
|
static uint16 XLSB, YLSB;
|
||||||
static uint16 SCALE = 2;
|
static uint16 SCALE = 2;
|
||||||
static uint16 BLOCK = 0;
|
static uint16 BLOCK = 0;
|
||||||
static uint16 MIT8K;
|
static uint16 MIT8K;
|
||||||
@@ -67,8 +68,8 @@ static REG dp_reg[] = {
|
|||||||
{ ORDATAD (MODE, MODE, 1, "Display mode") },
|
{ ORDATAD (MODE, MODE, 1, "Display mode") },
|
||||||
{ BRDATAD (DT, DT, 8, 16, 8, "Return address stack") },
|
{ BRDATAD (DT, DT, 8, 16, 8, "Return address stack") },
|
||||||
{ ORDATAD (SP, SP, 3, "Stack pointer") },
|
{ ORDATAD (SP, SP, 3, "Stack pointer") },
|
||||||
{ ORDATAD (XA, XA, 11, "X accumulator") },
|
{ ORDATAD (XMSB, XMSB, 11, "X accumulator") },
|
||||||
{ ORDATAD (YA, YA, 11, "Y accumulator") },
|
{ ORDATAD (YMSB, YMSB, 11, "Y accumulator") },
|
||||||
{ ORDATAD (SCALE, SCALE, 3, "Scale") },
|
{ ORDATAD (SCALE, SCALE, 3, "Scale") },
|
||||||
{ ORDATAD (BLOCK, BLOCK, 3, "Block") },
|
{ ORDATAD (BLOCK, BLOCK, 3, "Block") },
|
||||||
{ ORDATAD (MIT8K, MIT8K, 1, "MIT 8K addressing") },
|
{ ORDATAD (MIT8K, MIT8K, 1, "MIT 8K addressing") },
|
||||||
@@ -165,6 +166,25 @@ dp_iot (uint16 insn, uint16 AC)
|
|||||||
return AC;
|
return AC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static uint16 deflect (uint16 msb, uint16 lsb)
|
||||||
|
{
|
||||||
|
return (msb << 5) + lsb;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void increment (uint16 *msb, uint16 *lsb, uint16 x)
|
||||||
|
{
|
||||||
|
*lsb += SCALE * x;
|
||||||
|
*msb += *lsb >> 5;
|
||||||
|
*lsb &= 037;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void decrement (uint16 *msb, uint16 *lsb, uint16 x)
|
||||||
|
{
|
||||||
|
*lsb -= SCALE * x;
|
||||||
|
*msb += ((int16)*lsb) >> 5;
|
||||||
|
*lsb &= 037;
|
||||||
|
}
|
||||||
|
|
||||||
static t_stat
|
static t_stat
|
||||||
dp_opr(uint16 insn)
|
dp_opr(uint16 insn)
|
||||||
{
|
{
|
||||||
@@ -202,7 +222,7 @@ dp_opr(uint16 insn)
|
|||||||
}
|
}
|
||||||
if (insn & 00020) { /* DDSP */
|
if (insn & 00020) { /* DDSP */
|
||||||
sim_debug (DBG, &dp_dev, "DDSP ");
|
sim_debug (DBG, &dp_dev, "DDSP ");
|
||||||
crt_point (XA, YA);
|
crt_point (deflect (XMSB, XLSB), deflect (YMSB, YLSB));
|
||||||
}
|
}
|
||||||
if (insn & 00040) { /* DRJM */
|
if (insn & 00040) { /* DRJM */
|
||||||
sim_debug (DBG, &dp_dev, "DRJM ");
|
sim_debug (DBG, &dp_dev, "DRJM ");
|
||||||
@@ -213,19 +233,19 @@ dp_opr(uint16 insn)
|
|||||||
}
|
}
|
||||||
if (insn & 00100) { /* DDYM */
|
if (insn & 00100) { /* DDYM */
|
||||||
sim_debug (DBG, &dp_dev, "DDYM ");
|
sim_debug (DBG, &dp_dev, "DDYM ");
|
||||||
YA -= 040;
|
YMSB--;
|
||||||
}
|
}
|
||||||
if (insn & 00200) { /* DDXM */
|
if (insn & 00200) { /* DDXM */
|
||||||
sim_debug (DBG, &dp_dev, "DDXM ");
|
sim_debug (DBG, &dp_dev, "DDXM ");
|
||||||
XA -= 040;
|
XMSB--;
|
||||||
}
|
}
|
||||||
if (insn & 00400) { /* DIYM */
|
if (insn & 00400) { /* DIYM */
|
||||||
sim_debug (DBG, &dp_dev, "DIYM ");
|
sim_debug (DBG, &dp_dev, "DIYM ");
|
||||||
YA += 040;
|
YMSB++;
|
||||||
}
|
}
|
||||||
if (insn & 01000) { /* DIXM */
|
if (insn & 01000) { /* DIXM */
|
||||||
sim_debug (DBG, &dp_dev, "DIXM ");
|
sim_debug (DBG, &dp_dev, "DIXM ");
|
||||||
XA += 040;
|
XMSB++;
|
||||||
}
|
}
|
||||||
if (insn & 02000) { /* DHVC */
|
if (insn & 02000) { /* DHVC */
|
||||||
sim_debug (DBG, &dp_dev, "DHVC ");
|
sim_debug (DBG, &dp_dev, "DHVC ");
|
||||||
@@ -294,7 +314,7 @@ dp_opt (uint16 insn)
|
|||||||
static void
|
static void
|
||||||
dp_inc_vector (uint16 byte)
|
dp_inc_vector (uint16 byte)
|
||||||
{
|
{
|
||||||
uint16 x1 = XA, y1 = YA;
|
uint16 x1 = deflect (XMSB, XLSB), y1 = deflect (YMSB, YLSB);
|
||||||
uint16 dx, dy;
|
uint16 dx, dy;
|
||||||
|
|
||||||
if (byte == 0200) {
|
if (byte == 0200) {
|
||||||
@@ -309,19 +329,18 @@ dp_inc_vector (uint16 byte)
|
|||||||
sim_debug (DBG, &dp_dev, "%o", byte & 3);
|
sim_debug (DBG, &dp_dev, "%o", byte & 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
dx = SCALE * ((byte >> 3) & 3);
|
dx = (byte >> 3) & 3;
|
||||||
dy = SCALE * (byte & 3);
|
dy = byte & 3;
|
||||||
if (byte & 040)
|
if (byte & 040)
|
||||||
XA -= dx;
|
decrement (&XMSB, &XLSB, dx);
|
||||||
else
|
else
|
||||||
XA += dx;
|
increment (&XMSB, &XLSB, dx);
|
||||||
if (byte & 4)
|
if (byte & 4)
|
||||||
YA -= dy;
|
decrement (&YMSB, &YLSB, dy);
|
||||||
else
|
else
|
||||||
YA += dy;
|
increment (&YMSB, &YLSB, dy);
|
||||||
if (byte & 0100)
|
if (byte & 0100)
|
||||||
crt_line (x1, y1, XA, YA);
|
crt_line (x1, y1, deflect (XMSB, XLSB), deflect (YMSB, YLSB));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -345,15 +364,15 @@ dp_inc_escape (uint16 byte)
|
|||||||
sim_debug (DBG, &dp_dev, "stack underflow");
|
sim_debug (DBG, &dp_dev, "stack underflow");
|
||||||
}
|
}
|
||||||
if (byte & 020)
|
if (byte & 020)
|
||||||
XA += 040;
|
XMSB++;
|
||||||
if (byte & 010)
|
if (byte & 010)
|
||||||
XA &= 03740;
|
XLSB = 0;
|
||||||
if (byte & 4) /* Enter PPM mode. */
|
if (byte & 4) /* Enter PPM mode. */
|
||||||
;
|
;
|
||||||
if (byte & 2)
|
if (byte & 2)
|
||||||
YA += 040;
|
YMSB++;
|
||||||
if (byte & 1)
|
if (byte & 1)
|
||||||
YA &= 03740;
|
YLSB = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -380,7 +399,7 @@ dp_deim (uint16 insn)
|
|||||||
static void
|
static void
|
||||||
dp_dlvh (uint16 insn1, uint16 insn2, uint16 insn3)
|
dp_dlvh (uint16 insn1, uint16 insn2, uint16 insn3)
|
||||||
{
|
{
|
||||||
uint16 x1 = XA, y1 = YA;
|
uint16 x1 = deflect (XMSB, XLSB), y1 = deflect (YMSB, YLSB);
|
||||||
uint16 m, n, dx, dy;
|
uint16 m, n, dx, dy;
|
||||||
m = insn2 & 07777;
|
m = insn2 & 07777;
|
||||||
n = insn3 & 07777;
|
n = insn3 & 07777;
|
||||||
@@ -392,15 +411,15 @@ dp_dlvh (uint16 insn1, uint16 insn2, uint16 insn3)
|
|||||||
dy = n;
|
dy = n;
|
||||||
}
|
}
|
||||||
if (insn3 & 040000)
|
if (insn3 & 040000)
|
||||||
XA -= SCALE * dx;
|
decrement (&XMSB, &XLSB, dx);
|
||||||
else
|
else
|
||||||
XA += SCALE * dx;
|
increment (&XMSB, &XLSB, dx);
|
||||||
if (insn3 & 020000)
|
if (insn3 & 020000)
|
||||||
YA -= SCALE * dy;
|
decrement (&YMSB, &YLSB, dy);
|
||||||
else
|
else
|
||||||
YA += SCALE * dy;
|
increment (&YMSB, &YLSB, dy);
|
||||||
if (insn2 & 020000)
|
if (insn2 & 020000)
|
||||||
crt_line (x1, y1, XA, YA);
|
crt_line (x1, y1, deflect (XMSB, XLSB), deflect (YMSB, YLSB));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -412,11 +431,13 @@ dp_insn (uint16 insn)
|
|||||||
break;
|
break;
|
||||||
case 1: /* DLXA */
|
case 1: /* DLXA */
|
||||||
sim_debug (DBG, &dp_dev, "DLXA\n");
|
sim_debug (DBG, &dp_dev, "DLXA\n");
|
||||||
XA = (insn & 01777) << 1;
|
XMSB = (insn >> 4) & 0077;
|
||||||
|
XLSB = (insn << 1) & 0036;
|
||||||
break;
|
break;
|
||||||
case 2: /* DLYA */
|
case 2: /* DLYA */
|
||||||
sim_debug (DBG, &dp_dev, "DLYA\n");
|
sim_debug (DBG, &dp_dev, "DLYA\n");
|
||||||
YA = (insn & 01777) << 1;
|
YMSB = (insn >> 4) & 0077;
|
||||||
|
YLSB = (insn << 1) & 0036;
|
||||||
break;
|
break;
|
||||||
case 3: /* DEIM */
|
case 3: /* DEIM */
|
||||||
sim_debug (DBG, &dp_dev, "DEIM ");
|
sim_debug (DBG, &dp_dev, "DEIM ");
|
||||||
|
|||||||
Reference in New Issue
Block a user