and tried to convert the sample code, from intel to AT&T syntax.
But my putsrc procedure didn't work. can someone help me?
Code: Select all
.code16 # 16 bit code generation
.text
.global _start
_start:
jmpl $0x07C0, $start2 # Normalize the start address
start2:
movw $0x0000, %ax # Setup the Data Segment Register
movw %ax, %ds # ( 'movw $0x0000, %ds' will NOT work due to limitations on the CPU )
movw $helloworld, %si
call putstr
loop:
jmp loop # Put it into a coninuous loop to stop it running off into
# the memory running any junk it may find there.
putstr:
# Setup registers for interrupt call
movb $0x0E, %ah # Function to display a character on the screen ( teletype )
movb $0x00, %bh # Page number
movb $0x07, %bl # Text attribute ( 0x07 = White text, black background )
putstr.nc: # Label to loop arround for the next char
lodsb
orb %al,%al # Check for end of string
jz putstr.ret
int $0x10 # Run the BIOS video interrupt
jmp putstr.nc # Next character
putstr.ret:
ret
helloworld:
.asciz "Hello World!"
.org 510,0
.word 0xAA55 # Boot signature