aboutsummaryrefslogtreecommitdiff
path: root/m68k.risu
blob: 3317005d43c2de032dd79fad0f094d736ddacf1e (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
###############################################################################
# Copyright (c) 2016 Laurent Vivier
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
###############################################################################

.mode m68k

# abcd $dx,$dy
ABCD  M68000 1100 Dx:3 10000 0 Dy:3 \
                 !constraints { \
                        write_movb_di($Dx, rand(10) | (rand(10) << 4)); \
                        write_movb_di($Dy, rand(10) | (rand(10) << 4)); \
                        1;\
                      }
# add $dx,$dy
ADD   M68000 1101 Dx:3 0 opmode:2 000 Dy:3 \
                 !constraints { $opmode != 0b11; }
# adda $dx, $ay
ADDA  M68000 1101 Ax:3 size:1 11 000 Dy:3
# addi #Imm, $dx
ADDIB M68000 00000110 00 000 Dx:3 00000000 data:8
ADDIW M68000 00000110 01 000 Dx:3 data:16
# addq #Imm3, $dx
ADDQ  M68000 0101 imm:3 0 size:2 000 Dx:3 \
                 !constraints { $size != 0b11; }
# addx $dx,$dy
ADDX  M68000 1101 Dx:3 1 size:2 00 0 Dy:3 \
                 !constraints { $size != 0b11; }
# and $dx, $dy
AND   M68000 1100 Dx:3 0 opmode:2 000 Dy:3 \
                 !constraints { $opmode != 0b11; }
# andi #Imm,$dx
ANDIB M68000 00000010 00 000 Dx:3 00000000 data:8
ANDIW M68000 00000010 01 000 Dx:3 data:16
# andi #imm,ccr
ANDICCR M68000 0000001000111100 data:16 \
                 !constraints { write_mov_ccr(rand(0x100)); 1; }
# asl/asr $dx,$dy , asl/asr #im3,$r
ASx   M68000 1110 count:3 d:1 size:2 i:1 00 r:3 \
                 !constraints { $size != 0b11; }
# bchg $dx,$dy
BCHG  M68000 0000 Dx:3 101 000 Dy:3
BCHGI M68000 0000 100  001 000 Dx:3 0000000 data:9
# blcr $dx,$dy
BCLR  M68000 0000 Dx:3 110 000 Dy:3
BCLRI M68000 0000 100  010 000 Dx:3 0000000 data:9
# bfchg $dx,offset:width
BFCHG M68020 1110101011 000 Dx:3 0000 Do:1 offset:5 Dw:1 width:5 \
                !constraints { (!$Do || $offset < 8) &&          \
                               (!$Dw || $width < 8);             \
                             }
# bfclr $dx,offset:width
BFCLR M68020 1110110011 000 Dx:3 0000 Do:1 offset:5 Dw:1 width:5 \
                !constraints { (!$Do || $offset < 8) &&          \
                               (!$Dw || $width < 8);             \
                             }
# bfexts $dx,offset:width,$dy
BFEXTS M68020 1110101111 000 Dx:3 0 Dy:3 Do:1 offset:5 Dw:1 width:5 \
                !constraints { (!$Do || $offset < 8) &&          \
                               (!$Dw || $width < 8);             \
                             }
# bfextu $dx,offset:width,$dy
BFEXTU M68020 1110100111 000 Dx:3 0 Dy:3 Do:1 offset:5 Dw:1 width:5 \
                !constraints { (!$Do || $offset < 8) &&          \
                               (!$Dw || $width < 8);             \
                             }
# bfffo $dx,offset:width,$dy
# there is a bug in 68040 with offset > 31
BFFFO M68020 1110110111 000 Dx:3 0 Dy:3 Do:1 offset:5 Dw:1 width:5    \
                !constraints {                                        \
                               if ($Dw == 1) { $width &= 0x7; ;}      \
                               if ($Do == 1) {                        \
                                   $offset &= 0x7;                    \
                                   write_mov_di($offset, rand(0x20)); \
                               }                                      \
                               1;                                     \
                             }
# bfins $dx,offset:width,$dy
BFINS M68020 1110111111 000 Dx:3 0 Dy:3 Do:1 offset:5 Dw:1 width:5 \
                !constraints { (!$Do || $offset < 8) &&          \
                               (!$Dw || $width < 8);             \
                             }
# bfset $dx,offset:width
BFSET M68020 1110111011 000 Dx:3 0000 Do:1 offset:5 Dw:1 width:5 \
                !constraints { (!$Do || $offset < 8) &&          \
                               (!$Dw || $width < 8);             \
                             }
# bftst $dx,offset:width
BFTST M68020 1110100011 000 Dx:3 0000 Do:1 offset:5 Dw:1 width:5 \
                !constraints { (!$Do || $offset < 8) &&          \
                               (!$Dw || $width < 8);             \
                             }
# bset $dx,$dy
BSET  M68000 0000 Dx:3 111 000 Dy:3
BSETI M68000 0000 100  011 000 Dx:3 0000000 data:9
# btst $dx,$dy
BTST  M68000 0000 Dx:3 100 000 Dy:3
BTSTI M68000 0000 100  000 000 Dx:3 0000000 data:9
# clr $dx
CLR   M68000 01000010 size:2 000 Dx:3 \
                 !constraints { $size != 0b11; }
# cmp $dx,$dy
CMP   M68000 1011 Dx:3 0 size:2 000 Dy:3 \
                 !constraints { $size != 0b11; }
# cmpa $dx,$ay
CMPA  M68000 1011 Ax:3 size:1 11 000 Dy:3
# cmpi #Imm, $dx
CMPIB M68000 00001100 00 000 Dx:3 00000000 data:8
CMPIW M68000 00001100 01 000 Dx:3 data:16
# divs $dx,$dy
DIVS  M68000 1000 Dy:3 111 000 Dx:3 \
                 !constraints { \
                        write_mov_di($Dx, rand(0xffffffff) + 1); \
                        1;                                       \
                      }
# divsl $dx,$dr:$dq
DIVSL M68020 0100110001 000 Dx:3  0 Dq:3 1 size:1 0000000 Dr:3 \
                 !constraints { \
                        write_mov_di($Dx, rand(0xffffffff) + 1); \
                        1;                                       \
                      }
# divu $dx,$dy
DIVU  M68000 1000 Dy:3 011 000 Dx:3 \
                 !constraints { \
                        write_mov_di($Dx, rand(0xffffffff) + 1); \
                        1;                                       \
                      }
# divul $dx,$dr:$dq
DIVUL M68020 0100110001 000 Dx:3  0 Dq:3 0 size:1 0000000 Dr:3 \
                 !constraints { \
                        write_mov_di($Dx, rand(0xffffffff) + 1); \
                        1;                                       \
                      }
# eor $dx,$dy
EOR   M68000 1011 Dx:3 1 size:2 000 Dy:3 \
                 !constraints { $size != 0b11; }
# eori #Imm, $dx
EORIB M68000 00001010 00 000 Dx:3 00000000 data:8
EORIW M68000 00001010 01 000 Dx:3 data:16
# eori #imm,ccr
EORICCR M68000 0000101000111100 data:16 \
                 !constraints { write_mov_ccr(rand(0x100)); 1; }
# exg $dx,$dy
EXG_d M68000 1100 Dx:3 1 01000 Dy:3
# exg $ax,$ay
EXG_a M68000 1100 Ax:3 1 01000 Ay:3
# exg $dx,$ay
EXG   M68000 1100 Dx:3 1 01000 Ay:3
# ext $dx
EXT   M68000 0100100 opmode:3 000 Dx:3 \
                 !constraints { $opmode == 0b010 || $opmode == 0b011 }
EXTB  M68020 0100100 111 000 Dx:3
# lsl/lsr $dx,$dy , lsl/lsr #im3,$r
LSx   M68000 1110 count:3 d:1 size:2 i:1 01 r:3 \
                 !constraints { $size != 0b11; }
# move $dx,$dy
MOVE  M68000 00 size:2 Dy:3 000 000 Dx:3 \
                 !constraints { $size != 0b00; }
# movea $dx,$ay
MOVEA M68000 00 size:2 Ay:3 001 000 Dx:3 \
                 !constraints { $size != 0b00 && $size != 0b01; }
# move ccr,$dx
MOVEFROMCCR  M68010 0100001011 000 Dx:3
# move $dx,ccr
MOVETOCCR M68000 0100010011 000 Dx:3
# moveq #Imm8, $dx
MOVEQ M68000 0111 Dx:3 0 data:8
# muls $dx,$dy
MULS  M68000 1100 Dy:3 111 000 Dx:3
# mulsl $dx, $dh:$dl
MULSL M68020 0100110000 000 Dx:3 0 Dl:3 1 size:1 0000000 Dh:3
# mulu $dx,$dy
MULU  M68000 1100 Dy:3 011 000 Dx:3
# mulul $dx, $dh:$dl
MULUL M68020 0100110000 000 Dx:3 0 Dl:3 0 size:1 0000000 Dh:3
# nbcd $dx
NBCD  M68000 0100100000 000 Dx:3 \
                 !constraints { \
                        write_movb_di($Dx, rand(10) | (rand(10) << 4)); \
                        1;                                              \
                      }
# neg $dx
NEG   M68000 01000100 size:2 000 Dx:3 \
                 !constraints { $size != 0b11; }
# negx $dx
NEGX  M68000 01000000 size:2 000 Dx:3 \
                 !constraints { $size != 0b11; }
# nop
NOP   M68000 0100111001110001
# not $dx
NOT   M68000 01000110 size:2 000 Dx:3 \
                 !constraints { $size != 0b11; }
# or $dx,$dy
OR    M68000 1000 Dy:3 0 size:2 000 Dx:3 \
                 !constraints { $size != 0b11; }
# ori #Imm, $dx
ORIB M68000 00000000 00 000 Dx:3 00000000 data:8
ORIW M68000 00000000 01 000 Dx:3 data:16
# ori #imm,ccr
ORICCR M68000 0000000000111100 data:16 \
                 !constraints { write_mov_ccr(rand(0x100)); 1; }
# rol/ror $dx,$dy , rol/ror #im3,$r
ROx   M68000 1110 count:3 d:1 size:2 i:1 11 r:3 \
                 !constraints { $size != 0b11; }
# roxl/roxr $dx,$dy , roxl/roxr #im3,$r
ROXx  M68000 1110 count:3 d:1 size:2 i:1 10 r:3 \
                 !constraints { $size != 0b11; }
# sbcd $dx,$dy
SBCD  M68000 1000 Dx:3 10000 0 Dy:3 \
                 !constraints { \
                        write_movb_di($Dx, rand(10) | (rand(10) << 4)); \
                        write_movb_di($Dy, rand(10) | (rand(10) << 4)); \
                        1;                                              \
                      }
# Scc $dx
SCC M68000 0101 cond:4 11 000 dx:3 \
                 !constraints { write_mov_ccr(rand(0x100)); 1; }
# sub $dx,$dy
SUB   M68000 1001 Dx:3 0 opmode:2 000 Dy:3 \
                 !constraints { $opmode != 0b11; }
# suba $dx, $ay
SUBA  M68000 1001 Ax:3 size:1 11 000 Dy:3
# subi #Imm, $dx
SUBIB M68000 00000100 00 000 Dx:3 00000000 data:8
SUBIW M68000 00000100 01 000 Dx:3 data:16
# subq #Imm3n $dx
SUBQ  M68000 0101 imm:3 1 size:2 000 Dx:3 \
                 !constraints { $size != 0b11; }
# subx $dx,$dy
SUBX  M68000 1001 Dx:3 1 size:2 00 0 Dy:3 \
                 !constraints { $size != 0b11; }
# swap $dx
SWAP  M68000 0100100001000 Dx:3
# tas $dx
TAS   M68000 0100101011 000 Dx:3
# tst $dx
TST   M68000 01001010 size:2 000 Dx:3 \
                 !constraints { $size != 0b11; }