Anonymous

Project:Nanode/Tiny Basic: Difference between revisions

From London Hackspace Wiki
Line 40: Line 40:
Extending this Tiny Basic and including the common Arduino libraries to form an Nanode operating system (NanOS ?)will be an interesting but achievable task.
Extending this Tiny Basic and including the common Arduino libraries to form an Nanode operating system (NanOS ?)will be an interesting but achievable task.


The Tiny Basic plus all the nex=cessary hardware libraries fit into just 13K of program space leaving 17K for language extensions and application code. The breakthrough will be to get the SRAM and the SD working as a program application memory and solid state disk.
The Tiny Basic plus all the necessary hardware libraries fit into just 13K of program space leaving 17K for language extensions and application code. The breakthrough will be to get the SRAM and the SD working as a program application memory and solid state disk.


With the Tiny Basic is a means to list the program, so that lines of code can easily be edited with a terminal program. - or probably a whole file loaded using a file transfer program such as Hyperterminal or whatever.
With the Tiny Basic is a means to list the program, so that lines of code can easily be edited with a terminal program. - or probably a whole file loaded using a file transfer program such as Hyperterminal or whatever.
Line 57: Line 57:
to set Digital 4 High. As there are only 20 I/O pins on a ATmega - it's not going to take much program space to code them up. eg
to set Digital 4 High. As there are only 20 I/O pins on a ATmega - it's not going to take much program space to code them up. eg


10 Let D4 = 1 // Set Dig 4 High
10 DOUT 4 = 1 // Set Dig 4 High
20 Let A = AN1 // Get input from Analogue 1
20 Let A = AIN 1 // Get input from Analogue 1
30 PRINT A   
 
 
==List of KeyWords==
 
The Basic functions are implemented as a list of reserved Keywords.  When the interpreter comes across a Keyword in a line of code it strips off any associated parameters and jumps to the subroutine that executes the code behind that Keyword function.  It then returns control to the interpreter which then handles and executes the next line of code.
 
Our Version of TB has the following Keywords (KW) - but more are easily added to extend the language.
 
#define KW_LIST 0
#define KW_LOAD 1
#define KW_NEW 2
#define KW_RUN 3
#define KW_SAVE 4
#define KW_NEXT 5
#define KW_LET 6
#define KW_IF 7
#define KW_GOTO 8
#define KW_GOSUB 9
#define KW_RETURN 10
#define KW_REM 11
#define KW_FOR 12
#define KW_INPUT 13
#define KW_PRINT 14
#define KW_POKE 15
#define KW_STOP 16
#define KW_BYE 17
#define KW_DOUT         18
#define KW_AOUT         19
#define KW_SLEEP 20
#define KW_DEFAULT 21
552

edits