Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Assembly

Assembly

Scheduled Pinned Locked Moved The Lounge
questionlearning
51 Posts 32 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S StevenWalsh

    I'm interested in learning assembly, so i can better understand how my code executes with the hopes of writing more effecient code. Does anyone have any good suggestions on books and or sites?

    M Offline
    M Offline
    Marc Clifton
    wrote on last edited by
    #24

    Various microcontroller vendors make prototyping development kits, often free, that come with a processor, a little breadboard area for some custom hardware, pots and leds and switches, etc., and an assembler. I think it's a good way to learn assembly language, by actually doing something at the hardware level. Check out development systems for the 8051 processor, which is a popular microcontroller. Marc

    Thyme In The Country
    Interacx
    My Blog

    G 1 Reply Last reply
    0
    • R RoswellNX

      From what i can see from the Amazon reviews, it's a good book but it contains some buggy and poorly written examples, so i'd say it's best for beginners to supplement this book with something else as well, although an experienced programmer won't have as much trouble with it since they already have the necessary knowledge. Roswell

      "Angelinos -- excuse me. There will be civility today."
      Antonio VillaRaigosa
      City Mayor, Los Angeles, CA

      D Offline
      D Offline
      Dean Ours
      wrote on last edited by
      #25

      I did 4 years of Motorola 68000 assembly programming for embedded control applications. Keep in mind that Intel x86 type processors and their decendants are not the only hardware out there (yes, I know, they dominate). You may find a good book for another processor type, and that is still good for understanding assembler in general. I would suggest also reading up on compiler theory, because this may more directly benefit you in understanding what your program in a higher-level language will do. Even if you knew assembler well, that does not tell you what the compiler may be doing.

      S 1 Reply Last reply
      0
      • W Weiye Chen

        code-frog wrote:

        I've been thinking about the ramifications of running my own growing company and working in another.

        No conflict of interest here? :~

        Weiye Chen A hermit trying to learn hibernation...

        D Offline
        D Offline
        Dr Walt Fair PE
        wrote on last edited by
        #26

        I work full time and do software outside my employment. As long as you have a clear agreement and understanding beforehand, there's no conflict. As my lawyer once told me, the issue isn't conflict. The issue is disclosure. If the employer knows about and accepts the situation, there's no problem.

        Walt

        1 Reply Last reply
        0
        • S StevenWalsh

          I'm interested in learning assembly, so i can better understand how my code executes with the hopes of writing more effecient code. Does anyone have any good suggestions on books and or sites?

          A Offline
          A Offline
          Alan Balkany
          wrote on last edited by
          #27

          You'd probably be interested in "Optimizing C With Assembly Code" by Peter Gulutzan and Trudy Pelzer. In Microsoft C/C++ (and probably most others) you can use keywords to put assembly language in the middle of your functions, speeding up the execution of critical loops. In the 80X86 instruction set, some of the more complex instructions are inefficient, and hand-coded assembly is faster. The two editions of the book are a little dated (for the 80386 and 80486) but you can definitely learn the basic concepts. For efficiency there are techniques that will give you as much of a performance gain as assembly, if not more. For example, selecting a clever algorithm can sometimes give you orders of magnitude of improvement. Processing data in sequentially increasing addresses takes advantage of the cache: When you get even one byte from memory, the cache gets a whole 32-byte (or 64-byte depending on the hardware) line from memory which also contains the following bytes. The key idea is that if you use those bytes next, the processor gets them directly from the cache, and doesn't have to wait to get them from a separate memory chip. Hope this helps you.

          1 Reply Last reply
          0
          • S StevenWalsh

            I'm interested in learning assembly, so i can better understand how my code executes with the hopes of writing more effecient code. Does anyone have any good suggestions on books and or sites?

            E Offline
            E Offline
            El Corazon
            wrote on last edited by
            #28

            StevenWalsh wrote:

            I'm interested in learning assembly, so i can better understand how my code executes with the hopes of writing more effecient code.

            I learned assembly by taking the assembly output from my compiler, and reading it. Google will tell you an amazing amount of information if you have something to google on. Just about any assembler command can be googled. By taking the compiler output, depending on the compiler, you can directly read line-by-line how your code translates, and eventually recognize how to optimize it. However, after the old DOS days, I do very little hand-optimizaton. A quality algorithm will take less time to write than hand-optimized assembly. Knowing how your compiler generates assembly is part of that, knowing what operations are faster, and how to organize your high-level code for speed is far more important. Work with the compiler for fast operation, don't replace it.

            _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

            1 Reply Last reply
            0
            • C code frog 0

              Absolutely true. Got any ideas?:laugh:

              E Offline
              E Offline
              El Corazon
              wrote on last edited by
              #29

              code-frog wrote:

              Got any ideas?

              SBIR. :-D

              _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

              1 Reply Last reply
              0
              • W Weiye Chen

                code-frog wrote:

                I've been thinking about the ramifications of running my own growing company and working in another.

                No conflict of interest here? :~

                Weiye Chen A hermit trying to learn hibernation...

                E Offline
                E Offline
                El Corazon
                wrote on last edited by
                #30

                Weiye Chen wrote:

                No conflict of interest here?

                As long as you are upfront and honest about it, and do not write competing projects against your primary employer, no.

                _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

                1 Reply Last reply
                0
                • S StevenWalsh

                  I'm interested in learning assembly, so i can better understand how my code executes with the hopes of writing more effecient code. Does anyone have any good suggestions on books and or sites?

                  P Offline
                  P Offline
                  PICguy
                  wrote on last edited by
                  #31

                  Why not start with a $1 CPU. Get a PIC 16F57. It has all of 80 bytes of RAM and more than enough code space to do something useful with all that RAM. I wrote firmware for a pellet stove - in assembly - on that CPU. And Microchip has a free IDE for that and most of the chips they make. There is more to assembly than x86. I have written assembly in the IBM 1620, 1440, 7090/94. I wrote floppy disk controller PCB firmware firmware on an 8085 and plotter firmware on a Z80. Large OS code for both CP & PP on CDC 6000/Cyber 70 - all in assembly. -Peter Butler

                  1 Reply Last reply
                  0
                  • S StevenWalsh

                    I'm interested in learning assembly, so i can better understand how my code executes with the hopes of writing more effecient code. Does anyone have any good suggestions on books and or sites?

                    A Offline
                    A Offline
                    AKAJamie
                    wrote on last edited by
                    #32

                    Out of curiosity, what language are you using to write your code? If it's not a .NET language then you're on the right track. If it is a .NET language then you would want to learn about IL.

                    S 1 Reply Last reply
                    0
                    • M Member 96

                      Hundreds, you can't have any of them. :) I was a contract programmer once, I felt at the time as I was doing it that it was a suckers game and I feel even more so that way now. Here I was writing code over and over again, getting paid by the hour or job once then moving on and doing it all over again. Now, any code I write, I'll be selling that same product countless times over for years to come. Of course it's a *lot* more work than contracting ever was for the first few years. One hour of writing contract code was just that, one hour of code, one hour of pay. Now, one hour of time spent writing code for software we sell to the public in general has almost exponential rewards that keep giving and giving. The feeling is *completely* different.


                      "I don't want more choice. I just want better things!" - Edina Monsoon

                      C Offline
                      C Offline
                      code frog 0
                      wrote on last edited by
                      #33

                      Those thoughts are on my mind every single day. I'm constantly looking for ideas of something to write.

                      E 1 Reply Last reply
                      0
                      • C code frog 0

                        Those thoughts are on my mind every single day. I'm constantly looking for ideas of something to write.

                        E Offline
                        E Offline
                        El Corazon
                        wrote on last edited by
                        #34

                        code-frog wrote:

                        I'm constantly looking for ideas of something to write.

                        If you don't have ideas for yourself, I would seriously tell you to consider SBIR work. If you have no problems with where the money comes from, the process basically posts ideas and you bid on them. Generally it starts at 90k to100k for 6 to 9 months the first year, strictly R&D, and then if you have an innovative enough approach and they fund Phase II, it jumps to 250k to 750k for the next 2 years to reach prototype. Not bad considering you didn't even have to come up with the idea, only the solution. There are lots of problems to be solved, and sometimes they fund two or more on the same project hoping that one person will come up with a highly innovative solution. And, you MUST have an idea of how to commercialize it. That is the whole idea, after the funding creates the product, you get to sell it for more $$. It is competative, but with R&D paid for, your $$ outlay for any given project is relatively little compared to completely doing it on your own dime.

                        _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

                        C 1 Reply Last reply
                        0
                        • E El Corazon

                          code-frog wrote:

                          I'm constantly looking for ideas of something to write.

                          If you don't have ideas for yourself, I would seriously tell you to consider SBIR work. If you have no problems with where the money comes from, the process basically posts ideas and you bid on them. Generally it starts at 90k to100k for 6 to 9 months the first year, strictly R&D, and then if you have an innovative enough approach and they fund Phase II, it jumps to 250k to 750k for the next 2 years to reach prototype. Not bad considering you didn't even have to come up with the idea, only the solution. There are lots of problems to be solved, and sometimes they fund two or more on the same project hoping that one person will come up with a highly innovative solution. And, you MUST have an idea of how to commercialize it. That is the whole idea, after the funding creates the product, you get to sell it for more $$. It is competative, but with R&D paid for, your $$ outlay for any given project is relatively little compared to completely doing it on your own dime.

                          _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

                          C Offline
                          C Offline
                          code frog 0
                          wrote on last edited by
                          #35

                          I'm dumb as a nail. What's SBIR?

                          E 1 Reply Last reply
                          0
                          • A AKAJamie

                            Out of curiosity, what language are you using to write your code? If it's not a .NET language then you're on the right track. If it is a .NET language then you would want to learn about IL.

                            S Offline
                            S Offline
                            StevenWalsh
                            wrote on last edited by
                            #36

                            At work its .net, but i'm not as interested in learning assembly for the sake of writing assembly, I'm more interested in having an understanding of how my code is executing. At home I write C++ (my goal is to have my program run on this [^] )

                            A 1 Reply Last reply
                            0
                            • C code frog 0

                              I'm dumb as a nail. What's SBIR?

                              E Offline
                              E Offline
                              El Corazon
                              wrote on last edited by
                              #37

                              code-frog wrote:

                              What's SBIR?

                              http://www.dodsbir.net/[^] check the current solicitation, just avoid the ones I am bidding on. ;P Actually, given the closing date is less than a month away, you might not want to do it this time around (but you might want to also). About 3-4 times a year a solicitaton is opened up with any number of topics, you choose a topic, bid on it, and if you win, you get the honor of doing the work and submitting horrid accounting documentation of the process, but reasonable compensation in most cases.

                              _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

                              1 Reply Last reply
                              0
                              • M Marc Clifton

                                Various microcontroller vendors make prototyping development kits, often free, that come with a processor, a little breadboard area for some custom hardware, pots and leds and switches, etc., and an assembler. I think it's a good way to learn assembly language, by actually doing something at the hardware level. Check out development systems for the 8051 processor, which is a popular microcontroller. Marc

                                Thyme In The Country
                                Interacx
                                My Blog

                                G Offline
                                G Offline
                                ghle
                                wrote on last edited by
                                #38

                                Excellent suggestion! You'll be able to touch and feel the results of your work. You won't have to worry about Windows/Linux/etc. getting in the way or confusing the issue. Start simple: try to make some lights blink.

                                Gary

                                1 Reply Last reply
                                0
                                • S StevenWalsh

                                  I'm interested in learning assembly, so i can better understand how my code executes with the hopes of writing more effecient code. Does anyone have any good suggestions on books and or sites?

                                  G Offline
                                  G Offline
                                  ghle
                                  wrote on last edited by
                                  #39

                                  After getting a feeling for Assembler, compile your C/C++ with the assembler listing. Even debug/step through code at the assembly level. I worked in industry where we were VERY limited on program space (embedded project). At one release, we could not fit in the memory space. We looked at the assembler listing and saw that i++ and i+=1 took one more instruction than ++i. We were able to recode all the "don't matter" cases to use ++1 and shoehorn the code in. No change to logic, just to program size (and therefore, minimally, to execution speed). This will no doubt help you think along the lines of code optimization as you move along in your career.

                                  Gary

                                  1 Reply Last reply
                                  0
                                  • D Dean Ours

                                    I did 4 years of Motorola 68000 assembly programming for embedded control applications. Keep in mind that Intel x86 type processors and their decendants are not the only hardware out there (yes, I know, they dominate). You may find a good book for another processor type, and that is still good for understanding assembler in general. I would suggest also reading up on compiler theory, because this may more directly benefit you in understanding what your program in a higher-level language will do. Even if you knew assembler well, that does not tell you what the compiler may be doing.

                                    S Offline
                                    S Offline
                                    sly44
                                    wrote on last edited by
                                    #40

                                    Just remember you can only try the code on the processor type you have. mikie

                                    D D D 3 Replies Last reply
                                    0
                                    • S sly44

                                      Just remember you can only try the code on the processor type you have. mikie

                                      D Offline
                                      D Offline
                                      Dean Ours
                                      wrote on last edited by
                                      #41

                                      Granted, but he never said he planned to actually write any code.

                                      S 1 Reply Last reply
                                      0
                                      • D Dean Ours

                                        Granted, but he never said he planned to actually write any code.

                                        S Offline
                                        S Offline
                                        sly44
                                        wrote on last edited by
                                        #42

                                        true but to learn it you really need to try it out mikie

                                        1 Reply Last reply
                                        0
                                        • S sly44

                                          Just remember you can only try the code on the processor type you have. mikie

                                          D Offline
                                          D Offline
                                          Dan Neely
                                          wrote on last edited by
                                          #43

                                          Emulators. Afaik my college didn't have any hardware for the MIPS assembly they taught.

                                          -- You have to explain to them [VB coders] what you mean by "typed". their first response is likely to be something like, "Of course my code is typed. Do you think i magically project it onto the screen with the power of my mind?" --- John Simmons / outlaw programmer

                                          H 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups