Problem trying to convert Babystep2 to AT&T assembler
Posted: Wed Mar 12, 2014 5:49 pm
Hi,
I am trying to convert the Babystep2 (http://wiki.osdev.org/Babystep2) tutorial to AT&T assembler format:
However, when looking at the disassembled code, I see that $msg gets translated to 0x0. Changing $msg to $(msg-main) gives the correct value, but that is just ugly When googling around I see similar code just using the single label ($msg).
I am puzzled, can anyone explain why this happens and how to fix it properly?
I am trying to convert the Babystep2 (http://wiki.osdev.org/Babystep2) tutorial to AT&T assembler format:
Code: Select all
.code16
main:
movw $0x07c0,%ax
movw %ax,%ds
movw $msg,%si # XXX $msg translated to 0x0???
ch_loop:
lodsb
or %al,%al
jz hang
movb $0xe,%ah
int $0x10
jmp ch_loop
hang:
jmp hang
msg: .asciz "Hello, World!\r\n"
.org 510
.hword 0xaa55
I am puzzled, can anyone explain why this happens and how to fix it properly?