Previous 199869 Revisions Next

r17748 Sunday 9th September, 2012 at 09:59:56 UTC by Curt Coder
(MESS) p500: Refactored to use new VIC emulation. (nw)
[src/mess/drivers]cbmb.c

trunk/src/mess/drivers/cbmb.c
r17747r17748
107107#include "includes/cbmb.h"
108108#include "machine/ieee488.h"
109109#include "machine/cbmipt.h"
110#include "video/vic6567.h"
110#include "video/mos6566.h"
111111#include "video/mc6845.h"
112112
113113#include "includes/cbmb.h"
r17747r17748
162162   AM_RANGE(0xf8000, 0xfbfff) AM_ROM AM_SHARE("basic")
163163   AM_RANGE(0xfd000, 0xfd3ff) AM_RAM AM_SHARE("videoram")      /* videoram */
164164   AM_RANGE(0xfd400, 0xfd7ff) AM_RAM_WRITE(cbmb_colorram_w) AM_SHARE("colorram")      /* colorram */
165   AM_RANGE(0xfd800, 0xfd8ff) AM_DEVREADWRITE_LEGACY("vic6567", vic2_port_r, vic2_port_w)
165   AM_RANGE(0xfd800, 0xfd8ff) AM_DEVREADWRITE("vic6567", mos6566_device, read, write)
166166   /* disk units */
167167   AM_RANGE(0xfda00, 0xfdaff) AM_DEVREADWRITE_LEGACY("sid6581", sid6581_r, sid6581_w)
168168   /* db00 coprocessor */
r17747r17748
313313
314314/* p500 uses a VIC II chip */
315315
316static const unsigned char p500_palette[] =
317{
318/* black, white, red, cyan */
319/* purple, green, blue, yellow */
320/* orange, brown, light red, dark gray, */
321/* medium gray, light green, light blue, light gray */
322/* taken from the vice emulator */
323   0x00, 0x00, 0x00,  0xfd, 0xfe, 0xfc,  0xbe, 0x1a, 0x24,  0x30, 0xe6, 0xc6,
324   0xb4, 0x1a, 0xe2,  0x1f, 0xd2, 0x1e,  0x21, 0x1b, 0xae,  0xdf, 0xf6, 0x0a,
325   0xb8, 0x41, 0x04,  0x6a, 0x33, 0x04,  0xfe, 0x4a, 0x57,  0x42, 0x45, 0x40,
326   0x70, 0x74, 0x6f,  0x59, 0xfe, 0x59,  0x5f, 0x53, 0xfe,  0xa4, 0xa7, 0xa2
327};
328
329static PALETTE_INIT( p500 )
330{
331   int i;
332
333   for (i = 0; i < sizeof(p500_palette) / 3; i++)
334   {
335      palette_set_color_rgb(machine, i, p500_palette[i * 3], p500_palette[i * 3 + 1], p500_palette[i * 3 + 2]);
336   }
337}
338
339static SCREEN_UPDATE_IND16( p500 )
340{
341   device_t *vic2 = screen.machine().device("vic6567");
342
343   vic2_video_update(vic2, bitmap, cliprect);
344   return 0;
345}
346
347316READ8_MEMBER( cbmb_state::vic_lightpen_x_cb )
348317{
349318   return ioport("LIGHTX")->read() & ~0x01;
r17747r17748
377346   return ioport("CTRLSEL")->read() & 0x08;
378347}
379348
349static ADDRESS_MAP_START( vic_videoram_map, AS_0, 8, cbmb_state )
350   AM_RANGE(0x0000, 0x3fff) AM_READ(vic_dma_read)
351ADDRESS_MAP_END
380352
381static const vic2_interface p500_vic2_intf = {
353static ADDRESS_MAP_START( vic_colorram_map, AS_1, 8, cbmb_state )
354   AM_RANGE(0x000, 0x3ff) AM_READ(vic_dma_read_color)
355ADDRESS_MAP_END
356
357static MOS6567_INTERFACE( vic_intf )
358{
382359   "screen",
383360   "maincpu",
384   VIC6567,
361   DEVCB_NULL,
362   DEVCB_NULL,
385363   DEVCB_DRIVER_MEMBER(cbmb_state, vic_lightpen_x_cb),
386364   DEVCB_DRIVER_MEMBER(cbmb_state, vic_lightpen_y_cb),
387365   DEVCB_DRIVER_MEMBER(cbmb_state, vic_lightpen_button_cb),
388   DEVCB_DRIVER_MEMBER(cbmb_state, vic_dma_read),
389   DEVCB_DRIVER_MEMBER(cbmb_state, vic_dma_read_color),
390   DEVCB_NULL,
391366   DEVCB_DRIVER_MEMBER(cbmb_state, vic_rdy_cb)
392367};
393368
r17747r17748
528503   MCFG_MACHINE_RESET( cbmb )
529504
530505   /* video hardware */
531   MCFG_SCREEN_ADD("screen", RASTER)
532   MCFG_SCREEN_SIZE(VIC6567_COLUMNS, VIC6567_LINES)
533   MCFG_SCREEN_VISIBLE_AREA(0, VIC6567_VISIBLECOLUMNS - 1, 0, VIC6567_VISIBLELINES - 1)
534   MCFG_SCREEN_REFRESH_RATE(VIC6567_VRETRACERATE)
535   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
536   MCFG_SCREEN_UPDATE_STATIC( p500 )
506   MCFG_MOS6567_ADD("vic6567", "screen", VIC6567_CLOCK, vic_intf, vic_videoram_map, vic_colorram_map)
537507
538   MCFG_PALETTE_INIT( p500 )
539   MCFG_PALETTE_LENGTH(ARRAY_LENGTH(p500_palette) / 3)
540
541   MCFG_VIC2_ADD("vic6567", p500_vic2_intf)
542
543508   /* sound hardware */
544509   MCFG_SPEAKER_STANDARD_MONO("mono")
545510   MCFG_SOUND_ADD("sid6581", SID6581, 1000000)

Previous 199869 Revisions Next


© 1997-2024 The MAME Team