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
5 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 ...
user avatar
  • 231
1 vote
1 answer
19 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/...
user avatar
  • 11
-2 votes
1 answer
47 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 ...
user avatar
-1 votes
1 answer
34 views

Computer Architecture MIPS assembler with predictors

This MIPS code is given: ...
user avatar
  • 11
0 votes
2 answers
46 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 ...
user avatar
1 vote
1 answer
47 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 #...
user avatar
0 votes
1 answer
32 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
41 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 ...
user avatar
1 vote
1 answer
37 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 ...
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 ...
user avatar
0 votes
0 answers
48 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 ...
user avatar
  • 113
0 votes
2 answers
139 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 ...
user avatar
  • 125
1 vote
1 answer
33 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 ...
user avatar
  • 113
0 votes
1 answer
38 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 ...
user avatar
  • 125
0 votes
1 answer
64 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!...
user avatar
1 vote
0 answers
29 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 ...
user avatar
  • 111
1 vote
1 answer
156 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 ...
user avatar
  • 341
0 votes
0 answers
54 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 ...
user avatar
  • 101
0 votes
1 answer
73 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 ?
user avatar
0 votes
0 answers
26 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.
user avatar
1 vote
1 answer
56 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 ...
user avatar
  • 341
1 vote
0 answers
58 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 . ...
user avatar
  • 11
0 votes
1 answer
53 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 ...
user avatar
1 vote
0 answers
20 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 ...
user avatar
1 vote
2 answers
102 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 ...
user avatar
0 votes
0 answers
64 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 ...
user avatar
  • 101
2 votes
0 answers
27 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 ...
user avatar
0 votes
3 answers
67 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 ...
user avatar
0 votes
1 answer
51 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 ...
user avatar
2 votes
0 answers
63 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?
user avatar
0 votes
1 answer
92 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? ...
user avatar
0 votes
1 answer
233 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, ...
user avatar
  • 3
8 votes
5 answers
779 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 ...
user avatar
  • 233
0 votes
1 answer
711 views

Direct and Associate Cache - Offset, Index, and Tag

I have two questions: ...
user avatar
2 votes
1 answer
27 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 \...
user avatar
  • 209
0 votes
2 answers
103 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
1k 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
739 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 ...
user avatar
2 votes
1 answer
77 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 ...
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 ...
user avatar
  • 576
4 votes
3 answers
2k 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 ...
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 ...
user avatar
2 votes
1 answer
70 views

Prove that the next multiple of 4 is obtained using the next formula

I was reading an assembly procedure that needed to align addresses on 4 bytes boundary for performance reasons so it has used the next statement that i formulated as a theorem to be proven. Let $s$ ...
user avatar
0 votes
1 answer
130 views

The instructions a Stack Machine has

Trying to figure out which instructions a stack machine has, and wanted to clarify / reassure that these are in fact all of them. push onto stack ...
user avatar
19 votes
6 answers
11k views

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?...
user avatar
  • 193