Pregunta

I'm following a guide on writing your own operating system. It starts with writing a 2 stage bootloader, where the first bootloader loads in stage 2. In the guide i am following, they have me use the FAT12 filesystem for the floppy image, so i'm reading from a root directory table to see if the file exists, and then going to the FAT to get the file clusters.... etc, etc.

My problem is that my code isn't finding the file in the root directory table, but i can't figure out why. Can someone please point me in the right direction here?

This is the code for my bootloader: https://friendpaste.com/FkSFfxLz17LUwdyvK3ONX

¿Fue útil?

Solución

Your readsectors is broken. The call reset at the beginning (line 270) destroys registers such as AX with important information in them. Then the call to LBAtoCHS (line 282) is too "late", it's after AX has already been destroyed by the previous two lines preparing for the BIOS interrupt. You should move the call LBAtoCHS up to line 278.

Fixing that, you will see that you are loading sectors that will eventually overwrite your stack area that you have set to 0x9000. You will have to resolve that conflict.

One further problem I spotted is on line 102: it should be repe not plain rep.

Finally, a piece of advice: learn to use a debugger so you can solve your own problems.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top