From eda272dc91a651f9b923b45efdde4e0bf71dc7bb Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Thu, 20 Oct 2022 16:47:49 -0400 Subject: Add boilerplate --- tnslc/compile/isa_x86.tnsl | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'tnslc/compile/isa_x86.tnsl') diff --git a/tnslc/compile/isa_x86.tnsl b/tnslc/compile/isa_x86.tnsl index e342c90..e11311a 100644 --- a/tnslc/compile/isa_x86.tnsl +++ b/tnslc/compile/isa_x86.tnsl @@ -56,6 +56,13 @@ ;return construct_statement("\tjmp ", {pos}) ;/ +/; cjmp_asm ({}charp suffix, pos) [{}charp] + ;{}charp p = "\tj" + ;add_strings(~p, ~suffix) + ;p.append(' ') + ;return construct_statement(p, {pos}) +;/ + /; mem_offset ({}charp pos, offset, scale) [{}charp] ;{}charp tmp = construct_statement("(", {pos, offset, scale}) ;tmp{len tmp - 1} = ')' @@ -104,6 +111,13 @@ ;add_strings(csec, ~out) ;/ +/; is_common_reg ({}charp n) [bool] + ;return string_equate(n, "ax") || string_equate(n, "bx") || string_equate(n, "cx") || string_equate(n, "dx") + || string_equate(n, "sp") || string_equate(n, "bp") || string_equate(n, "si") || string_equate(n, "di") + || string_equate(n, "8") || string_equate(n, "9") || string_equate(n, "10") || string_equate(n, "11") + || string_equate(n, "12") || string_equate(n, "13") || string_equate(n, "14") || string_equate(n, "15") +;/ + /# Accepted common names: # - ax # - bx @@ -162,7 +176,7 @@ /; make_label ({}charp func_name, func_place, ~{}charp csec) ;func_name.append("_") ;add_strings(~func_name, ~func_place) + ;func_name.append(':') + ;func_name.append('\n') ;add_strings(csec, ~func_name) - ;csec`.append(':') - ;csec`.append('\n') ;/ -- cgit v1.2.3