summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/cpu/adsp2100/adsp2100.c
blob: 33efb32ae6c617ca54ca41dd510bdb4eae115f5e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
/***************************************************************************

        ADSP2100.c
        Core implementation for the portable Analog ADSP-2100 emulator.
        Written by Aaron Giles

****************************************************************************

    For ADSP-2101, ADSP-2111
    ------------------------

        MMAP = 0                                        MMAP = 1

        Automatic boot loading                          No auto boot loading

        Program Space:                                  Program Space:
            0000-07ff = 2k Internal RAM (booted)            0000-37ff = 14k External access
            0800-3fff = 14k External access                 3800-3fff = 2k Internal RAM

        Data Space:                                     Data Space:
            0000-03ff = 1k External DWAIT0                  0000-03ff = 1k External DWAIT0
            0400-07ff = 1k External DWAIT1                  0400-07ff = 1k External DWAIT1
            0800-2fff = 10k External DWAIT2                 0800-2fff = 10k External DWAIT2
            3000-33ff = 1k External DWAIT3                  3000-33ff = 1k External DWAIT3
            3400-37ff = 1k External DWAIT4                  3400-37ff = 1k External DWAIT4
            3800-3bff = 1k Internal RAM                     3800-3bff = 1k Internal RAM
            3c00-3fff = 1k Internal Control regs            3c00-3fff = 1k Internal Control regs


    For ADSP-2105, ADSP-2115
    ------------------------

        MMAP = 0                                        MMAP = 1

        Automatic boot loading                          No auto boot loading

        Program Space:                                  Program Space:
            0000-03ff = 1k Internal RAM (booted)            0000-37ff = 14k External access
            0400-07ff = 1k Reserved                         3800-3bff = 1k Internal RAM
            0800-3fff = 14k External access                 3c00-3fff = 1k Reserved

        Data Space:                                     Data Space:
            0000-03ff = 1k External DWAIT0                  0000-03ff = 1k External DWAIT0
            0400-07ff = 1k External DWAIT1                  0400-07ff = 1k External DWAIT1
            0800-2fff = 10k External DWAIT2                 0800-2fff = 10k External DWAIT2
            3000-33ff = 1k External DWAIT3                  3000-33ff = 1k External DWAIT3
            3400-37ff = 1k External DWAIT4                  3400-37ff = 1k External DWAIT4
            3800-39ff = 512 Internal RAM                    3800-39ff = 512 Internal RAM
            3a00-3bff = 512 Reserved                        3a00-3bff = 512 Reserved
            3c00-3fff = 1k Internal Control regs            3c00-3fff = 1k Internal Control regs


    For ADSP-2104
    -------------

        MMAP = 0                                        MMAP = 1

        Automatic boot loading                          No auto boot loading

        Program Space:                                  Program Space:
            0000-01ff = 512 Internal RAM (booted)           0000-37ff = 14k External access
            0400-07ff = 1k Reserved                         3800-3bff = 1k Internal RAM
            0800-3fff = 14k External access                 3c00-3fff = 1k Reserved

        Data Space:                                     Data Space:
            0000-03ff = 1k External DWAIT0                  0000-03ff = 1k External DWAIT0
            0400-07ff = 1k External DWAIT1                  0400-07ff = 1k External DWAIT1
            0800-2fff = 10k External DWAIT2                 0800-2fff = 10k External DWAIT2
            3000-33ff = 1k External DWAIT3                  3000-33ff = 1k External DWAIT3
            3400-37ff = 1k External DWAIT4                  3400-37ff = 1k External DWAIT4
            3800-38ff = 256 Internal RAM                    3800-38ff = 256 Internal RAM
            3a00-3bff = 512 Reserved                        3a00-3bff = 512 Reserved
            3c00-3fff = 1k Internal Control regs            3c00-3fff = 1k Internal Control regs


    For ADSP-2181
    -------------

        MMAP = 0                                        MMAP = 1

        Program Space:                                  Program Space:
            0000-1fff = 8k Internal RAM                     0000-1fff = 8k External access
            2000-3fff = 8k Internal RAM or Overlay          2000-3fff = 8k Internal

        Data Space:                                     Data Space:
            0000-1fff = 8k Internal RAM or Overlay          0000-1fff = 8k Internal RAM or Overlay
            2000-3fdf = 8k-32 Internal RAM                  2000-3fdf = 8k-32 Internal RAM
            3fe0-3fff = 32 Internal Control regs            3fe0-3fff = 32 Internal Control regs

        I/O Space:                                      I/O Space:
            0000-01ff = 512 External IOWAIT0                0000-01ff = 512 External IOWAIT0
            0200-03ff = 512 External IOWAIT1                0200-03ff = 512 External IOWAIT1
            0400-05ff = 512 External IOWAIT2                0400-05ff = 512 External IOWAIT2
            0600-07ff = 512 External IOWAIT3                0600-07ff = 512 External IOWAIT3

***************************************************************************/

#include "debugger.h"
#include "deprecat.h"
#include "adsp2100.h"
#include <stddef.h>


/***************************************************************************
    CONSTANTS
***************************************************************************/

#define TRACK_HOTSPOTS		0

/* stack depths */
#define	PC_STACK_DEPTH		16
#define CNTR_STACK_DEPTH	4
#define STAT_STACK_DEPTH	4
#define LOOP_STACK_DEPTH	4

/* chip types */
#define CHIP_TYPE_ADSP2100	0
#define CHIP_TYPE_ADSP2101	1
#define CHIP_TYPE_ADSP2104	2
#define CHIP_TYPE_ADSP2105	3
#define CHIP_TYPE_ADSP2115	4
#define CHIP_TYPE_ADSP2181	5



/***************************************************************************
    STRUCTURES & TYPEDEFS
***************************************************************************/

/* 16-bit registers that can be loaded signed or unsigned */
typedef union
{
	UINT16	u;
	INT16	s;
} ADSPREG16;


/* the SHIFT result register is 32 bits */
typedef union
{
#ifdef LSB_FIRST
	struct { ADSPREG16 sr0, sr1; } srx;
#else
	struct { ADSPREG16 sr1, sr0; } srx;
#endif
	UINT32 sr;
} SHIFTRESULT;


/* the MAC result register is 40 bits */
typedef union
{
#ifdef LSB_FIRST
	struct { ADSPREG16 mr0, mr1, mr2, mrzero; } mrx;
	struct { UINT32 mr0, mr1; } mry;
#else
	struct { ADSPREG16 mrzero, mr2, mr1, mr0; } mrx;
	struct { UINT32 mr1, mr0; } mry;
#endif
	UINT64 mr;
} MACRESULT;

/* there are two banks of "core" registers */
typedef struct ADSPCORE
{
	/* ALU registers */
	ADSPREG16	ax0, ax1;
	ADSPREG16	ay0, ay1;
	ADSPREG16	ar;
	ADSPREG16	af;

	/* MAC registers */
	ADSPREG16	mx0, mx1;
	ADSPREG16	my0, my1;
	MACRESULT	mr;
	ADSPREG16	mf;

	/* SHIFT registers */
	ADSPREG16	si;
	ADSPREG16	se;
	ADSPREG16	sb;
	SHIFTRESULT	sr;

	/* dummy registers */
	ADSPREG16	zero;
} ADSPCORE;


/* ADSP-2100 Registers */
typedef struct
{
	/* Core registers, 2 banks */
	ADSPCORE	core;
	ADSPCORE	alt;

	/* Memory addressing registers */
	UINT32		i[8];
	INT32		m[8];
	UINT32		l[8];
	UINT32		lmask[8];
	UINT32		base[8];
	UINT8		px;

	/* other CPU registers */
	UINT32		pc;
	UINT32		ppc;
	UINT32		loop;
	UINT32		loop_condition;
	UINT32		cntr;

	/* status registers */
	UINT32		astat;
	UINT32		sstat;
	UINT32		mstat;
	UINT32		astat_clear;
	UINT32		idle;

	/* stacks */
	UINT32		loop_stack[LOOP_STACK_DEPTH];
	UINT32		cntr_stack[CNTR_STACK_DEPTH];
	UINT32		pc_stack[PC_STACK_DEPTH];
	UINT16		stat_stack[STAT_STACK_DEPTH][3];
	INT32		pc_sp;
	INT32		cntr_sp;
	INT32		stat_sp;
	INT32		loop_sp;

	/* external I/O */
	UINT8		flagout;
	UINT8		flagin;
	UINT8		fl0;
	UINT8		fl1;
	UINT8		fl2;
	UINT16		idma_addr;
	UINT16		idma_cache;
	UINT8		idma_offs;

	/* interrupt handling */
	UINT16		imask;
	UINT8		icntl;
	UINT16		ifc;
    UINT8    	irq_state[9];
    UINT8    	irq_latch[9];
    cpu_irq_callback irq_callback;
    const device_config *device;

	/* other internal states */
    int			icount;
	int			chip_type;
	int			mstat_mask;
	int			imask_mask;

	/* register maps */
	void *		alu_xregs[8];
	void *		alu_yregs[4];
	void *		mac_xregs[8];
	void *		mac_yregs[4];
	void *		shift_xregs[8];

    /* other callbacks */
	RX_CALLBACK sport_rx_callback;
	TX_CALLBACK sport_tx_callback;
	ADSP2100_TIMER_CALLBACK timer_fired_func;
} adsp2100_state;



/***************************************************************************
    PRIVATE GLOBAL VARIABLES
***************************************************************************/

static void *token;

static UINT16 *reverse_table = 0;
static UINT16 *mask_table = 0;
static UINT8 *condition_table = 0;

#if TRACK_HOTSPOTS
static UINT32 pcbucket[0x4000];
#endif


/***************************************************************************
    PRIVATE FUNCTION PROTOTYPES
***************************************************************************/

static int create_tables(void);
static void check_irqs(adsp2100_state *adsp);


/***************************************************************************
    MEMORY ACCESSORS
***************************************************************************/

INLINE UINT16 RWORD_DATA(UINT32 addr)
{
	return data_read_word_16le(addr << 1);
}

INLINE void WWORD_DATA(UINT32 addr, UINT16 data)
{
	data_write_word_16le(addr << 1, data);
}

INLINE UINT16 RWORD_IO(UINT32 addr)
{
	return io_read_word_16le(addr << 1);
}

INLINE void WWORD_IO(UINT32 addr, UINT16 data)
{
	io_write_word_16le(addr << 1, data);
}

INLINE UINT32 RWORD_PGM(UINT32 addr)
{
	return program_read_dword_32le(addr << 2);
}

INLINE void WWORD_PGM(UINT32 addr, UINT32 data)
{
	program_write_dword_32le(addr << 2, data & 0xffffff);
}

#define ROPCODE(a) cpu_readop32((a)->pc << 2)

#define CHANGEPC(a) change_pc((a)->pc << 2)


/***************************************************************************
    IMPORT CORE UTILITIES
***************************************************************************/

#include "2100ops.c"



/***************************************************************************
    IRQ HANDLING
***************************************************************************/

INLINE int adsp2100_generate_irq(adsp2100_state *adsp, int which)
{
	/* skip if masked */
	if (!(adsp->imask & (1 << which)))
		return 0;

	/* clear the latch */
	adsp->irq_latch[which] = 0;

	/* push the PC and the status */
	pc_stack_push(adsp);
	stat_stack_push(adsp);

	/* vector to location & stop idling */
	adsp->pc = which;
	CHANGEPC(adsp);
	adsp->idle = 0;

	/* mask other interrupts based on the nesting bit */
	if (adsp->icntl & 0x10) adsp->imask &= ~((2 << which) - 1);
	else adsp->imask &= ~0xf;

	return 1;
}


INLINE int adsp2101_generate_irq(adsp2100_state *adsp, int which, int indx)
{
	/* skip if masked */
	if (!(adsp->imask & (0x20 >> indx)))
		return 0;

	/* clear the latch */
	adsp->irq_latch[which] = 0;

	/* push the PC and the status */
	pc_stack_push(adsp);
	stat_stack_push(adsp);

	/* vector to location & stop idling */
	adsp->pc = 0x04 + indx * 4;
	CHANGEPC(adsp);
	adsp->idle = 0;

	/* mask other interrupts based on the nesting bit */
	if (adsp->icntl & 0x10) adsp->imask &= ~(0x3f >> indx);
	else adsp->imask &= ~0x3f;

	return 1;
}


INLINE int adsp2181_generate_irq(adsp2100_state *adsp, int which, int indx)
{
	/* skip if masked */
	if (!(adsp->imask & (0x200 >> indx)))
		return 0;

	/* clear the latch */
	adsp->irq_latch[which] = 0;

	/* push the PC and the status */
	pc_stack_push(adsp);
	stat_stack_push(adsp);

	/* vector to location & stop idling */
	adsp->pc = 0x04 + indx * 4;
	CHANGEPC(adsp);
	adsp->idle = 0;

	/* mask other interrupts based on the nesting bit */
	if (adsp->icntl & 0x10) adsp->imask &= ~(0x3ff >> indx);
	else adsp->imask &= ~0x3ff;

	return 1;
}


static void check_irqs(adsp2100_state *adsp)
{
	UINT8 check;

#if (HAS_ADSP2181)
	if (adsp->chip_type >= CHIP_TYPE_ADSP2181)
	{
		/* check IRQ2 */
		check = (adsp->icntl & 4) ? adsp->irq_latch[ADSP2181_IRQ2] : adsp->irq_state[ADSP2181_IRQ2];
		if (check && adsp2181_generate_irq(adsp, ADSP2181_IRQ2, 0))
			return;

		/* check IRQL1 */
		check = adsp->irq_state[ADSP2181_IRQL1];
		if (check && adsp2181_generate_irq(adsp, ADSP2181_IRQL1, 1))
			return;

		/* check IRQL2 */
		check = adsp->irq_state[ADSP2181_IRQL2];
		if (check && adsp2181_generate_irq(adsp, ADSP2181_IRQL2, 2))
			return;

		/* check SPORT0 transmit */
		check = adsp->irq_latch[ADSP2181_SPORT0_TX];
		if (check && adsp2181_generate_irq(adsp, ADSP2181_SPORT0_TX, 3))
			return;

		/* check SPORT0 receive */
		check = adsp->irq_latch[ADSP2181_SPORT0_RX];
		if (check && adsp2181_generate_irq(adsp, ADSP2181_SPORT0_RX, 4))
			return;

		/* check IRQE */
		check = adsp->irq_latch[ADSP2181_IRQE];
		if (check && adsp2181_generate_irq(adsp, ADSP2181_IRQE, 5))
			return;

		/* check BDMA interrupt */

		/* check IRQ1/SPORT1 transmit */
		check = (adsp->icntl & 2) ? adsp->irq_latch[ADSP2181_IRQ1] : adsp->irq_state[ADSP2181_IRQ1];
		if (check && adsp2181_generate_irq(adsp, ADSP2181_IRQ1, 7))
			return;

		/* check IRQ0/SPORT1 receive */
		check = (adsp->icntl & 1) ? adsp->irq_latch[ADSP2181_IRQ0] : adsp->irq_state[ADSP2181_IRQ0];
		if (check && adsp2181_generate_irq(adsp, ADSP2181_IRQ0, 8))
			return;

		/* check timer */
		check = adsp->irq_latch[ADSP2181_TIMER];
		if (check && adsp2181_generate_irq(adsp, ADSP2181_TIMER, 9))
			return;
	}
	else
#endif
	if (adsp->chip_type >= CHIP_TYPE_ADSP2101)
	{
		/* check IRQ2 */
		check = (adsp->icntl & 4) ? adsp->irq_latch[ADSP2101_IRQ2] : adsp->irq_state[ADSP2101_IRQ2];
		if (check && adsp2101_generate_irq(adsp, ADSP2101_IRQ2, 0))
			return;

		/* check SPORT0 transmit */
		check = adsp->irq_latch[ADSP2101_SPORT0_TX];
		if (check && adsp2101_generate_irq(adsp, ADSP2101_SPORT0_TX, 1))
			return;

		/* check SPORT0 receive */
		check = adsp->irq_latch[ADSP2101_SPORT0_RX];
		if (check && adsp2101_generate_irq(adsp, ADSP2101_SPORT0_RX, 2))
			return;

		/* check IRQ1/SPORT1 transmit */
		check = (adsp->icntl & 2) ? adsp->irq_latch[ADSP2101_IRQ1] : adsp->irq_state[ADSP2101_IRQ1];
		if (check && adsp2101_generate_irq(adsp, ADSP2101_IRQ1, 3))
			return;

		/* check IRQ0/SPORT1 receive */
		check = (adsp->icntl & 1) ? adsp->irq_latch[ADSP2101_IRQ0] : adsp->irq_state[ADSP2101_IRQ0];
		if (check && adsp2101_generate_irq(adsp, ADSP2101_IRQ0, 4))
			return;

		/* check timer */
		check = adsp->irq_latch[ADSP2101_TIMER];
		if (check && adsp2101_generate_irq(adsp, ADSP2101_TIMER, 5))
			return;
	}
	else
	{
		/* check IRQ3 */
		check = (adsp->icntl & 8) ? adsp->irq_latch[ADSP2100_IRQ3] : adsp->irq_state[ADSP2100_IRQ3];
		if (check && adsp2100_generate_irq(adsp, ADSP2100_IRQ3))
			return;

		/* check IRQ2 */
		check = (adsp->icntl & 4) ? adsp->irq_latch[ADSP2100_IRQ2] : adsp->irq_state[ADSP2100_IRQ2];
		if (check && adsp2100_generate_irq(adsp, ADSP2100_IRQ2))
			return;

		/* check IRQ1 */
		check = (adsp->icntl & 2) ? adsp->irq_latch[ADSP2100_IRQ1] : adsp->irq_state[ADSP2100_IRQ1];
		if (check && adsp2100_generate_irq(adsp, ADSP2100_IRQ1))
			return;

		/* check IRQ0 */
		check = (adsp->icntl & 1) ? adsp->irq_latch[ADSP2100_IRQ0] : adsp->irq_state[ADSP2100_IRQ0];
		if (check && adsp2100_generate_irq(adsp, ADSP2100_IRQ0))
			return;
	}
}


static void set_irq_line(adsp2100_state *adsp, int irqline, int state)
{
	/* update the latched state */
	if (state != CLEAR_LINE && adsp->irq_state[irqline] == CLEAR_LINE)
    	adsp->irq_latch[irqline] = 1;

    /* update the absolute state */
    adsp->irq_state[irqline] = state;

	/* check for IRQs */
    if (state != CLEAR_LINE)
    	check_irqs(adsp);
}



/***************************************************************************
    CONTEXT SWITCHING
***************************************************************************/

static CPU_GET_CONTEXT( adsp21xx )
{
}


static CPU_SET_CONTEXT( adsp21xx )
{
	/* copy the context */
	if (src)
	{
		adsp2100_state *adsp;
		token = src;
		adsp = token;
		CHANGEPC(adsp);
		check_irqs(adsp);
	}
}



/***************************************************************************
    INITIALIZATION AND SHUTDOWN
***************************************************************************/

static adsp2100_state *adsp21xx_init(const device_config *device, int index, int clock, const void *config, cpu_irq_callback irqcallback)
{
	adsp2100_state *adsp = device->token;

	token = device->token;	// temporary

	/* create the tables */
	if (!create_tables())
		fatalerror("creating adsp2100 tables failed");

	/* set the IRQ callback */
	adsp->irq_callback = irqcallback;
	adsp->device = device;

	/* set up ALU register pointers */
	adsp->alu_xregs[0] = &adsp->core.ax0;
	adsp->alu_xregs[1] = &adsp->core.ax1;
	adsp->alu_xregs[2] = &adsp->core.ar;
	adsp->alu_xregs[3] = &adsp->core.mr.mrx.mr0;
	adsp->alu_xregs[4] = &adsp->core.mr.mrx.mr1;
	adsp->alu_xregs[5] = &adsp->core.mr.mrx.mr2;
	adsp->alu_xregs[6] = &adsp->core.sr.srx.sr0;
	adsp->alu_xregs[7] = &adsp->core.sr.srx.sr1;
	adsp->alu_yregs[0] = &adsp->core.ay0;
	adsp->alu_yregs[1] = &adsp->core.ay1;
	adsp->alu_yregs[2] = &adsp->core.af;
	adsp->alu_yregs[3] = &adsp->core.zero;

	/* set up MAC register pointers */
	adsp->mac_xregs[0] = &adsp->core.mx0;
	adsp->mac_xregs[1] = &adsp->core.mx1;
	adsp->mac_xregs[2] = &adsp->core.ar;
	adsp->mac_xregs[3] = &adsp->core.mr.mrx.mr0;
	adsp->mac_xregs[4] = &adsp->core.mr.mrx.mr1;
	adsp->mac_xregs[5] = &adsp->core.mr.mrx.mr2;
	adsp->mac_xregs[6] = &adsp->core.sr.srx.sr0;
	adsp->mac_xregs[7] = &adsp->core.sr.srx.sr1;
	adsp->mac_yregs[0] = &adsp->core.my0;
	adsp->mac_yregs[1] = &adsp->core.my1;
	adsp->mac_yregs[2] = &adsp->core.mf;
	adsp->mac_yregs[3] = &adsp->core.zero;

	/* set up shift register pointers */
	adsp->shift_xregs[0] = &adsp->core.si;
	adsp->shift_xregs[1] = &adsp->core.si;
	adsp->shift_xregs[2] = &adsp->core.ar;
	adsp->shift_xregs[3] = &adsp->core.mr.mrx.mr0;
	adsp->shift_xregs[4] = &adsp->core.mr.mrx.mr1;
	adsp->shift_xregs[5] = &adsp->core.mr.mrx.mr2;
	adsp->shift_xregs[6] = &adsp->core.sr.srx.sr0;
	adsp->shift_xregs[7] = &adsp->core.sr.srx.sr1;

	/* "core" */
	state_save_register_item("adsp2100", index, adsp->core.ax0.u);
	state_save_register_item("adsp2100", index, adsp->core.ax1.u);
	state_save_register_item("adsp2100", index, adsp->core.ay0.u);
	state_save_register_item("adsp2100", index, adsp->core.ay1.u);
	state_save_register_item("adsp2100", index, adsp->core.ar.u);
	state_save_register_item("adsp2100", index, adsp->core.af.u);
	state_save_register_item("adsp2100", index, adsp->core.mx0.u);
	state_save_register_item("adsp2100", index, adsp->core.mx1.u);
	state_save_register_item("adsp2100", index, adsp->core.my0.u);
	state_save_register_item("adsp2100", index, adsp->core.my1.u);
	state_save_register_item("adsp2100", index, adsp->core.mr.mr);
	state_save_register_item("adsp2100", index, adsp->core.mf.u);
	state_save_register_item("adsp2100", index, adsp->core.si.u);
	state_save_register_item("adsp2100", index, adsp->core.se.u);
	state_save_register_item("adsp2100", index, adsp->core.sb.u);
	state_save_register_item("adsp2100", index, adsp->core.sr.sr);
	state_save_register_item("adsp2100", index, adsp->core.zero.u);

	/* "alt" */
	state_save_register_item("adsp2100", index, adsp->alt.ax0.u);
	state_save_register_item("adsp2100", index, adsp->alt.ax1.u);
	state_save_register_item("adsp2100", index, adsp->alt.ay0.u);
	state_save_register_item("adsp2100", index, adsp->alt.ay1.u);
	state_save_register_item("adsp2100", index, adsp->alt.ar.u);
	state_save_register_item("adsp2100", index, adsp->alt.af.u);
	state_save_register_item("adsp2100", index, adsp->alt.mx0.u);
	state_save_register_item("adsp2100", index, adsp->alt.mx1.u);
	state_save_register_item("adsp2100", index, adsp->alt.my0.u);
	state_save_register_item("adsp2100", index, adsp->alt.my1.u);
	state_save_register_item("adsp2100", index, adsp->alt.mr.mr);
	state_save_register_item("adsp2100", index, adsp->alt.mf.u);
	state_save_register_item("adsp2100", index, adsp->alt.si.u);
	state_save_register_item("adsp2100", index, adsp->alt.se.u);
	state_save_register_item("adsp2100", index, adsp->alt.sb.u);
	state_save_register_item("adsp2100", index, adsp->alt.sr.sr);
	state_save_register_item("adsp2100", index, adsp->alt.zero.u);

	state_save_register_item_array("adsp2100", index, adsp->i);
	state_save_register_item_array("adsp2100", index, adsp->m);
	state_save_register_item_array("adsp2100", index, adsp->l);
	state_save_register_item_array("adsp2100", index, adsp->lmask);
	state_save_register_item_array("adsp2100", index, adsp->base);
	state_save_register_item("adsp2100", index, adsp->px);

	state_save_register_item("adsp2100", index, adsp->pc);
	state_save_register_item("adsp2100", index, adsp->ppc);
	state_save_register_item("adsp2100", index, adsp->loop);
	state_save_register_item("adsp2100", index, adsp->loop_condition);
	state_save_register_item("adsp2100", index, adsp->cntr);
	state_save_register_item("adsp2100", index, adsp->astat);
	state_save_register_item("adsp2100", index, adsp->sstat);
	state_save_register_item("adsp2100", index, adsp->mstat);
	state_save_register_item("adsp2100", index, adsp->astat_clear);
	state_save_register_item("adsp2100", index, adsp->idle);

	state_save_register_item_array("adsp2100", index, adsp->loop_stack);
	state_save_register_item_array("adsp2100", index, adsp->cntr_stack);
	state_save_register_item_array("adsp2100", index, adsp->pc_stack);
	state_save_register_item_2d_array("adsp2100", index, adsp->stat_stack);

	state_save_register_item("adsp2100", index, adsp->pc_sp);
	state_save_register_item("adsp2100", index, adsp->cntr_sp);
	state_save_register_item("adsp2100", index, adsp->stat_sp);
	state_save_register_item("adsp2100", index, adsp->loop_sp);

	state_save_register_item("adsp2100", index, adsp->flagout);
	state_save_register_item("adsp2100", index, adsp->flagin);
	state_save_register_item("adsp2100", index, adsp->fl0);
	state_save_register_item("adsp2100", index, adsp->fl1);
	state_save_register_item("adsp2100", index, adsp->fl2);
	state_save_register_item("adsp2100", index, adsp->idma_addr);
	state_save_register_item("adsp2100", index, adsp->idma_cache);
	state_save_register_item("adsp2100", index, adsp->idma_offs);

	state_save_register_item("adsp2100", index, adsp->imask);
	state_save_register_item("adsp2100", index, adsp->icntl);
	state_save_register_item("adsp2100", index, adsp->ifc);
	state_save_register_item_array("adsp2100", index, adsp->irq_state);
	state_save_register_item_array("adsp2100", index, adsp->irq_latch);

	return adsp;
}


static CPU_RESET( adsp21xx )
{
	adsp2100_state *adsp = device->token;
	int irq;

	/* ensure that zero is zero */
	adsp->core.zero.u = adsp->alt.zero.u = 0;

	/* recompute the memory registers with their current values */
	wr_l0(adsp, adsp->l[0]);  wr_i0(adsp, adsp->i[0]);
	wr_l1(adsp, adsp->l[1]);  wr_i1(adsp, adsp->i[1]);
	wr_l2(adsp, adsp->l[2]);  wr_i2(adsp, adsp->i[2]);
	wr_l3(adsp, adsp->l[3]);  wr_i3(adsp, adsp->i[3]);
	wr_l4(adsp, adsp->l[4]);  wr_i4(adsp, adsp->i[4]);
	wr_l5(adsp, adsp->l[5]);  wr_i5(adsp, adsp->i[5]);
	wr_l6(adsp, adsp->l[6]);  wr_i6(adsp, adsp->i[6]);
	wr_l7(adsp, adsp->l[7]);  wr_i7(adsp, adsp->i[7]);

	/* reset PC and loops */
	switch (adsp->chip_type)
	{
		case CHIP_TYPE_ADSP2100:
			adsp->pc = 4;
			break;

		case CHIP_TYPE_ADSP2101:
		case CHIP_TYPE_ADSP2104:
		case CHIP_TYPE_ADSP2105:
		case CHIP_TYPE_ADSP2115:
		case CHIP_TYPE_ADSP2181:
			adsp->pc = 0;
			break;

		default:
			logerror( "ADSP2100 core: Unknown chip type!. Defaulting to adsp->\n" );
			adsp->pc = 4;
			adsp->chip_type = CHIP_TYPE_ADSP2100;
			break;
	}
	CHANGEPC(adsp);

	adsp->ppc = -1;
	adsp->loop = 0xffff;
	adsp->loop_condition = 0;

	/* reset status registers */
	adsp->astat_clear = ~(CFLAG | VFLAG | NFLAG | ZFLAG);
	adsp->mstat = 0;
	adsp->sstat = 0x55;
	adsp->idle = 0;

	/* reset stacks */
	adsp->pc_sp = 0;
	adsp->cntr_sp = 0;
	adsp->stat_sp = 0;
	adsp->loop_sp = 0;

	/* reset external I/O */
	adsp->flagout = 0;
	adsp->flagin = 0;
	adsp->fl0 = 0;
	adsp->fl1 = 0;
	adsp->fl2 = 0;

	/* reset interrupts */
	adsp->imask = 0;
	for (irq = 0; irq < 8; irq++)
		adsp->irq_state[irq] = adsp->irq_latch[irq] = CLEAR_LINE;
}


static int create_tables(void)
{
	int i;

	/* allocate the tables */
	if (!reverse_table)
		reverse_table = (UINT16 *)malloc(0x4000 * sizeof(UINT16));
	if (!mask_table)
		mask_table = (UINT16 *)malloc(0x4000 * sizeof(UINT16));
	if (!condition_table)
		condition_table = (UINT8 *)malloc(0x1000 * sizeof(UINT8));

	/* handle errors */
	if (reverse_table == NULL || mask_table == NULL || condition_table == NULL)
		return 0;

	/* initialize the bit reversing table */
	for (i = 0; i < 0x4000; i++)
	{
		UINT16 data = 0;

		data |= (i >> 13) & 0x0001;
		data |= (i >> 11) & 0x0002;
		data |= (i >> 9)  & 0x0004;
		data |= (i >> 7)  & 0x0008;
		data |= (i >> 5)  & 0x0010;
		data |= (i >> 3)  & 0x0020;
		data |= (i >> 1)  & 0x0040;
		data |= (i << 1)  & 0x0080;
		data |= (i << 3)  & 0x0100;
		data |= (i << 5)  & 0x0200;
		data |= (i << 7)  & 0x0400;
		data |= (i << 9)  & 0x0800;
		data |= (i << 11) & 0x1000;
		data |= (i << 13) & 0x2000;

		reverse_table[i] = data;
	}

	/* initialize the mask table */
	for (i = 0; i < 0x4000; i++)
	{
		     if (i > 0x2000) mask_table[i] = 0x0000;
		else if (i > 0x1000) mask_table[i] = 0x2000;
		else if (i > 0x0800) mask_table[i] = 0x3000;
		else if (i > 0x0400) mask_table[i] = 0x3800;
		else if (i > 0x0200) mask_table[i] = 0x3c00;
		else if (i > 0x0100) mask_table[i] = 0x3e00;
		else if (i > 0x0080) mask_table[i] = 0x3f00;
		else if (i > 0x0040) mask_table[i] = 0x3f80;
		else if (i > 0x0020) mask_table[i] = 0x3fc0;
		else if (i > 0x0010) mask_table[i] = 0x3fe0;
		else if (i > 0x0008) mask_table[i] = 0x3ff0;
		else if (i > 0x0004) mask_table[i] = 0x3ff8;
		else if (i > 0x0002) mask_table[i] = 0x3ffc;
		else if (i > 0x0001) mask_table[i] = 0x3ffe;
		else                 mask_table[i] = 0x3fff;
	}

	/* initialize the condition table */
	for (i = 0; i < 0x100; i++)
	{
		int az = ((i & ZFLAG) != 0);
		int an = ((i & NFLAG) != 0);
		int av = ((i & VFLAG) != 0);
		int ac = ((i & CFLAG) != 0);
		int mv = ((i & MVFLAG) != 0);
		int as = ((i & SFLAG) != 0);

		condition_table[i | 0x000] = az;
		condition_table[i | 0x100] = !az;
		condition_table[i | 0x200] = !((an ^ av) | az);
		condition_table[i | 0x300] = (an ^ av) | az;
		condition_table[i | 0x400] = an ^ av;
		condition_table[i | 0x500] = !(an ^ av);
		condition_table[i | 0x600] = av;
		condition_table[i | 0x700] = !av;
		condition_table[i | 0x800] = ac;
		condition_table[i | 0x900] = !ac;
		condition_table[i | 0xa00] = as;
		condition_table[i | 0xb00] = !as;
		condition_table[i | 0xc00] = mv;
		condition_table[i | 0xd00] = !mv;
		condition_table[i | 0xf00] = 1;
	}
	return 1;
}


static CPU_EXIT( adsp21xx )
{
	if (reverse_table != NULL)
		free(reverse_table);
	reverse_table = NULL;

	if (mask_table != NULL)
		free(mask_table);
	mask_table = NULL;

	if (condition_table != NULL)
		free(condition_table);
	condition_table = NULL;

#if TRACK_HOTSPOTS
	{
		FILE *log = fopen("adsp.hot", "w");
		while (1)
		{
			int maxindex = 0, i;
			for (i = 1; i < 0x4000; i++)
				if (pcbucket[i] > pcbucket[maxindex])
					maxindex = i;
			if (pcbucket[maxindex] == 0)
				break;
			fprintf(log, "PC=%04X  (%10d hits)\n", maxindex, pcbucket[maxindex]);
			pcbucket[maxindex] = 0;
		}
		fclose(log);
	}
#endif

}



/***************************************************************************
    CORE EXECUTION LOOP
***************************************************************************/

/* execute instructions on this CPU until icount expires */
static CPU_EXECUTE( adsp21xx )
{
	int check_debugger = ((Machine->debug_flags & DEBUG_FLAG_ENABLED) != 0);
	adsp2100_state *adsp = device->token;

	/* reset the core */
	set_mstat(adsp, adsp->mstat);

	/* count cycles and interrupt cycles */
	adsp->icount = cycles;

	CHANGEPC(adsp);

	do
	{
		UINT32 temp;
		UINT32 op;

		/* debugging */
		adsp->ppc = adsp->pc;	/* copy PC to previous PC */
		if (check_debugger)
			debugger_instruction_hook(Machine, adsp->pc);

#if TRACK_HOTSPOTS
		pcbucket[adsp->pc & 0x3fff]++;
#endif

		/* instruction fetch */
		op = ROPCODE(adsp);

		/* advance to the next instruction */
		if (adsp->pc != adsp->loop)
			adsp->pc++;

		/* handle looping */
		else
		{
			/* condition not met, keep looping */
			if (CONDITION(adsp, adsp->loop_condition))
				adsp->pc = pc_stack_top(adsp);

			/* condition met; pop the PC and loop stacks and fall through */
			else
			{
				loop_stack_pop(adsp);
				pc_stack_pop_val(adsp);
				adsp->pc++;
			}
		}

		/* parse the instruction */
		switch (op >> 16)
		{
			case 0x00:
				/* 00000000 00000000 00000000  NOP */
				break;
			case 0x01:
				/* 00000000 0xxxxxxx xxxxxxxx  dst = IO(x) */
				/* 00000000 1xxxxxxx xxxxxxxx  IO(x) = dst */
				/* ADSP-218x only */
				if (adsp->chip_type >= CHIP_TYPE_ADSP2181)
				{
					if ((op & 0x008000) == 0x000000)
						WRITE_REG(adsp, 0, op & 15, RWORD_IO((op >> 4) & 0x7ff));
					else
						WWORD_IO((op >> 4) & 0x7ff, READ_REG(adsp, 0, op & 15));
				}
				break;
			case 0x02:
				/* 00000010 0000xxxx xxxxxxxx  modify flag out */
				/* 00000010 10000000 00000000  idle */
				/* 00000010 10000000 0000xxxx  idle (n) */
				if (op & 0x008000)
				{
					adsp->idle = 1;
					adsp->icount = 0;
				}
				else
				{
					if (CONDITION(adsp, op & 15))
					{
						if (op & 0x020) adsp->flagout = 0;
						if (op & 0x010) adsp->flagout ^= 1;
						if (adsp->chip_type >= CHIP_TYPE_ADSP2101)
						{
							if (op & 0x080) adsp->fl0 = 0;
							if (op & 0x040) adsp->fl0 ^= 1;
							if (op & 0x200) adsp->fl1 = 0;
							if (op & 0x100) adsp->fl1 ^= 1;
							if (op & 0x800) adsp->fl2 = 0;
							if (op & 0x400) adsp->fl2 ^= 1;
						}
					}
				}
				break;
			case 0x03:
				/* 00000011 xxxxxxxx xxxxxxxx  call or jump on flag in */
				if (op & 0x000002)
				{
					if (adsp->flagin)
					{
						if (op & 0x000001)
							pc_stack_push(adsp);
						adsp->pc = ((op >> 4) & 0x0fff) | ((op << 10) & 0x3000);
						CHANGEPC(adsp);
					}
				}
				else
				{
					if (!adsp->flagin)
					{
						if (op & 0x000001)
							pc_stack_push(adsp);
						adsp->pc = ((op >> 4) & 0x0fff) | ((op << 10) & 0x3000);
						CHANGEPC(adsp);
					}
				}
				break;
			case 0x04:
				/* 00000100 00000000 000xxxxx  stack control */
				if (op & 0x000010) pc_stack_pop_val(adsp);
				if (op & 0x000008) loop_stack_pop(adsp);
				if (op & 0x000004) cntr_stack_pop(adsp);
				if (op & 0x000002)
				{
					if (op & 0x000001) stat_stack_pop(adsp);
					else stat_stack_push(adsp);
				}
				break;
			case 0x05:
				/* 00000101 00000000 00000000  saturate MR */
				if (GET_MV)
				{
					if (adsp->core.mr.mrx.mr2.u & 0x80)
						adsp->core.mr.mrx.mr2.u = 0xffff, adsp->core.mr.mrx.mr1.u = 0x8000, adsp->core.mr.mrx.mr0.u = 0x0000;
					else
						adsp->core.mr.mrx.mr2.u = 0x0000, adsp->core.mr.mrx.mr1.u = 0x7fff, adsp->core.mr.mrx.mr0.u = 0xffff;
				}
				break;
			case 0x06:
				/* 00000110 000xxxxx 00000000  DIVS */
				{
					int xop = (op >> 8) & 7;
					int yop = (op >> 11) & 3;

					xop = ALU_GETXREG_UNSIGNED(adsp, xop);
					yop = ALU_GETYREG_UNSIGNED(adsp, yop);

					temp = xop ^ yop;
					adsp->astat = (adsp->astat & ~QFLAG) | ((temp >> 10) & QFLAG);
					adsp->core.af.u = (yop << 1) | (adsp->core.ay0.u >> 15);
					adsp->core.ay0.u = (adsp->core.ay0.u << 1) | (temp >> 15);
				}
				break;
			case 0x07:
				/* 00000111 00010xxx 00000000  DIVQ */
				{
					int xop = (op >> 8) & 7;
					int res;

					xop = ALU_GETXREG_UNSIGNED(adsp, xop);

					if (GET_Q)
						res = adsp->core.af.u + xop;
					else
						res = adsp->core.af.u - xop;

					temp = res ^ xop;
					adsp->astat = (adsp->astat & ~QFLAG) | ((temp >> 10) & QFLAG);
					adsp->core.af.u = (res << 1) | (adsp->core.ay0.u >> 15);
					adsp->core.ay0.u = (adsp->core.ay0.u << 1) | ((~temp >> 15) & 0x0001);
				}
				break;
			case 0x08:
				/* 00001000 00000000 0000xxxx  reserved */
				break;
			case 0x09:
				/* 00001001 00000000 000xxxxx  modify address register */
				temp = (op >> 2) & 4;
				modify_address(adsp, temp + ((op >> 2) & 3), temp + (op & 3));
				break;
			case 0x0a:
				/* 00001010 00000000 000xxxxx  conditional return */
				if (CONDITION(adsp, op & 15))
				{
					pc_stack_pop(adsp);

					/* RTI case */
					if (op & 0x000010)
						stat_stack_pop(adsp);
				}
				break;
			case 0x0b:
				/* 00001011 00000000 xxxxxxxx  conditional jump (indirect address) */
				if (CONDITION(adsp, op & 15))
				{
					if (op & 0x000010)
						pc_stack_push(adsp);
					adsp->pc = adsp->i[4 + ((op >> 6) & 3)] & 0x3fff;
					CHANGEPC(adsp);
				}
				break;
			case 0x0c:
				/* 00001100 xxxxxxxx xxxxxxxx  mode control */
				temp = adsp->mstat;
				if (adsp->chip_type >= CHIP_TYPE_ADSP2101)
				{
					if (op & 0x000008) temp = (temp & ~MSTAT_GOMODE) | ((op << 5) & MSTAT_GOMODE);
					if (op & 0x002000) temp = (temp & ~MSTAT_INTEGER) | ((op >> 8) & MSTAT_INTEGER);
					if (op & 0x008000) temp = (temp & ~MSTAT_TIMER) | ((op >> 9) & MSTAT_TIMER);
				}
				if (op & 0x000020) temp = (temp & ~MSTAT_BANK) | ((op >> 4) & MSTAT_BANK);
				if (op & 0x000080) temp = (temp & ~MSTAT_REVERSE) | ((op >> 5) & MSTAT_REVERSE);
				if (op & 0x000200) temp = (temp & ~MSTAT_STICKYV) | ((op >> 6) & MSTAT_STICKYV);
				if (op & 0x000800) temp = (temp & ~MSTAT_SATURATE) | ((op >> 7) & MSTAT_SATURATE);
				set_mstat(adsp, temp);
				break;
			case 0x0d:
				/* 00001101 0000xxxx xxxxxxxx  internal data move */
				WRITE_REG(adsp, (op >> 10) & 3, (op >> 4) & 15, READ_REG(adsp, (op >> 8) & 3, op & 15));
				break;
			case 0x0e:
				/* 00001110 0xxxxxxx xxxxxxxx  conditional shift */
				if (CONDITION(adsp, op & 15)) shift_op(adsp, op);
				break;
			case 0x0f:
				/* 00001111 0xxxxxxx xxxxxxxx  shift immediate */
				shift_op_imm(adsp, op);
				break;
			case 0x10:
				/* 00010000 0xxxxxxx xxxxxxxx  shift with internal data register move */
				shift_op(adsp, op);
				temp = READ_REG(adsp, 0, op & 15);
				WRITE_REG(adsp, 0, (op >> 4) & 15, temp);
				break;
			case 0x11:
				/* 00010001 xxxxxxxx xxxxxxxx  shift with pgm memory read/write */
				if (op & 0x8000)
				{
					pgm_write_dag2(adsp, op, READ_REG(adsp, 0, (op >> 4) & 15));
					shift_op(adsp, op);
				}
				else
				{
					shift_op(adsp, op);
					WRITE_REG(adsp, 0, (op >> 4) & 15, pgm_read_dag2(adsp, op));
				}
				break;
			case 0x12:
				/* 00010010 xxxxxxxx xxxxxxxx  shift with data memory read/write DAG1 */
				if (op & 0x8000)
				{
					data_write_dag1(adsp, op, READ_REG(adsp, 0, (op >> 4) & 15));
					shift_op(adsp, op);
				}
				else
				{
					shift_op(adsp, op);
					WRITE_REG(adsp, 0, (op >> 4) & 15, data_read_dag1(adsp, op));
				}
				break;
			case 0x13:
				/* 00010011 xxxxxxxx xxxxxxxx  shift with data memory read/write DAG2 */
				if (op & 0x8000)
				{
					data_write_dag2(adsp, op, READ_REG(adsp, 0, (op >> 4) & 15));
					shift_op(adsp, op);
				}
				else
				{
					shift_op(adsp, op);
					WRITE_REG(adsp, 0, (op >> 4) & 15, data_read_dag2(adsp, op));
				}
				break;
			case 0x14: case 0x15: case 0x16: case 0x17:
				/* 000101xx xxxxxxxx xxxxxxxx  do until */
				loop_stack_push(adsp, op & 0x3ffff);
				pc_stack_push(adsp);
				break;
			case 0x18: case 0x19: case 0x1a: case 0x1b:
				/* 000110xx xxxxxxxx xxxxxxxx  conditional jump (immediate addr) */
				if (CONDITION(adsp, op & 15))
				{
					adsp->pc = (op >> 4) & 0x3fff;
					CHANGEPC(adsp);
					/* check for a busy loop */
					if (adsp->pc == adsp->ppc)
						adsp->icount = 0;
				}
				break;
			case 0x1c: case 0x1d: case 0x1e: case 0x1f:
				/* 000111xx xxxxxxxx xxxxxxxx  conditional call (immediate addr) */
				if (CONDITION(adsp, op & 15))
				{
					pc_stack_push(adsp);
					adsp->pc = (op >> 4) & 0x3fff;
					CHANGEPC(adsp);
				}
				break;
			case 0x20: case 0x21:
				/* 0010000x xxxxxxxx xxxxxxxx  conditional MAC to MR */
				if (CONDITION(adsp, op & 15))
				{
					if (adsp->chip_type >= CHIP_TYPE_ADSP2181 && (op & 0x0018f0) == 0x000010)
						mac_op_mr_xop(adsp, op);
					else
						mac_op_mr(adsp, op);
				}
				break;
			case 0x22: case 0x23:
				/* 0010001x xxxxxxxx xxxxxxxx  conditional ALU to AR */
				if (CONDITION(adsp, op & 15))
				{
					if (adsp->chip_type >= CHIP_TYPE_ADSP2181 && (op & 0x000010) == 0x000010)
						alu_op_ar_const(adsp, op);
					else
						alu_op_ar(adsp, op);
				}
				break;
			case 0x24: case 0x25:
				/* 0010010x xxxxxxxx xxxxxxxx  conditional MAC to MF */
				if (CONDITION(adsp, op & 15))
				{
					if (adsp->chip_type >= CHIP_TYPE_ADSP2181 && (op & 0x0018f0) == 0x000010)
						mac_op_mf_xop(adsp, op);
					else
						mac_op_mf(adsp, op);
				}
				break;
			case 0x26: case 0x27:
				/* 0010011x xxxxxxxx xxxxxxxx  conditional ALU to AF */
				if (CONDITION(adsp, op & 15))
				{
					if (adsp->chip_type >= CHIP_TYPE_ADSP2181 && (op & 0x000010) == 0x000010)
						alu_op_af_const(adsp, op);
					else
						alu_op_af(adsp, op);
				}
				break;
			case 0x28: case 0x29:
				/* 0010100x xxxxxxxx xxxxxxxx  MAC to MR with internal data register move */
				temp = READ_REG(adsp, 0, op & 15);
				mac_op_mr(adsp, op);
				WRITE_REG(adsp, 0, (op >> 4) & 15, temp);
				break;
			case 0x2a: case 0x2b:
				/* 0010101x xxxxxxxx xxxxxxxx  ALU to AR with internal data register move */
				if (adsp->chip_type >= CHIP_TYPE_ADSP2181 && (op & 0x0000ff) == 0x0000aa)
					alu_op_none(adsp, op);
				else
				{
					temp = READ_REG(adsp, 0, op & 15);
					alu_op_ar(adsp, op);
					WRITE_REG(adsp, 0, (op >> 4) & 15, temp);
				}
				break;
			case 0x2c: case 0x2d:
				/* 0010110x xxxxxxxx xxxxxxxx  MAC to MF with internal data register move */
				temp = READ_REG(adsp, 0, op & 15);
				mac_op_mf(adsp, op);
				WRITE_REG(adsp, 0, (op >> 4) & 15, temp);
				break;
			case 0x2e: case 0x2f:
				/* 0010111x xxxxxxxx xxxxxxxx  ALU to AF with internal data register move */
				temp = READ_REG(adsp, 0, op & 15);
				alu_op_af(adsp, op);
				WRITE_REG(adsp, 0, (op >> 4) & 15, temp);
				break;
			case 0x30: case 0x31: case 0x32: case 0x33:
				/* 001100xx xxxxxxxx xxxxxxxx  load non-data register immediate (group 0) */
				WRITE_REG(adsp, 0, op & 15, (INT32)(op << 14) >> 18);
				break;
			case 0x34: case 0x35: case 0x36: case 0x37:
				/* 001101xx xxxxxxxx xxxxxxxx  load non-data register immediate (group 1) */
				WRITE_REG(adsp, 1, op & 15, (INT32)(op << 14) >> 18);
				break;
			case 0x38: case 0x39: case 0x3a: case 0x3b:
				/* 001110xx xxxxxxxx xxxxxxxx  load non-data register immediate (group 2) */
				WRITE_REG(adsp, 2, op & 15, (INT32)(op << 14) >> 18);
				break;
			case 0x3c: case 0x3d: case 0x3e: case 0x3f:
				/* 001111xx xxxxxxxx xxxxxxxx  load non-data register immediate (group 3) */
				WRITE_REG(adsp, 3, op & 15, (INT32)(op << 14) >> 18);
				break;
			case 0x40: case 0x41: case 0x42: case 0x43: case 0x44: case 0x45: case 0x46: case 0x47:
			case 0x48: case 0x49: case 0x4a: case 0x4b: case 0x4c: case 0x4d: case 0x4e: case 0x4f:
				/* 0100xxxx xxxxxxxx xxxxxxxx  load data register immediate */
				WRITE_REG(adsp, 0, op & 15, (op >> 4) & 0xffff);
				break;
			case 0x50: case 0x51:
				/* 0101000x xxxxxxxx xxxxxxxx  MAC to MR with pgm memory read */
				mac_op_mr(adsp, op);
				WRITE_REG(adsp, 0, (op >> 4) & 15, pgm_read_dag2(adsp, op));
				break;
			case 0x52: case 0x53:
				/* 0101001x xxxxxxxx xxxxxxxx  ALU to AR with pgm memory read */
				alu_op_ar(adsp, op);
				WRITE_REG(adsp, 0, (op >> 4) & 15, pgm_read_dag2(adsp, op));
				break;
			case 0x54: case 0x55:
				/* 0101010x xxxxxxxx xxxxxxxx  MAC to MF with pgm memory read */
				mac_op_mf(adsp, op);
				WRITE_REG(adsp, 0, (op >> 4) & 15, pgm_read_dag2(adsp, op));
				break;
			case 0x56: case 0x57:
				/* 0101011x xxxxxxxx xxxxxxxx  ALU to AF with pgm memory read */
				alu_op_af(adsp, op);
				WRITE_REG(adsp, 0, (op >> 4) & 15, pgm_read_dag2(adsp, op));
				break;
			case 0x58: case 0x59:
				/* 0101100x xxxxxxxx xxxxxxxx  MAC to MR with pgm memory write */
				pgm_write_dag2(adsp, op, READ_REG(adsp, 0, (op >> 4) & 15));
				mac_op_mr(adsp, op);
				break;
			case 0x5a: case 0x5b:
				/* 0101101x xxxxxxxx xxxxxxxx  ALU to AR with pgm memory write */
				pgm_write_dag2(adsp, op, READ_REG(adsp, 0, (op >> 4) & 15));
				alu_op_ar(adsp, op);
				break;
			case 0x5c: case 0x5d:
				/* 0101110x xxxxxxxx xxxxxxxx  ALU to MR with pgm memory write */
				pgm_write_dag2(adsp, op, READ_REG(adsp, 0, (op >> 4) & 15));
				mac_op_mf(adsp, op);
				break;
			case 0x5e: case 0x5f:
				/* 0101111x xxxxxxxx xxxxxxxx  ALU to MF with pgm memory write */
				pgm_write_dag2(adsp, op, READ_REG(adsp, 0, (op >> 4) & 15));
				alu_op_af(adsp, op);
				break;
			case 0x60: case 0x61:
				/* 0110000x xxxxxxxx xxxxxxxx  MAC to MR with data memory read DAG1 */
				mac_op_mr(adsp, op);
				WRITE_REG(adsp, 0, (op >> 4) & 15, data_read_dag1(adsp, op));
				break;
			case 0x62: case 0x63:
				/* 0110001x xxxxxxxx xxxxxxxx  ALU to AR with data memory read DAG1 */
				alu_op_ar(adsp, op);
				WRITE_REG(adsp, 0, (op >> 4) & 15, data_read_dag1(adsp, op));
				break;
			case 0x64: case 0x65:
				/* 0110010x xxxxxxxx xxxxxxxx  MAC to MF with data memory read DAG1 */
				mac_op_mf(adsp, op);
				WRITE_REG(adsp, 0, (op >> 4) & 15, data_read_dag1(adsp, op));
				break;
			case 0x66: case 0x67:
				/* 0110011x xxxxxxxx xxxxxxxx  ALU to AF with data memory read DAG1 */
				alu_op_af(adsp, op);
				WRITE_REG(adsp, 0, (op >> 4) & 15, data_read_dag1(adsp, op));
				break;
			case 0x68: case 0x69:
				/* 0110100x xxxxxxxx xxxxxxxx  MAC to MR with data memory write DAG1 */
				data_write_dag1(adsp, op, READ_REG(adsp, 0, (op >> 4) & 15));
				mac_op_mr(adsp, op);
				break;
			case 0x6a: case 0x6b:
				/* 0110101x xxxxxxxx xxxxxxxx  ALU to AR with data memory write DAG1 */
				data_write_dag1(adsp, op, READ_REG(adsp, 0, (op >> 4) & 15));
				alu_op_ar(adsp, op);
				break;
			case 0x6c: case 0x6d:
				/* 0111110x xxxxxxxx xxxxxxxx  MAC to MF with data memory write DAG1 */
				data_write_dag1(adsp, op, READ_REG(adsp, 0, (op >> 4) & 15));
				mac_op_mf(adsp, op);
				break;
			case 0x6e: case 0x6f:
				/* 0111111x xxxxxxxx xxxxxxxx  ALU to AF with data memory write DAG1 */
				data_write_dag1(adsp, op, READ_REG(adsp, 0, (op >> 4) & 15));
				alu_op_af(adsp, op);
				break;
			case 0x70: case 0x71:
				/* 0111000x xxxxxxxx xxxxxxxx  MAC to MR with data memory read DAG2 */
				mac_op_mr(adsp, op);
				WRITE_REG(adsp, 0, (op >> 4) & 15, data_read_dag2(adsp, op));
				break;
			case 0x72: case 0x73:
				/* 0111001x xxxxxxxx xxxxxxxx  ALU to AR with data memory read DAG2 */
				alu_op_ar(adsp, op);
				WRITE_REG(adsp, 0, (op >> 4) & 15, data_read_dag2(adsp, op));
				break;
			case 0x74: case 0x75:
				/* 0111010x xxxxxxxx xxxxxxxx  MAC to MF with data memory read DAG2 */
				mac_op_mf(adsp, op);
				WRITE_REG(adsp, 0, (op >> 4) & 15, data_read_dag2(adsp, op));
				break;
			case 0x76: case 0x77:
				/* 0111011x xxxxxxxx xxxxxxxx  ALU to AF with data memory read DAG2 */
				alu_op_af(adsp, op);
				WRITE_REG(adsp, 0, (op >> 4) & 15, data_read_dag2(adsp, op));
				break;
			case 0x78: case 0x79:
				/* 0111100x xxxxxxxx xxxxxxxx  MAC to MR with data memory write DAG2 */
				data_write_dag2(adsp, op, READ_REG(adsp, 0, (op >> 4) & 15));
				mac_op_mr(adsp, op);
				break;
			case 0x7a: case 0x7b:
				/* 0111101x xxxxxxxx xxxxxxxx  ALU to AR with data memory write DAG2 */
				data_write_dag2(adsp, op, READ_REG(adsp, 0, (op >> 4) & 15));
				alu_op_ar(adsp, op);
				break;
			case 0x7c: case 0x7d:
				/* 0111110x xxxxxxxx xxxxxxxx  MAC to MF with data memory write DAG2 */
				data_write_dag2(adsp, op, READ_REG(adsp, 0, (op >> 4) & 15));
				mac_op_mf(adsp, op);
				break;
			case 0x7e: case 0x7f:
				/* 0111111x xxxxxxxx xxxxxxxx  ALU to AF with data memory write DAG2 */
				data_write_dag2(adsp, op, READ_REG(adsp, 0, (op >> 4) & 15));
				alu_op_af(adsp, op);
				break;
			case 0x80: case 0x81: case 0x82: case 0x83:
				/* 100000xx xxxxxxxx xxxxxxxx  read data memory (immediate addr) to reg group 0 */
				WRITE_REG(adsp, 0, op & 15, RWORD_DATA((op >> 4) & 0x3fff));
				break;
			case 0x84: case 0x85: case 0x86: case 0x87:
				/* 100001xx xxxxxxxx xxxxxxxx  read data memory (immediate addr) to reg group 1 */
				WRITE_REG(adsp, 1, op & 15, RWORD_DATA((op >> 4) & 0x3fff));
				break;
			case 0x88: case 0x89: case 0x8a: case 0x8b:
				/* 100010xx xxxxxxxx xxxxxxxx  read data memory (immediate addr) to reg group 2 */
				WRITE_REG(adsp, 2, op & 15, RWORD_DATA((op >> 4) & 0x3fff));
				break;
			case 0x8c: case 0x8d: case 0x8e: case 0x8f:
				/* 100011xx xxxxxxxx xxxxxxxx  read data memory (immediate addr) to reg group 3 */
				WRITE_REG(adsp, 3, op & 15, RWORD_DATA((op >> 4) & 0x3fff));
				break;
			case 0x90: case 0x91: case 0x92: case 0x93:
				/* 1001xxxx xxxxxxxx xxxxxxxx  write data memory (immediate addr) from reg group 0 */
				WWORD_DATA((op >> 4) & 0x3fff, READ_REG(adsp, 0, op & 15));
				break;
			case 0x94: case 0x95: case 0x96: case 0x97:
				/* 1001xxxx xxxxxxxx xxxxxxxx  write data memory (immediate addr) from reg group 1 */
				WWORD_DATA((op >> 4) & 0x3fff, READ_REG(adsp, 1, op & 15));
				break;
			case 0x98: case 0x99: case 0x9a: case 0x9b:
				/* 1001xxxx xxxxxxxx xxxxxxxx  write data memory (immediate addr) from reg group 2 */
				WWORD_DATA((op >> 4) & 0x3fff, READ_REG(adsp, 2, op & 15));
				break;
			case 0x9c: case 0x9d: case 0x9e: case 0x9f:
				/* 1001xxxx xxxxxxxx xxxxxxxx  write data memory (immediate addr) from reg group 3 */
				WWORD_DATA((op >> 4) & 0x3fff, READ_REG(adsp, 3, op & 15));
				break;
			case 0xa0: case 0xa1: case 0xa2: case 0xa3: case 0xa4: case 0xa5: case 0xa6: case 0xa7:
			case 0xa8: case 0xa9: case 0xaa: case 0xab: case 0xac: case 0xad: case 0xae: case 0xaf:
				/* 1010xxxx xxxxxxxx xxxxxxxx  data memory write (immediate) DAG1 */
				data_write_dag1(adsp, op, (op >> 4) & 0xffff);
				break;
			case 0xb0: case 0xb1: case 0xb2: case 0xb3: case 0xb4: case 0xb5: case 0xb6: case 0xb7:
			case 0xb8: case 0xb9: case 0xba: case 0xbb: case 0xbc: case 0xbd: case 0xbe: case 0xbf:
				/* 1011xxxx xxxxxxxx xxxxxxxx  data memory write (immediate) DAG2 */
				data_write_dag2(adsp, op, (op >> 4) & 0xffff);
				break;
			case 0xc0: case 0xc1:
				/* 1100000x xxxxxxxx xxxxxxxx  MAC to MR with data read to AX0 & pgm read to AY0 */
				mac_op_mr(adsp, op);
				adsp->core.ax0.u = data_read_dag1(adsp, op);
				adsp->core.ay0.u = pgm_read_dag2(adsp, op >> 4);
				break;
			case 0xc2: case 0xc3:
				/* 1100001x xxxxxxxx xxxxxxxx  ALU to AR with data read to AX0 & pgm read to AY0 */
				alu_op_ar(adsp, op);
				adsp->core.ax0.u = data_read_dag1(adsp, op);
				adsp->core.ay0.u = pgm_read_dag2(adsp, op >> 4);
				break;
			case 0xc4: case 0xc5:
				/* 1100010x xxxxxxxx xxxxxxxx  MAC to MR with data read to AX1 & pgm read to AY0 */
				mac_op_mr(adsp, op);
				adsp->core.ax1.u = data_read_dag1(adsp, op);
				adsp->core.ay0.u = pgm_read_dag2(adsp, op >> 4);
				break;
			case 0xc6: case 0xc7:
				/* 1100011x xxxxxxxx xxxxxxxx  ALU to AR with data read to AX1 & pgm read to AY0 */
				alu_op_ar(adsp, op);
				adsp->core.ax1.u = data_read_dag1(adsp, op);
				adsp->core.ay0.u = pgm_read_dag2(adsp, op >> 4);
				break;
			case 0xc8: case 0xc9:
				/* 1100100x xxxxxxxx xxxxxxxx  MAC to MR with data read to MX0 & pgm read to AY0 */
				mac_op_mr(adsp, op);
				adsp->core.mx0.u = data_read_dag1(adsp, op);
				adsp->core.ay0.u = pgm_read_dag2(adsp, op >> 4);
				break;
			case 0xca: case 0xcb:
				/* 1100101x xxxxxxxx xxxxxxxx  ALU to AR with data read to MX0 & pgm read to AY0 */
				alu_op_ar(adsp, op);
				adsp->core.mx0.u = data_read_dag1(adsp, op);
				adsp->core.ay0.u = pgm_read_dag2(adsp, op >> 4);
				break;
			case 0xcc: case 0xcd:
				/* 1100110x xxxxxxxx xxxxxxxx  MAC to MR with data read to MX1 & pgm read to AY0 */
				mac_op_mr(adsp, op);
				adsp->core.mx1.u = data_read_dag1(adsp, op);
				adsp->core.ay0.u = pgm_read_dag2(adsp, op >> 4);
				break;
			case 0xce: case 0xcf:
				/* 1100111x xxxxxxxx xxxxxxxx  ALU to AR with data read to MX1 & pgm read to AY0 */
				alu_op_ar(adsp, op);
				adsp->core.mx1.u = data_read_dag1(adsp, op);
				adsp->core.ay0.u = pgm_read_dag2(adsp, op >> 4);
				break;
			case 0xd0: case 0xd1:
				/* 1101000x xxxxxxxx xxxxxxxx  MAC to MR with data read to AX0 & pgm read to AY1 */
				mac_op_mr(adsp, op);
				adsp->core.ax0.u = data_read_dag1(adsp, op);
				adsp->core.ay1.u = pgm_read_dag2(adsp, op >> 4);
				break;
			case 0xd2: case 0xd3:
				/* 1101001x xxxxxxxx xxxxxxxx  ALU to AR with data read to AX0 & pgm read to AY1 */
				alu_op_ar(adsp, op);
				adsp->core.ax0.u = data_read_dag1(adsp, op);
				adsp->core.ay1.u = pgm_read_dag2(adsp, op >> 4);
				break;
			case 0xd4: case 0xd5:
				/* 1101010x xxxxxxxx xxxxxxxx  MAC to MR with data read to AX1 & pgm read to AY1 */
				mac_op_mr(adsp, op);
				adsp->core.ax1.u = data_read_dag1(adsp, op);
				adsp->core.ay1.u = pgm_read_dag2(adsp, op >> 4);
				break;
			case 0xd6: case 0xd7:
				/* 1101011x xxxxxxxx xxxxxxxx  ALU to AR with data read to AX1 & pgm read to AY1 */
				alu_op_ar(adsp, op);
				adsp->core.ax1.u = data_read_dag1(adsp, op);
				adsp->core.ay1.u = pgm_read_dag2(adsp, op >> 4);
				break;
			case 0xd8: case 0xd9:
				/* 1101100x xxxxxxxx xxxxxxxx  MAC to MR with data read to MX0 & pgm read to AY1 */
				mac_op_mr(adsp, op);
				adsp->core.mx0.u = data_read_dag1(adsp, op);
				adsp->core.ay1.u = pgm_read_dag2(adsp, op >> 4);
				break;
			case 0xda: case 0xdb:
				/* 1101101x xxxxxxxx xxxxxxxx  ALU to AR with data read to MX0 & pgm read to AY1 */
				alu_op_ar(adsp, op);
				adsp->core.mx0.u = data_read_dag1(adsp, op);
				adsp->core.ay1.u = pgm_read_dag2(adsp, op >> 4);
				break;
			case 0xdc: case 0xdd:
				/* 1101110x xxxxxxxx xxxxxxxx  MAC to MR with data read to MX1 & pgm read to AY1 */
				mac_op_mr(adsp, op);
				adsp->core.mx1.u = data_read_dag1(adsp, op);
				adsp->core.ay1.u = pgm_read_dag2(adsp, op >> 4);
				break;
			case 0xde: case 0xdf:
				/* 1101111x xxxxxxxx xxxxxxxx  ALU to AR with data read to MX1 & pgm read to AY1 */
				alu_op_ar(adsp, op);
				adsp->core.mx1.u = data_read_dag1(adsp, op);
				adsp->core.ay1.u = pgm_read_dag2(adsp, op >> 4);
				break;
			case 0xe0: case 0xe1:
				/* 1110000x xxxxxxxx xxxxxxxx  MAC to MR with data read to AX0 & pgm read to MY0 */
				mac_op_mr(adsp, op);
				adsp->core.ax0.u = data_read_dag1(adsp, op);
				adsp->core.my0.u = pgm_read_dag2(adsp, op >> 4);
				break;
			case 0xe2: case 0xe3:
				/* 1110001x xxxxxxxx xxxxxxxx  ALU to AR with data read to AX0 & pgm read to MY0 */
				alu_op_ar(adsp, op);
				adsp->core.ax0.u = data_read_dag1(adsp, op);
				adsp->core.my0.u = pgm_read_dag2(adsp, op >> 4);
				break;
			case 0xe4: case 0xe5:
				/* 1110010x xxxxxxxx xxxxxxxx  MAC to MR with data read to AX1 & pgm read to MY0 */
				mac_op_mr(adsp, op);
				adsp->core.ax1.u = data_read_dag1(adsp, op);
				adsp->core.my0.u = pgm_read_dag2(adsp, op >> 4);
				break;
			case 0xe6: case 0xe7:
				/* 1110011x xxxxxxxx xxxxxxxx  ALU to AR with data read to AX1 & pgm read to MY0 */
				alu_op_ar(adsp, op);
				adsp->core.ax1.u = data_read_dag1(adsp, op);
				adsp->core.my0.u = pgm_read_dag2(adsp, op >> 4);
				break;
			case 0xe8: case 0xe9:
				/* 1110100x xxxxxxxx xxxxxxxx  MAC to MR with data read to MX0 & pgm read to MY0 */
				mac_op_mr(adsp, op);
				adsp->core.mx0.u = data_read_dag1(adsp, op);
				adsp->core.my0.u = pgm_read_dag2(adsp, op >> 4);
				break;
			case 0xea: case 0xeb:
				/* 1110101x xxxxxxxx xxxxxxxx  ALU to AR with data read to MX0 & pgm read to MY0 */
				alu_op_ar(adsp, op);
				adsp->core.mx0.u = data_read_dag1(adsp, op);
				adsp->core.my0.u = pgm_read_dag2(adsp, op >> 4);
				break;
			case 0xec: case 0xed:
				/* 1110110x xxxxxxxx xxxxxxxx  MAC to MR with data read to MX1 & pgm read to MY0 */
				mac_op_mr(adsp, op);
				adsp->core.mx1.u = data_read_dag1(adsp, op);
				adsp->core.my0.u = pgm_read_dag2(adsp, op >> 4);
				break;
			case 0xee: case 0xef:
				/* 1110111x xxxxxxxx xxxxxxxx  ALU to AR with data read to MX1 & pgm read to MY0 */
				alu_op_ar(adsp, op);
				adsp->core.mx1.u = data_read_dag1(adsp, op);
				adsp->core.my0.u = pgm_read_dag2(adsp, op >> 4);
				break;
			case 0xf0: case 0xf1:
				/* 1111000x xxxxxxxx xxxxxxxx  MAC to MR with data read to AX0 & pgm read to MY1 */
				mac_op_mr(adsp, op);
				adsp->core.ax0.u = data_read_dag1(adsp, op);
				adsp->core.my1.u = pgm_read_dag2(adsp, op >> 4);
				break;
			case 0xf2: case 0xf3:
				/* 1111001x xxxxxxxx xxxxxxxx  ALU to AR with data read to AX0 & pgm read to MY1 */
				alu_op_ar(adsp, op);
				adsp->core.ax0.u = data_read_dag1(adsp, op);
				adsp->core.my1.u = pgm_read_dag2(adsp, op >> 4);
				break;
			case 0xf4: case 0xf5:
				/* 1111010x xxxxxxxx xxxxxxxx  MAC to MR with data read to AX1 & pgm read to MY1 */
				mac_op_mr(adsp, op);
				adsp->core.ax1.u = data_read_dag1(adsp, op);
				adsp->core.my1.u = pgm_read_dag2(adsp, op >> 4);
				break;
			case 0xf6: case 0xf7:
				/* 1111011x xxxxxxxx xxxxxxxx  ALU to AR with data read to AX1 & pgm read to MY1 */
				alu_op_ar(adsp, op);
				adsp->core.ax1.u = data_read_dag1(adsp, op);
				adsp->core.my1.u = pgm_read_dag2(adsp, op >> 4);
				break;
			case 0xf8: case 0xf9:
				/* 1111100x xxxxxxxx xxxxxxxx  MAC to MR with data read to MX0 & pgm read to MY1 */
				mac_op_mr(adsp, op);
				adsp->core.mx0.u = data_read_dag1(adsp, op);
				adsp->core.my1.u = pgm_read_dag2(adsp, op >> 4);
				break;
			case 0xfa: case 0xfb:
				/* 1111101x xxxxxxxx xxxxxxxx  ALU to AR with data read to MX0 & pgm read to MY1 */
				alu_op_ar(adsp, op);
				adsp->core.mx0.u = data_read_dag1(adsp, op);
				adsp->core.my1.u = pgm_read_dag2(adsp, op >> 4);
				break;
			case 0xfc: case 0xfd:
				/* 1111110x xxxxxxxx xxxxxxxx  MAC to MR with data read to MX1 & pgm read to MY1 */
				mac_op_mr(adsp, op);
				adsp->core.mx1.u = data_read_dag1(adsp, op);
				adsp->core.my1.u = pgm_read_dag2(adsp, op >> 4);
				break;
			case 0xfe: case 0xff:
				/* 1111111x xxxxxxxx xxxxxxxx  ALU to AR with data read to MX1 & pgm read to MY1 */
				alu_op_ar(adsp, op);
				adsp->core.mx1.u = data_read_dag1(adsp, op);
				adsp->core.my1.u = pgm_read_dag2(adsp, op >> 4);
				break;
		}

		adsp->icount--;
	} while (adsp->icount > 0);

	return cycles - adsp->icount;
}



/***************************************************************************
    DEBUGGER DEFINITIONS
***************************************************************************/

extern CPU_DISASSEMBLE( adsp21xx );



/**************************************************************************
 * Generic set_info
 **************************************************************************/

static CPU_SET_INFO( adsp21xx )
{
	adsp2100_state *adsp = token;
	switch (state)
	{
		/* --- the following bits of info are set as 64-bit signed integers --- */
		case CPUINFO_INT_PC:
		case CPUINFO_INT_REGISTER + ADSP2100_PC:		adsp->pc = info->i;					break;

		case CPUINFO_INT_REGISTER + ADSP2100_AX0:		wr_ax0(adsp, info->i);				break;
		case CPUINFO_INT_REGISTER + ADSP2100_AX1:		wr_ax1(adsp, info->i);				break;
		case CPUINFO_INT_REGISTER + ADSP2100_AY0:		wr_ay0(adsp, info->i);				break;
		case CPUINFO_INT_REGISTER + ADSP2100_AY1:		wr_ay1(adsp, info->i);				break;
		case CPUINFO_INT_REGISTER + ADSP2100_AR:		wr_ar(adsp, info->i);				break;
		case CPUINFO_INT_REGISTER + ADSP2100_AF:		adsp->core.af.u = info->i;			break;

		case CPUINFO_INT_REGISTER + ADSP2100_MX0:		wr_mx0(adsp, info->i);				break;
		case CPUINFO_INT_REGISTER + ADSP2100_MX1:		wr_mx1(adsp, info->i);				break;
		case CPUINFO_INT_REGISTER + ADSP2100_MY0:		wr_my0(adsp, info->i);				break;
		case CPUINFO_INT_REGISTER + ADSP2100_MY1:		wr_my1(adsp, info->i);				break;
		case CPUINFO_INT_REGISTER + ADSP2100_MR0:		wr_mr0(adsp, info->i);				break;
		case CPUINFO_INT_REGISTER + ADSP2100_MR1:		wr_mr1(adsp, info->i);				break;
		case CPUINFO_INT_REGISTER + ADSP2100_MR2:		wr_mr2(adsp, info->i);				break;
		case CPUINFO_INT_REGISTER + ADSP2100_MF:		adsp->core.mf.u = info->i;			break;

		case CPUINFO_INT_REGISTER + ADSP2100_SI:		wr_si(adsp, info->i);				break;
		case CPUINFO_INT_REGISTER + ADSP2100_SE:		wr_se(adsp, info->i);				break;
		case CPUINFO_INT_REGISTER + ADSP2100_SB:		wr_sb(adsp, info->i);				break;
		case CPUINFO_INT_REGISTER + ADSP2100_SR0:		wr_sr0(adsp, info->i);				break;
		case CPUINFO_INT_REGISTER + ADSP2100_SR1:		wr_sr1(adsp, info->i);				break;

		case CPUINFO_INT_REGISTER + ADSP2100_AX0_SEC:	adsp->alt.ax0.s = info->i;			break;
		case CPUINFO_INT_REGISTER + ADSP2100_AX1_SEC:	adsp->alt.ax1.s = info->i;			break;
		case CPUINFO_INT_REGISTER + ADSP2100_AY0_SEC:	adsp->alt.ay0.s = info->i;			break;
		case CPUINFO_INT_REGISTER + ADSP2100_AY1_SEC:	adsp->alt.ay1.s = info->i;			break;
		case CPUINFO_INT_REGISTER + ADSP2100_AR_SEC:	adsp->alt.ar.s = info->i;			break;
		case CPUINFO_INT_REGISTER + ADSP2100_AF_SEC:	adsp->alt.af.u = info->i;			break;

		case CPUINFO_INT_REGISTER + ADSP2100_MX0_SEC:	adsp->alt.mx0.s = info->i;			break;
		case CPUINFO_INT_REGISTER + ADSP2100_MX1_SEC:	adsp->alt.mx1.s = info->i;			break;
		case CPUINFO_INT_REGISTER + ADSP2100_MY0_SEC:	adsp->alt.my0.s = info->i;			break;
		case CPUINFO_INT_REGISTER + ADSP2100_MY1_SEC:	adsp->alt.my1.s = info->i;			break;
		case CPUINFO_INT_REGISTER + ADSP2100_MR0_SEC:	adsp->alt.mr.mrx.mr0.s = info->i;	break;
		case CPUINFO_INT_REGISTER + ADSP2100_MR1_SEC:	adsp->alt.mr.mrx.mr1.s = info->i; adsp->alt.mr.mrx.mr2.s = (INT16)info->i >> 15; break;
		case CPUINFO_INT_REGISTER + ADSP2100_MR2_SEC:	adsp->alt.mr.mrx.mr2.s = (INT8)info->i; break;
		case CPUINFO_INT_REGISTER + ADSP2100_MF_SEC:	adsp->alt.mf.u = info->i;			break;

		case CPUINFO_INT_REGISTER + ADSP2100_SI_SEC:	adsp->alt.si.s = info->i;			break;
		case CPUINFO_INT_REGISTER + ADSP2100_SE_SEC:	adsp->alt.se.s = (INT8)info->i;		break;
		case CPUINFO_INT_REGISTER + ADSP2100_SB_SEC:	adsp->alt.sb.s = (INT32)(info->i << 27) >> 27; break;
		case CPUINFO_INT_REGISTER + ADSP2100_SR0_SEC:	adsp->alt.sr.srx.sr0.s = info->i;	break;
		case CPUINFO_INT_REGISTER + ADSP2100_SR1_SEC:	adsp->alt.sr.srx.sr1.s = info->i;	break;

		case CPUINFO_INT_REGISTER + ADSP2100_I0:		wr_i0(adsp, info->i); 				break;
		case CPUINFO_INT_REGISTER + ADSP2100_I1:		wr_i1(adsp, info->i); 				break;
		case CPUINFO_INT_REGISTER + ADSP2100_I2:		wr_i2(adsp, info->i); 				break;
		case CPUINFO_INT_REGISTER + ADSP2100_I3:		wr_i3(adsp, info->i); 				break;
		case CPUINFO_INT_REGISTER + ADSP2100_I4:		wr_i4(adsp, info->i); 				break;
		case CPUINFO_INT_REGISTER + ADSP2100_I5:		wr_i5(adsp, info->i); 				break;
		case CPUINFO_INT_REGISTER + ADSP2100_I6:		wr_i6(adsp, info->i); 				break;
		case CPUINFO_INT_REGISTER + ADSP2100_I7:		wr_i7(adsp, info->i); 				break;

		case CPUINFO_INT_REGISTER + ADSP2100_L0:		wr_l0(adsp, info->i); 				break;
		case CPUINFO_INT_REGISTER + ADSP2100_L1:		wr_l1(adsp, info->i); 				break;
		case CPUINFO_INT_REGISTER + ADSP2100_L2:		wr_l2(adsp, info->i); 				break;
		case CPUINFO_INT_REGISTER + ADSP2100_L3:		wr_l3(adsp, info->i); 				break;
		case CPUINFO_INT_REGISTER + ADSP2100_L4:		wr_l4(adsp, info->i); 				break;
		case CPUINFO_INT_REGISTER + ADSP2100_L5:		wr_l5(adsp, info->i); 				break;
		case CPUINFO_INT_REGISTER + ADSP2100_L6:		wr_l6(adsp, info->i); 				break;
		case CPUINFO_INT_REGISTER + ADSP2100_L7:		wr_l7(adsp, info->i); 				break;

		case CPUINFO_INT_REGISTER + ADSP2100_M0:		wr_m0(adsp, info->i); 				break;
		case CPUINFO_INT_REGISTER + ADSP2100_M1:		wr_m1(adsp, info->i); 				break;
		case CPUINFO_INT_REGISTER + ADSP2100_M2:		wr_m2(adsp, info->i); 				break;
		case CPUINFO_INT_REGISTER + ADSP2100_M3:		wr_m3(adsp, info->i); 				break;
		case CPUINFO_INT_REGISTER + ADSP2100_M4:		wr_m4(adsp, info->i); 				break;
		case CPUINFO_INT_REGISTER + ADSP2100_M5:		wr_m5(adsp, info->i); 				break;
		case CPUINFO_INT_REGISTER + ADSP2100_M6:		wr_m6(adsp, info->i); 				break;
		case CPUINFO_INT_REGISTER + ADSP2100_M7:		wr_m7(adsp, info->i); 				break;

		case CPUINFO_INT_REGISTER + ADSP2100_PX:		wr_px(adsp, info->i); 				break;
		case CPUINFO_INT_REGISTER + ADSP2100_CNTR:		adsp->cntr = info->i; 				break;
		case CPUINFO_INT_REGISTER + ADSP2100_ASTAT:		wr_astat(adsp, info->i); 			break;
		case CPUINFO_INT_REGISTER + ADSP2100_SSTAT:		wr_sstat(adsp, info->i); 			break;
		case CPUINFO_INT_REGISTER + ADSP2100_MSTAT:		wr_mstat(adsp, info->i); 			break;

		case CPUINFO_INT_SP:
		case CPUINFO_INT_REGISTER + ADSP2100_PCSP:		adsp->pc_sp = info->i; 				break;
		case CPUINFO_INT_REGISTER + ADSP2100_CNTRSP:	adsp->cntr_sp = info->i; 			break;
		case CPUINFO_INT_REGISTER + ADSP2100_STATSP:	adsp->stat_sp = info->i; 			break;
		case CPUINFO_INT_REGISTER + ADSP2100_LOOPSP:	adsp->loop_sp = info->i; 			break;

		case CPUINFO_INT_REGISTER + ADSP2100_IMASK:		wr_imask(adsp, info->i); 			break;
		case CPUINFO_INT_REGISTER + ADSP2100_ICNTL:		wr_icntl(adsp, info->i); 			break;
		case CPUINFO_INT_REGISTER + ADSP2100_IRQSTATE0:	adsp->irq_state[0] = info->i; 		break;
		case CPUINFO_INT_REGISTER + ADSP2100_IRQSTATE1:	adsp->irq_state[1] = info->i; 		break;
		case CPUINFO_INT_REGISTER + ADSP2100_IRQSTATE2:	adsp->irq_state[2] = info->i; 		break;
		case CPUINFO_INT_REGISTER + ADSP2100_IRQSTATE3:	adsp->irq_state[3] = info->i; 		break;

		case CPUINFO_INT_REGISTER + ADSP2100_FLAGIN:	adsp->flagin = info->i; 			break;
		case CPUINFO_INT_REGISTER + ADSP2100_FLAGOUT:	adsp->flagout = info->i; 			break;
		case CPUINFO_INT_REGISTER + ADSP2100_FL0:		adsp->fl0 = info->i; 				break;
		case CPUINFO_INT_REGISTER + ADSP2100_FL1:		adsp->fl1 = info->i; 				break;
		case CPUINFO_INT_REGISTER + ADSP2100_FL2: 		adsp->fl2 = info->i; 				break;
	}
}



/**************************************************************************
 * Generic get_info
 **************************************************************************/

static CPU_GET_INFO( adsp21xx )
{
	adsp2100_state *adsp = token;
	switch (state)
	{
		/* --- the following bits of info are returned as 64-bit signed integers --- */
		case CPUINFO_INT_CONTEXT_SIZE:					info->i = sizeof(adsp2100_state);		break;
		case CPUINFO_INT_INPUT_LINES:					/* set per CPU */						break;
		case CPUINFO_INT_DEFAULT_IRQ_VECTOR:			info->i = 0;							break;
		case CPUINFO_INT_ENDIANNESS:					info->i = CPU_IS_LE;					break;
		case CPUINFO_INT_CLOCK_MULTIPLIER:				info->i = 1;							break;
		case CPUINFO_INT_CLOCK_DIVIDER:					info->i = 1;							break;
		case CPUINFO_INT_MIN_INSTRUCTION_BYTES:			info->i = 4;							break;
		case CPUINFO_INT_MAX_INSTRUCTION_BYTES:			info->i = 4;							break;
		case CPUINFO_INT_MIN_CYCLES:					info->i = 1;							break;
		case CPUINFO_INT_MAX_CYCLES:					info->i = 1;							break;

		case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:	info->i = 32;					break;
		case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 14;					break;
		case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = -2;					break;
		case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:	info->i = 16;					break;
		case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA: 	info->i = 14;					break;
		case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA: 	info->i = -1;					break;
		case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:		info->i = 0;					break;
		case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO: 		info->i = 0;					break;
		case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO: 		info->i = 0;					break;

		case CPUINFO_INT_PREVIOUSPC:					info->i = adsp->ppc;					break;
		case CPUINFO_INT_PC:
		case CPUINFO_INT_REGISTER + ADSP2100_PC:		info->i = adsp->pc;						break;

		case CPUINFO_INT_REGISTER + ADSP2100_AX0:		info->i = adsp->core.ax0.u;				break;
		case CPUINFO_INT_REGISTER + ADSP2100_AX1:		info->i = adsp->core.ax1.u;				break;
		case CPUINFO_INT_REGISTER + ADSP2100_AY0:		info->i = adsp->core.ay0.u;				break;
		case CPUINFO_INT_REGISTER + ADSP2100_AY1:		info->i = adsp->core.ay1.u;				break;
		case CPUINFO_INT_REGISTER + ADSP2100_AR:		info->i = adsp->core.ar.u;				break;
		case CPUINFO_INT_REGISTER + ADSP2100_AF:		info->i = adsp->core.af.u;				break;

		case CPUINFO_INT_REGISTER + ADSP2100_MX0:		info->i = adsp->core.mx0.u;				break;
		case CPUINFO_INT_REGISTER + ADSP2100_MX1:		info->i = adsp->core.mx1.u;				break;
		case CPUINFO_INT_REGISTER + ADSP2100_MY0:		info->i = adsp->core.my0.u;				break;
		case CPUINFO_INT_REGISTER + ADSP2100_MY1:		info->i = adsp->core.my1.u;				break;
		case CPUINFO_INT_REGISTER + ADSP2100_MR0:		info->i = adsp->core.mr.mrx.mr0.u;		break;
		case CPUINFO_INT_REGISTER + ADSP2100_MR1:		info->i = adsp->core.mr.mrx.mr1.u;		break;
		case CPUINFO_INT_REGISTER + ADSP2100_MR2:		info->i = adsp->core.mr.mrx.mr2.u;		break;
		case CPUINFO_INT_REGISTER + ADSP2100_MF:		info->i = adsp->core.mf.u;				break;

		case CPUINFO_INT_REGISTER + ADSP2100_SI:		info->i = adsp->core.si.u;				break;
		case CPUINFO_INT_REGISTER + ADSP2100_SE:		info->i = adsp->core.se.u;				break;
		case CPUINFO_INT_REGISTER + ADSP2100_SB:		info->i = adsp->core.sb.u;				break;
		case CPUINFO_INT_REGISTER + ADSP2100_SR0:		info->i = adsp->core.sr.srx.sr0.u;		break;
		case CPUINFO_INT_REGISTER + ADSP2100_SR1:		info->i = adsp->core.sr.srx.sr1.u;		break;

		case CPUINFO_INT_REGISTER + ADSP2100_AX0_SEC:	info->i = adsp->alt.ax0.u;				break;
		case CPUINFO_INT_REGISTER + ADSP2100_AX1_SEC:	info->i = adsp->alt.ax1.u;				break;
		case CPUINFO_INT_REGISTER + ADSP2100_AY0_SEC:	info->i = adsp->alt.ay0.u;				break;
		case CPUINFO_INT_REGISTER + ADSP2100_AY1_SEC:	info->i = adsp->alt.ay1.u;				break;
		case CPUINFO_INT_REGISTER + ADSP2100_AR_SEC:	info->i = adsp->alt.ar.u;				break;
		case CPUINFO_INT_REGISTER + ADSP2100_AF_SEC:	info->i = adsp->alt.af.u;				break;

		case CPUINFO_INT_REGISTER + ADSP2100_MX0_SEC:	info->i = adsp->alt.mx0.u;				break;
		case CPUINFO_INT_REGISTER + ADSP2100_MX1_SEC:	info->i = adsp->alt.mx1.u;				break;
		case CPUINFO_INT_REGISTER + ADSP2100_MY0_SEC:	info->i = adsp->alt.my0.u;				break;
		case CPUINFO_INT_REGISTER + ADSP2100_MY1_SEC:	info->i = adsp->alt.my1.u;				break;
		case CPUINFO_INT_REGISTER + ADSP2100_MR0_SEC:	info->i = adsp->alt.mr.mrx.mr0.u;		break;
		case CPUINFO_INT_REGISTER + ADSP2100_MR1_SEC:	info->i = adsp->alt.mr.mrx.mr1.u;		break;
		case CPUINFO_INT_REGISTER + ADSP2100_MR2_SEC:	info->i = adsp->alt.mr.mrx.mr2.u;		break;
		case CPUINFO_INT_REGISTER + ADSP2100_MF_SEC:	info->i = adsp->alt.mf.u;				break;

		case CPUINFO_INT_REGISTER + ADSP2100_SI_SEC:	info->i = adsp->alt.si.u;				break;
		case CPUINFO_INT_REGISTER + ADSP2100_SE_SEC:	info->i = adsp->alt.se.u;				break;
		case CPUINFO_INT_REGISTER + ADSP2100_SB_SEC:	info->i = adsp->alt.sb.u;				break;
		case CPUINFO_INT_REGISTER + ADSP2100_SR0_SEC:	info->i = adsp->alt.sr.srx.sr0.u;		break;
		case CPUINFO_INT_REGISTER + ADSP2100_SR1_SEC:	info->i = adsp->alt.sr.srx.sr1.u;		break;

		case CPUINFO_INT_REGISTER + ADSP2100_I0:		info->i = adsp->i[0];					break;
		case CPUINFO_INT_REGISTER + ADSP2100_I1:		info->i = adsp->i[1];					break;
		case CPUINFO_INT_REGISTER + ADSP2100_I2:		info->i = adsp->i[2];					break;
		case CPUINFO_INT_REGISTER + ADSP2100_I3:		info->i = adsp->i[3];					break;
		case CPUINFO_INT_REGISTER + ADSP2100_I4:		info->i = adsp->i[4];					break;
		case CPUINFO_INT_REGISTER + ADSP2100_I5:		info->i = adsp->i[5];					break;
		case CPUINFO_INT_REGISTER + ADSP2100_I6:		info->i = adsp->i[6];					break;
		case CPUINFO_INT_REGISTER + ADSP2100_I7:		info->i = adsp->i[7];					break;

		case CPUINFO_INT_REGISTER + ADSP2100_L0:		info->i = adsp->l[0];					break;
		case CPUINFO_INT_REGISTER + ADSP2100_L1:		info->i = adsp->l[1];					break;
		case CPUINFO_INT_REGISTER + ADSP2100_L2:		info->i = adsp->l[2];					break;
		case CPUINFO_INT_REGISTER + ADSP2100_L3:		info->i = adsp->l[3];					break;
		case CPUINFO_INT_REGISTER + ADSP2100_L4:		info->i = adsp->l[4];					break;
		case CPUINFO_INT_REGISTER + ADSP2100_L5:		info->i = adsp->l[5];					break;
		case CPUINFO_INT_REGISTER + ADSP2100_L6:		info->i = adsp->l[6];					break;
		case CPUINFO_INT_REGISTER + ADSP2100_L7:		info->i = adsp->l[7];					break;

		case CPUINFO_INT_REGISTER + ADSP2100_M0:		info->i = adsp->m[0];					break;
		case CPUINFO_INT_REGISTER + ADSP2100_M1:		info->i = adsp->m[1];					break;
		case CPUINFO_INT_REGISTER + ADSP2100_M2:		info->i = adsp->m[2];					break;
		case CPUINFO_INT_REGISTER + ADSP2100_M3:		info->i = adsp->m[3];					break;
		case CPUINFO_INT_REGISTER + ADSP2100_M4:		info->i = adsp->m[4];					break;
		case CPUINFO_INT_REGISTER + ADSP2100_M5:		info->i = adsp->m[5];					break;
		case CPUINFO_INT_REGISTER + ADSP2100_M6:		info->i = adsp->m[6];					break;
		case CPUINFO_INT_REGISTER + ADSP2100_M7:		info->i = adsp->m[7];					break;

		case CPUINFO_INT_REGISTER + ADSP2100_PX:		info->i = adsp->px;						break;
		case CPUINFO_INT_REGISTER + ADSP2100_CNTR:		info->i = adsp->cntr;					break;
		case CPUINFO_INT_REGISTER + ADSP2100_ASTAT:		info->i = adsp->astat;					break;
		case CPUINFO_INT_REGISTER + ADSP2100_SSTAT:		info->i = adsp->sstat;					break;
		case CPUINFO_INT_REGISTER + ADSP2100_MSTAT:		info->i = adsp->mstat;					break;

		case CPUINFO_INT_SP:
		case CPUINFO_INT_REGISTER + ADSP2100_PCSP:		info->i = adsp->pc_sp;					break;
		case CPUINFO_INT_REGISTER + ADSP2100_CNTRSP:	info->i = adsp->cntr_sp;				break;
		case CPUINFO_INT_REGISTER + ADSP2100_STATSP:	info->i = adsp->stat_sp;				break;
		case CPUINFO_INT_REGISTER + ADSP2100_LOOPSP:	info->i = adsp->loop_sp;				break;

		case CPUINFO_INT_REGISTER + ADSP2100_IMASK:		info->i = adsp->imask;					break;
		case CPUINFO_INT_REGISTER + ADSP2100_ICNTL:		info->i = adsp->icntl;					break;
		case CPUINFO_INT_REGISTER + ADSP2100_IRQSTATE0:	info->i = adsp->irq_state[0];			break;
		case CPUINFO_INT_REGISTER + ADSP2100_IRQSTATE1:	info->i = adsp->irq_state[1];			break;
		case CPUINFO_INT_REGISTER + ADSP2100_IRQSTATE2:	info->i = adsp->irq_state[2];			break;
		case CPUINFO_INT_REGISTER + ADSP2100_IRQSTATE3:	info->i = adsp->irq_state[3];			break;

		case CPUINFO_INT_REGISTER + ADSP2100_FLAGIN:	info->i = adsp->flagin;					break;
		case CPUINFO_INT_REGISTER + ADSP2100_FLAGOUT:	info->i = adsp->flagout;				break;
		case CPUINFO_INT_REGISTER + ADSP2100_FL0:		info->i = adsp->fl0;					break;
		case CPUINFO_INT_REGISTER + ADSP2100_FL1:		info->i = adsp->fl1;					break;
		case CPUINFO_INT_REGISTER + ADSP2100_FL2:		info->i = adsp->fl2;					break;

		/* --- the following bits of info are returned as pointers to data or functions --- */
		case CPUINFO_PTR_SET_INFO:						/* set per CPU */						break;
		case CPUINFO_PTR_SET_CONTEXT:					info->setcontext = CPU_SET_CONTEXT_NAME(adsp21xx);break;
		case CPUINFO_PTR_GET_CONTEXT:					info->getcontext = CPU_GET_CONTEXT_NAME(adsp21xx);break;
		case CPUINFO_PTR_INIT:							/* set per CPU */						break;
		case CPUINFO_PTR_RESET:							info->reset = CPU_RESET_NAME(adsp21xx);			break;
		case CPUINFO_PTR_EXIT:							info->exit = CPU_EXIT_NAME(adsp21xx);				break;
		case CPUINFO_PTR_EXECUTE:						info->execute = CPU_EXECUTE_NAME(adsp21xx);		break;
		case CPUINFO_PTR_BURN:							info->burn = NULL;						break;
		case CPUINFO_PTR_DISASSEMBLE:					info->disassemble = CPU_DISASSEMBLE_NAME(adsp21xx);		break;
		case CPUINFO_PTR_INSTRUCTION_COUNTER:			info->icount = &adsp->icount;			break;

		/* --- the following bits of info are returned as NULL-terminated strings --- */
		case CPUINFO_STR_NAME:							/* set per CPU */						break;
		case CPUINFO_STR_CORE_FAMILY:					strcpy(info->s, "ADSP21xx");			break;
		case CPUINFO_STR_CORE_VERSION:					strcpy(info->s, "2.0");					break;
		case CPUINFO_STR_CORE_FILE:						strcpy(info->s, __FILE__);				break;
		case CPUINFO_STR_CORE_CREDITS:					strcpy(info->s, "Copyright Aaron Giles"); break;

		case CPUINFO_STR_FLAGS:
			sprintf(info->s, "%c%c%c%c%c%c%c%c",
				adsp->astat & 0x80 ? 'X':'.',
				adsp->astat & 0x40 ? 'M':'.',
				adsp->astat & 0x20 ? 'Q':'.',
				adsp->astat & 0x10 ? 'S':'.',
				adsp->astat & 0x08 ? 'C':'.',
				adsp->astat & 0x04 ? 'V':'.',
				adsp->astat & 0x02 ? 'N':'.',
				adsp->astat & 0x01 ? 'Z':'.');
			break;

		case CPUINFO_STR_REGISTER + ADSP2100_PC:  		sprintf(info->s, "PC:  %04X", adsp->pc); break;

		case CPUINFO_STR_REGISTER + ADSP2100_AX0:		sprintf(info->s, "AX0: %04X", adsp->core.ax0.u); break;
		case CPUINFO_STR_REGISTER + ADSP2100_AX1:		sprintf(info->s, "AX1: %04X", adsp->core.ax1.u); break;
		case CPUINFO_STR_REGISTER + ADSP2100_AY0:		sprintf(info->s, "AY0: %04X", adsp->core.ay0.u); break;
		case CPUINFO_STR_REGISTER + ADSP2100_AY1:		sprintf(info->s, "AY1: %04X", adsp->core.ay1.u); break;
		case CPUINFO_STR_REGISTER + ADSP2100_AR:		sprintf(info->s, "AR:  %04X", adsp->core.ar.u); break;
		case CPUINFO_STR_REGISTER + ADSP2100_AF:		sprintf(info->s, "AF:  %04X", adsp->core.af.u); break;

		case CPUINFO_STR_REGISTER + ADSP2100_MX0: 		sprintf(info->s, "MX0: %04X", adsp->core.mx0.u); break;
		case CPUINFO_STR_REGISTER + ADSP2100_MX1: 		sprintf(info->s, "MX1: %04X", adsp->core.mx1.u); break;
		case CPUINFO_STR_REGISTER + ADSP2100_MY0: 		sprintf(info->s, "MY0: %04X", adsp->core.my0.u); break;
		case CPUINFO_STR_REGISTER + ADSP2100_MY1: 		sprintf(info->s, "MY1: %04X", adsp->core.my1.u); break;
		case CPUINFO_STR_REGISTER + ADSP2100_MR0: 		sprintf(info->s, "MR0: %04X", adsp->core.mr.mrx.mr0.u); break;
		case CPUINFO_STR_REGISTER + ADSP2100_MR1:		sprintf(info->s, "MR1: %04X", adsp->core.mr.mrx.mr1.u); break;
		case CPUINFO_STR_REGISTER + ADSP2100_MR2: 		sprintf(info->s, "MR2: %02X", adsp->core.mr.mrx.mr2.u & 0x00ff); break;
		case CPUINFO_STR_REGISTER + ADSP2100_MF:		sprintf(info->s, "MF:  %04X", adsp->core.mf.u); break;

		case CPUINFO_STR_REGISTER + ADSP2100_SI:		sprintf(info->s, "SI:  %04X", adsp->core.si.u); break;
		case CPUINFO_STR_REGISTER + ADSP2100_SE:		sprintf(info->s, "SE:  %02X  ", adsp->core.se.u & 0x00ff); break;
		case CPUINFO_STR_REGISTER + ADSP2100_SB:		sprintf(info->s, "SB:  %02X  ", adsp->core.sb.u & 0x001f); break;
		case CPUINFO_STR_REGISTER + ADSP2100_SR0: 		sprintf(info->s, "SR0: %04X", adsp->core.sr.srx.sr0.u); break;
		case CPUINFO_STR_REGISTER + ADSP2100_SR1:		sprintf(info->s, "SR1: %04X", adsp->core.sr.srx.sr1.u); break;

		case CPUINFO_STR_REGISTER + ADSP2100_AX0_SEC:	sprintf(info->s, "AX0_SEC: %04X", adsp->alt.ax0.u); break;
		case CPUINFO_STR_REGISTER + ADSP2100_AX1_SEC:	sprintf(info->s, "AX1_SEC: %04X", adsp->alt.ax1.u); break;
		case CPUINFO_STR_REGISTER + ADSP2100_AY0_SEC:	sprintf(info->s, "AY0_SEC: %04X", adsp->alt.ay0.u); break;
		case CPUINFO_STR_REGISTER + ADSP2100_AY1_SEC:	sprintf(info->s, "AY1_SEC: %04X", adsp->alt.ay1.u); break;
		case CPUINFO_STR_REGISTER + ADSP2100_AR_SEC:	sprintf(info->s, "AR_SEC:  %04X", adsp->alt.ar.u); break;
		case CPUINFO_STR_REGISTER + ADSP2100_AF_SEC:	sprintf(info->s, "AF_SEC:  %04X", adsp->alt.af.u); break;

		case CPUINFO_STR_REGISTER + ADSP2100_MX0_SEC:	sprintf(info->s, "MX0_SEC: %04X", adsp->alt.mx0.u); break;
		case CPUINFO_STR_REGISTER + ADSP2100_MX1_SEC: 	sprintf(info->s, "MX1_SEC: %04X", adsp->alt.mx1.u); break;
		case CPUINFO_STR_REGISTER + ADSP2100_MY0_SEC: 	sprintf(info->s, "MY0_SEC: %04X", adsp->alt.my0.u); break;
		case CPUINFO_STR_REGISTER + ADSP2100_MY1_SEC: 	sprintf(info->s, "MY1_SEC: %04X", adsp->alt.my1.u); break;
		case CPUINFO_STR_REGISTER + ADSP2100_MR0_SEC: 	sprintf(info->s, "MR0_SEC: %04X", adsp->alt.mr.mrx.mr0.u); break;
		case CPUINFO_STR_REGISTER + ADSP2100_MR1_SEC:	sprintf(info->s, "MR1_SEC: %04X", adsp->alt.mr.mrx.mr1.u); break;
		case CPUINFO_STR_REGISTER + ADSP2100_MR2_SEC: 	sprintf(info->s, "MR2_SEC: %02X", adsp->alt.mr.mrx.mr2.u & 0x00ff); break;
		case CPUINFO_STR_REGISTER + ADSP2100_MF_SEC:	sprintf(info->s, "MF_SEC:  %04X", adsp->alt.mf.u); break;

		case CPUINFO_STR_REGISTER + ADSP2100_SI_SEC:	sprintf(info->s, "SI_SEC:  %04X", adsp->alt.si.u); break;
		case CPUINFO_STR_REGISTER + ADSP2100_SE_SEC:	sprintf(info->s, "SE_SEC:  %02X  ", adsp->alt.se.u & 0x00ff); break;
		case CPUINFO_STR_REGISTER + ADSP2100_SB_SEC:	sprintf(info->s, "SB_SEC:  %02X  ", adsp->alt.sb.u & 0x001f); break;
		case CPUINFO_STR_REGISTER + ADSP2100_SR0_SEC: 	sprintf(info->s, "SR0_SEC: %04X", adsp->alt.sr.srx.sr0.u); break;
		case CPUINFO_STR_REGISTER + ADSP2100_SR1_SEC:	sprintf(info->s, "SR1_SEC: %04X", adsp->alt.sr.srx.sr1.u); break;

		case CPUINFO_STR_REGISTER + ADSP2100_I0:		sprintf(info->s, "I0:  %04X", adsp->i[0]); break;
		case CPUINFO_STR_REGISTER + ADSP2100_I1:		sprintf(info->s, "I1:  %04X", adsp->i[1]); break;
		case CPUINFO_STR_REGISTER + ADSP2100_I2:		sprintf(info->s, "I2:  %04X", adsp->i[2]); break;
		case CPUINFO_STR_REGISTER + ADSP2100_I3:		sprintf(info->s, "I3:  %04X", adsp->i[3]); break;
		case CPUINFO_STR_REGISTER + ADSP2100_I4:		sprintf(info->s, "I4:  %04X", adsp->i[4]); break;
		case CPUINFO_STR_REGISTER + ADSP2100_I5:		sprintf(info->s, "I5:  %04X", adsp->i[5]); break;
		case CPUINFO_STR_REGISTER + ADSP2100_I6:		sprintf(info->s, "I6:  %04X", adsp->i[6]); break;
		case CPUINFO_STR_REGISTER + ADSP2100_I7:		sprintf(info->s, "I7:  %04X", adsp->i[7]); break;

		case CPUINFO_STR_REGISTER + ADSP2100_L0:		sprintf(info->s, "L0:  %04X", adsp->l[0]); break;
		case CPUINFO_STR_REGISTER + ADSP2100_L1:		sprintf(info->s, "L1:  %04X", adsp->l[1]); break;
		case CPUINFO_STR_REGISTER + ADSP2100_L2:		sprintf(info->s, "L2:  %04X", adsp->l[2]); break;
		case CPUINFO_STR_REGISTER + ADSP2100_L3:		sprintf(info->s, "L3:  %04X", adsp->l[3]); break;
		case CPUINFO_STR_REGISTER + ADSP2100_L4:		sprintf(info->s, "L4:  %04X", adsp->l[4]); break;
		case CPUINFO_STR_REGISTER + ADSP2100_L5:		sprintf(info->s, "L5:  %04X", adsp->l[5]); break;
		case CPUINFO_STR_REGISTER + ADSP2100_L6:		sprintf(info->s, "L6:  %04X", adsp->l[6]); break;
		case CPUINFO_STR_REGISTER + ADSP2100_L7:		sprintf(info->s, "L7:  %04X", adsp->l[7]); break;

		case CPUINFO_STR_REGISTER + ADSP2100_M0:		sprintf(info->s, "M0:  %04X", adsp->m[0]); break;
		case CPUINFO_STR_REGISTER + ADSP2100_M1:		sprintf(info->s, "M1:  %04X", adsp->m[1]); break;
		case CPUINFO_STR_REGISTER + ADSP2100_M2:		sprintf(info->s, "M2:  %04X", adsp->m[2]); break;
		case CPUINFO_STR_REGISTER + ADSP2100_M3:		sprintf(info->s, "M3:  %04X", adsp->m[3]); break;
		case CPUINFO_STR_REGISTER + ADSP2100_M4:		sprintf(info->s, "M4:  %04X", adsp->m[4]); break;
		case CPUINFO_STR_REGISTER + ADSP2100_M5:		sprintf(info->s, "M5:  %04X", adsp->m[5]); break;
		case CPUINFO_STR_REGISTER + ADSP2100_M6:		sprintf(info->s, "M6:  %04X", adsp->m[6]); break;
		case CPUINFO_STR_REGISTER + ADSP2100_M7:		sprintf(info->s, "M7:  %04X", adsp->m[7]); break;

		case CPUINFO_STR_REGISTER + ADSP2100_PX:		sprintf(info->s, "PX:  %02X  ", adsp->px); break;
		case CPUINFO_STR_REGISTER + ADSP2100_CNTR:		sprintf(info->s, "CNTR:%04X", adsp->cntr); break;
		case CPUINFO_STR_REGISTER + ADSP2100_ASTAT: 	sprintf(info->s, "ASTA:%02X  ", adsp->astat); break;
		case CPUINFO_STR_REGISTER + ADSP2100_SSTAT: 	sprintf(info->s, "SSTA:%02X  ", adsp->sstat); break;
		case CPUINFO_STR_REGISTER + ADSP2100_MSTAT: 	sprintf(info->s, "MSTA:%02X  ", adsp->mstat); break;

		case CPUINFO_STR_REGISTER + ADSP2100_PCSP: 		sprintf(info->s, "PCSP:%02X  ", adsp->pc_sp); break;
		case CPUINFO_STR_REGISTER + ADSP2100_CNTRSP: 	sprintf(info->s, "CTSP:%01X   ", adsp->cntr_sp); break;
		case CPUINFO_STR_REGISTER + ADSP2100_STATSP: 	sprintf(info->s, "STSP:%01X   ", adsp->stat_sp); break;
		case CPUINFO_STR_REGISTER + ADSP2100_LOOPSP: 	sprintf(info->s, "LPSP:%01X   ", adsp->loop_sp); break;

		case CPUINFO_STR_REGISTER + ADSP2100_IMASK: 	sprintf(info->s, "IMSK:%03X  ", adsp->imask); break;
		case CPUINFO_STR_REGISTER + ADSP2100_ICNTL: 	sprintf(info->s, "ICTL:%02X  ", adsp->icntl); break;
		case CPUINFO_STR_REGISTER + ADSP2100_IRQSTATE0:	sprintf(info->s, "IRQ0:%X   ", adsp->irq_state[0]); break;
		case CPUINFO_STR_REGISTER + ADSP2100_IRQSTATE1:	sprintf(info->s, "IRQ1:%X   ", adsp->irq_state[1]); break;
		case CPUINFO_STR_REGISTER + ADSP2100_IRQSTATE2:	sprintf(info->s, "IRQ2:%X   ", adsp->irq_state[2]); break;
		case CPUINFO_STR_REGISTER + ADSP2100_IRQSTATE3:	sprintf(info->s, "IRQ3:%X   ", adsp->irq_state[3]); break;

		case CPUINFO_STR_REGISTER + ADSP2100_FLAGIN: 	sprintf(info->s, "FI:  %X   ", adsp->flagin); break;
		case CPUINFO_STR_REGISTER + ADSP2100_FLAGOUT: 	sprintf(info->s, "FO:  %X   ", adsp->flagout); break;
		case CPUINFO_STR_REGISTER + ADSP2100_FL0: 		sprintf(info->s, "FL0: %X   ", adsp->fl0); break;
		case CPUINFO_STR_REGISTER + ADSP2100_FL1: 		sprintf(info->s, "FL1: %X   ", adsp->fl1); break;
		case CPUINFO_STR_REGISTER + ADSP2100_FL2: 		sprintf(info->s, "FL2: %X   ", adsp->fl2); break;
	}
}

#if (HAS_ADSP2104||HAS_ADSP2105||HAS_ADSP2115||HAS_ADSP2181)
static void adsp21xx_load_boot_data(UINT8 *srcdata, UINT32 *dstdata)
{
	/* see how many words we need to copy */
	int pagelen = (srcdata[(3)] + 1) * 8;
	int i;
	for (i = 0; i < pagelen; i++)
	{
		UINT32 opcode = (srcdata[(i*4+0)] << 16) | (srcdata[(i*4+1)] << 8) | srcdata[(i*4+2)];
		dstdata[i] = opcode;
	}
}
#endif

#if (HAS_ADSP2100)
/**************************************************************************
 * ADSP2100 section
 **************************************************************************/

static CPU_INIT( adsp2100 )
{
	adsp2100_state *adsp = adsp21xx_init(device, index, clock, config, irqcallback);
	adsp->chip_type = CHIP_TYPE_ADSP2100;
	adsp->mstat_mask = 0x0f;
	adsp->imask_mask = 0x0f;
}

static CPU_SET_INFO( adsp2100 )
{
	adsp2100_state *adsp = token;
	switch (state)
	{
		/* --- the following bits of info are set as 64-bit signed integers --- */
		case CPUINFO_INT_INPUT_STATE + ADSP2100_IRQ0:	set_irq_line(adsp, ADSP2100_IRQ0, info->i);	break;
		case CPUINFO_INT_INPUT_STATE + ADSP2100_IRQ1:	set_irq_line(adsp, ADSP2100_IRQ1, info->i);	break;
		case CPUINFO_INT_INPUT_STATE + ADSP2100_IRQ2:	set_irq_line(adsp, ADSP2100_IRQ2, info->i);	break;
		case CPUINFO_INT_INPUT_STATE + ADSP2100_IRQ3:	set_irq_line(adsp, ADSP2100_IRQ3, info->i);	break;

		default:
			CPU_SET_INFO_CALL(adsp21xx);
			break;
	}
}

CPU_GET_INFO( adsp2100 )
{
	adsp2100_state *adsp = token;
	switch (state)
	{
		/* --- the following bits of info are returned as 64-bit signed integers --- */
		case CPUINFO_INT_INPUT_LINES:					info->i = 4;								break;
		case CPUINFO_INT_INPUT_STATE + ADSP2100_IRQ0:	info->i = adsp->irq_state[ADSP2100_IRQ0]; 	break;
		case CPUINFO_INT_INPUT_STATE + ADSP2100_IRQ1:	info->i = adsp->irq_state[ADSP2100_IRQ1]; 	break;
		case CPUINFO_INT_INPUT_STATE + ADSP2100_IRQ2:	info->i = adsp->irq_state[ADSP2100_IRQ2]; 	break;
		case CPUINFO_INT_INPUT_STATE + ADSP2100_IRQ3:	info->i = adsp->irq_state[ADSP2100_IRQ3]; 	break;

		/* --- the following bits of info are returned as pointers to data or functions --- */
		case CPUINFO_PTR_INIT:							info->init = CPU_INIT_NAME(adsp2100);					break;
		case CPUINFO_PTR_SET_INFO:						info->setinfo = CPU_SET_INFO_NAME(adsp2100);			break;
		case CPUINFO_PTR_SET_CONTEXT:					info->setcontext = CPU_SET_CONTEXT_NAME(adsp21xx); 	break;

		/* --- the following bits of info are returned as NULL-terminated strings --- */
		case CPUINFO_STR_NAME:							strcpy(info->s, "ADSP2100");				break;

		default:
			CPU_GET_INFO_CALL(adsp21xx);
			break;
	}
}
#endif


#if (HAS_ADSP2101)
/**************************************************************************
 * ADSP2101 section
 **************************************************************************/

static CPU_INIT( adsp2101 )
{
	adsp2100_state *adsp = adsp21xx_init(device, index, clock, config, irqcallback);
	adsp->chip_type = CHIP_TYPE_ADSP2101;
	adsp->mstat_mask = 0x7f;
	adsp->imask_mask = 0x3f;
}

static CPU_SET_INFO( adsp2101 )
{
	adsp2100_state *adsp = token;
	switch (state)
	{
		/* --- the following bits of info are set as 64-bit signed integers --- */
		case CPUINFO_INT_INPUT_STATE + ADSP2101_IRQ0:	set_irq_line(adsp, ADSP2101_IRQ0, info->i);			break;
		case CPUINFO_INT_INPUT_STATE + ADSP2101_IRQ1:	set_irq_line(adsp, ADSP2101_IRQ1, info->i);			break;
		case CPUINFO_INT_INPUT_STATE + ADSP2101_IRQ2:	set_irq_line(adsp, ADSP2101_IRQ2, info->i);			break;
		case CPUINFO_INT_INPUT_STATE + ADSP2101_SPORT0_RX:set_irq_line(adsp, ADSP2101_SPORT0_RX, info->i); 	break;
		case CPUINFO_INT_INPUT_STATE + ADSP2101_SPORT0_TX:set_irq_line(adsp, ADSP2101_SPORT0_TX, info->i); 	break;
		case CPUINFO_INT_INPUT_STATE + ADSP2101_TIMER:	set_irq_line(adsp, ADSP2101_TIMER, info->i);		break;

		/* --- the following bits of info are set as pointers to data or functions --- */
		case CPUINFO_PTR_ADSP2100_RX_HANDLER:			adsp->sport_rx_callback = (RX_CALLBACK)info->f;		break;
		case CPUINFO_PTR_ADSP2100_TX_HANDLER:			adsp->sport_tx_callback = (TX_CALLBACK)info->f;		break;
		case CPUINFO_PTR_ADSP2100_TIMER_HANDLER:		adsp->timer_fired_func = (ADSP2100_TIMER_CALLBACK)info->f;	break;

		default:
			CPU_SET_INFO_CALL(adsp21xx);
			break;
	}
}

CPU_GET_INFO( adsp2101 )
{
	adsp2100_state *adsp = token;
	switch (state)
	{
		/* --- the following bits of info are returned as 64-bit signed integers --- */
		case CPUINFO_INT_INPUT_LINES:					info->i = 5;									break;
		case CPUINFO_INT_INPUT_STATE + ADSP2101_IRQ0:	info->i = adsp->irq_state[ADSP2101_IRQ0]; 		break;
		case CPUINFO_INT_INPUT_STATE + ADSP2101_IRQ1:	info->i = adsp->irq_state[ADSP2101_IRQ1]; 		break;
		case CPUINFO_INT_INPUT_STATE + ADSP2101_IRQ2:	info->i = adsp->irq_state[ADSP2101_IRQ2]; 		break;
		case CPUINFO_INT_INPUT_STATE + ADSP2101_SPORT0_RX:info->i = adsp->irq_state[ADSP2101_SPORT0_RX];break;
		case CPUINFO_INT_INPUT_STATE + ADSP2101_SPORT0_TX:info->i = adsp->irq_state[ADSP2101_SPORT0_TX];break;
		case CPUINFO_INT_INPUT_STATE + ADSP2101_TIMER:	info->i = adsp->irq_state[ADSP2101_TIMER]; 		break;

		/* --- the following bits of info are returned as pointers to data or functions --- */
		case CPUINFO_PTR_INIT:							info->init = CPU_INIT_NAME(adsp2101);						break;
		case CPUINFO_PTR_SET_INFO:						info->setinfo = CPU_SET_INFO_NAME(adsp2101);				break;

		case CPUINFO_PTR_ADSP2100_RX_HANDLER:			info->f = (genf *)adsp->sport_rx_callback;		break;
		case CPUINFO_PTR_ADSP2100_TX_HANDLER:			info->f = (genf *)adsp->sport_tx_callback;		break;
		case CPUINFO_PTR_ADSP2100_TIMER_HANDLER:		info->f = (genf *)adsp->timer_fired_func;		break;

		/* --- the following bits of info are returned as NULL-terminated strings --- */
		case CPUINFO_STR_NAME:							strcpy(info->s, "ADSP2101");					break;

		default:
			CPU_GET_INFO_CALL(adsp21xx);
			break;
	}
}
#endif


#if (HAS_ADSP2104)
/**************************************************************************
 * ADSP2104 section
 **************************************************************************/

static CPU_INIT( adsp2104 )
{
	adsp2100_state *adsp = adsp21xx_init(device, index, clock, config, irqcallback);
	adsp->chip_type = CHIP_TYPE_ADSP2104;
	adsp->mstat_mask = 0x7f;
	adsp->imask_mask = 0x3f;
}

void adsp2104_load_boot_data(UINT8 *srcdata, UINT32 *dstdata)
{
	adsp21xx_load_boot_data(srcdata, dstdata);
}

static CPU_SET_INFO( adsp2104 )
{
	adsp2100_state *adsp = token;
	switch (state)
	{
		/* --- the following bits of info are set as 64-bit signed integers --- */
		case CPUINFO_INT_INPUT_STATE + ADSP2104_IRQ0:	set_irq_line(adsp, ADSP2104_IRQ0, info->i);			break;
		case CPUINFO_INT_INPUT_STATE + ADSP2104_IRQ1:	set_irq_line(adsp, ADSP2104_IRQ1, info->i);			break;
		case CPUINFO_INT_INPUT_STATE + ADSP2104_IRQ2:	set_irq_line(adsp, ADSP2104_IRQ2, info->i);			break;
		case CPUINFO_INT_INPUT_STATE + ADSP2104_SPORT0_RX:set_irq_line(adsp, ADSP2104_SPORT0_RX, info->i); 	break;
		case CPUINFO_INT_INPUT_STATE + ADSP2104_SPORT0_TX:set_irq_line(adsp, ADSP2104_SPORT0_TX, info->i); 	break;
		case CPUINFO_INT_INPUT_STATE + ADSP2104_TIMER:	set_irq_line(adsp, ADSP2104_TIMER, info->i);		break;

		/* --- the following bits of info are set as pointers to data or functions --- */
		case CPUINFO_PTR_ADSP2100_RX_HANDLER:			adsp->sport_rx_callback = (RX_CALLBACK)info->f;		break;
		case CPUINFO_PTR_ADSP2100_TX_HANDLER:			adsp->sport_tx_callback = (TX_CALLBACK)info->f;		break;
		case CPUINFO_PTR_ADSP2100_TIMER_HANDLER:		adsp->timer_fired_func = (ADSP2100_TIMER_CALLBACK)info->f;	break;

		default:
			CPU_SET_INFO_CALL(adsp21xx);
			break;
	}
}

CPU_GET_INFO( adsp2104 )
{
	adsp2100_state *adsp = token;
	switch (state)
	{
		/* --- the following bits of info are returned as 64-bit signed integers --- */
		case CPUINFO_INT_INPUT_LINES:					info->i = 5;									break;
		case CPUINFO_INT_INPUT_STATE + ADSP2104_IRQ0:	info->i = adsp->irq_state[ADSP2104_IRQ0]; 		break;
		case CPUINFO_INT_INPUT_STATE + ADSP2104_IRQ1:	info->i = adsp->irq_state[ADSP2104_IRQ1]; 		break;
		case CPUINFO_INT_INPUT_STATE + ADSP2104_IRQ2:	info->i = adsp->irq_state[ADSP2104_IRQ2]; 		break;
		case CPUINFO_INT_INPUT_STATE + ADSP2104_SPORT0_RX:info->i = adsp->irq_state[ADSP2104_SPORT0_RX];break;
		case CPUINFO_INT_INPUT_STATE + ADSP2104_SPORT0_TX:info->i = adsp->irq_state[ADSP2104_SPORT0_TX];break;
		case CPUINFO_INT_INPUT_STATE + ADSP2104_TIMER:	info->i = adsp->irq_state[ADSP2104_TIMER]; 		break;

		/* --- the following bits of info are returned as pointers to data or functions --- */
		case CPUINFO_PTR_INIT:							info->init = CPU_INIT_NAME(adsp2104);						break;
		case CPUINFO_PTR_SET_INFO:						info->setinfo = CPU_SET_INFO_NAME(adsp2104);				break;

		case CPUINFO_PTR_ADSP2100_RX_HANDLER:			info->f = (genf *)adsp->sport_rx_callback;		break;
		case CPUINFO_PTR_ADSP2100_TX_HANDLER:			info->f = (genf *)adsp->sport_tx_callback;		break;
		case CPUINFO_PTR_ADSP2100_TIMER_HANDLER:		info->f = (genf *)adsp->timer_fired_func;		break;

		/* --- the following bits of info are returned as NULL-terminated strings --- */
		case CPUINFO_STR_NAME:							strcpy(info->s, "ADSP2104");					break;

		default:
			CPU_GET_INFO_CALL(adsp21xx);
			break;
	}
}
#endif


#if (HAS_ADSP2105)
/**************************************************************************
 * ADSP2105 section
 **************************************************************************/

static CPU_INIT( adsp2105 )
{
	adsp2100_state *adsp = adsp21xx_init(device, index, clock, config, irqcallback);
	adsp->chip_type = CHIP_TYPE_ADSP2105;
	adsp->mstat_mask = 0x7f;
	adsp->imask_mask = 0x3f;
}

void adsp2105_load_boot_data(UINT8 *srcdata, UINT32 *dstdata)
{
	adsp21xx_load_boot_data(srcdata, dstdata);
}

static CPU_SET_INFO( adsp2105 )
{
	adsp2100_state *adsp = token;
	switch (state)
	{
		/* --- the following bits of info are set as 64-bit signed integers --- */
		case CPUINFO_INT_INPUT_STATE + ADSP2105_IRQ0:	set_irq_line(adsp, ADSP2105_IRQ0, info->i);		break;
		case CPUINFO_INT_INPUT_STATE + ADSP2105_IRQ1:	set_irq_line(adsp, ADSP2105_IRQ1, info->i);		break;
		case CPUINFO_INT_INPUT_STATE + ADSP2105_IRQ2:	set_irq_line(adsp, ADSP2105_IRQ2, info->i);		break;

		/* --- the following bits of info are set as pointers to data or functions --- */
		case CPUINFO_PTR_ADSP2100_RX_HANDLER:			adsp->sport_rx_callback = (RX_CALLBACK)info->f;	break;
		case CPUINFO_PTR_ADSP2100_TX_HANDLER:			adsp->sport_tx_callback = (TX_CALLBACK)info->f;	break;
		case CPUINFO_PTR_ADSP2100_TIMER_HANDLER:		adsp->timer_fired_func = (ADSP2100_TIMER_CALLBACK)info->f;	break;

		default:
			CPU_SET_INFO_CALL(adsp21xx);
			break;
	}
}

CPU_GET_INFO( adsp2105 )
{
	adsp2100_state *adsp = token;
	switch (state)
	{
		/* --- the following bits of info are returned as 64-bit signed integers --- */
		case CPUINFO_INT_INPUT_LINES:					info->i = 3;								break;
		case CPUINFO_INT_INPUT_STATE + ADSP2105_IRQ0:	info->i = adsp->irq_state[ADSP2105_IRQ0]; 	break;
		case CPUINFO_INT_INPUT_STATE + ADSP2105_IRQ1:	info->i = adsp->irq_state[ADSP2105_IRQ1]; 	break;
		case CPUINFO_INT_INPUT_STATE + ADSP2105_IRQ2:	info->i = adsp->irq_state[ADSP2105_IRQ2]; 	break;

		/* --- the following bits of info are returned as pointers to data or functions --- */
		case CPUINFO_PTR_INIT:							info->init = CPU_INIT_NAME(adsp2105);					break;
		case CPUINFO_PTR_SET_INFO:						info->setinfo = CPU_SET_INFO_NAME(adsp2105);			break;

		case CPUINFO_PTR_ADSP2100_RX_HANDLER:			info->f = (genf *)adsp->sport_rx_callback;	break;
		case CPUINFO_PTR_ADSP2100_TX_HANDLER:			info->f = (genf *)adsp->sport_tx_callback;	break;
		case CPUINFO_PTR_ADSP2100_TIMER_HANDLER:		info->f = (genf *)adsp->timer_fired_func;	break;

		/* --- the following bits of info are returned as NULL-terminated strings --- */
		case CPUINFO_STR_NAME:							strcpy(info->s, "ADSP2105");				break;

		default:
			CPU_GET_INFO_CALL(adsp21xx);
			break;
	}
}
#endif


#if (HAS_ADSP2115)
/**************************************************************************
 * ADSP2115 section
 **************************************************************************/

static CPU_INIT( adsp2115 )
{
	adsp2100_state *adsp = adsp21xx_init(device, index, clock, config, irqcallback);
	adsp->chip_type = CHIP_TYPE_ADSP2115;
	adsp->mstat_mask = 0x7f;
	adsp->imask_mask = 0x3f;
}

void adsp2115_load_boot_data(UINT8 *srcdata, UINT32 *dstdata)
{
	adsp21xx_load_boot_data(srcdata, dstdata);
}

static CPU_SET_INFO( adsp2115 )
{
	adsp2100_state *adsp = token;
	switch (state)
	{
		/* --- the following bits of info are set as 64-bit signed integers --- */
		case CPUINFO_INT_INPUT_STATE + ADSP2115_IRQ0:	set_irq_line(adsp, ADSP2115_IRQ0, info->i);			break;
		case CPUINFO_INT_INPUT_STATE + ADSP2115_IRQ1:	set_irq_line(adsp, ADSP2115_IRQ1, info->i);			break;
		case CPUINFO_INT_INPUT_STATE + ADSP2115_IRQ2:	set_irq_line(adsp, ADSP2115_IRQ2, info->i);			break;
		case CPUINFO_INT_INPUT_STATE + ADSP2115_SPORT0_RX:set_irq_line(adsp, ADSP2115_SPORT0_RX, info->i); 	break;
		case CPUINFO_INT_INPUT_STATE + ADSP2115_SPORT0_TX:set_irq_line(adsp, ADSP2115_SPORT0_TX, info->i); 	break;
		case CPUINFO_INT_INPUT_STATE + ADSP2115_TIMER:	set_irq_line(adsp, ADSP2115_TIMER, info->i);		break;

		/* --- the following bits of info are set as pointers to data or functions --- */
		case CPUINFO_PTR_ADSP2100_RX_HANDLER:			adsp->sport_rx_callback = (RX_CALLBACK)info->f;		break;
		case CPUINFO_PTR_ADSP2100_TX_HANDLER:			adsp->sport_tx_callback = (TX_CALLBACK)info->f;		break;
		case CPUINFO_PTR_ADSP2100_TIMER_HANDLER:		adsp->timer_fired_func = (ADSP2100_TIMER_CALLBACK)info->f;	break;

		default:
			CPU_SET_INFO_CALL(adsp21xx);
			break;
	}
}

CPU_GET_INFO( adsp2115 )
{
	adsp2100_state *adsp = token;
	switch (state)
	{
		/* --- the following bits of info are returned as 64-bit signed integers --- */
		case CPUINFO_INT_INPUT_LINES:					info->i = 4;									break;
		case CPUINFO_INT_INPUT_STATE + ADSP2115_IRQ0:	info->i = adsp->irq_state[ADSP2115_IRQ0]; 		break;
		case CPUINFO_INT_INPUT_STATE + ADSP2115_IRQ1:	info->i = adsp->irq_state[ADSP2115_IRQ1]; 		break;
		case CPUINFO_INT_INPUT_STATE + ADSP2115_IRQ2:	info->i = adsp->irq_state[ADSP2115_IRQ2]; 		break;
		case CPUINFO_INT_INPUT_STATE + ADSP2115_SPORT0_RX:info->i = adsp->irq_state[ADSP2115_SPORT0_RX];break;
		case CPUINFO_INT_INPUT_STATE + ADSP2115_SPORT0_TX:info->i = adsp->irq_state[ADSP2115_SPORT0_TX];break;
		case CPUINFO_INT_INPUT_STATE + ADSP2115_TIMER:	info->i = adsp->irq_state[ADSP2115_TIMER]; 		break;

		/* --- the following bits of info are returned as pointers to data or functions --- */
		case CPUINFO_PTR_INIT:							info->init = CPU_INIT_NAME(adsp2115);						break;
		case CPUINFO_PTR_SET_INFO:						info->setinfo = CPU_SET_INFO_NAME(adsp2115);				break;

		case CPUINFO_PTR_ADSP2100_RX_HANDLER:			info->f = (genf *)adsp->sport_rx_callback;		break;
		case CPUINFO_PTR_ADSP2100_TX_HANDLER:			info->f = (genf *)adsp->sport_tx_callback;		break;
		case CPUINFO_PTR_ADSP2100_TIMER_HANDLER:		info->f = (genf *)adsp->timer_fired_func;		break;

		/* --- the following bits of info are returned as NULL-terminated strings --- */
		case CPUINFO_STR_NAME:							strcpy(info->s, "ADSP2115");					break;

		default:
			CPU_GET_INFO_CALL(adsp21xx);
			break;
	}
}
#endif


#if (HAS_ADSP2181)
/**************************************************************************
 * ADSP2181 section
 **************************************************************************/

static CPU_INIT( adsp2181 )
{
	adsp2100_state *adsp = adsp21xx_init(device, index, clock, config, irqcallback);
	adsp->chip_type = CHIP_TYPE_ADSP2181;
	adsp->mstat_mask = 0x7f;
	adsp->imask_mask = 0x3ff;
}

void adsp2181_load_boot_data(UINT8 *srcdata, UINT32 *dstdata)
{
	adsp21xx_load_boot_data(srcdata, dstdata);
}

static CPU_SET_INFO( adsp2181 )
{
	adsp2100_state *adsp = token;
	switch (state)
	{
		/* --- the following bits of info are set as 64-bit signed integers --- */
		case CPUINFO_INT_INPUT_STATE + ADSP2181_IRQ0:	set_irq_line(adsp, ADSP2181_IRQ0, info->i);			break;
		case CPUINFO_INT_INPUT_STATE + ADSP2181_IRQ1:	set_irq_line(adsp, ADSP2181_IRQ1, info->i);			break;
		case CPUINFO_INT_INPUT_STATE + ADSP2181_IRQ2:	set_irq_line(adsp, ADSP2181_IRQ2, info->i);			break;
		case CPUINFO_INT_INPUT_STATE + ADSP2181_SPORT0_RX:set_irq_line(adsp, ADSP2181_SPORT0_RX, info->i); 	break;
		case CPUINFO_INT_INPUT_STATE + ADSP2181_SPORT0_TX:set_irq_line(adsp, ADSP2181_SPORT0_TX, info->i); 	break;
		case CPUINFO_INT_INPUT_STATE + ADSP2181_TIMER:	set_irq_line(adsp, ADSP2181_TIMER, info->i);		break;
		case CPUINFO_INT_INPUT_STATE + ADSP2181_IRQE:	set_irq_line(adsp, ADSP2181_IRQE, info->i);			break;
		case CPUINFO_INT_INPUT_STATE + ADSP2181_IRQL1:	set_irq_line(adsp, ADSP2181_IRQL1, info->i);		break;
		case CPUINFO_INT_INPUT_STATE + ADSP2181_IRQL2:	set_irq_line(adsp, ADSP2181_IRQL2, info->i);		break;

		/* --- the following bits of info are set as pointers to data or functions --- */
		case CPUINFO_PTR_ADSP2100_RX_HANDLER:			adsp->sport_rx_callback = (RX_CALLBACK)info->f;		break;
		case CPUINFO_PTR_ADSP2100_TX_HANDLER:			adsp->sport_tx_callback = (TX_CALLBACK)info->f;		break;
		case CPUINFO_PTR_ADSP2100_TIMER_HANDLER:		adsp->timer_fired_func = (ADSP2100_TIMER_CALLBACK)info->f;	break;

		default:
			CPU_SET_INFO_CALL(adsp21xx);
			break;
	}
}

CPU_GET_INFO( adsp2181 )
{
	adsp2100_state *adsp = token;
	switch (state)
	{
		/* --- the following bits of info are returned as 64-bit signed integers --- */
		case CPUINFO_INT_INPUT_LINES:					info->i = 4;									break;
		case CPUINFO_INT_INPUT_STATE + ADSP2181_IRQ0:	info->i = adsp->irq_state[ADSP2181_IRQ0]; 		break;
		case CPUINFO_INT_INPUT_STATE + ADSP2181_IRQ1:	info->i = adsp->irq_state[ADSP2181_IRQ1]; 		break;
		case CPUINFO_INT_INPUT_STATE + ADSP2181_IRQ2:	info->i = adsp->irq_state[ADSP2181_IRQ2]; 		break;
		case CPUINFO_INT_INPUT_STATE + ADSP2181_SPORT0_RX:info->i = adsp->irq_state[ADSP2181_SPORT0_RX];break;
		case CPUINFO_INT_INPUT_STATE + ADSP2181_SPORT0_TX:info->i = adsp->irq_state[ADSP2181_SPORT0_TX];break;
		case CPUINFO_INT_INPUT_STATE + ADSP2181_TIMER:	info->i = adsp->irq_state[ADSP2181_TIMER]; 		break;
		case CPUINFO_INT_INPUT_STATE + ADSP2181_IRQE:	info->i = adsp->irq_state[ADSP2181_IRQE]; 		break;
		case CPUINFO_INT_INPUT_STATE + ADSP2181_IRQL1:	info->i = adsp->irq_state[ADSP2181_IRQL1]; 		break;
		case CPUINFO_INT_INPUT_STATE + ADSP2181_IRQL2:	info->i = adsp->irq_state[ADSP2181_IRQL2]; 		break;

		case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:		info->i = 16;							break;
		case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO: 		info->i = 11;							break;
		case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO: 		info->i = -1;							break;

		/* --- the following bits of info are returned as pointers to data or functions --- */
		case CPUINFO_PTR_INIT:							info->init = CPU_INIT_NAME(adsp2181);						break;
		case CPUINFO_PTR_SET_INFO:						info->setinfo = CPU_SET_INFO_NAME(adsp2181);				break;

		case CPUINFO_PTR_ADSP2100_RX_HANDLER:			info->f = (genf *)adsp->sport_rx_callback; 		break;
		case CPUINFO_PTR_ADSP2100_TX_HANDLER:			info->f = (genf *)adsp->sport_tx_callback; 		break;
		case CPUINFO_PTR_ADSP2100_TIMER_HANDLER:		info->f = (genf *)adsp->timer_fired_func; 		break;

		/* --- the following bits of info are returned as NULL-terminated strings --- */
		case CPUINFO_STR_NAME:							strcpy(info->s, "ADSP2181");					break;

		default:
			CPU_GET_INFO_CALL(adsp21xx);
			break;
	}
}

void adsp2181_idma_addr_w(UINT16 data)
{
	adsp2100_state *adsp = token;
	adsp->idma_addr = data;
	adsp->idma_offs = 0;
}

UINT16 adsp2181_idma_addr_r(void)
{
	adsp2100_state *adsp = token;
	return adsp->idma_addr;
}

void adsp2181_idma_data_w(UINT16 data)
{
	adsp2100_state *adsp = token;

	/* program memory? */
	if (!(adsp->idma_addr & 0x4000))
	{
		/* upper 16 bits */
		if (adsp->idma_offs == 0)
		{
			adsp->idma_cache = data;
			adsp->idma_offs = 1;
		}

		/* lower 8 bits */
		else
		{
			WWORD_PGM(adsp->idma_addr++ & 0x3fff, (adsp->idma_cache << 8) | (data & 0xff));
			adsp->idma_offs = 0;
		}
	}

	/* data memory */
	else
		WWORD_DATA(adsp->idma_addr++ & 0x3fff, data);
}

UINT16 adsp2181_idma_data_r(void)
{
	adsp2100_state *adsp = token;
	UINT16 result = 0xffff;

	/* program memory? */
	if (!(adsp->idma_addr & 0x4000))
	{
		/* upper 16 bits */
		if (adsp->idma_offs == 0)
		{
			result = RWORD_PGM(adsp->idma_addr & 0x3fff) >> 8;
			adsp->idma_offs = 1;
		}

		/* lower 8 bits */
		else
		{
			result = RWORD_PGM(adsp->idma_addr++ & 0x3fff) & 0xff;
			adsp->idma_offs = 0;
		}
	}

	/* data memory */
	else
		result = RWORD_DATA(adsp->idma_addr++ & 0x3fff);

	return result;
}

#endif