Previous 199869 Revisions Next

r19847 Thursday 27th December, 2012 at 03:55:41 UTC by R. Belmont
Preliminary support for M740 (M5074x/M5074x) CPU family [R. Belmont]
[src/emu/cpu]cpu.mak
[src/emu/cpu/m6502]dm740.lst* m6502.c m6502.h m740.c* m740.h* om740.lst*

trunk/src/emu/cpu/m6502/m6502.c
r19846r19847
602602      flags |= 2;
603603      break;
604604
605   case DASM_imz:
606      sprintf(buffer, " #$%02x, $%02x", opram[1], opram[2]);
607      flags |= 3;
608      break;
609
610   case DASM_spg:
611      sprintf(buffer, " \\$%02x", opram[1]);
612      flags |= 2;
613      break;
614
615   case DASM_biz:
616      sprintf(buffer, " %d, $%02x", (opram[0] >> 5) & 7, opram[1]);
617      flags |= 2;
618      break;
619
605620   default:
606621      fprintf(stderr, "Unhandled dasm mode %d\n", e.mode);
607622      abort();
trunk/src/emu/cpu/m6502/m6502.h
r19846r19847
124124        DASM_zpi,    /* zero page indirect (65c02) */
125125        DASM_zpx,    /* zero page + X */
126126        DASM_zpy,    /* zero page + Y */
127      DASM_imz,    /* load immediate byte, store to zero page address (M740) */
128      DASM_spg,    /* "special page": implied FF00 plus immediate value (M740)*/
129      DASM_biz    /* bit, zero page (M740) */
127130   };
128131
129132   enum {
130133      F_N = 0x80,
131134      F_V = 0x40,
132135      F_E = 0x20, // 65ce02
136      F_T = 0x20, // M740: replaces A with $00,X in some opcodes when set
133137      F_B = 0x10,
134138      F_D = 0x08,
135139      F_I = 0x04,
trunk/src/emu/cpu/m6502/dm740.lst
r0r19847
1# m740 device
2brk_imp      ora_idx      kil_non      bbs_acc      nop_zpg      ora_zpg      asl_zpg      bbs_biz      php_imp      ora_imm      asl_acc      seb_acc      nop_aba      ora_aba      asl_aba      seb_biz
3bpl_rel      ora_idy      clt_imp      bbc_acc      nop_zpx      ora_zpx      asl_zpx      bbc_biz      clc_imp      ora_aby      nop_imp      clb_acc      nop_abx      ora_abx      asl_abx      clb_biz
4jsr_adr      and_idx      jsr_spg      bbs_acc      bit_zpg      and_zpg      rol_zpg      bbs_biz      plp_imp      and_imm      rol_acc      seb_acc      bit_aba      and_aba      rol_aba      seb_biz
5bmi_rel      and_idy      set_imp      bbc_acc      nop_zpx      and_zpx      rol_zpx      bbc_biz      sec_imp      and_aby      nop_imp      clb_acc      ldm_imz      and_abx      rol_abx      clb_biz
6rti_imp      eor_idx      kil_non      bbs_acc      nop_zpg      eor_zpg      lsr_zpg      bbs_biz      pha_imp      eor_imm      lsr_acc      seb_acc      jmp_adr      eor_aba      lsr_aba      seb_biz
7bvc_rel      eor_idy      kil_non      bbc_acc      nop_zpx      eor_zpx      lsr_zpx      bbc_biz      cli_imp      eor_aby      nop_imp      clb_acc      nop_abx      eor_abx      lsr_abx      clb_biz
8rts_imp      adc_idx      kil_non      bbs_acc      nop_zpg      adc_zpg      ror_zpg      bbs_biz      pla_imp      adc_imm      ror_acc      seb_acc      jmp_ind      adc_aba      ror_aba      seb_biz
9bvs_rel      adc_idy      kil_non      bbc_acc      nop_zpx      adc_zpx      ror_zpx      bbc_biz      sei_imp      adc_aby      nop_imp      clb_acc      nop_abx      adc_abx      ror_abx      clb_biz
10bra_rel      sta_idx      rrf_zpg      bbs_acc      sty_zpg      sta_zpg      stx_zpg      bbs_biz      dey_imp      nop_imm      txa_imp      seb_acc      sty_aba      sta_aba      stx_aba      seb_biz
11bcc_rel      sta_idy      kil_non      bbc_acc      sty_zpx      sta_zpx      stx_zpy      bbc_biz      tya_imp      sta_aby      txs_imp      clb_acc      shy_abx      sta_abx      shx_aby      clb_biz
12ldy_imm      lda_idx      ldx_imm      bbs_acc      ldy_zpg      lda_zpg      ldx_zpg      bbs_biz      tay_imp      lda_imm      tax_imp      seb_acc      ldy_aba      lda_aba      ldx_aba      seb_biz
13bcs_rel      lda_idy      kil_non      bbc_acc      ldy_zpx      lda_zpx      ldx_zpy      bbc_biz      clv_imp      lda_aby      tsx_imp      clb_acc      ldy_abx      lda_abx      ldx_aby      clb_biz
14cpy_imm      cmp_idx      nop_imm      bbs_acc      cpy_zpg      cmp_zpg      dec_zpg      bbs_biz      iny_imp      cmp_imm      dex_imp      seb_acc      cpy_aba      cmp_aba      dec_aba      seb_biz
15bne_rel      cmp_idy      kil_non      bbc_acc      nop_zpx      cmp_zpx      dec_zpx      bbc_biz      cld_imp      cmp_aby      nop_imp      clb_acc      nop_abx      cmp_abx      dec_abx      clb_biz
16cpx_imm      sbc_idx      nop_imm      bbs_acc      cpx_zpg      sbc_zpg      inc_zpg      bbs_biz      inx_imp      sbc_imm      nop_imp      seb_acc      cpx_aba      sbc_aba      inc_aba      seb_biz
17beq_rel      sbc_idy      kil_non      bbc_acc      nop_zpx      sbc_zpx      inc_zpx      bbc_biz      sed_imp      sbc_aby      nop_imp      clb_acc      nop_abx      sbc_abx      inc_abx      clb_biz
18reset740
trunk/src/emu/cpu/m6502/om740.lst
r0r19847
1# m740 opcodes
2set_imp
3   read_pc_noinc();
4   P |= F_T;
5   prefetch();
6
7clt_imp
8   read_pc_noinc();
9   P &= ~F_T;
10   prefetch();
11
12ldm_imz
13   TMP = read_pc();
14   TMP2 = read_pc();
15   write(TMP2, TMP);
16   prefetch();
17
18jsr_spg
19   TMP = read_pc_noinc();
20   read(SP);
21   write(SP, PC>>8);
22   dec_SP();
23   write(SP, PC);
24   dec_SP();
25   TMP = set_h(TMP, 0xff);
26   PC = TMP;
27   prefetch();
28
29clb_acc
30   read_pc_noinc();
31   A = do_clb(A, (IR>>5) & 7);
32   prefetch();
33
34seb_acc
35   read_pc_noinc();
36   A = do_seb(A, (IR>>5) & 7);
37   prefetch();
38
39clb_biz
40   TMP = read_pc();
41   TMP2 = read(TMP);
42   TMP2 = do_clb(TMP2, (IR>>5) & 7);
43   write(TMP, TMP2);
44   prefetch();
45
46seb_biz
47   TMP = read_pc();
48   TMP2 = read(TMP);
49   TMP2 = do_seb(TMP2, (IR>>5) & 7);
50   write(TMP, TMP2);
51   prefetch();
52
53bbc_biz
54   TMP = read_pc();
55   TMP2 = read(TMP);
56   TMP = read_pc();
57   read_pc_noinc();
58   if(!(TMP2 & (1 << ((IR>>5) & 7)))) {
59      PC += INT8(TMP);
60   }
61   prefetch();
62
63bbs_biz
64   TMP = read_pc();
65   TMP2 = read(TMP);
66   TMP = read_pc();
67   read_pc_noinc();
68   if(TMP2 & (1 << ((IR>>5) & 7))) {
69      PC += INT8(TMP);
70   }
71   prefetch();
72
73bbc_acc
74   TMP = read_pc();
75   read_pc_noinc();
76   if(!(A & (1 << ((IR>>5) & 7)))) {
77      PC += INT8(TMP);
78   }
79   prefetch();
80
81bbs_acc
82   TMP = read_pc();
83   read_pc_noinc();
84   if(A & (1 << ((IR>>5) & 7))) {
85      PC += INT8(TMP);
86   }
87   prefetch();
88
89rrf_zpg
90   TMP = read_pc();
91   TMP2 = read(TMP);
92   TMP2 = do_rrf(TMP2);
93   write(TMP, TMP2);
94   prefetch();
95
96bra_rel
97   TMP = read_pc();
98   read_pc_noinc();
99   if(page_changing(PC, INT8(TMP))) {
100      read_direct(set_l(PC, PC+INT8(TMP)));
101   }
102   PC += INT8(TMP);
103   prefetch();
104
105reset740
106   PC = read_direct(0xfffe);
107   PC = set_h(PC, read_direct(0xffff));
108   prefetch();
109   inst_state = -1;
110
trunk/src/emu/cpu/m6502/m740.c
r0r19847
1/***************************************************************************
2
3    m740.c
4
5    Mitsubishi M740 series (M507xx/M509xx)
6
7****************************************************************************
8
9    Copyright Olivier Galibert
10    All rights reserved.
11
12    Redistribution and use in source and binary forms, with or without
13    modification, are permitted provided that the following conditions are
14    met:
15
16        * Redistributions of source code must retain the above copyright
17          notice, this list of conditions and the following disclaimer.
18        * Redistributions in binary form must reproduce the above copyright
19          notice, this list of conditions and the following disclaimer in
20          the documentation and/or other materials provided with the
21          distribution.
22        * Neither the name 'MAME' nor the names of its contributors may be
23          used to endorse or promote products derived from this software
24          without specific prior written permission.
25
26    THIS SOFTWARE IS PROVIDED BY OLIVIER GALIBERT ''AS IS'' AND ANY EXPRESS OR
27    IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
28    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
29    DISCLAIMED. IN NO EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT,
30    INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
31    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
32    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
34    STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
35    IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36    POSSIBILITY OF SUCH DAMAGE.
37
38***************************************************************************/
39
40#include "emu.h"
41#include "m740.h"
42
43const device_type M740 = &device_creator<m740_device>;
44
45m740_device::m740_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
46   m6502_device(mconfig, M740, "M740", tag, owner, clock)
47{
48}
49
50m740_device::m740_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) :
51   m6502_device(mconfig, type, name, tag, owner, clock)
52{
53}
54
55offs_t m740_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options)
56{
57   return disassemble_generic(buffer, pc, oprom, opram, options, disasm_entries);
58}
59
60void m740_device::device_reset()
61{
62   inst_state = STATE_RESET;
63   inst_substate = 0;
64   nmi_state = false;
65   irq_state = false;
66   apu_irq_state = false;
67   irq_taken = false;
68   v_state = false;
69   end_cycles = 0;
70   sync = false;
71   inhibit_interrupts = false;
72   SP = 0x00ff;
73}
74
75UINT8 m740_device::do_clb(UINT8 in, UINT8 bit)
76{
77   return in & ~(1<<bit);
78}
79
80UINT8 m740_device::do_seb(UINT8 in, UINT8 bit)
81{
82   return in | (1<<bit);
83}
84
85// swap the two nibbles of the input (Rotate Right Four bits)
86// doesn't affect the flags
87UINT8 m740_device::do_rrf(UINT8 in)
88{
89   return ((in&0xf)<<4) | ((in&0xf0)>>4);
90}
91
92#include "cpu/m6502/m740.inc"
trunk/src/emu/cpu/m6502/m740.h
r0r19847
1/***************************************************************************
2
3    m740.h
4
5    Mitsubishi M740 series (M507xx/M509xx)
6
7****************************************************************************
8
9    Copyright Olivier Galibert
10    All rights reserved.
11
12    Redistribution and use in source and binary forms, with or without
13    modification, are permitted provided that the following conditions are
14    met:
15
16        * Redistributions of source code must retain the above copyright
17          notice, this list of conditions and the following disclaimer.
18        * Redistributions in binary form must reproduce the above copyright
19          notice, this list of conditions and the following disclaimer in
20          the documentation and/or other materials provided with the
21          distribution.
22        * Neither the name 'MAME' nor the names of its contributors may be
23          used to endorse or promote products derived from this software
24          without specific prior written permission.
25
26    THIS SOFTWARE IS PROVIDED BY OLIVIER GALIBERT ''AS IS'' AND ANY EXPRESS OR
27    IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
28    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
29    DISCLAIMED. IN NO EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT,
30    INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
31    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
32    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
34    STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
35    IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36    POSSIBILITY OF SUCH DAMAGE.
37
38***************************************************************************/
39
40#ifndef __M740_H__
41#define __M740_H__
42
43#include "m6502.h"
44
45class m740_device : public m6502_device {
46public:
47   m740_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
48   m740_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock);
49
50   virtual void device_reset();
51
52   static const disasm_entry disasm_entries[0x100];
53
54   virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options);
55   virtual void do_exec_full();
56   virtual void do_exec_partial();
57
58protected:
59#define O(o) void o ## _full(); void o ## _partial()
60
61   UINT8 do_clb(UINT8 in, UINT8 bit);
62   UINT8 do_seb(UINT8 in, UINT8 bit);
63   UINT8 do_rrf(UINT8 in);
64
65   // m740 opcodes
66   O(clt_imp);
67   O(set_imp);
68   O(ldm_imz);
69   O(jsr_spg);
70   O(reset740);
71   O(seb_biz); O(seb_acc);
72   O(clb_biz); O(clb_acc);
73   O(bbc_biz); O(bbc_acc);
74   O(bbs_biz); O(bbs_acc);
75   O(rrf_zpg);
76   O(bra_rel);
77
78#undef O
79};
80
81enum {
82   M740_IRQ_LINE = m6502_device::IRQ_LINE,
83   M740_NMI_LINE = m6502_device::NMI_LINE,
84   M740_SET_OVERFLOW = m6502_device::V_LINE,
85};
86
87extern const device_type M740;
88
89#endif
trunk/src/emu/cpu/cpu.mak
r19846r19847
10531053           $(CPUOBJ)/m6502/m7501.o \
10541054           $(CPUOBJ)/m6502/m8502.o \
10551055           $(CPUOBJ)/m6502/n2a03.o \
1056           $(CPUOBJ)/m6502/r65c02.o
1056           $(CPUOBJ)/m6502/r65c02.o \
1057         $(CPUOBJ)/m6502/m740.o
10571058DASMOBJS +=
10581059endif
10591060
r19846r19847
11291130                     $(CPUSRC)/m6502/m65c02.h \
11301131                     $(CPUSRC)/m6502/m6502.h
11311132
1133$(CPUOBJ)/m6502/m740.o:      $(CPUSRC)/m6502/m740.c \
1134                     $(CPUOBJ)/m6502/m740.inc \
1135                     $(CPUSRC)/m6502/m740.h \
1136                     $(CPUSRC)/m6502/m6502.h
1137
11321138# rule to generate the C files
11331139$(CPUOBJ)/m6502/deco16.inc: $(CPUSRC)/m6502/m6502make.py $(CPUSRC)/m6502/odeco16.lst $(CPUSRC)/m6502/ddeco16.lst
11341140   @echo Generating DECO16 source file...
r19846r19847
11661172   @echo Generating R65C02 source file...
11671173   $(PYTHON) $(CPUSRC)/m6502/m6502make.py r65c02_device - $(CPUSRC)/m6502/dr65c02.lst $@
11681174
1175$(CPUOBJ)/m6502/m740.inc: $(CPUSRC)/m6502/m6502make.py $(CPUSRC)/m6502/om740.lst $(CPUSRC)/m6502/dm740.lst
1176   @echo Generating M740 source file...
1177   $(PYTHON) $(CPUSRC)/m6502/m6502make.py m740_device $(CPUSRC)/m6502/om740.lst $(CPUSRC)/m6502/dm740.lst $@
11691178
11701179#-------------------------------------------------
11711180# Motorola 680x

Previous 199869 Revisions Next


© 1997-2024 The MAME Team