From b05bd83de41d28bf6a179dd66539d3b3455794f6 Mon Sep 17 00:00:00 2001 From: Jeremiah Orians Date: Sun, 5 Feb 2017 08:11:54 -0500 Subject: [PATCH] Starting to implement lisp interpreter in assembly --- stage2/lisp.s | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 stage2/lisp.s diff --git a/stage2/lisp.s b/stage2/lisp.s new file mode 100644 index 0000000..876d2a5 --- /dev/null +++ b/stage2/lisp.s @@ -0,0 +1,33 @@ + ;; A simple lisp with a precise garbage collector for cells + +;; Start function +:start + LOADUI R15 $stack ; Put stack at end of program + ;; We will be using R14 for our condition codes + ;; We will be using R13 for which IO we will be using + + ;; Initialize + CALLI R15 @garbage_init + CALLI R15 @init_sl3 + + ;; Prep TAPE_01 + LOADUI R0 0x1100 + FOPEN_READ + + ;; We first read Tape_01 until completion + LOADUI R13 0x1100 + +;; Main loop +:main + CALLI R15 @garbage_collect ; Clean up unused cells + CALLI R15 @Readline ; Read another S-expression + CALLI R15 @parse ; Convert into tokens + CALLI R15 @eval ; Evaluate tokens + CALLI R15 @writeobj ; Print result + JUMP @main ; Loop forever + HALT ; If broken get the fuck out now + + + +;; Stack starts at the end of the program +:stack