Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; **** Code-Segment ****
- section .text
- global asm_addsub
- asm_addsub:
- push ebp ; neuer Stackframe: BasePointer retten
- mov ebp,esp ; Stackpointer zum neuen BasePointer machen
- mov ecx, [ebp+8] ; summand 1 auslesen
- mov ebx, [ebp+16] ; operator auslesen
- or ebx, ebx ; prüfen ob +(ebx=0) oder -(ebx!=0) gerechnet werden soll
- jnz sub1
- add1:
- add cx, [ebp+12] ; summand 1 + summand
- jmp out1
- sub1:
- sub cx, [ebp+12] ; summand 1 - summand 2
- out1:
- pushfd ; flags auslesen
- pop eax ; falgs vom Stack holen
- mov edx, [ebp + 20]
- mov word [edx], cx
- mov esp, ebp ; ?
- pop ebp ; BP wiederherstellen
- ret ; um die Uebergabeparameter kuemmert sich
- ; das rufende Programm (add esp, 16)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement