diff options
| -rw-r--r-- | jefs.fs | 4 | ||||
| -rw-r--r-- | readme.md | 49 |
2 files changed, 9 insertions, 44 deletions
@@ -147,7 +147,6 @@ decimal : ?comp state @ 0<> if 3 error ! handler execute then ; : ?intr state @ if 4 error ! handler execute then ; - hex : >word ffff and ; : >byte ff and ; @@ -382,8 +381,6 @@ termios TCGETS stdin ioctl ( noname ) swap execute value tty \ DUMP {{{ \ it's designed to look like xxd. i like xxd's hex dumps. hex -\ blorken -\ is my if broken or is this? : dump-colour ( c -- n ) dup 0= if white else dup 0a = if yellow else dup 20 < if red else @@ -391,7 +388,6 @@ hex dup ff < if red else blue then then then then then nip ; -\ also blorken : dump-char ( c -- c' ) dup 20 < if drop [ char . ] literal else dup 7e >= if drop [ char . ] literal then then ; decimal @@ -32,6 +32,14 @@ the dictionary follows a fairly standard format. | string | variable length | still NFA | | code | variable length | CFA (code field address) | +## non-standard forth + +this does not follow any standards. here are some things to keep in mind + +- the string output word is called `say` instead of `type` (i may change this) +- `create` can't be used for arrays and stuff. use `make` instead +- `:noname` is called `:>` (based on duskos). it also just creates a word called `_` and pushes its xt to the stack + ## the one reserved register the working stack pointer is `r14`. @@ -39,19 +47,7 @@ the other registers are used as general purpose registers; `r11` in particular is the standard register used in compiling calls. -## miscellaneous notes and stuff - -### COMPILE, -this is an STC forth so when we compile a call we have to -write the bytes of a `call` in manually. -x86\_64 does not allow absolute jumps from an immediate address, -so a wonky but hopefully not too slow solution is to compile -`literal address → W` and then `call W`. It'll Be Fine? - -- `mov r11, [cfa]` = `94 BB [CFA]` -- `call r11` = `41 FF D3` - -### Some Links +## Some Links - jonesforth, public domain forth tutorial implementation which was significantly cribbed from and studied: http://git.annexia.org/?p=jonesforth.git;a=tree - jonesforth nasm port: http://ratfactor.com/repos/nasmjf/ @@ -60,33 +56,6 @@ so a wonky but hopefully not too slow solution is to compile - page describing `<BUILDS`: https://amforth.sourceforge.net/TG/recipes/Builds.html - page describing pictured numeric output: http://www.jimbrooks.org/web/forth/forthPicturedNumericOutput.php -## silly little plans - -### in-forth assembler -this would reap the most benefits from STC. -probably look at dusk's assemblers for how it should look like -or liek something liek dusk's lib/bm? -idk something to do stuff Fast if u need. would be fun - -### DOES> -ah yes, the infamous `DOES>`. i don't have a DOCOL segment so i'm not -sure how exactly to implement this? - -https://news.ycombinator.com/item?id=44231594 top comment here discusses -the forth `<BUILDS` which i've never heard of elsewhere. in fact if i look up -`forth "<BUILDS"` on duckduckgo that link is the only result. -i debased myself and looked it up on google too, and found a few more results. -maybe i can do something with that because i like `DOES>` and i wanna use it - -maybe this sucks shit but my idea is that i compile in a relative jmp with -`<BUILDS` and fill it in with `DOES>` - -### PNO -'pictured numeric output'. its forth's numeric output functionality. -note that this forth doesn't have double numbers -(i don't think it's necessary, since cells are 64 bit) -so PNO works on single cell values. - ## error codes in order to have Good Error Handling anywhere, the error handler's xt is stored in the `handler` variable and is then called by loading its value |
