trunk/src/mess/drivers/cbmb.c
| r17747 | r17748 | |
| 107 | 107 | #include "includes/cbmb.h" |
| 108 | 108 | #include "machine/ieee488.h" |
| 109 | 109 | #include "machine/cbmipt.h" |
| 110 | | #include "video/vic6567.h" |
| 110 | #include "video/mos6566.h" |
| 111 | 111 | #include "video/mc6845.h" |
| 112 | 112 | |
| 113 | 113 | #include "includes/cbmb.h" |
| r17747 | r17748 | |
| 162 | 162 | AM_RANGE(0xf8000, 0xfbfff) AM_ROM AM_SHARE("basic") |
| 163 | 163 | AM_RANGE(0xfd000, 0xfd3ff) AM_RAM AM_SHARE("videoram") /* videoram */ |
| 164 | 164 | 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) |
| 166 | 166 | /* disk units */ |
| 167 | 167 | AM_RANGE(0xfda00, 0xfdaff) AM_DEVREADWRITE_LEGACY("sid6581", sid6581_r, sid6581_w) |
| 168 | 168 | /* db00 coprocessor */ |
| r17747 | r17748 | |
| 313 | 313 | |
| 314 | 314 | /* p500 uses a VIC II chip */ |
| 315 | 315 | |
| 316 | | static 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 | | |
| 329 | | static 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 | | |
| 339 | | static 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 | | |
| 347 | 316 | READ8_MEMBER( cbmb_state::vic_lightpen_x_cb ) |
| 348 | 317 | { |
| 349 | 318 | return ioport("LIGHTX")->read() & ~0x01; |
| r17747 | r17748 | |
| 377 | 346 | return ioport("CTRLSEL")->read() & 0x08; |
| 378 | 347 | } |
| 379 | 348 | |
| 349 | static ADDRESS_MAP_START( vic_videoram_map, AS_0, 8, cbmb_state ) |
| 350 | AM_RANGE(0x0000, 0x3fff) AM_READ(vic_dma_read) |
| 351 | ADDRESS_MAP_END |
| 380 | 352 | |
| 381 | | static const vic2_interface p500_vic2_intf = { |
| 353 | static ADDRESS_MAP_START( vic_colorram_map, AS_1, 8, cbmb_state ) |
| 354 | AM_RANGE(0x000, 0x3ff) AM_READ(vic_dma_read_color) |
| 355 | ADDRESS_MAP_END |
| 356 | |
| 357 | static MOS6567_INTERFACE( vic_intf ) |
| 358 | { |
| 382 | 359 | "screen", |
| 383 | 360 | "maincpu", |
| 384 | | VIC6567, |
| 361 | DEVCB_NULL, |
| 362 | DEVCB_NULL, |
| 385 | 363 | DEVCB_DRIVER_MEMBER(cbmb_state, vic_lightpen_x_cb), |
| 386 | 364 | DEVCB_DRIVER_MEMBER(cbmb_state, vic_lightpen_y_cb), |
| 387 | 365 | 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, |
| 391 | 366 | DEVCB_DRIVER_MEMBER(cbmb_state, vic_rdy_cb) |
| 392 | 367 | }; |
| 393 | 368 | |
| r17747 | r17748 | |
| 528 | 503 | MCFG_MACHINE_RESET( cbmb ) |
| 529 | 504 | |
| 530 | 505 | /* 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) |
| 537 | 507 | |
| 538 | | MCFG_PALETTE_INIT( p500 ) |
| 539 | | MCFG_PALETTE_LENGTH(ARRAY_LENGTH(p500_palette) / 3) |
| 540 | | |
| 541 | | MCFG_VIC2_ADD("vic6567", p500_vic2_intf) |
| 542 | | |
| 543 | 508 | /* sound hardware */ |
| 544 | 509 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 545 | 510 | MCFG_SOUND_ADD("sid6581", SID6581, 1000000) |