Something wrong with my bootstrap
Posted: Fri Mar 28, 2008 10:51 am
l have written a bootstrap boot.asm. It just print the string " load setup ...." which is not my want. i looked at it for a long time;nothing wrong found. Can some of you give me some tips?
The code is here:
and here is want my want:
load the second and third sector of floopy where my setup.s is at 0x07c00.
Then jump into setup.s.
but it does nothing but prints the first message.
Thanks all the tips.
The code is here:
Code: Select all
;-----------------------------------------------------------------------;
; boot.asm
;
[ORG 0x7c00]
jmp start
BOOTSEG equ 0x07c0
SYSSEG equ 0x1000
LOADSEG equ 0x07e0
;some print strings and val
msg1_load db "loading setup... "
msg2_ok db "loaded ok "
msg3_faile db "loaded faile "
sectors db 18
;----------------------------------;
; boot starts here ;
;----------------------------------;
start:
mov ax, [BOOTSEG]
mov es, ax
mov ds, ax
mov ss, ax
;set textmode
mov ax, 0x0003
int 0x10
mov ax, [BOOTSEG]
mov es, ax
;print "Loadint setup... "
mov dx, 0x0100
mov cx, 17
mov bx, 0x0007
mov bp, msg1_load
mov ax, 0x1301 ; write string, move cursor
int 0x10
load_setup:
mov ax, [LOADSEG]
mov es, ax
xor bx, bx ; bx is starting address within segment
mov dx, 0x0000 ; driver 0, head 0
mov cx, 0x0002 ; start sector 2, track 0
mov al, 02 ; nr of sectors
mov ah, 02 ; service
int 0x13
jnc next
jmp load_failed
;; print "load Ok"
next:
mov ax, [BOOTSEG]
mov es, ax
mov dx, 0x0200
mov cx, 10
mov bx, 0x0007
mov bp, msg2_ok
mov ax, 0x1301 ; write string, move cursor
int 0x10
jmp 0x07e0:0x0000
load_failed:
mov ax, [BOOTSEG]
mov es, ax
mov dx, 0x0300
mov cx, 13
mov bx, 0x0007
mov bp, msg3_faile
mov ax, 0x1301 ; write string, move cursor
int 0x10
die: jmp die
times 510-($-$$) db 0 ; Fill up the file with zeros
boot_sign:
dw 0AA55h ; Boot sector identifyer
load the second and third sector of floopy where my setup.s is at 0x07c00.
Then jump into setup.s.
but it does nothing but prints the first message.
Thanks all the tips.