English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 01 January 2016, 17:58   #1
MintyTheCat
 
Posts: n/a
GNU GAS Immediate data misbehaving

Hello all,

when I use older 68K Assemblers this is fine:

Code:
move.L #'Hello!',(a3)
This does not work under GNU GAS though and a I get a syntax error - what am I doing wrong?

Cheers,

Minty.
 
Old 01 January 2016, 19:15   #2
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 55
Posts: 2,006
Quote:
Originally Posted by MintyTheCat View Post
Hello all,

when I use older 68K Assemblers this is fine:

Code:
move.L #'Hello!',(a3)
This does not work under GNU GAS though and a I get a syntax error - what am I doing wrong?

Cheers,

Minty.
Too long string.
You can use
Code:
move.l #'Hell',(a3)
move.w #"o!", 4(A3)
Don_Adan is offline  
Old 01 January 2016, 19:19   #3
MintyTheCat
 
Posts: n/a
Quote:
Originally Posted by Don_Adan View Post
Too long string.
You can use
Code:
move.l #'Hell',(a3)
move.w #"o!", 4(A3)
Sorry, I put in an example without thinking:

for the general form of:

Code:
move.B #'A',d1
Usually this is fine under other Assemblers for the 68K that I have used but not for my GNU Assembler - any ideas?
 
Old 01 January 2016, 20:18   #4
copse
Registered User
 
Join Date: Jul 2009
Location: Lala Land
Posts: 539
Quote:
Originally Posted by MintyTheCat View Post
Usually this is fine under other Assemblers for the 68K that I have used but not for my GNU Assembler - any ideas?
Yes. Post the error it causes.
copse is offline  
Old 01 January 2016, 20:56   #5
MintyTheCat
 
Posts: n/a
Quote:
Originally Posted by copse View Post
Yes. Post the error it causes.
Sorry, guys - it has been a long day and I messed things up.

This works fine:

Code:
move.B #'AB',d1
But I had used the double-quotes as I would for Strings in C as:

Code:
move.B #"AB",d1
To which we get the GNU AS error as:

Code:
Error: syntax error -- statement 'move.b #"AB",d1' ignored
Thank you all for your help and I apologise for making a silly mistake.

Cheers.
 
Old 01 January 2016, 21:08   #6
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,510
Quote:
Originally Posted by MintyTheCat View Post
Code:
Error: syntax error -- statement 'move.b #"AB",d1' ignored
Most Amiga assemblers make no differences between ' and ". But GNU-as does.
phx is offline  
Old 01 January 2016, 21:49   #7
MintyTheCat
 
Posts: n/a
Quote:
Originally Posted by phx View Post
Most Amiga assemblers make no differences between ' and ". But GNU-as does.
Yes, as I found out

Still, all part of the fun.
 
Old 01 January 2016, 23:34   #8
MintyTheCat
 
Posts: n/a
Quote:
Originally Posted by Don_Adan View Post
Too long string.
You can use
Code:
move.l #'Hell',(a3)
move.w #"o!", 4(A3)
I seem to still be having issues with GAS:

For this:

Code:
move.l #'Hell',(a3)
I get the error as:

Code:
Error: syntax error -- statement 'move.l #72e1144(a3)' ignored
Puzzling, any ideas, anyone?
 
Old 01 January 2016, 23:46   #9
alkis
Registered User
 
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 719
Replace # with $
(source http://stackoverflow.com/questions/3...eplace-numbers )
alkis is offline  
Old 02 January 2016, 00:11   #10
MintyTheCat
 
Posts: n/a
Quote:
Originally Posted by alkis View Post
I see how that is meant to work for x86 but for 68K not.

I get now:

Code:
move.W $'A',(a3)

undefined reference to '$65'
So GAS must be taking it as Absolute now.

This is odd that.

I am using these GAS switches:

AS_FLAGS:= -D -R -mcpu=68000 --bitwise-or --traditional-format --register-prefix-optional --statistics -I $(SRC)

The switches in red are 68K GAS specific.
 
Old 02 January 2016, 01:58   #11
alkis
Registered User
 
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 719
Well, this works

Code:
	.text
	.even
	.globl	_foo
_foo:
	movel #('H'<<24|'E'<<16|'L'<<8|'L'),d0
	rts
Yeah, it's ugly.

Code:
#include <stdio.h>
int foo(void);
int main(int argc, char **argv)
{
  char buf[5];
  buf[4]='\0';

  int i = foo();
  
  strncpy(buf, (char *)&i, 4);
  
  printf("%s\n",buf);
  printf("%X\n",i);
  return 0;
}
Those two work as expected, compiled with:
m68k-amigaos-gcc -o tas t.c t.s -Wa,--bitwise-or
alkis is offline  
Old 02 January 2016, 11:04   #12
MintyTheCat
 
Posts: n/a
Quote:
Originally Posted by alkis View Post
Well, this works

Code:
	.text
	.even
	.globl	_foo
_foo:
	movel #('H'<<24|'E'<<16|'L'<<8|'L'),d0
	rts
Yes, that is very ugly.

I find it impossible to believe that GNU GAS does not permit string literals, for a start it would mean that much of the older 68K code assembled with Assemblers of the day which did permit it would not assemble with GAS.

I may end up having to look in the GAS src at this rate.

Thanks for trying that out, Alkis.

Last edited by MintyTheCat; 02 January 2016 at 11:40.
 
Old 02 January 2016, 18:59   #13
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,510
Quote:
Originally Posted by MintyTheCat View Post
I find it impossible to believe that GNU GAS does not permit string literals, for a start it would mean that much of the older 68K code assembled with Assemblers of the day which did permit it would not assemble with GAS.
The main intention behind the development of the GNU assembler certainly was to assemble compiler output. It doesn't offer a lot of comfort for the pure 68k coder.

May I ask what you want to achieve? There are dozens of really good assemblers on the Amiga. Nobody would deliberately use gas for program development.
phx is offline  
Old 03 January 2016, 10:58   #14
MintyTheCat
 
Posts: n/a
Quote:
Originally Posted by phx View Post
The main intention behind the development of the GNU assembler certainly was to assemble compiler output. It doesn't offer a lot of comfort for the pure 68k coder.

May I ask what you want to achieve? There are dozens of really good assemblers on the Amiga. Nobody would deliberately use gas for program development.
May I disagree with you on this? GNU GAS is a fine Assembler.

I seem to have found a bug in this version of GAS. I will be looking into this further.

I have used GAS for many projects now. My main concern is that I want the flexibility of GAS and the Binutils and I want to know that my toolchain will be supported into the future.
 
Old 03 January 2016, 16:01   #15
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,510
Quote:
Originally Posted by MintyTheCat View Post
I want to know that my toolchain will be supported into the future.
The GNU binutils and compiler people don't care for anything other than x86 or ARM. Other targets are slowly bit-rotting and finally removed...
phx is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Tool to convert asm to gnu asm (gas) Asman Coders. Asm / Hardware 13 30 December 2020 11:57
Preparing a CF from GNU/Linux iddqd support.FS-UAE 1 21 June 2015 10:09
Auto-config of games in DB misbehaving TenLeftFingers support.FS-UAE 4 13 March 2014 15:11
OS3.9 Gnu C Compiler Environment help Morbane Coders. General 0 06 January 2012 08:35
Misbehaving CD32 - Odd Problems Fingerlickin_B support.Hardware 39 28 January 2010 19:20

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:27.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.10672 seconds with 13 queries