Boot sector doesn't run
Boot sector doesn't run
Hello all, first, sorry for my english.
So, I post here cause I have troubles that I didn't had on my last computer : I am actually running on Win7-0x64 and I want to make my own MBR.
I mounted my virtual floppy, put my BIN on, and launch it with Qemu. It works ! But still don't launch my MBR...
My MBR is simple, but to be sure I tried different codes, and I'm sure that Qemu(I have tried with VB too) doesn't launch it. I just have a black window which doesn't move.
I use Virtual Floppy Drive to create virtual floppies.
And the most strange is that I could launch my MBR using this method with my last computer which was in 32 bits... I don't know.
Thank all.
So, I post here cause I have troubles that I didn't had on my last computer : I am actually running on Win7-0x64 and I want to make my own MBR.
I mounted my virtual floppy, put my BIN on, and launch it with Qemu. It works ! But still don't launch my MBR...
My MBR is simple, but to be sure I tried different codes, and I'm sure that Qemu(I have tried with VB too) doesn't launch it. I just have a black window which doesn't move.
I use Virtual Floppy Drive to create virtual floppies.
And the most strange is that I could launch my MBR using this method with my last computer which was in 32 bits... I don't know.
Thank all.
Re: Boot sector doesn't run
Hi,
If you ever need help, don't forget that you can ask questions on the forums. You can even post source code if you want to (so that people can check for any bugs, etc).
Cheers,
Brendan
I'm sorry to hear your code is having troubles.romfox wrote:So, I post here cause I have troubles that I didn't had on my last computer : I am actually running on Win7-0x64 and I want to make my own MBR.
I mounted my virtual floppy, put my BIN on, and launch it with Qemu. It works ! But still don't launch my MBR...
My MBR is simple, but to be sure I tried different codes, and I'm sure that Qemu(I have tried with VB too) doesn't launch it. I just have a black window which doesn't move.
I use Virtual Floppy Drive to create virtual floppies.
And the most strange is that I could launch my MBR using this method with my last computer which was in 32 bits... I don't know.
If you ever need help, don't forget that you can ask questions on the forums. You can even post source code if you want to (so that people can check for any bugs, etc).
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re: Boot sector doesn't run
Thanks for answers
This is one of the code I tested from the wiki :
Is there a type of floppies to use ? I use the Virtual Floppy Driver's default settings.
So I do :
nasmw -f bin boot.asm -o boot.bin
copy boot.bin A:
qemu -L . -boot a -fda A:
It starts but doesn't launch anything.
Thanks.
This is one of the code I tested from the wiki :
Code: Select all
; boot.asm
mov ax, 0x07c0
mov ds, ax
mov si, msg
ch_loop:lodsb
or al, al ; zero=end or str
jz hang ; get out
mov ah, 0x0E
int 0x10
jmp ch_loop
hang:
jmp hang
msg db 'Salut !', 13, 10, 0
times 510-($-$$) db 0
db 0x55
db 0xAA
So I do :
nasmw -f bin boot.asm -o boot.bin
copy boot.bin A:
qemu -L . -boot a -fda A:
It starts but doesn't launch anything.
Thanks.
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Boot sector doesn't run
That does not overwrite the bootsector at all. It only places a "boot.bin" at some random location on the floppy.copy boot.bin A:
I suggest you try actually following the instructions in the Babystep1 tutorial instead of inventing your own.
Re: Boot sector doesn't run
Yeah it works !
Now I tried a boot sector which spawn a message, init the drive, read the sectors :
Then I jump to the readed (don't think 'readed' is correct...) where is my kernel.
But it looks never launching the kernel because I have an infinite loop on the boot sector's message whenever using the "-no-reboot" Qemu's option.
I tried lot of things, but whithout correct internet connection this is hard. So I tried to copy a simple boot sector which do the same thing but still the same problem.
To make the img file I do :
copy boot.bin/B+kernel.bin/B OS.img
Thanks..
Edit : I tried with VBox, it only spawns 1 time the message but doesn't spawn the kernel's one.
But something gones bad. I know I maybe look like a noob who wants to run before walk, but I'm programming asm since a little moment, and a simple OS (in real mode using BIOS first) will be a good way to learn and have fun I think
Now I tried a boot sector which spawn a message, init the drive, read the sectors :
Code: Select all
init_drive:
xor ax, ax
int 0x13
jc init_drive
push es
read_drive:
mov ax, BASE ; base set as 0x100
mov es, ax
mov ah, 0x02
mov al, 1
xor bx, bx
mov ch, 0 ; No cylinders
mov cl, 2 ; Read the second segment
mov dl, [bootdriver]
mov dh, 0x00
int 0x13
jc read_drive
pop es
Code: Select all
jump dword BASE:00
I tried lot of things, but whithout correct internet connection this is hard. So I tried to copy a simple boot sector which do the same thing but still the same problem.
To make the img file I do :
copy boot.bin/B+kernel.bin/B OS.img
Thanks..
Edit : I tried with VBox, it only spawns 1 time the message but doesn't spawn the kernel's one.
But something gones bad. I know I maybe look like a noob who wants to run before walk, but I'm programming asm since a little moment, and a simple OS (in real mode using BIOS first) will be a good way to learn and have fun I think
Re: Boot sector doesn't run
Done It was a code error (cause parse code when you have to copy from your phone is hard :p)
Really happy
I have one last question now :
When spawning a char to screen whithout using the BIOS, the tuto show that I have to mov AX to ES:DI and I'm not sure I understand.
Does it simply move the char and its properties to ES:DI which is the video memory ? It looks too 'easy'.
Really happy
I have one last question now :
When spawning a char to screen whithout using the BIOS, the tuto show that I have to mov AX to ES:DI and I'm not sure I understand.
Does it simply move the char and its properties to ES:DI which is the video memory ? It looks too 'easy'.
Re: Boot sector doesn't run
Hi,
Before doing this you should make sure the video card actually is in text mode. Eventually you'd have code to handle things like tracking the current position and scrolling the screen.
Also note that (sooner or later) for modern OSs you typically want to use a graphics mode (where you control individual pixels, and can draw pictures, icons, menus, etc; and aren't limited to pre-supplied text characters or 16 colours). That's where it starts getting more complicated.
Cheers,
Brendan
Yes - it stores the character and it's attribute into video display memory (and ES:DI points to the address in video display memory).romfox wrote:I have one last question now :
When spawning a char to screen whithout using the BIOS, the tuto show that I have to mov AX to ES:DI and I'm not sure I understand.
Does it simply move the char and its properties to ES:DI which is the video memory ? It looks too 'easy'.
Before doing this you should make sure the video card actually is in text mode. Eventually you'd have code to handle things like tracking the current position and scrolling the screen.
Also note that (sooner or later) for modern OSs you typically want to use a graphics mode (where you control individual pixels, and can draw pictures, icons, menus, etc; and aren't limited to pre-supplied text characters or 16 colours). That's where it starts getting more complicated.
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re: Boot sector doesn't run
Hi, sorry, couldn't connect before.
So now my OS looks like a... textbox :p
I made a little keyboard driver, but I think it could be nice to sometime can use C. But I got a "cannot perform PE operations on non PE file" or something like that. I know a little about cross compiling, but I don't know which choice to do. I use windows 7 64bits, I think Cygwin could be a good choice.
But will it work ?
Thanks.
So now my OS looks like a... textbox :p
I made a little keyboard driver, but I think it could be nice to sometime can use C. But I got a "cannot perform PE operations on non PE file" or something like that. I know a little about cross compiling, but I don't know which choice to do. I use windows 7 64bits, I think Cygwin could be a good choice.
But will it work ?
Thanks.
Re: Boot sector doesn't run
WIKI is your friend. See GCC_Cross-Compilerromfox wrote:I know a little about cross compiling
I suggest to have a look at it before deciding to use or not to use it.
Re: Boot sector doesn't run
Thanks, the question was : Will it work with Cygwin ? Cause I am not sûre I really understand.
Re: Boot sector doesn't run
I don't know if you can use cygwin host compiler for os development, it might work if you provided enough compiler flags and do it very carefully.
However, you can build a cross compiler on top of cygwin environment, which the procedure and advantages is listed on the wiki link above. and most people here are more familiar with that environment.
However, you can build a cross compiler on top of cygwin environment, which the procedure and advantages is listed on the wiki link above. and most people here are more familiar with that environment.
Re: Boot sector doesn't run
Thanks, I have to follow the wiki but downloading with an edge connection at 5kb/s... I Will do it at a friend's home... Thanks, m'y OS now handles what is written But all in asm....
Re: Boot sector doesn't run
One more question : yesterday I could try my os copying to my external HD, but it doesnt work anymore, I simply use "dd if=os32.img of=\\.\g: bs=512 count=2880", I dont know why cause it worked fine... I have looked if my sectors are really copied and it does...