![]() |
|
#11
|
|||
|
|||
Re: Assembly Tutorial?At least it did something... How about 'as' ,, do you have as?
Not sure what your code was, post it next time. (and use the c++ code enclosure icon) A C++ program is done like this in g++: CPP / C++ / C Code:
|
|||
|
#12
|
|||
|
|||
Re: Assembly Tutorial?First of all thank you so much. you got the sense of teaching not like others so it is impressive.(knowing that will not be paid for just like lunix ...lol) but really thanks and what goes arround comes arround also that programming ground pdf book is looking very sharp at least till chap 3 which i am still reading ( i wanted to remind you that i am talking data structure I using c++) so the reason i am trying to run a cpp application is to see how the lunix will display the "hello assembly " string to the screen, therefore my program is
CPP / C++ / C Code:
thank you again. |
|
#13
|
|||
|
|||
Re: Assembly Tutorial?Hi again i also run the as-v and i think it seems ok this is what i got
heikel@heikel-desktop:~$ as -v GNU assembler version 2.18.93 (i486-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.18.93.20081009. Also i wish if u tell me how to get a assembly hello word we will call the file : test.s and i wanna run in in this compiler. So i can see the result. thanks forward |
|
#14
|
|||
|
|||
Re: Assembly Tutorial?Looks like your off and running! Very good.
I'm not clear about what you want to do with your C++ hello program and assembly. I haven't learned how to work assemby into C or C++ yet.... but I guess it's on the 'to learn' list... I would suggest that you play through the first 3 examples in 'Programming From the Ground UP', the 'exit' , 'maximum value' , and 'function' examples, and createl your own Hello in assembly alone. When I say 'play' I mean: compile, link, run, observe neat stuff, make experimental changes, repeat In the 'maximum value' example you can see how an array of 'long's (4 bytes) is created. ( there is your data structure) Also note how it is manipulated by indexing like in C an C++. He also shows you the datatypes including the '.ascii' type. And you should have noticed how int 0x80 calls are how you 'do stuff' So you set stuff up - and do it ,,,, set stuff up - do it.... There is a linux sys opcode reference at the bottom of this linux/nasm tutorial: cin.ufpe.br/~if817/arquivos/asmtut/index.html There you can find the 'write' opcode with which you can print the ascii array (string) to the screen It shows what values to put in what registers to make the 'syscall'. You can look these functions up in section 2 of the man pages. eg: man 2 write (you'll want to do this... (ain't linux cool)) So basically all you need to do is: -define an .ascii array (much the same as the 'long' array is defined in 'maximum' example) -load up the registers with the proper values to make the 'write' syscall (look up, observe, think, try) -make the call (int 0x80) -exit (as shown in 'exit' example) See what you can do with what you learned from the book! Next you will want to learn about using gdb (debugger)! |
|
#15
|
|||
|
|||
Re: Assembly Tutorial?Hi, the more i read your replies the more i believe you are a teacher, or at least you got the teacher way.
so i did run my c++ test using this command to compile it g++ -test.cpp -o test so it did generate a file called a.out and test(exe) and i fdid find out that to run the application i should type this: ./a.out and the program did run. so by analogy if i write my assembly hello World i should compile it using this command : as -test.s -o test and run it : ./a.out |
|
#16
|
|||
|
|||
Re: Assembly Tutorial?Very similar... just Do the Examples in the Book First!
At the top of the exit example he shows you EXACTLY how to compile the as assembler code. Just Do it! What editor are you using. I use vim. I generally open two xterms side by side. iuse the command mkdir project1 ... to make a new directory called project1 for this particular project then I change directory with: cd project ...in each xterm so both are in the same place. Then in the right xtem I open vim like this: vim ...To open vim with no filename loaded or vim myproject.cpp ... to open the editor with a existing file loaded (or a new blank file with that name) or vimtutor ...to quickly learn how to use vim I type 'i' (insert mode) to begin adding text and 'ESC' to stop that mode and save with ':w' or quit with ':q', get help with ':help' . It is different at first but very powerful. Then on the left xterm I do all compiling and running. So I can switch back and forth between xterms with 'alt>tab' and edit/try/edit /try...etc If I need I open another xterm. Right now I have five xterms and this browser open in this virtual window. (and I need them alll!) Seriously, do the excercises , at least through 'maximum value'... |
|
#17
|
|||
|
|||
Re: Assembly Tutorial?As of now i was still in the begining of chap 3 by tonight i may go through it all now my question is if u can tell me where to download the vim editor i am using the text editor of lunix also if u can tell me how to make a directory called Assembly into my documents without using the GUI interface and can you tell me what this mean in lunix shell terminal
heikel@heikel-desktop:~$ ~$ : ?? thanks. |
|
#18
|
|||
|
|||
Re: Assembly Tutorial?Good take your time in chapter 3. Do not proceed unless you understand. If you don't understadnd , ask.
Everybody's got vim!!! (or should) did you try: (you should know this drill by now) man vim whereis vim Make a directory... you know how to open an xterm right? Well when you open an xterm you should be in yur home directory that is: /home/yourusername If you type: ls -l you will see a listing of unhidden files and directories. If you type: mkdir mynewdir and do ls -l again you will see your new directory listed. If you type: cd mynewdir You will be in the new directory,,,, man ls , man mkdir , look at bottom of any man page for a list other related man and info pages to check out for 'more info/ There is a lot of great linux stuff (beginner on up) here: http://tldp.org/ I gotta go |
|
#19
|
|||
|
|||
Re: Assembly Tutorial?Quote:
username@machine_name-present_working_directory-$: the '-$: ' just marks the end of it. Does it change if you change directory (cd)? If you do a 'pwd' (present working directory) what do you get? '/home/heikel/desktop' ? There is this for the prompt (and much more): tldp.org/HOWTO/Bash-Prompt-HOWTO/index.html |
|
#20
|
|||
|
|||
Re: Assembly Tutorial?Hi, after my last post i went to copy that code for the program to dispaly the 0 with the command ech$?
now i did read the max program i am trying to comment that with c++ analogy i hope i won't mess up a lot CPP / C++ / C Code:
i will get back to read the rest of the chapter. |
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