[Simh] Writeup of PDP-11 bootstrap loader analysis

Will Senn will.senn at gmail.com
Wed Dec 23 20:02:37 EST 2015



On 12/23/15 5:09 PM, Johnny Billquist wrote:
>
> As for your analysis:
> Your explanation of branches seems somewhat over complicated. The 
> instruction is indeed in just 8 bits, while 8 bits are the offset.
> However, there is no need to mess things up with one-complement, or 
> tricks like that. The offset is an 8-bit value. Sign extend to 16 
> bits. Multiply by 2, and add to the updated PC. Simple as that.
> (Note that I said "updated PC". The PC will contain the address of the 
> instruction after the branch before you start doing the calculation 
> for the branch destination.)
>
Johnny,

Given Line 7 037760  100376               BPL WAIT

100376 is a BPL instruction and the offset (376) is to be multiplied by 
two and added to the updated PC. That is, 376 * 2 is going to be added 
to 037762. 376 represents a negative offset in two's complement notation 
- it has a one in it's most significant bit, the left hand bit in 11 111 
110. As a human, I kind of need the number in some form that makes sense 
to me, so I convert it to a positive quantity by first taking the one's 
complement and adding one. This gives me the positive magnitude of the 
negative number -1. Multiplying this by two is easy, it's -2, which when 
added to 037762 yields 037760 , which is the correct location. This is 
how I did the math. If I understand you correctly, the machine doesn't 
do it this way. I tried multiplying 376, 11 111 110 by shifting left 
one, 11 111 100, and adding that to 037762's binary representation, but 
that doesn't seem to make sense. Would you please elaborate?

Thanks,

Will
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.trailing-edge.com/pipermail/simh/attachments/20151223/373a0a66/attachment.html>


More information about the Simh mailing list