Skip to content

Commit

Permalink
interpreter/interp: implement Call for external functions for #1
Browse files Browse the repository at this point in the history
  • Loading branch information
pdarragh committed Jul 1, 2022
1 parent 3d37f95 commit 775da5f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions interpreter/interp.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,11 @@
#:with-registers new-registers))]
[(Call (? (curry hash-has-key? runtime) external-function))
;; call the external function
;; TODO: implement this!
(error 'step "calls of external functions not yet implemented")]
(displayln (format "registers (outside): ~v" registers))
(let* ([func (hash-ref runtime external-function)]
[result (func registers memory 0)] ; FIXME: stack pointer
[new-registers (hash-set registers 'rax result)])
(make-state #:with-registers new-registers))]
[(Call dst)
;; Mem.push(ip + wordsize)
;; ip = dst
Expand Down

0 comments on commit 775da5f

Please sign in to comment.