From 6e97d134e444828f25405f6cfdeb6d081fc21e95 Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Wed, 25 Nov 2015 10:47:37 -0800 Subject: [PATCH] implicit RA argument for JR --- README.md | 2 +- lips.lua | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 91b2400..d57d466 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ Whether or not they output the proper machine code is another thing. ### Unimplemented Pseudo-Instructions -Besides implied arguments for existing instructions, there are: +Besides implicit arguments for existing instructions, there are: * ABS, MUL, DIV, REM diff --git a/lips.lua b/lips.lua index 511ea79..448348b 100644 --- a/lips.lua +++ b/lips.lua @@ -946,6 +946,14 @@ function Parser:instruction() args.immediate = {'LOWER', im} self:format_out(addi[3], addi[1], args, addi[4], addi[5]) end + elseif name == 'JR' then + local args = {} + if self:is_EOL() then + args.rs = 'RA' + else + args.rs = self:register() + end + self:format_out(h[3], h[1], args, h[4], h[5]) elseif h[2] == 'tob' then -- or h[2] == 'Tob' then local lui = instructions['LUI'] local args = {}