Assembly or More C++?

This is a discussion on Assembly or More C++? within the Tech Board forums, part of the Community Boards category; sorry if this is in the wrong place to post but i wan't shure where to post it ive been ...

  1. #1
    Registered User whackaxe's Avatar
    Join Date
    Mar 2004
    Posts
    332

    Assembly or More C++?

    sorry if this is in the wrong place to post but i wan't shure where to post it

    ive been looking around at a few assembly tutorials and i thought i might have a go at it, but for those who know both i suppose, would it be better for me (the realtive c++ n00b) to continue learning c++ or would it still be a valuble experience to learn some ASM?
    thanks for any adivce
    I loathe pointers

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    I would say both...but in time.

    I would at least want to be confident at C++ before going on...but once your confident, then ASM can answer a lot of questions about how it works and it can be good for your debugging skills

  3. #3
    Registered User whackaxe's Avatar
    Join Date
    Mar 2004
    Posts
    332
    thanks
    i know this is a bit of an open question, but what would you consider confident?
    I loathe pointers

  4. #4
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    Quote Originally Posted by whackaxe
    thanks
    i know this is a bit of an open question, but what would you consider confident?

    Only you can answer that...

    Basically when you feel confident that you understand all the features and can use them in a project without getting overwhelmed

  5. #5
    5|-|1+|-|34|) ober's Avatar
    Join Date
    Aug 2001
    Posts
    4,429
    I would say confident means that you can code the majority (1/2 to 3/4) of a project without looking for outside help.

  6. #6
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,590
    I think Fordy has it backwards. Learn ASM first then C++. IMO C++ is fifty times harder than assembly language. Assembly is simple because everything is broken down into small steps. But it is also cumbersome because there is no way to skip steps or provide structure to the code. After awhile even well commented assembler turns into a large jumbled mess.

    If you can understand this, then you can do assembly. Say you want to do this:

    y*[width]+x

    Here it is:
    Code:
    ;Put y value into eax
    mov   eax,[y]
    
    ;Put width value into ebx
    mov   ebx,[width]
    
    ;multiply eax by ebx leaving result in eax
    mul    eax,ebx
    
    ;add x value to eax
    add   eax,[x]
    And that's just one of a million ways you could do it. Here's another way.

    If you wanted to break 320 down into 2 base 2 values you could do this.

    320 is essentially 256+64. Since those are both base 2 we can do this:

    (y<<8)+(y<<6)+x
    or
    y*(2^8)+y*(2^6)+x
    y*(128)+y*(64)+x

    After all (y*128)+(y*64)+x is the same as y*(128+64)+x or y*320+x.

    Here is the asm code:
    Code:
    ;put y value into eax
    mov  eax,[y]
    
    ;shift left by 8 -> multiplies by 2^8 or by 128
    shl    eax,8
    
    ;put y value into ebx
    mov  ebx,[y]
    
    ;shift left by 6 -> multiplies by 2^6 or by 64
    shl    ebx,6
    
    ;add ebx to eax, leave result in eax
    add  eax,ebx
    
    ;add x value to eax, leave result in eax
    add  eax,[x]

  7. #7
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    Whatever

    It's a matter of opinion..

  8. #8
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,590
    Yes it is and you know I love to play devil's advocate.

    By the way, Fordy is a very very good assembly language programmer and knows far more than I do. He just doesn't want to get blasted on this board for using it so he hides it from the masses. Or maybe perhaps he is just smarter than I and realizes that, after all, this is a C programming board not an assembly board.



  9. #9
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    If anyone is interested in ASM, this board is very good - http://board.win32asmcommunity.net/

    It's mostly windows assembly based and there are some real asm nuts over there

  10. #10
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    I learned ASM after knowing C for a while and it was one of the best classes I've taken so far. It doubled my understanding of how things worked. I think one reason was that the professor kept making links between a set of C commands and their equivelent ASM commands and vice versa. Heck like 2/3 of our final was "What is the equivelent ASM code for the follow C code"

  11. #11
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,590
    Great....thanks Fordy....another board.

    Too bad Bubba was already taken. So now I'm ASMBubba. Sounds like some sort of disease or something.

    Assembly is not really a language per se....it's the hexadecimal equivalent or syntax of the binary that activates circuits in the CPU. So it 'is' a language and it 'isn't' a language. Assembly is really hexadecimal opcodes....but the opcodes have been given English like names so we can understand them.

  12. #12
    Registered User Draco's Avatar
    Join Date
    Apr 2002
    Posts
    463
    right, but it is complex in ways that others arent, like knowing all the different registers and what they do. That probably isnt too hard either, my time spent trying to learn asm is getting around 10 minutes or so

  13. #13
    Registered User axon's Avatar
    Join Date
    Feb 2003
    Location
    Mt. Prospect, IL
    Posts
    2,572
    Quote Originally Posted by C+++C_forever
    oo... so how much time could somoene spend to learn the whole language?
    for a normal person, not too long; for you, there is not enough time. STFU already!

    some entropy with that sink? entropysink.com

    there are two cardinal sins from which all others spring: Impatience and Laziness. - franz kafka

  14. #14
    ggs
    ggs is offline
    C > C++ duders ggs's Avatar
    Join Date
    Aug 2001
    Posts
    435
    .sect signature

  15. #15
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    there is a really friendly java board at http://www.flashdaddee.com/forums/fo...p?s=&forumid=5

    <evil snicker>

Page 1 of 2 12 LastLast
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, 04:00 PM
  2. C to assembly interface
    By Roaring_Tiger in forum C Programming
    Replies: 4
    Last Post: 02-04-2005, 02: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, 03:28 AM
  5. C,C++,Perl,Java
    By brusli in forum C Programming
    Replies: 9
    Last Post: 12-31-2001, 02:35 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21