src/mess/drivers/mz2500.c
| r8964 | r8965 | |
| 10 | 10 | (check Back to the Future); |
| 11 | 11 | - Implement unlatched ROMs (Phone and Dictionary); |
| 12 | 12 | - Find real CRTC registers |
| 13 | - Some games doesn't set proper registers if you have interlace enabled, is there any real reason? |
| 13 | 14 | - Implement external ROM hook-up; |
| 14 | 15 | - FDC loading without the IPLPRO doesn't work at all, why? |
| 15 | 16 | - reverse / blanking tvram attributes; |
| r8964 | r8965 | |
| 120 | 121 | y_step = (text_font_reg) ? 1 : 2; |
| 121 | 122 | s_y = text_reg[9] & 0xf; |
| 122 | 123 | |
| 123 | | for (y=0;y<26;y+=y_step) |
| 124 | for (y=0;y<26*y_step;y+=y_step) |
| 124 | 125 | { |
| 125 | 126 | for (x=0;x<80;x++) |
| 126 | 127 | { |
| r8964 | r8965 | |
| 176 | 177 | |
| 177 | 178 | if(pen) |
| 178 | 179 | { |
| 179 | | if((y*8+yi-s_y) >= 0 && (y*8+yi-s_y) < 200) |
| 180 | if((y*8+yi-s_y) >= 0 && (y*8+yi-s_y) < 200*y_step) |
| 180 | 181 | *BITMAP_ADDR16(bitmap, (y*8+yi-s_y), x*8+xi) = machine->pens[pen+(pal_select ? 0x000 : 0x208)]; |
| 181 | 182 | } |
| 182 | 183 | } |
| r8964 | r8965 | |
| 202 | 203 | y_step = (text_font_reg) ? 1 : 2; |
| 203 | 204 | s_y = text_reg[9] & 0xf; |
| 204 | 205 | |
| 205 | | for (y=0;y<26;y+=y_step) |
| 206 | for (y=0;y<26*y_step;y+=y_step) |
| 206 | 207 | { |
| 207 | 208 | for (x=0;x<40;x++) |
| 208 | 209 | { |
| r8964 | r8965 | |
| 259 | 260 | { |
| 260 | 261 | if(wid_40) // 640 x 200 with 40 x 25, double x size |
| 261 | 262 | { |
| 262 | | if((y*8+yi-s_y) >= 0 && (y*8+yi-s_y) < 200) |
| 263 | if((y*8+yi-s_y) >= 0 && (y*8+yi-s_y) < 200*y_step) |
| 263 | 264 | { |
| 264 | 265 | *BITMAP_ADDR16(bitmap, (y*8+yi-s_y), (x*8+xi)*2+0) = machine->pens[pen+(pal_select ? 0x000 : 0x208)]; |
| 265 | 266 | *BITMAP_ADDR16(bitmap, (y*8+yi-s_y), (x*8+xi)*2+1) = machine->pens[pen+(pal_select ? 0x000 : 0x208)]; |
| r8964 | r8965 | |
| 267 | 268 | } |
| 268 | 269 | else |
| 269 | 270 | { |
| 270 | | if((y*8+yi-s_y) >= 0 && (y*8+yi-s_y) < 200) |
| 271 | if((y*8+yi-s_y) >= 0 && (y*8+yi-s_y) < 200*y_step) |
| 271 | 272 | *BITMAP_ADDR16(bitmap, (y*8+yi-s_y), x*8+xi) = machine->pens[pen+(pal_select ? 0x000 : 0x208)]; |
| 272 | 273 | } |
| 273 | 274 | } |
| r8964 | r8965 | |
| 325 | 326 | UINT8 s_x; |
| 326 | 327 | UINT8 base_mask; |
| 327 | 328 | int res_x,res_y; |
| 329 | UINT8 cg_interlace; |
| 328 | 330 | |
| 329 | 331 | base_mask = (x_size == 640) ? 0x3f : 0x1f; |
| 330 | 332 | |
| r8964 | r8965 | |
| 332 | 334 | wa_reg = (cg_reg[0x12]) | ((cg_reg[0x13] & base_mask) << 8); |
| 333 | 335 | /* TODO: layer 2 scrolling */ |
| 334 | 336 | s_x = (cg_reg[0x0f] & 0xf); |
| 337 | cg_interlace = text_font_reg ? 1 : 2; |
| 335 | 338 | |
| 336 | 339 | //popmessage("%d %d %d %d",cg_hs,cg_he,cg_vs,cg_ve); |
| 340 | popmessage("%d %d",cg_vs,cg_ve); |
| 337 | 341 | |
| 338 | 342 | for(y=0;y<200;y++) |
| 339 | 343 | { |
| r8964 | r8965 | |
| 357 | 361 | for(pen_i=0;pen_i<4;pen_i++) |
| 358 | 362 | pen |= pen_bit[pen_i]; |
| 359 | 363 | |
| 360 | | if(pri == ((clut16[pen] & 0x10) >> 4)) |
| 361 | | *BITMAP_ADDR16(bitmap, res_y, res_x) = machine->pens[(clut16[pen] & 0x0f)+0x200]; |
| 364 | if(cg_interlace == 2) |
| 365 | { |
| 366 | if(pri == ((clut16[pen] & 0x10) >> 4)) |
| 367 | { |
| 368 | *BITMAP_ADDR16(bitmap, res_y*2+0, res_x) = machine->pens[(clut16[pen] & 0x0f)+0x200]; |
| 369 | *BITMAP_ADDR16(bitmap, res_y*2+1, res_x) = machine->pens[(clut16[pen] & 0x0f)+0x200]; |
| 370 | } |
| 371 | } |
| 372 | else |
| 373 | { |
| 374 | if(pri == ((clut16[pen] & 0x10) >> 4)) |
| 375 | *BITMAP_ADDR16(bitmap, res_y, res_x) = machine->pens[(clut16[pen] & 0x0f)+0x200]; |
| 376 | } |
| 362 | 377 | } |
| 363 | 378 | count++; |
| 364 | 379 | count&=((base_mask<<8) | 0xff); |
| r8964 | r8965 | |
| 375 | 390 | UINT8 pen,pen_bit[8]; |
| 376 | 391 | int x,y,xi,pen_i; |
| 377 | 392 | int res_x,res_y; |
| 393 | UINT8 cg_interlace; |
| 378 | 394 | |
| 379 | 395 | count = 0x40000; |
| 396 | cg_interlace = text_font_reg ? 1 : 2; |
| 380 | 397 | |
| 381 | 398 | for(y=0;y<200;y++) |
| 382 | 399 | { |
| r8964 | r8965 | |
| 404 | 421 | for(pen_i=0;pen_i<8;pen_i++) |
| 405 | 422 | pen |= pen_bit[pen_i]; |
| 406 | 423 | |
| 407 | | if(pri == ((clut256[pen] & 0x100) >> 8)) |
| 408 | | *BITMAP_ADDR16(bitmap, res_y, res_x) = machine->pens[(clut256[pen] & 0xff)+0x100]; |
| 424 | if(cg_interlace == 2) |
| 425 | { |
| 426 | if(pri == ((clut256[pen] & 0x100) >> 8)) |
| 427 | { |
| 428 | *BITMAP_ADDR16(bitmap, res_y*2+0, res_x) = machine->pens[(clut256[pen] & 0xff)+0x100]; |
| 429 | *BITMAP_ADDR16(bitmap, res_y*2+1, res_x) = machine->pens[(clut256[pen] & 0xff)+0x100]; |
| 430 | } |
| 431 | } |
| 432 | else |
| 433 | { |
| 434 | if(pri == ((clut256[pen] & 0x100) >> 8)) |
| 435 | *BITMAP_ADDR16(bitmap, res_y, res_x) = machine->pens[(clut256[pen] & 0xff)+0x100]; |
| 436 | } |
| 409 | 437 | } |
| 410 | 438 | count++; |
| 411 | 439 | } |
| r8964 | r8965 | |
| 1069 | 1097 | |
| 1070 | 1098 | /* TODO: not convinced about this arrangement ... */ |
| 1071 | 1099 | x_size = ((cg_reg[0x0e] & 0x1f) == 0x17 || (cg_reg[0x0e] & 0x1f) == 0x03) ? 640 : 320; |
| 1072 | | y_size = ((cg_reg[0x0e] & 0x1f) == 0x03) ? 400 : 200; |
| 1100 | y_size = ((cg_reg[0x0e] & 0x1f) == 0x03) ? 400 : 200*((text_font_reg) ? 1 : 2); //enables interlace? |
| 1073 | 1101 | |
| 1074 | 1102 | visarea.min_x = 0; |
| 1075 | 1103 | visarea.min_y = 0; |
| r8964 | r8965 | |
| 1160 | 1188 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 1161 | 1189 | // AM_RANGE(0x60, 0x63) AM_WRITE(w3100a_w) |
| 1162 | 1190 | // AM_RANGE(0x63, 0x63) AM_READ(w3100a_r) |
| 1191 | AM_RANGE(0x60, 0x63) AM_NOP |
| 1163 | 1192 | // AM_RANGE(0xa0, 0xa3) AM_READWRITE(sio_r,sio_w) |
| 1193 | AM_RANGE(0xa0, 0xa3) AM_NOP |
| 1164 | 1194 | // AM_RANGE(0xa4, 0xa5) AM_READWRITE(sasi_r, sasi_w) |
| 1195 | AM_RANGE(0xa4, 0xa5) AM_NOP |
| 1165 | 1196 | AM_RANGE(0xa8, 0xa8) AM_WRITE(mz2500_rom_w) |
| 1166 | 1197 | AM_RANGE(0xa9, 0xa9) AM_READ(mz2500_rom_r) |
| 1167 | 1198 | // AM_RANGE(0xac, 0xad) AM_WRITE(emm_w) |
| r8964 | r8965 | |
| 1170 | 1201 | // AM_RANGE(0xb0, 0xb3) AM_READWRITE(sio_r,sio_w) |
| 1171 | 1202 | AM_RANGE(0xb4, 0xb4) AM_READWRITE(mz2500_bank_addr_r,mz2500_bank_addr_w) |
| 1172 | 1203 | AM_RANGE(0xb5, 0xb5) AM_READWRITE(mz2500_bank_data_r,mz2500_bank_data_w) |
| 1204 | AM_RANGE(0xb7, 0xb7) AM_WRITENOP |
| 1173 | 1205 | AM_RANGE(0xb8, 0xb9) AM_READWRITE(mz2500_kanji_r,mz2500_kanji_w) |
| 1174 | 1206 | AM_RANGE(0xbc, 0xbc) AM_READ(mz2500_bplane_latch_r) AM_WRITE(mz2500_cg_addr_w) |
| 1175 | 1207 | AM_RANGE(0xbd, 0xbd) AM_READ(mz2500_rplane_latch_r) AM_WRITE(mz2500_cg_data_w) |
| r8964 | r8965 | |
| 1180 | 1212 | AM_RANGE(0xc8, 0xc9) AM_DEVREADWRITE("ym", ym2203_r, ym2203_w) |
| 1181 | 1213 | // AM_RANGE(0xca, 0xca) AM_READWRITE(voice_r,voice_w) |
| 1182 | 1214 | // AM_RANGE(0xcc, 0xcc) AM_READWRITE(calendar_r,calendar_w) |
| 1215 | AM_RANGE(0xcc, 0xcd) AM_NOP |
| 1183 | 1216 | // AM_RANGE(0xce, 0xce) AM_WRITE(mz2500_dictionary_bank_w) |
| 1217 | AM_RANGE(0xce, 0xce) AM_NOP |
| 1184 | 1218 | AM_RANGE(0xcf, 0xcf) AM_WRITE(mz2500_kanji_bank_w) |
| 1185 | 1219 | AM_RANGE(0xd8, 0xdb) AM_DEVREADWRITE("mb8877a", mz2500_wd17xx_r, mz2500_wd17xx_w) |
| 1186 | 1220 | AM_RANGE(0xdc, 0xdd) AM_WRITE(mz2500_fdc_w) |
| 1221 | AM_RANGE(0xde, 0xde) AM_WRITENOP |
| 1187 | 1222 | AM_RANGE(0xe0, 0xe3) AM_DEVREADWRITE("i8255_0", i8255a_r, i8255a_w) |
| 1188 | 1223 | AM_RANGE(0xe4, 0xe7) AM_DEVREADWRITE("pit", pit8253_r, pit8253_w) |
| 1189 | | // AM_RANGE(0xe8, 0xe9) AM_DEVREADWRITE("z80pio_1", z80pio_c_r, z80pio_c_w) |
| 1190 | | // AM_RANGE(0xea, 0xeb) AM_DEVREADWRITE("z80pio_1", z80pio_d_r, z80pio_d_w) |
| 1191 | 1224 | AM_RANGE(0xe8, 0xeb) AM_DEVREADWRITE("z80pio_1", z80pio_ba_cd_r, z80pio_ba_cd_w) |
| 1192 | 1225 | AM_RANGE(0xef, 0xef) AM_READWRITE(mz2500_joystick_r,mz2500_joystick_w) |
| 1193 | 1226 | AM_RANGE(0xf0, 0xf3) AM_WRITE(timer_w) |
| r8964 | r8965 | |
| 1327 | 1360 | PORT_START("UNUSED") |
| 1328 | 1361 | PORT_BIT(0xff,IP_ACTIVE_LOW,IPT_UNUSED ) |
| 1329 | 1362 | |
| 1330 | | PORT_START("DSW0") |
| 1331 | | PORT_DIPNAME( 0x01, 0x00, "DSW0" ) |
| 1332 | | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 1333 | | PORT_DIPSETTING( 0x01, DEF_STR( On ) ) |
| 1334 | | PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) |
| 1335 | | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 1336 | | PORT_DIPSETTING( 0x02, DEF_STR( On ) ) |
| 1337 | | PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) |
| 1338 | | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 1339 | | PORT_DIPSETTING( 0x04, DEF_STR( On ) ) |
| 1340 | | PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) |
| 1341 | | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 1342 | | PORT_DIPSETTING( 0x08, DEF_STR( On ) ) |
| 1343 | | PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) |
| 1344 | | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 1345 | | PORT_DIPSETTING( 0x10, DEF_STR( On ) ) |
| 1346 | | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) ) |
| 1347 | | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 1348 | | PORT_DIPSETTING( 0x20, DEF_STR( On ) ) |
| 1349 | | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) |
| 1350 | | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 1351 | | PORT_DIPSETTING( 0x40, DEF_STR( On ) ) |
| 1352 | | PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) |
| 1353 | | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 1354 | | PORT_DIPSETTING( 0x80, DEF_STR( On ) ) |
| 1355 | | |
| 1356 | 1363 | /* this enables HD-loader */ |
| 1357 | 1364 | PORT_START("DSW1") |
| 1358 | 1365 | PORT_DIPNAME( 0x01, 0x01, "DSW1" ) |
| r8964 | r8965 | |
| 1367 | 1374 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) |
| 1368 | 1375 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 1369 | 1376 | PORT_DIPSETTING( 0x08, DEF_STR( On ) ) |
| 1370 | | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) |
| 1377 | PORT_DIPNAME( 0x30, 0x30, "IPLPRO" ) |
| 1371 | 1378 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 1372 | | PORT_DIPSETTING( 0x10, DEF_STR( On ) ) |
| 1373 | | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) |
| 1374 | | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 1375 | | PORT_DIPSETTING( 0x20, DEF_STR( On ) ) |
| 1376 | | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) |
| 1377 | | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 1378 | | PORT_DIPSETTING( 0x40, DEF_STR( On ) ) |
| 1379 | PORT_DIPSETTING( 0x30, DEF_STR( On ) ) |
| 1380 | PORT_DIPNAME( 0x40, 0x40, "Monitor Interlace" ) //not all games support this |
| 1381 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 1382 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1379 | 1383 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) |
| 1380 | 1384 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 1381 | 1385 | PORT_DIPSETTING( 0x80, DEF_STR( On ) ) |
| r8964 | r8965 | |
| 1610 | 1614 | DEVCB_NULL |
| 1611 | 1615 | }; |
| 1612 | 1616 | |
| 1617 | static UINT8 ym_porta; |
| 1618 | |
| 1619 | static READ8_DEVICE_HANDLER( opn_porta_r ) |
| 1620 | { |
| 1621 | return ym_porta; |
| 1622 | } |
| 1623 | |
| 1613 | 1624 | static WRITE8_DEVICE_HANDLER( opn_porta_w ) |
| 1614 | 1625 | { |
| 1615 | 1626 | /* |
| r8964 | r8965 | |
| 1618 | 1629 | ---- --x- floppy reverse bit (controls wd17xx bits in command registers) |
| 1619 | 1630 | */ |
| 1620 | 1631 | |
| 1621 | | // printf("%02x\n",data); |
| 1622 | 1632 | fdc_reverse = (data & 2) ? 0x00 : 0xff; |
| 1623 | 1633 | pal_select = (data & 4) ? 1 : 0; |
| 1634 | |
| 1635 | ym_porta = data; |
| 1624 | 1636 | } |
| 1625 | 1637 | |
| 1638 | static WRITE8_DEVICE_HANDLER( opn_portb_w ) |
| 1639 | { |
| 1640 | logerror("B %02x\n",data); |
| 1641 | } |
| 1642 | |
| 1626 | 1643 | static const ym2203_interface ym2203_interface_1 = |
| 1627 | 1644 | { |
| 1628 | 1645 | { |
| 1629 | 1646 | AY8910_LEGACY_OUTPUT, |
| 1630 | 1647 | AY8910_DEFAULT_LOADS, |
| 1631 | | DEVCB_INPUT_PORT("DSW0"), // read A |
| 1648 | DEVCB_HANDLER(opn_porta_r), // read A |
| 1632 | 1649 | DEVCB_INPUT_PORT("DSW1"), // read B |
| 1633 | 1650 | DEVCB_HANDLER(opn_porta_w), // write A |
| 1634 | | DEVCB_NULL // write B |
| 1651 | DEVCB_HANDLER(opn_portb_w) // write B |
| 1635 | 1652 | }, |
| 1636 | 1653 | NULL |
| 1637 | 1654 | }; |
| r8964 | r8965 | |
| 1710 | 1727 | |
| 1711 | 1728 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 1712 | 1729 | |
| 1713 | | MDRV_SOUND_ADD("ym", YM2203, 6000000/2) //unknown clock / divider |
| 1730 | MDRV_SOUND_ADD("ym", YM2203, 6000000/4) //unknown clock / divider |
| 1714 | 1731 | MDRV_SOUND_CONFIG(ym2203_interface_1) |
| 1715 | 1732 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.60) |
| 1716 | 1733 | |