home *** CD-ROM | disk | FTP | other *** search
/ Beijing Paradise BBS Backup / PARADISE.ISO / software / BBSDOORW / CYRIX100.ZIP / CX486DLC / SRC_MS / STATE.ASM < prev    next >
Encoding:
Assembly Source File  |  1994-03-31  |  753 b   |  43 lines

  1.     .MODEL    SMALL, C
  2.     .CODE
  3.     PUBLIC cx_i486cachemode
  4.  
  5. CR0_CD_DIS    EQU    040000000h    ; Disable cache with CR0
  6.  
  7. ;
  8. ;    int cx_i486cachemode(void)
  9. ;
  10. ;    This routine returns 1 if the i486 cache is enabled.
  11. ;    Otherwise, it returns 0.
  12. ;
  13.  
  14. cx_i486cachemode    PROC        ; The proc name.
  15.  
  16.     .386P                ; 386 prot. instrucions allowed.
  17.  
  18. ; Use of MASM v5.1 should make this unnecessary.
  19. ;    push    ebp
  20. ;    mov    ebp, esp
  21.  
  22.     mov    eax, cr0        ; cr0 -> eax
  23.     and    eax, CR0_CD_DIS        ; Test if CD bit "on"
  24.     or    eax, eax
  25.     jnz    cx_cacheisoff
  26.  
  27.     mov    eax, 1            ; Cache is on: set return value
  28.     jmp    cx_mode_done
  29.  
  30. cx_cacheisoff:
  31.     mov    eax, 0            ; Cache is off: set return value
  32.  
  33. cx_mode_done:
  34.  
  35. ; Didn't push it, so don't pop it.
  36. ;    pop    ebp
  37.  
  38.     ret
  39.  
  40. cx_i486cachemode    ENDP
  41.             END
  42.  
  43.