TIP: Click on subject to list as thread! ANSI
echo: z3_pascal
to: All
from: Benjamin Hoyt
date: 1996-11-04 18:15:44
subject: A20, Pmode, etc.

* Crossposted from: FIDO: Hardware Chat


Hi, does anyone know how to safely enable the A20 (address line 20)?
I can't find any dox on it. I have a little bit of code which does
it which I got from somewhere but I don't wanna use it because I don't
know exactly what it's doing. (Typical me :) So how does one enable
the A20 lines (eg., so you can use more than 1mb of memory)?

Second up on the list, I've got a big bad ugly bug. If you've never
done any protected mode programming just skip this one. Anyway, I'm
making a small sorta Dos pmode (protected mode) header/extender. And
I've got it working fine as to what it's supposed to do. Here's what
I'm doing:

a) check for real mode, if Cpu is not in real mode or an Xms driver
   is installed, quit with error msg
b) do a CLI and setup pmode Gdt & Idt and then load Gdtr & Idtr
c) switch to pmode by setting cr0 bit 0 (the pmode bit)
d) setup pmode ss to a segment defined as 32bit data 4gb long and put
   esp into that segment a ways up
e) setup my other segregs
f) I could now run my pmode code but I'm not for debugging purposes.
g) switch back to real mode by clearing cr0 bit 0
h) restore real mode stack
i) do a STI and exit to Dos

Now that all works fine. Repeat: My Program Runs Fine! :) I can do
stuff in pmode, write to the screen, use my stack properly, etc.
But what bugs me is when I exit to Dos and try to run Dos's Mem.Exe
program, Mem.Exe crashes! For no good reason at all. And 99% of the
other programs I've tried work, but just Dos Mem.Exe! :( And
Mem.Exe works if I haven't run my Pmode.Exe program. And I've
narrowed the bug down even to the last instruction. If I take
out these two lines in my code:

mov ax,018h    ; segment selector for 32bit data segment 4gb long
mov ss,ax      ; ss = ditto

If I just take out the mov ss,ax then my program still works fine (I
can't use the stack of course), but weirdly and wackily Dos's Mem.Exe
when I run it runs fine as well! So that one mov instruction is doing
_SomeThing_ wacky that I don't know about.

If you think you can help in _Any_ way please reply Asap, and I'll be
more than happy to post the assembly source code if you want. The source
is only about 7k so no problems there. Anyway, please help if you at all
can and I'd be _MOST_ ablidged to you!  Thanx Heaps.

l8r, JaKe/Steel Dawn

... "Other than that, Mrs. Lincoln, how was the play?"
--- FMail/386 1.02
>>> (3:776/300)
* Origin: <<< JayBee's BBS * Excitement Plus! * +646-876-9442
SEEN-BY: 633/267 270
@PATH: 776/300 774/605 772/20 712/624 515 711/808 50/99 635/728 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.