hi
i was converting an ordinary floppy into bootable via the following code which i downloaded from some site i dont remember. it works perfectly well but i m unable to understand some parts of the assembly code .if some one will please explain my questioins
source: (there is a makefile also)
------------
.code16
.text
.org 0x00
.global _start <============== why this "start" begins with an underscore while other labels do not?
_start:
mov $0x07C0,%ax
mov %ax,%ds
call booting
xor %dx,%dx
call working
call idleloop
ret
booting:
mov $boot,%si
call message
call nl
ret
message:
cld
lodsb
or %al,%al
jz done
mov $0xE,%ah
mov $7,%bx
int $0x10
jmp message
done:
ret
nl:
mov $newline,%si
call message
ret
working:
call nl
call nl
mov $device,%si
call message
call waitenter
inc %dx
cmp $3,%dx
je keyboard
jmp working
waitenter:
call nl
movw $cont,%si
call message
xor %ax,%ax
int $0x16
cmp 'T',%al
jz taz
cmp 't',%al
jz taz
cmp $13,%al
jnz waitenter
ret
keyboard:
call nl
call nl
movw $kbd,%si
call message
call nl
movw cont,%si
call message
ret
taz:
call nl
call nl
movw tazq,%si
call message
jmp waitenter
idleloop:
hlt
jmp idleloop
boot:
.ascii "Loading UniOS 1.1 Beta..."
newline:
.byte 10, 13, 0
device:
.ascii "Device not responding to SCSI command."
cont:
.ascii "Hit ENTER to continue..."
kbd:
.ascii "Keyboard not responding to SCSI command."
tazq:
.ascii "Yes, TazQ is an Internet crack monkey on wheels."
<========================== what is the function of the following few lines?
padlen:
.byte boottag - .
.fill 10,1,0
.org 510
boottag:
.word 0xAA55
=============== it seems the above few lines are writing AA55 to 510... th byte of boot sector which ofcourse will tell the BIOS that it is a bootable.but if these three lines can do the job why do we need the whole program?they r never referenced in the program will only this three lines make it a bootable?
thanks in advance.