a20.inc

来自「TestOS - 带简单GUI的DOS扩展OS// 源代码// ASM// 英文」· INC 代码 · 共 35 行

INC
35
字号
;=========================================================;
; A20                                            11/12/03 ;
;---------------------------------------------------------;
; DOS EXTREME OS V0.01                                    ;
; by Craig Bamford.                                       ;
;                                                         ;
; Enable the A20 line.                                    ;                          
;=========================================================;
enable_A20:
        pusha
        cli                                    ; Disable all irqs
        cld
        mov   al,255                           ; Mask all irqs
        out   0xa1,al
        out   0x21,al
l.5:    in    al,0x64                          ; Enable A20
        test  al,2                             ; Test the buffer full flag
        jnz   l.5                              ; Loop until buffer is empty
        mov   al,0xD1                          ; Keyboard: write to output port
        out   0x64,al                          ; Output command to keyboard
l.6:    in    al,0x64                          
        test  al,2
        jnz   l.6                              ; Wait 'till buffer is empty again
        mov   al,0xDF                          ; keyboard: set A20
        out   0x60,al                          ; Send it to the keyboard controller
        mov   cx,14h
l.7:                                           ; this is approx. a 25uS delay to wait
        out   0edh,ax                          ; for the kb controler to execute our
        loop  l.7                              ; command.
        sti
        popa
        ret


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?