Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: src/mess/drivers/a7150.c
- ===================================================================
- --- src/mess/drivers/a7150.c (revision 26850)
- +++ src/mess/drivers/a7150.c (working copy)
- @@ -4,28 +4,158 @@
- 04/10/2009 Skeleton driver.
- + TODO:
- +
- + - KGS (It's a uPD7220 controlled by a Z80, which from the main system, is controlled by an 8086. I don't even see the point of that.)
- + - A whole crapload of other controllers.
- +
- http://www.robotrontechnik.de/index.htm?/html/computer/a7150.htm
- + Additional, more helpful docs here:
- +
- + http://www.tiffe.de/Robotron/MMS16/
- +
- ****************************************************************************/
- #include "emu.h"
- +
- #include "cpu/i86/i86.h"
- +#include "machine/i8251.h"
- +#include "machine/i8255.h"
- +#include "machine/pit8253.h"
- +#include "machine/pic8259.h"
- +#include "cpu/z80/z80.h"
- +#include "machine/z80ctc.h"
- +#include "machine/z80sio.h"
- +#include "video/upd7220.h"
- +
- class a7150_state : public driver_device
- {
- public:
- a7150_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag) ,
- - m_maincpu(*this, "maincpu") { }
- + m_maincpu(*this, "maincpu"),
- + m_pit8253(*this, "pit8253"),
- + m_pic8259(*this, "pic8259"),
- + m_gfxcpu(*this, "gfxcpu"),
- + m_upd7220(*this, "upd7220"),
- + m_video_ram(*this, "video_ram") { }
- virtual void machine_reset();
- virtual void video_start();
- - UINT32 screen_update_a7150(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- +
- + DECLARE_READ8_MEMBER(a7150_ppi_r);
- + DECLARE_WRITE8_MEMBER(a7150_ppi_w);
- + DECLARE_READ8_MEMBER(a7150_pit_r);
- + DECLARE_WRITE8_MEMBER(a7150_pit_w);
- + DECLARE_READ8_MEMBER(a7150_pic_r);
- + DECLARE_WRITE8_MEMBER(a7150_pic_w);
- + DECLARE_READ8_MEMBER(a7150_i8251_r);
- + DECLARE_WRITE8_MEMBER(a7150_i8251_w);
- +
- required_device<cpu_device> m_maincpu;
- + required_device<pit8253_device> m_pit8253;
- + required_device<pic8259_device> m_pic8259;
- + //KGS stuff.
- + required_device<z80_device> m_gfxcpu;
- + required_device<upd7220_device> m_upd7220;
- + required_shared_ptr<UINT8> m_video_ram;
- };
- +Z80CTC_INTERFACE(a7150_z80ctc_interface)
- +{
- + DEVCB_NULL,
- + DEVCB_NULL,
- + DEVCB_NULL,
- + DEVCB_NULL
- +};
- +const i8251_interface a7150_i8251_interface =
- +{
- + DEVCB_NULL,
- + DEVCB_NULL,
- + DEVCB_NULL,
- + DEVCB_NULL,
- + DEVCB_NULL,
- + DEVCB_NULL,
- + DEVCB_NULL
- +};
- +
- +const z80sio_interface a7150_z80sio_interface =
- +{
- + DEVCB_NULL,
- + DEVCB_NULL,
- + DEVCB_NULL,
- + DEVCB_NULL,
- + DEVCB_NULL,
- + DEVCB_NULL
- +};
- +
- +I8255_INTERFACE(a7150_ppi8255_interface)
- +{
- + DEVCB_NULL,
- + DEVCB_NULL,
- + DEVCB_NULL,
- + DEVCB_NULL,
- + DEVCB_NULL,
- + DEVCB_NULL
- +};
- +
- +//The clock rate given here is a sheer guess based on the PC/XT, which this thing tries to be compatible with.
- +const pit8253_interface a7150_pit8253_config =
- +{
- + {
- + {
- + 4915000,
- + DEVCB_NULL,
- + DEVCB_DEVICE_LINE_MEMBER("pic8259", pic8259_device, ir2_w)
- + },
- + {
- + 4915000,
- + DEVCB_NULL,
- + DEVCB_NULL
- + },
- + {
- + 4915000,
- + DEVCB_NULL,
- + DEVCB_NULL
- + }
- + }
- +};
- +
- +static UPD7220_DISPLAY_PIXELS( abg_display_pixels )
- +{
- + a7150_state *state = device->machine().driver_data<a7150_state>();
- + const rgb_t *palette = palette_entry_list_raw(bitmap.palette());
- +
- + int xi,gfx;
- + UINT8 pen;
- +
- + gfx = state->m_video_ram[address & 0xffff];
- +
- + for(xi=0;xi<8;xi++)
- + {
- + pen = ((gfx >> xi) & 1) ? 7 : 0;
- +
- + bitmap.pix32(y, x + xi) = palette[pen];
- + }
- +}
- +
- +static UPD7220_DRAW_TEXT_LINE( abg_draw_text )
- +{
- +}
- +
- +static UPD7220_INTERFACE( abg_intf )
- +{
- + abg_display_pixels,
- + abg_draw_text,
- + DEVCB_NULL,
- + DEVCB_NULL,
- + DEVCB_NULL
- +};
- +
- static ADDRESS_MAP_START(a7150_mem, AS_PROGRAM, 16, a7150_state)
- ADDRESS_MAP_UNMAP_HIGH
- AM_RANGE(0x00000,0xeffff) AM_RAM
- @@ -32,6 +162,106 @@
- AM_RANGE(0xf8000,0xfffff) AM_ROM AM_REGION("user1", 0)
- ADDRESS_MAP_END
- +static ADDRESS_MAP_START( upd7220_map, AS_0, 8, a7150_state)
- + ADDRESS_MAP_GLOBAL_MASK(0xffff)
- + AM_RANGE(0x00000, 0x0ffff) AM_RAM AM_SHARE("video_ram")
- +ADDRESS_MAP_END
- +
- +//Ugly, ugly hacks. These also assume the PPI addresses are only partially decoded, which they probably are.
- +
- +READ8_MEMBER(a7150_state::a7150_ppi_r)
- +{
- + i8255_device* dev = machine().device<i8255_device>("ppi8255");
- + return dev->read(space, offset >> 1, mem_mask);
- +}
- +
- +WRITE8_MEMBER(a7150_state::a7150_ppi_w)
- +{
- + i8255_device* dev = machine().device<i8255_device>("ppi8255");
- + dev->write(space, offset >> 1, data, mem_mask);
- +}
- +
- +READ8_MEMBER(a7150_state::a7150_i8251_r)
- +{
- + i8251_device* dev = machine().device<i8251_device>("usart8251");
- + switch(offset >> 1)
- + {
- + case 0:
- + {
- + return dev->data_r(space, 0, mem_mask);
- + break;
- + }
- + case 1:
- + {
- + return dev->status_r(space, 0, mem_mask);
- + break;
- + }
- + }
- + return 0;
- +}
- +
- +WRITE8_MEMBER(a7150_state::a7150_i8251_w)
- +{
- + i8251_device* dev = machine().device<i8251_device>("usart8251");
- + switch(offset >> 1)
- + {
- + case 0:
- + {
- + dev->data_w(space, 0, data, mem_mask);
- + break;
- + }
- + case 1:
- + {
- + dev->control_w(space, 0, data, mem_mask);
- + break;
- + }
- + }
- +}
- +
- +READ8_MEMBER(a7150_state::a7150_pic_r)
- +{
- + pic8259_device* dev = machine().device<pic8259_device>("pic8259");
- + return dev->read(space, offset >> 1, mem_mask);
- +}
- +
- +WRITE8_MEMBER(a7150_state::a7150_pic_w)
- +{
- + pic8259_device* dev = machine().device<pic8259_device>("pic8259");
- + dev->write(space, offset >> 1, data, mem_mask);
- +}
- +
- +READ8_MEMBER(a7150_state::a7150_pit_r)
- +{
- + return m_pit8253->read(space, offset >> 1, mem_mask);
- +}
- +
- +WRITE8_MEMBER(a7150_state::a7150_pit_w)
- +{
- + m_pit8253->write(space, offset >> 1, data, mem_mask);
- +}
- +
- +static ADDRESS_MAP_START(a7150_io, AS_IO, 16, a7150_state)
- + ADDRESS_MAP_UNMAP_HIGH
- + AM_RANGE(0x00c0,0x00c3) AM_READWRITE8(a7150_pic_r, a7150_pic_w, 0xffff)
- + AM_RANGE(0x00c8,0x00cf) AM_READWRITE8(a7150_ppi_r, a7150_ppi_w, 0xffff)
- + AM_RANGE(0x00d0,0x00d7) AM_READWRITE8(a7150_pit_r, a7150_pit_w, 0xffff)
- + AM_RANGE(0x00d8,0x00db) AM_READWRITE8(a7150_i8251_r, a7150_i8251_w, 0xffff)
- +ADDRESS_MAP_END
- +
- +static ADDRESS_MAP_START(a7150_gfxcpu_mem, AS_PROGRAM, 8, a7150_state)
- + ADDRESS_MAP_UNMAP_HIGH
- + AM_RANGE(0x0000,0x1fff) AM_ROM AM_REGION("user2", 0)
- + AM_RANGE(0x2000,0xffff) AM_RAM
- +ADDRESS_MAP_END
- +
- +static ADDRESS_MAP_START(a7150_gfxcpu_io, AS_IO, 8, a7150_state)
- + ADDRESS_MAP_UNMAP_HIGH
- + ADDRESS_MAP_GLOBAL_MASK(0x1ffff)
- + AM_RANGE(0x0000,0x0003) AM_DEVREADWRITE("z80ctc", z80ctc_device, read, write)
- + AM_RANGE(0x0008,0x000b) AM_DEVREADWRITE("z80sio", z80sio_device, read, write)
- + AM_RANGE(0x0010,0x0011) AM_DEVREADWRITE("upd7220", upd7220_device, read, write)
- +ADDRESS_MAP_END
- +
- /* Input ports */
- static INPUT_PORTS_START( a7150 )
- INPUT_PORTS_END
- @@ -45,24 +275,36 @@
- {
- }
- -UINT32 a7150_state::screen_update_a7150(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
- -{
- - return 0;
- -}
- -
- static MACHINE_CONFIG_START( a7150, a7150_state )
- /* basic machine hardware */
- MCFG_CPU_ADD("maincpu", I8086, 4915000)
- MCFG_CPU_PROGRAM_MAP(a7150_mem)
- + MCFG_CPU_IO_MAP(a7150_io)
- + MCFG_I8255_ADD("ppi8255", a7150_ppi8255_interface)
- + MCFG_PIT8253_ADD("pit8253", a7150_pit8253_config)
- +
- + MCFG_PIC8259_ADD( "pic8259", INPUTLINE("maincpu",0), VCC, NULL )
- +
- + MCFG_I8251_ADD("usart8251", a7150_i8251_interface)
- +
- + MCFG_CPU_ADD("gfxcpu", Z80, 4915000) //Guessing up the wazoo here.
- + MCFG_CPU_PROGRAM_MAP(a7150_gfxcpu_mem)
- + MCFG_CPU_IO_MAP(a7150_gfxcpu_io)
- +
- + MCFG_Z80CTC_ADD("z80ctc", 4915000, a7150_z80ctc_interface) //More guessing.
- + MCFG_Z80SIO_ADD("z80sio", 4915000, a7150_z80sio_interface) //Even more guessing
- +
- + MCFG_UPD7220_ADD("upd7220", 4915000/4, abg_intf, upd7220_map)
- +
- /* video hardware */
- MCFG_SCREEN_ADD("screen", RASTER)
- - MCFG_SCREEN_REFRESH_RATE(50)
- + MCFG_SCREEN_REFRESH_RATE(58) //Turns out the original churned frames out at around 58 Hz.
- MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
- MCFG_SCREEN_SIZE(640, 480)
- MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
- - MCFG_SCREEN_UPDATE_DRIVER(a7150_state, screen_update_a7150)
- + MCFG_SCREEN_UPDATE_DEVICE("upd7220", upd7220_device, screen_update)
- MCFG_PALETTE_LENGTH(2)
- MCFG_PALETTE_INIT_OVERRIDE(driver_device, black_and_white)
- @@ -73,6 +315,8 @@
- ROM_START( a7150 )
- ROM_REGION( 0x10000, "user1", ROMREGION_ERASEFF )
- ROM_LOAD( "a7150.rom", 0x0000, 0x8000, CRC(57855abd) SHA1(b58f1363623d2c3ff1221e449529ecaa22573bff))
- + ROM_REGION( 0x10000, "user2", ROMREGION_ERASEFF )
- + ROM_LOAD( "kgs.bin", 0x0000, 0x2000, CRC(403f4235) SHA1(d07ccd40f8b600651d513f588bcf1ea4f15ed094))
- ROM_END
- /* Driver */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement