RE: Assembly as a first language? 02-27-2017, 08:05 AM
#13
Here's another example. I've been playing with it the last thirty minutes.
This one takes an integer input, adds 5 to it and then returns it back to the calling c...
#include "stdafx.h"
#include "stdio.h"
int subtr(int num)
{
int z;
__asm
{
mov eax, num
sub eax, 5
mov z, eax
}
return z;
}
int _tmain(int argc, _TCHAR* argv[])
{
int num = 0;
num = subtr(5);
return 0;
}
This one takes an integer input, adds 5 to it and then returns it back to the calling c...
#include "stdafx.h"
#include "stdio.h"
int subtr(int num)
{
int z;
__asm
{
mov eax, num
sub eax, 5
mov z, eax
}
return z;
}
int _tmain(int argc, _TCHAR* argv[])
{
int num = 0;
num = subtr(5);
return 0;
}

![[+]](https://sinister.li/images/modern/collapse_collapsed.png)