trunk/src/mess/drivers/mz2500.c
| r20284 | r20285 | |
| 64 | 64 | public: |
| 65 | 65 | mz2500_state(const machine_config &mconfig, device_type type, const char *tag) |
| 66 | 66 | : driver_device(mconfig, type, tag), |
| 67 | | m_rtc(*this, RP5C15_TAG) |
| 67 | m_maincpu(*this, "maincpu"), |
| 68 | m_rtc(*this, RP5C15_TAG) |
| 68 | 69 | { } |
| 69 | 70 | |
| 71 | required_device<cpu_device> m_maincpu; |
| 70 | 72 | required_device<rp5c15_device> m_rtc; |
| 71 | 73 | |
| 74 | UINT8 *m_main_ram; |
| 75 | UINT8 *m_ipl_rom; |
| 76 | UINT8 *m_kanji_rom; |
| 77 | UINT8 *m_kanji2_rom; |
| 78 | UINT8 *m_pcg_ram; |
| 79 | UINT8 *m_emm_ram; |
| 80 | UINT8 *m_dic_rom; |
| 81 | UINT8 *m_phone_rom; |
| 82 | UINT8 *m_iplpro_rom; |
| 83 | |
| 72 | 84 | UINT8 m_bank_val[8]; |
| 73 | 85 | UINT8 m_bank_addr; |
| 74 | 86 | UINT8 m_irq_sel; |
| r20284 | r20285 | |
| 162 | 174 | UINT8 mz2500_cg_latch_compare(); |
| 163 | 175 | UINT8 mz2500_ram_read(UINT16 offset, UINT8 bank_num); |
| 164 | 176 | void mz2500_ram_write(UINT16 offset, UINT8 data, UINT8 bank_num); |
| 177 | virtual void machine_start(); |
| 165 | 178 | virtual void machine_reset(); |
| 166 | 179 | virtual void video_start(); |
| 167 | 180 | virtual void palette_init(); |
| r20284 | r20285 | |
| 182 | 195 | DECLARE_WRITE8_MEMBER(opn_porta_w); |
| 183 | 196 | DECLARE_WRITE_LINE_MEMBER(pit8253_clk0_irq); |
| 184 | 197 | DECLARE_WRITE_LINE_MEMBER(mz2500_rtc_alarm_irq); |
| 198 | |
| 199 | void draw_80x25(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,UINT16 map_addr); |
| 200 | void draw_40x25(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int plane,UINT16 map_addr); |
| 201 | void draw_cg4_screen(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int pri); |
| 202 | void draw_cg16_screen(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int plane,int x_size,int pri); |
| 203 | void draw_cg256_screen(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int plane,int pri); |
| 204 | void draw_tv_screen(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect); |
| 205 | void draw_cg_screen(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int pri); |
| 206 | |
| 185 | 207 | }; |
| 186 | 208 | |
| 187 | 209 | |
| r20284 | r20285 | |
| 237 | 259 | bitmap.pix16(y, x) = machine.pens[pen]; |
| 238 | 260 | } |
| 239 | 261 | |
| 240 | | static void draw_80x25(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,UINT16 map_addr) |
| 262 | void mz2500_state::draw_80x25(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,UINT16 map_addr) |
| 241 | 263 | { |
| 242 | | mz2500_state *state = machine.driver_data<mz2500_state>(); |
| 243 | | UINT8 *vram = machine.root_device().memregion("maincpu")->base(); |
| 264 | UINT8 *vram = m_main_ram; // TODO |
| 244 | 265 | int x,y,count,xi,yi; |
| 245 | 266 | UINT8 *gfx_data; |
| 246 | 267 | UINT8 y_step; |
| r20284 | r20285 | |
| 249 | 270 | |
| 250 | 271 | count = (map_addr & 0x7ff); |
| 251 | 272 | |
| 252 | | y_step = (state->m_text_font_reg) ? 1 : 2; |
| 253 | | y_height = (state->m_text_reg[0] & 0x10) ? 10 : 8; |
| 254 | | s_y = state->m_text_reg[9] & 0xf; |
| 273 | y_step = (m_text_font_reg) ? 1 : 2; |
| 274 | y_height = (m_text_reg[0] & 0x10) ? 10 : 8; |
| 275 | s_y = m_text_reg[9] & 0xf; |
| 255 | 276 | |
| 256 | 277 | for (y=0;y<26*y_step;y+=y_step) |
| 257 | 278 | { |
| r20284 | r20285 | |
| 265 | 286 | int inv_col = (attr & 0x40) >> 6; |
| 266 | 287 | |
| 267 | 288 | if(gfx_sel & 8) // Xevious, PCG 8 colors have priority above kanji roms |
| 268 | | gfx_data = machine.root_device().memregion("pcg")->base(); |
| 289 | gfx_data = m_pcg_ram; |
| 269 | 290 | else if(gfx_sel == 0x80) |
| 270 | 291 | { |
| 271 | | gfx_data = state->memregion("kanji")->base(); |
| 292 | gfx_data = m_kanji_rom; |
| 272 | 293 | tile|= tile_bank << 8; |
| 273 | 294 | if(y_step == 2) |
| 274 | 295 | tile &= 0x3ffe; |
| 275 | 296 | } |
| 276 | 297 | else if(gfx_sel == 0xc0) |
| 277 | 298 | { |
| 278 | | gfx_data = machine.root_device().memregion("kanji")->base(); |
| 299 | gfx_data = m_kanji_rom; |
| 279 | 300 | tile|= (tile_bank << 8); |
| 280 | 301 | if(y_step == 2) |
| 281 | 302 | tile &= 0x3ffe; |
| r20284 | r20285 | |
| 283 | 304 | } |
| 284 | 305 | else |
| 285 | 306 | { |
| 286 | | gfx_data = machine.root_device().memregion("pcg")->base(); |
| 307 | gfx_data = m_pcg_ram; |
| 287 | 308 | } |
| 288 | 309 | |
| 289 | 310 | for(yi=0;yi<8*y_step;yi++) |
| r20284 | r20285 | |
| 291 | 312 | for(xi=0;xi<8;xi++) |
| 292 | 313 | { |
| 293 | 314 | UINT8 pen_bit[3],pen; |
| 294 | | |
| 295 | 315 | int res_x,res_y; |
| 296 | 316 | |
| 297 | 317 | res_x = x*8+xi; |
| 298 | 318 | res_y = y*y_height+yi-s_y; |
| 299 | 319 | |
| 300 | 320 | /* check TV window boundaries */ |
| 301 | | if(res_x < state->m_tv_hs || res_x >= state->m_tv_he || res_y < state->m_tv_vs || res_y >= state->m_tv_ve) |
| 321 | if(res_x < m_tv_hs || res_x >= m_tv_he || res_y < m_tv_vs || res_y >= m_tv_ve) |
| 302 | 322 | continue; |
| 303 | 323 | |
| 304 | 324 | if(gfx_sel & 0x8) |
| r20284 | r20285 | |
| 317 | 337 | if(pen) |
| 318 | 338 | { |
| 319 | 339 | if((res_y) >= 0 && (res_y) < 200*y_step) |
| 320 | | mz2500_draw_pixel(machine,bitmap,res_x,res_y,pen+(state->m_pal_select ? 0x00 : 0x10),0,0); |
| 340 | mz2500_draw_pixel(machine,bitmap,res_x,res_y,pen+(m_pal_select ? 0x00 : 0x10),0,0); |
| 321 | 341 | } |
| 322 | 342 | } |
| 323 | 343 | } |
| r20284 | r20285 | |
| 328 | 348 | } |
| 329 | 349 | } |
| 330 | 350 | |
| 331 | | static void draw_40x25(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int plane,UINT16 map_addr) |
| 351 | void mz2500_state::draw_40x25(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int plane,UINT16 map_addr) |
| 332 | 352 | { |
| 333 | | mz2500_state *state = machine.driver_data<mz2500_state>(); |
| 334 | | UINT8 *vram = machine.root_device().memregion("maincpu")->base(); |
| 353 | UINT8 *vram = m_main_ram; // TODO |
| 335 | 354 | int x,y,count,xi,yi; |
| 336 | 355 | UINT8 *gfx_data; |
| 337 | 356 | UINT8 y_step; |
| r20284 | r20285 | |
| 340 | 359 | |
| 341 | 360 | count = (((plane * 0x400) + map_addr) & 0x7ff); |
| 342 | 361 | |
| 343 | | y_step = (state->m_text_font_reg) ? 1 : 2; |
| 344 | | y_height = (state->m_text_reg[0] & 0x10) ? 10 : 8; |
| 345 | | s_y = state->m_text_reg[9] & 0xf; |
| 362 | y_step = (m_text_font_reg) ? 1 : 2; |
| 363 | y_height = (m_text_reg[0] & 0x10) ? 10 : 8; |
| 364 | s_y = m_text_reg[9] & 0xf; |
| 346 | 365 | |
| 347 | 366 | for (y=0;y<26*y_step;y+=y_step) |
| 348 | 367 | { |
| r20284 | r20285 | |
| 357 | 376 | int inv_col = (attr & 0x40) >> 6; |
| 358 | 377 | |
| 359 | 378 | if(gfx_sel & 8) // Xevious, PCG 8 colors have priority above kanji roms |
| 360 | | gfx_data = machine.root_device().memregion("pcg")->base(); |
| 379 | gfx_data = m_pcg_ram; |
| 361 | 380 | else if(gfx_sel == 0x80) |
| 362 | 381 | { |
| 363 | | gfx_data = state->memregion("kanji")->base(); |
| 382 | gfx_data = m_kanji_rom; |
| 364 | 383 | tile|= tile_bank << 8; |
| 365 | 384 | if(y_step == 2) |
| 366 | 385 | tile &= 0x3ffe; |
| 367 | 386 | } |
| 368 | 387 | else if(gfx_sel == 0xc0) |
| 369 | 388 | { |
| 370 | | gfx_data = machine.root_device().memregion("kanji")->base(); |
| 389 | gfx_data = m_kanji_rom; |
| 371 | 390 | tile|= (tile_bank << 8); |
| 372 | 391 | if(y_step == 2) |
| 373 | 392 | tile &= 0x3ffe; |
| r20284 | r20285 | |
| 375 | 394 | } |
| 376 | 395 | else |
| 377 | 396 | { |
| 378 | | gfx_data = machine.root_device().memregion("pcg")->base(); |
| 397 | gfx_data = m_pcg_ram; |
| 379 | 398 | } |
| 380 | 399 | |
| 381 | 400 | for(yi=0;yi<8*y_step;yi++) |
| r20284 | r20285 | |
| 389 | 408 | res_y = y*y_height+yi-s_y; |
| 390 | 409 | |
| 391 | 410 | /* check TV window boundaries */ |
| 392 | | if(res_x < state->m_tv_hs || res_x >= state->m_tv_he || res_y < state->m_tv_vs || res_y >= state->m_tv_ve) |
| 411 | if(res_x < m_tv_hs || res_x >= m_tv_he || res_y < m_tv_vs || res_y >= m_tv_ve) |
| 393 | 412 | continue; |
| 394 | 413 | |
| 395 | 414 | if(gfx_sel & 0x8) |
| r20284 | r20285 | |
| 408 | 427 | if(pen) |
| 409 | 428 | { |
| 410 | 429 | if((res_y) >= 0 && (res_y) < 200*y_step) |
| 411 | | mz2500_draw_pixel(machine,bitmap,res_x,res_y,pen+(state->m_pal_select ? 0x00 : 0x10),state->m_scr_x_size == 640,0); |
| 430 | mz2500_draw_pixel(machine,bitmap,res_x,res_y,pen+(m_pal_select ? 0x00 : 0x10),m_scr_x_size == 640,0); |
| 412 | 431 | } |
| 413 | 432 | } |
| 414 | 433 | } |
| r20284 | r20285 | |
| 419 | 438 | } |
| 420 | 439 | } |
| 421 | 440 | |
| 422 | | static void draw_cg4_screen(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int pri) |
| 441 | void mz2500_state::draw_cg4_screen(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int pri) |
| 423 | 442 | { |
| 424 | | mz2500_state *state = machine.driver_data<mz2500_state>(); |
| 425 | 443 | UINT32 count; |
| 426 | | UINT8 *vram = state->memregion("maincpu")->base(); |
| 444 | UINT8 *vram = m_main_ram; // TODO |
| 427 | 445 | UINT8 pen,pen_bit[2]; |
| 428 | 446 | int x,y,xi,pen_i; |
| 429 | 447 | int res_x,res_y; |
| r20284 | r20285 | |
| 440 | 458 | res_y = y; |
| 441 | 459 | |
| 442 | 460 | /* check window boundaries */ |
| 443 | | //if(res_x < state->m_cg_hs || res_x >= state->m_cg_he || res_y < state->m_cg_vs || res_y >= state->m_cg_ve) |
| 461 | //if(res_x < m_cg_hs || res_x >= m_cg_he || res_y < m_cg_vs || res_y >= m_cg_ve) |
| 444 | 462 | // continue; |
| 445 | 463 | |
| 446 | 464 | /* TODO: very preliminary, just Yukar K2 uses this so far*/ |
| r20284 | r20285 | |
| 452 | 470 | pen |= pen_bit[pen_i]; |
| 453 | 471 | |
| 454 | 472 | { |
| 455 | | //if(pri == ((state->m_clut256[pen] & 0x100) >> 8)) |
| 473 | //if(pri == ((m_clut256[pen] & 0x100) >> 8)) |
| 456 | 474 | mz2500_draw_pixel(machine,bitmap,res_x,res_y,pen,0,0); |
| 457 | 475 | } |
| 458 | 476 | } |
| r20284 | r20285 | |
| 461 | 479 | } |
| 462 | 480 | } |
| 463 | 481 | |
| 464 | | static void draw_cg16_screen(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int plane,int x_size,int pri) |
| 482 | void mz2500_state::draw_cg16_screen(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int plane,int x_size,int pri) |
| 465 | 483 | { |
| 466 | | mz2500_state *state = machine.driver_data<mz2500_state>(); |
| 467 | 484 | UINT32 count; |
| 468 | | UINT8 *vram = state->memregion("maincpu")->base(); |
| 485 | UINT8 *vram = m_main_ram; //TODO |
| 469 | 486 | UINT8 pen,pen_bit[4]; |
| 470 | 487 | int x,y,xi,pen_i; |
| 471 | 488 | UINT32 wa_reg; |
| r20284 | r20285 | |
| 477 | 494 | |
| 478 | 495 | base_mask = (x_size == 640) ? 0x3f : 0x1f; |
| 479 | 496 | |
| 480 | | count = (state->m_cg_reg[0x10]) | ((state->m_cg_reg[0x11] & base_mask) << 8); |
| 481 | | wa_reg = (state->m_cg_reg[0x12]) | ((state->m_cg_reg[0x13] & base_mask) << 8); |
| 497 | count = (m_cg_reg[0x10]) | ((m_cg_reg[0x11] & base_mask) << 8); |
| 498 | wa_reg = (m_cg_reg[0x12]) | ((m_cg_reg[0x13] & base_mask) << 8); |
| 482 | 499 | /* TODO: layer 2 scrolling */ |
| 483 | | s_x = (state->m_cg_reg[0x0f] & 0xf); |
| 484 | | cg_interlace = state->m_text_font_reg ? 1 : 2; |
| 485 | | pen_mask = (state->m_cg_reg[0x18] >> ((plane & 1) * 4)) & 0x0f; |
| 500 | s_x = (m_cg_reg[0x0f] & 0xf); |
| 501 | cg_interlace = m_text_font_reg ? 1 : 2; |
| 502 | pen_mask = (m_cg_reg[0x18] >> ((plane & 1) * 4)) & 0x0f; |
| 486 | 503 | |
| 487 | | // popmessage("%d %d %d %d",state->m_cg_hs,state->m_cg_he,state->m_cg_vs,state->m_cg_ve); |
| 504 | // popmessage("%d %d %d %d",m_cg_hs,m_cg_he,m_cg_vs,m_cg_ve); |
| 488 | 505 | |
| 489 | 506 | for(y=0;y<200;y++) |
| 490 | 507 | { |
| r20284 | r20285 | |
| 496 | 513 | res_y = y; |
| 497 | 514 | |
| 498 | 515 | /* check window boundaries */ |
| 499 | | if(res_x < state->m_cg_hs || res_x >= state->m_cg_he || res_y < state->m_cg_vs || res_y >= state->m_cg_ve) |
| 516 | if(res_x < m_cg_hs || res_x >= m_cg_he || res_y < m_cg_vs || res_y >= m_cg_ve) |
| 500 | 517 | continue; |
| 501 | 518 | |
| 502 | 519 | pen_bit[0] = (vram[count+0x40000+((plane & 1) * 0x2000)+(((plane & 2)>>1) * 0x10000)]>>(xi)) & 1 ? (pen_mask & 0x01) : 0; //B |
| r20284 | r20285 | |
| 508 | 525 | for(pen_i=0;pen_i<4;pen_i++) |
| 509 | 526 | pen |= pen_bit[pen_i]; |
| 510 | 527 | |
| 511 | | if(pri == ((state->m_clut16[pen] & 0x10) >> 4) && state->m_clut16[pen] != 0x00 && pen_mask) //correct? |
| 512 | | mz2500_draw_pixel(machine,bitmap,res_x,res_y,(state->m_clut16[pen] & 0x0f)+0x10,(x_size == 320 && state->m_scr_x_size == 640),cg_interlace == 2); |
| 528 | if(pri == ((m_clut16[pen] & 0x10) >> 4) && m_clut16[pen] != 0x00 && pen_mask) //correct? |
| 529 | mz2500_draw_pixel(machine,bitmap,res_x,res_y,(m_clut16[pen] & 0x0f)+0x10,(x_size == 320 && m_scr_x_size == 640),cg_interlace == 2); |
| 513 | 530 | } |
| 514 | 531 | count++; |
| 515 | 532 | count&=((base_mask<<8) | 0xff); |
| r20284 | r20285 | |
| 519 | 536 | } |
| 520 | 537 | } |
| 521 | 538 | |
| 522 | | static void draw_cg256_screen(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int plane,int pri) |
| 539 | void mz2500_state::draw_cg256_screen(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int plane,int pri) |
| 523 | 540 | { |
| 524 | | mz2500_state *state = machine.driver_data<mz2500_state>(); |
| 525 | 541 | UINT32 count; |
| 526 | | UINT8 *vram = state->memregion("maincpu")->base(); |
| 542 | UINT8 *vram = m_main_ram; |
| 527 | 543 | UINT8 pen,pen_bit[8]; |
| 528 | 544 | int x,y,xi,pen_i; |
| 529 | 545 | UINT32 wa_reg; |
| r20284 | r20285 | |
| 534 | 550 | |
| 535 | 551 | base_mask = 0x3f; //no x_size == 640 |
| 536 | 552 | |
| 537 | | count = (state->m_cg_reg[0x10]) | ((state->m_cg_reg[0x11] & base_mask) << 8); |
| 538 | | wa_reg = (state->m_cg_reg[0x12]) | ((state->m_cg_reg[0x13] & base_mask) << 8); |
| 553 | count = (m_cg_reg[0x10]) | ((m_cg_reg[0x11] & base_mask) << 8); |
| 554 | wa_reg = (m_cg_reg[0x12]) | ((m_cg_reg[0x13] & base_mask) << 8); |
| 539 | 555 | /* TODO: layer 2 scrolling */ |
| 540 | | s_x = (state->m_cg_reg[0x0f] & 0xf); |
| 541 | | cg_interlace = state->m_text_font_reg ? 1 : 2; |
| 556 | s_x = (m_cg_reg[0x0f] & 0xf); |
| 557 | cg_interlace = m_text_font_reg ? 1 : 2; |
| 542 | 558 | |
| 543 | 559 | for(y=0;y<200;y++) |
| 544 | 560 | { |
| r20284 | r20285 | |
| 550 | 566 | res_y = y; |
| 551 | 567 | |
| 552 | 568 | /* check window boundaries */ |
| 553 | | if(res_x < state->m_cg_hs || res_x >= state->m_cg_he || res_y < state->m_cg_vs || res_y >= state->m_cg_ve) |
| 569 | if(res_x < m_cg_hs || res_x >= m_cg_he || res_y < m_cg_vs || res_y >= m_cg_ve) |
| 554 | 570 | continue; |
| 555 | 571 | |
| 556 | | pen_bit[0] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0x2000]>>(xi)) & 1 ? (state->m_cg_reg[0x18] & 0x10) : 0; // B1 |
| 557 | | pen_bit[1] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0x0000]>>(xi)) & 1 ? (state->m_cg_reg[0x18] & 0x01) : 0; // B0 |
| 558 | | pen_bit[2] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0x6000]>>(xi)) & 1 ? (state->m_cg_reg[0x18] & 0x20) : 0; // R1 |
| 559 | | pen_bit[3] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0x4000]>>(xi)) & 1 ? (state->m_cg_reg[0x18] & 0x02) : 0; // R0 |
| 560 | | pen_bit[4] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0xa000]>>(xi)) & 1 ? (state->m_cg_reg[0x18] & 0x40) : 0; // G1 |
| 561 | | pen_bit[5] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0x8000]>>(xi)) & 1 ? (state->m_cg_reg[0x18] & 0x04) : 0; // G0 |
| 562 | | pen_bit[6] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0xe000]>>(xi)) & 1 ? (state->m_cg_reg[0x18] & 0x80) : 0; // I1 |
| 563 | | pen_bit[7] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0xc000]>>(xi)) & 1 ? (state->m_cg_reg[0x18] & 0x08) : 0; // I0 |
| 572 | pen_bit[0] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0x2000]>>(xi)) & 1 ? (m_cg_reg[0x18] & 0x10) : 0; // B1 |
| 573 | pen_bit[1] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0x0000]>>(xi)) & 1 ? (m_cg_reg[0x18] & 0x01) : 0; // B0 |
| 574 | pen_bit[2] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0x6000]>>(xi)) & 1 ? (m_cg_reg[0x18] & 0x20) : 0; // R1 |
| 575 | pen_bit[3] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0x4000]>>(xi)) & 1 ? (m_cg_reg[0x18] & 0x02) : 0; // R0 |
| 576 | pen_bit[4] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0xa000]>>(xi)) & 1 ? (m_cg_reg[0x18] & 0x40) : 0; // G1 |
| 577 | pen_bit[5] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0x8000]>>(xi)) & 1 ? (m_cg_reg[0x18] & 0x04) : 0; // G0 |
| 578 | pen_bit[6] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0xe000]>>(xi)) & 1 ? (m_cg_reg[0x18] & 0x80) : 0; // I1 |
| 579 | pen_bit[7] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0xc000]>>(xi)) & 1 ? (m_cg_reg[0x18] & 0x08) : 0; // I0 |
| 564 | 580 | |
| 565 | 581 | pen = 0; |
| 566 | 582 | for(pen_i=0;pen_i<8;pen_i++) |
| 567 | 583 | pen |= pen_bit[pen_i]; |
| 568 | 584 | |
| 569 | | if(pri == ((state->m_clut256[pen] & 0x100) >> 8)) |
| 570 | | mz2500_draw_pixel(machine,bitmap,res_x,res_y,(state->m_clut256[pen] & 0xff)+0x100,state->m_scr_x_size == 640,cg_interlace == 2); |
| 585 | if(pri == ((m_clut256[pen] & 0x100) >> 8)) |
| 586 | mz2500_draw_pixel(machine,bitmap,res_x,res_y,(m_clut256[pen] & 0xff)+0x100,m_scr_x_size == 640,cg_interlace == 2); |
| 571 | 587 | } |
| 572 | 588 | count++; |
| 573 | 589 | count&=((base_mask<<8) | 0xff); |
| r20284 | r20285 | |
| 577 | 593 | } |
| 578 | 594 | } |
| 579 | 595 | |
| 580 | | static void draw_tv_screen(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect) |
| 596 | void mz2500_state::draw_tv_screen(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect) |
| 581 | 597 | { |
| 582 | | mz2500_state *state = machine.driver_data<mz2500_state>(); |
| 583 | 598 | UINT16 base_addr; |
| 584 | 599 | |
| 585 | | base_addr = state->m_text_reg[1] | ((state->m_text_reg[2] & 0x7) << 8); |
| 600 | base_addr = m_text_reg[1] | ((m_text_reg[2] & 0x7) << 8); |
| 586 | 601 | |
| 587 | | // popmessage("%02x",state->m_clut16[0]); |
| 588 | | // popmessage("%d %d %d %d",state->m_tv_hs,(state->m_tv_he),state->m_tv_vs,(state->m_tv_ve)); |
| 602 | // popmessage("%02x",m_clut16[0]); |
| 603 | // popmessage("%d %d %d %d",m_tv_hs,(m_tv_he),m_tv_vs,(m_tv_ve)); |
| 589 | 604 | |
| 590 | | if(state->m_text_col_size) |
| 605 | if(m_text_col_size) |
| 591 | 606 | draw_80x25(machine,bitmap,cliprect,base_addr); |
| 592 | 607 | else |
| 593 | 608 | { |
| 594 | 609 | int tv_mode; |
| 595 | 610 | |
| 596 | | tv_mode = state->m_text_reg[0] >> 2; |
| 611 | tv_mode = m_text_reg[0] >> 2; |
| 597 | 612 | |
| 598 | 613 | switch(tv_mode & 3) |
| 599 | 614 | { |
| r20284 | r20285 | |
| 610 | 625 | draw_40x25(machine,bitmap,cliprect,1,base_addr); |
| 611 | 626 | draw_40x25(machine,bitmap,cliprect,0,base_addr); |
| 612 | 627 | break; |
| 613 | | //default: popmessage("%02x %02x %02x",tv_mode & 3,state->m_text_reg[1],state->m_text_reg[2]); break; |
| 628 | //default: popmessage("%02x %02x %02x",tv_mode & 3,m_text_reg[1],m_text_reg[2]); break; |
| 614 | 629 | } |
| 615 | 630 | } |
| 616 | 631 | } |
| 617 | 632 | |
| 618 | | static void draw_cg_screen(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int pri) |
| 633 | void mz2500_state::draw_cg_screen(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int pri) |
| 619 | 634 | { |
| 620 | | mz2500_state *state = machine.driver_data<mz2500_state>(); |
| 621 | | //popmessage("%02x %02x",state->m_cg_reg[0x0e],state->m_cg_reg[0x18]); |
| 635 | //popmessage("%02x %02x",m_cg_reg[0x0e],m_cg_reg[0x18]); |
| 622 | 636 | |
| 623 | | switch(state->m_cg_reg[0x0e]) |
| 637 | switch(m_cg_reg[0x0e]) |
| 624 | 638 | { |
| 625 | 639 | case 0x00: |
| 626 | 640 | break; |
| r20284 | r20285 | |
| 645 | 659 | draw_cg16_screen(machine,bitmap,cliprect,2,640,pri); |
| 646 | 660 | break; |
| 647 | 661 | default: |
| 648 | | popmessage("Unsupported CG mode %02x, contact MESS dev",state->m_cg_reg[0x0e]); |
| 662 | popmessage("Unsupported CG mode %02x, contact MESS dev",m_cg_reg[0x0e]); |
| 649 | 663 | break; |
| 650 | 664 | } |
| 651 | 665 | } |
| r20284 | r20285 | |
| 757 | 771 | |
| 758 | 772 | UINT8 mz2500_state::mz2500_ram_read(UINT16 offset, UINT8 bank_num) |
| 759 | 773 | { |
| 760 | | UINT8 *ram = memregion("maincpu")->base(); |
| 774 | UINT8 *ram = m_main_ram; // TODO |
| 761 | 775 | UINT8 cur_bank = m_bank_val[bank_num]; |
| 762 | 776 | |
| 763 | 777 | switch(cur_bank) |
| r20284 | r20285 | |
| 791 | 805 | case 0x39: |
| 792 | 806 | { |
| 793 | 807 | if(m_kanji_bank & 0x80) //kanji ROM |
| 794 | | { |
| 795 | | UINT8 *knj_rom = memregion("kanji")->base(); |
| 796 | | |
| 797 | | return knj_rom[(offset & 0x7ff)+((m_kanji_bank & 0x7f)*0x800)]; |
| 798 | | } |
| 808 | return m_kanji_rom[(offset & 0x7ff)+((m_kanji_bank & 0x7f)*0x800)]; |
| 799 | 809 | else //PCG RAM |
| 800 | | { |
| 801 | | UINT8 *pcg_ram = memregion("pcg")->base(); |
| 802 | | |
| 803 | | return pcg_ram[offset]; |
| 804 | | } |
| 810 | return m_pcg_ram[offset]; |
| 805 | 811 | } |
| 806 | 812 | break; |
| 807 | 813 | case 0x3a: |
| 808 | 814 | { |
| 809 | | UINT8 *dic_rom = memregion("dictionary")->base(); |
| 810 | | |
| 811 | | return dic_rom[(offset & 0x1fff) + ((m_dic_bank & 0x1f)*0x2000)]; |
| 815 | return m_dic_rom[(offset & 0x1fff) + ((m_dic_bank & 0x1f)*0x2000)]; |
| 812 | 816 | } |
| 813 | 817 | break; |
| 814 | 818 | case 0x3c: |
| r20284 | r20285 | |
| 816 | 820 | case 0x3e: |
| 817 | 821 | case 0x3f: |
| 818 | 822 | { |
| 819 | | UINT8 *phone_rom = memregion("phone")->base(); |
| 820 | | |
| 821 | | return phone_rom[offset+(cur_bank & 3)*0x2000]; |
| 823 | return m_phone_rom[offset+(cur_bank & 3)*0x2000]; |
| 822 | 824 | } |
| 823 | 825 | break; |
| 824 | 826 | default: return ram[offset+cur_bank*0x2000]; |
| r20284 | r20285 | |
| 829 | 831 | |
| 830 | 832 | void mz2500_state::mz2500_ram_write(UINT16 offset, UINT8 data, UINT8 bank_num) |
| 831 | 833 | { |
| 832 | | UINT8 *ram = memregion("maincpu")->base(); |
| 834 | UINT8 *ram = m_main_ram; // TODO |
| 833 | 835 | UINT8 cur_bank = m_bank_val[bank_num]; |
| 834 | 836 | |
| 835 | 837 | // if(cur_bank >= 0x30 && cur_bank <= 0x33) |
| r20284 | r20285 | |
| 922 | 924 | } |
| 923 | 925 | else //PCG RAM |
| 924 | 926 | { |
| 925 | | UINT8 *pcg_ram = memregion("pcg")->base(); |
| 926 | | pcg_ram[offset] = data; |
| 927 | | if((offset & 0x1800) == 0x0000) |
| 928 | | machine().gfx[3]->mark_dirty((offset) >> 3); |
| 929 | | else |
| 930 | | machine().gfx[4]->mark_dirty((offset & 0x7ff) >> 3); |
| 927 | m_pcg_ram[offset] = data; |
| 928 | //if((offset & 0x1800) == 0x0000) |
| 929 | // machine().gfx[3]->mark_dirty((offset) >> 3); |
| 930 | //else |
| 931 | // machine().gfx[4]->mark_dirty((offset & 0x7ff) >> 3); |
| 931 | 932 | } |
| 932 | 933 | break; |
| 933 | 934 | } |
| r20284 | r20285 | |
| 991 | 992 | |
| 992 | 993 | WRITE8_MEMBER(mz2500_state::mz2500_bank_data_w) |
| 993 | 994 | { |
| 994 | | // UINT8 *ROM = memregion("maincpu")->base(); |
| 995 | 995 | // static const char *const bank_name[] = { "bank0", "bank1", "bank2", "bank3", "bank4", "bank5", "bank6", "bank7" }; |
| 996 | 996 | |
| 997 | 997 | m_bank_val[m_bank_addr] = data & 0x3f; |
| r20284 | r20285 | |
| 999 | 999 | // if((data*2) >= 0x70) |
| 1000 | 1000 | // printf("%s %02x\n",bank_name[m_bank_addr],m_bank_val[m_bank_addr]*2); |
| 1001 | 1001 | |
| 1002 | | // membank(bank_name[m_bank_addr])->set_base(&ROM[m_bank_val[m_bank_addr]*0x2000]); |
| 1002 | // membank(bank_name[m_bank_addr])->set_base(&m_main_ram[m_bank_val[m_bank_addr]*0x2000]); |
| 1003 | 1003 | |
| 1004 | 1004 | m_bank_addr++; |
| 1005 | 1005 | m_bank_addr&=7; |
| r20284 | r20285 | |
| 1231 | 1231 | |
| 1232 | 1232 | READ8_MEMBER(mz2500_state::mz2500_rom_r) |
| 1233 | 1233 | { |
| 1234 | | UINT8 *rom = memregion("rom")->base(); |
| 1235 | | UINT8 res; |
| 1234 | m_lrom_index = (m_maincpu->state_int(Z80_B)); |
| 1236 | 1235 | |
| 1237 | | m_lrom_index = (machine().device("maincpu")->state().state_int(Z80_B)); |
| 1238 | | |
| 1239 | 1236 | m_rom_index = (m_rom_index & 0xffff00) | (m_lrom_index & 0xff); |
| 1240 | 1237 | |
| 1241 | | res = rom[m_rom_index]; |
| 1242 | | |
| 1243 | | return res; |
| 1238 | return m_iplpro_rom[m_rom_index]; |
| 1244 | 1239 | } |
| 1245 | 1240 | |
| 1246 | 1241 | WRITE8_MEMBER(mz2500_state::mz2500_rom_w) |
| 1247 | 1242 | { |
| 1248 | | m_hrom_index = (machine().device("maincpu")->state().state_int(Z80_B)); |
| 1243 | m_hrom_index = (m_maincpu->state_int(Z80_B)); |
| 1249 | 1244 | |
| 1250 | 1245 | m_rom_index = (data << 8) | (m_rom_index & 0x0000ff) | ((m_hrom_index & 0xff)<<16); |
| 1251 | 1246 | //printf("%02x\n",data); |
| r20284 | r20285 | |
| 1257 | 1252 | UINT8 pal_index; |
| 1258 | 1253 | UINT8 pal_entry; |
| 1259 | 1254 | |
| 1260 | | pal_index = machine().device("maincpu")->state().state_int(Z80_B); |
| 1255 | pal_index = m_maincpu->state_int(Z80_B); |
| 1261 | 1256 | pal_entry = (pal_index & 0x1e) >> 1; |
| 1262 | 1257 | |
| 1263 | 1258 | if(pal_index & 1) |
| r20284 | r20285 | |
| 1364 | 1359 | if((m_cg_reg_index & 0x1f) == 0x05 && (m_cg_reg[0x05] & 0xc0) == 0x80) //clear bitmap buffer |
| 1365 | 1360 | { |
| 1366 | 1361 | UINT32 i; |
| 1367 | | UINT8 *vram = memregion("maincpu")->base(); |
| 1362 | UINT8 *vram = m_main_ram; // TODO |
| 1368 | 1363 | UINT32 layer_bank; |
| 1369 | 1364 | |
| 1370 | 1365 | layer_bank = (m_cg_reg[0x0e] & 0x80) ? 0x10000 : 0x00000; |
| r20284 | r20285 | |
| 1450 | 1445 | |
| 1451 | 1446 | READ8_MEMBER(mz2500_state::mz2500_kanji_r) |
| 1452 | 1447 | { |
| 1453 | | UINT8 *knj2_rom = memregion("kanji2")->base(); |
| 1454 | | |
| 1455 | 1448 | printf("Read from kanji 2 ROM\n"); |
| 1456 | 1449 | |
| 1457 | | return knj2_rom[(m_kanji_index << 1) | (offset & 1)]; |
| 1450 | return m_kanji2_rom[(m_kanji_index << 1) | (offset & 1)]; |
| 1458 | 1451 | } |
| 1459 | 1452 | |
| 1460 | 1453 | WRITE8_MEMBER(mz2500_state::mz2500_kanji_w) |
| r20284 | r20285 | |
| 1464 | 1457 | |
| 1465 | 1458 | READ8_MEMBER(mz2500_state::rp5c15_8_r) |
| 1466 | 1459 | { |
| 1467 | | UINT8 rtc_index = (machine().device("maincpu")->state().state_int(Z80_B)); |
| 1460 | UINT8 rtc_index = (m_maincpu->state_int(Z80_B)); |
| 1468 | 1461 | |
| 1469 | 1462 | return m_rtc->read(space, rtc_index); |
| 1470 | 1463 | } |
| 1471 | 1464 | |
| 1472 | 1465 | WRITE8_MEMBER(mz2500_state::rp5c15_8_w) |
| 1473 | 1466 | { |
| 1474 | | UINT8 rtc_index = (machine().device("maincpu")->state().state_int(Z80_B)); |
| 1467 | UINT8 rtc_index = (m_maincpu->state_int(Z80_B)); |
| 1475 | 1468 | |
| 1476 | 1469 | m_rtc->write(space, rtc_index, data); |
| 1477 | 1470 | } |
| r20284 | r20285 | |
| 1479 | 1472 | |
| 1480 | 1473 | READ8_MEMBER(mz2500_state::mz2500_emm_data_r) |
| 1481 | 1474 | { |
| 1482 | | UINT8 *emm_ram = memregion("emm")->base(); |
| 1483 | 1475 | UINT8 emm_lo_index; |
| 1484 | 1476 | |
| 1485 | | emm_lo_index = (machine().device("maincpu")->state().state_int(Z80_B)); |
| 1477 | emm_lo_index = (m_maincpu->state_int(Z80_B)); |
| 1486 | 1478 | |
| 1487 | 1479 | m_emm_offset = (m_emm_offset & 0xffff00) | (emm_lo_index & 0xff); |
| 1488 | 1480 | |
| 1489 | 1481 | if(m_emm_offset < 0x100000) //emm max size |
| 1490 | | return emm_ram[m_emm_offset]; |
| 1482 | return m_emm_ram[m_emm_offset]; |
| 1491 | 1483 | |
| 1492 | 1484 | return 0xff; |
| 1493 | 1485 | } |
| r20284 | r20285 | |
| 1496 | 1488 | { |
| 1497 | 1489 | UINT8 emm_hi_index; |
| 1498 | 1490 | |
| 1499 | | emm_hi_index = (machine().device("maincpu")->state().state_int(Z80_B)); |
| 1491 | emm_hi_index = (m_maincpu->state_int(Z80_B)); |
| 1500 | 1492 | |
| 1501 | 1493 | m_emm_offset = ((emm_hi_index & 0xff) << 16) | ((data & 0xff) << 8) | (m_emm_offset & 0xff); |
| 1502 | 1494 | } |
| 1503 | 1495 | |
| 1504 | 1496 | WRITE8_MEMBER(mz2500_state::mz2500_emm_data_w) |
| 1505 | 1497 | { |
| 1506 | | UINT8 *emm_ram = memregion("emm")->base(); |
| 1507 | 1498 | UINT8 emm_lo_index; |
| 1508 | 1499 | |
| 1509 | | emm_lo_index = (machine().device("maincpu")->state().state_int(Z80_B)); |
| 1500 | emm_lo_index = (m_maincpu->state_int(Z80_B)); |
| 1510 | 1501 | |
| 1511 | 1502 | m_emm_offset = (m_emm_offset & 0xffff00) | (emm_lo_index & 0xff); |
| 1512 | 1503 | |
| 1513 | 1504 | if(m_emm_offset < 0x100000) //emm max size |
| 1514 | | emm_ram[m_emm_offset] = data; |
| 1505 | m_emm_ram[m_emm_offset] = data; |
| 1515 | 1506 | } |
| 1516 | 1507 | |
| 1517 | 1508 | static ADDRESS_MAP_START(mz2500_io, AS_IO, 8, mz2500_state ) |
| r20284 | r20285 | |
| 1739 | 1730 | state->m_bank_val[i] = bank_reset_val[type][i]; |
| 1740 | 1731 | } |
| 1741 | 1732 | |
| 1733 | static const gfx_layout mz2500_pcg_layout_1bpp = |
| 1734 | { |
| 1735 | 8, 8, |
| 1736 | 0x100, |
| 1737 | 1, |
| 1738 | { 0 }, |
| 1739 | { 0, 1, 2, 3, 4, 5, 6, 7 }, |
| 1740 | { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, |
| 1741 | 8 * 8 |
| 1742 | }; |
| 1743 | |
| 1744 | static const gfx_layout mz2500_pcg_layout_3bpp = |
| 1745 | { |
| 1746 | 8, 8, |
| 1747 | 0x100, |
| 1748 | 3, |
| 1749 | { RGN_FRAC(3,4), RGN_FRAC(2,4), RGN_FRAC(1,4) }, |
| 1750 | { 0, 1, 2, 3, 4, 5, 6, 7 }, |
| 1751 | { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, |
| 1752 | 8 * 8 |
| 1753 | }; |
| 1754 | |
| 1755 | void mz2500_state::machine_start() |
| 1756 | { |
| 1757 | /* TODO: main RAM actually needs to be splitted */ |
| 1758 | m_main_ram = auto_alloc_array_clear(machine(), UINT8, 0x80000); |
| 1759 | m_pcg_ram = auto_alloc_array_clear(machine(), UINT8, 0x2000); |
| 1760 | m_ipl_rom = memregion("ipl")->base(); |
| 1761 | m_kanji_rom = memregion("kanji")->base(); |
| 1762 | m_kanji2_rom = memregion("kanji2")->base(); |
| 1763 | m_emm_ram = auto_alloc_array_clear(machine(), UINT8, 0x100000); |
| 1764 | m_dic_rom = memregion("dictionary")->base(); |
| 1765 | m_phone_rom = memregion("phone")->base(); |
| 1766 | m_iplpro_rom = memregion("iplpro")->base(); |
| 1767 | |
| 1768 | state_save_register_global_pointer(machine(), m_main_ram, 0x80000); |
| 1769 | state_save_register_global_pointer(machine(), m_pcg_ram, 0x2000); |
| 1770 | state_save_register_global_pointer(machine(), m_emm_ram, 0x100000); |
| 1771 | |
| 1772 | /* TODO: gfx[4] crashes as per now */ |
| 1773 | // machine().gfx[3] = auto_alloc(machine(), gfx_element(machine(), mz2500_pcg_layout_1bpp, (UINT8 *)m_pcg_ram, 0x10, 0)); |
| 1774 | // machine().gfx[4] = auto_alloc(machine(), gfx_element(machine(), mz2500_pcg_layout_3bpp, (UINT8 *)m_pcg_ram, 4, 0)); |
| 1775 | } |
| 1776 | |
| 1742 | 1777 | void mz2500_state::machine_reset() |
| 1743 | 1778 | { |
| 1744 | | UINT8 *RAM = machine().root_device().memregion("maincpu")->base(); |
| 1745 | | UINT8 *IPL = memregion("ipl")->base(); |
| 1746 | 1779 | UINT32 i; |
| 1747 | 1780 | |
| 1748 | 1781 | mz2500_reset(this, IPL_RESET); |
| r20284 | r20285 | |
| 1755 | 1788 | /* copy IPL to its natural bank ROM/RAM position */ |
| 1756 | 1789 | for(i=0;i<0x8000;i++) |
| 1757 | 1790 | { |
| 1758 | | //RAM[i] = IPL[i]; |
| 1759 | | RAM[i+0x68000] = IPL[i]; |
| 1791 | //m_main_ram[i] = IPL[i]; |
| 1792 | m_main_ram[i+0x68000] = m_ipl_rom[i]; |
| 1760 | 1793 | } |
| 1761 | 1794 | |
| 1762 | 1795 | /* clear CG RAM */ |
| 1763 | 1796 | for(i=0;i<0x20000;i++) |
| 1764 | | RAM[i+0x40000] = 0x00; |
| 1797 | m_main_ram[i+0x40000] = 0x00; |
| 1765 | 1798 | |
| 1766 | 1799 | /* disable IRQ */ |
| 1767 | 1800 | for(i=0;i<4;i++) |
| r20284 | r20285 | |
| 1811 | 1844 | 16 * 16 /* code takes 16 times 16 bits */ |
| 1812 | 1845 | }; |
| 1813 | 1846 | |
| 1814 | | static const gfx_layout mz2500_pcg_layout_1bpp = |
| 1815 | | { |
| 1816 | | 8, 8, |
| 1817 | | RGN_FRAC(1,4), |
| 1818 | | 1, |
| 1819 | | { 0 }, |
| 1820 | | { 0, 1, 2, 3, 4, 5, 6, 7 }, |
| 1821 | | { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, |
| 1822 | | 8 * 8 |
| 1823 | | }; |
| 1824 | | |
| 1825 | | static const gfx_layout mz2500_pcg_layout_3bpp = |
| 1826 | | { |
| 1827 | | 8, 8, |
| 1828 | | RGN_FRAC(1,4), |
| 1829 | | 3, |
| 1830 | | { RGN_FRAC(3,4), RGN_FRAC(2,4), RGN_FRAC(1,4) }, |
| 1831 | | { 0, 1, 2, 3, 4, 5, 6, 7 }, |
| 1832 | | { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, |
| 1833 | | 8 * 8 |
| 1834 | | }; |
| 1835 | | |
| 1836 | 1847 | /* these are just for viewer sake, actually they aren't used in drawing routines */ |
| 1837 | 1848 | static GFXDECODE_START( mz2500 ) |
| 1838 | 1849 | GFXDECODE_ENTRY("kanji", 0, mz2500_cg_layout, 0, 256) |
| 1839 | 1850 | GFXDECODE_ENTRY("kanji", 0x4400, mz2500_8_layout, 0, 256) |
| 1840 | 1851 | GFXDECODE_ENTRY("kanji", 0, mz2500_16_layout, 0, 256) |
| 1841 | | GFXDECODE_ENTRY("pcg", 0, mz2500_pcg_layout_1bpp, 0, 0x10) |
| 1842 | | GFXDECODE_ENTRY("pcg", 0, mz2500_pcg_layout_3bpp, 0, 4) |
| 1852 | // GFXDECODE_ENTRY("pcg", 0, mz2500_pcg_layout_1bpp, 0, 0x10) |
| 1853 | // GFXDECODE_ENTRY("pcg", 0, mz2500_pcg_layout_3bpp, 0, 4) |
| 1843 | 1854 | GFXDECODE_END |
| 1844 | 1855 | |
| 1845 | 1856 | INTERRUPT_GEN_MEMBER(mz2500_state::mz2500_vbl) |
| r20284 | r20285 | |
| 1897 | 1908 | { |
| 1898 | 1909 | mz2500_reset(this, WRAM_RESET); |
| 1899 | 1910 | /* correct? */ |
| 1900 | | machine().device("maincpu")->execute().set_input_line(INPUT_LINE_RESET, PULSE_LINE); |
| 1911 | m_maincpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); |
| 1901 | 1912 | } |
| 1902 | 1913 | |
| 1903 | 1914 | /* bit 2 is speaker */ |
| r20284 | r20285 | |
| 2060 | 2071 | WRITE_LINE_MEMBER(mz2500_state::pit8253_clk0_irq) |
| 2061 | 2072 | { |
| 2062 | 2073 | if(m_irq_mask[1]/* && state & 1*/) |
| 2063 | | machine().device("maincpu")->execute().set_input_line_and_vector(0, HOLD_LINE,m_irq_vector[1]); |
| 2074 | m_maincpu->set_input_line_and_vector(0, HOLD_LINE,m_irq_vector[1]); |
| 2064 | 2075 | } |
| 2065 | 2076 | |
| 2066 | 2077 | static const struct pit8253_config mz2500_pit8253_intf = |
| r20284 | r20285 | |
| 2088 | 2099 | { |
| 2089 | 2100 | /* TODO: doesn't work yet */ |
| 2090 | 2101 | // if(m_irq_mask[3] && state & 1) |
| 2091 | | // device.device("maincpu")->execute().set_input_line_and_vector(0, HOLD_LINE,drvm_irq_vector[3]); |
| 2102 | // m_maincpu->set_input_line_and_vector(0, HOLD_LINE,drvm_irq_vector[3]); |
| 2092 | 2103 | } |
| 2093 | 2104 | |
| 2094 | 2105 | static RP5C15_INTERFACE( rtc_intf ) |
| r20284 | r20285 | |
| 2152 | 2163 | |
| 2153 | 2164 | /* ROM definition */ |
| 2154 | 2165 | ROM_START( mz2500 ) |
| 2155 | | ROM_REGION( 0x80000, "maincpu", ROMREGION_ERASEFF ) |
| 2156 | | |
| 2157 | | ROM_REGION( 0x2000, "pcg", ROMREGION_ERASE00 ) |
| 2158 | | |
| 2159 | | ROM_REGION( 0x100000, "emm", ROMREGION_ERASEFF ) |
| 2160 | | |
| 2161 | 2166 | ROM_REGION( 0x08000, "ipl", 0 ) |
| 2162 | 2167 | ROM_LOAD( "ipl.rom", 0x00000, 0x8000, CRC(7a659f20) SHA1(ccb3cfdf461feea9db8d8d3a8815f7e345d274f7) ) |
| 2163 | 2168 | |
| r20284 | r20285 | |
| 2174 | 2179 | ROM_REGION( 0x40000, "dictionary", 0 ) |
| 2175 | 2180 | ROM_LOAD( "dict.rom", 0x00000, 0x40000, CRC(aa957c2b) SHA1(19a5ba85055f048a84ed4e8d471aaff70fcf0374) ) |
| 2176 | 2181 | |
| 2177 | | ROM_REGION( 0x8000, "rom", ROMREGION_ERASEFF ) //iplpro |
| 2182 | ROM_REGION( 0x8000, "iplpro", ROMREGION_ERASEFF ) |
| 2178 | 2183 | ROM_LOAD( "sasi.rom", 0x00000, 0x8000, CRC(a7bf39ce) SHA1(3f4a237fc4f34bac6fe2bbda4ce4d16d42400081) ) |
| 2179 | 2184 | |
| 2180 | 2185 | ROM_REGION( 0x8000, "phone", ROMREGION_ERASEFF ) |
| r20284 | r20285 | |
| 2182 | 2187 | ROM_END |
| 2183 | 2188 | |
| 2184 | 2189 | ROM_START( mz2520 ) |
| 2185 | | ROM_REGION( 0x80000, "maincpu", ROMREGION_ERASEFF ) |
| 2186 | | |
| 2187 | | ROM_REGION( 0x2000, "pcg", ROMREGION_ERASE00 ) |
| 2188 | | |
| 2189 | | ROM_REGION( 0x100000, "emm", ROMREGION_ERASEFF ) |
| 2190 | | |
| 2191 | 2190 | ROM_REGION( 0x08000, "ipl", 0 ) |
| 2192 | 2191 | ROM_LOAD( "ipl2520.rom", 0x00000, 0x8000, CRC(0a126eb2) SHA1(faf71236b3ad82d30184adea951d43d10ced663d) ) |
| 2193 | 2192 | |
| r20284 | r20285 | |
| 2204 | 2203 | ROM_REGION( 0x40000, "dictionary", 0 ) |
| 2205 | 2204 | ROM_LOAD( "dict.rom", 0x00000, 0x40000, CRC(aa957c2b) SHA1(19a5ba85055f048a84ed4e8d471aaff70fcf0374) ) |
| 2206 | 2205 | |
| 2207 | | ROM_REGION( 0x8000, "rom", ROMREGION_ERASEFF ) //iplpro |
| 2206 | ROM_REGION( 0x8000, "iplpro", ROMREGION_ERASEFF ) |
| 2208 | 2207 | ROM_LOAD( "sasi.rom", 0x00000, 0x8000, CRC(a7bf39ce) SHA1(3f4a237fc4f34bac6fe2bbda4ce4d16d42400081) ) |
| 2209 | 2208 | |
| 2210 | 2209 | ROM_REGION( 0x8000, "phone", ROMREGION_ERASEFF ) |