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 Rating: Thread Rating: 2 votes, 5.00 average.
  #1  
Old 06-Dec-2008, 02:42
zatora zatora is offline
Member
 
Join Date: May 2008
Posts: 111
zatora will become famous soon enough

Assembly Tutorial?


I am a student in c++ i am taking datastructure I in college. I always was curious about assembly language so i am wondering if anyone can give an easy assembly tutorial ( please would you provide a link to download a compiler because i don't know how to run an asm file). I am also wondering if assembly is still a language to learn or just for hobbiest. Thnaks all for your efforts
  #2  
Old 06-Dec-2008, 20:29
Howard_L Howard_L is offline
Regular Member
 
Join Date: Apr 2007
Location: Maryland/PA, USA
Posts: 846
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 ??????


I tell ya, I recently got stated into assembly and have found it to be enlightening but confusing. )what else is new) It really gets down to basics. I can start to see where all the other languages come from.

I come mostly from C. I soon realized that when writing assembly there are three things I'm giving instructions to:
- the cpu
- the OS
- the compiler
Weird to get used to after being used to the neatly structured standard C or C++.

You will see how all OS's need to interface with the cpu's registers.
You will see that for the linux kernel there is one set interrupt codes (functions) to do things like print stuff and for the dos kernel there is a completely different set!
You will see that each compiler deals with these things a little differently...

So your first choice is to choose a compiler.
I started in linux with the simple gcc 'as' compiler and a tutorial here: cs.princeton.edu/courses/archive/spr05/cos217/

Then I found there was another popular compiler called nasm which is available for linux (AND dos).
I had that on my Fedora disks ant tried that too. Here is one I followed a bit for that: cin.ufpe.br/~if817/arquivos/asmtut/index.html

Then I tried it in dos. (that's when I found there was the different interrupt set)
This is a good tut that (lots of good background stuff) uses NASM in dos: drpaulcarter.com/pcasm/index.php

Then I found that there are the MASM (M for bill (microsoft)) and TASM (borland-T for turbo) which supposedly use fairly identical syntax. I have not tried either an probably won't. This one uses that style: oopweb.com/Assembly/Documents/ArtOfAssembly/Volume/toc.html

Note here that 'as' and GAS use the AT&T style of syntax while nasm, masm and tasm use the Intel style.
Cornfused yet? Hang in there it gets better!

Another route to take in dos is debug which comes with my '98se and I guess on up line.
It is a simple yet VERY interesting compiler/debugger program to learn to use!

I code in nasm and step through it with debug to watch what's happening with all the data and registers, etc. I found some good stuff on that here:
armory.com/~rstevew/Public/Tutor/Debug/

Oh yeah , another concept to begin to learn is the different executable types in linux and dos.
like .com and .exe and how they work. Just starting to get that. neat stuff.
Well there are some ideas. Where do you want to go?
  #3  
Old 06-Dec-2008, 22:42
zatora zatora is offline
Member
 
Join Date: May 2008
Posts: 111
zatora will become famous soon enough

Re: Assembly Tutorial ??????


CPP / C++ / C Code:
"Note here that 'as' and GAS
 use the AT&T style of syntax
 while nasm, masm and tasm use the Intel style.
Cornfused yet? Hang in there it gets better!"

Yes i am confused good job, you 've nailed it lol, i choose this link to start with i have ubunto 8.01 installed in my system (i am just new to linux so i barely can open a terminal) so will this compiler run in ubuntu ?
also if u would please write an asm file that display "hello Assemby" and adds two integer together and if you could comment it that would be my start;
i read some about the computer architecture some about the binary deciman hexadecimal converstion i got to the registers inside the cpu and i stopped.
  #4  
Old 07-Dec-2008, 00:21
Howard_L Howard_L is offline
Regular Member
 
Join Date: Apr 2007
Location: Maryland/PA, USA
Posts: 846
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 ??????


Quote:
i have ubunto 8.01... (new to linux, barely open a terminal) will this compiler run in ubuntu ?
Welcome to linux.
You may already have the 'as' assemler installed. (it is part of gcc compiler) type:
gcc --h
If that is installed you should see a bunch of help info. ( use shift>pg-up/pg-down to scroll xterm screen)
If so try:
as --h ...which should do the same. If so you have that assembler ready to go!
In the first link I gave above it suggests this tutorial usin the as assembler.
cs.princeton.edu/courses/archive/spr05/cos217/reading/ProgrammingGroundUp-1-0-lettersize.pdf


Do you have man pages installed? try: 'man as'
If that works try 'man nasm'
If that works you probably have the NASM assembler installed and could follow this tutorial:
: cin.ufpe.br/~if817/arquivos/asmtut/index.html
cin.ufpe.br/~if817/arquivos/asmtut/index.html

If not you will need to install.
I'm using Fedora6 which uses the rpm for package management. I believe Ubunto uses Apt get?
Have you used that to install a program yet?
  #5  
Old 11-Dec-2008, 02:27
zatora zatora is offline
Member
 
Join Date: May 2008
Posts: 111
zatora will become famous soon enough

Re: Assembly Tutorial ??????


Quote:
Originally Posted by Howard_L
Welcome to linux.
You may already have the 'as' assemler installed. (it is part of gcc compiler) type:
gcc --h
If that is installed you should see a bunch of help info. ( use shift>pg-up/pg-down to scroll xterm screen)
If so try:
as --h ...which should do the same. If so you have that assembler ready to go!
In the first link I gave above it suggests this tutorial usin the as assembler.
cs.princeton.edu/courses/archive/spr05/cos217/reading/ProgrammingGroundUp-1-0-lettersize.pdf

Do you have man pages installed? try: 'man as'
If that works try 'man nasm'
If that works you probably have the NASM assembler installed and could follow this tutorial:
: cin.ufpe.br/~if817/arquivos/asmtut/index.html
cin.ufpe.br/~if817/arquivos/asmtut/index.html

If not you will need to install.
I'm using Fedora6 which uses the rpm for package management. I believe Ubunto uses Apt get?
Have you used that to install a program yet?
Thank You Howard i wasn't able to check your posting till 12-11-08 @ 4:24 am from my work. as i am having my internet back today @10:00 i will check what the Ubuntu 8.01 has cuz when i run the update packages but i did not have a strong internet connection i could not do anything so i will be in track soon thanks so much i am yearning to learn assembly.
  #6  
Old 11-Dec-2008, 08:17
Howard_L Howard_L is offline
Regular Member
 
Join Date: Apr 2007
Location: Maryland/PA, USA
Posts: 846
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?


Frustrating sometimes isn't it...
If you are talking about 'updating' over a dialup connection good luck.
Fedora has that 'yum' updater which did nothing but stop my machine!
It never even finish checking for available updates!
I managed to turn the stupid thing off.
They forget about us out in the boonies with dial-up only.
I use what came on my disks and the 'old versions' work just fine , thanks ANYHOW.
The Fedora 6 set that I got form Edmunds Enterprises for around
$10 HAS everything AND the kitchen sink already on them.
All developement packages for gcc, perl, python, nasm ... you name it!
Screw the updates....
So you might want to order a full set of Ubuntu (or Fedora or other disto).

What compiler are they using in your C++ class? Linux g++?
If so you will want to have the full gnu cc developement suite installed.
(gcc, g++) The 'as' assembler will be included with that (I think).
Also you will want to get the 'gdb' debugger packages too....
On the other hand , the nasm assembler is not as much to get downloaded and installed...
Hang in there.
Meanwhile I have been playing with 'as' and gdb in linux. very nice.
I now have this list of sites I am using for info:
Code:
Linux : ----- as: - online as reference (man page): http://www.cs.utah.edu/dept/old/texinfo/as/as_toc.html - A full tutorial from cpu registers, memory on up to functions in 'as': http://www.cs.princeton.edu/courses/archive/spr05/cos217/reading/ProgrammingGroundUp-1-0-lettersize.pdf - tutorial for using asm mixed into a c prog (inline): http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html - tutorial (inline): http://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html - tutorial with gcc as and using gdb debugger! http://web.cecs.pdx.edu/~bjorn/CS200/linux_tutorial/ - tutorial- brief but very concise , http://database.sarang.net/study/linux/asm/linux-asm.txt ----- nasm: - http://www.cin.ufpe.br/~if817/arquivos/asmtut/index.html - http://www.cin.ufpe.br/~if817/arquivos/asmtut/quickstart.html#cmdarg_file - http://asm.sourceforge.net/howto/Assembly-HOWTO.html ----- ----- Dos: ----- interrupts: - http://www.htl-steyr.ac.at/~morg/pcinfo/hardware/interrupts/inte1at0.htm ----- NASM style; - http://www.drpaulcarter.com/pcasm/index.php MASM style: - http://oopweb.com/Assembly/Documents/ArtOfAssembly/Volume/toc.html dos psp info: - http://oopweb.com/Assembly/Documents/ArtOfAssembly/Volume/Chapter_13/CH13-8.html#HEADING8-103
Last edited by Howard_L : 11-Dec-2008 at 09:41.
  #7  
Old 11-Dec-2008, 14:22
zatora zatora is offline
Member
 
Join Date: May 2008
Posts: 111
zatora will become famous soon enough

Re: Assembly Tutorial?


ok i am taking data structure class we are using Microsoft visual c++ express edition 2008 but i want to learn how to do that in gcc lunix but i can not download it cuz i am total newbi to the lunix.
i use the synaptic manager to instal gnu but it said it did install it, but i typed back gcc--h still saying no input file ?
so i am kinda lost...
  #8  
Old 11-Dec-2008, 15:09
Howard_L Howard_L is offline
Regular Member
 
Join Date: Apr 2007
Location: Maryland/PA, USA
Posts: 846
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?


I searched at ubuntu.com.
Post #3 in this thread talks about installing gcc right from your disk: ubuntuforums.org/showthread.php

It your lucky maybe they included enough developement stuff to get started on the single disk you have...
If you want to stick with Ubuntu you should join their forums where you could get distro specific help.
Sorry I can't help more but I'm not up on ubuntu or the apt-get package system.

Also, did you know that gcc is available for Windows?
djgpp : http://www.delorie.com/djgpp/
mingw:http://www.mingw.org/
  #9  
Old 11-Dec-2008, 19:24
Howard_L Howard_L is offline
Regular Member
 
Join Date: Apr 2007
Location: Maryland/PA, USA
Posts: 846
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?


WAIT A MINUTE!!! , Did you say you got this:
Code:
[myprompt]$ gcc --h gcc: no input files
I get that too!. I think you DO have gcc installed.
I'm sorry to have given you that to try above without testing. I was wrong!
We get that message because gcc is looking for an input filename after the --h. Try this instead
Code:
gcc --help If that works try these: as --help whereis gcc man gcc man as man gdb
So have you used a command line compiler before?
If you have only used an IDE like Visual C++ this will be different but here's how we do gcc.
So you know some C++ so how about you just try a hello.c program first:
CPP / C++ / C Code:
#include <stdio.h>
int main(void)
{
  printf("Hello World!\n");
  return 0;
}
/*  Save the above code as 'hello.c' 
compile it with this command line:
gcc -Wall -W -pedantic hello.c -o hello

And run it with this:
./hello

Your output should be this:
Hello World!

man gcc    to find out what -Wall -W and -pedantic add to the compilation
*/
Does it work?
Last edited by Howard_L : 11-Dec-2008 at 20:42.
  #10  
Old 11-Dec-2008, 21:54
zatora zatora is offline
Member
 
Join Date: May 2008
Posts: 111
zatora will become famous soon enough

Re: Assembly Tutorial?


Ok, i think i had to install g++ from the cd so i typed this (g++ -v) it shows g++ version 4.3.2
now i run this in the terminal
g++ -o test.cpp test
so it did generated a test.exe file but i did not see anything on my screen alrhough befor my int main(){ return 0;} i declared int i then cin>>i;to make the compiler wait for the user to enter the value of i but none happened
 
 

Recent GIDBlogInstall Adobe Flash - Without Administrator Rights by LocalTech

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 08:29
Tutorial: How to Make a Web 2.0-Style Logo PhotoshopTrend Graphics Forum 0 20-Sep-2007 05:57
Assemblers & assembly language BlueFireCO. Assembly Language 2 26-Mar-2007 09:56
Photoshop Tutorial: Make An Inspirational/Mystical Picture ToddSAFM Graphics Forum 9 09-Aug-2005 20:32

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 02:12.


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