Previous 199869 Revisions Next

r34135 Thursday 1st January, 2015 at 04:34:30 UTC by R. Belmont
m68k: implement FTRAP instruction, add "68020 with FPU" CPU type. [R. Belmont]
[src/emu/cpu/m68000]m68000.h m68k_in.c m68kcpu.c m68kfpu.inc

trunk/src/emu/cpu/m68000/m68000.h
r242646r242647
376376   void init_cpu_m68008(void);
377377   void init_cpu_m68010(void);
378378   void init_cpu_m68020(void);
379   void init_cpu_m68020fpu(void);
379380   void init_cpu_m68020pmmu(void);
380381   void init_cpu_m68020hmmu(void);
381382   void init_cpu_m68ec020(void);
r242646r242647
554555protected:
555556};
556557
558class m68020fpu_device : public m68000_base_device
559{
560public:
561   // construction/destruction
562   m68020fpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
563
564   virtual UINT32 disasm_min_opcode_bytes() const { return 2; };
565   virtual UINT32 disasm_max_opcode_bytes() const { return 20; };
566   virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options);
567
568   virtual UINT32 execute_min_cycles() const { return 2; };
569   virtual UINT32 execute_max_cycles() const { return 158; };
570
571   virtual UINT32 execute_default_irq_vector() const { return -1; };
572
573   // device-level overrides
574   virtual void device_start();
575protected:
576};
577
557578class m68020pmmu_device : public m68000_base_device
558579{
559580public:
r242646r242647
773794extern const device_type M68010;
774795extern const device_type M68EC020;
775796extern const device_type M68020;
797extern const device_type M68020FPU;
776798extern const device_type M68020PMMU;
777799extern const device_type M68020HMMU;
778800extern const device_type M68EC030;
trunk/src/emu/cpu/m68000/m68k_in.c
r242646r242647
272272extern void m68040_fpu_op0(m68000_base_device *m68k);
273273extern void m68040_fpu_op1(m68000_base_device *m68k);
274274extern void m68881_mmu_ops(m68000_base_device *m68k);
275extern void m68881_ftrap(m68000_base_device *m68k);
275276
276277/* ======================================================================== */
277278/* ========================= INSTRUCTION HANDLERS ========================= */
r242646r242647
551552cpgen     32  .     .     1111...000......  ..........  . . U U . . U   .   .   4   4   .   .   .
552553cpscc     32  .     .     1111...001......  ..........  . . U U . . U   .   .   4   4   .   .   .
553554cptrapcc  32  .     .     1111...001111...  ..........  . . U U . . U   .   .   4   4   .   .   .
555ftrapcc   32  .     .     1111001001111...  ..........  . . U U . . U   .   .   4   4   .   .   .
554556dbt       16  .     .     0101000011001...  ..........  U U U U U U U  12  12   6   6   6   6   6
555557dbf       16  .     .     0101000111001...  ..........  U U U U U U U  12  12   6   4   4   4   4
556558dbcc      16  .     .     0101....11001...  ..........  U U U U U U U  12  12   6   6   6   6   6
r242646r242647
44774479   m68ki_exception_1111(mc68kcpu);
44784480}
44794481
4482M68KMAKE_OP(ftrapcc, 32, ., .)
4483{
4484   if((mc68kcpu)->has_fpu)
4485   {
4486      m68881_ftrap(mc68kcpu);
4487      return;
4488   }
4489   m68ki_exception_1111(mc68kcpu);
4490}
4491
44804492M68KMAKE_OP(dbt, 16, ., .)
44814493{
44824494   REG_PC(mc68kcpu) += 2;
trunk/src/emu/cpu/m68000/m68kcpu.c
r242646r242647
699699   {
700700      /* only the 68010 throws this unique type-1000 frame */
701701      m68ki_stack_frame_1000(m68k, REG_PPC(m68k), sr, EXCEPTION_BUS_ERROR);
702   }
702   }
703703   else if (m68k->mmu_tmp_buserror_address == REG_PPC(m68k))
704704   {
705705      m68ki_stack_frame_1010(m68k, sr, EXCEPTION_BUS_ERROR, REG_PPC(m68k), m68k->mmu_tmp_buserror_address);
r242646r242647
18851885   define_state();
18861886}
18871887
1888void m68000_base_device::init_cpu_m68020fpu(void)
1889{
1890   init_cpu_m68020();
18881891
1892   has_fpu          = 1;
1893}
1894
18891895void m68000_base_device::init_cpu_m68020pmmu(void)
18901896{
18911897   init_cpu_m68020();
r242646r242647
22432249offs_t m68010_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) { return CPU_DISASSEMBLE_NAME(dasm_m68010)(this, buffer, pc, oprom, opram, options); };
22442250offs_t m68ec020_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) { return CPU_DISASSEMBLE_NAME(dasm_m68020)(this, buffer, pc, oprom, opram, options); };
22452251offs_t m68020_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) { return CPU_DISASSEMBLE_NAME(dasm_m68020)(this, buffer, pc, oprom, opram, options); };
2252offs_t m68020fpu_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) { return CPU_DISASSEMBLE_NAME(dasm_m68020)(this, buffer, pc, oprom, opram, options); };
22462253offs_t m68020pmmu_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) { return CPU_DISASSEMBLE_NAME(dasm_m68020)(this, buffer, pc, oprom, opram, options); };
22472254offs_t m68020hmmu_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) { return CPU_DISASSEMBLE_NAME(dasm_m68020)(this, buffer, pc, oprom, opram, options); };
22482255offs_t m68ec030_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) { return CPU_DISASSEMBLE_NAME(dasm_m68ec030)(this, buffer, pc, oprom, opram, options); };
r242646r242647
25472554const device_type M68010 = &device_creator<m68010_device>;
25482555const device_type M68EC020 = &device_creator<m68ec020_device>;
25492556const device_type M68020 = &device_creator<m68020_device>;
2557const device_type M68020FPU = &device_creator<m68020fpu_device>;
25502558const device_type M68020PMMU = &device_creator<m68020pmmu_device>;
25512559const device_type M68020HMMU = &device_creator<m68020hmmu_device>;
25522560const device_type M68EC030 = &device_creator<m68ec030_device>;
r242646r242647
26462654   init_cpu_m68020();
26472655}
26482656
2657
2658m68020fpu_device::m68020fpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
2659   : m68000_base_device(mconfig, "M68020FPU", tag, owner, clock, M68020, 32,32, "m68020fpu", __FILE__)
2660{
2661}
2662
2663void m68020fpu_device::device_start()
2664{
2665   init_cpu_m68020fpu();
2666}
2667
26492668// 68020 with 68851 PMMU
26502669m68020pmmu_device::m68020pmmu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
26512670   : m68000_base_device(mconfig, "M68020PMMU", tag, owner, clock, M68020PMMU, 32,32, "m68020pmmu", __FILE__)
trunk/src/emu/cpu/m68000/m68kfpu.inc
r242646r242647
21662166      default:    fatalerror("m68040_fpu_op1: unimplemented op %d at %08X\n", (m68k->ir >> 6) & 0x3, REG_PC(m68k)-2);
21672167   }
21682168}
2169
2170void m68881_ftrap(m68000_base_device *m68k)
2171{
2172   UINT16 w2  = OPER_I_16(m68k);
2173
2174   // now check the condition
2175   if (TEST_CONDITION(m68k, w2 & 0x3f))
2176   {
2177      // trap here
2178      m68ki_exception_trap(m68k, EXCEPTION_TRAPV);
2179   }
2180   else   // fall through, requires eating the operand
2181   {
2182      switch (m68k->ir & 0x7)
2183      {
2184         case 2:   // word operand
2185            OPER_I_16(m68k);
2186            break;
2187
2188         case 3: // long word operand
2189            OPER_I_32(m68k);
2190            break;
2191
2192         case 4:   // no operand
2193            break;
2194      }
2195   }
2196}
2197


Previous 199869 Revisions Next


© 1997-2024 The MAME Team