I1620: Fixed bug in select index A (COVERITY)

If the CPU is a model 1, then the value of idxb is irrelevant. For
tidiness, it should always be 0, but on a model 1, idxe (index
enable) is always 0, so idxb is not looked at. Thus,

- on a model 1, idxb is set to 0, which is harmless and probably a good
   thing to do.
- on a model 2, idxe is set to 1, and idxb is set to 0, which is the correct
   behavior.

Note that case 0 doesn't need to check for model 2, because clearing
idxe and idxb yields the correct settings on a model 1: indexing is off.
This commit is contained in:
Bob Supnik 2018-06-05 17:05:25 -07:00 committed by Mark Pizzolato
parent b007669ad5
commit f6f4fe6c3c

View file

@ -1,6 +1,6 @@
/* i1620_cpu.c: IBM 1620 CPU simulator /* i1620_cpu.c: IBM 1620 CPU simulator
Copyright (c) 2002-2017, Robert M. Supnik Copyright (c) 2002-2018, 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"),
@ -26,6 +26,7 @@
This CPU module incorporates code and comments from the 1620 simulator by This CPU module incorporates code and comments from the 1620 simulator by
Geoff Kuenning, with his permission. Geoff Kuenning, with his permission.
05-Jun-18 RMS Fixed bug in select index A (COVERITY)
23-Jun-17 RMS BS should not enable indexing unless configured 23-Jun-17 RMS BS should not enable indexing unless configured
15-Jun-17 RMS Added more information to IO in progress message 15-Jun-17 RMS Added more information to IO in progress message
26-May-17 RMS Added deferred IO mode for slow devices 26-May-17 RMS Added deferred IO mode for slow devices
@ -975,7 +976,7 @@ while (reason == SCPE_OK) { /* loop until halted */
break; break;
case 1: case 1:
if ((cpu_unit.flags & IF_IDX) != 0) /* indexing present? */ if ((cpu_unit.flags & IF_IDX) != 0) /* indexing present? */
idxe = 1; idxb = 0; /* index band A */ idxe = 1, idxb = 0; /* index band A */
break; break;
case 2: case 2:
if ((cpu_unit.flags & IF_IDX) != 0) /* indexing present? */ if ((cpu_unit.flags & IF_IDX) != 0) /* indexing present? */