From a5ada20d77f6fcf7bf54e49402e55d3b1c56df5e Mon Sep 17 00:00:00 2001 From: Aleksey Veresov Date: Fri, 16 Oct 2020 22:38:45 +0300 Subject: Meh. --- ia32/macro.sts | 20 +++++++++++++++++--- ia32/math.sts | 16 ++++++++++++++++ 2 files changed, 33 insertions(+), 3 deletions(-) (limited to 'ia32') diff --git a/ia32/macro.sts b/ia32/macro.sts index 5aa3b35..34c3a9d 100644 --- a/ia32/macro.sts +++ b/ia32/macro.sts @@ -40,13 +40,21 @@ [ as 1 _data_segment ?choose - defword %1% - lit ?$ # 0 ?. - exit + defword %1% + lit ?$ # 0 ?. + exit _code_segment ?choose lit ?. ! ] +[ local 1 + top as %1% +] + +[ ref 0 + top + 1 + +] + [ literal 0 lit # %1% ?. ] @@ -84,3 +92,9 @@ branch ?swap ?. ?$ ?swap ?! ] + +[ change 0 + dup get + swap 2 get swap 2 + set + swap drop +] diff --git a/ia32/math.sts b/ia32/math.sts index 1864a93..95ca5f7 100644 --- a/ia32/math.sts +++ b/ia32/math.sts @@ -17,6 +17,22 @@ defasm / # 50 ?' ; push eax next +defasm mod + # 5b ?' ; pop ebx + # 58 ?' ; pop eax + # 31 ?' # d2 ?' ; xor edx, edx + # f7 ?' # f3 ?' ; div ebx + # 52 ?' ; push edx +next + +defasm div + # 5b ?' ; pop ebx + # 58 ?' ; pop eax + # 31 ?' # d2 ?' ; xor edx, edx + # f7 ?' # f3 ?' ; div ebx + # 50 ?' ; push eax +next + defasm = # 5b ?' ; pop ebx # 58 ?' ; pop eax -- cgit v1.2.3