Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 11:00 01 Aug 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : arduino Basic in 2k

Author Message
zeitfest
Guru

Joined: 31/07/2019
Location: Australia
Posts: 581
Posted: 11:46pm 28 Oct 2021
Copy link to clipboard 
Print this post

a small Basic interpreter on arduino and 2k memory..
link

interesting, obviously small though
 
panky

Guru

Joined: 02/10/2012
Location: Australia
Posts: 1114
Posted: 04:47am 29 Oct 2021
Copy link to clipboard 
Print this post

Interesting, and without in any way wishing to start a "mine is bigger/longer than yours" fight,   , the Uno is almost twice the size of the Pico, from twice to five times the cost of the Pico and with only a fraction of the speed, functionality, memory etc.

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 Zealand
Posts: 2442
Posted: 04:58am 29 Oct 2021
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 1646
Posted: 05:55am 29 Oct 2021
Copy link to clipboard 
Print this post

  panky said  

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.


 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7937
Posted: 08:17am 29 Oct 2021
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 2170
Posted: 10:35am 29 Oct 2021
Copy link to clipboard 
Print this post



but still line numbers.
Edited 2021-10-29 20:35 by CaptainBoing
 
hitsware2

Guru

Joined: 03/08/2019
Location: United States
Posts: 719
Posted: 10:52am 29 Oct 2021
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 7937
Posted: 12:34pm 29 Oct 2021
Copy link to clipboard 
Print this post

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: Canada
Posts: 91
Posted: 05:17pm 29 Oct 2021
Copy link to clipboard 
Print this post

  robert.rozee said  the Arduino Pro (no USB) and Arduino Nano (onboard USB) are both smaller than the RPi Pico ...


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: Netherlands
Posts: 5089
Posted: 07:24pm 29 Oct 2021
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 2170
Posted: 09:17pm 29 Oct 2021
Copy link to clipboard 
Print this post

  Volhout said  ...when i need to put something very basic together


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 Kingdom
Posts: 7937
Posted: 07:10am 30 Oct 2021
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 2170
Posted: 07:34am 30 Oct 2021
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 7937
Posted: 08:14am 30 Oct 2021
Copy link to clipboard 
Print this post

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
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025