Hi Mike,
I've been trying to document issues with the available C -> PDP1 cross compiler and have run across an issue that may be related to how the simulator handles "shift" instructions across a 16-bit boundary. I've not been able to isolate the issue away from the compiler yet as there's a more fundamental issue with initializing integers larger than 12-bits. Just in case this is relevant the code I'm playing with shifts 3-bits (07) up from the low bits, up to the high bits and then back down again. Here's the C Code:
#define THREE_BITS 07
bits = THREE_BITS;
pdp1_puti(bits, OCTAL_BASE);
pdp1_putc(NL);
for(i=0 ; i < 5 ; i++) {
bits = bits << 3;
pdp1_puti(bits, OCTAL_BASE);
pdp1_putc(NL);
}
pdp1_putc(NL);
for(i=0 ; i < 6 ; i++) {
pdp1_puti(bits, OCTAL_BASE);
bits = bits >> 3;
pdp1_putc(NL);
}
pdp1_puti(bits, OCTAL_BASE);
pdp1_putc(NL);
which gives this output:
0
07
070
0700
07000
070000
0100000
0100000
030000
03000
0300
030
03
0
Looks like shifting up into the 16th, 17th, and 18th bits loses 2 out of the three bits but shifting back down again gains back one of the bits.
Might this be related to your random function misbehaving?
Regards,
--Alen