-
Notifications
You must be signed in to change notification settings - Fork 0
/
subProcs.asm
71 lines (48 loc) · 1.1 KB
/
subProcs.asm
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
59
60
61
62
63
64
65
66
67
68
69
70
71
title The subProcs.asm Subroutine (subProcs.asm)
;Description: Calling asm procedures in C with different calling conventions
; Date
.386P
.model flat ;No convention
.stack 4096
.code
ProcC_CallWithParameterList PROC C, x:DWORD, y:DWORD
mov eax, x
sub eax, y
ret
PorcC_CallWithParameterList endp
_ProcC_CallWithStackFrame PROC near
push ebp
mov ebp, esp
mov eax,[ebp+8]
sub eax, [ebp+12]
pop ebp
ret
_ProcC_CallWithStackFrame endp
ProcSTD_CallWithParameterList PROC stdcall, x:DWORD, y:DWORD
mov eax, x
sub eax, y
ret
ProcC_CallWithParameterList endp
_ProcSTD_CallWithStack@8 PROC near
push ebp
mov ebp, esp
mov eax,[ebp+8]
sub eax,[ebp+12]
pop ebp
ret 8
_ProcSTD_CallWithStackFrame@8 endp
ReadFromConsole PROTO C, by:BYTE
DisplayToConsole PROTO C, s:PTR BYTE, n:DWORD
DoSubtraction PROC C
.data
text2Disp BYTE 'X-Y =', 0
diff DWORD ?
.code
INVOKE ReadFromConsole, 'X'
mov diff, eax
INVOKE ReadFromConsole, 'Y'
sub diff, eax
INVOKE DisplayToConsole, OFFSET text2Disp, diff
ret
DoSubtraction endp
end