rrq/jonasforth.git
4 years agoSeparate example code from sys.f and add build instructions
Jonas Hvid [Fri, 6 Mar 2020 13:12:18 +0000 (14:12 +0100)]
Separate example code from sys.f and add build instructions

4 years agoAdd support for comments
Jonas Hvid [Tue, 10 Dec 2019 17:40:58 +0000 (18:40 +0100)]
Add support for comments

4 years agoReimplement HELLO in Forth
Jonas Hvid [Tue, 10 Dec 2019 17:21:41 +0000 (18:21 +0100)]
Reimplement HELLO in Forth

This implementation is a bit awkward right now, but we should be able to clean
it up later.

4 years agoImplement looping words and add fibonacci example
Jonas Hvid [Tue, 10 Dec 2019 15:58:14 +0000 (16:58 +0100)]
Implement looping words and add fibonacci example

4 years agoDefine ELSE
Jonas Hvid [Tue, 10 Dec 2019 15:28:35 +0000 (16:28 +0100)]
Define ELSE

4 years agoDefine IF and THEN
Jonas Hvid [Tue, 10 Dec 2019 15:26:36 +0000 (16:26 +0100)]
Define IF and THEN

4 years agoAdd error handling to parse_number
Jonas Hvid [Tue, 10 Dec 2019 14:51:24 +0000 (15:51 +0100)]
Add error handling to parse_number

4 years agoFix bug in interface of parse_number
Jonas Hvid [Tue, 10 Dec 2019 14:36:11 +0000 (15:36 +0100)]
Fix bug in interface of parse_number

This procedure did not actually do what it claimed to be doing. It just happened
to work with the way it was called.

4 years agoImplement some arithmetic words
Jonas Hvid [Mon, 9 Dec 2019 17:09:38 +0000 (18:09 +0100)]
Implement some arithmetic words

4 years agoDefine ':' and ';' in Forth
Jonas Hvid [Sun, 8 Dec 2019 20:51:08 +0000 (21:51 +0100)]
Define ':' and ';' in Forth

4 years agoSupport compilation mode in INTERPRET
Jonas Hvid [Sun, 8 Dec 2019 18:28:29 +0000 (19:28 +0100)]
Support compilation mode in INTERPRET

Now we can do

  S" BOOP" CREATE ] DOCOL HELLO 3 2 + .U NEWLINE EXIT [ BOOP

4 years agoAdd space for immediate flag
Jonas Hvid [Sun, 8 Dec 2019 17:32:21 +0000 (18:32 +0100)]
Add space for immediate flag

We don't actually use this for anything yet.

4 years agoImplement CREATE
Jonas Hvid [Fri, 6 Dec 2019 13:48:12 +0000 (14:48 +0100)]
Implement CREATE

We can now do stuff like:

  S" 3HELLO" CREATE
  S" DOCOL" FIND >CFA ,
  S" HELLO" FIND >CFA ,
  S" HELLO" FIND >CFA ,
  S" HELLO" FIND >CFA ,
  S" EXIT" FIND >CFA ,
  3HELLO

4 years agoImplement ','
Jonas Hvid [Fri, 6 Dec 2019 12:37:07 +0000 (13:37 +0100)]
Implement ','

4 years agoAdd variables 'LATEST' and 'HERE'
Jonas Hvid [Fri, 6 Dec 2019 12:30:54 +0000 (13:30 +0100)]
Add variables 'LATEST' and 'HERE'

These will be used for compilation.

4 years agoAutomatically parse integers in INTERPRET
Jonas Hvid [Tue, 3 Dec 2019 18:54:21 +0000 (19:54 +0100)]
Automatically parse integers in INTERPRET

4 years agoImplement '!' and '@' commands and add 'STATE' variable
Jonas Hvid [Tue, 3 Dec 2019 18:35:51 +0000 (19:35 +0100)]
Implement '!' and '@' commands and add 'STATE' variable

4 years agoRefactor: Create INTERPRET word
Jonas Hvid [Tue, 3 Dec 2019 18:28:17 +0000 (19:28 +0100)]
Refactor: Create INTERPRET word

(We will probably want to write this in assembly when we add more
functionality.)

4 years agoMove some assembly functions to separate module
Jonas Hvid [Sat, 30 Nov 2019 17:35:28 +0000 (18:35 +0100)]
Move some assembly functions to separate module

4 years agoRemove some unused code
Jonas Hvid [Sat, 30 Nov 2019 15:48:44 +0000 (16:48 +0100)]
Remove some unused code

4 years agoSupport executing words that the user enters
Jonas Hvid [Sat, 30 Nov 2019 15:47:04 +0000 (16:47 +0100)]
Support executing words that the user enters

4 years agoAdd metadata to all words using macro
Jonas Hvid [Mon, 25 Nov 2019 19:26:48 +0000 (20:26 +0100)]
Add metadata to all words using macro

4 years agoImplement FIND
Jonas Hvid [Mon, 25 Nov 2019 19:01:49 +0000 (20:01 +0100)]
Implement FIND

I could only be bothered to add some of the words to the dictionary in this
commit. We should probably have a macro for that.

4 years agoImplement word for reading numbers
Jonas Hvid [Sat, 23 Nov 2019 18:07:30 +0000 (19:07 +0100)]
Implement word for reading numbers

4 years agoImplement .U
Jonas Hvid [Sat, 23 Nov 2019 17:00:05 +0000 (18:00 +0100)]
Implement .U

4 years agoAlso implement BRANCH
Jonas Hvid [Sat, 23 Nov 2019 16:21:29 +0000 (17:21 +0100)]
Also implement BRANCH

I feel like we should theoretically be able to implement this in terms of
0BRANCH, but since we don't have a mechanism for getting the "outer" value of
RSI inside the function, we can't just implement it as

  : BRANCH 0 0BRANCH ;

In that case, RSI would point to EXIT when executing 0BRANCH.

4 years agoRename TYPE to TELL
Jonas Hvid [Sat, 23 Nov 2019 16:07:01 +0000 (17:07 +0100)]
Rename TYPE to TELL

This is what jonesforth uses, so we'll use the same convention.

4 years agoImplement 0BRANCH
Jonas Hvid [Sat, 23 Nov 2019 16:05:32 +0000 (17:05 +0100)]
Implement 0BRANCH

4 years agoAdd comments to Forth words that we expect to keep
Jonas Hvid [Thu, 21 Nov 2019 21:55:59 +0000 (22:55 +0100)]
Add comments to Forth words that we expect to keep

4 years agoImplement and use LIT
Jonas Hvid [Thu, 21 Nov 2019 21:11:42 +0000 (22:11 +0100)]
Implement and use LIT

4 years agoImplement READ_WORD
Jonas Hvid [Thu, 21 Nov 2019 18:12:47 +0000 (19:12 +0100)]
Implement READ_WORD

4 years agoImplement TYPE
Jonas Hvid [Thu, 21 Nov 2019 17:32:27 +0000 (18:32 +0100)]
Implement TYPE

4 years agoChange indentation to use 2 spaces
Jonas Hvid [Thu, 21 Nov 2019 17:23:14 +0000 (18:23 +0100)]
Change indentation to use 2 spaces

4 years agoAdd notes on IO and compilation
Jonas Hvid [Tue, 19 Nov 2019 18:50:13 +0000 (19:50 +0100)]
Add notes on IO and compilation

4 years agoAdd list of built-in variables
Jonas Hvid [Mon, 18 Nov 2019 17:47:55 +0000 (18:47 +0100)]
Add list of built-in variables

4 years agoTerminate program correctly
Jonas Hvid [Mon, 18 Nov 2019 17:23:37 +0000 (18:23 +0100)]
Terminate program correctly

4 years agoRemove unused code
Jonas Hvid [Mon, 18 Nov 2019 17:08:20 +0000 (18:08 +0100)]
Remove unused code

4 years agoAdd extension to notes file
Jonas Hvid [Mon, 18 Nov 2019 16:49:25 +0000 (17:49 +0100)]
Add extension to notes file

4 years agoAdd somewhat working hello world
Jonas Hvid [Sat, 16 Nov 2019 20:24:30 +0000 (21:24 +0100)]
Add somewhat working hello world

We exit by segfaulting, which is not very elegant.

4 years agoImplement basic return stack
Jonas Hvid [Thu, 14 Nov 2019 17:47:05 +0000 (18:47 +0100)]
Implement basic return stack

4 years agoAdd notes on how literals are handled
Jonas Hvid [Thu, 14 Nov 2019 17:28:11 +0000 (18:28 +0100)]
Add notes on how literals are handled

4 years agoAdd documentation describing how definitions are stored
Jonas Hvid [Thu, 14 Nov 2019 17:24:35 +0000 (18:24 +0100)]
Add documentation describing how definitions are stored

4 years agoImplement "next" macro and add related notes
Jonas Hvid [Thu, 14 Nov 2019 17:03:42 +0000 (18:03 +0100)]
Implement "next" macro and add related notes

4 years agoAdd notes about dictionary
Jonas Hvid [Thu, 14 Nov 2019 16:32:21 +0000 (17:32 +0100)]
Add notes about dictionary

4 years agoHello world in FASM
Jonas Hvid [Wed, 13 Nov 2019 20:53:45 +0000 (21:53 +0100)]
Hello world in FASM