Page 1 of 1

Anyone use GAS instead of NASM?

Posted: Wed Jan 02, 2008 9:13 pm
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.

Posted: Wed Jan 02, 2008 11:12 pm
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.

Posted: Wed Jan 02, 2008 11:39 pm
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

Posted: Wed Jan 02, 2008 11:50 pm
by ucosty
Incidentally I have my repo links on my site (linky in sig).

Posted: Thu Jan 03, 2008 1:53 am
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.

Posted: Thu Jan 03, 2008 2:06 am
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.

Posted: Thu Jan 03, 2008 12:03 pm
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]

Posted: Thu Jan 03, 2008 12:11 pm
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.

Posted: Thu Jan 03, 2008 1:29 pm
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...

Posted: Thu Jan 03, 2008 2:05 pm
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?

Posted: Thu Jan 03, 2008 2:45 pm
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.

Posted: Thu Jan 03, 2008 2:52 pm
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
-><-<-

Posted: Thu Jan 03, 2008 5:32 pm
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... ;)

Posted: Fri Jan 04, 2008 6:37 am
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...