home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / lan / netlight / netlight.asm next >
Assembly Source File  |  1987-11-12  |  5KB  |  178 lines

  1. ;Simulates a disk-drive light for network activity.  When a packet is sent or
  2. ;recieved, a block will flash at the upper, right corner of the screen.
  3. ;
  4. ;Andy Stevens   11/10/87
  5.  
  6.          page ,132
  7.          name NetLight
  8.  
  9. CR                    equ 13
  10. LF                    equ 10
  11. Interrupt             equ 71h
  12.  
  13. CSeg     segment byte public 'CODE'
  14.          org     100h
  15.          assume  CS: CSeg, DS:CSeg, ES: nothing, SS: nothing
  16.  
  17. ENTRY    proc near
  18.          jmp  initialize               ;skip over the resident part of program
  19.  
  20.  
  21. OldVector label dword                  ;storage space for old interrupt vector
  22.          VectorOff dw 0
  23.          VectorSeg dw 0
  24.  
  25. CursorRow db 0
  26. CursorCol db 0
  27. Character db 0
  28. Attribute db 0
  29.  
  30. Signature db 'NETLIGHT'
  31.  
  32. InterruptServiceRoutine proc far
  33.          call Invert
  34.          jmp  cs: dword ptr OldVector  ;call the old int 0x71 ISR
  35. InterruptServiceRoutine endp
  36.  
  37. Invert proc near
  38.          push  ax
  39.          push  bx
  40.          push  cx
  41.          push  dx
  42.  
  43.          mov  ah, 3                    ;get cursor position
  44.          xor  bh, bh                   ;page 0
  45.          int  10h
  46.          mov  cs: byte ptr CursorRow, dh            ;save for later
  47.          mov  cs: byte ptr CursorCol, dl
  48.  
  49.          mov  ah, 2                    ;set cursor position
  50.          mov  dl, 79                   ;colum 79
  51.          xor  dh, dh                   ;row 0
  52.          xor  bh, bh                   ;page 0
  53.          int  10h
  54.  
  55.          mov  ah, 8                    ;get character and attribute
  56.          xor  bh, bh                   ;page 0
  57.          int  10h
  58.          mov  cs: byte ptr Character, al   ;save for later
  59.          mov  cs: byte ptr Attribute, ah
  60.  
  61.          mov  ah, 9                    ;put character and attribute
  62.          mov  al, 219                  ;block character
  63.          mov  bl, ah
  64.          not  bl                       ;reverse the attribute
  65.          xor  bh, bh                   ;page 0
  66.          mov  cx, 1                    ;one character
  67.          int  10h
  68.  
  69.          mov  cx, 100                  ;brief delay
  70. l1:      nop
  71.          loop l1
  72.  
  73.          mov  ah, 9                        ;put character and attribute
  74.          mov  al, cs: byte ptr Character   ;restore old character
  75.          mov  bl, cs: byte ptr Attribute   ;and attribute
  76.          xor  bh, bh                       ;page 0
  77.          mov  cx, 1                        ;one character
  78.          int  10h
  79.  
  80.          mov  ah, 2                        ;set cursor position
  81.          mov  dh, cs: byte ptr CursorRow   ;restore old cursor position
  82.          mov  dl, cs: byte ptr CursorCol
  83.          xor  bh, bh
  84.          int  10h
  85.  
  86.          pop  dx
  87.          pop  cx
  88.          pop  bx
  89.          pop  ax
  90.          ret
  91. Invert endp
  92.  
  93.  
  94.      page
  95. ;***************************************************************************
  96. ;* The remainder of code will perform the folowing functions:
  97. ;*
  98. ;*    1) verify that the computer is running a NetWare shell.
  99. ;*    2) check for previous installation of NetLight.
  100. ;*    3) terminate and stay resident, leaving only the ISR
  101. ;*
  102. ;*
  103. ;*  Everything below this point will be discarded when the program TSR's
  104. ;*
  105.  
  106. Initialize:
  107.      call CheckForIPX             ;check for an IPX module
  108.      call CheckPrevious           ;check for previous installations
  109.  
  110.      mov ax, 3500h + Interrupt    ;save old interrupt vector
  111.      int 21h                      ;returned in ES:BX
  112.  
  113.      mov VectorSeg, es
  114.      mov VectorOff, bx
  115.  
  116.      mov ax, cs
  117.      mov ds, ax
  118.      mov dx, offset InterruptServiceRoutine
  119.      mov ax, 2500h + Interrupt
  120.      int 21h
  121.  
  122.      mov  dx, offset message1       ;confirmation message
  123.      mov  ah, 9
  124.      int  21h                       ;display message
  125.      mov  dx, offset Initialize
  126.      int  27h                       ;TSR
  127. ENTRY endp
  128.  
  129. CheckForIPX proc near
  130.      mov  ax, 357Ah                 ;get interrupt address of int 0x7A
  131.      int  21h                       ;vector returned in ES:BX
  132.      sub  bx, 6                     ;IPX signature begins 6 bytes before
  133.      mov  di, bx                    ;the int 0x7A handler
  134.      mov  si, offset IPXString
  135.      mov  cx, 4
  136.      cli
  137.      repz cmpsb
  138.      jnz  NoIPX
  139.      ret
  140. NoIPX:
  141.      mov  ah, 9
  142.      mov  dx, offset message2       ;no IPX module present
  143.      int  21h                       ;display message
  144.      int  20h                       ;abort
  145. CheckForIPX endp
  146.  
  147.  
  148. CheckPrevious proc near
  149.      mov  ax, 3500h + Interrupt     ;get interrupt address of interrupt
  150.      int  21h                       ;vector returned in ES:BX
  151.      sub  bx, 8                     ;signature is 8 bytes befor ISR
  152.      mov  di, bx
  153.      mov  si, offset NetString
  154.      mov  cx, 8                     ;signature length of 8 bytes
  155.      cli
  156.      repz cmpsb
  157.      jz  Previous
  158.      ret
  159. Previous:
  160.      mov  ah, 9
  161.      mov  dx, offset message3       ;already installed
  162.      int  21h                       ;display message
  163.      int  20h                       ;abort
  164. CheckPrevious endp
  165.  
  166.      page
  167. ;display messages
  168. message1 db 'NetLight loaded',CR,LF,'$'
  169. message2 db 'ERROR - No IPX module present.  Aborting',CR,LF,'$'
  170. message3 db 'ERROR - NetLight already installed.  Aborting',CR,LF,'$'
  171.  
  172. ;signature strings
  173. IPXString db 'IPX',0
  174. NetString db 'NETLIGHT'
  175.  
  176. CSeg  ends
  177.       end ENTRY
  178.