fancom: seems like you're trying to doublebuffer. check out zippy's tut on double buffering, then ninkazu's tutorial on double buffering.
why not use screen 13? much better. same size screen, but 256 colours, aka 8 bit. so 8 bits = 1 byte, 1 byte = 1 pixel, 1 integer = 2 bytes (very convient) so 1 integer = 2 pixels.
so therefore if you were double buffering the whole screen, 320*200, 64000 pixels in area. but it's too big. so we're going to have to store two pixels in one integer, so it will be cut in half, 32000. if you want it in get/put format, you'll need two extra integers, one for the width in bits (so width * 8) and the height in pixels. so it seems like you need 32002, but you only need 32001, since counting in qbasic starts at 0. (0,1,2,3...) the very first variable will be 320*8, or 2560. the second will contain the height of the screen, 200 pixels. so therefore...
dim buffer(32001)
buffer(0) = 320*8
buffer(1) = 200
or...
get(0,0)-(319,199), buffer
so now you're set. however, now you need to be able to draw pixels on the buffer. with plasma357's setvideoseg, you could use qb's primary routines (pset, line, etc. etc. ) but if you don't want to use them, then you'll have to use poke. once again this only works in screen 13.
first of all, you have to set the default segment to the buffer, as poke "pokes" information to whereever the def seg is pointing too. however, if you use
def seg = buffer(0)
then it will set the default segment to 2560. in order to find the address the buffer is at, you must use varseg. it returns the segment of whatever variable you put in it.
def seg = varseg(buffer(0))
but now how do we put a pixel on the buffer? well, first you need to know the x and the y. now, poke works like this:
poke offset, byte
this creates problems. how do we get the x and y variables in there? well, you should be able to tell that this is one dimensional. since the screen is 320 pixels wide, then we should have enough information to find the offset, or x and y coordinates on the buffer.
poke 320& * y + x + varptr(buffer(2), colour
now, we times the y with 320 because since we're working with one dimension, timesing the y with 320 will bring the offset to the right row. adding x will move it forward to the right column. you must add varptr(buffer(2) to skip over the two variables holding the size of the buffer. for example, say x is 32 an y is 1. first you times the y with 320. this will move the the coordinates to the right row. then you add x, which moves teh coordinates to teh right column. oh, the reason why it's 320& instead of just 320 is because the buffer will overflow if you don't.
sub putpixel (x, y, colour, buffer()
def seg = varseg(buffer(0))
offset& = 320& * y + x + varptr(buffer(2))
poke offset&, colour
end sub
maybe later i'll explain it better.