diff options
Diffstat (limited to 'readme.md')
| -rw-r--r-- | readme.md | 27 |
1 files changed, 20 insertions, 7 deletions
@@ -5,18 +5,31 @@ if you use it and it breaks, too bad public domain -the plan right now is that this will be a DTC forth. -while an STC forth would be nice -(being able to mix assembly and forth would be nice) -having to manually compile in bytes would be annoying. -maybe one day i will do an STC forth... +the plan right now is that this will be an STC forth. +if this proves Too Complicated To Deal With the plan may be changed +to a DTC forth instead. ## forth registers there are a set of 'virtual registers' (see moving forth part 1) - W, the working register, is r11. - X, the secondary working register, is r12. -- IP, the instruction pointer, is r13. +- IP, the instruction pointer, is r13. (this will only be needed if we switch to DTC, otherwise this can be Y, a third general purpose register) - SP, the working stack pointer, is r14. -- RSP, the return stack pointer, is rsp. - TOS, the top of the stack, is r15. +- RSP, the return stack pointer, is rsp. + +on SP (r14): note that since TOS is kept in a register, +SP points to the *second* item in the stack. + +## 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` |
