[comp.lang.c] how to peek

Leisner.Henr@Xerox.COM (Marty) (11/11/87)

Perhaps this will help end the debate of "how to peek ram on a PC".

You can also use far pointers, although not all compilers support them.

Poke and peekword is just a variation on the following:

procdef	peek,<<offset, word>, <segment, word>>
	push	ds
	mov	ax,segment
	mov	ds,ax
	mov	bx,offset
	mov	al,ds:[bx]
	pop	ds
	mov	ah,0
	pret

procdef is a macro Aztec supplies to set up bp indexing off the stack.
Pret becomoe	pop	bp at the end.  Very handy way to program in 
assembler.


To read 0xf000:0000, call
	peek(0, 0xf000).
	
Hope this helps solve the debate.

marty
ARPA:	leisner.henr@xerox.com
GV:  leisner.henr
NS:  martin leisner:henr801c:xerox
UUCP: martyl@rocksvax.uucp