Thread: Assembly Programming...

  1. #1
    Registered User
    Join Date
    Nov 2004
    Location
    Pennsylvania
    Posts
    434

    Assembly Programming...

    Anyone know a good place to start?

    I was interested in 'broadening my horizons' so to speak and assembly sounded interesting, more basic than C++ but also more 'powerful' i use that term loosely. I know you can combine C++ with some assembly too which sounded interesting.

    So if anyone knows of a good book, online tutorial, etc (preferably book ) let me know.

    Oh and this computer here is an AMD Turion 64 CPU, cause i know that Assembly depends on the CPU, i assume this is in the same class as like the 8086 or Intel Family or whatever?

    Thanks!
    "Anyone can aspire to greatness if they try hard enough."
    - Me

  2. #2
    Anirban Ghosh
    Join Date
    Jan 2006
    Posts
    278
    This is a good book on Assembly
    http://webster.cs.ucr.edu/AoA/index.html

    For beginners the Book "THE INTEL MICROPROCESSORS" by Brey(80x86) is a very good book!

    Well i could post some other links also but I suppose those are not permissible here.

  3. #3
    Registered User
    Join Date
    Nov 2004
    Location
    Pennsylvania
    Posts
    434
    PM me the links you can't post
    "Anyone can aspire to greatness if they try hard enough."
    - Me

  4. #4

  5. #5
    Registered User
    Join Date
    Nov 2004
    Location
    Pennsylvania
    Posts
    434
    I got this one: Assembly Language for Intel-Based Computers (4th Edition) Its a text book and it looked really good, it shows you how to incorporate asm files into you're C/C++ projects as well. Anyone ever use this one?

    Oh and any tuts in the meantime before i get the book to keep me busy would be great too =)

    Thanks!
    "Anyone can aspire to greatness if they try hard enough."
    - Me

  6. #6
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by Junior89 View Post
    I got this one: Assembly Language for Intel-Based Computers (4th Edition) Its a text book and it looked really good, it shows you how to incorporate asm files into you're C/C++ projects as well. Anyone ever use this one?
    Nope. Back in the early 90's I essentially taught assembly language to myself, using the basic references available from Intel. Books are good and everything, but there really isn't that much TO assembly language. There is a small set of instructions that cover 99% of what you want to do. It's easy enough to learn how to use them in a few days.

    The real challenge with assembly language is that it is so low-level, it feels like you have to write mounds of code in order to accomplish anything real. The challenge in learning assembly programming isn't in using the instructions, but understanding the the thousands of nuances of the architecture or platform you are working with.

    I'm not trying to say I'm a super genius or anything. In fact, I still have half a bookshelf covered in books relating to low-level Intel architecture programming. It's just that none of those books is a general "How to program assembly language" book. I've got books on programming the PCI bus, books on programming DMA, IO ports and memory-mapped devices, books on utilizing the various protected mode features of the processor, etc. THAT stuff is the really cool part.

    There are tutorials online. They pretty much universally suck, having been written either by demo-graphics-coders (who are highly skilled but far too specialized) or virus writers. To see real examples of working assembly code that does "real stuff," look at the various assembly language modules of the Linux kernel. They even have half-decent comments!

    Also, get the gcc compiler if you don't already have it and use its "-S" switch. This causes the compiler to output assembly language instead of object code. There are other switches that cause the compiler to add comments to the code, so you can see how it relates to the C source. It's a good place to start experimenting with making tiny changes or adding your own stuff, without having to write the entire program yourself in assembly language.

  7. #7
    Registered User
    Join Date
    Nov 2004
    Location
    Pennsylvania
    Posts
    434
    Thanks for the input! I understand what you're saying, hopefully this book is a decent introduction. I'll download the manuals from Intel i suppose =)
    "Anyone can aspire to greatness if they try hard enough."
    - Me

  8. #8
    Registered User
    Join Date
    Apr 2007
    Location
    In my house
    Posts
    29
    I learned Assembly a while back from a few tutorials that where quite basic err, I donno if I still have them handy I'll look them out, but if you want to see some impressive code I suggest the NeHe site, all the tutorials are designed to teach C++ with OpenGL, but at the bottom of ever tutorial are the links to download the source, and some of the tutorials actually have an assembly version of the code in the tutorials, I can't say off hand which ones, but I looked at one and I must say I was impressed . . .
    http://www.groovyweb.uklinux.net/ind...age%20how%20to
    I think is the link I learned from, sorry I aint sure of the codes the forum uses yet

    http://www.sandpile.org/
    http://www.programmersheaven.com/zone5/index.htm

    two other links I found when i was learning I didn't look into them in great detail but I hope they have something to help you in your search for greater knowledge

  9. #9
    Registered User
    Join Date
    Nov 2004
    Location
    Pennsylvania
    Posts
    434
    Well thank you for your help =)

    I'll take a look
    "Anyone can aspire to greatness if they try hard enough."
    - Me

  10. #10
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    The thing that helped me with assembly when I would get stuck with writing things was to think about what I was trying to accomplish at a more higher level. Just like how people are recommended to think in pseudo-code when having trouble in C, I would tend to think in C when having trouble with assembly.

    brewbuck is totally right about feeling that you have to write loads of code to do something simple, but on the other hand, the shortcuts and super fast code that you are able to write make it worth while. In addition, due to learning assembly, I became aware of bad coding practices that I was using when programming in C that made for very inefficient assembly. Modern compilers probably are able to catch some of these bad practices, but it's not always guarenteed that they will save you.

    Try not to get caught up in lots of assembler-specific macros or anything like that. I know assembly isn't portable, but learning compiler-specific things in C don't always help you in the long run if you're dependent upon them.

  11. #11
    Registered User
    Join Date
    Nov 2004
    Location
    Pennsylvania
    Posts
    434
    ah... very interesting, thanks! =)
    "Anyone can aspire to greatness if they try hard enough."
    - Me

  12. #12
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    I suppose I should have mentioned that I actually have that book, or rather I have the 5th edition of it.

    My main complaint would be that the author's examples were written with a custom set of macros that seemed to really hide what was going on. I know they can be quite useful, but I would have preferred that most examples use either the C library or Win32 API functions. Since you already know how to use them in C/C++ (hopefully ), to see how they are used in assembly would seem to me the best way to help someone learn the language, but I digress.

    Overall, the book does cover many items, so between it and any other references to fill in the blanks, you should get a good idea of what assembly is about.

  13. #13
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,273
    Yep, I've got that book too, although I've only ever really used it as an instruction reference and a quick insight into particular instructions.

    One way of developing your assembly language skills is by studying the disassembly of programs. Yes it's a bit of a dark art, but certainly with simple DOS programs you can learn a lot about what does what by following the flow of execution in your head.

    Then you can apply all that to writing stuff!

  14. #14
    Registered User
    Join Date
    Nov 2004
    Location
    Pennsylvania
    Posts
    434
    Reverse engineering? ha sounds interesting as well =)
    "Anyone can aspire to greatness if they try hard enough."
    - Me

  15. #15
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by Junior89 View Post
    Reverse engineering? ha sounds interesting as well =)
    It can be fun when you're learning. Once you're experienced, it's just boring busy work. I'd rather write new code from scratch :-)

    My first experience with reverse engineering was when I was a kid playing Might & Magic III. You could save and restore your game, and the game data got written to a big binary file.

    I spent several MONTHS of after-school time trying to understand the data format of those save game files. Eventually I built up a book of several hundred pages, consisting of tables of offsets, magic values, flags, etc. I could modify my characters in any way I wanted, change the inventory, warp myself to different places in the game, etc.

    It was actually one of the inspirations for me to begin "real" programming (I'd done some little stuff before but nothing real). I wanted to write a Windows application for editing MMIII savegame files and sell it as shareware. Never finished that project, but it launched me in a direction that has influenced my entire life.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Learning Assembly
    By mrafcho001 in forum Tech Board
    Replies: 5
    Last Post: 03-12-2006, 05:00 PM
  2. C to assembly interface
    By Roaring_Tiger in forum C Programming
    Replies: 4
    Last Post: 02-04-2005, 03:51 PM
  3. assembly language...the best tool for game programming?
    By silk.odyssey in forum Game Programming
    Replies: 50
    Last Post: 06-22-2004, 01:11 PM
  4. True ASM vs. Fake ASM ????
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 04-02-2003, 04:28 AM
  5. C,C++,Perl,Java
    By brusli in forum C Programming
    Replies: 9
    Last Post: 12-31-2001, 03:35 AM