home *** CD-ROM | disk | FTP | other *** search
- ; The following routine will increment the contents of an integer variable
- ; declared in separately compiled source code. This particular example
- ; involves a Microsoft C main program. The technique illustrated assumes
- ; that this routine is linked with the main program. This is necessary
- ; so that DS correctly addresses C's integer variable.
- ;
- extrn _cvar:WORD ; Integer C variable declared in
- ; the C source file.
- ;
- count segment para public 'CODE'
- assume cs:count
- public _sub
- ;
- _sub proc far ; Function 12 uses a far CALL.
- push ds ; Save Mouse driver's ISS DS.
- mov ax,SEG _cvar ; Restore DS to C programs DGROUP.
- mov ds,ax
- ;
- inc _cvar ; Increment integer C variable.
- ;
- pop ds ; Restore Mouse driver's ISS DS.
- ret ; Far return to Mouse driver's ISS.
- _sub endp
- count ends
- end
-