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

  1. ; Program Name: MsgfHook.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. bmsgf   DW  ?
  16. bqmsg1  DW  ?
  17. bqmsg2  DW  ?
  18.  
  19. .code
  20.  
  21. EXTRN  MsgFilterHook:PROC        ; BASIC function to call
  22.  
  23. PUBLIC BasMsgFilterHook, RegMsgFilterHook
  24.  
  25. BasMsgFilterHook PROC hab1:word, hab2:word, msgf:word, qmsg1:word, qmsg2: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, msgf
  36.    mov  bmsgf, ax
  37.    mov  ax, qmsg2
  38.    mov  bqmsg1, ax
  39.    mov  ax, qmsg1
  40.    mov  bqmsg2, ax
  41.  
  42.    mov  ax, OFFSET bhab1  ; set up for call to BASIC
  43.    push ax                ; BASIC expects values to
  44.    mov  ax, OFFSET bmsgf  ; be passed by reference.
  45.    push ax
  46.    mov  ax, OFFSET bqmsg1
  47.    push ax
  48.  
  49.    call MsgFilterHook     ; 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. BasMsgFilterHook ENDP
  55.  
  56. RegMsgFilterHook PROC
  57.    mov dx, SEG BasMsgFilterHook    ; return address of
  58.    mov ax, OFFSET BasMsgFilterHook ; BASIC routine.
  59.    ret
  60.  
  61. RegMsgFilterHook ENDP
  62.  
  63.    end
  64.