Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A third way to pset
#1
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!
Reply
#2
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.
Reply
#3
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.
Reply
#4
http://faq.qbasicnews.com/?blast=Plottin...enThirteen
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#5
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.
Reply
#6
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.
Reply
#7
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. ;*)
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply
#8
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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)