Questions tagged [assembly]

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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
23 views

I'm having trouble storing the value in R0 into the correct memory location (LC-3 Assembly)

Here is my LC-3 Assembly code. It is designed to add up the 10 values in x3100 through x3109 and store them in x310A. It correctly adds the values, storing the total in R0, however I cannot seem to ...
Leo's user avatar
  • 1
1 vote
1 answer
40 views

Why do we shift by three in RISC-V loops?

In this youtube video, the instructor explained some basic code in RISC-V assembly, but i didn't understand why in the first line, he is shifting i by 3. Why do we have to multiply it by 8?? I feel ...
Shinobi San's user avatar
1 vote
3 answers
118 views

In theory, is it impossible, or possible (although ridiculously impractical), to inline recursive functions?

In an older question I asked about stack, the statement came up that recursive functions cannot be inlined (link). I am interested in whether this statement is actually true or not. I understand that ...
BipedalJoe's user avatar
1 vote
2 answers
69 views

Stack Program Counter

I am trying to understand stacks a little better. I don't understand why the content of the program counter is saved on the stack for the function call (call), but not for a jump (jmp)? can someone ...
DanielJackson1's user avatar
9 votes
2 answers
3k views

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 ...
LetsdothisEpic's user avatar
0 votes
0 answers
20 views

RISCV Mem Virtualization: Sv57x4 58-bit VA is longer than 56-bit PA, how to form it?

I'm exploring RISCV Priveleged Spec and got confused with memory virtualization (especially hypervisor part and two-stage addr translation). How can we form Sv57x4 Virtual Address (VA) for G-stage if ...
katzesaal's user avatar
1 vote
1 answer
42 views

Is the executable always loaded to the same place in the text segment?

I am reading a book about data architecture, and I am wondering about the text segment and the memory adresses. In one example(assembly using ARM) where the code was compiled there were adresses to ...
user394334's user avatar
0 votes
2 answers
77 views

Why scopes in general do not have prologue and epilogue instructions?

Data only accessible in a scope, seems to still be maintained by the stack. What is the reason that entering and exiting scopes (in general) does not do the same "prologue and epilogue" ...
user52174's user avatar
0 votes
2 answers
55 views

Is solving Binary String Matching equivalent to Solving All type of string matching?

This might be an irritating, naive question, but please bear with me. If an algorithm/code solves the string matching problem for a binary string, does not it imply that the algo/code actually solves ...
Michael's user avatar
  • 291
1 vote
1 answer
22 views

Decomposing large bit mult or exp into smaller bit operations

Imagine a machine that can only hold N-bit values (N-bit uint). The machine can also calculate the 2N-bit result of two operations: mult, exp. The 2N-bit result is stored across 2 N-bit values (high/...
1m1's user avatar
  • 11
-2 votes
1 answer
50 views

Approximate x*(a/b)^(c/d) using integer arithmetic only (assembler)

0 < x,a,b,c,d < M are all positive integers (uint64). also, a<b if that helps. we have assembler (integer only) operations available (e.g. division only yields integers). we want to ...
imi kim's user avatar
  • 101
-1 votes
1 answer
48 views

Computer Architecture MIPS assembler with predictors

This MIPS code is given: ...
Pol's user avatar
  • 11
0 votes
2 answers
89 views

Are all CPU computations done using registers?

From my understanding, a CPU register is a temporary storage or working location built into the CPU itself. The CPU includes some functional units such as the ALU (which is part of the chip, as far as ...
wrongbyte's user avatar
1 vote
1 answer
60 views

Boot Loaders, Boot Sectors, BIOS, and GRUB

Again, I must apologize if this is "easily googlable". I have tried. My understanding is that the BIOS typically looks for the magic number 0x55aa at the end of a 512 byte sector (so bytes #...
prss98408's user avatar
0 votes
2 answers
90 views

Assembly language addressing mode instructions

I am studying assembly language. I feel very difficult in understanding few instruction. ADD R1,R2,[R3] ADD R1, R2, R3 What is the difference between these two instructions. I think second instruction ...
user avatar
0 votes
1 answer
57 views

How do data registers work in assembly programming?

I'm learning assembly programming and I can't seem to get my head around the register usage, as I'm using emu8086 which emulates old 8086 processors. According to 8086 (16-bit architecture) the four ...
Uzair Ahmed Nasir's user avatar
1 vote
1 answer
46 views

What happens if 2 processor try to access the same memory in one clock cycle?

Assume a parralled adder program: CPU0: ADD sum,eax;or LOCK ADD sum,eax CPU1: ADD sum,eax;or LOCK ADD sum,eax If these 2 instructions are issued in the same clock ...
Zackham's user avatar
  • 13
0 votes
0 answers
20 views

Is arithmetic/constants code optimization a function of the Language/Compiler/CPU/ALU/OS and what languages implement such features in itself?

Take the following case ...
newInt1x1's user avatar
0 votes
0 answers
58 views

Can you decompile from code that was written in assembly?

I've been reading a little about decompilers, and I think I get the general idea. I understand that I could start with either assembly or machine code, and then I'd have a decompiler which would ...
Joe's user avatar
  • 113
0 votes
2 answers
377 views

How does a CPU do function calls?

Besides basic instructions for a general-purpose computer (binary arithmetic, move instruction, and jump on condition), it seems you can't implement a universal turing machine (is that even the right ...
theDoctor's user avatar
  • 113
1 vote
1 answer
105 views

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 ...
Joe's user avatar
  • 113
0 votes
1 answer
44 views

How did 8-bit computers (Intel 8088) iterate numbers beyond 256?

I never recall any problem making FOR loops in BASIC to 10000 on old IBM PC computers, but how does it work at the machine level when the number in the data register is (presumably) limited to a ...
theDoctor's user avatar
  • 113
0 votes
1 answer
162 views

Why are lw and sw byte addressable but jump and beq word addressable?

I am refering to MIPS (32 bits). Is there any particular reason that when loading or storing a word, we address memory in bytes, but when we jump or branch using beq we address memory in words? Thanks!...
pgiouroukis's user avatar
1 vote
0 answers
75 views

Number of stall cycles when there is only EX/MEM pipeline registers or only MEM/WB pipeline register

I am working on a problem which is related to The processor. The problem is the problem 4.12 in the book whose title is "Computer Organization and Design". The problem has the assumption as ...
Hoang Nam's user avatar
  • 111
1 vote
1 answer
375 views

Manipulating stack pointer in assembly

I have written an assembly program to store digits in a stack. And to print the digits I have used loop2: mov ah,2 int 21h sub cl,1 jnz loop2 But this would only ...
kiv's user avatar
  • 339
0 votes
0 answers
75 views

How does the assembler translate english assembly to binary machine code instructions?

My assumptions (please correct me if anything in this part is wrong including wrong usages of jargons) In MIPS instructions, add t1 t2 t3 translates to ...
Acy's user avatar
  • 101
0 votes
1 answer
123 views

Are EAX , EBX registers 64 bit in length in modern processors [closed]

The EAX, EBX and ECX registers on a cpu are they 64 bits for a 64-bit cpu ?
Monu Didi's user avatar
0 votes
0 answers
27 views

Why are registers name in assembly cryptic

Why are registers named so short - EAX, EBX,...etc They could have easily made the names more descriptive rather than encrypted like that.
Amit wadhwa's user avatar
1 vote
1 answer
77 views

Addressing mode in 8086

I'm a beginner learning about Assembly language and I was doing questions where I have to identify different addressing mode in 8086 processor. One such instruction is: mov ah,09h Here the source ...
kiv's user avatar
  • 339
1 vote
0 answers
168 views

purpose of stack segment in assembly language

The code snippet below is the "beginning lines of an assembly language program" used to display a single line string . ...
Tina's user avatar
  • 11
0 votes
1 answer
66 views

What will a given CPU architecture do in the event that we were to invert all of the instruction bits to a given instruction?

Given an arbitrary CPU - Architecture and its instruction set... What would be the outcome of the given inverted instruction within that Architect? For simplicity, let's use an 8-bit CPU architecture ...
Francis Cugler's user avatar
1 vote
0 answers
27 views

How does an assembler manage varying offsets when using a literal pool?

I am trying to write a simple multi-pass assembler. Wikipedia states that: Multi-pass assemblers create a table with all symbols and their values in the first passes, then use the table in later ...
Pop Flamingo's user avatar
1 vote
2 answers
114 views

Why can't we compile 8086 Assembily for all OSs from any OS?

If Mac OS, Linux, and Windows (mostly) all use Intel's 8086 64 bit instruction set, why can't we compile 8086 64 assembly from any operating system to any other operating system? (e.g. compile a Mac ...
maxbear123's user avatar
0 votes
0 answers
96 views

Unbanked access, banked access and common memory access

What are they and what are their differences? Unbanked access Banked access Common memory access [EDIT] This question is originated from my reading of MPLAB XC8 PIC Assembler User's Guide where the ...
KMC's user avatar
  • 101
3 votes
1 answer
87 views

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 ...
User9123's user avatar
0 votes
3 answers
75 views

CPU Registers and Computation

How exactly does the control unit in the CPU retrieves data from registers? Does it retrieve bit by bit? For example if I'm adding two numbers, A+B, how does the computation takes place in memory ...
Pratheek R Pai's user avatar
0 votes
1 answer
70 views

Is it possible to modify the linux assembler in order to modify what fuctions do?

I was wondering if it were possible to modify the linux assembler in order to change the function of "-" to "+" and vice versa. I was also wondering if this would affect the whole system making it ...
david david's user avatar
2 votes
0 answers
72 views

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's user avatar
0 votes
1 answer
142 views

RAM and ROM confusion

we know RAM contains instruction for we ask computer to do operations we know ROM contains instructions which for computer to work does this mean RAM contains address of instruction sitting in ROM? ...
wannabeprogrammer's user avatar
0 votes
1 answer
313 views

Can a 32-bit processor work with a 64-bit size word?

In a 32-bit byte addressable memory system, each "row" has 4 bytes and each byte has a 32-bit address. My question is: can I read and/or write word of length 64 bits from/to memory? In other terms, ...
OmarAI's user avatar
  • 3
8 votes
5 answers
1k views

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 ...
A. Sallai's user avatar
  • 233
0 votes
1 answer
1k views

Direct and Associate Cache - Offset, Index, and Tag

I have two questions: ...
Hawkeye's user avatar
2 votes
1 answer
30 views

Names of power-of-two bit operations on bitsets that would not assume any number interpretation

Three commonly used functions when it comes to bit manipulation are : is_pow2: Checking that an integer is a power-of-two (only one bit is set): $00010000 \...
Vincent's user avatar
  • 221
0 votes
2 answers
116 views

Do compilers of high programming languages always compile them directly to machine code?

As an amateur Bash/JavaScript scripter who never wrote one sentence in Assembly, I ask: Do compilers of high programming languages always compile them directly to machine code, or are there cases ...
user avatar
6 votes
7 answers
2k views

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 ...
user avatar
2 votes
2 answers
932 views

Does assembly language get translated to binary code? If so, is assembly language portable across machines?

I've tried to find the answer through Google but I've come across conflicting uses of terminology, so I just wanted to be absolutely clear. Here is my understanding: High level code written in a ...
James Ronald's user avatar
2 votes
1 answer
82 views

Understanding addition overflows when performing full, signed multiplication of two 64-bit numbers

I am close to solving question 3.59 from Computer Systems: A Programmer's Perspective 3rd Editionby Randal E. Bryant and David R. O'Hallaron, however I am having difficulties with understanding the ...
Dorik's user avatar
  • 23
22 votes
7 answers
6k views

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 ...
JJJohn's user avatar
  • 588
4 votes
5 answers
3k views

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 ...
Major's user avatar
  • 41
8 votes
2 answers
2k views

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 ...
Dasha Sham's user avatar