From 383d1fbe2740fd0bfd12521cf54ef680d4af7ba1 Mon Sep 17 00:00:00 2001 From: pommicket Date: Sat, 13 Nov 2021 13:12:38 -0500 Subject: ]=, ^=, also *fixed variable sar in previous compilers* --- 03/in02 | 113 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) (limited to '03/in02') diff --git a/03/in02 b/03/in02 index a687e10..5a0f113 100644 --- a/03/in02 +++ b/03/in02 @@ -158,6 +158,10 @@ im je :-|= X|=Y im +##5e. ascii '^' +je +:-^= X^=Y +im ##3c. ascii '<' je :-<= X<=C / X<=imm @@ -166,6 +170,10 @@ im je :->= X>=C / X>=imm im +##5d. ascii ']' +je +:-]= X]=C / X]=imm +im ##3d. ascii '=' je :-x= X=imm / X=:label / X=nY @@ -322,6 +330,37 @@ jm :-rl next line ::|B |B +// deal with bitwise xor +::^= +im +--=? +cl +// put operand 1 in rbx, +im +--B1 +cl +// operand 2 in rax +im +--A2 +cl +// emit 'xor rax, rbx' +im +--^B +IA +im +##3. +DA +im +--wr +cl +// put rax in operand 1 +im +--1A +cl +jm +:-rl next line +::^B +^B // deal with left shift ::<= im @@ -434,6 +473,62 @@ jm :-rl next line ::>I >I +// deal with arithmetic right shift +::]= +im +--=? +cl +im +--A1 put operand 1 in rax +cl +// look at 2nd operand (line[3]) +im +##3. +BA +im +--LI ++B +BA +zA +lb +BA +im +##43. ascii 'C' +je +:-]c non-constant shift +// write sar rax, +im +--]I +IA +im +##3. +DA +im +--wr +cl +// now write immediate. calculate number +im +##3. +BA +im +--LI ++B +BA +im +--nu +cl +// we now have the shift amount in rax. write it to the file +BA +im +--wb +cl +im +--1A put rax back in operand 1 +cl +jm +:-rl next line +::]I +]I // left shift by cl ::C >C +// arithmetic right shift by cl +::]c +im +--]C +IA +im +##3. +DA +im +--wr +cl emit 'sar rax, cl' +im +--1A put rax back in operand 1 +cl +jm +:-rl next line +::]C +]C // deal with set immediate (e.g. "A=d3, B=:label, C=1B") ::x= im -- cgit v1.2.3