Page 1 of 1

ATT question

Posted: Sat Jan 10, 2009 12:15 am
by yemista
Does anyone know that the equivalent of the nasm code times 510-($-$$) is under as syntax?

Re: ATT question

Posted: Sat Jan 10, 2009 12:18 am
by Love4Boobies
I have no clue what you just asked there. Could you please rephrase?

Re: ATT question

Posted: Sat Jan 10, 2009 12:21 am
by yemista
i need the code for as that will fill up the end of my bootsector with empty data to make it 512 bytes long

Re: ATT question

Posted: Sat Jan 10, 2009 12:30 am
by Love4Boobies
I'm assuming you're making a boot record or a boot sector and you need the 55AAH signature at the end. Anyway, your code was correct, I'm not sure why you thought there was a different syntax.

Code: Select all

times 510-($-$$) db 00h
dw 0aa55h ; x86-based systems are little-endian so you have 0aa55h instead 0f 55aah

Re: ATT question

Posted: Sat Jan 10, 2009 12:33 am
by yemista
yea that code works under nasm, but do you know what the equivalent is under gas? I converted my bootsector over and cant get it to work.

Re: ATT question

Posted: Sat Jan 10, 2009 4:42 am
by LMN
If you conclude your source code with

Code: Select all

.org 0x1fe
.word 0xaa55
it should be working. Btw. do you know

Code: Select all

.intel_syntax noprefix
directive? It lets you type assembler in more intel-ish style.

Re: ATT question

Posted: Sat Jan 10, 2009 6:21 am
by CodeCat

Code: Select all

.rept 510 - .
.byte 0x00
.endr
Might do the trick. Untested, though.

Re: ATT question

Posted: Sat Jan 10, 2009 8:12 am
by DeletedAccount
hint : dd , db , times etc are assembler directives :wink: .

Regards
Shrek

Re: ATT question

Posted: Sat Jan 10, 2009 10:39 am
by LMN
hint : dd , db , times etc are assembler directives :wink: .
But not for GNU assembler in either Intel or AT&T Syntax ;)

Re: ATT question

Posted: Sat Jan 10, 2009 12:56 pm
by yemista
lmn wrote:If you conclude your source code with

Code: Select all

.org 0x1fe
.word 0xaa55
it should be working. Btw. do you know

Code: Select all

.intel_syntax noprefix
directive? It lets you type assembler in more intel-ish style.
oh wow, do you have a link with more information? i hate att syntax because of all the unnecessary symbols, but i am just using it because i plan to develop under linux with gcc and it will be easier to integrate things.

Re: ATT question

Posted: Sat Jan 10, 2009 1:42 pm
by LMN
I dont think that Intel-syntax is widely used with gas, as nasm or yasm support this on unix. Therefore i also have no further documents about it. Basically everything is described in the documentation of GNU as, http://sourceware.org/binutils/docs/as/index.html. Everything else is revealed by google ;).