summaryrefslogtreecommitdiff
path: root/gas/testsuite/gasp/macro.out
blob: 0740732c7c297e22bcb475a42f53cf1897b7d1a5 (plain)
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
!	.MACRO	SUM FROM=0, TO=9
!	; \FROM \TO
!	MOV	R\FROM,R10
!COUNT	.ASSIGNA	\FROM+1
!	.AWHILE	\&COUNT LE \TO
!	MOV	R\&COUNT,R10
!COUNT	.ASSIGNA	\&COUNT+1
!	.AENDW
!	.ENDM
!

!	SUM 0,5
!	; 0 5
	; 0 5
!	MOV	R0,R10
	MOV	R0,R10
!COUNT	.ASSIGNA	0+1
!	.AWHILE	\&COUNT LE 5
!	MOV	R\&COUNT,R10
!COUNT	.ASSIGNA	\&COUNT+1
!	.AENDW
!	MOV	R\&COUNT,R10
	MOV	R1,R10
!COUNT	.ASSIGNA	\&COUNT+1
!	.AWHILE	\&COUNT LE 5
!	MOV	R\&COUNT,R10
!COUNT	.ASSIGNA	\&COUNT+1
!	.AENDW
!	MOV	R\&COUNT,R10
	MOV	R2,R10
!COUNT	.ASSIGNA	\&COUNT+1
!	.AWHILE	\&COUNT LE 5
!	MOV	R\&COUNT,R10
!COUNT	.ASSIGNA	\&COUNT+1
!	.AENDW
!	MOV	R\&COUNT,R10
	MOV	R3,R10
!COUNT	.ASSIGNA	\&COUNT+1
!	.AWHILE	\&COUNT LE 5
!	MOV	R\&COUNT,R10
!COUNT	.ASSIGNA	\&COUNT+1
!	.AENDW
!	MOV	R\&COUNT,R10
	MOV	R4,R10
!COUNT	.ASSIGNA	\&COUNT+1
!	.AWHILE	\&COUNT LE 5
!	MOV	R\&COUNT,R10
!COUNT	.ASSIGNA	\&COUNT+1
!	.AENDW
!	MOV	R\&COUNT,R10
	MOV	R5,R10
!COUNT	.ASSIGNA	\&COUNT+1
!	.AWHILE	\&COUNT LE 5
!	MOV	R\&COUNT,R10
!COUNT	.ASSIGNA	\&COUNT+1
!	.AENDW
!	SUM 	TO=5
!	; 0 5
	; 0 5
!	MOV	R0,R10
	MOV	R0,R10
!COUNT	.ASSIGNA	0+1
!	.AWHILE	\&COUNT LE 5
!	MOV	R\&COUNT,R10
!COUNT	.ASSIGNA	\&COUNT+1
!	.AENDW
!	MOV	R\&COUNT,R10
	MOV	R1,R10
!COUNT	.ASSIGNA	\&COUNT+1
!	.AWHILE	\&COUNT LE 5
!	MOV	R\&COUNT,R10
!COUNT	.ASSIGNA	\&COUNT+1
!	.AENDW
!	MOV	R\&COUNT,R10
	MOV	R2,R10
!COUNT	.ASSIGNA	\&COUNT+1
!	.AWHILE	\&COUNT LE 5
!	MOV	R\&COUNT,R10
!COUNT	.ASSIGNA	\&COUNT+1
!	.AENDW
!	MOV	R\&COUNT,R10
	MOV	R3,R10
!COUNT	.ASSIGNA	\&COUNT+1
!	.AWHILE	\&COUNT LE 5
!	MOV	R\&COUNT,R10
!COUNT	.ASSIGNA	\&COUNT+1
!	.AENDW
!	MOV	R\&COUNT,R10
	MOV	R4,R10
!COUNT	.ASSIGNA	\&COUNT+1
!	.AWHILE	\&COUNT LE 5
!	MOV	R\&COUNT,R10
!COUNT	.ASSIGNA	\&COUNT+1
!	.AENDW
!	MOV	R\&COUNT,R10
	MOV	R5,R10
!COUNT	.ASSIGNA	\&COUNT+1
!	.AWHILE	\&COUNT LE 5
!	MOV	R\&COUNT,R10
!COUNT	.ASSIGNA	\&COUNT+1
!	.AENDW
!	SUM 	FROM=2, TO=5
!	; 2 5
	; 2 5
!	MOV	R2,R10
	MOV	R2,R10
!COUNT	.ASSIGNA	2+1
!	.AWHILE	\&COUNT LE 5
!	MOV	R\&COUNT,R10
!COUNT	.ASSIGNA	\&COUNT+1
!	.AENDW
!	MOV	R\&COUNT,R10
	MOV	R3,R10
!COUNT	.ASSIGNA	\&COUNT+1
!	.AWHILE	\&COUNT LE 5
!	MOV	R\&COUNT,R10
!COUNT	.ASSIGNA	\&COUNT+1
!	.AENDW
!	MOV	R\&COUNT,R10
	MOV	R4,R10
!COUNT	.ASSIGNA	\&COUNT+1
!	.AWHILE	\&COUNT LE 5
!	MOV	R\&COUNT,R10
!COUNT	.ASSIGNA	\&COUNT+1
!	.AENDW
!	MOV	R\&COUNT,R10
	MOV	R5,R10
!COUNT	.ASSIGNA	\&COUNT+1
!	.AWHILE	\&COUNT LE 5
!	MOV	R\&COUNT,R10
!COUNT	.ASSIGNA	\&COUNT+1
!	.AENDW
!

!

!; hi this is a comment
	; hi this is a comment
!	.MACRO	BACK_SLASH_SET
!	\(MOV	#"\",R0) 
!	.ENDM
!	BACK_SLASH_SET
!	MOV	#"\",R0 
	MOV	#"\",R0 
!	.MACRO	COMM
!	bar	; this comment will get copied out
!	foo	\; this one will get dropped
!	.ENDM
!	COMM
!	bar	; this comment will get copied out
	bar	; this comment will get copied out
!	foo	\; this one will get dropped
	foo	\; this one will get dropped
!	BACK_SLASH_SET
!	MOV	#"\",R0 
	MOV	#"\",R0 
!	.MACRO	PLUS2
!	ADD	#1,R\&V1
!	.SDATA	"\&V'1"
!	.ENDM
!V	.ASSIGNC	"R"
!V1	.ASSIGNA	1
!	PLUS2
!	ADD	#1,R\&V1
	ADD	#1,R1
!	.SDATA	"\&V'1"
	.byte	82,49
!	.MACRO	PLUS1	P,P1
!	ADD	#1,\P1
!	.SDATA	"\P'1"
!	.ENDM
!	PLUS1	R,R1
!	ADD	#1,R1
	ADD	#1,R1
!	.SDATA	"R1"
	.byte	82,49
!

!	.MACRO	SUM P1
!	MOV	R0,R10
!	ADD	R1,R10
!	ADD	R2,R10
!	\P1	
!	ADD	R3,R10
!	.ENDM
!

!	SUM	.EXITM
!	MOV	R0,R10
	MOV	R0,R10
!	ADD	R1,R10
	ADD	R1,R10
!	ADD	R2,R10
	ADD	R2,R10
!	.EXITM	
!

!	.MACRO foo bar=a default=b
!	\bar
!	\default
!	bar
!	default
!	.ENDM
!	foo default=dog bar=cat
!	cat
	cat
!	dog
	dog
!	bar
	bar
!	default
	default
!	foo X Y
!	X
	X
!	Y
	Y
!	bar
	bar
!	default
	default
!	foo
!	a
	a
!	b
	b
!	bar
	bar
!	default
	default
!	foo bar=cat default=dog
!	cat
	cat
!	dog
	dog
!	bar
	bar
!	default
	default
!

!

!	.MACRO	foo bar
!	HI
!	HI \bar
!	HI
!	.ENDM
!

!	foo 1
!	HI
	HI
!	HI 1
	HI 1
!	HI
	HI
!	foo 123
!	HI
	HI
!	HI 123
	HI 123
!	HI
	HI
!	foo 1 2 3 4
!	foo
!	HI
	HI
!	HI 
	HI 
!	HI
	HI
!

!	
!	.MACRO	PUSH Rn
!	MOV.L	\Rn,@-r15
!	.ENDM
!	PUSH	R0
!	MOV.L	R0,@-r15
	MOV.L	R0,@-r15
!	PUSH	R1
!	MOV.L	R1,@-r15
	MOV.L	R1,@-r15
!

!

!	.MACRO	RES_STR STR, Rn
!	MOV.L	#str\@,\Rn
!	BRA	end_str\@
!	NOP
!str\@	.SDATA "\STR"
!	.ALIGN	2
!end_str\@
!	.ENDM
!	
!	RES_STR	"ONE",R0	
!	MOV.L	#str00018,R0
	MOV.L	#str00018,R0
!	BRA	end_str00018
	BRA	end_str00018
!	NOP
	NOP
!str00018	.SDATA "ONE"
str00018:	.byte	79,78,69
!	.ALIGN	2
	.align	2
!end_str00018
end_str00018:
!	RES_STR	"TWO",R1
!	MOV.L	#str00019,R1
	MOV.L	#str00019,R1
!	BRA	end_str00019
	BRA	end_str00019
!	NOP
	NOP
!str00019	.SDATA "TWO"
str00019:	.byte	84,87,79
!	.ALIGN	2
	.align	2
!end_str00019
end_str00019:
!	RES_STR	"THREE",R2
!	MOV.L	#str00020,R2
	MOV.L	#str00020,R2
!	BRA	end_str00020
	BRA	end_str00020
!	NOP
	NOP
!str00020	.SDATA "THREE"
str00020:	.byte	84,72,82,69,69
!	.ALIGN	2
	.align	2
!end_str00020
end_str00020:
!

!

!

!	RES_STR STR=donkey Rn=R1
!	MOV.L	#str00021,R1
	MOV.L	#str00021,R1
!	BRA	end_str00021
	BRA	end_str00021
!	NOP
	NOP
!str00021	.SDATA "donkey"
str00021:	.byte	100,111,110,107,101,121
!	.ALIGN	2
	.align	2
!end_str00021
end_str00021:
!	RES_STR donkey,R1
!	MOV.L	#str00022,R1
	MOV.L	#str00022,R1
!	BRA	end_str00022
	BRA	end_str00022
!	NOP
	NOP
!str00022	.SDATA "donkey"
str00022:	.byte	100,111,110,107,101,121
!	.ALIGN	2
	.align	2
!end_str00022
end_str00022:
! 	RES_STR donkey Rn=R1
!	MOV.L	#str00023,R1
	MOV.L	#str00023,R1
!	BRA	end_str00023
	BRA	end_str00023
!	NOP
	NOP
!str00023	.SDATA "donkey"
str00023:	.byte	100,111,110,107,101,121
!	.ALIGN	2
	.align	2
!end_str00023
end_str00023:
!	.END