home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 5 / ctrom5b.zip / ctrom5b / PROGRAM / ASM / ALIB30B / MISC3.ASM < prev    next >
Assembly Source File  |  1994-12-01  |  3KB  |  126 lines

  1.     PAGE    66,132
  2. ;******************************** MISC3.ASM  *********************************
  3. LIBSEG           segment byte public "LIB"
  4.         assume cs:LIBSEG , ds:nothing
  5. ;----------------------------------------------------------------------------
  6.     include    mac.inc
  7.  
  8. comment 
  9. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(  MISC   )
  10. ; A20_CHECK - check if A20 line is active
  11. ;  inputs: none
  12. ;  outputs  ax = 0 a20 is wrapping (normal DOS state)
  13. ;           ax = 1 a20 is not wrapping
  14. ;
  15. ;* * * * * * * * * * * * * *
  16. 
  17.  
  18.     public    A20_CHECK
  19. A20_CHECK    proc    far
  20.     push    ds
  21.     push    es
  22.     mov    ax,0
  23.     mov    es,ax
  24.     dec    ax
  25.     mov    ds,ax
  26.     mov    ax,word ptr es:[4eh]
  27.     cmp    ax,word ptr ds:[5eh]
  28.     jne    no_wrap
  29.     mov    word ptr ds:[5eh],1234h
  30.     cmp    word ptr es:[4eh],1234h
  31.     mov    word ptr ds:[5eh],ax
  32.     jne    no_wrap
  33. is_wraping:
  34.     pop    es
  35.     pop    ds
  36.     mov    ax,0            ;wrapping, normal dos state
  37.     jmp    wrap_display
  38. no_wrap:
  39.     pop    es
  40.     pop    ds
  41.     mov    ax,1            ;no wrap, A20 disabled
  42. wrap_display:
  43.     retf
  44. A20_CHECK    endp
  45.  
  46. comment 
  47. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(  MISC   )
  48. ; A20_WRAP_OFF - check if A20 line is active
  49. ;  inputs: none
  50. ;  outputs  ax = 0 a20 is wrapping (normal DOS state)
  51. ;           ax = 1 a20 is not wrapping
  52. ;
  53. ;* * * * * * * * * * * * * *
  54. 
  55.  
  56.     public    A20_WRAP_OFF
  57. A20_WRAP_OFF    proc    far
  58.     MOV    AX,0DF90h
  59.     CALL    command_8042        ;ah=8042 command
  60.     retf
  61. A20_WRAP_OFF    endp
  62.  
  63. comment 
  64. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(  MISC   )
  65. ; A20_WRAP_ON - check if A20 line is active
  66. ;  inputs: none
  67. ;  outputs  ax = 0 a20 is wrapping (normal DOS state)
  68. ;           ax = 1 a20 is not wrapping
  69. ;
  70. ;* * * * * * * * * * * * * *
  71. 
  72.  
  73.     public    A20_WRAP_ON
  74. A20_WRAP_ON    proc    far
  75.           MOV    CX,0800h
  76. await:    MOV    AX,0DD00h        ;
  77.     CALL    command_8042        ;ah=command
  78.     LOOPNZ    await
  79.     retf
  80. A20_WRAP_ON    endp
  81. ;-----------------------------------
  82. ;  ah=command for port 60h  al=att command ?
  83. command_8042:
  84.     CLI
  85.     CALL    wait_8042_inbuf_ful
  86.     JNZ    c8_cont
  87.     MOV    AL,0D1H
  88.     OUT    64H,AL            ;force next out to 60 to be cmd
  89.     CALL    wait_8042_inbuf_ful
  90.     JNZ    c8_cont
  91.     MOV    AL,AH
  92.     OUT    60H,AL            ;see notes
  93.     CALL    wait_8042_inbuf_ful
  94. c8_cont:STI
  95.     RET
  96.  
  97. wait_8042_inbuf_ful:
  98.     XOR    CX,CX
  99. L02A1:    IN    AL,64H            ;read 8042 status
  100.     AND    AL,2            ;check 8042 input buffer full
  101.     LOOPNZ    L02A1
  102.     RET
  103.  
  104. comment 
  105. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(  MISC   )
  106. ; SEG_TO_ABS - convert segment:offset to absolute address
  107. ;  inputs: ax:bx = segment offset
  108. ;  outputs dx,ax = absolute adderss
  109. ;
  110. ;* * * * * * * * * * * * * *
  111. 
  112.  
  113.     public    seg_to_abs
  114. seg_to_abs    proc    far
  115.     push    cx
  116.     MOV    CX,010H
  117.     MUL    CX
  118.     add    ax,bx
  119.     adc    dx,0
  120.     pop    cx
  121.     RETF
  122. seg_to_abs    endp
  123.  
  124. LIBSEG    ENDS
  125. ;;    end
  126.