[Coco] assembly question

K. Pruitt pruittk at roadrunner.com
Sun Aug 9 00:04:23 EDT 2015


Awesome. Thank you, William.

----- Original Message ----- 
From: "William Astle"
Sent: Saturday, August 08, 2015 8:53 PM
Subject: Re: [Coco] assembly question


> DEC doesn't set C (carry) so any branch that relies on the setting of C 
> cannot be used meaningfully after DEC. That is the four "unsigned" 
> branches. DEC does, however, set N, Z, and V which means the signed 
> branches (which don't test C) do work as expected (since they use V, not 
> C).
>
> The reason INC and DEC do not affect C is so that they can be used for 
> iteration counting in multiple precision arithmetic.
>
> On 2015-08-08 21:32, K. Pruitt wrote:
>> I have an assembly question.
>>
>> How is the BCC operand any different than the BGE operand in the context
>> of using it on a counter?
>>
>> Here's the code example:
>>
>>               ldb  #$03
>> Loop      stb Counter
>>
>>               <do stuff here>
>>
>>               decb
>>               bcc Loop
>>
>> The idea is to take the counter from 3 to 0 and include 0 in the loop.
>> So four times through the loop.
>>
>> The code above does not work for me.  However, this code does:
>>
>>               ldb  #$03
>> Loop      stb Counter
>>
>>               <do stuff here>
>>
>>               decb
>>               bge Loop
>>
>> The only difference is the bge instead of the bcc. From the description
>> I read in Leventhal's book, bcc and bge sound functionally identical in
>> this context.
>> But they are not.
>>
>>
>>
>
>
> -- 
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco
> 



More information about the Coco mailing list