[ELI5] I need help in assembly x86

290 views

I wrote a basic code, here it is in summery:
**data segment:**
arr db 1
atr db 100

**code segment:**
mov bl,arr
mov bl,\[arr\]

for some reason the two lines in the code segment do the same thing, is that what they’re supposed to do? I am sorry if its a dumb question I’ve just began learning, but from what I understood up til now is that for example \[arr\] where arr is for example “1” would return the value in the address of “1” whatever that may be(although I thought it would return the value of atr since its located in ds:\[1\]) and not the value “1”. What am I doing wrong?

In: 0

2 Answers

Anonymous 0 Comments

What exactly is it you’re trying to do? In assembly mov is a move command and it copies data from one register to another. In this case, it looks like your moving ARR into BL.

Your first parameter needs to be a register or memory address where you want to move the new data to, and the second parameter needs to be a register memory address or constant that you’re trying to load into that first parameter

For instance

mov eax, ebx – puts the value of EBX into EAX

mov byte ptr[var], 5 – creates a byte at var and stores 5 into it

You are viewing 1 out of 2 answers, click here to view all answers.