int Add(int a,int b)
{
int ret = 0;
__asm {
mov eax, a//move our parameter a to the register eax/ax
mov ebx, b//move our parameter b to the register ebx/bx
add ebx, eax//add the registers eax and ebx
mov ret,ebx//move the added register to our return varible
}
return ret;
}
int Sub(int a,int b)
{
int ret = 0;
__asm {
mov eax, a//move our parameter a to the register eax/ax
mov ebx, b//move our parameter b to the register ebx/bx
sub ebx, eax//subtract the registers eax and ebx
mov ret,ebx//move the subtracted register to our return varible
}
return ret;
}
int Mullie(int a,int b)
{
int ret = 0;
__asm {
mov eax, a//move our parameter a to the register eax/ax
mov ebx, b//move our parameter b to the register ebx/bx
imul ebx,eax//multiply the registers eax and ebx
mov ret,ebx//move the multiplied register to our return varible
}
return ret;
}
int Divide(int a,int b)
{
int ret = 0;
__asm {
mov eax, a//move our parameter a to the register eax/ax, this will be the dividend
mov ebx, b//move our parameter b to the register ebx/bx, this will be the arg
div ebx//divides the dividend(eax) by the arg(ebx)
mov ret,ebx//move the divided register to the return varible
}
return ret;
}
#include <stdio.h>
int j = Sub(2,4);
printf("%i\n",j);
_wsystem(L"pause");
int Add(int a,int b)
{
int ret = 0;
__asm {
mov eax, a//move our parameter a to the register eax/ax
mov ebx, b//move our parameter b to the register ebx/bx
add ebx, eax//add the registers eax and ebx
mov ret,ebx//move the added register to our return varible
}
return ret;
}
int Sub(int a,int b)
{
int ret = 0;
__asm {
mov eax, a//move our parameter a to the register eax/ax
mov ebx, b//move our parameter b to the register ebx/bx
sub ebx, eax//subtract the registers eax and ebx
mov ret,ebx//move the subtracted register to our return varible
}
return ret;
}
int Mullie(int a,int b)
{
int ret = 0;
__asm {
mov eax, a//move our parameter a to the register eax/ax
mov ebx, b//move our parameter b to the register ebx/bx
imul ebx,eax//multiply the registers eax and ebx
mov ret,ebx//move the multiplied register to our return varible
}
return ret;
}
int Divide(int a,int b)
{
int ret = 0;
__asm {
mov eax, a//move our parameter a to the register eax/ax, this will be the dividend
mov ebx, b//move our parameter b to the register ebx/bx, this will be the arg
div ebx//divides the dividend(eax) by the arg(ebx)
mov ret,ebx//move the divided register to the return varible
}
return ret;
}
#include <stdio.h>
int j = Sub(2,4);
printf("%i\n",j);
_wsystem(L"pause");
Copyright © 2024, NextGenUpdate.
All Rights Reserved.