home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / UTILITY / SYSTEM / REDVIEW2.ZIP / REDVIEW.ASM next >
Encoding:
Assembly Source File  |  1992-03-23  |  6.5 KB  |  283 lines

  1.  
  2. ; REDVIEW.ASM (C) Alexandr NOVY 1988,92
  3.             
  4. IFDEF _286_
  5.  .286
  6.  _pusha_ equ pusha
  7.  _popa_ equ popa
  8. ELSE
  9.  _pusha_ equ call push_all
  10.  _popa_ equ call pop_all
  11. ENDIF
  12.    
  13. MY_FLAG EQU 0BEh
  14.  
  15. _TEXT       SEGMENT
  16.             ASSUME  cs:_TEXT, ds:_TEXT, ss:_TEXT
  17.             ORG     100h
  18.        
  19. $start:      jmp   $begin
  20.  
  21. oldadr21    DD ?
  22. oldadr09    DD ?
  23. oldadr2f    DD ?
  24. duplo       DB 1
  25. character   DB ?
  26.  
  27. ; ################################ INTERRUPT 09 ##############################
  28. $begin09:
  29.             push ax
  30.             in al,60h
  31.             cmp al,3ah
  32.             jne $old09
  33.  
  34.             push es
  35.             xor ax,ax
  36.             mov es,ax
  37.             test byte ptr es:[0417h],08h ; test for Alt
  38.             jne  $alt09
  39.             test byte ptr es:[0417h],04h ; test for Ctrl
  40.             jne  $ctrl09
  41.             pop  es
  42.             jmp  short $old09
  43. $ctrl09:
  44.             mov  cs:duplo,0
  45.             jmp  short $end09
  46. $alt09:
  47.             mov  cs:duplo,1
  48. $end09:
  49.             in al,60h
  50.             in al,61h
  51.             mov ah,al
  52.             or  al,80h
  53.             out 61h,al
  54.             xchg ah,al
  55.             out  61h,al
  56.             mov  al,20h
  57.             out  20h,al
  58.             pop  es
  59.             pop  ax
  60.             sti
  61.             iret
  62. $old09:
  63.            pop ax
  64.            jmp cs:oldadr09
  65. ; ############################# END OF INTERRUPT 09 ##########################
  66.  
  67. IFNDEF _286_
  68. retw DW ?
  69. push_all:
  70.          pop  cs:retw
  71.          push ax
  72.          push bx
  73.          push cx
  74.          push dx
  75.          push bp
  76.          push si
  77.          push di
  78.          jmp  cs:retw
  79. pop_all:
  80.          pop cs:retw
  81.          pop di
  82.          pop si
  83.          pop bp
  84.          pop dx
  85.          pop cx
  86.          pop bx
  87.          pop ax
  88.          jmp cs:retw
  89. ENDIF
  90.  
  91. ; ################################ INTERRUPT 21 ##############################
  92. $begin21:
  93. ;-------------------------------------------------------
  94.                               ; new in version 2.0 :
  95.            cmp ax,4400h       ; IOCTL info for handle 1 & 2
  96.            jne $21_1          ; must be 'device' when
  97.            cmp bx,1           ; REDVIEW installed
  98.            je  $21_dev
  99.            cmp bx,2
  100.            jne $21_1
  101. $21_dev:
  102.            pushf
  103.            call cs:oldadr21
  104.            pushf
  105.            or   dx,80h        ; set 'device' bit in IOCTL info
  106.            popf
  107.            retf 2
  108. $21_1:
  109. ;--------------------------------------------------------            
  110.            cmp cs:duplo,0
  111.            je  $ne21
  112.  
  113.            push bx
  114.            mov  bx,1
  115.            call device_test
  116.            pop  bx
  117.            jne  $ne21
  118.  
  119.            push bx
  120.            mov  bx,2
  121.            call device_test
  122.            pop  bx
  123.            je   $ne21
  124.  
  125.            cmp ah,02
  126.            jne $l2109
  127.            _pusha_
  128.            push ds
  129.            push cs
  130.            pop  ds
  131.            mov  character,dl
  132.            mov  ah,40h
  133.            mov  bx,2
  134.            mov  dx,OFFSET character
  135.            mov  cx,1
  136.            pushf
  137.            call oldadr21
  138.            pop  ds
  139.            _popa_
  140.            jmp  short $ne21
  141. $l2109:
  142.            cmp ah,09
  143.            jne $l2140
  144.            _pusha_
  145. $loop09:
  146.            mov  si,dx
  147.            cmp  byte ptr ds:[si],'$'
  148.            je   $end2109
  149.            mov  ah,40h
  150.            mov  bx,2
  151.            mov  cx,1
  152.            push dx
  153.            pushf
  154.            call cs:oldadr21
  155.            pop  dx
  156.            inc  dx
  157.            jmp  short $loop09
  158. $end2109:
  159.            _popa_
  160. $l2140:
  161.            cmp ah,40h
  162.            jne $ne21
  163.  
  164.            cmp bx,1
  165.            jne $ne21
  166.  
  167.            _pusha_
  168.            push ds
  169.            mov  bx,2
  170.            pushf
  171.            call cs:oldadr21
  172.            pop  ds
  173.            _popa_
  174. $ne21:
  175.            jmp cs:oldadr21
  176.  
  177. device_test:
  178.            push ax
  179.            push dx
  180.            mov  ax,4400h
  181.            pushf
  182.            call cs:oldadr21
  183.            test dl,80h
  184.            pop  dx
  185.            pop  ax
  186.            ret
  187.  
  188. ; ################################ INTERRUPT 2f ##############################
  189. $begin2f:
  190.           cmp  ah,MY_FLAG
  191.           je   $l2f_0
  192.           jmp  cs:oldadr2f
  193. $l2f_0:
  194.           or   al,al
  195.           jne  $l2f_1
  196.           mov  al,0ffh
  197. $l2f_1:
  198.           iret
  199. ; ############################# END OF INTERRUPT 2f ##########################
  200.  
  201. ; ############################# START UP ################################
  202.  
  203. $begin:
  204.  
  205.             mov bx,2
  206.             mov dx,OFFSET ilogo
  207.             mov cx,l_ilogo
  208.             mov ah,40h
  209.             int 21h
  210.  
  211.             mov ah,MY_FLAG
  212.             sub al,al
  213.             int 2fh
  214.             or  al,al
  215.             je  $cont
  216.             cmp al,0ffh
  217.             je  $end
  218.             mov bx,2
  219.             mov dx,OFFSET noins
  220.             mov cx,l_noins
  221.             mov ah,40h
  222.             int 21h
  223. $end:       int 20h
  224. $cont:
  225.             mov ah,35h
  226.             mov al,09h
  227.             int 21h
  228.             mov word ptr oldadr09[2],es
  229.             mov word ptr oldadr09[0],bx ; get int 09
  230.  
  231.             mov ah,35h
  232.             mov al,21h
  233.             int 21h
  234.             mov word ptr oldadr21[2],es
  235.             mov word ptr oldadr21[0],bx ; get int 21
  236.  
  237.             mov ah,35h
  238.             mov al,2fh
  239.             int 21h
  240.             mov word ptr oldadr2f[2],es
  241.             mov word ptr oldadr2f[0],bx ; get int 2f
  242.  
  243.             mov ah,25h
  244.             mov al,09h
  245.             mov dx,OFFSET $begin09
  246.             int 21h                      ; set int 09
  247.  
  248.             mov ah,25h
  249.             mov al,21h
  250.             mov dx,OFFSET $begin21
  251.             int 21h                      ; set int 21
  252.  
  253.             mov ah,25h
  254.             mov al,2fh
  255.             mov dx,OFFSET $begin2f
  256.             int 21h                      ; set int 2f
  257.  
  258.             mov bx,2
  259.             mov dx,OFFSET resins
  260.             mov cx,l_resins
  261.             mov ah,40h
  262.             int 21h
  263.             
  264.             push cs:[2ch] ; release of the enviroment
  265.             pop  es
  266.             mov  ah,49h
  267.             int  21h
  268.             
  269.             push ds
  270.             pop es
  271.             mov dx,OFFSET $begin
  272.             inc dx
  273.             int 27h  ; terminate and stay resident
  274.  
  275. ilogo DB 13,10,"REDVIEW - written by Alexandr NOVY, CVUT FJFI Prague 1988,92.",13,10
  276. l_ilogo EQU $ - ilogo
  277. resins DB "Resident part installed.",13,10
  278. l_resins EQU $ - resins
  279. noins DB "Can not be installed.",13,10
  280. l_noins EQU $ - noins
  281. _TEXT       ENDS
  282.             END   $start
  283.