Previous 15994 Revisions Next

r3669 Thursday 27th November, 2008 at 18:35:12 UTC by Fabio Priuli
nec.a, tutor.a & pasogo.a re-enabled
[src/mess]mess.mak messdriv.c
[src/mess/drivers]pasogo.c pcfx.c tutor.c
[src/mess/machine]pce.c

src/mess/messdriv.c
r3668r3669
148148   DRIVER( adam )      /* Coleco Adam                              */
149149
150150   /* NEC */
151//128u4   DRIVER( pce )      /* PC/Engine NEC 1987-1993                     */
152//128u4   DRIVER( tg16 )      /* Turbo Grafix-16  NEC 1989-1993               */
153//128u4   DRIVER( sgx )      /* SuperGrafX NEC 1989                        */
154//128u4   DRIVER( pcfx)      /* PC-FX NEC 1994                           */
151   DRIVER( pce )      /* PC/Engine NEC 1987-1993                     */
152   DRIVER( tg16 )      /* Turbo Grafix-16  NEC 1989-1993               */
153   DRIVER( sgx )      /* SuperGrafX NEC 1989                        */
154   DRIVER( pcfx)      /* PC-FX NEC 1994                           */
155155
156156   DRIVER( arcadia )   /* Emerson Arcadia 2001                        */
157157   DRIVER( vcg )      /* Palladium Video-Computer-Game               */
r3668r3669
195195//128u4   DRIVER( gamepock )   /* Epoch Game Pocket Computer                  */
196196
197197   /* KOEI */
198//128u4   DRIVER( pasogo )   /* KOEI PasoGo                              */
198   DRIVER( pasogo )   /* KOEI PasoGo                              */
199199
200200
201201/****************COMPUTERS***************************************************/
r3668r3669
537537//128u4   DRIVER( ti99_8e )   /* 1983 TI-99/8 with 50Hz video                  */
538538
539539   /* TI 99 clones */
540//128u4   DRIVER( tutor)      /* 1983? Tomy Tutor                           */
540   DRIVER( tutor)      /* 1983? Tomy Tutor                           */
541541//128u4   DRIVER( geneve )   /* 1987? Myarc Geneve 9640                     */
542542//128u4   DRIVER( genmod )   /* 199?? Myarc Geneve 9640                     */
543543//128u4   DRIVER( ti99_4p )   /* 1996 SNUG 99/4P (a.k.a. SGCPU)               */
src/mess/machine/pce.c
r3668r3669
9999static TIMER_CALLBACK( pce_cd_adpcm_dma_timer_callback );
100100
101101
102static WRITE8_HANDLER( pce_sf2_banking_w ) {
103   memory_set_bankptr( 2, memory_region(machine, "user1") + offset * 0x080000 + 0x080000 );
104   memory_set_bankptr( 3, memory_region(machine, "user1") + offset * 0x080000 + 0x088000 );
105   memory_set_bankptr( 4, memory_region(machine, "user1") + offset * 0x080000 + 0x0D0000 );
102static WRITE8_HANDLER( pce_sf2_banking_w )
103{
104   memory_set_bankptr( space->machine, 2, memory_region(space->machine, "user1") + offset * 0x080000 + 0x080000 );
105   memory_set_bankptr( space->machine, 3, memory_region(space->machine, "user1") + offset * 0x080000 + 0x088000 );
106   memory_set_bankptr( space->machine, 4, memory_region(space->machine, "user1") + offset * 0x080000 + 0x0D0000 );
106107}
107108
108static WRITE8_HANDLER( pce_cartridge_ram_w ) {
109static WRITE8_HANDLER( pce_cartridge_ram_w )
110{
109111   cartridge_ram[ offset ] = data;
110112}
111113
r3668r3669
190192         memcpy( ROM + 0x080000, ROM, 0x080000 );
191193   }
192194
193   memory_set_bankptr( 1, ROM );
194   memory_set_bankptr( 2, ROM + 0x080000 );
195   memory_set_bankptr( 3, ROM + 0x088000 );
196   memory_set_bankptr( 4, ROM + 0x0D0000 );
195   memory_set_bankptr( image->machine, 1, ROM );
196   memory_set_bankptr( image->machine, 2, ROM + 0x080000 );
197   memory_set_bankptr( image->machine, 3, ROM + 0x088000 );
198   memory_set_bankptr( image->machine, 4, ROM + 0x0D0000 );
197199
198200   /* Check for Street fighter 2 */
199   if ( size == PCE_ROM_MAXSIZE ) {
200      memory_install_write8_handler(image->machine, 0, ADDRESS_SPACE_PROGRAM, 0x01ff0, 0x01ff3, 0, 0, pce_sf2_banking_w );
201   if ( size == PCE_ROM_MAXSIZE )
202   {
203      memory_install_write8_handler(cpu_get_address_space(image->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x01ff0, 0x01ff3, 0, 0, pce_sf2_banking_w );
201204   }
202205
203206   /* Check for Populous */
204   if ( ! memcmp( ROM + 0x1F26, "POPULOUS", 8 ) ) {
207   if ( ! memcmp( ROM + 0x1F26, "POPULOUS", 8 ) )
208   {
205209      cartridge_ram = auto_malloc( 0x8000 );
206      memory_set_bankptr( 2, cartridge_ram );
207      memory_install_write8_handler(image->machine, 0, ADDRESS_SPACE_PROGRAM, 0x080000, 0x087FFF, 0, 0, pce_cartridge_ram_w );
210      memory_set_bankptr( image->machine, 2, cartridge_ram );
211      memory_install_write8_handler(cpu_get_address_space(image->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x080000, 0x087FFF, 0, 0, pce_cartridge_ram_w );
208212   }
209213
210214   /* Check for CD system card */
211215   pce_sys3_card = 0;
212   if ( ! memcmp( ROM + 0x3FFB6, "PC Engine CD-ROM SYSTEM", 23 ) ) {
216   if ( ! memcmp( ROM + 0x3FFB6, "PC Engine CD-ROM SYSTEM", 23 ) )
217   {
213218      /* Check if 192KB additional system card ram should be used */
214      if ( ! memcmp( ROM + 0x29D1, "VER. 3.", 7 ) || ! memcmp( ROM + 0x29C4, "VER. 3.", 7 ) ) {
219      if ( ! memcmp( ROM + 0x29D1, "VER. 3.", 7 ) || ! memcmp( ROM + 0x29C4, "VER. 3.", 7 ) )
220      {
215221         pce_sys3_card = 1;
216222         cartridge_ram = auto_malloc( 0x30000 );
217         memory_set_bankptr( 4, cartridge_ram );
218         memory_install_write8_handler(image->machine, 0, ADDRESS_SPACE_PROGRAM, 0x0D0000, 0x0FFFFF, 0, 0, pce_cartridge_ram_w );
223         memory_set_bankptr( image->machine, 4, cartridge_ram );
224         memory_install_write8_handler(cpu_get_address_space(image->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0D0000, 0x0FFFFF, 0, 0, pce_cartridge_ram_w );
219225      }
220226   }
221227   return 0;
222228}
223229
224DRIVER_INIT( pce ) {
230DRIVER_INIT( pce )
231{
225232   pce.io_port_options = PCE_JOY_SIG | CONST_SIG;
226233}
227234
228DRIVER_INIT( tg16 ) {
235DRIVER_INIT( tg16 )
236{
229237   pce.io_port_options = TG_16_JOY_SIG | CONST_SIG;
230238}
231239
232DRIVER_INIT( sgx ) {
240DRIVER_INIT( sgx )
241{
233242   pce.io_port_options = PCE_JOY_SIG | CONST_SIG;
234243}
235244
236MACHINE_RESET( pce ) {
245MACHINE_RESET( pce )
246{
237247   pce_cd_init( machine );
238248}
239249
r3668r3669
260270READ8_HANDLER ( pce_joystick_r )
261271{
262272   UINT8 ret;
263   int data = input_port_read(machine, "JOY");
273   int data = input_port_read(space->machine, "JOY");
264274   if(joystick_data_select) data >>= 4;
265275   ret = (data & 0x0F) | pce.io_port_options;
266276#ifdef UNIFIED_PCE
r3668r3669
283293   }
284294}
285295
286static void pce_set_cd_bram( void ) {
287   memory_set_bankptr( 10, pce_cd.bram + ( pce_cd.bram_locked ? PCE_BRAM_SIZE : 0 ) );
296static void pce_set_cd_bram( running_machine *machine )
297{
298   memory_set_bankptr( machine, 10, pce_cd.bram + ( pce_cd.bram_locked ? PCE_BRAM_SIZE : 0 ) );
288299}
289300
290301/* Callback for new data from the MSM5205.
r3668r3669
292303  the MSM5205. Currently we can only use static clocks for the
293304  MSM5205.
294305 */
295static void pce_cd_msm5205_int( running_machine *machine, int chip ) {
306static void pce_cd_msm5205_int( running_machine *machine, int chip )
307{
296308   pce_cd.adpcm_clock_count = ( pce_cd.adpcm_clock_count + 1 ) % pce_cd.adpcm_clock_divider;
297   if ( ! pce_cd.adpcm_clock_count ) {
309   if ( ! pce_cd.adpcm_clock_count )
310   {
298311      /* Supply new ADPCM data */
299   } else {
312   }
313   else
314   {
300315      /* Make sure the sample does not change */
301316   }
302317}
r3668r3669
304319#define   SCSI_STATUS_OK         0x00
305320#define SCSI_CHECK_CONDITION   0x02
306321
307static void pce_cd_reply_status_byte( UINT8 status ) {
322static void pce_cd_reply_status_byte( UINT8 status )
323{
308324logerror("Setting CD in reply_status_byte\n");
309325   pce_cd.scsi_CD = pce_cd.scsi_IO = pce_cd.scsi_REQ = 1;
310326   pce_cd.scsi_MSG = 0;
311327   pce_cd.message_after_status = 1;
312328   pce_cd.status_sent = pce_cd.message_sent = 0;
313329
314   if ( status == SCSI_STATUS_OK ) {
330   if ( status == SCSI_STATUS_OK )
331   {
315332      pce_cd.regs[0x01] = 0x00;
316   } else {
333   }
334   else
335   {
317336      pce_cd.regs[0x01] = 0x01;
318337   }
319338}
320339
321340/* 0x00 - TEST UNIT READY */
322static void pce_cd_test_unit_ready( void ) {
341static void pce_cd_test_unit_ready( void )
342{
323343   logerror("test unit ready\n");
324   if ( pce_cd.cd ) {
344   if ( pce_cd.cd )
345   {
325346      logerror( "Sending STATUS_OK status\n" );
326347      pce_cd_reply_status_byte( SCSI_STATUS_OK );
327   } else {
348   }
349   else
350   {
328351      logerror( "Sending CHECK_CONDITION status\n" );
329352      pce_cd_reply_status_byte( SCSI_CHECK_CONDITION );
330353   }
331354}
332355
333356/* 0x08 - READ (6) */
334static void pce_cd_read_6( void ) {
357static void pce_cd_read_6( void )
358{
335359   UINT32 frame = ( ( pce_cd.command_buffer[1] & 0x1F ) << 16 ) | ( pce_cd.command_buffer[2] << 8 ) | pce_cd.command_buffer[3];
336360   UINT32 frame_count = pce_cd.command_buffer[4];
337361
338362   /* Check for presence of a CD */
339   if ( ! pce_cd.cd ) {
363   if ( ! pce_cd.cd )
364   {
340365      pce_cd_reply_status_byte( SCSI_CHECK_CONDITION );
341366      return;
342367   }
343368
344   if ( pce_cd.cdda_status != PCE_CD_CDDA_OFF ) {
369   if ( pce_cd.cdda_status != PCE_CD_CDDA_OFF )
370   {
345371      pce_cd.cdda_status = PCE_CD_CDDA_OFF;
346372      cdda_stop_audio( 0 );
347373   }
r3668r3669
349375   pce_cd.current_frame = frame;
350376   pce_cd.end_frame = frame + frame_count;
351377
352   if ( frame_count == 0 ) {
378   if ( frame_count == 0 )
379   {
353380      pce_cd_reply_status_byte( SCSI_STATUS_OK );
354   } else {
381   }
382   else
383   {
355384      timer_adjust_periodic(pce_cd.data_timer, ATTOTIME_IN_HZ( PCE_CD_DATA_FRAMES_PER_SECOND ), 0, ATTOTIME_IN_HZ( PCE_CD_DATA_FRAMES_PER_SECOND ));
356385   }
357386}
358387
359388/* 0xD8 - SET AUDIO PLAYBACK START POSITION (NEC) */
360static void pce_cd_nec_set_audio_start_position( void ) {
389static void pce_cd_nec_set_audio_start_position( void )
390{
361391   UINT32   frame = 0;
362392
363   if ( ! pce_cd.cd ) {
393   if ( ! pce_cd.cd )
394   {
364395      /* Throw some error here */
365396      pce_cd_reply_status_byte( SCSI_CHECK_CONDITION );
366397      return;
367398   }
368399
369   switch( pce_cd.command_buffer[9] & 0xC0 ) {
400   switch( pce_cd.command_buffer[9] & 0xC0 )
401   {
370402   case 0x00:
371403      frame = ( pce_cd.command_buffer[3] << 16 ) | ( pce_cd.command_buffer[4] << 8 ) | pce_cd.command_buffer[5];
372404      break;
r3668r3669
383415
384416   pce_cd.current_frame = frame;
385417   pce_cd.cdda_play_mode = pce_cd.command_buffer[1];
386   if ( pce_cd.cdda_play_mode ) {
418   if ( pce_cd.cdda_play_mode )
419   {
387420      pce_cd.cdda_status = PCE_CD_CDDA_PLAYING;
388421      cdda_start_audio( 0, pce_cd.current_frame, pce_cd.end_frame - pce_cd.current_frame );
389   } else {
422   }
423   else
424   {
390425      pce_cd.cdda_status = PCE_CD_CDDA_OFF;
391426      cdda_stop_audio( 0 );
392427      pce_cd.end_frame = pce_cd.last_frame;
r3668r3669
397432}
398433
399434/* 0xD9 - SET AUDIO PLAYBACK END POSITION (NEC) */
400static void pce_cd_nec_set_audio_stop_position( void ) {
435static void pce_cd_nec_set_audio_stop_position( void )
436{
401437   UINT32  frame = 0;
402438
403   if ( ! pce_cd.cd ) {
439   if ( ! pce_cd.cd )
440   {
404441      /* Throw some error here */
405442      pce_cd_reply_status_byte( SCSI_CHECK_CONDITION );
406443      return;
407444   }
408445
409   switch( pce_cd.command_buffer[9] & 0xC0 ) {
446   switch( pce_cd.command_buffer[9] & 0xC0 )
447   {
410448   case 0x00:
411449      frame = ( pce_cd.command_buffer[3] << 16 ) | ( pce_cd.command_buffer[4] << 8 ) | pce_cd.command_buffer[5];
412450      break;
r3668r3669
423461
424462   pce_cd.end_frame = frame;
425463   pce_cd.cdda_play_mode = pce_cd.command_buffer[1];
426   if ( pce_cd.cdda_play_mode ) {
427      if ( pce_cd.cdda_status == PCE_CD_CDDA_PAUSED ) {
464   if ( pce_cd.cdda_play_mode )
465   {
466      if ( pce_cd.cdda_status == PCE_CD_CDDA_PAUSED )
467      {
428468         cdda_pause_audio( 0, 0 );
429      } else {
469      }
470      else
471      {
430472         cdda_start_audio( 0, pce_cd.current_frame, pce_cd.end_frame - pce_cd.current_frame );
431473      }
432474      pce_cd.cdda_status = PCE_CD_CDDA_PLAYING;
433   } else {
475   }
476   else
477   {
434478      pce_cd.cdda_status = PCE_CD_CDDA_OFF;
435479      cdda_stop_audio( 0 );
436480      pce_cd.end_frame = pce_cd.last_frame;
r3668r3669
442486}
443487
444488/* 0xDA - PAUSE (NEC) */
445static void pce_cd_nec_pause( void ) {
489static void pce_cd_nec_pause( void )
490{
446491
447492   /* If no cd mounted throw an error */
448   if ( ! pce_cd.cd ) {
493   if ( ! pce_cd.cd )
494   {
449495      pce_cd_reply_status_byte( SCSI_CHECK_CONDITION );
450496      return;
451497   }
452498
453499   /* If there was no cdda playing, throw an error */
454   if ( pce_cd.cdda_status == PCE_CD_CDDA_OFF ) {
500   if ( pce_cd.cdda_status == PCE_CD_CDDA_OFF )
501   {
455502      pce_cd_reply_status_byte( SCSI_CHECK_CONDITION );
456503      return;
457504   }
r3668r3669
463510}
464511
465512/* 0xDD - READ SUBCHANNEL Q (NEC) */
466static void pce_cd_nec_get_subq( void ) {
513static void pce_cd_nec_get_subq( void )
514{
467515   /* WP - I do not have access to chds with subchannel information yet, so I'm faking something here */
468516   UINT32 msf_abs, msf_rel, track, frame;
469517
470   if ( ! pce_cd.cd ) {
518   if ( ! pce_cd.cd )
519   {
471520      /* Throw some error here */
472521      pce_cd_reply_status_byte( SCSI_CHECK_CONDITION );
473522      return;
r3668r3669
475524
476525   frame = pce_cd.current_frame;
477526
478   switch( pce_cd.cdda_status ) {
527   switch( pce_cd.cdda_status )
528   {
479529   case PCE_CD_CDDA_PAUSED:
480530      pce_cd.data_buffer[0] = 2;
481531      frame = cdda_get_audio_lba( 0 );
r3668r3669
511561}
512562
513563/* 0xDE - GET DIR INFO (NEC) */
514static void pce_cd_nec_get_dir_info( void ) {
564static void pce_cd_nec_get_dir_info( void )
565{
515566   UINT32 frame, msf, track = 0;
516567   const cdrom_toc   *toc;
517568   logerror("nec get dir info\n");
518569
519   if ( ! pce_cd.cd ) {
570   if ( ! pce_cd.cd )
571   {
520572      /* Throw some error here */
521573      pce_cd_reply_status_byte( SCSI_CHECK_CONDITION );
522574   }
523575
524576   toc = cdrom_get_toc( pce_cd.cd );
525577
526   switch( pce_cd.command_buffer[1] ) {
578   switch( pce_cd.command_buffer[1] )
579   {
527580   case 0x00:      /* Get first and last track numbers */
528581      pce_cd.data_buffer[0] = dec_2_bcd(1);
529582      pce_cd.data_buffer[1] = dec_2_bcd(toc->numtrks);
r3668r3669
540593      pce_cd.data_buffer_size = 3;
541594      break;
542595   case 0x02:      /* Get track information */
543      if ( pce_cd.command_buffer[2] == 0xAA ) {
596      if ( pce_cd.command_buffer[2] == 0xAA )
597      {
544598         frame = toc->tracks[toc->numtrks-1].physframeofs;
545599         frame += toc->tracks[toc->numtrks-1].frames;
546600         pce_cd.data_buffer[3] = 0x04;   /* correct? */
547      } else {
601      } else
602      {
548603         track = MAX( bcd_2_dec( pce_cd.command_buffer[2] ), 1 );
549604         frame = toc->tracks[track-1].physframeofs;
550605         pce_cd.data_buffer[3] = ( toc->tracks[track-1].trktype == CD_TRACK_AUDIO ) ? 0x00 : 0x04;
r3668r3669
567622   pce_cd.scsi_CD = 0;
568623}
569624
570static void pce_cd_handle_data_output( void ) {
625static void pce_cd_handle_data_output( void )
626{
571627   static const struct {
572628      UINT8   command_byte;
573629      UINT8   command_size;
r3668r3669
583639      { 0xFF, 0, NULL }                           /* end of list marker */
584640   };
585641
586   if ( pce_cd.scsi_REQ && pce_cd.scsi_ACK ) {
642   if ( pce_cd.scsi_REQ && pce_cd.scsi_ACK )
643   {
587644      /* Command byte received */
588645      logerror( "Command byte $%02X received\n", pce_cd.regs[0x01] );
589646
r3668r3669
595652      pce_cd.scsi_REQ = 0;
596653   }
597654
598   if ( ! pce_cd.scsi_REQ && ! pce_cd.scsi_ACK && pce_cd.command_buffer_index ) {
655   if ( ! pce_cd.scsi_REQ && ! pce_cd.scsi_ACK && pce_cd.command_buffer_index )
656   {
599657      int i = 0;
600658
601659      logerror( "Check if command done\n" );
r3668r3669
603661      for( i = 0; pce_cd.command_buffer[0] > pce_cd_commands[i].command_byte; i++ );
604662
605663      /* Check for unknown commands */
606      if ( pce_cd.command_buffer[0] != pce_cd_commands[i].command_byte ) {
664      if ( pce_cd.command_buffer[0] != pce_cd_commands[i].command_byte )
665      {
607666         logerror("Unrecognized command: %02X\n", pce_cd.command_buffer[0] );
608667      }
609668      assert( pce_cd.command_buffer[0] == pce_cd_commands[i].command_byte );
610669
611      if ( pce_cd.command_buffer_index == pce_cd_commands[i].command_size ) {
670      if ( pce_cd.command_buffer_index == pce_cd_commands[i].command_size )
671      {
612672         (pce_cd_commands[i].command_handler)();
613673         pce_cd.command_buffer_index = 0;
614      } else {
674      }
675      else
676      {
615677         pce_cd.scsi_REQ = 1;
616678      }
617679   }
618680}
619681
620static void pce_cd_handle_data_input( void ) {
621   if ( pce_cd.scsi_CD ) {
682static void pce_cd_handle_data_input( void )
683{
684   if ( pce_cd.scsi_CD )
685   {
622686      /* Command / Status byte */
623      if ( pce_cd.scsi_REQ && pce_cd.scsi_ACK ) {
687      if ( pce_cd.scsi_REQ && pce_cd.scsi_ACK )
688      {
624689         logerror( "status sent\n" );
625690         pce_cd.scsi_REQ = 0;
626691         pce_cd.status_sent = 1;
627692      }
628693
629      if ( ! pce_cd.scsi_REQ && ! pce_cd.scsi_ACK && pce_cd.status_sent ) {
694      if ( ! pce_cd.scsi_REQ && ! pce_cd.scsi_ACK && pce_cd.status_sent )
695      {
630696         pce_cd.status_sent = 0;
631         if ( pce_cd.message_after_status ) {
697         if ( pce_cd.message_after_status )
698         {
632699            logerror( "message after status\n" );
633700            pce_cd.message_after_status = 0;
634701            pce_cd.scsi_MSG = pce_cd.scsi_REQ = 1;
635702            pce_cd.regs[0x01] = 0;
636703         }
637704      }
638   } else {
705   }
706   else
707   {
639708      /* Data */
640      if ( pce_cd.scsi_REQ && pce_cd.scsi_ACK ) {
709      if ( pce_cd.scsi_REQ && pce_cd.scsi_ACK )
710      {
641711         pce_cd.scsi_REQ = 0;
642712      }
643713
644      if ( ! pce_cd.scsi_REQ && ! pce_cd.scsi_ACK ) {
645         if ( pce_cd.data_buffer_index == pce_cd.data_buffer_size ) {
714      if ( ! pce_cd.scsi_REQ && ! pce_cd.scsi_ACK )
715      {
716         if ( pce_cd.data_buffer_index == pce_cd.data_buffer_size )
717         {
646718            pce_cd_set_irq_line( Machine, PCE_CD_IRQ_TRANSFER_READY, CLEAR_LINE );
647            if ( pce_cd.data_transferred ) {
719            if ( pce_cd.data_transferred )
720            {
648721               pce_cd.data_transferred = 0;
649722               pce_cd_reply_status_byte( SCSI_STATUS_OK );
650723               pce_cd_set_irq_line( Machine, PCE_CD_IRQ_TRANSFER_DONE, ASSERT_LINE );
651724            }
652         } else {
725         }
726         else
727         {
653728            logerror("Transfer byte from offset %d\n", pce_cd.data_buffer_index);
654729            pce_cd.regs[0x01] = pce_cd.data_buffer[pce_cd.data_buffer_index];
655730            pce_cd.data_buffer_index++;
r3668r3669
659734   }
660735}
661736
662static void pce_cd_handle_message_output( void ) {
663   if ( pce_cd.scsi_REQ && pce_cd.scsi_ACK ) {
737static void pce_cd_handle_message_output( void )
738{
739   if ( pce_cd.scsi_REQ && pce_cd.scsi_ACK )
740   {
664741      pce_cd.scsi_REQ = 0;
665742   }
666743}
667744
668static void pce_cd_handle_message_input( void ) {
669   if ( pce_cd.scsi_REQ && pce_cd.scsi_ACK ) {
745static void pce_cd_handle_message_input( void )
746{
747   if ( pce_cd.scsi_REQ && pce_cd.scsi_ACK )
748   {
670749      pce_cd.scsi_REQ = 0;
671750      pce_cd.message_sent = 1;
672751   }
673752
674   if ( ! pce_cd.scsi_REQ && ! pce_cd.scsi_ACK && pce_cd.message_sent ) {
753   if ( ! pce_cd.scsi_REQ && ! pce_cd.scsi_ACK && pce_cd.message_sent )
754   {
675755      pce_cd.message_sent = 0;
676756      pce_cd.scsi_BSY = 0;
677757   }
678758}
679759
680760/* Update internal CD statuses */
681static void pce_cd_update( running_machine *machine ) {
761static void pce_cd_update( running_machine *machine )
762{
682763   /* Check for reset of CD unit */
683   if ( pce_cd.scsi_RST != pce_cd.scsi_last_RST ) {
684      if ( pce_cd.scsi_RST ) {
764   if ( pce_cd.scsi_RST != pce_cd.scsi_last_RST )
765   {
766      if ( pce_cd.scsi_RST )
767      {
685768         logerror("Performing CD reset\n");
686769         /* Reset internal data */
687770         pce_cd.scsi_BSY = pce_cd.scsi_SEL = pce_cd.scsi_CD = pce_cd.scsi_IO = 0;
r3668r3669
693776   }
694777
695778   /* Check if bus can be freed */
696   if ( ! pce_cd.scsi_SEL && ! pce_cd.scsi_BSY && pce_cd.selected ) {
779   if ( ! pce_cd.scsi_SEL && ! pce_cd.scsi_BSY && pce_cd.selected )
780   {
697781      logerror( "freeing bus\n" );
698782      pce_cd.selected = 0;
699783      pce_cd.scsi_CD = pce_cd.scsi_MSG = pce_cd.scsi_IO = pce_cd.scsi_REQ = 0;
r3668r3669
701785   }
702786
703787   /* Select the CD device */
704   if ( pce_cd.scsi_SEL ) {
705      if ( ! pce_cd.selected ) {
788   if ( pce_cd.scsi_SEL )
789   {
790      if ( ! pce_cd.selected )
791      {
706792         pce_cd.selected = 1;
707793logerror("Setting CD in device selection\n");
708794         pce_cd.scsi_BSY = pce_cd.scsi_REQ = pce_cd.scsi_CD = 1;
r3668r3669
710796      }
711797   }
712798
713   if ( pce_cd.scsi_ATN ) {
714   } else {
799   if ( pce_cd.scsi_ATN )
800   {
801   }
802   else
803   {
715804      /* Check for data and pessage phases */
716      if ( pce_cd.scsi_BSY ) {
717         if ( pce_cd.scsi_MSG ) {
805      if ( pce_cd.scsi_BSY )
806      {
807         if ( pce_cd.scsi_MSG )
808         {
718809            /* message phase */
719            if ( pce_cd.scsi_IO ) {
810            if ( pce_cd.scsi_IO )
811            {
720812               pce_cd_handle_message_input();
721            } else {
813            }
814            else
815            {
722816               pce_cd_handle_message_output();
723817            }
724         } else {
818         }
819         else
820         {
725821            /* data phase */
726            if ( pce_cd.scsi_IO ) {
822            if ( pce_cd.scsi_IO )
823            {
727824               /* Reading data from target */
728825               pce_cd_handle_data_input();
729            } else {
826            }
827            else
828            {
730829               /* Sending data to target */
731830               pce_cd_handle_data_output();
732831            }
r3668r3669
735834   }
736835}
737836
738static void pce_cd_set_irq_line( running_machine *machine, int num, int state ) {
739   switch( num ) {
837static void pce_cd_set_irq_line( running_machine *machine, int num, int state )
838{
839   switch( num )
840   {
740841   case PCE_CD_IRQ_TRANSFER_DONE:
741      if ( state == ASSERT_LINE ) {
842      if ( state == ASSERT_LINE )
843      {
742844         pce_cd.regs[0x03] |= PCE_CD_IRQ_TRANSFER_DONE;
743      } else {
845      }
846      else
847      {
744848         pce_cd.regs[0x03] &= ~ PCE_CD_IRQ_TRANSFER_DONE;
745849      }
746850      break;
747851   case PCE_CD_IRQ_TRANSFER_READY:
748      if ( state == ASSERT_LINE ) {
852      if ( state == ASSERT_LINE )
853      {
749854         pce_cd.regs[0x03] |= PCE_CD_IRQ_TRANSFER_READY;
750      } else {
855      }
856      else
857      {
751858         pce_cd.regs[0x03] &= ~ PCE_CD_IRQ_TRANSFER_READY;
752859      }
753860      break;
r3668r3669
755862      break;
756863   }
757864
758   if ( pce_cd.regs[0x02] & pce_cd.regs[0x03] & ( PCE_CD_IRQ_TRANSFER_DONE | PCE_CD_IRQ_TRANSFER_READY ) ) {
865   if ( pce_cd.regs[0x02] & pce_cd.regs[0x03] & ( PCE_CD_IRQ_TRANSFER_DONE | PCE_CD_IRQ_TRANSFER_READY ) )
866   {
759867      cpu_set_input_line(machine->cpu[0], 1, ASSERT_LINE );
760   } else {
868   }
869   else
870   {
761871      cpu_set_input_line(machine->cpu[0], 1, CLEAR_LINE );
762872   }
763873}
764874
765static TIMER_CALLBACK( pce_cd_data_timer_callback ) {
766   if ( pce_cd.data_buffer_index == pce_cd.data_buffer_size ) {
875static TIMER_CALLBACK( pce_cd_data_timer_callback )
876{
877   if ( pce_cd.data_buffer_index == pce_cd.data_buffer_size )
878   {
767879      /* Read next data sector */
768880      logerror("read sector %d\n", pce_cd.current_frame );
769      if ( ! cdrom_read_data( pce_cd.cd, pce_cd.current_frame, pce_cd.data_buffer, CD_TRACK_MODE1 ) ) {
881      if ( ! cdrom_read_data( pce_cd.cd, pce_cd.current_frame, pce_cd.data_buffer, CD_TRACK_MODE1 ) )
882      {
770883         logerror("Mode1 CD read failed for frame #%d\n", pce_cd.current_frame );
771      } else {
884      }
885      else
886      {
772887         logerror("Succesfully read mode1 frame #%d\n", pce_cd.current_frame );
773888      }
774889
r3668r3669
779894      pce_cd.scsi_IO = 1;
780895      pce_cd.scsi_CD = 0;
781896
782      if ( pce_cd.current_frame == pce_cd.end_frame ) {
897      if ( pce_cd.current_frame == pce_cd.end_frame )
898      {
783899         /* We are done, disable the timer */
784900         logerror("Last frame read from CD\n");
785901         pce_cd.data_transferred = 1;
786902         timer_adjust_oneshot(pce_cd.data_timer, attotime_never, 0);
787      } else {
903      }
904      else
905      {
788906         pce_cd.data_transferred = 0;
789907      }
790908   }
791909}
792910
793static void pce_cd_init( running_machine *machine ) {
911static void pce_cd_init( running_machine *machine )
912{
794913   const device_config *device;
795914
796915   /* Initialize pce_cd struct */
r3668r3669
801920   memset( pce_cd.bram, 0, PCE_BRAM_SIZE );
802921   memset( pce_cd.bram + PCE_BRAM_SIZE, 0xFF, PCE_BRAM_SIZE );
803922   pce_cd.bram_locked = 1;
804   pce_set_cd_bram();
923   pce_set_cd_bram(machine);
805924
806925   /* set up adpcm related things */
807926   pce_cd.adpcm_ram = auto_malloc( PCE_ADPCM_RAM_SIZE );
r3668r3669
840959   timer_adjust_oneshot(pce_cd.adpcm_dma_timer, attotime_never, 0);
841960}
842961
843WRITE8_HANDLER( pce_cd_bram_w ) {
844   if ( ! pce_cd.bram_locked ) {
962WRITE8_HANDLER( pce_cd_bram_w )
963{
964   if ( ! pce_cd.bram_locked )
965   {
845966      pce_cd.bram[ offset ] = data;
846967   }
847968}
848969
849WRITE8_HANDLER( pce_cd_intf_w ) {
850   logerror("%04X: write to CD interface offset %02X, data %02X\n", activecpu_get_pc(), offset, data );
851   pce_cd_update(machine);
970WRITE8_HANDLER( pce_cd_intf_w )
971{
972   logerror("%04X: write to CD interface offset %02X, data %02X\n", cpu_get_pc(space->cpu), offset, data );
973   pce_cd_update(space->machine);
852974
853   switch( offset ) {
975   switch( offset )
976   {
854977   case 0x00:   /* CDC status */
855978      /* select device (which bits??) */
856979      pce_cd.scsi_SEL = 1;
857      pce_cd_update(machine);
980      pce_cd_update(space->machine);
858981      pce_cd.scsi_SEL = 0;
859982      break;
860983   case 0x01:   /* CDC command / status / data */
r3668r3669
867990            /* bit 2 - ?? irq */
868991      pce_cd.scsi_ACK = data & 0x80;
869992      /* Don't set or reset any irq lines, but just verify the current state */
870      pce_cd_set_irq_line( machine, 0, 0 );
993      pce_cd_set_irq_line( space->machine, 0, 0 );
871994      break;
872995   case 0x03:   /* BRAM lock / CD status / IRQ - Read Only register */
873996      break;
r3668r3669
8781001   case 0x06:   /* PCM data */
8791002      break;
8801003   case 0x07:   /* BRAM unlock / CD status */
881      if ( data & 0x80 ) {
1004      if ( data & 0x80 )
1005      {
8821006         pce_cd.bram_locked = 0;
883         pce_set_cd_bram();
1007         pce_set_cd_bram(space->machine);
8841008      }
8851009      break;
8861010   case 0x08:   /* ADPCM address (LSB) / CD data */
r3668r3669
8891013   case 0x0A:   /* ADPCM RAM data port */
8901014      break;
8911015   case 0x0B:   /* ADPCM DMA control */
892      if ( ! ( pce_cd.regs[0x0B] & 0x02 ) && ( data & 0x02 ) ) {
1016      if ( ! ( pce_cd.regs[0x0B] & 0x02 ) && ( data & 0x02 ) )
1017      {
8931018         /* Start CD to ADPCM transfer */
8941019         timer_adjust_periodic(pce_cd.adpcm_dma_timer, ATTOTIME_IN_HZ( PCE_CD_DATA_FRAMES_PER_SECOND * 2048 ), 0, ATTOTIME_IN_HZ( PCE_CD_DATA_FRAMES_PER_SECOND * 2048 ) );
8951020      }
896      if ( ( pce_cd.regs[0x0B] & 0x02 ) && ! ( data & 0x02 ) ) {
1021      if ( ( pce_cd.regs[0x0B] & 0x02 ) && ! ( data & 0x02 ) )
1022      {
8971023         /* Stop CD to ADPCM transfer (?) */
8981024         timer_adjust_oneshot(pce_cd.adpcm_dma_timer, attotime_never, 0);
8991025      }
r3668r3669
9011027   case 0x0C:   /* ADPCM status */
9021028      break;
9031029   case 0x0D:   /* ADPCM address control */
904      if ( ( pce_cd.regs[0x0D] & 0x80 ) && ! ( data & 0x80 ) ) {
1030      if ( ( pce_cd.regs[0x0D] & 0x80 ) && ! ( data & 0x80 ) )
1031      {
9051032         /* Reset ADPCM hardware */
9061033         pce_cd.adpcm_read_ptr = 0;
9071034         pce_cd.adpcm_write_ptr = 0;
9081035         msm5205_reset_w( 0, 0 );
9091036      }
910      if ( data & 0x10 ) {
1037      if ( data & 0x10 )
1038      {
9111039         pce_cd.adpcm_length = ( pce_cd.regs[0x09] << 8 ) | pce_cd.regs[0x08];
9121040      }
913      if ( data & 0x08 ) {
1041      if ( data & 0x08 )
1042      {
9141043         pce_cd.adpcm_read_ptr = ( pce_cd.regs[0x09] << 8 ) | pce_cd.regs[0x08];
9151044      }
916      if ( ( data & 0x03 ) == 0x03 ) {
1045      if ( ( data & 0x03 ) == 0x03 )
1046      {
9171047         pce_cd.adpcm_write_ptr = ( pce_cd.regs[0x09] << 8 ) | pce_cd.regs[0x08];
9181048      }
9191049      break;
r3668r3669
9271057      return;
9281058   }
9291059   pce_cd.regs[offset] = data;
930   pce_cd_update(machine);
1060   pce_cd_update(space->machine);
9311061}
9321062
933static TIMER_CALLBACK( pce_cd_clear_ack ) {
1063static TIMER_CALLBACK( pce_cd_clear_ack )
1064{
9341065   pce_cd_update(machine);
9351066   pce_cd.scsi_ACK = 0;
9361067   pce_cd_update(machine);
937   if ( pce_cd.scsi_CD ) {
1068   if ( pce_cd.scsi_CD )
1069   {
9381070      pce_cd.regs[0x0B] &= 0xFE;
9391071   }
9401072}
9411073
942static UINT8 pce_cd_get_cd_data_byte( void ) {
1074static UINT8 pce_cd_get_cd_data_byte( void )
1075{
9431076   UINT8 data = pce_cd.regs[0x01];
944   if ( pce_cd.scsi_REQ && ! pce_cd.scsi_ACK && ! pce_cd.scsi_CD ) {
945      if ( pce_cd.scsi_IO ) {
1077   if ( pce_cd.scsi_REQ && ! pce_cd.scsi_ACK && ! pce_cd.scsi_CD )
1078   {
1079      if ( pce_cd.scsi_IO )
1080      {
9461081         pce_cd.scsi_ACK = 1;
9471082         timer_set( ATTOTIME_IN_CYCLES( 15, 0 ), NULL, 0, pce_cd_clear_ack );
9481083      }
r3668r3669
9501085   return data;
9511086}
9521087
953static TIMER_CALLBACK( pce_cd_adpcm_dma_timer_callback ) {
954   if ( pce_cd.scsi_REQ && ! pce_cd.scsi_ACK && ! pce_cd.scsi_CD && pce_cd.scsi_IO ) {
1088
1089static TIMER_CALLBACK( pce_cd_adpcm_dma_timer_callback )
1090{
1091   if ( pce_cd.scsi_REQ && ! pce_cd.scsi_ACK && ! pce_cd.scsi_CD && pce_cd.scsi_IO )
1092   {
9551093      pce_cd.adpcm_ram[pce_cd.adpcm_write_ptr] = pce_cd_get_cd_data_byte();
9561094      pce_cd.adpcm_write_ptr = ( pce_cd.adpcm_write_ptr + 1 ) & 0xFFFF;
9571095   }
9581096}
9591097
960READ8_HANDLER( pce_cd_intf_r ) {
1098READ8_HANDLER( pce_cd_intf_r )
1099{
9611100   UINT8 data = pce_cd.regs[offset & 0x0F];
9621101
963   pce_cd_update(machine);
1102   pce_cd_update(space->machine);
9641103
965   logerror("%04X: read from CD interface offset %02X\n", activecpu_get_pc(), offset );
966   switch( offset ) {
1104   logerror("%04X: read from CD interface offset %02X\n", cpu_get_pc(space->cpu), offset );
1105   switch( offset )
1106   {
9671107   case 0x00:   /* CDC status */
9681108      data &= 0x07;
9691109      data |= pce_cd.scsi_BSY ? 0x80 : 0;
r3668r3669
9801120      /* bit 4 set when CD motor is on */
9811121      /* bit 2 set when less than half of the ADPCM data is remaining ?? */
9821122      pce_cd.bram_locked = 1;
983      pce_set_cd_bram();
1123      pce_set_cd_bram(space->machine);
9841124      data = data & 0x6E;
9851125      data |= ( pce_cd.cd_motor_on ? 0x10 : 0 );
9861126      pce_cd.regs[0x03] ^= 0x02;         /* TODO: get rid of this hack */
src/mess/mess.mak
r3668r3669
412412   $(MESSOBJ)/mikro80.a \
413413   $(MESSOBJ)/mk2.a \
414414   $(MESSOBJ)/motorola.a \
415   $(MESSOBJ)/nec.a \
415416   $(MESSOBJ)/nintendo.a \
416417   $(MESSOBJ)/ondra.a \
417418   $(MESSOBJ)/orion.a \
418419   $(MESSOBJ)/osborne.a \
419420   $(MESSOBJ)/p2000.a \
421   $(MESSOBJ)/pasogo.a \
420422   $(MESSOBJ)/pc.a \
421423   $(MESSOBJ)/pcshare.a \
422424   $(MESSOBJ)/pel.a \
r3668r3669
441443   $(MESSOBJ)/ti85.a \
442444   $(MESSOBJ)/tiger.a \
443445   $(MESSOBJ)/trs80.a \
446   $(MESSOBJ)/tutor.a \
444447   $(MESSOBJ)/ut88.a \
445448   $(MESSOBJ)/vc4000.a \
446449   $(MESSOBJ)/vector06.a \
r3668r3669
469472#   $(MESSOBJ)/mk1.a \
470473#   $(MESSOBJ)/multitch.a \
471474#   $(MESSOBJ)/nascom1.a \
472#   $(MESSOBJ)/nec.a \
473475#   $(MESSOBJ)/necpc.a \
474#   $(MESSOBJ)/pasogo.a \
475476#   $(MESSOBJ)/pdp1.a \
476477#   $(MESSOBJ)/rockwell.a \
477478#   $(MESSOBJ)/samcoupe.a \
r3668r3669
484485#   $(MESSOBJ)/tatung.a \
485486#   $(MESSOBJ)/teamconc.a \
486487#   $(MESSOBJ)/ti99.a \
487#   $(MESSOBJ)/tutor.a \
488488#   $(MESSOBJ)/tx0.a \
489489#   $(MESSOBJ)/veb.a \
490490
src/mess/drivers/pasogo.c
r3668r3669
1919 */
2020
2121static struct {
22  UINT8 index;
23  UINT8 data[0x100];
24  struct {
25    UINT16 data;
26  } bios_timer; // 1.19mhz tclk signal
27  struct {
28    int seconds, minutes, hours, days;
29    int alarm_seconds, alarm_minutes, alarm_hours, alarm_days;
22   UINT8 index;
23   UINT8 data[0x100];
24   struct {
25      UINT16 data;
26   } bios_timer; // 1.19mhz tclk signal
27   struct {
28      int seconds, minutes, hours, days;
29      int alarm_seconds, alarm_minutes, alarm_hours, alarm_days;
3030
31    int onehertz_interrupt_on;
32    int onehertz_interrupt_request;
33    int alarm_interrupt_on;
34    int alarm_interrupt_request;
35  } rtc;
36  struct {
37    int write_protected;
38  } pmu;
31      int onehertz_interrupt_on;
32      int onehertz_interrupt_request;
33      int alarm_interrupt_on;
34      int alarm_interrupt_request;
35   } rtc;
36   struct {
37      int write_protected;
38   } pmu;
3939} vg230;
4040
4141
4242static TIMER_CALLBACK( vg230_timer )
4343{
44  vg230.rtc.seconds+=1;
45  if (vg230.rtc.seconds>=60)
46    {
47      vg230.rtc.seconds=00;
48      vg230.rtc.minutes+=1;
49      if (vg230.rtc.minutes>=60) {
50   vg230.rtc.minutes=0;
51   vg230.rtc.hours+=1;
52   if (vg230.rtc.hours>=24) {
53     vg230.rtc.hours=0;
54     vg230.rtc.days=(vg230.rtc.days+1)&0xfff;
44   vg230.rtc.seconds+=1;
45   if (vg230.rtc.seconds>=60)
46   {
47      vg230.rtc.seconds=00;
48      vg230.rtc.minutes+=1;
49      if (vg230.rtc.minutes>=60)
50      {
51         vg230.rtc.minutes=0;
52         vg230.rtc.hours+=1;
53         if (vg230.rtc.hours>=24)
54         {
55            vg230.rtc.hours=0;
56            vg230.rtc.days=(vg230.rtc.days+1)&0xfff;
57         }
58      }
5559   }
56      }
57    }
58  if (vg230.rtc.seconds==vg230.rtc.alarm_seconds
59      && vg230.rtc.minutes==vg230.rtc.alarm_minutes
60      && vg230.rtc.hours==vg230.rtc.alarm_hours
61      && (vg230.rtc.days&0x1f)==vg230.rtc.alarm_hours) {
62    // generate alarm
63  }
60
61   if (vg230.rtc.seconds==vg230.rtc.alarm_seconds
62      && vg230.rtc.minutes==vg230.rtc.alarm_minutes
63      && vg230.rtc.hours==vg230.rtc.alarm_hours
64      && (vg230.rtc.days&0x1f)==vg230.rtc.alarm_hours)
65   {
66      // generate alarm
67   }
6468}
6569
6670static void vg230_reset(running_machine *machine)
6771{
68  mame_system_time systime;
72   mame_system_time systime;
6973
70  memset(&vg230, 0, sizeof(vg230));
71  vg230.pmu.write_protected=TRUE;
72  timer_pulse(ATTOTIME_IN_HZ(1), NULL, 0, vg230_timer);
74   memset(&vg230, 0, sizeof(vg230));
75   vg230.pmu.write_protected=TRUE;
76   timer_pulse(ATTOTIME_IN_HZ(1), NULL, 0, vg230_timer);
7377
7478
75  mame_get_base_datetime(machine, &systime);
79   mame_get_base_datetime(machine, &systime);
7680 
77  vg230.rtc.seconds= systime.local_time.second;
78  vg230.rtc.minutes= systime.local_time.minute;
79  vg230.rtc.hours = systime.local_time.hour;
80  vg230.rtc.days = 0;
81   vg230.rtc.seconds= systime.local_time.second;
82   vg230.rtc.minutes= systime.local_time.minute;
83   vg230.rtc.hours = systime.local_time.hour;
84   vg230.rtc.days = 0;
8185
82  vg230.bios_timer.data=0x7200; // HACK
86   vg230.bios_timer.data=0x7200; // HACK
8387}
8488
8589static void vg230_init(running_machine *machine)
8690{
87  vg230_reset(machine);
91   vg230_reset(machine);
8892}
8993
9094
9195static READ8_HANDLER( vg230_io_r )
9296{
93  int log=TRUE;
94    UINT8 data=0;
95    vg230.bios_timer.data+=0x100; //HACK
96    if (offset&1) {
97      data=vg230.data[vg230.index];
98      switch (vg230.index) {
99      case 0x09: break;
100      case 0x0a:
101   if (vg230.data[9]&1) {
102     data=input_port_read(machine, "JOY");
103   } else {
104     data=0xff;
105   }
106   break;
107      case 0x30:
108   data=vg230.bios_timer.data&0xff;
109   break;
110      case 0x31:
111   data=vg230.bios_timer.data>>8;
112   log=FALSE;
113   break;
114      case 0x70: data=vg230.rtc.seconds; log=FALSE; break;
115      case 0x71: data=vg230.rtc.minutes; log=FALSE; break;
116      case 0x72: data=vg230.rtc.hours; log=FALSE; break;
117      case 0x73: data=vg230.rtc.days; break;
118      case 0x74: data=vg230.rtc.days>>8; break;
119      case 0x79: /*rtc status*/log=FALSE; break;
120      case 0x7a:
121   data&=~3;
122   if (vg230.rtc.alarm_interrupt_request) data|=1<<1;
123   if (vg230.rtc.onehertz_interrupt_request) data|=1<<0;
124   break;
125      case 0xc1:
126   data&=~1;
127   if (vg230.pmu.write_protected) data|=1;
128   vg230.pmu.write_protected=FALSE;
129   log=FALSE;
130   break;
131      }
132      if (log)
133   logerror("%.5x vg230 %02x read %.2x\n",(int)activecpu_get_pc(),vg230.index,data);
97   int log=TRUE;
98   UINT8 data=0;
99   vg230.bios_timer.data+=0x100; //HACK
100   if (offset&1)
101   {
102      data=vg230.data[vg230.index];
103      switch (vg230.index)
104      {
105         case 0x09: break;
106         case 0x0a:
107            if (vg230.data[9]&1)
108            {
109               data=input_port_read(space->machine, "JOY");
110            }
111            else
112            {
113               data=0xff;
114            }
115            break;
116
117         case 0x30:
118            data=vg230.bios_timer.data&0xff;
119            break;
120
121         case 0x31:
122            data=vg230.bios_timer.data>>8;
123            log=FALSE;
124            break;
125
126         case 0x70: data=vg230.rtc.seconds; log=FALSE; break;
127         case 0x71: data=vg230.rtc.minutes; log=FALSE; break;
128         case 0x72: data=vg230.rtc.hours; log=FALSE; break;
129         case 0x73: data=vg230.rtc.days; break;
130         case 0x74: data=vg230.rtc.days>>8; break;
131         case 0x79: /*rtc status*/log=FALSE; break;
132         case 0x7a:
133            data&=~3;
134            if (vg230.rtc.alarm_interrupt_request) data|=1<<1;
135            if (vg230.rtc.onehertz_interrupt_request) data|=1<<0;
136            break;
137
138         case 0xc1:
139            data&=~1;
140            if (vg230.pmu.write_protected) data|=1;
141            vg230.pmu.write_protected=FALSE;
142            log=FALSE;
143            break;
144      }
145
146      if (log)
147         logerror("%.5x vg230 %02x read %.2x\n",(int) cpu_get_pc(space->cpu),vg230.index,data);
134148      //   data=memory_region(machine, "main")[0x4000+offset];
135    } else {     
136      data=vg230.index;
149   }
150   else
151   {     
152      data=vg230.index;
137153    }
138    return data;
154   return data;
139155}
140156
141157static WRITE8_HANDLER( vg230_io_w )
142158{
143  int log=TRUE;
144    if (offset&1) {
145      //   memory_region(machine, "main")[0x4000+offset]=data;
146      vg230.data[vg230.index]=data;
147      switch (vg230.index) {
148      case 0x09: break;
149      case 0x70: vg230.rtc.seconds=data&0x3f; break;
150      case 0x71: vg230.rtc.minutes=data&0x3f; break;
151      case 0x72: vg230.rtc.hours=data&0x1f;break;
152      case 0x73: vg230.rtc.days=(vg230.rtc.days&~0xff)|data; break;
153      case 0x74: vg230.rtc.days=(vg230.rtc.days&0xff)|((data&0xf)<<8); break;
154      case 0x75: vg230.rtc.alarm_seconds=data&0x3f; break;
155      case 0x76: vg230.rtc.alarm_minutes=data&0x3f; break;
156      case 0x77: vg230.rtc.alarm_hours=data&0x1f; break;
157      case 0x78: vg230.rtc.days=data&0x1f; break;
158      case 0x79:
159   vg230.rtc.onehertz_interrupt_on=data&1;
160   vg230.rtc.alarm_interrupt_on=data&2;
161   log=FALSE;
162   break;
163      case 0x7a:
164   if (data&2) { vg230.rtc.alarm_interrupt_request=FALSE; vg230.rtc.onehertz_interrupt_request=FALSE; /* update interrupt */ }
165   break;
166      }
167      if (log)
168   logerror("%.5x vg230 %02x write %.2x\n",(int)activecpu_get_pc(),vg230.index,data);
169    } else {
170      vg230.index=data;
171    }
159   int log=TRUE;
160   if (offset&1)
161   {
162      //   memory_region(machine, "main")[0x4000+offset]=data;
163      vg230.data[vg230.index]=data;
164      switch (vg230.index)
165      {
166         case 0x09: break;
167         case 0x70: vg230.rtc.seconds=data&0x3f; break;
168         case 0x71: vg230.rtc.minutes=data&0x3f; break;
169         case 0x72: vg230.rtc.hours=data&0x1f;break;
170         case 0x73: vg230.rtc.days=(vg230.rtc.days&~0xff)|data; break;
171         case 0x74: vg230.rtc.days=(vg230.rtc.days&0xff)|((data&0xf)<<8); break;
172         case 0x75: vg230.rtc.alarm_seconds=data&0x3f; break;
173         case 0x76: vg230.rtc.alarm_minutes=data&0x3f; break;
174         case 0x77: vg230.rtc.alarm_hours=data&0x1f; break;
175         case 0x78: vg230.rtc.days=data&0x1f; break;
176         case 0x79:
177            vg230.rtc.onehertz_interrupt_on=data&1;
178            vg230.rtc.alarm_interrupt_on=data&2;
179            log=FALSE;
180            break;
181
182         case 0x7a:
183            if (data&2)
184            {
185               vg230.rtc.alarm_interrupt_request=FALSE; vg230.rtc.onehertz_interrupt_request=FALSE; /* update interrupt */
186            }
187            break;
188      }
189     
190      if (log)
191         logerror("%.5x vg230 %02x write %.2x\n",(int)cpu_get_pc(space->cpu),vg230.index,data);
192   }
193   else
194   {
195      vg230.index=data;
196   }
172197}
173198
174199static struct {
175  UINT8 data;
176  int index;
177  struct {
178    UINT8 data[2];
179    int address;
180    int type;
181    int on;
182  } mapper[26];
200   UINT8 data;
201   int index;
202   struct {
203      UINT8 data[2];
204      int address;
205      int type;
206      int on;
207   } mapper[26];
183208} ems/*?*/;
184209
185210static READ8_HANDLER( ems_r )
186211{
187  UINT8 data=0;
188  switch (offset) {
189  case 0: data=ems.data; break;
190  case 2: case 3: data=ems.mapper[ems.index].data[offset&1]; break;
191  }
192  return data;
212   UINT8 data=0;
213   switch (offset)
214   {
215      case 0: data=ems.data; break;
216      case 2: case 3: data=ems.mapper[ems.index].data[offset&1]; break;
217   }
218   return data;
193219}
194220
195221static WRITE8_HANDLER( ems_w )
196222{
197  switch (offset) {
198  case 0:
199    ems.data=data;
200    switch (data&~3) {
201    case 0x80: ems.index=0; break;
202    case 0x84: ems.index=1; break;
203    case 0x88: ems.index=2; break;
204    case 0x8c: ems.index=3; break;
205    case 0x90: ems.index=4; break;
206    case 0x94: ems.index=5; break;
207    case 0x98: ems.index=6; break;
208    case 0x9c: ems.index=7; break;
209    case 0xa0: ems.index=8; break;
210    case 0xa4: ems.index=9; break;
211    case 0xa8: ems.index=10; break;
212    case 0xac: ems.index=11; break;
213    case 0xb0: ems.index=12; break;
214    case 0xb4: ems.index=13; break;
223   switch (offset)
224   {
225   case 0:
226      ems.data=data;
227      switch (data&~3)
228      {
229      case 0x80: ems.index=0; break;
230      case 0x84: ems.index=1; break;
231      case 0x88: ems.index=2; break;
232      case 0x8c: ems.index=3; break;
233      case 0x90: ems.index=4; break;
234      case 0x94: ems.index=5; break;
235      case 0x98: ems.index=6; break;
236      case 0x9c: ems.index=7; break;
237      case 0xa0: ems.index=8; break;
238      case 0xa4: ems.index=9; break;
239      case 0xa8: ems.index=10; break;
240      case 0xac: ems.index=11; break;
241      case 0xb0: ems.index=12; break;
242      case 0xb4: ems.index=13; break;
215243      //  case 0xb8: ems.index=14; break;
216244      //  case 0xbc: ems.index=15; break;
217    case 0xc0: ems.index=14; break;
218    case 0xc4: ems.index=15; break;
219    case 0xc8: ems.index=16; break;
220    case 0xcc: ems.index=17; break;
221    case 0xd0: ems.index=18; break;
222    case 0xd4: ems.index=19; break;
223    case 0xd8: ems.index=20; break;
224    case 0xdc: ems.index=21; break;
225    case 0xe0: ems.index=22; break;
226    case 0xe4: ems.index=23; break;
227    case 0xe8: ems.index=24; break;
228    case 0xec: ems.index=25; break;
229    }
230    break;
231  case 2:
232  case 3:
233    ems.mapper[ems.index].data[offset&1]=data;
234    ems.mapper[ems.index].address=(ems.mapper[ems.index].data[0]<<14)|((ems.mapper[ems.index].data[1]&0xf)<<22);
235    ems.mapper[ems.index].on=ems.mapper[ems.index].data[1]&0x80;
236    ems.mapper[ems.index].type=(ems.mapper[ems.index].data[1]&0x70)>>4;
237    logerror("%.5x ems mapper %d(%05x)on:%d type:%d address:%07x\n",(int)activecpu_get_pc(),ems.index, ems.data<<12,
238        ems.mapper[ems.index].on, ems.mapper[ems.index].type, ems.mapper[ems.index].address );
239    switch (ems.mapper[ems.index].type) {
240    case 0: /*external*/
241    case 1: /*ram*/
242      memory_set_bankptr( ems.index+1, memory_region(machine, "main") + (ems.mapper[ems.index].address&0xfffff) );
243      break;
244    case 3: /* rom 1 */
245    case 4: /* pc card a */
246    case 5: /* pc card b */
247    default:
248      break;
249    case 2:
250      memory_set_bankptr( ems.index+1, memory_region(machine, "user1") + (ems.mapper[ems.index].address&0xfffff) );
251      break;
252    }
253    break;
254  }
245      case 0xc0: ems.index=14; break;
246      case 0xc4: ems.index=15; break;
247      case 0xc8: ems.index=16; break;
248      case 0xcc: ems.index=17; break;
249      case 0xd0: ems.index=18; break;
250      case 0xd4: ems.index=19; break;
251      case 0xd8: ems.index=20; break;
252      case 0xdc: ems.index=21; break;
253      case 0xe0: ems.index=22; break;
254      case 0xe4: ems.index=23; break;
255      case 0xe8: ems.index=24; break;
256      case 0xec: ems.index=25; break;
257      }
258      break;
259   
260   case 2:
261   case 3:
262      ems.mapper[ems.index].data[offset&1]=data;
263      ems.mapper[ems.index].address=(ems.mapper[ems.index].data[0]<<14)|((ems.mapper[ems.index].data[1]&0xf)<<22);
264      ems.mapper[ems.index].on=ems.mapper[ems.index].data[1]&0x80;
265      ems.mapper[ems.index].type=(ems.mapper[ems.index].data[1]&0x70)>>4;
266      logerror("%.5x ems mapper %d(%05x)on:%d type:%d address:%07x\n",(int)cpu_get_pc(space->cpu),ems.index, ems.data<<12,
267         ems.mapper[ems.index].on, ems.mapper[ems.index].type, ems.mapper[ems.index].address );
268      switch (ems.mapper[ems.index].type)
269      {
270      case 0: /*external*/
271      case 1: /*ram*/
272      memory_set_bankptr( space->machine, ems.index+1, memory_region(space->machine, "main") + (ems.mapper[ems.index].address&0xfffff) );
273      break;
274      case 3: /* rom 1 */
275      case 4: /* pc card a */
276      case 5: /* pc card b */
277      default:
278      break;
279      case 2:
280      memory_set_bankptr( space->machine, ems.index+1, memory_region(space->machine, "user1") + (ems.mapper[ems.index].address&0xfffff) );
281      break;
282      }
283      break;
284   }
255285}
256286
257287static ADDRESS_MAP_START( pasogo_mem, ADDRESS_SPACE_PROGRAM, 8 )
258//     AM_RANGE(0x00000, 0xfffff) AM_UNMAP AM_MASK(0xfffff)
259//      AM_RANGE( 0x4000, 0x7fff) AM_READWRITE(gmaster_io_r, gmaster_io_w)
288//   AM_RANGE(0x00000, 0xfffff) AM_UNMAP AM_MASK(0xfffff)
289//   AM_RANGE( 0x4000, 0x7fff) AM_READWRITE(gmaster_io_r, gmaster_io_w)
260290   ADDRESS_MAP_GLOBAL_MASK(0xffFFF)
261     AM_RANGE(0x00000, 0x7ffff) AM_RAM
262AM_RANGE(0x80000, 0x83fff) AM_RAMBANK(1)
263AM_RANGE(0x84000, 0x87fff) AM_RAMBANK(2)
264AM_RANGE(0x88000, 0x8bfff) AM_RAMBANK(3)
265AM_RANGE(0x8c000, 0x8ffff) AM_RAMBANK(4)
266AM_RANGE(0x90000, 0x93fff) AM_RAMBANK(5)
267AM_RANGE(0x94000, 0x97fff) AM_RAMBANK(6)
268AM_RANGE(0x98000, 0x9bfff) AM_RAMBANK(7)
269AM_RANGE(0x9c000, 0x9ffff) AM_RAMBANK(8)
270AM_RANGE(0xa0000, 0xa3fff) AM_RAMBANK(9)
271AM_RANGE(0xa4000, 0xa7fff) AM_RAMBANK(10)
272AM_RANGE(0xa8000, 0xabfff) AM_RAMBANK(11)
273AM_RANGE(0xac000, 0xaffff) AM_RAMBANK(12)
274AM_RANGE(0xb0000, 0xb3fff) AM_RAMBANK(13)
275AM_RANGE(0xb4000, 0xb7fff) AM_RAMBANK(14)
276//AM_RANGE(0xb8000, 0xbffff) AM_RAM
277     AM_RANGE(0xb8000, 0xbffff) AM_RAMBANK(28)
278AM_RANGE(0xc0000, 0xc3fff) AM_RAMBANK(15)
279AM_RANGE(0xc4000, 0xc7fff) AM_RAMBANK(16)
280AM_RANGE(0xc8000, 0xcbfff) AM_RAMBANK(17)
281AM_RANGE(0xcc000, 0xcffff) AM_RAMBANK(18)
282AM_RANGE(0xd0000, 0xd3fff) AM_RAMBANK(19)
283AM_RANGE(0xd4000, 0xd7fff) AM_RAMBANK(20)
284AM_RANGE(0xd8000, 0xdbfff) AM_RAMBANK(21)
285AM_RANGE(0xdc000, 0xdffff) AM_RAMBANK(22)
286AM_RANGE(0xe0000, 0xe3fff) AM_RAMBANK(23)
287AM_RANGE(0xe4000, 0xe7fff) AM_RAMBANK(24)
288AM_RANGE(0xe8000, 0xebfff) AM_RAMBANK(25)
289AM_RANGE(0xec000, 0xeffff) AM_RAMBANK(26)
291   AM_RANGE(0x00000, 0x7ffff) AM_RAM
292   AM_RANGE(0x80000, 0x83fff) AM_RAMBANK(1)
293   AM_RANGE(0x84000, 0x87fff) AM_RAMBANK(2)
294   AM_RANGE(0x88000, 0x8bfff) AM_RAMBANK(3)
295   AM_RANGE(0x8c000, 0x8ffff) AM_RAMBANK(4)
296   AM_RANGE(0x90000, 0x93fff) AM_RAMBANK(5)
297   AM_RANGE(0x94000, 0x97fff) AM_RAMBANK(6)
298   AM_RANGE(0x98000, 0x9bfff) AM_RAMBANK(7)
299   AM_RANGE(0x9c000, 0x9ffff) AM_RAMBANK(8)
300   AM_RANGE(0xa0000, 0xa3fff) AM_RAMBANK(9)
301   AM_RANGE(0xa4000, 0xa7fff) AM_RAMBANK(10)
302   AM_RANGE(0xa8000, 0xabfff) AM_RAMBANK(11)
303   AM_RANGE(0xac000, 0xaffff) AM_RAMBANK(12)
304   AM_RANGE(0xb0000, 0xb3fff) AM_RAMBANK(13)
305   AM_RANGE(0xb4000, 0xb7fff) AM_RAMBANK(14)
306//   AM_RANGE(0xb8000, 0xbffff) AM_RAM
307   AM_RANGE(0xb8000, 0xbffff) AM_RAMBANK(28)
308   AM_RANGE(0xc0000, 0xc3fff) AM_RAMBANK(15)
309   AM_RANGE(0xc4000, 0xc7fff) AM_RAMBANK(16)
310   AM_RANGE(0xc8000, 0xcbfff) AM_RAMBANK(17)
311   AM_RANGE(0xcc000, 0xcffff) AM_RAMBANK(18)
312   AM_RANGE(0xd0000, 0xd3fff) AM_RAMBANK(19)
313   AM_RANGE(0xd4000, 0xd7fff) AM_RAMBANK(20)
314   AM_RANGE(0xd8000, 0xdbfff) AM_RAMBANK(21)
315   AM_RANGE(0xdc000, 0xdffff) AM_RAMBANK(22)
316   AM_RANGE(0xe0000, 0xe3fff) AM_RAMBANK(23)
317   AM_RANGE(0xe4000, 0xe7fff) AM_RAMBANK(24)
318   AM_RANGE(0xe8000, 0xebfff) AM_RAMBANK(25)
319   AM_RANGE(0xec000, 0xeffff) AM_RAMBANK(26)
290320
291AM_RANGE(0xf0000, 0xfffff) AM_ROMBANK(27)
321   AM_RANGE(0xf0000, 0xfffff) AM_ROMBANK(27)
292322ADDRESS_MAP_END
293323
294324static ADDRESS_MAP_START(pasogo_io, ADDRESS_SPACE_IO, 8)
295325//   ADDRESS_MAP_GLOBAL_MASK(0xfFFF)
296326   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE(PIC8259, "pic8259", pic8259_r, pic8259_w)
297     AM_RANGE(0x26, 0x27) AM_READWRITE(vg230_io_r, vg230_io_w )
327   AM_RANGE(0x26, 0x27) AM_READWRITE(vg230_io_r, vg230_io_w )
298328   AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE(PIT8254, "pit8254", pit8253_r, pit8253_w)
299     AM_RANGE(0x6c, 0x6f) AM_READWRITE(ems_r, ems_w )
329   AM_RANGE(0x6c, 0x6f) AM_READWRITE(ems_r, ems_w )
300330ADDRESS_MAP_END
301331
302332static INPUT_PORTS_START( pasogo )
303333PORT_START("JOY")
304//     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SELECT)  PORT_NAME("select")
305//     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START) PORT_NAME("start")
306     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("O") /*?*/
307     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("X") /*?*/
308     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP   )
309     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
310     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT)
311     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
312     PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("a") PORT_CODE(KEYCODE_A)
313     PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("b") PORT_CODE(KEYCODE_B)
334//   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SELECT)  PORT_NAME("select")
335//   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START) PORT_NAME("start")
336   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("O") /*?*/
337   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("X") /*?*/
338   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP   )
339   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
340   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT)
341   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
342   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("a") PORT_CODE(KEYCODE_A)
343   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("b") PORT_CODE(KEYCODE_B)
314344INPUT_PORTS_END
315345
316346/* palette in red, green, blue tribles */
317347static unsigned char pasogo_palette[][3] =
318348{
319  { 0, 0, 0 },
320    { 45,45,43 },
321    { 130, 159, 166 },
322    { 255,255,255 }
349   { 0, 0, 0 },
350   { 45,45,43 },
351   { 130, 159, 166 },
352   { 255,255,255 }
323353};
324354
325355static PALETTE_INIT( pasogo )
326356{
327357   int i;
328358
329   for ( i = 0; i < ARRAY_LENGTH(pasogo_palette); i++ ) {
359   for ( i = 0; i < ARRAY_LENGTH(pasogo_palette); i++ )
360   {
330361      palette_set_color_rgb(machine, i, pasogo_palette[i][0], pasogo_palette[i][1], pasogo_palette[i][2]);
331362   }
332363}
333364
334365static VIDEO_UPDATE( pasogo )
335366{
336  static int width=-1, height=-1;
337  UINT8 *rom = memory_region(screen->machine, "main")+0xb8000;
338  UINT16 c[]={ 3, 0 };
339    int x,y;
340//    plot_box(bitmap, 0, 0, 64/*bitmap->width*/, bitmap->height, 0);
341    int w=640;
342    int h=240;
343    if (0) {
344      w=320;
345      h=240;
346      for (y=0;y<h; y++) {
347   for (x=0;x<w;x+=4) {
348     int a=(y&1)*0x2000;
349     UINT8 d=rom[a+(y&~1)*80/2+x/4];
350     UINT16 *line=BITMAP_ADDR16(bitmap, y, x);
351     *line++=(d>>6)&3;
352     *line++=(d>>4)&3;
353     *line++=(d>>2)&3;
354     *line++=(d>>0)&3;
367   static int width=-1, height=-1;
368   UINT8 *rom = memory_region(screen->machine, "main")+0xb8000;
369   UINT16 c[]={ 3, 0 };
370   int x,y;
371//   plot_box(bitmap, 0, 0, 64/*bitmap->width*/, bitmap->height, 0);
372   int w=640;
373   int h=240;
374   if (0)
375   {
376      w=320;
377      h=240;
378      for (y=0;y<h; y++)
379      {
380         for (x=0;x<w;x+=4)
381         {
382            int a=(y&1)*0x2000;
383            UINT8 d=rom[a+(y&~1)*80/2+x/4];
384            UINT16 *line=BITMAP_ADDR16(bitmap, y, x);
385            *line++=(d>>6)&3;
386            *line++=(d>>4)&3;
387            *line++=(d>>2)&3;
388            *line++=(d>>0)&3;
389         }
390      }
391   }
392   else
393   {
394      for (y=0;y<h; y++)
395      {
396         for (x=0;x<w;x+=8)
397         {
398            int a=(y&3)*0x2000;
399            UINT8 d=rom[a+(y&~3)*80/4+x/8];
400            UINT16 *line=BITMAP_ADDR16(bitmap, y, x);
401            *line++=c[(d>>7)&1];
402            *line++=c[(d>>6)&1];
403            *line++=c[(d>>5)&1];
404            *line++=c[(d>>4)&1];
405            *line++=c[(d>>3)&1];
406            *line++=c[(d>>2)&1];
407            *line++=c[(d>>1)&1];
408            *line++=c[(d>>0)&1];
409         }
410      }
355411   }
356      }
357    } else {
358      for (y=0;y<h; y++) {
359   for (x=0;x<w;x+=8) {
360     int a=(y&3)*0x2000;
361     UINT8 d=rom[a+(y&~3)*80/4+x/8];
362     UINT16 *line=BITMAP_ADDR16(bitmap, y, x);
363     *line++=c[(d>>7)&1];
364     *line++=c[(d>>6)&1];
365     *line++=c[(d>>5)&1];
366     *line++=c[(d>>4)&1];
367     *line++=c[(d>>3)&1];
368     *line++=c[(d>>2)&1];
369     *line++=c[(d>>1)&1];
370     *line++=c[(d>>0)&1];
412   if (w!=width || h!=height)
413   {
414      width=w; height=h;
415//      video_screen_set_visarea(machine->primary_screen, 0, width-1, 0, height-1);
416      video_screen_set_visarea(screen, 0, width-1, 0, height-1);
371417   }
372      }
373    }
374    if (w!=width || h!=height) {
375      width=w; height=h;
376      //      video_screen_set_visarea(machine->primary_screen, 0, width-1, 0, height-1);
377      video_screen_set_visarea(screen, 0, width-1, 0, height-1);
378    }
379    return 0;
418   return 0;
380419}
381420
382421static INTERRUPT_GEN( pasogo_interrupt )
383422{
384  //  cpu_set_input_line(machine->cpu[0], UPD7810_INTFE1, PULSE_LINE);
423//   cpu_set_input_line(machine->cpu[0], UPD7810_INTFE1, PULSE_LINE);
385424}
386425
387426#if 0
r3668r3669
393432
394433static IRQ_CALLBACK(pasogo_irq_callback)
395434{
396   return pic8259_acknowledge( (device_config*)device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259"));
435   return pic8259_acknowledge( (device_config*)device_list_find_by_tag( device->machine->config->devicelist, PIC8259, "pic8259"));
397436}
398437
399438static MACHINE_RESET( pasogo )
400439{
401  cpunum_set_irq_callback(0, pasogo_irq_callback);
440   cpu_set_irq_callback(machine->cpu[0], pasogo_irq_callback);
402441}
403442
404443//static const unsigned i86_address_mask = 0x000fffff;
r3668r3669
425464};
426465
427466
428static PIC8259_SET_INT_LINE( pasogo_pic8259_set_int_line ) {
467static PIC8259_SET_INT_LINE( pasogo_pic8259_set_int_line )
468{
429469   cpu_set_input_line(device->machine->cpu[0], 0, interrupt ? HOLD_LINE : CLEAR_LINE);
430470}
431471
r3668r3669
436476
437477
438478static MACHINE_DRIVER_START( pasogo )
439     MDRV_CPU_ADD("main", I80188/*V30HL in vadem vg230*/, 10000000/*?*/)
440MDRV_CPU_PROGRAM_MAP(pasogo_mem, 0)
441MDRV_CPU_IO_MAP( pasogo_io, 0 )
442MDRV_CPU_VBLANK_INT("main", pasogo_interrupt)
479   MDRV_CPU_ADD("main", I80188/*V30HL in vadem vg230*/, 10000000/*?*/)
480   MDRV_CPU_PROGRAM_MAP(pasogo_mem, 0)
481   MDRV_CPU_IO_MAP( pasogo_io, 0 )
482   MDRV_CPU_VBLANK_INT("main", pasogo_interrupt)
443483//   MDRV_CPU_CONFIG(i86_address_mask)
444484   MDRV_MACHINE_RESET( pasogo )
445485
r3668r3669
449489   MDRV_DEVICE_ADD( "pic8259", PIC8259 )
450490   MDRV_DEVICE_CONFIG( pasogo_pic8259_config )
451491
452     MDRV_SCREEN_ADD("main", LCD)
453     MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
454     MDRV_SCREEN_REFRESH_RATE(60)
455     MDRV_SCREEN_SIZE(640, 400)
456     MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 400-1)
457  MDRV_PALETTE_LENGTH(ARRAY_LENGTH(pasogo_palette))
458  MDRV_VIDEO_UPDATE(pasogo)
459     MDRV_PALETTE_INIT(pasogo)
492   MDRV_SCREEN_ADD("main", LCD)
493   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
494   MDRV_SCREEN_REFRESH_RATE(60)
495   MDRV_SCREEN_SIZE(640, 400)
496   MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 400-1)
497   MDRV_PALETTE_LENGTH(ARRAY_LENGTH(pasogo_palette))
498   MDRV_VIDEO_UPDATE(pasogo)
499   MDRV_PALETTE_INIT(pasogo)
460500#if 0
461     MDRV_SPEAKER_STANDARD_MONO("gmaster")
462     MDRV_SOUND_ADD("custom", CUSTOM, 0)
463     MDRV_SOUND_CONFIG(gmaster_sound_interface)
464     MDRV_SOUND_ROUTE(0, "gmaster", 0.50)
501   MDRV_SPEAKER_STANDARD_MONO("gmaster")
502   MDRV_SOUND_ADD("custom", CUSTOM, 0)
503   MDRV_SOUND_CONFIG(gmaster_sound_interface)
504   MDRV_SOUND_ROUTE(0, "gmaster", 0.50)
465505#endif
466506MACHINE_DRIVER_END
467507
468508
469509ROM_START(pasogo)
470     ROM_REGION(0x100000,"main", ROMREGION_ERASEFF) // 1 megabyte dram?
471//     ROM_LOAD("gmaster.bin", 0x0000, 0x1000, CRC(05cc45e5) SHA1(05d73638dea9657ccc2791c0202d9074a4782c1e) )
472//     ROM_CART_LOAD(0, "bin", 0x8000, 0x8000, 0)
510   ROM_REGION(0x100000,"main", ROMREGION_ERASEFF) // 1 megabyte dram?
511//   ROM_LOAD("gmaster.bin", 0x0000, 0x1000, CRC(05cc45e5) SHA1(05d73638dea9657ccc2791c0202d9074a4782c1e) )
512//   ROM_CART_LOAD(0, "bin", 0x8000, 0x8000, 0)
473513   ROM_REGION(0x100000,"user1", ROMREGION_ERASEFF)
474514ROM_END
475515
r3668r3669
478518{
479519   vg230_init(machine);
480520   memset(&ems, 0, sizeof(ems));
481   memory_set_bankptr( 27, memory_region(machine, "user1") + 0x00000 );
482   memory_set_bankptr( 28, memory_region(machine, "main") + 0xb8000/*?*/ );
521   memory_set_bankptr( machine, 27, memory_region(machine, "user1") + 0x00000 );
522   memory_set_bankptr( machine, 28, memory_region(machine, "main") + 0xb8000/*?*/ );
483523}
484524
485525
src/mess/drivers/pcfx.c
r3668r3669
3636
3737static MACHINE_RESET( pcfx )
3838{
39   memory_set_bankptr( 1, memory_region(machine, "user1") );
39   memory_set_bankptr( machine, 1, memory_region(machine, "user1") );
4040}
4141
4242
src/mess/drivers/tutor.c
r3668r3669
135135static INTERRUPT_GEN( tutor_vblank_interrupt )
136136{
137137   /* No vblank interrupt? */
138   TMS9928A_interrupt(machine);
138   TMS9928A_interrupt(device->machine);
139139}
140140
141141static const device_config *printer_fp(void)
r3668r3669
164164   UINT8 value;
165165
166166   snprintf(port, ARRAY_LENGTH(port), "LINE%d", offset);
167   value = input_port_read(machine, port);
167   value = input_port_read(space->machine, port);
168168
169169   /* hack for ports overlapping with joystick */
170170   if (offset == 4 || offset == 5)
171171   {
172172      snprintf(port, ARRAY_LENGTH(port), "LINE%d_alt", offset);
173      value |= input_port_read(machine, port);
173      value |= input_port_read(space->machine, port);
174174   }
175175
176176   return value;
r3668r3669
232232   case 0x08:
233233      /* disable cartridge ROM, enable BASIC ROM at base >8000 */
234234      cartridge_enable = 0;
235      memory_set_bank(machine, 1, 0);
235      memory_set_bank(space->machine, 1, 0);
236236      break;
237237
238238   case 0x0c:
239239      /* enable cartridge ROM, disable BASIC ROM at base >8000 */
240240      cartridge_enable = 1;
241      memory_set_bank(machine, 1, 1);
241      memory_set_bank(space->machine, 1, 1);
242242      break;
243243
244244   default:
r3668r3669
276276/* CRU handler */
277277static  READ8_HANDLER(tutor_cassette_r)
278278{
279   return (cassette_input(device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" )) > 0.0) ? 1 : 0;
279   return (cassette_input(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" )) > 0.0) ? 1 : 0;
280280}
281281
282282/* memory handler */
r3668r3669
293293      {
294294      case 0:
295295         /* data out */
296         cassette_output(device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" ), (data) ? +1.0 : -1.0);
296         cassette_output(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" ), (data) ? +1.0 : -1.0);
297297         break;
298298      case 1:
299299         /* interrupt control??? */
r3668r3669
306306            else
307307            {
308308               timer_adjust_oneshot(tape_interrupt_timer, attotime_never, 0);
309               cpu_set_input_line(machine->cpu[0], 1, CLEAR_LINE);
309               cpu_set_input_line(space->machine->cpu[0], 1, CLEAR_LINE);
310310            }
311311         }
312312         break;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team