Machinarius
Machinarius

Reputation: 3731

Visual Studio Inline assembler not working as expected

Is

MOV MUL_AXB[EBX * 4], EAX

supposed to actually change the effective MUL_AXB address?

I have declared MUL_AXB as

int* MUL_AXB;

on the global scope after the using statements and i have assigned it a value with

MUL_AXB = (int*) memset(malloc(size), 0, size);

Any insight on this issue is highly appreciated.

Upvotes: 0

Views: 63

Answers (1)

interjay
interjay

Reputation: 110069

What you are doing will write in memory somewhere past the mul_axb pointer, causing bad things to happen.

To actually write into the allocated array, you need to load the pointer into a register first. Assuming this is 32-bit code:

mov edx, [mul_axb]
mov [edx + ebx*4], eax

Upvotes: 2

Related Questions