1  /**************************************************************************\
2  *                 Texas Instruments TMS32010 DSP Emulator                  *
3  *                                                                          *
4  *                  Copyright (C) 1999-2002+ Tony La Porta                  *
5  *      You are not allowed to distribute this software commercially.       *
6  *                      Written for the MAME project.                       *
7  *                                                                          *
8  *                                                                          *
9  *      Note :  This is a word based microcontroller, with addressing       *
10  *              architecture based on the Harvard addressing scheme.        *
11  *                                                                          *
12  \**************************************************************************/
13 
14 #ifndef _TMS32010_H
15 #define _TMS32010_H
16 
17 void tms32010RunEnd();
18 
19 extern UINT16 *tms32010_ram;
20 extern UINT16 *tms32010_rom;
21 
22 void tms32010_set_write_port_handler(void (*pointer)(INT32,UINT16));
23 void tms32010_set_read_port_handler(UINT16 (*pointer)(INT32));
24 
25 void tms32010_init (void);
26 void tms32010_reset (void);
27 void tms32010_exit (void);
28 int tms32010Run(int cycles);
29 int tms32010_Ext_IRQ(void);
30 void tms32010_set_irq_line(int irqline, int state);
31 void tms32010_scan(INT32 nAction);
32 
33 UINT16 tms32010_get_pc();
34 
35 UINT32 tms32010TotalCycles();
36 void tms32010NewFrame();
37 
38 
39 /**************************************************************************
40  *  Internal Clock divisor
41  *
42  *  External Clock is divided internally by 4, to produce the states
43  *  used in carrying out an instruction (machine) cycle.
44  */
45 
46 #define TMS32010_CLOCK_DIVIDER		4
47 
48 
49 /****************************************************************************
50  * Use this in the I/O port address fields of your driver for the BIO pin
51  * i.e,
52  *  AM_RANGE(TMS32010_BIO, TMS32010_BIO) AM_READ(twincobr_bio_line_r)
53  */
54 
55 #define TMS32010_BIO			0x10		/* BIO input */
56 
57 
58 #define TMS32010_INT_PENDING	0x80000000
59 #define TMS32010_INT_NONE		0
60 
61 #define  TMS32010_ADDR_MASK  0x0fff		/* TMS32010 can only address 0x0fff */
62 										/* however other TMS3201x devices   */
63 										/* can address up to 0xffff (incase */
64 										/* their support is ever added).    */
65 
66 
67 enum {
68 	TMS32010_PC=1, TMS32010_SP,   TMS32010_STR,  TMS32010_ACC,
69 	TMS32010_PREG, TMS32010_TREG, TMS32010_AR0,  TMS32010_AR1,
70 	TMS32010_STK0, TMS32010_STK1, TMS32010_STK2, TMS32010_STK3
71 };
72 
73 
74 /****************************************************************************
75  *  Public Functions
76  */
77 
78 //void tms32010_get_info(UINT32 state, union cpuinfo *info);
79 
80 
81 
82 /****************************************************************************
83  *  Read the state of the BIO pin
84  */
85 #if 0
86 #define TMS32010_BIO_In (io_read_word_16be(TMS32010_BIO<<1))
87 
88 
89 /****************************************************************************
90  *  Input a word from given I/O port
91  */
92 
93 #define TMS32010_In(Port) (io_read_word_16be((Port)<<1))
94 
95 
96 /****************************************************************************
97  *  Output a word to given I/O port
98  */
99 
100 #define TMS32010_Out(Port,Value) (io_write_word_16be((Port)<<1,Value))
101 
102 
103 
104 /****************************************************************************
105  *  Read a word from given ROM memory location
106  */
107 
108 #define TMS32010_ROM_RDMEM(A) (program_read_word_16be((A)<<1))
109 
110 
111 /****************************************************************************
112  *  Write a word to given ROM memory location
113  */
114 
115 #define TMS32010_ROM_WRMEM(A,V) (program_write_word_16be((A)<<1,V))
116 
117 
118 
119 /****************************************************************************
120  *  Read a word from given RAM memory location
121  */
122 
123 #define TMS32010_RAM_RDMEM(A) (data_read_word_16be((A)<<1))
124 
125 
126 /****************************************************************************
127  *  Write a word to given RAM memory location
128  */
129 
130 #define TMS32010_RAM_WRMEM(A,V) (data_write_word_16be((A)<<1,V))
131 
132 
133 
134 /****************************************************************************
135  *  TMS32010_RDOP() is identical to TMS32010_RDMEM() except it is used for reading
136  *  opcodes. In case of system with memory mapped I/O, this function can be
137  *  used to greatly speed up emulation
138  */
139 
140 #define TMS32010_RDOP(A) (cpu_readop16((A)<<1))
141 
142 
143 /****************************************************************************
144  *  TMS32010_RDOP_ARG() is identical to TMS32010_RDOP() except it is used
145  *  for reading opcode arguments. This difference can be used to support systems
146  *  that use different encoding mechanisms for opcodes and opcode arguments
147  */
148 
149 #define TMS32010_RDOP_ARG(A) (cpu_readop_arg16((A)<<1))
150 #endif
151 
152 
153 #ifdef	MAME_DEBUG
154 //extern unsigned Dasm32010(char *buffer, unsigned pc, const UINT8 *oprom, const UINT8 *opram);
155 #endif
156 
157 #endif	/* _TMS32010_H */
158