| Previous | 15994 Revisions | Next |
| r3334 Saturday 27th September, 2008 at 03:25:52 UTC by Nathan Woods |
|---|
| Updated to MAME 0.127u5 core |
| [docs] | messnew.txt |
| [src/emu] | cheat.c clifront.c debugger.h emu.mak timer.c timer.h ui.c uimenu.c |
| [src/emu/cpu/arm7] | arm7core.c arm7core.h |
| [src/emu/cpu/cubeqcpu] | cubeqcpu.c |
| [src/emu/cpu/dsp56k] | dsp56dsm.c |
| [src/emu/cpu/g65816] | g65816ds.c |
| [src/emu/cpu/i8085] | i8085.c |
| [src/emu/cpu/m37710] | m7700ds.c |
| [src/emu/cpu/mcs48] | mcs48.c |
| [src/emu/debug] | debugcpu.c debugcpu.h debugvw.c |
| [src/emu/machine] | laserdsc.h ldcore.c ldcore.h ldpr8210.c ldvp931.c* |
| [src/emu/sound] | multipcm.c |
| [src/lib/util] | bitmap.c png.c |
| [src/mame] | mame.mak mamedriv.c |
| [src/mame/audio] | dkong.c irem.c tx1.c |
| [src/mame/drivers] | chanbara.c* cubeqst.c firefox.c galaxi.c gamecstl.c goal92.c gticlub.c guab.c hikaru.c igs009.c itgambl3.c leland.c namcoic.c namcona1.c namconb1.c namcond1.c namcos23.c naomi.c neodrvr.c niyanpai.c paradise.c peplus.c plygonet.c quizpun2.c senjyo.c shanghai.c snesb.c snk.c srmp6.c subsino.c system1.c tx1.c videopkr.c warpwarp.c zn.c |
| [src/mame/includes] | dc.h dkong.h neogeo.h |
| [src/mame/machine] | cubocd32.c dc.c namcos1.c nb1413m3.c neocrypt.c neoprot.c psx.c |
| [src/mame/video] | atarirle.c avgdvg.c dc.c dkong.c esd16.c hd63484.c hyprduel.c leland.c midzeus.c midzeus2.c model3.c namcofl.c naughtyb.c neogeo.c system1.c taito_f3.c tx1.c |
| [src/mess/osd/windows] | menu.c |
| [src/osd/windows] | debugwin.c |
| [src/tools] | chdcd.c |
| r3333 | r3334 | |
|---|---|---|
| 3 | 3 | Tatsumi TX-1/Buggy Boy sound hardware |
| 4 | 4 | |
| 5 | 5 | ***************************************************************************/ |
| 6 | ||
| 6 | 7 | #include "driver.h" |
| 7 | 8 | #include "streams.h" |
| 8 | 9 | #include "deprecat.h" |
| r3333 | r3334 | |
| 10 | 11 | #include "video/resnet.h" |
| 11 | 12 | #include "sound/custom.h" |
| 12 | 13 | |
| 14 | ||
| 13 | 15 | /************************************* |
| 14 | 16 | * |
| 15 | 17 | * Common |
| r3333 | r3334 | |
| 22 | 24 | static UINT32 step1; |
| 23 | 25 | static UINT32 step2; |
| 24 | 26 | |
| 27 | ||
| 25 | 28 | /************************************* |
| 26 | 29 | * |
| 27 | 30 | * 8253 Programmable Interval Timer |
| r3333 | r3334 | |
| 166 | 169 | sndti_set_output_gain(SOUND_AY8910, 0, 0, gain); |
| 167 | 170 | sndti_set_output_gain(SOUND_AY8910, 0, 1, gain); |
| 168 | 171 | sndti_set_output_gain(SOUND_AY8910, 0, 2, gain); |
| 169 | ||
| 170 | if (!BIT(ay_outputb, 6)) | |
| 171 | popmessage("Skid!"); | |
| 172 | ||
| 173 | if (!BIT(ay_outputb, 7)) | |
| 174 | popmessage("Screech!"); | |
| 175 | 172 | } |
| 176 | 173 | |
| 177 | 174 | /*************************************************************************** |
| r3333 | r3334 | |
| 200 | 197 | |
| 201 | 198 | ***************************************************************************/ |
| 202 | 199 | |
| 203 | ||
| 204 | 200 | INLINE void update_engine (int eng[4]) |
| 205 | 201 | { |
| 206 | 202 | int p0 = eng[0]; |
| r3333 | r3334 | |
| 231 | 227 | memset(buffer[0], 0, length * sizeof(*buffer[0])); |
| 232 | 228 | memset(buffer[1], 0, length * sizeof(*buffer[1])); |
| 233 | 229 | |
| 234 | /* 8253 outputs for the player/opponent | |
| 230 | /* 8253 outputs for the player/opponent | |
| 235 | 231 | step_0 = pit8253.counts[0].val ? (TX1_PIT_CLOCK / pit8253.counts[0].val) * freq_to_step : 0; |
| 236 | 232 | step_1 = pit8253.counts[1].val ? (TX1_PIT_CLOCK / pit8253.counts[1].val) * freq_to_step : 0; |
| 237 | 233 | step_2 = pit8253.counts[2].val ? (TX1_PIT_CLOCK / pit8253.counts[2].val) * freq_to_step : 0; |
| r3333 | r3334 | |
|---|---|---|
| 194 | 194 | *************************************/ |
| 195 | 195 | |
| 196 | 196 | /* All 6 (3*2) AY-3-8910 outputs are tied together |
| 197 | * and put with 470 KOhm to gnd. | |
| 198 | * The following is a approximation */ | |
| 197 | * and put with 470 Ohm to gnd. | |
| 198 | * The following is a approximation, since | |
| 199 | * it does not take cross-chip mixing effects into account. | |
| 200 | */ | |
| 199 | 201 | |
| 200 | 202 | static const ay8910_interface irem_ay8910_interface_1 = |
| 201 | 203 | { |
| r3333 | r3334 | |
|---|---|---|
| 872 | 872 | * |
| 873 | 873 | ****************************************************************/ |
| 874 | 874 | |
| 875 | SOUND_START( dkong) | |
| 876 | { | |
| 877 | dkong_state *state = machine->driver_data; | |
| 875 | 878 | |
| 879 | state->snd_rom = memory_region(machine, "sound"); | |
| 880 | state->dev_vp2 = devtag_get_device(machine, LATCH8, "virtual_p2"); | |
| 881 | } | |
| 876 | 882 | |
| 883 | ||
| 877 | 884 | /**************************************************************** |
| 878 | 885 | * |
| 879 | 886 | * M58817 Speech |
| r3333 | r3334 | |
| 998 | 1005 | |
| 999 | 1006 | static READ8_DEVICE_HANDLER( dkong_tune_r ) |
| 1000 | 1007 | { |
| 1001 | const device_config *devvp2 = devtag_get_device(device->machine, LATCH8, "virtual_p2"); | |
| 1002 | UINT8 *snd_rom = memory_region(device->machine, "sound"); | |
| 1003 | UINT8 page = latch8_r(devvp2,0) & 0x47; | |
| 1008 | dkong_state *state = device->machine->driver_data; | |
| 1009 | UINT8 page = latch8_r(state->dev_vp2,0) & 0x47; | |
| 1004 | 1010 | |
| 1005 | 1011 | if ( page & 0x40 ) |
| 1006 | 1012 | { |
| r3333 | r3334 | |
| 1009 | 1015 | else |
| 1010 | 1016 | { |
| 1011 | 1017 | /* printf("rom access at pc = %4x\n",activecpu_get_pc()); */ |
| 1012 | return (snd_rom[0x1000+(page & 7)*256+offset]); | |
| 1018 | return (state->snd_rom[0x1000+(page & 7)*256+offset]); | |
| 1013 | 1019 | } |
| 1014 | 1020 | } |
| 1015 | 1021 | |
| r3333 | r3334 | |
| 1099 | 1105 | static const nes_interface nes_interface_1 = { "n2a03a" }; |
| 1100 | 1106 | static const nes_interface nes_interface_2 = { "n2a03b" }; |
| 1101 | 1107 | |
| 1108 | ||
| 1102 | 1109 | /************************************* |
| 1103 | 1110 | * |
| 1104 | 1111 | * Machine driver |
| r3333 | r3334 | |
| 1107 | 1114 | |
| 1108 | 1115 | MACHINE_DRIVER_START( dkong2b_audio ) |
| 1109 | 1116 | |
| 1117 | MDRV_SOUND_START( dkong ) | |
| 1118 | ||
| 1110 | 1119 | /* sound latches */ |
| 1111 | 1120 | |
| 1112 | 1121 | MDRV_LATCH8_ADD("ls175.3d") /* sound cmd latch */ |
| r3333 | r3334 | |
|---|---|---|
| 260 | 260 | /*E*/ "C2P" |
| 261 | 261 | }; |
| 262 | 262 | |
| 263 | const char* get_akiko_reg_name(int reg) | |
| 263 | static const char* get_akiko_reg_name(int reg) | |
| 264 | 264 | { |
| 265 | 265 | if (reg < 0xf ) |
| 266 | 266 | { |
| r3333 | r3334 | |
|---|---|---|
| 16 | 16 | |
| 17 | 17 | #define DEBUG_SYSCTRL (0) |
| 18 | 18 | #define DEBUG_MAPLE (0) |
| 19 | #define DEBUG_MAPLE_REGS (0) | |
| 19 | 20 | |
| 20 | 21 | #if DEBUG_SYSCTRL |
| 21 | 22 | static const char *const sysctrl_names[] = |
| r3333 | r3334 | |
| 289 | 290 | |
| 290 | 291 | reg = decode_reg_64(offset, mem_mask, &shift); |
| 291 | 292 | |
| 292 | #if DEBUG_MAPLE | |
| 293 | #if DEBUG_MAPLE_REGS | |
| 293 | 294 | mame_printf_verbose("MAPLE: Unmapped read %08x\n", 0x5f6c00+reg*4); |
| 294 | 295 | #endif |
| 295 | 296 | return (UINT64)maple_regs[reg] << shift; |
| r3333 | r3334 | |
| 313 | 314 | dat = (UINT32)(data >> shift); |
| 314 | 315 | old = maple_regs[reg]; |
| 315 | 316 | |
| 316 | #if DEBUG_MAPLE | |
| 317 | #if DEBUG_MAPLE_REGS | |
| 317 | 318 | mame_printf_verbose("MAPLE: [%08x=%x] write %llx to %x (reg %x: %s), mask %llx\n", 0x5f6c00+reg*4, dat, data >> shift, offset, reg, maple_names[reg], mem_mask); |
| 318 | 319 | #endif |
| 319 | 320 | |
| r3333 | r3334 | |
| 353 | 354 | |
| 354 | 355 | if (pattern == 0) |
| 355 | 356 | { |
| 357 | if (port > 0) | |
| 358 | buff[0]=0xffffffff; | |
| 356 | 359 | switch (command) |
| 357 | 360 | { |
| 358 | 361 | case 1: |
| r3333 | r3334 | |
| 398 | 401 | cpunum_set_info_ptr(0,CPUINFO_PTR_SH4_EXTERNAL_DDT_DMA,&ddtdata); |
| 399 | 402 | |
| 400 | 403 | subcommand = buff[0] & 0xff; |
| 404 | #if DEBUG_MAPLE | |
| 405 | mame_printf_verbose("MAPLE: transfer command %d port %d subcommand %d\n", command, port, subcommand); | |
| 406 | #endif | |
| 401 | 407 | if (subcommand == 3) // read data |
| 402 | 408 | { |
| 403 | 409 | for (a=0;a < 0x80;a+=4) |
| r3333 | r3334 | |
| 594 | 600 | #if DEBUG_MAPLE |
| 595 | 601 | mame_printf_verbose("MAPLE: unknown transfer command %d port %d\n", command, port); |
| 596 | 602 | #endif |
| 603 | ddtdata.length=1; | |
| 604 | buff[0]=0xffffffff; | |
| 597 | 605 | break; |
| 598 | 606 | } |
| 599 | 607 | } |
| r3333 | r3334 | |
| 609 | 617 | // skip fixed packet header |
| 610 | 618 | dat += 8; |
| 611 | 619 | // skip transfer data |
| 612 | dat += ( | |
| 620 | dat += (le | |
| 613 | 621 | } // do transfers |
| 614 | 622 | maple_regs[reg] = 0; |
| 615 | 623 | } |
| 624 | else | |
| 625 | { | |
| 626 | #if DEBUG_MAPLE | |
| 627 | mame_printf_verbose("MAPLE: hardware trigger not supported yet\n"); | |
| 628 | #endif | |
| 629 | } | |
| 616 | 630 | } |
| 617 | 631 | break; |
| 618 | 632 | } |
| r3333 | r3334 | |
|---|---|---|
| 1211 | 1211 | } |
| 1212 | 1212 | |
| 1213 | 1213 | // Inputs are multiplexed, somehow |
| 1214 | READ8_HANDLER( tankfrc4_input_r ) | |
| 1214 | static READ8_HANDLER( tankfrc4_input_r ) | |
| 1215 | 1215 | { |
| 1216 | 1216 | |
| 1217 | 1217 | switch (offset) |
| r3333 | r3334 | |
|---|---|---|
| 3 | 3 | Neo-Geo hardware protection devices |
| 4 | 4 | |
| 5 | 5 | unknown devices |
| 6 | ssideki, fatfury2, | |
| 6 | ssideki, fatfury2, | |
| 7 | 7 | |
| 8 | 8 | SMA chip |
| 9 | 9 | kof99, garou, garouo, mslug3, kof2002 |
| r3333 | r3334 | |
|---|---|---|
| 13 | 13 | NeoGeo 'C' (Graphics) Rom encryption |
| 14 | 14 | CMC42 and CMC50 protection chips |
| 15 | 15 | Also contains 'S' (Text Layer) data on these games |
| 16 | M1 (Z80) rom is also encrypted for CMC50 | |
| 16 | M1 (Z80) rom is also encrypted for CMC50 | |
| 17 | 17 | |
| 18 | the M1 roms contain some additional data at 0xf800. Some of this | |
| 19 | is said to be related to the C rom encryption. | |
| 20 | ||
| 18 | 21 | Later games use additional basic scrambling on top of the standard |
| 19 | 22 | CMC scramble. |
| 20 | 23 | |
| r3333 | r3334 | |
| 631 | 634 | address_0_7_xor = kof2000_address_0_7_xor; |
| 632 | 635 | neogeo_gfx_decrypt(machine, extra_xor); |
| 633 | 636 | neogeo_sfix_decrypt(machine); |
| 634 | ||
| 635 | /* here I should also decrypt the sound ROM */ | |
| 636 | 637 | } |
| 637 | 638 | |
| 638 | 639 | |
| r3333 | r3334 | |
| 665 | 666 | address_16_23_xor2 = kof2000_address_16_23_xor2; |
| 666 | 667 | address_0_7_xor = kof2000_address_0_7_xor; |
| 667 | 668 | neogeo_gfx_decrypt(machine, extra_xor); |
| 668 | ||
| 669 | /* here I should also decrypt the sound ROM */ | |
| 670 | 669 | } |
| 671 | 670 | |
| 672 | 671 | |
| r3333 | r3334 | |
| 1363 | 1362 | } |
| 1364 | 1363 | free(buf); |
| 1365 | 1364 | } |
| 1365 | ||
| 1366 | ||
| 1367 | static const UINT8 m1_address_8_15_xor[256] = | |
| 1368 | { | |
| 1369 | 0x0a, 0x72, 0xb7, 0xaf, 0x67, 0xde, 0x1d, 0xb1, 0x78, 0xc4, 0x4f, 0xb5, 0x4b, 0x18, 0x76, 0xdd, | |
| 1370 | 0x11, 0xe2, 0x36, 0xa1, 0x82, 0x03, 0x98, 0xa0, 0x10, 0x5f, 0x3f, 0xd6, 0x1f, 0x90, 0x6a, 0x0b, | |
| 1371 | 0x70, 0xe0, 0x64, 0xcb, 0x9f, 0x38, 0x8b, 0x53, 0x04, 0xca, 0xf8, 0xd0, 0x07, 0x68, 0x56, 0x32, | |
| 1372 | 0xae, 0x1c, 0x2e, 0x48, 0x63, 0x92, 0x9a, 0x9c, 0x44, 0x85, 0x41, 0x40, 0x09, 0xc0, 0xc8, 0xbf, | |
| 1373 | 0xea, 0xbb, 0xf7, 0x2d, 0x99, 0x21, 0xf6, 0xba, 0x15, 0xce, 0xab, 0xb0, 0x2a, 0x60, 0xbc, 0xf1, | |
| 1374 | 0xf0, 0x9e, 0xd5, 0x97, 0xd8, 0x4e, 0x14, 0x9d, 0x42, 0x4d, 0x2c, 0x5c, 0x2b, 0xa6, 0xe1, 0xa7, | |
| 1375 | 0xef, 0x25, 0x33, 0x7a, 0xeb, 0xe7, 0x1b, 0x6d, 0x4c, 0x52, 0x26, 0x62, 0xb6, 0x35, 0xbe, 0x80, | |
| 1376 | 0x01, 0xbd, 0xfd, 0x37, 0xf9, 0x47, 0x55, 0x71, 0xb4, 0xf2, 0xff, 0x27, 0xfa, 0x23, 0xc9, 0x83, | |
| 1377 | 0x17, 0x39, 0x13, 0x0d, 0xc7, 0x86, 0x16, 0xec, 0x49, 0x6f, 0xfe, 0x34, 0x05, 0x8f, 0x00, 0xe6, | |
| 1378 | 0xa4, 0xda, 0x7b, 0xc1, 0xf3, 0xf4, 0xd9, 0x75, 0x28, 0x66, 0x87, 0xa8, 0x45, 0x6c, 0x20, 0xe9, | |
| 1379 | 0x77, 0x93, 0x7e, 0x3c, 0x1e, 0x74, 0xf5, 0x8c, 0x3e, 0x94, 0xd4, 0xc2, 0x5a, 0x06, 0x0e, 0xe8, | |
| 1380 | 0x3d, 0xa9, 0xb2, 0xe3, 0xe4, 0x22, 0xcf, 0x24, 0x8e, 0x6b, 0x8a, 0x8d, 0x84, 0x4a, 0xd2, 0x91, | |
| 1381 | 0x88, 0x79, 0x57, 0xa5, 0x0f, 0xcd, 0xb9, 0xac, 0x3b, 0xaa, 0xb3, 0xd1, 0xee, 0x31, 0x81, 0x7c, | |
| 1382 | 0xd7, 0x89, 0xd3, 0x96, 0x43, 0xc5, 0xc6, 0xc3, 0x69, 0x7f, 0x46, 0xdf, 0x30, 0x5b, 0x6e, 0xe5, | |
| 1383 | 0x08, 0x95, 0x9b, 0xfb, 0xb8, 0x58, 0x0c, 0x61, 0x50, 0x5d, 0x3a, 0xa2, 0x29, 0x12, 0xfc, 0x51, | |
| 1384 | 0x7d, 0x1a, 0x02, 0x65, 0x54, 0x5e, 0x19, 0xcc, 0xdc, 0xdb, 0x73, 0xed, 0xad, 0x59, 0x2f, 0xa3, | |
| 1385 | }; | |
| 1386 | ||
| 1387 | static const UINT8 m1_address_0_7_xor[256] = | |
| 1388 | { | |
| 1389 | 0xf4, 0xbc, 0x02, 0xf7, 0x2c, 0x3d, 0xe8, 0xd9, 0x50, 0x62, 0xec, 0xbd, 0x53, 0x73, 0x79, 0x61, | |
| 1390 | 0x00, 0x34, 0xcf, 0xa2, 0x63, 0x28, 0x90, 0xaf, 0x44, 0x3b, 0xc5, 0x8d, 0x3a, 0x46, 0x07, 0x70, | |
| 1391 | 0x66, 0xbe, 0xd8, 0x8b, 0xe9, 0xa0, 0x4b, 0x98, 0xdc, 0xdf, 0xe2, 0x16, 0x74, 0xf1, 0x37, 0xf5, | |
| 1392 | 0xb7, 0x21, 0x81, 0x01, 0x1c, 0x1b, 0x94, 0x36, 0x09, 0xa1, 0x4a, 0x91, 0x30, 0x92, 0x9b, 0x9a, | |
| 1393 | 0x29, 0xb1, 0x38, 0x4d, 0x55, 0xf2, 0x56, 0x18, 0x24, 0x47, 0x9d, 0x3f, 0x80, 0x1f, 0x22, 0xa4, | |
| 1394 | 0x11, 0x54, 0x84, 0x0d, 0x25, 0x48, 0xee, 0xc6, 0x59, 0x15, 0x03, 0x7a, 0xfd, 0x6c, 0xc3, 0x33, | |
| 1395 | 0x5b, 0xc4, 0x7b, 0x5a, 0x05, 0x7f, 0xa6, 0x40, 0xa9, 0x5d, 0x41, 0x8a, 0x96, 0x52, 0xd3, 0xf0, | |
| 1396 | 0xab, 0x72, 0x10, 0x88, 0x6f, 0x95, 0x7c, 0xa8, 0xcd, 0x9c, 0x5f, 0x32, 0xae, 0x85, 0x39, 0xac, | |
| 1397 | 0xe5, 0xd7, 0xfb, 0xd4, 0x08, 0x23, 0x19, 0x65, 0x6b, 0xa7, 0x93, 0xbb, 0x2b, 0xbf, 0xb8, 0x35, | |
| 1398 | 0xd0, 0x06, 0x26, 0x68, 0x3e, 0xdd, 0xb9, 0x69, 0x2a, 0xb2, 0xde, 0x87, 0x45, 0x58, 0xff, 0x3c, | |
| 1399 | 0x9e, 0x7d, 0xda, 0xed, 0x49, 0x8c, 0x14, 0x8e, 0x75, 0x2f, 0xe0, 0x6e, 0x78, 0x6d, 0x20, 0xd2, | |
| 1400 | 0xfa, 0x2d, 0x51, 0xcc, 0xc7, 0xe7, 0x1d, 0x27, 0x97, 0xfc, 0x31, 0xdb, 0xf8, 0x42, 0xe3, 0x99, | |
| 1401 | 0x5e, 0x83, 0x0e, 0xb4, 0x2e, 0xf6, 0xc0, 0x0c, 0x4c, 0x57, 0xb6, 0x64, 0x0a, 0x17, 0xa3, 0xc1, | |
| 1402 | 0x77, 0x12, 0xfe, 0xe6, 0x8f, 0x13, 0x71, 0xe4, 0xf9, 0xad, 0x9f, 0xce, 0xd5, 0x89, 0x7e, 0x0f, | |
| 1403 | 0xc2, 0x86, 0xf3, 0x67, 0xba, 0x60, 0x43, 0xc9, 0x04, 0xb3, 0xb0, 0x1e, 0xb5, 0xc8, 0xeb, 0xa5, | |
| 1404 | 0x76, 0xea, 0x5c, 0x82, 0x1a, 0x4f, 0xaa, 0xca, 0xe1, 0x0b, 0x4e, 0xcb, 0x6a, 0xef, 0xd1, 0xd6, | |
| 1405 | }; | |
| 1406 | ||
| 1407 | ||
| 1408 | int m1_address_scramble_inv(int address, UINT16 key) | |
| 1409 | { | |
| 1410 | int block; | |
| 1411 | int aux; | |
| 1412 | ||
| 1413 | const int p1[8][16] = { | |
| 1414 | {8,4,5,6,15,14,12,3,7,13,2,10,9,11,1,0}, | |
| 1415 | {13,1,6,7,10,8,14,0,2,5,12,3,15,9,11,4}, | |
| 1416 | {9,7,10,3,8,11,1,5,0,15,4,13,14,12,2,6}, | |
| 1417 | {10,12,0,4,5,15,9,7,1,3,11,6,13,8,14,2}, | |
| 1418 | {14,0,13,5,9,12,2,10,6,8,7,15,11,1,4,3}, | |
| 1419 | {5,11,7,2,3,13,8,4,12,6,14,0,10,15,9,1}, | |
| 1420 | {11,6,15,10,14,1,4,13,3,9,0,8,12,2,7,5}, | |
| 1421 | {3,14,4,1,6,10,15,2,11,0,9,7,5,13,8,12}, | |
| 1422 | }; | |
| 1423 | ||
| 1424 | block = (address>>16)&7; | |
| 1425 | aux = address&0xffff; | |
| 1426 | ||
| 1427 | aux = BITSWAP16(aux, 14,13,10,9,7,5,3,1,15,12,11,8,6,4,2,0); | |
| 1428 | aux ^= m1_address_8_15_xor[aux&0xff]<<8; | |
| 1429 | aux ^= m1_address_0_7_xor[(aux>>8)&0xff]; | |
| 1430 | aux = BITSWAP16(aux, | |
| 1431 | p1[block][15],p1[block][14],p1[block][13],p1[block][12], | |
| 1432 | p1[block][11],p1[block][10],p1[block][9],p1[block][8], | |
| 1433 | p1[block][7],p1[block][6],p1[block][5],p1[block][4], | |
| 1434 | p1[block][3],p1[block][2],p1[block][1],p1[block][0]); | |
| 1435 | aux ^= key; | |
| 1436 | ||
| 1437 | return (block<<16)|aux; | |
| 1438 | } | |
| 1439 | ||
| 1440 | ||
| 1441 | /* The CMC50 hardware does a checksum of the first 64kb of the M1 rom, | |
| 1442 | ,and uses this checksum as the basis of the key with which to decrypt | |
| 1443 | the rom */ | |
| 1444 | ||
| 1445 | static UINT16 generate_cs16(UINT8 *rom, int size) | |
| 1446 | { | |
| 1447 | UINT16 cs16; | |
| 1448 | int i; | |
| 1449 | cs16 = 0x0000; | |
| 1450 | for (i=0;i<size;i++ ) | |
| 1451 | { | |
| 1452 | cs16 += rom[i]; | |
| 1453 | } | |
| 1454 | return cs16&0xFFFF; | |
| 1455 | } | |
| 1456 | ||
| 1457 | ||
| 1458 | int m1_address_scramble(int address, UINT16 key) | |
| 1459 | { | |
| 1460 | int block; | |
| 1461 | int aux; | |
| 1462 | ||
| 1463 | const int p1[8][16] = { | |
| 1464 | {15,14,10,7,1,2,3,8,0,12,11,13,6,9,5,4}, | |
| 1465 | {7,1,8,11,15,9,2,3,5,13,4,14,10,0,6,12}, | |
| 1466 | {8,6,14,3,10,7,15,1,4,0,2,5,13,11,12,9}, | |
| 1467 | {2,8,15,9,3,4,11,7,13,6,0,10,1,12,14,5}, | |
| 1468 | {1,13,6,15,14,3,8,10,9,4,7,12,5,2,0,11}, | |
| 1469 | {11,15,3,4,7,0,9,2,6,14,12,1,8,5,10,13}, | |
| 1470 | {10,5,13,8,6,15,1,14,11,9,3,0,12,7,4,2}, | |
| 1471 | {9,3,7,0,2,12,4,11,14,10,5,8,15,13,1,6}, | |
| 1472 | }; | |
| 1473 | ||
| 1474 | block = (address>>16)&7; | |
| 1475 | aux = address&0xffff; | |
| 1476 | ||
| 1477 | aux ^= BITSWAP16(key,12,0,2,4,8,15,7,13,10,1,3,6,11,9,14,5); | |
| 1478 | aux = BITSWAP16(aux, | |
| 1479 | p1[block][15],p1[block][14],p1[block][13],p1[block][12], | |
| 1480 | p1[block][11],p1[block][10],p1[block][9],p1[block][8], | |
| 1481 | p1[block][7],p1[block][6],p1[block][5],p1[block][4], | |
| 1482 | p1[block][3],p1[block][2],p1[block][1],p1[block][0]); | |
| 1483 | aux ^= m1_address_0_7_xor[(aux>>8)&0xff]; | |
| 1484 | aux ^= m1_address_8_15_xor[aux&0xff]<<8; | |
| 1485 | aux = BITSWAP16(aux, 7,15,14,6,5,13,12,4,11,3,10,2,9,1,8,0); | |
| 1486 | ||
| 1487 | return (block<<16)|aux; | |
| 1488 | } | |
| 1489 | ||
| 1490 | ||
| 1491 | void neogeo_cmc50_m1_decrypt(running_machine *machine) | |
| 1492 | { | |
| 1493 | UINT8* rom = memory_region(machine, "audiocrypt"); | |
| 1494 | size_t rom_size = 0x80000; | |
| 1495 | UINT8* rom2 = memory_region(machine, "audio"); | |
| 1496 | ||
| 1497 | UINT8* buffer = malloc_or_die(rom_size); | |
| 1498 | ||
| 1499 | UINT32 i; | |
| 1500 | ||
| 1501 | UINT16 key=generate_cs16(rom,0x10000); | |
| 1502 | ||
| 1503 | //printf("key %04x\n",key); | |
| 1504 | ||
| 1505 | for (i=0; i<rom_size; i++) | |
| 1506 | { | |
| 1507 | buffer[i] = rom[m1_address_scramble(i,key)]; | |
| 1508 | } | |
| 1509 | ||
| 1510 | memcpy(rom,buffer,rom_size); | |
| 1511 | ||
| 1512 | memcpy(rom2,rom,0x10000); | |
| 1513 | memcpy(rom2+0x10000,rom,0x80000); | |
| 1514 | ||
| 1515 | #if 0 | |
| 1516 | { | |
| 1517 | FILE *fp; | |
| 1518 | const char *gamename = machine->gamedrv->name; | |
| 1519 | char filename[256]; | |
| 1520 | sprintf(filename, "%s_m1.dump", gamename); | |
| 1521 | ||
| 1522 | fp=fopen(filename, "w+b"); | |
| 1523 | if (fp) | |
| 1524 | { | |
| 1525 | fwrite(rom, rom_size, 1, fp); | |
| 1526 | fclose(fp); | |
| 1527 | } | |
| 1528 | } | |
| 1529 | #endif | |
| 1530 | ||
| 1531 | ||
| 1532 | #if 0 | |
| 1533 | { | |
| 1534 | FILE *fp; | |
| 1535 | const char *gamename = machine->gamedrv->name; | |
| 1536 | char filename[256]; | |
| 1537 | sprintf(filename, "%s_m1extra.dump", gamename); | |
| 1538 | ||
| 1539 | fp=fopen(filename, "w+b"); | |
| 1540 | if (fp) | |
| 1541 | { | |
| 1542 | fwrite(&rom[0xf800], 0x800, 1, fp); | |
| 1543 | fclose(fp); | |
| 1544 | } | |
| 1545 | } | |
| 1546 | #endif | |
| 1547 | ||
| 1548 | } |
| r3333 | r3334 | |
|---|---|---|
| 35 | 35 | UINT32 *g_p_n_psxram; |
| 36 | 36 | size_t g_n_psxramsize; |
| 37 | 37 | |
| 38 | #ifdef UNUSED_FUNCTON | |
| 38 | #ifdef UNUSED_FUNCTION | |
| 39 | 39 | INLINE void psxwriteword( UINT32 n_address, UINT16 n_data ) |
| 40 | 40 | { |
| 41 | 41 | *( (UINT16 *)( (UINT8 *)g_p_n_psxram + WORD_XOR_LE( n_address ) ) ) = n_data; |
| r3333 | r3334 | |
|---|---|---|
| 20 | 20 | |
| 21 | 21 | |
| 22 | 22 | int nb1413m3_type; |
| 23 | int nb1413m3_sndromregion; | |
| 23 | //int nb1413m3_sndromregion; | |
| 24 | 24 | const char * nb1413m3_sndromrgntag; |
| 25 | 25 | int nb1413m3_sndrombank1; |
| 26 | 26 | int nb1413m3_sndrombank2; |
| r3333 | r3334 | |
|---|---|---|
| 861 | 861 | DRIVER( propcycl ) /* (c) 1996 */ |
| 862 | 862 | |
| 863 | 863 | /* Namco System 23 */ |
| 864 | DRIVER( rapidrvr ) /* (c) 1997 */ | |
| 864 | 865 | DRIVER( timecrs2 ) /* (c) 1997 */ |
| 865 | DRIVER( gp500 ) /* (c) 1999 */ | |
| 866 | DRIVER( timcrs2b ) /* (c) 1997 */ | |
| 867 | DRIVER( 500gp ) /* (c) 1999 */ | |
| 866 | 868 | DRIVER( finfurl2 ) /* (c) 1999 */ |
| 867 | 869 | DRIVER( finfrl2j ) /* (c) 1999 */ |
| 868 | 870 | |
| r3333 | r3334 | |
| 4225 | 4227 | DRIVER( firetrap ) /* (c) 1986 Data East USA (US) */ |
| 4226 | 4228 | DRIVER( firetpbl ) /* bootleg */ |
| 4227 | 4229 | DRIVER( metlclsh ) /* (c) 1985 Data East */ |
| 4230 | DRIVER( chanbara ) /* (c) 1985 Data East */ | |
| 4228 | 4231 | DRIVER( brkthru ) /* (c) 1986 Data East USA (US) */ |
| 4229 | 4232 | DRIVER( brkthruj ) /* (c) 1986 Data East Corporation (Japan) */ |
| 4230 | 4233 | DRIVER( forcebrk ) /* (c) 1986 Data East Corporation (Japan) */ |
| r3333 | r3334 | |
| 7142 | 7145 | /* Yun Sung games */ |
| 7143 | 7146 | DRIVER( paradise ) /* (c) >1994 Yun Sung */ |
| 7144 | 7147 | DRIVER( paradlx ) /* (c) >1994 Yun Sung */ |
| 7148 | DRIVER( para2dx ) /* (c) >1994 Yun Sung */ | |
| 7145 | 7149 | DRIVER( tgtball ) /* (c) 1995 Yun Sung */ |
| 7146 | 7150 | DRIVER( tgtballa ) /* (c) 1995 Yun Sung */ |
| 7147 | 7151 | DRIVER( torus ) /* (c) 1996 Yun Sung */ |
| r3333 | r3334 | |
| 8229 | 8233 | DRIVER( jongkyo ) /* (c) 1985 Kiwako */ |
| 8230 | 8234 | DRIVER( gtipoker ) /* (c) 1983 GTI Inc */ |
| 8231 | 8235 | DRIVER( gamecstl ) /* MAME based bootleg */ |
| 8236 | DRIVER( gamecst2 ) /* MAME based bootleg, version 2.613 */ | |
| 8232 | 8237 | DRIVER( drw80pkr ) /* (c) 1983 IGT */ |
| 8233 | 8238 | DRIVER( blazlaz ) /* (c) 1989 Hudson Soft */ |
| 8234 | 8239 | DRIVER( paranoia ) /* (c) 1990 Naxat Soft */ |
| r3333 | r3334 | |
|---|---|---|
| 78 | 78 | UINT8 hardware_type; |
| 79 | 79 | |
| 80 | 80 | /* sound state */ |
| 81 | const UINT8 * snd_rom; | |
| 82 | const device_config * dev_vp2; /* virtual port 2 */ | |
| 81 | 83 | |
| 82 | 84 | /* video state */ |
| 83 | 85 | tilemap *bg_tilemap; |
| r3333 | r3334 | |
| 91 | 93 | size_t sprite_ram_size; |
| 92 | 94 | |
| 93 | 95 | /* radar scope */ |
| 96 | ||
| 97 | UINT8 * gfx4; | |
| 98 | UINT8 * gfx3; | |
| 99 | int gfx3_len; | |
| 100 | ||
| 94 | 101 | UINT8 sig30Hz; |
| 95 | 102 | UINT8 grid_sig; |
| 96 | 103 | UINT8 rflip_sig; |
| r3333 | r3334 | |
|---|---|---|
| 67 | 67 | void neo_pcm2_snk_1999(running_machine *machine, int value); |
| 68 | 68 | void neo_pcm2_swap(running_machine *machine, int value); |
| 69 | 69 | |
| 70 | void neogeo_cmc50_m1_decrypt(running_machine *machine); | |
| 70 | 71 | |
| 71 | 72 | /*----------- defined in machine/neoprot.c -----------*/ |
| 72 | 73 |
| r3333 | r3334 | |
|---|---|---|
| 113 | 113 | #define REVISION ((0x005F8004-0x005F8000)/4) |
| 114 | 114 | #define SOFTRESET ((0x005F8008-0x005F8000)/4) |
| 115 | 115 | #define STARTRENDER ((0x005F8014-0x005F8000)/4) |
| 116 | #define PARAM_BASE ((0x005F8020-0x005F8000)/4) | |
| 116 | 117 | #define VO_BORDER_COL ((0x005F8040-0x005F8000)/4) |
| 118 | #define FB_W_CTRL ((0x005F8048-0x005F8000)/4) | |
| 119 | #define FB_W_LINESTRIDE ((0x005F804c-0x005F8000)/4) | |
| 120 | #define FB_R_SOF1 ((0x005F8050-0x005F8000)/4) | |
| 121 | #define FB_R_SOF2 ((0x005F8054-0x005F8000)/4) | |
| 122 | #define FB_R_SIZE ((0x005F805c-0x005F8000)/4) | |
| 123 | #define FB_W_SOF1 ((0x005F8060-0x005F8000)/4) | |
| 124 | #define FB_W_SOF2 ((0x005F8064-0x005F8000)/4) | |
| 117 | 125 | #define VO_CONTROL ((0x005F80E8-0x005F8000)/4) |
| 118 | 126 | #define PAL_RAM_CTRL ((0x005F8108-0x005F8000)/4) |
| 119 | 127 | #define ISP_BACKGND_T ((0x005F808C-0x005F8000)/4) |
| r3333 | r3334 | |
| 131 | 139 | #define TA_NEXT_OPB ((0x005F8134-0x005F8000)/4) |
| 132 | 140 | #define TA_ITP_CURRENT ((0x005F8138-0x005F8000)/4) |
| 133 | 141 | |
| 142 | /* ------------- normal interrupts ------------- */ | |
| 134 | 143 | #define IST_EOR_VIDEO 0x00000001 |
| 135 | 144 | #define IST_EOR_ISP 0x00000002 |
| 136 | 145 | #define IST_EOR_TSP 0x00000004 |
| r3333 | r3334 | |
| 154 | 163 | #define IST_DMA_SORT 0x00100000 |
| 155 | 164 | #define IST_G1G2EXTSTAT 0x40000000 |
| 156 | 165 | #define IST_ERROR 0x80000000 |
| 166 | /* ------------ external interrupts ------------ */ | |
| 167 | #define IST_EXT_EXTERNAL 0x00000008 | |
| 168 | #define IST_EXT_MODEM 0x00000004 | |
| 169 | #define IST_EXT_AICA 0x00000002 | |
| 170 | #define IST_EXT_GDROM 0x00000001 | |
| 157 | 171 | |
| 158 | 172 | #endif |
| r3333 | r3334 | |
|---|---|---|
| 628 | 628 | $(DRIVERS)/boogwing.o $(VIDEO)/boogwing.o \ |
| 629 | 629 | $(DRIVERS)/brkthru.o $(VIDEO)/brkthru.o \ |
| 630 | 630 | $(DRIVERS)/btime.o $(MACHINE)/btime.o $(VIDEO)/btime.o \ |
| 631 | $(DRIVERS)/chanbara.o \ | |
| 631 | 632 | $(DRIVERS)/bwing.o $(VIDEO)/bwing.o \ |
| 632 | 633 | $(DRIVERS)/cbuster.o $(VIDEO)/cbuster.o \ |
| 633 | 634 | $(DRIVERS)/cninja.o $(VIDEO)/cninja.o \ |
| r3333 | r3334 | |
|---|---|---|
| 24 | 24 | static UINT16 readfifo; |
| 25 | 25 | UINT16 *HD63484_ram; |
| 26 | 26 | UINT16 HD63484_reg[256/2]; |
| 27 | UINT16 pattern[16]; | |
| 27 | static UINT16 pattern[16]; | |
| 28 | 28 | static int org,org_dpd,rwp; |
| 29 | 29 | static UINT16 cl0,cl1,ccmp,edg,mask,ppy,pzcy,ppx,pzcx,psy,psx,pey,pzy,pex,pzx,xmin,ymin,xmax,ymax,rwp_dn; |
| 30 | 30 | static INT16 cpx,cpy; |
| r3333 | r3334 | |
| 790 | 790 | } |
| 791 | 791 | } |
| 792 | 792 | |
| 793 | void line(INT16 sx, INT16 sy, INT16 ex, INT16 ey, INT16 col) | |
| 793 | static void line(INT16 sx, INT16 sy, INT16 ex, INT16 ey, INT16 col) | |
| 794 | 794 | { |
| 795 | 795 | INT16 ax,ay; |
| 796 | 796 | |
| r3333 | r3334 | |
| 841 | 841 | |
| 842 | 842 | } |
| 843 | 843 | |
| 844 | void paint(int sx, int sy, int col) | |
| 844 | static void paint(int sx, int sy, int col) | |
| 845 | 845 | { |
| 846 | 846 | int getpixel; |
| 847 | 847 | dot(sx,sy,0,col); |
| r3333 | r3334 | |
|---|---|---|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | |
| 181 | #ifdef UNUSED_FUNCTON | |
| 181 | #ifdef UNUSED_FUNCTION | |
| 182 | 182 | INLINE int get_sprite_bottom_y(int spr_number) |
| 183 | 183 | { |
| 184 | 184 | return spriteram[0x10 * spr_number + SPR_Y_BOTTOM]; |
| r3333 | r3334 | |
|---|---|---|
| 14 | 14 | /* nth_word32 is a general-purpose utility function, which allows us to |
| 15 | 15 | * read from 32-bit aligned memory as if it were an array of 16 bit words. |
| 16 | 16 | */ |
| 17 | #ifdef UNUSED_FUNCTON | |
| 17 | #ifdef UNUSED_FUNCTION | |
| 18 | 18 | INLINE UINT16 |
| 19 | 19 | nth_word32( const UINT32 *source, int which ) |
| 20 | 20 | { |
| r3333 | r3334 | |
| 34 | 34 | /* nth_byte32 is a general-purpose utility function, which allows us to |
| 35 | 35 | * read from 32-bit aligned memory as if it were an array of bytes. |
| 36 | 36 | */ |
| 37 | #ifdef UNUSED_FUNCTON | |
| 37 | #ifdef UNUSED_FUNCTION | |
| 38 | 38 | INLINE UINT8 |
| 39 | 39 | nth_byte32( const UINT32 *pSource, int which ) |
| 40 | 40 | { |
| r3333 | r3334 | |
|---|---|---|
| 202 | 202 | } |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | #ifdef UNUSED_FUNCTON | |
| 205 | #ifdef UNUSED_FUNCTION | |
| 206 | 206 | INLINE void waveram_plot_check_depth_nowrite(int y, int x, UINT16 color, UINT16 depth) |
| 207 | 207 | { |
| 208 | 208 | if (x >= 0 && x <= zeus_cliprect.max_x && y >= 0 && y < zeus_cliprect.max_y) |
| r3333 | r3334 | |
|---|---|---|
| 817 | 817 | UINT16 *pixel; |
| 818 | 818 | |
| 819 | 819 | if (state->hardware_type == HARDWARE_TRS01) |
| 820 | htable = | |
| 820 | htable = st | |
| 821 | 821 | |
| 822 | 822 | y = cliprect->min_y; |
| 823 | 823 | while (y <= cliprect->max_y) |
| r3333 | r3334 | |
| 840 | 840 | static void radarscp_scanline(running_machine *machine, int scanline) |
| 841 | 841 | { |
| 842 | 842 | dkong_state *state = machine->driver_data; |
| 843 | const UINT8 *table = memory_region(machine, "gfx3"); | |
| 844 | int table_len = memory_region_length(machine, "gfx3"); | |
| 843 | const UINT8 *table = state->gfx3; | |
| 844 | int table_len = state->gfx3_len; | |
| 845 | 845 | int x,y,offset; |
| 846 | 846 | UINT16 *pixel; |
| 847 | 847 | static int counter=0; |
| r3333 | r3334 | |
| 950 | 950 | { |
| 951 | 951 | case HARDWARE_TRS02: |
| 952 | 952 | state->bg_bits = video_screen_auto_bitmap_alloc(machine->primary_screen); |
| 953 | state->gfx3 = memory_region(machine, "gfx3"); | |
| 954 | state->gfx3_len = memory_region_length(machine, "gfx3"); | |
| 953 | 955 | /* fall through */ |
| 954 | 956 | case HARDWARE_TKG04: |
| 955 | 957 | case HARDWARE_TKG02: |
| r3333 | r3334 | |
| 961 | 963 | tilemap_set_scrolldx(state->bg_tilemap, 0, 128); |
| 962 | 964 | |
| 963 | 965 | state->bg_bits = video_screen_auto_bitmap_alloc(machine->primary_screen); |
| 966 | state->gfx4 = memory_region(machine, "gfx4"); | |
| 967 | state->gfx3 = memory_region(machine, "gfx3"); | |
| 968 | state->gfx3_len = memory_region_length(machine, "gfx3"); | |
| 969 | ||
| 964 | 970 | break; |
| 965 | 971 | default: |
| 966 | 972 | fatalerror("Invalid hardware type in dkong_video_start"); |
| r3333 | r3334 | |
|---|---|---|
| 126 | 126 | |
| 127 | 127 | |
| 128 | 128 | /* 8x8x4 tiles only */ |
| 129 | #ifdef UNUSED_FUNCTON | |
| 129 | #ifdef UNUSED_FUNCTION | |
| 130 | 130 | INLINE void get_tile_info(running_machine *machine,tile_data *tileinfo,int tile_index,int layer,UINT16 *vram) |
| 131 | 131 | { |
| 132 | 132 | UINT16 code; |
| r3333 | r3334 | |
| 204 | 204 | |
| 205 | 205 | /* 16x16x4 or 16x16x8 tiles. It's the tile's color that decides: if its low 4 |
| 206 | 206 | bits are high ($f,$1f,$2f etc) the tile is 8bpp, otherwise it's 4bpp */ |
| 207 | #ifdef UNUSED_FUNCTON | |
| 207 | #ifdef UNUSED_FUNCTION | |
| 208 | 208 | INLINE void get_tile_info_16x16_8bit(running_machine *machine,tile_data *tileinfo,int tile_index,int layer,UINT16 *vram) |
| 209 | 209 | { |
| 210 | 210 | UINT16 code; |
| r3333 | r3334 | |
|---|---|---|
| 40 | 40 | static UINT16 xscroll; |
| 41 | 41 | static UINT16 yscroll; |
| 42 | 42 | static UINT8 gfxbank; |
| 43 | static UINT16 last_scanline; | |
| 43 | 44 | |
| 45 | static emu_timer *scanline_timer; | |
| 44 | 46 | |
| 47 | /************************************* | |
| 48 | * | |
| 49 | * Scanline callback | |
| 50 | * | |
| 51 | *************************************/ | |
| 45 | 52 | |
| 53 | static TIMER_CALLBACK( scanline_callback ) | |
| 54 | { | |
| 55 | int scanline = param; | |
| 56 | ||
| 57 | /* update the DACs */ | |
| 58 | ||
| 59 | if (!(leland_dac_control & 0x01)) | |
| 60 | leland_dac_update(0, leland_video_ram[(last_scanline) * 256 + 160]); | |
| 61 | ||
| 62 | if (!(leland_dac_control & 0x02)) | |
| 63 | leland_dac_update(1, leland_video_ram[(last_scanline) * 256 + 161]); | |
| 64 | ||
| 65 | last_scanline = scanline; | |
| 66 | ||
| 67 | scanline = (scanline+1) % 256; | |
| 68 | ||
| 69 | if (scanline == 0) | |
| 70 | { | |
| 71 | /* turn off the DACs at the start of the frame */ | |
| 72 | leland_dac_control = 3; | |
| 73 | } | |
| 74 | ||
| 75 | /* come back at the next appropriate scanline */ | |
| 76 | timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), scanline); | |
| 77 | } | |
| 78 | ||
| 79 | ||
| 46 | 80 | /************************************* |
| 47 | 81 | * |
| 48 | 82 | * Start video hardware |
| r3333 | r3334 | |
| 56 | 90 | |
| 57 | 91 | /* reset videoram */ |
| 58 | 92 | memset(leland_video_ram, 0, VRAM_SIZE); |
| 93 | ||
| 94 | /* scanline timer */ | |
| 95 | scanline_timer = timer_alloc(scanline_callback, NULL); | |
| 96 | timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, 0, 0), 0); | |
| 97 | ||
| 59 | 98 | } |
| 60 | 99 | |
| 61 | 100 | |
| r3333 | r3334 | |
| 369 | 408 | |
| 370 | 409 | /************************************* |
| 371 | 410 | * |
| 372 | * Resets the DAC | |
| 373 | * | |
| 374 | *************************************/ | |
| 375 | ||
| 376 | static TIMER_CALLBACK( dac_reset ) | |
| 377 | { | |
| 378 | /* turn off the DACs at the start of the frame */ | |
| 379 | leland_dac_control = 3; | |
| 380 | } | |
| 381 | ||
| 382 | ||
| 383 | ||
| 384 | /************************************* | |
| 385 | * | |
| 386 | 411 | * ROM-based refresh routine |
| 387 | 412 | * |
| 388 | 413 | *************************************/ |
| r3333 | r3334 | |
| 442 | 467 | *dst++ = pen; |
| 443 | 468 | } |
| 444 | 469 | |
| 445 | /* also update the DACs */ | |
| 446 | if (!(leland_dac_control & 0x01)) | |
| 447 | leland_dac_update(0, leland_video_ram[y * 256 + 160]); | |
| 448 | ||
| 449 | if (!(leland_dac_control & 0x02)) | |
| 450 | leland_dac_update(1, leland_video_ram[y * 256 + 161]); | |
| 451 | 470 | } |
| 452 | 471 | |
| 453 | /* set a timer to go off at the top of the frame */ | |
| 454 | if (cliprect->max_y == video_screen_get_visible_area(screen)->max_y) | |
| 455 | timer_set(video_screen_get_time_until_pos(screen, 0, 0), NULL, 0, dac_reset); | |
| 456 | ||
| 457 | 472 | return 0; |
| 458 | 473 | } |
| 459 | 474 | |
| r3333 | r3334 | |
| 517 | 532 | |
| 518 | 533 | *dst++ = pen; |
| 519 | 534 | } |
| 520 | ||
| 521 | /* also update the DACs */ | |
| 522 | if (!(leland_dac_control & 0x01)) | |
| 523 | leland_dac_update(0, leland_video_ram[y * 256 + 160]); | |
| 524 | ||
| 525 | if (!(leland_dac_control & 0x02)) | |
| 526 | leland_dac_update(1, leland_video_ram[y * 256 + 161]); | |
| 527 | 535 | } |
| 528 | 536 | |
| 529 | /* set a timer to go off at the top of the frame */ | |
| 530 | if (cliprect->max_y == video_screen_get_visible_area(screen)->max_y) | |
| 531 | timer_set(video_screen_get_time_until_pos(screen, 0, 0), NULL, 0, dac_reset); | |
| 532 | ||
| 533 | 537 | return 0; |
| 534 | 538 | } |
| 535 | 539 |
| r3333 | r3334 | |
|---|---|---|
| 30 | 30 | static emu_timer *vbout_timer; |
| 31 | 31 | |
| 32 | 32 | typedef struct { |
| 33 | int tafifo_pos, tafifo_mask, tafifo_vertexwords, tafifo_listtype; | |
| 34 | int start_render_received; | |
| 35 | int listtype_used; | |
| 36 | int alloc_ctrl_OPB_Mode, alloc_ctrl_PT_OPB, alloc_ctrl_TM_OPB, alloc_ctrl_T_OPB, alloc_ctrl_OM_OPB, alloc_ctrl_O_OPB; | |
| 37 | 33 | struct testsprites |
| 38 | 34 | { |
| 39 | 35 | int positionx, positiony; |
| r3333 | r3334 | |
| 51 | 47 | int endofstrip; |
| 52 | 48 | } showvertices[65536]; |
| 53 | 49 | #endif |
| 54 | int testsprites_size, toerasesprites, testvertices_size; | |
| 50 | int testsprites_size, testsprites_toerase, testvertices_size; | |
| 51 | UINT32 ispbase; | |
| 52 | UINT32 fbwsof1; | |
| 53 | UINT32 fbwsof2; | |
| 54 | int busy; | |
| 55 | int valid; | |
| 56 | } receiveddata; | |
| 57 | ||
| 58 | typedef struct { | |
| 59 | int tafifo_pos, tafifo_mask, tafifo_vertexwords, tafifo_listtype; | |
| 60 | int start_render_received; | |
| 61 | int renderselect; | |
| 62 | int listtype_used; | |
| 63 | int alloc_ctrl_OPB_Mode, alloc_ctrl_PT_OPB, alloc_ctrl_TM_OPB, alloc_ctrl_T_OPB, alloc_ctrl_OM_OPB, alloc_ctrl_O_OPB; | |
| 64 | receiveddata grab[4]; | |
| 65 | int grabsel; | |
| 66 | int grabsellast; | |
| 55 | 67 | UINT32 paracontrol,paratype,endofstrip,listtype,global_paratype,parameterconfig; |
| 56 | 68 | UINT32 groupcontrol,groupen,striplen,userclip; |
| 57 | 69 | UINT32 objcontrol,shadow,volume,coltype,texture,offfset,gouraud,uv16bit; |
| r3333 | r3334 | |
| 61 | 73 | UINT32 depthcomparemode,cullingmode,zwritedisable,cachebypass,dcalcctrl,volumeinstruction,mipmapped,vqcompressed,strideselect,paletteselector; |
| 62 | 74 | } pvrta_state; |
| 63 | 75 | |
| 64 | pvrta_state state_ta; | |
| 76 | static pvrta_state state_ta; | |
| 65 | 77 | |
| 66 | 78 | // register decode helper |
| 67 | 79 | INLINE int decode_reg_64(UINT32 offset, UINT64 mem_mask, UINT64 *shift) |
| r3333 | r3334 | |
| 130 | 142 | } |
| 131 | 143 | |
| 132 | 144 | #if DEBUG_PVRTA_REGS |
| 133 | mame_printf_verbose("PVRTA: [%08x] read %x @ %x (reg %x), mask %llx (PC=%x)\n", 0x5f8000+reg*4, pvrta_regs[reg], offset, reg, mem_mask, activecpu_get_pc()); | |
| 145 | if (reg != 0x43) | |
| 146 | mame_printf_verbose("PVRTA: [%08x] read %x @ %x (reg %x), mask %llx (PC=%x)\n", 0x5f8000+reg*4, pvrta_regs[reg], offset, reg, mem_mask, activecpu_get_pc()); | |
| 134 | 147 | #endif |
| 135 | 148 | return (UINT64)pvrta_regs[reg] << shift; |
| 136 | 149 | } |
| r3333 | r3334 | |
| 140 | 153 | int reg; |
| 141 | 154 | UINT64 shift; |
| 142 | 155 | UINT32 old,dat; |
| 156 | int a; | |
| 143 | 157 | |
| 144 | 158 | reg = decode_reg_64(offset, mem_mask, &shift); |
| 145 | 159 | dat = (UINT32)(data >> shift); |
| r3333 | r3334 | |
| 161 | 175 | mame_printf_verbose("pvr_ta_w: Core Pipeline soft reset\n"); |
| 162 | 176 | #endif |
| 163 | 177 | if (state_ta.start_render_received == 1) |
| 178 | { | |
| 179 | for (a=0;a < 4;a++) | |
| 180 | if (state_ta.grab[a].busy == 1) | |
| 181 | state_ta.grab[a].busy = 0; | |
| 164 | 182 | state_ta.start_render_received = 0; |
| 183 | } | |
| 165 | 184 | } |
| 166 | 185 | if (dat & 4) |
| 167 | 186 | { |
| r3333 | r3334 | |
| 176 | 195 | mame_printf_verbose(" Region Array at %08x\n",pvrta_regs[REGION_BASE]); |
| 177 | 196 | mame_printf_verbose(" ISP/TSP Parameters at %08x\n",pvrta_regs[PARAM_BASE]); |
| 178 | 197 | #endif |
| 179 | state_ta.start_render_received=1; | |
| 198 | // select buffer to draw using PARAM_BASE | |
| 199 | for (a=0;a < 4;a++) | |
| 200 | { | |
| 201 | if ((state_ta.grab[a].ispbase == pvrta_regs[PARAM_BASE]) && (state_ta.grab[a].valid == 1) && (state_ta.grab[a].busy == 0)) | |
| 202 | { | |
| 203 | state_ta.grab[a].busy = 1; | |
| 204 | state_ta.renderselect = a; | |
| 205 | state_ta.start_render_received=1; | |
| 206 | state_ta.grab[a].fbwsof1=pvrta_regs[FB_W_SOF1]; | |
| 207 | state_ta.grab[a].fbwsof2=pvrta_regs[FB_W_SOF2]; | |
| 208 | break; | |
| 209 | } | |
| 210 | } | |
| 211 | if (a != 4) | |
| 212 | break; | |
| 213 | assert_always(0, "TA grabber error!\n"); | |
| 180 | 214 | break; |
| 181 | 215 | case TA_LIST_INIT: |
| 182 | 216 | state_ta.tafifo_pos=0; |
| 183 | 217 | state_ta.tafifo_mask=7; |
| 184 | 218 | state_ta.tafifo_vertexwords=8; |
| 185 | 219 | state_ta.tafifo_listtype= -1; |
| 186 | state_ta.toerasesprites=1; | |
| 187 | 220 | #if DEBUG_PVRTA |
| 188 | 221 | mame_printf_verbose("TA_OL_BASE %08x TA_OL_LIMIT %08x\n", pvrta_regs[TA_OL_BASE], pvrta_regs[TA_OL_LIMIT]); |
| 189 | 222 | mame_printf_verbose("TA_ISP_BASE %08x TA_ISP_LIMIT %08x\n", pvrta_regs[TA_ISP_BASE], pvrta_regs[TA_ISP_LIMIT]); |
| r3333 | r3334 | |
| 199 | 232 | state_ta.alloc_ctrl_OM_OPB = (4 << ((pvrta_regs[TA_ALLOC_CTRL] >> 4) & 3)) & 0x38; |
| 200 | 233 | state_ta.alloc_ctrl_O_OPB = (4 << ((pvrta_regs[TA_ALLOC_CTRL] >> 0) & 3)) & 0x38; |
| 201 | 234 | state_ta.listtype_used |= (1+4); |
| 235 | // use TA_ISP_BASE and select buffer for grab data | |
| 236 | state_ta.grabsel = -1; | |
| 237 | // try to find already used buffer but not busy | |
| 238 | for (a=0;a < 4;a++) | |
| 239 | { | |
| 240 | if ((state_ta.grab[a].ispbase == pvrta_regs[TA_ISP_BASE]) && (state_ta.grab[a].busy == 0) && (state_ta.grab[a].valid == 1)) | |
| 241 | { | |
| 242 | state_ta.grabsel=a; | |
| 243 | break; | |
| 244 | } | |
| 245 | } | |
| 246 | // try a buffer not used yet | |
| 247 | if (state_ta.grabsel < 0) | |
| 248 | { | |
| 249 | for (a=0;a < 4;a++) | |
| 250 | { | |
| 251 | if (state_ta.grab[a].valid == 0) | |
| 252 | { | |
| 253 | state_ta.grabsel=a; | |
| 254 | break; | |
| 255 | } | |
| 256 | } | |
| 257 | } | |
| 258 | // find a non busy buffer starting from the last one used | |
| 259 | if (state_ta.grabsel < 0) | |
| 260 | { | |
| 261 | for (a=0;a < 3;a++) | |
| 262 | { | |
| 263 | if (state_ta.grab[(state_ta.grabsellast+1+a) & 3].busy == 0) | |
| 264 | { | |
| 265 | state_ta.grabsel=a; | |
| 266 | break; | |
| 267 | } | |
| 268 | } | |
| 269 | } | |
| 270 | if (state_ta.grabsel < 0) | |
| 271 | assert_always(0, "TA grabber error!\n"); | |
| 272 | state_ta.grabsellast=state_ta.grabsel; | |
| 273 | state_ta.grab[state_ta.grabsel].ispbase=pvrta_regs[TA_ISP_BASE]; | |
| 274 | state_ta.grab[state_ta.grabsel].busy=0; | |
| 275 | state_ta.grab[state_ta.grabsel].valid=1; | |
| 276 | state_ta.grab[state_ta.grabsel].testsprites_size=0; | |
| 277 | state_ta.grab[state_ta.grabsel].testvertices_size=0; | |
| 202 | 278 | break; |
| 203 | 279 | case TA_LIST_CONT: |
| 204 | 280 | #if DEBUG_PVRTA |
| r3333 | r3334 | |
| 210 | 286 | } |
| 211 | 287 | |
| 212 | 288 | #if DEBUG_PVRTA_REGS |
| 213 | mame_printf_verbose("PVRTA: [%08x=%x] write %llx to %x (reg %x %x), mask %llx\n", 0x5f8000+reg*4, dat, data>>shift, offset, reg, (reg*4)+0x8000, mem_mask); | |
| 289 | if ((reg != 0x14) && (reg != 0x15)) | |
| 290 | mame_printf_verbose("PVRTA: [%08x=%x] write %llx to %x (reg %x %x), mask %llx\n", 0x5f8000+reg*4, dat, data>>shift, offset, reg, (reg*4)+0x8000, mem_mask); | |
| 214 | 291 | #endif |
| 215 | 292 | } |
| 216 | 293 | |
| r3333 | r3334 | |
| 223 | 300 | tafifo_buff[state_ta.tafifo_pos]=(UINT32)data; |
| 224 | 301 | tafifo_buff[state_ta.tafifo_pos+1]=(UINT32)(data >> 32); |
| 225 | 302 | #if DEBUG_FIFO_POLY |
| 226 | mame_printf_debug("ta_fifo_poly_w: Unmapped write64 %08x = %llx -> %08x %08x\n", 0x10000000+offset*8, data, tafifo_buff[tafifo_pos], tafifo_buff[tafifo_pos+1]); | |
| 303 | mame_printf_debug("ta_fifo_poly_w: Unmapped write64 %08x = %llx -> %08x %08x\n", 0x10000000+offset*8, data, tafifo_buff[state_ta.tafifo_pos], tafifo_buff[state_ta.tafifo_pos+1]); | |
| 227 | 304 | #endif |
| 228 | 305 | state_ta.tafifo_pos += 2; |
| 229 | 306 | } |
| r3333 | r3334 | |
| 264 | 341 | state_ta.uv16bit=(state_ta.objcontrol >> 0) & 1; |
| 265 | 342 | } |
| 266 | 343 | |
| 267 | if (state_ta.toerasesprites == 1) | |
| 268 | { | |
| 269 | state_ta.toerasesprites=0; | |
| 270 | state_ta.testsprites_size=0; | |
| 271 | #if DEBUG_VERTICES | |
| 272 | state_ta.testvertices_size=0; | |
| 273 | #endif | |
| 274 | } | |
| 275 | ||
| 276 | 344 | // check if we need 8 words more |
| 277 | 345 | if (state_ta.tafifo_mask == 7) |
| 278 | 346 | { |
| r3333 | r3334 | |
| 304 | 372 | } |
| 305 | 373 | |
| 306 | 374 | // now we heve all the needed words |
| 307 | // interpret their meaning | |
| 375 | // here we should generate the data for the various tiles | |
| 376 | // for now, just interpret their meaning | |
| 308 | 377 | if (state_ta.paratype == 0) |
| 309 | 378 | { // end of list |
| 310 | 379 | #if DEBUG_PVRDLIST |
| r3333 | r3334 | |
| 461 | 530 | mame_printf_verbose(" A(%f,%f) B(%f,%f) C(%f,%f)\n",u2f(tafifo_buff[13] & 0xffff0000),u2f((tafifo_buff[13] & 0xffff) << 16),u2f(tafifo_buff[14] & 0xffff0000),u2f((tafifo_buff[14] & 0xffff) << 16),u2f(tafifo_buff[15] & 0xffff0000),u2f((tafifo_buff[15] & 0xffff) << 16)); |
| 462 | 531 | #endif |
| 463 | 532 | /* test video start */ |
| 464 | state_ta.showsprites[state_ta.testsprites_size].positionx=u2f(tafifo_buff[1]); | |
| 465 | state_ta.showsprites[state_ta.testsprites_size].positiony=u2f(tafifo_buff[2]); | |
| 466 | state_ta.showsprites[state_ta.testsprites_size].sizex=u2f(tafifo_buff[4])-u2f(tafifo_buff[1]); | |
| 467 | state_ta.showsprites[state_ta.testsprites_size].sizey=u2f(tafifo_buff[8])-u2f(tafifo_buff[2]); | |
| 468 | state_ta.showsprites[state_ta.testsprites_size].u=u2f(tafifo_buff[13] & 0xffff0000); | |
| 469 | state_ta.showsprites[state_ta.testsprites_size].v=u2f((tafifo_buff[13] & 0xffff) << 16); | |
| 470 | state_ta.showsprites[state_ta.testsprites_size].du=u2f(tafifo_buff[14] & 0xffff0000)-state_ta.showsprites[state_ta.testsprites_size].u; | |
| 471 | state_ta.showsprites[state_ta.testsprites_size].dv=u2f((tafifo_buff[15] & 0xffff) << 16)-state_ta.showsprites[state_ta.testsprites_size].v; | |
| 472 | state_ta.showsprites[state_ta.testsprites_size].textureaddress=state_ta.textureaddress; | |
| 473 | state_ta.showsprites[state_ta.testsprites_size].texturesizex=state_ta.textureusize; | |
| 474 | state_ta.showsprites[state_ta.testsprites_size].texturesizey=state_ta.texturevsize; | |
| 475 | state_ta.showsprites[state_ta.testsprites_size].texturemode=state_ta.scanorder+state_ta.vqcompressed*2; | |
| 476 | state_ta.showsprites[state_ta.testsprites_size].texturesizes=state_ta.texturesizes; | |
| 477 | state_ta.showsprites[state_ta.testsprites_size].texturepf=state_ta.pixelformat; | |
| 478 | state_ta.showsprites[state_ta.testsprites_size].texturepalette=state_ta.paletteselector; | |
| 479 | state_ta.testsprites_size=state_ta.testsprites_size+1; | |
| 533 | state_ta.grab[state_ta.grabsel].showsprites[state_ta.grab[state_ta.grabsel].testsprites_size].positionx=u2f(tafifo_buff[1]); | |
| 534 | state_ta.grab[state_ta.grabsel].showsprites[state_ta.grab[state_ta.grabsel].testsprites_size].positiony=u2f(tafifo_buff[2]); | |
| 535 | state_ta.grab[state_ta.grabsel].showsprites[state_ta.grab[state_ta.grabsel].testsprites_size].sizex=u2f(tafifo_buff[4])-u2f(tafifo_buff[1]); | |
| 536 | state_ta.grab[state_ta.grabsel].showsprites[state_ta.grab[state_ta.grabsel].testsprites_size].sizey=u2f(tafifo_buff[8])-u2f(tafifo_buff[2]); | |
| 537 | state_ta.grab[state_ta.grabsel].showsprites[state_ta.grab[state_ta.grabsel].testsprites_size].u=u2f(tafifo_buff[13] & 0xffff0000); | |
| 538 | state_ta.grab[state_ta.grabsel].showsprites[state_ta.grab[state_ta.grabsel].testsprites_size].v=u2f((tafifo_buff[13] & 0xffff) << 16); | |
| 539 | state_ta.grab[state_ta.grabsel].showsprites[state_ta.grab[state_ta.grabsel].testsprites_size].du=u2f(tafifo_buff[14] & 0xffff0000)-state_ta.grab[state_ta.grabsel].showsprites[state_ta.grab[state_ta.grabsel].testsprites_size].u; | |
| 540 | state_ta.grab[state_ta.grabsel].showsprites[state_ta.grab[state_ta.grabsel].testsprites_size].dv=u2f((tafifo_buff[15] & 0xffff) << 16)-state_ta.grab[state_ta.grabsel].showsprites[state_ta.grab[state_ta.grabsel].testsprites_size].v; | |
| 541 | state_ta.grab[state_ta.grabsel].showsprites[state_ta.grab[state_ta.grabsel].testsprites_size].textureaddress=state_ta.textureaddress; | |
| 542 | state_ta.grab[state_ta.grabsel].showsprites[state_ta.grab[state_ta.grabsel].testsprites_size].texturesizex=state_ta.textureusize; | |
| 543 | state_ta.grab[state_ta.grabsel].showsprites[state_ta.grab[state_ta.grabsel].testsprites_size].texturesizey=state_ta.texturevsize; | |
| 544 | state_ta.grab[state_ta.grabsel].showsprites[state_ta.grab[state_ta.grabsel].testsprites_size].texturemode=state_ta.scanorder+state_ta.vqcompressed*2; | |
| 545 | state_ta.grab[state_ta.grabsel].showsprites[state_ta.grab[state_ta.grabsel].testsprites_size].texturesizes=state_ta.texturesizes; | |
| 546 | state_ta.grab[state_ta.grabsel].showsprites[state_ta.grab[state_ta.grabsel].testsprites_size].texturepf=state_ta.pixelformat; | |
| 547 | state_ta.grab[state_ta.grabsel].showsprites[state_ta.grab[state_ta.grabsel].testsprites_size].texturepalette=state_ta.paletteselector; | |
| 548 | state_ta.grab[state_ta.grabsel].testsprites_size=state_ta.grab[state_ta.grabsel].testsprites_size+1; | |
| 480 | 549 | /* test video end */ |
| 481 | 550 | } |
| 482 | 551 | } |
| r3333 | r3334 | |
| 488 | 557 | mame_printf_verbose("\n"); |
| 489 | 558 | #endif |
| 490 | 559 | #if DEBUG_VERTICES |
| 491 | if (state_ta.testvertices_size < 65530) | |
| 560 | if (state_ta.grab[state_ta.grabsel].testvertices_size <= 65530) | |
| 492 | 561 | { |
| 493 | state_ta.showvertices[state_ta.testvertices_size].x=u2f(tafifo_buff[1]); | |
| 494 | state_ta.showvertices[state_ta.testvertices_size].y=u2f(tafifo_buff[2]); | |
| 495 | state_ta.showvertices[state_ta.testvertices_size].endofstrip=state_ta.endofstrip; | |
| 562 | state_ta.grab[state_ta.grabsel].showvertices[state_ta.grab[state_ta.grabsel].testvertices_size].x=u2f(tafifo_buff[1]); | |
| 563 | state_ta.grab[state_ta.grabsel].showvertices[state_ta.grab[state_ta.grabsel].testvertices_size].y=u2f(tafifo_buff[2]); | |
| 564 | state_ta.grab[state_ta.grabsel].showvertices[state_ta.grab[state_ta.grabsel].testvertices_size].endofstrip=state_ta.endofstrip; | |
| 496 | 565 | } |
| 497 | state_ta.testvertices_size=state_ta.testvertices_size+1; | |
| 566 | state_ta.grab[state_ta.grabsel].testvertices_size=state_ta.grab[state_ta.grabsel].testvertices_size+1; | |
| 498 | 567 | #endif |
| 499 | 568 | } |
| 500 | 569 | } |
| r3333 | r3334 | |
| 562 | 631 | } |
| 563 | 632 | |
| 564 | 633 | #if DEBUG_VERTICES |
| 565 | static void testdrawline(bitmap_t *bitmap,int from,int to) | |
| 634 | static void testdrawline(bitmap_t *bitmap, int index, int from, int to) | |
| 566 | 635 | { |
| 636 | UINT32 *bmpaddr; | |
| 637 | int ix, iy, i, inc, x, y, dx, dy, plotx, ploty; | |
| 638 | ||
| 639 | if ((state_ta.grab[index].showvertices[to].x < 0) || (state_ta.grab[index].showvertices[to].x > 639)) | |
| 640 | return; | |
| 641 | if ((state_ta.grab[index].showvertices[from].x < 0) || (state_ta.grab[index].showvertices[from].x > 639)) | |
| 642 | return; | |
| 643 | if ((state_ta.grab[index].showvertices[to].y < 0) || (state_ta.grab[index].showvertices[to].y > 479)) | |
| 644 | return; | |
| 645 | if ((state_ta.grab[index].showvertices[from].y < 0) || (state_ta.grab[index].showvertices[from].y > 479)) | |
| 646 | return; | |
| 647 | dx = state_ta.grab[index].showvertices[to].x - state_ta.grab[index].showvertices[from].x; | |
| 648 | dy = state_ta.grab[index].showvertices[to].y - state_ta.grab[index].showvertices[from].y; | |
| 649 | plotx = state_ta.grab[index].showvertices[from].x; | |
| 650 | ploty = state_ta.grab[index].showvertices[from].y; | |
| 651 | ix = abs(dx); | |
| 652 | iy = abs(dy); | |
| 653 | inc = max(ix,iy); | |
| 654 | x = y = 0; | |
| 655 | ||
| 656 | for (i=0; i <= inc; ++i) | |
| 657 | { | |
| 658 | x += ix; y += iy; | |
| 659 | ||
| 660 | if (x > inc) | |
| 661 | { | |
| 662 | x -= inc; | |
| 663 | plotx += (dx ? dx/ix : 0); | |
| 664 | bmpaddr = BITMAP_ADDR32(bitmap,ploty,plotx); | |
| 665 | *bmpaddr = MAKE_RGB(0, 0, 255); | |
| 666 | } | |
| 667 | if (y > inc) | |
| 668 | { | |
| 669 | y -= inc; | |
| 670 | ploty += (dy ? dy/iy : 0); | |
| 671 | bmpaddr = BITMAP_ADDR32(bitmap,ploty,plotx); | |
| 672 | *bmpaddr = MAKE_RGB(0, 0, 255); | |
| 673 | } | |
| 674 | } | |
| 567 | 675 | } |
| 568 | 676 | #endif |
| 569 | 677 | |
| 678 | #if 0 | |
| 679 | INLINE UINT32 alpha_blend_r16_565(UINT32 d, UINT32 s, UINT8 level) | |
| 680 | { | |
| 681 | int alphad = 256 - level; | |
| 682 | return ((((s & 0x001f) * level + (d & 0x001f) * alphad) >> 8)) | | |
| 683 | ((((s & 0x07e0) * level + (d & 0x07e0) * alphad) >> 8) & 0x07e0) | | |
| 684 | ((((s & 0xf800) * level + (d & 0xf800) * alphad) >> 8) & 0xf800); | |
| 685 | } | |
| 686 | #endif | |
| 687 | ||
| 570 | 688 | static void testdrawscreen(bitmap_t *bitmap,const rectangle *cliprect) |
| 571 | 689 | { |
| 572 | int cs,x,y,dx,dy,xi,yi,a; | |
| 690 | int cs,x,y,dx,dy,xi,yi,a,rs,ns; | |
| 573 | 691 | float iu,iv,u,v; |
| 574 | 692 | UINT32 addrp; |
| 575 | 693 | UINT32 *bmpaddr; |
| 576 | 694 | int xt,yt,cd; |
| 577 | 695 | UINT32 c; |
| 696 | #if 0 | |
| 697 | int stride; | |
| 698 | UINT16 *bmpaddr16; | |
| 699 | UINT32 k; | |
| 700 | #endif | |
| 578 | 701 | |
| 702 | if (state_ta.renderselect < 0) | |
| 703 | return; | |
| 704 | rs=state_ta.renderselect; | |
| 579 | 705 | c=pvrta_regs[ISP_BACKGND_T]; |
| 580 | fillbitmap(bitmap,program_read_dword_64le(0x05000000+((c&0xfffff8)>>1)+(3+3)*4),cliprect); | |
| 706 | c=program_read_dword_64le(0x05000000+((c&0xfffff8)>>1)+(3+3)*4); | |
| 707 | fillbitmap(bitmap,c,cliprect); | |
| 708 | #if 0 | |
| 709 | stride=pvrta_regs[FB_W_LINESTRIDE] << 3; | |
| 710 | c=pvrta_regs[ISP_BACKGND_T]; | |
| 711 | a=(c & 0xfffff8) >> 1; | |
| 712 | cs=(c >> 24) & 7; | |
| 713 | cs=cs+3; // cs*2+3 | |
| 714 | c=program_read_dword_64le(0x05000000+a+3*4+(cs-1)*4); | |
| 715 | dx=(int)u2f(program_read_dword_64le(0x05000000+a+3*4+cs*4+0)); | |
| 716 | dy=(int)u2f(program_read_dword_64le(0x05000000+a+3*4+2*cs*4+4)); | |
| 717 | for (y=0;y < dy;y++) | |
| 718 | { | |
| 719 | addrp=state_ta.grab[rs].fbwsof1+y*stride; | |
| 720 | for (x=0;x < dx;x++) | |
| 721 | { | |
| 722 | bmpaddr16=((UINT16 *)dc_texture_ram) + (WORD2_XOR_LE(addrp) >> 1); | |
| 723 | *bmpaddr16=((c & 0xf80000) >> 8) | ((c & 0xfc00) >> 5) | ((c & 0xf8) >> 3); | |
| 724 | addrp+=2; | |
| 725 | } | |
| 726 | } | |
| 727 | #endif | |
| 581 | 728 | |
| 582 | for (cs=0;cs < state_ta.testsprites_size;cs++) | |
| 729 | ns=state_ta.grab[rs].testsprites_size; | |
| 730 | for (cs=0;cs < ns;cs++) | |
| 583 | 731 | { |
| 584 | dx=state_ta.showsprites[cs].sizex; | |
| 585 | dy=state_ta.showsprites[cs].sizey; | |
| 586 | iu=state_ta.showsprites[cs].du/dx; | |
| 587 | iv=state_ta.showsprites[cs].dv/dy; | |
| 588 | cd=dilatechose[state_ta.showsprites[cs].texturesizes]; | |
| 732 | dx=state_ta.grab[rs].showsprites[cs].sizex; | |
| 733 | dy=state_ta.grab[rs].showsprites[cs].sizey; | |
| 734 | iu=state_ta.grab[rs].showsprites[cs].du/dx; | |
| 735 | iv=state_ta.grab[rs].showsprites[cs].dv/dy; | |
| 736 | cd=dilatechose[state_ta.grab[rs].showsprites[cs].texturesizes]; | |
| 589 | 737 | |
| 590 | if ((state_ta.showsprites[cs].positionx+dx) > 640) | |
| 591 | dx=640-state_ta.showsprites[cs].positionx; | |
| 592 | if ((state_ta.showsprites[cs].positiony+dy) > 480) | |
| 593 | dy=480-state_ta.showsprites[cs].positiony; | |
| 738 | if ((state_ta.grab[rs].showsprites[cs].positionx+dx) > 640) | |
| 739 | dx=640-state_ta.grab[rs].showsprites[cs].positionx; | |
| 740 | if ((state_ta.grab[rs].showsprites[cs].positiony+dy) > 480) | |
| 741 | dy=480-state_ta.grab[rs].showsprites[cs].positiony; | |
| 594 | 742 | xi=0; |
| 595 | 743 | yi=0; |
| 596 | 744 | |
| 597 | if (state_ta.showsprites[cs].positionx < 0) | |
| 598 | xi=-state_ta.showsprites[cs].positionx; | |
| 599 | if (state_ta.showsprites[cs].positiony < 0) | |
| 600 | yi=-state_ta.showsprites[cs].positiony; | |
| 745 | if (state_ta.grab[rs].showsprites[cs].positionx < 0) | |
| 746 | xi=-state_ta.grab[rs].showsprites[cs].positionx; | |
| 747 | if (state_ta.grab[rs].showsprites[cs].positiony < 0) | |
| 748 | yi=-state_ta.grab[rs].showsprites[cs].positiony; | |
| 601 | 749 | |
| 602 | 750 | for (y = yi;y < dy;y++) |
| 603 | 751 | { |
| 604 | 752 | for (x = xi;x < dx;x++) |
| 605 | 753 | { |
| 606 | 754 | // find the coordinates |
| 607 | u=state_ta.showsprites[cs].u+iu*x; | |
| 608 | v=state_ta.showsprites[cs].v+iv*y; | |
| 609 | yt=v*(state_ta.showsprites[cs].texturesizey-1); | |
| 610 | xt=u*(state_ta.showsprites[cs].texturesizex-1); | |
| 755 | u=state_ta.grab[rs].showsprites[cs].u+iu*x; | |
| 756 | v=state_ta.grab[rs].showsprites[cs].v+iv*y; | |
| 757 | yt=v*(state_ta.grab[rs].showsprites[cs].texturesizey-1); | |
| 758 | xt=u*(state_ta.grab[rs].showsprites[cs].texturesizex-1); | |
| 611 | 759 | |
| 612 | switch (state_ta.showsprites[cs].texturepf) | |
| 760 | a=255; | |
| 761 | switch (state_ta.grab[rs].showsprites[cs].texturepf) | |
| 613 | 762 | { |
| 614 | 763 | case 0: // 1555 |
| 615 | 764 | // find the address |
| 616 | if (state_ta.showsprites[cs].texturemode == 1) | |
| 617 | addrp=state_ta.showsprites[cs].textureaddress+(state_ta.showsprites[cs].texturesizex*yt+xt)*2; | |
| 618 | else if (state_ta.showsprites[cs].texturemode == 0) // twiddled | |
| 619 | addrp=state_ta.showsprites[cs].textureaddress+(dilated1[cd][xt] + dilated0[cd][yt])*2; | |
| 765 | if (state_ta.grab[rs].showsprites[cs].texturemode == 1) | |
| 766 | addrp=state_ta.grab[rs].showsprites[cs].textureaddress+(state_ta.grab[rs].showsprites[cs].texturesizex*yt+xt)*2; | |
| 767 | else if (state_ta.grab[rs].showsprites[cs].texturemode == 0) // twiddled | |
| 768 | addrp=state_ta.grab[rs].showsprites[cs].textureaddress+(dilated1[cd][xt] + dilated0[cd][yt])*2; | |
| 620 | 769 | else // vq-compressed |
| 621 | 770 | { |
| 622 | 771 | c=0x800+(dilated1[cd][xt >> 1] + dilated0[cd][yt >> 1]); |
| 623 | c=*(((UINT8 *)dc_texture_ram) + BYTE_XOR_LE(state_ta.showsprites[cs].textureaddress+c)); | |
| 624 | addrp=state_ta.showsprites[cs].textureaddress+c*8+(dilated1[cd][xt & 1] + dilated0[cd][yt & 1])*2; | |
| 772 | c=*(((UINT8 *)dc_texture_ram) + BYTE_XOR_LE(state_ta.grab[rs].showsprites[cs].textureaddress+c)); | |
| 773 | addrp=state_ta.grab[rs].showsprites[cs].textureaddress+c*8+(dilated1[cd][xt & 1] + dilated0[cd][yt & 1])*2; | |
| 625 | 774 | } |
| 626 | 775 | // read datum |
| 627 | 776 | c=*(((UINT16 *)dc_texture_ram) + (WORD2_XOR_LE(addrp) >> 1)); |
| 628 | 777 | // find the color and draw |
| 629 | 778 | a=(((c & 0x8000) >> 8)*255)/0x80; |
| 630 | bmpaddr=BITMAP_ADDR32(bitmap,state_ta.showsprites[cs].positiony+y,state_ta.showsprites[cs].positionx+x); | |
| 631 | *bmpaddr = alpha_blend_r32(*bmpaddr, MAKE_RGB((c&0x7c00) >> 7, (c&0x3e0) >> 2, (c&0x1f) << 3), a); | |
| 779 | c=MAKE_RGB((c&0x7c00) >> 7, (c&0x3e0) >> 2, (c&0x1f) << 3); | |
| 632 | 780 | break; |
| 633 | 781 | case 1: // 565 |
| 634 | 782 | // find the address |
| 635 | if (state_ta.showsprites[cs].texturemode == 1) | |
| 636 | addrp=state_ta.showsprites[cs].textureaddress+(state_ta.showsprites[cs].texturesizex*yt+xt)*2; | |
| 637 | else if (state_ta.showsprites[cs].texturemode == 0) // twiddled | |
| 638 | addrp=state_ta.showsprites[cs].textureaddress+(dilated1[cd][xt] + dilated0[cd][yt])*2; | |
| 783 | if (state_ta.grab[rs].showsprites[cs].texturemode == 1) | |
| 784 | addrp=state_ta.grab[rs].showsprites[cs].textureaddress+(state_ta.grab[rs].showsprites[cs].texturesizex*yt+xt)*2; | |
| 785 | else if (state_ta.grab[rs].showsprites[cs].texturemode == 0) // twiddled | |
| 786 | addrp=state_ta.grab[rs].showsprites[cs].textureaddress+(dilated1[cd][xt] + dilated0[cd][yt])*2; | |
| 639 | 787 | else // vq-compressed |
| 640 | 788 | { |
| 641 | 789 | c=0x800+(dilated1[cd][xt >> 1] + dilated0[cd][yt >> 1]); |
| 642 | c=*(((UINT8 *)dc_texture_ram) + BYTE_XOR_LE(state_ta.showsprites[cs].textureaddress+c)); | |
| 643 | addrp=state_ta.showsprites[cs].textureaddress+c*8+(dilated1[cd][xt & 1] + dilated0[cd][yt & 1])*2; | |
| 790 | c=*(((UINT8 *)dc_texture_ram) + BYTE_XOR_LE(state_ta.grab[rs].showsprites[cs].textureaddress+c)); | |
| 791 | addrp=state_ta.grab[rs].showsprites[cs].textureaddress+c*8+(dilated1[cd][xt & 1] + dilated0[cd][yt & 1])*2; | |
| 644 | 792 | } |
| 645 | 793 | // read datum |
| 646 | 794 | c=*(((UINT16 *)dc_texture_ram) + (WORD2_XOR_LE(addrp) >> 1)); |
| 647 | 795 | // find the color and draw |
| 648 | bmpaddr=BITMAP_ADDR32(bitmap,state_ta.showsprites[cs].positiony+y,state_ta.showsprites[cs].positionx+x); | |
| 649 | *bmpaddr = alpha_blend_r32(*bmpaddr, MAKE_RGB((c&0xf800) >> 8, (c&0x7e0) >> 3, (c&0x1f) << 3), 255); | |
| 796 | a=255; | |
| 797 | c=MAKE_RGB((c&0xf800) >> 8, (c&0x7e0) >> 3, (c&0x1f) << 3); | |
| 650 | 798 | break; |
| 651 | 799 | case 2: // 4444 |
| 652 | 800 | // find the address |
| 653 | if (state_ta.showsprites[cs].texturemode == 1) | |
| 654 | addrp=state_ta.showsprites[cs].textureaddress+(state_ta.showsprites[cs].texturesizex*yt+xt)*2; | |
| 655 | else if (state_ta.showsprites[cs].texturemode == 0) // twiddled | |
| 656 | addrp=state_ta.showsprites[cs].textureaddress+(dilated1[cd][xt] + dilated0[cd][yt])*2; | |
| 801 | if (state_ta.grab[rs].showsprites[cs].texturemode == 1) | |
| 802 | addrp=state_ta.grab[rs].showsprites[cs].textureaddress+(state_ta.grab[rs].showsprites[cs].texturesizex*yt+xt)*2; | |
| 803 | else if (state_ta.grab[rs].showsprites[cs].texturemode == 0) // twiddled | |
| 804 | addrp=state_ta.grab[rs].showsprites[cs].textureaddress+(dilated1[cd][xt] + dilated0[cd][yt])*2; | |
| 657 | 805 | else // vq-compressed |
| 658 | 806 | { |
| 659 | 807 | c=0x800+(dilated1[cd][xt >> 1] + dilated0[cd][yt >> 1]); |
| 660 | c=*(((UINT8 *)dc_texture_ram) + BYTE_XOR_LE(state_ta.showsprites[cs].textureaddress+c)); | |
| 661 | addrp=state_ta.showsprites[cs].textureaddress+c*8+(dilated1[cd][xt & 1] + dilated0[cd][yt & 1])*2; | |
| 808 | c=*(((UINT8 *)dc_texture_ram) + BYTE_XOR_LE(state_ta.grab[rs].showsprites[cs].textureaddress+c)); | |
| 809 | addrp=state_ta.grab[rs].showsprites[cs].textureaddress+c*8+(dilated1[cd][xt & 1] + dilated0[cd][yt & 1])*2; | |
| 662 | 810 | } |
| 663 | 811 | // read datum |
| 664 | 812 | c=*(((UINT16 *)dc_texture_ram) + (WORD2_XOR_LE(addrp) >> 1)); |
| 665 | 813 | // find the color and draw |
| 666 | 814 | a=(((c & 0xf000) >> 8)*255)/0xf0; |
| 667 | bmpaddr=BITMAP_ADDR32(bitmap,state_ta.showsprites[cs].positiony+y,state_ta.showsprites[cs].positionx+x); | |
| 668 | *bmpaddr = alpha_blend_r32(*bmpaddr, MAKE_RGB((c&0xf00) >> 4, c&0xf0, (c&0xf) << 4), a); | |
| 815 | c=MAKE_RGB((c&0xf00) >> 4, c&0xf0, (c&0xf) << 4); | |
| 669 | 816 | break; |
| 670 | 817 | case 3: // yuv422 |
| 671 | 818 | break; |
| r3333 | r3334 | |
| 674 | 821 | case 5: // 4 bpp palette |
| 675 | 822 | break; |
| 676 | 823 | case 6: // 8 bpp palette |
| 677 | if (state_ta.showsprites[cs].texturemode & 2) // vq-compressed | |
| 824 | if (state_ta.grab[rs].showsprites[cs].texturemode & 2) // vq-compressed | |
| 678 | 825 | { |
| 679 | 826 | c=0x800+(dilated1[cd][xt >> 1] + dilated0[cd][yt >> 2]); |
| 680 | c=*(((UINT8 *)dc_texture_ram) + BYTE_XOR_LE(state_ta.showsprites[cs].textureaddress+c)); | |
| 681 | addrp=state_ta.showsprites[cs].textureaddress+c*8+(dilated1[cd][xt & 1] + dilated0[cd][yt & 3]); | |
| 827 | c=*(((UINT8 *)dc_texture_ram) + BYTE_XOR_LE(state_ta.grab[rs].showsprites[cs].textureaddress+c)); | |
| 828 | addrp=state_ta.grab[rs].showsprites[cs].textureaddress+c*8+(dilated1[cd][xt & 1] + dilated0[cd][yt & 3]); | |
| 682 | 829 | } |
| 683 | 830 | else |
| 684 | 831 | { |
| 685 | addrp=state_ta.showsprites[cs].textureaddress+(dilated1[cd][xt] + dilated0[cd][yt]); | |
| 832 | addrp=state_ta.grab[rs].showsprites[cs].textureaddress+(dilated1[cd][xt] + dilated0[cd][yt]); | |
| 686 | 833 | } |
| 687 | 834 | c=*(((UINT8 *)dc_texture_ram) + BYTE_XOR_LE(addrp)); |
| 688 | c=((state_ta.showsprites[cs].texturepalette & 0x30) << 4) | c; | |
| 835 | c=((state_ta.grab[rs].showsprites[cs].texturepalette & 0x30) << 4) | c; | |
| 689 | 836 | c=pvrta_regs[0x1000/4+c]; |
| 690 | 837 | switch (pvrta_regs[PAL_RAM_CTRL]) |
| 691 | 838 | { |
| 692 | 839 | case 0: // argb1555 |
| 693 | 840 | a=(((c & 0x8000) >> 8)*255)/0x80; |
| 694 | bmpaddr=BITMAP_ADDR32(bitmap,state_ta.showsprites[cs].positiony+y,state_ta.showsprites[cs].positionx+x); | |
| 695 | *bmpaddr = alpha_blend_r32(*bmpaddr, MAKE_RGB((c&0x7c00) >> 7, (c&0x3e0) >> 2, (c&0x1f) << 3), a); | |
| 841 | c=MAKE_RGB((c&0x7c00) >> 7, (c&0x3e0) >> 2, (c&0x1f) << 3); | |
| 696 | 842 | break; |
| 697 | 843 | case 1: // rgb565 |
| 698 | bmpaddr=BITMAP_ADDR32(bitmap,state_ta.showsprites[cs].positiony+y,state_ta.showsprites[cs].positionx+x); | |
| 699 | *bmpaddr = alpha_blend_r32(*bmpaddr, MAKE_RGB((c&0xf800) >> 8, (c&0x7e0) >> 3, (c&0x1f) << 3), 255); | |
| 844 | a=255; | |
| 845 | c=MAKE_RGB((c&0xf800) >> 8, (c&0x7e0) >> 3, (c&0x1f) << 3); | |
| 700 | 846 | break; |
| 701 | 847 | case 2: // argb4444 |
| 702 | 848 | a=(((c & 0xf000) >> 8)*255)/0xf0; |
| 703 | bmpaddr=BITMAP_ADDR32(bitmap,state_ta.showsprites[cs].positiony+y,state_ta.showsprites[cs].positionx+x); | |
| 704 | *bmpaddr = alpha_blend_r32(*bmpaddr, MAKE_RGB((c&0xf00) >> 4, c&0xf0, (c&0xf) << 4), a); | |
| 849 | c=MAKE_RGB((c&0xf00) >> 4, c&0xf0, (c&0xf) << 4); | |
| 705 | 850 | break; |
| 706 | 851 | case 3: // argb8888 |
| 707 | 852 | a=(c & 0xff000000) >> 24; |
| 708 | bmpaddr=BITMAP_ADDR32(bitmap,state_ta.showsprites[cs].positiony+y,state_ta.showsprites[cs].positionx+x); | |
| 709 | *bmpaddr = alpha_blend_r32(*bmpaddr, MAKE_RGB((c&0xff0000) >> 16, (c&0xff00) >> 8, c&0xff), a); | |
| 853 | c=MAKE_RGB((c&0xff0000) >> 16, (c&0xff00) >> 8, c&0xff); | |
| 710 | 854 | break; |
| 711 | 855 | } |
| 712 | 856 | break; |
| 713 | 857 | case 7: // reserved |
| 714 | 858 | break; |
| 715 | } | |
| 859 | } // switch | |
| 860 | bmpaddr=BITMAP_ADDR32(bitmap,state_ta.grab[rs].showsprites[cs].positiony+y,state_ta.grab[rs].showsprites[cs].positionx+x); | |
| 861 | *bmpaddr = alpha_blend_r32(*bmpaddr, c, a); | |
| 862 | #if 0 | |
| 863 | // write into framebuffer | |
| 864 | switch (pvrta_regs[FB_W_CTRL] & 7) | |
| 865 | { | |
| 866 | case 0: // 0555 KRGB 16 bit | |
| 867 | k=pvrta_regs[FB_W_CTRL] & 0x8000; | |
| 868 | addrp=state_ta.grab[s].fbwsof1+(state_ta.grab[s].showsprites[cs].positiony+y)*stride+(state_ta.grab[s].showsprites[cs].positionx+x)*2; | |
| 869 | bmpaddr16=((UINT16 *)dc_texture_ram) + (WORD2_XOR_LE(addrp) >> 1); | |
| 870 | *bmpaddr16=k | alpha_blend_r16(*bmpaddr16,((c & 0xf80000) >> 9) | ((c & 0xf800) >> 6) | ((c & 0xf8) >> 3),a); | |
| 871 | break; | |
| 872 | case 1: // 565 RGB 16 bit | |
| 873 | addrp=state_ta.grab[rs].fbwsof1+(state_ta.grab[rs].showsprites[cs].positiony+y)*stride+(state_ta.grab[rs].showsprites[cs].positionx+x)*2; | |
| 874 | bmpaddr16=((UINT16 *)dc_texture_ram) + (WORD2_XOR_LE(addrp) >> 1); | |
| 875 | //*bmpaddr16=alpha_blend_r16_565(*bmpaddr16,((c & 0xf80000) >> 8) | ((c & 0xfc00) >> 5) | ((c & 0xf8) >> 3),a); | |
| 876 | *bmpaddr16=((c & 0xf80000) >> 8) | ((c & 0xfc00) >> 5) | ((c & 0xf8) >> 3); | |
| 877 | break; | |
| 878 | case 2: // 4444 ARGB 16 bit | |
| 879 | break; | |
| 880 | case 3: // 1555 ARGB 16 bit | |
| 881 | break; | |
| 882 | case 4: // 888 RGB 24 bit packed | |
| 883 | break; | |
| 884 | case 5: // 0888 KRGB 32 bit | |
| 885 | break; | |
| 886 | case 6: // 8888 ARGB 32 bit | |
| 887 | break; | |
| 888 | case 7: // reserved | |
| 889 | break; | |
| 890 | } // switch | |
| 891 | #endif | |
| 716 | 892 | } |
| 717 | 893 | } |
| 718 | 894 | } |
| 895 | state_ta.grab[rs].busy=0; | |
| 719 | 896 | #if DEBUG_VERTICES |
| 720 | xi = yi = -1; | |
| 721 | a = state_ta.testvertices_size; | |
| 722 | if (a > 65535) | |
| 723 | a = 65535; | |
| 724 | for (cs=0;cs < a;cs++) | |
| 897 | a = state_ta.grab[rs].testvertices_size; | |
| 898 | if (a > 65530) | |
| 899 | a = 65530; | |
| 900 | for (cs=1;cs < a;cs++) | |
| 725 | 901 | { |
| 726 | xi=yi; | |
| 727 | yi=cs; | |
| 728 | if (xi >= 0) | |
| 729 | testdrawline(bitmap,xi,yi); // draw a segment from vertex xi to vertex yi | |
| 730 | if (state_ta.showvertices[cs].endofstrip == 1) | |
| 731 | xi = yi = -1; | |
| 902 | testdrawline(bitmap,rs,cs-1,cs); // draw a segment from vertex xi to vertex yi | |
| 903 | if ((cs > 1) && (state_ta.grab[rs].showvertices[cs-2].endofstrip == 0)) | |
| 904 | testdrawline(bitmap,rs,cs-2,cs); | |
| 905 | if (state_ta.grab[rs].showvertices[cs].endofstrip == 1) | |
| 906 | cs++; | |
| 732 | 907 | } |
| 733 | 908 | #endif |
| 734 | 909 | } |
| 910 | ||
| 911 | static void testdrawscreenframebuffer(bitmap_t *bitmap,const rectangle *cliprect) | |
| 912 | { | |
| 913 | int x,y,dy,xi; | |
| 914 | UINT32 addrp; | |
| 915 | UINT16 *fbaddr; | |
| 916 | UINT32 c; | |
| 917 | ||
| 918 | // only for rgb565 framebuffer | |
| 919 | xi=((pvrta_regs[FB_R_SIZE] & 0x3ff)+1) << 1; | |
| 920 | dy=((pvrta_regs[FB_R_SIZE] >> 10) & 0x3ff)+1; | |
| 921 | for (y=0;y < dy;y++) | |
| 922 | { | |
| 923 | addrp=pvrta_regs[FB_R_SOF1]+y*xi*2; | |
| 924 | for (x=0;x < xi;x++) | |
| 925 | { | |
| 926 | fbaddr=BITMAP_ADDR16(bitmap,y,x); | |
| 927 | c=*(((UINT16 *)dc_texture_ram) + (WORD2_XOR_LE(addrp) >> 1)); | |
| 928 | *fbaddr = (UINT16)c; | |
| 929 | addrp+=2; | |
| 930 | } | |
| 931 | } | |
| 932 | } | |
| 735 | 933 | /* test video end */ |
| 736 | 934 | |
| 737 | 935 | static void pvr_build_parameterconfig(void) |
| r3333 | r3334 | |
| 776 | 974 | { |
| 777 | 975 | memset(pvrctrl_regs, 0, sizeof(pvrctrl_regs)); |
| 778 | 976 | memset(pvrta_regs, 0, sizeof(pvrta_regs)); |
| 977 | memset(state_ta.grab, 0, sizeof(state_ta.grab)); | |
| 779 | 978 | pvr_build_parameterconfig(); |
| 780 | 979 | |
| 781 | 980 | // if the next 2 registers do not have the correct values, the naomi bios will hang |
| r3333 | r3334 | |
| 788 | 987 | state_ta.tafifo_vertexwords=8; |
| 789 | 988 | state_ta.tafifo_listtype= -1; |
| 790 | 989 | state_ta.start_render_received=0; |
| 990 | state_ta.renderselect= -1; | |
| 991 | state_ta.grabsel=0; | |
| 791 | 992 | |
| 792 | state_ta.testsprites_size=0; | |
| 793 | state_ta.toerasesprites=0; | |
| 794 | state_ta.testvertices_size=0; | |
| 795 | 993 | computedilated(); |
| 796 | 994 | |
| 797 | 995 | vbout_timer = timer_alloc(vbout, 0); |
| r3333 | r3334 | |
| 800 | 998 | |
| 801 | 999 | VIDEO_UPDATE(dc) |
| 802 | 1000 | { |
| 1001 | static int useframebuffer=1; | |
| 1002 | ||
| 803 | 1003 | if (pvrta_regs[VO_CONTROL] & (1 << 3)) |
| 804 | 1004 | { |
| 805 | 1005 | fillbitmap(bitmap,pvrta_regs[VO_BORDER_COL] & 0xFFFFFF,cliprect); |
| 806 | 1006 | return 0; |
| 807 | 1007 | } |
| 808 | 1008 | |
| 809 | testdrawscreen(bitmap,cliprect); | |
| 1009 | if ((useframebuffer) && !state_ta.start_render_received) | |
| 1010 | { | |
| 1011 | testdrawscreenframebuffer(bitmap,cliprect); | |
| 1012 | return 0; | |
| 1013 | } | |
| 810 | 1014 | |
| 811 | 1015 | if (state_ta.start_render_received) |
| 812 | 1016 | { |
| 1017 | useframebuffer=0; | |
| 1018 | testdrawscreen(bitmap,cliprect); | |
| 813 | 1019 | state_ta.start_render_received=0; |
| 1020 | state_ta.renderselect= -1; | |
| 814 | 1021 | dc_sysctrl_regs[SB_ISTNRM] |= IST_EOR_TSP; // TSP end of render |
| 815 | 1022 | update_interrupt_status(); |
| 1023 | return 0; | |
| 816 | 1024 | } |
| 817 | return 0; | |
| 1025 | else | |
| 1026 | return 1; | |
| 818 | 1027 | } |
| 819 | 1028 | |
| 820 | 1029 | void dc_vblank(running_machine *machine) |
| r3333 | r3334 | |
|---|---|---|
| 169 | 169 | return WAVERAM_BLOCK1(blocknum); |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | #ifdef UNUSED_FUNCTON | |
| 172 | #ifdef UNUSED_FUNCTION | |
| 173 | 173 | INLINE void *waveram0_ptr_from_texture_addr(UINT32 addr, int width) |
| 174 | 174 | { |
| 175 | 175 | UINT32 blocknum = ((addr & ~1) * width) / 8; |
| r3333 | r3334 | |
| 184 | 184 | * |
| 185 | 185 | *************************************/ |
| 186 | 186 | |
| 187 | #ifdef UNUSED_FUNCTON | |
| 187 | #ifdef UNUSED_FUNCTION | |
| 188 | 188 | INLINE void waveram_plot(int y, int x, UINT32 color) |
| 189 | 189 | { |
| 190 | 190 | if (x >= 0 && x <= zeus_cliprect.max_x && y >= 0 && y < zeus_cliprect.max_y) |
| r3333 | r3334 | |
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | #ifdef UNUSED_FUNCTON | |
| 204 | #ifdef UNUSED_FUNCTION | |
| 205 | 205 | INLINE void waveram_plot_check_depth(int y, int x, UINT32 color, UINT16 depth) |
| 206 | 206 | { |
| 207 | 207 | if (x >= 0 && x <= zeus_cliprect.max_x && y >= 0 && y < zeus_cliprect.max_y) |
| r3333 | r3334 | |
| 216 | 216 | } |
| 217 | 217 | #endif |
| 218 | 218 | |
| 219 | #ifdef UNUSED_FUNCTON | |
| 219 | #ifdef UNUSED_FUNCTION | |
| 220 | 220 | INLINE void waveram_plot_check_depth_nowrite(int y, int x, UINT32 color, UINT16 depth) |
| 221 | 221 | { |
| 222 | 222 | if (x >= 0 && x <= zeus_cliprect.max_x && y >= 0 && y < zeus_cliprect.max_y) |
| r3333 | r3334 | |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | |
| 245 | #ifdef UNUSED_FUNCTON | |
| 245 | #ifdef UNUSED_FUNCTION | |
| 246 | 246 | INLINE UINT8 get_texel_4bit(const void *base, int y, int x, int width) |
| 247 | 247 | { |
| 248 | 248 | UINT32 byteoffs = (y / 2) * (width * 2) + ((x / 8) << 3) + ((y & 1) << 2) + ((x / 2) & 3); |
| r3333 | r3334 | |
|---|---|---|
| 68 | 68 | static tilemap *esdtilemap_0; |
| 69 | 69 | static tilemap *esdtilemap_1; |
| 70 | 70 | tilemap *esdtilemap_1_16x16; |
| 71 | tilemap *esdtilemap_0_16x16; | |
| 71 | static tilemap *esdtilemap_0_16x16; | |
| 72 | 72 | |
| 73 | 73 | static TILE_GET_INFO( get_tile_info_0 ) |
| 74 | 74 | { |
| r3333 | r3334 | |
|---|---|---|
| 739 | 739 | } |
| 740 | 740 | } |
| 741 | 741 | |
| 742 | #ifdef UNUSED_FUNCTON | |
| 742 | #ifdef UNUSED_FUNCTION | |
| 743 | 743 | INLINE void write_texture8(int xpos, int ypos, int width, int height, int page, UINT16 *data) |
| 744 | 744 | { |
| 745 | 745 | int x,y,i,j; |
| r3333 | r3334 | |
| 916 | 916 | /*****************************************************************************/ |
| 917 | 917 | /* matrix and vector operations */ |
| 918 | 918 | |
| 919 | #ifdef UNUSED_FUNCTON | |
| 919 | #ifdef UNUSED_FUNCTION | |
| 920 | 920 | INLINE float dot_product(VECTOR a, VECTOR b) |
| 921 | 921 | { |
| 922 | 922 | return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]); |
| r3333 | r3334 | |
|---|---|---|
| 162 | 162 | two. |
| 163 | 163 | ---------------------------------------------------------------*/ |
| 164 | 164 | |
| 165 | #ifdef UNUSED_FUNCTON | |
| 165 | #ifdef UNUSED_FUNCTION | |
| 166 | 166 | INLINE int compute_log(int value) |
| 167 | 167 | { |
| 168 | 168 | int log = 0; |
| r3333 | r3334 | |
| 201 | 201 | value into the result, packing the bits along the way. |
| 202 | 202 | ---------------------------------------------------------------*/ |
| 203 | 203 | |
| 204 | #ifdef UNUSED_FUNCTON | |
| 204 | #ifdef UNUSED_FUNCTION | |
| 205 | 205 | INLINE int collapse_bits(int value, int mask) |
| 206 | 206 | { |
| 207 | 207 | int testmask, ormask; |
| r3333 | r3334 | |
|---|---|---|
| 1217 | 1217 | * |
| 1218 | 1218 | ************************************/ |
| 1219 | 1219 | |
| 1220 | #ifdef UNUSED_FUNCTION | |
| 1220 | 1221 | int avgdvg_done(void) |
| 1221 | 1222 | { |
| 1222 | 1223 | return vg->sync_halt; |
| 1223 | 1224 | } |
| 1225 | #endif | |
| 1224 | 1226 | |
| 1225 | 1227 | CUSTOM_INPUT( avgdvg_done_r ) |
| 1226 | 1228 | { |
| r3333 | r3334 | |
|---|---|---|
| 3 | 3 | Tatsumi TX-1/Buggy Boy video hardware |
| 4 | 4 | |
| 5 | 5 | ****************************************************************************/ |
| 6 | ||
| 6 | 7 | #include "driver.h" |
| 7 | 8 | #include "profiler.h" |
| 8 | 9 | #include "render.h" |
| 9 | 10 | #include "cpu/i86/i86.h" |
| 11 | #include "video/resnet.h" | |
| 10 | 12 | #include "tx1.h" |
| 11 | 13 | |
| 12 | #define PRINT_CRTC_DATA 1 | |
| 13 | 14 | |
| 14 | /* | |
| 15 | HD46505S-2 CRT Controller | |
| 16 | */ | |
| 15 | /************************************* | |
| 16 | * | |
| 17 | * HD46505S-2 CRT Controller | |
| 18 | * | |
| 19 | *************************************/ | |
| 20 | ||
| 21 | #define PRINT_CRTC_DATA 0 | |
| 22 | ||
| 17 | 23 | READ16_HANDLER( tx1_crtc_r ) |
| 18 | 24 | { |
| 19 | 25 | return 0xffff; |
| r3333 | r3334 | |
| 35 | 41 | case 0x04: mame_printf_debug("Vertical total "); break; |
| 36 | 42 | case 0x05: mame_printf_debug("Vertical total adjust "); break; |
| 37 | 43 | case 0x06: mame_printf_debug("Vertical displayed "); break; |
| 38 | case 0x07: mame_printf_debug("Vertical sync position "); break; | |
| 39 | case 0x08: mame_printf_debug("Interlace mode "); break; | |
| 40 | case 0x09: mame_printf_debug("Max. scan line address "); break; | |
| 41 | case 0x0a: mame_printf_debug("Cursror start "); break; | |
| 42 | case 0x0b: mame_printf_debug("Cursor end "); break; | |
| 43 | case 0x0c: mame_printf_debug("Start address (h) "); break; | |
| 44 | case 0x0d: mame_printf_debug("Start address (l) "); break; | |
| 45 | case 0x0e: mame_printf_debug("Cursor (h) "); break; | |
| 46 | case 0x0f: mame_printf_debug("Cursor (l) "); break; | |
| 47 | case 0x10: mame_printf_debug("Light pen (h)) "); break; | |
| 48 | case 0x11: mame_printf_debug("Light pen (l) "); break; | |
| 44 | case 0x07: mame_printf_debug("Vertical sync position "); break; | |
| 45 | case 0x08: mame_printf_debug("Interlace mode "); break; | |
| 46 | case 0x09: mame_printf_debug("Max. scan line address "); break; | |
| 47 | case 0x0a: mame_printf_debug("Cursror start "); break; | |
| 48 | case 0x0b: mame_printf_debug("Cursor end "); break; | |
| 49 | case 0x0c: mame_printf_debug("Start address (h) "); break; | |
| 50 | case 0x0d: mame_printf_debug("Start address (l) "); break; | |
| 51 | case 0x0e: mame_printf_debug("Cursor (h) "); break; | |
| 52 | case 0x0f: mame_printf_debug("Cursor (l) "); break; | |
| 53 | case 0x10: mame_printf_debug("Light pen (h)) "); break; | |
| 54 | case 0x11: mame_printf_debug("Light pen (l) "); break; | |
| 49 | 55 | } |
| 50 | 56 | } |
| 51 | 57 | else if (offset == 1) |
| r3333 | r3334 | |
| 61 | 67 | TX-1 |
| 62 | 68 | |
| 63 | 69 | ***************************************************************************/ |
| 70 | ||
| 71 | enum | |
| 72 | { | |
| 73 | TX1_RDFLAG_RVA8 = 0, | |
| 74 | TX1_RDFLAG_RVA9, | |
| 75 | TX1_RDFLAG_RVA7, | |
| 76 | TX1_RDFLAG_TNLF, | |
| 77 | TX1_RDFLAG_STLF, | |
| 78 | TX1_RDFLAG_SCCHGF | |
| 79 | } tx1_roadreg; | |
| 80 | ||
| 64 | 81 | static struct |
| 65 | 82 | { |
| 66 | 83 | UINT16 scol; /* Road colours */ |
| r3333 | r3334 | |
| 69 | 86 | |
| 70 | 87 | UINT32 ba_val; /* Accumulator */ |
| 71 | 88 | UINT32 ba_inc; |
| 89 | UINT32 bank_mode; | |
| 72 | 90 | |
| 73 | 91 | UINT16 h_val; /* Accumulator */ |
| 74 | 92 | UINT16 h_inc; |
| r3333 | r3334 | |
| 77 | 95 | UINT8 slin_inc; |
| 78 | 96 | } tx1_vregs; |
| 79 | 97 | |
| 80 | /* Offsets into the palette PROMs */ | |
| 81 | #define TX1_COLORS_CHAR 0x00 | |
| 82 | #define TX1_COLORS_OBJ 0x80 | |
| 83 | #define TX1_COLORS_ROAD 0xC0 | |
| 84 | ||
| 85 | 98 | UINT16 *tx1_vram; |
| 86 | 99 | UINT16 *tx1_objram; |
| 87 | 100 | UINT16 *tx1_rcram; |
| 88 | 101 | size_t tx1_objram_size; |
| 89 | 102 | |
| 90 | static tilemap *tx1_tilemap; | |
| 103 | static UINT8 *tx1_chr_bmp; | |
| 104 | static UINT8 *tx1_obj_bmp; | |
| 105 | static UINT8 *tx1_rod_bmp; | |
| 106 | ||
| 91 | 107 | static bitmap_t *tx1_bitmap; |
| 92 | 108 | static render_texture *tx1_texture; |
| 93 | 109 | |
| 94 | WRITE16_HANDLER( tx1_vram_w ) | |
| 95 | { | |
| 96 | COMBINE_DATA(&tx1_vram[offset]); | |
| 97 | tilemap_mark_tile_dirty(tx1_tilemap, offset); | |
| 98 | } | |
| 99 | 110 | |
| 100 | static TILE_GET_INFO( get_tx1_tile_info ) | |
| 101 | { | |
| 102 | int tilenum, color; | |
| 103 | ||
| 104 | color = (tx1_vram[tile_index] >> 10) & 0x3f; | |
| 105 | tilenum = (tx1_vram[tile_index]&0x03ff) | ((tx1_vram[tile_index] & 0x8000) >> 5); | |
| 106 | ||
| 107 | SET_TILE_INFO(0, tilenum, color, 0); | |
| 108 | } | |
| 109 | ||
| 110 | 111 | /*************************************************************************** |
| 111 | 112 | |
| 112 | 113 | Palette initialisation |
| 113 | 114 | |
| 114 | TODO: Add some notes | |
| 115 | ||
| 116 | 115 | bit 3 -- 220 ohm resistor -- RED/GREEN/BLUE |
| 117 | 116 | -- 470 ohm resistor -- RED/GREEN/BLUE |
| 118 | 117 | -- 1.0kohm resistor -- RED/GREEN/BLUE |
| 119 | 118 | bit 0 -- 2.2kohm resistor -- RED/GREEN/BLUE |
| 120 | 119 | |
| 121 | 120 | ***************************************************************************/ |
| 121 | ||
| 122 | 122 | PALETTE_INIT( tx1 ) |
| 123 | 123 | { |
| 124 | 124 | int i; |
| 125 | 125 | |
| 126 | /* allocate the colortable */ | |
| 127 | machine->colortable = colortable_alloc(machine, 0x100); | |
| 126 | static const res_net_info tx1_net_info = | |
| 127 | { | |
| 128 | RES_NET_VCC_5V | RES_NET_VIN_TTL_OUT, | |
| 129 | { | |
| 130 | { RES_NET_AMP_NONE, 0, 0, 4, { 2200, 1000, 470, 220 } }, | |
| 131 | { RES_NET_AMP_NONE, 0, 0, 4, { 2200, 1000, 470, 220 } }, | |
| 132 | { RES_NET_AMP_NONE, 0, 0, 4, { 2200, 1000, 470, 220 } } | |
| 133 | } | |
| 134 | }; | |
| 128 | 135 | |
| 129 | /* create a lookup table for the palette */ | |
| 130 | for (i = 0; i < 0x100; i++) | |
| 136 | for (i = 0; i < 256; ++i) | |
| 131 | 137 | { |
| 132 | int r = pal4bit(color_prom[i + 0x000]); | |
| 133 | int g = pal4bit(color_prom[i + 0x100]); | |
| 134 | int b = pal4bit(color_prom[i + 0x200]); | |
| 138 | int r, g, b; | |
| 135 | 139 | |
| 136 | colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b)); | |
| 137 | } | |
| 140 | r = compute_res_net(color_prom[i + 0x300] & 0xf, 0, &tx1_net_info); | |
| 141 | g = compute_res_net(color_prom[i + 0x400] & 0xf, 1, &tx1_net_info); | |
| 142 | b = compute_res_net(color_prom[i + 0x500] & 0xf, 2, &tx1_net_info); | |
| 138 | 143 | |
| 139 | /* color_prom now points to the beginning of the lookup table */ | |
| 140 | color_prom += 0x300; | |
| 141 | ||
| 142 | /* TODO */ | |
| 143 | for (i = 0; i < 0x100; i++) | |
| 144 | { | |
| 145 | UINT8 ctabentry = (color_prom[i + 0x600] & 0x0f) | 0x00; | |
| 146 | colortable_entry_set_value(machine->colortable, i, ctabentry); | |
| 144 | palette_set_color(machine, i, MAKE_RGB(r, g, b)); | |
| 147 | 145 | } |
| 148 | 146 | } |
| 149 | 147 | |
| 148 | ||
| 149 | /************************************* | |
| 150 | * | |
| 151 | * Video Control Registers | |
| 152 | * | |
| 153 | *************************************/ | |
| 154 | ||
| 150 | 155 | WRITE16_HANDLER( tx1_bankcs_w ) |
| 151 | 156 | { |
| 152 | 157 | // AAB2 = /BASET0 |
| r3333 | r3334 | |
| 171 | 176 | tx1_vregs.ba_inc &= ~0xffff0000; |
| 172 | 177 | tx1_vregs.ba_inc |= data << 16; |
| 173 | 178 | |
| 179 | // TODO: Schems say D15. | |
| 180 | tx1_vregs.bank_mode = BIT(data, 1); | |
| 181 | ||
| 174 | 182 | if ( !(offset & 2) ) |
| 175 | 183 | tx1_vregs.ba_val &= ~0xffff0000; |
| 176 | 184 | } |
| 177 | if ( offset & 0x10 ) | |
| 185 | if ( !(offset & 0x10) ) | |
| 178 | 186 | { |
| 179 | 187 | /* Ignore data */ |
| 180 | 188 | if ( offset & 2 ) |
| 181 | { | |
| 182 | 189 | tx1_vregs.ba_val = (tx1_vregs.ba_inc + tx1_vregs.ba_val) & 0x00ffffff; |
| 183 | } | |
| 184 | 190 | } |
| 185 | 191 | if ( offset & 0x20 ) |
| 186 | 192 | { |
| r3333 | r3334 | |
| 191 | 197 | } |
| 192 | 198 | if ( !(offset & 0x40) ) |
| 193 | 199 | { |
| 194 | /* Ignore data? */ | |
| 195 | if ( offset & 2 ) | |
| 200 | /* TODO: Looks safe to remove this */ | |
| 201 | // if ( offset & 2 ) | |
| 196 | 202 | tx1_vregs.h_val += tx1_vregs.h_inc; |
| 197 | 203 | } |
| 198 | 204 | } |
| r3333 | r3334 | |
| 221 | 227 | } |
| 222 | 228 | |
| 223 | 229 | |
| 224 | /* Preliminary */ | |
| 225 | static void tx1_draw_objects(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) | |
| 230 | /************************************* | |
| 231 | * | |
| 232 | * Characters | |
| 233 | * | |
| 234 | *************************************/ | |
| 235 | ||
| 236 | static void tx1_draw_char(running_machine *machine, UINT8 *bitmap) | |
| 226 | 237 | { |
| 238 | INT32 x, y; | |
| 239 | UINT32 scroll_x; | |
| 240 | UINT8 *gfx1, *gfx2; | |
| 241 | ||
| 242 | /* 2bpp characters */ | |
| 243 | gfx1 = memory_region(machine, "gfx1"); | |
| 244 | gfx2 = gfx1 + 0x4000; | |
| 245 | ||
| 246 | /* X scroll value is the last word in char RAM */ | |
| 247 | scroll_x = tx1_vram[0xfff] & 0x3ff; | |
| 248 | ||
| 249 | for (y = 0; y < 240; ++y) | |
| 250 | { | |
| 251 | UINT32 d0 = 0, d1 = 0; | |
| 252 | UINT32 colour = 0; | |
| 253 | UINT32 y_offs; | |
| 254 | UINT32 x_offs; | |
| 255 | UINT32 y_gran; | |
| 256 | ||
| 257 | /* No y-scrolling? */ | |
| 258 | y_offs = y; | |
| 259 | ||
| 260 | if ( (y_offs >= 64) && (y_offs < 128) ) | |
| 261 | x_offs = tx1_vregs.slock ? scroll_x : 0; | |
| 262 | else | |
| 263 | x_offs = 0; | |
| 264 | ||
| 265 | y_gran = y_offs & 7; | |
| 266 | ||
| 267 | if (x_offs & 7) | |
| 268 | { | |
| 269 | UINT32 tilenum; | |
| 270 | UINT16 ram_val = tx1_vram[((y_offs << 4) & 0xf80) + ((x_offs >> 3) & 0x7f)]; | |
| 271 | ||
| 272 | tilenum = (ram_val & 0x03ff) | ((ram_val & 0x8000) >> 5); | |
| 273 | colour = (ram_val & 0xfc00) >> 8; | |
| 274 | d0 = *(gfx2 + (tilenum << 3) + y_gran); | |
| 275 | d1 = *(gfx1 + (tilenum << 3) + y_gran); | |
| 276 | } | |
| 277 | ||
| 278 | for (x = 0; x < 256 * 3; ++x) | |
| 279 | { | |
| 280 | UINT32 x_gran = x_offs & 7; | |
| 281 | ||
| 282 | if (!x_gran) | |
| 283 | { | |
| 284 | UINT32 tilenum; | |
| 285 | UINT16 ram_val = tx1_vram[((y_offs << 4) & 0xf80) + ((x_offs >> 3) & 0x7f)]; | |
| 286 | ||
| 287 | tilenum = (ram_val & 0x03ff) | ((ram_val & 0x8000) >> 5); | |
| 288 | colour = (ram_val & 0xfc00) >> 8; | |
| 289 | d0 = *(gfx2 + (tilenum << 3) + y_gran); | |
| 290 | d1 = *(gfx1 + (tilenum << 3) + y_gran); | |
| 291 | } | |
| 292 | ||
| 293 | *bitmap++ = colour | | |
| 294 | (((d1 >> (7 ^ x_gran)) & 1) << 1) | | |
| 295 | ((d0 >> (7 ^ x_gran)) & 1); | |
| 296 | ||
| 297 | x_offs = (x_offs + 1) & 0x3ff; | |
| 298 | } | |
| 299 | } | |
| 300 | } | |
| 301 | ||
| 302 | ||
| 303 | /************************************* | |
| 304 | * | |
| 305 | * Road | |
| 306 | * | |
| 307 | *************************************/ | |
| 308 | ||
| 309 | #define TX1_GET_ROADPIX(NUM) \ | |
| 310 | { \ | |
| 311 | UINT32 addr = (rva6_0 << 5) | (road##NUM##_hcnt & 0x1f); \ | |
| 312 | UINT8 promaddr1, promaddr2, promaddr3; \ | |
| 313 | promaddr1 = rom_a[addr]; \ | |
| 314 | promaddr2 = rom_b[addr]; \ | |
| 315 | promaddr3 = rom_c[addr]; \ | |
| 316 | pix[NUM][0][0] = prom_a[promaddr1]; pix[NUM][0][1] = prom_b[promaddr1]; pix[NUM][0][2] = prom_c[promaddr1]; \ | |
| 317 | pix[NUM][1][0] = prom_a[promaddr2]; pix[NUM][1][1] = prom_b[promaddr2]; pix[NUM][1][2] = prom_c[promaddr2]; \ | |
| 318 | pix[NUM][2][0] = prom_a[promaddr3]; pix[NUM][2][1] = prom_b[promaddr3]; pix[NUM][2][2] = prom_c[promaddr3]; \ | |
| 319 | pix[NUM][3][0] = prom_a[0]; pix[NUM][3][1] = prom_b[0]; pix[NUM][3][2] = prom_c[0]; \ | |
| 320 | } | |
| 321 | ||
| 322 | INLINE void tx1_draw_road_pixel(int screen, UINT8 *bmpaddr, | |
| 323 | UINT8 apix[3], UINT8 bpix[3], UINT32 pixnuma, UINT32 pixnumb, | |
| 324 | UINT8 stl, UINT8 sld, UINT8 selb, | |
| 325 | UINT8 bnk, UINT8 rorev, UINT8 eb, UINT8 r, UINT8 delr, | |
| 326 | running_machine *machine) | |
| 327 | { | |
| 328 | UINT8 a0 = BIT(apix[0], pixnuma); | |
| 329 | UINT8 a1 = BIT(apix[1], pixnuma); | |
| 330 | UINT8 a2 = BIT(apix[2], pixnuma); | |
| 331 | ||
| 332 | UINT8 b0 = BIT(bpix[0], pixnumb); | |
| 333 | UINT8 b1 = BIT(bpix[1], pixnumb); | |
| 334 | UINT8 b2 = BIT(bpix[2], pixnumb); | |
| 335 | ||
| 336 | UINT8 d3; | |
| 337 | UINT8 d2; | |
| 338 | UINT8 d1; | |
| 339 | UINT8 d0; | |
| 340 | UINT8 sel; | |
| 341 | UINT8 c6 = BIT(sld, 6); | |
| 342 | UINT8 c5 = BIT(sld, 5); | |
| 343 | UINT8 c4 = BIT(sld, 4); | |
| 344 | UINT8 c3 = BIT(sld, 2); | |
| 345 | ||
| 346 | UINT32 addr_offset = screen * 256; | |
| 347 | ||
| 348 | sel = !bnk && ( (a2 && !b0) || (!a0 && b2) || !a1 || !a2 || !b1 || !b2 ); | |
| 349 | ||
| 350 | d3 = | |
| 351 | (a2 && a1 && a0 && b2 && b1 && b0 && !rorev) | |
| 352 | || (a1 && b1 && !b0 && stl && !bnk && !c6) | |
| 353 | || (a1 && !a0 && b1 && stl && !bnk && !c6) | |
| 354 | || (a1 && !b2 && b1 && stl && !bnk && !c6) | |
| 355 | || (a2 && b2 && !b1 && stl && !bnk && !c4) | |
| 356 | || (a2 && !a1 && b2 && stl && !bnk && !c4) | |
| 357 | || (!a2 && a1 && b2 && stl && !bnk && !c6) | |
| 358 | || (a2 && !b2 && b1 && stl && !bnk && !c6) | |
| 359 | || (!a2 && !a1 && stl && !bnk && !c5) | |
| 360 | || (!b2 && !b1 && stl && !bnk && !c5) | |
| 361 | || (!b0 && !stl && !bnk && !c3) | |
| 362 | || (!b1 && !stl && !bnk && !c3) | |
| 363 | || (!a0 && !stl && !bnk && !c3) | |
| 364 | || (!a1 && !stl && !bnk && !c3) | |
| 365 | || (!a2 && !stl && !bnk && !c3) | |
| 366 | || (!b2 && !stl && !bnk && !c3) | |
| 367 | || (bnk && !rorev); | |
| 368 | ||
| 369 | if (eb == 0) | |
| 370 | { | |
| 371 | if (sel == 1) | |
| 372 | { | |
| 373 | d2 = stl && (!a2 || !b2); | |
| 374 | d1 = !stl || (!a2 && !a1) || (!b1 && !b2) || (a2 && !b1) || (b2 && !a1); | |
| 375 | d0 = !stl | |
| 376 | || (!a2 && !a0 && b1) | |
| 377 | || (a1 && !b2 && !b0) | |
| 378 | || (!a2 && !a1 && !a0) | |
| 379 | || (!b2 && !b1 && !b0) | |
| 380 | || (a2 && a1 && !b0) | |
| 381 | || (!a0 && b2 && b1) | |
| 382 | || (a2 && !b1 && !b0) | |
| 383 | || (!a1 && !a0 && b2) | |
| 384 | || (!a2 && !a0 && b2) | |
| 385 | || (a2 && !b2 && !b0); | |
| 386 | } | |
| 387 | else | |
| 388 | { | |
| 389 | d2 = BIT(tx1_vregs.scol, selb ? 2 : 10); | |
| 390 | d1 = BIT(tx1_vregs.scol, selb ? 1 : 9); | |
| 391 | d0 = BIT(tx1_vregs.scol, selb ? 0 : 8); | |
| 392 | } | |
| 393 | } | |
| 394 | else | |
| 395 | d2 = d1 = d0 = 0; | |
| 396 | ||
| 397 | *(bmpaddr + addr_offset) = (bnk << 6) | (r << 5) | (!(sel && delr) << 4 ) | (d3 << 3) | (d2 << 2) | (d1 << 1) | d0; | |
| 398 | } | |
| 399 | ||
| 400 | /* This could do with a tidy up and more comments... */ | |
| 401 | static void tx1_draw_road(running_machine *machine, UINT8 *bitmap) | |
| 402 | { | |
| 403 | INT32 y; | |
| 404 | UINT32 rva9_8; | |
| 405 | UINT32 rva7; | |
| 406 | UINT32 tnlf; | |
| 407 | UINT32 stlf; | |
| 408 | UINT32 scchgf; | |
| 409 | ||
| 410 | UINT32 vc = 0; | |
| 411 | ||
| 412 | UINT16 road0_hcnt; | |
| 413 | UINT8 road0_pcnt; | |
| 414 | UINT16 road1_hcnt; | |
| 415 | UINT8 road1_pcnt; | |
| 416 | UINT8 pix[2][4][3]; | |
| 417 | ||
| 418 | /* Road slice map ROMs */ | |
| 419 | const UINT8 *const gfx3 = memory_region(machine, "gfx3"); | |
| 420 | const UINT8 *const rom_a = gfx3; | |
| 421 | const UINT8 *const rom_b = gfx3 + 0x2000; | |
| 422 | const UINT8 *const rom_c = gfx3 + 0x4000; | |
| 423 | ||
| 424 | /* Pixel data */ | |
| 425 | const UINT8 *const proms = memory_region(machine, "proms"); | |
| 426 | const UINT8 *const prom_a = proms + 0x1100; | |
| 427 | const UINT8 *const prom_b = proms + 0x1300; | |
| 428 | const UINT8 *const prom_c = proms + 0x1500; | |
| 429 | const UINT8 *const vprom = proms + 0x1700; | |
| 430 | ||
| 431 | rva9_8 = (tx1_vregs.flags & 3) << 8; | |
| 432 | rva7 = !BIT(tx1_vregs.flags, TX1_RDFLAG_RVA7) << 7; | |
| 433 | tnlf = BIT(tx1_vregs.flags, TX1_RDFLAG_TNLF); | |
| 434 | scchgf = BIT(tx1_vregs.flags, TX1_RDFLAG_SCCHGF); | |
| 435 | stlf = BIT(tx1_vregs.flags, TX1_RDFLAG_STLF); | |
| 436 | ||
| 437 | for (y = 0; y < 240; ++y) | |
| 438 | { | |
| 439 | UINT32 x; | |
| 440 | UINT8 sld; | |
| 441 | UINT8 rva6_0; | |
| 442 | UINT16 rcrdb15_0; | |
| 443 | UINT16 rva_addr; | |
| 444 | UINT32 bank_cnt; | |
| 445 | ||
| 446 | UINT16 vat; | |
| 447 | UINT16 vp0; | |
| 448 | UINT16 vp1; | |
| 449 | UINT16 vp2; | |
| 450 | UINT16 vp3; | |
| 451 | UINT16 vp4; | |
| 452 | ||
| 453 | UINT32 va8, va9, va10, va11, va12, va13, va14, va15; | |
| 454 | UINT32 v0, v1, v2; | |
| 455 | ||
| 456 | UINT8 hc1_u, hc1_l; | |
| 457 | UINT8 hc0_u, hc0_l; | |
| 458 | ||
| 459 | UINT32 bnkls, bnkcs, bnkrs; | |
| 460 | UINT32 rl, rc, rr; | |
| 461 | ||
| 462 | UINT32 stl; | |
| 463 | UINT32 selb; | |
| 464 | UINT32 ebls, ebcs, ebrs; | |
| 465 | ||
| 466 | UINT8 *bmpaddr = bitmap + (y * 768); | |
| 467 | ||
| 468 | UINT32 rltmp, rctmp, rrtmp; | |
| 469 | UINT32 eltmp, ectmp, ertmp; | |
| 470 | ||
| 471 | UINT32 tmpm; | |
| 472 | UINT32 tmpn; | |
| 473 | UINT32 tmpc; | |
| 474 | UINT32 tmpd; | |
| 475 | ||
| 476 | UINT8 scrcnt0; | |
| 477 | UINT8 scrcnt1; | |
| 478 | ||
| 479 | UINT8 rorevls = 0; | |
| 480 | UINT8 rorevcs = 0; | |
| 481 | UINT8 rorevrs = 0; | |
| 482 | ||
| 483 | int febl[2] = { 0, 0 }; | |
| 484 | int febr[2] = { 0, 0 }; | |
| 485 | int febc[2] = { 0, 0 }; | |
| 486 | ||
| 487 | /* Road vertical address */ | |
| 488 | if ( BIT(tx1_vregs.h_val, 15) ) | |
| 489 | rva6_0 = 0x7f; | |
| 490 | else | |
| 491 | rva6_0 = (~tx1_vregs.h_val >> 7) & 0x7f; | |
| 492 | ||
| 493 | rva_addr = rva9_8 | rva6_0; | |
| 494 | ||
| 495 | /* Get the stripe data also */ | |
| 496 | sld = vprom[rva6_0] + tx1_vregs.slin_val; | |
| 497 | ||
| 498 | /* Load the left road h-counter */ | |
| 499 | rcrdb15_0 = tx1_rcram[(0x80 + rva_addr) ^ 0x7ff]; | |
| 500 | road0_pcnt = rcrdb15_0 & 0x7; | |
| 501 | road0_hcnt = (rcrdb15_0 >> 3) & 0x7f; | |
| 502 | road0_hcnt |= rcrdb15_0 & 0xfc00 ? 0x80 : 0; | |
| 503 | road0_hcnt |= (rcrdb15_0 & 0xfc00) == 0xfc00 ? 0x100 : 0x000; | |
| 504 | ||
| 505 | /* Load the second road h-counter */ | |
| 506 | rcrdb15_0 = tx1_rcram[(rva7 + rva_addr) ^ 0x7ff]; | |
| 507 | road1_pcnt = rcrdb15_0 & 0x7; | |
| 508 | road1_hcnt = (rcrdb15_0 >> 3) & 0x7f; | |
| 509 | road1_hcnt |= rcrdb15_0 & 0xfc00 ? 0x80 : 0; | |
| 510 | road1_hcnt |= (rcrdb15_0 & 0xfc00) == 0xfc00 ? 0x100 : 0x000; | |
| 511 | road1_hcnt |= (rcrdb15_0 & 0x800); | |
| 512 | ||
| 513 | scrcnt0 = (road0_hcnt >> 5) & 0xf; | |
| 514 | scrcnt1 = (road1_hcnt >> 5) & 0xf; | |
| 515 | ||
| 516 | if (road0_pcnt & 7) | |
| 517 | { | |
| 518 | TX1_GET_ROADPIX(0); | |
| 519 | ||
| 520 | febl[0] = (scrcnt0 + 0) & 0xc; | |
| 521 | febc[0] = (scrcnt0 + 1) & 0xc; | |
| 522 | febr[0] = (scrcnt0 + 2) & 0xc; | |
| 523 | } | |
| 524 | ||
| 525 | if (road1_pcnt & 7) | |
| 526 | { | |
| 527 | UINT32 y4 = (road1_hcnt >> 4) & 1; | |
| 528 | UINT32 temp = (road1_hcnt >> 5) & 0xf; | |
| 529 | UINT32 x, u; | |
| 530 | UINT32 fl11 = BIT(road1_hcnt, 15); | |
| 531 | ||
| 532 | TX1_GET_ROADPIX(1); | |
| 533 | ||
| 534 | x = (temp & 0xc); | |
| 535 | u = !(((temp & 1) && y4) || (temp & 2)); | |
| 536 | rorevls = ((fl11 && !x) || (fl11 && x && u)); | |
| 537 | febl[1] = x; | |
| 538 | ||
| 539 | temp += 1; | |
| 540 | x = (temp & 0xc); | |
| 541 | u = !(((temp & 1) && y4) || (temp & 2)); | |
| 542 | rorevcs = ((fl11 && !x) || (fl11 && x && u)); | |
| 543 | febc[1] = x; | |
| 544 | ||
| 545 | temp += 1; | |
| 546 | x = (temp & 0xc); | |
| 547 | u = !(((temp & 1) && y4) || (temp & 2)); | |
| 548 | rorevrs = ((fl11 && !x) || (fl11 && x && u)); | |
| 549 | febr[1] = x; | |
| 550 | } | |
| 551 | ||
| 552 | /* Load the bank counter with accumulator bits 14-5 */ | |
| 553 | bank_cnt = (tx1_vregs.ba_val >> 5) & 0x3ff; | |
| 554 | ||
| 555 | /* Load vertical position data */ | |
| 556 | vat = tx1_rcram[(rva9_8 + 7) ^ 0x7f8]; | |
| 557 | vp0 = tx1_rcram[(rva9_8 + 6) ^ 0x7f8]; | |
| 558 | vp1 = tx1_rcram[(rva9_8 + 5) ^ 0x7f8]; | |
| 559 | vp2 = tx1_rcram[(rva9_8 + 4) ^ 0x7f8]; | |
| 560 | vp3 = tx1_rcram[(rva9_8 + 3) ^ 0x7f8]; | |
| 561 | vp4 = tx1_rcram[(rva9_8 + 2) ^ 0x7f8]; | |
| 562 | ||
| 563 | /* */ | |
| 564 | if (y-1 == vp0) vc++; | |
| 565 | if (y-1 == vp1) vc++; | |
| 566 | if (y-1 == vp2) vc++; | |
| 567 | if (y-1 == vp3) vc++; | |
| 568 | if (y-1 == vp4) vc++; | |
| 569 | ||
| 570 | /* */ | |
| 571 | va8 = BIT(vat, 8); | |
| 572 | va9 = BIT(vat, 9); | |
| 573 | va10 = BIT(vat, 10); | |
| 574 | va11 = BIT(vat, 11); | |
| 575 | va12 = BIT(vat, 12); | |
| 576 | va13 = BIT(vat, 13); | |
| 577 | va14 = BIT(vat, 14); | |
| 578 | va15 = BIT(vat, 15); | |
| 579 | ||
| 580 | v0 = BIT(vc, 0); | |
| 581 | v1 = BIT(vc, 1); | |
| 582 | v2 = BIT(vc, 2); | |
| 583 | ||
| 584 | /* Load the horizontal tunnel position counters */ | |
| 585 | hc1_u = tx1_rcram[(rva9_8 + 1) ^ 0x7f8] >> 8; | |
| 586 | hc1_l = tx1_rcram[(rva9_8 + 1) ^ 0x7f8] & 0xff; | |
| 587 | hc0_u = tx1_rcram[(rva9_8 + 0) ^ 0x7f8] >> 8; | |
| 588 | hc0_l = tx1_rcram[(rva9_8 + 0) ^ 0x7f8] & 0xff; | |
| 589 | ||
| 590 | stl = !stlf || v0 || (!v2 && !scchgf) || scchgf; | |
| 591 | selb = (!v2 && !scchgf) || v2; | |
| 592 | ||
| 593 | rltmp = | |
| 594 | (v2 && !v0 && !va10) | |
| 595 | || (!v2 && v0 && !va10) | |
| 596 | || (v2 && !v0 && !va11) | |
| 597 | || (v2 && !v1 && !v0) | |
| 598 | || (!v2 && v0 && !va11) | |
| 599 | || (!v2 && v1 && !v0) | |
| 600 | || (!v2 && !v1 && v0); | |
| 601 | ||
| 602 | rctmp = | |
| 603 | (v2 && !v0 && va9 && va8) | |
| 604 | || (!v2 && v0 && va9 && va8) | |
| 605 | || (v2 && !v0 && !va11) | |
| 606 | || (v2 && !v1 && !v0) | |
| 607 | || (!v2 && v0 && !va11) | |
| 608 | || (!v2 && v1 && !v0) | |
| 609 | || (!v2 && !v1 && v0); | |
| 610 | ||
| 611 | rrtmp = | |
| 612 | (v2 && !v0 && !va11 && !va10) | |
| 613 | || (!v2 && v0 && !va11 && !va10) | |
| 614 | || (v2 && !v0 && va9) | |
| 615 | || (!v2 && v0 && va9) | |
| 616 | || (v2 && !v1 && !v0) | |
| 617 | || (!v2 && v1 && !v0) | |
| 618 | || (!v2 && !v1 && v0); | |
| 619 | ||
| 620 | ectmp = | |
| 621 | (v2 && !v0 && va13 && va12) | |
| 622 | || (!v2 && v1 && va13 && va12) | |
| 623 | || (!v2 && !v1 && v0) | |
| 624 | || (v2 && !v0 && !va15) | |
| 625 | || (!v2 && v1 && !va15); | |
| 626 | ||
| 627 | eltmp = | |
| 628 | (v2 && !v0 && !va14) | |
| 629 | || (!v2 && v1 && !va14) | |
| 630 | || (!v2 && !v1 && v0) | |
| 631 | || (v2 && !v0 && !va15) | |
| 632 | || (!v2 && v1 && !va15); | |
| 633 | ||
| 634 | ertmp = | |
| 635 | (v2 && !v0 && !va15 && !va14) | |
| 636 | || (!v2 && v1 && !va15 && !va14) | |
| 637 | || (v2 && !v0 && va13) | |
| 638 | || (!v2 && v1 && va13) | |
| 639 | || (!v2 && !v1 && v0); | |
| 640 | ||
| 641 | tmpn = (v2 && !v0) || (!v2 && v0); | |
| 642 | tmpm = (v2 && !v0) || (!v2 && v1); | |
| 643 | tmpc = (!v1 && !v0) || (v2); | |
| 644 | tmpd = v1 && v0 && va11; | |
| 645 | ||
| 646 | for (x = 0; x < 256; x++) | |
| 647 | { | |
| 648 | UINT32 pixnum0 = (road0_pcnt & 7) ^ 7; | |
| 649 | UINT32 pixnum1 = (road1_pcnt & 7) ^ 7; | |
| 650 | ||
| 651 | UINT32 cyu, cyl; | |
| 652 | UINT32 delrl, delrc, delrr; | |
| 653 | ||
| 654 | /* */ | |
| 655 | scrcnt0 = (road0_hcnt >> 5) & 0xf; | |
| 656 | scrcnt1 = (road1_hcnt >> 5) & 0xf; | |
| 657 | ||
| 658 | /* Get new pixel data? */ | |
| 659 | if ( !(road0_pcnt & 7) ) | |
| 660 | { | |
| 661 | TX1_GET_ROADPIX(0); | |
| 662 | ||
| 663 | /* Road 0 enables */ | |
| 664 | febl[0] = (scrcnt0 + 0) & 0xc; | |
| 665 | febc[0] = (scrcnt0 + 1) & 0xc; | |
| 666 | febr[0] = (scrcnt0 + 2) & 0xc; | |
| 667 | } | |
| 668 | ||
| 669 | if ( !(road1_pcnt & 7) ) | |
| 670 | { | |
| 671 | UINT32 y4 = (road1_hcnt >> 4) & 1; | |
| 672 | UINT32 temp = (road1_hcnt >> 5) & 0xf; | |
| 673 | UINT32 x, u; | |
| 674 | UINT32 fl11 = BIT(road1_hcnt, 15); | |
| 675 | ||
| 676 | TX1_GET_ROADPIX(1); | |
| 677 | ||
| 678 | x = (temp & 0xc); | |
| 679 | u = !(((temp & 1) && y4) || (temp & 2)); | |
| 680 | rorevls = ((fl11 && !x) || (fl11 && x && u)); | |
| 681 | febl[1] = x; | |
| 682 | ||
| 683 | temp += 1; | |
| 684 | x = (temp & 0xc); | |
| 685 | u = !(((temp & 1) && y4) || (temp & 2)); | |
| 686 | rorevcs = ((fl11 && !x) || (fl11 && x && u)); | |
| 687 | febc[1] = x; | |
| 688 | ||
| 689 | temp += 1; | |
| 690 | x = (temp & 0xc); | |
| 691 | u = !(((temp & 1) && y4) || (temp & 2)); | |
| 692 | rorevrs = ((fl11 && !x) || (fl11 && x && u)); | |
| 693 | febr[1] = x; | |
| 694 | } | |
| 695 | ||
| 696 | /* Road camber/banking */ | |
| 697 | if ( BIT(tx1_vregs.ba_val, 23) ) | |
| 698 | { | |
| 699 | bnkls = 1; | |
| 700 | bnkcs = 1; | |
| 701 | bnkrs = 1; | |
| 702 | } | |
| 703 | else if (tx1_vregs.ba_val & 0x007f8000) | |
| 704 | { | |
| 705 | bnkls = 0; | |
| 706 | bnkcs = 0; | |
| 707 | bnkrs = 0; | |
| 708 | } | |
| 709 | else | |
| 710 | { | |
| 711 | bnkls = bank_cnt < 0x400; | |
| 712 | bnkcs = bank_cnt < 0x300; | |
| 713 | bnkrs = bank_cnt < 0x200; | |
| 714 | } | |
| 715 | ||
| 716 | if (tx1_vregs.bank_mode) | |
| 717 | { | |
| 718 | bnkls ^= 1; | |
| 719 | bnkcs ^= 1; | |
| 720 | bnkrs ^= 1; | |
| 721 | } | |
| 722 | ||
| 723 | cyu = hc1_u == 0xff; | |
| 724 | cyl = hc1_l == 0xff; | |
| 725 | ||
| 726 | rl = tnlf && ( rltmp || (tmpn && (!cyl || (va8 && va9 && cyu))) ); | |
| 727 | rc = tnlf && ( rctmp || (tmpn && ((!va10 && !cyl) || (va9 && cyu))) ); | |
| 728 | rr = tnlf && ( rrtmp || (tmpn && ((!va11 && !cyl) || (va8 && cyu))) ); | |
| 729 | ||
| 730 | /* Evaluates to 0 for tunnels */ | |
| 731 | delrl = !tnlf || tmpc || ((tmpd && va10) && ((!va8 && cyl) || (!va9 && cyl) || (!cyu && !cyl))); | |
| 732 | ||
| 733 | delrr = | |
| 734 | !tnlf | |
| 735 | || tmpc | |
| 736 | || (v1 && v0 && va10 && !va9 && !va8 && cyl) | |
| 737 | || (v1 && v0 && va10 && !va9 && cyl && !cyu) | |
| 738 | || (tmpd && !va9 && !cyu) | |
| 739 | || (tmpd && !va9 && !va8); | |
| 740 | ||
| 741 | delrc = !tnlf || tmpc || (tmpd && ((!va8 && cyl && !cyu) || (!va8 && va10 && !cyu) || (!va9 && cyl) || (va10 && !va9))); | |
| 742 | ||
| 743 | cyu = hc0_u == 0xff; | |
| 744 | cyl = hc0_l == 0xff; | |
| 745 | ||
| 746 | ebls = tnlf && ( eltmp || (tmpm && (!cyl || (va12 && va13 && cyu)))); | |
| 747 | ebcs = tnlf && ( ectmp || (tmpm && ((!va14 && !cyl) || (va13 && cyu)))); | |
| 748 | ebrs = tnlf && ( ertmp || (tmpm && ((!va15 && !cyl) || (va12 && cyu)))); | |
| 749 | ||
| 750 | /* Carry for horizontal position counters */ | |
| 751 | cyu = hc0_u == 0xff; | |
| 752 | cyl = hc0_l == 0xff; | |
| 753 | ||
| 754 | if (!(bnkls && !rl)) | |
| 755 | { | |
| 756 | int a, b; | |
| 757 | ||
| 758 | if (!febl[0]) | |
| 759 | a = (scrcnt0) & 3; | |
| 760 | else | |
| 761 | a = 3; | |
| 762 | ||
| 763 | if (!febl[1]) | |
| 764 | b = (scrcnt1) & 3; | |
| 765 | else | |
| 766 | b = 3; | |
| 767 | ||
| 768 | tx1_draw_road_pixel(0, bmpaddr, | |
| 769 | &pix[0][a][0], &pix[1][b][0], | |
| 770 | pixnum0, pixnum1, | |
| 771 | stl, sld, selb, bnkls, rorevls, ebls, rl, delrl, machine); | |
| 772 | } | |
| 773 | else | |
| 774 | *(bmpaddr) = (bnkls << 6) | (rl << 5); | |
| 775 | ||
| 776 | if (!(bnkcs && !rc)) | |
| 777 | { | |
| 778 | int a, b; | |
| 779 | ||
| 780 | if (!febc[0]) | |
| 781 | a = (scrcnt0 + 1) & 3; | |
| 782 | else | |
| 783 | a = 3; | |
| 784 | ||
| 785 | if (!febc[1]) | |
| 786 | b = (scrcnt1 + 1) & 3; | |
| 787 | else | |
| 788 | b = 3; | |
| 789 | ||
| 790 | tx1_draw_road_pixel(1, bmpaddr, | |
| 791 | &pix[0][a][0], &pix[1][b][0], | |
| 792 | pixnum0, pixnum1, | |
| 793 | stl, sld, selb, bnkcs, rorevcs, ebcs, rc, delrc, machine); | |
| 794 | } | |
| 795 | else | |
| 796 | *(bmpaddr + 256) = (bnkcs << 6) | (rc << 5); | |
| 797 | ||
| 798 | if (!(bnkrs && !rr)) | |
| 799 | { | |
| 800 | int a, b; | |
| 801 | ||
| 802 | if (!febr[0]) | |
| 803 | a = (scrcnt0 + 2) & 3; | |
| 804 | else | |
| 805 | a = 3; | |
| 806 | ||
| 807 | if (!febr[1]) | |
| 808 | b = (scrcnt1 + 2) & 3; | |
| 809 | else | |
| 810 | b = 3; | |
| 811 | ||
| 812 | tx1_draw_road_pixel(2, bmpaddr, | |
| 813 | &pix[0][a][0], &pix[1][b][0], | |
| 814 | pixnum0, pixnum1, | |
| 815 | stl, sld, selb, bnkrs, rorevrs, ebrs, rr, delrr, machine); | |
| 816 | } | |
| 817 | else | |
| 818 | *(bmpaddr + 512) = (bnkrs << 6) | (rr << 5); | |
| 819 | ||
| 820 | ++bmpaddr; | |
| 821 | ||
| 822 | /* Update road counters */ | |
| 823 | if (!(++road0_pcnt & 7)) | |
| 824 | ++road0_hcnt; | |
| 825 | ||
| 826 | if (!(++road1_pcnt & 7)) | |
| 827 | ++road1_hcnt; | |
| 828 | ||
| 829 | /* Increment horizontal counters (stop at 0xff) */ | |
| 830 | if (hc0_u != 0xff) ++hc0_u; | |
| 831 | if (hc0_l != 0xff) ++hc0_l; | |
| 832 | if (hc1_u != 0xff) ++hc1_u; | |
| 833 | if (hc1_l != 0xff) ++hc1_l; | |
| 834 | ||
| 835 | /* Update bank counter */ | |
| 836 | bank_cnt = (bank_cnt + 1) & 0x7ff; | |
| 837 | } | |
| 838 | ||
| 839 | tx1_vregs.h_val += tx1_vregs.h_inc; | |
| 840 | ||
| 841 | /* Finally, increment the bank accumulator */ | |
| 842 | tx1_vregs.ba_val = (tx1_vregs.ba_val + tx1_vregs.ba_inc) & 0x00ffffff; | |
| 843 | } | |
| 844 | ||
| 845 | } | |
| 846 | ||
| 847 | /************************************* | |
| 848 | * | |
| 849 | * Objects | |
| 850 | * | |
| 851 | *************************************/ | |
| 852 | ||
| 853 | static void tx1_draw_objects(running_machine *machine, UINT8 *bitmap) | |
| 854 | { | |
| 227 | 855 | #define FRAC 16 |
| 228 | 856 | |
| 229 | 857 | UINT32 offs; |
| 230 | 858 | |
| 231 | 859 | /* The many lookup table ROMs */ |
| 232 | const UINT8 *const ic48 = (UINT8*)memory_region(machine, "user3"); | |
| 233 | const UINT8 *const ic281 = (UINT8*)memory_region(machine, "user3") + 0x2000; | |
| 234 | const UINT8 *const ic25 = (UINT8*)memory_region(machine, "proms") + 0x1000; | |
| 860 | const UINT8 *const user3 = memory_region(machine, "user3"); | |
| 861 | const UINT8 *const ic48 = user3; | |
| 862 | const UINT8 *const ic281 = user3 + 0x2000; | |
| 235 | 863 | |
| 236 | const UINT8 *const ic106 = (UINT8*)memory_region(machine, "user2"); | |
| 237 | const UINT8 *const ic73 = (UINT8*)memory_region(machine, "user2") + 0x4000; | |
| 864 | const UINT8 *const proms = memory_region(machine, "proms"); | |
| 865 | const UINT8 *const ic25 = proms + 0x1000; | |
| 238 | 866 | |
| 239 | const UINT8 *const ic190 = (UINT8*)memory_region(machine, "proms") + 0xc00; | |
| 240 | const UINT8 *const ic162 = (UINT8*)memory_region(machine, "proms") + 0xe00; | |
| 867 | const UINT8 *const user2 = memory_region(machine, "user2"); | |
| 868 | const UINT8 *const ic106 = user2; | |
| 869 | const UINT8 *const ic73 = user2 + 0x4000; | |
| 241 | 870 | |
| 242 | const UINT8 *const pixdata_rgn = (UINT8*)memory_region(machine, "gfx2"); | |
| 871 | const UINT8 *const ic190 = proms + 0xc00; | |
| 872 | const UINT8 *const ic162 = proms + 0xe00; | |
| 243 | 873 | |
| 874 | const UINT8 *const pixdata_rgn = memory_region(machine, "gfx2"); | |
| 875 | ||
| 244 | 876 | for (offs = 0x0; offs <= tx1_objram_size; offs += 8) |
| 245 | 877 | { |
| 246 | 878 | UINT32 x; |
| r3333 | r3334 | |
| 282 | 914 | /* Add 1 to account for line buffering */ |
| 283 | 915 | y = (tx1_objram[offs] >> 8) + 1; |
| 284 | 916 | |
| 285 | for (; y < | |
| 917 | for (; y < | |
| 286 | 918 | { |
| 287 | 919 | UINT32 rom_addr2 = 0; |
| 288 | 920 | UINT8 ic106_data = 0; |
| r3333 | r3334 | |
| 374 | 1006 | lut_data = (ic106_data << 8) | ic73_data; |
| 375 | 1007 | psbb0_12 = lut_data & 0x1fff; |
| 376 | 1008 | |
| 377 | // 0000 1100 0011 1111 | |
| 378 | 1009 | pscb0_14 = (psbb0_12 & 0xc3f); |
| 379 | 1010 | |
| 380 | 1011 | /* Bits 9_6 are from PCTMP11-8 or PSBB9-6 */ |
| r3333 | r3334 | |
| 416 | 1047 | } |
| 417 | 1048 | |
| 418 | 1049 | /* Draw a pixel? */ |
| 419 | if ( x < | |
| 1050 | if ( x < | |
| 420 | 1051 | { |
| 421 | 1052 | UINT8 pix; |
| 422 | 1053 | UINT8 bit; |
| r3333 | r3334 | |
| 442 | 1073 | else |
| 443 | 1074 | color = ~ic162[prom_addr] & 0x3f; |
| 444 | 1075 | |
| 445 | *BITMAP_ADDR16(bitmap, y, x) = TX1_COLORS_OBJ + color; | |
| 1076 | // *BITMAP_ADDR16(bitmap, y, x) = machine->pens[TX1_COLORS_OBJ + color]; | |
| 1077 | *(bitmap + 768*y + x) = 0x40 | color; | |
| 446 | 1078 | } |
| 447 | 1079 | } |
| 448 | 1080 | |
| r3333 | r3334 | |
| 466 | 1098 | } |
| 467 | 1099 | |
| 468 | 1100 | |
| 1101 | /************************************* | |
| 1102 | * | |
| 1103 | * Core Functions | |
| 1104 | * | |
| 1105 | *************************************/ | |
| 1106 | ||
| 469 | 1107 | VIDEO_START( tx1 ) |
| 470 | 1108 | { |
| 471 | tx1_tilemap = tilemap_create(get_tx1_tile_info, tilemap_scan_rows, 8, 8, 128, 64); | |
| 472 | tilemap_set_transparent_pen(tx1_tilemap, 0xff); | |
| 473 | ||
| 474 | 1109 | /* Allocate a large bitmap that covers the three screens */ |
| 475 | 1110 | tx1_bitmap = auto_bitmap_alloc(768, 256, BITMAP_FORMAT_INDEXED16); |
| 476 | 1111 | tx1_texture = render_texture_alloc(NULL, NULL); |
| 1112 | ||
| 1113 | /* Allocate some bitmaps */ | |
| 1114 | tx1_chr_bmp = auto_malloc(sizeof(UINT8) * 256 * 3 * 240); | |
| 1115 | tx1_obj_bmp = auto_malloc(sizeof(UINT8) * 256 * 3 * 240); | |
| 1116 | tx1_rod_bmp = auto_malloc(sizeof(UINT8) * 256 * 3 * 240); | |
| 477 | 1117 | } |
| 478 | 1118 | |
| 479 | 1119 | VIDEO_EOF( tx1 ) |
| r3333 | r3334 | |
| 482 | 1122 | tx1_vregs.slin_val += tx1_vregs.slin_inc; |
| 483 | 1123 | } |
| 484 | 1124 | |
| 1125 | static void tx1_combine_layers(running_machine *machine, bitmap_t *bitmap, int screen) | |
| 1126 | { | |
| 1127 | int x, y; | |
| 1128 | UINT8 *chr_pal = memory_region(machine, "proms") + 0x900; | |
| 485 | 1129 | |
| 486 | /* Experimental :) */ | |
| 1130 | int x_offset = screen * 256; | |
| 1131 | ||
| 1132 | for (y = 0; y < 240; ++y) | |
| 1133 | { | |
| 1134 | UINT16 *bmp_addr = BITMAP_ADDR16(bitmap, y, 0); | |
| 1135 | ||
| 1136 | UINT32 bmp_offset = y * 768 + x_offset; | |
| 1137 | ||
| 1138 | UINT8 *chr_addr = tx1_chr_bmp + bmp_offset; | |
| 1139 | UINT8 *rod_addr = tx1_rod_bmp + bmp_offset; | |
| 1140 | UINT8 *obj_addr = tx1_obj_bmp + bmp_offset; | |
| 1141 | ||
| 1142 | for (x = 0; x < 256; ++x) | |
| 1143 | { | |
| 1144 | UINT8 out_val; | |
| 1145 | UINT32 char_val = chr_addr[x]; | |
| 1146 | UINT32 c7 = BIT(char_val, 7); | |
| 1147 | UINT32 c1 = BIT(char_val, 1); | |
| 1148 | UINT32 c0 = BIT(char_val, 0); | |
| 1149 | ||
| 1150 | UINT32 road_val = rod_addr[x]; | |
| 1151 | UINT32 r6 = BIT(road_val, 6); | |
| 1152 | UINT32 r5 = BIT(road_val, 5); | |
| 1153 | ||
| 1154 | UINT32 obj_val = obj_addr[x]; | |
| 1155 | UINT32 obj6 = BIT(obj_val, 6); | |
| 1156 | ||
| 1157 | UINT32 term1 = !(c7 && c1); | |
| 1158 | UINT32 term2 = !(c7 && c0); | |
| 1159 | UINT32 term3 = r5 || !r6; | |
| 1160 | UINT32 p12 = !(term1 && term2 && term3); | |
| 1161 | UINT32 p6 = !(obj6 && term1 && term2); | |
| 1162 | UINT32 sel = p12 | (p6 << 1); | |
| 1163 | ||
| 1164 | UINT32 psel = (!(p6 && p12) << 1) | p6; | |
| 1165 | ||
| 1166 | if (sel == 3) out_val = ((char_val & 0xc0) >> 2) | (chr_pal[char_val] & 0xf); | |
| 1167 | else if (sel == 2) out_val = road_val & 0x3f; | |
| 1168 | else out_val = obj_val & 0x3f; | |
| 1169 | ||
| 1170 | *bmp_addr++ = (psel << 6) | out_val; | |
| 1171 | } | |
| 1172 | } | |
| 1173 | } | |
| 1174 | ||
| 487 | 1175 | VIDEO_UPDATE( tx1 ) |
| 488 | 1176 | { |
| 489 | int y; | |
| 1177 | const device_config *left_screen = device_list_find_by_tag(screen->machine->config->devicelist, VIDEO_SCREEN, "left"); | |
| 1178 | const device_config *centre_screen = device_list_find_by_tag(screen->machine->config->devicelist, VIDEO_SCREEN, "center"); | |
| 1179 | const device_config *right_screen = device_list_find_by_tag(screen->machine->config->devicelist, VIDEO_SCREEN, "right"); | |
| 490 | 1180 | |
| 491 | const device_config *left_screen = device_list_find_by_tag(screen->machine->config->devicelist, VIDEO_SCREEN, "left"); | |
| 492 | const device_config *center_screen = device_list_find_by_tag(screen->machine->config->devicelist, VIDEO_SCREEN, "center"); | |
| 493 | const device_config *right_screen = device_list_find_by_tag(screen->machine->config->devicelist, VIDEO_SCREEN, "right"); | |
| 494 | ||
| 495 | 1181 | if ( screen == left_screen ) |
| 496 | 1182 | { |
| 497 | | |
| 1183 | mems | |
| 498 | 1184 | |
| 499 | // tilemap_set_scrollx(tx1_tilemap, 0, scroll); | |
| 500 | tilemap_draw(tx1_bitmap, &rect, tx1_tilemap, 0, 0); | |
| 501 | // tx1_draw_road(tx1_bitmap, &rect); | |
| 502 | tx1_draw_objects(screen->machine, tx1_bitmap, &rect); | |
| 1185 | tx1_draw_char(screen->machine, tx1_chr_bmp); | |
| 1186 | tx1_draw_road(screen->machine, tx1_rod_bmp); | |
| 1187 | tx1_draw_objects(screen->machine, tx1_obj_bmp); | |
| 503 | 1188 | |
| 504 | for (y = 0; y < 240; ++y) | |
| 505 | memcpy(BITMAP_ADDR16(bitmap, y, 0), BITMAP_ADDR16(tx1_bitmap, y, 0 * 256), sizeof(UINT16) * 256); | |
| 1189 | tx1_combine_layers(screen->machine, bitmap, 0); | |
| 506 | 1190 | } |
| 507 | else if ( screen == center_screen ) | |
| 508 | for (y = 0; y < 240; ++y) | |
| 509 | memcpy(BITMAP_ADDR16(bitmap, y, 0), BITMAP_ADDR16(tx1_bitmap, y, 1 * 256), sizeof(UINT16) * 256); | |
| 510 | else if ( screen == right_screen ) | |
| 511 | for (y = 0; y < 240; ++y) | |
| 512 | memcpy(BITMAP_ADDR16(bitmap, y, 0), BITMAP_ADDR16(tx1_bitmap, y, 2 * 256), sizeof(UINT16) * 256); | |
| 1191 | else if (screen == centre_screen) | |
| 1192 | { | |
| 1193 | tx1_combine_layers(screen->machine, bitmap, 1); | |
| 1194 | } | |
| 1195 | else if (screen == right_screen) | |
| 1196 | { | |
| 1197 | tx1_combine_layers(screen->machine, bitmap, 2); | |
| 1198 | } | |
| 513 | 1199 | |
| 514 | ||
| 515 | 1200 | return 0; |
| 516 | 1201 | } |
| 517 | 1202 | |
| r3333 | r3334 | |
| 566 | 1251 | size_t buggyboy_objram_size; |
| 567 | 1252 | size_t buggyboy_rcram_size; |
| 568 | 1253 | |
| 569 | static tilemap *buggyboy_tilemap; | |
| 1254 | static UINT8 *bb_chr_bmp; | |
| 1255 | static UINT8 *bb_obj_bmp; | |
| 1256 | static UINT8 *bb_rod_bmp; | |
| 570 | 1257 | |
| 571 | static UINT8 *chr_bmp; | |
| 572 | static UINT8 *obj_bmp; | |
| 573 | static UINT8 *rod_bmp; | |
| 574 | 1258 | |
| 575 | 1259 | /*************************************************************************** |
| 576 | 1260 | |
| r3333 | r3334 | |
| 592 | 1276 | bit 2 -- 4.7kohm resistor -- RED |
| 593 | 1277 | |
| 594 | 1278 | ***************************************************************************/ |
| 595 | PALETTE_INIT( buggybjr ) | |
| 1279 | ||
| 1280 | PALETTE_INIT( buggyboy ) | |
| 596 | 1281 | { |
| 597 | 1282 | int i; |
| 598 | 1283 | |
| r3333 | r3334 | |
| 626 | 1311 | } |
| 627 | 1312 | } |
| 628 | 1313 | |
| 629 | PALETTE_INIT( buggyboy ) | |
| 1314 | ||
| 1315 | /************************************* | |
| 1316 | * | |
| 1317 | * Characters | |
| 1318 | * | |
| 1319 | *************************************/ | |
| 1320 | ||
| 1321 | static void buggyboy_draw_char(running_machine *machine, UINT8 *bitmap, int wide) | |
| 630 | 1322 | { |
| 631 | int i; | |
| 1323 | INT32 x, y; | |
| 1324 | UINT32 scroll_x, scroll_y; | |
| 1325 | UINT8 *gfx1, *gfx2; | |
| 1326 | UINT32 total_width; | |
| 1327 | UINT32 x_mask; | |
| 632 | 1328 | |
| 633 | /* allocate the colortable */ | |
| 634 | machine->colortable = colortable_alloc(machine, 0x100); | |
| 1329 | /* 2bpp characters */ | |
| 1330 | gfx1 = memory_region(machine, "gfx1"); | |
| 1331 | gfx2 = memory_region(machine, "gfx1") + 0x4000; | |
| 635 | 1332 | |
| 636 | /* create a lookup table for the palette */ | |
| 637 | for (i = 0; i < 0x100; i++) | |
| 1333 | /* X/Y scroll values are the last word in char RAM */ | |
| 1334 | if (wide) | |
| 638 | 1335 | { |
| 639 | int bit0, bit1, bit2, bit3, bit4; | |
| 640 | int r, g, b; | |
| 1336 | scroll_y = (buggyboy_vram[0xfff] >> 10) & 0x3f; | |
| 1337 | scroll_x = buggyboy_vram[0xfff] & 0x1ff; | |
| 1338 | total_width = 768; | |
| 1339 | x_mask = 0x3ff; | |
| 1340 | } | |
| 1341 | else | |
| 1342 | { | |
| 1343 | scroll_y = (buggyboy_vram[0x7ff] >> 10) & 0x3f; | |
| 1344 | scroll_x = buggyboy_vram[0x7ff] & 0x1ff; | |
| 1345 | total_width = 256; | |
| 1346 | x_mask = 0x1ff; | |
| 1347 | } | |
| 641 | 1348 | |
| 642 | bit0 = BIT(color_prom[i + 0x000], 0); | |
| 643 | bit1 = BIT(color_prom[i + 0x000], 1); | |
| 644 | bit2 = BIT(color_prom[i + 0x000], 2); | |
| 645 | bit3 = BIT(color_prom[i + 0x000], 3); | |
| 646 | bit4 = BIT(color_prom[i + 0x300], 2); | |
| 647 | r = 0x06 * bit4 + 0x0d * bit0 + 0x1e * bit1 + 0x41 * bit2 + 0x8a * bit3; | |
| 1349 | for (y = 0; y < 240; ++y) | |
| 1350 | { | |
| 1351 | UINT32 d0 = 0, d1 = 0; | |
| 1352 | UINT32 colour = 0; | |
| 1353 | UINT32 y_offs; | |
| 1354 | UINT32 x_offs; | |
| 1355 | UINT32 y_gran; | |
| 648 | 1356 | |
| 649 | bit0 = BIT(color_prom[i + 0x100], 0); | |
| 650 | bit1 = BIT(color_prom[i + 0x100], 1); | |
| 651 | bit2 = BIT(color_prom[i + 0x100], 2); | |
| 652 | bit3 = BIT(color_prom[i + 0x100], 3); | |
| 653 | bit4 = BIT(color_prom[i + 0x300], 1); | |
| 654 | g = 0x06 * bit4 + 0x0d * bit0 + 0x1e * bit1 + 0x41 * bit2 + 0x8a * bit3; | |
| 1357 | /* There's no y-scrolling between scanlines 0 and 63 */ | |
| 1358 | if (y < 64) | |
| 1359 | y_offs = y; | |
| 1360 | else | |
| 1361 | { | |
| 1362 | y_offs = (y + (scroll_y | 0xc0) + 1) & 0xff; | |
| 655 | 1363 | |
| 656 | bit0 = BIT(color_prom[i + 0x200], 0); | |
| 657 | bit1 = BIT(color_prom[i + 0x200], 1); | |
| 658 | bit2 = BIT(color_prom[i + 0x200], 2); | |
| 659 | bit3 = BIT(color_prom[i + 0x200], 3); | |
| 660 | bit4 = BIT(color_prom[i + 0x300], 0); | |
| 661 | b = 0x06 * bit4 + 0x0d * bit0 + 0x1e * bit1 + 0x41 * bit2 + 0x8a * bit3; | |
| 1364 | /* Clamp */ | |
| 1365 | if (y_offs < 64) | |
| 1366 | y_offs |= 0xc0; | |
| 1367 | } | |
| 662 | 1368 | |
| 663 | colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b)); | |
| 664 | } | |
| 1369 | if ( (y_offs >= 64) && (y_offs < 128) ) | |
| 1370 | x_offs = scroll_x; | |
| 1371 | else | |
| 1372 | x_offs = 0; | |
| 665 | 1373 | |
| 666 | /* color_prom now points to the beginning of the lookup table */ | |
| 667 | color_prom += 0x400; | |
| 668 | 1374 | |
| 669 | /* Characters use colours 192-255 */ | |
| 670 | for (i = 0; i < 0x100; i++) | |
| 671 | { | |
| 672 | UINT8 ctabentry = 0xc0 | (((i & 0xc0) >> 2)) | (color_prom[i] & 0x0f); | |
| 673 | colortable_entry_set_value(machine->colortable, i, ctabentry); | |
| 674 | } | |
| 675 | } | |
| 1375 | y_gran = y_offs & 7; | |
| 676 | 1376 | |
| 677 | WRITE16_HANDLER( buggyboy_vram_w ) | |
| 678 | { | |
| 679 | COMBINE_DATA(&buggyboy_vram[offset]); | |
| 680 | tilemap_mark_tile_dirty(buggyboy_tilemap, offset); | |
| 681 | } | |
| 1377 | if (x_offs & 7) | |
| 1378 | { | |
| 1379 | UINT32 tilenum; | |
| 1380 | UINT16 ram_val; | |
| 682 | 1381 | |
| 683 | WRITE16_HANDLER( buggybjr_vram_w ) | |
| 684 | { | |
| 685 | COMBINE_DATA(&buggybjr_vram[offset]); | |
| 686 | } | |
| 1382 | if (wide) | |
| 1383 | ram_val = buggyboy_vram[((y_offs << 4) & 0xf80) + ((x_offs >> 3) & 0x7f)]; | |
| 1384 | else | |
| 1385 | ram_val = buggyboy_vram[((y_offs << 3) & 0x7c0) + ((x_offs >> 3) & 0x3f)]; | |
| 687 | 1386 | |
| 688 | static TILE_GET_INFO( get_buggyboy_tile_info ) | |
| 689 | { | |
| 690 | int color, tilenum; | |
| 1387 | tilenum = (ram_val & 0x03ff) | ((ram_val & 0x8000) >> 5); | |
| 1388 | colour = (ram_val & 0xfc00) >> 8; | |
| 1389 | d0 = *(gfx2 + (tilenum << 3) + y_gran); | |
| 1390 | d1 = *(gfx1 + (tilenum << 3) + y_gran); | |
| 1391 | } | |
| 691 | 1392 | |
| 692 | color = (buggyboy_vram[tile_index] >> 10) & 0x3f; | |
| 693 | tilenum = (buggyboy_vram[tile_index]&0x03ff) | ((buggyboy_vram[tile_index] & 0x8000) >> 5); | |
| 1393 | for (x = 0; x < total_width; ++x) | |
| 1394 | { | |
| 1395 | UINT32 x_gran = x_offs & 7; | |
| 694 | 1396 | |
| 695 | SET_TILE_INFO(0, tilenum, color, 0); | |
| 1397 | if (!x_gran) | |
| 1398 | { | |
| 1399 | UINT32 tilenum; | |
| 1400 | UINT16 ram_val; | |
| 1401 | ||
| 1402 | if (wide) | |
| 1403 | ram_val = buggyboy_vram[((y_offs << 4) & 0xf80) + ((x_offs >> 3) & 0x7f)]; | |
| 1404 | else | |
| 1405 | ram_val = buggyboy_vram[((y_offs << 3) & 0x7c0) + ((x_offs >> 3) & 0x3f)]; | |
| 1406 | ||
| 1407 | tilenum = (ram_val & 0x03ff) | ((ram_val & 0x8000) >> 5); | |
| 1408 | colour = (ram_val & 0xfc00) >> 8; | |
| 1409 | d0 = *(gfx2 + (tilenum << 3) + y_gran); | |
| 1410 | d1 = *(gfx1 + (tilenum << 3) + y_gran); | |
| 1411 | } | |
| 1412 | ||
| 1413 | *bitmap++ = colour | | |
| 1414 | (((d1 >> (7 ^ x_gran)) & 1) << 1) | | |
| 1415 | ((d0 >> (7 ^ x_gran)) & 1); | |
| 1416 | ||
| 1417 | x_offs = (x_offs + 1) & x_mask; | |
| 1418 | } | |
| 1419 | } | |
| 696 | 1420 | } |
| 697 | 1421 | |
| 1422 | ||
| 698 | 1423 | /*************************************************************************** |
| 699 | 1424 | |
| 700 | 1425 | Buggy Boy Road Hardware |
| r3333 | r3334 | |
| 732 | 1457 | http://philwip.mameworld.info/buggyboy/PAL16L8.150.htm |
| 733 | 1458 | |
| 734 | 1459 | ***************************************************************************/ |
| 735 | static void buggybjr_draw_road(running_machine *machine, UINT8 *bitmap) | |
| 1460 | ||
| 1461 | static void buggybjr_draw_road(running_machine *machine, UINT8 *bitmap, int wide) | |
| 736 | 1462 | { |
| 737 | 1463 | #define X_ADJUST 384 |
| 738 | 1464 | #define LOAD_HPOS_COUNTER( NUM ) \ |
| r3333 | r3334 | |
| 833 | 1559 | |
| 834 | 1560 | UINT32 bank_cnt; |
| 835 | 1561 | UINT8 roadpix; |
| 1562 | UINT32 _rorevcs = 0; | |
| 836 | 1563 | |
| 837 | 1564 | rva8 = (vregs.h_val & 0x8000) || !(vregs.shift & 0x80); |
| 838 | 1565 | |
| r3333 | r3334 | |
| 907 | 1634 | UINT32 rom_en; |
| 908 | 1635 | UINT32 pix; |
| 909 | 1636 | UINT32 hp0_en, hp1_en, hp2_en, hp3_en; |
| 910 | UINT32 _rorevcs = 0; | |
| 911 | 1637 | |
| 912 | 1638 | /* The many PALs */ |
| 913 | 1639 | |
| r3333 | r3334 | |
| 948 | 1674 | hp2_en = !(hp2_cy || hps22); |
| 949 | 1675 | hp3_en = !(hp3_cy || hps32); |
| 950 | 1676 | |
| 951 | _rorevcs = !( (rom_en && rom_flip) || (!rom_en && (ls161 & 0x4000)) ); | |
| 952 | ||
| 953 | 1677 | /* Load in a new road gfx strip */ |
| 954 | 1678 | if ( (ls161 & 7) == 0 ) |
| 955 | 1679 | { |
| 956 | 1680 | UINT8 d0 = 0; |
| 957 | 1681 | UINT8 d1 = 0; |
| 958 | 1682 | |
| 1683 | /* I think it's correct to latch it here */ | |
| 1684 | _rorevcs = !( (rom_en && rom_flip) || (!rom_en && (ls161 & 0x4000)) ); | |
| 1685 | ||
| 959 | 1686 | /* TODO: ROM data is 0xff if not enabled. */ |
| 960 | 1687 | if (rom_en) |
| 961 | 1688 | { |
| r3333 | r3334 | |
| 1228 | 1955 | /* Finally, increment the banking accumulator */ |
| 1229 | 1956 | vregs.ba_val = (vregs.ba_val + vregs.ba_inc) & 0x00ffffff; |
| 1230 | 1957 | } |
| 1231 | ||
| 1232 | profiler_mark(PROFILER_END); | |
| 1233 | 1958 | } |
| 1234 | 1959 | |
| 1235 | 1960 | |
| r3333 | r3334 | |
| 1255 | 1980 | ------xx xxxxxxxx X position |
| 1256 | 1981 | |
| 1257 | 1982 | **************************************************************************/ |
| 1258 | static void buggyboy_draw_objs(running_machine *machine, UINT8 *bitmap) | |
| 1983 | ||
| 1984 | static void buggyboy_draw_objs(running_machine *machine, UINT8 *bitmap, int wide) | |
| 1259 | 1985 | { |
| 1260 | 1986 | #define FRAC 16 |
| 1261 | 1987 | |
| 1262 | 1988 | UINT32 offs; |
| 1263 | 1989 | |
| 1990 | UINT32 x_mask; | |
| 1991 | UINT32 x_stride; | |
| 1992 | ||
| 1264 | 1993 | /* The many lookup table ROMs */ |
| 1265 | 1994 | const UINT8 *const bug13 = (UINT8*)memory_region(machine, "user3"); |
| 1266 | 1995 | const UINT8 *const bug18s = (UINT8*)memory_region(machine, "user3") + 0x2000; |
| r3333 | r3334 | |
| 1274 | 2003 | |
| 1275 | 2004 | const UINT8 *const pixdata_rgn = (UINT8*)memory_region(machine, "gfx2"); |
| 1276 | 2005 | |
| 1277 | profiler_mark(PROFILER_USER2); | |
| 2006 | if (wide) | |
| 2007 | { | |
| 2008 | x_mask = 0x7ff; // ??????? | |
| 2009 | x_stride = 768; | |
| 2010 | } | |
| 2011 | else | |
| 2012 | { | |
| 2013 | x_mask = 0x3ff; | |
| 2014 | x_stride = 256; | |
| 2015 | } | |
| 1278 | 2016 | |
| 1279 | 2017 | for (offs = 0; offs <= buggyboy_objram_size; offs += 8) |
| 1280 | 2018 | { |
| r3333 | r3334 | |
| 1368 | 2106 | x_acc = (psa0_12 & 0xff) << (FRAC + 5); |
| 1369 | 2107 | |
| 1370 | 2108 | /* TODO Add note */ |
| 1371 | x = buggyboy_objram[offs + 4] & | |
| 2109 | x = buggyboy_objram[offs + 4] & | |
| 1372 | 2110 | |
| 1373 | 2111 | for (;;) |
| 1374 | 2112 | { |
| 1375 | #define MASK 0x3ff | |
| 1376 | ||
| 1377 | 2113 | /* Get data and attributes for an 8x8 tile */ |
| 1378 | 2114 | if (newtile) |
| 1379 | 2115 | { |
| r3333 | r3334 | |
| 1383 | 2119 | UINT32 rombank; |
| 1384 | 2120 | UINT8 *romptr; |
| 1385 | 2121 | UINT32 bug18s_data; |
| 1386 | UINT32 low_addr = ((x_acc >> (FRAC + 3)) & | |
| 2122 | UINT32 low_addr = ((x_acc >> (FRAC + 3)) & x_mask); | |
| 1387 | 2123 | |
| 1388 | 2124 | /* |
| 1389 | 2125 | Objects are grouped by width (either 16, 8 or 4 tiles) in |
| r3333 | r3334 | |
| 1449 | 2185 | } |
| 1450 | 2186 | |
| 1451 | 2187 | /* Draw a pixel? */ |
| 1452 | if (x < | |
| 2188 | if (x < x_stride) | |
| 1453 | 2189 | { |
| 1454 | 2190 | UINT8 pix; |
| 1455 | 2191 | UINT8 bit; |
| r3333 | r3334 | |
| 1476 | 2212 | else |
| 1477 | 2213 | color = ~(color | bb9e[bb9_addr]) & 0x3f; |
| 1478 | 2214 | |
| 1479 | *(bitmap + | |
| 2215 | *(bitmap + x_stride*y + x) = 0x40 | color; | |
| 1480 | 2216 | } |
| 1481 | 2217 | } |
| 1482 | 2218 | |
| 1483 | 2219 | /* Check if we've stepped into a new 8x8 tile */ |
| 1484 | if ( (((x_acc + x_step) >> (FRAC + 3)) & | |
| 2220 | if ( (((x_acc + x_step) >> (FRAC + 3)) & x_mask) != ((x_acc >> (FRAC + 3)) & x_mask) ) | |
| 1485 | 2221 | { |
| 1486 | 2222 | if (lasttile) |
| 1487 | 2223 | break; |
| r3333 | r3334 | |
| 1489 | 2225 | newtile = 1; |
| 1490 | 2226 | } |
| 1491 | 2227 | |
| 1492 | ||
| 2228 | ||
| 1493 | 2229 | x_acc += x_step; |
| 1494 | 2230 | } |
| 1495 | 2231 | }// if (yscale) |
| 1496 | 2232 | y_scale += y_step; |
| 1497 | 2233 | } /* for (y) */ |
| 1498 | 2234 | }/* for (offs) */ |
| 1499 | ||
| 1500 | profiler_mark(PROFILER_END); | |
| 1501 | 2235 | } |
| 1502 | 2236 | |
| 1503 | 2237 | |
| 2238 | /************************************* | |
| 2239 | * | |
| 2240 | * Video Control Registers | |
| 2241 | * | |
| 2242 | *************************************/ | |
| 2243 | ||
| 1504 | 2244 | /* |
| 1505 | 2245 | 2400-24FF is road control (R/W) |
| 1506 | 2246 | |
| r3333 | r3334 | |
| 1524 | 2264 | vregs.ba_inc &= ~0x0000ffff; |
| 1525 | 2265 | vregs.ba_inc |= data; |
| 1526 | 2266 | |
| 1527 | if ( | |
| 2267 | if ( | |
| 1528 | 2268 | vregs.ba_val &= ~0x0000ffff; |
| 1529 | 2269 | |
| 1530 | 2270 | break; |
| r3333 | r3334 | |
| 1537 | 2277 | |
| 1538 | 2278 | vregs.bank_mode = data & 1; |
| 1539 | 2279 | |
| 1540 | if ( | |
| 2280 | if ( | |
| 1541 | 2281 | vregs.ba_val &= ~0xffff0000; |
| 1542 | 2282 | |
| 1543 | 2283 | break; |
| r3333 | r3334 | |
| 1545 | 2285 | case 0x40: |
| 1546 | 2286 | { |
| 1547 | 2287 | /* Ignore data? */ |
| 1548 | if ( offset & 2 ) | |
| 1549 | { | |
| 2288 | if (offset & 2) | |
| 1550 | 2289 | vregs.ba_val = (vregs.ba_inc + vregs.ba_val) & 0x00ffffff; |
| 1551 | } | |
| 1552 | 2290 | |
| 1553 | 2291 | break; |
| 1554 | 2292 | } |
| r3333 | r3334 | |
| 1557 | 2295 | vregs.h_inc = data; |
| 1558 | 2296 | vregs.shift = 0; |
| 1559 | 2297 | |
| 1560 | if ( | |
| 2298 | if ( | |
| 1561 | 2299 | vregs.h_val = 0; |
| 1562 | 2300 | |
| 1563 | 2301 | break; |
| r3333 | r3334 | |
| 1565 | 2303 | case 0x80: |
| 1566 | 2304 | { |
| 1567 | 2305 | /* Ignore data? */ |
| 1568 | if ( | |
| 2306 | if ( | |
| 1569 | 2307 | vregs.h_val += vregs.h_inc; |
| 1570 | 2308 | break; |
| 1571 | 2309 | } |
| r3333 | r3334 | |
| 1607 | 2345 | } |
| 1608 | 2346 | |
| 1609 | 2347 | |
| 2348 | /************************************* | |
| 2349 | * | |
| 2350 | * Core Functions | |
| 2351 | * | |
| 2352 | *************************************/ | |
| 1610 | 2353 | |
| 1611 | ||
| 2354 | static | |
| 1612 | 2355 | { |
| 1613 | buggyboy_tilemap = tilemap_create(get_buggyboy_tile_info, tilemap_scan_rows, 8, 8, 128, 64); | |
| 1614 | tilemap_set_transparent_pen(buggyboy_tilemap, 0); | |
| 1615 | } | |
| 2356 | UINT8 *chr_pal = memory_region(machine, "proms") + 0x400; | |
| 2357 | UINT32 bmp_stride; | |
| 2358 | UINT32 x_offset; | |
| 2359 | UINT32 y; | |
| 1616 | 2360 | |
| 1617 | ||
| 1618 | ||
| 1619 | VIDEO_UPDATE( buggyboy ) | |
| 1620 | { | |
| 1621 | int xscrollamount = 0; | |
| 1622 | ||
| 1623 | const device_config *left_screen = device_list_find_by_tag(screen->machine->config->devicelist, VIDEO_SCREEN, "left"); | |
| 1624 | const device_config *center_screen = device_list_find_by_tag(screen->machine->config->devicelist, VIDEO_SCREEN, "center"); | |
| 1625 | const device_config *right_screen = device_list_find_by_tag(screen->machine->config->devicelist, VIDEO_SCREEN, "right"); | |
| 1626 | ||
| 1627 | /* The video hardware seems to use one large tilemap, scroll it to the right position for each screen */ | |
| 1628 | if ( screen == left_screen ) | |
| 1629 | xscrollamount = 0 * 256; | |
| 1630 | else if ( screen == center_screen ) | |
| 1631 | xscrollamount = 1 * 256; | |
| 1632 | else if ( screen == right_screen ) | |
| 1633 | xscrollamount = 2 * 256; | |
| 1634 | ||
| 1635 | tilemap_set_scrollx(buggyboy_tilemap, 0, xscrollamount); | |
| 1636 | tilemap_draw(bitmap, cliprect, buggyboy_tilemap, TILEMAP_DRAW_OPAQUE, 0); | |
| 1637 | return 0; | |
| 1638 | } | |
| 1639 | ||
| 1640 | ||
| 1641 | VIDEO_EOF( buggyboy ) | |
| 1642 | { | |
| 1643 | /* /VSYNC: Update TZ113 @ 219 */ | |
| 1644 | vregs.slin += vregs.slin_inc; | |
| 1645 | ||
| 1646 | /* /VSYNC: Clear wave LFSR */ | |
| 1647 | vregs.wave_lfsr = 0; | |
| 1648 | } | |
| 1649 | ||
| 1650 | ||
| 1651 | VIDEO_START( buggybjr ) | |
| 1652 | { | |
| 1653 | /* Allocate some bitmaps */ | |
| 1654 | chr_bmp = auto_malloc(sizeof(UINT8) * 256 * 240); | |
| 1655 | obj_bmp = auto_malloc(sizeof(UINT8) * 256 * 240); | |
| 1656 | rod_bmp = auto_malloc(sizeof(UINT8) * 256 * 240); | |
| 1657 | } | |
| 1658 | ||
| 1659 | /* | |
| 1660 | Draw the tilemap with scrolling | |
| 1661 | */ | |
| 1662 | static void buggyboy_draw_char(running_machine *machine, UINT8 *bitmap) | |
| 1663 | { | |
| 1664 | INT32 x, y; | |
| 1665 | UINT32 scroll_x, scroll_y; | |
| 1666 | UINT8 *gfx1, *gfx2; | |
| 1667 | ||
| 1668 | profiler_mark(PROFILER_USER3); | |
| 1669 | ||
| 1670 | /* 2bpp characters */ | |
| 1671 | gfx1 = memory_region(machine, "gfx1"); | |
| 1672 | gfx2 = memory_region(machine, "gfx1") + 0x4000; | |
| 1673 | ||
| 1674 | /* X/Y scroll values are the last word in char RAM */ | |
| 1675 | scroll_y = (buggybjr_vram[0x7ff] >> 10) & 0x3f; | |
| 1676 | scroll_x = buggybjr_vram[0x7ff] & 0x1ff; | |
| 1677 | ||
| 1678 | for (y = 0; y < 240; ++y) | |
| 2361 | if (screen < 0) | |
| 1679 | 2362 | { |
| 1680 | UINT32 d0 = 0, d1 = 0; | |
| 1681 | UINT32 colour = 0; | |
| 1682 | UINT32 y_offs; | |
| 1683 | UINT32 x_offs; | |
| 1684 | UINT32 y_gran; | |
| 1685 | ||
| 1686 | /* There's no y-scrolling between scanlines 0 and 1 */ | |
| 1687 | if (y < 64) | |
| 1688 | y_offs = y; | |
| 1689 | else | |
| 1690 | { | |
| 1691 | y_offs = (y + (scroll_y | 0xc0) + 1) & 0xff; | |
| 1692 | ||
| 1693 | /* Clamp */ | |
| 1694 | if (y_offs < 64) | |
| 1695 | y_offs |= 0xc0; | |
| 1696 | } | |
| 1697 | ||
| 1698 | if ( (y_offs >= 64) && (y_offs < 128) ) | |
| 1699 | x_offs = scroll_x; | |
| 1700 | else | |
| 1701 | x_offs = 0; | |
| 1702 | ||
| 1703 | ||
| 1704 | y_gran = y_offs & 7; | |
| 1705 | ||
| 1706 | if (x_offs & 7) | |
| 1707 | { | |
| 1708 | UINT32 tilenum; | |
| 1709 | UINT16 ram_val = buggybjr_vram[((y_offs << 3) & 0x7c0) + ((x_offs >> 3) & 0x3f)]; | |
| 1710 | ||
| 1711 | tilenum = (ram_val & 0x03ff) | ((ram_val & 0x8000) >> 5); | |
| 1712 | colour = (ram_val & 0xfc00) >> 8; | |
| 1713 | d0 = *(gfx2 + (tilenum << 3) + y_gran); | |
| 1714 | d1 = *(gfx1 + (tilenum << 3) + y_gran); | |
| 1715 | } | |
| 1716 | ||
| 1717 | for (x = 0; x < 256; ++x) | |
| 1718 | { | |
| 1719 | UINT32 x_gran = x_offs & 7; | |
| 1720 | ||
| 1721 | if (!x_gran) | |
| 1722 | { | |
| 1723 | UINT32 tilenum; | |
| 1724 | UINT16 ram_val = buggybjr_vram[((y_offs << 3) & 0x7c0) + ((x_offs >> 3) & 0x3f)]; | |
| 1725 | ||
| 1726 | tilenum = (ram_val & 0x03ff) | ((ram_val & 0x8000) >> 5); | |
| 1727 | colour = (ram_val & 0xfc00) >> 8; | |
| 1728 | d0 = *(gfx2 + (tilenum << 3) + y_gran); | |
| 1729 | d1 = *(gfx1 + (tilenum << 3) + y_gran); | |
| 1730 | } | |
| 1731 | ||
| 1732 | *bitmap++ = colour | | |
| 1733 | (((d1 >> (7 ^ x_gran)) & 1) << 1) | | |
| 1734 | ((d0 >> (7 ^ x_gran)) & 1); | |
| 1735 | ||
| 1736 | x_offs = (x_offs + 1) & 0x1ff; | |
| 1737 | } | |
| 1738 | ||
| 2363 | bmp_stride = 256; | |
| 2364 | x_offset = 0; | |
| 1739 | 2365 | } |
| 2366 | else | |
| 2367 | { | |
| 2368 | bmp_stride = 768; | |
| 2369 | x_offset = 256 * screen; | |
| 2370 | } | |
| 1740 | 2371 | |
| 1741 | profiler_mark(PROFILER_END); | |
| 1742 | } | |
| 1743 | ||
| 1744 | VIDEO_UPDATE( buggybjr ) | |
| 1745 | { | |
| 1746 | int x, y; | |
| 1747 | UINT8 *chr_pal = (memory_region(screen->machine, "proms") + 0x400); | |
| 1748 | ||
| 1749 | memset(obj_bmp, 0, 256*240); | |
| 1750 | ||
| 1751 | buggyboy_draw_char(screen->machine, chr_bmp); | |
| 1752 | buggybjr_draw_road(screen->machine, rod_bmp); | |
| 1753 | buggyboy_draw_objs(screen->machine, obj_bmp); | |
| 1754 | ||
| 1755 | 2372 | for (y = 0; y < 240; ++y) |
| 1756 | 2373 | { |
| 1757 | UINT | |
| 2374 | UINT32 x | |
| 1758 | 2375 | |
| 1759 | UINT8 *chr_addr = chr_bmp + (y * 256); | |
| 1760 | UINT8 *rod_addr = rod_bmp + (y * 256); | |
| 1761 | UINT8 *obj_addr = obj_bmp + (y * 256); | |
| 2376 | UINT32 bmp_offset = y * bmp_stride + x_offset; | |
| 1762 | 2377 | |
| 2378 | UINT8 *chr_addr = bb_chr_bmp + bmp_offset; | |
| 2379 | UINT8 *rod_addr = bb_rod_bmp + bmp_offset; | |
| 2380 | UINT8 *obj_addr = bb_obj_bmp + bmp_offset; | |
| 2381 | ||
| 1763 | 2382 | UINT32 sky_en = BIT(vregs.sky, 7); |
| 1764 | 2383 | UINT32 sky_val = (((vregs.sky & 0x7f) + y) >> 2) & 0x3f; |
| 1765 | 2384 | |
| 2385 | UINT16 *bmp_addr = BITMAP_ADDR16(bitmap, y, 0); | |
| 2386 | ||
| 1766 | 2387 | for (x = 0; x < 256; ++x) |
| 1767 | 2388 | { |
| 1768 | 2389 | UINT32 out_val; |
| r3333 | r3334 | |
| 1795 | 2416 | *bmp_addr++ = (sel << 6) + out_val; |
| 1796 | 2417 | } |
| 1797 | 2418 | } |
| 2419 | } | |
| 1798 | 2420 | |
| 2421 | VIDEO_START( buggyboy ) | |
| 2422 | { | |
| 2423 | /* Allocate some bitmaps */ | |
| 2424 | bb_chr_bmp = auto_malloc(sizeof(UINT8) * 3 * 256 * 240); | |
| 2425 | bb_obj_bmp = auto_malloc(sizeof(UINT8) * 3 * 256 * 240); | |
| 2426 | bb_rod_bmp = auto_malloc(sizeof(UINT8) * 3 * 256 * 240); | |
| 2427 | } | |
| 2428 | ||
| 2429 | VIDEO_START( buggybjr ) | |
| 2430 | { | |
| 2431 | /* Allocate some bitmaps */ | |
| 2432 | bb_chr_bmp = auto_malloc(sizeof(UINT8) * 256 * 240); | |
| 2433 | bb_obj_bmp = auto_malloc(sizeof(UINT8) * 256 * 240); | |
| 2434 | bb_rod_bmp = auto_malloc(sizeof(UINT8) * 256 * 240); | |
| 2435 | } | |
| 2436 | ||
| 2437 | VIDEO_EOF( buggyboy ) | |
| 2438 | { | |
| 2439 | /* /VSYNC: Update TZ113 @ 219 */ | |
| 2440 | vregs.slin += vregs.slin_inc; | |
| 2441 | ||
| 2442 | /* /VSYNC: Clear wave LFSR */ | |
| 2443 | vregs.wave_lfsr = 0; | |
| 2444 | } | |
| 2445 | ||
| 2446 | ||
| 2447 | VIDEO_UPDATE( buggyboy ) | |
| 2448 | { | |
| 2449 | const device_config *left_screen = device_list_find_by_tag(screen->machine->config->devicelist, VIDEO_SCREEN, "left"); | |
| 2450 | const device_config *center_screen = device_list_find_by_tag(screen->machine->config->devicelist, VIDEO_SCREEN, "center"); | |
| 2451 | const device_config *right_screen = device_list_find_by_tag(screen->machine->config->devicelist, VIDEO_SCREEN, "right"); | |
| 2452 | ||
| 2453 | if (screen == left_screen) | |
| 2454 | { | |
| 2455 | memset(bb_obj_bmp, 0, 768*240); | |
| 2456 | ||
| 2457 | buggyboy_draw_char(screen->machine, bb_chr_bmp, 1); | |
| 2458 | // buggyboy_draw_road(screen->machine, bb_rod_bmp, 1); | |
| 2459 | buggyboy_draw_objs(screen->machine, bb_obj_bmp, 1); | |
| 2460 | ||
| 2461 | bb_combine_layers(screen->machine, bitmap, 0); | |
| 2462 | } | |
| 2463 | else if (screen == center_screen) | |
| 2464 | { | |
| 2465 | bb_combine_layers(screen->machine, bitmap, 1); | |
| 2466 | } | |
| 2467 | else if (screen == right_screen) | |
| 2468 | { | |
| 2469 | bb_combine_layers(screen->machine, bitmap, 2); | |
| 2470 | } | |
| 2471 | ||
| 1799 | 2472 | return 0; |
| 2473 | ||
| 1800 | 2474 | } |
| 2475 | ||
| 2476 | VIDEO_UPDATE( buggybjr ) | |
| 2477 | { | |
| 2478 | memset(bb_obj_bmp, 0, 256*240); | |
| 2479 | ||
| 2480 | buggyboy_draw_char(screen->machine, bb_chr_bmp, 0); | |
| 2481 | buggybjr_draw_road(screen->machine, bb_rod_bmp, 0); | |
| 2482 | buggyboy_draw_objs(screen->machine, bb_obj_bmp, 0); | |
| 2483 | ||
| 2484 | bb_combine_layers(screen->machine, bitmap, -1); | |
| 2485 | return 0; | |
| 2486 | } |
| r3333 | r3334 | |
|---|---|---|
| 42 | 42 | 0*8, 28*8-1 |
| 43 | 43 | }; |
| 44 | 44 | |
| 45 | static const res_net_decode_info naughtyb_decode_info = | |
| 46 | { | |
| 47 | 2, /* two proms */ | |
| 48 | 0, /* start at 0 */ | |
| 49 | 255, /* end at 255 */ | |
| 50 | /* R, G, B, R, G, B */ | |
| 51 | { 0, 0, 0, 256, 256, 256}, /* offsets */ | |
| 52 | { 0, 2, 1, -1, 1, 0}, /* shifts */ | |
| 53 | {0x01,0x01,0x01,0x02,0x02,0x02} /* masks */ | |
| 54 | }; | |
| 45 | 55 | |
| 56 | static const res_net_info naughtyb_net_info = | |
| 57 | { | |
| 58 | RES_NET_VCC_5V | RES_NET_VBIAS_5V | RES_NET_VIN_OPEN_COL, | |
| 59 | { | |
| 60 | { RES_NET_AMP_NONE, 130, 270, 2, { 270, 1 } }, /* no resistor for bit1 */ | |
| 61 | { RES_NET_AMP_NONE, 130, 270, 2, { 270, 1 } }, /* no resistor for bit1 */ | |
| 62 | { RES_NET_AMP_NONE, 130, 270, 2, { 270, 1 } } /* no resistor for bit1 */ | |
| 63 | } | |
| 64 | }; | |
| 46 | 65 | |
| 47 | 66 | /*************************************************************************** |
| 48 | 67 | |
| r3333 | r3334 | |
| 50 | 69 | |
| 51 | 70 | Naughty Boy has two 256x4 palette PROMs, one containing the high bits and |
| 52 | 71 | the other the low bits (2x2x2 color space). |
| 53 | The palette PROMs are connected to the RGB output this way: | |
| 72 | The palette PROMs are connected to a 7407 (hex open collector buffer), | |
| 73 | which in turn is connected to the RGB output this way: | |
| 54 | 74 | |
| 55 | 75 | bit 3 -- |
| 56 | 76 | -- 270 ohm resistor -- GREEN |
| r3333 | r3334 | |
| 62 | 82 | -- BLUE |
| 63 | 83 | bit 0 -- RED |
| 64 | 84 | |
| 65 | plus | |
| 85 | plus 130 ohm pullup and 270 ohm pulldown resistors on all lines | |
| 66 | 86 | |
| 67 | 87 | ***************************************************************************/ |
| 88 | ||
| 68 | 89 | PALETTE_INIT( naughtyb ) |
| 69 | 90 | { |
| 70 | /* note: there is no resistor on second PROM so we define second resistance as 0 */ | |
| 71 | static const int resistances[2] = { 270, 0 }; | |
| 72 | double rweights[2], gweights[2], bweights[2]; | |
| 91 | rgb_t *rgb; | |
| 73 | 92 | int i; |
| 74 | 93 | |
| 75 | /* compute the color output resistor weights */ | |
| 76 | compute_resistor_weights(0, 255, -1.0, | |
| 77 | 2, resistances, rweights, 270, 270, | |
| 78 | 2, resistances, gweights, 270, 270, | |
| 79 | 2, resistances, bweights, 270, 270); | |
| 94 | rgb = compute_res_net_all(color_prom, &naughtyb_decode_info, &naughtyb_net_info); | |
| 80 | 95 | |
| 81 | 96 | for (i = 0; i < 0x100; i++) |
| 82 | { | |
| 83 | int bit0, bit1; | |
| 84 | int r, g, b; | |
| 85 | int swapped_i; | |
| 97 | palette_set_color(machine, BITSWAP8(i,5,7,6,2,1,0,4,3), rgb[i]); | |
| 86 | 98 | |
| 87 | /* red component */ | |
| 88 | bit0 = (color_prom[i | 0x000] >> 0) & 0x01; | |
| 89 | bit1 = (color_prom[i | 0x100] >> 0) & 0x01; | |
| 90 | r = combine_2_weights(rweights, bit0, bit1); | |
| 91 | ||
| 92 | /* green component */ | |
| 93 | bit0 = (color_prom[i | 0x000] >> 2) & 0x01; | |
| 94 | bit1 = (color_prom[i | 0x100] >> 2) & 0x01; | |
| 95 | g = combine_2_weights(gweights, bit0, bit1); | |
| 96 | ||
| 97 | /* blue component */ | |
| 98 | bit0 = (color_prom[i | 0x000] >> 1) & 0x01; | |
| 99 | bit1 = (color_prom[i | 0x100] >> 1) & 0x01; | |
| 100 | b = combine_2_weights(bweights, bit0, bit1); | |
| 101 | ||
| 102 | swapped_i = BITSWAP8(i,5,7,6,2,1,0,4,3); | |
| 103 | palette_set_color(machine, swapped_i, MAKE_RGB(r, g, b)); | |
| 104 | } | |
| 99 | palette_normalize_range(machine->palette, 0, 255, 0, 255); | |
| 105 | 100 | } |
| 106 | 101 | |
| 107 | 102 | |
| 108 | ||
| 109 | 103 | /*************************************************************************** |
| 110 | 104 | |
| 111 | 105 | Start the video hardware emulation. |
| r3333 | r3334 | |
|---|---|---|
| 35 | 35 | |
| 36 | 36 | static emu_timer *sprite_line_timer; |
| 37 | 37 | |
| 38 | static const UINT8 *region_zoomy; | |
| 38 | 39 | |
| 39 | 40 | |
| 40 | 41 | /************************************* |
| r3333 | r3334 | |
| 504 | 505 | } |
| 505 | 506 | } |
| 506 | 507 | |
| 507 | sprite_y_and_tile = | |
| 508 | sprite_y_and_tile = | |
| 508 | 509 | sprite_y = sprite_y_and_tile & 0x0f; |
| 509 | 510 | tile = sprite_y_and_tile >> 4; |
| 510 | 511 | |
| r3333 | r3334 | |
| 902 | 903 | state_save_register_global(auto_animation_frame_counter); |
| 903 | 904 | |
| 904 | 905 | state_save_register_postload(machine, regenerate_pens, NULL); |
| 906 | ||
| 907 | region_zoomy = memory_region(machine, "zoomy"); | |
| 905 | 908 | } |
| 906 | 909 | |
| 907 | 910 |
| r3333 | r3334 | |
|---|---|---|
| 245 | 245 | static const struct F3config f3_config_table[] = |
| 246 | 246 | { |
| 247 | 247 | /* Name Extend Lag Bpp */ |
| 248 | { RINGRAGE, 0, 2, | |
| 248 | { RINGRAGE, 0, 2, 4, 4 }, | |
| 249 | 249 | { ARABIANM, 0, 2, 5, 5 }, /* sprites 1200-120F contain 6bpp pixels but this seems to be a data error */ |
| 250 | 250 | { RIDINGF, 1, 1, 4, 4 }, |
| 251 | 251 | { GSEEKER, 0, 1, 4, 4 }, |
| r3333 | r3334 | |
| 270 | 270 | { KTIGER2, 0, 0, 4, 4 }, |
| 271 | 271 | { BUBBLEM, 1, 1, 4, 5 }, |
| 272 | 272 | { CLEOPATR, 0, 1, 4, 6 }, |
| 273 | { PBOBBLE3, 0, 1, 4, | |
| 273 | { PBOBBLE3, 0, 1, 4, 4 }, | |
| 274 | 274 | { ARKRETRN, 1, 1, 5, 6 }, |
| 275 | 275 | { KIRAMEKI, 0, 1, 5, 6 }, |
| 276 | 276 | { PUCHICAR, 1, 1, 5, 6 }, |
| 277 | { PBOBBLE4, 0, 1, 4, | |
| 277 | { PBOBBLE4, 0, 1, 4, 4 }, | |
| 278 | 278 | { POPNPOP, 1, 1, 6, 6 }, |
| 279 | 279 | { LANDMAKR, 1, 1, 5, 6 }, |
| 280 | 280 | {0} |
| r3333 | r3334 | |
| 690 | 690 | tilemap_set_transparent_pen(vram_layer,0); |
| 691 | 691 | tilemap_set_transparent_pen(pixel_layer,0); |
| 692 | 692 | |
| 693 | // Palettes have 4 bpp indexes despite up to 6 bpp data. The unused | |
| 694 | // top bits in the gfx data are cleared later. | |
| 693 | /* Palettes have 4 bpp indexes despite up to 6 bpp data. The unused */ | |
| 694 | /* top bits in the gfx data are cleared later. */ | |
| 695 | 695 | machine->gfx[1]->color_granularity=16; |
| 696 | 696 | machine->gfx[2]->color_granularity=16; |
| 697 | 697 | |
| r3333 | r3334 | |
| 2557 | 2557 | |
| 2558 | 2558 | /* |
| 2559 | 2559 | sprite priority==playfield priority |
| 2560 | GSEEKER (plane leaving hangar) --> sprite | |
| 2560 | 2561 | BUBSYMPH (title) ---> sprite |
| 2561 | 2562 | DARIUSG (ZONE V' BOSS) ---> playfield |
| 2562 | 2563 | */ |
| 2563 | 2564 | |
| 2564 | 2565 | if (f3_game == BUBSYMPH ) sp++; //BUBSYMPH (title) |
| 2566 | if (f3_game == GSEEKER ) sp++; //GSEEKER (plane leaving hangar) | |
| 2565 | 2567 | |
| 2566 | 2568 | if( sp>l0) sprite[0]|=sflg; |
| 2567 | 2569 | else if(sp<=l0 && sp>l1) sprite[1]|=sflg; |
| r3333 | r3334 | |
|---|---|---|
| 979 | 979 | ROM_END |
| 980 | 980 | |
| 981 | 981 | |
| 982 | DRIVER_INIT( starforc ) | |
| 982 | static DRIVER_INIT( starforc ) | |
| 983 | 983 | { |
| 984 | 984 | is_senjyo = 0; |
| 985 | 985 | senjyo_scrollhack = 1; |
| 986 | 986 | } |
| 987 | DRIVER_INIT( starfore ) | |
| 987 | static DRIVER_INIT( starfore ) | |
| 988 | 988 | { |
| 989 | 989 | /* encrypted CPU */ |
| 990 | 990 | suprloco_decode(machine, "main"); |
| r3333 | r3334 | |
| 993 | 993 | senjyo_scrollhack = 0; |
| 994 | 994 | } |
| 995 | 995 | |
| 996 | DRIVER_INIT( starfora ) | |
| 996 | static DRIVER_INIT( starfora ) | |
| 997 | 997 | { |
| 998 | 998 | /* encrypted CPU */ |
| 999 | 999 | yamato_decode(machine, "main"); |
| r3333 | r3334 | |
| 1002 | 1002 | senjyo_scrollhack = 1; |
| 1003 | 1003 | } |
| 1004 | 1004 | |
| 1005 | DRIVER_INIT( senjyo ) | |
| 1005 | static DRIVER_INIT( senjyo ) | |
| 1006 | 1006 | { |
| 1007 | 1007 | is_senjyo = 1; |
| 1008 | 1008 | senjyo_scrollhack = 0; |
| r3333 | r3334 | |
|---|---|---|
| 395 | 395 | ADDRESS_MAP_END |
| 396 | 396 | |
| 397 | 397 | |
| 398 | #define COINAGE_PORT \ | |
| 399 | PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW A:1,2,3,4") \ | |
| 400 | PORT_DIPSETTING( 0x07, DEF_STR( 4C_1C ) ) \ | |
| 401 | PORT_DIPSETTING( 0x08, DEF_STR( 3C_1C ) ) \ | |
| 402 | PORT_DIPSETTING( 0x09, DEF_STR( 2C_1C ) ) \ | |
| 403 | PORT_DIPSETTING( 0x05, "2 Coins/1 Credit 4/2 5/3 6/4" ) \ | |
| 404 | PORT_DIPSETTING( 0x04, "2 Coins/1 Credit 4/3" ) \ | |
| 405 | PORT_DIPSETTING( 0x0f, DEF_STR( 1C_1C ) ) \ | |
| 406 | /* PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) Not allowed by mame coinage sorting, but valid */ \ | |
| 407 | PORT_DIPSETTING( 0x03, "1 Coin/1 Credit 5/6" ) \ | |
| 408 | PORT_DIPSETTING( 0x02, "1 Coin/1 Credit 4/5" ) \ | |
| 409 | PORT_DIPSETTING( 0x01, "1 Coin/1 Credit 2/3" ) \ | |
| 410 | PORT_DIPSETTING( 0x06, DEF_STR( 2C_3C ) ) \ | |
| 411 | PORT_DIPSETTING( 0x0e, DEF_STR( 1C_2C ) ) \ | |
| 412 | PORT_DIPSETTING( 0x0d, DEF_STR( 1C_3C ) ) \ | |
| 413 | PORT_DIPSETTING( 0x0c, DEF_STR( 1C_4C ) ) \ | |
| 414 | PORT_DIPSETTING( 0x0b, DEF_STR( 1C_5C ) ) \ | |
| 415 | PORT_DIPSETTING( 0x0a, DEF_STR( 1C_6C ) ) \ | |
| 416 | PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW A:5,6,7,8") \ | |
| 417 | PORT_DIPSETTING( 0x70, DEF_STR( 4C_1C ) ) \ | |
| 418 | PORT_DIPSETTING( 0x80, DEF_STR( 3C_1C ) ) \ | |
| 419 | PORT_DIPSETTING( 0x90, DEF_STR( 2C_1C ) ) \ | |
| 420 | PORT_DIPSETTING( 0x50, "2 Coins/1 Credit 4/2 5/3 6/4" ) \ | |
| 421 | PORT_DIPSETTING( 0x40, "2 Coins/1 Credit 4/3" ) \ | |
| 422 | PORT_DIPSETTING( 0xf0, DEF_STR( 1C_1C ) ) \ | |
| 423 | /* PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) Not allowed by mame coinage sorting, but valid */ \ | |
| 424 | PORT_DIPSETTING( 0x30, "1 Coin/1 Credit 5/6" ) \ | |
| 425 | PORT_DIPSETTING( 0x20, "1 Coin/1 Credit 4/5" ) \ | |
| 426 | PORT_DIPSETTING( 0x10, "1 Coin/1 Credit 2/3" ) \ | |
| 427 | PORT_DIPSETTING( 0x60, DEF_STR( 2C_3C ) ) \ | |
| 428 | PORT_DIPSETTING( 0xe0, DEF_STR( 1C_2C ) ) \ | |
| 429 | PORT_DIPSETTING( 0xd0, DEF_STR( 1C_3C ) ) \ | |
| 430 | PORT_DIPSETTING( 0xc0, DEF_STR( 1C_4C ) ) \ | |
| 431 | PORT_DIPSETTING( 0xb0, DEF_STR( 1C_5C ) ) \ | |
| 432 | PORT_DIPSETTING( 0xa0, DEF_STR( 1C_6C ) ) | |
| 398 | /************************************* | |
| 399 | * | |
| 400 | * Generic port definitions | |
| 401 | * | |
| 402 | *************************************/ | |
| 433 | 403 | |
| 434 | /* If you don't like the description, feel free to change it */ | |
| 435 | #define DSW0_BIT7 \ | |
| 436 | PORT_DIPNAME( 0x80, 0x80, "SW 0 Read From" ) \ | |
| 437 | PORT_DIPSETTING( 0x80, "Port $0D" ) \ | |
| 438 | PORT_DIPSETTING( 0x00, "Port $10" ) | |
| 439 | ||
| 440 | static INPUT_PORTS_START( common ) | |
| 404 | static INPUT_PORTS_START( system1_generic ) | |
| 441 | 405 | PORT_START("P1") |
| 442 | 406 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 443 | 407 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) |
| r3333 | r3334 | |
| 468 | 432 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 469 | 433 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 470 | 434 | |
| 435 | PORT_START("DSW1") | |
| 436 | PORT_DIPUNUSED_DIPLOC( 0x01, 0x01, "SWB:1" ) | |
| 437 | PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "SWB:2" ) | |
| 438 | PORT_DIPUNUSED_DIPLOC( 0x04, 0x04, "SWB:3" ) | |
| 439 | PORT_DIPUNUSED_DIPLOC( 0x08, 0x08, "SWB:4" ) | |
| 440 | PORT_DIPUNUSED_DIPLOC( 0x10, 0x10, "SWB:5" ) | |
| 441 | PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "SWB:6" ) | |
| 442 | PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SWB:7" ) | |
| 443 | /* If you don't like the description, feel free to change it */ | |
| 444 | PORT_DIPNAME( 0x80, 0x80, "SW 0 Read From" ) PORT_DIPLOCATION("SWB:8") | |
| 445 | PORT_DIPSETTING( 0x80, "Port $0D" ) | |
| 446 | PORT_DIPSETTING( 0x00, "Port $10" ) | |
| 447 | ||
| 471 | 448 | PORT_START("DSW2") |
| 472 | COINAGE_PORT | |
| 449 | PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SWA:1,2,3,4") | |
| 450 | PORT_DIPSETTING( 0x07, DEF_STR( 4C_1C ) ) | |
| 451 | PORT_DIPSETTING( 0x08, DEF_STR( 3C_1C ) ) | |
| 452 | PORT_DIPSETTING( 0x09, DEF_STR( 2C_1C ) ) | |
| 453 | PORT_DIPSETTING( 0x05, "2 Coins/1 Credit 5/3 6/4" ) | |
| 454 | PORT_DIPSETTING( 0x04, "2 Coins/1 Credit 4/3" ) | |
| 455 | PORT_DIPSETTING( 0x0f, DEF_STR( 1C_1C ) ) | |
| 456 | PORT_DIPSETTING( 0x01, "1 Coin/1 Credit 2/3" ) | |
| 457 | PORT_DIPSETTING( 0x02, "1 Coin/1 Credit 4/5" ) | |
| 458 | PORT_DIPSETTING( 0x03, "1 Coin/1 Credit 5/6" ) | |
| 459 | PORT_DIPSETTING( 0x06, DEF_STR( 2C_3C ) ) | |
| 460 | PORT_DIPSETTING( 0x0e, DEF_STR( 1C_2C ) ) | |
| 461 | PORT_DIPSETTING( 0x0d, DEF_STR( 1C_3C ) ) | |
| 462 | PORT_DIPSETTING( 0x0c, DEF_STR( 1C_4C ) ) | |
| 463 | PORT_DIPSETTING( 0x0b, DEF_STR( 1C_5C ) ) | |
| 464 | PORT_DIPSETTING( 0x0a, DEF_STR( 1C_6C ) ) | |
| 465 | /* PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) Not allowed by mame coinage sorting, but valid */ | |
| 466 | PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SWA:5,6,7,8") | |
| 467 | PORT_DIPSETTING( 0x70, DEF_STR( 4C_1C ) ) | |
| 468 | PORT_DIPSETTING( 0x80, DEF_STR( 3C_1C ) ) | |
| 469 | PORT_DIPSETTING( 0x90, DEF_STR( 2C_1C ) ) | |
| 470 | PORT_DIPSETTING( 0x50, "2 Coins/1 Credit 5/3 6/4" ) | |
| 471 | PORT_DIPSETTING( 0x40, "2 Coins/1 Credit 4/3" ) | |
| 472 | PORT_DIPSETTING( 0xf0, DEF_STR( 1C_1C ) ) | |
| 473 | PORT_DIPSETTING( 0x10, "1 Coin/1 Credit 2/3" ) | |
| 474 | PORT_DIPSETTING( 0x20, "1 Coin/1 Credit 4/5" ) | |
| 475 | PORT_DIPSETTING( 0x30, "1 Coin/1 Credit 5/6" ) | |
| 476 | PORT_DIPSETTING( 0x60, DEF_STR( 2C_3C ) ) | |
| 477 | PORT_DIPSETTING( 0xe0, DEF_STR( 1C_2C ) ) | |
| 478 | PORT_DIPSETTING( 0xd0, DEF_STR( 1C_3C ) ) | |
| 479 | PORT_DIPSETTING( 0xc0, DEF_STR( 1C_4C ) ) | |
| 480 | PORT_DIPSETTING( 0xb0, DEF_STR( 1C_5C ) ) | |
| 481 | PORT_DIPSETTING( 0xa0, DEF_STR( 1C_6C ) ) | |
| 482 | /* PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) Not allowed by mame coinage sorting, but valid */ | |
| 473 | 483 | INPUT_PORTS_END |
| 474 | 484 | |
| 485 | /************************************* | |
| 486 | * | |
| 487 | * Game-specific port definitions | |
| 488 | * | |
| 489 | *************************************/ | |
| 475 | 490 | |
| 476 | 491 | static INPUT_PORTS_START( starjack ) |
| 477 | PORT_INCLUDE( | |
| 492 | PORT_INCLUDE( system1_generic ) | |
| 478 | 493 | |
| 479 | PORT_ | |
| 494 | PORT_MODIFY("DSW1") | |
| 480 | 495 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) |
| 481 | 496 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| 482 | 497 | PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) |
| r3333 | r3334 | |
| 502 | 517 | INPUT_PORTS_END |
| 503 | 518 | |
| 504 | 519 | static INPUT_PORTS_START( starjacs ) |
| 505 | PORT_INCLUDE( c | |
| 520 | PORT_INCLUDE( starjack | |
| 506 | 521 | |
| 507 | PORT_START("DSW1") | |
| 508 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) | |
| 509 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) | |
| 510 | PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) | |
| 511 | PORT_DIPNAME( 0x06, 0x06, DEF_STR( Lives ) ) | |
| 512 | PORT_DIPSETTING( 0x06, "3" ) | |
| 513 | PORT_DIPSETTING( 0x04, "4" ) | |
| 514 | PORT_DIPSETTING( 0x02, "5" ) | |
| 515 | PORT_DIPSETTING( 0x00, DEF_STR( Infinite ) ) | |
| 522 | PORT_MODIFY("DSW1") | |
| 516 | 523 | PORT_DIPNAME( 0x08, 0x08, "Ship" ) |
| 517 | 524 | PORT_DIPSETTING( 0x08, DEF_STR( Single ) ) |
| 518 | 525 | PORT_DIPSETTING( 0x00, "Multi" ) |
| r3333 | r3334 | |
| 521 | 528 | PORT_DIPSETTING( 0x20, "40k, then every 50k" ) |
| 522 | 529 | PORT_DIPSETTING( 0x10, "50k, then every 60k" ) |
| 523 | 530 | PORT_DIPSETTING( 0x00, "60k, then every 70k" ) |
| 524 | PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) ) | |
| 525 | PORT_DIPSETTING( 0xc0, DEF_STR( Easy ) ) | |
| 526 | PORT_DIPSETTING( 0x80, DEF_STR( Medium ) ) | |
| 527 | PORT_DIPSETTING( 0x40, DEF_STR( Hard ) ) | |
| 528 | PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) | |
| 529 | 531 | INPUT_PORTS_END |
| 530 | 532 | |
| 531 | 533 | static INPUT_PORTS_START( regulus ) |
| 532 | PORT_INCLUDE( | |
| 534 | PORT_INCLUDE( system1_generic ) | |
| 533 | 535 | |
| 534 | PORT_ | |
| 536 | PORT_MODIFY("DSW1") | |
| 535 | 537 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) |
| 536 | 538 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| 537 | 539 | PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) |
| r3333 | r3334 | |
| 568 | 570 | INPUT_PORTS_END |
| 569 | 571 | |
| 570 | 572 | static INPUT_PORTS_START( upndown ) |
| 571 | PORT_INCLUDE( | |
| 573 | PORT_INCLUDE( system1_generic ) | |
| 572 | 574 | |
| 573 | 575 | PORT_MODIFY("P1") |
| 574 | 576 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* no button 2 */ |
| r3333 | r3334 | |
| 576 | 578 | PORT_MODIFY("P2") |
| 577 | 579 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* no button 2 */ |
| 578 | 580 | |
| 579 | PORT_ | |
| 581 | PORT_MODIFY("DSW1") | |
| 580 | 582 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) |
| 581 | 583 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| 582 | 584 | PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) |
| r3333 | r3334 | |
| 602 | 604 | INPUT_PORTS_END |
| 603 | 605 | |
| 604 | 606 | static INPUT_PORTS_START( mrviking ) |
| 605 | PORT_INCLUDE( | |
| 607 | PORT_INCLUDE( system1_generic ) | |
| 606 | 608 | |
| 607 | 609 | PORT_MODIFY("P1") |
| 608 | 610 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| r3333 | r3334 | |
| 612 | 614 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL |
| 613 | 615 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL |
| 614 | 616 | |
| 615 | PORT_ | |
| 617 | PORT_MODIFY("DSW1") | |
| 616 | 618 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) |
| 617 | 619 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| 618 | 620 | PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) |
| r3333 | r3334 | |
| 632 | 634 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Difficulty ) ) |
| 633 | 635 | PORT_DIPSETTING( 0x40, DEF_STR( Easy ) ) |
| 634 | 636 | PORT_DIPSETTING( 0x00, DEF_STR( Hard ) ) |
| 635 | DSW0_BIT7 | |
| 636 | 637 | INPUT_PORTS_END |
| 637 | 638 | |
| 638 | 639 | /* Same as 'mrviking', but no "Maximum Credits" Dip Switch and "Difficulty" Dip Switch is |
| r3333 | r3334 | |
| 653 | 654 | INPUT_PORTS_END |
| 654 | 655 | |
| 655 | 656 | static INPUT_PORTS_START( swat ) |
| 656 | PORT_INCLUDE( | |
| 657 | PORT_INCLUDE( system1_generic ) | |
| 657 | 658 | |
| 658 | PORT_MODIFY("P1") | |
| 659 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY | |
| 660 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY | |
| 661 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY | |
| 662 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY | |
| 663 | ||
| 664 | PORT_MODIFY("P2") | |
| 665 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_COCKTAIL | |
| 666 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_COCKTAIL | |
| 667 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_COCKTAIL | |
| 668 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_COCKTAIL | |
| 669 | ||
| 670 | PORT_START("DSW1") | |
| 659 | PORT_MODIFY("DSW1") | |
| 671 | 660 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) |
| 672 | 661 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| 673 | 662 | PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) |
| r3333 | r3334 | |
| 694 | 683 | INPUT_PORTS_END |
| 695 | 684 | |
| 696 | 685 | static INPUT_PORTS_START( flicky ) |
| 697 | PORT_INCLUDE( | |
| 686 | PORT_INCLUDE( system1_generic ) | |
| 698 | 687 | |
| 699 | 688 | PORT_MODIFY("P1") |
| 700 | 689 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* no button 2 */ |
| r3333 | r3334 | |
| 707 | 696 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* no button 2 */ |
| 708 | 697 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* only 2way inputs */ |
| 709 | 698 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* only 2way inputs */ |
| 710 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL | |
| 711 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL | |
| 699 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_COCKTAIL | |
| 700 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_COCKTAIL | |
| 712 | 701 | |
| 713 | PORT_ | |
| 702 | PORT_MODIFY("DSW1") | |
| 714 | 703 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) |
| 715 | 704 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| 716 | 705 | PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) |
| r3333 | r3334 | |
| 730 | 719 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Difficulty ) ) |
| 731 | 720 | PORT_DIPSETTING( 0x40, DEF_STR( Easy ) ) |
| 732 | 721 | PORT_DIPSETTING( 0x00, DEF_STR( Hard ) ) |
| 733 | DSW0_BIT7 | |
| 734 | 722 | INPUT_PORTS_END |
| 735 | 723 | |
| 736 | 724 | static INPUT_PORTS_START( wmatch ) |
| 737 | PORT_START("P1") | |
| 725 | PORT_INCLUDE( system1_generic ) | |
| 726 | ||
| 727 | PORT_MODIFY("P1") | |
| 738 | 728 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_DOWN ) PORT_8WAY |
| 739 | 729 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_UP ) PORT_8WAY |
| 740 | 730 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_RIGHT ) PORT_8WAY |
| r3333 | r3334 | |
| 744 | 734 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_RIGHT ) PORT_8WAY |
| 745 | 735 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_LEFT ) PORT_8WAY |
| 746 | 736 | |
| 747 | PORT_ | |
| 737 | PORT_MODIFY("P2") | |
| 748 | 738 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_DOWN ) PORT_8WAY PORT_COCKTAIL |
| 749 | 739 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_UP ) PORT_8WAY PORT_COCKTAIL |
| 750 | 740 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_RIGHT ) PORT_8WAY PORT_COCKTAIL |
| r3333 | r3334 | |
| 754 | 744 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_RIGHT ) PORT_8WAY PORT_COCKTAIL |
| 755 | 745 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_LEFT ) PORT_8WAY PORT_COCKTAIL |
| 756 | 746 | |
| 757 | PORT_START("SYSTEM") | |
| 758 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) | |
| 759 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) | |
| 760 | PORT_SERVICE_NO_TOGGLE( 0x04, IP_ACTIVE_LOW ) | |
| 761 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 ) | |
| 762 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 ) | |
| 763 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 ) | |
| 764 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) /* TURN P1 */ | |
| 747 | PORT_MODIFY("SYSTEM") | |
| 748 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) /* TURN P1 */ | |
| 765 | 749 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL /* TURN P2 */ |
| 766 | 750 | |
| 767 | PORT_START("DSW2") | |
| 768 | COINAGE_PORT | |
| 769 | ||
| 770 | PORT_START("DSW1") | |
| 751 | PORT_MODIFY("DSW1") | |
| 771 | 752 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) |
| 772 | 753 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| 773 | 754 | PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) |
| r3333 | r3334 | |
| 788 | 769 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Difficulty ) ) |
| 789 | 770 | PORT_DIPSETTING( 0x40, DEF_STR( Easy ) ) |
| 790 | 771 | PORT_DIPSETTING( 0x00, DEF_STR( Hard ) ) |
| 791 | DSW0_BIT7 | |
| 792 | 772 | INPUT_PORTS_END |
| 793 | 773 | |
| 794 | 774 | static INPUT_PORTS_START( bullfgt ) |
| 795 | PORT_INCLUDE( | |
| 775 | PORT_INCLUDE( system1_generic ) | |
| 796 | 776 | |
| 797 | PORT_ | |
| 777 | PORT_MODIFY("DSW1") | |
| 798 | 778 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) |
| 799 | 779 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| 800 | 780 | PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) |
| r3333 | r3334 | |
| 811 | 791 | PORT_DIPSETTING( 0x20, "50000" ) |
| 812 | 792 | PORT_DIPSETTING( 0x10, "70000" ) |
| 813 | 793 | PORT_DIPSETTING( 0x00, DEF_STR( None ) ) |
| 814 | PORT_DIPNAME( 0x40, 0x40, "Unused SW 0-6" ) | |
| 815 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 816 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 817 | DSW0_BIT7 | |
| 818 | 794 | INPUT_PORTS_END |
| 819 | 795 | |
| 820 | 796 | static INPUT_PORTS_START( spatter ) |
| 821 | PORT_INCLUDE( | |
| 797 | PORT_INCLUDE( system1_generic ) | |
| 822 | 798 | |
| 823 | PORT_ | |
| 799 | PORT_MODIFY("DSW1") | |
| 824 | 800 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) |
| 825 | 801 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| 826 | 802 | PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) |
| r3333 | r3334 | |
| 840 | 816 | PORT_DIPNAME( 0x40, 0x40, "Reset Timer/Objects On Life Loss" ) |
| 841 | 817 | PORT_DIPSETTING( 0x40, DEF_STR( No ) ) |
| 842 | 818 | PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) |
| 843 | DSW0_BIT7 | |
| 844 | 819 | INPUT_PORTS_END |
| 845 | 820 | |
| 846 | 821 | static INPUT_PORTS_START( pitfall2 ) |
| 847 | PORT_INCLUDE( | |
| 822 | PORT_INCLUDE( system1_generic ) | |
| 848 | 823 | |
| 849 | PORT_ | |
| 824 | PORT_MODIFY("DSW1") | |
| 850 | 825 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) |
| 851 | 826 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| 852 | 827 | PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) |
| r3333 | r3334 | |
| 873 | 848 | INPUT_PORTS_END |
| 874 | 849 | |
| 875 | 850 | static INPUT_PORTS_START( pitfallu ) |
| 876 | PORT_INCLUDE( | |
| 851 | PORT_INCLUDE( pitfall2 ) | |
| 877 | 852 | |
| 878 | PORT_START("DSW1") /* DSW0 */ | |
| 879 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) | |
| 880 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) | |
| 881 | PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) | |
| 853 | PORT_MODIFY("DSW1") | |
| 882 | 854 | PORT_DIPNAME( 0x06, 0x06, DEF_STR( Lives ) ) |
| 883 | 855 | PORT_DIPSETTING( 0x06, "3" ) |
| 884 | 856 | PORT_DIPSETTING( 0x04, "4" ) |
| r3333 | r3334 | |
| 889 | 861 | PORT_DIPSETTING( 0x10, "2" ) |
| 890 | 862 | PORT_DIPSETTING( 0x08, "3" ) |
| 891 | 863 | PORT_DIPSETTING( 0x00, "4" ) |
| 892 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Allow_Continue ) ) | |
| 893 | PORT_DIPSETTING( 0x20, DEF_STR( No ) ) | |
| 894 | PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) | |
| 895 | PORT_DIPNAME( 0x40, 0x40, "Time" ) | |
| 896 | PORT_DIPSETTING( 0x00, "2 Minutes" ) | |
| 897 | PORT_DIPSETTING( 0x40, "3 Minutes" ) | |
| 898 | PORT_DIPNAME( 0x80, 0x80, "Unused SW 0-7" ) | |
| 899 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 900 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 901 | 864 | INPUT_PORTS_END |
| 902 | 865 | |
| 903 | 866 | static INPUT_PORTS_START( seganinj ) |
| 904 | PORT_INCLUDE( | |
| 867 | PORT_INCLUDE( system1_generic ) | |
| 905 | 868 | |
| 906 | 869 | PORT_MODIFY("P1") |
| 907 | 870 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) |
| r3333 | r3334 | |
| 909 | 872 | PORT_MODIFY("P1") |
| 910 | 873 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL |
| 911 | 874 | |
| 912 | PORT_ | |
| 875 | PORT_MODIFY("DSW1") | |
| 913 | 876 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) |
| 914 | 877 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| 915 | 878 | PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) |
| r3333 | r3334 | |
| 930 | 893 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Difficulty ) ) |
| 931 | 894 | PORT_DIPSETTING( 0x40, DEF_STR( Easy ) ) |
| 932 | 895 | PORT_DIPSETTING( 0x00, DEF_STR( Hard ) ) |
| 933 | DSW0_BIT7 | |
| 934 | 896 | INPUT_PORTS_END |
| 935 | 897 | |
| 936 | 898 | static INPUT_PORTS_START( imsorry ) |
| 937 | PORT_INCLUDE( | |
| 899 | PORT_INCLUDE( system1_generic ) | |
| 938 | 900 | |
| 939 | PORT_ | |
| 901 | PORT_MODIFY("DSW1") | |
| 940 | 902 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) |
| 941 | 903 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| 942 | 904 | PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) |
| r3333 | r3334 | |
| 956 | 918 | PORT_DIPNAME( 0x40, 0x40, "Unused SW 0-6" ) |
| 957 | 919 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 958 | 920 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 959 | DSW0_BIT7 | |
| 960 | 921 | INPUT_PORTS_END |
| 961 | 922 | |
| 962 | 923 | static INPUT_PORTS_START( teddybb ) |
| 963 | PORT_INCLUDE( | |
| 924 | PORT_INCLUDE( system1_generic ) | |
| 964 | 925 | |
| 965 | 926 | PORT_MODIFY("P1") |
| 966 | 927 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| r3333 | r3334 | |
| 970 | 931 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL |
| 971 | 932 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL |
| 972 | 933 | |
| 973 | PORT_ | |
| 934 | PORT_MODIFY("DSW1") | |
| 974 | 935 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) |
| 975 | 936 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| 976 | 937 | PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) |
| r3333 | r3334 | |
| 990 | 951 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Difficulty ) ) |
| 991 | 952 | PORT_DIPSETTING( 0x40, DEF_STR( Easy ) ) |
| 992 | 953 | PORT_DIPSETTING( 0x00, DEF_STR( Hard ) ) |
| 993 | DSW0_BIT7 | |
| 994 | 954 | INPUT_PORTS_END |
| 995 | 955 | |
| 996 | 956 | static INPUT_PORTS_START( hvymetal ) |
| 997 | PORT_INCLUDE( | |
| 957 | PORT_INCLUDE( system1_generic ) | |
| 998 | 958 | |
| 999 | 959 | PORT_MODIFY("P1") |
| 1000 | 960 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| r3333 | r3334 | |
| 1004 | 964 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL |
| 1005 | 965 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL |
| 1006 | 966 | |
| 1007 | PORT_ | |
| 967 | PORT_MODIFY("DSW1") | |
| 1008 | 968 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) |
| 1009 | 969 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| 1010 | 970 | PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) |
| r3333 | r3334 | |
| 1030 | 990 | INPUT_PORTS_END |
| 1031 | 991 | |
| 1032 | 992 | static INPUT_PORTS_START( myhero ) |
| 1033 | PORT_INCLUDE( | |
| 993 | PORT_INCLUDE( system1_generic ) | |
| 1034 | 994 | |
| 1035 | 995 | PORT_MODIFY("P1") |
| 1036 | 996 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| r3333 | r3334 | |
| 1040 | 1000 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL |
| 1041 | 1001 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL |
| 1042 | 1002 | |
| 1043 | PORT_ | |
| 1003 | PORT_MODIFY("DSW1") | |
| 1044 | 1004 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) |
| 1045 | 1005 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| 1046 | 1006 | PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) |
| r3333 | r3334 | |
| 1060 | 1020 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Difficulty ) ) |
| 1061 | 1021 | PORT_DIPSETTING( 0x40, DEF_STR( Easy ) ) |
| 1062 | 1022 | PORT_DIPSETTING( 0x00, DEF_STR( Hard ) ) |
| 1063 | DSW0_BIT7 | |
| 1064 | 1023 | INPUT_PORTS_END |
| 1065 | 1024 | |
| 1025 | static INPUT_PORTS_START( chplft ) | |
| 1026 | PORT_INCLUDE( system1_generic ) | |
| 1027 | ||
| 1028 | PORT_MODIFY("DSW1") | |
| 1029 | PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SWA:1,2,3,4") | |
| 1030 | PORT_DIPSETTING( 0x07, DEF_STR( 4C_1C ) ) | |
| 1031 | PORT_DIPSETTING( 0x08, DEF_STR( 3C_1C ) ) | |
| 1032 | PORT_DIPSETTING( 0x09, DEF_STR( 2C_1C ) ) | |
| 1033 | PORT_DIPSETTING( 0x05, "2 Coins/1 Credit 5/3 6/4" ) | |
| 1034 | PORT_DIPSETTING( 0x04, "2 Coins/1 Credit 4/3" ) | |
| 1035 | PORT_DIPSETTING( 0x0f, DEF_STR( 1C_1C ) ) | |
| 1036 | PORT_DIPSETTING( 0x01, "1 Coin/1 Credit 2/3" ) | |
| 1037 | PORT_DIPSETTING( 0x02, "1 Coin/1 Credit 4/5" ) | |
| 1038 | PORT_DIPSETTING( 0x03, "1 Coin/1 Credit 5/6" ) | |
| 1039 | PORT_DIPSETTING( 0x06, DEF_STR( 2C_3C ) ) | |
| 1040 | PORT_DIPSETTING( 0x0e, DEF_STR( 1C_2C ) ) | |
| 1041 | PORT_DIPSETTING( 0x0d, DEF_STR( 1C_3C ) ) | |
| 1042 | PORT_DIPSETTING( 0x0c, DEF_STR( 1C_4C ) ) | |
| 1043 | PORT_DIPSETTING( 0x0b, DEF_STR( 1C_5C ) ) | |
| 1044 | PORT_DIPSETTING( 0x0a, DEF_STR( 1C_6C ) ) | |
| 1045 | PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SWA:5,6,7,8") | |
| 1046 | PORT_DIPSETTING( 0x70, DEF_STR( 4C_1C ) ) | |
| 1047 | PORT_DIPSETTING( 0x80, DEF_STR( 3C_1C ) ) | |
| 1048 | PORT_DIPSETTING( 0x90, DEF_STR( 2C_1C ) ) | |
| 1049 | PORT_DIPSETTING( 0x50, "2 Coins/1 Credit 5/3 6/4" ) | |
| 1050 | PORT_DIPSETTING( 0x40, "2 Coins/1 Credit 4/3" ) | |
| 1051 | PORT_DIPSETTING( 0xf0, DEF_STR( 1C_1C ) ) | |
| 1052 | PORT_DIPSETTING( 0x10, "1 Coin/1 Credit 2/3" ) | |
| 1053 | PORT_DIPSETTING( 0x20, "1 Coin/1 Credit 4/5" ) | |
| 1054 | PORT_DIPSETTING( 0x30, "1 Coin/1 Credit 5/6" ) | |
| 1055 | PORT_DIPSETTING( 0x60, DEF_STR( 2C_3C ) ) | |
| 1056 | PORT_DIPSETTING( 0xe0, DEF_STR( 1C_2C ) ) | |
| 1057 | PORT_DIPSETTING( 0xd0, DEF_STR( 1C_3C ) ) | |
| 1058 | PORT_DIPSETTING( 0xc0, DEF_STR( 1C_4C ) ) | |
| 1059 | PORT_DIPSETTING( 0xb0, DEF_STR( 1C_5C ) ) | |
| 1060 | PORT_DIPSETTING( 0xa0, DEF_STR( 1C_6C ) ) | |
| 1061 | ||
| 1062 | PORT_MODIFY("DSW2") | |
| 1063 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SWB:1") | |
| 1064 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) | |
| 1065 | PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) | |
| 1066 | PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SWB:2") | |
| 1067 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) | |
| 1068 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1069 | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) ) PORT_DIPLOCATION("SWB:3,4") | |
| 1070 | PORT_DIPSETTING( 0x08, "2" ) | |
| 1071 | PORT_DIPSETTING( 0x0c, "3" ) | |
| 1072 | PORT_DIPSETTING( 0x04, "4" ) | |
| 1073 | PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) ) | |
| 1074 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SWB:5") | |
| 1075 | PORT_DIPSETTING( 0x10, "20k 70k 120k 170k" ) | |
| 1076 | PORT_DIPSETTING( 0x00, "50k 100k 150k 200k" ) | |
| 1077 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SWB:6") | |
| 1078 | PORT_DIPSETTING( 0x00, DEF_STR( Hard ) ) | |
| 1079 | PORT_DIPSETTING( 0x20, DEF_STR( Easy ) ) | |
| 1080 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) ) PORT_DIPLOCATION("SWB:7") | |
| 1081 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 1082 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1083 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) PORT_DIPLOCATION("SWB:8") | |
| 1084 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 1085 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1086 | INPUT_PORTS_END | |
| 1087 | ||
| 1066 | 1088 | static INPUT_PORTS_START( shtngmst ) |
| 1067 | PORT_START("P1") | |
| 1068 | /* | |
| 1069 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1070 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) | |
| 1071 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) | |
| 1072 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1073 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY | |
| 1074 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY | |
| 1075 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY | |
| 1076 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY | |
| 1077 | */ | |
| 1089 | PORT_INCLUDE( chplft ) | |
| 1078 | 1090 | |
| 1079 | PORT_START("P2") | |
| 1080 | /* | |
| 1081 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1082 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL | |
| 1083 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL | |
| 1084 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1085 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL | |
| 1086 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL | |
| 1087 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL | |
| 1088 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL | |
| 1089 | */ | |
| 1091 | PORT_MODIFY("P1") | |
| 1092 | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 1090 | 1093 | |
| 1091 | PORT_START("SYSTEM") | |
| 1092 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) | |
| 1093 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) | |
| 1094 | PORT_SERVICE_NO_TOGGLE( 0x04, IP_ACTIVE_LOW ) | |
| 1095 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 ) | |
| 1096 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 ) | |
| 1097 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 ) | |
| 1098 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1099 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1094 | PORT_MODIFY("P2") | |
| 1095 | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 1100 | 1096 | |
| 1101 | PORT_ | |
| 1097 | PORT_MODIFY("DSW2") | |
| 1102 | 1098 | PORT_DIPNAME( 0x01, 0x01, "DSW2" ) |
| 1103 | 1099 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 1104 | 1100 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| r3333 | r3334 | |
| 1124 | 1120 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 1125 | 1121 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1126 | 1122 | |
| 1127 | PORT_START("DSW1") | |
| 1128 | COINAGE_PORT | |
| 1129 | ||
| 1130 | 1123 | PORT_START("TRIGGER") /* trigger is in here */ |
| 1131 | 1124 | PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 1132 | 1125 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| r3333 | r3334 | |
| 1169 | 1162 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1170 | 1163 | INPUT_PORTS_END |
| 1171 | 1164 | |
| 1172 | ||
| 1173 | static INPUT_PORTS_START( chplft ) | |
| 1174 | PORT_INCLUDE( common ) | |
| 1175 | ||
| 1176 | PORT_MODIFY("DSW2") | |
| 1177 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW B:1") | |
| 1178 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) | |
| 1179 | PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) | |
| 1180 | PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW B:2") | |
| 1181 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) | |
| 1182 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1183 | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW B:3,4") | |
| 1184 | PORT_DIPSETTING( 0x08, "2" ) | |
| 1185 | PORT_DIPSETTING( 0x0c, "3" ) | |
| 1186 | PORT_DIPSETTING( 0x04, "4" ) | |
| 1187 | PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) ) | |
| 1188 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW B:5") | |
| 1189 | PORT_DIPSETTING( 0x10, "20k 70k 120k 170k" ) | |
| 1190 | PORT_DIPSETTING( 0x00, "50k 100k 150k 200k" ) | |
| 1191 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW B:6") | |
| 1192 | PORT_DIPSETTING( 0x00, DEF_STR( Hard ) ) | |
| 1193 | PORT_DIPSETTING( 0x20, DEF_STR( Easy ) ) | |
| 1194 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW B:7") | |
| 1195 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 1196 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1197 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW B:8") | |
| 1198 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 1199 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1200 | ||
| 1201 | PORT_START("DSW1") | |
| 1202 | COINAGE_PORT | |
| 1203 | INPUT_PORTS_END | |
| 1204 | ||
| 1205 | 1165 | static INPUT_PORTS_START( 4dwarrio ) |
| 1206 | PORT_INCLUDE( | |
| 1166 | PORT_INCLUDE( system1_generic ) | |
| 1207 | 1167 | |
| 1208 | PORT_ | |
| 1168 | PORT_MODIFY("DSW1") | |
| 1209 | 1169 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) |
| 1210 | 1170 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| 1211 | 1171 | PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) |
| r3333 | r3334 | |
| 1226 | 1186 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Difficulty ) ) |
| 1227 | 1187 | PORT_DIPSETTING( 0x40, DEF_STR( Easy ) ) |
| 1228 | 1188 | PORT_DIPSETTING( 0x00, DEF_STR( Hard ) ) |
| 1229 | DSW0_BIT7 | |
| 1230 | 1189 | INPUT_PORTS_END |
| 1231 | 1190 | |
| 1232 | 1191 | static INPUT_PORTS_START( brain ) |
| 1233 | PORT_INCLUDE( | |
| 1192 | PORT_INCLUDE( system1_generic ) | |
| 1234 | 1193 | |
| 1235 | PORT_ | |
| 1194 | PORT_MODIFY("DSW1") | |
| 1236 | 1195 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) |
| 1237 | 1196 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| 1238 | 1197 | PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) |
| r3333 | r3334 | |
| 1259 | 1218 | INPUT_PORTS_END |
| 1260 | 1219 | |
| 1261 | 1220 | static INPUT_PORTS_START( gardia ) |
| 1262 | PORT_INCLUDE( | |
| 1221 | PORT_INCLUDE( system1_generic ) | |
| 1263 | 1222 | |
| 1264 | PORT_ | |
| 1223 | PORT_MODIFY("DSW1") | |
| 1265 | 1224 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) |
| 1266 | 1225 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| 1267 | 1226 | PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) |
| r3333 | r3334 | |
| 1287 | 1246 | INPUT_PORTS_END |
| 1288 | 1247 | |
| 1289 | 1248 | static INPUT_PORTS_START( raflesia ) |
| 1290 | PORT_INCLUDE( | |
| 1249 | PORT_INCLUDE( system1_generic ) | |
| 1291 | 1250 | |
| 1292 | PORT_ | |
| 1251 | PORT_MODIFY("DSW1") | |
| 1293 | 1252 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) |
| 1294 | 1253 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| 1295 | 1254 | PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) |
| r3333 | r3334 | |
| 1309 | 1268 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) ) /* Manual lists this dip as "Unused" */ |
| 1310 | 1269 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 1311 | 1270 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1312 | DSW0_BIT7 | |
| 1313 | 1271 | INPUT_PORTS_END |
| 1314 | 1272 | |
| 1315 | 1273 | static INPUT_PORTS_START( wboy ) |
| 1316 | PORT_INCLUDE( | |
| 1274 | PORT_INCLUDE( system1_generic ) | |
| 1317 | 1275 | |
| 1318 | 1276 | PORT_MODIFY("P1") |
| 1319 | 1277 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| r3333 | r3334 | |
| 1331 | 1289 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_COCKTAIL |
| 1332 | 1290 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_COCKTAIL |
| 1333 | 1291 | |
| 1334 | PORT_ | |
| 1292 | PORT_MODIFY("DSW1") | |
| 1335 | 1293 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW B:1") |
| 1336 | 1294 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| 1337 | 1295 | PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) |
| r3333 | r3334 | |
| 1369 | 1327 | INPUT_PORTS_END |
| 1370 | 1328 | |
| 1371 | 1329 | static INPUT_PORTS_START( wboysys2 ) |
| 1372 | PORT_INCLUDE( c | |
| 1330 | PORT_INCLUDE( chplft ) | |
| 1373 | 1331 | |
| 1374 | 1332 | PORT_MODIFY("P1") |
| 1375 | 1333 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| r3333 | r3334 | |
| 1411 | 1369 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW B:8") |
| 1412 | 1370 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 1413 | 1371 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1414 | ||
| 1415 | PORT_START("DSW1") | |
| 1416 | COINAGE_PORT | |
| 1417 | 1372 | INPUT_PORTS_END |
| 1418 | 1373 | |
| 1419 | 1374 | /* same as wboy, additional Energy Consumption switch */ |
| r3333 | r3334 | |
| 1529 | 1484 | */ |
| 1530 | 1485 | |
| 1531 | 1486 | static INPUT_PORTS_START( blockgal ) |
| 1532 | PORT_START("P1") | |
| 1487 | PORT_INCLUDE( chplft ) | |
| 1488 | ||
| 1489 | PORT_MODIFY("P1") | |
| 1533 | 1490 | PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(60) PORT_KEYDELTA(15) PORT_REVERSE |
| 1534 | 1491 | |
| 1535 | PORT_ | |
| 1492 | PORT_MODIFY("P2") | |
| 1536 | 1493 | PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(60) PORT_KEYDELTA(15) PORT_REVERSE PORT_COCKTAIL |
| 1537 | 1494 | |
| 1538 | PORT_START("SYSTEM") | |
| 1539 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) | |
| 1540 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) | |
| 1541 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 1542 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 ) | |
| 1543 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 ) | |
| 1544 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 ) | |
| 1495 | PORT_MODIFY("SYSTEM") | |
| 1545 | 1496 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| 1546 | 1497 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL |
| 1547 | 1498 | |
| 1548 | PORT_ | |
| 1499 | PORT_MODIFY("DSW2") | |
| 1549 | 1500 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) |
| 1550 | 1501 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| 1551 | 1502 | PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) |
| r3333 | r3334 | |
| 1568 | 1519 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 1569 | 1520 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1570 | 1521 | PORT_SERVICE( 0x80, IP_ACTIVE_LOW ) |
| 1571 | ||
| 1572 | PORT_START("DSW1") | |
| 1573 | COINAGE_PORT | |
| 1574 | 1522 | INPUT_PORTS_END |
| 1575 | 1523 | |
| 1576 | 1524 | static INPUT_PORTS_START( tokisens ) |
| 1577 | PORT_INCLUDE( c | |
| 1525 | PORT_INCLUDE( chplft ) | |
| 1578 | 1526 | |
| 1579 | 1527 | PORT_MODIFY("DSW2") |
| 1580 | 1528 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) |
| r3333 | r3334 | |
| 1600 | 1548 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) |
| 1601 | 1549 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 1602 | 1550 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1603 | ||
| 1604 | PORT_START("DSW1") | |
| 1605 | COINAGE_PORT | |
| 1606 | 1551 | INPUT_PORTS_END |
| 1607 | 1552 | |
| 1608 | 1553 | static INPUT_PORTS_START( wbml ) |
| 1609 | PORT_INCLUDE( c | |
| 1554 | PORT_INCLUDE( chplft ) | |
| 1610 | 1555 | |
| 1611 | 1556 | PORT_MODIFY("DSW2") |
| 1612 | 1557 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) |
| r3333 | r3334 | |
| 1632 | 1577 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) |
| 1633 | 1578 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 1634 | 1579 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1635 | ||
| 1636 | PORT_START("DSW1") | |
| 1637 | COINAGE_PORT | |
| 1638 | 1580 | INPUT_PORTS_END |
| 1639 | 1581 | |
| 1640 | 1582 | static INPUT_PORTS_START( noboranb ) |
| 1641 | PORT_INCLUDE( | |
| 1583 | PORT_INCLUDE( system1_generic ) | |
| 1642 | 1584 | |
| 1643 | 1585 | PORT_MODIFY("P1") |
| 1644 | 1586 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) // shot |
| r3333 | r3334 | |
| 1671 | 1613 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 1672 | 1614 | PORT_DIPSETTING( 0x80, DEF_STR( On ) ) |
| 1673 | 1615 | |
| 1674 | PORT_ | |
| 1616 | PORT_MODIFY("DSW1") | |
| 1675 | 1617 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) |
| 1676 | 1618 | PORT_DIPSETTING( 0x02, "2" ) |
| 1677 | 1619 | PORT_DIPSETTING( 0x03, "3" ) |
| r3333 | r3334 | |
| 1703 | 1645 | |
| 1704 | 1646 | */ |
| 1705 | 1647 | static INPUT_PORTS_START( ufosensi ) |
| 1706 | PORT_INCLUDE( c | |
| 1648 | PORT_INCLUDE( chplft ) | |
| 1707 | 1649 | |
| 1708 | 1650 | PORT_MODIFY("P1") |
| 1709 | 1651 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) |
| r3333 | r3334 | |
| 1734 | 1676 | PORT_DIPNAME( 0x80, 0x80, "Invulnerability" ) |
| 1735 | 1677 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 1736 | 1678 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1737 | ||
| 1738 | PORT_START("DSW1") | |
| 1739 | PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) ) | |
| 1740 | PORT_DIPSETTING( 0x07, DEF_STR( 4C_1C ) ) | |
| 1741 | PORT_DIPSETTING( 0x08, DEF_STR( 3C_1C ) ) | |
| 1742 | PORT_DIPSETTING( 0x09, DEF_STR( 2C_1C ) ) | |
| 1743 | PORT_DIPSETTING( 0x05, "2 Coins/1 Credit 5/3 6/4" ) | |
| 1744 | PORT_DIPSETTING( 0x04, "2 Coins/1 Credit 4/3" ) | |
| 1745 | PORT_DIPSETTING( 0x0f, DEF_STR( 1C_1C ) ) | |
| 1746 | PORT_DIPSETTING( 0x03, "1 Coin/1 Credit 5/6" ) | |
| 1747 | PORT_DIPSETTING( 0x02, "1 Coin/1 Credit 4/5" ) | |
| 1748 | PORT_DIPSETTING( 0x01, "1 Coin/1 Credit 2/3" ) | |
| 1749 | PORT_DIPSETTING( 0x06, DEF_STR( 2C_3C ) ) | |
| 1750 | PORT_DIPSETTING( 0x0e, DEF_STR( 1C_2C ) ) | |
| 1751 | PORT_DIPSETTING( 0x0d, DEF_STR( 1C_3C ) ) | |
| 1752 | PORT_DIPSETTING( 0x0c, DEF_STR( 1C_4C ) ) | |
| 1753 | PORT_DIPSETTING( 0x0b, DEF_STR( 1C_5C ) ) | |
| 1754 | PORT_DIPSETTING( 0x0a, DEF_STR( 1C_6C ) ) | |
| 1755 | PORT_DIPSETTING( 0x00, "Infinite Lives (both set)" ) | |
| 1756 | PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) ) | |
| 1757 | PORT_DIPSETTING( 0x70, DEF_STR( 4C_1C ) ) | |
| 1758 | PORT_DIPSETTING( 0x80, DEF_STR( 3C_1C ) ) | |
| 1759 | PORT_DIPSETTING( 0x90, DEF_STR( 2C_1C ) ) | |
| 1760 | PORT_DIPSETTING( 0x50, "2 Coins/1 Credit 5/3 6/4" ) | |
| 1761 | PORT_DIPSETTING( 0x40, "2 Coins/1 Credit 4/3" ) | |
| 1762 | PORT_DIPSETTING( 0xf0, DEF_STR( 1C_1C ) ) | |
| 1763 | PORT_DIPSETTING( 0x30, "1 Coin/1 Credit 5/6" ) | |
| 1764 | PORT_DIPSETTING( 0x20, "1 Coin/1 Credit 4/5" ) | |
| 1765 | PORT_DIPSETTING( 0x10, "1 Coin/1 Credit 2/3" ) | |
| 1766 | PORT_DIPSETTING( 0x60, DEF_STR( 2C_3C ) ) | |
| 1767 | PORT_DIPSETTING( 0xe0, DEF_STR( 1C_2C ) ) | |
| 1768 | PORT_DIPSETTING( 0xd0, DEF_STR( 1C_3C ) ) | |
| 1769 | PORT_DIPSETTING( 0xc0, DEF_STR( 1C_4C ) ) | |
| 1770 | PORT_DIPSETTING( 0xb0, DEF_STR( 1C_5C ) ) | |
| 1771 | PORT_DIPSETTING( 0xa0, DEF_STR( 1C_6C ) ) | |
| 1772 | PORT_DIPSETTING( 0x00, "Infinite Lives (both set)" ) | |
| 1773 | 1679 | INPUT_PORTS_END |
| 1774 | 1680 | |
| 1775 | 1681 | static const gfx_layout charlayout = |
| r3333 | r3334 | |
|---|---|---|
| 574 | 574 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 575 | 575 | INPUT_PORTS_END |
| 576 | 576 | |
| 577 | INPUT_PORTS_START( nbmjctrl_16 ) | |
| 577 | static INPUT_PORTS_START( nbmjctrl_16 ) | |
| 578 | 578 | PORT_START("KEY0") |
| 579 | 579 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START2 ) |
| 580 | 580 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_KAN ) PORT_PLAYER(2) |
| r3333 | r3334 | |
|---|---|---|
| 2243 | 2243 | return jdredd_gun_mux; |
| 2244 | 2244 | } |
| 2245 | 2245 | |
| 2246 | INTERRUPT_GEN( jdredd_vblank ) | |
| 2246 | static INTERRUPT_GEN( jdredd_vblank ) | |
| 2247 | 2247 | { |
| 2248 | 2248 | int x; |
| 2249 | 2249 | int y; |
| r3333 | r3334 | |
| 2898 | 2898 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(2) |
| 2899 | 2899 | INPUT_PORTS_END |
| 2900 | 2900 | |
| 2901 | INPUT_PORTS_START( jdredd ) | |
| 2901 | static INPUT_PORTS_START( jdredd ) | |
| 2902 | 2902 | PORT_INCLUDE( zn ) |
| 2903 | 2903 | |
| 2904 | 2904 | PORT_MODIFY("P1") |
| r3333 | r3334 | |
| 2936 | 2936 | PORT_BIT( 0xffff, 0x0122, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_MINMAX(0x02d-1,0x217+1) PORT_SENSITIVITY(100) PORT_KEYDELTA(15) PORT_PLAYER(2) |
| 2937 | 2937 | INPUT_PORTS_END |
| 2938 | 2938 | |
| 2939 | INPUT_PORTS_START( primrag2 ) | |
| 2939 | static INPUT_PORTS_START( primrag2 ) | |
| 2940 | 2940 | PORT_INCLUDE( zn ) |
| 2941 | 2941 | |
| 2942 | 2942 | PORT_MODIFY("SYSTEM") |
| r3333 | r3334 | |
|---|---|---|
| 698 | 698 | ROM_LOAD( "9.u113", 0x00000, 0x80000, CRC(9c5337f0) SHA1(4d7a8069be4551aad9d7d32d835dcf91be079359) ) |
| 699 | 699 | ROM_END |
| 700 | 700 | |
| 701 | ||
| 702 | ||
| 703 | ROM_START( para2dx ) | |
| 704 | ROM_REGION( 0x44000, "main", 0 ) /* Z80 Code */ | |
| 705 | ROM_LOAD( "pdx2_u128.bin", 0x00000, 0x0c000, CRC(4cbd22e1) SHA1(ad69663109d3127f6472797ec8763097da94b7d4) ) | |
| 706 | ROM_CONTINUE( 0x10000, 0x34000 ) | |
| 707 | ||
| 708 | ROM_REGION( 0x80000, "gfx1", ROMREGION_DISPOSE | ROMREGION_INVERT) /* 16x16x8 Sprites */ | |
| 709 | ROM_LOAD( "pdx2_u114.bin", 0x00000, 0x40000, CRC(3634b086) SHA1(6d079efb7be4fbe51d95d1f6b2c44dafdacb6016) ) | |
| 710 | ROM_LOAD( "pdx2_u115.bin", 0x40000, 0x40000, CRC(404409f4) SHA1(0763da81a1eb57037edd816e49a56dc8609fa502) ) | |
| 711 | ||
| 712 | ROM_REGION( 0x40000, "gfx2", ROMREGION_DISPOSE | ROMREGION_INVERT) /* 8x8x4 Background */ | |
| 713 | ROM_LOAD( "pdx2_u094.bin", 0x00000, 0x40000, CRC(87c4521b) SHA1(3ebd1e475e6125e9361b21160736103471c7aa2b) ) | |
| 714 | ||
| 715 | ROM_REGION( 0x100000, "gfx3", ROMREGION_DISPOSE | ROMREGION_INVERT) /* 8x8x8 Foreground */ | |
| 716 | ROM_LOAD( "pdx2_u092.bin", 0x00000, 0x80000, CRC(d6797812) SHA1(b2d463b5932501382abcbbd911c492b6671c3cf7) ) | |
| 717 | ROM_LOAD( "pdx2_u093.bin", 0xc0000, 0x20000, BAD_DUMP CRC(36f4f8b2) SHA1(7d6a6bdeb867ab5105097a6efbb219ce5e922bb9) ) // wrong size! | |
| 718 | ||
| 719 | ROM_REGION( 0x40000, "gfx4", ROMREGION_DISPOSE | ROMREGION_INVERT) /* 8x8x8 Midground */ | |
| 720 | ROM_LOAD( "pdx2_u110.bin", 0x00000, 0x20000, CRC(59e828d1) SHA1(fd76c5a74e1be22bde52bcfbce179dc73591bec3) ) | |
| 721 | ROM_LOAD( "pdx2_u111.bin", 0x20000, 0x20000, CRC(619dd972) SHA1(c64d256d21da5821e27b1cd55351ad2a9b141f47) ) | |
| 722 | ||
| 723 | ROM_REGION( 0x40000, "oki1", 0 ) /* Samples */ | |
| 724 | ROM_LOAD( "pdx2_u085.bin", 0x00000, 0x40000, CRC(398b842e) SHA1(933759d2907640e85f11f532096ee1a912f67b53) ) | |
| 725 | ||
| 726 | ROM_REGION( 0x80000, "oki2", 0 ) /* Samples (banked) */ | |
| 727 | ROM_LOAD( "pdx2_u113.bin", 0x00000, 0x80000, CRC(9c5337f0) SHA1(4d7a8069be4551aad9d7d32d835dcf91be079359) ) | |
| 728 | ROM_END | |
| 729 | ||
| 701 | 730 | /*************************************************************************** |
| 702 | 731 | |
| 703 | 732 | Target Ball |
| r3333 | r3334 | |
| 996 | 1025 | |
| 997 | 1026 | GAME( 1994+, paradise, 0, paradise, paradise, paradise, ROT90, "Yun Sung", "Paradise", 0 ) |
| 998 | 1027 | GAME( 1994+, paradlx, 0, paradise, paradise, paradise, ROT90, "Yun Sung", "Paradise Deluxe", GAME_IMPERFECT_GRAPHICS ) |
| 1028 | GAME( 1994+, para2dx , 0, paradise, paradise, paradise, ROT90, "Yun Sung", "Paradise 2 Deluxe", GAME_IMPERFECT_GRAPHICS ) | |
| 999 | 1029 | GAME( 1995, tgtball, 0, tgtball, tgtball, tgtball, ROT0, "Yun Sung", "Target Ball (Nude)", 0 ) |
| 1000 | 1030 | GAME( 1995, tgtballa, tgtball, tgtball, tgtball, tgtball, ROT0, "Yun Sung", "Target Ball", 0 ) |
| 1001 | 1031 | GAME( 1996, torus, 0, torus, torus, torus, ROT90, "Yun Sung", "Torus", 0 ) |
| r3333 | r3334 | |
|---|---|---|
| 254 | 254 | static UINT8 te_40103; |
| 255 | 255 | static UINT8 ld_40103; |
| 256 | 256 | |
| 257 | UINT8 c_io, hp_1, hp_2, bell | |
| 257 | static UINT8 c_io, hp_1, hp_2, bell | |
| 258 | 258 | |
| 259 | 259 | |
| 260 | 260 | /************************* |
| r3333 | r3334 | |
| 264 | 264 | static tilemap *bg_tilemap; |
| 265 | 265 | |
| 266 | 266 | |
| 267 | PALETTE_INIT( videopkr ) | |
| 267 | static PALETTE_INIT( videopkr ) | |
| 268 | 268 | { |
| 269 | 269 | int i; |
| 270 | 270 | |
| r3333 | r3334 | |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | |
| 302 | VIDEO_START( videopkr ) | |
| 302 | static VIDEO_START( videopkr ) | |
| 303 | 303 | { |
| 304 | 304 | bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32); |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | VIDEO_START( vidadcba ) | |
| 307 | static VIDEO_START( vidadcba ) | |
| 308 | 308 | { |
| 309 | 309 | bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, 16, 8, 32, 32); |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | |
| 313 | VIDEO_UPDATE( videopkr ) | |
| 313 | static VIDEO_UPDATE( videopkr ) | |
| 314 | 314 | { |
| 315 | 315 | tilemap_mark_all_tiles_dirty(bg_tilemap); |
| 316 | 316 | tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); |
| r3333 | r3334 | |
|---|---|---|
| 544 | 544 | return 0; |
| 545 | 545 | } |
| 546 | 546 | |
| 547 | TIMER_CALLBACK( network_irq_clear ) | |
| 547 | static TIMER_CALLBACK( network_irq_clear ) | |
| 548 | 548 | { |
| 549 | 549 | cpunum_set_input_line(machine, 0, INPUT_LINE_IRQ2, CLEAR_LINE); |
| 550 | 550 | } |
| r3333 | r3334 | |
|---|---|---|
| 465 | 465 | res = BITSWAP16(keyval, 22,26,31,23,18,20,16,30,24,21,25,19,17,29,28,27); |
| 466 | 466 | |
| 467 | 467 | keyval >>= 1; |
| 468 | printf("popcount(%08X) = %d\n", keyval & 0x58000c00, popcount(keyval & 0x58000c00)); | |
| 468 | // printf("popcount(%08X) = %d\n", keyval & 0x58000c00, popcount(keyval & 0x58000c00)); | |
| 469 | 469 | if((!keyval) || (popcount(keyval & 0x58000c00) & 1)) |
| 470 | 470 | keyval ^= 0x80000000; |
| 471 | 471 |
| r3333 | r3334 | |
|---|---|---|
| 49 | 49 | * Video Hardware * |
| 50 | 50 | *************************/ |
| 51 | 51 | |
| 52 | VIDEO_START( itgambl3 ) | |
| 52 | static VIDEO_START( itgambl3 ) | |
| 53 | 53 | { |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | |
| 57 | VIDEO_UPDATE( itgambl3 ) | |
| 57 | static VIDEO_UPDATE( itgambl3 ) | |
| 58 | 58 | { |
| 59 | 59 | return 0; |
| 60 | 60 | } |
| r3333 | r3334 | |
| 158 | 158 | * Machine Reset * |
| 159 | 159 | **************************/ |
| 160 | 160 | |
| 161 | MACHINE_RESET( itgambl3 ) | |
| 161 | static MACHINE_RESET( itgambl3 ) | |
| 162 | 162 | { |
| 163 | 163 | /* stop the CPU, we have no code for it anyway */ |
| 164 | 164 | cpunum_set_input_line(machine, 0, INPUT_LINE_HALT, ASSERT_LINE); |
| r0 | r3334 | |
|---|---|---|
| 1 | /**************************************************************************************** | |
| 2 | Chanbara | |
| 3 | Data East, 1985 | |
| 4 | ||
| 5 | PCB Layout | |
| 6 | ---------- | |
| 7 | ||
| 8 | DE-0207-0 | |
| 9 | |-----------------------------------------------------------| | |
| 10 | | CP12.17H CP00-2.17C | | |
| 11 | | 2016 6809 | | |
| 12 | | CP13.15H CP01.15C | | |
| 13 | | 2016 | | |
| 14 | |1 RCDM-I4 CP14.13H CP02.14C | | |
| 15 | |8 RCDM-I1 2016 | | |
| 16 | |W RCDM-I1 CP03.11C 2016 | | |
| 17 | |A RCDM-I1 2148 CP04.10C | | |
| 18 | |Y RCDM-I1 CP05.9C | | |
| 19 | | RCDM-I1 2148 CP06.8C | | |
| 20 | | RM-C2 2148 TC15G032AY| | |
| 21 | | PM-C1 2148 CP07.6C | | |
| 22 | | DSW1 CP08.5C | | |
| 23 | |CP15.6K DECO DECO | | |
| 24 | |CP16.5K VSC30 CP09.3C HMC20 | | |
| 25 | |CP17.4K CP10.2C | | |
| 26 | |MB3730 558 558 YM3014 YM2203 CP11.1C 12MHz | | |
| 27 | |-----------------------------------------------------------| | |
| 28 | Notes: | |
| 29 | 6809 - clock 1.500MHz [12/8] | |
| 30 | YM2203 - clock 1.500MHz [12/8] | |
| 31 | VSC30 - clock 3.000MHz [12/4, pin 7), custom DECO DIP40 IC | |
| 32 | HMC20 - DECO HMC20 custom DIP28 IC. Provides many clocks each divided by 2 | |
| 33 | (i.e. 12MHz, 6MHz, 3MHz, 1.5MHz, 750kHz etc) | |
| 34 | HSync is generated on pins 12 and 13 with 12/256/3. Actual xtal measures | |
| 35 | 11.9931MHz, which accounts for the measured HSync error (12/256/3 = 15.625kHz) | |
| 36 | VSync - 57.4122Hz | |
| 37 | HSync - 15.6161kHz | |
| 38 | ||
| 39 | ------------------------ | |
| 40 | ||
| 41 | Driver by Tomasz Slanina & David Haywood | |
| 42 | ||
| 43 | ToDo: | |
| 44 | there might still be some sprite banking issues | |
| 45 | ||
| 46 | ||
| 47 | ****************************************************************************************/ | |
| 48 | ||
| 49 | #include "driver.h" | |
| 50 | #include "sound/2203intf.h" | |
| 51 | ||
| 52 | static tilemap *bg_tilemap; | |
| 53 | static tilemap *bg2_tilemap; | |
| 54 | ||
| 55 | static UINT8 *videoram2, *colorram2; | |
| 56 | ||
| 57 | static PALETTE_INIT( chanbara ) | |
| 58 | { | |
| 59 | int i, red, green, blue; | |
| 60 | ||
| 61 | for (i = 0;i < machine->config->total_colors;i++) | |
| 62 | { | |
| 63 | red = color_prom[i]; | |
| 64 | green = color_prom[machine->config->total_colors+i]; | |
| 65 | blue = color_prom[2*machine->config->total_colors+i]; | |
| 66 | ||
| 67 | palette_set_color_rgb(machine,i,pal4bit(red<<1),pal4bit(green<<1),pal4bit(blue<<1)); | |
| 68 | } | |
| 69 | } | |
| 70 | ||
| 71 | static WRITE8_HANDLER( chanbara_videoram_w ) | |
| 72 | { | |
| 73 | videoram[offset] = data; | |
| 74 | tilemap_mark_tile_dirty(bg_tilemap, offset); | |
| 75 | } | |
| 76 | ||
| 77 | static WRITE8_HANDLER( chanbara_colorram_w ) | |
| 78 | { | |
| 79 | colorram[offset] = data; | |
| 80 | tilemap_mark_tile_dirty(bg_tilemap, offset); | |
| 81 | } | |
| 82 | ||
| 83 | static WRITE8_HANDLER( chanbara_videoram2_w ) | |
| 84 | { | |
| 85 | videoram2[offset] = data; | |
| 86 | tilemap_mark_tile_dirty(bg2_tilemap, offset); | |
| 87 | } | |
| 88 | ||
| 89 | static WRITE8_HANDLER( chanbara_colorram2_w ) | |
| 90 | { | |
| 91 | colorram2[offset] = data; | |
| 92 | tilemap_mark_tile_dirty(bg2_tilemap, offset); | |
| 93 | } | |
| 94 | ||
| 95 | ||
| 96 | static TILE_GET_INFO( get_bg_tile_info ) | |
| 97 | { | |
| 98 | int code = videoram[tile_index] + ((colorram[tile_index] & 1) << 8); | |
| 99 | int color = (colorram[tile_index] >> 1) & 0x1f; | |
| 100 | ||
| 101 | SET_TILE_INFO(0, code, color, 0); | |
| 102 | } | |
| 103 | ||
| 104 | static TILE_GET_INFO( get_bg2_tile_info ) | |
| 105 | { | |
| 106 | int code = videoram2[tile_index]; | |
| 107 | int color = (colorram2[tile_index] >> 1) & 0x1f; | |
| 108 | ||
| 109 | SET_TILE_INFO(2, code, color, 0); | |
| 110 | } | |
| 111 | ||
| 112 | static VIDEO_START(chanbara ) | |
| 113 | { | |
| 114 | bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows,8, 8, 32, 32); | |
| 115 | bg2_tilemap = tilemap_create(get_bg2_tile_info, tilemap_scan_rows,16, 16, 16, 32); | |
| 116 | tilemap_set_transparent_pen(bg_tilemap,0); | |
| 117 | } | |
| 118 | ||
| 119 | static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) | |
| 120 | { | |
| 121 | int offs; | |
| 122 | ||
| 123 | for (offs = 0; offs < 0x80; offs += 4) | |
| 124 | { | |
| 125 | if(spriteram[offs + 0x80]&0x80) | |
| 126 | { | |
| 127 | int attr = spriteram[offs + 0]; | |
| 128 | int code = spriteram[offs + 1]; | |
| 129 | int color = spriteram[offs + 0x80]&0x1f; | |
| 130 | int flipx = 0; | |
| 131 | int flipy = attr & 2; | |
| 132 | int sx = 240-spriteram[offs + 3]; | |
| 133 | int sy = 232-spriteram[offs+2]; | |
| 134 | ||
| 135 | sy+=16; | |
| 136 | ||
| 137 | if (spriteram[offs + 0x80]&0x10) code += 0x200; | |
| 138 | if (spriteram[offs + 0x80]&0x20) code += 0x400; | |
| 139 | if (spriteram[offs + 0x80]&0x40) code += 0x100; | |
| 140 | ||
| 141 | if(attr&0x10) | |
| 142 | { | |
| 143 | if(!flipy) | |
| 144 | { | |
| 145 | ||
| 146 | drawgfx(bitmap, machine->gfx[1], code, color, flipx, flipy, sx, sy-16,cliprect, TRANSPARENCY_PEN, 0); | |
| 147 | drawgfx(bitmap, machine->gfx[1], code+1, color, flipx, flipy, sx, sy, cliprect, TRANSPARENCY_PEN, 0); | |
| 148 | } | |
| 149 | else | |
| 150 | { | |
| 151 | drawgfx(bitmap, machine->gfx[1], code, color, flipx, flipy, sx, sy,cliprect, TRANSPARENCY_PEN, 0); | |
| 152 | drawgfx(bitmap, machine->gfx[1], code+1, color, flipx, flipy, sx, sy-16,cliprect, TRANSPARENCY_PEN, 0); | |
| 153 | } | |
| 154 | } | |
| 155 | else | |
| 156 | { | |
| 157 | drawgfx(bitmap, machine->gfx[1], code, color, flipx, flipy, sx, sy,cliprect, TRANSPARENCY_PEN, 0); | |
| 158 | } | |
| 159 | } | |
| 160 | } | |
| 161 | } | |
| 162 | ||
| 163 | static UINT8 scroll; | |
| 164 | static UINT8 scrollhi; | |
| 165 | ||
| 166 | VIDEO_UPDATE( chanbara ) | |
| 167 | { | |
| 168 | tilemap_set_scrolly(bg2_tilemap,0,scroll | (scrollhi << 8)); | |
| 169 | tilemap_draw(bitmap, cliprect, bg2_tilemap, 0, 0); | |
| 170 | draw_sprites(screen->machine, bitmap, cliprect); | |
| 171 | tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); | |
| 172 | return 0; | |
| 173 | } | |
| 174 | ||
| 175 | static ADDRESS_MAP_START( memmap, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 176 | AM_RANGE(0x0000, 0x07ff) AM_RAM | |
| 177 | AM_RANGE(0x0800, 0x0bff) AM_READ(SMH_RAM) AM_WRITE(chanbara_videoram_w) AM_BASE(&videoram) | |
| 178 | AM_RANGE(0x0c00, 0x0fff) AM_READ(SMH_RAM) AM_WRITE(chanbara_colorram_w) AM_BASE(&colorram) | |
| 179 | AM_RANGE(0x1000, 0x10ff) AM_RAM AM_BASE(&spriteram) | |
| 180 | AM_RANGE(0x1800, 0x19ff) AM_READ(SMH_RAM) AM_WRITE(chanbara_videoram2_w) AM_BASE(&videoram2) | |
| 181 | AM_RANGE(0x1a00, 0x1bff) AM_READ(SMH_RAM) AM_WRITE(chanbara_colorram2_w) AM_BASE(&colorram2) | |
| 182 | AM_RANGE(0x2000, 0x2000) AM_READ_PORT("DSW0") | |
| 183 | AM_RANGE(0x2001, 0x2001) AM_READ_PORT("SYSTEM") | |
| 184 | AM_RANGE(0x2003, 0x2003) AM_READ_PORT("JOY") | |
| 185 | AM_RANGE(0x3800, 0x3800) AM_READ(ym2203_status_port_0_r) AM_WRITE(ym2203_control_port_0_w) | |
| 186 | AM_RANGE(0x3801, 0x3801) AM_WRITE(ym2203_write_port_0_w) | |
| 187 | AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK1) | |
| 188 | AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM) | |
| 189 | ADDRESS_MAP_END | |
| 190 | ||
| 191 | /***************************************************************************/ | |
| 192 | ||
| 193 | static INPUT_PORTS_START( chanbara ) | |
| 194 | PORT_START ("DSW0") | |
| 195 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) ) | |
| 196 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 197 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 198 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unused ) ) | |
| 199 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) | |
| 200 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 201 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) ) | |
| 202 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) | |
| 203 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 204 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) ) | |
| 205 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 206 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 207 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) ) | |
| 208 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 209 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 210 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) ) | |
| 211 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 212 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 213 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) ) | |
| 214 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 215 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 216 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) | |
| 217 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 218 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 219 | ||
| 220 | PORT_START ("SYSTEM") | |
| 221 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) | |
| 222 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) | |
| 223 | PORT_DIPNAME( 0x04, 0x04, "2" ) | |
| 224 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) | |
| 225 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 226 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) ) | |
| 227 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 228 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 229 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 ) | |
| 230 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 ) | |
| 231 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE1 ) | |
| 232 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK ) | |
| 233 | ||
| 234 | /* System Port */ | |
| 235 | PORT_START ("JOY") | |
| 236 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_DOWN ) | |
| 237 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_UP ) | |
| 238 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_LEFT ) | |
| 239 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_RIGHT ) | |
| 240 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_DOWN ) | |
| 241 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_UP ) | |
| 242 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_LEFT ) | |
| 243 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_RIGHT ) | |
| 244 | INPUT_PORTS_END | |
| 245 | ||
| 246 | /***************************************************************************/ | |
| 247 | ||
| 248 | static const gfx_layout tilelayout = | |
| 249 | { | |
| 250 | 8,8, /* tile size */ | |
| 251 | RGN_FRAC(1,2), /* number of tiles */ | |
| 252 | 2, /* bits per pixel */ | |
| 253 | { 0, 4 }, /* plane offsets */ | |
| 254 | { RGN_FRAC(1,2)+0, RGN_FRAC(1,2)+1, RGN_FRAC(1,2)+2, RGN_FRAC(1,2)+3, 0,1,2,3 }, /* x offsets */ | |
| 255 | { 0*8,1*8,2*8,3*8, 4*8, 5*8, 6*8, 7*8 }, /* y offsets */ | |
| 256 | 8*8 /* offset to next tile */ | |
| 257 | }; | |
| 258 | ||
| 259 | static const gfx_layout tile16layout = | |
| 260 | { | |
| 261 | 16,16, /* tile size */ | |
| 262 | RGN_FRAC(1,4), /* number of tiles */ | |
| 263 | 3, /* bits per pixel */ | |
| 264 | { RGN_FRAC(1,2),0,4 }, /* plane offsets */ | |
| 265 | { 16*8+RGN_FRAC(1,4)+0,16*8+ RGN_FRAC(1,4)+1,16*8+ RGN_FRAC(1,4)+2,16*8+ RGN_FRAC(1,4)+3, | |
| 266 | 0,1,2,3, | |
| 267 | RGN_FRAC(1,4)+0, RGN_FRAC(1,4)+1, RGN_FRAC(1,4)+2, RGN_FRAC(1,4)+3, | |
| 268 | 16*8+0, 16*8+1, 16*8+2, 16*8+3, | |
| 269 | ||
| 270 | }, /* x offsets */ | |
| 271 | { 0*8,1*8,2*8,3*8, 4*8, 5*8, 6*8, 7*8,8*8,9*8,10*8,11*8,12*8,13*8,14*8,15*8 }, /* y offsets */ | |
| 272 | 32*8 /* offset to next tile */ | |
| 273 | }; | |
| 274 | ||
| 275 | ||
| 276 | static const gfx_layout spritelayout = | |
| 277 | { | |
| 278 | 16,16, | |
| 279 | RGN_FRAC(1,3), | |
| 280 | 3, | |
| 281 | { RGN_FRAC(2,3),RGN_FRAC(1,3), 0}, | |
| 282 | { 2*8*8+0,2*8*8+1,2*8*8+2,2*8*8+3,2*8*8+4,2*8*8+5,2*8*8+6,2*8*8+7, | |
| 283 | 0,1,2,3,4,5,6,7 }, | |
| 284 | { 0*8,1*8,2*8,3*8,4*8,5*8,6*8,7*8, | |
| 285 | 1*8*8+0*8,1*8*8+1*8,1*8*8+2*8,1*8*8+3*8,1*8*8+4*8,1*8*8+5*8,1*8*8+6*8,1*8*8+7*8 }, | |
| 286 | 16*16 | |
| 287 | }; | |
| 288 | ||
| 289 | static GFXDECODE_START( chanbara ) | |
| 290 | GFXDECODE_ENTRY( "gfx1", 0x00000, tilelayout, 0x40, 32 ) | |
| 291 | GFXDECODE_ENTRY( "gfx2", 0x00000, spritelayout, 0x80, 16 ) | |
| 292 | ||
| 293 | GFXDECODE_ENTRY( "gfx3", 0x00000, tile16layout, 0, 32 ) | |
| 294 | GFXDECODE_END | |
| 295 | /***************************************************************************/ | |
| 296 | ||
| 297 | ||
| 298 | static WRITE8_HANDLER(chanbara_ay_out_0_w) | |
| 299 | { | |
| 300 | // printf("chanbara_ay_out_0_w %02x\n",data); | |
| 301 | scroll=data; | |
| 302 | } | |
| 303 | ||
| 304 | static WRITE8_HANDLER(chanbara_ay_out_1_w) | |
| 305 | { | |
| 306 | // printf("chanbara_ay_out_1_w %02x\n",data); | |
| 307 | memory_set_bankptr(1, memory_region(machine, "user1") + ((data&4)?0x4000:0x0000) ); | |
| 308 | scrollhi = data & 0x03; | |
| 309 | ||
| 310 | //if (data&0xf8) printf("chanbara_ay_out_1_w unused bits set %02x\n",data&0xf8); | |
| 311 | } | |
| 312 | ||
| 313 | static void sound_irq(running_machine *machine, int linestate) | |
| 314 | { | |
| 315 | cpunum_set_input_line(machine, 0,0,linestate); | |
| 316 | } | |
| 317 | ||
| 318 | ||
| 319 | static const ym2203_interface ym2203_config = | |
| 320 | { | |
| 321 | { | |
| 322 | AY8910_LEGACY_OUTPUT, | |
| 323 | AY8910_DEFAULT_LOADS, | |
| 324 | 0, | |
| 325 | 0, | |
| 326 | chanbara_ay_out_0_w, | |
| 327 | chanbara_ay_out_1_w, | |
| 328 | }, | |
| 329 | sound_irq | |
| 330 | }; | |
| 331 | ||
| 332 | static MACHINE_DRIVER_START( chanbara ) | |
| 333 | MDRV_CPU_ADD("main", M6809, 12000000/8) | |
| 334 | MDRV_CPU_PROGRAM_MAP(memmap,0) | |
| 335 | ||
| 336 | /* video hardware */ | |
| 337 | MDRV_SCREEN_ADD("main", RASTER) | |
| 338 | MDRV_SCREEN_REFRESH_RATE(57.4122) | |
| 339 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) | |
| 340 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) | |
| 341 | MDRV_SCREEN_SIZE(32*8, 32*8) | |
| 342 | MDRV_SCREEN_VISIBLE_AREA(0, 32*8-1, 2*8, 30*8-1) | |
| 343 | ||
| 344 | MDRV_GFXDECODE(chanbara) | |
| 345 | MDRV_PALETTE_LENGTH(256) | |
| 346 | MDRV_PALETTE_INIT(chanbara) | |
| 347 | ||
| 348 | MDRV_VIDEO_START(chanbara) | |
| 349 | MDRV_VIDEO_UPDATE(chanbara) | |
| 350 | ||
| 351 | MDRV_SPEAKER_STANDARD_MONO("mono") | |
| 352 | ||
| 353 | MDRV_SOUND_ADD("ym", YM2203, 12000000/8) | |
| 354 | MDRV_SOUND_CONFIG(ym2203_config) | |
| 355 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) | |
| 356 | MACHINE_DRIVER_END | |
| 357 | ||
| 358 | ||
| 359 | ROM_START( chanbara ) | |
| 360 | ROM_REGION( 0x10000, "main", 0 ) | |
| 361 | ROM_LOAD( "cp01.16c", 0x08000, 0x4000, CRC(a0c3c24c) SHA1(8445dc39dd763187a2d66c6165b487f146e7d474)) | |
| 362 | ROM_LOAD( "cp00-2.17c", 0x0c000, 0x4000, CRC(a045e463) SHA1(2eb546e16f163be6ed72238f2f0203527a957efd) ) | |
| 363 | ||
| 364 | ROM_REGION( 0x8000, "user1", 0 ) // background data | |
| 365 | ROM_LOAD( "cp02.14c", 0x00000, 0x8000, CRC(c2b66cea) SHA1(f72f57add5f38313a72f5c521dce157edf49f70e) ) | |
| 366 | ||
| 367 | ROM_REGION( 0x02000, "gfx1", ROMREGION_DISPOSE ) // text layer | |
| 368 | ROM_LOAD( "cp12.17h", 0x00000, 0x2000, CRC(b87b96de) SHA1(f8bb9f094917df305c4fed071edaa775071e40fd) ) | |
| 369 | ||
| 370 | ROM_REGION( 0x08000, "gfx3", ROMREGION_DISPOSE ) // bg layer | |
| 371 | ROM_LOAD( "cp13.15h", 0x00000, 0x4000, CRC(2dc38c3d) SHA1(4bb1335b8285e91b51c28e74d8de11a8d6df0486) ) | |
| 372 | /* rom cp14.13h is expanded at 0x4000 - 0x8000 */ | |
| 373 | ||
| 374 | ROM_REGION( 0x08000, "gfx4", ROMREGION_DISPOSE ) | |
| 375 | ROM_LOAD( "cp14.13h", 0x00000, 0x2000, CRC(d31db368) SHA1(b62834137bfe4ac2013d2d16b0ead10bf2a2df83) ) | |
| 376 | ||
| 377 | ROM_REGION( 0x24000, "gfx2", ROMREGION_DISPOSE ) | |
| 378 | ROM_LOAD( "cp03.12c", 0x08000, 0x4000, CRC(dea247fb) SHA1(d54fa30813613ef6c3b5f86b563e9ab618a9f627)) | |
| 379 | ROM_LOAD( "cp04.10c", 0x04000, 0x4000, CRC(f7dce87b) SHA1(129ae41d70d96720e020ec1bc1d3f2d9e87ebf47) ) | |
| 380 | ROM_LOAD( "cp05.9c", 0x00000, 0x4000, CRC(df2dc3cb) SHA1(3505042c91566bb09fcd2102fecbe2034551b8eb) ) | |
| 381 | ||
| 382 | ROM_LOAD( "cp06.7c", 0x14000, 0x4000, CRC(2f337c08) SHA1(657ee6776780fa0a979a278ff27a49b459232cad) ) | |
| 383 | ROM_LOAD( "cp07.6c", 0x10000, 0x4000, CRC(0e3727f2) SHA1(d177651bc20a56f5651ae5ce6f3d3ff7ad0e2053) ) | |
| 384 | ROM_LOAD( "cp08.5c", 0x0c000, 0x4000, CRC(4cf35192) SHA1(1891dcc412caf72ba5a2ea56c1cab35cb3ae6123) ) | |
| 385 | ||
| 386 | ROM_LOAD( "cp09.4c", 0x20000, 0x4000, CRC(3f58b647) SHA1(4eb212667aedd7c397a4911ac7f1b542c5c0a70d) ) | |
| 387 | ROM_LOAD( "cp10.2c", 0x1c000, 0x4000, CRC(bfa324c0) SHA1(c7ff09bb5f1dd2d3707970fae1fd60b6004250c0) ) | |
| 388 | ROM_LOAD( "cp11.1c", 0x18000, 0x4000, CRC(33e6160a) SHA1(b0171b554825072eebe935d12a6085d158b87bdc) ) | |
| 389 | ||
| 390 | ROM_REGION( 0x0300, "proms", 0 ) | |
| 391 | ROM_LOAD( "cp17.4k", 0x0000, 0x0100, CRC(cf03706e) SHA1(2dd2b29067f418ec590c56a38cc64d09d8dc8e09) ) /* red */ | |
| 392 | ROM_LOAD( "cp16.5k", 0x0100, 0x0100, CRC(5fedc8ba) SHA1(8b685ce71d833fefb3e4502d1dd0cca96ba9162a) ) /* green */ | |
| 393 | ROM_LOAD( "cp15.6k", 0x0200, 0x0100, CRC(655936eb) SHA1(762b419c0571fafd8e1c5e96d0d94999768ba325) ) /* blue */ | |
| 394 | ROM_END | |
| 395 | ||
| 396 | ||
| 397 | static DRIVER_INIT(chanbara ) | |
| 398 | { | |
| 399 | UINT8 *src = memory_region(machine, "gfx4"); | |
| 400 | UINT8 *dst = memory_region(machine, "gfx3")+0x4000; | |
| 401 | ||
| 402 | int i; | |
| 403 | for (i=0;i<0x1000;i++) | |
| 404 | { | |
| 405 | dst[i+0x1000] = src[i]&0xf0; | |
| 406 | dst[i+0x0000] = (src[i]&0x0f)<<4; | |
| 407 | dst[i+0x3000] = src[i+0x1000]&0xf0; | |
| 408 | dst[i+0x2000] = (src[i+0x1000]&0x0f)<<4; | |
| 409 | } | |
| 410 | } | |
| 411 | ||
| 412 | GAME( 1985, chanbara, 0, chanbara, chanbara, chanbara, ROT270, "Data East", "Chanbara", 0 ) |
| r3333 | r3334 | |
|---|---|---|
| 720 | 720 | |
| 721 | 721 | *****************************************************************************/ |
| 722 | 722 | |
| 723 | CUSTOM_INPUT( gwar_rotary ) | |
| 723 | static CUSTOM_INPUT( gwar_rotary ) | |
| 724 | 724 | { |
| 725 | 725 | static int last_value[2] = {0, 0}; |
| 726 | 726 | static int cp_count[2] = {0, 0}; |
| r3333 | r3334 | |
| 739 | 739 | return value; |
| 740 | 740 | } |
| 741 | 741 | |
| 742 | CUSTOM_INPUT( gwarb_rotary ) | |
| 742 | static CUSTOM_INPUT( gwarb_rotary ) | |
| 743 | 743 | { |
| 744 | 744 | if (input_port_read(field->port->machine, "JOYSTICK_MODE") == 1) |
| 745 | 745 | { |
| r3333 | r3334 | |
|---|---|---|
| 1801 | 1801 | |
| 1802 | 1802 | static INPUT_PORTS_START( gunbulet ) |
| 1803 | 1803 | PORT_START("MISC") |
| 1804 | PORT_DIPNAME( 0x01, 0x00, "DSW2 (unused)" ) | |
| 1805 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 1806 | PORT_DIPSETTING( 0x01, DEF_STR( On ) ) | |
| 1807 | PORT_DIPNAME( 0x02, 0x00, "DSW1 (unused)" ) | |
| 1808 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 1809 | PORT_DIPSETTING( 0x02, DEF_STR( On ) ) | |
| 1804 | PORT_DIPUNUSED_DIPLOC(0x01, 0x01, "SW1: 2") | |
| 1805 | PORT_SERVICE_DIPLOC(0x02, 0x02, "SW1: 1") | |
| 1806 | ||
| 1810 | 1807 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1811 | 1808 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1812 | 1809 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 1813 | 1810 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 1814 | PORT_DIPNAME( 0x40, 0x00, "Test switch" ) | |
| 1815 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 1816 | PORT_DIPSETTING( 0x40, DEF_STR( On ) ) | |
| 1811 | PORT_DIPNAME( 0x40, 0x40, "Test switch" ) | |
| 1812 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 1813 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1817 | 1814 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| 1818 | 1815 | |
| 1819 | 1816 | PORT_START("P1") |
| r3333 | r3334 | |
| 1856 | 1853 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 ) |
| 1857 | 1854 | |
| 1858 | 1855 | PORT_START("MISC") |
| 1859 | PORT_DIPNAME( 0x01, 0x01, "Freeze Screen" ) | |
| 1860 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 1861 | PORT_DIPSETTING( 0x01, DEF_STR( On ) ) | |
| 1862 | PORT_DIPNAME( 0x02, 0x02, "DSW1 (Test)" ) | |
| 1863 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 1864 | PORT_DIPSETTING( 0x02, DEF_STR( On ) ) | |
| 1856 | PORT_DIPNAME( 0x01, 0x01, "Freeze Screen" ) PORT_DIPLOCATION("SW1: 2") | |
| 1857 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 1858 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1859 | PORT_SERVICE_DIPLOC(0x02, 0x02, "SW1: 1") | |
| 1865 | 1860 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 1866 | 1861 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 1867 | 1862 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| r3333 | r3334 | |
| 1892 | 1887 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 ) |
| 1893 | 1888 | |
| 1894 | 1889 | PORT_START("MISC") |
| 1895 | PORT_DIPNAME( 0x01, 0x01, "Freeze Screen" ) | |
| 1896 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 1897 | PORT_DIPSETTING( 0x01, DEF_STR( On ) ) | |
| 1898 | PORT_DIPNAME( 0x02, 0x02, "DSW1 (Test)" ) | |
| 1899 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 1900 | PORT_DIPSETTING( 0x02, DEF_STR( On ) ) | |
| 1890 | PORT_DIPNAME( 0x01, 0x01, "Freeze Screen" ) PORT_DIPLOCATION("SW1: 2") | |
| 1891 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 1892 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1893 | PORT_SERVICE_DIPLOC(0x02, 0x02, "SW1: 1") | |
| 1901 | 1894 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1902 | 1895 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1903 | 1896 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 ) |
| r3333 | r3334 | |
| 1948 | 1941 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START4 ) |
| 1949 | 1942 | |
| 1950 | 1943 | PORT_START("MISC") |
| 1951 | PORT_DIPNAME( 0x01, 0x00, "DSW2 (unused)" ) | |
| 1952 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 1953 | PORT_DIPSETTING( 0x01, DEF_STR( On ) ) | |
| 1954 | PORT_DIPNAME( 0x02, 0x00, "DSW1 (unused)" ) | |
| 1955 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 1956 | PORT_DIPSETTING( 0x02, DEF_STR( On ) ) | |
| 1944 | PORT_DIPNAME( 0x01, 0x01, "Freeze Screen" ) PORT_DIPLOCATION("SW1: 2") | |
| 1945 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 1946 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1947 | PORT_SERVICE_DIPLOC(0x02, 0x02, "SW1: 1") | |
| 1957 | 1948 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 1958 | 1949 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 1959 | 1950 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN3 ) |
| 1960 | 1951 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN4 ) |
| 1961 | PORT_DIPNAME( 0x40, 0x00, "Test switch" ) | |
| 1962 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 1963 | PORT_DIPSETTING( 0x40, DEF_STR( On ) ) | |
| 1952 | PORT_DIPNAME( 0x40, 0x40, "Test switch" ) | |
| 1953 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 1954 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 1964 | 1955 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| 1965 | 1956 | INPUT_PORTS_END |
| 1966 | 1957 |
| r3333 | r3334 | |
|---|---|---|
| 680 | 680 | |
| 681 | 681 | Port A of both chips is connected to a banking control |
| 682 | 682 | register. |
| 683 | ||
| 684 | All 6 (3*2) AY-3-8910/12 outputs are tied together | |
| 685 | and put with 1000 Ohm to gnd. | |
| 686 | The following is a approximation, since | |
| 687 | it does not take cross-chip mixing effects into account. | |
| 683 | 688 | */ |
| 684 | 689 | |
| 685 | 690 | static const ay8910_interface ay8910_config = |
| 686 | 691 | { |
| 687 | AY8910_LEGACY_OUTPUT, | |
| 688 | AY8910_DEFAULT_LOADS, | |
| 692 | AY8910_SINGLE_OUTPUT, | |
| 693 | {1000, 0, 0}, | |
| 689 | 694 | leland_sound_port_r, |
| 690 | 695 | 0, |
| 691 | 696 | leland_sound_port_w, |
| r3333 | r3334 | |
|---|---|---|
| 410 | 410 | }; |
| 411 | 411 | |
| 412 | 412 | |
| 413 | const ym2203_interface kothello_ym2203_interface = | |
| 413 | static const ym2203_interface kothello_ym2203_interface = | |
| 414 | 414 | { |
| 415 | 415 | { |
| 416 | 416 | AY8910_LEGACY_OUTPUT, |
| r3333 | r3334 | |
|---|---|---|
| 295 | 295 | Input Ports |
| 296 | 296 | ***************************************************************************/ |
| 297 | 297 | |
| 298 | INPUT_PORTS_START( jingbell ) | |
| 298 | static INPUT_PORTS_START( jingbell ) | |
| 299 | 299 | PORT_START("DSW1") |
| 300 | 300 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) ) |
| 301 | 301 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| r3333 | r3334 | |
|---|---|---|
| 433 | 433 | DRIVER_INIT_CALL(snes_hirom); |
| 434 | 434 | } |
| 435 | 435 | |
| 436 | DRIVER_INIT( ffight2b ) | |
| 436 | static DRIVER_INIT( ffight2b ) | |
| 437 | 437 | { |
| 438 | 438 | INT32 i; |
| 439 | 439 | UINT8 *rom = memory_region(machine, "user3"); |
| r3333 | r3334 | |
|---|---|---|
| 29 | 29 | ***************************************************************************/ |
| 30 | 30 | |
| 31 | 31 | static tilemap *tmap; |
| 32 | int tiles_offset; | |
| 32 | static int tiles_offset; | |
| 33 | 33 | |
| 34 | 34 | static WRITE8_HANDLER( subsino_tiles_offset_w ) |
| 35 | 35 | { |
| r3333 | r3334 | |
| 148 | 148 | Input Ports |
| 149 | 149 | ***************************************************************************/ |
| 150 | 150 | |
| 151 | INPUT_PORTS_START( smoto ) | |
| 151 | static INPUT_PORTS_START( smoto ) | |
| 152 | 152 | |
| 153 | 153 | PORT_START( "DSW1" ) |
| 154 | 154 | PORT_DIPUNKNOWN( 0x01, 0x01 ) |
| r3333 | r3334 | |
|---|---|---|
| 251 | 251 | AM_RANGE(0x000000, 0x07ffff) AM_READ(SMH_ROM) |
| 252 | 252 | AM_RANGE(0x200000, 0x20ffff) AM_READWRITE( sharedram_sub_r, sharedram_sub_w ) |
| 253 | 253 | AM_RANGE(0xa00000, 0xa07fff) AM_READWRITE( c352_0_r, c352_0_w ) |
| 254 | AM_RANGE(0xc00000, 0xc00001) AM_READ_PORT("P1_P2") | |
| 255 | AM_RANGE(0xc00002, 0xc00003) AM_READ_PORT("DSW") | |
| 254 | AM_RANGE(0xc00000, 0xc00001) AM_READ_PORT("DSW") | |
| 255 | AM_RANGE(0xc00002, 0xc00003) AM_READ_PORT("P1_P2") | |
| 256 | 256 | AM_RANGE(0xc00010, 0xc00011) AM_NOP |
| 257 | 257 | AM_RANGE(0xc00030, 0xc00031) AM_NOP |
| 258 | 258 | AM_RANGE(0xc00040, 0xc00041) AM_NOP |
| r3333 | r3334 | |
|---|---|---|
| 261 | 261 | //static const struct sh4_config sh4cpu_config = { 1, 0, 1, 0, 0, 0, 1, 1, 0, CPU_CLOCK }; |
| 262 | 262 | |
| 263 | 263 | |
| 264 | VIDEO_START(hikaru) | |
| 264 | static VIDEO_START(hikaru) | |
| 265 | 265 | { |
| 266 | 266 | |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | VIDEO_UPDATE(hikaru) | |
| 269 | static VIDEO_UPDATE(hikaru) | |
| 270 | 270 | { |
| 271 | 271 | return 0; |
| 272 | 272 | } |
| r3333 | r3334 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | Namco (Super) System 23 | |
| 2 | Namco System 22.5 and (Super) System 23 | |
| 3 | 3 | Extremely preliminary driver by R. Belmont, thanks to Phil Stroffolino & Olivier Galibert |
| 4 | 4 | |
| 5 | 5 | Hardware: R4650 (MIPS III with IDT special instructions) main CPU @ 166 MHz |
| r3333 | r3334 | |
| 14 | 14 | - Text layer is (almost?) identical to System 22 & Super System 22. |
| 15 | 15 | |
| 16 | 16 | TODO: |
| 17 | - Text layer does not refresh properly in all cases, in spite of forced all-dirty. | |
| 18 | Why? | |
| 17 | - Palette is not right. | |
| 19 | 18 | |
| 20 | - Palette is not right. Games always write 16 bits at a time where the top 8 bits of each 16 | |
| 21 | appear to always be 0 (some sort of gamma correct?). | |
| 22 | ||
| 23 | 19 | - H8/3002 does not handshake. Protocol should be the same as System 12 where the MIPS |
| 24 | 20 | writes 0x3163 to offset 0x3002 in the shared RAM and the H8/3002 notices and sets it to 0x7106. |
| 25 | 21 | The H8 currently never reads that location (core bug?). |
| r3333 | r3334 | |
| 52 | 48 | *Gunmen Wars Namco, 1998 System 23 |
| 53 | 49 | *Motocross Go! Namco, 1997 System 23 |
| 54 | 50 | *Panic Park Namco, 1998 System 23 |
| 55 | Rapid River Namco, 1997 System 2 | |
| 51 | Rapid River Namco, 1997 System 22.5/ | |
| 56 | 52 | Time Crisis II Namco, 1997 System 23 |
| 57 | 53 | *Underground King Namco, 1998 System 23 |
| 58 | 54 | *Downhill Bikers Namco, 199? System 23 |
| 59 | 55 | GP 500 Namco, 1999 Super System 23 |
| 60 | ||
| 56 | ||
| 61 | 57 | Final Furlong 2 Namco, 1999 Super System 23 |
| 62 | 58 | *Guitar Jam Namco, 1999 Super System 23 |
| 63 | 59 | *Race On! Namco, 1998 Super System 23 |
| 64 | 60 | |
| 65 | * - denotes not dumped yet (and hardware type not confirmed). If you can help with the remaining undumped S23/SS23 games, | |
| 61 | * - denotes not dumped yet (and hardware type not confirmed). If you can help with the remaining undumped S22.5/S23/SS23 games, | |
| 66 | 62 | please contact me at http://www.mameworld.net/gurudumps/ |
| 67 | 63 | |
| 68 | 64 | The system comprises the following main boards.... |
| r3333 | r3334 | |
| 498 | 494 | ADM485 - Analog Devices ADM485 +5V Low Power EIA RS-485 Transceiver (SOIC8) |
| 499 | 495 | */ |
| 500 | 496 | |
| 497 | /* | |
| 498 | Rapid River | |
| 499 | Namco, 1997 | |
| 501 | 500 | |
| 501 | This game runs on hardware called "GORGON". It appears to be similar to | |
| 502 | System 23 but the PCBs are slightly larger. | |
| 503 | ||
| 504 | The system comprises Main PCB, ROM PCB and I/O PCB all located inside | |
| 505 | a metal box with 3 separate power supplies for 5V, 12V and 3.3V. Main | |
| 506 | input power is 115V. | |
| 507 | The game is controlled by rotating a paddle (for thrust) and turning it | |
| 508 | sideways (moves left/right). | |
| 509 | The rotation action is done with a 5K potentiometer whereby the thrust | |
| 510 | is achieved by moving the pot from full left to full right continuously. | |
| 511 | The left/right turning movement is just another 5K potentiometer connected | |
| 512 | to the column of the paddle center shaft. | |
| 513 | There are also some buttons just for test mode, including SELECT, UP & DOWN | |
| 514 | The player's seat has movement controlled by a compressor and several | |
| 515 | potentiometers. On bootup, the system tests the seat movement and displays | |
| 516 | a warning if it's not working. Pressing START allows the game to continue | |
| 517 | and function normally without the seat movement. | |
| 518 | ||
| 519 | ||
| 520 | Main PCB | |
| 521 | -------- | |
| 522 | ||
| 523 | 8664960102 (8664970102) GORGON MAIN PCB | |
| 524 | |------------------------------------------------------------------------------------------------------| | |
| 525 | | J4 J5 J6 | | |
| 526 | | |---------| |---------| |------| |---------| | | |
| 527 | | |---------| |------| | | | | |C401 | | |HM534251 HM534251 | | |
| 528 | | CXD1178Q| | |C381 | | C374 | |------| | C417 | | | | 304 |HM534251 HM534251 | | |
| 529 | | | C404 | | | | | |C435 | | | |------| | |HM534251 HM534251 | | |
| 530 | | | | |------| | | | | | | |------| | | | | |
| 531 | | | | |---------| |------| |---------| |C400 | |---------| | | |
| 532 | | |---------| |---------| |------| | | |---------| | | |
| 533 | | | | |C435 | 341256 |------| | |HM534251 HM534251 | | |
| 534 | | | C397 | | | |------| | 304 |HM534251 HM534251 | | |
| 535 | | 341256 341256 341256 | | |------| 341256 |C401 | | |HM534251 HM534251 | | |
| 536 | | M5M51008 341256 | | |---------| | | | | | | |
| 537 | | |---------| | | |------| |------| |---------| | | |
| 538 | | M5M51008 341256 |------| | C403 | |C406 | |------| |---------| | | |
| 539 | |ADM485 |---------| |C379 | | | | | |C400 | | |HM534251 HM534251 | | |
| 540 | | | | | | | | |------| | | | 304 |HM534251 HM534251 | | |
| 541 | | M5M51008 | C300 | |------| |---------| |------| | |HM534251 HM534251 | | |
| 542 | | | | LH540204 LH540204 |------| | | | | |
| 543 | | M5M51008 | |341256 |------| |C401 | |---------| | | |
| 544 | |J1 HCPL0611 |---------|341256 |C407 | | | |---------| | | |
| 545 | | DS8921 PST575 PST575 | | |------| | | | | |
| 546 | | DS8921 |------| |------| | 304 |HM534251 HM534251 | | |
| 547 | | M5M51008 |C400 | | |HM534251 HM534251 | | |
| 548 | | CY7C128 CY2291S | | | | | | |
| 549 | | |------|M5M51008 14.31818MHz |------| |---------| | | |
| 550 | | |C422 | J9 M5M5256 |------| |---------| 3V_BATT | | |
| 551 | | | |341256 |C400 | | | | | |
| 552 | | |------|341256 | | | C399 |341256 LEDS(8) | | |
| 553 | | |------| |--------| |------| | |341256 | | |
| 554 | | |C352 | |ALTERA | |------| | | | | |
| 555 | | ADM485 DSW1(2) |------| | | |EPM7128 | |C401 | |---------| DSW3(2) DSW5(8)| | |
| 556 | | 2061ASC |C416 | |------| | | | | |---------| |---------| | | |
| 557 | | 14.7456MHz | | |--------| |------| | | |NKK | | | |
| 558 | |PAL |-----| |------| |------| D4516161 | C413 | |NR4650 | | | |
| 559 | | |H8/ | |C361 | D4516161 | | |LQF-133 | | | |
| 560 | | |3002 | | |LC321664 | | | | | | |
| 561 | | J10 |-----| |------| J8 |---------| |---------| | | |
| 562 | |------------------------------------------------------------------------------------------------------| | |
| 563 | Notes: | |
| 564 | NKK NR4650 - R4600-based 64bit RISC CPU (Main CPU, QFP208, clock input source = CY2291S) | |
| 565 | H8/3002 - Hitachi H8/3002 HD6413002F17 (Sound CPU, QFP100, running at 14.7456MHz) | |
| 566 | EPM7128 - Altera EPM7128 FPGA labelled 'GOR-M1' (PLCC84) | |
| 567 | PAL - PALCE16V8H stamped 'GOR-M3' (PLCC20) | |
| 568 | HM534251 - Hitachi HM534251 256k x4 Dynamic Video RAM (SOJ28) | |
| 569 | N341256 - NKK 32k x8 SRAM (SOJ28) | |
| 570 | M5M5256 - Mitsubishi 32k x8 SRAM (SOP28) | |
| 571 | D4516161 - NEC uPD4516161AG5-A80 1M x16 (16MBit) SDRAM (SSOP50) | |
| 572 | LC321664 - Sanyo 64k x16 EDO DRAM (SOJ40) | |
| 573 | M5M51008 - Mitsubishi 128k x8 SRAM (SOP32) | |
| 574 | CY7C128 - Cypress 2k x8 SRAM (SOJ28) | |
| 575 | LH540204 - Sharp CMOS 4096 x 9 Asynchronous FIFO (PLCC32) | |
| 576 | 2061ASC-1- IC Designs 2061ASC-1 programmable clock generator (SOIC16) | |
| 577 | DS8921 - Dallas Semiconductor DS8921 RS-422/423 Differential Line Driver and Receiver Pair (SOIC8) | |
| 578 | HCPL0611 - Fairchild HCPL0611 High Speed 10MBits/sec Logic Gate Optocoupler (SOIC8) | |
| 579 | ADM485 - Analog Devices ADM485 5V Low Power EIA RS-485 Transceiver (SOIC8) | |
| 580 | PST575 - System Reset IC (SOIC8) | |
| 581 | CXD1178Q - Sony CXD1178Q 8-bit RGB 3-channel D/A converter (QFP48) | |
| 582 | J1 - 64 pin connector for connection of I/O board | |
| 583 | J4/J5/J6 \ | |
| 584 | J8/J9 / Custom NAMCO connectors for connection of MEM(M1) PCB | |
| 585 | J10 - Custom NAMCO connector for MSPM(FR) PCB | |
| 586 | ||
| 587 | ||
| 588 | Namco Custom ICs | |
| 589 | ---------------- | |
| 590 | C300 (QFP160) | |
| 591 | 304 (x4, QFP120) | |
| 592 | C352 (QFP100) | |
| 593 | C361 (QFP120) | |
| 594 | C374 (QFP160) | |
| 595 | C379 (QFP64) | |
| 596 | C381 (QFP144) | |
| 597 | C397 (QFP160) | |
| 598 | C399 (QFP160) | |
| 599 | C400 (QFP100) | |
| 600 | C401 (x4, QFP64) | |
| 601 | C403 (QFP136) | |
| 602 | C404 (QFP208) | |
| 603 | C406 (QFP120) | |
| 604 | C407 (QFP64) | |
| 605 | C413 (QFP208) | |
| 606 | C416 (QFP176) | |
| 607 | C417 (QFP208) | |
| 608 | C422 (QFP64) | |
| 609 | C435 (x2, TQFP144) | |
| 610 | ||
| 611 | ||
| 612 | Program ROM PCB | |
| 613 | --------------- | |
| 614 | ||
| 615 | MSPM(FR) PCB 8699015200 (8699015100) | |
| 616 | |--------------------------| | |
| 617 | | J1 | | |
| 618 | | | | |
| 619 | | IC3 IC1 | | |
| 620 | | | | |
| 621 | | | | |
| 622 | | IC2 | | |
| 623 | |--------------------------| | |
| 624 | Notes: | |
| 625 | J1 - Connector to plug into Main PCB | |
| 626 | IC1 \ | |
| 627 | IC2 / Main Program (Fujitsu 29F016 16MBit FlashROM, TSOP48) | |
| 628 | IC3 - Sound Program (Fujitsu 29F400T 4MBit FlashROM, TSOP48) | |
| 629 | ||
| 630 | Games that use this PCB include... | |
| 631 | ||
| 632 | Game Code and revision | |
| 633 | -------------------------------- | |
| 634 | Rapid River RD3 Ver.C | |
| 635 | ||
| 636 | ||
| 637 | ROM PCB | |
| 638 | ------- | |
| 639 | ||
| 640 | MEM(M1) PCB | |
| 641 | 8664960202 (8664970202) | |
| 642 | |--------------------------------------------------------| | |
| 643 | | J2(TEXTURE) J3(POINT) J5(SPRITE) | | |
| 644 | | PAL1 | | |
| 645 | | | | |
| 646 | | | | |
| 647 | | | | |
| 648 | | CCRL.11A | | |
| 649 | | CCRL.11E PT3L.12J PT3H.12L SPRLL.12P SPRLL.12T | | |
| 650 | | CCRH.11B | | |
| 651 | | CCRH.11F | | |
| 652 | | PT2L.11J PT2H.11L SPRLM.11P SPRLM.11T | | |
| 653 | | | | |
| 654 | | | | |
| 655 | | PT1L.10J PT1H.10L SPRUM.10P SPRUM.10T | | |
| 656 | | PAL2 PAL3 | | |
| 657 | | | | |
| 658 | | PT0L.9J PT0H.9L SPRUU.9P SPRUU.9T | | |
| 659 | | JP7 JP9 | | |
| 660 | | JP6 JP8 | | |
| 661 | | CGLL.8B CGLL.8F | | |
| 662 | | | | |
| 663 | | | | |
| 664 | | CGLM.7B CGLM.7F | | |
| 665 | | JP2 JP4 | | |
| 666 | | JP1 JP3 | | |
| 667 | | CGUM.6B CGUM.6F | | |
| 668 | | J1(WAVE) | | |
| 669 | | | | |
| 670 | | CGUU.5B CGUU.5F WAVEH.3S | | |
| 671 | | | | |
| 672 | | MTBH.5J WAVEL.2S | | |
| 673 | | MTAH.3J JP5 | | |
| 674 | | MTBL.2J | | |
| 675 | | MTAL.1J KEYCUS | | |
| 676 | | | | |
| 677 | | J4(MOTION) | | |
| 678 | |--------------------------------------------------------| | |
| 679 | Notes: | |
| 680 | PAL1 - PALCE16V8H stamped 'SS22M1' (PLCC20) | |
| 681 | PAL2 - PALCE20V8H stamped 'SS22M2' (PLCC32) | |
| 682 | PAL3 - PALCE20V8H stamped 'SS22M2' (PLCC32) | |
| 683 | KEYCUS - MACH211 CPLD stamped 'KC012' (PLCC44) | |
| 684 | J1->J5 - Custom NAMCO connectors for joining ROM PCB to Main PCB | |
| 685 | JP1/JP2 \ | |
| 686 | JP3/JP4 | | |
| 687 | JP5 | Jumpers to set ROM sizes (32M/64M) | |
| 688 | JP6/JP7 | | |
| 689 | JP8/JP9 / | |
| 690 | ||
| 691 | ROMs | |
| 692 | ---- | |
| 693 | PT* - Point ROMs, sizes configurable to either 16M or 32M (SOP44) | |
| 694 | MT* - Motion ROMs, sizes configurable to either 32M or 64M (SOP44) | |
| 695 | CG* - Texture ROMs, sizes configurable to either 32M or 64M (SOP44) | |
| 696 | CCR* - Texture Tilemap ROMs, sizes fixed at 16M (SOP44) | |
| 697 | SPR* - Sprite ROMs, sizes configurable to either 32M or 64M (SOP44) | |
| 698 | WAVE*- Wave ROMs, sizes configurable to either 32M or 64M (SOP44) | |
| 699 | ||
| 700 | I/O PCB | |
| 701 | ------- | |
| 702 | ||
| 703 | V187 ASCA-2A PCB | |
| 704 | 2477960102 (2477970102) | |
| 705 | |--------------------------------------------------------| | |
| 706 | | J105 | | |
| 707 | | |-------| 14.7456MHz | | |
| 708 | | J104 |ALTERA | ADM485 PST592 | | |
| 709 | | |EPM7064| |-------| | | |
| 710 | | | | | | | | |
| 711 | | |-------| | C78 | | | |
| 712 | | LC78815 | | | | |
| 713 | | |-------| | | |
| 714 | | MB87078 |---| | | |
| 715 | | LA4705 |IC1| 62256 | | |
| 716 | | |---| | | |
| 717 | | J101 J102 | | |
| 718 | |--------------------------------------------------------| | |
| 719 | Notes: | |
| 720 | IC1 - Atmel AT29C020 2MBit EEPROM labelled 'ASCA1 I/O-A' (PLCC32) | |
| 721 | C78 - Namco Custom MCU, positively identified as a Hitachi H8/3334 (PLCC84) | |
| 722 | EPM7064 - Altera EPM7064LC68-15 FPGA, labelled 'ASCA DR0' (PLCC68) | |
| 723 | PST592 - System Reset IC (SOIC4) | |
| 724 | ADM485 - Analog Devices +ADM485 5V Low Power EIA RS-485 Transceiver (SOIC8) | |
| 725 | MB87078 - Fujitsu MB87078 Electronic Volume Control IC (SOIC24) | |
| 726 | LC78815 - Sanyo LM78815 2-Channel 16-Bit D/A Converter (SOIC20) | |
| 727 | J101 - 34 pin flat cable connector for filter board | |
| 728 | J102 - 50 pin flat cable connector for filter board | |
| 729 | J104 - 8 pin power connector (+5V, +12V, +3.3V) | |
| 730 | J105 - 64 pin connector for connection of Main PCB | |
| 731 | */ | |
| 732 | ||
| 502 | 733 | #include "driver.h" |
| 503 | 734 | #include "cpu/mips/mips3.h" |
| 504 | 735 | #include "cpu/h83002/h83002.h" |
| r3333 | r3334 | |
| 525 | 756 | * ----.--xx.xxxx.xxxx code |
| 526 | 757 | */ |
| 527 | 758 | SET_TILE_INFO( 0, data&0x03ff, data>>12, TILE_FLIPYX((data&0x0c00)>>10) ); |
| 528 | if( data&0x8000 ) | |
| 529 | { | |
| 530 | tileinfo->category = 1; | |
| 531 | } | |
| 532 | 759 | } /* TextTilemapGetInfo */ |
| 533 | 760 | |
| 534 | 761 | static READ32_HANDLER( namcos23_textram_r ) |
| r3333 | r3334 | |
| 539 | 766 | static WRITE32_HANDLER( namcos23_textram_w ) |
| 540 | 767 | { |
| 541 | 768 | COMBINE_DATA( &namcos23_textram[offset] ); |
| 542 | // tilemap_mark_tile_dirty( bgtilemap, offset*2 ); | |
| 543 | // tilemap_mark_tile_dirty( bgtilemap, offset*2+1 ); | |
| 544 | 769 | } |
| 545 | 770 | |
| 546 | 771 | static VIDEO_START( ss23 ) |
| 547 | 772 | { |
| 548 | bgtilemap = tilemap_create( TextTilemapGetInfo,tilemap_scan_rows,16,16,64,64 ); | |
| 549 | tilemap_set_transparent_pen( bgtilemap, 0xf ); | |
| 773 | bgtilemap = tilemap_create(TextTilemapGetInfo, tilemap_scan_rows, 16, 16, 64, 64); | |
| 774 | tilemap_set_transparent_pen(bgtilemap, 0xf); | |
| 550 | 775 | } |
| 551 | 776 | |
| 552 | 777 | #if 0 |
| r3333 | r3334 | |
| 647 | 872 | fillbitmap(priority_bitmap, 0, cliprect); |
| 648 | 873 | |
| 649 | 874 | tilemap_mark_all_tiles_dirty(bgtilemap); |
| 650 | tilemap_draw( bitmap, cliprect, bgtilemap, 0/*flags*/, 0 | |
| 875 | tilemap_draw( bitmap, cliprect, bgtilemap, 0/*flags*/, 0 | |
| 651 | 876 | |
| 652 | 877 | #if 0 |
| 653 | 878 | static int bNew = 1; |
| r3333 | r3334 | |
| 699 | 924 | return 0; |
| 700 | 925 | } |
| 701 | 926 | |
| 927 | static VIDEO_UPDATE( gorgon ) | |
| 928 | { | |
| 929 | return 0; | |
| 930 | } | |
| 931 | ||
| 702 | 932 | static WRITE32_HANDLER( s23_txtchar_w ) |
| 703 | 933 | { |
| 704 | 934 | COMBINE_DATA(&namcos23_charram[offset] ); |
| r3333 | r3334 | |
| 793 | 1023 | } |
| 794 | 1024 | } |
| 795 | 1025 | |
| 1026 | static UINT32 gorgon_vbl = 0; | |
| 1027 | static READ32_HANDLER( gorgon_vbl_r ) | |
| 1028 | { | |
| 1029 | gorgon_vbl ^= 0xffffffff; | |
| 1030 | ||
| 1031 | return gorgon_vbl; | |
| 1032 | } | |
| 1033 | ||
| 1034 | static ADDRESS_MAP_START( gorgon_map, ADDRESS_SPACE_PROGRAM, 32 ) | |
| 1035 | AM_RANGE(0x00000000, 0x003fffff) AM_RAM | |
| 1036 | AM_RANGE(0x02000000, 0x02000003) AM_READ( gorgon_vbl_r ) | |
| 1037 | AM_RANGE(0x04400000, 0x0440ffff) AM_RAM AM_BASE(&namcos23_shared_ram) | |
| 1038 | AM_RANGE(0x04c3ff0c, 0x04c3ff0f) AM_RAM // 3d FIFO | |
| 1039 | AM_RANGE(0x0d000000, 0x0d000007) AM_READ(sysctl_stat_r) | |
| 1040 | AM_RANGE(0x0fc00000, 0x0fffffff) AM_WRITENOP AM_ROM AM_REGION("user1", 0) | |
| 1041 | AM_RANGE(0x1fc00000, 0x1fffffff) AM_WRITENOP AM_ROM AM_REGION("user1", 0) | |
| 1042 | ADDRESS_MAP_END | |
| 1043 | ||
| 796 | 1044 | static ADDRESS_MAP_START( ss23_map, ADDRESS_SPACE_PROGRAM, 32 ) |
| 797 | 1045 | AM_RANGE(0x00000000, 0x003fffff) AM_RAM |
| 798 | 1046 | AM_RANGE(0x02000000, 0x02000003) AM_READ( s23_unk_r ) |
| 799 | AM_RANGE(0x04400000, 0x0440ffff) AM_BASE(&namcos23_shared_ram) | |
| 1047 | AM_RANGE(0x04400000, 0x0440ffff) AM_RAM AM_BASE(&namcos23_shared_ram) | |
| 800 | 1048 | AM_RANGE(0x04c3ff08, 0x04c3ff0b) AM_WRITE( s23_mcuen_w ) |
| 801 | 1049 | AM_RANGE(0x04c3ff0c, 0x04c3ff0f) AM_RAM // 3d FIFO |
| 802 | 1050 | AM_RANGE(0x06800000, 0x06800fff) AM_RAM // text layer palette |
| r3333 | r3334 | |
| 1019 | 1267 | { |
| 1020 | 1268 | } |
| 1021 | 1269 | |
| 1270 | static MACHINE_DRIVER_START( gorgon ) | |
| 1271 | ||
| 1272 | /* basic machine hardware */ | |
| 1273 | MDRV_CPU_ADD("main", R4650BE, 133000000) | |
| 1274 | MDRV_CPU_CONFIG(config) | |
| 1275 | MDRV_CPU_PROGRAM_MAP(gorgon_map, 0) | |
| 1276 | ||
| 1277 | MDRV_CPU_ADD("audio", H83002, 14745600 ) | |
| 1278 | MDRV_CPU_PROGRAM_MAP( s23h8rwmap, 0 ) | |
| 1279 | MDRV_CPU_IO_MAP( s23h8iomap, 0 ) | |
| 1280 | MDRV_CPU_VBLANK_INT("main", irq1_line_pulse) | |
| 1281 | ||
| 1282 | MDRV_SCREEN_ADD("main", RASTER) | |
| 1283 | MDRV_SCREEN_REFRESH_RATE(60) | |
| 1284 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) | |
| 1285 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) | |
| 1286 | MDRV_SCREEN_SIZE(64*16, 30*16) | |
| 1287 | MDRV_SCREEN_VISIBLE_AREA(0, 64*16-1, 0, 30*16-1) | |
| 1288 | ||
| 1289 | MDRV_PALETTE_LENGTH(0x8000) | |
| 1290 | ||
| 1291 | MDRV_GFXDECODE(namcos23) | |
| 1292 | ||
| 1293 | MDRV_VIDEO_START(ss23) | |
| 1294 | MDRV_VIDEO_UPDATE(gorgon) | |
| 1295 | ||
| 1296 | /* sound hardware */ | |
| 1297 | MDRV_SPEAKER_STANDARD_STEREO("left", "right") | |
| 1298 | ||
| 1299 | MDRV_SOUND_ADD("c352", C352, 14745600) | |
| 1300 | MDRV_SOUND_ROUTE(0, "right", 1.00) | |
| 1301 | MDRV_SOUND_ROUTE(1, "left", 1.00) | |
| 1302 | MDRV_SOUND_ROUTE(2, "right", 1.00) | |
| 1303 | MDRV_SOUND_ROUTE(3, "left", 1.00) | |
| 1304 | MACHINE_DRIVER_END | |
| 1305 | ||
| 1022 | 1306 | static MACHINE_DRIVER_START( s23 ) |
| 1023 | 1307 | |
| 1024 | 1308 | /* basic machine hardware */ |
| r3333 | r3334 | |
| 1069 | 1353 | MDRV_CPU_IO_MAP( s23h8iomap, 0 ) |
| 1070 | 1354 | MDRV_CPU_VBLANK_INT("main", irq1_line_pulse) |
| 1071 | 1355 | |
| 1072 | ||
| 1073 | 1356 | MDRV_SCREEN_ADD("main", RASTER) |
| 1074 | 1357 | MDRV_SCREEN_REFRESH_RATE(60) |
| 1075 | 1358 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| r3333 | r3334 | |
| 1094 | 1377 | MDRV_SOUND_ROUTE(3, "left", 1.00) |
| 1095 | 1378 | MACHINE_DRIVER_END |
| 1096 | 1379 | |
| 1380 | ROM_START( rapidrvr ) | |
| 1381 | ROM_REGION32_BE( 0x400000, "user1", 0 ) /* 4 megs for main R4650 code */ | |
| 1382 | ROM_LOAD16_BYTE( "rd3verc.ic2", 0x000000, 0x200000, CRC(c15c0f30) SHA1(9f529232818f3e184f81f62408a5cad615b05613) ) | |
| 1383 | ROM_LOAD16_BYTE( "rd3verc.ic1", 0x000001, 0x200000, CRC(9d7f4411) SHA1(d049efaa539d36ed0f73ca3f50a8f7112e67f865) ) | |
| 1384 | ||
| 1385 | ROM_REGION( 0x80000, "audio", 0 ) /* Hitachi H8/3002 MCU code */ | |
| 1386 | ROM_LOAD16_WORD_SWAP( "rd3verc.ic3", 0x000000, 0x080000, CRC(6e26fbaf) SHA1(4ab6637d22f0d26f7e1d10e9c80059c56f64303d) ) | |
| 1387 | ||
| 1388 | ROM_REGION( 0x800000, "sprite", 0 ) /* sprite? tilemap? tiles */ | |
| 1389 | ROM_LOAD16_BYTE( "rd1mtal.1j", 0x000000, 0x400000, CRC(8f0efa86) SHA1(9953461c258f2a96be275a7b18d6518ddfac3860) ) | |
| 1390 | ROM_LOAD16_BYTE( "rd1mtah.3j", 0x000001, 0x400000, CRC(d8fa0f3d) SHA1(0d5bdb3a2e7be1dffe11b74baa2c10bfe011ae92) ) | |
| 1391 | ||
| 1392 | ROM_REGION( 0x2000000, "textile", 0 ) /* texture tiles */ | |
| 1393 | ROM_LOAD( "rd1cguu.5b", 0x0000000, 0x800000, CRC(611bab41) SHA1(84cddb2b63bf8336e92aecb06eddf1b34af73540) ) | |
| 1394 | ROM_LOAD( "rd1cgum.6b", 0x0800000, 0x800000, CRC(c50de2ef) SHA1(24758a72b3569ce6a643a5786fce7c34b8aa692d) ) | |
| 1395 | ROM_LOAD( "rd1cgll.8b", 0x1000000, 0x800000, CRC(b58b92ac) SHA1(70ee6e0e5347e05817aa30d53d766b8ce0fc44e4) ) | |
| 1396 | ROM_LOAD( "rd1cglm.7b", 0x1800000, 0x800000, CRC(447067fa) SHA1(e2052373773594feb303e1924a4a820cf34ab55b) ) | |
| 1397 | ||
| 1398 | ROM_REGION( 0x2000000, "textile2", 0 ) /* texture tiles bank 2? */ | |
| 1399 | ROM_LOAD( "rd1spruu.9p", 0x0000000, 0x400000, CRC(f20a9673) SHA1(e5f1d552b0c42e102593ab578ff0b9ff814f8650) ) | |
| 1400 | ROM_LOAD( "rd1sprum.10p", 0x0800000, 0x400000, CRC(8e08b2c6) SHA1(a17331a4e41f677f604d1b74e7694cf920b03b66) ) | |
| 1401 | ROM_LOAD( "rd1sprll.12t", 0x1000000, 0x400000, CRC(8d450259) SHA1(27cccd1e7dad8880147bb85185982d8d27076e69) ) | |
| 1402 | ROM_LOAD( "rd1sprlm.11p", 0x1800000, 0x400000, CRC(6c8db3a5) SHA1(24d81fa11e9c835cddadec4cbd530738e258346c) ) | |
| 1403 | ||
| 1404 | ROM_REGION( 0x2000000, "textiledup", 0 ) /* duplicate bank of texture tiles */ | |
| 1405 | ROM_LOAD( "rd1cguu.5f", 0x0800000, 0x800000, CRC(611bab41) SHA1(84cddb2b63bf8336e92aecb06eddf1b34af73540) ) | |
| 1406 | ROM_LOAD( "rd1cgum.6f", 0x1800000, 0x800000, CRC(c50de2ef) SHA1(24758a72b3569ce6a643a5786fce7c34b8aa692d) ) | |
| 1407 | ROM_LOAD( "rd1cgll.8f", 0x1000000, 0x800000, CRC(b58b92ac) SHA1(70ee6e0e5347e05817aa30d53d766b8ce0fc44e4) ) | |
| 1408 | ROM_LOAD( "rd1cglm.7f", 0x0000000, 0x800000, CRC(447067fa) SHA1(e2052373773594feb303e1924a4a820cf34ab55b) ) | |
| 1409 | ||
| 1410 | ROM_REGION( 0x2000000, "textile2d", 0 ) /* duplicate of texture tiles bank 2? */ | |
| 1411 | ROM_LOAD( "rd1spruu.9t", 0x0000000, 0x400000, CRC(f20a9673) SHA1(e5f1d552b0c42e102593ab578ff0b9ff814f8650) ) | |
| 1412 | ROM_LOAD( "rd1sprum.10t", 0x0800000, 0x400000, CRC(8e08b2c6) SHA1(a17331a4e41f677f604d1b74e7694cf920b03b66) ) | |
| 1413 | ROM_LOAD( "rd1sprll.12p", 0x1000000, 0x400000, CRC(8d450259) SHA1(27cccd1e7dad8880147bb85185982d8d27076e69) ) | |
| 1414 | ROM_LOAD( "rd1sprlm.11t", 0x1800000, 0x400000, CRC(6c8db3a5) SHA1(24d81fa11e9c835cddadec4cbd530738e258346c) ) | |
| 1415 | ||
| 1416 | ROM_REGION( 0x400000, "textilemap", 0 ) /* texture tilemap */ | |
| 1417 | ROM_LOAD( "rd1ccrl.11a", 0x000000, 0x200000, CRC(b0ea2b32) SHA1(0dc45846725b0de619bc6bae69e3eb166ed21bf0) ) | |
| 1418 | ROM_LOAD( "rd1ccrh.11b", 0x200000, 0x200000, CRC(fafffb86) SHA1(15b0ba0252b99d0cac29fcb374fb895643f528fe) ) | |
| 1419 | ||
| 1420 | ROM_REGION( 0x400000, "textilemp2", 0 ) /* duplicate texture tilemap */ | |
| 1421 | ROM_LOAD( "rd1ccrl.11e", 0x000000, 0x200000, CRC(b0ea2b32) SHA1(0dc45846725b0de619bc6bae69e3eb166ed21bf0) ) | |
| 1422 | ROM_LOAD( "rd1ccrh.11f", 0x200000, 0x200000, CRC(fafffb86) SHA1(15b0ba0252b99d0cac29fcb374fb895643f528fe) ) | |
| 1423 | ||
| 1424 | ROM_REGION32_LE( 0x2000000, "pointrom", 0 ) /* 3D model data */ | |
| 1425 | ROM_LOAD32_WORD( "rd1pt0l.9j", 0x0000000, 0x400000, CRC(47b1c5a5) SHA1(021d4ca7b8674d8ed5daa701bf41b4a7164d992a) ) | |
| 1426 | ROM_LOAD32_WORD( "rd1pt0h.9l", 0x0000002, 0x400000, CRC(6f280eff) SHA1(9dd8c8903581d7a412146e50f4009e1d2b743f06) ) | |
| 1427 | ROM_LOAD32_WORD( "rd1pt1l.10j", 0x0800000, 0x400000, CRC(91131cb3) SHA1(e42c5e190c719f1cf2d6e91444062ab901be0e73) ) | |
| 1428 | ROM_LOAD32_WORD( "rd1pt1h.10l", 0x0800002, 0x400000, CRC(37bd9bdf) SHA1(b26c284024ea4ad4c67b2eefbfdd5ebb35a0118e) ) | |
| 1429 | ROM_LOAD32_WORD( "rd1pt2l.11j", 0x1000000, 0x400000, CRC(3423ff9f) SHA1(73823c179c866cbb601a23417acbbf5b3dc97213) ) | |
| 1430 | ROM_LOAD32_WORD( "rd1pt2h.11l", 0x1000002, 0x400000, CRC(fa601e83) SHA1(45c420538910f566e75d668306735f54c901669f) ) | |
| 1431 | ROM_LOAD32_WORD( "rd1pt3l.12j", 0x1800000, 0x400000, CRC(7216d63e) SHA1(77088ff05c2630996f4bdc87fe466f9b97611467) ) | |
| 1432 | ROM_LOAD32_WORD( "rd1pt3h.12l", 0x1800002, 0x400000, CRC(e82ff66a) SHA1(9e2c951136b26d969d2c9d030b7e0bad8bbbe3fb) ) | |
| 1433 | ||
| 1434 | ROM_REGION( 0x1000000, "c352", 0 ) /* C352 PCM samples */ | |
| 1435 | ROM_LOAD( "rd1wavel.2s", 0x000000, 0x800000, CRC(bf52c08c) SHA1(6745062e078e520484390fad1f723124aa4076d0) ) | |
| 1436 | ROM_LOAD( "rd1waveh.3s", 0x800000, 0x800000, CRC(ef0136b5) SHA1(a6d923ededca168fe555e0b86a72f53bec5424cc) ) | |
| 1437 | ROM_END | |
| 1438 | ||
| 1097 | 1439 | ROM_START( timecrs2 ) |
| 1098 | 1440 | ROM_REGION32_BE( 0x400000, "user1", 0 ) /* 4 megs for main R4650 code */ |
| 1099 | 1441 | ROM_LOAD16_BYTE( "tss3verb.2", 0x000000, 0x200000, CRC(c7be691f) SHA1(5e2e7a0db3d8ce6dfeb6c0d99e9fe6a9f9cab467) ) |
| r3333 | r3334 | |
| 1131 | 1473 | ROM_LOAD( "tss1waveh.2a", 0x800000, 0x800000, CRC(5c8758b4) SHA1(b85c8f6869900224ef83a2340b17f5bbb2801af9) ) |
| 1132 | 1474 | ROM_END |
| 1133 | 1475 | |
| 1134 | ROM_START( gp500 ) | |
| 1476 | ROM_START( timcrs2b ) | |
| 1477 | ROM_REGION32_BE( 0x400000, "user1", 0 ) /* 4 megs for main R4650 code */ | |
| 1478 | ROM_LOAD16_BYTE( "tss2verb.ic2", 0x000000, 0x200000, CRC(9f56a4df) SHA1(5ecb3cd93726ab6be02762853fd6a45266d6c0bc) ) | |
| 1479 | ROM_LOAD16_BYTE( "tss2verb.ic1", 0x000001, 0x200000, CRC(aa147f71) SHA1(e00267d1a8286942c83dc35289ad65bd3cb6d8db) ) | |
| 1480 | ||
| 1481 | ROM_REGION( 0x80000, "audio", 0 ) /* Hitachi H8/3002 MCU code */ | |
| 1482 | ROM_LOAD16_WORD_SWAP( "tss3verb.3", 0x000000, 0x080000, CRC(41e41994) SHA1(eabc1a307c329070bfc6486cb68169c94ff8a162) ) | |
| 1483 | ||
| 1484 | ROM_REGION( 0x40000, "ioboard", 0 ) /* I/O board HD643334 H8/300 MCU code */ | |
| 1485 | ROM_LOAD( "tssioprog.ic3", 0x000000, 0x040000, CRC(edad4538) SHA1(1330189184a636328d956c0e435f8d9ad2e96a80) ) | |
| 1486 | ||
| 1487 | ROM_REGION( 0x2000000, "sprite", 0 ) /* sprite? tilemap? tiles */ | |
| 1488 | ROM_LOAD16_BYTE( "tss1mtal.2h", 0x0000000, 0x800000, CRC(bfc79190) SHA1(04bda00c4cc5660d27af4f3b0ee3550dea8d3805) ) | |
| 1489 | ROM_LOAD16_BYTE( "tss1mtah.2j", 0x0000001, 0x800000, CRC(697c26ed) SHA1(72f6f69e89496ba0c6183b35c3bde71f5a3c721f) ) | |
| 1490 | ROM_LOAD16_BYTE( "tss1mtbl.2f", 0x1000000, 0x800000, CRC(e648bea4) SHA1(3803d03e72b25fbcc124d5b25066d25629b76b94) ) | |
| 1491 | ROM_LOAD16_BYTE( "tss1mtbh.2m", 0x1000001, 0x800000, CRC(82582776) SHA1(7c790d09bac660ea1c62da3ffb21ab43f2461594) ) | |
| 1492 | ||
| 1493 | ROM_REGION( 0x2000000, "textile", 0 ) /* texture tiles */ | |
| 1494 | ROM_LOAD( "tss1cguu.4f", 0x0000000, 0x800000, CRC(76924e04) SHA1(751065d6ce658cbbcd88f854f6937ebd2204ec68) ) | |
| 1495 | ROM_LOAD( "tss1cgum.4j", 0x0800000, 0x800000, CRC(c22739e1) SHA1(8671ee047bb248033656c50befd1c35e5e478e1a) ) | |
| 1496 | ROM_LOAD( "tss1cgll.4m", 0x1000000, 0x800000, CRC(18433aaa) SHA1(08539beb2e66ec4e41062621fc098b121c669546) ) | |
| 1497 | ROM_LOAD( "tss1cglm.4k", 0x1800000, 0x800000, CRC(669974c2) SHA1(cfebe199631e38f547b38fcd35f1645b74e8dd0a) ) | |
| 1498 | ||
| 1499 | ROM_REGION( 0x600000, "textilemap", 0 ) /* texture tilemap */ | |
| 1500 | ROM_LOAD( "tss1ccrl.7f", 0x000000, 0x400000, CRC(3a325fe7) SHA1(882735dce7aeb36f9e88a983498360f5de901e9d) ) | |
| 1501 | ROM_LOAD( "tss1ccrh.7e", 0x400000, 0x200000, CRC(f998de1a) SHA1(371f540f505608297c5ffcfb623b983ca8310afb) ) | |
| 1502 | ||
| 1503 | ROM_REGION32_LE( 0x2000000, "pointrom", 0 ) /* 3D model data */ | |
| 1504 | ROM_LOAD32_WORD( "tss1pt0l.7c", 0x0000000, 0x400000, CRC(896f0fb4) SHA1(bdfa99eb21ce4fc8021f9d95a5558a34f9942c57) ) | |
| 1505 | ROM_LOAD32_WORD( "tss1pt0h.7a", 0x0000002, 0x400000, CRC(cdbe0ba8) SHA1(f8c6da31654c0a2a8024888ffb7fc1c783b2d629) ) | |
| 1506 | ROM_LOAD32_WORD( "tss1pt1l.5c", 0x0800000, 0x400000, CRC(5a09921f) SHA1(c23885708c7adf0b81c2c9346e21b869634a5b35) ) | |
| 1507 | ROM_LOAD32_WORD( "tss1pt1h.5a", 0x0800002, 0x400000, CRC(63647596) SHA1(833412be8f61686bd7e06c2738df740e0e585d0f) ) | |
| 1508 | ROM_LOAD32_WORD( "tss1pt2l.4c", 0x1000000, 0x400000, CRC(4b230d79) SHA1(794cee0a19993e90913f58507c53224f361e9663) ) | |
| 1509 | ROM_LOAD32_WORD( "tss1pt2h.4a", 0x1000002, 0x400000, CRC(9b06e22d) SHA1(cff5ed098112a4f0a2bc8937e226f50066e605b1) ) | |
| 1510 | ||
| 1511 | ROM_REGION( 0x1000000, "c352", 0 ) /* C352 PCM samples */ | |
| 1512 | ROM_LOAD( "tss1wavel.2c", 0x000000, 0x800000, CRC(deaead26) SHA1(72dac0c3f41d4c3c290f9eb1b50236ae3040a472) ) | |
| 1513 | ROM_LOAD( "tss1waveh.2a", 0x800000, 0x800000, CRC(5c8758b4) SHA1(b85c8f6869900224ef83a2340b17f5bbb2801af9) ) | |
| 1514 | ROM_END | |
| 1515 | ||
| 1516 | ROM_START( 500gp ) | |
| 1135 | 1517 | /* r4650-generic-xrom-generic: NMON 1.0.8-sys23-19990105 P for SYSTEM23 P1 */ |
| 1136 | 1518 | ROM_REGION32_BE( 0x400000, "user1", 0 ) /* 4 megs for main R4650 code */ |
| 1137 | 1519 | ROM_LOAD16_BYTE( "5gp3verc.2", 0x000000, 0x200000, CRC(e2d43468) SHA1(5e861dd223c7fa177febed9803ac353cba18e19d) ) |
| r3333 | r3334 | |
| 1254 | 1636 | ROM_END |
| 1255 | 1637 | |
| 1256 | 1638 | /* Games */ |
| 1257 | //GAME( 199?, downhbkr, 0, s23, 0, ss23, ROT0, "Namco", "Downhill Bikers (DH3 Ver.A)", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_SOUND ) | |
| 1258 | GAME( 1997, timecrs2, 0, s23, 0, ss23, ROT0, "Namco", "Time Crisis 2", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_SOUND ) | |
| 1259 | GAME( 1999, gp500, 0, ss23, 0, ss23, ROT0, "Namco", "GP500", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_SOUND ) | |
| 1639 | GAME( 1997, rapidrvr, 0, gorgon, 0, ss23, ROT0, "Namco", "Rapid River (RD3 Ver. C)", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_SOUND ) | |
| 1640 | GAME( 1997, timecrs2, 0, s23, 0, ss23, ROT0, "Namco", "Time Crisis 2 (TSS3 Ver. B)", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_SOUND ) | |
| 1641 | GAME( 1997, timcrs2b, timecrs2, s23, 0, ss23, ROT0, "Namco", "Time Crisis 2 (TSS2 Ver. B)", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_SOUND ) | |
| 1642 | GAME( 1999, 500gp, 0, ss23, 0, ss23, ROT0, "Namco", "500GP", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_SOUND ) | |
| 1260 | 1643 | GAME( 1999, finfurl2, 0, ss23, 0, ss23, ROT0, "Namco", "Final Furlong 2 (World)", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_SOUND ) |
| 1261 | 1644 | GAME( 1999, finfrl2j, finfurl2, ss23, 0, ss23, ROT0, "Namco", "Final Furlong 2 (Japan)", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_SOUND ) |
| r3333 | r3334 | |
|---|---|---|
| 825 | 825 | ROM_LOAD( "geebee.1k", 0x0000, 0x1000, CRC(8a5577e0) SHA1(356d33e19c6b4f519816ee4b65ff9b59d6c1b565) ) |
| 826 | 826 | |
| 827 | 827 | ROM_REGION( 0x800, "gfx1", 0 ) |
| 828 | ROM_LOAD( "geebee.3a", | |
| 828 | ROM_LOAD( "geebeeg.3a", | |
| 829 | 829 | ROM_END |
| 830 | 830 | |
| 831 | 831 | ROM_START( navarone ) |
| r3333 | r3334 | |
|---|---|---|
| 198 | 198 | } |
| 199 | 199 | #endif |
| 200 | 200 | |
| 201 | READ32_HANDLER( dsp_host_interface_r ) | |
| 201 | static READ32_HANDLER( dsp_host_interface_r ) | |
| 202 | 202 | { |
| 203 | 203 | UINT32 value; |
| 204 | 204 | UINT8 hi_addr = offset << 1; |
| r3333 | r3334 | |
|---|---|---|
| 55 | 55 | on power-up. |
| 56 | 56 | JP1 - set to 2-3. Alt setting is 1-2 |
| 57 | 57 | JP4 - set to 2-3. Alt setting is 1-2 |
| 58 | 93C46 - 128 bytes EEPROM | |
| 59 | A179B 96K - ?, made by TI | |
| 58 | 93C46 - 128 bytes serial EEPROM | |
| 59 | A179B 96K - TI SN75179B Differential driver and receiver pair (like RS485) | |
| 60 | 60 | ADM485 - Analog Devices ADM485 |
| 61 | 61 | BIOS.IC27 - 27C160 EPROM |
| 62 | 62 | 5264165 - Hitachi 5264165FTTA60 (video RAM) |
| r3333 | r3334 | |
| 662 | 662 | #include "dc.h" |
| 663 | 663 | |
| 664 | 664 | #define CPU_CLOCK (200000000) |
| 665 | /* MD2 MD1 MD0 MD6 MD4 MD3 MD5 MD7 MD8 */ | |
| 665 | /* MD2 MD1 MD0 MD6 MD4 MD3 MD5 MD7 MD8 */ | |
| 666 | 666 | static const struct sh4_config sh4cpu_config = { 1, 0, 1, 0, 0, 0, 1, 1, 0, CPU_CLOCK }; |
| 667 | 667 | |
| 668 | 668 | static UINT32 *dc_sound_ram; |
| 669 | static UINT32 rom_offset, dma_count; | |
| 669 | static UINT32 rom_offset, rom_offset_flags, dma_count; | |
| 670 | 670 | UINT32 dma_offset; |
| 671 | 671 | |
| 672 | 672 | static INTERRUPT_GEN( naomi_vblank ) |
| r3333 | r3334 | |
| 716 | 716 | |
| 717 | 717 | Dimm board registers (add more information if you find it): |
| 718 | 718 | |
| 719 | NAOMI_DIMM_COMMAND = 5f703c (16 bit): | |
| 719 | Name: Naomi Dimm Bd. | |
| 720 | NAOMI_DIMM_COMMAND = 5f703c 14000014 (16 bit): | |
| 720 | 721 | if bits all 1 no dimm board present and other registers not used |
| 721 | 722 | bit 15: during an interrupt is 1 if the dimm board has a command to be executed |
| 722 | 723 | bit 14-9: 6 bit command number (naomi bios understands 0 1 3 4 5 6 8 9 a) |
| 723 | bit 8-0: higher 9 bits of 25 bit offset parameter | |
| 724 | NAOMI_DIMM_OFFSETL = 5f7040 (16 bit): | |
| 725 | bit 15-0: lower 16 bits of 25 bit offset parameter | |
| 726 | NAOMI_DIMM_PARAMETERL = 5f7044 (16 bit) | |
| 727 | NAOMI_DIMM_PARAMETERH = 5f7048 (16 bit) | |
| 728 | NAOMI_DIMM_STATUS = 5f704c (16 bit): | |
| 729 | bit 0: when read as 1 means something has happened write it to 0 to clear | |
| 730 | bit 8: written to 1 at the end of the interrupt routine (signals command response available to dimm board ?) | |
| 724 | bit 7-0: higher 8 bits of 24 bit offset parameter | |
| 725 | NAOMI_DIMM_OFFSETL = 5f7040 14000018 (16 bit): | |
| 726 | bit 15-0: lower 16 bits of 24 bit offset parameter | |
| 727 | NAOMI_DIMM_PARAMETERL = 5f7044 1400001c (16 bit) | |
| 728 | NAOMI_DIMM_PARAMETERH = 5f7048 14000020 (16 bit) | |
| 729 | NAOMI_DIMM_STATUS = 5f704c 14000024 (16 bit): | |
| 730 | bit 0: when 0 signal interrupt from naomi to dimm board | |
| 731 | bit 8: when 0 signal interrupt from dimm board to naomi | |
| 731 | 732 | */ |
| 732 | 733 | |
| 733 | 734 | // NOTE: all accesses are 16 or 32 bits wide but only 16 bits are valid |
| r3333 | r3334 | |
| 812 | 813 | // ROM_OFFSETH |
| 813 | 814 | rom_offset &= 0xffff; |
| 814 | 815 | rom_offset |= (data & 0x1fff)<<16; |
| 816 | rom_offset_flags = data >> 13; | |
| 815 | 817 | } |
| 816 | 818 | else if ((offset == 0) && ACCESSING_BITS_32_47) |
| 817 | 819 | { |
| r3333 | r3334 | |
| 819 | 821 | rom_offset &= 0xffff0000; |
| 820 | 822 | rom_offset |= ((data >> 32) & 0xffff); |
| 821 | 823 | } |
| 824 | if ((offset == 1) && ACCESSING_BITS_0_15) | |
| 825 | { | |
| 826 | // ROM_DATA | |
| 827 | // Doa2 writes here (16 bit decryption key ?) | |
| 828 | mame_printf_verbose("ROM: write %llx to 5f7008 (PC=%x)\n", data, activecpu_get_pc()); | |
| 829 | } | |
| 822 | 830 | else if ((offset == 15) && ACCESSING_BITS_0_15) |
| 823 | 831 | { |
| 824 | 832 | // NAOMI_BOARDID_WRITE |
| r3333 | r3334 | |
| 1154 | 1162 | EPR-23605 - NAOMI BOOT ROM 2001 01/19 1.50 (Japan) |
| 1155 | 1163 | EPR-23605A - NAOMI BOOT ROM 2001 06/20 1.60 (Japan) |
| 1156 | 1164 | EPR-23605B - NAOMI BOOT ROM 2001 09/10 1.70 (Japan) |
| 1165 | EPR-23605C - NAOMI BOOT ROM 2002 07/08 1.8- (Japan) | |
| 1157 | 1166 | EPR-23607 - NAOMI BOOT ROM 2001 01/19 1.50 (USA) |
| 1158 | 1167 | EPR-23607B - NAOMI BOOT ROM 2001 09/10 1.70 (USA) |
| 1159 | 1168 | EPR-23608 - NAOMI BOOT ROM 2001 01/19 1.50 (Export) |
| r3333 | r3334 | |
| 1185 | 1194 | ROM_LOAD16_WORD_SWAP_BIOS( 2, "epr-23607b.bin", 0x000000, 0x200000, CRC(f308c5e9) SHA1(5470ab1cee6afecbd8ca8cf40f8fbe4ec2cb1471) ) \ |
| 1186 | 1195 | ROM_SYSTEM_BIOS( 3, "bios3", "epr-23607 (USA)" ) \ |
| 1187 | 1196 | ROM_LOAD16_WORD_SWAP_BIOS( 3, "epr-23607.bin", 0x000000, 0x200000, CRC(2b55add2) SHA1(547de5f97d3183c8cd069c4fa3c09f13d8b637d9) ) \ |
| 1188 | ROM_SYSTEM_BIOS( 4, "bios4", "epr-23605b (Japan)" ) \ | |
| 1189 | ROM_LOAD16_WORD_SWAP_BIOS( 4, "epr-23605b.bin", 0x000000, 0x200000, CRC(3a3242d4) SHA1(aaca4df51ef91d926f8191d372f3dfe1d20d9484) ) \ | |
| 1190 | ROM_SYSTEM_BIOS( 5, "bios5", "epr-23605a (Japan)" ) \ | |
| 1191 | ROM_LOAD16_WORD_SWAP_BIOS( 5, "epr-23605a.bin", 0x000000, 0x200000, CRC(7bc3fc2d) SHA1(a4a9531a7c66ff30046908cf71f6c7b6fb59c392) ) \ | |
| 1192 | ROM_SYSTEM_BIOS( 6, "bios6", "epr-23605 (Japan)" ) \ | |
| 1193 | ROM_LOAD16_WORD_SWAP_BIOS( 6, "epr-23605.bin", 0x000000, 0x200000, CRC(5731e446) SHA1(787b0844fc408cf124c12405c095c59948709ea6) ) | |
| 1197 | ROM_SYSTEM_BIOS( 4, "bios4", "epr-23605c (Japan)" ) \ | |
| 1198 | ROM_LOAD16_WORD_SWAP_BIOS( 4, "epr-23605c.bin", 0x000000, 0x200000, CRC(297ea6ed) SHA1(cfbfe57c80e6ee86a101fa83aec0a01e00c0f42a) ) \ | |
| 1199 | ROM_SYSTEM_BIOS( 5, "bios5", "epr-23605b (Japan)" ) \ | |
| 1200 | ROM_LOAD16_WORD_SWAP_BIOS( 5, "epr-23605b.bin", 0x000000, 0x200000, CRC(3a3242d4) SHA1(aaca4df51ef91d926f8191d372f3dfe1d20d9484) ) \ | |
| 1201 | ROM_SYSTEM_BIOS( 6, "bios6", "epr-23605a (Japan)" ) \ | |
| 1202 | ROM_LOAD16_WORD_SWAP_BIOS( 6, "epr-23605a.bin", 0x000000, 0x200000, CRC(7bc3fc2d) SHA1(a4a9531a7c66ff30046908cf71f6c7b6fb59c392) ) \ | |
| 1203 | ROM_SYSTEM_BIOS( 7, "bios7", "epr-23605 (Japan)" ) \ | |
| 1204 | ROM_LOAD16_WORD_SWAP_BIOS( 7, "epr-23605.bin", 0x000000, 0x200000, CRC(5731e446) SHA1(787b0844fc408cf124c12405c095c59948709ea6) ) | |
| 1194 | 1205 | |
| 1195 | 1206 | /* this is one flashrom, however the second half looks like it's used for game settings, may differ between dumps, and may not be needed / could be blanked */ |
| 1196 | 1207 | #define AW_BIOS \ |
| r3333 | r3334 | |
| 1269 | 1280 | int S3[8]; |
| 1270 | 1281 | }; |
| 1271 | 1282 | |
| 1272 | struct AtomiswaveKey fotns_key = { | |
| 1283 | static const struct AtomiswaveKey fotns_key = { | |
| 1273 | 1284 | {0,2,7,11,12,1,5,6,15,4,8,9,14,3,10,13}, |
| 1274 | 1285 | {12,8,3,7,0,15,1,11,6,10,4,14,9,5,13,2}, |
| 1275 | 1286 | {4,1,10,16,9,25,26,31,13,0,14,15,24,6,30,18,7,20,5,12,22,17,27,3,8,11,21,29,19,23,28,2}, |
| r3333 | r3334 | |
| 1278 | 1289 | {7,1,6,5,4,2,0,3} |
| 1279 | 1290 | }; |
| 1280 | 1291 | |
| 1281 | struct AtomiswaveKey df_key = { | |
| 1292 | static const struct AtomiswaveKey df_key = { | |
| 1282 | 1293 | {1,4,5,6,9,7,10,11,13,0,8,12,14,2,3,15}, |
| 1283 | 1294 | {12,0,3,8,7,6,15,11,1,4,14,10,9,5,13,2}, |
| 1284 | 1295 | {9,27,15,6,28,30,7,12,21,0,1,25,22,3,16,29,13,4,24,20,2,5,23,19,18,10,8,14,17,11,31,26}, |
| r3333 | r3334 | |
| 1288 | 1299 | }; |
| 1289 | 1300 | |
| 1290 | 1301 | |
| 1291 | UINT16 atomiswave_decrypt(UINT16 cipherText, int address, struct AtomiswaveKey* key) | |
| 1302 | static UINT16 atomiswave_decrypt(UINT16 cipherText, int address, const struct AtomiswaveKey* key) | |
| 1292 | 1303 | { |
| 1293 | 1304 | int b0,b1,b2,b3; |
| 1294 | 1305 | int aux; |
| r3333 | r3334 | |
| 1314 | 1325 | } |
| 1315 | 1326 | |
| 1316 | 1327 | |
| 1317 | DRIVER_INIT(fotns) | |
| 1328 | static DRIVER_INIT(fotns) | |
| 1318 | 1329 | { |
| 1319 | 1330 | int i; |
| 1320 | 1331 | UINT16 *src = (UINT16 *)(memory_region(machine, "user1")); |
| r3333 | r3334 | |
| 1344 | 1355 | |
| 1345 | 1356 | |
| 1346 | 1357 | |
| 1347 | DRIVER_INIT(demofist) | |
| 1358 | static DRIVER_INIT(demofist) | |
| 1348 | 1359 | { |
| 1349 | 1360 | int i; |
| 1350 | 1361 | UINT16 *src = (UINT16 *)(memory_region(machine, "user1")); |
| r3333 | r3334 | |
| 2526 | 2537 | NAOMI_BIOS |
| 2527 | 2538 | |
| 2528 | 2539 | ROM_REGION( 0xb000000, "user1", 0) |
| 2529 | ROM_LOAD("epr22121.22", 0x0000000, 0x0400000, CRC(30f93b5e) SHA1(0e33383e7ab9a721dab4708b063598f2e9c9f2e7) ) | |
| 2540 | ROM_LOAD("epr22121.22", 0x0000000, 0x0400000, CRC(30f93b5e) SHA1(0e33383e7ab9a721dab4708b063598f2e9c9f2e7) ) // partially encrypted | |
| 2530 | 2541 | |
| 2531 | 2542 | ROM_LOAD("mpr-22100.ic1", 0x0800000, 0x0800000, CRC(92a53e5e) SHA1(87fcdeee9c4e65a3eb6eb345eed85d4f2df26c3c) ) |
| 2532 | 2543 | ROM_LOAD("mpr-22101.ic2", 0x1000000, 0x0800000, CRC(14cd7dce) SHA1(5df14a5dad14bc922b4f88881dc2e9c8e74d6170) ) |
| r3333 | r3334 | |
| 2722 | 2733 | |
| 2723 | 2734 | */ |
| 2724 | 2735 | |
| 2736 | #ifdef UNUSED_FUNCTION | |
| 2725 | 2737 | // rather crude function to write out a key file |
| 2726 | 2738 | void naomi_write_keyfile(void) |
| 2727 | 2739 | { |
| r3333 | r3334 | |
| 2792 | 2804 | |
| 2793 | 2805 | |
| 2794 | 2806 | } |
| 2807 | #endif | |
| 2808 | ||
| 2795 | 2809 | extern void naomi_game_decrypt(UINT64 key, UINT8* region, int length); |
| 2796 | 2810 | |
| 2797 | 2811 | |
| r3333 | r3334 | |
| 2857 | 2871 | |
| 2858 | 2872 | |
| 2859 | 2873 | |
| 2860 | DRIVER_INIT( ngdkey ) | |
| 2874 | static DRIVER_INIT( ngdkey ) | |
| 2861 | 2875 | { |
| 2862 | 2876 | UINT8* picdata = memory_region(machine,"picreturn"); |
| 2863 | 2877 | UINT64 key; |
| r3333 | r3334 | |
|---|---|---|
| 287 | 287 | 16*16 |
| 288 | 288 | }; |
| 289 | 289 | |
| 290 | #ifdef UNUSED_FUNCTON | |
| 290 | #ifdef UNUSED_FUNCTION | |
| 291 | 291 | static const gfx_layout layout_16x16x4_2 = |
| 292 | 292 | { |
| 293 | 293 | 16,16, |
| r3333 | r3334 | |
|---|---|---|
| 26 | 26 | */ |
| 27 | 27 | |
| 28 | 28 | #include "mame.h" |
| 29 | #include "deprecat.h" | |
| 30 | 29 | #include "driver.h" |
| 31 | 30 | #include "cpu/m6809/m6809.h" |
| 32 | 31 | #include "cpu/m6502/m6502.h" |
| r3333 | r3334 | |
| 37 | 36 | #include "machine/6532riot.h" |
| 38 | 37 | #include "machine/x2212.h" |
| 39 | 38 | |
| 39 | ||
| 40 | #define MASTER_XTAL XTAL_14_31818MHz | |
| 41 | ||
| 42 | ||
| 40 | 43 | /* |
| 41 | 44 | fff6=firq e4a2 when dav goes active/low |
| 42 | 45 | fff8=irq e38f This is through a flip-flop so goes off (high as active low) only when reset_irq is active - low. |
| r3333 | r3334 | |
| 56 | 59 | /* FXXXXX for first field |
| 57 | 60 | AXXXXX for second field */ |
| 58 | 61 | |
| 62 | static const device_config *laserdisc; | |
| 59 | 63 | static int m_n_disc_lock; |
| 60 | 64 | static int m_n_disc_left_audio; |
| 61 | 65 | static int m_n_disc_right_audio; |
| 62 | 66 | static int m_n_disc_data; |
| 63 | static int command_offset; | |
| 64 | static int command_data[ 3 ]; | |
| 65 | static int manchester_data[ 6 ]; | |
| 66 | static int manchester_offset; | |
| 67 | static int disc_reset; | |
| 68 | static int disk_opr = 0; | |
| 69 | static int dav = 0x80; | |
| 70 | static int dak_just_low = 0; /* simulate the 15 uS time for the player to read the data */ | |
| 71 | static int dak = 0x40; /* DAK or DSKFULL active low indicates player has data, | |
| 72 | reset when player has read data */ | |
| 73 | static int disk_data; /* after a command is sent the first bit indicates an error, except of the data is 0x00 which indicates an invalid manchester data read (whatever that means) */ | |
| 67 | static int m_n_disc_read_data; | |
| 74 | 68 | |
| 75 | int laser_disc_speed = 0; | |
| 76 | int laser_disc_field = 0; | |
| 77 | void laser_seek_frame( int frame ) | |
| 78 | { | |
| 79 | } | |
| 80 | ||
| 81 | ||
| 82 | 69 | /* 20 = DISKOPR - Active low |
| 83 | 70 | 40 = DISKFULL - Active low |
| 84 | 71 | 80 = DISKDAV - Active low data available |
| 85 | 72 | */ |
| 86 | READ8_HANDLER( firefox_disc_status_r ) | |
| 73 | static READ8_HANDLER( firefox_disc_status_r ) | |
| 87 | 74 | { |
| 88 | int n_data; | |
| 89 | n_data = dav | dak | disk_opr; /* always operational */ | |
| 90 | logerror( "%08x: disc status r %02x\n", activecpu_get_pc(), n_data & ( 0x80 | 0x40 | 0x20 ) ); | |
| 91 | /* | |
| 92 | fprintf(stderr, "%08x: reading disc status r %02x\n", activecpu_get_pc(), n_data & ( 0x80 | 0x40 | 0x20 ) ); | |
| 93 | */ | |
| 94 | if(dak_just_low) | |
| 95 | { | |
| 96 | /* assume that the next status read will be after 15uS */ | |
| 97 | dak = 0x40; | |
| 98 | dak_just_low = 0; | |
| 99 | } | |
| 100 | return n_data; | |
| 75 | UINT8 result = 0xff; | |
| 76 | ||
| 77 | result ^= 0x20; | |
| 78 | if (!laserdisc_line_r(laserdisc, LASERDISC_LINE_READY)) | |
| 79 | result ^= 0x40; | |
| 80 | if (laserdisc_line_r(laserdisc, LASERDISC_LINE_DATA_AVAIL)) | |
| 81 | result ^= 0x80; | |
| 82 | ||
| 83 | return result; | |
| 101 | 84 | } |
| 102 | 85 | |
| 103 | 86 | /* 4105 - DREAD */ |
| 104 | 87 | /* this reset RDDSK (&DSKRD) */ |
| 105 | READ8_HANDLER( firefox_disc_data_r ) | |
| 88 | static READ8_HANDLER( firefox_disc_data_r ) | |
| 106 | 89 | { |
| 107 | return dis | |
| 90 | return m_n_disc_read_data; | |
| 108 | 91 | } |
| 109 | 92 | |
| 110 | 93 | /* DISK READ ENABLE */ |
| 111 | 94 | /* 4218 - DSKREAD, set RDDSK */ |
| 112 | WRITE8_HANDLER( firefox_disc_read_w ) | |
| 95 | static WRITE8_HANDLER( firefox_disc_read_w ) | |
| 113 | 96 | { |
| 114 | dav=0x80; | |
| 115 | if( manchester_offset < 6 ) | |
| 116 | { | |
| 117 | disk_data = manchester_data[ manchester_offset++ ]; | |
| 118 | if(manchester_offset < 6) | |
| 119 | { | |
| 120 | dav = 0; /* more data */ | |
| 121 | cpunum_set_input_line( machine, 0, M6809_FIRQ_LINE, ASSERT_LINE ); | |
| 122 | } | |
| 123 | ||
| 124 | } | |
| 97 | m_n_disc_read_data = laserdisc_data_r(laserdisc); | |
| 125 | 98 | } |
| 126 | 99 | |
| 127 | WRITE8_HANDLER( firefox_disc_lock_w ) | |
| 100 | static WRITE8_HANDLER( firefox_disc_lock_w ) | |
| 128 | 101 | { |
| 129 | 102 | m_n_disc_lock = data & 0x80; |
| 130 | 103 | } |
| 131 | 104 | |
| 132 | WRITE8_HANDLER( | |
| 105 | static WRITE8_HANDLER( | |
| 133 | 106 | { |
| 134 | m_n_disc_right_audio = data & 0x80; | |
| 107 | if (!(offset & 1)) | |
| 108 | m_n_disc_right_audio = data & 0x80; | |
| 109 | else | |
| 110 | m_n_disc_left_audio = data & 0x80; | |
| 135 | 111 | } |
| 136 | 112 | |
| 137 | WRITE8_HANDLER( firefox_disc_ | |
| 113 | static WRITE8_HANDLER( firefox_disc_res | |
| 138 | 114 | { |
| 139 | | |
| 115 | laserdisc_line | |
| 140 | 116 | } |
| 141 | 117 | |
| 142 | WRITE8_HANDLER( firefox_disc_reset_w ) | |
| 143 | { | |
| 144 | disc_reset = (data & 0x80); | |
| 145 | if(!disc_reset) | |
| 146 | { | |
| 147 | laser_disc_speed = 0; | |
| 148 | manchester_offset = 6; /* no data available */ | |
| 149 | command_offset = 0; | |
| 150 | dak = 0x40; | |
| 151 | dav = 0x80; | |
| 152 | } | |
| 153 | } | |
| 154 | ||
| 155 | 118 | /* active low on dbb7 */ |
| 156 | WRITE8_HANDLER( firefox_disc_write_w ) | |
| 119 | static WRITE8_HANDLER( firefox_disc_write_w ) | |
| 157 | 120 | { |
| 158 | if( ( data & 0x80 ) == 0 ) | |
| 159 | { | |
| 160 | dak = 0; /* should go high after 15 uS */ | |
| 161 | dak_just_low = 1; | |
| 162 | command_data[ command_offset++ ] = m_n_disc_data; | |
| 163 | if( command_offset == 3 ) | |
| 164 | { | |
| 165 | command_offset = 0; | |
| 166 | switch( command_data[ 0 ] & 0xf0 ) | |
| 167 | { | |
| 168 | case 0xf0: | |
| 169 | logerror( "CMD: goto Frame #%01x%02x%02x & play forward\n", command_data[ 0 ] & 0x0f, command_data[ 1 ], command_data[ 2 ] ); | |
| 170 | laser_disc_field = | |
| 171 | ( ( command_data[ 0 ] & 0x0f ) * 20000 ) + | |
| 172 | ( (( command_data[ 1 ] & 0xf0 ) >> 4) * 2000 ) + | |
| 173 | ( ( command_data[ 1 ] & 0x0f ) * 200 ) + | |
| 174 | ( (( command_data[ 2 ] & 0xf0 ) >> 4) * 20 ) + | |
| 175 | ( ( command_data[ 2 ] & 0x0f ) * 2 ); | |
| 176 | laser_seek_frame(laser_disc_field >> 1); | |
| 177 | /* | |
| 178 | fprintf(stderr, "CMD: goto frame #%01x%02x%02x & play forward disc_field %d\n", command_data[ 0 ] & 0x0f, command_data[ 1 ], command_data[ 2 ] , laser_disc_field); | |
| 179 | */ | |
| 180 | laser_disc_speed = 1; | |
| 181 | return; | |
| 182 | case 0xd0: | |
| 183 | /* | |
| 184 | fprintf(stderr, "CMD: goto Frame #%01x%02x%02x & halt (first field)\n", command_data[ 0 ] & 0x0f, command_data[ 1 ], command_data[ 2 ] ); | |
| 185 | */ | |
| 186 | laser_disc_field = | |
| 187 | ( ( command_data[ 0 ] & 0x0f ) * 20000 ) + | |
| 188 | ( (( command_data[ 1 ] & 0xf0 ) >> 4) * 2000 ) + | |
| 189 | ( ( command_data[ 1 ] & 0x0f ) * 200 ) + | |
| 190 | ( (( command_data[ 2 ] & 0xf0 ) >> 4) * 20 ) + | |
| 191 | ( ( command_data[ 2 ] & 0x0f ) * 2 ); | |
| 192 | laser_seek_frame(laser_disc_field >> 1); | |
| 193 | laser_disc_speed = 0; | |
| 194 | return; | |
| 195 | case 0x00: | |
| 196 | switch( command_data[ 0 ] & 0x0f ) | |
| 197 | { | |
| 198 | case 0x00: | |
| 199 | switch( command_data[ 1 ] & 0xf0 ) | |
| 200 | { | |
| 201 | case 0x00: | |
| 202 | laser_disc_speed = 1; | |
| 203 | return; | |
| 204 | case 0x10: | |
| 205 | laser_disc_speed = -1; | |
| 206 | return; | |
| 207 | case 0x20: | |
| 208 | laser_disc_speed = 0; | |
| 209 | return; | |
| 210 | case 0x40: | |
| 211 | return; | |
| 212 | case 0x50: | |
| 213 | return; | |
| 214 | case 0xa0: | |
| 215 | laser_disc_speed = 75; | |
| 216 | return; | |
| 217 | case 0xb0: | |
| 218 | laser_disc_speed = -75; | |
| 219 | return; | |
| 220 | case 0xe0: | |
| 221 | return; | |
| 222 | case 0xf0: | |
| 223 | return; | |
| 224 | } | |
| 225 | break; | |
| 226 | case 0x02: | |
| 227 | switch( command_data[ 1 ] ) | |
| 228 | { | |
| 229 | case 0xb0: | |
| 230 | logerror( "CMD: Video ON/OFF %02x\n", command_data[ 2 ] ); | |
| 231 | return; | |
| 232 | case 0xb1: | |
| 233 | logerror( "CMD: Audio-I ON/OFF %02x\n", command_data[ 2 ] ); | |
| 234 | return; | |
| 235 | case 0xb2: | |
| 236 | logerror( "CMD: Audio-II ON/OFF %02x\n", command_data[ 2 ] ); | |
| 237 | return; | |
| 238 | case 0xb3: | |
| 239 | logerror( "CMD: CX ON/OFF %02x\n", command_data[ 2 ] ); | |
| 240 | return; | |
| 241 | } | |
| 242 | break; | |
| 243 | } | |
| 244 | break; | |
| 245 | } | |
| 246 | logerror( "CMD: invalid %02x%02x%02x\n", command_data[ 0 ], command_data[ 1 ], command_data[ 2 ] ); | |
| 247 | } | |
| 248 | } | |
| 121 | if ( ( data & 0x80 ) == 0 ) | |
| 122 | laserdisc_data_w(laserdisc, m_n_disc_data); | |
| 249 | 123 | } |
| 250 | 124 | |
| 251 | 125 | /* latch the data */ |
| 252 | WRITE8_HANDLER( firefox_disc_data_w ) | |
| 126 | static WRITE8_HANDLER( firefox_disc_data_w ) | |
| 253 | 127 | { |
| 254 | 128 | m_n_disc_data = data; |
| 255 | 129 | } |
| 256 | 130 | |
| 257 | static TIMER_DEVICE_CALLBACK( laserdisk_timer_callback ) | |
| 258 | { | |
| 259 | if(param == 0 && laser_disc_speed != 0) | |
| 260 | { | |
| 261 | manchester_data[ 0 ] = ( ( laser_disc_field & 0x01 )?0xA0:0xF0 ) | ( ( laser_disc_field / 20000 ) % 10 ); | |
| 262 | manchester_data[ 1 ] = ( ( ( laser_disc_field / 2000 ) % 10 ) << 4 ) | ( ( laser_disc_field / 200 ) % 10 ); | |
| 263 | manchester_data[ 2 ] = ( ( ( laser_disc_field / 20 ) % 10 ) << 4 ) | ( ( laser_disc_field / 2 ) % 10 ); | |
| 264 | manchester_data[ 3 ] = 0xff; | |
| 265 | manchester_data[ 4 ] = 0xff; | |
| 266 | manchester_data[ 5 ] = 0xff; | |
| 267 | manchester_offset = 0; | |
| 268 | cpunum_set_input_line( Machine, 0, M6809_FIRQ_LINE, ASSERT_LINE ); | |
| 269 | dav = 0; /* buffer contains info */ | |
| 270 | 131 | |
| 271 | laser_disc_field += laser_disc_speed; | |
| 272 | } | |
| 273 | } | |
| 274 | ||
| 275 | ||
| 276 | ||
| 277 | 132 | static unsigned char *tileram; |
| 278 | static size_t tileram_size; | |
| 279 | 133 | static unsigned char *tile_palette; |
| 280 | 134 | static unsigned char *sprite_palette; |
| 281 | 135 | static const device_config *nvram_1c; |
| r3333 | r3334 | |
| 292 | 146 | * |
| 293 | 147 | *************************************/ |
| 294 | 148 | |
| 295 | static | |
| 149 | static VIDEO | |
| 296 | 150 | { |
| 151 | int x; | |
| 152 | int y; | |
| 297 | 153 | int sprite; |
| 154 | int gfxtop = video_screen_get_visible_area(screen)->min_y; | |
| 298 | 155 | |
| 156 | fillbitmap( bitmap, 256, cliprect ); | |
| 157 | ||
| 158 | for( y = 0; y < 64; y++ ) | |
| 159 | { | |
| 160 | for( x = 0; x < 64; x++ ) | |
| 161 | { | |
| 162 | drawgfx( bitmap, screen->machine->gfx[ 0 ], tileram[ x + ( y * 64 ) ], 0, 0, 0, x * 8, gfxtop + y * 8, cliprect, TRANSPARENCY_PEN, 0 ); | |
| 163 | } | |
| 164 | } | |
| 165 | ||
| 299 | 166 | for( sprite = 0; sprite < 32; sprite++ ) |
| 300 | 167 | { |
| 301 | 168 | UINT8 *sprite_data = spriteram + ( 0x200 * sprite_bank ) + ( sprite * 16 ); |
| r3333 | r3334 | |
| 309 | 176 | |
| 310 | 177 | for( row = 0; row < 8; row++ ) |
| 311 | 178 | { |
| 312 | int code = sprite_data[ 15 - row ] + ( 256 * ( ( flags >> 6 ) & 3 ) ); | |
| 313 | 179 | int color = 2 * ( ( flags >> 2 ) & 0x03 ); |
| 314 | int flipx = flags & 0x20; | |
| 315 | 180 | int flipy = flags & 0x10; |
| 181 | int flipx = flags & 0x20; | |
| 182 | int code = sprite_data[ 15 - row ] + ( 256 * ( ( flags >> 6 ) & 3 ) ); | |
| 316 | 183 | |
| 317 | if( ( flags & 1 ) == priority ) | |
| 318 | { | |
| 319 | drawgfx( bitmap, Machine->gfx[ 1 ], code, color, flipx, flipy, x + 16, 500 - y - ( row * 16 ), visarea, TRANSPARENCY_PEN, 0 ); | |
| 320 | } | |
| 184 | drawgfx( bitmap, screen->machine->gfx[ 1 ], code, color, flipx, flipy, x + 16, gfxtop + 500 - y - ( row * 16 ), cliprect, TRANSPARENCY_PEN, 0 ); | |
| 321 | 185 | } |
| 322 | 186 | } |
| 323 | 187 | } |
| 324 | 188 | |
| 325 | } | |
| 326 | ||
| 327 | VIDEO_UPDATE( firefox ) | |
| 328 | { | |
| 329 | int x; | |
| 330 | int y; | |
| 331 | const rectangle *visarea = video_screen_get_visible_area( Machine->primary_screen ); | |
| 332 | ||
| 333 | fillbitmap( bitmap, 256, visarea ); | |
| 334 | ||
| 335 | draw_sprites( bitmap, 1, visarea ); | |
| 336 | ||
| 337 | for( y = 0; y < 64; y++ ) | |
| 338 | { | |
| 339 | for( x = 0; x < 64; x++ ) | |
| 340 | { | |
| 341 | drawgfx( bitmap, Machine->gfx[ 0 ], tileram[ x + ( y * 64 ) ], 0, 0, 0, x * 8, y * 8, visarea, TRANSPARENCY_PEN, 0 ); | |
| 342 | } | |
| 343 | } | |
| 344 | ||
| 345 | draw_sprites( bitmap, 0, visarea ); | |
| 346 | ||
| 347 | 189 | return 0; |
| 348 | 190 | } |
| 349 | 191 | |
| r3333 | r3334 | |
| 351 | 193 | { |
| 352 | 194 | video_screen_update_now(timer->machine->primary_screen); |
| 353 | 195 | |
| 354 | cpu | |
| 196 | cputag_set_input_line( timer->machine, "main", M6809_IRQ_LINE, ASSERT_LINE ); | |
| 355 | 197 | } |
| 356 | 198 | |
| 357 | static void set_rgba( int start, int index, unsigned char *palette_ram ) | |
| 199 | static void set_rgba( running_machine *machine, int start, int index, unsigned char *palette_ram ) | |
| 358 | 200 | { |
| 359 | 201 | int r = palette_ram[ index ]; |
| 360 | 202 | int g = palette_ram[ index + 256 ]; |
| 361 | 203 | int b = palette_ram[ index + 512 ]; |
| 362 | 204 | int a = ( b & 3 ) * 0x55; |
| 363 | 205 | |
| 364 | palette_set_color( Machine, start + index, MAKE_RGB( r, g, b ) ); | |
| 365 | render_container_set_palette_alpha(render_container_get_screen(Machine->primary_screen), start + index, a); | |
| 206 | palette_set_color( machine, start + index, MAKE_RGB( r, g, b ) ); | |
| 207 | render_container_set_palette_alpha(render_container_get_screen(machine->primary_screen), start + index, a); | |
| 366 | 208 | } |
| 367 | 209 | |
| 368 | 210 | static WRITE8_HANDLER( tile_palette_w ) |
| 369 | 211 | { |
| 370 | 212 | tile_palette[ offset ] = data; |
| 371 | set_rgba( 0, offset & 0xff, tile_palette ); | |
| 213 | set_rgba( machine, 0, offset & 0xff, tile_palette ); | |
| 372 | 214 | } |
| 373 | 215 | |
| 374 | 216 | static WRITE8_HANDLER( sprite_palette_w ) |
| 375 | 217 | { |
| 376 | 218 | sprite_palette[ offset ] = data; |
| 377 | set_rgba( 256, offset & 0xff, sprite_palette ); | |
| 219 | set_rgba( machine, 256, offset & 0xff, sprite_palette ); | |
| 378 | 220 | } |
| 379 | 221 | |
| 380 | WRITE8_HANDLER( firefox_objram_bank_w ) | |
| 222 | static WRITE8_HANDLER( firefox_objram_bank_w ) | |
| 381 | 223 | { |
| 382 | 224 | sprite_bank = data & 0x03; |
| 383 | 225 | } |
| r3333 | r3334 | |
| 409 | 251 | static WRITE8_HANDLER( main_to_sound_w ) |
| 410 | 252 | { |
| 411 | 253 | main_to_sound_flag = 1; |
| 412 | soundlatch_w(Machine, 0, data); | |
| 413 | cputag_set_input_line(Machine, "audio", INPUT_LINE_NMI, PULSE_LINE); | |
| 254 | soundlatch_w(machine, 0, data); | |
| 255 | cputag_set_input_line(machine, "audio", INPUT_LINE_NMI, PULSE_LINE); | |
| 414 | 256 | } |
| 415 | 257 | |
| 416 | 258 | static WRITE8_HANDLER( sound_reset_w ) |
| r3333 | r3334 | |
| 423 | 265 | static READ8_HANDLER( main_to_sound_r ) |
| 424 | 266 | { |
| 425 | 267 | main_to_sound_flag = 0; |
| 426 | return soundlatch_r( | |
| 268 | return soundlatch_r(machine, 0); | |
| 427 | 269 | } |
| 428 | 270 | |
| 429 | 271 | static WRITE8_HANDLER( sound_to_main_w ) |
| 430 | 272 | { |
| 431 | 273 | sound_to_main_flag = 1; |
| 432 | soundlatch2_w( | |
| 274 | soundlatch2_w(machine, 0, data); | |
| 433 | 275 | } |
| 434 | 276 | |
| 435 | 277 | |
| r3333 | r3334 | |
| 484 | 326 | { |
| 485 | 327 | if( control_num == 0 ) |
| 486 | 328 | { |
| 487 | return input_port_read( | |
| 329 | return input_port_read( machine, "PITCH" ); | |
| 488 | 330 | } |
| 489 | 331 | |
| 490 | return input_port_read( | |
| 332 | return input_port_read( machine, "YAW" ); | |
| 491 | 333 | } |
| 492 | 334 | |
| 493 | 335 | static WRITE8_HANDLER( adc_select_w ) |
| r3333 | r3334 | |
| 534 | 376 | * |
| 535 | 377 | *************************************/ |
| 536 | 378 | |
| 537 | WRITE8_HANDLER( rom_bank_w ) | |
| 379 | static WRITE8_HANDLER( rom_bank_w ) | |
| 538 | 380 | { |
| 539 | 381 | memory_set_bank(1, data & 0x1f); |
| 540 | 382 | } |
| 541 | 383 | |
| 542 | 384 | static WRITE8_HANDLER( main_irq_clear_w ) |
| 543 | 385 | { |
| 544 | cpu | |
| 386 | cputag_set_input_line( machine, "main", M6809_IRQ_LINE, CLEAR_LINE ); | |
| 545 | 387 | } |
| 546 | 388 | |
| 547 | 389 | static WRITE8_HANDLER( main_firq_clear_w ) |
| 548 | 390 | { |
| 549 | cpu | |
| 391 | cputag_set_input_line( machine, "main", M6809_FIRQ_LINE, CLEAR_LINE ); | |
| 550 | 392 | } |
| 551 | 393 | |
| 552 | WRITE8_HANDLER( self_reset_w ) | |
| 394 | static WRITE8_HANDLER( self_reset_w ) | |
| 553 | 395 | { |
| 554 | cpu | |
| 396 | cputag_set_input_line( machine, "main", INPUT_LINE_RESET, PULSE_LINE ); | |
| 555 | 397 | } |
| 556 | 398 | |
| 557 | 399 | |
| r3333 | r3334 | |
| 562 | 404 | * |
| 563 | 405 | *************************************/ |
| 564 | 406 | |
| 565 | WRITE8_HANDLER( led_w ) | |
| 407 | static WRITE8_HANDLER( led_w ) | |
| 566 | 408 | { |
| 567 | if( ( data & 0x80 ) != 0 ) | |
| 568 | { | |
| 569 | set_led_status( offset, 0 ); | |
| 570 | } | |
| 571 | else | |
| 572 | { | |
| 573 | set_led_status( offset, 1 ); | |
| 574 | } | |
| 409 | set_led_status( offset, ( data & 0x80 ) == 0 ); | |
| 575 | 410 | } |
| 576 | 411 | |
| 577 | WRITE8_HANDLER( firefox_coin_counter_w ) | |
| 412 | static WRITE8_HANDLER( firefox_coin_counter_w ) | |
| 578 | 413 | { |
| 579 | 414 | coin_counter_w( offset, data & 0x80 ); |
| 580 | 415 | } |
| 581 | 416 | |
| 582 | 417 | |
| 583 | 418 | |
| 584 | ||
| 419 | static | |
| 585 | 420 | { |
| 421 | if (state) | |
| 422 | cputag_set_input_line( device->machine, "main", M6809_FIRQ_LINE, ASSERT_LINE ); | |
| 423 | } | |
| 424 | ||
| 425 | ||
| 426 | static MACHINE_START( firefox ) | |
| 427 | { | |
| 586 | 428 | memory_configure_bank(1, 0, 32, memory_region(machine, "main") + 0x10000, 0x1000); |
| 587 | 429 | nvram_1c = device_list_find_by_tag(machine->config->devicelist, X2212, "nvram_1c"); |
| 588 | 430 | nvram_1d = device_list_find_by_tag(machine->config->devicelist, X2212, "nvram_1d"); |
| 589 | 431 | |
| 432 | laserdisc = device_list_find_by_tag(machine->config->devicelist, LASERDISC, "laserdisc"); | |
| 433 | vp931_set_data_ready_callback(laserdisc, firq_gen); | |
| 434 | ||
| 590 | 435 | control_num = 0; |
| 591 | 436 | sprite_bank = 0; |
| 592 | ||
| 593 | command_data[ 0 ] = 0; | |
| 594 | command_data[ 1 ] = 0; | |
| 595 | command_data[ 2 ] = 0; | |
| 596 | command_offset = 0; | |
| 597 | ||
| 598 | laser_disc_field = 0; | |
| 599 | laser_disc_speed = 0; | |
| 600 | manchester_offset = 6; | |
| 601 | 437 | } |
| 602 | 438 | |
| 603 | 439 | |
| r3333 | r3334 | |
| 607 | 443 | * |
| 608 | 444 | *************************************/ |
| 609 | 445 | |
| 610 | static ADDRESS_MAP_START( main_map | |
| 446 | static ADDRESS_MAP_START( main_map | |
| 611 | 447 | AM_RANGE(0x0000, 0x0fff) AM_RAM |
| 612 | AM_RANGE(0x1000, 0x1fff) AM_RAM AM_BASE(&tileram) AM_SIZE(&tileram_size) | |
| 613 | AM_RANGE(0x2000, 0x27ff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size) | |
| 448 | AM_RANGE(0x1000, 0x1fff) AM_RAM AM_BASE(&tileram) | |
| 449 | AM_RANGE(0x2000, 0x27ff) AM_RAM AM_BASE(&spriteram) | |
| 614 | 450 | AM_RANGE(0x2800, 0x2aff) AM_READWRITE(SMH_RAM, sprite_palette_w) AM_BASE(&sprite_palette) |
| 615 | AM_RANGE(0x2b00, 0x2b00) AM_WRITE(firefox_objram_bank_w) | |
| 616 | AM_RANGE(0x2b01, 0x2bff) AM_RAM | |
| 451 | AM_RANGE(0x2b00, 0x2b00) AM_MIRROR(0x04ff) AM_WRITE(firefox_objram_bank_w) | |
| 617 | 452 | AM_RANGE(0x2c00, 0x2eff) AM_READWRITE(SMH_RAM, tile_palette_w) AM_BASE(&tile_palette) |
| 618 | AM_RANGE(0x2f00, 0x2fff) AM_RAM | |
| 619 | 453 | AM_RANGE(0x3000, 0x3fff) AM_ROMBANK(1) |
| 620 | AM_RANGE(0x4000, 0x40ff) AM_READWRITE(nvram_r, nvram_w) | |
| 621 | AM_RANGE(0x4100, 0x4100) AM_READ_PORT("IN0") | |
| 622 | AM_RANGE(0x4101, 0x4101) AM_READ_PORT("IN1") | |
| 623 | AM_RANGE(0x4102, 0x4102) AM_READ(firefox_disc_status_r) | |
| 624 | AM_RANGE(0x4103, 0x4103) AM_READ_PORT("IN3") | |
| 625 | AM_RANGE(0x4104, 0x4104) AM_READ_PORT("IN4") | |
| 626 | AM_RANGE(0x4105, 0x4105) AM_READ(firefox_disc_data_r) | |
| 627 | AM_RANGE(0x4106, 0x4106) AM_READ(sound_to_main_r) | |
| 628 | AM_RANGE(0x4107, 0x4107) AM_READ(adc_r) | |
| 629 | AM_RANGE(0x4200, 0x4200) AM_WRITE(main_irq_clear_w) | |
| 630 | AM_RANGE(0x4208, 0x4208) AM_WRITE(main_firq_clear_w) | |
| 631 | AM_RANGE(0x4210, 0x4210) AM_WRITE(watchdog_reset_w) | |
| 632 | AM_RANGE(0x4218, 0x4218) AM_WRITE(firefox_disc_read_w) | |
| 633 | AM_RANGE(0x4220, 0x4221) AM_WRITE(adc_select_w) | |
| 634 | AM_RANGE(0x4230, 0x4230) AM_WRITE(self_reset_w) | |
| 635 | AM_RANGE(0x4280, 0x4280) AM_WRITE(novram_recall_w) | |
| 636 | AM_RANGE(0x4281, 0x4281) AM_WRITE(sound_reset_w) | |
| 637 | AM_RANGE(0x4282, 0x4282) AM_WRITE(novram_store_w) | |
| 638 | AM_RANGE(0x4283, 0x4283) AM_WRITE(firefox_disc_lock_w) | |
| 639 | AM_RANGE(0x4284, 0x4284) AM_WRITE(firefox_disc_right_audio_enable_w) | |
| 640 | AM_RANGE(0x4285, 0x4285) AM_WRITE(firefox_disc_left_audio_enable_w) | |
| 641 | AM_RANGE(0x4286, 0x4286) AM_WRITE(firefox_disc_reset_w) | |
| 642 | AM_RANGE(0x4287, 0x4287) AM_WRITE(firefox_disc_write_w) | |
| 643 | AM_RANGE(0x4288, 0x4289) AM_WRITE(firefox_coin_counter_w) | |
| 644 | AM_RANGE(0x428c, 0x428f) AM_WRITE(led_w) | |
| 645 | AM_RANGE(0x4290, 0x4290) AM_WRITE(rom_bank_w) | |
| 646 | AM_RANGE(0x4298, 0x4298) AM_WRITE(main_to_sound_w) | |
| 647 | AM_RANGE(0x42a0, 0x42a7) AM_WRITE(firefox_disc_data_w) | |
| 454 | AM_RANGE(0x4000, 0x40ff) AM_READWRITE(nvram_r, nvram_w) /* NOVRAM */ | |
| 455 | AM_RANGE(0x4100, 0x4100) AM_MIRROR(0x00f8) AM_READ_PORT("rdin0") /* RDIN0 */ | |
| 456 | AM_RANGE(0x4101, 0x4101) AM_MIRROR(0x00f8) AM_READ_PORT("rdin1") /* RDIN1 */ | |
| 457 | AM_RANGE(0x4102, 0x4102) AM_MIRROR(0x00f8) AM_READ(firefox_disc_status_r) /* RDIN2 */ | |
| 458 | AM_RANGE(0x4103, 0x4103) AM_MIRROR(0x00f8) AM_READ_PORT("opt0") /* OPT0 */ | |
| 459 | AM_RANGE(0x4104, 0x4104) AM_MIRROR(0x00f8) AM_READ_PORT("opt1") /* OPT1 */ | |
| 460 | AM_RANGE(0x4105, 0x4105) AM_MIRROR(0x00f8) AM_READ(firefox_disc_data_r) /* DREAD */ | |
| 461 | AM_RANGE(0x4106, 0x4106) AM_MIRROR(0x00f8) AM_READ(sound_to_main_r) /* RDSOUND */ | |
| 462 | AM_RANGE(0x4107, 0x4107) AM_MIRROR(0x00f8) AM_READ(adc_r) /* ADC */ | |
| 463 | AM_RANGE(0x4200, 0x4200) AM_MIRROR(0x0047) AM_WRITE(main_irq_clear_w) /* RSTIRQ */ | |
| 464 | AM_RANGE(0x4208, 0x4208) AM_MIRROR(0x0047) AM_WRITE(main_firq_clear_w) /* RSTFIRQ */ | |
| 465 | AM_RANGE(0x4210, 0x4210) AM_MIRROR(0x0047) AM_WRITE(watchdog_reset_w) /* WDCLK */ | |
| 466 | AM_RANGE(0x4218, 0x4218) AM_MIRROR(0x0047) AM_WRITE(firefox_disc_read_w) /* DSKREAD */ | |
| 467 | AM_RANGE(0x4220, 0x4223) AM_MIRROR(0x0044) AM_WRITE(adc_select_w) /* ADCSTART */ | |
| 468 | AM_RANGE(0x4230, 0x4230) AM_MIRROR(0x0047) AM_WRITE(self_reset_w) /* AMUCK */ | |
| 469 | AM_RANGE(0x4280, 0x4280) AM_MIRROR(0x0040) AM_WRITE(novram_recall_w) /* LATCH0 -> NVRECALL */ | |
| 470 | AM_RANGE(0x4281, 0x4281) AM_MIRROR(0x0040) AM_WRITE(sound_reset_w) /* LATCH0 -> RSTSOUND */ | |
| 471 | AM_RANGE(0x4282, 0x4282) AM_MIRROR(0x0040) AM_WRITE(novram_store_w) /* LATCH0 -> NVRSTORE */ | |
| 472 | AM_RANGE(0x4283, 0x4283) AM_MIRROR(0x0040) AM_WRITE(firefox_disc_lock_w) /* LATCH0 -> LOCK */ | |
| 473 | AM_RANGE(0x4284, 0x4285) AM_MIRROR(0x0040) AM_WRITE(audio_enable_w) /* LATCH0 -> SWDSKR, SWDSKL */ | |
| 474 | AM_RANGE(0x4286, 0x4286) AM_MIRROR(0x0040) AM_WRITE(firefox_disc_reset_w) /* LATCH0 -> RSTDSK */ | |
| 475 | AM_RANGE(0x4287, 0x4287) AM_MIRROR(0x0040) AM_WRITE(firefox_disc_write_w) /* LATCH0 -> WRDSK */ | |
| 476 | AM_RANGE(0x4288, 0x4289) AM_MIRROR(0x0040) AM_WRITE(firefox_coin_counter_w) /* LATCH1 -> COIN COUNTERR, COUNTERL */ | |
| 477 | AM_RANGE(0x428c, 0x428f) AM_MIRROR(0x0040) AM_WRITE(led_w) /* LATCH1 -> LEDs */ | |
| 478 | AM_RANGE(0x4290, 0x4290) AM_MIRROR(0x0047) AM_WRITE(rom_bank_w) /* WRTREG */ | |
| 479 | AM_RANGE(0x4298, 0x4298) AM_MIRROR(0x0047) AM_WRITE(main_to_sound_w) /* WRSOUND */ | |
| 480 | AM_RANGE(0x42a0, 0x42a0) AM_MIRROR(0x0047) AM_WRITE(firefox_disc_data_w) /* DSKLATCH */ | |
| 648 | 481 | AM_RANGE(0x4400, 0xffff) AM_ROM |
| 649 | 482 | ADDRESS_MAP_END |
| 650 | 483 | |
| r3333 | r3334 | |
| 678 | 511 | *************************************/ |
| 679 | 512 | |
| 680 | 513 | INPUT_PORTS_START( firefox ) |
| 681 | PORT_START(" | |
| 514 | PORT_START("rdin0") | |
| 682 | 515 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| 683 | 516 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) |
| 684 | 517 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) |
| r3333 | r3334 | |
| 688 | 521 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 689 | 522 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 690 | 523 | |
| 691 | PORT_START(" | |
| 524 | PORT_START("rdin1") | |
| 692 | 525 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(mainflag_r, NULL) |
| 693 | 526 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(soundflag_r, NULL) |
| 694 | 527 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_VBLANK ) |
| r3333 | r3334 | |
| 698 | 531 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 699 | 532 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 700 | 533 | |
| 701 | PORT_START(" | |
| 534 | PORT_START("opt0") | |
| 702 | 535 | PORT_DIPNAME( 0x03, 0x00, "Coins Per Credit" ) |
| 703 | 536 | PORT_DIPSETTING( 0x00, "1 Coin 1 Credit" ) |
| 704 | 537 | PORT_DIPSETTING( 0x01, "2 Coins 1 Credit" ) |
| r3333 | r3334 | |
| 721 | 554 | PORT_DIPSETTING( 0x60, "2 Credits for 4 Coin Units" ) |
| 722 | 555 | PORT_DIPSETTING( 0xe0, DEF_STR( Free_Play ) ) |
| 723 | 556 | |
| 724 | PORT_START(" | |
| 557 | PORT_START("opt1") | |
| 725 | 558 | PORT_DIPNAME( 0x01, 0x00, "Missions" ) |
| 726 | 559 | PORT_DIPSETTING( 0x00, "All .50" ) |
| 727 | 560 | PORT_DIPSETTING( 0x01, ".50 .75" ) |
| r3333 | r3334 | |
| 782 | 615 | }; |
| 783 | 616 | |
| 784 | 617 | static GFXDECODE_START( firefox ) |
| 785 | GFXDECODE_ENTRY("tiles", 0, tilelayout, 0, 16) | |
| 618 | GFXDECODE_ENTRY("tiles", 0, tilelayout, 0, 16) | |
| 786 | 619 | GFXDECODE_ENTRY("sprites", 0, spritelayout, 256, 32) |
| 787 | 620 | GFXDECODE_END |
| 788 | 621 | |
| r3333 | r3334 | |
| 807 | 640 | static MACHINE_DRIVER_START( firefox ) |
| 808 | 641 | |
| 809 | 642 | /* basic machine hardware */ |
| 810 | MDRV_CPU_ADD("main", M6809, | |
| 643 | MDRV_CPU_ADD("main", M6809E, MASTER_XTAL/2) | |
| 811 | 644 | MDRV_CPU_PROGRAM_MAP(main_map, 0) |
| 812 | MDRV_TIMER_ADD_SCANLINE("32v", video_timer_callback, "main", 96, 128) | |
| 645 | /* interrupts count starting at end of VBLANK, which is 44, so add 44 */ | |
| 646 | MDRV_TIMER_ADD_SCANLINE("32v", video_timer_callback, "main", 96+44, 128) | |
| 813 | 647 | |
| 814 | MDRV_CPU_ADD("audio", M6502, | |
| 648 | MDRV_CPU_ADD("audio", M6502, MASTER_XTAL/8) | |
| 815 | 649 | MDRV_CPU_PROGRAM_MAP(audio_map, 0) |
| 816 | 650 | |
| 651 | MDRV_INTERLEAVE(100) | |
| 652 | ||
| 817 | 653 | MDRV_MACHINE_START(firefox) |
| 654 | MDRV_WATCHDOG_TIME_INIT(UINT64_ATTOTIME_IN_HZ((double)MASTER_XTAL/8/16/16/16/16)) | |
| 818 | 655 | |
| 819 | 656 | /* video hardware */ |
| 820 | 657 | MDRV_LASERDISC_SCREEN_ADD_NTSC("main", BITMAP_FORMAT_INDEXED16) |
| r3333 | r3334 | |
| 822 | 659 | MDRV_GFXDECODE(firefox) |
| 823 | 660 | MDRV_PALETTE_LENGTH(512) |
| 824 | 661 | |
| 825 | MDRV_LASERDISC_ADD("laserdisc", PIONEER_PR8210, "main", "ldsound") | |
| 826 | MDRV_LASERDISC_OVERLAY(firefox, 64*8, 64*8, BITMAP_FORMAT_INDEXED16) | |
| 827 | MDRV_LASERDISC_OVERLAY_CLIP(7*8, 53*8-1, 1*8, 62*8-1) | |
| 828 | MDRV_TIMER_ADD_SCANLINE("laserdisk", laserdisk_timer_callback, "main", 0, 0) | |
| 662 | MDRV_LASERDISC_ADD("laserdisc", PHILLIPS_22VP931, "main", "ldsound") | |
| 663 | MDRV_LASERDISC_OVERLAY(firefox, 64*8, 525, BITMAP_FORMAT_INDEXED16) | |
| 664 | MDRV_LASERDISC_OVERLAY_CLIP(7*8, 53*8-1, 44, 480+44) | |
| 829 | 665 | |
| 830 | 666 | MDRV_DEVICE_ADD("nvram_1c",X2212) |
| 831 | 667 | MDRV_DEVICE_ADD("nvram_1d",X2212) |
| 832 | MDRV_RIOT6532_ADD("riot", | |
| 668 | MDRV_RIOT6532_ADD("riot", MASTER_XTAL/8, riot_intf) | |
| 833 | 669 | |
| 834 | 670 | /* sound hardware */ |
| 835 | 671 | MDRV_SPEAKER_STANDARD_STEREO("left", "right") |
| 836 | 672 | |
| 837 | MDRV_SOUND_ADD("pokey1", POKEY, | |
| 673 | MDRV_SOUND_ADD("pokey1", POKEY, MASTER_XTAL/8) | |
| 838 | 674 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 0.20) |
| 839 | 675 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 0.20) |
| 840 | 676 | |
| 841 | MDRV_SOUND_ADD("pokey2", POKEY, | |
| 677 | MDRV_SOUND_ADD("pokey2", POKEY, MASTER_XTAL/8) | |
| 842 | 678 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 0.20) |
| 843 | 679 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 0.20) |
| 844 | 680 | |
| 845 | MDRV_SOUND_ADD("pokey3", POKEY, | |
| 681 | MDRV_SOUND_ADD("pokey3", POKEY, MASTER_XTAL/8) | |
| 846 | 682 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 0.20) |
| 847 | 683 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 0.20) |
| 848 | 684 | |
| 849 | MDRV_SOUND_ADD("pokey4", POKEY, | |
| 685 | MDRV_SOUND_ADD("pokey4", POKEY, MASTER_XTAL/8) | |
| 850 | 686 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 0.20) |
| 851 | 687 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 0.20) |
| 852 | 688 | |
| 853 | MDRV_SOUND_ADD("tms", TMS5220, | |
| 689 | MDRV_SOUND_ADD("tms", TMS5220, MASTER_XTAL/2/10) | |
| 854 | 690 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 0.50) |
| 855 | 691 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 0.50) |
| 856 | 692 | |
| r3333 | r3334 | |
| 858 | 694 | MDRV_SOUND_CONFIG(laserdisc_custom_interface) |
| 859 | 695 | MDRV_SOUND_ROUTE(0, "left", 1.0) |
| 860 | 696 | MDRV_SOUND_ROUTE(1, "right", 1.0) |
| 861 | ||
| 862 | 697 | MACHINE_DRIVER_END |
| 863 | 698 | |
| 864 | 699 | |
| r3333 | r3334 | |
| 906 | 741 | ROM_LOAD( "136026.120", 0x1c000, 0x4000, CRC(e1b95923) SHA1(b6d0c0af0a8f55e728cd0f4c3222745eefd57f50)) /* 2a */ |
| 907 | 742 | ROM_LOAD( "136026.115", 0x20000, 0x4000, CRC(861abc82) SHA1(1845888d07162ae915364a2a91294731f1c5b3bd)) /* 1c */ |
| 908 | 743 | ROM_LOAD( "136026.119", 0x24000, 0x4000, CRC(959471b1) SHA1(a032209a209f51d34360d5c7ad32ec62150158d2)) /* 1a */ |
| 744 | ||
| 745 | DISK_REGION( "laserdisc" ) | |
| 746 | DISK_IMAGE_READONLY( "firefox", 0, NO_DUMP ) | |
| 909 | 747 | ROM_END |
| 910 | 748 | |
| 911 | 749 | ROM_START( firefoxa ) |
| r3333 | r3334 | |
| 943 | 781 | ROM_LOAD( "136026.120", 0x1c000, 0x4000, CRC(e1b95923) SHA1(b6d0c0af0a8f55e728cd0f4c3222745eefd57f50)) /* 2a */ |
| 944 | 782 | ROM_LOAD( "136026.115", 0x20000, 0x4000, CRC(861abc82) SHA1(1845888d07162ae915364a2a91294731f1c5b3bd)) /* 1c */ |
| 945 | 783 | ROM_LOAD( "136026.119", 0x24000, 0x4000, CRC(959471b1) SHA1(a032209a209f51d34360d5c7ad32ec62150158d2)) /* 1a */ |
| 784 | ||
| 785 | DISK_REGION( "laserdisc" ) | |
| 786 | DISK_IMAGE_READONLY( "firefox", 0, NO_DUMP ) | |
| 946 | 787 | ROM_END |
| 947 | 788 | |
| 948 | 789 |
| r3333 | r3334 | |
|---|---|---|
| 13 | 13 | * TX-1 V8 (1984) |
| 14 | 14 | |
| 15 | 15 | Notes: |
| 16 | * | |
| 16 | * TX-1 tyre | |
| 17 | 17 | * 'buggyboy' set is using ROMs from 'buggybjr' for testing purposes |
| 18 | 18 | until the original set can be dumped. |
| 19 | 19 | |
| r3333 | r3334 | |
| 47 | 47 | #include "rendlay.h" |
| 48 | 48 | #include "tx1.h" |
| 49 | 49 | |
| 50 | ||
| 50 | 51 | /************************************* |
| 51 | 52 | * |
| 52 | 53 | * Globals |
| 53 | 54 | * |
| 54 | 55 | *************************************/ |
| 55 | UINT16 *tx1_math_ram; | |
| 56 | static UINT8 *z80_ram; | |
| 56 | ||
| 57 | UINT16 *tx1_math_ram; | |
| 58 | static UINT8 *z80_ram; | |
| 57 | 59 | static UINT8 tx1_ppi_latch_a; |
| 58 | 60 | static UINT8 tx1_ppi_latch_b; |
| 59 | 61 | static UINT32 ts; |
| 60 | 62 | |
| 61 | 63 | |
| 64 | /************************************* | |
| 65 | * | |
| 66 | * CPU Control | |
| 67 | * | |
| 68 | *************************************/ | |
| 69 | ||
| 62 | 70 | /* Main CPU and Z80 synchronisation */ |
| 63 | 71 | static WRITE16_HANDLER( z80_busreq_w ) |
| 64 | 72 | { |
| r3333 | r3334 | |
| 75 | 83 | cpunum_set_input_line(machine, 1, INPUT_LINE_TEST, CLEAR_LINE); |
| 76 | 84 | } |
| 77 | 85 | |
| 78 | /* Z80 can trigger | |
| 86 | /* Z80 can trigger its own interrupt | |
| 79 | 87 | static WRITE8_HANDLER( z80_intreq_w ) |
| 80 | 88 | { |
| 81 | 89 | cpunum_set_input_line(machine, 2, 0, HOLD_LINE); |
| r3333 | r3334 | |
| 184 | 192 | PORT_DIPSETTING( 0x80, "4" ) |
| 185 | 193 | INPUT_PORTS_END |
| 186 | 194 | |
| 187 | ||
| 188 | 195 | static INPUT_PORTS_START( tx1a ) |
| 189 | PORT_INCLUDE( | |
| 196 | PORT_INCLUDE( | |
| 190 | 197 | |
| 191 | PORT_MODIFY( | |
| 198 | PORT_MODIFY( | |
| 192 | 199 | PORT_DIPNAME( 0x000c, 0x0000, "Game Cost" ) |
| 193 | 200 | PORT_DIPSETTING( 0x0000, "1 Coin Unit for 1 Credit" ) |
| 194 | 201 | PORT_DIPSETTING( 0x0004, "2 Coin Units for 1 Credit" ) |
| r3333 | r3334 | |
| 407 | 414 | return z80_ram[offset]; |
| 408 | 415 | } |
| 409 | 416 | |
| 417 | static WRITE8_HANDLER( tx1_coin_cnt ) | |
| 418 | { | |
| 419 | coin_counter_w(0, data & 0x80); | |
| 420 | coin_counter_w(1, data & 0x40); | |
| 421 | } | |
| 422 | ||
| 423 | static WRITE8_HANDLER( tx1_ppi_latch_w ) | |
| 424 | { | |
| 425 | tx1_ppi_latch_a = ((input_port_read(machine, "AN_BRAKE") & 0xf) << 4) | (input_port_read(machine, "AN_ACCELERATOR") & 0xf); | |
| 426 | tx1_ppi_latch_b = input_port_read(machine, "AN_STEERING"); | |
| 427 | } | |
| 428 | ||
| 429 | static READ8_HANDLER( tx1_ppi_porta_r ) | |
| 430 | { | |
| 431 | return tx1_ppi_latch_a; | |
| 432 | } | |
| 433 | ||
| 434 | static READ8_HANDLER( tx1_ppi_portb_r ) | |
| 435 | { | |
| 436 | return input_port_read(machine, "PPI_PORTD") | tx1_ppi_latch_b; | |
| 437 | } | |
| 438 | ||
| 439 | /* TODO */ | |
| 440 | static READ8_HANDLER( bb_analog_r ) | |
| 441 | { | |
| 442 | if ( offset == 1 ) | |
| 443 | return ((input_port_read(machine, "AN_ACCELERATOR") & 0xf) << 4) | input_port_read(machine, "AN_STEERING"); | |
| 444 | else | |
| 445 | return (input_port_read(machine, "AN_BRAKE") & 0xf) << 4; | |
| 446 | } | |
| 447 | ||
| 448 | static READ8_HANDLER( bbjr_analog_r ) | |
| 449 | { | |
| 450 | if ( offset == 0 ) | |
| 451 | return ((input_port_read(machine, "AN_ACCELERATOR") & 0xf) << 4) | input_port_read(machine, "AN_STEERING"); | |
| 452 | else | |
| 453 | return (input_port_read(machine, "AN_BRAKE") & 0xf) << 4; | |
| 454 | } | |
| 455 | ||
| 456 | ||
| 410 | 457 | /************************************* |
| 411 | 458 | * |
| 459 | * 8255 PPI Interfaces | |
| 460 | * | |
| 461 | *************************************/ | |
| 462 | ||
| 463 | /* Buggy Boy uses an 8255 PPI instead of YM2149 ports for inputs! */ | |
| 464 | static const ppi8255_interface buggyboy_ppi8255_intf = | |
| 465 | { | |
| 466 | input_port_1_r, | |
| 467 | NULL, | |
| 468 | input_port_2_r, | |
| 469 | NULL, | |
| 470 | NULL, | |
| 471 | NULL | |
| 472 | }; | |
| 473 | ||
| 474 | ||
| 475 | static const ppi8255_interface tx1_ppi8255_intf = | |
| 476 | { | |
| 477 | tx1_ppi_porta_r, | |
| 478 | tx1_ppi_portb_r, | |
| 479 | input_port_4_r, | |
| 480 | NULL, | |
| 481 | NULL, | |
| 482 | tx1_coin_cnt | |
| 483 | }; | |
| 484 | ||
| 485 | ||
| 486 | /************************************* | |
| 487 | * | |
| 412 | 488 | * TX-1 Memory Maps |
| 413 | 489 | * |
| 414 | 490 | *************************************/ |
| r3333 | r3334 | |
| 418 | 494 | AM_RANGE(0x02000, 0x02fff) AM_MIRROR(0x1000) AM_RAM |
| 419 | 495 | AM_RANGE(0x04000, 0x04fff) AM_MIRROR(0x1000) AM_RAM AM_BASE(&generic_nvram16) AM_SIZE(&generic_nvram_size) |
| 420 | 496 | AM_RANGE(0x06000, 0x06fff) AM_READWRITE(tx1_crtc_r, tx1_crtc_w) |
| 421 | AM_RANGE(0x08000, 0x09fff) AM_RAM | |
| 497 | AM_RANGE(0x08000, 0x09fff) AM_RAM | |
| 422 | 498 | AM_RANGE(0x0a000, 0x0afff) AM_RAM AM_SHARE(1) AM_BASE(&tx1_rcram) |
| 423 | 499 | AM_RANGE(0x0b000, 0x0b001) AM_READWRITE(dipswitches_r, z80_busreq_w) |
| 424 | 500 | AM_RANGE(0x0c000, 0x0c001) AM_WRITE(tx1_scolst_w) |
| r3333 | r3334 | |
| 444 | 520 | AM_RANGE(0xfc000, 0xfffff) AM_ROM |
| 445 | 521 | ADDRESS_MAP_END |
| 446 | 522 | |
| 447 | ||
| 448 | static WRITE8_HANDLER( tx1_ppi_latch_w ) | |
| 449 | { | |
| 450 | tx1_ppi_latch_a = ((input_port_read(machine, "AN_BRAKE") & 0xf) << 4) | (input_port_read(machine, "AN_ACCELERATOR") & 0xf); | |
| 451 | tx1_ppi_latch_b = input_port_read(machine, "AN_STEERING"); | |
| 452 | } | |
| 453 | ||
| 454 | static READ8_HANDLER( tx1_ppi_porta_r ) | |
| 455 | { | |
| 456 | return tx1_ppi_latch_a; | |
| 457 | } | |
| 458 | ||
| 459 | static READ8_HANDLER( tx1_ppi_portb_r ) | |
| 460 | { | |
| 461 | return input_port_read(machine, "PPI_PORTD") | tx1_ppi_latch_b; | |
| 462 | } | |
| 463 | ||
| 464 | 523 | static ADDRESS_MAP_START( tx1_sound_prg, ADDRESS_SPACE_PROGRAM, 8 ) |
| 465 | 524 | AM_RANGE(0x0000, 0x1fff) AM_ROM |
| 466 | 525 | AM_RANGE(0x3000, 0x37ff) AM_RAM AM_MIRROR(0x800) AM_BASE(&z80_ram) |
| r3333 | r3334 | |
| 487 | 546 | static ADDRESS_MAP_START( buggyboy_main, ADDRESS_SPACE_PROGRAM, 16 ) |
| 488 | 547 | AM_RANGE(0x00000, 0x03fff) AM_RAM AM_BASE(&generic_nvram16) AM_SIZE(&generic_nvram_size) |
| 489 | 548 | AM_RANGE(0x04000, 0x04fff) AM_READWRITE(tx1_crtc_r, tx1_crtc_w) |
| 490 | AM_RANGE(0x08000, 0x09fff) AM_RAM | |
| 549 | AM_RANGE(0x08000, 0x09fff) AM_RAM | |
| 491 | 550 | AM_RANGE(0x0a000, 0x0afff) AM_RAM AM_SHARE(1) AM_BASE(&buggyboy_rcram) AM_SIZE(&buggyboy_rcram_size) |
| 492 | 551 | AM_RANGE(0x0b000, 0x0b001) AM_READWRITE(dipswitches_r, z80_busreq_w) |
| 493 | 552 | AM_RANGE(0x0c000, 0x0c001) AM_WRITE(buggyboy_scolst_w) |
| r3333 | r3334 | |
| 502 | 561 | static ADDRESS_MAP_START( buggybjr_main, ADDRESS_SPACE_PROGRAM, 16 ) |
| 503 | 562 | AM_RANGE(0x00000, 0x03fff) AM_RAM AM_BASE(&generic_nvram16) AM_SIZE(&generic_nvram_size) |
| 504 | 563 | AM_RANGE(0x04000, 0x04fff) AM_READWRITE(tx1_crtc_r, tx1_crtc_w) |
| 505 | AM_RANGE(0x08000, 0x08fff) AM_RAM AM_BASE(&buggyb | |
| 564 | AM_RANGE(0x08000, 0x08fff) AM_RAM AM_BASE(&buggyboy_vram) | |
| 506 | 565 | AM_RANGE(0x0a000, 0x0afff) AM_RAM AM_SHARE(1) AM_BASE(&buggyboy_rcram) AM_SIZE(&buggyboy_rcram_size) |
| 507 | 566 | AM_RANGE(0x0b000, 0x0b001) AM_READWRITE(dipswitches_r, z80_busreq_w) |
| 508 | 567 | AM_RANGE(0x0c000, 0x0c001) AM_WRITE(buggyboy_scolst_w) |
| r3333 | r3334 | |
| 528 | 587 | AM_RANGE(0xfc000, 0xfffff) AM_ROM |
| 529 | 588 | ADDRESS_MAP_END |
| 530 | 589 | |
| 531 | ||
| 532 | /* TODO */ | |
| 533 | static READ8_HANDLER( bb_analog_r ) | |
| 534 | { | |
| 535 | if ( offset == 1 ) | |
| 536 | { | |
| 537 | return ((input_port_read(machine, "AN_ACCELERATOR") & 0xf) << 4) | input_port_read(machine, "AN_STEERING"); | |
| 538 | } | |
| 539 | else | |
| 540 | { | |
| 541 | return (input_port_read(machine, "AN_BRAKE") & 0xf) << 4; | |
| 542 | } | |
| 543 | } | |
| 544 | ||
| 545 | static READ8_HANDLER( bbjr_analog_r ) | |
| 546 | { | |
| 547 | if ( offset == 0 ) | |
| 548 | { | |
| 549 | return ((input_port_read(machine, "AN_ACCELERATOR") & 0xf) << 4) | input_port_read(machine, "AN_STEERING"); | |
| 550 | } | |
| 551 | else | |
| 552 | { | |
| 553 | return (input_port_read(machine, "AN_BRAKE") & 0xf) << 4; | |
| 554 | } | |
| 555 | } | |
| 556 | ||
| 557 | 590 | /* Buggy Boy Sound PCB TC033A */ |
| 558 | 591 | static ADDRESS_MAP_START( buggyboy_sound_prg, ADDRESS_SPACE_PROGRAM, 8 ) |
| 559 | 592 | AM_RANGE(0x0000, 0x3fff) AM_ROM |
| r3333 | r3334 | |
| 587 | 620 | |
| 588 | 621 | /************************************* |
| 589 | 622 | * |
| 590 | * Graphics definitions | |
| 591 | * | |
| 592 | *************************************/ | |
| 593 | ||
| 594 | static const gfx_layout char_layout = | |
| 595 | { | |
| 596 | 8,8, | |
| 597 | 2048, | |
| 598 | 2, | |
| 599 | { 0, 8*8*2048 }, | |
| 600 | { 0,1,2,3,4,5,6,7 }, | |
| 601 | { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, | |
| 602 | 8*8 | |
| 603 | }; | |
| 604 | ||
| 605 | static GFXDECODE_START( buggyboy ) | |
| 606 | GFXDECODE_ENTRY( "gfx1", 0, char_layout, 0, 256 ) | |
| 607 | GFXDECODE_END | |
| 608 | ||
| 609 | static GFXDECODE_START( tx1 ) | |
| 610 | GFXDECODE_ENTRY( "gfx1", 0, char_layout, 0, 16 ) | |
| 611 | GFXDECODE_END | |
| 612 | ||
| 613 | ||
| 614 | /************************************* | |
| 615 | * | |
| 616 | 623 | * Sound Hardware |
| 617 | 624 | * |
| 618 | 625 | *************************************/ |
| r3333 | r3334 | |
| 650 | 657 | bb_ym1_b_w, |
| 651 | 658 | }; |
| 652 | 659 | |
| 653 | static WRITE8_HANDLER( tx1_coin_cnt ) | |
| 654 | { | |
| 655 | coin_counter_w(0, data & 0x80); | |
| 656 | coin_counter_w(1, data & 0x40); | |
| 657 | } | |
| 658 | ||
| 659 | static const ppi8255_interface tx1_ppi8255_intf = | |
| 660 | { | |
| 661 | tx1_ppi_porta_r, | |
| 662 | tx1_ppi_portb_r, | |
| 663 | input_port_4_r, | |
| 664 | NULL, | |
| 665 | NULL, | |
| 666 | tx1_coin_cnt | |
| 667 | }; | |
| 668 | ||
| 669 | 660 | static const custom_sound_interface tx1_custom_interface = |
| 670 | 661 | { |
| 671 | 662 | tx1_sh_start, |
| r3333 | r3334 | |
| 673 | 664 | tx1_sh_reset |
| 674 | 665 | }; |
| 675 | 666 | |
| 676 | /* Buggy Boy uses an 8255 PPI instead of YM2149 ports for inputs! */ | |
| 677 | static const ppi8255_interface buggyboy_ppi8255_intf = | |
| 678 | { | |
| 679 | input_port_1_r, | |
| 680 | NULL, | |
| 681 | input_port_2_r, | |
| 682 | NULL, | |
| 683 | NULL, | |
| 684 | NULL | |
| 685 | }; | |
| 686 | ||
| 687 | 667 | static const custom_sound_interface bb_custom_interface = |
| 688 | 668 | { |
| 689 | 669 | buggyboy_sh_start, |
| r3333 | r3334 | |
| 691 | 671 | buggyboy_sh_reset |
| 692 | 672 | }; |
| 693 | 673 | |
| 674 | ||
| 694 | 675 | /************************************* |
| 695 | 676 | * |
| 696 | 677 | * Machine driver |
| r3333 | r3334 | |
| 714 | 695 | MDRV_MACHINE_START(tx1) |
| 715 | 696 | MDRV_NVRAM_HANDLER(generic_0fill) |
| 716 | 697 | |
| 717 | MDRV_DEVICE_ADD( "ppi8255", PPI8255 ) | |
| 718 | MDRV_DEVICE_CONFIG( tx1_ppi8255_intf ) | |
| 698 | MDRV_DEVICE_ADD("ppi8255", PPI8255) | |
| 699 | MDRV_DEVICE_CONFIG(tx1_ppi8255_intf) | |
| 719 | 700 | |
| 720 | MDRV_GFXDECODE(tx1) | |
| 721 | MDRV_PALETTE_LENGTH(256+(256*4)+(2048*4)) | |
| 701 | MDRV_PALETTE_LENGTH(256) | |
| 722 | 702 | MDRV_PALETTE_INIT(tx1) |
| 723 | 703 | MDRV_VIDEO_EOF(tx1) |
| 724 | 704 | |
| r3333 | r3334 | |
| 726 | 706 | |
| 727 | 707 | MDRV_SCREEN_ADD("left", RASTER) |
| 728 | 708 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 729 | MDRV_SCREEN_REFRESH_RATE(60) | |
| 730 | 709 | MDRV_SCREEN_RAW_PARAMS(TX1_PIXEL_CLOCK, TX1_HTOTAL, TX1_HBEND, TX1_HBSTART, TX1_VTOTAL, TX1_VBEND, TX1_VBSTART) |
| 731 | 710 | |
| 732 | 711 | MDRV_SCREEN_ADD("center", RASTER) |
| r3333 | r3334 | |
| 772 | 751 | MDRV_MACHINE_START(buggyboy) |
| 773 | 752 | MDRV_NVRAM_HANDLER(generic_0fill) |
| 774 | 753 | |
| 775 | MDRV_DEVICE_ADD( "ppi8255", PPI8255 ) | |
| 776 | MDRV_DEVICE_CONFIG( buggyboy_ppi8255_intf ) | |
| 754 | MDRV_DEVICE_ADD("ppi8255", PPI8255) | |
| 755 | MDRV_DEVICE_CONFIG(buggyboy_ppi8255_intf) | |
| 777 | 756 | |
| 778 | MDRV_GFXDECODE(buggyboy) | |
| 779 | 757 | MDRV_DEFAULT_LAYOUT(layout_triphsxs) |
| 780 | 758 | |
| 781 | 759 | MDRV_SCREEN_ADD("left", RASTER) |
| r3333 | r3334 | |
| 790 | 768 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 791 | 769 | MDRV_SCREEN_RAW_PARAMS(BB_PIXEL_CLOCK, BB_HTOTAL, BB_HBEND, BB_HBSTART, BB_VTOTAL, BB_VBEND, BB_VBSTART) |
| 792 | 770 | |
| 793 | MDRV_PALETTE_LENGTH(256 | |
| 771 | MDRV_PALETTE_LENGTH(256 | |
| 794 | 772 | MDRV_PALETTE_INIT(buggyboy) |
| 795 | 773 | MDRV_VIDEO_START(buggyboy) |
| 796 | 774 | MDRV_VIDEO_UPDATE(buggyboy) |
| r3333 | r3334 | |
| 830 | 808 | MDRV_MACHINE_START(buggybjr) |
| 831 | 809 | MDRV_NVRAM_HANDLER(generic_0fill) |
| 832 | 810 | |
| 833 | ||
| 834 | 811 | MDRV_SCREEN_ADD("main", RASTER) |
| 835 | 812 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 836 | 813 | #if 0 |
| r3333 | r3334 | |
| 842 | 819 | MDRV_SCREEN_VISIBLE_AREA(0, 255, 0, 239) |
| 843 | 820 | #endif |
| 844 | 821 | |
| 845 | MDRV_PALETTE_LENGTH(512) | |
| 846 | MDRV_PALETTE_INIT(buggybjr) | |
| 822 | MDRV_PALETTE_LENGTH(256) | |
| 823 | MDRV_PALETTE_INIT(buggyboy) | |
| 847 | 824 | MDRV_VIDEO_START(buggybjr) |
| 848 | 825 | MDRV_VIDEO_UPDATE(buggybjr) |
| 849 | 826 | MDRV_VIDEO_EOF(buggyboy) |
| r3333 | r3334 | |
| 865 | 842 | MDRV_SOUND_ROUTE(1, "frontright", 0.2) |
| 866 | 843 | MACHINE_DRIVER_END |
| 867 | 844 | |
| 845 | ||
| 868 | 846 | /************************************* |
| 869 | 847 | * |
| 870 | 848 | * ROM definition(s) |
| r3333 | r3334 | |
| 875 | 853 | ROM_REGION( 0x100000, "main", 0 ) |
| 876 | 854 | ROM_LOAD16_BYTE( "tx1_1c.ic22", 0xf0000, 0x4000, CRC(eedcee83) SHA1(7fa0590b142fb13c6562126a9bdd5a1e032880c7) ) |
| 877 | 855 | ROM_LOAD16_BYTE( "tx1_2c.ic29", 0xf0001, 0x4000, CRC(294bf5bf) SHA1(02b425caba8a187c58211bab27988205eb044558) ) |
| 878 | ||
| 879 | 856 | ROM_LOAD16_BYTE( "tx1_4c.ic54", 0xf8001, 0x4000, CRC(15bb8ef2) SHA1(83968f010ec555fcd0548a80562fb23a892b5afb) ) |
| 880 | 857 | ROM_LOAD16_BYTE( "tx1_3c.ic45", 0xf8000, 0x4000, CRC(21a8aa55) SHA1(21bc4adefb22a95fcd7a4e305bf0b05e2cb34129) ) |
| 881 | 858 | |
| r3333 | r3334 | |
| 894 | 871 | ROM_LOAD( "8411-136027-157.11", 0x00000, 0x2000, CRC(10ae3075) SHA1(69c5f62f2473aba848383eed3cecf15e273d86ca) ) |
| 895 | 872 | |
| 896 | 873 | /* 8x8 characters */ |
| 897 | ROM_REGION( 0x20000, "gfx1", | |
| 874 | ROM_REGION( 0x20000, "gfx1", 0 | |
| 898 | 875 | ROM_LOAD( "tx1_21a.ic204", 0x0000, 0x4000, CRC(cd3441ad) SHA1(8e6597b3177b8aaa34ed3373d85fc4b6231e1333) ) |
| 899 | 876 | ROM_LOAD( "tx1_20a.ic174", 0x4000, 0x4000, CRC(dbe595fc) SHA1(1ed2f775f0a1b46a2ffbc056eb4ef732ed546d3c) ) |
| 900 | 877 | |
| r3333 | r3334 | |
| 902 | 879 | ROM_REGION( 0x40000, "gfx2", 0 ) |
| 903 | 880 | ROM_LOAD( "tx1_16b.ic203", 0x0000, 0x4000, CRC(1141c965) SHA1(4b90c1428bcbd72d0449c064856a5596269b3fc6) ) |
| 904 | 881 | ROM_LOAD( "tx1_18b.ic258", 0x4000, 0x4000, NO_DUMP ) |
| 882 | ROM_LOAD( "tx1_15b.ic173", 0x8000, 0x4000, CRC(30d1a8d5) SHA1(b4c585b7b8a8920bb3949d643e9e10c17d4009a0) ) | |
| 883 | ROM_LOAD( "tx1_17b.ic232", 0xc000, 0x4000, CRC(364bb354) SHA1(a26581ca1088b979285471e2c6595048df84d75e) ) | |
| 905 | 884 | |
| 906 | /* 8x8 object chunks */ | |
| 907 | ROM_REGION( 0x40000, "gfx3", 0 ) | |
| 908 | ROM_LOAD( "tx1_15b.ic173", 0x0000, 0x4000, CRC(30d1a8d5) SHA1(b4c585b7b8a8920bb3949d643e9e10c17d4009a0) ) | |
| 909 | ROM_LOAD( "tx1_17b.ic232", 0x4000, 0x4000, CRC(364bb354) SHA1(a26581ca1088b979285471e2c6595048df84d75e) ) | |
| 910 | ||
| 911 | 885 | /* Road LUTs */ |
| 912 | ROM_REGION( 0x40000, "gfx | |
| 886 | ROM_REGION( 0x40000, "gfx3", 0 ) | |
| 913 | 887 | ROM_LOAD( "tx1_5a.ic56", 0x0000, 0x2000, CRC(5635b8c1) SHA1(5cc9437a2ff0843f1917f2451852d4561c240b24) ) |
| 914 | 888 | ROM_LOAD( "tx1_6a.ic66", 0x2000, 0x2000, CRC(03d83cf8) SHA1(5c0cfc6bf02ad2b3f37e1ceb493f69eb9829ab1e) ) |
| 915 | 889 | ROM_LOAD( "tx1_7a.ic76", 0x4000, 0x2000, CRC(ad56013a) SHA1(ae3a91f58f30daff334754476db33ad1d12569fc) ) |
| r3333 | r3334 | |
| 965 | 939 | ROM_LOAD( "xb10.ic40", 0x1300, 0x200, CRC(93deb894) SHA1(5ae9a21298c836fe649a52f3df2b4067f9012b91) ) |
| 966 | 940 | ROM_LOAD( "xb11.ic49", 0x1500, 0x200, CRC(aa5ed232) SHA1(f33e7bc2dd33ac6d75fb06b93c4dd58e5d10010d) ) |
| 967 | 941 | |
| 968 | /* Road re | |
| 942 | /* Road stripes | |
| 969 | 943 | ROM_LOAD( "xb12.ic50", 0x1700, 0x200, CRC(6b424cea) SHA1(83127326c20116b0a4be1126e163f9c6755e19dc) ) |
| 970 | ||
| 971 | /* Arithmetic unit instructions */ | |
| 972 | ROM_LOAD16_BYTE( "xb02b.ic223", 0x1800, 0x200, CRC(22c77af6) SHA1(1be8585b95316b4fc5712cdaef699e676320cd4d) ) | |
| 973 | ROM_LOAD16_BYTE( "xb01b.ic213", 0x1801, 0x200, CRC(f6b8b70b) SHA1(b79374acf11d71db1e4ad3c494ac5f500a52677b) ) | |
| 974 | 944 | ROM_END |
| 975 | 945 | |
| 976 | 946 | /* Some PROMs haven't been confirmed to be the same as the Tatsumi set (but are very likely identical) */ |
| r3333 | r3334 | |
| 996 | 966 | ROM_LOAD( "8411-136027-157.11", 0x00000, 0x2000, CRC(10ae3075) SHA1(69c5f62f2473aba848383eed3cecf15e273d86ca) ) |
| 997 | 967 | |
| 998 | 968 | /* 8x8 characters */ |
| 999 | ROM_REGION( 0x20000, "gfx1", | |
| 969 | ROM_REGION( 0x20000, "gfx1", 0 | |
| 1000 | 970 | ROM_LOAD( "8411-136027-156.204", 0x0000, 0x4000, CRC(60f3c616) SHA1(59c4361891e4274e27e6279c919e8fd6803af7cf) ) |
| 1001 | 971 | ROM_LOAD( "8411-136027-155.174", 0x4000, 0x4000, CRC(e59a6b72) SHA1(c10efa77ab421ac60b97227a8d547f50f8415670) ) |
| 1002 | 972 | |
| r3333 | r3334 | |
| 1176 | 1146 | ROM_REGION( 0x10000, "audio", 0 ) |
| 1177 | 1147 | ROM_LOAD( "bug35.11", 0x00000, 0x4000, CRC(7aa16e9e) SHA1(ea54e56270f70351a62a78fa32027bb41ef9861e) ) |
| 1178 | 1148 | |
| 1179 | ROM_REGION( 0x20000, "gfx1", ROMREGION_DISPOSE ) | |
| 1149 | /* 8x8 characters */ | |
| 1150 | ROM_REGION( 0x8000, "gfx1", 0 ) | |
| 1180 | 1151 | ROM_LOAD( "bug34s.46", 0x00000, 0x4000, CRC(8ea8fec4) SHA1(75e67c9a59a86fcdedf2a70fafd303baa552aa18) ) |
| 1181 | 1152 | ROM_LOAD( "bug33s.47", 0x04000, 0x4000, CRC(459c2b03) SHA1(ff62a86195042a349fbe799c638cf590fe9572bb) ) |
| 1182 | 1153 | |
| 1183 | ROM_REGION( 0x40000, "gfx2", ROMREGION_DISPOSE ) | |
| 1184 | ROM_LOAD( "bug26s.147", 0x0000, 0x8000, CRC(14033710) SHA1(e05afeb557ce14055fa8b4f6d8805307feaa1660) ) | |
| 1185 | ROM_LOAD( "bug19s.144", 0x8000, 0x8000, CRC(838e0697) SHA1(0e9aff2c4065d79350ddb55edff57a899c33ef1c) ) | |
| 1154 | /* 8x8 object chunks */ | |
| 1155 | ROM_REGION( 0x40000, "gfx2", 0 ) | |
| 1156 | ROM_LOAD( "bug26s.147", 0x00000, 0x8000, CRC(14033710) SHA1(e05afeb557ce14055fa8b4f6d8805307feaa1660) ) | |
| 1157 | ROM_LOAD( "bug19s.144", 0x08000, 0x8000, CRC(838e0697) SHA1(0e9aff2c4065d79350ddb55edff57a899c33ef1c) ) | |
| 1158 | ROM_LOAD( "bug28s.146", 0x10000, 0x8000, CRC(8b47d227) SHA1(a3e57594ad0085e8b1bd327c580eb36237f3e3d2) ) | |
| 1159 | ROM_LOAD( "bug21s.143", 0x18000, 0x8000, CRC(876a5666) SHA1(db485cdf35f63c080c919ee86374f63e577092c3) ) | |
| 1160 | ROM_LOAD( "bug30s.145", 0x20000, 0x8000, CRC(11d8e2a8) SHA1(9bf198229a12d331e8e7352b7ee3f39f6891f517) ) | |
| 1161 | ROM_LOAD( "bug23s.142", 0x28000, 0x8000, CRC(015db5d8) SHA1(39ef8b44f2eb9399fb1555cffa6763e06d59c181) ) | |
| 1186 | 1162 | |
| 1187 | ROM_REGION( 0x40000, "gfx3", ROMREGION_DISPOSE ) | |
| 1188 | ROM_LOAD( "bug28s.146", 0x0000, 0x8000, CRC(8b47d227) SHA1(a3e57594ad0085e8b1bd327c580eb36237f3e3d2) ) | |
| 1189 | ROM_LOAD( "bug21s.143", 0x8000, 0x8000, CRC(876a5666) SHA1(db485cdf35f63c080c919ee86374f63e577092c3) ) | |
| 1163 | /* Road */ | |
| 1164 | ROM_REGION( 0x40000, "gfx6", 0 ) | |
| 1165 | ROM_LOAD( "bug11s.225", 0x0000, 0x4000, CRC(771af4e1) SHA1(a42b164dd0567c78c0d308ee48d63e5a284897bb) ) | |
| 1166 | ROM_LOAD( "bb3s", 0x4000, 0x200, CRC(2ab3d5ff) SHA1(9f8359cb4ba2e7d15dbb9dc21cd71c0902cd2153) ) | |
| 1167 | ROM_LOAD( "bb4s", 0x4200, 0x200, CRC(630f68a4) SHA1(d730f050353c688f81d090e33e00cd35e7b7b6fa) ) | |
| 1168 | ROM_LOAD( "bb5s", 0x4400, 0x200, CRC(65925c9e) SHA1(d1ff1cb9f83c09e52a96632945e4edfedc335fd4) ) | |
| 1169 | ROM_LOAD( "bb6.224", 0x4600, 0x200, CRC(ad43e02a) SHA1(c50a398020508f52ddf8d45881f211d17d096fa1) ) | |
| 1190 | 1170 | |
| 1191 | ROM_REGION( 0x40000, "gfx4", ROMREGION_DISPOSE ) | |
| 1192 | ROM_LOAD( "bug30s.145", 0x0000, 0x8000, CRC(11d8e2a8) SHA1(9bf198229a12d331e8e7352b7ee3f39f6891f517) ) | |
| 1193 | ROM_LOAD( "bug23s.142", 0x8000, 0x8000, CRC(015db5d8) SHA1(39ef8b44f2eb9399fb1555cffa6763e06d59c181) ) | |
| 1194 | ||
| 1195 | ROM_REGION( 0x40000, "gfx5", ROMREGION_DISPOSE ) | |
| 1196 | ROM_LOAD( "bug16s.139", 0x0000, 0x8000, CRC(1903a9ad) SHA1(526c404c15e3f04b4afb27dee66e9deb0a6b9704) ) | |
| 1197 | ROM_LOAD( "bug17s.140", 0x8000, 0x8000, CRC(82cabdd4) SHA1(94324fcf83c373621fc40553473ae3cb552ab704) ) | |
| 1198 | ROM_LOAD( "bug18s.141", 0x10000, 0x4000, CRC(67786327) SHA1(32cc1f5bc654497c968ddcd4af29720c6d659482) ) | |
| 1199 | ||
| 1200 | ROM_REGION( 0x40000, "gfx6", 0) | |
| 1201 | ROM_LOAD( "bb3s", 0x000, 0x200, CRC(2ab3d5ff) SHA1(9f8359cb4ba2e7d15dbb9dc21cd71c0902cd2153) ) | |
| 1202 | ROM_LOAD( "bb4s", 0x200, 0x200, CRC(630f68a4) SHA1(d730f050353c688f81d090e33e00cd35e7b7b6fa) ) | |
| 1203 | ROM_LOAD( "bb5s", 0x400, 0x200, CRC(65925c9e) SHA1(d1ff1cb9f83c09e52a96632945e4edfedc335fd4) ) | |
| 1204 | ROM_LOAD( "bug11s.225", 0x1000, 0x4000, CRC(771af4e1) SHA1(a42b164dd0567c78c0d308ee48d63e5a284897bb) ) | |
| 1205 | ||
| 1206 | 1171 | ROM_REGION( 0x10000, "user1", ROMREGION_LE ) |
| 1207 | 1172 | ROM_LOAD16_BYTE( "bug9.138", 0x0000, 0x4000, CRC(7d84135b) SHA1(3c669c4e796e83672aceeb6de1aeea28f9f2fef0) ) |
| 1208 | 1173 | ROM_LOAD16_BYTE( "bug10.95", 0x0001, 0x4000, CRC(b518dd6f) SHA1(7cefa2f9438306c81dc83cd260928c835eb9b712) ) |
| r3333 | r3334 | |
| 1230 | 1195 | ROM_LOAD( "bb8.31", 0x1600, 0x100, CRC(2330ff4f) SHA1(e86eb63ce47572bcbbf325f9bb749d10d96bf2e7) ) |
| 1231 | 1196 | ROM_END |
| 1232 | 1197 | |
| 1198 | ||
| 1233 | 1199 | /************************************* |
| 1234 | 1200 | * |
| 1235 | 1201 | * Game driver(s) |
| 1236 | 1202 | * |
| 1237 | 1203 | *************************************/ |
| 1238 | 1204 | |
| 1239 | GAME( 1983, tx1, 0, tx1, tx1, 0, ROT0, "Tatsumi", "TX-1", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_NOT_WORKING ) | |
| 1240 | GAME( 1983, tx1a, tx1, tx1, tx1a, 0, ROT0, "Tatsumi", "TX-1 (Atari/Namco/Taito license)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_NOT_WORKING ) | |
| 1241 | GAME( 1985, buggyboy, buggybjr, buggyboy, buggyboy, 0, ROT0, "Tatsumi", "Buggy Boy/Speed Buggy (Cockpit)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_NOT_WORKING ) | |
| 1205 | GAME( 1983, tx1, 0, tx1, tx1, 0, ROT0, "Tatsumi", "TX-1", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 1206 | GAME( 1983, tx1a, tx1, tx1, tx1a, 0, ROT0, "Tatsumi", "TX-1 (Atari/Namco/Taito license)", GAME_IMPERFECT_SOUND ) | |
| 1207 | GAME( 1985, buggyboy, buggybjr, buggyboy, buggyboy, 0, ROT0, "Tatsumi", "Buggy Boy/Speed Buggy (Cockpit)", GAME_NOT_WORKING ) | |
| 1242 | 1208 | GAME( 1986, buggybjr, 0, buggybjr, buggybjr, 0, ROT0, "Tatsumi", "Buggy Boy Junior/Speed Buggy (Upright)", 0 ) |
| r3333 | r3334 | |
|---|---|---|
| 250 | 250 | Input Ports |
| 251 | 251 | ***************************************************************************/ |
| 252 | 252 | |
| 253 | INPUT_PORTS_START( galaxi ) | |
| 253 | static INPUT_PORTS_START( galaxi ) | |
| 254 | 254 | |
| 255 | 255 | PORT_START("INPUTS") |
| 256 | 256 | PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Hold 1") PORT_CODE(KEYCODE_Z) |
| r3333 | r3334 | |
| 272 | 272 | |
| 273 | 273 | INPUT_PORTS_END |
| 274 | 274 | |
| 275 | INPUT_PORTS_START( magjoker ) | |
| 275 | static INPUT_PORTS_START( magjoker ) | |
| 276 | 276 | |
| 277 | 277 | PORT_START("INPUTS") |
| 278 | 278 | PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Hold 1") PORT_CODE(KEYCODE_Z) |
| r3333 | r3334 | |
|---|---|---|
| 367 | 367 | ROM_LOAD( name, 0x00000, 0x80000, hash ) \ |
| 368 | 368 | ROM_RELOAD( 0x10000, 0x80000 ) |
| 369 | 369 | |
| 370 | #define NEO_BIOS_AUDIO_ENCRYPTED_512K(name, hash) \ | |
| 371 | NEOGEO_BIOS \ | |
| 372 | ROM_REGION( 0x20000, "audiobios", 0 ) \ | |
| 373 | ROM_LOAD( "sm1.sm1", 0x00000, 0x20000, CRC(97cf998b) SHA1(977387a7c76ef9b21d0b01fa69830e949a9a9626) ) \ | |
| 374 | ROM_REGION( 0x90000, "audio", ROMREGION_ERASEFF ) \ | |
| 375 | ROM_REGION( 0x80000, "audiocrypt", 0 ) \ | |
| 376 | ROM_LOAD( name, 0x00000, 0x80000, hash ) \ | |
| 370 | 377 | |
| 378 | #define NEO_BIOS_AUDIO_ENCRYPTED_256K(name, hash) \ | |
| 379 | NEOGEO_BIOS \ | |
| 380 | ROM_REGION( 0x20000, "audiobios", 0 ) \ | |
| 381 | ROM_LOAD( "sm1.sm1", 0x00000, 0x20000, CRC(97cf998b) SHA1(977387a7c76ef9b21d0b01fa69830e949a9a9626) ) \ | |
| 382 | ROM_REGION( 0x90000, "audio", ROMREGION_ERASEFF ) \ | |
| 383 | ROM_REGION( 0x80000, "audiocrypt", 0 ) \ | |
| 384 | ROM_LOAD( name, 0x00000, 0x40000, hash ) \ | |
| 385 | ||
| 386 | #define NEO_BIOS_AUDIO_ENCRYPTED_128K(name, hash) \ | |
| 387 | NEOGEO_BIOS \ | |
| 388 | ROM_REGION( 0x20000, "audiobios", 0 ) \ | |
| 389 | ROM_LOAD( "sm1.sm1", 0x00000, 0x20000, CRC(97cf998b) SHA1(977387a7c76ef9b21d0b01fa69830e949a9a9626) ) \ | |
| 390 | ROM_REGION( 0x90000, "audio", ROMREGION_ERASEFF ) \ | |
| 391 | ROM_REGION( 0x80000, "audiocrypt", 0 ) \ | |
| 392 | ROM_LOAD( name, 0x00000, 0x20000, hash ) \ | |
| 393 | ||
| 394 | ||
| 371 | 395 | #define NO_DELTAT_REGION |
| 372 | 396 | |
| 373 | 397 | |
| r3333 | r3334 | |
| 4998 | 5022 | ROM_REGION( 0x20000, "fixedbios", 0 ) |
| 4999 | 5023 | ROM_LOAD( "sfix.sfx", 0x000000, 0x20000, CRC(354029fc) SHA1(4ae4bf23b4c2acff875775d4cbff5583893ce2a1) ) |
| 5000 | 5024 | |
| 5001 | /* The M1 ROM is encrypted, we load it here for reference and replace it with a decrypted version */ | |
| 5002 | ROM_REGION( 0x40000, "audiocrypt", 0 ) | |
| 5003 | ROM_LOAD( "257-m1.bin", 0x00000, 0x40000, CRC(4b749113) SHA1(2af2361146edd0ce3966614d90165a5c1afb8de4) ) | |
| 5004 | NEO_BIOS_AUDIO_256K( "257-m1_decrypted.bin", CRC(d404db70) SHA1(8cd1f3e140a9a367de23544e76371b0491287909) ) | |
| 5025 | /* Encrypted */ | |
| 5026 | NEO_BIOS_AUDIO_ENCRYPTED_256K( "257-m1.bin", CRC(4b749113) SHA1(2af2361146edd0ce3966614d90165a5c1afb8de4) ) | |
| 5005 | 5027 | |
| 5006 | 5028 | ROM_REGION( 0x1000000, "ym", 0 ) |
| 5007 | 5029 | ROM_LOAD( "257-v1.bin", 0x000000, 0x400000, CRC(17cde847) SHA1(4bcc0205b70dc6d9216b29025450c9c5b08cb65d) ) |
| r3333 | r3334 | |
| 5035 | 5057 | ROM_REGION( 0x20000, "fixedbios", 0 ) |
| 5036 | 5058 | ROM_LOAD( "sfix.sfx", 0x000000, 0x20000, CRC(354029fc) SHA1(4ae4bf23b4c2acff875775d4cbff5583893ce2a1) ) |
| 5037 | 5059 | |
| 5038 | /* The M1 ROM is encrypted, we load it here for reference and replace it with a decrypted version */ | |
| 5039 | ROM_REGION( 0x40000, "audiocrypt", 0 ) | |
| 5040 | ROM_LOAD( "257-m1.bin", 0x00000, 0x40000, CRC(4b749113) SHA1(2af2361146edd0ce3966614d90165a5c1afb8de4) ) | |
| 5041 | NEO_BIOS_AUDIO_256K( "257-m1_decrypted.bin", CRC(d404db70) SHA1(8cd1f3e140a9a367de23544e76371b0491287909) ) | |
| 5060 | /* Encrypted */ | |
| 5061 | NEO_BIOS_AUDIO_ENCRYPTED_256K( "257-m1.bin", CRC(4b749113) SHA1(2af2361146edd0ce3966614d90165a5c1afb8de4) ) | |
| 5042 | 5062 | |
| 5043 | 5063 | ROM_REGION( 0x1000000, "ym", 0 ) |
| 5044 | 5064 | ROM_LOAD( "257-v1.bin", 0x000000, 0x400000, CRC(17cde847) SHA1(4bcc0205b70dc6d9216b29025450c9c5b08cb65d) ) |
| r3333 | r3334 | |
| 5204 | 5224 | ROM_REGION( 0x20000, "fixedbios", 0 ) |
| 5205 | 5225 | ROM_LOAD( "sfix.sfx", 0x000000, 0x20000, CRC(354029fc) SHA1(4ae4bf23b4c2acff875775d4cbff5583893ce2a1) ) |
| 5206 | 5226 | |
| 5207 | /* The M1 ROM is encrypted, we load it here for reference and replace it with a decrypted version */ | |
| 5208 | ROM_REGION( 0x40000, "audiocrypt", 0 ) | |
| 5209 | ROM_LOAD( "265-262-m1.bin", 0x00000, 0x40000, CRC(a7f8119f) SHA1(71805b39b8b09c32425cf39f9de59b2f755976c2) ) /* yes it really does have a strange name */ | |
| 5210 | /* Decrypted */ | |
| 5211 | NEO_BIOS_AUDIO_256K( "265-262_decrypted-m1.bin", CRC(4bcc537b) SHA1(9fcf1342bcd53d5eec12c46ee41a51bf543256c2) ) | |
| 5227 | /* Encrypted */ | |
| 5228 | NEO_BIOS_AUDIO_ENCRYPTED_256K( "265-262-m1.bin", CRC(a7f8119f) SHA1(71805b39b8b09c32425cf39f9de59b2f755976c2) ) /* yes it really does have a strange name */ | |
| 5212 | 5229 | |
| 5213 | 5230 | ROM_REGION( 0x1000000, "ym", 0 ) |
| 5214 | 5231 | ROM_LOAD( "262-v1-08-e0.bin", 0x000000, 0x400000, CRC(83d49ecf) SHA1(2f2c116e45397652e77fcf5d951fa5f71b639572) ) |
| r3333 | r3334 | |
| 5243 | 5260 | ROM_REGION( 0x20000, "fixedbios", 0 ) |
| 5244 | 5261 | ROM_LOAD( "sfix.sfx", 0x000000, 0x20000, CRC(354029fc) SHA1(4ae4bf23b4c2acff875775d4cbff5583893ce2a1) ) |
| 5245 | 5262 | |
| 5246 | /* The M1 ROM is encrypted, we load it here for reference and replace it with a decrypted version */ | |
| 5247 | ROM_REGION( 0x40000, "audiocrypt", 0 ) | |
| 5248 | ROM_LOAD( "265-262-m1.bin", 0x00000, 0x40000, CRC(a7f8119f) SHA1(71805b39b8b09c32425cf39f9de59b2f755976c2) ) /* yes it really does have a strange name */ | |
| 5249 | /* Decrypted */ | |
| 5250 | NEO_BIOS_AUDIO_256K( "265-262_decrypted-m1.bin", CRC(4bcc537b) SHA1(9fcf1342bcd53d5eec12c46ee41a51bf543256c2) ) | |
| 5263 | /* Encrypted */ | |
| 5264 | NEO_BIOS_AUDIO_ENCRYPTED_256K( "265-262-m1.bin", CRC(a7f8119f) SHA1(71805b39b8b09c32425cf39f9de59b2f755976c2) ) /* yes it really does have a strange name */ | |
| 5251 | 5265 | |
| 5252 | 5266 | ROM_REGION( 0x1000000, "ym", 0 ) |
| 5253 | 5267 | ROM_LOAD( "262-v1-08-e0.bin", 0x000000, 0x400000, CRC(83d49ecf) SHA1(2f2c116e45397652e77fcf5d951fa5f71b639572) ) |
| r3333 | r3334 | |
| 5282 | 5296 | ROM_REGION( 0x20000, "fixedbios", 0 ) |
| 5283 | 5297 | ROM_LOAD( "sfix.sfx", 0x000000, 0x20000, CRC(354029fc) SHA1(4ae4bf23b4c2acff875775d4cbff5583893ce2a1) ) |
| 5284 | 5298 | |
| 5285 | /* The M1 ROM is encrypted, we load it here for reference and replace it with a decrypted version */ | |
| 5286 | ROM_REGION( 0x20000, "audiocrypt", 0 ) | |
| 5287 | ROM_LOAD( "263-m1.bin", 0x00000, 0x20000, CRC(46ac8228) SHA1(5aeea221050c98e4bb0f16489ce772bf1c80f787) ) | |
| 5288 | /* Decrypted */ | |
| 5289 | NEO_BIOS_AUDIO_128K( "263-m1_decrypted.bin", CRC(ef5db532) SHA1(4aeba9e206b8f309610eb7e1891644f39aa61830) ) | |
| 5299 | /* Encrypted */ | |
| 5300 | NEO_BIOS_AUDIO_ENCRYPTED_128K( "263-m1.bin", CRC(46ac8228) SHA1(5aeea221050c98e4bb0f16489ce772bf1c80f787) ) | |
| 5290 | 5301 | |
| 5291 | 5302 | ROM_REGION( 0x1000000, "ym", 0 ) |
| 5292 | 5303 | ROM_LOAD( "263-v1.bin", 0x000000, 0x800000, CRC(01e9b9cd) SHA1(0b045c2999449f7dab5ae8a42e957d5b6650431e) ) |
| r3333 | r3334 | |
| 5313 | 5324 | NEO_SFIX_128K( "263-s1p.bin", CRC(07ff87ce) SHA1(96ddb439de2a26bf9869015d7fb19129d40f3fd9) ) |
| 5314 | 5325 | |
| 5315 | 5326 | /* bootleg: non-encrypted m1 */ |
| 5316 | NEO_BIOS_AUDIO_128K( "263-m1_ | |
| 5327 | NEO_BIOS_AUDIO_128K( "263-m1_boo | |
| 5317 | 5328 | |
| 5318 | 5329 | ROM_REGION( 0x1000000, "ym", 0 ) |
| 5319 | 5330 | /* bootleg: non-encrypted samples */ |
| r3333 | r3334 | |
| 5344 | 5355 | ROM_REGION( 0x20000, "fixedbios", 0 ) |
| 5345 | 5356 | ROM_LOAD( "sfix.sfx", 0x000000, 0x20000, CRC(354029fc) SHA1(4ae4bf23b4c2acff875775d4cbff5583893ce2a1) ) |
| 5346 | 5357 | |
| 5347 | ROM_REGION( 0x20000, "audiocrypt", 0 ) | |
| 5348 | /* Encrypted, we load it here for reference and replace with decrypted ROM */ | |
| 5349 | ROM_LOAD( "264-m1.bin", 0x00000, 0x20000, CRC(4dbd7b43) SHA1(6b63756b0d2d30bbf13fbd219833c81fd060ef96) ) | |
| 5350 | /* Decrypted */ | |
| 5351 | NEO_BIOS_AUDIO_128K( "264-m1_decrypted.bin", CRC(c5d36af9) SHA1(320739d0cfa6cc84455ae1f7b1f9cdab3c018933) ) | |
| 5358 | /* Encrypted */ | |
| 5359 | NEO_BIOS_AUDIO_ENCRYPTED_128K( "264-m1.bin", CRC(4dbd7b43) SHA1(6b63756b0d2d30bbf13fbd219833c81fd060ef96) ) | |
| 5352 | 5360 | |
| 5353 | 5361 | ROM_REGION( 0x1000000, "ym", 0 ) |
| 5354 | 5362 | /* Encrypted */ |
| r3333 | r3334 | |
| 5382 | 5390 | ROM_REGION( 0x20000, "fixedbios", 0 ) |
| 5383 | 5391 | ROM_LOAD( "sfix.sfx", 0x000000, 0x20000, CRC(354029fc) SHA1(4ae4bf23b4c2acff875775d4cbff5583893ce2a1) ) |
| 5384 | 5392 | |
| 5385 | ROM_REGION( 0x20000, "audiocrypt", 0 ) | |
| 5386 | /* Encrypted, we load it here for reference and replace with decrypted ROM */ | |
| 5387 | ROM_LOAD( "265-m1.bin", 0x00000, 0x20000, CRC(85aaa632) SHA1(744fba4ca3bc3a5873838af886efb97a8a316104) ) | |
| 5388 | /* Decrypted */ | |
| 5389 | NEO_BIOS_AUDIO_128K( "265-m1_decrypted.bin", CRC(1c661a4b) SHA1(4e5aa862a0a182a806d538996ddc68d9f2dffaf7) ) | |
| 5393 | /* Encrypted */ | |
| 5394 | NEO_BIOS_AUDIO_ENCRYPTED_128K( "265-m1.bin", CRC(85aaa632) SHA1(744fba4ca3bc3a5873838af886efb97a8a316104) ) | |
| 5390 | 5395 | |
| 5391 | 5396 | ROM_REGION( 0x1000000, "ym", 0 ) |
| 5392 | 5397 | /* Encrypted */ |
| r3333 | r3334 | |
| 5414 | 5419 | |
| 5415 | 5420 | NEO_SFIX_128K( "265-s1p.bin", CRC(595e0006) SHA1(ff086bdaa6f40e9ad963e1100a27f44618d684ed) ) |
| 5416 | 5421 | |
| 5417 | ROM_REGION( 0x20000, "audiocrypt", 0 ) | |
| 5418 | /* Encrypted, we load it here for reference and replace with decrypted ROM */ | |
| 5419 | ROM_LOAD( "265-m1.bin", 0x00000, 0x20000, CRC(85aaa632) SHA1(744fba4ca3bc3a5873838af886efb97a8a316104) ) | |
| 5420 | /* Decrypted */ | |
| 5421 | NEO_BIOS_AUDIO_128K( "265-m1_decrypted.bin", CRC(1c661a4b) SHA1(4e5aa862a0a182a806d538996ddc68d9f2dffaf7) ) | |
| 5422 | /* Correct To Use Decrypted? */ | |
| 5423 | NEO_BIOS_AUDIO_128K( "265-m1_bootleg.bin", CRC(1c661a4b) SHA1(4e5aa862a0a182a806d538996ddc68d9f2dffaf7) ) | |
| 5422 | 5424 | |
| 5423 | 5425 | ROM_REGION( 0x1000000, "ym", 0 ) |
| 5424 | 5426 | /* Encrypted */ |
| r3333 | r3334 | |
| 5446 | 5448 | |
| 5447 | 5449 | NEO_SFIX_128K( "265-s1pa.bin", CRC(1a3ed064) SHA1(9749bb55c750e6b65d651998c2649c5fb68db68e)) |
| 5448 | 5450 | |
| 5449 | ROM_REGION( 0x20000, "audiocrypt", 0 ) | |
| 5450 | /* Encrypted, we load it here for reference and replace with decrypted ROM */ | |
| 5451 | ROM_LOAD( "265-m1.bin", 0x00000, 0x20000, CRC(85aaa632) SHA1(744fba4ca3bc3a5873838af886efb97a8a316104) ) | |
| 5452 | /* Decrypted */ | |
| 5453 | NEO_BIOS_AUDIO_128K( "265-m1_decrypted.bin", CRC(1c661a4b) SHA1(4e5aa862a0a182a806d538996ddc68d9f2dffaf7) ) | |
| 5451 | /* Correct To Use Decrypted? */ | |
| 5452 | NEO_BIOS_AUDIO_128K( "265-m1_bootleg.bin", CRC(1c661a4b) SHA1(4e5aa862a0a182a806d538996ddc68d9f2dffaf7) ) | |
| 5454 | 5453 | |
| 5455 | 5454 | ROM_REGION( 0x1000000, "ym", 0 ) |
| 5456 | 5455 | /* Encrypted */ |
| r3333 | r3334 | |
| 5479 | 5478 | NEO_SFIX_128K( "kf02m-s1.bin", CRC(348d6f2c) SHA1(586da8a936ebbb71af324339a4b60ec91dfa0990) ) |
| 5480 | 5479 | |
| 5481 | 5480 | /* Decrypted */ |
| 5482 | NEO_BIOS_AUDIO_128K( "265-m1_ | |
| 5481 | NEO_BIOS_AUDIO_128K( "265-m1_boo | |
| 5483 | 5482 | |
| 5484 | 5483 | ROM_REGION( 0x1000000, "ym", 0 ) |
| 5485 | 5484 | /* Encrypted */ |
| r3333 | r3334 | |
| 5506 | 5505 | NEO_SFIX_128K( "k2k2m2s1.bin", CRC(446e74c5) SHA1(efc2afb26578bad9eb21659c70eb0f827d6d1ef6) ) |
| 5507 | 5506 | |
| 5508 | 5507 | /* Decrypted */ |
| 5509 | NEO_BIOS_AUDIO_128K( "265-m1_ | |
| 5508 | NEO_BIOS_AUDIO_128K( "265-m1_boo | |
| 5510 | 5509 | |
| 5511 | 5510 | ROM_REGION( 0x1000000, "ym", 0 ) |
| 5512 | 5511 | /* Encrypted */ |
| r3333 | r3334 | |
| 5538 | 5537 | ROM_REGION( 0x20000, "fixedbios", 0 ) |
| 5539 | 5538 | ROM_LOAD( "sfix.sfx", 0x000000, 0x20000, CRC(354029fc) SHA1(4ae4bf23b4c2acff875775d4cbff5583893ce2a1) ) |
| 5540 | 5539 | |
| 5541 | ROM_REGION( 0x20000, "audiocrypt", 0 ) | |
| 5542 | /* Encrypted, we load it here for reference and replace with decrypted ROM */ | |
| 5543 | ROM_LOAD( "266-m1.bin", 0x00000, 0x20000, CRC(456c3e6c) SHA1(5a07d0186198a18d2dda1331093cf29b0b9b2984) ) | |
| 5544 | /* Decrypted */ | |
| 5545 | NEO_BIOS_AUDIO_128K( "266-m1_decrypted.bin", CRC(d2f3742d) SHA1(dd42f8a301f07e079fbc2bfd23e788baa03ca72d) ) | |
| 5540 | /* Encrypted */ | |
| 5541 | NEO_BIOS_AUDIO_ENCRYPTED_128K( "266-m1.bin", CRC(456c3e6c) SHA1(5a07d0186198a18d2dda1331093cf29b0b9b2984) ) | |
| 5546 | 5542 | |
| 5547 | 5543 | ROM_REGION( 0x1000000, "ym", 0 ) |
| 5548 | 5544 | /* Encrypted */ |
| r3333 | r3334 | |
| 5575 | 5571 | ROM_REGION( 0x20000, "fixedbios", 0 ) |
| 5576 | 5572 | ROM_LOAD( "sfix.sfx", 0x000000, 0x20000, CRC(354029fc) SHA1(4ae4bf23b4c2acff875775d4cbff5583893ce2a1) ) |
| 5577 | 5573 | |
| 5578 | ROM_REGION( 0x80000, "audiocrypt", 0 ) | |
| 5579 | /* Encrypted, we load it here for reference and replace with decrypted ROM */ | |
| 5580 | ROM_LOAD( "267-m1.bin", 0x00000, 0x80000, CRC(c7853ccd) SHA1(1b7a4c5093cf0fe3861ce44fd1d3b30c71ad0abe) ) | |
| 5581 | /* Decrypted */ | |
| 5582 | NEO_BIOS_AUDIO_512K( "267-m1_decrypted.bin", CRC(d58eaa8e) SHA1(4c4faf1da671a41b4d854790eb623a40cb35f256) ) | |
| 5574 | /* Encrypted */ | |
| 5575 | NEO_BIOS_AUDIO_ENCRYPTED_512K( "267-m1.bin", CRC(c7853ccd) SHA1(1b7a4c5093cf0fe3861ce44fd1d3b30c71ad0abe) ) | |
| 5583 | 5576 | |
| 5584 | 5577 | ROM_REGION( 0x400000, "ym", 0 ) |
| 5585 | 5578 | /* Encrypted */ |
| r3333 | r3334 | |
| 5606 | 5599 | ROM_REGION( 0x20000, "fixedbios", 0 ) |
| 5607 | 5600 | ROM_LOAD( "sfix.sfx", 0x000000, 0x20000, CRC(354029fc) SHA1(4ae4bf23b4c2acff875775d4cbff5583893ce2a1) ) |
| 5608 | 5601 | |
| 5609 | ROM_REGION( 0x80000, "audiocrypt", 0 ) | |
| 5610 | /* Encrypted, we load it here for reference and replace with decrypted ROM */ | |
| 5611 | ROM_LOAD( "268-m1.bin", 0x00000, 0x80000, CRC(4a5a6e0e) SHA1(df0f660f2465e1db7be5adfcaf5e88ad61a74a42) ) | |
| 5612 | /* Decrypted */ | |
| 5613 | NEO_BIOS_AUDIO_64K( "268-m1_decrypted.bin", CRC(3c0655a7) SHA1(ae839d4c2b87a7aa3dd8e5caddc43eb75ee9b732) ) /* not a 100% match for encrypted version */ | |
| 5602 | /* Encrypted */ | |
| 5603 | NEO_BIOS_AUDIO_ENCRYPTED_512K( "268-m1.bin", CRC(4a5a6e0e) SHA1(df0f660f2465e1db7be5adfcaf5e88ad61a74a42) ) | |
| 5614 | 5604 | |
| 5615 | 5605 | ROM_REGION( 0x1000000, "ym", 0 ) |
| 5616 | 5606 | /* Encrypted */ |
| r3333 | r3334 | |
| 5644 | 5634 | ROM_REGION( 0x20000, "fixedbios", 0 ) |
| 5645 | 5635 | ROM_LOAD( "sfix.sfx", 0x000000, 0x20000, CRC(354029fc) SHA1(4ae4bf23b4c2acff875775d4cbff5583893ce2a1) ) |
| 5646 | 5636 | |
| 5647 | ROM_REGION( 0x80000, "audiocrypt", 0 ) | |
| 5648 | /* Encrypted, we load it here for reference and replace with decrypted ROM */ | |
| 5649 | ROM_LOAD( "268-m1h.bin", 0x00000, 0x80000, CRC(4a5a6e0e) SHA1(df0f660f2465e1db7be5adfcaf5e88ad61a74a42) ) /* Same as MVS above, but different label */ | |
| 5650 | /* Decrypted */ | |
| 5651 | NEO_BIOS_AUDIO_64K( "268-m1_decrypted.bin", CRC(3c0655a7) SHA1(ae839d4c2b87a7aa3dd8e5caddc43eb75ee9b732) ) /* not a 100% match for encrypted version */ | |
| 5637 | /* Encrypted */ | |
| 5638 | NEO_BIOS_AUDIO_ENCRYPTED_512K( "268-m1h.bin", CRC(4a5a6e0e) SHA1(df0f660f2465e1db7be5adfcaf5e88ad61a74a42) ) /* Same as MVS above, but different label */ | |
| 5652 | 5639 | |
| 5653 | 5640 | ROM_REGION( 0x1000000, "ym", 0 ) |
| 5654 | 5641 | /* Encrypted */ |
| r3333 | r3334 | |
| 5685 | 5672 | /* this contains both an ASIA and JAPAN bios, HARDDIP3 on the PCB selects which to use */ |
| 5686 | 5673 | ROM_LOAD16_WORD_SWAP( "268-bios.bin", 0x00000, 0x80000, CRC(b4590283) SHA1(47047ed5b6062babc0a0bebcc30e4b3f021e115a) ) |
| 5687 | 5674 | |
| 5688 | ROM_REGION( 0x50000, "audio", 0 ) | |
| 5689 | /* Encrypted, we load it here for reference and replace with decrypted ROM */ | |
| 5690 | ROM_LOAD( "268-m1.bin", 0x00000, 0x10000, CRC(58b107d0) SHA1(cc7fe66ff4f9c026cde4df06f86c848eb21f7af8) ) | |
| 5691 | /* Decrypted */ | |
| 5692 | ROM_LOAD( "268-m1_decrypted.bin", 0x00000, 0x10000, CRC(3c0655a7) SHA1(ae839d4c2b87a7aa3dd8e5caddc43eb75ee9b732) ) /* not a 100% match for encrypted version */ | |
| 5693 | ROM_RELOAD( 0x10000, 0x10000 ) | |
| 5694 | 5675 | |
| 5676 | /* Encrypted */ | |
| 5677 | ROM_REGION( 0x80000, "audiocrypt", 0 ) | |
| 5678 | ROM_LOAD( "268-m1.bin", 0x00000, 0x80000, CRC(4a5a6e0e) SHA1(df0f660f2465e1db7be5adfcaf5e88ad61a74a42) ) | |
| 5679 | ROM_REGION( 0x90000, "audio", ROMREGION_ERASEFF ) | |
| 5680 | ||
| 5681 | ||
| 5682 | /* Encrypted */ | |
| 5683 | ||
| 5695 | 5684 | ROM_Y_ZOOM |
| 5696 | 5685 | |
| 5697 | 5686 | ROM_REGION( 0x1000000, "ym", 0 ) |
| r3333 | r3334 | |
| 5721 | 5710 | ROM_REGION( 0x20000, "fixedbios", 0 ) |
| 5722 | 5711 | ROM_LOAD( "sfix.sfx", 0x000000, 0x20000, CRC(354029fc) SHA1(4ae4bf23b4c2acff875775d4cbff5583893ce2a1) ) |
| 5723 | 5712 | |
| 5724 | ROM_REGION( 0x80000, "audiocrypt", 0 ) | |
| 5725 | /* Encrypted, we load it here for reference and replace with decrypted ROM */ | |
| 5726 | ROM_LOAD( "268-m1.bin", 0x00000, 0x80000, CRC(4a5a6e0e) SHA1(df0f660f2465e1db7be5adfcaf5e88ad61a74a42) ) | |
| 5727 | /* Decrypted */ | |
| 5728 | NEO_BIOS_AUDIO_64K( "268-m1_decrypted.bin", CRC(3c0655a7) SHA1(ae839d4c2b87a7aa3dd8e5caddc43eb75ee9b732) ) /* not a 100% match for encrypted version */ | |
| 5713 | /* Correct to use Decrypted Rom? */ | |
| 5714 | NEO_BIOS_AUDIO_64K( "268-m1_bootleg.bin", CRC(3c0655a7) SHA1(ae839d4c2b87a7aa3dd8e5caddc43eb75ee9b732) ) /* not a 100% match for encrypted version */ | |
| 5729 | 5715 | |
| 5730 | 5716 | ROM_REGION( 0x1000000, "ym", 0 ) |
| 5731 | 5717 | /* Encrypted */ |
| r3333 | r3334 | |
| 5759 | 5745 | /* this contains both an ASIA and JAPAN bios, HARDDIP3 on the PCB selects which to use */ |
| 5760 | 5746 | ROM_LOAD16_WORD_SWAP( "sp-4x.sp1", 0x00000, 0x80000, CRC(b4590283) SHA1(47047ed5b6062babc0a0bebcc30e4b3f021e115a) ) |
| 5761 | 5747 | |
| 5762 | ROM_REGION( 0x90000, "audio", 0 ) | |
| 5763 | /* Encrypted, we load it here for reference and replace with decrypted ROM */ | |
| 5748 | /* Encrypted */ | |
| 5749 | ROM_REGION( 0x80000, "audiocrypt", 0 ) | |
| 5764 | 5750 | ROM_LOAD( "269-m1.bin", 0x00000, 0x80000, CRC(f6819d00) SHA1(d3bbe09df502464f104e53501708ac6e2c1832c6) ) |
| 5765 | /* Decrypted */ | |
| 5766 | ROM_LOAD( "269-m1_decrypted.bin", 0x00000, 0x80000, CRC(7b7bf462) SHA1(7466a6962de5242f71b9c52d7bd21a9832115e11) ) | |
| 5767 | ROM_RELOAD( 0x10000, 0x80000 ) | |
| 5751 | ROM_REGION( 0x90000, "audio", ROMREGION_ERASEFF ) | |
| 5768 | 5752 | |
| 5769 | 5753 | ROM_Y_ZOOM |
| 5770 | 5754 | |
| r3333 | r3334 | |
| 5794 | 5778 | /* this contains both an ASIA and JAPAN bios, HARDDIP3 on the PCB selects which to use */ |
| 5795 | 5779 | ROM_LOAD16_WORD_SWAP( "sp-4x.sp1", 0x00000, 0x80000, CRC(b4590283) SHA1(47047ed5b6062babc0a0bebcc30e4b3f021e115a) ) |
| 5796 | 5780 | |
| 5797 | ROM_REGION( 0x90000, "audio", 0 ) | |
| 5798 | /* Encrypted, we load it here for reference and replace with decrypted ROM */ | |
| 5781 | /* Encrypted */ | |
| 5782 | ROM_REGION( 0x80000, "audiocrypt", 0 ) | |
| 5799 | 5783 | ROM_LOAD( "269-m1.bin", 0x00000, 0x80000, CRC(f6819d00) SHA1(d3bbe09df502464f104e53501708ac6e2c1832c6) ) |
| 5800 | /* Decrypted */ | |
| 5801 | ROM_LOAD( "269-m1_decrypted.bin", 0x00000, 0x80000, CRC(7b7bf462) SHA1(7466a6962de5242f71b9c52d7bd21a9832115e11) ) | |
| 5802 | ROM_RELOAD( 0x10000, 0x80000 ) | |
| 5784 | ROM_REGION( 0x90000, "audio", ROMREGION_ERASEFF ) | |
| 5803 | 5785 | |
| 5804 | 5786 | ROM_Y_ZOOM |
| 5805 | 5787 | |
| r3333 | r3334 | |
| 5828 | 5810 | ROM_REGION( 0x20000, "fixedbios", 0 ) |
| 5829 | 5811 | ROM_LOAD( "sfix.sfx", 0x000000, 0x20000, CRC(354029fc) SHA1(4ae4bf23b4c2acff875775d4cbff5583893ce2a1) ) |
| 5830 | 5812 | |
| 5831 | ROM_REGION( 0x80000, "audiocrypt", 0 ) | |
| 5832 | /* Encrypted, we load it here for reference and replace with decrypted ROM */ | |
| 5833 | ROM_LOAD( "269-m1.bin", 0x00000, 0x80000, CRC(f6819d00) SHA1(d3bbe09df502464f104e53501708ac6e2c1832c6) ) | |
| 5834 | /* Decrypted */ | |
| 5835 | NEO_BIOS_AUDIO_512K( "269-m1_decrypted.bin", CRC(7b7bf462) SHA1(7466a6962de5242f71b9c52d7bd21a9832115e11) ) | |
| 5813 | /* Encrypted */ | |
| 5814 | NEO_BIOS_AUDIO_ENCRYPTED_512K( "269-m1.bin", CRC(f6819d00) SHA1(d3bbe09df502464f104e53501708ac6e2c1832c6) ) | |
| 5836 | 5815 | |
| 5837 | 5816 | ROM_REGION( 0x1000000, "ym", 0 ) |
| 5838 | 5817 | /* Encrypted */ |
| r3333 | r3334 | |
| 6020 | 5999 | ROM_REGION( 0x20000, "fixedbios", 0 ) |
| 6021 | 6000 | ROM_LOAD( "sfix.sfx", 0x000000, 0x20000, CRC(354029fc) SHA1(4ae4bf23b4c2acff875775d4cbff5583893ce2a1) ) |
| 6022 | 6001 | |
| 6023 | ROM_REGION( 0x80000, "audiocrypt", 0 ) | |
| 6024 | /* Encrypted, we load it here for reference and replace with decrypted ROM */ | |
| 6025 | ROM_LOAD( "270-m1.bin", 0x00000, 0x80000, CRC(49c9901a) SHA1(2623e9765a0eba58fee2de72851e9dc502344a3d) ) | |
| 6026 | /* Decrypted */ | |
| 6027 | NEO_BIOS_AUDIO_256K( "270-m1_decrypted.bin", CRC(e94a5e2b) SHA1(53ef2ad6583060af69fdde73576e09ba88affa55) ) /* not a 100% match for encrypted version */ | |
| 6002 | /* Encrypted */ | |
| 6003 | NEO_BIOS_AUDIO_ENCRYPTED_512K( "270-m1.bin", CRC(49c9901a) SHA1(2623e9765a0eba58fee2de72851e9dc502344a3d) ) | |
| 6028 | 6004 | |
| 6029 | 6005 | ROM_REGION( 0x1000000, "ym", 0 ) |
| 6030 | 6006 | /* Encrypted */ |
| r3333 | r3334 | |
| 6058 | 6034 | ROM_REGION( 0x20000, "fixedbios", 0 ) |
| 6059 | 6035 | ROM_LOAD( "sfix.sfx", 0x000000, 0x20000, CRC(354029fc) SHA1(4ae4bf23b4c2acff875775d4cbff5583893ce2a1) ) |
| 6060 | 6036 | |
| 6061 | ROM_REGION( 0x80000, "audiocrypt", 0 ) | |
| 6062 | /* Encrypted, we load it here for reference and replace with decrypted ROM */ | |
| 6063 | ROM_LOAD( "270-m1.bin", 0x00000, 0x80000, CRC(49c9901a) SHA1(2623e9765a0eba58fee2de72851e9dc502344a3d) ) | |
| 6064 | /* Decrypted */ | |
| 6065 | NEO_BIOS_AUDIO_256K( "270-m1_decrypted.bin", CRC(e94a5e2b) SHA1(53ef2ad6583060af69fdde73576e09ba88affa55) ) /* not a 100% match for encrypted version */ | |
| 6037 | /* Encrypted */ | |
| 6038 | NEO_BIOS_AUDIO_ENCRYPTED_512K( "270-m1.bin", CRC(49c9901a) SHA1(2623e9765a0eba58fee2de72851e9dc502344a3d) ) | |
| 6066 | 6039 | |
| 6067 | 6040 | ROM_REGION( 0x1000000, "ym", 0 ) |
| 6068 | 6041 | /* Encrypted */ |
| r3333 | r3334 | |
| 6096 | 6069 | ROM_REGION( 0x20000, "fixedbios", 0 ) |
| 6097 | 6070 | ROM_LOAD( "sfix.sfx", 0x000000, 0x20000, CRC(354029fc) SHA1(4ae4bf23b4c2acff875775d4cbff5583893ce2a1) ) |
| 6098 | 6071 | |
| 6099 | ROM_REGION( 0x80000, "audiocrypt", 0 ) | |
| 6100 | /* Encrypted, we load it here for reference and replace with decrypted ROM */ | |
| 6101 | ROM_LOAD( "270-m1.bin", 0x00000, 0x80000, CRC(49c9901a) SHA1(2623e9765a0eba58fee2de72851e9dc502344a3d) ) | |
| 6102 | /* Decrypted */ | |
| 6103 | NEO_BIOS_AUDIO_256K( "270-m1_decrypted.bin", CRC(e94a5e2b) SHA1(53ef2ad6583060af69fdde73576e09ba88affa55) ) /* not a 100% match for encrypted version */ | |
| 6072 | /* 0xf800 area doesn't match encrypted rom */ | |
| 6073 | NEO_BIOS_AUDIO_256K( "270-m1_bootleg.bin", CRC(e94a5e2b) SHA1(53ef2ad6583060af69fdde73576e09ba88affa55) ) /* not a 100% match for encrypted version */ | |
| 6104 | 6074 | |
| 6075 | /* should this set use decrypted roms? */ | |
| 6076 | ||
| 6105 | 6077 | ROM_REGION( 0x1000000, "ym", 0 ) |
| 6106 | 6078 | /* Encrypted */ |
| 6107 | 6079 | ROM_LOAD( "270-v1.bin", 0x000000, 0x800000, CRC(62e434eb) SHA1(1985f5e88f8e866f9683b6cea901aa28c04b80bf) ) |
| r3333 | r3334 | |
| 6135 | 6107 | ROM_REGION16_BE( 0x80000, "mainbios", 0 ) |
| 6136 | 6108 | ROM_LOAD16_WORD_SWAP( "271-bios.bin", 0x00000, 0x080000, CRC(148dd727) SHA1(2cf592a16c7157de02a989675d47965f2b3a44dd) ) // encrypted |
| 6137 | 6109 | |
| 6138 | ROM_REGION( 0x90000, "audio", 0 ) | |
| 6139 | /* Encrypted, we load it here for reference and replace with decrypted ROM */ | |
| 6110 | /* Encrypted */ | |
| 6111 | ROM_REGION( 0x80000, "audiocrypt", 0 ) | |
| 6140 | 6112 | ROM_LOAD( "271-m1.bin", 0x00000, 0x80000, CRC(d6bcf2bc) SHA1(df78bc95990eb8e8f3638dde6e1876354df7fe84) ) |
| 6141 | /* Decrypted */ | |
| 6142 | ROM_LOAD( "271-m1_decrypted.bin", 0x00000, 0x80000, CRC(0e86af8f) SHA1(769102b67bb1a699cfa5674d66cdb46ae633cb65) ) | |
| 6143 | ROM_RELOAD( 0x10000, 0x80000 ) | |
| 6113 | ROM_REGION( 0x90000, "audio", ROMREGION_ERASEFF ) | |
| 6144 | 6114 | |
| 6145 | 6115 | ROM_Y_ZOOM |
| 6146 | 6116 | |
| r3333 | r3334 | |
| 6174 | 6144 | ROM_REGION( 0x20000, "fixedbios", 0 ) |
| 6175 | 6145 | ROM_LOAD( "sfix.sfx", 0x000000, 0x20000, CRC(354029fc) SHA1(4ae4bf23b4c2acff875775d4cbff5583893ce2a1) ) |
| 6176 | 6146 | |
| 6177 | ROM_REGION( 0x080000, "audiocrypt", 0 ) | |
| 6178 | /* The M1 ROM is encrypted, we load it here for reference and replace it with a decrypted version */ | |
| 6179 | ROM_LOAD( "271-m1c.bin", 0x00000, 0x080000, CRC(f5515629) SHA1(7516bf1b0207a3c8d41dc30c478f8d8b1f71304b) ) | |
| 6180 | /* Decrypted */ | |
| 6181 | NEO_BIOS_AUDIO_512K( "271-m1_decrypted.bin", CRC(0e86af8f) SHA1(769102b67bb1a699cfa5674d66cdb46ae633cb65) ) /* not a 100% match for encrypted version */ | |
| 6147 | /* Encrypted */ | |
| 6148 | NEO_BIOS_AUDIO_ENCRYPTED_512K( "271-m1c.bin", CRC(f5515629) SHA1(7516bf1b0207a3c8d41dc30c478f8d8b1f71304b) ) | |
| 6182 | 6149 | |
| 6183 | 6150 | ROM_REGION( 0x1000000, "ym", 0 ) |
| 6184 | 6151 | /* Encrypted */ |
| r3333 | r3334 | |
| 6329 | 6296 | ROM_REGION( 0x20000, "fixedbios", 0 ) |
| 6330 | 6297 | ROM_LOAD( "sfix.sfx", 0x000000, 0x20000, CRC(354029fc) SHA1(4ae4bf23b4c2acff875775d4cbff5583893ce2a1) ) |
| 6331 | 6298 | |
| 6332 | ROM_REGION( 0x80000, "audiocrypt", 0 ) | |
| 6333 | /* Encrypted, we load it here for reference and replace with decrypted ROM */ | |
| 6334 | ROM_LOAD( "272-m1.bin", 0x00000, 0x80000, CRC(adeebf40) SHA1(8cbd63dda3fff4de38060405bf70cd9308c9e66e) ) | |
| 6335 | /* Decrypted */ | |
| 6336 | NEO_BIOS_AUDIO_512K( "272-m1_decrypted.bin", CRC(203d744e) SHA1(24fc73943009effa14eed0f7a29955f349ca8e8f) ) | |
| 6299 | NEO_BIOS_AUDIO_ENCRYPTED_512K( "272-m1.bin", CRC(adeebf40) SHA1(8cbd63dda3fff4de38060405bf70cd9308c9e66e) ) | |
| 6337 | 6300 | |
| 6338 | 6301 | ROM_REGION( 0x1000000, "ym", 0 ) |
| 6339 | 6302 | /* Encrypted */ |
| r3333 | r3334 | |
| 6367 | 6330 | ROM_REGION( 0x20000, "fixedbios", 0 ) |
| 6368 | 6331 | ROM_LOAD( "sfix.sfx", 0x000000, 0x20000, CRC(354029fc) SHA1(4ae4bf23b4c2acff875775d4cbff5583893ce2a1) ) |
| 6369 | 6332 | |
| 6370 | ROM_REGION( 0x80000, "audiocrypt", 0 ) | |
| 6371 | /* Encrypted, we load it here for reference and replace with decrypted ROM */ | |
| 6372 | ROM_LOAD( "272-m1.bin", 0x00000, 0x80000, CRC(adeebf40) SHA1(8cbd63dda3fff4de38060405bf70cd9308c9e66e) ) | |
| 6373 | /* Decrypted */ | |
| 6374 | NEO_BIOS_AUDIO_512K( "272-m1_decrypted.bin", CRC(203d744e) SHA1(24fc73943009effa14eed0f7a29955f349ca8e8f) ) | |
| 6333 | /* Encrypted */ | |
| 6334 | NEO_BIOS_AUDIO_ENCRYPTED_512K( "272-m1.bin", CRC(adeebf40) SHA1(8cbd63dda3fff4de38060405bf70cd9308c9e66e) ) | |
| 6375 | 6335 | |
| 6376 | 6336 | ROM_REGION( 0x1000000, "ym", 0 ) |
| 6377 | 6337 | /* Encrypted */ |
| r3333 | r3334 | |
| 6405 | 6365 | ROM_REGION( 0x20000, "fixedbios", 0 ) |
| 6406 | 6366 | ROM_LOAD( "sfix.sfx", 0x000000, 0x20000, CRC(354029fc) SHA1(4ae4bf23b4c2acff875775d4cbff5583893ce2a1) ) |
| 6407 | 6367 | |
| 6408 | ROM_REGION( 0x80000, "audiocrypt", 0 ) | |
| 6409 | /* Encrypted, we load it here for reference and replace with decrypted ROM */ | |
| 6410 | ROM_LOAD( "272-m1.bin", 0x00000, 0x80000, CRC(adeebf40) SHA1(8cbd63dda3fff4de38060405bf70cd9308c9e66e) ) | |
| 6411 | /* Decrypted */ | |
| 6412 | NEO_BIOS_AUDIO_512K( "272-m1_decrypted.bin", CRC(203d744e) SHA1(24fc73943009effa14eed0f7a29955f349ca8e8f) ) | |
| 6368 | /* Encrypted */ | |
| 6369 | NEO_BIOS_AUDIO_ENCRYPTED_512K( "272-m1.bin", CRC(adeebf40) SHA1(8cbd63dda3fff4de38060405bf70cd9308c9e66e) ) | |
| 6413 | 6370 | |
| 6414 | 6371 | ROM_REGION( 0x1000000, "ym", 0 ) |
| 6415 | 6372 | /* Encrypted */ |
| r3333 | r3334 | |
| 6443 | 6400 | ROM_REGION( 0x20000, "fixedbios", 0 ) |
| 6444 | 6401 | ROM_LOAD( "sfix.sfx", 0x000000, 0x20000, CRC(354029fc) SHA1(4ae4bf23b4c2acff875775d4cbff5583893ce2a1) ) |
| 6445 | 6402 | |
| 6446 | ROM_REGION( 0x80000, "audiocrypt", 0 ) | |
| 6447 | /* encrypted, we load it here for reference and replace with decrypted ROM */ | |
| 6448 | ROM_LOAD( "jgp-m1.bin", 0x00000, 0x80000, CRC(d163c690) SHA1(1dfd04d20c5985037f07cd01000d0b04f3a8f4f4) ) | |
| 6449 | /* Decrypted */ | |
| 6450 | NEO_BIOS_AUDIO_512K( "jgp-m1_decrypted.bin", CRC(1cab4de2) SHA1(112ff90806d8757db0685b88b762c45ed02548de) ) | |
| 6403 | /* Encrypted */ | |
| 6404 | NEO_BIOS_AUDIO_ENCRYPTED_512K( "jgp-m1.bin", CRC(d163c690) SHA1(1dfd04d20c5985037f07cd01000d0b04f3a8f4f4) ) | |
| 6451 | 6405 | |
| 6452 | 6406 | ROM_REGION( 0x0200000, "ym", 0 ) |
| 6453 | 6407 | ROM_LOAD( "jgp-v1.bin", 0x000000, 0x200000, CRC(443eadba) SHA1(3def3c22f0e276bc4c2fc7ff70ce473c08b0d2df) ) |
| r3333 | r3334 | |
| 6722 | 6676 | ROM_LOAD16_WORD_SWAP( "5008-p2.rom", 0x100000, 0x400000, CRC(a649ec38) SHA1(5c63ed5e5c848940f587c966da4908d04cf1293c) ) |
| 6723 | 6677 | ROM_LOAD16_WORD_SWAP( "5008-p3.rom", 0x500000, 0x200000, CRC(e629e13c) SHA1(6ebe080ce01c51064cb2f4d89315ba98a45ae727) ) |
| 6724 | 6678 | |
| 6725 | ROM_REGION( 0x200000, "audio | |
| 6679 | ROM_REGION( 0x200000, "audio | |
| 6726 | 6680 | ROM_LOAD( "5008-p1.rom", 0x000000, 0x200000, CRC(bf5469ba) SHA1(f05236d8fffab5836c0d27becdeeb80def32ee49) ) |
| 6727 | 6681 | |
| 6728 | 6682 | NEO_SFIX_128K( "5008-s1.rom", CRC(92410064) SHA1(1fb800b46341858207d3b6961a760289fbec7faa) ) |
| 6729 | 6683 | |
| 6730 | NEO_BIOS_AUDIO_128K( "5008-m1.rom", CRC(5a47d9ad) SHA1(0197737934653acc6c97221660d789e9914f3578) ) | |
| 6684 | //NEO_BIOS_AUDIO_128K( "5008-m1.rom", CRC(5a47d9ad) SHA1(0197737934653acc6c97221660d789e9914f3578) ) | |
| 6731 | 6685 | //NEO_BIOS_AUDIO_128K( "5004-m1.bin", CRC(f6fab859) SHA1(0184aa1394b9f9946d610278b53b846020dd88dc) ) |
| 6732 | 6686 | |
| 6733 | 6687 | ROM_REGION( 0x1000000, "ym", 0 ) |
| r3333 | r3334 | |
| 6894 | 6848 | { |
| 6895 | 6849 | kof2000_decrypt_68k(machine); |
| 6896 | 6850 | neogeo_fixed_layer_bank_type = 2; |
| 6851 | neogeo_cmc50_m1_decrypt(machine); | |
| 6897 | 6852 | kof2000_neogeo_gfx_decrypt(machine, 0x00); |
| 6853 | ||
| 6898 | 6854 | DRIVER_INIT_CALL(neogeo); |
| 6899 | 6855 | kof2000_install_protection(machine); |
| 6900 | 6856 | } |
| 6901 | 6857 | |
| 6902 | 6858 | static DRIVER_INIT( kof2001 ) |
| 6903 | 6859 | { |
| 6860 | neogeo_cmc50_m1_decrypt(machine); | |
| 6904 | 6861 | kof2000_neogeo_gfx_decrypt(machine, 0x1e); |
| 6862 | ||
| 6905 | 6863 | DRIVER_INIT_CALL(neogeo); |
| 6906 | 6864 | } |
| 6907 | 6865 | |
| 6908 | 6866 | static DRIVER_INIT( mslug4 ) |
| 6909 | 6867 | { |
| 6910 | 6868 | neogeo_fixed_layer_bank_type = 1; /* USA violent content screen is wrong -- not a bug, confirmed on real hardware! */ |
| 6869 | neogeo_cmc50_m1_decrypt(machine); | |
| 6911 | 6870 | kof2000_neogeo_gfx_decrypt(machine, 0x31); |
| 6912 | 6871 | DRIVER_INIT_CALL(neogeo); |
| 6913 | 6872 | neo_pcm2_snk_1999(machine, 8); |
| r3333 | r3334 | |
| 6951 | 6910 | static DRIVER_INIT( kof2000n ) |
| 6952 | 6911 | { |
| 6953 | 6912 | neogeo_fixed_layer_bank_type = 2; |
| 6913 | neogeo_cmc50_m1_decrypt(machine); | |
| 6954 | 6914 | kof2000_neogeo_gfx_decrypt(machine, 0x00); |
| 6915 | ||
| 6955 | 6916 | DRIVER_INIT_CALL(neogeo); |
| 6956 | 6917 | } |
| 6957 | 6918 | |
| r3333 | r3334 | |
| 6994 | 6955 | { |
| 6995 | 6956 | neo_pcm2_snk_1999(machine, 16); |
| 6996 | 6957 | neogeo_fixed_layer_bank_type = 1; |
| 6958 | neogeo_cmc50_m1_decrypt(machine); | |
| 6997 | 6959 | kof2000_neogeo_gfx_decrypt(machine, 0x3f); |
| 6998 | 6960 | DRIVER_INIT_CALL(neogeo); |
| 6999 | 6961 | } |
| r3333 | r3334 | |
| 7003 | 6965 | { |
| 7004 | 6966 | kof2002_decrypt_68k(machine); |
| 7005 | 6967 | neo_pcm2_swap(machine, 0); |
| 6968 | neogeo_cmc50_m1_decrypt(machine); | |
| 7006 | 6969 | kof2000_neogeo_gfx_decrypt(machine, 0xec); |
| 6970 | ||
| 6971 | ||
| 6972 | ||
| 6973 | ||
| 7007 | 6974 | DRIVER_INIT_CALL(neogeo); |
| 7008 | 6975 | } |
| 7009 | 6976 | |
| r3333 | r3334 | |
| 7038 | 7005 | matrim_decrypt_68k(machine); |
| 7039 | 7006 | neo_pcm2_swap(machine, 1); |
| 7040 | 7007 | neogeo_fixed_layer_bank_type = 2; |
| 7008 | neogeo_cmc50_m1_decrypt(machine); | |
| 7041 | 7009 | kof2000_neogeo_gfx_decrypt(machine, 0x6a); |
| 7010 | ||
| 7042 | 7011 | DRIVER_INIT_CALL(neogeo); |
| 7043 | 7012 | } |
| 7044 | 7013 | |
| r3333 | r3334 | |
| 7046 | 7015 | { |
| 7047 | 7016 | neo_pcm2_snk_1999(machine, 4); |
| 7048 | 7017 | neogeo_fixed_layer_bank_type = 1; |
| 7018 | neogeo_cmc50_m1_decrypt(machine); | |
| 7049 | 7019 | kof2000_neogeo_gfx_decrypt(machine, 0x2e); |
| 7020 | ||
| 7050 | 7021 | DRIVER_INIT_CALL(neogeo); |
| 7051 | 7022 | } |
| 7052 | 7023 | |
| r3333 | r3334 | |
| 7055 | 7026 | mslug5_decrypt_68k(machine); |
| 7056 | 7027 | neo_pcm2_swap(machine, 2); |
| 7057 | 7028 | neogeo_fixed_layer_bank_type = 1; |
| 7029 | neogeo_cmc50_m1_decrypt(machine); | |
| 7058 | 7030 | kof2000_neogeo_gfx_decrypt(machine, 0x19); |
| 7031 | ||
| 7032 | ||
| 7059 | 7033 | DRIVER_INIT_CALL(neogeo); |
| 7060 | 7034 | install_pvc_protection(machine); |
| 7061 | 7035 | } |
| r3333 | r3334 | |
| 7064 | 7038 | { |
| 7065 | 7039 | mslug5_decrypt_68k(machine); |
| 7066 | 7040 | svcpcb_gfx_decrypt(machine); |
| 7041 | neogeo_cmc50_m1_decrypt(machine); | |
| 7067 | 7042 | kof2000_neogeo_gfx_decrypt(machine, 0x19); |
| 7043 | ||
| 7068 | 7044 | neogeo_fixed_layer_bank_type = 2; |
| 7069 | 7045 | svcpcb_s1data_decrypt(machine); |
| 7070 | 7046 | neo_pcm2_swap(machine, 2); |
| r3333 | r3334 | |
| 7098 | 7074 | |
| 7099 | 7075 | svcchaos_px_decrypt(machine); |
| 7100 | 7076 | svcpcb_gfx_decrypt(machine); |
| 7077 | neogeo_cmc50_m1_decrypt(machine); | |
| 7101 | 7078 | kof2000_neogeo_gfx_decrypt(machine, 0x57); |
| 7079 | ||
| 7102 | 7080 | svcpcb_s1data_decrypt(machine); |
| 7103 | 7081 | neo_pcm2_swap(machine, 3); |
| 7104 | 7082 | neogeo_fixed_layer_bank_type = 2; |
| r3333 | r3334 | |
| 7111 | 7089 | svcchaos_px_decrypt(machine); |
| 7112 | 7090 | neo_pcm2_swap(machine, 3); |
| 7113 | 7091 | neogeo_fixed_layer_bank_type = 2; |
| 7092 | neogeo_cmc50_m1_decrypt(machine); | |
| 7114 | 7093 | kof2000_neogeo_gfx_decrypt(machine, 0x57); |
| 7094 | ||
| 7095 | ||
| 7115 | 7096 | DRIVER_INIT_CALL(neogeo); |
| 7116 | 7097 | install_pvc_protection(machine); |
| 7117 | 7098 | } |
| r3333 | r3334 | |
| 7158 | 7139 | samsho5_decrypt_68k(machine); |
| 7159 | 7140 | neo_pcm2_swap(machine, 4); |
| 7160 | 7141 | neogeo_fixed_layer_bank_type = 1; |
| 7142 | neogeo_cmc50_m1_decrypt(machine); | |
| 7161 | 7143 | kof2000_neogeo_gfx_decrypt(machine, 0x0f); |
| 7144 | ||
| 7162 | 7145 | DRIVER_INIT_CALL(neogeo); |
| 7163 | 7146 | } |
| 7164 | 7147 | |
| r3333 | r3334 | |
| 7175 | 7158 | { |
| 7176 | 7159 | kf2k3pcb_decrypt_68k(machine); |
| 7177 | 7160 | kf2k3pcb_gfx_decrypt(machine); |
| 7161 | kof2003biosdecode(machine); | |
| 7162 | ||
| 7163 | neogeo_cmc50_m1_decrypt(machine); | |
| 7164 | ||
| 7165 | /* extra little swap on the m1 - this must be performed AFTER the m1 decrypt | |
| 7166 | or the m1 checksum (used to generate the key) for decrypting the m1 is | |
| 7167 | incorrect */ | |
| 7168 | { | |
| 7169 | int i; | |
| 7170 | UINT8* rom = memory_region(machine, "audio"); | |
| 7171 | for (i=0;i<0x90000;i++) | |
| 7172 | { | |
| 7173 | rom[i] = BITSWAP8(rom[i], 5, 6, 1, 4, 3, 0, 7, 2); | |
| 7174 | } | |
| 7175 | ||
| 7176 | } | |
| 7177 | ||
| 7178 | 7178 | kof2000_neogeo_gfx_decrypt(machine, 0x9d); |
| 7179 | 7179 | kf2k3pcb_decrypt_s1data(machine); |
| 7180 | kof2003biosdecode(machine); | |
| 7181 | /* rom[i] = BITSWAP8(rom[i], 5, 6, 1, 4, 3, 0, 7, 2) -- extra encrypted m1 swap? not confirmed */ | |
| 7180 | ||
| 7182 | 7181 | neo_pcm2_swap(machine, 5); |
| 7183 | 7182 | neogeo_fixed_layer_bank_type = 2; |
| 7184 | 7183 | DRIVER_INIT_CALL(neogeo); |
| r3333 | r3334 | |
| 7192 | 7191 | kof2003_decrypt_68k(machine); |
| 7193 | 7192 | neo_pcm2_swap(machine, 5); |
| 7194 | 7193 | neogeo_fixed_layer_bank_type = 2; |
| 7194 | neogeo_cmc50_m1_decrypt(machine); | |
| 7195 | 7195 | kof2000_neogeo_gfx_decrypt(machine, 0x9d); |
| 7196 | ||
| 7196 | 7197 | DRIVER_INIT_CALL(neogeo); |
| 7197 | 7198 | install_pvc_protection(machine); |
| 7198 | 7199 | } |
| r3333 | r3334 | |
| 7231 | 7232 | samsh5p_decrypt_68k(machine); |
| 7232 | 7233 | neo_pcm2_swap(machine, 6); |
| 7233 | 7234 | neogeo_fixed_layer_bank_type = 1; |
| 7235 | neogeo_cmc50_m1_decrypt(machine); | |
| 7234 | 7236 | kof2000_neogeo_gfx_decrypt(machine, 0x0d); |
| 7237 | ||
| 7238 | ||
| 7235 | 7239 | DRIVER_INIT_CALL(neogeo); |
| 7236 | 7240 | } |
| 7237 | 7241 | |
| r3333 | r3334 | |
| 7241 | 7245 | UINT16* extra_ram; |
| 7242 | 7246 | |
| 7243 | 7247 | neogeo_fixed_layer_bank_type = 1; |
| 7248 | neogeo_cmc50_m1_decrypt(machine); | |
| 7244 | 7249 | kof2000_neogeo_gfx_decrypt(machine, 0xac); |
| 7245 | 7250 | |
| 7246 | 7251 | /* install some extra RAM */ |
| r3333 | r3334 | |
|---|---|---|
| 779 | 779 | |
| 780 | 780 | static CUSTOM_INPUT( peplus_input_r ) |
| 781 | 781 | { |
| 782 | UINT8 inp_ret = 0x00; | |
| 783 | UINT8 inp_read = input_port_read(field->port->machine, param); | |
| 782 | UINT8 inp_ret = 0x00; | |
| 783 | UINT8 inp_read = input_port_read(field->port->machine, param); | |
| 784 | 784 | |
| 785 | if (inp_read & 0x01) inp_ret = 0x01; | |
| 786 | if (inp_read & 0x02) inp_ret = 0x02; | |
| 787 | if (inp_read & 0x04) inp_ret = 0x03; | |
| 788 | if (inp_read & 0x08) inp_ret = 0x04; | |
| 789 | if (inp_read & 0x10) inp_ret = 0x05; | |
| 790 | if (inp_read & 0x20) inp_ret = 0x06; | |
| 791 | if (inp_read & 0x40) inp_ret = 0x07; | |
| 785 | if (inp_read & 0x01) inp_ret = 0x01; | |
| 786 | if (inp_read & 0x02) inp_ret = 0x02; | |
| 787 | if (inp_read & 0x04) inp_ret = 0x03; | |
| 788 | if (inp_read & 0x08) inp_ret = 0x04; | |
| 789 | if (inp_read & 0x10) inp_ret = 0x05; | |
| 790 | if (inp_read & 0x20) inp_ret = 0x06; | |
| 791 | if (inp_read & 0x40) inp_ret = 0x07; | |
| 792 | 792 | |
| 793 | ||
| 793 | | |
| 794 | 794 | } |
| 795 | 795 | |
| 796 | 796 | static INPUT_PORTS_START( peplus ) |
| r3333 | r3334 | |
| 801 | 801 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Lower Door") PORT_CODE(KEYCODE_I) |
| 802 | 802 | |
| 803 | 803 | PORT_START("SENSOR") |
| 804 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Coin In") PORT_IMPULSE(1) | |
| 804 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_NAME("Coin In") PORT_IMPULSE(1) | |
| 805 | 805 | |
| 806 | 806 | PORT_START("SW1") |
| 807 | 807 | PORT_DIPNAME( 0x01, 0x01, "Line Frequency" ) |
| r3333 | r3334 | |
| 819 | 819 | static INPUT_PORTS_START( peplus_schip ) |
| 820 | 820 | PORT_INCLUDE(peplus) |
| 821 | 821 | PORT_START("IN_BANK1") |
| 822 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Jackpot Reset") PORT_CODE(KEYCODE_L) | |
| 823 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Self Test") PORT_CODE(KEYCODE_K) | |
| 824 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN ) | |
| 825 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN ) | |
| 826 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN ) | |
| 827 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN ) | |
| 828 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN ) | |
| 822 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Jackpot Reset") PORT_CODE(KEYCODE_L) | |
| 823 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Self Test") PORT_CODE(KEYCODE_K) | |
| 824 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN ) | |
| 825 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN ) | |
| 826 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN ) | |
| 827 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN ) | |
| 828 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN ) | |
| 829 | 829 | |
| 830 | PORT_START("IN_BANK2") | |
| 831 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_NAME("Deal-Spin-Start") PORT_CODE(KEYCODE_Q) | |
| 832 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN ) | |
| 833 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN ) | |
| 834 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN ) | |
| 835 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN ) | |
| 836 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN ) | |
| 837 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN ) | |
| 830 | PORT_START("IN_BANK2") | |
| 831 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_NAME("Deal-Spin-Start") PORT_CODE(KEYCODE_Q) | |
| 832 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN ) | |
| 833 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN ) | |
| 834 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN ) | |
| 835 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN ) | |
| 836 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN ) | |
| 837 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN ) | |
| 838 | 838 | |
| 839 | PORT_START("IN0") | |
| 840 | PORT_BIT( 0x07, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(peplus_input_r, "IN_BANK1") | |
| 841 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 842 | PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(peplus_input_r, "IN_BANK2") | |
| 843 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 839 | PORT_START("IN0") | |
| 840 | PORT_BIT( 0x07, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(peplus_input_r, "IN_BANK1") | |
| 841 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 842 | PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(peplus_input_r, "IN_BANK2") | |
| 843 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 844 | 844 | INPUT_PORTS_END |
| 845 | 845 | |
| 846 | 846 | static INPUT_PORTS_START( peplus_poker ) |
| 847 | 847 | PORT_INCLUDE(peplus) |
| 848 | 848 | |
| 849 | 849 | PORT_START("IN_BANK1") |
| 850 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Jackpot Reset") PORT_CODE(KEYCODE_L) | |
| 851 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Self Test") PORT_CODE(KEYCODE_K) | |
| 852 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Hold 1") PORT_CODE(KEYCODE_Z) | |
| 853 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Hold 2") PORT_CODE(KEYCODE_X) | |
| 854 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Hold 3") PORT_CODE(KEYCODE_C) | |
| 855 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Hold 4") PORT_CODE(KEYCODE_V) | |
| 856 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_NAME("Hold 5") PORT_CODE(KEYCODE_B) | |
| 850 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Jackpot Reset") PORT_CODE(KEYCODE_L) | |
| 851 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Self Test") PORT_CODE(KEYCODE_K) | |
| 852 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Hold 1") PORT_CODE(KEYCODE_Z) | |
| 853 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Hold 2") PORT_CODE(KEYCODE_X) | |
| 854 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Hold 3") PORT_CODE(KEYCODE_C) | |
| 855 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Hold 4") PORT_CODE(KEYCODE_V) | |
| 856 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_NAME("Hold 5") PORT_CODE(KEYCODE_B) | |
| 857 | 857 | |
| 858 | PORT_START("IN_BANK2") | |
| 859 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_NAME("Deal-Spin-Start") PORT_CODE(KEYCODE_Q) | |
| 858 | PORT_START("IN_BANK2") | |
| 859 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_NAME("Deal-Spin-Start") PORT_CODE(KEYCODE_Q) | |
| 860 | 860 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON10 ) PORT_NAME("Max Bet") PORT_CODE(KEYCODE_W) |
| 861 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN | |
| 861 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN | |
| 862 | 862 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON12 ) PORT_NAME("Play Credit") PORT_CODE(KEYCODE_R) |
| 863 | 863 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON13 ) PORT_NAME("Cashout") PORT_CODE(KEYCODE_T) |
| 864 | 864 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON14 ) PORT_NAME("Change Request") PORT_CODE(KEYCODE_Y) |
| 865 | ||
| 865 | | |
| 866 | 866 | |
| 867 | PORT_START("IN0") | |
| 868 | PORT_BIT( 0x07, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(peplus_input_r, "IN_BANK1") | |
| 869 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 870 | PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(peplus_input_r, "IN_BANK2") | |
| 871 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 867 | PORT_START("IN0") | |
| 868 | PORT_BIT( 0x07, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(peplus_input_r, "IN_BANK1") | |
| 869 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 870 | PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(peplus_input_r, "IN_BANK2") | |
| 871 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 872 | 872 | INPUT_PORTS_END |
| 873 | 873 | |
| 874 | 874 | static INPUT_PORTS_START( peplus_bjack ) |
| 875 | 875 | PORT_INCLUDE(peplus) |
| 876 | 876 | |
| 877 | 877 | PORT_START("IN_BANK1") |
| 878 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Jackpot Reset") PORT_CODE(KEYCODE_L) | |
| 879 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Self Test") PORT_CODE(KEYCODE_K) | |
| 880 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Surrender") PORT_CODE(KEYCODE_Z) | |
| 881 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Stand") PORT_CODE(KEYCODE_X) | |
| 882 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Insurance") PORT_CODE(KEYCODE_C) | |
| 883 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Double Down") PORT_CODE(KEYCODE_V) | |
| 884 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_NAME("Split") PORT_CODE(KEYCODE_B) | |
| 878 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Jackpot Reset") PORT_CODE(KEYCODE_L) | |
| 879 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Self Test") PORT_CODE(KEYCODE_K) | |
| 880 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Surrender") PORT_CODE(KEYCODE_Z) | |
| 881 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Stand") PORT_CODE(KEYCODE_X) | |
| 882 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Insurance") PORT_CODE(KEYCODE_C) | |
| 883 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Double Down") PORT_CODE(KEYCODE_V) | |
| 884 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_NAME("Split") PORT_CODE(KEYCODE_B) | |
| 885 | 885 | |
| 886 | PORT_START("IN_BANK2") | |
| 887 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_NAME("Deal-Spin-Start") PORT_CODE(KEYCODE_Q) | |
| 886 | PORT_START("IN_BANK2") | |
| 887 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_NAME("Deal-Spin-Start") PORT_CODE(KEYCODE_Q) | |
| 888 | 888 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON10 ) PORT_NAME("Max Bet") PORT_CODE(KEYCODE_W) |
| 889 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN | |
| 889 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN | |
| 890 | 890 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON12 ) PORT_NAME("Play Credit") PORT_CODE(KEYCODE_R) |
| 891 | 891 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON13 ) PORT_NAME("Cashout") PORT_CODE(KEYCODE_T) |
| 892 | 892 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON14 ) PORT_NAME("Change Request") PORT_CODE(KEYCODE_Y) |
| 893 | ||
| 893 | | |
| 894 | 894 | |
| 895 | PORT_START("IN0") | |
| 896 | PORT_BIT( 0x07, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(peplus_input_r, "IN_BANK1") | |
| 897 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 898 | PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(peplus_input_r, "IN_BANK2") | |
| 899 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 895 | PORT_START("IN0") | |
| 896 | PORT_BIT( 0x07, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(peplus_input_r, "IN_BANK1") | |
| 897 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 898 | PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(peplus_input_r, "IN_BANK2") | |
| 899 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 900 | 900 | INPUT_PORTS_END |
| 901 | 901 | |
| 902 | 902 | static INPUT_PORTS_START( peplus_keno ) |
| 903 | 903 | PORT_INCLUDE(peplus) |
| 904 | 904 | |
| 905 | PORT_START("IN_BANK1") | |
| 906 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Jackpot Reset") PORT_CODE(KEYCODE_L) | |
| 907 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Self Test") PORT_CODE(KEYCODE_K) | |
| 908 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN ) | |
| 909 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN ) | |
| 910 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN ) | |
| 911 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN ) | |
| 912 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_NAME("Erase") PORT_CODE(KEYCODE_B) | |
| 905 | PORT_START("IN_BANK1") | |
| 906 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Jackpot Reset") PORT_CODE(KEYCODE_L) | |
| 907 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Self Test") PORT_CODE(KEYCODE_K) | |
| 908 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN ) | |
| 909 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN ) | |
| 910 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN ) | |
| 911 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN ) | |
| 912 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_NAME("Erase") PORT_CODE(KEYCODE_B) | |
| 913 | 913 | |
| 914 | PORT_START("IN_BANK2") | |
| 915 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_NAME("Deal-Spin-Start") PORT_CODE(KEYCODE_Q) | |
| 914 | PORT_START("IN_BANK2") | |
| 915 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_NAME("Deal-Spin-Start") PORT_CODE(KEYCODE_Q) | |
| 916 | 916 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON10 ) PORT_NAME("Max Bet") PORT_CODE(KEYCODE_W) |
| 917 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN | |
| 917 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN | |
| 918 | 918 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON12 ) PORT_NAME("Play Credit") PORT_CODE(KEYCODE_R) |
| 919 | 919 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON13 ) PORT_NAME("Cashout") PORT_CODE(KEYCODE_T) |
| 920 | 920 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON14 ) PORT_NAME("Change Request") PORT_CODE(KEYCODE_Y) |
| 921 | ||
| 921 | | |
| 922 | 922 | |
| 923 | PORT_START("TOUCH_X") | |
| 924 | PORT_BIT( 0xff, 0x08, IPT_LIGHTGUN_X ) PORT_MINMAX(0x00, 0x28) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(13) | |
| 925 | PORT_START("TOUCH_Y") | |
| 923 | PORT_START("TOUCH_X") | |
| 924 | PORT_BIT( 0xff, 0x08, IPT_LIGHTGUN_X ) PORT_MINMAX(0x00, 0x28) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(13) | |
| 925 | PORT_START("TOUCH_Y") | |
| 926 | 926 | PORT_BIT( 0xff, 0x08, IPT_LIGHTGUN_Y ) PORT_MINMAX(0x00, 0x19) PORT_CROSSHAIR(Y, -1.0, 0.0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(13) |
| 927 | 927 | |
| 928 | PORT_START("IN0") | |
| 929 | PORT_BIT( 0x07, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(peplus_input_r, "IN_BANK1") | |
| 930 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_NAME("Light Pen") PORT_CODE(KEYCODE_A) | |
| 931 | PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(peplus_input_r, "IN_BANK2") | |
| 932 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 928 | PORT_START("IN0") | |
| 929 | PORT_BIT( 0x07, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(peplus_input_r, "IN_BANK1") | |
| 930 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Light Pen") PORT_CODE(KEYCODE_A) | |
| 931 | PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(peplus_input_r, "IN_BANK2") | |
| 932 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 933 | 933 | INPUT_PORTS_END |
| 934 | 934 | |
| 935 | 935 | static INPUT_PORTS_START( peplus_slots ) |
| 936 | 936 | PORT_INCLUDE(peplus) |
| 937 | 937 | |
| 938 | 938 | PORT_START("IN_BANK1") |
| 939 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Jackpot Reset") PORT_CODE(KEYCODE_L) | |
| 940 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Self Test") PORT_CODE(KEYCODE_K) | |
| 941 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN ) | |
| 942 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN ) | |
| 943 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN ) | |
| 944 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN ) | |
| 945 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN ) | |
| 939 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Jackpot Reset") PORT_CODE(KEYCODE_L) | |
| 940 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Self Test") PORT_CODE(KEYCODE_K) | |
| 941 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN ) | |
| 942 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN ) | |
| 943 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN ) | |
| 944 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN ) | |
| 945 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN ) | |
| 946 | 946 | |
| 947 | PORT_START("IN_BANK2") | |
| 948 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_NAME("Deal-Spin-Start") PORT_CODE(KEYCODE_Q) | |
| 947 | PORT_START("IN_BANK2") | |
| 948 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_NAME("Deal-Spin-Start") PORT_CODE(KEYCODE_Q) | |
| 949 | 949 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON10 ) PORT_NAME("Max Bet") PORT_CODE(KEYCODE_W) |
| 950 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN | |
| 950 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN | |
| 951 | 951 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON12 ) PORT_NAME("Play Credit") PORT_CODE(KEYCODE_R) |
| 952 | 952 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON13 ) PORT_NAME("Cashout") PORT_CODE(KEYCODE_T) |
| 953 | 953 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON14 ) PORT_NAME("Change Request") PORT_CODE(KEYCODE_Y) |
| 954 | ||
| 954 | | |
| 955 | 955 | |
| 956 | PORT_START("IN0") | |
| 957 | PORT_BIT( 0x07, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(peplus_input_r, "IN_BANK1") | |
| 958 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 959 | PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(peplus_input_r, "IN_BANK2") | |
| 960 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 956 | PORT_START("IN0") | |
| 957 | PORT_BIT( 0x07, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(peplus_input_r, "IN_BANK1") | |
| 958 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 959 | PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(peplus_input_r, "IN_BANK2") | |
| 960 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 961 | 961 | INPUT_PORTS_END |
| 962 | 962 | |
| 963 | 963 | /* same as peplus_poker with additionnal fake option to enable the "Autohold" feature */ |
| r3333 | r3334 | |
|---|---|---|
| 693 | 693 | /* nth_byte32 is a general-purpose utility function, which allows us to |
| 694 | 694 | * read from 32-bit aligned memory as if it were an array of bytes. |
| 695 | 695 | */ |
| 696 | #ifdef UNUSED_FUNCTON | |
| 696 | #ifdef UNUSED_FUNCTION | |
| 697 | 697 | INLINE UINT8 |
| 698 | 698 | nth_byte32( const UINT32 *pSource, int which ) |
| 699 | 699 | { |
| r3333 | r3334 | |
|---|---|---|
| 75 | 75 | tilemap_mark_tile_dirty(fg_tmap, offset/4); |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | VIDEO_START(quizpun2) | |
| 78 | static VIDEO_START(quizpun2) | |
| 79 | 79 | { |
| 80 | 80 | bg_tmap = tilemap_create( get_bg_tile_info, tilemap_scan_rows, 8,16, 0x20,0x20 ); |
| 81 | 81 | fg_tmap = tilemap_create( get_fg_tile_info, tilemap_scan_rows, 8,16, 0x20,0x20 ); |
| r3333 | r3334 | |
| 84 | 84 | tilemap_set_transparent_pen(fg_tmap, 0); |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | VIDEO_UPDATE(quizpun2) | |
| 87 | static VIDEO_UPDATE(quizpun2) | |
| 88 | 88 | { |
| 89 | 89 | int layers_ctrl = -1; |
| 90 | 90 | |
| r3333 | r3334 | |
| 335 | 335 | Input Ports |
| 336 | 336 | ***************************************************************************/ |
| 337 | 337 | |
| 338 | INPUT_PORTS_START( quizpun2 ) | |
| 338 | static INPUT_PORTS_START( quizpun2 ) | |
| 339 | 339 | PORT_START("DSW") |
| 340 | 340 | PORT_SERVICE( 0x01, IP_ACTIVE_LOW ) |
| 341 | 341 | PORT_DIPUNKNOWN( 0x02, 0x02 ) |
| r3333 | r3334 | |
|---|---|---|
| 36 | 36 | |
| 37 | 37 | 0x05 0xFF 0xFF 0xFF 0xFF 0x02 |
| 38 | 38 | |
| 39 | CPUID info: | |
| 40 | Original set: | |
| 41 | ||
| 42 | CPUID Level: EAX: EBX: ECX: EDX: | |
| 43 | 00000000 00000003 756E6547 6C65746E 49656E69 | |
| 44 | 00000001 0000068A 00000002 00000000 0387F9FF | |
| 45 | 00000002 03020101 00000000 00000000 0C040882 | |
| 46 | 00000003 00000000 00000000 CA976D2E 000082F6 | |
| 47 | 80000000 00000000 00000000 CA976D2E 000082F6 | |
| 48 | C0000000 00000000 00000000 CA976D2E 000082F6 | |
| 49 | ||
| 50 | ||
| 51 | Version 2: | |
| 52 | CPUID Level: EAX: EBX: ECX: EDX: | |
| 53 | 00000000 00000003 756E6547 6C65746E 49656E69 | |
| 54 | 00000001 0000068A 00000002 00000000 0387F9FF | |
| 55 | 00000002 03020101 00000000 00000000 0C040882 | |
| 56 | 00000003 00000000 00000000 B8BA1941 00038881 | |
| 57 | 80000000 00000000 00000000 B8BA1941 00038881 | |
| 58 | C0000000 00000000 00000000 B8BA1941 00038881 | |
| 59 | ||
| 39 | 60 | */ |
| 40 | 61 | |
| 41 | 62 | #include "driver.h" |
| r3333 | r3334 | |
| 735 | 756 | // not the correct BIOS, f205v owes me a dump of it... |
| 736 | 757 | ROM_START(gamecstl) |
| 737 | 758 | ROM_REGION32_LE(0x40000, "user1", 0) |
| 738 | ROM_LOAD(" | |
| 759 | ROM_LOAD( "bios | |
| 739 | 760 | |
| 740 | 761 | ROM_REGION(0x08100, "gfx1", 0) |
| 741 | 762 | ROM_LOAD("cga.chr", 0x00000, 0x01000, CRC(42009069) SHA1(ed08559ce2d7f97f68b9f540bddad5b6295294dd)) |
| r3333 | r3334 | |
| 744 | 765 | DISK_IMAGE( "gamecstl", 0, MD5(501ddbebb530b8fd67eb64a4a2de3e35) SHA1(2477468ef1c1d4529057064a319ebfe9fd8facd7) ) |
| 745 | 766 | ROM_END |
| 746 | 767 | |
| 768 | ROM_START(gamecst2) | |
| 769 | ROM_REGION32_LE(0x40000, "user1", 0) | |
| 770 | ROM_LOAD( "bios.bin", 0x000000, 0x040000, CRC(27834ce9) SHA1(134c546dd75138c6f4bc5729b40e20e118454df9) ) | |
| 771 | ||
| 772 | ROM_REGION(0x08100, "gfx1", 0) | |
| 773 | ROM_LOAD("cga.chr", 0x00000, 0x01000, CRC(42009069) SHA1(ed08559ce2d7f97f68b9f540bddad5b6295294dd)) | |
| 774 | ||
| 775 | DISK_REGION( "ide" ) | |
| 776 | DISK_IMAGE( "gamecst2", 0, MD5(ef880a411521e0c6e10f715ad9dd796e) SHA1(8243d7d2eacedf358334821c9401c1b945524a69) ) | |
| 777 | ROM_END | |
| 778 | ||
| 747 | 779 | /*****************************************************************************/ |
| 748 | 780 | |
| 749 | 781 | GAME(2002, gamecstl, 0, gamecstl, gamecstl, gamecstl, ROT0, "Cristaltec", "GameCristal", GAME_NOT_WORKING | GAME_NO_SOUND) |
| 782 | GAME(2002, gamecst2, gamecstl, gamecstl, gamecstl, gamecstl, ROT0, "Cristaltec", "GameCristal (version 2.613)", GAME_NOT_WORKING | GAME_NO_SOUND) | |
| 750 | 783 |
| r3333 | r3334 | |
|---|---|---|
| 35 | 35 | #define FDC_LOG(x) do { if (LOG_FDC_COMMANDS) mame_printf_debug x; } while(0) |
| 36 | 36 | |
| 37 | 37 | |
| 38 | enum | |
| 38 | enum int_levels | |
| 39 | 39 | { |
| 40 | 40 | INT_UNKNOWN1 = 1, |
| 41 | 41 | INT_UNKNOWN2 = 2, |
| r3333 | r3334 | |
| 44 | 44 | INT_TMS34061 = 5, |
| 45 | 45 | INT_FLOPPYCTRL = 6, |
| 46 | 46 | INT_WATCHDOG_INT = 7, |
| 47 | } | |
| 47 | } | |
| 48 | 48 | |
| 49 | 49 | |
| 50 | 50 | /************************************* |
| r3333 | r3334 | |
| 272 | 272 | #define DISK_TRACK_SIZE (DISK_SECTOR_SIZE * DISK_SECTORS) |
| 273 | 273 | #define DISK_SIDE_SIZE (DISK_TRACK_SIZE * DISK_TRACKS) |
| 274 | 274 | |
| 275 | enum | |
| 275 | enum wd1770_status | |
| 276 | 276 | { |
| 277 | 277 | BUSY = 1 << 0, |
| 278 | 278 | DATA_REQUEST = 1 << 1, |
| r3333 | r3334 | |
| 285 | 285 | SPIN_UP = 1 << 5, |
| 286 | 286 | WRITE_PROTECT = 1 << 6, |
| 287 | 287 | MOTOR_ON = 1 << 7 |
| 288 | } | |
| 288 | } | |
| 289 | 289 | |
| 290 | 290 | |
| 291 | 291 | static TIMER_CALLBACK( fdc_data_callback ) |
| r3333 | r3334 | |
|---|---|---|
| 546 | 546 | static ADDRESS_MAP_START( srmp6, ADDRESS_SPACE_PROGRAM, 16 ) |
| 547 | 547 | AM_RANGE(0x000000, 0x0fffff) AM_ROM |
| 548 | 548 | AM_RANGE(0x200000, 0x23ffff) AM_RAM // work RAM |
| 549 | AM_RANGE(0x600000, 0x7fffff) AM_READ(SMH_BANK1) // banked ROM (used by ROM check) | |
| 550 | AM_RANGE(0x800000, 0x9fffff) AM_ROM AM_REGION("nile", 0) | |
| 549 | AM_RANGE(0x600000, 0x7fffff) AM_READ(SMH_BANK1) // banked ROM (used by ROM check) | |
| 550 | AM_RANGE(0x800000, 0x9fffff) AM_ROM AM_REGION("user1", 0) | |
| 551 | 551 | |
| 552 | 552 | AM_RANGE(0x300000, 0x300005) AM_READWRITE(srmp6_inputs_r, srmp6_input_select_w) // inputs |
| 553 | 553 | AM_RANGE(0x480000, 0x480fff) AM_RAM_WRITE(paletteram_w) AM_BASE(&paletteram16) |
| r3333 | r3334 | |
|---|---|---|
| 37 | 37 | |
| 38 | 38 | #define ALPHA_PEN 8192 |
| 39 | 39 | |
| 40 | enum | |
| 40 | enum cpu_indices | |
| 41 | 41 | { |
| 42 | 42 | MAIN_CPU = 0, |
| 43 | 43 | ROTATE_CPU = 1, |
| 44 | 44 | LINE_CPU = 2, |
| 45 | 45 | SOUND_CPU = 3, |
| 46 | } | |
| 46 | } | |
| 47 | 47 | |
| 48 | 48 | |
| 49 | 49 | /************************************* |
| r3333 | r3334 | |
| 469 | 469 | } cquest_sound; |
| 470 | 470 | |
| 471 | 471 | /* Called by the sound CPU emulation */ |
| 472 | void sound_dac_w(UINT16 data) | |
| 472 | static void sound_dac_w(UINT16 data) | |
| 473 | 473 | { |
| 474 | 474 | int side = data & 1; |
| 475 | 475 | int chan = (data >> 1) & 7; |
| r3333 | r3334 | |
| 504 | 504 | } |
| 505 | 505 | } |
| 506 | 506 | |
| 507 | void *cquest_sh_start(int clock, const custom_sound_interface *config) | |
| 507 | static void *cquest_sh_start(int clock, const custom_sound_interface *config) | |
| 508 | 508 | { |
| 509 | 509 | /* Allocate the stream */ |
| 510 | 510 | cquest_stream = stream_create(0, 2, Machine->sample_rate, NULL, cquest_stream_update); |
| r3333 | r3334 | |
|---|---|---|
| 119 | 119 | return f; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | chd_error chdcd_parse_gdi(const char *tocfname, cdrom_toc *outtoc, chdcd_track_input_info *outinfo) | |
| 122 | static chd_error chdcd_parse_gdi(const char *tocfname, cdrom_toc *outtoc, chdcd_track_input_info *outinfo) | |
| 123 | 123 | { |
| 124 | 124 | FILE *infile; |
| 125 | 125 | int i, numtracks; |
| r3333 | r3334 | |
|---|---|---|
| 309 | 309 | // debugwin_seq_pressed |
| 310 | 310 | //============================================================ |
| 311 | 311 | |
| 312 | int debugwin_seq_pressed(void) | |
| 312 | static int debugwin_seq_pressed(void) | |
| 313 | 313 | { |
| 314 | 314 | const input_seq *seq = input_type_seq(Machine, IPT_UI_DEBUG_BREAK, 0, SEQ_TYPE_STANDARD); |
| 315 | 315 | int result = FALSE; |
| r3333 | r3334 | |
| 485 | 485 | void debugwin_update_during_game(running_machine *machine) |
| 486 | 486 | { |
| 487 | 487 | // if we're running live, do some checks |
| 488 | if (!winwindow_has_focus() && !debug_cpu_is_stopped(machine) && mame_get_phase( | |
| 488 | if (!winwindow_has_focus() && !debug_cpu_is_stopped(machine) && mame_get_phase(machine) == MAME_PHASE_RUNNING) | |
| 489 | 489 | { |
| 490 | 490 | // see if the interrupt key is pressed and break if it is |
| 491 | 491 | if (debugwin_seq_pressed()) |
| r3333 | r3334 | |
| 493 | 493 | HWND focuswnd = GetFocus(); |
| 494 | 494 | debugwin_info *info; |
| 495 | 495 | |
| 496 | debug_cpu_halt_on_next_instruction( | |
| 496 | debug_cpu_halt_on_next_instruction(machine, -1, "User-initiated break\n"); | |
| 497 | 497 | |
| 498 | 498 | // if we were focused on some window's edit box, reset it to default |
| 499 | 499 | for (info = window_list; info; info = info->next) |
| r3333 | r3334 | |
|---|---|---|
| 55 | 55 | debug_cpu_info cpuinfo[MAX_CPU]; |
| 56 | 56 | debug_cpu_info *livecpu; |
| 57 | 57 | debug_cpu_info *visiblecpu; |
| 58 | debug_cpu_info *breakcpu; | |
| 58 | 59 | |
| 59 | 60 | UINT8 within_instruction_hook; |
| 60 | 61 | UINT8 vblank_occurred; |
| r3333 | r3334 | |
| 424 | 425 | /* update the target execution end time */ |
| 425 | 426 | info->endexectime = endtime; |
| 426 | 427 | |
| 427 | /* if a VBLANK occurred, check on things */ | |
| 428 | if (global.vblank_occurred && global.execution_state != EXECUTION_STATE_STOPPED) | |
| 428 | /* if we're running, do some periodic updating */ | |
| 429 | if (global.execution_state != EXECUTION_STATE_STOPPED) | |
| 429 | 430 | { |
| 430 | global.vblank_occurred = FALSE; | |
| 431 | ||
| 432 | /* if we were waiting for a VBLANK, signal it now */ | |
| 433 | if ((info->flags & DEBUG_FLAG_STOP_VBLANK) != 0) | |
| 431 | /* check for periodic updates */ | |
| 432 | if (info == global.visiblecpu && osd_ticks() > global.last_periodic_update_time + osd_ticks_per_second()/4) | |
| 434 | 433 | { |
| 435 | global.execution_state = EXECUTION_STATE_STOPPED; | |
| 436 | debug_console_printf("Stopped at VBLANK\n"); | |
| 434 | debug_view_update_all(); | |
| 435 | global.last_periodic_update_time = osd_ticks(); | |
| 437 | 436 | } |
| 438 | 437 | |
| 439 | /* check for debug keypresses */ | |
| 440 | else if (ui_input_pressed(machine, IPT_UI_DEBUG_BREAK)) | |
| 438 | /* check for pending breaks */ | |
| 439 | else if (info == global.breakcpu) | |
| 441 | 440 | { |
| 442 | 441 | global.execution_state = EXECUTION_STATE_STOPPED; |
| 443 | | |
| 442 | | |
| 444 | 443 | } |
| 445 | 444 | |
| 446 | /* while we're here, check for a periodic update */ | |
| 447 | else if (info == global.visiblecpu && osd_ticks() > global.last_periodic_update_time + osd_ticks_per_second()/4) | |
| 445 | /* if a VBLANK occurred, check on things */ | |
| 446 | if (global.vblank_occurred) | |
| 448 | 447 | { |
| 449 | debug_view_update_all(); | |
| 450 | global.last_periodic_update_time = osd_ticks(); | |
| 448 | global.vblank_occurred = FALSE; | |
| 449 | ||
| 450 | /* if we were waiting for a VBLANK, signal it now */ | |
| 451 | if ((info->flags & DEBUG_FLAG_STOP_VBLANK) != 0) | |
| 452 | { | |
| 453 | global.execution_state = EXECUTION_STATE_STOPPED; | |
| 454 | debug_console_printf("Stopped at VBLANK\n"); | |
| 455 | } | |
| 456 | ||
| 457 | /* check for debug keypresses */ | |
| 458 | else if (ui_input_pressed(machine, IPT_UI_DEBUG_BREAK)) | |
| 459 | debug_cpu_halt_on_next_instruction(machine, -1, "User-initiated break\n"); | |
| 451 | 460 | } |
| 452 | 461 | } |
| 453 | 462 | |
| r3333 | r3334 | |
| 593 | 602 | |
| 594 | 603 | /* reset any transient state */ |
| 595 | 604 | reset_transient_flags(machine); |
| 605 | global.breakcpu = NULL; | |
| 596 | 606 | |
| 597 | 607 | /* update all views */ |
| 598 | 608 | debug_view_update_all(); |
| r3333 | r3334 | |
| 798 | 808 | specified exception fires |
| 799 | 809 | -------------------------------------------------*/ |
| 800 | 810 | |
| 811 | #ifdef UNUSED_FUNCTION | |
| 801 | 812 | void debug_cpu_go_exception(int exception) |
| 802 | 813 | { |
| 803 | 814 | debug_cpu_info *info = global.livecpu; |
| r3333 | r3334 | |
| 810 | 821 | info->flags |= DEBUG_FLAG_STOP_EXCEPTION; |
| 811 | 822 | global.execution_state = EXECUTION_STATE_RUNNING; |
| 812 | 823 | } |
| 824 | #endif | |
| 813 | 825 | |
| 814 | 826 | |
| 815 | 827 | /*------------------------------------------------- |
| r3333 | r3334 | |
| 928 | 940 | the debugger on the next instruction |
| 929 | 941 | -------------------------------------------------*/ |
| 930 | 942 | |
| 931 | void debug_cpu_halt_on_next_instruction(running_machine *machine, const char *fmt, ...) | |
| 943 | void debug_cpu_halt_on_next_instruction(running_machine *machine, int cpunum, const char *fmt, ...) | |
| 932 | 944 | { |
| 945 | debug_cpu_info *info; | |
| 933 | 946 | va_list arg; |
| 934 | 947 | |
| 948 | /* pick the best CPU to land on */ | |
| 949 | if (cpunum != -1) | |
| 950 | info = &global.cpuinfo[cpunum]; | |
| 951 | else if (global.visiblecpu != NULL) | |
| 952 | info = global.visiblecpu; | |
| 953 | else | |
| 954 | info = global.livecpu; | |
| 955 | ||
| 956 | /* if something is pending on this CPU already, ignore this request */ | |
| 957 | if (info != NULL && info == global.breakcpu) | |
| 958 | return; | |
| 959 | ||
| 935 | 960 | va_start(arg, fmt); |
| 936 | 961 | debug_console_vprintf(fmt, arg); |
| 937 | 962 | va_end(arg); |
| 938 | 963 | |
| 939 | global.execution_state = EXECUTION_STATE_STOPPED; | |
| 940 | if (global.livecpu != NULL) | |
| 941 | compute_debug_flags(machine, global.livecpu); | |
| 964 | if (info == global.livecpu) | |
| 965 | { | |
| 966 | global.execution_state = EXECUTION_STATE_STOPPED; | |
| 967 | if (global.livecpu != NULL) | |
| 968 | compute_debug_flags(machine, global.livecpu); | |
| 969 | } | |
| 970 | else | |
| 971 | global.breakcpu = info; | |
| 942 | 972 | } |
| 943 | 973 | |
| 944 | 974 |
| r3333 | r3334 | |
|---|---|---|
| 585 | 585 | view->update_pending = 0; |
| 586 | 586 | |
| 587 | 587 | /* resize the viewdata if needed */ |
| 588 | size = view->visible_rows*view->visible_cols; | |
| 588 | size = view->visible_rows * view->visible_cols; | |
| 589 | 589 | if (size > view->viewdata_size) |
| 590 | 590 | { |
| 591 | 591 | view->viewdata_size = size; |
| r3333 | r3334 | |
|---|---|---|
| 247 | 247 | |
| 248 | 248 | int debug_cpu_within_instruction_hook(running_machine *machine); |
| 249 | 249 | const debug_cpu_info *debug_get_cpu_info(int cpunum); |
| 250 | void debug_cpu_halt_on_next_instruction(running_machine *machine, const char *fmt, ...) ATTR_PRINTF( | |
| 250 | void debug_cpu_halt_on_next_instruction(running_machine *machine, int cpunum, const char *fmt, ...) ATTR_PRINTF( | |
| 251 | 251 | int debug_cpu_is_stopped(running_machine *machine); |
| 252 | 252 | void debug_cpu_trace_printf(int cpunum, const char *fmt, ...) ATTR_PRINTF(2,3); |
| 253 | 253 | void debug_cpu_source_script(running_machine *machine, const char *file); |
| r3333 | r3334 | |
|---|---|---|
| 276 | 276 | INLINE void execute_add(UINT8 dat) |
| 277 | 277 | { |
| 278 | 278 | UINT16 temp = A + dat; |
| 279 | UINT16 temp4 = (A & 0x0f) + (dat & 0x0f); | |
| 279 | 280 | |
| 280 | 281 | PSW &= ~(C_FLAG | A_FLAG); |
| 281 | PSW |= ( | |
| 282 | PSW |= ( | |
| 282 | 283 | PSW |= (temp >> 1) & C_FLAG; |
| 283 | 284 | A = temp; |
| 284 | 285 | } |
| r3333 | r3334 | |
| 292 | 293 | INLINE void execute_addc(UINT8 dat) |
| 293 | 294 | { |
| 294 | 295 | UINT16 temp = A + dat + CARRYIN; |
| 296 | UINT16 temp4 = (A & 0x0f) + (dat & 0x0f) + CARRYIN; | |
| 295 | 297 | |
| 296 | 298 | PSW &= ~(C_FLAG | A_FLAG); |
| 297 | PSW |= ( | |
| 299 | PSW |= ( | |
| 298 | 300 | PSW |= (temp >> 1) & C_FLAG; |
| 299 | 301 | A = temp; |
| 300 | 302 | } |
| r3333 | r3334 | |
|---|---|---|
| 438 | 438 | case RELW: |
| 439 | 439 | case PER : |
| 440 | 440 | var = read_16(oprom,1); |
| 441 | sprintf(ptr, " %06x (%s)", pb | ((pc + 1 + var)&0xffff), int_16_str(var)); | |
| 442 | 441 | length += 2; |
| 442 | sprintf(ptr, " %06x (%s)", pb | ((pc + length + var)&0xffff), int_16_str(var)); | |
| 443 | 443 | break; |
| 444 | 444 | case IMM : |
| 445 | 445 | if((opcode->flag == M && !m_flag) || (opcode->flag == X && !x_flag)) |
| r3333 | r3334 | |
|---|---|---|
| 56 | 56 | "RAMU ", |
| 57 | 57 | }; |
| 58 | 58 | |
| 59 | enum | |
| 59 | enum alu_src | |
| 60 | 60 | { |
| 61 | 61 | AQ = 0, |
| 62 | 62 | AB = 1, |
| r3333 | r3334 | |
| 66 | 66 | DA = 5, |
| 67 | 67 | DQ = 6, |
| 68 | 68 | DZ = 7, |
| 69 | } | |
| 69 | } | |
| 70 | 70 | |
| 71 | enum | |
| 71 | enum alu_ins | |
| 72 | 72 | { |
| 73 | 73 | ADD = 0, |
| 74 | 74 | SUBR = 1, |
| r3333 | r3334 | |
| 78 | 78 | NOTRS = 5, |
| 79 | 79 | EXOR = 6, |
| 80 | 80 | EXNOR = 7, |
| 81 | } | |
| 81 | } | |
| 82 | 82 | |
| 83 | enum | |
| 83 | enum alu_dst | |
| 84 | 84 | { |
| 85 | 85 | QREG = 0, |
| 86 | 86 | NOP = 1, |
| r3333 | r3334 | |
| 90 | 90 | RAMD = 5, |
| 91 | 91 | RAMQU = 6, |
| 92 | 92 | RAMU = 7, |
| 93 | } | |
| 93 | } | |
| 94 | 94 | |
| 95 | 95 | /*************************************************************************** |
| 96 | 96 | MACROS |
| r3333 | r3334 | |
| 517 | 517 | #define SND_PC (cquestsnd.pc) |
| 518 | 518 | #define SND_DATA_IN (_ramen ? cquestsnd.sound_data[cquestsnd.platch] : cquestsnd.dinlatch) |
| 519 | 519 | |
| 520 | enum | |
| 520 | enum snd_latch_type | |
| 521 | 521 | { |
| 522 | 522 | PLTCH = 0, |
| 523 | 523 | DAC = 1, |
| 524 | 524 | ADLATCH = 2, |
| 525 | } | |
| 525 | } | |
| 526 | 526 | |
| 527 | 527 | static int do_sndjmp(int jmp) |
| 528 | 528 | { |
| r3333 | r3334 | |
| 820 | 820 | |
| 821 | 821 | #define ROT_PC (cquestrot.pc & 0x1ff) |
| 822 | 822 | |
| 823 | enum | |
| 823 | enum rot_spf | |
| 824 | 824 | { |
| 825 | 825 | SPF_UNUSED0 = 0, |
| 826 | 826 | SPF_UNUSED1 = 1, |
| r3333 | r3334 | |
| 832 | 832 | SPF_MULT = 7, |
| 833 | 833 | SPF_DRED = 8, |
| 834 | 834 | SPF_DWRT = 9, |
| 835 | } | |
| 835 | } | |
| 836 | 836 | |
| 837 | enum | |
| 837 | enum rot_yout | |
| 838 | 838 | { |
| 839 | 839 | YOUT_UNUSED0 = 0, |
| 840 | 840 | YOUT_UNUSED1 = 1, |
| r3333 | r3334 | |
| 844 | 844 | YOUT_Y2DYN = 5, |
| 845 | 845 | YOUT_Y2R = 6, |
| 846 | 846 | YOUT_Y2D = 7, |
| 847 | } | |
| 847 | } | |
| 848 | 848 | |
| 849 | 849 | /* Sync is asserted for the duration of every fourth cycle */ |
| 850 | 850 | /* The Dynamic RAM latch clocks in a value at the end of this cycle */ |
| r3333 | r3334 | |
| 1297 | 1297 | |
| 1298 | 1298 | #define VISIBLE_FIELD !cquestlin.field |
| 1299 | 1299 | |
| 1300 | enum | |
| 1300 | enum line_spf | |
| 1301 | 1301 | { |
| 1302 | 1302 | LSPF_UNUSUED = 0, |
| 1303 | 1303 | LSPF_FSTOP = 1, |
| r3333 | r3334 | |
| 1307 | 1307 | LSPF_MULT = 5, |
| 1308 | 1308 | LSPF_LSTOP = 6, |
| 1309 | 1309 | LSPF_BRES = 7, |
| 1310 | } | |
| 1310 | } | |
| 1311 | 1311 | |
| 1312 | enum | |
| 1312 | enum line_latch | |
| 1313 | 1313 | { |
| 1314 | 1314 | LLATCH_UNUSED = 0, |
| 1315 | 1315 | LLATCH_SEQLATCH = 1, |
| r3333 | r3334 | |
| 1319 | 1319 | LLATCH_FADLATCH = 5, |
| 1320 | 1320 | LLATCH_CLATCH = 6, |
| 1321 | 1321 | LLATCH_ZLATCH = 7, |
| 1322 | } | |
| 1322 | } | |
| 1323 | 1323 | |
| 1324 | enum | |
| 1324 | enum sreg_bits | |
| 1325 | 1325 | { |
| 1326 | 1326 | SREG_E0 = 0, |
| 1327 | 1327 | SREG_DX_DY = 1, |
| r3333 | r3334 | |
| 1331 | 1331 | SREG_LDX_DY = 5, |
| 1332 | 1332 | SREG_LDY = 6, |
| 1333 | 1333 | SREG_LDX = 7, |
| 1334 | } | |
| 1334 | } | |
| 1335 | 1335 | |
| 1336 | 1336 | INLINE int do_linjmp(int jmp) |
| 1337 | 1337 | { |
| r3333 | r3334 | |
|---|---|---|
| 6 | 6 | |
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 | |
| 9 | #include "dsp56k.h" | |
| 9 | /* | |
| 10 | NOTES: | |
| 11 | *** There seems to be a disagreement in dasm with bytes like this : 0500 0307 | |
| 12 | On one hand, you can dasm it like this : add Y1,A X:(R2+00),Y0 | |
| 13 | On the other, you can dasm it like this : move(m) P:(R2+00),B0 | |
| 14 | The interesting doc pages for this are the following : move(m) . A-155 | |
| 15 | mem move + short displacement . A-139 | |
| 16 | add . A-23 | |
| 17 | (POSSIBILITY : Maybe Add can't have a mem move + short displacement parallel move?) | |
| 18 | (CURRENT SOLUTION : I'm completely ignoring mem move + short displacements for now) | |
| 10 | 19 | |
| 11 | /* Main opcode categories */ | |
| 12 | static unsigned assemble_x_memory_data_move_ALU_opcode(char* buffer, const UINT16 op, const UINT16 op2, const unsigned pc); | |
| 13 | static unsigned assemble_dual_x_memory_data_read_ALU_opcode(char* buffer, const UINT16 op, const UINT16 op2, const unsigned pc); | |
| 14 | static unsigned assemble_no_parallel_move_ALU_opcode(char* buffer, const UINT16 op, const UINT16 op2, const unsigned pc); | |
| 15 | static unsigned assemble_parallel_register_to_register_moveALU_opcode(char* buffer, const UINT16 op, const UINT16 op2, const unsigned pc); | |
| 16 | static unsigned assemble_coorperative_x_memory_data_move_ALU_opcode(char* buffer, const UINT16 op, const UINT16 op2, const unsigned pc); | |
| 17 | static unsigned assemble_TCC_opcode(char* buffer, const UINT16 op, const UINT16 op2, const unsigned pc); | |
| 18 | static unsigned assemble_bitfield_opcode(char* buffer, const UINT16 op, const UINT16 op2, const unsigned pc); | |
| 19 | static unsigned assemble_no_parallel_move_opcode(char* buffer, const UINT16 op, const UINT16 op2, const unsigned pc); | |
| 20 | static unsigned assemble_immediate_opcode(char* buffer, const UINT16 op, const UINT16 op2, const unsigned pc); | |
| 21 | static unsigned assemble_movec_opcodes(char* buffer, const UINT16 op, const UINT16 op2, const unsigned pc); | |
| 22 | static unsigned assemble_misc_opcode(char* buffer, const UINT16 op, const UINT16 op2, const unsigned pc); | |
| 23 | static unsigned assemble_unique_opcode(char* buffer, const UINT16 op, const UINT16 op2, const unsigned pc); | |
| 20 | *** This disassembler has been 75% tested. There may remain some bugs, but it disassembles | |
| 21 | Polygonet Commanders' memtest code 100% accurate (to my knowledge). | |
| 22 | */ | |
| 24 | 23 | |
| 25 | /* Sub-opcode decoding */ | |
| 26 | static void decode_data_ALU_opcode(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register); | |
| 27 | static void decode_data_ALU_opcode_dual_move(const UINT16 op_byte, char* opcode_str, char* arg_str); | |
| 24 | #include "dsp56k.h" | |
| 28 | 25 | |
| 29 | /* Direct opcode decoding */ | |
| 30 | static unsigned decode_TCC_opcode(const UINT16 op, char* opcode_str, char* arg_str); | |
| 31 | static unsigned decode_bitfield_opcode(const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str); | |
| 32 | static unsigned decode_no_parallel_move_opcode(const UINT16 op, const UINT16 op2, const UINT16 pc, char* opcode_str, char* arg_str); | |
| 33 | static unsigned decode_immediate_opcode(const UINT16 op, const UINT16 pc, char* opcode_str, char* arg_str); | |
| 34 | static unsigned decode_movec_opcodes(const UINT16 op, const UINT16 op2, const UINT16 pc, char* opcode_str, char* arg_str); | |
| 35 | static unsigned decode_misc_opcode(const UINT16 op, const UINT16 pc, char* opcode_str, char* arg_str); | |
| 36 | static unsigned decode_unique_opcode(const UINT16 op, const UINT16 op2, const UINT16 pc, char* opcode_str, char* arg_str); | |
| 26 | /*******************/ | |
| 27 | /* Dasm prototypes */ | |
| 28 | /*******************/ | |
| 29 | static size_t dsp56k_dasm_add_2 (const UINT16 op_byte, char* opcode_str, char* arg_str); | |
| 30 | static size_t dsp56k_dasm_mac_1 (const UINT16 op_byte, char* opcode_str, char* arg_str); | |
| 31 | static size_t dsp56k_dasm_macr_1 (const UINT16 op_byte, char* opcode_str, char* arg_str); | |
| 32 | static size_t dsp56k_dasm_move_1 (const UINT16 op_byte, char* opcode_str, char* arg_str); | |
| 33 | static size_t dsp56k_dasm_mpy_1 (const UINT16 op_byte, char* opcode_str, char* arg_str); | |
| 34 | static size_t dsp56k_dasm_mpyr_1 (const UINT16 op_byte, char* opcode_str, char* arg_str); | |
| 35 | static size_t dsp56k_dasm_sub_1 (const UINT16 op_byte, char* opcode_str, char* arg_str); | |
| 36 | static size_t dsp56k_dasm_tfr_2 (const UINT16 op_byte, char* opcode_str, char* arg_str); | |
| 37 | static size_t dsp56k_dasm_mpy_2 (const UINT16 op_byte, char* opcode_str, char* arg_str); | |
| 38 | static size_t dsp56k_dasm_mac_2 (const UINT16 op_byte, char* opcode_str, char* arg_str); | |
| 39 | static size_t dsp56k_dasm_clr (const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register); | |
| 40 | static size_t dsp56k_dasm_add (const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register); | |
| 41 | static size_t dsp56k_dasm_move (const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register); | |
| 42 | static size_t dsp56k_dasm_tfr (const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register); | |
| 43 | static size_t dsp56k_dasm_rnd (const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register); | |
| 44 | static size_t dsp56k_dasm_tst (const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register); | |
| 45 | static size_t dsp56k_dasm_inc (const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register); | |
| 46 | static size_t dsp56k_dasm_inc24 (const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register); | |
| 47 | static size_t dsp56k_dasm_or (const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register); | |
| 48 | static size_t dsp56k_dasm_asr (const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register); | |
| 49 | static size_t dsp56k_dasm_asl (const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register); | |
| 50 | static size_t dsp56k_dasm_lsr (const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register); | |
| 51 | static size_t dsp56k_dasm_lsl (const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register); | |
| 52 | static size_t dsp56k_dasm_eor (const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register); | |
| 53 | static size_t dsp56k_dasm_subl (const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register); | |
| 54 | static size_t dsp56k_dasm_sub (const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register); | |
| 55 | static size_t dsp56k_dasm_clr2 (const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register); | |
| 56 | static size_t dsp56k_dasm_sbc (const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register); | |
| 57 | static size_t dsp56k_dasm_cmp (const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register); | |
| 58 | static size_t dsp56k_dasm_neg (const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register); | |
| 59 | static size_t dsp56k_dasm_not (const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register); | |
| 60 | static size_t dsp56k_dasm_dec (const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register); | |
| 61 | static size_t dsp56k_dasm_dec24 (const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register); | |
| 62 | static size_t dsp56k_dasm_and (const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register); | |
| 63 | static size_t dsp56k_dasm_abs (const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register); | |
| 64 | static size_t dsp56k_dasm_ror (const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register); | |
| 65 | static size_t dsp56k_dasm_rol (const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register); | |
| 66 | static size_t dsp56k_dasm_cmpm (const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register); | |
| 67 | static size_t dsp56k_dasm_mpy (const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register); | |
| 68 | static size_t dsp56k_dasm_mpyr (const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register); | |
| 69 | static size_t dsp56k_dasm_mac (const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register); | |
| 70 | static size_t dsp56k_dasm_macr (const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register); | |
| 71 | static size_t dsp56k_dasm_adc (const UINT16 op, char* opcode_str, char* arg_str); | |
| 72 | static size_t dsp56k_dasm_andi (const UINT16 op, char* opcode_str, char* arg_str); | |
| 73 | static size_t dsp56k_dasm_asl4 (const UINT16 op, char* opcode_str, char* arg_str); | |
| 74 | static size_t dsp56k_dasm_asr4 (const UINT16 op, char* opcode_str, char* arg_str); | |
| 75 | static size_t dsp56k_dasm_asr16 (const UINT16 op, char* opcode_str, char* arg_str); | |
| 76 | static size_t dsp56k_dasm_bfop (const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str); | |
| 77 | static size_t dsp56k_dasm_bcc (const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str, const offs_t pc); | |
| 78 | static size_t dsp56k_dasm_bcc_1 (const UINT16 op, char* opcode_str, char* arg_str, const offs_t pc); | |
| 79 | static size_t dsp56k_dasm_bcc_2 (const UINT16 op, char* opcode_str, char* arg_str); | |
| 80 | static size_t dsp56k_dasm_bra (const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str, const offs_t pc); | |
| 81 | static size_t dsp56k_dasm_bra_1 (const UINT16 op, char* opcode_str, char* arg_str, const offs_t pc); | |
| 82 | static size_t dsp56k_dasm_bra_2 (const UINT16 op, char* opcode_str, char* arg_str); | |
| 83 | static size_t dsp56k_dasm_brkc (const UINT16 op, char* opcode_str, char* arg_str); | |
| 84 | static size_t dsp56k_dasm_bscc (const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str, const offs_t pc); | |
| 85 | static size_t dsp56k_dasm_bscc_1 (const UINT16 op, char* opcode_str, char* arg_str); | |
| 86 | static size_t dsp56k_dasm_bsr (const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str, const offs_t pc); | |
| 87 | static size_t dsp56k_dasm_bsr_1 (const UINT16 op, char* opcode_str, char* arg_str); | |
| 88 | static size_t dsp56k_dasm_chkaau (const UINT16 op, char* opcode_str, char* arg_str); | |
| 89 | static size_t dsp56k_dasm_debug (const UINT16 op, char* opcode_str, char* arg_str); | |
| 90 | static size_t dsp56k_dasm_debugcc (const UINT16 op, char* opcode_str, char* arg_str); | |
| 91 | static size_t dsp56k_dasm_div (const UINT16 op, char* opcode_str, char* arg_str); | |
| 92 | static size_t dsp56k_dasm_dmac (const UINT16 op, char* opcode_str, char* arg_str); | |
| 93 | static size_t dsp56k_dasm_do (const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str); | |
| 94 | static size_t dsp56k_dasm_do_1 (const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str); | |
| 95 | static size_t dsp56k_dasm_do_2 (const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str); | |
| 96 | static size_t dsp56k_dasm_doforever (const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str); | |
| 97 | static size_t dsp56k_dasm_enddo (const UINT16 op, char* opcode_str, char* arg_str); | |
| 98 | static size_t dsp56k_dasm_ext (const UINT16 op, char* opcode_str, char* arg_str); | |
| 99 | static size_t dsp56k_dasm_illegal (const UINT16 op, char* opcode_str, char* arg_str); | |
| 100 | static size_t dsp56k_dasm_imac (const UINT16 op, char* opcode_str, char* arg_str); | |
| 101 | static size_t dsp56k_dasm_impy (const UINT16 op, char* opcode_str, char* arg_str); | |
| 102 | static size_t dsp56k_dasm_jcc (const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str); | |
| 103 | static size_t dsp56k_dasm_jcc_1 (const UINT16 op, char* opcode_str, char* arg_str); | |
| 104 | static size_t dsp56k_dasm_jmp (const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str); | |
| 105 | static size_t dsp56k_dasm_jmp_1 (const UINT16 op, char* opcode_str, char* arg_str); | |
| 106 | static size_t dsp56k_dasm_jscc (const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str); | |
| 107 | static size_t dsp56k_dasm_jscc_1 (const UINT16 op, char* opcode_str, char* arg_str); | |
| 108 | static size_t dsp56k_dasm_jsr (const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str); | |
| 109 | static size_t dsp56k_dasm_jsr_1 (const UINT16 op, char* opcode_str, char* arg_str); | |
| 110 | static size_t dsp56k_dasm_jsr_2 (const UINT16 op, char* opcode_str, char* arg_str); | |
| 111 | static size_t dsp56k_dasm_lea (const UINT16 op, char* opcode_str, char* arg_str); | |
| 112 | static size_t dsp56k_dasm_lea_1 (const UINT16 op, char* opcode_str, char* arg_str); | |
| 113 | static size_t dsp56k_dasm_macsuuu (const UINT16 op, char* opcode_str, char* arg_str); | |
| 114 | static size_t dsp56k_dasm_move_2 (const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str); | |
| 115 | static size_t dsp56k_dasm_movec (const UINT16 op, char* opcode_str, char* arg_str); | |
| 116 | static size_t dsp56k_dasm_movec_1 (const UINT16 op, char* opcode_str, char* arg_str); | |
| 117 | static size_t dsp56k_dasm_movec_2 (const UINT16 op, char* opcode_str, char* arg_str); | |
| 118 | static size_t dsp56k_dasm_movec_3 (const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str); | |
| 119 | static size_t dsp56k_dasm_movec_4 (const UINT16 op, char* opcode_str, char* arg_str); | |
| 120 | static size_t dsp56k_dasm_movec_5 (const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str); | |
| 121 | static size_t dsp56k_dasm_movei (const UINT16 op, char* opcode_str, char* arg_str); | |
| 122 | static size_t dsp56k_dasm_movem (const UINT16 op, char* opcode_str, char* arg_str); | |
| 123 | static size_t dsp56k_dasm_movem_1 (const UINT16 op, char* opcode_str, char* arg_str); | |
| 124 | static size_t dsp56k_dasm_movem_2 (const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str); | |
| 125 | static size_t dsp56k_dasm_movep (const UINT16 op, char* opcode_str, char* arg_str); | |
| 126 | static size_t dsp56k_dasm_movep_1 (const UINT16 op, char* opcode_str, char* arg_str); | |
| 127 | static size_t dsp56k_dasm_moves (const UINT16 op, char* opcode_str, char* arg_str); | |
| 128 | static size_t dsp56k_dasm_mpysuuu (const UINT16 op, char* opcode_str, char* arg_str); | |
| 129 | static size_t dsp56k_dasm_negc (const UINT16 op, char* opcode_str, char* arg_str); | |
| 130 | static size_t dsp56k_dasm_nop (const UINT16 op, char* opcode_str, char* arg_str); | |
| 131 | static size_t dsp56k_dasm_norm (const UINT16 op, char* opcode_str, char* arg_str); | |
| 132 | static size_t dsp56k_dasm_ori (const UINT16 op, char* opcode_str, char* arg_str); | |
| 133 | static size_t dsp56k_dasm_rep (const UINT16 op, char* opcode_str, char* arg_str); | |
| 134 | static size_t dsp56k_dasm_rep_1 (const UINT16 op, char* opcode_str, char* arg_str); | |
| 135 | static size_t dsp56k_dasm_rep_2 (const UINT16 op, char* opcode_str, char* arg_str); | |
| 136 | static size_t dsp56k_dasm_repcc (const UINT16 op, char* opcode_str, char* arg_str); | |
| 137 | static size_t dsp56k_dasm_reset (const UINT16 op, char* opcode_str, char* arg_str); | |
| 138 | static size_t dsp56k_dasm_rti (const UINT16 op, char* opcode_str, char* arg_str); | |
| 139 | static size_t dsp56k_dasm_rts (const UINT16 op, char* opcode_str, char* arg_str); | |
| 140 | static size_t dsp56k_dasm_stop (const UINT16 op, char* opcode_str, char* arg_str); | |
| 141 | static size_t dsp56k_dasm_swap (const UINT16 op, char* opcode_str, char* arg_str); | |
| 142 | static size_t dsp56k_dasm_swi (const UINT16 op, char* opcode_str, char* arg_str); | |
| 143 | static size_t dsp56k_dasm_tcc (const UINT16 op, char* opcode_str, char* arg_str); | |
| 144 | static size_t dsp56k_dasm_tfr2 (const UINT16 op, char* opcode_str, char* arg_str); | |
| 145 | static size_t dsp56k_dasm_tfr3 (const UINT16 op, char* opcode_str, char* arg_str); | |
| 146 | static size_t dsp56k_dasm_tst2 (const UINT16 op, char* opcode_str, char* arg_str); | |
| 147 | static size_t dsp56k_dasm_wait (const UINT16 op, char* opcode_str, char* arg_str); | |
| 148 | static size_t dsp56k_dasm_zero (const UINT16 op, char* opcode_str, char* arg_str); | |
| 37 | 149 | |
| 38 | /* Parallel operation decoding */ | |
| 39 | static void decode_x_memory_data_move(const UINT16 op_byte, char* parallel_move_str); | |
| 40 | static void decode_dual_x_memory_data_read(const UINT16 op, char* parallel_move_str, char* parallel_move_str2); | |
| 41 | static void decode_register_to_register_data_move(const UINT16 op_byte, char* parallel_move_str, char* d_register); | |
| 42 | static void decode_parallel_cooperative_x_memory_data_move(const UINT16 op_byte, char* parallel_move_str, char* d_register); | |
| 43 | 150 | |
| 44 | ||
| 45 | /* Helper functions */ | |
| 46 | #define BITS(CUR,MASK) (dsp56k_op_mask(CUR,MASK)) | |
| 47 | static UINT16 dsp56k_op_mask(UINT16 op, UINT16 mask); | |
| 48 | static void pad_string(const int dest_length, char* string); | |
| 49 | ||
| 50 | enum bbbType { BBB_UPPER, BBB_MIDDLE, BBB_LOWER }; | |
| 51 | ||
| 151 | /***************************/ | |
| 52 | 152 | /* Table decoder functions */ |
| 153 | /***************************/ | |
| 53 | 154 | static int decode_BBB_table (UINT16 BBB); |
| 54 | 155 | static void decode_cccc_table (UINT16 cccc, char *mnemonic); |
| 55 | 156 | static void decode_DDDDD_table(UINT16 DDDDD, char *SD); |
| r3333 | r3334 | |
| 64 | 165 | static void decode_JJJF_table (UINT16 JJJ, UINT16 F, char *S, char *D); |
| 65 | 166 | static void decode_JJF_table (UINT16 JJ, UINT16 F, char *S, char *D); |
| 66 | 167 | static void decode_JF_table (UINT16 J, UINT16 F, char *S, char *D); |
| 67 | ||
| 168 | ||
| 68 | 169 | static void decode_kSign_table(UINT16 k, char *plusMinus); |
| 69 | 170 | static void decode_KKK_table (UINT16 KKK, char *D1, char *D2); |
| 70 | /* static int decode_NN_table (UINT16 NN); */ | |
| 171 | static int decode_NN_table (UINT16 NN); | |
| 172 | static int decode_TT_table (UINT16 TT); | |
| 71 | 173 | static void decode_QQF_table (UINT16 QQ, UINT16 F, char *S1, char *S2, char *D); |
| 72 | 174 | static void decode_QQF_special_table(UINT16 QQ, UINT16 F, char *S1, char *S2, char *D); |
| 73 | 175 | static void decode_QQQF_table (UINT16 QQQ, UINT16 F, char *S1, char *S2, char *D); |
| r3333 | r3334 | |
| 83 | 185 | static void assemble_ea_from_MM_table(UINT16 MM, int n, char *ea); |
| 84 | 186 | static void assemble_ea_from_t_table (UINT16 t, UINT16 val, char *ea); |
| 85 | 187 | static void assemble_ea_from_q_table (UINT16 q, int n, char *ea); |
| 86 | ||
| 188 | ||
| 87 | 189 | |
| 88 | 190 | static void assemble_D_from_P_table(UINT16 P, UINT16 ppppp, char *D); |
| 89 | 191 | static void assemble_arguments_from_W_table(UINT16 W, char *args, char ma, char *SD, char *ea); |
| 90 | 192 | static void assemble_reg_from_W_table(UINT16 W, char *args, char ma, char *SD, UINT8 xx); |
| 91 | 193 | |
| 92 | 194 | static void assemble_address_from_IO_short_address(UINT16 pp, char *ea); |
| 93 | static INT8 get_6_bit_ | |
| 195 | static INT8 get_6_bit_s | |
| 94 | 196 | |
| 95 | 197 | |
| 198 | /**********************************/ | |
| 199 | /* Parallel memory move functions */ | |
| 200 | /**********************************/ | |
| 201 | static void decode_x_memory_data_move(const UINT16 op, char* parallel_move_str); | |
| 202 | static void decode_x_memory_data_move2(const UINT16 op, char* parallel_move_str, char* d_register); | |
| 203 | static void decode_dual_x_memory_data_read(const UINT16 op, char* parallel_move_str, char* parallel_move_str2); | |
| 204 | static void decode_register_to_register_data_move(const UINT16 op, char* parallel_move_str, char* d_register); | |
| 205 | static void decode_x_memory_data_write_and_register_data_move(const UINT16 op, char* parallel_move_str, char* parallel_move_str2); | |
| 206 | static void decode_address_register_update(const UINT16 op, char* parallel_move_str); | |
| 207 | static void decode_x_memory_data_move_with_short_displacement(const UINT16 op, const UINT16 op2, char* parallel_move_str); | |
| 208 | ||
| 209 | /********************/ | |
| 210 | /* Helper functions */ | |
| 211 | /********************/ | |
| 212 | #define BITS(CUR,MASK) (dsp56k_op_mask(CUR,MASK)) | |
| 213 | static UINT16 dsp56k_op_mask(UINT16 op, UINT16 mask); | |
| 214 | static void pad_string(const int dest_length, char* string); | |
| 215 | ||
| 216 | enum bbbType { BBB_UPPER, BBB_MIDDLE, BBB_LOWER }; | |
| 217 | ||
| 218 | ||
| 96 | 219 | /*****************************/ |
| 97 | 220 | /* Main disassembly function */ |
| 98 | 221 | /*****************************/ |
| 99 | 222 | offs_t dsp56k_dasm(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram) |
| 100 | 223 | { |
| 224 | /* ORDER: Handle parallel types in the ALU */ | |
| 225 | /* Handle the rest */ | |
| 101 | 226 | unsigned size = 0; |
| 227 | ||
| 228 | char arg_str[128] = ""; | |
| 229 | char opcode_str[128] = ""; | |
| 230 | char parallel_move_str[128] = ""; | |
| 231 | char parallel_move_str2[128] = ""; | |
| 232 | ||
| 102 | 233 | const UINT16 op = oprom[0] | (oprom[1] << 8); |
| 103 | 234 | const UINT16 op2 = oprom[2] | (oprom[3] << 8); |
| 104 | 235 | |
| 105 | /* FILTER FOR PARALLEL DATA MOVES */ | |
| 106 | if (BITS(op,0x8000)) | |
| 236 | /* Dual X Memory Data Read : 011m mKKK -rr- ---- : A-142*/ | |
| 237 | if ((op & 0xe000) == 0x6000) | |
| 107 | 238 | { |
| 108 | /* ALU opcode with a single parallel data move */ | |
| 109 | size = assemble_x_memory_data_move_ALU_opcode(buffer, op, op2, pc); | |
| 239 | /* Quote: (MOVE, MAC(R), MPY(R), ADD, SUB, TFR) */ | |
| 240 | UINT16 op_byte = op & 0x00ff; | |
| 241 | ||
| 242 | /* ADD : 011m mKKK 0rru Fuuu : A-22 */ | |
| 243 | if ((op & 0xe080) == 0x6000) | |
| 244 | { | |
| 245 | size = dsp56k_dasm_add_2(op_byte, opcode_str, arg_str); | |
| 246 | } | |
| 247 | /* MAC : 011m mKKK 1xx0 F1QQ : A-122 */ | |
| 248 | else if ((op & 0xe094) == 0x6084) | |
| 249 | { | |
| 250 | size = dsp56k_dasm_mac_1(op_byte, opcode_str, arg_str); | |
| 251 | } | |
| 252 | /* MACR: 011m mKKK 1--1 F1QQ : A-124 */ | |
| 253 | else if ((op & 0xe094) == 0x6094) | |
| 254 | { | |
| 255 | size = dsp56k_dasm_macr_1(op_byte, opcode_str, arg_str); | |
| 256 | } | |
| 257 | /* MOVE : 011m mKKK 0rr1 0000 : A-128 */ | |
| 258 | else if ((op & 0xe09f) == 0x6010) | |
| 259 | { | |
| 260 | size = dsp56k_dasm_move_1(op_byte, opcode_str, arg_str); | |
| 261 | } | |
| 262 | /* MPY : 011m mKKK 1xx0 F0QQ : A-160 */ | |
| 263 | else if ((op & 0xe094) == 0x6080) | |
| 264 | { | |
| 265 | size = dsp56k_dasm_mpy_1(op_byte, opcode_str, arg_str); | |
| 266 | } | |
| 267 | /* MPYR : 011m mKKK 1--1 F0QQ : A-162 */ | |
| 268 | else if ((op & 0xe094) == 0x6090) | |
| 269 | { | |
| 270 | size = dsp56k_dasm_mpyr_1(op_byte, opcode_str, arg_str); | |
| 271 | } | |
| 272 | /* SUB : 011m mKKK 0rru Fuuu : A-202 */ | |
| 273 | else if ((op & 0xe080) == 0x6000) | |
| 274 | { | |
| 275 | size = dsp56k_dasm_sub_1(op_byte, opcode_str, arg_str); | |
| 276 | } | |
| 277 | /* TFR : 011m mKKK 0rr1 F0DD : A-212 */ | |
| 278 | else if ((op & 0xe094) == 0x6010) | |
| 279 | { | |
| 280 | size = dsp56k_dasm_tfr_2(op_byte, opcode_str, arg_str); | |
| 281 | } | |
| 282 | ||
| 283 | /* Now evaluate the parallel data move */ | |
| 284 | decode_dual_x_memory_data_read(op, parallel_move_str, parallel_move_str2); | |
| 110 | 285 | } |
| 111 | else if (BITS(op,0xe000) == 0x3) | |
| 286 | /* X Memory Data Write and Register Data Move : 0001 011k RRDD ---- : A-140 */ | |
| 287 | else if ((op & 0xfe00) == 0x1600) | |
| 112 | 288 | { |
| 113 | /* ALU opcode with two parallel data moves */ | |
| 114 | size = assemble_dual_x_memory_data_read_ALU_opcode(buffer, op, op2, pc); | |
| 289 | /* Quote: (MPY or MAC) */ | |
| 290 | UINT16 op_byte = op & 0x00ff; | |
| 291 | ||
| 292 | /* MPY : 0001 0110 RRDD FQQQ : A-160 */ | |
| 293 | if ((op & 0xff00) == 0x1600) | |
| 294 | { | |
| 295 | size = dsp56k_dasm_mpy_2(op_byte, opcode_str, arg_str); | |
| 296 | } | |
| 297 | /* MAC : 0001 0111 RRDD FQQQ : A-122 */ | |
| 298 | else if ((op & 0xff00) == 0x1700) | |
| 299 | { | |
| 300 | size = dsp56k_dasm_mac_2(op_byte, opcode_str, arg_str); | |
| 301 | } | |
| 302 | ||
| 303 | /* Now evaluate the parallel data move */ | |
| 304 | decode_x_memory_data_write_and_register_data_move(op, parallel_move_str, parallel_move_str2); | |
| 115 | 305 | } |
| 116 | else if (BITS(op,0xff00) == 0x4a) | |
| 306 | ||
| 307 | /* Handle Other parallel types */ | |
| 308 | else | |
| 117 | 309 | { |
| 118 | /* ALU opcode without any parallel data move */ | |
| 119 | size = assemble_no_parallel_move_ALU_opcode(buffer, op, op2, pc); | |
| 310 | /***************************************/ | |
| 311 | /* 32 General parallel move operations */ | |
| 312 | /***************************************/ | |
| 313 | ||
| 314 | enum pType { kNoParallelDataMove, | |
| 315 | kRegisterToRegister, | |
| 316 | kAddressRegister, | |
| 317 | kXMemoryDataMove, | |
| 318 | kXMemoryDataMove2, | |
| 319 | kXMemoryDataMoveWithDisp }; | |
| 320 | ||
| 321 | UINT16 op_byte = 0x0000; | |
| 322 | char d_register[32] = ""; | |
| 323 | int parallelType = -1; | |
| 324 | ||
| 325 | /* Note: it's important that NPDM comes before RtRDM here */ | |
| 326 | /* No Parallel Data Move : 0100 1010 ---- ---- : A-131 */ | |
| 327 | if ((op & 0xff00) == 0x4a00) | |
| 328 | { | |
| 329 | op_byte = op & 0x00ff; | |
| 330 | parallelType = kNoParallelDataMove; | |
| 331 | } | |
| 332 | /* Register to Register Data Move : 0100 IIII ---- ---- : A-133 */ | |
| 333 | else if ((op & 0xf000) == 0x4000) | |
| 334 | { | |
| 335 | op_byte = op & 0x00ff; | |
| 336 | parallelType = kRegisterToRegister; | |
| 337 | } | |
| 338 | /* Address Register Update : 0011 0zRR ---- ---- : A-135 */ | |
| 339 | else if ((op & 0xf800) == 0x3000) | |
| 340 | { | |
| 341 | op_byte = op & 0x00ff; | |
| 342 | parallelType = kAddressRegister; | |
| 343 | } | |
| 344 | /* X Memory Data Move : 1mRR HHHW ---- ---- : A-137 */ | |
| 345 | else if ((op & 0x8000) == 0x8000) | |
| 346 | { | |
| 347 | op_byte = op & 0x00ff; | |
| 348 | parallelType = kXMemoryDataMove; | |
| 349 | } | |
| 350 | /* X Memory Data Move : 0101 HHHW ---- ---- : A-137 */ | |
| 351 | else if ((op & 0xf000) == 0x5000) | |
| 352 | { | |
| 353 | op_byte = op & 0x00ff; | |
| 354 | parallelType = kXMemoryDataMove2; | |
| 355 | } | |
| 356 | /* X Memory Data Move with short displacement : 0000 0101 BBBB BBBB ---- HHHW ---- ---- : A-139 */ | |
| 357 | else if ((op & 0xff00) == 0x0500) | |
| 358 | { | |
| 359 | /* See notes at top of file! */ | |
| 360 | /* op_byte = op2 & 0x00ff; */ | |
| 361 | /* parallelType = kXMemoryDataMoveWithDisp; */ | |
| 362 | /* DO NOTHING FOR NOW */ | |
| 363 | } | |
| 364 | ||
| 365 | ||
| 366 | if (parallelType != -1) | |
| 367 | { | |
| 368 | /* Note: There is much overlap between opcodes down here */ | |
| 369 | /* To this end, certain ops must come before others in the list */ | |
| 370 | ||
| 371 | /* CLR : .... .... 0000 F001 : A-60 */ | |
| 372 | if ((op_byte & 0x00f7) == 0x0001) | |
| 373 | { | |
| 374 | size = dsp56k_dasm_clr(op_byte, opcode_str, arg_str, d_register); | |
| 375 | } | |
| 376 | /* ADD : .... .... 0000 FJJJ : A-22 */ | |
| 377 | else if ((op_byte & 0x00f0) == 0x0000) | |
| 378 | { | |
| 379 | size = dsp56k_dasm_add(op_byte, opcode_str, arg_str, d_register); | |
| 380 | } | |
| 381 | ||
| 382 | ||
| 383 | /* MOVE : .... .... 0001 0001 : A-128 */ | |
| 384 | else if ((op_byte & 0x00ff) == 0x0011) | |
| 385 | { | |
| 386 | size = dsp56k_dasm_move(op_byte, opcode_str, arg_str, d_register); | |
| 387 | } | |
| 388 | /* TFR : .... .... 0001 FJJJ : A-212 */ | |
| 389 | else if ((op_byte & 0x00f0) == 0x0010) | |
| 390 | { | |
| 391 | size = dsp56k_dasm_tfr(op_byte, opcode_str, arg_str, d_register); | |
| 392 | } | |
| 393 | ||
| 394 | ||
| 395 | /* RND : .... .... 0010 F000 : A-188 */ | |
| 396 | else if ((op_byte & 0x00f7) == 0x0020) | |
| 397 | { | |
| 398 | size = dsp56k_dasm_rnd(op_byte, opcode_str, arg_str, d_register); | |
| 399 | } | |
| 400 | /* TST : .... .... 0010 F001 : A-218 */ | |
| 401 | else if ((op_byte & 0x00f7) == 0x0021) | |
| 402 | { | |
| 403 | size = dsp56k_dasm_tst(op_byte, opcode_str, arg_str, d_register); | |
| 404 | } | |
| 405 | /* INC : .... .... 0010 F010 : A-104 */ | |
| 406 | else if ((op_byte & 0x00f7) == 0x0022) | |
| 407 | { | |
| 408 | size = dsp56k_dasm_inc(op_byte, opcode_str, arg_str, d_register); | |
| 409 | } | |
| 410 | /* INC24 : .... .... 0010 F011 : A-106 */ | |
| 411 | else if ((op_byte & 0x00f7) == 0x0023) | |
| 412 | { | |
| 413 | size = dsp56k_dasm_inc24(op_byte, opcode_str, arg_str, d_register); | |
| 414 | } | |
| 415 | /* OR : .... .... 0010 F1JJ : A-176 */ | |
| 416 | else if ((op_byte & 0x00f4) == 0x0024) | |
| 417 | { | |
| 418 | size = dsp56k_dasm_or(op_byte, opcode_str, arg_str, d_register); | |
| 419 | } | |
| 420 | ||
| 421 | ||
| 422 | /* ASR : .... .... 0011 F000 : A-32 */ | |
| 423 | else if ((op_byte & 0x00f7) == 0x0030) | |
| 424 | { | |
| 425 | size = dsp56k_dasm_asr(op_byte, opcode_str, arg_str, d_register); | |
| 426 | } | |
| 427 | /* ASL : .... .... 0011 F001 : A-28 */ | |
| 428 | else if ((op_byte & 0x00f7) == 0x0031) | |
| 429 | { | |
| 430 | size = dsp56k_dasm_asl(op_byte, opcode_str, arg_str, d_register); | |
| 431 | } | |
| 432 | /* LSR : .... .... 0011 F010 : A-120 */ | |
| 433 | else if ((op_byte & 0x00f7) == 0x0032) | |
| 434 | { | |
| 435 | size = dsp56k_dasm_lsr(op_byte, opcode_str, arg_str, d_register); | |
| 436 | } | |
| 437 | /* LSL : .... .... 0011 F011 : A-118 */ | |
| 438 | else if ((op_byte & 0x00f7) == 0x0033) | |
| 439 | { | |
| 440 | size = dsp56k_dasm_lsl(op_byte, opcode_str, arg_str, d_register); | |
| 441 | } | |
| 442 | /* EOR : .... .... 0011 F1JJ : A-94 */ | |
| 443 | else if ((op_byte & 0x00f4) == 0x0034) | |
| 444 | { | |
| 445 | size = dsp56k_dasm_eor(op_byte, opcode_str, arg_str, d_register); | |
| 446 | } | |
| 447 | ||
| 448 | ||
| 449 | /* SUBL : .... .... 0100 F001 : A-204 */ | |
| 450 | else if ((op_byte & 0x00f7) == 0x0041) | |
| 451 | { | |
| 452 | size = dsp56k_dasm_subl(op_byte, opcode_str, arg_str, d_register); | |
| 453 | } | |
| 454 | /* SUB : .... .... 0100 FJJJ : A-202 */ | |
| 455 | else if ((op_byte & 0x00f0) == 0x0040) | |
| 456 | { | |
| 457 | size = dsp56k_dasm_sub(op_byte, opcode_str, arg_str, d_register); | |
| 458 | } | |
| 459 | ||
| 460 | ||
| 461 | /* CLR24 : .... .... 0101 F001 : A-62 */ | |
| 462 | else if ((op_byte & 0x00f7) == 0x0051) | |
| 463 | { | |
| 464 | size = dsp56k_dasm_clr2(op_byte, opcode_str, arg_str, d_register); | |
| 465 | } | |
| 466 | /* SBC : .... .... 0101 F01J : A-198 */ | |
| 467 | else if ((op_byte & 0x00f6) == 0x0052) | |
| 468 | { | |
| 469 | size = dsp56k_dasm_sbc(op_byte, opcode_str, arg_str, d_register); | |
| 470 | } | |
| 471 | /* CMP : .... .... 0101 FJJJ : A-64 */ | |
| 472 | else if ((op_byte & 0x00f0) == 0x0050) | |
| 473 | { | |
| 474 | size = dsp56k_dasm_cmp(op_byte, opcode_str, arg_str, d_register); | |
| 475 | } | |
| 476 | ||
| 477 | ||
| 478 | /* NEG : .... .... 0110 F000 : A-166 */ | |
| 479 | else if ((op_byte & 0x00f7) == 0x0060) | |
| 480 | { | |
| 481 | size = dsp56k_dasm_neg(op_byte, opcode_str, arg_str, d_register); | |
| 482 | } | |
| 483 | /* NOT : .... .... 0110 F001 : A-174 */ | |
| 484 | else if ((op_byte & 0x00f7) == 0x0061) | |
| 485 | { | |
| 486 | size = dsp56k_dasm_not(op_byte, opcode_str, arg_str, d_register); | |
| 487 | } | |
| 488 | /* DEC : .... .... 0110 F010 : A-72 */ | |
| 489 | else if ((op_byte & 0x00f7) == 0x0062) | |
| 490 | { | |
| 491 | size = dsp56k_dasm_dec(op_byte, opcode_str, arg_str, d_register); | |
| 492 | } | |
| 493 | /* DEC24 : .... .... 0110 F011 : A-74 */ | |
| 494 | else if ((op_byte & 0x00f7) == 0x0063) | |
| 495 | { | |
| 496 | size = dsp56k_dasm_dec24(op_byte, opcode_str, arg_str, d_register); | |
| 497 | } | |
| 498 | /* AND : .... .... 0110 F1JJ : A-24 */ | |
| 499 | else if ((op_byte & 0x00f4) == 0x0064) | |
| 500 | { | |
| 501 | size = dsp56k_dasm_and(op_byte, opcode_str, arg_str, d_register); | |
| 502 | } | |
| 503 | ||
| 504 | ||
| 505 | /* ABS : .... .... 0111 F001 : A-18 */ | |
| 506 | if ((op_byte & 0x00f7) == 0x0071) | |
| 507 | { | |
| 508 | size = dsp56k_dasm_abs(op_byte, opcode_str, arg_str, d_register); | |
| 509 | } | |
| 510 | /* ROR : .... .... 0111 F010 : A-192 */ | |
| 511 | else if ((op_byte & 0x00f7) == 0x0072) | |
| 512 | { | |
| 513 | size = dsp56k_dasm_ror(op_byte, opcode_str, arg_str, d_register); | |
| 514 | } | |
| 515 | /* ROL : .... .... 0111 F011 : A-190 */ | |
| 516 | else if ((op_byte & 0x00f7) == 0x0073) | |
| 517 | { | |
| 518 | size = dsp56k_dasm_rol(op_byte, opcode_str, arg_str, d_register); | |
| 519 | } | |
| 520 | /* CMPM : .... .... 0111 FJJJ : A-66 */ | |
| 521 | else if ((op_byte & 0x00f0) == 0x0070) | |
| 522 | { | |
| 523 | size = dsp56k_dasm_cmpm(op_byte, opcode_str, arg_str, d_register); | |
| 524 | } | |
| 525 | ||
| 526 | ||
| 527 | /* MPY : .... .... 1k00 FQQQ : A-160 -- CONFIRMED TYPO IN DOCS (HHHH vs HHHW) */ | |
| 528 | else if ((op_byte & 0x00b0) == 0x0080) | |
| 529 | { | |
| 530 | size = dsp56k_dasm_mpy(op_byte, opcode_str, arg_str, d_register); | |
| 531 | } | |
| 532 | /* MPYR : .... .... 1k01 FQQQ : A-162 */ | |
| 533 | else if ((op_byte & 0x00b0) == 0x0090) | |
| 534 | { | |
| 535 | size = dsp56k_dasm_mpyr(op_byte, opcode_str, arg_str, d_register); | |
| 536 | } | |
| 537 | /* MAC : .... .... 1k10 FQQQ : A-122 */ | |
| 538 | else if ((op_byte & 0x00b0) == 0x00a0) | |
| 539 | { | |
| 540 | size = dsp56k_dasm_mac(op_byte, opcode_str, arg_str, d_register); | |
| 541 | } | |
| 542 | /* MACR : .... .... 1k11 FQQQ : A-124 -- DRAMA - rr vs xx (805) */ | |
| 543 | else if ((op_byte & 0x00b0) == 0x00b0) | |
| 544 | { | |
| 545 | size = dsp56k_dasm_macr(op_byte, opcode_str, arg_str, d_register); | |
| 546 | } | |
| 547 | ||
| 548 | ||
| 549 | /* Now evaluate the parallel data move */ | |
| 550 | switch (parallelType) | |
| 551 | { | |
| 552 | case kNoParallelDataMove: | |
| 553 | /* DO NOTHING */ | |
| 554 | size = 1; | |
| 555 | break; | |
| 556 | case kRegisterToRegister: | |
| 557 | decode_register_to_register_data_move(op, parallel_move_str, d_register); | |
| 558 | size = 1; | |
| 559 | break; | |
| 560 | case kAddressRegister: | |
| 561 | decode_address_register_update(op, parallel_move_str); | |
| 562 | size = 1; | |
| 563 | break; | |
| 564 | case kXMemoryDataMove: | |
| 565 | decode_x_memory_data_move(op, parallel_move_str); | |
| 566 | size = 1; | |
| 567 | break; | |
| 568 | case kXMemoryDataMove2: | |
| 569 | decode_x_memory_data_move2(op, parallel_move_str, d_register); | |
| 570 | size = 1; | |
| 571 | break; | |
| 572 | case kXMemoryDataMoveWithDisp: | |
| 573 | decode_x_memory_data_move_with_short_displacement(op, op2, parallel_move_str); | |
| 574 | size = 2; | |
| 575 | break; | |
| 576 | } | |
| 577 | } | |
| 120 | 578 | } |
| 121 | else if (BITS(op,0xf000) == 0x4) /* TODO */ | |
| 579 | ||
| 580 | /* Assemble and return parallel move operation */ | |
| 581 | if (size > 0) | |
| 122 | 582 | { |
| 123 | /* ALU opcode with a parallel register to register move */ | |
| 124 | size = assemble_parallel_register_to_register_moveALU_opcode(buffer, op, op2, pc); | |
| 583 | char space[32] = ""; | |
| 584 | ||
| 585 | pad_string(11, opcode_str); | |
| 586 | if (strlen(parallel_move_str) != 0) | |
| 587 | pad_string(15, arg_str); | |
| 588 | if (strlen(parallel_move_str2) != 0) | |
| 589 | sprintf(space, " "); | |
| 590 | ||
| 591 | sprintf(buffer, "%s%s%s%s%s", opcode_str, arg_str, parallel_move_str, space, parallel_move_str2); | |
| 592 | ||
| 593 | return (size | DASMFLAG_SUPPORTED); | |
| 125 | 594 | } |
| 126 | else if (BITS(op,0xf800) == 0x6) /* TODO */ | |
| 595 | ||
| 596 | ||
| 597 | /******************************/ | |
| 598 | /* Remaining non-parallel ops */ | |
| 599 | /******************************/ | |
| 600 | ||
| 601 | /* ADC : 0001 0101 0000 F01J : A-20 */ | |
| 602 | if ((op & 0xfff6) == 0x1502) | |
| 127 | 603 | { |
| 128 | /* ALU opcode with an address register update */ | |
| 129 | sprintf(buffer, "Parallel address register update unimplemented."); | |
| 130 | size = 1; | |
| 604 | size = dsp56k_dasm_adc(op, opcode_str, arg_str); | |
| 131 | 605 | } |
| 132 | else if (BITS(op,0xf000) == 0x5) | |
| 606 | /* ANDI : 0001 1EE0 iiii iiii : A-26 */ | |
| 607 | /* (MoveP sneaks in here if you don't check 0x0600) */ | |
| 608 | else if (((op & 0xf900) == 0x1800) & ((op & 0x0600) != 0x0000)) | |
| 133 | 609 | { |
| 134 | /* ALU opcode with an cooperative x data memory move */ | |
| 135 | size = assemble_coorperative_x_memory_data_move_ALU_opcode(buffer, op, op2, pc); | |
| 610 | size = dsp56k_dasm_andi(op, opcode_str, arg_str); | |
| 136 | 611 | } |
| 137 | else if (BITS(op,0xff00) == 0x05) /* TODO */ | |
| 612 | /* ASL4 : 0001 0101 0011 F001 : A-30 */ | |
| 613 | else if ((op & 0xfff7) == 0x1531) | |
| 138 | 614 | { |
| 139 | /* ALU opcode with x memory data move + short displacement */ | |
| 140 | sprintf(buffer, "Parallel x memory data move + short displacement unimplemented."); | |
| 141 | size = 2; | |
| 615 | size = dsp56k_dasm_asl4(op, opcode_str, arg_str); | |
| 142 | 616 | } |
| 143 | else if (BITS(op,0xfe00) == 0xb) /* TODO */ | |
| 617 | /* ASR4 : 0001 0101 0011 F000 : A-34 */ | |
| 618 | else if ((op & 0xfff7) == 0x1530) | |
| 144 | 619 | { |
| 145 | /* ALU opcode with x memory data write and register data move */ | |
| 146 | /* Don't forget these two, unique cases */ | |
| 147 | /* MPY X 0001 0110 xxxx xxxx */ | |
| 148 | /* MAC X 0001 0111 xxxx xxxx */ | |
| 149 | sprintf(buffer, "Parallel x memory data write and register data move unimplemented."); | |
| 150 | size = 1; | |
| 620 | size = dsp56k_dasm_asr4(op, opcode_str, arg_str); | |
| 151 | 621 | } |
| 152 | ||
| 153 | /* Tcc is a unique critter */ | |
| 154 | if (BITS(op,0xfc00) == 0x4) | |
| 622 | /* ASR16 : 0001 0101 0111 F000 : A-36 */ | |
| 623 | else if ((op & 0xfff7) == 0x1570) | |
| 155 | 624 | { |
| 156 | size = as | |
| 625 | size = dsp56k_das | |
| 157 | 626 | } |
| 158 | ||
| 159 | /* Operations that do not allow a parallel move */ | |
| 160 | if (BITS(op,0xff00) == 0x14) | |
| 627 | /* BFCHG : 0001 0100 11Pp pppp BBB1 0010 iiii iiii : A-38 */ | |
| 628 | else if (((op & 0xffc0) == 0x14c0) && ((op2 & 0x1f00) == 0x1200)) | |
| 161 | 629 | { |
| 162 | size = as | |
| 630 | size = dsp56k_das | |
| 163 | 631 | } |
| 164 | if (BITS(op,0xff00) == 0x15) | |
| 632 | /* BFCHG : 0001 0100 101- --RR BBB1 0010 iiii iiii : A-38 */ | |
| 633 | else if (((op & 0xffe0) == 0x14a0) && ((op2 & 0x1f00) == 0x1200)) | |
| 165 | 634 | { |
| 166 | size = | |
| 635 | size = ds | |
| 167 | 636 | } |
| 168 | if (BITS(op,0xf800) == 0x3) | |
| 637 | /* BFCHG : 0001 0100 100D DDDD BBB1 0010 iiii iiii : A-38 */ | |
| 638 | else if (((op & 0xffe0) == 0x1480) && ((op2 & 0x1f00) == 0x1200)) | |
| 169 | 639 | { |
| 170 | size = | |
| 640 | size = dsp56k | |
| 171 | 641 | } |
| 172 | if (BITS(op,0xf800) == 0x7) | |
| 642 | /* BFCLR : 0001 0100 11Pp pppp BBB0 0100 iiii iiii : A-40 */ | |
| 643 | else if (((op & 0xffc0) == 0x14c0) && ((op2 & 0x1f00) == 0x0400)) | |
| 173 | 644 | { |
| 174 | size = as | |
| 645 | size = dsp56k_das | |
| 175 | 646 | } |
| 176 | if (BITS(op,0xf000) == 0x2) | |
| 647 | /* BFCLR : 0001 0100 101- --RR BBB0 0100 iiii iiii : A-40 */ | |
| 648 | else if (((op & 0xffe0) == 0x14a0) && ((op2 & 0x1f00) == 0x0400)) | |
| 177 | 649 | { |
| 178 | size = as | |
| 650 | size = dsp56k_das | |
| 179 | 651 | } |
| 180 | ||
| 181 | if (BITS(op,0xf000) == 0x0) | |
| 652 | /* BFCLR : 0001 0100 100D DDDD BBB0 0100 iiii iiii : A-40 */ | |
| 653 | else if (((op & 0xffe0) == 0x1480) && ((op2 & 0x1f00) == 0x0400)) | |
| 182 | 654 | { |
| 183 | size = as | |
| 655 | size = dsp56k_das | |
| 184 | 656 | } |
| 657 | /* BFSET : 0001 0100 11Pp pppp BBB1 1000 iiii iiii : A-42 */ | |
| 658 | else if (((op & 0xffc0) == 0x14c0) && ((op2 & 0x1f00) == 0x1800)) | |
| 659 | { | |
| 660 | size = dsp56k_dasm_bfop(op, op2, opcode_str, arg_str); | |
| 661 | } | |
| 662 | /* BFSET : 0001 0100 101- --RR BBB1 1000 iiii iiii : A-42 */ | |
| 663 | else if (((op & 0xffe0) == 0x14a0) && ((op2 & 0x1f00) == 0x1800)) | |
| 664 | { | |
| 665 | size = dsp56k_dasm_bfop(op, op2, opcode_str, arg_str); | |
| 666 | } | |
| 667 | /* BFSET : 0001 0100 100D DDDD BBB1 1000 iiii iiii : A-42 */ | |
| 668 | else if (((op & 0xffe0) == 0x1480) && ((op2 & 0x1f00) == 0x1800)) | |
| 669 | { | |
| 670 | size = dsp56k_dasm_bfop(op, op2, opcode_str, arg_str); | |
| 671 | } | |
| 672 | /* BFTSTH : 0001 0100 01Pp pppp BBB1 0000 iiii iiii : A-44 */ | |
| 673 | else if (((op & 0xffc0) == 0x1440) && ((op2 & 0x1f00) == 0x1000)) | |
| 674 | { | |
| 675 | size = dsp56k_dasm_bfop(op, op2, opcode_str, arg_str); | |
| 676 | } | |
| 677 | /* BFTSTH : 0001 0100 001- --RR BBB1 0000 iiii iiii : A-44 */ | |
| 678 | else if (((op & 0xffe0) == 0x1420) && ((op2 & 0x1f00) == 0x1000)) | |
| 679 | { | |
| 680 | size = dsp56k_dasm_bfop(op, op2, opcode_str, arg_str); | |
| 681 | } | |
| 682 | /* BFTSTH : 0001 0100 000D DDDD BBB1 0000 iiii iiii : A-44 */ | |
| 683 | else if (((op & 0xffe0) == 0x1400) && ((op2 & 0x1f00) == 0x1000)) | |
| 684 | { | |
| 685 | size = dsp56k_dasm_bfop(op, op2, opcode_str, arg_str); | |
| 686 | } | |
| 687 | /* BFTSTL : 0001 0100 01Pp pppp BBB0 0000 iiii iiii : A-46 */ | |
| 688 | else if (((op & 0xffc0) == 0x1440) && ((op2 & 0x1f00) == 0x0000)) | |
| 689 | { | |
| 690 | size = dsp56k_dasm_bfop(op, op2, opcode_str, arg_str); | |
| 691 | } | |
| 692 | /* BFTSTL : 0001 0100 001- --RR BBB0 0000 iiii iiii : A-46 */ | |
| 693 | else if (((op & 0xffe0) == 0x1420) && ((op2 & 0x1f00) == 0x0000)) | |
| 694 | { | |
| 695 | size = dsp56k_dasm_bfop(op, op2, opcode_str, arg_str); | |
| 696 | } | |
| 697 | /* BFTSTL : 0001 0100 000D DDDD BBB0 0000 iiii iiii : A-46 */ | |
| 698 | else if (((op & 0xffe0) == 0x1400) && ((op2 & 0x1f00) == 0x0000)) | |
| 699 | { | |
| 700 | size = dsp56k_dasm_bfop(op, op2, opcode_str, arg_str); | |
| 701 | } | |
| 702 | /* Bcc : 0000 0111 --11 cccc xxxx xxxx xxxx xxxx : A-48 */ | |
| 703 | else if (((op & 0xff30) == 0x0730) && ((op2 & 0x0000) == 0x0000)) | |
| 704 | { | |
| 705 | size = dsp56k_dasm_bcc(op, op2, opcode_str, arg_str, pc); | |
| 706 | } | |
| 707 | /* Bcc : 0010 11cc ccee eeee : A-48 */ | |
| 708 | else if ((op & 0xfc00) == 0x2c00) | |
| 709 | { | |
| 710 | size = dsp56k_dasm_bcc_1(op, opcode_str, arg_str, pc); | |
| 711 | } | |
| 712 | /* Bcc : 0000 0111 RR10 cccc : A-48 */ | |
| 713 | else if ((op & 0xff30) == 0x0720) | |
| 714 | { | |
| 715 | size = dsp56k_dasm_bcc_2(op, opcode_str, arg_str); | |
| 716 | } | |
| 717 | /* BRA : 0000 0001 0011 11-- xxxx xxxx xxxx xxxx : A-50 */ | |
| 718 | else if (((op & 0xfffc) == 0x013c) && ((op2 & 0x0000) == 0x0000)) | |
| 719 | { | |
| 720 | size = dsp56k_dasm_bra(op, op2, opcode_str, arg_str, pc); | |
| 721 | } | |
| 722 | /* BRA : 0000 1011 aaaa aaaa : A-50 */ | |
| 723 | else if ((op & 0xff00) == 0x0b00) | |
| 724 | { | |
| 725 | size = dsp56k_dasm_bra_1(op, opcode_str, arg_str, pc); | |
| 726 | } | |
| 727 | /* BRA : 0000 0001 0010 11RR : A-50 */ | |
| 728 | else if ((op & 0xfffc) == 0x012c) | |
| 729 | { | |
| 730 | size = dsp56k_dasm_bra_2(op, opcode_str, arg_str); | |
| 731 | } | |
| 732 | /* BRKc : 0000 0001 0001 cccc : A-52 */ | |
| 733 | else if ((op & 0xfff0) == 0x0110) | |
| 734 | { | |
| 735 | size = dsp56k_dasm_brkc(op, opcode_str, arg_str); | |
| 736 | } | |
| 737 | /* BScc : 0000 0111 --01 cccc xxxx xxxx xxxx xxxx : A-54 */ | |
| 738 | else if (((op & 0xff30) == 0x0710) && ((op2 & 0x0000) == 0x0000)) | |
| 739 | { | |
| 740 | size = dsp56k_dasm_bscc(op, op2, opcode_str, arg_str, pc); | |
| 741 | } | |
| 742 | /* BScc: 0000 0111 RR00 cccc : A-54 */ | |
| 743 | else if ((op & 0xff30) == 0x0700) | |
| 744 | { | |
| 745 | size = dsp56k_dasm_bscc_1(op, opcode_str, arg_str); | |
| 746 | } | |
| 747 | /* BSR : 0000 0001 0011 10-- xxxx xxxx xxxx xxxx : A-56 */ | |
| 748 | else if (((op & 0xfffc) == 0x0138) && ((op2 & 0x0000) == 0x0000)) | |
| 749 | { | |
| 750 | size = dsp56k_dasm_bsr(op, op2, opcode_str, arg_str, pc); | |
| 751 | } | |
| 752 | /* BSR : 0000 0001 0010 10RR : A-56 */ | |
| 753 | else if ((op & 0xfffc) == 0x0128) | |
| 754 | { | |
| 755 | size = dsp56k_dasm_bsr_1(op, opcode_str, arg_str); | |
| 756 | } | |
| 757 | /* CHKAAU : 0000 0000 0000 0100 : A-58 */ | |
| 758 | else if ((op & 0xffff) == 0x0004) | |
| 759 | { | |
| 760 | size = dsp56k_dasm_chkaau(op, opcode_str, arg_str); | |
| 761 | } | |
| 762 | /* DEBUG : 0000 0000 0000 0001 : A-68 */ | |
| 763 | else if ((op & 0xffff) == 0x0001) | |
| 764 | { | |
| 765 | size = dsp56k_dasm_debug(op, opcode_str, arg_str); | |
| 766 | } | |
| 767 | /* DEBUGcc : 0000 0000 0101 cccc : A-70 */ | |
| 768 | else if ((op & 0xfff0) == 0x0050) | |
| 769 | { | |
| 770 | size = dsp56k_dasm_debugcc(op, opcode_str, arg_str); | |
| 771 | } | |
| 772 | /* DIV : 0001 0101 0--0 F1DD : A-76 */ | |
| 773 | /* WARNING : DOCS SAY THERE IS A PARALLEL MOVE HERE !!! */ | |
| 774 | else if ((op & 0xff94) == 0x1504) | |
| 775 | { | |
| 776 | size = dsp56k_dasm_div(op, opcode_str, arg_str); | |
| 777 | } | |
| 778 | /* DMAC : 0001 0101 10s1 FsQQ : A-80 */ | |
| 779 | else if ((op & 0xffd0) == 0x1590) | |
| 780 | { | |
| 781 | size = dsp56k_dasm_dmac(op, opcode_str, arg_str); | |
| 782 | } | |
| 783 | /* DO : 0000 0000 110- --RR xxxx xxxx xxxx xxxx : A-82 */ | |
| 784 | else if (((op & 0xffe0) == 0x00c0) && ((op2 & 0x0000) == 0x0000)) | |
| 785 | { | |
| 786 | size = dsp56k_dasm_do(op, op2, opcode_str, arg_str); | |
| 787 | } | |
| 788 | /* DO : 0000 1110 iiii iiii xxxx xxxx xxxx xxxx : A-82 */ | |
| 789 | else if (((op & 0xff00) == 0x0e00) && ((op2 & 0x0000) == 0x0000)) | |
| 790 | { | |
| 791 | size = dsp56k_dasm_do_1(op, op2, opcode_str, arg_str); | |
| 792 | } | |
| 793 | /* DO : 0000 0100 000D DDDD xxxx xxxx xxxx xxxx : A-82 */ | |
| 794 | else if (((op & 0xffe0) == 0x0400) && ((op2 & 0x0000) == 0x0000)) | |
| 795 | { | |
| 796 | size = dsp56k_dasm_do_2(op, op2, opcode_str, arg_str); | |
| 797 | } | |
| 798 | /* DO FOREVER : 0000 0000 0000 0010 xxxx xxxx xxxx xxxx : A-88 */ | |
| 799 | else if (((op & 0xffff) == 0x0002) && ((op2 & 0x0000) == 0x0000)) | |
| 800 | { | |
| 801 | size = dsp56k_dasm_doforever(op, op2, opcode_str, arg_str); | |
| 802 | } | |
| 803 | /* ENDDO : 0000 0000 0000 1001 : A-92 */ | |
| 804 | else if ((op & 0xffff) == 0x0009) | |
| 805 | { | |
| 806 | size = dsp56k_dasm_enddo(op, opcode_str, arg_str); | |
| 807 | } | |
| 808 | /* EXT : 0001 0101 0101 F010 : A-96 */ | |
| 809 | else if ((op & 0xfff7) == 0x1552) | |
| 810 | { | |
| 811 | size = dsp56k_dasm_ext(op, opcode_str, arg_str); | |
| 812 | } | |
| 813 | /* ILLEGAL : 0000 0000 0000 1111 : A-98 */ | |
| 814 | else if ((op & 0xffff) == 0x000f) | |
| 815 | { | |
| 816 | size = dsp56k_dasm_illegal(op, opcode_str, arg_str); | |
| 817 | } | |
| 818 | /* IMAC : 0001 0101 1010 FQQQ : A-100 */ | |
| 819 | else if ((op & 0xfff0) == 0x15a0) | |
| 820 | { | |
| 821 | size = dsp56k_dasm_imac(op, opcode_str, arg_str); | |
| 822 | } | |
| 823 | /* IMPY : 0001 0101 1000 FQQQ : A-102 */ | |
| 824 | else if ((op & 0xfff0) == 0x1580) | |
| 825 | { | |
| 826 | size = dsp56k_dasm_impy(op, opcode_str, arg_str); | |
| 827 | } | |
| 828 | /* Jcc : 0000 0110 --11 cccc xxxx xxxx xxxx xxxx : A-108 */ | |
| 829 | else if (((op & 0xff30) == 0x0630) && ((op2 & 0x0000) == 0x0000)) | |
| 830 | { | |
| 831 | size = dsp56k_dasm_jcc(op, op2, opcode_str, arg_str); | |
| 832 | } | |
| 833 | /* Jcc : 0000 0110 RR10 cccc : A-108 */ | |
| 834 | else if ((op & 0xff30) == 0x0620 ) | |
| 835 | { | |
| 836 | size = dsp56k_dasm_jcc_1(op, opcode_str, arg_str); | |
| 837 | } | |
| 838 | /* JMP : 0000 0001 0011 01-- xxxx xxxx xxxx xxxx : A-110 */ | |
| 839 | else if (((op & 0xfffc) == 0x0134) && ((op2 & 0x0000) == 0x0000)) | |
| 840 | { | |
| 841 | size = dsp56k_dasm_jmp(op, op2, opcode_str, arg_str); | |
| 842 | } | |
| 843 | /* JMP : 0000 0001 0010 01RR : A-110 */ | |
| 844 | else if ((op & 0xfffc) == 0x0124) | |
| 845 | { | |
| 846 | size = dsp56k_dasm_jmp_1(op, opcode_str, arg_str); | |
| 847 | } | |
| 848 | /* JScc : 0000 0110 --01 cccc xxxx xxxx xxxx xxxx : A-112 */ | |
| 849 | else if (((op & 0xff30) == 0x0610) && ((op2 & 0x0000) == 0x0000)) | |
| 850 | { | |
| 851 | size = dsp56k_dasm_jscc(op, op2, opcode_str, arg_str); | |
| 852 | } | |
| 853 | /* JScc : 0000 0110 RR00 cccc : A-112 */ | |
| 854 | else if ((op & 0xff30) == 0x0600) | |
| 855 | { | |
| 856 | size = dsp56k_dasm_jscc_1(op, opcode_str, arg_str); | |
| 857 | } | |
| 858 | /* JSR : 0000 0001 0011 00-- xxxx xxxx xxxx xxxx : A-114 */ | |
| 859 | else if (((op & 0xfffc) == 0x0130) && ((op2 & 0x0000) == 0x0000)) | |
| 860 | { | |
| 861 | size = dsp56k_dasm_jsr(op, op2, opcode_str, arg_str); | |
| 862 | } | |
| 863 | /* JSR : 0000 1010 AAAA AAAA : A-114 */ | |
| 864 | else if ((op & 0xff00) == 0x0a00) | |
| 865 | { | |
| 866 | size = dsp56k_dasm_jsr_1(op, opcode_str, arg_str); | |
| 867 | } | |
| 868 | /* JSR : 0000 0001 0010 00RR : A-114 */ | |
| 869 | else if ((op & 0xfffc) == 0x0120) | |
| 870 | { | |
| 871 | size = dsp56k_dasm_jsr_2(op, opcode_str, arg_str); | |
| 872 | } | |
| 873 | /* LEA : 0000 0001 11TT MMRR : A-116 */ | |
| 874 | else if ((op & 0xffc0) == 0x01c0) | |
| 875 | { | |
| 876 | size = dsp56k_dasm_lea(op, opcode_str, arg_str); | |
| 877 | } | |
| 878 | /* LEA : 0000 0001 10NN MMRR : A-116 */ | |
| 879 | else if ((op & 0xffc0) == 0x0180) | |
| 880 | { | |
| 881 | size = dsp56k_dasm_lea_1(op, opcode_str, arg_str); | |
| 882 | } | |
| 883 | /* MAC(su,uu) : 0001 0101 1110 FsQQ : A-126 */ | |
| 884 | else if ((op & 0xfff0) == 0x15e0) | |
| 885 | { | |
| 886 | size = dsp56k_dasm_macsuuu(op, opcode_str, arg_str); | |
| 887 | } | |
| 888 | /* MOVE : 0000 0101 BBBB BBBB ---- HHHW 0001 0001 : A-128 */ | |
| 889 | else if (((op & 0xff00) == 0x0500) && ((op2 & 0x00ff) == 0x0011)) | |
| 890 | { | |
| 891 | size = dsp56k_dasm_move_2(op, op2, opcode_str, arg_str); | |
| 892 | } | |
| 893 | /* MOVE(C) : 0011 1WDD DDD0 MMRR : A-144 */ | |
| 894 | else if ((op & 0xf810) == 0x3800) | |
| 895 | { | |
| 896 | size = dsp56k_dasm_movec(op, opcode_str, arg_str); | |
| 897 | } | |
| 898 | /* MOVE(C) : 0011 1WDD DDD1 q0RR : A-144 */ | |
| 899 | else if ((op & 0xf814) == 0x3810) | |
| 900 | { | |
| 901 | size = dsp56k_dasm_movec_1(op, opcode_str, arg_str); | |
| 902 | } | |
| 903 | /* MOVE(C) : 0011 1WDD DDD1 Z11- : A-144 */ | |
| 904 | else if ((op & 0xf816) == 0x3816) | |
| 905 | { | |
| 906 | size = dsp56k_dasm_movec_2(op, opcode_str, arg_str); | |
| 907 | } | |
| 908 | /* MOVE(C) : 0011 1WDD DDD1 t10- xxxx xxxx xxxx xxxx : A-144 */ | |
| 909 | else if (((op & 0xf816) == 0x3814) && ((op2 & 0x0000) == 0x0000)) | |
| 910 | { | |
| 911 | size = dsp56k_dasm_movec_3(op, op2, opcode_str, arg_str); | |
| 912 | } | |
| 913 | /* MOVE(C) : 0010 10dd dddD DDDD : A-144 */ | |
| 914 | else if ((op & 0xfc00) == 0x2800) | |
| 915 | { | |
| 916 | size = dsp56k_dasm_movec_4(op, opcode_str, arg_str); | |
| 917 | } | |
| 918 | /* MOVE(C) : 0000 0101 BBBB BBBB 0011 1WDD DDD0 ---- : A-144 */ | |
| 919 | else if (((op & 0xff00) == 0x0500) && ((op2 & 0xf810) == 0x3800)) | |
| 920 | { | |
| 921 | size = dsp56k_dasm_movec_5(op, op2, opcode_str, arg_str); | |
| 922 | } | |
| 923 | /* MOVE(I) : 0010 00DD BBBB BBBB : A-150 */ | |
| 924 | else if ((op & 0xfc00) == 0x2000) | |
| 925 | { | |
| 926 | size = dsp56k_dasm_movei(op, opcode_str, arg_str); | |
| 927 | } | |
| 928 | /* MOVE(M) : 0000 001W RR0M MHHH : A-152 */ | |
| 929 | else if ((op & 0xfe20) == 0x0200) | |
| 930 | { | |
| 931 | size = dsp56k_dasm_movem(op, opcode_str, arg_str); | |
| 932 | } | |
| 933 | /* MOVE(M) : 0000 001W RR11 mmRR : A-152 */ | |
| 934 | else if ((op & 0xfe30) == 0x0230) | |
| 935 | { | |
| 936 | size = dsp56k_dasm_movem_1(op, opcode_str, arg_str); | |
| 937 | } | |
| 938 | /* MOVE(M) : 0000 0101 BBBB BBBB 0000 001W --0- -HHH : A-152 */ | |
| 939 | else if (((op & 0xff00) == 0x0500) && ((op2 & 0xfe20) == 0x0200)) | |
| 940 | { | |
| 941 | size = dsp56k_dasm_movem_2(op, op2, opcode_str, arg_str); | |
| 942 | } | |
| 943 | /* MOVE(P) : 0001 100W HH1p pppp : A-156 */ | |
| 944 | else if ((op & 0xfe20) == 0x1820) | |
| 945 | { | |
| 946 | size = dsp56k_dasm_movep(op, opcode_str, arg_str); | |
| 947 | } | |
| 948 | /* MOVE(P) : 0000 110W RRmp pppp : A-156 */ | |
| 949 | else if ((op & 0xfe00) == 0x0c00) | |
| 950 | { | |
| 951 | size = dsp56k_dasm_movep_1(op, opcode_str, arg_str); | |
| 952 | } | |
| 953 | /* MOVE(S) : 0001 100W HH0a aaaa : A-158 */ | |
| 954 | else if ((op & 0xfe20) == 0x1800) | |
| 955 | { | |
| 956 | size = dsp56k_dasm_moves(op, opcode_str, arg_str); | |
| 957 | } | |
| 958 | /* MPY(su,uu) : 0001 0101 1100 FsQQ : A-164 */ | |
| 959 | else if ((op & 0xfff0) == 0x15c0) | |
| 960 | { | |
| 961 | size = dsp56k_dasm_mpysuuu(op, opcode_str, arg_str); | |
| 962 | } | |
| 963 | /* NEGC : 0001 0101 0110 F000 : A-168 */ | |
| 964 | else if ((op & 0xfff7) == 0x1560) | |
| 965 | { | |
| 966 | size = dsp56k_dasm_negc(op, opcode_str, arg_str); | |
| 967 | } | |
| 968 | /* NOP : 0000 0000 0000 0000 : A-170 */ | |
| 969 | else if ((op & 0xffff) == 0x0000) | |
| 970 | { | |
| 971 | size = dsp56k_dasm_nop(op, opcode_str, arg_str); | |
| 972 | } | |
| 973 | /* NORM : 0001 0101 0010 F0RR : A-172 */ | |
| 974 | else if ((op & 0xfff4) == 0x1520) | |
| 975 | { | |
| 976 | size = dsp56k_dasm_norm(op, opcode_str, arg_str); | |
| 977 | } | |
| 978 | /* ORI : 0001 1EE1 iiii iiii : A-178 */ | |
| 979 | else if ((op & 0xf900) == 0x1900) | |
| 980 | { | |
| 981 | size = dsp56k_dasm_ori(op, opcode_str, arg_str); | |
| 982 | } | |
| 983 | /* REP : 0000 0000 111- --RR : A-180 */ | |
| 984 | else if ((op & 0xffe0) == 0x00e0) | |
| 985 | { | |
| 986 | size = dsp56k_dasm_rep(op, opcode_str, arg_str); | |
| 987 | } | |
| 988 | /* REP : 0000 1111 iiii iiii : A-180 */ | |
| 989 | else if ((op & 0xff00) == 0x0f00) | |
| 990 | { | |
| 991 | size = dsp56k_dasm_rep_1(op, opcode_str, arg_str); | |
| 992 | } | |
| 993 | /* REP : 0000 0100 001D DDDD : A-180 */ | |
| 994 | else if ((op & 0xffe0) == 0x0420) | |
| 995 | { | |
| 996 | size = dsp56k_dasm_rep_2(op, opcode_str, arg_str); | |
| 997 | } | |
| 998 | /* REPcc : 0000 0001 0101 cccc : A-184 */ | |
| 999 | else if ((op & 0xfff0) == 0x0150) | |
| 1000 | { | |
| 1001 | size = dsp56k_dasm_repcc(op, opcode_str, arg_str); | |
| 1002 | } | |
| 1003 | /* RESET : 0000 0000 0000 1000 : A-186 */ | |
| 1004 | else if ((op & 0xffff) == 0x0008) | |
| 1005 | { | |
| 1006 | size = dsp56k_dasm_reset(op, opcode_str, arg_str); | |
| 1007 | } | |
| 1008 | /* RTI : 0000 0000 0000 0111 : A-194 */ | |
| 1009 | else if ((op & 0xffff) == 0x0007) | |
| 1010 | { | |
| 1011 | size = dsp56k_dasm_rti(op, opcode_str, arg_str); | |
| 1012 | } | |
| 1013 | /* RTS : 0000 0000 0000 0110 : A-196 */ | |
| 1014 | else if ((op & 0xffff) == 0x0006) | |
| 1015 | { | |
| 1016 | size = dsp56k_dasm_rts(op, opcode_str, arg_str); | |
| 1017 | } | |
| 1018 | /* STOP : 0000 0000 0000 1010 : A-200 */ | |
| 1019 | else if ((op & 0xffff) == 0x000a) | |
| 1020 | { | |
| 1021 | size = dsp56k_dasm_stop(op, opcode_str, arg_str); | |
| 1022 | } | |
| 1023 | /* SWAP : 0001 0101 0111 F001 : A-206 */ | |
| 1024 | else if ((op & 0xfff7) == 0x1571) | |
| 1025 | { | |
| 1026 | size = dsp56k_dasm_swap(op, opcode_str, arg_str); | |
| 1027 | } | |
| 1028 | /* SWI : 0000 0000 0000 0101 : A-208 */ | |
| 1029 | else if ((op & 0xffff) == 0x0005) | |
| 1030 | { | |
| 1031 | size = dsp56k_dasm_swi(op, opcode_str, arg_str); | |
| 1032 | } | |
| 1033 | /* Tcc : 0001 00cc ccTT Fh0h : A-210 */ | |
| 1034 | else if ((op & 0xfc02) == 0x1000) | |
| 1035 | { | |
| 1036 | size = dsp56k_dasm_tcc(op, opcode_str, arg_str); | |
| 1037 | } | |
| 1038 | /* TFR(2) : 0001 0101 0000 F00J : A-214 */ | |
| 1039 | else if ((op & 0xfff6) == 0x1500) | |
| 1040 | { | |
| 1041 | size = dsp56k_dasm_tfr2(op, opcode_str, arg_str); | |
| 1042 | } | |
| 1043 | /* TFR(3) : 0010 01mW RRDD FHHH : A-216 */ | |
| 1044 | else if ((op & 0xfc00) == 0x2400) | |
| 1045 | { | |
| 1046 | size = dsp56k_dasm_tfr3(op, opcode_str, arg_str); | |
| 1047 | } | |
| 1048 | /* TST(2) : 0001 0101 0001 -1DD : A-220 */ | |
| 1049 | else if ((op & 0xfff4) == 0x1514) | |
| 1050 | { | |
| 1051 | size = dsp56k_dasm_tst2(op, opcode_str, arg_str); | |
| 1052 | } | |
| 1053 | /* WAIT : 0000 0000 0000 1011 : A-222 */ | |
| 1054 | else if ((op & 0xffff) == 0x000b) | |
| 1055 | { | |
| 1056 | size = dsp56k_dasm_wait(op, opcode_str, arg_str); | |
| 1057 | } | |
| 1058 | /* ZERO : 0001 0101 0101 F000 : A-224 */ | |
| 1059 | else if ((op & 0xfff7) == 0x1550) | |
| 1060 | { | |
| 1061 | size = dsp56k_dasm_zero(op, opcode_str, arg_str); | |
| 1062 | } | |
| 185 | 1063 | |
| 186 | /* Not recognized? Nudge debugger onto the next opcode. */ | |
| 187 | if (size == 0) | |
| 1064 | ||
| 1065 | /* Assemble opcode string buffer */ | |
| 1066 | if (size >= 1) | |
| 188 | 1067 | { |
| 1068 | pad_string(11, opcode_str); | |
| 1069 | sprintf(buffer, "%s%s", opcode_str, arg_str); | |
| 1070 | } | |
| 1071 | /* Not recognized? Nudge debugger onto the next word */ | |
| 1072 | else if (size == 0) | |
| 1073 | { | |
| 189 | 1074 | sprintf(buffer, "unknown"); |
| 190 | 1075 | size = 1; |
| 191 | 1076 | } |
| 192 | 1077 | |
| 193 | return size | DASMFLAG_SUPPORTED; | |
| 1078 | return (size | DASMFLAG_SUPPORTED); | |
| 194 | 1079 | } |
| 195 | 1080 | |
| 196 | static unsigned assemble_x_memory_data_move_ALU_opcode(char* buffer, const UINT16 op, const UINT16 op2, const unsigned pc) | |
| 197 | { | |
| 198 | /* All operations are of length 1 */ | |
| 199 | unsigned opSize = 1; | |
| 200 | 1081 | |
| 201 | /* Recovered strings */ | |
| 202 | char arg_str[128] = ""; | |
| 203 | char opcode_str[128] = ""; | |
| 204 | char parallel_move_str[128] = ""; | |
| 205 | char d_register[128] = ""; | |
| 1082 | /*******************************/ | |
| 1083 | /* 32 Parallel move operations */ | |
| 1084 | /*******************************/ | |
| 206 | 1085 | |
| 207 | /* Init */ | |
| 208 | sprintf(buffer, " "); | |
| 1086 | /* ADD : 011m mKKK 0rru Fuuu : A-22 */ | |
| 1087 | static size_t dsp56k_dasm_add_2(const UINT16 op_byte, char* opcode_str, char* arg_str) | |
| 1088 | { | |
| 1089 | /* TODO: How strange. Same as SUB? Investigate */ | |
| 1090 | char D[32]; | |
| 1091 | char S1[32]; | |
| 1092 | char arg[32]; | |
| 1093 | decode_uuuuF_table(BITS(op_byte,0x17), BITS(op_byte,0x08), arg, S1, D); | |
| 1094 | sprintf(opcode_str, "%s", arg); | |
| 1095 | sprintf(arg_str, "%s,%s", S1, D); | |
| 1096 | return 1; | |
| 1097 | } | |
| 209 | 1098 | |
| 210 | /* First, decode the Data ALU opcode */ | |
| 211 | decode_data_ALU_opcode(BITS(op,0x00ff), opcode_str, arg_str, d_register); | |
| 1099 | /* MAC : 011m mKKK 1xx0 F1QQ : A-122 */ | |
| 1100 | static size_t dsp56k_dasm_mac_1(const UINT16 op_byte, char* opcode_str, char* arg_str) | |
| 1101 | { | |
| 1102 | char D[32]; | |
| 1103 | char S1[32]; | |
| 1104 | char S2[32]; | |
| 1105 | /* Oddly, these 4 mpxx ops have identical operand ordering as compared to single memory move equivalents */ | |
| 1106 | decode_QQF_table(BITS(op_byte,0x03), BITS(op_byte,0x08), S1, S2, D); | |
| 1107 | sprintf(arg_str, "%s,%s,%s", S1, S2, D); | |
| 1108 | sprintf(opcode_str, "mac"); | |
| 1109 | return 1; | |
| 1110 | } | |
| 212 | 1111 | |
| 213 | /* Next, decode the X Memory Data Move */ | |
| 214 | decode_x_memory_data_move(BITS(op,0xff00), parallel_move_str); | |
| 1112 | /* MACR: 011m mKKK 1--1 F1QQ : A-124 */ | |
| 1113 | static size_t dsp56k_dasm_macr_1(const UINT16 op_byte, char* opcode_str, char* arg_str) | |
| 1114 | { | |
| 1115 | char D[32]; | |
| 1116 | char S1[32]; | |
| 1117 | char S2[32]; | |
| 1118 | /* Oddly, these 4 mpxx ops have identical operand ordering as compared to single memory move equivalents */ | |
| 1119 | decode_QQF_table(BITS(op_byte,0x03), BITS(op_byte,0x08), S1, S2, D); | |
| 1120 | sprintf(arg_str, "%s,%s,%s", S1, S2, D); | |
| 1121 | sprintf(opcode_str, "macr"); | |
| 1122 | return 1; | |
| 1123 | } | |
| 215 | 1124 | |
| 216 | /* Finally, assemble the full opcode */ | |
| 217 | pad_string(11, opcode_str); | |
| 218 | pad_string(15, arg_str); | |
| 219 | sprintf(buffer, "%s%s%s", opcode_str, arg_str, parallel_move_str); | |
| 1125 | /* MOVE : 011m mKKK 0rr1 0000 : A-128 */ | |
| 1126 | static size_t dsp56k_dasm_move_1(const UINT16 op_byte, char* opcode_str, char* arg_str) | |
| 1127 | { | |
| 1128 | /* TODO: This MOVE opcode is .identical. to the TFR one. Investigate */ | |
| 1129 | char D[32]; | |
| 1130 | char S1[32]; | |
| 1131 | decode_DDF_table(BITS(op_byte,0x03), BITS(op_byte,0x08), S1, D); | |
| 1132 | sprintf(opcode_str, "tfr"); | |
| 1133 | sprintf(arg_str, "%s,%s", S1, D); | |
| 1134 | return 1; | |
| 1135 | } | |
| 220 | 1136 | |
| 221 | return opSize; | |
| 1137 | /* MPY : 011m mKKK 1xx0 F0QQ : A-160 */ | |
| 1138 | static size_t dsp56k_dasm_mpy_1(const UINT16 op_byte, char* opcode_str, char* arg_str) | |
| 1139 | { | |
| 1140 | char D[32]; | |
| 1141 | char S1[32]; | |
| 1142 | char S2[32]; | |
| 1143 | /* Oddly, these 4 mpxx ops have identical operand ordering as compared to single memory move equivalents */ | |
| 1144 | decode_QQF_table(BITS(op_byte,0x03), BITS(op_byte,0x08), S1, S2, D); | |
| 1145 | sprintf(arg_str, "%s,%s,%s", S1, S2, D); | |
| 1146 | sprintf(opcode_str, "mpy"); | |
| 1147 | return 1; | |
| 222 | 1148 | } |
| 223 | 1149 | |
| 224 | static unsigned assemble_dual_x_memory_data_read_ALU_opcode(char* buffer, const UINT16 op, const UINT16 op2, const unsigned pc) | |
| 1150 | /* MPYR : 011m mKKK 1--1 F0QQ : A-162 */ | |
| 1151 | static size_t dsp56k_dasm_mpyr_1(const UINT16 op_byte, char* opcode_str, char* arg_str) | |
| 225 | 1152 | { |
| 226 | /* All operations are of length 1 */ | |
| 227 | unsigned opSize = 1; | |
| 1153 | char D[32]; | |
| 1154 | char S1[32]; | |
| 1155 | char S2[32]; | |
| 1156 | /* Oddly, these 4 mpxx ops have identical operand ordering as compared to single memory move equivalents */ | |
| 1157 | decode_QQF_table(BITS(op_byte,0x03), BITS(op_byte,0x08), S1, S2, D); | |
| 1158 | sprintf(arg_str, "%s,%s,%s", S1, S2, D); | |
| 1159 | sprintf(opcode_str, "mpyr"); | |
| 1160 | return 1; | |
| 1161 | } | |
| 228 | 1162 | |
| 229 | /* Recovered strings */ | |
| 230 | char arg_str[128] = ""; | |
| 231 | char opcode_str[128] = ""; | |
| 232 | char parallel_move_str[128] = ""; | |
| 233 | char parallel_move_str2[128] = ""; | |
| 1163 | /* SUB : 011m mKKK 0rru Fuuu : A-202 */ | |
| 1164 | static size_t dsp56k_dasm_sub_1(const UINT16 op_byte, char* opcode_str, char* arg_str) | |
| 1165 | { | |
| 1166 | /* TODO - overlap with ADD (up above) */ | |
| 1167 | char D[32]; | |
| 1168 | char S1[32]; | |
| 1169 | char arg[32]; | |
| 1170 | decode_uuuuF_table(BITS(op_byte,0x17), BITS(op_byte,0x08), arg, S1, D); | |
| 1171 | sprintf(opcode_str, "%s", arg); | |
| 1172 | sprintf(arg_str, "%s,%s", S1, D); | |
| 1173 | return 1; | |
| 1174 | } | |
| 234 | 1175 | |
| 235 | /* Init */ | |
| 236 | sprintf(buffer, " "); | |
| 1176 | /* TFR : 011m mKKK 0rr1 F0DD : A-212 */ | |
| 1177 | static size_t dsp56k_dasm_tfr_2(const UINT16 op_byte, char* opcode_str, char* arg_str) | |
| 1178 | { | |
| 1179 | /* TODO - Same as move above. Investigate */ | |
| 1180 | char D[32]; | |
| 1181 | char S1[32]; | |
| 1182 | decode_DDF_table(BITS(op_byte,0x03), BITS(op_byte,0x08), S1, D); | |
| 1183 | sprintf(opcode_str, "tfr"); | |
| 1184 | sprintf(arg_str, "%s,%s", S1, D); | |
| 1185 | return 1; | |
| 1186 | } | |
| 237 | 1187 | |
| 238 | /* First, decode the Data ALU opcode */ | |
| 239 | decode_data_ALU_opcode_dual_move(BITS(op,0x00ff), opcode_str, arg_str); | |
| 1188 | /* MPY : 0001 0110 RRDD FQQQ : A-160 */ | |
| 1189 | static size_t dsp56k_dasm_mpy_2(const UINT16 op_byte, char* opcode_str, char* arg_str) | |
| 1190 | { | |
| 1191 | /* TODO | |
| 1192 | // MPY - 0001 0110 RRDD FQQQ | |
| 1193 | decode_k_table(BITS(op,0x0100), Dnot); | |
| 1194 | Rnum = decode_RR_table(BITS(op,0x00c0)); | |
| 1195 | decode_DD_table(BITS(op,0x0030), S); | |
| 1196 | decode_QQQF_table(BITS(op,0x0007), BITS(op,0x0008), S1, S2, D); | |
| 1197 | sprintf(buffer, "mpy %s,%s,%s %s,(R%d)+N%d %s,%s", S1, S2, D, Dnot, Rnum, Rnum, S, Dnot); | |
| 1198 | // Strange, but not entirely out of the question - this 'k' parameter is hardcoded | |
| 1199 | // I cheat here and do the parallel memory data move above - this specific one is only used twice | |
| 1200 | retSize = 1; | |
| 1201 | */ | |
| 1202 | return 0; | |
| 1203 | } | |
| 240 | 1204 | |
| 241 | /* Next, decode the Dual X Memory Data Read */ | |
| 242 | decode_dual_x_memory_data_read(op, parallel_move_str, parallel_move_str2); | |
| 1205 | /* MAC : 0001 0111 RRDD FQQQ : A-122 */ | |
| 1206 | static size_t dsp56k_dasm_mac_2(const UINT16 op_byte, char* opcode_str, char* arg_str) | |
| 1207 | { | |
| 1208 | /* TODO | |
| 1209 | // MAC - 0001 0111 RRDD FQQQ | |
| 1210 | decode_k_table(BITS(op,0x0100), Dnot); | |
| 1211 | Rnum = decode_RR_table(BITS(op,0x00c0)); | |
| 1212 | decode_DD_table(BITS(op,0x0030), S); | |
| 1213 | decode_QQQF_table(BITS(op,0x0007), BITS(op,0x0008), S1, S2, D); | |
| 1214 | sprintf(buffer, "mac %s,%s,%s %s,(R%d)+N%d %s,%s", S1, S2, D, Dnot, Rnum, Rnum, S, Dnot); | |
| 1215 | // Strange, but not entirely out of the question - this 'k' parameter is hardcoded | |
| 1216 | // I cheat here and do the parallel memory data move above - this specific one is only used twice | |
| 1217 | retSize = 1; | |
| 1218 | */ | |
| 1219 | return 0; | |
| 1220 | } | |
| 243 | 1221 | |
| 244 | /* Finally, assemble the full opcode */ | |
| 245 | pad_string(11, opcode_str); | |
| 246 | pad_string(15, arg_str); | |
| 247 | sprintf(buffer, "%s%s%s %s", opcode_str, arg_str, parallel_move_str, parallel_move_str2); | |
| 1222 | /* CLR : .... .... 0000 F001 : A-60 */ | |
| 1223 | static size_t dsp56k_dasm_clr(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register) | |
| 1224 | { | |
| 1225 | char D[32]; | |
| 1226 | decode_F_table(BITS(op_byte,0x08), D); | |
| 1227 | sprintf(opcode_str, "clr"); | |
| 1228 | sprintf(arg_str, "%s", D); | |
| 1229 | sprintf(d_register, "%s", D); | |
| 1230 | return 1; | |
| 1231 | } | |
| 248 | 1232 | |
| 249 | return opSize; | |
| 1233 | /* ADD : .... .... 0000 FJJJ : A-22 */ | |
| 1234 | static size_t dsp56k_dasm_add(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register) | |
| 1235 | { | |
| 1236 | char D[32]; | |
| 1237 | char S1[32]; | |
| 1238 | decode_JJJF_table(BITS(op_byte,0x07), BITS(op_byte,0x08), S1, D); | |
| 1239 | sprintf(opcode_str, "add"); | |
| 1240 | sprintf(arg_str, "%s,%s", S1, D); | |
| 1241 | sprintf(d_register, "%s", D); | |
| 1242 | return 1; | |
| 250 | 1243 | } |
| 251 | 1244 | |
| 252 | static unsigned assemble_no_parallel_move_ALU_opcode(char* buffer, const UINT16 op, const UINT16 op2, const unsigned pc) | |
| 1245 | /* MOVE : .... .... 0001 0001 : A-128 */ | |
| 1246 | static size_t dsp56k_dasm_move(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register) | |
| 253 | 1247 | { |
| 254 | /* All operations are of length 1 */ | |
| 255 | unsigned opSize = 1; | |
| 1248 | /* Equivalent to a NOP (+ parallel move) */ | |
| 1249 | sprintf(opcode_str, "move"); | |
| 1250 | sprintf(arg_str, " "); | |
| 1251 | sprintf(d_register, " "); | |
| 1252 | return 1; | |
| 1253 | } | |
| 256 | 1254 | |
| 257 | /* Recovered strings */ | |
| 258 | char arg_str[128] = ""; | |
| 259 | char opcode_str[128] = ""; | |
| 260 | char d_register[128] = ""; | |
| 1255 | /* TFR : .... .... 0001 FJJJ : A-212 */ | |
| 1256 | static size_t dsp56k_dasm_tfr(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register) | |
| 1257 | { | |
| 1258 | char D[32]; | |
| 1259 | char S1[32]; | |
| 1260 | decode_JJJF_table(BITS(op_byte,0x07), BITS(op_byte,0x08), S1, D); | |
| 1261 | sprintf(opcode_str, "tfr"); | |
| 1262 | sprintf(arg_str, "%s,%s", S1, D); | |
| 1263 | sprintf(d_register, "%s", D); | |
| 1264 | return 1; | |
| 1265 | } | |
| 261 | 1266 | |
| 262 | /* Init */ | |
| 263 | sprintf(buffer, " "); | |
| 1267 | /* RND : .... .... 0010 F000 : A-188 */ | |
| 1268 | static size_t dsp56k_dasm_rnd(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register) | |
| 1269 | { | |
| 1270 | char D[32]; | |
| 1271 | decode_F_table(BITS(op_byte,0x08), D); | |
| 1272 | sprintf(opcode_str, "rnd"); | |
| 1273 | sprintf(arg_str, "%s", D); | |
| 1274 | sprintf(d_register, "%s", D); | |
| 1275 | return 1; | |
| 1276 | } | |
| 264 | 1277 | |
| 265 | /* First, decode the Data ALU opcode */ | |
| 266 | decode_data_ALU_opcode(BITS(op,0x00ff), opcode_str, arg_str, d_register); | |
| 1278 | /* TST : .... .... 0010 F001 : A-218 */ | |
| 1279 | static size_t dsp56k_dasm_tst(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register) | |
| 1280 | { | |
| 1281 | char D[32]; | |
| 1282 | decode_F_table(BITS(op_byte,0x08), D); | |
| 1283 | sprintf(opcode_str, "tst"); | |
| 1284 | sprintf(arg_str, "%s", D); | |
| 1285 | sprintf(d_register, "%s", D); | |
| 1286 | return 1; | |
| 1287 | } | |
| 267 | 1288 | |
| 268 | /* Finally, assemble the full opcode */ | |
| 269 | pad_string(11, opcode_str); | |
| 270 | sprintf(buffer, "%s%s", opcode_str, arg_str); | |
| 1289 | /* INC : .... .... 0010 F010 : A-104 */ | |
| 1290 | static size_t dsp56k_dasm_inc(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register) | |
| 1291 | { | |
| 1292 | char D[32]; | |
| 1293 | decode_F_table(BITS(op_byte,0x08), D); | |
| 1294 | sprintf(opcode_str, "inc"); | |
| 1295 | sprintf(arg_str, "%s", D); | |
| 1296 | sprintf(d_register, "%s", D); | |
| 1297 | return 1; | |
| 1298 | } | |
| 271 | 1299 | |
| 272 | return opSize; | |
| 1300 | /* INC24 : .... .... 0010 F011 : A-106 */ | |
| 1301 | static size_t dsp56k_dasm_inc24(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register) | |
| 1302 | { | |
| 1303 | char D[32]; | |
| 1304 | decode_F_table(BITS(op_byte,0x08), D); | |
| 1305 | sprintf(opcode_str, "inc24"); | |
| 1306 | sprintf(arg_str, "%s", D); | |
| 1307 | sprintf(d_register, "%s", D); | |
| 1308 | return 1; | |
| 273 | 1309 | } |
| 274 | 1310 | |
| 275 | static unsigned assemble_parallel_register_to_register_moveALU_opcode(char* buffer, const UINT16 op, const UINT16 op2, const unsigned pc) | |
| 1311 | /* OR : .... .... 0010 F1JJ : A-176 */ | |
| 1312 | static size_t dsp56k_dasm_or(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register) | |
| 276 | 1313 | { |
| 277 | /* All operations are of length 1 */ | |
| 278 | unsigned opSize = 1; | |
| 1314 | char D[32]; | |
| 1315 | char S1[32]; | |
| 1316 | decode_JJF_table(BITS(op_byte,0x03),BITS(op_byte,0x08), S1, D); | |
| 1317 | sprintf(opcode_str, "or"); | |
| 1318 | sprintf(arg_str, "%s,%s", S1, D); | |
| 1319 | sprintf(d_register, "%s", D); | |
| 1320 | return 1; | |
| 1321 | } | |
| 279 | 1322 | |
| 280 | /* Recovered strings */ | |
| 281 | char arg_str[128] = ""; | |
| 282 | char opcode_str[128] = ""; | |
| 283 | char d_register[128] = ""; | |
| 284 | char parallel_move_str[128] = ""; | |
| 1323 | /* ASR : .... .... 0011 F000 : A-32 */ | |
| 1324 | static size_t dsp56k_dasm_asr(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register) | |
| 1325 | { | |
| 1326 | char D[32]; | |
| 1327 | decode_F_table(BITS(op_byte,0x08), D); | |
| 1328 | sprintf(opcode_str, "asr"); | |
| 1329 | sprintf(arg_str, "%s", D); | |
| 1330 | sprintf(d_register, "%s", D); | |
| 1331 | return 1; | |
| 1332 | } | |
| 285 | 1333 | |
| 286 | /* Init */ | |
| 287 | sprintf(buffer, " "); | |
| 1334 | /* ASL : .... .... 0011 F001 : A-28 */ | |
| 1335 | static size_t dsp56k_dasm_asl(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register) | |
| 1336 | { | |
| 1337 | char D[32]; | |
| 1338 | decode_F_table(BITS(op_byte,0x08), D); | |
| 1339 | sprintf(opcode_str, "asl"); | |
| 1340 | sprintf(arg_str, "%s", D); | |
| 1341 | sprintf(d_register, "%s", D); | |
| 1342 | return 1; | |
| 1343 | } | |
| 288 | 1344 | |
| 289 | /* First, decode the Data ALU opcode */ | |
| 290 | decode_data_ALU_opcode(BITS(op,0x00ff), opcode_str, arg_str, d_register); | |
| 1345 | /* LSR : .... .... 0011 F010 : A-120 */ | |
| 1346 | static size_t dsp56k_dasm_lsr(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register) | |
| 1347 | { | |
| 1348 | char D[32]; | |
| 1349 | decode_F_table(BITS(op_byte,0x08), D); | |
| 1350 | sprintf(opcode_str, "lsr"); | |
| 1351 | sprintf(arg_str, "%s", D); | |
| 1352 | sprintf(d_register, "%s", D); | |
| 1353 | return 1; | |
| 1354 | } | |
| 291 | 1355 | |
| 292 | /* Next, decode the X Memory Data Move */ | |
| 293 | decode_register_to_register_data_move(BITS(op,0xff00), parallel_move_str, d_register); | |
| 1356 | /* LSL : .... .... 0011 F011 : A-118 */ | |
| 1357 | static size_t dsp56k_dasm_lsl(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register) | |
| 1358 | { | |
| 1359 | char D[32]; | |
| 1360 | decode_F_table(BITS(op_byte,0x08), D); | |
| 1361 | sprintf(opcode_str, "lsl"); | |
| 1362 | sprintf(arg_str, "%s", D); | |
| 1363 | sprintf(d_register, "%s", D); | |
| 1364 | return 1; | |
| 1365 | } | |
| 294 | 1366 | |
| 295 | /* Finally, assemble the full opcode */ | |
| 296 | pad_string(11, opcode_str); | |
| 297 | pad_string(15, arg_str); | |
| 298 | sprintf(buffer, "%s%s%s", opcode_str, arg_str, parallel_move_str); | |
| 299 | ||
| 300 | return opSize; | |
| 1367 | /* EOR : .... .... 0011 F1JJ : A-94 */ | |
| 1368 | static size_t dsp56k_dasm_eor(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register) | |
| 1369 | { | |
| 1370 | char D[32]; | |
| 1371 | char S1[32]; | |
| 1372 | decode_JJF_table(BITS(op_byte,0x03),BITS(op_byte,0x08), S1, D); | |
| 1373 | sprintf(opcode_str, "eor"); | |
| 1374 | sprintf(arg_str, "%s,%s", S1, D); | |
| 1375 | sprintf(d_register, "%s", D); | |
| 1376 | return 1; | |
| 301 | 1377 | } |
| 302 | 1378 | |
| 303 | static unsigned assemble_coorperative_x_memory_data_move_ALU_opcode(char* buffer, const UINT16 op, const UINT16 op2, const unsigned pc) | |
| 1379 | /* SUBL : .... .... 0100 F001 : A-204 */ | |
| 1380 | static size_t dsp56k_dasm_subl(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register) | |
| 304 | 1381 | { |
| 305 | /* All operations are of length 1 */ | |
| 306 | unsigned opSize = 1; | |
| 1382 | sprintf(opcode_str, "subl"); | |
| 307 | 1383 | |
| 308 | /* Recovered strings */ | |
| 309 | char arg_str[128] = ""; | |
| 310 | char opcode_str[128] = ""; | |
| 311 | char parallel_move_str[128] = ""; | |
| 312 | char d_register[128] = ""; | |
| 1384 | /* Only one option for the F table */ | |
| 1385 | if (!BITS(op_byte,0x08)) | |
| 1386 | { | |
| 1387 | sprintf(arg_str, "B,A"); | |
| 1388 | sprintf(d_register, "A"); | |
| 1389 | } | |
| 1390 | else | |
| 1391 | { | |
| 1392 | sprintf(arg_str, "!"); | |
| 1393 | } | |
| 313 | 1394 | |
| 314 | /* Init */ | |
| 315 | sprintf(buffer, " "); | |
| 1395 | return 1; | |
| 1396 | } | |
| 316 | 1397 | |
| 317 | /* First, decode the Data ALU opcode */ | |
| 318 | decode_data_ALU_opcode(BITS(op,0x00ff), opcode_str, arg_str, d_register); | |
| 1398 | /* SUB : .... .... 0100 FJJJ : A-202 */ | |
| 1399 | static size_t dsp56k_dasm_sub(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register) | |
| 1400 | { | |
| 1401 | char D[32]; | |
| 1402 | char S1[32]; | |
| 1403 | decode_JJJF_table(BITS(op_byte,0x07), BITS(op_byte,0x08), S1, D); | |
| 1404 | sprintf(opcode_str, "sub"); | |
| 1405 | sprintf(arg_str, "%s,%s", S1, D); | |
| 1406 | sprintf(d_register, "%s", D); | |
| 1407 | return 1; | |
| 1408 | } | |
| 319 | 1409 | |
| 320 | /* Next, decode the X Memory Data Move */ | |
| 321 | decode_parallel_cooperative_x_memory_data_move(BITS(op,0xff00), parallel_move_str, d_register); | |
| 1410 | /* CLR24 : .... .... 0101 F001 : A-62 */ | |
| 1411 | static size_t dsp56k_dasm_clr2(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register) | |
| 1412 | { | |
| 1413 | char D[32]; | |
| 1414 | decode_F_table(BITS(op_byte,0x08), D); | |
| 1415 | sprintf(opcode_str, "clr24"); | |
| 1416 | sprintf(arg_str, "%s", D); | |
| 1417 | sprintf(d_register, "%s", D); | |
| 1418 | return 1; | |
| 1419 | } | |
| 322 | 1420 | |
| 323 | /* Finally, assemble the full opcode */ | |
| 324 | pad_string(11, opcode_str); | |
| 325 | pad_string(15, arg_str); | |
| 326 | sprintf(buffer, "%s%s%s", opcode_str, arg_str, parallel_move_str); | |
| 1421 | /* SBC : .... .... 0101 F01J : A-198 */ | |
| 1422 | static size_t dsp56k_dasm_sbc(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register) | |
| 1423 | { | |
| 1424 | char D[32]; | |
| 1425 | char S1[32]; | |
| 1426 | decode_JF_table(BITS(op_byte,0x01), BITS(op_byte,0x08), S1, D); | |
| 1427 | sprintf(opcode_str, "sbc"); | |
| 1428 | sprintf(arg_str, "%s,%s", S1, D); | |
| 1429 | sprintf(d_register, "%s", D); | |
| 1430 | return 1; | |
| 1431 | } | |
| 327 | 1432 | |
| 328 | return opSize; | |
| 1433 | /* CMP : .... .... 0101 FJJJ : A-64 */ | |
| 1434 | static size_t dsp56k_dasm_cmp(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register) | |
| 1435 | { | |
| 1436 | char D[32]; | |
| 1437 | char S1[32]; | |
| 1438 | decode_JJJF_table(BITS(op_byte,0x07), BITS(op_byte,0x08), S1, D); | |
| 1439 | /* TODO: This is a JJJF limited */ | |
| 1440 | sprintf(opcode_str, "cmp"); | |
| 1441 | sprintf(arg_str, "%s,%s", S1,D); | |
| 1442 | sprintf(d_register, "%s", D); | |
| 1443 | return 1; | |
| 329 | 1444 | } |
| 330 | 1445 | |
| 331 | static unsigned assemble_TCC_opcode(char* buffer, const UINT16 op, const UINT16 op2, const unsigned pc) | |
| 1446 | /* NEG : .... .... 0110 F000 : A-166 */ | |
| 1447 | static size_t dsp56k_dasm_neg(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register) | |
| 332 | 1448 | { |
| 333 | /* TCC is of length 1 */ | |
| 334 | unsigned opSize = 1; | |
| 1449 | char D[32]; | |
| 1450 | decode_F_table(BITS(op_byte,0x08), D); | |
| 1451 | sprintf(opcode_str, "neg"); | |
| 1452 | sprintf(arg_str, "%s", D); | |
| 1453 | sprintf(d_register, "%s", D); | |
| 1454 | return 1; | |
| 1455 | } | |
| 335 | 1456 | |
| 336 | /* Recovered strings */ | |
| 337 | char arg_str[128] = ""; | |
| 338 | char opcode_str[128] = ""; | |
| 1457 | /* NOT : .... .... 0110 F001 : A-174 */ | |
| 1458 | static size_t dsp56k_dasm_not(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register) | |
| 1459 | { | |
| 1460 | char D[32]; | |
| 1461 | decode_F_table(BITS(op_byte,0x08), D); | |
| 1462 | sprintf(opcode_str, "not"); | |
| 1463 | sprintf(arg_str, "%s", D); | |
| 1464 | sprintf(d_register, "%s", D); | |
| 1465 | return 1; | |
| 1466 | } | |
| 339 | 1467 | |
| 340 | /* Init */ | |
| 341 | sprintf(buffer, " "); | |
| 1468 | /* DEC : .... .... 0110 F010 : A-72 */ | |
| 1469 | static size_t dsp56k_dasm_dec(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register) | |
| 1470 | { | |
| 1471 | char D[32]; | |
| 1472 | decode_F_table(BITS(op_byte,0x08), D); | |
| 1473 | sprintf(opcode_str, "dec"); | |
| 1474 | sprintf(arg_str, "%s", D); | |
| 1475 | sprintf(d_register, "%s", D); | |
| 1476 | return 1; | |
| 1477 | } | |
| 342 | 1478 | |
| 343 | /* Simply decode the opcode and its arguments */ | |
| 344 | opSize = decode_TCC_opcode(op, opcode_str, arg_str); | |
| 1479 | /* DEC24 : .... .... 0110 F011 : A-74 */ | |
| 1480 | static size_t dsp56k_dasm_dec24(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register) | |
| 1481 | { | |
| 1482 | char D[32]; | |
| 1483 | decode_F_table(BITS(op_byte,0x08), D); | |
| 1484 | sprintf(opcode_str, "dec24"); | |
| 1485 | sprintf(arg_str, "%s", D); | |
| 1486 | sprintf(d_register, "%s", D); | |
| 1487 | return 1; | |
| 1488 | } | |
| 345 | 1489 | |
| 346 | /* Finally, assemble the full opcode */ | |
| 347 | pad_string(11, opcode_str); | |
| 348 | sprintf(buffer, "%s%s", opcode_str, arg_str); | |
| 349 | ||
| 350 | return opSize; | |
| 1490 | /* AND : .... .... 0110 F1JJ : A-24 */ | |
| 1491 | static size_t dsp56k_dasm_and(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register) | |
| 1492 | { | |
| 1493 | char D[32]; | |
| 1494 | char S1[32]; | |
| 1495 | decode_JJF_table(BITS(op_byte,0x03),BITS(op_byte,0x08), S1, D); | |
| 1496 | sprintf(opcode_str, "and"); | |
| 1497 | sprintf(arg_str, "%s,%s", S1, D); | |
| 1498 | sprintf(d_register, "%s", D); | |
| 1499 | return 1; | |
| 351 | 1500 | } |
| 352 | 1501 | |
| 353 | static unsigned assemble_bitfield_opcode(char* buffer, const UINT16 op, const UINT16 op2, const unsigned pc) | |
| 1502 | /* ABS : .... .... 0111 F001 : A-18 */ | |
| 1503 | static size_t dsp56k_dasm_abs(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register) | |
| 354 | 1504 | { |
| 355 | /* All bitfield ops are length 2 */ | |
| 356 | unsigned opSize = 2; | |
| 357 | ||
| 358 | /* Recovered strings */ | |
| 359 | char arg_str[128] = ""; | |
| 360 | char opcode_str[128] = ""; | |
| 361 | ||
| 362 | /* Init */ | |
| 363 | sprintf(buffer, " "); | |
| 364 | ||
| 365 | /* Simply decode the opcode and its arguments */ | |
| 366 | opSize = decode_bitfield_opcode(op, op2, opcode_str, arg_str); | |
| 367 | ||
| 368 | /* Finally, assemble the full opcode */ | |
| 369 | pad_string(11, opcode_str); | |
| 370 | sprintf(buffer, "%s%s", opcode_str, arg_str); | |
| 371 | ||
| 372 | return opSize; | |
| 1505 | char D[32]; | |
| 1506 | decode_F_table(BITS(op_byte,0x08), D); | |
| 1507 | sprintf(opcode_str, "abs"); | |
| 1508 | sprintf(arg_str, "%s", D); | |
| 1509 | sprintf(d_register, "%s", D); | |
| 1510 | return 1; | |
| 373 | 1511 | } |
| 374 | 1512 | |
| 375 | static unsigned assemble_no_parallel_move_opcode(char* buffer, const UINT16 op, const UINT16 op2, const unsigned pc) | |
| 1513 | /* ROR : .... .... 0111 F010 : A-192 */ | |
| 1514 | static size_t dsp56k_dasm_ror(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register) | |
| 376 | 1515 | { |
| 377 | /* Length is variable */ | |
| 378 | unsigned opSize = 0; | |
| 379 | ||
| 380 | /* Recovered strings */ | |
| 381 | char arg_str[128] = ""; | |
| 382 | char opcode_str[128] = ""; | |
| 383 | ||
| 384 | /* Init */ | |
| 385 | sprintf(buffer, " "); | |
| 386 | ||
| 387 | /* Simply decode the opcode and its arguments */ | |
| 388 | opSize = decode_no_parallel_move_opcode(op, op2, pc, opcode_str, arg_str); | |
| 389 | ||
| 390 | /* Finally, assemble the full opcode */ | |
| 391 | pad_string(11, opcode_str); | |
| 392 | sprintf(buffer, "%s%s", opcode_str, arg_str); | |
| 393 | ||
| 394 | return opSize; | |
| 1516 | char D[32]; | |
| 1517 | decode_F_table(BITS(op_byte,0x08), D); | |
| 1518 | sprintf(opcode_str, "ror"); | |
| 1519 | sprintf(arg_str, "%s", D); | |
| 1520 | sprintf(d_register, "%s", D); | |
| 1521 | return 1; | |
| 395 | 1522 | } |
| 396 | 1523 | |
| 397 | static unsigned assemble_immediate_opcode(char* buffer, const UINT16 op, const UINT16 op2, const unsigned pc) | |
| 1524 | /* ROL : .... .... 0111 F011 : A-190 */ | |
| 1525 | static size_t dsp56k_dasm_rol(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register) | |
| 398 | 1526 | { |
| 399 | /* Length is variable */ | |
| 400 | unsigned opSize = 0; | |
| 401 | ||
| 402 | /* Recovered strings */ | |
| 403 | char arg_str[128] = ""; | |
| 404 | char opcode_str[128] = ""; | |
| 405 | ||
| 406 | /* Init */ | |
| 407 | sprintf(buffer, " "); | |
| 408 | ||
| 409 | /* Decode the 4 opcode and their arguments */ | |
| 410 | opSize = decode_immediate_opcode(op, pc, opcode_str, arg_str); | |
| 411 | ||
| 412 | /* Finally, assemble the full opcode */ | |
| 413 | pad_string(11, opcode_str); | |
| 414 | sprintf(buffer, "%s%s", opcode_str, arg_str); | |
| 415 | ||
| 416 | return opSize; | |
| 1527 | char D[32]; | |
| 1528 | decode_F_table(BITS(op_byte,0x08), D); | |
| 1529 | sprintf(opcode_str, "rol"); | |
| 1530 | sprintf(arg_str, "%s", D); | |
| 1531 | sprintf(d_register, "%s", D); | |
| 1532 | return 1; | |
| 417 | 1533 | } |
| 418 | 1534 | |
| 419 | static unsigned assemble_movec_opcodes(char* buffer, const UINT16 op, const UINT16 op2, const unsigned pc) | |
| 1535 | /* CMPM : .... .... 0111 FJJJ : A-66 */ | |
| 1536 | static size_t dsp56k_dasm_cmpm(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register) | |
| 420 | 1537 | { |
| 421 | /* Length is variable */ | |
| 422 | unsigned opSize = 0; | |
| 423 | ||
| 424 | /* Recovered strings */ | |
| 425 | char arg_str[128] = ""; | |
| 426 | char opcode_str[128] = ""; | |
| 427 | ||
| 428 | /* Init */ | |
| 429 | sprintf(buffer, " "); | |
| 430 | ||
| 431 | /* Simply decode the opcode and its arguments */ | |
| 432 | opSize = decode_movec_opcodes(op, op2, pc, opcode_str, arg_str); | |
| 433 | ||
| 434 | /* Finally, assemble the full opcode */ | |
| 435 | pad_string(11, opcode_str); | |
| 436 | sprintf(buffer, "%s%s", opcode_str, arg_str); | |
| 437 | ||
| 438 | return opSize; | |
| 1538 | char D[32]; | |
| 1539 | char S1[32]; | |
| 1540 | decode_JJJF_table(BITS(op_byte,0x07), BITS(op_byte,0x08), S1, D); | |
| 1541 | /* TODO: This is JJJF limited */ | |
| 1542 | sprintf(opcode_str, "cmpm"); | |
| 1543 | sprintf(arg_str, "%s,%s", S1,D); | |
| 1544 | sprintf(d_register, "%s", D); | |
| 1545 | return 1; | |
| 439 | 1546 | } |
| 440 | 1547 | |
| 441 | static unsigned assemble_misc_opcode(char* buffer, const UINT16 op, const UINT16 op2, const unsigned pc) | |
| 1548 | /* MPY : .... .... 1k00 FQQQ : A-160 -- CONFIRMED TYPO IN DOCS (HHHH vs HHHW) */ | |
| 1549 | static size_t dsp56k_dasm_mpy(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register) | |
| 442 | 1550 | { |
| 443 | /* Length is variable */ | |
| 444 | unsigned opSize = 0; | |
| 445 | ||
| 446 | /* Recovered strings */ | |
| 447 | char arg_str[128] = ""; | |
| 448 | char opcode_str[128] = ""; | |
| 449 | ||
| 450 | /* Init */ | |
| 451 | sprintf(buffer, " "); | |
| 452 | ||
| 453 | /* Simply decode the opcode and its arguments */ | |
| 454 | opSize = decode_misc_opcode(op, pc, opcode_str, arg_str); | |
| 455 | ||
| 456 | /* Finally, assemble the full opcode */ | |
| 457 | pad_string(11, opcode_str); | |
| 458 | sprintf(buffer, "%s%s", opcode_str, arg_str); | |
| 459 | ||
| 460 | return opSize; | |
| 1551 | char D[32]; | |
| 1552 | char S1[32]; | |
| 1553 | char S2[32]; | |
| 1554 | char SIGN[32]; | |
| 1555 | decode_QQQF_table(BITS(op_byte,0x07), BITS(op_byte,0x08), S1, S2, D); | |
| 1556 | decode_kSign_table(BITS(op_byte,0x40), SIGN); | |
| 1557 | sprintf(opcode_str, "mpy"); | |
| 1558 | sprintf(arg_str, "(%s)%s,%s,%s", SIGN, S2, S1, D); | |
| 1559 | sprintf(d_register, "%s", D); | |
| 1560 | return 1; | |
| 461 | 1561 | } |
| 462 | 1562 | |
| 463 | /* Working except for a TODO */ | |
| 464 | static unsigned assemble_unique_opcode(char* buffer, const UINT16 op, const UINT16 op2, const unsigned pc) | |
| 1563 | /* MPYR : .... .... 1k01 FQQQ : A-162 */ | |
| 1564 | static size_t dsp56k_dasm_mpyr(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register) | |
| 465 | 1565 | { |
| 466 | /* Length is variable */ | |
| 467 | unsigned opSize = 0; | |
| 468 | ||
| 469 | /* Recovered strings */ | |
| 470 | char arg_str[128] = ""; | |
| 471 | char opcode_str[128] = ""; | |
| 472 | ||
| 473 | /* Init */ | |
| 474 | sprintf(buffer, " "); | |
| 475 | ||
| 476 | /* Simply decode the opcode and its arguments */ | |
| 477 | opSize = decode_unique_opcode(op, op2, pc, opcode_str, arg_str); | |
| 478 | ||
| 479 | /* Finally, assemble the full opcode */ | |
| 480 | pad_string(11, opcode_str); | |
| 481 | sprintf(buffer, "%s%s", opcode_str, arg_str); | |
| 482 | ||
| 483 | return opSize; | |
| 1566 | char D[32]; | |
| 1567 | char S1[32]; | |
| 1568 | char S2[32]; | |
| 1569 | char SIGN[32]; | |
| 1570 | decode_QQQF_table(BITS(op_byte,0x07), BITS(op_byte,0x08), S1, S2, D); | |
| 1571 | decode_kSign_table(BITS(op_byte,0x40), SIGN); | |
| 1572 | sprintf(opcode_str, "mpyr"); | |
| 1573 | sprintf(arg_str, "(%s)%s,%s,%s", SIGN, S2, S1, D); | |
| 1574 | sprintf(d_register, "%s", D); | |
| 1575 | return 1; | |
| 484 | 1576 | } |
| 485 | 1577 | |
| 486 | ||
| 487 | /**************************/ | |
| 488 | /* Actual opcode decoding */ | |
| 489 | /**************************/ | |
| 490 | static void decode_data_ALU_opcode(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register) | |
| 1578 | /* MAC : .... .... 1k10 FQQQ : A-122 */ | |
| 1579 | static size_t dsp56k_dasm_mac(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register) | |
| 491 | 1580 | { |
| 492 | char D[128]; | |
| 493 | char S1[128]; | |
| 494 | ||
| 495 | if (!BITS(op_byte, 0x80)) | |
| 496 | { | |
| 497 | switch(BITS(op_byte,0x70)) | |
| 498 | { | |
| 499 | case 0x0: | |
| 500 | if (BITS(op_byte,0x07) == 0x1) | |
| 501 | { | |
| 502 | /* CLR - 1mRR HHHW 0000 F001 */ | |
| 503 | decode_F_table(BITS(op_byte,0x08), D); | |
| 504 | sprintf(opcode_str, "clr"); | |
| 505 | sprintf(arg_str, "%s", D); | |
| 506 | } | |
| 507 | else | |
| 508 | { | |
| 509 | /* ADD - 1mRR HHHW 0000 FJJJ */ | |
| 510 | decode_JJJF_table(BITS(op_byte,0x07), BITS(op_byte,0x08), S1, D); | |
| 511 | sprintf(opcode_str, "add"); | |
| 512 | sprintf(arg_str, "%s,%s", S1, D); | |
| 513 | } | |
| 514 | break; | |
| 515 | ||
| 516 | case 0x1: | |
| 517 | if (BITS(op_byte,0x0f) == 0x1) | |
| 518 | { | |
| 519 | /* MOVE - 1mRR HHHW 0001 0001 */ | |
| 520 | /* Equivalent to a NOP (+ parallel move) */ | |
| 521 | sprintf(opcode_str, "move"); | |
| 522 | sprintf(arg_str, " "); | |
| 523 | } | |
| 524 | else | |
| 525 | { | |
| 526 | /* TFR - 1mRR HHHW 0001 FJJJ */ | |
| 527 | decode_JJJF_table(BITS(op_byte,0x07), BITS(op_byte,0x08), S1, D); | |
| 528 | sprintf(opcode_str, "tfr"); | |
| 529 | sprintf(arg_str, "%s,%s", S1, D); | |
| 530 | } | |
| 531 | break; | |
| 532 | ||
| 533 | case 0x2: | |
| 534 | if (BITS(op_byte,0x07) == 0x0) | |
| 535 | { | |
| 536 | /* RND - 1mRR HHHW 0010 F000 */ | |
| 537 | decode_F_table(BITS(op_byte,0x08), D); | |
| 538 | sprintf(opcode_str, "rnd"); | |
| 539 | sprintf(arg_str, "%s", D); | |
| 540 | } | |
| 541 | else if (BITS(op_byte,0x07) == 0x1) | |
| 542 | { | |
| 543 | /* TST - 1mRR HHHW 0010 F001 */ | |
| 544 | decode_F_table(BITS(op_byte,0x08), D); | |
| 545 | sprintf(opcode_str, "tst"); | |
| 546 | sprintf(arg_str, "%s", D); | |
| 547 | } | |
| 548 | else if (BITS(op_byte,0x07) == 0x2) | |
| 549 | { | |
| 550 | /* INC - 1mRR HHHW 0010 F010 */ | |
| 551 | decode_F_table(BITS(op_byte,0x08), D); | |
| 552 | sprintf(opcode_str, "inc"); | |
| 553 | sprintf(arg_str, "%s", D); | |
| 554 | } | |
| 555 | else if (BITS(op_byte,0x07) == 0x3) | |
| 556 | { | |
| 557 | /* INC24 - 1mRR HHHW 0010 F011 */ | |
| 558 | decode_F_table(BITS(op_byte,0x08), D); | |
| 559 | sprintf(opcode_str, "inc24"); | |
| 560 | sprintf(arg_str, "%s", D); | |
| 561 | } | |
| 562 | else | |
| 563 | { | |
| 564 | /* OR - 1mRR HHHW 0010 F1JJ */ | |
| 565 | decode_JJF_table(BITS(op_byte,0x03),BITS(op_byte,0x08), S1, D); | |
| 566 | sprintf(opcode_str, "or"); | |
| 567 | sprintf(arg_str, "%s,%s", S1, D); | |
| 568 | } | |
| 569 | break; | |
| 570 | ||
| 571 | case 0x3: | |
| 572 | if (BITS(op_byte,0x07) == 0x0) | |
| 573 | { | |
| 574 | /* ASR - 1mRR HHHW 0011 F000 */ | |
| 575 | decode_F_table(BITS(op_byte,0x08), D); | |
| 576 | sprintf(opcode_str, "asr"); | |
| 577 | sprintf(arg_str, "%s", D); | |
| 578 | } | |
| 579 | else if (BITS(op_byte,0x07) == 0x1) | |
| 580 | { | |
| 581 | /* ASL - 1mRR HHHW 0011 F001 */ | |
| 582 | decode_F_table(BITS(op_byte,0x08), D); | |
| 583 | sprintf(opcode_str, "asl"); | |
| 584 | sprintf(arg_str, "%s", D); | |
| 585 | } | |
| 586 | else if (BITS(op_byte,0x07) == 0x2) | |
| 587 | { | |
| 588 | /* LSR - 1mRR HHHW 0011 F010 */ | |
| 589 | decode_F_table(BITS(op_byte,0x08), D); | |
| 590 | sprintf(opcode_str, "lsr"); | |
| 591 | sprintf(arg_str, "%s", D); | |
| 592 | } | |
| 593 | else if (BITS(op_byte,0x07) == 0x3) | |
| 594 | { | |
| 595 | /* LSL - 1mRR HHHW 0011 F011 */ | |
| 596 | decode_F_table(BITS(op_byte,0x08), D); | |
| 597 | sprintf(opcode_str, "lsl"); | |
| 598 | sprintf(arg_str, "%s", D); | |
| 599 | } | |
| 600 | else | |
| 601 | { | |
| 602 | /* EOR - 1mRR HHHW 0011 F1JJ */ | |
| 603 | decode_JJF_table(BITS(op_byte,0x03),BITS(op_byte,0x08), S1, D); | |
| 604 | sprintf(opcode_str, "eor"); | |
| 605 | sprintf(arg_str, "%s,%s", S1, D); | |
| 606 | } | |
| 607 | break; | |
| 608 | ||
| 609 | case 0x4: | |
| 610 | if (BITS(op_byte,0x07) == 0x1) | |
| 611 | { | |
| 612 | /* SUBL - 1mRR HHHW 0100 F001 */ | |
| 613 | sprintf(opcode_str, "subl"); | |
| 614 | ||
| 615 | /* Only one option for the F table */ | |
| 616 | if (!BITS(op_byte,0x08)) | |
| 617 | sprintf(arg_str, "B,A"); | |
| 618 | else | |
| 619 | sprintf(arg_str, "!"); | |
| 620 | } | |
| 621 | else | |
| 622 | { | |
| 623 | /* SUB - 1mRR HHHW 0100 FJJJ */ | |
| 624 | decode_JJJF_table(BITS(op_byte,0x07), BITS(op_byte,0x08), S1, D); | |
| 625 | sprintf(opcode_str, "sub"); | |
| 626 | sprintf(arg_str, "%s,%s", S1, D); | |
| 627 | } | |
| 628 | break; | |
| 629 | ||
| 630 | case 0x5: | |
| 631 | if (BITS(op_byte,0x07) == 0x1) | |
| 632 | { | |
| 633 | /* CLR24 - 1mRR HHHW 0101 F001 */ | |
| 634 | decode_F_table(BITS(op_byte,0x08), D); | |
| 635 | sprintf(opcode_str, "clr24"); | |
| 636 | sprintf(arg_str, "%s", D); | |
| 637 | } | |
| 638 | else if (BITS(op_byte,0x06) == 0x1) | |
| 639 | { | |
| 640 | /* SBC - 1mRR HHHW 0101 F01J */ | |
| 641 | decode_JF_table(BITS(op_byte,0x01), BITS(op_byte,0x08), S1, D); | |
| 642 | sprintf(opcode_str, "sbc"); | |
| 643 | sprintf(arg_str, "%s,%s", S1, D); | |
| 644 | } | |
| 645 | else | |
| 646 | { | |
| 647 | /* CMP - 1mRR HHHW 0101 FJJJ */ | |
| 648 | decode_JJJF_table(BITS(op_byte,0x07), BITS(op_byte,0x08), S1, D); | |
| 649 | /* TODO: This is a JJJF limited */ | |
| 650 | sprintf(opcode_str, "cmp"); | |
| 651 | sprintf(arg_str, "%s,%s", S1,D); | |
| 652 | } | |
| 653 | break; | |
| 654 | ||
| 655 | case 0x6: | |
| 656 | if (BITS(op_byte,0x07) == 0x0) | |
| 657 | { | |
| 658 | /* NEG - 1mRR HHHW 0110 F000 */ | |
| 659 | decode_F_table(BITS(op_byte,0x08), D); | |
| 660 | sprintf(opcode_str, "neg"); | |
| 661 | sprintf(arg_str, "%s", D); | |
| 662 | } | |
| 663 | else if (BITS(op_byte,0x07) == 0x1) | |
| 664 | { | |
| 665 | /* NOT - 1mRR HHHW 0110 F001 */ | |
| 666 | decode_F_table(BITS(op_byte,0x08), D); | |
| 667 | sprintf(opcode_str, "not"); | |
| 668 | sprintf(arg_str, "%s", D); | |
| 669 | } | |
| 670 | else if (BITS(op_byte,0x07) == 0x2) | |
| 671 | { | |
| 672 | /* DEC - 1mRR HHHW 0110 F010 */ | |
| 673 | decode_F_table(BITS(op_byte,0x08), D); | |
| 674 | sprintf(opcode_str, "dec"); | |
| 675 | sprintf(arg_str, "%s", D); | |
| 676 | } | |
| 677 | else if (BITS(op_byte,0x07) == 0x3) | |
| 678 | { | |
| 679 | /* DEC24 - 1mRR HHHW 0110 F011 */ | |
| 680 | decode_F_table(BITS(op_byte,0x08), D); | |
| 681 | sprintf(opcode_str, "dec24"); | |
| 682 | sprintf(arg_str, "%s", D); | |
| 683 | } | |
| 684 | else | |
| 685 | { | |
| 686 | /* AND - 1mRR HHHW 0110 F1JJ */ | |
| 687 | decode_JJF_table(BITS(op_byte,0x03),BITS(op_byte,0x08), S1, D); | |
| 688 | sprintf(opcode_str, "and"); | |
| 689 | sprintf(arg_str, "%s,%s", S1, D); | |
| 690 | } | |
| 691 | break; | |
| 692 | ||
| 693 | case 0x7: | |
| 694 | if (BITS(op_byte,0x07) == 0x1) | |
| 695 | { | |
| 696 | /* ABS - 1mRR HHHW 0111 F001 */ | |
| 697 | decode_F_table(BITS(op_byte,0x08), D); | |
| 698 | sprintf(opcode_str, "abs"); | |
| 699 | sprintf(arg_str, "%s", D); | |
| 700 | } | |
| 701 | else if (BITS(op_byte,0x07) == 0x2) | |
| 702 | { | |
| 703 | /* ROR - 1mRR HHHW 0111 F010 */ | |
| 704 | decode_F_table(BITS(op_byte,0x08), D); | |
| 705 | sprintf(opcode_str, "ror"); | |
| 706 | sprintf(arg_str, "%s", D); | |
| 707 | } | |
| 708 | else if (BITS(op_byte,0x07) == 0x3) | |
| 709 | { | |
| 710 | /* ROL - 1mRR HHHW 0111 F011 */ | |
| 711 | decode_F_table(BITS(op_byte,0x08), D); | |
| 712 | sprintf(opcode_str, "rol"); | |
| 713 | sprintf(arg_str, "%s", D); | |
| 714 | } | |
| 715 | else | |
| 716 | { | |
| 717 | /* CMPM - 1mRR HHHW 0111 FJJJ */ | |
| 718 | decode_JJJF_table(BITS(op_byte,0x07), BITS(op_byte,0x08), S1, D); | |
| 719 | /* TODO: This is JJJF limited */ | |
| 720 | sprintf(opcode_str, "cmpm"); | |
| 721 | sprintf(arg_str, "%s,%s", S1,D); | |
| 722 | } | |
| 723 | break; | |
| 724 | } | |
| 725 | } | |
| 726 | else | |
| 727 | { | |
| 728 | char S2[128]; | |
| 729 | char SIGN[128]; | |
| 730 | ||
| 731 | decode_QQQF_table(BITS(op_byte,0x07), BITS(op_byte,0x08), S1, S2, D); | |
| 732 | decode_kSign_table(BITS(op_byte,0x40), SIGN); | |
| 733 | ||
| 734 | switch(BITS(op_byte,0x30)) | |
| 735 | { | |
| 736 | /* MPY - 1mRR HHHH 1k00 FQQQ */ | |
| 737 | case 0x0: | |
| 738 | sprintf(opcode_str, "mpy"); | |
| 739 | sprintf(arg_str, "(%s)%s,%s,%s", SIGN, S2, S1, D); | |
| 740 | break; | |
| 741 | ||
| 742 | /* MPYR - 1mRR HHHH 1k01 FQQQ */ | |
| 743 | case 0x1: | |
| 744 | sprintf(opcode_str, "mpyr"); | |
| 745 | sprintf(arg_str, "(%s)%s,%s,%s", SIGN, S2, S1, D); | |
| 746 | break; | |
| 747 | ||
| 748 | /* MAC - 1mRR HHHH 1k10 FQQQ */ | |
| 749 | case 0x2: | |
| 750 | sprintf(opcode_str, "mac"); | |
| 751 | sprintf(arg_str, "(%s)%s,%s,%s", SIGN, S2, S1, D); | |
| 752 | break; | |
| 753 | ||
| 754 | /* MACR - 1mRR HHHH 1k11 FQQQ */ | |
| 755 | case 0x3: | |
| 756 | sprintf(opcode_str, "macr"); | |
| 757 | /* TODO: It's a little odd that macr is S1,S2 while everyone else is S2,S1. Check! */ | |
| 758 | sprintf(arg_str, "(%s)%s,%s,%s", SIGN, S1, S2, D); | |
| 759 | break; | |
| 760 | } | |
| 761 | } | |
| 762 | ||
| 763 | /* For the cooperative x data memory move */ | |
| 1581 | char D[32]; | |
| 1582 | char S1[32]; | |
| 1583 | char S2[32]; | |
| 1584 | char SIGN[32]; | |
| 1585 | decode_QQQF_table(BITS(op_byte,0x07), BITS(op_byte,0x08), S1, S2, D); | |
| 1586 | decode_kSign_table(BITS(op_byte,0x40), SIGN); | |
| 1587 | sprintf(opcode_str, "mac"); | |
| 1588 | sprintf(arg_str, "(%s)%s,%s,%s", SIGN, S2, S1, D); | |
| 764 | 1589 | sprintf(d_register, "%s", D); |
| 1590 | return 1; | |
| 765 | 1591 | } |
| 766 | 1592 | |
| 767 | /* TODO: Triple-check these. There's weirdness around TFR & MOVE */ | |
| 768 | static void decode_data_ALU_opcode_dual_move(const UINT16 op_byte, char* opcode_str, char* arg_str) | |
| 1593 | /* MACR : .... .... 1k11 FQQQ : A-124 -- DRAMA - rr vs xx (805) */ | |
| 1594 | static size_t dsp56k_dasm_macr(const UINT16 op_byte, char* opcode_str, char* arg_str, char* d_register) | |
| 769 | 1595 | { |
| 770 | 1596 | char D[32]; |
| 771 | 1597 | char S1[32]; |
| 772 | 1598 | char S2[32]; |
| 773 | char arg[32]; | |
| 1599 | char SIGN[32]; | |
| 1600 | decode_QQQF_table(BITS(op_byte,0x07), BITS(op_byte,0x08), S1, S2, D); | |
| 1601 | decode_kSign_table(BITS(op_byte,0x40), SIGN); | |
| 1602 | sprintf(opcode_str, "macr"); | |
| 1603 | /* TODO: It's a little odd that macr is S1,S2 while everyone else (mac, mpy, mpyr) is S2,S1. Check! */ | |
| 1604 | sprintf(arg_str, "(%s)%s,%s,%s", SIGN, S1, S2, D); | |
| 1605 | sprintf(d_register, "%s", D); | |
| 1606 | return 1; | |
| 1607 | } | |
| 774 | 1608 | |
| 775 | if (!BITS(op_byte,0x80)) | |
| 776 | { | |
| 777 | if (BITS(op_byte,0x14) != 0x2) | |
| 778 | { | |
| 779 | /* ADD - 011m mKKK 0rru Fuuu */ | |
| 780 | /* SUB - 011m mKKK 0rru Fuuu */ | |
| 781 | /* These two opcodes are conflated */ | |
| 782 | decode_uuuuF_table(BITS(op_byte,0x17), BITS(op_byte,0x08), arg, S1, D); | |
| 783 | sprintf(opcode_str, "%s", arg); | |
| 784 | sprintf(arg_str, "%s,%s", S1, D); | |
| 785 | } | |
| 786 | else if (BITS(op_byte,0x14) == 0x2) | |
| 787 | { | |
| 788 | /* TFR - 011m mKKK 0rr1 F0DD */ | |
| 789 | /* MOVE - 011m mKKK 0rr1 0000 */ | |
| 790 | /* TODO: This MOVE opcode is .identical. to the TFR one. Investigate. */ | |
| 791 | decode_DDF_table(BITS(op_byte,0x03), BITS(op_byte,0x08), S1, D); | |
| 792 | sprintf(opcode_str, "tfr"); | |
| 793 | sprintf(arg_str, "%s,%s", S1, D); | |
| 794 | } | |
| 795 | } | |
| 796 | else | |
| 797 | { | |
| 798 | decode_QQF_table(BITS(op_byte,0x03), BITS(op_byte,0x08), S1, S2, D); | |
| 799 | sprintf(arg_str, "%s,%s,%s", S1, S2, D); /* Oddly, these 4 have identical operand ordering as */ | |
| 800 | /* compared to single memory move equivalents */ | |
| 801 | switch (BITS(op_byte,0x14)) | |
| 802 | { | |
| 803 | case 0x0: | |
| 804 | /* MPY - 011m mKKK 1rr0 F0QQ */ | |
| 805 | sprintf(opcode_str, "mpy"); | |
| 806 | break; | |
| 807 | 1609 | |
| 808 | case 0x1: | |
| 809 | /* MAC - 011m mKKK 1rr0 F1QQ */ | |
| 810 | sprintf(opcode_str, "mac"); | |
| 811 | break; | |
| 1610 | /******************************/ | |
| 1611 | /* Remaining non-parallel ops */ | |
| 1612 | /******************************/ | |
| 812 | 1613 | |
| 813 | case 0x2: | |
| 814 | /* MPYR - 011m mKKK 1rr1 F0QQ */ | |
| 815 | sprintf(opcode_str, "mpyr"); | |
| 816 | break; | |
| 1614 | /* ADC : 0001 0101 0000 F01J : A-20 */ | |
| 1615 | static size_t dsp56k_dasm_adc(const UINT16 op, char* opcode_str, char* arg_str) | |
| 1616 | { | |
| 1617 | char D[32]; | |
| 1618 | char S1[32]; | |
| 1619 | decode_JF_table(BITS(op,0x0001), BITS(op,0x0008), S1, D); | |
| 1620 | sprintf(opcode_str, "adc"); | |
| 1621 | sprintf(arg_str, "%s,%s", S1, D); | |
| 1622 | return 1; | |
| 1623 | } | |
| 817 | 1624 | |
| 818 | case 0x3: | |
| 819 | /* MACR - 011m mKKK 1rr1 F1QQ */ | |
| 820 | sprintf(opcode_str, "macr"); | |
| 821 | break; | |
| 822 | } | |
| 823 | } | |
| 1625 | /* ANDI : 0001 1EE0 iiii iiii : A-26 */ | |
| 1626 | static size_t dsp56k_dasm_andi(const UINT16 op, char* opcode_str, char* arg_str) | |
| 1627 | { | |
| 1628 | char D[32]; | |
| 1629 | decode_EE_table(BITS(op,0x0600), D); | |
| 1630 | sprintf(opcode_str, "and(i)"); | |
| 1631 | sprintf(arg_str, "#%02x,%s", BITS(op,0x00ff), D); | |
| 1632 | return 1; | |
| 824 | 1633 | } |
| 825 | 1634 | |
| 826 | static unsigned decode_TCC_opcode(const UINT16 op, char* opcode_str, char* arg_str) | |
| 1635 | /* ASL4 : 0001 0101 0011 F001 : A-30 */ | |
| 1636 | static size_t dsp56k_dasm_asl4(const UINT16 op, char* opcode_str, char* arg_str) | |
| 827 | 1637 | { |
| 828 | int Rnum = -1; | |
| 829 | char M[32]; | |
| 830 | 1638 | char D[32]; |
| 831 | char S[32]; | |
| 1639 | decode_F_table(BITS(op,0x0008), D); | |
| 1640 | sprintf(opcode_str, "asl4"); | |
| 1641 | sprintf(arg_str, "%s", D); | |
| 1642 | return 1; | |
| 1643 | } | |
| 832 | 1644 | |
| 833 | decode_cccc_table(BITS(op,0x03c0), M); | |
| 834 | sprintf(opcode_str, "t.%s", M); | |
| 1645 | /* ASR4 : 0001 0101 0011 F000 : A-34 */ | |
| 1646 | static size_t dsp56k_dasm_asr4(const UINT16 op, char* opcode_str, char* arg_str) | |
| 1647 | { | |
| 1648 | char D[32]; | |
| 1649 | decode_F_table(BITS(op,0x0008), D); | |
| 1650 | sprintf(opcode_str, "asr4"); | |
| 1651 | sprintf(arg_str, "%s", D); | |
| 1652 | return 1; | |
| 1653 | } | |
| 835 | 1654 | |
| 836 | Rnum = decode_RR_table(BITS(op,0x0030)); | |
| 837 | decode_h0hF_table(BITS(op,0x0007),BITS(op,0x0008), S, D); | |
| 838 | sprintf(arg_str, "%s,%s R0,R%d", S, D, Rnum); | |
| 839 | ||
| 840 | /* TODO: Investigate | |
| 841 | if (S1[0] == D[0] && D[0] == 'A') | |
| 842 | sprintf(buffer, "t.%s %s,%s", M, S1, D); | |
| 843 | else | |
| 844 | sprintf(buffer, "t.%s %s,%s R0,R%d", M, S1, D, Rnum); | |
| 845 | */ | |
| 846 | ||
| 1655 | /* ASR16 : 0001 0101 0111 F000 : A-36 */ | |
| 1656 | static size_t dsp56k_dasm_asr16(const UINT16 op, char* opcode_str, char* arg_str) | |
| 1657 | { | |
| 1658 | char D[32]; | |
| 1659 | decode_F_table(BITS(op,0x0008), D); | |
| 1660 | sprintf(opcode_str, "asr16"); | |
| 1661 | sprintf(arg_str, "%s", D); | |
| 847 | 1662 | return 1; |
| 848 | 1663 | } |
| 849 | 1664 | |
| 850 | /* TODO: Check all (dual-world) */ | |
| 851 | static unsigned decode_bitfield_opcode(const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str) | |
| 1665 | /* BFCHG : 0001 0100 11Pp pppp BBB1 0010 iiii iiii : A-38 */ | |
| 1666 | /* BFCHG : 0001 0100 101- --RR BBB1 0010 iiii iiii : A-38 */ | |
| 1667 | /* BFCHG : 0001 0100 100D DDDD BBB1 0010 iiii iiii : A-38 */ | |
| 1668 | /* BFCLR : 0001 0100 11Pp pppp BBB0 0100 iiii iiii : A-40 */ | |
| 1669 | /* BFCLR : 0001 0100 101- --RR BBB0 0100 iiii iiii : A-40 */ | |
| 1670 | /* BFCLR : 0001 0100 100D DDDD BBB0 0100 iiii iiii : A-40 */ | |
| 1671 | /* BFSET : 0001 0100 11Pp pppp BBB1 1000 iiii iiii : A-42 */ | |
| 1672 | /* BFSET : 0001 0100 101- --RR BBB1 1000 iiii iiii : A-42 */ | |
| 1673 | /* BFSET : 0001 0100 100D DDDD BBB1 1000 iiii iiii : A-42 */ | |
| 1674 | /* BFTSTH : 0001 0100 01Pp pppp BBB1 0000 iiii iiii : A-44 */ | |
| 1675 | /* BFTSTH : 0001 0100 001- --RR BBB1 0000 iiii iiii : A-44 */ | |
| 1676 | /* BFTSTH : 0001 0100 000D DDDD BBB1 0000 iiii iiii : A-44 */ | |
| 1677 | /* BFTSTL : 0001 0100 01Pp pppp BBB0 0000 iiii iiii : A-46 */ | |
| 1678 | /* BFTSTL : 0001 0100 001- --RR BBB0 0000 iiii iiii : A-46 */ | |
| 1679 | /* BFTSTL : 0001 0100 000D DDDD BBB0 0000 iiii iiii : A-46 */ | |
| 1680 | static size_t dsp56k_dasm_bfop(const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str) | |
| 852 | 1681 | { |
| 853 | 1682 | char D[32]; |
| 854 | 1683 | int upperMiddleLower = -1; |
| r3333 | r3334 | |
| 895 | 1724 | return 2; |
| 896 | 1725 | } |
| 897 | 1726 | |
| 898 | static unsigned decode_no_parallel_move_opcode(const UINT16 op, const UINT16 op2, const UINT16 pc, char* opcode_str, char* arg_str) | |
| 1727 | /* Bcc : 0000 0111 --11 cccc xxxx xxxx xxxx xxxx : A-48 */ | |
| 1728 | static size_t dsp56k_dasm_bcc(const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str, const offs_t pc) | |
| 899 | 1729 | { |
| 900 | unsigned retSize = 1; | |
| 1730 | char M[32]; | |
| 1731 | decode_cccc_table(BITS(op,0x000f), M); | |
| 1732 | sprintf(opcode_str, "b.%s", M); | |
| 1733 | sprintf(arg_str, "%d (0x%04x)", (INT16)op2, pc + 2 + (INT16)op2); | |
| 1734 | return 2; | |
| 1735 | } | |
| 901 | 1736 | |
| 902 | int Rnum = -1; | |
| 903 | char A[32]; | |
| 904 | char D[32]; | |
| 905 | char S1[32]; | |
| 906 | char S2[32]; | |
| 1737 | /* Bcc : 0010 11cc ccee eeee : A-48 */ | |
| 1738 | static size_t dsp56k_dasm_bcc_1(const UINT16 op, char* opcode_str, char* arg_str, const offs_t pc) | |
| 1739 | { | |
| 1740 | char M[32]; | |
| 1741 | INT8 relativeInt; | |
| 1742 | decode_cccc_table(BITS(op,0x3c0), M); | |
| 1743 | relativeInt = get_6_bit_signed_value(BITS(op,0x003f)); | |
| 1744 | sprintf(opcode_str, "b.%s", M); | |
| 1745 | sprintf(arg_str, "%d (0x%04x)", relativeInt, pc + 1 + relativeInt); | |
| 1746 | return 1; | |
| 1747 | } | |
| 907 | 1748 | |
| 908 | switch(BITS(op,0x0074)) | |
| 909 | { | |
| 910 | case 0x0: | |
| 911 | if (BITS(op,0x0006) == 0x0) | |
| 912 | { | |
| 913 | /* TFR(2) - 0001 0101 0000 F00J */ | |
| 914 | decode_JF_table(BITS(op,0x0001),BITS(op,0x0008), D, S1); | |
| 915 | sprintf(opcode_str, "tfr2"); | |
| 916 | sprintf(arg_str, "%s,%s", S1, D); | |
| 917 | } | |
| 918 | else if (BITS(op,0x0006) == 0x1) | |
| 919 | { | |
| 920 | /* ADC - 0001 0101 0000 F01J */ | |
| 921 | decode_JF_table(BITS(op,0x0001),BITS(op,0x0008), S1, D); | |
| 922 | sprintf(opcode_str, "adc"); | |
| 923 | sprintf(arg_str, "%s,%s", S1, D); | |
| 924 | } | |
| 925 | break; | |
| 1749 | /* Bcc : 0000 0111 RR10 cccc : A-48 */ | |
| 1750 | static size_t dsp56k_dasm_bcc_2(const UINT16 op, char* opcode_str, char* arg_str) | |
| 1751 | { | |
| 1752 | int Rnum; | |
| 1753 | char M[32]; | |
| 1754 | decode_cccc_table(BITS(op,0x000f), M); | |
| 1755 | Rnum = decode_RR_table(BITS(op,0x00c0)); | |
| 1756 | sprintf(opcode_str, "b.%s", M); | |
| 1757 | sprintf(arg_str, "R%d", Rnum); | |
| 1758 | return 1; | |
| 1759 | } | |
| 926 | 1760 | |
| 927 | case 0x3: | |
| 928 | /* TST(2) - 0001 0101 0001 -1DD */ | |
| 929 | decode_DD_table(BITS(op,0x0003), S1); | |
| 930 | sprintf(opcode_str, "tst2"); | |
| 931 | sprintf(arg_str, "%s", S1); | |
| 932 | break; | |
| 1761 | /* BRA : 0000 0001 0011 11-- xxxx xxxx xxxx xxxx : A-50 */ | |
| 1762 | static size_t dsp56k_dasm_bra(const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str, const offs_t pc) | |
| 1763 | { | |
| 1764 | sprintf(opcode_str, "bra"); | |
| 1765 | sprintf(arg_str, "%d (0x%04x)", (INT16)op2, pc + 2 + op2); | |
| 1766 | return 2; | |
| 1767 | } | |
| 933 | 1768 | |
| 934 | case 0x4: | |
| 935 | /* NORM - 0001 0101 0010 F0RR */ | |
| 936 | decode_F_table(BITS(op,0x0008), D); | |
| 937 | Rnum = decode_RR_table(BITS(op,0x0003)); | |
| 938 | sprintf(opcode_str, "norm"); | |
| 939 | sprintf(arg_str, "R%d,%s", Rnum, D); | |
| 940 | break; | |
| 1769 | /* BRA : 0000 1011 aaaa aaaa : A-50 */ | |
| 1770 | static size_t dsp56k_dasm_bra_1(const UINT16 op, char* opcode_str, char* arg_str, const offs_t pc) | |
| 1771 | { | |
| 1772 | sprintf(opcode_str, "bra"); | |
| 1773 | sprintf(arg_str, "%d (0x%02x)", (INT8)BITS(op,0x00ff), pc + 1 + (INT8)BITS(op,0x00ff)); | |
| 1774 | return 1; | |
| 1775 | } | |
| 941 | 1776 | |
| 942 | case 0x6: | |
| 943 | if (BITS(op,0x0003) == 0x0) | |
| 944 | { | |
| 945 | /* ASR4 - 0001 0101 0011 F000 */ | |
| 946 | decode_F_table(BITS(op,0x0008), D); | |
| 947 | sprintf(opcode_str, "asr4"); | |
| 948 | sprintf(arg_str, "%s", D); | |
| 949 | } | |
| 950 | else if (BITS(op,0x0003) == 0x1) | |
| 951 | { | |
| 952 | /* ASL4 - 0001 0101 0011 F001 */ | |
| 953 | decode_F_table(BITS(op,0x0008), D); | |
| 954 | sprintf(opcode_str, "asl4"); | |
| 955 | sprintf(arg_str, "%s", D); | |
| 956 | } | |
| 957 | break; | |
| 1777 | /* BRA : 0000 0001 0010 11RR : A-50 */ | |
| 1778 | static size_t dsp56k_dasm_bra_2(const UINT16 op, char* opcode_str, char* arg_str) | |
| 1779 | { | |
| 1780 | int Rnum; | |
| 1781 | Rnum = decode_RR_table(BITS(op,0x0003)); | |
| 1782 | sprintf(opcode_str, "bra"); | |
| 1783 | sprintf(arg_str, "R%d", Rnum); | |
| 1784 | return 1; | |
| 1785 | } | |
| 958 | 1786 | |
| 959 | case 0x1: case 0x5: case 0x9: case 0xd: | |
| 960 | /* DIV - 0001 0101 0--0 F1DD */ | |
| 961 | decode_DDF_table(BITS(op,0x0003), BITS(op,0x0008), S1, D); | |
| 962 | sprintf(opcode_str, "div"); | |
| 963 | sprintf(arg_str, "%s,%s", S1, D); | |
| 964 | break; | |
| 1787 | /* BRKc : 0000 0001 0001 cccc : A-52 */ | |
| 1788 | static size_t dsp56k_dasm_brkc(const UINT16 op, char* opcode_str, char* arg_str) | |
| 1789 | { | |
| 1790 | char M[32]; | |
| 1791 | decode_cccc_table(BITS(op,0x000f), M); | |
| 1792 | sprintf(opcode_str, "brk.%s", M); | |
| 1793 | sprintf(arg_str, " "); | |
| 1794 | return 1; | |
| 1795 | } | |
| 965 | 1796 | |
| 966 | case 0xa: | |
| 967 | if (BITS(op,0x0003) == 0x0) | |
| 968 | { | |
| 969 | /* ZERO - 0001 0101 0101 F000 */ | |
| 970 | decode_F_table(BITS(op,0x0008), D); | |
| 971 | sprintf(opcode_str, "zero"); | |
| 972 | sprintf(arg_str, "%s", D); | |
| 973 | } | |
| 974 | else if (BITS(op,0x0003) == 0x2) | |
| 975 | { | |
| 976 | /* EXT - 0001 0101 0101 F010 */ | |
| 977 | decode_F_table(BITS(op,0x0008), D); | |
| 978 | sprintf(opcode_str, "ext"); | |
| 979 | sprintf(arg_str, "%s", D); | |
| 980 | } | |
| 981 | break; | |
| 1797 | /* BScc : 0000 0111 --01 cccc xxxx xxxx xxxx xxxx : A-54 */ | |
| 1798 | static size_t dsp56k_dasm_bscc(const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str, const offs_t pc) | |
| 1799 | { | |
| 1800 | char M[32]; | |
| 1801 | decode_cccc_table(BITS(op,0x000f), M); | |
| 1802 | sprintf(opcode_str, "bs.%s", M); | |
| 1803 | sprintf(arg_str, "%d (0x%04x)", (INT16)op2, pc + 2 + (INT16)op2); | |
| 1804 | return (2 | DASMFLAG_STEP_OVER); /* probably */ | |
| 1805 | } | |
| 982 | 1806 | |
| 983 | case 0xc: | |
| 984 | if (BITS(op,0x0003) == 0x0) | |
| 985 | { | |
| 986 | /* NEGC - 0001 0101 0110 F000 */ | |
| 987 | decode_F_table(BITS(op,0x0008), D); | |
| 988 | sprintf(opcode_str, "negc"); | |
| 989 | sprintf(arg_str, "%s", D); | |
| 990 | } | |
| 991 | break; | |
| 1807 | /* BScc: 0000 0111 RR00 cccc : A-54 */ | |
| 1808 | static size_t dsp56k_dasm_bscc_1(const UINT16 op, char* opcode_str, char* arg_str) | |
| 1809 | { | |
| 1810 | int Rnum; | |
| 1811 | char M[32]; | |
| 1812 | decode_cccc_table(BITS(op,0x000f), M); | |
| 1813 | Rnum = decode_RR_table(BITS(op,0x00c0)); | |
| 1814 | sprintf(opcode_str, "bs.%s", M); | |
| 1815 | sprintf(arg_str, "R%d", Rnum); | |
| 1816 | return (1 | DASMFLAG_STEP_OVER); /* probably. What's the diff between a branch and a jump? */ | |
| 1817 | } | |
| 992 | 1818 | |
| 993 | case 0xe: | |
| 994 | if (BITS(op,0x0003) == 0x0) | |
| 995 | { | |
| 996 | /* ASR16 - 0001 0101 0111 F000 */ | |
| 997 | decode_F_table(BITS(op,0x0008), D); | |
| 998 | sprintf(opcode_str, "asr16"); | |
| 999 | sprintf(arg_str, "%s", D); | |
| 1000 | } | |
| 1001 | else if (BITS(op,0x0003) == 0x1) | |
| 1002 | { | |
| 1003 | /* SWAP - 0001 0101 0111 F001 */ | |
| 1004 | decode_F_table(BITS(op,0x0008), D); | |
| 1005 | sprintf(opcode_str, "swap"); | |
| 1006 | sprintf(arg_str, "%s", D); | |
| 1007 | } | |
| 1008 | break; | |
| 1009 | } | |
| 1819 | /* BSR : 0000 0001 0011 10-- xxxx xxxx xxxx xxxx : A-56 */ | |
| 1820 | static size_t dsp56k_dasm_bsr(const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str, const offs_t pc) | |
| 1821 | { | |
| 1822 | sprintf(opcode_str, "bsr"); | |
| 1823 | sprintf(arg_str, "%d (0x%04x)", (INT16)op2, pc + 2 + (INT16)op2); | |
| 1824 | return (2 | DASMFLAG_STEP_OVER); | |
| 1825 | } | |
| 1010 | 1826 | |
| 1011 | switch(BITS(op,0x00f0)) | |
| 1012 | { | |
| 1013 | case 0x8: | |
| 1014 | /* IMPY - 0001 0101 1000 FQQQ */ | |
| 1015 | decode_QQQF_table(BITS(op,0x0007), BITS(op,0x0008), S1, S2, D); | |
| 1016 | sprintf(opcode_str, "impy"); | |
| 1017 | sprintf(arg_str, "%s,%s,%s", S1, S2, D); | |
| 1018 | break; | |
| 1019 | case 0xa: | |
| 1020 | /* IMAC - 0001 0101 1010 FQQQ */ | |
| 1021 | decode_QQQF_table(BITS(op,0x0007), BITS(op,0x0008), S1, S2, D); | |
| 1022 | sprintf(opcode_str, "imac"); | |
| 1023 | sprintf(arg_str, "%s,%s,%s", S1, S2, D); | |
| 1024 | break; | |
| 1025 | case 0x9: case 0xb: | |
| 1026 | /* DMAC(ss,su,uu) - 0001 0101 10s1 FsQQ */ | |
| 1027 | decode_ss_table(BITS(op,0x0024), A); | |
| 1028 | decode_QQF_special_table(BITS(op,0x0003), BITS(op,0x0008), S1, S2, D); /* Special QQF */ | |
| 1029 | sprintf(opcode_str, "dmac(%s)", A); | |
| 1030 | sprintf(arg_str, "%s,%s,%s", S1, S2, D); | |
| 1031 | break; | |
| 1032 | case 0xc: | |
| 1033 | /* MPY(su,uu) - 0001 0101 1100 FsQQ */ | |
| 1034 | decode_s_table(BITS(op,0x0004), A); | |
| 1035 | decode_QQF_special_table(BITS(op,0x0003), BITS(op,0x0008), S1, S2, D); /* Special QQF */ | |
| 1036 | sprintf(opcode_str, "mpy(%s)", A); | |
| 1037 | sprintf(arg_str, "%s,%s,%s", S1, S2, D); | |
| 1038 | break; | |
| 1039 | case 0xe: | |
| 1040 | /* MAC(su,uu) - 0001 0101 1110 FsQQ */ | |
| 1041 | decode_s_table(BITS(op,0x0004), A); | |
| 1042 | decode_QQF_special_table(BITS(op,0x0003), BITS(op,0x0008), S1, S2, D); /* Special QQF */ | |
| 1043 | sprintf(opcode_str, "mac(%s)", A); | |
| 1044 | sprintf(arg_str, "%s,%s,%s", S1, S2, D); | |
| 1045 | break; | |
| 1046 | } | |
| 1827 | /* BSR : 0000 0001 0010 10RR : A-56 */ | |
| 1828 | static size_t dsp56k_dasm_bsr_1(const UINT16 op, char* opcode_str, char* arg_str) | |
| 1829 | { | |
| 1830 | int Rnum; | |
| 1831 | Rnum = decode_RR_table(BITS(op,0x0003)); | |
| 1832 | sprintf(opcode_str, "bsr"); | |
| 1833 | sprintf(arg_str, "R%d", Rnum); | |
| 1834 | return (1 | DASMFLAG_STEP_OVER); | |
| 1835 | } | |
| 1047 | 1836 | |
| 1048 | return retSize; | |
| 1837 | /* CHKAAU : 0000 0000 0000 0100 : A-58 */ | |
| 1838 | static size_t dsp56k_dasm_chkaau(const UINT16 op, char* opcode_str, char* arg_str) | |
| 1839 | { | |
| 1840 | sprintf(opcode_str, "chkaau"); | |
| 1841 | sprintf(arg_str, " "); | |
| 1842 | return 1; | |
| 1049 | 1843 | } |
| 1050 | 1844 | |
| 1051 | static unsigned decode_immediate_opcode(const UINT16 op, const UINT16 pc, char* opcode_str, char* arg_str) | |
| 1845 | /* DEBUG : 0000 0000 0000 0001 : A-68 */ | |
| 1846 | static size_t dsp56k_dasm_debug(const UINT16 op, char* opcode_str, char* arg_str) | |
| 1052 | 1847 | { |
| 1053 | unsigned retSize = 1; | |
| 1848 | sprintf(opcode_str, "debug"); | |
| 1849 | sprintf(arg_str, " "); | |
| 1850 | return 1; | |
| 1851 | } | |
| 1054 | 1852 | |
| 1055 | if (BITS(op,0x0600)) | |
| 1056 | { | |
| 1057 | if (!BITS(op,0x0100)) | |
| 1058 | { | |
| 1059 | /* ANDI - 0001 1EE0 iiii iiii */ | |
| 1060 | char D[32]; | |
| 1061 | decode_EE_table(BITS(op,0x0600), D); | |
| 1062 | sprintf(opcode_str, "and(i)"); | |
| 1063 | sprintf(arg_str, "#%02x,%s", BITS(op,0x00ff), D); | |
| 1064 | } | |
| 1065 | else | |
| 1066 | { | |
| 1067 | /* ORI - 0001 1EE1 iiii iiii */ | |
| 1068 | char D[32]; | |
| 1069 | decode_EE_table(BITS(op,0x0600), D); | |
| 1070 | sprintf(opcode_str, "or(i)"); | |
| 1071 | sprintf(arg_str, "#%02x,%s", BITS(op,0x00ff), D); | |
| 1072 | } | |
| 1073 | } | |
| 1074 | else | |
| 1075 | { | |
| 1076 | if (!BITS(op,0x0020)) | |
| 1077 | { | |
| 1078 | /* MOVE(S) - 0001 100W HH0a aaaa */ | |
| 1079 | char A[32]; | |
| 1080 | char SD[32]; | |
| 1081 | char args[32]; | |
| 1082 | decode_HH_table(BITS(op,0x00c0), SD); | |
| 1083 | sprintf(A, "00%02x", BITS(op,0x001f)); | |
| 1084 | assemble_arguments_from_W_table(BITS(op,0x0100), args, 'X', SD, A); | |
| 1085 | sprintf(opcode_str, "move(s)"); | |
| 1086 | sprintf(arg_str, "%s", args); | |
| 1087 | } | |
| 1088 | else | |
| 1089 | { | |
| 1090 | /* MOVE(P) - 0001 100W HH1p pppp */ | |
| 1091 | char A[32]; | |
| 1092 | char SD[32]; | |
| 1093 | char args[32]; | |
| 1094 | char fullAddy[128]; | |
| 1095 | decode_HH_table(BITS(op,0x00c0), SD); | |
| 1096 | assemble_address_from_IO_short_address(BITS(op,0x001f), fullAddy); /* Convert Short Absolute Address to full 16-bit */ | |
| 1097 | sprintf(A, "%02x (%s)", BITS(op,0x001f), fullAddy); | |
| 1098 | assemble_arguments_from_W_table(BITS(op,0x0100), args, 'X', SD, A); | |
| 1099 | sprintf(opcode_str, "move(p)"); | |
| 1100 | sprintf(arg_str, "%s", args); | |
| 1101 | } | |
| 1102 | } | |
| 1853 | /* DEBUGcc : 0000 0000 0101 cccc : A-70 */ | |
| 1854 | static size_t dsp56k_dasm_debugcc(const UINT16 op, char* opcode_str, char* arg_str) | |
| 1855 | { | |
| 1856 | char M[32]; | |
| 1857 | decode_cccc_table(BITS(op,0x000f), M); | |
| 1858 | sprintf(opcode_str, "debug.%s", M); | |
| 1859 | sprintf(arg_str, " "); | |
| 1860 | return 1; | |
| 1861 | } | |
| 1103 | 1862 | |
| 1104 | return retSize; | |
| 1863 | /* DIV : 0001 0101 0--0 F1DD : A-76 */ | |
| 1864 | /* WARNING : DOCS SAY THERE IS A PARALLEL MOVE HERE !!! */ | |
| 1865 | static size_t dsp56k_dasm_div(const UINT16 op, char* opcode_str, char* arg_str) | |
| 1866 | { | |
| 1867 | char D[32]; | |
| 1868 | char S1[32]; | |
| 1869 | decode_DDF_table(BITS(op,0x0003), BITS(op,0x0008), S1, D); | |
| 1870 | sprintf(opcode_str, "div"); | |
| 1871 | sprintf(arg_str, "%s,%s", S1, D); | |
| 1872 | return 1; | |
| 1105 | 1873 | } |
| 1106 | 1874 | |
| 1107 | static unsigned decode_movec_opcodes(const UINT16 op, const UINT16 op2, const UINT16 pc, char* opcode_str, char* arg_str) | |
| 1875 | /* DMAC : 0001 0101 10s1 FsQQ : A-80 */ | |
| 1876 | static size_t dsp56k_dasm_dmac(const UINT16 op, char* opcode_str, char* arg_str) | |
| 1108 | 1877 | { |
| 1109 | unsigned retSize = 1; | |
| 1878 | char A[32]; | |
| 1879 | char D[32]; | |
| 1880 | char S1[32]; | |
| 1881 | char S2[32]; | |
| 1882 | decode_ss_table(BITS(op,0x0024), A); | |
| 1883 | decode_QQF_special_table(BITS(op,0x0003), BITS(op,0x0008), S1, S2, D); /* Special QQF */ | |
| 1884 | sprintf(opcode_str, "dmac(%s)", A); | |
| 1885 | sprintf(arg_str, "%s,%s,%s", S1, S2, D); | |
| 1886 | return 1; | |
| 1887 | } | |
| 1110 | 1888 | |
| 1111 | char SD[32]; | |
| 1112 | char ea[32]; | |
| 1113 | char args[64]; | |
| 1114 | int Rnum = -1; | |
| 1889 | /* DO : 0000 0000 110- --RR xxxx xxxx xxxx xxxx : A-82 */ | |
| 1890 | static size_t dsp56k_dasm_do(const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str) | |
| 1891 | { | |
| 1892 | int Rnum; | |
| 1893 | Rnum = decode_RR_table(BITS(op,0x0003)); | |
| 1894 | sprintf(opcode_str, "do"); | |
| 1895 | sprintf(arg_str, "X:(R%d),%02x", Rnum, op2); | |
| 1896 | return 2; | |
| 1897 | } | |
| 1115 | 1898 | |
| 1116 | if (BITS(op,0x0010) == 0x0) | |
| 1117 | { | |
| 1118 | /* MOVE(C) - 0011 1WDD DDD0 MMRR */ | |
| 1119 | decode_DDDDD_table(BITS(op,0x03e0), SD); | |
| 1120 | Rnum = decode_RR_table(BITS(op,0x0003)); | |
| 1121 | assemble_ea_from_MM_table(BITS(op,0x000c), Rnum, ea); | |
| 1122 | assemble_arguments_from_W_table(BITS(op,0x0400), args, 'X', SD, ea); | |
| 1123 | sprintf(opcode_str, "move(c)"); | |
| 1124 | sprintf(arg_str, "%s", args); | |
| 1125 | } | |
| 1126 | else | |
| 1127 | { | |
| 1128 | if (BITS(op,0x0004) == 0x0) | |
| 1129 | { | |
| 1130 | /* MOVE(C) - 0011 1WDD DDD1 q0RR */ | |
| 1131 | decode_DDDDD_table(BITS(op,0x03e0), SD); | |
| 1132 | Rnum = decode_RR_table(BITS(op,0x0003)); | |
| 1133 | assemble_ea_from_q_table(BITS(op,0x0008), Rnum, ea); | |
| 1134 | assemble_arguments_from_W_table(BITS(op,0x0400), args, 'X', SD, ea); | |
| 1135 | sprintf(opcode_str, "move(c)"); | |
| 1136 | sprintf(arg_str, "%s", args); | |
| 1137 | } | |
| 1138 | else | |
| 1139 | { | |
| 1140 | switch(BITS(op,0x0006)) | |
| 1141 | { | |
| 1142 | /* MOVE(C) - 0011 1WDD DDD1 t10- xxxx xxxx xxxx xxxx */ | |
| 1143 | case 0x2: | |
| 1144 | decode_DDDDD_table(BITS(op,0x03e0), SD); | |
| 1145 | assemble_ea_from_t_table(BITS(op,0x0008), op2, ea); | |
| 1146 | /* !!! I'm pretty sure this is in the right order - same issue as the WTables !!! */ | |
| 1147 | if (BITS(op,0x0400)) /* fixed - 02/03/05 */ | |
| 1148 | sprintf(args, "%s,%s", ea, SD); | |
| 1149 | else | |
| 1150 | sprintf(args, "%s,%s", SD, ea); | |
| 1151 | sprintf(opcode_str, "move(c)"); | |
| 1152 | sprintf(arg_str, "%s", args); | |
| 1153 | retSize = 2; | |
| 1154 | break; | |
| 1899 | /* DO : 0000 1110 iiii iiii xxxx xxxx xxxx xxxx : A-82 */ | |
| 1900 | static size_t dsp56k_dasm_do_1(const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str) | |
| 1901 | { | |
| 1902 | sprintf(opcode_str, "do"); | |
| 1903 | sprintf(arg_str, "#%02x,%04x", BITS(op,0x00ff), op2); | |
| 1904 | return 2; | |
| 1905 | } | |
| 1155 | 1906 | |
| 1156 | /* MOVE(C) - 0011 1WDD DDD1 Z11- */ | |
| 1157 | case 0x3: | |
| 1158 | decode_DDDDD_table(BITS(op,0x03e0), SD); | |
| 1159 | decode_Z_table(BITS(op,0x0008), ea); | |
| 1160 | assemble_arguments_from_W_table(BITS(op,0x0400), args, 'X', SD, ea); | |
| 1161 | sprintf(opcode_str, "move(c)"); | |
| 1162 | sprintf(arg_str, "%s", args); | |
| 1163 | break; | |
| 1164 | } | |
| 1165 | } | |
| 1166 | } | |
| 1907 | /* DO : 0000 0100 000D DDDD xxxx xxxx xxxx xxxx : A-82 */ | |
| 1908 | static size_t dsp56k_dasm_do_2(const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str) | |
| 1909 | { | |
| 1910 | char S1[32]; | |
| 1911 | decode_DDDDD_table(BITS(op,0x001f), S1); | |
| 1912 | sprintf(opcode_str, "do"); | |
| 1913 | sprintf(arg_str, "%s,%04x", S1, op2); | |
| 1914 | return 2; | |
| 1915 | } | |
| 1167 | 1916 | |
| 1168 | return retSize; | |
| 1917 | /* DO FOREVER : 0000 0000 0000 0010 xxxx xxxx xxxx xxxx : A-88 */ | |
| 1918 | static size_t dsp56k_dasm_doforever(const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str) | |
| 1919 | { | |
| 1920 | sprintf(opcode_str, "doForever"); | |
| 1921 | sprintf(arg_str, "%04x", op2); | |
| 1922 | return 2; | |
| 1169 | 1923 | } |
| 1170 | 1924 | |
| 1171 | static unsigned decode_misc_opcode(const UINT16 op, const UINT16 pc, char* opcode_str, char* arg_str) | |
| 1925 | /* ENDDO : 0000 0000 0000 1001 : A-92 */ | |
| 1926 | static size_t dsp56k_dasm_enddo(const UINT16 op, char* opcode_str, char* arg_str) | |
| 1172 | 1927 | { |
| 1173 | unsigned retSize = 1; | |
| 1928 | sprintf(opcode_str, "enddo"); | |
| 1929 | sprintf(arg_str, " "); | |
| 1930 | return 1; | |
| 1931 | } | |
| 1174 | 1932 | |
| 1175 | char M[32]; | |
| 1933 | /* EXT : 0001 0101 0101 F010 : A-96 */ | |
| 1934 | static size_t dsp56k_dasm_ext(const UINT16 op, char* opcode_str, char* arg_str) | |
| 1935 | { | |
| 1936 | char D[32]; | |
| 1937 | decode_F_table(BITS(op,0x0008), D); | |
| 1938 | sprintf(opcode_str, "ext"); | |
| 1939 | sprintf(arg_str, "%s", D); | |
| 1940 | return 1; | |
| 1941 | } | |
| 1942 | ||
| 1943 | /* ILLEGAL : 0000 0000 0000 1111 : A-98 */ | |
| 1944 | static size_t dsp56k_dasm_illegal(const UINT16 op, char* opcode_str, char* arg_str) | |
| 1945 | { | |
| 1946 | sprintf(opcode_str, "illegal"); | |
| 1947 | sprintf(arg_str, " "); | |
| 1948 | return 1; | |
| 1949 | } | |
| 1950 | ||
| 1951 | /* IMAC : 0001 0101 1010 FQQQ : A-100 */ | |
| 1952 | static size_t dsp56k_dasm_imac(const UINT16 op, char* opcode_str, char* arg_str) | |
| 1953 | { | |
| 1954 | char D[32]; | |
| 1176 | 1955 | char S1[32]; |
| 1177 | char SD[32]; | |
| 1178 | char D1[32]; | |
| 1179 | char ea[32]; | |
| 1180 | char args[64]; | |
| 1181 | int Rnum = -1; | |
| 1182 | int relativeInt = 666; | |
| 1956 | char S2[32]; | |
| 1957 | decode_QQQF_table(BITS(op,0x0007), BITS(op,0x0008), S1, S2, D); | |
| 1958 | sprintf(opcode_str, "imac"); | |
| 1959 | sprintf(arg_str, "%s,%s,%s", S1, S2, D); | |
| 1960 | return 1; | |
| 1961 | } | |
| 1183 | 1962 | |
| 1184 | switch(BITS(op,0x0c00)) | |
| 1185 | { | |
| 1186 | /* MOVE(I) - 0010 00DD BBBB BBBB */ | |
| 1187 | case 0x0: | |
| 1188 | decode_DD_table(BITS(op,0x0300), D1); | |
| 1189 | sprintf(opcode_str, "move(i)"); | |
| 1190 | sprintf(arg_str, "#%02x,%s", BITS(op,0x00ff), D1); | |
| 1191 | break; | |
| 1963 | /* IMPY : 0001 0101 1000 FQQQ : A-102 */ | |
| 1964 | static size_t dsp56k_dasm_impy(const UINT16 op, char* opcode_str, char* arg_str) | |
| 1965 | { | |
| 1966 | char D[32]; | |
| 1967 | char S1[32]; | |
| 1968 | char S2[32]; | |
| 1969 | decode_QQQF_table(BITS(op,0x0007), BITS(op,0x0008), S1, S2, D); | |
| 1970 | sprintf(opcode_str, "impy"); | |
| 1971 | sprintf(arg_str, "%s,%s,%s", S1, S2, D); | |
| 1972 | return 1; | |
| 1973 | } | |
| 1192 | 1974 | |
| 1193 | /* TFR(3) - 0010 01mW RRDD FHHH */ | |
| 1194 | case 0x1: | |
| 1195 | decode_DDF_table(BITS(op,0x0030), BITS(op,0x0008), D1, S1); /* Intentionally switched */ | |
| 1196 | decode_HHH_table(BITS(op,0x0007), SD); | |
| 1197 | Rnum = decode_RR_table(BITS(op,0x00c0)); | |
| 1198 | assemble_ea_from_m_table(BITS(op,0x0200), Rnum, ea); | |
| 1199 | assemble_arguments_from_W_table(BITS(op,0x0100), args, 'X', SD, ea); | |
| 1200 | sprintf(opcode_str, "tfr3"); | |
| 1201 | sprintf(arg_str, "%s,%s %s", S1, D1, args); | |
| 1202 | break; | |
| 1975 | /* Jcc : 0000 0110 --11 cccc xxxx xxxx xxxx xxxx : A-108 */ | |
| 1976 | static size_t dsp56k_dasm_jcc(const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str) | |
| 1977 | { | |
| 1978 | char M[32]; | |
| 1979 | decode_cccc_table(BITS(op,0x000f), M); | |
| 1980 | sprintf(opcode_str, "j.%s", M); | |
| 1981 | sprintf(arg_str, "%04x", op2); | |
| 1982 | return 2; | |
| 1983 | } | |
| 1203 | 1984 | |
| 1204 | /* MOVE(C) - 0010 10dd dddD DDDD */ | |
| 1205 | case 0x2: | |
| 1206 | decode_DDDDD_table(BITS(op,0x03e0), S1); | |
| 1207 | decode_DDDDD_table(BITS(op,0x001f), D1); | |
| 1208 | sprintf(opcode_str, "move(c)"); | |
| 1209 | sprintf(arg_str, "%s,%s", S1, D1); | |
| 1210 | break; | |
| 1985 | /* Jcc : 0000 0110 RR10 cccc : A-108 */ | |
| 1986 | static size_t dsp56k_dasm_jcc_1(const UINT16 op, char* opcode_str, char* arg_str) | |
| 1987 | { | |
| 1988 | int Rnum; | |
| 1989 | char M[32]; | |
| 1990 | decode_cccc_table(BITS(op,0x000f), M); | |
| 1991 | Rnum = decode_RR_table(BITS(op,0x00c0)); | |
| 1992 | sprintf(opcode_str, "j.%s", M); | |
| 1993 | sprintf(arg_str, "R%d", Rnum); | |
| 1994 | return 1; | |
| 1995 | } | |
| 1211 | 1996 | |
| 1212 | /* B.cc - 0010 11cc ccee eeee */ | |
| 1213 | case 0x3: | |
| 1214 | decode_cccc_table(BITS(op,0x3c0), M); | |
| 1215 | relativeInt = get_6_bit_relative_value(BITS(op,0x003f)); | |
| 1216 | sprintf(opcode_str, "b.%s", M); | |
| 1217 | sprintf(arg_str, "%04x (%d)", (int)pc + relativeInt, relativeInt); | |
| 1218 | break; | |
| 1219 | } | |
| 1997 | /* JMP : 0000 0001 0011 01-- xxxx xxxx xxxx xxxx : A-110 */ | |
| 1998 | static size_t dsp56k_dasm_jmp(const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str) | |
| 1999 | { | |
| 2000 | sprintf(opcode_str, "jmp"); | |
| 2001 | sprintf(arg_str, "%04x", op2); | |
| 2002 | return 2; | |
| 2003 | } | |
| 1220 | 2004 | |
| 1221 | return retSize; | |
| 2005 | /* JMP : 0000 0001 0010 01RR : A-110 */ | |
| 2006 | static size_t dsp56k_dasm_jmp_1(const UINT16 op, char* opcode_str, char* arg_str) | |
| 2007 | { | |
| 2008 | int Rnum; | |
| 2009 | Rnum = decode_RR_table(BITS(op,0x0003)); | |
| 2010 | sprintf(opcode_str, "jmp"); | |
| 2011 | sprintf(arg_str, "R%d", Rnum); | |
| 2012 | return 1; | |
| 1222 | 2013 | } |
| 1223 | 2014 | |
| 1224 | /* TODO: Check all dual-word guys */ | |
| 1225 | static unsigned decode_unique_opcode(const UINT16 op, const UINT16 op2, const UINT16 pc, char* opcode_str, char* arg_str) | |
| 2015 | /* JScc : 0000 0110 --01 cccc xxxx xxxx xxxx xxxx : A-112 */ | |
| 2016 | static size_t dsp56k_dasm_jscc(const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str) | |
| 1226 | 2017 | { |
| 1227 | unsigned retSize = 1; | |
| 2018 | char M[32]; | |
| 2019 | decode_cccc_table(BITS(op,0x000f), M); | |
| 2020 | sprintf(opcode_str, "js.%s", M); | |
| 2021 | sprintf(arg_str, "%04x", op2); | |
| 2022 | return (2 |DASMFLAG_STEP_OVER); /* probably */ | |
| 2023 | } | |
| 1228 | 2024 | |
| 2025 | /* JScc : 0000 0110 RR00 cccc : A-112 */ | |
| 2026 | static size_t dsp56k_dasm_jscc_1(const UINT16 op, char* opcode_str, char* arg_str) | |
| 2027 | { | |
| 2028 | int Rnum; | |
| 2029 | char M[32]; | |
| 2030 | decode_cccc_table(BITS(op,0x000f), M); | |
| 2031 | Rnum = decode_RR_table(BITS(op,0x00c0)); | |
| 2032 | sprintf(opcode_str, "js.%s", M); | |
| 2033 | sprintf(arg_str, "R%d", Rnum); | |
| 2034 | return (1 | DASMFLAG_STEP_OVER); /* probably. What's the diff between a branch and a jump? */ | |
| 2035 | } | |
| 2036 | ||
| 2037 | /* JSR : 0000 0001 0011 00-- xxxx xxxx xxxx xxxx : A-114 */ | |
| 2038 | static size_t dsp56k_dasm_jsr(const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str) | |
| 2039 | { | |
| 2040 | sprintf(opcode_str, "jsr"); | |
| 2041 | sprintf(arg_str, "%04x", op2); | |
| 2042 | return (2 | DASMFLAG_STEP_OVER); | |
| 2043 | } | |
| 2044 | ||
| 2045 | /* JSR : 0000 1010 AAAA AAAA : A-114 */ | |
| 2046 | static size_t dsp56k_dasm_jsr_1(const UINT16 op, char* opcode_str, char* arg_str) | |
| 2047 | { | |
| 2048 | sprintf(opcode_str, "jsr"); | |
| 2049 | sprintf(arg_str, "%d (0x%02x)", BITS(op,0x00ff), BITS(op,0x00ff)); | |
| 2050 | return (1 | DASMFLAG_STEP_OVER); | |
| 2051 | } | |
| 2052 | ||
| 2053 | /* JSR : 0000 0001 0010 00RR : A-114 */ | |
| 2054 | static size_t dsp56k_dasm_jsr_2(const UINT16 op, char* opcode_str, char* arg_str) | |
| 2055 | { | |
| 2056 | int Rnum; | |
| 2057 | Rnum = decode_RR_table(BITS(op,0x0003)); | |
| 2058 | sprintf(opcode_str, "jsr"); | |
| 2059 | sprintf(arg_str, "R%d", Rnum); | |
| 2060 | return (1 | DASMFLAG_STEP_OVER); | |
| 2061 | } | |
| 2062 | ||
| 2063 | /* LEA : 0000 0001 11TT MMRR : A-116 */ | |
| 2064 | static size_t dsp56k_dasm_lea(const UINT16 op, char* opcode_str, char* arg_str) | |
| 2065 | { | |
| 2066 | int Rnum; | |
| 2067 | int Tnum; | |
| 1229 | 2068 | char ea[32]; |
| 1230 | char ea2[32]; | |
| 2069 | Tnum = decode_TT_table(BITS(op,0x0030)); | |
| 2070 | Rnum = decode_RR_table(BITS(op,0x0003)); | |
| 2071 | assemble_ea_from_MM_table(BITS(op,0x000c), Rnum, ea); | |
| 2072 | sprintf(opcode_str, "lea"); | |
| 2073 | sprintf(arg_str, "%s,R%d", ea, Tnum); | |
| 2074 | return 1; | |
| 2075 | } | |
| 2076 | ||
| 2077 | /* LEA : 0000 0001 10NN MMRR : A-116 */ | |
| 2078 | static size_t dsp56k_dasm_lea_1(const UINT16 op, char* opcode_str, char* arg_str) | |
| 2079 | { | |
| 2080 | int Nnum; | |
| 2081 | int Rnum; | |
| 2082 | char ea[32]; | |
| 2083 | Nnum = decode_NN_table(BITS(op,0x0030)); | |
| 2084 | Rnum = decode_RR_table(BITS(op,0x0003)); | |
| 2085 | assemble_ea_from_MM_table(BITS(op,0x000c), Rnum, ea); | |
| 2086 | sprintf(opcode_str, "lea"); | |
| 2087 | sprintf(arg_str, "%s,N%d", ea, Nnum); | |
| 2088 | return 1; | |
| 2089 | } | |
| 2090 | ||
| 2091 | /* MAC(su,uu) : 0001 0101 1110 FsQQ : A-126 */ | |
| 2092 | static size_t dsp56k_dasm_macsuuu(const UINT16 op, char* opcode_str, char* arg_str) | |
| 2093 | { | |
| 2094 | char A[32]; | |
| 2095 | char D[32]; | |
| 1231 | 2096 | char S1[32]; |
| 2097 | char S2[32]; | |
| 2098 | decode_s_table(BITS(op,0x0004), A); | |
| 2099 | decode_QQF_special_table(BITS(op,0x0003), BITS(op,0x0008), S1, S2, D); /* Special QQF */ | |
| 2100 | sprintf(opcode_str, "mac(%s)", A); | |
| 2101 | sprintf(arg_str, "%s,%s,%s", S1, S2, D); | |
| 2102 | return 1; | |
| 2103 | } | |
| 2104 | ||
| 2105 | /* MOVE : 0000 0101 BBBB BBBB ---- HHHW 0001 0001 : A-128 */ | |
| 2106 | static size_t dsp56k_dasm_move_2(const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str) | |
| 2107 | { | |
| 2108 | UINT8 B; | |
| 1232 | 2109 | char SD[32]; |
| 1233 | 2110 | char args[32]; |
| 2111 | B = BITS(op,0x00ff); | |
| 2112 | decode_HHH_table(BITS(op2,0x0e00), SD); | |
| 2113 | assemble_reg_from_W_table(BITS(op2,0x0100), args, 'X', SD, B); | |
| 2114 | sprintf(opcode_str, "move"); | |
| 2115 | sprintf(arg_str, "%s", args); | |
| 2116 | return 2; | |
| 2117 | } | |
| 1234 | 2118 | |
| 1235 | if (BITS(op,0x0ff0) == 0x0) | |
| 1236 | { | |
| 1237 | switch (BITS(op,0x000f)) | |
| 1238 | { | |
| 1239 | /* NOP - 0000 0000 0000 0000 */ | |
| 1240 | case 0x0: | |
| 1241 | sprintf(opcode_str, "nop"); | |
| 1242 | sprintf(arg_str, " "); | |
| 1243 | break; | |
| 2119 | /* MOVE(C) : 0011 1WDD DDD0 MMRR : A-144 */ | |
| 2120 | static size_t dsp56k_dasm_movec(const UINT16 op, char* opcode_str, char* arg_str) | |
| 2121 | { | |
| 2122 | int Rnum; | |
| 2123 | char ea[32]; | |
| 2124 | char SD[32]; | |
| 2125 | char args[32]; | |
| 2126 | decode_DDDDD_table(BITS(op,0x03e0), SD); | |
| 2127 | Rnum = decode_RR_table(BITS(op,0x0003)); | |
| 2128 | assemble_ea_from_MM_table(BITS(op,0x000c), Rnum, ea); | |
| 2129 | assemble_arguments_from_W_table(BITS(op,0x0400), args, 'X', SD, ea); | |
| 2130 | sprintf(opcode_str, "move(c)"); | |
| 2131 | sprintf(arg_str, "%s", args); | |
| 2132 | return 1; | |
| 2133 | } | |
| 1244 | 2134 | |
| 1245 | /* Debug - 0000 0000 0000 0001 */ | |
| 1246 | case 0x1: | |
| 1247 | sprintf(opcode_str, "debug"); | |
| 1248 | sprintf(arg_str, " "); | |
| 1249 | break; | |
| 2135 | /* MOVE(C) : 0011 1WDD DDD1 q0RR : A-144 */ | |
| 2136 | static size_t dsp56k_dasm_movec_1(const UINT16 op, char* opcode_str, char* arg_str) | |
| 2137 | { | |
| 2138 | int Rnum; | |
| 2139 | char ea[32]; | |
| 2140 | char SD[32]; | |
| 2141 | char args[32]; | |
| 2142 | decode_DDDDD_table(BITS(op,0x03e0), SD); | |
| 2143 | Rnum = decode_RR_table(BITS(op,0x0003)); | |
| 2144 | assemble_ea_from_q_table(BITS(op,0x0008), Rnum, ea); | |
| 2145 | assemble_arguments_from_W_table(BITS(op,0x0400), args, 'X', SD, ea); | |
| 2146 | sprintf(opcode_str, "move(c)"); | |
| 2147 | sprintf(arg_str, "%s", args); | |
| 2148 | return 1; | |
| 2149 | } | |
| 1250 | 2150 | |
| 1251 | /* DO FOREVER - 0000 0000 0000 0010 xxxx xxxx xxxx xxxx */ | |
| 1252 | case 0x2: | |
| 1253 | sprintf(opcode_str, "doForever"); | |
| 1254 | sprintf(arg_str, "%04x", op2); | |
| 1255 | retSize = 2; | |
| 1256 | break; | |
| 2151 | /* MOVE(C) : 0011 1WDD DDD1 Z11- : A-144 */ | |
| 2152 | static size_t dsp56k_dasm_movec_2(const UINT16 op, char* opcode_str, char* arg_str) | |
| 2153 | { | |
| 2154 | char ea[32]; | |
| 2155 | char SD[32]; | |
| 2156 | char args[32]; | |
| 2157 | decode_DDDDD_table(BITS(op,0x03e0), SD); | |
| 2158 | decode_Z_table(BITS(op,0x0008), ea); | |
| 2159 | assemble_arguments_from_W_table(BITS(op,0x0400), args, 'X', SD, ea); | |
| 2160 | sprintf(opcode_str, "move(c)"); | |
| 2161 | sprintf(arg_str, "%s", args); | |
| 2162 | return 1; | |
| 2163 | } | |
| 1257 | 2164 | |
| 1258 | /* chkaau - 0000 0000 0000 0100 */ | |
| 1259 | case 0x4: | |
| 1260 | sprintf(opcode_str, "chkaau"); | |
| 1261 | sprintf(arg_str, " "); | |
| 1262 | break; | |
| 2165 | /* MOVE(C) : 0011 1WDD DDD1 t10- xxxx xxxx xxxx xxxx : A-144 */ | |
| 2166 | static size_t dsp56k_dasm_movec_3(const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str) | |
| 2167 | { | |
| 2168 | char ea[32]; | |
| 2169 | char SD[32]; | |
| 2170 | char args[32]; | |
| 2171 | decode_DDDDD_table(BITS(op,0x03e0), SD); | |
| 2172 | assemble_ea_from_t_table(BITS(op,0x0008), op2, ea); | |
| 2173 | if (BITS(op,0x0400)) /* order fixed - 02/03/05 */ | |
| 2174 | sprintf(args, "%s,%s", ea, SD); | |
| 2175 | else | |
| 2176 | sprintf(args, "%s,%s", SD, ea); | |
| 2177 | sprintf(opcode_str, "move(c)"); | |
| 2178 | sprintf(arg_str, "%s", args); | |
| 2179 | return 2; | |
| 2180 | } | |
| 1263 | 2181 | |
| 1264 | /* SWI - 0000 0000 0000 0101 */ | |
| 1265 | case 0x5: | |
| 1266 | sprintf(opcode_str, "swi"); | |
| 1267 | sprintf(arg_str, " "); | |
| 1268 | break; | |
| 2182 | /* MOVE(C) : 0010 10dd dddD DDDD : A-144 */ | |
| 2183 | static size_t dsp56k_dasm_movec_4(const UINT16 op, char* opcode_str, char* arg_str) | |
| 2184 | { | |
| 2185 | char D1[32]; | |
| 2186 | char S1[32]; | |
| 2187 | decode_DDDDD_table(BITS(op,0x03e0), S1); | |
| 2188 | decode_DDDDD_table(BITS(op,0x001f), D1); | |
| 2189 | sprintf(opcode_str, "move(c)"); | |
| 2190 | sprintf(arg_str, "%s,%s", S1, D1); | |
| 2191 | return 1; | |
| 2192 | } | |
| 1269 | 2193 | |
| 1270 | /* RTS - 0000 0000 0000 0110 */ | |
| 1271 | case 0x6: | |
| 1272 | sprintf(opcode_str, "rts"); | |
| 1273 | sprintf(arg_str, " "); | |
| 1274 | retSize |= DASMFLAG_STEP_OUT; | |
| 1275 | break; | |
| 2194 | /* MOVE(C) : 0000 0101 BBBB BBBB 0011 1WDD DDD0 ---- : A-144 */ | |
| 2195 | static size_t dsp56k_dasm_movec_5(const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str) | |
| 2196 | { | |
| 2197 | UINT8 B; | |
| 2198 | char SD[32]; | |
| 2199 | char args[32]; | |
| 2200 | B = BITS(op,0x00ff); | |
| 2201 | decode_DDDDD_table(BITS(op2,0x03e0), SD); | |
| 2202 | assemble_reg_from_W_table(BITS(op2,0x0400), args, 'X', SD, B); | |
| 2203 | sprintf(opcode_str, "move(c)"); | |
| 2204 | sprintf(arg_str, "%s", args); | |
| 2205 | return 2; | |
| 2206 | } | |
| 1276 | 2207 | |
| 1277 | /* RTI - 0000 0000 0000 0111 */ | |
| 1278 | case 0x7: | |
| 1279 | sprintf(opcode_str, "rti"); | |
| 1280 | sprintf(arg_str, " "); | |
| 1281 | retSize |= DASMFLAG_STEP_OUT; | |
| 1282 | break; | |
| 2208 | /* MOVE(I) : 0010 00DD BBBB BBBB : A-150 */ | |
| 2209 | static size_t dsp56k_dasm_movei(const UINT16 op, char* opcode_str, char* arg_str) | |
| 2210 | { | |
| 2211 | char D1[32]; | |
| 2212 | decode_DD_table(BITS(op,0x0300), D1); | |
| 2213 | sprintf(opcode_str, "move(i)"); | |
| 2214 | sprintf(arg_str, "#%02x,%s", BITS(op,0x00ff), D1); | |
| 2215 | return 1; | |
| 2216 | } | |
| 1283 | 2217 | |
| 1284 | /* RESET - 0000 0000 0000 1000 */ | |
| 1285 | case 0x8: | |
| 1286 | sprintf(opcode_str, "reset"); | |
| 1287 | sprintf(arg_str, " "); | |
| 1288 | break; | |
| 2218 | /* MOVE(M) : 0000 001W RR0M MHHH : A-152 */ | |
| 2219 | static size_t dsp56k_dasm_movem(const UINT16 op, char* opcode_str, char* arg_str) | |
| 2220 | { | |
| 2221 | int Rnum; | |
| 2222 | char ea[32]; | |
| 2223 | char SD[32]; | |
| 2224 | char args[32]; | |
| 2225 | Rnum = decode_RR_table(BITS(op,0x00c0)); | |
| 2226 | decode_HHH_table(BITS(op,0x0007), SD); | |
| 2227 | assemble_ea_from_MM_table(BITS(op,0x0018), Rnum, ea); | |
| 2228 | assemble_arguments_from_W_table(BITS(op,0x0100), args, 'P', SD, ea); | |
| 2229 | sprintf(opcode_str, "move(m)"); | |
| 2230 | sprintf(arg_str, "%s", args); | |
| 2231 | return 1; | |
| 2232 | } | |
| 1289 | 2233 | |
| 1290 | /* Enddo - 0000 0000 0000 1001 */ | |
| 1291 | case 0x9: | |
| 1292 | sprintf(opcode_str, "enddo"); | |
| 1293 | sprintf(arg_str, " "); | |
| 1294 | break; | |
| 2234 | /* MOVE(M) : 0000 001W RR11 mmRR : A-152 */ | |
| 2235 | static size_t dsp56k_dasm_movem_1(const UINT16 op, char* opcode_str, char* arg_str) | |
| 2236 | { | |
| 2237 | char ea[32]; | |
| 2238 | char SD[32]; | |
| 2239 | char ea2[32]; | |
| 2240 | char args[32]; | |
| 2241 | assemble_eas_from_m_table(BITS(op,0x000c), BITS(op,0x00c0), BITS(op,0x0003), ea, ea2); | |
| 2242 | sprintf(SD, "P:%s", ea); | |
| 2243 | assemble_arguments_from_W_table(BITS(op,0x0100), args, 'X', SD, ea2); | |
| 2244 | sprintf(opcode_str, "move(m)"); | |
| 2245 | sprintf(arg_str, "%s", args); | |
| 2246 | return 1; | |
| 2247 | } | |
| 1295 | 2248 | |
| 1296 | /* STOP - 0000 0000 0000 1010 */ | |
| 1297 | case 0xa: | |
| 1298 | sprintf(opcode_str, "stop"); | |
| 1299 | sprintf(arg_str, " "); | |
| 1300 | break; | |
| 2249 | /* MOVE(M) : 0000 0101 BBBB BBBB 0000 001W --0- -HHH : A-152 */ | |
| 2250 | static size_t dsp56k_dasm_movem_2(const UINT16 op, const UINT16 op2, char* opcode_str, char* arg_str) | |
| 2251 | { | |
| 2252 | UINT8 B; | |
| 2253 | char SD[32]; | |
| 2254 | char args[32]; | |
| 2255 | B = BITS(op,0x00ff); | |
| 2256 | decode_HHH_table(BITS(op2,0x0007), SD); | |
| 2257 | assemble_reg_from_W_table(BITS(op2,0x0100), args, 'P', SD, B); | |
| 2258 | sprintf(opcode_str, "move(m)"); | |
| 2259 | sprintf(arg_str, "%s", args); | |
| 2260 | /* !!! The docs list the read/write order backwards for all move(m)'s - crackbabies ??? */ | |
| 2261 | return 2; | |
| 2262 | } | |
| 1301 | 2263 | |
| 1302 | /* WAIT - 0000 0000 0000 1011 */ | |
| 1303 | case 0xb: | |
| 1304 | sprintf(opcode_str, "wait"); | |
| 1305 | sprintf(arg_str, " "); | |
| 1306 | break; | |
| 2264 | /* MOVE(P) : 0001 100W HH1p pppp : A-156 */ | |
| 2265 | static size_t dsp56k_dasm_movep(const UINT16 op, char* opcode_str, char* arg_str) | |
| 2266 | { | |
| 2267 | char A[32]; | |
| 2268 | char SD[32]; | |
| 2269 | char args[32]; | |
| 2270 | char fullAddy[128]; | |
| 2271 | decode_HH_table(BITS(op,0x00c0), SD); | |
| 2272 | assemble_address_from_IO_short_address(BITS(op,0x001f), fullAddy); /* Convert Short Absolute Address to full 16-bit */ | |
| 2273 | sprintf(A, "%02x (%s)", BITS(op,0x001f), fullAddy); | |
| 2274 | assemble_arguments_from_W_table(BITS(op,0x0100), args, 'X', SD, A); | |
| 2275 | sprintf(opcode_str, "move(p)"); | |
| 2276 | sprintf(arg_str, "%s", args); | |
| 2277 | return 1; | |
| 2278 | } | |
| 1307 | 2279 | |
| 1308 | /* ILLEGAL - 0000 0000 0000 1111 */ | |
| 1309 | case 0xf: | |
| 1310 | sprintf(opcode_str, "illegal"); | |
| 1311 | sprintf(arg_str, " "); | |
| 1312 | break; | |
| 1313 | } | |
| 1314 | } | |
| 1315 | else if (BITS(op,0x0f00) == 0x0) | |
| 1316 | { | |
| 1317 | int Rnum = -1; | |
| 1318 | char M[32] = ""; | |
| 2280 | /* MOVE(P) : 0000 110W RRmp pppp : A-156 */ | |
| 2281 | static size_t dsp56k_dasm_movep_1(const UINT16 op, char* opcode_str, char* arg_str) | |
| 2282 | { | |
| 2283 | int Rnum; | |
| 2284 | char ea[32]; | |
| 2285 | char SD[32]; | |
| 2286 | char args[32]; | |
| 2287 | char fullAddy[128]; /* Convert Short Absolute Address to full 16-bit */ | |
| 2288 | Rnum = decode_RR_table(BITS(op,0x00c0)); | |
| 2289 | assemble_ea_from_m_table(BITS(op,0x0020), Rnum, ea); | |
| 2290 | assemble_address_from_IO_short_address(BITS(op,0x001f), fullAddy); | |
| 2291 | sprintf(SD, "X:%02x (%s)", BITS(op,0x001f), fullAddy); | |
| 2292 | assemble_arguments_from_W_table(BITS(op,0x0100), args, 'X', SD, ea); | |
| 2293 | sprintf(opcode_str, "move(p)"); | |
| 2294 | sprintf(arg_str, "%s", args); | |
| 2295 | return 1; | |
| 2296 | } | |
| 1319 | 2297 | |
| 1320 | switch(BITS(op,0x00e0)) | |
| 1321 | { | |
| 1322 | case 0x2: | |
| 1323 | /* DEBUG.cc - 0000 0000 0101 cccc */ | |
| 1324 | decode_cccc_table(BITS(op,0x000f), M); | |
| 1325 | sprintf(opcode_str, "debug.%s", M); | |
| 1326 | sprintf(arg_str, " "); | |
| 1327 | break; | |
| 2298 | /* MOVE(S) : 0001 100W HH0a aaaa : A-158 */ | |
| 2299 | static size_t dsp56k_dasm_moves(const UINT16 op, char* opcode_str, char* arg_str) | |
| 2300 | { | |
| 2301 | char A[32]; | |
| 2302 | char SD[32]; | |
| 2303 | char args[32]; | |
| 2304 | decode_HH_table(BITS(op,0x00c0), SD); | |
| 2305 | sprintf(A, "00%02x", BITS(op,0x001f)); | |
| 2306 | assemble_arguments_from_W_table(BITS(op,0x0100), args, 'X', SD, A); | |
| 2307 | sprintf(opcode_str, "move(s)"); | |
| 2308 | sprintf(arg_str, "%s", args); | |
| 2309 | return 1; | |
| 2310 | } | |
| 1328 | 2311 | |
| 1329 | case 0x6: | |
| 1330 | /* DO - 0000 0000 110- --RR xxxx xxxx xxxx xxxx */ | |
| 1331 | Rnum = decode_RR_table(BITS(op,0x0003)); | |
| 1332 | sprintf(opcode_str, "do"); | |
| 1333 | sprintf(arg_str, "X:(R%d),%02x", Rnum, op2); | |
| 1334 | retSize = 2; | |
| 1335 | break; | |
| 2312 | /* MPY(su,uu) : 0001 0101 1100 FsQQ : A-164 */ | |
| 2313 | static size_t dsp56k_dasm_mpysuuu(const UINT16 op, char* opcode_str, char* arg_str) | |
| 2314 | { | |
| 2315 | char A[32]; | |
| 2316 | char D[32]; | |
| 2317 | char S1[32]; | |
| 2318 | char S2[32]; | |
| 2319 | decode_s_table(BITS(op,0x0004), A); | |
| 2320 | decode_QQF_special_table(BITS(op,0x0003), BITS(op,0x0008), S1, S2, D); /* Special QQF */ | |
| 2321 | sprintf(opcode_str, "mpy(%s)", A); | |
| 2322 | sprintf(arg_str, "%s,%s,%s", S1, S2, D); | |
| 2323 | return 1; | |
| 2324 | } | |
| 1336 | 2325 | |
| 1337 | case 0x7: | |
| 1338 | /* REP - 0000 0000 111- --RR */ | |
| 1339 | Rnum = decode_RR_table(BITS(op,0x0003)); | |
| 1340 | sprintf(opcode_str, "rep"); | |
| 1341 | sprintf(arg_str, "X:(R%d)", Rnum); | |
| 1342 | break; | |
| 1343 | } | |
| 1344 | } | |
| 1345 | else if (BITS(op,0x0f00) == 0x1) | |
| 1346 | { | |
| 1347 | char M[32] = ""; | |
| 2326 | /* NEGC : 0001 0101 0110 F000 : A-168 */ | |
| 2327 | static size_t dsp56k_dasm_negc(const UINT16 op, char* opcode_str, char* arg_str) | |
| 2328 | { | |
| 2329 | char D[32]; | |
| 2330 | decode_F_table(BITS(op,0x0008), D); | |
| 2331 | sprintf(opcode_str, "negc"); | |
| 2332 | sprintf(arg_str, "%s", D); | |
| 2333 | return 1; | |
| 2334 | } | |
| 1348 | 2335 | |
| 1349 | if (BITS(op,0x00f0) == 0x1) | |
| 1350 | { | |
| 1351 | /* BRK.cc - 0000 0001 0001 cccc */ | |
| 1352 | decode_cccc_table(BITS(op,0x000f), M); | |
| 1353 | sprintf(opcode_str, "brk.%s", M); | |
| 1354 | sprintf(arg_str, " "); | |
| 1355 | } | |
| 1356 | else if (BITS(op,0x00f0) == 0x2) | |
| 1357 | { | |
| 1358 | /* All 4 instructions have the same RR encoding */ | |
| 1359 | int Rnum = decode_RR_table(BITS(op,0x0003)); | |
| 2336 | /* NOP : 0000 0000 0000 0000 : A-170 */ | |
| 2337 | static size_t dsp56k_dasm_nop(const UINT16 op, char* opcode_str, char* arg_str) | |
| 2338 | { | |
| 2339 | sprintf(opcode_str, "nop"); | |
| 2340 | sprintf(arg_str, " "); | |
| 2341 | return 1; | |
| 2342 | } | |
| 1360 | 2343 | |
| 1361 | switch(BITS(op,0x000c)) | |
| 1362 | { | |
| 1363 | /* JSR - 0000 0001 0010 00RR */ | |
| 1364 | case 0x0: | |
| 1365 | sprintf(opcode_str, "jsr"); | |
| 1366 | sprintf(arg_str, "R%d", Rnum); | |
| 1367 | retSize |= DASMFLAG_STEP_OVER; | |
| 1368 | break; | |
| 2344 | /* NORM : 0001 0101 0010 F0RR : A-172 */ | |
| 2345 | static size_t dsp56k_dasm_norm(const UINT16 op, char* opcode_str, char* arg_str) | |
| 2346 | { | |
| 2347 | int Rnum; | |
| 2348 | char D[32]; | |
| 2349 | decode_F_table(BITS(op,0x0008), D); | |
| 2350 | Rnum = decode_RR_table(BITS(op,0x0003)); | |
| 2351 | sprintf(opcode_str, "norm"); | |
| 2352 | sprintf(arg_str, "R%d,%s", Rnum, D); | |
| 2353 | return 1; | |
| 2354 | } | |
| 1369 | 2355 | |
| 1370 | /* JMP - 0000 0001 0010 01RR */ | |
| 1371 | case 0x1: | |
| 1372 | sprintf(opcode_str, "jmp"); | |
| 1373 | sprintf(arg_str, "R%d", Rnum); | |
| 1374 | break; | |
| 2356 | /* ORI : 0001 1EE1 iiii iiii : A-178 */ | |
| 2357 | static size_t dsp56k_dasm_ori(const UINT16 op, char* opcode_str, char* arg_str) | |
| 2358 | { | |
| 2359 | char D[32]; | |
| 2360 | decode_EE_table(BITS(op,0x0600), D); | |
| 2361 | sprintf(opcode_str, "or(i)"); | |
| 2362 | sprintf(arg_str, "#%02x,%s", BITS(op,0x00ff), D); | |
| 2363 | return 1; | |
| 2364 | } | |
| 1375 | 2365 | |
| 1376 | /* BSR - 0000 0001 0010 10RR */ | |
| 1377 | case 0x2: | |
| 1378 | sprintf(opcode_str, "bsr"); | |
| 1379 | sprintf(arg_str, "R%d", Rnum); | |
| 1380 | retSize |= DASMFLAG_STEP_OVER; | |
| 1381 | break; | |
| 2366 | /* REP : 0000 0000 111- --RR : A-180 */ | |
| 2367 | static size_t dsp56k_dasm_rep(const UINT16 op, char* opcode_str, char* arg_str) | |
| 2368 | { | |
| 2369 | int Rnum; | |
| 2370 | Rnum = decode_RR_table(BITS(op,0x0003)); | |
| 2371 | sprintf(opcode_str, "rep"); | |
| 2372 | sprintf(arg_str, "X:(R%d)", Rnum); | |
| 2373 | return 1; | |
| 2374 | } | |
| 1382 | 2375 | |
| 1383 | /* BRA - 0000 0001 0010 11RR */ | |
| 1384 | case 0x3: | |
| 1385 | sprintf(opcode_str, "bra"); | |
| 1386 | sprintf(arg_str, "R%d", Rnum); | |
| 1387 | break; | |
| 1388 | } | |
| 1389 | } | |
| 1390 | else if (BITS(op,0x00f0) == 0x3) | |
| 1391 | { | |
| 1392 | switch(BITS(op,0x000c)) | |
| 1393 | { | |
| 1394 | /* JSR - 0000 0001 0011 00-- xxxx xxxx xxxx xxxx */ | |
| 1395 | case 0x0: | |
| 1396 | sprintf(opcode_str, "jsr"); | |
| 1397 | sprintf(arg_str, "%04x", op2); | |
| 1398 | retSize = 2; | |
| 1399 | retSize |= DASMFLAG_STEP_OVER; | |
| 1400 | break; | |
| 2376 | /* REP : 0000 1111 iiii iiii : A-180 */ | |
| 2377 | static size_t dsp56k_dasm_rep_1(const UINT16 op, char* opcode_str, char* arg_str) | |
| 2378 | { | |
| 2379 | sprintf(opcode_str, "rep"); | |
| 2380 | sprintf(arg_str, "%d (0x%02x)", BITS(op,0x00ff), BITS(op,0x00ff)); | |
| 2381 | return 1; | |
| 2382 | } | |
| 1401 | 2383 | |
| 1402 | /* JMP - 0000 0001 0011 01-- xxxx xxxx xxxx xxxx */ | |
| 1403 | case 0x1: | |
| 1404 | sprintf(opcode_str, "jmp"); | |
| 1405 | sprintf(arg_str, "%04x", op2); | |
| 1406 | retSize = 2; | |
| 1407 | break; | |
| 2384 | /* REP : 0000 0100 001D DDDD : A-180 */ | |
| 2385 | static size_t dsp56k_dasm_rep_2(const UINT16 op, char* opcode_str, char* arg_str) | |
| 2386 | { | |
| 2387 | char S1[32]; | |
| 2388 | decode_DDDDD_table(BITS(op,0x001f), S1); | |
| 2389 | sprintf(opcode_str, "rep"); | |
| 2390 | sprintf(arg_str, "%s", S1); | |
| 2391 | return 1; | |
| 2392 | } | |
| 1408 | 2393 | |
| 1409 | /* BSR - 0000 0001 0011 10-- xxxx xxxx xxxx xxxx */ | |
| 1410 | case 0x2: | |
| 1411 | sprintf(opcode_str, "bsr"); | |
| 1412 | sprintf(arg_str, "%d (0x%04x)", (INT16)op2, pc + (INT16)op2); | |
| 1413 | retSize = 2; | |
| 1414 | retSize |= DASMFLAG_STEP_OVER; | |
| 1415 | break; | |
| 2394 | /* REPcc : 0000 0001 0101 cccc : A-184 */ | |
| 2395 | static size_t dsp56k_dasm_repcc(const UINT16 op, char* opcode_str, char* arg_str) | |
| 2396 | { | |
| 2397 | char M[32]; | |
| 2398 | decode_cccc_table(BITS(op,0x000f), M); | |
| 2399 | sprintf(opcode_str, "rep.%s", M); | |
| 2400 | sprintf(arg_str, " "); | |
| 2401 | return 1; | |
| 2402 | } | |
| 1416 | 2403 | |
| 1417 | /* BRA - 0000 0001 0011 11-- xxxx xxxx xxxx xxxx */ | |
| 1418 | case 0x3: | |
| 1419 | sprintf(opcode_str, "bra"); | |
| 1420 | sprintf(arg_str, "%d (0x%04x)", op2, op2); | |
| 1421 | retSize = 2; | |
| 1422 | break; | |
| 1423 | } | |
| 1424 | } | |
| 1425 | else if (BITS(op,0x00f0) == 0x5) | |
| 1426 | { | |
| 1427 | char M[32] = ""; | |
| 2404 | /* RESET : 0000 0000 0000 1000 : A-186 */ | |
| 2405 | static size_t dsp56k_dasm_reset(const UINT16 op, char* opcode_str, char* arg_str) | |
| 2406 | { | |
| 2407 | sprintf(opcode_str, "reset"); | |
| 2408 | sprintf(arg_str, " "); | |
| 2409 | return 1; | |
| 2410 | } | |
| 1428 | 2411 | |
| 1429 | /* REP.cc - 0000 0001 0101 cccc */ | |
| 1430 | decode_cccc_table(BITS(op,0x000f), M); | |
| 1431 | sprintf(opcode_str, "rep.%s", M); | |
| 1432 | sprintf(arg_str, " "); | |
| 1433 | /* !!! Should I decode the next instruction and put it here ??? probably... */ | |
| 1434 | } | |
| 1435 | else if (BITS(op,0x0080) == 0x1) | |
| 1436 | { | |
| 1437 | /* LEA - 0000 0001 10TT MMRR */ | |
| 1438 | /* - 0000 0001 11NN MMRR */ | |
| 1439 | int Rnum = decode_RR_table(BITS(op,0x0030)); | |
| 1440 | assemble_ea_from_MM_table(BITS(op,0x000c), BITS(op,0x0003), ea); | |
| 1441 | sprintf(opcode_str, "lea"); | |
| 1442 | if (BITS(op,0x0040)) | |
| 1443 | sprintf(arg_str, "%s,R%d", ea, Rnum); | |
| 1444 | else | |
| 1445 | sprintf(arg_str, "%s,N%d", ea, Rnum); | |
| 1446 | } | |
| 1447 | } | |
| 1448 | else if (BITS(op,0x0e00) == 0x1) | |
| 1449 | { | |
| 1450 | sprintf(opcode_str, "move(m)"); | |
| 2412 | /* RTI : 0000 0000 0000 0111 : A-194 */ | |
| 2413 | static size_t dsp56k_dasm_rti(const UINT16 op, char* opcode_str, char* arg_str) | |
| 2414 | { | |
| 2415 | sprintf(opcode_str, "rti"); | |
| 2416 | sprintf(arg_str, " "); | |
| 2417 | return (1 | DASMFLAG_STEP_OUT); | |
| 2418 | } | |
| 1451 | 2419 | |
| 1452 | if (BITS(op,0x0020) == 0x0) | |
| 1453 | { | |
| 1454 | /* MOVE(M) - 0000 001W RR0M MHHH */ | |
| 1455 | int Rnum = decode_RR_table(BITS(op,0x00c0)); | |
| 1456 | decode_HHH_table(BITS(op,0x0007), SD); | |
| 1457 | assemble_ea_from_MM_table(BITS(op,0x0018), Rnum, ea); | |
| 1458 | assemble_arguments_from_W_table(BITS(op,0x0100), args, 'P', SD, ea); | |
| 1459 | sprintf(arg_str, "%s", args); | |
| 1460 | } | |
| 1461 | else | |
| 1462 | { | |
| 1463 | /* MOVE(M) - 0000 001W RR11 mmRR */ | |
| 1464 | assemble_eas_from_m_table(BITS(op,0x000c), BITS(op,0x00c0), BITS(op,0x0003), ea, ea2); | |
| 1465 | sprintf(SD, "P:%s", ea); | |
| 1466 | assemble_arguments_from_W_table(BITS(op,0x0100), args, 'X', SD, ea2); | |
| 1467 | sprintf(arg_str, "%s", args); | |
| 1468 | } | |
| 1469 | } | |
| 1470 | else if (BITS(op,0x0f00) == 0x4) | |
| 1471 | { | |
| 1472 | if (BITS(op,0x0020) == 0x0) | |
| 1473 | { | |
| 1474 | /* DO - 0000 0100 000D DDDD xxxx xxxx xxxx xxxx */ | |
| 1475 | decode_DDDDD_table(BITS(op,0x001f), S1); | |
| 1476 | sprintf(opcode_str, "do"); | |
| 1477 | sprintf(arg_str, "%s,%04x", S1, op2); | |
| 1478 | retSize = 2; | |
| 1479 | } | |
| 1480 | else | |
| 1481 | { | |
| 1482 | /* REP - 0000 0100 001D DDDD */ | |
| 1483 | decode_DDDDD_table(BITS(op,0x001f), S1); | |
| 1484 | sprintf(opcode_str, "rep"); | |
| 1485 | sprintf(arg_str, "%s", S1); | |
| 1486 | } | |
| 1487 | } | |
| 1488 | else if (BITS(op,0x0f00) == 0x5) | |
| 1489 | { | |
| 1490 | UINT8 B; | |
| 2420 | /* RTS : 0000 0000 0000 0110 : A-196 */ | |
| 2421 | static size_t dsp56k_dasm_rts(const UINT16 op, char* opcode_str, char* arg_str) | |
| 2422 | { | |
| 2423 | sprintf(opcode_str, "rts"); | |
| 2424 | sprintf(arg_str, " "); | |
| 2425 | return (1 | DASMFLAG_STEP_OUT); | |
| 2426 | } | |
| 1491 | 2427 | |
| 1492 | if (BITS(op2,0xfe20) == 0x02) | |
| 1493 | { | |
| 1494 | /* MOVE(M) - 0000 0101 BBBB BBBB | 0000 001W --0- -HHH */ | |
| 1495 | B = BITS(op,0x00ff); | |
| 1496 | decode_HHH_table(BITS(op2,0x0007), SD); | |
| 1497 | assemble_reg_from_W_table(BITS(op2,0x0100), args, 'P', SD, B); | |
| 1498 | sprintf(opcode_str, "move(m)"); | |
| 1499 | sprintf(arg_str, "%s", args); | |
| 1500 | /* !!! The docs list the read/write order backwards for all move(m)'s - crackbabies ??? */ | |
| 1501 | retSize = 2; | |
| 1502 | } | |
| 1503 | else if (BITS(op2,0xf810) == 0x0e) | |
| 1504 | { | |
| 1505 | /* MOVE(C) - 0000 0101 BBBB BBBB | 0011 1WDD DDD0 ---- */ | |
| 1506 | B = BITS(op,0x00ff); | |
| 1507 | decode_DDDDD_table(BITS(op2,0x03e0), SD); | |
| 1508 | assemble_reg_from_W_table(BITS(op2,0x0400), args, 'X', SD, B); | |
| 1509 | sprintf(opcode_str, "move(c)"); | |
| 1510 | sprintf(arg_str, "%s", args); | |
| 1511 | retSize = 2; | |
| 1512 | } | |
| 1513 | else if (BITS(op2,0x00ff) == 0x11) | |
| 1514 | { | |
| 1515 | /* MOVE - 0000 0101 BBBB BBBB | ---- HHHW 0001 0001 */ | |
| 1516 | B = BITS(op,0x00ff); | |
| 1517 | decode_HHH_table(BITS(op2,0x0e00), SD); | |
| 1518 | assemble_reg_from_W_table(BITS(op2,0x0100), args, 'X', SD, B); | |
| 1519 | sprintf(opcode_str, "move"); | |
| 1520 | sprintf(arg_str, "%s", args); | |
| 1521 | retSize = 2; | |
| 1522 | } | |
| 1523 | } | |
| 1524 | else if (BITS(op,0x0f00) == 0x6) | |
| 1525 | { | |
| 1526 | int Rnum = -1; | |
| 1527 | char M[32] = ""; | |
| 2428 | /* STOP : 0000 0000 0000 1010 : A-200 */ | |
| 2429 | static size_t dsp56k_dasm_stop(const UINT16 op, char* opcode_str, char* arg_str) | |
| 2430 | { | |
| 2431 | sprintf(opcode_str, "stop"); | |
| 2432 | sprintf(arg_str, " "); | |
| 2433 | return 1; | |
| 2434 | } | |
| 1528 | 2435 | |
| 1529 | switch(BITS(op,0x0030)) | |
| 1530 | { | |
| 1531 | case 0x0: | |
| 1532 | /* JS.cc - 0000 0110 RR00 cccc */ | |
| 1533 | decode_cccc_table(BITS(op,0x000f), M); | |
| 1534 | Rnum = decode_RR_table(BITS(op,0x00c0)); | |
| 1535 | sprintf(opcode_str, "js.%s", M); | |
| 1536 | sprintf(arg_str, "R%d", Rnum); | |
| 1537 | retSize |= DASMFLAG_STEP_OVER; /* probably. What's the diff between a branch and a jump? */ | |
| 1538 | break; | |
| 2436 | /* SWAP : 0001 0101 0111 F001 : A-206 */ | |
| 2437 | static size_t dsp56k_dasm_swap(const UINT16 op, char* opcode_str, char* arg_str) | |
| 2438 | { | |
| 2439 | char D[32]; | |
| 2440 | decode_F_table(BITS(op,0x0008), D); | |
| 2441 | sprintf(opcode_str, "swap"); | |
| 2442 | sprintf(arg_str, "%s", D); | |
| 2443 | return 1; | |
| 2444 | } | |
| 1539 | 2445 | |
| 1540 | case 0x1: | |
| 1541 | /* JS.cc - 0000 0110 --01 cccc xxxx xxxx xxxx xxxx */ | |
| 1542 | decode_cccc_table(BITS(op,0x000f), M); | |
| 1543 | sprintf(opcode_str, "js.%s", M); | |
| 1544 | sprintf(arg_str, "%04x", op2); | |
| 1545 | retSize = 2; | |
| 1546 | retSize |= DASMFLAG_STEP_OVER; /* probably */ | |
| 1547 | break; | |
| 2446 | /* SWI : 0000 0000 0000 0101 : A-208 */ | |
| 2447 | static size_t dsp56k_dasm_swi(const UINT16 op, char* opcode_str, char* arg_str) | |
| 2448 | { | |
| 2449 | sprintf(opcode_str, "swi"); | |
| 2450 | sprintf(arg_str, " "); | |
| 2451 | return 1; | |
| 2452 | } | |
| 1548 | 2453 | |
| 1549 | case 0x2: | |
| 1550 | /* J.cc - 0000 0110 RR10 cccc */ | |
| 1551 | decode_cccc_table(BITS(op,0x000f), M); | |
| 1552 | Rnum = decode_RR_table(BITS(op,0x00c0)); | |
| 1553 | sprintf(opcode_str, "j.%s", M); | |
| 1554 | sprintf(arg_str, "R%d", Rnum); | |
| 1555 | break; | |
| 2454 | /* Tcc : 0001 00cc ccTT Fh0h : A-210 */ | |
| 2455 | static size_t dsp56k_dasm_tcc(const UINT16 op, char* opcode_str, char* arg_str) | |
| 2456 | { | |
| 2457 | int Rnum = -1; | |
| 2458 | char M[32]; | |
| 2459 | char D[32]; | |
| 2460 | char S[32]; | |
| 1556 | 2461 | |
| 1557 | case 0x3: | |
| 1558 | /* J.cc - 0000 0110 --11 cccc xxxx xxxx xxxx xxxx */ | |
| 1559 | decode_cccc_table(BITS(op,0x000f), M); | |
| 1560 | sprintf(opcode_str, "j.%s", M); | |
| 1561 | sprintf(arg_str, "%04x", op2); | |
| 1562 | retSize = 2; | |
| 1563 | break; | |
| 1564 | } | |
| 1565 | } | |
| 1566 | else if (BITS(op,0x0f00) == 0x7) | |
| 1567 | { | |
| 1568 | int Rnum = -1; | |
| 1569 | char M[32] = ""; | |
| 2462 | decode_cccc_table(BITS(op,0x03c0), M); | |
| 2463 | sprintf(opcode_str, "t.%s", M); | |
| 1570 | 2464 | |
| 1571 | switch(BITS(op,0x0030)) | |
| 1572 | { | |
| 1573 | case 0x0: | |
| 1574 | /* BS.cc - 0000 0111 RR00 cccc */ | |
| 1575 | decode_cccc_table(BITS(op,0x000f), M); | |
| 1576 | Rnum = decode_RR_table(BITS(op,0x00c0)); | |
| 1577 | sprintf(opcode_str, "bs.%s", M); | |
| 1578 | sprintf(arg_str, "R%d", Rnum); | |
| 1579 | retSize |= DASMFLAG_STEP_OVER; /* probably. What's the diff between a branch and a jump? */ | |
| 1580 | break; | |
| 2465 | Rnum = decode_RR_table(BITS(op,0x0030)); | |
| 2466 | decode_h0hF_table(BITS(op,0x0007),BITS(op,0x0008), S, D); | |
| 2467 | sprintf(arg_str, "%s,%s R0,R%d", S, D, Rnum); | |
| 1581 | 2468 | |
| 1582 | case 0x1: | |
| 1583 | /* BS.cc - 0000 0111 --01 cccc xxxx xxxx xxxx xxxx */ | |
| 1584 | decode_cccc_table(BITS(op,0x000f), M); | |
| 1585 | sprintf(opcode_str, "bs.%s", M); | |
| 1586 | sprintf(arg_str, "%d (0x%04x)", (INT16)(op2), op2); | |
| 1587 | retSize = 2; | |
| 1588 | retSize |= DASMFLAG_STEP_OVER; /* probably */ | |
| 1589 | break; | |
| 2469 | /* TODO: Investigate | |
| 2470 | if (S1[0] == D[0] && D[0] == 'A') | |
| 2471 | sprintf(buffer, "t.%s %s,%s", M, S1, D); | |
| 2472 | else | |
| 2473 | sprintf(buffer, "t.%s %s,%s R0,R%d", M, S1, D, Rnum); | |
| 2474 | */ | |
| 2475 | return 1; | |
| 2476 | } | |
| 1590 | 2477 | |
| 1591 | case 0x2: | |
| 1592 | /* B.cc - 0000 0111 RR10 cccc */ | |
| 1593 | decode_cccc_table(BITS(op,0x000f), M); | |
| 1594 | Rnum = decode_RR_table(BITS(op,0x00c0)); | |
| 1595 | sprintf(opcode_str, "b.%s", M); | |
| 1596 | sprintf(arg_str, "R%d", Rnum); | |
| 1597 | break; | |
| 2478 | /* TFR(2) : 0001 0101 0000 F00J : A-214 */ | |
| 2479 | static size_t dsp56k_dasm_tfr2(const UINT16 op, char* opcode_str, char* arg_str) | |
| 2480 | { | |
| 2481 | char D[32]; | |
| 2482 | char S1[32]; | |
| 2483 | decode_JF_table(BITS(op,0x0001),BITS(op,0x0008), D, S1); | |
| 2484 | sprintf(opcode_str, "tfr2"); | |
| 2485 | sprintf(arg_str, "%s,%s", S1, D); | |
| 2486 | return 1; | |
| 2487 | } | |
| 1598 | 2488 | |
| 1599 | case 0x3: | |
| 1600 | /* B.cc - 0000 0111 --11 cccc xxxx xxxx xxxx xxxx */ | |
| 1601 | decode_cccc_table(BITS(op,0x000f), M); | |
| 1602 | sprintf(opcode_str, "b.%s", M); | |
| 1603 | sprintf(arg_str, "%04x (%d)", op2, op2); | |
| 1604 | retSize = 2; | |
| 1605 | break; | |
| 1606 | } | |
| 1607 | } | |
| 1608 | else if (BITS(op,0x0800)) | |
| 1609 | { | |
| 1610 | int Rnum = -1; | |
| 2489 | /* TFR(3) : 0010 01mW RRDD FHHH : A-216 */ | |
| 2490 | static size_t dsp56k_dasm_tfr3(const UINT16 op, char* opcode_str, char* arg_str) | |
| 2491 | { | |
| 2492 | int Rnum; | |
| 2493 | char ea[32]; | |
| 2494 | char D1[32]; | |
| 2495 | char S1[32]; | |
| 2496 | char SD[32]; | |
| 2497 | char args[32]; | |
| 2498 | decode_DDF_table(BITS(op,0x0030), BITS(op,0x0008), D1, S1); /* Intentionally switched */ | |
| 2499 | decode_HHH_table(BITS(op,0x0007), SD); | |
| 2500 | Rnum = decode_RR_table(BITS(op,0x00c0)); | |
| 2501 | assemble_ea_from_m_table(BITS(op,0x0200), Rnum, ea); | |
| 2502 | assemble_arguments_from_W_table(BITS(op,0x0100), args, 'X', SD, ea); | |
| 2503 | sprintf(opcode_str, "tfr3"); | |
| 2504 | sprintf(arg_str, "%s,%s %s", S1, D1, args); | |
| 2505 | return 1; | |
| 2506 | } | |
| 1611 | 2507 | |
| 1612 | switch (BITS(op,0x0700)) | |
| 1613 | { | |
| 1614 | /* JSR - 0000 1010 AAAA AAAA */ | |
| 1615 | case 0x2: | |
| 1616 | sprintf(opcode_str, "jsr"); | |
| 1617 | sprintf(arg_str, "%d (0x%02x)", BITS(op,0x00ff), BITS(op,0x00ff)); | |
| 1618 | retSize |= DASMFLAG_STEP_OVER; | |
| 1619 | break; | |
| 2508 | /* TST(2) : 0001 0101 0001 -1DD : A-220 */ | |
| 2509 | static size_t dsp56k_dasm_tst2(const UINT16 op, char* opcode_str, char* arg_str) | |
| 2510 | { | |
| 2511 | char S1[32]; | |
| 2512 | decode_DD_table(BITS(op,0x0003), S1); | |
| 2513 | sprintf(opcode_str, "tst2"); | |
| 2514 | sprintf(arg_str, "%s", S1); | |
| 2515 | return 1; | |
| 2516 | } | |
| 1620 | 2517 | |
| 1621 | /* BRA - 0000 1011 aaaa aaaa */ | |
| 1622 | case 0x3: | |
| 1623 | sprintf(opcode_str, "bra"); | |
| 1624 | sprintf(arg_str, "%d (0x%02x)", (INT8)BITS(op,0x00ff), pc + (INT8)BITS(op,0x00ff)); | |
| 1625 | break; | |
| 2518 | /* WAIT : 0000 0000 0000 1011 : A-222 */ | |
| 2519 | static size_t dsp56k_dasm_wait(const UINT16 op, char* opcode_str, char* arg_str) | |
| 2520 | { | |
| 2521 | sprintf(opcode_str, "wait"); | |
| 2522 | sprintf(arg_str, " "); | |
| 2523 | return 1; | |
| 2524 | } | |
| 1626 | 2525 | |
| 1627 | /* MOVE(P) - 0000 110W RRmp pppp */ | |
| 1628 | case 0x4: case 0x5: | |
| 1629 | { | |
| 1630 | char fullAddy[128]; /* Convert Short Absolute Address to full 16-bit */ | |
| 1631 | Rnum = decode_RR_table(BITS(op,0x00c0)); | |
| 1632 | assemble_ea_from_m_table(BITS(op,0x0020), Rnum, ea); | |
| 1633 | assemble_address_from_IO_short_address(BITS(op,0x001f), fullAddy); | |
| 1634 | sprintf(SD, "X:%02x (%s)", BITS(op,0x001f), fullAddy); | |
| 1635 | assemble_arguments_from_W_table(BITS(op,0x0100), args, 'X', SD, ea); | |
| 1636 | sprintf(opcode_str, "move(p)"); | |
| 1637 | sprintf(arg_str, "%s", args); | |
| 1638 | break; | |
| 1639 | } | |
| 2526 | /* ZERO : 0001 0101 0101 F000 : A-224 */ | |
| 2527 | static size_t dsp56k_dasm_zero(const UINT16 op, char* opcode_str, char* arg_str) | |
| 2528 | { | |
| 2529 | char D[32]; | |
| 2530 | decode_F_table(BITS(op,0x0008), D); | |
| 2531 | sprintf(opcode_str, "zero"); | |
| 2532 | sprintf(arg_str, "%s", D); | |
| 2533 | return 1; | |
| 2534 | } | |
| 1640 | 2535 | |
| 1641 | /* DO - 0000 1110 iiii iiii xxxx xxxx xxxx xxxx */ | |
| 1642 | case 0x6: | |
| 1643 | sprintf(opcode_str, "do"); | |
| 1644 | sprintf(arg_str, "#%02x,%04x", BITS(op,0x00ff), op2); | |
| 1645 | retSize = 2; | |
| 1646 | break; | |
| 1647 | 2536 | |
| 1648 | /* REP - 0000 1111 iiii iiii */ | |
| 1649 | case 0x7: | |
| 1650 | sprintf(opcode_str, "rep"); | |
| 1651 | sprintf(arg_str, "%d (0x%02x)", BITS(op,0x00ff), BITS(op,0x00ff)); | |
| 1652 | break; | |
| 1653 | } | |
| 1654 | } | |
| 1655 | 2537 | |
| 1656 | return retSize; | |
| 1657 | } | |
| 1658 | ||
| 1659 | ||
| 1660 | /*******************************/ | |
| 1661 | /* Parallel data move decoding */ | |
| 1662 | /*******************************/ | |
| 1663 | static void decode_x_memory_data_move(const UINT16 op_byte, char* parallel_move_str) | |
| 2538 | /**********************************/ | |
| 2539 | /* Parallel memory move functions */ | |
| 2540 | /**********************************/ | |
| 2541 | /* X Memory Data Move : 1mRR HHHW ---- ---- : A-137 */ | |
| 2542 | static void decode_x_memory_data_move(const UINT16 op, char* parallel_move_str) | |
| 1664 | 2543 | { |
| 1665 | 2544 | int Rnum; |
| 1666 | 2545 | char SD[32]; |
| 1667 | 2546 | char ea[32]; |
| 1668 | 2547 | char args[32]; |
| 1669 | 2548 | |
| 1670 | /* Byte: 1mRR HHHW ---- ---- */ | |
| 1671 | Rnum = decode_RR_table(BITS(op_byte,0x30)); | |
| 1672 | decode_HHH_table(BITS(op_byte,0x0e), SD); | |
| 1673 | assemble_ea_from_m_table(BITS(op_byte,0x40), Rnum, ea); | |
| 1674 | assemble_arguments_from_W_table(BITS(op_byte,0x01), args, 'X', SD, ea); | |
| 2549 | Rnum = decode_RR_table(BITS(op,0x3000)); | |
| 2550 | decode_HHH_table(BITS(op,0x0e00), SD); | |
| 2551 | assemble_ea_from_m_table(BITS(op,0x4000), Rnum, ea); | |
| 2552 | assemble_arguments_from_W_table(BITS(op,0x0100), args, 'X', SD, ea); | |
| 1675 | 2553 | |
| 1676 | 2554 | sprintf(parallel_move_str, "%s", args); |
| 1677 | 2555 | } |
| 1678 | 2556 | |
| 2557 | /* X Memory Data Move : 0101 HHHW ---- ---- : A-137 */ | |
| 2558 | static void decode_x_memory_data_move2(const UINT16 op, char* parallel_move_str, char* d_register) | |
| 2559 | { | |
| 2560 | char SD[32] ; | |
| 2561 | char args[32] ; | |
| 2562 | char dest[32] ; | |
| 2563 | ||
| 2564 | if (d_register[0] == 'B') | |
| 2565 | sprintf(dest, "(A1)"); | |
| 2566 | else if (d_register[0] == 'A') | |
| 2567 | sprintf(dest, "(B1)"); | |
| 2568 | else | |
| 2569 | sprintf(dest, "(A1)"); | |
| 2570 | ||
| 2571 | decode_HHH_table(BITS(op,0x0e00), SD) ; | |
| 2572 | assemble_arguments_from_W_table(BITS(op,0x0100), args, 'X', SD, dest) ; | |
| 2573 | ||
| 2574 | sprintf(parallel_move_str, "%s", args); | |
| 2575 | } | |
| 2576 | ||
| 2577 | /* Dual X Memory Data Read : 011m mKKK -rr- ---- : A-142*/ | |
| 1679 | 2578 | static void decode_dual_x_memory_data_read(const UINT16 op, char* parallel_move_str, char* parallel_move_str2) |
| 1680 | 2579 | { |
| 1681 | 2580 | int Rnum; |
| r3333 | r3334 | |
| 1684 | 2583 | char ea1[32] = ""; |
| 1685 | 2584 | char ea2[32] = ""; |
| 1686 | 2585 | |
| 1687 | /* 011m mKKK -rr- ---- */ | |
| 1688 | 2586 | Rnum = decode_rr_table(BITS(op,0x0060)); |
| 1689 | 2587 | decode_KKK_table(BITS(op,0x0700), D1, D2); |
| 1690 | 2588 | assemble_eas_from_m_table(BITS(op,0x1800), Rnum, 3, ea1, ea2); |
| 1691 | 2589 | |
| 1692 | /* TODO : | |
| 2590 | /* TODO : Th | |
| 1693 | 2591 | |
| 1694 | 2592 | if (Rnum == -1) |
| 1695 | 2593 | { |
| r3333 | r3334 | |
| 1700 | 2598 | sprintf(parallel_move_str2, "X:%s,%s", ea2, D2); |
| 1701 | 2599 | } |
| 1702 | 2600 | |
| 1703 | static void decode_register_to_register_data_move(const UINT16 op_byte, char* parallel_move_str, char* d_register) | |
| 2601 | /* Register to Register Data Move : 0100 IIII ---- ---- : A-133 */ | |
| 2602 | static void decode_register_to_register_data_move(const UINT16 op, char* parallel_move_str, char* d_register) | |
| 1704 | 2603 | { |
| 1705 | 2604 | char S[32]; |
| 1706 | 2605 | char D[32]; |
| 1707 | 2606 | |
| 1708 | decode_IIII_table(BITS(op | |
| 2607 | decode_IIII_table(BITS(op | |
| 1709 | 2608 | |
| 1710 | 2609 | if (D[0] == '^' && D[1] == 'F') |
| 1711 | 2610 | { |
| r3333 | r3334 | |
| 1720 | 2619 | sprintf(parallel_move_str, "%s,%s", S, D); |
| 1721 | 2620 | } |
| 1722 | 2621 | |
| 1723 | static void decode_parallel_cooperative_x_memory_data_move(const UINT16 op_byte, char* parallel_move_str, char* d_register) | |
| 2622 | /* Address Register Update : 0011 0zRR ---- ---- : A-135 */ | |
| 2623 | static void decode_address_register_update(const UINT16 op, char* parallel_move_str) | |
| 1724 | 2624 | { |
| 1725 | char SD[32] ; | |
| 1726 | char args[32] ; | |
| 1727 | char dest[32] ; | |
| 2625 | char ea[32]; | |
| 2626 | int Rnum; | |
| 2627 | Rnum = decode_RR_table(BITS(op,0x0300)); | |
| 2628 | assemble_ea_from_z_table(BITS(op,0x0400), Rnum, ea); | |
| 2629 | sprintf(parallel_move_str, "%s", ea); | |
| 2630 | } | |
| 1728 | 2631 | |
| 1729 | if (d_register[0] == 'B') | |
| 1730 | sprintf(dest, "(A1)"); | |
| 1731 | else if (d_register[0] == 'A') | |
| 1732 | sprintf(dest, "(B1)"); | |
| 1733 | else | |
| 1734 | sprintf(dest, "(A1)"); | |
| 2632 | /* X Memory Data Write and Register Data Move : 0001 011k RRDD ---- : A-140 */ | |
| 2633 | static void decode_x_memory_data_write_and_register_data_move(const UINT16 op, char* parallel_move_str, char* parallel_move_str2) | |
| 2634 | { | |
| 2635 | int Rnum; | |
| 2636 | char S[32]; | |
| 2637 | char Dnot[32]; | |
| 1735 | 2638 | |
| 1736 | decode_HHH_table(BITS(op_byte,0x0e), SD) ; | |
| 1737 | assemble_arguments_from_W_table(BITS(op_byte,0x01), args, 'X', SD, dest) ; | |
| 2639 | /* TODO : Cross-check the Dnot stuff against the MPY & MAC things. */ | |
| 2640 | /* It's likely correct as-is, since the ALU op and this guy probably decode the same bit, */ | |
| 2641 | /* but i may have to pass in d_register just to be sure? */ | |
| 2642 | decode_k_table(BITS(op,0x0100), Dnot); | |
| 2643 | Rnum = decode_RR_table(BITS(op,0x00c0)); | |
| 2644 | decode_DD_table(BITS(op,0x0030), S); | |
| 1738 | 2645 | |
| 1739 | sprintf(parallel_move_str, "%s", args); | |
| 2646 | /* TODO : is Nn correct here? */ | |
| 2647 | sprintf(parallel_move_str, "%s,X:(R%d)+N%d", Dnot, Rnum, Rnum); | |
| 2648 | sprintf(parallel_move_str2, "%s,%s", S, Dnot); | |
| 1740 | 2649 | } |
| 1741 | 2650 | |
| 1742 | /* MISSING MPY */ | |
| 1743 | /* | |
| 1744 | char S[32]; | |
| 2651 | /* X Memory Data Move with short displacement : 0000 0101 BBBB BBBB ---- HHHW ---- ---- : A-139 */ | |
| 2652 | static void decode_x_memory_data_move_with_short_displacement(const UINT16 op, const UINT16 op2, char* parallel_move_str) | |
| 2653 | { | |
| 2654 | INT8 B; | |
| 2655 | char SD[32]; | |
| 2656 | char args[32]; | |
| 1745 | 2657 | |
| 1746 | // MPY - 0001 0110 RRDD FQQQ | |
| 1747 | decode_k_table(BITS(op,0x0100), Dnot); | |
| 1748 | Rnum = decode_RR_table(BITS(op,0x00c0)); | |
| 1749 | decode_DD_table(BITS(op,0x0030), S); | |
| 1750 | decode_QQQF_table(BITS(op,0x0007), BITS(op,0x0008), S1, S2, D); | |
| 1751 | sprintf(buffer, "mpy %s,%s,%s %s,(R%d)+N%d %s,%s", S1, S2, D, Dnot, Rnum, Rnum, S, Dnot); | |
| 1752 | // Strange, but not entirely out of the question - this 'k' parameter is hardcoded | |
| 1753 | // I cheat here and do the parallel memory data move above - this specific one is only used twice | |
| 1754 | retSize = 1; | |
| 1755 | */ | |
| 2658 | B = (char)(op & 0x00ff); | |
| 2659 | decode_HHH_table(BITS(op2,0x0e00), SD); | |
| 2660 | assemble_reg_from_W_table(BITS(op2,0x0100), args, 'X', SD, B); | |
| 2661 | sprintf(parallel_move_str, "%s", args); | |
| 2662 | } | |
| 1756 | 2663 | |
| 1757 | /* MISSING MAC */ | |
| 1758 | /* | |
| 1759 | char S[32]; | |
| 1760 | 2664 | |
| 1761 | // MAC - 0001 0111 RRDD FQQQ | |
| 1762 | decode_k_table(BITS(op,0x0100), Dnot); | |
| 1763 | Rnum = decode_RR_table(BITS(op,0x00c0)); | |
| 1764 | decode_DD_table(BITS(op,0x0030), S); | |
| 1765 | decode_QQQF_table(BITS(op,0x0007), BITS(op,0x0008), S1, S2, D); | |
| 1766 | sprintf(buffer, "mac %s,%s,%s %s,(R%d)+N%d %s,%s", S1, S2, D, Dnot, Rnum, Rnum, S, Dnot); | |
| 1767 | // Strange, but not entirely out of the question - this 'k' parameter is hardcoded | |
| 1768 | // I cheat here and do the parallel memory data move above - this specific one is only used twice | |
| 1769 | retSize = 1; | |
| 1770 | */ | |
| 1771 | ||
| 1772 | ||
| 1773 | ||
| 1774 | 2665 | /******************/ |
| 1775 | 2666 | /* Table decoding */ |
| 1776 | 2667 | /******************/ |
| 2668 | ||
| 1777 | 2669 | static int decode_BBB_table(UINT16 BBB) |
| 1778 | 2670 | { |
| 1779 | 2671 | switch(BBB) |
| r3333 | r3334 | |
| 2017 | 2909 | } |
| 2018 | 2910 | } |
| 2019 | 2911 | |
| 2020 | #ifdef UNUSED_FUNCTION | |
| 2021 | 2912 | static void decode_k_table(UINT16 k, char *Dnot) |
| 2022 | 2913 | { |
| 2023 | 2914 | switch(k) |
| r3333 | r3334 | |
| 2026 | 2917 | case 0x1: sprintf(Dnot, "A"); break; |
| 2027 | 2918 | } |
| 2028 | 2919 | } |
| 2029 | #endif | |
| 2030 | 2920 | |
| 2031 | 2921 | static void decode_kSign_table(UINT16 k, char *plusMinus) |
| 2032 | 2922 | { |
| r3333 | r3334 | |
| 2052 | 2942 | } |
| 2053 | 2943 | } |
| 2054 | 2944 | |
| 2055 | #ifdef UNUSED_FUNCTION | |
| 2056 | 2945 | static int decode_NN_table(UINT16 NN) |
| 2057 | 2946 | { |
| 2058 | 2947 | return NN; |
| 2059 | 2948 | } |
| 2060 | #endif | |
| 2061 | 2949 | |
| 2950 | static int decode_TT_table(UINT16 TT) | |
| 2951 | { | |
| 2952 | return TT; | |
| 2953 | } | |
| 2954 | ||
| 2062 | 2955 | static void decode_QQF_table(UINT16 QQ, UINT16 F, char *S1, char *S2, char *D) |
| 2063 | 2956 | { |
| 2064 | 2957 | UINT16 switchVal = (QQ << 1) | F; |
| r3333 | r3334 | |
| 2244 | 3137 | } |
| 2245 | 3138 | } |
| 2246 | 3139 | |
| 2247 | ||
| 2248 | #ifdef UNUSED_FUNCTION | |
| 2249 | 3140 | static void assemble_ea_from_z_table(UINT16 z, int n, char *ea) |
| 2250 | 3141 | { |
| 2251 | 3142 | switch(z) |
| r3333 | r3334 | |
| 2254 | 3145 | case 0x1: sprintf(ea, "(R%d)+N%d", n, n); break; |
| 2255 | 3146 | } |
| 2256 | 3147 | } |
| 2257 | #endif | |
| 2258 | 3148 | |
| 2259 | 3149 | static void assemble_D_from_P_table(UINT16 P, UINT16 ppppp, char *D) |
| 2260 | 3150 | { |
| r3333 | r3334 | |
| 2296 | 3186 | sprintf(ea, "%.04x", fullAddy); |
| 2297 | 3187 | } |
| 2298 | 3188 | |
| 2299 | static INT8 get_6_bit_ | |
| 3189 | static INT8 get_6_bit_s | |
| 2300 | 3190 | { |
| 2301 | 3191 | UINT16 fullAddy = bits; |
| 2302 | 3192 | if (fullAddy & 0x0020) |
| r3333 | r3334 | |
| 2339 | 3229 | } |
| 2340 | 3230 | } |
| 2341 | 3231 | |
| 2342 | ||
| 2343 | ||
| 2344 | ||
| 2345 | /* | |
| 2346 | ||
| 2347 | Data ALU Ops | |
| 2348 | -------------------- | |
| 2349 | ||
| 2350 | CLR X 1xxx xxxx 0000 x001 | |
| 2351 | ADD X 1xxx xxxx 0000 xxxx | |
| 2352 | ||
| 2353 | MOVE X 1xxx xxxx 0001 0001 | |
| 2354 | TFR X 1xxx xxxx 0001 xxxx | |
| 2355 | ||
| 2356 | RND X 1xxx xxxx 0010 x000 | |
| 2357 | TST X 1xxx xxxx 0010 x001 | |
| 2358 | INC X 1xxx xxxx 0010 x010 | |
| 2359 | INC24 X 1xxx xxxx 0010 x011 | |
| 2360 | OR X 1xxx xxxx 0010 x1xx | |
| 2361 | ||
| 2362 | ASR X 1xxx xxxx 0011 x000 | |
| 2363 | ASL X 1xxx xxxx 0011 x001 | |
| 2364 | LSR X 1xxx xxxx 0011 x010 | |
| 2365 | LSL X 1xxx xxxx 0011 x011 | |
| 2366 | EOR X 1xxx xxxx 0011 x1xx | |
| 2367 | ||
| 2368 | SUBL X 1xxx xxxx 0100 x001 | |
| 2369 | SUB X 1xxx xxxx 0100 xxxx | |
| 2370 | ||
| 2371 | CLR24 X 1xxx xxxx 0101 x001 | |
| 2372 | SBC X 1xxx xxxx 0101 x01x | |
| 2373 | CMP X 1xxx xxxx 0101 xxxx | |
| 2374 | ||
| 2375 | NEG X 1xxx xxxx 0110 x000 | |
| 2376 | NOT X 1xxx xxxx 0110 x001 | |
| 2377 | DEC X 1xxx xxxx 0110 x010 | |
| 2378 | DEC24 X 1xxx xxxx 0110 x011 | |
| 2379 | AND X 1xxx xxxx 0110 x1xx | |
| 2380 | ||
| 2381 | ABS X 1xxx xxxx 0111 x001 | |
| 2382 | ROR X 1xxx xxxx 0111 x010 | |
| 2383 | ROL X 1xxx xxxx 0111 x011 | |
| 2384 | CMPM X 1xxx xxxx 0111 xxxx | |
| 2385 | ||
| 2386 | MPY X 1xxx xxxx 1x00 xxxx | |
| 2387 | MPYR X 1xxx xxxx 1x01 xxxx | |
| 2388 | MAC X 1xxx xxxx 1x10 xxxx | |
| 2389 | MACR X 1xxx xxxx 1x11 xxxx | |
| 2390 | ||
| 2391 | ||
| 2392 | VERY STRANGE XMDM! 0101 HHHW xxxx xxxx | |
| 2393 | ||
| 2394 | ||
| 2395 | DXMDR | |
| 2396 | ----------------- | |
| 2397 | ||
| 2398 | ADD X 011x xxxx 0xxx xxxx | |
| 2399 | SUB X 011x xxxx 0xxx xxxx | |
| 2400 | TFR X 011x xxxx 0xx1 x0xx | |
| 2401 | MOVE X 011x xxxx 0xx1 0000 | |
| 2402 | ||
| 2403 | MPY X 011x xxxx 1xx0 x0xx | |
| 2404 | MAC X 011x xxxx 1xx0 x1xx | |
| 2405 | MPYR X 011x xxxx 1XX1 x0xx | |
| 2406 | MACR X 011x xxxx 1XX1 x1xx | |
| 2407 | ||
| 2408 | TODO: don't forget us | |
| 2409 | x memory data write and register data move - unique | |
| 2410 | ----------------- | |
| 2411 | MPY X 0001 0110 xxxx xxxx | |
| 2412 | MAC X 0001 0111 xxxx xxxx | |
| 2413 | ||
| 2414 | ODDBALL | |
| 2415 | ------- | |
| 2416 | Tcc X 0001 00xx xxxx xx0x | |
| 2417 | ||
| 2418 | BITFIELD | |
| 2419 | ----------------- | |
| 2420 | ||
| 2421 | BFTSTL X 0001 0100 000x xxxx . xxx0 0000 xxxx xxxx | |
| 2422 | BFTSTH X 0001 0100 000x xxxx . xxx1 0000 xxxx xxxx | |
| 2423 | BFTSTL X 0001 0100 001X XXxx . xxx0 0000 xxxx xxxx | |
| 2424 | BFTSTH X 0001 0100 001X XXxx . xxx1 0000 xxxx xxxx | |
| 2425 | BFTSTL X 0001 0100 01xx xxxx . xxx0 0000 xxxx xxxx | |
| 2426 | BFTSTH X 0001 0100 01xx xxxx . xxx1 0000 xxxx xxxx | |
| 2427 | BFCLR X 0001 0100 100x xxxx . xxx0 0100 xxxx xxxx | |
| 2428 | BFCHG X 0001 0100 100x xxxx . xxx1 0010 xxxx xxxx | |
| 2429 | BFSET X 0001 0100 100x xxxx . xxx1 1000 xxxx xxxx | |
| 2430 | BFCLR X 0001 0100 101X XXxx . xxx0 0100 xxxx xxxx | |
| 2431 | BFCHG X 0001 0100 101X XXxx . xxx1 0010 xxxx xxxx | |
| 2432 | BFSET X 0001 0100 101X XXxx . xxx1 1000 xxxx xxxx | |
| 2433 | BFCHG X 0001 0100 11xx xxxx . xxx1 0010 xxxx xxxx | |
| 2434 | BFCLR X 0001 0100 11xx xxxx . xxx0 0100 xxxx xxxx | |
| 2435 | BFSET X 0001 0100 11xx xxxx . xxx1 1000 xxxx xxxx | |
| 2436 | ||
| 2437 | ||
| 2438 | NPM | |
| 2439 | ----------------- | |
| 2440 | ||
| 2441 | TFR2 X 0001 0101 0000 x00x | |
| 2442 | ADC X 0001 0101 0000 x01x | |
| 2443 | ||
| 2444 | TST2 X 0001 0101 0001 X1xx | |
| 2445 | ||
| 2446 | NORM X 0001 0101 0010 x0xx | |
| 2447 | ||
| 2448 | ASR4 X 0001 0101 0011 x000 | |
| 2449 | ASL4 X 0001 0101 0011 x001 | |
| 2450 | ||
| 2451 | DIV X 0001 0101 0XX0 x1xx | |
| 2452 | ||
| 2453 | ZERO X 0001 0101 0101 x000 | |
| 2454 | EXT X 0001 0101 0101 x010 | |
| 2455 | ||
| 2456 | NEGC X 0001 0101 0110 x000 | |
| 2457 | ||
| 2458 | ASR16 X 0001 0101 0111 x000 | |
| 2459 | SWAP X 0001 0101 0111 x001 | |
| 2460 | ||
| 2461 | IMPY X 0001 0101 1000 xxxx | |
| 2462 | IMAC X 0001 0101 1010 xxxx | |
| 2463 | DMAC(ss,su,uu) X 0001 0101 10x1 xxxx | |
| 2464 | MPY(su,uu) X 0001 0101 1100 xxxx | |
| 2465 | MAC(su,uu) X 0001 0101 1110 xxxx | |
| 2466 | ||
| 2467 | IMMEDIATE | |
| 2468 | ----------------- | |
| 2469 | ||
| 2470 | ANDI X 0001 1xx0 xxxx xxxx | |
| 2471 | ORI X 0001 1xx1 xxxx xxxx | |
| 2472 | ||
| 2473 | ||
| 2474 | SPECIAL | |
| 2475 | ----------------- | |
| 2476 | ||
| 2477 | MOVE(S) X 0001 100x xx0x xxxx | |
| 2478 | MOVE(P) X 0001 100x xx1x xxxx | |
| 2479 | ||
| 2480 | ----------------- | |
| 2481 | ||
| 2482 | MOVE(I) X 0010 00xx xxxx xxxx | |
| 2483 | TFR3 X 0010 01xx xxxx xxxx | |
| 2484 | MOVE(C) X 0010 10xx xxxx xxxx | |
| 2485 | Bcc X 0010 11xx xxxx xxxx | |
| 2486 | ||
| 2487 | ----------------- | |
| 2488 | ||
| 2489 | MOVE(C) X 0011 1xxx xxx0 xxxx | |
| 2490 | MOVE(C) X 0011 1xxx xxx1 x0xx | |
| 2491 | MOVE(C) X 0011 1xxx xxx1 x10X xxxx xxxx xxxx xxxx | |
| 2492 | MOVE(C) X 0011 1xxx xxx1 x11X | |
| 2493 | ||
| 2494 | ||
| 2495 | ||
| 2496 | ||
| 2497 | ||
| 2498 | ||
| 2499 | ||
| 2500 | ||
| 2501 | ----------------- | |
| 2502 | ||
| 2503 | NOP X 0000 0000 0000 0000 | |
| 2504 | DEBUG X 0000 0000 0000 0001 | |
| 2505 | DO FOREVER X 0000 0000 0000 0010 xxxx xxxx xxxx xxxx | |
| 2506 | CHKAAU X 0000 0000 0000 0100 | |
| 2507 | SWI X 0000 0000 0000 0101 | |
| 2508 | RTS X 0000 0000 0000 0110 | |
| 2509 | RTI X 0000 0000 0000 0111 | |
| 2510 | RESET X 0000 0000 0000 1000 | |
| 2511 | ENDDO X 0000 0000 0000 1001 | |
| 2512 | STOP X 0000 0000 0000 1010 | |
| 2513 | WAIT X 0000 0000 0000 1011 | |
| 2514 | ILLEGAL X 0000 0000 0000 1111 | |
| 2515 | ||
| 2516 | DEBUGcc X 0000 0000 0101 xxxx | |
| 2517 | DOLoop X 0000 0000 110X XXxx xxxx xxxx xxxx xxxx | |
| 2518 | REP X 0000 0000 111X XXxx | |
| 2519 | ||
| 2520 | BRKcc X 0000 0001 0001 xxxx | |
| 2521 | ||
| 2522 | JSR X 0000 0001 0010 00xx | |
| 2523 | JMP X 0000 0001 0010 01xx | |
| 2524 | BSR X 0000 0001 0010 10xx | |
| 2525 | BRA X 0000 0001 0010 11xx | |
| 2526 | ||
| 2527 | JSR X 0000 0001 0011 00XX xxxx xxxx xxxx xxxx | |
| 2528 | JMP X 0000 0001 0011 01XX xxxx xxxx xxxx xxxx | |
| 2529 | BSR X 0000 0001 0011 10XX xxxx xxxx xxxx xxxx | |
| 2530 | BRA X 0000 0001 0011 11XX xxxx xxxx xxxx xxxx | |
| 2531 | ||
| 2532 | REPcc X 0000 0001 0101 xxxx | |
| 2533 | ||
| 2534 | LEA X 0000 0001 10xx xxxx | |
| 2535 | LEA X 0000 0001 11xx xxxx | |
| 2536 | ||
| 2537 | ----------------- | |
| 2538 | ||
| 2539 | MOVE(M) X 0000 001x xx0x xxxx | |
| 2540 | MOVE(M) X 0000 001x xx11 xxxx | |
| 2541 | ||
| 2542 | ----------------- | |
| 2543 | ||
| 2544 | DOLoop X 0000 0100 000x xxxx xxxx xxxx xxxx xxxx | |
| 2545 | REP X 0000 0100 001x xxxx | |
| 2546 | ||
| 2547 | ----------------- | |
| 2548 | ||
| 2549 | MOVE(M) X 0000 0101 xxxx xxxx 0000 001x XX0X Xxxx | |
| 2550 | MOVE(C) X 0000 0101 xxxx xxxx 0011 1xxx xxx0 XXXX | |
| 2551 | MOVE X 0000 0101 xxxx xxxx XXXX xxxx 0001 0001 | |
| 2552 | ||
| 2553 | ----------------- | |
| 2554 | ||
| 2555 | JScc X 0000 0110 xx00 xxxx | |
| 2556 | JScc X 0000 0110 XX01 xxxx xxxx xxxx xxxx xxxx | |
| 2557 | Jcc X 0000 0110 xx10 xxxx | |
| 2558 | Jcc X 0000 0110 XX11 xxxx xxxx xxxx xxxx xxxx | |
| 2559 | ||
| 2560 | BScc X 0000 0111 xx00 xxxx | |
| 2561 | BScc X 0000 0111 XX01 xxxx xxxx xxxx xxxx xxxx | |
| 2562 | Bcc X 0000 0111 xx10 xxxx | |
| 2563 | Bcc X 0000 0111 XX11 xxxx xxxx xxxx xxxx xxxx | |
| 2564 | ||
| 2565 | ----------------- | |
| 2566 | ||
| 2567 | JSR X 0000 1010 xxxx xxxx | |
| 2568 | BRA X 0000 1011 xxxx xxxx | |
| 2569 | MOVE(P) X 0000 110x xxxx xxxx | |
| 2570 | DOLoop X 0000 1110 xxxx xxxx xxxx xxxx xxxx xxxx | |
| 2571 | REP X 0000 1111 xxxx xxxx | |
| 2572 | ||
| 2573 | */ |
| r3333 | r3334 | |
|---|---|---|
| 1221 | 1221 | M_RST(7); |
| 1222 | 1222 | break; |
| 1223 | 1223 | } |
| 1224 | /* For 8080 NF flag is not used but bit is always set */ | |
| 1225 | if(!I.cputype ) { | |
| 1226 | I.AF.b.l = I.AF.b.l | NF; | |
| 1227 | } | |
| 1228 | 1224 | } |
| 1229 | 1225 | |
| 1230 | 1226 | static void Interrupt(void) |
| r3333 | r3334 | |
|---|---|---|
| 250 | 250 | case RELW: |
| 251 | 251 | case PER : |
| 252 | 252 | var = read_16(address+1); |
| 253 | sprintf(ptr, " %06x (%s)", pb | ((pc + 1 + var)&0xffff), int_16_str(var)); | |
| 254 | 253 | length += 2; |
| 254 | sprintf(ptr, " %06x (%s)", pb | ((pc + length + var)&0xffff), int_16_str(var)); | |
| 255 | 255 | break; |
| 256 | 256 | case IMM : |
| 257 | 257 | if((opcode->flag == M && !m_flag) || (opcode->flag == X && !x_flag)) |
| r3333 | r3334 | |
|---|---|---|
| 125 | 125 | void (*arm7_coproc_dt_r_callback)(UINT32 insn, UINT32 *prn, UINT32 (*read32)(UINT32 addr)); |
| 126 | 126 | void (*arm7_coproc_dt_w_callback)(UINT32 insn, UINT32 *prn, void (*write32)(UINT32 addr, UINT32 data)); |
| 127 | 127 | |
| 128 | #ifdef UNUSED_DEFINITION | |
| 128 | 129 | // custom dasm callback handlers for co-processor instructions |
| 129 | 130 | char *(*arm7_dasm_cop_dt_callback)(char *pBuf, UINT32 opcode, char *pConditionCode, char *pBuf0); |
| 130 | 131 | char *(*arm7_dasm_cop_rt_callback)(char *pBuf, UINT32 opcode, char *pConditionCode, char *pBuf0); |
| 131 | 132 | char *(*arm7_dasm_cop_do_callback)(char *pBuf, UINT32 opcode, char *pConditionCode, char *pBuf0); |
| 133 | #endif | |
| 132 | 134 | |
| 133 | 135 | |
| 134 | 136 | /*************************************************************************** |
| r3333 | r3334 | |
|---|---|---|
| 403 | 403 | extern UINT32 arm7_disasm(char *pBuf, UINT32 pc, UINT32 opcode); |
| 404 | 404 | extern UINT32 thumb_disasm(char *pBuf, UINT32 pc, UINT16 opcode); |
| 405 | 405 | |
| 406 | #ifdef UNUSED_DEFINITION | |
| 406 | 407 | extern char *(*arm7_dasm_cop_dt_callback)(char *pBuf, UINT32 opcode, char *pConditionCode, char *pBuf0); |
| 407 | 408 | extern char *(*arm7_dasm_cop_rt_callback)(char *pBuf, UINT32 opcode, char *pConditionCode, char *pBuf0); |
| 408 | 409 | extern char *(*arm7_dasm_cop_do_callback)(char *pBuf, UINT32 opcode, char *pConditionCode, char *pBuf0); |
| 410 | #endif | |
| 409 | 411 | |
| 410 | 412 | #endif /* __ARM7CORE_H__ */ |
| r3333 | r3334 | |
|---|---|---|
| 3151 | 3151 | /* if nothing there, add a single multiline item and return */ |
| 3152 | 3152 | if (matchcount == 0) |
| 3153 | 3153 | { |
| 3154 | ui_menu_item_append(menu, "No games found. Please check the rompath specified in the mame.ini file.\n\n" | |
| 3155 | "If this is your first time using MAME, please see the config.txt file in " | |
| 3156 | "the docs directory for information on configuring MAME.", NULL, MENU_FLAG_MULTILINE | MENU_FLAG_REDTEXT, NULL); | |
| 3154 | ui_menu_item_append(menu, "No "GAMESNOUN" found. Please check the rompath specified in the "CONFIGNAME".ini file.\n\n" | |
| 3155 | "If this is your first time using "APPNAME", please see the config.txt file in " | |
| 3156 | "the docs directory for information on configuring "APPNAME, NULL, MENU_FLAG_MULTILINE | MENU_FLAG_REDTEXT, NULL); | |
| 3157 | 3157 | return; |
| 3158 | 3158 | } |
| 3159 | 3159 |
| r3333 | r3334 | |
|---|---|---|
| 142 | 142 | $(EMUMACHINE)/ldcore.o \ |
| 143 | 143 | $(EMUMACHINE)/ldpr8210.o \ |
| 144 | 144 | $(EMUMACHINE)/ldv1000.o \ |
| 145 | $(EMUMACHINE)/ldvp931.o \ | |
| 145 | 146 | $(EMUMACHINE)/mb3773.o \ |
| 146 | 147 | $(EMUMACHINE)/mb87078.o \ |
| 147 | 148 | $(EMUMACHINE)/mc146818.o \ |
| r3333 | r3334 | |
|---|---|---|
| 349 | 349 | player data |
| 350 | 350 | -------------------------------------------------*/ |
| 351 | 351 | |
| 352 | void pr8210_overlay(laserdisc_state *ld, bitmap_t *bitmap) | |
| 352 | static void pr8210_overlay(laserdisc_state *ld, bitmap_t *bitmap) | |
| 353 | 353 | { |
| 354 | 354 | // ldplayer_data *player = ld->player; |
| 355 | 355 | } |
| r3333 | r3334 | |
| 804 | 804 | ADDRESS_MAP_END |
| 805 | 805 | |
| 806 | 806 | |
| 807 | MACHINE_DRIVER_START( simutrek ) | |
| 807 | static MACHINE_DRIVER_START( simutrek ) | |
| 808 | 808 | MDRV_CPU_ADD("simutrek", I8748, XTAL_6MHz) |
| 809 | 809 | MDRV_CPU_IO_MAP(simutrek_portmap,0) |
| 810 | 810 |
| r0 | r3334 | |
|---|---|---|
| 1 | /************************************************************************* | |
| 2 | ||
| 3 | ldvp931.c | |
| 4 | ||
| 5 | Philips 22VP931 laserdisc emulation. | |
| 6 | ||
| 7 | Copyright Nicola Salmoria and the MAME Team. | |
| 8 | Visit http://mamedev.org for licensing and usage restrictions. | |
| 9 | ||
| 10 | ************************************************************************** | |
| 11 | ||
| 12 | Still to do: | |
| 13 | ||
| 14 | * determine actual slow/fast speeds | |
| 15 | * | |
| 16 | ||
| 17 | *************************************************************************/ | |
| 18 | ||
| 19 | #include "ldcore.h" | |
| 20 | #include "cpu/mcs48/mcs48.h" | |
| 21 | ||
| 22 | ||
| 23 | ||
| 24 | /*************************************************************************** | |
| 25 | DEBUGGING | |
| 26 | ***************************************************************************/ | |
| 27 | ||
| 28 | #define LOG_COMMANDS 0 | |
| 29 | #define LOG_PORTS 0 | |
| 30 | ||
| 31 | ||
| 32 | ||
| 33 | /*************************************************************************** | |
| 34 | CONSTANTS | |
| 35 | ***************************************************************************/ | |
| 36 | ||
| 37 | /* Philips 22VP931 specific information */ | |
| 38 | #define VP931_SCAN_SPEED (2000 / 30) /* 2000 frames/second */ | |
| 39 | #define VP931_SCAN_FAST_SPEED (4000 / 30) /* 4000 frames/second */ | |
| 40 | ||
| 41 | ||
| 42 | ||
| 43 | /*************************************************************************** | |
| 44 | TYPE DEFINITIONS | |
| 45 | ***************************************************************************/ | |
| 46 | ||
| 47 | /* player-specific data */ | |
| 48 | struct _ldplayer_data | |
| 49 | { | |
| 50 | /* low-level emulation data */ | |
| 51 | int cpunum; /* CPU index of the 8049 */ | |
| 52 | const device_config *tracktimer; /* timer device */ | |
| 53 | int lastframe; | |
| 54 | UINT8 out0; /* output 0 state */ | |
| 55 | UINT8 out1; /* output 1 state */ | |
| 56 | UINT8 port1; /* port 1 state */ | |
| 57 | UINT8 daticval; /* latched DATIC value */ | |
| 58 | UINT8 daticerp; /* /ERP value from DATIC */ | |
| 59 | UINT8 datastrobe; /* DATA STROBE line from DATIC */ | |
| 60 | UINT8 fromcontroller; /* command byte from the controller */ | |
| 61 | UINT8 fromcontroller_pending; /* TRUE if data is pending */ | |
| 62 | UINT8 tocontroller; /* command byte to the controller */ | |
| 63 | UINT8 tocontroller_pending; /* TRUE if data is pending */ | |
| 64 | INT8 trackdir; /* direction of tracking */ | |
| 65 | UINT8 trackstate; /* state of tracking */ | |
| 66 | UINT8 cmdbuf[3]; /* 3 bytes worth of commands */ | |
| 67 | UINT8 cmdcount; /* number of command bytes seen */ | |
| 68 | INT16 advanced; /* number of frames advanced */ | |
| 69 | void (*data_ready_cb)(const device_config *device, int state); /* data ready callback */ | |
| 70 | }; | |
| 71 | ||
| 72 | ||
| 73 | ||
| 74 | /*************************************************************************** | |
| 75 | FUNCTION PROTOTYPES | |
| 76 | ***************************************************************************/ | |
| 77 | ||
| 78 | static void vp931_init(laserdisc_state *ld); | |
| 79 | static void vp931_vsync(laserdisc_state *ld, const vbi_metadata *vbi, int fieldnum, attotime curtime); | |
| 80 | static INT32 vp931_update(laserdisc_state *ld, const vbi_metadata *vbi, int fieldnum, attotime curtime); | |
| 81 | static void vp931_data_w(laserdisc_state *ld, UINT8 prev, UINT8 data); | |
| 82 | static UINT8 vp931_data_r(laserdisc_state *ld); | |
| 83 | static UINT8 vp931_ready(laserdisc_state *ld); | |
| 84 | static UINT8 vp931_data_ready(laserdisc_state *ld); | |
| 85 | ||
| 86 | static WRITE8_HANDLER( output0_w ); | |
| 87 | static WRITE8_HANDLER( output1_w ); | |
| 88 | static WRITE8_HANDLER( lcd_w ); | |
| 89 | static READ8_HANDLER( keypad_r ); | |
| 90 | static READ8_HANDLER( datic_r ); | |
| 91 | static READ8_HANDLER( from_controller_r ); | |
| 92 | static WRITE8_HANDLER( to_controller_w ); | |
| 93 | static READ8_HANDLER( port1_r ); | |
| 94 | static WRITE8_HANDLER( port1_w ); | |
| 95 | static READ8_HANDLER( port2_r ); | |
| 96 | static WRITE8_HANDLER( port2_w ); | |
| 97 | static READ8_HANDLER( t0_r ); | |
| 98 | static READ8_HANDLER( t1_r ); | |
| 99 | static TIMER_CALLBACK( vbi_data_fetch ); | |
| 100 | static TIMER_CALLBACK( deferred_data_w ); | |
| 101 | static TIMER_CALLBACK( irq_off ); | |
| 102 | static TIMER_CALLBACK( datastrobe_off ); | |
| 103 | static TIMER_CALLBACK( erp_off ); | |
| 104 | static TIMER_DEVICE_CALLBACK( track_timer ); | |
| 105 | ||
| 106 | ||
| 107 | ||
| 108 | /*************************************************************************** | |
| 109 | INLINE FUNCTIONS | |
| 110 | ***************************************************************************/ | |
| 111 | ||
| 112 | /*------------------------------------------------- | |
| 113 | find_vp931 - find our device; assumes there | |
| 114 | is only one | |
| 115 | -------------------------------------------------*/ | |
| 116 | ||
| 117 | INLINE laserdisc_state *find_vp931(running_machine *machine) | |
| 118 | { | |
| 119 | return ldcore_get_safe_token(device_list_first(machine->config->devicelist, LASERDISC)); | |
| 120 | } | |
| 121 | ||
| 122 | ||
| 123 | ||
| 124 | /*************************************************************************** | |
| 125 | 22VP931 ROM AND MACHINE INTERFACES | |
| 126 | ***************************************************************************/ | |
| 127 | ||
| 128 | static ADDRESS_MAP_START( vp931_portmap, ADDRESS_SPACE_IO, 8 ) | |
| 129 | AM_RANGE(0x00, 0x00) AM_MIRROR(0xcf) AM_READWRITE(keypad_r, output0_w) | |
| 130 | AM_RANGE(0x10, 0x10) AM_MIRROR(0xcf) AM_WRITE(output1_w) | |
| 131 | AM_RANGE(0x20, 0x20) AM_MIRROR(0xcf) AM_READWRITE(datic_r, lcd_w) | |
| 132 | AM_RANGE(0x30, 0x30) AM_MIRROR(0xcf) AM_READWRITE(from_controller_r, to_controller_w) | |
| 133 | AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(port1_r, port1_w) | |
| 134 | AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READWRITE(port2_r, port2_w) | |
| 135 | AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(t0_r) | |
| 136 | AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(t1_r) | |
| 137 | ADDRESS_MAP_END | |
| 138 | ||
| 139 | ||
| 140 | static MACHINE_DRIVER_START( vp931 ) | |
| 141 | MDRV_CPU_ADD("vp931", I8049, XTAL_11MHz) | |
| 142 | MDRV_CPU_IO_MAP(vp931_portmap,0) | |
| 143 | MDRV_TIMER_ADD("tracktimer", track_timer) | |
| 144 | MACHINE_DRIVER_END | |
| 145 | ||
| 146 | ||
| 147 | ROM_START( vp931 ) | |
| 148 | ROM_REGION( 0x800, "vp931", ROMREGION_LOADBYNAME ) | |
| 149 | ROM_LOAD( "at-6-1_a.bin", 0x000, 0x800, CRC(e11b3c8d) SHA1(ea2d7f6a044ed085ce5e09d8b1b1a21c37f0e9b8) ) | |
| 150 | ROM_END | |
| 151 | ||
| 152 | ||
| 153 | ||
| 154 | /*************************************************************************** | |
| 155 | PR-8210 PLAYER INTERFACE | |
| 156 | ***************************************************************************/ | |
| 157 | ||
| 158 | const ldplayer_interface vp931_interface = | |
| 159 | { | |
| 160 | LASERDISC_TYPE_PHILLIPS_22VP931, /* type of the player */ | |
| 161 | sizeof(ldplayer_data), /* size of the state */ | |
| 162 | "Phillips 22VP931", /* name of the player */ | |
| 163 | rom_vp931, /* pointer to ROM region information */ | |
| 164 | machine_config_vp931, /* pointer to machine configuration */ | |
| 165 | vp931_init, /* initialization callback */ | |
| 166 | vp931_vsync, /* vsync callback */ | |
| 167 | vp931_update, /* update callback */ | |
| 168 | NULL, /* overlay callback */ | |
| 169 | vp931_data_w, /* parallel data write */ | |
| 170 | { /* single line write: */ | |
| 171 | NULL, /* LASERDISC_LINE_ENTER */ | |
| 172 | NULL /* LASERDISC_LINE_CONTROL */ | |
| 173 | }, | |
| 174 | vp931_data_r, /* parallel data read */ | |
| 175 | { /* single line read: */ | |
| 176 | vp931_ready, /* LASERDISC_LINE_READY */ | |
| 177 | NULL, /* LASERDISC_LINE_STATUS */ | |
| 178 | NULL, /* LASERDISC_LINE_COMMAND */ | |
| 179 | vp931_data_ready, /* LASERDISC_LINE_DATA_AVAIL */ | |
| 180 | } | |
| 181 | }; | |
| 182 | ||
| 183 | ||
| 184 | ||
| 185 | /*************************************************************************** | |
| 186 | PUBLIC FUNCTIONS | |
| 187 | ***************************************************************************/ | |
| 188 | ||
| 189 | /*------------------------------------------------- | |
| 190 | vp931_set_data_ready_callback - set the data | |
| 191 | ready callback | |
| 192 | -------------------------------------------------*/ | |
| 193 | ||
| 194 | void vp931_set_data_ready_callback(const device_config *device, void (*callback)(const device_config *device, int state)) | |
| 195 | { | |
| 196 | laserdisc_state *ld = ldcore_get_safe_token(device); | |
| 197 | ld->player->data_ready_cb = callback; | |
| 198 | } | |
| 199 | ||
| 200 | ||
| 201 | ||
| 202 | /*************************************************************************** | |
| 203 | PHILLIPS 22VP931 IMPLEMENTATION | |
| 204 | ***************************************************************************/ | |
| 205 | ||
| 206 | /*------------------------------------------------- | |
| 207 | vp931_init - Pioneer PR-8210-specific | |
| 208 | initialization | |
| 209 | -------------------------------------------------*/ | |
| 210 | ||
| 211 | static void vp931_init(laserdisc_state *ld) | |
| 212 | { | |
| 213 | astring *tempstring = astring_alloc(); | |
| 214 | ldplayer_data *player = ld->player; | |
| 215 | ||
| 216 | /* find our CPU */ | |
| 217 | astring_printf(tempstring, "%s:%s", ld->device->tag, "vp931"); | |
| 218 | player->cpunum = mame_find_cpu_index(ld->device->machine, astring_c(tempstring)); | |
| 219 | ||
| 220 | /* find our timer */ | |
| 221 | astring_printf(tempstring, "%s:%s", ld->device->tag, "tracktimer"); | |
| 222 | player->tracktimer = device_list_find_by_tag(ld->device->machine->config->devicelist, TIMER, astring_c(tempstring)); | |
| 223 | timer_device_set_ptr(player->tracktimer, ld); | |
| 224 | ||
| 225 | astring_free(tempstring); | |
| 226 | } | |
| 227 | ||
| 228 | ||
| 229 | /*------------------------------------------------- | |
| 230 | vp931_vsync - VSYNC callback, called at the | |
| 231 | start of the blanking period | |
| 232 | -------------------------------------------------*/ | |
| 233 | ||
| 234 | static void vp931_vsync(laserdisc_state *ld, const vbi_metadata *vbi, int fieldnum, attotime curtime) | |
| 235 | { | |
| 236 | /* reset our command counter (debugging only) */ | |
| 237 | ld->player->cmdcount = 0; | |
| 238 | ||
| 239 | /* set the ERP signal to 1 to indicate start of frame, and set a timer to turn it off */ | |
| 240 | ld->player->daticerp = 1; | |
| 241 | timer_set(video_screen_get_time_until_pos(ld->screen, 15*2, 0), ld, 0, erp_off); | |
| 242 | } | |
| 243 | ||
| 244 | ||
| 245 | /*------------------------------------------------- | |
| 246 | vp931_update - update callback, called on | |
| 247 | the first visible line of the frame | |
| 248 | -------------------------------------------------*/ | |
| 249 | ||
| 250 | static INT32 vp931_update(laserdisc_state *ld, const vbi_metadata *vbi, int fieldnum, attotime curtime) | |
| 251 | { | |
| 252 | /* set the first VBI timer to go at the start of line 16 */ | |
| 253 | timer_set(video_screen_get_time_until_pos(ld->screen, 16*2, 0), ld, LASERDISC_CODE_LINE16 << 2, vbi_data_fetch); | |
| 254 | ||
| 255 | /* play forward by default */ | |
| 256 | return fieldnum; | |
| 257 | } | |
| 258 | ||
| 259 | ||
| 260 | /*------------------------------------------------- | |
| 261 | vp931_data_w - handle a parallel data write | |
| 262 | to the 22VP931 | |
| 263 | -------------------------------------------------*/ | |
| 264 | ||
| 265 | static void vp931_data_w(laserdisc_state *ld, UINT8 prev, UINT8 data) | |
| 266 | { | |
| 267 | /* set a timer to synchronize execution before sending the data */ | |
| 268 | timer_call_after_resynch(ld, data, deferred_data_w); | |
| 269 | } | |
| 270 | ||
| 271 | ||
| 272 | /*------------------------------------------------- | |
| 273 | vp931_data_r - handle a parallel data read | |
| 274 | from the 22VP931 | |
| 275 | -------------------------------------------------*/ | |
| 276 | ||
| 277 | static UINT8 vp931_data_r(laserdisc_state *ld) | |
| 278 | { | |
| 279 | ldplayer_data *player = ld->player; | |
| 280 | ||
| 281 | /* if data is pending, clear the pending flag and notify any callbacks */ | |
| 282 | if (player->tocontroller_pending) | |
| 283 | { | |
| 284 | player->tocontroller_pending = FALSE; | |
| 285 | if (player->data_ready_cb != NULL) | |
| 286 | (*player->data_ready_cb)(ld->device, FALSE); | |
| 287 | } | |
| 288 | ||
| 289 | /* also boost interleave for 4 scanlines to ensure proper communications */ | |
| 290 | cpu_boost_interleave(attotime_zero, attotime_mul(video_screen_get_scan_period(ld->screen), 4)); | |
| 291 | return player->tocontroller; | |
| 292 | } | |
| 293 | ||
| 294 | ||
| 295 | /*------------------------------------------------- | |
| 296 | vp931_ready - return the status of "ready" | |
| 297 | to the caller (ready to accept another | |
| 298 | command) | |
| 299 | -------------------------------------------------*/ | |
| 300 | ||
| 301 | static UINT8 vp931_ready(laserdisc_state *ld) | |
| 302 | { | |
| 303 | /* if data is pending, we are not ready */ | |
| 304 | ldplayer_data *player = ld->player; | |
| 305 | return player->fromcontroller_pending ? CLEAR_LINE : ASSERT_LINE; | |
| 306 | } | |
| 307 | ||
| 308 | ||
| 309 | /*------------------------------------------------- | |
| 310 | vp931_data_ready - return the status of | |
| 311 | "data available" to the caller | |
| 312 | -------------------------------------------------*/ | |
| 313 | ||
| 314 | static UINT8 vp931_data_ready(laserdisc_state *ld) | |
| 315 | { | |
| 316 | ldplayer_data *player = ld->player; | |
| 317 | return player->tocontroller_pending ? ASSERT_LINE : CLEAR_LINE; | |
| 318 | } | |
| 319 | ||
| 320 | ||
| 321 | /*------------------------------------------------- | |
| 322 | output0_w - controls audio/video squelch | |
| 323 | and other bits | |
| 324 | -------------------------------------------------*/ | |
| 325 | ||
| 326 | static WRITE8_HANDLER( output0_w ) | |
| 327 | { | |
| 328 | laserdisc_state *ld = find_vp931(machine); | |
| 329 | ldplayer_data *player = ld->player; | |
| 330 | ||
| 331 | /* | |
| 332 | $80 = n/c | |
| 333 | $40 = LED (?) -> C335 | |
| 334 | $20 = LED (?) | |
| 335 | $10 = LED (?) -> CX | |
| 336 | $08 = EJECT | |
| 337 | $04 = inverted -> AUDIO MUTE II | |
| 338 | $02 = inverted -> AUDIO MUTE I | |
| 339 | $01 = inverted -> VIDEO MUTE | |
| 340 | */ | |
| 341 | ||
| 342 | if (LOG_PORTS && (player->out0 ^ data) & 0xff) | |
| 343 | { | |
| 344 | printf("%03X:out0:", activecpu_get_pc()); | |
| 345 | if ( (data & 0x80)) printf(" ???"); | |
| 346 | if ( (data & 0x40)) printf(" LED1"); | |
| 347 | if ( (data & 0x20)) printf(" LED2"); | |
| 348 | if ( (data & 0x10)) printf(" LED3"); | |
| 349 | if ( (data & 0x08)) printf(" EJECT"); | |
| 350 | if (!(data & 0x04)) printf(" AUDMUTE2"); | |
| 351 | if (!(data & 0x02)) printf(" AUDMUTE1"); | |
| 352 | if (!(data & 0x01)) printf(" VIDMUTE"); | |
| 353 | printf("\n"); | |
| 354 | player->out0 = data; | |
| 355 | } | |
| 356 | ||
| 357 | /* update a/v squelch */ | |
| 358 | ldcore_set_audio_squelch(ld, !(data & 0x02), !(data & 0x04)); | |
| 359 | ldcore_set_video_squelch(ld, !(data & 0x01)); | |
| 360 | } | |
| 361 | ||
| 362 | ||
| 363 | /*------------------------------------------------- | |
| 364 | output1_w - controls scanning behaviors | |
| 365 | -------------------------------------------------*/ | |
| 366 | ||
| 367 | static WRITE8_HANDLER( output1_w ) | |
| 368 | { | |
| 369 | laserdisc_state *ld = find_vp931(machine); | |
| 370 | ldplayer_data *player = ld->player; | |
| 371 | INT32 speed = 0; | |
| 372 | ||
| 373 | /* | |
| 374 | $80 = n/c | |
| 375 | $40 = n/c | |
| 376 | $20 = n/c | |
| 377 | $10 = n/c | |
| 378 | $08 = inverted -> SMS | |
| 379 | $04 = inverted -> SSS | |
| 380 | $02 = inverted -> SCAN CMD | |
| 381 | $01 = OSM | |
| 382 | */ | |
| 383 | ||
| 384 | if (LOG_PORTS && (player->out1 ^ data) & 0x08) | |
| 385 | { | |
| 386 | mame_printf_debug("%03X:out1:", activecpu_get_pc()); | |
| 387 | if (!(data & 0x08)) mame_printf_debug(" SMS"); | |
| 388 | mame_printf_debug("\n"); | |
| 389 | player->out1 = data; | |
| 390 | } | |
| 391 | ||
| 392 | /* speed is 0 unless SCAN CMD is clear */ | |
| 393 | speed = 0; | |
| 394 | if (!(data & 0x02)) | |
| 395 | { | |
| 396 | /* fast/slow is based on bit 2 */ | |
| 397 | speed = (data & 0x04) ? VP931_SCAN_FAST_SPEED : VP931_SCAN_SPEED; | |
| 398 | ||
| 399 | /* direction is based on bit 0 */ | |
| 400 | if (data & 0x01) | |
| 401 | speed = -speed; | |
| 402 | } | |
| 403 | ||
| 404 | /* update the speed */ | |
| 405 | ldcore_set_slider_speed(ld, speed); | |
| 406 | } | |
| 407 | ||
| 408 | ||
| 409 | /*------------------------------------------------- | |
| 410 | lcd_w - vestigial LCD frame display | |
| 411 | -------------------------------------------------*/ | |
| 412 | ||
| 413 | static WRITE8_HANDLER( lcd_w ) | |
| 414 | { | |
| 415 | /* | |
| 416 | Frame number is written as 5 digits here; however, it is not actually | |
| 417 | connected | |
| 418 | */ | |
| 419 | } | |
| 420 | ||
| 421 | ||
| 422 | /*------------------------------------------------- | |
| 423 | keypad_r - vestigial keypad/button controls | |
| 424 | -------------------------------------------------*/ | |
| 425 | ||
| 426 | static READ8_HANDLER( keypad_r ) | |
| 427 | { | |
| 428 | /* | |
| 429 | From the code, this is apparently a vestigial keypad with basic controls: | |
| 430 | $01 = play | |
| 431 | $02 = still | |
| 432 | $04 = jump 25 frames backward | |
| 433 | $08 = jump 25 frames forward | |
| 434 | $10 = search for frame 50(?) | |
| 435 | $20 = search for frame 350(?) | |
| 436 | $40 = reset | |
| 437 | $80 = play reverse | |
| 438 | */ | |
| 439 | return 0x00; | |
| 440 | } | |
| 441 | ||
| 442 | ||
| 443 | /*------------------------------------------------- | |
| 444 | datic_r - read the latched value from the | |
| 445 | DATIC circuit | |
| 446 | -------------------------------------------------*/ | |
| 447 | ||
| 448 | static READ8_HANDLER( datic_r ) | |
| 449 | { | |
| 450 | laserdisc_state *ld = find_vp931(machine); | |
| 451 | return ld->player->daticval; | |
| 452 | } | |
| 453 | ||
| 454 | ||
| 455 | /*------------------------------------------------- | |
| 456 | from_controller_r - read the value the | |
| 457 | external controller wrote | |
| 458 | -------------------------------------------------*/ | |
| 459 | ||
| 460 | static READ8_HANDLER( from_controller_r ) | |
| 461 | { | |
| 462 | laserdisc_state *ld = find_vp931(machine); | |
| 463 | ldplayer_data *player = ld->player; | |
| 464 | ||
| 465 | /* clear the pending flag and return the data */ | |
| 466 | player->fromcontroller_pending = FALSE; | |
| 467 | return player->fromcontroller; | |
| 468 | } | |
| 469 | ||
| 470 | ||
| 471 | /*------------------------------------------------- | |
| 472 | to_controller_w - write a value back to the | |
| 473 | external controller | |
| 474 | -------------------------------------------------*/ | |
| 475 | ||
| 476 | static WRITE8_HANDLER( to_controller_w ) | |
| 477 | { | |
| 478 | laserdisc_state *ld = find_vp931(machine); | |
| 479 | ldplayer_data *player = ld->player; | |
| 480 | ||
| 481 | /* set the pending flag and stash the data */ | |
| 482 | player->tocontroller_pending = TRUE; | |
| 483 | player->tocontroller = data; | |
| 484 | ||
| 485 | /* signal to the callback if provided */ | |
| 486 | if (player->data_ready_cb != NULL) | |
| 487 | (*player->data_ready_cb)(ld->device, TRUE); | |
| 488 | ||
| 489 | /* also boost interleave for 4 scanlines to ensure proper communications */ | |
| 490 | cpu_boost_interleave(attotime_zero, attotime_mul(video_screen_get_scan_period(ld->screen), 4)); | |
| 491 | } | |
| 492 | ||
| 493 | ||
| 494 | /*------------------------------------------------- | |
| 495 | port1_r - read the 8048 I/O port 1 | |
| 496 | -------------------------------------------------*/ | |
| 497 | ||
| 498 | static READ8_HANDLER( port1_r ) | |
| 499 | { | |
| 500 | laserdisc_state *ld = find_vp931(machine); | |
| 501 | ldplayer_data *player = ld->player; | |
| 502 | UINT8 result = 0x00; | |
| 503 | ||
| 504 | /* | |
| 505 | $80 = P17 = (in) unsure | |
| 506 | $40 = P16 = (in) /ERP from datic circuit | |
| 507 | $20 = P15 = (in) D105 | |
| 508 | */ | |
| 509 | ||
| 510 | if (!player->daticerp) | |
| 511 | result |= 0x40; | |
| 512 | ||
| 513 | return result; | |
| 514 | } | |
| 515 | ||
| 516 | ||
| 517 | /*------------------------------------------------- | |
| 518 | port1_w - write the 8048 I/O port 1 | |
| 519 | -------------------------------------------------*/ | |
| 520 | ||
| 521 | static WRITE8_HANDLER( port1_w ) | |
| 522 | { | |
| 523 | laserdisc_state *ld = find_vp931(machine); | |
| 524 | ldplayer_data *player = ld->player; | |
| 525 | ||
| 526 | /* | |
| 527 | $10 = P14 = (out) D104 -> /SPEED | |
| 528 | $08 = P13 = (out) D103 -> /TIMER ENABLE | |
| 529 | $04 = P12 = (out) D102 -> /REV | |
| 530 | $02 = P11 = (out) D101 -> /FORW | |
| 531 | $01 = P10 = (out) D100 -> some op-amp then to C334, B56, B332 | |
| 532 | */ | |
| 533 | ||
| 534 | if (LOG_PORTS && (player->port1 ^ data) & 0x1f) | |
| 535 | { | |
| 536 | printf("%03X:port1:", activecpu_get_pc()); | |
| 537 | if (!(data & 0x10)) printf(" SPEED"); | |
| 538 | if (!(data & 0x08)) printf(" TIMENABLE"); | |
| 539 | if (!(data & 0x04)) printf(" REV"); | |
| 540 | if (!(data & 0x02)) printf(" FORW"); | |
| 541 | if (!(data & 0x01)) printf(" OPAMP"); | |
| 542 | printf("\n"); | |
| 543 | } | |
| 544 | ||
| 545 | /* if bit 0 is set, we are not tracking */ | |
| 546 | if (data & 0x01) | |
| 547 | player->trackdir = 0; | |
| 548 | ||
| 549 | /* if bit 0 is clear and we weren't tracking before, initialize the state */ | |
| 550 | else if (player->trackdir == 0) | |
| 551 | { | |
| 552 | player->advanced = 0; | |
| 553 | ||
| 554 | /* if bit 2 is clear, we are moving backwards */ | |
| 555 | if (!(data & 0x04)) | |
| 556 | { | |
| 557 | player->trackdir = -1; | |
| 558 | player->trackstate = 1; | |
| 559 | } | |
| 560 | ||
| 561 | /* if bit 1 is clear, we are moving forward */ | |
| 562 | else if (!(data & 0x02)) | |
| 563 | { | |
| 564 | player->trackdir = 1; | |
| 565 | player->trackstate = 0; | |
| 566 | } | |
| 567 | } | |
| 568 | ||
| 569 | /* if we have a timer, adjust it */ | |
| 570 | if (player->tracktimer != NULL) | |
| 571 | { | |
| 572 | /* turn it off if we're not tracking */ | |
| 573 | if (player->trackdir == 0) | |
| 574 | timer_device_adjust_periodic(player->tracktimer, attotime_never, 0, attotime_never); | |
| 575 | ||
| 576 | /* if we just started tracking, or if the speed was changed, reprime the timer */ | |
| 577 | else if (((player->port1 ^ data) & 0x11) != 0) | |
| 578 | { | |
| 579 | /* speeds here are just guesses, but work with the player logic; this is the time per half-track */ | |
| 580 | attotime speed = (data & 0x10) ? ATTOTIME_IN_USEC(60) : ATTOTIME_IN_USEC(10); | |
| 581 | ||
| 582 | /* always start with an initial long delay; the code expects this */ | |
| 583 | timer_device_adjust_periodic(player->tracktimer, ATTOTIME_IN_USEC(100), 0, speed); | |
| 584 | } | |
| 585 | } | |
| 586 | ||
| 587 | player->port1 = data; | |
| 588 | } | |
| 589 | ||
| 590 | ||
| 591 | /*------------------------------------------------- | |
| 592 | port2_r - read from the 8048 I/O port 2 | |
| 593 | -------------------------------------------------*/ | |
| 594 | ||
| 595 | static READ8_HANDLER( port2_r ) | |
| 596 | { | |
| 597 | laserdisc_state *ld = find_vp931(machine); | |
| 598 | ldplayer_data *player = ld->player; | |
| 599 | UINT8 result = 0x00; | |
| 600 | ||
| 601 | /* | |
| 602 | $80 = P27 = (in) set/reset latch; set by FOC LS, reset by IGR | |
| 603 | $20 = P25 = (in) D125 -> 0 when data written to controller is preset, reset to 1 when read | |
| 604 | $10 = P24 = (in) D124 -> 0 when data from controller is present, reset to 1 on a read | |
| 605 | */ | |
| 606 | ||
| 607 | if (!player->tocontroller_pending) | |
| 608 | result |= 0x20; | |
| 609 | if (!player->fromcontroller_pending) | |
| 610 | result |= 0x10; | |
| 611 | ||
| 612 | return result; | |
| 613 | } | |
| 614 | ||
| 615 | ||
| 616 | /*------------------------------------------------- | |
| 617 | port2_w - write the 8048 I/O port 2 | |
| 618 | -------------------------------------------------*/ | |
| 619 | ||
| 620 | static WRITE8_HANDLER( port2_w ) | |
| 621 | { | |
| 622 | /* | |
| 623 | $40 = P26 = (out) cleared while data is sent back & forth; set afterwards | |
| 624 | [Not actually connected, but this is done in the code] | |
| 625 | */ | |
| 626 | } | |
| 627 | ||
| 628 | ||
| 629 | /*------------------------------------------------- | |
| 630 | t0_r - return the T0 line status, which is | |
| 631 | connected to the DATIC's data strobe line | |
| 632 | -------------------------------------------------*/ | |
| 633 | ||
| 634 | static READ8_HANDLER( t0_r ) | |
| 635 | { | |
| 636 | laserdisc_state *ld = find_vp931(machine); | |
| 637 | return ld->player->datastrobe; | |
| 638 | } | |
| 639 | ||
| 640 | ||
| 641 | /*------------------------------------------------- | |
| 642 | t1_r - return the T1 line status, which is | |
| 643 | connected to the tracking state and is used | |
| 644 | to count the number of tracks advanced | |
| 645 | -------------------------------------------------*/ | |
| 646 | ||
| 647 | static READ8_HANDLER( t1_r ) | |
| 648 | { | |
| 649 | laserdisc_state *ld = find_vp931(machine); | |
| 650 | return ld->player->trackstate; | |
| 651 | } | |
| 652 | ||
| 653 | ||
| 654 | /*------------------------------------------------- | |
| 655 | vbi_data_fetch - called 4 times per scanline | |
| 656 | on lines 16, 17, and 18 to feed the VBI data | |
| 657 | through one byte at a time | |
| 658 | -------------------------------------------------*/ | |
| 659 | ||
| 660 | static TIMER_CALLBACK( vbi_data_fetch ) | |
| 661 | { | |
| 662 | laserdisc_state *ld = ptr; | |
| 663 | ldplayer_data *player = ld->player; | |
| 664 | int which = param & 3; | |
| 665 | int line = param >> 2; | |
| 666 | UINT32 code = 0; | |
| 667 | ||
| 668 | /* fetch the code and compute the DATIC latched value */ | |
| 669 | if (line >= LASERDISC_CODE_LINE16 && line <= LASERDISC_CODE_LINE18) | |
| 670 | code = laserdisc_get_field_code(ld->device, line); | |
| 671 | ||
| 672 | /* at the start of each line, signal an interrupt and use a timer to turn it off */ | |
| 673 | if (which == 0) | |
| 674 | { | |
| 675 | cpunum_set_input_line(machine, player->cpunum, MCS48_INPUT_IRQ, ASSERT_LINE); | |
| 676 | timer_set(ATTOTIME_IN_NSEC(5580), ld, 0, irq_off); | |
| 677 | } | |
| 678 | ||
| 679 | /* clock the data strobe on each subsequent callback */ | |
| 680 | else if (code != 0) | |
| 681 | { | |
| 682 | player->daticval = code >> (8 * (3 - which)); | |
| 683 | player->datastrobe = 1; | |
| 684 | timer_set(ATTOTIME_IN_NSEC(5000), ld, 0, datastrobe_off); | |
| 685 | } | |
| 686 | ||
| 687 | /* determine the next bit to fetch and reprime ourself */ | |
| 688 | if (++which == 4) | |
| 689 | { | |
| 690 | which = 0; | |
| 691 | line++; | |
| 692 | } | |
| 693 | if (line <= LASERDISC_CODE_LINE18 + 1) | |
| 694 | timer_set(video_screen_get_time_until_pos(ld->screen, line*2, which * 2 * video_screen_get_width(ld->screen) / 4), ld, (line << 2) | which, vbi_data_fetch); | |
| 695 | } | |
| 696 | ||
| 697 | ||
| 698 | /*------------------------------------------------- | |
| 699 | deferred_data_w - handle a write from the | |
| 700 | external controller | |
| 701 | -------------------------------------------------*/ | |
| 702 | ||
| 703 | static TIMER_CALLBACK( deferred_data_w ) | |
| 704 | { | |
| 705 | laserdisc_state *ld = ptr; | |
| 706 | ldplayer_data *player = ld->player; | |
| 707 | ||
| 708 | /* set the value and mark it pending */ | |
| 709 | player->fromcontroller = param; | |
| 710 | player->fromcontroller_pending = TRUE; | |
| 711 | ||
| 712 | /* track the commands for debugging purposes */ | |
| 713 | if (player->cmdcount < ARRAY_LENGTH(player->cmdbuf)) | |
| 714 | { | |
| 715 | player->cmdbuf[player->cmdcount++] = param; | |
| 716 | if (LOG_COMMANDS && player->cmdcount == 3) | |
| 717 | printf("Cmd: %02X %02X %02X\n", player->cmdbuf[0], player->cmdbuf[1], player->cmdbuf[2]); | |
| 718 | } | |
| 719 | } | |
| 720 | ||
| 721 | ||
| 722 | /*------------------------------------------------- | |
| 723 | irq_off - turn off the 8048 IRQ signal | |
| 724 | -------------------------------------------------*/ | |
| 725 | ||
| 726 | static TIMER_CALLBACK( irq_off ) | |
| 727 | { | |
| 728 | laserdisc_state *ld = ptr; | |
| 729 | cpunum_set_input_line(machine, ld->player->cpunum, MCS48_INPUT_IRQ, CLEAR_LINE); | |
| 730 | } | |
| 731 | ||
| 732 | ||
| 733 | /*------------------------------------------------- | |
| 734 | datastrobe_off - turn off the DATIC data | |
| 735 | strobe signal | |
| 736 | -------------------------------------------------*/ | |
| 737 | ||
| 738 | static TIMER_CALLBACK( datastrobe_off ) | |
| 739 | { | |
| 740 | laserdisc_state *ld = ptr; | |
| 741 | ld->player->datastrobe = 0; | |
| 742 | } | |
| 743 | ||
| 744 | ||
| 745 | /*------------------------------------------------- | |
| 746 | erp_off - turn off the DATIC ERP signal | |
| 747 | -------------------------------------------------*/ | |
| 748 | ||
| 749 | static TIMER_CALLBACK( erp_off ) | |
| 750 | { | |
| 751 | laserdisc_state *ld = ptr; | |
| 752 | ld->player->daticerp = 0; | |
| 753 | } | |
| 754 | ||
| 755 | ||
| 756 | /*------------------------------------------------- | |
| 757 | track_timer - advance by one half-track | |
| 758 | -------------------------------------------------*/ | |
| 759 | ||
| 760 | static TIMER_DEVICE_CALLBACK( track_timer ) | |
| 761 | { | |
| 762 | laserdisc_state *ld = ptr; | |
| 763 | ldplayer_data *player = ld->player; | |
| 764 | ||
| 765 | /* advance by the count and toggle the state */ | |
| 766 | player->trackstate ^= 1; | |
| 767 | if ((player->trackdir < 0 && !player->trackstate) || (player->trackdir > 0 && player->trackstate)) | |
| 768 | { | |
| 769 | ldcore_advance_slider(ld, player->trackdir); | |
| 770 | player->advanced += player->trackdir; | |
| 771 | } | |
| 772 | } |
| r3333 | r3334 | |
|---|---|---|
| 37 | 37 | /* laserdisc control lines */ |
| 38 | 38 | #define LASERDISC_LINE_ENTER 0 /* "ENTER" key/line */ |
| 39 | 39 | #define LASERDISC_LINE_CONTROL 1 /* "CONTROL" line */ |
| 40 | #define LASERDISC_INPUT_LINES 2 | |
| 40 | #define LASERDISC_LINE_RESET 2 /* "RESET" line */ | |
| 41 | #define LASERDISC_INPUT_LINES 3 | |
| 41 | 42 | |
| 42 | 43 | /* laserdisc status lines */ |
| 43 | 44 | #define LASERDISC_LINE_READY 0 /* "READY" line */ |
| r3333 | r3334 | |
| 47 | 48 | #define LASERDISC_OUTPUT_LINES 4 |
| 48 | 49 | |
| 49 | 50 | /* laserdisc field codes */ |
| 50 | #define LASERDISC_CODE_WHITE_FLAG 0 /* boolean white flag */ | |
| 51 | #define LASERDISC_CODE_LINE16 1 /* 24-bit line 16 code */ | |
| 52 | #define LASERDISC_CODE_LINE17 2 /* 24-bit line 17 code */ | |
| 53 | #define LASERDISC_CODE_LINE18 3 /* 24-bit line 18 code */ | |
| 54 | #define LASERDISC_CODE_LINE1718 4 /* 24-bit best of line 17/18 code */ | |
| 51 | #define LASERDISC_CODE_WHITE_FLAG 11 /* boolean white flag */ | |
| 52 | #define LASERDISC_CODE_LINE16 16 /* 24-bit line 16 code */ | |
| 53 | #define LASERDISC_CODE_LINE17 17 /* 24-bit line 17 code */ | |
| 54 | #define LASERDISC_CODE_LINE18 18 /* 24-bit line 18 code */ | |
| 55 | #define LASERDISC_CODE_LINE1718 1718 /* 24-bit best of line 17/18 code */ | |
| 55 | 56 | |
| 56 | 57 | /* device configuration */ |
| 57 | 58 | enum |
| r3333 | r3334 | |
| 161 | 162 | int laserdisc_get_video(const device_config *device, bitmap_t **bitmap); |
| 162 | 163 | |
| 163 | 164 | /* return the raw philips or white flag codes */ |
| 164 | UINT32 laserdisc_get_field_code(const device_config *device, UINT | |
| 165 | UINT32 laserdisc_get_field_code(const device_config *device, UINT32 code); | |
| 165 | 166 | |
| 166 | 167 | |
| 167 | 168 | |
| r3333 | r3334 | |
| 186 | 187 | /* specify the "slow" speed of the Pioneer PR-7820 */ |
| 187 | 188 | void pr7820_set_slow_speed(const device_config *device, double frame_rate_scaler); |
| 188 | 189 | |
| 190 | /* set a callback for data ready on the Phillips 22VP931 */ | |
| 191 | void vp931_set_data_ready_callback(const device_config *device, void (*callback)(const device_config *device, int state)); | |
| 192 | ||
| 189 | 193 | /* control the audio squelch of the Simutrek modified players */ |
| 190 | 194 | void simutrek_set_audio_squelch(const device_config *device, int state); |
| 191 | 195 |
| r3333 | r3334 | |
|---|---|---|
| 151 | 151 | &simutrek_interface, |
| 152 | 152 | &ldv1000_interface, |
| 153 | 153 | // &ldp1450_interface, |
| 154 | // &vp932_interface | |
| 154 | // &vp932_interface, | |
| 155 | &vp931_interface | |
| 155 | 156 | }; |
| 156 | 157 | |
| 157 | 158 | const custom_sound_interface laserdisc_custom_interface = |
| r3333 | r3334 | |
| 560 | 561 | information read from the disc |
| 561 | 562 | -------------------------------------------------*/ |
| 562 | 563 | |
| 563 | UINT32 laserdisc_get_field_code(const device_config *device, UINT | |
| 564 | UINT32 laserdisc_get_field_code(const device_config *device, UINT32 code) | |
| 564 | 565 | { |
| 565 | 566 | laserdisc_state *ld = get_safe_token(device); |
| 566 | 567 | ldcore_data *ldcore = ld->core; |
| r3333 | r3334 | |
| 888 | 889 | ldcore_data *ldcore = ld->core; |
| 889 | 890 | UINT32 tracknum = ldcore->curtrack; |
| 890 | 891 | UINT32 fieldnum = ldcore->fieldnum; |
| 892 | UINT32 curfield = tracknum * 2 + fieldnum; | |
| 891 | 893 | frame_data *frame; |
| 892 | 894 | UINT32 vbiframe; |
| 893 | 895 | UINT32 readhunk; |
| 894 | 896 | INT32 chdtrack; |
| 895 | 897 | |
| 896 | /* if the previous field had a frame number, and the new field immediately follows it, | |
| 897 | force the new field to pair with the previous one */ | |
| 898 | 898 | frame = &ldcore->frame[ldcore->videoindex]; |
| 899 | if ((ldcore->metadata[fieldnum ^ 1].line1718 & VBI_MASK_CAV_PICTURE) == VBI_CODE_CAV_PICTURE && (tracknum * 2 + fieldnum == frame->lastfield + 1)) | |
| 900 | frame->numfields = 1; | |
| 901 | 899 | |
| 902 | /* otherwise, keep the frames in sync with the absolute field numbers */ | |
| 903 | else if (frame->numfields == 2 && fieldnum != 0) | |
| 904 | frame->numfields--; | |
| 900 | /* special cases for playing forward */ | |
| 901 | if (curfield == frame->lastfield + 1) | |
| 902 | { | |
| 903 | /* if the previous field had a frame number, force the new field to pair with the previous one */ | |
| 904 | if ((ldcore->metadata[fieldnum ^ 1].line1718 & VBI_MASK_CAV_PICTURE) == VBI_CODE_CAV_PICTURE) | |
| 905 | frame->numfields = 1; | |
| 905 | 906 | |
| 906 | /* if we already have both fields on the current videoindex, advance */ | |
| 907 | else if (frame->numfields >= 2) | |
| 907 | /* if the twice-previous field was a frame number, and we've moved one since then, consider this one done */ | |
| 908 | else if (frame->numfields >= 2 && (ldcore->metadata[fieldnum].line1718 & VBI_MASK_CAV_PICTURE) == VBI_CODE_CAV_PICTURE) | |
| 909 | { | |
| 910 | ldcore->videoindex = (ldcore->videoindex + 1) % ARRAY_LENGTH(ldcore->frame); | |
| 911 | frame = &ldcore->frame[ldcore->videoindex]; | |
| 912 | frame->numfields = 0; | |
| 913 | } | |
| 914 | } | |
| 915 | ||
| 916 | /* all other cases */ | |
| 917 | else | |
| 908 | 918 | { |
| 909 | ldcore->videoindex = (ldcore->videoindex + 1) % ARRAY_LENGTH(ldcore->frame); | |
| 910 | frame = &ldcore->frame[ldcore->videoindex]; | |
| 911 | frame->numfields = 0; | |
| 919 | /* otherwise, keep the frames in sync with the absolute field numbers */ | |
| 920 | if (frame->numfields == 2 && fieldnum != 0) | |
| 921 | frame->numfields--; | |
| 922 | ||
| 923 | /* if we already have both fields on the current videoindex, advance */ | |
| 924 | else if (frame->numfields >= 2) | |
| 925 | { | |
| 926 | ldcore->videoindex = (ldcore->videoindex + 1) % ARRAY_LENGTH(ldcore->frame); | |
| 927 | frame = &ldcore->frame[ldcore->videoindex]; | |
| 928 | frame->numfields = 0; | |
| 929 | } | |
| 912 | 930 | } |
| 913 | 931 | |
| 914 | 932 | /* if we're squelched, reset the frame counter */ |
| r3333 | r3334 | |
| 1333 | 1351 | rectangle clip = *cliprect; |
| 1334 | 1352 | |
| 1335 | 1353 | /* scale the cliprect to the overlay size and then call the update callback */ |
| 1336 | clip.min_x = 0; | |
| 1337 | clip.max_x = ldcore->config.overwidth - 1; | |
| 1354 | clip.min_x = ldcore->config.overclip.min_x; | |
| 1355 | clip.max_x = ldcore->config.overclip.max_x; | |
| 1338 | 1356 | clip.min_y = cliprect->min_y * overbitmap->height / bitmap->height; |
| 1339 | 1357 | if (cliprect->min_y == visarea->min_y) |
| 1340 | 1358 | clip.min_y = MIN(clip.min_y, ldcore->config.overclip.min_y); |
| r3333 | r3334 | |
|---|---|---|
| 172 | 172 | extern const ldplayer_interface simutrek_interface; |
| 173 | 173 | extern const ldplayer_interface ldv1000_interface; |
| 174 | 174 | extern const ldplayer_interface ldp1450_interface; |
| 175 | extern const ldplayer_interface vp931_interface; | |
| 175 | 176 | extern const ldplayer_interface vp932_interface; |
| 176 | 177 | |
| 177 | 178 |
| r3333 | r3334 | |
|---|---|---|
| 182 | 182 | return lin2expvol[slot->EG.volume>>EG_SHIFT]; |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | unsigned int Get_RATE(unsigned int *Steps,unsigned int rate,unsigned int val) | |
| 185 | static unsigned int Get_RATE(unsigned int *Steps,unsigned int rate,unsigned int val) | |
| 186 | 186 | { |
| 187 | 187 | int r=4*val+rate; |
| 188 | 188 | if(val==0) |
| r3333 | r3334 | |
| 312 | 312 | |
| 313 | 313 | |
| 314 | 314 | |
| 315 | void WriteSlot(struct _MultiPCM *ptChip,struct _SLOT *slot,int reg,unsigned char data) | |
| 315 | static void WriteSlot(struct _MultiPCM *ptChip,struct _SLOT *slot,int reg,unsigned char data) | |
| 316 | 316 | { |
| 317 | 317 | slot->Regs[reg]=data; |
| 318 | 318 | |
| r3333 | r3334 | |
| 481 | 481 | } |
| 482 | 482 | } |
| 483 | 483 | |
| 484 | unsigned char multi_pcm_reg_r(int chip, int offset) | |
| 484 | static unsigned char multi_pcm_reg_r(int chip, int offset) | |
| 485 | 485 | { |
| 486 | 486 | // struct _MultiPCM *ptChip = sndti_token(SOUND_MULTIPCM, chip); |
| 487 | 487 | return 0; |
| r3333 | r3334 | |
|---|---|---|
| 263 | 263 | |
| 264 | 264 | static int rescale_notifier(running_machine *machine, int width, int height) |
| 265 | 265 | { |
| 266 | /* always allow "small" rescaling */ | |
| 267 | if (width < 500 || height < 500) | |
| 266 | /* always allow rescaling for a "small" area and for screenless drivers */ | |
| 267 | if (width < 500 || height < 500 || machine->primary_screen == NULL) | |
| 268 | 268 | return TRUE; |
| 269 | 269 | |
| 270 | 270 | /* if we've currently disallowed rescaling, turn on a message next frame */ |
| r3333 | r3334 | |
|---|---|---|
| 82 | 82 | INLINE void debugger_break(running_machine *machine) |
| 83 | 83 | { |
| 84 | 84 | if ((machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) |
| 85 | debug_cpu_halt_on_next_instruction(machine, "Internal breakpoint\n"); | |
| 85 | debug_cpu_halt_on_next_instruction(machine, cpu_getactivecpu(), "Internal breakpoint\n"); | |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 |
| r3333 | r3334 | |
|---|---|---|
| 484 | 484 | for (drvindex = 0; drivers[drvindex]; drvindex++) |
| 485 | 485 | if (mame_strwildcmp(gamename, drivers[drvindex]->name) == 0) |
| 486 | 486 | { |
| 487 | machine_config *config = machine_config_alloc(drivers[drvindex]->machine_config); | |
| 487 | 488 | const rom_entry *region, *rom, *chunk; |
| 489 | const rom_source *source; | |
| 488 | 490 | |
| 489 | 491 | /* print the header */ |
| 490 | 492 | if (count > 0) |
| r3333 | r3334 | |
| 492 | 494 | mame_printf_info("This is the list of the ROMs required for driver \"%s\".\n" |
| 493 | 495 | "Name Size Checksum\n", drivers[drvindex]->name); |
| 494 | 496 | |
| 495 | /* iterate over regions and then ROMs within the region */ | |
| 496 | for (region = drivers[drvindex]->rom; region; region = rom_next_region(region)) | |
| 497 | for (rom = rom_first_file(region); rom; rom = rom_next_file(rom)) | |
| 498 | { | |
| 499 | const char *name = ROM_GETNAME(rom); | |
| 500 | const char* hash = ROM_GETHASHDATA(rom); | |
| 501 | char hashbuf[HASH_BUF_SIZE]; | |
| 502 | int length = -1; | |
| 503 | ||
| 504 | /* accumulate the total length of all chunks */ | |
| 505 | if (ROMREGION_ISROMDATA(region)) | |
| 497 | /* iterate over sources, regions and then ROMs within the region */ | |
| 498 | for (source = rom_first_source(drivers[drvindex], config); source != NULL; source = rom_next_source(drivers[drvindex], config, source)) | |
| 499 | for (region = rom_first_region(drivers[drvindex], source); region != NULL; region = rom_next_region(region)) | |
| 500 | for (rom = rom_first_file(region); rom != NULL; rom = rom_next_file(rom)) | |
| 506 | 501 | { |
| 507 | length = 0; | |
| 508 | for (chunk = rom_first_chunk(rom); chunk; chunk = rom_next_chunk(chunk)) | |
| 509 | length += ROM_GETLENGTH(chunk); | |
| 510 | } | |
| 502 | const char *name = ROM_GETNAME(rom); | |
| 503 | const char *hash = ROM_GETHASHDATA(rom); | |
| 504 | char hashbuf[HASH_BUF_SIZE]; | |
| 505 | int length = -1; | |
| 511 | 506 | |
| 512 | /* start with the name */ | |
| 513 | mame_printf_info("%-12s ", name); | |
| 507 | /* accumulate the total length of all chunks */ | |
| 508 | if (ROMREGION_ISROMDATA(region)) | |
| 509 | { | |
| 510 | length = 0; | |
| 511 | for (chunk = rom_first_chunk(rom); chunk; chunk = rom_next_chunk(chunk)) | |
| 512 | length += ROM_GETLENGTH(chunk); | |
| 513 | } | |
| 514 | 514 | |
| 515 | /* output the length next */ | |
| 516 | if (length >= 0) | |
| 517 | mame_printf_info("%7d", length); | |
| 518 | else | |
| 519 | mame_printf_info(" "); | |
| 515 | /* start with the name */ | |
| 516 | mame_printf_info("%-12s ", name); | |
| 520 | 517 | |
| 521 | /* output the hash data */ | |
| 522 | if (!hash_data_has_info(hash, HASH_INFO_NO_DUMP)) | |
| 523 | { | |
| 524 | if (hash_data_has_info(hash, HASH_INFO_BAD_DUMP)) | |
| 525 | mame_printf_info(" BAD"); | |
| 518 | /* output the length next */ | |
| 519 | if (length >= 0) | |
| 520 | mame_printf_info("%7d", length); | |
| 521 | else | |
| 522 | mame_printf_info(" "); | |
| 526 | 523 | |
| 527 | hash_data_print(hash, 0, hashbuf); | |
| 528 | mame_printf_info(" %s", hashbuf); | |
| 524 | /* output the hash data */ | |
| 525 | if (!hash_data_has_info(hash, HASH_INFO_NO_DUMP)) | |
| 526 | { | |
| 527 | if (hash_data_has_info(hash, HASH_INFO_BAD_DUMP)) | |
| 528 | mame_printf_info(" BAD"); | |
| 529 | ||
| 530 | hash_data_print(hash, 0, hashbuf); | |
| 531 | mame_printf_info(" %s", hashbuf); | |
| 532 | } | |
| 533 | else | |
| 534 | mame_printf_info(" NO GOOD DUMP KNOWN"); | |
| 535 | ||
| 536 | /* end with a CR */ | |
| 537 | mame_printf_info("\n"); | |
| 529 | 538 | } |
| 530 | else | |
| 531 | mame_printf_info(" NO GOOD DUMP KNOWN"); | |
| 532 | 539 | |
| 533 | /* end with a CR */ | |
| 534 | mame_printf_info("\n"); | |
| 535 | } | |
| 536 | ||
| 537 | 540 | count++; |
| 541 | machine_config_free(config); | |
| 538 | 542 | } |
| 539 | 543 | |
| 540 | 544 | return (count > 0) ? MAMERR_NONE : MAMERR_NO_SUCH_GAME; |
| r3333 | r3334 | |
|---|---|---|
| 572 | 572 | |
| 573 | 573 | void timer_device_adjust_oneshot(const device_config *timer, attotime duration, INT32 param) |
| 574 | 574 | { |
| 575 | #if | |
| 575 | #if | |
| 576 | 576 | timer_config *config = timer->inline_config; |
| 577 | 577 | |
| 578 | /* only makes sense for periodic timers */ | |
| 579 | assert(config->type == TIMER_TYPE_PERIODIC); | |
| 578 | /* doesn't make sense for scanline timers */ | |
| 579 | assert(config->type != TIMER_TYPE_SCANLINE); | |
| 580 | 580 | #endif |
| 581 | 581 | |
| 582 | 582 | timer_device_adjust_periodic(timer, duration, param, attotime_never); |
| r3333 | r3334 | |
| 624 | 624 | void timer_device_adjust_periodic(const device_config *timer, attotime start_delay, INT32 param, attotime period) |
| 625 | 625 | { |
| 626 | 626 | timer_state *state = get_safe_token(timer); |
| 627 | #if | |
| 627 | #if | |
| 628 | 628 | timer_config *config = timer->inline_config; |
| 629 | 629 | |
| 630 | /* only makes sense for periodic timers */ | |
| 631 | assert(config->type == TIMER_TYPE_PERIODIC); | |
| 630 | /* doesn't make sense for scanline timers */ | |
| 631 | assert(config->type != TIMER_TYPE_SCANLINE); | |
| 632 | 632 | #endif |
| 633 | 633 | |
| 634 | 634 | state->start_delay = start_delay; |
| r3333 | r3334 | |
| 688 | 688 | void timer_device_reset(const device_config *timer) |
| 689 | 689 | { |
| 690 | 690 | timer_state *state = get_safe_token(timer); |
| 691 | #if | |
| 691 | #if | |
| 692 | 692 | timer_config *config = timer->inline_config; |
| 693 | 693 | |
| 694 | /* only makes sense for periodic timers */ | |
| 695 | assert(config->type == TIMER_TYPE_PERIODIC); | |
| 694 | /* doesn't make sense for scanline timers */ | |
| 695 | assert(config->type != TIMER_TYPE_SCANLINE); | |
| 696 | 696 | #endif |
| 697 | 697 | |
| 698 | 698 | timer_adjust_periodic(state->timer, state->start_delay, 0, state->period); |
| r3333 | r3334 | |
| 745 | 745 | |
| 746 | 746 | |
| 747 | 747 | /*------------------------------------------------- |
| 748 | timer_get_param | |
| 749 | timer_get_param_ptr - returns the callback | |
| 748 | timer_get_param - returns the callback | |
| 750 | 749 | parameter of a timer |
| 751 | 750 | -------------------------------------------------*/ |
| 752 | 751 | |
| r3333 | r3334 | |
| 759 | 758 | int timer_device_get_param(const device_config *timer) |
| 760 | 759 | { |
| 761 | 760 | timer_state *state = get_safe_token(timer); |
| 762 | #if | |
| 761 | #if | |
| 763 | 762 | timer_config *config = timer->inline_config; |
| 764 | 763 | |
| 765 | /* only makes sense for periodic timers */ | |
| 766 | assert(config->type == TIMER_TYPE_PERIODIC); | |
| 764 | /* doesn't make sense for scanline timers */ | |
| 765 | assert(config->type != TIMER_TYPE_SCANLINE); | |
| 767 | 766 | #endif |
| 768 | 767 | |
| 769 | 768 | return state->param; |
| 770 | 769 | } |
| 771 | 770 | |
| 772 | 771 | |
| 773 | void *timer_get_param_ptr(emu_timer *which) | |
| 772 | /*------------------------------------------------- | |
| 773 | timer_set_param - changes the callback | |
| 774 | parameter of a timer | |
| 775 | -------------------------------------------------*/ | |
| 776 | ||
| 777 | void timer_set_param(emu_timer *which, int param) | |
| 774 | 778 | { |
| 779 | which->param = param; | |
| 780 | } | |
| 781 | ||
| 782 | ||
| 783 | void timer_device_set_param(const device_config *timer, int param) | |
| 784 | { | |
| 785 | timer_state *state = get_safe_token(timer); | |
| 786 | #ifdef MAME_DEBUG | |
| 787 | timer_config *config = timer->inline_config; | |
| 788 | ||
| 789 | /* doesn't make sense for scanline timers */ | |
| 790 | assert(config->type != TIMER_TYPE_SCANLINE); | |
| 791 | #endif | |
| 792 | ||
| 793 | state->param = param; | |
| 794 | } | |
| 795 | ||
| 796 | ||
| 797 | /*------------------------------------------------- | |
| 798 | timer_get_ptr - returns the callback pointer | |
| 799 | of a timer | |
| 800 | -------------------------------------------------*/ | |
| 801 | ||
| 802 | void *timer_get_ptr(emu_timer *which) | |
| 803 | { | |
| 775 | 804 | return which->ptr; |
| 776 | 805 | } |
| 777 | 806 | |
| 778 | 807 | |
| 779 | void *timer_device_get_p | |
| 808 | void *timer_device_get_p | |
| 780 | 809 | { |
| 781 | 810 | timer_state *state = get_safe_token(timer); |
| 782 | 811 | return state->ptr; |
| 783 | 812 | } |
| 784 | 813 | |
| 785 | 814 | |
| 815 | /*------------------------------------------------- | |
| 816 | timer_set_ptr - changes the callback pointer | |
| 817 | of a timer | |
| 818 | -------------------------------------------------*/ | |
| 819 | ||
| 820 | void timer_set_ptr(emu_timer *which, void *ptr) | |
| 821 | { | |
| 822 | which->ptr = ptr; | |
| 823 | } | |
| 824 | ||
| 825 | ||
| 826 | void timer_device_set_ptr(const device_config *timer, void *ptr) | |
| 827 | { | |
| 828 | timer_state *state = get_safe_token(timer); | |
| 829 | state->ptr = ptr; | |
| 830 | } | |
| 831 | ||
| 832 | ||
| 833 | ||
| 786 | 834 | /*************************************************************************** |
| 787 | 835 | TIMING FUNCTIONS |
| 788 | 836 | ***************************************************************************/ |
| r3333 | r3334 | |
| 994 | 1042 | |
| 995 | 1043 | /* get and validate the configuration */ |
| 996 | 1044 | config = device->inline_config; |
| 997 | assert( | |
| 1045 | assert( | |
| 998 | 1046 | assert(config->callback != NULL); |
| 999 | 1047 | |
| 1000 | 1048 | /* copy the pointer parameter */ |
| r3333 | r3334 | |
| 1007 | 1055 | /* type based configuration */ |
| 1008 | 1056 | switch (config->type) |
| 1009 | 1057 | { |
| 1058 | case TIMER_TYPE_GENERIC: | |
| 1059 | /* make sure that only the applicable parameters are filled in */ | |
| 1060 | assert(config->screen == NULL); | |
| 1061 | assert(config->first_vpos == 0); | |
| 1062 | assert(config->increment == 0); | |
| 1063 | assert(config->start_delay == 0); | |
| 1064 | assert(config->period == 0); | |
| 1065 | ||
| 1066 | /* copy the optional integer parameter */ | |
| 1067 | state->param = config->param; | |
| 1068 | ||
| 1069 | /* convert the start_delay and period into attotime */ | |
| 1070 | state->period = attotime_never; | |
| 1071 | state->start_delay = attotime_zero; | |
| 1072 | ||
| 1073 | /* register for state saves */ | |
| 1074 | state_save_register_item(unique_tag, 0, state->param); | |
| 1075 | ||
| 1076 | /* allocate the backing timer */ | |
| 1077 | param = (void *)device; | |
| 1078 | state->timer = timer_alloc(periodic_timer_device_timer_callback, param); | |
| 1079 | break; | |
| 1080 | ||
| 1010 | 1081 | case TIMER_TYPE_PERIODIC: |
| 1011 | 1082 | /* make sure that only the applicable parameters are filled in */ |
| 1012 | 1083 | assert(config->screen == NULL); |
| r3333 | r3334 | |
|---|---|---|
| 221 | 221 | the format |
| 222 | 222 | -------------------------------------------------*/ |
| 223 | 223 | |
| 224 | const char *format_int(astring *string, UINT64 value, int format) | |
| 224 | static const char *format_int(astring *string, UINT64 value, int format) | |
| 225 | 225 | { |
| 226 | 226 | switch (format) |
| 227 | 227 | { |
| r3333 | r3334 | |
|---|---|---|
| 28 | 28 | enum |
| 29 | 29 | { |
| 30 | 30 | TIMER_TYPE_PERIODIC = 0, |
| 31 | TIMER_TYPE_SCANLINE | |
| 31 | TIMER_TYPE_SCANLINE, | |
| 32 | TIMER_TYPE_GENERIC | |
| 32 | 33 | }; |
| 33 | 34 | |
| 34 | 35 | |
| r3333 | r3334 | |
| 105 | 106 | TIMER DEVICE CONFIGURATION MACROS |
| 106 | 107 | ***************************************************************************/ |
| 107 | 108 | |
| 109 | #define MDRV_TIMER_ADD(_tag, _callback) \ | |
| 110 | MDRV_DEVICE_ADD(_tag, TIMER) \ | |
| 111 | MDRV_DEVICE_CONFIG_DATA32(timer_config, type, TIMER_TYPE_GENERIC) \ | |
| 112 | MDRV_DEVICE_CONFIG_DATAPTR(timer_config, callback, _callback) \ | |
| 113 | ||
| 108 | 114 | #define MDRV_TIMER_ADD_PERIODIC(_tag, _callback, _period) \ |
| 109 | 115 | MDRV_DEVICE_ADD(_tag, TIMER) \ |
| 110 | 116 | MDRV_DEVICE_CONFIG_DATA32(timer_config, type, TIMER_TYPE_PERIODIC) \ |
| r3333 | r3334 | |
| 224 | 230 | int timer_get_param(emu_timer *which); |
| 225 | 231 | int timer_device_get_param(const device_config *timer); |
| 226 | 232 | |
| 227 | void *timer_get_param_ptr(emu_timer *which); | |
| 228 | void *timer_device_get_param_ptr(const device_config *timer); | |
| 233 | /* changes the callback parameter of a timer */ | |
| 234 | void timer_set_param(emu_timer *which, int param); | |
| 235 | void timer_device_set_param(const device_config *timer, int param); | |
| 229 | 236 | |
| 237 | /* returns the callback pointer of a timer */ | |
| 238 | void *timer_get_ptr(emu_timer *which); | |
| 239 | void *timer_device_get_ptr(const device_config *timer); | |
| 230 | 240 | |
| 241 | /* changes the callback pointer of a timer */ | |
| 242 | void timer_set_ptr(emu_timer *which, void *ptr); | |
| 243 | void timer_device_set_ptr(const device_config *timer, void *ptr); | |
| 231 | 244 | |
| 245 | ||
| 246 | ||
| 232 | 247 | /* ----- timing functions ----- */ |
| 233 | 248 | |
| 234 | 249 | /* return the time since the last trigger */ |
| r3333 | r3334 | |
|---|---|---|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | |
| 61 | #ifdef UNUSED_FUNCTON | |
| 61 | #ifdef UNUSED_FUNCTION | |
| 62 | 62 | INLINE UINT16 fetch_16bit(UINT8 *v) |
| 63 | 63 | { |
| 64 | 64 | return BIG_ENDIANIZE_INT16(*(UINT16 *)v); |
| r3333 | r3334 | |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | |
| 80 | #ifdef UNUSED_FUNCTON | |
| 80 | #ifdef UNUSED_FUNCTION | |
| 81 | 81 | INLINE void put_16bit(UINT8 *v, UINT16 data) |
| 82 | 82 | { |
| 83 | 83 | *(UINT16 *)v = BIG_ENDIANIZE_INT16(data); |
| r3333 | r3334 | |
|---|---|---|
| 198 | 198 | } |
| 199 | 199 | else |
| 200 | 200 | { |
| 201 | for (y = fill.min_y; y <= fill.max_y; y++) | |
| 201 | UINT16 *destrow, *destrow0; | |
| 202 | ||
| 203 | /* Fill the first line the hard way */ | |
| 204 | destrow = BITMAP_ADDR16(dest, fill.min_y, 0); | |
| 205 | for (x = fill.min_x; x <= fill.max_x; x++) | |
| 206 | destrow[x] = (UINT16)color; | |
| 207 | ||
| 208 | /* For the other lines, just copy the first one */ | |
| 209 | destrow0 = BITMAP_ADDR16(dest, fill.min_y, fill.min_x); | |
| 210 | for (y = fill.min_y + 1; y <= fill.max_y; y++) | |
| 202 | 211 | { |
| 203 | UINT16 *destrow = BITMAP_ADDR16(dest, y, 0); | |
| 204 | for (x = fill.min_x; x <= fill.max_x; x++) | |
| 205 | destrow[x] = (UINT16)color; | |
| 212 | destrow = BITMAP_ADDR16(dest, y, fill.min_x); | |
| 213 | memcpy(destrow, destrow0, (fill.max_x + 1 - fill.min_x) * 2); | |
| 206 | 214 | } |
| 207 | 215 | } |
| 208 | 216 | break; |
| r3333 | r3334 | |
| 216 | 224 | } |
| 217 | 225 | else |
| 218 | 226 | { |
| 219 | for (y = fill.min_y; y <= fill.max_y; y++) | |
| 227 | UINT32 *destrow, *destrow0; | |
| 228 | ||
| 229 | /* Fill the first line the hard way */ | |
| 230 | destrow = BITMAP_ADDR32(dest, fill.min_y, 0); | |
| 231 | for (x = fill.min_x; x <= fill.max_x; x++) | |
| 232 | destrow[x] = (UINT32)color; | |
| 233 | ||
| 234 | /* For the other lines, just copy the first one */ | |
| 235 | destrow0 = BITMAP_ADDR32(dest, fill.min_y, fill.min_x); | |
| 236 | for (y = fill.min_y + 1; y <= fill.max_y; y++) | |
| 220 | 237 | { |
| 221 | UINT32 *destrow = BITMAP_ADDR32(dest, y, 0); | |
| 222 | for (x = fill.min_x; x <= fill.max_x; x++) | |
| 223 | destrow[x] = (UINT32)color; | |
| 238 | destrow = BITMAP_ADDR32(dest, y, fill.min_x); | |
| 239 | memcpy(destrow, destrow0, (fill.max_x + 1 - fill.min_x) * 4); | |
| 224 | 240 | } |
| 225 | 241 | } |
| 226 | 242 | break; |
| r3333 | r3334 | |
|---|---|---|
| 1750 | 1750 | #endif // HAS_PROFILER |
| 1751 | 1751 | |
| 1752 | 1752 | case ID_OPTIONS_DEBUGGER: |
| 1753 | debug_cpu_halt_on_next_instruction(machine, "User-initiated break\n"); | |
| 1753 | debug_cpu_halt_on_next_instruction(machine, -1, "User-initiated break\n"); | |
| 1754 | 1754 | break; |
| 1755 | 1755 | |
| 1756 | 1756 | case ID_OPTIONS_CONFIGURATION: |
| r3333 | r3334 | |
|---|---|---|
| 171 | 171 | |
| 172 | 172 | Source Changes: |
| 173 | 173 | ---------------- |
| 174 | - The core is based on MAME 0.127u | |
| 174 | - The core is based on MAME 0.127u5. This incorporates all features of the | |
| 175 | 175 | update to this core. [MAME team] |
| 176 | 176 | |
| 177 | 177 | - Refactored ZIP path code out of src/mess/image.c, made more testable. [Nate |
| Previous | 15994 Revisions | Next |