Questions tagged [assembly]
An assembly language is a low-level programming language for a computer, microcontroller, or other programmable device, in which each statement corresponds to a single machine code instruction.
170 questions
132
votes
17
answers
73k
views
How does learning assembly aid in programming? [closed]
I have been programming in higher level languages (Python, C#, VBA, VB.NET) for around 10 years and I have completely zero understanding on what's going on, "under the hood."
I am wondering what are ...
75
votes
9
answers
37k
views
How were the first compilers made?
I always wonder this, and perhaps I need a good history lesson on programming languages.
But since most compilers nowadays are made in C, how were the very first compilers made (AKA before C) or were ...
70
votes
7
answers
29k
views
Is this an assembly language?
In my childhood I used to program on an MK-61 Soviet calculator. It had four operating registers (X, Y, Z, T) and 15 storage registers. A program could have 105 steps.
As I recall it, it had commands ...
59
votes
12
answers
37k
views
How Do Computers Work? [closed]
This is almost embarrassing ask...I have a degree in Computer Science (and a second one in progress). I've worked as a full-time .NET Developer for nearly five years. I generally seem competent at ...
57
votes
11
answers
36k
views
Were the first assemblers written in machine code?
I am reading the book The Elements of Computing Systems: Building a Modern Computer from First Principles, which contains projects encompassing the build of a computer from boolean gates all the way ...
57
votes
4
answers
7k
views
Development process used for the code on Apollo 11 missions?
The Apollo missions had technology no more complicated than a pocket calculator.
From link here, there's an information about Apollo Guidance Computer (AGC)
The on-board Apollo Guidance Computer (...
51
votes
4
answers
16k
views
Why do we still grow the stack backwards?
When compiling C code and looking at assembly, it all has the stack grow backwards like this:
_main:
pushq %rbp
movl $5, -4(%rbp)
popq %rbp
ret
-4(%rbp) - does this mean the ...
47
votes
1
answer
89k
views
Frame Pointer Explanation
In MIPS assembly, there is a register for the stack pointer, and another register for the frame pointer. What is the frame pointer and what is its purpose? How does it differ from the stack pointer?
45
votes
5
answers
18k
views
How can this all fit into 64kb?
So, I am here at assembly 2011 and there was this demo played: http://www.youtube.com/watch?v=69Xjc7eklxE&feature=player_embedded
It's one single file only, it says that in the rules. So I repeat,...
44
votes
15
answers
11k
views
How have languages influenced CPU design? [closed]
We are often told that the hardware doesn't care what language a program is written in as it only sees the compiled binary code, however this is not the whole truth. For example, consider the humble ...
35
votes
13
answers
23k
views
Low level programming - what's in it for me? [closed]
For years I have considered digging into what I consider "low level" languages. For me this means C and assembly. However I had no time for this yet, nor has it EVER been neccessary.
Now because I ...
34
votes
11
answers
2k
views
Is it wise for a high level developer to spend time studying assembly? [closed]
It is clear that the knowledge of low level stuff is very important in our work.
But in a situation where you're already developing commercial software on a high level, and when you already have a ...
27
votes
3
answers
10k
views
Why is the copying instruction usually named MOV?
In quite many assemblers, a value copying instruction is usually named "MOV" and its description in manuals usually also contains "move" (however, other words can be used, like "load", "store", "...
25
votes
5
answers
22k
views
Is there a canonical book on x86 assembly? [closed]
There are lots of books on assembly. However, they usually deal with ISAs about which I don't care, such as MIPS or ARM. I don't deal with these architectures; there's no reason for me to try to learn ...
24
votes
3
answers
11k
views
I want to build a Virtual Machine, are there any good references? [closed]
I'm looking to build a Virtual Machine as a platform independent way to run some game code (essentially scripting).
The Virtual Machines that I'm aware of in games are rather old: Infocom's Z-Machine,...
22
votes
4
answers
11k
views
Why does Donald Knuth write TAOCP using assembly language?
I don't hate using assembly language, since I have written some in my os course. But obviously, assembly language lacks abstraction, you have to pay more attention to the details.
Is assembly ...
22
votes
7
answers
10k
views
How do programmers deal with low level software development in high level languages?
I am somewhat new to programming and the best way I can ask this question is with an example.
I know how to do basic things in Java and C#. Things like a small windows forms application or make a ...
21
votes
4
answers
69k
views
How do we go from assembly to machine code(code generation)
Is there an easy way to visualize the step between assembling code to machine code?
For example if you open about a binary file in notepad you see a textually formatted representation of machine code....
19
votes
7
answers
37k
views
Purpose of NOP instruction and align statement in x86 assembly
It has been a year or so since I last took an assembly class. In that class, we were using MASM with the Irvine libraries to make it easier to program in.
After we'd gone through most of the ...
19
votes
5
answers
23k
views
Advice for an ambitious student on building your own kernel [closed]
I'm a very ambitious university student who wishes to learn pretty much everything there is to know about computers (bash me if you want, I love learning). Recently I thought it would be a fun project ...
19
votes
6
answers
7k
views
What came first, the compiler, or the source?
I'm curious about the birth of the compiler. How did programming begin? Did people first build hardware that recognized a certain set of commands, or did people define a language and then build ...
18
votes
1
answer
9k
views
What is the purpose of red zone?
Red zone is a fixed size area in memory beyond the stack pointer that has not been "allocated". Compilers do generate assembly to access that area in simple leaf functions.
But I can't see any real ...
17
votes
7
answers
68k
views
What Are Some Advantages/Disadvantages of Using C over Assembly? [closed]
I'm currently studying engineering in Telecommunications and Electronics and we have migrated from assembler to C in microprocessor programming. I have doubts that this is a good idea. What are some ...
17
votes
6
answers
25k
views
Is Assembly still relevant? [closed]
Are there major differences between assembly language and higher level languages when it comes to coding and/or managing projects? Obviously it takes more statements in assembly language to carry out ...
17
votes
3
answers
7k
views
Is it true that "Real programmers can write assembly code in any language."?
Real programmers can write assembly code in any language.
(Larry Wall).
As far as I can make out, Mr. Larry Wall is trying to say that to a real programmer any language can have the same ...
16
votes
2
answers
10k
views
How are OOP "objects" and "classes" organized in memory in terms of assembly language?
How are objects organized in memory?
For instance, I know that a function is a piece of code in memory, that expects parameters via the stack and/or the registers and handles it's own stack frame.
...
15
votes
8
answers
7k
views
Reverse engineering: what is it really good for? [closed]
I have some innocent/beginner questions:
What is reverse engineering good for?
As a programmer, should I learn the art of reverse engineering?
What are the benefits to a programmer who is ...
14
votes
7
answers
40k
views
"Write an Assembler in C." Why writing a machine code translator for a low level language in a higher level language?
My Microprocessor class instructor gave us an assignment and said:
"Write an Assembler in C." - My beloved Professor
So it seemed a little bit illogical to me.
If I'm not wrong Assembly ...
14
votes
8
answers
16k
views
Should I include `assembly` as programming language in the CV? [closed]
In the answer for one question someone wrote that assembly is not a language, it's a process. I tend to agree, since the assembly "language" is dependent on the architecture it will run on, which may ...
13
votes
7
answers
19k
views
How exactly do we go from Binary/Hex to Assembly Instruction sets?
So i've been trying to learn some Embedded/Assembly programming for a bit here lately, as well as going far as trying to learn the lowest level (gates and such).
One thing puzzles me though....is how ...
13
votes
9
answers
2k
views
Rewriting IBM assembler + COBOL in C++
I work as a rental agent / manager for a car rental company that is running on a rental system that was written in 1972. I decided that maybe it was time for an update. For a bit of background, here ...
12
votes
12
answers
26k
views
Assembly as a First Programming Language? [closed]
How good of an idea do you think it would be to teach people Assembly (some variant) as a first programming language? It would take a lot more effort than learning for instance Java or Python, but one ...
12
votes
2
answers
952
views
Are some NOP codes treated differently than others?
I'm curious about this, let's say I have:
00000000001 90 nop
00000000002 90 nop
00000000003 90 ...
11
votes
1
answer
3k
views
Why is Assembly Language called "Assembly"?
Why is assembly language called "assembly"?
I was just watching the 1st video in the "Crockford on JavaScript" series.
In it, Douglas says,
". . . the first program to make programming easier was ...
10
votes
4
answers
10k
views
Is there much difference between X86 Assembly language on Windows and Linux?
I'm a complete beginner at Assembly, and my aim is to learn as much as I can to do with Assembly to one day I can reach expert level (I know I'm way off right now, but you never know). My only problem ...
10
votes
1
answer
3k
views
Why does GCC use AT&T syntax by default?
I think title says it all :)
Is there any particular practical reason (I guess it's mostly historic, but I'm unable to find it on my own) why GCC uses AT&T/GAS syntax?
Note: I know this is just ...
10
votes
5
answers
3k
views
Learning to Program in Assembly - Useful Resources [closed]
Following on from a previous thread, it has got me interested in learning a little about Assembly programming. Not so much for wanting to program useful apps in, just to get a feel for low level ...
9
votes
2
answers
2k
views
Assembly Language being used in Aircraft System
Today my lecturer mentioned the reason why the aircraft system is programmed in assembly language is due to the program being written have less error . Is this statement true ? Because when he asked ...
9
votes
6
answers
4k
views
Should I try to do practice problems in assembly? [closed]
I was looking at Project Euler Problem 48:
The series, 11 + 22 + 33 + ... + 1010 = 10405071317.
Find the last ten digits of the series, 11 + 22 + 33 + ... + 10001000.
In Python I can do this with a ...
9
votes
2
answers
462
views
Apollo-11: Using inclusion instead of a linker
Recently digitized and turned into a repo, the original Apollo 11 guidance computer source code has been made available for viewing on Github.
In MAIN.agc, the repo author comments that they
split ...
9
votes
2
answers
8k
views
How does a CPU load multiple bytes at once if memory is byte addressed?
I've been reading about CPUs and how they are implemented, and some big complex architectures (looking at you x86) have instructions that load from memory during one clock cycle. Since one address ...
9
votes
1
answer
3k
views
Why data alignment is used exactly?
Each data type must be aligned to a multiple of some number of bytes, for example a short int must be aligned to a multiple of 2 bytes, and an int must be aligned to a multiple of 4 bytes.
But why ...
8
votes
4
answers
1k
views
Writing a bootloader with no bootloader
I have a question that I really can't find a straight answer to. Let me start by saying I'm not asking for a step by step tutorial, or even plan on doing anything. I'm just curious.
I've been ...
8
votes
1
answer
15k
views
Difference between direct and indirect function() calls
I am curious about the Difference between direct and indirect function() calls
Could anyone help in the diff analysis ?
The c source code could be found at subroutine_direct.c and ...
8
votes
3
answers
2k
views
How to optimize a mixed stack/register bytecode with control flow and side effects?
I'm trying to figure out a technique to optimize bytecode for the following virtual machine:
Bytecode is a flat list of instructions, with execution starting from the first instruction.
Stack ...
8
votes
3
answers
28k
views
Small assembly language project for practice [closed]
I am learning assembly language for x86 architecture. But, i am unable to find any practice problems so that i can test my skills. Can you suggest me some practice problems or some small assembly ...
8
votes
4
answers
5k
views
What are the key differences between low-level C development and higher level OOP development? [duplicate]
I have been using high-level OOP language (like C# and/or Java) for quite some time. I know patterns like the gang of four, can read and write code reasonably well and am considered a senior by his ...
8
votes
2
answers
20k
views
What is the difference between Times and Dup in Assembly Language?
In a bootloader, the second last line is :
TIMES 510-($-$$) db 0
Now, will this command also do the same :
db 510-($-$$) DUP (0)
If not why?
I know what TIMES does, but its not mentioned in ...
8
votes
2
answers
2k
views
Why was the AT&T assembly syntax designed this way?
The AT&T assembly syntax, often called the GAS syntax, keeps surprising me. For example, its parameter order:
mov $100,%eax /* Destination after source */
This just seems so counter-intuitive! ...
8
votes
1
answer
1k
views
Unit Testing: Assembler code and different architectures
I am currently unit testing some C code and I am faced with a problem:
Within the code there are called functions that contain inline assembler code for the SPARC 8 architecture.
Since I am doing ...