summary |
shortlog | log |
commit |
commitdiff |
tree
first ⋅ prev ⋅ next
Jonas Hvid [Mon, 5 Oct 2020 01:38:54 +0000 (03:38 +0200)]
Implement UTF16" to store UEFI-compatible string
Jonas Hvid [Mon, 5 Oct 2020 01:33:07 +0000 (03:33 +0200)]
Support calling EFI functions directly from Forth
Obviously, this doesn't work with the Linux backend. Maybe we'll have to remove
that again, since it would basically require a UEFI emulator.
Jonas Hvid [Mon, 5 Oct 2020 00:33:04 +0000 (02:33 +0200)]
Add startup.nsh to QEMU drive
This reduces the amount of typing that we have to do. Now the UEFI application
automatically runs on startup.
Jonas Hvid [Sun, 4 Oct 2020 01:08:51 +0000 (03:08 +0200)]
Add alternative Linux backend
You can now run:
make main && ./main
To run the interpreter without needing to boot up a virtual machine.
Note that this mode uses per-line buffering by default, so you may have to press
enter where you would normally only need a space.
Jonas Hvid [Sun, 4 Oct 2020 01:07:25 +0000 (03:07 +0200)]
Implement Linux backend
You can now run:
make main && ./main
To run the interpreter without needing to boot up a virtual machine.
Note that this mode uses per-line buffering by default, so you may have to press
enter where you would normally only need a space.
Jonas Hvid [Sun, 4 Oct 2020 00:14:04 +0000 (02:14 +0200)]
Add placeholder implementation of Linux backend
Jonas Hvid [Sun, 4 Oct 2020 00:02:42 +0000 (02:02 +0200)]
Clean up OS interface
We got rid of those weird macros that would try to preserve a bunch of registers
for no reason. The OS interface was changes slightly to allow for simpler
implementation and usage.
Jonas Hvid [Sat, 3 Oct 2020 23:40:36 +0000 (01:40 +0200)]
Rename UEFI procedures to generic naming scheme
Jonas Hvid [Sat, 3 Oct 2020 23:25:48 +0000 (01:25 +0200)]
Supply UEFI module path as environment variable
We'd like to have multiple backends -- e.g. Linux instead of UEFI. That would
make testing less cumbersome.
Also remove an outdated comment.
Jonas Hvid [Sat, 3 Oct 2020 23:06:21 +0000 (01:06 +0200)]
Make S" work inside compiled words
The approach we're using here is kinda silly and cause by the fact that I
wasn't/still aren't very familiar with Forth outside of trying to implement it
myself.
From doing a bit of reading, it sounds like S" is primarily intended to be used
inside definitions -- not at runtime. So now we use the old, weird S" (that has a
single static buffer and only works at runtime) to bootstrap the system, then
replace it with a more sensible S" that only works at compile time.
Jonas Hvid [Sat, 3 Oct 2020 22:33:07 +0000 (00:33 +0200)]
Implement '\'-style comments
Jonas Hvid [Sat, 3 Oct 2020 18:32:39 +0000 (20:32 +0200)]
Implement the 'KEY' primitive for user input
This is a lower-level primitive for getting user input. We now also use this to
implement READ-WORD.
Jonas Hvid [Sat, 3 Oct 2020 17:15:36 +0000 (19:15 +0200)]
Clarify some explanations in the README
Jonas Hvid [Sat, 25 Apr 2020 23:41:54 +0000 (01:41 +0200)]
Update README with link to UEFI tutorial
Jonas Hvid [Fri, 20 Mar 2020 18:32:15 +0000 (19:32 +0100)]
Add instructions for running on real hardware
Jonas Hvid [Sat, 14 Mar 2020 20:38:43 +0000 (21:38 +0100)]
Improve build instructions in README
Jonas Hvid [Mon, 9 Mar 2020 16:22:19 +0000 (17:22 +0100)]
Handle newlines (in both input and output)
Jonas Hvid [Mon, 9 Mar 2020 16:01:33 +0000 (17:01 +0100)]
Show the user's input on screen as they are typing
Jonas Hvid [Mon, 9 Mar 2020 14:13:34 +0000 (15:13 +0100)]
Make it run on UEFI!
The program is now usable, albeit barely, running inside QEMU, with the only
dependency being UEFI! Very cool!
Right now, no output is printed to the screen when you type characters, newlines
aren't printed correctly, and the program doesn't accept Enter as valid
whitespace when reading input.
Jonas Hvid [Mon, 9 Mar 2020 13:50:45 +0000 (14:50 +0100)]
Get rid of remaining "loose" syscalls
Jonas Hvid [Mon, 9 Mar 2020 13:41:33 +0000 (14:41 +0100)]
Remove old code from example.f
Jonas Hvid [Mon, 9 Mar 2020 13:34:34 +0000 (14:34 +0100)]
Improve README and update information about sys.f
Jonas Hvid [Sun, 8 Mar 2020 18:32:16 +0000 (19:32 +0100)]
Finish implementing embedded sys.f
OK, this works... barely!
We have to omit the final newline in sys.f for it to work. We should probably
take another look at that.
But, it does technically work: We can now run just ./main, and the sys.f file
will be run automatically from inside the program. Very cool!
Jonas Hvid [Sun, 8 Mar 2020 18:17:02 +0000 (19:17 +0100)]
Use a different approach to reading from buffers
We now store INPUT-BUFFER as a global variable. Words like S" and READ-WORD
automatically use this INPUT-BUFFER if it's available.
Our program currently segfaults on startup, which is probably because of at
least one of the following:
1. We don't handle the case where an input buffer ends in whitespace in
INTERPRET-STRING.
2. We don't do anything to resume reading from user input when the buffer has
been exhausted.
Jonas Hvid [Sun, 8 Mar 2020 17:42:47 +0000 (18:42 +0100)]
Implement BUF"
This still doesn't actually work, because our definition of : doesn't make sense
when we're reading input from the buffer.
Jonas Hvid [Sun, 8 Mar 2020 17:12:07 +0000 (18:12 +0100)]
Implement INTERPRET-STRING
INTERPRET-STRING works, but the program crashes on startup, because sys.f uses
words that assume that they are being run with user input, for example S" and
READ-WORD.
Jonas Hvid [Sun, 8 Mar 2020 14:48:18 +0000 (15:48 +0100)]
Implement POP-WORD
Jonas Hvid [Sun, 8 Mar 2020 14:27:49 +0000 (15:27 +0100)]
Embed sys.f into binary and start working on POP-WORD
Jonas Hvid [Sun, 8 Mar 2020 13:57:05 +0000 (14:57 +0100)]
Refactor INTERPRET so we also have INTERPRET-WORD
Jonas Hvid [Sun, 8 Mar 2020 13:39:22 +0000 (14:39 +0100)]
Add notes about loading files from disk
Jonas Hvid [Sun, 8 Mar 2020 13:19:27 +0000 (14:19 +0100)]
Move some Forth words to separate 'bootstrap.asm' file
Jonas Hvid [Sat, 7 Mar 2020 19:08:13 +0000 (20:08 +0100)]
Move printing syscall to a macro
This will allow us to more easily replace it with the UEFI
implementation.
Jonas Hvid [Sat, 7 Mar 2020 18:30:40 +0000 (19:30 +0100)]
Add syntax=fasm to FASM files
Jonas Hvid [Sat, 7 Mar 2020 17:18:54 +0000 (18:18 +0100)]
Implement subroutine to read character
Jonas Hvid [Sat, 7 Mar 2020 16:33:41 +0000 (17:33 +0100)]
Implement a subroutine to print a byte-string of a given length
Jonas Hvid [Fri, 6 Mar 2020 17:15:15 +0000 (18:15 +0100)]
Add "Hello world" UEFI application
Jonas Hvid [Fri, 6 Mar 2020 13:44:09 +0000 (14:44 +0100)]
Set up QEMU and add some notes on UEFI
Jonas Hvid [Fri, 6 Mar 2020 13:12:18 +0000 (14:12 +0100)]
Separate example code from sys.f and add build instructions
Jonas Hvid [Tue, 10 Dec 2019 17:40:58 +0000 (18:40 +0100)]
Add support for comments
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.
Jonas Hvid [Tue, 10 Dec 2019 15:58:14 +0000 (16:58 +0100)]
Implement looping words and add fibonacci example
Jonas Hvid [Tue, 10 Dec 2019 15:28:35 +0000 (16:28 +0100)]
Define ELSE
Jonas Hvid [Tue, 10 Dec 2019 15:26:36 +0000 (16:26 +0100)]
Define IF and THEN
Jonas Hvid [Tue, 10 Dec 2019 14:51:24 +0000 (15:51 +0100)]
Add error handling to 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.
Jonas Hvid [Mon, 9 Dec 2019 17:09:38 +0000 (18:09 +0100)]
Implement some arithmetic words
Jonas Hvid [Sun, 8 Dec 2019 20:51:08 +0000 (21:51 +0100)]
Define ':' and ';' in Forth
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
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.
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
Jonas Hvid [Fri, 6 Dec 2019 12:37:07 +0000 (13:37 +0100)]
Implement ','
Jonas Hvid [Fri, 6 Dec 2019 12:30:54 +0000 (13:30 +0100)]
Add variables 'LATEST' and 'HERE'
These will be used for compilation.
Jonas Hvid [Tue, 3 Dec 2019 18:54:21 +0000 (19:54 +0100)]
Automatically parse integers in INTERPRET
Jonas Hvid [Tue, 3 Dec 2019 18:35:51 +0000 (19:35 +0100)]
Implement '!' and '@' commands and add 'STATE' variable
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.)
Jonas Hvid [Sat, 30 Nov 2019 17:35:28 +0000 (18:35 +0100)]
Move some assembly functions to separate module
Jonas Hvid [Sat, 30 Nov 2019 15:48:44 +0000 (16:48 +0100)]
Remove some unused code
Jonas Hvid [Sat, 30 Nov 2019 15:47:04 +0000 (16:47 +0100)]
Support executing words that the user enters
Jonas Hvid [Mon, 25 Nov 2019 19:26:48 +0000 (20:26 +0100)]
Add metadata to all words using macro
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.
Jonas Hvid [Sat, 23 Nov 2019 18:07:30 +0000 (19:07 +0100)]
Implement word for reading numbers
Jonas Hvid [Sat, 23 Nov 2019 17:00:05 +0000 (18:00 +0100)]
Implement .U
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.
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.
Jonas Hvid [Sat, 23 Nov 2019 16:05:32 +0000 (17:05 +0100)]
Implement 0BRANCH
Jonas Hvid [Thu, 21 Nov 2019 21:55:59 +0000 (22:55 +0100)]
Add comments to Forth words that we expect to keep
Jonas Hvid [Thu, 21 Nov 2019 21:11:42 +0000 (22:11 +0100)]
Implement and use LIT
Jonas Hvid [Thu, 21 Nov 2019 18:12:47 +0000 (19:12 +0100)]
Implement READ_WORD
Jonas Hvid [Thu, 21 Nov 2019 17:32:27 +0000 (18:32 +0100)]
Implement TYPE
Jonas Hvid [Thu, 21 Nov 2019 17:23:14 +0000 (18:23 +0100)]
Change indentation to use 2 spaces
Jonas Hvid [Tue, 19 Nov 2019 18:50:13 +0000 (19:50 +0100)]
Add notes on IO and compilation
Jonas Hvid [Mon, 18 Nov 2019 17:47:55 +0000 (18:47 +0100)]
Add list of built-in variables
Jonas Hvid [Mon, 18 Nov 2019 17:23:37 +0000 (18:23 +0100)]
Terminate program correctly
Jonas Hvid [Mon, 18 Nov 2019 17:08:20 +0000 (18:08 +0100)]
Remove unused code
Jonas Hvid [Mon, 18 Nov 2019 16:49:25 +0000 (17:49 +0100)]
Add extension to notes file
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.
Jonas Hvid [Thu, 14 Nov 2019 17:47:05 +0000 (18:47 +0100)]
Implement basic return stack
Jonas Hvid [Thu, 14 Nov 2019 17:28:11 +0000 (18:28 +0100)]
Add notes on how literals are handled
Jonas Hvid [Thu, 14 Nov 2019 17:24:35 +0000 (18:24 +0100)]
Add documentation describing how definitions are stored
Jonas Hvid [Thu, 14 Nov 2019 17:03:42 +0000 (18:03 +0100)]
Implement "next" macro and add related notes
Jonas Hvid [Thu, 14 Nov 2019 16:32:21 +0000 (17:32 +0100)]
Add notes about dictionary
Jonas Hvid [Wed, 13 Nov 2019 20:53:45 +0000 (21:53 +0100)]
Hello world in FASM