News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

unreal mode

Started by ninjarider, June 29, 2007, 04:27:43 AM

Previous topic - Next topic

ninjarider

just read an article on the psdev.org or actually the os wiki thats found there. there was somthing about the a20 with unreal mode. with the wording there dont know if that needs to be enabled or disabled.

japheth


it depends what addresses you want to access with unreal mode. The A20 gate drops the A20 line to 0, so you cannot access the content of physical addresses in the second MB (100000-1FFFFF), but the third MB (200000-2FFFFF) doesn't need A20 to be 1, so it can be accessed with A20 off ... and so on.

But generally it is a good idea to enable A20 for unreal mode.

sinsi

Here is a good explanation of A20. A couple of interesting points are
Quote
This was accomplished by inserting a logic gate on the A20 line between the processor and system bus, which logically got named Gate-A20. Gate-A20 can be enabled or disabled by software to allow or prevent the address bus from receiving a signal from A20. It is set to non-passing for the execution of older programs which rely on the wrap-around. At boot time, the BIOS first enables Gate-A20 when counting and testing all of the system's memory, and disables it before transferring control to the operating system.
So the A20 address line is the only one that can be switched on/off by code. Also notice that the BIOS (supposedly) disables it again - VMWare/Bochs don't seem to...or my actual computer.

Quote
It should be noted that disconnecting A20 would not wrap all memory accesses above 1 MB, just those in the 1 MB-2 MB, 3 MB-4 MB, 5 MB-6 MB, etc. ranges. Real mode software only cared about the area slightly above 1 MB, so Gate-A20 was enough.
That explains what japeth said about the different memory ranges you can access with the A20 off. Look at the bits (0..31) and see where the A20 sits (bit 21)

In your boot code (roll your own eh?) after setting unreal mode just enable the A20.
Light travels faster than sound, that's why some people seem bright until you hear them.

ninjarider

ok so with the a20 gate off i can only access every other 1mb block with the a20 on i have access to everything

just to clarify


and also i read that with using unreal mode that the code still has to reside under 1meg. is that true.

ninjarider

yeah im in the process of writing an os. im tired of the microsoft bullshit.

BogdanOntanu

Microsoft Windows is not bullshit.
At this time it is the best available operating system in both design and implementation.

I have a saying: until you have done better than a product you have no right to criticize it.
So first make a better OS than Windows and only then criticize it :D

But first you must understand A20 and much more an only then you will understand how complicated and how much work is involved in creating an OS of Windows magnitude...



Ambition is a lame excuse for the ones not brave enough to be lazy.
http://www.oby.ro

ninjarider

the only thing i dont like about windows is they want $300 even with the new release of vista. i have nothing against windows besides that. theres what seems to be a couple memory leeks here and there but nothing is perfect.

japheth

> I have a saying: until you have done better than a product you have no right to criticize it.

That's something most vendors would surely love :).

But it case you are serious about that (I don't know your kind of humor): this sentence is what *I* would call bulllshit.

> the only thing i dont like about windows is they want $300 even with the new release of vista.

There are some more things which one could mention: desperately bloated, almost no progress compared to the previous version, WGA, DRM, TCPA. In short: you don't get enough value for your money (the difference is transfered to "Billy").

sinsi

Quote from: ninjarider on June 29, 2007, 08:39:41 PM
ok so with the a20 gate off i can only access every other 1mb block with the a20 on i have access to everything
Yep. One reason DOS in the HMA works is that every DOS interrupt goes to a stub in conventional memory and the first
thing the stub does is enable the A20, then it jumps to the code in the HMA.
Quote from: ninjarider on June 29, 2007, 08:39:41 PM
and also i read that with using unreal mode that the code still has to reside under 1meg. is that true.
Because it's only 16-bit, only IP is used - not EIP - so a segment:offset won't work avove 1 meg.
Light travels faster than sound, that's why some people seem bright until you hear them.

ninjarider

using masm with the link16

.186
.model small
.{cant remember what i have here}
.stack 200h

//real mode to protected mode
setup the gdt
temp db 66h
execute a lgdt - executing the lgdt gives an error. something about opcode not valid in current processor mode


ninjarider

think my issue is the .186 needs to be a .386p

MichaelW

eschew obfuscation

ninjarider

didn't know there was a .286p

is there a list of all the directives (.186 .286, etc)

MichaelW

eschew obfuscation

ninjarider

#14
dont know if they would like me opening it here at work. gonna see if i can get it home.