Previous 15994 Revisions Next

r9823 Sunday 26th December, 2010 at 14:54:41 UTC by Tim Schuerewegen
[GIZMONDO] Added driver.
[docs]messnew.txt
[src/mess]mess.mak messdriv.c
[src/mess/drivers]gizmondo.c*
[src/mess/machine]docg3.c* docg3.h*
[src/mess/video]gf4500.c* gf4500.h*

src/mess/machine/docg3.c
r0r9823
1/*
2 
3    M-Systems DiskOnChip G3 - Flash Disk with MLC NAND and M-Systems’ x2 Technology
4 
5    (c) 2009 Tim Schuerewegen
6 
7*/
8 
9#include "emu.h"
10#include "machine/docg3.h"
11 
12#define VERBOSE_LEVEL ( 0 )
13 
14INLINE void ATTR_PRINTF(3,4) verboselog( running_machine *machine, int n_level, const char *s_fmt, ... )
15{
16   if( VERBOSE_LEVEL >= n_level )
17   {
18      va_list v;
19      char buf[ 32768 ];
20      va_start( v, s_fmt );
21      vsprintf( buf, s_fmt, v );
22      va_end( v );
23      logerror( "%s: %s", cpuexec_describe_context(machine), buf );
24   }
25}
26 
27/***************************************************************************
28    TYPE DEFINITIONS
29***************************************************************************/
30 
31typedef struct _diskonchip_g3_t diskonchip_g3_t;
32struct _diskonchip_g3_t
33{
34   UINT32 planes;
35   UINT32 blocks;
36   UINT32 pages;
37   UINT32 user_data_size;
38   UINT32 extra_area_size;
39   UINT8 *data[3];
40   UINT32 data_size[3];
41   UINT8 sec_2[0x800];
42   UINT32 data_1036;
43   UINT32 data_1036_count;
44   UINT32 transfer_offset;
45   UINT8 device;
46   UINT32 block;
47   UINT32 page;
48   UINT32 plane;
49   UINT32 transfersize;
50   UINT8 test;
51   UINT32 address_count;
52};
53 
54/***************************************************************************
55    PROTOTYPES
56***************************************************************************/
57 
58static DEVICE_NVRAM( diskonchip_g3 );
59 
60/***************************************************************************
61    INLINE FUNCTIONS
62***************************************************************************/
63 
64INLINE diskonchip_g3_t *get_token( running_device *device)
65{
66   assert(device != NULL);
67   assert(device->type == DISKONCHIP_G3);
68   assert(device->token != NULL);
69   return (diskonchip_g3_t *)downcast<legacy_device_base *>(device)->token();
70}
71 
72INLINE const diskonchip_g3_config *get_config( running_device *device)
73{
74   assert(device != NULL);
75   assert(device->type == DISKONCHIP_G3);
76   assert(device->inline_config != NULL);
77   return (const diskonchip_g3_config *)downcast<const legacy_device_config_base &>(device->baseconfig()).inline_config();
78}
79 
80/***************************************************************************
81    IMPLEMENTATION
82***************************************************************************/
83 
84static UINT32 diskonchip_g3_offset_data_1( running_device *device)
85{
86   diskonchip_g3_t *doc = get_token( device);
87//   printf( "block %d pages %d page %d planes %d plane %d user_data_size %d extra_area_size %d\n", doc->block, doc->pages, doc->page, doc->planes, doc->plane, doc->user_data_size, doc->extra_area_size);
88   return ((((doc->block * doc->pages) + doc->page) * doc->planes) + doc->plane) * (doc->user_data_size + doc->extra_area_size);
89}
90 
91static UINT32 diskonchip_g3_offset_data_2( running_device *device)
92{
93   diskonchip_g3_t *doc = get_token( device);
94   return ((((doc->block * doc->pages) + doc->page) * doc->planes) + doc->plane) * 16;
95}
96 
97static UINT32 diskonchip_g3_offset_data_3( running_device *device)
98{
99   diskonchip_g3_t *doc = get_token( device);
100   return doc->block * 8;
101}
102 
103static UINT8 diskonchip_g3_read_data( running_device *device)
104{
105   diskonchip_g3_t *doc = get_token( device);
106   UINT8 data = 0;
107   UINT32 offset;
108   if (doc->test == 0)
109   {
110      // read page data (512 + 16)
111      if (doc->transfer_offset >= (doc->user_data_size + doc->extra_area_size))
112      {
113         doc->transfer_offset = doc->transfer_offset - (doc->user_data_size + doc->extra_area_size);
114         doc->plane++;
115      }
116      offset = diskonchip_g3_offset_data_1( device) + doc->transfer_offset;
117      data = doc->data[0][offset];
118   }
119   else if (doc->test == 1)
120   {
121      // read ??? (0x28 bytes)
122      if (doc->transfer_offset < 0x20)
123      {
124         offset = diskonchip_g3_offset_data_1( device) + (doc->user_data_size + doc->extra_area_size) + (doc->user_data_size - 16) + doc->transfer_offset;
125         data = doc->data[0][offset];
126      }
127      else if (doc->transfer_offset < 0x28)
128      {
129         offset = diskonchip_g3_offset_data_3( device) + doc->transfer_offset - 0x20;
130         data = doc->data[2][offset];
131      }
132      else
133      {
134         data = 0xFF;
135      }
136   }
137   else if (doc->test == 2)
138   {
139      // read erase block status
140      data = 0x00;
141   }
142   doc->transfer_offset++;
143   return data;
144}
145 
146READ16_DEVICE_HANDLER( diskonchip_g3_sec_1_r )
147{
148   diskonchip_g3_t *doc = get_token( device);
149   UINT16 data;
150   if (doc->sec_2[0x1B] & 0x40)
151   {
152      data = diskonchip_g3_read_data( device);
153      doc->sec_2[0x1B] &= ~0x40;
154   }
155   else
156   {
157      data = (diskonchip_g3_read_data( device) << 0) | (diskonchip_g3_read_data( device) << 8);
158   }
159   verboselog( device->machine, 9, "(DOC) %08X -> %04X\n", 0x0800 + (offset << 1), data);
160   return data;
161}
162 
163static void diskonchip_g3_write_data( running_device *device, UINT8 data)
164{
165   diskonchip_g3_t *doc = get_token( device);
166   UINT32 offset;
167   if (doc->test == 3)
168   {
169      // read page data (512 + 16)
170      if (doc->transfer_offset >= (doc->user_data_size + doc->extra_area_size))
171      {
172         doc->transfer_offset = doc->transfer_offset - (doc->user_data_size + doc->extra_area_size);
173         doc->plane++;
174      }
175      if (doc->transfer_offset == 0)
176      {
177         const UINT8 xxx[] = { 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
178         offset = diskonchip_g3_offset_data_2( device);
179         memcpy( doc->data[1] + offset, xxx, 16);
180      }
181      offset = diskonchip_g3_offset_data_1( device) + doc->transfer_offset;
182      doc->data[0][offset] = data;
183   }
184   doc->transfer_offset++;
185}
186 
187WRITE16_DEVICE_HANDLER( diskonchip_g3_sec_1_w )
188{
189   diskonchip_g3_t *doc = get_token( device);
190   verboselog( device->machine, 9, "(DOC) %08X <- %04X\n", 0x0800 + (offset << 1), data);
191   if (doc->sec_2[0x1B] & 0x40)
192   {
193      diskonchip_g3_write_data( device, data);
194      doc->sec_2[0x1B] &= ~0x40;
195   }
196   else
197   {
198      diskonchip_g3_write_data( device, (data >> 0) & 0xFF);
199      diskonchip_g3_write_data( device, (data >> 8) & 0xFF);
200   }
201}
202 
203// #define DoC_G3_IO 0x0800
204// #define DoC_G3_ChipID 0x1000
205// #define DoC_G3_DeviceIdSelect 0x100a
206// #define DoC_G3_Ctrl 0x100c
207// #define DoC_G3_CtrlConfirm 0x1072
208// #define DoC_G3_ReadAddress 0x101a
209// #define DoC_G3_FlashSelect 0x1032
210// #define DoC_G3_FlashCmd 0x1034
211// #define DoC_G3_FlashAddr 0x1036
212// #define DoC_G3_FlashCtrl 0x1038
213// #define DoC_G3_Nop 0x103e
214 
215static UINT16 diskonchip_sec_2_read_1000( running_device *device)
216{
217   diskonchip_g3_t *doc = get_token( device);
218   if (doc->device == 0)
219   {
220      return 0x0200;
221   }
222   else
223   {
224      return 0x008C;
225   }
226}
227 
228static UINT16 diskonchip_sec_2_read_1074( running_device *device)
229{
230   diskonchip_g3_t *doc = get_token( device);
231   if (doc->device == 0)
232   {
233      return 0xFDFF;
234   }
235   else
236   {
237      return 0x02B3;
238   }
239}
240 
241static UINT8 diskonchip_sec_2_read_1042( running_device *device)
242{
243   diskonchip_g3_t *doc = get_token( device);
244   UINT8 data;
245   if ((doc->block == 0) && (doc->page == 0) && (doc->transfersize == 0x27))
246   {
247      data = 0x07;
248   }
249   else
250   {
251      UINT32 offset = diskonchip_g3_offset_data_2( device) + 0x02;
252      data = doc->data[1][offset]; //0x07; //data & ~(1 << 7);
253      if ((doc->sec_2[0x41] & 0x10) == 0)
254      {
255         data = data & ~0x20;
256      }
257      if ((doc->sec_2[0x41] & 0x08) == 0)
258      {
259         data = data & ~0x80;
260      }
261      if (doc->test != 0)
262      {
263         data = 0x00;
264      }
265   }
266   return data;
267}
268 
269static UINT8 diskonchip_sec_2_read_1046( running_device *device)
270{
271   diskonchip_g3_t *doc = get_token( device);
272   if (doc->test == 0)
273   {
274      UINT32 offset = diskonchip_g3_offset_data_2( device) + 0x06;
275      return doc->data[1][offset];
276   }
277   else
278   {
279      return 0x00;
280   }
281}
282 
283static UINT8 diskonchip_sec_2_read_1048( running_device *device)
284{
285   diskonchip_g3_t *doc = get_token( device);
286   if (doc->test == 0)
287   {
288      UINT32 offset = diskonchip_g3_offset_data_2( device) + 0x08;
289      return doc->data[1][offset];
290   }
291   else
292   {
293      return 0x00;
294   }
295}
296 
297static UINT8 diskonchip_sec_2_read_1049( running_device *device)
298{
299   diskonchip_g3_t *doc = get_token( device);
300   if (doc->test == 0)
301   {
302      UINT32 offset = diskonchip_g3_offset_data_2( device) + 0x09;
303      return doc->data[1][offset];
304   }
305   else
306   {
307      return 0x00;
308   }
309}
310 
311static UINT8 diskonchip_sec_2_read_104A( running_device *device)
312{
313   diskonchip_g3_t *doc = get_token( device);
314   if (doc->test == 0)
315   {
316      UINT32 offset = diskonchip_g3_offset_data_2( device) + 0x0A;
317      return doc->data[1][offset];
318   }
319   else
320   {
321      return 0x00;
322   }
323}
324 
325static UINT8 diskonchip_sec_2_read_104B( running_device *device)
326{
327   diskonchip_g3_t *doc = get_token( device);
328   if (doc->test == 0)
329   {
330      UINT32 offset = diskonchip_g3_offset_data_2( device) + 0x0B;
331      return doc->data[1][offset];
332   }
333   else
334   {
335      return 0x00;
336   }
337}
338 
339static UINT8 diskonchip_sec_2_read_104C( running_device *device)
340{
341   diskonchip_g3_t *doc = get_token( device);
342   if (doc->test == 0)
343   {
344      UINT32 offset = diskonchip_g3_offset_data_2( device) + 0x0C;
345      return doc->data[1][offset];
346   }
347   else
348   {
349      return 0x00;
350   }
351}
352 
353static UINT8 diskonchip_sec_2_read_104D( running_device *device)
354{
355   diskonchip_g3_t *doc = get_token( device);
356   if (doc->test == 0)
357   {
358      UINT32 offset = diskonchip_g3_offset_data_2( device) + 0x0D;
359      return doc->data[1][offset];
360   }
361   else
362   {
363      return 0x00;
364   }
365}
366 
367static UINT8 diskonchip_sec_2_read_104E( running_device *device)
368{
369   diskonchip_g3_t *doc = get_token( device);
370   if (doc->test == 0)
371   {
372      UINT32 offset = diskonchip_g3_offset_data_2( device) + 0x0E;
373      return doc->data[1][offset];
374   }
375   else
376   {
377      return 0x00;
378   }
379}
380 
381static UINT8 diskonchip_sec_2_read_104F( running_device *device)
382{
383   diskonchip_g3_t *doc = get_token( device);
384   if (doc->test == 0)
385   {
386      UINT32 offset = diskonchip_g3_offset_data_2( device) + 0x0F;
387      return doc->data[1][offset];
388   }
389   else
390   {
391      return 0x00;
392   }
393}
394 
395static UINT8 diskonchip_sec_2_read_100E( running_device *device)
396{
397   return 0x81;
398}
399 
400static UINT8 diskonchip_sec_2_read_1014( running_device *device)
401{
402   return 0x01;
403}
404 
405static UINT8 diskonchip_sec_2_read_1022( running_device *device)
406{
407   return 0x85;
408}
409 
410static UINT8 diskonchip_sec_2_read_1038( running_device *device)
411{
412   // bit 0 = ?
413   // bit 1 = ? error 0x7C
414   // bit 2 = ? error 0x73
415   // bit 3 = ?
416   // bit 4 = ?
417   // bit 5 = ?
418   // bit 6 = ?
419   // bit 7 = ?
420   diskonchip_g3_t *doc = get_token( device);
421   if (doc->device == 0)
422   {
423      return 0x19;
424   }
425   else
426   {
427      return 0x38;
428   }
429}
430 
431static UINT16 diskonchip_sec_2_read16( running_device *device, UINT32 offset)
432{
433   diskonchip_g3_t *doc = get_token( device);
434   UINT16 data = (doc->sec_2[offset+0] << 0) + (doc->sec_2[offset+1] << 8);
435   switch (0x1000 + offset)
436   {
437      // ?
438      case 0x1000 : data = diskonchip_sec_2_read_1000( device); break;
439      // ?
440      case 0x100E : data = diskonchip_sec_2_read_100E( device); break;
441      // ?
442      case 0x1014 : data = diskonchip_sec_2_read_1014( device); break;
443      // ?
444      case 0x1022 : data = diskonchip_sec_2_read_1022( device); break;
445      // flash control
446      case 0x1038 : data = diskonchip_sec_2_read_1038( device); break;
447      // flash ?
448      case 0x1042 : data = diskonchip_sec_2_read_1042( device); break;
449      // ?
450      case 0x1046 : data = diskonchip_sec_2_read_1046( device); break;
451      // ?
452      case 0x1048 : data = (diskonchip_sec_2_read_1048( device) << 0) + (diskonchip_sec_2_read_1049( device) << 8); break;
453      case 0x104A : data = (diskonchip_sec_2_read_104A( device) << 0) + (diskonchip_sec_2_read_104B( device) << 8); break;
454      case 0x104C : data = (diskonchip_sec_2_read_104C( device) << 0) + (diskonchip_sec_2_read_104D( device) << 8); break;
455      case 0x104E : data = (diskonchip_sec_2_read_104E( device) << 0) + (diskonchip_sec_2_read_104F( device) << 8); break;
456      // ?
457      case 0x1074 : data = diskonchip_sec_2_read_1074( device); break;
458   }
459   verboselog( device->machine, 9, "(DOC) %08X -> %04X\n", 0x1000 + offset, data);
460   return data;
461}
462 
463static UINT8 diskonchip_sec_2_read8( running_device *device, UINT32 offset)
464{
465   diskonchip_g3_t *doc = get_token( device);
466   UINT8 data = doc->sec_2[offset];
467   switch (0x1000 + offset)
468   {
469      // ?
470      case 0x100E : data = diskonchip_sec_2_read_100E( device); break;
471      // ?
472      case 0x1014 : data = diskonchip_sec_2_read_1014( device); break;
473      // ?
474      case 0x1022 : data = diskonchip_sec_2_read_1022( device); break;
475      // flash control
476      case 0x1038 : data = diskonchip_sec_2_read_1038( device); break;
477      // flash ?
478      case 0x1042 : data = diskonchip_sec_2_read_1042( device); break;
479      // ?
480      case 0x1046 : data = diskonchip_sec_2_read_1046( device); break;
481      // ?
482      case 0x1048 : data = diskonchip_sec_2_read_1048( device); break;
483      case 0x1049 : data = diskonchip_sec_2_read_1049( device); break;
484      case 0x104A : data = diskonchip_sec_2_read_104A( device); break;
485      case 0x104B : data = diskonchip_sec_2_read_104B( device); break;
486      case 0x104C : data = diskonchip_sec_2_read_104C( device); break;
487      case 0x104D : data = diskonchip_sec_2_read_104D( device); break;
488      case 0x104E : data = diskonchip_sec_2_read_104E( device); break;
489      case 0x104F : data = diskonchip_sec_2_read_104F( device); break;
490   }
491   verboselog( device->machine, 9, "(DOC) %08X -> %02X\n", 0x1000 + offset, data);
492   return data;
493}
494 
495static void diskonchip_sec_2_write_100C( running_device *device, UINT8 data)
496{
497   diskonchip_g3_t *doc = get_token( device);
498   const char *mode_name[] = { "reset", "normal", "deep power down" };
499   UINT32 mode = data & 3;
500   verboselog( device->machine, 5, "mode %d (%s)\n", mode, mode_name[mode]);
501   if (mode == 0)
502   {
503      doc->sec_2[0x04] = 00;
504   }
505}
506 
507static void diskonchip_sec_2_write_1032( running_device *device, UINT8 data)
508{
509   diskonchip_g3_t *doc = get_token( device);
510   verboselog( device->machine, 5, "flash select %02X\n", data);
511   if ((data == 0x12) || (data == 0x27))
512   {
513      doc->transfer_offset = 0;
514      doc->plane = 0;
515      doc->block = 0;
516      doc->page = 0;
517   }
518}
519 
520static void diskonchip_g3_erase_block( running_device *device)
521{
522   diskonchip_g3_t *doc = get_token( device);
523   UINT32 offset;
524   int i, j;
525   const UINT8 xxx[] = { 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 0xCE, 0x00, 0xCF, 0x72, 0xFC, 0x1B, 0xA9, 0xC7, 0xB9, 0x00 };
526   verboselog( device->machine, 5, "erase block %04X\n", doc->block);
527   for (i=0;i<doc->pages;i++)
528   {
529      doc->page = i;
530      for (j=0;j<2;j++)
531      {
532         doc->plane = j;
533         offset = diskonchip_g3_offset_data_1( device);
534         memset( doc->data[0] + offset, 0xFF, (doc->user_data_size + doc->extra_area_size));
535         offset = diskonchip_g3_offset_data_2( device);
536         memcpy( doc->data[1] + offset, xxx, 16);
537      }
538   }
539}
540 
541// 'maincpu' (028848E4): diskonchip_sec_2_write_1034: unknown value 60/27
542// 'maincpu' (028848E4): diskonchip_sec_2_write_1034: unknown value D0/27
543// 'maincpu' (028848E4): diskonchip_sec_2_write_1034: unknown value 71/31
544// 'maincpu' (028848E4): diskonchip_sec_2_write_1034: unknown value 80/1D
545// 'maincpu' (028848E4): diskonchip_sec_2_write_1034: unknown value 11/1D
546// 'maincpu' (028848E4): diskonchip_sec_2_write_1034: unknown value 10/1D
547 
548static void diskonchip_sec_2_write_1034( running_device *device, UINT8 data)
549{
550   diskonchip_g3_t *doc = get_token( device);
551   verboselog( device->machine, 5, "flash command %02X\n", data);
552   if ((doc->sec_2[0x32] == 0x0E) && (data == 0x00))
553   {
554      doc->test = 0;
555      doc->address_count = 0;
556   }
557   else if ((doc->sec_2[0x32] == 0x10) && (data == 0x50))
558   {
559      doc->test = 1;
560      doc->address_count = 0;
561   }
562   else if ((doc->sec_2[0x32] == 0x03) && (data == 0x3C))
563   {
564      // do nothing
565   }
566   else if ((doc->sec_2[0x32] == 0x00) && (data == 0xFF))
567   {
568      doc->address_count = 0;
569   }
570   else if (doc->sec_2[0x32] == 0x09)
571   {
572       if (data == 0x22)
573       {
574         // do nothing
575       }
576       else if (data == 0xA2)
577       {
578         // do nothing
579       }
580       else
581       {
582         verboselog( device->machine, 0, "diskonchip_sec_2_write_1034: unknown value %02X/%02X\n", data, doc->sec_2[0x32]);
583       }
584   }
585   else if (doc->sec_2[0x32] == 0x12)
586   {
587       if (data == 0x60)
588       {
589         doc->data_1036 = 0;
590         doc->data_1036_count = 0;
591         doc->address_count++;
592       }
593       else if (data == 0x30)
594       {
595         // do nothing
596       }
597       else if (data == 0x05)
598       {
599         // do nothing
600       }
601       else if (data == 0xE0)
602       {
603         // do nothing
604       }
605       else
606       {
607         verboselog( device->machine, 0, "diskonchip_sec_2_write_1034: unknown value %02X/%02X\n", data, doc->sec_2[0x32]);
608       }
609   }
610   else if (doc->sec_2[0x32] == 0x27)
611   {
612       if (data == 0x60)
613       {
614         doc->data_1036 = 0;
615         doc->data_1036_count = 0;
616         doc->address_count++;
617       }
618       else if (data == 0xD0)
619       {
620         diskonchip_g3_erase_block( device);
621       }
622       else
623       {
624         verboselog( device->machine, 0, "diskonchip_sec_2_write_1034: unknown value %02X/%02X\n", data, doc->sec_2[0x32]);
625       }
626   }
627   else if ((doc->sec_2[0x32] == 0x31) && (data == 0x71))
628   {
629      // erase block status? (after: read one byte from 08xx, bit 0/1/2 is checked)
630      doc->test = 2;
631   }
632   else if (doc->sec_2[0x32] == 0x1D)
633   {
634       if (data == 0x80)
635       {
636         doc->data_1036 = 0;
637         doc->data_1036_count = 0;
638         doc->address_count++;
639       }
640       else if (data == 0x11)
641       {
642         doc->test = 3;
643       }
644       else
645       {
646         verboselog( device->machine, 0, "diskonchip_sec_2_write_1034: unknown value %02X/%02X\n", data, doc->sec_2[0x32]);
647       }
648   }
649   else
650   {
651      verboselog( device->machine, 0, "diskonchip_sec_2_write_1034: unknown value %02X/%02X\n", data, doc->sec_2[0x32]);
652   }
653}
654 
655static void diskonchip_sec_2_write_1036( running_device *device, UINT8 data)
656{
657   diskonchip_g3_t *doc = get_token( device);
658   if (doc->sec_2[0x34] == 0x60)
659   {
660      doc->data_1036 |= data << (8 * doc->data_1036_count++);
661      if (doc->data_1036_count == 3)
662      {
663         UINT32 block, page, plane;
664         block = (doc->data_1036 >> 7);
665         if (block >= doc->blocks) fatalerror( "DOCG3: invalid block (%d)", block);
666         plane = (doc->data_1036 >> 6) & 1;
667         page = (doc->data_1036 >> 0) & 0x3F;
668         verboselog( device->machine, 5, "flash address %d - %06X (plane %d block %04X page %04X)\n", doc->address_count, doc->data_1036, plane, block, page);
669         if (doc->address_count == 1)
670         {
671            doc->plane = 0;
672            doc->block = block;
673            doc->page = page;
674         }
675      }
676   }
677   else if (doc->sec_2[0x34] == 0x80)
678   {
679      doc->data_1036 |= data << (8 * doc->data_1036_count++);
680      if (doc->data_1036_count == 4)
681      {
682         UINT32 block, page, plane, unk;
683         block = (doc->data_1036 >> 15);
684         plane = (doc->data_1036 >> 14) & 1;
685         page = (doc->data_1036 >> 8) & 0x3F;
686         unk = (doc->data_1036 >> 0) & 0xFF;
687         verboselog( device->machine, 5, "flash address %d - %08X (plane %d block %04X page %04X unk %02X)\n", doc->address_count, doc->data_1036, plane, block, page, unk);
688         if (doc->address_count == 1)
689         {
690            doc->plane = 0;
691            doc->block = block;
692            doc->page = page;
693            doc->transfer_offset = 0;
694         }
695      }
696   }
697   else if (doc->sec_2[0x34] == 0x05)
698   {
699      doc->transfer_offset = data << 2;
700      verboselog( device->machine, 5, "flash transfer offset %04X\n", doc->transfer_offset);
701   }
702}
703 
704static void diskonchip_sec_2_write_1040( running_device *device, UINT16 data)
705{
706   diskonchip_g3_t *doc = get_token( device);
707   doc->transfersize = (data & 0x3FF);
708   verboselog( device->machine, 5, "flash transfer size %04X\n", doc->transfersize);
709}
710 
711static void diskonchip_sec_2_write_100A( running_device *device, UINT8 data)
712{
713   diskonchip_g3_t *doc = get_token( device);
714   doc->device = data & 3;
715   verboselog( device->machine, 5, "select device %d\n", doc->device);
716}
717 
718static void diskonchip_sec_2_write16( running_device *device, UINT32 offset, UINT16 data)
719{
720   diskonchip_g3_t *doc = get_token( device);
721   doc->sec_2[offset+0] = (data >> 0) & 0xFF;
722   doc->sec_2[offset+1] = (data >> 8) & 0xFF;
723   verboselog( device->machine, 9, "(DOC) %08X <- %04X\n", 0x1000 + offset, data);
724   switch (0x1000 + offset)
725   {
726      // ?
727      case 0x100C : diskonchip_sec_2_write_100C( device, data); break;
728      // Device ID Select Register
729      case 0x100A : diskonchip_sec_2_write_100A( device, data); break;
730      // flash select
731      case 0x1032 : diskonchip_sec_2_write_1032( device, data); break;
732      // flash command
733      case 0x1034 : diskonchip_sec_2_write_1034( device, data); break;
734      // flash address
735      case 0x1036 : diskonchip_sec_2_write_1036( device, data); break;
736      // ?
737      case 0x1040 : diskonchip_sec_2_write_1040( device, data); break;
738   }
739}
740 
741static void diskonchip_sec_2_write8( running_device *device, UINT32 offset, UINT8 data)
742{
743   diskonchip_g3_t *doc = get_token( device);
744   doc->sec_2[offset] = data;
745   verboselog( device->machine, 9, "(DOC) %08X <- %02X\n", 0x1000 + offset, data);
746   switch (0x1000 + offset)
747   {
748      // ?
749      case 0x100C : diskonchip_sec_2_write_100C( device, data); break;
750      // Device ID Select Register
751      case 0x100A : diskonchip_sec_2_write_100A( device, data); break;
752      // flash select
753      case 0x1032 : diskonchip_sec_2_write_1032( device, data); break;
754      // flash command
755      case 0x1034 : diskonchip_sec_2_write_1034( device, data); break;
756      // flash address
757      case 0x1036 : diskonchip_sec_2_write_1036( device, data); break;
758   }
759}
760 
761READ16_DEVICE_HANDLER( diskonchip_g3_sec_2_r )
762{
763   if (mem_mask == 0xffff)
764   {
765      return diskonchip_sec_2_read16( device, offset * 2);
766   }
767   else if (mem_mask == 0x00ff)
768   {
769      return diskonchip_sec_2_read8( device, offset * 2 + 0) << 0;
770   }
771   else if (mem_mask == 0xff00)
772   {
773      return diskonchip_sec_2_read8( device, offset * 2 + 1) << 8;
774   }
775   else
776   {
777      verboselog( device->machine, 0, "diskonchip_g3_sec_2_r: unknown mem_mask %08X\n", mem_mask);
778      return 0;
779   }
780}
781 
782WRITE16_DEVICE_HANDLER( diskonchip_g3_sec_2_w )
783{
784   if (mem_mask == 0xffff)
785   {
786      diskonchip_sec_2_write16( device, offset * 2, data);
787   }
788   else if (mem_mask == 0x00ff)
789   {
790      diskonchip_sec_2_write8( device, offset * 2 + 0, (data >> 0) & 0xFF);
791   }
792   else if (mem_mask == 0xff00)
793   {
794      diskonchip_sec_2_write8( device, offset * 2 + 1, (data >> 8) & 0xFF);
795   }
796   else
797   {
798      verboselog( device->machine, 0, "diskonchip_g3_sec_2_w: unknown mem_mask %08X\n", mem_mask);
799   }
800}
801 
802READ16_DEVICE_HANDLER( diskonchip_g3_sec_3_r )
803{
804   UINT16 data = 0;
805   verboselog( device->machine, 9, "(DOC) %08X -> %04X\n", 0x1800 + (offset << 1), data);
806   return data;
807}
808 
809WRITE16_DEVICE_HANDLER( diskonchip_g3_sec_3_w )
810{
811   verboselog( device->machine, 9, "(DOC) %08X <- %02X\n", 0x1800 + (offset << 1), data);
812}
813 
814#if 0
815 
816static mame_file *nvram_system_fopen( running_machine *machine, UINT32 openflags, const char *name)
817{
818   astring *fname;
819   file_error filerr;
820   mame_file *file;
821   fname = astring_assemble_4( astring_alloc(), machine->gamedrv->name, PATH_SEPARATOR, name, ".nv");
822   filerr = mame_fopen( SEARCHPATH_NVRAM, astring_c( fname), openflags, &file);
823   astring_free( fname);
824   return (filerr == FILERR_NONE) ? file : NULL;
825}
826 
827static void diskonchip_load( running_device *device, const char *name)
828{
829   mame_file *file;
830   file = nvram_system_fopen( device->machine, OPEN_FLAG_READ, name);
831   device_nvram_diskonchip_g3( device, file, 0);
832   if (file) mame_fclose( file);
833}
834 
835static void diskonchip_save( running_device *device, const char *name)
836{
837   mame_file *file;
838   file = nvram_system_fopen( device->machine, OPEN_FLAG_CREATE | OPEN_FLAG_WRITE | OPEN_FLAG_CREATE_PATHS, name);
839   device_nvram_diskonchip_g3( device, file, 1);
840   if (file) mame_fclose( file);
841}
842 
843#endif
844 
845static DEVICE_START( diskonchip_g3 )
846{
847   diskonchip_g3_t *doc = get_token( device);
848   const diskonchip_g3_config *config = get_config( device);
849 
850   verboselog( device->machine, 9, "(DOC) device start\n");
851 
852   switch (config->size)
853   {
854      case 64 :
855      {
856         doc->planes = 2;
857         doc->blocks = 1024;
858         doc->pages = 64;
859         doc->user_data_size = 512;
860         doc->extra_area_size = 16;
861      }
862      break;
863   }
864 
865   doc->data_size[0] = doc->planes * doc->blocks * doc->pages * (doc->user_data_size + doc->extra_area_size);
866   doc->data_size[1] = doc->planes * doc->blocks * doc->pages * 16;
867   doc->data_size[2] = doc->blocks * 8;
868 
869   doc->data[0] = auto_alloc_array( device->machine, UINT8, doc->data_size[0]);
870   doc->data[1] = auto_alloc_array( device->machine, UINT8, doc->data_size[1]);
871   doc->data[2] = auto_alloc_array( device->machine, UINT8, doc->data_size[2]);
872 
873//   diskonchip_load( device, "diskonchip");
874 
875   state_save_register_device_item( device, 0, doc->planes);
876   state_save_register_device_item( device, 0, doc->blocks);
877   state_save_register_device_item( device, 0, doc->pages);
878   state_save_register_device_item( device, 0, doc->user_data_size);
879   state_save_register_device_item( device, 0, doc->extra_area_size);
880   state_save_register_device_item_pointer( device, 0, doc->data[0], doc->data_size[0]);
881   state_save_register_device_item_pointer( device, 0, doc->data[1], doc->data_size[1]);
882   state_save_register_device_item_pointer( device, 0, doc->data[2], doc->data_size[2]);
883}
884 
885static DEVICE_STOP( diskonchip_g3 )
886{
887   verboselog( device->machine, 9, "(DOC) device stop\n");
888//   diskonchip_save( device, "diskonchip");
889}
890 
891static DEVICE_RESET( diskonchip_g3 )
892{
893   verboselog( device->machine, 9, "(DOC) device reset\n");
894}
895 
896static DEVICE_NVRAM( diskonchip_g3 )
897{
898   diskonchip_g3_t *doc = get_token( device);
899   verboselog( device->machine, 9, "(DOC) nvram %s\n", read_or_write ? "write" : "read");
900   if (read_or_write)
901   {
902      if (file)
903      {
904         mame_fwrite( file, doc->data[0], doc->data_size[0]);
905         mame_fwrite( file, doc->data[1], doc->data_size[1]);
906         mame_fwrite( file, doc->data[2], doc->data_size[2]);
907      }
908   }
909   else
910   {
911       if (file)
912       {
913         mame_fread( file, doc->data[0], doc->data_size[0]);
914         mame_fread( file, doc->data[1], doc->data_size[1]);
915         mame_fread( file, doc->data[2], doc->data_size[2]);
916      }
917      else
918      {
919         memset( doc->data[0], 0xFF, doc->data_size[0]);
920         memset( doc->data[1], 0x00, doc->data_size[1]);
921         memset( doc->data[2], 0xFF, doc->data_size[2]);
922      }
923   }
924}
925 
926DEVICE_GET_INFO( diskonchip_g3 )
927{
928   switch (state)
929   {
930      /* --- the following bits of info are returned as 64-bit signed integers --- */
931      case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(diskonchip_g3_t); break;
932      case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = sizeof(diskonchip_g3_config); break;
933//      case DEVINFO_INT_CLASS: info->i = DEVICE_CLASS_PERIPHERAL; break;
934 
935      /* --- the following bits of info are returned as pointers to data or functions --- */
936      case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(diskonchip_g3); break;
937      case DEVINFO_FCT_STOP: info->stop = DEVICE_STOP_NAME(diskonchip_g3); break;
938      case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME(diskonchip_g3); break;
939      case DEVINFO_FCT_NVRAM: info->nvram = DEVICE_NVRAM_NAME(diskonchip_g3); break;
940 
941      /* --- the following bits of info are returned as NULL-terminated strings --- */
942      case DEVINFO_STR_NAME: strcpy(info->s, "DiskOnChip G3"); break;
943      case DEVINFO_STR_FAMILY: strcpy(info->s, "DiskOnChip"); break;
944      case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
945      case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
946      case DEVINFO_STR_CREDITS: strcpy( info->s, "Copyright Tim Schuerewegen and the MESS Team" ); break;
947   }
948}
949 
950DEFINE_LEGACY_NVRAM_DEVICE(DISKONCHIP_G3, diskonchip_g3);
src/mess/machine/docg3.h
r0r9823
1/*
2 
3    M-Systems DiskOnChip G3 - Flash Disk with MLC NAND and M-Systems’ x2 Technology
4 
5    (c) 2009 Tim Schuerewegen
6 
7*/
8 
9#ifndef __DOCG3_H__
10#define __DOCG3_H__
11 
12#include "devlegcy.h"
13 
14typedef struct _diskonchip_g3_config diskonchip_g3_config;
15struct _diskonchip_g3_config
16{
17   const int size;
18};
19 
20DEVICE_GET_INFO( diskonchip_g3 );
21 
22#define MDRV_DISKONCHIP_G3_ADD(_tag, _size) \
23   MDRV_DEVICE_ADD(_tag, DISKONCHIP_G3, 0) \
24   MDRV_DEVICE_CONFIG_DATA32(diskonchip_g3_config, size, _size)
25 
26READ16_DEVICE_HANDLER( diskonchip_g3_sec_1_r );
27WRITE16_DEVICE_HANDLER( diskonchip_g3_sec_1_w );
28READ16_DEVICE_HANDLER( diskonchip_g3_sec_2_r );
29WRITE16_DEVICE_HANDLER( diskonchip_g3_sec_2_w );
30READ16_DEVICE_HANDLER( diskonchip_g3_sec_3_r );
31WRITE16_DEVICE_HANDLER( diskonchip_g3_sec_3_w );
32 
33DECLARE_LEGACY_NVRAM_DEVICE(DISKONCHIP_G3, diskonchip_g3);
34 
35#endif /* __DOCG3_H__ */
src/mess/video/gf4500.c
r0r9823
1/*
2 
3    NVIDIA GoForce 4500
4 
5    (c) 2010 Tim Schuerewegen
6 
7*/
8 
9#include "emu.h"
10 
11#define VERBOSE_LEVEL ( 0 )
12 
13INLINE void ATTR_PRINTF(3,4) verboselog( running_machine *machine, int n_level, const char *s_fmt, ...)
14{
15   if (VERBOSE_LEVEL >= n_level)
16   {
17      va_list v;
18      char buf[32768];
19      va_start( v, s_fmt);
20      vsprintf( buf, s_fmt, v);
21      va_end( v);
22      logerror( "%s: %s", cpuexec_describe_context( machine), buf);
23   }
24}
25 
26#define BIT(x,n) (((x)>>(n))&1)
27#define BITS(x,m,n) (((x)>>(n))&(((UINT32)1<<((m)-(n)+1))-1))
28 
29#define GF4500_FRAMEBUF_OFFSET 0x20000
30 
31static struct {
32   UINT32 *data;
33   int screen_x;
34   int screen_y;
35   int screen_x_max;
36   int screen_y_max;
37   int screen_x_min;
38   int screen_y_min;
39} gf4500;
40 
41static void gf4500_init( running_machine *machine)
42{
43   gf4500.data = auto_alloc_array( machine, UINT32, 0x140000 / 4);
44   gf4500.screen_x = gf4500.screen_y = 0;
45   gf4500.screen_x_max = gf4500.screen_y_max = gf4500.screen_x_min = gf4500.screen_y_min = 0;
46}
47 
48static void gf4500_vram_write16( UINT16 data)
49{
50   if ((gf4500.screen_x < gf4500.screen_x_max) && (gf4500.screen_y < gf4500.screen_y_max))
51   {
52      UINT16 *vram = (UINT16 *)((UINT8 *)gf4500.data + GF4500_FRAMEBUF_OFFSET + (((gf4500.screen_y_min + gf4500.screen_y) * (320 + 1)) + (gf4500.screen_x_min + gf4500.screen_x)) * 2);
53      *vram = data;
54      gf4500.screen_x++;
55   }
56}
57 
58static rgb_t gf4500_get_color_16( UINT16 data)
59{
60   UINT8 r, g, b;
61   r = BITS( data, 15, 11) << 3;
62   g = BITS( data, 10, 5) << 2;
63   b = BITS( data, 4, 0) << 3;
64   return MAKE_RGB( r, g, b);
65}
66 
67static void gf4500_render_screen( running_machine *machine, bitmap_t *bitmap)
68{
69   UINT16 *vram = (UINT16 *)(gf4500.data + GF4500_FRAMEBUF_OFFSET / 4);
70   int x, y;
71   for (y = 0; y < 240; y++)
72   {
73      UINT32 *scanline = BITMAP_ADDR32( bitmap, y, 0);
74      for (x = 0; x < 320; x++)
75      {
76         *scanline++ = gf4500_get_color_16( *vram++);
77      }
78      vram += 1;
79   }
80}
81 
82READ32_HANDLER( gf4500_r )
83{
84   UINT32 data = gf4500.data[offset];
85   switch (offset)
86   {
87      case 0x4C / 4 :
88      {
89         data = 0x00145000;
90      }
91      break;
92   }
93   if ((offset < (GF4500_FRAMEBUF_OFFSET / 4)) || (offset >= ((GF4500_FRAMEBUF_OFFSET + (321 * 240 * 2)) / 4)))
94   {
95      verboselog( space->machine, 9, "(GFO) %08X -> %08X\n", 0x34000000 + (offset << 2), data);
96   }
97   return data;
98}
99 
100WRITE32_HANDLER( gf4500_w )
101{
102   COMBINE_DATA(&gf4500.data[offset]);
103   if ((offset < (GF4500_FRAMEBUF_OFFSET / 4)) || (offset >= ((GF4500_FRAMEBUF_OFFSET + (321 * 240 * 2)) / 4)))
104   {
105      verboselog( space->machine, 9, "(GFO) %08X <- %08X\n", 0x34000000 + (offset << 2), data);
106   }
107   switch (offset)
108   {
109      case 0x300 / 4 :
110      {
111         gf4500.screen_x = gf4500.screen_y = 0;
112      }
113      break;
114      case 0x304 / 4 :
115      {
116         gf4500.screen_x_max = (data >>  0) & 0xFFFF;
117         gf4500.screen_y_max = (data >> 16) & 0xFFFF;
118         if (gf4500.screen_x_max & 1) gf4500.screen_x_min++;
119         //if (screen_y_max & 1) screen_y_min++;
120      }
121      break;
122      case 0x308 / 4 :
123      {
124         gf4500.screen_x_min = (data >>  0) & 0xFFFF;
125         gf4500.screen_y_min = (data >> 16) & 0xFFFF;
126         if (gf4500.screen_x_min & 1) gf4500.screen_x_min--;
127         //if (screen_y_min & 1) screen_y_min--;
128      }
129      break;
130   }
131   if ((offset >= (0x200 / 4)) && (offset < (0x280 / 4)))
132   {
133 
134// 'maincpu' (02996998): (GFO) 34000304 <- 00F00140
135// 'maincpu' (029969A8): (GFO) 34000308 <- 00000000
136// 'maincpu' (029969B4): (GFO) 34000324 <- 00000000
137// 'maincpu' (029969C4): (GFO) 34000328 <- 40000282
138// 'maincpu' (029969D4): (GFO) 34000300 <- 001022CC
139//
140// 'maincpu' (01DCC55C): (GFO) 34000024 -> 00000000
141// 'maincpu' (02996A24): (GFO) 34000200 <- AE9FAE9F
142//
143// 'maincpu' (02996A24): (GFO) 3400027C <- AE9FAE9F
144//
145// 'maincpu' (01DCC55C): (GFO) 34000024 -> 00000000
146// 'maincpu' (02996A24): (GFO) 34000200 <- AE9FAE9F
147// ...
148// 'maincpu' (02996A24): (GFO) 3400027C <- AE9FAE9F
149 
150      gf4500_vram_write16( (data >>  0) & 0xFFFF);
151      gf4500_vram_write16( (data >> 16) & 0xFFFF);
152      if (gf4500.screen_x >= gf4500.screen_x_max)
153      {
154         gf4500.screen_x = 0;
155         gf4500.screen_y++;
156      }
157   }
158}
159 
160VIDEO_START( gf4500 )
161{
162   gf4500_init( machine);
163   return VIDEO_START_CALL(generic_bitmapped);
164}
165 
166VIDEO_UPDATE( gf4500 )
167{
168   gf4500_render_screen( screen->machine, screen->machine->generic.tmpbitmap);
169   return VIDEO_UPDATE_CALL(generic_bitmapped);
170}
src/mess/video/gf4500.h
r0r9823
1/*
2 
3    NVIDIA GoForce 4500
4 
5    (c) 2010 Tim Schuerewegen
6 
7*/
8 
9#ifndef __GF4500_H__
10#define __GF4500_H__
11 
12READ32_HANDLER( gf4500_r );
13WRITE32_HANDLER( gf4500_w );
14 
15VIDEO_START( gf4500 );
16VIDEO_UPDATE( gf4500 );
17 
18#endif /* __GF4500_H__ */
src/mess/messdriv.c
r9822r9823
12881288   /* Tiger Electronics */
12891289   DRIVER( gamecom )   /* Tiger Game.com      */
12901290
1291   /* Tiger Telematics */
1292   DRIVER( gizmondo )
1293
12911294   /* Thomson */
12921295   DRIVER( t9000 )    /* 1980 Thomson T9000 (TO7 prototype)     */
12931296   DRIVER( to7 )      /* 1982 Thomson TO7   */
src/mess/mess.mak
r9822r9823
396396   $(MESSOBJ)/thomson.a \
397397   $(MESSOBJ)/ti.a \
398398   $(MESSOBJ)/tiger.a \
399   $(MESSOBJ)/tigertel.a \
399400   $(MESSOBJ)/tiki.a \
400401   $(MESSOBJ)/tomy.a \
401402   $(MESSOBJ)/toshiba.a \
r9822r9823
16021603   $(MESS_MACHINE)/gamecom.o   \
16031604   $(MESS_VIDEO)/gamecom.o      \
16041605
1606$(MESSOBJ)/tigertel.a:         \
1607   $(MESS_DRIVERS)/gizmondo.o   \
1608   $(MESS_MACHINE)/docg3.o      \
1609   $(MESS_VIDEO)/gf4500.o      \
1610
16051611$(MESSOBJ)/tiki.a:            \
16061612   $(MESS_DRIVERS)/tiki100.o   \
16071613
src/mess/drivers/gizmondo.c
r0r9823
1/*******************************************************************************
2 
3    Tiger Telematics Gizmondo
4 
5    (c) 2010 Tim Schuerewegen
6 
7*******************************************************************************/
8 
9/*
10 
11== DiskOnChip G3 - Layout ==
12 
1300000020 00000020 00000000 00000000 00000000 00000006 00000025 00000006 12A00000 000000FF 00000000 00000000 00000000 00000000 (BOOT & FTST)
1400000140 00000140 00000000 00000000 00000000 00000026 00000165 00000026 12100000 000000FF 00000000 00000000 00000000 00000000 (KRNL)
1500000001 00000001 00000000 00000000 00000000 00000166 00000166 00000166 12100000 000000FF 00000000 00000000 00000000 00000000
1600000299 00000264 0000002F 00000003 00000003 0000016A 000003FF 00000167 1C100000 000000FF 00000000
17 
18== Windows CE - Interrupts ==
19 
20SYSINTR_KEYBOARD = INT_EINT1, INT_EINT4_7 (EINT4/EINT5/EINT6/EINT7, INT_EINT8_23 (EINT23)
21SYSINTR_SERIAL_1 = INT_UART0 (SUBINT_ERR0, SUBINT_TXD0, SUBINT_RXD0), INT_EINT4_7 (EINT13)
22SYSINTR_SERIAL_2 = INT_UART2 (SUBINT_ERR2, SUBINT_TXD2, SUBINT_RXD2)
23SYSINTR_SERIAL_3 = INT_EINT8_23 (EINT17), ?
24SYSINTR_POWER    = INT_EINT8_23 (EINT12)
25SYSINTR_SYNTH    = INT_EINT8_23 (EINT16)
26SYSINTR_GPS      = INT_EINT3, INT_EINT8_23 (EINT18)
27 
28*/
29 
30#include "emu.h"
31#include "cpu/arm7/arm7.h"
32#include "machine/docg3.h"
33#include "machine/s3c2440.h"
34#include "video/gf4500.h"
35 
36#define VERBOSE_LEVEL ( 0 )
37 
38INLINE void ATTR_PRINTF(3,4) verboselog( running_machine *machine, int n_level, const char *s_fmt, ...)
39{
40   if (VERBOSE_LEVEL >= n_level)
41   {
42      va_list v;
43      char buf[32768];
44      va_start( v, s_fmt);
45      vsprintf( buf, s_fmt, v);
46      va_end( v);
47      logerror( "%s: %s", cpuexec_describe_context( machine), buf);
48   }
49}
50 
51#define BIT(x,n) (((x)>>(n))&1)
52#define BITS(x,m,n) (((x)>>(n))&(((UINT32)1<<((m)-(n)+1))-1))
53 
54class gizmondo_state : public driver_device
55{
56public:
57   gizmondo_state(running_machine &machine, const driver_device_config_base &config)
58      : driver_device(machine, config) { }
59 
60   UINT32 port[9];
61   running_device *s3c2440;
62};
63 
64/*******************************************************************************
65    ...
66*******************************************************************************/
67 
68// I/O PORT
69 
70static UINT32 s3c2440_gpio_port_r( running_device *device, int port)
71{
72   gizmondo_state *gizmondo = device->machine->driver_data<gizmondo_state>();
73   UINT32 data = gizmondo->port[port];
74   switch (port)
75   {
76      case S3C2440_GPIO_PORT_D :
77      {
78         data = data & ~0x00000010;
79         data |= (1 << 4); // 1 = "BOOT", 0 = "FTST"
80      }
81      break;
82      case S3C2440_GPIO_PORT_F :
83      {
84         UINT32 port_c = gizmondo->port[S3C2440_GPIO_PORT_C];
85         data = data & ~0x000000F2;
86         // keys
87         data |= 0x00F2;
88         if ((port_c & 0x01) == 0) data &= ~input_port_read( device->machine, "PORTF-01");
89         if ((port_c & 0x02) == 0) data &= ~input_port_read( device->machine, "PORTF-02");
90         if ((port_c & 0x04) == 0) data &= ~input_port_read( device->machine, "PORTF-04");
91         if ((port_c & 0x08) == 0) data &= ~input_port_read( device->machine, "PORTF-08");
92         if ((port_c & 0x10) == 0) data &= ~input_port_read( device->machine, "PORTF-10");
93         data &= ~input_port_read( device->machine, "PORTF");
94      }
95      break;
96      case S3C2440_GPIO_PORT_G :
97      {
98         data = data & ~0x00008001;
99         // keys
100         data = data | 0x8000;
101         data &= ~input_port_read( device->machine, "PORTG");
102         // no sd card inserted
103         data = data | 0x0001;
104      }
105      break;
106   }
107   return data;
108}
109 
110static void s3c2440_gpio_port_w( running_device *device, int port, UINT32 data)
111{
112   gizmondo_state *gizmondo = device->machine->driver_data<gizmondo_state>();
113   gizmondo->port[port] = data;
114}
115 
116static INPUT_CHANGED( port_changed )
117{
118   gizmondo_state *gizmondo = field->port->machine->driver_data<gizmondo_state>();
119   s3c2440_request_eint( gizmondo->s3c2440, 4);
120   //s3c2440_request_irq( device, S3C2440_INT_EINT1);
121}
122 
123#if 0
124static QUICKLOAD_LOAD( gizmondo )
125{
126   return gizmondo_quickload( image, file_type, quickload_size, 0x3000E000); // eboot
127   //return gizmondo_quickload( image, file_type, quickload_size, 0x30400000); // wince
128}
129#endif
130 
131/*******************************************************************************
132    MACHINE HARDWARE
133*******************************************************************************/
134 
135static MACHINE_START( gizmondo )
136{
137   gizmondo_state *gizmondo = machine->driver_data<gizmondo_state>();
138   gizmondo->s3c2440 = machine->device( "s3c2440");
139   gizmondo->port[S3C2440_GPIO_PORT_B] = 0x055E;
140   gizmondo->port[S3C2440_GPIO_PORT_C] = 0x5F20;
141   gizmondo->port[S3C2440_GPIO_PORT_D] = 0x4F60;
142}
143 
144static MACHINE_RESET( gizmondo )
145{
146   devtag_reset( machine, "maincpu");
147}
148 
149/*******************************************************************************
150    ADDRESS MAPS
151*******************************************************************************/
152 
153static ADDRESS_MAP_START( gizmondo_map, ADDRESS_SPACE_PROGRAM, 32 )
154   AM_RANGE(0x00000000, 0x000007ff) AM_ROM
155   AM_RANGE(0x00000800, 0x00000fff) AM_DEVREADWRITE16( "diskonchip", diskonchip_g3_sec_1_r, diskonchip_g3_sec_1_w, 0xffffffff)
156   AM_RANGE(0x00001000, 0x000017ff) AM_DEVREADWRITE16( "diskonchip", diskonchip_g3_sec_2_r, diskonchip_g3_sec_2_w, 0xffffffff)
157   AM_RANGE(0x00001800, 0x00001fff) AM_DEVREADWRITE16( "diskonchip", diskonchip_g3_sec_3_r, diskonchip_g3_sec_3_w, 0xffffffff)
158   AM_RANGE(0x30000000, 0x33ffffff) AM_RAM
159   AM_RANGE(0x34000000, 0x3413ffff) AM_READWRITE( gf4500_r, gf4500_w)
160ADDRESS_MAP_END
161 
162/*******************************************************************************
163    MACHINE DRIVERS
164*******************************************************************************/
165 
166static DRIVER_INIT( gizmondo )
167{
168   // do nothing
169}
170 
171static S3C2440_INTERFACE( gizmondo_s3c2440_intf )
172{
173   // GPIO (port read / port write)
174   { s3c2440_gpio_port_r, s3c2440_gpio_port_w },
175   // I2C (scl write / sda read / sda write)
176   { NULL, NULL, NULL },
177   // ADC (data read)
178   { NULL },
179   // I2S (data write)
180   { NULL }
181};
182 
183static MACHINE_CONFIG_START( gizmondo, gizmondo_state )
184   MDRV_CPU_ADD("maincpu", ARM9, 40000000)
185   MDRV_CPU_PROGRAM_MAP(gizmondo_map)
186 
187   MDRV_PALETTE_LENGTH(32768)
188 
189   MDRV_SCREEN_ADD("screen", LCD)
190   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
191   MDRV_SCREEN_REFRESH_RATE(60)
192   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
193   MDRV_SCREEN_SIZE(320, 240)
194   MDRV_SCREEN_VISIBLE_AREA(0, 320 - 1, 0, 240 - 1)
195   MDRV_DEFAULT_LAYOUT(layout_lcd)
196 
197   MDRV_VIDEO_START(gf4500)
198   MDRV_VIDEO_UPDATE(gf4500)
199 
200   MDRV_MACHINE_START(gizmondo)
201   MDRV_MACHINE_RESET(gizmondo)
202 
203   MDRV_S3C2440_ADD("s3c2440", 12000000, gizmondo_s3c2440_intf)
204 
205   MDRV_DISKONCHIP_G3_ADD("diskonchip", 64)
206 
207#if 0
208   MDRV_QUICKLOAD_ADD("quickload", wince, "bin", 0)
209#endif
210MACHINE_CONFIG_END
211 
212static INPUT_PORTS_START( gizmondo )
213   PORT_START( "PORTF-01" )
214   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_CHANGED(port_changed, NULL) PORT_NAME("STOP") PORT_PLAYER(1)
215   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CHANGED(port_changed, NULL) PORT_PLAYER(1)
216   PORT_START( "PORTF-02" )
217   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_CHANGED(port_changed, NULL) PORT_NAME("F2") PORT_PLAYER(1) PORT_CODE(KEYCODE_F2)
218   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_CHANGED(port_changed, NULL) PORT_NAME("FORWARD") PORT_PLAYER(1)
219   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CHANGED(port_changed, NULL) PORT_PLAYER(1)
220   PORT_START( "PORTF-04" )
221   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_CHANGED(port_changed, NULL) PORT_NAME("F3") PORT_PLAYER(1) PORT_CODE(KEYCODE_F3)
222   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED(port_changed, NULL) PORT_NAME("PLAY") PORT_PLAYER(1)
223   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED(port_changed, NULL) PORT_PLAYER(1)
224   PORT_START( "PORTF-08" )
225   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON10 ) PORT_CHANGED(port_changed, NULL) PORT_NAME("F4") PORT_PLAYER(1) PORT_CODE(KEYCODE_F4)
226   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_CHANGED(port_changed, NULL) PORT_NAME("REWIND") PORT_PLAYER(1)
227   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CHANGED(port_changed, NULL) PORT_PLAYER(1)
228   PORT_START( "PORTF-10" )
229   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_CHANGED(port_changed, NULL) PORT_NAME("L") PORT_PLAYER(1) PORT_CODE(KEYCODE_L)
230   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_CHANGED(port_changed, NULL) PORT_NAME("R") PORT_PLAYER(1) PORT_CODE(KEYCODE_R)
231   PORT_START( "PORTF" )
232   PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_BUTTON11 ) PORT_CHANGED(port_changed, NULL) PORT_NAME("F5") PORT_PLAYER(1) PORT_CODE(KEYCODE_F5)
233   PORT_START( "PORTG" )
234   PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_CHANGED(port_changed, NULL) PORT_NAME("F1") PORT_PLAYER(1) PORT_CODE(KEYCODE_F1)
235INPUT_PORTS_END
236 
237/*******************************************************************************
238    GAME DRIVERS
239*******************************************************************************/
240 
241ROM_START( gizmondo )
242   ROM_REGION( 0x800, "maincpu", 0 )
243   ROM_SYSTEM_BIOS( 0, "fboot", "fboot" )
244   ROMX_LOAD( "fboot.bin", 0, 0x800, CRC(28887c29) SHA1(e625caaa63b9db74cb6d7499dce12ac758c5fe76), ROM_BIOS(1) )
245ROM_END
246 
247CONS(2005, gizmondo, 0, 0, gizmondo, gizmondo, gizmondo, "Tiger Telematics", "Gizmondo", GAME_NOT_WORKING | GAME_NO_SOUND)
docs/messnew.txt
r9822r9823
1717- Impuls-03 [Miodrag Milanovic]
1818- Advanced Bridge Challenger (not working) [Kevtris, Lord Nightmare, Sandro Ronco]
1919- Elektronika MC-1502 (not working) [Miodrag Milanovic]
20- Tiger Telematics Gizmondo (not working) [Tim Schuerewegen]
2021
2122
2223

Previous 15994 Revisions Next


© 1998-2018 The MESS Team