Hello,
I've just started developing my own OS. So far I've written a boot code and a small kernel. The OS works on both Bochs and VMWare. But when I try to run it on a real computer, it seems to crash. I figured out on what line it was crashing (you can see it in the attachment). It's when I move the kernel from 0x7E00 to 0x100000 (1MB). I have no idea why it's crashing. Please help.
If the attachment doesn't work, use this link: http://jwfiles.europe.webmatrixhosting.net/os/boot.asm
Thanks in advance.
ps. I added my attachment, but there already was a boot.asm on the forum which isn't mine. So use the link.
Boot code doesn't work on real computer
Re:Boot code doesn't work on real computer
your memory moving code does not set the direction flag. Depending on its value when you get to "rep movsb", the memory copied will be in range ESI to ESI+ECX or ESI-ECX to ESI. Try inserting one of these instructions: cld std. Not sure which will suffice.
Anyways, I'm impressed with your code, it's just perfectly commented! Did you write it all yourself?
Cheers,
Adrian
Anyways, I'm impressed with your code, it's just perfectly commented! Did you write it all yourself?
Cheers,
Adrian
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Boot code doesn't work on real computer
try replacing 'jmp boot' with 'jmp 0000:boot'. Your real hardware may be jumping 0x7c0:0000 instead of 0x0000:0x7c00 ...
Re:Boot code doesn't work on real computer
isn?t 0x7c0:0000 and 0x0000:0x7c00 the same physical address?
Should it really make a diffrent?
/ Christoffer
Should it really make a diffrent?
/ Christoffer
Re:Boot code doesn't work on real computer
Thanks for your replies.
I will try to set cs to zero and the direction flag.
I will try to set cs to zero and the direction flag.
Yes I wrote it myself. Thanks ;D (but I think it could be commented better, especially the A20 part)Anyways, I'm impressed with your code, it's just perfectly commented! Did you write it all yourself?
Re:Boot code doesn't work on real computer
It's working....
I had to set the ecx register instead of the cx register in the code where I move the kernel from 0x7E00 to 0x100000 ( maybe I had to set cs to zero too ).
I had to set the ecx register instead of the cx register in the code where I move the kernel from 0x7E00 to 0x100000 ( maybe I had to set cs to zero too ).
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Boot code doesn't work on real computer
the difference *does* matters.bubach wrote: isn?t 0x7c0:0000 and 0x0000:0x7c00 the same physical address?
Should it really make a diffrent?
/ Christoffer
You have assembled stuff so that the code may have
Code: Select all
jmp 0x7D40
Things will even become more ugly if you have something like
Code: Select all
mov ax,cs
mov ds,ax