[Coco] is this a bug?

Dave Philipsen dave at davebiz.com
Thu Apr 20 00:58:34 EDT 2017



> On Apr 19, 2017, at 9:45 PM, Robert Gault <robert.gault at att.net> wrote:
> 
> 
> A phasing error normally means that the location of code changed during the first and second passes of the assembler. Typically this happens with forward addressing when the assembler can't decide whether long or short branches or direct or extended addressing is needed.
> 
> However, in your example there is another problem. :) Remove the opt M and try assembling this small amount of code. I think you will find that it compiles without any errors.
> Now with the opt M present, remove the org $2000 and it will compile without error.
> 

> Opt M turns on Motorola-compatible mode which is the default state and not needed. It should not confuse the address counter during assembly.

Ok, well actually I believe OPT -M is the default behavior for assembling OS9 program.  And, normally, one would not use ORG.  However, I am assembling a program for an OS9 bootloader which will reside at a specific location in memory so ORG is needed.


> 
> So there is probably is a bug in ASM. Your code generates extended addressing for Entry. Without the opt instruction, the code becomes $E $06, direct addressing. If you reverse the first two lines
> org $2000
> opt M
> you get more phasing errors. None of this should happen.
> 
> The only way to get this code to compile with direct addressing while including the opt M is as follows
> opt M
> org $2000
> start jmp <entry
> fcc /TEST/
> entry nop
> end
> 
> Clearly it should not be necessary to include the <. An assembler should optimize code on its own.
> 

Yes, I believe you are right. The OS9 assembler has a SETDP directive that could be used to force direct/extended addressing in some cases but it doesn't seem to work either.  So I guess if someone is keeping track of these sorts of things for the NitrOS9 repository it could be noted as a bug.  Don't know if anyone would ever get around to correcting it though.  This is the first time I have used the assembler to generate a non-OS9 object file so I'd never noticed the behavior before.  Fortunately I can just force the extended addressing for now.

Dave

> Robert
> 
> 
> -- 
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco



More information about the Coco mailing list