Previous 15994 Revisions Next

r14824 Friday 30th March, 2012 at 08:08:44 UTC by Miodrag Milanović
Sync with MAME r15821 (no whatsnew)
[src/emu/cpu]cpu.mak
[src/emu/cpu/m68000]68307bus.c* 68307bus.h* 68307ser.c* 68307ser.h* 68307sim.c* 68307sim.h* 68307tmu.c* 68307tmu.h* 68340dma.c* 68340dma.h* 68340ser.c* 68340ser.h* 68340sim.c* 68340sim.h* 68340tmu.c* 68340tmu.h* m68000.h m68kcpu.c m68kcpu.h
[src/emu/video]pc_vga.c pc_vga.h
[src/lib/libjpeg]jpeglib.h
[src/lib/util]flac.h
[src/mame]mame.lst mame.mak
[src/mame/drivers]gamtor.c gundealr.c ksys573.c model2.c quizshow.c*
[src/mame/layout]quizshow.lay*
[src/mame/machine]r2crypt.c seibuspi.c seibuspi.h
[src/osd/sdl/man]chdman.1

src/mame/mame.lst
r14823r14824
62176217mf_bdash      // (c) 1984 Exidy / First Star Software
62186218
62196219// Atari b/w games
6220quizshow      // 005464           1976/04 [2650]
62206221tank8         // ??????           1976/04 [6800]
62216222tank8a         // ??????           1976/04 [6800]
62226223tank8b         // ??????           1976/04 [6800]
src/mame/machine/seibuspi.c
r14823r14824
5353   return res;
5454}
5555
56static UINT32 partial_carry_sum32(UINT32 add1,UINT32 add2,UINT32 carry_mask)
56UINT32 partial_carry_sum32(UINT32 add1,UINT32 add2,UINT32 carry_mask)
5757{
5858   return partial_carry_sum(add1,add2,carry_mask,32);
5959}
src/mame/machine/seibuspi.h
r14823r14824
1UINT32 partial_carry_sum32(UINT32 add1,UINT32 add2,UINT32 carry_mask);
2
13void seibuspi_text_decrypt(UINT8 *rom);
24void seibuspi_bg_decrypt(UINT8 *rom, int size);
35
src/mame/machine/r2crypt.c
r14823r14824
22
33#include "emu.h"
44#include "includes/raiden2.h"
5#include "seibuspi.h"
56
67/* INIT */
78
r14823r14824
119120  i1 = idx & 0xff;
120121  i2 = (i >> 8) & 0xff;
121122
122  x = 0x4c435012;
123  x = 0;
123124
124125  if(bt(xmap_low_01, i1))
125126    x ^= 0x00401000;
r14823r14824
130131  if(bt(xmap_low_23, i1))
131132    x ^= 0x00102000;
132133  if(bt(xmap_low_31, i1))
133    x ^= 0x00008000;
134    x ^= 0x00018000;
134135  if(bt(xmap_high_00, i2))
135    x ^= 0x0c000400;
136    x ^= 0x04000400;
136137  if(bt(xmap_high_02, i2))
137138    x ^= 0x00200020;
138139  if(bt(xmap_high_03, i2))
r14823r14824
159160  if(i & 0x020000)
160161    x ^= 0x00aa00f0;
161162  if(i & 0x040000)
162    x ^= 0x5d000f00;
163    x ^= 0x55000f00;
163164  if(i & 0x080000)
164    x ^= 0x0054f000;
165    x ^= 0x0055f000;
165166
166167  return x;
167168}
168169
169static UINT32 trans(UINT32 v, UINT32 x)
170{
171  unsigned y,r2,v2;
172
173  v2 = (BIT(v,30)<<8)|(BIT(v,22)<<12)|(BIT(v,18)<<18)|(BIT(v,19)<<19)|(BIT(v,22)<<22)|(BIT(v,24)<<24)|(BIT(v,3)<<25)|(BIT(v,26)<<26)|(BIT(v,28)<<28);
174  v2 ^= 0x01000000;
175
176  r2 = 0;
177  y = 0;
178
179  y |= ((                              0 ^ BIT(x, 0) ^ BIT(v, 0))<< 0);
180  y |= ((                              0 ^ BIT(x, 1) ^ BIT(v, 1))<< 1);
181  y |= ((                              0 ^ BIT(x, 2) ^ BIT(v, 2))<< 2);
182  y |= ((                              0 ^ BIT(x, 3) ^ BIT(v, 3))<< 3);
183  y |= ((                              0 ^ BIT(x, 4) ^ BIT(v, 4))<< 4);
184  y |= ((                              0 ^ BIT(x, 5) ^ BIT(v, 5))<< 5);
185  y |= ((                              0 ^ BIT(x, 6) ^ BIT(v, 6))<< 6);
186  y |= ((                              0 ^ BIT(x, 7) ^ BIT(v, 7))<< 7);
187  y |= ((                              0 ^ BIT(x, 8) ^ BIT(v, 8))<< 8);
188  y |= ((                              0 ^ BIT(x, 9) ^ BIT(v, 9))<< 9);
189  y |= ((                              0 ^ BIT(x,10) ^ BIT(v,10))<<10);
190  y |= ((                              0 ^ BIT(x,11) ^ BIT(v,11))<<11);
191  y |= ((                              0 ^ BIT(x,12) ^ BIT(v,12))<<12);
192  y |= ((                              0 ^ BIT(x,13) ^ BIT(v,13))<<13);
193  y |= ((                              0 ^ BIT(x,14) ^ BIT(v,14))<<14);
194  y |= ((                              0 ^ BIT(x,15) ^ BIT(v,15))<<15);
195  y |= ((                              0 ^ BIT(x,16) ^ BIT(v,16))<<16);
196  y |= ((                              0 ^ BIT(x,17) ^ BIT(v,17))<<17);
197  y |= ((                              0 ^ BIT(x,18) ^ BIT(v,18))<<18);
198  y |= ((                              1 ^ BIT(x,19) ^ BIT(v,19))<<19);
199  y |= ((                      BIT(x,19) ^ BIT(x,20) ^ BIT(v,20))<<20);
200  y |= ((                              0 ^ BIT(x,21) ^ BIT(v,21))<<21);
201  y |= ((                              0 ^ BIT(x,22) ^ BIT(v,22))<<22);
202  y |= ((                              0 ^ BIT(x,23) ^ BIT(v,23))<<23);
203  y |= ((                              1 ^ BIT(x,24) ^ BIT(v,24))<<24);
204  y |= ((                      BIT(x,24) ^ BIT(x,25) ^ BIT(v,25))<<25);
205  y |= ((          (BIT(x,24)&BIT(x,25)) ^ BIT(x,26) ^ BIT(v,26))<<26);
206  y |= (((BIT(x,24)&BIT(x,25)&BIT(x,26)) ^ BIT(x,27) ^ BIT(v,27))<<27);
207  y |= ((                              0 ^ BIT(x,28) ^ BIT(v,28))<<28);
208  y |= ((                              0 ^ BIT(x,29) ^ BIT(v,29))<<29);
209  y |= ((                              0 ^ BIT(x,30) ^ BIT(v,30))<<30);
210  y |= ((                              0 ^ BIT(x,31) ^ BIT(v,31))<<31);
211
212
213  r2 |= (                     0<< 0);
214  r2 |= (                     0<< 1);
215  r2 |= (                     0<< 2);
216  r2 |= (                     0<< 3);
217  r2 |= (                     0<< 4);
218  r2 |= (                     0<< 5);
219  r2 |= (                     0<< 6);
220  r2 |= (                     0<< 7);
221  r2 |= (                     0<< 8);
222  r2 |= ((BIT(v2, 8)&BIT(y, 8))<< 9);
223  r2 |= (                     0<<10);
224  r2 |= (                     0<<11);
225  r2 |= (                     0<<12);
226  r2 |= ((BIT(v2,12)&BIT(y,12))<<13);
227  r2 |= (                     0<<14);
228  r2 |= (                     0<<15);
229  r2 |= (                     0<<16);
230  r2 |= (                     0<<17);
231  r2 |= (                     0<<18);
232  r2 |= ((BIT(v2,18)&BIT(y,18))<<19);
233  r2 |= ((BIT(v2,19)&BIT(y,19))<<20);
234  r2 |= (                     0<<21);
235  r2 |= (                     0<<22);
236  r2 |= ((BIT(v2,22)&BIT(y,22))<<23);
237  r2 |= (                     0<<24);
238  r2 |= ((BIT(v2,24)&BIT(y,24))<<25);
239  r2 |= ((BIT(v2,25)&BIT(y,25))<<26);
240  r2 |= ((BIT(v2,26)&BIT(y,26))<<27);
241  r2 |= (                     0<<28);
242  r2 |= ((BIT(v2,28)&BIT(y,28))<<29);
243  r2 |= (                     0<<30);
244  r2 |= (                     0<<31);
245
246  r2 ^= y;
247  r2 ^= 0x0c500000;
248
249  return r2;
250}
251
252170void raiden2_decrypt_sprites(running_machine &machine)
253171{
254172  int i;
255173  UINT32 *data = (UINT32 *)machine.region("gfx3")->base();
256174  for(i=0; i<0x800000/4; i++) {
257    UINT32 x1, v1, y1;
175    UINT32 x1, v1;
258176
259    int idx = i & 0xff;
260    //int i2;
261    //int idx2;
262
263    //idx2 = ((i>>7) & 0x3ff) | ((i>>8) & 0x400);
264    if(i & 0x008000)
265      idx ^= 1;
266    if(i & 0x100000)
267      idx ^= 256;
268
269    //i2 = i >> 8;
270
271177    v1 = sw(yrot(data[i], gr(i)));
272178
273179    x1 = gm(i);
274180
275    y1 = ~trans(v1, x1);
276
277    data[i] = y1;
181    data[i] = partial_carry_sum32(v1, x1 ^ 0xbfbc2fed, 0x176c91a8) ^ 0x0f488000;
278182  }
279183}
280184
src/mame/mame.mak
r14823r14824
456456   $(DRIVERS)/orbit.o $(AUDIO)/orbit.o $(VIDEO)/orbit.o \
457457   $(DRIVERS)/poolshrk.o $(AUDIO)/poolshrk.o $(VIDEO)/poolshrk.o \
458458   $(DRIVERS)/quantum.o \
459   $(DRIVERS)/quizshow.o \
459460   $(DRIVERS)/rampart.o $(VIDEO)/rampart.o \
460461   $(DRIVERS)/relief.o $(VIDEO)/relief.o \
461462   $(DRIVERS)/runaway.o $(VIDEO)/runaway.o \
r14823r14824
20782079
20792080$(DRIVERS)/qix.o:   $(LAYOUT)/elecyoyo.lh
20802081
2082$(DRIVERS)/quizshow.o:   $(LAYOUT)/quizshow.lh
2083
20812084$(DRIVERS)/re900.o:   $(LAYOUT)/re900.lh
20822085
20832086$(DRIVERS)/roul.o:   $(LAYOUT)/roul.lh
src/mame/layout/quizshow.lay
r0r14824
1<?xml version="1.0"?>
2<mamelayout version="2">
3   <element name="overlay">
4      <rect>
5         <bounds left="0" top="0" right="256" bottom="240" />
6         <color red="1" green="1" blue="1" />
7      </rect>
8      <rect>
9         <bounds left="0" top="28" right="256" bottom="60" />
10         <color red="1" green="0.2" blue="0.125" />
11      </rect>
12      <rect>
13         <bounds left="0" top="60" right="256" bottom="108" />
14         <color red="0.125" green="1" blue="0.33" />
15      </rect>
16      <rect>
17         <bounds left="0" top="108" right="256" bottom="140" />
18         <color red="1" green="0.66" blue="0.125" />
19      </rect>
20      <rect>
21         <bounds left="0" top="140" right="256" bottom="172" />
22         <color red="0.125" green="0.66" blue="1" />
23      </rect>
24      <rect>
25         <bounds left="0" top="172" right="256" bottom="204" />
26         <color red="0.66" green="0.125" blue="1" />
27      </rect>
28      <rect>
29         <bounds left="0" top="204" right="256" bottom="240" />
30         <color red="1" green="1" blue="0.33" />
31      </rect>
32   </element>
33
34   <view name="Color Overlay">
35      <screen index="0">
36         <bounds left="0" top="0" right="4" bottom="3" />
37      </screen>
38      <overlay name="overlay" element="overlay">
39         <bounds left="0" top="0" right="4" bottom="3" />
40      </overlay>
41   </view>
42</mamelayout>
src/mame/drivers/model2.c
r14823r14824
40354035   ROM_LOAD("mpr-18029.32", 0x0000000, 0x200000, CRC(f6804150) SHA1(ef40c11008c75d04159772ad30f02cdb8c5464f3) )
40364036   ROM_LOAD("mpr-18030.34", 0x0400000, 0x200000, CRC(1167615d) SHA1(bae0060aec3c15f08342f11df665c05c5703523d) )
40374037
4038   /* the Drive I/O clearly has a CPU on it (see above) */
4039   ROM_REGION( 0x1000, "iocpu", 0 )
4040   ROM_LOAD("epr-17895", 0x0000, 0x1000, NO_DUMP ) /* Z80 code, unknown rom size */
4038   /* Z80 code located on the I/O board type 837-11694. Z80 @ 4Mhz with 8-way DSW & unknown SONY CXD10950 QFP64 chip */
4039   ROM_REGION( 0x8000, "iocpu", 0 )
4040   ROM_LOAD("epr-17895.ic8", 0x0000, 0x8000, CRC(8fd7003d) SHA1(b8b16e20e3ed07326330ba335ea1e701cc0bec17) )
40414041ROM_END
40424042
40434043
src/mame/drivers/gundealr.c
r14823r14824
588588
589589
590590GAME( 1990, gundealr,  0,        gundealr, gundealr, 0, ROT270, "Dooyong", "Gun Dealer",                GAME_SUPPORTS_SAVE )
591GAME( 19??, gundealra, gundealr, gundealr, gundealr, 0, ROT270, "Dooyong", "Gun Dealer (alt card set)", GAME_SUPPORTS_SAVE )
592GAME( 1990, gundealrt, gundealr, gundealr, gundealt, 0, ROT270, "Dooyong (Tecmo license)", "Gun Dealer (Korea)", GAME_SUPPORTS_SAVE )
591GAME( 1990, gundealra, gundealr, gundealr, gundealr, 0, ROT270, "Dooyong", "Gun Dealer (alt card set)", GAME_SUPPORTS_SAVE )
592GAME( 1990, gundealrt, gundealr, gundealr, gundealt, 0, ROT270, "Dooyong (Tecmo license)", "Gun Dealer (Japan)", GAME_SUPPORTS_SAVE )
593593GAME( 1990, yamyam,    0,        yamyam,   yamyam,   0, ROT0,   "Dooyong", "Yam! Yam!?",                GAME_SUPPORTS_SAVE )
594594GAME( 1990, wiseguy,   yamyam,   yamyam,   yamyam,   0, ROT0,   "Dooyong", "Wise Guy",                  GAME_SUPPORTS_SAVE )
src/mame/drivers/gamtor.c
r14823r14824
2626
2727#include "emu.h"
2828#include "cpu/m68000/m68000.h"
29#include "video/ramdac.h"
29#include "video/pc_vga.h"
3030
3131class gaminator_state : public driver_device
3232{
3333public:
3434   gaminator_state(const machine_config &mconfig, device_type type, const char *tag)
3535      : driver_device(mconfig, type, tag) { }
36
37   UINT32* m_vram;
38   UINT32* m_tmapram1;
39   UINT32* m_tmapram2;
40
41   struct { int r,g,b,offs,offs_internal; } m_pal;
4236};
4337
4438static WRITE32_HANDLER( gamtor_unk_w )
r14823r14824
4640
4741}
4842
49static READ32_HANDLER( gamtor_unk2_r )
50{
51   return space->machine().rand();
52}
5343
5444
55
56static WRITE32_HANDLER( gamtor_unk2_w )
57{
58
59}
60
61static WRITE32_HANDLER( gamtor_unk3_w )
62{
63
64}
65
66static READ32_HANDLER( gamtor_unk4_r )
67{
68   return space->machine().rand();
69}
70
71static WRITE32_HANDLER( gamtor_unk4_w )
72{
73
74}
75
76static WRITE32_HANDLER( gamtor_unk6_w )
77{
78
79}
80
81static READ32_HANDLER( gamtor_unk7_r )
82{
83   return space->machine().rand();
84}
85
86#define GAMTOR_NUM_TILES 0x4000000 / 8
87
88static const gfx_layout gamtor_layout =
89{
90   8,8,
91   GAMTOR_NUM_TILES,
92   1,
93   { 0 },
94   { 0,1,2,3,4,5,6,7 },
95   {  3*8, 2*8, 1*8, 0*8,  7*8, 6*8, 5*8, 4*8 },
96   8*8
97};
98
99static WRITE32_HANDLER( gaminator_vram_w )
100{
101   gaminator_state *state = space->machine().driver_data<gaminator_state>();
102
103   COMBINE_DATA(state->m_vram + offset);
104   gfx_element_mark_dirty(space->machine().gfx[0], offset/8);
105
106}
107
108VIDEO_START( gamtor )
109{
110   gaminator_state *state = machine.driver_data<gaminator_state>();
111
112   /* create the char set (gfx will then be updated dynamically from RAM) */
113   machine.gfx[0] = gfx_element_alloc(machine, &gamtor_layout, (UINT8 *)state->m_vram, 1, 0);
114
115}
116
117SCREEN_UPDATE_IND16(gamtor)
118{
119   gaminator_state *state = screen.machine().driver_data<gaminator_state>();
120
121   int tile_base = 0x00000;
122
123   // where does the base address come from?
124   if (!strcmp(screen.machine().system().name,"g4u5"))   tile_base = 0x31BE4 - 2;
125   if (!strcmp(screen.machine().system().name,"llcharm"))   tile_base = 0x2f58d - 2;
126
127
128
129   const gfx_element *gfx = screen.machine().gfx[0];
130   int count = 0;
131   for (int y=0;y<32;y++)
132   {
133      for (int x=0;x<80;x++)
134      {
135         UINT32 chr = state->m_tmapram1[count];
136
137
138         int tile = ((chr>>24)&0xff)*2;
139         tile += tile_base;
140
141         drawgfx_opaque(bitmap,cliprect,gfx,tile,0,0,0,x*8,y*16);
142         drawgfx_opaque(bitmap,cliprect,gfx,tile+1,0,0,0,x*8,(y*16)+8);
143
144         count++;
145      }
146
147   }
148
149   return 0;
150}
151
152
153
154
155
15645static ADDRESS_MAP_START( gaminator_map, AS_PROGRAM, 32 )
15746   AM_RANGE(0x00000000, 0x07ffffff) AM_ROM
158   AM_RANGE(0x08000000, 0x0bffffff) AM_RAM_WRITE(gaminator_vram_w) AM_BASE_MEMBER(gaminator_state, m_vram) // 0x083ea460 = some data
47   AM_RANGE(0x08000000, 0x0bffffff) AM_RAM
15948   AM_RANGE(0x1e040008, 0x1e04000b) AM_WRITE( gamtor_unk_w )
16049
16150   AM_RANGE(0x20000000, 0x2003ffff) AM_RAM
16251
163   /* These are definitely VGA/SVGA ports, for example 0x3d4-0x3d5 = CRTC */
164   AM_RANGE(0x400003c0, 0x400003c3) AM_WRITE( gamtor_unk3_w )
165   AM_RANGE(0x400003c4, 0x400003c7) AM_READWRITE( gamtor_unk4_r, gamtor_unk4_w )
166   AM_RANGE(0x400003c8, 0x400003cb) AM_DEVWRITE8_MODERN("ramdac", ramdac_device, index_w, 0x000000ff)
167   AM_RANGE(0x400003c8, 0x400003cb) AM_DEVWRITE8_MODERN("ramdac", ramdac_device, pal_w,   0x0000ff00)
168//  AM_RANGE(0x400003c8, 0x400003cb) AM_DEVWRITE8_MODERN("ramdac", ramdac_device, mask_w,  0x00ff0000)
169   AM_RANGE(0x400003cc, 0x400003cf) AM_WRITE( gamtor_unk6_w )
170   AM_RANGE(0x400003d4, 0x400003d7) AM_READWRITE( gamtor_unk2_r, gamtor_unk2_w )
171   AM_RANGE(0x400003d8, 0x400003fb) AM_READ( gamtor_unk7_r )
52   /* standard VGA */
53//  AM_RANGE(0x40000000, 0x40000fff) AM_RAM // regs
54   AM_RANGE(0x44000000, 0x4401ffff) AM_RAM // VRAM
55//   AM_RANGE(0x44000000, 0x44007fff) AM_RAM AM_BASE_MEMBER(gaminator_state, m_tmapram1) // puts strings here, looks almost like a tilemap, but where are the tiles?
56//   AM_RANGE(0x440a0000, 0x440a1fff) AM_RAM AM_BASE_MEMBER(gaminator_state, m_tmapram2) // beetlem (like above, mirror?)
17257
173   AM_RANGE(0x44000000, 0x44007fff) AM_RAM AM_BASE_MEMBER(gaminator_state, m_tmapram1) // puts strings here, looks almost like a tilemap, but where are the tiles?
174   AM_RANGE(0x440a0000, 0x440a1fff) AM_RAM AM_BASE_MEMBER(gaminator_state, m_tmapram2) // beetlem (like above, mirror?)
175
17658   AM_RANGE(0xe0000000, 0xe00001ff) AM_RAM // nvram?
17759
17860   AM_RANGE(0xf0000000, 0xf00001ff) AM_RAM // coldfire peripherals?
r14823r14824
18365
18466
18567
186static ADDRESS_MAP_START( ramdac_map, AS_0, 8 )
187   AM_RANGE(0x000, 0x3ff) AM_DEVREADWRITE_MODERN("ramdac",ramdac_device,ramdac_pal_r,ramdac_rgb666_w)
188ADDRESS_MAP_END
189
190static RAMDAC_INTERFACE( ramdac_intf )
191{
192   0
193};
194
19568static MACHINE_CONFIG_START( gaminator, gaminator_state )
19669   MCFG_CPU_ADD("maincpu", MCF5206E, 40000000) /* definitely Coldfire, model / clock uncertain */
19770   MCFG_CPU_PROGRAM_MAP(gaminator_map)
19871   MCFG_CPU_VBLANK_INT("screen", irq6_line_hold) // irq6 seems to be needed to get past the ROM checking
19972
73   MCFG_FRAGMENT_ADD( pcvideo_vga )
20074
201   MCFG_SCREEN_ADD("screen", RASTER)
202   MCFG_SCREEN_REFRESH_RATE(60)
203   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
204   MCFG_SCREEN_SIZE(64*8, 32*8)
205   MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 0*8, 32*8-1)
206   MCFG_SCREEN_UPDATE_STATIC(gamtor)
207
208   MCFG_PALETTE_LENGTH(0x100)
209
210   MCFG_RAMDAC_ADD("ramdac", ramdac_intf, ramdac_map)
211
212
213   MCFG_VIDEO_START(gamtor)
214
21575   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
21676   /* unknown sound */
21777MACHINE_CONFIG_END
r14823r14824
13861246   ROM_LOAD( "llc_92_5.6-0", 0x0000, 0x2000000, CRC(c8c2a5d3) SHA1(ec23eff63871cc515ec58a894446d4d639d864e4) )
13871247ROM_END
13881248
1249static READ8_HANDLER( vga_setting ) { return 0xff; } // hard-code to color
13891250
13901251
13911252DRIVER_INIT( gaminator )
13921253{
1393
1254   pc_vga_init(machine, vga_setting, NULL);
1255   pc_vga_gamtor_io_init(machine, machine.device("maincpu")->memory().space(AS_PROGRAM), 0x44000000, machine.device("maincpu")->memory().space(AS_PROGRAM), 0x40000000);
13941256}
13951257
13961258
src/mame/drivers/quizshow.c
r0r14824
1/***************************************************************************
2
3  Atari Quiz Show
4  released under their Kee Games label, 04/1976
5
6  S2650 CPU, 512 bytes RAM, B&W tilemapped video. It uses a tape player to
7  stream questions, totaling 1000, divided into 4 categories.
8
9TODO:
10- preserve tape and hook it up, the game is not playable without it
11- discrete sound (should be simple to those that know how)
12- is timing accurate?
13- correct gfx roms
14- fix color inverted tiles (8*12 instead of 8*8!)
15
16***************************************************************************/
17
18#include "emu.h"
19#include "cpu/s2650/s2650.h"
20
21#include "quizshow.lh"
22
23
24#define MASTER_CLOCK   XTAL_12_096MHz
25#define PIXEL_CLOCK      (MASTER_CLOCK/2)
26
27#define HTOTAL         ((32+8+4+1) * 8)
28#define HBEND         (0)
29#define HBSTART         (256)
30
31#define VTOTAL         (256+8+4)
32#define VBEND         (0)
33#define VBSTART         (240)
34
35
36class quizshow_state : public driver_device
37{
38public:
39   quizshow_state(const machine_config &mconfig, device_type type, const char *tag)
40      : driver_device(mconfig, type, tag) { }
41   
42   tilemap_t *m_tilemap;
43   UINT8* m_fo_state;
44   UINT8* m_main_ram;
45   UINT32 m_clocks;
46   int m_blink_state;
47   int m_category_enable;
48   int m_tape_head_pos;
49};
50
51
52/***************************************************************************
53
54  Video
55
56***************************************************************************/
57
58PALETTE_INIT( quizshow )
59{
60   machine.colortable = colortable_alloc(machine, 2);
61
62   colortable_palette_set_color(machine.colortable, 0, RGB_BLACK);
63   colortable_palette_set_color(machine.colortable, 1, RGB_WHITE);
64
65   // normal, blink/off, invert, blink+invert
66   colortable_entry_set_value(machine.colortable, 0, 0);
67   colortable_entry_set_value(machine.colortable, 1, 1);
68   colortable_entry_set_value(machine.colortable, 2, 0);
69   colortable_entry_set_value(machine.colortable, 3, 0);
70   colortable_entry_set_value(machine.colortable, 4, 1);
71   colortable_entry_set_value(machine.colortable, 5, 0);
72   colortable_entry_set_value(machine.colortable, 6, 1);
73   colortable_entry_set_value(machine.colortable, 7, 1);
74}
75
76static TILE_GET_INFO( get_tile_info )
77{
78   quizshow_state *state = machine.driver_data<quizshow_state>();
79   UINT8 code = state->m_main_ram[(tile_index >> 1 & 0x1e0) | (tile_index & 0x1f)];
80
81   // d6: blink, d7: invert
82   UINT8 color = (code & (state->m_blink_state | 0x80)) >> 6;
83
84   // video is idle on uneven rows
85   if (tile_index & 0x20)
86      color = 1;
87
88   SET_TILE_INFO(0, code & 0x3f, color, 0);
89}
90
91VIDEO_START( quizshow )
92{
93   quizshow_state *state = machine.driver_data<quizshow_state>();
94   state->m_tilemap = tilemap_create(machine, get_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
95}
96
97SCREEN_UPDATE_IND16( quizshow )
98{
99   quizshow_state *state = screen.machine().driver_data<quizshow_state>();
100   state->m_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
101   return 0;
102}
103
104
105/***************************************************************************
106
107  I/O
108
109***************************************************************************/
110
111static WRITE8_HANDLER(quizshow_lamps1_w)
112{
113   // d0-d3: P1 answer button lamps
114   for (int i = 0; i < 4; i++)
115      output_set_lamp_value(i, data >> i & 1);
116
117   // d4-d7: N/C
118}
119
120static WRITE8_HANDLER(quizshow_lamps2_w)
121{
122   // d0-d3: P2 answer button lamps
123   for (int i = 0; i < 4; i++)
124      output_set_lamp_value(i + 4, data >> i & 1);
125
126   // d4-d7: N/C
127}
128
129static WRITE8_HANDLER(quizshow_lamps3_w)
130{
131   // d0-d1: start button lamps
132   output_set_lamp_value(8, data >> 0 & 1);
133   output_set_lamp_value(9, data >> 1 & 1);
134
135   // d2-d3: unused? (chip is shared with quizshow_tape_control_w)
136   // d4-d7: N/C
137}
138
139static WRITE8_HANDLER(quizshow_tape_control_w)
140{
141   quizshow_state *state = space->machine().driver_data<quizshow_state>();
142
143   // d2: enable user category select (changes tape head position)
144   output_set_lamp_value(10, data >> 2 & 1);
145   state->m_category_enable = data & 4;
146
147   // d3: tape motor
148   // TODO
149
150   // d0-d1: unused? (chip is shared with quizshow_lamps3_w)
151   // d4-d7: N/C
152}
153
154static WRITE8_HANDLER(quizshow_audio_w)
155{
156   // d1: audio beep on/off
157   // TODO
158
159   // d0, d2-d7: N/C
160}
161
162static WRITE8_HANDLER(quizshow_video_disable_w)
163{
164   // d0: video disable (looked glitchy when I implemented it, maybe there's more to it)
165   // d1-d7: N/C
166}
167
168static READ8_HANDLER(quizshow_timing_r)
169{
170   quizshow_state *state = space->machine().driver_data<quizshow_state>();
171   UINT8 ret = 0x80;
172
173   // d0-d3: 1R-8R (16-line counter)
174   ret |= state->m_clocks >> 1 & 0xf;
175
176   // d4: 8VAC?, use 8V instead
177   ret |= state->m_clocks << 4 & 0x10;
178
179   // d5-d6: 4F-8F
180   ret |= state->m_clocks >> 2 & 0x60;
181
182   // d7: display busy
183   if (space->machine().primary_screen->vpos() >= VBSTART || space->machine().primary_screen->vpos() & 8)
184      ret &= 0x7f;
185
186   return ret;
187}
188
189static READ8_HANDLER(quizshow_tape_signal_r)
190{
191   // TODO (for now, hold INS to fastforward and it'll show garbage questions where D is always(?) the right answer)
192   return space->machine().rand() & 0x80;
193}
194
195static WRITE8_HANDLER(quizshow_main_ram_w)
196{
197   quizshow_state *state = space->machine().driver_data<quizshow_state>();
198   state->m_main_ram[offset]=data;
199   state->m_tilemap->mark_tile_dirty((offset << 1 & 0x3c0) | (offset & 0x1f));
200}
201
202
203static ADDRESS_MAP_START( quizshow_mem_map, AS_PROGRAM, 8 )
204   ADDRESS_MAP_GLOBAL_MASK(0x7fff)
205   AM_RANGE(0x0000, 0x0bff) AM_ROM
206   AM_RANGE(0x1802, 0x1802) AM_WRITE(quizshow_audio_w)
207   AM_RANGE(0x1804, 0x1804) AM_WRITE(quizshow_lamps1_w)
208   AM_RANGE(0x1808, 0x1808) AM_WRITE(quizshow_lamps2_w)
209   AM_RANGE(0x1810, 0x1810) AM_WRITE(quizshow_lamps3_w)
210   AM_RANGE(0x1820, 0x1820) AM_WRITE(quizshow_tape_control_w)
211   AM_RANGE(0x1840, 0x1840) AM_WRITE(quizshow_video_disable_w)
212   AM_RANGE(0x1881, 0x1881) AM_READ_PORT("IN0")
213   AM_RANGE(0x1882, 0x1882) AM_READ_PORT("IN1")
214   AM_RANGE(0x1884, 0x1884) AM_READ_PORT("IN2")
215   AM_RANGE(0x1888, 0x1888) AM_READ_PORT("IN3")
216   AM_RANGE(0x1900, 0x1900) AM_READ(quizshow_timing_r)
217   AM_RANGE(0x1e00, 0x1fff) AM_RAM_WRITE(quizshow_main_ram_w) AM_BASE_MEMBER(quizshow_state, m_main_ram)
218ADDRESS_MAP_END
219
220static ADDRESS_MAP_START( quizshow_io_map, AS_IO, 8 )
221   ADDRESS_MAP_UNMAP_HIGH
222//   AM_RANGE(S2650_CTRL_PORT, S2650_CTRL_PORT) AM_NOP // unused
223//   AM_RANGE(S2650_DATA_PORT, S2650_DATA_PORT) AM_NOP // unused
224   AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ(quizshow_tape_signal_r)
225   AM_RANGE(S2650_FO_PORT, S2650_FO_PORT) AM_RAM AM_BASE_MEMBER(quizshow_state, m_fo_state)
226ADDRESS_MAP_END
227
228
229/***************************************************************************
230
231  Inputs
232
233***************************************************************************/
234
235static CUSTOM_INPUT(quizshow_tape_headpos_r)
236{
237   quizshow_state *state = field.machine().driver_data<quizshow_state>();
238   return 1 << state->m_tape_head_pos;
239}
240
241static INPUT_CHANGED(quizshow_category_select)
242{
243   if (newval)
244   {
245      quizshow_state *state = field.machine().driver_data<quizshow_state>();
246      if (state->m_category_enable)
247         state->m_tape_head_pos = (state->m_tape_head_pos + 1) & 3;
248   }
249}
250
251static INPUT_PORTS_START( quizshow )
252   PORT_START("IN0") // ADR strobe 0
253   PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(quizshow_tape_headpos_r, NULL)
254   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_START1 )
255   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_START2 )
256   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN1 )
257   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN2 )
258
259   PORT_START("IN1") // ADR strobe 1
260   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P1 Answer A")
261   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P1 Answer B")
262   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P1 Answer C")
263   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("P1 Answer D")
264   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P2 Answer A") PORT_PLAYER(2)
265   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P2 Answer B") PORT_PLAYER(2)
266   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P2 Answer C") PORT_PLAYER(2)
267   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("P2 Answer D") PORT_PLAYER(2)
268
269   PORT_START("IN2") // ADR strobe 2
270   PORT_DIPNAME( 0x0f, 0x05, "Game Duration" )         PORT_DIPLOCATION("SW3:4,3,2,1")
271   PORT_DIPSETTING( 0x00, "50 sec. / 5 questions" )
272   PORT_DIPSETTING( 0x01, "60 sec. / 6 questions" )
273   PORT_DIPSETTING( 0x02, "70 sec. / 7 questions" )
274   PORT_DIPSETTING( 0x03, "80 sec. / 8 questions" )
275   PORT_DIPSETTING( 0x04, "90 sec. / 9 questions" )
276   PORT_DIPSETTING( 0x05, "100 sec. / 10 questions" )
277   PORT_DIPSETTING( 0x06, "110 sec. / 11 questions" )
278   PORT_DIPSETTING( 0x07, "120 sec. / 12 questions" )
279   PORT_DIPSETTING( 0x08, "130 sec. / 13 questions" )
280   PORT_DIPSETTING( 0x09, "140 sec. / 14 questions" )
281   PORT_DIPSETTING( 0x0a, "150 sec. / 15 questions" ) // not listed in manual
282   PORT_DIPSETTING( 0x0b, "160 sec. / 16 questions" ) // "
283   PORT_DIPSETTING( 0x0c, "170 sec. / 17 questions" ) // "
284   PORT_DIPSETTING( 0x0d, "180 sec. / 18 questions" ) // "
285   PORT_DIPSETTING( 0x0e, "190 sec. / 19 questions" ) // "
286   PORT_DIPSETTING( 0x0f, "200 sec. / 20 questions" ) // "
287
288   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW1:4")
289   PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) )
290   PORT_DIPSETTING( 0x10, DEF_STR( 1C_2C ) )
291   PORT_DIPNAME( 0x20, 0x00, "Duration Mode" )         PORT_DIPLOCATION("SW1:3")
292   PORT_DIPSETTING(    0x00, "Question Count" )
293   PORT_DIPSETTING(    0x20, "Timed" )
294   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
295   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) // N/C
296
297   PORT_START("IN3") // ADR strobe 3
298   PORT_DIPNAME( 0x0f, 0x05, "Bonus Questions" )      PORT_DIPLOCATION("SW2:4,3,2,1")
299   PORT_DIPSETTING( 0x00, "0" )
300   PORT_DIPSETTING( 0x01, "1" )
301   PORT_DIPSETTING( 0x02, "2" )
302   PORT_DIPSETTING( 0x03, "3" )
303   PORT_DIPSETTING( 0x04, "4" )
304   PORT_DIPSETTING( 0x05, "5" )
305   PORT_DIPSETTING( 0x06, "6" )
306   PORT_DIPSETTING( 0x07, "7" )
307   PORT_DIPSETTING( 0x08, "8" )
308   PORT_DIPSETTING( 0x09, "9" )
309   PORT_DIPSETTING( 0x0a, "10" ) // not listed in manual
310   PORT_DIPSETTING( 0x0b, "11" ) // "
311   PORT_DIPSETTING( 0x0c, "12" ) // "
312   PORT_DIPSETTING( 0x0d, "13" ) // "
313   PORT_DIPSETTING( 0x0e, "14" ) // "
314   PORT_DIPSETTING( 0x0f, "15" ) // "
315   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNUSED )
316
317   PORT_START("CAT")
318   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Category Select") PORT_CHANGED(quizshow_category_select, NULL)
319
320INPUT_PORTS_END
321
322
323/***************************************************************************
324
325  Machine Config
326
327***************************************************************************/
328
329static const gfx_layout tile_layout =
330{
331   8,8,
332   64,
333   1,
334   { 0 },
335   { 0, 1, 2, 3, 4, 5, 6, 7 },
336   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
337   8*8
338};
339
340static GFXDECODE_START( quizshow )
341   GFXDECODE_ENTRY( "gfx1", 0, tile_layout, 0, 4 )
342GFXDECODE_END
343
344
345static TIMER_DEVICE_CALLBACK( quizshow_clock_timer_cb )
346{
347   quizshow_state *state = timer.machine().driver_data<quizshow_state>();
348   state->m_clocks++;
349
350   // blink is on 4F and 8F
351   int blink_old = state->m_blink_state;
352   state->m_blink_state = (state->m_clocks >> 2 & state->m_clocks >> 1) & 0x40;
353   if (state->m_blink_state != blink_old)
354      state->m_tilemap->mark_all_dirty();
355}
356
357static MACHINE_RESET(quizshow)
358{
359   quizshow_state *state = machine.driver_data<quizshow_state>();
360
361   state->m_category_enable = 0;
362   state->m_tape_head_pos = 0;
363}
364
365static MACHINE_CONFIG_START( quizshow, quizshow_state )
366   /* basic machine hardware */
367   MCFG_CPU_ADD("maincpu", S2650, MASTER_CLOCK / 16) // divider guessed
368   MCFG_CPU_PROGRAM_MAP(quizshow_mem_map)
369   MCFG_CPU_IO_MAP(quizshow_io_map)
370   MCFG_TIMER_ADD_PERIODIC("clock_timer", quizshow_clock_timer_cb, attotime::from_hz(PIXEL_CLOCK / (HTOTAL * 8))) // 8V
371
372   /* video hardware */
373   MCFG_SCREEN_ADD("screen", RASTER)
374   MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART)
375
376   MCFG_SCREEN_UPDATE_STATIC(quizshow)
377
378   MCFG_GFXDECODE(quizshow)
379   MCFG_PALETTE_LENGTH(8)
380
381   MCFG_PALETTE_INIT(quizshow)
382   MCFG_VIDEO_START(quizshow)
383   MCFG_MACHINE_RESET(quizshow)
384
385   /* sound hardware (discrete) */
386   // ..
387MACHINE_CONFIG_END
388
389
390/***************************************************************************
391
392  Game drivers
393
394***************************************************************************/
395
396ROM_START( quizshow )
397   ROM_REGION( 0x1000, "maincpu", 0 )
398   ROM_LOAD( "005464-01.a1", 0x00000, 0x0200, CRC(c9da809a) SHA1(0d16e552398069a4389c34cc9fb6dcc89eb05b9b) )
399   ROM_LOAD( "005464-02.c1", 0x00200, 0x0200, CRC(42237134) SHA1(2932d4820f6c9a383cb5a4e504e043e2d479d474) )
400   ROM_LOAD( "005464-03.d1", 0x00400, 0x0200, CRC(0c58fee9) SHA1(c7b081bc4f274a29eb758c8758877b15c9e54d79) )
401   ROM_LOAD( "005464-04.f1", 0x00600, 0x0200, CRC(4c6cffd4) SHA1(c291d0fa140faa78b807af72c677d53c620b3103) )
402   ROM_LOAD( "005464-05.h1", 0x00800, 0x0200, CRC(b8d61b96) SHA1(eb437a5deaf2fc2a9acebbc506321f3151b4eafa) )
403   ROM_LOAD( "005464-06.k1", 0x00a00, 0x0200, CRC(200023b2) SHA1(271d0b2b2f985a6c7b7146869ed00990a52dd653) )
404
405   ROM_REGION( 0x0200, "gfx1", 0 )
406   ROM_LOAD_NIB_HIGH( "005466-01.m2", 0x0000, 0x0200, BAD_DUMP CRC(4f42fdd6) SHA1(f8ea4b582e26cad37b746174cdc9f1c7ae0819c3) ) // not dumped yet, placeholder taken from dominos.zip
407   ROM_LOAD_NIB_LOW ( "005466-02.n2", 0x0000, 0x0200, BAD_DUMP CRC(957dd8df) SHA1(280457392f40cd66eae34d2fcdbd4d2142793402) ) // "
408
409   ROM_REGION( 0x0020, "proms", 0 )
410   ROM_LOAD( "005465-01.f2", 0x0000, 0x0020, NO_DUMP ) // memory timing
411ROM_END
412
413
414GAMEL( 1976, quizshow, 0, quizshow, quizshow, 0, ROT0, "Atari", "Quiz Show", GAME_NO_SOUND | GAME_NOT_WORKING, layout_quizshow )
src/mame/drivers/ksys573.c
r14823r14824
9292P Fisherman's Bait                              1998.06    GE765 UA          765 UA B02
9393P Fisherman's Bait 2                            1998       GC865 UA          865 UA B02
9494P Fisherman's Bait Marlin Challenge             1999       GX889             889 AA/EA/JA/UA(needs redump)
95P Gachagachamp                                  1999.01    GQ877 JA          GE877-JA(PCMCIA card)
9596A GUITARFREAKS                                  1999.02    GQ886 EA/JA/UA    886 ** C02
9697A GUITARFREAKS 2ndMIX                           1999.07    GQ883 JA          929 JB B02(needs redump)
9798A *GUITARFREAKS 2ndMIX Link ver.                1999.09
r14823r14824
107108N *GUITARFREAKS 11thMIX                         2004.04
108109G *Gun Mania                                    2000.07    G?906 JA          (no CD)
109110? *Gun Mania Zone Plus                          2000.10
110P *Gachaga Champ                                1999.01
111111P Hyper Bishi Bashi Champ                       1998.07    GC908 JA          908    A02
112112P Jikkyou Powerful Pro Yakyuu EX                1998.04    GX802 JA          802 JA B02
113113P *Jikkyou Powerful Pro Yakyuu EX 98            1998.08
r14823r14824
170170  |   058232         |056879 |    |3644|                            SM5877   |
171171  |                  |       |    |----|         ADC0834                LM358|
172172  |                  |-------|            ADM485           CN4               |
173  |                                                         CN3      CN17    |
173  |                              CN5                        CN3      CN17    |
174174  |                                TEST_SW  DIP4 USB   CN8     RCA-L/R   CN9 |
175175  |--|          JAMMA            |-------------------------------------------|
176176     |---------------------------|
r14823r14824
208208  LA4705    - Sanyo LA4705 15W 2-channel power amplifier (SIP18)
209209  LM358     - National Semiconductor LM358 low power dual operational amplifier (SOIC8, @ 33C)
210210  CXD2925Q  - Sony CXD2925Q SPU (QFP100, @ 15Q)
211  CXD8561Q  - Sony CXD8561Q GPU (QFP208, @ 10M)
211  CXD8561Q  - Sony CXD8561Q GPU (QFP208, @ 10M) Also found CXD8561BQ in some units
212212  CXD8530CQ - Sony CXD8530CQ R3000-based CPU (QFP208, @ 17M)
213213  9536      - Xilinx XC9536 in-system-programmable CPLD (PLCC44, @ 22J)
214214  3644      - Hitachi H8/3644 HD6473644H microcontroller with 32k ROM & 1k RAM (QFP64, @ 18E,
r14823r14824
226226              is updated with the new game data
227227  29F016      Fujitsu 29F016A-90PFTN 2M x8 FlashROM (TSOP48, @ 27H/J/L/M & 31H/J/L/M)
228228              Also found Sharp LH28F016S (2M x8 TSOP40) in some units
229  KM416V256 - Samsung Electronics KM416V256BT-7 256k x 16 DRAM (TSOP44/40, @ 11Q)
230  KM48V514  - Samsung Electronics KM48V514BJ-6 512k x 8 EDO DRAM (SOJ28, @ 16G/H, 14G/H, 12G/H, 9G/H)
229  KM416V256 - Samsung Electronics KM416V256BT-7 256k x 16 DRAM (TSOP44/40, @ 11Q labelled 'SPUDR4M')
230  KM48V514  - Samsung Electronics KM48V514BJ-6 512k x 8 EDO DRAM (SOJ28, @ 16G/H, 14G/H, 12G/H, 9G/H labelled 'HDR4M8SJ')
231              Also found NEC 424805AL-A60 in some units
231232  32M       - NEC D481850GF-A12 128k x 32Bit x 2 Banks SGRAM (QFP100, @ 4P & 4L)
232
233              Also found Samsung KM4132G271Q-12 in some units
233234  Software  -
234              - 700A01.22G 4M MaskROM (DIP32, @ 22G)
235              - 700A01.22G 4M MaskROM (DIP32, @ 22G). AMD 27C040 is also used
235236              - SONY ATAPI CDROM drive, with CDROM disc containing program + graphics + sound
236237                Some System 573 units contain a CR-583 drive dated October 1997, some contain a
237238                CR-587 drive dated March 1998. Note that the CR-587 will not read CDR discs ;-)
r14823r14824
271272        PAL        - AMD PALCE16V8Q, stamped 'E765Bx' (DIP20)
272273
273274
275 GE877-PWB(C) (C)1998 KONAMI
276  |----------------------|
277|--       JAMMA OUT      --|
278|                          |
279|      CN6                 |
280|     CN5  CN4  CN3  CN2   |
281|                          |
282|                          |
283|         JAMMA IN         |
284|--------------------------|
285 Notes: This PCB is used for Gachagachamp. No ICs.
286
287        CN5 - To control lever unit (1P). uses 9 pins out of 15 pins of B15P-SHF-1AA
288        CN6 - To control lever unit (2P). uses 9 pins out of 14 pins of B14P-SHF-1AA
289        (CN4, CN3, CN2 is printed pattern only, no actual connector)
290
291
292
274293  Digital I/O PCB
275294  ---------------
276295
src/osd/sdl/man/chdman.1
r14823r14824
66.\" Ashley T. Howes <debiandev@ashleyhowes.com>, February 2005
77.\" updated by Cesare Falco <cesare.falco@gmail.com>, February 2007
88.\"
9.TH CHDMAN 1 2012-03-25 0.145u5 "chdman"
9.TH CHDMAN 1 2012-03-25 0.145u5 "MAME Compressed Hunks of Data (CHD) manager"
1010.\"
1111.\" NAME chapter
1212.SH NAME
r14823r14824
6060.B copy \fIinput\fR.chd \fIoutput\fR.chd
6161Copy all hunks of data from one CHD file to another. The hunk sizes do not need to match.
6262If the source is shorter than the destination, the source data will be padded with 0s.
63.\"
6364.\" SWITCHES chapter
6465.SH SWITCHES
6566.TP
66.B --chs, -chs \fI <cylinders,heads,sectors>: specifies CHS geometry values for CHD harddisks
67.B \-\-chs, \-chs \fIcylinders,heads,sectors
68Specifies CHS geometry values for CHD harddisks.
6769.TP
68.B --compression, -c \fI <none|type1[,type2[,...]]>: which compression codecs to use (up to 4)
70.B \-\-compression, \-c \fInone\fR|\fItype1\fR[,\fItype2\fR[,...]]
71Which compression codecs to use (up to 4).
6972.TP
70.B --force, -f \fI : force overwriting an existing file
73.B \-\-force, \-f
74Force overwriting an existing file.
7175.TP
72.B --help, -h \fI : shows the available switches for an option
76.B \-\-help, \-h
77Shows the available switches for an option.
7378.TP
74.B --hunksize, -hs \fI <bytes>: size of each unit, in hunks
79.B \-\-hunksize, \-hs \fIbytes
80Size of each unit, in hunks.
7581.TP
76.B --ident, -id \fI <filename>: name of ident file to provide CHS information
82.B \-\-ident, \-id \fIfilename
83Name of ident file to provide CHS information.
7784.TP
78.B --input, -i \fI <filename>: input file name
85.B \-\-input, \-i \fIfilename
86Input file name.
7987.TP
80.B --inputstartbyte, -isb \fI <offset>: starting byte offset within the input
88.B \-\-inputstartbyte, \-isb \fIoffset
89Starting byte offset within the input.
8190.TP
82.B --inputstarthunk, -ish \fI <offset>:  starting hunk offset within the input
91.B \-\-inputstarthunk, \-ish \fIoffset
92Starting hunk offset within the input.
8393.TP
84.B --inputbytes, -ib \fI <length>: effective length of the input in bytes
94.B \-\-inputbytes, \-ib \fIlength
95Effective length of the input in bytes.
8596.TP                             
86.B --inputhunks, -ih \fI <length>: effective length of the input in hunks
97.B \-\-inputhunks, \-ih \fIlength
98Effective length of the input in hunks.
8799.TP
88.B --inputparent, -ip \fI <filename>: parent CHD's input file name
100.B \-\-inputparent, \-ip \fIfilename
101Parent CHD's input file name.
89102.TP
90.B --numprocessors, -np \fI <count>: limits the number of processors to use during compression
103.B \-\-numprocessors, \-np \fIcount
104Limits the number of processors to use during compression.
91105.TP
92.B --sectorsize, -ss \fI <bytes>: size of each hard disk sector
106.B \-\-sectorsize, \-ss \fIbytes
107size of each hard disk sector.
93108.TP
94.B --verbose, -v \fI : output additional information about the operation
109.B \-\-verbose, \-v
110Output additional information about the operation.
95111.TP
96.B --output, -o \fI <filename>: output file name
112.B \-\-output, \-o \fIfilename
113Output file name.
97114.TP
98.B --outputbin, -ob \fI <filename>: output binary file name for extractcd
115.B \-\-outputbin, \-ob \fIfilename
116Output binary file name for extractcd.
99117.TP
100.B --outputparent, -op \fI <filename>: parent CHD's output file name
118.B \-\-outputparent, \-op \fIfilename
119Parent CHD's output file name.
101120.TP
102.B --unitsize, -us \fI <bytes>: size of each unit, in bytes
121.B \-\-unitsize, \-us \fIbytes
122Size of each unit, in bytes.
103123
src/emu/cpu/m68000/68340ser.c
r0r14824
1/* 68340 SERIAL module */
2
3#include "emu.h"
4#include "m68kcpu.h"
5
6
7READ32_HANDLER( m68340_internal_serial_r )
8{
9   m68ki_cpu_core *m68k = m68k_get_safe_token(&space->device());
10   m68340_serial* serial = m68k->m68340SERIAL;
11   assert(serial != NULL);
12
13   if (serial)
14   {
15      int pc = cpu_get_pc(&space->device());
16      logerror("%08x m68340_internal_serial_r %08x, (%08x)\n", pc, offset*4,mem_mask);
17   }
18
19   return 0x00000000;
20}
21
22WRITE32_HANDLER( m68340_internal_serial_w )
23{
24   m68ki_cpu_core *m68k = m68k_get_safe_token(&space->device());
25   m68340_serial* serial = m68k->m68340SERIAL;
26   assert(serial != NULL);
27
28   if (serial)
29   {
30      int pc = cpu_get_pc(&space->device());
31      logerror("%08x m68340_internal_serial_w %08x, %08x (%08x)\n", pc, offset*4,data,mem_mask);
32   }
33
34}
35
36void m68340_serial::reset(void)
37{
38
39}
src/emu/cpu/m68000/m68000.h
r14823r14824
44#define __M68000_H__
55
66
7#include "68307sim.h"
8#include "68307bus.h"
9#include "68307ser.h"
10#include "68307tmu.h"
11
12#include "68340sim.h"
13#include "68340dma.h"
14#include "68340ser.h"
15#include "68340tmu.h"
16
717/* There are 7 levels of interrupt to the 68K.
818 * A transition from < 7 to 7 will cause a non-maskable interrupt (NMI).
919 */
r14823r14824
123133void m68k_set_rte_callback(device_t *device, m68k_rte_func callback);
124134void m68k_set_tas_callback(device_t *device, m68k_tas_func callback);
125135UINT16 m68k_get_fc(device_t *device);
136UINT16 m68307_get_cs(device_t *device, offs_t address);
126137
127
128138typedef int (*instruction_hook_t)(device_t *device, offs_t curpc);
129139void m68k_set_instruction_hook(device_t *device, instruction_hook_t ihook);
130140
src/emu/cpu/m68000/68307sim.c
r0r14824
1/* 68307 SIM module */
2
3#include "emu.h"
4#include "m68kcpu.h"
5
6
7READ16_HANDLER( m68307_internal_sim_r )
8{
9   m68ki_cpu_core *m68k = m68k_get_safe_token(&space->device());
10   m68307_sim* sim = m68k->m68307SIM;
11   assert(sim != NULL);
12
13   int pc = cpu_get_pc(&space->device());
14   logerror("%08x m68307_internal_sim_r %08x, (%04x)\n", pc, offset*2,mem_mask);
15
16   if (sim)
17   {
18      switch (offset<<1)
19      {
20         case m68307SIM_BR0:   return (sim->m_br[0]);
21         case m68307SIM_OR0:   return (sim->m_or[0]);
22         case m68307SIM_BR1:   return (sim->m_br[1]);
23         case m68307SIM_OR1:   return (sim->m_or[1]);
24         case m68307SIM_BR2:   return (sim->m_br[2]);
25         case m68307SIM_OR2:   return (sim->m_or[2]);
26         case m68307SIM_BR3:   return (sim->m_br[3]);
27         case m68307SIM_OR3:   return (sim->m_or[3]);
28      }
29   }
30
31
32   return 0x0000;
33}
34
35WRITE16_HANDLER( m68307_internal_sim_w )
36{
37   m68ki_cpu_core *m68k = m68k_get_safe_token(&space->device());
38   m68307_sim* sim = m68k->m68307SIM;
39   assert(sim != NULL);
40
41   int pc = cpu_get_pc(&space->device());
42   logerror("%08x m68307_internal_sim_w %08x, %04x (%04x)\n", pc, offset*2,data,mem_mask);
43
44   if (sim)
45   {
46      switch (offset<<1)
47      {
48         
49         case m68307SIM_BR0:
50            COMBINE_DATA(&sim->m_br[0]);
51            break;
52         case m68307SIM_OR0:
53            COMBINE_DATA(&sim->m_or[0]);
54            break;
55         case m68307SIM_BR1:
56            COMBINE_DATA(&sim->m_br[1]);
57            break;
58         case m68307SIM_OR1:
59            COMBINE_DATA(&sim->m_or[1]);
60            break;
61         case m68307SIM_BR2:
62            COMBINE_DATA(&sim->m_br[2]);
63            break;
64         case m68307SIM_OR2:
65            COMBINE_DATA(&sim->m_or[2]);
66            break;
67         case m68307SIM_BR3:
68            COMBINE_DATA(&sim->m_br[3]);
69            break;
70         case m68307SIM_OR3:
71            COMBINE_DATA(&sim->m_or[3]);
72            break;
73      }
74   }
75}
76
77
78void m68307_sim::reset(void)
79{
80   for (int i=0;i<4;i++)
81   {
82      m_br[i] = 0xc001;
83      m_or[i] = 0xdffd;
84   }
85}
src/emu/cpu/m68000/68307bus.c
r0r14824
1/* 68307 MBUS module */
2
3#include "emu.h"
4#include "m68kcpu.h"
5
6
7READ16_HANDLER( m68307_internal_mbus_r )
8{
9   m68ki_cpu_core *m68k = m68k_get_safe_token(&space->device());
10   m68307_mbus* mbus = m68k->m68307MBUS;
11   assert(mbus != NULL);
12
13   if (mbus)
14   {
15      int pc = cpu_get_pc(&space->device());
16      logerror("%08x m68307_internal_mbus_r %08x, (%04x)\n", pc, offset*2,mem_mask);
17   }
18   
19   return 0x0000;
20}
21
22WRITE16_HANDLER( m68307_internal_mbus_w )
23{
24   m68ki_cpu_core *m68k = m68k_get_safe_token(&space->device());
25   m68307_mbus* mbus = m68k->m68307MBUS;
26   assert(mbus != NULL);
27
28   if (mbus)
29   {
30      int pc = cpu_get_pc(&space->device());
31      logerror("%08x m68307_internal_mbus_w %08x, %04x (%04x)\n", pc, offset*2,data,mem_mask);
32   }
33}
34
35void m68307_mbus::reset(void)
36{
37
38}
src/emu/cpu/m68000/68307ser.c
r0r14824
1/* 68307 SERIAL Module */
2
3#include "emu.h"
4#include "m68kcpu.h"
5
6
7READ16_HANDLER( m68307_internal_serial_r )
8{
9   m68ki_cpu_core *m68k = m68k_get_safe_token(&space->device());
10   m68307_serial* serial = m68k->m68307SERIAL;
11   assert(serial != NULL);
12
13   if (serial)
14   {
15      int pc = cpu_get_pc(&space->device());
16      logerror("%08x m68307_internal_serial_r %08x, (%04x)\n", pc, offset*2,mem_mask);
17   }
18
19   return 0x0000;
20}
21
22WRITE16_HANDLER( m68307_internal_serial_w )
23{
24   m68ki_cpu_core *m68k = m68k_get_safe_token(&space->device());
25   m68307_serial* serial = m68k->m68307SERIAL;
26   assert(serial != NULL);
27
28   if (serial)
29   {
30      int pc = cpu_get_pc(&space->device());
31      logerror("%08x m68307_internal_serial_w %08x, %04x (%04x)\n", pc, offset*2,data,mem_mask);
32   }
33}
34
35void m68307_serial::reset(void)
36{
37
38}
39
src/emu/cpu/m68000/m68kcpu.h
r14823r14824
2727
2828typedef class _m68ki_cpu_core m68ki_cpu_core;
2929
30
3130#include "m68000.h"
3231#include "../../../lib/softfloat/milieu.h"
3332#include "../../../lib/softfloat/softfloat.h"
r14823r14824
552551public:
553552   void init8(address_space &space);
554553   void init16(address_space &space);
555   void init16_68307(address_space &space);
554   void init16_m68307(address_space &space);
556555   void init32(address_space &space);
557556   void init32mmu(address_space &space);
558557   void init32hmmu(address_space &space);
r14823r14824
571570   UINT16 read_immediate_16(offs_t address);
572571   UINT16 simple_read_immediate_16(offs_t address);
573572
574   UINT16 simple_read_immediate_16_68307(offs_t address);
575   UINT8 read_byte_68307(offs_t address);
576   UINT16 read_word_68307(offs_t address);
577   UINT32 read_dword_68307(offs_t address);
578   void write_byte_68307(offs_t address, UINT8 data);
579   void write_word_68307(offs_t address, UINT16 data);
580   void write_dword_68307(offs_t address, UINT32 data);
573   UINT16 simple_read_immediate_16_m68307(offs_t address);
574   UINT8 read_byte_m68307(offs_t address);
575   UINT16 read_word_m68307(offs_t address);
576   UINT32 read_dword_m68307(offs_t address);
577   void write_byte_m68307(offs_t address, UINT8 data);
578   void write_word_m68307(offs_t address, UINT16 data);
579   void write_dword_m68307(offs_t address, UINT32 data);
581580
582581   UINT8 read_byte_32_mmu(offs_t address);
583582   void write_byte_32_mmu(offs_t address, UINT8 data);
r14823r14824
722721   UINT32 ic_address[M68K_IC_SIZE];   /* instruction cache address data */
723722   UINT16 ic_data[M68K_IC_SIZE];      /* instruction cache content data */
724723
724   /* 68307 peripheral modules */
725   m68307_sim*    m68307SIM;
726   m68307_mbus*   m68307MBUS;
727   m68307_serial* m68307SERIAL;
728   m68307_timer*  m68307TIMER;
729
730   UINT16 m68307_base;
731   UINT16 m68307_scrhigh;
732   UINT16 m68307_scrlow;
733
734   int m68307_currentcs;
735
736   /* 68340 peripheral modules */
737   m68340_sim*      m68340SIM;
738   m68340_dma*      m68340DMA;
739   m68340_serial* m68340SERIAL;
740   m68340_timer*  m68340TIMER;
741
742   UINT32 m68340_base;
743
744
745   /* 68308 / 68340 internal address map */
746   address_space *internal;
747
748
725749   /* external instruction hook (does not depend on debug mode) */
726750   typedef int (*instruction_hook_t)(device_t *device, offs_t curpc);
727751   instruction_hook_t instruction_hook;
r14823r14824
732756};
733757
734758
759INLINE m68ki_cpu_core *m68k_get_safe_token(device_t *device)
760{
761   assert(device != NULL);
762   assert(device->type() == M68000 ||
763         device->type() == M68301 ||
764         device->type() == M68307 ||
765         device->type() == M68008 ||
766         device->type() == M68008PLCC ||
767         device->type() == M68010 ||
768         device->type() == M68EC020 ||
769         device->type() == M68020 ||
770         device->type() == M68020HMMU ||
771         device->type() == M68020PMMU ||
772         device->type() == M68EC030 ||
773         device->type() == M68030 ||
774         device->type() == M68EC040 ||
775         device->type() == M68040 ||
776         device->type() == SCC68070 ||
777         device->type() == MCF5206E ||
778         device->type() == M68340);
779   return (m68ki_cpu_core *)downcast<legacy_cpu_device *>(device)->token();
780}
781
735782extern const UINT8    m68ki_shift_8_table[];
736783extern const UINT16   m68ki_shift_16_table[];
737784extern const UINT32   m68ki_shift_32_table[];
src/emu/cpu/m68000/68340sim.h
r0r14824
1
2READ32_HANDLER( m68340_internal_sim_r );
3WRITE32_HANDLER( m68340_internal_sim_w );
4
5class m68340_sim
6{
7   public:
8   void reset(void);
9};
10
src/emu/cpu/m68000/68340ser.h
r0r14824
1
2READ32_HANDLER( m68340_internal_serial_r );
3WRITE32_HANDLER( m68340_internal_serial_w );
4
5class m68340_serial
6{
7   public:
8   void reset(void);
9};
10
src/emu/cpu/m68000/68307sim.h
r0r14824
1/* 68307 SIM module */
2
3READ16_HANDLER( m68307_internal_sim_r );
4WRITE16_HANDLER( m68307_internal_sim_w );
5
6/* used for the CS logic */
7#define m68307SIM_BR0 (0x40)
8#define m68307SIM_OR0 (0x42)
9#define m68307SIM_BR1 (0x44)
10#define m68307SIM_OR1 (0x46)
11#define m68307SIM_BR2 (0x48)
12#define m68307SIM_OR2 (0x4a)
13#define m68307SIM_BR3 (0x4c)
14#define m68307SIM_OR3 (0x4e)
15
16class m68307_sim
17{
18   public:
19
20   UINT16 m_br[4];
21   UINT16 m_or[4];
22
23   void reset(void);
24};
No newline at end of file
src/emu/cpu/m68000/68307bus.h
r0r14824
1
2READ16_HANDLER( m68307_internal_mbus_r );
3WRITE16_HANDLER( m68307_internal_mbus_w );
4
5class m68307_mbus
6{
7   public:
8   void reset(void);
9};
10
src/emu/cpu/m68000/68307ser.h
r0r14824
1
2
3READ16_HANDLER( m68307_internal_serial_r );
4WRITE16_HANDLER( m68307_internal_serial_w );
5
6class m68307_serial
7{
8   public:   void reset(void);
9};
10
src/emu/cpu/m68000/68340dma.c
r0r14824
1/* 68340 DMA module */
2
3#include "emu.h"
4#include "m68kcpu.h"
5
6
7READ32_HANDLER( m68340_internal_dma_r )
8{
9   m68ki_cpu_core *m68k = m68k_get_safe_token(&space->device());
10   m68340_dma* dma = m68k->m68340DMA;
11   assert(dma != NULL);
12
13   if (dma)
14   {
15      int pc = cpu_get_pc(&space->device());
16      logerror("%08x m68340_internal_dma_r %08x, (%08x)\n", pc, offset*4,mem_mask);
17   }
18   
19   return 0x00000000;
20}
21
22WRITE32_HANDLER( m68340_internal_dma_w )
23{
24   m68ki_cpu_core *m68k = m68k_get_safe_token(&space->device());
25   m68340_dma* dma = m68k->m68340DMA;
26   assert(dma != NULL);
27   
28   if (dma)
29   {
30      int pc = cpu_get_pc(&space->device());
31      logerror("%08x m68340_internal_dma_w %08x, %08x (%08x)\n", pc, offset*4,data,mem_mask);
32   }
33}
34
35void m68340_dma::reset(void)
36{
37
38}
src/emu/cpu/m68000/68340tmu.c
r0r14824
1/* 68340 TIMER module */
2
3#include "emu.h"
4#include "m68kcpu.h"
5
6
7
8READ32_HANDLER( m68340_internal_timer_r )
9{
10   m68ki_cpu_core *m68k = m68k_get_safe_token(&space->device());
11   m68340_timer* timer = m68k->m68340TIMER;
12   assert(timer != NULL);
13
14   if (timer)
15   {
16      int pc = cpu_get_pc(&space->device());
17      logerror("%08x m68340_internal_timer_r %08x, (%08x)\n", pc, offset*4,mem_mask);
18   }
19     
20   return 0x00000000;
21}
22
23WRITE32_HANDLER( m68340_internal_timer_w )
24{
25   m68ki_cpu_core *m68k = m68k_get_safe_token(&space->device());
26   m68340_timer* timer = m68k->m68340TIMER;
27   assert(timer != NULL);
28
29   if (timer)
30   {
31      int pc = cpu_get_pc(&space->device());
32      logerror("%08x m68340_internal_timer_w %08x, %08x (%08x)\n", pc, offset*4,data,mem_mask);
33   }
34}
35
36void m68340_timer::reset(void)
37{
38
39}
src/emu/cpu/m68000/68340dma.h
r0r14824
1
2READ32_HANDLER( m68340_internal_dma_r );
3WRITE32_HANDLER( m68340_internal_dma_w );
4
5class m68340_dma
6{
7   public:
8   void reset(void);
9};
10
src/emu/cpu/m68000/68307tmu.c
r0r14824
1/* 68307 TIMER module */
2// 2x timers
3
4#include "emu.h"
5#include "m68kcpu.h"
6
7READ16_HANDLER( m68307_internal_timer_r )
8{
9   m68ki_cpu_core *m68k = m68k_get_safe_token(&space->device());
10   m68307_timer* timer = m68k->m68307TIMER;
11   assert(timer != NULL);
12
13   if (timer)
14   {
15      int pc = cpu_get_pc(&space->device());
16      logerror("%08x m68307_internal_timer_r %08x, (%04x)\n", pc, offset*2,mem_mask);
17   }
18     
19   return 0x0000;
20}
21
22WRITE16_HANDLER( m68307_internal_timer_w )
23{
24   m68ki_cpu_core *m68k = m68k_get_safe_token(&space->device());
25   m68307_timer* timer = m68k->m68307TIMER;
26   assert(timer != NULL);
27
28   if (timer)
29   {
30      int pc = cpu_get_pc(&space->device());
31      logerror("%08x m68307_internal_timer_w %08x, %04x (%04x)\n", pc, offset*2,data,mem_mask);
32   }
33}
34
35void m68307_timer::reset(void)
36{
37   for (int i=0;i<2;i++)
38   {
39      m68307_single_timer* tptr = &timer[i];
40
41      tptr->regs[m68307TIMER_TMR] = 0x0000;
42      tptr->regs[m68307TIMER_TRR] = 0xffff;
43      tptr->regs[m68307TIMER_TCR] = 0x0000;
44      tptr->regs[m68307TIMER_TCN] = 0x0000;
45      tptr->regs[m68307TIMER_TER] = 0x0000;
46      tptr->regs[m68307TIMER_WRR] = 0xffff;
47      tptr->regs[m68307TIMER_WCR] = 0xffff;
48      tptr->regs[m68307TIMER_XXX] = 0;
49      tptr->enabled = false;
50   }
51}
52
src/emu/cpu/m68000/68340tmu.h
r0r14824
1
2READ32_HANDLER( m68340_internal_timer_r );
3WRITE32_HANDLER( m68340_internal_timer_w );
4
5class m68340_timer
6{
7   public:
8   void reset(void);
9};
10
src/emu/cpu/m68000/68307tmu.h
r0r14824
1
2READ16_HANDLER( m68307_internal_timer_r );
3WRITE16_HANDLER( m68307_internal_timer_w );
4
5#define m68307TIMER_TMR (0x0)
6#define m68307TIMER_TRR (0x1)
7#define m68307TIMER_TCR (0x2)
8#define m68307TIMER_TCN (0x3)
9#define m68307TIMER_TER (0x4)
10#define m68307TIMER_WRR (0x5)
11#define m68307TIMER_WCR (0x6)
12#define m68307TIMER_XXX (0x7)
13
14struct m68307_single_timer
15{
16   UINT16 regs[0x8];
17   bool enabled;
18};
19
20class m68307_timer
21{
22   public:
23   m68307_single_timer timer[2];
24   void reset(void);
25};
26
src/emu/cpu/m68000/68340sim.c
r0r14824
1/* 68340 SIM module */
2
3#include "emu.h"
4#include "m68kcpu.h"
5
6
7READ32_HANDLER( m68340_internal_sim_r )
8{
9   m68ki_cpu_core *m68k = m68k_get_safe_token(&space->device());
10   m68340_sim* sim = m68k->m68340SIM;
11   assert(sim != NULL);
12   
13   if (sim)
14   {
15      int pc = cpu_get_pc(&space->device());
16      logerror("%08x m68340_internal_sim_r %08x, (%08x)\n", pc, offset*4,mem_mask);
17   }
18
19   return 0x00000000;
20}
21
22WRITE32_HANDLER( m68340_internal_sim_w )
23{
24   m68ki_cpu_core *m68k = m68k_get_safe_token(&space->device());
25   m68340_sim* sim = m68k->m68340SIM;
26   assert(sim != NULL);
27
28   if (sim)
29   {
30      int pc = cpu_get_pc(&space->device());
31      logerror("%08x m68340_internal_sim_w %08x, %08x (%08x)\n", pc, offset*4,data,mem_mask);
32   }
33}
34
35void m68340_sim::reset(void)
36{
37
38}
src/emu/cpu/m68000/m68kcpu.c
r14823r14824
639639#define MASK_040_OR_LATER         (CPU_TYPE_040 | CPU_TYPE_EC040)
640640
641641
642INLINE m68ki_cpu_core *get_safe_token(device_t *device)
643{
644   assert(device != NULL);
645   assert(device->type() == M68000 ||
646         device->type() == M68301 ||
647         device->type() == M68307 ||
648         device->type() == M68008 ||
649         device->type() == M68008PLCC ||
650         device->type() == M68010 ||
651         device->type() == M68EC020 ||
652         device->type() == M68020 ||
653         device->type() == M68020HMMU ||
654         device->type() == M68020PMMU ||
655         device->type() == M68EC030 ||
656         device->type() == M68030 ||
657         device->type() == M68EC040 ||
658         device->type() == M68040 ||
659         device->type() == SCC68070 ||
660         device->type() == MCF5206E ||
661         device->type() == M68340);
662   return (m68ki_cpu_core *)downcast<legacy_cpu_device *>(device)->token();
663}
664642
665643/* ======================================================================== */
666644/* ================================= API ================================== */
r14823r14824
733711/* translate logical to physical addresses */
734712static CPU_TRANSLATE( m68k )
735713{
736   m68ki_cpu_core *m68k = get_safe_token(device);
714   m68ki_cpu_core *m68k = m68k_get_safe_token(device);
737715
738716   /* only applies to the program address space and only does something if the MMU's enabled */
739717   if (m68k)
r14823r14824
769747/* translate logical to physical addresses for Apple HMMU */
770748static CPU_TRANSLATE( m68khmmu )
771749{
772   m68ki_cpu_core *m68k = get_safe_token(device);
750   m68ki_cpu_core *m68k = m68k_get_safe_token(device);
773751
774752   /* only applies to the program address space and only does something if the MMU's enabled */
775753   if (m68k)
r14823r14824
785763/* Execute some instructions until we use up cycles clock cycles */
786764static CPU_EXECUTE( m68k )
787765{
788   m68ki_cpu_core *m68k = get_safe_token(device);
766   m68ki_cpu_core *m68k = m68k_get_safe_token(device);
789767
790768   m68k->initial_cycles = m68k->remaining_cycles;
791769
r14823r14824
917895static CPU_INIT( m68k )
918896{
919897   static UINT32 emulation_initialized = 0;
920   m68ki_cpu_core *m68k = get_safe_token(device);
898   m68ki_cpu_core *m68k = m68k_get_safe_token(device);
921899
922900   m68k->device = device;
923901   m68k->program = device->space(AS_PROGRAM);
r14823r14824
961939/* Pulse the RESET line on the CPU */
962940static CPU_RESET( m68k )
963941{
964   m68ki_cpu_core *m68k = get_safe_token(device);
942   m68ki_cpu_core *m68k = m68k_get_safe_token(device);
965943
966944   /* Disable the PMMU/HMMU on reset, if any */
967945   m68k->pmmu_enabled = 0;
r14823r14824
1019997
1020998static CPU_DISASSEMBLE( m68k )
1021999{
1022   m68ki_cpu_core *m68k = get_safe_token(device);
1000   m68ki_cpu_core *m68k = m68k_get_safe_token(device);
10231001   return m68k_disassemble_raw(buffer, pc, oprom, opram, m68k->dasm_type);
10241002}
10251003
r14823r14824
10311009
10321010static CPU_IMPORT_STATE( m68k )
10331011{
1034   m68ki_cpu_core *m68k = get_safe_token(device);
1012   m68ki_cpu_core *m68k = m68k_get_safe_token(device);
10351013
10361014   switch (entry.index())
10371015   {
r14823r14824
10701048
10711049static CPU_EXPORT_STATE( m68k )
10721050{
1073   m68ki_cpu_core *m68k = get_safe_token(device);
1051   m68ki_cpu_core *m68k = m68k_get_safe_token(device);
10741052
10751053   switch (entry.index())
10761054   {
r14823r14824
11091087
11101088static CPU_SET_INFO( m68k )
11111089{
1112   m68ki_cpu_core *m68k = get_safe_token(device);
1090   m68ki_cpu_core *m68k = m68k_get_safe_token(device);
11131091   switch (state)
11141092   {
11151093      /* --- the following bits of info are set as 64-bit signed integers --- */
r14823r14824
11361114
11371115static CPU_EXPORT_STRING( m68k )
11381116{
1139   m68ki_cpu_core *m68k = get_safe_token(device);
1117   m68ki_cpu_core *m68k = m68k_get_safe_token(device);
11401118   UINT16 sr;
11411119
11421120   switch (entry.index())
r14823r14824
11981176
11991177static CPU_GET_INFO( m68k )
12001178{
1201   m68ki_cpu_core *m68k = (device != NULL && device->token() != NULL) ? get_safe_token(device) : NULL;
1179   m68ki_cpu_core *m68k = (device != NULL && device->token() != NULL) ? m68k_get_safe_token(device) : NULL;
12021180
12031181   switch (state)
12041182   {
r14823r14824
12551233
12561234void m68k_set_encrypted_opcode_range(device_t *device, offs_t start, offs_t end)
12571235{
1258   m68ki_cpu_core *m68k = get_safe_token(device);
1236   m68ki_cpu_core *m68k = m68k_get_safe_token(device);
12591237   m68k->encrypted_start = start;
12601238   m68k->encrypted_end = end;
12611239}
12621240
12631241void m68k_set_hmmu_enable(device_t *device, int enable)
12641242{
1265   m68ki_cpu_core *m68k = get_safe_token(device);
1243   m68ki_cpu_core *m68k = m68k_get_safe_token(device);
12661244
12671245   m68k->hmmu_enabled = enable;
12681246}
12691247
12701248void m68k_set_instruction_hook(device_t *device, instruction_hook_t ihook)
12711249{
1272   m68ki_cpu_core *m68k = get_safe_token(device);
1250   m68ki_cpu_core *m68k = m68k_get_safe_token(device);
12731251
12741252    m68k->instruction_hook = ihook;
12751253}
r14823r14824
12871265{
12881266   m_space = &space;
12891267   m_direct = &space.direct();
1290   m_cpustate = get_safe_token(&space.device());
1268   m_cpustate = m68k_get_safe_token(&space.device());
12911269   opcode_xor = 0;
12921270
12931271   readimm16 = m68k_readimm16_delegate(FUNC(m68k_memory_interface::m68008_read_immediate_16), this);
r14823r14824
13171295{
13181296   m_space = &space;
13191297   m_direct = &space.direct();
1320   m_cpustate = get_safe_token(&space.device());
1298   m_cpustate = m68k_get_safe_token(&space.device());
13211299   opcode_xor = 0;
13221300
13231301   readimm16 = m68k_readimm16_delegate(FUNC(m68k_memory_interface::simple_read_immediate_16), this);
r14823r14824
13291307   write32 = m68k_write32_delegate(FUNC(address_space::write_dword), &space);
13301308}
13311309
1310int m68307_calc_cs(m68ki_cpu_core *m68k, offs_t address)
1311{
1312   m68307_sim* sim = m68k->m68307SIM;
13321313
1314   for (int i=0;i<4;i++)
1315   {
1316      int br,amask,bra;
1317      br = sim->m_br[i] & 1;
1318      amask = ((sim->m_or[i]&0x1ffc)<<11);
1319      bra = ((sim->m_br[i] & 0x1ffc)<<11);
1320      if ((br) && ((address & amask) == bra)) return i+1;
1321   }
1322   return 0;
1323}
13331324
13341325
1335UINT16 m68k_memory_interface::simple_read_immediate_16_68307(offs_t address)
1326
1327UINT16 m68k_memory_interface::simple_read_immediate_16_m68307(offs_t address)
13361328{
1337    if ( address >= 0xf0 && address < 0x100 )
1338   {
1339      return 0;
1340   }
1341
1329//   m_cpustate->m68307_currentcs = m68307_calc_cs(m_cpustate, address);
13421330   return m_direct->read_decrypted_word(address);
13431331}
13441332
1345UINT8 m68k_memory_interface::read_byte_68307(offs_t address)
1333UINT8 m68k_memory_interface::read_byte_m68307(offs_t address)
13461334{
1347    if ( address >= 0xf0 && address < 0x100 )
1348   {
1349      return 0;
1350   }
1351
1335//   m_cpustate->m68307_currentcs = m68307_calc_cs(m_cpustate, address);
13521336   return m_space->read_byte(address);
13531337}
13541338
1355UINT16 m68k_memory_interface::read_word_68307(offs_t address)
1339UINT16 m68k_memory_interface::read_word_m68307(offs_t address)
13561340{
1357    if ( address >= 0xf0 && address < 0x100 )
1358   {
1359      return 0;
1360   }
1361
1341//   m_cpustate->m68307_currentcs = m68307_calc_cs(m_cpustate, address);
13621342   return m_space->read_word(address);
13631343}
13641344
1365UINT32 m68k_memory_interface::read_dword_68307(offs_t address)
1345UINT32 m68k_memory_interface::read_dword_m68307(offs_t address)
13661346{
1367    if ( address >= 0xf0 && address < 0x100 )
1368   {
1369      return 0;
1370   }
1371
1347//   m_cpustate->m68307_currentcs = m68307_calc_cs(m_cpustate, address);
13721348   return m_space->read_dword(address);
13731349}
13741350
1375void m68k_memory_interface::write_byte_68307(offs_t address, UINT8 data)
1351void m68k_memory_interface::write_byte_m68307(offs_t address, UINT8 data)
13761352{
1353//   m_cpustate->m68307_currentcs = m68307_calc_cs(m_cpustate, address);
13771354   m_space->write_byte(address, data);
13781355}
13791356
1380void m68k_memory_interface::write_word_68307(offs_t address, UINT16 data)
1357void m68k_memory_interface::write_word_m68307(offs_t address, UINT16 data)
13811358{
1359//   m_cpustate->m68307_currentcs = m68307_calc_cs(m_cpustate, address);
13821360   m_space->write_word(address, data);
13831361}
13841362
1385void m68k_memory_interface::write_dword_68307(offs_t address, UINT32 data)
1363void m68k_memory_interface::write_dword_m68307(offs_t address, UINT32 data)
13861364{
1365//   m_cpustate->m68307_currentcs = m68307_calc_cs(m_cpustate, address);
13871366   m_space->write_dword(address, data);
13881367}
13891368
13901369
13911370
13921371
1393void m68k_memory_interface::init16_68307(address_space &space)
1372void m68k_memory_interface::init16_m68307(address_space &space)
13941373{
13951374   m_space = &space;
13961375   m_direct = &space.direct();
1397   m_cpustate = get_safe_token(&space.device());
1376   m_cpustate = m68k_get_safe_token(&space.device());
13981377   opcode_xor = 0;
13991378
1400   readimm16 = m68k_readimm16_delegate(FUNC(m68k_memory_interface::simple_read_immediate_16_68307), this);
1401   read8 = m68k_read8_delegate(FUNC(m68k_memory_interface::read_byte_68307), this);
1402   read16 = m68k_read16_delegate(FUNC(m68k_memory_interface::read_word_68307), this);
1403   read32 = m68k_read32_delegate(FUNC(m68k_memory_interface::read_dword_68307), this);
1404   write8 = m68k_write8_delegate(FUNC(m68k_memory_interface::write_byte_68307), this);
1405   write16 = m68k_write16_delegate(FUNC(m68k_memory_interface::write_word_68307), this);
1406   write32 = m68k_write32_delegate(FUNC(m68k_memory_interface::write_dword_68307), this);
1379   readimm16 = m68k_readimm16_delegate(FUNC(m68k_memory_interface::simple_read_immediate_16_m68307), this);
1380   read8 = m68k_read8_delegate(FUNC(m68k_memory_interface::read_byte_m68307), this);
1381   read16 = m68k_read16_delegate(FUNC(m68k_memory_interface::read_word_m68307), this);
1382   read32 = m68k_read32_delegate(FUNC(m68k_memory_interface::read_dword_m68307), this);
1383   write8 = m68k_write8_delegate(FUNC(m68k_memory_interface::write_byte_m68307), this);
1384   write16 = m68k_write16_delegate(FUNC(m68k_memory_interface::write_word_m68307), this);
1385   write32 = m68k_write32_delegate(FUNC(m68k_memory_interface::write_dword_m68307), this);
14071386}
14081387
14091388/****************************************************************************
r14823r14824
14151394{
14161395   m_space = &space;
14171396   m_direct = &space.direct();
1418   m_cpustate = get_safe_token(&space.device());
1397   m_cpustate = m68k_get_safe_token(&space.device());
14191398   opcode_xor = WORD_XOR_BE(0);
14201399
14211400   readimm16 = m68k_readimm16_delegate(FUNC(m68k_memory_interface::read_immediate_16), this);
r14823r14824
16331612{
16341613   m_space = &space;
16351614   m_direct = &space.direct();
1636   m_cpustate = get_safe_token(&space.device());
1615   m_cpustate = m68k_get_safe_token(&space.device());
16371616   opcode_xor = WORD_XOR_BE(0);
16381617
16391618   readimm16 = m68k_readimm16_delegate(FUNC(m68k_memory_interface::read_immediate_16_mmu), this);
r14823r14824
17601739{
17611740   m_space = &space;
17621741   m_direct = &space.direct();
1763   m_cpustate = get_safe_token(&space.device());
1742   m_cpustate = m68k_get_safe_token(&space.device());
17641743   opcode_xor = WORD_XOR_BE(0);
17651744
17661745   readimm16 = m68k_readimm16_delegate(FUNC(m68k_memory_interface::read_immediate_16_hmmu), this);
r14823r14824
17741753
17751754void m68k_set_reset_callback(device_t *device, m68k_reset_func callback)
17761755{
1777   m68ki_cpu_core *m68k = get_safe_token(device);
1756   m68ki_cpu_core *m68k = m68k_get_safe_token(device);
17781757   m68k->reset_instr_callback = callback;
17791758}
17801759
17811760void m68k_set_cmpild_callback(device_t *device, m68k_cmpild_func callback)
17821761{
1783   m68ki_cpu_core *m68k = get_safe_token(device);
1762   m68ki_cpu_core *m68k = m68k_get_safe_token(device);
17841763   m68k->cmpild_instr_callback = callback;
17851764}
17861765
17871766void m68k_set_rte_callback(device_t *device, m68k_rte_func callback)
17881767{
1789   m68ki_cpu_core *m68k = get_safe_token(device);
1768   m68ki_cpu_core *m68k = m68k_get_safe_token(device);
17901769   m68k->rte_instr_callback = callback;
17911770}
17921771
17931772void m68k_set_tas_callback(device_t *device, m68k_tas_func callback)
17941773{
1795   m68ki_cpu_core *m68k = get_safe_token(device);
1774   m68ki_cpu_core *m68k = m68k_get_safe_token(device);
17961775   m68k->tas_instr_callback = callback;
17971776}
17981777
17991778UINT16 m68k_get_fc(device_t *device)
18001779{
1801   m68ki_cpu_core *m68k = get_safe_token(device);
1780   m68ki_cpu_core *m68k = m68k_get_safe_token(device);
18021781   return m68k->mmu_tmp_fc;
18031782}
18041783
1784UINT16 m68307_get_cs(device_t *device, offs_t address)
1785{
1786   m68ki_cpu_core *m68k = m68k_get_safe_token(device);
18051787
1788   m68k->m68307_currentcs = m68307_calc_cs(m68k, address);
1789
1790   return m68k->m68307_currentcs;
1791}
1792
18061793/****************************************************************************
18071794 * State definition
18081795 ****************************************************************************/
18091796
18101797static void define_state(device_t *device)
18111798{
1812   m68ki_cpu_core *m68k = get_safe_token(device);
1799   m68ki_cpu_core *m68k = m68k_get_safe_token(device);
18131800   UINT32 addrmask = (m68k->cpu_type & MASK_24BIT_SPACE) ? 0xffffff : 0xffffffff;
18141801
18151802   device_state_interface *state;
r14823r14824
18641851
18651852static CPU_INIT( m68000 )
18661853{
1867   m68ki_cpu_core *m68k = get_safe_token(device);
1854   m68ki_cpu_core *m68k = m68k_get_safe_token(device);
18681855
18691856   CPU_INIT_CALL(m68k);
18701857
r14823r14824
19111898
19121899static CPU_INIT( m68301 )
19131900{
1914//  m68ki_cpu_core *m68k = get_safe_token(device);
1901//  m68ki_cpu_core *m68k = m68k_get_safe_token(device);
19151902
19161903   CPU_INIT_CALL(m68000);
19171904
r14823r14824
19361923
19371924static CPU_INIT( m68307 )
19381925{
1939   m68ki_cpu_core *m68k = get_safe_token(device);
1926   m68ki_cpu_core *m68k = m68k_get_safe_token(device);
19401927
19411928   CPU_INIT_CALL(m68000);
19421929
r14823r14824
19441931       set via remappable register
19451932    */
19461933   new(&m68k->memory) m68k_memory_interface;
1947   m68k->memory.init16_68307(*m68k->program);
1934   m68k->memory.init16_m68307(*m68k->program);
19481935
1936   m68k->m68307SIM    = new m68307_sim();
1937   m68k->m68307MBUS   = new m68307_mbus();
1938   m68k->m68307SERIAL = new m68307_serial();
1939   m68k->m68307TIMER  = new m68307_timer();
1940
1941   m68k->m68307SIM->reset();
1942   m68k->m68307MBUS->reset();
1943   m68k->m68307SERIAL->reset();
1944   m68k->m68307TIMER->reset();
1945
1946   m68k->internal = device->space(AS_PROGRAM);
1947   m68k->m68307_base = 0xbfff;
1948   m68k->m68307_scrhigh = 0x0007;
1949   m68k->m68307_scrlow = 0xf010;
19491950}
19501951
1952static READ16_HANDLER( m68307_internal_base_r )
1953{
1954   m68ki_cpu_core *m68k = m68k_get_safe_token(&space->device());
1955
1956   int pc = cpu_get_pc(&space->device());
1957   logerror("%08x m68307_internal_base_r %08x, (%04x)\n", pc, offset*2,mem_mask);
1958
1959   switch (offset<<1)
1960   {
1961      case 0x2: return m68k->m68307_base;
1962      case 0x4: return m68k->m68307_scrhigh;
1963      case 0x6: return m68k->m68307_scrlow;
1964   }
1965
1966   logerror("(read was illegal?)\n");
1967
1968   return 0x0000;
1969}
1970
1971static WRITE16_HANDLER( m68307_internal_base_w )
1972{
1973   m68ki_cpu_core *m68k = m68k_get_safe_token(&space->device());
1974
1975   int pc = cpu_get_pc(&space->device());
1976   logerror("%08x m68307_internal_base_w %08x, %04x (%04x)\n", pc, offset*2,data,mem_mask);
1977   int base = 0;
1978   //int mask = 0;
1979
1980   switch (offset<<1)
1981   {
1982      case 0x2:
1983         /* remove old internal handler */
1984         base = (m68k->m68307_base & 0x0fff) << 12;
1985         //mask = (m68k->m68307_base & 0xe000) >> 13;
1986         //if ( m68k->m68307_base & 0x1000 ) mask |= 7;
1987            m68k->internal->unmap_readwrite(base+0x000, base+0x04f);
1988            m68k->internal->unmap_readwrite(base+0x100, base+0x11f);
1989            m68k->internal->unmap_readwrite(base+0x120, base+0x13f);
1990            m68k->internal->unmap_readwrite(base+0x140, base+0x149);
1991
1992         /* store new base address */
1993         COMBINE_DATA(&m68k->m68307_base);
1994
1995         /* install new internal handler */
1996         base = (m68k->m68307_base & 0x0fff) << 12;
1997         //mask = (m68k->m68307_base & 0xe000) >> 13;
1998         //if ( m68k->m68307_base & 0x1000 ) mask |= 7;     
1999         m68k->internal->install_legacy_readwrite_handler(base + 0x000, base + 0x04f, FUNC(m68307_internal_sim_r),    FUNC(m68307_internal_sim_w));
2000         m68k->internal->install_legacy_readwrite_handler(base + 0x100, base + 0x11f, FUNC(m68307_internal_serial_r), FUNC(m68307_internal_serial_w));
2001         m68k->internal->install_legacy_readwrite_handler(base + 0x120, base + 0x13f, FUNC(m68307_internal_timer_r),  FUNC(m68307_internal_timer_w));
2002         m68k->internal->install_legacy_readwrite_handler(base + 0x140, base + 0x149, FUNC(m68307_internal_mbus_r),   FUNC(m68307_internal_mbus_w));
2003
2004         break;
2005
2006      case 0x4:
2007         COMBINE_DATA(&m68k->m68307_scrhigh);
2008         break;
2009
2010      case 0x6:
2011         COMBINE_DATA(&m68k->m68307_scrlow);
2012         break;
2013
2014      default:
2015         logerror("(write was illegal?)\n");
2016         break;
2017   }
2018}
2019
2020static ADDRESS_MAP_START( m68307_internal_map, AS_PROGRAM, 16 )
2021   AM_RANGE(0x000000f0, 0x000000ff) AM_READWRITE(m68307_internal_base_r, m68307_internal_base_w)
2022ADDRESS_MAP_END
2023
19512024CPU_GET_INFO( m68307 )
19522025{
19532026   switch (state)
19542027   {
2028      case DEVINFO_INT_ADDRBUS_WIDTH + AS_PROGRAM:   info->i = 32;                     break;
2029
19552030      /* --- the following bits of info are returned as pointers to data or functions --- */
19562031      case CPUINFO_FCT_INIT:                  info->init = CPU_INIT_NAME(m68307);            break;
19572032
19582033      /* --- the following bits of info are returned as NULL-terminated strings --- */
19592034      case DEVINFO_STR_NAME:                  strcpy(info->s, "68307");                  break;
19602035
2036      case DEVINFO_PTR_INTERNAL_MEMORY_MAP + AS_PROGRAM: info->internal_map16 = ADDRESS_MAP_NAME(m68307_internal_map); break;
2037
2038
19612039      default:                           CPU_GET_INFO_CALL(m68k);                  break;
19622040   }
19632041}
r14823r14824
19692047
19702048static CPU_INIT( m68008 )
19712049{
1972   m68ki_cpu_core *m68k = get_safe_token(device);
2050   m68ki_cpu_core *m68k = m68k_get_safe_token(device);
19732051
19742052   CPU_INIT_CALL(m68k);
19752053
r14823r14824
20422120
20432121static CPU_INIT( m68010 )
20442122{
2045   m68ki_cpu_core *m68k = get_safe_token(device);
2123   m68ki_cpu_core *m68k = m68k_get_safe_token(device);
20462124
20472125   CPU_INIT_CALL(m68k);
20482126
r14823r14824
20932171
20942172static CPU_INIT( m68020 )
20952173{
2096   m68ki_cpu_core *m68k = get_safe_token(device);
2174   m68ki_cpu_core *m68k = m68k_get_safe_token(device);
20972175
20982176   CPU_INIT_CALL(m68k);
20992177
r14823r14824
21462224// 68020 with 68851 PMMU
21472225static CPU_INIT( m68020pmmu )
21482226{
2149   m68ki_cpu_core *m68k = get_safe_token(device);
2227   m68ki_cpu_core *m68k = m68k_get_safe_token(device);
21502228
21512229   CPU_INIT_CALL(m68020);
21522230
r14823r14824
21772255// 68020 with Apple HMMU & 68881 FPU
21782256static CPU_INIT( m68020hmmu )
21792257{
2180   m68ki_cpu_core *m68k = get_safe_token(device);
2258   m68ki_cpu_core *m68k = m68k_get_safe_token(device);
21812259
21822260   CPU_INIT_CALL(m68020);
21832261
r14823r14824
22112289
22122290static CPU_INIT( m68ec020 )
22132291{
2214   m68ki_cpu_core *m68k = get_safe_token(device);
2292   m68ki_cpu_core *m68k = m68k_get_safe_token(device);
22152293
22162294   CPU_INIT_CALL(m68k);
22172295
r14823r14824
22642342
22652343static CPU_INIT( m68030 )
22662344{
2267   m68ki_cpu_core *m68k = get_safe_token(device);
2345   m68ki_cpu_core *m68k = m68k_get_safe_token(device);
22682346
22692347   CPU_INIT_CALL(m68k);
22702348
r14823r14824
23232401
23242402static CPU_INIT( m68ec030 )
23252403{
2326   m68ki_cpu_core *m68k = get_safe_token(device);
2404   m68ki_cpu_core *m68k = m68k_get_safe_token(device);
23272405
23282406   CPU_INIT_CALL(m68k);
23292407
r14823r14824
23732451
23742452static CPU_INIT( m68040 )
23752453{
2376   m68ki_cpu_core *m68k = get_safe_token(device);
2454   m68ki_cpu_core *m68k = m68k_get_safe_token(device);
23772455
23782456   CPU_INIT_CALL(m68k);
23792457
r14823r14824
24312509
24322510static CPU_INIT( m68ec040 )
24332511{
2434   m68ki_cpu_core *m68k = get_safe_token(device);
2512   m68ki_cpu_core *m68k = m68k_get_safe_token(device);
24352513
24362514   CPU_INIT_CALL(m68k);
24372515
r14823r14824
24812559
24822560static CPU_INIT( m68lc040 )
24832561{
2484   m68ki_cpu_core *m68k = get_safe_token(device);
2562   m68ki_cpu_core *m68k = m68k_get_safe_token(device);
24852563
24862564   CPU_INIT_CALL(m68k);
24872565
r14823r14824
25312609
25322610static CPU_INIT( scc68070 )
25332611{
2534   m68ki_cpu_core *m68k = get_safe_token(device);
2612   m68ki_cpu_core *m68k = m68k_get_safe_token(device);
25352613
25362614   CPU_INIT_CALL(m68010);
25372615
r14823r14824
25592637 * Freescale M68340 section
25602638 ****************************************************************************/
25612639
2640static READ32_HANDLER( m68340_internal_base_r )
2641{
25622642
2643
2644   int pc = cpu_get_pc(&space->device());
2645   logerror("%08x m68340_internal_base_r %08x, (%04x)\n", pc, offset*4,mem_mask);
2646   return 0x55555555;
2647}
2648
2649static WRITE32_HANDLER( m68340_internal_base_w )
2650{
2651   m68ki_cpu_core *m68k = m68k_get_safe_token(&space->device());
2652
2653   int pc = cpu_get_pc(&space->device());
2654   logerror("%08x m68340_internal_base_w %08x, %04x (%04x)\n", pc, offset*4,data,mem_mask);
2655
2656   // other conditions?
2657   if (m68k->dfc==0x7)
2658   {
2659      // unmap old modules
2660      if (m68k->m68340_base&1)
2661      {
2662         int base = m68k->m68340_base & 0xfffff000;
2663
2664         m68k->internal->unmap_readwrite(base + 0x000, base + 0x05f);
2665         m68k->internal->unmap_readwrite(base + 0x600, base + 0x67f);
2666         m68k->internal->unmap_readwrite(base + 0x700, base + 0x723);
2667         m68k->internal->unmap_readwrite(base + 0x780, base + 0x7bf);
2668
2669      }
2670
2671      COMBINE_DATA(&m68k->m68340_base);
2672      logerror("%08x m68340_internal_base_w %08x, %04x (%04x) (m68340_base write)\n", pc, offset*4,data,mem_mask);
2673
2674      // map new modules
2675      if (m68k->m68340_base&1)
2676      {
2677         int base = m68k->m68340_base & 0xfffff000;
2678
2679         m68k->internal->install_legacy_readwrite_handler(base + 0x000, base + 0x05f, FUNC(m68340_internal_sim_r),    FUNC(m68340_internal_sim_w));
2680         m68k->internal->install_legacy_readwrite_handler(base + 0x600, base + 0x67f, FUNC(m68340_internal_timer_r),  FUNC(m68340_internal_timer_w));
2681         m68k->internal->install_legacy_readwrite_handler(base + 0x700, base + 0x723, FUNC(m68340_internal_serial_r), FUNC(m68340_internal_serial_w));
2682         m68k->internal->install_legacy_readwrite_handler(base + 0x780, base + 0x7bf, FUNC(m68340_internal_dma_r),    FUNC(m68340_internal_dma_w));
2683
2684      }
2685
2686   }
2687   else
2688   {
2689      logerror("%08x m68340_internal_base_w %08x, %04x (%04x) (should fall through?)\n", pc, offset*4,data,mem_mask);
2690   }
2691
2692
2693
2694}
2695
2696
2697static ADDRESS_MAP_START( m68340_internal_map, AS_PROGRAM, 32 )
2698   AM_RANGE(0x0003ff00, 0x0003ff03) AM_READWRITE( m68340_internal_base_r, m68340_internal_base_w)
2699ADDRESS_MAP_END
2700
25632701static CPU_INIT( m68340 )
25642702{
2565   m68ki_cpu_core *m68k = get_safe_token(device);
2703   m68ki_cpu_core *m68k = m68k_get_safe_token(device);
25662704
25672705   CPU_INIT_CALL(m68k);
25682706
r14823r14824
25872725   m68k->cyc_shift        = 0;
25882726   m68k->cyc_reset        = 518;
25892727
2728   m68k->m68340SIM    = new m68340_sim();
2729   m68k->m68340DMA    = new m68340_dma();
2730   m68k->m68340SERIAL = new m68340_serial();
2731   m68k->m68340TIMER  = new m68340_timer();
2732
2733   m68k->m68340SIM->reset();
2734   m68k->m68340DMA->reset();
2735   m68k->m68340SERIAL->reset();
2736   m68k->m68340TIMER->reset();
2737
2738   m68k->m68340_base = 0x00000000;
2739
2740   m68k->internal = device->space(AS_PROGRAM);
2741
25902742   define_state(device);
25912743}
25922744
r14823r14824
26022754      case DEVINFO_INT_DATABUS_WIDTH + AS_PROGRAM:         info->i = 32;                     break;
26032755      case DEVINFO_INT_ADDRBUS_WIDTH + AS_PROGRAM:      info->i = 32;                     break;
26042756
2757      case DEVINFO_PTR_INTERNAL_MEMORY_MAP + AS_PROGRAM: info->internal_map32 = ADDRESS_MAP_NAME(m68340_internal_map); break;
2758
26052759      /* --- the following bits of info are returned as pointers to data or functions --- */
26062760      case CPUINFO_FCT_INIT:         info->init = CPU_INIT_NAME(m68340);                  break;
26072761
r14823r14824
26192773
26202774static CPU_INIT( coldfire )
26212775{
2622   m68ki_cpu_core *m68k = get_safe_token(device);
2776   m68ki_cpu_core *m68k = m68k_get_safe_token(device);
26232777
26242778   CPU_INIT_CALL(m68k);
26252779
src/emu/cpu/cpu.mak
r14823r14824
11061106
11071107ifneq ($(filter M680X0,$(CPUS)),)
11081108OBJDIRS += $(CPUOBJ)/m68000
1109CPUOBJS += $(CPUOBJ)/m68000/m68kcpu.o $(CPUOBJ)/m68000/m68kops.o
1109CPUOBJS += $(CPUOBJ)/m68000/m68kcpu.o $(CPUOBJ)/m68000/m68kops.o \
1110   $(CPUOBJ)/m68000/68307sim.o \
1111   $(CPUOBJ)/m68000/68307bus.o \
1112   $(CPUOBJ)/m68000/68307ser.o \
1113   $(CPUOBJ)/m68000/68307tmu.o \
1114   $(CPUOBJ)/m68000/68340sim.o \
1115   $(CPUOBJ)/m68000/68340dma.o \
1116   $(CPUOBJ)/m68000/68340ser.o \
1117   $(CPUOBJ)/m68000/68340tmu.o \
1118
11101119DASMOBJS += $(CPUOBJ)/m68000/m68kdasm.o
11111120M68KMAKE = $(BUILDOUT)/m68kmake$(BUILD_EXE)
11121121endif
r14823r14824
11421151
11431152# m68kcpu.h now includes m68kops.h; m68kops.h won't exist until m68kops.c has been made
11441153$(CPUSRC)/m68000/m68kcpu.h: $(CPUOBJ)/m68000/m68kops.c
1154$(CPUSRC)/m68000/68307sim.c: $(CPUOBJ)/m68000/m68kops.c
1155$(CPUSRC)/m68000/68307bus.c: $(CPUOBJ)/m68000/m68kops.c
1156$(CPUSRC)/m68000/68307ser.c: $(CPUOBJ)/m68000/m68kops.c
1157$(CPUSRC)/m68000/68307tmu.c: $(CPUOBJ)/m68000/m68kops.c
1158$(CPUSRC)/m68000/68340sim.c: $(CPUOBJ)/m68000/m68kops.c
1159$(CPUSRC)/m68000/68340dma.c: $(CPUOBJ)/m68000/m68kops.c
1160$(CPUSRC)/m68000/68340ser.c: $(CPUOBJ)/m68000/m68kops.c
1161$(CPUSRC)/m68000/68340tmu.c: $(CPUOBJ)/m68000/m68kops.c
11451162
11461163
11471164#-------------------------------------------------
src/emu/video/pc_vga.c
r14823r14824
27462746
27472747   vga_mem_w(space,offset,data);
27482748}
2749
2750/******************************************
2751
2752gamtor.c implementation (TODO: identify the video card)
2753
2754******************************************/
2755
2756READ8_HANDLER(vga_gamtor_mem_r)
2757{
2758   return vga.memory[offset];
2759}
2760
2761WRITE8_HANDLER(vga_gamtor_mem_w)
2762{
2763   vga.memory[offset] = data;
2764}
2765
2766
2767READ8_HANDLER(vga_port_gamtor_03b0_r)
2768{
2769   UINT8 res;
2770
2771   switch(offset)
2772   {
2773      default:
2774         res = vga_port_03b0_r(space,offset ^ 3);
2775         break;
2776   }
2777
2778   return res;
2779}
2780
2781WRITE8_HANDLER(vga_port_gamtor_03b0_w)
2782{
2783   switch(offset)
2784   {
2785      default:
2786         vga_port_03b0_w(space,offset ^ 3,data);
2787         break;
2788   }
2789}
2790
2791READ8_HANDLER(vga_port_gamtor_03c0_r)
2792{
2793   UINT8 res;
2794
2795   switch(offset)
2796   {
2797      default:
2798         res = vga_port_03c0_r(space,offset ^ 3);
2799         break;
2800   }
2801
2802   return res;
2803}
2804
2805WRITE8_HANDLER(vga_port_gamtor_03c0_w)
2806{
2807   switch(offset)
2808   {
2809      default:
2810         vga_port_03c0_w(space,offset ^ 3,data);
2811         break;
2812   }
2813}
2814
2815READ8_HANDLER(vga_port_gamtor_03d0_r)
2816{
2817   UINT8 res;
2818
2819   switch(offset)
2820   {
2821      default:
2822         res = vga_port_03d0_r(space,offset ^ 3);
2823         break;
2824   }
2825
2826   return res;
2827}
2828
2829WRITE8_HANDLER(vga_port_gamtor_03d0_w)
2830{
2831   switch(offset)
2832   {
2833      default:
2834         vga_port_03d0_w(space,offset ^ 3,data);
2835         break;
2836   }
2837}
2838
2839void pc_vga_gamtor_io_init(running_machine &machine, address_space *mem_space, offs_t mem_offset, address_space *io_space, offs_t port_offset)
2840{
2841   int buswidth;
2842   UINT64 mask = 0;
2843
2844   buswidth = machine.firstcpu->memory().space_config(AS_PROGRAM)->m_databus_width;
2845   switch(buswidth)
2846   {
2847      case 8:
2848         mask = 0;
2849         break;
2850
2851      case 16:
2852         mask = 0xffff;
2853         break;
2854
2855      case 32:
2856         mask = 0xffffffff;
2857         break;
2858
2859      case 64:
2860         mask = -1;
2861         break;
2862
2863      default:
2864         fatalerror("VGA: Bus width %d not supported", buswidth);
2865         break;
2866   }
2867   io_space->install_legacy_readwrite_handler(port_offset + 0x3b0, port_offset + 0x3bf, FUNC(vga_port_gamtor_03b0_r), FUNC(vga_port_gamtor_03b0_w), mask);
2868   io_space->install_legacy_readwrite_handler(port_offset + 0x3c0, port_offset + 0x3cf, FUNC(vga_port_gamtor_03c0_r), FUNC(vga_port_gamtor_03c0_w), mask);
2869   io_space->install_legacy_readwrite_handler(port_offset + 0x3d0, port_offset + 0x3df, FUNC(vga_port_gamtor_03d0_r), FUNC(vga_port_gamtor_03d0_w), mask);
2870
2871   mem_space->install_legacy_readwrite_handler(mem_offset + 0x00000, mem_offset + 0x1ffff, FUNC(vga_gamtor_mem_r), FUNC(vga_gamtor_mem_w), mask);
2872}
2873
src/emu/video/pc_vga.h
r14823r14824
2525
2626void pc_vga_init(running_machine &machine, read8_space_func read_dipswitch, const struct pc_svga_interface *svga_intf);
2727void pc_vga_io_init(running_machine &machine, address_space *mem_space, offs_t mem_offset, address_space *io_space, offs_t port_offset);
28void pc_vga_gamtor_io_init(running_machine &machine, address_space *mem_space, offs_t mem_offset, address_space *io_space, offs_t port_offset);
2829void pc_svga_trident_io_init(running_machine &machine, address_space *mem_space, offs_t mem_offset, address_space *io_space, offs_t port_offset);
2930void pc_vga_reset(running_machine &machine);
3031void *pc_vga_memory(void);
src/lib/libjpeg/jpeglib.h
r14823r14824
1111 * and perhaps jerror.h if they want to know the exact error codes.
1212 */
1313 
14#ifdef USE_SYSTEM_JPEGLIB
15#ifndef XMD_H
16#define XMD_H
17#endif
18#include <jpeglib.h>
19#else
20 
1421#ifndef JPEGLIB_H
1522#define JPEGLIB_H
1623 
r14823r14824
11561163}
11571164#endif
11581165#endif
1159 
11601166#endif /* JPEGLIB_H */
1167#endif /* USE_SYSTEM_JPEGLIB */
src/lib/util/flac.h
r14823r14824
4444
4545#include "osdcore.h"
4646#include "corefile.h"
47
48#ifdef FLAC__NO_DLL
4749#include "../../lib/libflac/include/flac/all.h"
50#else
51#include <FLAC/all.h>
52#endif
4853
4954
5055//**************************************************************************

Previous 15994 Revisions Next


© 1998-2018 The MESS Team