home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Magic 1995 #1 / CDM_5.ISO / shell / graph / ansi / avtctl.arj / AVTCTL.ASM next >
Encoding:
Assembly Source File  |  1990-08-09  |  3.5 KB  |  131 lines

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;
  3. ;;      Copyright (C) 1990 G. Adam Stanislav
  4. ;;      All Rights Reserved
  5. ;;
  6. ;;      Purpose:
  7. ;;
  8. ;;              To control AVATAR driver.
  9. ;;
  10. ;;      Usage:
  11. ;;              avtctl [adsfgGl...]
  12. ;;
  13. ;;      Revisions:
  14. ;;
  15. ;;              07-29-90: Version 1.00. Released to Fidocon '90 participants.
  16. ;;              08-03-90: Version 1.01. Saves CX before calling AVTCHECK.
  17. ;;              08-09-90: Version 1.02. Makes AX='AV', BX='AT', CX='AR'.
  18. ;;
  19. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  20.  
  21. avatar  segment
  22.  
  23.         assume  cs:avatar, ds:avatar
  24.  
  25.         org     100h
  26.  
  27. begin:
  28.         ; Get the count of command line
  29.         mov     cl, ds:[80h]
  30.         sub     ch, ch
  31.  
  32.         ; If nothing there, complain
  33.         jcxz    explain
  34.  
  35.         ; see if Avatar is loaded
  36.         push    cx              ; Changed by avtcheck
  37.         call    avtcheck
  38.         pop     cx
  39.         jc      noavatar
  40.  
  41.         ; pass command line tail to Avatar driver
  42.         mov     si, 81h
  43.         mov     ax, 1A00h OR '!'
  44.         int     2Fh
  45.  
  46.         ; quit
  47.         mov     ax, 4C00h
  48.         int     21h
  49.  
  50. explain:
  51.         call    usage
  52.         mov     ax, 4C01h
  53.         int     21h             ; quit with errorlevel = 1
  54.  
  55. noavatar:
  56.         lea     dx, noavt
  57.         mov     ah, 9
  58.         int     21h             ; print no-avatar message
  59.  
  60.         mov     ax, 4C02h
  61.         int     21h             ; quit with errorlevel = 2
  62.  
  63. noavt   db      'Avatar console not loaded.', 13, 10, '$'
  64. usg     db      13, 10, 'Usage:', 13, 10, 10, 9
  65.         db      'AVTCTL [options]', 13, 10, 10
  66.         db      'Each option is only one character long. The options are '
  67.         db      'case sensitive.', 13, 10
  68.         db      'Some options may not be supported by some drivers, but '
  69.         db      'generally they are:', 13, 10, 10, 9
  70.         db      'a - activate the driver', 13, 10, 9
  71.         db      'd - deactivate the driver', 13, 10, 9
  72.         db      's - slow mode on (BIOS output)', 13, 10, 9
  73.         db      'f - fast mode on (direct screen writes)', 13, 10, 9
  74.         db      'g - gray keys always translated', 13, 10, 9
  75.         db      'G - gray keys never translated', 13, 10, 9
  76.         db      'l - gray keys translated when ScrollLock depressed', 13, 10, 9
  77.         db      't - Tandy 1000 keyboard conversion', 13, 10, 10
  78.         db      '$'
  79.  
  80. dummy   db      0
  81.  
  82. usage:
  83.         lea     dx, usg
  84.         mov     ah, 9
  85.         int     21h
  86.         ret
  87.  
  88. avtcheck:
  89.         mov     ax, 1A00h
  90.         mov     bx, 'AV'
  91.         mov     cx, 'AT'
  92.         mov     dx, 'AR'
  93.         int     2Fh
  94.         jc      avtdunno
  95.  
  96.         inc     al              ; AL = FF?
  97.         jne     avtdunno
  98.  
  99. avtcheck_1:
  100.         cmp     dx, 16h         ; DX = ^V?
  101.         jne     avtbad
  102.  
  103.         clc
  104.         ret
  105.  
  106. avtbad:
  107.         stc
  108.         ret
  109.  
  110. avtdunno:
  111.         ; At this point Avatar either is not loaded, or it is turned off.
  112.         ; We attempt to pass a dummy command to it. If it fails, Avatar
  113.         ; is not loaded
  114.  
  115.         push    cx              ; save the command line count
  116.         mov     cx, 1
  117.         lea     si, dummy
  118.         mov     ax, 1A00h OR '!'
  119.         int     2Fh
  120.         pop     cx              ; restore the count
  121.  
  122.         jc      avtbad          ; no avatar
  123.         inc     al
  124.         jne     avtbad
  125.         jmp     avtcheck_1      ; could be, continue checking
  126.  
  127. avatar  ends
  128.  
  129.         end     begin
  130.  
  131.