• Turning on an LED

    Alexander Williams01/22/2023 at 01:26 0 comments

    I recently implemented the ability to handle HEX strings (it stores them as a 32-bit binary value) and now it's much easier to work with hardware.

    As an example, I demonstrate how to turn on the blue LED on GPIOA pin 2:

    : blue_led 0x40010800 @ 0xFFFFF0FF and 0x00000300 or 0x40010800 ! ;

    This is a very simple and inelegant solution, but it works!

    There's some documentation on how/why it works here, but essentially it boils down to:

    1. read the current GPIOA port config
    2. apply a mask to clear the 4 bits for pin 2
    3. apply the new pin 2 config
    4. store the new GPIOA port config
    5. execute the new word to turn on the blue LED

    I think this shows the merits of Forth. It's possible to easily define more robust functions (words) which for example might take some arguments from the stack (ex: GPIO port, pin number, status), and then perform calculations on those values to set the new config - which could then be used to toggle any pin, etc. As long as you know the HEX address of the memory-mapped devices, pretty much all the hardware can be controlled and configured interactively.

  • Released v0.3: bug fixes, enhancements, and docs

    Alexander Williams01/19/2023 at 13:59 0 comments

    I just release v0.3 of FiveForths which includes a few bug fixes, some useful enhancements, and lots of additional documentation.

  • Added a README and documentation

    Alexander Williams01/13/2023 at 12:41 0 comments

    As promised, I uploaded a README and some detailed documentation to GitHub. There's more information I plan on adding over time, but for the moment I think it's a good start.

  • Done!

    Alexander Williams01/06/2023 at 07:48 0 comments

    Well, I fixed the compiler and now FiveForths is fully functional!

    Check out the devlog here.

    I'll upload a README within the next few days.

  • It's almost done!

    Alexander Williams01/06/2023 at 03:59 0 comments

    When I say done, I mean "fully functional". There are still some optimizations and improvements I want to make in the future, but so far it's just about "done".

    The devlogs can be read here.

    The remaining bug is to fix the execution of compiled "colon definition" words. Once that works, the Forth will be 100% functional.

    Grab the code from GitHub and follow along.