33 lines
375 B
NASM
33 lines
375 B
NASM
|
|
section .text
|
|
|
|
global addsub
|
|
|
|
addsub:
|
|
push ebp
|
|
mov ebp, esp
|
|
|
|
push bx
|
|
|
|
mov eax, 0
|
|
|
|
mov bx, word [ebp+16] ;Operation
|
|
mov ax, word [ebp+8] ;op1
|
|
|
|
cmp bx, 0x2b
|
|
jne substract
|
|
|
|
add ax, word [ebp+12] ;op2
|
|
jmp return
|
|
|
|
substract: sub ax, word [ebp+12] ;op2
|
|
|
|
return:
|
|
pop bx
|
|
mov esp, ebp
|
|
pop ebp
|
|
ret
|
|
|
|
section .data
|
|
|
|
operation dw 2 |