So, after 30+ years I wrote my first small BASIC program, just to check some of The Gigatron's capabilities (and watch those blinkenlights dance).
The program pretends to do a lot of calculating, and then shows a random number on screen and in binary with the blinkenlights. Easy peasy. What I did find however is that the four LEDs are in the reverse order for proper binary number presentation: with poke20,1 the leftmost LED lights up, not the rightmost, and so on. So my program needed to do a little bit rotating, but (for now) the best I could find was to hardcode the reversed values in an array. And even the array populating is not very sleek. Quick and dirty, but it works.
Saving to Mr. Plugface is indeed very limited storage wise, so I will need to do something about that before adding more bells and whistles
Anyway, I did a little video. It just so happens that on this run the first results were zeroes and ones. I guess there is no seeding for the rnd function so no surprises there.
https://youtu.be/2SwoTdzKq_I
* EDIT *
Not happy with the code, I had a bit of an epiphany just when I went to bed, worked it out in my sleep, and tested it this morning. A typical case of approaching a problem from another direction. Anyway, here is the code, should you want to play
Code: Select all
10 mode 1
15 poke 42,16:poke 46,1
20 cls:poke 43,32:C=0
25 ?"<q>uit @ pause":?
30 poke 43,53
35 ?"Calculating numbers"
40 ?"between 0 and 15":?
45 if C=8 goto 20
50 C=C+1:for T=0 to 128
55 poke 20,rnd(16):next T
60 poke 20,0:for T=0 to 3
65 B(T)=rnd(2):next T
70 N=B(0)+B(1)*2+B(2)*4
75 N=N+B(3)*8:poke 43,63
80 L=B(3)+B(2)*2+B(1)*4
85 L=L+B(0)*8:poke 20,L
90 ?N:for T=0 to 50
95 K=peek(15)
100 if K=113 goto 110
105 next T:goto 45
110 poke 42,63:poke 43,53
115 poke 46,0:cls:end
Cheers,
Marco