home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / PASCUTIL.ZIP / PEEKSUB.ASM < prev    next >
Encoding:
Assembly Source File  |  1985-11-07  |  896 b   |  28 lines

  1. ; PEEKSUB - subroutine to read memory for Pascal programs
  2. ; PEEKSUB(DATASEG,LOCATION,PEEKVAL)
  3. ; DATASEG is the value of the data segment
  4. ; LOCATION is the memory location relative to the DS (0-66535)
  5. ; PEEKVAL is the integer value (0-255) returned
  6. cseg segment para public 'code'
  7. public peeksub
  8. peeksub proc far
  9.     assume cs:cseg,ds:nothing,ss:nothing,es:nothing
  10.     push bp
  11.     mov bp,sp
  12.     push es         ; save original es
  13.     mov si,[bp+10]   ; point to dataseg
  14.     mov ax,[si]      ; dataseg in ax
  15.     mov es,ax         ; fix extra segment
  16.     mov di,[bp+8]    ; point to memory location
  17.     mov di,[di]      ; location in di
  18.     mov si,[bp+6]    ; point to return value
  19.     mov al,es:[di]   ; peek
  20.     mov ah,0
  21.     mov [si],ax      ; return value
  22.     pop es         ; restore es
  23.     pop bp
  24.     ret 6
  25. peeksub endp
  26. cseg ends
  27.     end
  28.