[Coco] 6309 andcc z,v ?

Robert Gault robert.gault at worldnet.att.net
Mon Jun 11 22:47:05 EDT 2007


Roger Taylor wrote:
> While looking through an "as09.exe" assembler test file, I noticed the 
> following line:
> 
>                 andcc   z,v                         ; alternate
> 
> And the source code assembles without errors!  You would think the 
> author meant, "exg z,v" but even that is strange unless he means "0,v" 
> since "0" is actually the name of a 6309 register.  Actually, there's 
> two 0 registers, so in CCASM I call them "0" and "00" I think.  I might 
> add the "z" name in case someone is used to it, but still... what the 
> heck is andcc z,v, and what does it do?
> 
> Examining the code stream, I see that the opcodes for the above 
> instruction are:
> 
> $1C $F9
> 
> I'm not able right now to spend time running this through a debugger to 
> watch the CPU registers, so if anyone wants to check this out and post 
> your findings, please let us know what happens!
> 

As others have stated, regCC has bits assigned E,F,H,I,N,Z,V,C. The 
problem with that notation is interpreting what AND means in this context.

You can AND with either 0 or 1. The instruction ANDCC z,v is ambiguous 
in that it does not indicate what value is being used. The Motorola 
approved syntax is ANDCC #n and in this context the code could be either 
ANDCC #%00000110 or ANDCC #%11111001. Both separate bits z,v from the 
rest, but one keeps only z,v and the other keeps all but z,v.

Whatever as09.exe intended, this is not a syntax that should be used 
with 6309 code where there actually is a V register.



More information about the Coco mailing list