Minor correction and last one, apologies for the spam. 037760, not
037756 is the address for the BPL instruction, fixed below.
On 12/23/15 10:30 PM, 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:
037760 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
[email protected]
http://mailman.trailing-edge.com/mailman/listinfo/simh