Page 1 of 1

And I so promised myself... (continued)

Posted: 13 Dec 2019, 19:52
by Marco
[Split from original topic by moderator]

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 :P

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.

* 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


Re: And I so promised myself... (continued)

Posted: 14 Dec 2019, 16:46
by marcelk
The ATtiny85 has just 512 bytes of EPROM to work with. But if you hookup an Arduino, you'll have more storage there. Even better, you can then bypass the EPROM entirely and send the whole BASIC program back to your laptop/PC over the serial port. Just first enter terminal mode for that with BabelFish command 'T' and then type 'save'.

Re: And I so promised myself... (continued)

Posted: 14 Dec 2019, 21:16
by Marco
Yes, definitely something I'm going to look into. Very interested in interfacing with other devices. I'm thinking of using an NodeMCU with Wifi and MQTT for instance, which (the NodeMCU) is very similar to an Arduino. But indeed I might first start with an Uno.

Love the Gigatron, and hats off to you and Walter for it. Or in other words...goed man! ;)


Re: And I so promised myself... (continued)

Posted: 08 Jan 2020, 10:02
by Marco
In case someone should want to attempt something similar: I recently did try to use a NodeMCU (ESP8266) instead of an Arduino, it started promising but in the end I decided it was not worth the effort. It's not an AVR compatible board and unable to handle AVR-specific registers such as PORTx and PINx, thus a comprehensive rewrite of BabelFish and libraries would have been required.

A pity really, NodeMCU's are cheap but reliable, have embedded WiFi and more than enough storage (4MB). Ah well, case closed! :roll:

Re: And I so promised myself... (continued)

Posted: 09 Jan 2020, 12:09
by marcelk
Pin handling in BabelFish is localised in low-level functions, or at least it's pretty idiomatic when not. So porting BabelFish shouldn't be too hard. There is a RPi version in Contrib/xxxbxxx/, so it has been done before...