home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / memory / xm / xmmem.asm < prev    next >
Encoding:
Assembly Source File  |  1990-10-08  |  1.2 KB  |  88 lines

  1.         .386
  2.         include    xmhd.inc
  3. _DATA        segment    para public USE16 'DATA'
  4.  
  5. _DATA        ends
  6. ;
  7.         public    a20_on, a20_off
  8. ;
  9. _TEXT        segment    para public USE16 'CODE'
  10.         assume    cs:_TEXT, ds:_DATA
  11.  
  12. ;
  13.  
  14. ;    validate a20 line
  15. ;
  16.  
  17. IF PCAT
  18.         %OUT  " Creating PC/AT version "
  19. kbd_mode    = 64h
  20. kbd_data    = 60h
  21.  
  22. wait_empty_dis    proc    near
  23.         cli
  24. wait_empty:
  25.         push    ax
  26.         push    cx
  27.         xor    cx,cx
  28. .still_full:
  29.         in    al,kbd_mode
  30.         test    al,2
  31.         loopnz    .still_full
  32.         pop    cx
  33.         pop    ax
  34.         ret
  35.         endp
  36.         
  37. a20_on        proc    near
  38.         push    ax
  39.         mov    ah, 0dfh
  40. a20_set        label    near
  41.         push    cx
  42.         call    wait_empty
  43.         jnz    .forgive
  44.         mov    al, 0d1h
  45.         call    wait_empty_dis
  46.         jnz    .forgive
  47.         out    kbd_mode, al        ; 64h
  48.         mov    al, ah
  49.         call    wait_empty
  50.         out    kbd_data, al        ; 60h
  51.         mov    al, 0ffh
  52.         call    wait_empty
  53.         out    kbd_mode, al        ; 64h
  54. .kbd_end:        
  55.         in    al, kbd_mode
  56.         test    al, 2
  57.         loopnz    .kbd_end
  58.         mov    bx,1010h
  59. .forgive:
  60.         pop    cx
  61.         pop    ax    
  62.         ret
  63. a20_off        label    near    
  64.         push    ax
  65.         mov    al, 0ddh
  66.         jmp    a20_set
  67.         endp
  68. ENDIF
  69. IF  FMR70
  70. a20_on        proc    near
  71.         push    ax
  72.         mov    al, 00110000b
  73.         out    20h, al
  74.         pop    ax
  75.         ret
  76.         endp
  77. a20_off        proc    near
  78.         push    ax
  79.         mov    al, 0
  80.         out    20h, al
  81.         pop    ax
  82.         ret
  83.         endp
  84. ENDIF        
  85.  
  86. _TEXT        ends
  87.         end    
  88.