emacs ----- * set the compile command to "tail -f cat.log" to use compilation-mode for easy error navigation. naming conventions ------------------ * a 'word' is a single (named) code entity in a compositional language. the strict meaning in CAT is the element of a program = list of words. in PURRR/18, a word refers to a code address, in PURRR a word refers to a primitive address (execution token), and a program is an array of words (run token). * a procedure (or function) is a scheme code entity. * words prefixed with '_' (underscore) refer to double wordlength operations. each underscore doubles the wordlength. * '>' and '<' in names indicate linear data motion (not copying!). ex: '>r' * '->' and '<-' in names indicate data conversion. * '>>' and '<<' are named SHIFT RIGHT/LEFT and indicate bit shifts. * '>>>' and '<<<' shift n bits (word n -- shifted) * words/procedures prefixed with '~' (tilde) implement the core part of something, missing some (shared) preprocessing step. * a->xxx and f->yyy set the current RAM and FLASH ROM pointers to some object. strings ------- i am using 'Pascal strings', instead of NULL terminated 'C strings'. pro/con : + can contain arbitrary bytes (no speciall NULL byte) + only require a single pass when length needs to be known - limited size on a small chip like a pic buffers are usually small, so it makes sense to design code so the limited size is not a problem. this will greatly simplify code. strings stored in flash memory are accessed using the 'f' register (TBLPTR). this register can be understood as the 'current flash object register'. suppose f points to a string, performing an operation on a string is then simply: : xxx-string @f++ for @f++ xxx next ; where 'xxx' consumes one byte of the string.