home *** CD-ROM | disk | FTP | other *** search
- ;_ peek.asm Sun Jan 24 1988 Modified by: Walter Bright */
- ; Copyright (C) 1985-1988 by Northwest Software
- ; All Rights Reserved
- ; Written by Walter Bright
-
- include macros.asm
-
- begcode peek
-
- c_public peek,poke
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; Transfer numbytes from seg:offset to DS:buf
- ; Use:
- ; peek(seg,offset,buf,numbytes);
-
- func peek
- push BP
- mov BP,SP
- .save <SI,DI>
- cld
- push DS
- mov DS,P[BP] ;source segment
- mov SI,P+2[BP] ;source pointer in DS:SI
- if LPTR
- les DI,P+4[BP] ;get pointer to buf in ES:DI
- else
- ife ESeqDS
- mov AX,SS
- mov ES,AX
- endif
- mov DI,P+4[BP] ;get pointer to buf in ES:DI
- endif
- mov CX,P+4+SIZEPTR[BP] ;number of bytes to move
- rep movsb
- pop DS
- .restore <DI,SI>
- pop BP
- ret
- c_endp peek
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; Transfer numbytes from DS:buf to seg:offset
- ; Use:
- ; poke(seg,offset,buf,numbytes);
-
- func poke
- push BP
- mov BP,SP
- .save <SI,DI>
- cld
- if LPTR
- push DS
- mov ES,P[BP] ;segment of destination
- mov DI,P+2[BP] ;ES:DI -> destination
- lds SI,P+4[BP] ;DS:SI -> buf (source pointer)
- mov CX,P+8[BP] ;# of bytes to move
- rep movsb
- pop DS
- else
- push ES
- mov ES,P[BP] ;segment of destination
- mov DI,P+2[BP] ;offset of destination
- mov SI,P+4[BP] ;buf (source offset)
- mov CX,P+6[BP] ;# of bytes to move
- rep movsb
- pop ES
- endif
- .restore <DI,SI>
- pop BP
- ret
- c_endp poke
-
- endcode peek
-
- end
-