. .. ... The Syntiac Pages ... .. .
[Home] [Synthesizers] [Software Proj] [Hardware Proj] [Pinball]
   |
[Games] [PerlWeb] [4Tron] [MPForth] [Video Compression]

   |
[About] [Language] [Developers] [i386] [6502] [Research] [Ideas] [Download]


4Tron

Programming techniques and rules


This page contains detailed information for developers working in the 4Tron environment.

Keep in mind that the system is work in progress so the specifications will change in time.


Writing good Forth code for running under the 4Tron compiler is like an art. It isn't something which happens automatically. 4Tron allowes the creation of very small and fast software systems. The system runs on almost everything which has a microprocessor and allows your software to run unchanged on all platforms supported. Because most of these systems are low-end a few restrictions are placed on the 4tron system. Keeping these restrictions in mind and utilising the features offered by the 4Tron system will enable you to run large application on (very) small systems. The system is fully open and enables custimisation of the system to a far extend, without damaging compatiblity. Ofcourse the system must be fully understood before changes can be made to the kernel. Therefore these pages will try to help explain the ideas behind the implementations and choices made.


The 4TrOn playing rules


Type definitions and stack comments

bByte wide valueB, B@ B!
dDouble cell wide valuestack comment
fFloating point numberF* F/MOD F- F+ FNEG
wCell (word) wide valueW,

Missing words in 4TrOn

+! ( n a -- ; add n to cell at address a )
Looks quite usefull, but until now I never used it in actual code.

ROT -ROT 2DUP 2OVER 2SWAP 2ROT
Don't put too much on the data-stack. For example 2ROT deals with 6 stack positions at a time! ROT and -ROT might come in handy, but effective use of the return-stack will fix most problems. The 2OVER and 2SWAP routines can be used when working with double numbers, but I would call them DOVER and DSWAP then... For the last one, do : 2DUP OVER' OVER' ; if you need it.

DEPTH ( -- n )
Can somebody tell me why this word is in the CORE, instead of TOOLS wordset. Anyway try this if you need it : DEPTH SP@' NEG' SP0' +' 2/' 2/' ;



The Syntiac Pages -- www.syntiac.com
For website questions mail to: webmaster@syntiac.com
"/4tron_developers" is last updated on Mon Nov 3 01:03:08 2003