scotws / TaliForth2

A Subroutine Threaded Code (STC) ANS-like Forth for the 65c02
Other
86 stars 23 forks source link

Added based-constants and character constants #262

Closed SamCoVT closed 3 years ago

SamCoVT commented 3 years ago

ANS2012 requires the recognition of the following constants:

#1234 - a decimal number $1234 - a hexadecimal number %1010 - a binary number 'W' - a character constant

NUMBER now pushes the base at the beginning, modifies the base if appropriate, processes the number like before (including negative signs and a . on the end for a double), and restores the base at the end. Character constants are handled directly by putting the ASCII value on the stack as a single. Not all characters can be used as caracter constants (eg. ' ' for a space will not work and there are no escaped characters supported so no way to get a newline - use a hex/dec/bin constant instead for those situations)

Tests have been added to the core_c.fs file to test positive/negative single/double based numbers in both decimal and hex modes, as well as a few select character constants.

Note: Because there are other outstanding pull requests, the taliforth-py65mon.bin and listings in /docs were not included in this pull request. Just issue a "make" (or "make -B" to guarantee everything is rebuilt) after this has been merged and then push the result. A "make tests" before pushing might be in order as well, just to double check.