An open API service indexing awesome lists of open source software.

https://github.com/andreax79/go-forth


https://github.com/andreax79/go-forth

Last synced: 19 days ago
JSON representation

Awesome Lists containing this project

README

          

http://www.forth.org/Ting/Forth-for-the-Complete-Idiot/Forth-79-Handy-Reference.pdf
https://people.ece.cornell.edu/land/courses/ece5760/DE2/Stack_cpu.html

- forth
- nice syntax [OK]
- forth comments [OK]
- loop [OK]
- forth definitions [OK]
- ( ... ) comments [OK]

- assembler
- variables [OK]
- 2 pass compiler [OK]
- asciiz [OK]
- word/bytes [OK]

- bios
- compiler -> bios
- load bios
- display string/char
- read keyboard scancode (blocking)
- read keyboard scancode (non-blocking)
- read disk
- write disk
- get/size # of disks?
- get memory size?

- cpu
- mmu (virtual memory) [OK]
- short opcodes [OK]
- shift [OK]
- map registers ram?
- interrupt
- I/O

The CPU has the following instruction formats:

8 7 6 5 4 3 2 1 0
+-+-+-+-+-+-+-+-+-+
| # | |
|pop| opcode |
| | |
+-+-+-+-+-+-+-+-+-+

Push 32 bit value:

8 7 6 5 4 3 2 1 0
3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | | |
|0 0| PUSH opcode | 32 bit word |
| | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

------------------------------------------------------------------------------------------------
- call/ret ==> accesso variabili 'globali' ?
- I/O = emit
- relative jump

------------------------
Before subcall execution

- caller local var
- caller stack
- arguments
- fn addr

------------------------
During subcall execution

- caller local var
- caller stack
- arguments

- address to return <---- $data ($fp)
- value of $data in the caller
- local var
- stack <- $sp

case CALL:
cpu.mmu.WriteW(cpu.rsp, Word(cpu.rsp)) // store rsp
cpu.mmu.WriteW(cpu.rsp+1*WordSize, Word(cpu.rbp)) // store rbp
cpu.mmu.WriteW(cpu.rsp+2*WordSize, Word(cpu.pc)) // store pc
cpu.rbp = cpu.rsp + 3*WordSize
break
case RET:
cpu.pc = Addr(cpu.mmu.ReadW(cpu.rsp - 1*WordSize)) // return
cpu.rbp = Addr(cpu.mmu.ReadW(cpu.rsp - 2*WordSize)) // restore rbp
cpu.rsp = Addr(cpu.mmu.ReadW(cpu.rsp - 3*WordSize)) // restore rsp
break