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


ADVERTISEMENT

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 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

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 :: Create Inverted Files To Associate Files To Numbers ( Numbers Being The Index Of My Paths )?

Apr 4, 2011

am writing a small search program for my class. I have decided to use indexing for my program. Ive researched online about indexing and how search engines do it. If im gonno do that I need to create inverted files to associate files to numbers ( numbers being the index of my paths ) . Now I was wondering what would be the best way to create an inverted file ? I was going to create sql tables using mysql api in C but then again there is no array data type or vectors to store few numbers in a single column in mysql and it is not advised to use Enum or SET

View 14 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

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

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 :: Get A Number Between Two Numbers?

Feb 1, 2010

I have some code that opens a directory and reads in the names of files which are e.g. 0001, 0002, 0003 up to 9999I need to get all these numbers and then generate a new number that is not one of these numbers already.here is my code to check the files in the directory

DIR *d;
struct dirent *dir;
int i = 0;

[code]....

View 11 Replies View Related

Programming :: Sum The Numbers Between And Including A And B?

Feb 11, 2010

write a script in bash or shell to add the numbers between and including two numbers

View 3 Replies View Related

Programming :: Perl - Interpreter For Fib Numbers

Apr 1, 2010

As some of you know that I am new to this forum. I have another problem that I got stuck on. I have this file called "Fib.rbb" and my instructor told us to write an interpreter program by using Fib.rbb.

"You are to write an interpreter in Perl for Rongs Basic Basic (RBB) as explained in class. The BNF description for RBB and a test file called Fib.rbb are part of the RBB.zip file which is available in the Course Documents folder on blackboard. If you call your interpreter myIntp.pl, you would execute the program via perl myIntp.pl Fib.rbb

Code: Print "A few Fibonacci numbers:"

View 3 Replies View Related

Programming :: Extract 2 Numbers From A Same File?

Dec 22, 2010

I am trying to extract 2 numbers from a same file and my goal is to print them both in another file, on the same line, separated with a space. I have to do that for 20 files and I would like to have therefore 20 lines like this in the output file. It would look like this :

Quote:

number1_file1 number2_file1
number1_file2 number2_file2
...
...
number_1_file20 number2_file20

So far, I did only extract one number and got an output file like this :

Quote:

number1_file1
number1_file2
...
...
number1_file20

And I did this by running a bash script with the following content :

Code:

#!/bin/bash
ls execution$1$2*.* | while read filename
do
cat $filename | grep -e "Total aborts:" | cut -d " " -f3 >> abort$1$2.dat
done

$1 and $2 are just strings to identify the different files I want to consider in this loop. This script works well to extract a number which is the 3rd field of a line starting with "Total aborts:".Now, how could I change this script to do what I mentioned above (i.e. extracting two numbers from two different lines) ? The second number is the 3rd field of a line starting with "Total throughput:"

View 7 Replies View Related

Programming :: Date Subtraction Using Numbers

Nov 15, 2010

I want the get the date of the oldest log in this directory and compare it with current date.Time of the each log can be seen before ".Z" prefix.I have written the following piece of code. However, it is not working for the following case:

LOGDAY=20101129
TODAY= 20101201

Difference is 72, which is not correct, since these are dates.

View 11 Replies View Related

Programming :: Generating Prime Numbers In C?

Mar 9, 2011

I'm trying to write a program that generates a random number and then tells if it is prime or not. I have doe some research about how to calculate prime and random numbers but I'm still having trouble. I don't really get how to calculate a prime number. I know a prime number is a number that is divisible by 1 and and itself. how to calculate a prime number in C?

View 10 Replies View Related

Programming :: Matching Numbers With Nawk

May 11, 2011

I am struggling to understand why nawk matches values that are either 1 or 2 digits in length, but not 100 (3 digits).

Am I missing something obvious ? Should I use substr to remove the % ?

I am sure it's something to do with character and string matching behaviour with nawk.

Code:

View 9 Replies View Related

Programming :: Storing Numbers In QByteArray?

Dec 15, 2010

I have a program that sends QByteArray datagrams over a udp socket. I would like to have 4 bytes of the datagram that contain a 32 bit integer. When saving numbers to the QByteArray, I have tried the static function number(int) and member function setNum(int), but they convert the integer to its decimal string representation and save that in the byte array. So if the number were 10, it takes 2 bytes, if it were 10,000,000 it takes 8 bytes. This wastes space, and makes it more difficult to get the number when it is packed with a few other pieces of data in the same datagram. Is there a standard way of doing this in Qt?

View 1 Replies View Related

Programming :: Allowing Export To Take Numbers As Variables?

Jan 26, 2011

I'm playing around with some shell scripting and I've got a directory call CS005 and I'm trying to write a script to I can locate to the directory really quick and easy.

export CS005DIR=/home/stud/0/043234/CS005

Now I get this error

CS005DIR=/home/stud/0/043234/CS005 No such file or directory.

This is because I've got numerical values within my variable.

Is there a way to allow numbers for variable names?

View 3 Replies View Related

Programming :: Append Numbers To A Word List?

Dec 30, 2010

If I do:

for i in $(cat names); do seq -f "$i%03.0f" 0 999; done > output5.txt

I got ( tail snipped):

997munt
998munt
999munt

If I do:

for i in $(cat names); do seq -f "%03.0f$i" 0 999; done > output4.txt

I got:

997Zygmunt
998Zygmunt
999Zygmunt

How I can get numbers from 000 to 999 appended like:

Zygmunt997
Zygmunt998
Zygmunt999

View 8 Replies View Related

Programming :: Bash Rounding Up Numbers With Printf

Feb 2, 2010

For eg: $NUMBEROFPASSES=6.19 to round up I use NUMBEROFPASSES=$(printf %.0f $NUMBEROFPASSES) What I need to do is round up from eg: 6.10 to be 7 and if lower than 6.10 round down to 6

View 5 Replies View Related

Programming :: C - Check If An Input Char Contain Numbers?

Mar 19, 2010

I would like to create a small C tool. I encounter a problem of how to make a function to check an input chars contains numbers (started from the second element).

Some samples:

char *mychar= "a3547"; (The result of function checking this is true)
char *another_char = "t6548"; (The result of function checking this is true)
char *next_char = "appl3"; (The result of function checking this is false)
char *new_char = "b1aa3"; (The result of function checking this is false)

View 4 Replies View Related

Programming :: Generating Series Of Numbers Of Sequence?

Mar 19, 2011

I am trying to generate sequence of number in the order of :

1
2
3
4

[Code]....

View 7 Replies View Related

Programming :: Find The Average Of First 12 Numbers In The Third Column Using 'awk'

Nov 20, 2010

I have a text file with 4 columns and 18 rows. All are integers. I wish to find the average of first 12 numbers in the third column using 'awk'.

View 8 Replies View Related

Programming :: Loop Produces Wierd Numbers

Aug 13, 2010

I'm learning c but then when i tried looping as i follow a tutorial, the numbers are wierd that it seems not right..

This is the example.

Quote:

When i run it, it outputs this.

Quote:

why?

View 2 Replies View Related

Programming :: Random Float Numbers In BASH

Mar 27, 2011

I'm learning shell scripting using bash and I want to generate 4 floating point number with 5 decimal places and write them to a file and a variable. I've done all this except the $RAMDOM enviroment variable does not generate a float number but a integrer.

[code]...

View 4 Replies View Related







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