From 5543e137f81df4ae1aa5b3a8d3ecdb26e13f36d1 Mon Sep 17 00:00:00 2001 From: Bob Supnik Date: Thu, 16 Jun 2022 16:13:46 -0700 Subject: [PATCH] I1620, I1401: Add max value to address registers --- I1401/i1401_cpu.c | 9 +++++---- I1401/i1401_defs.h | 4 +++- I1620/i1620_cpu.c | 11 ++++++----- I1620/i1620_defs.h | 4 +++- sim_defs.h | 3 ++- 5 files changed, 19 insertions(+), 12 deletions(-) diff --git a/I1401/i1401_cpu.c b/I1401/i1401_cpu.c index 435621b6..3d6c7cf4 100644 --- a/I1401/i1401_cpu.c +++ b/I1401/i1401_cpu.c @@ -1,6 +1,6 @@ /* i1401_cpu.c: IBM 1401 CPU simulator - Copyright (c) 1993-2017, Robert M. Supnik + Copyright (c) 1993-2021, Robert M. Supnik Permission is hereby granted, free of charge, to any person obtaining a 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 in this Software without prior written authorization from Robert M Supnik. + 08-Jun-21 RMS Added max value to address registers 13-Mar-17 RMS Fixed MTF length checking (COVERITY) 30-Jan-15 RMS Fixed treatment of overflow (Ken Shirriff) 08-Oct-12 RMS Clear storage and branch preserves B register (Van Snyder) @@ -249,9 +250,9 @@ UNIT cpu_unit = { }; REG cpu_reg[] = { - { DRDATA (IS, saved_IS, 14), PV_LEFT }, - { DRDATA (AS, AS, 14), PV_LEFT }, - { DRDATA (BS, BS, 14), PV_LEFT }, + { DRDATA (IS, saved_IS, 14), PV_LEFT, MAXADDR }, + { DRDATA (AS, AS, 14), PV_LEFT, MAXADDR }, + { DRDATA (BS, BS, 14), PV_LEFT, MAXADDR }, { FLDATA (ASERR, as_err, 0) }, { FLDATA (BSERR, bs_err, 0) }, { ORDATA (D, D, 7) }, diff --git a/I1401/i1401_defs.h b/I1401/i1401_defs.h index 3f773e35..6b1e4f3c 100644 --- a/I1401/i1401_defs.h +++ b/I1401/i1401_defs.h @@ -1,6 +1,6 @@ /* i1401_defs.h: IBM 1401 simulator definitions - Copyright (c) 1993-2010, Robert M. Supnik + Copyright (c) 1993-2021, Robert M. Supnik Permission is hereby granted, free of charge, to any person obtaining a 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 in this Software without prior written authorization from Robert M Supnik. + 08-Jun-21 RMS Added max memory address 06-JUl-10 RMS Added overlap indicator definitions 22-May-10 RMS Added check for 64b definitions 11-Jul-08 RMS Added IO mode flag for boot (from Bob Abeles) @@ -81,6 +82,7 @@ /* Memory and devices */ #define MAXMEMSIZE 16000 /* max memory */ +#define MAXADDR (MAXMEMSIZE - 1) /* max memory address */ #define MEMSIZE (cpu_unit.capac) /* current memory */ #define CDR_BUF 1 /* card rdr buffer */ #define CDR_WIDTH 80 /* card rdr width */ diff --git a/I1620/i1620_cpu.c b/I1620/i1620_cpu.c index bb0b01b7..b7a6d89e 100644 --- a/I1620/i1620_cpu.c +++ b/I1620/i1620_cpu.c @@ -1,6 +1,6 @@ /* i1620_cpu.c: IBM 1620 CPU simulator - Copyright (c) 2002-2018, Robert M. Supnik + Copyright (c) 2002-2021, Robert M. Supnik Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), @@ -26,6 +26,7 @@ This CPU module incorporates code and comments from the 1620 simulator by Geoff Kuenning, with his permission. + 01-Feb-21 RMS Added max value to address registers 05-Jun-18 RMS Fixed bug in select index A (COVERITY) 23-Jun-17 RMS BS should not enable indexing unless configured 15-Jun-17 RMS Added more information to IO in progress message @@ -234,10 +235,10 @@ extern t_stat fp_fsr (uint32 d, uint32 s); UNIT cpu_unit = { UDATA (NULL, UNIT_FIX+UNIT_BCD+MI_STD, MAXMEMSIZE) }; REG cpu_reg[] = { - { DRDATA (PC, saved_PC, 16), PV_LEFT }, - { DRDATA (APC, actual_PC, 16), PV_LEFT + REG_HRO }, - { DRDATAD (IR2, IR2, 16, "instruction storage address register (PC)"), PV_LEFT }, - { DRDATAD (PR1, PR1, 16, "processor register 1"), PV_LEFT }, + { DRDATA (PC, saved_PC, 16), PV_LEFT, MAXADDR }, + { DRDATA (APC, actual_PC, 16), PV_LEFT + REG_HRO, MAXADDR }, + { DRDATAD (IR2, IR2, 16, "instruction storage address register (PC)"), PV_LEFT, MAXADDR }, + { DRDATAD (PR1, PR1, 16, "processor register 1"), PV_LEFT, MAXADDR }, { DRDATAD (PAR, PAR, 16, "P address register (OR2)"), PV_LEFT + REG_RO }, { DRDATAD (QAR, QAR, 16, "Q address register (OR1)"), PV_LEFT + REG_RO }, { FLDATAD (SW1, ind[IN_SW1], 0, "sense switch 1" ) }, diff --git a/I1620/i1620_defs.h b/I1620/i1620_defs.h index a48882c7..060ed63b 100644 --- a/I1620/i1620_defs.h +++ b/I1620/i1620_defs.h @@ -1,6 +1,6 @@ /* i1620_defs.h: IBM 1620 simulator definitions - Copyright (c) 2002-2017, Robert M. Supnik + Copyright (c) 2002-2021, Robert M. Supnik Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), @@ -27,6 +27,7 @@ I am grateful to Al Kossow, the Computer History Museum, and the IBM Corporate Archives for their help in gathering documentation about the IBM 1620. + 01-Feb-21 RMS Added MAXADDR for register contents 23-May-17 RMS MARCHK is indicator 8, not 18 (Dave Wise) 19-May-17 RMS Added option for Model I diagnostic mode (Dave Wise) 05-Feb-15 TFM Added definitions for flagged RM, GM, NB @@ -88,6 +89,7 @@ /* Memory */ #define MAXMEMSIZE 60000 /* max mem size */ +#define MAXADDR (MAXMEMSIZE - 1) /* max address */ #define MEMSIZE (cpu_unit.capac) /* act memory size */ /* Processor parameters */ diff --git a/sim_defs.h b/sim_defs.h index 256e7d97..dddc9290 100644 --- a/sim_defs.h +++ b/sim_defs.h @@ -698,8 +698,9 @@ struct REG { size_t obj_size; /* sizeof(*loc) */ size_t ele_size; /* sizeof(**loc) or sizeof(*loc) if depth == 1 */ const char *macro; /* Initializer Macro Name */ - /* NOTE: Flags MUST always be last since it is initialized outside of macro definitions */ + /* NOTE: Flags and maxval MUST always be last since they are initialized outside of macro definitions */ uint32 flags; /* flags */ + t_value maxval; /* maximum value */ }; /* Register flags */