What will be the equivalent ATT code for the following intel code:
BIOS segment byte at 40h
org 13h
memory dw ?
BIOS ends
What will be the equivalent ATT code for the following intel code:
BIOS segment byte at 40h
org 13h
memory dw ?
BIOS ends
There's no equivalent for the AT 40h
attribute of a segment definition in AT&T syntax as used by the GNU assembler. GAS doesn't actually understand x86 segments and has no special support for them. Neither do the object formats supported by GAS, PECOFF and ELF. Note that sections (sometimes called segments) are not the same thing as x86 segments. Even modern versions of MASM don't support the AT attribute anymore.
If your MASM code uses the BIOS segment like in the following example:
BIOS segment byte at 40h
org 13h
memory dw ?
BIOS ends
_TEXT SEGMENT USE16
mov bx, OFFSET memory
mov ax, SEG memory
mov es, eax
_TEXT ENDS
Then you can do the equivalent in AT&T syntax with something like this:
memory = 0x04
memory_seg = 0x40
.text:
mov $memory, %bx
mov $memory_seg, %ax
mov %ax, %es
That's not a question of at&t syntax as such. It's a question of what assembler and linker you use. Also, I suppose you still need to load the segment register by hand. Thus the simplest case would be to get rid of that whole thing, and instead do something along these lines:
Depending on your requirements and the available tools, you can of course produce fancier code, but I don't see much point.