|
Listing 3: DOS GATE A20 (file: gatea20.asm)
title _gatea20
; Copyright (c) 1989, 1990 William Jolitz. All rights reserved.
; Written by William Jolitz, July 1989
; THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
; IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
; WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
; (void) gatea20();
; Enable Address Bit 20 that was disabled by BIOS for MSDOS
; We need it off to use entire memory space of the AT.
; We do this just prior to entering protected mode, never to return.
;
_TEXT segment byte public 'CODE'
assume cs:_TEXT,ds:_TEXT
_TEXT ends
Status_Port equ 64h ; 8042 Status Port
Cmd_rdy equ 2 ; Keyboard is ready?
Write_outpt equ 0d1h ; Write next data to output port
Port_A equ 60h ; 8042 Keyboard Scan and Diagnostic
EnableA20 equ 0dfh ; Enable Address bit 20 for use
_TEXT segment byte public 'CODE'
; Wait for Keyboard controller to be ready for command
wait42 proc near
chkrdy:
in al, Status_Port
and al, Cmd_rdy
jnz chkrdy
ret
wait42 endp
; Turn on A20 again.
_gatea20 proc far
call wait42
mov al, Write_outpt
out Status_Port, al
call wait42
mov al, EnableA20
out Port_A, al
call wait42
ret
_gatea20 endp
public _gatea20
_TEXT ends
end
Thus, the urgent need for GATE A20 (short for "Gate the A20 address line to logic zero"). With our UNIX system, we will want to grab all available RAM memory, especially that above 1 Mbyte, so we need to defeat the GATE A20 feature and allow all the processor's address lines to be functional. We did this with our gatea20.asm module in Listing 3 invoked by boot.c (see Unix Kernel Load Program).
|
|