home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / lansystk.zip / SAMPLE / MPTS / SAMPLDOS / APPENDS.ASM next >
Assembly Source File  |  1998-05-08  |  5KB  |  180 lines

  1.         PAGE  ,132
  2. ;
  3. ;   This file contains all the appendage routines
  4. ;
  5. ;
  6. ;
  7. ;
  8.         TITLE    appends
  9. ;;
  10.                %OUT  MASM - LARGE MODEL ASSEMBLY
  11. ;;
  12. ;;       Define the ARGUMENT BASE relative to BP
  13. ;;
  14.                @AB      EQU       6
  15.  
  16. ;;
  17. ;;       Define all of the IBMC segments
  18. ;;
  19. _TEXT          SEGMENT BYTE PUBLIC 'CODE'       ; Default code segment
  20. _TEXT          ENDS
  21. NULL           SEGMENT PARA PUBLIC 'BEGDATA'    ; Null pointer assignment check
  22. NULL           ENDS
  23. _DATA          SEGMENT WORD PUBLIC 'DATA'       ; Default data segment
  24. _DATA          ENDS
  25. CONST          SEGMENT WORD PUBLIC 'CONST'      ; Read only constants
  26. CONST          ENDS
  27. _BSS           SEGMENT WORD PUBLIC 'BSS'        ; Uninitialized static data
  28. _BSS           ENDS
  29. STACK          SEGMENT PARA STACK 'STACK'       ; Stack segment
  30. STACK          ENDS
  31. ;;
  32. DGROUP         GROUP   NULL,_DATA,CONST,_BSS,STACK
  33. _TEXT          SEGMENT BYTE PUBLIC 'CODE'
  34.                ASSUME    CS:_TEXT,DS:DGROUP
  35. ;;
  36.  
  37.  
  38. CCBspin       label dword
  39. CCBspin_off   dw  0
  40. CCBspin_seg   dw  0
  41. RECspin       label dword
  42. RECspin_off   dw  0
  43. RECspin_seg   dw  0
  44. DLCspin       label dword
  45. DLCspin_off   dw  0
  46. DLCspin_seg   dw  0
  47.  
  48. ;
  49. ; General CCB completion handler
  50. ;
  51. ;       Simply modifies the extern four-byte variable CCBADDR to the
  52. ;       address of the completing CCB.  The mainline program will be
  53. ;       "spinning" on this variable which it set to zero before invoking
  54. ;       the CCB.
  55. ;
  56.           PUBLIC _CCBCpltApp
  57. _CCBCpltApp  PROC far
  58.  
  59.         cli                             ; we don't want to be bothered
  60.         push ax                         ; housekeeping
  61.         push ds
  62.         push si
  63.  
  64.         lds  si,CCBspin                 ; get the saved address into ds:si
  65.         mov  ds:[si],bx                 ; save bs as the offset there
  66.         mov  ax,es
  67.         mov  ds:[si+2],ax               ; save es as the segment there
  68.  
  69.         pop  si                         ; housekeeping
  70.         pop  ds
  71.         pop  ax
  72.         sti                             ; reenable interrupts
  73.  
  74.         iret                            ; and exit the interrupt
  75. _CCBCPLTAPP  ENDP
  76.  
  77. ; General Received Data handler
  78. ;
  79. ;       Simply modifies the extern four-byte variable RECADDR to the
  80. ;       address of the received buffer.  The mainline program will be
  81. ;       "spinning" on this variable which it set to zero before invoking
  82. ;       starting the receive.
  83. ;
  84.           PUBLIC _RecDataApp
  85. _RecDataApp PROC far
  86.  
  87.         cli                             ; we don't want to be bothered
  88.         push ax                         ; housekeeping
  89.         push ds
  90.         push si
  91.  
  92.         lds  si,RECspin                 ; get the saved address into ds:si
  93.         mov  ds:[si],bx                 ; save bs as the offset there
  94.         mov  ax,es
  95.         mov  ds:[si+2],ax               ; save es as the segment there
  96.  
  97.         pop  si                         ; housekeeping
  98.         pop  ds
  99.         pop  ax
  100.         sti                             ; reenable interrupts
  101.  
  102.         iret                            ; and exit the interrupt
  103. _RecDataApp ENDP
  104.  
  105. ;
  106. ;
  107. ;
  108. ; DLC status change handler
  109. ;
  110. ;       Simply modifies the extern four-byte variable DLCADDR to the
  111. ;       address of the DLC status table.  The mainline program will be
  112. ;       "spinning" on this variable which it set to zero before beginning
  113. ;       to wait for the status change.  The two-byte variable DLCLANA
  114. ;       is also set to the adapter number causing the interrupt.
  115. ;
  116.           PUBLIC _DlcStatApp
  117. _DlcStatApp  PROC far
  118.  
  119.         cli                            ; we don't want to be bothered
  120.         push ax                        ; housekeeping
  121.         push ds
  122.         push si
  123.  
  124.         lds  si,DLCspin                ; get the saved address into ds:si
  125.         mov  ds:[si],bx                ; save bs as the offset there
  126.         mov  ax,es
  127.         mov  ds:[si+2],ax              ; save es as the segment there
  128.  
  129.         pop  si                        ; housekeeping
  130.         pop  ds
  131.         pop  ax
  132.         sti                            ; reenable interrupts
  133.         iret
  134. _DlcStatApp  ENDP                      ; and exit the interrupt
  135.  
  136. ;
  137. ; Appendage initialization function
  138. ;
  139. ;       Accepts the addresses of the three spin variables that the
  140. ;       appendages will modify upon entry.
  141. ;
  142. ;       Returns nothing.
  143. ;
  144.  
  145. ccbloc  =  @AB                          ; location on the stack
  146. recloc  =  @AB+4
  147. dlcloc  =  @AB+8
  148.  
  149.         PUBLIC  _appinit
  150. _appinit PROC far
  151.  
  152.         push bp                         ; housekeeping
  153.         mov  bp,sp
  154.         push si
  155.         push ds
  156.  
  157.         lds  si,ccbloc[bp]              ; save the address of CCBADDR
  158.         mov  cs:CCBspin_off,si
  159.         mov  ax,ds
  160.         mov  cs:CCBspin_seg,ax
  161.         lds  si,recloc[bp]              ; save the address of RECADDR
  162.         mov  cs:RECspin_off,si
  163.         mov  ax,ds
  164.         mov  cs:RECspin_seg,ax
  165.         lds  si,dlcloc[bp]              ; save the address of DLCADDR
  166.         mov  cs:DLCspin_off,si
  167.         mov  ax,ds
  168.         mov  cs:DLCspin_seg,ax
  169.  
  170.         pop  ds                         ; housekeeping
  171.         pop  si
  172.         pop  bp
  173.  
  174.         ret                             ; and return
  175. _appinit ENDP
  176.  
  177.  
  178. _TEXT   ENDS
  179.         end
  180.