src/mess/machine/c128.c
| r14267 | r14268 | |
| 184 | 184 | c128_irq(device->machine(), level || state->m_vicirq); |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | | void c128_vic_interrupt( running_machine &machine, int level ) |
| 187 | WRITE_LINE_MEMBER( c128_state::vic_interrupt ) |
| 188 | 188 | { |
| 189 | | c128_state *state = machine.driver_data<c128_state>(); |
| 190 | | device_t *cia_0 = machine.device("cia_0"); |
| 189 | device_t *cia_0 = machine().device("cia_0"); |
| 191 | 190 | #if 1 |
| 192 | | if (level != state->m_vicirq) |
| 191 | if (state != m_vicirq) |
| 193 | 192 | { |
| 194 | | c128_irq (machine, level || mos6526_irq_r(cia_0)); |
| 195 | | state->m_vicirq = level; |
| 193 | c128_irq (machine(), state || mos6526_irq_r(cia_0)); |
| 194 | m_vicirq = state; |
| 196 | 195 | } |
| 197 | 196 | #endif |
| 198 | 197 | } |
| r14267 | r14268 | |
| 1030 | 1029 | * a15 and a14 portlines |
| 1031 | 1030 | * 0x1000-0x1fff, 0x9000-0x9fff char rom |
| 1032 | 1031 | */ |
| 1033 | | int c128_dma_read(running_machine &machine, int offset) |
| 1032 | READ8_MEMBER( c128_state::vic_dma_read ) |
| 1034 | 1033 | { |
| 1035 | | c128_state *state = machine.driver_data<c128_state>(); |
| 1036 | | UINT8 c64_port6510 = m6510_get_port(machine.device<legacy_cpu_device>("m8502")); |
| 1034 | UINT8 c64_port6510 = m6510_get_port(machine().device<legacy_cpu_device>("m8502")); |
| 1037 | 1035 | |
| 1038 | 1036 | /* main memory configuration to include */ |
| 1039 | | if (state->m_c64mode) |
| 1037 | if (m_c64mode) |
| 1040 | 1038 | { |
| 1041 | | if (!state->m_game && state->m_exrom) |
| 1039 | if (!m_game && m_exrom) |
| 1042 | 1040 | { |
| 1043 | 1041 | if (offset < 0x3000) |
| 1044 | | return state->m_memory[offset]; |
| 1045 | | return state->m_romh[offset & 0x1fff]; |
| 1042 | return m_memory[offset]; |
| 1043 | return m_romh[offset & 0x1fff]; |
| 1046 | 1044 | } |
| 1047 | | if (((state->m_vicaddr - state->m_memory + offset) & 0x7000) == 0x1000) |
| 1048 | | return state->m_chargen[offset & 0xfff]; |
| 1049 | | return state->m_vicaddr[offset]; |
| 1045 | if (((m_vicaddr - m_memory + offset) & 0x7000) == 0x1000) |
| 1046 | return m_chargen[offset & 0xfff]; |
| 1047 | return m_vicaddr[offset]; |
| 1050 | 1048 | } |
| 1051 | | if (!(c64_port6510 & 4) && (((state->m_c128_vicaddr - state->m_memory + offset) & 0x7000) == 0x1000)) |
| 1052 | | return state->m_c128_chargen[offset & 0xfff]; |
| 1053 | | return state->m_c128_vicaddr[offset]; |
| 1049 | if (!(c64_port6510 & 4) && (((m_c128_vicaddr - m_memory + offset) & 0x7000) == 0x1000)) |
| 1050 | return m_c128_chargen[offset & 0xfff]; |
| 1051 | return m_c128_vicaddr[offset]; |
| 1054 | 1052 | } |
| 1055 | 1053 | |
| 1056 | | int c128_dma_read_color(running_machine &machine, int offset) |
| 1054 | READ8_MEMBER( c128_state::vic_dma_read_color ) |
| 1057 | 1055 | { |
| 1058 | | c128_state *state = machine.driver_data<c128_state>(); |
| 1059 | | UINT8 c64_port6510 = m6510_get_port(machine.device<legacy_cpu_device>("m8502")); |
| 1056 | UINT8 c64_port6510 = m6510_get_port(machine().device<legacy_cpu_device>("m8502")); |
| 1060 | 1057 | |
| 1061 | | if (state->m_c64mode) |
| 1062 | | return state->m_colorram[offset & 0x3ff] & 0xf; |
| 1058 | if (m_c64mode) |
| 1059 | return m_colorram[offset & 0x3ff] & 0xf; |
| 1063 | 1060 | else |
| 1064 | | return state->m_colorram[(offset & 0x3ff)|((c64_port6510 & 0x3) << 10)] & 0xf; |
| 1061 | return m_colorram[(offset & 0x3ff)|((c64_port6510 & 0x3) << 10)] & 0xf; |
| 1065 | 1062 | } |
| 1066 | 1063 | |
| 1067 | 1064 | /* 2008-09-01 |
src/mess/video/vic6567.c
| r14267 | r14268 | |
| 149 | 149 | UINT8 device_suspended; |
| 150 | 150 | |
| 151 | 151 | /* DMA */ |
| 152 | | vic2_dma_read dma_read; |
| 153 | | vic2_dma_read_color dma_read_color; |
| 152 | devcb_resolved_read8 in_dma_read_func; |
| 153 | devcb_resolved_read8 in_dma_read_color_func; |
| 154 | 154 | |
| 155 | 155 | /* IRQ */ |
| 156 | | vic2_irq interrupt; |
| 156 | devcb_resolved_write_line out_interrupt_func; |
| 157 | 157 | |
| 158 | 158 | /* RDY */ |
| 159 | | vic2_rdy_callback rdy_workaround_cb; |
| 159 | devcb_resolved_read8 in_rdy_workaround_func; |
| 160 | 160 | |
| 161 | 161 | /* lightpen */ |
| 162 | | vic2_lightpen_button_callback lightpen_button_cb; |
| 163 | | vic2_lightpen_x_callback lightpen_x_cb; |
| 164 | | vic2_lightpen_y_callback lightpen_y_cb; |
| 162 | devcb_resolved_read8 in_lightpen_button_func; |
| 163 | devcb_resolved_read8 in_lightpen_x_func; |
| 164 | devcb_resolved_read8 in_lightpen_y_func; |
| 165 | 165 | }; |
| 166 | 166 | |
| 167 | 167 | |
| r14267 | r14268 | |
| 193 | 193 | |
| 194 | 194 | /* 2008-05 FP: lightpen code needs to read input port from c64.c and cbmb.c */ |
| 195 | 195 | |
| 196 | | #define LIGHTPEN_BUTTON (vic2->lightpen_button_cb(machine)) |
| 197 | | #define LIGHTPEN_X_VALUE (vic2->lightpen_x_cb(machine)) |
| 198 | | #define LIGHTPEN_Y_VALUE (vic2->lightpen_y_cb(machine)) |
| 196 | #define LIGHTPEN_BUTTON (vic2->in_lightpen_button_func(0)) |
| 197 | #define LIGHTPEN_X_VALUE (vic2->in_lightpen_x_func(0)) |
| 198 | #define LIGHTPEN_Y_VALUE (vic2->in_lightpen_y_func(0)) |
| 199 | 199 | |
| 200 | 200 | /* lightpen delivers values from internal counters; they do not start with the visual area or frame area */ |
| 201 | 201 | #define VIC2_MAME_XPOS 0 |
| r14267 | r14268 | |
| 291 | 291 | { |
| 292 | 292 | DBG_LOG(2, "vic2", ("irq start %.2x\n", mask)); |
| 293 | 293 | vic2->reg[0x19] |= 0x80; |
| 294 | | vic2->interrupt(machine, 1); |
| 294 | vic2->out_interrupt_func(1); |
| 295 | 295 | } |
| 296 | 296 | } |
| 297 | 297 | vic2->reg[0x19] |= mask; |
| r14267 | r14268 | |
| 304 | 304 | { |
| 305 | 305 | DBG_LOG(2, "vic2", ("irq end %.2x\n", mask)); |
| 306 | 306 | vic2->reg[0x19] &= ~0x80; |
| 307 | | vic2->interrupt(machine, 0); |
| 307 | vic2->out_interrupt_func(0); |
| 308 | 308 | } |
| 309 | 309 | } |
| 310 | 310 | |
| r14267 | r14268 | |
| 340 | 340 | // Idle access |
| 341 | 341 | INLINE void vic2_idle_access( running_machine &machine, vic2_state *vic2 ) |
| 342 | 342 | { |
| 343 | | vic2->dma_read(machine, 0x3fff); |
| 343 | vic2->in_dma_read_func(0x3fff); |
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | // Fetch sprite data pointer |
| 347 | 347 | INLINE void vic2_spr_ptr_access( running_machine &machine, vic2_state *vic2, int num ) |
| 348 | 348 | { |
| 349 | | vic2->spr_ptr[num] = vic2->dma_read(machine, SPRITE_ADDR(num)) << 6; |
| 349 | vic2->spr_ptr[num] = vic2->in_dma_read_func(SPRITE_ADDR(num)) << 6; |
| 350 | 350 | } |
| 351 | 351 | |
| 352 | 352 | // Fetch sprite data, increment data counter |
| r14267 | r14268 | |
| 354 | 354 | { |
| 355 | 355 | if (vic2->spr_dma_on & (1 << num)) |
| 356 | 356 | { |
| 357 | | vic2->spr_data[num][bytenum] = vic2->dma_read(machine, (vic2->mc[num] & 0x3f) | vic2->spr_ptr[num]); |
| 357 | vic2->spr_data[num][bytenum] = vic2->in_dma_read_func((vic2->mc[num] & 0x3f) | vic2->spr_ptr[num]); |
| 358 | 358 | vic2->mc[num]++; |
| 359 | 359 | } |
| 360 | 360 | else |
| r14267 | r14268 | |
| 375 | 375 | if (vic2->device_suspended == 0) |
| 376 | 376 | { |
| 377 | 377 | vic2->first_ba_cycle = vic2->cycles_counter; |
| 378 | | if ((vic2->rdy_workaround_cb != NULL) && (vic2->rdy_workaround_cb(machine) != 7 )) |
| 378 | if (vic2->in_rdy_workaround_func(0) != 7 ) |
| 379 | 379 | { |
| 380 | 380 | // device_suspend(machine.firstcpu, SUSPEND_REASON_SPIN, 0); |
| 381 | 381 | } |
| r14267 | r14268 | |
| 388 | 388 | { |
| 389 | 389 | if (vic2->device_suspended == 1) |
| 390 | 390 | { |
| 391 | | if ((vic2->rdy_workaround_cb != NULL)) |
| 392 | | { |
| 393 | | // device_resume(machine.firstcpu, SUSPEND_REASON_SPIN); |
| 394 | | } |
| 391 | // device_resume(machine.firstcpu, SUSPEND_REASON_SPIN); |
| 395 | 392 | vic2->device_suspended = 0; |
| 396 | 393 | } |
| 397 | 394 | } |
| r14267 | r14268 | |
| 399 | 396 | // Refresh access |
| 400 | 397 | INLINE void vic2_refresh_access( running_machine &machine, vic2_state *vic2 ) |
| 401 | 398 | { |
| 402 | | vic2->dma_read(machine, 0x3f00 | vic2->ref_cnt--); |
| 399 | vic2->in_dma_read_func(0x3f00 | vic2->ref_cnt--); |
| 403 | 400 | } |
| 404 | 401 | |
| 405 | 402 | |
| r14267 | r14268 | |
| 458 | 455 | else |
| 459 | 456 | { |
| 460 | 457 | UINT16 adr = (vic2->vc & 0x03ff) | VIDEOADDR; |
| 461 | | vic2->matrix_line[vic2->ml_index] = vic2->dma_read(machine, adr); \ |
| 462 | | vic2->color_line[vic2->ml_index] = vic2->dma_read_color(machine, (adr & 0x03ff)); \ |
| 458 | vic2->matrix_line[vic2->ml_index] = vic2->in_dma_read_func(adr); \ |
| 459 | vic2->color_line[vic2->ml_index] = vic2->in_dma_read_color_func((adr & 0x03ff)); \ |
| 463 | 460 | } |
| 464 | 461 | } |
| 465 | 462 | } |
| r14267 | r14268 | |
| 476 | 473 | adr = (vic2->matrix_line[vic2->ml_index] << 3) | vic2->chargenaddr | vic2->rc; |
| 477 | 474 | if (ECMON) |
| 478 | 475 | adr &= 0xf9ff; |
| 479 | | vic2->gfx_data = vic2->dma_read(machine, adr); |
| 476 | vic2->gfx_data = vic2->in_dma_read_func(adr); |
| 480 | 477 | vic2->char_data = vic2->matrix_line[vic2->ml_index]; |
| 481 | 478 | vic2->color_data = vic2->color_line[vic2->ml_index]; |
| 482 | 479 | vic2->ml_index++; |
| r14267 | r14268 | |
| 484 | 481 | } |
| 485 | 482 | else |
| 486 | 483 | { |
| 487 | | vic2->gfx_data = vic2->dma_read(machine, (ECMON ? 0x39ff : 0x3fff)); |
| 484 | vic2->gfx_data = vic2->in_dma_read_func((ECMON ? 0x39ff : 0x3fff)); |
| 488 | 485 | vic2->char_data = 0; |
| 489 | 486 | } |
| 490 | 487 | } |
| r14267 | r14268 | |
| 1235 | 1232 | |
| 1236 | 1233 | vic2->raster_x = 0xfffc; |
| 1237 | 1234 | |
| 1238 | | if ((vic2->rdy_workaround_cb(machine) == 0 ) && (vic2->is_bad_line)) |
| 1235 | if ((vic2->in_rdy_workaround_func(0) == 0 ) && (vic2->is_bad_line)) |
| 1239 | 1236 | vic2->rdy_cycles += (43+adjust(0)); |
| 1240 | 1237 | |
| 1241 | 1238 | vic2->cycle++; |
| r14267 | r14268 | |
| 1250 | 1247 | |
| 1251 | 1248 | vic2->vc = vic2->vc_base; |
| 1252 | 1249 | |
| 1253 | | if ((vic2->rdy_workaround_cb(machine) == 1 ) && (vic2->is_bad_line)) |
| 1250 | if ((vic2->in_rdy_workaround_func(0) == 1 ) && (vic2->is_bad_line)) |
| 1254 | 1251 | vic2->rdy_cycles += (42+adjust(0)); |
| 1255 | 1252 | |
| 1256 | 1253 | vic2->cycle++; |
| r14267 | r14268 | |
| 1270 | 1267 | vic2->ml_index = 0; |
| 1271 | 1268 | vic2_matrix_access(machine, vic2); |
| 1272 | 1269 | |
| 1273 | | if ((vic2->rdy_workaround_cb(machine) == 2 ) && (vic2->is_bad_line)) |
| 1270 | if ((vic2->in_rdy_workaround_func(0) == 2 ) && (vic2->is_bad_line)) |
| 1274 | 1271 | vic2->rdy_cycles += (41+adjust(0)); |
| 1275 | 1272 | |
| 1276 | 1273 | vic2->cycle++; |
| r14267 | r14268 | |
| 1294 | 1291 | |
| 1295 | 1292 | vic2_matrix_access(machine, vic2); |
| 1296 | 1293 | |
| 1297 | | if ((vic2->rdy_workaround_cb(machine) == 3 ) && (vic2->is_bad_line)) |
| 1294 | if ((vic2->in_rdy_workaround_func(0) == 3 ) && (vic2->is_bad_line)) |
| 1298 | 1295 | vic2->rdy_cycles += (40+adjust(0)); |
| 1299 | 1296 | |
| 1300 | 1297 | vic2->cycle++; |
| r14267 | r14268 | |
| 1331 | 1328 | vic2_fetch_if_bad_line(vic2); |
| 1332 | 1329 | vic2_matrix_access(machine, vic2); |
| 1333 | 1330 | |
| 1334 | | if ((vic2->rdy_workaround_cb(machine) == 4 ) && (vic2->is_bad_line)) |
| 1331 | if ((vic2->in_rdy_workaround_func(0) == 4 ) && (vic2->is_bad_line)) |
| 1335 | 1332 | vic2->rdy_cycles += (40+adjust(0)); |
| 1336 | 1333 | |
| 1337 | 1334 | vic2->cycle++; |
| r14267 | r14268 | |
| 2601 | 2598 | int width, height; |
| 2602 | 2599 | int i; |
| 2603 | 2600 | |
| 2601 | // resolve callbacks |
| 2602 | vic2->in_lightpen_x_func.resolve(intf->in_x_cb, *device); |
| 2603 | vic2->in_lightpen_y_func.resolve(intf->in_y_cb, *device); |
| 2604 | vic2->in_lightpen_button_func.resolve(intf->in_button_cb, *device); |
| 2605 | vic2->in_dma_read_func.resolve(intf->in_dma_read_cb, *device); |
| 2606 | vic2->in_dma_read_color_func.resolve(intf->in_dma_read_color_cb, *device); |
| 2607 | vic2->out_interrupt_func.resolve(intf->out_irq_cb, *device); |
| 2608 | vic2->in_rdy_workaround_func.resolve(intf->in_rdy_cb, *device); |
| 2609 | |
| 2604 | 2610 | vic2->cpu = device->machine().device(intf->cpu); |
| 2605 | 2611 | |
| 2606 | 2612 | vic2->screen = device->machine().device<screen_device>(intf->screen); |
| r14267 | r14268 | |
| 2611 | 2617 | |
| 2612 | 2618 | vic2->type = intf->type; |
| 2613 | 2619 | |
| 2614 | | vic2->dma_read = intf->dma_read; |
| 2615 | | vic2->dma_read_color = intf->dma_read_color; |
| 2616 | | vic2->interrupt = intf->irq; |
| 2617 | | |
| 2618 | | vic2->rdy_workaround_cb = intf->rdy_cb; |
| 2619 | | |
| 2620 | | vic2->lightpen_button_cb = intf->button_cb; |
| 2621 | | vic2->lightpen_x_cb = intf->x_cb; |
| 2622 | | vic2->lightpen_y_cb = intf->y_cb; |
| 2623 | | |
| 2624 | 2620 | // immediately call the timer to handle the first line |
| 2625 | 2621 | if (vic2->type == VIC6569 || vic2->type == VIC8566) |
| 2626 | 2622 | device->machine().scheduler().timer_set(downcast<cpu_device *>(vic2->cpu)->cycles_to_attotime(0), FUNC(pal_timer_callback), 0, vic2); |
src/mess/drivers/cbmb.c
| r14267 | r14268 | |
| 344 | 344 | return 0; |
| 345 | 345 | } |
| 346 | 346 | |
| 347 | | static UINT8 cbmb_lightpen_x_cb( running_machine &machine ) |
| 347 | READ8_MEMBER( cbmb_state::vic_lightpen_x_cb ) |
| 348 | 348 | { |
| 349 | | return input_port_read(machine, "LIGHTX") & ~0x01; |
| 349 | return input_port_read(machine(), "LIGHTX") & ~0x01; |
| 350 | 350 | } |
| 351 | 351 | |
| 352 | | static UINT8 cbmb_lightpen_y_cb( running_machine &machine ) |
| 352 | READ8_MEMBER( cbmb_state::vic_lightpen_y_cb ) |
| 353 | 353 | { |
| 354 | | return input_port_read(machine, "LIGHTY") & ~0x01; |
| 354 | return input_port_read(machine(), "LIGHTY") & ~0x01; |
| 355 | 355 | } |
| 356 | 356 | |
| 357 | | static UINT8 cbmb_lightpen_button_cb( running_machine &machine ) |
| 357 | READ8_MEMBER( cbmb_state::vic_lightpen_button_cb ) |
| 358 | 358 | { |
| 359 | | return input_port_read(machine, "OTHER") & 0x04; |
| 359 | return input_port_read(machine(), "OTHER") & 0x04; |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | | static UINT8 cbmb_rdy_cb( running_machine &machine ) |
| 362 | READ8_MEMBER( cbmb_state::vic_dma_read ) |
| 363 | 363 | { |
| 364 | | return input_port_read(machine, "CTRLSEL") & 0x08; |
| 364 | if (offset >= 0x1000) |
| 365 | return m_videoram[offset & 0x3ff]; |
| 366 | else |
| 367 | return m_chargen[offset & 0xfff]; |
| 365 | 368 | } |
| 366 | 369 | |
| 370 | READ8_MEMBER( cbmb_state::vic_dma_read_color ) |
| 371 | { |
| 372 | return m_colorram[offset & 0x3ff]; |
| 373 | } |
| 367 | 374 | |
| 375 | READ8_MEMBER( cbmb_state::vic_rdy_cb ) |
| 376 | { |
| 377 | return input_port_read(machine(), "CTRLSEL") & 0x08; |
| 378 | } |
| 379 | |
| 380 | |
| 368 | 381 | static const vic2_interface p500_vic2_intf = { |
| 369 | 382 | "screen", |
| 370 | 383 | "maincpu", |
| 371 | 384 | VIC6567, |
| 372 | | cbmb_lightpen_x_cb, |
| 373 | | cbmb_lightpen_y_cb, |
| 374 | | cbmb_lightpen_button_cb, |
| 375 | | cbmb_dma_read, |
| 376 | | cbmb_dma_read_color, |
| 377 | | NULL, |
| 378 | | cbmb_rdy_cb |
| 385 | DEVCB_DRIVER_MEMBER(cbmb_state, vic_lightpen_x_cb), |
| 386 | DEVCB_DRIVER_MEMBER(cbmb_state, vic_lightpen_y_cb), |
| 387 | 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 | DEVCB_DRIVER_MEMBER(cbmb_state, vic_rdy_cb) |
| 379 | 392 | }; |
| 380 | 393 | |
| 381 | 394 | /************************************* |
src/mess/drivers/c128.c
| r14267 | r14268 | |
| 679 | 679 | * |
| 680 | 680 | *************************************/ |
| 681 | 681 | |
| 682 | | static UINT8 c128_lightpen_x_cb( running_machine &machine ) |
| 682 | READ8_MEMBER( c128_state::vic_lightpen_x_cb ) |
| 683 | 683 | { |
| 684 | | return input_port_read(machine, "LIGHTX") & ~0x01; |
| 684 | return input_port_read(machine(), "LIGHTX") & ~0x01; |
| 685 | 685 | } |
| 686 | 686 | |
| 687 | | static UINT8 c128_lightpen_y_cb( running_machine &machine ) |
| 687 | READ8_MEMBER( c128_state::vic_lightpen_y_cb ) |
| 688 | 688 | { |
| 689 | | return input_port_read(machine, "LIGHTY") & ~0x01; |
| 689 | return input_port_read(machine(), "LIGHTY") & ~0x01; |
| 690 | 690 | } |
| 691 | 691 | |
| 692 | | static UINT8 c128_lightpen_button_cb( running_machine &machine ) |
| 692 | READ8_MEMBER( c128_state::vic_lightpen_button_cb ) |
| 693 | 693 | { |
| 694 | | return input_port_read(machine, "OTHER") & 0x04; |
| 694 | return input_port_read(machine(), "OTHER") & 0x04; |
| 695 | 695 | } |
| 696 | 696 | |
| 697 | | static UINT8 c128_rdy_cb( running_machine &machine ) |
| 697 | READ8_MEMBER( c128_state::vic_rdy_cb ) |
| 698 | 698 | { |
| 699 | | return input_port_read(machine, "CTRLSEL") & 0x08; |
| 699 | return input_port_read(machine(), "CTRLSEL") & 0x08; |
| 700 | 700 | } |
| 701 | 701 | |
| 702 | 702 | static const vic2_interface c128_vic2_ntsc_intf = { |
| 703 | 703 | "screen", |
| 704 | 704 | "maincpu", |
| 705 | 705 | VIC8564, |
| 706 | | c128_lightpen_x_cb, |
| 707 | | c128_lightpen_y_cb, |
| 708 | | c128_lightpen_button_cb, |
| 709 | | c128_dma_read, |
| 710 | | c128_dma_read_color, |
| 711 | | c128_vic_interrupt, |
| 712 | | c128_rdy_cb |
| 706 | DEVCB_DRIVER_MEMBER(c128_state, vic_lightpen_x_cb), |
| 707 | DEVCB_DRIVER_MEMBER(c128_state, vic_lightpen_y_cb), |
| 708 | DEVCB_DRIVER_MEMBER(c128_state, vic_lightpen_button_cb), |
| 709 | DEVCB_DRIVER_MEMBER(c128_state, vic_dma_read), |
| 710 | DEVCB_DRIVER_MEMBER(c128_state, vic_dma_read_color), |
| 711 | DEVCB_DRIVER_LINE_MEMBER(c128_state, vic_interrupt), |
| 712 | DEVCB_DRIVER_MEMBER(c128_state, vic_rdy_cb) |
| 713 | 713 | }; |
| 714 | 714 | |
| 715 | 715 | static const vic2_interface c128_vic2_pal_intf = { |
| 716 | 716 | "screen", |
| 717 | 717 | "maincpu", |
| 718 | 718 | VIC8566, |
| 719 | | c128_lightpen_x_cb, |
| 720 | | c128_lightpen_y_cb, |
| 721 | | c128_lightpen_button_cb, |
| 722 | | c128_dma_read, |
| 723 | | c128_dma_read_color, |
| 724 | | c128_vic_interrupt, |
| 725 | | c128_rdy_cb |
| 719 | DEVCB_DRIVER_MEMBER(c128_state, vic_lightpen_x_cb), |
| 720 | DEVCB_DRIVER_MEMBER(c128_state, vic_lightpen_y_cb), |
| 721 | DEVCB_DRIVER_MEMBER(c128_state, vic_lightpen_button_cb), |
| 722 | DEVCB_DRIVER_MEMBER(c128_state, vic_dma_read), |
| 723 | DEVCB_DRIVER_MEMBER(c128_state, vic_dma_read_color), |
| 724 | DEVCB_DRIVER_LINE_MEMBER(c128_state, vic_interrupt), |
| 725 | DEVCB_DRIVER_MEMBER(c128_state, vic_rdy_cb) |
| 726 | 726 | }; |
| 727 | 727 | |
| 728 | 728 | static const vdc8563_interface c128_vdc8563_intf = { |
src/mess/drivers/c64.c
| r14267 | r14268 | |
| 580 | 580 | return 0; |
| 581 | 581 | } |
| 582 | 582 | |
| 583 | | static UINT8 c64_lightpen_x_cb( running_machine &machine ) |
| 583 | READ8_MEMBER( c64_state::c64_lightpen_x_cb ) |
| 584 | 584 | { |
| 585 | | return input_port_read(machine, "LIGHTX") & ~0x01; |
| 585 | return input_port_read(machine(), "LIGHTX") & ~0x01; |
| 586 | 586 | } |
| 587 | 587 | |
| 588 | | static UINT8 c64_lightpen_y_cb( running_machine &machine ) |
| 588 | READ8_MEMBER( c64_state::c64_lightpen_y_cb ) |
| 589 | 589 | { |
| 590 | | return input_port_read(machine, "LIGHTY") & ~0x01; |
| 590 | return input_port_read(machine(), "LIGHTY") & ~0x01; |
| 591 | 591 | } |
| 592 | 592 | |
| 593 | | static UINT8 c64_lightpen_button_cb( running_machine &machine ) |
| 593 | READ8_MEMBER( c64_state::c64_lightpen_button_cb ) |
| 594 | 594 | { |
| 595 | | return input_port_read(machine, "OTHER") & 0x04; |
| 595 | return input_port_read(machine(), "OTHER") & 0x04; |
| 596 | 596 | } |
| 597 | 597 | |
| 598 | | static int c64_dma_read( running_machine &machine, int offset ) |
| 598 | READ8_MEMBER( c64_state::c64_dma_read ) |
| 599 | 599 | { |
| 600 | | c64_state *state = machine.driver_data<c64_state>(); |
| 601 | | if (!state->m_game && state->m_exrom) |
| 600 | if (!m_game && m_exrom) |
| 602 | 601 | { |
| 603 | 602 | if (offset < 0x3000) |
| 604 | | return state->m_memory[offset]; |
| 603 | return m_memory[offset]; |
| 605 | 604 | |
| 606 | | return state->m_c64_romh[offset & 0x1fff]; |
| 605 | return m_c64_romh[offset & 0x1fff]; |
| 607 | 606 | } |
| 608 | 607 | |
| 609 | | if (((state->m_vicaddr - state->m_memory + offset) & 0x7000) == 0x1000) |
| 610 | | return state->m_chargen[offset & 0xfff]; |
| 608 | if (((m_vicaddr - m_memory + offset) & 0x7000) == 0x1000) |
| 609 | return m_chargen[offset & 0xfff]; |
| 611 | 610 | |
| 612 | | return state->m_vicaddr[offset]; |
| 611 | return m_vicaddr[offset]; |
| 613 | 612 | } |
| 614 | 613 | |
| 615 | | static int c64_dma_read_ultimax( running_machine &machine, int offset ) |
| 614 | READ8_MEMBER( c64_state::c64_dma_read_ultimax ) |
| 616 | 615 | { |
| 617 | | c64_state *state = machine.driver_data<c64_state>(); |
| 618 | 616 | if (offset < 0x3000) |
| 619 | | return state->m_memory[offset]; |
| 617 | return m_memory[offset]; |
| 620 | 618 | |
| 621 | | return state->m_c64_romh[offset & 0x1fff]; |
| 619 | return m_c64_romh[offset & 0x1fff]; |
| 622 | 620 | } |
| 623 | 621 | |
| 624 | | static int c64_dma_read_color( running_machine &machine, int offset ) |
| 622 | READ8_MEMBER( c64_state::c64_dma_read_color ) |
| 625 | 623 | { |
| 626 | | c64_state *state = machine.driver_data<c64_state>(); |
| 627 | | return state->m_colorram[offset & 0x3ff] & 0xf; |
| 624 | return m_colorram[offset & 0x3ff] & 0xf; |
| 628 | 625 | } |
| 629 | 626 | |
| 630 | | static UINT8 c64_rdy_cb( running_machine &machine ) |
| 627 | READ8_MEMBER( c64_state::c64_rdy_cb ) |
| 631 | 628 | { |
| 632 | | return input_port_read(machine, "CYCLES") & 0x07; |
| 629 | return input_port_read(machine(), "CYCLES") & 0x07; |
| 633 | 630 | } |
| 634 | 631 | |
| 635 | 632 | static const vic2_interface c64_vic2_ntsc_intf = { |
| 636 | 633 | "screen", |
| 637 | 634 | "maincpu", |
| 638 | 635 | VIC6567, |
| 639 | | c64_lightpen_x_cb, |
| 640 | | c64_lightpen_y_cb, |
| 641 | | c64_lightpen_button_cb, |
| 642 | | c64_dma_read, |
| 643 | | c64_dma_read_color, |
| 644 | | c64_vic_interrupt, |
| 645 | | c64_rdy_cb |
| 636 | DEVCB_DRIVER_MEMBER(c64_state, c64_lightpen_x_cb), |
| 637 | DEVCB_DRIVER_MEMBER(c64_state, c64_lightpen_y_cb), |
| 638 | DEVCB_DRIVER_MEMBER(c64_state, c64_lightpen_button_cb), |
| 639 | DEVCB_DRIVER_MEMBER(c64_state, c64_dma_read), |
| 640 | DEVCB_DRIVER_MEMBER(c64_state, c64_dma_read_color), |
| 641 | DEVCB_DRIVER_LINE_MEMBER(c64_state, c64_vic_interrupt), |
| 642 | DEVCB_DRIVER_MEMBER(c64_state, c64_rdy_cb) |
| 646 | 643 | }; |
| 647 | 644 | |
| 648 | 645 | static const vic2_interface c64_vic2_pal_intf = { |
| 649 | 646 | "screen", |
| 650 | 647 | "maincpu", |
| 651 | 648 | VIC6569, |
| 652 | | c64_lightpen_x_cb, |
| 653 | | c64_lightpen_y_cb, |
| 654 | | c64_lightpen_button_cb, |
| 655 | | c64_dma_read, |
| 656 | | c64_dma_read_color, |
| 657 | | c64_vic_interrupt, |
| 658 | | c64_rdy_cb |
| 649 | DEVCB_DRIVER_MEMBER(c64_state, c64_lightpen_x_cb), |
| 650 | DEVCB_DRIVER_MEMBER(c64_state, c64_lightpen_y_cb), |
| 651 | DEVCB_DRIVER_MEMBER(c64_state, c64_lightpen_button_cb), |
| 652 | DEVCB_DRIVER_MEMBER(c64_state, c64_dma_read), |
| 653 | DEVCB_DRIVER_MEMBER(c64_state, c64_dma_read_color), |
| 654 | DEVCB_DRIVER_LINE_MEMBER(c64_state, c64_vic_interrupt), |
| 655 | DEVCB_DRIVER_MEMBER(c64_state, c64_rdy_cb) |
| 659 | 656 | }; |
| 660 | 657 | |
| 661 | 658 | static const vic2_interface ultimax_vic2_intf = { |
| 662 | 659 | "screen", |
| 663 | 660 | "maincpu", |
| 664 | 661 | VIC6567, |
| 665 | | c64_lightpen_x_cb, |
| 666 | | c64_lightpen_y_cb, |
| 667 | | c64_lightpen_button_cb, |
| 668 | | c64_dma_read_ultimax, |
| 669 | | c64_dma_read_color, |
| 670 | | c64_vic_interrupt, |
| 671 | | c64_rdy_cb |
| 662 | DEVCB_DRIVER_MEMBER(c64_state, c64_lightpen_x_cb), |
| 663 | DEVCB_DRIVER_MEMBER(c64_state, c64_lightpen_y_cb), |
| 664 | DEVCB_DRIVER_MEMBER(c64_state, c64_lightpen_button_cb), |
| 665 | DEVCB_DRIVER_MEMBER(c64_state, c64_dma_read_ultimax), |
| 666 | DEVCB_DRIVER_MEMBER(c64_state, c64_dma_read_color), |
| 667 | DEVCB_DRIVER_LINE_MEMBER(c64_state, c64_vic_interrupt), |
| 668 | DEVCB_DRIVER_MEMBER(c64_state, c64_rdy_cb) |
| 672 | 669 | }; |
| 673 | 670 | |
| 674 | 671 | static C64_EXPANSION_INTERFACE( c64_expansion_intf ) |
| r14267 | r14268 | |
| 676 | 673 | DEVCB_CPU_INPUT_LINE("maincpu", INPUT_LINE_IRQ0), |
| 677 | 674 | DEVCB_CPU_INPUT_LINE("maincpu", INPUT_LINE_NMI), |
| 678 | 675 | DEVCB_NULL, // DMA |
| 679 | | DEVCB_NULL, // RESET |
| 680 | | DEVCB_NULL, // GAME |
| 681 | | DEVCB_NULL // EXROM |
| 676 | DEVCB_NULL // RESET |
| 682 | 677 | }; |
| 683 | 678 | |
| 684 | 679 | |
| r14267 | r14268 | |
| 1092 | 1087 | COMP(1982, max, 0, 0, ultimax, c64, ultimax, "Commodore Business Machines", "Commodore Max Machine", 0) |
| 1093 | 1088 | |
| 1094 | 1089 | COMP(1982, c64, 0, 0, c64, c64, c64, "Commodore Business Machines", "Commodore 64 (NTSC)", 0) |
| 1095 | | COMP(1982, c64pal, c64, 0, c64pal, c64, c64pal, "Commodore Business Machines", "Commodore 64 (PAL)", 0) |
| 1090 | //COMP(1982, c64pal, c64, 0, c64pal, c64, c64pal, "Commodore Business Machines", "Commodore 64 (PAL)", 0) |
| 1096 | 1091 | COMP(1982, c64jpn, c64, 0, c64, c64, c64, "Commodore Business Machines", "Commodore 64 (Japan)", 0) |
| 1097 | 1092 | COMP(1982, vic64s, c64, 0, c64pal, vic64s, c64pal, "Commodore Business Machines", "VIC 64S", 0) |
| 1098 | 1093 | COMP(1982, c64swe, c64, 0, c64pal, vic64s, c64pal, "Commodore Business Machines", "Commodore 64 (Sweden/Finland)", 0) |