Thread: Learning assembly language really helps understanding how computers work

  1. #1
    Linux is where it's at movl0x1's Avatar
    Join Date
    May 2007

    Learning assembly language really helps understanding how computers work

    When I first got into programming (in C) I always wondered how the computer
    understood things like 'printf("Hello World\n")', 'if (a > b)', etc. After delving into assembly
    language (using linux, as and gdb to step through C code), I realized that those high level statements are only for humans to read, and that another program (compiler) reads that
    human code

    if (a == b)
    do this;

    and turns it into something in assembly code:

    mov 3, eax - this puts the first variable into the CPU's eax register
    - eax will then equal -> 00000000 00000000 00000000 00000011
    mov 2, ebx - ebx equals -> 00000000 00000000 00000000 00000010

    cmp eax, ebx - the compare instruction compares these two registers, and then
    sets a bit in the flags register that the following instruction checks:

    je somewhere - je (jump if equal) checks to see if that certain bit is set or not and
    either jumps to a certain address (somewhere) or doesn't.

    And even 'mov 3, eax' is a higher level (for humans to read) statement. In memory 'mov 3, eax' and any other machine instruction would be something like:

    00000000 00000000 00000101 11001011 (actual 1's and 0's would be different)

    Learning some assembly language and seeing what's "under the hood" in C, etc.
    will really help you understand how computers really just operate on 1's and 0's (actually HIGH and LOW voltages), and that certain instructions move 0's and 1's around in memory, and others compare 0's and 1's setting other 0's and 1's, etc.

    The computer isn't "smart" and cannot "understand" anything. Smart people put logic
    gates together in mind-boggling patterns that when fed high and low voltages in varying patterns push other logic gates, etc., and after millions of them fire off based upon what pattern was input, finally accomplish some small task somewhere in RAM or the CPU.

    Alot of people probably know this already, but I just thought that if someone had
    questions like I had when I first got into computers, they could use the info that learning how the machine operates at its base level will REALLY help you understand how computers and C work.

    Last edited by movl0x1; 05-14-2007 at 01:42 AM.

  2. #2
    Ethernal Noob
    Join Date
    Nov 2001
    I had to write a division operation in assembly a few semesters ago. It was pretty neat, but it wasn't the intel architecture but some learning architecture with 7 registers. I also did macro-code, which is one below assembly, and is purly machine interpreted. THat was hard.

  3. #3
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Of course it does. Then you know what the computer really does, not what you write in your compiler.

    I'm addicted to assembly. (Writing pure machine code was fun too, but it was really pointless, because assembly gives the same result.)
    "The Internet treats censorship as damage and routes around it." - John Gilmore

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. learning to work with SDKs & source code out there...
    By psasidisrcum in forum C++ Programming
    Replies: 3
    Last Post: 05-14-2005, 09:26 PM
  2. Computers as authors
    By hk_mp5kpdw in forum A Brief History of
    Replies: 8
    Last Post: 11-22-2004, 08:55 PM
  3. C or C++ LEARNING either language with previous prog.experience Assit w/REAL ADVICE
    By bobbyjrbbobbyjr in forum A Brief History of
    Replies: 3
    Last Post: 10-03-2002, 07:52 AM
  4. C,C++,Perl,Java
    By brusli in forum C Programming
    Replies: 9
    Last Post: 12-31-2001, 03:35 AM
  5. Assembly Language
    By Breach23 in forum A Brief History of
    Replies: 2
    Last Post: 10-21-2001, 11:31 AM