1 
2 /*
3     FULLY TRUSTED
4 */
5 
opBGT8(void)6 static UINT32 opBGT8(void) /* TRUSTED */
7 {
8 	NORMALIZEFLAGS();
9 
10 	if (!((_S ^ _OV) | _Z))
11 	{
12 		PC += (INT8)OpRead8(PC + 1);
13 		return 0;
14 	}
15 
16 	return 2;
17 }
18 
opBGT16(void)19 static UINT32 opBGT16(void) /* TRUSTED */
20 {
21 	NORMALIZEFLAGS();
22 
23 	if (!((_S ^ _OV) | _Z))
24 	{
25 		PC += (INT16)OpRead16(PC + 1);
26 		return 0;
27 	}
28 
29 	return 3;
30 }
31 
32 
opBGE8(void)33 static UINT32 opBGE8(void) /* TRUSTED */
34 {
35 	NORMALIZEFLAGS();
36 
37 	if (!(_S ^ _OV))
38 	{
39 		PC += (INT8)OpRead8(PC + 1);
40 		return 0;
41 	}
42 
43 	return 2;
44 }
45 
opBGE16(void)46 static UINT32 opBGE16(void) /* TRUSTED */
47 {
48 	NORMALIZEFLAGS();
49 
50 	if (!(_S ^ _OV))
51 	{
52 		PC += (INT16)OpRead16(PC + 1);
53 		return 0;
54 	}
55 
56 	return 3;
57 }
58 
opBLT8(void)59 static UINT32 opBLT8(void) /* TRUSTED */
60 {
61 	NORMALIZEFLAGS();
62 
63 	if ((_S ^ _OV))
64 	{
65 		PC += (INT8)OpRead8(PC + 1);
66 		return 0;
67 	}
68 
69 	return 2;
70 }
71 
opBLT16(void)72 static UINT32 opBLT16(void) /* TRUSTED */
73 {
74 	NORMALIZEFLAGS();
75 
76 	if ((_S ^ _OV))
77 	{
78 		PC += (INT16)OpRead16(PC + 1);
79 		return 0;
80 	}
81 
82 	return 3;
83 }
84 
85 
opBLE8(void)86 static UINT32 opBLE8(void) /* TRUSTED */
87 {
88 	NORMALIZEFLAGS();
89 
90 	if (((_S ^ _OV) | _Z))
91 	{
92 		PC += (INT8)OpRead8(PC + 1);
93 		return 0;
94 	}
95 
96 	return 2;
97 }
98 
opBLE16(void)99 static UINT32 opBLE16(void) /* TRUSTED */
100 {
101 	NORMALIZEFLAGS();
102 
103 	if (((_S ^ _OV) | _Z))
104 	{
105 		PC += (INT16)OpRead16(PC + 1);
106 		return 0;
107 	}
108 
109 	return 3;
110 }
111 
opBH8(void)112 static UINT32 opBH8(void) /* TRUSTED */
113 {
114 	if (!(_CY | _Z))
115 	{
116 		PC += (INT8)OpRead8(PC + 1);
117 		return 0;
118 	}
119 
120 	return 2;
121 }
122 
opBH16(void)123 static UINT32 opBH16(void) /* TRUSTED */
124 {
125 	if (!(_CY | _Z))
126 	{
127 		PC += (INT16)OpRead16(PC + 1);
128 		return 0;
129 	}
130 
131 	return 3;
132 }
133 
opBNH8(void)134 static UINT32 opBNH8(void) /* TRUSTED */
135 {
136 	if ((_CY | _Z))
137 	{
138 		PC += (INT8)OpRead8(PC + 1);
139 		return 0;
140 	}
141 
142 	return 2;
143 }
144 
opBNH16(void)145 static UINT32 opBNH16(void) /* TRUSTED */
146 {
147 	if ((_CY | _Z))
148 	{
149 		PC += (INT16)OpRead16(PC + 1);
150 		return 0;
151 	}
152 
153 	return 3;
154 }
155 
opBNL8(void)156 static UINT32 opBNL8(void) /* TRUSTED */
157 {
158 	if (!(_CY))
159 	{
160 		PC += (INT8)OpRead8(PC + 1);
161 		return 0;
162 	}
163 
164 	return 2;
165 }
166 
opBNL16(void)167 static UINT32 opBNL16(void) /* TRUSTED */
168 {
169 	if (!(_CY))
170 	{
171 		PC += (INT16)OpRead16(PC + 1);
172 		return 0;
173 	}
174 
175 	return 3;
176 }
177 
opBL8(void)178 static UINT32 opBL8(void) /* TRUSTED */
179 {
180 	if ((_CY))
181 	{
182 		PC += (INT8)OpRead8(PC + 1);
183 		return 0;
184 	}
185 
186 	return 2;
187 }
188 
opBL16(void)189 static UINT32 opBL16(void) /* TRUSTED */
190 {
191 	if ((_CY))
192 	{
193 		PC += (INT16)OpRead16(PC + 1);
194 		return 0;
195 	}
196 
197 	return 3;
198 }
199 
opBNE8(void)200 static UINT32 opBNE8(void) /* TRUSTED */
201 {
202 	if (!(_Z))
203 	{
204 		PC += (INT8)OpRead8(PC + 1);
205 		return 0;
206 	}
207 
208 	return 2;
209 }
210 
opBNE16(void)211 static UINT32 opBNE16(void) /* TRUSTED */
212 {
213 	if (!(_Z))
214 	{
215 		PC += (INT16)OpRead16(PC + 1);
216 		return 0;
217 	}
218 
219 	return 3;
220 }
221 
opBE8(void)222 static UINT32 opBE8(void) /* TRUSTED */
223 {
224 	if ((_Z))
225 	{
226 		PC += (INT8)OpRead8(PC + 1);
227 		return 0;
228 	}
229 
230 	return 2;
231 }
232 
opBE16(void)233 static UINT32 opBE16(void) /* TRUSTED */
234 {
235 	if ((_Z))
236 	{
237 		PC += (INT16)OpRead16(PC + 1);
238 		return 0;
239 	}
240 
241 	return 3;
242 }
243 
opBNV8(void)244 static UINT32 opBNV8(void) /* TRUSTED */
245 {
246 	if (!(_OV))
247 	{
248 		PC += (INT8)OpRead8(PC + 1);
249 		return 0;
250 	}
251 
252 	return 2;
253 }
254 
opBNV16(void)255 static UINT32 opBNV16(void) /* TRUSTED */
256 {
257 	if (!(_OV))
258 	{
259 		PC += (INT16)OpRead16(PC + 1);
260 		return 0;
261 	}
262 
263 	return 3;
264 }
265 
opBV8(void)266 static UINT32 opBV8(void) /* TRUSTED */
267 {
268 	if ((_OV))
269 	{
270 		PC += (INT8)OpRead8(PC + 1);
271 		return 0;
272 	}
273 
274 	return 2;
275 }
276 
opBV16(void)277 static UINT32 opBV16(void) /* TRUSTED */
278 {
279 	if ((_OV))
280 	{
281 		PC += (INT16)OpRead16(PC + 1);
282 		return 0;
283 	}
284 
285 	return 3;
286 }
287 
opBP8(void)288 static UINT32 opBP8(void) /* TRUSTED */
289 {
290 	if (!(_S))
291 	{
292 		PC += (INT8)OpRead8(PC + 1);
293 		return 0;
294 	}
295 
296 	return 2;
297 }
298 
opBP16(void)299 static UINT32 opBP16(void) /* TRUSTED */
300 {
301 	if (!(_S))
302 	{
303 		PC += (INT16)OpRead16(PC + 1);
304 		return 0;
305 	}
306 
307 	return 3;
308 }
309 
opBN8(void)310 static UINT32 opBN8(void) /* TRUSTED */
311 {
312 	if ((_S))
313 	{
314 		PC += (INT8)OpRead8(PC + 1);
315 		return 0;
316 	}
317 
318 	return 2;
319 }
320 
opBN16(void)321 static UINT32 opBN16(void) /* TRUSTED */
322 {
323 	if ((_S))
324 	{
325 		PC += (INT16)OpRead16(PC + 1);
326 		return 0;
327 	}
328 
329 	return 3;
330 }
331 
opBR8(void)332 static UINT32 opBR8(void) /* TRUSTED */
333 {
334 	PC += (INT8)OpRead8(PC + 1);
335 	return 0;
336 }
337 
opBR16(void)338 static UINT32 opBR16(void) /* TRUSTED */
339 {
340 	PC += (INT16)OpRead16(PC + 1);
341 	return 0;
342 }
343 
opBSR(void)344 static UINT32 opBSR(void) /* TRUSTED */
345 {
346 	// Save Next PC onto the stack
347 	SP -= 4;
348 	MemWrite32(SP, PC+3);
349 
350 	// Jump to subroutine
351 	PC += (INT16)OpRead16(PC + 1);
352 	return 0;
353 }
354