bootsector help

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.
Post Reply
beyondsociety

bootsector help

Post by beyondsociety »

[attachment deleted by admin]
crazybuddha

Re:bootsector help

Post by crazybuddha »

Where does it cease to work right???
beyondsociety

Re:bootsector help

Post by beyondsociety »

I took your advice crazybuddha and decided to start over and figure out where I was having problems and where I had questions. I need who-ever to look over my code and see if its correct. Also in the code I have added questions that I need answering. The bootsector is heavily commented but you can still tell if its a question or a comment.

ex: comment = ; this does this
question = ;---------------------------
What does this do?

Got it!

I have tried it and it displays the message but I havent tested it by jumping to another program. I wanted to make sure the code was corerect before I did that.
beyondsociety

Re:bootsector help

Post by beyondsociety »

[attachment deleted by admin]
crazybuddha

Re:bootsector help

Post by crazybuddha »

; ---------------------------------------------------------

; What does this mean?
; Why do I have to do this?

mov ax,0x9000 ; typical place for a stack
mov ss,ax
mov sp,0xFFFF ; use whole segment

; ---------------------------------------------------------

whenever you push/pop values you will decrement/increment the value of SP, which is an offset from SS. You set these values explicitly so you know what they are.


; Does the location have to be equal to the
; selector = 0x10 ?
; or can it be the location of the segment = 0x2000 ?

jmp 0x2000:0x000 ; jump to the bootstrap


You are in real mode at this point. "Selector" doesn't have any meaning in real mode. In pmode, it means the value in the segment register is "selecting" an entry in the GDT. In this example, you would be jumping to where you loaded the sectors from disk.

Regarding your comments. This is MUCH, MUCH better. Try to avoid restating the obvious (or what should be obvious to anyone who is reasonably familiar with assembly).
beyondsociety

Re:bootsector help

Post by beyondsociety »

Thanks for the help crazybuddha! I found one more thing wrong in my code that made it not work.

boot drv

should be changed to:

bootdrv db 0

After I corrected this, It works!.

The reason it doesn't work is because in my code I save in the drive I booted from. Without the "db 0" it won't work because it doesn't know what drive it is and its set for the floppy drive.
Post Reply