Booting to the hard drive from a floppy

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
User avatar
inflater
Member
Member
Posts: 1309
Joined: Thu Sep 28, 2006 10:32 am
Location: Slovakia
Contact:

Post by inflater »

Hi,
Try this:

Code: Select all

jmp far 0x0000:0x7C00
-or-

Code: Select all

xor ax,ax
mov ds,ax
jmp far [ds:7C00h]
-or-

Code: Select all

cli
xor ax,ax
mov bx,7C00h
push ax
push bx
sti
retf
I wonder why that INT 19h is not working for you, as borrowed from Ralph Brown's interrupt list, it should work.
I will test it in my OS and I'll post my results.

//EDIT: Your right my man, INT 19h is not working with that...

Regards,
inflater
My web site: http://inflater.wz.cz (Slovak)
Derrick operating system: http://derrick.xf.cz (Slovak and English :P)
fbelzile
Posts: 18
Joined: Tue Dec 28, 2004 12:00 am

Post by fbelzile »

The first code didn't compile.
The second code compiled but didn't work.
The third code WORKED like a charm!

Thank-you:

XCHG figured out I had CX as 0000.
Urxae posted the original code that I edited and used.
Inflater mentioned int 19 and solved my jumping problem :lol:

Thanks again, I learned lots! Have a great day 8)
User avatar
Combuster
Member
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:

Post by Combuster »

Some notes:
inflater wrote:jmp far 0x0000:0x7C00
I use

Code: Select all

jmp 0x0000:0x7C00
(i.e. without the far) which assembles correctly.

Code: Select all

xor ax,ax
mov ds,ax
jmp far [ds:7C00h]
this is obviously wrong. Note the memory operand - it will try to load the offset from memory at 0x0:0x7c00 not jump to 0x0:0x7c00

Code: Select all

cli
xor ax,ax
mov bx,7C00h
push ax
push bx
sti
retf
I don't think the cli/sti pair is necessary here. There is no inconsistent hardware state anywhere in that block so...
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
inflater
Member
Member
Posts: 1309
Joined: Thu Sep 28, 2006 10:32 am
Location: Slovakia
Contact:

Post by inflater »

Combuster wrote:I don't think the cli/sti pair is necessary here. There is no inconsistent hardware state anywhere in that block so...
I was setting up segment registers and stack there :), fbelzile, if you do this in your kernel, you can safely strip off CLI and STI parts. :)

inflater
My web site: http://inflater.wz.cz (Slovak)
Derrick operating system: http://derrick.xf.cz (Slovak and English :P)
Post Reply