[comp.sys.amiga] PD Assembler;Label errors!

billk@crash.UUCP (03/02/87)

Has anyone used the public domain 68000 MACRO Assembler (written by
W. WESLEY HOWE)???

It seems to be very nicely put together except for the fact that I'm having
trouble defining any sorts of labels at all.  I've tried all the different
ways of labeling things that the docs mention.  I've made *short* files to
try to find out what's wrong.  I.E:

LabelOne:       movea.l         #4,a0
                movea.l         (a0),a0
                bra LabelTwo

LabelTwo        move.l          a0,_ExecBase    ; colon on label name
                beq NoExec                      ; purposely omitted

      NoExec:   rts

...this code is the kind of stuff I was writing to try to determine what in my
LARGE file had caused the errors.   In a file as small as the one above, the
same problems would occur.  Whenever I define *any* label, I get:

***** 45  Label value changed between passes.

...and I get this for each label defined!  Gack!

Does anyone have any idea what the (CENSORED) is going on?

Thanks,

NAME: Bill Kelly
UUCP: {akgua, hplabs!hp-sdd, sdcsvax}!crash!pnet01!billk
ARPA: crash!pnet01!billk@nosc
INET: billk@pnet01.CTS.COM
USPS: 2507 Caminito La Paz      "We buy your old junk
      La Jolla, CA  92037        and sell fine furnature..."
FONE: (619) 454-1307

tim@amdcad.UUCP (03/02/87)

In article <859@crash.CTS.COM> billk@pnet01.CTS.COM (Bill Kelly) writes:
>
>LabelOne:       movea.l         #4,a0
>                movea.l         (a0),a0
>                bra LabelTwo
>
>LabelTwo        move.l          a0,_ExecBase    ; colon on label name
>                beq NoExec                      ; purposely omitted
>
>      NoExec:   rts
>
>...this code is the kind of stuff I was writing to try to determine what in my
>LARGE file had caused the errors.   In a file as small as the one above, the
>same problems would occur.  Whenever I define *any* label, I get:
>
>***** 45  Label value changed between passes.

The MC68020 User's Manual states

	" Note: A short branch to the immediately following instruction
	  cannot be generated, because it would result in a zero offset,
	  which forces a word branch instruction definition."

The assembler assumes in pass 1 that the displacement of the branch
label can fit in an 8-bit field, and doesn't know the actual
displacement until the end of pass1 (since it is a forward reference). 
Then in pass2, it discovers that the branch matches the above condition,
and changes the displacement size to 16-bits.  This causes further
labels to now be off by 1 byte from pass1 to pass2, hence the error
message you see.  You will somehow have to force the branch to use the
16-bit displacement mode in pass1 (sorry, I don't know the syntax for
your assembler.)

	-- Tim Olson
	Advanced Micro Devices
	tim@amdcad

dillon@CORY.BERKELEY.EDU.UUCP (03/02/87)

	This is what is known as a phase error.  Somewhere in your code
the assembler assumed an instruction was a certain size and then in pass2
found that it was actually larger.  Usually, the instruction in question is
a FORWARD branch.  Since the destination label isn't defined yet, the
assembler assumes the branch can be done with an 8 bit displacement.  When
pass2 rolls around, BOOM, the forward branch suddenly becomes a 16 bit
displacement (assuming the label is sufficiently far away) and you get a phase
error.  The phase error is usually detected in pass2 when a program label's
address is found to be different than in pass1.

			-Matt


In article <859@crash.CTS.COM> billk@pnet01.CTS.COM (Bill Kelly) writes:
>
>LabelOne:       movea.l         #4,a0
>                movea.l         (a0),a0
>                bra LabelTwo
>
>LabelTwo        move.l          a0,_ExecBase    ; colon on label name
>                beq NoExec                      ; purposely omitted
>
>      NoExec:   rts
>
>...this code is the kind of stuff I was writing to try to determine what in my
>LARGE file had caused the errors.   In a file as small as the one above, the
>same problems would occur.  Whenever I define *any* label, I get:
>
>***** 45  Label value changed between passes.

higgin@cbmvax.UUCP (03/03/87)

In article <859@crash.CTS.COM> billk@pnet01.CTS.COM (Bill Kelly) writes:
$Has anyone used the public domain 68000 MACRO Assembler (written by
$W. WESLEY HOWE)???
$

I haven't.

$It seems to be very nicely put together except for the fact that I'm having
$trouble defining any sorts of labels at all.  I've tried all the different
$ways of labeling things that the docs mention.  I've made *short* files to
$try to find out what's wrong.  I.E:
$
$LabelOne:       movea.l         #4,a0
$                movea.l         (a0),a0
$                bra LabelTwo
$
$LabelTwo        move.l          a0,_ExecBase    ; colon on label name
$                beq NoExec                      ; purposely omitted
$
$      NoExec:   rts
$
$...this code is the kind of stuff I was writing to try to determine what in my
$LARGE file had caused the errors.   In a file as small as the one above, the
$same problems would occur.  Whenever I define *any* label, I get:
$
$***** 45  Label value changed between passes.
$
$...and I get this for each label defined!  Gack!
$
$Does anyone have any idea what the (CENSORED) is going on?
$
$Thanks,
$
$NAME: Bill Kelly
$UUCP: {akgua, hplabs!hp-sdd, sdcsvax}!crash!pnet01!billk
$ARPA: crash!pnet01!billk@nosc
$INET: billk@pnet01.CTS.COM
$USPS: 2507 Caminito La Paz      "We buy your old junk
$      La Jolla, CA  92037        and sell fine furnature..."
$FONE: (619) 454-1307

Perhaps the assembler REQUIRES that you specify whether you're doing long
or short branches.  That is beq.s or beq.l, etc.

Maybe this causes errors between passes.

	Paul.