home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / MSMOUSE1.ZIP / EGA.ZIP / INCVAR.ZIP / SUB12.ASM < prev   
Encoding:
Assembly Source File  |  1989-02-10  |  837 b   |  26 lines

  1. ; The following routine will increment the contents of an integer variable
  2. ; declared in separately compiled source code.  This particular example
  3. ; involves a Microsoft C main program.  The technique illustrated assumes
  4. ; that this routine is linked with the main program.  This is necessary
  5. ; so that DS correctly addresses C's integer variable.
  6. ;
  7.     extrn    _cvar:WORD        ; Integer C variable declared in
  8.                     ;   the C source file.
  9. ;
  10. count    segment para public 'CODE'
  11.     assume    cs:count
  12.     public    _sub
  13. ;
  14. _sub    proc    far            ; Function 12 uses a far CALL.
  15.     push    ds            ; Save Mouse driver's ISS DS.
  16.     mov    ax,SEG _cvar        ; Restore DS to C programs DGROUP.
  17.     mov    ds,ax
  18. ;
  19.     inc    _cvar            ; Increment integer C variable.
  20. ;
  21.     pop    ds            ; Restore Mouse driver's ISS DS.
  22.     ret                ; Far return to Mouse driver's ISS.
  23. _sub    endp
  24. count    ends
  25.     end
  26.