I have a problem i have a fully operational C++ code that works but when i convert it to ASM (assembly) code it doesnt work I dont know where I am going wrong but here are both codes..
#include <iostream>
using namespace std;
int main()
{
int n, tmpA, tmpB
int CO[0] = { 0 };
cin >> n;
CO[0] = 1;
for( int = 2; i < (n + 3); i++)
{
tmpB = CO[k] + CO[k + 1];
CO[k] = tmpA;
cout << " " << tmpA;
tmpA = tmpB;
}
cout << endl;
}
return 0;
}
And here is the ASM code I hope this is the right place where people know how to program in ASM??
TITLE Combinatorial Coefficents
INCLUDE Irvine32.inc
.data
CO DWORD 40 DUP(0)
mystr1 BYTE "Please enter a positive number from 1 to 40: ", 0
i DWORD ?
k DWORD ?
n DWORD ?
tmpA DWORD ?
tmpB DWORD ?
.code
main PROC
mov edx, OFFSET mystr1
call WriteString
call CrLf
call ReadInt
mov n, eax
mov ebx, CO[0]
mov ebx, 1
LL:
mov edx, 2 ; i = 2
add n, 3 ; n + 3
cmp edx, n
jae QX
mov tmpA, 1 ; tmpA = 1
LX:
mov k, 0
;mov edx, i
dec edx ; i - 1
cmp k, edx
jae QX
mov esi, OFFSET CO
shl esi, 2
mov ebx, CO[esi]
add ebx, CO[esi + 4]
mov eax, tmpA
mov eax, CO[esi]
;mov tmpA, eax
;mov eax, tmpA
call WriteDec
call CrLf
mov eax, ebx
; mov tmpA, eax
inc k
inc edx
jmp LL
QX:
exit
main ENDP
END main