home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
xbase
/
library
/
clipper
/
rettig
/
source
/
offset.asm
< prev
next >
Wrap
Assembly Source File
|
1990-10-21
|
2KB
|
69 lines
; OFFSET.ASM
;
; by Ralph Davis, Leonard Zerman
;
; Placed in the public domain by Tom Rettig Associates, 10/22/1990.
;
PUBLIC _OFFSET
EXTRN __TR_HEXASM:FAR
;===================
IN_PARMS STRUC
BP_OLD DW ?
RET_ADDR DD ?
IN_VAR DD ? ; Variable we want the offset of
OUT_VAR DD ? ; Variable to return offset in
; must be 4-byte character variable
; (not including null terminator)
IN_PARMS ENDS
;===================
;************************************
_TEXT SEGMENT BYTE PUBLIC 'CODE'
ASSUME CS:_TEXT
;------------------------------------
_OFFSET PROC FAR
PUSH BP
MOV BP,SP
PUSH DS
PUSH ES
PUSH AX
PUSH BX
PUSH CX
PUSH SI
PUSH DI
LDS SI,[BP].IN_VAR
LES DI,[BP].OUT_VAR
XOR BX,BX
PUSH BX ; pass 0 as first parameter
PUSH SI ; push offset address
CALL __TR_HEXASM ; Returns address of hex string
; in DX:AX
ADD SP,4 ; discard parms from stack
MOV DS,DX ; set up registers to return offset
MOV SI,AX ; DX=segment; AX=offset
MOV CX,4
REP MOVSB ; return offset address
POP DI
POP SI
POP CX
POP BX
POP AX
POP ES
POP DS
POP BP
RET
_OFFSET ENDP
;------------------------------------
_TEXT ENDS
;*****************************************
END