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

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