PDA

View Full Version : lists



Meriachee
- 19th September 2008, 04:21
Hi,

I'm trying to figure a way to simulate a large list, that I can sequentially pick the "next" number from and use it as a variable.
List example:
2
354
9826
55
122
97

So the program would use "2" on the first gosub, "354" the next time and so on. I'm sure somebody has done something like this in PBP and maybe would share?
Cheers
Gary

Bruce
- 19th September 2008, 09:54
Use LOOKUP2.


INDEX VAR BYTE
MYVAR VAR WORD


MAIN:
FOR INDEX = 0 TO 5 ' lookup 6 values 0 to 5
LOOKUP2 INDEX,[2,354,9826,55,122,97],MYVAR
GOSUB DOIT
NEXT INDEX
MAIN2:
GOTO MAIN2

DOIT:
' Do something here
HSEROUT [DEC MYVAR,13,10]
RETURN

END

Meriachee
- 19th September 2008, 16:10
Bruce,

Outstanding.
Thank you.