File size: 1,004 Bytes
806d4b5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58

class Person
{
  U8 first    [32];
  U8 last     [32];
  U8 address1 [64];
  U8 address2 [64];
  U8 city     [32];
  U8 state_zip[32];
};

U0 OffsetDemo1()
{
  Person *p=MAlloc(sizeof(Person));
  StrCpy(p->first,    "Terry");
  StrCpy(p->last,     "Davis");
  StrCpy(p->address1, "8144 Sickle Lane");
  StrCpy(p->address2, "");
  StrCpy(p->city,     "Las Vegas");
  StrCpy(p->state_zip,"NV 89128");
}

U(&OffsetDemo1,34);
PressAKey;

/*

x86 has signed 8-bit  displacements
    and signed 32-bit displacements.

This example uses 8-bit negative displacements.

*/

class Person
{ $=-128;
U8 first    [32];
U8 last     [32];
U8 address1 [64];
U8 address2 [64];
U8 city     [32];
U8 state_zip[32];
};

U0 OffsetDemo2()
{
  Person *p=MAlloc(sizeof(Person))(I64)+128;
  StrCpy(p->first,    "Terry");
  StrCpy(p->last,     "Davis");
  StrCpy(p->address1, "8144 Sickle Lane");
  StrCpy(p->address2, "");
  StrCpy(p->city,     "Las Vegas");
  StrCpy(p->state_zip,"NV 89128");
}

U(&OffsetDemo2,34);
PressAKey;