Booting: int 13h not reading?
Posted: Sat Mar 14, 2009 5:57 am
Hey,
I'm trying to do a simple 2 stage bootloader for an OS. However, when I tried to load the 2nd part of the boot loader using the int 13 (ah=02) interrupt, though I get no error, I don't think my code gets loaded, because when I dump the memory of the location I've loaded the 2nd part to, I simply get null's all over.
The following are my codes-
boot1.asm
boot2.asm:
My compilation:
(concat is a small C++ code to concat 2 binary files, and it works, cause I get a 1.5 kb file with both files included in it)
When I ran it with bochs (with experimental windows debugger)-
1. Put breakpoint at 0x7c00
2. "proceed" until the int 13 for loading
3. Do a physical dump of location: 0x00001000
I get only 00's being there, instead of hex ascii value of 'A' (whatever it maybe)
Could sum1 please help me. Its been bugging me for a few days now.
I'm trying to do a simple 2 stage bootloader for an OS. However, when I tried to load the 2nd part of the boot loader using the int 13 (ah=02) interrupt, though I get no error, I don't think my code gets loaded, because when I dump the memory of the location I've loaded the 2nd part to, I simply get null's all over.
The following are my codes-
boot1.asm
Code: Select all
[BITS 16]
[ORG 0x7c00]
;To load into memory first
mov ah,0 ;dh is already filled by drive letter
int 13h
mov ax,0
mov es,ax
mov bx,0x1000
mov ah,02h
mov al,02 ; number of sectors to read
mov ch,0
mov cl,02h
mov dh,0
int 10h
jc prerror
lea si,[strsuccess]
jmp printstring
prerror:
lea si,[strerror]
jmp printstring
printstring:
mov ah,0Eh
mov al,[si]
cmp al,'$'
je progend
mov bh,0
mov bl,0fh
inc si
int 10h
jmp printstring
progend:
jmp progend
strsuccess db 'Loaded Successfully$'
strerror db 'Unable to Load$'
times 510-($-$$) db 0
db 055h
db 0aah
boot2.asm:
Code: Select all
times 1024-($-$$) db 'A'
My compilation:
Code: Select all
nasm boot1.asm
nasm boot2.asm
concat final boot1 boot2
When I ran it with bochs (with experimental windows debugger)-
1. Put breakpoint at 0x7c00
2. "proceed" until the int 13 for loading
3. Do a physical dump of location: 0x00001000
I get only 00's being there, instead of hex ascii value of 'A' (whatever it maybe)
Could sum1 please help me. Its been bugging me for a few days now.