![]() |
|
#21
|
|||
|
|||
Re: Assembly Tutorial?ok i finished chapter 3 i am not getting the adressing mode it seems like either using the value of a register directly or using memory adress i just did not get it.
i am also not getting how the command echo$? will dispay the content of register %EBX, so why not %EAX i am posting my coe to modify this list serach to return the minimum value in the list check it out i can not run it at work so i have to go home to see if it compiles right. CPP / C++ / C Code:
|
|||
|
#22
|
|||
|
|||
Re: Assembly Tutorial?Code:
Last edited by Howard_L : 13-Dec-2008 at 15:26.
|
|
#23
|
|||
|
|||
Re: Assembly Tutorial?hi howard
ok the register eflags is kinda out of my league for now but i think i can use properly in boolean comparison actually what i did this morning is to make my last item in the list 10 and i inserted a new item =1 then i modified the code to get the min number now when i tried to insert an .ascii item into a register and display it than i had a problem how to use the gdb command to dispay the contenat of all the registers Last question u think i should move the chap4 or just review the first three |
|
#24
|
|||
|
|||
Re: Assembly Tutorial?If you have gdb , you would compile your code with the --gstabs option:
Here is a good tutorial I didn't want to show you earlier because it has hello, but I think you will not even care to look at that part now, you're hooked!: database.sarang.net/study/linux/asm/linux-asm.txt Learn the techniques on his code and then use them on your code. I gotta go. |
|
#25
|
|||
|
|||
Re: Assembly Tutorial?I am kinda lost, tht tutorial that u gave kinda lost me so this is what i need to know how to declar these variable in assembly?
int len=125; cout<<len; string str="Heikel" cout<<str; bool found=true; cout<<found; char ch1,ch2; ch1='A';ch2='B'; cout<<ch1<<ch2; i want to see how can i add two int int a,b; a=100;b=50; cout<<a+b; thanks Howard. |
|
#26
|
|||
|
|||
Re: Assembly Tutorial?No offense but that is ridiculous... I sense frustration : )
I can't just write that for you. for two reasons. -1- You wouldn't learn anything ..and -2- I don't know how!!! To print a numeric value you have to convert it into an ascii string? I haven't even tried to do that yet... and a string class? way outa my league! You must keep in mind that in assembly we work with the basic building blocks. It takes a heck of a lot of building blocks to make 'cout<<len' possible! But I am willing to work along with you to learn how to put some things together. The task is overwhelming to me too but I find I am able to get there one step at a time. That being said , NO you should not move on to chapter 4... ...did you fix your attempt at finding a minimum value (post #21) I'm guessing not. I think it would be to your benefit to learn to step through this with gdb and find the problem. I had thought that tutorial might guide and prompt you into it, but apparently that was not to be., woe.... Here's a short howto use gdb to solve all your problems (except butt itch): Code:
Last edited by Howard_L : 15-Dec-2008 at 14:51.
|
|
#27
|
|||
|
|||
Re: Assembly Tutorial?Hi, i don't believe that i am frustrated if that what u meant learning is a long journey
i will tell exactly where i am at. i know that we need to move data from memory to register or even from register to register so my goal was to get familiar to more commands and also try to get use to manipulate data like i know how to use long type variable and i don't how to use integer or char or double but to cheer you up a little i fixed my star_globl and i did put in the right code to get the minimum value in the array i even changed the last value to 1 so i had to change eax to 1 to enable the compiler to know that and it did work. now i am practicing playing with moving data to registers like this code which did work too CPP / C++ / C Code:
CPP / C++ / C Code:
|
|
#28
|
|||
|
|||
Re: Assembly Tutorial?i tried the gdb this is what i got
CPP / C++ / C Code:
so may be u can tell me how to get it right this time lol? |
|
#29
|
|||
|
|||
Re: Assembly Tutorial?Quote:
Too often do we see 'I Need blah blah...' postings around here (you will see)where people just want their homework done for them without doing any of the work. I hope you will stick around and help others. Code:
re: xorl %ebx, %ebx #why not: movl $0, %ebx Yes he's using xor to zero out the register. (look up 'xor' in bitwise operators to see what it does) I believe it is considered safer that 'movl $0, %ebx'. You do realize that when we refer to %eax (and any register id with the e prefix) we are referring to the 'extended' ax register. It is 32 bits. the 'ax' register is the lowest 16 bits of that and the 'al' register is the lowest 8 bits of ax,,, and the 'l' on xorl means that it xor's all 32 bits. There is a chance that movl $0, %eax may only set the lowest 8 or 16 bits to 0. We learn not to assume things like that may not always work as expected. re: movl $4, %eax # write () system call (i am not sure what is that really) Yes it's a linux operation code number for the 'write' function. I posted a link to a site with a linux opcode reference: cin.ufpe.br/~if817/arquivos/asmtut/index.html Type 'man 2 write' to get the man page for it. There you will see that it is from the unistd.h library and the the prototype (interface) is: ssize_t write(int fd, const void *buf, size_t count); Those parameters are given in ebx, ecx, and edx Look up leal in appendix. basically it's transferring the 'address of' (pointer to) the hello string to %ecx. The program as posted runs OK for me. Last edited by Howard_L : 15-Dec-2008 at 17:53.
|
|
#30
|
|||
|
|||
Re: Assembly Tutorial?Hi, ok i tried the gdb again this what i wrote in the source code
CPP / C++ / C Code:
when i tried to debug this what i typed and this what i ve got CPP / C++ / C Code:
i got the part where Eax stands for extended and i remember that it said in the book (http://www.drpaulcarter.com/pcasm/index.php) that there is no way to access the higher EAX(16 bits) so we kinda still dealing wiith the AX If u know what these register are designed for a small help will be great and specially the EFLAGS ??? the O C Z .... what are they ? the book explanation does not provide a good example to understand the concept also i am a newbi. thnak you again |
Recent GIDBlog
Accepted for Ph.D. program by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Mixing C and assembly in x86 - Makefile nuances | aijazbaig1 | Assembly Language | 3 | 23-Apr-2008 09:29 |
| Tutorial: How to Make a Web 2.0-Style Logo | PhotoshopTrend | Graphics Forum | 0 | 20-Sep-2007 06:57 |
| Assemblers & assembly language | BlueFireCO. | Assembly Language | 2 | 26-Mar-2007 10:56 |
| Photoshop Tutorial: Make An Inspirational/Mystical Picture | ToddSAFM | Graphics Forum | 9 | 09-Aug-2005 21:32 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The