A20 Line: Difference between revisions

[unchecked revision][unchecked revision]
Content deleted Content added
reworked section "INT 15, 2401"
Line 191:
However, the Fast A20 method is not supported everywhere and there is no reliable way to tell if it will have some effect or not on a given system. Even worse, on some systems, it may actually do something else like blanking the screen, so it should be used only after the [[BIOS]] has reported that FAST A20 is available. Code for systems lacking FAST A20 support is also needed, so relying only on this method is discouraged. Also, on some chipsets you might have to enable Fast A20 support in the BIOS configuration screen.
 
===INT 15, 2401===
Another way is to use the BIOS.
<source lang="asm">
;FASM
mov ax, 0x2401
use16
int 0x15
mov ax,2403h ;--- A20-Gate Support ---
int 15h
jb a20_ns ;INT 15h is not supported
cmp ah,0
jnz a20_ns ;INT 15h is not supported
 
mov ax,2402h ;--- A20-Gate Status ---
int 15h
jb a20_failed ;couldn't get status
cmp ah,0
jnz a20_failed ;couldn't get status
 
cmp al,1
jz a20_activated ;A20 is already activated
 
mov ax,2401h ;--- A20-Gate Activate ---
int 15h
jb a20_failed ;couldn't activate the gate
cmp ah,0
jnz a20_failed ;couldn't activate the gate
 
a20_activated: ;go on
</source>
If the one interrupt failes you will have to use another method. (See below.)
If there is an error, the CF will be set, and the error code will be in AH. On success, the CF is clear, and AH==0. Specifically, AH==0x86 means the function is not supported, and you will have to use another method.
 
===Recommended Method===