-
Notifications
You must be signed in to change notification settings - Fork 5
/
spasm.inc
96 lines (96 loc) · 1.38 KB
/
spasm.inc
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
macro .org? address*
org address
end macro
macro .block? size*
rb? size
end macro
macro .fill? size*, value:?
db? size dup? value
end macro
macro .db? data&
db? data
end macro
macro .byte? data&
db? data
end macro
macro .dw? data&
dw? data
end macro
macro .word? data&
dw? data
end macro
macro .dl? data&
dl? data
end macro
macro .long? data&
dl? data
end macro
struc .equ? value
. =: value
end struc
macro .echo? first*, rest&
if 0 eqtype first
repeat 1, int:first
display `int
end repeat
else
display first
end if
match any, rest
.echo? any
else
display 13, 10
end match
end macro
macro .error? text&
err? text
end macro
macro .list?
end macro
macro .nolist?
end macro
macro .end?
macro ?! line&
end macro
end macro
macro #comment?
macro ?! line&
match #=endcomment?, line
purge ?
end match
end macro
end macro
macro #define? line&
rmatch name value, line
redefine name (value)
else rmatch name, line
redefine name
end rmatch
end macro
macro #undef? name*
restore name
end macro
macro #undefine? name*
restore name
end macro
macro #ifdef? name&
local save
if defined save | ~ defined name
redefine save
end if
if ~ defined save
end macro
macro #ifndef? name&
local save
if defined save | ~ defined name
redefine save
end macro
macro #elif?! cond&
else if cond
end macro
macro #endif?!
end if
end macro
macro #endmacro?!
esc end macro
end macro