![]() |
Forum Index : Microcontroller and PC projects : arduino Basic in 2k
Author | Message | ||||
zeitfest Guru ![]() Joined: 31/07/2019 Location: AustraliaPosts: 581 |
a small Basic interpreter on arduino and 2k memory.. link interesting, obviously small though |
||||
panky![]() Guru ![]() Joined: 02/10/2012 Location: AustraliaPosts: 1114 |
Interesting, and without in any way wishing to start a "mine is bigger/longer than yours" fight, ![]() ![]() IMHO, I think it very hard to go past the Pico and Geoffs/Peters MMBasic which is now totally open source. Thanks again to goth gentlemen above for a terrific package. D. ... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it! |
||||
robert.rozee Guru ![]() Joined: 31/12/2012 Location: New ZealandPosts: 2442 |
the Arduino Pro (no USB) and Arduino Nano (onboard USB) are both smaller than the RPi Pico, and both have the same processor available as the Arduino Uno. the cost, out of china, is similar to that of a RPi Pico ![]() however, it is, i agree, an impressive technical achievement. although one must keep in mind that these Arduinos have 32k of 'ROM', whereas many 80's computers (like the ZX81) got by with just 8k ROMs. the ATmega328p processors are capable of rewriting their own flash, raising the interesting possibility of storing the tokenised BASIC code in flash. this would provide additional space in RAM for variables, etc. but then when the MX170 is so cheap, there is little need to head down that path. cheers, rob :-) |
||||
Tinine Guru ![]() Joined: 30/03/2016 Location: United KingdomPosts: 1646 |
![]() |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7937 |
That's a creditable bit of programming. The BASIC isn't too bad - definitely an upgrade on Tiny BASIC. It's pretty useful, I think. It appears to need LET and line numbers though, so two points lost there. :) I like it but it's not a patch on MMBasic! Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
CaptainBoing![]() Guru ![]() Joined: 07/09/2016 Location: United KingdomPosts: 2170 |
![]() but still line numbers. Edited 2021-10-29 20:35 by CaptainBoing |
||||
hitsware2![]() Guru ![]() Joined: 03/08/2019 Location: United StatesPosts: 719 |
I like the " terseness " , ( for lack of a better term ) If it would run in a terminal or ? ( using the host PC ) I would use it . ************* Commands *************** PRINT <expr>;<expr>... e.g. PRINT "A=";a LET variable = <expr> e.g. LET A$="Hello". variable = <expr> e.g. A=5 LIST [start],[end] e.g. LIST or LIST 10,100 RUN [lineNumber] GOTO lineNumber REM <comment> e.g. REM ** My Program *** STOP CONT (continue from a STOP) INPUT variable e.g. INPUT a$ or INPUT a(5,3) IF <expr> THEN cmd e.g. IF a>10 THEN a = 0: GOTO 20 FOR variable = start TO end STEP step NEXT variable NEW GOSUB lineNumber RETURN DIM variable(n1,n2...) CLS PAUSE milliseconds POSITION x,y sets the cursor PIN pinNum, value (0 = low, non-zero = high) PINMODE pinNum, mode ( 0 = input, 1 = output) LOAD (from internal EEPROM) SAVE (to internal EEPROM) e.g. use SAVE + to set auto-run on boot flag LOAD "filename", SAVE "filename, DIR, DELETE "filename" if using with external EEPROM. ******** Pseudo-identifiers *********** INKEY$ - returns (and eats) the last key pressed buffer (non-blocking). e.g. PRINT INKEY$ RND - random number betweeen 0 and 1. e.g. LET a = RND *************** Functions **************** LEN(string) e.g. PRINT LEN("Hello") -> 5 VAL(string) e.g. PRINT VAL("1+2") INT(number) e.g. INT(1.5)-> 1 STR$(number) e.g. STR$(2) -> "2" LEFT$(string,n) RIGHT$(string,n) MID$(string,start,n) PINREAD(pin) - see Arduino digitalRead() ANALOGRD(pin) - see Arduino analogRead() my site |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7937 |
Yeah, the requirement to use a magnifying glass is a little off-putting. :) Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
scruss Regular Member ![]() Joined: 20/09/2021 Location: CanadaPosts: 91 |
The Tiny 2040 is smaller than either of those, and will run MMBasic. Somewhere I have the smallest 'classic' Arduino compatible board, which is only fractionally larger than the ATMega32U4 it's based on. It uses 1 mm pitch headers though, which are a terrible idea. |
||||
Volhout Guru ![]() Joined: 05/03/2018 Location: NetherlandsPosts: 5089 |
Nice find. Few years ago i worked on a tinybasic port for the uno. But that was using the arduino toolchain, and was not very ram efficient. But i still use it from time to time, when i need to put something very basic together. Switch some relays timed, read some analog, opto inputs. Etc... Sometimes i simply spool an ascii text file to it from a pc, and the uno executes the commands as if typed from the terminal, like a pc io port. PicomiteVGA PETSCII ROBOTS |
||||
CaptainBoing![]() Guru ![]() Joined: 07/09/2016 Location: United KingdomPosts: 2170 |
I use Great Cow Basic on a PIC (you can use it on Arduino flavours but I never went that way). Do/Loop, Repeat, Subs, Functions etc. supports bit as a datatype, in-line assembly opcodes (godsend) and no line numbers. all the usual displays and modules you like. I have a unit I used to sell (ethernet hard air gap) which had a 12F509 with some GCB source. simple job, worked like a charm. No floats though so you have to do the juggling yourself. Gets compiled - not p-codes, no boot-loader, just a hex file so it runs like lightning. A 20MHz 16F877 (not exactly a tiny PIC but you get the picture) is quick. AndI really like that it will output ASM files so you can examine or tweak the final code before you assemble it if you like . Edited 2021-10-30 17:05 by CaptainBoing |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7937 |
GCBasic is brilliant! I've played with that quite a bit. Even though it's a compiler I don't find the programming cycle too bad. I do like the PICkit 2 (official) though, because of the little logic analyzer that's built in. I have the 3 (chinese clone) as well, but I never went for the 4. Every credit - Writing the compiler and linker in BASIC is really something! :) It's just a pity that it only handles the 8-bit chips. Edited 2021-10-30 17:13 by Mixtel90 Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
CaptainBoing![]() Guru ![]() Joined: 07/09/2016 Location: United KingdomPosts: 2170 |
I agree with that. Most bases are covered in GCB. If it supported the bigger chips, I might do a lot more with it - the speed would be nice. I think I have got lazy. MMBasic is such a nice environment and really easy to work with my dev cycle between versions/debugs is probably down to seconds with just code changes (no brain ticking counted). Even with "just" the basic PICs GCB will compile for, you can do some pretty fancy stuff in just 8K of assembler. I have looked at the ASM output extensively and the "bloat" level you always get with compiled code isn't too bad. you know the stuff, like switching the banks for the registers each time you use them even though you are already in the right bank because it can't possibly have that level of optimization in such a package - and free! God we are spoiled with it and MMBasic. If I had the resources of today back in the 80s when I was doing all this stuff with Z80s and 68Ks we'd all have holiday homes on the moon by now (ideal if you are into grey sand). . |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7937 |
One of the things I like doing with GCBasic and the PIC chips is trying to use every single pin on the chip. It's become something of a competition with myself. Jamming a lot of stuff onto an 8-pin PIC is fun (I've not got any 6-pin ones - that's going a bit far). 8-bits rule! ;) Currently building one of these. I think I've found the perfect case for it too. :) Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |