188

Because you'll understand how it really works. You'll understand that function calls are not for free and why the call stack can overflow (e.g., in recursive functions). You'll understand how arguments are passed to function parameters and the ways in which it can be done (copying memory, pointing to memory). You'll understand that memory is not for free ...


87

Does this mean the base pointer or the stack pointer are actually moving down the memory addresses instead of going up? Why is that? Yes, the push instructions decrement the stack pointer and write to the stack, while the pop do the reverse, read from the stack and increment the stack pointer. This is somewhat historical in that for machines with limited ...


56

You young whippersnappers amaze me sometimes. You all too often have no clue that anything happened before you started school. (I have the same problem. It took me a long time to grasp that 15 years was actually a very short time, from an adult viewpoint. That's roughly the span from Hiroshima to the Cuban Missile Crisis. To me, World War II is just ...


43

Knuth discusses his reasoning in the Preface. I'll quote just a few bits and pieces: ...I needed to decide whether to use an algebraic language such as ALGOL or FORTRAN, or to use a machine-oriented language for this purpose. Perhaps many of today's computer experts will disagree with my decision to use a machine-oriented language, but I have become ...


38

Often times NOP is used to align instruction addresses. This is usually encountered for example when writing Shellcode to exploit buffer overflow or format string vulnerability. Say you have a relative jump to 100 bytes forwards, and make some modifications to the code. The chances are that your modifications mess up the jump target's address and as such ...


36

I would say that the answer to both parts of your question is no: this calculator's commands aren't like assembly language, and programming this calculator is different from programming in assembly language. The "language" this calculator is programmed in is fairly low level, but it still represents an abstraction on top of lower-level constructs that aren'...


33

It will give you a better understanding of what is "happening under the hood" and how pointers work and the meaning of register variables and architecture (memory allocation and management, parameter passing (by value/by reference), etc) in general. For a quick peek with C how's this? #include <stdio.h> main() { puts("Hello World."); return(0); }...


32

If I understand correctly, the development process was peer review and experimentation. The team consisted of people like "Math Doctors" - extremely dedicated, intelligent, passionate, detail-oriented folks whose lives were dedicated to their work. So when I say peer review, I mean many peer reviews over the course of many months (more than a year). These ...


30

I think the answer you seek is here: http://www.codeproject.com/Articles/89460/Why-Learn-Assembly-Language A quote from the article: Though it's true, you probably won't find yourself writing your next customer's app in assembly, there is still much to gain from learning assembly. Today, assembly language is used primarily for direct hardware manipulation, ...


30

This has a very clear answer, actually: Source code came first – by a big margin. Before giving the technical details, a bit of perspective: The first programming languages were all translated into machine language or assembler by hand. The idea of using a piece of software to automate this translation (either via a compiler or evaluator) always came later,...


29

Your lecturer's statement is provably false. The Joint Strike Fighter's control code is written in C++. The 777 from Boeing uses 99%+ ADA. The JPL uses mostly C to drive spaceships. I'm sure there are more examples but I suspect many are proprietary or classified. Here is a paper that goes into some detail on the subject of testing avionics software on a ...


29

Knuth has updated his rationale as well: Why have a machine language? Many readers are no doubt thinking, ``Why does Knuth replace MIX by another machine instead of just sticking to a high-level programming language? Hardly anybody uses assemblers these days.'' Such people are entitled to their opinions, and they need not bother reading the machine-language ...


29

Look at the instruction set documentation, and you will find entries like this one from a pic microcontroller for each instruction: The "encoding" line tells what that instruction looks like in binary. In this case, it always starts with 5 ones, then a don't care bit (which can be either one or zero), then the "k"s stand for the literal you are adding. ...


25

Yes, that definitely sounds like an assembly language to me. It's hard to say whether or not that actually is assembly just from the description, because the definition--a language whose commands map 1:1 with its target platform's machine code--is hard to determine without a knowledge of the machine code itself, but that does sound like the way ASM works on ...


25

I like Falcon's answer, but I'd like to add that on some old boring business application world reverse engineering can get you out of some nasty troubles. At work we do it a lot when doing data integration with a 3rd party system that does not have any new maintenance, so we can know where it should or should not break. We also use reverse engineer to ...


22

In my humble opinion, it doesn't help much. I used to know x86 assembly very well. It helped a little when assembly came up in my courses, it came up once during an interview, and it helped me prove that a compiler (Metrowerks) was generating bad code. It's fascinating how the computer actually works, and I feel intellectually richer for having learned it....


22

He not only uses MIXAL, his assembly language for MIX, but also MIX, a model for a simple computer (like one which was used in the sixties). This is a model for teaching with which he is, to some extent, independent of development in the field. If he'd used another programming language (which one, by the way, would you think would have been suited?), say ...


20

The existing answers focus on ISA changes. There are other hardware changes, too. For instance, C++ commonly uses vtables for virtual calls. Starting with the Pentium M, Intel has an "indirect branch predictor" component which accelerates virtual function calls.


18

I'd start by checking Lua. Both as a sample implementation, and as a very usable VM/language out of the box if you finally decide not to roll your own. The source code is very readble, and there's also the Annotated source code. And some Design documents written by the main author, Roberto Ierusalimschy. Finally, if you choose to use it instead of your ...


18

The red zone is, purely and simply, an optimization that can save instructions. It means that it's no longer necessary for the emitted code for every function to subtract from the stack pointer to make local storage like so sub XXX, %rsp at the beginning of every function call, even if they are not leaf functions. Often times the code emitted from the ...


18

People have written assemblers in machine code. They've also written then in assembly language--often a subset of the language they translate themselves, so they start with a simple "bootstrap" version of the assembler, then add features to it as they need them for the assembler itself. However, none of this is particularly a necessity. In the end, an ...


18

They seem to mean simple textual concatenation / insertion. In other words, even though the source text was split into individual files, the program wasn't split into modules.


15

The performance overhead of writing lots of data to disk isn't the execution speed of your code, but rather the physical limitations of the actual hard drive. Doing it assembly won't give you a noticeable performance increase. Your best bet is to either log less data (recommended, if you're logging that much stuff how useful can it be) or change the drives ...


15

The AGC is controlled with verbs and nouns The Apollo command software is not written in any syntax users would recognize today. Astronauts input commands numerically, with each two-digit number representing a verb or a noun. The verb described the action to be performed, and the noun specified the data to be affected by the verb’s action. Astronauts hated ...


14

The Intel 8086 instruction set includes a variation of "ret" which adds a value to the stack pointer after popping the return address. This is useful for many Pascal implementations where the caller of a function will push arguments onto the stack before making a function call, and pop them off afterward. If a routine would accept e.g. four bytes' worth of ...


14

What is reverse engineering is good for? Reverse Engineering is mainly good for cracking and hacking (remove serial number protection or password prompts), but also for understanding viruses or miracles that other softwares can perform. Sometimes it is a useful skill to have in order to find bugs in programs that you haven't got the source for and to patch ...


14

There was a lovely documentary I'm trying to chase down about John 'Jack' Garman had to "invent" a "a priority-scheduled multiprogramming operating system". This may have been related to the lander module though. The story was that when you were landing the lander, you better give priority to guidance because other things, like the temperature in the cabin ...


Only top voted, non community-wiki answers of a minimum length are eligible