Compare commits

..

No commits in common. "274376a5de644fb368a5ed212a928a953cf5a8db" and "f91fa39aefc0a82391e42e4d9a72a2917acde4d5" have entirely different histories.

2 changed files with 13 additions and 35 deletions

View File

@ -1,9 +1,8 @@
;; Note that this is scheme syntax wrapping asm for a stack machine
(variable eol 0)
(variable eom 1024)
;; These need to be initialized with the runtime
(variable scan 0)
(variable free 0)
;; These need to be initialized with the runtime
(variable eom 0)
(variable old 0)
(variable new 0)
(variable root 0)
@ -50,13 +49,9 @@ gc-run ;; ( -- )
(call)
; Flip old and new
(ref old)
(dup)
(ref new)
(set! old)
(set! new)
(push 512)
(+)
(set! eom)
(return)
relocate-cons ;; (o -- )
@ -71,19 +66,19 @@ relocate-cons ;; (o -- )
relocate-reg ;; (r -- )
(dup)
(push #x80000000) ;; Is this a cons?
(and)
(push cons?)
(call)
(push reg-relocated)
(if)
(dup)
(ref eol)
(=) ;; Is this eol?
(push eol?)
(call)
(not)
(push reg-relocated)
(if)
(dup)
(push #x40000000) ;; Is it a broken heart?
(and)
(push broken-heart?)
(call)
(push copy-and-construct)
(if)
(dup) ;; Broken heart, copy updated address from cdr
@ -107,14 +102,9 @@ copy-and-construct
(push 4)
(+)
(!)
(push #x40000000)
(over)
(!)
(ref free)
(over)
(push 4)
(+)
(!)
(dup) ;; Construct the broken heart
(push install-broken-heart)
(call)
(ref free) ;; Move free pointer
(push 8)
(+)
@ -122,17 +112,5 @@ copy-and-construct
reg-relocated
(drop)
(return)
main
;; These need to be initialized with the runtime
(push memory)
(dup)
(set! new)
(push 512)
(+)
(dup)
(set! eom)
(set! old)
;; TODO set up root
memory
;; TODO

View File

@ -164,7 +164,7 @@
(define ram-word-set! (cute vm-memory-set! vm <> <>))
(define debugger (vm-debugger vm))
(define exit? #f)
(define (jump x) (vm-pc-set! vm (logand #x2fffffff x)))
(define (jump x) (vm-pc-set! vm x))
(define (fetch-byte)
(let ([byte (ram-byte-ref (vm-pc vm))])
(vm-pc-set! vm (+ (vm-pc vm) 1))