a5: es kann gerechnet werden, nur noch nicht richtig

This commit is contained in:
Johannes Theiner 2018-12-20 11:20:15 +01:00
parent 4c0acc96ee
commit 2dd692df86
2 changed files with 9 additions and 11 deletions

View File

@ -7,27 +7,23 @@ addsub:
push ebp push ebp
mov ebp, esp mov ebp, esp
mov eax, 0 push bx
sub esp, 4
mov [ebp-4], word 1
mov eax, 0 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 bx, 0x2b
cmp [operation], 0x2b
jne substract jne substract
add ax, word [ebp-12] add ax, word [ebp+12];op2
jmp return jmp return
substract: sub ax, word [ebp-12] substract: sub ax, word [ebp+12];op2
return: return:
pop bx
mov esp, ebp mov esp, ebp
pop ebp pop ebp
ret ret

View File

@ -18,7 +18,9 @@ int main(int argc, char **argv) {
int result = addsub(op1, op2, what, flags); int result = addsub(op1, op2, what, flags);
printf("%d\n", result); printf("%d\n", result);
printf("%u\n", result);
return 0; return 0;
} }