Page 1 of 1

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

Posted: Fri 18 Nov, 2016 6:33 am
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.

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

Posted: Fri 18 Nov, 2016 6:53 am
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*

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

Posted: Sat 19 Nov, 2016 6:09 am
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.

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

Posted: Sat 19 Nov, 2016 8:33 am
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?

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

Posted: Mon 17 Jul, 2017 6:04 am
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.

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

Posted: Mon 17 Jul, 2017 6:53 pm
by SarahWalker
Committed at rev 800.

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

Posted: Tue 18 Jul, 2017 8:52 am
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.