Previous 15994 Revisions Next

r9826 Sunday 26th December, 2010 at 22:32:43 UTC by Wilbert Pol
[OSBEXEC] Added some more bits.
[src/mess/drivers]osbexec.c

src/mess/drivers/osbexec.c
r9825r9826
5353   osbexec_state(running_machine &machine, const driver_device_config_base &config)
5454      : driver_device(machine, config) { }
5555
56   running_device   *maincpu;
57   running_device   *mb8877;
58   running_device   *messram;
59   running_device   *pia_0;
60   running_device   *pia_1;
61   running_device   *sio;
62   running_device   *speaker;
63
5664   region_info   *fontram_region;
5765   region_info *vram_region;
5866   UINT8   *fontram;
r9825r9826
6270   /* PIA 0 (UD12) */
6371   UINT8   pia0_porta;
6472   UINT8   pia0_portb;
73   int      pia0_irq_state;
6574
75   /* PIA 1 (UD8) */
76   int      pia1_irq_state;
6677
78   /* Vblank counter ("RTC") */
79   UINT8   rtc;
80
6781   void set_banks(running_machine *machine)
6882   {
69      UINT8 *messram_ptr = messram_get_ptr( machine->device("messram") );
83      UINT8 *messram_ptr = messram_get_ptr( messram );
7084
7185      if ( pia0_porta & 0x01 )
7286         messram_ptr += 0x10000;
r9825r9826
8296         memory_set_bankptr(machine, "c000", vram_region->base() );
8397   }
8498
99   void update_irq_state(running_machine *machine)
100   {
101      if ( pia0_irq_state || pia1_irq_state )
102         cpu_set_input_line( maincpu, 0, ASSERT_LINE );
103      else
104         cpu_set_input_line( maincpu, 0, CLEAR_LINE );
105   }
85106};
86107
87108
r9825r9826
98119}
99120
100121
122static READ8_HANDLER( osbexec_rtc_r )
123{
124   osbexec_state *state = space->machine->driver_data<osbexec_state>();
125
126   return state->rtc;
127}
128
129
101130static ADDRESS_MAP_START( osbexec_mem, ADDRESS_SPACE_PROGRAM, 8 )
102131   AM_RANGE( 0x0000, 0x1FFF ) AM_READ_BANK("0000") AM_WRITE( osbexec_0000_w )   /* ROM and maybe also banked ram */
103132   AM_RANGE( 0x2000, 0x3FFF ) AM_RAM                                 /* Banked? RAM */
r9825r9826
117146   AM_RANGE( 0x0C, 0x0F ) AM_DEVREADWRITE( "sio", z80dart_ba_cd_r, z80dart_ba_cd_w )   /* SIO @ UD4 */
118147   /* 0x10 - 0x13 - 6821 PIA @UD8 */
119148   /* 0x14 - 0x17 - kbd */
120   /* 0x18 - 0x1b - "RTC" */
149   AM_RANGE( 0x18, 0x1b ) AM_READ( osbexec_rtc_r )                        /* "RTC" @ UE13/UF13 */
121150   /* ?? - vid ? */
122151ADDRESS_MAP_END
123152
r9825r9826
274303static WRITE8_DEVICE_HANDLER( osbexec_pia0_b_w )
275304{
276305   osbexec_state *state = device->machine->driver_data<osbexec_state>();
277   running_device *speaker = device->machine->device("speaker");
278306
279307   state->pia0_portb = data;
280308
281   speaker_level_w( speaker, ( data & 0x08 ) ? 0 : 1 );
309   speaker_level_w( state->speaker, ( data & 0x08 ) ? 0 : 1 );
310   wd17xx_dden_w( state->mb8877, ( data & 0x01 ) ? 1 : 0 );
282311}
283312
284313
314static WRITE_LINE_DEVICE_HANDLER( osbexec_pia0_irq )
315{
316   osbexec_state *st = device->machine->driver_data<osbexec_state>();
317
318   st->pia0_irq_state = state;
319   st->update_irq_state( device->machine );
320}
321
322
285323static const pia6821_interface osbexec_pia0_config =
286324{
287325   DEVCB_HANDLER( osbexec_pia0_a_r ),   /* in_a_func */         /* port A - banking */
r9825r9826
294332   DEVCB_HANDLER( osbexec_pia0_b_w ),   /* out_b_func */      /* modem / speaker */
295333   DEVCB_NULL,                     /* out_ca2_func */      /* Keyboard strobe */
296334   DEVCB_NULL,                     /* out_cb2_func */      /* 60/50 */
297   DEVCB_NULL,                     /* irq_a_func */      /* IRQ */
298   DEVCB_NULL                     /* irq_b_func */      /* IRQ */
335   DEVCB_LINE( osbexec_pia0_irq ),      /* irq_a_func */      /* IRQ */
336   DEVCB_LINE( osbexec_pia0_irq )      /* irq_b_func */      /* IRQ */
299337};
300338
301339
340static WRITE_LINE_DEVICE_HANDLER( osbexec_pia1_irq )
341{
342   osbexec_state *st = device->machine->driver_data<osbexec_state>();
343
344   st->pia1_irq_state = state;
345   st->update_irq_state( device->machine );
346}
347
348
302349static const pia6821_interface osbexec_pia1_config =
303350{
304351   DEVCB_NULL,                     /* in_a_func */
r9825r9826
311358   DEVCB_NULL,                     /* out_b_func */
312359   DEVCB_NULL,                     /* out_ca2_func */
313360   DEVCB_NULL,                     /* out_cb2_func */
314   DEVCB_NULL,                     /* irq_a_func */
315   DEVCB_NULL                     /* irq_b_func */
361   DEVCB_LINE( osbexec_pia1_irq ),      /* irq_a_func */
362   DEVCB_LINE( osbexec_pia1_irq )      /* irq_b_func */
316363};
317364
318365
r9825r9826
397444static TIMER_CALLBACK( osbexec_video_callback )
398445{
399446   osbexec_state *state = machine->driver_data<osbexec_state>();
400   running_device *pia_0 = machine->device("pia_0");
401447   int y = machine->primary_screen->vpos();
402448
403449   /* Start of frame */
404450   if ( y == 0 )
405451   {
406452      /* Clear CB1 on PIA @ UD12 */
407      pia6821_cb1_w( pia_0, 0 );
453      pia6821_cb1_w( state->pia_0, 0 );
408454   }
409455   else if ( y == 240 )
410456   {
411457      /* Set CB1 on PIA @ UD12 */
412      pia6821_cb1_w( pia_0, 1 );
458      pia6821_cb1_w( state->pia_0, 1 );
459      state->rtc++;
413460   }
414461   if ( y < 240 )
415462   {
r9825r9826
428475         if ( ( attr & 0x40 ) && char_line == 9 )
429476            font_bits = 0xFF;
430477
478         /* Check for blink */
479         if ( ( attr & 0x20 ) && ( state->rtc & 0x10 ) )
480            font_bits = 0;
481
482         /* Check for inverse video */
483         if ( attr & 0x10 )
484            font_bits ^= 0xFF;
485
431486         for ( int b = 0; b < 8; b++ )
432487         {
433488            p[ x * 8 + b ] = ( font_bits & 0x80 ) ? fg_col : 0;
r9825r9826
457512}
458513
459514
515static MACHINE_START( osbexec )
516{
517   osbexec_state *state = machine->driver_data<osbexec_state>();
518
519   state->maincpu = machine->device( "maincpu" );
520   state->mb8877  = machine->device( "mb8877" );
521   state->messram = machine->device( "messram" );
522   state->pia_0   = machine->device( "pia_0" );
523   state->pia_1   = machine->device( "pia_1" );
524   state->sio     = machine->device( "sio" );
525   state->speaker = machine->device( "speaker" );
526}
527
528
460529static MACHINE_RESET( osbexec )
461530{
462531   osbexec_state *state = machine->driver_data<osbexec_state>();
r9825r9826
466535   state->set_banks( machine );
467536
468537   timer_adjust_oneshot( state->video_timer, machine->primary_screen->time_until_pos( 0, 0 ), 0 );
538
539   state->rtc = 0;
469540}
470541
471542
543static const z80_daisy_config osbexec_daisy_config[] =
544{
545    { "sio" },
546   { NULL }
547};
548
549
472550static MACHINE_CONFIG_START( osbexec, osbexec_state )
473551   MDRV_CPU_ADD( "maincpu", Z80, MAIN_CLOCK/6 )
474552   MDRV_CPU_PROGRAM_MAP( osbexec_mem)
475553   MDRV_CPU_IO_MAP( osbexec_io)
554   MDRV_CPU_CONFIG( osbexec_daisy_config )
476555
556   MDRV_MACHINE_START( osbexec )
477557   MDRV_MACHINE_RESET( osbexec )
478558
479559   MDRV_SCREEN_ADD("screen", RASTER)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team