diff --git a/src/c/a5/addsub.asm b/src/c/a5/addsub.asm index 5057f2d..c6bf74e 100644 --- a/src/c/a5/addsub.asm +++ b/src/c/a5/addsub.asm @@ -7,27 +7,23 @@ addsub: push ebp mov ebp, esp - mov eax, 0 - sub esp, 4 - - mov [ebp-4], word 1 + push bx mov eax, 0 - mov [operation], word [ebp+16] + mov bx, word [ebp+16];Operation + mov ax, word [ebp+8];op1 - add ax, word [ebp+8] - - cmp [operation], 0x2b + cmp bx, 0x2b jne substract - add ax, word [ebp-12] + add ax, word [ebp+12];op2 jmp return -substract: sub ax, word [ebp-12] +substract: sub ax, word [ebp+12];op2 return: - + pop bx mov esp, ebp pop ebp ret diff --git a/src/c/a5/flagtest.c b/src/c/a5/flagtest.c index 1657ff9..ec206ec 100644 --- a/src/c/a5/flagtest.c +++ b/src/c/a5/flagtest.c @@ -18,7 +18,9 @@ int main(int argc, char **argv) { int result = addsub(op1, op2, what, flags); + printf("%d\n", result); + printf("%u\n", result); return 0; } \ No newline at end of file