Skip to main content

Posts

Showing posts with the label c

The Additon & Subtraction in Assembly

There is not much difficulty when it comes to addition and subtraction in assembly programming. Simply, additon and substraction breaks down to the following: add eax , ecx ; eax = eax + ecx, result in eax add eax , DWORD [ ebp - 4 ] ; eax = eax + localVar1, result in eax add DWORD [ ebp - 4 ] , DWORD [ ebp -4 ] ; illegal, with all instruction both operands can never be memory add DWORD [ ebp - 4 ] , eax ; [ebp-4] = [ebp-4] + eax sub eax , ecx ; eax = eax - ecx, result in eax sub eax , DWORD [ ebp - 4 ] ; eax = eax - localVar1, result in eax sub DWORD [ ebp - 4 ] , DWORD [ ebp -4 ] ; illegal, with all instruction both operands can never be memory sub DWORD [ ebp - 4 ] , eax ; [ebp-4] = [ebp-4] - eax A simple program to display the message about an arithetic operation like "Math: 8 + 4 = ?" can be achived b