Jerome H. Fine wrote:
I normally attempt to delete anything from previous
posts which is
not essential. Here, I can't find anything that can easily be omitted
from
the previous record.
FIRST - I want to apologize for misleading Johnny when I sort of stated
that I had obtained the results by running on a PDP-11 when in fact the
most recent activity was ONLY under E11. I had previously made a
number of tests on a real DEC PDP-11/73 (KDJ11-AB) and found
results (IF I REMEMBER CORRECTLY) which seem to agree
with the results on the real DEC PDP-11/44, SPECIFICALLY the
second last test of 65536. / 2. => -32768. QUO / 0. REM
In general, I remember that as long as the value in R0 was LESS
than the divisor, then the quotient was correct even if overflow did
occur. Then meant that for both values initially being positive, the
quotient can be greater than 32767. which appears to be negative
but which is actually an unsigned 16 bit integer. So, the best example
if you can do the test again on both systems is:
196607. / 3. => 65535. QUO / 2. REM OR in OCTAL
R0 = 2, R1 = 177777, R2 = 3 produces R0 = 177777, R1 = 2, R2 = 3
likely the v bit and n bit will be set, but the key point is that as long
as R0 is initially LESS than the divisor in R2, then the divide operation
is attempted. THEN, the full 16 bit unsigned integer result seems to
appear in R0 even if the v bit is set when the QUO exceeds 32767.
I added the
suggested test case 196607./3. to the DIV test, and here are the
results from both SIMH and the 11/44. The suggested behavior above does not
hold true. In both instances for this test case (the second lines) the
result
registers are unchanged, and the V-bit is set. The quotient result is not
the low 16b of the 32b quotient, but is the source register unaltered.
Don North
Here's the result from SIMH:
local[516] pdp11 divtest.ini
PDP-11 simulator V3.5-0
DIV Test of 'div r2,r0'
..R0.. ..R1.. ..R2.. ....NUM... ..DEN.. => ..R0.. ..R1.. ..R2.. NZVC
..QUO.. ..REM..
000003 000004 000003 196612. 3. => 000003 000004 000003
0010 3. 4.
000002 177777 000003 196607. 3. => 000002 177777 000003
0010 2. -1. <---
000000 000000 000000 0. 0. => 000000 000000 000000
0111 0. 0.
000001 000001 000000 65537. 0. => 000001 000001 000000
0111 1. 1.
000000 001000 000010 512. 8. => 000100 000000 000010
0000 64. 0.
000000 001234 000021 668. 17. => 000047 000005 000021
0000 39. 5.
000010 001234 005432 524956. 2842. => 000270 003754 005432
0000 184. 2028.
012345 012345 054321 350557413. 22737. => 036071 051134 054321 0000
15417. 21084.
012345 012345 000005 350557413. 5. => 012345 012345 000005 0010
5349. 5349.
000000 040000 000002 16384. 2. => 020000 000000 000002 0000
8192. 0.
000000 100000 000002 32768. 2. => 040000 000000 000002 0000
16384. 0.
000001 000000 000002 65536. 2. => 000001 000000 000002
0010 1. 0.
000002 000000 000002 131072. 2. => 000002 000000 000002
0010 2. 0.
Goodbye
HALT instruction, PC: 000010 (000012)
Goodbye
local[517]
and here's the result from a real PDP-11/44:
>s 1000
(Program)
DIV Test of 'div r2,r0'
..R0.. ..R1.. ..R2.. ....NUM... ..DEN.. => ..R0.. ..R1.. ..R2.. NZVC
..QUO.. ..REM..
000003 000004 000003 196612. 3. => 000003 000004 000003
0010 3. 4.
000002 177777 000003 196607. 3. => 000002 177777 000003
0010 2. -1. <---
000000 000000 000000 0. 0. => 000000 000000 000000
0011 0. 0.
000001 000001 000000 65537. 0. => 000001 000001 000000
0011 1. 1.
000000 001000 000010 512. 8. => 000100 000000 000010
0000 64. 0.
000000 001234 000021 668. 17. => 000047 000005 000021
0000 39. 5.
000010 001234 005432 524956. 2842. => 000270 003754 005432
0000 184. 2028.
012345 012345 054321 350557413. 22737. => 036071 051134 054321 0000
15417. 21084.
012345 012345 000005 350557413. 5. => 012345 012345 000005 0010
5349. 5349.
000000 040000 000002 16384. 2. => 020000 000000 000002 0000
8192. 0.
000000 100000 000002 32768. 2. => 040000 000000 000002 0000
16384. 0.
000001 000000 000002 65536. 2. => 100000 000000 000002 0010
-32768. 0.
000002 000000 000002 131072. 2. => 000002 000000 000002
0010 2. 0.
Goodbye
(Console)
Halted at 165146