Previous 199869 Revisions Next

r33915 Monday 15th December, 2014 at 23:27:13 UTC by David Haywood
arcompact dasm fixes (jump / branch destinations) (nw)
[src/emu/cpu/arcompact]arcompactdasm_ops.c

trunk/src/emu/cpu/arcompact/arcompactdasm_ops.c
r242426r242427
198198#define GET_01_01_01_BRANCH_ADDR \
199199   INT32 address = (op & 0x00fe0000) >> 17; \
200200   address |= ((op & 0x00008000) >> 15) << 7; \
201   if (address & 0x80) address = -(address & 0x7f); \
201   if (address & 0x80) address = -0x80 + (address & 0x7f); \
202202   op &= ~ 0x00fe800f;
203203
204204
r242426r242427
248248   limm = oprom[4] | (oprom[5] << 8); \
249249   limm |= (oprom[2] << 16) | (oprom[3] << 24); \
250250
251#define PC_ALIGNED32 \
252   (pc&0xfffffffc)
251253
254
252255/************************************************************************************************************************************
253256*                                                                                                                                   *
254257* individual opcode handlers (disassembly)                                                                                          *
r242426r242427
262265   // 0000 0sss ssss sss0 SSSS SSSS SSNQ QQQQ
263266   INT32 address = (op & 0x07fe0000) >> 17;
264267   address |= ((op & 0x0000ffc0) >> 6) << 10;
265   if (address & 0x800000) address = -(address & 0x7fffff);
268   if (address & 0x800000) address = -0x800000 + (address & 0x7fffff);
266269   int n = (op & 0x00000020) >> 5; op &= ~0x00000020;
267270   UINT8 condition = op & 0x0000001f;
268271
269   output  += sprintf( output, "B%s(%s) %08x", delaybit[n], conditions[condition], pc + (address * 2));
272   output  += sprintf( output, "B%s(%s) %08x", delaybit[n], conditions[condition], PC_ALIGNED32 + (address * 2));
270273   return size;
271274}
272275
r242426r242427
278281   INT32 address = (op & 0x07fe0000) >> 17;
279282   address |= ((op & 0x0000ffc0) >> 6) << 10;
280283   address |= ((op & 0x0000000f) >> 0) << 20;
281   if (address & 0x800000) address = -(address & 0x7fffff);
284   if (address & 0x800000) address = -0x800000 + (address & 0x7fffff);
282285   int n = (op & 0x00000020) >> 5; op &= ~0x00000020;
283286   int res =  (op & 0x00000010) >> 4; op &= ~0x00000010;
284287
285   output  += sprintf( output, "B%s %08x", delaybit[n], pc + (address * 2) );
288   output  += sprintf( output, "B%s %08x", delaybit[n], PC_ALIGNED32 + (address * 2) );
286289   if (res)  output += sprintf(output, "(reserved bit set)");
287290
288291   return size;
r242426r242427
296299   // 00001 sssssssss 00 SSSSSSSSSS N QQQQQ
297300   INT32 address =   (op & 0x07fc0000) >> 17;
298301   address |=        ((op & 0x0000ffc0) >> 6) << 10;
299   if (address & 0x800000) address = -(address&0x7fffff);   
302   if (address & 0x800000) address = -0x800000 + (address&0x7fffff);   
300303   int n = (op & 0x00000020) >> 5; op &= ~0x00000020;
301304
302305   UINT8 condition = op & 0x0000001f;
303306
304   output  += sprintf( output, "BL%s(%s) %08x", delaybit[n], conditions[condition], pc + (address *2) );
307   output  += sprintf( output, "BL%s(%s) %08x", delaybit[n], conditions[condition], PC_ALIGNED32 + (address *2) );
305308   return size;
306309}
307310
r242426r242427
313316   INT32 address =   (op & 0x07fc0000) >> 17;
314317   address |=        ((op & 0x0000ffc0) >> 6) << 10;
315318   address |=        ((op & 0x0000000f) >> 0) << 20;
316   if (address & 0x800000) address = -(address&0x7fffff);   
319   if (address & 0x800000) address = -0x800000 + (address&0x7fffff);   
317320   int n = (op & 0x00000020) >> 5; op &= ~0x00000020;
318321   int res =  (op & 0x00000010) >> 4; op &= ~0x00000010;
319322
320   output  += sprintf( output, "BL%s %08x", delaybit[n], pc + (address *2) );
323   output  += sprintf( output, "BL%s %08x", delaybit[n], PC_ALIGNED32 + (address *2) );
321324   if (res)  output += sprintf(output, "(reserved bit set)");
322325
323326   return size;
r242426r242427
325328
326329
327330
328int arcompact_01_01_00_helper(char *output, offs_t pc, UINT32 op, const UINT8* oprom, const char* optext)
331int arcompact_01_01_00_helper(DASM_OPS_32, const char* optext)
329332{
330333   int size = 4;
331334
r242426r242427
343346
344347   if ((b != LIMM_REG) && (c != LIMM_REG))
345348   {
346      print("%s%s %s, %s %08x (%08x)", optext, delaybit[n], regnames[b], regnames[c], pc + (address * 2) + 4, op & ~0xf8fe800f);
349      print("%s%s %s, %s %08x (%08x)", optext, delaybit[n], regnames[b], regnames[c], PC_ALIGNED32 + (address * 2), op & ~0xf8fe800f);
347350   }
348351   else
349352   {
r242426r242427
353356
354357      if ((b == LIMM_REG) && (c != LIMM_REG))
355358      {
356         print("%s%s (%08x) %s %08x (%08x)", optext, delaybit[n], limm, regnames[b], pc + (address * 2) + 4, op & ~0xf8fe800f);
359         print("%s%s (%08x) %s %08x (%08x)", optext, delaybit[n], limm, regnames[b], PC_ALIGNED32 + (address * 2), op & ~0xf8fe800f);
357360      }
358361      else if ((c == LIMM_REG) && (b != LIMM_REG))
359362      {
360         print("%s%s %s, (%08x) %08x (%08x)", optext, delaybit[n], regnames[b], limm, pc + (address * 2) + 4, op & ~0xf8fe800f);
363         print("%s%s %s, (%08x) %08x (%08x)", optext, delaybit[n], regnames[b], limm, PC_ALIGNED32 + (address * 2), op & ~0xf8fe800f);
361364      }
362365      else
363366      {
364367         // b and c are LIMM? invalid??
365         print("%s%s (%08x), (%08x) (illegal?) %08x (%08x)", optext, delaybit[n], limm, limm, pc + (address * 2) + 4, op & ~0xf8fe800f);
368         print("%s%s (%08x), (%08x) (illegal?) %08x (%08x)", optext, delaybit[n], limm, limm, PC_ALIGNED32 + (address * 2), op & ~0xf8fe800f);
366369
367370      }
368371   }
r242426r242427
372375
373376
374377// register - register cases
375int arcompact_handle01_01_00_00_dasm(DASM_OPS_32)  { return arcompact_01_01_00_helper( output, pc, op, oprom, "BREQ"); }
376int arcompact_handle01_01_00_01_dasm(DASM_OPS_32)  { return arcompact_01_01_00_helper( output, pc, op, oprom, "BRNE"); }
377int arcompact_handle01_01_00_02_dasm(DASM_OPS_32)  { return arcompact_01_01_00_helper( output, pc, op, oprom, "BRLT"); }
378int arcompact_handle01_01_00_03_dasm(DASM_OPS_32)  { return arcompact_01_01_00_helper( output, pc, op, oprom, "BRGE"); }
379int arcompact_handle01_01_00_04_dasm(DASM_OPS_32)  { return arcompact_01_01_00_helper( output, pc, op, oprom, "BRLO"); }
380int arcompact_handle01_01_00_05_dasm(DASM_OPS_32)  { return arcompact_01_01_00_helper( output, pc, op, oprom, "BRHS"); }
381int arcompact_handle01_01_00_0e_dasm(DASM_OPS_32)  { return arcompact_01_01_00_helper( output, pc, op, oprom, "BBIT0");}
382int arcompact_handle01_01_00_0f_dasm(DASM_OPS_32)  { return arcompact_01_01_00_helper( output, pc, op, oprom, "BBIT1");}
378int arcompact_handle01_01_00_00_dasm(DASM_OPS_32)  { return arcompact_01_01_00_helper( DASM_PARAMS, "BREQ"); }
379int arcompact_handle01_01_00_01_dasm(DASM_OPS_32)  { return arcompact_01_01_00_helper( DASM_PARAMS, "BRNE"); }
380int arcompact_handle01_01_00_02_dasm(DASM_OPS_32)  { return arcompact_01_01_00_helper( DASM_PARAMS, "BRLT"); }
381int arcompact_handle01_01_00_03_dasm(DASM_OPS_32)  { return arcompact_01_01_00_helper( DASM_PARAMS, "BRGE"); }
382int arcompact_handle01_01_00_04_dasm(DASM_OPS_32)  { return arcompact_01_01_00_helper( DASM_PARAMS, "BRLO"); }
383int arcompact_handle01_01_00_05_dasm(DASM_OPS_32)  { return arcompact_01_01_00_helper( DASM_PARAMS, "BRHS"); }
384int arcompact_handle01_01_00_0e_dasm(DASM_OPS_32)  { return arcompact_01_01_00_helper( DASM_PARAMS, "BBIT0");}
385int arcompact_handle01_01_00_0f_dasm(DASM_OPS_32)  { return arcompact_01_01_00_helper( DASM_PARAMS, "BBIT1");}
383386
384int arcompact_01_01_01_helper(char *output, offs_t pc, UINT32 op, const UINT8* oprom, const char* optext)
387int arcompact_01_01_01_helper(DASM_OPS_32, const char* optext)
385388{
386389   int size = 4;
387390
r242426r242427
399402
400403   op &= ~0x07007fe0;
401404
402   print("%s%s %s, 0x%02x %08x (%08x)", optext, delaybit[n], regnames[b], u, pc + (address * 2) + 4, op & ~0xf8fe800f);
405   print("%s%s %s, 0x%02x %08x (%08x)", optext, delaybit[n], regnames[b], u, PC_ALIGNED32 + (address * 2), op & ~0xf8fe800f);
403406   
404407   return size;
405408}
406409
407410// register -immediate cases
408int arcompact_handle01_01_01_00_dasm(DASM_OPS_32)  { return arcompact_01_01_01_helper(output, pc, op, oprom, "BREQ"); }
409int arcompact_handle01_01_01_01_dasm(DASM_OPS_32)  { return arcompact_01_01_01_helper(output, pc, op, oprom, "BRNE"); }
410int arcompact_handle01_01_01_02_dasm(DASM_OPS_32)  { return arcompact_01_01_01_helper(output, pc, op, oprom, "BRLT"); }
411int arcompact_handle01_01_01_03_dasm(DASM_OPS_32)  { return arcompact_01_01_01_helper(output, pc, op, oprom, "BRGE"); }
412int arcompact_handle01_01_01_04_dasm(DASM_OPS_32)  { return arcompact_01_01_01_helper(output, pc, op, oprom, "BRLO"); }
413int arcompact_handle01_01_01_05_dasm(DASM_OPS_32)  { return arcompact_01_01_01_helper(output, pc, op, oprom, "BRHS"); }
414int arcompact_handle01_01_01_0e_dasm(DASM_OPS_32)  { return arcompact_01_01_01_helper(output, pc, op, oprom, "BBIT0"); }
415int arcompact_handle01_01_01_0f_dasm(DASM_OPS_32)  { return arcompact_01_01_01_helper(output, pc, op, oprom, "BBIT1"); }
411int arcompact_handle01_01_01_00_dasm(DASM_OPS_32)  { return arcompact_01_01_01_helper(DASM_PARAMS, "BREQ"); }
412int arcompact_handle01_01_01_01_dasm(DASM_OPS_32)  { return arcompact_01_01_01_helper(DASM_PARAMS, "BRNE"); }
413int arcompact_handle01_01_01_02_dasm(DASM_OPS_32)  { return arcompact_01_01_01_helper(DASM_PARAMS, "BRLT"); }
414int arcompact_handle01_01_01_03_dasm(DASM_OPS_32)  { return arcompact_01_01_01_helper(DASM_PARAMS, "BRGE"); }
415int arcompact_handle01_01_01_04_dasm(DASM_OPS_32)  { return arcompact_01_01_01_helper(DASM_PARAMS, "BRLO"); }
416int arcompact_handle01_01_01_05_dasm(DASM_OPS_32)  { return arcompact_01_01_01_helper(DASM_PARAMS, "BRHS"); }
417int arcompact_handle01_01_01_0e_dasm(DASM_OPS_32)  { return arcompact_01_01_01_helper(DASM_PARAMS, "BBIT0"); }
418int arcompact_handle01_01_01_0f_dasm(DASM_OPS_32)  { return arcompact_01_01_01_helper(DASM_PARAMS, "BBIT1"); }
416419
417420
418421int arcompact_handle02_dasm(DASM_OPS_32)
r242426r242427
511514}
512515
513516
514int arcompact_handle04_helper_dasm(char *output, offs_t pc, UINT32 op, const UINT8* oprom, const char* optext, int ignore_dst, int b_reserved)
517int arcompact_handle04_helper_dasm(DASM_OPS_32, const char* optext, int ignore_dst, int b_reserved)
515518{
516519   //           PP
517520   // 0010 0bbb 00ii iiii FBBB CCCC CCAA AAAA
r242426r242427
615618
616619int arcompact_handle04_00_dasm(DASM_OPS_32) 
617620{
618   return arcompact_handle04_helper_dasm(output, pc, op, oprom, "ADD", 0,0);
621   return arcompact_handle04_helper_dasm(DASM_PARAMS, "ADD", 0,0);
619622}
620623
621624int arcompact_handle04_01_dasm(DASM_OPS_32) 
622625{
623   return arcompact_handle04_helper_dasm(output, pc, op, oprom, "ADC", 0,0);
626   return arcompact_handle04_helper_dasm(DASM_PARAMS, "ADC", 0,0);
624627}
625628
626629int arcompact_handle04_02_dasm(DASM_OPS_32) 
627630{
628   return arcompact_handle04_helper_dasm(output, pc, op, oprom, "SUB", 0,0);
631   return arcompact_handle04_helper_dasm(DASM_PARAMS, "SUB", 0,0);
629632}
630633
631634int arcompact_handle04_03_dasm(DASM_OPS_32) 
632635{
633   return arcompact_handle04_helper_dasm(output, pc, op, oprom, "SBC", 0,0);
636   return arcompact_handle04_helper_dasm(DASM_PARAMS, "SBC", 0,0);
634637}
635638
636639int arcompact_handle04_04_dasm(DASM_OPS_32) 
637640{
638   return arcompact_handle04_helper_dasm(output, pc, op, oprom, "AND", 0,0);
641   return arcompact_handle04_helper_dasm(DASM_PARAMS, "AND", 0,0);
639642}
640643
641644int arcompact_handle04_05_dasm(DASM_OPS_32) 
642645{
643   return arcompact_handle04_helper_dasm(output, pc, op, oprom, "OR", 0,0);
646   return arcompact_handle04_helper_dasm(DASM_PARAMS, "OR", 0,0);
644647}
645648
646649int arcompact_handle04_06_dasm(DASM_OPS_32) 
647650{
648   return arcompact_handle04_helper_dasm(output, pc, op, oprom, "BIC", 0,0);
651   return arcompact_handle04_helper_dasm(DASM_PARAMS, "BIC", 0,0);
649652}
650653
651654int arcompact_handle04_07_dasm(DASM_OPS_32) 
652655{
653   return arcompact_handle04_helper_dasm(output, pc, op, oprom, "XOR", 0,0);
656   return arcompact_handle04_helper_dasm(DASM_PARAMS, "XOR", 0,0);
654657}
655658
656659int arcompact_handle04_08_dasm(DASM_OPS_32) 
657660{
658   return arcompact_handle04_helper_dasm(output, pc, op, oprom, "MAX", 0,0);
661   return arcompact_handle04_helper_dasm(DASM_PARAMS, "MAX", 0,0);
659662}
660663
661664int arcompact_handle04_09_dasm(DASM_OPS_32)
662665{
663   return arcompact_handle04_helper_dasm(output, pc, op, oprom, "MIN", 0,0);
666   return arcompact_handle04_helper_dasm(DASM_PARAMS, "MIN", 0,0);
664667}
665668
666669
667670int arcompact_handle04_0a_dasm(DASM_OPS_32)
668671{
669   return arcompact_handle04_helper_dasm(output, pc, op, oprom, "MOV", 1,0);
672   return arcompact_handle04_helper_dasm(DASM_PARAMS, "MOV", 1,0);
670673}
671674
672675int arcompact_handle04_0b_dasm(DASM_OPS_32)
673676{
674   return arcompact_handle04_helper_dasm(output, pc, op, oprom, "TST", 1,0);
677   return arcompact_handle04_helper_dasm(DASM_PARAMS, "TST", 1,0);
675678}
676679
677680int arcompact_handle04_0c_dasm(DASM_OPS_32)
678681{
679   return arcompact_handle04_helper_dasm(output, pc, op, oprom, "CMP", 1,0);
682   return arcompact_handle04_helper_dasm(DASM_PARAMS, "CMP", 1,0);
680683}
681684
682685int arcompact_handle04_0d_dasm(DASM_OPS_32)
683686{
684   return arcompact_handle04_helper_dasm(output, pc, op, oprom, "RCMP", 1,0);
687   return arcompact_handle04_helper_dasm(DASM_PARAMS, "RCMP", 1,0);
685688}
686689
687690int arcompact_handle04_0e_dasm(DASM_OPS_32)
688691{
689   return arcompact_handle04_helper_dasm(output, pc, op, oprom, "RSUB", 0,0);
692   return arcompact_handle04_helper_dasm(DASM_PARAMS, "RSUB", 0,0);
690693}
691694
692695int arcompact_handle04_0f_dasm(DASM_OPS_32) 
693696{
694   return arcompact_handle04_helper_dasm(output, pc, op, oprom, "BSET", 0,0);
697   return arcompact_handle04_helper_dasm(DASM_PARAMS, "BSET", 0,0);
695698}
696699
697700int arcompact_handle04_10_dasm(DASM_OPS_32) 
698701{
699   return arcompact_handle04_helper_dasm(output, pc, op, oprom, "BCLR", 0,0);
702   return arcompact_handle04_helper_dasm(DASM_PARAMS, "BCLR", 0,0);
700703}
701704
702705int arcompact_handle04_11_dasm(DASM_OPS_32) 
703706{
704   return arcompact_handle04_helper_dasm(output, pc, op, oprom, "BTST", 0,0);
707   return arcompact_handle04_helper_dasm(DASM_PARAMS, "BTST", 0,0);
705708}
706709
707710int arcompact_handle04_12_dasm(DASM_OPS_32) 
708711{
709   return arcompact_handle04_helper_dasm(output, pc, op, oprom, "BXOR", 0,0);
712   return arcompact_handle04_helper_dasm(DASM_PARAMS, "BXOR", 0,0);
710713}
711714
712715int arcompact_handle04_13_dasm(DASM_OPS_32) 
713716{
714   return arcompact_handle04_helper_dasm(output, pc, op, oprom, "BMSK", 0,0);
717   return arcompact_handle04_helper_dasm(DASM_PARAMS, "BMSK", 0,0);
715718}
716719
717720int arcompact_handle04_14_dasm(DASM_OPS_32) 
718721{
719   return arcompact_handle04_helper_dasm(output, pc, op, oprom, "ADD1", 0,0);
722   return arcompact_handle04_helper_dasm(DASM_PARAMS, "ADD1", 0,0);
720723}
721724
722725int arcompact_handle04_15_dasm(DASM_OPS_32) 
723726{
724   return arcompact_handle04_helper_dasm(output, pc, op, oprom, "ADD2", 0,0);
727   return arcompact_handle04_helper_dasm(DASM_PARAMS, "ADD2", 0,0);
725728}
726729
727730int arcompact_handle04_16_dasm(DASM_OPS_32) 
728731{
729   return arcompact_handle04_helper_dasm(output, pc, op, oprom, "ADD3", 0,0);
732   return arcompact_handle04_helper_dasm(DASM_PARAMS, "ADD3", 0,0);
730733}
731734
732735int arcompact_handle04_17_dasm(DASM_OPS_32) 
733736{
734   return arcompact_handle04_helper_dasm(output, pc, op, oprom, "SUB1", 0,0);
737   return arcompact_handle04_helper_dasm(DASM_PARAMS, "SUB1", 0,0);
735738}
736739
737740int arcompact_handle04_18_dasm(DASM_OPS_32) 
738741{
739   return arcompact_handle04_helper_dasm(output, pc, op, oprom, "SUB2", 0,0);
742   return arcompact_handle04_helper_dasm(DASM_PARAMS, "SUB2", 0,0);
740743}
741744
742745int arcompact_handle04_19_dasm(DASM_OPS_32) 
743746{
744   return arcompact_handle04_helper_dasm(output, pc, op, oprom, "SUB3", 0,0);
747   return arcompact_handle04_helper_dasm(DASM_PARAMS, "SUB3", 0,0);
745748}
746749
747750int arcompact_handle04_1a_dasm(DASM_OPS_32) 
748751{
749   return arcompact_handle04_helper_dasm(output, pc, op, oprom, "MPY", 0,0);
752   return arcompact_handle04_helper_dasm(DASM_PARAMS, "MPY", 0,0);
750753} // *
751754
752755int arcompact_handle04_1b_dasm(DASM_OPS_32) 
753756{
754   return arcompact_handle04_helper_dasm(output, pc, op, oprom, "MPYH", 0,0);
757   return arcompact_handle04_helper_dasm(DASM_PARAMS, "MPYH", 0,0);
755758} // *
756759
757760int arcompact_handle04_1c_dasm(DASM_OPS_32) 
758761{
759   return arcompact_handle04_helper_dasm(output, pc, op, oprom, "MPYHU", 0,0);
762   return arcompact_handle04_helper_dasm(DASM_PARAMS, "MPYHU", 0,0);
760763} // *
761764
762765int arcompact_handle04_1d_dasm(DASM_OPS_32) 
763766{
764   return arcompact_handle04_helper_dasm(output, pc, op, oprom, "MPYU", 0,0);
767   return arcompact_handle04_helper_dasm(DASM_PARAMS, "MPYU", 0,0);
765768} // *
766769
767770
768771
769772int arcompact_handle04_20_dasm(DASM_OPS_32)
770773{
771   return arcompact_handle04_helper_dasm(output, pc, op, oprom, "J", 1,1);
774   return arcompact_handle04_helper_dasm(DASM_PARAMS, "J", 1,1);
772775}
773776
774777
775778
776779int arcompact_handle04_21_dasm(DASM_OPS_32)
777780{
778   return arcompact_handle04_helper_dasm(output, pc, op, oprom, "J.D", 1,1);
781   return arcompact_handle04_helper_dasm(DASM_PARAMS, "J.D", 1,1);
779782}
780783
781784int arcompact_handle04_22_dasm(DASM_OPS_32)
782785{
783   return arcompact_handle04_helper_dasm(output, pc, op, oprom, "JL", 1,1);
786   return arcompact_handle04_helper_dasm(DASM_PARAMS, "JL", 1,1);
784787}
785788
786789int arcompact_handle04_23_dasm(DASM_OPS_32)
787790{
788   return arcompact_handle04_helper_dasm(output, pc, op, oprom, "JL.D", 1,1);
791   return arcompact_handle04_helper_dasm(DASM_PARAMS, "JL.D", 1,1);
789792}
790793
791794
r242426r242427
797800int arcompact_handle04_2b_dasm(DASM_OPS_32)  { print("SR (%08x)", op); return 4;}
798801
799802
800int arcompact_handle04_2f_helper_dasm(char *output, offs_t pc, UINT32 op, const UINT8* oprom, const char* optext)
803int arcompact_handle04_2f_helper_dasm(DASM_OPS_32, const char* optext)
801804{
802805   //           
803806   // 0010 0bbb pp10 1111 FBBB CCCC CCII IIII
r242426r242427
851854}
852855
853856
854int arcompact_handle04_2f_00_dasm(DASM_OPS_32)  { return arcompact_handle04_2f_helper_dasm(output, pc, op, oprom, "ASL"); } // ASL
855int arcompact_handle04_2f_01_dasm(DASM_OPS_32)  { return arcompact_handle04_2f_helper_dasm(output, pc, op, oprom, "ASR"); } // ASR
856int arcompact_handle04_2f_02_dasm(DASM_OPS_32)  { return arcompact_handle04_2f_helper_dasm(output, pc, op, oprom, "LSR"); } // LSR
857int arcompact_handle04_2f_03_dasm(DASM_OPS_32)  { return arcompact_handle04_2f_helper_dasm(output, pc, op, oprom, "ROR"); } // ROR
858int arcompact_handle04_2f_04_dasm(DASM_OPS_32)  { return arcompact_handle04_2f_helper_dasm(output, pc, op, oprom, "RCC"); } // RCC
859int arcompact_handle04_2f_05_dasm(DASM_OPS_32)  { return arcompact_handle04_2f_helper_dasm(output, pc, op, oprom, "SEXB"); } // SEXB
860int arcompact_handle04_2f_06_dasm(DASM_OPS_32)  { return arcompact_handle04_2f_helper_dasm(output, pc, op, oprom, "SEXW"); } // SEXW
861int arcompact_handle04_2f_07_dasm(DASM_OPS_32)  { return arcompact_handle04_2f_helper_dasm(output, pc, op, oprom, "EXTB"); } // EXTB
862int arcompact_handle04_2f_08_dasm(DASM_OPS_32)  { return arcompact_handle04_2f_helper_dasm(output, pc, op, oprom, "EXTW"); } // EXTW
863int arcompact_handle04_2f_09_dasm(DASM_OPS_32)  { return arcompact_handle04_2f_helper_dasm(output, pc, op, oprom, "ABS"); } // ABS
864int arcompact_handle04_2f_0a_dasm(DASM_OPS_32)  { return arcompact_handle04_2f_helper_dasm(output, pc, op, oprom, "NOT"); } // NOT
865int arcompact_handle04_2f_0b_dasm(DASM_OPS_32)  { return arcompact_handle04_2f_helper_dasm(output, pc, op, oprom, "RCL"); } // RLC
866int arcompact_handle04_2f_0c_dasm(DASM_OPS_32)  { return arcompact_handle04_2f_helper_dasm(output, pc, op, oprom, "EX"); } // EX
857int arcompact_handle04_2f_00_dasm(DASM_OPS_32)  { return arcompact_handle04_2f_helper_dasm(DASM_PARAMS, "ASL"); } // ASL
858int arcompact_handle04_2f_01_dasm(DASM_OPS_32)  { return arcompact_handle04_2f_helper_dasm(DASM_PARAMS, "ASR"); } // ASR
859int arcompact_handle04_2f_02_dasm(DASM_OPS_32)  { return arcompact_handle04_2f_helper_dasm(DASM_PARAMS, "LSR"); } // LSR
860int arcompact_handle04_2f_03_dasm(DASM_OPS_32)  { return arcompact_handle04_2f_helper_dasm(DASM_PARAMS, "ROR"); } // ROR
861int arcompact_handle04_2f_04_dasm(DASM_OPS_32)  { return arcompact_handle04_2f_helper_dasm(DASM_PARAMS, "RCC"); } // RCC
862int arcompact_handle04_2f_05_dasm(DASM_OPS_32)  { return arcompact_handle04_2f_helper_dasm(DASM_PARAMS, "SEXB"); } // SEXB
863int arcompact_handle04_2f_06_dasm(DASM_OPS_32)  { return arcompact_handle04_2f_helper_dasm(DASM_PARAMS, "SEXW"); } // SEXW
864int arcompact_handle04_2f_07_dasm(DASM_OPS_32)  { return arcompact_handle04_2f_helper_dasm(DASM_PARAMS, "EXTB"); } // EXTB
865int arcompact_handle04_2f_08_dasm(DASM_OPS_32)  { return arcompact_handle04_2f_helper_dasm(DASM_PARAMS, "EXTW"); } // EXTW
866int arcompact_handle04_2f_09_dasm(DASM_OPS_32)  { return arcompact_handle04_2f_helper_dasm(DASM_PARAMS, "ABS"); } // ABS
867int arcompact_handle04_2f_0a_dasm(DASM_OPS_32)  { return arcompact_handle04_2f_helper_dasm(DASM_PARAMS, "NOT"); } // NOT
868int arcompact_handle04_2f_0b_dasm(DASM_OPS_32)  { return arcompact_handle04_2f_helper_dasm(DASM_PARAMS, "RCL"); } // RLC
869int arcompact_handle04_2f_0c_dasm(DASM_OPS_32)  { return arcompact_handle04_2f_helper_dasm(DASM_PARAMS, "EX"); } // EX
867870
868871
869872int arcompact_handle04_2f_3f_01_dasm(DASM_OPS_32)  { print("SLEEP (%08x)", op); return 4;}
r242426r242427
880883
881884// 0010 0bbb aa11 0ZZX DBBB CCCC CCAA AAAA
882885// note, bits  11 0ZZX are part of the sub-opcode # already - this is a special encoding
883int arcompact_handle04_3x_helper_dasm(char *output, offs_t pc, UINT32 op, const UINT8* oprom, int dsize, int extend)
886int arcompact_handle04_3x_helper_dasm(DASM_OPS_32, int dsize, int extend)
884887{
885888   int size = 4;
886889   output += sprintf(output, "LD");
r242426r242427
911914
912915}
913916
914int arcompact_handle04_30_dasm(DASM_OPS_32)  { return arcompact_handle04_3x_helper_dasm(output,pc,op,oprom,0,0); }
917int arcompact_handle04_30_dasm(DASM_OPS_32)  { return arcompact_handle04_3x_helper_dasm(DASM_PARAMS,0,0); }
915918// ZZ value of 0x0 with X of 1 is illegal
916int arcompact_handle04_31_dasm(DASM_OPS_32)  { return arcompact_handle04_3x_helper_dasm(output,pc,op,oprom,0,1); }
917int arcompact_handle04_32_dasm(DASM_OPS_32)  { return arcompact_handle04_3x_helper_dasm(output,pc,op,oprom,1,0); }
918int arcompact_handle04_33_dasm(DASM_OPS_32)  { return arcompact_handle04_3x_helper_dasm(output,pc,op,oprom,1,1); }
919int arcompact_handle04_34_dasm(DASM_OPS_32)  { return arcompact_handle04_3x_helper_dasm(output,pc,op,oprom,2,0); }
920int arcompact_handle04_35_dasm(DASM_OPS_32)  { return arcompact_handle04_3x_helper_dasm(output,pc,op,oprom,2,1); }
919int arcompact_handle04_31_dasm(DASM_OPS_32)  { return arcompact_handle04_3x_helper_dasm(DASM_PARAMS,0,1); }
920int arcompact_handle04_32_dasm(DASM_OPS_32)  { return arcompact_handle04_3x_helper_dasm(DASM_PARAMS,1,0); }
921int arcompact_handle04_33_dasm(DASM_OPS_32)  { return arcompact_handle04_3x_helper_dasm(DASM_PARAMS,1,1); }
922int arcompact_handle04_34_dasm(DASM_OPS_32)  { return arcompact_handle04_3x_helper_dasm(DASM_PARAMS,2,0); }
923int arcompact_handle04_35_dasm(DASM_OPS_32)  { return arcompact_handle04_3x_helper_dasm(DASM_PARAMS,2,1); }
921924// ZZ value of 0x3 is illegal
922int arcompact_handle04_36_dasm(DASM_OPS_32)  { return arcompact_handle04_3x_helper_dasm(output,pc,op,oprom,3,0); }
923int arcompact_handle04_37_dasm(DASM_OPS_32)  { return arcompact_handle04_3x_helper_dasm(output,pc,op,oprom,3,1); }
925int arcompact_handle04_36_dasm(DASM_OPS_32)  { return arcompact_handle04_3x_helper_dasm(DASM_PARAMS,3,0); }
926int arcompact_handle04_37_dasm(DASM_OPS_32)  { return arcompact_handle04_3x_helper_dasm(DASM_PARAMS,3,1); }
924927
925928
926929
r242426r242427
989992
990993
991994
992int arcompact_handle0c_helper_dasm(char *output, offs_t pc, UINT16 op, const UINT8* oprom, const char* optext)
995int arcompact_handle0c_helper_dasm(DASM_OPS_16, const char* optext)
993996{
994997   int areg, breg, creg;
995998
r242426r242427
10091012
10101013int arcompact_handle0c_00_dasm(DASM_OPS_16)
10111014{
1012   return arcompact_handle0c_helper_dasm(output, pc, op, oprom, "LD_S");
1015   return arcompact_handle0c_helper_dasm(DASM_PARAMS, "LD_S");
10131016}
10141017
10151018int arcompact_handle0c_01_dasm(DASM_OPS_16)
10161019{
1017   return arcompact_handle0c_helper_dasm(output, pc, op, oprom, "LDB_S");
1020   return arcompact_handle0c_helper_dasm(DASM_PARAMS, "LDB_S");
10181021}
10191022
10201023int arcompact_handle0c_02_dasm(DASM_OPS_16)
10211024{
1022   return arcompact_handle0c_helper_dasm(output, pc, op, oprom, "LDW_S");
1025   return arcompact_handle0c_helper_dasm(DASM_PARAMS, "LDW_S");
10231026}
10241027
10251028int arcompact_handle0c_03_dasm(DASM_OPS_16)
10261029{
1027   return arcompact_handle0c_helper_dasm(output, pc, op, oprom, "ADD_S");
1030   return arcompact_handle0c_helper_dasm(DASM_PARAMS, "ADD_S");
10281031}
10291032
10301033
1031int arcompact_handle0d_helper_dasm(char *output, offs_t pc, UINT16 op, const UINT8* oprom, const char* optext)
1034int arcompact_handle0d_helper_dasm(DASM_OPS_16, const char* optext)
10321035{
10331036   int u, breg, creg;
10341037
r242426r242427
10461049
10471050int arcompact_handle0d_00_dasm(DASM_OPS_16)
10481051{
1049   return arcompact_handle0d_helper_dasm(output, pc, op, oprom, "ADD_S");
1052   return arcompact_handle0d_helper_dasm(DASM_PARAMS, "ADD_S");
10501053}
10511054
10521055int arcompact_handle0d_01_dasm(DASM_OPS_16)
10531056{
1054   return arcompact_handle0d_helper_dasm(output, pc, op, oprom, "SUB_S");
1057   return arcompact_handle0d_helper_dasm(DASM_PARAMS, "SUB_S");
10551058}
10561059
10571060int arcompact_handle0d_02_dasm(DASM_OPS_16)
10581061{
1059   return arcompact_handle0d_helper_dasm(output, pc, op, oprom, "ASL_S");
1062   return arcompact_handle0d_helper_dasm(DASM_PARAMS, "ASL_S");
10601063}
10611064
10621065int arcompact_handle0d_03_dasm(DASM_OPS_16)
10631066{
1064   return arcompact_handle0d_helper_dasm(output, pc, op, oprom, "ASR_S");
1067   return arcompact_handle0d_helper_dasm(DASM_PARAMS, "ASR_S");
10651068}
10661069
10671070
10681071
1069int arcompact_handle0e_0x_helper_dasm(char *output, offs_t pc, UINT16 op, const UINT8* oprom, const char* optext, int revop)
1072int arcompact_handle0e_0x_helper_dasm(DASM_OPS_16, const char* optext, int revop)
10701073{
10711074   int h,breg;
10721075   int size = 2;
r242426r242427
10961099
10971100int arcompact_handle0e_00_dasm(DASM_OPS_16)
10981101{
1099   return arcompact_handle0e_0x_helper_dasm(output, pc, op, oprom, "ADD_S", 0);
1102   return arcompact_handle0e_0x_helper_dasm(DASM_PARAMS, "ADD_S", 0);
11001103}
11011104
11021105int arcompact_handle0e_01_dasm(DASM_OPS_16)
11031106{
1104   return arcompact_handle0e_0x_helper_dasm(output, pc, op, oprom, "MOV_S", 0);
1107   return arcompact_handle0e_0x_helper_dasm(DASM_PARAMS, "MOV_S", 0);
11051108}
11061109
11071110int arcompact_handle0e_02_dasm(DASM_OPS_16)
11081111{
1109   return arcompact_handle0e_0x_helper_dasm(output, pc, op, oprom, "CMP_S", 0);
1112   return arcompact_handle0e_0x_helper_dasm(DASM_PARAMS, "CMP_S", 0);
11101113}
11111114
11121115int arcompact_handle0e_03_dasm(DASM_OPS_16)
11131116{
1114   return arcompact_handle0e_0x_helper_dasm(output, pc, op, oprom, "MOV_S", 1);
1117   return arcompact_handle0e_0x_helper_dasm(DASM_PARAMS, "MOV_S", 1);
11151118}
11161119
11171120
r242426r242427
11721175int arcompact_handle0f_1f_dasm(DASM_OPS_16)  { print("BRK_S (%08x)", op); return 2;}
11731176
11741177
1175int arcompact_handle_ld_helper_dasm(char *output, offs_t pc, UINT16 op, const UINT8* oprom, const char* optext, int shift, int swap)
1178int arcompact_handle_ld_helper_dasm(DASM_OPS_16, const char* optext, int shift, int swap)
11761179{
11771180   int breg, creg, u;
11781181
r242426r242427
11941197
11951198int arcompact_handle10_dasm(DASM_OPS_16)
11961199{
1197   return arcompact_handle_ld_helper_dasm(output, pc, op, oprom, "LD_S", 2, 0);
1200   return arcompact_handle_ld_helper_dasm(DASM_PARAMS, "LD_S", 2, 0);
11981201}
11991202
12001203int arcompact_handle11_dasm(DASM_OPS_16)
12011204{
1202   return arcompact_handle_ld_helper_dasm(output, pc, op, oprom, "LDB_S", 0, 0);
1205   return arcompact_handle_ld_helper_dasm(DASM_PARAMS, "LDB_S", 0, 0);
12031206}
12041207
12051208int arcompact_handle12_dasm(DASM_OPS_16)
12061209{
1207   return arcompact_handle_ld_helper_dasm(output, pc, op, oprom, "LDW_S", 1, 0);
1210   return arcompact_handle_ld_helper_dasm(DASM_PARAMS, "LDW_S", 1, 0);
12081211}
12091212
12101213int arcompact_handle13_dasm(DASM_OPS_16)
12111214{
1212   return arcompact_handle_ld_helper_dasm(output, pc, op, oprom, "LDW_S.X", 1, 0);
1215   return arcompact_handle_ld_helper_dasm(DASM_PARAMS, "LDW_S.X", 1, 0);
12131216}
12141217
12151218int arcompact_handle14_dasm(DASM_OPS_16)
12161219{
1217   return arcompact_handle_ld_helper_dasm(output, pc, op, oprom, "ST_S", 2, 1);
1220   return arcompact_handle_ld_helper_dasm(DASM_PARAMS, "ST_S", 2, 1);
12181221}
12191222
12201223int arcompact_handle15_dasm(DASM_OPS_16)
12211224{
1222   return arcompact_handle_ld_helper_dasm(output, pc, op, oprom, "STB_S", 0, 1);
1225   return arcompact_handle_ld_helper_dasm(DASM_PARAMS, "STB_S", 0, 1);
12231226}
12241227
12251228int arcompact_handle16_dasm(DASM_OPS_16)
12261229{
1227   return arcompact_handle_ld_helper_dasm(output, pc, op, oprom, "STW_S", 1, 1);
1230   return arcompact_handle_ld_helper_dasm(DASM_PARAMS, "STW_S", 1, 1);
12281231}
12291232
12301233
r242426r242427
14321435   return 2;
14331436}
14341437
1435int arcompact_handle1d_helper_dasm(char *output, offs_t pc, UINT16 op, const UINT8* oprom, const char* optext)
1438int arcompact_handle1d_helper_dasm(DASM_OPS_16, const char* optext)
14361439{
14371440   int breg;
14381441   COMMON16_GET_breg;
r242426r242427
14411444   int s = (op & 0x007f) >> 0;   op &= ~0x007f;
14421445   if (s & 0x40) s = -0x40 + (s & 0x3f);
14431446
1444   print("%s %s %08x", optext, regnames[breg], (pc&0xfffffffc) + s*2);
1447   print("%s %s %08x", optext, regnames[breg], PC_ALIGNED32 + s*2);
14451448   return 2;
14461449}
14471450
14481451
1449int arcompact_handle1d_00_dasm(DASM_OPS_16)  { return arcompact_handle1d_helper_dasm(output,pc,op,oprom,"BREQ_S"); }
1450int arcompact_handle1d_01_dasm(DASM_OPS_16)  { return arcompact_handle1d_helper_dasm(output,pc,op,oprom,"BRNE_S"); }
1452int arcompact_handle1d_00_dasm(DASM_OPS_16)  { return arcompact_handle1d_helper_dasm(DASM_PARAMS,"BREQ_S"); }
1453int arcompact_handle1d_01_dasm(DASM_OPS_16)  { return arcompact_handle1d_helper_dasm(DASM_PARAMS,"BRNE_S"); }
14511454
14521455
1453int arcompact_handle1e_0x_helper_dasm(char *output, offs_t pc, UINT16 op, const UINT8* oprom, const char* optext)
1456int arcompact_handle1e_0x_helper_dasm(DASM_OPS_16, const char* optext)
14541457{
14551458   int s = (op & 0x01ff) >> 0;   op &= ~0x01ff;
14561459   if (s & 0x100) s = -0x100 + (s & 0xff);
14571460
1458   print("%s %08x", optext, (pc&0xfffffffc) + s*2);
1461   print("%s %08x", optext, PC_ALIGNED32 + s*2);
14591462   return 2;
14601463}
14611464
14621465
14631466
1464int arcompact_handle1e_00_dasm(DASM_OPS_16)  { return arcompact_handle1e_0x_helper_dasm(output, pc, op, oprom, "BL_S");  }
1465int arcompact_handle1e_01_dasm(DASM_OPS_16)  { return arcompact_handle1e_0x_helper_dasm(output, pc, op, oprom, "BEQ_S"); }
1466int arcompact_handle1e_02_dasm(DASM_OPS_16)  { return arcompact_handle1e_0x_helper_dasm(output, pc, op, oprom, "BNE_S"); }
1467int arcompact_handle1e_00_dasm(DASM_OPS_16)  { return arcompact_handle1e_0x_helper_dasm(DASM_PARAMS, "BL_S");  }
1468int arcompact_handle1e_01_dasm(DASM_OPS_16)  { return arcompact_handle1e_0x_helper_dasm(DASM_PARAMS, "BEQ_S"); }
1469int arcompact_handle1e_02_dasm(DASM_OPS_16)  { return arcompact_handle1e_0x_helper_dasm(DASM_PARAMS, "BNE_S"); }
14671470
1468int arcompact_handle1e_03_0x_helper_dasm(char *output, offs_t pc, UINT16 op, const UINT8* oprom, const char* optext)
1471int arcompact_handle1e_03_0x_helper_dasm(DASM_OPS_16, const char* optext)
14691472{
14701473   int s = (op & 0x003f) >> 0;   op &= ~0x003f;
14711474   if (s & 0x020) s = -0x20 + (s & 0x1f);
14721475
1473   print("%s %08x", optext, (pc&0xfffffffc) + s*2);
1476   print("%s %08x", optext, PC_ALIGNED32 + s*2);
14741477   return 2;
14751478}
14761479
1477int arcompact_handle1e_03_00_dasm(DASM_OPS_16)  { return arcompact_handle1e_03_0x_helper_dasm(output, pc, op, oprom, "BGT_S"); }
1478int arcompact_handle1e_03_01_dasm(DASM_OPS_16)  { return arcompact_handle1e_03_0x_helper_dasm(output, pc, op, oprom, "BGE_S"); }
1479int arcompact_handle1e_03_02_dasm(DASM_OPS_16)  { return arcompact_handle1e_03_0x_helper_dasm(output, pc, op, oprom, "BLT_S"); }
1480int arcompact_handle1e_03_03_dasm(DASM_OPS_16)  { return arcompact_handle1e_03_0x_helper_dasm(output, pc, op, oprom, "BLE_S"); }
1481int arcompact_handle1e_03_04_dasm(DASM_OPS_16)  { return arcompact_handle1e_03_0x_helper_dasm(output, pc, op, oprom, "BHI_S"); }
1482int arcompact_handle1e_03_05_dasm(DASM_OPS_16)  { return arcompact_handle1e_03_0x_helper_dasm(output, pc, op, oprom, "BHS_S"); }
1483int arcompact_handle1e_03_06_dasm(DASM_OPS_16)  { return arcompact_handle1e_03_0x_helper_dasm(output, pc, op, oprom, "BLO_S"); }
1484int arcompact_handle1e_03_07_dasm(DASM_OPS_16)  { return arcompact_handle1e_03_0x_helper_dasm(output, pc, op, oprom, "BLS_S"); }
1480int arcompact_handle1e_03_00_dasm(DASM_OPS_16)  { return arcompact_handle1e_03_0x_helper_dasm(DASM_PARAMS, "BGT_S"); }
1481int arcompact_handle1e_03_01_dasm(DASM_OPS_16)  { return arcompact_handle1e_03_0x_helper_dasm(DASM_PARAMS, "BGE_S"); }
1482int arcompact_handle1e_03_02_dasm(DASM_OPS_16)  { return arcompact_handle1e_03_0x_helper_dasm(DASM_PARAMS, "BLT_S"); }
1483int arcompact_handle1e_03_03_dasm(DASM_OPS_16)  { return arcompact_handle1e_03_0x_helper_dasm(DASM_PARAMS, "BLE_S"); }
1484int arcompact_handle1e_03_04_dasm(DASM_OPS_16)  { return arcompact_handle1e_03_0x_helper_dasm(DASM_PARAMS, "BHI_S"); }
1485int arcompact_handle1e_03_05_dasm(DASM_OPS_16)  { return arcompact_handle1e_03_0x_helper_dasm(DASM_PARAMS, "BHS_S"); }
1486int arcompact_handle1e_03_06_dasm(DASM_OPS_16)  { return arcompact_handle1e_03_0x_helper_dasm(DASM_PARAMS, "BLO_S"); }
1487int arcompact_handle1e_03_07_dasm(DASM_OPS_16)  { return arcompact_handle1e_03_0x_helper_dasm(DASM_PARAMS, "BLS_S"); }
14851488
14861489int arcompact_handle1f_dasm(DASM_OPS_16)
14871490{
14881491   int s = (op & 0x07ff) >> 0;   op &= ~0x07ff;
14891492   if (s & 0x400) s = -0x400 + (s & 0x3ff);
14901493
1491   print("BL_S %08x", (pc&0xfffffffc) + (s*4));
1494   print("BL_S %08x", PC_ALIGNED32 + (s*4));
14921495   return 2;
14931496}
14941497


Previous 199869 Revisions Next


© 1997-2024 The MAME Team