| | |
Convert into a procedure
Please support our Assembly advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Nov 2008
Posts: 1
Reputation:
Solved Threads: 0
IN CPP:
Im having trouble converting this cpp function into an ASM procedure. The closest code i got near to a procedure was
Help plz
Assembly Syntax (Toggle Plain Text)
extern "C" { void ENCRYPT_CPP(char buffer,int count, char CIPHER,int CIPHER_LENGTH);
Assembly Syntax (Toggle Plain Text)
void ENCRYPT_CPP(char buffer[],int count,char CIPHER[],int CIPHER_LENGTH ) { int t=0; for( int i=0; i<count; i++) { buffer[i]=buffer[i] ^ CIPHER[t % CIPHER_LENGTH]; t++; } }
Assembly Syntax (Toggle Plain Text)
mov ecx,LENGTHOF buffer mov esi,0 mov edi,0 L1: mov eax,esi CDQ mov ebx,CIPHER_LENGTH IDIV ebx mov edi,edx mov eax,0 mov eax,DWORD PTR CIPHER[edi] mov ebx,0 mov ebx, DWORD PTR buffer[esi] xor eax, ebx mov buffer[esi],al inc esi loop L1
Help plz
> IDIV ebx
does this leave the result you want in esi?
> DWORD PTR CIPHER[edi]
It's a char array, not an array of dwords.
You're processing 4* as much data as you expect.
also
xor al,bl
etc, for bytes.
> void ENCRYPT_CPP(char buffer,int count, char CIPHER,int CIPHER_LENGTH);
Missing [ ] on buffer is copy/paste?
Or just what you typed?
does this leave the result you want in esi?
> DWORD PTR CIPHER[edi]
It's a char array, not an array of dwords.
You're processing 4* as much data as you expect.
also
xor al,bl
etc, for bytes.
> void ENCRYPT_CPP(char buffer,int count, char CIPHER,int CIPHER_LENGTH);
Missing [ ] on buffer is copy/paste?
Or just what you typed?
![]() |
Similar Threads
- Return value from Stored Procedure to TextBox (ASP.NET)
- convert string into object (Visual Basic 4 / 5 / 6)
- DrScheme - Convert a string into a list of words (Computer Science)
- How to convert strSQLStmt result to integer? (VB.NET)
- VB procedure for GCD (Visual Basic 4 / 5 / 6)
Other Threads in the Assembly Forum
- Previous Thread: newbie help
- Next Thread: convert ASCii chacracter to decimal
| Thread Tools | Search this Thread |
Tag cloud for Assembly






