From d34374858d5d0873ac7ff8caebc464cfc14240c5 Mon Sep 17 00:00:00 2001 From: able Date: Fri, 3 May 2024 14:18:42 -0500 Subject: [PATCH] consistent asm stuffs --- examples/asm.lisp | 11 ++++++++++- examples/log.lisp | 11 ++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/examples/asm.lisp b/examples/asm.lisp index 8b7d499..4c68134 100644 --- a/examples/asm.lisp +++ b/examples/asm.lisp @@ -1,2 +1,11 @@ +(define a 12) + +; maps fairly directly to the `htasm` assembler (asm - (li64 r1 0)) \ No newline at end of file + ; zero here might be replaced with a variable + (li64 r1 0) + ; like so + (li64 r2 a)) + +; create a ptr to a +(ptr-to a) \ No newline at end of file diff --git a/examples/log.lisp b/examples/log.lisp index 07f5b4b..4df968f 100644 --- a/examples/log.lisp +++ b/examples/log.lisp @@ -1,13 +1,14 @@ - (define log (lambda (level message) ( (append (message level)) + (define ptr-to-message (ptr-to message)) + (define length-of-message (length message)) (asm - (set-register r1 3) - (set-register r2 1) - (set-register r3 (ptr-to message)) - (set-register r4 (+ 1 (length message))) + (li64 r1 3) + (li64 r2 1) + (li64 r3 ptr-to-message) + (li64 r4 length-of-message) (eca))))) (define error (lambda (message) (log 0 message)))