[Simh] Writeup of PDP-11 bootstrap loader analysis

Johnny Billquist bqt at softjar.se
Thu Dec 24 08:22:27 EST 2015


Will, you got it. :-)
I didn't check through my inbox before writing my replies, and Paul 
already put you on track.

	Johnny

On 2015-12-24 05:30, Will Senn wrote:
>
>
> 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,
>
> OK. I think I figured out how to think about the BPL. Given the machine
> code:
>
> 037756  100376
>
> It is a BPL instruction to the updated PC + (2 * offset). The offset is
> given as 376, in binary, sign extended 1 111 111 111 111 110, shifting
> it left to multiply by 2 (there's a carry out that we can ignore)
> results in  1 111 111 111 111 100. Adding the result to the updated PC,
> 037762, results in binary 0 011 111 111 110 010 (there's another carry
> out we can ignore). The math looks like this:
>
>    1 111 111 111 111 100 (2 * offset 376 sign extended)
> + 0 011 111 111 110 010 (PC = 037762)
> -----------------------
>    0 011 111 111 101 110 (037756)
>
> I can see that this is a better, simpler explanation and more in line
> with how the machine processes the instruction.
>
> Thanks,
>
> Will
>
> _______________________________________________
> Simh mailing list
> Simh at trailing-edge.com
> http://mailman.trailing-edge.com/mailman/listinfo/simh

-- 
Johnny Billquist                  || "I'm on a bus
                                   ||  on a psychedelic trip
email: bqt at softjar.se             ||  Reading murder books
pdp is alive!                     ||  tryin' to stay hip" - B. Idol


More information about the Simh mailing list