Page 2 of 2
Re:Reading Sectors with BIOS
Posted: Wed Jun 29, 2005 5:07 pm
by Goober
Thanks man, I can't believe I didn't see that data segment problem!
I assumed that the kernel wouldn't error because it's so simple.
Code: Select all
ORG 0x1000
use16
; Print welcome message
mov si,msg4
call print
call br
; Finish up
jmp $
Plus the appropriate print, br and msg4 calls.
Re:Reading Sectors with BIOS
Posted: Wed Jun 29, 2005 5:55 pm
by AR
The problem with the segments is there again.
CS=0x1000 IP=0 DS=0x1000 and your ORG=0x1000, so when you try to access the strings and code the assembler assumes 0x0:0x1000 + Offset so what you end up with is 0x1000:0x1000 + Offset, change ORG to 0.
Re:Reading Sectors with BIOS
Posted: Wed Jun 29, 2005 6:13 pm
by Goober
Thanks for pointing that out.
However, no cigar ??? . It still crashes before printing the kernel's message.
Re:Reading Sectors with BIOS
Posted: Wed Jun 29, 2005 10:59 pm
by AR
Try putting cli hlt at the start, also you may want to set the segments manually as well, it is better to not rely on the bootloader to set your segments for you in realmode.
If it actually executes CLI HLT then it is probably a problem with the parts of the program that you didn't include.
Re:Reading Sectors with BIOS
Posted: Thu Jun 30, 2005 11:58 am
by Goober
What a frustrating problem. There's no code I didn't post.
How can I tell if it executed cli hlt at the start of the kernel? Wouldn't it just hang like it does now?
Re:Reading Sectors with BIOS
Posted: Fri Jul 01, 2005 3:08 am
by AR
Where's "print" and "br" in the kernel?
Try:
Code: Select all
mov ax, 0xb800
mov gs, ax
mov byte [gs:0], 0x21
cli
hlt
You're using the wrong cylinder, you're setting the cylinder to 0x1 (CH) which is the second one. Both Cylinders and Heads are base 0, Sectors are base 1.
Re:Reading Sectors with BIOS
Posted: Fri Jul 01, 2005 10:26 am
by Goober
YOU DUNNIT AGAIN AR!
ch was supposed to be 0. I'm proud to present the working output:
Booting from Floppy...
[Boot] Setting up system stack...
[Boot] Reading kernel from disk...
[Boot] Jumping to kernel...
[Kernel] Started...
Thanks again!