home *** CD-ROM | disk | FTP | other *** search
- ; PEEKDBL.ASM
- ;
- ; by Ralph Davis
- ; modified by Leonard Zerman
- ;
- ; Placed in the public domain by Tom Rettig Associates, 10/22/1990.
- ;
- PUBLIC PEEKDBL
-
- EXTRN _TR_PEEK_PARMS:FAR, __TR_ITOD:FAR
-
- INCLUDE EXTENDA.MAC
-
- ;*****************************************************
- PEEKDBL_TEXT SEGMENT BYTE PUBLIC 'CODE'
- ASSUME CS:PEEKDBL_TEXT
- ;-----------------------------------------------------
- ; PEEKDBL(segment, offset)
- ;
- ; segment = SPACE(4) && hexadecimal string
- ; offset = number < 65536 or hexadecimal string
- ;
- ; Returns: 8-byte floating number at segment:offset
- ; -1 if less than two parameters passed
- ;--------------
- PEEKDBL PROC FAR
- PUSH BP
- MOV BP,SP
- PUSH DS
- PUSH ES
- PUSH SI
- CALL _TR_PEEK_PARMS
- JL PEEKDBL_ERR ; Sign flag set means less than 2 parms
- MOV DS,SI
- MOV SI,AX ; DS:SI now points to requested
- ; floating-point number
- MOV DX,[SI] ; pick it up
- MOV CX,[SI+2] ; AX:BX:CX:DX
- MOV BX,[SI+4]
- MOV AX,[SI+6]
- JMP SHORT PEEKDBL_EXIT ; and we're done
- PEEKDBL_ERR:
- MOV AX,-1 ; return -1 for error condition
- PUSH AX
- CALL __TR_ITOD ; converts int in AX to double in AX:BX:CX:DX
- ADD SP,2
- PEEKDBL_EXIT:
- POP SI
- POP ES
- POP DS
- POP BP
- RET_DBL AX,BX,CX,DX ; return double precision value to caller
- RET
- PEEKDBL ENDP
- ;------------------------------------------------
- PEEKDBL_TEXT ENDS
- ;************************************************
- END
-