From: Krogg
Subject: Re: pointers:help
Don Schullian wrote:
>
> On Thu, 05 Mar 1998 06:09:28 -0500, Krogg
> wrote:
>
> '==================================Subject: pointers:help
> From: Krogg
> Date: Thu, 05 Mar 1998 06:09:28 -0500
> --------
> >I am using trypb32 and have ordered 3.5 for dos.(waiting for it
> >to come in mail :) )
> >
> >What i want to do is make an array that is 100x100 and
> >store the address for a 100x100 section of the mode 13h
> >vga screen.then i can do like
> >"@scrn(x,y)=pixelcolor"
> >the help file says that pointers are faster than poke and peek
> >and using an array would be faster than
> >saying "poke 320*y+x" anyhow cause it would eliminate a multiply
> >and an add.
>
> Hi,
>
> You're confusing apples and oranges. If you want to address the whole
screen
> with a 2D array then you need to DIM it as ABSOLUTE. (See code, below)
>
> On the other hand, if you were to use an indexed pointer then you'd not
need
> an array.
>
> DIM S_prt AS BYTE PTR
> S_ptr = &hA0000000
>
> FOR X% = 0 TO 319
> FOR Y% = 0 TO 199
> Ofs% = ( Y% * 320 ) + X%
> @S_ptr[Ofs%] = ( (x%+y%) AND 255 )
> NEXT
> NEXT
> Got it?
This one didn't werk.I get a "invalid sub/function label" error
in the line:
> @S_ptr[Ofs%] = ( (x%+y%) AND 255 )
maybe trypb32 doesnt yet have indexed pointers?
maybe when pb3.5 comes it will work.?
> ____ _ ____ ____ _____
> | _ \ / \ / ___) __ | ___)(_ _)
> | |_) / _ \ \____\/ \| _) | |
> |____//_/ \_\(____/\__/|_| |_|
> Reply to: d83@ath.forthnet.gr
> www.basicguru.com/schullian
>
> -----------begin code-----------------
> DEFINT A-Z
>
> DIM ABSOLUTE Scrn(319,199) AS BYTE AT &hA000
>
> asm mov ax,&h13 ;chained 320x200 256 vga
> asm int &h10
>
> for x=1 to 100 'show test pattern
> for y=1 to 100 'It works good enuf
> scrn(x,y) = y+x 'dont know if faster yet though
> next y 'BTW y+x ranges from 2-200 and
> next x 'its just some diagonal lines
>
> poop:
> a$=inkey$ 'lame loop,but it werks.
> if a$="" then goto poop
>
> asm mov ax,&h03 ;reset normal 80x25 text mode
> asm int &h10
> cls
> ?"done"
>
> end
Hey,this works fine(thanks,im a dufus).I got to know though is it really
faster than POKE?I will test it!!
Another thing i just have to know is:
(and if anything in the manuals that come with pb3.5 give clues
then dont tell me)
if i want to make more ABSOLUTE arrays how can i find "safe" segments
to use for it?Is there some reference?On the net?
And :
What would be the fastest way to copy a segment to another segment,
Ya know,fer page fliping.
Oh,Hey thanks dude.I must be boring.
Continued with next message...
*** QwkNews (tm) v2.1
* [TN71] Internet Newsgroup: alt.lang.powerbasic
--- GEcho 1.20/Pro
---------------
* Origin: Toast House Remote (1:100/561)
|