Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with example 14 on real machine #247

Open
AhmedAlaa2024 opened this issue Jun 14, 2022 · 1 comment
Open

Problem with example 14 on real machine #247

AhmedAlaa2024 opened this issue Jun 14, 2022 · 1 comment

Comments

@AhmedAlaa2024
Copy link

I tried running the example 14 on a real machine it's a Pentium dual-core. I debugged the code and I found that the problem starts at the line
call KERNEL_OFFSET
I think the kernel is not loaded here, however, the disk procedures don't return any error, so I assume the int 0x13 already loads the kernel but where is it?

I don't know if my inspections are right or not. Any help, please?

@OpGamer3000
Copy link

Even i had problems running things on real machine.
Eventually i found a solution, that was just to set the CS register to zero. CS being non-zero causes problem with offsetting of the memory thats why.

here is how it worked for me:

; --[init stuf for your bootloader]--

jmp 0:mainBOOT         ; setting CS register to zero with the jump

mainBOOT:
    mov [DISK], dl     ; saving the drive number we booted from
    mov bp, 0x9000     ; setting the base pointer far from kernel load location, cuz stack grows downwards
    mov sp, bp         ; setting stack pointer

; --[the rest of your bootloader]--

tell me if it works or not.

PS: last time i made a fake entry for the drive as a 1.44 MB floppy disk. wasted 5 HOURS! then came to know that CS register was non-zero. dont make the same mistake xd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants