diff options
author | Ekaitz Zarraga <ekaitz@elenq.tech> | 2022-07-19 15:41:28 +0200 |
---|---|---|
committer | Ekaitz Zarraga <ekaitz@elenq.tech> | 2022-07-19 15:41:28 +0200 |
commit | 95b1e787db0b31834e79c0a5186c1fa571b3c613 (patch) | |
tree | 0ea4ea71f3449d3a65bc73c5cc20d426c5f791cf | |
parent | 279d03cdb8ca420ffc09b5eccf09c59eb46e9d02 (diff) |
Simplify the instruction load and execution process
This makes the process a little bit lighter, but it doesn't have a huge
impact in the performance. Looks like we are avoiding a memory
allocation without the `values` call.
-rw-r--r-- | bytepusher.scm | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/bytepusher.scm b/bytepusher.scm index 1be1365..1182f48 100644 --- a/bytepusher.scm +++ b/bytepusher.scm @@ -168,20 +168,11 @@ (bytevector-copy! program 0 memory 0 (bytevector-length program)))))) (define (execute! instruction-addr) - (call-with-values - (lambda () (load-instruction instruction-addr)) - (lambda (a b c) - (set-byte! b (get-byte a)) - c))) - -(define (load-instruction instruction-addr) (let ((a (get-addr (+ 0 instruction-addr))) (b (get-addr (+ 3 instruction-addr))) (c (get-addr (+ 6 instruction-addr)))) - #;(display (string-append "a: " (number->string a 16) " ")) - #;(display (string-append "b: " (number->string b 16) " ")) - #;(display (string-append "c: " (number->string c 16) "\n")) - (values a b c))) + (set-byte! b (get-byte a)) + c)) (define (loop-frame!) (let loop ((count 65536) |