Programming :: Converting C Code To Assembly

May 17, 2011

I've been converting some C code to assembly for my homework; it was going well but I'm having trouble with a for loop for hours. I could not understand where is the problem and decided to ask. I'm posting the part where I'm having trouble of my C-code and assembly-code; every other part of codes act same and the variable values are same. I'm waiting this two codes to act same, but they don't.

Code:
mov ebx, [result]
mov eax, [i]
mov ecx, [ebx+eax]
mov [j], ecx
mov [ebx+eax], byte '.'

_loop:
mov ebx, [result]
mov eax, [i]
inc eax
mov cl, [ebx+eax]
cmp cl, 'Z'
je _continue

mov ebx,[result]
mov eax,[i]
inc eax
mov ecx, [ebx+eax]
mov [k], ecx
mov ebx, [result]
mov eax, [i]
inc eax
mov ecx, [j]
mov [ebx+eax], ecx
mov ecx, [k]
mov [j], ecx
inc dword [i]
jmp _loop

_continue:
Code:
j=result[i];
result[i]='.';
for(;result[i+1]!='Z';i++){
k=result[i+1];
result[i+1]=j;
j=k;
}

View 10 Replies


ADVERTISEMENT

Programming :: Code To Add 5 Numbers In Assembly?

Mar 28, 2011

Looking for code to add 5 numbers in assembly? I want to use array for input of those 5 numbers. No problem if the output is 1 digit(0....9).

View 3 Replies View Related

Programming :: Can Bash Commands Be Converted To Assembly Like C Source Code?

Nov 30, 2010

I have read where C is first converted to Assembly before its final compilation to binary. Is there a way to do this with Bash commands? I would like the understanding that Assembly allows to Bash somehow.

View 14 Replies View Related

Programming :: Converting C Code To C++ Causes An Type Error?

Mar 25, 2010

I'm a C / assembler programmer so am not use to C++, which I need to use. Basically I'm using my own versions of memcpy, but for long and int rather than char. It's for fast graphics. So I have a char array which I copy to another array. But I copy as either longs or ints, much faster. for example

Code:
void * fastmemcpysprite (void *destaddr, void const *srcaddr, size_t len)
{

[code]...

View 3 Replies View Related

Software :: Compile Assembly Code In Fedora11?

Jun 21, 2010

how to compile assembly code in linux? I am using AMD processor code instructions...is that amd registers inbuilt? with what file extension i should give while writing assembly code program?

View 14 Replies View Related

Software :: Unable To Compile The Assembly Code With Make Tools

Dec 29, 2010

/tmp/cctiuwxL.s: Assembler messages:
/tmp/cctiuwxL.s:3534: Error: unknown opcode
/tmp/cctiuwxL.s:3534: Error: unknown opcode
/tmp/cctiuwxL.s:3602: Error: unknown opcode

[code]....

This is the make step error./tmp/cctiuwxL.s is the make temporary dirictory which is distroyed after the make process finises . The problem is how can I hold the /tmp/cctiuwxL.s dirictory .Then I can check it and find out the proiblem.

View 1 Replies View Related

Programming :: Linking The Assembly And C?

Apr 29, 2010

I have a C code and assembly (nasm) code and I am not able to find how to link them each other. Here are the codes :
NASM side:

Code:

global_maxofthree
section .text
_maxofthree:

[code]....

I am using ubuntu 9.10 and my NASM version 2.05.01 compiled on Nov 5 2008.

View 4 Replies View Related

Programming :: What's Relationship Btw C Hex And Assembly?

Jul 12, 2011

Could you please explain the relationship between the languages?For one, is C writing assembly when you compile, does every piece of code end up assembly/hex? Is there a way to convert (?port?) between them?I don't understand much at all of them yet, but I've seen examples where it looks like they are interacting, and an understanding of all of them looks to be important?

View 12 Replies View Related

Debian Programming :: How Can Use Chmod In Assembly X86

Aug 3, 2014

i wanna use chmod() in linux x86 [debian 3.7.2 x86] but i have some problem in function argv

look at this function:
Code: Select all int chmod(const char *path, mode_t mode);

and mode_t modes:
Code: Select all       S_ISUID  (04000)  set-user-ID  (set  process  effective  user   ID   on
                         execve(2))

       S_ISGID  (02000)  set-group-ID  (set  process  effective  group  ID  on
                         execve(2);  mandatory  locking,   as   described   in
                         fcntl(2);  take a new file's group from parent direcق
                         tory, as described in chown(2) and mkdir(2))

[code]...

i know there is some problem in ecx and mode_t value/

View 2 Replies View Related

General :: Converting Script To C Code?

Mar 25, 2011

i wanna covert script to C code or any other method to embed this script in C code, script link [URL]

View 1 Replies View Related

Programming :: X86 Syntax - Understanding Assembly Instruction

Jan 6, 2011

I'm reading "Understanding the Linux Kernel" and came upon this assembly instruction:
movl $(__KERNEL_CS << 16), %eax
I am curious as to what "<<" means/does. I tried to gooogle, but google doesn't search for "<<".

View 7 Replies View Related

General :: Converting C Code Into Command Line Executable?

Sep 1, 2010

I thought this question's best category would be in the newbie sectionBasically I have a C code, (for simplicity is only prints a few lines), called printx.c that I would like to convert into a binary file so whenever I have to type "printx" in the command line it would execute the programofcourse gcc will give me a binary file if I do a "gcc printx.c", but even the output file (e.g. print.outwould have to be executed following manner./print.outI only ask, because I notice programs like mailx (which is written in C) is a binary file that could be run in this manner (at least that's what I notice on my ubuntu distro)

View 3 Replies View Related

Programming :: Assembly - Structure References To Members - Get The Values 403004h And 4

Jul 9, 2011

[Code]....

if the address of stWndClass is 403000h, WHY it would be compile as mov eax,[esi+403004] and the first one would be mov eax,[esi+4]? I know how to get the values 403004h and 4,but do not know why.

View 5 Replies View Related

Programming :: Traverse Byte Array In Assembly Using Nasm As Assembler?

Jun 16, 2010

I am trying to learn assembly using nasm as assembler. I did not found example related to string operation. I had following example code,

global asm_strlen
section .data
section .bss
section .text

[code].....

my problem is at highlighted line, I am not getting how to copy a byte into 4 byte reg. rather what is syntax of mov instruction to mov byte to WORD DWORD etc.

View 3 Replies View Related

Programming :: Selenium Java Code Into Equivalent Php Code?

Mar 30, 2011

I need to rewrite the selenium java code into its equivalent php code.

View 5 Replies View Related

Programming :: Assembly Error: I386 Architecture Incompatible With I386:x86-64 Output?

Aug 21, 2010

I was following a simple tutorial on how to program and compile a hello world program using assembly when I got this error;Quote:ld: i386 architecture of input file `hello.o' is incompatible with i386:x86-64 output.The tutorial told me to make two files;Quote:hello.asmsection .data;section declaration

msg db "Hello, world!",0xa;our dear string
len equ $ - msg ;length of our dear string
section .text;section declaration

[code]....

View 3 Replies View Related

Programming :: Converting MB/TB To GB In Perl?

Jan 30, 2010

I am taking an input from the user for free and Used capacity in a disk. I wish to convert Input entered in MBTB to GB and this is how i am doing it.

Code:

<some code>
print "Enter Total disk space";
$tot = <STDIN>;
convert($tot);

[code]...

how do i pass the value of conv[0] after conversion back to $tot or $use such that they contain only value which is in GB?

View 3 Replies View Related

Programming :: Error When Converting C To C++?

Jan 22, 2011

I'm working on a project where I am converting a C file to C++. I have worked out 99% of the errors but there is still one lingering one that I cant seem to figure out. I get the following error when compiling with g++

Code:
mscp.cpp:749: error: invalid conversion from const void* to move
mscp.cpp:750: error: invalid conversion from const void* to move

[code]...

View 5 Replies View Related

Programming :: Converting ODT File To PDF Using PHP

Apr 3, 2011

My problem is to convert an odt file to pdf using php. I wrote an article in odt and I'd want to download it in pdf from my site. I know "fpdf", but it doesn't convert from odt. Someone says to convert from odt to html then to pdf... but some others says NO! Well, do you know a way? (may be also different from odt to pdf, e.g. from latex to pdf).

View 12 Replies View Related

Programming :: Converting Bash Script Into PHP?

Jul 5, 2011

I wrote the following as our developers won't do it for us! The rest of my programming is in PHP, any ideas on how I can get this into php?I'm in the middle of writing a reminder system which involves importing the customer data and sending out reminder emails.All the script below does is download the current report $FILEIN, compare field number 6 ($DATA) with the date($DATE), if there is a match, it checks each line in the prescription_skus.csv to see if there is a match with field number 1 in the current report. It then outputs the entire line to $FILEOUT

Code:
TODAY=`date +"%Y-%m-%d"`
FILEIN="export-"$TODAY".csv"

[code]...

View 7 Replies View Related

Programming :: GMP And Converting Mpz_t To Char?

Jul 16, 2011

I'm writing the Diffie-Hellman key exchange system using GMP to handle big integers. For the most part, everything works. I can convert the string to mpz_t, set up the keys and everything, and encrypt it fine. Its the decrypting I'm having issues with. What I'm using is mpz_xor() for both. To encrypt I'm doing mpz_xor(buffer, mpz_of_text, secret_key), and to decrypt I'm doing mpz_xor(buffer, mpz_of_cipher, secret_key).

For one character, it semi-works...it'll decrypt it fine, but it'll return it as it's ASCII value (i.e.: if I encrypt "A", it'll decrypt it as 65). Which, I can easily just do sprintf(decrypted_buffer, "%c", 65) for example and be fine. But, when I'm sending text bigger than one character, the encryption for AB gives me something like 1061043 after running the decrypting xor on it.

Has anyone ever done this before or can point me in some directions? Perhaps other algorithms to try? I know XOR isn't the most secure encryption method to use, but at the time I wasn't sure what else to use. I'm really just having a hard time trying to convert a mpz_t to a character string. I've looked at mpz_get_str() and it works before running encryption (i.e.: using mpz_set_str() to create a mpz of a string, then calling mpz_get_str() to change it back). Maybe my XOR method is wrong? Here's the code I'm using:

Code:

/**
* str2mpz()
* b The current buffer of text to convert [in]
* m The mpz_t variable to store converted text [out]

[code]....

View 9 Replies View Related

Programming :: Converting Perl Script To Python?

Jul 21, 2011

#!/usr/bin/perl
print "Input File Name: ";
$filename = <>;
$filename =~ s/s+$//;mkdir "$filename";

[code]....

View 3 Replies View Related

Programming :: Converting Vector Of Bytes To String C++

Mar 4, 2011

I have a vector of octets that needs to be converted to a std string. I'm currently doing it this way:

Code:
stringstream ss;
for (unsigned int i=0; i < data.size(); i++
{
ss << data[i];
}
string s_data = ss.str();

This works, but is there any better way to do it?

View 2 Replies View Related

Programming :: Converting String Sequence Of 1's And 0's Into Their Hexa Sequences

Apr 27, 2011

I have to write a code that converts a sequence of 1's and 0's(block) into their equivalent hexa number and copying to another array(byte). but this sequence is not always of length 8 and you are required to send strlen(sequence)%8 bits back into the string. So i've written down this code and it works well with the sample input but fails in the real program.

Code:
int Convert_encode( char * block,unsigned char * byte)
{
int len,iter,i,j,k,sum;
char * temp=(char *)malloc(4*sizeof(char));
len=strlen(block)/8;

[code]....

View 7 Replies View Related

Programming :: Converting YYYYMMDD To Date In Bash Script?

Aug 2, 2010

I need to convert strings in the format YYYYMMDD to dates so I can perform date arithmetic.

View 4 Replies View Related

Programming :: Converting Date Format In A Comma Separated Field?

Apr 9, 2010

I am in the process of learning some scripting, however I am running into a roadblock in specifying a certain time format in the array. Ideally I would like to use Here are the lines of text that I am interrogating:

1123,3/25/2010,00:14 Thu,33229
1124,3/26/2010,13:30 Fri,33230
1125,3/27/2010,04:49 Sat,33231

[code]...

View 2 Replies View Related

Programming :: Converting Epoch In A File Name To Human Readable Date/time?

May 5, 2011

I have log files that everyday are downloaded from my webserver in the format: Code: samplesite.com.xxxxxxxxxxx.gz xxxxxxxxxx is a 10 digit epoch time. I am trying to figure out a way in batch to:

1. find all of exisiting files containing the pattern (after the first run it will only be one a day)
2. Isolate the epoch string
3. convert the epoch string to human readable date/time
4. rename the original file as samplesite.com.mmddYYYY.gz

View 2 Replies View Related

Programming :: Use SSE(2,3) In C/C++ Code?

Jun 6, 2011

I am working on a project with a lot of vector math and I'd like to find a way to speed it up.eading about SSE, but I've found no explanation on how to actually use it in code (was looking for some kind of hello-world example, complete with compilation instructions).Does the gcc compiler automatically make use of SSE, if you add the -sse(2,3) option on the command line? Or are their specific functions/libraries you need to call?

View 12 Replies View Related

Ubuntu :: Application For ASSEMBLY Training?

Feb 8, 2011

i am new to programming world and am trying to understand ARM core. I need an application to help me understand / train assembly language. If anyone knows a good application for this

View 9 Replies View Related

Programming :: Code That Will Never Execute

May 23, 2011

Is there, by chance, a fancy name to describe code that must be in a program but will never be executed? In one of my (Haskell) programs, I have some error-handling code that must be in the program to keep the compiler happy (due to the type checking). However I know that, due to the logical structure of the program, it is impossible for the code to be evaluated. I am curious if there is a technical name given to code that must exist but cannot be executed.

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved