GIDForums  

Go Back   GIDForums > Computer Programming Forums > Assembly Language
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #71  
Old 28-Jan-2009, 07:01
Mexican Bob's Avatar
Mexican Bob Mexican Bob is offline
Member
 
Join Date: Mar 2008
Location: Chicxulub, Yucatán
Posts: 226
Mexican Bob is a jewel in the roughMexican Bob is a jewel in the roughMexican Bob is a jewel in the rough

Re: Assembly Tutorial ?


Quote:
Originally Posted by zatora
hi BOB welcome here,
1-do you know how to install lunix (ubuntu 8.01) version of oracle 10g
i have downloaded both rpm and the zip file
2-do you know how to install netbeans for ubuntu
3-what do you think about 67

If you are referring to me:

1: Why not use a more recent version of Ubuntu? Isn't 8.10 current, or is it merely a typo? I do not "know" how to install Oracle 10g on Ubuntu, because I have never done it. I have not installed Oracle on anything since the days of 7.x and that was on Solaris. However, if you have the RPM file, use sudo rpm -Uv <name of rpm file>.

2: I do not "know" how to install Netbeans on Ubuntu. It probably isn't very difficult, but I have never done it. Perhaps try: sudo apt-get install netbeans ?

3: I don't have any idea what "67" is other than as a placeholder between 66 and 68. The only other special significance that I can think of is that it is the "entry point" to "retirement" and the "beginning" of being able to "collect" "full benefits" from the SSA for those born during or after 1960. Besides, I like 69 better


MxB
  #72  
Old 28-Jan-2009, 21:29
zatora zatora is offline
Member
 
Join Date: May 2008
Posts: 110
zatora will become famous soon enough

Re: Assembly Tutorial ?


Quote:
Originally Posted by Mexican Bob
I don't have any idea what "67" is other than as a placeholder between 66 and 68. The only other special significance that I can think of is that it is the "entry point" to "retirement" and the "beginning" of being able to "collect" "full benefits" from the SSA for those born during or after 1960. Besides, I like 69 better
MxB
LOL i think i wanted to say post number 67 but the word post was written with some magic keys obviously the magic trick worked and it did not show the word " post "
  #73  
Old 11-Feb-2009, 23:11
zatora zatora is offline
Member
 
Join Date: May 2008
Posts: 110
zatora will become famous soon enough

Re: Assembly Tutorial?


Hi all, I am back with more of the same i hope Howard_L is doing fine.
As i am still in school, i am still busy to continue with functions implementation in assembly.
I will ask today about binary files in assembly, i think we said that linux treat every thing as a file ( which need more explanantion ) so i went online to know the structure of a binary file and how to use in linux (if it is a jpg picture we may want to display it, or if it text file coded as binary we want to display it is content to the screen ).
So i did not get the part where the online document below talks about header file, allocation table.... http://www.itee.uq.edu.au/~cristina/...esis96/bff.htm
so if it happen that you can show me how to display an image woth assembly that would be great ?
thanks howard_l.
  #74  
Old 12-Feb-2009, 00:10
Howard_L Howard_L is offline
Regular Member
 
Join Date: Apr 2007
Location: Maryland/PA, USA
Posts: 800
Howard_L is a jewel in the roughHoward_L is a jewel in the roughHoward_L is a jewel in the rough

Re: Assembly Tutorial?


In linux you should have a program called 'hexdump'.
Running it like this will have output like what is shown in that page:
hexdump -C <file_to_examine>

On the far left is the byte count of the first byte on that line.
In the center are the bytes (16 per line in hex).
On the right is the bytes in ascii. 'isprint()' characters are printed, non-printable characters are substituted with a dot.

See if you can produce a listing file and find the machine language instructions. Then see if you can find those instructions in the hexdump of the binary.

Another way to use the 'objdump -d ' on the .obj file.
That will show you more stuff to find in the hexdump.

man hexdump , man objdump , man as (or info as)
Good to hear from you. Have fun.
  #75  
Old 20-Apr-2009, 09:03
zatora zatora is offline
Member
 
Join Date: May 2008
Posts: 110
zatora will become famous soon enough

Re: Assembly Tutorial?


Hi EveryOne...
i guess it has been a while since i started this crazy idea about learning Assembly, So i guess i will resume where i stopped the Assembly Function With return Value knowing in c, c++ or Java as
int myFunction(args[])
{//
return myvariable
}
so i coded very primitive functions using two args but what i fail to understand is the over all mechanism to code a function according to standard if even there is any so by looking at the follwing code can anyone tell me what should be adjusted if necessary
i called this function add( what a challenge... lol), it takes two args, and add them then return the value(which will be in EAX)
CPP / C++ / C Code:
.section .data
 .section .text
 .globl _start
_start:
nop # just to use the debugger gdb
 pushl $3                  #push second argument
 pushl $2                  #push first argument
 call adding
# here i used the return value of the first call of add function  pushed it on the stack
# then pushed  15 just to see if i can chain function like this 
myfunc( myfunc(arg1,arg2),15)); 
pushl %eax
pushl $15
call adding               #call the function
 movl %eax,%ebx                           #the result is in %ebx
 movl  $1, %eax             #exit (%ebx is returned)
 int   $0x80
 
.type adding, @function
adding:
 pushl %ebp            #save old base pointer
 movl %esp, %ebp       #make stack pointer the base pointer
 subl $4, %esp         #get room for our local storage
 movl 8(%ebp),%ebx # 1st arg
movl 12(%ebp),%eax # 2nd arg
movl %eax,-4(%ebp) # copy the first arg from eax to our local storage variable
addl %ebx,%eax # adding the copy of the 1st arg + the second arg itself
movl %eax,-4(%ebp) # putting the result back into eax
 movl %ebp, %esp   
 popl %ebp # poping the stack ( i need some help here cuz i don't know what happen to #the value in ebp after the pop instruction where will it go this value inside ebp
 ret # not know what happened here really
 
i hope anyone can tell me if this how we do it according to assembly programmers standard ?
thanks...
  #76  
Old 22-Apr-2009, 12:57
Howard_L Howard_L is offline
Regular Member
 
Join Date: Apr 2007
Location: Maryland/PA, USA
Posts: 800
Howard_L is a jewel in the roughHoward_L is a jewel in the roughHoward_L is a jewel in the rough

Re: Assembly Tutorial?


Don't have time to really get into this now , but here are some thoughts:
I think you should review your comments and be sure they are correct.
I see what looks like misconceptions, but they may just be language dificulties.
(heck I check my stuff over and over and still get it wrong...)

re:
CPP / C++ / C Code:
 movl %eax,-4(%ebp) # putting the result back into eax
 movl %ebp, %esp   
 popl %ebp          # poping the stack 
            # i need some help here cuz i don't know what happen to the
            # value in ebp after the pop instruction where will it go??
 ret   # not know what happened here really
What your doing there is popping the return address into ebp.
ret is a routine that:
- automatically gets the address to return to from ebp.
- then gets that address into eip (instruction pointer)
so your code resumes running at that address. ie:you have returned!

As for your: myfunc( myfunc(arg1, arg2) , 15)); question
I believe you could enclose the call in a loop something like this:
----
push arg2
push arg1
i = 0
loop
call (return val is in eax non?)
pop arg1
pop arg2
push your 15
push return val in eax (new arg1)
inc i
cmpl i 1
j lt loop
----
Does that make sense? Of couse there would variations depending on the task.

I think you are using it but in case not a good tutorial on functions is chapter 4 of:
cs.princeton.edu/../ProgrammingGroundUp-1-0-lettersize.pdf
  #77  
Old 22-Apr-2009, 22:19
zatora zatora is offline
Member
 
Join Date: May 2008
Posts: 110
zatora will become famous soon enough

Re: Assembly Tutorial?


[quote=Howard_L]Don't have time to really get into this now , but here are some thoughts:
re:
CPP / C++ / C Code:
 movl %eax,-4(%ebp) 
# putting the result back into the local var @ esp -4
movl %ebp, %esp   
popl %ebp     ret   
Quote:
What your doing there is popping the return address into ebp.
ret is a routine that:
- automatically gets the address to return to from ebp.
- then gets that address into eip (instruction pointer)
so your code resumes running at that address. ie:you have returned!

I think that is what i wanted to understand about the ret instruction.

i did coded the add functionbut when i coded the sub and if arg1<arg2 the result is weired ? any tips here ( i guess it is related to signed and insigned long but i may be wrong as always...lol)

I will refer back to a previous function that you coded adding 5 args and i think the way you did it is by adding the arg[i] to EAX (for sure all args are pushed on the stack first ) after the 5 args are added the return result will be in eax, this fact is clear to me by now and i like it, because it gives the result with less instruction to issue. but when i compare that to what the compiler generate as codefile.s from an existing codefile.c
i notice that the c compiler produced a different code with more instructions. So i was not trying to waist your time or either mine by spending more than 4 months just trying to grasp that concept. but i want to know the so called standards of coding in assembly.
Other than that it is good to hear from you again, you seem very busy. but no rush in replying because i am going to progress a bit away from chap 4 and start chap 5 also i am taking 3 classes this quarter so good luck for me there,but i got to admit this though Assembly is addicting i have 3 projects in school, working full time midnihgt job and i am playing with assembly...lol)
Till i hear from you bye and thanks for replying.
 
 

Recent GIDBlogProblems with the Navy (Chiefs) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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

All times are GMT -6. The time now is 07:18.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.