C++ and Forth source code.
All code is distributed under the terms of the MIT License which means that you can use and modify it for any purpose.
The code has only been tested on 32bit little-endian targets but has been designed to be word size and endian agnostic; please let me know if it doesn't work on your system.
C++ source is commented using Doxygen style comments and is formatted with tab stops every four characters.
If you have any comments, please feel free to contact me.
All C++ code below requires this header file which provides type definitions and helper macros which aren't part of standard C++.
Extensible classes for producing formated C strings.
This also contains implementation of the C standard library functions:
vsprintf, sprintf, vsnprintf and snprintf.
Classes for constructing and manipluating a bit-vector (array of bits).
This code is targeted at CPUs without hardware support for division or floating point. It has been optimised for ARM CPUs but should be suitable for other RISC architectures.
32 bit fixed-point maths implementation, including multiplication, division, square-root, trigonometric and logarithm functions.
Routines for handling 3 dimensional points, vectors and matrices. This uses the Fixed-Point Maths routines above.
An implementation of ITU-T (formerly CCITT) Recommendation G711 "Pulse Code Modulation (PCM) of Voice Frequencies"
An implementation of ITU-T (formerly CCITT) Recommendation G726 "40, 32, 24, 16 kbit/s Adaptive Differential Pulse Code Modulation (ADPCM)"
This code optionally contains two deliberate bugs in the COMPRESS function
which were added so the code passes the G726 test sequences. It seems that
the standard implementation in G191 also contains these bugs.
Also requires source for G711
An implementation of the IMA ADPCM audio coding algorithm.
Simple class for using serial ports.
Y-Modem (and X-Modem) file transfer protocol. The receive and transmit code is separated into two classes which reduces memory size when only one of these functions is required. The code uses the Serial Port routines above.
Below is source for a command-line program for Y-Modem file transfer. This acts as a test program for the Y-Modem implementation and is a useful utility in its own right. It also supports receiving a 'log' after transmitting files; this can be used when sending a file to a development board and receiving instrumentation output which comes back on same port.
ANS Forth virtual machine written in C++. This is a token threaded implementation which contains the ANS Core words plus a few extra words from other wordsets. It doesn't make use of any C library functions, and so should compile to stand-alone code suitable for embedding in other programs.
Forth source code is also available to implement additional ANS wordsets...
SEE.)
Test code for all implemented wordsets...
ARM Assembler and Disassembler written in Forth. These support all ARM architectures up to and including Version 6.
The assembler syntax closely follows standard ARM format and includes support for labels.
2009-12-30
2009-10-09
2009-10-02
EXPORT and IMPORT macros which
were used to manage symbol visability when making Windows style DLLs.
AssertFailed.
select() rather than hand rolled polling and sleeping.
QUIT — the WHILE branch
in XT_DO_QUIT was jumping one token to far, which would produce
unpredicable results if REFILL returned false.
StdForthIo, to use standard
Posix functions rather than Microsoft's conio.h.
ForthVM::Accept to accept alternative keys for backspace
(0x08 and 0x7F) and input end (0x0a and 0x0d).
ASSERT_DEBUG.
2007-08-18
2007-05-28
THROW handling into new member function ForthVM::UncaughtException.
This improves the code generated by GCC.
2007-01-13
offsetof to work on GGC 4, also added global placement new operator.
2006-11-09
2006-09-02
2006-06-04
FIX_USE_64BIT_MUL and FIX_UNROLL_DIV_LOOP macros in
maths/fix.cpp)
2006-05-31
2006-05-20
uint8 with uint8_t,
and made use of size_t.
2006-04-14
2005-12-27
sizeof(CELL) was greater than sizeof(CELL*).
C" (forth/core-ext.f)
which manifested when the size of a CHAR was not one address unit.
L: word in the ARM Assembler.
2005-12-26
2005-08-20
2005-03-02
Vector3::Normal faster.
2005-03-01
Vector3::Normal
so that it copes with vectors of any magnitude.
Vector3.
2005-02-27
2005-02-26
Fix::Random()
to Fixed-Point Maths routines.
2005-02-18
2005-02-13
2005-02-08
2005-02-07
Fix::Sqrt(0) to return 0x0000.0001.