Page 1 of 1
Protected Mode
Posted: Fri Mar 07, 2008 5:34 am
by Philip
A part of my code is like this:
mov eax,cr0
or eax,1
mov cr0,eax
jmp far ptr pm
pm:
but my masm 5.1 say that cr0 is undefined symbol
what's the meaning of this error message?
how can i access cr0?
pls help
Posted: Fri Mar 07, 2008 5:41 am
by zaleschiemilgabriel
MASM 5.1 does not support the latest Intel Instruction set (I'm not even sure it supports 32 bit instructions). Either try using a newer MASM version or a different assembler.
I'd recommend one of these: FASM, NASM, MASM32...
Posted: Fri Mar 07, 2008 6:10 am
by nekros
For pure ASM use FASM
For ASM and C use fasm or GAS.
MASM: ONLY for windows, I suggest not to.
Posted: Fri Mar 07, 2008 8:02 am
by Philip
masm 5.1 supports 32-bit register like eax,ebx,esi,edi, etc.
the directive to turn it on is ".386" and to put use16 after each segment declaration
only the control registers like cr0, cr1, etc are stated as:
Error: Symbol not define: CRO
who know why pls help me.........
Posted: Fri Mar 07, 2008 8:43 am
by zaleschiemilgabriel
First, MASM 5.1 is old, dude! Get over it!
Second, the fact that you have segment declarations is kind of disturbing.
I hope you're not trying to compile that piece of code as a PE or MZ executable.
You don't even know how many ways you're making me want to insult you right now! I wrote about 10-20 swears/curses/insults/bad words that I erased and put this instead, but a psychologist (or a moderator) would say that's bad for my health, so please stop making me sick!
Posted: Fri Mar 07, 2008 9:27 am
by Philip
i found it out already
.386 directive does not allow access to control registers
but .386p directive allows
that was the reason
Posted: Sat Mar 08, 2008 8:06 am
by zaleschiemilgabriel
Then that error message was not very informative, and it support what I've been trying to say: throw out MASM and get FASM or one of the others that were mentioned. You won't regret it, trust me. If you're just starting out OSDeving, do it now, before it's too late.
Posted: Sat Mar 08, 2008 8:09 am
by cyr1x
Doesn't Microsoft disallow non-Windows executables created with MASM anyway?
Posted: Sat Mar 08, 2008 8:16 am
by Philip
this is my very simple code for switching to protected mode
Posted: Sat Mar 08, 2008 8:52 am
by nekros
Really, you shouldn't use masm.
Posted: Sat Mar 08, 2008 11:59 pm
by Philip
i just use it to build the core of my os only
i plan to build my own assembler to run on my os