more examples

This commit is contained in:
able 2024-05-03 14:01:00 -05:00
parent 30bdd44ba5
commit 51299f33bc
2 changed files with 21 additions and 0 deletions

2
examples/asm.lisp Normal file
View file

@ -0,0 +1,2 @@
(asm
(li64 r1 0))

19
examples/log.lisp Normal file
View file

@ -0,0 +1,19 @@
(define log
(lambda (level message)
(
(append (message level))
(asm
(set-register r1 3)
(set-register r2 1)
(set-register r3 (ptr-to message))
(set-register r4 (+ 1 (length message)))
(eca)))))
(define error (lambda (message) (log 0 message)))
(define warn (lambda (message) (log 1 message)))
(define info (lambda (message) (log 2 message)))
(define debug (lambda (message) (log 3 message)))
(define trace (lambda (message) (log 4 message)))
(info "Logger works.")