
Originally Posted by
krohtech
I guess I was hoping for was some kind of nested for next loop with an array?
I don't know if I can explain the whole Arrays and Loops category. Would need a full book.
But here's some more examples (untested) that might nurture some thoughts.
Code:
Value VAR BYTE
X VAR BYTE
Y VAR BYTE
MarqueeCnt VAR BYTE
RepeatCnt VAR BYTE
Rnd VAR WORD : Rnd = 123
MaxChannel CON 15
Main:
Value = DIM
GOSUB ALL2Value
Pause 2000
GOSUB Marquee
GOSUB Scan
GOSUB DoRandom
GOTO Main
;------------------------
Marquee:
Value = 0
Gosub ALL2value
For RepeatCnt = 1 to 50
MarqueeCnt = (MarqueeCnt + 1) // 4
For X = 0 to MaxChannel STEP 4
For Y = X to X + 3
Lookup ((Y-X) + MarqueeCnt),[0,25,75,25,0,25,75,25],Value
DutyVars(Y) = Value
Next Y
Next X
Next RepeatCnt
Return
;------------------------
Scan:
Value = 0
Gosub ALL2value
For RepeatCnt = 1 to 20
For X = 0 to MaxChannel
DutyVars(X) = MED
Pause 200
DutyVars(X) = 0
Next X
Next RepeatCnt
Return
;------------------------
DoRandom:
For RepeatCnt = 1 to 100
For X = 0 to MaxChannel
RANDOM Rnd
DutyVars(X) = Rnd // 100
Next X
Pause 200
Next RepeatCnt
Return
;------------------------
ALL2value:
For X = 0 to MaxChannel
DutyVars(X) = Value
Next X
Return
HTH,
Bookmarks