| Previous | 15994 Revisions | Next |
| r1479 Friday 4th January, 2008 at 00:46:25 UTC by Nathan Woods |
|---|
| Updated to MAME 0.122u3 core |
| [docs] | messnew.txt |
| [src/emu] | driver.h fileio.h mame.c mame.h memory.c memory.h romload.c ui.c uimenu.c |
| [src/emu/cpu] | x86log.h |
| [src/emu/cpu/e132xs] | e132xs.c |
| [src/emu/cpu/i8051] | i8051.c |
| [src/emu/cpu/mc68hc11] | hc11dasm.c |
| [src/emu/cpu/mips] | psx.c |
| [src/emu/cpu/rsp] | rsp_dasm.c |
| [src/emu/cpu/sharc] | sharcdsm.c |
| [src/emu/cpu/tms32051] | dis32051.c |
| [src/emu/debug] | debugcmd.c debugcpu.c debugcpu.h |
| [src/emu/drivers] | xtal.h* |
| [src/emu/machine] | adc083x.c ds2401.c generic.c i2cmem.c x76f041.c x76f100.c |
| [src/emu/sound] | discrete.c k054539.c psx.c sidenvel.c tms5110r.c |
| [src/lib/util] | astring.h cdrom.c corefile.h options.c pool.c |
| [src/mame] | mame.mak mamedriv.c |
| [src/mame/audio] | mario.c |
| [src/mame/drivers] | btoads.c cninja.c dkong.c flstory.c funkyjet.c itech8.c ksys573.c legionna.c mario.c midyunit.c midzeus.c namcos1.c namcos11.c namcos12.c sbrkout.c seta.c simpsons.c sslam.c suprloco.c taitosj.c toki.c zn.c |
| [src/mame/includes] | dc.h mario.h* midzeus.h |
| [src/mame/layout] | crusnexo.lay* |
| [src/mame/machine] | dc.c decoprot.c flstory.c namcos1.c psx.c snes.c snesdsp1.c zs01.c |
| [src/mame/video] | btoads.c dc.c flstory.c legionna.c liberate.c mario.c namcos1.c psx.c suprloco.c |
| [src/osd/windows] | debugwin.c ledutil.c main.c windows.mak winmain.c |
| r1478 | r1479 | |
|---|---|---|
| 1 | 1 | #include "driver.h" |
| 2 | 2 | #include "cpu/i8039/i8039.h" |
| 3 | #include "sound/dac.h" | |
| 4 | #include "sound/ay8910.h" | |
| 3 | 5 | #include "sound/samples.h" |
| 4 | 6 | |
| 7 | #include "includes/mario.h" | |
| 5 | 8 | |
| 9 | /**************************************************************** | |
| 10 | * | |
| 11 | * Defines and Macros | |
| 12 | * | |
| 13 | ****************************************************************/ | |
| 6 | 14 | |
| 15 | #define ACTIVELOW_PORT_BIT(P,A,D) ((P & (~(1 << A))) | ((D ^ 1) << A)) | |
| 16 | #define ACTIVEHIGH_PORT_BIT(P,A,D) ((P & (~(1 << A))) | (D << A)) | |
| 17 | ||
| 18 | /************************************* | |
| 19 | * | |
| 20 | * statics | |
| 21 | * | |
| 22 | *************************************/ | |
| 23 | ||
| 24 | static UINT8 p[8] = { 0,0xf0,0,0,0,0,0,0 }; | |
| 25 | static UINT8 t[2] = { 0,0 }; | |
| 26 | ||
| 27 | static UINT8 last; | |
| 28 | ||
| 29 | /**************************************************************** | |
| 30 | * | |
| 31 | * Initialization | |
| 32 | * | |
| 33 | ****************************************************************/ | |
| 34 | ||
| 35 | static SOUND_START( mario ) | |
| 36 | { | |
| 37 | p[1] = 0xf0; | |
| 38 | state_save_register_global_array(p); | |
| 39 | state_save_register_global_array(t); | |
| 40 | state_save_register_global(last); | |
| 41 | } | |
| 42 | ||
| 43 | /**************************************************************** | |
| 44 | * | |
| 45 | * I/O Handlers - static | |
| 46 | * | |
| 47 | ****************************************************************/ | |
| 48 | ||
| 49 | static READ8_HANDLER( mario_sh_p1_r ) | |
| 50 | { | |
| 51 | return p[1]; | |
| 52 | } | |
| 53 | ||
| 54 | static READ8_HANDLER( mario_sh_p2_r ) | |
| 55 | { | |
| 56 | return p[2]; | |
| 57 | } | |
| 58 | ||
| 59 | static READ8_HANDLER( mario_sh_t0_r ) | |
| 60 | { | |
| 61 | return t[0]; | |
| 62 | } | |
| 63 | ||
| 64 | static READ8_HANDLER( mario_sh_t1_r ) | |
| 65 | { | |
| 66 | return t[1]; | |
| 67 | } | |
| 68 | ||
| 69 | static READ8_HANDLER( mario_sh_tune_r ) | |
| 70 | { | |
| 71 | return soundlatch_r(offset); | |
| 72 | } | |
| 73 | ||
| 74 | static WRITE8_HANDLER( mario_sh_sound_w ) | |
| 75 | { | |
| 76 | DAC_data_w(0,data); | |
| 77 | } | |
| 78 | ||
| 79 | static WRITE8_HANDLER( mario_sh_p1_w ) | |
| 80 | { | |
| 81 | p[1] = data; | |
| 82 | } | |
| 83 | ||
| 84 | static WRITE8_HANDLER( mario_sh_p2_w ) | |
| 85 | { | |
| 86 | p[2] = data; | |
| 87 | } | |
| 88 | ||
| 89 | /**************************************************************** | |
| 90 | * | |
| 91 | * I/O Handlers - global | |
| 92 | * | |
| 93 | ****************************************************************/ | |
| 94 | ||
| 95 | WRITE8_HANDLER( mario_sh_getcoin_w ) | |
| 96 | { | |
| 97 | t[0] = data; | |
| 98 | } | |
| 99 | ||
| 100 | WRITE8_HANDLER( mario_sh_crab_w ) | |
| 101 | { | |
| 102 | p[1] = ACTIVEHIGH_PORT_BIT(p[1],0,data); | |
| 103 | } | |
| 104 | ||
| 105 | WRITE8_HANDLER( mario_sh_turtle_w ) | |
| 106 | { | |
| 107 | p[1] = ACTIVEHIGH_PORT_BIT(p[1],1,data); | |
| 108 | } | |
| 109 | ||
| 110 | WRITE8_HANDLER( mario_sh_fly_w ) | |
| 111 | { | |
| 112 | p[1] = ACTIVEHIGH_PORT_BIT(p[1],2,data); | |
| 113 | } | |
| 114 | ||
| 115 | WRITE8_HANDLER( masao_sh_irqtrigger_w ) | |
| 116 | { | |
| 117 | if (last == 1 && data == 0) | |
| 118 | { | |
| 119 | /* setting bit 0 high then low triggers IRQ on the sound CPU */ | |
| 120 | cpunum_set_input_line_and_vector(1,0,HOLD_LINE,0xff); | |
| 121 | } | |
| 122 | ||
| 123 | last = data; | |
| 124 | } | |
| 125 | ||
| 126 | WRITE8_HANDLER( mario_sh_tuneselect_w ) | |
| 127 | { | |
| 128 | soundlatch_w(offset,data); | |
| 129 | } | |
| 130 | ||
| 7 | 131 | WRITE8_HANDLER( mario_sh_w ) |
| 8 | 132 | { |
| 9 | 133 | if (data) |
| r1478 | r1479 | |
| 62 | 186 | } |
| 63 | 187 | } |
| 64 | 188 | } |
| 189 | ||
| 190 | /************************************* | |
| 191 | * | |
| 192 | * Sound CPU memory handlers | |
| 193 | * | |
| 194 | *************************************/ | |
| 195 | ||
| 196 | static ADDRESS_MAP_START( mario_sound_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 197 | AM_RANGE(0x0000, 0x0fff) AM_ROM | |
| 198 | ADDRESS_MAP_END | |
| 199 | ||
| 200 | static ADDRESS_MAP_START( mario_sound_io_map, ADDRESS_SPACE_IO, 8 ) | |
| 201 | AM_RANGE(0x00, 0xff) AM_READWRITE(mario_sh_tune_r, mario_sh_sound_w) | |
| 202 | AM_RANGE(I8039_p1, I8039_p1) AM_READWRITE(mario_sh_p1_r, mario_sh_p1_w) | |
| 203 | AM_RANGE(I8039_p2, I8039_p2) AM_READWRITE(mario_sh_p2_r, mario_sh_p2_w) | |
| 204 | AM_RANGE(I8039_t0, I8039_t0) AM_READ(mario_sh_t0_r) | |
| 205 | AM_RANGE(I8039_t1, I8039_t1) AM_READ(mario_sh_t1_r) | |
| 206 | ADDRESS_MAP_END | |
| 207 | ||
| 208 | static ADDRESS_MAP_START( masao_sound_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 209 | AM_RANGE(0x0000, 0x0fff) AM_ROM | |
| 210 | AM_RANGE(0x2000, 0x23ff) AM_RAM | |
| 211 | AM_RANGE(0x4000, 0x4000) AM_READWRITE(AY8910_read_port_0_r, AY8910_write_port_0_w) | |
| 212 | AM_RANGE(0x6000, 0x6000) AM_WRITE(AY8910_control_port_0_w) | |
| 213 | ADDRESS_MAP_END | |
| 214 | ||
| 215 | /************************************* | |
| 216 | * | |
| 217 | * Sound Interfaces | |
| 218 | * | |
| 219 | *************************************/ | |
| 220 | ||
| 221 | static const char *const mario_sample_names[] = | |
| 222 | { | |
| 223 | "*mario", | |
| 224 | ||
| 225 | /* 7f01 - 7f07 sounds */ | |
| 226 | "ice.wav", /* 0x02 ice appears (formerly effect0.wav) */ | |
| 227 | "coin.wav", /* 0x06 coin appears (formerly effect1.wav) */ | |
| 228 | "skid.wav", /* 0x07 skid */ | |
| 229 | ||
| 230 | /* 7c00 */ | |
| 231 | "run.wav", /* 03, 02, 01 - 0x1b */ | |
| 232 | ||
| 233 | /* 7c80 */ | |
| 234 | "luigirun.wav", /* 03, 02, 01 - 0x1c */ | |
| 235 | ||
| 236 | 0 /* end of array */ | |
| 237 | }; | |
| 238 | ||
| 239 | static const struct Samplesinterface samples_interface = | |
| 240 | { | |
| 241 | 3, /* 3 channels */ | |
| 242 | mario_sample_names | |
| 243 | }; | |
| 244 | ||
| 245 | static const struct AY8910interface ay8910_interface = | |
| 246 | { | |
| 247 | soundlatch_r | |
| 248 | }; | |
| 249 | ||
| 250 | ||
| 251 | /************************************* | |
| 252 | * | |
| 253 | * Machine driver | |
| 254 | * | |
| 255 | *************************************/ | |
| 256 | ||
| 257 | MACHINE_DRIVER_START( mario_audio ) | |
| 258 | ||
| 259 | MDRV_CPU_ADD(I8039, I8035_CLOCK) /* audio CPU */ /* 730 kHz */ | |
| 260 | MDRV_CPU_PROGRAM_MAP(mario_sound_map, 0) | |
| 261 | MDRV_CPU_IO_MAP(mario_sound_io_map, 0) | |
| 262 | ||
| 263 | MDRV_SOUND_START(mario) | |
| 264 | ||
| 265 | MDRV_SPEAKER_STANDARD_MONO("mono") | |
| 266 | ||
| 267 | MDRV_SOUND_ADD(DAC, 0) | |
| 268 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) | |
| 269 | ||
| 270 | MDRV_SOUND_ADD(SAMPLES, 0) | |
| 271 | MDRV_SOUND_CONFIG(samples_interface) | |
| 272 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) | |
| 273 | ||
| 274 | MACHINE_DRIVER_END | |
| 275 | ||
| 276 | MACHINE_DRIVER_START( masao_audio ) | |
| 277 | ||
| 278 | MDRV_CPU_ADD(Z80,24576000/16) /* audio CPU */ /* ???? */ | |
| 279 | MDRV_CPU_PROGRAM_MAP(masao_sound_map,0) | |
| 280 | ||
| 281 | MDRV_SOUND_START(mario) | |
| 282 | ||
| 283 | MDRV_SPEAKER_STANDARD_MONO("mono") | |
| 284 | ||
| 285 | MDRV_SOUND_ADD(AY8910, 14318000/6) | |
| 286 | MDRV_SOUND_CONFIG(ay8910_interface) | |
| 287 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) | |
| 288 | ||
| 289 | MACHINE_DRIVER_END | |
| 290 |
| r1478 | r1479 | |
|---|---|---|
| 9 | 9 | |
| 10 | 10 | #include "driver.h" |
| 11 | 11 | |
| 12 | extern UINT8 *onna34ro_workram; | |
| 13 | extern UINT8 *victnine_workram; | |
| 12 | 14 | |
| 13 | 15 | static UINT8 from_main,from_mcu; |
| 14 | 16 | static int mcu_sent = 0,main_sent = 0; |
| r1478 | r1479 | |
| 140 | 142 | |
| 141 | 143 | WRITE8_HANDLER( onna34ro_mcu_w ) |
| 142 | 144 | { |
| 143 | UINT8 *RAM = memory_region(REGION_CPU1); | |
| 144 | UINT16 score_adr = RAM[0xe29e]*0x100 + RAM[0xe29d]; | |
| 145 | UINT16 score_adr = onna34ro_workram[0x29e]*0x100 + onna34ro_workram[0x29d]; | |
| 145 | 146 | |
| 146 | 147 | switch (data) |
| 147 | 148 | { |
| r1478 | r1479 | |
| 152 | 153 | from_mcu = 0x6a; |
| 153 | 154 | break; |
| 154 | 155 | case 0x40: |
| 155 | from_mcu = RAM[score_adr]; /* score l*/ | |
| 156 | if(score_adr >= 0xe000 && score_adr < 0xe800) | |
| 157 | from_mcu = onna34ro_workram[score_adr - 0xe000]; /* score l*/ | |
| 156 | 158 | break; |
| 157 | 159 | case 0x41: |
| 158 | from_mcu = RAM[score_adr+1]; /* score m*/ | |
| 160 | if(score_adr >= 0xe000 && score_adr < 0xe800) | |
| 161 | from_mcu = onna34ro_workram[(score_adr+1) - 0xe000]; /* score m*/ | |
| 159 | 162 | break; |
| 160 | 163 | case 0x42: |
| 161 | from_mcu = RAM[score_adr+2] & 0x0f; /* score h*/ | |
| 164 | if(score_adr >= 0xe000 && score_adr < 0xe800) | |
| 165 | from_mcu = onna34ro_workram[(score_adr+2) - 0xe000] & 0x0f; /* score h*/ | |
| 162 | 166 | break; |
| 163 | 167 | default: |
| 164 | 168 | from_mcu = 0x80; |
| r1478 | r1479 | |
| 178 | 182 | } |
| 179 | 183 | |
| 180 | 184 | |
| 181 | #define VICTNINE_MCU_SEED ( | |
| 185 | #define VICTNINE_MCU_SEED (victnine_work | |
| 182 | 186 | |
| 183 | 187 | static const UINT8 victnine_mcu_data[0x100] = |
| 184 | 188 | { |
| r1478 | r1479 | |
| 245 | 249 | } |
| 246 | 250 | else if (data >= 0x38 && data <= 0x3a) |
| 247 | 251 | { |
| 248 | UINT8 *RAM = memory_region(REGION_CPU1); | |
| 249 | ||
| 250 | from_mcu = RAM[0xe691 - 0x38 + data]; | |
| 252 | from_mcu = victnine_workram[0x691 - 0x38 + data]; | |
| 251 | 253 | } |
| 252 | 254 | else |
| 253 | 255 | { |
| r1478 | r1479 | |
|---|---|---|
| 4 | 4 | |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | #include "mamecore.h" | |
| 7 | 8 | #include "driver.h" |
| 8 | 9 | #include "dc.h" |
| 9 | 10 | |
| 11 | #define DEBUG_REGISTERS (1) | |
| 12 | ||
| 13 | #if DEBUG_REGISTERS | |
| 14 | ||
| 15 | #define DEBUG_SYSCTRL (1) | |
| 16 | #define DEBUG_MAPLE (0) | |
| 17 | ||
| 18 | #if DEBUG_SYSCTRL | |
| 19 | static const char *sysctrl_names[] = | |
| 20 | { | |
| 21 | "CH2 DMA dest", | |
| 22 | "CH2 DMA length", | |
| 23 | "CH2 DMA start", | |
| 24 | "5f680c", | |
| 25 | "Sort DMA start link table addr", | |
| 26 | "Sort DMA link base addr", | |
| 27 | "Sort DMA link address bit width", | |
| 28 | "Sort DMA link address shift control", | |
| 29 | "Sort DMA start", | |
| 30 | "5f6824", "5f6828", "5f682c", "5f6830", | |
| 31 | "5f6834", "5f6838", "5f683c", | |
| 32 | "DBREQ # signal mask control", | |
| 33 | "BAVL # signal wait count", | |
| 34 | "DMA priority count", | |
| 35 | "CH2 DMA max burst length", | |
| 36 | "5f6850", "5f6854", "5f6858", "5f685c", | |
| 37 | "5f6860", "5f6864", "5f6868", "5f686c", | |
| 38 | "5f6870", "5f6874", "5f6878", "5f687c", | |
| 39 | "TA FIFO remaining", | |
| 40 | "TA texture memory bus select 0", | |
| 41 | "TA texture memory bus select 1", | |
| 42 | "FIFO status", | |
| 43 | "System reset", "5f6894", "5f6898", | |
| 44 | "System bus version", | |
| 45 | "SH4 root bus split enable", | |
| 46 | "5f68a4", "5f68a8", "5f68ac", | |
| 47 | "5f68b0", "5f68b4", "5f68b8", "5f68bc", | |
| 48 | "5f68c0", "5f68c4", "5f68c8", "5f68cc", | |
| 49 | "5f68d0", "5f68d4", "5f68d8", "5f68dc", | |
| 50 | "5f68e0", "5f68e4", "5f68e8", "5f68ec", | |
| 51 | "5f68f0", "5f68f4", "5f68f8", "5f68fc", | |
| 52 | "Normal IRQ status", | |
| 53 | "External IRQ status", | |
| 54 | "Error IRQ status", "5f690c", | |
| 55 | "Level 2 normal IRQ mask", | |
| 56 | "Level 2 external IRQ mask", | |
| 57 | "Level 2 error IRQ mask", "5f691c", | |
| 58 | "Level 4 normal IRQ mask", | |
| 59 | "Level 4 external IRQ mask", | |
| 60 | "Level 4 error IRQ mask", "5f692c", | |
| 61 | "Level 6 normal IRQ mask", | |
| 62 | "Level 6 external IRQ mask", | |
| 63 | "Level 6 error IRQ mask", "5f693c", | |
| 64 | "Normal IRQ PVR-DMA startup mask", | |
| 65 | "External IRQ PVR-DMA startup mask", | |
| 66 | "5f6948", "5f694c", | |
| 67 | "Normal IRQ G2-DMA startup mask", | |
| 68 | "External IRQ G2-DMA startup mask" | |
| 69 | }; | |
| 70 | #endif | |
| 71 | ||
| 72 | #if DEBUG_MAPLE | |
| 73 | static const char *maple_names[] = | |
| 74 | { | |
| 75 | "5f6c00", | |
| 76 | "DMA command table addr", | |
| 77 | "5f6c08", "5f6c0c", | |
| 78 | "DMA trigger select", | |
| 79 | "DMA enable", | |
| 80 | "DMA start", "5f6c1c", | |
| 81 | "5f6c20", "5f6c24", "5f6c28", "5f6c2c", | |
| 82 | "5f6c30", "5f6c34", "5f6c38", "5f6c3c", | |
| 83 | "5f6c40", "5f6c44", "5f6c48", "5f6c4c", | |
| 84 | "5f6c50", "5f6c54", "5f6c58", "5f6c5c", | |
| 85 | "5f6c60", "5f6c64", "5f6c68", "5f6c6c", | |
| 86 | "5f6c70", "5f6c74", "5f6c78", "5f6c7c", | |
| 87 | "System control", | |
| 88 | "Status", | |
| 89 | "DMA hard trigger clear", | |
| 90 | "DMA address range", | |
| 91 | "5f6c90", "5f6c94", "5f6c98", "5f6c9c", | |
| 92 | "5f6ca0", "5f6ca4", "5f6ca8", "5f6cac", | |
| 93 | "5f6cb0", "5f6cb4", "5f6cb8", "5f6cbc", | |
| 94 | "5f6cc0", "5f6cc4", "5f6cc8", "5f6ccc", | |
| 95 | "5f6cd0", "5f6cd4", "5f6cd8", "5f6cdc", | |
| 96 | "5f6ce0", "5f6ce4", | |
| 97 | "MSB select", "5f6cec", "5f6cf0", | |
| 98 | "Txd address counter", | |
| 99 | "Rxd address counter", | |
| 100 | "Rxd base address" | |
| 101 | ||
| 102 | }; | |
| 103 | #endif | |
| 104 | ||
| 105 | #endif | |
| 106 | ||
| 107 | // selected Maple registers | |
| 108 | enum | |
| 109 | { | |
| 110 | MAPLE_DMACMD = 1, | |
| 111 | MAPLE_DMATRIGGERSEL = 4, | |
| 112 | MAPLE_DMAENABLE = 5, | |
| 113 | MAPLE_DMASTART = 6, | |
| 114 | MAPLE_SYSCTRL = 0x20, | |
| 115 | MAPLE_STATUS = 0x21, | |
| 116 | }; | |
| 117 | ||
| 118 | static UINT32 sysctrl_regs[0x200/4]; | |
| 119 | static UINT32 maple_regs[0x100/4]; | |
| 120 | ||
| 121 | // register decode helper | |
| 122 | ||
| 123 | INLINE int decode_reg_64(UINT32 offset, UINT64 mem_mask, UINT64 *shift) | |
| 124 | { | |
| 125 | int reg = offset * 2; | |
| 126 | ||
| 127 | *shift = 0; | |
| 128 | ||
| 129 | if (mem_mask == U64(0x00000000ffffffff)) | |
| 130 | { | |
| 131 | reg++; | |
| 132 | *shift = 32; | |
| 133 | } | |
| 134 | ||
| 135 | return reg; | |
| 136 | } | |
| 137 | ||
| 138 | // I/O functions | |
| 139 | ||
| 10 | 140 | READ64_HANDLER( dc_sysctrl_r ) |
| 11 | 141 | { |
| 12 | return 0; | |
| 142 | int reg; | |
| 143 | UINT64 shift; | |
| 144 | ||
| 145 | reg = decode_reg_64(offset, mem_mask, &shift); | |
| 146 | ||
| 147 | #if DEBUG_SYSCTRL | |
| 148 | mame_printf_verbose("SYSCTRL: read %x @ %x (reg %x: %s), mask %llx (PC=%x)\n", sysctrl_regs[reg], offset, reg, sysctrl_names[reg], mem_mask, activecpu_get_pc()); | |
| 149 | #endif | |
| 150 | ||
| 151 | return (UINT64)sysctrl_regs[reg] << shift; | |
| 13 | 152 | } |
| 14 | 153 | |
| 15 | 154 | WRITE64_HANDLER( dc_sysctrl_w ) |
| 16 | 155 | { |
| 17 | mame_printf_verbose("SYSCTRL: write %llx to %x, mask %llx\n", data, offset, mem_mask); | |
| 156 | int reg; | |
| 157 | UINT64 shift; | |
| 158 | ||
| 159 | reg = decode_reg_64(offset, mem_mask, &shift); | |
| 160 | ||
| 161 | #if DEBUG_SYSCTRL | |
| 162 | mame_printf_verbose("SYSCTRL: write %llx to %x (reg %x: %s), mask %llx\n", data>>shift, offset, reg, sysctrl_names[reg], mem_mask); | |
| 163 | #endif | |
| 164 | ||
| 165 | sysctrl_regs[reg] |= data >> shift; | |
| 18 | 166 | } |
| 19 | 167 | |
| 20 | 168 | READ64_HANDLER( dc_maple_r ) |
| 21 | 169 | { |
| 22 | return 0; | |
| 170 | int reg; | |
| 171 | UINT64 shift; | |
| 172 | ||
| 173 | reg = decode_reg_64(offset, mem_mask, &shift); | |
| 174 | ||
| 175 | return (UINT64)maple_regs[reg] << shift; | |
| 23 | 176 | } |
| 24 | 177 | |
| 25 | 178 | WRITE64_HANDLER( dc_maple_w ) |
| 26 | 179 | { |
| 27 | mame_printf_verbose("MAPLE: write %llx to %x, mask %llx\n", data, offset, mem_mask); | |
| 180 | int reg; | |
| 181 | UINT64 shift; | |
| 182 | ||
| 183 | reg = decode_reg_64(offset, mem_mask, &shift); | |
| 184 | ||
| 185 | #if DEBUG_MAPLE | |
| 186 | mame_printf_verbose("MAPLE: write %llx to %x (reg %x: %s), mask %llx\n", data >> shift, offset, reg, maple_names[reg], mem_mask); | |
| 187 | #endif | |
| 188 | ||
| 189 | maple_regs[reg] |= data >> shift; | |
| 28 | 190 | } |
| 29 | 191 | |
| 30 | 192 | READ64_HANDLER( dc_gdrom_r ) |
| r1478 | r1479 | |
| 77 | 239 | mame_printf_verbose("RTC: write %llx to %x, mask %llx\n", data, offset, mem_mask); |
| 78 | 240 | } |
| 79 | 241 | |
| 80 | MACHINE_RESET( dc ) | |
| 81 | { | |
| 82 | /* halt the ARM7 */ | |
| 83 | cpunum_set_input_line(1, INPUT_LINE_RESET, ASSERT_LINE); | |
| 84 | } | |
| 85 | ||
| 86 | 242 | READ64_HANDLER( dc_aica_reg_r ) |
| 87 | 243 | { |
| 88 | 244 | return 0; |
| r1478 | r1479 | |
| 93 | 249 | mame_printf_verbose("AICA REG: write %llx to %x, mask %llx\n", data, offset, mem_mask); |
| 94 | 250 | } |
| 95 | 251 | |
| 252 | MACHINE_RESET( dc ) | |
| 253 | { | |
| 254 | /* halt the ARM7 */ | |
| 255 | cpunum_set_input_line(1, INPUT_LINE_RESET, ASSERT_LINE); | |
| 256 | ||
| 257 | memset(sysctrl_regs, 0, sizeof(sysctrl_regs)); | |
| 258 | memset(maple_regs, 0, sizeof(maple_regs)); | |
| 259 | ||
| 260 | sysctrl_regs[0x27] = 0x00000008; // Naomi BIOS requires at least this version | |
| 261 | } | |
| 262 | ||
| 263 | // called at vblank | |
| 264 | void dc_vblank( void ) | |
| 265 | { | |
| 266 | // is system control set for automatic polling on VBL? | |
| 267 | if ((maple_regs[MAPLE_SYSCTRL] & 0xffff0000) == 0x3a980000) | |
| 268 | { | |
| 269 | // is enabled? | |
| 270 | if (maple_regs[MAPLE_DMAENABLE] == 1) | |
| 271 | { | |
| 272 | // is started? | |
| 273 | if (maple_regs[MAPLE_DMASTART] == 1) | |
| 274 | { | |
| 275 | UINT32 cmd, dest, addr = maple_regs[MAPLE_DMACMD]; | |
| 276 | ||
| 277 | // process the command list | |
| 278 | // first word: bit 31 set = last command in list, 16-17 = port, 8-10 = pattern, 0-7 = xfer length | |
| 279 | // second word: destination address | |
| 280 | // third word: what to send to port A | |
| 281 | cmd = 0; | |
| 282 | while (!(cmd & 0x80000000)) | |
| 283 | { | |
| 284 | // read command word | |
| 285 | cmd = program_read_dword(addr); | |
| 286 | ||
| 287 | dest = program_read_dword(addr+4); | |
| 288 | ||
| 289 | // just indicate "no connection" for now | |
| 290 | program_write_dword(dest, 0); | |
| 291 | program_write_dword(dest+4, 0xffffffff); | |
| 292 | ||
| 293 | // skip fixed packet header | |
| 294 | addr += 8; | |
| 295 | // skip transfer data | |
| 296 | addr += ((cmd & 0xff) + 1) * 4; | |
| 297 | } | |
| 298 | ||
| 299 | ||
| 300 | #if DEBUG_MAPLE | |
| 301 | mame_printf_verbose("MAPLE: automatic read, table @ %x\n", addr); | |
| 302 | #endif | |
| 303 | ||
| 304 | // indicate transfer completed | |
| 305 | maple_regs[MAPLE_DMASTART] = 0; | |
| 306 | } | |
| 307 | } | |
| 308 | } | |
| 309 | } | |
| 310 |
| r1478 | r1479 | |
|---|---|---|
| 4 | 4 | |
| 5 | 5 | #define NAMCOS1_MAX_BANK 0x400 |
| 6 | 6 | |
| 7 | /* from drivers */ | |
| 8 | void namcos1_init_DACs(void); | |
| 9 | ||
| 7 | 10 | /* from video */ |
| 8 | 11 | READ8_HANDLER( namcos1_videoram_r ); |
| 9 | 12 | WRITE8_HANDLER( namcos1_videoram_w ); |
| r1478 | r1479 | |
| 570 | 573 | |
| 571 | 574 | static int mcu_patch_data; |
| 572 | 575 | static int namcos1_reset = 0; |
| 576 | static int wdog; | |
| 577 | static int chip[16]; | |
| 573 | 578 | |
| 574 | 579 | WRITE8_HANDLER( namcos1_cpu_control_w ) |
| 575 | 580 | { |
| r1478 | r1479 | |
| 589 | 594 | |
| 590 | 595 | WRITE8_HANDLER( namcos1_watchdog_w ) |
| 591 | 596 | { |
| 592 | static int wdog; | |
| 593 | ||
| 594 | 597 | wdog |= 1 << (cpu_getactivecpu()); |
| 595 | 598 | if (wdog == 7 || !namcos1_reset) |
| 596 | 599 | { |
| r1478 | r1479 | |
| 702 | 705 | |
| 703 | 706 | static void namcos1_bankswitch(int cpu, offs_t offset, UINT8 data) |
| 704 | 707 | { |
| 705 | static int chip[16]; | |
| 706 | 708 | int bank = (cpu*8) + (( offset >> 9) & 0x07); |
| 707 | 709 | |
| 708 | 710 | if (offset & 1) |
| r1478 | r1479 | |
| 865 | 867 | /* mcu patch data clear */ |
| 866 | 868 | mcu_patch_data = 0; |
| 867 | 869 | namcos1_reset = 0; |
| 870 | ||
| 871 | namcos1_init_DACs(); | |
| 872 | memset(key, 0, sizeof(key)); | |
| 873 | memset(chip, 0, sizeof(chip)); | |
| 874 | wdog = 0; | |
| 868 | 875 | } |
| 869 | 876 | |
| 870 | 877 | |
| r1478 | r1479 | |
| 949 | 956 | |
| 950 | 957 | static void namcos1_driver_init(const struct namcos1_specific *specific ) |
| 951 | 958 | { |
| 952 | const struct namcos1_specific no_key = | |
| 959 | static const struct namcos1_specific no_key = | |
| 953 | 960 | { |
| 954 | 961 | no_key_r,no_key_w |
| 955 | 962 | }; |
| r1478 | r1479 | |
| 998 | 1005 | *******************************************************************************/ |
| 999 | 1006 | DRIVER_INIT( dspirit ) |
| 1000 | 1007 | { |
| 1001 | const struct namcos1_specific dspirit_specific= | |
| 1008 | static const struct namcos1_specific dspirit_specific= | |
| 1002 | 1009 | { |
| 1003 | 1010 | key_type1_r,key_type1_w, 0x36 |
| 1004 | 1011 | }; |
| r1478 | r1479 | |
| 1010 | 1017 | *******************************************************************************/ |
| 1011 | 1018 | DRIVER_INIT( wldcourt ) |
| 1012 | 1019 | { |
| 1013 | const struct namcos1_specific worldcourt_specific= | |
| 1020 | static const struct namcos1_specific worldcourt_specific= | |
| 1014 | 1021 | { |
| 1015 | 1022 | key_type1_r,key_type1_w, 0x35 |
| 1016 | 1023 | }; |
| r1478 | r1479 | |
| 1022 | 1029 | *******************************************************************************/ |
| 1023 | 1030 | DRIVER_INIT( blazer ) |
| 1024 | 1031 | { |
| 1025 | const struct namcos1_specific blazer_specific= | |
| 1032 | static const struct namcos1_specific blazer_specific= | |
| 1026 | 1033 | { |
| 1027 | 1034 | key_type1_r,key_type1_w, 0x13 |
| 1028 | 1035 | }; |
| r1478 | r1479 | |
| 1034 | 1041 | *******************************************************************************/ |
| 1035 | 1042 | DRIVER_INIT( puzlclub ) |
| 1036 | 1043 | { |
| 1037 | const struct namcos1_specific puzlclub_specific= | |
| 1044 | static const struct namcos1_specific puzlclub_specific= | |
| 1038 | 1045 | { |
| 1039 | 1046 | key_type1_r,key_type1_w, 0x35 |
| 1040 | 1047 | }; |
| r1478 | r1479 | |
| 1046 | 1053 | *******************************************************************************/ |
| 1047 | 1054 | DRIVER_INIT( pacmania ) |
| 1048 | 1055 | { |
| 1049 | const struct namcos1_specific pacmania_specific= | |
| 1056 | static const struct namcos1_specific pacmania_specific= | |
| 1050 | 1057 | { |
| 1051 | 1058 | key_type2_r,key_type2_w, 0x12 |
| 1052 | 1059 | }; |
| r1478 | r1479 | |
| 1058 | 1065 | *******************************************************************************/ |
| 1059 | 1066 | DRIVER_INIT( alice ) |
| 1060 | 1067 | { |
| 1061 | const struct namcos1_specific alice_specific= | |
| 1068 | static const struct namcos1_specific alice_specific= | |
| 1062 | 1069 | { |
| 1063 | 1070 | key_type2_r,key_type2_w, 0x25 |
| 1064 | 1071 | }; |
| r1478 | r1479 | |
| 1070 | 1077 | *******************************************************************************/ |
| 1071 | 1078 | DRIVER_INIT( galaga88 ) |
| 1072 | 1079 | { |
| 1073 | const struct namcos1_specific galaga88_specific= | |
| 1080 | static const struct namcos1_specific galaga88_specific= | |
| 1074 | 1081 | { |
| 1075 | 1082 | key_type2_r,key_type2_w, 0x31 |
| 1076 | 1083 | }; |
| r1478 | r1479 | |
| 1082 | 1089 | *******************************************************************************/ |
| 1083 | 1090 | DRIVER_INIT( ws ) |
| 1084 | 1091 | { |
| 1085 | const struct namcos1_specific ws_specific= | |
| 1092 | static const struct namcos1_specific ws_specific= | |
| 1086 | 1093 | { |
| 1087 | 1094 | key_type2_r,key_type2_w, 0x07 |
| 1088 | 1095 | }; |
| r1478 | r1479 | |
| 1094 | 1101 | *******************************************************************************/ |
| 1095 | 1102 | DRIVER_INIT( bakutotu ) |
| 1096 | 1103 | { |
| 1097 | const struct namcos1_specific bakutotu_specific= | |
| 1104 | static const struct namcos1_specific bakutotu_specific= | |
| 1098 | 1105 | { |
| 1099 | 1106 | key_type2_r,key_type2_w, 0x22 |
| 1100 | 1107 | }; |
| r1478 | r1479 | |
| 1131 | 1138 | *******************************************************************************/ |
| 1132 | 1139 | DRIVER_INIT( splatter ) |
| 1133 | 1140 | { |
| 1134 | const struct namcos1_specific splatter_specific= | |
| 1141 | static const struct namcos1_specific splatter_specific= | |
| 1135 | 1142 | { |
| 1136 | 1143 | key_type3_r,key_type3_w, 181, 3, 4,-1,-1,-1,-1 |
| 1137 | 1144 | }; |
| r1478 | r1479 | |
| 1144 | 1151 | *******************************************************************************/ |
| 1145 | 1152 | DRIVER_INIT( rompers ) |
| 1146 | 1153 | { |
| 1147 | const struct namcos1_specific rompers_specific= | |
| 1154 | static const struct namcos1_specific rompers_specific= | |
| 1148 | 1155 | { |
| 1149 | 1156 | key_type3_r,key_type3_w, 182, 7,-1,-1,-1,-1,-1 |
| 1150 | 1157 | }; |
| r1478 | r1479 | |
| 1156 | 1163 | *******************************************************************************/ |
| 1157 | 1164 | DRIVER_INIT( blastoff ) |
| 1158 | 1165 | { |
| 1159 | const struct namcos1_specific blastoff_specific= | |
| 1166 | static const struct namcos1_specific blastoff_specific= | |
| 1160 | 1167 | { |
| 1161 | 1168 | key_type3_r,key_type3_w, 183, 0, 7, 3, 5,-1,-1 |
| 1162 | 1169 | }; |
| r1478 | r1479 | |
| 1168 | 1175 | *******************************************************************************/ |
| 1169 | 1176 | DRIVER_INIT( ws89 ) |
| 1170 | 1177 | { |
| 1171 | const struct namcos1_specific ws89_specific= | |
| 1178 | static const struct namcos1_specific ws89_specific= | |
| 1172 | 1179 | { |
| 1173 | 1180 | key_type3_r,key_type3_w, 184, 2,-1,-1,-1,-1,-1 |
| 1174 | 1181 | }; |
| r1478 | r1479 | |
| 1180 | 1187 | *******************************************************************************/ |
| 1181 | 1188 | DRIVER_INIT( tankfrce ) |
| 1182 | 1189 | { |
| 1183 | const struct namcos1_specific tankfrce_specific= | |
| 1190 | static const struct namcos1_specific tankfrce_specific= | |
| 1184 | 1191 | { |
| 1185 | 1192 | key_type3_r,key_type3_w, 185, 5,-1, 1,-1, 2,-1 |
| 1186 | 1193 | }; |
| r1478 | r1479 | |
| 1192 | 1199 | *******************************************************************************/ |
| 1193 | 1200 | DRIVER_INIT( dangseed ) |
| 1194 | 1201 | { |
| 1195 | const struct namcos1_specific dangseed_specific= | |
| 1202 | static const struct namcos1_specific dangseed_specific= | |
| 1196 | 1203 | { |
| 1197 | 1204 | key_type3_r,key_type3_w, 308, 6,-1, 5,-1, 0, 4 |
| 1198 | 1205 | }; |
| r1478 | r1479 | |
| 1204 | 1211 | *******************************************************************************/ |
| 1205 | 1212 | DRIVER_INIT( pistoldm ) |
| 1206 | 1213 | { |
| 1207 | const struct namcos1_specific pistoldm_specific= | |
| 1214 | static const struct namcos1_specific pistoldm_specific= | |
| 1208 | 1215 | { |
| 1209 | 1216 | key_type3_r,key_type3_w, 309, 1, 2, 0,-1, 4,-1 |
| 1210 | 1217 | }; |
| r1478 | r1479 | |
| 1216 | 1223 | *******************************************************************************/ |
| 1217 | 1224 | DRIVER_INIT( ws90 ) |
| 1218 | 1225 | { |
| 1219 | const struct namcos1_specific ws90_specific= | |
| 1226 | static const struct namcos1_specific ws90_specific= | |
| 1220 | 1227 | { |
| 1221 | 1228 | key_type3_r,key_type3_w, 310, 4,-1, 7,-1, 3,-1 |
| 1222 | 1229 | }; |
| r1478 | r1479 | |
| 1228 | 1235 | *******************************************************************************/ |
| 1229 | 1236 | DRIVER_INIT( soukobdx ) |
| 1230 | 1237 | { |
| 1231 | const struct namcos1_specific soukobdx_specific= | |
| 1238 | static const struct namcos1_specific soukobdx_specific= | |
| 1232 | 1239 | { |
| 1233 | 1240 | key_type3_r,key_type3_w, 311, 2, 3/*?*/, 0,-1, 4,-1 |
| 1234 | 1241 | }; |
| r1478 | r1479 | |
|---|---|---|
| 43 | 43 | static emu_timer *snes_hirq_timer; |
| 44 | 44 | static UINT16 hblank_offset; |
| 45 | 45 | static UINT16 snes_htmult; /* in 512 wide, we run HTOTAL double and halve it on latching */ |
| 46 | static UINT8 has_dsp1; | |
| 46 | 47 | |
| 47 | 48 | // full graphic variables |
| 48 | 49 | static UINT16 vram_fgr_high, vram_fgr_increment, vram_fgr_count, vram_fgr_mask, vram_fgr_shift, vram_read_buffer; |
| r1478 | r1479 | |
| 279 | 280 | { |
| 280 | 281 | int i; |
| 281 | 282 | |
| 282 | /* Init DSP1 interface */ | |
| 283 | InitDSP1(); | |
| 283 | /* Init DSP1 */ | |
| 284 | DSP1_reset(); | |
| 284 | 285 | |
| 285 | 286 | /* Init VRAM */ |
| 286 | 287 | memset( snes_vram, 0, SNES_VRAM_SIZE ); |
| r1478 | r1479 | |
| 436 | 437 | { |
| 437 | 438 | if ((address >= 0x8000) && (offset >= 0x200000)) |
| 438 | 439 | { |
| 439 | return dsp1_read(address); | |
| 440 | if (address >= 0xc000) | |
| 441 | return DSP1_getSr(); | |
| 442 | else | |
| 443 | return DSP1_getDr(); | |
| 440 | 444 | } |
| 441 | 445 | } |
| 442 | 446 | |
| 443 | 447 | if( address <= 0x1fff ) /* Mirror of Low RAM */ |
| 448 | { | |
| 444 | 449 | return program_read_byte(0x7e0000 + address ); |
| 450 | } | |
| 445 | 451 | else if( address >= 0x2000 && address <= 0x5fff ) /* I/O */ |
| 452 | { | |
| 446 | 453 | return snes_r_io( address ); |
| 454 | } | |
| 447 | 455 | else if( address >= 0x6000 && address <= 0x7fff ) /* Reserved */ |
| 448 | 456 | { |
| 449 | 457 | if( snes_cart.mode == SNES_MODE_20 ) |
| 450 | return 0xff; | |
| 451 | else | |
| 452 | return dsp1_read(address); | |
| 458 | { | |
| 459 | return 0xff; | |
| 460 | } | |
| 461 | else | |
| 462 | { | |
| 463 | if (address >= 0x7000) | |
| 464 | return DSP1_getSr(); | |
| 465 | else | |
| 466 | return DSP1_getDr(); | |
| 467 | } | |
| 453 | 468 | } |
| 454 | 469 | else |
| 455 | 470 | { |
| 456 | 471 | if( snes_cart.mode == SNES_MODE_20 ) |
| 472 | { | |
| 457 | 473 | return snes_ram[offset]; |
| 474 | } | |
| 458 | 475 | else /* MODE_21 */ |
| 476 | { | |
| 459 | 477 | return snes_ram[0xc00000 + offset]; |
| 478 | } | |
| 460 | 479 | } |
| 461 | 480 | |
| 462 | 481 | return 0xff; |
| r1478 | r1479 | |
| 471 | 490 | { |
| 472 | 491 | if (address >= 0x8000) |
| 473 | 492 | { |
| 474 | return dsp1_read(address); | |
| 493 | if (address >= 0xc000) | |
| 494 | return DSP1_getSr(); | |
| 495 | else | |
| 496 | return DSP1_getDr(); | |
| 475 | 497 | } |
| 476 | 498 | } |
| 477 | 499 | |
| r1478 | r1479 | |
| 482 | 504 | else if( address >= 0x6000 && address <= 0x7fff ) |
| 483 | 505 | { |
| 484 | 506 | if( snes_cart.mode == SNES_MODE_20 ) |
| 507 | { | |
| 485 | 508 | return 0xff; /* Reserved */ |
| 509 | } | |
| 486 | 510 | else /* MODE_21 */ |
| 487 | 511 | { |
| 488 | 512 | int mask; |
| r1478 | r1479 | |
| 533 | 557 | |
| 534 | 558 | if (address < 0x8000) |
| 535 | 559 | { |
| 536 | return dsp1_read(address); | |
| 560 | if (address >= 0x4000) | |
| 561 | return DSP1_getSr(); | |
| 562 | else | |
| 563 | return DSP1_getDr(); | |
| 537 | 564 | } |
| 538 | 565 | |
| 539 | 566 | return 0xff; |
| r1478 | r1479 | |
| 567 | 594 | |
| 568 | 595 | if ((address >= 0x8000) && (offset >= 0x200000)) |
| 569 | 596 | { |
| 570 | | |
| 597 | DSP1_s | |
| 571 | 598 | return; |
| 572 | 599 | } |
| 573 | 600 | |
| r1478 | r1479 | |
| 580 | 607 | logerror( "Attempt to write to reserved address: %X\n", offset ); |
| 581 | 608 | else |
| 582 | 609 | { |
| 583 | | |
| 610 | DSP1_s | |
| 584 | 611 | return; |
| 585 | 612 | } |
| 586 | 613 | else |
| r1478 | r1479 | |
| 594 | 621 | |
| 595 | 622 | if (address >= 0x8000) |
| 596 | 623 | { |
| 597 | | |
| 624 | DSP1_s | |
| 598 | 625 | return; |
| 599 | 626 | } |
| 600 | 627 | |
| r1478 | r1479 | |
| 629 | 656 | |
| 630 | 657 | if (address < 0x8000) |
| 631 | 658 | { |
| 632 | | |
| 659 | DSP1_s | |
| 633 | 660 | return; |
| 634 | 661 | } |
| 635 | 662 | } |
| r1478 | r1479 | |
|---|---|---|
| 12 | 12 | |
| 13 | 13 | #define VERBOSE_LEVEL ( 0 ) |
| 14 | 14 | |
| 15 | INLINE void verboselog( int n_level, const char *s_fmt, ... ) | |
| 15 | INLINE void ATTR_PRINTF(2,3) verboselog( int n_level, const char *s_fmt, ... ) | |
| 16 | 16 | { |
| 17 | 17 | if( VERBOSE_LEVEL >= n_level ) |
| 18 | 18 | { |
| r1478 | r1479 | |
| 532 | 532 | memset( &c->read_buffer[ 0 ], 0xff, 2 ); |
| 533 | 533 | } |
| 534 | 534 | |
| 535 | verboselog( 1, "zs01(%d) <- status: %02x%02\n", chip, | |
| 535 | verboselog( 1, "zs01(%d) <- status: %02x%02x\n", chip, | |
| 536 | 536 | c->read_buffer[ 0 ], c->read_buffer[ 1 ] ); |
| 537 | 537 | |
| 538 | 538 | verboselog( 1, "zs01(%d) <- data: %02x%02x%02x%02x%02x%02x%02x%02x\n", chip, |
| r1478 | r1479 | |
|---|---|---|
| 701 | 701 | return deco16_prot_ram[0x104>>1]; |
| 702 | 702 | case 0x3a8 >> 1: /* See 93e4/9376 */ |
| 703 | 703 | return deco16_prot_ram[0x500>>1]; |
| 704 | case 0x3e8 >> 1: | |
| 704 | ||
| 705 | // The top byte of 0x50c is used as a bitmask of completed levels, | |
| 706 | // checked at end of each (0x0100 = level 1 completed, | |
| 707 | // 0x3000 = levels 5 & 6 completed, 0x3f00 = levels 1-6 completed, etc) | |
| 708 | case 0x56c >> 1: | |
| 705 | 709 | return deco16_prot_ram[0x50c>>1]; |
| 706 | 710 | |
| 711 | // The game compares $ffc0 to check for all 6 basic levels | |
| 712 | // being completed. (which is 0x3f00 inverted and shifted) | |
| 713 | // If wrong value is returned here the level select screen is | |
| 714 | // incorrectly shown and leads to a crash as that screen | |
| 715 | // cannot cope with all levels being already completed. | |
| 716 | case 0x3e8 >> 1: | |
| 717 | return (deco16_prot_ram[0x50c>>1] >> 8) ^ 0xffff; | |
| 718 | ||
| 707 | 719 | case 0x4e4 >> 1: |
| 708 | 720 | return deco16_prot_ram[0x702>>1]; |
| 709 | 721 | case 0x562 >> 1: |
| 710 | 722 | return deco16_prot_ram[0x18e>>1]; |
| 711 | case 0x56c >> 1: | |
| 712 | return deco16_prot_ram[0x50c>>1]; | |
| 713 | 723 | |
| 714 | 724 | case 0x688 >> 1: |
| 715 | 725 | return deco16_prot_ram[0x300>>1]; |
| r1478 | r1479 | |
| 737 | 747 | return (readinputport(3) + (readinputport(4) << 8)); |
| 738 | 748 | } |
| 739 | 749 | |
| 740 | if (activecpu_get_pc()!=0xc0ea) logerror("CPU #0 PC %06x: warning - read unmapped control address %06x\n",activecpu_get_pc(),offset<<1); | |
| 750 | if (activecpu_get_pc()!=0xc0ea) | |
| 751 | logerror("CPU #0 PC %06x: warning - read unmapped control address %06x (ctrl %04x)\n",activecpu_get_pc(),offset<<1, readinputport(0)); | |
| 741 | 752 | |
| 742 | 753 | return 0; |
| 743 | 754 | } |
| r1478 | r1479 | |
|---|---|---|
| 4 | 4 | |
| 5 | 5 | File to handle emulation of the SNES "DSP-1" add-on chip. |
| 6 | 6 | |
| 7 | R. Belmont | |
| 8 | Code from http://users.tpg.com.au/trauma/dsp/dsp1.html | |
| 9 | By The Dumper (Electrical Engineering), Neviksti (Physics), Overload (Computer Science), Andreas Naive (Mathematics) | |
| 7 | Original C++ "dsp1emul.cpp" by Andreas Naive | |
| 8 | Based on research by Overload, The Dumper, Neviksti and Andreas Naive | |
| 9 | MAME/MESS C conversion by R. Belmont | |
| 10 | 10 | |
| 11 | This is up to date with the source version | |
| 11 | This is up to date with the source version d | |
| 12 | 12 | |
| 13 | 13 | ***************************************************************************/ |
| 14 | 14 | |
| 15 | static INT16 dsp1_waitcmd, dsp1_in_cnt, dsp1_out_cnt, dsp1_in_idx, dsp1_out_idx, dsp1_first_parm, dsp1_cur_cmd; | |
| 16 | static int has_dsp1; | |
| 17 | static UINT8 dsp1_in[32], dsp1_out[16]; | |
| 18 | ||
| 19 | 15 | #define DSP1_VERSION 0x0102 |
| 20 | 16 | |
| 21 | // 1FH - Memory Dump (DSP1B Data ROM) | |
| 22 | // Input byte(1FH) integer(Undefined) | |
| 23 | // Output integer[1024] | |
| 17 | // The DSP-1 status register has 16 bits, but only | |
| 18 | // the upper 8 bits can be accessed from an external device, so all these | |
| 19 | // positions are referred to the upper byte (bits D8 to D15) | |
| 24 | 20 | |
| 25 | ||
| 21 | enum SrFlags | |
| 26 | 22 | |
| 27 | // Command Translation Table | |
| 23 | // According to Overload's docs, these are the meanings of the flags: | |
| 24 | // DRC: The Data Register Control (DRC) bit specifies the data transfer length to and from the host CPU. | |
| 25 | // 0: Data transfer to and from the DSP-1 is 16 bits. | |
| 26 | // 1: Data transfer to and from the DSP-1 is 8 bits. | |
| 27 | // DRS: The Data Register Status (DRS) bit indicates the data transfer status in the case of transfering 16-bit data. | |
| 28 | // 0: Data transfer has terminated. | |
| 29 | // 1: Data transfer in progress. | |
| 30 | // RQM: The Request for Master (RQM) indicates that the DSP1 is requesting host CPU for data read/write. | |
| 31 | // 0: Internal Data Register Transfer. | |
| 32 | // 1: External Data Register Transfer. | |
| 28 | 33 | |
| 29 | static const INT16 DSP1_CmdTable[64] = { | |
| 30 | 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0001, 0x0006, 0x000f, | |
| 31 | 0x0008, 0x000d, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, | |
| 32 | 0x0010, 0x0011, 0x0002, 0x0013, 0x0014, 0x0011, 0x0006, 0x001f, | |
| 33 | 0x0018, 0x001d, 0x001a, 0x001b, 0x001c, 0x001d, 0x000e, 0x001f, | |
| 34 | 0x0020, 0x0021, 0x0002, 0x0023, 0x0004, 0x0021, 0x0006, 0x002f, | |
| 35 | 0x0028, 0x002d, 0x001a, 0x002b, 0x000c, 0x002d, 0x000e, 0x002f, | |
| 36 | 0x0010, 0x0001, 0x0002, 0x0003, 0x0014, 0x0001, 0x0006, 0x001f, | |
| 37 | 0x0038, 0x000d, 0x001a, 0x000b, 0x001c, 0x000d, 0x000e, 0x001f}; | |
| 34 | enum FsmMajorState {WAIT_COMMAND, READ_DATA, WRITE_DATA}; | |
| 35 | enum MaxDataAccesses {MAX_READS=7, MAX_WRITES=1024}; | |
| 38 | 36 | |
| 39 | // Optimised for Performance | |
| 37 | struct DSP1_Command { | |
| 38 | void (*callback)(INT16 *, INT16 *); | |
| 39 | unsigned int reads; | |
| 40 | unsigned int writes; | |
| 41 | }; | |
| 40 | 42 | |
| 41 | static const INT16 DSP1_MulTable[256] = { | |
| 42 | 0x0000, 0x0003, 0x0006, 0x0009, 0x000c, 0x000f, 0x0012, 0x0015, | |
| 43 | 0x0019, 0x001c, 0x001f, 0x0022, 0x0025, 0x0028, 0x002b, 0x002f, | |
| 44 | 0x0032, 0x0035, 0x0038, 0x003b, 0x003e, 0x0041, 0x0045, 0x0048, | |
| 45 | 0x004b, 0x004e, 0x0051, 0x0054, 0x0057, 0x005b, 0x005e, 0x0061, | |
| 46 | 0x0064, 0x0067, 0x006a, 0x006d, 0x0071, 0x0074, 0x0077, 0x007a, | |
| 47 | 0x007d, 0x0080, 0x0083, 0x0087, 0x008a, 0x008d, 0x0090, 0x0093, | |
| 48 | 0x0096, 0x0099, 0x009d, 0x00a0, 0x00a3, 0x00a6, 0x00a9, 0x00ac, | |
| 49 | 0x00af, 0x00b3, 0x00b6, 0x00b9, 0x00bc, 0x00bf, 0x00c2, 0x00c5, | |
| 50 | 0x00c9, 0x00cc, 0x00cf, 0x00d2, 0x00d5, 0x00d8, 0x00db, 0x00df, | |
| 51 | 0x00e2, 0x00e5, 0x00e8, 0x00eb, 0x00ee, 0x00f1, 0x00f5, 0x00f8, | |
| 52 | 0x00fb, 0x00fe, 0x0101, 0x0104, 0x0107, 0x010b, 0x010e, 0x0111, | |
| 53 | 0x0114, 0x0117, 0x011a, 0x011d, 0x0121, 0x0124, 0x0127, 0x012a, | |
| 54 | 0x012d, 0x0130, 0x0133, 0x0137, 0x013a, 0x013d, 0x0140, 0x0143, | |
| 55 | 0x0146, 0x0149, 0x014d, 0x0150, 0x0153, 0x0156, 0x0159, 0x015c, | |
| 56 | 0x015f, 0x0163, 0x0166, 0x0169, 0x016c, 0x016f, 0x0172, 0x0175, | |
| 57 | 0x0178, 0x017c, 0x017f, 0x0182, 0x0185, 0x0188, 0x018b, 0x018e, | |
| 58 | 0x0192, 0x0195, 0x0198, 0x019b, 0x019e, 0x01a1, 0x01a4, 0x01a8, | |
| 59 | 0x01ab, 0x01ae, 0x01b1, 0x01b4, 0x01b7, 0x01ba, 0x01be, 0x01c1, | |
| 60 | 0x01c4, 0x01c7, 0x01ca, 0x01cd, 0x01d0, 0x01d4, 0x01d7, 0x01da, | |
| 61 | 0x01dd, 0x01e0, 0x01e3, 0x01e6, 0x01ea, 0x01ed, 0x01f0, 0x01f3, | |
| 62 | 0x01f6, 0x01f9, 0x01fc, 0x0200, 0x0203, 0x0206, 0x0209, 0x020c, | |
| 63 | 0x020f, 0x0212, 0x0216, 0x0219, 0x021c, 0x021f, 0x0222, 0x0225, | |
| 64 | 0x0228, 0x022c, 0x022f, 0x0232, 0x0235, 0x0238, 0x023b, 0x023e, | |
| 65 | 0x0242, 0x0245, 0x0248, 0x024b, 0x024e, 0x0251, 0x0254, 0x0258, | |
| 66 | 0x025b, 0x025e, 0x0261, 0x0264, 0x0267, 0x026a, 0x026e, 0x0271, | |
| 67 | 0x0274, 0x0277, 0x027a, 0x027d, 0x0280, 0x0284, 0x0287, 0x028a, | |
| 68 | 0x028d, 0x0290, 0x0293, 0x0296, 0x029a, 0x029d, 0x02a0, 0x02a3, | |
| 69 | 0x02a6, 0x02a9, 0x02ac, 0x02b0, 0x02b3, 0x02b6, 0x02b9, 0x02bc, | |
| 70 | 0x02bf, 0x02c2, 0x02c6, 0x02c9, 0x02cc, 0x02cf, 0x02d2, 0x02d5, | |
| 71 | 0x02d8, 0x02db, 0x02df, 0x02e2, 0x02e5, 0x02e8, 0x02eb, 0x02ee, | |
| 72 | 0x02f1, 0x02f5, 0x02f8, 0x02fb, 0x02fe, 0x0301, 0x0304, 0x0307, | |
| 73 | 0x030b, 0x030e, 0x0311, 0x0314, 0x0317, 0x031a, 0x031d, 0x0321}; | |
| 43 | static const struct DSP1_Command mCommandTable[0x40]; | |
| 44 | static const INT16 DSP1_MaxAZS_Exp[16]; | |
| 45 | static const INT16 DSP1_SinTable[256]; | |
| 46 | static const INT16 DSP1_MulTable[256]; | |
| 47 | static UINT16 DSP1_DataRom[1024]; | |
| 74 | 48 | |
| 75 | static const INT16 DSP1_SinTable[256] = { | |
| 76 | 0x0000, 0x0324, 0x0647, 0x096a, 0x0c8b, 0x0fab, 0x12c8, 0x15e2, | |
| 77 | 0x18f8, 0x1c0b, 0x1f19, 0x2223, 0x2528, 0x2826, 0x2b1f, 0x2e11, | |
| 78 | 0x30fb, 0x33de, 0x36ba, 0x398c, 0x3c56, 0x3f17, 0x41ce, 0x447a, | |
| 79 | 0x471c, 0x49b4, 0x4c3f, 0x4ebf, 0x5133, 0x539b, 0x55f5, 0x5842, | |
| 80 | 0x5a82, 0x5cb4, 0x5ed7, 0x60ec, 0x62f2, 0x64e8, 0x66cf, 0x68a6, | |
| 81 | 0x6a6d, 0x6c24, 0x6dca, 0x6f5f, 0x70e2, 0x7255, 0x73b5, 0x7504, | |
| 82 | 0x7641, 0x776c, 0x7884, 0x798a, 0x7a7d, 0x7b5d, 0x7c29, 0x7ce3, | |
| 83 | 0x7d8a, 0x7e1d, 0x7e9d, 0x7f09, 0x7f62, 0x7fa7, 0x7fd8, 0x7ff6, | |
| 84 | 0x7fff, 0x7ff6, 0x7fd8, 0x7fa7, 0x7f62, 0x7f09, 0x7e9d, 0x7e1d, | |
| 85 | 0x7d8a, 0x7ce3, 0x7c29, 0x7b5d, 0x7a7d, 0x798a, 0x7884, 0x776c, | |
| 86 | 0x7641, 0x7504, 0x73b5, 0x7255, 0x70e2, 0x6f5f, 0x6dca, 0x6c24, | |
| 87 | 0x6a6d, 0x68a6, 0x66cf, 0x64e8, 0x62f2, 0x60ec, 0x5ed7, 0x5cb4, | |
| 88 | 0x5a82, 0x5842, 0x55f5, 0x539b, 0x5133, 0x4ebf, 0x4c3f, 0x49b4, | |
| 89 | 0x471c, 0x447a, 0x41ce, 0x3f17, 0x3c56, 0x398c, 0x36ba, 0x33de, | |
| 90 | 0x30fb, 0x2e11, 0x2b1f, 0x2826, 0x2528, 0x2223, 0x1f19, 0x1c0b, | |
| 91 | 0x18f8, 0x15e2, 0x12c8, 0x0fab, 0x0c8b, 0x096a, 0x0647, 0x0324, | |
| 92 | -0x0000, -0x0324, -0x0647, -0x096a, -0x0c8b, -0x0fab, -0x12c8, -0x15e2, | |
| 93 | -0x18f8, -0x1c0b, -0x1f19, -0x2223, -0x2528, -0x2826, -0x2b1f, -0x2e11, | |
| 94 | -0x30fb, -0x33de, -0x36ba, -0x398c, -0x3c56, -0x3f17, -0x41ce, -0x447a, | |
| 95 | -0x471c, -0x49b4, -0x4c3f, -0x4ebf, -0x5133, -0x539b, -0x55f5, -0x5842, | |
| 96 | -0x5a82, -0x5cb4, -0x5ed7, -0x60ec, -0x62f2, -0x64e8, -0x66cf, -0x68a6, | |
| 97 | -0x6a6d, -0x6c24, -0x6dca, -0x6f5f, -0x70e2, -0x7255, -0x73b5, -0x7504, | |
| 98 | -0x7641, -0x776c, -0x7884, -0x798a, -0x7a7d, -0x7b5d, -0x7c29, -0x7ce3, | |
| 99 | -0x7d8a, -0x7e1d, -0x7e9d, -0x7f09, -0x7f62, -0x7fa7, -0x7fd8, -0x7ff6, | |
| 100 | -0x7fff, -0x7ff6, -0x7fd8, -0x7fa7, -0x7f62, -0x7f09, -0x7e9d, -0x7e1d, | |
| 101 | -0x7d8a, -0x7ce3, -0x7c29, -0x7b5d, -0x7a7d, -0x798a, -0x7884, -0x776c, | |
| 102 | -0x7641, -0x7504, -0x73b5, -0x7255, -0x70e2, -0x6f5f, -0x6dca, -0x6c24, | |
| 103 | -0x6a6d, -0x68a6, -0x66cf, -0x64e8, -0x62f2, -0x60ec, -0x5ed7, -0x5cb4, | |
| 104 | -0x5a82, -0x5842, -0x55f5, -0x539b, -0x5133, -0x4ebf, -0x4c3f, -0x49b4, | |
| 105 | -0x471c, -0x447a, -0x41ce, -0x3f17, -0x3c56, -0x398c, -0x36ba, -0x33de, | |
| 106 | -0x30fb, -0x2e11, -0x2b1f, -0x2826, -0x2528, -0x2223, -0x1f19, -0x1c0b, | |
| 107 | -0x18f8, -0x15e2, -0x12c8, -0x0fab, -0x0c8b, -0x096a, -0x0647, -0x0324 | |
| 108 | }; | |
| 49 | static struct SharedData { // some RAM variables shared between commands | |
| 50 | INT16 MatrixA[3][3]; // attitude matrix A | |
| 51 | INT16 MatrixB[3][3]; | |
| 52 | INT16 MatrixC[3][3]; | |
| 53 | INT16 CentreX, CentreY, CentreZ; // center of projection | |
| 54 | INT16 CentreZ_C, CentreZ_E; | |
| 55 | INT16 VOffset; // vertical offset of the screen with regard to the centre of projection | |
| 56 | INT16 Les, C_Les, E_Les; | |
| 57 | INT16 SinAas, CosAas; | |
| 58 | INT16 SinAzs, CosAzs; | |
| 59 | INT16 SinAZS, CosAZS; | |
| 60 | INT16 SecAZS_C1, SecAZS_E1; | |
| 61 | INT16 SecAZS_C2, SecAZS_E2; | |
| 62 | INT16 Nx, Ny, Nz; // normal vector to the screen (norm 1, points toward the center of projection) | |
| 63 | INT16 Gx, Gy, Gz; // center of the screen (global coordinates) | |
| 64 | INT16 Hx, Hy; // horizontal vector of the screen (Hz=0, norm 1, points toward the right of the screen) | |
| 65 | INT16 Vx, Vy, Vz; // vertical vector of the screen (norm 1, points toward the top of the screen) | |
| 109 | 66 | |
| 110 | #define INCR 2048 | |
| 111 | static double CosTable2[INCR]; | |
| 112 | static double SinTable2[INCR]; | |
| 67 | } shared; | |
| 113 | 68 | |
| 114 | #define Angle(x) (((x)/(65536/INCR)) & (INCR-1)) | |
| 115 | #define Cos(x) ((double) CosTable2[x]) | |
| 116 | #define Sin(x) ((double) SinTable2[x]) | |
| 69 | static UINT8 mSr; // status register | |
| 70 | static int mSrLowByteAccess; | |
| 71 | static UINT16 mDr; // "internal" representation of the data register | |
| 72 | static enum FsmMajorState mFsmMajorState; // current major state of the FSM | |
| 73 | static UINT8 mCommand; // current command processed by the FSM | |
| 74 | static UINT8 mDataCounter; // #UINT16 read/writes counter used by the FSM | |
| 75 | static INT16 mReadBuffer[MAX_READS]; | |
| 76 | static INT16 mWriteBuffer[MAX_WRITES]; | |
| 77 | static UINT8 mFreeze; // need explanation? ;) | |
| 117 | 78 | |
| 118 | // init DSP1 math tables | |
| 119 | static void InitDSP1(void) | |
| 79 | static void DSP1_fsmStep(UINT8 read, UINT8 *data); // FSM logic | |
| 80 | ||
| 81 | // commands | |
| 82 | static void DSP1_memoryTest(INT16 *input, INT16 *output); | |
| 83 | static void DSP1_memoryDump(INT16 *input, INT16 *output); | |
| 84 | static void DSP1_memorySize(INT16 *input, INT16 *output); | |
| 85 | static void DSP1_multiply(INT16* input, INT16* output); | |
| 86 | static void DSP1_multiply2(INT16* input, INT16* output); | |
| 87 | static void DSP1_inverse(INT16 *input, INT16 *output); | |
| 88 | static void DSP1_triangle(INT16 *input, INT16 *output); | |
| 89 | static void DSP1_radius(INT16 *input, INT16 *output); | |
| 90 | static void DSP1_range(INT16 *input, INT16 *output); | |
| 91 | static void DSP1_range2(INT16 *input, INT16 *output); | |
| 92 | static void DSP1_distance(INT16 *input, INT16 *output); | |
| 93 | static void DSP1_rotate(INT16 *input, INT16 *output); | |
| 94 | static void DSP1_polar(INT16 *input, INT16 *output); | |
| 95 | static void DSP1_attitudeA(INT16 *input, INT16 *output); | |
| 96 | static void DSP1_attitudeB(INT16 *input, INT16 *output); | |
| 97 | static void DSP1_attitudeC(INT16 *input, INT16 *output); | |
| 98 | static void DSP1_objectiveA(INT16 *input, INT16 *output); | |
| 99 | static void DSP1_objectiveB(INT16 *input, INT16 *output); | |
| 100 | static void DSP1_objectiveC(INT16 *input, INT16 *output); | |
| 101 | static void DSP1_subjectiveA(INT16 *input, INT16 *output); | |
| 102 | static void DSP1_subjectiveB(INT16 *input, INT16 *output); | |
| 103 | static void DSP1_subjectiveC(INT16 *input, INT16 *output); | |
| 104 | static void DSP1_scalarA(INT16 *input, INT16 *output); | |
| 105 | static void DSP1_scalarB(INT16 *input, INT16 *output); | |
| 106 | static void DSP1_scalarC(INT16 *input, INT16 *output); | |
| 107 | static void DSP1_gyrate(INT16 *input, INT16 *output); | |
| 108 | static void DSP1_parameter(INT16 *input, INT16 *output); | |
| 109 | static void DSP1_raster(INT16 *input, INT16 *output); | |
| 110 | static void DSP1_target(INT16 *input, INT16 *output); | |
| 111 | static void DSP1_project(INT16 *input, INT16 *output); | |
| 112 | ||
| 113 | // auxiliar functions | |
| 114 | static INT16 DSP1_sin(INT16 Angle); | |
| 115 | static INT16 DSP1_cos(INT16 Angle); | |
| 116 | static void inverse(INT16 Coefficient, INT16 Exponent, INT16 *iCoefficient, INT16 *iExponent); | |
| 117 | static INT16 denormalizeAndClip(INT16 C, INT16 E); | |
| 118 | static void normalize(INT16 m, INT16 *Coefficient, INT16 *Exponent); | |
| 119 | static void normalizeDouble(INT32 Product, INT16 *Coefficient, INT16 *Exponent); | |
| 120 | static INT16 shiftR(INT16 C, INT16 E); | |
| 121 | ||
| 122 | ////////////////////////////////////////////////////////////////// | |
| 123 | ||
| 124 | UINT8 DSP1_getSr(void) | |
| 120 | 125 | { |
| 126 | mSrLowByteAccess = ~mSrLowByteAccess; | |
| 127 | if (mSrLowByteAccess) | |
| 128 | { | |
| 129 | return 0; | |
| 130 | } | |
| 131 | else | |
| 132 | { | |
| 133 | return mSr; | |
| 134 | } | |
| 135 | } | |
| 136 | ||
| 137 | ////////////////////////////////////////////////////////////////// | |
| 138 | ||
| 139 | UINT8 DSP1_getDr(void) | |
| 140 | { | |
| 141 | UINT8 oDr; | |
| 142 | ||
| 143 | DSP1_fsmStep(1, &oDr); | |
| 144 | return oDr; | |
| 145 | } | |
| 146 | ||
| 147 | ////////////////////////////////////////////////////////////////// | |
| 148 | ||
| 149 | void DSP1_setDr(UINT8 iDr) | |
| 150 | { | |
| 151 | DSP1_fsmStep(0, &iDr); | |
| 152 | } | |
| 153 | ||
| 154 | ////////////////////////////////////////////////////////////////// | |
| 155 | ||
| 156 | void DSP1_reset(void) | |
| 157 | { | |
| 121 | 158 | UINT32 i; |
| 122 | 159 | UINT8 *dspin = memory_region(REGION_USER6); |
| 123 | 160 | |
| 124 | dsp1_waitcmd = dsp1_first_parm = 1; | |
| 161 | mSr = DRC|RQM; | |
| 162 | mSrLowByteAccess = FALSE; | |
| 163 | mDr = 0x0080; // Only a supposition. Is this correct? | |
| 164 | mFreeze = FALSE; | |
| 165 | mFsmMajorState = WAIT_COMMAND; | |
| 166 | memset(&shared, 0, sizeof(struct SharedData)); // another supposition | |
| 125 | 167 | |
| 126 | for (i=0; i<INCR; i++) | |
| 127 | { | |
| 128 | CosTable2[i] = (cos((double)(2*M_PI*i/INCR))); | |
| 129 | SinTable2[i] = (sin((double)(2*M_PI*i/INCR))); | |
| 130 | } | |
| 131 | ||
| 132 | 168 | // expand the DSP-1 data ROM |
| 133 | 169 | for (i = 0; i < 2048; i+=2) |
| 134 | 170 | { |
| 135 | DSP1R | |
| 171 | DSP1_DataRom[i/2] = dspin[i]<<8 | dspin[i+1]; | |
| 136 | 172 | } |
| 137 | 173 | } |
| 138 | 174 | |
| 139 | static INT16 Gx, Nx, CentreX; | |
| 140 | static INT16 Gy, Ny, CentreY; | |
| 141 | static INT16 Gz, Nz, CentreZ; | |
| 142 | static INT16 Les_C, Les_E, Les_G; | |
| 175 | ////////////////////////////////////////////////////////////////// | |
| 143 | 176 | |
| 144 | static INT16 VOffset; | |
| 177 | // Though the DSP-1 is unaware of the type of operation (read or write) | |
| 178 | // we need to know what is being done by the program, as the class | |
| 179 | // is responsible for maintaining the binding between the | |
| 180 | // "external" and "internal" representations of the DR (data register). | |
| 145 | 181 | |
| 146 | static INT16 VPlane_C, VPlane_E; | |
| 182 | static void DSP1_fsmStep(UINT8 read, UINT8 *data) | |
| 183 | { | |
| 184 | if (0 == (mSr&RQM)) return; | |
| 185 | // Now RQM would be cleared; however, as this code is not to be used in | |
| 186 | // a multithread environment, we will simply fake RQM operation. | |
| 187 | // (The only exception would be Op1A's freeze.) | |
| 147 | 188 | |
| 148 | // Azimuth and Zenith angles | |
| 149 | static INT16 SinAas, CosAas, SinAzs, CosAzs; | |
| 189 | // binding | |
| 190 | if (read) | |
| 191 | { | |
| 192 | if (mSr&DRS) | |
| 193 | *data = (UINT8)(mDr>>8); | |
| 194 | else | |
| 195 | *data = (UINT8)(mDr); | |
| 196 | } | |
| 197 | else | |
| 198 | { | |
| 199 | if (mSr&DRS) | |
| 200 | { | |
| 201 | mDr &= 0x00ff; | |
| 202 | mDr |= *data<<8; | |
| 203 | } | |
| 204 | else | |
| 205 | { | |
| 206 | mDr &= 0xff00; | |
| 207 | mDr |= *data; | |
| 208 | } | |
| 209 | } | |
| 150 | 210 | |
| 151 | // Clipped Zenith angle | |
| 152 | static INT16 SinAzsB, CosAzsB; | |
| 153 | static INT16 SecAZS_C1; | |
| 154 | static INT16 SecAZS_E1; | |
| 155 | static INT16 SecAZS_C2; | |
| 156 | static INT16 SecAZS_E2; | |
| 157 | 211 | |
| 158 | static INT16 DSP1_Sin(INT16 Angle) | |
| 159 | { | |
| 160 | int S; | |
| 212 | switch (mFsmMajorState) | |
| 213 | { | |
| 214 | case WAIT_COMMAND: | |
| 215 | mCommand = (UINT8)(mDr); | |
| 216 | if (!(mCommand & 0xc0)) // valid command? | |
| 217 | { | |
| 218 | switch(mCommand) | |
| 219 | { | |
| 220 | // freeze cases | |
| 221 | case 0x1a: | |
| 222 | case 0x2a: | |
| 223 | case 0x3a: | |
| 224 | mFreeze = TRUE; | |
| 225 | break; | |
| 226 | // normal cases | |
| 227 | default: | |
| 228 | mDataCounter=0; | |
| 229 | mFsmMajorState = READ_DATA; | |
| 230 | mSr &= ~DRC; | |
| 231 | break; | |
| 232 | } | |
| 233 | } | |
| 234 | break; | |
| 235 | case READ_DATA: | |
| 236 | mSr ^= DRS; | |
| 237 | if (!(mSr&DRS)) | |
| 238 | { | |
| 239 | mReadBuffer[mDataCounter++] = (INT16)(mDr); | |
| 240 | if (mDataCounter >= mCommandTable[mCommand].reads) | |
| 241 | { | |
| 242 | (*mCommandTable[mCommand].callback)(mReadBuffer, mWriteBuffer); | |
| 243 | if (0 != mCommandTable[mCommand].writes) // any output? | |
| 244 | { | |
| 245 | mDataCounter = 0; | |
| 246 | mDr = (UINT16)(mWriteBuffer[mDataCounter]); | |
| 247 | mFsmMajorState = WRITE_DATA; | |
| 248 | } | |
| 249 | else | |
| 250 | { | |
| 251 | mDr = 0x0080; // valid command completion | |
| 252 | mFsmMajorState = WAIT_COMMAND; | |
| 253 | mSr |= DRC; | |
| 254 | } | |
| 255 | } | |
| 256 | } | |
| 257 | break; | |
| 258 | case WRITE_DATA: | |
| 259 | mSr ^= DRS; | |
| 260 | if (!(mSr&DRS)) | |
| 261 | { | |
| 262 | ++mDataCounter; | |
| 263 | if (mDataCounter >= mCommandTable[mCommand].writes) | |
| 264 | { | |
| 265 | if ((mCommand == 0x0a)&&(mDr != 0x8000)) | |
| 266 | { | |
| 267 | // works in continuous mode | |
| 268 | mReadBuffer[0]++; // next raster line | |
| 269 | (*mCommandTable[mCommand].callback)(mReadBuffer, mWriteBuffer); | |
| 270 | mDataCounter = 0; | |
| 271 | mDr = (UINT16)(mWriteBuffer[mDataCounter]); | |
| 272 | } | |
| 273 | else | |
| 274 | { | |
| 275 | mDr = 0x0080; // valid command completion | |
| 276 | mFsmMajorState = WAIT_COMMAND; | |
| 277 | mSr |= DRC; | |
| 278 | } | |
| 279 | } | |
| 280 | else | |
| 281 | { | |
| 282 | mDr = (UINT16)(mWriteBuffer[mDataCounter]); | |
| 283 | } | |
| 284 | } | |
| 285 | break; | |
| 286 | } | |
| 161 | 287 | |
| 162 | if (Angle < 0) { | |
| 163 | if (Angle == -32768) return 0; | |
| 164 | return -DSP1_Sin(-Angle); | |
| 165 | } | |
| 166 | 288 | |
| 167 | S = DSP1_SinTable[Angle >> 8] + (DSP1_MulTable[Angle & 0xff] * DSP1_SinTable[0x40 + (Angle >> 8)] >> 15); | |
| 168 | if (S > 32767) S = 32767; | |
| 169 | return (INT16) S; | |
| 289 | ||
| 290 | // Now RQM would be set (except when executing Op1A -command equals 0x1a, 0x2a or 0x3a-). | |
| 291 | if (mFreeze) | |
| 292 | mSr &= ~RQM; | |
| 170 | 293 | } |
| 171 | 294 | |
| 172 | static INT16 DSP1_Cos(INT16 Angle) | |
| 173 | { | |
| 174 | int S; | |
| 295 | ////////////////////////////////////////////////////////////////// | |
| 175 | 296 | |
| 176 | if (Angle < 0) { | |
| 177 | if (Angle == -32768) return -32768; | |
| 178 | Angle = -Angle; | |
| 179 | } | |
| 180 | S = DSP1_SinTable[0x40 + (Angle >> 8)] - (DSP1_MulTable[Angle & 0xff] * DSP1_SinTable[Angle >> 8] >> 15); | |
| 181 | if (S < -32768) S = -32767; | |
| 182 | return (INT16) S; | |
| 183 | } | |
| 297 | // The info on this table follows Overload's docs. | |
| 184 | 298 | |
| 185 | static | |
| 299 | static const struct DSP1_Co | |
| 186 | 300 | { |
| 187 | INT16 i = 0x4000; | |
| 188 | INT16 e = 0; | |
| 301 | {&DSP1_multiply, 2, 1}, //0x00 | |
| 302 | {&DSP1_attitudeA, 4, 0}, //0x01 | |
| 303 | {&DSP1_parameter, 7, 4}, //0x02 | |
| 304 | {&DSP1_subjectiveA, 3, 3}, //0x03 | |
| 305 | {&DSP1_triangle, 2, 2}, //0x04 | |
| 306 | {&DSP1_attitudeA, 4, 0}, //0x01 | |
| 307 | {&DSP1_project, 3, 3}, //0x06 | |
| 308 | {&DSP1_memoryTest, 1, 1}, //0x0f | |
| 309 | {&DSP1_radius, 3, 2}, //0x08 | |
| 310 | {&DSP1_objectiveA, 3, 3}, //0x0d | |
| 311 | {&DSP1_raster, 1, 4}, // 0x0a. This will normally work in continuous mode | |
| 312 | {&DSP1_scalarA, 3, 1}, //0x0b | |
| 313 | {&DSP1_rotate, 3, 2}, //0x0c | |
| 314 | {&DSP1_objectiveA, 3, 3}, //0x0d | |
| 315 | {&DSP1_target, 2, 2}, //0x0e | |
| 316 | {&DSP1_memoryTest, 1, 1}, //0x0f | |
| 189 | 317 | |
| 190 | if (m < 0) | |
| 191 | while ((m & i) && i) | |
| 192 | { | |
| 193 | i >>= 1; | |
| 194 | e++; | |
| 195 | } | |
| 196 | else | |
| 197 | while (!(m & i) && i) | |
| 198 | { | |
| 199 | i >>= 1; | |
| 200 | e++; | |
| 201 | } | |
| 318 | {&DSP1_inverse, 2, 2}, //0x10 | |
| 319 | {&DSP1_attitudeB, 4, 0}, //0x11 | |
| 320 | {&DSP1_parameter, 7, 4}, //0x02 | |
| 321 | {&DSP1_subjectiveB, 3, 3}, //0x13 | |
| 322 | {&DSP1_gyrate, 6, 3}, //0x14 | |
| 323 | {&DSP1_attitudeB, 4, 0}, //0x11 | |
| 324 | {&DSP1_project, 3, 3}, //0x06 | |
| 325 | {&DSP1_memoryDump, 1, 1024}, //0x1f | |
| 326 | {&DSP1_range, 4, 1}, //0x18 | |
| 327 | {&DSP1_objectiveB, 3, 3}, //0x1d | |
| 328 | {0, 0, 0}, // 0x1a; the chip freezes | |
| 329 | {&DSP1_scalarB, 3, 1}, //0x1b | |
| 330 | {&DSP1_polar, 6, 3}, //0x1c | |
| 331 | {&DSP1_objectiveB, 3, 3}, //0x1d | |
| 332 | {&DSP1_target, 2, 2}, //0x0e | |
| 333 | {&DSP1_memoryDump, 1, 1024}, //0x1f | |
| 202 | 334 | |
| 203 | if (e > 0) | |
| 204 | *Coefficient = m * DSP1ROM[0x0021 + e] << 1; | |
| 205 | else | |
| 206 | *Coefficient = m; | |
| 335 | {&DSP1_multiply2, 2, 1}, //0x20 | |
| 336 | {&DSP1_attitudeC, 4, 0}, //0x21 | |
| 337 | {&DSP1_parameter, 7, 4}, //0x02 | |
| 338 | {&DSP1_subjectiveC, 3, 3}, //0x23 | |
| 339 | {&DSP1_triangle, 2, 2}, //0x04 | |
| 340 | {&DSP1_attitudeC, 4, 0}, //0x21 | |
| 341 | {&DSP1_project, 3, 3}, //0x06 | |
| 342 | {&DSP1_memorySize, 1, 1}, //0x2f | |
| 343 | {&DSP1_distance, 3, 1}, //0x28 | |
| 344 | {&DSP1_objectiveC, 3, 3}, //0x2d | |
| 345 | {0, 0, 0}, // 0x1a; the chip freezes | |
| 346 | {&DSP1_scalarC, 3, 1}, //0x2b | |
| 347 | {&DSP1_rotate, 3, 2}, //0x0c | |
| 348 | {&DSP1_objectiveC, 3, 3}, //0x2d | |
| 349 | {&DSP1_target, 2, 2}, //0x0e | |
| 350 | {&DSP1_memorySize, 1, 1}, //0x2f | |
| 207 | 351 | |
| 208 | *Exponent -= e; | |
| 209 | } | |
| 352 | {&DSP1_inverse, 2, 2}, //0x10 | |
| 353 | {&DSP1_attitudeA, 4, 0}, //0x01 | |
| 354 | {&DSP1_parameter, 7, 4}, //0x02 | |
| 355 | {&DSP1_subjectiveA, 3, 3}, //0x03 | |
| 356 | {&DSP1_gyrate, 6, 3}, //0x14 | |
| 357 | {&DSP1_attitudeA, 4, 0}, //0x01 | |
| 358 | {&DSP1_project, 3, 3}, //0x06 | |
| 359 | {&DSP1_memoryDump, 1, 1024}, //0x1f | |
| 360 | {&DSP1_range2, 4, 1}, //0x38 | |
| 361 | {&DSP1_objectiveA, 3, 3}, //0x0d | |
| 362 | {0, 0, 0}, // 0x1a; the chip freezes | |
| 363 | {&DSP1_scalarA, 3, 1}, //0x0b | |
| 364 | {&DSP1_polar, 6, 3}, //0x1c | |
| 365 | {&DSP1_objectiveA, 3, 3}, //0x0d | |
| 366 | {&DSP1_target, 2, 2}, //0x0e | |
| 367 | {&DSP1_memoryDump, 1, 1024}, //0x1f | |
| 368 | }; | |
| 210 | 369 | |
| 211 | static void DSP1_NormalizeDouble(int Product, INT16 *Coefficient, INT16 *Exponent) | |
| 370 | ////////////////////////////////////////////////////////////////// | |
| 371 | ||
| 372 | static void DSP1_memoryTest(INT16 *input, INT16 *output) | |
| 212 | 373 | { |
| 213 | INT16 n = Product & 0x7fff; | |
| 214 | INT16 m = Product >> 15; | |
| 215 | INT16 i = 0x4000; | |
| 216 | INT16 e = 0; | |
| 374 | // INT16 *Size = &input[0]; | |
| 375 | INT16 *Result = &output[0]; | |
| 217 | 376 | |
| 218 | if (m < 0) | |
| 219 | while ((m & i) && i) | |
| 220 | { | |
| 221 | i >>= 1; | |
| 222 | e++; | |
| 223 | } | |
| 224 | else | |
| 225 | while (!(m & i) && i) | |
| 226 | { | |
| 227 | i >>= 1; | |
| 228 | e++; | |
| 229 | } | |
| 377 | *Result = 0x0000; | |
| 378 | } | |
| 230 | 379 | |
| 231 | if (e > 0) | |
| 232 | { | |
| 233 | *Coefficient = m * DSP1ROM[0x0021 + e] << 1; | |
| 380 | ////////////////////////////////////////////////////////////////// | |
| 234 | 381 | |
| 235 | if (e < 15) | |
| 236 | *Coefficient += n * DSP1ROM[0x0040 - e] >> 15; | |
| 237 | else | |
| 238 | { | |
| 239 | i = 0x4000; | |
| 382 | static void DSP1_memoryDump(INT16 *input, INT16 *output) | |
| 383 | { | |
| 384 | memcpy(output, DSP1_DataRom, 1024); | |
| 385 | } | |
| 240 | 386 | |
| 241 | if (m < 0) | |
| 242 | while ((n & i) && i) | |
| 243 | { | |
| 244 | i >>= 1; | |
| 245 | e++; | |
| 246 | } | |
| 247 | else | |
| 248 | while (!(n & i) && i) | |
| 249 | { | |
| 250 | i >>= 1; | |
| 251 | e++; | |
| 252 | } | |
| 387 | ////////////////////////////////////////////////////////////////// | |
| 253 | 388 | |
| 254 | if (e > 15) | |
| 255 | *Coefficient = n * DSP1ROM[0x0012 + e] << 1; | |
| 256 | else | |
| 257 | *Coefficient += n; | |
| 258 | } | |
| 259 | } | |
| 260 | else | |
| 261 | *Coefficient = m; | |
| 389 | static void DSP1_memorySize(INT16 *input, INT16 *output) | |
| 390 | { | |
| 391 | INT16 *Size = &output[0]; | |
| 262 | 392 | |
| 263 | ||
| 393 | *Siz | |
| 264 | 394 | } |
| 265 | 395 | |
| 266 | static INT16 DSP1_Truncate(INT16 C, INT16 E) | |
| 267 | { | |
| 268 | if (E > 0) { | |
| 269 | if (C > 0) return 32767; else if (C < 0) return -32767; | |
| 270 | } else { | |
| 271 | if (E < 0) return C * DSP1ROM[0x0031 + E] >> 15; | |
| 272 | } | |
| 273 | return C; | |
| 274 | } | |
| 396 | ////////////////////////////////////////////////////////////////// | |
| 275 | 397 | |
| 276 | // 00H - 16-bit Multiplication (Bit Perfect) | |
| 277 | // Input byte(00H) integer(Multiplicand) integer(Multiplier) | |
| 278 | // Output integer(Product) | |
| 398 | // 16-bit multiplication | |
| 279 | 399 | |
| 280 | static void DSP1_ | |
| 400 | static void DSP1_multiply(INT16 * | |
| 281 | 401 | { |
| 282 | *Product = (Multiplicand * Multiplier >> 15); | |
| 402 | INT16 Multiplicand = input[0]; | |
| 403 | INT16 Multiplier = input[1]; | |
| 404 | INT16 *Product = &output[0]; | |
| 405 | ||
| 406 | *Product = Multiplicand * Multiplier >> 15; | |
| 283 | 407 | } |
| 284 | 408 | |
| 285 | // 20H - 16-bit Multiplication (Bit Perfect) | |
| 286 | // Input byte(20H) integer(Multiplicand) integer(Multiplier) | |
| 287 | // Output integer(Product) | |
| 409 | ////////////////////////////////////////////////////////////////// | |
| 288 | 410 | |
| 289 | #ifdef UNUSED_FUNCTION | |
| 290 | static void DSP1_Multiply1(INT16 Multiplicand, INT16 Multiplier, INT16 *Product) | |
| 411 | // 16-bit multiplication. 'Alternative' method. Can anyone check this carefully? | |
| 412 | ||
| 413 | static void DSP1_multiply2(INT16 *input, INT16 *output) | |
| 291 | 414 | { |
| 292 | *Product = (Multiplicand * Multiplier >> 15) + 1; | |
| 415 | INT16 Multiplicand = input[0]; | |
| 416 | INT16 Multiplier = input[1]; | |
| 417 | INT16* Product = &output[0]; | |
| 418 | ||
| 419 | *Product = (Multiplicand * Multiplier >> 15)+1; | |
| 293 | 420 | } |
| 294 | #endif | |
| 295 | 421 | |
| 296 | // 10H - Inverse Calculation (Bit Perfect) | |
| 297 | // Input byte(10H) integer(Coefficient) integer(Exponent) | |
| 298 | // Output integer(Coefficient) integer(Exponent) | |
| 422 | ////////////////////////////////////////////////////////////////// | |
| 299 | 423 | |
| 300 | static void DSP1_Inverse(INT16 Coefficient, INT16 Exponent, INT16 *iCoefficient, INT16 *iExponent) | |
| 424 | // This command determines the inverse of a floating point decimal number. | |
| 425 | ||
| 426 | static void DSP1_inverse(INT16 *input, INT16 *output) | |
| 301 | 427 | { |
| 302 | // Step One: Division by Zero | |
| 303 | if (Coefficient == 0x0000) | |
| 304 | { | |
| 305 | *iCoefficient = 0x7fff; | |
| 306 | *iExponent = 0x002f; | |
| 307 | } | |
| 308 | else | |
| 309 | { | |
| 310 | INT16 Sign = 1; | |
| 428 | INT16 Coefficient = input[0]; | |
| 429 | INT16 Exponent = input[1]; | |
| 430 | INT16* iCoefficient = &output[0]; | |
| 431 | INT16* iExponent = &output[1]; | |
| 311 | 432 | |
| 312 | // Step Two: Remove Sign | |
| 313 | if (Coefficient < 0) | |
| 314 | { | |
| 315 | if (Coefficient < -32767) Coefficient = -32767; | |
| 316 | Coefficient = -Coefficient; | |
| 317 | Sign = -1; | |
| 318 | } | |
| 433 | inverse(Coefficient, Exponent, iCoefficient, iExponent); | |
| 434 | } | |
| 319 | 435 | |
| 320 | // Step Three: Normalize | |
| 321 | while (Coefficient < 0x4000) | |
| 322 | { | |
| 323 | Coefficient <<= 1; | |
| 324 | Exponent--; | |
| 325 | } | |
| 436 | ////////////////////////////////////////////////////////////////// | |
| 326 | 437 | |
| 327 | // Step Four: Special Case | |
| 328 | if (Coefficient == 0x4000) | |
| 329 | if (Sign == 1) *iCoefficient = 0x7fff; | |
| 330 | else { | |
| 331 | *iCoefficient = -0x4000; | |
| 332 | Exponent--; | |
| 333 | } | |
| 334 | else { | |
| 335 | // Step Five: Initial Guess | |
| 336 | INT16 i = DSP1ROM[((Coefficient - 0x4000) >> 7) + 0x0065]; | |
| 438 | // Vector component calculation. Determines the X and Y components for a | |
| 439 | // two-dimensional vector whose size and direction is known. | |
| 440 | // Y = Radius * sin(Angle) | |
| 441 | // X = Radius * cos(Angle) | |
| 337 | 442 | |
| 338 | // Step Six: Iterate Newton's Method | |
| 339 | i = (i + (-i * (Coefficient * i >> 15) >> 15)) << 1; | |
| 340 | i = (i + (-i * (Coefficient * i >> 15) >> 15)) << 1; | |
| 443 | static void DSP1_triangle(INT16 *input, INT16 *output) | |
| 444 | { | |
| 445 | INT16 Angle = input[0]; | |
| 446 | INT16 Radius = input[1]; | |
| 447 | INT16* Y = &output[0]; | |
| 448 | INT16* X = &output[1]; | |
| 341 | 449 | |
| 342 | *iCoefficient = i * Sign; | |
| 343 | } | |
| 344 | ||
| 345 | *iExponent = 1 - Exponent; | |
| 346 | } | |
| 450 | *Y = DSP1_sin(Angle) * Radius >> 15; | |
| 451 | *X = DSP1_cos(Angle) * Radius >> 15; | |
| 347 | 452 | } |
| 348 | 453 | |
| 349 | // 04H - Trigonometric Calculation (Bit Perfect) | |
| 350 | // Input byte(04H) integer(Angle) integer(Radius) | |
| 351 | // Output integer(Sine) integer(Cosine) | |
| 454 | ////////////////////////////////////////////////////////////////// | |
| 352 | 455 | |
| 353 | static void DSP1_Triangle(INT16 Angle, INT16 Radius, INT16 *S, INT16 *C) | |
| 456 | // Determines the squared norm of a vector (X,Y,Z) | |
| 457 | // The output is Radius = X^2+Y^2+Z^2 (double integer) | |
| 458 | ||
| 459 | static void DSP1_radius(INT16 *input, INT16 *output) | |
| 354 | 460 | { |
| 355 | *S = DSP1_Sin(Angle) * Radius >> 15; | |
| 356 | *C = DSP1_Cos(Angle) * Radius >> 15; | |
| 357 | } | |
| 461 | INT16 X = input[0]; | |
| 462 | INT16 Y = input[1]; | |
| 463 | INT16 Z = input[2]; | |
| 464 | INT16* RadiusLow = &output[0]; | |
| 465 | INT16* RadiusHigh = &output[1]; | |
| 358 | 466 | |
| 359 | // 08H - Vector Size Calculation (Bit Perfect) | |
| 360 | // Input byte(08H) integer(X) integer(Y) integer(Z) | |
| 361 | // Output double(Radius) | |
| 467 | INT32 Radius; | |
| 362 | 468 | |
| 363 | static void DSP1_Radius(INT16 X, INT16 Y, INT16 Z, int *Radius) | |
| 364 | { | |
| 365 | *Radius = (X * X + Y * Y + Z * Z) << 1; | |
| 469 | Radius = (X * X + Y * Y + Z * Z) << 1; | |
| 470 | *RadiusLow = (INT16)(Radius); | |
| 471 | *RadiusHigh = (INT16)(Radius>>16); | |
| 366 | 472 | } |
| 367 | 473 | |
| 368 | // 18H - Vector Size Comparison (Bit Perfect) | |
| 369 | // Input byte(18H) integer(X) integer(Y) integer(Z) integer(Radius) | |
| 370 | // Output integer(Range) | |
| 474 | ////////////////////////////////////////////////////////////////// | |
| 371 | 475 | |
| 372 | static void DSP1_Range(INT16 X, INT16 Y, INT16 Z, INT16 Radius, INT16 *Range) | |
| 476 | // Vector size comparison. This command compares the size of the vector (X,Y,Z) and the distance (R) | |
| 477 | // from a particular point, and so may be used to determine if a point is within the sphere or radius R. | |
| 478 | // The output is D = X^2+Y^2+Z^2-R^2 | |
| 479 | ||
| 480 | static void DSP1_range(INT16 *input, INT16 *output) | |
| 373 | 481 | { |
| 374 | *Range = ((X * X + Y * Y + Z * Z - Radius * Radius) >> 15); | |
| 482 | INT16 X = input[0]; | |
| 483 | INT16 Y = input[1]; | |
| 484 | INT16 Z = input[2]; | |
| 485 | INT16 Radius = input[3]; | |
| 486 | INT16* Range = &output[0]; | |
| 487 | ||
| 488 | *Range = (X * X + Y * Y + Z * Z - Radius * Radius) >> 15; | |
| 375 | 489 | } |
| 376 | 490 | |
| 377 | // 38H - Vector Size Comparison (Bit Perfect) | |
| 378 | // Input byte(38H) integer(X) integer(Y) integer(Z) integer(Radius) | |
| 379 | // Output integer(Range) | |
| 491 | ////////////////////////////////////////////////////////////////// | |
| 380 | 492 | |
| 381 | #ifdef UNUSED_FUNCTION | |
| 382 | static void DSP1_Range1(INT16 X, INT16 Y, INT16 Z, INT16 Radius, INT16 *Range) | |
| 493 | // Vector size comparison. 'Alternative' method. | |
| 494 | ||
| 495 | static void DSP1_range2(INT16 *input, INT16 *output) | |
| 383 | 496 | { |
| 384 | *Range = ((X * X + Y * Y + Z * Z - Radius * Radius) >> 15) + 1; | |
| 497 | INT16 X = input[0]; | |
| 498 | INT16 Y = input[1]; | |
| 499 | INT16 Z = input[2]; | |
| 500 | INT16 Radius = input[3]; | |
| 501 | INT16* Range = &output[0]; | |
| 502 | ||
| 503 | *Range = ((X * X + Y * Y + Z * Z - Radius * Radius) >> 15) + 1; | |
| 385 | 504 | } |
| 386 | #endif | |
| 387 | 505 | |
| 388 | // 28H - Vector Absolute Value Calculation (Bit Perfect) | |
| 389 | // Input byte(28H) integer(X) integer(Y) integer(Z) | |
| 390 | // Output integer(Distance) | |
| 506 | ////////////////////////////////////////////////////////////////// | |
| 391 | 507 | |
| 392 | static void DSP1_Distance(INT16 X, INT16 Y, INT16 Z, INT16 *Distance) | |
| 508 | // This command calculates the norm of a (X,Y,Z) vector, or the distance from | |
| 509 | // the point (X,Y,Z) to (0,0,0), as you prefer to see it. | |
| 510 | // Distance = sqrt(X^2+Y^2+Z^2) | |
| 511 | // The square root of a number 'a' is calculated by doing this: you | |
| 512 | // write 'a' as b*2^2n, with 'b' between 1/4 and 1; then, you calculate | |
| 513 | // c=sqrt(b) by using lineal interpolation between points of a | |
| 514 | // look-up table and, finally, you output the result as c*2^n. | |
| 515 | ||
| 516 | static void DSP1_distance(INT16 *input, INT16 *output) | |
| 393 | 517 | { |
| 394 | int Radius = X * X + Y * Y + Z * Z; | |
| 395 | INT16 C, E, Pos, Node1, Node2; | |
| 518 | INT16 X = input[0]; | |
| 519 | INT16 Y = input[1]; | |
| 520 | INT16 Z = input[2]; | |
| 521 | INT16* Distance = &output[0]; | |
| 522 | INT16 Pos, Node1, Node2; | |
| 396 | 523 | |
| 397 | if (Radius == 0) *Distance = 0; | |
| 398 | else | |
| 399 | { | |
| 400 | DSP1_NormalizeDouble(Radius, &C, &E); | |
| 401 | if (E & 1) C = C * 0x4000 >> 15; | |
| 524 | INT32 Radius = X * X + Y * Y + Z * Z; | |
| 402 | 525 | |
| 403 | Pos = C * 0x0040 >> 15; | |
| 404 | 526 | |
| 405 | Node1 = DSP1ROM[0x00d5 + Pos]; | |
| 406 | Node2 = DSP1ROM[0x00d6 + Pos]; | |
| 527 | if (Radius == 0) Distance = 0; | |
| 528 | else | |
| 529 | { | |
| 530 | INT16 C, E; | |
| 531 | normalizeDouble(Radius, &C, &E); | |
| 532 | if (E & 1) C = C * 0x4000 >> 15; | |
| 407 | 533 | |
| 408 | ||
| 534 | ||
| 409 | 535 | |
| 536 | Node1 = DSP1_DataRom[0x00d5 + Pos]; | |
| 537 | Node2 = DSP1_DataRom[0x00d6 + Pos]; | |
| 538 | ||
| 539 | *Distance = ((Node2 - Node1) * (C & 0x1ff) >> 9) + Node1; | |
| 540 | ||
| 410 | 541 | #if DSP1_VERSION < 0x0102 |
| 411 | 542 | if (Pos & 1) *Distance -= (Node2 - Node1); |
| 412 | 543 | #endif |
| 413 | 544 | *Distance >>= (E >> 1); |
| 414 | ||
| 545 | } | |
| 415 | 546 | } |
| 416 | 547 | |
| 417 | // 0CH - 2D Coordinate Rotation (Bit Perfect) | |
| 418 | // Input byte(0CH) integer(Angle) integer(X) integer(Y) | |
| 419 | // Output integer(X) integer(Y) | |
| 548 | ////////////////////////////////////////////////////////////////// | |
| 420 | 549 | |
| 421 | static void DSP1_Rotate(INT16 Angle, INT16 X1, INT16 Y1, INT16 *X2, INT16 *Y2) | |
| 550 | // Determines the (X2, Y2) coordinates obtained by rotating (X1, Y1) | |
| 551 | // clockwise for an angle 'Angle'. The official documentation says | |
| 552 | // 'counterclockwise', but it's obviously wrong (surprise! :P) | |
| 553 | // | |
| 554 | // In matrix notation: | |
| 555 | // |X2| |cos(Angle) sin(Angle)| |X1| | |
| 556 | // | | = | | | | | |
| 557 | // |Y2| |-sin(Angle cos(Angle)| |Y1| | |
| 558 | ||
| 559 | static void DSP1_rotate(INT16 *input, INT16 *output) | |
| 422 | 560 | { |
| 423 | *X2 = (Y1 * DSP1_Sin(Angle) >> 15) + (X1 * DSP1_Cos(Angle) >> 15); | |
| 424 | *Y2 = (Y1 * DSP1_Cos(Angle) >> 15) - (X1 * DSP1_Sin(Angle) >> 15); | |
| 561 | INT16 Angle = input[0]; | |
| 562 | INT16 X1 = input[1]; | |
| 563 | INT16 Y1 = input[2]; | |
| 564 | INT16* X2 = &output[0]; | |
| 565 | INT16* Y2 = &output[1]; | |
| 566 | ||
| 567 | *X2 = (Y1 * DSP1_sin(Angle) >> 15) + (X1 * DSP1_cos(Angle) >> 15); | |
| 568 | *Y2 = (Y1 * DSP1_cos(Angle) >> 15) - (X1 * DSP1_sin(Angle) >> 15); | |
| 425 | 569 | } |
| 426 | 570 | |
| 427 | // 1CH - 3D Coordinate Rotation (Bit Perfect) | |
| 428 | // Input byte(1CH) integer(Az) integer(Ay) integer(Ax) integer(X) integer(Y) integer(Z) | |
| 429 | // Output integer(X) integer(Y) integer(Z) | |
| 571 | ////////////////////////////////////////////////////////////////// | |
| 430 | 572 | |
| 431 | #ifdef UNUSED_FUNCTION | |
| 432 | static void DSP1_Polar(INT16 Az, INT16 Ay, INT16 Ax, INT16 X1, INT16 Y1, INT16 Z1, INT16 *X2, INT16 *Y2, INT16 *Z2) | |
| 573 | // Calculate the coordinates (X2, Y2, Z2) obtained when rotating (X1, Y1, Z1) | |
| 574 | // three-dimensionally. Rotation is done in the order of Az around the Z axis, | |
| 575 | // Ay around the Y axis and Ax around the X axis. As occur with the "attitude" commands | |
| 576 | // (see comments in the "gyrate" command), qthis doesn't match what explained in | |
| 577 | // the official documentation, but it's coherent with what it is done in the "attitude" | |
| 578 | // command (but not with the "gyrate" command). | |
| 579 | // | |
| 580 | // In matrix notation: | |
| 581 | // |X2| |1 0 0 | |cosRy 0 -sinRy| | cosRz sinRz 0| |X1| | |
| 582 | // |Y2| = |0 cosRx sinRx| | 0 1 0 | |-sinRz cosRz 0| |Y1| | |
| 583 | // |Z2| |0 -sinRx cosRx| |sinRy 0 cosRy| | 0 0 1| |Z1| | |
| 584 | ||
| 585 | static void DSP1_polar(INT16 *input, INT16 *output) | |
| 433 | 586 | { |
| 434 | INT16 X, Y, Z; | |
| 587 | INT16 Az = input[0]; | |
| 588 | INT16 Ay = input[1]; | |
| 589 | INT16 Ax = input[2]; | |
| 590 | INT16 X1 = input[3]; | |
| 591 | INT16 Y1 = input[4]; | |
| 592 | INT16 Z1 = input[5]; | |
| 593 | INT16* X2 = &output[0]; | |
| 594 | INT16* Y2 = &output[1]; | |
| 595 | INT16* Z2 = &output[2]; | |
| 435 | 596 | |
| 436 | // Rotate Around Z | |
| 437 | X = (Y1 * DSP1_Sin(Az) >> 15) + (X1 * DSP1_Cos(Az) >> 15); | |
| 438 | Y = (Y1 * DSP1_Cos(Az) >> 15) - (X1 * DSP1_Sin(Az) >> 15); | |
| 439 | X1 = X; Y1 = Y; | |
| 597 | INT16 X, Y, Z; | |
| 440 | 598 | |
| 441 | // Rotate Around Y | |
| 442 | Z = (X1 * DSP1_Sin(Ay) >> 15) + (Z1 * DSP1_Cos(Ay) >> 15); | |
| 443 | X = (X1 * DSP1_Cos(Ay) >> 15) - (Z1 * DSP1_Sin(Ay) >> 15); | |
| 444 | *X2 = X; Z1 = Z; | |
| 599 | // Rotate Around Z | |
| 600 | X = (Y1 * DSP1_sin(Az) >> 15) + (X1 * DSP1_cos(Az) >> 15); | |
| 601 | Y = (Y1 * DSP1_cos(Az) >> 15) - (X1 * DSP1_sin(Az) >> 15); | |
| 602 | X1 = X; Y1 = Y; | |
| 445 | 603 | |
| 446 | // Rotate Around X | |
| 447 | Y = (Z1 * DSP1_Sin(Ax) >> 15) + (Y1 * DSP1_Cos(Ax) >> 15); | |
| 448 | Z = (Z1 * DSP1_Cos(Ax) >> 15) - (Y1 * DSP1_Sin(Ax) >> 15); | |
| 449 | *Y2 = Y; *Z2 = Z; | |
| 604 | // Rotate Around Y | |
| 605 | Z = (X1 * DSP1_sin(Ay) >> 15) + (Z1 * DSP1_cos(Ay) >> 15); | |
| 606 | X = (X1 * DSP1_cos(Ay) >> 15) - (Z1 * DSP1_sin(Ay) >> 15); | |
| 607 | *X2 = X; Z1 = Z; | |
| 608 | ||
| 609 | // Rotate Around X | |
| 610 | Y = (Z1 * DSP1_sin(Ax) >> 15) + (Y1 * DSP1_cos(Ax) >> 15); | |
| 611 | Z = (Z1 * DSP1_cos(Ax) >> 15) - (Y1 * DSP1_sin(Ax) >> 15); | |
| 612 | *Y2 = Y; *Z2 = Z; | |
| 450 | 613 | } |
| 451 | #endif | |
| 452 | 614 | |
| 453 | // 02H - Projection Parameter Setting (Bit Perfect) | |
| 454 | // Input byte(02H) integer(Fx) integer(Fy) integer(Fz) integer(Lfe) integer(Les) integer(Aas) integer(Azs) | |
| 455 | // Output integer(Vof) integer(Vva) integer(Cx) integer(Cy) | |
| 615 | ////////////////////////////////////////////////////////////////// | |
| 456 | 616 | |
| 457 | static const INT16 MaxAZS_Exp[16] = { | |
| 458 | 0x38b4, 0x38b7, 0x38ba, 0x38be, 0x38c0, 0x38c4, 0x38c7, 0x38ca, | |
| 459 | 0x38ce, 0x38d0, 0x38d4, 0x38d7, 0x38da, 0x38dd, 0x38e0, 0x38e4 | |
| 460 | }; | |
| 617 | // Set up the elements of an "attitude matrix" (there are other ones): | |
| 618 | // S | cosRz sinRz 0| |cosRy 0 -sinRy| |1 0 0 | | |
| 619 | // MatrixA = - |-sinRz cosRz 0| | 0 1 0 | |0 cosRx sinRx| | |
| 620 | // 2 | 0 0 1| |sinRy 0 cosRy| |0 -sinRx cosRx| | |
| 621 | // This matrix is thought to be used within the following framework: | |
| 622 | // let's suppose we define positive rotations around a system of orthogonal axes in this manner: | |
| 623 | // a rotation of +90 degrees around axis3 converts axis2 into axis1 | |
| 624 | // a rotation of +90 degrees around axis2 converts axis1 into axis3 | |
| 625 | // a rotation of +90 degrees around axis1 converts axis3 into axis2 | |
| 626 | // and let's suppose that we have defined a new orthonormal axes system (FLU) | |
| 627 | // by doing the following operations about the standard one (XYZ): | |
| 628 | // first rotating the XYZ system around Z by an angle Rz (obtaining X'Y'Z'), | |
| 629 | // then rotating the resulting system around Y by an angle Ry (obtaining X''Y''Z'') | |
| 630 | // and, finally, rotating the resulting system around X by an angle Rx (obtaining FLU) | |
| 631 | // This FLU (forward/left/up) system represents an "attitude" and, then, the matrix here defined | |
| 632 | // is the change of coordinates matrix that transform coordinates in the FLU | |
| 633 | // system (the "object coordinates") into the standard XYZ system (the "global coordinates"), | |
| 634 | // multiplied by a scale factor S/2, that is: | |
| 635 | // |x| S |f| | |
| 636 | // |y| * - = MatrixA * |l| | |
| 637 | // |z| 2 |u| | |
| 638 | // In a similar way, if we use the transpose of the matrix, we can transform global coordinates | |
| 639 | // into object coordinates: | |
| 640 | // |f| S |x| | |
| 641 | // |l| * - = MatrixA_transposed * |y| | |
| 642 | // |u| 2 |z| | |
| 643 | // | |
| 644 | // input[0]: S | |
| 645 | // input[1]: Rz | |
| 646 | // input[2]: Ry | |
| 647 | // input[3]: Rx | |
| 461 | 648 | |
| 462 | static INT16 FxParm, FyParm, FzParm, AasParm, AzsParm, LfeParm, LesParm; | |
| 463 | ||
| 464 | static void DSP1_Parameter(INT16 Fx, INT16 Fy, INT16 Fz, INT16 Lfe, INT16 Les, INT16 Aas, INT16 Azs, INT16 *Vof, INT16 *Vva, INT16 *Cx, INT16 *Cy) | |
| 649 | static void DSP1_attitudeA(INT16 *input, INT16 *output) | |
| 465 | 650 | { |
| 466 | INT16 CSec, C, E; | |
| 651 | INT16 S = input[0]; | |
| 652 | INT16 Rz = input[1]; | |
| 653 | INT16 Ry = input[2]; | |
| 654 | INT16 Rx = input[3]; | |
| 467 | 655 | |
| 468 | // Copy Zenith angle for clipping | |
| 469 | INT16 AzsB = Azs; | |
| 656 | INT16 SinRz = DSP1_sin(Rz); | |
| 657 | INT16 CosRz = DSP1_cos(Rz); | |
| 658 | INT16 SinRy = DSP1_sin(Ry); | |
| 659 | INT16 CosRy = DSP1_cos(Ry); | |
| 660 | INT16 SinRx = DSP1_sin(Rx); | |
| 661 | INT16 CosRx = DSP1_cos(Rx); | |
| 470 | 662 | |
| 471 | ||
| 663 | ||
| 472 | 664 | |
| 473 | // store off parameters for use by the Project operation | |
| 474 | FxParm = Fx; | |
| 475 | FyParm = Fy; | |
| 476 | FzParm = Fz; | |
| 477 | AasParm = Aas; | |
| 478 | AzsParm = Azs; | |
| 479 | LfeParm = Lfe; | |
| 480 | LesParm = Les; | |
| 665 | shared.MatrixA[0][0] = (S * CosRz >> 15) * CosRy >> 15; | |
| 666 | shared.MatrixA[0][1] = ((S * SinRz >> 15) * CosRx >> 15) + (((S * CosRz >> 15) * SinRx >> 15) * SinRy >> 15); | |
| 667 | shared.MatrixA[0][2] = ((S * SinRz >> 15) * SinRx >> 15) - (((S * CosRz >> 15) * CosRx >> 15) * SinRy >> 15); | |
| 481 | 668 | |
| 482 | // Store Sine and Cosine of Azimuth and Zenith angle | |
| 483 | SinAas = DSP1_Sin(Aas); | |
| 484 | CosAas = DSP1_Cos(Aas); | |
| 485 | SinAzs = DSP1_Sin(Azs); | |
| 486 | CosAzs = DSP1_Cos(Azs); | |
| 669 | shared.MatrixA[1][0] = -((S * SinRz >> 15) * CosRy >> 15); | |
| 670 | shared.MatrixA[1][1] = ((S * CosRz >> 15) * CosRx >> 15) - (((S * SinRz >> 15) * SinRx >> 15) * SinRy >> 15); | |
| 671 | shared.MatrixA[1][2] = ((S * CosRz >> 15) * SinRx >> 15) + (((S * SinRz >> 15) * CosRx >> 15) * SinRy >> 15); | |
| 487 | 672 | |
| 488 | Nx = SinAzs * -SinAas >> 15; | |
| 489 | Ny = SinAzs * CosAas >> 15; | |
| 490 | Nz = CosAzs * 0x7fff >> 15; | |
| 673 | shared.MatrixA[2][0] = S * SinRy >> 15; | |
| 674 | shared.MatrixA[2][1] = -((S * SinRx >> 15) * CosRy >> 15); | |
| 675 | shared.MatrixA[2][2] = (S * CosRx >> 15) * CosRy >> 15; | |
| 676 | } | |
| 491 | 677 | |
| 492 | // Center of Projection | |
| 493 | CentreX = Fx + (Lfe * Nx >> 15); | |
| 494 | CentreY = Fy + (Lfe * Ny >> 15); | |
| 495 | CentreZ = Fz + (Lfe * Nz >> 15); | |
| 678 | ////////////////////////////////////////////////////////////////// | |
| 496 | 679 | |
| 497 | Gx = CentreX - (Les * Nx >> 15); | |
| 498 | Gy = CentreY - (Les * Ny >> 15); | |
| 499 | Gz = CentreZ - (Les * Nz >> 15); | |
| 680 | // Same than 'attitudeA', but with a difference attitude matrix (matrixB) | |
| 500 | 681 | |
| 501 | Les_E = 0; | |
| 502 | DSP1_Normalize(Les, &Les_C, &Les_E); | |
| 503 | Les_G = Les; | |
| 682 | static void DSP1_attitudeB(INT16 *input, INT16 *output) | |
| 683 | { | |
| 684 | INT16 S = input[0]; | |
| 685 | INT16 Rz = input[1]; | |
| 686 | INT16 Ry = input[2]; | |
| 687 | INT16 Rx = input[3]; | |
| 504 | 688 | |
| 505 | E = 0; | |
| 506 | DSP1_Normalize(CentreZ, &C, &E); | |
| 689 | INT16 SinRz = DSP1_sin(Rz); | |
| 690 | INT16 CosRz = DSP1_cos(Rz); | |
| 691 | INT16 SinRy = DSP1_sin(Ry); | |
| 692 | INT16 CosRy = DSP1_cos(Ry); | |
| 693 | INT16 SinRx = DSP1_sin(Rx); | |
| 694 | INT16 CosRx = DSP1_cos(Rx); | |
| 507 | 695 | |
| 508 | VPlane_C = C; | |
| 509 | VPlane_E = E; | |
| 696 | S >>= 1; | |
| 510 | 697 | |
| 511 | // Determine clip boundary and clip Zenith angle if necessary | |
| 512 | MaxAZS = MaxAZS_Exp[-E]; | |
| 698 | shared.MatrixB[0][0] = (S * CosRz >> 15) * CosRy >> 15; | |
| 699 | shared.MatrixB[0][1] = ((S * SinRz >> 15) * CosRx >> 15) + (((S * CosRz >> 15) * SinRx >> 15) * SinRy >> 15); | |
| 700 | shared.MatrixB[0][2] = ((S * SinRz >> 15) * SinRx >> 15) - (((S * CosRz >> 15) * CosRx >> 15) * SinRy >> 15); | |
| 513 | 701 | |
| 514 | if (AzsB < 0) { | |
| 515 | MaxAZS = -MaxAZS; | |
| 516 | if (AzsB < MaxAZS + 1) AzsB = MaxAZS + 1; | |
| 517 | } else { | |
| 518 | if (AzsB > MaxAZS) AzsB = MaxAZS; | |
| 519 | } | |
| 702 | shared.MatrixB[1][0] = -((S * SinRz >> 15) * CosRy >> 15); | |
| 703 | shared.MatrixB[1][1] = ((S * CosRz >> 15) * CosRx >> 15) - (((S * SinRz >> 15) * SinRx >> 15) * SinRy >> 15); | |
| 704 | shared.MatrixB[1][2] = ((S * CosRz >> 15) * SinRx >> 15) + (((S * SinRz >> 15) * CosRx >> 15) * SinRy >> 15); | |
| 520 | 705 | |
| 521 | // Store Sine and Cosine of clipped Zenith angle | |
| 522 | SinAzsB = DSP1_Sin(AzsB); | |
| 523 | CosAzsB = DSP1_Cos(AzsB); | |
| 706 | shared.MatrixB[2][0] = S * SinRy >> 15; | |
| 707 | shared.MatrixB[2][1] = -((S * SinRx >> 15) * CosRy >> 15); | |
| 708 | shared.MatrixB[2][2] = (S * CosRx >> 15) * CosRy >> 15; | |
| 709 | } | |
| 524 | 710 | |
| 525 | DSP1_Inverse(CosAzsB, 0, &SecAZS_C1, &SecAZS_E1); | |
| 526 | DSP1_Normalize(C * SecAZS_C1 >> 15, &C, &E); | |
| 527 | E += SecAZS_E1; | |
| 711 | ////////////////////////////////////////////////////////////////// | |
| 528 | 712 | |
| 529 | ||
| 713 | // | |
| 530 | 714 | |
| 531 | CentreX += C * SinAas >> 15; | |
| 532 | CentreY -= C * CosAas >> 15; | |
| 715 | static void DSP1_attitudeC(INT16 *input, INT16 *output) | |
| 716 | { | |
| 717 | INT16 S = input[0]; | |
| 718 | INT16 Rz = input[1]; | |
| 719 | INT16 Ry = input[2]; | |
| 720 | INT16 Rx = input[3]; | |
| 533 | 721 | |
| 534 | *Cx = CentreX; | |
| 535 | *Cy = CentreY; | |
| 722 | INT16 SinRz = DSP1_sin(Rz); | |
| 723 | INT16 CosRz = DSP1_cos(Rz); | |
| 724 | INT16 SinRy = DSP1_sin(Ry); | |
| 725 | INT16 CosRy = DSP1_cos(Ry); | |
| 726 | INT16 SinRx = DSP1_sin(Rx); | |
| 727 | INT16 CosRx = DSP1_cos(Rx); | |
| 536 | 728 | |
| 537 | // Raster number of imaginary center and horizontal line | |
| 538 | *Vof = 0; | |
| 729 | S >>= 1; | |
| 539 | 730 | |
| 540 | if ((Azs != AzsB) || (Azs == MaxAZS)) | |
| 541 | { | |
| 542 | INT16 Aux; | |
| 731 | shared.MatrixC[0][0] = (S * CosRz >> 15) * CosRy >> 15; | |
| 732 | shared.MatrixC[0][1] = ((S * SinRz >> 15) * CosRx >> 15) + (((S * CosRz >> 15) * SinRx >> 15) * SinRy >> 15); | |
| 733 | shared.MatrixC[0][2] = ((S * SinRz >> 15) * SinRx >> 15) - (((S * CosRz >> 15) * CosRx >> 15) * SinRy >> 15); | |
| 543 | 734 | |
| 544 | if (Azs == -32768) Azs = -32767; | |
| 735 | shared.MatrixC[1][0] = -((S * SinRz >> 15) * CosRy >> 15); | |
| 736 | shared.MatrixC[1][1] = ((S * CosRz >> 15) * CosRx >> 15) - (((S * SinRz >> 15) * SinRx >> 15) * SinRy >> 15); | |
| 737 | shared.MatrixC[1][2] = ((S * CosRz >> 15) * SinRx >> 15) + (((S * SinRz >> 15) * CosRx >> 15) * SinRy >> 15); | |
| 545 | 738 | |
| 546 | C = Azs - MaxAZS; | |
| 547 | if (C >= 0) C--; | |
| 548 | Aux = ~(C << 2); | |
| 739 | shared.MatrixC[2][0] = S * SinRy >> 15; | |
| 740 | shared.MatrixC[2][1] = -((S * SinRx >> 15) * CosRy >> 15); | |
| 741 | shared.MatrixC[2][2] = (S * CosRx >> 15) * CosRy >> 15; | |
| 742 | } | |
| 549 | 743 | |
| 550 | C = Aux * DSP1ROM[0x0328] >> 15; | |
| 551 | C = (C * Aux >> 15) + DSP1ROM[0x0327]; | |
| 552 | *Vof -= (C * Aux >> 15) * Les >> 15; | |
| 744 | ////////////////////////////////////////////////////////////////// | |
| 553 | 745 | |
| 554 | C = Aux * Aux >> 15; | |
| 555 | Aux = (C * DSP1ROM[0x0324] >> 15) + DSP1ROM[0x0325]; | |
| 556 | CosAzsB += (C * Aux >> 15) * CosAzsB >> 15; | |
| 557 | } | |
| 746 | // Convert global coordinates (X,Y,Z) to object coordinates (F,L,U) | |
| 747 | // See the comment in "attitudeA" for a explanation about the calculation. | |
| 748 | // | |
| 749 | // input[0]: X ; input[1]: Y ; input[2]: Z | |
| 750 | // &output[0]: F ; &output[1]: L ; &output[2]: U | |
| 558 | 751 | |
| 559 | VOffset = Les * CosAzsB >> 15; | |
| 752 | static void DSP1_objectiveA(INT16 *input, INT16 *output) | |
| 753 | { | |
| 754 | INT16 X = input[0]; | |
| 755 | INT16 Y = input[1]; | |
| 756 | INT16 Z = input[2]; | |
| 757 | INT16* F = &output[0]; | |
| 758 | INT16* L = &output[1]; | |
| 759 | INT16* U = &output[2]; | |
| 560 | 760 | |
| 561 | DSP1_Inverse(SinAzsB, 0, &CSec, &E); | |
| 562 | DSP1_Normalize(VOffset, &C, &E); | |
| 563 | DSP1_Normalize(C * CSec >> 15, &C, &E); | |
| 761 | *F = (shared.MatrixA[0][0] * X >> 15) + (shared.MatrixA[1][0] * Y >> 15) + (shared.MatrixA[2][0] * Z >> 15); | |
| 762 | *L = (shared.MatrixA[0][1] * X >> 15) + (shared.MatrixA[1][1] * Y >> 15) + (shared.MatrixA[2][1] * Z >> 15); | |
| 763 | *U = (shared.MatrixA[0][2] * X >> 15) + (shared.MatrixA[1][2] * Y >> 15) + (shared.MatrixA[2][2] * Z >> 15); | |
| 764 | } | |
| 564 | 765 | |
| 565 | ||
| 766 | ////////////////////////////////////////////////////////////////// | |
| 566 | 767 | |
| 567 | ||
| 768 | // | |
| 568 | 769 | |
| 569 | // Store Secant of clipped Zenith angle | |
| 570 | DSP1_Inverse(CosAzsB, 0, &SecAZS_C2, &SecAZS_E2); | |
| 770 | static void DSP1_objectiveB(INT16 *input, INT16 *output) | |
| 771 | { | |
| 772 | INT16 X = input[0]; | |
| 773 | INT16 Y = input[1]; | |
| 774 | INT16 Z = input[2]; | |
| 775 | INT16* F = &output[0]; | |
| 776 | INT16* L = &output[1]; | |
| 777 | INT16* U = &output[2]; | |
| 778 | ||
| 779 | *F = (shared.MatrixB[0][0] * X >> 15) + (shared.MatrixB[1][0] * Y >> 15) + (shared.MatrixB[2][0] * Z >> 15); | |
| 780 | *L = (shared.MatrixB[0][1] * X >> 15) + (shared.MatrixB[1][1] * Y >> 15) + (shared.MatrixB[2][1] * Z >> 15); | |
| 781 | *U = (shared.MatrixB[0][2] * X >> 15) + (shared.MatrixB[1][2] * Y >> 15) + (shared.MatrixB[2][2] * Z >> 15); | |
| 571 | 782 | } |
| 572 | 783 | |
| 573 | // 06H - Object Projection Calculation | |
| 574 | // Input byte(06H) integer(X) integer(Y) integer(Z) | |
| 575 | // Output integer(H) integer(V) integer(M) | |
| 784 | ////////////////////////////////////////////////////////////////// | |
| 576 | 785 | |
| 577 | static void DSP1_Project(INT16 X, INT16 Y, INT16 Z, INT16 *H, INT16 *V, UINT16 *M) | |
| 786 | // Same than 'objectiveA', but for the 'C' attitude | |
| 787 | ||
| 788 | static void DSP1_objectiveC(INT16 *input, INT16 *output) | |
| 578 | 789 | { |
| 579 | double Px, Py, Pz, Px1, Py1, Pz1, Px2, Py2, Pz2; | |
| 580 | INT32 dTan; | |
| 790 | INT16 X = input[0]; | |
| 791 | INT16 Y = input[1]; | |
| 792 | INT16 Z = input[2]; | |
| 793 | INT16* F = &output[0]; | |
| 794 | INT16* L = &output[1]; | |
| 795 | INT16* U = &output[2]; | |
| 581 | 796 | |
| 582 | Px = X - FxParm; | |
| 583 | Py = Y - FyParm; | |
| 584 | Pz = Z - FzParm; | |
| 797 | *F = (shared.MatrixC[0][0] * X >> 15) + (shared.MatrixC[1][0] * Y >> 15) + (shared.MatrixC[2][0] * Z >> 15); | |
| 798 | *L = (shared.MatrixC[0][1] * X >> 15) + (shared.MatrixC[1][1] * Y >> 15) + (shared.MatrixC[2][1] * Z >> 15); | |
| 799 | *U = (shared.MatrixC[0][2] * X >> 15) + (shared.MatrixC[1][2] * Y >> 15) + (shared.MatrixC[2][2] * Z >> 15); | |
| 800 | } | |
| 585 | 801 | |
| 586 | // rotate around the Z axis | |
| 587 | dTan = Angle(-AasParm+32768); | |
| 588 | Px1 = (Px*Cos(dTan)+Py*-Sin(dTan)); | |
| 589 | Py1 = (Px*Sin(dTan)+Py*Cos(dTan)); | |
| 590 | Pz1 = Pz; | |
| 802 | ////////////////////////////////////////////////////////////////// | |
| 591 | 803 | |
| 592 | // rotate around the X axis | |
| 593 | dTan = Angle(-AzsParm); | |
| 594 | Px2 = Px1; | |
| 595 | Py2 = (Py1*Cos(dTan)+Pz1*-Sin(dTan)); | |
| 596 | Pz2 = (Py1*Sin(dTan)+Pz1*Cos(dTan)); | |
| 804 | // Convert object coordinates (F,L,U) to object coordinates (X,Y,Z) | |
| 805 | // See the comment in "attitudeA" for a explanation about the calculation. | |
| 806 | // | |
| 807 | // input[0]: F ; input[1]: L ; input[2]: U | |
| 808 | // &output[0]: X ; &output[1]: Y ; &output[2]: Z | |
| 597 | 809 | |
| 598 | Pz2 = Pz2-LfeParm; | |
| 810 | static void DSP1_subjectiveA(INT16 *input, INT16 *output) | |
| 811 | { | |
| 812 | INT16 F = input[0]; | |
| 813 | INT16 L = input[1]; | |
| 814 | INT16 U = input[2]; | |
| 815 | INT16* X = &output[0]; | |
| 816 | INT16* Y = &output[1]; | |
| 817 | INT16* Z = &output[2]; | |
| 599 | 818 | |
| 600 | if (Pz2 < 0) | |
| 601 | { | |
| 602 | double dM; | |
| 819 | *X = (shared.MatrixA[0][0] * F >> 15) + (shared.MatrixA[0][1] * L >> 15) + (shared.MatrixA[0][2] * U >> 15); | |
| 820 | *Y = (shared.MatrixA[1][0] * F >> 15) + (shared.MatrixA[1][1] * L >> 15) + (shared.MatrixA[1][2] * U >> 15); | |
| 821 | *Z = (shared.MatrixA[2][0] * F >> 15) + (shared.MatrixA[2][1] * L >> 15) + (shared.MatrixA[2][2] * U >> 15); | |
| 822 | } | |
| 603 | 823 | |
| 604 | *H = (INT16)(-Px2*LesParm/-Pz2); | |
| 605 | *V = (INT16)(-Py2*LesParm/-Pz2); | |
| 824 | ////////////////////////////////////////////////////////////////// | |
| 606 | 825 | |
| 607 | dM = (double)LesParm; | |
| 608 | dM *= 256.0; | |
| 609 | dM /= -Pz2; | |
| 826 | // Same than 'subjectiveA', but for the 'B' attitude | |
| 610 | 827 | |
| 611 | if (dM > 65535.0) | |
| 612 | { | |
| 613 | dM = 65535.0; | |
| 614 | } | |
| 615 | else if (dM < 0.0) | |
| 616 | { | |
| 617 | dM = 0.0; | |
| 618 | } | |
| 828 | static void DSP1_subjectiveB(INT16 *input, INT16 *output) | |
| 829 | { | |
| 830 | INT16 F = input[0]; | |
| 831 | INT16 L = input[1]; | |
| 832 | INT16 U = input[2]; | |
| 833 | INT16* X = &output[0]; | |
| 834 | INT16* Y = &output[1]; | |
| 835 | INT16* Z = &output[2]; | |
| 619 | 836 | |
| 620 | *M = (UINT16)dM; | |
| 621 | } | |
| 622 | else | |
| 623 | { | |
| 624 | *H = 0; | |
| 625 | *V = 224; | |
| 626 | *M = 65535; | |
| 627 | } | |
| 837 | *X = (shared.MatrixB[0][0] * F >> 15) + (shared.MatrixB[0][1] * L >> 15) + (shared.MatrixB[0][2] * U >> 15); | |
| 838 | *Y = (shared.MatrixB[1][0] * F >> 15) + (shared.MatrixB[1][1] * L >> 15) + (shared.MatrixB[1][2] * U >> 15); | |
| 839 | *Z = (shared.MatrixB[2][0] * F >> 15) + (shared.MatrixB[2][1] * L >> 15) + (shared.MatrixB[2][2] * U >> 15); | |
| 628 | 840 | } |
| 629 | 841 | |
| 630 | // 0AH - Raster Data Calculation (Bit Perfect) | |
| 631 | // Input byte(0AH) integer(Vs) | |
| 632 | // Output integer(An) integer(Bn) integer(Cn) integer(Dn) | |
| 842 | ////////////////////////////////////////////////////////////////// | |
| 633 | 843 | |
| 634 | static void DSP1_Raster(INT16 Vs, INT16 *An, INT16 *Bn, INT16 *Cn, INT16 *Dn) | |
| 844 | // Same than 'subjectiveA', but for the 'C' attitude | |
| 845 | ||
| 846 | static void DSP1_subjectiveC(INT16 *input, INT16 *output) | |
| 635 | 847 | { |
| 636 | INT16 C, E, C1, E1; | |
| 848 | INT16 F = input[0]; | |
| 849 | INT16 L = input[1]; | |
| 850 | INT16 U = input[2]; | |
| 851 | INT16* X = &output[0]; | |
| 852 | INT16* Y = &output[1]; | |
| 853 | INT16* Z = &output[2]; | |
| 637 | 854 | |
| 638 | DSP1_Inverse((Vs * SinAzs >> 15) + VOffset, 7, &C, &E); | |
| 639 | E += VPlane_E; | |
| 855 | *X = (shared.MatrixC[0][0] * F >> 15) + (shared.MatrixC[0][1] * L >> 15) + (shared.MatrixC[0][2] * U >> 15); | |
| 856 | *Y = (shared.MatrixC[1][0] * F >> 15) + (shared.MatrixC[1][1] * L >> 15) + (shared.MatrixC[1][2] * U >> 15); | |
| 857 | *Z = (shared.MatrixC[2][0] * F >> 15) + (shared.MatrixC[2][1] * L >> 15) + (shared.MatrixC[2][2] * U >> 15); | |
| 858 | } | |
| 640 | 859 | |
| 641 | C1 = C * VPlane_C >> 15; | |
| 642 | E1 = E + SecAZS_E2; | |
| 860 | ////////////////////////////////////////////////////////////////// | |
| 643 | 861 | |
| 644 | DSP1_Normalize(C1, &C, &E); | |
| 862 | // This command calculates the inner product (S) of a vector (X,Y,Z) and | |
| 863 | // the first column of MatrixA. It should be noted that that first column | |
| 864 | // represent the global coordinates of an unity vector in the forward | |
| 865 | // direction in the object coordinate system (coordinates (1,0,0) in the FLU | |
| 866 | // axes system). | |
| 867 | // | |
| 868 | // input[0]: X ; input[1]: Y ; input[2]: Z | |
| 869 | // &output[0]: S | |
| 645 | 870 | |
| 646 | C = DSP1_Truncate(C, E); | |
| 871 | static void DSP1_scalarA(INT16 *input, INT16 *output) | |
| 872 | { | |
| 873 | INT16 X = input[0]; | |
| 874 | INT16 Y = input[1]; | |
| 875 | INT16 Z = input[2]; | |
| 876 | INT16* S = &output[0]; | |
| 647 | 877 | |
| 648 | *An = C * CosAas >> 15; | |
| 649 | *Cn = C * SinAas >> 15; | |
| 878 | *S = (X * shared.MatrixA[0][0] + Y * shared.MatrixA[1][0] + Z * shared.MatrixA[2][0]) >> 15; | |
| 879 | } | |
| 650 | 880 | |
| 651 | ||
| 881 | ////////////////////////////////////////////////////////////////// | |
| 652 | 882 | |
| 653 | ||
| 883 | // | |
| 654 | 884 | |
| 655 | *Bn = C * -SinAas >> 15; | |
| 656 | *Dn = C * CosAas >> 15; | |
| 885 | static void DSP1_scalarB(INT16 *input, INT16 *output) | |
| 886 | { | |
| 887 | INT16 X = input[0]; | |
| 888 | INT16 Y = input[1]; | |
| 889 | INT16 Z = input[2]; | |
| 890 | INT16* S = &output[0]; | |
| 891 | ||
| 892 | *S = (X * shared.MatrixB[0][0] + Y * shared.MatrixB[1][0] + Z * shared.MatrixB[2][0]) >> 15; | |
| 657 | 893 | } |
| 658 | 894 | |
| 659 | // 0EH - Coordinate Calculation of a Selected Point on the Screen (Bit Perfect) | |
| 660 | // Input byte(0EH) integer(H) integer(V) | |
| 661 | // Output integer(X) integer(Y) | |
| 895 | ////////////////////////////////////////////////////////////////// | |
| 662 | 896 | |
| 663 | static void DSP1_Target(INT16 H, INT16 V, INT16 *X, INT16 *Y) | |
| 897 | // Same than 'scalarA', but for the 'C' attitude | |
| 898 | ||
| 899 | static void DSP1_scalarC(INT16 *input, INT16 *output) | |
| 664 | 900 | { |
| 665 | INT16 C, E, C1, E1; | |
| 901 | INT16 X = input[0]; | |
| 902 | INT16 Y = input[1]; | |
| 903 | INT16 Z = input[2]; | |
| 904 | INT16* S = &output[0]; | |
| 666 | 905 | |
| 667 | DSP1_Inverse((V * SinAzs >> 15) + VOffset, 8, &C, &E); | |
| 668 | E += VPlane_E; | |
| 906 | *S = (X * shared.MatrixC[0][0] + Y * shared.MatrixC[1][0] + Z * shared.MatrixC[2][0]) >> 15; | |
| 907 | } | |
| 669 | 908 | |
| 670 | C1 = C * VPlane_C >> 15; | |
| 671 | E1 = E + SecAZS_E1; | |
| 909 | ////////////////////////////////////////////////////////////////// | |
| 672 | 910 | |
| 673 | H <<= 8; | |
| 911 | // This command determines the final attitude angles after the body with attitude angles (Ax, Ay, Az) with | |
| 912 | // respect to the global coordinates is rotated by the minor angular displacements (DeltaF, DeltaL, DeltaU). | |
| 913 | // It means that the XYZ axes are rotated by (Ax, Ay, Az) to obtain the FLU axes and, then, these | |
| 914 | // are rotated by (DeltaF, DeltaL, DeltaU). The command calculates and return the new FLU angles respect to the | |
| 915 | // XYZ system (Rx, Ry, Rz) | |
| 916 | // The formulae are: | |
| 917 | // Rx = Ax + (DeltaU*sin(Ay)+DeltaF*cos(Ay)) | |
| 918 | // Ry = Ay + DeltaL - tan(Ax)*(DeltaU*cos(Ay)+DeltaF*sin(Ay)) | |
| 919 | // Rz = Az + sec(Ax)*(DeltaU*cos(Ay)-DeltaF*sin(Ay)) | |
| 920 | // | |
| 921 | // Now the discussion: according to the official documentation, as described in various commands, you pass from | |
| 922 | // XYZ to FLU by doing the rotations in the order Y, X, Z. In this command, the formulae are coherent with the | |
| 923 | // fact that Y is the first axis to do a rotation around it. However, in the "attitude" command, while the official | |
| 924 | // document describe it that way, we have discovered, when reverse engineering the command, that the calculated | |
| 925 | // matrix do the rotation around Y in the second place. This incoherent behaviour of various commands is, in my | |
| 926 | // opinion, a pretty severe implementation error. However, if you only use small "minor displacements", the error term | |
| 927 | // introduced by that incoherence should be almost negligible. | |
| 674 | 928 | |
| 675 | DSP1_Normalize(C1, &C, &E); | |
| 929 | static void DSP1_gyrate(INT16 *input, INT16 *output) | |
| 930 | { | |
| 931 | INT16 Az = input[0]; | |
| 932 | INT16 Ax = input[1]; | |
| 933 | INT16 Ay = input[2]; | |
| 934 | INT16 U = input[3]; | |
| 935 | INT16 F = input[4]; | |
| 936 | INT16 L = input[5]; | |
| 937 | INT16* Rz = &output[0]; | |
| 938 | INT16* Rx = &output[1]; | |
| 939 | INT16* Ry = &output[2]; | |
| 676 | 940 | |
| 677 | C = DSP1_Truncate(C, E) * H >> 15; | |
| 941 | INT16 CSec, ESec, CSin, C, E; | |
| 942 | INT16 SinAy = DSP1_sin(Ay); | |
| 943 | INT16 CosAy = DSP1_cos(Ay); | |
| 678 | 944 | |
| 679 | *X = CentreX + (C * CosAas >> 15); | |
| 680 | *Y = CentreY - (C * SinAas >> 15); | |
| 945 | inverse(DSP1_cos(Ax), 0, &CSec, &ESec); | |
| 681 | 946 | |
| 682 | V <<= 8; | |
| 947 | // Rotation Around Z | |
| 948 | normalizeDouble(U * CosAy - F * SinAy, &C, &E); | |
| 683 | 949 | |
| 684 | ||
| 950 | ||
| 685 | 951 | |
| 686 | ||
| 952 | ||
| 687 | 953 | |
| 688 | *X += C * -SinAas >> 15; | |
| 689 | *Y += C * CosAas >> 15; | |
| 954 | *Rz = Az + denormalizeAndClip(C, E); | |
| 955 | ||
| 956 | // Rotation Around X | |
| 957 | *Rx = Ax + (U * SinAy >> 15) + (F * CosAy >> 15); | |
| 958 | ||
| 959 | // Rotation Around Y | |
| 960 | normalizeDouble(U * CosAy + F * SinAy, &C, &E); | |
| 961 | ||
| 962 | E = ESec - E; | |
| 963 | ||
| 964 | normalize(DSP1_sin(Ax), &CSin, &E); | |
| 965 | ||
| 966 | normalize(-(C * (CSec * CSin >> 15) >> 15), &C, &E); | |
| 967 | ||
| 968 | *Ry = Ay + denormalizeAndClip(C, E) + L; | |
| 690 | 969 | } |
| 691 | 970 | |
| 692 | // 01H - Set Attitude A (Bit Perfect) | |
| 693 | // Input byte(01H) integer(M) integer(Az) integer(Ay) integer(Ax) | |
| 694 | // Output None | |
| 971 | ////////////////////////////////////////////////////////////////// | |
| 695 | 972 | |
| 696 | static INT16 MatrixA[3][3]; | |
| 973 | static const INT16 DSP1_MaxAZS_Exp[16] = { | |
| 974 | 0x38b4, 0x38b7, 0x38ba, 0x38be, 0x38c0, 0x38c4, 0x38c7, 0x38ca, | |
| 975 | 0x38ce, 0x38d0, 0x38d4, 0x38d7, 0x38da, 0x38dd, 0x38e0, 0x38e4 | |
| 976 | }; | |
| 697 | 977 | |
| 698 | static void DSP1_Attitude_A(INT16 M, INT16 Az, INT16 Ay, INT16 Ax) | |
| 978 | ////////////////////////////////////////////////////////////////// | |
| 979 | ||
| 980 | ||
| 981 | // Set-up the projection framework. Besides returning some values, it store in RAM some values that | |
| 982 | // will be used by the other three projection commands (raster, target an project) | |
| 983 | // Input: | |
| 984 | // (Fx, Fy, Fz)-> coordinates of base point (global coordinates) | |
| 985 | // Lfe-> distance between the base point and the viewpoint (center of projection) | |
| 986 | // Les-> distance between the base point and the screen | |
| 987 | // Aas-> azimuth angle (0 degrees is east; 90 degrees is north) | |
| 988 | // Azs-> zenith angle (0 degrees is zenith) | |
| 989 | // Output: | |
| 990 | // Vof-> raster line of imaginary center (whatever it means ;) ) | |
| 991 | // Vva-> raster line representing the horizon line | |
| 992 | // (Cx, Cy)-> coordinates of the projection of the center of the screen over the ground (ground coordinates) | |
| 993 | ||
| 994 | static void DSP1_parameter(INT16 *input, INT16 *output) | |
| 699 | 995 | { |
| 700 | INT16 SinAz = DSP1_Sin(Az); | |
| 701 | INT16 CosAz = DSP1_Cos(Az); | |
| 702 | INT16 SinAy = DSP1_Sin(Ay); | |
| 703 | INT16 CosAy = DSP1_Cos(Ay); | |
| 704 | INT16 SinAx = DSP1_Sin(Ax); | |
| 705 | INT16 CosAx = DSP1_Cos(Ax); | |
| 996 | INT16 Fx = input[0]; | |
| 997 | INT16 Fy = input[1]; | |
| 998 | INT16 Fz = input[2]; | |
| 999 | INT16 Lfe = input[3]; | |
| 1000 | INT16 Les = input[4]; | |
| 1001 | INT16 Aas = input[5]; | |
| 1002 | INT16 Azs = input[6]; | |
| 1003 | INT16* Vof = &output[0]; | |
| 1004 | INT16* Vva = &output[1]; | |
| 1005 | INT16* Cx = &output[2]; | |
| 1006 | INT16* Cy = &output[3]; | |
| 706 | 1007 | |
| 707 | M >>= 1; | |
| 1008 | INT16 CSec, C, E; | |
| 1009 | INT16 LfeNx, LfeNy, LfeNz; | |
| 1010 | INT16 LesNx, LesNy, LesNz; | |
| 1011 | INT16 AZS, MaxAZS; | |
| 708 | 1012 | |
| 709 | MatrixA[0][0] = (M * CosAz >> 15) * CosAy >> 15; | |
| 710 | MatrixA[0][1] = -((M * SinAz >> 15) * CosAy >> 15); | |
| 711 | MatrixA[0][2] = M * SinAy >> 15; | |
| 1013 | // Copy Zenith angle for clipping | |
| 1014 | AZS = Azs; | |
| 712 | 1015 | |
| 713 | MatrixA[1][0] = ((M * SinAz >> 15) * CosAx >> 15) + (((M * CosAz >> 15) * SinAx >> 15) * SinAy >> 15); | |
| 714 | MatrixA[1][1] = ((M * CosAz >> 15) * CosAx >> 15) - (((M * SinAz >> 15) * SinAx >> 15) * SinAy >> 15); | |
| 715 | MatrixA[1][2] = -((M * SinAx >> 15) * CosAy >> 15); | |
| 1016 | // Store Les and his coefficient and exponent when normalized | |
| 1017 | shared.Les = Les; | |
| 1018 | shared.E_Les=0; | |
| 1019 | normalize(Les, &shared.C_Les, &shared.E_Les); | |
| 716 | 1020 | |
| 717 | MatrixA[2][0] = ((M * SinAz >> 15) * SinAx >> 15) - (((M * CosAz >> 15) * CosAx >> 15) * SinAy >> 15); | |
| 718 | MatrixA[2][1] = ((M * CosAz >> 15) * SinAx >> 15) + (((M * SinAz >> 15) * CosAx >> 15) * SinAy >> 15); | |
| 719 | MatrixA[2][2] = (M * CosAx >> 15) * CosAy >> 15; | |
| 720 | } | |
| 1021 | // Store Sine and Cosine of Azimuth and Zenith angle | |
| 1022 | shared.SinAas = DSP1_sin(Aas); | |
| 1023 | shared.CosAas = DSP1_cos(Aas); | |
| 1024 | shared.SinAzs = DSP1_sin(Azs); | |
| 1025 | shared.CosAzs = DSP1_cos(Azs); | |
| 721 | 1026 | |
| 722 | // 11H - Set Attitude B (Bit Perfect) | |
| 723 | // Input byte(11H) integer(M) integer(Az) integer(Ay) integer(Ax) | |
| 724 | // Output None | |
| 1027 | // normal vector to the screen (norm 1, points toward the center of projection) | |
| 1028 | shared.Nx = shared.SinAzs * -shared.SinAas >> 15; | |
| 1029 | shared.Ny = shared.SinAzs * shared.CosAas >> 15; | |
| 1030 | shared.Nz = shared.CosAzs * 0x7fff >> 15; | |
| 725 | 1031 | |
| 726 | static INT16 MatrixB[3][3]; | |
| 1032 | // horizontal vector of the screen (Hz=0, norm 1, points toward the right of the screen) | |
| 1033 | shared.Hx = shared.CosAas*0x7fff>>15; | |
| 1034 | shared.Hy = shared.SinAas*0x7fff>>15; | |
| 727 | 1035 | |
| 728 | static void DSP1_Attitude_B(INT16 M, INT16 Az, INT16 Ay, INT16 Ax) | |
| 729 | { | |
| 730 | INT16 SinAz = DSP1_Sin(Az); | |
| 731 | INT16 CosAz = DSP1_Cos(Az); | |
| 732 | INT16 SinAy = DSP1_Sin(Ay); | |
| 733 | INT16 CosAy = DSP1_Cos(Ay); | |
| 734 | INT16 SinAx = DSP1_Sin(Ax); | |
| 735 | INT16 CosAx = DSP1_Cos(Ax); | |
| 1036 | // vertical vector of the screen (norm 1, points toward the top of the screen) | |
| 1037 | shared.Vx = shared.CosAzs*-shared.SinAas>>15; | |
| 1038 | shared.Vy = shared.CosAzs*shared.CosAas>>15; | |
| 1039 | shared.Vz = -shared.SinAzs*0x7fff>>15; | |
| 736 | 1040 | |
| 737 | M >>= 1; | |
| 1041 | LfeNx = Lfe*shared.Nx>>15; | |
| 1042 | LfeNy = Lfe*shared.Ny>>15; | |
| 1043 | LfeNz = Lfe*shared.Nz>>15; | |
| 738 | 1044 | |
| 739 | MatrixB[0][0] = (M * CosAz >> 15) * CosAy >> 15; | |
| 740 | MatrixB[0][1] = -((M * SinAz >> 15) * CosAy >> 15); | |
| 741 | MatrixB[0][2] = M * SinAy >> 15; | |
| 1045 | // Center of Projection | |
| 1046 | shared.CentreX = Fx+LfeNx; | |
| 1047 | shared.CentreY = Fy+LfeNy; | |
| 1048 | shared.CentreZ = Fz+LfeNz; | |
| 742 | 1049 | |
| 743 | MatrixB[1][0] = ((M * SinAz >> 15) * CosAx >> 15) + (((M * CosAz >> 15) * SinAx >> 15) * SinAy >> 15); | |
| 744 | MatrixB[1][1] = ((M * CosAz >> 15) * CosAx >> 15) - (((M * SinAz >> 15) * SinAx >> 15) * SinAy >> 15); | |
| 745 | MatrixB[1][2] = -((M * SinAx >> 15) * CosAy >> 15); | |
| 1050 | LesNx = Les*shared.Nx>>15; | |
| 1051 | LesNy = Les*shared.Ny>>15; | |
| 1052 | LesNz = Les*shared.Nz>>15; | |
| 746 | 1053 | |
| 747 | MatrixB[2][0] = ((M * SinAz >> 15) * SinAx >> 15) - (((M * CosAz >> 15) * CosAx >> 15) * SinAy >> 15); | |
| 748 | MatrixB[2][1] = ((M * CosAz >> 15) * SinAx >> 15) + (((M * SinAz >> 15) * CosAx >> 15) * SinAy >> 15); | |
| 749 | MatrixB[2][2] = (M * CosAx >> 15) * CosAy >> 15; | |
| 750 | } | |
| 1054 | // center of the screen (global coordinates) | |
| 1055 | shared.Gx=shared.CentreX-LesNx; | |
| 1056 | shared.Gy=shared.CentreY-LesNy; | |
| 1057 | shared.Gz=shared.CentreZ-LesNz; | |
| 751 | 1058 | |
| 752 | // 21H - Set Attitude C (Bit Perfect) | |
| 753 | // Input byte(21H) integer(M) integer(Az) integer(Ay) integer(Ax) | |
| 754 | // Output None | |
| 755 | 1059 | |
| 756 | static INT16 MatrixC[3][3]; | |
| 1060 | E = 0; | |
| 1061 | normalize(shared.CentreZ, &C, &E); | |
| 757 | 1062 | |
| 758 | #ifdef UNUSED_FUNCTION | |
| 759 | static void DSP1_Attitude_C(INT16 M, INT16 Az, INT16 Ay, INT16 Ax) | |
| 760 | { | |
| 761 | INT16 SinAz = DSP1_Sin(Az); | |
| 762 | INT16 CosAz = DSP1_Cos(Az); | |
| 763 | INT16 SinAy = DSP1_Sin(Ay); | |
| 764 | INT16 CosAy = DSP1_Cos(Ay); | |
| 765 | INT16 SinAx = DSP1_Sin(Ax); | |
| 766 | INT16 CosAx = DSP1_Cos(Ax); | |
| 1063 | shared.CentreZ_C = C; | |
| 1064 | shared.CentreZ_E = E; | |
| 767 | 1065 | |
| 768 | M >>= 1; | |
| 1066 | // Determine clip boundary and clip Zenith angle if necessary | |
| 1067 | // (Why to clip? Maybe to avoid the screen can only show sky with no ground? Only a guess...) | |
| 1068 | MaxAZS = DSP1_MaxAZS_Exp[-E]; | |
| 769 | 1069 | |
| 770 | MatrixC[0][0] = (M * CosAz >> 15) * CosAy >> 15; | |
| 771 | MatrixC[0][1] = -((M * SinAz >> 15) * CosAy >> 15); | |
| 772 | MatrixC[0][2] = M * SinAy >> 15; | |
| 1070 | if (AZS < 0) { | |
| 1071 | MaxAZS = -MaxAZS; | |
| 1072 | if (AZS < MaxAZS + 1) AZS = MaxAZS + 1; | |
| 1073 | } else { | |
| 1074 | if (AZS > MaxAZS) AZS = MaxAZS; | |
| 1075 | } | |
| 773 | 1076 | |
| 774 | MatrixC[1][0] = ((M * SinAz >> 15) * CosAx >> 15) + (((M * CosAz >> 15) * SinAx >> 15) * SinAy >> 15); | |
| 775 | MatrixC[1][1] = ((M * CosAz >> 15) * CosAx >> 15) - (((M * SinAz >> 15) * SinAx >> 15) * SinAy >> 15); | |
| 776 | MatrixC[1][2] = -((M * SinAx >> 15) * CosAy >> 15); | |
| 1077 | // Store Sine and Cosine of clipped Zenith angle | |
| 1078 | shared.SinAZS = DSP1_sin(AZS); | |
| 1079 | shared.CosAZS = DSP1_cos(AZS); | |
| 777 | 1080 | |
| 778 | MatrixC[2][0] = ((M * SinAz >> 15) * SinAx >> 15) - (((M * CosAz >> 15) * CosAx >> 15) * SinAy >> 15); | |
| 779 | MatrixC[2][1] = ((M * CosAz >> 15) * SinAx >> 15) + (((M * SinAz >> 15) * CosAx >> 15) * SinAy >> 15); | |
| 780 | MatrixC[2][2] = (M * CosAx >> 15) * CosAy >> 15; | |
| 781 | } | |
| 782 | #endif | |
| 1081 | // calculate the separation of (cx, cy) from the projection of | |
| 1082 | // the 'centre of projection' over the ground... (CentreZ*tg(AZS)) | |
| 1083 | inverse(shared.CosAZS, 0, &shared.SecAZS_C1, &shared.SecAZS_E1); | |
| 1084 | normalize(C * shared.SecAZS_C1 >> 15, &C, &E); | |
| 1085 | E += shared.SecAZS_E1; | |
| 1086 | C = denormalizeAndClip(C, E) * shared.SinAZS >> 15; | |
| 783 | 1087 | |
| 784 | // 0DH - Convert from Global to Object Coordinates A (Bit Perfect) | |
| 785 | // Input byte(0DH) integer(X) integer(Y) integer(Z) | |
| 786 | // Output integer(F) integer(L) integer(U) | |
| 1088 | // ... and then take into account the position of the centre of | |
| 1089 | // projection and the azimuth angle | |
| 1090 | shared.CentreX += C * shared.SinAas >> 15; | |
| 1091 | shared.CentreY -= C * shared.CosAas >> 15; | |
| 787 | 1092 | |
| 788 | static void DSP1_Objective_A(INT16 X, INT16 Y, INT16 Z, INT16 *F, INT16 *L, INT16 *U) | |
| 789 | { | |
| 790 | *F = (X * MatrixA[0][0] >> 15) + (Y * MatrixA[0][1] >> 15) + (Z * MatrixA[0][2] >> 15); | |
| 791 | *L = (X * MatrixA[1][0] >> 15) + (Y * MatrixA[1][1] >> 15) + (Z * MatrixA[1][2] >> 15); | |
| 792 | *U = (X * MatrixA[2][0] >> 15) + (Y * MatrixA[2][1] >> 15) + (Z * MatrixA[2][2] >> 15); | |
| 793 | } | |
| 1093 | *Cx = shared.CentreX; | |
| 1094 | *Cy = shared.CentreY; | |
| 794 | 1095 | |
| 795 | // 1DH - Convert from Global to Object Coordinates B (Bit Perfect) | |
| 796 | // Input byte(1DH) integer(X) integer(Y) integer(Z) | |
| 797 | // Output integer(F) integer(L) integer(U) | |
| 1096 | // Raster number of imaginary center and horizontal line | |
| 1097 | *Vof = 0; | |
| 798 | 1098 | |
| 799 | void DSP1_Objective_B(INT16 X, INT16 Y, INT16 Z, INT16 *F, INT16 *L, INT16 *U) | |
| 800 | { | |
| 801 | *F = (X * MatrixB[0][0] >> 15) + (Y * MatrixB[0][1] >> 15) + (Z * MatrixB[0][2] >> 15); | |
| 802 | *L = (X * MatrixB[1][0] >> 15) + (Y * MatrixB[1][1] >> 15) + (Z * MatrixB[1][2] >> 15); | |
| 803 | *U = (X * MatrixB[2][0] >> 15) + (Y * MatrixB[2][1] >> 15) + (Z * MatrixB[2][2] >> 15); | |
| 804 | } | |
| 1099 | if ((Azs != AZS) || (Azs == MaxAZS)) | |
| 1100 | { | |
| 1101 | INT16 Aux; | |
| 805 | 1102 | |
| 806 | // 2DH - Convert from Global to Object Coordinates C (Bit Perfect) | |
| 807 | // Input byte(2DH) integer(X) integer(Y) integer(Z) | |
| 808 | // Output integer(F) integer(L) integer(U) | |
| 1103 | // correct vof and vva when Azs is outside the 'non-clipping interval' | |
| 1104 | // we have only some few Taylor coefficients, so we cannot guess which ones | |
| 1105 | // are the approximated functions and, what is worse, we don't know why | |
| 1106 | // the own clipping stuff (and, particularly, this correction) is done | |
| 1107 | if (Azs == -32768) Azs = -32767; | |
| 809 | 1108 | |
| 810 | static void DSP1_Objective_C(INT16 X, INT16 Y, INT16 Z, INT16 *F, INT16 *L, INT16 *U) | |
| 811 | { | |
| 812 | *F = (X * MatrixC[0][0] >> 15) + (Y * MatrixC[0][1] >> 15) + (Z * MatrixC[0][2] >> 15); | |
| 813 | *L = (X * MatrixC[1][0] >> 15) + (Y * MatrixC[1][1] >> 15) + (Z * MatrixC[1][2] >> 15); | |
| 814 | *U = (X * MatrixC[2][0] >> 15) + (Y * MatrixC[2][1] >> 15) + (Z * MatrixC[2][2] >> 15); | |
| 815 | } | |
| 1109 | C = Azs - MaxAZS; | |
| 1110 | if (C >= 0) C--; | |
| 1111 | Aux = ~(C << 2); | |
| 816 | 1112 | |
| 817 | // 03H - Conversion from Object to Global Coordinates A (Bit Perfect) | |
| 818 | // Input byte(03H) integer(F) integer(L) integer(U) | |
| 819 | // Output integer(X) integer(Y) integer(Z) | |
| 1113 | // Vof += x+(1/3)*x^3, where x ranges from 0 to PI/4 when Azs-MaxAZS goes from 0 to 0x2000 | |
| 1114 | C = Aux * DSP1_DataRom[0x0328] >> 15; | |
| 1115 | C = (C * Aux >> 15) + DSP1_DataRom[0x0327]; | |
| 1116 | *Vof -= (C * Aux >> 15) * Les >> 15; | |
| 820 | 1117 | |
| 821 | static void DSP1_Subjective_A(INT16 F, INT16 L, INT16 U, INT16 *X, INT16 *Y, INT16 *Z) | |
| 822 | { | |
| 823 | *X = (F * MatrixA[0][0] >> 15) + (L * MatrixA[1][0] >> 15) + (U * MatrixA[2][0] >> 15); | |
| 824 | *Y = (F * MatrixA[0][1] >> 15) + (L * MatrixA[1][1] >> 15) + (U * MatrixA[2][1] >> 15); | |
| 825 | *Z = (F * MatrixA[0][2] >> 15) + (L * MatrixA[1][2] >> 15) + (U * MatrixA[2][2] >> 15); | |
| 826 | } | |
| 1118 | // CosAZS *= 1+(1/2)*x^2+(5/24)*x^24, where x ranges from 0 to PI/4 when Azs-MaxAZS goes from 0 to 0x2000 | |
| 1119 | C = Aux * Aux >> 15; | |
| 1120 | Aux = (C * DSP1_DataRom[0x0324] >> 15) + DSP1_DataRom[0x0325]; | |
| 1121 | shared.CosAZS += (C * Aux >> 15) * shared.CosAZS >> 15; | |
| 1122 | } | |
| 827 | 1123 | |
| 828 | // 13H - Conversion from Object to Global Coordinates B (Bit Perfect) | |
| 829 | // Input byte(13H) integer(F) integer(L) integer(U) | |
| 830 | // Output integer(X) integer(Y) integer(Z) | |
| 1124 | // vertical offset of the screen with regard to the horizontal plane | |
| 1125 | // containing the centre of projection | |
| 1126 | shared.VOffset = Les * shared.CosAZS >> 15; | |
| 831 | 1127 | |
| 832 | static void DSP1_Subjective_B(INT16 F, INT16 L, INT16 U, INT16 *X, INT16 *Y, INT16 *Z) | |
| 833 | { | |
| 834 | *X = (F * MatrixB[0][0] >> 15) + (L * MatrixB[1][0] >> 15) + (U * MatrixB[2][0] >> 15); | |
| 835 | *Y = (F * MatrixB[0][1] >> 15) + (L * MatrixB[1][1] >> 15) + (U * MatrixB[2][1] >> 15); | |
| 836 | *Z = (F * MatrixB[0][2] >> 15) + (L * MatrixB[1][2] >> 15) + (U * MatrixB[2][2] >> 15); | |
| 1128 | // The horizon line (the line in the screen that is crossed by the horizon plane | |
| 1129 | // -the horizontal plane containing the 'centre of projection'-), | |
| 1130 | // will be at distance Les*cotg(AZS) from the centre of the screen. This is difficult | |
| 1131 | // to explain but easily seen in a graph. To better see it, consider it in this way: | |
| 1132 | // Les*tg(AZS-90), draw some lines and apply basic trigonometry. ;) | |
| 1133 | inverse(shared.SinAZS, 0, &CSec, &E); | |
| 1134 | normalize(shared.VOffset, &C, &E); | |
| 1135 | normalize(C * CSec >> 15, &C, &E); | |
| 1136 | ||
| 1137 | if (C == -32768) { C >>= 1; E++; } | |
| 1138 | ||
| 1139 | *Vva = denormalizeAndClip(-C, E); | |
| 1140 | ||
| 1141 | // Store Secant of clipped Zenith angle | |
| 1142 | inverse(shared.CosAZS, 0, &shared.SecAZS_C2, &shared.SecAZS_E2); | |
| 837 | 1143 | } |
| 838 | 1144 | |
| 839 | // 23H - Conversion from Object to Global Coordinates C (Bit Perfect) | |
| 840 | // Input byte(23H) integer(F) integer(L) integer(U) | |
| 841 | // Output integer(X) integer(Y) integer(Z) | |
| 1145 | ////////////////////////////////////////////////////////////////// | |
| 842 | 1146 | |
| 843 | static void DSP1_Subjective_C(INT16 F, INT16 L, INT16 U, INT16 *X, INT16 *Y, INT16 *Z) | |
| 1147 | // Calculates the matrix which transform an object situated on a raster line (Vs) into | |
| 1148 | // his projection over the ground. The modified SecAZS is used here, so | |
| 1149 | // i don't understand the fine details, but, basically, it's done | |
| 1150 | // this way: The vertical offset between the point of projection and the | |
| 1151 | // raster line is calculated (Vs*SinAzs>>15)+VOffset, then the height of | |
| 1152 | // the center of projection is measured in that units (*CentreZ_C). If, now | |
| 1153 | // you consider the "reference case" (center of projection at an unit of height), | |
| 1154 | // the projection of a thin strip containing the raster line will have the same | |
| 1155 | // width (as the raster line would be on the ground in this case, but will suffer a | |
| 1156 | // change of scale in height (as the ground and the vertical axis would form an angle of 180-Azs degrees). | |
| 1157 | // This scale factor, when the angle 'center of screen-center of projection-raster line' is small, | |
| 1158 | // can be aproximated by the one of the center of the screen, 1/cos(Azs).(**) (Here is when it's used | |
| 1159 | // SecAZS). By last, you have to consider the effect of the azimuth angle Aas, and you are done. | |
| 1160 | // | |
| 1161 | // Using matrix notation: | |
| 1162 | // |A B| Centre_ZS | cos(Aas) -sin(Aas)| |1 0| | |
| 1163 | // ProjectionMatrix = | | = ----------- * | | * | | | |
| 1164 | // |C D| Vs*sin(Azs) |sin(Aas) cos(Aas)| |0 sec(Azs)| | |
| 1165 | // | |
| 1166 | // (**) | |
| 1167 | // If Les=1, the vertical offset between the center | |
| 1168 | // of projection and the center of the screen is Cos(Azs); then, if the vertical | |
| 1169 | // offset is 1, the ratio of the projection over the ground respect to the | |
| 1170 | // line on the screen is 1/cos(Azs). | |
| 1171 | ||
| 1172 | static void DSP1_raster(INT16 *input, INT16 *output) | |
| 844 | 1173 | { |
| 845 | *X = (F * MatrixC[0][0] >> 15) + (L * MatrixC[1][0] >> 15) + (U * MatrixC[2][0] >> 15); | |
| 846 | *Y = (F * MatrixC[0][1] >> 15) + (L * MatrixC[1][1] >> 15) + (U * MatrixC[2][1] >> 15); | |
| 847 | *Z = (F * MatrixC[0][2] >> 15) + (L * MatrixC[1][2] >> 15) + (U * MatrixC[2][2] >> 15); | |
| 848 | } | |
| 1174 | INT16 Vs = input[0]; | |
| 1175 | INT16* An = &output[0]; | |
| 1176 | INT16* Bn = &output[1]; | |
| 1177 | INT16* Cn = &output[2]; | |
| 1178 | INT16* Dn = &output[3]; | |
| 849 | 1179 | |
| 850 | // 0BH - Calculation of Inner Product with Forward Attitude A and a Vector (Bit Perfect) | |
| 851 | // Input byte(0BH) integer(X) integer(Y) integer(Z) | |
| 852 | // Output integer(S) | |
| 1180 | INT16 C, E, C1, E1; | |
| 853 | 1181 | |
| 854 | static void DSP1_Scalar_A(INT16 X, INT16 Y, INT16 Z, INT16 *S) | |
| 855 | { | |
| 856 | *S = ((X * MatrixA[0][0]) + (Y * MatrixA[0][1]) + (Z * MatrixA[0][2])) >> 15; | |
| 1182 | inverse((Vs * shared.SinAzs >> 15) + shared.VOffset, 7, &C, &E); | |
| 1183 | ||
| 1184 | E += shared.CentreZ_E; | |
| 1185 | C1 = C * shared.CentreZ_C >> 15; | |
| 1186 | ||
| 1187 | E1 = E + shared.SecAZS_E2; | |
| 1188 | ||
| 1189 | normalize(C1, &C, &E); | |
| 1190 | C = denormalizeAndClip(C, E); | |
| 1191 | ||
| 1192 | *An = C * shared.CosAas >> 15; | |
| 1193 | *Cn = C * shared.SinAas >> 15; | |
| 1194 | ||
| 1195 | normalize(C1 * shared.SecAZS_C2 >> 15, &C, &E1); | |
| 1196 | C = denormalizeAndClip(C, E1); | |
| 1197 | ||
| 1198 | *Bn = C * -shared.SinAas >> 15; | |
| 1199 | *Dn = C * shared.CosAas >> 15; | |
| 857 | 1200 | } |
| 858 | 1201 | |
| 859 | // 1BH - Calculation of Inner Product with Forward Attitude B and a Vector (Bit Perfect) | |
| 860 | // Input byte(1BH) integer(X) integer(Y) integer(Z) | |
| 861 | // Output integer(S) | |
| 1202 | ////////////////////////////////////////////////////////////////// | |
| 862 | 1203 | |
| 863 | static void DSP1_Scalar_B(INT16 X, INT16 Y, INT16 Z, INT16 *S) | |
| 1204 | // Calculate the projection over the ground of a selected point of screen | |
| 1205 | // It simply apply the projection matrix described in the "Raster" command | |
| 1206 | // to the vector (H,V) transposed, and add the result to the position of | |
| 1207 | // the centre of projection. | |
| 1208 | // The only special point to take into account is the directions on the screen: | |
| 1209 | // H is positive rightward, but V is positive downward; this is why | |
| 1210 | // the signs take that configuration | |
| 1211 | ||
| 1212 | static void DSP1_target(INT16 *input, INT16 *output) | |
| 864 | 1213 | { |
| 865 | *S = ((X * MatrixB[0][0]) + (Y * MatrixB[0][1]) + (Z * MatrixB[0][2])) >> 15; | |
| 866 | } | |
| 1214 | INT16 H = input[0]; | |
| 1215 | INT16 V = input[1]; | |
| 1216 | INT16* X = &output[0]; | |
| 1217 | INT16* Y = &output[1]; | |
| 867 | 1218 | |
| 868 | // 2BH - Calculation of Inner Product with Forward Attitude C and a Vector (Bit Perfect) | |
| 869 | // Input byte(2BH) integer(X) integer(Y) integer(Z) | |
| 870 | // Output integer(S) | |
| 1219 | INT16 C, E, C1, E1; | |
| 871 | 1220 | |
| 872 | static void DSP1_Scalar_C(INT16 X, INT16 Y, INT16 Z, INT16 *S) | |
| 873 | { | |
| 874 | *S = ((X * MatrixC[0][0]) + (Y * MatrixC[0][1]) + (Z * MatrixC[0][2])) >> 15; | |
| 1221 | inverse((V * shared.SinAzs >> 15) + shared.VOffset, 8, &C, &E); | |
| 1222 | ||
| 1223 | E += shared.CentreZ_E; | |
| 1224 | C1 = C * shared.CentreZ_C >> 15; | |
| 1225 | ||
| 1226 | E1 = E + shared.SecAZS_E1; | |
| 1227 | ||
| 1228 | H <<= 8; | |
| 1229 | normalize(C1, &C, &E); | |
| 1230 | C = denormalizeAndClip(C, E) * H >> 15; | |
| 1231 | ||
| 1232 | *X = shared.CentreX + (C * shared.CosAas >> 15); | |
| 1233 | *Y = shared.CentreY - (C * shared.SinAas >> 15); | |
| 1234 | ||
| 1235 | V <<= 8; | |
| 1236 | normalize(C1 * shared.SecAZS_C1 >> 15, &C, &E1); | |
| 1237 | C = denormalizeAndClip(C, E1) * V >> 15; | |
| 1238 | ||
| 1239 | *X += C * -shared.SinAas >> 15; | |
| 1240 | *Y += C * shared.CosAas >> 15; | |
| 875 | 1241 | } |
| 876 | 1242 | |
| 877 | // 14H - 3D Angle Rotation (Bit Perfect) | |
| 878 | // Input byte(14H) integer(Az) integer(Ax) integer(Ay) integer(U) integer(F) integer(L) | |
| 879 | // Output integer(Rz) integer(Rx) integer(Ry) | |
| 1243 | ////////////////////////////////////////////////////////////////// | |
| 880 | 1244 | |
| 881 | static void DSP1_Gyrate(INT16 Az, INT16 Ax, INT16 Ay, INT16 U, INT16 F, INT16 L, INT16 *Rz, INT16 *Rx, INT16 *Ry) | |
| 1245 | // Calculation of the projection over the screen (H,V) of an object (X,Y,Z) and his | |
| 1246 | // 'enlargement ratio' (M). The positive directions on the screen are as described | |
| 1247 | // in the targe command. M is scaled down by 2^-7, that is, M==0x0100 means ratio 1:1 | |
| 1248 | ||
| 1249 | static void DSP1_project(INT16 *input, INT16 *output) | |
| 882 | 1250 | { |
| 883 | INT16 CSec, ESec, CSin, C, E; | |
| 1251 | INT16 X = input[0]; | |
| 1252 | INT16 Y = input[1]; | |
| 1253 | INT16 Z = input[2]; | |
| 1254 | INT16* H = &output[0]; | |
| 1255 | INT16* V = &output[1]; | |
| 1256 | INT16* M = &output[2]; | |
| 884 | 1257 | |
| 885 | DSP1_Inverse(DSP1_Cos(Ax), 0, &CSec, &ESec); | |
| 1258 | INT32 aux, aux4; | |
| 1259 | INT16 E, E2, E3, E4, E5, refE, E6, E7; | |
| 1260 | INT16 C2, C4, C6, C8, C9, C10, C11, C12, C16, C17, C18, C19, C20, C21, C22, C23, C24, C25, C26; | |
| 1261 | INT16 Px, Py, Pz; | |
| 886 | 1262 | |
| 887 | // Rotation Around Z | |
| 888 | DSP1_NormalizeDouble(U * DSP1_Cos(Ay) - F * DSP1_Sin(Ay), &C, &E); | |
| 1263 | E4=E3=E2=E=E5=0; | |
| 889 | 1264 | |
| 890 | E = ESec - E; | |
| 1265 | normalizeDouble((INT32)(X)-shared.Gx, &Px, &E4); | |
| 1266 | normalizeDouble((INT32)(Y)-shared.Gy, &Py, &E); | |
| 1267 | normalizeDouble((INT32)(Z)-shared.Gz, &Pz, &E3); | |
| 1268 | Px>>=1; E4--; // to avoid overflows when calculating the scalar products | |
| 1269 | Py>>=1; E--; | |
| 1270 | Pz>>=1; E3--; | |
| 891 | 1271 | |
| 892 | DSP1_Normalize(C * CSec >> 15, &C, &E); | |
| 1272 | refE = (E<E3)?E:E3; | |
| 1273 | refE = (refE<E4)?refE:E4; | |
| 893 | 1274 | |
| 894 | *Rz = Az + DSP1_Truncate(C, E); | |
| 1275 | Px=shiftR(Px,E4-refE); // normalize them to the same exponent | |
| 1276 | Py=shiftR(Py,E-refE); | |
| 1277 | Pz=shiftR(Pz,E3-refE); | |
| 895 | 1278 | |
| 896 | // Rotation Around X | |
| 897 | *Rx = Ax + (U * DSP1_Sin(Ay) >> 15) + (F * DSP1_Cos(Ay) >> 15); | |
| 1279 | C11=- (Px*shared.Nx>>15); | |
| 1280 | C8=- (Py*shared.Ny>>15); | |
| 1281 | C9=- (Pz*shared.Nz>>15); | |
| 1282 | C12=C11+C8+C9; // this cannot overflow! | |
| 898 | 1283 | |
| 899 | // Rotation Around Y | |
| 900 | DSP1_NormalizeDouble(U * DSP1_Cos(Ay) + F * DSP1_Sin(Ay), &C, &E); | |
| 1284 | aux4=C12; // de-normalization with 32-bits arithmetic | |
| 1285 | refE = 16-refE; // refE can be up to 3 | |
| 1286 | if (refE>=0) | |
| 1287 | aux4 <<=(refE); | |
| 1288 | else | |
| 1289 | aux4 >>=-(refE); | |
| 1290 | if (aux4==-1) aux4 = 0; // why? | |
| 1291 | aux4>>=1; | |
| 901 | 1292 | |
| 902 | E = ESec - E; | |
| 1293 | aux = (UINT16)(shared.Les) + aux4; // Les - the scalar product of P with the normal vector of the screen | |
| 1294 | normalizeDouble(aux, &C10, &E2); | |
| 1295 | E2 = 15-E2; | |
| 903 | 1296 | |
| 904 | DSP1_Normalize(DSP1_Sin(Ax), &CSin, &E); | |
| 1297 | inverse(C10, 0, &C4, &E4); | |
| 1298 | C2=C4*shared.C_Les>>15; // scale factor | |
| 905 | 1299 | |
| 906 | DSP1_Normalize(-(C * (CSec * CSin >> 15) >> 15), &C, &E); | |
| 907 | 1300 | |
| 908 | *Ry = Ay + DSP1_Truncate(C, E) + L; | |
| 909 | } | |
| 1301 | // H | |
| 1302 | E7=0; | |
| 1303 | C16= (Px*shared.Hx>>15); | |
| 1304 | C20= (Py*shared.Hy>>15); | |
| 1305 | C17=C16+C20; // scalar product of P with the normalized horizontal vector of the screen... | |
| 910 | 1306 | |
| 911 | // 0FH - Memory Test (Bit Perfect) | |
| 912 | // Input byte(0FH) integer(Size) | |
| 913 | // Output integer(Result) | |
| 1307 | C18=C17*C2>>15; // ... multiplied by the scale factor | |
| 1308 | normalize(C18, &C19, &E7); | |
| 1309 | *H=denormalizeAndClip(C19, shared.E_Les-E2+refE+E7); | |
| 914 | 1310 | |
| 915 | static void DSP1_MemoryTest(INT16 Size, INT16 *Result) | |
| 916 | { | |
| 917 | *Result = 0x0000; | |
| 1311 | // V | |
| 1312 | E6=0; | |
| 1313 | C21 = Px*shared.Vx>>15; | |
| 1314 | C22 = Py*shared.Vy>>15; | |
| 1315 | C23 = Pz*shared.Vz>>15; | |
| 1316 | C24=C21+C22+C23; // scalar product of P with the normalized vertical vector of the screen... | |
| 1317 | ||
| 1318 | C26=C24*C2>>15; // ... multiplied by the scale factor | |
| 1319 | normalize(C26, &C25, &E6); | |
| 1320 | *V=denormalizeAndClip(C25, shared.E_Les-E2+refE+E6); | |
| 1321 | ||
| 1322 | // M | |
| 1323 | normalize(C2, &C6, &E4); | |
| 1324 | *M=denormalizeAndClip(C6, E4+shared.E_Les-E2-7); // M is the scale factor divided by 2^7 | |
| 918 | 1325 | } |
| 919 | 1326 | |
| 920 | // 2FH - Memory Size Calculation (Bit Perfect) | |
| 921 | // Input byte(2FH) integer(Undefined) | |
| 922 | // Output integer(Size) | |
| 1327 | ////////////////////////////////////////////////////////////////// | |
| 923 | 1328 | |
| 924 | static void DSP1_MemorySize(INT16 *Size) | |
| 1329 | // Calculate the sine of the input parameter | |
| 1330 | // this is done by linear interpolation between | |
| 1331 | // the points of a look-up table | |
| 1332 | ||
| 1333 | static INT16 DSP1_sin(INT16 Angle) | |
| 925 | 1334 | { |
| 926 | *Size = 0x0100; | |
| 1335 | INT32 S; | |
| 1336 | ||
| 1337 | if (Angle < 0) { | |
| 1338 | if (Angle == -32768) return 0; | |
| 1339 | return -sin(-Angle); | |
| 1340 | } | |
| 1341 | S = DSP1_SinTable[Angle >> 8] + (DSP1_MulTable[Angle & 0xff] * DSP1_SinTable[0x40 + (Angle >> 8)] >> 15); | |
| 1342 | if (S > 32767) S = 32767; | |
| 1343 | return (INT16) S; | |
| 927 | 1344 | } |
| 928 | 1345 | |
| 929 | // ******************************************************************************************** | |
| 930 | // MAME/MESS interface for above DSP1 code | |
| 931 | // ******************************************************************************************** | |
| 1346 | ////////////////////////////////////////////////////////////////// | |
| 932 | 1347 | |
| 933 | // DSP1 interface | |
| 934 | static UINT8 dsp1_read(UINT16 address) | |
| 1348 | // Calculate the cosine of the input parameter. | |
| 1349 | // It's used the same method than in sin(INT16) | |
| 1350 | ||
| 1351 | static INT16 DSP1_cos(INT16 Angle) | |
| 935 | 1352 | { |
| 936 | // check data vs. status | |
| 937 | if (((address & 0xf000) == 0x6000) || ((address & 0x7fff) < 0x4000)) | |
| 938 | { | |
| 939 | // data reg | |
| 940 | if (dsp1_out_cnt) | |
| 941 | { | |
| 942 | UINT8 temp = (UINT8)dsp1_out[dsp1_out_idx++]; | |
| 943 | if (--dsp1_out_cnt == 0) | |
| 944 | { | |
| 945 | if ((dsp1_cur_cmd == 0x1a) || (dsp1_cur_cmd == 0x0a)) | |
| 946 | { | |
| 947 | INT16 tr, tr1, tr2, tr3; | |
| 1353 | INT32 S; | |
| 948 | 1354 | |
| 949 | DSP1_Raster(dsp1_in[0]|dsp1_in[1]<<8, &tr, &tr1, &tr2, &tr3); | |
| 950 | dsp1_in[0]++; | |
| 951 | if (dsp1_in[0] == 0) dsp1_in[1]++; | |
| 952 | dsp1_out_cnt = 8; | |
| 953 | dsp1_out[0] = tr&0xff; | |
| 954 | dsp1_out[1] = (tr>>8)&0xff; | |
| 955 | dsp1_out[2] = tr1&0xff; | |
| 956 | dsp1_out[3] = (tr1>>8)&0xff; | |
| 957 | dsp1_out[4] = tr2&0xff; | |
| 958 | dsp1_out[5] = (tr2>>8)&0xff; | |
| 959 | dsp1_out[6] = tr3&0xff; | |
| 960 | dsp1_out[7] = (tr3>>8)&0xff; | |
| 961 | dsp1_out_idx = 0; | |
| 962 | } | |
| 963 | else if (dsp1_cur_cmd == 0x1f) | |
| 964 | { | |
| 965 | if ((dsp1_out_idx % 2) != 0) | |
| 966 | { | |
| 967 | return DSP1ROM[dsp1_out_idx>>1] & 0xff; | |
| 968 | } | |
| 969 | else | |
| 970 | { | |
| 971 | return (DSP1ROM[dsp1_out_idx>>1] >> 8) & 0xff; | |
| 972 | } | |
| 973 | } | |
| 974 | } | |
| 975 | dsp1_waitcmd = 1; | |
| 976 | // printf("dsp_r: %02x\n", temp); | |
| 977 | return temp; | |
| 978 | } | |
| 979 | else | |
| 980 | { | |
| 981 | // printf("dsp_r: %02x\n", 0xff); | |
| 982 | return 0xff; // indicate "no data" | |
| 983 | } | |
| 984 | } | |
| 985 | ||
| 986 | // status register | |
| 987 | // printf("dsp_r: %02x\n", 0x80); | |
| 988 | return 0x80; | |
| 1355 | if (Angle < 0) { | |
| 1356 | if (Angle == -32768) return -32768; | |
| 1357 | Angle = -Angle; | |
| 1358 | } | |
| 1359 | S = DSP1_SinTable[0x40 + (Angle >> 8)] - (DSP1_MulTable[Angle & 0xff] * DSP1_SinTable[Angle >> 8] >> 15); | |
| 1360 | if (S < -32768) S = -32767; | |
| 1361 | return (INT16) S; | |
| 989 | 1362 | } |
| 990 | 1363 | |
| 991 | static void dsp1_write(UINT16 address, UINT8 data) | |
| 992 | { | |
| 993 | // check data vs. status | |
| 994 | if (((address & 0xf000) == 0x6000) || ((address & 0x7fff) < 0x4000)) | |
| 995 | { | |
| 996 | // printf("DSP_w: %02x cmd %02x wait %d dsp1_in_cnt %d\n", data, dsp1_cur_cmd, dsp1_waitcmd, dsp1_in_cnt); | |
| 1364 | ////////////////////////////////////////////////////////////////// | |
| 997 | 1365 | |
| 998 | if (((dsp1_cur_cmd == 0x0a) || (dsp1_cur_cmd == 0x1a)) && (dsp1_out_cnt != 0)) | |
| 999 | { | |
| 1000 | dsp1_out_cnt--; | |
| 1001 | dsp1_out_idx++; | |
| 1002 | return; | |
| 1003 | } | |
| 1004 | else if (dsp1_waitcmd) | |
| 1005 | { | |
| 1006 | dsp1_cur_cmd = data; | |
| 1007 | dsp1_in_idx = 0; | |
| 1008 | dsp1_waitcmd = 0; | |
| 1009 | dsp1_first_parm = 1; | |
| 1010 | switch (data) | |
| 1011 | { | |
| 1012 | case 0x00: dsp1_in_cnt = 2; break; | |
| 1013 | case 0x10: case 0x30: dsp1_in_cnt = 2; break; | |
| 1014 | case 0x20: dsp1_in_cnt = 2; break; | |
| 1015 | case 0x04: case 0x24: dsp1_in_cnt = 2; break; | |
| 1016 | case 0x08: dsp1_in_cnt = 3; break; | |
| 1017 | case 0x18: dsp1_in_cnt = 4; break; | |
| 1018 | case 0x28: dsp1_in_cnt = 3; break; | |
| 1019 | case 0x38: dsp1_in_cnt = 4; break; | |
| 1020 | case 0x0c: case 0x2c: dsp1_in_cnt = 3; break; | |
| 1021 | case 0x1c: case 0x3c: dsp1_in_cnt = 6; break; | |
| 1022 | case 0x02: case 0x12: case 0x22: case 0x32: dsp1_in_cnt = 7; break; | |
| 1023 | case 0x0a: dsp1_in_cnt = 1; break; | |
| 1024 | case 0x1a: case 0x2a: case 0x3a: dsp1_cur_cmd = 0x1a; dsp1_in_cnt = 1; break; | |
| 1025 | case 0x06: case 0x16: case 0x26: case 0x36: dsp1_in_cnt = 3; break; | |
| 1026 | case 0x0e: case 0x1e: case 0x2e: case 0x3e: dsp1_in_cnt = 2; break; | |
| 1027 | case 0x01: case 0x05: case 0x31: case 0x35: dsp1_in_cnt = 4; break; | |
| 1028 | case 0x11: case 0x15: dsp1_in_cnt = 4; break; | |
| 1029 | case 0x21: case 0x25: dsp1_in_cnt = 4; break; | |
| 1030 | case 0x0d: case 0x3d: case 0x09: case 0x39: dsp1_in_cnt = 3; break; | |
| 1031 | case 0x19: case 0x1d: dsp1_in_cnt = 3; break; | |
| 1032 | case 0x29: case 0x2d: dsp1_in_cnt = 3; break; | |
| 1033 | case 0x03: case 0x33: dsp1_in_cnt = 3; break; | |
| 1034 | case 0x13: dsp1_in_cnt = 3; break; | |
| 1035 | case 0x23: dsp1_in_cnt = 3; break; | |
| 1036 | case 0x0b: case 0x3b: dsp1_in_cnt = 3; break; | |
| 1037 | case 0x1b: dsp1_in_cnt = 3; break; | |
| 1038 | case 0x2b: dsp1_in_cnt = 3; break; | |
| 1039 | case 0x14: case 0x34: dsp1_in_cnt = 6; break; | |
| 1040 | case 0x07: case 0x0f: dsp1_in_cnt = 1; break; | |
| 1041 | case 0x27: case 0x2F: dsp1_in_cnt=1; break; | |
| 1042 | case 0x17: case 0x37: case 0x3F: dsp1_cur_cmd = 0x1f; dsp1_in_cnt = 1; break; | |
| 1043 | case 0x1f: dsp1_in_cnt = 1; break; | |
| 1366 | // Determines the inverse of a floating point decimal number | |
| 1367 | // iCoefficient*2^iExponent = 1/(Coefficient*2^Exponent), with the output | |
| 1368 | // normalized (iCoefficient represents a number whose absolute value is between 1/2 and 1) | |
| 1369 | // To invert 'Coefficient' a first initial guess is taken from a look-up table | |
| 1370 | // and, then, two iterations of the Newton method (applied to the function | |
| 1371 | // f(x)=1/(2*x)-Coefficient) are done. This results in a close approximation (iCoefficient) to a number 'y' | |
| 1372 | // that verify Coefficient*y=1/2. This is why you have to correct the exponent by one | |
| 1373 | // unit at the end. | |
| 1044 | 1374 | |
| 1045 | case 0x80: | |
| 1046 | dsp1_in_cnt = 0; | |
| 1047 | dsp1_waitcmd = 1; | |
| 1048 | dsp1_first_parm = 1; | |
| 1049 | break; | |
| 1050 | } | |
| 1375 | static void inverse(INT16 Coefficient, INT16 Exponent, INT16 *iCoefficient, INT16 *iExponent) | |
| 1376 | { | |
| 1377 | // Step One: Division by Zero | |
| 1378 | if (Coefficient == 0x0000) | |
| 1379 | { | |
| 1380 | *iCoefficient = 0x7fff; | |
| 1381 | *iExponent = 0x002f; | |
| 1382 | } | |
| 1383 | else | |
| 1384 | { | |
| 1385 | INT16 Sign = 1; | |
| 1051 | 1386 | |
| 1052 | // that gives us parameter lengths in words, convert to bytes | |
| 1053 | dsp1_in_cnt *= 2; | |
| 1054 | } | |
| 1055 | else | |
| 1056 | { | |
| 1057 | dsp1_in[dsp1_in_idx++] = data; | |
| 1058 | dsp1_first_parm = 0; | |
| 1059 | } | |
| 1387 | // Step Two: Remove Sign | |
| 1388 | if (Coefficient < 0) | |
| 1389 | { | |
| 1390 | if (Coefficient < -32767) Coefficient = -32767; | |
| 1391 | Coefficient = -Coefficient; | |
| 1392 | Sign = -1; | |
| 1393 | } | |
| 1060 | 1394 | |
| 1061 | if ((dsp1_waitcmd) || ((dsp1_first_parm) && (data == 0x80))) | |
| 1062 | { | |
| 1063 | dsp1_waitcmd = 1; | |
| 1064 | dsp1_first_parm = 0; | |
| 1065 | } | |
| 1066 | else if (((dsp1_first_parm) && (dsp1_in_cnt != 0)) || ((dsp1_in_cnt == 0) && (dsp1_in_idx == 0))) | |
| 1067 | { | |
| 1068 | } | |
| 1069 | else | |
| 1070 | { | |
| 1071 | if (dsp1_in_cnt) | |
| 1072 | { | |
| 1073 | if (--dsp1_in_cnt == 0) | |
| 1074 | { | |
| 1075 | INT16 tr = 0, tr1 = 0, tr2 = 0, tr3 = 0; | |
| 1076 | INT32 ltr; | |
| 1395 | // Step Three: Normalize | |
| 1396 | while (Coefficient < 0x4000) | |
| 1397 | { | |
| 1398 | Coefficient <<= 1; | |
| 1399 | Exponent--; | |
| 1400 | } | |
| 1077 | 1401 | |
| 1078 | // time to run the command | |
| 1079 | dsp1_waitcmd = 1; | |
| 1080 | dsp1_out_idx = 0; | |
| 1081 | switch (dsp1_cur_cmd) | |
| 1082 | { | |
| 1083 | case 0x00: | |
| 1084 | DSP1_Multiply(dsp1_in[0]|dsp1_in[1]<<8, dsp1_in[2]|dsp1_in[3]<<8, &tr); | |
| 1085 | dsp1_out_cnt = 2; | |
| 1086 | break; | |
| 1402 | // Step Four: Special Case | |
| 1403 | if (Coefficient == 0x4000) | |
| 1404 | if (Sign == 1) *iCoefficient = 0x7fff; | |
| 1405 | else { | |
| 1406 | *iCoefficient = -0x4000; | |
| 1407 | Exponent--; | |
| 1408 | } | |
| 1409 | else { | |
| 1410 | // Step Five: Initial Guess | |
| 1411 | INT16 i = DSP1_DataRom[((Coefficient - 0x4000) >> 7) + 0x0065]; | |
| 1087 | 1412 | |
| 1088 | case 0x01: | |
| 1089 | case 0x05: | |
| 1090 | case 0x31: | |
| 1091 | case 0x35: | |
| 1092 | DSP1_Attitude_A(dsp1_in[0]|dsp1_in[1]<<8, dsp1_in[2]|dsp1_in[3]<<8, dsp1_in[4]|dsp1_in[5]<<8, dsp1_in[6]|dsp1_in[7]<<8); | |
| 1093 | dsp1_out_cnt = 0; | |
| 1094 | break; | |
| 1413 | // Step Six: Iterate Newton's Method | |
| 1414 | i = (i + (-i * (Coefficient * i >> 15) >> 15)) << 1; | |
| 1415 | i = (i + (-i * (Coefficient * i >> 15) >> 15)) << 1; | |
| 1095 | 1416 | |
| 1096 | case 0x02: | |
| 1097 | case 0x12: | |
| 1098 | case 0x22: | |
| 1099 | case 0x32: | |
| 1100 | DSP1_Parameter(dsp1_in[0]|dsp1_in[1]<<8, dsp1_in[2]|dsp1_in[3]<<8, dsp1_in[4]|dsp1_in[5]<<8, dsp1_in[6]|dsp1_in[7]<<8, | |
| 1101 | dsp1_in[8]|dsp1_in[9]<<8, dsp1_in[10]|dsp1_in[11]<<8, dsp1_in[12]|dsp1_in[13]<<8, &tr, &tr1, &tr2, &tr3); | |
| 1102 | dsp1_out_cnt = 8; | |
| 1103 | break; | |
| 1417 | *iCoefficient = i * Sign; | |
| 1418 | } | |
| 1104 | 1419 | |
| 1105 | case 0x03: | |
| 1106 | case 0x33: | |
| 1107 | DSP1_Subjective_A(dsp1_in[0]|dsp1_in[1]<<8, dsp1_in[2]|dsp1_in[3]<<8, dsp1_in[4]|dsp1_in[5]<<8, &tr, &tr1, &tr2); | |
| 1108 | dsp1_out_cnt = 6; | |
| 1109 | break; | |
| 1420 | *iExponent = 1 - Exponent; | |
| 1421 | } | |
| 1422 | } | |
| 1110 | 1423 | |
| 1111 | case 0x04: | |
| 1112 | case 0x24: | |
| 1113 | DSP1_Triangle(dsp1_in[0]|dsp1_in[1]<<8, dsp1_in[2]|dsp1_in[3]<<8, &tr, &tr1); | |
| 1114 | dsp1_out_cnt = 4; | |
| 1115 | break; | |
| 1424 | ////////////////////////////////////////////////////////////////// | |
| 1116 | 1425 | |
| 1117 | case 0x06: | |
| 1118 | case 0x16: | |
| 1119 | case 0x26: | |
| 1120 | case 0x36: | |
| 1121 | DSP1_Project(dsp1_in[0]|dsp1_in[1]<<8, dsp1_in[2]|dsp1_in[3]<<8, dsp1_in[4]|dsp1_in[5]<<8, &tr, &tr1, (UINT16 *) &tr2); | |
| 1122 | dsp1_out_cnt = 6; | |
| 1123 | break; | |
| 1426 | static INT16 denormalizeAndClip(INT16 C, INT16 E) | |
| 1427 | { | |
| 1428 | if (E > 0) { | |
| 1429 | if (C > 0) return 32767; else if (C < 0) return -32767; | |
| 1430 | } else { | |
| 1431 | if (E < 0) return C * DSP1_DataRom[0x0031 + E] >> 15; | |
| 1432 | } | |
| 1433 | return C; | |
| 1434 | } | |
| 1124 | 1435 | |
| 1125 | case 0x0a: | |
| 1126 | case 0x1a: | |
| 1127 | case 0x2a: | |
| 1128 | case 0x3a: | |
| 1129 | DSP1_Raster(dsp1_in[0]|dsp1_in[1]<<8, &tr, &tr1, &tr2, &tr3); | |
| 1130 | dsp1_in[0]++; | |
| 1131 | if (dsp1_in[0] == 0) dsp1_in[1]++; | |
| 1132 | dsp1_out_cnt = 8; | |
| 1133 | dsp1_in_idx = 0; | |
| 1134 | break; | |
| 1436 | ////////////////////////////////////////////////////////////////// | |
| 1135 | 1437 | |
| 1136 | case 0x08: | |
| 1137 | DSP1_Radius(dsp1_in[0]|dsp1_in[1]<<8, dsp1_in[2]|dsp1_in[3]<<8, dsp1_in[4]|dsp1_in[5]<<8, <r); | |
| 1138 | tr = (ltr & 0xffff); | |
| 1139 | tr1 = (ltr >> 16) & 0xffff; | |
| 1140 | dsp1_out_cnt = 4; | |
| 1141 | break; | |
| 1438 | // Normalize the input number (m), understood as ranging from -1 to 1, | |
| 1439 | // to the form: Coefficient*2^Exponent, | |
| 1440 | // where the absolute value of Coefficient is >= 1/2 | |
| 1441 | // (Coefficient>=0x4000 or Coefficient <= (INT16)0xc001) | |
| 1142 | 1442 | |
| 1143 | case 0x09: | |
| 1144 | case 0x0d: | |
| 1145 | case 0x39: | |
| 1146 | case 0x3d: | |
| 1147 | DSP1_Objective_A(dsp1_in[0]|dsp1_in[1]<<8, dsp1_in[2]|dsp1_in[3]<<8, dsp1_in[4]|dsp1_in[5]<<8, &tr, &tr1, &tr2); | |
| 1148 | dsp1_out_cnt = 6; | |
| 1149 | break; | |
| 1443 | static void normalize(INT16 m, INT16 *Coefficient, INT16 *Exponent) | |
| 1444 | { | |
| 1445 | INT16 i = 0x4000; | |
| 1446 | INT16 e = 0; | |
| 1150 | 1447 | |
| 1151 | case 0x0b: | |
| 1152 | case 0x3b: | |
| 1153 | DSP1_Scalar_A(dsp1_in[0]|dsp1_in[1]<<8, dsp1_in[2]|dsp1_in[3]<<8, dsp1_in[4]|dsp1_in[5]<<8, &tr); | |
| 1154 | dsp1_out_cnt = 2; | |
| 1155 | break; | |
| 1448 | if (m < 0) | |
| 1449 | while ((m & i) && i) | |
| 1450 | { | |
| 1451 | i >>= 1; | |
| 1452 | e++; | |
| 1453 | } | |
| 1454 | else | |
| 1455 | while (!(m & i) && i) | |
| 1456 | { | |
| 1457 | i >>= 1; | |
| 1458 | e++; | |
| 1459 | } | |
| 1156 | 1460 | |
| 1157 | case 0x0c: | |
| 1158 | case 0x2c: | |
| 1159 | DSP1_Rotate(dsp1_in[0]|dsp1_in[1]<<8, dsp1_in[2]|dsp1_in[3]<<8, dsp1_in[4]|dsp1_in[5]<<8, &tr, &tr1); | |
| 1160 | dsp1_out_cnt = 4; | |
| 1161 | break; | |
| 1461 | if (e > 0) | |
| 1462 | *Coefficient = m * DSP1_DataRom[0x21 + e] << 1; | |
| 1463 | else | |
| 1464 | *Coefficient = m; | |
| 1162 | 1465 | |
| 1163 | case 0x0e: | |
| 1164 | case 0x1e: | |
| 1165 | case 0x2e: | |
| 1166 | case 0x3e: | |
| 1167 | DSP1_Target(dsp1_in[0]|dsp1_in[1]<<8, dsp1_in[2]|dsp1_in[3]<<8, &tr, &tr1); | |
| 1168 | dsp1_out_cnt = 4; | |
| 1169 | break; | |
| 1466 | *Exponent -= e; | |
| 1467 | } | |
| 1170 | 1468 | |
| 1171 | case 0x07: | |
| 1172 | case 0x0f: | |
| 1173 | DSP1_MemoryTest(dsp1_in[0]|dsp1_in[1]<<8, &tr); | |
| 1174 | dsp1_out_cnt = 2; | |
| 1175 | break; | |
| 1469 | ////////////////////////////////////////////////////////////////// | |
| 1176 | 1470 | |
| 1177 | case 0x10: | |
| 1178 | case 0x30: | |
| 1179 | DSP1_Inverse(dsp1_in[0]|dsp1_in[1]<<8, dsp1_in[2]|dsp1_in[3]<<8, &tr, &tr1); | |
| 1180 | dsp1_out_cnt = 4; | |
| 1181 | break; | |
| 1471 | // Same than 'normalize' but with an INT32 input | |
| 1182 | 1472 | |
| 1183 | case 0x11: | |
| 1184 | case 0x15: | |
| 1185 | DSP1_Attitude_B(dsp1_in[0]|dsp1_in[1]<<8, dsp1_in[2]|dsp1_in[3]<<8, dsp1_in[4]|dsp1_in[5]<<8, dsp1_in[6]|dsp1_in[7]<<8); | |
| 1186 | dsp1_out_cnt = 0; | |
| 1187 | break; | |
| 1473 | static void normalizeDouble(INT32 Product, INT16 *Coefficient, INT16 *Exponent) | |
| 1474 | { | |
| 1475 | INT16 n = Product & 0x7fff; | |
| 1476 | INT16 m = Product >> 15; | |
| 1477 | INT16 i = 0x4000; | |
| 1478 | INT16 e = 0; | |
| 1188 | 1479 | |
| 1189 | case 0x13: | |
| 1190 | DSP1_Subjective_B(dsp1_in[0]|dsp1_in[1]<<8, dsp1_in[2]|dsp1_in[3]<<8, dsp1_in[4]|dsp1_in[5]<<8, &tr, &tr1, &tr2); | |
| 1191 | dsp1_out_cnt = 6; | |
| 1192 | break; | |
| 1480 | if (m < 0) | |
| 1481 | while ((m & i) && i) | |
| 1482 | { | |
| 1483 | i >>= 1; | |
| 1484 | e++; | |
| 1485 | } | |
| 1486 | else | |
| 1487 | while (!(m & i) && i) | |
| 1488 | { | |
| 1489 | i >>= 1; | |
| 1490 | e++; | |
| 1491 | } | |
| 1193 | 1492 | |
| 1194 | case 0x14: | |
| 1195 | case 0x34: | |
| 1196 | DSP1_Gyrate(dsp1_in[0]|dsp1_in[1]<<8, dsp1_in[2]|dsp1_in[3]<<8, dsp1_in[4]|dsp1_in[5]<<8, dsp1_in[6]|dsp1_in[7]<<8, | |
| 1197 | dsp1_in[8]|dsp1_in[9]<<8, dsp1_in[10]|dsp1_in[11]<<8, &tr, &tr1, &tr2); | |
| 1198 | dsp1_out_cnt = 6; | |
| 1199 | break; | |
| 1493 | if (e > 0) | |
| 1494 | { | |
| 1495 | *Coefficient = m * DSP1_DataRom[0x0021 + e] << 1; | |
| 1200 | 1496 | |
| 1201 | case 0x18: | |
| 1202 | DSP1_Range(dsp1_in[0]|dsp1_in[1]<<8, dsp1_in[2]|dsp1_in[3]<<8, dsp1_in[4]|dsp1_in[5]<<8, dsp1_in[6]|dsp1_in[7]<<8, &tr); | |
| 1203 | dsp1_out_cnt = 2; | |
| 1204 | break; | |
| 1497 | if (e < 15) | |
| 1498 | *Coefficient += n * DSP1_DataRom[0x0040 - e] >> 15; | |
| 1499 | else | |
| 1500 | { | |
| 1501 | i = 0x4000; | |
| 1205 | 1502 | |
| 1206 | case 0x19: | |
| 1207 | case 0x1d: | |
| 1208 | DSP1_Objective_B(dsp1_in[0]|dsp1_in[1]<<8, dsp1_in[2]|dsp1_in[3]<<8, dsp1_in[4]|dsp1_in[5]<<8, &tr, &tr1, &tr2); | |
| 1209 | dsp1_out_cnt = 6; | |
| 1210 | break; | |
| 1503 | if (m < 0) | |
| 1504 | while ((n & i) && i) | |
| 1505 | { | |
| 1506 | i >>= 1; | |
| 1507 | e++; | |
| 1508 | } | |
| 1509 | else | |
| 1510 | while (!(n & i) && i) | |
| 1511 | { | |
| 1512 | i >>= 1; | |
| 1513 | e++; | |
| 1514 | } | |
| 1211 | 1515 | |
| 1212 | case 0x1b: | |
| 1213 | DSP1_Scalar_B(dsp1_in[0]|dsp1_in[1]<<8, dsp1_in[2]|dsp1_in[3]<<8, dsp1_in[4]|dsp1_in[5]<<8, &tr); | |
| 1214 | dsp1_out_cnt = 2; | |
| 1215 | break; | |
| 1516 | if (e > 15) | |
| 1517 | *Coefficient = n * DSP1_DataRom[0x0012 + e] << 1; | |
| 1518 | else | |
| 1519 | *Coefficient += n; | |
| 1520 | } | |
| 1521 | } | |
| 1522 | else | |
| 1523 | *Coefficient = m; | |
| 1216 | 1524 | |
| 1217 | case 0x1f: | |
| 1218 | dsp1_out_cnt = 2048; | |
| 1219 | break; | |
| 1525 | *Exponent = e; | |
| 1526 | } | |
| 1220 | 1527 | |
| 1221 | case 0x23: | |
| 1222 | DSP1_Subjective_C(dsp1_in[0]|dsp1_in[1]<<8, dsp1_in[2]|dsp1_in[3]<<8, dsp1_in[4]|dsp1_in[5]<<8, &tr, &tr1, &tr2); | |
| 1223 | dsp1_out_cnt = 6; | |
| 1224 | break; | |
| 1528 | ////////////////////////////////////////////////////////////////// | |
| 1225 | 1529 | |
| 1226 | case 0x28: | |
| 1227 | DSP1_Distance(dsp1_in[0]|dsp1_in[1]<<8, dsp1_in[2]|dsp1_in[3]<<8, dsp1_in[4]|dsp1_in[5]<<8, &tr); | |
| 1228 | dsp1_out_cnt = 2; | |
| 1229 | break; | |
| 1530 | // Shift to the right | |
| 1230 | 1531 | |
| 1231 | case 0x29: | |
| 1232 | case 0x2d: | |
| 1233 | DSP1_Objective_C(dsp1_in[0]|dsp1_in[1]<<8, dsp1_in[2]|dsp1_in[3]<<8, dsp1_in[4]|dsp1_in[5]<<8, &tr, &tr1, &tr2); | |
| 1234 | dsp1_out_cnt = 6; | |
| 1235 | break; | |
| 1532 | static INT16 shiftR(INT16 C, INT16 E) | |
| 1533 | { | |
| 1534 | return (C * DSP1_DataRom[0x0031 + E] >> 15); | |
| 1535 | } | |
| 1236 | 1536 | |
| 1237 | case 0x2b: | |
| 1238 | DSP1_Scalar_C(dsp1_in[0]|dsp1_in[1]<<8, dsp1_in[2]|dsp1_in[3]<<8, dsp1_in[4]|dsp1_in[5]<<8, &tr); | |
| 1239 | dsp1_out_cnt = 2; | |
| 1240 | break; | |
| 1537 | ////////////////////////////////////////////////////////////////// | |
| 1241 | 1538 | |
| 1242 | case 0x27: | |
| 1243 | case 0x2f: | |
| 1244 | DSP1_MemorySize(&tr); | |
| 1245 | dsp1_out_cnt = 2; | |
| 1246 | break; | |
| 1539 | static const INT16 DSP1_SinTable[256] = { | |
| 1540 | 0x0000, 0x0324, 0x0647, 0x096a, 0x0c8b, 0x0fab, 0x12c8, 0x15e2, | |
| 1541 | 0x18f8, 0x1c0b, 0x1f19, 0x2223, 0x2528, 0x2826, 0x2b1f, 0x2e11, | |
| 1542 | 0x30fb, 0x33de, 0x36ba, 0x398c, 0x3c56, 0x3f17, 0x41ce, 0x447a, | |
| 1543 | 0x471c, 0x49b4, 0x4c3f, 0x4ebf, 0x5133, 0x539b, 0x55f5, 0x5842, | |
| 1544 | 0x5a82, 0x5cb4, 0x5ed7, 0x60ec, 0x62f2, 0x64e8, 0x66cf, 0x68a6, | |
| 1545 | 0x6a6d, 0x6c24, 0x6dca, 0x6f5f, 0x70e2, 0x7255, 0x73b5, 0x7504, | |
| 1546 | 0x7641, 0x776c, 0x7884, 0x798a, 0x7a7d, 0x7b5d, 0x7c29, 0x7ce3, | |
| 1547 | 0x7d8a, 0x7e1d, 0x7e9d, 0x7f09, 0x7f62, 0x7fa7, 0x7fd8, 0x7ff6, | |
| 1548 | 0x7fff, 0x7ff6, 0x7fd8, 0x7fa7, 0x7f62, 0x7f09, 0x7e9d, 0x7e1d, | |
| 1549 | 0x7d8a, 0x7ce3, 0x7c29, 0x7b5d, 0x7a7d, 0x798a, 0x7884, 0x776c, | |
| 1550 | 0x7641, 0x7504, 0x73b5, 0x7255, 0x70e2, 0x6f5f, 0x6dca, 0x6c24, | |
| 1551 | 0x6a6d, 0x68a6, 0x66cf, 0x64e8, 0x62f2, 0x60ec, 0x5ed7, 0x5cb4, | |
| 1552 | 0x5a82, 0x5842, 0x55f5, 0x539b, 0x5133, 0x4ebf, 0x4c3f, 0x49b4, | |
| 1553 | 0x471c, 0x447a, 0x41ce, 0x3f17, 0x3c56, 0x398c, 0x36ba, 0x33de, | |
| 1554 | 0x30fb, 0x2e11, 0x2b1f, 0x2826, 0x2528, 0x2223, 0x1f19, 0x1c0b, | |
| 1555 | 0x18f8, 0x15e2, 0x12c8, 0x0fab, 0x0c8b, 0x096a, 0x0647, 0x0324, | |
| 1556 | -0x0000, -0x0324, -0x0647, -0x096a, -0x0c8b, -0x0fab, -0x12c8, -0x15e2, | |
| 1557 | -0x18f8, -0x1c0b, -0x1f19, -0x2223, -0x2528, -0x2826, -0x2b1f, -0x2e11, | |
| 1558 | -0x30fb, -0x33de, -0x36ba, -0x398c, -0x3c56, -0x3f17, -0x41ce, -0x447a, | |
| 1559 | -0x471c, -0x49b4, -0x4c3f, -0x4ebf, -0x5133, -0x539b, -0x55f5, -0x5842, | |
| 1560 | -0x5a82, -0x5cb4, -0x5ed7, -0x60ec, -0x62f2, -0x64e8, -0x66cf, -0x68a6, | |
| 1561 | -0x6a6d, -0x6c24, -0x6dca, -0x6f5f, -0x70e2, -0x7255, -0x73b5, -0x7504, | |
| 1562 | -0x7641, -0x776c, -0x7884, -0x798a, -0x7a7d, -0x7b5d, -0x7c29, -0x7ce3, | |
| 1563 | -0x7d8a, -0x7e1d, -0x7e9d, -0x7f09, -0x7f62, -0x7fa7, -0x7fd8, -0x7ff6, | |
| 1564 | -0x7fff, -0x7ff6, -0x7fd8, -0x7fa7, -0x7f62, -0x7f09, -0x7e9d, -0x7e1d, | |
| 1565 | -0x7d8a, -0x7ce3, -0x7c29, -0x7b5d, -0x7a7d, -0x798a, -0x7884, -0x776c, | |
| 1566 | -0x7641, -0x7504, -0x73b5, -0x7255, -0x70e2, -0x6f5f, -0x6dca, -0x6c24, | |
| 1567 | -0x6a6d, -0x68a6, -0x66cf, -0x64e8, -0x62f2, -0x60ec, -0x5ed7, -0x5cb4, | |
| 1568 | -0x5a82, -0x5842, -0x55f5, -0x539b, -0x5133, -0x4ebf, -0x4c3f, -0x49b4, | |
| 1569 | -0x471c, -0x447a, -0x41ce, -0x3f17, -0x3c56, -0x398c, -0x36ba, -0x33de, | |
| 1570 | -0x30fb, -0x2e11, -0x2b1f, -0x2826, -0x2528, -0x2223, -0x1f19, -0x1c0b, | |
| 1571 | -0x18f8, -0x15e2, -0x12c8, -0x0fab, -0x0c8b, -0x096a, -0x0647, -0x0324}; | |
| 1247 | 1572 | |
| 1248 | default: | |
| 1249 | printf("Unhandled DSP1 command: %02x\n", dsp1_cur_cmd); | |
| 1250 | break; | |
| 1573 | ////////////////////////////////////////////////////////////////// | |
| 1251 | 1574 | |
| 1252 | } | |
| 1575 | // Optimised for Performance | |
| 1576 | static const INT16 DSP1_MulTable[256] = { | |
| 1577 | 0x0000, 0x0003, 0x0006, 0x0009, 0x000c, 0x000f, 0x0012, 0x0015, | |
| 1578 | 0x0019, 0x001c, 0x001f, 0x0022, 0x0025, 0x0028, 0x002b, 0x002f, | |
| 1579 | 0x0032, 0x0035, 0x0038, 0x003b, 0x003e, 0x0041, 0x0045, 0x0048, | |
| 1580 | 0x004b, 0x004e, 0x0051, 0x0054, 0x0057, 0x005b, 0x005e, 0x0061, | |
| 1581 | 0x0064, 0x0067, 0x006a, 0x006d, 0x0071, 0x0074, 0x0077, 0x007a, | |
| 1582 | 0x007d, 0x0080, 0x0083, 0x0087, 0x008a, 0x008d, 0x0090, 0x0093, | |
| 1583 | 0x0096, 0x0099, 0x009d, 0x00a0, 0x00a3, 0x00a6, 0x00a9, 0x00ac, | |
| 1584 | 0x00af, 0x00b3, 0x00b6, 0x00b9, 0x00bc, 0x00bf, 0x00c2, 0x00c5, | |
| 1585 | 0x00c9, 0x00cc, 0x00cf, 0x00d2, 0x00d5, 0x00d8, 0x00db, 0x00df, | |
| 1586 | 0x00e2, 0x00e5, 0x00e8, 0x00eb, 0x00ee, 0x00f1, 0x00f5, 0x00f8, | |
| 1587 | 0x00fb, 0x00fe, 0x0101, 0x0104, 0x0107, 0x010b, 0x010e, 0x0111, | |
| 1588 | 0x0114, 0x0117, 0x011a, 0x011d, 0x0121, 0x0124, 0x0127, 0x012a, | |
| 1589 | 0x012d, 0x0130, 0x0133, 0x0137, 0x013a, 0x013d, 0x0140, 0x0143, | |
| 1590 | 0x0146, 0x0149, 0x014d, 0x0150, 0x0153, 0x0156, 0x0159, 0x015c, | |
| 1591 | 0x015f, 0x0163, 0x0166, 0x0169, 0x016c, 0x016f, 0x0172, 0x0175, | |
| 1592 | 0x0178, 0x017c, 0x017f, 0x0182, 0x0185, 0x0188, 0x018b, 0x018e, | |
| 1593 | 0x0192, 0x0195, 0x0198, 0x019b, 0x019e, 0x01a1, 0x01a4, 0x01a8, | |
| 1594 | 0x01ab, 0x01ae, 0x01b1, 0x01b4, 0x01b7, 0x01ba, 0x01be, 0x01c1, | |
| 1595 | 0x01c4, 0x01c7, 0x01ca, 0x01cd, 0x01d0, 0x01d4, 0x01d7, 0x01da, | |
| 1596 | 0x01dd, 0x01e0, 0x01e3, 0x01e6, 0x01ea, 0x01ed, 0x01f0, 0x01f3, | |
| 1597 | 0x01f6, 0x01f9, 0x01fc, 0x0200, 0x0203, 0x0206, 0x0209, 0x020c, | |
| 1598 | 0x020f, 0x0212, 0x0216, 0x0219, 0x021c, 0x021f, 0x0222, 0x0225, | |
| 1599 | 0x0228, 0x022c, 0x022f, 0x0232, 0x0235, 0x0238, 0x023b, 0x023e, | |
| 1600 | 0x0242, 0x0245, 0x0248, 0x024b, 0x024e, 0x0251, 0x0254, 0x0258, | |
| 1601 | 0x025b, 0x025e, 0x0261, 0x0264, 0x0267, 0x026a, 0x026e, 0x0271, | |
| 1602 | 0x0274, 0x0277, 0x027a, 0x027d, 0x0280, 0x0284, 0x0287, 0x028a, | |
| 1603 | 0x028d, 0x0290, 0x0293, 0x0296, 0x029a, 0x029d, 0x02a0, 0x02a3, | |
| 1604 | 0x02a6, 0x02a9, 0x02ac, 0x02b0, 0x02b3, 0x02b6, 0x02b9, 0x02bc, | |
| 1605 | 0x02bf, 0x02c2, 0x02c6, 0x02c9, 0x02cc, 0x02cf, 0x02d2, 0x02d5, | |
| 1606 | 0x02d8, 0x02db, 0x02df, 0x02e2, 0x02e5, 0x02e8, 0x02eb, 0x02ee, | |
| 1607 | 0x02f1, 0x02f5, 0x02f8, 0x02fb, 0x02fe, 0x0301, 0x0304, 0x0307, | |
| 1608 | 0x030b, 0x030e, 0x0311, 0x0314, 0x0317, 0x031a, 0x031d, 0x0321}; | |
| 1253 | 1609 | |
| 1254 | // copy up to 8 bytes of result into the buffer | |
| 1255 | dsp1_out[0] = tr&0xff; | |
| 1256 | dsp1_out[1] = (tr>>8)&0xff; | |
| 1257 | dsp1_out[2] = tr1&0xff; | |
| 1258 | dsp1_out[3] = (tr1>>8)&0xff; | |
| 1259 | dsp1_out[4] = tr2&0xff; | |
| 1260 | dsp1_out[5] = (tr2>>8)&0xff; | |
| 1261 | dsp1_out[6] = tr3&0xff; | |
| 1262 | dsp1_out[7] = (tr3>>8)&0xff; | |
| 1263 | } | |
| 1264 | } | |
| 1265 | } | |
| 1266 | } | |
| 1267 | } | |
| 1610 | ////////////////////////////////////////////////////////////////// | |
| 1268 | 1611 | |
| 1612 | // Data ROM, as logged from a DSP-1B with the 0x1f command; | |
| 1613 | // it contains the tables and constants used by the commands. | |
| 1614 | // The tables used are: two shift tables (0x022-0x031 and 0x031-0x040 -this last one | |
| 1615 | // with an error in 0x03c which has survived to all the DSP-1 revisions-); a inverse | |
| 1616 | // table (used as initial guess) at 0x065-0x0e4; a square root table (used also | |
| 1617 | // as initial guess) at 0x0e5-0x115; two sin and cos tables (used as nodes to construct | |
| 1618 | // a interpolation curve) at, respectively, 0x116-0x197 and 0x196-0x215. | |
| 1619 | // As a curiosity, in the positions 0x21c-0x31c it's contained a | |
| 1620 | // 257-points arccos table that, apparently, have been not used anywhere | |
| 1621 | // (maybe for the MaxAZS_Exp table?). | |
| 1622 | static UINT16 DSP1_DataRom[1024]; |
| r1478 | r1479 | |
|---|---|---|
| 13 | 13 | |
| 14 | 14 | #define VERBOSE_LEVEL ( 0 ) |
| 15 | 15 | |
| 16 | INLINE void verboselog( int n_level, const char *s_fmt, ... ) | |
| 16 | INLINE void ATTR_PRINTF(2,3) verboselog( int n_level, const char *s_fmt, ... ) | |
| 17 | 17 | { |
| 18 | 18 | if( VERBOSE_LEVEL >= n_level ) |
| 19 | 19 | { |
| r1478 | r1479 | |
| 726 | 726 | if( m_p_n_sio_baud[ n_port ] != 0 && n_prescaler != 0 ) |
| 727 | 727 | { |
| 728 | 728 | n_time = attotime_mul(ATTOTIME_IN_HZ(33868800), n_prescaler * m_p_n_sio_baud[n_port]); |
| 729 | verboselog( 2, "sio_timer_adjust( %d ) = % | |
| 729 | verboselog( 2, "sio_timer_adjust( %d ) = %s ( %d x %d )\n", n_port, attotime_string(n_time, 9), n_prescaler, m_p_n_sio_baud[ n_port ] ); | |
| 730 | 730 | } |
| 731 | 731 | else |
| 732 | 732 | { |
| r1478 | r1479 | |
|---|---|---|
| 4208 | 4208 | DRIVER( gatedoom ) /* MAC (c) 1990 Data East Corporation (US) */ |
| 4209 | 4209 | DRIVER( gatedom1 ) /* MAC (c) 1990 Data East Corporation (US) */ |
| 4210 | 4210 | DRIVER( edrandy ) /* MAD (c) 1990 Data East Corporation (World) */ |
| 4211 | DRIVER( edrandy2 ) /* MAD (c) 1990 Data East Corporation (World) */ | |
| 4211 | 4212 | DRIVER( edrandy1 ) /* MAD (c) 1990 Data East Corporation (World) */ |
| 4212 | DRIVER( edrandy0 ) /* MAD (c) 1990 Data East Corporation (World) */ | |
| 4213 | 4213 | DRIVER( edrandyj ) /* MAD (c) 1990 Data East Corporation (Japan) */ |
| 4214 | 4214 | DRIVER( supbtime ) /* MAE (c) 1990 Data East Corporation (World) */ |
| 4215 | 4215 | DRIVER( supbtima ) /* MAE (c) 1990 Data East Corporation (World) */ |
| 4216 | 4216 | DRIVER( supbtimj ) /* MAE (c) 1990 Data East Corporation (Japan) */ |
| 4217 | 4217 | DRIVER( mutantf ) /* MAF (c) 1992 Data East Corporation (World) */ |
| 4218 | DRIVER( mutantfa ) /* MAF (c) 1992 Data East Corporation (World) */ | |
| 4218 | DRIVER( mutantf4 ) /* MAF (c) 1992 Data East Corporation (World) */ | |
| 4219 | DRIVER( mutantf3 ) /* MAF (c) 1992 Data East Corporation (World) */ | |
| 4219 | 4220 | DRIVER( deathbrd ) /* MAF (c) 1992 Data East Corporation (Japan) */ |
| 4220 | 4221 | DRIVER( cninja ) /* MAG (c) 1991 Data East Corporation (World) */ |
| 4221 | DRIVER( cninja | |
| 4222 | DRIVER( cninja1 ) /* MAG (c) 1991 Data East Corporation (World) */ | |
| 4222 | 4223 | DRIVER( cninjau ) /* MAG (c) 1991 Data East Corporation (US) */ |
| 4223 | 4224 | DRIVER( joemac ) /* MAG (c) 1991 Data East Corporation (Japan) */ |
| 4224 | 4225 | DRIVER( stoneage ) /* bootleg */ |
| r1478 | r1479 | |
| 4555 | 4556 | DRIVER( simps4pa ) /* GX072 (c) 1991 */ |
| 4556 | 4557 | DRIVER( simpsn2p ) /* GX072 (c) 1991 */ |
| 4557 | 4558 | DRIVER( simps2pa ) /* GX072 (c) 1991 */ |
| 4559 | DRIVER( simp2pa ) /* GX072 (c) 1991 (Asia) */ | |
| 4558 | 4560 | DRIVER( simps2pj ) /* GX072 (c) 1991 (Japan) */ |
| 4559 | 4561 | DRIVER( esckids ) /* GX975 (c) 1991 (Asia) */ |
| 4560 | 4562 | DRIVER( esckidsj ) /* GX975 (c) 1991 (Japan) */ |
| r1478 | r1479 | |
|---|---|---|
| 28 | 28 | |
| 29 | 29 | MACHINE_RESET( dc ); |
| 30 | 30 | |
| 31 | void dc_vblank( void ); | |
| 32 | ||
| 31 | 33 | /*----------- defined in video/dc.c -----------*/ |
| 32 | 34 | |
| 33 | 35 | READ64_HANDLER( pvr_ctrl_r ); |
| r1478 | r1479 | |
|---|---|---|
| 4 | 4 | |
| 5 | 5 | **************************************************************************/ |
| 6 | 6 | |
| 7 | #define MIDZEUS_VIDEO_CLOCK 66 | |
| 7 | #define MIDZEUS_VIDEO_CLOCK XTAL_66_6667MHz | |
| 8 | 8 | |
| 9 | 9 | |
| 10 | 10 | /*----------- defined in video/midzeus.c -----------*/ |
| r0 | r1479 | |
|---|---|---|
| 1 | #ifndef MARIO_H_ | |
| 2 | #define MARIO_H_ | |
| 3 | ||
| 4 | /* | |
| 5 | * From the schematics: | |
| 6 | * | |
| 7 | * Video generation like dkong/dkongjr. However, clock is 24MHZ | |
| 8 | * 7C -> 100 => 256 - 124 = 132 ==> 264 Scanlines | |
| 9 | */ | |
| 10 | ||
| 11 | #define MASTER_CLOCK XTAL_24MHz | |
| 12 | #define PIXEL_CLOCK (MASTER_CLOCK / 4) | |
| 13 | #define CLOCK_1H (MASTER_CLOCK / 8) | |
| 14 | #define CLOCK_16H (CLOCK_1H / 16) | |
| 15 | #define CLOCK_1VF ((CLOCK_16H) / 12 / 2) | |
| 16 | #define CLOCK_2VF ((CLOCK_1VF) / 2) | |
| 17 | ||
| 18 | #define HTOTAL (384) | |
| 19 | #define HBSTART (256) | |
| 20 | #define HBEND (0) | |
| 21 | #define VTOTAL (264) | |
| 22 | #define VBSTART (240) | |
| 23 | #define VBEND (16) | |
| 24 | ||
| 25 | #define Z80_MASTER_CLOCK XTAL_8MHz | |
| 26 | #define Z80_CLOCK (Z80_MASTER_CLOCK / 2) /* verified on pcb */ | |
| 27 | ||
| 28 | #define I8035_MASTER_CLOCK XTAL_11MHz /* verified on pcb: 730Khz */ | |
| 29 | #define I8035_DIVIDER (15) | |
| 30 | #define I8035_CLOCK (I8035_MASTER_CLOCK/I8035_DIVIDER) | |
| 31 | ||
| 32 | #define MARIO_PALETTE_LENGTH (256) | |
| 33 | ||
| 34 | typedef struct _mario_state mario_state; | |
| 35 | struct _mario_state | |
| 36 | { | |
| 37 | /* memory pointers */ | |
| 38 | ||
| 39 | /* machine states */ | |
| 40 | ||
| 41 | /* sound state */ | |
| 42 | ||
| 43 | /* video state */ | |
| 44 | ||
| 45 | /* Save state relevant */ | |
| 46 | ||
| 47 | UINT8 dummy; /* structs need to have something */ | |
| 48 | }; | |
| 49 | ||
| 50 | /*----------- defined in video/mario.c -----------*/ | |
| 51 | ||
| 52 | WRITE8_HANDLER( mario_videoram_w ); | |
| 53 | WRITE8_HANDLER( mario_gfxbank_w ); | |
| 54 | WRITE8_HANDLER( mario_palettebank_w ); | |
| 55 | WRITE8_HANDLER( mario_scroll_w ); | |
| 56 | ||
| 57 | PALETTE_INIT( mario ); | |
| 58 | VIDEO_START( mario ); | |
| 59 | VIDEO_UPDATE( mario ); | |
| 60 | ||
| 61 | ||
| 62 | /*----------- defined in audio/mario.c -----------*/ | |
| 63 | ||
| 64 | WRITE8_HANDLER( mario_sh_w ); | |
| 65 | WRITE8_HANDLER( mario_sh1_w ); | |
| 66 | WRITE8_HANDLER( mario_sh2_w ); | |
| 67 | WRITE8_HANDLER( mario_sh3_w ); | |
| 68 | ||
| 69 | WRITE8_HANDLER( mario_sh_getcoin_w ); | |
| 70 | WRITE8_HANDLER( mario_sh_crab_w ); | |
| 71 | WRITE8_HANDLER( mario_sh_turtle_w ); | |
| 72 | WRITE8_HANDLER( mario_sh_fly_w ); | |
| 73 | WRITE8_HANDLER( mario_sh_tuneselect_w ); | |
| 74 | WRITE8_HANDLER( masao_sh_irqtrigger_w ); | |
| 75 | ||
| 76 | MACHINE_DRIVER_EXTERN( mario_audio ); | |
| 77 | MACHINE_DRIVER_EXTERN( masao_audio ); | |
| 78 | ||
| 79 | #endif /*MARIO_H_*/ |
| r1478 | r1479 | |
|---|---|---|
| 492 | 492 | $(DRIVERS)/rampart.o $(VIDEO)/rampart.o \ |
| 493 | 493 | $(DRIVERS)/relief.o $(VIDEO)/relief.o \ |
| 494 | 494 | $(DRIVERS)/runaway.o $(VIDEO)/runaway.o \ |
| 495 | $(DRIVERS)/sbrkout.o | |
| 495 | $(DRIVERS)/sbrkout.o | |
| 496 | 496 | $(DRIVERS)/shuuz.o $(VIDEO)/shuuz.o \ |
| 497 | 497 | $(DRIVERS)/skullxbo.o $(VIDEO)/skullxbo.o \ |
| 498 | 498 | $(DRIVERS)/skydiver.o $(AUDIO)/skydiver.o $(VIDEO)/skydiver.o \ |
| r1478 | r1479 | |
| 1681 | 1681 | $(DRIVERS)/meadows.o: $(LAYOUT)/deadeye.lh \ |
| 1682 | 1682 | $(LAYOUT)/gypsyjug.lh |
| 1683 | 1683 | |
| 1684 | $(DRIVERS)/midzeus.o: $(LAYOUT)/crusnexo.lh | |
| 1685 | ||
| 1684 | 1686 | $(DRIVERS)/nbmj8688.o: $(LAYOUT)/nbmj8688.lh |
| 1685 | 1687 | |
| 1686 | 1688 | $(DRIVERS)/peplus.o: $(LAYOUT)/peplus.lh \ |
| r1478 | r1479 | |
|---|---|---|
| 25 | 25 | |
| 26 | 26 | #define VERBOSE_LEVEL ( 0 ) |
| 27 | 27 | |
| 28 | INLINE void verboselog( int n_level, const char *s_fmt, ... ) | |
| 28 | INLINE void ATTR_PRINTF(2,3) verboselog( int n_level, const char *s_fmt, ... ) | |
| 29 | 29 | { |
| 30 | 30 | if( VERBOSE_LEVEL >= n_level ) |
| 31 | 31 | { |
| r1478 | r1479 | |
|---|---|---|
| 109 | 109 | |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | READ8_HANDLER( victnine_gfxctrl_r ) | |
| 113 | { | |
| 114 | return gfxctrl; | |
| 115 | } | |
| 116 | ||
| 112 | 117 | WRITE8_HANDLER( victnine_gfxctrl_w ) |
| 113 | 118 | { |
| 114 | 119 | if (gfxctrl == data) |
| r1478 | r1479 | |
| 127 | 132 | |
| 128 | 133 | } |
| 129 | 134 | |
| 130 | #ifdef UNUSED_FUNCTION | |
| 131 | READ8_HANDLER( flstory_scrlram_r ) | |
| 132 | { | |
| 133 | return flstory_scrlram[offset]; | |
| 134 | } | |
| 135 | #endif | |
| 136 | ||
| 137 | 135 | WRITE8_HANDLER( flstory_scrlram_w ) |
| 138 | 136 | { |
| 139 | 137 | flstory_scrlram[offset] = data; |
| r1478 | r1479 | |
|---|---|---|
| 6 | 6 | #include "driver.h" |
| 7 | 7 | #include "dc.h" |
| 8 | 8 | |
| 9 | #define DEBUG_PVRCTRL (1) | |
| 10 | #define DEBUG_PVRTA (1) | |
| 11 | ||
| 12 | static UINT32 pvrctrl_regs[0x100/4]; | |
| 13 | static UINT32 pvrta_regs[0x2000/4]; | |
| 14 | ||
| 9 | 15 | VIDEO_START(dc) |
| 10 | 16 | { |
| 17 | memset(pvrctrl_regs, 0, sizeof(pvrctrl_regs)); | |
| 18 | memset(pvrta_regs, 0, sizeof(pvrta_regs)); | |
| 19 | ||
| 20 | pvrta_regs[0] = 0x17fd11db; // vendor and device ID of HOLLY chip | |
| 21 | pvrta_regs[1] = 1; // chip revision | |
| 11 | 22 | } |
| 12 | 23 | |
| 13 | 24 | VIDEO_UPDATE(dc) |
| 14 | 25 | { |
| 26 | dc_vblank(); | |
| 27 | ||
| 15 | 28 | return 0; |
| 16 | 29 | } |
| 17 | 30 | |
| 31 | // register decode helper | |
| 32 | ||
| 33 | INLINE int decode_reg_64(UINT32 offset, UINT64 mem_mask, UINT64 *shift) | |
| 34 | { | |
| 35 | int reg = offset * 2; | |
| 36 | ||
| 37 | *shift = 0; | |
| 38 | ||
| 39 | if (mem_mask == U64(0x00000000ffffffff)) | |
| 40 | { | |
| 41 | reg++; | |
| 42 | *shift = 32; | |
| 43 | } | |
| 44 | ||
| 45 | return reg; | |
| 46 | } | |
| 47 | ||
| 18 | 48 | READ64_HANDLER( pvr_ctrl_r ) |
| 19 | 49 | { |
| 20 | return 0; | |
| 50 | int reg; | |
| 51 | UINT64 shift; | |
| 52 | ||
| 53 | reg = decode_reg_64(offset, mem_mask, &shift); | |
| 54 | ||
| 55 | #if DEBUG_PVRCTRL | |
| 56 | mame_printf_verbose("PVRCTRL: read %x @ %x (reg %x), mask %llx (PC=%x)\n", pvrctrl_regs[reg], offset, reg, mem_mask, activecpu_get_pc()); | |
| 57 | #endif | |
| 58 | ||
| 59 | return (UINT64)pvrctrl_regs[reg] << shift; | |
| 21 | 60 | } |
| 22 | 61 | |
| 23 | 62 | WRITE64_HANDLER( pvr_ctrl_w ) |
| 24 | 63 | { |
| 25 | mame_printf_verbose("PVRCTRL: write %llx to %x, mask %llx\n", data, offset, mem_mask); | |
| 64 | int reg; | |
| 65 | UINT64 shift; | |
| 66 | ||
| 67 | reg = decode_reg_64(offset, mem_mask, &shift); | |
| 68 | ||
| 69 | #if DEBUG_PVRCTRL | |
| 70 | mame_printf_verbose("PVRCTRL: write %llx to %x (reg %x), mask %llx\n", data>>shift, offset, reg, mem_mask); | |
| 71 | #endif | |
| 72 | ||
| 73 | pvrctrl_regs[reg] |= data >> shift; | |
| 26 | 74 | } |
| 27 | 75 | |
| 28 | 76 | READ64_HANDLER( pvr_ta_r ) |
| 29 | 77 | { |
| 30 | return 0; | |
| 78 | int reg; | |
| 79 | UINT64 shift; | |
| 80 | ||
| 81 | reg = decode_reg_64(offset, mem_mask, &shift); | |
| 82 | ||
| 83 | #if DEBUG_PVRTA | |
| 84 | mame_printf_verbose("PVRTA: read %x @ %x (reg %x), mask %llx (PC=%x)\n", pvrta_regs[reg], offset, reg, mem_mask, activecpu_get_pc()); | |
| 85 | #endif | |
| 86 | ||
| 87 | return (UINT64)pvrta_regs[reg] << shift; | |
| 31 | 88 | } |
| 32 | 89 | |
| 33 | 90 | WRITE64_HANDLER( pvr_ta_w ) |
| 34 | 91 | { |
| 35 | mame_printf_verbose("PVR TA: write %llx to %x, mask %llx\n", data, offset, mem_mask); | |
| 92 | int reg; | |
| 93 | UINT64 shift; | |
| 94 | ||
| 95 | reg = decode_reg_64(offset, mem_mask, &shift); | |
| 96 | ||
| 97 | #if DEBUG_PVRTA | |
| 98 | mame_printf_verbose("PVRTA: write %llx to %x (reg %x %x), mask %llx\n", data>>shift, offset, reg, (reg*4)+0x8000, mem_mask); | |
| 99 | #endif | |
| 100 | ||
| 101 | pvrta_regs[reg] |= data >> shift; | |
| 36 | 102 | } |
| 37 | 103 | |
| 38 | 104 | |
| r1478 | r1479 | |
| 45 | 111 | { |
| 46 | 112 | mame_printf_verbose("YUV FIFO: write %llx to %x, mask %llx\n", data, offset, mem_mask); |
| 47 | 113 | } |
| 48 |
| r1478 | r1479 | |
|---|---|---|
| 29 | 29 | |
| 30 | 30 | static UINT8 *vram_fg_draw, *vram_fg_display; |
| 31 | 31 | |
| 32 | static int xscroll0, yscroll0; | |
| 33 | static int xscroll1, yscroll1; | |
| 34 | static int screen_control; | |
| 32 | static INT32 xscroll0, yscroll0; | |
| 33 | static INT32 xscroll1, yscroll1; | |
| 34 | static UINT8 screen_control; | |
| 35 | 35 | |
| 36 | 36 | static UINT16 sprite_source_offs; |
| 37 | 37 | static UINT8 *sprite_dest_base; |
| r1478 | r1479 | |
| 52 | 52 | /* initialize the swapped pointers */ |
| 53 | 53 | vram_fg_draw = (UINT8 *)btoads_vram_fg0; |
| 54 | 54 | vram_fg_display = (UINT8 *)btoads_vram_fg1; |
| 55 | ||
| 56 | state_save_register_global(xscroll0); | |
| 57 | state_save_register_global(xscroll1); | |
| 58 | state_save_register_global(yscroll0); | |
| 59 | state_save_register_global(yscroll1); | |
| 60 | state_save_register_global(screen_control); | |
| 61 | ||
| 62 | state_save_register_global(sprite_source_offs); | |
| 63 | state_save_register_global(sprite_dest_offs); | |
| 64 | state_save_register_global(misc_control); | |
| 55 | 65 | } |
| 56 | 66 | |
| 57 | 67 | |
| r1478 | r1479 | |
| 341 | 351 | int coladdr = fulladdr & 0x3ff; |
| 342 | 352 | int x; |
| 343 | 353 | |
| 354 | if (BT_DEBUG) | |
| 355 | popmessage("screen_control = %02X", screen_control); | |
| 356 | ||
| 344 | 357 | /* for each scanline, switch off the render mode */ |
| 345 | 358 | switch (screen_control & 3) |
| 346 | 359 | { |
| 347 | 360 | /* mode 0: used in ship level, snake boss, title screen (free play) */ |
| 361 | /* priority is: | |
| 362 | 1. BG1 pixels with the high bit set | |
| 363 | 2. Sprites | |
| 364 | 3. BG1 | |
| 365 | 4. BG0 | |
| 366 | */ | |
| 348 | 367 | case 0: |
| 349 | ||
| 350 | /* mode 2: used in EOA screen, jetpack level, first level, high score screen */ | |
| 351 | case 2: | |
| 352 | 368 | for (x = params->heblnk; x < params->hsblnk; x += 2, coladdr++) |
| 353 | 369 | { |
| 370 | UINT16 bg0pix = bg0_base[(coladdr + xscroll0) & 0xff]; | |
| 371 | UINT16 bg1pix = bg1_base[(coladdr + xscroll1) & 0xff]; | |
| 354 | 372 | UINT8 sprpix = spr_base[coladdr & 0xff]; |
| 355 | 373 | |
| 356 | if (sprpix) | |
| 357 | { | |
| 374 | if (bg1pix & 0x80) | |
| 375 | dst[x + 0] = bg1pix & 0xff; | |
| 376 | else if (sprpix) | |
| 358 | 377 | dst[x + 0] = sprpix; |
| 378 | else if (bg1pix & 0xff) | |
| 379 | dst[x + 0] = bg1pix & 0xff; | |
| 380 | else | |
| 381 | dst[x + 0] = bg0pix & 0xff; | |
| 382 | ||
| 383 | if (bg1pix & 0x8000) | |
| 384 | dst[x + 1] = bg1pix >> 8; | |
| 385 | else if (sprpix) | |
| 359 | 386 | dst[x + 1] = sprpix; |
| 360 | } | |
| 387 | else if (bg1pix >> 8) | |
| 388 | dst[x + 1] = bg1pix >> 8; | |
| 361 | 389 | else |
| 362 | { | |
| 363 | UINT16 bg0pix = bg0_base[(coladdr + xscroll0) & 0xff]; | |
| 364 | UINT16 bg1pix = bg1_base[(coladdr + xscroll1) & 0xff]; | |
| 365 | ||
| 366 | if (bg1pix & 0xff) | |
| 367 | dst[x + 0] = bg1pix & 0xff; | |
| 368 | else | |
| 369 | dst[x + 0] = bg0pix & 0xff; | |
| 370 | ||
| 371 | if (bg1pix >> 8) | |
| 372 | dst[x + 1] = bg1pix >> 8; | |
| 373 | else | |
| 374 | dst[x + 1] = bg0pix >> 8; | |
| 375 | } | |
| 390 | dst[x + 1] = bg0pix >> 8; | |
| 376 | 391 | } |
| 377 | 392 | break; |
| 378 | 393 | |
| 379 | 394 | /* mode 1: used in snow level, title screen (free play), top part of rolling ball level */ |
| 395 | /* priority is: | |
| 396 | 1. Sprite pixels with high bit clear | |
| 397 | 2. BG0 | |
| 398 | 3. BG1 pixels with high bit set | |
| 399 | 4. Sprite pixels with high bit set | |
| 400 | 5. BG1 | |
| 401 | */ | |
| 380 | 402 | case 1: |
| 381 | 403 | for (x = params->heblnk; x < params->hsblnk; x += 2, coladdr++) |
| 382 | 404 | { |
| r1478 | r1479 | |
| 413 | 435 | } |
| 414 | 436 | break; |
| 415 | 437 | |
| 438 | /* mode 2: used in EOA screen, jetpack level, first level, high score screen */ | |
| 439 | /* priority is: | |
| 440 | 1. Sprites | |
| 441 | 2. BG1 | |
| 442 | 3. BG0 | |
| 443 | */ | |
| 444 | case 2: | |
| 445 | for (x = params->heblnk; x < params->hsblnk; x += 2, coladdr++) | |
| 446 | { | |
| 447 | UINT8 sprpix = spr_base[coladdr & 0xff]; | |
| 448 | ||
| 449 | if (sprpix) | |
| 450 | { | |
| 451 | dst[x + 0] = sprpix; | |
| 452 | dst[x + 1] = sprpix; | |
| 453 | } | |
| 454 | else | |
| 455 | { | |
| 456 | UINT16 bg0pix = bg0_base[(coladdr + xscroll0) & 0xff]; | |
| 457 | UINT16 bg1pix = bg1_base[(coladdr + xscroll1) & 0xff]; | |
| 458 | ||
| 459 | if (bg1pix & 0xff) | |
| 460 | dst[x + 0] = bg1pix & 0xff; | |
| 461 | else | |
| 462 | dst[x + 0] = bg0pix & 0xff; | |
| 463 | ||
| 464 | if (bg1pix >> 8) | |
| 465 | dst[x + 1] = bg1pix >> 8; | |
| 466 | else | |
| 467 | dst[x + 1] = bg0pix >> 8; | |
| 468 | } | |
| 469 | } | |
| 470 | break; | |
| 471 | ||
| 416 | 472 | /* mode 3: used in toilet level, toad intros, bottom of rolling ball level */ |
| 473 | /* priority is: | |
| 474 | 1. BG1 pixels with the high bit set | |
| 475 | 2. Sprite pixels with the high bit set | |
| 476 | 3. BG1 | |
| 477 | 4. Sprites | |
| 478 | 5. BG0 | |
| 479 | */ | |
| 417 | 480 | case 3: |
| 418 | 481 | for (x = params->heblnk; x < params->hsblnk; x += 2, coladdr++) |
| 419 | 482 | { |
| r1478 | r1479 | |
|---|---|---|
| 190 | 190 | { |
| 191 | 191 | int multi,fx,fy,sx,sy,sy2,code,color; |
| 192 | 192 | |
| 193 | code = spriteram[offs+1] + ( ( spriteram[offs+0] & 0x60 ) << 3 ); | |
| 194 | sx = (240 - spriteram[offs+3]); | |
| 195 | //if (sx < -7) sx += 256; | |
| 193 | /* | |
| 194 | Byte 0: 0x01 - ? | |
| 195 | 0x02 - Y flip | |
| 196 | 0x04 - X flip | |
| 197 | 0x08 - Colour? | |
| 198 | 0x10 - Multi sprite set | |
| 199 | 0x60 - Tile (high bits) | |
| 200 | 0x80 - ? | |
| 201 | Byte 1: 0xff - Tile (low bits) | |
| 202 | Byte 2: 0xff - Y position | |
| 203 | Byte 3: 0xff - X position | |
| 204 | */ | |
| 196 | 205 | |
| 197 | sy = 240-spriteram[offs+2]; | |
| 198 | color = 0;//(spriteram[offs+1] & 0x03);// + ((spriteram[offs+1] & 0x08) >> 1); | |
| 206 | code = spriteram[offs+1] + ((spriteram[offs+0] & 0x60) << 3); | |
| 207 | sx = 240 - spriteram[offs+3]; | |
| 208 | sy = 240 - spriteram[offs+2]; | |
| 209 | color = ((spriteram[offs+1] & 0x08) >> 3); // ? | |
| 199 | 210 | |
| 200 | // if (pri==0 && color!=0) continue; | |
| 201 | // if (pri==1 && color==0) continue; | |
| 202 | ||
| 203 | 211 | fx = spriteram[offs+0] & 0x04; |
| 204 | fy = spriteram[offs+0] & 0x0 | |
| 212 | fy = spriteram[offs+0] & 0x0 | |
| 205 | 213 | multi = spriteram[offs+0] & 0x10; |
| 206 | 214 | |
| 215 | if (multi && fy==0) sy-=16; | |
| 207 | 216 | |
| 208 | if (multi) sy-=16; | |
| 209 | ||
| 210 | 217 | if (flip_screen) { |
| 211 | 218 | sy=240-sy; |
| 212 | 219 | sx=240-sx; |
| 220 | if (fy) | |
| 221 | sy2=sy+16; | |
| 222 | else | |
| 223 | sy2=sy-16; | |
| 213 | 224 | if (fx) fx=0; else fx=1; |
| 214 | 225 | if (fy) fy=0; else fy=1; |
| 215 | sy2=sy-16; | |
| 216 | 226 | } |
| 217 | else sy2=sy+16; | |
| 227 | else { | |
| 228 | if (fy) | |
| 229 | sy2=sy-16; | |
| 230 | else | |
| 231 | sy2=sy+16; | |
| 232 | } | |
| 218 | 233 | |
| 219 | drawgfx(bitmap,machine->gfx[1], | |
| 220 | code, | |
| 221 | color, | |
| 222 | fx,fy, | |
| 223 | sx,sy, | |
| 224 | cliprect,TRANSPARENCY_PEN,0); | |
| 225 | if (multi) | |
| 226 | drawgfx(bitmap,machine->gfx[1], | |
| 227 | code+1, | |
| 228 | color, | |
| 229 | fx,fy, | |
| 230 | sx,sy2, | |
| 231 | cliprect,TRANSPARENCY_PEN,0); | |
| 234 | drawgfx(bitmap,machine->gfx[1], | |
| 235 | code, | |
| 236 | color, | |
| 237 | fx,fy, | |
| 238 | sx,sy, | |
| 239 | cliprect,TRANSPARENCY_PEN,0); | |
| 240 | if (multi) | |
| 241 | drawgfx(bitmap,machine->gfx[1], | |
| 242 | code+1, | |
| 243 | color, | |
| 244 | fx,fy, | |
| 245 | sx,sy2, | |
| 246 | cliprect,TRANSPARENCY_PEN,0); | |
| 232 | 247 | } |
| 233 | 248 | } |
| 234 | 249 |
| r1478 | r1479 | |
|---|---|---|
| 50 | 50 | |
| 51 | 51 | static tilemap *bg_tilemap[6]; |
| 52 | 52 | static UINT8 *tilemap_maskdata; |
| 53 | static int copy_sprites; | |
| 53 | 54 | |
| 54 | 55 | |
| 55 | 56 | |
| r1478 | r1479 | |
| 142 | 143 | machine->shadow_table[machine->pens[i]] = machine->pens[i + 0x0800]; |
| 143 | 144 | |
| 144 | 145 | spriteram = &namcos1_spriteram[0x800]; |
| 146 | ||
| 147 | memset(namcos1_playfield_control, 0, sizeof(namcos1_playfield_control)); | |
| 148 | copy_sprites = 0; | |
| 145 | 149 | } |
| 146 | 150 | |
| 147 | 151 | |
| r1478 | r1479 | |
| 212 | 216 | |
| 213 | 217 | |
| 214 | 218 | |
| 215 | static int copy_sprites; | |
| 216 | 219 | |
| 217 | 220 | READ8_HANDLER( namcos1_spriteram_r ) |
| 218 | 221 | { |
| r1478 | r1479 | |
|---|---|---|
| 319 | 319 | if (input_code_pressed_once (KEYCODE_Z)) |
| 320 | 320 | { |
| 321 | 321 | dislayer[0] ^= 1; |
| 322 | | |
| 322 | | |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | if (input_code_pressed_once (KEYCODE_X)) |
| 326 | 326 | { |
| 327 | 327 | dislayer[1] ^= 1; |
| 328 | | |
| 328 | | |
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | if (input_code_pressed_once (KEYCODE_C)) |
| 332 | 332 | { |
| 333 | 333 | dislayer[2] ^= 1; |
| 334 | | |
| 334 | | |
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | if (input_code_pressed_once (KEYCODE_V)) |
| 338 | 338 | { |
| 339 | 339 | dislayer[3] ^= 1; |
| 340 | | |
| 340 | | |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | if (input_code_pressed_once (KEYCODE_B)) |
| 344 | 344 | { |
| 345 | 345 | dislayer[4] ^= 1; |
| 346 | | |
| 346 | | |
| 347 | 347 | } |
| 348 | 348 | #endif |
| 349 | 349 |
| r1478 | r1479 | |
|---|---|---|
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 | |
| 9 | 9 | #include "driver.h" |
| 10 | #include "video/resnet.h" | |
| 10 | 11 | |
| 12 | #include "includes/mario.h" | |
| 13 | ||
| 11 | 14 | static UINT8 gfx_bank, palette_bank; |
| 15 | static int monitor; | |
| 12 | 16 | |
| 13 | 17 | static tilemap *bg_tilemap; |
| 14 | 18 | |
| 19 | static const res_net_decode_info mario_decode_info = | |
| 20 | { | |
| 21 | 1, // there may be two proms needed to construct color | |
| 22 | 0, // start at 0 | |
| 23 | 255, // end at 255 | |
| 24 | // R, G, B | |
| 25 | { 0, 0, 0}, // offsets | |
| 26 | { 5, 2, 0}, // shifts | |
| 27 | {0x07,0x07,0x03} // masks | |
| 28 | }; | |
| 29 | ||
| 30 | static const res_net_info mario_net_info = | |
| 31 | { | |
| 32 | RES_NET_VCC_5V | RES_NET_VBIAS_5V | RES_NET_VIN_MB7052 | RES_NET_MONITOR_SANYO_EZV20, | |
| 33 | { | |
| 34 | { RES_NET_AMP_DARLINGTON, 470, 0, 3, { 1000, 470, 220 } }, | |
| 35 | { RES_NET_AMP_DARLINGTON, 470, 0, 3, { 1000, 470, 220 } }, | |
| 36 | { RES_NET_AMP_EMITTER, 680, 0, 2, { 470, 220, 0 } } // dkong | |
| 37 | } | |
| 38 | }; | |
| 39 | ||
| 40 | static const res_net_info mario_net_info_std = | |
| 41 | { | |
| 42 | RES_NET_VCC_5V | RES_NET_VBIAS_5V | RES_NET_VIN_MB7052, | |
| 43 | { | |
| 44 | { RES_NET_AMP_DARLINGTON, 470, 0, 3, { 1000, 470, 220 } }, | |
| 45 | { RES_NET_AMP_DARLINGTON, 470, 0, 3, { 1000, 470, 220 } }, | |
| 46 | { RES_NET_AMP_EMITTER, 680, 0, 2, { 470, 220, 0 } } // dkong | |
| 47 | } | |
| 48 | }; | |
| 49 | ||
| 15 | 50 | /*************************************************************************** |
| 16 | 51 | |
| 17 | 52 | Convert the color PROMs into a more useable format. |
| r1478 | r1479 | |
| 34 | 69 | ***************************************************************************/ |
| 35 | 70 | PALETTE_INIT( mario ) |
| 36 | 71 | { |
| 37 | int i; | |
| 38 | #define TOTAL_COLORS(gfxn) (machine->gfx[gfxn]->total_colors * machine->gfx[gfxn]->color_granularity) | |
| 39 | #define COLOR(gfxn,offs) (colortable[machine->drv->gfxdecodeinfo[gfxn].color_codes_start + offs]) | |
| 72 | rgb_t *rgb; | |
| 40 | 73 | |
| 74 | rgb = compute_res_net_all(color_prom, &mario_decode_info, &mario_net_info); | |
| 75 | palette_set_colors(machine, 0, rgb, 256); | |
| 76 | free(rgb); | |
| 77 | rgb = compute_res_net_all(color_prom+256, &mario_decode_info, &mario_net_info_std); | |
| 78 | palette_set_colors(machine, 256, rgb, 256); | |
| 79 | free(rgb); | |
| 41 | 80 | |
| 42 | for (i = 0;i < machine->drv->total_colors;i++) | |
| 43 | { | |
| 44 | int bit0,bit1,bit2,r,g,b; | |
| 45 | ||
| 46 | ||
| 47 | /* red component */ | |
| 48 | bit0 = (*color_prom >> 5) & 1; | |
| 49 | bit1 = (*color_prom >> 6) & 1; | |
| 50 | bit2 = (*color_prom >> 7) & 1; | |
| 51 | r = 255 - (0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2); | |
| 52 | /* green component */ | |
| 53 | bit0 = (*color_prom >> 2) & 1; | |
| 54 | bit1 = (*color_prom >> 3) & 1; | |
| 55 | bit2 = (*color_prom >> 4) & 1; | |
| 56 | g = 255 - (0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2); | |
| 57 | /* blue component */ | |
| 58 | bit0 = (*color_prom >> 0) & 1; | |
| 59 | bit1 = (*color_prom >> 1) & 1; | |
| 60 | b = 255 - (0x55 * bit0 + 0xaa * bit1); | |
| 61 | ||
| 62 | palette_set_color(machine,i,MAKE_RGB(r,g,b)); | |
| 63 | color_prom++; | |
| 64 | } | |
| 65 | ||
| 66 | /* characters use the same palette as sprites, however characters */ | |
| 67 | /* use only colors 64-127 and 192-255. */ | |
| 68 | for (i = 0;i < 8;i++) | |
| 69 | { | |
| 70 | COLOR(0,4*i) = 8*i + 64; | |
| 71 | COLOR(0,4*i+1) = 8*i+1 + 64; | |
| 72 | COLOR(0,4*i+2) = 8*i+2 + 64; | |
| 73 | COLOR(0,4*i+3) = 8*i+3 + 64; | |
| 74 | } | |
| 75 | for (i = 0;i < 8;i++) | |
| 76 | { | |
| 77 | COLOR(0,4*i+8*4) = 8*i + 192; | |
| 78 | COLOR(0,4*i+8*4+1) = 8*i+1 + 192; | |
| 79 | COLOR(0,4*i+8*4+2) = 8*i+2 + 192; | |
| 80 | COLOR(0,4*i+8*4+3) = 8*i+3 + 192; | |
| 81 | } | |
| 82 | ||
| 83 | /* sprites */ | |
| 84 | for (i = 0;i < TOTAL_COLORS(1);i++) | |
| 85 | COLOR(1,i) = i; | |
| 81 | palette_normalize_range(machine->palette, 0, 255, 0, 255); | |
| 82 | palette_normalize_range(machine->palette, 256, 511, 0, 255); | |
| 86 | 83 | } |
| 87 | 84 | |
| 88 | 85 | WRITE8_HANDLER( mario_videoram_w ) |
| r1478 | r1479 | |
| 117 | 114 | static TILE_GET_INFO( get_bg_tile_info ) |
| 118 | 115 | { |
| 119 | 116 | int code = videoram[tile_index] + 256 * gfx_bank; |
| 120 | int color | |
| 117 | int color | |
| 121 | 118 | |
| 119 | color = ((videoram[tile_index] >> 2) & 0x38) | 0x40 | (palette_bank<<7) | (monitor<<8); | |
| 120 | color = color >> 2; | |
| 122 | 121 | SET_TILE_INFO(0, code, color, 0); |
| 123 | 122 | } |
| 124 | 123 | |
| r1478 | r1479 | |
| 141 | 140 | { |
| 142 | 141 | drawgfx(bitmap,machine->gfx[1], |
| 143 | 142 | spriteram[offs + 2], |
| 144 | (spriteram[offs + 1] & 0x0f) + 16 * palette_bank, | |
| 143 | (spriteram[offs + 1] & 0x0f) + 16 * palette_bank+32 * monitor, | |
| 145 | 144 | spriteram[offs + 1] & 0x80,spriteram[offs + 1] & 0x40, |
| 146 | spriteram[offs + 3] - 8, | |
| 145 | spriteram[offs + 3] - 8,(VBSTART - 1) - spriteram[offs] + 8, | |
| 147 | 146 | cliprect,TRANSPARENCY_PEN,0); |
| 148 | 147 | } |
| 149 | 148 | } |
| r1478 | r1479 | |
| 151 | 150 | |
| 152 | 151 | VIDEO_UPDATE( mario ) |
| 153 | 152 | { |
| 153 | int t; | |
| 154 | t = readinputportbytag("MONITOR"); | |
| 155 | if (t != monitor) | |
| 156 | { | |
| 157 | monitor = t; | |
| 158 | tilemap_mark_all_tiles_dirty(ALL_TILEMAPS); | |
| 159 | } | |
| 154 | 160 | tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); |
| 155 | 161 | draw_sprites(machine, bitmap, cliprect); |
| 156 | 162 | return 0; |
| r1478 | r1479 | |
|---|---|---|
| 9 | 9 | #include "driver.h" |
| 10 | 10 | |
| 11 | 11 | UINT8 *suprloco_videoram; |
| 12 | UINT8 *suprloco_scrollram; | |
| 12 | 13 | |
| 13 | 14 | static tilemap *bg_tilemap; |
| 14 | 15 | static int control; |
| r1478 | r1479 | |
| 116 | 117 | tilemap_mark_tile_dirty(bg_tilemap,offset/2); |
| 117 | 118 | } |
| 118 | 119 | |
| 119 | static int suprloco_scrollram[32]; | |
| 120 | ||
| 121 | 120 | WRITE8_HANDLER( suprloco_scrollram_w ) |
| 122 | 121 | { |
| 123 | 122 | int adj = flip_screen ? -8 : 8; |
| r1478 | r1479 | |
| 126 | 125 | tilemap_set_scrollx(bg_tilemap,offset, data - adj); |
| 127 | 126 | } |
| 128 | 127 | |
| 129 | READ8_HANDLER( suprloco_scrollram_r ) | |
| 130 | { | |
| 131 | return suprloco_scrollram[offset]; | |
| 132 | } | |
| 133 | ||
| 134 | 128 | WRITE8_HANDLER( suprloco_control_w ) |
| 135 | 129 | { |
| 136 | 130 | /* There is probably a palette select in here */ |
| r1478 | r1479 | |
| 152 | 146 | coin_counter_w(1, data & 0x02); |
| 153 | 147 | |
| 154 | 148 | flip_screen_set(data & 0x80); |
| 155 | tilemap_set_scrolly(bg_tilemap,0,flip_screen ? -32 : 0); | |
| 156 | 149 | |
| 157 | 150 | control = data; |
| 158 | 151 | } |
| r1478 | r1479 | |
| 208 | 201 | } |
| 209 | 202 | else |
| 210 | 203 | { |
| 211 | adjy = sy + height | |
| 204 | adjy = sy + height - 1 | |
| 212 | 205 | dy = -1; |
| 213 | 206 | } |
| 214 | 207 |
| r0 | r1479 | |
|---|---|---|
| 1 | <?xml version="1.0"?> | |
| 2 | <mamelayout version="2"> | |
| 3 | <element name="digit" defstate="0"> | |
| 4 | <led7seg> | |
| 5 | <color red="1.0" green="0.3" blue="0.0" /> | |
| 6 | </led7seg> | |
| 7 | </element> | |
| 8 | ||
| 9 | <element name="led" defstate="0"> | |
| 10 | <disk state="1"> | |
| 11 | <color red="0.2" green="1.0" blue="0.2" /> | |
| 12 | </disk> | |
| 13 | </element> | |
| 14 | ||
| 15 | <element name="start" defstate="0"> | |
| 16 | <disk state="0"> | |
| 17 | <bounds x="0.1" y="0" width="0.8" height="1" /> | |
| 18 | <color red="0.1" green="0.1" blue="0.1" /> | |
| 19 | </disk> | |
| 20 | <disk state="1"> | |
| 21 | <bounds x="0.1" y="0" width="0.8" height="1" /> | |
| 22 | <color red="1.0" green="1.0" blue="1.0" /> | |
| 23 | </disk> | |
| 24 | <text string="START"> | |
| 25 | <color red="0.0" green="0.0" blue="0.0" /> | |
| 26 | <bounds x="0" y="0.1" width="1" height="0.8" /> | |
| 27 | </text> | |
| 28 | </element> | |
| 29 | ||
| 30 | <element name="radio" defstate="1"> | |
| 31 | <disk state="0"> | |
| 32 | <bounds x="0.1" y="0" width="0.8" height="1" /> | |
| 33 | <color red="0.1" green="0.1" blue="0.1" /> | |
| 34 | </disk> | |
| 35 | <disk state="1"> | |
| 36 | <bounds x="0.1" y="0" width="0.8" height="1" /> | |
| 37 | <color red="1.0" green="1.0" blue="1.0" /> | |
| 38 | </disk> | |
| 39 | <text string="RADIO"> | |
| 40 | <color red="0.0" green="0.0" blue="0.0" /> | |
| 41 | <bounds x="0" y="0.1" width="1" height="0.8" /> | |
| 42 | </text> | |
| 43 | </element> | |
| 44 | ||
| 45 | <element name="view1" defstate="0"> | |
| 46 | <disk state="0"> | |
| 47 | <bounds x="0.1" y="0" width="0.8" height="1" /> | |
| 48 | <color red="0.1" green="0.02" blue="0.02" /> | |
| 49 | </disk> | |
| 50 | <disk state="1"> | |
| 51 | <bounds x="0.1" y="0" width="0.8" height="1" /> | |
| 52 | <color red="1.0" green="0.2" blue="0.2" /> | |
| 53 | </disk> | |
| 54 | <text string="VIEW 1"> | |
| 55 | <color red="0.0" green="0.0" blue="0.0" /> | |
| 56 | <bounds x="0" y="0.1" width="1" height="0.8" /> | |
| 57 | </text> | |
| 58 | </element> | |
| 59 | ||
| 60 | <element name="view2" defstate="0"> | |
| 61 | <disk state="0"> | |
| 62 | <bounds x="0.1" y="0" width="0.8" height="1" /> | |
| 63 | <color red="0.1" green="0.1" blue="0.1" /> | |
| 64 | </disk> | |
| 65 | <disk state="1"> | |
| 66 | <bounds x="0.1" y="0" width="0.8" height="1" /> | |
| 67 | <color red="1.0" green="1.0" blue="1.0" /> | |
| 68 | </disk> | |
| 69 | <text string="VIEW 2"> | |
| 70 | <color red="0.0" green="0.0" blue="0.0" /> | |
| 71 | <bounds x="0" y="0.1" width="1" height="0.8" /> | |
| 72 | </text> | |
| 73 | </element> | |
| 74 | ||
| 75 | <element name="view3" defstate="0"> | |
| 76 | <disk state="0"> | |
| 77 | <bounds x="0.1" y="0" width="0.8" height="1" /> | |
| 78 | <color red="0.02" green="0.02" blue="0.1" /> | |
| 79 | </disk> | |
| 80 | <disk state="1"> | |
| 81 | <bounds x="0.1" y="0" width="0.8" height="1" /> | |
| 82 | <color red="0.2" green="0.2" blue="1.0" /> | |
| 83 | </disk> | |
| 84 | <text string="VIEW 3"> | |
| 85 | <color red="0.0" green="0.0" blue="0.0" /> | |
| 86 | <bounds x="0" y="0.1" width="1" height="0.8" /> | |
| 87 | </text> | |
| 88 | </element> | |
| 89 | ||
| 90 | ||
| 91 | <view name="Simple LEDs"> | |
| 92 | <bounds left="0" top="0" right="4" bottom="3.472" /> | |
| 93 | ||
| 94 | <screen index="0"> | |
| 95 | <bounds left="0" top="0" right="4" bottom="3" /> | |
| 96 | </screen> | |
| 97 | ||
| 98 | <bezel name="digit6" element="digit"> | |
| 99 | <bounds x="1.70" y="3.136" width="0.134" height="0.2" /> | |
| 100 | </bezel> | |
| 101 | <bezel name="digit5" element="digit"> | |
| 102 | <bounds x="1.90" y="3.136" width="0.134" height="0.2" /> | |
| 103 | </bezel> | |
| 104 | <bezel name="digit4" element="digit"> | |
| 105 | <bounds x="2.10" y="3.136" width="0.134" height="0.2" /> | |
| 106 | </bezel> | |
| 107 | ||
| 108 | <bezel name="led0" element="led"> | |
| 109 | <bounds x="0.533" y="3.461" width="0.02" height="0.02" /> | |
| 110 | </bezel> | |
| 111 | <bezel name="led1" element="led"> | |
| 112 | <bounds x="0.533" y="3.370" width="0.02" height="0.02" /> | |
| 113 | </bezel> | |
| 114 | <bezel name="led2" element="led"> | |
| 115 | <bounds x="0.549" y="3.279" width="0.02" height="0.02" /> | |
| 116 | </bezel> | |
| 117 | <bezel name="led3" element="led"> | |
| 118 | <bounds x="0.596" y="3.195" width="0.02" height="0.02" /> | |
| 119 | </bezel> | |
| 120 | <bezel name="led4" element="led"> | |
| 121 | <bounds x="0.670" y="3.123" width="0.02" height="0.02" /> | |
| 122 | </bezel> | |
| 123 | <bezel name="led5" element="led"> | |
| 124 | <bounds x="0.767" y="3.067" width="0.02" height="0.02" /> | |
| 125 | </bezel> | |
| 126 | <bezel name="led6" element="led"> | |
| 127 | <bounds x="0.879" y="3.032" width="0.02" height="0.02" /> | |
| 128 | </bezel> | |
| 129 | <bezel name="led7" element="led"> | |
| 130 | <bounds x="1.000" y="3.020" width="0.02" height="0.02" /> | |
| 131 | </bezel> | |
| 132 | <bezel name="led16" element="led"> | |
| 133 | <bounds x="1.121" y="3.032" width="0.02" height="0.02" /> | |
| 134 | </bezel> | |
| 135 | <bezel name="led17" element="led"> | |
| 136 | <bounds x="1.233" y="3.067" width="0.02" height="0.02" /> | |
| 137 | </bezel> | |
| 138 | ||
| 139 | <bezel name="led8" element="led"> | |
| 140 | <bounds x="3.467" y="3.461" width="0.02" height="0.02" /> | |
| 141 | </bezel> | |
| 142 | <bezel name="led9" element="led"> | |
| 143 | <bounds x="3.467" y="3.370" width="0.02" height="0.02" /> | |
| 144 | </bezel> | |
| 145 | <bezel name="led10" element="led"> | |
| 146 | <bounds x="3.451" y="3.279" width="0.02" height="0.02" /> | |
| 147 | </bezel> | |
| 148 | <bezel name="led11" element="led"> | |
| 149 | <bounds x="3.404" y="3.195" width="0.02" height="0.02" /> | |
| 150 | </bezel> | |
| 151 | <bezel name="led12" element="led"> | |
| 152 | <bounds x="3.330" y="3.123" width="0.02" height="0.02" /> | |
| 153 | </bezel> | |
| 154 | <bezel name="led13" element="led"> | |
| 155 | <bounds x="3.233" y="3.067" width="0.02" height="0.02" /> | |
| 156 | </bezel> | |
| 157 | <bezel name="led14" element="led"> | |
| 158 | <bounds x="3.121" y="3.032" width="0.02" height="0.02" /> | |
| 159 | </bezel> | |
| 160 | <bezel name="led15" element="led"> | |
| 161 | <bounds x="3.000" y="3.020" width="0.02" height="0.02" /> | |
| 162 | </bezel> | |
| 163 | <bezel name="led22" element="led"> | |
| 164 | <bounds x="2.879" y="3.032" width="0.02" height="0.02" /> | |
| 165 | </bezel> | |
| 166 | <bezel name="led23" element="led"> | |
| 167 | <bounds x="2.767" y="3.067" width="0.02" height="0.02" /> | |
| 168 | </bezel> | |
| 169 | ||
| 170 | <bezel name="lamp0" element="start"> | |
| 171 | <bounds x="3.5" y="3.3" width="0.4" height="0.1" /> | |
| 172 | </bezel> | |
| 173 | <bezel name="lamp1" element="view1"> | |
| 174 | <bounds x="0.1" y="3.1" width="0.4" height="0.1" /> | |
| 175 | </bezel> | |
| 176 | <bezel name="lamp2" element="view2"> | |
| 177 | <bounds x="0.1" y="3.2" width="0.4" height="0.1" /> | |
| 178 | </bezel> | |
| 179 | <bezel name="lamp3" element="view3"> | |
| 180 | <bounds x="0.1" y="3.3" width="0.4" height="0.1" /> | |
| 181 | </bezel> | |
| 182 | </view> | |
| 183 | </mamelayout> |
| r1478 | r1479 | |
|---|---|---|
| 27 | 27 | * Super Hi Impact Proto V4.0: You need to at least reset the high score |
| 28 | 28 | table from the UTILITIES menu. It's best to do a FULL FACTORY RESTORE |
| 29 | 29 | |
| 30 | ||
| 31 | Super High Impact | |
| 32 | Midway, 1991 | |
| 33 | ||
| 34 | This game runs on (typical) Midway Y-Unit hardware. The PCB is a base | |
| 35 | board 'system' that can run other Y-Unit games by swapping ROMs and | |
| 36 | the protection chip. | |
| 37 | ||
| 38 | PCB Layout | |
| 39 | ---------- | |
| 40 | ||
| 41 | 5770-12555-00 REV. - A | |
| 42 | |-------------------------------------------------------------------| | |
| 43 | | 6264 PAL 53461 53461 53461 48MHZ 24MHz J6| | |
| 44 | |J4 53461 53461 53461 | | |
| 45 | | 53461 53461 53461 | | |
| 46 | | 53461 53461 53461 | | |
| 47 | |J2 MAX691 6264 PAL |-----| | | |
| 48 | | PAL PAL |TMS | J7| | |
| 49 | |RESET_SW |34010| | | |
| 50 | | LED1 |-----| | | |
| 51 | | LED2 6264 PAL PAL | | |
| 52 | | | | |
| 53 | |J 41464 41464 J8| | |
| 54 | |A PAL 41464 41464 | | |
| 55 | |M | | |
| 56 | |M | | |
| 57 | |A U89 U90 U91 U92 U93 U95 U96 U97 U98 | | |
| 58 | | |--------| | | |
| 59 | | |L1A3787 | | | |
| 60 | | |WILLIAMS| | | |
| 61 | | |5410-12239 | | |
| 62 | | |--------| | | |
| 63 | |DSW1 DSW2 | | |
| 64 | |BATTERY *A-5346-40017-8| | |
| 65 | | | | |
| 66 | | J13 J12 U105 U106 U107 U108 U109 U111 U112 U113 U114 | | |
| 67 | |-------------------------------------------------------------------| | |
| 68 | Notes: | |
| 69 | * - Intel P5C090-50 protection chip labelled 'A-5346-40017-8' | |
| 70 | clocks on pin1 6.00MHz, pin4 6.00MHz, pin21 6.00MHz | |
| 71 | J* - multi-pin connectors for additional controls, cabinet switches | |
| 72 | and power input and output | |
| 73 | J8 - used to connect external sound PCB via a flat cable. | |
| 74 | J2 - Used to supply power to external sound PCB | |
| 75 | 34010 - clock 6.000MHz [48/8] | |
| 76 | LED1 - power active | |
| 77 | LED2 - data active, flickers while PCB is working | |
| 78 | U89/105 - main program EPROMs 27C010 | |
| 79 | Other U* - 27C020 EPROMs | |
| 80 | ||
| 81 | ||
| 82 | Sound PCB | |
| 83 | --------- | |
| 84 | ||
| 85 | 5766-12702-00 REV. B | |
| 86 | |----------------------------------------| | |
| 87 | | 3.579545MHz 6116 U4 U19 U20 | | |
| 88 | | YM2151 | | |
| 89 | |YM3012 | | |
| 90 | | 458 6809 | | |
| 91 | | 458 | | |
| 92 | | MC1408 | | |
| 93 | |J1 6821 | | |
| 94 | | | | |
| 95 | | 458 55536 8MHz | | |
| 96 | | 458 | | |
| 97 | | | | |
| 98 | |J2 J| | |
| 99 | | J3 J4 TDA2002 TDA2002| | |
| 100 | |----------------------------------------| | |
| 101 | Notes: | |
| 102 | 6809 - clock 2.000MHz [8/4] | |
| 103 | YM2151 - clock 3.579545MHz | |
| 104 | 55536 - Harris HC-55536 Continuously Variable Slope Delta Modulator | |
| 105 | 6116 - 2k x8 SRAM | |
| 106 | U* - 27C010 EPROMs | |
| 107 | J4 - flat cable connector from main board J8 | |
| 108 | J3 - power input connector | |
| 109 | J2 - connector for volume pot | |
| 110 | J - speakers output connector | |
| 111 | ||
| 30 | 112 | **************************************************************************/ |
| 31 | 113 | |
| 32 | 114 | #include "driver.h" |
| r1478 | r1479 | |
|---|---|---|
| 98 | 98 | UINT16 *sslam_spriteram, *sslam_regs; |
| 99 | 99 | |
| 100 | 100 | static UINT8 playmark_oki_control = 0, playmark_oki_command = 0; |
| 101 | static UINT8 playmark_oki_bank = 0; | |
| 101 | 102 | |
| 102 | 103 | |
| 103 | ||
| 104 | 104 | /************************************************************************** |
| 105 | 105 | This table converts commands sent from the main CPU, into sample numbers |
| 106 | 106 | played back by the sound processor (the 87C751). |
| r1478 | r1479 | |
| 371 | 371 | sslam_play(sslam_melody, sslam_sound); |
| 372 | 372 | } |
| 373 | 373 | else if (sslam_sound >= 0x60) { |
| 374 | sslam_snd_bank = 0 | |
| 374 | if (sslam_snd_bank != 0) | |
| 375 | 375 | OKIM6295_set_bank_base(0, (0 * 0x40000)); |
| 376 | 376 | sslam_snd_bank = 0; |
| 377 | 377 | switch (sslam_sound) |
| r1478 | r1479 | |
| 469 | 469 | |
| 470 | 470 | static WRITE8_HANDLER( playmark_snd_control_w ) |
| 471 | 471 | { |
| 472 | static int oki_old_bank = -1; | |
| 473 | ||
| 474 | 472 | playmark_oki_control = data; |
| 475 | 473 | |
| 476 | 474 | if(data & 3) |
| 477 | 475 | { |
| 478 | if(oki_ | |
| 476 | if(playmark_oki_ | |
| 479 | 477 | { |
| 480 | oki_old_bank = data & 3; | |
| 481 | OKIM6295_set_bank_base(0, 0x40000 * (oki_old_bank - 1)); | |
| 478 | playmark_oki_bank = (data & 3) - 1; | |
| 479 | OKIM6295_set_bank_base(0, 0x40000 * playmark_oki_bank); | |
| 482 | 480 | } |
| 483 | 481 | } |
| 484 | 482 | |
| r1478 | r1479 | |
| 965 | 963 | { |
| 966 | 964 | state_save_register_global(playmark_oki_control); |
| 967 | 965 | state_save_register_global(playmark_oki_command); |
| 966 | state_save_register_global(playmark_oki_bank); | |
| 968 | 967 | } |
| 969 | 968 | |
| 970 | 969 |
| r1478 | r1479 | |
|---|---|---|
| 26 | 26 | |
| 27 | 27 | #define VERBOSE_LEVEL ( 0 ) |
| 28 | 28 | |
| 29 | INLINE void verboselog( int n_level, const char *s_fmt, ... ) | |
| 29 | INLINE void ATTR_PRINTF(2,3) verboselog( int n_level, const char *s_fmt, ... ) | |
| 30 | 30 | { |
| 31 | 31 | if( VERBOSE_LEVEL >= n_level ) |
| 32 | 32 | { |
| r1478 | r1479 | |
|---|---|---|
| 16 | 16 | **************************************************************************/ |
| 17 | 17 | |
| 18 | 18 | #include "driver.h" |
| 19 | #include "debugger.h" | |
| 19 | 20 | #include "cpu/tms34010/tms34010.h" |
| 20 | 21 | #include "cpu/adsp2100/adsp2100.h" |
| 21 | 22 | #include "includes/midzeus.h" |
| r1478 | r1479 | |
| 23 | 24 | #include "machine/timekpr.h" |
| 24 | 25 | #include "audio/dcs.h" |
| 25 | 26 | |
| 27 | #include "crusnexo.lh" | |
| 26 | 28 | |
| 27 | #define CPU_CLOCK 60000000 | |
| 28 | 29 | |
| 30 | #define CPU_CLOCK XTAL_60MHz | |
| 31 | ||
| 29 | 32 | #define BEAM_DY 3 |
| 30 | 33 | #define BEAM_DX 3 |
| 31 | 34 | #define BEAM_XOFFS 40 /* table in the code indicates an offset of 20 with a beam height of 7 */ |
| r1478 | r1479 | |
| 35 | 38 | static emu_timer * gun_timer[2]; |
| 36 | 39 | static INT32 gun_x[2], gun_y[2]; |
| 37 | 40 | |
| 41 | static UINT8 crusnexo_leds_select; | |
| 42 | static UINT8 keypad_select; | |
| 43 | static UINT8 bitlatch[10]; | |
| 44 | ||
| 38 | 45 | static UINT32 *ram_base; |
| 39 | 46 | static UINT32 *zpram; |
| 40 | 47 | static size_t zpram_size; |
| 41 | 48 | static UINT8 cmos_protected; |
| 42 | 49 | |
| 50 | static UINT32 *linkram; | |
| 51 | ||
| 43 | 52 | static emu_timer *timer[2]; |
| 44 | 53 | |
| 45 | 54 | static UINT32 *tms32031_control; |
| r1478 | r1479 | |
| 67 | 76 | state_save_register_global(gun_irq_state); |
| 68 | 77 | state_save_register_global_array(gun_x); |
| 69 | 78 | state_save_register_global_array(gun_y); |
| 79 | state_save_register_global(crusnexo_leds_select); | |
| 80 | state_save_register_global(keypad_select); | |
| 70 | 81 | } |
| 71 | 82 | |
| 72 | 83 | |
| r1478 | r1479 | |
| 114 | 125 | |
| 115 | 126 | static WRITE32_HANDLER( cmos_w ) |
| 116 | 127 | { |
| 117 | if (!cmos_protected) | |
| 128 | if (bitlatch[2] && !cmos_protected) | |
| 118 | 129 | COMBINE_DATA(&generic_nvram32[offset]); |
| 130 | else | |
| 131 | logerror("%06X:timekeeper_w with bitlatch[2] = %d, cmos_protected = %d\n", activecpu_get_pc(), bitlatch[2], cmos_protected); | |
| 119 | 132 | cmos_protected = TRUE; |
| 120 | 133 | } |
| 121 | 134 | |
| 122 | 135 | |
| 123 | 136 | static READ32_HANDLER( cmos_r ) |
| 124 | 137 | { |
| 125 | return generic_nvram32[offset]; | |
| 138 | return generic_nvram32[offset] | 0xffffff00; | |
| 126 | 139 | } |
| 127 | 140 | |
| 128 | 141 | |
| r1478 | r1479 | |
| 135 | 148 | |
| 136 | 149 | /************************************* |
| 137 | 150 | * |
| 138 | * Timekeeper access (Zeus 2 only) | |
| 151 | * Timekeeper and ZPRAM access | |
| 152 | * (Zeus 2 only) | |
| 139 | 153 | * |
| 140 | 154 | *************************************/ |
| 141 | 155 | |
| 142 | 156 | static READ32_HANDLER( timekeeper_r ) |
| 143 | 157 | { |
| 144 | UINT8 result = timekeeper_0_r(offset); | |
| 145 | // logerror("%06X:cmos_time_r(%X) = %02X\n", activecpu_get_pc(), offset, result); | |
| 146 | return result; | |
| 158 | return timekeeper_0_r(offset) | 0xffffff00; | |
| 147 | 159 | } |
| 148 | 160 | |
| 149 | 161 | |
| 150 | 162 | static WRITE32_HANDLER( timekeeper_w ) |
| 151 | 163 | { |
| 152 | if (!cmos_protected) | |
| 153 | { | |
| 154 | // logerror("%06X:cmos_time_w(%X) = %02X\n", activecpu_get_pc(), offset, data); | |
| 164 | if (bitlatch[2] && !cmos_protected) | |
| 155 | 165 | timekeeper_0_w(offset, data); |
| 156 | } | |
| 166 | else | |
| 167 | logerror("%06X:timekeeper_w with bitlatch[2] = %d, cmos_protected = %d\n", activecpu_get_pc(), bitlatch[2], cmos_protected); | |
| 157 | 168 | cmos_protected = TRUE; |
| 158 | 169 | } |
| 159 | 170 | |
| 160 | 171 | |
| 161 | ||
| 162 | /************************************* | |
| 163 | * | |
| 164 | * Zero-power RAM access (Zeus 2 only) | |
| 165 | * | |
| 166 | *************************************/ | |
| 167 | ||
| 168 | static WRITE32_HANDLER( zpram_w ) | |
| 172 | static READ32_HANDLER( zpram_r ) | |
| 169 | 173 | { |
| 170 | /* ZPRAM seems to use the same protection control as CMOS */ | |
| 171 | // if (!cmos_protected) | |
| 172 | COMBINE_DATA(zpram + offset); | |
| 173 | cmos_protected = TRUE; | |
| 174 | return zpram[offset] | 0xffffff00; | |
| 174 | 175 | } |
| 175 | 176 | |
| 176 | 177 | |
| 177 | static RE | |
| 178 | static WRITE | |
| 178 | 179 | { |
| 179 | return zpram[offset] | 0xffffff00; | |
| 180 | if (bitlatch[2]) | |
| 181 | COMBINE_DATA(&zpram[offset]); | |
| 182 | else | |
| 183 | logerror("%06X:zpram_w with bitlatch[2] = %d\n", activecpu_get_pc(), bitlatch[2]); | |
| 180 | 184 | } |
| 181 | 185 | |
| 182 | 186 | |
| r1478 | r1479 | |
| 203 | 207 | |
| 204 | 208 | /************************************* |
| 205 | 209 | * |
| 210 | * Miscellaneous bit latches | |
| 211 | * | |
| 212 | *************************************/ | |
| 213 | ||
| 214 | static READ32_HANDLER( bitlatches_r ) | |
| 215 | { | |
| 216 | switch (offset) | |
| 217 | { | |
| 218 | /* unknown purpose; two bits are apparently used */ | |
| 219 | case 1: | |
| 220 | return bitlatch[offset] | ~3; | |
| 221 | ||
| 222 | /* CMOS/ZPRAM extra enable latch; only low bit is used */ | |
| 223 | case 2: | |
| 224 | return bitlatch[offset] | ~1; | |
| 225 | ||
| 226 | /* unknown purpose; mk4/invasn/thegrid read at startup; invasn freaks if it is 1 at startup */ | |
| 227 | /* only low bit is used */ | |
| 228 | case 3: | |
| 229 | return bitlatch[offset] | ~1; | |
| 230 | ||
| 231 | /* ROM bank selection on Zeus 2; two bits are used */ | |
| 232 | case 5: | |
| 233 | return bitlatch[offset] | ~3; | |
| 234 | ||
| 235 | /* unknown purpose; crusnexo reads at startup: if (val & 0xf0) == 0xa0 it affects */ | |
| 236 | /* how the Zeus is used (reg 0x5d is set to 0x54580006) */ | |
| 237 | /* thegrid does the same, writing either 0xD4580006 or 0xC4180006 depending */ | |
| 238 | /* this is the value reported as DISK JR ASIC version in thegrid startup test */ | |
| 239 | case 6: | |
| 240 | return 0xa0 | ~0xff; | |
| 241 | ||
| 242 | /* unknown purpose */ | |
| 243 | default: | |
| 244 | logerror("%06X:bitlatches_r(%X)\n", activecpu_get_pc(), offset); | |
| 245 | break; | |
| 246 | } | |
| 247 | return ~0; | |
| 248 | } | |
| 249 | ||
| 250 | ||
| 251 | static WRITE32_HANDLER( bitlatches_w ) | |
| 252 | { | |
| 253 | UINT32 oldval = bitlatch[offset]; | |
| 254 | bitlatch[offset] = data; | |
| 255 | ||
| 256 | switch (offset) | |
| 257 | { | |
| 258 | /* unknown purpose */ | |
| 259 | default: | |
| 260 | if (oldval ^ data) | |
| 261 | logerror("%06X:bitlatches_w(%X) = %X\n", activecpu_get_pc(), offset, data); | |
| 262 | break; | |
| 263 | ||
| 264 | /* unknown purpose; crusnexo toggles this between 0 and 1 every 20 frames; thegrid writes 1 */ | |
| 265 | case 0: | |
| 266 | if (data != 0 && data != 1) | |
| 267 | logerror("%06X:bitlatches_w(%X) = %X (unexpected)\n", activecpu_get_pc(), offset, data); | |
| 268 | break; | |
| 269 | ||
| 270 | /* unknown purpose; mk4/invasn write 1 here at initialization; crusnexo/thegrid write 3 */ | |
| 271 | case 1: | |
| 272 | if (data != 1 && data != 3) | |
| 273 | logerror("%06X:bitlatches_w(%X) = %X (unexpected)\n", activecpu_get_pc(), offset, data); | |
| 274 | break; | |
| 275 | ||
| 276 | /* CMOS/ZPRAM extra enable latch; only low bit is used */ | |
| 277 | case 2: | |
| 278 | break; | |
| 279 | ||
| 280 | /* unknown purpose; invasn writes 2 here at startup */ | |
| 281 | case 4: | |
| 282 | if (data != 2) | |
| 283 | logerror("%06X:bitlatches_w(%X) = %X (unexpected)\n", activecpu_get_pc(), offset, data); | |
| 284 | break; | |
| 285 | ||
| 286 | /* ROM bank selection on Zeus 2 */ | |
| 287 | case 5: | |
| 288 | memory_set_bank(1, bitlatch[offset] & 3); | |
| 289 | break; | |
| 290 | ||
| 291 | /* unknown purpose; crusnexo/thegrid write 1 at startup */ | |
| 292 | case 7: | |
| 293 | if (data != 1) | |
| 294 | logerror("%06X:bitlatches_w(%X) = %X (unexpected)\n", activecpu_get_pc(), offset, data); | |
| 295 | break; | |
| 296 | ||
| 297 | /* unknown purpose; crusnexo writes 4 at startup; thegrid writes 6 */ | |
| 298 | case 8: | |
| 299 | if (data != 4 && data != 6) | |
| 300 | logerror("%06X:bitlatches_w(%X) = %X (unexpected)\n", activecpu_get_pc(), offset, data); | |
| 301 | break; | |
| 302 | ||
| 303 | /* unknown purpose; thegrid writes 1 at startup */ | |
| 304 | case 9: | |
| 305 | if (data != 1) | |
| 306 | logerror("%06X:bitlatches_w(%X) = %X (unexpected)\n", activecpu_get_pc(), offset, data); | |
| 307 | break; | |
| 308 | } | |
| 309 | } | |
| 310 | ||
| 311 | ||
| 312 | ||
| 313 | /************************************* | |
| 314 | * | |
| 315 | * 7-segment LED controls | |
| 316 | * | |
| 317 | *************************************/ | |
| 318 | ||
| 319 | static READ32_HANDLER( crusnexo_leds_r ) | |
| 320 | { | |
| 321 | /* reads appear to just be for synchronization */ | |
| 322 | return ~0; | |
| 323 | } | |
| 324 | ||
| 325 | ||
| 326 | static WRITE32_HANDLER( crusnexo_leds_w ) | |
| 327 | { | |
| 328 | int bit, led; | |
| 329 | ||
| 330 | switch (offset) | |
| 331 | { | |
| 332 | case 0: /* unknown purpose */ | |
| 333 | break; | |
| 334 | ||
| 335 | case 1: /* controls lamps */ | |
| 336 | for (bit = 0; bit < 8; bit++) | |
| 337 | output_set_lamp_value(bit, (data >> bit) & 1); | |
| 338 | break; | |
| 339 | ||
| 340 | case 2: /* sets state of selected LEDs */ | |
| 341 | ||
| 342 | /* selection bits 4-6 select the 3 7-segment LEDs */ | |
| 343 | for (bit = 4; bit < 7; bit++) | |
| 344 | if ((crusnexo_leds_select & (1 << bit)) == 0) | |
| 345 | output_set_digit_value(bit, ~data & 0xff); | |
| 346 | ||
| 347 | /* selection bits 0-2 select the tachometer LEDs */ | |
| 348 | for (bit = 0; bit < 3; bit++) | |
| 349 | if ((crusnexo_leds_select & (1 << bit)) == 0) | |
| 350 | for (led = 0; led < 8; led++) | |
| 351 | output_set_led_value(bit * 8 + led, (~data >> led) & 1); | |
| 352 | break; | |
| 353 | ||
| 354 | case 3: /* selects which set of LEDs we are addressing */ | |
| 355 | crusnexo_leds_select = data; | |
| 356 | break; | |
| 357 | } | |
| 358 | } | |
| 359 | ||
| 360 | ||
| 361 | /************************************* | |
| 362 | * | |
| 363 | * Link controller access (Zeus 2 only) | |
| 364 | * | |
| 365 | *************************************/ | |
| 366 | ||
| 367 | // read 8d0003, check bit 1, skip some stuff if 0 | |
| 368 | // write junk to 9e0000 | |
| 369 | ||
| 370 | static READ32_HANDLER( linkram_r ) | |
| 371 | { | |
| 372 | logerror("%06X:unknown_8a000_r(%02X)\n", activecpu_get_pc(), offset); | |
| 373 | if (offset == 0) | |
| 374 | return 0x30313042; | |
| 375 | else if (offset == 0x3c) | |
| 376 | return 0xffffffff; | |
| 377 | return linkram[offset]; | |
| 378 | } | |
| 379 | ||
| 380 | static WRITE32_HANDLER( linkram_w ) | |
| 381 | { | |
| 382 | logerror("%06X:unknown_8a000_w(%02X) = %08X\n", activecpu_get_pc(), offset, data); | |
| 383 | COMBINE_DATA(&linkram[offset]); | |
| 384 | } | |
| 385 | ||
| 386 | ||
| 387 | ||
| 388 | /************************************* | |
| 389 | * | |
| 206 | 390 | * TMS32031 I/O accesses |
| 207 | 391 | * |
| 208 | 392 | *************************************/ |
| r1478 | r1479 | |
| 262 | 446 | } |
| 263 | 447 | |
| 264 | 448 | |
| 449 | static WRITE32_HANDLER( keypad_select_w ) | |
| 450 | { | |
| 451 | if (offset == 1) | |
| 452 | keypad_select = data; | |
| 453 | } | |
| 265 | 454 | |
| 455 | ||
| 456 | static UINT32 keypad_r(void *param) | |
| 457 | { | |
| 458 | UINT32 bits = readinputportbytag(param); | |
| 459 | UINT8 select = keypad_select; | |
| 460 | while ((select & 1) != 0) | |
| 461 | { | |
| 462 | select >>= 1; | |
| 463 | bits >>= 4; | |
| 464 | } | |
| 465 | return bits; | |
| 466 | } | |
| 467 | ||
| 468 | ||
| 469 | ||
| 266 | 470 | /************************************* |
| 267 | 471 | * |
| 268 | 472 | * Analog input handling |
| r1478 | r1479 | |
| 373 | 577 | * |
| 374 | 578 | *************************************/ |
| 375 | 579 | |
| 376 | ||
| 377 | // read 8d0003, check bit 1, skip some stuff if 0 | |
| 378 | // write junk to 9e0000 | |
| 379 | ||
| 380 | static UINT32 *unknown_8a0000; | |
| 381 | static UINT32 *unknown_8d0000; | |
| 382 | static READ32_HANDLER( unknown_8d0000_r ) | |
| 383 | { | |
| 384 | return unknown_8d0000[offset]; | |
| 385 | } | |
| 386 | static WRITE32_HANDLER( unknown_8d0000_w ) | |
| 387 | { | |
| 388 | // logerror("%06X:write to %06X = %08X\n", activecpu_get_pc(), 0x8d0000 + offset, data); | |
| 389 | COMBINE_DATA(&unknown_8d0000[offset]); | |
| 390 | } | |
| 391 | static WRITE32_HANDLER( unknown_9d0000_w ) | |
| 392 | { | |
| 393 | // logerror("%06X:write to %06X = %08X\n", activecpu_get_pc(), 0x9d0000 + offset, data); | |
| 394 | COMBINE_DATA(&unknown_8d0000[offset]); | |
| 395 | } | |
| 396 | ||
| 397 | static WRITE32_HANDLER( rombank_select_w ) | |
| 398 | { | |
| 399 | if (data >= 0 && data <= 2) | |
| 400 | memory_set_bank(1, data); | |
| 401 | } | |
| 402 | ||
| 403 | static READ32_HANDLER( unknown_8a0000_r ) | |
| 404 | { | |
| 405 | logerror("%06X:unknown_8a000_r(%02X)\n", activecpu_get_pc(), offset); | |
| 406 | if (offset == 0) | |
| 407 | return 0x30313042; | |
| 408 | return unknown_8a0000[offset]; | |
| 409 | } | |
| 410 | ||
| 411 | static WRITE32_HANDLER( unknown_8a0000_w ) | |
| 412 | { | |
| 413 | logerror("%06X:unknown_8a000_w(%02X) = %08X\n", activecpu_get_pc(), offset, data); | |
| 414 | COMBINE_DATA(&unknown_8a0000[offset]); | |
| 415 | } | |
| 416 | ||
| 417 | ||
| 418 | 580 | static ADDRESS_MAP_START( zeus_map, ADDRESS_SPACE_PROGRAM, 32 ) |
| 419 | 581 | ADDRESS_MAP_FLAGS( AMEF_UNMAP(1) ) |
| 420 | 582 | AM_RANGE(0x000000, 0x03ffff) AM_RAM AM_BASE(&ram_base) |
| 421 | 583 | AM_RANGE(0x400000, 0x41ffff) AM_RAM |
| 422 | 584 | AM_RANGE(0x808000, 0x80807f) AM_READWRITE(tms32031_control_r, tms32031_control_w) AM_BASE(&tms32031_control) |
| 423 | 585 | AM_RANGE(0x880000, 0x8803ff) AM_READWRITE(zeus_r, zeus_w) AM_BASE(&zeusbase) |
| 424 | AM_RANGE(0x8d0000, 0x8d000 | |
| 586 | AM_RANGE(0x8d0000, 0x8d0004) AM_READWRITE(bitlatches_ | |
| 425 | 587 | AM_RANGE(0x990000, 0x99000f) AM_READWRITE(midway_ioasic_r, midway_ioasic_w) |
| 426 | AM_RANGE(0x9d0000, 0x9d0001) AM_WRITE(unknown_9d0000_w) | |
| 427 | 588 | AM_RANGE(0x9e0000, 0x9e0000) AM_WRITENOP // watchdog? |
| 428 | 589 | AM_RANGE(0x9f0000, 0x9f7fff) AM_READWRITE(cmos_r, cmos_w) AM_BASE(&generic_nvram32) AM_SIZE(&generic_nvram_size) |
| 429 | 590 | AM_RANGE(0x9f8000, 0x9f8000) AM_WRITE(cmos_protect_w) |
| r1478 | r1479 | |
| 437 | 598 | AM_RANGE(0x400000, 0x43ffff) AM_RAM |
| 438 | 599 | AM_RANGE(0x808000, 0x80807f) AM_READWRITE(tms32031_control_r, tms32031_control_w) AM_BASE(&tms32031_control) |
| 439 | 600 | AM_RANGE(0x880000, 0x88007f) AM_READWRITE(zeus2_r, zeus2_w) AM_BASE(&zeusbase) |
| 440 | AM_RANGE(0x8a0000, 0x8a0027) AM_READWRITE(unknown_8a0000_r, unknown_8a0000_w) AM_BASE(&unknown_8a0000) | |
| 441 | AM_RANGE(0x8d0000, 0x8d0003) AM_READWRITE(unknown_8d0000_r, unknown_8d0000_w) AM_BASE(&unknown_8d0000) | |
| 442 | AM_RANGE(0x8d0005, 0x8d0005) AM_WRITE(rombank_select_w) | |
| 601 | AM_RANGE(0x8a0000, 0x8a003f) AM_READWRITE(linkram_r, linkram_w) AM_BASE(&linkram) | |
| 602 | AM_RANGE(0x8d0000, 0x8d000a) AM_READWRITE(bitlatches_r, bitlatches_w) | |
| 443 | 603 | AM_RANGE(0x900000, 0x91ffff) AM_READWRITE(zpram_r, zpram_w) AM_BASE(&zpram) AM_SIZE(&zpram_size) AM_MIRROR(0x020000) |
| 444 | 604 | AM_RANGE(0x990000, 0x99000f) AM_READWRITE(midway_ioasic_r, midway_ioasic_w) |
| 445 | 605 | AM_RANGE(0x9c0000, 0x9c000f) AM_READWRITE(analog_r, analog_w) |
| r1478 | r1479 | |
| 450 | 610 | AM_RANGE(0xc00000, 0xffffff) AM_ROMBANK(1) AM_REGION(REGION_USER2, 0) |
| 451 | 611 | ADDRESS_MAP_END |
| 452 | 612 | |
| 613 | /* | |
| 453 | 614 | |
| 615 | mk4: | |
| 454 | 616 | |
| 617 | writes to 9D0000: 00000009, FFFFFFFF | |
| 618 | reads from 9D0000 | |
| 619 | writes to 9D0001: 00000000 | |
| 620 | writes to 9D0003: 00000374 | |
| 621 | writes to 9D0005: 00000000 | |
| 622 | ||
| 623 | crusnexo: | |
| 624 | ||
| 625 | reads from 8A0000 | |
| 626 | ||
| 627 | writes to 9D0000: 00000000, 00000008, 00000009, FFFFFFFF | |
| 628 | reads from 9D0000 | |
| 629 | writes to 9D0001: 00000000, 00000004, 00000204 | |
| 630 | writes to 9D0003: 00000374 | |
| 631 | -- hard coded to $374 at startup | |
| 632 | writes to 9D0004: 0000000F | |
| 633 | -- hard coded to $F at startup | |
| 634 | ||
| 635 | writes to 9E0008: 00000000 | |
| 636 | ||
| 637 | writes to 9E8000: 00810081 | |
| 638 | ||
| 639 | thegrid: | |
| 640 | ||
| 641 | writes to 9D0000: 00000008, 00000009, 0000008D | |
| 642 | writes to 9D0001: 00000000, 00000004, 00000204 | |
| 643 | writes to 9D0003: 00000354 | |
| 644 | reads from 9D0003 | |
| 645 | writes to 9D0004: FFFFFFFF | |
| 646 | writes to 9D0005: 00000000 | |
| 647 | ||
| 648 | writes to 9E8000: 00810081 | |
| 649 | */ | |
| 650 | ||
| 651 | ||
| 455 | 652 | /************************************* |
| 456 | 653 | * |
| 457 | 654 | * Input ports |
| r1478 | r1479 | |
| 751 | 948 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 752 | 949 | |
| 753 | 950 | PORT_START |
| 951 | PORT_BIT( 0x0007, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM( keypad_r, "KEYPAD" ) | |
| 952 | PORT_BIT( 0xfff8, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 953 | ||
| 954 | PORT_START_TAG("KEYPAD") | |
| 754 | 955 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3) /* keypad 3 */ |
| 755 | 956 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) /* keypad 1 */ |
| 756 | 957 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3) /* keypad 2 */ |
| 757 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(3) /* keypad 2 */ | |
| 758 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(3) /* keypad 2 */ | |
| 759 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(3) /* keypad 2 */ | |
| 760 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_PLAYER(3) /* keypad 2 */ | |
| 761 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_PLAYER(3) /* keypad 2 */ | |
| 762 | PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 958 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(3) /* keypad 6 */ | |
| 959 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(3) /* keypad 4 */ | |
| 960 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(3) /* keypad 5 */ | |
| 961 | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON9 ) PORT_PLAYER(3) /* keypad 9 */ | |
| 962 | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_PLAYER(3) /* keypad 7 */ | |
| 963 | PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_PLAYER(3) /* keypad 8 */ | |
| 964 | PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON12 ) PORT_PLAYER(3) /* keypad # */ | |
| 965 | PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON11 ) PORT_PLAYER(3) /* keypad * */ | |
| 966 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON10 ) PORT_PLAYER(3) /* keypad 0 */ | |
| 763 | 967 | |
| 764 | 968 | PORT_START_TAG("ANALOG3") |
| 765 | 969 | PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(25) PORT_KEYDELTA(20) |
| r1478 | r1479 | |
| 1077 | 1281 | static DRIVER_INIT( mk4 ) |
| 1078 | 1282 | { |
| 1079 | 1283 | dcs2_init(0, 0); |
| 1080 | midway_ioasic_init(MIDWAY_IOASIC_STANDARD, 461/* or 474 */, 9 | |
| 1284 | midway_ioasic_init(MIDWAY_IOASIC_STANDARD, 461/* or 474 */, 94, NULL); | |
| 1081 | 1285 | midway_ioasic_set_shuffle_state(1); |
| 1082 | 1286 | } |
| 1083 | 1287 | |
| r1478 | r1479 | |
| 1085 | 1289 | static DRIVER_INIT( invasn ) |
| 1086 | 1290 | { |
| 1087 | 1291 | dcs2_init(0, 0); |
| 1088 | midway_ioasic_init(MIDWAY_IOASIC_STANDARD, 468/* or 488 */, 9 | |
| 1292 | midway_ioasic_init(MIDWAY_IOASIC_STANDARD, 468/* or 488 */, 94, NULL); | |
| 1089 | 1293 | memory_install_readwrite32_handler(0, ADDRESS_SPACE_PROGRAM, 0x9c0000, 0x9c0000, 0, 0, invasn_gun_r, invasn_gun_w); |
| 1090 | 1294 | } |
| 1091 | 1295 | |
| r1478 | r1479 | |
| 1095 | 1299 | dcs2_init(0, 0); |
| 1096 | 1300 | midway_ioasic_init(MIDWAY_IOASIC_STANDARD, 472/* or 476,477,478,110 */, 99, NULL); |
| 1097 | 1301 | memory_configure_bank(1, 0, 3, memory_region(REGION_USER2), 0x400000*4); |
| 1302 | ||
| 1303 | memory_install_readwrite32_handler(0, ADDRESS_SPACE_PROGRAM, 0x9b0004, 0x9b0007, 0, 0, crusnexo_leds_r, crusnexo_leds_w); | |
| 1304 | memory_install_write32_handler (0, ADDRESS_SPACE_PROGRAM, 0x8d0009, 0x8d000a, 0, 0, keypad_select_w); | |
| 1098 | 1305 | } |
| 1099 | 1306 | |
| 1100 | 1307 | |
| r1478 | r1479 | |
| 1116 | 1323 | GAME( 1997, mk4, 0, midzeus, mk4, mk4, ROT0, "Midway", "Mortal Kombat 4 (3.0)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) |
| 1117 | 1324 | GAME( 1997, mk4a, mk4, midzeus, mk4, mk4, ROT0, "Midway", "Mortal Kombat 4 (2.1)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) |
| 1118 | 1325 | GAME( 1999, invasn, 0, midzeus, invasn, invasn, ROT0, "Midway", "Invasion (Midway)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) |
| 1119 | GAME( 1999, crusnexo, 0, midzeus2, crusnexo, crusnexo, ROT0, "Midway", "Cruis'n Exotica", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) | |
| 1326 | GAMEL( 1999, crusnexo, 0, midzeus2, crusnexo, crusnexo, ROT0, "Midway", "Cruis'n Exotica", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE, layout_crusnexo ) | |
| 1120 | 1327 | GAME( 2001, thegrid, 0, midzeus2, thegrid, thegrid, ROT0, "Midway", "The Grid (version 1.1)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) |
| r1478 | r1479 | |
|---|---|---|
| 511 | 511 | if (!lst && (readinputportbytag("TST") & 0x01)) |
| 512 | 512 | { |
| 513 | 513 | ui_snd = (ui_snd + 1) % 10; |
| 514 | | |
| 514 | | |
| 515 | 515 | } |
| 516 | 516 | lst = readinputportbytag("TST") & 0x01; |
| 517 | 517 | if (ui_snd<8) |
| r1478 | r1479 | |
| 1463 | 1463 | static const gfx_layout pestplce_spritelayout = |
| 1464 | 1464 | { |
| 1465 | 1465 | 16,16, /* 16*16 sprites */ |
| 1466 | RGN_FRAC(1, | |
| 1466 | RGN_FRAC(1,4), /* 256 sprites */ | |
| 1467 | 1467 | 2, /* 2 bits per pixel */ |
| 1468 | 1468 | { RGN_FRAC(1,2), RGN_FRAC(0,2) }, /* the two bitplanes are separated */ |
| 1469 | 1469 | { STEP8(0,1), STEP8(RGN_FRAC(1,4),1) }, /* the two halves of the sprite are separated */ |
| r1478 | r1479 | |
|---|---|---|
| 322 | 322 | |
| 323 | 323 | ***************************************************************************/ |
| 324 | 324 | |
| 325 | ROM_START( simpsons ) | |
| 325 | ROM_START( simpsons ) /* World 4 Player */ | |
| 326 | 326 | ROM_REGION( 0x8b000, REGION_CPU1, 0 ) /* code + banked roms + banked ram */ |
| 327 | ROM_LOAD( "072-g02.16c", 0x10000, 0x20000, CRC(580ce1d6) SHA1(5b07fb8e8041e1663980aa35d853fdc13b22dac5) ) | |
| 328 | ROM_LOAD( "072-g01.17c", 0x30000, 0x20000, CRC(9f843def) SHA1(858432b59101b0577c5cec6ac0c7c20ab0780c9a) ) | |
| 329 | ROM_LOAD( "072-j13.13c", 0x50000, 0x20000, CRC(aade2abd) SHA1(10f178d5ed399b4866266e075d91ca3db26798f8) ) | |
| 330 | ROM_LOAD( "072-j12.15c", 0x70000, 0x18000, CRC(479e12f2) SHA1(15a6cb12e68b4773a29ab463640a43f8e814de59) ) | |
| 331 | ROM_CONTINUE( 0x08000, 0x08000 ) | |
| 327 | ROM_LOAD( "072-g02.16c", 0x10000, 0x20000, CRC(580ce1d6) SHA1(5b07fb8e8041e1663980aa35d853fdc13b22dac5) ) | |
| 328 | ROM_LOAD( "072-g01.17c", 0x30000, 0x20000, CRC(9f843def) SHA1(858432b59101b0577c5cec6ac0c7c20ab0780c9a) ) | |
| 329 | ROM_LOAD( "072-j13.13c", 0x50000, 0x20000, CRC(aade2abd) SHA1(10f178d5ed399b4866266e075d91ca3db26798f8) ) | |
| 330 | ROM_LOAD( "072-j12.15c", 0x70000, 0x18000, CRC(479e12f2) SHA1(15a6cb12e68b4773a29ab463640a43f8e814de59) ) | |
| 331 | ROM_CONTINUE( 0x08000, 0x08000 ) | |
| 332 | 332 | |
| 333 | 333 | ROM_REGION( 0x28000, REGION_CPU2, 0 ) /* Z80 code + banks */ |
| 334 | ROM_LOAD( "072-e03.6g", 0x00000, 0x08000, CRC(866b7a35) SHA1(98905764eb4c7d968ccc17618a1f24ee12e33c0e) ) | |
| 335 | ROM_CONTINUE( 0x10000, 0x18000 ) | |
| 334 | ROM_LOAD( "072-e03.6g", 0x00000, 0x08000, CRC(866b7a35) SHA1(98905764eb4c7d968ccc17618a1f24ee12e33c0e) ) | |
| 335 | ROM_CONTINUE( 0x10000, 0x18000 ) | |
| 336 | 336 | |
| 337 | 337 | ROM_REGION( 0x100000, REGION_GFX1, 0 ) /* graphics ( dont dispose as the program can read them, 0 ) */ |
| 338 | 338 | ROM_LOAD( "072-b07.18h", 0x000000, 0x080000, CRC(ba1ec910) SHA1(0805ccb641271dea43185dc0365732260db1763d) ) /* tiles */ |
| r1478 | r1479 | |
| 349 | 349 | ROM_LOAD( "072-d04.1d", 0x100000, 0x040000, CRC(78778013) SHA1(edbd6d83b0d1a20df39bb160b92395586fa3c32d) ) |
| 350 | 350 | ROM_END |
| 351 | 351 | |
| 352 | ROM_START( simps4pa ) | |
| 352 | ROM_START( simps4pa ) /* World 4 Player, later? (by use of later leters) */ | |
| 353 | 353 | ROM_REGION( 0x8b000, REGION_CPU1, 0 ) /* code + banked roms + banked ram */ |
| 354 | ROM_LOAD( "072-g02.16c", 0x10000, 0x20000, CRC(580ce1d6) SHA1(5b07fb8e8041e1663980aa35d853fdc13b22dac5) ) | |
| 355 | ROM_LOAD( "072-g01.17c", 0x30000, 0x20000, CRC(9f843def) SHA1(858432b59101b0577c5cec6ac0c7c20ab0780c9a) ) | |
| 356 | ROM_LOAD( "simpm13.13c", 0x50000, 0x20000, CRC(f36c9423) SHA1(4a7311ffcb2e6916006c1e79dfc231e7fc570781) ) | |
| 357 | ROM_LOAD( "simpl12.15c", 0x70000, 0x18000, CRC(84f9d9ba) SHA1(d52f999b7c8125daea5e9b5754c6e82c17861d1b) ) | |
| 358 | ROM_CONTINUE( 0x08000, 0x08000 ) | |
| 354 | ROM_LOAD( "072-g02.16c", 0x10000, 0x20000, CRC(580ce1d6) SHA1(5b07fb8e8041e1663980aa35d853fdc13b22dac5) ) | |
| 355 | ROM_LOAD( "072-g01.17c", 0x30000, 0x20000, CRC(9f843def) SHA1(858432b59101b0577c5cec6ac0c7c20ab0780c9a) ) | |
| 356 | ROM_LOAD( "072-m13.13c", 0x50000, 0x20000, CRC(f36c9423) SHA1(4a7311ffcb2e6916006c1e79dfc231e7fc570781) ) | |
| 357 | ROM_LOAD( "072-l12.15c", 0x70000, 0x18000, CRC(84f9d9ba) SHA1(d52f999b7c8125daea5e9b5754c6e82c17861d1b) ) | |
| 358 | ROM_CONTINUE( 0x08000, 0x08000 ) | |
| 359 | 359 | |
| 360 | 360 | ROM_REGION( 0x28000, REGION_CPU2, 0 ) /* Z80 code + banks */ |
| 361 | ROM_LOAD( "072-e03.6g", 0x00000, 0x08000, CRC(866b7a35) SHA1(98905764eb4c7d968ccc17618a1f24ee12e33c0e) ) | |
| 362 | ROM_CONTINUE( 0x10000, 0x18000 ) | |
| 361 | ROM_LOAD( "072-e03.6g", 0x00000, 0x08000, CRC(866b7a35) SHA1(98905764eb4c7d968ccc17618a1f24ee12e33c0e) ) | |
| 362 | ROM_CONTINUE( 0x10000, 0x18000 ) | |
| 363 | 363 | |
| 364 | 364 | ROM_REGION( 0x100000, REGION_GFX1, 0 ) /* graphics ( dont dispose as the program can read them, 0 ) */ |
| 365 | 365 | ROM_LOAD( "072-b07.18h", 0x000000, 0x080000, CRC(ba1ec910) SHA1(0805ccb641271dea43185dc0365732260db1763d) ) /* tiles */ |
| r1478 | r1479 | |
| 377 | 377 | ROM_END |
| 378 | 378 | |
| 379 | 379 | |
| 380 | ROM_START( simpsn2p ) | |
| 380 | ROM_START( simpsn2p ) /* World 2 Player */ | |
| 381 | 381 | ROM_REGION( 0x8b000, REGION_CPU1, 0 ) /* code + banked roms + banked ram */ |
| 382 | ROM_LOAD( "072-g02.16c", 0x10000, 0x20000, CRC(580ce1d6) SHA1(5b07fb8e8041e1663980aa35d853fdc13b22dac5) ) | |
| 383 | ROM_LOAD( "simp_p01.17c", 0x30000, 0x20000, CRC(07ceeaea) SHA1(c18255ae1d578c2d53de80d6323cdf41cbe47b57) ) | |
| 384 | ROM_LOAD( "simp_013.13c", 0x50000, 0x20000, CRC(8781105a) SHA1(ef2f16f7a56d3715536511c674df4b3aab1be2bd) ) | |
| 385 | ROM_LOAD( "simp_012.15c", 0x70000, 0x18000, CRC(244f9289) SHA1(eeda7f5c7340cbd1a1cd576af48cd5d1a629914a) ) | |
| 386 | ROM_CONTINUE( 0x08000, 0x08000 ) | |
| 382 | ROM_LOAD( "072-g02.16c", 0x10000, 0x20000, CRC(580ce1d6) SHA1(5b07fb8e8041e1663980aa35d853fdc13b22dac5) ) | |
| 383 | ROM_LOAD( "072-p01.17c", 0x30000, 0x20000, CRC(07ceeaea) SHA1(c18255ae1d578c2d53de80d6323cdf41cbe47b57) ) | |
| 384 | ROM_LOAD( "072-013.13c", 0x50000, 0x20000, CRC(8781105a) SHA1(ef2f16f7a56d3715536511c674df4b3aab1be2bd) ) | |
| 385 | ROM_LOAD( "072-012.15c", 0x70000, 0x18000, CRC(244f9289) SHA1(eeda7f5c7340cbd1a1cd576af48cd5d1a629914a) ) | |
| 386 | ROM_CONTINUE( 0x08000, 0x08000 ) | |
| 387 | 387 | |
| 388 | 388 | ROM_REGION( 0x28000, REGION_CPU2, 0 ) /* Z80 code + banks */ |
| 389 | ROM_LOAD( "072-g03.6g", 0x00000, 0x08000, CRC(76c1850c) SHA1(9047c6b26c4e33c74eb7400a807d3d9f206f7bbe) ) | |
| 390 | ROM_CONTINUE( 0x10000, 0x18000 ) | |
| 389 | ROM_LOAD( "072-g03.6g", 0x00000, 0x08000, CRC(76c1850c) SHA1(9047c6b26c4e33c74eb7400a807d3d9f206f7bbe) ) | |
| 390 | ROM_CONTINUE( 0x10000, 0x18000 ) | |
| 391 | 391 | |
| 392 | 392 | ROM_REGION( 0x100000, REGION_GFX1, 0 ) /* graphics ( dont dispose as the program can read them, 0 ) */ |
| 393 | 393 | ROM_LOAD( "072-b07.18h", 0x000000, 0x080000, CRC(ba1ec910) SHA1(0805ccb641271dea43185dc0365732260db1763d) ) /* tiles */ |
| r1478 | r1479 | |
| 404 | 404 | ROM_LOAD( "072-d04.1d", 0x100000, 0x040000, CRC(78778013) SHA1(edbd6d83b0d1a20df39bb160b92395586fa3c32d) ) |
| 405 | 405 | ROM_END |
| 406 | 406 | |
| 407 | ROM_START( simps2pa ) | |
| 407 | ROM_START( simps2pa ) /* World 2 Player, alt */ | |
| 408 | 408 | ROM_REGION( 0x8b000, REGION_CPU1, 0 ) /* code + banked roms + banked ram */ |
| 409 | ROM_LOAD( "072-g02.16c", 0x010000, 0x020000, CRC(580ce1d6) SHA1(5b07fb8e8041e1663980aa35d853fdc13b22dac5) ) | |
| 410 | ROM_LOAD( "simp1.17c", 0x030000, 0x020000, CRC(07ceeaea) SHA1(c18255ae1d578c2d53de80d6323cdf41cbe47b57) ) | |
| 411 | ROM_LOAD( "simp4.13c", 0x050000, 0x020000, CRC(54e6df66) SHA1(1b83ae56cf1deb51b04880fa421f06568c938a99) ) | |
| 412 | ROM_LOAD( "simp3.15c", 0x070000, 0x018000, CRC(96636225) SHA1(5de95606e5c9337f18bc42f4df791cacafa20399) ) | |
| 413 | ROM_CONTINUE( 0x08000, 0x08000 ) | |
| 409 | ROM_LOAD( "072-g02.16c", 0x10000, 0x20000, CRC(580ce1d6) SHA1(5b07fb8e8041e1663980aa35d853fdc13b22dac5) ) | |
| 410 | ROM_LOAD( "072-p01.17c", 0x30000, 0x20000, CRC(07ceeaea) SHA1(c18255ae1d578c2d53de80d6323cdf41cbe47b57) ) | |
| 411 | ROM_LOAD( "072-_13.13c", 0x50000, 0x20000, CRC(54e6df66) SHA1(1b83ae56cf1deb51b04880fa421f06568c938a99) ) /* Uknown revision/region code */ | |
| 412 | ROM_LOAD( "072-_12.15c", 0x70000, 0x18000, CRC(96636225) SHA1(5de95606e5c9337f18bc42f4df791cacafa20399) ) /* Uknown revision/region code */ | |
| 413 | ROM_CONTINUE( 0x08000, 0x08000 ) | |
| 414 | 414 | |
| 415 | 415 | ROM_REGION( 0x28000, REGION_CPU2, 0 ) /* Z80 code + banks */ |
| 416 | ROM_LOAD( "072-g03.6g", 0x00000, 0x08000, CRC(76c1850c) SHA1(9047c6b26c4e33c74eb7400a807d3d9f206f7bbe) ) | |
| 417 | ROM_CONTINUE( 0x10000, 0x18000 ) | |
| 416 | ROM_LOAD( "072-g03.6g", 0x00000, 0x08000, CRC(76c1850c) SHA1(9047c6b26c4e33c74eb7400a807d3d9f206f7bbe) ) | |
| 417 | ROM_CONTINUE( 0x10000, 0x18000 ) | |
| 418 | 418 | |
| 419 | 419 | ROM_REGION( 0x100000, REGION_GFX1, 0 ) /* graphics ( dont dispose as the program can read them, 0 ) */ |
| 420 | 420 | ROM_LOAD( "072-b07.18h", 0x000000, 0x080000, CRC(ba1ec910) SHA1(0805ccb641271dea43185dc0365732260db1763d) ) /* tiles */ |
| r1478 | r1479 | |
| 431 | 431 | ROM_LOAD( "072-d04.1d", 0x100000, 0x040000, CRC(78778013) SHA1(edbd6d83b0d1a20df39bb160b92395586fa3c32d) ) |
| 432 | 432 | ROM_END |
| 433 | 433 | |
| 434 | ROM_START( simp | |
| 434 | ROM_START( simp | |
| 435 | 435 | ROM_REGION( 0x8b000, REGION_CPU1, 0 ) /* code + banked roms + banked ram */ |
| 436 | ROM_LOAD( "072-s02.16c", 0x10000, 0x20000, CRC(265f7a47) SHA1(d39c19a5e303f822313409343b209947f4c47ae4) ) | |
| 437 | ROM_LOAD( "072-t01.17c", 0x30000, 0x20000, CRC(91de5c2d) SHA1(1e18a5585ed821ec7cda69bdcdbfa4e6c71455c6) ) | |
| 438 | ROM_LOAD( "072-213.13c", 0x50000, 0x20000, CRC(b326a9ae) SHA1(f222c33f2e8b306f2f0ef6f0da9febbf8219e1a4) ) | |
| 439 | ROM_LOAD( "072-212.15c", 0x70000, 0x18000, CRC(584d9d37) SHA1(61b9df4dfb323b7284894e5e1eb9d713ebf64721) ) | |
| 440 | ROM_CONTINUE( 0x08000, 0x08000 ) | |
| 436 | ROM_LOAD( "072-g02.16c", 0x10000, 0x20000, CRC(580ce1d6) SHA1(5b07fb8e8041e1663980aa35d853fdc13b22dac5) ) /* Same as both world 2p sets */ | |
| 437 | ROM_LOAD( "072-p01.17c", 0x30000, 0x20000, CRC(07ceeaea) SHA1(c18255ae1d578c2d53de80d6323cdf41cbe47b57) ) /* Same as both world 2p sets */ | |
| 438 | ROM_LOAD( "072-113.13c", 0x50000, 0x20000, CRC(8781105a) SHA1(ef2f16f7a56d3715536511c674df4b3aab1be2bd) ) /* Same as world set simpsn2p */ | |
| 439 | ROM_LOAD( "072-112.15c", 0x70000, 0x18000, CRC(3bd69404) SHA1(e055fed7e9bde8315ae2f9b2d35bc05fece6b80b) ) | |
| 440 | ROM_CONTINUE( 0x08000, 0x08000 ) | |
| 441 | 441 | |
| 442 | 442 | ROM_REGION( 0x28000, REGION_CPU2, 0 ) /* Z80 code + banks */ |
| 443 | ROM_LOAD( "072-g03.6g", 0x00000, 0x08000, CRC(76c1850c) SHA1(9047c6b26c4e33c74eb7400a807d3d9f206f7bbe) ) | |
| 444 | ROM_CONTINUE( 0x10000, 0x18000 ) | |
| 443 | ROM_LOAD( "072-e03.6g", 0x00000, 0x08000, CRC(866b7a35) SHA1(98905764eb4c7d968ccc17618a1f24ee12e33c0e) ) | |
| 444 | ROM_CONTINUE( 0x10000, 0x18000 ) | |
| 445 | 445 | |
| 446 | 446 | ROM_REGION( 0x100000, REGION_GFX1, 0 ) /* graphics ( dont dispose as the program can read them, 0 ) */ |
| 447 | 447 | ROM_LOAD( "072-b07.18h", 0x000000, 0x080000, CRC(ba1ec910) SHA1(0805ccb641271dea43185dc0365732260db1763d) ) /* tiles */ |
| r1478 | r1479 | |
| 458 | 458 | ROM_LOAD( "072-d04.1d", 0x100000, 0x040000, CRC(78778013) SHA1(edbd6d83b0d1a20df39bb160b92395586fa3c32d) ) |
| 459 | 459 | ROM_END |
| 460 | 460 | |
| 461 | ROM_START( simps2pj ) /* Japan 2 Player */ | |
| 462 | ROM_REGION( 0x8b000, REGION_CPU1, 0 ) /* code + banked roms + banked ram */ | |
| 463 | ROM_LOAD( "072-s02.16c", 0x10000, 0x20000, CRC(265f7a47) SHA1(d39c19a5e303f822313409343b209947f4c47ae4) ) | |
| 464 | ROM_LOAD( "072-t01.17c", 0x30000, 0x20000, CRC(91de5c2d) SHA1(1e18a5585ed821ec7cda69bdcdbfa4e6c71455c6) ) | |
| 465 | ROM_LOAD( "072-213.13c", 0x50000, 0x20000, CRC(b326a9ae) SHA1(f222c33f2e8b306f2f0ef6f0da9febbf8219e1a4) ) | |
| 466 | ROM_LOAD( "072-212.15c", 0x70000, 0x18000, CRC(584d9d37) SHA1(61b9df4dfb323b7284894e5e1eb9d713ebf64721) ) | |
| 467 | ROM_CONTINUE( 0x08000, 0x08000 ) | |
| 461 | 468 | |
| 469 | ROM_REGION( 0x28000, REGION_CPU2, 0 ) /* Z80 code + banks */ | |
| 470 | ROM_LOAD( "072-g03.6g", 0x00000, 0x08000, CRC(76c1850c) SHA1(9047c6b26c4e33c74eb7400a807d3d9f206f7bbe) ) | |
| 471 | ROM_CONTINUE( 0x10000, 0x18000 ) | |
| 462 | 472 | |
| 473 | ROM_REGION( 0x100000, REGION_GFX1, 0 ) /* graphics ( dont dispose as the program can read them, 0 ) */ | |
| 474 | ROM_LOAD( "072-b07.18h", 0x000000, 0x080000, CRC(ba1ec910) SHA1(0805ccb641271dea43185dc0365732260db1763d) ) /* tiles */ | |
| 475 | ROM_LOAD( "072-b06.16h", 0x080000, 0x080000, CRC(cf2bbcab) SHA1(47afea47f9bc8cb5eb1c7b7fbafe954b3e749aeb) ) | |
| 476 | ||
| 477 | ROM_REGION( 0x400000, REGION_GFX2, 0 ) /* graphics ( dont dispose as the program can read them, 0 ) */ | |
| 478 | ROM_LOAD( "072-b08.3n", 0x000000, 0x100000, CRC(7de500ad) SHA1(61b76b8f402e3bde1509679aaaa28ef08cafb0ab) ) /* sprites */ | |
| 479 | ROM_LOAD( "072-b09.8n", 0x100000, 0x100000, CRC(aa085093) SHA1(925239d79bf607021d371263352618876f59c1f8) ) | |
| 480 | ROM_LOAD( "072-b10.12n", 0x200000, 0x100000, CRC(577dbd53) SHA1(e603e03e3dcba766074561faa92afafa5761953d) ) | |
| 481 | ROM_LOAD( "072-b11.16l", 0x300000, 0x100000, CRC(55fab05d) SHA1(54db8559d71ed257de9a29c8808654eaea0df9e2) ) | |
| 482 | ||
| 483 | ROM_REGION( 0x140000, REGION_SOUND1, 0 ) /* samples for the 053260 */ | |
| 484 | ROM_LOAD( "072-d05.1f", 0x000000, 0x100000, CRC(1397a73b) SHA1(369422c84cca5472967af54b8351e29fcd69f621) ) | |
| 485 | ROM_LOAD( "072-d04.1d", 0x100000, 0x040000, CRC(78778013) SHA1(edbd6d83b0d1a20df39bb160b92395586fa3c32d) ) | |
| 486 | ROM_END | |
| 487 | ||
| 463 | 488 | /*************************************************************************** |
| 464 | 489 | |
| 465 | 490 | Game driver(s) |
| r1478 | r1479 | |
| 472 | 497 | konami_rom_deinterleave_4(REGION_GFX2); |
| 473 | 498 | } |
| 474 | 499 | |
| 475 | GAME( 1991, simpsons, 0, simpsons, simpsons, simpsons, ROT0, "Konami", "The Simpsons (4 Players)", 0 ) | |
| 476 | GAME( 1991, simps4pa, simpsons, simpsons, simpsons, simpsons, ROT0, "Konami", "The Simpsons (4 Players alt)", 0 ) | |
| 477 | GAME( 1991, simpsn2p, simpsons, simpsons, simpsn2p, simpsons, ROT0, "Konami", "The Simpsons (2 Players)", 0 ) | |
| 478 | GAME( 1991, simps2pa, simpsons, simpsons, simpsons, simpsons, ROT0, "Konami", "The Simpsons (2 Players alt)", 0 ) | |
| 500 | // the region warning, if one exists, is shown after the high-score screen in attract mode | |
| 501 | GAME( 1991, simpsons, 0, simpsons, simpsons, simpsons, ROT0, "Konami", "The Simpsons (4 Players World, set 1)", 0 ) | |
| 502 | GAME( 1991, simps4pa, simpsons, simpsons, simpsons, simpsons, ROT0, "Konami", "The Simpsons (4 Players World, set 2)", 0 ) | |
| 503 | GAME( 1991, simpsn2p, simpsons, simpsons, simpsn2p, simpsons, ROT0, "Konami", "The Simpsons (2 Players World, set 1)", 0 ) | |
| 504 | GAME( 1991, simps2pa, simpsons, simpsons, simpsons, simpsons, ROT0, "Konami", "The Simpsons (2 Players World, set 2)", 0 ) | |
| 505 | GAME( 1991, simp2pa, simpsons, simpsons, simpsn2p, simpsons, ROT0, "Konami", "The Simpsons (2 Players Asia)", 0 ) | |
| 479 | 506 | GAME( 1991, simps2pj, simpsons, simpsons, simpsn2p, simpsons, ROT0, "Konami", "The Simpsons (2 Players Japan)", 0 ) |
| r1478 | r1479 | |
|---|---|---|
| 273 | 273 | |
| 274 | 274 | #define VERBOSE_LEVEL ( 0 ) |
| 275 | 275 | |
| 276 | INLINE void verboselog( int n_level, const char *s_fmt, ... ) | |
| 276 | INLINE void ATTR_PRINTF(2,3) verboselog( int n_level, const char *s_fmt, ... ) | |
| 277 | 277 | { |
| 278 | 278 | if( VERBOSE_LEVEL >= n_level ) |
| 279 | 279 | { |
| r1478 | r1479 | |
|---|---|---|
| 1391 | 1391 | |
| 1392 | 1392 | PORT_START /* 60 */ |
| 1393 | 1393 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN3 ) |
| 1394 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P | |
| 1394 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 Soft") PORT_PLAYER(1) | |
| 1395 | 1395 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) |
| 1396 | 1396 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) |
| 1397 | 1397 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) |
| r1478 | r1479 | |
|---|---|---|
| 33 | 33 | WRITE8_HANDLER( flstory_gfxctrl_w ); |
| 34 | 34 | READ8_HANDLER( flstory_scrlram_r ); |
| 35 | 35 | WRITE8_HANDLER( flstory_scrlram_w ); |
| 36 | READ8_HANDLER( victnine_gfxctrl_r ); | |
| 36 | 37 | WRITE8_HANDLER( victnine_gfxctrl_w ); |
| 37 | 38 | |
| 38 | 39 | READ8_HANDLER( flstory_68705_portA_r ); |
| r1478 | r1479 | |
| 54 | 55 | READ8_HANDLER( victnine_mcu_r ); |
| 55 | 56 | READ8_HANDLER( victnine_mcu_status_r ); |
| 56 | 57 | |
| 58 | UINT8 *onna34ro_workram; | |
| 59 | UINT8 *victnine_workram; | |
| 57 | 60 | |
| 58 | 61 | static UINT8 snd_data; |
| 59 | 62 | static UINT8 snd_flag; |
| r1478 | r1479 | |
| 106 | 109 | } |
| 107 | 110 | } |
| 108 | 111 | |
| 109 | ||
| 110 | static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 111 | AM_RANGE(0x0000, 0xbfff) AM_READ(MRA8_ROM) | |
| 112 | AM_RANGE(0xc000, 0xc7ff) AM_READ(MRA8_RAM) | |
| 113 | AM_RANGE(0xc800, 0xcfff) AM_READ(MRA8_RAM) /* unknown */ | |
| 114 | AM_RANGE(0xd000, 0xd000) AM_READ(flstory_mcu_r) | |
| 115 | AM_RANGE(0xd400, 0xd400) AM_READ(from_snd_r) | |
| 112 | static ADDRESS_MAP_START( flstory_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 113 | AM_RANGE(0x0000, 0xbfff) AM_ROM | |
| 114 | AM_RANGE(0xc000, 0xc7ff) AM_RAM AM_WRITE(flstory_videoram_w) AM_BASE(&videoram) AM_SIZE(&videoram_size) | |
| 115 | AM_RANGE(0xc800, 0xcfff) AM_RAM /* unknown */ | |
| 116 | AM_RANGE(0xd000, 0xd000) AM_READWRITE(flstory_mcu_r, flstory_mcu_w) | |
| 117 | AM_RANGE(0xd001, 0xd001) AM_WRITENOP /* watchdog? */ | |
| 118 | AM_RANGE(0xd002, 0xd002) AM_WRITENOP /* coin lock out? */ | |
| 119 | AM_RANGE(0xd400, 0xd400) AM_READWRITE(from_snd_r, sound_command_w) | |
| 116 | 120 | AM_RANGE(0xd401, 0xd401) AM_READ(snd_flag_r) |
| 117 | AM_RANGE(0xd403, 0xd403) AM_ | |
| 121 | AM_RANGE(0xd403, 0xd403) AM_ | |
| 118 | 122 | AM_RANGE(0xd800, 0xd800) AM_READ(input_port_0_r) |
| 119 | 123 | AM_RANGE(0xd801, 0xd801) AM_READ(input_port_1_r) |
| 120 | 124 | AM_RANGE(0xd802, 0xd802) AM_READ(input_port_2_r) |
| r1478 | r1479 | |
| 122 | 126 | AM_RANGE(0xd804, 0xd804) AM_READ(input_port_4_r) |
| 123 | 127 | AM_RANGE(0xd805, 0xd805) AM_READ(flstory_mcu_status_r) |
| 124 | 128 | AM_RANGE(0xd806, 0xd806) AM_READ(input_port_5_r) |
| 125 | AM_RANGE(0xdc00, 0xdcff) AM_READ(MRA8_RAM) /* spriteram / scrollram */ | |
| 126 | AM_RANGE(0xdd00, 0xdeff) AM_READ(flstory_palette_r) | |
| 127 | AM_RANGE(0xe000, 0xe7ff) AM_READ(MRA8_RAM) | |
| 128 | ADDRESS_MAP_END | |
| 129 | ||
| 130 | static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 131 | AM_RANGE(0x0000, 0xbfff) AM_WRITE(MWA8_ROM) | |
| 132 | AM_RANGE(0xc000, 0xc7ff) AM_WRITE(flstory_videoram_w) AM_BASE(&videoram) AM_SIZE(&videoram_size) | |
| 133 | AM_RANGE(0xc800, 0xcfff) AM_WRITE(MWA8_RAM) | |
| 134 | AM_RANGE(0xd000, 0xd000) AM_WRITE(flstory_mcu_w) | |
| 135 | AM_RANGE(0xd001, 0xd001) AM_WRITE(MWA8_NOP) /* watchdog? */ | |
| 136 | AM_RANGE(0xd002, 0xd002) AM_WRITE(MWA8_NOP) /* coin lock out? */ | |
| 137 | AM_RANGE(0xd400, 0xd400) AM_WRITE(sound_command_w) | |
| 138 | AM_RANGE(0xd403, 0xd403) AM_WRITE(MWA8_NOP) /* unknown */ | |
| 139 | 129 | // AM_RANGE(0xda00, 0xda00) AM_WRITE(MWA8_RAM) |
| 140 | AM_RANGE(0xdc00, 0xdc9f) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size) | |
| 141 | AM_RANGE(0xdca0, 0xdcbf) AM_WRITE(flstory_scrlram_w) AM_BASE(&flstory_scrlram) | |
| 142 | AM_RANGE(0xdcc0, 0xdcff) AM_WRITE(MWA8_RAM) /* unknown */ | |
| 143 | AM_RANGE(0xdd00, 0xdeff) AM_WRITE(flstory_palette_w) | |
| 130 | AM_RANGE(0xdc00, 0xdc9f) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size) | |
| 131 | AM_RANGE(0xdca0, 0xdcbf) AM_RAM AM_WRITE(flstory_scrlram_w) AM_BASE(&flstory_scrlram) | |
| 132 | AM_RANGE(0xdcc0, 0xdcff) AM_RAM /* unknown */ | |
| 133 | AM_RANGE(0xdd00, 0xdeff) AM_READWRITE(flstory_palette_r, flstory_palette_w) | |
| 144 | 134 | AM_RANGE(0xdf03, 0xdf03) AM_WRITE(flstory_gfxctrl_w) |
| 145 | AM_RANGE(0xe000, 0xe7ff) AM_ | |
| 135 | AM_RANGE(0xe000, 0xe7ff) AM_ | |
| 146 | 136 | ADDRESS_MAP_END |
| 147 | 137 | |
| 148 | static ADDRESS_MAP_START( onna34ro_readmem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 149 | AM_RANGE(0x0000, 0xbfff) AM_READ(MRA8_ROM) | |
| 150 | AM_RANGE(0xc000, 0xc7ff) AM_READ(MRA8_RAM) | |
| 151 | AM_RANGE(0xc800, 0xcfff) AM_READ(MRA8_RAM) /* unknown */ | |
| 152 | AM_RANGE(0xd000, 0xd000) AM_READ(onna34ro_mcu_r) | |
| 153 | AM_RANGE(0xd400, 0xd400) AM_READ(from_snd_r) | |
| 138 | static ADDRESS_MAP_START( onna34ro_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 139 | AM_RANGE(0x0000, 0xbfff) AM_ROM | |
| 140 | AM_RANGE(0xc000, 0xc7ff) AM_RAM AM_WRITE(flstory_videoram_w) AM_BASE(&videoram) AM_SIZE(&videoram_size) | |
| 141 | AM_RANGE(0xc800, 0xcfff) AM_RAM /* unknown */ | |
| 142 | AM_RANGE(0xd000, 0xd000) AM_READWRITE(onna34ro_mcu_r, onna34ro_mcu_w) | |
| 143 | AM_RANGE(0xd001, 0xd001) AM_WRITENOP /* watchdog? */ | |
| 144 | AM_RANGE(0xd002, 0xd002) AM_WRITENOP /* coin lock out? */ | |
| 145 | AM_RANGE(0xd400, 0xd400) AM_READWRITE(from_snd_r, sound_command_w) | |
| 154 | 146 | AM_RANGE(0xd401, 0xd401) AM_READ(snd_flag_r) |
| 155 | AM_RANGE(0xd403, 0xd403) AM_ | |
| 147 | AM_RANGE(0xd403, 0xd403) AM_ | |
| 156 | 148 | AM_RANGE(0xd800, 0xd800) AM_READ(input_port_0_r) |
| 157 | 149 | AM_RANGE(0xd801, 0xd801) AM_READ(input_port_1_r) |
| 158 | 150 | AM_RANGE(0xd802, 0xd802) AM_READ(input_port_2_r) |
| r1478 | r1479 | |
| 160 | 152 | AM_RANGE(0xd804, 0xd804) AM_READ(input_port_4_r) |
| 161 | 153 | AM_RANGE(0xd805, 0xd805) AM_READ(onna34ro_mcu_status_r) |
| 162 | 154 | AM_RANGE(0xd806, 0xd806) AM_READ(input_port_5_r) |
| 163 | AM_RANGE(0xdc00, 0xdcff) AM_READ(MRA8_RAM) /* spriteram / scrollram */ | |
| 164 | AM_RANGE(0xdd00, 0xdeff) AM_READ(flstory_palette_r) | |
| 165 | AM_RANGE(0xe000, 0xe7ff) AM_READ(MRA8_RAM) | |
| 166 | ADDRESS_MAP_END | |
| 167 | ||
| 168 | static ADDRESS_MAP_START( onna34ro_writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 169 | AM_RANGE(0x0000, 0xbfff) AM_WRITE(MWA8_ROM) | |
| 170 | AM_RANGE(0xc000, 0xc7ff) AM_WRITE(flstory_videoram_w) AM_BASE(&videoram) AM_SIZE(&videoram_size) | |
| 171 | AM_RANGE(0xc800, 0xcfff) AM_WRITE(MWA8_RAM) | |
| 172 | AM_RANGE(0xd000, 0xd000) AM_WRITE(onna34ro_mcu_w) | |
| 173 | AM_RANGE(0xd001, 0xd001) AM_WRITE(MWA8_NOP) /* watchdog? */ | |
| 174 | AM_RANGE(0xd002, 0xd002) AM_WRITE(MWA8_NOP) /* coin lock out? */ | |
| 175 | AM_RANGE(0xd400, 0xd400) AM_WRITE(sound_command_w) | |
| 176 | AM_RANGE(0xd403, 0xd403) AM_WRITE(MWA8_NOP) /* unknown */ | |
| 177 | 155 | // AM_RANGE(0xda00, 0xda00) AM_WRITE(MWA8_RAM) |
| 178 | AM_RANGE(0xdc00, 0xdc9f) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size) | |
| 179 | AM_RANGE(0xdca0, 0xdcbf) AM_WRITE(flstory_scrlram_w) AM_BASE(&flstory_scrlram) | |
| 180 | AM_RANGE(0xdcc0, 0xdcff) AM_WRITE(MWA8_RAM) /* unknown */ | |
| 181 | AM_RANGE(0xdd00, 0xdeff) AM_WRITE(flstory_palette_w) | |
| 156 | AM_RANGE(0xdc00, 0xdc9f) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size) | |
| 157 | AM_RANGE(0xdca0, 0xdcbf) AM_RAM AM_WRITE(flstory_scrlram_w) AM_BASE(&flstory_scrlram) | |
| 158 | AM_RANGE(0xdcc0, 0xdcff) AM_RAM /* unknown */ | |
| 159 | AM_RANGE(0xdd00, 0xdeff) AM_READWRITE(flstory_palette_r, flstory_palette_w) | |
| 182 | 160 | AM_RANGE(0xdf03, 0xdf03) AM_WRITE(flstory_gfxctrl_w) |
| 183 | AM_RANGE(0xe000, 0xe7ff) AM_ | |
| 161 | AM_RANGE(0xe000, 0xe7ff) AM_ | |
| 184 | 162 | ADDRESS_MAP_END |
| 185 | 163 | |
| 186 | 164 | static READ8_HANDLER( victnine_port_5_r ) |
| r1478 | r1479 | |
| 188 | 166 | return (victnine_mcu_status_r(0) & 3) | (readinputport(5) & ~3); |
| 189 | 167 | } |
| 190 | 168 | |
| 191 | static ADDRESS_MAP_START( victnine_readmem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 192 | AM_RANGE(0x0000, 0xbfff) AM_READ(MRA8_ROM) | |
| 193 | AM_RANGE(0xc000, 0xc7ff) AM_READ(MRA8_RAM) | |
| 194 | AM_RANGE(0xc800, 0xcfff) AM_READ(MRA8_RAM) /* unknown */ | |
| 195 | AM_RANGE(0xd000, 0xd000) AM_READ(victnine_mcu_r) | |
| 196 | AM_RANGE(0xd002, 0xd002) AM_READ(MRA8_NOP) /* unknown */ | |
| 197 | AM_RANGE(0xd400, 0xd400) AM_READ(from_snd_r) | |
| 169 | static ADDRESS_MAP_START( victnine_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 170 | AM_RANGE(0x0000, 0xbfff) AM_ROM | |
| 171 | AM_RANGE(0xc000, 0xc7ff) AM_RAM AM_WRITE(flstory_videoram_w) AM_BASE(&videoram) AM_SIZE(&videoram_size) | |
| 172 | AM_RANGE(0xc800, 0xcfff) AM_RAM /* unknown */ | |
| 173 | AM_RANGE(0xd000, 0xd000) AM_READWRITE(victnine_mcu_r, victnine_mcu_w) | |
| 174 | AM_RANGE(0xd001, 0xd001) AM_WRITENOP /* watchdog? */ | |
| 175 | AM_RANGE(0xd002, 0xd002) AM_READWRITE(MRA8_NOP, MWA8_NOP) /* unknown read & coin lock out? */ | |
| 176 | AM_RANGE(0xd400, 0xd400) AM_READWRITE(from_snd_r, sound_command_w) | |
| 198 | 177 | AM_RANGE(0xd401, 0xd401) AM_READ(snd_flag_r) |
| 199 | AM_RANGE(0xd403, 0xd403) AM_READ | |
| 178 | AM_RANGE(0xd403, 0xd403) AM_READ | |
| 200 | 179 | AM_RANGE(0xd800, 0xd800) AM_READ(input_port_0_r) |
| 201 | 180 | AM_RANGE(0xd801, 0xd801) AM_READ(input_port_1_r) |
| 202 | 181 | AM_RANGE(0xd802, 0xd802) AM_READ(input_port_2_r) |
| r1478 | r1479 | |
| 205 | 184 | AM_RANGE(0xd805, 0xd805) AM_READ(victnine_port_5_r) |
| 206 | 185 | AM_RANGE(0xd806, 0xd806) AM_READ(input_port_6_r) |
| 207 | 186 | AM_RANGE(0xd807, 0xd807) AM_READ(input_port_7_r) |
| 208 | AM_RANGE(0xdc00, 0xdcff) AM_READ(MRA8_RAM) /* spriteram / scrollram */ | |
| 209 | AM_RANGE(0xdd00, 0xdeff) AM_READ(flstory_palette_r) | |
| 210 | AM_RANGE(0xe000, 0xe7ff) AM_READ(MRA8_RAM) | |
| 211 | ADDRESS_MAP_END | |
| 212 | ||
| 213 | static ADDRESS_MAP_START( victnine_writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 214 | AM_RANGE(0x0000, 0xbfff) AM_WRITE(MWA8_ROM) | |
| 215 | AM_RANGE(0xc000, 0xc7ff) AM_WRITE(flstory_videoram_w) AM_BASE(&videoram) AM_SIZE(&videoram_size) | |
| 216 | AM_RANGE(0xc800, 0xcfff) AM_WRITE(MWA8_RAM) | |
| 217 | AM_RANGE(0xd000, 0xd000) AM_WRITE(victnine_mcu_w) | |
| 218 | AM_RANGE(0xd001, 0xd001) AM_WRITE(MWA8_NOP) /* watchdog? */ | |
| 219 | AM_RANGE(0xd002, 0xd002) AM_WRITE(MWA8_NOP) /* coin lock out? */ | |
| 220 | AM_RANGE(0xd400, 0xd400) AM_WRITE(sound_command_w) | |
| 221 | 187 | // AM_RANGE(0xda00, 0xda00) AM_WRITE(MWA8_RAM) |
| 222 | AM_RANGE(0xdc00, 0xdc9f) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size) | |
| 223 | AM_RANGE(0xdca0, 0xdcbf) AM_WRITE(flstory_scrlram_w) AM_BASE(&flstory_scrlram) | |
| 224 | AM_RANGE(0xdce0, 0xdce0) AM_WRITE(victnine_gfxctrl_w) | |
| 225 | AM_RANGE(0xdce1, 0xdce1) AM_WRITE(MWA8_NOP) /* unknown */ | |
| 226 | AM_RANGE(0xdd00, 0xdeff) AM_WRITE(flstory_palette_w) | |
| 227 | AM_RANGE(0xe000, 0xe7ff) AM_WRITE(MWA8_RAM) /* work RAM */ | |
| 188 | AM_RANGE(0xdc00, 0xdc9f) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size) | |
| 189 | AM_RANGE(0xdca0, 0xdcbf) AM_RAM AM_WRITE(flstory_scrlram_w) AM_BASE(&flstory_scrlram) | |
| 190 | AM_RANGE(0xdce0, 0xdce0) AM_READWRITE(victnine_gfxctrl_r, victnine_gfxctrl_w) | |
| 191 | AM_RANGE(0xdce1, 0xdce1) AM_WRITENOP /* unknown */ | |
| 192 | AM_RANGE(0xdd00, 0xdeff) AM_READWRITE(flstory_palette_r, flstory_palette_w) | |
| 193 | AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_BASE(&victnine_workram) /* work RAM */ | |
| 228 | 194 | ADDRESS_MAP_END |
| 229 | 195 | |
| 230 | static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 231 | AM_RANGE(0x0000, 0xbfff) AM_READ(MRA8_ROM) | |
| 232 | AM_RANGE(0xc000, 0xc7ff) AM_READ(MRA8_RAM) | |
| 233 | AM_RANGE(0xd800, 0xd800) AM_READ(soundlatch_r) | |
| 234 | AM_RANGE(0xda00, 0xda00) AM_READ(MRA8_NOP) /* unknown */ | |
| 235 | AM_RANGE(0xde00, 0xde00) AM_READ(MRA8_NOP) /* unknown */ | |
| 236 | AM_RANGE(0xe000, 0xefff) AM_READ(MRA8_ROM) /* space for diagnostics ROM */ | |
| 237 | ADDRESS_MAP_END | |
| 238 | ||
| 239 | 196 | static int vol_ctrl[16]; |
| 240 | 197 | |
| 241 | 198 | static MACHINE_RESET( ta7630 ) |
| r1478 | r1479 | |
| 301 | 258 | } |
| 302 | 259 | |
| 303 | 260 | |
| 304 | static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 305 | AM_RANGE(0x0000, 0xbfff) AM_WRITE(MWA8_ROM) | |
| 306 | AM_RANGE(0xc000, 0xc7ff) AM_WRITE(MWA8_RAM) | |
| 261 | static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 262 | AM_RANGE(0x0000, 0xbfff) AM_ROM | |
| 263 | AM_RANGE(0xc000, 0xc7ff) AM_RAM | |
| 307 | 264 | AM_RANGE(0xc800, 0xc800) AM_WRITE(AY8910_control_port_0_w) |
| 308 | 265 | AM_RANGE(0xc801, 0xc801) AM_WRITE(AY8910_write_port_0_w) |
| 309 | 266 | AM_RANGE(0xca00, 0xca0d) AM_WRITE(MSM5232_0_w) |
| 310 | 267 | AM_RANGE(0xcc00, 0xcc00) AM_WRITE(sound_control_0_w) |
| 311 | 268 | AM_RANGE(0xce00, 0xce00) AM_WRITE(sound_control_1_w) |
| 312 | AM_RANGE(0xd800, 0xd800) AM_WRITE(to_main_w) | |
| 313 | AM_RANGE(0xda00, 0xda00) AM_WRITE(nmi_enable_w) | |
| 269 | AM_RANGE(0xd800, 0xd800) AM_READWRITE(soundlatch_r, to_main_w) | |
| 270 | AM_RANGE(0xda00, 0xda00) AM_READWRITE(MRA8_NOP, nmi_enable_w) /* unknown read*/ | |
| 314 | 271 | AM_RANGE(0xdc00, 0xdc00) AM_WRITE(nmi_disable_w) |
| 315 | AM_RANGE(0xde00, 0xde00) AM_WRITE(DAC_0_signed_data_w) /* signed 8-bit DAC */ | |
| 316 | AM_RANGE(0xe000, 0xefff) AM_WRITE(MWA8_ROM) | |
| 272 | AM_RANGE(0xde00, 0xde00) AM_READWRITE(MRA8_NOP, DAC_0_signed_data_w) /* signed 8-bit DAC & unknown read */ | |
| 273 | AM_RANGE(0xe000, 0xefff) AM_ROM /* space for diagnostics ROM */ | |
| 317 | 274 | ADDRESS_MAP_END |
| 318 | 275 | |
| 319 | static ADDRESS_MAP_START( m68705_ | |
| 276 | static ADDRESS_MAP_START( flstory_m68705_ | |
| 320 | 277 | ADDRESS_MAP_FLAGS( AMEF_ABITS(11) ) |
| 321 | AM_RANGE(0x0000, 0x0000) AM_READ(flstory_68705_portA_r) | |
| 322 | AM_RANGE(0x0001, 0x0001) AM_READ(flstory_68705_portB_r) | |
| 323 | AM_RANGE(0x0002, 0x0002) AM_READ(flstory_68705_portC_r) | |
| 324 | AM_RANGE(0x0010, 0x007f) AM_READ(MRA8_RAM) | |
| 325 | AM_RANGE(0x0080, 0x07ff) AM_READ(MRA8_ROM) | |
| 326 | ADDRESS_MAP_END | |
| 327 | ||
| 328 | static ADDRESS_MAP_START( m68705_writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 329 | ADDRESS_MAP_FLAGS( AMEF_ABITS(11) ) | |
| 330 | AM_RANGE(0x0000, 0x0000) AM_WRITE(flstory_68705_portA_w) | |
| 331 | AM_RANGE(0x0001, 0x0001) AM_WRITE(flstory_68705_portB_w) | |
| 332 | AM_RANGE(0x0002, 0x0002) AM_WRITE(flstory_68705_portC_w) | |
| 278 | AM_RANGE(0x0000, 0x0000) AM_READWRITE(flstory_68705_portA_r, flstory_68705_portA_w) | |
| 279 | AM_RANGE(0x0001, 0x0001) AM_READWRITE(flstory_68705_portB_r, flstory_68705_portB_w) | |
| 280 | AM_RANGE(0x0002, 0x0002) AM_READWRITE(flstory_68705_portC_r, flstory_68705_portC_w) | |
| 333 | 281 | AM_RANGE(0x0004, 0x0004) AM_WRITE(flstory_68705_ddrA_w) |
| 334 | 282 | AM_RANGE(0x0005, 0x0005) AM_WRITE(flstory_68705_ddrB_w) |
| 335 | 283 | AM_RANGE(0x0006, 0x0006) AM_WRITE(flstory_68705_ddrC_w) |
| 336 | AM_RANGE(0x0010, 0x007f) AM_WRITE(MWA8_RAM) | |
| 337 | AM_RANGE(0x0080, 0x07ff) AM_WRITE(MWA8_ROM) | |
| 284 | AM_RANGE(0x0010, 0x007f) AM_RAM | |
| 285 | AM_RANGE(0x0080, 0x07ff) AM_ROM | |
| 338 | 286 | ADDRESS_MAP_END |
| 339 | 287 | |
| 340 | 288 | |
| r1478 | r1479 | |
| 734 | 682 | |
| 735 | 683 | /* basic machine hardware */ |
| 736 | 684 | MDRV_CPU_ADD(Z80,10733000/2) /* ??? */ |
| 737 | MDRV_CPU_PROGRAM_MAP(r | |
| 685 | MDRV_CPU_PROGRAM_MAP(flstory_ | |
| 738 | 686 | MDRV_CPU_VBLANK_INT(irq0_line_hold,1) |
| 739 | 687 | |
| 740 | 688 | MDRV_CPU_ADD(Z80,8000000/2) |
| 741 | 689 | /* audio CPU */ /* 4 MHz */ |
| 742 | MDRV_CPU_PROGRAM_MAP(sound_ | |
| 690 | MDRV_CPU_PROGRAM_MAP(sound_ | |
| 743 | 691 | MDRV_CPU_VBLANK_INT(irq0_line_hold,2) /* IRQ generated by ??? */ |
| 744 | 692 | /* NMI generated by the main CPU */ |
| 745 | 693 | |
| 746 | 694 | MDRV_CPU_ADD(M68705,4000000/M68705_CLOCK_DIVIDER) /* ??? */ |
| 747 | MDRV_CPU_PROGRAM_MAP(m68705_ | |
| 695 | MDRV_CPU_PROGRAM_MAP(flstory_m68705_ | |
| 748 | 696 | |
| 749 | 697 | MDRV_SCREEN_REFRESH_RATE(60) |
| 750 | 698 | MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION) |
| r1478 | r1479 | |
| 782 | 730 | |
| 783 | 731 | /* basic machine hardware */ |
| 784 | 732 | MDRV_CPU_ADD(Z80,10733000/2) /* ??? */ |
| 785 | MDRV_CPU_PROGRAM_MAP(onna34ro_ | |
| 733 | MDRV_CPU_PROGRAM_MAP(onna34ro_ | |
| 786 | 734 | MDRV_CPU_VBLANK_INT(irq0_line_hold,1) |
| 787 | 735 | |
| 788 | 736 | MDRV_CPU_ADD(Z80,8000000/2) |
| 789 | 737 | /* audio CPU */ /* 4 MHz */ |
| 790 | MDRV_CPU_PROGRAM_MAP(sound_ | |
| 738 | MDRV_CPU_PROGRAM_MAP(sound_ | |
| 791 | 739 | MDRV_CPU_VBLANK_INT(irq0_line_hold,2) /* IRQ generated by ??? */ |
| 792 | 740 | /* NMI generated by the main CPU */ |
| 793 | 741 | // MDRV_CPU_ADD(M68705,4000000/M68705_CLOCK_DIVIDER) /* ??? */ |
| r1478 | r1479 | |
| 829 | 777 | |
| 830 | 778 | /* basic machine hardware */ |
| 831 | 779 | MDRV_CPU_ADD(Z80,8000000/2) /* 4 MHz */ |
| 832 | MDRV_CPU_PROGRAM_MAP(victnine_ | |
| 780 | MDRV_CPU_PROGRAM_MAP(victnine_ | |
| 833 | 781 | MDRV_CPU_VBLANK_INT(irq0_line_hold,1) |
| 834 | 782 | |
| 835 | 783 | MDRV_CPU_ADD(Z80,8000000/2) |
| 836 | 784 | /* audio CPU */ /* 4 MHz */ |
| 837 | MDRV_CPU_PROGRAM_MAP(sound_ | |
| 785 | MDRV_CPU_PROGRAM_MAP(sound_ | |
| 838 | 786 | MDRV_CPU_VBLANK_INT(irq0_line_hold,2) /* IRQ generated by ??? */ |
| 839 | 787 | /* NMI generated by the main CPU */ |
| 840 | 788 | // MDRV_CPU_ADD(M68705,4000000/M68705_CLOCK_DIVIDER) /* ??? */ |
| r1478 | r1479 | |
|---|---|---|
| 931 | 931 | |
| 932 | 932 | #define VERBOSE_LEVEL ( 0 ) |
| 933 | 933 | |
| 934 | INLINE void verboselog( int n_level, const char *s_fmt, ... ) | |
| 934 | INLINE void ATTR_PRINTF(2,3) verboselog( int n_level, const char *s_fmt, ... ) | |
| 935 | 935 | { |
| 936 | 936 | if( VERBOSE_LEVEL >= n_level ) |
| 937 | 937 | { |
| r1478 | r1479 | |
|---|---|---|
| 467 | 467 | |
| 468 | 468 | /******************************************************************************/ |
| 469 | 469 | |
| 470 | GAME( 1992, funkyjet, 0, funkyjet, funkyjet, funkyjet, ROT0, "[Data East] (Mitchell license)", "Funky Jet (World)", 0 ) | |
| 471 | GAME( 1992, funkyjej, funkyjet, funkyjet, funkyjej, funkyjet, ROT0, "Data East Corporation", "Funky Jet (Japan)", 0 ) | |
| 472 | GAME( 1995, sotsugyo, 0, funkyjet, sotsugyo, funkyjet, ROT0, "Mitchell (Atlus license)", "Sotsugyo Shousho", 0 ) | |
| 470 | GAME( 1992, funkyjet, 0, funkyjet, funkyjet, funkyjet, ROT0, "[Data East] (Mitchell license)", "Funky Jet (World)", GAME_SUPPORTS_SAVE ) | |
| 471 | GAME( 1992, funkyjej, funkyjet, funkyjet, funkyjej, funkyjet, ROT0, "Data East Corporation", "Funky Jet (Japan)", GAME_SUPPORTS_SAVE ) | |
| 472 | GAME( 1995, sotsugyo, 0, funkyjet, sotsugyo, funkyjet, ROT0, "Mitchell (Atlus license)", "Sotsugyo Shousho", GAME_SUPPORTS_SAVE ) |
| r1478 | r1479 | |
|---|---|---|
| 35 | 35 | * |
| 36 | 36 | *************************************/ |
| 37 | 37 | |
| 38 | static MACHINE_START( btoads ) | |
| 39 | { | |
| 40 | state_save_register_global(main_to_sound_data); | |
| 41 | state_save_register_global(main_to_sound_ready); | |
| 42 | state_save_register_global(sound_to_main_data); | |
| 43 | state_save_register_global(sound_to_main_ready); | |
| 44 | state_save_register_global(sound_int_state); | |
| 45 | } | |
| 46 | ||
| 47 | ||
| 38 | 48 | static MACHINE_RESET( btoads ) |
| 39 | 49 | { |
| 40 | 50 | tlc34076_reset(6); |
| r1478 | r1479 | |
| 333 | 343 | MDRV_CPU_IO_MAP(sound_io_map,0) |
| 334 | 344 | MDRV_CPU_PERIODIC_INT(irq0_line_assert, 183) |
| 335 | 345 | |
| 346 | MDRV_MACHINE_START(btoads) | |
| 336 | 347 | MDRV_MACHINE_RESET(btoads) |
| 337 | 348 | MDRV_NVRAM_HANDLER(generic_1fill) |
| 338 | 349 | |
| r1478 | r1479 | |
| 384 | 395 | * |
| 385 | 396 | *************************************/ |
| 386 | 397 | |
| 387 | GAME( 1994, btoads, 0, btoads, btoads, 0, ROT0, "Rare", "Battle Toads", | |
| 398 | GAME( 1994, btoads, 0, btoads, btoads, 0, ROT0, "Rare", "Battle Toads", GAME_SUPPORTS_SAVE ) |
| r1478 | r1479 | |
|---|---|---|
| 7303 | 7303 | Orbs |
| 7304 | 7304 | ***************************************************************************/ |
| 7305 | 7305 | |
| 7306 | /* The CPU clock has been verified/measured, PCB only has one OSC and it's 14.318180 MHz */ | |
| 7307 | ||
| 7306 | 7308 | static MACHINE_DRIVER_START( orbs ) |
| 7307 | 7309 | |
| 7308 | 7310 | /* basic machine hardware */ |
| 7309 | MDRV_CPU_ADD(M68000, 1 | |
| 7311 | MDRV_CPU_ADD(M68000, 14318180/2 | |
| 7310 | 7312 | MDRV_CPU_PROGRAM_MAP(orbs_readmem,orbs_writemem) |
| 7311 | 7313 | MDRV_CPU_VBLANK_INT(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM) |
| 7312 | 7314 | |
| r1478 | r1479 | |
| 7327 | 7329 | /* sound hardware */ |
| 7328 | 7330 | MDRV_SPEAKER_STANDARD_STEREO("left", "right") |
| 7329 | 7331 | |
| 7330 | MDRV_SOUND_ADD(X1_010, 1 | |
| 7332 | MDRV_SOUND_ADD(X1_010, 14318180 | |
| 7331 | 7333 | MDRV_SOUND_CONFIG(seta_sound_intf) |
| 7332 | 7334 | MDRV_SOUND_ROUTE(0, "left", 1.0) |
| 7333 | 7335 | MDRV_SOUND_ROUTE(1, "right", 1.0) |
| r1478 | r1479 | |
|---|---|---|
| 345 | 345 | #include "sound/namco.h" |
| 346 | 346 | #include "sound/dac.h" |
| 347 | 347 | |
| 348 | static int dac0_value, dac1_value, dac0_gain, dac1_gain; | |
| 349 | ||
| 350 | ||
| 348 | 351 | /* from video */ |
| 349 | 352 | VIDEO_START( namcos1 ); |
| 350 | 353 | VIDEO_UPDATE( namcos1 ); |
| r1478 | r1479 | |
| 420 | 423 | coin_counter_w(1,data & 4); |
| 421 | 424 | } |
| 422 | 425 | |
| 423 | static int dac0_value ,dac1_value, dac0_gain=0x80, dac1_gain=0x80; | |
| 424 | ||
| 425 | 426 | static void namcos1_update_DACs(void) |
| 426 | 427 | { |
| 427 | 428 | DAC_signed_data_16_w(0,0x8000 + (dac0_value * dac0_gain) + (dac1_value * dac1_gain)); |
| 428 | 429 | } |
| 429 | 430 | |
| 431 | void namcos1_init_DACs(void) | |
| 432 | { | |
| 433 | dac0_value = 0; | |
| 434 | dac1_value = 0; | |
| 435 | dac0_gain=0x80; | |
| 436 | dac1_gain=0x80; | |
| 437 | } | |
| 438 | ||
| 430 | 439 | static WRITE8_HANDLER( namcos1_dac_gain_w ) |
| 431 | 440 | { |
| 432 | 441 | int value; |
| r1478 | r1479 | |
|---|---|---|
| 8 | 8 | Coin inputs are handled by the sound CPU, so they don't work with sound |
| 9 | 9 | disabled. Use the service switch instead. |
| 10 | 10 | |
| 11 | -- | |
| 12 | Mametesters bug tokiu056gre - "tokiu: "0000000" is always displayed as the top hiscore during gameplay, | |
| 13 | regardless of what it actually is. This does not happen in the other Toki sets." | |
| 11 | 14 | |
| 15 | Notes by bmcphail@vcmame.net, 1/1/2008 | |
| 16 | ||
| 17 | Toki stores high score at $60008 in main ram (init code at $ADA, compared with player score at $1A1BA) | |
| 18 | Tokiu stores high score at $60010 instead (init code at $B16, equivalent compare code at $1a204), $60008 | |
| 19 | is used for different purposes in many parts of the code. | |
| 20 | ||
| 21 | Both games feature a common routine ($1cba2 in toki, $1cbfa in tokiu) that prints the high score to screen, | |
| 22 | the problem is that the version in Tokiu has not been adjusted for the different high score location and | |
| 23 | it reads from the $68008 location instead of $680010. From analysing the code I'm certain this is a bug | |
| 24 | in the original USA version code and not an emulation bug. | |
| 25 | ||
| 26 | ||
| 27 | ||
| 12 | 28 | TODO |
| 13 | 29 | ---- |
| 14 | 30 |
| r1478 | r1479 | |
|---|---|---|
| 31 | 31 | |
| 32 | 32 | Emulation by Bryan McPhail, mish@tendril.co.uk |
| 33 | 33 | |
| 34 | Note about verision levels using Mutant Fighter as the example: | |
| 35 | Version 1 HD-00 | |
| 36 | Version 2 HD-00-1 | |
| 37 | Version 3 HD-00-2 | |
| 38 | Version 4 HD-00-3 | |
| 39 | ect... | |
| 40 | ||
| 34 | 41 | ***************************************************************************/ |
| 35 | 42 | |
| 36 | 43 | #include "driver.h" |
| r1478 | r1479 | |
| 125 | 132 | logerror("%08x: Unmapped IRQ write %d %04x\n",activecpu_get_pc(),offset,data); |
| 126 | 133 | } |
| 127 | 134 | |
| 135 | static READ16_HANDLER( robo2_dip3_r ) { return readinputport(3); } | |
| 136 | ||
| 128 | 137 | static READ16_HANDLER( robocop2_prot_r ) |
| 129 | 138 | { |
| 130 | 139 | switch (offset<<1) { |
| r1478 | r1479 | |
| 244 | 253 | AM_RANGE(0x156000, 0x156fff) AM_READ(MRA16_RAM) |
| 245 | 254 | AM_RANGE(0x15c000, 0x15c7ff) AM_READ(MRA16_RAM) |
| 246 | 255 | AM_RANGE(0x15e000, 0x15e7ff) AM_READ(MRA16_RAM) |
| 256 | AM_RANGE(0x1f8000, 0x1f8001) AM_READ(robo2_dip3_r) /* Dipswitch #3 */ | |
| 247 | 257 | ADDRESS_MAP_END |
| 248 | 258 | |
| 249 | 259 | static ADDRESS_MAP_START( robocop2_writemem, ADDRESS_SPACE_PROGRAM, 16 ) |
| r1478 | r1479 | |
| 375 | 385 | AM_RANGE(0x9800, 0x9800) AM_WRITE(OKIM6295_data_0_w) |
| 376 | 386 | ADDRESS_MAP_END |
| 377 | 387 | |
| 388 | /*********************************************************** | |
| 389 | Basic INPUT PORTS, DIPs | |
| 390 | ***********************************************************/ | |
| 391 | ||
| 392 | #define DATAEAST_2BUTTON \ | |
| 393 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) \ | |
| 394 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) \ | |
| 395 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) \ | |
| 396 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) \ | |
| 397 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) \ | |
| 398 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) \ | |
| 399 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED ) \ | |
| 400 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START1 ) \ | |
| 401 | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) \ | |
| 402 | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) \ | |
| 403 | PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) \ | |
| 404 | PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) \ | |
| 405 | PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) \ | |
| 406 | PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) \ | |
| 407 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED ) \ | |
| 408 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 ) | |
| 409 | ||
| 410 | #define DATAEAST_COINAGE \ | |
| 411 | PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:1,2,3") \ | |
| 412 | PORT_DIPSETTING( 0x0000, DEF_STR( 3C_1C ) ) \ | |
| 413 | PORT_DIPSETTING( 0x0001, DEF_STR( 2C_1C ) ) \ | |
| 414 | PORT_DIPSETTING( 0x0007, DEF_STR( 1C_1C ) ) \ | |
| 415 | PORT_DIPSETTING( 0x0006, DEF_STR( 1C_2C ) ) \ | |
| 416 | PORT_DIPSETTING( 0x0005, DEF_STR( 1C_3C ) ) \ | |
| 417 | PORT_DIPSETTING( 0x0004, DEF_STR( 1C_4C ) ) \ | |
| 418 | PORT_DIPSETTING( 0x0003, DEF_STR( 1C_5C ) ) \ | |
| 419 | PORT_DIPSETTING( 0x0002, DEF_STR( 1C_6C ) ) \ | |
| 420 | PORT_DIPNAME( 0x0038, 0x0038, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW1:4,5,6") \ | |
| 421 | PORT_DIPSETTING( 0x0000, DEF_STR( 3C_1C ) ) \ | |
| 422 | PORT_DIPSETTING( 0x0008, DEF_STR( 2C_1C ) ) \ | |
| 423 | PORT_DIPSETTING( 0x0038, DEF_STR( 1C_1C ) ) \ | |
| 424 | PORT_DIPSETTING( 0x0030, DEF_STR( 1C_2C ) ) \ | |
| 425 | PORT_DIPSETTING( 0x0028, DEF_STR( 1C_3C ) ) \ | |
| 426 | PORT_DIPSETTING( 0x0020, DEF_STR( 1C_4C ) ) \ | |
| 427 | PORT_DIPSETTING( 0x0018, DEF_STR( 1C_5C ) ) \ | |
| 428 | PORT_DIPSETTING( 0x0010, DEF_STR( 1C_6C ) ) | |
| 429 | ||
| 378 | 430 | /**********************************************************************************/ |
| 379 | 431 | |
| 380 | 432 | static INPUT_PORTS_START( edrandy ) |
| 433 | ||
| 381 | 434 | PORT_START |
| 382 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) | |
| 383 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) | |
| 384 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) | |
| 385 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) | |
| 386 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) | |
| 387 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) | |
| 388 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 389 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START1 ) | |
| 390 | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) | |
| 391 | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) | |
| 392 | PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) | |
| 393 | PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) | |
| 394 | PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) | |
| 395 | PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) | |
| 396 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 397 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 ) | |
| 435 | DATAEAST_2BUTTON | |
| 398 | 436 | |
| 399 | 437 | PORT_START |
| 400 | 438 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) |
| r1478 | r1479 | |
| 402 | 440 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| 403 | 441 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_VBLANK ) |
| 404 | 442 | |
| 405 | PORT_START | |
| 406 | PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) ) | |
| 407 | PORT_DIPSETTING( 0x0000, DEF_STR( 3C_1C ) ) | |
| 408 | PORT_DIPSETTING( 0x0001, DEF_STR( 2C_1C ) ) | |
| 409 | PORT_DIPSETTING( 0x0007, DEF_STR( 1C_1C ) ) | |
| 410 | PORT_DIPSETTING( 0x0006, DEF_STR( 1C_2C ) ) | |
| 411 | PORT_DIPSETTING( 0x0005, DEF_STR( 1C_3C ) ) | |
| 412 | PORT_DIPSETTING( 0x0004, DEF_STR( 1C_4C ) ) | |
| 413 | PORT_DIPSETTING( 0x0003, DEF_STR( 1C_5C ) ) | |
| 414 | PORT_DIPSETTING( 0x0002, DEF_STR( 1C_6C ) ) | |
| 415 | PORT_DIPNAME( 0x0038, 0x0038, DEF_STR( Coin_B ) ) | |
| 416 | PORT_DIPSETTING( 0x0000, DEF_STR( 3C_1C ) ) | |
| 417 | PORT_DIPSETTING( 0x0008, DEF_STR( 2C_1C ) ) | |
| 418 | PORT_DIPSETTING( 0x0038, DEF_STR( 1C_1C ) ) | |
| 419 | PORT_DIPSETTING( 0x0030, DEF_STR( 1C_2C ) ) | |
| 420 | PORT_DIPSETTING( 0x0028, DEF_STR( 1C_3C ) ) | |
| 421 | PORT_DIPSETTING( 0x0020, DEF_STR( 1C_4C ) ) | |
| 422 | PORT_DIPSETTING( 0x0018, DEF_STR( 1C_5C ) ) | |
| 423 | PORT_DIPSETTING( 0x0010, DEF_STR( 1C_6C ) ) | |
| 424 | PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Flip_Screen ) ) | |
| 443 | PORT_START_TAG("DSW") | |
| 444 | ||
| 445 | DATAEAST_COINAGE | |
| 446 | ||
| 447 | PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:7") | |
| 425 | 448 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) |
| 426 | 449 | PORT_DIPSETTING( 0x0040, DEF_STR( On ) ) |
| 427 | PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) ) /* Listed as "Don't Change" in the manual */ | |
| 428 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) | |
| 429 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 430 | PORT_DIPNAME( 0x0300, 0x0300, "Player's Power" ) /* Energy */ | |
| 450 | PORT_DIPNAME( 0x0080, 0x0080, "Credit(s) to Start" ) PORT_DIPLOCATION("SW1:8") /* Also, if Coin A and B are on 1/1, 0x00 gives 2 to start, 1 to continue */ | |
| 451 | PORT_DIPSETTING( 0x0080, "1" ) | |
| 452 | PORT_DIPSETTING( 0x0000, "2" ) | |
| 453 | ||
| 454 | PORT_DIPNAME( 0x0300, 0x0300, "Player's Power" ) PORT_DIPLOCATION("SW2:1,2") /* Energy */ | |
| 431 | 455 | PORT_DIPSETTING( 0x0100, DEF_STR( Very_Low ) ) /* 2.5 */ |
| 432 | 456 | PORT_DIPSETTING( 0x0000, DEF_STR( Low ) ) /* 3 */ |
| 433 | 457 | PORT_DIPSETTING( 0x0300, DEF_STR( Medium ) ) /* 3.5 */ |
| 434 | 458 | PORT_DIPSETTING( 0x0200, DEF_STR( High ) ) /* 4.5 */ |
| 435 | PORT_DIPNAME( 0x0c00, 0x0c00, DEF_STR( Difficulty ) ) | |
| 459 | PORT_DIPNAME( 0x0c00, 0x0c00, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:3,4") | |
| 436 | 460 | PORT_DIPSETTING( 0x0800, DEF_STR( Easy ) ) |
| 437 | 461 | PORT_DIPSETTING( 0x0c00, DEF_STR( Normal ) ) |
| 438 | 462 | PORT_DIPSETTING( 0x0400, DEF_STR( Hard ) ) |
| 439 | 463 | PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) ) |
| 440 | PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) ) /* Listed as "Don't Change" in the manual */ | |
| 464 | PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:5") /* Listed as "Don't Change" in the manual */ | |
| 441 | 465 | PORT_DIPSETTING( 0x1000, DEF_STR( Off ) ) |
| 442 | 466 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 443 | PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) ) /* Listed as "Don't Change" in the manual */ | |
| 467 | PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:6") /* Listed as "Don't Change" in the manual */ | |
| 444 | 468 | PORT_DIPSETTING( 0x2000, DEF_STR( Off ) ) |
| 445 | 469 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 446 | PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Continues ) ) | |
| 470 | PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Continues ) ) PORT_DIPLOCATION("SW2:7") | |
| 447 | 471 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) |
| 448 | 472 | PORT_DIPSETTING( 0x4000, DEF_STR( On ) ) |
| 449 | PORT_DIPNAME( 0x8000, 0x0000, DEF_STR( Demo_Sounds ) ) | |
| 473 | PORT_DIPNAME( 0x8000, 0x0000, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:8") | |
| 450 | 474 | PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) |
| 451 | 475 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 452 | 476 | INPUT_PORTS_END |
| 453 | 477 | |
| 478 | static INPUT_PORTS_START( edrandc ) | |
| 479 | PORT_INCLUDE(edrandy) | |
| 480 | ||
| 481 | PORT_MODIFY("DSW") | |
| 482 | PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:8") /* Listed as "Don't Change" in the manual */ | |
| 483 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) | |
| 484 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 485 | INPUT_PORTS_END | |
| 486 | ||
| 454 | 487 | static INPUT_PORTS_START( cninja ) |
| 488 | ||
| 455 | 489 | PORT_START |
| 456 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) | |
| 457 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) | |
| 458 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) | |
| 459 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) | |
| 460 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) | |
| 461 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) | |
| 462 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 463 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START1 ) | |
| 464 | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) | |
| 465 | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) | |
| 466 | PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) | |
| 467 | PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) | |
| 468 | PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) | |
| 469 | PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) | |
| 470 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 471 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 ) | |
| 490 | DATAEAST_2BUTTON | |
| 472 | 491 | |
| 473 | 492 | PORT_START |
| 474 | 493 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) |
| r1478 | r1479 | |
| 476 | 495 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| 477 | 496 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_VBLANK ) |
| 478 | 497 | |
| 479 | PORT_START | |
| 480 | PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) ) | |
| 481 | PORT_DIPSETTING( 0x0000, DEF_STR( 3C_1C ) ) | |
| 482 | PORT_DIPSETTING( 0x0001, DEF_STR( 2C_1C ) ) | |
| 483 | PORT_DIPSETTING( 0x0007, DEF_STR( 1C_1C ) ) | |
| 484 | PORT_DIPSETTING( 0x0006, DEF_STR( 1C_2C ) ) | |
| 485 | PORT_DIPSETTING( 0x0005, DEF_STR( 1C_3C ) ) | |
| 486 | PORT_DIPSETTING( 0x0004, DEF_STR( 1C_4C ) ) | |
| 487 | PORT_DIPSETTING( 0x0003, DEF_STR( 1C_5C ) ) | |
| 488 | PORT_DIPSETTING( 0x0002, DEF_STR( 1C_6C ) ) | |
| 489 | PORT_DIPNAME( 0x0038, 0x0038, DEF_STR( Coin_B ) ) | |
| 490 | PORT_DIPSETTING( 0x0000, DEF_STR( 3C_1C ) ) | |
| 491 | PORT_DIPSETTING( 0x0008, DEF_STR( 2C_1C ) ) | |
| 492 | PORT_DIPSETTING( 0x0038, DEF_STR( 1C_1C ) ) | |
| 493 | PORT_DIPSETTING( 0x0030, DEF_STR( 1C_2C ) ) | |
| 494 | PORT_DIPSETTING( 0x0028, DEF_STR( 1C_3C ) ) | |
| 495 | PORT_DIPSETTING( 0x0020, DEF_STR( 1C_4C ) ) | |
| 496 | PORT_DIPSETTING( 0x0018, DEF_STR( 1C_5C ) ) | |
| 497 | PORT_DIPSETTING( 0x0010, DEF_STR( 1C_6C ) ) | |
| 498 | PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Flip_Screen ) ) | |
| 498 | PORT_START_TAG("DSW") /* Dip switch bank 1 */ | |
| 499 | ||
| 500 | DATAEAST_COINAGE | |
| 501 | ||
| 502 | PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:7") | |
| 499 | 503 | PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) |
| 500 | 504 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 501 | PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) ) /* If DS #1-#6 are all ON */ | |
| 505 | PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:8") /* If DS #1-#6 are all ON */ | |
| 502 | 506 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) /* Standard Coin Credit */ |
| 503 | 507 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) /* 2 Coins to Start / 1 Coin to Continue */ |
| 504 | PORT_DIPNAME( 0x0300, 0x0300, DEF_STR( Lives ) ) | |
| 508 | ||
| 509 | PORT_DIPNAME( 0x0300, 0x0300, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:1,2") /* Dip switch bank 2 */ | |
| 505 | 510 | PORT_DIPSETTING( 0x0100, "1" ) |
| 506 | 511 | PORT_DIPSETTING( 0x0000, "2" ) |
| 507 | 512 | PORT_DIPSETTING( 0x0300, "3" ) |
| 508 | 513 | PORT_DIPSETTING( 0x0200, "4" ) |
| 509 | PORT_DIPNAME( 0x0c00, 0x0c00, DEF_STR( Difficulty ) ) | |
| 514 | PORT_DIPNAME( 0x0c00, 0x0c00, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:3,4") | |
| 510 | 515 | PORT_DIPSETTING( 0x0800, DEF_STR( Easy ) ) |
| 511 | 516 | PORT_DIPSETTING( 0x0c00, DEF_STR( Normal ) ) |
| 512 | 517 | PORT_DIPSETTING( 0x0400, DEF_STR( Hard ) ) |
| 513 | 518 | PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) ) |
| 514 | PORT_DIPNAME( 0x1000, 0x1000, "Restore Life Meter" ) /* Recovery of Life After Defeated Boss */ | |
| 519 | PORT_DIPNAME( 0x1000, 0x1000, "Restore Life Meter" ) PORT_DIPLOCATION("SW2:5") /* Recovery of Life After Defeated Boss */ | |
| 515 | 520 | PORT_DIPSETTING( 0x1000, DEF_STR( Off ) ) |
| 516 | 521 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 517 | PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) ) /* Listed as "Don't Change" in the manual */ | |
| 522 | PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:6") /* Listed as "Don't Change" in the manual */ | |
| 518 | 523 | PORT_DIPSETTING( 0x2000, DEF_STR( Off ) ) |
| 519 | 524 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 520 | PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown ) ) /* Listed as "Don't Change" in the manual */ | |
| 525 | PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:7") /* Listed as "Don't Change" in the manual */ | |
| 521 | 526 | PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) |
| 522 | 527 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 523 | PORT_DIPNAME( 0x8000, 0x0000, DEF_STR( Demo_Sounds ) ) | |
| 528 | PORT_DIPNAME( 0x8000, 0x0000, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:8") | |
| 524 | 529 | PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) |
| 525 | 530 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 526 | 531 | INPUT_PORTS_END |
| 527 | 532 | |
| 528 | 533 | static INPUT_PORTS_START( cninjau ) |
| 529 | PORT_START | |
| 530 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) | |
| 531 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) | |
| 532 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) | |
| 533 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) | |
| 534 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) | |
| 535 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) | |
| 536 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 537 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START1 ) | |
| 538 | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) | |
| 539 | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) | |
| 540 | PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) | |
| 541 | PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) | |
| 542 | PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) | |
| 543 | PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) | |
| 544 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 545 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 ) | |
| 534 | PORT_INCLUDE(cninja) | |
| 546 | 535 | |
| 547 | PORT_START | |
| 548 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) | |
| 549 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) | |
| 550 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) | |
| 551 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_VBLANK ) | |
| 552 | ||
| 553 | PORT_START | |
| 554 | PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) ) | |
| 555 | PORT_DIPSETTING( 0x0000, DEF_STR( 3C_1C ) ) | |
| 556 | PORT_DIPSETTING( 0x0001, DEF_STR( 2C_1C ) ) | |
| 557 | PORT_DIPSETTING( 0x0007, DEF_STR( 1C_1C ) ) | |
| 558 | PORT_DIPSETTING( 0x0006, DEF_STR( 1C_2C ) ) | |
| 559 | PORT_DIPSETTING( 0x0005, DEF_STR( 1C_3C ) ) | |
| 560 | PORT_DIPSETTING( 0x0004, DEF_STR( 1C_4C ) ) | |
| 561 | PORT_DIPSETTING( 0x0003, DEF_STR( 1C_5C ) ) | |
| 562 | PORT_DIPSETTING( 0x0002, DEF_STR( 1C_6C ) ) | |
| 563 | PORT_DIPNAME( 0x0038, 0x0038, DEF_STR( Coin_B ) ) | |
| 564 | PORT_DIPSETTING( 0x0000, DEF_STR( 3C_1C ) ) | |
| 565 | PORT_DIPSETTING( 0x0008, DEF_STR( 2C_1C ) ) | |
| 566 | PORT_DIPSETTING( 0x0038, DEF_STR( 1C_1C ) ) | |
| 567 | PORT_DIPSETTING( 0x0030, DEF_STR( 1C_2C ) ) | |
| 568 | PORT_DIPSETTING( 0x0028, DEF_STR( 1C_3C ) ) | |
| 569 | PORT_DIPSETTING( 0x0020, DEF_STR( 1C_4C ) ) | |
| 570 | PORT_DIPSETTING( 0x0018, DEF_STR( 1C_5C ) ) | |
| 571 | PORT_DIPSETTING( 0x0010, DEF_STR( 1C_6C ) ) | |
| 572 | PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Flip_Screen ) ) | |
| 573 | PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) | |
| 574 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 575 | PORT_DIPNAME( 0x0080, 0x0080, "Credit(s) to Start" ) /* Also, if Coin A and B are on 1/1, 0x00 gives 2 to start, 1 to continue */ | |
| 536 | PORT_MODIFY("DSW") | |
| 537 | PORT_DIPNAME( 0x0080, 0x0080, "Credit(s) to Start" ) PORT_DIPLOCATION("SW1:8") /* Also, if Coin A and B are on 1/1, 0x00 gives 2 to start, 1 to continue */ | |
| 576 | 538 | PORT_DIPSETTING( 0x0080, "1" ) |
| 577 | 539 | PORT_DIPSETTING( 0x0000, "2" ) |
| 578 | PORT_DIPNAME( 0x0300, 0x0300, DEF_STR( Lives ) ) | |
| 579 | PORT_DIPSETTING( 0x0100, "1" ) | |
| 580 | PORT_DIPSETTING( 0x0000, "2" ) | |
| 581 | PORT_DIPSETTING( 0x0300, "3" ) | |
| 582 | PORT_DIPSETTING( 0x0200, "4" ) | |
| 583 | PORT_DIPNAME( 0x0c00, 0x0c00, DEF_STR( Difficulty ) ) | |
| 584 | PORT_DIPSETTING( 0x0800, DEF_STR( Easy ) ) | |
| 585 | PORT_DIPSETTING( 0x0c00, DEF_STR( Normal ) ) | |
| 586 | PORT_DIPSETTING( 0x0400, DEF_STR( Hard ) ) | |
| 587 | PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) ) | |
| 588 | PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) ) /* Listed as "Don't Change" in the manual */ | |
| 589 | PORT_DIPSETTING( 0x1000, DEF_STR( Off ) ) | |
| 590 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 591 | PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) ) /* Listed as "Don't Change" in the manual */ | |
| 592 | PORT_DIPSETTING( 0x2000, DEF_STR( Off ) ) | |
| 593 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 594 | PORT_DIPNAME( 0x4000, 0x4000, "Restore Life Meter" ) /* Life Meter Restored when Big Boss is Defeated */ | |
| 595 | PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) | |
| 596 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 597 | PORT_DIPNAME( 0x8000, 0x0000, DEF_STR( Demo_Sounds ) ) | |
| 598 | PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) | |
| 599 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 600 | 540 | INPUT_PORTS_END |
| 601 | 541 | |
| 602 | 542 | static INPUT_PORTS_START( robocop2 ) |
| r1478 | r1479 | |
| 624 | 564 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| 625 | 565 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_VBLANK ) |
| 626 | 566 | |
| 627 | PORT_START /* Dip switch bank 1 */ | |
| 628 | PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) ) | |
| 629 | PORT_DIPSETTING( 0x0000, DEF_STR( 3C_1C ) ) | |
| 630 | PORT_DIPSETTING( 0x0001, DEF_STR( 2C_1C ) ) | |
| 631 | PORT_DIPSETTING( 0x0007, DEF_STR( 1C_1C ) ) | |
| 632 | PORT_DIPSETTING( 0x0006, DEF_STR( 1C_2C ) ) | |
| 633 | PORT_DIPSETTING( 0x0005, DEF_STR( 1C_3C ) ) | |
| 634 | PORT_DIPSETTING( 0x0004, DEF_STR( 1C_4C ) ) | |
| 635 | PORT_DIPSETTING( 0x0003, DEF_STR( 1C_5C ) ) | |
| 636 | PORT_DIPSETTING( 0x0002, DEF_STR( 1C_6C ) ) | |
| 637 | PORT_DIPNAME( 0x0038, 0x0038, DEF_STR( Coin_B ) ) | |
| 638 | PORT_DIPSETTING( 0x0000, DEF_STR( 3C_1C ) ) | |
| 639 | PORT_DIPSETTING( 0x0008, DEF_STR( 2C_1C ) ) | |
| 640 | PORT_DIPSETTING( 0x0038, DEF_STR( 1C_1C ) ) | |
| 641 | PORT_DIPSETTING( 0x0030, DEF_STR( 1C_2C ) ) | |
| 642 | PORT_DIPSETTING( 0x0028, DEF_STR( 1C_3C ) ) | |
| 643 | PORT_DIPSETTING( 0x0020, DEF_STR( 1C_4C ) ) | |
| 644 | PORT_DIPSETTING( 0x0018, DEF_STR( 1C_5C ) ) | |
| 645 | PORT_DIPSETTING( 0x0010, DEF_STR( 1C_6C ) ) | |
| 646 | PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Flip_Screen ) ) | |
| 567 | PORT_START_TAG("DSW") /* Dip switch bank 1 */ | |
| 568 | ||
| 569 | DATAEAST_COINAGE | |
| 570 | ||
| 571 | PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:7") | |
| 647 | 572 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) |
| 648 | 573 | PORT_DIPSETTING( 0x0040, DEF_STR( On ) ) |
| 649 | PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unused ) ) | |
| 574 | PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:8") | |
| 650 | 575 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) |
| 651 | 576 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 652 | PORT_DIPNAME( 0x0300, 0x0300, DEF_STR( Lives ) ) /* Dip switch bank 2 */ | |
| 577 | ||
| 578 | PORT_DIPNAME( 0x0300, 0x0300, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:1,2") /* Dip switch bank 2 */ | |
| 653 | 579 | PORT_DIPSETTING( 0x0100, "1" ) |
| 654 | 580 | PORT_DIPSETTING( 0x0000, "2" ) |
| 655 | 581 | PORT_DIPSETTING( 0x0300, "3" ) |
| 656 | 582 | PORT_DIPSETTING( 0x0200, "4" ) |
| 657 | PORT_DIPNAME( 0x0c00, 0x0c00, DEF_STR( Difficulty ) ) | |
| 658 | PORT_DIPSETTING( 0x0800, DEF_STR( Easy ) ) | |
| 659 | PORT_DIPSETTING( 0x0c00, DEF_STR( Normal ) ) | |
| 660 | PORT_DIPSETTING( 0x0400, DEF_STR( Hard ) ) | |
| 661 | PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) ) | |
| 662 | PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) ) | |
| 663 | PORT_DIPSETTING( 0x1000, DEF_STR( Off ) ) | |
| 664 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 665 | PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) ) | |
| 666 | PORT_DIPSETTING( 0x2000, DEF_STR( Off ) ) | |
| 667 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 668 | PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown ) ) | |
| 669 | PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) | |
| 670 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 671 | PORT_DIPNAME( 0x8000, 0x0000, DEF_STR( Demo_Sounds ) ) | |
| 583 | PORT_DIPNAME( 0x0c00, 0x0c00, "Time" ) PORT_DIPLOCATION("SW2:3,4") | |
| 584 | PORT_DIPSETTING( 0x0800, "400 Seconds" ) | |
| 585 | PORT_DIPSETTING( 0x0c00, "300 Seconds" ) | |
| 586 | PORT_DIPSETTING( 0x0400, "200 Seconds" ) | |
| 587 | PORT_DIPSETTING( 0x0000, "100 Seconds" ) | |
| 588 | PORT_DIPNAME( 0x3000, 0x3000, "Health" ) PORT_DIPLOCATION("SW2:5,6") | |
| 589 | PORT_DIPSETTING( 0x0000, "17" ) | |
| 590 | PORT_DIPSETTING( 0x1000, "24" ) | |
| 591 | PORT_DIPSETTING( 0x3000, "33" ) | |
| 592 | PORT_DIPSETTING( 0x2000, "40" ) | |
| 593 | PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Continues ) ) PORT_DIPLOCATION("SW2:7") | |
| 594 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) | |
| 595 | PORT_DIPSETTING( 0x4000, DEF_STR( On ) ) | |
| 596 | PORT_DIPNAME( 0x8000, 0x0000, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:8") | |
| 672 | 597 | PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) |
| 673 | 598 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 599 | ||
| 600 | PORT_START | |
| 601 | PORT_DIPNAME( 0x0003, 0x0003, "Bullets" ) PORT_DIPLOCATION("SW3:1,2") /* Dip switch bank 3 */ | |
| 602 | PORT_DIPSETTING( 0x0000, "Least" ) | |
| 603 | PORT_DIPSETTING( 0x0001, "Less" ) | |
| 604 | PORT_DIPSETTING( 0x0003, DEF_STR( Normal ) ) | |
| 605 | PORT_DIPSETTING( 0x0002, "More" ) | |
| 606 | PORT_DIPNAME( 0x000c, 0x000c, "Enemy Movement" ) PORT_DIPLOCATION("SW3:3,4") | |
| 607 | PORT_DIPSETTING( 0x0008, "Slow" ) | |
| 608 | PORT_DIPSETTING( 0x000c, DEF_STR( Normal ) ) | |
| 609 | PORT_DIPSETTING( 0x0004, "Fast" ) | |
| 610 | PORT_DIPSETTING( 0x0000, "Fastest" ) | |
| 611 | PORT_DIPNAME( 0x0030, 0x0030, "Enemy Strength" ) PORT_DIPLOCATION("SW3:5,6") | |
| 612 | PORT_DIPSETTING( 0x0020, "Less" ) | |
| 613 | PORT_DIPSETTING( 0x0030, DEF_STR( Normal ) ) | |
| 614 | PORT_DIPSETTING( 0x0010, "More" ) | |
| 615 | PORT_DIPSETTING( 0x0000, "Most" ) | |
| 616 | PORT_DIPNAME( 0x0040, 0x0040, "Enemy Weapon Speed" ) PORT_DIPLOCATION("SW3:7") | |
| 617 | PORT_DIPSETTING( 0x0040, DEF_STR( Normal ) ) | |
| 618 | PORT_DIPSETTING( 0x0000, "Fast" ) | |
| 619 | PORT_DIPNAME( 0x0080, 0x0080, "Game Over Message" ) PORT_DIPLOCATION("SW3:8") /* This refers to the system shut down text just before the actual "GAME OVER" */ | |
| 620 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) | |
| 621 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 674 | 622 | INPUT_PORTS_END |
| 675 | 623 | |
| 676 | 624 | static INPUT_PORTS_START( mutantf ) |
| 625 | ||
| 677 | 626 | PORT_START |
| 678 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) | |
| 679 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) | |
| 680 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) | |
| 681 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) | |
| 682 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) | |
| 683 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) | |
| 684 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 685 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START1 ) | |
| 686 | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) | |
| 687 | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) | |
| 688 | PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) | |
| 689 | PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) | |
| 690 | PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) | |
| 691 | PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) | |
| 692 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 693 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 ) | |
| 627 | DATAEAST_2BUTTON | |
| 694 | 628 | |
| 695 | 629 | PORT_START |
| 696 | 630 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) |
| r1478 | r1479 | |
| 698 | 632 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| 699 | 633 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_VBLANK ) |
| 700 | 634 | |
| 701 | PORT_START | |
| 702 | PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) ) | |
| 703 | PORT_DIPSETTING( 0x0000, DEF_STR( 3C_1C ) ) | |
| 704 | PORT_DIPSETTING( 0x0001, DEF_STR( 2C_1C ) ) | |
| 705 | PORT_DIPSETTING( 0x0007, DEF_STR( 1C_1C ) ) | |
| 706 | PORT_DIPSETTING( 0x0006, DEF_STR( 1C_2C ) ) | |
| 707 | PORT_DIPSETTING( 0x0005, DEF_STR( 1C_3C ) ) | |
| 708 | PORT_DIPSETTING( 0x0004, DEF_STR( 1C_4C ) ) | |
| 709 | PORT_DIPSETTING( 0x0003, DEF_STR( 1C_5C ) ) | |
| 710 | PORT_DIPSETTING( 0x0002, DEF_STR( 1C_6C ) ) | |
| 711 | PORT_DIPNAME( 0x0038, 0x0038, DEF_STR( Coin_B ) ) | |
| 712 | PORT_DIPSETTING( 0x0000, DEF_STR( 3C_1C ) ) | |
| 713 | PORT_DIPSETTING( 0x0008, DEF_STR( 2C_1C ) ) | |
| 714 | PORT_DIPSETTING( 0x0038, DEF_STR( 1C_1C ) ) | |
| 715 | PORT_DIPSETTING( 0x0030, DEF_STR( 1C_2C ) ) | |
| 716 | PORT_DIPSETTING( 0x0028, DEF_STR( 1C_3C ) ) | |
| 717 | PORT_DIPSETTING( 0x0020, DEF_STR( 1C_4C ) ) | |
| 718 | PORT_DIPSETTING( 0x0018, DEF_STR( 1C_5C ) ) | |
| 719 | PORT_DIPSETTING( 0x0010, DEF_STR( 1C_6C ) ) | |
| 720 | PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Flip_Screen ) ) | |
| 635 | PORT_START_TAG("DSW") /* Dip switch bank 1 */ | |
| 636 | ||
| 637 | DATAEAST_COINAGE | |
| 638 | ||
| 639 | PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:7") | |
| 721 | 640 | PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) |
| 722 | 641 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 723 | PORT_DIPNAME( 0x0080, 0x0080, "Continue Coin" ) | |
| 724 | PORT_DIPSETTING( 0x0080, DEF_STR( Normal ) ) | |
| 725 | PORT_DIPSETTING( 0x0000, "Two Coin Start" ) | |
| 726 | PORT_DIPNAME( 0x0300, 0x0300, "Timer Decrement" ) | |
| 642 | PORT_DIPNAME( 0x0080, 0x0080, "Credit(s) to Start" ) PORT_DIPLOCATION("SW1:8") | |
| 643 | PORT_DIPSETTING( 0x0080, "1" ) | |
| 644 | PORT_DIPSETTING( 0x0000, "2" ) | |
| 645 | ||
| 646 | PORT_DIPNAME( 0x0300, 0x0300, "Timer Decrement" ) PORT_DIPLOCATION("SW2:1,2") | |
| 727 | 647 | PORT_DIPSETTING( 0x0100, "Slow" ) |
| 728 | 648 | PORT_DIPSETTING( 0x0300, DEF_STR( Normal ) ) |
| 729 | 649 | PORT_DIPSETTING( 0x0200, "Fast" ) |
| 730 | 650 | PORT_DIPSETTING( 0x0000, "Very Fast" ) |
| 731 | PORT_DIPNAME( 0x0c00, 0x0c00, DEF_STR( Difficulty ) ) | |
| 651 | PORT_DIPNAME( 0x0c00, 0x0c00, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:3,4") | |
| 732 | 652 | PORT_DIPSETTING( 0x0800, DEF_STR( Easy ) ) |
| 733 | 653 | PORT_DIPSETTING( 0x0c00, DEF_STR( Normal ) ) |
| 734 | 654 | PORT_DIPSETTING( 0x0400, DEF_STR( Hard ) ) |
| 735 | 655 | PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) ) |
| 736 | PORT_DIPNAME( 0x3000, 0x3000, "Life Per Stage" ) | |
| 656 | PORT_DIPNAME( 0x3000, 0x3000, "Life Per Stage" ) PORT_DIPLOCATION("SW2:5,6") | |
| 737 | 657 | PORT_DIPSETTING( 0x0000, "Least" ) |
| 738 | 658 | PORT_DIPSETTING( 0x1000, "Little" ) |
| 739 | 659 | PORT_DIPSETTING( 0x2000, "Less" ) |
| 740 | 660 | PORT_DIPSETTING( 0x3000, DEF_STR( Normal ) ) |
| 741 | PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Continues ) ) | |
| 661 | PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Continues ) ) PORT_DIPLOCATION("SW2:7") | |
| 742 | 662 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) |
| 743 | 663 | PORT_DIPSETTING( 0x4000, DEF_STR( On ) ) |
| 744 | PORT_DIPNAME( 0x8000, 0x0000, DEF_STR( Demo_Sounds ) ) | |
| 664 | PORT_DIPNAME( 0x8000, 0x0000, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:8") | |
| 745 | 665 | PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) |
| 746 | 666 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 747 | 667 | INPUT_PORTS_END |
| r1478 | r1479 | |
| 1088 | 1008 | |
| 1089 | 1009 | /**********************************************************************************/ |
| 1090 | 1010 | |
| 1091 | ROM_START( cninja ) | |
| 1011 | ROM_START( cninja ) /* World ver 4 */ | |
| 1092 | 1012 | ROM_REGION( 0xc0000, REGION_CPU1, 0 ) /* 68000 code */ |
| 1093 | 1013 | ROM_LOAD16_BYTE( "gn-02-3.1k", 0x00000, 0x20000, CRC(39aea12a) SHA1(5de4e26d2c03c559249720b6a204567673754774) ) |
| 1094 | 1014 | ROM_LOAD16_BYTE( "gn-05-2.3k", 0x00001, 0x20000, CRC(0f4360ef) SHA1(d60b3377e818a037d0f94383dd207865853f529d) ) |
| r1478 | r1479 | |
| 1129 | 1049 | ROM_LOAD( "mb7122h.7v", 0x00000, 0x400, CRC(a1267336) SHA1(d11ea9d78526ac3c0dc6e57a2da5914273ad1e3f) ) /* Priority Unused */ |
| 1130 | 1050 | ROM_END |
| 1131 | 1051 | |
| 1132 | ROM_START( cninja | |
| 1052 | ROM_START( cninja1 ) /* World ver 1 */ | |
| 1133 | 1053 | ROM_REGION( 0xc0000, REGION_CPU1, 0 ) /* 68000 code */ |
| 1134 | 1054 | ROM_LOAD16_BYTE( "gn-02.1k", 0x00000, 0x20000, CRC(ccc59524) SHA1(430ae28ca38ec6a97b00cc3dee02d57e073819d4) ) |
| 1135 | 1055 | ROM_LOAD16_BYTE( "gn-05.3k", 0x00001, 0x20000, CRC(a002cbe4) SHA1(76f57e49fc41a779856f70feb14432a8ffd08bff) ) |
| r1478 | r1479 | |
| 1170 | 1090 | ROM_LOAD( "mb7122h.7v", 0x00000, 0x400, CRC(a1267336) SHA1(d11ea9d78526ac3c0dc6e57a2da5914273ad1e3f) ) /* Priority Unused */ |
| 1171 | 1091 | ROM_END |
| 1172 | 1092 | |
| 1173 | ROM_START( cninjau ) | |
| 1093 | ROM_START( cninjau ) /* US ver 4 */ | |
| 1174 | 1094 | ROM_REGION( 0xc0000, REGION_CPU1, 0 ) /* 68000 code */ |
| 1175 | 1095 | ROM_LOAD16_BYTE( "gm-02-3.1k", 0x00000, 0x20000, CRC(d931c3b1) SHA1(336390072a3a085fc534d9e2443c76104093b24f) ) |
| 1176 | 1096 | ROM_LOAD16_BYTE( "gm-05-2.3k", 0x00001, 0x20000, CRC(7417d3fb) SHA1(24c65101585955d56440b63a307021b5c137d7b9) ) |
| r1478 | r1479 | |
| 1211 | 1131 | ROM_LOAD( "mb7122h.7v", 0x00000, 0x400, CRC(a1267336) SHA1(d11ea9d78526ac3c0dc6e57a2da5914273ad1e3f) ) /* Priority Unused */ |
| 1212 | 1132 | ROM_END |
| 1213 | 1133 | |
| 1214 | ROM_START( joemac ) | |
| 1134 | ROM_START( joemac ) /* Japan ver 1 */ | |
| 1215 | 1135 | ROM_REGION( 0xc0000, REGION_CPU1, 0 ) /* 68000 code */ |
| 1216 | 1136 | ROM_LOAD16_BYTE( "gl-02-2.1k", 0x00000, 0x20000, CRC(80da12e2) SHA1(1037ed56c15dbe1eb8bb8b70f0bc3affc1119782) ) |
| 1217 | 1137 | ROM_LOAD16_BYTE( "gl-05-2.3k", 0x00001, 0x20000, CRC(fe4dbbbb) SHA1(85a3c5470270ebfc695fc5e937cf133a33860bec) ) |
| r1478 | r1479 | |
| 1292 | 1212 | /* No extra Oki samples in the bootleg */ |
| 1293 | 1213 | ROM_END |
| 1294 | 1214 | |
| 1295 | ROM_START( edrandy ) | |
| 1215 | ROM_START( edrandy ) /* World ver 3 */ | |
| 1296 | 1216 | ROM_REGION( 0x100000, REGION_CPU1, 0 ) /* 68000 code */ |
| 1297 | 1217 | ROM_LOAD16_BYTE( "gg-00-2.k1", 0x00000, 0x20000, CRC(ce1ba964) SHA1(da21734721344eff41a64a7f2382d5c027a24782) ) |
| 1298 | 1218 | ROM_LOAD16_BYTE( "gg-04-2.k3", 0x00001, 0x20000, CRC(24caed19) SHA1(bdca689dbb13685e71d3385a9ff7b356d2459d45) ) |
| r1478 | r1479 | |
| 1341 | 1261 | ROM_LOAD( "ge-12.v7", 0x00000, 0x400, CRC(278f674f) SHA1(d4f5b9770d6d2ddebf1b999e291c80a3e274d492) ) /* Priority Unused, same as Robocop 2 */ |
| 1342 | 1262 | ROM_END |
| 1343 | 1263 | |
| 1344 | ROM_START( edrandy | |
| 1264 | ROM_START( edrandy2 ) /* World ver 2 */ | |
| 1345 | 1265 | ROM_REGION( 0x100000, REGION_CPU1, 0 ) /* 68000 code */ |
| 1346 | 1266 | ROM_LOAD16_BYTE( "gg00-1.k1", 0x00000, 0x20000, CRC(a029cc4a) SHA1(3801fd6df6d1299972eeadbdbba1b0b7acf89139) ) |
| 1347 | 1267 | ROM_LOAD16_BYTE( "gg04-1.k3", 0x00001, 0x20000, CRC(8b7928a4) SHA1(4075713a830c9d5e324bb790468ec555fa747106) ) |
| r1478 | r1479 | |
| 1390 | 1310 | ROM_LOAD( "ge-12.v7", 0x00000, 0x400, CRC(278f674f) SHA1(d4f5b9770d6d2ddebf1b999e291c80a3e274d492) ) /* Priority Unused, same as Robocop 2 */ |
| 1391 | 1311 | ROM_END |
| 1392 | 1312 | |
| 1393 | ROM_START( edrandy | |
| 1313 | ROM_START( edrandy1 ) /* | |
| 1394 | 1314 | ROM_REGION( 0x100000, REGION_CPU1, 0 ) /* 68000 code */ |
| 1395 | 1315 | ROM_LOAD16_BYTE( "1.k1", 0x00000, 0x20000, CRC(f184cdaa) SHA1(7d4a1e8acf6737a9d74d78eb414f32885ffa9846) ) /* roms were simply labeled 1 through 12 */ |
| 1396 | 1316 | ROM_LOAD16_BYTE( "5.k3", 0x00001, 0x20000, CRC(7e3a4b81) SHA1(e768dd710a8b38add9fd8d9bfc88ad3a3c353ba5) ) |
| r1478 | r1479 | |
| 1439 | 1359 | ROM_LOAD( "ge-12.v7", 0x00000, 0x400, CRC(278f674f) SHA1(d4f5b9770d6d2ddebf1b999e291c80a3e274d492) ) /* Priority Unused, same as Robocop 2 */ |
| 1440 | 1360 | ROM_END |
| 1441 | 1361 | |
| 1442 | ROM_START( edrandyj ) | |
| 1362 | ROM_START( edrandyj ) /* Japan ver 3 */ | |
| 1443 | 1363 | ROM_REGION( 0x100000, REGION_CPU1, 0 ) /* 68000 code */ |
| 1444 | 1364 | ROM_LOAD16_BYTE( "ge-00-2.k1", 0x00000, 0x20000, CRC(b3d2403c) SHA1(9747dbe7905e1453e3e7764c874c523c54970e2e) ) |
| 1445 | 1365 | ROM_LOAD16_BYTE( "ge-04-2.k3", 0x00001, 0x20000, CRC(8a9624d6) SHA1(d5a9b56bc8a1d67fa28df95299cb205e9c965310) ) |
| r1478 | r1479 | |
| 1638 | 1558 | ROM_LOAD( "go-12.v7", 0x00000, 0x400, CRC(278f674f) SHA1(d4f5b9770d6d2ddebf1b999e291c80a3e274d492) ) /* Priority Unused */ |
| 1639 | 1559 | ROM_END |
| 1640 | 1560 | |
| 1641 | ROM_START( mutantf ) | |
| 1561 | ROM_START( mutantf ) /* World ver 5 */ | |
| 1642 | 1562 | ROM_REGION( 0x80000, REGION_CPU1, 0 ) /* 68000 code */ |
| 1643 | 1563 | ROM_LOAD16_BYTE("hd-03-4.2c", 0x00000, 0x20000, CRC(94859545) SHA1(4b218442bf1ba01b9b6b54c0037c76c827b79d35) ) |
| 1644 | 1564 | ROM_LOAD16_BYTE("hd-00-4.2a", 0x00001, 0x20000, CRC(3cdb648f) SHA1(f803d2894d4c32de770861c70f837377afd329fe) ) |
| 1645 | ROM_LOAD16_BYTE("hf-04-1.4c", 0x40000, 0x20000, CRC(fd2ea8d7) SHA1(00e50d42fcc7f6d5076963b02f5abb36275dc993) ) | |
| 1646 | ROM_LOAD16_BYTE("hf-01-1.4a", 0x40001, 0x20000, CRC(48a247ac) SHA1(c69d67e44ffae92b261de247f8d3eac2e02fcf11) ) | |
| 1565 | ROM_LOAD16_BYTE("hd-04-1.4c", 0x40000, 0x20000, CRC(fd2ea8d7) SHA1(00e50d42fcc7f6d5076963b02f5abb36275dc993) ) | |
| 1566 | ROM_LOAD16_BYTE("hd-01-1.4a", 0x40001, 0x20000, CRC(48a247ac) SHA1(c69d67e44ffae92b261de247f8d3eac2e02fcf11) ) | |
| 1647 | 1567 | |
| 1648 | 1568 | ROM_REGION( 0x10000, REGION_CPU2, 0 ) /* Sound CPU */ |
| 1649 | ROM_LOAD( "h | |
| 1569 | ROM_LOAD( "hd-12.21j", 0x00000, 0x10000, CRC(13d55f11) SHA1(6438dca57f43b3ca6d273bf82b62104a49260132) ) | |
| 1650 | 1570 | |
| 1651 | 1571 | ROM_REGION( 0x0a0000, REGION_GFX1, ROMREGION_DISPOSE ) /* chars */ |
| 1652 | ROM_LOAD16_BYTE( "hf-06-1.8d", 0x000000, 0x10000, CRC(8b7a558b) SHA1(06f1f6910b9a54e208ee9a0b734d5df946016236) ) | |
| 1653 | ROM_LOAD16_BYTE( "hf-07-1.9d", 0x000001, 0x10000, CRC(d2a3d449) SHA1(10ad634eb0238f6e9ba04266e4dbaf9470f5d169) ) | |
| 1572 | ROM_LOAD16_BYTE( "hd-06-1.8d", 0x000000, 0x10000, CRC(8b7a558b) SHA1(06f1f6910b9a54e208ee9a0b734d5df946016236) ) | |
| 1573 | ROM_LOAD16_BYTE( "hd-07-1.9d", 0x000001, 0x10000, CRC(d2a3d449) SHA1(10ad634eb0238f6e9ba04266e4dbaf9470f5d169) ) | |
| 1654 | 1574 | |
| 1655 | 1575 | ROM_REGION( 0x080000, REGION_GFX2, ROMREGION_DISPOSE ) |
| 1656 | 1576 | ROM_LOAD( "maf-00.8a", 0x000000, 0x80000, CRC(e56f528d) SHA1(3908d9b189fa4895c532d1d1f133df0913810cf9) ) /* tiles 3 */ |
| r1478 | r1479 | |
| 1682 | 1602 | ROM_LOAD( "maf-09.18l", 0x00000, 0x80000, CRC(28e7ed81) SHA1(e168a2748b75c647f6f9c0d7d25d4f046aa98094) ) |
| 1683 | 1603 | ROM_END |
| 1684 | 1604 | |
| 1685 | ROM_START( mutantf | |
| 1605 | ROM_START( mutantf4 ) /* World ver 4 */ | |
| 1686 | 1606 | ROM_REGION( 0x80000, REGION_CPU1, 0 ) /* 68000 code */ |
| 1687 | 1607 | ROM_LOAD16_BYTE("hd-03-3.2c", 0x00000, 0x20000, CRC(e6f53574) SHA1(98d5a76bda52346e4bee5b1b0755e3fee4ad8283) ) |
| 1688 | 1608 | ROM_LOAD16_BYTE("hd-00-3.2a", 0x00001, 0x20000, CRC(d3055454) SHA1(83531ae52e5928ac64279bcb98878eef291f8f70) ) |
| 1689 | ROM_LOAD16_BYTE("hf-04-1.4c", 0x40000, 0x20000, CRC(fd2ea8d7) SHA1(00e50d42fcc7f6d5076963b02f5abb36275dc993) ) | |
| 1690 | ROM_LOAD16_BYTE("hf-01-1.4a", 0x40001, 0x20000, CRC(48a247ac) SHA1(c69d67e44ffae92b261de247f8d3eac2e02fcf11) ) | |
| 1609 | ROM_LOAD16_BYTE("hd-04-1.4c", 0x40000, 0x20000, CRC(fd2ea8d7) SHA1(00e50d42fcc7f6d5076963b02f5abb36275dc993) ) | |
| 1610 | ROM_LOAD16_BYTE("hd-01-1.4a", 0x40001, 0x20000, CRC(48a247ac) SHA1(c69d67e44ffae92b261de247f8d3eac2e02fcf11) ) | |
| 1691 | 1611 | |
| 1692 | 1612 | ROM_REGION( 0x10000, REGION_CPU2, 0 ) /* Sound CPU */ |
| 1693 | ROM_LOAD( "h | |
| 1613 | ROM_LOAD( "hd-12.21j", 0x00000, 0x10000, CRC(13d55f11) SHA1(6438dca57f43b3ca6d273bf82b62104a49260132) ) | |
| 1694 | 1614 | |
| 1695 | 1615 | ROM_REGION( 0x0a0000, REGION_GFX1, ROMREGION_DISPOSE ) /* chars */ |
| 1696 | ROM_LOAD16_BYTE( "hf-06-1.8d", 0x000000, 0x10000, CRC(8b7a558b) SHA1(06f1f6910b9a54e208ee9a0b734d5df946016236) ) | |
| 1697 | ROM_LOAD16_BYTE( "hf-07-1.9d", 0x000001, 0x10000, CRC(d2a3d449) SHA1(10ad634eb0238f6e9ba04266e4dbaf9470f5d169) ) | |
| 1616 | ROM_LOAD16_BYTE( "hd-06-1.8d", 0x000000, 0x10000, CRC(8b7a558b) SHA1(06f1f6910b9a54e208ee9a0b734d5df946016236) ) | |
| 1617 | ROM_LOAD16_BYTE( "hd-07-1.9d", 0x000001, 0x10000, CRC(d2a3d449) SHA1(10ad634eb0238f6e9ba04266e4dbaf9470f5d169) ) | |
| 1698 | 1618 | |
| 1699 | 1619 | ROM_REGION( 0x080000, REGION_GFX2, ROMREGION_DISPOSE ) |
| 1700 | 1620 | ROM_LOAD( "maf-00.8a", 0x000000, 0x80000, CRC(e56f528d) SHA1(3908d9b189fa4895c532d1d1f133df0913810cf9) ) /* tiles 3 */ |
| r1478 | r1479 | |
| 1726 | 1646 | ROM_LOAD( "maf-09.18l", 0x00000, 0x80000, CRC(28e7ed81) SHA1(e168a2748b75c647f6f9c0d7d25d4f046aa98094) ) |
| 1727 | 1647 | ROM_END |
| 1728 | 1648 | |
| 1729 | ROM_START( | |
| 1649 | ROM_START( mutantf3 ) /* World ver 3 */ | |
| 1730 | 1650 | ROM_REGION( 0x80000, REGION_CPU1, 0 ) /* 68000 code */ |
| 1651 | ROM_LOAD16_BYTE("hd-03-2.2c", 0x00000, 0x20000, CRC(0586c4fa) SHA1(bba9f7e57be0e70185b8103af26443ce832e7413) ) | |
| 1652 | ROM_LOAD16_BYTE("hd-00-2.2a", 0x00001, 0x20000, CRC(6f8ec48e) SHA1(5fcc2ae4ce409598ca9d0c28ba60f3de3874efa5) ) | |
| 1653 | ROM_LOAD16_BYTE("hd-04-1.4c", 0x40000, 0x20000, CRC(fd2ea8d7) SHA1(00e50d42fcc7f6d5076963b02f5abb36275dc993) ) | |
| 1654 | ROM_LOAD16_BYTE("hd-01-1.4a", 0x40001, 0x20000, CRC(48a247ac) SHA1(c69d67e44ffae92b261de247f8d3eac2e02fcf11) ) | |
| 1655 | ||
| 1656 | ROM_REGION( 0x10000, REGION_CPU2, 0 ) /* Sound CPU */ | |
| 1657 | ROM_LOAD( "hd-12.21j", 0x00000, 0x10000, CRC(13d55f11) SHA1(6438dca57f43b3ca6d273bf82b62104a49260132) ) | |
| 1658 | ||
| 1659 | ROM_REGION( 0x0a0000, REGION_GFX1, ROMREGION_DISPOSE ) /* chars */ | |
| 1660 | ROM_LOAD16_BYTE( "hd-06-1.8d", 0x000000, 0x10000, CRC(8b7a558b) SHA1(06f1f6910b9a54e208ee9a0b734d5df946016236) ) | |
| 1661 | ROM_LOAD16_BYTE( "hd-07-1.9d", 0x000001, 0x10000, CRC(d2a3d449) SHA1(10ad634eb0238f6e9ba04266e4dbaf9470f5d169) ) | |
| 1662 | ||
| 1663 | ROM_REGION( 0x080000, REGION_GFX2, ROMREGION_DISPOSE ) | |
| 1664 | ROM_LOAD( "maf-00.8a", 0x000000, 0x80000, CRC(e56f528d) SHA1(3908d9b189fa4895c532d1d1f133df0913810cf9) ) /* tiles 3 */ | |
| 1665 | ||
| 1666 | ROM_REGION( 0x100000, REGION_GFX3, ROMREGION_DISPOSE ) | |
| 1667 | ROM_LOAD( "maf-01.9a", 0x000000, 0x40000, CRC(c3d5173d) SHA1(2b6559bf65d7cc5b957ad347b64cf6a18f661686) ) /* tiles 1 */ | |
| 1668 | ROM_CONTINUE( 0x080000, 0x40000 ) | |
| 1669 | ROM_LOAD( "maf-02.11a", 0x040000, 0x40000, CRC(0b37d849) SHA1(a0606fb8130a2e86a241ce5ce0b4f61373a88c17) ) /* tiles 2 */ | |
| 1670 | ROM_CONTINUE( 0x0c0000, 0x40000 ) | |
| 1671 | ||
| 1672 | ROM_REGION( 0x500000, REGION_GFX4, ROMREGION_DISPOSE ) /* sprites */ | |
| 1673 | ROM_LOAD16_BYTE( "maf-03.18a", 0x000000, 0x100000, CRC(f4366d2c) SHA1(20964d0e1b879b3e5cb5d18a46d2a17dca2b4171) ) | |
| 1674 | ROM_LOAD16_BYTE( "maf-04.20a", 0x200000, 0x100000, CRC(0c8f654e) SHA1(e566d4b789b345e20caf7e061e43be7c2e1be9b2) ) | |
| 1675 | ROM_LOAD16_BYTE( "maf-05.21a", 0x400000, 0x080000, CRC(b0cfeb80) SHA1(b8519c604b03eb8bcf26d00a43b39d48f1b45ab5) ) | |
| 1676 | ROM_LOAD16_BYTE( "maf-06.18d", 0x000001, 0x100000, CRC(f5c7a9b5) SHA1(92efc9401347598c90acf62c9aef30109c990ad6) ) | |
| 1677 | ROM_LOAD16_BYTE( "maf-07.20d", 0x200001, 0x100000, CRC(fd6008a3) SHA1(7b680424eca3804c70fa0c4dc415d665c8626498) ) | |
| 1678 | ROM_LOAD16_BYTE( "maf-08.21d", 0x400001, 0x080000, CRC(e41cf1e7) SHA1(06524e1aed0adc4c32c92e16a00dc983014f4994) ) | |
| 1679 | ||
| 1680 | ROM_REGION( 0x40000, REGION_GFX5, ROMREGION_DISPOSE ) /* sprites 2 */ | |
| 1681 | ROM_LOAD32_BYTE("hf-08.15a", 0x00001, 0x10000, CRC(93b7279f) SHA1(14304a1ffe1bc791bfa83f8200793d897449133c) ) | |
| 1682 | ROM_LOAD32_BYTE("hf-09.17a", 0x00003, 0x10000, CRC(05e2c074) SHA1(ec95303e8196424864964b5d2ae862bf75571e83) ) | |
| 1683 | ROM_LOAD32_BYTE("hf-10.15c", 0x00000, 0x10000, CRC(9b06f418) SHA1(d1579ae36676e38c96ee55a1ffa20aa307a21654) ) | |
| 1684 | ROM_LOAD32_BYTE("hf-11.17c", 0x00002, 0x10000, CRC(3859a531) SHA1(a2a0c1aa28181b5ef6c075ff0118178340389693) ) | |
| 1685 | ||
| 1686 | ROM_REGION( 0x40000, REGION_SOUND1, 0 ) /* ADPCM samples */ | |
| 1687 | ROM_LOAD( "maf-10.20l", 0x00000, 0x40000, CRC(7c57f48b) SHA1(9a5624553b3b038d70f9b517f410a635c00a8771) ) | |
| 1688 | ||
| 1689 | ROM_REGION( 0x80000, REGION_SOUND2, 0 ) /* ADPCM samples */ | |
| 1690 | ROM_LOAD( "maf-09.18l", 0x00000, 0x80000, CRC(28e7ed81) SHA1(e168a2748b75c647f6f9c0d7d25d4f046aa98094) ) | |
| 1691 | ROM_END | |
| 1692 | ||
| 1693 | ROM_START( deathbrd ) /* Japan ver 3 */ | |
| 1694 | ROM_REGION( 0x80000, REGION_CPU1, 0 ) /* 68000 code */ | |
| 1731 | 1695 | ROM_LOAD16_BYTE("hf-03-2.2c", 0x00000, 0x20000, CRC(fb86fff3) SHA1(af4cfc19ec85e0aa49b5e46d95bdd94a20922cce) ) |
| 1732 | 1696 | ROM_LOAD16_BYTE("hf-00-2.2a", 0x00001, 0x20000, CRC(099aa422) SHA1(b62f261b1903dd2d1a308f7abb9584b3726204b5) ) |
| 1733 | ROM_LOAD16_BYTE("hf-04-1.4c", 0x40000, 0x20000, CRC(fd2ea8d7) SHA1(00e50d42fcc7f6d5076963b02f5abb36275dc993) ) | |
| 1734 | ROM_LOAD16_BYTE("hf-01-1.4a", 0x40001, 0x20000, CRC(48a247ac) SHA1(c69d67e44ffae92b261de247f8d3eac2e02fcf11) ) | |
| 1697 | ROM_LOAD16_BYTE("hd-04-1.4c", 0x40000, 0x20000, CRC(fd2ea8d7) SHA1(00e50d42fcc7f6d5076963b02f5abb36275dc993) ) /* May have the "HD" or "HF" region code label */ | |
| 1698 | ROM_LOAD16_BYTE("hd-01-1.4a", 0x40001, 0x20000, CRC(48a247ac) SHA1(c69d67e44ffae92b261de247f8d3eac2e02fcf11) ) /* May have the "HD" or "HF" region code label */ | |
| 1735 | 1699 | |
| 1736 | 1700 | ROM_REGION( 0x10000, REGION_CPU2, 0 ) /* Sound CPU */ |
| 1737 | ROM_LOAD( "h | |
| 1701 | ROM_LOAD( "hd-12.21j", 0x00000, 0x10000, CRC(13d55f11) SHA1(6438dca57f43b3ca6d273bf82b62104a49260132) ) /* May have the "HD" or "HF" region code label */ | |
| 1738 | 1702 | |
| 1739 | 1703 | ROM_REGION( 0x0a0000, REGION_GFX1, ROMREGION_DISPOSE ) /* chars */ |
| 1740 | ROM_LOAD16_BYTE( "hf-06-1.8d", 0x000000, 0x10000, CRC(8b7a558b) SHA1(06f1f6910b9a54e208ee9a0b734d5df946016236) ) | |
| 1741 | ROM_LOAD16_BYTE( "hf-07-1.9d", 0x000001, 0x10000, CRC(d2a3d449) SHA1(10ad634eb0238f6e9ba04266e4dbaf9470f5d169) ) | |
| 1704 | ROM_LOAD16_BYTE( "hd-06-1.8d", 0x000000, 0x10000, CRC(8b7a558b) SHA1(06f1f6910b9a54e208ee9a0b734d5df946016236) ) /* May have the "HD" or "HF" region code label */ | |
| 1705 | ROM_LOAD16_BYTE( "hd-07-1.9d", 0x000001, 0x10000, CRC(d2a3d449) SHA1(10ad634eb0238f6e9ba04266e4dbaf9470f5d169) ) /* May have the "HD" or "HF" region code label */ | |
| 1742 | 1706 | |
| 1743 | 1707 | ROM_REGION( 0x080000, REGION_GFX2, ROMREGION_DISPOSE ) |
| 1744 | 1708 | ROM_LOAD( "maf-00.8a", 0x000000, 0x80000, CRC(e56f528d) SHA1(3908d9b189fa4895c532d1d1f133df0913810cf9) ) /* tiles 3 */ |
| r1478 | r1479 | |
| 1824 | 1788 | |
| 1825 | 1789 | /**********************************************************************************/ |
| 1826 | 1790 | |
| 1827 | GAME( 1990, edrandy, 0, edrandy, edrandy, 0, ROT0, "Data East Corporation", "The Cliffhanger - Edward Randy (World revision 2)", 0 ) | |
| 1828 | GAME( 1990, edrandy1, edrandy, edrandy, edrandy, 0, ROT0, "Data East Corporation", "The Cliffhanger - Edward Randy (World revision 1)", 0 ) | |
| 1829 | GAME( 1990, edrandy0, edrandy, edrandy, edrandy, 0, ROT0, "Data East Corporation", "The Cliffhanger - Edward Randy (World)", 0 ) | |
| 1830 | GAME( 1990, edrandyj, edrandy, edrandy, edrandy, 0, ROT0, "Data East Corporation", "The Cliffhanger - Edward Randy (Japan revision 2)", 0 ) | |
| 1831 | GAME( 1991, cninja, 0, cninja, cninja, cninja, ROT0, "Data East Corporation", "Caveman Ninja (World revision 3)", 0 ) | |
| 1832 | GAME( 1991, cninja0, cninja, cninja, cninja, cninja, ROT0, "Data East Corporation", "Caveman Ninja (World revision 0)", 0 ) | |
| 1833 | GAME( 1991, cninjau, cninja, cninja, cninjau, cninja, ROT0, "Data East Corporation", "Caveman Ninja (US)", 0 ) | |
| 1834 | GAME( 1991, joemac, cninja, cninja, cninja, cninja, ROT0, "Data East Corporation", "Tatakae Genshizin Joe & Mac (Japan)", 0 ) | |
| 1791 | GAME( 1990, edrandy, 0, edrandy, edrandy, 0, ROT0, "Data East Corporation", "The Cliffhanger - Edward Randy (World ver 3)", 0 ) | |
| 1792 | GAME( 1990, edrandy2, edrandy, edrandy, edrandc, 0, ROT0, "Data East Corporation", "The Cliffhanger - Edward Randy (World ver 2)", 0 ) | |
| 1793 | GAME( 1990, edrandy1, edrandy, edrandy, edrandc, 0, ROT0, "Data East Corporation", "The Cliffhanger - Edward Randy (World ver 1)", 0 ) | |
| 1794 | GAME( 1990, edrandyj, edrandy, edrandy, edrandc, 0, ROT0, "Data East Corporation", "The Cliffhanger - Edward Randy (Japan ver 3)", 0 ) | |
| 1795 | GAME( 1991, cninja, 0, cninja, cninja, cninja, ROT0, "Data East Corporation", "Caveman Ninja (World ver 4)", 0 ) | |
| 1796 | GAME( 1991, cninja1, cninja, cninja, cninja, cninja, ROT0, "Data East Corporation", "Caveman Ninja (World ver 1)", 0 ) | |
| 1797 | GAME( 1991, cninjau, cninja, cninja, cninjau, cninja, ROT0, "Data East Corporation", "Caveman Ninja (US ver 4)", 0 ) | |
| 1798 | GAME( 1991, joemac, cninja, cninja, cninja, cninja, ROT0, "Data East Corporation", "Tatakae Genshizin Joe & Mac (Japan ver 1)", 0 ) | |
| 1835 | 1799 | GAME( 1991, stoneage, cninja, stoneage, cninja, stoneage, ROT0, "bootleg", "Stoneage", 0 ) |
| 1836 | 1800 | GAME( 1991, robocop2, 0, robocop2, robocop2,0, ROT0, "Data East Corporation", "Robocop 2 (Euro/Asia v0.10)", 0 ) |
| 1837 | 1801 | GAME( 1991, robocp2u, robocop2,robocop2, robocop2,0, ROT0, "Data East Corporation", "Robocop 2 (US v0.05)", 0 ) |
| 1838 | 1802 | GAME( 1991, robocp2j, robocop2,robocop2, robocop2,0, ROT0, "Data East Corporation", "Robocop 2 (Japan v0.11)", 0 ) |
| 1839 | GAME( 1992, mutantf, 0, mutantf, mutantf, mutantf, ROT0, "Data East Corporation", "Mutant Fighter (World Rev 4, EM-5)", 0 ) | |
| 1840 | GAME( 1992, mutantfa, mutantf, mutantf, mutantf, mutantf, ROT0, "Data East Corporation", "Mutant Fighter (World Rev 3, EM-4)", 0 ) | |
| 1841 | GAME( 1992, deathbrd, mutantf, mutantf, mutantf, mutantf, ROT0, "Data East Corporation", "Death Brade (Japan Rev 2, JM-3)", 0 ) | |
| 1803 | GAME( 1992, mutantf, 0, mutantf, mutantf, mutantf, ROT0, "Data East Corporation", "Mutant Fighter (World ver EM-5)", 0 ) | |
| 1804 | GAME( 1992, mutantf4, mutantf, mutantf, mutantf, mutantf, ROT0, "Data East Corporation", "Mutant Fighter (World ver EM-4)", 0 ) | |
| 1805 | GAME( 1992, mutantf3, mutantf, mutantf, mutantf, mutantf, ROT0, "Data East Corporation", "Mutant Fighter (World ver EM-3)", 0 ) | |
| 1806 | GAME( 1992, deathbrd, mutantf, mutantf, mutantf, mutantf, ROT0, "Data East Corporation", "Death Brade (Japan ver JM-3)", 0 ) |
| r1478 | r1479 | |
|---|---|---|
| 66 | 66 | 11010101----1010 W xxxxxxxx EXROM2 high 8 bits of address to read from graphics ROMs |
| 67 | 67 | 11010101----1011 W xxxxxxxx EPORT1 command to sound CPU |
| 68 | 68 | 11010101----1100 W -------x EPORT2 single bit signal to audio CPU (not used?) |
| 69 | 11010101----1101 W -------- TIME RESET wat | |
| 69 | 11010101----1101 W -------- TIME RESET wat | |
| 70 | 70 | 11010101----1110 W -------x COIN LOCK coin lockout |
| 71 | 71 | 11010101----1110 W ------x- SOUND STOP mute sound |
| 72 | 72 | 11010101----1110 W -xxxxx-- n.c. |
| r1478 | r1479 | |
|---|---|---|
| 222 | 222 | |
| 223 | 223 | #define VERBOSE_LEVEL ( 0 ) |
| 224 | 224 | |
| 225 | INLINE void verboselog( int n_level, const char *s_fmt, ... ) | |
| 225 | INLINE void ATTR_PRINTF(2,3) verboselog( int n_level, const char *s_fmt, ... ) | |
| 226 | 226 | { |
| 227 | 227 | if( VERBOSE_LEVEL >= n_level ) |
| 228 | 228 | { |
| r1478 | r1479 | |
| 289 | 289 | static READ32_HANDLER( mb89371_r ) |
| 290 | 290 | { |
| 291 | 291 | UINT32 data = 0xffffffff; |
| 292 | verboselog( 2, "mb89371_r %08x %08x\n", offset, mem_mask, data ); | |
| 292 | verboselog( 2, "mb89371_r %08x %08x %08x\n", offset, mem_mask, data ); | |
| 293 | 293 | return data; |
| 294 | 294 | } |
| 295 | 295 | |
| r1478 | r1479 | |
| 2002 | 2002 | break; |
| 2003 | 2003 | } |
| 2004 | 2004 | |
| 2005 | verboselog( 2, "gtrfrks_io_r( %08x, %08x ) %08x\n", data ); | |
| 2005 | verboselog( 2, "gtrfrks_io_r( %08x, %08x ) %08x\n", offset, mem_mask, data ); | |
| 2006 | 2006 | return data; |
| 2007 | 2007 | } |
| 2008 | 2008 | |
| 2009 | 2009 | static WRITE32_HANDLER( gtrfrks_io_w ) |
| 2010 | 2010 | { |
| 2011 | verboselog( 2, "gtrfrks_io_w( %08x, %08x ) %08x\n", data ); | |
| 2011 | verboselog( 2, "gtrfrks_io_w( %08x, %08x ) %08x\n", offset, mem_mask, data ); | |
| 2012 | 2012 | |
| 2013 | 2013 | switch( offset ) |
| 2014 | 2014 | { |
| r1478 | r1479 | |
| 2621 | 2621 | |
| 2622 | 2622 | static WRITE32_HANDLER( dmx_io_w ) |
| 2623 | 2623 | { |
| 2624 | verboselog( 2, "dmx_io_w( %08x, %08x ) %08x\n", data ); | |
| 2624 | verboselog( 2, "dmx_io_w( %08x, %08x ) %08x\n", offset, mem_mask, data ); | |
| 2625 | 2625 | |
| 2626 | 2626 | switch( offset ) |
| 2627 | 2627 | { |
| r1478 | r1479 | |
|---|---|---|
| 12 | 12 | |
| 13 | 13 | **************************************************************************** |
| 14 | 14 | |
| 15 | Note: I'm cheating a little bit with the paddle control. The original | |
| 16 | game handles the paddle control as following. The paddle is a potentiometer. | |
| 17 | Every VBlank signal triggers the start of a voltage ramp. Whenever the | |
| 18 | ramp has the same value as the potentiometer, an NMI is generated. In the | |
| 19 | NMI code, the current scanline value is used to calculate the value to | |
| 20 | put into location $1F in memory. I cheat in this driver by just putting | |
| 21 | the paddle value directly into $1F, which has the same net result. | |
| 15 | To do: | |
| 22 | 16 | |
| 23 | If you have any questions about how this driver works, don't hesitate to | |
| 24 | ask. - Mike Balfour (mab22@po.cwru.edu) | |
| 17 | * Merge with Sprint 1 | |
| 25 | 18 | |
| 26 | CHANGES: | |
| 27 | MAB 05 MAR 99 - changed overlay support to use artwork functions | |
| 19 | **************************************************************************** | |
| 28 | 20 | |
| 21 | Stephh's notes (based on the games M6502 code and some tests) : | |
| 29 | 22 | |
| 30 | Stephh's notes (based on the games M6502 code and some tests) : | |
| 23 | - Each time the game is reset, it is set to "Cavity". | |
| 24 | I can't remember if it's the correct behaviour or not, | |
| 25 | but the VBLANK interruption is not called in "demo mode". | |
| 26 | - You can only select the game after 1st coin is inserted | |
| 27 | and before you press BUTTON1 to launch the first ball, | |
| 28 | then the VBLANK interruption is no more called. | |
| 29 | This means that player 2 plays the same game as player 1. | |
| 31 | 30 | |
| 32 | - Each time the game is reset, it is set to "Cavity". | |
| 33 | I can't remember if it's the correct behaviour or not, | |
| 34 | but the VBLANK interruption is not called in "demo mode". | |
| 35 | - You can only select the game after 1st coin is inserted | |
| 36 | and before you press BUTTON1 to launch the first ball, | |
| 37 | then the VBLANK interruption is no more called. | |
| 38 | This means that player 2 plays the same game as player 1. | |
| 39 | ||
| 40 | 31 | ***************************************************************************/ |
| 41 | 32 | |
| 42 | 33 | #include "driver.h" |
| 43 | 34 | #include "sound/dac.h" |
| 44 | #include "includes/sbrkout.h" | |
| 45 | 35 | |
| 46 | 36 | #include "sbrkout.lh" |
| 47 | 37 | |
| 48 | 38 | |
| 39 | ||
| 49 | 40 | /************************************* |
| 50 | 41 | * |
| 51 | * | |
| 42 | * C | |
| 52 | 43 | * |
| 53 | 44 | *************************************/ |
| 54 | 45 | |
| 55 | #define TIME_4V ATTOTIME_IN_SEC(4075000/4) | |
| 46 | #define MAIN_CLOCK XTAL_12_096MHz | |
| 47 | #define TIME_4V ATTOTIME_IN_HZ(MAIN_CLOCK/2/256/2/4) | |
| 56 | 48 | |
| 57 | static UINT8 *sbrkout_sound; | |
| 58 | 49 | |
| 59 | static WRITE8_HANDLER( sbrkout_dac_w ) | |
| 50 | ||
| 51 | /************************************* | |
| 52 | * | |
| 53 | * Globals | |
| 54 | * | |
| 55 | *************************************/ | |
| 56 | ||
| 57 | static emu_timer *scanline_timer; | |
| 58 | static emu_timer *pot_timer; | |
| 59 | ||
| 60 | static tilemap *bg_tilemap; | |
| 61 | ||
| 62 | static UINT8 sync2_value; | |
| 63 | static UINT8 pot_mask[2]; | |
| 64 | static UINT8 pot_trigger[2]; | |
| 65 | ||
| 66 | ||
| 67 | ||
| 68 | /************************************* | |
| 69 | * | |
| 70 | * Prototypes | |
| 71 | * | |
| 72 | *************************************/ | |
| 73 | ||
| 74 | static TIMER_CALLBACK( scanline_callback ); | |
| 75 | static TIMER_CALLBACK( pot_trigger_callback ); | |
| 76 | ||
| 77 | ||
| 78 | ||
| 79 | /************************************* | |
| 80 | * | |
| 81 | * Machine setup | |
| 82 | * | |
| 83 | *************************************/ | |
| 84 | ||
| 85 | static MACHINE_START( sbrkout ) | |
| 60 | 86 | { |
| 61 | sbrkout_sound[offset]=data; | |
| 87 | memory_set_bankptr(1, &videoram[0x380]); | |
| 88 | scanline_timer = timer_alloc(scanline_callback, NULL); | |
| 89 | pot_timer = timer_alloc(pot_trigger_callback, NULL); | |
| 90 | ||
| 91 | state_save_register_global(sync2_value); | |
| 92 | state_save_register_global_array(pot_mask); | |
| 93 | state_save_register_global_array(pot_trigger); | |
| 62 | 94 | } |
| 63 | 95 | |
| 64 | 96 | |
| 65 | static | |
| 97 | static | |
| 66 | 98 | { |
| 67 | static int vlines=0; | |
| 99 | timer_adjust(scanline_timer, video_screen_get_time_until_pos(0, 0, 0), 0, attotime_never); | |
| 100 | } | |
| 68 | 101 | |
| 69 | if ((*sbrkout_sound) & vlines) | |
| 70 | DAC_data_w(0,255); | |
| 102 | ||
| 103 | ||
| 104 | /************************************* | |
| 105 | * | |
| 106 | * Interrupts | |
| 107 | * | |
| 108 | *************************************/ | |
| 109 | ||
| 110 | static TIMER_CALLBACK( scanline_callback ) | |
| 111 | { | |
| 112 | int scanline = param; | |
| 113 | ||
| 114 | /* force a partial update before anything happens */ | |
| 115 | video_screen_update_partial(0, scanline); | |
| 116 | ||
| 117 | /* if this is a rising edge of 16V, assert the CPU interrupt */ | |
| 118 | if (scanline % 32 == 16) | |
| 119 | cpunum_set_input_line(0, 0, ASSERT_LINE); | |
| 120 | ||
| 121 | /* update the DAC state */ | |
| 122 | DAC_data_w(0, (videoram[0x380 + 0x11] & (scanline >> 2)) ? 255 : 0); | |
| 123 | ||
| 124 | /* on the VBLANK, read the pot and schedule an interrupt time for it */ | |
| 125 | if (scanline == machine->screen[0].visarea.max_y + 1) | |
| 126 | { | |
| 127 | UINT8 potvalue = readinputportbytag("PADDLE"); | |
| 128 | timer_adjust(pot_timer, video_screen_get_time_until_pos(0, 72 + (potvalue / 2), (potvalue % 2) * 128), 0, attotime_never); | |
| 129 | } | |
| 130 | ||
| 131 | /* call us back in 4 scanlines */ | |
| 132 | scanline += 4; | |
| 133 | if (scanline >= machine->screen[0].height) | |
| 134 | scanline = 0; | |
| 135 | timer_adjust(scanline_timer, video_screen_get_time_until_pos(0, scanline, 0), scanline, attotime_never); | |
| 136 | } | |
| 137 | ||
| 138 | ||
| 139 | static WRITE8_HANDLER( irq_ack_w ) | |
| 140 | { | |
| 141 | cpunum_set_input_line(0, 0, CLEAR_LINE); | |
| 142 | } | |
| 143 | ||
| 144 | ||
| 145 | ||
| 146 | /************************************* | |
| 147 | * | |
| 148 | * Inputs | |
| 149 | * | |
| 150 | *************************************/ | |
| 151 | ||
| 152 | static READ8_HANDLER( switches_r ) | |
| 153 | { | |
| 154 | UINT8 result = 0xff; | |
| 155 | ||
| 156 | /* DIP switches are selected by ADR0+ADR1 if ADR3 == 0 */ | |
| 157 | if ((offset & 0x0b) == 0x00) | |
| 158 | result &= (readinputportbytag("DIPS") << 6) | 0x3f; | |
| 159 | if ((offset & 0x0b) == 0x01) | |
| 160 | result &= (readinputportbytag("DIPS") << 4) | 0x3f; | |
| 161 | if ((offset & 0x0b) == 0x02) | |
| 162 | result &= (readinputportbytag("DIPS") << 0) | 0x3f; | |
| 163 | if ((offset & 0x0b) == 0x03) | |
| 164 | result &= (readinputportbytag("DIPS") << 2) | 0x3f; | |
| 165 | ||
| 166 | /* other switches are selected by ADR0+ADR1+ADR2 if ADR4 == 0 */ | |
| 167 | if ((offset & 0x17) == 0x00) | |
| 168 | result &= (readinputportbytag("SELECT") << 7) | 0x7f; | |
| 169 | if ((offset & 0x17) == 0x04) | |
| 170 | result &= ((pot_trigger[0] & ~pot_mask[0]) << 7) | 0x7f; | |
| 171 | if ((offset & 0x17) == 0x05) | |
| 172 | result &= ((pot_trigger[1] & ~pot_mask[1]) << 7) | 0x7f; | |
| 173 | if ((offset & 0x17) == 0x06) | |
| 174 | result &= readinputportbytag("SERVE"); | |
| 175 | if ((offset & 0x17) == 0x07) | |
| 176 | result &= (readinputportbytag("SELECT") << 6) | 0x7f; | |
| 177 | ||
| 178 | return result; | |
| 179 | } | |
| 180 | ||
| 181 | ||
| 182 | static void update_nmi_state(void) | |
| 183 | { | |
| 184 | if ((pot_trigger[0] & ~pot_mask[0]) | (pot_trigger[1] & ~pot_mask[1])) | |
| 185 | cpunum_set_input_line(0, INPUT_LINE_NMI, ASSERT_LINE); | |
| 71 | 186 | else |
| 72 | DAC_data_w(0,0); | |
| 187 | cpunum_set_input_line(0, INPUT_LINE_NMI, CLEAR_LINE); | |
| 188 | } | |
| 73 | 189 | |
| 74 | vlines = (vlines+1) % 16; | |
| 190 | ||
| 191 | static TIMER_CALLBACK( pot_trigger_callback ) | |
| 192 | { | |
| 193 | pot_trigger[param] = 1; | |
| 194 | update_nmi_state(); | |
| 75 | 195 | } |
| 76 | 196 | |
| 77 | 197 | |
| 78 | static | |
| 198 | static WR | |
| 79 | 199 | { |
| 80 | timer_pulse(TIME_4V, NULL, 0, sbrkout_tones_4V); | |
| 200 | pot_mask[0] = ~offset & 1; | |
| 201 | pot_trigger[0] = 0; | |
| 202 | update_nmi_state(); | |
| 81 | 203 | } |
| 82 | 204 | |
| 83 | 205 | |
| 206 | static WRITE8_HANDLER( pot_mask2_w ) | |
| 207 | { | |
| 208 | pot_mask[1] = ~offset & 1; | |
| 209 | pot_trigger[1] = 0; | |
| 210 | update_nmi_state(); | |
| 211 | } | |
| 212 | ||
| 213 | ||
| 214 | ||
| 84 | 215 | /************************************* |
| 85 | 216 | * |
| 86 | * | |
| 217 | * Lamps | |
| 87 | 218 | * |
| 88 | 219 | *************************************/ |
| 89 | 220 | |
| 90 | static PALETTE_INIT( sbrkout ) | |
| 221 | /* | |
| 222 | The LEDs are turned on and off by two consecutive memory addresses. The | |
| 223 | first address turns them off, the second address turns them on. This is | |
| 224 | reversed for the Serve LED, which has a NOT on the signal. | |
| 225 | */ | |
| 226 | ||
| 227 | static WRITE8_HANDLER( start_1_led_w ) | |
| 91 | 228 | { |
| 92 | palette_set_color(machine,0,MAKE_RGB(0x00,0x00,0x00)); | |
| 93 | palette_set_color(machine,1,MAKE_RGB(0xff,0xff,0xff)); | |
| 229 | output_set_led_value(0, offset & 1); | |
| 94 | 230 | } |
| 95 | 231 | |
| 96 | 232 | |
| 233 | static WRITE8_HANDLER( start_2_led_w ) | |
| 234 | { | |
| 235 | output_set_led_value(1, offset & 1); | |
| 236 | } | |
| 97 | 237 | |
| 238 | ||
| 239 | static WRITE8_HANDLER( serve_led_w ) | |
| 240 | { | |
| 241 | output_set_led_value(0, ~offset & 1); | |
| 242 | } | |
| 243 | ||
| 244 | ||
| 245 | static WRITE8_HANDLER( coincount_w ) | |
| 246 | { | |
| 247 | coin_counter_w(0, offset & 1); | |
| 248 | } | |
| 249 | ||
| 250 | ||
| 251 | ||
| 98 | 252 | /************************************* |
| 99 | 253 | * |
| 100 | * | |
| 254 | * V | |
| 101 | 255 | * |
| 102 | 256 | *************************************/ |
| 103 | 257 | |
| 104 | static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 105 | AM_RANGE(0x001f, 0x001f) AM_READ(input_port_6_r) /* paddle value */ | |
| 106 | AM_RANGE(0x0000, 0x00ff) AM_READ(MRA8_RAM) /* Zero Page RAM */ | |
| 107 | AM_RANGE(0x0100, 0x01ff) AM_READ(MRA8_RAM) /* ??? */ | |
| 108 | AM_RANGE(0x0400, 0x077f) AM_READ(MRA8_RAM) /* Video Display RAM */ | |
| 109 | AM_RANGE(0x0828, 0x0828) AM_READ(sbrkout_select1_r) /* Select 1 */ | |
| 110 | AM_RANGE(0x082f, 0x082f) AM_READ(sbrkout_select2_r) /* Select 2 */ | |
| 111 | AM_RANGE(0x082e, 0x082e) AM_READ(input_port_5_r) /* Serve Switch */ | |
| 112 | AM_RANGE(0x0830, 0x0833) AM_READ(sbrkout_read_DIPs_r) /* DIP Switches */ | |
| 113 | AM_RANGE(0x0840, 0x0840) AM_READ(input_port_1_r) /* Coin Switches */ | |
| 114 | AM_RANGE(0x0880, 0x0880) AM_READ(input_port_2_r) /* Start Switches */ | |
| 115 | AM_RANGE(0x08c0, 0x08c0) AM_READ(input_port_3_r) /* Self Test Switch */ | |
| 116 | AM_RANGE(0x0c00, 0x0c00) AM_READ(input_port_4_r) /* Vertical Sync Counter */ | |
| 117 | AM_RANGE(0x2c00, 0x3fff) AM_READ(MRA8_ROM) /* PROGRAM */ | |
| 118 | AM_RANGE(0xfff0, 0xffff) AM_READ(MRA8_ROM) /* PROM8 for 6502 vectors */ | |
| 119 | ADDRESS_MAP_END | |
| 258 | static READ8_HANDLER( sync_r ) | |
| 259 | { | |
| 260 | int hpos = video_screen_get_hpos(0); | |
| 261 | sync2_value = (hpos >= 128 && hpos <= Machine->screen[0].visarea.max_x); | |
| 262 | return video_screen_get_vpos(0); | |
| 263 | } | |
| 120 | 264 | |
| 121 | 265 | |
| 122 | static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 123 | AM_RANGE(0x0011, 0x0011) AM_WRITE(sbrkout_dac_w) AM_BASE(&sbrkout_sound) /* Noise Generation Bits */ | |
| 124 | AM_RANGE(0x0010, 0x0014) AM_WRITE(MWA8_RAM) AM_BASE(&sbrkout_horiz_ram) /* Horizontal Ball Position */ | |
| 125 | AM_RANGE(0x0018, 0x001d) AM_WRITE(MWA8_RAM) AM_BASE(&sbrkout_vert_ram) /* Vertical Ball Position / ball picture */ | |
| 126 | AM_RANGE(0x0000, 0x00ff) AM_WRITE(MWA8_RAM) /* WRAM */ | |
| 127 | AM_RANGE(0x0100, 0x01ff) AM_WRITE(MWA8_RAM) /* ??? */ | |
| 128 | AM_RANGE(0x0400, 0x07ff) AM_WRITE(sbrkout_videoram_w) AM_BASE(&videoram) /* DISPLAY */ | |
| 129 | AM_RANGE(0x0c10, 0x0c11) AM_WRITE(sbrkout_serve_led_w) /* Serve LED */ | |
| 130 | AM_RANGE(0x0c30, 0x0c31) AM_WRITE(sbrkout_start_1_led_w) /* 1 Player Start Light */ | |
| 131 | AM_RANGE(0x0c40, 0x0c41) AM_WRITE(sbrkout_start_2_led_w) /* 2 Player Start Light */ | |
| 132 | AM_RANGE(0x0c50, 0x0c51) AM_WRITE(MWA8_RAM) /* NMI Pot Reading Enable */ | |
| 133 | AM_RANGE(0x0c70, 0x0c71) AM_WRITE(MWA8_RAM) /* Coin Counter */ | |
| 134 | AM_RANGE(0x0c80, 0x0c80) AM_WRITE(MWA8_NOP) /* Watchdog */ | |
| 135 | AM_RANGE(0x0e00, 0x0e00) AM_WRITE(MWA8_NOP) /* IRQ Enable? */ | |
| 136 | AM_RANGE(0x1000, 0x1000) AM_WRITE(MWA8_RAM) /* LSB of Pot Reading */ | |
| 137 | AM_RANGE(0x2c00, 0x3fff) AM_WRITE(MWA8_ROM) /* PROM1-PROM8 */ | |
| 266 | static READ8_HANDLER( sync2_r ) | |
| 267 | { | |
| 268 | return (sync2_value << 7) | 0x7f; | |
| 269 | } | |
| 270 | ||
| 271 | ||
| 272 | ||
| 273 | /************************************* | |
| 274 | * | |
| 275 | * Background tilemap | |
| 276 | * | |
| 277 | *************************************/ | |
| 278 | ||
| 279 | static TILE_GET_INFO( get_bg_tile_info ) | |
| 280 | { | |
| 281 | int code = (videoram[tile_index] & 0x80) ? videoram[tile_index] : 0; | |
| 282 | SET_TILE_INFO(0, code, 0, 0); | |
| 283 | } | |
| 284 | ||
| 285 | ||
| 286 | static VIDEO_START( sbrkout ) | |
| 287 | { | |
| 288 | bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, TILEMAP_TYPE_PEN, 8, 8, 32, 32); | |
| 289 | } | |
| 290 | ||
| 291 | ||
| 292 | static WRITE8_HANDLER( sbrkout_videoram_w ) | |
| 293 | { | |
| 294 | videoram[offset] = data; | |
| 295 | tilemap_mark_tile_dirty(bg_tilemap, offset); | |
| 296 | } | |
| 297 | ||
| 298 | ||
| 299 | ||
| 300 | /************************************* | |
| 301 | * | |
| 302 | * Video update | |
| 303 | * | |
| 304 | *************************************/ | |
| 305 | ||
| 306 | static VIDEO_UPDATE( sbrkout ) | |
| 307 | { | |
| 308 | int ball; | |
| 309 | ||
| 310 | tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); | |
| 311 | ||
| 312 | for (ball = 2; ball >= 0; ball--) | |
| 313 | { | |
| 314 | int code = ((videoram[0x380 + 0x18 + ball * 2 + 1] & 0x80) >> 7); | |
| 315 | int sx = 31 * 8 - videoram[0x380 + 0x10 + ball * 2]; | |
| 316 | int sy = 30 * 8 - videoram[0x380 + 0x18 + ball * 2]; | |
| 317 | ||
| 318 | drawgfx(bitmap, machine->gfx[1], code, 0, 0, 0, sx, sy, cliprect, TRANSPARENCY_PEN, 0); | |
| 319 | } | |
| 320 | return 0; | |
| 321 | } | |
| 322 | ||
| 323 | ||
| 324 | ||
| 325 | /************************************* | |
| 326 | * | |
| 327 | * Main CPU memory handlers | |
| 328 | * | |
| 329 | *************************************/ | |
| 330 | ||
| 331 | /* full memory map derived from schematics */ | |
| 332 | static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 333 | ADDRESS_MAP_FLAGS( AMEF_ABITS(14) ) | |
| 334 | AM_RANGE(0x0000, 0x007f) AM_MIRROR(0x380) AM_RAMBANK(1) | |
| 335 | AM_RANGE(0x0400, 0x07ff) AM_READWRITE(MRA8_RAM, sbrkout_videoram_w) AM_BASE(&videoram) | |
| 336 | AM_RANGE(0x0800, 0x083f) AM_READ(switches_r) | |
| 337 | AM_RANGE(0x0840, 0x0840) AM_MIRROR(0x003f) AM_READ_PORT("COIN") | |
| 338 | AM_RANGE(0x0880, 0x0880) AM_MIRROR(0x003f) AM_READ_PORT("START") | |
| 339 | AM_RANGE(0x08c0, 0x08c0) AM_MIRROR(0x003f) AM_READ_PORT("SERVICE") | |
| 340 | AM_RANGE(0x0c00, 0x0c00) AM_MIRROR(0x03ff) AM_READ(sync_r) | |
| 341 | AM_RANGE(0x0c10, 0x0c11) AM_MIRROR(0x000e) AM_WRITE(serve_led_w) | |
| 342 | AM_RANGE(0x0c30, 0x0c31) AM_MIRROR(0x000e) AM_WRITE(start_1_led_w) | |
| 343 | AM_RANGE(0x0c40, 0x0c41) AM_MIRROR(0x000e) AM_WRITE(start_2_led_w) | |
| 344 | AM_RANGE(0x0c50, 0x0c51) AM_MIRROR(0x000e) AM_WRITE(pot_mask1_w) | |
| 345 | AM_RANGE(0x0c60, 0x0c61) AM_MIRROR(0x000e) AM_WRITE(pot_mask2_w) | |
| 346 | AM_RANGE(0x0c70, 0x0c71) AM_MIRROR(0x000e) AM_WRITE(coincount_w) | |
| 347 | AM_RANGE(0x0c80, 0x0c80) AM_MIRROR(0x007f) AM_WRITE(watchdog_reset_w) | |
| 348 | AM_RANGE(0x0e00, 0x0e00) AM_MIRROR(0x007f) AM_WRITE(irq_ack_w) | |
| 349 | AM_RANGE(0x1000, 0x1000) AM_MIRROR(0x03ff) AM_READ(sync2_r) | |
| 350 | AM_RANGE(0x2800, 0x3fff) AM_ROM | |
| 138 | 351 | ADDRESS_MAP_END |
| 139 | 352 | |
| 140 | 353 | |
| r1478 | r1479 | |
| 146 | 359 | *************************************/ |
| 147 | 360 | |
| 148 | 361 | static INPUT_PORTS_START( sbrkout ) |
| 149 | PORT_START | |
| 362 | PORT_START_TAG("DIPS") | |
| 150 | 363 | PORT_DIPNAME( 0x03, 0x00, DEF_STR( Language ) ) |
| 151 | 364 | PORT_DIPSETTING( 0x00, DEF_STR( English ) ) |
| 152 | 365 | PORT_DIPSETTING( 0x01, DEF_STR( German ) ) |
| 153 | 366 | PORT_DIPSETTING( 0x02, DEF_STR( French ) ) |
| 154 | 367 | PORT_DIPSETTING( 0x03, DEF_STR( Spanish ) ) |
| 155 | PORT_DIPNAME( 0x0C, 0x08, DEF_STR( Coinage ) ) | |
| 156 | PORT_DIPSETTING( 0x0C, DEF_STR( 2C_1C ) ) | |
| 368 | PORT_DIPNAME( 0x0c, 0x08, DEF_STR( Coinage ) ) | |
| 369 | PORT_DIPSETTING( 0x0c, DEF_STR( 2C_1C ) ) | |
| 157 | 370 | PORT_DIPSETTING( 0x08, DEF_STR( 1C_1C ) ) |
| 158 | 371 | PORT_DIPSETTING( 0x04, DEF_STR( 1C_2C ) ) |
| 159 | 372 | PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) ) |
| 160 | 373 | PORT_DIPNAME( 0x70, 0x00, "Extended Play" ) |
| 161 | 374 | /* Progressive */ |
| 162 | PORT_DIPSETTING( 0x10, "200" ) PORT_CONDITION("SELECT",0x07,PORTCOND_EQUALS,0x01) | |
| 163 | PORT_DIPSETTING( 0x20, "400" ) PORT_CONDITION("SELECT",0x07,PORTCOND_EQUALS,0x01) | |
| 164 | PORT_DIPSETTING( 0x30, "600" ) PORT_CONDITION("SELECT",0x07,PORTCOND_EQUALS,0x01) | |
| 165 | PORT_DIPSETTING( 0x40, "900" ) PORT_CONDITION("SELECT",0x07,PORTCOND_EQUALS,0x01) | |
| 166 | PORT_DIPSETTING( 0x50, "1200" ) PORT_CONDITION("SELECT",0x07,PORTCOND_EQUALS,0x01) | |
| 167 | PORT_DIPSETTING( 0x60, "1600" ) PORT_CONDITION("SELECT",0x07,PORTCOND_EQUALS,0x01) | |
| 168 | PORT_DIPSETTING( 0x70, "2000" ) PORT_CONDITION("SELECT",0x07,PORTCOND_EQUALS,0x01) | |
| 375 | PORT_DIPSETTING( 0x10, "200" ) PORT_CONDITION("SELECT",0x03,PORTCOND_EQUALS,0x00) | |
| 376 | PORT_DIPSETTING( 0x20, "400" ) PORT_CONDITION("SELECT",0x03,PORTCOND_EQUALS,0x00) | |
| 377 | PORT_DIPSETTING( 0x30, "600" ) PORT_CONDITION("SELECT",0x03,PORTCOND_EQUALS,0x00) | |
| 378 | PORT_DIPSETTING( 0x40, "900" ) PORT_CONDITION("SELECT",0x03,PORTCOND_EQUALS,0x00) | |
| 379 | PORT_DIPSETTING( 0x50, "1200" ) PORT_CONDITION("SELECT",0x03,PORTCOND_EQUALS,0x00) | |
| 380 | PORT_DIPSETTING( 0x60, "1600" ) PORT_CONDITION("SELECT",0x03,PORTCOND_EQUALS,0x00) | |
| 381 | PORT_DIPSETTING( 0x70, "2000" ) PORT_CONDITION("SELECT",0x03,PORTCOND_EQUALS,0x00) | |
| 169 | 382 | /* Double */ |
| 170 | PORT_DIPSETTING( 0x10, "200" ) PORT_CONDITION("SELECT",0x07,PORTCOND_EQUALS,0x02) | |
| 171 | PORT_DIPSETTING( 0x20, "400" ) PORT_CONDITION("SELECT",0x07,PORTCOND_EQUALS,0x02) | |
| 172 | PORT_DIPSETTING( 0x30, "600" ) PORT_CONDITION("SELECT",0x07,PORTCOND_EQUALS,0x02) | |
| 173 | PORT_DIPSETTING( 0x40, "800" ) PORT_CONDITION("SELECT",0x07,PORTCOND_EQUALS,0x02) | |
| 174 | PORT_DIPSETTING( 0x50, "1000" ) PORT_CONDITION("SELECT",0x07,PORTCOND_EQUALS,0x02) | |
| 175 | PORT_DIPSETTING( 0x60, "1200" ) PORT_CONDITION("SELECT",0x07,PORTCOND_EQUALS,0x02) | |
| 176 | PORT_DIPSETTING( 0x70, "1500" ) PORT_CONDITION("SELECT",0x07,PORTCOND_EQUALS,0x02) | |
| 383 | PORT_DIPSETTING( 0x10, "200" ) PORT_CONDITION("SELECT",0x03,PORTCOND_EQUALS,0x02) | |
| 384 | PORT_DIPSETTING( 0x20, "400" ) PORT_CONDITION("SELECT",0x03,PORTCOND_EQUALS,0x02) | |
| 385 | PORT_DIPSETTING( 0x30, "600" ) PORT_CONDITION("SELECT",0x03,PORTCOND_EQUALS,0x02) | |
| 386 | PORT_DIPSETTING( 0x40, "800" ) PORT_CONDITION("SELECT",0x03,PORTCOND_EQUALS,0x02) | |
| 387 | PORT_DIPSETTING( 0x50, "1000" ) PORT_CONDITION("SELECT",0x03,PORTCOND_EQUALS,0x02) | |
| 388 | PORT_DIPSETTING( 0x60, "1200" ) PORT_CONDITION("SELECT",0x03,PORTCOND_EQUALS,0x02) | |
| 389 | PORT_DIPSETTING( 0x70, "1500" ) PORT_CONDITION("SELECT",0x03,PORTCOND_EQUALS,0x02) | |
| 177 | 390 | /* Cavity */ |
| 178 | PORT_DIPSETTING( 0x10, "200" ) PORT_CONDITION("SELECT",0x07,PORTCOND_EQUALS,0x04) | |
| 179 | PORT_DIPSETTING( 0x20, "300" ) PORT_CONDITION("SELECT",0x07,PORTCOND_EQUALS,0x04) | |
| 180 | PORT_DIPSETTING( 0x30, "400" ) PORT_CONDITION("SELECT",0x07,PORTCOND_EQUALS,0x04) | |
| 181 | PORT_DIPSETTING( 0x40, "700" ) PORT_CONDITION("SELECT",0x07,PORTCOND_EQUALS,0x04) | |
| 182 | PORT_DIPSETTING( 0x50, "900" ) PORT_CONDITION("SELECT",0x07,PORTCOND_EQUALS,0x04) | |
| 183 | PORT_DIPSETTING( 0x60, "1100" ) PORT_CONDITION("SELECT",0x07,PORTCOND_EQUALS,0x04) | |
| 184 | PORT_DIPSETTING( 0x70, "1400" ) PORT_CONDITION("SELECT",0x07,PORTCOND_EQUALS,0x04) | |
| 391 | PORT_DIPSETTING( 0x10, "200" ) PORT_CONDITION("SELECT",0x03,PORTCOND_EQUALS,0x01) | |
| 392 | PORT_DIPSETTING( 0x20, "300" ) PORT_CONDITION("SELECT",0x03,PORTCOND_EQUALS,0x01) | |
| 393 | PORT_DIPSETTING( 0x30, "400" ) PORT_CONDITION("SELECT",0x03,PORTCOND_EQUALS,0x01) | |
| 394 | PORT_DIPSETTING( 0x40, "700" ) PORT_CONDITION("SELECT",0x03,PORTCOND_EQUALS,0x01) | |
| 395 | PORT_DIPSETTING( 0x50, "900" ) PORT_CONDITION("SELECT",0x03,PORTCOND_EQUALS,0x01) | |
| 396 | PORT_DIPSETTING( 0x60, "1100" ) PORT_CONDITION("SELECT",0x03,PORTCOND_EQUALS,0x01) | |
| 397 | PORT_DIPSETTING( 0x70, "1400" ) PORT_CONDITION("SELECT",0x03,PORTCOND_EQUALS,0x01) | |
| 185 | 398 | PORT_DIPSETTING( 0x00, DEF_STR( None ) ) |
| 186 | 399 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Lives ) ) |
| 187 | 400 | PORT_DIPSETTING( 0x80, "3" ) |
| 188 | 401 | PORT_DIPSETTING( 0x00, "5" ) |
| 189 | 402 | |
| 190 | PORT_START /* IN0 */ | |
| 191 | PORT_BIT ( 0x40, IP_ACTIVE_HIGH, IPT_COIN1 ) | |
| 192 | PORT_BIT ( 0x80, IP_ACTIVE_HIGH, IPT_COIN2 ) | |
| 403 | PORT_START_TAG("COIN") | |
| 404 | PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 405 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN1 ) | |
| 406 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN2 ) | |
| 193 | 407 | |
| 194 | PORT_START /* IN1 */ | |
| 195 | PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_START1 ) | |
| 196 | PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_START2 ) | |
| 408 | PORT_START_TAG("START") | |
| 409 | PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 410 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 ) | |
| 411 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 ) | |
| 197 | 412 | |
| 198 | PORT_START /* IN2 */ | |
| 199 | PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_TILT ) | |
| 413 | PORT_START_TAG("SERVICE") | |
| 414 | PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 415 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_TILT ) | |
| 200 | 416 | PORT_SERVICE( 0x80, IP_ACTIVE_LOW ) |
| 201 | 417 | |
| 202 | PORT_START /* IN3 */ | |
| 203 | PORT_BIT ( 0xFF, IP_ACTIVE_LOW, IPT_VBLANK ) | |
| 418 | PORT_START_TAG("SERVE") | |
| 419 | PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 420 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 ) | |
| 204 | 421 | |
| 205 | PORT_START /* IN4 */ | |
| 206 | PORT_BIT ( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 ) | |
| 422 | PORT_START_TAG("PADDLE") | |
| 423 | PORT_BIT( 0xff, 0x00, IPT_PADDLE ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) | |
| 207 | 424 | |
| 208 | PORT_START /* IN5 */ | |
| 209 | PORT_BIT( 0xff, 0x00, IPT_PADDLE ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_REVERSE | |
| 210 | ||
| 211 | 425 | PORT_START_TAG("SELECT") /* IN6 - fake port, used to set the game select dial */ |
| 212 | PORT_CONFNAME( 0x07, 0x01, "Game Select" ) | |
| 213 | PORT_CONFSETTING( 0x01, "Progressive" ) | |
| 426 | PORT_CONFNAME( 0x03, 0x00, "Game Select" ) | |
| 427 | PORT_CONFSETTING( 0x00, "Progressive" ) | |
| 214 | 428 | PORT_CONFSETTING( 0x02, "Double" ) |
| 215 | PORT_CONFSETTING( 0x0 | |
| 429 | PORT_CONFSETTING( 0x01, "Cavity" ) | |
| 216 | 430 | INPUT_PORTS_END |
| 217 | 431 | |
| 218 | 432 | |
| r1478 | r1479 | |
| 263 | 477 | static MACHINE_DRIVER_START( sbrkout ) |
| 264 | 478 | |
| 265 | 479 | /* basic machine hardware */ |
| 266 | MDRV_CPU_ADD(M6502,375000) /* 375 KHz? Should be 750KHz? */ | |
| 267 | MDRV_CPU_PROGRAM_MAP(readmem,writemem) | |
| 268 | MDRV_CPU_VBLANK_INT(sbrkout_interrupt,1) | |
| 480 | MDRV_CPU_ADD(M6502,MAIN_CLOCK/16) /* 375 KHz? Should be 750KHz? */ | |
| 481 | MDRV_CPU_PROGRAM_MAP(main_map,0) | |
| 269 | 482 | |
| 270 | MDRV_SCREEN_REFRESH_RATE(60) | |
| 271 | MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION) | |
| 272 | ||
| 483 | MDRV_MACHINE_START(sbrkout) | |
| 273 | 484 | MDRV_MACHINE_RESET(sbrkout) |
| 485 | MDRV_WATCHDOG_VBLANK_INIT(8) | |
| 274 | 486 | |
| 275 | 487 | /* video hardware */ |
| 276 | 488 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| 277 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) | |
| 278 | MDRV_SCREEN_SIZE(32*8, 28*8) | |
| 279 | MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 28*8-1) | |
| 280 | 489 | MDRV_GFXDECODE(sbrkout) |
| 281 | 490 | MDRV_PALETTE_LENGTH(2) |
| 282 | 491 | |
| 283 | MDRV_PALETTE_INIT(sbrkout) | |
| 492 | MDRV_SCREEN_ADD("main", 0) | |
| 493 | MDRV_SCREEN_RAW_PARAMS(MAIN_CLOCK/2, 384, 0, 256, 262, 0, 224) | |
| 494 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) | |
| 495 | ||
| 496 | MDRV_PALETTE_INIT(black_and_white) | |
| 284 | 497 | MDRV_VIDEO_START(sbrkout) |
| 285 | 498 | MDRV_VIDEO_UPDATE(sbrkout) |
| 286 | 499 | |
| 287 | 500 | /* sound hardware */ |
| 288 | 501 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 289 | ||
| 290 | 502 | MDRV_SOUND_ADD(DAC, 0) |
| 291 | 503 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 292 | 504 | MACHINE_DRIVER_END |
| r1478 | r1479 | |
| 300 | 512 | *************************************/ |
| 301 | 513 | |
| 302 | 514 | ROM_START( sbrkout ) |
| 303 | ROM_REGION( 0x | |
| 515 | ROM_REGION( 0x4 | |
| 304 | 516 | ROM_LOAD( "033453.c1", 0x2800, 0x0800, CRC(a35d00e3) SHA1(53617ed1d362e82d6f45abd66056bffe23300e3b) ) |
| 305 | 517 | ROM_LOAD( "033454.d1", 0x3000, 0x0800, CRC(d42ea79a) SHA1(66c9b29226cde36d1ac6d1e81f34ebb5c79eded4) ) |
| 306 | 518 | ROM_LOAD( "033455.e1", 0x3800, 0x0800, CRC(e0a6871c) SHA1(1bdfa73d7b8d91e1c68b7847fc310cac314ee02d) ) |
| 307 | ROM_RELOAD( 0xf800, 0x0800 ) | |
| 308 | 519 | |
| 309 | 520 | ROM_REGION( 0x0400, REGION_GFX1, ROMREGION_DISPOSE ) |
| 310 | 521 | ROM_LOAD( "033280.p4", 0x0000, 0x0200, CRC(5a69ce85) SHA1(ad9078d12495c350738bdb0b1e1b6120d9e01f60) ) |
| r1478 | r1479 | |
| 315 | 526 | |
| 316 | 527 | ROM_REGION( 0x0120, REGION_PROMS, 0 ) |
| 317 | 528 | ROM_LOAD( "006400.m2", 0x0000, 0x0100, CRC(b8094b4c) SHA1(82dc6799a19984f3b204ee3aeeb007e55afc8be3) ) /* sync (not used) */ |
| 318 | ROM_LOAD( "006401.e2", 0x0100, 0x0020, CRC(857df8db) SHA1(06313d5bde03220b2bc313d18e50e4bb1d0cfbbb) ) /* | |
| 529 | ROM_LOAD( "006401.e2", 0x0100, 0x0020, CRC(857df8db) SHA1(06313d5bde03220b2bc313d18e50e4bb1d0cfbbb) ) /* mem | |
| 319 | 530 | ROM_END |
| 320 | 531 | |
| 321 | 532 | |
| r1478 | r1479 | |
| 326 | 537 | * |
| 327 | 538 | *************************************/ |
| 328 | 539 | |
| 329 | GAMEL( 1978, sbrkout, 0, sbrkout, sbrkout, 0, ROT270, "Atari", "Super Breakout", | |
| 540 | GAMEL( 1978, sbrkout, 0, sbrkout, sbrkout, 0, ROT270, "Atari", "Super Breakout", GAME_SUPPORTS_SAVE, layout_sbrkout ) |
| r1478 | r1479 | |
|---|---|---|
| 1009 | 1009 | // xp = (param1 & 0x00f0) >> 4; |
| 1010 | 1010 | // yp = (param1 & 0x0f00) >> 8; |
| 1011 | 1011 | |
| 1012 | // | |
| 1012 | // | |
| 1013 | 1013 | |
| 1014 | 1014 | xp = 0; |
| 1015 | 1015 | yp = 0; |
| r1478 | r1479 | |
| 1172 | 1172 | case (0x420/2): |
| 1173 | 1173 | { |
| 1174 | 1174 | //coin counter write |
| 1175 | // | |
| 1175 | // | |
| 1176 | 1176 | prot_bcd[0] = protection_bcd_jsr(mcu_ram[offset]); |
| 1177 | 1177 | //prot_bcd = mcu_ram[offset] - 0x22; |
| 1178 | 1178 | break; |
| r1478 | r1479 | |
| 1205 | 1205 | break; |
| 1206 | 1206 | case 0x4100: break; |
| 1207 | 1207 | case 0x41c0: break; |
| 1208 | //default: | |
| 1208 | //default: | |
| 1209 | 1209 | } |
| 1210 | 1210 | break; |
| 1211 | 1211 | } |
| r1478 | r1479 | |
| 1471 | 1471 | if(offset > (0x500/2) && offset < (0x600/2)) |
| 1472 | 1472 | { |
| 1473 | 1473 | logerror("CPU0 PC %06x MCU read offset: %04x\n",activecpu_get_previouspc(),offset*2); |
| 1474 | // | |
| 1474 | // | |
| 1475 | 1475 | } |
| 1476 | 1476 | |
| 1477 | 1477 | return mcu_ram[offset]; |
| r1478 | r1479 | |
| 1501 | 1501 | break; |
| 1502 | 1502 | case 0x4100: break; |
| 1503 | 1503 | case 0x41c0: break; |
| 1504 | //default: | |
| 1504 | //default: | |
| 1505 | 1505 | } |
| 1506 | 1506 | break; |
| 1507 | 1507 | } |
| r1478 | r1479 | |
| 1614 | 1614 | case (0x420/2): |
| 1615 | 1615 | { |
| 1616 | 1616 | //coin counter write |
| 1617 | // | |
| 1617 | // | |
| 1618 | 1618 | prot_bcd[0] = protection_bcd_jsr(mcu_ram[offset]); |
| 1619 | 1619 | //prot_bcd = mcu_ram[offset] - 0x22; |
| 1620 | 1620 | break; |
| r1478 | r1479 | |
| 1656 | 1656 | { |
| 1657 | 1657 | case 0xa180:/*do the job [1]*/ |
| 1658 | 1658 | { |
| 1659 | // | |
| 1659 | // | |
| 1660 | 1660 | /*fix the offset for easier reading*/ |
| 1661 | 1661 | dma_src+=4; |
| 1662 | 1662 | //dma_dst+=4; |
| r1478 | r1479 | |
| 1842 | 1842 | |
| 1843 | 1843 | // default: |
| 1844 | 1844 | // logerror("CPU0 PC %06x MCU write offset: %04x data: %04x\n",activecpu_get_previouspc(),offset*2,data); |
| 1845 | // | |
| 1845 | // | |
| 1846 | 1846 | } |
| 1847 | 1847 | } |
| 1848 | 1848 |
| r1478 | r1479 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | TODO: | |
| 4 | - combine memory maps | |
| 5 | - discrete sound | |
| 6 | - combine sh_* writes into one routine | |
| 7 | ||
| 8 | Done: | |
| 9 | - fixed mario0110u1gre | |
| 10 | - rewrote driver, separate MACHINE_DRIVER(mario_audio) | |
| 11 | - palette from schematics | |
| 12 | - video timing from schematics | |
| 13 | - driver configuration switch Nintendo/Std Monitor | |
| 14 | - got rid of COLORTABLE | |
| 15 | - clocks as defines in .h | |
| 16 | - use XTAL_* | |
| 17 | ||
| 3 | 18 | Mario Bros memory map (preliminary): |
| 4 | 19 | |
| 5 | 20 | driver by Mirko Buffoni |
| r1478 | r1479 | |
| 69 | 84 | ***************************************************************************/ |
| 70 | 85 | |
| 71 | 86 | #include "driver.h" |
| 72 | #include "cpu/i8039/i8039.h" | |
| 73 | #include "sound/dac.h" | |
| 74 | #include "sound/ay8910.h" | |
| 75 | #include "sound/samples.h" | |
| 76 | 87 | |
| 77 | static UINT8 p[8] = { 0,0xf0,0,0,0,0,0,0 }; | |
| 78 | static UINT8 t[2] = { 0,0 }; | |
| 88 | #include "mario.h" | |
| 79 | 89 | |
| 80 | static UINT8 last; | |
| 90 | /************************************* | |
| 91 | * | |
| 92 | * Main CPU memory handlers | |
| 93 | * | |
| 94 | *************************************/ | |
| 81 | 95 | |
| 82 | ||
| 83 | extern WRITE8_HANDLER( mario_videoram_w ); | |
| 84 | extern WRITE8_HANDLER( mario_gfxbank_w ); | |
| 85 | extern WRITE8_HANDLER( mario_palettebank_w ); | |
| 86 | extern WRITE8_HANDLER( mario_scroll_w ); | |
| 87 | ||
| 88 | extern PALETTE_INIT( mario ); | |
| 89 | extern VIDEO_START( mario ); | |
| 90 | extern VIDEO_UPDATE( mario ); | |
| 91 | ||
| 92 | /* | |
| 93 | * from audio/mario.c | |
| 94 | */ | |
| 95 | extern WRITE8_HANDLER( mario_sh_w ); | |
| 96 | extern WRITE8_HANDLER( mario_sh1_w ); | |
| 97 | extern WRITE8_HANDLER( mario_sh2_w ); | |
| 98 | extern WRITE8_HANDLER( mario_sh3_w ); | |
| 99 | ||
| 100 | ||
| 101 | static MACHINE_START( mario ) | |
| 102 | { | |
| 103 | state_save_register_global_array(p); | |
| 104 | state_save_register_global_array(t); | |
| 105 | state_save_register_global(last); | |
| 106 | } | |
| 107 | ||
| 108 | ||
| 109 | #define ACTIVELOW_PORT_BIT(P,A,D) ((P & (~(1 << A))) | ((D ^ 1) << A)) | |
| 110 | #define ACTIVEHIGH_PORT_BIT(P,A,D) ((P & (~(1 << A))) | (D << A)) | |
| 111 | ||
| 112 | ||
| 113 | static WRITE8_HANDLER( mario_sh_getcoin_w ) { t[0] = data; } | |
| 114 | static WRITE8_HANDLER( mario_sh_crab_w ) { p[1] = ACTIVEHIGH_PORT_BIT(p[1],0,data); } | |
| 115 | static WRITE8_HANDLER( mario_sh_turtle_w ) { p[1] = ACTIVEHIGH_PORT_BIT(p[1],1,data); } | |
| 116 | static WRITE8_HANDLER( mario_sh_fly_w ) { p[1] = ACTIVEHIGH_PORT_BIT(p[1],2,data); } | |
| 117 | static WRITE8_HANDLER( mario_sh_tuneselect_w ) { soundlatch_w(offset,data); } | |
| 118 | ||
| 119 | static READ8_HANDLER( mario_sh_p1_r ) { return p[1]; } | |
| 120 | static READ8_HANDLER( mario_sh_p2_r ) { return p[2]; } | |
| 121 | static READ8_HANDLER( mario_sh_t0_r ) { return t[0]; } | |
| 122 | static READ8_HANDLER( mario_sh_t1_r ) { return t[1]; } | |
| 123 | static READ8_HANDLER( mario_sh_tune_r ) { return soundlatch_r(offset); } | |
| 124 | ||
| 125 | static WRITE8_HANDLER( mario_sh_sound_w ) | |
| 126 | { | |
| 127 | DAC_data_w(0,data); | |
| 128 | } | |
| 129 | static WRITE8_HANDLER( mario_sh_p1_w ) | |
| 130 | { | |
| 131 | p[1] = data; | |
| 132 | } | |
| 133 | static WRITE8_HANDLER( mario_sh_p2_w ) | |
| 134 | { | |
| 135 | p[2] = data; | |
| 136 | } | |
| 137 | static WRITE8_HANDLER( masao_sh_irqtrigger_w ) | |
| 138 | { | |
| 139 | if (last == 1 && data == 0) | |
| 140 | { | |
| 141 | /* setting bit 0 high then low triggers IRQ on the sound CPU */ | |
| 142 | cpunum_set_input_line_and_vector(1,0,HOLD_LINE,0xff); | |
| 143 | } | |
| 144 | ||
| 145 | last = data; | |
| 146 | } | |
| 147 | ||
| 148 | 96 | static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) |
| 149 | 97 | AM_RANGE(0x0000, 0x5fff) AM_READ(MRA8_ROM) |
| 150 | 98 | AM_RANGE(0x6000, 0x6fff) AM_READ(MRA8_RAM) |
| r1478 | r1479 | |
| 198 | 146 | |
| 199 | 147 | static ADDRESS_MAP_START( mario_writeport, ADDRESS_SPACE_IO, 8 ) |
| 200 | 148 | ADDRESS_MAP_FLAGS( AMEF_ABITS(8) ) |
| 201 | AM_RANGE(0x00, 0x00) AM_WRITE(MWA8_NOP) /* | |
| 149 | AM_RANGE(0x00, 0x00) AM_WRITE(MWA8_NOP) /*Z80 DMA | |
| 202 | 150 | ADDRESS_MAP_END |
| 203 | 151 | |
| 152 | /************************************* | |
| 153 | * | |
| 154 | * Port definitions | |
| 155 | * | |
| 156 | *************************************/ | |
| 204 | 157 | |
| 205 | static ADDRESS_MAP_START( readmem_sound, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 206 | AM_RANGE(0x0000, 0x0fff) AM_READ(MRA8_ROM) | |
| 207 | ADDRESS_MAP_END | |
| 208 | ||
| 209 | static ADDRESS_MAP_START( writemem_sound, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 210 | AM_RANGE(0x0000, 0x0fff) AM_WRITE(MWA8_ROM) | |
| 211 | ADDRESS_MAP_END | |
| 212 | ||
| 213 | static ADDRESS_MAP_START( readport_sound, ADDRESS_SPACE_IO, 8 ) | |
| 214 | AM_RANGE(0x00, 0xff) AM_READ(mario_sh_tune_r) | |
| 215 | AM_RANGE(I8039_p1, I8039_p1) AM_READ(mario_sh_p1_r) | |
| 216 | AM_RANGE(I8039_p2, I8039_p2) AM_READ(mario_sh_p2_r) | |
| 217 | AM_RANGE(I8039_t0, I8039_t0) AM_READ(mario_sh_t0_r) | |
| 218 | AM_RANGE(I8039_t1, I8039_t1) AM_READ(mario_sh_t1_r) | |
| 219 | ADDRESS_MAP_END | |
| 220 | ||
| 221 | static ADDRESS_MAP_START( writeport_sound, ADDRESS_SPACE_IO, 8 ) | |
| 222 | AM_RANGE(0x00, 0xff) AM_WRITE(mario_sh_sound_w) | |
| 223 | AM_RANGE(I8039_p1, I8039_p1) AM_WRITE(mario_sh_p1_w) | |
| 224 | AM_RANGE(I8039_p2, I8039_p2) AM_WRITE(mario_sh_p2_w) | |
| 225 | ADDRESS_MAP_END | |
| 226 | ||
| 227 | ||
| 228 | ||
| 229 | 158 | static INPUT_PORTS_START( mario ) |
| 230 | 159 | PORT_START_TAG("IN0") |
| 231 | 160 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_PLAYER(1) |
| r1478 | r1479 | |
| 268 | 197 | PORT_DIPSETTING( 0x80, DEF_STR( Medium ) ) |
| 269 | 198 | PORT_DIPSETTING( 0x40, DEF_STR( Hard ) ) |
| 270 | 199 | PORT_DIPSETTING( 0xc0, DEF_STR( Hardest ) ) |
| 200 | ||
| 201 | PORT_START_TAG("MONITOR") | |
| 202 | PORT_CONFNAME( 0x01, 0x00, "Monitor" ) | |
| 203 | PORT_CONFSETTING( 0x00, "Nintendo" ) | |
| 204 | PORT_CONFSETTING( 0x01, "Std 15.72Khz" ) | |
| 205 | ||
| 271 | 206 | INPUT_PORTS_END |
| 272 | 207 | |
| 273 | 208 | static INPUT_PORTS_START( marioo ) |
| r1478 | r1479 | |
| 318 | 253 | INPUT_PORTS_END |
| 319 | 254 | |
| 320 | 255 | |
| 256 | /************************************* | |
| 257 | * | |
| 258 | * Graphics definitions | |
| 259 | * | |
| 260 | *************************************/ | |
| 321 | 261 | |
| 322 | 262 | static const gfx_layout charlayout = |
| 323 | 263 | { |
| r1478 | r1479 | |
| 344 | 284 | 16*8 /* every sprite takes 16 consecutive bytes */ |
| 345 | 285 | }; |
| 346 | 286 | |
| 347 | ||
| 348 | ||
| 349 | 287 | static GFXDECODE_START( mario ) |
| 350 | 288 | GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout, 0, 16 ) |
| 351 | GFXDECODE_ENTRY( REGION_GFX2, 0, spritelayout, | |
| 289 | GFXDECODE_ENTRY( REGION_GFX2, 0, spritelayout, 0, 32 ) | |
| 352 | 290 | GFXDECODE_END |
| 353 | 291 | |
| 354 | 292 | |
| 293 | /************************************* | |
| 294 | * | |
| 295 | * Machine driver | |
| 296 | * | |
| 297 | *************************************/ | |
| 355 | 298 | |
| 356 | static const char *const mario_sample_names[] = | |
| 357 | { | |
| 358 | "*mario", | |
| 359 | ||
| 360 | /* 7f01 - 7f07 sounds */ | |
| 361 | "ice.wav", /* 0x02 ice appears (formerly effect0.wav) */ | |
| 362 | "coin.wav", /* 0x06 coin appears (formerly effect1.wav) */ | |
| 363 | "skid.wav", /* 0x07 skid */ | |
| 364 | ||
| 365 | /* 7c00 */ | |
| 366 | "run.wav", /* 03, 02, 01 - 0x1b */ | |
| 367 | ||
| 368 | /* 7c80 */ | |
| 369 | "luigirun.wav", /* 03, 02, 01 - 0x1c */ | |
| 370 | ||
| 371 | 0 /* end of array */ | |
| 372 | }; | |
| 373 | ||
| 374 | static const struct Samplesinterface samples_interface = | |
| 375 | { | |
| 376 | 3, /* 3 channels */ | |
| 377 | mario_sample_names | |
| 378 | }; | |
| 379 | ||
| 380 | static const struct AY8910interface ay8910_interface = | |
| 381 | { | |
| 382 | soundlatch_r | |
| 383 | }; | |
| 384 | ||
| 385 | static ADDRESS_MAP_START( masao_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 386 | AM_RANGE(0x0000, 0x0fff) AM_READ(MRA8_ROM) | |
| 387 | AM_RANGE(0x2000, 0x23ff) AM_READ(MRA8_RAM) | |
| 388 | AM_RANGE(0x4000, 0x4000) AM_READ(AY8910_read_port_0_r) | |
| 389 | ADDRESS_MAP_END | |
| 390 | ||
| 391 | static ADDRESS_MAP_START( masao_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 392 | AM_RANGE(0x0000, 0x0fff) AM_WRITE(MWA8_ROM) | |
| 393 | AM_RANGE(0x2000, 0x23ff) AM_WRITE(MWA8_RAM) | |
| 394 | AM_RANGE(0x6000, 0x6000) AM_WRITE(AY8910_control_port_0_w) | |
| 395 | AM_RANGE(0x4000, 0x4000) AM_WRITE(AY8910_write_port_0_w) | |
| 396 | ADDRESS_MAP_END | |
| 397 | ||
| 398 | ||
| 399 | 299 | static MACHINE_DRIVER_START( mario ) |
| 400 | 300 | |
| 401 | 301 | /* basic machine hardware */ |
| 402 | MDRV_CPU_ADD(Z80, 80 | |
| 302 | MDRV_CPU_ADD(Z80, Z80_CLOCK | |
| 403 | 303 | MDRV_CPU_PROGRAM_MAP(readmem,writemem) |
| 404 | 304 | MDRV_CPU_IO_MAP(0,mario_writeport) |
| 405 | 305 | MDRV_CPU_VBLANK_INT(nmi_line_pulse,1) |
| 406 | 306 | |
| 407 | MDRV_CPU_ADD(I8039, 730000) | |
| 408 | /* audio CPU */ /* verified on pcb */ | |
| 409 | MDRV_CPU_PROGRAM_MAP(readmem_sound,writemem_sound) | |
| 410 | MDRV_CPU_IO_MAP(readport_sound,writeport_sound) | |
| 411 | ||
| 412 | MDRV_MACHINE_START(mario) | |
| 413 | MDRV_SCREEN_REFRESH_RATE(60) | |
| 414 | MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION) | |
| 415 | ||
| 416 | 307 | /* video hardware */ |
| 417 | 308 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| 418 | 309 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 419 | MDRV_SCREEN_SIZE(32*8, 32*8) | |
| 420 | MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) | |
| 310 | MDRV_SCREEN_RAW_PARAMS(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART) | |
| 421 | 311 | MDRV_GFXDECODE(mario) |
| 422 | MDRV_PALETTE_LENGTH(256) | |
| 423 | MDRV_COLORTABLE_LENGTH(16*4+32*8) | |
| 312 | MDRV_PALETTE_LENGTH(512) | |
| 424 | 313 | |
| 425 | 314 | MDRV_PALETTE_INIT(mario) |
| 426 | 315 | MDRV_VIDEO_START(mario) |
| 427 | 316 | MDRV_VIDEO_UPDATE(mario) |
| 428 | 317 | |
| 429 | 318 | /* sound hardware */ |
| 430 | MDRV_SPEAKER_STANDARD_MONO("mono") | |
| 431 | ||
| 432 | MDRV_SOUND_ADD(DAC, 0) | |
| 433 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) | |
| 434 | ||
| 435 | MDRV_SOUND_ADD(SAMPLES, 0) | |
| 436 | MDRV_SOUND_CONFIG(samples_interface) | |
| 437 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) | |
| 319 | MDRV_IMPORT_FROM(mario_audio) | |
| 438 | 320 | MACHINE_DRIVER_END |
| 439 | 321 | |
| 440 | 322 | |
| r1478 | r1479 | |
| 445 | 327 | MDRV_CPU_PROGRAM_MAP(readmem,masao_writemem) |
| 446 | 328 | MDRV_CPU_VBLANK_INT(nmi_line_pulse,1) |
| 447 | 329 | |
| 448 | MDRV_CPU_ADD(Z80,24576000/16) | |
| 449 | /* audio CPU */ /* ???? */ | |
| 450 | MDRV_CPU_PROGRAM_MAP(masao_sound_readmem,masao_sound_writemem) | |
| 451 | ||
| 452 | MDRV_MACHINE_START(mario) | |
| 453 | MDRV_SCREEN_REFRESH_RATE(60) | |
| 454 | MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION) | |
| 455 | ||
| 456 | 330 | /* video hardware */ |
| 457 | 331 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| 458 | 332 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 459 | MDRV_SCREEN_SIZE(32*8, 32*8) | |
| 460 | MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) | |
| 333 | MDRV_SCREEN_RAW_PARAMS(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART) | |
| 461 | 334 | MDRV_GFXDECODE(mario) |
| 462 | MDRV_PALETTE_LENGTH(256) | |
| 463 | MDRV_COLORTABLE_LENGTH(16*4+32*8) | |
| 335 | MDRV_PALETTE_LENGTH(512) | |
| 464 | 336 | |
| 465 | 337 | MDRV_PALETTE_INIT(mario) |
| 466 | 338 | MDRV_VIDEO_START(mario) |
| 467 | 339 | MDRV_VIDEO_UPDATE(mario) |
| 468 | 340 | |
| 469 | 341 | /* sound hardware */ |
| 470 | MDRV_SPEAKER_STANDARD_MONO("mono") | |
| 471 | ||
| 472 | MDRV_SOUND_ADD(AY8910, 14318000/6) | |
| 473 | MDRV_SOUND_CONFIG(ay8910_interface) | |
| 474 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) | |
| 342 | MDRV_IMPORT_FROM(masao_audio) | |
| 475 | 343 | MACHINE_DRIVER_END |
| 476 | 344 | |
| 477 | 345 | |
| 346 | /************************************* | |
| 347 | * | |
| 348 | * ROM definitions | |
| 349 | * | |
| 350 | *************************************/ | |
| 478 | 351 | |
| 479 | ||
| 480 | /*************************************************************************** | |
| 481 | ||
| 482 | Game driver(s) | |
| 483 | ||
| 484 | ***************************************************************************/ | |
| 485 | ||
| 486 | 352 | ROM_START( mario ) |
| 487 | 353 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) |
| 488 | 354 | ROM_LOAD( "tma1-c.7f_e-1", 0x0000, 0x2000, CRC(c0c6e014) SHA1(36a04f9ca1c2a583477cb8a6f2ef94e044e08296) ) |
| r1478 | r1479 | |
| 587 | 453 | ROM_LOAD( "mario.4p", 0x0000, 0x0200, CRC(afc9bd41) SHA1(90b739c4c7f24a88b6ac5ca29b06c032906a2801) ) |
| 588 | 454 | ROM_END |
| 589 | 455 | |
| 456 | /************************************* | |
| 457 | * | |
| 458 | * Game drivers | |
| 459 | * | |
| 460 | *************************************/ | |
| 590 | 461 | |
| 591 | ||
| 592 | 462 | GAME( 1983, mario, 0, mario, mario, 0, ROT180, "Nintendo of America", "Mario Bros. (US, set 1)", GAME_SUPPORTS_SAVE ) |
| 593 | 463 | GAME( 1983, marioo, mario, mario, marioo, 0, ROT180, "Nintendo of America", "Mario Bros. (US, set 2)", GAME_SUPPORTS_SAVE ) |
| 594 | 464 | GAME( 1983, marioj, mario, mario, marioj, 0, ROT180, "Nintendo", "Mario Bros. (Japan)", GAME_SUPPORTS_SAVE ) |
| r1478 | r1479 | |
|---|---|---|
| 18 | 18 | #include "sound/sn76496.h" |
| 19 | 19 | |
| 20 | 20 | extern UINT8 *suprloco_videoram; |
| 21 | extern UINT8 *suprloco_scrollram; | |
| 21 | 22 | |
| 22 | 23 | PALETTE_INIT( suprloco ); |
| 23 | 24 | VIDEO_START( suprloco ); |
| 24 | 25 | VIDEO_UPDATE( suprloco ); |
| 25 | 26 | WRITE8_HANDLER( suprloco_videoram_w ); |
| 26 | 27 | WRITE8_HANDLER( suprloco_scrollram_w ); |
| 27 | READ8_HANDLER( suprloco_scrollram_r ); | |
| 28 | 28 | WRITE8_HANDLER( suprloco_control_w ); |
| 29 | 29 | READ8_HANDLER( suprloco_control_r ); |
| 30 | 30 | |
| r1478 | r1479 | |
| 37 | 37 | cpu_spinuntil_time(ATTOTIME_IN_USEC(50)); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | ||
| 41 | static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 42 | AM_RANGE(0x0000, 0x7fff) AM_READ(MRA8_ROM) | |
| 43 | AM_RANGE(0x8000, 0xbfff) AM_READ(MRA8_ROM) | |
| 44 | AM_RANGE(0xc000, 0xc1ff) AM_READ(MRA8_RAM) | |
| 40 | static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 41 | AM_RANGE(0x0000, 0x7fff) AM_ROM | |
| 42 | AM_RANGE(0x8000, 0xbfff) AM_ROM | |
| 43 | AM_RANGE(0xc000, 0xc1ff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size) | |
| 45 | 44 | AM_RANGE(0xc800, 0xc800) AM_READ(input_port_0_r) |
| 46 | 45 | AM_RANGE(0xd000, 0xd000) AM_READ(input_port_1_r) |
| 47 | 46 | AM_RANGE(0xd800, 0xd800) AM_READ(input_port_2_r) |
| 48 | 47 | AM_RANGE(0xe000, 0xe000) AM_READ(input_port_3_r) |
| 49 | 48 | AM_RANGE(0xe001, 0xe001) AM_READ(input_port_4_r) |
| 50 | AM_RANGE(0xe801, 0xe801) AM_READ(suprloco_control_r) | |
| 51 | AM_RANGE(0xf000, 0xf6ff) AM_READ(MRA8_RAM) | |
| 52 | AM_RANGE(0xf7e0, 0xf7ff) AM_READ(suprloco_scrollram_r) | |
| 53 | AM_RANGE(0xf800, 0xffff) AM_READ(MRA8_RAM) | |
| 54 | ADDRESS_MAP_END | |
| 55 | ||
| 56 | static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 57 | AM_RANGE(0x0000, 0x7fff) AM_WRITE(MWA8_ROM) | |
| 58 | AM_RANGE(0x8000, 0xbfff) AM_WRITE(MWA8_ROM) | |
| 59 | AM_RANGE(0xc000, 0xc1ff) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size) | |
| 60 | 49 | AM_RANGE(0xe800, 0xe800) AM_WRITE(suprloco_soundport_w) |
| 61 | AM_RANGE(0xe801, 0xe801) AM_WRITE(suprloco_control_w) | |
| 62 | AM_RANGE(0xf000, 0xf6ff) AM_WRITE(suprloco_videoram_w) AM_BASE(&suprloco_videoram) | |
| 63 | AM_RANGE(0xf7e0, 0xf7ff) AM_WRITE(suprloco_scrollram_w) | |
| 64 | AM_RANGE(0xf800, 0xffff) AM_WRITE(MWA8_RAM) | |
| 50 | AM_RANGE(0xe801, 0xe801) AM_READWRITE(suprloco_control_r, suprloco_control_w) | |
| 51 | AM_RANGE(0xf000, 0xf6ff) AM_RAM AM_WRITE(suprloco_videoram_w) AM_BASE(&suprloco_videoram) | |
| 52 | AM_RANGE(0xf700, 0xf7df) AM_RAM /* unused */ | |
| 53 | AM_RANGE(0xf7e0, 0xf7ff) AM_RAM AM_WRITE(suprloco_scrollram_w) AM_BASE(&suprloco_scrollram) | |
| 54 | AM_RANGE(0xf800, 0xffff) AM_RAM | |
| 65 | 55 | ADDRESS_MAP_END |
| 66 | 56 | |
| 67 | ||
| 68 | static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 69 | AM_RANGE(0x0000, 0x7fff) AM_READ(MRA8_ROM) | |
| 70 | AM_RANGE(0x8000, 0x87ff) AM_READ(MRA8_RAM) | |
| 71 | AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r) | |
| 72 | ADDRESS_MAP_END | |
| 73 | ||
| 74 | static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 75 | AM_RANGE(0x0000, 0x7fff) AM_WRITE(MWA8_ROM) | |
| 76 | AM_RANGE(0x8000, 0x87ff) AM_WRITE(MWA8_RAM) | |
| 57 | static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 ) | |
| 58 | AM_RANGE(0x0000, 0x7fff) AM_ROM | |
| 59 | AM_RANGE(0x8000, 0x87ff) AM_RAM | |
| 77 | 60 | AM_RANGE(0xa000, 0xa003) AM_WRITE(SN76496_0_w) |
| 78 | 61 | AM_RANGE(0xc000, 0xc003) AM_WRITE(SN76496_1_w) |
| 62 | AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r) | |
| 79 | 63 | ADDRESS_MAP_END |
| 80 | 64 | |
| 81 | 65 | |
| r1478 | r1479 | |
| 85 | 69 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 86 | 70 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 87 | 71 | PORT_SERVICE_NO_TOGGLE(0x04, IP_ACTIVE_LOW) |
| 88 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_ | |
| 72 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 ) | |
| 89 | 73 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 ) |
| 90 | 74 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 ) |
| 91 | 75 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| r1478 | r1479 | |
| 184 | 168 | |
| 185 | 169 | /* basic machine hardware */ |
| 186 | 170 | MDRV_CPU_ADD(Z80, 4000000) /* 4 MHz (?) */ |
| 187 | MDRV_CPU_PROGRAM_MAP( | |
| 171 | MDRV_CPU_PROGRAM_MAP( | |
| 188 | 172 | MDRV_CPU_VBLANK_INT(irq0_line_hold,1) |
| 189 | 173 | |
| 190 | 174 | MDRV_CPU_ADD(Z80, 4000000) |
| 191 | 175 | /* audio CPU */ |
| 192 | MDRV_CPU_PROGRAM_MAP(sound_ | |
| 176 | MDRV_CPU_PROGRAM_MAP(sound_ | |
| 193 | 177 | MDRV_CPU_VBLANK_INT(irq0_line_hold,4) /* NMIs are caused by the main CPU */ |
| 194 | 178 | |
| 195 | 179 | MDRV_SCREEN_REFRESH_RATE(60) |
| r1478 | r1479 | |
|---|---|---|
| 42 | 42 | |
| 43 | 43 | |
| 44 | 44 | #------------------------------------------------- |
| 45 | # overrides | |
| 46 | #------------------------------------------------- | |
| 47 | ||
| 48 | # turn on unicode for all 64-bit builds regardless | |
| 49 | ifndef UNICODE | |
| 50 | ifdef PTR64 | |
| 51 | UNICODE = 1 | |
| 52 | endif | |
| 53 | endif | |
| 54 | ||
| 55 | ||
| 56 | ||
| 57 | #------------------------------------------------- | |
| 45 | 58 | # object and source roots |
| 46 | 59 | #------------------------------------------------- |
| 47 | 60 | |
| r1478 | r1479 | |
| 111 | 124 | CC += /wd4267 |
| 112 | 125 | endif |
| 113 | 126 | |
| 127 | # explicitly set the entry point for UNICODE builds | |
| 128 | ifdef UNICODE | |
| 129 | LD += /ENTRY:wmainCRTStartup | |
| 130 | endif | |
| 131 | ||
| 114 | 132 | # add some VC++-specific defines |
| 115 | 133 | DEFS += -D_CRT_SECURE_NO_DEPRECATE -DXML_STATIC -D__inline__=__inline -Dsnprintf=_snprintf |
| 116 | 134 | |
| r1478 | r1479 | |
| 122 | 140 | |
| 123 | 141 | $(VCONV): $(WINOBJ)/vconv.o |
| 124 | 142 | @echo Linking $@... |
| 125 | ifdef PTR64 | |
| 126 | @link.exe /nologo $^ version.lib bufferoverflowu.lib /out:$@ | |
| 127 | else | |
| 128 | 143 | @link.exe /nologo $^ version.lib /out:$@ |
| 129 | endif | |
| 130 | 144 | |
| 131 | 145 | $(WINOBJ)/vconv.o: $(WINSRC)/vconv.c |
| 132 | 146 | @echo Compiling $<... |
| r1478 | r1479 | |
| 259 | 273 | # rule for making the ledutil sample |
| 260 | 274 | #------------------------------------------------- |
| 261 | 275 | |
| 262 | ledutil$(EXE): $(WINOBJ)/ledutil.o $(LIBOCORE) | |
| 276 | LEDUTIL = ledutil$(EXE) | |
| 277 | TOOLS += $(LEDUTIL) | |
| 278 | ||
| 279 | LEDUTILOBJS = \ | |
| 280 | $(WINOBJ)/ledutil.o | |
| 281 | ||
| 282 | $(LEDUTIL): $(LEDUTILOBJS) $(LIBOCORE) | |
| 263 | 283 | @echo Linking $@... |
| 264 | 284 | $(LD) $(LDFLAGS) $^ $(LIBS) -o $@ |
| 265 | 285 | |
| 266 | TOOLS += ledutil$(EXE) | |
| 267 | 286 | |
| 268 | 287 | |
| 269 | ||
| 270 | 288 | #------------------------------------------------- |
| 271 | 289 | # rule for making the verinfo tool |
| 272 | 290 | #------------------------------------------------- |
| 273 | 291 | |
| 274 | 292 | VERINFO = $(WINOBJ)/verinfo$(EXE) |
| 293 | BUILD += $(VERINFO) | |
| 275 | 294 | |
| 276 | $(VERINFO): $(WINOBJ)/verinfo.o $(LIBOCORE) | |
| 295 | VERINFOOBJS = \ | |
| 296 | $(WINOBJ)/verinfo.o | |
| 297 | ||
| 298 | $(VERINFO): $(VERINFOOBJS) $(LIBOCORE) | |
| 277 | 299 | @echo Linking $@... |
| 278 | 300 | $(LD) $(LDFLAGS) $^ $(LIBS) -o $@ |
| 279 | 301 | |
| 280 | BUILD += $(VERINFO) | |
| 281 | 302 | |
| 282 | 303 | |
| 283 | 304 |
| r1478 | r1479 | |
|---|---|---|
| 171 | 171 | // main |
| 172 | 172 | //============================================================ |
| 173 | 173 | |
| 174 | int | |
| 174 | int | |
| 175 | 175 | { |
| 176 | 176 | const char *arg = (argc > 1) ? argv[1] : ""; |
| 177 | 177 | int exitcode = 1; |
| r1478 | r1479 | |
|---|---|---|
| 217 | 217 | // utf8_main |
| 218 | 218 | //============================================================ |
| 219 | 219 | |
| 220 | int | |
| 220 | int | |
| 221 | 221 | { |
| 222 | 222 | char *ext; |
| 223 | 223 |
| r1478 | r1479 | |
|---|---|---|
| 156 | 156 | struct _memorycombo_item |
| 157 | 157 | { |
| 158 | 158 | memorycombo_item * next; |
| 159 | | |
| 159 | TCHAR name[256]; | |
| 160 | 160 | UINT8 cpunum; |
| 161 | 161 | UINT8 spacenum; |
| 162 | 162 | void * base; |
| r1478 | r1479 | |
| 1721 | 1721 | memorycombo_item **tail = &memorycombo; |
| 1722 | 1722 | UINT32 cpunum, spacenum; |
| 1723 | 1723 | int rgnnum, itemnum; |
| 1724 | TCHAR *t_cpunum_name, *t_address_space_names; | |
| 1724 | 1725 | |
| 1725 | 1726 | // first add all the CPUs' address spaces |
| 1726 | 1727 | for (cpunum = 0; cpunum < MAX_CPU; cpunum++) |
| r1478 | r1479 | |
| 1735 | 1736 | ci->cpunum = cpunum; |
| 1736 | 1737 | ci->spacenum = spacenum; |
| 1737 | 1738 | ci->prefsize = MIN(cpuinfo->space[spacenum].databytes, 8); |
| 1738 | sprintf(ci->name, "CPU #%d (%s) %s memory", cpunum, cpunum_name(cpunum), address_space_names[spacenum]); | |
| 1739 | t_cpunum_name = tstring_from_utf8(cpunum_name(cpunum)); | |
| 1740 | t_address_space_names = tstring_from_utf8(address_space_names[spacenum]); | |
| 1741 | _sntprintf(ci->name, ARRAY_LENGTH(ci->name), TEXT("CPU #%d (%s) %s memory"), cpunum, t_cpunum_name, t_address_space_names); | |
| 1742 | free(t_address_space_names), | |
| 1743 | t_address_space_names = NULL; | |
| 1744 | free(t_cpunum_name); | |
| 1745 | t_cpunum_name = NULL; | |
| 1739 | 1746 | *tail = ci; |
| 1740 | 1747 | tail = &ci->next; |
| 1741 | 1748 | } |
| r1478 | r1479 | |
| 1744 | 1751 | // then add all the memory regions |
| 1745 | 1752 | for (rgnnum = 0; rgnnum < MAX_MEMORY_REGIONS; rgnnum++) |
| 1746 | 1753 | { |
| 1754 | TCHAR* t_memory_region_name; | |
| 1747 | 1755 | UINT8 *base = memory_region(rgnnum); |
| 1748 | 1756 | UINT32 type = memory_region_type(Machine, rgnnum); |
| 1749 | 1757 | if (base != NULL && type > REGION_INVALID && (type - REGION_INVALID) < ARRAY_LENGTH(memory_region_names)) |
| r1478 | r1479 | |
| 1768 | 1776 | ci->prefsize = MIN(width, 8); |
| 1769 | 1777 | ci->offset_xor = width - 1; |
| 1770 | 1778 | ci->little_endian = little_endian; |
| 1771 | strcpy(ci->name, memory_region_names[type - REGION_INVALID]); | |
| 1779 | t_memory_region_name = tstring_from_utf8(memory_region_names[type - REGION_INVALID]); | |
| 1780 | _tcscpy(ci->name, t_memory_region_name); | |
| 1781 | free(t_memory_region_name); | |
| 1782 | t_memory_region_name = NULL; | |
| 1772 | 1783 | *tail = ci; |
| 1773 | 1784 | tail = &ci->next; |
| 1774 | 1785 | } |
| r1478 | r1479 | |
| 1780 | 1791 | UINT32 valsize, valcount; |
| 1781 | 1792 | const char *name; |
| 1782 | 1793 | void *base; |
| 1794 | TCHAR* t_name; | |
| 1783 | 1795 | |
| 1784 | 1796 | /* stop when we run out of items */ |
| 1785 | 1797 | name = state_save_get_indexed_item(itemnum, &base, &valsize, &valcount); |
| r1478 | r1479 | |
| 1795 | 1807 | ci->length = valcount * valsize; |
| 1796 | 1808 | ci->prefsize = MIN(valsize, 8); |
| 1797 | 1809 | ci->little_endian = TRUE; |
| 1798 | strcpy(ci->name, strrchr(name, '/') + 1); | |
| 1810 | t_name = tstring_from_utf8(name); | |
| 1811 | _tcscpy(ci->name, _tcsrchr(t_name, TEXT('/')) + 1); | |
| 1812 | free(t_name); | |
| 1813 | t_name = NULL; | |
| 1799 | 1814 | *tail = ci; |
| 1800 | 1815 | tail = &ci->next; |
| 1801 | 1816 | } |
| r1478 | r1479 | |
| 1816 | 1831 | debug_view_set_property_UINT32(info->view[0].view, DVP_MEM_RAW_OFFSET_XOR, ci->offset_xor); |
| 1817 | 1832 | debug_view_set_property_UINT32(info->view[0].view, DVP_MEM_RAW_LITTLE_ENDIAN, ci->little_endian); |
| 1818 | 1833 | debug_view_set_property_UINT32(info->view[0].view, DVP_MEM_BYTES_PER_CHUNK, ci->prefsize); |
| 1819 | | |
| 1834 | S | |
| 1820 | 1835 | } |
| 1821 | 1836 | |
| 1822 | 1837 | |
| r1478 | r1479 | |
| 1871 | 1886 | SetWindowLongPtr(info->editwnd, GWLP_USERDATA, (LONG_PTR)info); |
| 1872 | 1887 | SetWindowLongPtr(info->editwnd, GWLP_WNDPROC, (LONG_PTR)debug_edit_proc); |
| 1873 | 1888 | SendMessage(info->editwnd, WM_SETFONT, (WPARAM)debug_font, (LPARAM)FALSE); |
| 1874 | SendMessage(info->editwnd, WM_SETTEXT, (WPARAM)0, (LPARAM)"0"); | |
| 1889 | SendMessage(info->editwnd, WM_SETTEXT, (WPARAM)0, (LPARAM)TEXT("0")); | |
| 1875 | 1890 | SendMessage(info->editwnd, EM_LIMITTEXT, (WPARAM)MAX_EDIT_STRING, (LPARAM)0); |
| 1876 | 1891 | SendMessage(info->editwnd, EM_SETSEL, (WPARAM)0, (LPARAM)-1); |
| 1877 | 1892 | |
| r1478 | r1479 | |
| 2204 | 2219 | SetWindowLongPtr(info->editwnd, GWLP_USERDATA, (LONG_PTR)info); |
| 2205 | 2220 | SetWindowLongPtr(info->editwnd, GWLP_WNDPROC, (LONG_PTR)debug_edit_proc); |
| 2206 | 2221 | SendMessage(info->editwnd, WM_SETFONT, (WPARAM)debug_font, (LPARAM)FALSE); |
| 2207 | SendMessage(info->editwnd, WM_SETTEXT, (WPARAM)0, (LPARAM)"curpc"); | |
| 2222 | SendMessage(info->editwnd, WM_SETTEXT, (WPARAM)0, (LPARAM)TEXT("curpc")); | |
| 2208 | 2223 | SendMessage(info->editwnd, EM_LIMITTEXT, (WPARAM)MAX_EDIT_STRING, (LPARAM)0); |
| 2209 | 2224 | SendMessage(info->editwnd, EM_SETSEL, (WPARAM)0, (LPARAM)-1); |
| 2210 | 2225 | |
| r1478 | r1479 | |
| 2217 | 2232 | // populate the combobox |
| 2218 | 2233 | for (cpunum = 0; cpunum < MAX_CPU; cpunum++) |
| 2219 | 2234 | { |
| 2235 | TCHAR* t_cpunum_name; | |
| 2220 | 2236 | const debug_cpu_info *cpuinfo = debug_get_cpu_info(cpunum); |
| 2221 | 2237 | if (cpuinfo->valid) |
| 2222 | 2238 | if (cpuinfo->space[ADDRESS_SPACE_PROGRAM].databytes) |
| 2223 | 2239 | { |
| 2224 | | |
| 2240 | TCHAR name[100]; | |
| 2225 | 2241 | int item; |
| 2226 | sprintf(name, "CPU #%d (%s)", cpunum, cpunum_name(cpunum)); | |
| 2242 | t_cpunum_name = tstring_from_utf8(cpunum_name(cpunum)); | |
| 2243 | _sntprintf(name, ARRAY_LENGTH(name), TEXT("CPU #%d (%s)"), cpunum, t_cpunum_name); | |
| 2244 | free(t_cpunum_name); | |
| 2245 | t_cpunum_name = NULL; | |
| 2227 | 2246 | item = SendMessage(info->otherwnd[0], CB_ADDSTRING, 0, (LPARAM)name); |
| 2228 | 2247 | if (cpunum == curcpu) |
| 2229 | 2248 | cursel = item; |
| r1478 | r1479 | |
| 2751 | 2770 | |
| 2752 | 2771 | // then update the caption |
| 2753 | 2772 | snprintf(title, ARRAY_LENGTH(title), "Debug: %s - CPU %d (%s)", Machine->gamedrv->name, cpu_getactivecpu(), activecpu_name()); |
| 2754 | win_get_window_text_utf8(main_console->wnd, curtitle, | |
| 2773 | win_get_window_text_utf8(main_console->wnd, curtitle, ARRAY_LENGTH(curtitle | |
| 2755 | 2774 | if (strcmp(title, curtitle)) |
| 2756 | 2775 | win_set_window_text_utf8(main_console->wnd, title); |
| 2757 | 2776 | } |
| r1478 | r1479 | |
|---|---|---|
| 28 | 28 | #ifndef MESSLIB |
| 29 | 29 | #if !defined(WINUI) || defined(MESS) |
| 30 | 30 | #undef main |
| 31 | #undef wmain | |
| 31 | 32 | #endif |
| 32 | 33 | #endif |
| 33 | 34 |
| r1478 | r1479 | |
|---|---|---|
| 42 | 42 | FILE *debug_source_file; |
| 43 | 43 | symbol_table *global_symtable; |
| 44 | 44 | |
| 45 | static const char *const address_space_name[] = { "program", "data", "I/O" }; | |
| 46 | ||
| 47 | 45 | static UINT64 wpdata; |
| 48 | 46 | static UINT64 wpaddr; |
| 49 | 47 | |
| r1478 | r1479 | |
| 1551 | 1549 | /* if the bottom of the list is over the threshhold, print it */ |
| 1552 | 1550 | debug_hotspot_entry *spot = &info->hotspots[info->hotspot_count - 1]; |
| 1553 | 1551 | if (spot->count > info->hotspot_threshhold) |
| 1554 | debug_console_printf("Hotspot @ %s %08X (PC=%08X) hit %d times (fell off bottom)\n", address_space_name[spot->spacenum], spot->access, spot->pc, spot->count); | |
| 1552 | debug_console_printf("Hotspot @ %s %08X (PC=%08X) hit %d times (fell off bottom)\n", address_space_names[spot->spacenum], spot->access, spot->pc, spot->count); | |
| 1555 | 1553 | |
| 1556 | 1554 | /* move everything else down and insert this one at the top */ |
| 1557 | 1555 | memmove(&info->hotspots[1], &info->hotspots[0], sizeof(info->hotspots[0]) * (info->hotspot_count - 1)); |
| r1478 | r1479 | |
|---|---|---|
| 177 | 177 | void debug_refresh_display(void); |
| 178 | 178 | int debug_get_execution_state(void); |
| 179 | 179 | UINT32 debug_get_execution_counter(void); |
| 180 | void debug_trace_printf(int cpunum, const char *fmt, ...); | |
| 180 | void debug_trace_printf(int cpunum, const char *fmt, ...) ATTR_PRINTF(2,3); | |
| 181 | 181 | void debug_source_script(const char *file); |
| 182 | 182 | void debug_flush_traces(void); |
| 183 | 183 |
| r1478 | r1479 | |
|---|---|---|
| 1275 | 1275 | |
| 1276 | 1276 | static void execute_wplist(int ref, int params, const char *param[]) |
| 1277 | 1277 | { |
| 1278 | static const char *const spacenames[ADDRESS_SPACES] = { "program", "data", "I/O" }; | |
| 1279 | 1278 | int cpunum, printed = 0; |
| 1280 | 1279 | char buffer[256]; |
| 1281 | 1280 | |
| r1478 | r1479 | |
| 1295 | 1294 | static const char *const types[] = { "unkn ", "read ", "write", "r/w " }; |
| 1296 | 1295 | debug_cpu_watchpoint *wp; |
| 1297 | 1296 | |
| 1298 | debug_console_printf("CPU %d %s space watchpoints:\n", cpunum, spacenames[spacenum]); | |
| 1297 | debug_console_printf("CPU %d %s space watchpoints:\n", cpunum, address_space_names[spacenum]); | |
| 1299 | 1298 | |
| 1300 | 1299 | /* loop over the watchpoints */ |
| 1301 | 1300 | for (wp = cpuinfo->space[spacenum].first_wp; wp; wp = wp->next) |
| r1478 | r1479 | |
|---|---|---|
| 28 | 28 | |
| 29 | 29 | |
| 30 | 30 | static char *output; |
| 31 | static void print(const char *fmt, ...) | |
| 31 | static void ATTR_PRINTF(1,2) print(const char *fmt, ...) | |
| 32 | 32 | { |
| 33 | 33 | va_list vl; |
| 34 | 34 |
| r1478 | r1479 | |
|---|---|---|
| 38 | 38 | void x86log_free_context(x86log_context *log); |
| 39 | 39 | |
| 40 | 40 | /* add a comment associated with a given code pointer */ |
| 41 | void x86log_add_comment(x86log_context *log, x86code *base, const char *format, ...); | |
| 41 | void x86log_add_comment(x86log_context *log, x86code *base, const char *format, ...) ATTR_PRINTF(3, 4); | |
| 42 | 42 | |
| 43 | 43 | /* mark a given range as data for logging purposes */ |
| 44 | 44 | void x86log_mark_as_data(x86log_context *log, x86code *base, x86code *end, int size); |
| r1478 | r1479 | |
| 47 | 47 | void x86log_disasm_code_range(x86log_context *log, const char *label, x86code *start, x86code *stop); |
| 48 | 48 | |
| 49 | 49 | /* manually printf information to the log file */ |
| 50 | void x86log_printf(x86log_context *log, const char *format, ...); | |
| 50 | void x86log_printf(x86log_context *log, const char *format, ...) ATTR_PRINTF(2, 3); | |
| 51 | 51 | |
| 52 | 52 | |
| 53 | 53 | #endif /* __X86LOG_H__ */ |
| r1478 | r1479 | |
|---|---|---|
| 1542 | 1542 | if (IO1_LINE_STATE && (FCR & 0x00000005) == 0x00000004) |
| 1543 | 1543 | { |
| 1544 | 1544 | execute_int(get_trap_addr(IO1)); |
| 1545 | (*hyperstone.irq_callback)(IRQ_IO | |
| 1545 | (*hyperstone.irq_callback)(IRQ_IO1); | |
| 1546 | 1546 | return; |
| 1547 | 1547 | } |
| 1548 | 1548 |
| r1478 | r1479 | |
|---|---|---|
| 1153 | 1153 | static char *output; |
| 1154 | 1154 | static const UINT8 *rombase; |
| 1155 | 1155 | |
| 1156 | static void print(const char *fmt, ...) | |
| 1156 | static void ATTR_PRINTF(1,2) print(const char *fmt, ...) | |
| 1157 | 1157 | { |
| 1158 | 1158 | va_list vl; |
| 1159 | 1159 |
| r1478 | r1479 | |
|---|---|---|
| 66 | 66 | |
| 67 | 67 | static char *output; |
| 68 | 68 | |
| 69 | static void print(const char *fmt, ...) | |
| 69 | static void ATTR_PRINTF(1,2) print(const char *fmt, ...) | |
| 70 | 70 | { |
| 71 | 71 | va_list vl; |
| 72 | 72 |
| r1478 | r1479 | |
|---|---|---|
| 59 | 59 | |
| 60 | 60 | static char *output; |
| 61 | 61 | |
| 62 | static void print(const char *fmt, ...) | |
| 62 | static void ATTR_PRINTF(1,2) print(const char *fmt, ...) | |
| 63 | 63 | { |
| 64 | 64 | va_list vl; |
| 65 | 65 |
| r1478 | r1479 | |
|---|---|---|
| 114 | 114 | UINT8 cur_irq; //Holds value of any current IRQ being serviced |
| 115 | 115 | UINT8 irq_priority; //Holds value of the current IRQ Priority Level |
| 116 | 116 | UINT8 rwm; //Signals that the current instruction is a read/write/modify instruction |
| 117 | int prev_used_cycles; //Track previous # of used cycles | |
| 118 | int last_int0; //Store state of int0 | |
| 119 | int last_int1; //Store state of int1 | |
| 120 | UINT8 int_vec; //Pending Interrupt Vector | |
| 121 | int priority_request; //Priority level of incoming new irq | |
| 117 | UINT8 prev_used_cycles; //Track previous # of used cycles | |
| 118 | UINT8 last_int0; //Store state of int0 | |
| 119 | UINT8 last_int1; //Store state of int1 | |
| 120 | UINT8 int_vec; //Pending Interrupt Vector | |
| 121 | UINT8 priority_request; //Priority level of incoming new irq | |
| 122 | 122 | //SFR Registers (Note: Appear in order as they do in memory) |
| 123 | 123 | UINT8 po; //Port 0 |
| 124 | 124 | UINT8 sp; //Stack Pointer |
| r1478 | r1479 | |
| 484 | 484 | state_save_register_item("i8051", index, i8051.subtype); |
| 485 | 485 | state_save_register_item("i8051", index, i8051.rwm ); |
| 486 | 486 | state_save_register_item("i8051", index, i8051.cur_irq ); |
| 487 | state_save_register_item("i8051", index, i8051.irq_priority ); | |
| 488 | state_save_register_item("i8051", index, i8051.prev_used_cycles ); | |
| 489 | state_save_register_item("i8051", index, i8051.last_int0 ); | |
| 490 | state_save_register_item("i8051", index, i8051.last_int1 ); | |
| 491 | state_save_register_item("i8051", index, i8051.int_vec ); | |
| 492 | state_save_register_item("i8051", index, i8051.priority_request ); | |
| 487 | 493 | //SFR Registers |
| 488 | 494 | state_save_register_item("i8051", index, i8051.po); |
| 489 | 495 | state_save_register_item("i8051", index, i8051.sp); |
| r1478 | r1479 | |
| 505 | 511 | state_save_register_item("i8051", index, i8051.ip); |
| 506 | 512 | //8052 Only registers |
| 507 | 513 | #if (HAS_I8052 || HAS_I8752) |
| 514 | state_save_register_item("i8051", index, i8051.t2con); | |
| 508 | 515 | state_save_register_item("i8051", index, i8051.rcap2l); |
| 509 | 516 | state_save_register_item("i8051", index, i8051.rcap2h); |
| 510 | 517 | state_save_register_item("i8051", index, i8051.tl2); |
| r1478 | r1479 | |
| 513 | 520 | state_save_register_item("i8051", index, i8051.psw); |
| 514 | 521 | state_save_register_item("i8051", index, i8051.acc); |
| 515 | 522 | state_save_register_item("i8051", index, i8051.b); |
| 523 | state_save_register_item_array("i8051", index, i8051.IntRam); | |
| 516 | 524 | } |
| 517 | 525 | |
| 518 | 526 | /* Reset registers to the initial values */ |
| r1478 | r1479 | |
|---|---|---|
| 129 | 129 | }; |
| 130 | 130 | |
| 131 | 131 | #if 0 |
| 132 | void GTELOG(const char *a,...) | |
| 132 | void ATTR_PRINTF(1,2) GTELOG(const char *a,...) | |
| 133 | 133 | { |
| 134 | 134 | va_list va; |
| 135 | 135 | char s_text[ 1024 ]; |
| r1478 | r1479 | |
| 139 | 139 | logerror( "%08x: GTE: %08x %s\n", mipscpu.pc, INS_COFUN( mipscpu.op ), s_text ); |
| 140 | 140 | } |
| 141 | 141 | #else |
| 142 | INLINE void GTELOG(const char *a, ...) {} | |
| 142 | INLINE void ATTR_PRINTF(1,2) GTELOG(const char *a, ...) {} | |
| 143 | 143 | #endif |
| 144 | 144 | |
| 145 | 145 | static UINT32 getcp2dr( int n_reg ); |
| r1478 | r1479 | |
| 3126 | 3126 | } |
| 3127 | 3127 | break; |
| 3128 | 3128 | } |
| 3129 | | |
| 3129 | | |
| 3130 | 3130 | logerror( "%08x: unknown GTE op %08x\n", mipscpu.pc, gteop ); |
| 3131 | 3131 | mips_stop(); |
| 3132 | 3132 | } |
| r1478 | r1479 | |
|---|---|---|
| 206 | 206 | to the string pool |
| 207 | 207 | -------------------------------------------------*/ |
| 208 | 208 | |
| 209 | INLINE const char *CLIB_DECL menu_string_pool_add(const char *format, ...) | |
| 209 | INLINE const char *CLIB_DECL ATTR_PRINTF(1,2) menu_string_pool_add(const char *format, ...) | |
| 210 | 210 | { |
| 211 | 211 | char *result = &menu_string_pool[menu_string_pool_offset]; |
| 212 | 212 | va_list arg; |
| r1478 | r1479 | |
|---|---|---|
| 143 | 143 | #define HANDLER_IS_BANK(h) ((FPTR)(h) >= STATIC_BANK1 && (FPTR)(h) <= STATIC_BANKMAX) |
| 144 | 144 | #define HANDLER_IS_STATIC(h) ((FPTR)(h) < STATIC_COUNT) |
| 145 | 145 | |
| 146 | #define HANDLER_TO_BANK(h) ((FPTR)(h)) | |
| 146 | #define HANDLER_TO_BANK(h) ((UINT32)(FPTR)(h)) | |
| 147 | 147 | #define BANK_TO_HANDLER(b) ((genf *)(FPTR)(b)) |
| 148 | 148 | |
| 149 | 149 | #define SPACE_SHIFT(s,a) (((s)->ashift < 0) ? ((a) << -(s)->ashift) : ((a) >> (s)->ashift)) |
| r1478 | r1479 | |
| 870 | 870 | |
| 871 | 871 | |
| 872 | 872 | /*------------------------------------------------- |
| 873 | memory_get_bank - return the currently | |
| 874 | selected bank | |
| 875 | -------------------------------------------------*/ | |
| 876 | ||
| 877 | int memory_get_bank(int banknum) | |
| 878 | { | |
| 879 | /* validation checks */ | |
| 880 | if (banknum < STATIC_BANK1 || banknum > MAX_EXPLICIT_BANKS || !bankdata[banknum].used) | |
| 881 | fatalerror("memory_get_bank called with invalid bank %d", banknum); | |
| 882 | if (bankdata[banknum].dynamic) | |
| 883 | fatalerror("memory_get_bank called with dynamic bank %d", banknum); | |
| 884 | return bankdata[banknum].curentry; | |
| 885 | } | |
| 886 | ||
| 887 | ||
| 888 | ||
| 889 | /*------------------------------------------------- | |
| 873 | 890 | memory_set_bankptr - set the base of a bank |
| 874 | 891 | -------------------------------------------------*/ |
| 875 | 892 | |
| r1478 | r1479 | |
| 2118 | 2135 | int allocatemem = (memory == NULL); |
| 2119 | 2136 | int region; |
| 2120 | 2137 | |
| 2121 | VPRINTF(("allocate_memory_block(%d,%d,%08X,%08X,% | |
| 2138 | VPRINTF(("allocate_memory_block(%d,%d,%08X,%08X,%p | |
| 2122 | 2139 | |
| 2123 | 2140 | /* if we weren't passed a memory block, allocate one and clear it to zero */ |
| 2124 | 2141 | if (allocatemem) |
| r1478 | r1479 | |
| 2188 | 2205 | if (map->share && shared_ptr[map->share]) |
| 2189 | 2206 | { |
| 2190 | 2207 | map->memory = shared_ptr[map->share]; |
| 2191 | VPRINTF(("memory range %08X-%08X -> shared_ptr[%d] [% | |
| 2208 | VPRINTF(("memory range %08X-%08X -> shared_ptr[%d] [%p | |
| 2192 | 2209 | } |
| 2193 | 2210 | |
| 2194 | 2211 | /* otherwise, look for a match in this block */ |
| r1478 | r1479 | |
| 2199 | 2216 | if (map->start >= start && map->end <= end) |
| 2200 | 2217 | { |
| 2201 | 2218 | map->memory = base + (map->start - start); |
| 2202 | VPRINTF(("memory range %08X-%08X -> found in block from %08X-%08X [% | |
| 2219 | VPRINTF(("memory range %08X-%08X -> found in block from %08X-%08X [%p | |
| 2203 | 2220 | } |
| 2204 | 2221 | } |
| 2205 | 2222 | else |
| r1478 | r1479 | |
| 2207 | 2224 | if (map->start >= start && map->start + map->mask <= end) |
| 2208 | 2225 | { |
| 2209 | 2226 | map->memory = base + (map->start - start); |
| 2210 | VPRINTF(("memory range %08X-%08X -> found in block from %08X-%08X [% | |
| 2227 | VPRINTF(("memory range %08X-%08X -> found in block from %08X-%08X [%p | |
| 2211 | 2228 | } |
| 2212 | 2229 | } |
| 2213 | 2230 | } |
| r1478 | r1479 | |
| 2290 | 2307 | if (!IS_AMENTRY_EXTENDED(map) && map->start == bankdata[banknum].base) |
| 2291 | 2308 | { |
| 2292 | 2309 | bank_ptr[banknum] = map->memory; |
| 2293 | VPRINTF(("assigned bank %d pointer to memory from range %08X-%08X [% | |
| 2310 | VPRINTF(("assigned bank %d pointer to memory from range %08X-%08X [%p | |
| 2294 | 2311 | break; |
| 2295 | 2312 | } |
| 2296 | 2313 | |
| r1478 | r1479 | |
| 2328 | 2345 | { |
| 2329 | 2346 | if (maskoffs >= map->start && maskoffs <= map->end) |
| 2330 | 2347 | { |
| 2331 | VPRINTF(("found in entry %08X-%08X [% | |
| 2348 | VPRINTF(("found in entry %08X-%08X [%p | |
| 2332 | 2349 | return (UINT8 *)map->memory + (maskoffs - map->start); |
| 2333 | 2350 | } |
| 2334 | 2351 | } |
| r1478 | r1479 | |
| 2336 | 2353 | { |
| 2337 | 2354 | if ((maskoffs & map->end) == map->start) |
| 2338 | 2355 | { |
| 2339 | VPRINTF(("found in entry %08X-%08X [% | |
| 2356 | VPRINTF(("found in entry %08X-%08X [%p | |
| 2340 | 2357 | return (UINT8 *)map->memory + (maskoffs - map->start); |
| 2341 | 2358 | } |
| 2342 | 2359 | } |
| r1478 | r1479 | |
| 2346 | 2363 | for (blocknum = 0, block = memory_block_list; blocknum < memory_block_count; blocknum++, block++) |
| 2347 | 2364 | if (block->cpunum == cpunum && block->spacenum == spacenum && block->start <= offset && block->end > offset) |
| 2348 | 2365 | { |
| 2349 | VPRINTF(("found in allocated memory block %08X-%08X [% | |
| 2366 | VPRINTF(("found in allocated memory block %08X-%08X [%p | |
| 2350 | 2367 | return block->data + offset - block->start; |
| 2351 | 2368 | } |
| 2352 | 2369 |
| r1478 | r1479 | |
|---|---|---|
| 953 | 953 | void memory_configure_bank(int banknum, int startentry, int numentries, void *base, offs_t stride); |
| 954 | 954 | void memory_configure_bank_decrypted(int banknum, int startentry, int numentries, void *base, offs_t stride); |
| 955 | 955 | void memory_set_bank(int banknum, int entrynum); |
| 956 | int memory_get_bank(int banknum); | |
| 956 | 957 | void memory_set_bankptr(int banknum, void *base); |
| 957 | 958 | |
| 958 | 959 | /* ----- debugging ----- */ |
| r1478 | r1479 | |
|---|---|---|
| 1153 | 1153 | popmessage - pop up a user-visible message |
| 1154 | 1154 | -------------------------------------------------*/ |
| 1155 | 1155 | |
| 1156 | void CLIB_DECL popmessage(const char * | |
| 1156 | void CLIB_DECL popmessage(const char *format, ...) | |
| 1157 | 1157 | { |
| 1158 | extern void CLIB_DECL ui_popup(const char *text, ...) ATTR_PRINTF(1,2); | |
| 1159 | va_list arg; | |
| 1158 | /* if the format is NULL, it is a signal to clear the popmessage */ | |
| 1159 | if (format == NULL) | |
| 1160 | ui_popup_time(0, " "); | |
| 1160 | 1161 | |
| 1161 | /* dump to the buffer */ | |
| 1162 | va_start(arg, text); | |
| 1163 | vsnprintf(giant_string_buffer, GIANT_STRING_BUFFER_SIZE, text, arg); | |
| 1164 | va_end(arg); | |
| 1162 | /* otherwise, generate the buffer and call the UI to display the message */ | |
| 1163 | else | |
| 1164 | { | |
| 1165 | extern void CLIB_DECL ui_popup(const char *format, ...) ATTR_PRINTF(1,2); | |
| 1166 | va_list arg; | |
| 1165 | 1167 | |
| 1166 | /* pop it in the UI */ | |
| 1167 | ui_popup("%s", giant_string_buffer); | |
| 1168 | /* dump to the buffer */ | |
| 1169 | va_start(arg, format); | |
| 1170 | vsnprintf(giant_string_buffer, GIANT_STRING_BUFFER_SIZE, format, arg); | |
| 1171 | va_end(arg); | |
| 1172 | ||
| 1173 | /* pop it in the UI */ | |
| 1174 | ui_popup_time((int)strlen(giant_string_buffer) / 40 + 2, "%s", giant_string_buffer); | |
| 1175 | } | |
| 1168 | 1176 | } |
| 1169 | 1177 | |
| 1170 | 1178 | |
| r1478 | r1479 | |
| 1173 | 1181 | OSD-defined output streams |
| 1174 | 1182 | -------------------------------------------------*/ |
| 1175 | 1183 | |
| 1176 | void CLIB_DECL logerror(const char * | |
| 1184 | void CLIB_DECL logerror(const char *format, ...) | |
| 1177 | 1185 | { |
| 1178 | 1186 | running_machine *machine = Machine; |
| 1179 | 1187 | |
| r1478 | r1479 | |
| 1191 | 1199 | profiler_mark(PROFILER_LOGERROR); |
| 1192 | 1200 | |
| 1193 | 1201 | /* dump to the buffer */ |
| 1194 | va_start(arg, text); | |
| 1195 | vsnprintf(giant_string_buffer, GIANT_STRING_BUFFER_SIZE, text, arg); | |
| 1202 | va_start(arg, format); | |
| 1203 | vsnprintf(giant_string_buffer, GIANT_STRING_BUFFER_SIZE, format, arg); | |
| 1196 | 1204 | va_end(arg); |
| 1197 | 1205 | |
| 1198 | 1206 | /* log to all callbacks */ |
| r1478 | r1479 | |
|---|---|---|
| 14 | 14 | |
| 15 | 15 | #define VERBOSE_LEVEL ( 0 ) |
| 16 | 16 | |
| 17 | INLINE void verboselog( int n_level, const char *s_fmt, ... ) | |
| 17 | INLINE void ATTR_PRINTF(2,3) verboselog( int n_level, const char *s_fmt, ... ) | |
| 18 | 18 | { |
| 19 | 19 | if( VERBOSE_LEVEL >= n_level ) |
| 20 | 20 | { |
| r1478 | r1479 | |
|---|---|---|
| 13 | 13 | |
| 14 | 14 | #define VERBOSE_LEVEL ( 0 ) |
| 15 | 15 | |
| 16 | INLINE void verboselog( int n_level, const char *s_fmt, ... ) | |
| 16 | INLINE void ATTR_PRINTF(2,3) verboselog( int n_level, const char *s_fmt, ... ) | |
| 17 | 17 | { |
| 18 | 18 | if( VERBOSE_LEVEL >= n_level ) |
| 19 | 19 | { |
| r1478 | r1479 | |
|---|---|---|
| 74 | 74 | servicecoinlockedout[counternum] = 0; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | /* register coin save state */ | |
| 78 | state_save_register_item_array("coin", 0, coin_count); | |
| 79 | state_save_register_item_array("coin", 0, coinlockedout); | |
| 80 | state_save_register_item_array("coin", 0, servicecoinlockedout); | |
| 81 | state_save_register_item_array("coin", 0, lastcoin); | |
| 82 | ||
| 77 | 83 | /* reset NVRAM size and pointers */ |
| 78 | 84 | generic_nvram_size = 0; |
| 79 | 85 | generic_nvram = NULL; |
| r1478 | r1479 | |
|---|---|---|
| 16 | 16 | |
| 17 | 17 | #define VERBOSE_LEVEL ( 0 ) |
| 18 | 18 | |
| 19 | INLINE void verboselog( int n_level, const char *s_fmt, ... ) | |
| 19 | INLINE void ATTR_PRINTF(2,3) verboselog( int n_level, const char *s_fmt, ... ) | |
| 20 | 20 | { |
| 21 | 21 | if( VERBOSE_LEVEL >= n_level ) |
| 22 | 22 | { |
| r1478 | r1479 | |
|---|---|---|
| 11 | 11 | |
| 12 | 12 | #define VERBOSE_LEVEL ( 0 ) |
| 13 | 13 | |
| 14 | INLINE void verboselog( int n_level, const char *s_fmt, ... ) | |
| 14 | INLINE void ATTR_PRINTF(2,3) verboselog( int n_level, const char *s_fmt, ... ) | |
| 15 | 15 | { |
| 16 | 16 | if( VERBOSE_LEVEL >= n_level ) |
| 17 | 17 | { |
| r1478 | r1479 | |
| 68 | 68 | |
| 69 | 69 | if( chip >= MAX_ADC083X_CHIPS ) |
| 70 | 70 | { |
| 71 | verboselog( 0, "adc083x_init( %d ) chip | |
| 71 | verboselog( 0, "adc083x_init( %d ) chip | |
| 72 | 72 | return; |
| 73 | 73 | } |
| 74 | 74 | |
| r1478 | r1479 | |
| 134 | 134 | |
| 135 | 135 | if( chip >= MAX_ADC083X_CHIPS ) |
| 136 | 136 | { |
| 137 | verboselog( 0, "adc083x_cs_write( %d ) chip | |
| 137 | verboselog( 0, "adc083x_cs_write( %d ) chip | |
| 138 | 138 | return; |
| 139 | 139 | } |
| 140 | 140 | |
| r1478 | r1479 | |
| 254 | 254 | |
| 255 | 255 | if( chip >= MAX_ADC083X_CHIPS ) |
| 256 | 256 | { |
| 257 | verboselog( 0, "adc083x_clk_write( %d ) chip | |
| 257 | verboselog( 0, "adc083x_clk_write( %d ) chip | |
| 258 | 258 | return; |
| 259 | 259 | } |
| 260 | 260 | |
| r1478 | r1479 | |
| 398 | 398 | |
| 399 | 399 | if( chip >= MAX_ADC083X_CHIPS ) |
| 400 | 400 | { |
| 401 | verboselog( 0, "adc083x_di_write( %d ) chip | |
| 401 | verboselog( 0, "adc083x_di_write( %d ) chip | |
| 402 | 402 | return; |
| 403 | 403 | } |
| 404 | 404 | |
| r1478 | r1479 | |
| 418 | 418 | |
| 419 | 419 | if( chip >= MAX_ADC083X_CHIPS ) |
| 420 | 420 | { |
| 421 | verboselog( 0, "adc083x_se_write( %d ) chip | |
| 421 | verboselog( 0, "adc083x_se_write( %d ) chip | |
| 422 | 422 | return; |
| 423 | 423 | } |
| 424 | 424 | |
| r1478 | r1479 | |
| 438 | 438 | |
| 439 | 439 | if( chip >= MAX_ADC083X_CHIPS ) |
| 440 | 440 | { |
| 441 | verboselog( 0, "adc083x_sars_read( %d ) chip | |
| 441 | verboselog( 0, "adc083x_sars_read( %d ) chip | |
| 442 | 442 | return 0; |
| 443 | 443 | } |
| 444 | 444 | |
| r1478 | r1479 | |
| 454 | 454 | |
| 455 | 455 | if( chip >= MAX_ADC083X_CHIPS ) |
| 456 | 456 | { |
| 457 | verboselog( 0, "adc083x_do_read( %d ) chip | |
| 457 | verboselog( 0, "adc083x_do_read( %d ) chip | |
| 458 | 458 | return 0; |
| 459 | 459 | } |
| 460 | 460 |
| r1478 | r1479 | |
|---|---|---|
| 25 | 25 | |
| 26 | 26 | #define VERBOSE_LEVEL ( 0 ) |
| 27 | 27 | |
| 28 | INLINE void verboselog( int n_level, const char *s_fmt, ... ) | |
| 28 | INLINE void ATTR_PRINTF(2,3) verboselog( int n_level, const char *s_fmt, ... ) | |
| 29 | 29 | { |
| 30 | 30 | if( VERBOSE_LEVEL >= n_level ) |
| 31 | 31 | { |
| r1478 | r1479 | |
|---|---|---|
| 369 | 369 | /* ----- miscellaneous bits & pieces ----- */ |
| 370 | 370 | |
| 371 | 371 | /* pop-up a user visible message */ |
| 372 | void CLIB_DECL popmessage(const char * | |
| 372 | void CLIB_DECL popmessage(const char *format,...) ATTR_PRINTF(1,2); | |
| 373 | 373 | |
| 374 | 374 | /* log to the standard error.log file */ |
| 375 | void CLIB_DECL logerror(const char * | |
| 375 | void CLIB_DECL logerror(const char *format,...) ATTR_PRINTF(1,2); | |
| 376 | 376 | |
| 377 | 377 | /* adds a callback to be called on logerror() */ |
| 378 | 378 | void add_logerror_callback(running_machine *machine, void (*callback)(running_machine *, const char *)); |
| r1478 | r1479 | |
|---|---|---|
| 377 | 377 | if (input_code_pressed_once(KEYCODE_DEL_PAD)) |
| 378 | 378 | { |
| 379 | 379 | gc_active ^= 1; |
| 380 | if (!gc_active) | |
| 380 | if (!gc_active) | |
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | if (gc_active) |
| r1478 | r1479 | |
|---|---|---|
| 45 | 45 | 112, 118, 120, 129, 134, 140, 147, 153 }, |
| 46 | 46 | { |
| 47 | 47 | /* K1 */ |
| 48 | { -504, -497, -493, -488, -471, -471, -460, -446, | |
| 49 | -427, -405, -378, -344, -501, -259, -206, -148, | |
| 50 | -86, -5, 45, 110, 168, 131, 277, 320, | |
| 48 | { -504, -497, -493, -488, -480, -471, -460, -446, | |
| 49 | -427, -408, -378, -344, -305, -259, -206, -148, | |
| 50 | -86, -5, 45, 110, 168, 227, 277, 325, | |
| 51 | 51 | 357, 388, 413, 434, 451, 464, 474, 482 }, |
| 52 | 52 | /* K2 */ |
| 53 | { -349, -3 | |
| 53 | { -349, -328, -305, -280, -252, -223, -192, -158, | |
| 54 | 54 | -124, -88, -51, -14, 23, 60, 97, 133, |
| 55 | 167, 215, 230, 259, 286, 310, 333, 354, | |
| 56 | 372, 389, 404, 417, 429, 439, 449, 506 }, | |
| 55 | 167, 199, 230, 259, 287, 310, 333, 354, | |
| 56 | 372, 389, 404, 417, 427, 439, 449, 506 }, | |
| 57 | 57 | /* K3 */ |
| 58 | { -397, -365, -327, -2 | |
| 58 | { -397, -365, -327, -282, -232 | |
| 59 | 59 | 35, 104, 169, 228, 281, 326, 364, 396 }, |
| 60 | 60 | /* K4 */ |
| 61 | { -36 | |
| 61 | { -376 | |
| 62 | 62 | 64, 128, 188, 243, 291, 332, 367, 397 }, |
| 63 | 63 | /* K5 */ |
| 64 | 64 | { -319, -286, -250, -211, -168, -122, -74, -25, |
| 65 | 24, 73, 121, 167, 210, 2 | |
| 65 | 24, 73, 121, 167, 210, 233, 285, 319 }, | |
| 66 | 66 | /* K6 */ |
| 67 | 67 | { -290, -252, -209, -163, -114, -62, -9, 44, |
| 68 | 68 | 97, 147, 194, 255, 278, 313, 344, 371 }, |
| 69 | 69 | /* K7 */ |
| 70 | { -291, -256, -216, -174, -128, -96, -31, 19, | |
| 71 | 69, 117, 163, 206, 246, 280, 316, 345 }, | |
| 70 | { -291, -256, -216, -174, -128, -80, -31, 19, | |
| 71 | 69, 117, 163, 207, 246, 283, 316, 345 }, | |
| 72 | 72 | /* K8 */ |
| 73 | { -21 | |
| 73 | { -219, -133, -38, 59, 152, 235 | |
| 74 | 74 | /* K9 */ |
| 75 | { -225, -157, -8 | |
| 75 | { -225, -157, -81, -3, 76, 151, 220, 280 }, | |
| 76 | 76 | /* K10 */ |
| 77 | { -179, - | |
| 77 | { -179, - 90, -61, 1, 63, 123, 179, 247 }, | |
| 78 | 78 | }, |
| 79 | 79 | /* Chirptable */ |
| 80 | 80 | { 0, 42, -44, 50, -78, 18, 37, 20, |
| r1478 | r1479 | |
|---|---|---|
| 123 | 123 | * |
| 124 | 124 | *************************************/ |
| 125 | 125 | |
| 126 | static void CLIB_DECL discrete_log(const char *text, ...) | |
| 126 | static void CLIB_DECL ATTR_PRINTF(1,2) discrete_log(const char *text, ...) | |
| 127 | 127 | { |
| 128 | 128 | if (DISCRETE_DEBUGLOG) |
| 129 | 129 | { |
| r1478 | r1479 | |
|---|---|---|
| 16 | 16 | |
| 17 | 17 | #define VERBOSE_LEVEL ( 0 ) |
| 18 | 18 | |
| 19 | INLINE void verboselog( int n_level, const char *s_fmt, ... ) | |
| 19 | INLINE void ATTR_PRINTF(2,3) verboselog( int n_level, const char *s_fmt, ... ) | |
| 20 | 20 | { |
| 21 | 21 | if( VERBOSE_LEVEL >= n_level ) |
| 22 | 22 | { |
| r1478 | r1479 | |
|---|---|---|
| 87 | 87 | static UINT32 decayReleaseRatesP[16]; |
| 88 | 88 | #endif |
| 89 | 89 | |
| 90 | const UINT32 attackTabLen = 255; | |
| 90 | static const UINT32 attackTabLen = 255; | |
| 91 | 91 | static UINT32 releaseTabLen; |
| 92 | 92 | static UINT32 releasePos[256]; |
| 93 | 93 |
| r1478 | r1479 | |
|---|---|---|
| 814 | 814 | |
| 815 | 815 | |
| 816 | 816 | /*------------------------------------------------- |
| 817 | ui_popup - popup a message for a standard | |
| 818 | amount of time | |
| 819 | -------------------------------------------------*/ | |
| 820 | ||
| 821 | void CLIB_DECL ui_popup(const char *text, ...) | |
| 822 | { | |
| 823 | int seconds; | |
| 824 | va_list arg; | |
| 825 | ||
| 826 | /* extract the text */ | |
| 827 | va_start(arg,text); | |
| 828 | vsprintf(messagebox_text, text, arg); | |
| 829 | messagebox_backcolor = UI_FILLCOLOR; | |
| 830 | va_end(arg); | |
| 831 | ||
| 832 | /* set a timer */ | |
| 833 | seconds = (int)strlen(messagebox_text) / 40 + 2; | |
| 834 | popup_text_end = osd_ticks() + osd_ticks_per_second() * seconds; | |
| 835 | } | |
| 836 | ||
| 837 | ||
| 838 | /*------------------------------------------------- | |
| 839 | 817 | ui_popup_time - popup a message for a specific |
| 840 | 818 | amount of time |
| 841 | 819 | -------------------------------------------------*/ |
| r1478 | r1479 | |
|---|---|---|
| 68 | 68 | #include "output.h" |
| 69 | 69 | #include "tilemap.h" |
| 70 | 70 | #include "romload.h" |
| 71 | #include "drivers/xtal.h" | |
| 71 | 72 | #include "machine/generic.h" |
| 72 | 73 | #include "audio/generic.h" |
| 73 | 74 | #include "video/generic.h" |
| r1478 | r1479 | |
|---|---|---|
| 141 | 141 | int mame_fputs(mame_file *f, const char *s); |
| 142 | 142 | |
| 143 | 143 | /* printf-style text write to a file */ |
| 144 | int CLIB_DECL mame_fprintf(mame_file *f, const char *fmt, ...); | |
| 144 | int CLIB_DECL mame_fprintf(mame_file *f, const char *fmt, ...) ATTR_PRINTF(2,3); | |
| 145 | 145 | |
| 146 | 146 | |
| 147 | 147 |
| r0 | r1479 | |
|---|---|---|
| 1 | /************************************************************************* | |
| 2 | ||
| 3 | xtal.h | |
| 4 | ||
| 5 | Documentation and consistent naming for known existing crystals. | |
| 6 | ||
| 7 | Copyright (c) 1996-2007, Nicola Salmoria and the MAME Team. | |
| 8 | Visit http://mamedev.org for licensing and usage restrictions. | |
| 9 | ||
| 10 | *************************************************************************** | |
| 11 | ||
| 12 | PCB Crystal Reference | |
| 13 | ---------------------- | |
| 14 | _____ ________ | |
| 15 | |16 | |o | | |
| 16 | |MHZ| |16.0MHZ | | |
| 17 | |___| |________| | |
| 18 | | | | |
| 19 | ||
| 20 | There is a finite list of _manufactured_ crystals. This file aims | |
| 21 | to document all of the known speeds that crystals were available in. | |
| 22 | Feel free to add to the list if you find another speed crystal on | |
| 23 | a PCB, but please DON'T GUESS! | |
| 24 | ||
| 25 | Remember that some very high frequencies (typically above 100MHz) are | |
| 26 | generated by a frequency multiplying IC from a lower frequency | |
| 27 | crystal. | |
| 28 | ||
| 29 | This is intended as a reference of existing parts to prevent incorrect | |
| 30 | clock speed measurements with digital frequency counters being used | |
| 31 | in drivers. When measuring clocks, remember that most parts have a | |
| 32 | tolerance so be sure to reference existing parts only and not just | |
| 33 | accept direct readings as 100% true. | |
| 34 | ||
| 35 | (Thanks to Guru for starting this documentation.) | |
| 36 | ||
| 37 | **************************************************************************/ | |
| 38 | ||
| 39 | enum | |
| 40 | { | |
| 41 | /* | |
| 42 | Name = Frequency Examples | |
| 43 | ------------------ ------------ ------------------------------------------------------------ */ | |
| 44 | XTAL_32_768kHz = 327680, /* 32.768kHz, used to drive RTC chips */ | |
| 45 | XTAL_1MHz = 1000000, | |
| 46 | XTAL_2MHz = 2000000, | |
| 47 | XTAL_3MHz = 3000000, /* Probably only used to drive 68705 or similar MCUs on 80's Taito PCBs */ | |
| 48 | XTAL_3_579545MHz = 3579545, | |
| 49 | XTAL_3_6864MHz = 3686400, /* CPS3 */ | |
| 50 | XTAL_4MHz = 4000000, | |
| 51 | XTAL_4_224MHz = 4224000, /* Used to drive OKI M6295 chips, usually with /4 divider */ | |
| 52 | XTAL_4_9152MHz = 4915200, | |
| 53 | XTAL_6MHz = 6000000, | |
| 54 | XTAL_7_3728MHz = 7372800, | |
| 55 | XTAL_8MHz = 8000000, | |
| 56 | XTAL_10MHz = 10000000, | |
| 57 | XTAL_10_595MHz = 10595000, /* Mad Alien */ | |
| 58 | XTAL_11MHz = 11000000, /* Mario I8039 sound */ | |
| 59 | XTAL_11_289MHz = 11289000, /* Vanguard */ | |
| 60 | XTAL_12MHz = 12000000, | |
| 61 | XTAL_12_096MHz = 12096000, | |
| 62 | XTAL_12_288MHz = 12288000, /* Sega Model 3 digital audio board */ | |
| 63 | XTAL_13_3MHz = 13300000, /* BMC bowling */ | |
| 64 | XTAL_13_33056MHz = 13330560, /* Taito L */ | |
| 65 | XTAL_14MHz = 14000000, | |
| 66 | XTAL_14_31818MHz = 14318180, | |
| 67 | XTAL_14_705882MHz = 14705882, /* Aleck64 */ | |
| 68 | XTAL_14_7456MHz = 14745600, /* Namco System 12 & System Super 22/23 for H8/3002 CPU */ | |
| 69 | XTAL_15_468MHz = 15468000, /* Bank Panic h/w, Sega G80 */ | |
| 70 | XTAL_16MHz = 16000000, | |
| 71 | XTAL_16_9344MHz = 16934400, /* Usually used to drive 90's Yamaha OPL/FM chips */ | |
| 72 | XTAL_18MHz = 18000000, | |
| 73 | XTAL_18_432MHz = 18432000, | |
| 74 | XTAL_19_968MHz = 19968000, /* Used mostly by Space Invaders games by Taito/Midway and clones */ | |
| 75 | XTAL_20MHz = 20000000, | |
| 76 | XTAL_21_3MHz = 21300000, | |
| 77 | XTAL_21_4772MHz = 21477200, /* BMC bowling */ | |
| 78 | XTAL_22MHz = 22000000, | |
| 79 | XTAL_24MHz = 24000000, /* Mario */ | |
| 80 | XTAL_24_576MHz = 24576000, /* Pole Position h/w, Model 3 CPU board */ | |
| 81 | XTAL_25MHz = 25000000, /* Namco System 22, Taito GNET */ | |
| 82 | XTAL_25_1748MHz = 25174800, /* Sega S16A, S16B */ | |
| 83 | XTAL_26_66666MHz = 26666660, /* Irem M92 but most use 27MHz */ | |
| 84 | XTAL_26_686MHz = 26686000, /* Typically used on 90's Taito PCBs to drive the custom chips */ | |
| 85 | XTAL_27MHz = 27000000, /* Some Banpresto games macrossp and Irem M92 */ | |
| 86 | XTAL_27_164MHz = 27164000, /* Typically used on 90's Taito PCBs to drive the custom chips */ | |
| 87 | XTAL_28MHz = 28000000, | |
| 88 | XTAL_28_63636MHz = 28636360, /* later Leland games and Atari GT */ | |
| 89 | XTAL_30_4761MHz = 30476100, /* Taito JC */ | |
| 90 | XTAL_32MHz = 32000000, | |
| 91 | XTAL_32_22MHz = 32220000, /* Typically used on 90's Data East PCBs */ | |
| 92 | XTAL_32_5304MHz = 32530400, /* Seta 2 */ | |
| 93 | XTAL_33MHz = 33000000, /* Sega Model 3 video board */ | |
| 94 | XTAL_33_333MHz = 33333000, /* Sega Model 3 CPU board, Vegas */ | |
| 95 | XTAL_33_8688MHz = 33868800, /* Usually used to drive 90's Yamaha OPL/FM chips with /2 divider */ | |
| 96 | XTAL_36MHz = 36000000, /* Sega Model 1 video board */ | |
| 97 | XTAL_38_76922MHz = 38769220, /* Namco System 21 video board */ | |
| 98 | XTAL_40MHz = 40000000, | |
| 99 | XTAL_42_9545MHz = 42954500, /* CPS3 */ | |
| 100 | XTAL_45MHz = 45000000, /* Eolith with Hyperstone CPUs */ | |
| 101 | XTAL_45_158MHz = 45158000, /* Sega Model 2A video board, Model 3 CPU board */ | |
| 102 | XTAL_48MHz = 48000000, | |
| 103 | XTAL_49_152MHz = 49152000, /* Used on some Namco PCBs, Baraduke h/w, System 21, Super System 22 */ | |
| 104 | XTAL_50MHz = 50000000, | |
| 105 | XTAL_52MHz = 52000000, /* Cojag */ | |
| 106 | XTAL_53_693175MHz = 53693175, /* PSX-based h/w, Sony ZN1-2-based */ | |
| 107 | XTAL_54MHz = 54000000, /* Taito JC */ | |
| 108 | XTAL_57_2727MHz = 57272700, /* Psikyo SH2 with /2 divider */ | |
| 109 | XTAL_60MHz = 60000000, | |
| 110 | XTAL_61_44MHz = 61440000, /* dkong */ | |
| 111 | XTAL_64MHz = 64000000, /* BattleToads */ | |
| 112 | XTAL_66_6667MHz = 66666700, /* later Midway games */ | |
| 113 | XTAL_67_7376MHz = 67737600, /* PSX-based h/w, Sony ZN1-2-based */ | |
| 114 | XTAL_100MHz = 100000000, /* PSX-based Namco System 12, Vegas, Sony ZN1-2-based */ | |
| 115 | XTAL_101_4912MHz = 101491200, /* PSX-based Namco System 10 */ | |
| 116 | ||
| 117 | /* Resonators (There are probably more. Almost always used for driving OKI sound chips) */ | |
| 118 | ||
| 119 | XTAL_384kHz = 384000, | |
| 120 | XTAL_640kHz = 640000 | |
| 121 | }; | |
| 122 | ||
| 123 | ||
| 124 | /* | |
| 125 | ||
| 126 | For further reference: | |
| 127 | ||
| 128 | A search at http://search.digikey.com/scripts/DkSearch/dksus.dll?Cat=852333;keywords=cry | |
| 129 | reveals the following shipping frequencies as of 1/1/2008: | |
| 130 | ||
| 131 | 20kHz | |
| 132 | 25.600kHz | |
| 133 | 26.667kHz | |
| 134 | 28kHz | |
| 135 | ||
| 136 | 30kHz | |
| 137 | 30.720kHz | |
| 138 | 30.76kHz | |
| 139 | 31.2kHz | |
| 140 | 31.25kHz | |
| 141 | 31.5kHz | |
| 142 | 32.000kHz | |
| 143 | 32.56kHz | |
| 144 | 32.768kHz | |
| 145 | 32.919kHz | |
| 146 | 34kHz | |
| 147 | 36kHz | |
| 148 | 38kHz | |
| 149 | 38.4kHz | |
| 150 | 39.500kHz | |
| 151 | ||
| 152 | 40kHz | |
| 153 | 44.100kHz | |
| 154 | 46.604kHz | |
| 155 | 46.6084kHz | |
| 156 | ||
| 157 | 50kHz | |
| 158 | 59.787kHz | |
| 159 | ||
| 160 | 60.000kHz | |
| 161 | 60.002kHz | |
| 162 | 60.005kHz | |
| 163 | 65.535kHz | |
| 164 | 65.536kHz | |
| 165 | 69kHz | |
| 166 | ||
| 167 | 70kHz | |
| 168 | 71kHz | |
| 169 | 72kHz | |
| 170 | 73kHz | |
| 171 | 74kHz | |
| 172 | 74.3kHz | |
| 173 | 74.4kHz | |
| 174 | 75kHz | |
| 175 | 76kHz | |
| 176 | 76.79kHz | |
| 177 | 76.8kHz | |
| 178 | 76.81kHz | |
| 179 | 77kHz | |
| 180 | 77.204kHz | |
| 181 | 77.287kHz | |
| 182 | 77.500kHz | |
| 183 | 77.503kHz | |
| 184 | 77.504kHz | |
| 185 | 78kHz | |
| 186 | 79kHz | |
| 187 | ||
| 188 | 83kHz | |
| 189 | ||
| 190 | 96kHz | |
| 191 | 96.006kHz | |
| 192 | ||
| 193 | 100kHz | |
| 194 | 111kHz | |
| 195 | 117.72kHz | |
| 196 | 120kHz | |
| 197 | 120.8475kHz | |
| 198 | 125kHz | |
| 199 | 131.072kHz | |
| 200 | 149.475kHz | |
| 201 | 153.600kHz | |
| 202 | ||
| 203 | 200kHz | |
| 204 | ||
| 205 | 307.2kHz | |
| 206 | ||
| 207 | 1.000MHz | |
| 208 | 1.8432MHz | |
| 209 | ||
| 210 | 2.000MHz | |
| 211 | 2.048MHz | |
| 212 | 2.097152MHz | |
| 213 | 2.4576MHz | |
| 214 | 2.5MHz | |
| 215 | 2.560MHz | |
| 216 | 2.949120MHz | |
| 217 | ||
| 218 | 3.000MHz | |
| 219 | 3.276MHz | |
| 220 | 3.2768MHz | |
| 221 | 3.579MHz | |
| 222 | 3.579545MHz | |
| 223 | 3.640MHz | |
| 224 | 3.6864MHz | |
| 225 | 3.700MHz | |
| 226 | 3.859MHz | |
| 227 | 3.93216MHz | |
| 228 | ||
| 229 | 4.000MHz | |
| 230 | 4.032MHz | |
| 231 | 4.096MHz | |
| 232 | 4.09625MHz | |
| 233 | 4.194MHz | |
| 234 | 4.194304MHz | |
| 235 | 4.332MHz | |
| 236 | 4.433MHz | |
| 237 | 4.433616MHz | |
| 238 | 4.433618MHz | |
| 239 | 4.433619MHz | |
| 240 | 4.74687MHz | |
| 241 | 4.800MHz | |
| 242 | 4.8970MHz | |
| 243 | 4.90625MHz | |
| 244 | 4.915MHz | |
| 245 | 4.9152MHz | |
| 246 | ||
| 247 | 5.000MHz | |
| 248 | 5.0688MHz | |
| 249 | 5.120MHz | |
| 250 | 5.185MHz | |
| 251 | 5.223438MHz | |
| 252 | 5.5MHz | |
| 253 | 5.5296MHz | |
| 254 | 5.9904MHz | |
| 255 | ||
| 256 | 6.000MHz | |
| 257 | 6.14MHz | |
| 258 | 6.144MHz | |
| 259 | 6.1760MHz | |
| 260 | 6.400 MHz | |
| 261 | 6.49830MHz | |
| 262 | 6.5MHz | |
| 263 | 6.5536MHz | |
| 264 | 6.612813MHz | |
| 265 | 6.7458MHz | |
| 266 | 6.757MHz | |
| 267 | 6.76438MHz | |
| 268 | ||
| 269 | 7.1505MHz | |
| 270 | 7.15909 MHz | |
| 271 | 7.2MHz | |
| 272 | 7.3728MHz | |
| 273 | 7.68MHz | |
| 274 | 7.94888MHz | |
| 275 | ||
| 276 | 8.000MHz | |
| 277 | 8.000156MHz | |
| 278 | 8.192MHz | |
| 279 | 8.388608MHz | |
| 280 | 8.432MHz | |
| 281 | 8.5MHz | |
| 282 | 8.6432MHz | |
| 283 | ||
| 284 | 9.000MHz | |
| 285 | 9.216MHz | |
| 286 | 9.509375MHz | |
| 287 | 9.545MHz | |
| 288 | 9.6MHz | |
| 289 | 9.7941MHz | |
| 290 | 9.830MHz | |
| 291 | 9.8304MHz | |
| 292 | 9.84375MHz | |
| 293 | 9.8438MHz | |
| 294 | ||
| 295 | 10.000MHz | |
| 296 | 10.240MHz | |
| 297 | 10.245MHz | |
| 298 | 10.6244MHz | |
| 299 | 10.738635MHz | |
| 300 | 10.73865MHz | |
| 301 | ||
| 302 | 11.000MHz | |
| 303 | 11.046MHz | |
| 304 | 11.0592MHz | |
| 305 | 11.228MHz | |
| 306 | 11.2896MHz | |
| 307 | 11.520MHz | |
| 308 | 11.981350MHz | |
| 309 | ||
| 310 | 12.000MHz | |
| 311 | 12.000393MHz | |
| 312 | 12.096MHz | |
| 313 | 12.1875MHz | |
| 314 | 12.288MHz | |
| 315 | 12.352MHz | |
| 316 | 12.500MHz | |
| 317 | 12.688MHz | |
| 318 | 12.800MHz | |
| 319 | 12.96MHz | |
| 320 | ||
| 321 | 13.000MHz | |
| 322 | 13.0625MHz | |
| 323 | 13.225MHz | |
| 324 | 13.2256MHz | |
| 325 | 13.500MHz | |
| 326 | 13.5168MHz | |
| 327 | 13.56MHz | |
| 328 | 13.605MHz | |
| 329 | 13.824MHz | |
| 330 | 13.94916MHz | |
| 331 | ||
| 332 | 14.00MHz | |
| 333 | 14.318MHz | |
| 334 | 14.31818MHz | |
| 335 | 14.3359MHz | |
| 336 | 14.3594MHz | |
| 337 | 14.4MHz | |
| 338 | 14.5MHz | |
| 339 | 14.69MHz | |
| 340 | 14.7456MHz | |
| 341 | 14.850MHz | |
| 342 | ||
| 343 | 15MHz | |
| 344 | 15.360MHz | |
| 345 | ||
| 346 | 16.000MHz | |
| 347 | 16.000312MHz | |
| 348 | 16.128MHz | |
| 349 | 16.257MHz | |
| 350 | 16.3676MHz | |
| 351 | 16.368MHz | |
| 352 | 16.384MHz | |
| 353 | 16.576MHz | |
| 354 | 16.6660MHz | |
| 355 | 16.667MHz | |
| 356 | 16.670MHz | |
| 357 | 16.800MHz | |
| 358 | 16.934MHz | |
| 359 | 16.9344MHz | |
| 360 | ||
| 361 | 17.734475MHz | |
| 362 | ||
| 363 | 18.000MHz | |
| 364 | 18.432MHz | |
| 365 | 18.869MHz | |
| 366 | ||
| 367 | 19.200MHz | |
| 368 | 19.440MHz | |
| 369 | 19.660MHz | |
| 370 | 19.6608MHz | |
| 371 | 19.68MHz | |
| 372 | 19.800MHz | |
| 373 | ||
| 374 | 20.000MHz | |
| 375 | 20.35625MHz | |
| 376 | 20.3563MHz | |
| 377 | 20.480MHz | |
| 378 | ||
| 379 | 21.47727MHz | |
| 380 | ||
| 381 | 22.000MHz | |
| 382 | 22.118MHz | |
| 383 | 22.1184MHz | |
| 384 | 22.400MHz | |
| 385 | 22.5MHz | |
| 386 | 22.5792MHz | |
| 387 | 22.6278MHz | |
| 388 | ||
| 389 | 23MHz | |
| 390 | 23.2643MHz | |
| 391 | 23.5MHz | |
| 392 | 23.5122MHz | |
| 393 | 23.592MHz | |
| 394 | ||
| 395 | 24.000MHz | |
| 396 | 24.00014MHz | |
| 397 | 24.5MHz | |
| 398 | 24.545454 MHz | |
| 399 | 24.5535MHz | |
| 400 | 24.576MHz | |
| 401 | 24.704MHz | |
| 402 | 24.7456MHz | |
| 403 | ||
| 404 | 25.000MHz | |
| 405 | 25MHz | |
| 406 | 25.175MHz | |
| 407 | 25.2235MHz | |
| 408 | 25.4563MHz | |
| 409 | 25.5MHz | |
| 410 | ||
| 411 | 26.000MHz | |
| 412 | 26.45125MHz | |
| 413 | 26.4513MHz | |
| 414 | 26.5MHz | |
| 415 | 26.5971MHz | |
| 416 | 26.800MHz | |
| 417 | ||
| 418 | 27.000MHz | |
| 419 | 27.1344MHz | |
| 420 | 27.3067MHz | |
| 421 | 27.4688MHz | |
| 422 | ||
| 423 | 28.000MHz | |
| 424 | 28.224MHz | |
| 425 | 28.259375MHz | |
| 426 | 28.2594MHz | |
| 427 | 28.322MHz | |
| 428 | 28.375MHz | |
| 429 | 28.5938MHz | |
| 430 | 28.636MHz | |
| 431 | 28.6363MHz | |
| 432 | 28.63636MHz | |
| 433 | ||
| 434 | 29.4912MHz | |
| 435 | 29.498928MHz | |
| 436 | 29.500MHz | |
| 437 | ||
| 438 | 30.000MHz | |
| 439 | 32.000MHz | |
| 440 | 32.514MHz | |
| 441 | 32.768MHz | |
| 442 | 33.000MHz | |
| 443 | 33.333MHz | |
| 444 | 33.3333MHz | |
| 445 | 33.8688MHz | |
| 446 | 35.2512MHz | |
| 447 | 35.3280MHz | |
| 448 | 36.000MHz | |
| 449 | 38.000MHz | |
| 450 | 38.00053MHz | |
| 451 | 38.400MHz | |
| 452 | 38.880MHz | |
| 453 | 39MHz | |
| 454 | ||
| 455 | 40.000MHz | |
| 456 | 40.320MHz | |
| 457 | 40.960 MHz | |
| 458 | 42.000MHz | |
| 459 | 44.000MHz | |
| 460 | 44.2368MHz | |
| 461 | 44.545MHz | |
| 462 | 44.736MHz | |
| 463 | 44.800MHz | |
| 464 | 44.900MHz | |
| 465 | 45.000MHz | |
| 466 | 46.000MHz | |
| 467 | 48.000MHz | |
| 468 | 49.152MHz | |
| 469 | 49.86MHz | |
| 470 | ||
| 471 | 50.000MHz | |
| 472 | 53.125MHz | |
| 473 | 55.000MHz | |
| 474 | ||
| 475 | 60.000MHz | |
| 476 | 64.000MHz | |
| 477 | 66.000MHz | |
| 478 | 66.666MHz | |
| 479 | 66.6666MHz | |
| 480 | ||
| 481 | 73.66979MHz | |
| 482 | 75.957292MHz | |
| 483 | 76.121875MHz | |
| 484 | ||
| 485 | 80.000MHz | |
| 486 | ||
| 487 | 100.00MHz | |
| 488 | ||
| 489 | */ |
| r1478 | r1479 | |
|---|---|---|
| 162 | 162 | debugload - log data to a file |
| 163 | 163 | -------------------------------------------------*/ |
| 164 | 164 | |
| 165 | static void CLIB_DECL debugload(const char *string, ...) | |
| 165 | static void CLIB_DECL ATTR_PRINTF(1,2) debugload(const char *string, ...) | |
| 166 | 166 | { |
| 167 | 167 | #ifdef LOG_LOAD |
| 168 | 168 | static int opened; |
| r1478 | r1479 | |
|---|---|---|
| 24 | 24 | ***************************************************************************/ |
| 25 | 25 | |
| 26 | 26 | #define VERBOSE (0) |
| 27 | #if VERBOSE | |
| 27 | 28 | #define LOG(x) do { if (VERBOSE) logerror x; } while (0) |
| 29 | #else | |
| 30 | #define LOG(x) | |
| 31 | #endif | |
| 28 | 32 | |
| 29 | 33 | void CLIB_DECL logerror(const char *text,...); |
| 30 | 34 | |
| 35 | ||
| 36 | ||
| 31 | 37 | /*************************************************************************** |
| 32 | 38 | TYPE DEFINITIONS |
| 33 | 39 | ***************************************************************************/ |
| r1478 | r1479 | |
|---|---|---|
| 88 | 88 | ***************************************************************************/ |
| 89 | 89 | |
| 90 | 90 | static void memory_destruct(void *object, size_t size); |
| 91 | static void report_failure(object_pool *pool, const char *format, ...); | |
| 91 | static void report_failure(object_pool *pool, const char *format, ...) ATTR_PRINTF(2,3); | |
| 92 | 92 | |
| 93 | 93 | |
| 94 | 94 | |
| r1478 | r1479 | |
| 268 | 268 | /* if we have an invalid type, fail */ |
| 269 | 269 | if (type == NULL) |
| 270 | 270 | { |
| 271 | report_failure(pool, "pool_object_add (via %s:%d): Attempted to add object of unknown type", file, line, (int)size); | |
| 271 | report_failure(pool, "pool_object_add (via %s:%d): Attempted to add object of unknown type with size %d", file, line, (int)size); | |
| 272 | 272 | return object; |
| 273 | 273 | } |
| 274 | 274 |
| r1478 | r1479 | |
|---|---|---|
| 70 | 70 | astring *astring_substr(astring *str, int start, int count); |
| 71 | 71 | |
| 72 | 72 | /* formatted printf to an astring */ |
| 73 | int astring_printf(astring *dst, const char *format, ...); | |
| 73 | int astring_printf(astring *dst, const char *format, ...) ATTR_PRINTF(2,3); | |
| 74 | 74 | |
| 75 | 75 | |
| 76 | 76 |
| r1478 | r1479 | |
|---|---|---|
| 100 | 100 | static void update_data(core_options *opts, options_data *data, const char *newdata, int priority); |
| 101 | 101 | static int parse_option_name(core_options *opts, const char *srcstring, options_data *data); |
| 102 | 102 | |
| 103 | static void message(core_options *opts, options_message msgtype, const char *format, ...); | |
| 103 | static void message(core_options *opts, options_message msgtype, const char *format, ...) ATTR_PRINTF(3,4); | |
| 104 | 104 | static UINT32 hash_value(core_options *opts, const char *str); |
| 105 | static void output_printf(void (*output)(const char *s), const char *format, ...); | |
| 105 | static void output_printf(void (*output)(const char *s), const char *format, ...) ATTR_PRINTF(2,3); | |
| 106 | 106 | |
| 107 | 107 | |
| 108 | 108 |
| r1478 | r1479 | |
|---|---|---|
| 100 | 100 | |
| 101 | 101 | /* printf-style text write to a file */ |
| 102 | 102 | int core_vfprintf(core_file *f, const char *fmt, va_list va); |
| 103 | int CLIB_DECL core_fprintf(core_file *f, const char *fmt, ...); | |
| 103 | int CLIB_DECL core_fprintf(core_file *f, const char *fmt, ...) ATTR_PRINTF(2,3); | |
| 104 | 104 | |
| 105 | 105 | |
| 106 | 106 |
| r1478 | r1479 | |
|---|---|---|
| 31 | 31 | |
| 32 | 32 | Source Changes: |
| 33 | 33 | ---------------- |
| 34 | - The core is based on MAME 0.122u | |
| 34 | - The core is based on MAME 0.122u3. This incorporates all features of the | |
| 35 | 35 | update to this core. [MAME team] |
| 36 | 36 | |
| 37 | 37 | - Conditional logging cleanups. [Atari Ace] |
| Previous | 15994 Revisions | Next |