home *** CD-ROM | disk | FTP | other *** search
- ; PEEKSTR.ASM
- ;
- ; by Ralph Davis
- ; modified by Leonard Zerman
- ;
- ; Placed in the public domain by Tom Rettig Associates, 10/22/1990.
- ;
- PUBLIC PEEKSTR
-
- EXTRN _TR_PEEK_PARMS:FAR
-
- INCLUDE EXTENDA.MAC
-
- DGROUP GROUP _DATA
- ;*****************************************************
- _DATA SEGMENT WORD PUBLIC 'DATA'
-
- ;
- NULL_STR DB 0
- ;
- _DATA ENDS
- ;*****************************************************
-
- ;*****************************************************
- PEEKSTR_TEXT SEGMENT BYTE PUBLIC 'CODE'
- ASSUME CS:PEEKSTR_TEXT,DS:_DATA
- ;-----------------------------------------------------
- ;
- ; PEEKSTR(segment, offset)
- ;
- ; segment = SPACE(4) && hexadecimal string
- ; offset = number < 65536 or hexadecimal string
- ;
- ; Returns: string at segment:offset
- ; null string if less than two parameters passed
- ;
- ; NOTE: String must be null-terminated in memory
- ; This function does NOT check for that!
- ;
- ;--------------
- PEEKSTR PROC FAR
- PUSH BP
- MOV BP,SP
- PUSH DS
- PUSH ES
- PUSH SI
- CALL _TR_PEEK_PARMS
- JL PEEKSTR_ERR ; Sign flag set means less than 2 parms
- MOV BX,AX
- MOV AX,SI ; AX:BX now points to string
- JMP SHORT PEEKSTR_EXIT ; and we're done
- PEEKSTR_ERR:
- MOV AX,_DATA ; return null string for error
- MOV BX,OFFSET NULL_STR
- PEEKSTR_EXIT:
- POP SI
- POP ES
- POP DS
- POP BP
- RET_CHAR AX,BX ; return char * to caller
- RET
- PEEKSTR ENDP
- ;------------------------------------------------
- PEEKSTR_TEXT ENDS
- ;************************************************
- END
-