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.
172 questions
-2
votes
3
answers
354
views
What is beyond ordinary c++, when trying to optimize a function?
Backstory:
Writing a QImage to Sixel renderer.
Feel like I have optimized it the best I can using basic c++.
I have heard suggestions here or there that you can utilize things like GPU, SIMD, insert ...
0
votes
0
answers
161
views
How To Share Code Between Assembly Files In A Modular Way
Recently, I started learning Arm64 assembly. The assembler I'm using is the GNU Assembler (GAS). The version of GAS I'm using is GNU assembler (GNU Binutils for Ubuntu) 2.42.
I want to make my code ...
-1
votes
1
answer
136
views
Debugging miscompile [closed]
Recently I encountered an issue at work where a unit test written in C++ would crash only when being compiled with MSVC 2017 (MSVC 2019 and up are fine). I tried to debug this issue and it seems like ...
-3
votes
1
answer
488
views
When making a compiler, what's the best way for compiling to machine code in the backend? [closed]
I know that a lot of compilers use an assembler to compile to machine code, to make an executable (compiled program).
Some people even made their own assemblers, or they just use an existing assembler,...
0
votes
2
answers
287
views
Where to put files (interfaces) that link two independent assemblies: Authentication and Main Program
I'm having an issue with dependencies in a C# app that I'm creating.
I have an assembly for my authentication process, and a separate assembly for starting up the main program once authentication is ...
1
vote
3
answers
277
views
Is an assembly program a procedure itself and does it occupy a stack frame?
If I am correct, an assembly language uses the program stack to store data.
Is it correct that the program stack is partitioned to frames, each of which is for a call to a procedure? So there is no ...
0
votes
2
answers
422
views
Do differences between ATT and Intel formats of assembly languages come from differences between their underlying machine languages?
From Computer Systems: a Programmer's Perspective, about assembly languages:
We see that the Intel and ATT formats differ in the following ways:
The Intel code omits the size designation suffixes. We ...
-3
votes
2
answers
241
views
Why will it take approximately 2 years for Apple to transition Mac to ARM? [closed]
Why will it take that long to transition all Mac software to ARM according to Apple? I thought all they would need to do is to recompile the source code of their apps and rewrite SIMD code from intel ...
12
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 ...
2
votes
1
answer
291
views
How are primitives stored in memory
In my searching although this question seems to get answered a lot, the answers don't really cover what I want to ask.
I'm learning assembly and my question is, in higher level languages e.g C data ...
0
votes
1
answer
161
views
What is meant by /0 in AMD64 specification?
The AMD64 specification talks about /0 with regards to instruction encoding but I don't have a clue what is meant by that. For example, in Volume 3 the ADD instruction has three forms:
ADD reg/mem16,...
52
votes
4
answers
17k
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 ...
0
votes
1
answer
1k
views
Opcodes vs Operands
In laymen's terms, what is the difference between opcodes and operands in assembly language programs? I understand that one involves where to get the data and one involves what is to be performed on ...
-4
votes
2
answers
278
views
Performance question - what are the defects of high level programming languages and compilers that makes assembly still a better choice today [closed]
What I want to know is, how can we still make use of assembly today, in productive manners?
When assembly outperform C, so it would seem practical to write a section of the project in assembly rather ...
-7
votes
1
answer
428
views
Why does the C compiler use memory for simple arithmetic operations
Assume the following C code:
#include <stdio.h>
int main()
{
int a = 5;
int b = 15;
return a + b;
}
Compiling it using gcc creates an assembly code which includes the following:
...
1
vote
2
answers
2k
views
How can I test generated assembly?
I'm working on a C compiler for Linux for the purpose of personal curiosity/fun. How can I test the generated assembly before the compiler is complete enough to do anything useful?
For example, if I ...
0
votes
3
answers
579
views
How to Simulate Control-Flow without using Control-Flow Primitives
Basically, I want to know how to simulate while and if if I'm handling the control flow myself through an array of instructions.
The while loop can be simulated by if, as seen with assembly branching ...
0
votes
0
answers
272
views
How to manage dynamically generated variables in Assembly
Along the lines of How v8 JIT compiler manages dynamically changing variables, wondering how you would go about creating dynamically generated variables in assembly. Not necessarily looking for ...
-1
votes
1
answer
863
views
How to make compiler portable?
I am writing a simple compiler. I have written lexer and parser and it now generates assembly code from given code. Now I need to write an assembler which generates machine code. But the problem is ...
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 ...
-1
votes
1
answer
454
views
Help With Memory Mapped I/O and Hardware Interrupts for Virtual Machine
I've been working on a 24-bit virtual machine to help me learn more about computers and programming in general and was hoping to find a bit more information on memory mapped input/output and hardware ...
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
1
answer
2k
views
Where are the stacks for the other threads located in a process virtual address space?
The following image shows where the sections of a process are laid out in the process's virtual address space:
You can see that there is only one stack section (since this process only has one thread ...
1
vote
1
answer
420
views
Intel Memory Addressing Form
I'm am trying to understand machine code memory addressing for x86, and I've encountered two opposing general forms for addressing (using the ModRM and SIB bytes).
Most unofficial resources I consult ...
-10
votes
1
answer
13k
views
Convert program in Java to Assembler? [closed]
I have to do a program to school in Assembler but we did just a few basic things. Is it possible to write code in Java and convert it to Assembler?