Basic Computer Challenge

i am sort of stringing together many things here.
my aim is to have a basic computer capable of simple programs that can A) read and write to an sd card B) display on an lcd (2x16 characters) C) run on my arduino UNO. it would be nice to have pin on/off commands, analog read commands and datalogging to make it useful as a development tool and meter of some sort. for my hardware i have a 1) arduino uno 2)seeed studio sd card shield (tinybasicplus has support for this) 3)maker shield to provide a base for 4)lcd display. independently, i can drive the lcd shield through it's examples, i can datalog to the sd card, i can use the arduino with tinybasic to do hello worlds and for loops via serial. i suppose item 1 on the list is to make the serial output of tinybasic to instead drive the lcd. it is attached with pins 2,3,4,5,11, and 12. unfortunately i am not fluent enough to get most of what is happening in the tiny basic source, and so i ask you to rise to the challenge. eventually i will get you pictures of my "cube" shaped hardware stack.

http://revision3.com/tbhs/basic-pocket-computer/hold-me-closer-tiny-basic
ben heck has done something quite similar to what i'm after. right now, however, i have no tiny input keyboard. instead i would like to run this through serial (but with a lcd read out)

here is the tinybasic i am lookin at
http://ec2-122-248-210-243.ap-southeast-1.compute.amazonaws.com/mediawiki/index.php/Arduino_Basic
i am using "tiny basic plus" to which there is a link to the bottom of the page.

my lcd is attached something like this, with the maker shield built in pot as the contrast knob.
http://api.ning.com/files/i8lDbHwHcLlJttcy7IVol2EaC3DkYlrn4AZqj9xNOFrqcSMdqvqvKD8d0v64*zLbYH3pMbs0lXueXqwkJQ4a0mBPSI1SGU8T/LCD_bb.png

also, a question, is it possible to store arduino programs on the sd card, instead of flashing the internal memory on the atmega? i currently am using a 2gig card, and would love to get rid of the sram/eeprom limitations of the atmega.

item 2 would be adding commands. to which there is a rundown on the wiki. i would like commands to control the pins and such, perhaps a basic equivalent to all the arduino capabilities, such as delays, math, random numbers, loops, control structures, ext.
eventually this should be all these things. let's figure out where in the code it sends serial data to the serial monitor and mod it to update the lcd screen.

this is my first post, let me know if i need to move it somewhere else.

i can use the arduino with tinybasic to do hello worlds and for loops via serial

How does that work then?

is it possible to store arduino programs on the sd card, instead of flashing the internal memory on the atmega?

No. It is not simple, without rewriting the boot loader it is not possible at all. You could use bit lash from the SD card if you want but that is another language.
http://bitlash.net/wiki/start

I am not sure I understand the main thrust of your question here.

here i have made an album of images of my stacked arduino computer.

Arduino Uno, seeed studio SD shield, maker shield, lcd display.

my questions are answered after some research, now i just want to inspire some group effort to further tiny basic to support lcd display.
also i would like to add extra commands to control pins and read inputs.

If "tiny basic" is a language stop using and start using C/C++ and the Arduino IDE that way you get all the lib's you want and all the pin based I/O you can deal with.

If you have questions about "tiny basic" ask on there forums.

Mark

perhaps i was not clear.
the computers of the 80's such as the commodore 64, apple ii, ext. ran different itterations of the operating system BASIC.

on most basic systems, if you wanted to make the computer display hello world infinatly, you would write:

10 print "hello world"
20 goto 10

^where 10 and 20 are line indicators. the commodore 64 (which i reference a lot in respect to basic because i love it) has 64,000 lines that can be programmed this way. similarly, you could have written

1 print "hello world"
2 goto 1

or

142 print "hello world"
5331 goto 142

it would still work.

what i am doing with my arduino, is using it as a tiny computer. the imsai/altair computers of the 80s ran an environment called tinybasic.
this was a small version (small enough to fit onto an arduino.) imagine you have a commodore, you get a screen. you type the above hello world program. you type run. "hello world" streams across the screen. now imagine you are looking at a serial monitor plugged into your arduino. you do the same thing. it responds the same way. independant of the IDE, you are programming the arduino in real time. i am using basic on purpose for its simplicity. with my stack of sheilds i can save and load to and from a sd card, and (eventually) print to a small LCD display. i want the arduino to act like a dinosour computer. until i have a tiny keyboard to type to it, however, i will use a terminal on my laptop to type to it in serial. the initial IDE programming of the actual atmega i do in c++, use the libraries, i understand. i know this is an off the wall subject, but i was hoping more would be interested. it is a challenge, as the title suggests.

In that case what you're trying to implement would be a basic interpreter. It would be limited to reading and writing to the terminal (serial port) plus whatever run-time functions you added support for. If that's all you want, I can't see any particular reason to involve an Arduino at all - you might just as well run your interpreter on the PC in the first place.

You can fit the data required by basic and the basic program (that's the program to be run) into the 2K of ram that you have to play with on (say) the Uno.

Mark

For a somewhat more modern language you could use Bitlash…

(ducks)

-br

He's trying to get a version of basic to run on the Arduino (I think) not the PC. But for me it would be Java or Fortran77.

Mark

Are you asking for help for porting tinybasic to Arduino ?

Understood. Perhaps I should have amplified a bit.

The Bitlash interpreted shell runs entirely on the Arduino. The Bitlash language is designed to be a better stepping-stone to C/C++ than BASIC. It doesn't teach quite the same bad habits and does teach the C statement and expression syntax and the Arduino runtime library, as well as functional program organization. You can get a surprising amount done with Bitlash code stored in the EEPROM, and there's a version that runs scripts from SD card.

Bitlash is written in Arduino C so it's really easy to add new functions, and to integrate drivers for things like LCD output. And all the digital and analog I/O the OP wanted is already built-in and integrated into the language. There are lots of examples showing how to integrate Bitlash into your setup.

So, carry on with BASIC and we'll all share in the nostalgia, but you might find Bitlash is worth a look to see if it matches your requirements.

Best,

-br

Edit: fixed typo.

I don't see anything in principle stopping you doing a Basic interpreter. After all the Apple II Integer Basic was apparently implemented in 4Kb of ROM.

According to that article:

It should also be noted that Wozniak did not have any software development tools for the 6502 processor other than an assembly language reference manual, and instead wrote out the software with pen and paper and then hand assembled the instructions into 4096[2] bytes of raw machine code for the 6502.[3]

Thus to do the job "properly" I think anyone attempting it should hand assemble the raw machine code using pencil and paper (I prefer a pencil as you can make corrections more easily). That's exactly how I wrote my first assembler.

So there's the "challenge" part of this project.

However I won't be personally volunteering for the job. There is a reason why C++ was invented, and that was to make your coding life easier. :stuck_out_tongue:

That brings back memories of my first computer program. I was a hardware field service engineer and had just returned from the factory school on the companies 16 bit minicomputer with a 8K core memory module around 1973. Didn't have an assembler, wrote the program with paper and pencil in hex with the machine instruction list close at hand, then hand keyed the hex code into the front panel switches. If was slot machine program that printed out 3 wheels of results on a model 33 Teletype and paid out with rings of the bell on the Teletype. Wrote it in a half day and really was pretty pleased with myself. Didn't even know what an assembler or editor was. :wink:

Lefty

i do understand the counter-intuitive nature of this project. but i am not exactly looking for practical uses here, this is an exercise to get a basic interpreter onto my arduino (with my listed specs). thank you all for your alternative languages and to "run this on a computer instead of the arduino" and everything, but i intend to do it this way. tinybasic is already written for the atmega. to clarify: my end result should look like, a set of electronics including: lcd display, and sd card slot. i want it to run some form of basic, for simplicity and line-by-line programming, plus the nostalgia. so things i need for this to work:

keyboard
possibly box to put things in, but that's later.

modifications to tiny basic:
first- making it output to lcd instead of serial (this is what i'm asking the most help on)
then- adding custom commands, extending functionality to controlling pins for I/O
debugging
eventually-keyboard input support
hoping for a nice looking product.
step 1. reverse engineering tiny basic to figure out what we add/replace.
the origonal creator doesent have time or something and has turned development onto users
who's with me?

this seems to be the most stable version
http://ec2-122-248-210-243.ap-southeast-1.compute.amazonaws.com/mediawiki/index.php/File:Tinybasicplus.zip

step 1. reverse engineering tiny basic to figure out what we add/replace.
the origonal creator doesent have time or something and has turned development onto users
who's with me?

Do you want me to move this to Gigs and Collaborations?

(I already have portable, BASIC-programmable devices - my Android phones and tablets all have BEEBdroid installed)

Unless you are just in it for the challenge of porting basic to an arduino board, you do know that there is a PIC based platform that already has that available and very affordable in many different chip sizes called PICAXE. Very active and friendly users forum and code examples to interface with lots of the same stuff that arduino boards interface with.

http://www.picaxe.com/What-Is-PICAXE

Lefty

before getting my arduino i played alot with pics. but again, you program the pics once and they carry out your instructions. in my case i want the microcontroller/processor in question to respond in real time to my commands. if you guys would check out my link youll see what im going for

upon looking through the code, i isolated the part which sends the serial data.

static void outchar(unsigned char c)
{
  if( inhibitOutput ) return;

#if ARDUINO
#if ENABLE_FILEIO
  if( outToFile ) {
    // output to a file
    fp.write( c );
  } else {
    Serial.write(c);
  }

Serial.write(c)

this is the part which updates one character at a time to the screen, and i assume each character is the variable C.
if instead of (c) you put ("."), then the serial terminal fills up with dots. so i know this is the part which does it.
so step two was adding lcd display output. in the "liquid crystal" examples, find hello world.

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
  // set up the LCD's number of columns and rows: 
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("hello, world!");
}

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(millis()/1000);
}

in tiny basic, i initialized the library, set up the lcd columns and rows, and within void setup i can print a message to the screen. but if i try to lcd.print ("."); under Serial.write("."); i get nothing on the lcd display. even if first i lcd.setCursor(0,1) which just moves the place you print from to the bottom row. any help here? it may be that tinybasic is erasing my message after it is printed. ill add a delay and see.
nope, still blank.

Do you have an lcd.clear() somewhere that is called periodically ? Have you tried printing a more "visible" character, like "#" ? Just thinking out loud...