Posts: 1,688
Threads: 119
Joined: Jun 2003
yeah. i was surfing the net, when i found a third way to pset a pixel. it's slightly faster than poke offset&, colour, but not much, because it constantly accesses the def seg.
def seg = segment + y * 20
poke x, colour
if it turned out everyone knew this already, then shoot me. if not, then :king:
Jumping Jahoolipers!
Posts: 1,241
Threads: 107
Joined: Feb 2003
I didn't know there was a 2nd way! anyway, congragulations on your discover.
the mind is a beautiful thing, use it and make the world a more beautiful place.
Posts: 292
Threads: 31
Joined: Apr 2003
Newb qustion, but... I knew there was a second way involving peek/poke but never learned it. Can someone show how or link a FAQ? Thanks.
Posts: 6,419
Threads: 74
Joined: Mar 2002
Posts: 3,616
Threads: 287
Joined: Jan 2003
Nice, Barok. Never knew that...*turns it into a subroutine*. Ah, now it's saved in my little library of usefull functions.
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Posts: 1,752
Threads: 21
Joined: Jun 2002
Actually, if you program is compiled you can just set the segment to A000h once and then use short ints (in effect they are unsigned):
poke y * 320 + x, color
If you're running in the IDE, and still want the speed of short ints, you only need to set the segment once for each half of the screen. A000h for the top half, A7D0h for the bottom.
Posts: 3,288
Threads: 167
Joined: Nov 2001
Quote:yeah. i was surfing the net, when i found a third way to pset a pixel. it's slightly faster than poke offset&, colour, but not much, because it constantly accesses the def seg.
def seg = segment + y * 20
poke x, colour
if it turned out everyone knew this already, then shoot me. if not, then :king:
Optimus and Mr. Chow used that in their demos. ;*)
Never got the hang off it though, I use a scanline poke. ;*)
Posts: 1,407
Threads: 117
Joined: Dec 2002
I have used it for years, you can find it at every source in my page. I learnt it from Optimus. I use it to build a table of scanline segments and then search the table for each line. It can't be used if you are filtering and PEEKing from line-1.
In general I find it more IDE friendly than POKE lineoffset%+x%, this one is slightly faster but can't be used from the IDE.
Antoni