Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 02:22 05 Feb 2023 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 : Pure BASIC with none of this new-fangled stuff

Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 6828
Posted: 11:37am 22 Jan 2023
Copy link to clipboard 
Print this post

Pico_TinyBasic.zip

Connects via USB

 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 3327
Posted: 11:44am 22 Jan 2023
Copy link to clipboard 
Print this post

Ooh....  must play!

This one is very BASIC, isn't it?
There doesn't appear to be any strings and @() isn't implemented.
What is it based on?

Hurray for WHAT? HOW? SORRY!

I see it uses the first 2 characters of a command followed by a full stop. :)
Edited 2023-01-22 21:55 by Mixtel90
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 2027
Posted: 11:55am 22 Jan 2023
Copy link to clipboard 
Print this post

This is tiny basic. 16 bit integers only, no float, no strings, only 26 variables. I modified it 5 years ago to run on a arduino uno.

Volhout
If nothing goes right ... turn left
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 3327
Posted: 12:05pm 22 Jan 2023
Copy link to clipboard 
Print this post

Yes, but I've had a Tiny BASIC (Palo Alto Tiny BASIC) with a single array called @(). You didn't dimension it, it was automatically dimensioned to use the rest of the memory!

It may have been a later version, but variables could hold short strings (but only to print). THere was no string identifier IIRC so it could get interesting. :)

This version also has commands that I don't recognise, which is why I asked. :)
Edited 2023-01-22 22:07 by Mixtel90
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 6828
Posted: 12:59pm 22 Jan 2023
Copy link to clipboard 
Print this post

I got the source from here
There was one major gotcha in running on the PICO. Line numbers are stored as 2 byte values and used in various ways. The Arduino source assumes you can use them as an index but 32 bit processor like the RP2040 can't cope when 2-byte or 4-byte values aren't aligned in memory and the TinyBasic source didn't force this so I had to.

Implemented in my version is:
  Quote  
16 bit integers only, no float, no strings, only 26 variables.

Supported statements and functions
System

   BYE - exits Basic, soft reboot on Arduino
   END - stops execution from the program, also "STOP"
   MEM - displays memory usage statistics
   NEW - clears the current program
   RUN - executes the current program

File IO/SD Card

Not implmented

EEProm - nonvolatile on-chip storage

Not implemented

IO, Documentation

   INPUT variable - let the user input an expression (number or variable name
   PEEK( address ) - get a value in memory
   PRINT expression - print out the expression, also "?"
   REM stuff - remark/comment, also "'"

   POKE not implemented

Expressions, Math

   A=V, LET A=V - assign value to a variable
   +, -, *, / - Math
   <,<=,=,<>,!=,>=,> - Comparisons
   ABS( expression ) - returns the absolute value of the expression
   RSEED( v ) - sets the random seed to v
   RND( m ) - returns a random number from 0 to m

Control

   IF expression statement - perform statement if expression is true
   FOR variable = start TO end - start for block
   FOR variable = start TO end STEP value - start for block with step
   NEXT variable - end of for block
   GOTO linenumber - continue execution at this line number
   GOSUB linenumber - call a subroutine at this line number
   RETURN - return from a subroutine

Pin IO

   DELAY timems*- wait (in milliseconds)*
   DWRITE pin,value - set pin with a value (HIGH,HI,LOW,LO)
   DREAD( pin ) - get the value of the pin
   AREAD( analogPin ) - get the value of the analog pin

   AWRITE not implemented

 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 3327
Posted: 01:13pm 22 Jan 2023
Copy link to clipboard 
Print this post

Thanks. :)
I've been playing, using JustPicoBasic documentation as a guide (although it's a lot bigger it's similar in many ways). Nothing appears to mention MILS. I wondered if it went with DELAY n MILS but apparently not.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 6828
Posted: 01:15pm 22 Jan 2023
Copy link to clipboard 
Print this post

MILS a
print a
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 3327
Posted: 01:29pm 22 Jan 2023
Copy link to clipboard 
Print this post

cryptic  :)

Loads the current value of the delay counter into the variable?
Edited 2023-01-22 23:34 by Mixtel90
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
knivd

Regular Member

Joined: 07/09/2014
Location: United Kingdom
Posts: 66
Posted: 02:58pm 22 Jan 2023
Copy link to clipboard 
Print this post

@Peter, want to try porting my Bitling BASIC?
I have worked hard on optimisations, so it should be quite fast and requires less than 2k RAM for system needs.
I just published the sources for the first time:
https://github.com/knivd/Bitling-BASIC
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 6828
Posted: 04:26pm 22 Jan 2023
Copy link to clipboard 
Print this post

  Quote  @Peter, want to try porting my Bitling BASIC?


Interesting. It's quite a bit of work (TinyBasic was trivial and done to show the GOSUB and line-number lovers how much things have moved on) and I'm not sure that porting as a general purpose Basic is worthwhile given the huge amount of work now in the PicoMite MMBasic port.

However, it might be interesting if targetted to a stand-alone dedicated bit of H/W like you have done with the Ello LC1. Obviously the RP2040 has far more capability than a PIC18F but is relatively short of I/O pins. Driving a RGB LCD panel is feasible though the PIO mechanism (same as VGA) although the colour palette would be limited in order to have a memory resident framebuffer. Keyboard is more tricky. The ELLO approach is one way as is on screen touch.

Send me a PM if this makes any sense
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 2382
Posted: 04:40pm 22 Jan 2023
Copy link to clipboard 
Print this post

  knivd said  Bitling BASIC

Any chance to add or alias DO ... LOOP?
PicoMite on fruitoftheshed
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 2027
Posted: 04:59pm 22 Jan 2023
Copy link to clipboard 
Print this post

Hihi,

MILS a is something I added to tinybasic. And VARS and HELP. And SERVO (timer controlled). They must have taken my source...hihi

The big issue with it was that there is no edit function. You have to retype the whole line.

It was fast though, 30k lines per second on an UNO.

Volhout
If nothing goes right ... turn left
 
knivd

Regular Member

Joined: 07/09/2014
Location: United Kingdom
Posts: 66
Posted: 05:51pm 22 Jan 2023
Copy link to clipboard 
Print this post

  lizby said  
  knivd said  Bitling BASIC

Any chance to add or alias DO ... LOOP?


There is... REPEAT... UNTIL
 
Amnesie
Senior Member

Joined: 30/06/2020
Location: Germany
Posts: 234
Posted: 07:09pm 22 Jan 2023
Copy link to clipboard 
Print this post

Peter!

This is really cool. Before I know that something more powerful like MMBASIC exists, I used exact this TinyBasic for Arduino stuff and modified it with my own statements and functions. Making it available for the Pico is cool too! I will definitly give it a try, especially for really simple stuff!

Thank you very much!

-Daniel
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 3327
Posted: 08:44pm 22 Jan 2023
Copy link to clipboard 
Print this post

I was running it on a 2MHz Z80 on a Nascom-1. IIRC it was in an EPROM as there probably wouldn't have been enough space for it, with the user program, in 960 (?) bytes of RAM. It's a few years ago now. :)
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 2027
Posted: 07:19am 23 Jan 2023
Copy link to clipboard 
Print this post

The UNO version also only had 800-900 bytes free (2k RAM) for program.
Apparantly someone did compile it with AVR-gcc, and squeezed another 200 bytes out of it (improved stack usage ? the Arduino toolchain did not have the best settings for memory usage on RAM.
If nothing goes right ... turn left
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 3327
Posted: 08:33am 23 Jan 2023
Copy link to clipboard 
Print this post

The Nascom-1 had a 2k EPROM area for the monitor (the early monitors were only 1k). Then there was 1k RAM for the memory-mapped video. Characters outside the scan area weren't used so some people actually managed to write programs for the video RAM! Then there was a second 1k of RAM, but part of it was used by the monitor. The user was left with about 960 bytes IIRC. The monitor was clever though, using the Z80 restart addresses to create commands. e.g. 0EFH followed by a string of ASCII characters terminated by 00H would send the text to the current output stream. A later one was RCAL, which implemented a relative call for subroutines. That allowed the monitor to be relocated anywhere in memory. The monitor's command table could be expanded as the address of it was in RAM, as were the addresses of the input and output routines. Pretty clever stuff for a SBC in 1977/78. :)
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Michal
Regular Member

Joined: 02/02/2022
Location: Poland
Posts: 82
Posted: 12:13pm 23 Jan 2023
Copy link to clipboard 
Print this post

This should fit on a RISC V
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 3327
Posted: 12:53pm 23 Jan 2023
Copy link to clipboard 
Print this post

Well, you know what to do.....   ;)
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.

© JAQ Software 2023