I think you are changing the address instead of the value. Try something similar to this:
Code:
// The following function generates no errors,
// but when called does not effect the variable passed.
// If the __asm lines are put in the main program, however
// and used with integer num, it works.
// How do I use assembly lines to access variables passed
// to functions? =|
void zapit (int &num) {
__asm mov di, num
__asm mov ecx, [di]
__asm xor ecx, ecx
__asm mov [di], ecx
}
I'm not sure if I have the correct register names. I'm using an old compiler. Here is what I used:
Code:
void zapit (int &num) {
__asm mov di, num
__asm mov ax, [di]
__asm xor ax, ax
__asm mov [di], ax
}