Top Navigational Bar

Possible Cause And Solutions For Sticking Shi
DocumentID: 604070
Revision Date: 29-Feb-96 1:30:29 PM

The information in this document applies to:
WordPerfect® 5.1 for DOS

Problem

Solutions: This article is taken from BYTE Magazine, August 1992 and can be sent to customers. This article can be downloaded from the BBS as STICK.ZIP.

EXORCISING THE A20 POLTERGEIST
Have you ever seen a word processor display odd keystrokes under DOS 5.0 or Windows? It happened to me while upgrading the machines in my office. My marketing person, Donna, claimed that WordPerfect for Windows wouldn't work with DOS 5.0. I didn't have time to look into it, so I uninstalled DOS 5.0 and put the matter in the "things I will do eventually" pile. But I kept hearing scattered reports of keyboard problems with DOS 5.0.

Then Kris, a technical instructor, reinstalled 5.0 on Donna's machine, "causing WordPerfect and other programs to display random characters." "Random characters?" I asked. "Will it do it right now- before our very eyes?" Kris said that there seemed to be no way to make it stop doing it. Grabbing my deerstalker cap and calabash pipe, I cried, "Quick, Kristina! The game is afoot!" Along the way, I learned that, believe it or not, you need the keyboard's permission to address extended memory. And thereby hangs a tale.

Address-Line Issues
A peek or two at the symptoms showed that the characters weren't random at all. Intermittently, the keyboard added a Shift key to the keystroke, almost as if there were a ghostly finger on the keyboard. Like all good troubleshooters, I started by emptying the CONFIG.SYS and AUTOEXEC.BAT files. The problem went away. While adding back the lines one by one, I found the problem in DOS=HIGH.

This surprised me. Of all the ninety features of the memory managers that come with DOS 5.0 and Windows 3. 1, the one that seems to have the least trouble is loading DOS into the HMA (high memory area). This is the memory space between 1024K and 1088K. (For you purists, it's not exactly from 1024K to 1088K: it's between 1024K and a point 16 bytes below 1088K.)

The HMA is an artifact of a problem in 286 and higher CPUS: These "286+"chips have several processing modes designed mainly to accommodate multitasking and handle large amounts of memory. Protected mode is the keystone of Windows, OS/2, and other advanced PC operating platforms. To maintain backward compatibility with existing 8088 programs, Intel included the 8088 compatibility mode, or real mode. DOS was written to live in real i-node, but Windows and OS/2 are changing that.

The original 8088 could address 1024K of memory, so you'd think that 1024K would be the limit for 286+ chips in real mode. But for reasons that are too convoluted to describe here, 286+ chips address just under 1088K of RAM in real mode.

Suppose an 8088 program has its instruction counter at the very top of memory at location 1024K - 1. (The addresses start at 0, so the top address is 1024K - 1). When the processor tries to increment the instruction pointer, it rolls over to location O, just as an automobile's odometer does when it passes 99,999 miles. It does this because the 8088 processor is built to support 1024K or RAM, which requires 20 wires, or address lines, on the address bus (2 2' equals 1024). These line numbers go from AO to A19. An 8088-based computer has no A20 address line and can't communicate with memory beyond 1024K. A 286+ computer, on the other hand, has more address lines: 24 for a 286, 386SX, or 386SL; and 32 for a 386DX, 486SX, or 486DX.

What happens when a program sets the instruction pointer for a 286+ CPU running in real mode at 1024K - I and then tries to increment the pointer? Instead of rolling over, it moves up to 1024K and continues to move up to nearly 1088K. That's partly because there are address lines above A19. When your program first rises above 1024K -1, it energizes the A20 address line.

The Infamous A20 Gate
The presence of the A20 line troubled the designers of the IBM AT, who sought compatibility with the IBM XT. They responded with the A20 gate, an electronic switch on the A20 line between the processor and memory. When the AT (and all subsequent PCs) powered up, the gate opened, keeping A20 signals from reaching memory. This lets a 286*+ more fully emulate an 8088: The addresses wrap around, and the top of real--mode memory becomes truly 1024K - 1 on a 286+ computer.

Then along came Windows. The A20 gate must close before protected-mode programs like Windows can address extended memory, and the keyboard controller controls the A20 gate. This controller, which is an 8042 chip on most 286+ motherboards, is a microcomputer in itself. It has a CPU, RAM, and ROM all built into a single 40-pin DIP. This design explains why resetting the computer with the Ctrl-Alt-Del keys doesn't do the same thing as turning the power off and on again. Pressing Ctrl-Alt-Del just resets the CPU. That doesn't do any good when the keyboard processor crashes.

Microsoft addressed the problem with DOS 5.O and Windows 3.O with HIMEM.SYS and the WINA20.386 driver, respectively, Windows 3.0 came first. Then DOS 5.0 arrived, with its ability to load DOS high by twiddling the A20 line. Windows' 386 enhanced mode creates virtual DOS machines, but the standard DOS machine that WIN386.EXE creates the virtual machine manager under Windows 3.0 - doesn't know anything about the HMA or the A20 gate.

The WINA20.386 driver solved that. WIN386.EXE in Windows 3.1 knows about the HMA, but the installation program doesn't remove the now-irrelevant device=WINA20.386 line from you SYSTEM.INI file; you should remove it yourself after upgrading. And if you're not loading DOS high, you don't need WINA20.386 at all.

The Poltergeist Problem
If you use OS/2, you don't have to worry about the A20 line; the software closes the gate (connects the A20 line) and goes on. DOS is a different story. Prior to version 5.0, DOS just opened the gate and left it open. Now you can load programs into the HMA. But when you put any program- particularly DOS - into the HMA, the A20 gate swings open and closed as though in a windstorm. That causes a problem on some PCs when the keyboard controller can't open and close the gate quickly enough. Bombarding the keyboard controller with A20 requests can make it behave erratically in its primary duties, leading to the Shift-key specter I described earlier.

What do you do if you have this problem? Start by checking your CMOS settings. Many motherboards, particularly those built with the Chips & Technologies chip set and the AMI BIOS, feature a "fast A20" option. If you've got such a motherboard, make sure it's enabled in your computer's Setup program. Also, look for this feature the next time you're buying a PC clone.

Next, check the keyboard controller. Just as BIOSes sometimes require updates, so does the keyboard controller. If you have an AMI BIOS, you'll see the words American Megatrends, Inc. on-screen when you turn on your computer. At the bottom of the screen, you'll see what looks like serial numbers, followed by -Kx. The x will be the version number of your keyboard controller. I've seen -KA, -K*, -KD, and -KF. You want the KF version to avoid A20 problems.

Don't think that just because you've got a new computer you have version KF- I recently did work for a large defense agency that had just received a pile of new Everex computers equipped with the K9 controller. Keyboard controllers sell for under $75 and aren't too hard to find; just check the adds in the back of computer magazines for BIOS upgrade vendors. Donna now has a new keyboard controller, and all is well. There may, however, be a cheaper way out.

Under DOS 5.0, HIMEM.SYS manipulates the A20 gate. You've probably noticed the "A20 handler enabled" message when HIMEM loads. And you know that the keyboard controller is the control point for the A20 gate. But that's not the whole story. PS/2 computers use an entirely different approach, as do the AT&T 6300 Plus, Philips computers, the Acer I 100, and many others. To address this problem, HIMEM has a /machine: switch. You invoke HIMEM.SYS with the /M:N parameter, where N is a number from 1 to 16.

If your PC misbehaves with HIMEM, try all the machine types - but make sure that you've got a bootable floppy disk on hand first. QEMM owners can use the IGNOREA20 and UNUSUAL8042 options. I find that if you've got a problem PC, QEMM is better at handling A20 troubles than HIMEM. However before you go out and buy QEMM or a new keyboard controller, try all the HIMEM machine parameters.

Here's a final suggestion: The DOS version of WordPerfect is more sensitive to this type of problem than are other programs, because it programs the keyboard controller directly. Invoking WordPerfect with the /NK option may alleviate the problem.

Answer:

Details:


Product specifications, packaging, technical support and information (*Specifications*) refer to theUnited States retail English version only. Specifications for other versions may vary. All Specifications, claims, features, representations, and/or comparisons provided are correct to the best of our knowledge of the date of publication, but are subject to change without notice.OUR MAXIMUM AGGREGATE LIABILITY TO YOU AND THAT OF OUR DEALERS AND SUPPLIERS IS LIMITED. IT SHALL NOTEXCEED THE AMOUNT YOU PAID TO ACCESS THE INFORMATION. SEE LEGAL DISCLAIMER.