Questions tagged [zero-extension]
28 questions
1
vote
1 answer
Problem to store value from register into memory, ARM 32 bit
I am new in ARM and assembler. I tried to write a simple program to store value from register to memory.
string:
.ascii "%d\012\000"
.align 2
var1:
.word 0
.align 4
.text
.global main
main:
push {ip, lr}
…

Encapsulation
- 13
- 3
1
vote
1 answer
Translate assembly instructions to c++
I am having trouble translating the below assembly in to c++
MOVZX EAX, DX
Where EDX is a 32bit register. I need to get the lowest 16 bits(DX).
I've tried the following:
unsigned edx = 0x123ABCDE;
unsigned dx = (edx>>16) & 0xff;
I expect to get…

1ntgr
- 126
- 2
- 8
0
votes
0 answers
random effects test in GLMM or zero-inflated mixed model
I`m considering several models such as GLM, GLMM, zero-inflated, and zero-inflated mixed in the count data.
All my work was done in R.
Prior studies confirmed that there is a problem of zero excess and over-dispersion as a consideration in counter…

나수빈
- 1
0
votes
1 answer
From word to byte
What can I do to take only the right digits of the num ? I tried byte ptr but it changed the vale. Is it possible to delete the 2 left digits in a register?
edit:
the number is written within a register so by right and left i meant the high order…

user17341742
- 59
- 4
0
votes
0 answers
x86 assembly - mov and movzx from dword to qword?
I'm testing the following code:
.intel_syntax noprefix
.data
.Ltest_data:
.byte 0xEF, 0xBE, 0xAD, 0xDE, 0xBE, 0xBA, 0xED, 0xFE
.text
...
movzx rax, BYTE PTR[.Ltest_data] # 0xEF
movzx rax, WORD PTR[.Ltest_data] # 0xBEEF
movsx rax,…

Martin
- 940
- 6
- 26
0
votes
2 answers
Moving a value of a lesser size into a register
I have stored a one-byte value of 8 and I'd like to move that into the rax register. I'm currently doing this with movzx to zero-extend the byte:
.globl main
main:
push %rbp
mov %rsp, %rbp
movb $8, -1(%rbp)
movzx -1(%rbp), %rax <--…

samuelbrody1249
- 4,379
- 1
- 15
- 58
0
votes
0 answers
when do use extension move instruction in assembly language
I saw movw %dx (%eax) on my textbook, and I'm wondering why use movw rather than movswl or movzwl here?
I think that there are 2 bytes in %dx and 4 bytes in (%eax) (for a 32-bit machine), so it needs an extension?

MusicalChicken
- 119
- 10
0
votes
1 answer
MOV 8 bit to 16 bit register (al to bx)
How can I fix the problem of moving 8 bit value to the BX register (16 bit)?
mov al, 10h
mov bx, al
for this I get:
operands do not match: 16 bit and 8 bit register

Slack Bot
- 64
- 1
- 9
0
votes
1 answer
How to isolate byte and word array elements in a 64-bit register
I can tell this is a super simple problem but I have yet to figure it out. Basically, I just want to be able to take one element an array and add and subtract some numbers from it using registers and then put the result into my result…

Austin25
- 3
- 2
0
votes
1 answer
shift right and shift left assembly language
If I want to say for example bx is a number:
shl bx,1
shr bx,1
What will be the new bx value? Does it stay the same?

Amer Syouri
- 13
- 3
0
votes
1 answer
How is MOVSX instruction sign extending input in this case?
I have the following disassembly:
[dest] = d5 cd e8 ca 68
movzx eax, [ebp+dest]
# value of edx at this point is: F7FBB898
movsx edx, al
# value of edx after this is: FFFFFFD5
# [ebp+var_E] stores 0
movzx eax, [ebp+var_E]
movsx eax, al
# eax…

Neon Flash
- 3,113
- 12
- 58
- 96
0
votes
0 answers
Does a 32bit move zero out higher bits in a 64bit register?
Possible Duplicate:
Why do most x64 instructions zero the upper part of a 32 register
If I do a movl something, %eax and rax contained something like 0x1234567812345678, will it automatically zero out the top half of rax?

tangrs
- 9,709
- 1
- 38
- 53
-2
votes
1 answer
Question regarding converting assembly to c -- specifically what the movzbl instruction does?
I am trying to figure out what this in assembly would mean in C:
movq 16(%rdi), %rdx
movq 16(%rsi), %rax
movzbl (%rdx), %edx
I am mostly confused about what the movzbl (%rdx), %edx will do. Thanks!

210312312
- 45
- 3