From 4c63a67fa92c12e092e4911083e8261e242002b7 Mon Sep 17 00:00:00 2001 From: Johannes Theiner Date: Thu, 20 Dec 2018 10:50:51 +0100 Subject: [PATCH] a5: Addition oder Substraktion --- src/c/a5/addsub.asm | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/c/a5/addsub.asm b/src/c/a5/addsub.asm index 2842278..06071f1 100644 --- a/src/c/a5/addsub.asm +++ b/src/c/a5/addsub.asm @@ -12,11 +12,26 @@ addsub: mov [ebp-4], word 1 - mov eax,0 - add ax, word [foo] + mov eax, 0 + + mov operation, word [ebp+16] + add ax, word [ebp+8] - add ax, word [ebp-4] + + cmp operation, 0x2b + jne substract + + add ax, word [ebp-12] + jmp return + +substract: sub ax, word [ebp-12] + +return: mov esp, ebp pop ebp - ret \ No newline at end of file + ret + +section .data + +operation dw 2 \ No newline at end of file