Rev 2811 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2811 | Rev 2839 | ||
---|---|---|---|
1 | //mem.Init |
1 | //mem.Init |
2 | dword mem_Init() |
2 | dword mem_Init() |
3 | { |
3 | { |
4 | $push ebx |
4 | $push ebx |
5 | $mov eax, 68 |
5 | $mov eax, 68 |
6 | $mov ebx, 11 |
6 | $mov ebx, 11 |
7 | $int 0x40 |
7 | $int 0x40 |
8 | 8 | ||
9 | $pop ebx |
9 | $pop ebx |
10 | return EAX; |
10 | return EAX; |
11 | } |
11 | } |
12 | 12 | ||
13 | //mem.Alloc |
13 | //mem.Alloc |
14 | dword mem_Alloc(dword size) |
14 | dword mem_Alloc(dword size) |
15 | { |
15 | { |
16 | $push ebx |
16 | $push ebx |
17 | $push ecx |
17 | $push ecx |
18 | $mov eax, 68 |
18 | $mov eax, 68 |
19 | $mov ebx, 12 |
19 | $mov ebx, 12 |
20 | $mov ecx, size |
20 | $mov ecx, size |
21 | $int 0x40 |
21 | $int 0x40 |
22 | 22 | ||
23 | $pop ecx |
23 | $pop ecx |
24 | $pop ebx |
24 | $pop ebx |
25 | return EAX; |
25 | return EAX; |
26 | } |
26 | } |
27 | 27 | ||
28 | //mem.ReAlloc |
28 | //mem.ReAlloc |
- | 29 | inline fastcall dword mem_ReAllocR( ECX, EDX) |
|
- | 30 | { |
|
- | 31 | $mov eax, 68 |
|
- | 32 | $mov ebx, 20 |
|
- | 33 | $int 0x40 |
|
- | 34 | } |
|
- | 35 | ||
29 | stdcall dword mem_ReAlloc(dword mptr, size) |
36 | stdcall dword mem_ReAlloc(dword mptr, size) |
30 | { |
37 | { |
31 | //$push ebx ecx edx |
- | |
32 | $push ebx |
38 | $push ebx |
33 | $push ecx |
39 | $push ecx |
34 | $push edx |
40 | $push edx |
35 | $mov eax, 68 |
41 | $mov eax, 68 |
36 | $mov ebx, 20 |
42 | $mov ebx, 20 |
37 | $mov ecx, size |
43 | $mov ecx, size |
38 | $mov edx, mptr |
44 | $mov edx, mptr |
39 | $int 0x40 |
45 | $int 0x40 |
40 | 46 | ||
41 | $pop edx |
47 | $pop edx |
42 | $pop ecx |
48 | $pop ecx |
43 | $pop ebx |
49 | $pop ebx |
44 | //$pop edx ecx ebx |
- | |
45 | return EAX; |
50 | return EAX; |
46 | } |
51 | } |
47 | 52 | ||
48 | //mem.Free |
53 | //mem.Free |
49 | void mem_Free(dword mptr) |
54 | void mem_Free(dword mptr) |
50 | { |
55 | { |
51 | $push eax |
56 | $push eax |
52 | $push ebx |
57 | $push ebx |
53 | $push ecx |
58 | $push ecx |
54 | $mov eax, 68 |
59 | $mov eax, 68 |
55 | $mov ebx, 13 |
60 | $mov ebx, 13 |
56 | $mov ecx, mptr |
61 | $mov ecx, mptr |
57 | $test ecx, ecx |
62 | $test ecx, ecx |
58 | $jz end0 |
63 | $jz end0 |
59 | $int 0x40 |
64 | $int 0x40 |
60 | @end0: |
65 | @end0: |
61 | $pop ecx |
66 | $pop ecx |
62 | $pop ebx |
67 | $pop ebx |
63 | $pop eax |
68 | $pop eax |
64 | } |
69 | } |
65 | 70 | ||
66 | //stdcall dword ?? |
71 | //stdcall dword ?? |
67 | inline fastcall mem_Move( EDI, ESI, ECX) |
72 | inline fastcall mem_Move( EDI, ESI, ECX) |
68 | { |
73 | { |
69 | asm { |
74 | asm { |
70 | mov eax, ecx |
75 | mov eax, ecx |
71 | cmp edi, esi |
76 | cmp edi, esi |
72 | jg l1 |
77 | jg l1 |
73 | je l2 |
78 | je l2 |
74 | sar ecx, 2 |
79 | sar ecx, 2 |
75 | js l2 |
80 | js l2 |
76 | rep movsd |
81 | rep movsd |
77 | mov ecx, eax |
82 | mov ecx, eax |
78 | and ecx, 3 |
83 | and ecx, 3 |
79 | rep movsb |
84 | rep movsb |
80 | jmp short l2 |
85 | jmp short l2 |
81 | l1: lea esi, dsdword[ esi+ecx-4] |
86 | l1: lea esi, dsdword[ esi+ecx-4] |
82 | lea edi, dsdword[ edi+ecx-4] |
87 | lea edi, dsdword[ edi+ecx-4] |
83 | sar ecx, 2 |
88 | sar ecx, 2 |
84 | js l2 |
89 | js l2 |
85 | std |
90 | std |
86 | rep movsd |
91 | rep movsd |
87 | mov ecx, eax |
92 | mov ecx, eax |
88 | and ecx, 3 |
93 | and ecx, 3 |
89 | add esi, 3 |
94 | add esi, 3 |
90 | add edi, 3 |
95 | add edi, 3 |
91 | rep movsb |
96 | rep movsb |
92 | cld |
97 | cld |
93 | l2: |
98 | l2: |
94 | } |
99 | } |
95 | } |
100 | } |