Arduino with built in BASIC interpreter, with keyboard and LCD?

Back in 1980s, many computer often offered built in BASIC interpreter for people who wanted to get started on programming as BASIC was easier to learn. I got started with Commodore PET back then.

I was thinking and I wondered, would this be possible? On C64, part of kernel ROM, about 9kb worth is devoted to BASIC command and interpreter that translated BASIC to equivalent ASM code. Mega2560 should have enough flash ROM space for BASIC interpreter, LCD, SD card, and keyboard code. Would this be possible on Arduino?

LCD, such as 16x2 or even 16x4 for display, some form of keyboard for text input, command typed are stored in SRAM. (maybe SD card support to save and load BASIC file)

I realize BASIC program would be much slower than if I stuck with Arduino IDE or C but it seems doable and I wanted to try "just because it can be done" ATMega2560 has plenty of SRAM for holding program and should have more than enough IO for LCD, SD memory, and some form of keyboard support.

That was done years ago. Google will show you some examples.

Why? :astonished:

Paul__B:
Why? :astonished:

wilykat:
"just because it can be done"

Good enough a reason for a hobby project :slight_smile:

One fundamental feature of your Basic interpreter must be memory management. At some point in time all of the Basic interpreters would stop and reorganize all the used memory locations so more available memory could be used. I suggest you work on this problem to begin with.

Also remember the Basic code line was first converted to a fixed format string with the op codes being a hex byte.

That is about all I remember!!

Paul

Also remember the Basic code line was first converted to a fixed format string with the op codes being a hex byte.

That's not required, though...
There are Arduino (or at least AVR) projects that drive a not-bangedvideo display from software, read a PS/2 keyboard, and include a BASIC interpreter. Here is one.
Usually the limitation is RAM. Yeah, the old computers would run BASIC in less memory than an Arduino has, but it tended to be nearly ALL RAM. With an Arduino, you have 32k for your interpreter, but only 2k of RAM that has to hold all the program that you type, all of its variables, and all the variables used by the interpreter itself.

(maybe SD card support to save and load BASIC file)

To relive the old days, surely you would want to save and load program files using a cassette tape recorder!

Use a Mega 1284 to get the extra RAM !

It would still be Basic, which sucks in ways that make even Pascal look good.

Well, your choice of small, embeddable, interpreted, languages seems to be between BASIC, Forth, and maybe tiny LISP. BASIC doesn't seem so bad (especially since you tend to get versions that are heavily customized toward the tasks at hand. Arguably, Parallax's PBASIC chips were the start of this "cheap physical computing for beginners" thing...

BASIC was easier to learn

Easier than what? There were few other interpreted languages commonly available back then.

These days there are many. If you wanted an interpreted language that’s easy to learn and looks good on your CV (Resume), Python would be a good choice. And a much better language than any version of BASIC.

You can get MicroPython to run on esp8266/32, and Circuit python on various boards sold by AdaFruit.

The cheapest option would be a Raspberry Pi Zero. If you need networking a Zero W is still probably cheaper than most of the AdaFruit boards and has usb and LCD interfaces built-in.

I need to remember to google my question before asking here, it's been done.

PaulRB:
Easier than what? There were few other interpreted languages commonly available back then.

Back in the day, all I can remember were FORTRAN, COBOL, PILOT, ASM, LOGO, and BASIC. BASIC were often the default built in language because back in the day it was easy. I don't think PASCAL or any flavor of C were even invented yet.

With the existing BASIC support, I'll have to see if I can port an old Commodore PET BASIC code, that ran on the miniscule 8k RAM called Kid Stuff. LOGO program that ran in BASIC. It'd be interesting to see how well a 16MHz MPU can use C variant to run BASIC to run LOGO code. Commodore PET ran at 1MHz and the one I've used had only 8k SRAM.

C was out in 1970. BASIC started out as interpreted (Dartmouth Basic 1965) but since around 1986 is compiled and more and more like C/C++. FORTRAN, ASM, COBOL all compile. Pascal token-compiles as does Forth, both out before 1980.

6502 is an 8 bit CPU with 2 work registers and little else (but some nice tricks). AVR has 32 GP registers, you can hold more on the processor and work with it where a 6502 would be fetching memory every step -- the Uno is more than 16x as fast.

and has memory on chip!

The 6502 IO was memory mapped, so portions of the memory were not usable for code. I am trying to recall the special use of memory addresses 00-255. Who remembers?

Paul

Memory-mapped video got used on some if not all 6502/6510 computers. It's not a cpu feature, it's board hardware.

Paul_KD7HB:
The 6502 IO was memory mapped, so portions of the memory were not usable for code. I am trying to recall the special use of memory addresses 00-255. Who remembers?

IO was memory mapped, yes. The portion of memory not available for code that this caused depended on the board design, the CPU itself did not determine that. With more complex address decoding circuits, the IO could take up minimum space.

Addresses 0..255 could be quickly and conveniently addressed with special instructions, so it could be used like an extended register file, making up (to a degree) for the tiny number of on-chip registers.

C was out in 1970.

For loose definitions of "out", I guess. (actually, WP says C was "developed" in 72 and 73.) It was big news when CP/M got BDS C in 1979, and the IBM PC got a (Microsoft) C compiler in about 83. Lovely compilers with different passes on different floppies :slight_smile: Borland "Turbo C" didn't show up until about 1988. You had to go to some lengths to get those compilers to produce "ROMable" code.
Remember that Unix was essentially unavailable to the world until the mid 1980s - you could get it form AT&T if you were a university or research organization, but otherwise ... nope.
(likewise, "U & R&D" sites had various cross-compilers and assemblers that could produce code for microcomputers, but such tools that actually ran on your microcomputer were expensive and large.)
Popular "commercial" languages included Assembly language, Fortran, COBOL, BASIC, Algol, APL, PL/1, Snobol, and RPG. Academia also had LISP and (somewhat later) Pascal. There were some specialized languages from particular vendors (arguably, PL/1 was IBM-only. DEC has "BLISS." CDC had Tutor. There was MUMPS.) In the late 70s, university students at many schools were still using keypunches to type up their programs on punch cards, and hard drives for personal computers were "rare" until the PC/XT in 83.

C was essentially, part of the development of UNIX.

Unix was written in C and first ran on PDP-11's AFAICT.

A lot of the slowness getting software out in the early days was the cost of access, the more expensive the computer, the more it cost to develop code on even when most of the dev time was not spent on the system....

What micros did was to open computing to loads more people and everything computer sped up.