Questions tagged [immediate-operand]
94 questions
1
vote
2 answers
immediate value encoding in ARM assembly
I'm learning about assembly language right now and I'm a bit confused about how the immediate values are encoded. Can someone explain why the following values are valid: 0xff00ff00, 0xffffffff, 0x007f8000? Also why are the values 0xff0000ff,…

ahahahahana
- 35
- 3
1
vote
2 answers
Why do 32-bit immediates with IMUL give warnings in NASM and errors in GCC?
I am currently investigating some strange behaviour with the imul instruction, because the official Intel manual seems to differ slightly from reality.
The first thing I noticed is that the Intel manual does not consider this example to be a correct…

Treeniks
- 23
- 4
1
vote
1 answer
Error while compiling MOV instruction in ARM assembly
I am using RVDS6_13 compiler and my processor is Cortex X1 (HERA). For a test where I need to do a bit of assembly language programming, I am getting below error in compilation:
Error: A1616E: Instruction, offset, immediate or register combination…

user3565150
- 884
- 5
- 21
- 49
1
vote
0 answers
Detecting potential MASM 64-bit sign extension errors for immediate 32-bit operands (imm32)
I'm trying to write a tool to scan 64-bit assembly code looking for possible sign extension errors.
For example, suppose a 32-bit constant (imm32) is defined as
SOCKET_ERROR_INT EQU 0FFFFFFFFh
Next, call any API that returns a SOCKET_ERROR (32-bit…

vengy
- 1,548
- 10
- 18
1
vote
1 answer
Set on Less Than Immediate Unsigned: Range of representable integers - MIPS
I am currently writing a seminar paper about machine-language and MIPS and when studying the Set on Less Than Immediate Unsigned Instruction I found something weird I don't understand.
The MIPS v5 Documentation (p. 277) states that the 16-Bit…

Lukas Thiersch
- 155
- 2
- 15
1
vote
1 answer
Multiplicative modular inverse using fermat's primality test (Assembly MIPS)
Receive two integers a and p and print x such that ax ≡ 1 (mod p)
p is prime and a is not a multiple of p
The code works perfectly in MARS, but in QTSpim it complains about overlfow (immediate value 825265 out of range) and accuses error when p and…

gmn_1450
- 121
- 4
1
vote
0 answers
How "Immediate" Work In MIPS Architecture?
I just started learning MIPS32 architecture some weeks ago and while I was reading about constants in it, it said that I can add a number which is not in memory or in a register!
For example this:
aadi $s3,$s2,4
If the numbers should be in a reg to…

Pink Cat
- 31
- 5
1
vote
1 answer
Enter a decimal number explicitly in assembly
I find myself often not immediately recognizing if a number is in decimal or in hex (if the hex number doesn't have a prefix or letters). For example, from a previous question a number like 0000000000400078 and not sure which it is.
Is there a way…

samuelbrody1249
- 4,379
- 1
- 15
- 58
1
vote
1 answer
RISC-V: Do 12-bit immediate logical operations operate on the whole register?
I am trying to write a simulator for a RISC-V CPU and can not find a definitve answer to my question.
Let's say I want to use
ANDI rs1, rd, 0xFFF
with rs1 containing 0xFFFFFFFF and the immediate value being 0xFFF.
Does the ANDI operate on the…

Klickmann
- 130
- 8
1
vote
0 answers
Objconv suggests zero-extended immediate but movzx doesn't work
Agner Fog's objconv shows several instances in my source disassembly where a message appears "Note: Immediate operand could be made smaller by zero extension."
For example, it appears right above these two lines:
mov rdi,out_fname_L
mov…

RTC222
- 2,025
- 1
- 20
- 53
1
vote
4 answers
Algorithm for acceptable ARM Cortex-M4F floating-point immediates?
The ARM Cortex-M4F processor has an instruction that will load an immediate constant into a floating-point register, as in:
VMOV S0,+6.75
However, the value of the constant is restricted and must be equal to a value that can be expressed…

Dan Lewis
- 93
- 8
1
vote
1 answer
MIPS I instruction immediate field
The field is used by arithmetic and conditional branch instructions.
First question is:
What would be the range of values which can be stored in an immediate arithmetic instruction and conditional branch?
Second is:
if a MIPS processor has 64…

user3543440
- 45
- 1
- 9
1
vote
2 answers
Fast way to get a valid imm num for arm mov?
Arm mov has a limitation that the immediates must be an 8bit rotated by a multiple of 2, we can write:
mov ip, #0x5000
But we cannot write that:
mov ip, #0x5001
The 0x5000 can be split as 0x5000 + 1, my means, the sum of a valid immediate number…

scvyao
- 143
- 1
- 12
1
vote
1 answer
Understanding ATT Assembly (immediate)
lets say i have the following assembly lines
movl $-1, %edi
movl $1, %edx
What exactly am I storing into %edi/%edx registers.
Basically if I were to convert this code into a C program, would I be initalizing some variables to -1 and 1 because…

ShadyBears
- 3,955
- 13
- 44
- 66
0
votes
0 answers
ARMv8-a GNU assembler error : immediate out of range at operand 3
I am having trouble performing logical instructions on the ARMv8-a architecture.
for example, "and x13, x13, #0x0000CCCC0000CCCC" or "and x13, x13, #0x0A0A0A0A0A0A0A0A" results in an immediate out of range error, but "and x13, x13,…

DAMPER
- 1
- 1