How do I get in and out of protected mode?

Is there any tutorials about how to get into protected mode. Those I have seen does'nt really explain a lot.

Hope you can help me...



  • I haven't had the time to do change from real mode though.


  • The code to get into it is simple.

    mov eax, cr0

    or al, 1

    mov cr0, eax

    tada, you're in protected mode, and you are probably locked up.

    While that IS the code to get you into protected mode, you need to do some setting up before you enter it, and you need to do some other stuff afterwards as well.

    But really, there is no point in getting into protected mode this way unless you are making an OS or you're just crazy like that.

    Either use DPMI or program in Windows/Linux.

    However, there is something that isn't too annoying to setup that you could use. One of it's names is UnReal mode. It is real-mode with the segment limits set to 4GB. IE you have complete access to memory while still having code act like it is in real-mode... to a degree, and you aren't in protected mode.

    Just, do a search for UnReal mode and you should come up with something. I'll post the code later if I remember and after I've messed with it again, I think there were some minor bugs in my code that I'll have to check about.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!