[Coco] Assembler Question???

uhmgawa uhmgawa at third-harmonic.com
Wed Sep 2 13:45:41 EDT 2009

jdaggett at gate.net wrote:
> To the list:
> I have started looking at two FPGA cores for the 6809 in altering one of them to handle 
> 6309 opcodes and stumbled across a potential  issue. As far as I can remember the 
> Motorola Freeware Assemblers treat subtraction as adding the 2's compliment of the 
> subtrahend. Also I seem to remember that is how the internal workings of the MC6809 
> is. There is actually no subtractor but the assemly code has the 2's compliment of the 
> subtrahend and does addition.

I don't believe that is the case as a subtract
operation sets the carry to the inverse of that
resulting from an add operation.  So in this
respect subtraction of x and addition of -x
aren't trivially interchangeable.

Internally the ALU may well negate the subtrahend,
perform an addition, and invert the carry bit,
with this modification of an underlying add operation
being keyed by a subtraction opcode.

uhmgawa at third-harmonic.com

More information about the Coco mailing list