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.

learn more… | top users | synonyms

3
votes
0answers
55 views

Assembly: push vs movl [migrated]

I have some C code that I compiled with gcc: int main() { int x = 1; printf("%d\n",x); return 0; } I've run it through gdb 7.9.1 and come up with this assembler code for main: ...
-1
votes
1answer
51 views

SPARC and Assembly [closed]

I'm currently self teaching myself programming and became familiar with Python, Java and C and I'm confused as to what are the differences between Assembly and SPARC Assembly and whether or not I ...
3
votes
2answers
296 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! ...
0
votes
1answer
94 views

How to make absolute jumps relative?

Given I have x86 assembly code disassembled into a list of structures that fully describe it (opcode, regs, imm etc.). How can I now programmatically turn absolute jumps to relative jumps? Basically ...
0
votes
0answers
58 views

How does a .COM file get loaded for execution

For a bit of fun I thought I would start writing my own emulator for the 80286. I have been reading a bunch about the topic. I thought for simplicity I would start with a really simple COM executable ...
-2
votes
1answer
77 views

Intel i7 3632qm assembler [closed]

I'd like to learn the basics of assembly. I searched in the internet, but i can't understand which assembler should I use on my machine (Intel i7 3632qm), if I already have one installed or I have to ...
0
votes
1answer
156 views

Longest x86 Instruction

I read the recent article "Longest x86 Instruction" http://blog.onlinedisassembler.com/blog/?p=23 I attempted to reproduce the curious disassembly issue on a Win7x86 development platform using masm ...
3
votes
1answer
145 views

Can SSE (or AVX) be used to do large bsf?

I'm faced with having to do a bsf (find the first bit set) in a 512bits bitmap. This is in the hot path so I'd like to see how I can speed things up. Right now I'm maintaining a header entry to know ...
2
votes
3answers
162 views

8085 assembly question. Why flag stacks named d0-d7?

I'm trying to make my C programming exciting by learning assembly programming. I've encountered an image of flag registers in 8085 assembly programming. In that image blocks are named from ...
-1
votes
2answers
99 views

How were assemblers created straight from binary? [duplicate]

How did these earlier programmers know what combinations of binary produced certain results? Is there a way I can create an assembler from binary today?
0
votes
1answer
142 views

Implementing a VM for simulation [closed]

I am aware of this question, and I think I know why it has been closed. I hope that my question manages to be more specific. My skill level: I have a "Computer Science" degree. I have programmed in ...
2
votes
1answer
248 views

Developing a compiler for a self made CPU Architecture

Recently ive been consumed by creating my own simple CPU architecture that at some point could be easily implemented in hardware (No FPGA, but actual Logic Gate circuits). Naturally to fulfill this ...
1
vote
1answer
271 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 ...
1
vote
1answer
346 views

Assembly vs. algorithmic languages (like C, Algol, etc) [duplicate]

Usually, computer science papers describe algorithms in Algol-like pseudolanguage, similar to Pascal or even C/C++. But Donald Knuth uses his own assembly language (MMIX). Are there any good known ...
1
vote
1answer
644 views

Polymorphic engines in C and/or C++ [closed]

I stumbled across polymorphic engines and I don't know anything about them. However, I am curious about how they are written. Every example that I've looked up writes them in assembly, my assembly is ...
-2
votes
1answer
319 views

What are steps in making an operating system in C ? [duplicate]

I am trying to make an my own OS. This is for educational purpose only, so that I get to understand the internals as well as get a good idea of low level programming. I have some prior application ...
-1
votes
2answers
307 views

Reading assembly useful for insights when writing C/C++? [closed]

While in most cases its not necessarily, recently I have taken to reading the generated assembly of my C code every so often, when I'm curious as to the kinds of optimizations my compiler is making. ...
2
votes
1answer
269 views

How do VMs implement function calling?

I'm reading a compiler textbook that compiles to some form of assembly. Since I don't know this assembly language I decided to invent my own simple "assembly language" and implement a basic "virtual ...
5
votes
2answers
575 views

If statements in “generic” assembly?

I'm reading a relatively 'friendly' and simple book about compilers named "Let's Build A Compiler" (originally a series of articles). The compiler written in the book generates instructions in some ...
6
votes
2answers
745 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. ...
1
vote
3answers
3k views

Is there still any value in learning assembly languages today? [closed]

Specifically for a game programmer. If you really needed some assembly routines you could look for help, whereas back in the 80s/90s it was one of the mainstream languages. I read that compilers can ...
2
votes
2answers
117 views

gcc -S seems a bit misshapen with shifting and ANDing bits

Example: int c = 4; int p = 5; if (p & (1 << c)) printf("ok\n"); else printf("nop\n"); gcc -S: movl -4(%rbp), %eax /* eax holds the variable c */ movl -8(%rbp), %edx /* ...
0
votes
3answers
489 views

How Byte loading/storing is implemented By the CPU?

I know that in 32bit machine, cpu read from memory 32bits at a time. since the registers in this case is 32bit in size too, I can understand how this works. What I don't understand is how the cpu ...
2
votes
2answers
471 views

Why convert to assembly language instead of machine code?

When I compile a C program, it is compiled first to assembly code, then assembled into machine code. I'm curious why it doesn't just convert straight to machine code in the first place.
0
votes
5answers
208 views

What conclusion to be drawn from no difference in generated assembly from 2 rather different programs?

I might not have had a counterexample when I got the reply "A pointer is just an address, what's the difficulty?" but I didn't really buy such a simple explanation and at assembly code it's not ...
1
vote
2answers
282 views

Creation of an Assembler [closed]

I've always been interested in how programming languages are created, so for the past 8 months I've been researching, practicing and more about the creation of compilers. I've been able to quite ...
4
votes
1answer
1k 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 ...
0
votes
4answers
850 views

How does assembly relate to machine/binary code

How does assembly relate to machine/binary code. For example here is how to print to the screen in mikeOS(a small pure assembly OS), mikeOS it uses NASM to assemble. BITS 16 ORG 32768 ...
0
votes
1answer
278 views

Fetching instructions from memory

So, I am a noob in assembly language and machine instructions. When the discussion came up as to how funtion calls are implemented at the processor level, someone said that the CALL instruction ...
1
vote
2answers
3k views

How do we go from assembly to machine code(code generation) [closed]

I know this is abstract as it's all about signals and switch - (electronics) - underneath, but is there a easy way to visualize the step between assembling code to machine code. For example if you ...
1
vote
1answer
186 views

What did machine code for 4-bit architecture look like?

I don't know how a 4-bit instruction could be enough to do something so I read about the Intel 4004 and it says that it used 8-bit instructions and then I can understand how opcode and numbers has ...
13
votes
3answers
812 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", ...
4
votes
3answers
630 views

Why do some compilers generate direct machine code?

I was taking this course - CMU 18-447, Computer Architecture at Carnegie Mellon to brush my knowledge and concepts. They say that most of the machine level details and implementations is taken care ...
1
vote
1answer
889 views

How are I/O port addresses and data sent?

First of all, I'd like to say this is a hardware-level question, which is very closely related to the "in" and "out" command in x86 assembly. I have searched for quite some time, but I still haven't ...
2
votes
4answers
490 views

Why do we use to talk about addresses and memory of variable in C?

Why do we use to talk about addresses and memory of variable in C, where in other languages (like in Java, .Net etc) we do not talk about variable address and memory in a program, we will directly use ...
5
votes
3answers
981 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 ...
5
votes
3answers
344 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 ...
-2
votes
1answer
339 views

Any good, easy to learn from books or tutorials for learning assembly? [closed]

I've been a developer since 2009 and I've learnt a lot of languages since, but I've always wanted to understand and be able to code in the lowest level language so I can directly (or at least very ...
5
votes
2answers
875 views

Implementing non-fixed length array support in a compiler

I'm thinking of building a language for PIC microcontrollers. I want to be able to use non-fixed size arrays, like this: Declare the variable as int[] Wait for input from serial connection Make the ...
3
votes
2answers
1k views

will an assembly language book for intel x86 processor be compatible with amd processors?

I'm wanting to get an assembly book to learn assembly, and was wandering if i get a book for intel x86 processor will there be any problems assembling the code on an amd processor?
16
votes
4answers
6k 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 ...
7
votes
1answer
12k 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 ponter and what is its purpose. How does it differ from the stack pointer?
0
votes
2answers
132 views

Is a “build” assembly?

In an old book I have, they say that "build" is either a process of converting source code into executable or the actual result - assembly. Is that correct? Is a build actually the assembly, I mean ...
1
vote
1answer
597 views

Using assembly to write to a file

I am working with a trading application (reading data from the exchange) which generates a bucket load of data on a per second basis. We have different "log-levels" but even the minimal log-level ...
-1
votes
3answers
468 views

How can I get assembly from an EXE? [closed]

Pretty much my only question is the title. Other then that I want to see the code behind small EXEs but I know it's hard to get it to convert to something like c or c++ so why not get assembly.
3
votes
3answers
303 views

Is it possible to use GNU GPL for application that has no source?

I mean, it is possible to create application without source code - for example using HEX editor or some debugger that can assembly instructions (actually every decent debugger can). Creating programs ...
14
votes
3answers
4k 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 ...
9
votes
2answers
848 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 ...
3
votes
5answers
610 views

Are there such thing as assembly SDK's? [closed]

I've never worked in assembly, but I was just curious if SDK's exist for assembly programming. For instance, if I wanted to create a linked list, are there libraries available that have already done ...
1
vote
1answer
1k 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 ...