[Coco] assembly question

James Ross jrosslist at outlook.com
Sun Aug 9 18:44:45 EDT 2015


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
 		 	   		  


More information about the Coco mailing list