[Coco] assembly question

K. Pruitt pruittk at roadrunner.com
Sun Aug 9 21:33:36 EDT 2015


That's a very nice reference document. Thanks for posting the link.

Honestly I never paid much attention to the various flags unless I was 
checking for a clear or set status to check for an error or when doing bit 
by bit stuff. Lot of stuff involved here. I can see how a greater 
understanding of these flags would not only result in more reliable code, 
but there is a lot of programming power to be unleashed from utilizing all 
these flags properly.


----- Original Message ----- 
From: "James Ross" <jrosslist at outlook.com>
To: "CoCoList for Color Computer Enthusiasts" <coco at maltedmedia.com>
Sent: Sunday, August 09, 2015 3:44 PM
Subject: Re: [Coco] assembly question


> In the guide 
> http://www.coco3.com/community/wp-content/uploads/2010/03/6x09_Instruction_Sets.pdf
>
> Page 57 DEC in all its forms effects the N, Z, V flags
>
> N -- The Negative flag is set equal to the new value of the accumulators 
> high-order bit.
>
> So the flag you want to check is the N flag and the branch is BPL
>
> Page 42 BPL Branch If Plus (IF CC.N = 0 then branch)
>
> Is the proper branch in the case of your loop...
>
> So when B=0 and you DECB and B=FF (N is now set)
>
> B=3 starting value
> DECB B=2 N=0 (branch)
> DECB B=1 N=0 (branch)
> DECB B=0 N=0 (branch)
> DECB B=FF (-1) N=1 (don't branch)
>
> Anybody can correct me if I am wrong...
>
> James
>
>
> ----------------------------------------
>> From: pruittk at roadrunner.com
>> To: Coco at maltedmedia.com
>> Date: Sat, 8 Aug 2015 20:32:50 -0700
>> Subject: [Coco] assembly question
>>
>> 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
>
>
> -- 
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco
> 



More information about the Coco mailing list