IchigoLatte FORTH

What is this?

This is a tiny OS for IchigoJam board like a Unix. It has a shell, vi and FORTH engine named 'ts'. See this article.

Sample Program

Avoid it!
cls
15
BEGIN
  DUP 5 lc 0 .
  32 rnd 23 lc 1 .
  0 scroll
  DUP 5 scr 0 = WHILE
  30 sleep
  inkey
  DUP 28 = IF SWAP 1 - SWAP THEN
  DUP 29 = IF SWAP 1 + SWAP THEN
  DROP
REPEAT
		
Robot controlling
BEGIN
  33 out 1000 sleep
  18 out 1000 sleep
REPEAT
		

FORTH Words

[[ ver 0.3.0 ]]
* BEGIN / WHILE / REPEAT
* IF / ELSE / THEN
* DUP, DROP, SWAP, OVER, ROT
* +, -, *, /, =, <, >
* ., .s
* Words for the board:
   led ( onoff -- )         \ on/off the LED. [onoff:0,1]
   btn ( -- onoff )         \ get the Button status. [onoff:0,1]
   in ( port -- onoff )     \ get from the GPIO-IN ports. [port:1,2,3,4]
   ana ( port -- val )      \ get from the GPIO-Analog input. [port:0,2]
   out ( bits -- )          \ set the GPIO-OUT ports. [bits:000000-111111](specify the 'bits' by decimal)
   pwm ( port, usec -- )    \ set the PWM hi-time usec.
   pwmt ( usec -- )         \ set the PWM period usec.
   cls ( -- )               \ clear the screen
   lc ( x y -- )            \ locate the screen cursor.
   scr ( x y -- char )      \ get the screen charactor.
   sleep ( msec -- )        \ sleep msec.
   dsleep ( msec -- )       \ deep sleep msec. [msec:1000-]
   inkey ( -- key )         \ get key from the keyboard.
   rnd ( max -- val )       \ get a random number.
   tick ( -- msec )         \ get the timer count from system booted.
   scroll ( dir -- )        \ scroll the screen. [dir:0,1,2,3]
   rscroll ( dir -- )       \ scroll the screen rotately. [dir:0,1,2,3]
   video ( onoff -- )       \ set screen mode. [onoff:0,1,2,3]
   input ( -- val )         \ get a number from user input.
   bps ( rate -- )          \ set the uart serial bps. (default:115,200)
   uartw ( char -- )        \ send 1 byte to uart.
   uartr ( -- char )        \ receive 1 byte from urat.
   exit ( code -- )         \ exit from this process.
   envw ( val -- )          \ set OS-env number.
   envr ( -- val )          \ get OS-env number.
   (** These Words specification may change in the future. **)

[[ ver 0.4.0 ]]
*[add] '\' comment
*[add] 'VARIABLE', '!', '@'
*[add] ':', ';' with '(',')'
*[mod] minus literal number supported
	

Download

ichigoforth.dj.0.4.0.us.hex (in facebook group)

How to install?

See here.

How to use?

See IchigoLatte JavaScript Reference for OS and lash usage.
See here to use without NTSC tv and PS/2 keyboard.

Where to get the IchigoJam board?

See here.