Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

16-bit SUBLEQ CPU running eForth - just for fun

License

NotificationsYou must be signed in to change notification settings

howerj/subleq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

If you feel like supporting the project you can buy a book fromAmazon, availableherethat describes how the project works and how to port a Forth toa new platform.

This project contains a working (self-hosting) Forth interpreter that runson top of a SUBLEQ 16-bit machine. SUBLEQ machines belong to the classof One Instruction Set Computers, they only execute a single instructionbut are still Turing Complete. The Forth system, specifically a variantof eForth, is provided assubleq.dec, passing this imageto the tiny (~ 600 bytes)SUBLEQ C virtual machine allowsyou to run eForth on the machine. For a list of commands type "words"and hit enter, numbers are entered using Reverse Polish Notation, eg. "22 + . cr" prints "4", and new functions can be defined like so:

: hello cr ." Hello, World" ;

Be careful with the spaces, they matter, after typing that in, type"hello" and hit enter. A Forth tutorial will not be provided here. ManyForth words are definedincluding the bitwise words.

To build and run you will need a C compiler and Make, type "make run",failing that:

cc subleq.c -o subleq./subleq subleq.dec

The system is self hosting, that is it can generate new eForth imagesusing the current eForth image and the eForth source code. This is donelike so:

./subleq subleq.dec < subleq.fth > new-image.dec

There is a website available that runs an interactive SUBLEQ interpreterin the browser in case you do not want to both compiling things, it isavailable athttps://github.com/howerj/subleq-js. Or if you just want totry it out directlyhttps://howerj.github.io/subleq.htm.

Happy hacking, and a shiny penny for anyone that manages to do somethinguseful with this project!

Other SUBLEQ projects

References

About

16-bit SUBLEQ CPU running eForth - just for fun

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp