home *** CD-ROM | disk | FTP | other *** search
/ Black Box 4 / BlackBox.cdr / progasm / ucheck.arj / UV_CHECK.ASM next >
Encoding:
Assembly Source File  |  1990-04-28  |  3.5 KB  |  67 lines

  1.         title    Set ERRORLEVEL To Reflect Ultravision Status
  2.  
  3. ;******************************************************************
  4. ;*                                                                *
  5. ;*  An idiot program by Tom Slone, CIS# 76137,215.  April 1990.   *
  6. ;*  Written to MASM 5.1.                                          *
  7. ;;                                                                *
  8. ;;  (modified by Mark Horvatich, 4/24/90, to allow assembly       *
  9. ;;   with other types/versions of assemblers)                     *
  10. ;*                                                                *
  11. ;*  ERRORLEVEL (return code) will be set as follows:              *
  12. ;*                                                                *
  13. ;*          0 = UV is not resident.                               *
  14. ;*          1 = UV is resident, but is presently inactive.        *
  15. ;*      other = UV is resident and is active; ERRORLEVEL is       *
  16. ;*              equal to the UV text mode (in decimal) per table  *
  17. ;*              C-2 on page 94 of the UV 2.0 Reference Manual.    *
  18. ;*                                                                *
  19. ;*                                                                *
  20. ;******************************************************************
  21.  
  22. VideoInt        equ     010h            ;BIOS video interrupt
  23. DosFuncInt      equ     021h            ;DOS function request interrupt
  24. UvSystemCtl     equ     0CCh            ;UV system control function
  25. UvScreenCtl     equ     0CDh            ;UV screen control function
  26. UvGetStatus     equ     000h            ;get UV status subfunction
  27. UvGetTextMode   equ     004h            ;get UV text mode subfunction
  28. UvResFlag       equ     0ABCDh          ;UV resident indicator
  29. ConZero         equ     000h            ;constant hex zero
  30. ConOne          equ     001h            ;constant hex one
  31. ExitFunc        equ     04Ch            ;DOS exit function
  32.  
  33.  
  34. uvcheck segment                         ;begin code segment
  35.         assume cs:uvcheck,ds:uvcheck    ;tell assembler about registers
  36.  
  37.         org     100h                    ;begin at 100h for .COM format
  38.  
  39. start:
  40.         mov     cx,ConZero              ;init cx to a known value
  41.         mov     ah,UvSystemCtl          ;UV system control function
  42.         mov     al,UvGetStatus          ;UV get status
  43.         int     VideoInt                ;perform video interrupt
  44.         cmp     cx,UvResFlag            ;is UV resident?
  45.         je      uv_resident             ;  jump if yes
  46.         mov     al,ConZero              ;set ERRORLVL to UV not resident
  47.         jmp     short exit              ;finished
  48.  
  49. uv_resident:
  50.         cmp     al,ConZero              ;is al=00 (UV active)?
  51.         je      uv_active               ;  jump if yes
  52.         mov     al,ConOne               ;set ERRORLVL to UV not active
  53.         jmp     short exit              ;finished
  54.  
  55. uv_active:
  56.         mov     ah,UvScreenCtl          ;UV screen control function
  57.         mov     al,UvGetTextMode        ;UV get text mode
  58.         int     VideoInt                ;perform video interrupt
  59.         jmp     short exit              ;finished - text mode is in al
  60.  
  61. exit:                                   ;exit with ERRORLVL in al
  62.         mov     ah,ExitFunc             ;DOS exit function
  63.         int     DosFuncInt              ;perform DOS interrupt
  64.  
  65. uvcheck ends                            ;end of code segment
  66.         end     start                   ;end of source program
  67.