Clear storage and branch preserves B register (Van Snyder)

This commit is contained in:
Mark Pizzolato 2013-08-22 15:50:08 -07:00
parent 18461f510b
commit 938b75fc44

View file

@ -1,6 +1,6 @@
/* i1401_cpu.c: IBM 1401 CPU simulator /* i1401_cpu.c: IBM 1401 CPU simulator
Copyright (c) 1993-2011, Robert M. Supnik Copyright (c) 1993-2012, Robert M. Supnik
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"), copy of this software and associated documentation files (the "Software"),
@ -23,6 +23,7 @@
used in advertising or otherwise to promote the sale, use or other dealings used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from Robert M Supnik. in this Software without prior written authorization from Robert M Supnik.
08-Oct-12 RMS Clear storage and branch preserves B register (Van Snyder)
19-Mar-11 RMS Reverted multiple tape indicator implementation 19-Mar-11 RMS Reverted multiple tape indicator implementation
20-Jan-11 RMS Fixed branch on EOT indicator per hardware (Van Snyder) 20-Jan-11 RMS Fixed branch on EOT indicator per hardware (Van Snyder)
07-Nov-10 RMS Fixed divide not to clear word marks in quotient 07-Nov-10 RMS Fixed divide not to clear word marks in quotient
@ -178,6 +179,14 @@ typedef struct {
PCQ_ENTRY; \ PCQ_ENTRY; \
IS = AS; IS = AS;
#define BRANCH_CS if (ADDR_ERR (AS)) { \
reason = STOP_INVBR; \
break; \
} \
PCQ_ENTRY; \
IS = AS;
uint8 M[MAXMEMSIZE] = { 0 }; /* main memory */ uint8 M[MAXMEMSIZE] = { 0 }; /* main memory */
int32 saved_IS = 0; /* saved IS */ int32 saved_IS = 0; /* saved IS */
int32 AS = 0; /* AS */ int32 AS = 0; /* AS */
@ -1563,6 +1572,9 @@ CHECK_LENGTH:
5,6 invalid B-address 5,6 invalid B-address
7 branch 7 branch
8+ one operand, branch ignored 8+ one operand, branch ignored
Note that clear storage and branch does not overwrite the B register,
unlike all other branches
*/ */
case OP_CS: /* clear storage */ case OP_CS: /* clear storage */
@ -1572,7 +1584,7 @@ CHECK_LENGTH:
if (BS < 0) /* wrap if needed */ if (BS < 0) /* wrap if needed */
BS = BS + MEMSIZE; BS = BS + MEMSIZE;
if (ilnt == 7) { /* branch variant? */ if (ilnt == 7) { /* branch variant? */
BRANCH; BRANCH_CS; /* special branch */
} }
break; break;