"Unable to control A20 line" or "A20 Line already enabled"

Support and general discussion.
Post Reply
insidious611
Posts: 9
Joined: Sun 29 Mar, 2015 12:40 pm

"Unable to control A20 line" or "A20 Line already enabled"

Post by insidious611 »

I'm trying to use PCem to do some DOS emulation. I was originally trying to simulate a PC/AT 286 with 4MB of XMS. Unfortunately, HIMEM.SYS on any version of DOS that I've tried (Specifically so far I've tried PC-DOS 5.02 and MS-DOS 6.22) either errors out with "Unable to control A20 line", or, if I set "/A20CONTROL:OFF" in config.sys, freezes upon warning me "A20 Line was already enabled". At this point in addition to the PC/AT I have tried various 286 and 386 setups using AMI and Award BIOSes, all to the same effect on both tested OSes.

This seems a rather big bug since it's so far preventing me from using PCem to run anything that needs more than the first 640KB of RAM on DOS :/

FWIW, I am running the latest PCem, on an old 2007-era MacBook running Windows 7 32-bit.
insidious611
Posts: 9
Joined: Sun 29 Mar, 2015 12:40 pm

Re: "Unable to control A20 line" or "A20 Line already enable

Post by insidious611 »

Just confirming that this is a regression compared to PCem v10.1 on the same system, where A20 seems to be handled correctly.

EDIT: Okay, this is getting weird.

I was finally able to get HIMEM.sys working on PCem v11, but only on a certain BIOS in a certain very specific setup. Specifically, if I use the award286 board, the one with NEAT chipset emulation, and set some amount of memory as EMS and the rest as XMS, HIMEM.SYS happily loads (as does the EMS driver I got from the thread about the award286 emulation). If I then go *back* into the *same* machine's BIOS setup and set all the memory as XMS, HIMEM.SYS continues to load happily (although of course the EMS driver, if I don't stub it, errors out at that point). The A20 gate continues to cause issues on all other setups (386, 486, other 286)

For now I'm using PCEMv11 for 286 stuff and PCEMv10.1 for 386/486 stuff :P *shrugs*
A. Naim
Posts: 139
Joined: Thu 09 Jul, 2015 5:06 pm

Re: "Unable to control A20 line" or "A20 Line already enable

Post by A. Naim »

insidious611 wrote:Just confirming that this is a regression compared to PCem v10.1 on the same system, where A20 seems to be handled correctly.

EDIT: Okay, this is getting weird.

I was finally able to get HIMEM.sys working on PCem v11, but only on a certain BIOS in a certain very specific setup. Specifically, if I use the award286 board, the one with NEAT chipset emulation, and set some amount of memory as EMS and the rest as XMS, HIMEM.SYS happily loads (as does the EMS driver I got from the thread about the award286 emulation). If I then go *back* into the *same* machine's BIOS setup and set all the memory as XMS, HIMEM.SYS continues to load happily (although of course the EMS driver, if I don't stub it, errors out at that point). The A20 gate continues to cause issues on all other setups (386, 486, other 286)

For now I'm using PCEMv11 for 286 stuff and PCEMv10.1 for 386/486 stuff :P *shrugs*
Heh. I wonder if my subconscious had this in mind when I posted on this in another thread?

The A20 line to the keyboard controls whether memory addresses wrap if you address a location higher than 1MB. Except when it doesn't. Or when it blanks the screen. Here. Read this if you want to facepalm: http://wiki.osdev.org/A20_Line

Anyway, that doesn't help you much, I guess, but it does explain why you're having problems there: The use of the A20 line was never properly standardized or supported. Ironically, the problem you're having might (I don't actually know) be due to more correct behaviour on the part of the emulator.
User avatar
SarahWalker
Site Admin
Posts: 2054
Joined: Thu 24 Apr, 2014 4:18 pm

Re: "Unable to control A20 line" or "A20 Line already enable

Post by SarahWalker »

I've not seen this issue before. Could you post your entire pcem.cfg file, for one configuration where you're seeing this?
Greatpsycho
Posts: 151
Joined: Tue 22 Mar, 2016 10:03 am
Location: Korea
Contact:

Re: "Unable to control A20 line" or "A20 Line already enable

Post by Greatpsycho »

insidious611 wrote:Just confirming that this is a regression compared to PCem v10.1 on the same system, where A20 seems to be handled correctly.

EDIT: Okay, this is getting weird.

I was finally able to get HIMEM.sys working on PCem v11, but only on a certain BIOS in a certain very specific setup. Specifically, if I use the award286 board, the one with NEAT chipset emulation, and set some amount of memory as EMS and the rest as XMS, HIMEM.SYS happily loads (as does the EMS driver I got from the thread about the award286 emulation). If I then go *back* into the *same* machine's BIOS setup and set all the memory as XMS, HIMEM.SYS continues to load happily (although of course the EMS driver, if I don't stub it, errors out at that point). The A20 gate continues to cause issues on all other setups (386, 486, other 286)

For now I'm using PCEMv11 for 286 stuff and PCEMv10.1 for 386/486 stuff :P *shrugs*
This trouble is caused by the mem_a20_alt variable that used in PS/2 port 0x92 is not properly initialized when initializing machine. Below patch solves that problem.
And below patch also solves MS-DOS himem.sys A20 error on Intel Premiere/PCI machine.
Attachments
ps2_a20_patch.tar.gz
Patch for A20 trouble in MS-DOS HIMEM.SYS
(1.25 KiB) Downloaded 300 times
User avatar
SarahWalker
Site Admin
Posts: 2054
Joined: Thu 24 Apr, 2014 4:18 pm

Re: "Unable to control A20 line" or "A20 Line already enabled"

Post by SarahWalker »

Committed at rev 800.
Greatpsycho
Posts: 151
Joined: Tue 22 Mar, 2016 10:03 am
Location: Korea
Contact:

Re: "Unable to control A20 line" or "A20 Line already enabled"

Post by Greatpsycho »

This additional patch the following.

- Moved initializing a20_mem_key and a20_mem_alt value to mem.c
- Changed initial a20_mem_key and mem_a20_state value to 2

Edit : This patch has been incorporated here.
Post Reply