Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
klaxon44
PostPosted: Sep 22, 2008 - 04:08 AM
Rookie


Joined: Sep 22, 2008
Posts: 47
Location: Bothell, WA

I have created a Basic interpreter for the AVR mega devices and would like to post the .hex file on the AVR Freaks site.

My goal with this project is to make the AVR devices accessible to those not skilled in C but wanting to use the chips in their projects.

KLBasic is written in C and lives in the 'mega's flash. Your Basic program is stored in RAM as tokens. Your Basic program can be saved to EEPROM or flash.

Note that this is a 32-bit integer Basic.

On a 90can128 at 20 MHz, this Basic executes 50,000 empty loops (FOR-NEXT) in 1.088 seconds; not too shabby for an interpreter.

Because the 90can128 and similar devices only have limited RAM, you will not be able to write really large programs. However, if you can get the atmega1284p, with 16K of RAM, you should be able to write substantial programs.

Features of KLBasic:
32-bit integer,
support for single-dimension arrays,
variable names significant to 8 characters,
SAVE/LOAD to/from EEPROM or three on-chip flash files,
autostart (runs any stored program on power-up),
direct access to I/O ports (no PEEK/POKE needed),
small footprint (the 90can128 version uses 29KB of flash)

This is just a quick overview of KLBasic. I'm working on a user's manual but for now you'll just have to play with it. I would appreciate any feedback.

Note that the .hex file is for the 90can128 but I believe works also on the atmega128. It does NOT work on the atmega1284p yet; I need to rebuild and test for that device.

BTW, this is my first post. If something gets lost, I'll try again.
 
 View user's profile Send private message  
Reply with quote Back to top
DocJC
PostPosted: Sep 22, 2008 - 04:13 AM
Raving lunatic


Joined: Dec 11, 2007
Posts: 6982
Location: Cleveland, OH

Klaxon44,

Welcome to the Forum!

Competition for the Basic Stamp, how fine!

JC
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
CirMicro
PostPosted: Sep 22, 2008 - 04:25 AM
Posting Freak


Joined: Jun 04, 2007
Posts: 1075
Location: Cincinnati, Ohio - USA

I'm afraid I've never seen the appeal for an interpreted basic on a micro when basic compilers are available. It seems you would need to download the program either way.
 
 View user's profile Send private message  
Reply with quote Back to top
klaxon44
PostPosted: Sep 22, 2008 - 04:33 AM
Rookie


Joined: Sep 22, 2008
Posts: 47
Location: Bothell, WA

It's all in the immediacy. The interpreter lets you work on your target hardware and enter commands like:

porta = $ff

to turn on the LEDs directly. If it works the way you like, just add:

950 porta = $ff

to your program and you're good to go.

I pay my rent writing in C; have done for years. But there are lots of newbies out there with wonderful ideas but no experience in C and no time/inclination to climb the learning curve. This tool gives them a shot at seeing their projects work. Plus, it's kinda cool to have the entire dev platform for your project IN your project...

klaxon44
 
 View user's profile Send private message  
Reply with quote Back to top
zbaird
PostPosted: Sep 22, 2008 - 05:39 AM
Raving lunatic


Joined: Aug 13, 2006
Posts: 6764
Location: Bellingham, WA - USA

I for one applaud your work and your willingness to share it, at least in its early stages. I agree that the interactive part of an interpreter is its best feature.

What are your plans? What other devices, what sort of marketing, etc.? Or is this just a work of love by a hobbyist?

Bothel, huh - Microsoft employee? I'll honk next time I drive by on I5.

Thanks for the posting and offer, and welcome to the forum.

_________________
Chuck Baird
"It's better to catch the trapeze than test the safety net" -- RPi book
http://www.cbaird.org
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
js
PostPosted: Sep 22, 2008 - 05:54 AM
10k+ Postman


Joined: Mar 28, 2001
Posts: 20635
Location: Sydney, Australia (Gum trees, Koalas and Kangaroos, No Edelweiss)

Hurray!! No more C vs ASM wars... Smile

_________________
John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
CirMicro
PostPosted: Sep 22, 2008 - 05:54 AM
Posting Freak


Joined: Jun 04, 2007
Posts: 1075
Location: Cincinnati, Ohio - USA

Chuck wrote:
I agree that the interactive part of an interpreter is its best feature.


Maybe I missed something somewhere. It seems like when I played with a Basic Stamp years ago you had to compile it to pcode and then download it to the stamp.

I don't mean to sound as though I'm hammering his efforts, just trying to understand better.
 
 View user's profile Send private message  
Reply with quote Back to top
zbaird
PostPosted: Sep 22, 2008 - 06:15 AM
Raving lunatic


Joined: Aug 13, 2006
Posts: 6764
Location: Bellingham, WA - USA

Quote:
Hurray!! No more C vs ASM wars...


Quote:
"No, not a tape measure, you nitwit! A screwdriver!"

"All that's here's a hammer. Will that do?"

The samperi looked at his well meaning but inept assistant in disdain. Good help is so hard to find, especially when you're too cheap to pay them.

He could read no more, he felt such an identification with the hero. His eyes welled up with tears as he closed the book, tidied himself, and absently wandered back to the major throne room from the minor throne room.

The poor hero. "What could be worse?" he thought. Then it struck him. No true index register.

_________________
Chuck Baird
"It's better to catch the trapeze than test the safety net" -- RPi book
http://www.cbaird.org
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
stevech
PostPosted: Sep 22, 2008 - 06:58 AM
Raving lunatic


Joined: Dec 18, 2001
Posts: 4780


klaxon44 wrote:

Note that this is a 32-bit integer Basic.

On a 90can128 at 20 MHz,...


On a mega128, using that hex file you uploaded, is the code set for a 20MHz crystal? I tried it on a 16MHz mega128 and nothing came out UART port 1 at several baud rates I tried.
 
 View user's profile Send private message  
Reply with quote Back to top
dl8dtl
PostPosted: Sep 22, 2008 - 09:19 AM
Raving lunatic


Joined: Dec 20, 2002
Posts: 7279
Location: Dresden, Germany

Funny to see, even though I'm not one of the potential users.

I once wrote a BASIC interpreter as a proof of concept for my flex
and byacc ports to the AVR. It's far from being perfect in any sense,
and obviously makes most sense when running on an AVR with external
SRAM to store the program lines into. I eventually pushed it to
floating-point numbers and string variables / string concatenation.
No AVR-specific stuff, however.

lex and yacc or not quite optimal for hacking a BASIC interpreter
though, and the resulting code size is fairly clumsy.

_________________
Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.
Please read the `General information...' article before.
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
farang
PostPosted: Sep 22, 2008 - 09:28 AM
Hangaround


Joined: Dec 12, 2002
Posts: 380
Location: Udon Thani, Thailand

While not a serious replacement for C or Basic compilers (remember Forth?), a basic interpreter is an excellent tool for learning programming concepts, and for debugging hardware -the peeks and pokes and input and output commands are excellent ways to tickle port pins or look at them.

Klaxon44, will you eventually be adding user documentation, and making versions for smaller chips, such as those that come in DIP packages, such as the ATMEGA32 and smaller?
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
clawson
PostPosted: Sep 22, 2008 - 10:52 AM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62944
Location: (using avr-gcc in) Finchingfield, Essex, England

klaxon44,

Would you not at least consider adding some auto-baudrate detection to it? 20MHz only may severely limit your "market".

(it'd be nice if there were also variants for some of the other AVRs though clearly it's going to need to be a fairly big one)

Cliff

BTW that code seems to include both the app and a bootloader witth the app occupying 29,017 bytes from 0x0000 to 0x7159 then the boot loader occupying 0x1fc00..0x1fcbf. Is the bootloader really required and does that imply that the AVR needs the BOOTRST fuse enabled?. If the interpreter is really less than 32K it'd be nice to get a build for a 32K device.

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
klaxon44
PostPosted: Sep 22, 2008 - 03:54 PM
Rookie


Joined: Sep 22, 2008
Posts: 47
Location: Bothell, WA

In response to several of the above posts:

1. The released .hex file is for the 90can128 but should work on the mega128 as well. Hook to USART0 (PE0 & PE1) at 38.4K, 8N1; your hardware needs a 16 MHz crystal. (My numbers in the original post probably implied 50K loops in 1.088 secs on a 20MHz AVR; it should have been on a 16MHz AVR. Sorry about that.)

2. I definetly want to add autobaud but haven't come up with a clean way to do it. I don't want to use the "wait for user to press CR" style; I would rather have the MCU derive the baudrate values for 38.4K from internal information. Any suggestions?

3. The code in the bootloader area is NOT a bootloader. It is code that allows the Basic interpreter to write Basic programs into lower flash pages. For example, you can save a program into lower flash with "save fl0." This will write your Basic program into flash file 0; it can be recovered with "load fl0" or autorun with "autost fl0."

4. I will be adding various chips in the coming days/weeks, and will provide a suitable user's manual. The core of this program is target-independent; creating a KLBasic for any device is limited to writing a single device-specific file that accesses various types of memory, handles loads/saves, and handles I/O ports. In fact, there is an equivalent KLBasic for Windows (console app) that I use as a development tool. I get the Windows version running first, then port the (minimal) changes to the AVR file and I'm done.

klaxon44
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Sep 22, 2008 - 03:58 PM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62944
Location: (using avr-gcc in) Finchingfield, Essex, England

Quote:
I don't want to use the "wait for user to press CR" style;

Why not? - that's the way it's usually done. In fact modems are only able to auto-baud because they expect to see "AT". but having the user hit [ENTER] ensures the start-bit is distinct so can be measured - but it helps to route this to an INT or ICP pin which maybe slight complicated the wiring (and wastes a pin)

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
klaxon44
PostPosted: Sep 22, 2008 - 04:01 PM
Rookie


Joined: Sep 22, 2008
Posts: 47
Location: Bothell, WA

To address CirMicro's post...

There are some interpreters that compile off-target to pcode, then require you to move the pcode into the target. This is not one of those interpreters.

In KLBasic, you work solely on the target through a comm program, such as Hyperterm. You enter your program on the target MCU, where it is incrementally reduced to pcode and stored in RAM.

Since the translation is on-the-fly, you can pretty much type in any Basic statement without a preceding line number and the statement will be interpreted and executed immediately.

This lets you do things like modify the I/O ports at the command prompt, just to see what will happen. Smile

klaxon44
 
 View user's profile Send private message  
Reply with quote Back to top
klaxon44
PostPosted: Sep 22, 2008 - 04:06 PM
Rookie


Joined: Sep 22, 2008
Posts: 47
Location: Bothell, WA

clawson wrote:
Quote:
I don't want to use the "wait for user to press CR" style;

Why not? - that's the way it's usually done. In fact modems are only able to auto-baud because they expect to see "AT". but having the user hit [ENTER] ensures the start-bit is distinct so can be measured - but it helps to route this to an INT or ICP pin which maybe slight complicated the wiring (and wastes a pin)


I want to avoid any user interaction at start up because KLBasic can be used to autostart an embedded app, such as a robot or greenhouse controller. Such a startup may require immediate transmission on USART0 with no ability of the user to press a key for autobauding.

I will (very reluctantly) use a variation of this autobauding if that is simply the only way to do it. But I would MUCH prefer to have the MCU compute the baud values on-the-fly without user interaction.

klaxon44
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Sep 22, 2008 - 04:19 PM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62944
Location: (using avr-gcc in) Finchingfield, Essex, England

So have it so that either:

a) it checks for a link via a PIN
b) it looks for a trigger value in an EEPROM location

that makes it stop and wait for the user interaction to auto-baud. The user like me will then program the EEPROM or wire a link to Vcc or whatever to say "don't just run, stop and wait for <CR> to auto baud rate"

(in fact links are best done by enabling the pull-up on the pin to be checked and then looking for it being connected to Gnd.)

Cliff

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
stevech
PostPosted: Sep 22, 2008 - 05:00 PM
Raving lunatic


Joined: Dec 18, 2001
Posts: 4780


klaxon44 wrote:
In response to several of the above posts:

1. The released .hex file is for the 90can128 but should work on the mega128 as well. Hook to USART0 (PE0 & PE1) at 38.4K, 8N1; your hardware needs a 16 MHz crystal. (My numbers in the original post probably implied 50K loops in 1.088 secs on a 20MHz AVR; it should have been on a 16MHz AVR. Sorry about that.)


FYI: When I ran the code on the 20MHz mega128, nothing at all came out UART0. I would have at least expected some garbled characters (speed mismatch). After running that, I immediately flashed some code I have for 16MHz and UART0 is working fine.
 
 View user's profile Send private message  
Reply with quote Back to top
klaxon44
PostPosted: Sep 22, 2008 - 07:19 PM
Rookie


Joined: Sep 22, 2008
Posts: 47
Location: Bothell, WA

stevech wrote:
klaxon44 wrote:
In response to several of the above posts:

1. The released .hex file is for the 90can128 but should work on the mega128 as well. Hook to USART0 (PE0 & PE1) at 38.4K, 8N1; your hardware needs a 16 MHz crystal. (My numbers in the original post probably implied 50K loops in 1.088 secs on a 20MHz AVR; it should have been on a 16MHz AVR. Sorry about that.)


FYI: When I ran the code on the 20MHz mega128, nothing at all came out UART0. I would have at least expected some garbled characters (speed mismatch). After running that, I immediately flashed some code I have for 16MHz and UART0 is working fine.


Darn it! I don't have a 'mega128 to test against. I do most of my work with the 90can128 and the two technical summaries look almost identical so I assumed the 90can128 .hex would just drop in.

I'll see if I can find a 'mega128 dev board somewhere. I'm also going to ramp up my work on the 'mega1284p version. That's really where I want to be, because of the increased RAM.

klaxon44
 
 View user's profile Send private message  
Reply with quote Back to top
sparrow2
PostPosted: Sep 22, 2008 - 09:28 PM
Raving lunatic


Joined: Oct 07, 2002
Posts: 2058
Location: Denmark

I have a problem with the download !
The link is to an index.php file ?!
This make me think back to the microsoft basic to the commodore PET. And they had the full thing into 14K ROM (6502 code). And the very same good part was that you do the calculations directly as well.
At one time I was playing with a AVR emulator running on a AVR (just for fun Smile ) and was able to run the code from an extern eeprom at about 1/10-1/20 of the real speed, so if you need some "speed" input I'm here Smile
We can even meet (I live less than 2 miles from where 405 ends), then Chuck can come as well.

Jens

Edit my location is Edmonds, I don't know why it not showing it.
 
 View user's profile Send private message  
Reply with quote Back to top
JohanEkdahl
PostPosted: Sep 22, 2008 - 09:52 PM
10k+ Postman


Joined: Mar 27, 2002
Posts: 18757
Location: Lund, Sweden

Quote:

I have a problem with the download !
The link is to an index.php file ?!

Thats a known bug in the forum software. The downloaded file is correct, but the suggested name "index.php" is wrong. Just choose to save the file under the correct name and all will be fine.
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
klaxon44
PostPosted: Sep 23, 2008 - 04:37 AM
Rookie


Joined: Sep 22, 2008
Posts: 47
Location: Bothell, WA

I recompiled for a 'mega128 and have attached that file. The executable expects a 16MHz crystal and talks through USART0 at 38.4K, 8N1. I tested this executable on a BDMicros' Mavric IIB dev board.

I have also attached a short benchmark program so you can get an idea of some of the features of this program. Just do an ASCII text transfer from your comm program; you may need to set a small delay (say, 20 ms) at the end of each line.

Feedback welcome...

klaxon44
 
 View user's profile Send private message  
Reply with quote Back to top
stevech
PostPosted: Sep 23, 2008 - 07:50 PM
Raving lunatic


Joined: Dec 18, 2001
Posts: 4780


klaxon44 wrote:
I recompiled for a 'mega128 and have attached that file.
Feedback welcome...

klaxon44


have you had time to document the language? Syntax? etc?


Last edited by stevech on Sep 23, 2008 - 07:54 PM; edited 1 time in total
 
 View user's profile Send private message  
Reply with quote Back to top
sparrow2
PostPosted: Sep 23, 2008 - 07:52 PM
Raving lunatic


Joined: Oct 07, 2002
Posts: 2058
Location: Denmark

First thank to Johan about the name problem.

I don't have a mega128, so can I get the numberes at 16MHz, to make some compare of how I would do it Smile
I see that you don't DIM your var. so do you place them like the microsoft basic (just after the program)
or some kind of stack ?
The same for the FOR NEXT do you have a stack ?
And do you semi compile on the fly (so a goto will be a jump, the microsoft basic compare with current line number and then either start here or at the beginning, so a lot of lines gets slow).
And I don't see real strings, they are a real pain to deal with, especially the gabage collection. (on a commodore64, the clean up can take more than 30min if you make a lot of strings 1 char long, then change them to 2char long then 3 long, now we are running out of memory and stall for 30min)(the way to get round is to force it to clean up more often, (for the MS the free() function will do that).

Have fun
Jens
 
 View user's profile Send private message  
Reply with quote Back to top
klaxon44
PostPosted: Sep 23, 2008 - 08:24 PM
Rookie


Joined: Sep 22, 2008
Posts: 47
Location: Bothell, WA

stevech and sparrow2,

1. No, I haven't yet had a chance to document the syntax or develop a manual. It's on my list because I know how important it is, but I don't have anything yet.

2. Simple variables do not (yet) need to be DIMed, though I will probably add an EXPLICIT command so you can decide whether you must DIM them before use. Arrays must be DIMed before use. All variables are kept in a separate pool of RAM. Use the FREE command to see how much RAM you have available and where it has been assigned.

3. GOTOs and GOSUBs are compiled to pcode + target line number. I'm not happy with this, because the line number search takes place repeatedly during execution. I will fix this and some other foundational issues as time permits.

4. String variables are not supported, though obviously printed constant strings are supported. Additionally, the INPUT statement accepts a quoted string for use as a prompt.

Do these questions mean that some of you have been able to get the .hex file to run?

klaxon44
 
 View user's profile Send private message  
Reply with quote Back to top
sparrow2
PostPosted: Sep 24, 2008 - 10:58 PM
Raving lunatic


Joined: Oct 07, 2002
Posts: 2058
Location: Denmark

I can't test it because I don't have a 1280.
And that will be a problem for your BASIC, it needs to be able to fit in a mega8 or so.
I don't see it as a problem with only 1K of RAM. I remember the ZX80 with 1K RAM and 4K ROM.
And if no need for speed the code can come from a EEprom(like a BASIC stamp).(that was why I started with the AVR emulator so a tiny AVR could run a big program, the emulater take only about 2K flash(depending of how fast it needs to be))
If you want I can help with a ASM version, but as a C freak I asume that isn't want you want Smile

Jens
 
 View user's profile Send private message  
Reply with quote Back to top
sparrow2
PostPosted: Sep 24, 2008 - 11:09 PM
Raving lunatic


Joined: Oct 07, 2002
Posts: 2058
Location: Denmark

If you need something for demo where the PC allways is connected you could make the basic run on the PC, and just have a fast RS232(or USB) to the AVR. The AVR then only need a robot program, evt with a automated timer interrupt etc. for the real time events.

Jens
 
 View user's profile Send private message  
Reply with quote Back to top
jrseattle
PostPosted: Sep 25, 2008 - 07:54 AM
Wannabe


Joined: Aug 24, 2006
Posts: 89


Great piece of software! I loaded the mega128 hex file on a 16 Mhz ET-AVR stamp board (from Futurlec) and it runs flawlessly (once I had the usual serial port issues resolved).
Downloading text files using Brey's terminal or Hyperterminal doesn't work very well though (buffer overrun probably), unless someone can point out a "delay after each line" option. So I copied the test program using several "paste to host" operations. Works great, here are the results:

Empty loops per second, uptime comparison: 4474
Empty loops per second, timer0: 5130

Time to execute 50,000 empty loops: 1088
Time to execute 50,000 additions: 5603
Time to execute 50,000 multiplies: 5769
Time to execute 50,000 divisions: 7482

Is there any way to edit lines (as opposed to retyping)?

I see that the original Basic11 has keywords like PORTA, PORTB, APOKE etc. Could you summarize the avr/machine level interfaces?

I live in Kirkland WA myself. With sparrow2, klaxon4 and jrseattle all close by, we could start a local AVR freaks chapter Smile Of course zbaird is invited too.

jrseattle
www.oscilloscopeclock.com
 
 View user's profile Send private message  
Reply with quote Back to top
js
PostPosted: Sep 25, 2008 - 08:50 AM
10k+ Postman


Joined: Mar 28, 2001
Posts: 20635
Location: Sydney, Australia (Gum trees, Koalas and Kangaroos, No Edelweiss)

How exciting!! Got it running on one of may boards fitted with the M128.
http://www.members.optusnet.com.au/~amp ... 20diag.gif

I only wish I had some time to play with BASIC, it would bring back lots of memories, at least 4K worth Laughing

I have the Basic11 manual and the .arc file for version 1.55. Had to install arc with winzip to extract it, how quaint!!

I should also have the whole source file somewhere as a have a js version of the .s19 file.

Now what do I do with it? Laughing

_________________
John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
stevech
PostPosted: Sep 25, 2008 - 04:25 PM
Raving lunatic


Joined: Dec 18, 2001
Posts: 4780


10 X = 1234
20 GOSUB 1400

déjà vu ! !
 
 View user's profile Send private message  
Reply with quote Back to top
jrseattle
PostPosted: Sep 25, 2008 - 06:02 PM
Wannabe


Joined: Aug 24, 2006
Posts: 89


Found one potential problem. I used the "autost fl0" command to automatically start a program on reboot, which worked great. Then I turned the unit off overnight and the autostart did not work this morning. The program was still saved in fl0 so I did another "autost fl0" to get it to autostart again.
Unclear why the previous autostart was lost.

jrseattle
www.oscilloscopeclock.com
 
 View user's profile Send private message  
Reply with quote Back to top
sparrow2
PostPosted: Sep 25, 2008 - 10:19 PM
Raving lunatic


Joined: Oct 07, 2002
Posts: 2058
Location: Denmark

So a short estimate give about 4000 clk for a empty loop.
semi compiled (where consts is handled as var)
will give something like this
10 x=x+1
could be handled as
stack addr x
stack addr x
stack addr 1
+
=
this should take about 100 clk with subrutine calls.
(the call/ret will be about 50% of the clk's)
20 if x<>1000 then 10 "in MS both then and goto would work"
would take about 50 clk.

so an empty loop would take 150 clk or be about 25 times faster Smile if it's written in ASM.
 
 View user's profile Send private message  
Reply with quote Back to top
stevech
PostPosted: Sep 26, 2008 - 04:29 AM
Raving lunatic


Joined: Dec 18, 2001
Posts: 4780


I flashed to a mega128 ETT stamp, 16MHz. UART0 is at 38.4Kbaud
Using Bray's Terminal, I could not upload the benchmark test program. I slowed down the upload to like 5 chars per second. I think there are line feeds in the file and the Interpreter does not want them. I could't find a way to prevent line feeds using the editors I have (several). The interpreter should/could ignore them.

Clue: If I change my terminal program so that when I type CR it sends CRLF, I get the same error when typing manually. That error is ERROR #7: Illegal variable

So I typed in part of the benchmark program and it ran fine.

here's another ditty
100 n = uptime/1000
110 if uptime/1000 = n then 110
120 ?uptime
130 goto 100
 
 View user's profile Send private message  
Reply with quote Back to top
klaxon44
PostPosted: Sep 26, 2008 - 05:26 PM
Rookie


Joined: Sep 22, 2008
Posts: 47
Location: Bothell, WA

1. There is no way to edit a line short of retyping. I have given thought to adding an ANSI terminal interface, which would allow cool things like source-level debugging, in-line editing, and suchlike. I don't think the overhead would be very much, either; mabye a few K.

2. Sounds like sending a trailing LF might be an issue; I will double-check to make sure that gets stripped out.

3. sparrow2, I agree that if this compiled down to assembly language, it would run about 10x faster and 10x smaller. I purposely chose to do a pcode interpreter rather than a full compiler. One of my reasons was I didn't want to create yet another machine-specific compiler. I may one day do a true target-based Basic compiler, but for now I'm having fun with the interpreter.

4. For the atmega128, you have direct access to all GPIO ports and registers, all A/D-based registers, and all SPI registers. For example, you can write a byte to the SPI with: 130 spdr = $44
and you can read a byte from the SPI with: 140 mydata = spdr
Note that I used the same names as WinAVR uses in their ioxxx.h files. I do not provide names for accessing bits, though.

5. When I use Hyperterm to send my source text into th e target, I include a 5 or 10 msec delay after each line but no delay between characters; works fine for me.

6. jrseattle, not sure why you would lose the autostart from flash following powercycle. Next time you powercycle, enter: autost
at the prompt and see if it says fl0 was marked for autostart. If it wasn't, something is corrupting your EEPROM on power-down or power-up. Let me know what you find out.

7. js, now that you have it running, you can do anything you want with it! Smile
Actually, I intend to provide support for PWM and servos soon, so robotics is right around the corner.

8. jrseattle, sparrow2, and others,
Yes, it would be fun to have a Puget Sound AVR gathering. If you guys want to hook up for pizza and geek-talk some evening, let me know.

So many features to add, so little time...

klaxon44
 
 View user's profile Send private message  
Reply with quote Back to top
klaxon44
PostPosted: Sep 26, 2008 - 05:29 PM
Rookie


Joined: Sep 22, 2008
Posts: 47
Location: Bothell, WA

1. There is no way to edit a line short of retyping. I have given thought to adding an ANSI terminal interface, which would allow cool things like source-level debugging, in-line editing, and suchlike. I don't think the overhead would be very much, either; mabye a few K.

2. Sounds like sending a trailing LF might be an issue; I will double-check to make sure that gets stripped out.

3. sparrow2, I agree that if this compiled down to assembly language, it would run about 10x faster and 10x smaller. I purposely chose to do a pcode interpreter rather than a full compiler. One of my reasons was I didn't want to create yet another machine-specific compiler. I may one day do a true target-based Basic compiler, but for now I'm having fun with the interpreter.

4. For the atmega128, you have direct access to all GPIO ports and registers, all A/D-based registers, and all SPI registers. For example, you can write a byte to the SPI with: 130 spdr = $44
and you can read a byte from the SPI with: 140 mydata = spdr
Note that I used the same names as WinAVR uses in their ioxxx.h files. I do not provide names for accessing bits, though.

5. When I use Hyperterm to send my source text into th e target, I include a 5 or 10 msec delay after each line but no delay between characters; works fine for me.

6. jrseattle, not sure why you would lose the autostart from flash following powercycle. Next time you powercycle, enter: autost
at the prompt and see if it says fl0 was marked for autostart. If it wasn't, something is corrupting your EEPROM on power-down or power-up. Let me know what you find out.

7. js, now that you have it running, you can do anything you want with it! Smile
Actually, I intend to provide support for PWM and servos soon, so robotics is right around the corner.

8. jrseattle, sparrow2, and others,
Yes, it would be fun to have a Puget Sound AVR gathering. If you guys want to hook up for pizza and geek-talk some evening, let me know.

So many features to add, so little time...

klaxon44
 
 View user's profile Send private message  
Reply with quote Back to top
klaxon44
PostPosted: Sep 26, 2008 - 05:33 PM
Rookie


Joined: Sep 22, 2008
Posts: 47
Location: Bothell, WA

Oops, sorry for the double-post!

sparrow2, I reread your post and realized my reply wasn't actually on-target; sorry about that. I'll try again.

I borrowed Gordon Doughman's original 'hc11 design for the interpreter. His design has some excellent features that I wanted to preserve, one of which is that his interpreter can recover the original source line intact, complete with all embedded spaces. The design you promote is much faster and smaller, but is one-way. I had compelling reasons to go with Gordon's design, but I certainly considered what you were proposing. Thanks for the comment!

klaxon44
 
 View user's profile Send private message  
Reply with quote Back to top
sparrow2
PostPosted: Sep 26, 2008 - 07:15 PM
Raving lunatic


Joined: Oct 07, 2002
Posts: 2058
Location: Denmark

For some reason I had missed that you use a specific BASIC I was thinking that you was making your own.(I will read the manual but I'm at work now).
Now I see why you need more RAM Smile
To speed it up you can do like the spectrum BASIC, store both (1000 is stored as 1000 and $03E8 you just don't see it).
Are there any way I can run this from the simulator?

In the 80's you could buy a 8052 with BASIC in the ROM (I don't think they made it for the CMOS). Maybe some ideas from there could help.

You could make a token for 2 spaces 3...... (or a token that take a byte for the number of spaces.(I asume you want this for indentation).

Jens

Edit: so does this BASIC run a true ASCII text or is it just stored so you can make a 100% correct LIST?

make it a 8052
 
 View user's profile Send private message  
Reply with quote Back to top
klaxon44
PostPosted: Sep 26, 2008 - 11:13 PM
Rookie


Joined: Sep 22, 2008
Posts: 47
Location: Bothell, WA

sparrow2 wrote:
For some reason I had missed that you use a specific BASIC I was thinking that you was making your own.(I will read the manual but I'm at work now).
Now I see why you need more RAM Smile
To speed it up you can do like the spectrum BASIC, store both (1000 is stored as 1000 and $03E8 you just don't see it).
Are there any way I can run this from the simulator?

In the 80's you could buy a 8052 with BASIC in the ROM (I don't think they made it for the CMOS). Maybe some ideas from there could help.

You could make a token for 2 spaces 3...... (or a token that take a byte for the number of spaces.(I asume you want this for indentation).

Jens

Edit: so does this BASIC run a true ASCII text or is it just stored so you can make a 100% correct LIST?

make it a 8052


Actually, this is my own Basic. It is based on Gordon Doughman's BASIC11, but it is all my own code. I translated Gordon's 68hc11 assembly language source into ANSI C, then compiled the C for Windows and also for the AVR.

How the interpreter stores each source line of your program internally was already mapped out by Gordon and I haven't changed it (much). Gordon's internal storage scheme makes it easy to convert back and forth between ASCII text and the corresponding pcodes. Keeping the flexibility, however, means that the pcode scheme isn't quite as efficient as it might be. Still, I want the user (typically a newbie) to be able to see the source faithfully reproduced with a LIST command, so I kept Gordon's scheme.

klaxon44
 
 View user's profile Send private message  
Reply with quote Back to top
stevech
PostPosted: Sep 27, 2008 - 12:39 AM
Raving lunatic


Joined: Dec 18, 2001
Posts: 4780


here's some of the keywords/command words from the original. Maybe it would be easy to edit this and delete those that are N/A and those that are omitted, etc.

Code:
              "LIST"
              "RUN"
              "NEW"
              "CONT"
              "CLEAR"
              "ESAVE"
              "ELOAD"
              "LLIST"
              "AUTOST"
              "NOAUTO"
                 "FREE"

 "DATA" xdata();
 "LET" xlet();
 "READ" xread();
 "RESTORE" xrestore();
 "GOSUB" xgosub();
 "GOTO" xgoto();
 "ON" xon();
 "RETURN" xreturn();
 "IF" xif();
 "INPUT" xinput();
 "PRINT" xprint();
 "FOR" xfor();
 "NEXT" xnext();
 "STOP" xstop();
 "ENDWH" xendwh();
 "END" xend();
 "REM" xrem();
*/*"SWAP" xswap();*/
 "TRON" xtron();
 "TROFF" xtroff();
 "WHILE" xwhile();


TOKTBL:   EQU     *
          FCB     LETTOK
          FDB     LET
          FCB     READTOK
          FDB     READ
          FCB     RESTRTOK
          FDB     RESTORE
          FCB     GOSUBTOK
          FDB     GOSUB
          FCB     GOTOTOK
          FDB     GOTO
          FCB     ONTOK
          FDB     ON
          FCB     RETNTOK
          FDB     RETURN
          FCB     IFTOK
          FDB     IIF
          FCB     THENTOK
          FDB     THENS
          FCB     ELSETOK
          FDB     ELSES
          FCB     INPUTTOK
          FDB     INPUT
          FCB     PRINTTOK
          FDB     PRINT
          FCB     FORTOK
          FDB     FOR
          FCB     NEXTTOK
          FDB     NEXT
          FCB     STOPTOK
          FDB     STOPSS
          FCB     ENDTOK
          FDB     ENDS
          FCB     TRONTOK
          FDB     TRON
          FCB     TROFFTOK
          FDB     TROFF
          FCB     WHILETOK
          FDB     WHILE
          FCB     ENDWHTOK
          FDB     ENDWH
          FCB     STEPTOK
          FDB     STEP
          FCB     TOTOK
          FDB     TO
          FCB     COMMATOK
          FDB     COMMAC
          FCB     SEMITOK
          FDB     SEMIC
          FCB     MEOLTOK
          FDB     COLLINC
          FCB     IMLETTOK
          FDB     IMLET
          FCB     POKETOK
          FDB     POKE
          FCB     EQUALTOK
          FDB     EQ
          FCB     OPARNTOK
          FDB     OPARN
          FCB     CPARNTOK
          FDB     CPARN
          FCB     ANDTOK
          FDB     ANDS
          FCB     ORTOK
          FDB     ORS
          FCB     EORTOK
          FDB     EORS
          FCB     LTTOK
          FDB     LT
          FCB     GTTOK
          FDB     GT
          FCB     LTEQTOK
          FDB     LTEQ
          FCB     GTEQTOK
          FDB     GTEQ
          FCB     EQTOK
          FDB     EQ
          FCB     NOTEQTOK
          FDB     NOTEQ
          FCB     PLUSTOK
          FDB     PLUS
          FCB     MINUSTOK
          FDB     MINUS
          FCB     MULTTOK
          FDB     MULT
          FCB     DIVTOK
          FDB     DIV
          FCB     MODTOK
          FDB     MODS
          FCB     NOTTOK
          FDB     NOTS
          FCB     RTIMETOK
          FDB     RTIMES
          FCB     NEGTOK
          FDB     NEGS
          FCB     SSCNTOK
          FDB     SPACE
          FCB     DIMTOK
          FDB     DIM
          FCB     EEPTOK
          FDB     EEP
          FCB     PORTATOK
          FDB     PORTA
          FCB     PORTBTOK
          FDB     PORTB
          FCB     PORTCTOK
          FDB     PORTC
          FCB     PORTDTOK
          FDB     PORTD
          FCB     PNUMTOK
          FDB     POUNDSGN
          FCB     INBYTTOK
          FDB     INBYTES
          FCB     TIMETOK
          FDB     TIME
          FCB     ONTIMTOK
          FDB     ONTIME
          FCB     ONIRQTOK
          FDB     ONIRQ
          FCB     RETITOK
          FDB     RETI
          FCB     PACCTOK
          FDB     PACC
          FCB     ONPACTOK
          FDB     ONPACC
          FCB     SLEEPTOK
          FDB     SLEEP


LFUNCTBL: EQU    *
          FCB    FDIVTOK
          FDB    FDIVS
          FCB    CHRTOK
          FDB    CHRS
          FCB    ADCTOK
          FDB    ADCS
          FCB    ABSTOK
          FDB    ABS
          FCB    RNDTOK
          FDB    RND
          FCB    SGNTOK
          FDB    SGN
          FCB    TABTOK
          FDB    TABS
          FCB    CALLTOK
          FDB    CALL
          FCB    PEEKTOK
          FDB    PEEK
          FCB    FEEPTOK
          FDB    EEP
          FCB    HEXTOK
          FDB    HEX
          FCB    FPRTATOK
          FDB    PORTA
          FCB    FPRTBTOK
          FDB    PORTB
          FCB    FPRTCTOK
          FDB    PORTC
          FCB    FPRTDTOK
          FDB    PORTD
          FCB    FPRTETOK
          FDB    PORTE
          FCB    FTIMETOK
          FDB    TIME
          FCB    HEX2TOK
          FDB    HEX2
          FCB    FPACCTOK
          FDB    PACC
 
 View user's profile Send private message  
Reply with quote Back to top
klaxon44
PostPosted: Sep 27, 2008 - 08:21 PM
Rookie


Joined: Sep 22, 2008
Posts: 47
Location: Bothell, WA

From the above list, KLBasic supports the following commands:

LIST
RUN
NEW
CONT
AUTOST (but with changes, see below)
FREE

NOAUTO has been replaced; AUTOST now supports the following variations:

AUTOST show state of autostart
AUTOST OFF autostart disabled
AUTOST EE autostart program in EEPROM
AUTOST FL0 autostart program in flash file 0
AUTOST FL1 autostart program in flash file 1
AUTOST FL2 autostart program in flash file 2

ESAVE and ELOAD replaced by LOAD and SAVE.

SAVE has the following arguments:

SAVE EE save program to EEPROM
SAVE FL0 save program to flash file 0
SAVE FL1 save program to flash file 0
SAVE FL2 save program to flash file 2

LOAD has following arguments:

LOAD EE load program from EEPROM
LOAD FL0 load program from flash file 0
LOAD FL1 load program from flash file 1
LOAD FL2 load program from flash file 2

KLBasic supports the following functions and statements:

DATA
LET (implied)
READ
RESTORE
GOSUB
GOTO
RETURN
IF
INPUT (with optional quoted prompt string)
PRINT (also supports ? as quick-print)
FOR
NEXT
STOP
WHILE
ENDWH
REM (also supports ' as a remark char)
TRON
TROFF
END
: (separates to statements in same line)
AND
OR
NOT
XOR
MOD
+, -, *, /
<, >, =, <>, <=, >=
DIM (declares size of arrays)
RND(N) returns random 32-bit int <N
RND(0) reseeds random number generator

This should get you going...

klaxon44
 
 View user's profile Send private message  
Reply with quote Back to top
klaxon44
PostPosted: Sep 29, 2008 - 12:34 AM
Rookie


Joined: Sep 22, 2008
Posts: 47
Location: Bothell, WA

I have version 0.5 of KLBasic ready to go. LFs are now ignored from the console.

Note that there are two files in this release, one for the 'mega128 and one for the 'mega1284p. The 'mega1284p version supports 11K of code space and 1K each of variable and array space. I'm running my '1284p at 20MHz so the benchmark01 program shows 50K empty loops in 0.811 seconds.
 
 View user's profile Send private message  
Reply with quote Back to top
stevech
PostPosted: Sep 29, 2008 - 07:15 AM
Raving lunatic


Joined: Dec 18, 2001
Posts: 4780


the mega128 is still 16MHz?
 
 View user's profile Send private message  
Reply with quote Back to top
klaxon44
PostPosted: Sep 29, 2008 - 03:41 PM
Rookie


Joined: Sep 22, 2008
Posts: 47
Location: Bothell, WA

stevech wrote:
the mega128 is still 16MHz?


Sorry for the omission. Yes, the 'mega128 is 16 MHz, the 'mega1284p is 20 MHz.

I'm open to suggestions on how to support a variety of crystal speeds across several MCU types. Besides the problem with console baud rates, changing the crystal impacts the down-counting timers and the uptime variable.

As it is, I'm keeping three different MCU boards laying around; I really don't want to have to switch crystals so I can test-drive versions with different clocks.

I also don't want to just turn loose a .hex file that I haven't tested because follow-on support becomes a nightmare if I don't have a suitable platform.

Any thoughts?

klaxon44
 
 View user's profile Send private message  
Reply with quote Back to top
kmr
PostPosted: Sep 29, 2008 - 03:52 PM
Raving lunatic


Joined: Apr 01, 2004
Posts: 3812
Location: New Mexico

klaxon44 wrote:
Any thoughts?
External jumpers to set the program's knowledge of clock speed at initialization time? Open-source project so that people can compile the source based on their own CPU speed? Defined EEPROM location where end-users can program their own clock speed identifier? [auto baud rate detection has already been discussed]

_________________
Kevin Rosenberg
http://b9.com
http://kevin.hypershots.com
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
bobgardner
PostPosted: Sep 29, 2008 - 03:56 PM
10k+ Postman


Joined: Sep 04, 2002
Posts: 21396
Location: Orlando Florida

How about a 'limp home mode' that boots at internal 1mhz and 1200 baud until you pick an xtal speed somehow? What percent is the flash filled up? Need a collaborator to put nokia graphics module or a fat on an sd card module in there?

_________________
Imagecraft compiler user
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
sparrow2
PostPosted: Sep 29, 2008 - 06:29 PM
Raving lunatic


Joined: Oct 07, 2002
Posts: 2058
Location: Denmark

Or have the first addr in the eeprom (or something like that) deside the speed, or even put it in a well defined byte in the hex file.

But why not have the normal way where you send a space and the taget make the speed calc?

Jens
 
 View user's profile Send private message  
Reply with quote Back to top
bobgardner
PostPosted: Sep 30, 2008 - 01:21 AM
10k+ Postman


Joined: Sep 04, 2002
Posts: 21396
Location: Orlando Florida

Thats what they cal 'autobaud'... if you know the char he's typing, and the xtal speed, you can either measure the bitwidth or look up the char you got in a table of different baudrates. I think the bet's off if the program doesnt know the xtal freq. But I actually thought the idea about having the initial turnon using 1mhz and 1200 baud was pretty clever. That's why I'm mentioning it again. Brazen hubris.

_________________
Imagecraft compiler user
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
sparrow2
PostPosted: Sep 30, 2008 - 07:02 PM
Raving lunatic


Joined: Oct 07, 2002
Posts: 2058
Location: Denmark

Can the 1280 switch from intern osc to extern on the fly ? (I don't think so)

Jens
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Sep 30, 2008 - 07:29 PM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62944
Location: (using avr-gcc in) Finchingfield, Essex, England

Quote:
Can the 1280 switch from intern osc to extern on the fly ? (I don't think so)

Nope (so you were right to think not)

I'm intrigued to know why on earth one would want to do that anyway?

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
sparrow2
PostPosted: Sep 30, 2008 - 08:37 PM
Raving lunatic


Joined: Oct 07, 2002
Posts: 2058
Location: Denmark

How else would you start at 1MHz so the baud rate is fixed, when you want to run 16 or 20 MHz.

Jens
 
 View user's profile Send private message  
Reply with quote Back to top
klaxon44
PostPosted: Sep 30, 2008 - 09:56 PM
Rookie


Joined: Sep 22, 2008
Posts: 47
Location: Bothell, WA

bobgardner wrote:
How about a 'limp home mode' that boots at internal 1mhz and 1200 baud until you pick an xtal speed somehow? What percent is the flash filled up? Need a collaborator to put nokia graphics module or a fat on an sd card module in there?


I am DEFINETLY looking to put SD/FAT on a '1284p! That would let me open up datalogging, text files, and other goodness.

klaxon44
 
 View user's profile Send private message  
Reply with quote Back to top
posix1965
PostPosted: Nov 19, 2008 - 06:54 PM
Newbie


Joined: Oct 21, 2008
Posts: 4


I loaded the mega128 .hex file on my home-made "wiring.org" board.This interpreter works great.With 8 LED's connected to port "c" I was able to test the port with a small program.
10 ddrc=$ff
20 for x=0 to 255
30 portc=x
40 for t=1 to 2000
50 next t
60 print x;
70 print " ";
80 next x
RUN
Thanks


Last edited by posix1965 on Nov 20, 2008 - 05:05 PM; edited 1 time in total
 
 View user's profile Send private message  
Reply with quote Back to top
jesper
PostPosted: Nov 19, 2008 - 08:32 PM
Raving lunatic


Joined: Mar 07, 2001
Posts: 2376
Location: Stockholm, Sweden

farang wrote:
While not a serious replacement for C or Basic compilers (remember Forth?), a basic interpreter is an excellent tool for learning programming concepts, and for debugging hardware -the peeks and pokes and input and output commands are excellent ways to tickle port pins or look at them.
Isn't that what the Dragon/JTAGICE is for? Which you just used to downoad the Basic Interpreter with? Wink

In ye olde days, yes, it was great for debugging and testing, but today?
Especially not a closed source one. There are plenty of open source variants around.
And who hasn't written one themselves?

_________________
/Jesper
http://www.yampp.com
The quick black AVR jumped over the lazy PIC.
What boots up, must come down.
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
JohanEkdahl
PostPosted: Nov 19, 2008 - 08:37 PM
10k+ Postman


Joined: Mar 27, 2002
Posts: 18757
Location: Lund, Sweden

Quote:

And who hasn't written one themselves?

Bill? Cool
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
posix1965
PostPosted: Nov 19, 2008 - 09:53 PM
Newbie


Joined: Oct 21, 2008
Posts: 4


All my .hex file are downloaded using Avrdude on a Linux terminal
emulator,and while I still like programming in C it sure beats getting an output without having to program the AVR's flash.
I can't wait until PWM and other IN/OUTS are available using the interpreter.
 
 View user's profile Send private message  
Reply with quote Back to top
zbaird
PostPosted: Nov 19, 2008 - 10:13 PM
Raving lunatic


Joined: Aug 13, 2006
Posts: 6764
Location: Bellingham, WA - USA

Quote:
Bill?
Since this funny came from you, Johan:

A thought in young Billie's head swirled
And finally it danced and it whirled
"A BASIC I'll claim
Without the least shame
And with it I'll soon rule the world."

_________________
Chuck Baird
"It's better to catch the trapeze than test the safety net" -- RPi book
http://www.cbaird.org
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
CirMicro
PostPosted: Nov 19, 2008 - 10:29 PM
Posting Freak


Joined: Jun 04, 2007
Posts: 1075
Location: Cincinnati, Ohio - USA

I think you've created a monster Johan! Smile
 
 View user's profile Send private message  
Reply with quote Back to top
georgestheking
PostPosted: Jan 02, 2009 - 04:54 PM
Newbie


Joined: Jul 08, 2002
Posts: 4


I try this nice piece of code.
But the most comun AVR is the MEGA32 I guess.

Can you supply a version for the AT MEGA 32 or the AT MEGA 644 p ?

Thanks to submit your work.

Have an happy new Year

Georges
 
 View user's profile Send private message  
Reply with quote Back to top
JohanEkdahl
PostPosted: Jan 02, 2009 - 05:14 PM
10k+ Postman


Joined: Mar 27, 2002
Posts: 18757
Location: Lund, Sweden

Quote:

But the most comun AVR is the MEGA32 I guess.

Do you have any numbers to put behind that? Or is it really a wild guess / shot in the dark?
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
microcarl
PostPosted: Jan 02, 2009 - 07:14 PM
Raving lunatic


Joined: May 30, 2004
Posts: 8143
Location: Cincinnati, Ohio

JohanEkdahl wrote:
Quote:

But the most comun AVR is the MEGA32 I guess.

Do you have any numbers to put behind that? Or is it really a wild guess / shot in the dark?

If you go by the numbers in my parts bin, I'd have to agree that the Mega32 was the more popular AVR, at one point in time.

But now I seem to have nearly that in each of the Mega168, Mega324, Mega644 & Tiny2313 controllers - all in TQFP packaging, of course.

_________________
Carl W. Livingston, KC5OTL
microcarl@roadrunner.com

"There are only two ways to sleep well at night... be ignorant or be prepared."

The original Dragon Slayer !

Long live the AVR!!!
 
 View user's profile Send private message Send e-mail  
Reply with quote Back to top
Bingo600
PostPosted: Jan 02, 2009 - 10:16 PM
Raving lunatic


Joined: Apr 25, 2004
Posts: 3817
Location: Denmark

Here is another , with source i beleive (Mega 644)

http://www.jcwolfram.de/projekte/avr/ch ... 2/main.php
http://www.mikrocontroller.net/topic/88481#new

For the M8/88/16
http://www.jcwolfram.de/projekte/avr/ch ... 8/main.php
http://www.mikrocontroller.net/topic/99957#new


http://www.jcwolfram.de/projekte/avr/main.php


It seems like the packet is made on Linux

/Bingo
 
 View user's profile Send private message  
Reply with quote Back to top
stevech
PostPosted: Jan 02, 2009 - 10:57 PM
Raving lunatic


Joined: Dec 18, 2001
Posts: 4780


Bingo600 wrote:


If some kind soul would translate the ChipBasic2 PDF user docs to english, we'd be so grateful!
 
 View user's profile Send private message  
Reply with quote Back to top
posix1965
PostPosted: Jan 02, 2009 - 11:59 PM
Newbie


Joined: Oct 21, 2008
Posts: 4


[f some kind soul would translate the ChipBasic2 PDF user docs to english, we'd be so grateful!]

And only the chipbasic2 for the m644 keyboard layout is switchable from German to US English.
 
 View user's profile Send private message  
Reply with quote Back to top
gerlynch
PostPosted: May 16, 2010 - 12:01 AM
Newbie


Joined: May 14, 2010
Posts: 1


Hi,

Is there a manual available for this yet?

Regards,

Gerard
 
 View user's profile Send private message  
Reply with quote Back to top
posix1965
PostPosted: Jun 11, 2010 - 03:12 AM
Newbie


Joined: Oct 21, 2008
Posts: 4


gerlynch wrote:
Hi,

Is there a manual available for this yet?

Regards,

Gerard


I think this is DEAD.
 
 View user's profile Send private message  
Reply with quote Back to top
klaxon44
PostPosted: Apr 15, 2012 - 07:19 PM
Rookie


Joined: Sep 22, 2008
Posts: 47
Location: Bothell, WA

Not dead; I just forgot to check this thread. :-)

Check my webpage at: www.seanet.com/~karllunt
for the latest release 15 Apr 2012. Sorry, no manual available yet, but I do provide a fairly large test program that shows how to use a lot of the features.

klaxon44
 
 View user's profile Send private message  
Reply with quote Back to top
stevech
PostPosted: Apr 17, 2012 - 02:55 AM
Raving lunatic


Joined: Dec 18, 2001
Posts: 4780


klaxon44 wrote:
Not dead; I just forgot to check this thread. Smile

Check my webpage at: www.seanet.com/~karllunt
for the latest release 15 Apr 2012. Sorry, no manual available yet, but I do provide a fairly large test program that shows how to use a lot of the features.

klaxon44
Thanks for the good work!
Just 2 more features and I'd give it a good go...

1. Renumber [by n]
2. labels, so one can gosub alpha

keep an eye out on ZBasic.net too - for new things short term. that's the best structured Basic for 8 bitters.
 
 View user's profile Send private message  
Reply with quote Back to top
georgestheking
PostPosted: Apr 17, 2012 - 06:22 PM
Newbie


Joined: Jul 08, 2002
Posts: 4


Other ideas

adc()
PWM()
I2C
ON INT gosub...

Nice work

Georges
 
 View user's profile Send private message  
Reply with quote Back to top
klaxon44
PostPosted: Apr 18, 2012 - 09:07 PM
Rookie


Joined: Sep 22, 2008
Posts: 47
Location: Bothell, WA

stevenc, I checked out ZBasic's pages. Looks excellent! If I understand correctly, this is a PC-based compiler that produces either interpreted or native code for an AVR target, right? Very much like my older SBasic for the 68hc11/12/68k. With KLB, I wanted an on-target interpreter so you can develop and debug locally.

I'm open to suggestions on syntax for the labels, as I've given that idea a lot of thought. How about these possibilities:

Code:
100 gosub ReadADC
.
.
3000 label ReadADC

or

3000 ReadADC::

or

3000 :ReadADC

I would like to not use SUBROUTINE as part of this solution, as I may actually get ambitious enough one day to include support for true subroutines and I don't want to create a problem between SUBROUTINE as a target for a goto/gosub and a true SUBROUTINE.

georges, thanks for your suggestions. I've got them in the queue...

klaxon44
 
 View user's profile Send private message  
Reply with quote Back to top
DocJC
PostPosted: Apr 18, 2012 - 09:17 PM
Raving lunatic


Joined: Dec 11, 2007
Posts: 6982
Location: Cleveland, OH

I wondered why the double colon?
Isn't one colon, after the label text, the "standard"?

If one has line numbers then isn't:
1000 goto 5000
.
.
.
5000 Instruction
5010 Instruction
5020 Instruction
.
.
.

also a valid construct?

But, the real question is this:
What do Line Numbers give you that the software can't figure out on its own without them?

JC
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
dkinzer
PostPosted: Apr 19, 2012 - 03:39 AM
Posting Freak


Joined: Mar 12, 2004
Posts: 1207
Location: Portland, OR, USA

klaxon44 wrote:
If I understand correctly, this is a PC-based compiler that produces either interpreted or native code for an AVR target, right?
Partially. The free ZBasic compiler generates either VM code or native object code for the several AVR-based ZX devices of the VM (interpreted) and native types, respectively. With the addition of a ZBasic Generic Target License, the same compiler is able to compile a ZBasic application to native object code that can be downloaded to an ordinary AVR. (Note, however, that not all AVR chips are supported - but over 100 different chips are supported.)

Downloading a compiled ZBasic application to a generic AVR can be achieved via ICSP Flash programming (requires a programmer and downloading application, e.g. avrdude), via a ZBasic-compatible bootloader (source code for which is provided), or via another bootloader of your choice (requires a compatible downloading application, e.g. FLIP).

_________________
Don Kinzer
ZBasic Microcontrollers
http://www.zbasic.net
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
klaxon44
PostPosted: Apr 19, 2012 - 11:52 PM
Rookie


Joined: Sep 22, 2008
Posts: 47
Location: Bothell, WA

Doc,

One colon following the label text is common, but colon is also the mid-line terminator, as in:

100 a = 4 : b = 3

It would be trivial to have the parser differentiate between the two uses of colon, but I was wondering if anyone had a better idea.

Having a label as a jump target helps minimize the chance of an editing error going undetected. A "gosub 160" when you meant "gosub 150" will still run without complaint (assuming line 160 exists). A "gosub ReadACD" when you meant "gosub ReadADC" will throw a parsing error since the label doesn't exist.

Another benefit comes with program structure. If you have a subroutine in lines 3000-3999 and you have to move it to lines 8000-8999, you won't also have to search and change all instances of 3000 in your mainline code. You can just leave the invocations as ReadADC and the parser will be happy.

The larger issue, the need for line numbers, arose because there simply isn't enough RAM in most of these AVRs to support a RAM editing buffer. For example, if a FOR-NEXT loop spans 20 lines, the editor would have to hold all of those lines so the parser could confirm that the FOR had a matching NEXT.

One workaround would be some kind of standardized, fast-access, external memory, such as an SPI-based FRAM. Way cool, but then anyone wanting to use the Basic program would have to add the device.

klaxon44
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits