
Basic Data Operation

This is a basic data operation. It represents a fundamental action on a basic data type.
You may see other such operations in the Basic Data Operations category, or:


Integer Operations
Arithmetic |
Comparison
Boolean Operations
Bitwise |
Logical
String Operations
Concatenation |
Interpolation |
Comparison |
Matching
Memory Operations
Pointers & references |
Addresses




Task

Demonstrate how to get the address of a variable and how to set the address of a variable.




procedure address()
object V
integer addr4   -- stored /4 (assuming dword aligned, which it will be)
#ilASM{
    [32]
        lea eax,[V]
        shr eax,2
        mov [addr4],eax
    [64]
        lea rax,[V]
        shr rax,2
        mov [addr4],rax
    []
      }
    if machine_bits()=32 then
        poke4(addr4*4,123)
    elsif machine_bits()=64 then
        poke8(addr4*4,123)
    end if
    ?V
    if getc(0) then end if
end procedure
 
address()
