ATT question

Programming, for all ages and all languages.
Post Reply
User avatar
yemista
Member
Member
Posts: 299
Joined: Fri Dec 26, 2008 12:31 pm
Location: Boston
Contact:

ATT question

Post by yemista »

Does anyone know that the equivalent of the nasm code times 510-($-$$) is under as syntax?
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: ATT question

Post by Love4Boobies »

I have no clue what you just asked there. Could you please rephrase?
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
User avatar
yemista
Member
Member
Posts: 299
Joined: Fri Dec 26, 2008 12:31 pm
Location: Boston
Contact:

Re: ATT question

Post 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
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: ATT question

Post 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
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
User avatar
yemista
Member
Member
Posts: 299
Joined: Fri Dec 26, 2008 12:31 pm
Location: Boston
Contact:

Re: ATT question

Post 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.
User avatar
LMN
Posts: 16
Joined: Tue Dec 30, 2008 6:11 pm
Location: Germany

Re: ATT question

Post 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.
CodeCat
Member
Member
Posts: 158
Joined: Tue Sep 23, 2008 1:45 pm
Location: Eindhoven, Netherlands

Re: ATT question

Post by CodeCat »

Code: Select all

.rept 510 - .
.byte 0x00
.endr
Might do the trick. Untested, though.
DeletedAccount
Member
Member
Posts: 566
Joined: Tue Jun 20, 2006 9:17 am

Re: ATT question

Post by DeletedAccount »

hint : dd , db , times etc are assembler directives :wink: .

Regards
Shrek
User avatar
LMN
Posts: 16
Joined: Tue Dec 30, 2008 6:11 pm
Location: Germany

Re: ATT question

Post by LMN »

hint : dd , db , times etc are assembler directives :wink: .
But not for GNU assembler in either Intel or AT&T Syntax ;)
User avatar
yemista
Member
Member
Posts: 299
Joined: Fri Dec 26, 2008 12:31 pm
Location: Boston
Contact:

Re: ATT question

Post 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.
User avatar
LMN
Posts: 16
Joined: Tue Dec 30, 2008 6:11 pm
Location: Germany

Re: ATT question

Post 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 ;).
Post Reply