Results 1 to 17 of 17

Thread: New to assembly

  1. #1

    Thread Starter
    Addicted Member Filik's Avatar
    Join Date
    Aug 2005
    Posts
    208

    New to assembly

    Hi, im thinking of learning assembly, but i cant figure out what program do you use to do that. I'm pretty sure that you can do it in VS.NET 2003 or 2005, but i cant figure out where, plz help.
    Thx

  2. #2
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: New to assembly

    Start using it in C++ like so:

    Code:
    #include <stdio.h>
    
    int Addition(int val1, int val2){
    
        _asm{
    
            mov eax, val1
            mov ebx, val2
            add eax, ebx 
    
        }
    
        //function automatically returns whats in the eax register
    
    }
    
    int main(void){
    
        printf("%d\n", Addition(10,20));
    
        return 0;
    
    {
    And the best website to learn assembly is www.artofassembly.com . Start in the 16 bit DOS section. The instruction set is introduced in Chapter 3 and 6, with more instructions introduced in the later chapters.

  3. #3
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: New to assembly

    Well I found that website pretty useless, way too much info and no obvious starting point.

    I'd suggest you grab yourself a copy of "Assembly Language for Intel-Based Computers" (Author: Kip Irvine, Publisher: Prentice Hall, ISBN: 0-13-049146-2).

    It comes with a CD and its everything you need to learn ASM. Teaches you how the hardware works first so you can start coding easily. Jumping into the code without appreciating the hardware makes it 10x harder to learn.

    It covers a LOT of different techniques and has an excelltnt instruction set reference and comprehensive glossary and index.

    I would have happily paid twice as much for this book. Go and buy it.
    I don't live here any more.

  4. #4
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246

    Re: New to assembly

    Once done with what wossname said, I would suggest MASM for GUI windows based stuff.

    (I really should get paid for how much I promote MASM here).

    Others may disagree, as there are easier syntaxes for Windows Based ASM, but meh.

    chem

    Visual Studio 6, Visual Studio.NET 2005, MASM

  5. #5
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: New to assembly

    That book I suggested uses MASM al the way through It has the compiler on the CD too.

    Very very cool indeed.
    I don't live here any more.

  6. #6

    Thread Starter
    Addicted Member Filik's Avatar
    Join Date
    Aug 2005
    Posts
    208

    Re: New to assembly

    Quote Originally Posted by Jacob Roman
    Start using it in C++ like so:

    Code:
    #include <stdio.h>
    
    int Addition(int val1, int val2){
    
        _asm{
    
            mov eax, val1
            mov ebx, val2
            add eax, ebx 
    
        }
    
        //function automatically returns whats in the eax register
    
    }
    
    int main(void){
    
        printf("%d\n", Addition(10,20));
    
        return 0;
    
    {
    And the best website to learn assembly is www.artofassembly.com . Start in the 16 bit DOS section. The instruction set is introduced in Chapter 3 and 6, with more instructions introduced in the later chapters.
    You mean the only way to program assembly in VS is in C++? I hope it doesn't use anything of C++ itself, cause i've never studied it, i only know VB.NET.


    And thx for all the links on books and stuff

  7. #7
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246

    Re: New to assembly

    I wouldn't know, never tried it in VS, but: If thats the case, all you'd need is the basics of C++ knowledge like the main procedure and you can have the rest as ASM:
    Code:
    int main()
    {
    __asm {
    xor eax,eax
    }
    return 0;
    }
    ..for example.

    chem

    Visual Studio 6, Visual Studio.NET 2005, MASM

  8. #8

    Thread Starter
    Addicted Member Filik's Avatar
    Join Date
    Aug 2005
    Posts
    208

    Re: New to assembly

    Quote Originally Posted by chemicalNova
    I wouldn't know, never tried it in VS, but: If thats the case, all you'd need is the basics of C++ knowledge like the main procedure and you can have the rest as ASM:
    Code:
    int main()
    {
    __asm {
    xor eax,eax
    }
    return 0;
    }
    ..for example.

    chem
    Thx for info

  9. #9
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: New to assembly

    Even so, the basics of C++ is still a lot to learn in order to learn ASM. It would be a major obstacle.

    There's little advantage to using VS as a debugger anyway. I find it much easier to use notepad and the console. It gives you a better idea of how things work. The book covers EVERYTHING you need to know.
    I don't live here any more.

  10. #10
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246

    Re: New to assembly

    Why would you bother with VS anyway. The MASM "IDE" is pretty much just notepad anyway

    chem

    Visual Studio 6, Visual Studio.NET 2005, MASM

  11. #11
    Addicted Member
    Join Date
    Aug 2005
    Location
    York
    Posts
    197

    Re: New to assembly

    Quote Originally Posted by chemicalNova
    Once done with what wossname said, I would suggest MASM for GUI windows based stuff.

    (I really should get paid for how much I promote MASM here).

    Others may disagree, as there are easier syntaxes for Windows Based ASM, but meh.

    chem
    I would also try fasm - its really good as well. You can do almost the same amount of things with fasm macros as with masm macros unlike most other assemblers. http://flatassembler.net/

    But of course masm has a nice code library and some pretty good ides:
    http://www.easycoder.org/English/index.htm (For MASM and looks like Visual Basic 6)
    http://radasm.visualassembler.com/ (Supports a wide range of assemblers but support for FASM is minimal)
    http://www.winasm.net/ (Supports MASM and FASM (with Shoorik's add-in))

  12. #12
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: New to assembly

    Quote Originally Posted by chemicalNova
    I wouldn't know, never tried it in VS, but: If thats the case, all you'd need is the basics of C++ knowledge like the main procedure and you can have the rest as ASM:
    Code:
    int main()
    {
    __asm {
    xor eax,eax
    }
    return 0;
    }
    ..for example.

    chem

    You didn't have to return 0. It automatically returns whats in the eax register. So you pretty much zeroed the result. But since theres no value in the eax register anyways...

  13. #13
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246

    Re: New to assembly

    Sif pick something like that up in a small example

    I assumed that he would have stored other values in eax

    chem

    Visual Studio 6, Visual Studio.NET 2005, MASM

  14. #14
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: New to assembly

    Quote Originally Posted by Jacob Roman
    You didn't have to return 0. It automatically returns whats in the eax register. So you pretty much zeroed the result. But since theres no value in the eax register anyways...
    1) Nothing "automatically returns" eax. The return code is STORED in eax.

    2) Since this is main(), you don't want to return a value. 0 is the successful application return code.

  15. #15
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: New to assembly

    Quote Originally Posted by penagate
    1) Nothing "automatically returns" eax. The return code is STORED in eax.
    You just controdicted yourself. The return code is stored in eax, hence it did it for ya, and the user didn't have to do it

    It's automatic like I said

  16. #16
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: New to assembly

    Quote Originally Posted by Jacob Roman
    You just controdicted yourself. The return code is stored in eax, hence it did it for ya, and the user didn't have to do it

    It's automatic like I said
    No, you contradicted yourself in saying that... the return code is stored in eax, but nothing did it for you, you moved it there yourself

    I think you are being unnecessarily confusing when you say "automatically returns". Returning a value is an action. In C you use the "return" statement to both set the return value and exit the procedure in one hit. In ASM you just exit the procedure and the value in the eax register, whatever it is at the time, is taken to be the return value.

    So, we are both trying to say the same thing anyway

  17. #17
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: New to assembly

    "Semantics gennelmen, semantics"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width