home *** CD-ROM | disk | FTP | other *** search
- ; PEEKCHAR.ASM
- ;
- ; by Ralph Davis
- ; modified by Leonard Zerman
- ;
- ; Placed in the public domain by Tom Rettig Associates, 10/22/1990.
- ;
- PUBLIC PEEKCHAR
-
- EXTRN _TR_PEEK_PARMS:FAR
-
- INCLUDE EXTENDA.MAC
-
- DGROUP GROUP _DATA
- ;*****************************************************
- _DATA SEGMENT WORD PUBLIC 'DATA'
-
- ;
- NULL_STR DB 0
- CHAR_BUFF DB ?,0 ; Buffer for return of character
- ;
- _DATA ENDS
- ;*****************************************************
-
- ;*****************************************************
- PEEKCHAR_TEXT SEGMENT BYTE PUBLIC 'CODE'
- ASSUME CS:PEEKCHAR_TEXT, DS:PEEKCHAR_TEXT
- ;-----------------------------------------------------
- ;
- ; PEEKCHAR(segment, offset)
- ;
- ; segment = SPACE(4) && hexadecimal string
- ; offset = number < 65536 or hexadecimal string
- ;
- ; Returns: one-byte string at segment:offset
- ;----------------
- PEEKCHAR PROC FAR
-
- PUSH BP
- MOV BP,SP
- PUSH SI
- PUSH DI
- PUSH DS
- PUSH ES
- CALL _TR_PEEK_PARMS
- JL PEEKCHAR_ERR ; Sign flag set means less than 2 parms
- MOV DS,SI ; DS:SI now points to one-byte string
- MOV SI,AX
- MOV DX,_DATA ; Point ES:DI to memory location we
- MOV ES,DX ; will use to return character
- MOV DI,OFFSET CHAR_BUFF
- MOV AX,DI ; DX:AX now has address to
- ; return to caller
- MOVSB ; Place the character in
- ; the return buffer
- JMP SHORT PEEKCHAR_EXIT ; and we're done
- PEEKCHAR_ERR:
- MOV DX,_DATA ; return null string for error
- MOV AX,OFFSET NULL_STR
- PEEKCHAR_EXIT:
- POP ES
- POP DS
- POP DI
- POP SI
- POP BP
- RET_CHAR DX,AX ; return char * to caller
- RET
-
- PEEKCHAR ENDP
- ;------------------------------------------------
- PEEKCHAR_TEXT ENDS
- ;************************************************
- END
-
-