[Coco] is this a bug?
Robert Gault
robert.gault at att.net
Wed Apr 19 22:45:13 EDT 2017
Dave Philipsen wrote:
> Is this a bug with the OS9 assembler? It appears that the first pass interprets the "jmp" as direct
> addressing while the second pass interprets it as extended which causes a phasing error. Am I
> missing something?
>
> If I force it with "jmp >entry" it works.
>
> Dave
>
>
>
> Microware OS-9 Assembler RS Version 01.00.00 04/19/2017 19:43:30 Page 001
> -
>
> 00001
> 00002
> 00003 opt M
> 00004
> 00005 2000 org $2000
> 00006 W 2000 7E2006 start jmp entry
> 00007 2003 54455354 fcc /TEST/
> ***** Error: phasing
> 00008 E 2007 12 entry nop
> 00009 end
>
> 00001 error(s)
> 00001 warning(s)
> $0008 00008 program bytes generated
> $0000 00000 data bytes allocated
> $0086 00134 bytes used for symbols
>
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.
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.
Robert
More information about the Coco
mailing list