home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / OS2BAS.ZIP / SNDMHOOK.ASM < prev    next >
Assembly Source File  |  1989-09-14  |  2KB  |  64 lines

  1. ; Program Name: SndMHook.ASM
  2. ;
  3. ; Functions   :
  4. ;
  5.  
  6. DOSSEG
  7. .286                      ; OS/2 only runs on 286 machines
  8. .model medium, PASCAL     ; Medium memory model when interfacing with BASIC
  9.                           ; PASCAL and BASIC use same calling conventions
  10.  
  11. .data
  12.  
  13. bhab1         DW  ?       ; set up local data for BasClientWndProc
  14. bhab2         DW  ?
  15. bsmh1         DW  ?
  16. bsmh2         DW  ?
  17. bfintertask   DW  ?
  18.  
  19. .code
  20.  
  21. EXTRN  SendMsgHook:PROC   ; BASIC function to call
  22.  
  23. PUBLIC BasSendMsgHook, RegSendMsgHook
  24.  
  25. BasSendMsgHook PROC hab1:word, hab2:word, smh1:word, smh2:word, fintertask:word
  26.  
  27.    push ds
  28.    mov  ax, @data           ; get our data segment
  29.    mov  ds, ax
  30.  
  31.    mov  ax, hab2            ; transfer the values passed
  32.    mov  bhab1, ax           ; from PM to local variables
  33.    mov  ax, hab1            ; for the call to BASIC
  34.    mov  bhab2, ax
  35.    mov  ax, smh2
  36.    mov  bsmh1, ax
  37.    mov  ax, smh1
  38.    mov  bsmh2, ax
  39.    mov  ax, fintertask
  40.    mov  bfintertask, ax
  41.  
  42.    mov  ax, OFFSET bhab1    ; set up for call to BASIC
  43.    push ax                  ; BASIC expects values to
  44.    mov  ax, OFFSET bsmh1    ; be passed by reference.
  45.    push ax
  46.    mov  ax, OFFSET bfintertask
  47.    push ax
  48.  
  49.    call SendMsgHook         ; call BASIC routine - note
  50.                             ; return values are already
  51.    pop  ds                  ; in dx, ax so we don't have
  52.    ret                      ; to do anything.
  53.  
  54. BasSendMsgHook ENDP
  55.  
  56. RegSendMsgHook PROC
  57.    mov dx, SEG BasSendMsgHook     ; return address of
  58.    mov ax, OFFSET BasSendMsgHook  ; BASIC routine.
  59.    ret
  60.  
  61. RegSendMsgHook ENDP
  62.  
  63.    end
  64.