Programming questions are off-topic here. Do not ask questions about how to write code in assembly. However, conceptual questions about how coding in assembly is different may be appropriate. See our help centre for the scope of this site.
Questions tagged [assembly]
65 questions
22
votes
7 answers
Given a specific computer system, is it possible to estimate the actual precise run time of a piece of Assembly code
this is a piece of Assembly code
section .text
global _start ;must be declared for using gcc
_start: ;tell linker entry point
mov edx, len ;message length
mov ecx, msg ;message to write
mov ebx, 1 …
JJJohn
- 588
- 4
- 11
19
votes
6 answers
Why do compilers produce assembly code?
Assembly language is converted in to machine language by assembler. Why would a compiler convert high-level language to assembly? Can't it directly convert from the high-level language to machine code?
CODERSAM
- 293
- 1
- 2
- 4
10
votes
2 answers
Purpose of the IRQ on a 6502
I've been researching the NES lately. Why does the IRQ/BRK Instruction exist on the 6502? All it seems to do is say "no more IRQs," jump to a random ROM address, and store the current state.
When is this useful? What does this accomplish?
Anonymous Coder
- 103
- 8
10
votes
2 answers
Why is static recompilation not possible?
I'm researching static recompilation but there doesn't seem to be too much information about the subject. I've heard that dynamic recompilation (emulation) can be up to 6 times slower than native assembly, but I'm curious why we aren't able to…
LetsdothisEpic
- 203
- 2
- 6
9
votes
5 answers
Are assembly languages untyped?
I'm writing my Bsc thesis about type systems of various languages and I want to have a short section about assembly languages. Initially I thought I'll bring up assembly as a counter example to languages with advanced type systems. My goal was to…
A. Sallai
- 243
- 1
- 6
8
votes
2 answers
Assembly writer vs compiler in VLIW architecture
I read this sentence in a book:
In VLIW architecture, the compiler/and or assembly writer chooses instructions that can be executed in parallel.
What is the difference between assembly writer and compiler? Would an assembly writer also mean the…
Dasha Sham
- 83
- 5
7
votes
6 answers
How AlphaDev improved sorting algorithms?
On the 7th of June 2023, Google DeepMind released an article about AlphaDev. AlphaDev is an evolution of AlphaZero (used to beat world champions at Go, Chess and Shogi), and it can produce assembly code for a task if said task is represented as a…
nico263nico
- 81
- 1
- 5
6
votes
7 answers
Essential difference between Assembly languages to all other programming languages
I understand that any assembly programming language has so little abstraction, so that one who programms with it (OS creator, hardware driver creator, "hacker" and so on), would have to know the relevant CPU's architecture pattern very well.
For me,…
user109446
5
votes
5 answers
How is an Assembly Language Processed by a CPU's Circuitry?
I'd like to have a bit more understanding of how, on a circuitry/hardware level, an assembler program works.
I think I have a very broad-brush understanding of how a CPU would process machine code on a hardware level. Please bear with me for this…
Major
- 51
- 1
- 3
3
votes
1 answer
How to allocate memory in NASM without C functions (x64)?
So I'm using NASM on linux and I was curious how this is done. All the info I can find online uses functions from C like malloc(). Can this be done purely with assembly code? Perhaps via a system call?
Thanks.
Lonely Lad
- 31
- 2
3
votes
1 answer
Patterson & Hennessy, Computer Organization and Design, 5th edition, Question for Ex. 2.3
I am stumbling over the Exercise 2.3 of Chapter 2, i.e.:
For the following C statement, what is the corresponding MIPS assembly
code? Assume that the variables f, g, h, i, and j are assigned to
registers $s_0$, $s_1$, $s_2$, $s_3$, and $s_4$,…
lordsnyder
- 33
- 3
3
votes
1 answer
What makes 'interrupt vectors' vectors?
I've recently been learning about interrupt vectors, partly from this Wikipedia page.
I've understood that different processors will have different types of interrupts, and the interrupt vector table stores the information about where code…
Jojo
- 133
- 4
3
votes
1 answer
Detecting Data and Control Hazards for a mips 5 stage pipeline
I'm practicing data and control dependencies, but having trouble detecting them. For this example, I'm assuming this pipeline is fully bypassed (with forwarding). I think the only data dependency is i3 on i2. Is this correct? I also don't know how…
User9123
- 31
- 1
2
votes
1 answer
Calculate the CPI of a program
foo:
addi $t0,$zero,1
addi $v0,$zero,0
outer:
beq $t0,$zero,exitout
sll $t0,$t0,0
addi $t1,$zero,0
add $t2,$zero,$a0
addi $t0,$zero,0
inner: addi $t8,$a1,-1
slt $t9,$t1,$t8
beq $t9,$zero,outer
sll $t0,$t0,0
addi $v0,$v0,1
lw $t8,0($t2)
lw…
First_1st
- 31
- 2
2
votes
0 answers
What is "orthogonality" in the context of Instruction Encoding?
What does it mean by "orthogonality" in the context of Instruction Encoding?
Why CISC Architecture is orthogonal while RISC is not?
David Roonie
- 33
- 4