NASM - The Netwide Assembler

NASM Forum => Programming with NASM => Topic started by: Charell King on April 28, 2011, 02:56:54 AM

Title: make a function of "peek" by using NASM, who can teach me?
Post by: Charell King on April 28, 2011, 02:56:54 AM
The 'C' language has no the function of "peek", now I want to use NASM and realize the function. who can help me , master
Title: Re: make a function of "peek" by using NASM, who can teach me?
Post by: Keith Kanios on April 28, 2011, 04:35:31 PM
PEEK and POKE are BASIC (http://en.wikipedia.org/wiki/BASIC) constructs that simulate functionality that natively exists in other languages such as C and various assembly languages.

In C, you want to start by studying pointers (http://www.cplusplus.com/doc/tutorial/pointers/).

In NASM, you want to start by studying effective addresses (http://www.nasm.us/doc/nasmdoc3.html#section-3.3).
Title: Re: make a function of "peek" by using NASM, who can teach me?
Post by: Charell King on April 30, 2011, 02:27:51 AM
haha ,you are right .    C - pointer and  NASM - effective address
Title: Re: make a function of "peek" by using NASM, who can teach me?
Post by: Frank Kotler on April 30, 2011, 05:56:00 AM
Yeah, it doesn't take much of a "function" to do the equivalent of "peek" in asm. You don't say "What OS?"... if you're using a segmented memory architecture (dos), and need both segment and offset, it might be worth a "function", but mostly it's "mov reg, [mem]" and you're done...

Best,
Frank