Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What is Peek and Poke? 1

Status
Not open for further replies.

palhello

Programmer
Dec 29, 2002
30
NP
I do know how to use get and put to move boxes and other objects, but don't know how to do these things using peek and poke. If we can do these things using peek and poke, what's the difference between get and put and peek and poke? Please describe what peek and poke is supposed to do.
 
PEEK and POKE are used to configure the inner working of the computer, they have nothing to do with graphics.
They can be used to create graphics, but most of the timer they are used for direct memory access
 
How to create graphics with Peek and Poke?
 
for example in screen mode 13 (SCREEN 13)

you can access Video Memory by directly reading and writing to segment &hA000

Dim OffSet as Long
Dim OffY as Long
SCREEN 13
DEF SEG = &hA000
'... your code here
DEF SEG

'A simple Direct Pset Sub might look like...
Sub DPset(X as integer, Y as integer, C as integer)
DEF SEG = &hA000
OffY = Y * 320&
OffSet = OffY + X
Poke OffSet, C
DEF SEG
End sub

'A simple Direct Point Function might look like...
Function DPoint(X as integer, Y as integer)
DEF SEG = &hA000
OffY = Y * 320&
OffSet = OffY + X
DPoint = Peek(OffSet)
DEF SEG
End sub Sometimes... the BASIC things in life are the best...
cheers.gif

or at least the most fun ;-)
-Josh Stribling
 
i don't know wat u guys are talking about. Can't u be a little simpler. What is Dim offset as long.. I do know that Dim is used to store arrays but wats that offset. And what is video memory. I am a complete novice so please explain all the things.
 
DIM is Dimension and can also be used to define the data type...

Long is a long integer data type.

With the above code you reach numbers as high as 64000.

The Highest number in an integer value can be is (positive) 32767

You will get an over flow error if you try to use this code without declareing it as a Long Integer.

Video Memory is a whole nother story...

I believe I answered this question on another post...
see thread314-435162 Sometimes... the BASIC things in life are the best...
cheers.gif

or at least the most fun ;-)
-Josh Stribling
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top