Previous 15994 Revisions Next

r1817 Saturday 1st March, 2008 at 14:21:50 UTC by Robbbert
[SUPER80]Various improvements and fixes
[src/mess/drivers]super80.c

src/mess/drivers/super80.c
r1816r1817
3030static UINT8 mc6845_reg;            /* register index */
3131static UINT8 mc6845_mask[]={0xff,0xff,0xff,0x0f,0x7f,0x1f,0x7f,0x7f,3,0x1f,0x7f,0x1f,0x3f,0xff,0x3f,0xff,0,0};
3232
33#define SUPER80V_SCREEN_WIDTH        (560)
34#define SUPER80V_SCREEN_HEIGHT       (300)
33#define MASTER_CLOCK         (12e6)      /* 12mhz */
34#define HTOTAL            (384)
35#define HBEND            (0)
36#define HBSTART            (256)
37#define VTOTAL            (240)
38#define VBEND            (0)
39#define VBSTART            (160)
3540
41#define SUPER80V_SCREEN_WIDTH      (560)
42#define SUPER80V_SCREEN_HEIGHT      (300)
43
3644/**************************** PALETTES for super80m and super80v ******************************************/
3745
3846static const UINT8 super80_rgb_palette[16*3] =
r1816r1817
196204   visarea.min_y = 0;
197205   visarea.max_y = SUPER80V_SCREEN_HEIGHT-1;
198206
199   /* dynamic screen sizing - we must override some user settings */
200   if (dyn)
201   {
202      mc6845[4] = mc6845[6];            // no band at top or bottom
203      mc6845[7] = mc6845[6];            // screen starts at the top line
204      mc6845[5] = 0;               // exactly at the top
205   }
206
207207   /* calculate the effect of sync and vertical adjustments */
208208   if ( mc6845[2] ) off_x = mc6845[0] - mc6845[2] - 23; else off_x = -24;
209209
r1816r1817
213213
214214   if( off_y > 128 ) off_y = 128;
215215
216   if (dyn)
217   {
218      off_x = 0;
219      off_y = 0;
220   }
221
216222   width = mc6845[1]*7-1;                     // width in pixels
217223   height = mc6845[6]*(mc6845[9]+1)-1;               // height in pixels
218224   bytes = mc6845[1]*mc6845[6]-1;                  // video ram needed -1
r1816r1817
233239         video_screen_configure(0, SUPER80V_SCREEN_WIDTH, SUPER80V_SCREEN_HEIGHT, &visarea, state->refresh);   // in case dipswitch was just turned to NO
234240}
235241
236static VIDEO_EOF( super80 )
242static VIDEO_EOF( super80m )
237243{
238   UINT8 go_fast = 0;
239   if ((super80_mhz == 2) || (!(readinputport(9) & 2)))   /* bit 2 of port F0 is low, OR user turned on config switch */
240      go_fast++;
241
242   /* code to slow down computer to 1mhz by halting cpu on every second frame */
243   if (!go_fast)
244   {
245      if (!int_sw)
246         cpunum_set_input_line(machine, 0, INPUT_LINE_HALT, ASSERT_LINE);   // if going, stop it
247
248      int_sw++;
249      if (int_sw > 1)
250      {
251         cpunum_set_input_line(machine, 0, INPUT_LINE_HALT, CLEAR_LINE);      // if stopped, start it
252         int_sw = 0;
253      }
254   }
255   else
256   {
257      if (int_sw < 8)                        // @2mhz, reset just once
258      {
259         cpunum_set_input_line(machine, 0, INPUT_LINE_HALT, CLEAR_LINE);
260         int_sw = 8;                     // ...not every time
261      }
262   }
263}
264
265static VIDEO_EOF( super80v )
266{
267244   /* if we chose another palette or colour mode, enable it */
268245   UINT8 chosen_palette = (readinputport(9) & 0x60)>>5;            // read colour dipswitches
269246
r1816r1817
277254   }
278255}
279256
280static VIDEO_EOF( super80m )
281{
282   VIDEO_EOF_CALL( super80v );
283   VIDEO_EOF_CALL( super80 );   
284}
285
286257static VIDEO_UPDATE( super80 )
287258{
288259   UINT8 x, y, code=32, screen_on=0;
r1816r1817
811782
812783/**************************** BASIC MACHINE CONSTRUCTION ***********************************************************/
813784
785static TIMER_CALLBACK( super80_halfspeed )
786{
787   UINT8 go_fast = 0;
788   if ((super80_mhz == 2) || (!(readinputport(9) & 2)))   /* bit 2 of port F0 is low, OR user turned on config switch */
789      go_fast++;
790
791   /* code to slow down computer to 1mhz by halting cpu on every second frame */
792   if (!go_fast)
793   {
794      if (!int_sw)
795         cpunum_set_input_line(machine, 0, INPUT_LINE_HALT, ASSERT_LINE);   // if going, stop it
796
797      int_sw++;
798      if (int_sw > 1)
799      {
800         cpunum_set_input_line(machine, 0, INPUT_LINE_HALT, CLEAR_LINE);      // if stopped, start it
801         int_sw = 0;
802      }
803   }
804   else
805   {
806      if (int_sw < 8)                        // @2mhz, reset just once
807      {
808         cpunum_set_input_line(machine, 0, INPUT_LINE_HALT, CLEAR_LINE);
809         int_sw = 8;                     // ...not every time
810      }
811   }
812}
813
814
814815/* after the first 4 bytes have been read from ROM, switch the ram back in */
815816static TIMER_CALLBACK( super80_reset )
816817{
r1816r1817
826827
827828static MACHINE_DRIVER_START( super80 )
828829   /* basic machine hardware */
829   MDRV_CPU_ADD_TAG("main", Z80, 12000000/6)      /* 2 Mhz */
830   MDRV_CPU_ADD_TAG("main", Z80, MASTER_CLOCK/6)      /* 2 Mhz */
830831   MDRV_CPU_PROGRAM_MAP(super80_map, 0)
831832   MDRV_CPU_IO_MAP(super80_io, 0)
832833   MDRV_CPU_CONFIG(super80_daisy_chain)
r1816r1817
836837   MDRV_GFXDECODE(super80)
837838   MDRV_SCREEN_ADD("main", RASTER)
838839   MDRV_SCREEN_REFRESH_RATE(48.8)
839//   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(200))
840840   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
841   MDRV_SCREEN_SIZE(32*8, 16*10)
842   MDRV_SCREEN_VISIBLE_AREA(0, 32*8-1, 0, 16*10-1)
841   MDRV_SCREEN_RAW_PARAMS(MASTER_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART)
843842   MDRV_PALETTE_LENGTH(2)
844843   MDRV_PALETTE_INIT(black_and_white)
845844
846   MDRV_VIDEO_EOF(super80)
847845   MDRV_VIDEO_UPDATE(super80)
848846
849847   /* sound hardware */
r1816r1817
872870MACHINE_DRIVER_END
873871
874872static MACHINE_DRIVER_START( super80v )
875   MDRV_IMPORT_FROM(super80m)
876   MDRV_CPU_MODIFY("main")
873   /* basic machine hardware */
874   MDRV_CPU_ADD_TAG("main", Z80, MASTER_CLOCK/6)      /* 2 Mhz */
877875   MDRV_CPU_PROGRAM_MAP(super80v_map, 0)
878876   MDRV_CPU_IO_MAP(super80v_io, 0)
877   MDRV_CPU_CONFIG(super80_daisy_chain)
879878
880//   MDRV_SCREEN_REFRESH_RATE(50)
879   MDRV_MACHINE_RESET( super80 )
880
881881   MDRV_GFXDECODE(super80v)
882//   MDRV_SCREEN_SIZE(SUPER80V_SCREEN_WIDTH, SUPER80V_SCREEN_HEIGHT)
883//   MDRV_SCREEN_VISIBLE_AREA(0, SUPER80V_SCREEN_WIDTH-1, 0, SUPER80V_SCREEN_HEIGHT-1)
884   MDRV_VIDEO_EOF(super80v)
882   MDRV_SCREEN_ADD("main", RASTER)
883   MDRV_SCREEN_REFRESH_RATE(50)
884   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
885   MDRV_SCREEN_SIZE(SUPER80V_SCREEN_WIDTH, SUPER80V_SCREEN_HEIGHT)
886   MDRV_SCREEN_VISIBLE_AREA(0, SUPER80V_SCREEN_WIDTH-1, 0, SUPER80V_SCREEN_HEIGHT-1)
887   MDRV_PALETTE_LENGTH(256*2)
888   MDRV_PALETTE_INIT(super80m)
889
890   MDRV_VIDEO_EOF(super80m)
885891   MDRV_VIDEO_UPDATE(super80v)
892
893   /* sound hardware */
894   MDRV_SPEAKER_STANDARD_MONO("mono")
895   MDRV_SOUND_ADD(WAVE, 0)
896   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
897   MDRV_SOUND_ADD(SPEAKER, 0)
898   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
886899MACHINE_DRIVER_END
887900
888
889static DRIVER_INIT( super80 )
901static void driver_init_common( void )
890902{
891903   UINT8 *RAM = memory_region(REGION_CPU1);
892904   memory_configure_bank(1, 0, 2, &RAM[0x0000], 0xc000);
893905   timer_pulse(ATTOTIME_IN_HZ(200000),NULL,0,super80_timer);   /* timer for keyboard and cassette */
894906}
895907
908static DRIVER_INIT( super80 )
909{
910   timer_pulse(ATTOTIME_IN_HZ(100),NULL,0,super80_halfspeed);   /* timer for 1mhz slowdown */
911   driver_init_common();
912}
913
896914static DRIVER_INIT( super80d )
897915{
898916   UINT8 *RAM = memory_region(REGION_GFX1);
r1816r1817
906924   pcgram = memory_region(REGION_CPU1)+0xf000;
907925   videoram = memory_region(REGION_CPU1)+0x18000;
908926   colorram = memory_region(REGION_CPU1)+0x1C000;
909   DRIVER_INIT_CALL( super80 );
927   driver_init_common();
910928}
911929
912930

Previous 15994 Revisions Next


© 1998-2018 The MESS Team