Anyone use GAS instead of NASM?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
someprogr
Posts: 7
Joined: Mon Dec 24, 2007 12:44 pm

Anyone use GAS instead of NASM?

Post by someprogr »

Anyone out there developing or developed an OS using GNU GAS and C instead of NASM? Most of my assembly reference books cover GAS and not NASM, so im a little inclined to use that (and AT&T syntax) over NASM.

If anyone wrote their bootloader or OS in GAS, let me know if your source code is available out there somewhere. I've been looking up tutorials for the bootloader and OS dev but most cover NASM development only. Thanks in advance.
User avatar
ucosty
Member
Member
Posts: 271
Joined: Tue Aug 08, 2006 7:43 am
Location: Sydney, Australia

Post by ucosty »

My os is programmed in GAS and C++, if that counts. I don't have any low level code in GAS, though, except for the multiboot stuff.
The cake is a lie | rackbits.com
Pyrofan1
Member
Member
Posts: 234
Joined: Sun Apr 29, 2007 1:13 am

Post by Pyrofan1 »

yeah, mine uses mainly GAS, but i do have about 7 lines of intel asm. but you can use intel syntax if you put
.intel_syntax
at the top of your files
User avatar
ucosty
Member
Member
Posts: 271
Joined: Tue Aug 08, 2006 7:43 am
Location: Sydney, Australia

Post by ucosty »

Incidentally I have my repo links on my site (linky in sig).
The cake is a lie | rackbits.com
xyzzy
Member
Member
Posts: 391
Joined: Wed Jul 25, 2007 8:45 am
Libera.chat IRC: aejsmith
Location: London, UK
Contact:

Post by xyzzy »

I'm using GAS for all my initialization code (sets up the initial page directory and page table, jumps to higher half, sets stack, etc) , some of the fork code, ring 3 switch and task switch. So basically all of my ASM code ;) sloccount says I have 467 lines of it.
User avatar
devel
Member
Member
Posts: 62
Joined: Wed Nov 28, 2007 4:15 am
Contact:

Post by devel »

I'm using GAS too and if you are looking for bootloader code written in GAS then take a look
into freebsd source code. I think MBR code is in boot0.S file or something like that.

Regards,
devel.
Jeffrey
Posts: 20
Joined: Fri Jul 27, 2007 1:35 pm
Location: Virginia, USA

Post by Jeffrey »

Yeah, mine uses GAS.

As mentioned above, you simply have to put the following to enable Intel syntax.

Code: Select all

.intel_syntax noprefix
.intel_syntax <- enables usage of generic mneumonics like mov instead of movl

noprefix <- enables use of registers and other constants without the prefixes like $(..), %, etc.

All you have to do is place at the start of your .S files.[/code]
User avatar
ucosty
Member
Member
Posts: 271
Joined: Tue Aug 08, 2006 7:43 am
Location: Sydney, Australia

Post by ucosty »

I don't see the advantage of intel syntax if you're using GAS. It's not like AT&T style is any worse. Actually I found (with only one exception) AT&T style to be nicer than intel style.
The cake is a lie | rackbits.com
thegreatseph
Posts: 12
Joined: Wed Dec 19, 2007 6:40 pm

Post by thegreatseph »

ucosty wrote:I don't see the advantage of intel syntax if you're using GAS. It's not like AT&T style is any worse. Actually I found (with only one exception) AT&T style to be nicer than intel style.
The "advantage" is that if you are someone like me who used TASM and Turbo Pascal's inline assembly for years it can be very frustrating to move to another syntax. Familiarity is very important to most programmers...
Craze Frog
Member
Member
Posts: 368
Joined: Sun Sep 23, 2007 4:52 am

Post by Craze Frog »

Actually I found (with only one exception) AT&T style to be nicer than intel style.
It's a lot more typing! And the assigments are wrong:

Code: Select all

      C/Pascal/Basic/Everything except AT&T syntax:
eax = 5
      Intel syntax:
mov eax, 5
      AT&T syntax:
mov $5, %eax
Also, the AT&T syntax requires a shift+number combo and a altGr+number combo, which makes it more uncomfortable to type. How can it be nicer?
User avatar
djnorthyy
Member
Member
Posts: 49
Joined: Mon Apr 09, 2007 10:50 am
Location: UK, Hants
Contact:

Post by djnorthyy »

Also, the AT&T syntax requires a shift+number combo and a altGr+number combo, which makes it more uncomfortable to type. How can it be nicer?
It is up to personal choice.
Reflect Desktop Operating System - ' You only remember the name of the OS when it crashes '
Pyrofan1
Member
Member
Posts: 234
Joined: Sun Apr 29, 2007 1:13 am

Post by Pyrofan1 »

It's a lot more typing! And the assigments are wrong
i think it makes sense when you think of it like this
move $5 to %eax
because i read left to right so

Code: Select all

mov eax, 5
doesn't make much sense because my eyes have to move like this
-><-<-
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Post by Brynet-Inc »

Craze Frog wrote:Also, the AT&T syntax requires a shift+number combo and a altGr+number combo, which makes it more uncomfortable to type. How can it be nicer?
Don't blame a language because your keyboard layout is "inconvenient".

Languages like C and AT&T syntax flow nicely on EN-us/EN-ca keyboard layouts... ;)
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
User avatar
Solar
Member
Member
Posts: 7637
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Post by Solar »

Craze Frog wrote:It's a lot more typing!
...which results in the source carrying much more information, making it easier to read (in my opinion). I tend to read code much more often than writing it.
And the assigments are wrong...
The opcode is called "mov(e)". I move something from somewhere to somewhere. So I'd say the opcode is chosen badly. If it were called "@$$(ign)" or something like that, I'd be at peace with it.
Also, the AT&T syntax requires a shift+number combo and a altGr+number combo...
So do C/C++, Java, C# and a number of others...
Every good solution is obvious once you've found it.
Post Reply