~ubuntu-branches/debian/sid/mame/sid

« back to all changes in this revision

Viewing changes to src/emu/cpu/m68000/m68kcpu.h

  • Committer: Package Import Robot
  • Author(s): Jordi Mallach, Emmanuel Kasper, Jordi Mallach
  • Date: 2012-06-05 20:02:23 UTC
  • mfrom: (0.3.1) (0.1.4)
  • Revision ID: package-import@ubuntu.com-20120605200223-gnlpogjrg6oqe9md
Tags: 0.146-1
[ Emmanuel Kasper ]
* New upstream release
* Drop patch to fix man pages section and patches to link with flac 
  and jpeg system lib: all this has been pushed upstream by Cesare Falco
* Add DM-Upload-Allowed: yes field.

[ Jordi Mallach ]
* Create a "gnu" TARGETOS stanza that defines NO_AFFINITY_NP.
* Stop setting TARGETOS to "unix" in d/rules. It should be autodetected,
  and set to the appropriate value.
* mame_manpage_section.patch: Change mame's manpage section to 6 (games),
  in the TH declaration.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 
28
28
typedef class _m68ki_cpu_core m68ki_cpu_core;
29
29
 
30
 
 
31
30
#include "m68000.h"
32
31
#include "../../../lib/softfloat/milieu.h"
33
32
#include "../../../lib/softfloat/softfloat.h"
552
551
public:
553
552
        void init8(address_space &space);
554
553
        void init16(address_space &space);
 
554
        void init16_m68307(address_space &space);
555
555
        void init32(address_space &space);
556
556
        void init32mmu(address_space &space);
557
557
        void init32hmmu(address_space &space);
570
570
        UINT16 read_immediate_16(offs_t address);
571
571
        UINT16 simple_read_immediate_16(offs_t address);
572
572
 
 
573
        UINT16 simple_read_immediate_16_m68307(offs_t address);
 
574
        UINT8 read_byte_m68307(offs_t address);
 
575
        UINT16 read_word_m68307(offs_t address);
 
576
        UINT32 read_dword_m68307(offs_t address);
 
577
        void write_byte_m68307(offs_t address, UINT8 data);
 
578
        void write_word_m68307(offs_t address, UINT16 data);
 
579
        void write_dword_m68307(offs_t address, UINT32 data);
 
580
 
573
581
        UINT8 read_byte_32_mmu(offs_t address);
574
582
        void write_byte_32_mmu(offs_t address, UINT8 data);
575
583
        UINT16 read_immediate_16_mmu(offs_t address);
669
677
        const UINT8* cyc_exception;
670
678
 
671
679
        /* Callbacks to host */
672
 
        device_irq_callback int_ack_callback;                     /* Interrupt Acknowledge */
 
680
        device_irq_acknowledge_callback int_ack_callback;                         /* Interrupt Acknowledge */
673
681
        m68k_bkpt_ack_func bkpt_ack_callback;         /* Breakpoint Acknowledge */
674
682
        m68k_reset_func reset_instr_callback;         /* Called when a RESET instruction is encountered */
675
683
        m68k_cmpild_func cmpild_instr_callback;       /* Called when a CMPI.L #v, Dn instruction is encountered */
707
715
        UINT16 mmu_tmp_rw;      /* temporary hack: read/write (1/0) for the mmu */
708
716
        UINT32 mmu_tmp_buserror_address;   /* temporary hack: (first) bus error address */
709
717
        UINT16 mmu_tmp_buserror_occurred;  /* temporary hack: flag that bus error has occurred from mmu */
 
718
        UINT16 mmu_tmp_buserror_fc;   /* temporary hack: (first) bus error fc */
 
719
        UINT16 mmu_tmp_buserror_rw;   /* temporary hack: (first) bus error rw */
710
720
 
711
721
        UINT32 ic_address[M68K_IC_SIZE];   /* instruction cache address data */
712
722
        UINT16 ic_data[M68K_IC_SIZE];      /* instruction cache content data */
713
723
 
 
724
        /* 68307 peripheral modules */
 
725
        m68307_sim*    m68307SIM;
 
726
        m68307_mbus*   m68307MBUS;
 
727
        m68307_serial* m68307SERIAL;
 
728
        m68307_timer*  m68307TIMER;
 
729
 
 
730
        UINT16 m68307_base;
 
731
        UINT16 m68307_scrhigh;
 
732
        UINT16 m68307_scrlow;
 
733
 
 
734
        int m68307_currentcs;
 
735
 
 
736
        /* 68340 peripheral modules */
 
737
        m68340_sim*        m68340SIM;
 
738
        m68340_dma*        m68340DMA;
 
739
        m68340_serial* m68340SERIAL;
 
740
        m68340_timer*  m68340TIMER;
 
741
 
 
742
        UINT32 m68340_base;
 
743
 
 
744
 
 
745
        /* 68308 / 68340 internal address map */
 
746
        address_space *internal;
 
747
 
 
748
        /* callbacks for internal ports */
 
749
        m68307_porta_read_callback m_m68307_porta_r;
 
750
        m68307_porta_write_callback m_m68307_porta_w;
 
751
        m68307_portb_read_callback m_m68307_portb_r;
 
752
        m68307_portb_write_callback m_m68307_portb_w;
 
753
 
 
754
 
 
755
 
714
756
        /* external instruction hook (does not depend on debug mode) */
715
757
        typedef int (*instruction_hook_t)(device_t *device, offs_t curpc);
716
758
        instruction_hook_t instruction_hook;
721
763
};
722
764
 
723
765
 
 
766
INLINE m68ki_cpu_core *m68k_get_safe_token(device_t *device)
 
767
{
 
768
        assert(device != NULL);
 
769
        assert(device->type() == M68000 ||
 
770
                   device->type() == M68301 ||
 
771
                   device->type() == M68307 ||
 
772
                   device->type() == M68008 ||
 
773
                   device->type() == M68008PLCC ||
 
774
                   device->type() == M68010 ||
 
775
                   device->type() == M68EC020 ||
 
776
                   device->type() == M68020 ||
 
777
                   device->type() == M68020HMMU ||
 
778
                   device->type() == M68020PMMU ||
 
779
                   device->type() == M68EC030 ||
 
780
                   device->type() == M68030 ||
 
781
                   device->type() == M68EC040 ||
 
782
                   device->type() == M68040 ||
 
783
                   device->type() == SCC68070 ||
 
784
                   device->type() == MCF5206E ||
 
785
                   device->type() == M68340);
 
786
        return (m68ki_cpu_core *)downcast<legacy_cpu_device *>(device)->token();
 
787
}
 
788
 
724
789
extern const UINT8    m68ki_shift_8_table[];
725
790
extern const UINT16   m68ki_shift_16_table[];
726
791
extern const UINT32   m68ki_shift_32_table[];
828
893
INLINE void m68ki_stack_frame_1000(m68ki_cpu_core *m68k, UINT32 pc, UINT32 sr, UINT32 vector);
829
894
INLINE void m68ki_stack_frame_1010(m68ki_cpu_core *m68k, UINT32 sr, UINT32 vector, UINT32 pc, UINT32 fault_address);
830
895
INLINE void m68ki_stack_frame_1011(m68ki_cpu_core *m68k, UINT32 sr, UINT32 vector, UINT32 pc, UINT32 fault_address);
 
896
INLINE void m68ki_stack_frame_0111(m68ki_cpu_core *m68k, UINT32 sr, UINT32 vector, UINT32 pc, UINT32 fault_address, bool in_mmu);
831
897
 
832
898
INLINE void m68ki_exception_trap(m68ki_cpu_core *m68k, UINT32 vector);
833
899
INLINE void m68ki_exception_trapN(m68ki_cpu_core *m68k, UINT32 vector);
1514
1580
/* Format 8 stack frame (68010).
1515
1581
 * 68010 only.  This is the 29 word bus/address error frame.
1516
1582
 */
1517
 
void m68ki_stack_frame_1000(m68ki_cpu_core *m68k, UINT32 pc, UINT32 sr, UINT32 vector)
 
1583
INLINE void m68ki_stack_frame_1000(m68ki_cpu_core *m68k, UINT32 pc, UINT32 sr, UINT32 vector)
1518
1584
{
1519
1585
        /* VERSION
1520
1586
     * NUMBER
1568
1634
 * if the error happens at an instruction boundary.
1569
1635
 * PC stacked is address of next instruction.
1570
1636
 */
1571
 
void m68ki_stack_frame_1010(m68ki_cpu_core *m68k, UINT32 sr, UINT32 vector, UINT32 pc, UINT32 fault_address)
 
1637
INLINE void m68ki_stack_frame_1010(m68ki_cpu_core *m68k, UINT32 sr, UINT32 vector, UINT32 pc, UINT32 fault_address)
1572
1638
{
1573
 
        int orig_rw = m68k->mmu_tmp_rw; // this gets splatted by the following pushes, so save it now
 
1639
        int orig_rw = m68k->mmu_tmp_buserror_rw;        // this gets splatted by the following pushes, so save it now
 
1640
        int orig_fc = m68k->mmu_tmp_buserror_fc;
1574
1641
 
1575
1642
        /* INTERNAL REGISTER */
1576
1643
        m68ki_push_16(m68k, 0);
1599
1666
        /* SPECIAL STATUS REGISTER */
1600
1667
        // set bit for: Rerun Faulted bus Cycle, or run pending prefetch
1601
1668
        // set FC
1602
 
        m68ki_push_16(m68k, 0x0100 | m68k->mmu_tmp_fc | orig_rw<<6);
 
1669
        m68ki_push_16(m68k, 0x0100 | orig_fc | orig_rw<<6);
1603
1670
 
1604
1671
        /* INTERNAL REGISTER */
1605
1672
        m68ki_push_16(m68k, 0);
1619
1686
 * if the error happens during instruction execution.
1620
1687
 * PC stacked is address of instruction in progress.
1621
1688
 */
1622
 
void m68ki_stack_frame_1011(m68ki_cpu_core *m68k, UINT32 sr, UINT32 vector, UINT32 pc, UINT32 fault_address)
 
1689
INLINE void m68ki_stack_frame_1011(m68ki_cpu_core *m68k, UINT32 sr, UINT32 vector, UINT32 pc, UINT32 fault_address)
1623
1690
{
1624
 
        int orig_rw = m68k->mmu_tmp_rw; // this gets splatted by the following pushes, so save it now
 
1691
        int orig_rw = m68k->mmu_tmp_buserror_rw;        // this gets splatted by the following pushes, so save it now
 
1692
        int orig_fc = m68k->mmu_tmp_buserror_fc;
1625
1693
 
1626
1694
        /* INTERNAL REGISTERS (18 words) */
1627
1695
        m68ki_push_32(m68k, 0);
1673
1741
        m68ki_push_16(m68k, 0);
1674
1742
 
1675
1743
        /* SPECIAL STATUS REGISTER */
1676
 
        m68ki_push_16(m68k, 0x0100 | m68k->mmu_tmp_fc | orig_rw<<6);
 
1744
        m68ki_push_16(m68k, 0x0100 | orig_fc | orig_rw<<6);
1677
1745
 
1678
1746
        /* INTERNAL REGISTER */
1679
1747
        m68ki_push_16(m68k, 0);
1688
1756
        m68ki_push_16(m68k, sr);
1689
1757
}
1690
1758
 
 
1759
/* Type 7 stack frame (access fault).
 
1760
 * This is used by the 68040 for bus fault and mmu trap
 
1761
 * 30 words
 
1762
 */
 
1763
INLINE void m68ki_stack_frame_0111(m68ki_cpu_core *m68k, UINT32 sr, UINT32 vector, UINT32 pc, UINT32 fault_address, bool in_mmu)
 
1764
{
 
1765
        int orig_rw = m68k->mmu_tmp_buserror_rw;        // this gets splatted by the following pushes, so save it now
 
1766
        int orig_fc = m68k->mmu_tmp_buserror_fc;
 
1767
 
 
1768
        /* INTERNAL REGISTERS (18 words) */
 
1769
        m68ki_push_32(m68k, 0);
 
1770
        m68ki_push_32(m68k, 0);
 
1771
        m68ki_push_32(m68k, 0);
 
1772
        m68ki_push_32(m68k, 0);
 
1773
        m68ki_push_32(m68k, 0);
 
1774
        m68ki_push_32(m68k, 0);
 
1775
        m68ki_push_32(m68k, 0);
 
1776
        m68ki_push_32(m68k, 0);
 
1777
        m68ki_push_32(m68k, 0);
 
1778
 
 
1779
        /* FAULT ADDRESS (2 words) */
 
1780
        m68ki_push_32(m68k, fault_address);
 
1781
 
 
1782
        /* INTERNAL REGISTERS (3 words) */
 
1783
        m68ki_push_32(m68k, 0);
 
1784
        m68ki_push_16(m68k, 0);
 
1785
 
 
1786
        /* SPECIAL STATUS REGISTER (1 word) */
 
1787
        m68ki_push_16(m68k, (in_mmu ? 0x400 : 0) | orig_fc | (orig_rw<<8));
 
1788
 
 
1789
        /* EFFECTIVE ADDRESS (2 words) */
 
1790
        m68ki_push_32(m68k, fault_address);
 
1791
 
 
1792
        /* 0111, VECTOR OFFSET (1 word) */
 
1793
        m68ki_push_16(m68k, 0x7000 | (vector<<2));
 
1794
 
 
1795
        /* PROGRAM COUNTER (2 words) */
 
1796
        m68ki_push_32(m68k, pc);
 
1797
 
 
1798
        /* STATUS REGISTER (1 word) */
 
1799
        m68ki_push_16(m68k, sr);
 
1800
}
 
1801
 
1691
1802
 
1692
1803
/* Used for Group 2 exceptions.
1693
1804
 * These stack a type 2 frame on the 020.
1844
1955
 
1845
1956
 
1846
1957
/* Service an interrupt request and start exception processing */
1847
 
void m68ki_exception_interrupt(m68ki_cpu_core *m68k, UINT32 int_level)
 
1958
INLINE void m68ki_exception_interrupt(m68ki_cpu_core *m68k, UINT32 int_level)
1848
1959
{
1849
1960
        UINT32 vector;
1850
1961
        UINT32 sr;