-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmac.inc
More file actions
102 lines (84 loc) · 1.26 KB
/
mac.inc
File metadata and controls
102 lines (84 loc) · 1.26 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
%ifndef _MAC_INC
%define _MAC_INC
%define crlf 0x0d, 0x0a
%macro macWriteStr 1+
section .data
%%str: db %1, '$'
section .text
macWriteStrAddr %%str
%endmacro
%macro macWriteStrAddrSize 2
push ax
push bx
push cx
push dx
mov cx, %2
mov bx, %1
mov ah, 0x02
%%loop:
mov dl, byte [bx]
int 0x21
inc bx
loop %%loop
pop dx
pop cx
pop bx
pop ax
%endmacro
%macro macWriteStrAddr 1
push ax
push dx
mov ah, 0x09
mov dx, %1
int 0x21
pop dx
pop ax
%endmacro
%macro macExitProgram 0
mov ax, 0x4c00
int 0x21
%endmacro
%macro macReserveVar 2
%assign %{1}__OFFSET__ BP_OFFSET
%define %1 bp + %{1}__OFFSET__
%assign BP_OFFSET BP_OFFSET+%2
%endmacro
%macro macReturnNoArg 0
xor cx, cx
xor dx, dx
ret
%endmacro
%macro macReturnOneArg 0
xor dx, dx
ret
%endmacro
%macro macReturnTwoArg 0
ret
%endmacro
%macro macModEntry 2
cmp al, (%1 << 3)
jnz %%skip
mov bx, %2
jmp .label_assigned
%%skip:
%endmacro
%macro macModEntryCall 3
cmp al, (%1 << 3)
jnz %%skip
mov bx, %2
mov di, %3
jmp .label_assigned
%%skip:
%endmacro
%macro macReadByteWithCheck 0
call procReadByte
jnc %%no_failure
xor bx, bx
%%no_failure:
%endmacro
%macro macReadSecondByte 0
mov ah, al
macReadByteWithCheck
%endmacro
%define BREAK db 0xcc
%endif