This is the mail archive of the crossgcc@cygnus.com mailing list for the crossgcc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: m68k: GAS equvivalent of DS.B


>
>The equivalent MRI directives in GAS :
>	MRI	|	GAS
>------------------------------------------
>	DS.B	|	.comm	label,1
>	DS.W	|	.comm	label,2
>	DS.L	|	.comm	label,4

Although maybe not documented anywhere but in the source, recent versions
of GAS support a bunch of things which make portation of Motorola format
assembler code somewhat easier.  GAS 2.9.1 will recognize:

	.ds.b
	.ds.w
	.ds.l
	.dcb.b
	.dcb.w
	.dcb.l

as well as:
	.space
	.skip

The behavior of the .ds directives is subtly different from that of the
.space directive and for some reason which I can't remember right now, I
changed everything to use .space.  We mostly use this with the .struct
directive to define structure offsets which parallel structures in C.

I believe that .comm specifically creates a symbol in the "COMMON" section.
If you want to skip forward in a specific program section, I think you
want to use one of the above directives.

>GAS use MIT syntax which is slightly different from Motorola syntax.
>To specify register with GAS, you must delete "." in mnemonics, add %
>for register,
>add @ for indirect addressing, and invert the position of displacement
>in 
>indirect with displacement addressing, for ex.:
>	MRI			|	GAS
>---------------------------------------------------------------
>	move.l (A2), D0		|	movel %A2@, %D0
>	lea DELETE, A2		|	lea DELETE, %A2
>	clr.l 8(A2)		|	clrl %A2@(8)

Actually almost all of the Motorola opcode and operand syntax is recognized
by GAS.  I've converted a lot of assembler code by globally replacing the
register names and compiler directives.  So if you have exisiting Motorola
format assembler code, you don't need to rewrite the operand syntax.
Thus:
	move.l (A2), D0		->	move.l (%a2),%d0
	lea DELETE, A2		->	lea DELETE,%a2
	clr.l 8(A2)		->	clr.l 8(%a2)

Art

________________________________________________
To get help for the crossgcc list, send mail to
crossgcc-request@cygnus.com with the text 'help'
(without the quotes) in the body of the message.