03/14/2016 at 09:25 •
Hey all, thanks for the recent follows! I got a cool new job and so I have time again to spend on blinkyBasic.
I wrote a serial terminal program for linux and for mac you can compile and use with blinkyBasic in the links area. Also, I fixed a couple of bugs with list and if then. The updated asm and hex files are in blinkyBasic.tar. You can compile with gavrasm or just flash the hex with avrdude.
The next things on my list are tackling the save and load commands and getting input working.
11/13/2015 at 00:32 •
The PCB I designed with Fritzing came in the mail a couple days ago. I tried it out and to me surprise nothing started smoking.
I was able to finish the list routine and a peek function which I'm happy about.
Hopefully see you at the conference so I can show you my project.
11/07/2015 at 19:14 •
I've got dim working! It has taken a little longer due to the fact that last Sunday I got an email about one of my iOS apps not working, so I had to spend all my free time updating for iOS 9.1. Kinda sucked but if I was getting paid to be an iPhone dev, it would mean good job security. Anyway, so originally I wanted to be able to do two dimensional arrays (x(10,10)) but had to settle with one because the print function interprets a comma as a tab: print x(1),x(2). I don't think you could use two dim arrays in Integer basic anyway. One other caveat of my program for now is that you can't pass an expression to a dim index; just numbers or variables (x(i) = 100 not x(i-1) = 100)
I updated the blinkyBasic.txt and blinkyBasic.tar if you want to have a go.
This week I'm planning to tackle "list", and soldering up the pcb I ordered from Fritzing so I have something cool to show at SuperCon.
10/25/2015 at 13:15 •
I updated the tar file and txt file so you can try it out if you want. I also updated the goto and gosub commands to handle expressions. This week I'm going to work on dim... dim x(100,100). I think I figured out a way to get up to 2K of int var space for 2 dimensional arrays. :]
10/23/2015 at 18:06 •
I swapped out the EEPROM for SRAM last night. It took me a while because I after hooking everything up I forgot the MISO line didn't need to go through the logic shifter because its already 3.3v coming back into the Arduino. The code was pretty easy. I'm going to probably use a different chip select when I write the save and load routines. (I'm planning on using EEPROM to save a file). Here's the SRAM wiring:
10/22/2015 at 01:24 •
Got the for next routines working today. Handling the negatives was a little tricky, but overall a lot easier then I thought.
Right now it can only handle 4 nested loops. Also the variable after next is totally arbitrary. I'm not sure if you could step another loop within a loop. I'll have to check.
I updated the .txt if you want to see the code. I'll update the download after I fix a couple of things.
Next I'm gonna start working on swapping out the EEPROM for SRAM. :]
10/18/2015 at 13:10 •
Today and probably the rest of the week I'm going to start working on the for next routine. I'm going to model it after Gates/Woz stack method of pushing the counter and start pointers on a stack, and popping them off every time a loop is done.
My plan of attack is going to be:
Get the next variable address and push it on the stack. (for a = 1 to 10 step 1. would be address of a)
Get beginning value (1) and assign it to variable
Get ending value (10) and push on to stack
Get step value (1) and push. if no step assume 1?
Get address of loop start and push.
Update stack pointer.
So every block is 8 bytes
00 01 varL varH
02 03 endL endH
04 05 stepL stepH
06 07 nxtL nxtH
when a next token is encountered
pop and store in registers: next address, step val, end val, var ptr.
add step val to var and compare.
if equal of higher branch out. update stack pointer
if lower push everything back (or just update pointer) and branch to beginning.
I need to handle negative case (for a= 10 to 0 step -1). Maybe a test for negative on step value switches the compare.
Ok, time to go to my day job (I'm a cook for the UCSC dining halls ;) )
10/17/2015 at 22:45 •
One of the challenges of writing a BASIC for the Arduino is the amount of available SRAM space. The Atmega328p has only 0x8FF bytes which include the stack and the internal i/o registers. So what I did was use a 32K eeprom chip and locally store a table of pointers. So my SRAM space looks like this:
0x0000 - 0x00FF register
0x0100 - 0x0569 program pointer memory. 6 bytes per pointer: first 2 bytes are line number, 2nd 2 bytes are a pointer to the next line, and 3rd 2 bytes are a pointer to the EEPROM address. (0A 00 06 01 00 00 is line 10). I also wrote a neat algorithm so you can insert line numbers by pointing to the end of the ppm space. Equals 188 lines max.
0x0570 - 0x062A int pointers. 4 bytes per poiner. first 2 bytes = 2 char name, 2nd 2 bytes = 16bit value. LSB first. 46 possible vars. But with the dim function I'm hoping to be able to use arrays.
0x062B - 0x0655 string pointers. 4 bytes per pointer. like ints. maximum chars in eprom are 128 chars.
0x0656 - 0x75F internal variables and pointers (265 bytes)
0x0760 - 0x080C input buffer. for getline and other buffering
0x080D - 0x0881 output buffer
0x0882 - 0x08FF stack. 125 bytes of stack. tight squeeze.