home *** CD-ROM | disk | FTP | other *** search
/ 20th Century Video Alman…Century in Depth - Sports / ALMANAC_03.iso / vesa / everex / e626vesa.exe / VIDUTIL.ASM < prev    next >
Assembly Source File  |  1991-03-29  |  9KB  |  424 lines

  1. ;------------------------------------------------------------------------
  2. ;02/19/90 GL    - Source code created
  3. ;------------------------------------------------------------------------
  4. ;------------------------------------------------------------------------
  5. ; BIOS data area variables
  6.  
  7. cSegMono    equ    0B000h
  8. cSegColor    equ    0B800h
  9. cSegGrfx    equ    0A000h
  10.  
  11. mSysEquip         equ    0410h
  12.  
  13. mSysMode          equ    0449h
  14. mSysColumns       equ    044Ah
  15. mSysRegenLen      equ    044Ch
  16. mSysRegenOfs      equ    044Eh
  17. mSysCursorPos     equ    0450h
  18. mSysCursorType     equ    0460h
  19. mSysVideoPage     equ    0462h
  20. mSysCRTC          equ    0463h
  21. mSys3x8           equ    0465h
  22. mSys3x9           equ    0466h
  23.  
  24. mSysRows          equ    0484h
  25. mSysPoints        equ    0485h
  26. mSysEGAInfo       equ    0487h
  27. mSysSwitches      equ    0488h
  28. mSysVGAInfo       equ    0489h
  29. mSysDCCIndex      equ    048Ah
  30.  
  31. mSysSavePtr       equ    04A8h
  32.  
  33. mSysPrntScrnStat equ    0500h
  34.  
  35. CR        equ    0Dh
  36. LF        equ    0Ah
  37. BS        equ    08h
  38.  
  39. ;------------------------------------------------------------------------
  40.  
  41.     cseg    segment word public 'CODE'
  42.  
  43.     assume    cs:cseg
  44.     assume    ds:cseg
  45.     assume    es:cseg
  46.  
  47.     org    0100h
  48.  
  49.     public    EndTSRCode
  50.  
  51. Start:
  52.  
  53.     jmp    Initialize
  54.  
  55.         db 'VIDUTIL'
  56. ShiftMask       label byte
  57.         db cShiftMask
  58. HotKey          label byte
  59.         db cHotKey
  60.     
  61. ;------------------------------------------------------------------------
  62. INSACTIVE    equ    10000000b
  63. CAPSACTIVE    equ    01000000b
  64. NUMACTIVE    equ    00100000b
  65. SCRLACTIVE    equ    00010000b
  66. ALTACTIVE    equ    00001000b
  67. CTRLACTIVE    equ    00000100b
  68. LSHFTACTIVE    equ    00000010b
  69. RSHFTACTIVE    equ    00000001b
  70.  
  71. cHotKey        equ    31h        ; 'N'
  72.             ;37h        ; Prnt Scrn on keypad(*) key
  73. cShiftMask    equ    CTRLACTIVE + ALTACTIVE
  74.                     ; [Ctrl][Alt] key
  75.                     ; b7 - Insert Active
  76.                     ; b6 - Caps Lock Active
  77.                     ; b5 - Num Lock Active
  78.                     ; b4 - Scroll Lock Active
  79.                     ; b3 - Alt key depressed
  80.                     ; b2 - Ctrl key depressed
  81.                     ; b1 - Left shift key depressed
  82.                     ; b0 - Right shift key depressed
  83.  
  84. BusyFlags    db    00h        ; Active bit flags
  85.                     ;  b0 : video active
  86. OldInt09    dd 0000h    ; Keyboard Break vector
  87.  
  88. ;------------------------------------------------------------------------
  89.  
  90. NewInt09    proc    far
  91.  
  92.     sti
  93.     push    ax
  94.  
  95.     in    al,60h        ; Get scan code
  96.     cmp    al,cs:[HotKey]
  97.     je    Trigger
  98. Int09Exit:
  99.     pop    ax
  100.     jmp    dword ptr cs:[OldInt09]
  101.  
  102. Trigger:
  103.     mov    ah,2
  104.     int    16h
  105.  
  106.     and    al,0Fh
  107.     cmp    al,cs:[ShiftMask]        ; Alt key?
  108.     jne    Int09Exit
  109.  
  110.     test    cs:[BusyFlags],00000001b    ; Is VIDUTIL active?
  111.     jnz    Int09Exit
  112.     or    cs:[BusyFlags],00000001b    ; VIDUTIL is active now
  113.  
  114.     pushf
  115.     call    dword ptr cs:[OldInt09]
  116.  
  117.     push    bx
  118.     push    cx
  119.     push    dx
  120.     push    bp
  121.     push    si
  122.     push    di
  123.     push    ds
  124.     push    es
  125.  
  126.     push    cs
  127.     pop    ds            ; DS = CS
  128.  
  129.     xor    ax,ax
  130.     mov    es,ax            ; ES = 0
  131.  
  132.     call    VideoUtil
  133.  
  134.     and    cs:[BusyFlags],11111110b    ; VIDUTIL done
  135.  
  136.     pop    es
  137.     pop    ds
  138.     pop    di
  139.     pop    si
  140.     pop    bp
  141.     pop    dx
  142.     pop    cx
  143.     pop    bx
  144.     pop    ax
  145.     iret
  146.  
  147. NewInt09    endp
  148.  
  149. ;------------------------------------------------------------------------
  150. ;------------------------------------------------------------------------
  151.  
  152. VideoUtil        proc    near
  153.  
  154. GetKB1:
  155.     xor    ah,ah
  156.     int    16h            ; Check keyboard
  157.  
  158.     cmp    ah,1            ; Esc key?
  159.     jne    NotEsc
  160.  
  161.     jmp    VideoUtilDone          ; Exit on Esc key
  162.  
  163. NotEsc:
  164.     cmp    ah,21h            ; Is it F? (Flicker filter)
  165.     je    FlickerFilter
  166.     cmp    ah,16h            ; Is it U? (Underscan mode)
  167.     je    Underscan
  168.     cmp    ah,2Fh            ; Is it V? (Video enable)
  169.     je    VideoBlank
  170.         cmp     ah,0Bh                  ; Is it 0? (Center H&V Pan)
  171.         je      HorzVertPan0
  172.     cmp    ah,48h            ; Is it up arrow?
  173.     je    DoUpArrow
  174.     cmp    ah,50h            ; Is it dn arrow?
  175.     je    DoDnArrow
  176.     cmp    ah,4Bh            ; Is it left arrow?
  177.     je    DoLeftArrow
  178.     cmp    ah,4Dh            ; Is it right arrow?
  179.     je    DoRightArrow
  180.     jmp    short GetKB1
  181.  
  182. DoUpArrow:
  183.         jmp     UpArrow
  184. DoDnArrow:
  185.         jmp     DnArrow
  186. DoLeftArrow:
  187.         jmp     LeftArrow
  188. DoRightArrow:
  189.         jmp     RightArrow
  190.  
  191. FlickerFilter:
  192.         mov     ax,7000h
  193.         mov     bx,0007h
  194.         mov     cl,00h
  195.         int     10h                     ;Get Video Status
  196.  
  197.         mov     ax,7000h
  198.         mov     bx,0007h
  199.         mov     cl,02h
  200.  
  201.         and     ch,00000001b
  202.         xor     ch,1
  203.  
  204.         int     10h
  205.  
  206.         jmp     short GetKB1
  207.  
  208. Underscan:
  209.         mov     ax,7000h
  210.         mov     bx,0007h
  211.         mov     cl,00h
  212.         int     10h                     ;Get Video Status
  213.  
  214.         mov     ax,7000h
  215.         mov     bx,0007h
  216.         mov     cl,03h
  217.  
  218.         shr     ch,1
  219.         and     ch,00000001b
  220.         xor     ch,1
  221.  
  222.         int     10h
  223.  
  224.         jmp     short GetKB1
  225.  
  226. VideoBlank:
  227.         mov     ax,7000h
  228.         mov     bx,0007h
  229.         mov     cl,00h
  230.         int     10h                     ;Get Video Status
  231.  
  232.         mov     ax,7000h
  233.         mov     bx,0007h
  234.         mov     cl,01h
  235.  
  236.         shr     ch,1
  237.         shr     ch,1
  238.         and     ch,00000001b
  239.         xor     ch,1
  240.  
  241.         int     10h
  242.  
  243.         jmp     GetKB1
  244.  
  245. HorzVertPan0:
  246.         mov     ax,7000h
  247.         mov     bx,0007h
  248.         mov     cl,04h
  249.         mov     ch,00h
  250.         int     10h
  251.  
  252.         mov     ax,7000h
  253.         mov     bx,0007h
  254.         mov     cl,05h
  255.         mov     ch,00h
  256.         int     10h
  257.  
  258.         jmp     GetKB1
  259.  
  260. UpArrow:
  261.         mov     ax,7000h
  262.         mov     bx,0007h
  263.         mov     cl,00h
  264.         int     10h                     ;Get Video Status
  265.  
  266.         mov     ax,7000h
  267.         mov     bx,0007h
  268.         mov     cl,05h
  269.         mov     ch,dl
  270.         inc     ch
  271.  
  272.         int     10h
  273.  
  274.         jmp     GetKB1
  275.  
  276. DnArrow:
  277.         mov     ax,7000h
  278.         mov     bx,0007h
  279.         mov     cl,00h
  280.         int     10h                     ;Get Video Status
  281.  
  282.         mov     ax,7000h
  283.         mov     bx,0007h
  284.         mov     cl,05h
  285.         mov     ch,dl
  286.         dec     ch
  287.  
  288.         int     10h
  289.  
  290.         jmp     GetKB1
  291.  
  292. LeftArrow:
  293.         mov     ax,7000h
  294.         mov     bx,0007h
  295.         mov     cl,00h
  296.         int     10h                     ;Get Video Status
  297.  
  298.         mov     ax,7000h
  299.         mov     bx,0007h
  300.         mov     cl,04h
  301.         mov     ch,dh
  302.         inc     ch
  303.  
  304.         int     10h
  305.  
  306.         jmp     GetKB1
  307.  
  308. RightArrow:
  309.         mov     ax,7000h
  310.         mov     bx,0007h
  311.         mov     cl,00h
  312.         int     10h                     ;Get Video Status
  313.  
  314.         mov     ax,7000h
  315.         mov     bx,0007h
  316.         mov     cl,04h
  317.         mov     ch,dh
  318.         dec     ch
  319.  
  320.         int     10h
  321.  
  322.         jmp     GetKB1
  323.  
  324. VideoUtilDone:
  325.         ret
  326.  
  327. VideoUtil        endp
  328.  
  329. ;------------------------------------------------------------------------
  330. ;------------------------------------------------------------------------
  331.  
  332. EndTSRCode    label byte
  333.  
  334. ;------------------------------------------------------------------------
  335. ;------------------------------------------------------------------------
  336. Initialize:
  337.     mov    dx,offset Copyright
  338.     mov    ah,9
  339.     int    21h            ; Display title message
  340.  
  341.     not    byte ptr cs:[Start]    ; Search for previous VideoUTIL
  342.     xor    bx,bx
  343.     mov    ax,cs
  344.  
  345. NextSeg:
  346.     inc    bx
  347.     cmp    ax,bx            ; Search up to this segment
  348.     mov    es,bx
  349.     je    NotInstalled
  350.  
  351.     mov    si,offset Start
  352.     mov    di,si
  353.     mov    cx,0Ah
  354.     rep    cmpsb            ; Check for signature string
  355.  
  356.     or    cx,cx            ; Did they match
  357.     jnz    NextSeg
  358.  
  359.     mov    dx,offset InstalledMesg
  360.     jmp    short ErrExit
  361.  
  362. NotInstalled:
  363.     mov    ah,30h
  364.     int    21h            ; Check for DOS 2.0 or later
  365.  
  366.     cmp    al,2
  367.     jae    VerOK
  368.     mov    dx,offset BadDosMesg
  369.  
  370. ErrExit:
  371.     mov    ah,9
  372.     int    21h
  373.  
  374.     int    20h            ; Display error and exit
  375.  
  376. VerOK:
  377.     mov    ax,3509h        ; Keyboard break vector
  378.     int    21h
  379.  
  380.     mov    word ptr ds:[OldInt09  ],bx
  381.     mov    word ptr ds:[OldInt09+2],es    ; Save old vector
  382.     mov    dx,offset NewInt09
  383.     mov    ax,2509h
  384.     int    21h            ; Install new handler
  385.  
  386.     push    cs
  387.     pop    ds
  388.  
  389.     mov    ax,ds:[002Ch]        ; Get environment seg
  390.     mov    es,ax
  391.     mov    ah,49h            ; Release memory
  392.     int    21h
  393.  
  394.     mov    dx,offset EndTSRCode
  395. ;    mov    dx,ds:[BuffEnd]
  396.     int    27h            ; TSR
  397.  
  398. ;------------------------------------------------------------------------
  399. Copyright    db 'VIDUTIL v1.0 (c) 1990 Everex Systems, Inc.',CR,LF
  400.         db 'Hotkey is [Alt][Ctrl][N]',CR,LF
  401.         db 'Courtesy of Gary Lorensen',CR,LF
  402.         db CR,LF
  403.         db '╓─────────────────────────────────╥──────────────────────────────────────╖',CR,LF
  404.         db '║[Up]           - Pan Up          ║[U]     - Underscan mode              ║',CR,LF
  405.         db '║[Down]         - Pan Down        ║[V]     - Video enable/disable        ║',CR,LF
  406.         db '║[Left]         - Pan Left        ║[0]     - Center Horz&Vert Pan        ║',CR,LF
  407.         db '║[Right]        - Pan Right       ║[ESC]   - Exit TSR and return to app  ║',CR,LF
  408.         db '║[F]            - Flicker filter  ║                                      ║',CR,LF
  409.         db '╙─────────────────────────────────╨──────────────────────────────────────╜',CR,LF
  410.         db '$',1Ah
  411.  
  412. InstalledMesg    db 'VIDUTIL has been previously installed.',CR,LF,'$'
  413. BadDosMesg    db 'VIDUTIL requires DOS 2.0 or later.',CR,LF,'$'
  414. ;------------------------------------------------------------------------
  415.  
  416. cseg    ends
  417.  
  418.     end    Start
  419.  
  420.     
  421. ;------------------------------------------------------------------------
  422.  
  423.