Previous 15994 Revisions Next

r5557 Tuesday 1st September, 2009 at 19:48:50 UTC by Angelo Salese
[X1]: Allow the X1Turbo versions to boot properly and hooked up basic YM-2151 hook-up for it, this allows some Turbo specific games to boot
[src/mess/drivers]x1.c

src/mess/drivers/x1.c
r5556r5557
1212   - Implement the interrupts (uses IM 2), basically used by the keyboard.
1313   - Implement DMA (X1Turbo only?)
1414   - clean-ups!
15   - x1turbo: understand how irq generation works for the ym-2151;
1516   - There are various unclear video things, these are:
1617      - Understand why some games still doesn't upload the proper PCG index;
1718      - Support the alternative PCG upload mode;
r5556r5557
145146#include "machine/8255ppi.h"
146147#include "sound/ay8910.h"
147148#include "video/mc6845.h"
149#include "sound/2151intf.h"
150
148151#include "machine/wd17xx.h"
149152#include "devices/basicdsk.h"
150153#include "includes/d88.h"
r5556r5557
632635   return 0xff;
633636}
634637
635static READ8_HANDLER( x1_io_r )
636{
637   io_bank_mode = 0; //any read disables the extended mode.
638
639   if(offset == 0x0000)                           { return x1_clr_r(space, 0); }
640   else if(offset >= 0x0704 && offset <= 0x0707)   { return z80ctc_r(devtag_get_device(space->machine, "ctc"), offset-0x0704); }
641   else if(offset == 0x0e03)                       { return x1_rom_r(space, 0); }
642   else if(offset >= 0x0ff8 && offset <= 0x0fff)   { return x1_fdc_r(space, offset-0xff8); }
643   else if(offset >= 0x1900 && offset <= 0x19ff)   { return sub_io_r(space, 0); }
644   else if(offset >= 0x1a00 && offset <= 0x1aff)   { return ppi8255_r(devtag_get_device(space->machine, "ppi8255_0"), (offset-0x1a00) & 3); }
645   else if(offset >= 0x1b00 && offset <= 0x1bff)   { return ay8910_r(devtag_get_device(space->machine, "ay"), 0); }
646//   else if(offset >= 0x1f90 && offset <= 0x1f93)   { return x1_sio_r(space,(offset-0x1f90) & 3); }
647   else if(offset >= 0x1fa0 && offset <= 0x1fa3)   { return z80ctc_r(devtag_get_device(space->machine, "ctc"), offset-0x1fa3); }
648   else if(offset >= 0x1fa8 && offset <= 0x1fab)   { return z80ctc_r(devtag_get_device(space->machine, "ctc"), offset-0x1fa8); }
649//   else if(offset >= 0x1fd0 && offset <= 0x1fdf)   { return x1_scrn_r(space,offset-0x1fd0); }
650   else if(offset >= 0x2000 && offset <= 0x2fff)   { return colorram[offset-0x2000]; }
651   else if(offset >= 0x3000 && offset <= 0x3fff)   { return videoram[offset-0x3000]; }
652   else if(offset >= 0x4000 && offset <= 0xffff)   { return gfx_bitmap_ram[offset-0x4000+(scrn_reg.gfx_bank*0xc000)]; }
653   else
654   {
655      logerror("(PC=%06x) Read i/o address %04x\n",cpu_get_pc(space->cpu),offset);
656   }
657   return 0xff;
658}
659
660638static WRITE8_HANDLER( x1_ex_gfxram_w )
661639{
662640   static UINT8 ex_mask;
r5556r5557
702680   }
703681}
704682
683static READ8_HANDLER( x1_io_r )
684{
685   io_bank_mode = 0; //any read disables the extended mode.
686
687   if(offset == 0x0000)                           { return x1_clr_r(space, 0); }
688   else if(offset >= 0x0704 && offset <= 0x0707)   { return z80ctc_r(devtag_get_device(space->machine, "ctc"), offset-0x0704); }
689   else if(offset == 0x0e03)                       { return x1_rom_r(space, 0); }
690   else if(offset >= 0x0ff8 && offset <= 0x0fff)   { return x1_fdc_r(space, offset-0xff8); }
691   else if(offset >= 0x1900 && offset <= 0x19ff)   { return sub_io_r(space, 0); }
692   else if(offset >= 0x1a00 && offset <= 0x1aff)   { return ppi8255_r(devtag_get_device(space->machine, "ppi8255_0"), (offset-0x1a00) & 3); }
693   else if(offset >= 0x1b00 && offset <= 0x1bff)   { return ay8910_r(devtag_get_device(space->machine, "ay"), 0); }
694//   else if(offset >= 0x1f90 && offset <= 0x1f93)   { return x1_sio_r(space,(offset-0x1f90) & 3); }
695   else if(offset >= 0x1fa0 && offset <= 0x1fa3)   { return z80ctc_r(devtag_get_device(space->machine, "ctc"), offset-0x1fa3); }
696   else if(offset >= 0x1fa8 && offset <= 0x1fab)   { return z80ctc_r(devtag_get_device(space->machine, "ctc"), offset-0x1fa8); }
697//   else if(offset >= 0x1fd0 && offset <= 0x1fdf)   { return x1_scrn_r(space,offset-0x1fd0); }
698   else if(offset >= 0x2000 && offset <= 0x2fff)   { return colorram[offset-0x2000]; }
699   else if(offset >= 0x3000 && offset <= 0x3fff)   { return videoram[offset-0x3000]; }
700   else if(offset >= 0x4000 && offset <= 0xffff)   { return gfx_bitmap_ram[offset-0x4000+(scrn_reg.gfx_bank*0xc000)]; }
701   else
702   {
703      logerror("(PC=%06x) Read i/o address %04x\n",cpu_get_pc(space->cpu),offset);
704   }
705   return 0xff;
706}
707
705708static WRITE8_HANDLER( x1_io_w )
706709{
707710   if(io_bank_mode == 1)                           { x1_ex_gfxram_w(space, offset, data); }
r5556r5557
736739   }
737740}
738741
742static READ8_HANDLER( x1turbo_io_r )
743{
744   io_bank_mode = 0; //any read disables the extended mode.
745
746   if(offset == 0x0000)                           { return x1_clr_r(space, 0); }
747   else if(offset == 0x0700 || offset == 0x0701)   { return ym2151_r(devtag_get_device(space->machine, "ym"), offset-0x0700); }
748   else if(offset >= 0x0704 && offset <= 0x0707)   { return z80ctc_r(devtag_get_device(space->machine, "ctc"), offset-0x0704); }
749   else if(offset == 0x0e03)                       { return x1_rom_r(space, 0); }
750   else if(offset >= 0x0ff8 && offset <= 0x0fff)   { return x1_fdc_r(space, offset-0xff8); }
751   else if(offset >= 0x1900 && offset <= 0x19ff)   { return sub_io_r(space, 0); }
752   else if(offset >= 0x1a00 && offset <= 0x1aff)   { return ppi8255_r(devtag_get_device(space->machine, "ppi8255_0"), (offset-0x1a00) & 3); }
753   else if(offset >= 0x1b00 && offset <= 0x1bff)   { return ay8910_r(devtag_get_device(space->machine, "ay"), 0); }
754//   else if(offset >= 0x1f90 && offset <= 0x1f93)   { return x1_sio_r(space,(offset-0x1f90) & 3); }
755   else if(offset >= 0x1fa0 && offset <= 0x1fa3)   { return z80ctc_r(devtag_get_device(space->machine, "ctc"), offset-0x1fa3); }
756   else if(offset >= 0x1fa8 && offset <= 0x1fab)   { return z80ctc_r(devtag_get_device(space->machine, "ctc"), offset-0x1fa8); }
757//   else if(offset >= 0x1fd0 && offset <= 0x1fdf)   { return x1_scrn_r(space,offset-0x1fd0); }
758   else if(offset >= 0x2000 && offset <= 0x2fff)   { return colorram[offset-0x2000]; }
759   else if(offset >= 0x3000 && offset <= 0x3fff)   { return videoram[offset-0x3000]; }
760   else if(offset >= 0x4000 && offset <= 0xffff)   { return gfx_bitmap_ram[offset-0x4000+(scrn_reg.gfx_bank*0xc000)]; }
761   else
762   {
763      logerror("(PC=%06x) Read i/o address %04x\n",cpu_get_pc(space->cpu),offset);
764   }
765   return 0xff;
766}
767
768static WRITE8_HANDLER( x1turbo_io_w )
769{
770   if(io_bank_mode == 1)                           { x1_ex_gfxram_w(space, offset, data); }
771   else if(offset == 0x0700 || offset == 0x0701)   { ym2151_w(devtag_get_device(space->machine, "ym"), offset-0x0700,data); }
772   else if(offset >= 0x0704 && offset <= 0x0707)   { z80ctc_w(devtag_get_device(space->machine, "ctc"), offset-0x0704,data); }
773//   else if(offset >= 0x0c00 && offset <= 0x0cff)   { x1_rs232c_w(space->machine, 0, data); }
774   else if(offset >= 0x0e00 && offset <= 0x0e02)     { x1_rom_w(space, offset-0xe00,data); }
775//   else if(offset >= 0x0e80 && offset <= 0x0e82)   { x1_kanji_w(space->machine, offset-0xe80,data); }
776   else if(offset >= 0x0ff8 && offset <= 0x0fff)   { x1_fdc_w(space, offset-0xff8,data); }
777   else if(offset >= 0x1000 && offset <= 0x10ff)   { x1_pal_b_w(space, 0,data); }
778   else if(offset >= 0x1100 && offset <= 0x11ff)   { x1_pal_r_w(space, 0,data); }
779   else if(offset >= 0x1200 && offset <= 0x12ff)   { x1_pal_g_w(space, 0,data); }
780   else if(offset >= 0x1300 && offset <= 0x13ff)   { x1_ply_w(space, 0,data); }
781   else if(offset >= 0x1400 && offset <= 0x17ff)   { x1_pcg_w(space, offset-0x1400,data); }
782   else if(offset == 0x1800 || offset == 0x1801)   { x1_6845_w(space, offset-0x1800, data); }
783   else if(offset >= 0x1900 && offset <= 0x19ff)   { sub_io_w(space, 0,data); }
784   else if(offset >= 0x1a00 && offset <= 0x1aff)   { ppi8255_w(devtag_get_device(space->machine, "ppi8255_0"), (offset-0x1a00) & 3,data); }
785   else if(offset >= 0x1b00 && offset <= 0x1bff)   { ay8910_data_w(devtag_get_device(space->machine, "ay"), 0,data); }
786   else if(offset >= 0x1c00 && offset <= 0x1cff)   { ay8910_address_w(devtag_get_device(space->machine, "ay"), 0,data); }
787   else if(offset >= 0x1d00 && offset <= 0x1dff)   { rom_bank_1_w(space,0,data); }
788   else if(offset >= 0x1e00 && offset <= 0x1eff)   { rom_bank_0_w(space,0,data); }
789   else if(offset >= 0x1f80 && offset <= 0x1f8f)   { x1_dma_w(space,offset-0x1f80,data); }
790//   else if(offset >= 0x1f90 && offset <= 0x1f93)   { x1_sio_w(space->machine,(offset-0x1f90) & 3),data; }
791   else if(offset >= 0x1fa0 && offset <= 0x1fa3)   { z80ctc_w(devtag_get_device(space->machine, "ctc"), offset-0x1fa3,data); }
792   else if(offset >= 0x1fa8 && offset <= 0x1fab)   { z80ctc_w(devtag_get_device(space->machine, "ctc"), offset-0x1fa8,data); }
793   else if(offset >= 0x1fd0 && offset <= 0x1fdf)   { x1_scrn_w(space,0,data); }
794   else if(offset >= 0x2000 && offset <= 0x2fff)   { colorram[offset-0x2000] = data; }
795   else if(offset >= 0x3000 && offset <= 0x3fff)   { videoram[offset-0x3000] = data; }
796   else if(offset >= 0x4000 && offset <= 0xffff)   { gfx_bitmap_ram[offset-0x4000+(scrn_reg.gfx_bank*0xc000)] = data; }
797   else
798   {
799      logerror("(PC=%06x) Write %02x at i/o address %04x\n",cpu_get_pc(space->cpu),data,offset);
800   }
801}
802
803
739804static ADDRESS_MAP_START( x1_mem, ADDRESS_SPACE_PROGRAM, 8 )
740805   ADDRESS_MAP_UNMAP_HIGH
741806   AM_RANGE(0x0000, 0x7fff) AM_ROMBANK(1) AM_WRITE(rom_data_w)
r5556r5557
747812   AM_RANGE(0x0000, 0xffff) AM_READWRITE(x1_io_r, x1_io_w)
748813ADDRESS_MAP_END
749814
815static ADDRESS_MAP_START( x1turbo_io , ADDRESS_SPACE_IO, 8 )
816   ADDRESS_MAP_UNMAP_HIGH
817   AM_RANGE(0x0000, 0xffff) AM_READWRITE(x1turbo_io_r, x1turbo_io_w)
818ADDRESS_MAP_END
819
750820static const gfx_layout x1_chars_8x8 =
751821{
752822   8,8,
r5556r5557
13091379   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
13101380MACHINE_DRIVER_END
13111381
1382static MACHINE_DRIVER_START( x1turbo )
1383   MDRV_IMPORT_FROM( x1 )
1384
1385   MDRV_CPU_MODIFY("maincpu")
1386   MDRV_CPU_IO_MAP(x1turbo_io)
1387
1388   MDRV_SOUND_ADD("ym", YM2151, XTAL_4MHz/4) //unknown clock / divider
1389//   MDRV_SOUND_CONFIG(ay8910_config)
1390   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
1391MACHINE_DRIVER_END
1392
13121393static DEVICE_IMAGE_LOAD( x1_floppy )
13131394{
13141395   const char *ext;
r5556r5557
13991480   ROM_REGION(0x1000, "mcu", ROMREGION_ERASEFF) //MCU for the Keyboard, "sub cpu"
14001481   ROM_LOAD( "80c48", 0x0000, 0x1000, NO_DUMP )
14011482
1402   ROM_REGION(0xc00, "pcg", ROMREGION_ERASEFF)
1483   ROM_REGION(0x1800, "pcg", ROMREGION_ERASEFF)
14031484
14041485   ROM_REGION(0x1800, "cgrom", 0)
14051486   ROM_LOAD("fnt0808.x1", 0x00000, 0x00800, CRC(e3995a57) SHA1(1c1a0d8c9f4c446ccd7470516b215ddca5052fb2) )
r5556r5557
14181499   ROM_REGION(0x1000, "mcu", ROMREGION_ERASEFF) //MCU for the Keyboard, "sub cpu"
14191500   ROM_LOAD( "80c48", 0x0000, 0x1000, NO_DUMP )
14201501
1421   ROM_REGION(0xc00, "pcg", ROMREGION_ERASEFF)
1502   ROM_REGION(0x1800, "pcg", ROMREGION_ERASEFF)
14221503
14231504   ROM_REGION(0x1800, "cgrom", 0)
14241505   /* This should be larger... hence, we are missing something (maybe part of the other fnt roms?) */
1425   ROM_LOAD("fnt0808.x1", 0x00000, 0x0800, CRC(84a47530) SHA1(06c0995adc7a6609d4272417fe3570ca43bd0454) )
1506   ROM_LOAD("fnt0808.x1", 0x00000, 0x00800, CRC(84a47530) SHA1(06c0995adc7a6609d4272417fe3570ca43bd0454) )
14261507   ROM_RELOAD(            0x00800, 0x00800)
14271508   ROM_RELOAD(            0x01000, 0x00800)
14281509
r5556r5557
14411522   ROM_REGION(0x1000, "mcu", ROMREGION_ERASEFF) //MCU for the Keyboard, "sub cpu"
14421523   ROM_LOAD( "80c48", 0x0000, 0x1000, NO_DUMP )
14431524
1444   ROM_REGION(0xc00, "pcg", ROMREGION_ERASEFF)
1525   ROM_REGION(0x1800, "pcg", ROMREGION_ERASEFF)
14451526
1446   ROM_REGION(0x4c600, "cgrom", 0)
1527   ROM_REGION(0x4d600, "cgrom", 0)
14471528   ROM_LOAD("fnt0808.x1", 0x0000, 0x0800, CRC(84a47530) SHA1(06c0995adc7a6609d4272417fe3570ca43bd0454) )
1529   ROM_RELOAD(            0x00800, 0x00800)
1530   ROM_RELOAD(            0x01000, 0x00800)
14481531   ROM_SYSTEM_BIOS( 0, "font1", "Font set 1" )
1449   ROMX_LOAD("fnt0816.x1", 0x0800, 0x1000, BAD_DUMP CRC(34818d54) SHA1(2c5fdd73249421af5509e48a94c52c4e423402bf), ROM_BIOS(1) )
1532   ROMX_LOAD("fnt0816.x1", 0x1800, 0x1000, BAD_DUMP CRC(34818d54) SHA1(2c5fdd73249421af5509e48a94c52c4e423402bf), ROM_BIOS(1) )
14501533   /* I strongly suspect this is not genuine */
1451   ROMX_LOAD("fnt1616.x1", 0x01800, 0x4ac00, BAD_DUMP CRC(46826745) SHA1(b9e6c320611f0842df6f45673c47c3e23bc14272), ROM_BIOS(1) )
1534   ROMX_LOAD("fnt1616.x1", 0x02800, 0x4ac00, BAD_DUMP CRC(46826745) SHA1(b9e6c320611f0842df6f45673c47c3e23bc14272), ROM_BIOS(1) )
14521535   ROM_SYSTEM_BIOS( 1, "font2", "Font set 2" )
1453   ROMX_LOAD("fnt0816_a.x1", 0x0800, 0x1000, BAD_DUMP CRC(98db5a6b) SHA1(adf1492ef326b0f8820a3caa1915ad5ab8138f49), ROM_BIOS(2) )
1536   ROMX_LOAD("fnt0816_a.x1", 0x01800, 0x1000, BAD_DUMP CRC(98db5a6b) SHA1(adf1492ef326b0f8820a3caa1915ad5ab8138f49), ROM_BIOS(2) )
14541537   /* I strongly suspect this is not genuine */
1455   ROMX_LOAD("fnt1616_a.x1", 0x01800, 0x4ac00, BAD_DUMP CRC(bc5689ae) SHA1(a414116e261eb92bbdd407f63c8513257cd5a86f), ROM_BIOS(2) )
1538   ROMX_LOAD("fnt1616_a.x1", 0x02800, 0x4ac00, BAD_DUMP CRC(bc5689ae) SHA1(a414116e261eb92bbdd407f63c8513257cd5a86f), ROM_BIOS(2) )
14561539
14571540   ROM_REGION(0x4ac00, "kanji", 0)
14581541   /* This is clearly a bad dump: size does not make sense and from 0x28000 on there are only 0xff */
r5556r5557
14651548/*    YEAR  NAME       PARENT  COMPAT   MACHINE  INPUT  INIT  CONFIG COMPANY   FULLNAME      FLAGS */
14661549COMP( 1982, x1,        0,      0,       x1,      x1,    0,    x1,    "Sharp",  "X1 (CZ-800C)",         GAME_NOT_WORKING)
14671550COMP( 1984, x1ck,      x1,     0,       x1,      x1,    0,    x1,    "Sharp",  "X1Ck (CZ-804C)",       GAME_NOT_WORKING)
1468COMP( 1984, x1turbo,   x1,     0,       x1,      x1,    0,    x1,    "Sharp",  "X1 Turbo (CZ-850C)",   GAME_NOT_WORKING)
1469COMP( 1986, x1turboz,  x1,     0,       x1,      x1,    0,    x1,    "Sharp",  "X1 Turbo Z (CZ-880C)", GAME_NOT_WORKING)
1551COMP( 1984, x1turbo,   x1,     0,       x1turbo, x1,    0,    x1,    "Sharp",  "X1 Turbo (CZ-850C)",   GAME_NOT_WORKING)
1552COMP( 1986, x1turboz,  x1,     0,       x1turbo, x1,    0,    x1,    "Sharp",  "X1 Turbo Z (CZ-880C)", GAME_NOT_WORKING)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team