2016 Update

This commit is contained in:
Tina Müller 2016-12-05 22:15:40 +01:00
parent 948b86eafa
commit dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions

View file

@ -1,4 +1,5 @@
{{basic data operation}}
Demonstrate how to get the address of a variable
and how to set the address of a variable.
;Task:
Demonstrate how to get the address of a variable and how to set the address of a variable.
<br><br>

View file

@ -0,0 +1,3 @@
LA R3,I load address of I
...
I DS F

View file

@ -0,0 +1,7 @@
USING MYDSECT,R12
LA R12,I set @J=@I
L R2,J now J is at the same location as I
...
I DS F
MYDSECT DSECT
J DS F

View file

@ -0,0 +1,2 @@
> addressof( x );
18446884674469911422

View file

@ -0,0 +1,2 @@
> pointto( 18446884674469911422 );
x

View file

@ -0,0 +1,6 @@
> addressof( sin( x )^2 + cos( x )^2 );
18446884674469972158
> pointto( 18446884674469972158 );
2 2
sin(x) + cos(x)

View file

@ -1 +1,9 @@
my $x; say $x.WHERE;
my $x;
say $x.WHERE;
my $y := $x; # alias
say $y.WHERE; # same address as $x
say "Same variable" if $y =:= $x;
$x = 42;
say $y; # 42

View file

@ -0,0 +1,24 @@
Option Explicit
Declare Sub GetMem1 Lib "msvbvm60" (ByVal ptr As Long, ByRef x As Byte)
Declare Sub GetMem2 Lib "msvbvm60" (ByVal ptr As Long, ByRef x As Integer)
Declare Sub GetMem4 Lib "msvbvm60" (ByVal ptr As Long, ByRef x As Long)
Declare Sub PutMem1 Lib "msvbvm60" (ByVal ptr As Long, ByVal x As Byte)
Declare Sub PutMem2 Lib "msvbvm60" (ByVal ptr As Long, ByVal x As Integer)
Declare Sub PutMem4 Lib "msvbvm60" (ByVal ptr As Long, ByVal x As Long)
Sub Test()
Dim a As Long, ptr As Long, s As Long
a = 12345678
'Get and print address
ptr = VarPtr(a)
Debug.Print ptr
'Peek
Call GetMem4(ptr, s)
Debug.Print s
'Poke
Call PutMem4(ptr, 87654321)
Debug.Print a
End Sub

View file

@ -0,0 +1 @@
movl my_variable, %eax

View file

@ -0,0 +1,7 @@
call eip_to_eax
addl $_GLOBAL_OFFSET_TABLE_, %eax
movl my_variable@GOT(%eax), %eax
...
eip_to_eax:
movl (%esp), %eax
ret