Qbasicnews.com
February 20, 2020, 10:22:27 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: DOn't poke and Don't peek!  (Read 2242 times)
nkk_kan
Member
*
Posts: 73


« on: June 29, 2006, 11:24:43 AM »

One more question.....
What is the use of those
peek and poke commandS???

and also if u cud explain about the usage of pallettes....

 :roll:
Logged

\__/)
(='.'=) Copy bunny into your signature to
(")_(") help him gain world domination.
torstum
Member
*
Posts: 62


« Reply #1 on: June 29, 2006, 03:06:59 PM »

I think you can PEEK all you want, but POKEing is dangerous, unless you really know what you're doing. I think PEEK reads the contents of a memory address, and POKE changes its contents.

PALETTE assigns colour attributes (red, green, blue) to numbers. This way you can build your very own palette, mixing those together.
Logged
KiZ
__/--\__
*****
Posts: 2879


WWW
« Reply #2 on: June 29, 2006, 05:18:01 PM »

POKEing isnt really dangerous, it can just funk up your program and at a stretch crash your computer.

Unless you consider that dangerous... :o
Logged
Anonymous
Guest
« Reply #3 on: June 29, 2006, 08:35:06 PM »

Yeah, it's not dangerous.. unless you consider permanently damaging your computer dangerous =)


Why do yu think modern OS's son't let you directly access hardware  and stuff? You had too much power in DOS days.
Logged
RyanKelly
Forum Regular
**
Posts: 109



WWW
« Reply #4 on: June 29, 2006, 10:38:14 PM »

Quote from: "cha0s"
Yeah, it's not dangerous.. unless you consider permanently damaging your computer dangerous =)


Why do yu think modern OS's son't let you directly access hardware  and stuff? You had too much power in DOS days.


Hardware access is protected in order to implement resource sharing in a multitasking enviroment without forcing the programmer to understand how every other program out there operates.  The actual physical damage you could possibly cause programatically is extremely limited.  The only risks that come to mind are running a CRT at a refresh rate that burns up the monitor, and burning the servos in a disk drive by rapidly sweeping the read or write head from the inside track to the outside.  Both task aren't exactly something you might do accidentally.
Logged
thegrogen
Ancient QBer
****
Posts: 444



« Reply #5 on: June 29, 2006, 11:45:52 PM »

(Somewhat offtopic)

I've just realized POKE and PEEK, when used with VARPTR(), can be used as a substitute hack for pointers.

That's probably old news, but I just realized it and felt it had to be said.
Logged

.14159265358979323846264338327950288419716939937510582709445
Glarplesnarkleflibbertygibbertygarbethparkentalelelangathaffendoinkadonkeydingdonkaspamahedron.
nkk_kan
Member
*
Posts: 73


« Reply #6 on: June 30, 2006, 06:07:51 AM »

well... i got that peek and poke
but where to use a pallette??
and what does it do?
and *How* to use it?
what is the use of it in a program?
can any one explain?
Logged

\__/)
(='.'=) Copy bunny into your signature to
(")_(") help him gain world domination.
DrV
Na_th_an
*****
Posts: 1553



WWW
« Reply #7 on: June 30, 2006, 10:38:37 AM »

A palette is just a color lookup table.  In display modes with 8 or less bits per pixel (all of the QB SCREEN modes, for instance) usually use a palette in order to have a wider range of colors than if they used a direct color scheme.  When you write pixels on the screen in a mode with a palette, the number you use is not a direct representation of a color, but just an index into your palette (color table), which contains the real colors.  This lets you do some nifty tricks, like rotating or fading the (relatively few) colors in the palette without changing the screen contents.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!