[Coco] assembly language question.
Gene Heskett
gene.heskett at verizon.net
Wed Feb 3 22:50:47 EST 2010
On Wednesday 03 February 2010, William Astle wrote:
>Gene Heskett wrote:
>> Greets all;
>>
>> I've read through the moto programmers manual for the 6809 for the cmp
>> functions, and am still confused. The cmp function is a subtract
>> function where the answer is thrown away, only affecting the CC flags so
>> that a following beq or blo will take the correct jump. But somehow, it
>> isn't clear which is subtracted from what.
>>
>> Given that regs.x contains $02FA, and that the integer memory location
>> referenced by LblName contains $000A, will the blo take, or be ignored
>> here?
>>
>> cmpx <LblName memory address in DP that holds the $000A above
>> blo somewhere else
>
>The subtraction in CMP is exactly equivalent to SUB. That is, the
>operand is subtracted from the register. In this case, the subtraction
>is $02FA-$000A giving $02F0 with C=0, N=0, V=0, Z=0.
>
>In this case, the condition will be false so no branch will be taken.
>(BLO is the same as BCS or branch if C=1).
>
>Thus, in the above, if X is less than the value at LblName (unsigned),
>the branch is taken; otherwise it's not.
>
Which is the general understanding I had too, but was getting confused about
because stuff isn't working quite right in sc6551.dr. Thanks William.
--
Cheers, Gene
"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
The price one pays for pursuing any profession, or calling, is an intimate
knowledge of its ugly side. -- James Baldwin
More information about the Coco
mailing list