From 4986e97e2b32f14433db32a4a3d95f1c9d1ff920 Mon Sep 17 00:00:00 2001 From: EvilMuffinHa Date: Wed, 13 Jul 2022 07:13:58 -0400 Subject: [PATCH] solve method --- solve/solve | Bin 30 -> 34 bytes solve/solve.s | 63 ++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 61 insertions(+), 2 deletions(-) diff --git a/solve/solve b/solve/solve index 93db8d4e2b84799288aadf78169a5bc0235d9c75..5bf9bdecd3077339bd6c8a5e68c36411c1fa9742 100644 GIT binary patch delta 15 Wcmb1Bnjpay$iOJCz{sG$$Or%tz5%BI delta 11 ScmY$An;^laz{sG$$Or%l&jB(3 diff --git a/solve/solve.s b/solve/solve.s index 6327989..c0ede8a 100644 --- a/solve/solve.s +++ b/solve/solve.s @@ -73,9 +73,68 @@ sd tape, 0x01 sd tape, 0x02 sd tape, 0x03 ; {a, b, c, d} +; [i[0], i[1], i[2], i[3] + i[0]] +; - add i[3] and i[0] + +; [i[0], i[1], i[2], (i[3] + i[0]) ^ i[1]] +; - xor i[1] with i[3] + i[0], pop from arith + +; [i[0] + i[1], i[1], i[2], (i[3] + i[0]) ^ i[1]] +; - add i[0] and i[1], pop from arith + +; [i[0] + i[1], i[1], (i[0] + i[1]) ^ i[2], (i[3] + i[0]) ^ i[1]] +; - xor i[0] + i[1] with i[2], pop from arith + +; [i[2], i[1], (i[0] + i[1]) ^ i[2], (i[3] + i[0]) ^ i[1]] +; - xor (i[0] + i[1]) ^ i[2] with i[0] + i[1], pop from arith + +; [i[2], i[2] + i[1], (i[0] + i[1]) ^ i[2], (i[3] + i[0]) ^ i[1]] +; - add i[2] + i[1], pop from arith | store i[2] + i[1] in arith + +; [i[2], i[3], (i[0] + i[1]) ^ i[2], (i[3] + i[0]) ^ i[1]] +; - pop i[3] from tape use previous i[1] + i[2] from arith to xor + +; [i[2], (i[2] + i[1]) ^ i[3], (i[0] + i[1]) ^ i[2], (i[3] + i[0]) ^ i[1]] +; - use previous i[1] + i[2] from arith to xor and pop + +; [i[1], (i[2] + i[1]) ^ i[3], (i[0] + i[1]) ^ i[2], (i[3] + i[0]) ^ i[1]] +; - put i[2] in arith, pop i[1] from tape + +; [i[2] + i[1], (i[2] + i[1]) ^ i[3], (i[0] + i[1]) ^ i[2], (i[3] + i[0]) ^ i[1]] +; - put i[1] in arith, add, pop + +; [i[3], (i[2] + i[1]) ^ i[3], (i[0] + i[1]) ^ i[2], (i[3] + i[0]) ^ i[1]] +; - xor i[2] + i[1] with (i[2] + i[1]) ^ i[3] + +; [i[2], (i[2] + i[1]) ^ i[3], (i[0] + i[1]) ^ i[2], (i[3] + i[0]) ^ i[1]] +; - put i[3] in arith, pop i[2] from tape + +; [i[2] + i[3], (i[2] + i[1]) ^ i[3], (i[0] + i[1]) ^ i[2], (i[3] + i[0]) ^ i[1]] +; - put i[2] in arith, add to i[3] + + +; [i[0], (i[2] + i[1]) ^ i[3], (i[0] + i[1]) ^ i[2], (i[3] + i[0]) ^ i[1]] +; - put i[2] + i[3] in arith, pop i[0] from tape + +; [(i[2] + i[3]) ^ i[0], (i[2] + i[1]) ^ i[3], (i[0] + i[1]) ^ i[2], (i[3] + i[0]) ^ i[1]] +; - xor in arith + +; push all to tape +; pop all back into mem in correct spot + + +; routine for doing overflowing add +; [a, b] +; [255 - a, b] +; 255 - a < b +; a = b - [255 - a] +; 255 - a >= b +; a = a + b +; +le 0x00, 0x01, label sd disp, 0x00 -sd disp, 0x01 - +label: + sd disp, 0x01