Previous 15994 Revisions Next

r5560 Wednesday 2nd September, 2009 at 19:41:21 UTC by Angelo Salese
cleaned-up the X1 driver
[src/mess/drivers]x1.c

src/mess/drivers/x1.c
r5559r5560
165165   UINT8 gfx_bank;
166166   UINT8 pcg_mode;
167167}scrn_reg;
168static UINT8 pcg_write_addr;
168169
170
171/*************************************
172 *
173 *  Video Functions
174 *
175 *************************************/
176
169177static VIDEO_START( x1 )
170178{
171179   colorram = auto_alloc_array(machine, UINT8, 0x1000);
r5559r5560
307315{
308316}
309317
318/*************************************
319 *
320 *  Keyboard MCU simulation
321 *
322 *************************************/
323
310324static UINT8 sub_cmd,sub_val,key_flag;
325static UINT8 sub_cmd_length;
311326
312/*
313Keyboard MCU simulation
314*/
315
316327static UINT8 check_keyboard_press(running_machine *machine)
317328{
318329   const char* portnames[3] = { "key1","key2","key3" };
r5559r5560
337348   return 0;
338349}
339350
340static UINT8 sub_cmd_length;
341
342351static READ8_HANDLER( sub_io_r )
343352{
344353   if(sub_obf)
r5559r5560
407416   sub_obf = (sub_cmd_length) ? 0x00 : 0x20;
408417}
409418
419/*************************************
420 *
421 *  ROM Image / Banking Handling
422 *
423 *************************************/
424
410425static UINT8 rom_index[3];
411426
412427static READ8_HANDLER( x1_rom_r )
r5559r5560
444459   ROM[0x10000+offset] = data;
445460}
446461
447/*
448FDC is a MB8877A, wd17XX compatible
449*/
450462
463/*************************************
464 *
465 *  MB8877A FDC (wd17XX compatible)
466 *
467 *************************************/
468
451469//static UINT8 fdc_irq_flag;
452470//static UINT8 fdc_drq_flag;
453471//static UINT8 fdc_side;
r5559r5560
519537         wd17xx_data_w(dev,offset,data);
520538         break;
521539      case 0x0ffc:
522         /* data & 3 = disk drive, TODO */
523         //if(data & 3)
524         //   fatalerror("FDC: Using more than 1 floppy disk drive!");
525540         wd17xx_set_drive(dev,data & 3);
526541         floppy_drive_set_motor_state(image_from_devtype_and_index(space->machine, IO_FLOPPY, data & 3), data & 0x80);
527542         floppy_drive_set_ready_state(image_from_devtype_and_index(space->machine, IO_FLOPPY, data & 3), data & 0x80,0);
r5559r5560
541556   NULL
542557};
543558
544/* for bitmap mode */
545static UINT8 x_b,x_g,x_r;
559/*************************************
560 *
561 *  Programmable Character Generator
562 *
563 *************************************/
546564
547static void set_current_palette(running_machine *machine)
548{
549   UINT8 addr,r,g,b;
550
551   for(addr=0;addr<8;addr++)
552   {
553      r = ((x_r)>>(addr)) & 1;
554      g = ((x_g)>>(addr)) & 1;
555      b = ((x_b)>>(addr)) & 1;
556
557      palette_set_color_rgb(machine, addr+0x100, pal1bit(r), pal1bit(g), pal1bit(b));
558   }
559}
560
561static WRITE8_HANDLER( x1_pal_r_w ) { x_r = data; set_current_palette(space->machine); }
562static WRITE8_HANDLER( x1_pal_g_w ) { x_g = data; set_current_palette(space->machine); }
563static WRITE8_HANDLER( x1_pal_b_w ) { x_b = data; set_current_palette(space->machine); }
564
565static WRITE8_HANDLER( x1_dma_w )
566{
567   printf("%02x %02x\n",offset,data);
568   //if(data)
569   //   fatalerror("Data written to the DMA space");
570}
571
572565/* TODO: apparently this is for the alternative PCG mode */
573566#if 0
574567static UINT16 check_pcg_addr(running_machine *machine)
r5559r5560
582575}
583576#endif
584577
585static UINT8 pcg_write_addr;
586
587578static READ8_HANDLER( x1_pcg_r )
588579{
589580   #if 0
r5559r5560
656647   }
657648}
658649
659static READ8_HANDLER( x1_clr_r )
650/*************************************
651 *
652 *  Other Video-related functions
653 *
654 *************************************/
655
656/* for bitmap mode */
657static UINT8 x_b,x_g,x_r;
658
659static void set_current_palette(running_machine *machine)
660660{
661   UINT8 addr,r,g,b;
661662
662   return 0xff;
663   for(addr=0;addr<8;addr++)
664   {
665      r = ((x_r)>>(addr)) & 1;
666      g = ((x_g)>>(addr)) & 1;
667      b = ((x_b)>>(addr)) & 1;
668
669      palette_set_color_rgb(machine, addr+0x100, pal1bit(r), pal1bit(g), pal1bit(b));
670   }
663671}
664672
673static WRITE8_HANDLER( x1_pal_r_w ) { x_r = data; set_current_palette(space->machine); }
674static WRITE8_HANDLER( x1_pal_g_w ) { x_g = data; set_current_palette(space->machine); }
675static WRITE8_HANDLER( x1_pal_b_w ) { x_b = data; set_current_palette(space->machine); }
676
665677static WRITE8_HANDLER( x1_ex_gfxram_w )
666678{
667679   static UINT8 ex_mask;
r5559r5560
707719   }
708720}
709721
722static WRITE8_HANDLER( x1_dma_w )
723{
724   printf("%02x %02x\n",offset,data);
725   //if(data)
726   //   fatalerror("Data written to the DMA space");
727}
728
729
730/*************************************
731 *
732 *  Memory maps
733 *
734 *************************************/
735
710736static READ8_HANDLER( x1_io_r )
711737{
712738   io_bank_mode = 0; //any read disables the extended mode.
713739
714   if(offset == 0x0000)                           { return x1_clr_r(space, 0); }
715   else if(offset >= 0x0704 && offset <= 0x0707)   { return z80ctc_r(devtag_get_device(space->machine, "ctc"), offset-0x0704); }
740   if(offset >= 0x0704 && offset <= 0x0707)         { return z80ctc_r(devtag_get_device(space->machine, "ctc"), offset-0x0704); }
716741   else if(offset == 0x0e03)                       { return x1_rom_r(space, 0); }
717742   else if(offset >= 0x0ff8 && offset <= 0x0fff)   { return x1_fdc_r(space, offset-0xff8); }
718743   else if(offset >= 0x1400 && offset <= 0x17ff)   { return x1_pcg_r(space, offset-0x1400); }
r5559r5560
771796{
772797   io_bank_mode = 0; //any read disables the extended mode.
773798
774   if(offset == 0x0000)                           { return x1_clr_r(space, 0); }
775   else if(offset == 0x0700 || offset == 0x0701)   { return ym2151_r(devtag_get_device(space->machine, "ym"), offset-0x0700); }
799   if(offset == 0x0700 || offset == 0x0701)      { return ym2151_r(devtag_get_device(space->machine, "ym"), offset-0x0700); }
776800   else if(offset >= 0x0704 && offset <= 0x0707)   { return z80ctc_r(devtag_get_device(space->machine, "ctc"), offset-0x0704); }
777801   else if(offset == 0x0e03)                       { return x1_rom_r(space, 0); }
778802   else if(offset >= 0x0ff8 && offset <= 0x0fff)   { return x1_fdc_r(space, offset-0xff8); }
r5559r5560
846870   AM_RANGE(0x0000, 0xffff) AM_READWRITE(x1turbo_io_r, x1turbo_io_w)
847871ADDRESS_MAP_END
848872
849static const gfx_layout x1_chars_8x8 =
850{
851   8,8,
852   RGN_FRAC(1,1),
853   1,
854   { 0 },
855   { 0, 1, 2, 3, 4, 5, 6, 7 },
856   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
857   8*8
858};
873/*************************************
874 *
875 *  PPI8255
876 *
877 *************************************/
859878
860static const gfx_layout x1_chars_8wx8 =
861{
862   16,8,
863   RGN_FRAC(1,1),
864   1,
865   { 0 },
866   { 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7 },
867   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
868   8*8
869};
870
871static const gfx_layout x1_chars_8x8w =
872{
873   8,16,
874   RGN_FRAC(1,1),
875   1,
876   { 0 },
877   { 0, 1, 2, 3, 4, 5, 6, 7 },
878   { 0*8, 0*8, 1*8, 1*8, 2*8, 2*8, 3*8, 3*8, 4*8, 4*8, 5*8, 5*8, 6*8, 6*8, 7*8, 7*8 },
879   8*8
880};
881
882static const gfx_layout x1_chars_8wx8w =
883{
884   16,16,
885   RGN_FRAC(1,1),
886   1,
887   { 0 },
888   { 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7 },
889   { 0*8, 0*8, 1*8, 1*8, 2*8, 2*8, 3*8, 3*8, 4*8, 4*8, 5*8, 5*8, 6*8, 6*8, 7*8, 7*8 },
890   8*8
891};
892
893static const gfx_layout x1_pcg_8x8 =
894{
895   8,8,
896   RGN_FRAC(1,3),
897   3,
898   { RGN_FRAC(2,3),RGN_FRAC(1,3),RGN_FRAC(0,3) },
899   { 0, 1, 2, 3, 4, 5, 6, 7 },
900   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
901   8*8
902};
903
904static const gfx_layout x1_pcg_8wx8 =
905{
906   16,8,
907   RGN_FRAC(1,3),
908   3,
909   { RGN_FRAC(2,3),RGN_FRAC(1,3),RGN_FRAC(0,3) },
910   { 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7 },
911   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
912   8*8
913};
914
915static const gfx_layout x1_pcg_8x8w =
916{
917   8,16,
918   RGN_FRAC(1,3),
919   3,
920   { RGN_FRAC(2,3),RGN_FRAC(1,3),RGN_FRAC(0,3) },
921   { 0, 1, 2, 3, 4, 5, 6, 7 },
922   { 0*8, 0*8, 1*8, 1*8, 2*8, 2*8, 3*8, 3*8, 4*8, 4*8, 5*8, 5*8, 6*8, 6*8, 7*8, 7*8 },
923   8*8
924};
925
926static const gfx_layout x1_pcg_8wx8w =
927{
928   16,16,
929   RGN_FRAC(1,3),
930   3,
931   { RGN_FRAC(2,3),RGN_FRAC(1,3),RGN_FRAC(0,3) },
932   { 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7 },
933   { 0*8, 0*8, 1*8, 1*8, 2*8, 2*8, 3*8, 3*8, 4*8, 4*8, 5*8, 5*8, 6*8, 6*8, 7*8, 7*8 },
934   8*8
935};
936
937static const gfx_layout x1_chars_16x16 =
938{
939   16,16,
940   RGN_FRAC(1,1),
941   1,
942   { 0 },
943   { 0, 1, 2, 3, 4, 5, 6, 7,8,9,10,11,12,13,14,15 },
944   { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16,8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16 },
945   16*16
946};
947
948/* TODO: separe the different x1 decodings accordingly */
949static GFXDECODE_START( x1 )
950   /* decoded for debugging purpose, they will be nuked in the end */
951   GFXDECODE_ENTRY( "cgrom", 0x00000, x1_chars_8x8,    0x200, 0x20 )
952   GFXDECODE_ENTRY( "cgrom", 0x00000, x1_chars_8wx8,   0x200, 0x20 )
953   GFXDECODE_ENTRY( "cgrom", 0x00000, x1_chars_8x8w,   0x200, 0x20 )
954   GFXDECODE_ENTRY( "cgrom", 0x00000, x1_chars_8wx8w,  0x200, 0x20 )
955   GFXDECODE_ENTRY( "pcg",   0x00000, x1_pcg_8x8,      0x100, 1 )
956   GFXDECODE_ENTRY( "pcg",   0x00000, x1_pcg_8wx8,     0x100, 1 )
957   GFXDECODE_ENTRY( "pcg",   0x00000, x1_pcg_8x8w,     0x100, 1 )
958   GFXDECODE_ENTRY( "pcg",   0x00000, x1_pcg_8wx8w,    0x100, 1 )
959   GFXDECODE_ENTRY( "cgrom", 0x01800, x1_chars_16x16,  0, 0x20 ) //only x1turboz uses this so far
960   GFXDECODE_ENTRY( "kanji", 0x27000, x1_chars_16x16,  0, 0x20 ) //needs to be checked when the ROM will be redumped
961GFXDECODE_END
962
963static PALETTE_INIT(x1)
964{
965   int i;
966
967   for(i=0;i<0x300;i++)
968      palette_set_color(machine, i,MAKE_RGB(0x00,0x00,0x00));
969
970   for (i = 0x200; i < 0x220; i++)
971   {
972      UINT8 r,g,b;
973
974      if(i & 0x01)
975      {
976         r = ((i >> 3) & 1) ? 0xff : 0x00;
977         g = ((i >> 2) & 1) ? 0xff : 0x00;
978         b = ((i >> 1) & 1) ? 0xff : 0x00;
979      }
980      else { r = g = b = 0x00; }
981
982      if(i & 0x10) { r^=0xff; g^=0xff; b^=0xff; }
983
984      palette_set_color_rgb(machine, i, r,g,b);
985   }
986
987   /* TODO: fix this */
988   for(i=0;i<8;i++)
989   {
990      palette_set_color_rgb(machine, i+0x000, pal1bit(i >> 2), pal1bit(i >> 1), pal1bit(i >> 0));
991      palette_set_color_rgb(machine, i+0x100, pal1bit(i >> 2), pal1bit(i >> 1), pal1bit(i >> 0));
992   }
993}
994
995879static READ8_DEVICE_HANDLER( x1_porta_r )
996880{
997881   printf("PPI Port A read\n");
r5559r5560
1039923
1040924static WRITE8_DEVICE_HANDLER( x1_portc_w )
1041925{
1042   //printf("PPI Port C write %02x\n",data);
1043926   hres_320 = data & 0x40;
1044927
1045//   if(hres_320 && data & 0x20 && io_switch & 0x20 && (data & 0xa0) != 0)
1046
1047928   if(((data & 0x20) == 0) && (io_switch & 0x20))
1048929      io_bank_mode = 1;
1049930
1050931   io_switch = data & 0x20;
1051932   io_sys = data & 0xff;
1052
1053   //if(io_sys_state != io_sys)
1054   //   io_sys_state = io_sys;
1055933}
1056934
1057935static const ppi8255_interface ppi8255_intf =
r5559r5560
1078956   NULL      /* update address callback */
1079957};
1080958
1081/* Input ports */
959/*************************************
960 *
961 *  Inputs
962 *
963 *************************************/
964
1082965static INPUT_PORTS_START( x1 )
1083966   PORT_START("SYSTEM")
1084967   PORT_DIPNAME( 0x01, 0x01, "SYSTEM" )
r5559r5560
13111194   #endif
13121195INPUT_PORTS_END
13131196
1314static MACHINE_RESET( x1 )
1197/*************************************
1198 *
1199 *  GFX decoding
1200 *
1201 *************************************/
1202
1203static const gfx_layout x1_chars_8x8 =
13151204{
1316   UINT8 *ROM = memory_region(machine, "maincpu");
1317   UINT8 *PCG_RAM = memory_region(machine, "pcg");
1318   int i;
1205   8,8,
1206   RGN_FRAC(1,1),
1207   1,
1208   { 0 },
1209   { 0, 1, 2, 3, 4, 5, 6, 7 },
1210   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
1211   8*8
1212};
13191213
1320   memory_set_bankptr(machine, 1, &ROM[0x00000]);
1214static const gfx_layout x1_chars_8wx8 =
1215{
1216   16,8,
1217   RGN_FRAC(1,1),
1218   1,
1219   { 0 },
1220   { 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7 },
1221   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
1222   8*8
1223};
13211224
1322   memset(gfx_bitmap_ram,0x00,0xc000*2);
1225static const gfx_layout x1_chars_8x8w =
1226{
1227   8,16,
1228   RGN_FRAC(1,1),
1229   1,
1230   { 0 },
1231   { 0, 1, 2, 3, 4, 5, 6, 7 },
1232   { 0*8, 0*8, 1*8, 1*8, 2*8, 2*8, 3*8, 3*8, 4*8, 4*8, 5*8, 5*8, 6*8, 6*8, 7*8, 7*8 },
1233   8*8
1234};
13231235
1324   for(i=0;i<0x1800;i++)
1325   {
1326      PCG_RAM[i] = 0;
1327   }
1236static const gfx_layout x1_chars_8wx8w =
1237{
1238   16,16,
1239   RGN_FRAC(1,1),
1240   1,
1241   { 0 },
1242   { 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7 },
1243   { 0*8, 0*8, 1*8, 1*8, 2*8, 2*8, 3*8, 3*8, 4*8, 4*8, 5*8, 5*8, 6*8, 6*8, 7*8, 7*8 },
1244   8*8
1245};
13281246
1329   for(i=0;i<0x0400;i++)
1330   {
1331      gfx_element_mark_dirty(machine->gfx[4], i);
1332         gfx_element_mark_dirty(machine->gfx[5], i);
1333         gfx_element_mark_dirty(machine->gfx[6], i);
1334      gfx_element_mark_dirty(machine->gfx[7], i);
1335   }
1247static const gfx_layout x1_pcg_8x8 =
1248{
1249   8,8,
1250   RGN_FRAC(1,3),
1251   3,
1252   { RGN_FRAC(2,3),RGN_FRAC(1,3),RGN_FRAC(0,3) },
1253   { 0, 1, 2, 3, 4, 5, 6, 7 },
1254   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
1255   8*8
1256};
13361257
1337   io_bank_mode = 0;
1338   pcg_index[0] = pcg_index[1] = pcg_index[2] = 0;
1339}
1258static const gfx_layout x1_pcg_8wx8 =
1259{
1260   16,8,
1261   RGN_FRAC(1,3),
1262   3,
1263   { RGN_FRAC(2,3),RGN_FRAC(1,3),RGN_FRAC(0,3) },
1264   { 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7 },
1265   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
1266   8*8
1267};
13401268
1269static const gfx_layout x1_pcg_8x8w =
1270{
1271   8,16,
1272   RGN_FRAC(1,3),
1273   3,
1274   { RGN_FRAC(2,3),RGN_FRAC(1,3),RGN_FRAC(0,3) },
1275   { 0, 1, 2, 3, 4, 5, 6, 7 },
1276   { 0*8, 0*8, 1*8, 1*8, 2*8, 2*8, 3*8, 3*8, 4*8, 4*8, 5*8, 5*8, 6*8, 6*8, 7*8, 7*8 },
1277   8*8
1278};
1279
1280static const gfx_layout x1_pcg_8wx8w =
1281{
1282   16,16,
1283   RGN_FRAC(1,3),
1284   3,
1285   { RGN_FRAC(2,3),RGN_FRAC(1,3),RGN_FRAC(0,3) },
1286   { 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7 },
1287   { 0*8, 0*8, 1*8, 1*8, 2*8, 2*8, 3*8, 3*8, 4*8, 4*8, 5*8, 5*8, 6*8, 6*8, 7*8, 7*8 },
1288   8*8
1289};
1290
1291static const gfx_layout x1_chars_16x16 =
1292{
1293   16,16,
1294   RGN_FRAC(1,1),
1295   1,
1296   { 0 },
1297   { 0, 1, 2, 3, 4, 5, 6, 7,8,9,10,11,12,13,14,15 },
1298   { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16,8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16 },
1299   16*16
1300};
1301
1302/* decoded for debugging purpose, this will be nuked in the end... */
1303static GFXDECODE_START( x1 )
1304   GFXDECODE_ENTRY( "cgrom", 0x00000, x1_chars_8x8,    0x200, 0x20 )
1305   GFXDECODE_ENTRY( "cgrom", 0x00000, x1_chars_8wx8,   0x200, 0x20 )
1306   GFXDECODE_ENTRY( "cgrom", 0x00000, x1_chars_8x8w,   0x200, 0x20 )
1307   GFXDECODE_ENTRY( "cgrom", 0x00000, x1_chars_8wx8w,  0x200, 0x20 )
1308   GFXDECODE_ENTRY( "pcg",   0x00000, x1_pcg_8x8,      0x100, 1 )
1309   GFXDECODE_ENTRY( "pcg",   0x00000, x1_pcg_8wx8,     0x100, 1 )
1310   GFXDECODE_ENTRY( "pcg",   0x00000, x1_pcg_8x8w,     0x100, 1 )
1311   GFXDECODE_ENTRY( "pcg",   0x00000, x1_pcg_8wx8w,    0x100, 1 )
1312   GFXDECODE_ENTRY( "cgrom", 0x01800, x1_chars_16x16,  0, 0x20 ) //only x1turboz uses this so far
1313   GFXDECODE_ENTRY( "kanji", 0x27000, x1_chars_16x16,  0, 0x20 ) //needs to be checked when the ROM will be redumped
1314GFXDECODE_END
1315
1316/*************************************
1317 *
1318 *  CTC
1319 *
1320 *************************************/
1321
13411322static void ctc0_interrupt(const device_config *device, int state)
13421323{
13431324   //cputag_set_input_line(device->machine, "maincpu", 0, state);
r5559r5560
13531334   0,               // ZC/TO2 callback
13541335};
13551336
1337/*************************************
1338 *
1339 *  Sound HW Config
1340 *
1341 *************************************/
1342
13561343static const ay8910_interface ay8910_config =
13571344{
13581345   AY8910_LEGACY_OUTPUT,
r5559r5560
13631350   DEVCB_NULL
13641351};
13651352
1353// (ym-2151 handler here)
1354
1355/*************************************
1356 *
1357 *  Machine Functions
1358 *
1359 *************************************/
1360
13661361static INTERRUPT_GEN( x1_vbl )
13671362{
13681363//   pcg_reset = 1;
13691364}
13701365
1366static MACHINE_RESET( x1 )
1367{
1368   UINT8 *ROM = memory_region(machine, "maincpu");
1369   UINT8 *PCG_RAM = memory_region(machine, "pcg");
1370   int i;
1371
1372   memory_set_bankptr(machine, 1, &ROM[0x00000]);
1373
1374   memset(gfx_bitmap_ram,0x00,0xc000*2);
1375
1376   for(i=0;i<0x1800;i++)
1377   {
1378      PCG_RAM[i] = 0;
1379   }
1380
1381   for(i=0;i<0x0400;i++)
1382   {
1383      gfx_element_mark_dirty(machine->gfx[4], i);
1384         gfx_element_mark_dirty(machine->gfx[5], i);
1385         gfx_element_mark_dirty(machine->gfx[6], i);
1386      gfx_element_mark_dirty(machine->gfx[7], i);
1387   }
1388
1389   io_bank_mode = 0;
1390   pcg_index[0] = pcg_index[1] = pcg_index[2] = 0;
1391}
1392
1393static PALETTE_INIT(x1)
1394{
1395   int i;
1396
1397   for(i=0;i<0x300;i++)
1398      palette_set_color(machine, i,MAKE_RGB(0x00,0x00,0x00));
1399
1400   for (i = 0x200; i < 0x220; i++)
1401   {
1402      UINT8 r,g,b;
1403
1404      if(i & 0x01)
1405      {
1406         r = ((i >> 3) & 1) ? 0xff : 0x00;
1407         g = ((i >> 2) & 1) ? 0xff : 0x00;
1408         b = ((i >> 1) & 1) ? 0xff : 0x00;
1409      }
1410      else { r = g = b = 0x00; }
1411
1412      if(i & 0x10) { r^=0xff; g^=0xff; b^=0xff; }
1413
1414      palette_set_color_rgb(machine, i, r,g,b);
1415   }
1416
1417   /* TODO: fix this */
1418   for(i=0;i<8;i++)
1419   {
1420      palette_set_color_rgb(machine, i+0x000, pal1bit(i >> 2), pal1bit(i >> 1), pal1bit(i >> 0));
1421      palette_set_color_rgb(machine, i+0x100, pal1bit(i >> 2), pal1bit(i >> 1), pal1bit(i >> 0));
1422   }
1423}
1424
13711425static MACHINE_DRIVER_START( x1 )
13721426   /* basic machine hardware */
13731427   MDRV_CPU_ADD("maincpu", Z80, XTAL_4MHz)
r5559r5560
14191473   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
14201474MACHINE_DRIVER_END
14211475
1476/*************************************
1477 *
1478 *  Image Load Functions
1479 *
1480 *************************************/
1481
14221482static DEVICE_IMAGE_LOAD( x1_floppy )
14231483{
14241484   const char *ext;
r5559r5560
14781538   CONFIG_DEVICE(x1_floppy_getinfo)
14791539SYSTEM_CONFIG_END
14801540
1481/* ROM definition */
1482ROM_START( x1 )
1541/*************************************
1542 *
1543 * ROM definitions
1544 *
1545 *************************************/
1546
1547 ROM_START( x1 )
14831548   ROM_REGION( 0x20000, "maincpu", ROMREGION_ERASEFF )
14841549   ROM_SYSTEM_BIOS( 0, "default", "X1 IPL" )
14851550   ROMX_LOAD( "ipl.x1", 0x0000, 0x1000, CRC(7b28d9de) SHA1(c4db9a6e99873808c8022afd1c50fef556a8b44d), ROM_BIOS(1) )
r5559r5560
15721637ROM_END
15731638
15741639
1575/* Driver */
15761640
15771641/*    YEAR  NAME       PARENT  COMPAT   MACHINE  INPUT  INIT  CONFIG COMPANY   FULLNAME      FLAGS */
15781642COMP( 1982, x1,        0,      0,       x1,      x1,    0,    x1,    "Sharp",  "X1 (CZ-800C)",         GAME_NOT_WORKING)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team