PDP10: Fixed last digit error in CVTBDT instruction as discussed in #347

This commit is contained in:
Mark Pizzolato 2016-11-05 12:38:15 -07:00
parent afad8ad374
commit d68c021d1f

View file

@ -1,6 +1,6 @@
/* pdp10_xtnd.c: PDP-10 extended instruction simulator /* pdp10_xtnd.c: PDP-10 extended instruction simulator
Copyright (c) 1993-2008, Robert M Supnik Copyright (c) 1993-2016, 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.
05-Nov-16 RMS Fixed last digit error in CVTBDT (Pascal Parent)
12-May-01 RMS Fixed compiler warning in xlate 12-May-01 RMS Fixed compiler warning in xlate
Instructions handled in this module: Instructions handled in this module:
@ -301,12 +302,12 @@ switch (xop) { /* case on opcode */
rs[0] = rs[0] - pwrs10[i][0] - (rs[1] < pwrs10[i][1]); rs[0] = rs[0] - pwrs10[i][0] - (rs[1] < pwrs10[i][1]);
rs[1] = (rs[1] - pwrs10[i][1]) & MMASK; rs[1] = (rs[1] - pwrs10[i][1]) & MMASK;
} }
if (xop == XT_CVTBDO) if (xop == XT_CVTBDO) /* offset? */
digit = (digit + xoff) & DMASK; digit = (digit + xoff) & DMASK;
else { else { /* translate */
f1 = Read (e1 + (int32) digit, MM_OPND); f1 = Read (e1 + (int32) digit, MM_OPND);/* get xlation */
if ((i == 1) && (AC(p3) & XT_LFLG)) if ((i == 1) && (AC(p3) & XT_MFLG)) /* last digit, minus? */
f1 = f1 >> 18; f1 = f1 >> 18; /* use left */
digit = f1 & RMASK; digit = f1 & RMASK;
} }
incstorebp (digit, p4, pflgs); /* store digit */ incstorebp (digit, p4, pflgs); /* store digit */