<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<br>
<br>
<div class="moz-cite-prefix">On 12/23/15 5:09 PM, Johnny Billquist
wrote:<br>
</div>
<blockquote cite="mid:567B29B6.6000707@softjar.se" type="cite"> <br>
As for your analysis:
<br>
Your explanation of branches seems somewhat over complicated. The
instruction is indeed in just 8 bits, while 8 bits are the offset.
<br>
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.
<br>
(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.)
<br>
<br>
</blockquote>
Johnny,<br>
<br>
Given Line 7
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<span style="font-family: "Courier
New",Courier,monospace;">037760 100376 BPL
WAIT</span><br>
<br>
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?<br>
<br>
Thanks,<br>
<br>
Will<br>
</body>
</html>