src/mame/audio/jedi.c
| r15225 | r15226 | |
| 170 | 170 | |
| 171 | 171 | static ADDRESS_MAP_START( audio_map, AS_PROGRAM, 8, jedi_state ) |
| 172 | 172 | AM_RANGE(0x0000, 0x07ff) AM_RAM |
| 173 | | AM_RANGE(0x0800, 0x080f) AM_MIRROR(0x07c0) AM_DEVREADWRITE_LEGACY("pokey1", pokey_r, pokey_w) |
| 174 | | AM_RANGE(0x0810, 0x081f) AM_MIRROR(0x07c0) AM_DEVREADWRITE_LEGACY("pokey2", pokey_r, pokey_w) |
| 175 | | AM_RANGE(0x0820, 0x082f) AM_MIRROR(0x07c0) AM_DEVREADWRITE_LEGACY("pokey3", pokey_r, pokey_w) |
| 176 | | AM_RANGE(0x0830, 0x083f) AM_MIRROR(0x07c0) AM_DEVREADWRITE_LEGACY("pokey4", pokey_r, pokey_w) |
| 173 | AM_RANGE(0x0800, 0x080f) AM_MIRROR(0x07c0) AM_DEVREADWRITE("pokey1", pokeyn_device, read, write) |
| 174 | AM_RANGE(0x0810, 0x081f) AM_MIRROR(0x07c0) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write) |
| 175 | AM_RANGE(0x0820, 0x082f) AM_MIRROR(0x07c0) AM_DEVREADWRITE("pokey3", pokeyn_device, read, write) |
| 176 | AM_RANGE(0x0830, 0x083f) AM_MIRROR(0x07c0) AM_DEVREADWRITE("pokey4", pokeyn_device, read, write) |
| 177 | 177 | AM_RANGE(0x1000, 0x1000) AM_MIRROR(0x00ff) AM_READNOP AM_WRITE(irq_ack_w) |
| 178 | 178 | AM_RANGE(0x1100, 0x1100) AM_MIRROR(0x00ff) AM_READNOP AM_WRITEONLY AM_SHARE("speech_data") |
| 179 | 179 | AM_RANGE(0x1200, 0x13ff) AM_READNOP AM_WRITE(speech_strobe_w) |
| r15225 | r15226 | |
| 205 | 205 | |
| 206 | 206 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| 207 | 207 | |
| 208 | | MCFG_SOUND_ADD("pokey1", POKEY, JEDI_POKEY_CLOCK) |
| 208 | MCFG_SOUND_ADD("pokey1", POKEYN, JEDI_POKEY_CLOCK) |
| 209 | 209 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.30) |
| 210 | 210 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.30) |
| 211 | 211 | |
| 212 | | MCFG_SOUND_ADD("pokey2", POKEY, JEDI_POKEY_CLOCK) |
| 212 | MCFG_SOUND_ADD("pokey2", POKEYN, JEDI_POKEY_CLOCK) |
| 213 | 213 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.30) |
| 214 | 214 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.30) |
| 215 | 215 | |
| 216 | | MCFG_SOUND_ADD("pokey3", POKEY, JEDI_POKEY_CLOCK) |
| 216 | MCFG_SOUND_ADD("pokey3", POKEYN, JEDI_POKEY_CLOCK) |
| 217 | 217 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.30) |
| 218 | 218 | |
| 219 | | MCFG_SOUND_ADD("pokey4", POKEY, JEDI_POKEY_CLOCK) |
| 219 | MCFG_SOUND_ADD("pokey4", POKEYN, JEDI_POKEY_CLOCK) |
| 220 | 220 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.30) |
| 221 | 221 | |
| 222 | 222 | MCFG_SOUND_ADD("tms", TMS5220, JEDI_TMS5220_CLOCK) |
src/mame/machine/atari.c
| r15225 | r15226 | |
| 159 | 159 | |
| 160 | 160 | void a800_handle_keyboard(running_machine &machine) |
| 161 | 161 | { |
| 162 | | device_t *pokey = machine.device("pokey"); |
| 162 | pokeyn_device *pokey = machine.device<pokeyn_device>("pokey"); |
| 163 | 163 | int atari_code, count, ipt, i; |
| 164 | 164 | static const char *const tag[] = { |
| 165 | 165 | "keyboard_0", "keyboard_1", "keyboard_2", "keyboard_3", |
| r15225 | r15226 | |
| 198 | 198 | |
| 199 | 199 | if( (atari_code & 0x3f) == AKEY_BREAK ) |
| 200 | 200 | { |
| 201 | | pokey_break_w(pokey, atari_code & 0x40); |
| 201 | pokey->break_w(atari_code & 0x40); |
| 202 | 202 | return; |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | | pokey_kbcode_w(pokey, atari_code, 1); |
| 205 | pokey->kbcode_w(atari_code, 1); |
| 206 | 206 | return; |
| 207 | 207 | } |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | } |
| 211 | 211 | /* remove key pressed status bit from skstat */ |
| 212 | | pokey_kbcode_w(pokey, AKEY_NONE, 0); |
| 212 | pokey->kbcode_w(AKEY_NONE, 0); |
| 213 | 213 | atari_last = AKEY_NONE; |
| 214 | 214 | } |
| 215 | 215 | |
| r15225 | r15226 | |
| 244 | 244 | |
| 245 | 245 | void a5200_handle_keypads(running_machine &machine) |
| 246 | 246 | { |
| 247 | | device_t *pokey = machine.device("pokey"); |
| 247 | pokeyn_device *pokey = downcast<pokeyn_device *>(machine.device("pokey")); |
| 248 | 248 | int atari_code, count, ipt, i; |
| 249 | 249 | static const char *const tag[] = { "keypad_0", "keypad_1", "keypad_2", "keypad_3" }; |
| 250 | 250 | |
| r15225 | r15226 | |
| 270 | 270 | |
| 271 | 271 | if( atari_code == 0 ) |
| 272 | 272 | { |
| 273 | | pokey_break_w(pokey, atari_code & 0x40); |
| 273 | pokey->break_w(atari_code & 0x40); |
| 274 | 274 | return; |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | | pokey_kbcode_w(pokey, (atari_code << 1) | 0x21, 1); |
| 277 | pokey->kbcode_w((atari_code << 1) | 0x21, 1); |
| 278 | 278 | return; |
| 279 | 279 | } |
| 280 | 280 | |
| r15225 | r15226 | |
| 285 | 285 | { |
| 286 | 286 | if (atari_last == 0xfe) |
| 287 | 287 | return; |
| 288 | | pokey_kbcode_w(pokey, 0x61, 1); |
| 288 | pokey->kbcode_w(0x61, 1); |
| 289 | 289 | //pokey_break_w(pokey, 0x40); |
| 290 | 290 | atari_last = 0xfe; |
| 291 | 291 | return; |
| 292 | 292 | } |
| 293 | 293 | else if (atari_last == 0xfe) |
| 294 | | pokey_kbcode_w(pokey, 0x21, 1); |
| 294 | pokey->kbcode_w(0x21, 1); |
| 295 | 295 | |
| 296 | 296 | /* remove key pressed status bit from skstat */ |
| 297 | | pokey_kbcode_w(pokey, 0xff, 0); |
| 297 | pokey->kbcode_w(0xff, 0); |
| 298 | 298 | atari_last = 0xff; |
| 299 | 299 | } |
| 300 | 300 | |
| r15225 | r15226 | |
| 308 | 308 | |
| 309 | 309 | static void pokey_reset(running_machine &machine) |
| 310 | 310 | { |
| 311 | | device_t *pokey = machine.device("pokey"); |
| 312 | | pokey_w(pokey,15,0); |
| 311 | pokeyn_device *pokey = downcast<pokeyn_device *>(machine.device("pokey")); |
| 312 | pokey->write(15,0); |
| 313 | 313 | atari_last = 0xff; |
| 314 | 314 | } |
| 315 | 315 | |
src/mame/drivers/foodf.c
| r15225 | r15226 | |
| 221 | 221 | AM_RANGE(0x950000, 0x9501ff) AM_MIRROR(0x023e00) AM_WRITE(foodf_paletteram_w) AM_SHARE("paletteram") |
| 222 | 222 | AM_RANGE(0x954000, 0x954001) AM_MIRROR(0x023ffe) AM_WRITE(nvram_recall_w) |
| 223 | 223 | AM_RANGE(0x958000, 0x958001) AM_MIRROR(0x023ffe) AM_READWRITE(watchdog_reset16_r, watchdog_reset16_w) |
| 224 | | AM_RANGE(0xa40000, 0xa4001f) AM_MIRROR(0x03ffe0) AM_DEVREADWRITE8_LEGACY("pokey2", pokey_r, pokey_w, 0x00ff) |
| 225 | | AM_RANGE(0xa80000, 0xa8001f) AM_MIRROR(0x03ffe0) AM_DEVREADWRITE8_LEGACY("pokey1", pokey_r, pokey_w, 0x00ff) |
| 226 | | AM_RANGE(0xac0000, 0xac001f) AM_MIRROR(0x03ffe0) AM_DEVREADWRITE8_LEGACY("pokey3", pokey_r, pokey_w, 0x00ff) |
| 224 | AM_RANGE(0xa40000, 0xa4001f) AM_MIRROR(0x03ffe0) AM_DEVREADWRITE8("pokey2", pokeyn_device, read, write, 0x00ff) |
| 225 | AM_RANGE(0xa80000, 0xa8001f) AM_MIRROR(0x03ffe0) AM_DEVREADWRITE8("pokey1", pokeyn_device, read, write, 0x00ff) |
| 226 | AM_RANGE(0xac0000, 0xac001f) AM_MIRROR(0x03ffe0) AM_DEVREADWRITE8("pokey3", pokeyn_device, read, write, 0x00ff) |
| 227 | 227 | ADDRESS_MAP_END |
| 228 | 228 | |
| 229 | 229 | |
| r15225 | r15226 | |
| 380 | 380 | /* sound hardware */ |
| 381 | 381 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 382 | 382 | |
| 383 | | MCFG_SOUND_ADD("pokey1", POKEY, MASTER_CLOCK/2/10) |
| 383 | MCFG_SOUND_ADD("pokey1", POKEYN, MASTER_CLOCK/2/10) |
| 384 | 384 | MCFG_SOUND_CONFIG(pokey_config) |
| 385 | 385 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.33) |
| 386 | 386 | |
| 387 | | MCFG_SOUND_ADD("pokey2", POKEY, MASTER_CLOCK/2/10) |
| 387 | MCFG_SOUND_ADD("pokey2", POKEYN, MASTER_CLOCK/2/10) |
| 388 | 388 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.33) |
| 389 | 389 | |
| 390 | | MCFG_SOUND_ADD("pokey3", POKEY, MASTER_CLOCK/2/10) |
| 390 | MCFG_SOUND_ADD("pokey3", POKEYN, MASTER_CLOCK/2/10) |
| 391 | 391 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.33) |
| 392 | 392 | MACHINE_CONFIG_END |
| 393 | 393 | |
src/mame/drivers/liberatr.c
| r15225 | r15226 | |
| 231 | 231 | AM_RANGE(0x6c05, 0x6c06) AM_WRITE(coin_counter_w) |
| 232 | 232 | AM_RANGE(0x6c07, 0x6c07) AM_WRITEONLY AM_SHARE("planet_select") |
| 233 | 233 | AM_RANGE(0x6e00, 0x6e3f) AM_WRITE(earom_w) |
| 234 | | AM_RANGE(0x7000, 0x701f) AM_DEVREADWRITE_LEGACY("pokey2", pokey_r, pokey_w) |
| 235 | | AM_RANGE(0x7800, 0x781f) AM_DEVREADWRITE_LEGACY("pokey1", pokey_r, pokey_w) |
| 234 | AM_RANGE(0x7000, 0x701f) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write) |
| 235 | AM_RANGE(0x7800, 0x781f) AM_DEVREADWRITE("pokey1", pokeyn_device, read, write) |
| 236 | 236 | AM_RANGE(0x8000, 0xefff) AM_ROM |
| 237 | 237 | AM_RANGE(0xfffa, 0xffff) AM_ROM |
| 238 | 238 | ADDRESS_MAP_END |
| r15225 | r15226 | |
| 264 | 264 | AM_RANGE(0x4c05, 0x4c06) AM_WRITE(coin_counter_w) |
| 265 | 265 | AM_RANGE(0x4c07, 0x4c07) AM_WRITEONLY AM_SHARE("planet_select") |
| 266 | 266 | AM_RANGE(0x4e00, 0x4e3f) AM_WRITE(earom_w) |
| 267 | | AM_RANGE(0x5000, 0x501f) AM_DEVREADWRITE_LEGACY("pokey2", pokey_r, pokey_w) |
| 268 | | AM_RANGE(0x5800, 0x581f) AM_DEVREADWRITE_LEGACY("pokey1", pokey_r, pokey_w) |
| 267 | AM_RANGE(0x5000, 0x501f) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write) |
| 268 | AM_RANGE(0x5800, 0x581f) AM_DEVREADWRITE("pokey1", pokeyn_device, read, write) |
| 269 | 269 | //AM_RANGE(0x6000, 0x601f) AM_WRITE(pokey1_w) /* bug ??? */ |
| 270 | 270 | AM_RANGE(0x6000, 0xbfff) AM_ROM |
| 271 | 271 | AM_RANGE(0xfffa, 0xffff) AM_ROM |
| r15225 | r15226 | |
| 404 | 404 | /* sound hardware */ |
| 405 | 405 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 406 | 406 | |
| 407 | | MCFG_SOUND_ADD("pokey1", POKEY, MASTER_CLOCK/16) /* 1.25Mhz from Phi2 signal from 6502 */ |
| 407 | MCFG_SOUND_ADD("pokey1", POKEYN, MASTER_CLOCK/16) /* 1.25Mhz from Phi2 signal from 6502 */ |
| 408 | 408 | MCFG_SOUND_CONFIG(pokey_interface_1) |
| 409 | 409 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 410 | 410 | |
| 411 | | MCFG_SOUND_ADD("pokey2", POKEY, MASTER_CLOCK/16) /* 1.25Mhz from Phi2 signal from 6502 */ |
| 411 | MCFG_SOUND_ADD("pokey2", POKEYN, MASTER_CLOCK/16) /* 1.25Mhz from Phi2 signal from 6502 */ |
| 412 | 412 | MCFG_SOUND_CONFIG(pokey_interface_2) |
| 413 | 413 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 414 | 414 | MACHINE_CONFIG_END |
src/mame/drivers/centiped.c
| r15225 | r15226 | |
| 692 | 692 | AM_RANGE(0x0c01, 0x0c01) AM_READ_PORT("IN1") /* IN1 */ |
| 693 | 693 | AM_RANGE(0x0c02, 0x0c02) AM_READ(centiped_IN2_r) /* IN2 */ |
| 694 | 694 | AM_RANGE(0x0c03, 0x0c03) AM_READ_PORT("IN3") /* IN3 */ |
| 695 | | AM_RANGE(0x1000, 0x100f) AM_DEVREADWRITE_LEGACY("pokey", pokey_r, pokey_w) |
| 695 | AM_RANGE(0x1000, 0x100f) AM_DEVREADWRITE("pokey", pokeyn_device, read, write) |
| 696 | 696 | AM_RANGE(0x1400, 0x140f) AM_WRITE(centiped_paletteram_w) AM_SHARE("paletteram") |
| 697 | 697 | AM_RANGE(0x1600, 0x163f) AM_DEVWRITE("earom",atari_vg_earom_device, write) |
| 698 | 698 | AM_RANGE(0x1680, 0x1680) AM_DEVWRITE("earom", atari_vg_earom_device, ctrl_w) |
| r15225 | r15226 | |
| 743 | 743 | static ADDRESS_MAP_START( milliped_map, AS_PROGRAM, 8, centiped_state ) |
| 744 | 744 | ADDRESS_MAP_GLOBAL_MASK(0x7fff) |
| 745 | 745 | AM_RANGE(0x0000, 0x03ff) AM_RAM |
| 746 | | AM_RANGE(0x0400, 0x040f) AM_DEVREADWRITE_LEGACY("pokey", pokey_r, pokey_w) |
| 747 | | AM_RANGE(0x0800, 0x080f) AM_DEVREADWRITE_LEGACY("pokey2", pokey_r, pokey_w) |
| 746 | AM_RANGE(0x0400, 0x040f) AM_DEVREADWRITE("pokey", pokeyn_device, read, write) |
| 747 | AM_RANGE(0x0800, 0x080f) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write) |
| 748 | 748 | AM_RANGE(0x1000, 0x13bf) AM_RAM_WRITE(centiped_videoram_w) AM_SHARE("videoram") |
| 749 | 749 | AM_RANGE(0x13c0, 0x13ff) AM_RAM AM_SHARE("spriteram") |
| 750 | 750 | AM_RANGE(0x2000, 0x2000) AM_READ(centiped_IN0_r) |
| r15225 | r15226 | |
| 782 | 782 | AM_RANGE(0x0801, 0x0801) AM_READ_PORT("DSW2") /* DSW2 */ |
| 783 | 783 | AM_RANGE(0x0c00, 0x0c00) AM_READ_PORT("IN0") /* IN0 */ |
| 784 | 784 | AM_RANGE(0x0c01, 0x0c01) AM_READ_PORT("IN1") /* IN1 */ |
| 785 | | AM_RANGE(0x1000, 0x100f) AM_DEVREADWRITE_LEGACY("pokey", pokey_r, pokey_w) |
| 785 | AM_RANGE(0x1000, 0x100f) AM_DEVREADWRITE("pokey", pokeyn_device, read, write) |
| 786 | 786 | AM_RANGE(0x1800, 0x1800) AM_WRITE(irq_ack_w) |
| 787 | 787 | AM_RANGE(0x1c00, 0x1c02) AM_WRITE(coin_count_w) |
| 788 | 788 | AM_RANGE(0x1c03, 0x1c06) AM_WRITE(led_w) |
| r15225 | r15226 | |
| 801 | 801 | static ADDRESS_MAP_START( mazeinv_map, AS_PROGRAM, 8, centiped_state ) |
| 802 | 802 | ADDRESS_MAP_GLOBAL_MASK(0x7fff) |
| 803 | 803 | AM_RANGE(0x0000, 0x03ff) AM_RAM |
| 804 | | AM_RANGE(0x0400, 0x040f) AM_DEVREADWRITE_LEGACY("pokey", pokey_r, pokey_w) |
| 805 | | AM_RANGE(0x0800, 0x080f) AM_DEVREADWRITE_LEGACY("pokey2", pokey_r, pokey_w) |
| 804 | AM_RANGE(0x0400, 0x040f) AM_DEVREADWRITE("pokey", pokeyn_device, read, write) |
| 805 | AM_RANGE(0x0800, 0x080f) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write) |
| 806 | 806 | AM_RANGE(0x1000, 0x13bf) AM_RAM_WRITE(centiped_videoram_w) AM_SHARE("videoram") |
| 807 | 807 | AM_RANGE(0x13c0, 0x13ff) AM_RAM AM_SHARE("spriteram") |
| 808 | 808 | AM_RANGE(0x2000, 0x2000) AM_READ_PORT("IN0") |
| r15225 | r15226 | |
| 1622 | 1622 | /* sound hardware */ |
| 1623 | 1623 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 1624 | 1624 | |
| 1625 | | MCFG_SOUND_ADD("pokey", POKEY, 12096000/8) |
| 1625 | MCFG_SOUND_ADD("pokey", POKEYN, 12096000/8) |
| 1626 | 1626 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 1627 | 1627 | MACHINE_CONFIG_END |
| 1628 | 1628 | |
| r15225 | r15226 | |
| 1677 | 1677 | MCFG_SCREEN_UPDATE_STATIC(milliped) |
| 1678 | 1678 | |
| 1679 | 1679 | /* sound hardware */ |
| 1680 | | MCFG_SOUND_REPLACE("pokey", POKEY, 12096000/8) |
| 1680 | MCFG_SOUND_REPLACE("pokey", POKEYN, 12096000/8) |
| 1681 | 1681 | MCFG_SOUND_CONFIG(milliped_pokey_interface_1) |
| 1682 | 1682 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 1683 | 1683 | |
| 1684 | | MCFG_SOUND_ADD("pokey2", POKEY, 12096000/8) |
| 1684 | MCFG_SOUND_ADD("pokey2", POKEYN, 12096000/8) |
| 1685 | 1685 | MCFG_SOUND_CONFIG(milliped_pokey_interface_2) |
| 1686 | 1686 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 1687 | 1687 | MACHINE_CONFIG_END |
| r15225 | r15226 | |
| 1703 | 1703 | MCFG_SCREEN_UPDATE_STATIC(warlords) |
| 1704 | 1704 | |
| 1705 | 1705 | /* sound hardware */ |
| 1706 | | MCFG_SOUND_REPLACE("pokey", POKEY, 12096000/8) |
| 1706 | MCFG_SOUND_REPLACE("pokey", POKEYN, 12096000/8) |
| 1707 | 1707 | MCFG_SOUND_CONFIG(warlords_pokey_interface) |
| 1708 | 1708 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 1709 | 1709 | MACHINE_CONFIG_END |
src/mame/drivers/firefox.c
| r15225 | r15226 | |
| 550 | 550 | AM_RANGE(0x0880, 0x089f) AM_MIRROR(0x07e0) AM_DEVREADWRITE_LEGACY("riot",riot6532_r, riot6532_w) |
| 551 | 551 | AM_RANGE(0x1000, 0x1000) AM_READ(main_to_sound_r) |
| 552 | 552 | AM_RANGE(0x1800, 0x1800) AM_WRITE(sound_to_main_w) |
| 553 | | AM_RANGE(0x2000, 0x200f) AM_DEVREADWRITE_LEGACY("pokey1", pokey_r, pokey_w) |
| 554 | | AM_RANGE(0x2800, 0x280f) AM_DEVREADWRITE_LEGACY("pokey2", pokey_r, pokey_w) |
| 555 | | AM_RANGE(0x3000, 0x300f) AM_DEVREADWRITE_LEGACY("pokey3", pokey_r, pokey_w) |
| 556 | | AM_RANGE(0x3800, 0x380f) AM_DEVREADWRITE_LEGACY("pokey4", pokey_r, pokey_w) |
| 553 | AM_RANGE(0x2000, 0x200f) AM_DEVREADWRITE("pokey1", pokeyn_device, read, write) |
| 554 | AM_RANGE(0x2800, 0x280f) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write) |
| 555 | AM_RANGE(0x3000, 0x300f) AM_DEVREADWRITE("pokey3", pokeyn_device, read, write) |
| 556 | AM_RANGE(0x3800, 0x380f) AM_DEVREADWRITE("pokey4", pokeyn_device, read, write) |
| 557 | 557 | AM_RANGE(0x8000, 0xffff) AM_ROM |
| 558 | 558 | ADDRESS_MAP_END |
| 559 | 559 | |
| r15225 | r15226 | |
| 727 | 727 | /* sound hardware */ |
| 728 | 728 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| 729 | 729 | |
| 730 | | MCFG_SOUND_ADD("pokey1", POKEY, MASTER_XTAL/8) |
| 730 | MCFG_SOUND_ADD("pokey1", POKEYN, MASTER_XTAL/8) |
| 731 | 731 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.30) |
| 732 | 732 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.30) |
| 733 | 733 | |
| 734 | | MCFG_SOUND_ADD("pokey2", POKEY, MASTER_XTAL/8) |
| 734 | MCFG_SOUND_ADD("pokey2", POKEYN, MASTER_XTAL/8) |
| 735 | 735 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.30) |
| 736 | 736 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.30) |
| 737 | 737 | |
| 738 | | MCFG_SOUND_ADD("pokey3", POKEY, MASTER_XTAL/8) |
| 738 | MCFG_SOUND_ADD("pokey3", POKEYN, MASTER_XTAL/8) |
| 739 | 739 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.30) |
| 740 | 740 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.30) |
| 741 | 741 | |
| 742 | | MCFG_SOUND_ADD("pokey4", POKEY, MASTER_XTAL/8) |
| 742 | MCFG_SOUND_ADD("pokey4", POKEYN, MASTER_XTAL/8) |
| 743 | 743 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.30) |
| 744 | 744 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.30) |
| 745 | 745 | |
src/mame/drivers/mhavoc.c
| r15225 | r15226 | |
| 206 | 206 | int pokey_reg = (offset % 8) | control; |
| 207 | 207 | |
| 208 | 208 | if (pokey_num == 0) |
| 209 | | return pokey_r(machine().device("pokey1"), pokey_reg); |
| 209 | return machine().device<pokeyn_device>("pokey1")->read(pokey_reg); |
| 210 | 210 | else |
| 211 | | return pokey_r(machine().device("pokey2"), pokey_reg); |
| 211 | return machine().device<pokeyn_device>("pokey2")->read(pokey_reg); |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | |
| r15225 | r15226 | |
| 219 | 219 | int pokey_reg = (offset % 8) | control; |
| 220 | 220 | |
| 221 | 221 | if (pokey_num == 0) |
| 222 | | pokey_w(machine().device("pokey1"), pokey_reg, data); |
| 222 | machine().device<pokeyn_device>("pokey1")->write(pokey_reg, data); |
| 223 | 223 | else |
| 224 | | pokey_w(machine().device("pokey2"), pokey_reg, data); |
| 224 | machine().device<pokeyn_device>("pokey2")->write(pokey_reg, data); |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | |
| r15225 | r15226 | |
| 265 | 265 | static ADDRESS_MAP_START( gamma_map, AS_PROGRAM, 8, mhavoc_state ) |
| 266 | 266 | AM_RANGE(0x0000, 0x07ff) AM_RAM /* Program RAM (2K) */ |
| 267 | 267 | AM_RANGE(0x0800, 0x0fff) AM_RAM AM_MIRROR (0x1800) |
| 268 | | AM_RANGE(0x2000, 0x203f) AM_READWRITE_LEGACY(quad_pokey_r, quad_pokey_w) /* Quad Pokey read */ |
| 268 | AM_RANGE(0x2000, 0x203f) AM_READWRITE_LEGACY(quad_pokeyn_r, quad_pokeyn_w) /* Quad Pokey read */ |
| 269 | 269 | AM_RANGE(0x2800, 0x2800) AM_READ_PORT("IN1") /* Gamma Input Port */ |
| 270 | 270 | AM_RANGE(0x3000, 0x3000) AM_READ(mhavoc_alpha_r) /* Alpha Comm. Read Port*/ |
| 271 | 271 | AM_RANGE(0x3800, 0x3803) AM_READ_PORT("DIAL") /* Roller Controller Input*/ |
| r15225 | r15226 | |
| 499 | 499 | /* sound hardware */ |
| 500 | 500 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 501 | 501 | |
| 502 | | MCFG_SOUND_ADD("pokey1", POKEY, MHAVOC_CLOCK_1_25M) |
| 502 | MCFG_SOUND_ADD("pokey1", POKEYN, MHAVOC_CLOCK_1_25M) |
| 503 | 503 | MCFG_SOUND_CONFIG(pokey_config) |
| 504 | 504 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 505 | 505 | |
| 506 | | MCFG_SOUND_ADD("pokey2", POKEY, MHAVOC_CLOCK_1_25M) |
| 506 | MCFG_SOUND_ADD("pokey2", POKEYN, MHAVOC_CLOCK_1_25M) |
| 507 | 507 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 508 | 508 | |
| 509 | | MCFG_SOUND_ADD("pokey3", POKEY, MHAVOC_CLOCK_1_25M) |
| 509 | MCFG_SOUND_ADD("pokey3", POKEYN, MHAVOC_CLOCK_1_25M) |
| 510 | 510 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 511 | 511 | |
| 512 | | MCFG_SOUND_ADD("pokey4", POKEY, MHAVOC_CLOCK_1_25M) |
| 512 | MCFG_SOUND_ADD("pokey4", POKEYN, MHAVOC_CLOCK_1_25M) |
| 513 | 513 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 514 | 514 | MACHINE_CONFIG_END |
| 515 | 515 | |
| r15225 | r15226 | |
| 532 | 532 | MCFG_SCREEN_VISIBLE_AREA(0, 580, 0, 500) |
| 533 | 533 | |
| 534 | 534 | /* sound hardware */ |
| 535 | | MCFG_SOUND_REPLACE("pokey1", POKEY, MHAVOC_CLOCK_1_25M) |
| 535 | MCFG_SOUND_REPLACE("pokey1", POKEYN, MHAVOC_CLOCK_1_25M) |
| 536 | 536 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 537 | 537 | |
| 538 | | MCFG_SOUND_REPLACE("pokey2", POKEY, MHAVOC_CLOCK_1_25M) |
| 538 | MCFG_SOUND_REPLACE("pokey2", POKEYN, MHAVOC_CLOCK_1_25M) |
| 539 | 539 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 540 | 540 | |
| 541 | 541 | MCFG_DEVICE_REMOVE("pokey3") |
src/mame/drivers/bwidow.c
| r15225 | r15226 | |
| 369 | 369 | AM_RANGE(0x0000, 0x07ff) AM_RAM |
| 370 | 370 | AM_RANGE(0x2000, 0x27ff) AM_RAM AM_BASE_LEGACY(&avgdvg_vectorram) AM_SIZE_LEGACY(&avgdvg_vectorram_size) AM_REGION("maincpu", 0x2000) |
| 371 | 371 | AM_RANGE(0x2800, 0x5fff) AM_ROM |
| 372 | | AM_RANGE(0x6000, 0x67ff) AM_DEVREADWRITE_LEGACY("pokey1", pokey_r, pokey_w) |
| 373 | | AM_RANGE(0x6800, 0x6fff) AM_DEVREADWRITE_LEGACY("pokey2", pokey_r, pokey_w) |
| 372 | AM_RANGE(0x6000, 0x67ff) AM_DEVREADWRITE("pokey1", pokeyn_device, read, write) |
| 373 | AM_RANGE(0x6800, 0x6fff) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write) |
| 374 | 374 | AM_RANGE(0x7000, 0x7000) AM_DEVREAD("earom", atari_vg_earom_device, read) |
| 375 | 375 | AM_RANGE(0x7800, 0x7800) AM_READ_PORT("IN0") |
| 376 | 376 | AM_RANGE(0x8000, 0x8000) AM_READ_PORT("IN3") |
| r15225 | r15226 | |
| 399 | 399 | AM_RANGE(0x0e00, 0x0e00) AM_WRITE(irq_ack_w) /* interrupt acknowledge */ |
| 400 | 400 | AM_RANGE(0x0e80, 0x0e80) AM_DEVWRITE("earom", atari_vg_earom_device, ctrl_w) |
| 401 | 401 | AM_RANGE(0x0f00, 0x0f3f) AM_DEVWRITE("earom", atari_vg_earom_device, write) |
| 402 | | AM_RANGE(0x1000, 0x100f) AM_DEVREADWRITE_LEGACY("pokey1", pokey_r, pokey_w) |
| 403 | | AM_RANGE(0x1400, 0x140f) AM_DEVREADWRITE_LEGACY("pokey2", pokey_r, pokey_w) |
| 402 | AM_RANGE(0x1000, 0x100f) AM_DEVREADWRITE("pokey1", pokeyn_device, read, write) |
| 403 | AM_RANGE(0x1400, 0x140f) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write) |
| 404 | 404 | AM_RANGE(0x2000, 0x27ff) AM_RAM AM_BASE_LEGACY(&avgdvg_vectorram) AM_SIZE_LEGACY(&avgdvg_vectorram_size) AM_REGION("maincpu", 0x2000) |
| 405 | 405 | AM_RANGE(0x2800, 0x3fff) AM_ROM |
| 406 | 406 | AM_RANGE(0x4000, 0xffff) AM_ROM |
| r15225 | r15226 | |
| 744 | 744 | /* sound hardware */ |
| 745 | 745 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 746 | 746 | |
| 747 | | MCFG_SOUND_ADD("pokey1", POKEY, MASTER_CLOCK / 8) |
| 747 | MCFG_SOUND_ADD("pokey1", POKEYN, MASTER_CLOCK / 8) |
| 748 | 748 | MCFG_SOUND_CONFIG(pokey_interface_1) |
| 749 | 749 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 750 | 750 | |
| 751 | | MCFG_SOUND_ADD("pokey2", POKEY, MASTER_CLOCK / 8) |
| 751 | MCFG_SOUND_ADD("pokey2", POKEYN, MASTER_CLOCK / 8) |
| 752 | 752 | MCFG_SOUND_CONFIG(pokey_interface_2) |
| 753 | 753 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 754 | 754 | MACHINE_CONFIG_END |
src/osd/windows/drawdd.c
| r15225 | r15226 | |
| 418 | 418 | { |
| 419 | 419 | case 0x00ff0000: software_renderer<UINT32, 0,0,0, 16,8,0, true>::draw_primitives(*window->primlist, dd->blitdesc.lpSurface, dd->blitwidth, dd->blitheight, dd->blitdesc.lPitch / 4); break; |
| 420 | 420 | case 0x000000ff: software_renderer<UINT32, 0,0,0, 0,8,16, true>::draw_primitives(*window->primlist, dd->blitdesc.lpSurface, dd->blitwidth, dd->blitheight, dd->blitdesc.lPitch / 4); break; |
| 421 | | case 0xf800: software_renderer<UINT32, 3,2,3, 11,5,0, true>::draw_primitives(*window->primlist, dd->blitdesc.lpSurface, dd->blitwidth, dd->blitheight, dd->blitdesc.lPitch / 2); break; |
| 422 | | case 0x7c00: software_renderer<UINT32, 3,3,3, 10,5,0, true>::draw_primitives(*window->primlist, dd->blitdesc.lpSurface, dd->blitwidth, dd->blitheight, dd->blitdesc.lPitch / 2); break; |
| 421 | case 0xf800: software_renderer<UINT16, 3,2,3, 11,5,0, true>::draw_primitives(*window->primlist, dd->blitdesc.lpSurface, dd->blitwidth, dd->blitheight, dd->blitdesc.lPitch / 2); break; |
| 422 | case 0x7c00: software_renderer<UINT16, 3,3,3, 10,5,0, true>::draw_primitives(*window->primlist, dd->blitdesc.lpSurface, dd->blitwidth, dd->blitheight, dd->blitdesc.lPitch / 2); break; |
| 423 | 423 | default: |
| 424 | 424 | mame_printf_verbose("DirectDraw: Unknown target mode: R=%08X G=%08X B=%08X\n", (int)dd->blitdesc.ddpfPixelFormat.dwRBitMask, (int)dd->blitdesc.ddpfPixelFormat.dwGBitMask, (int)dd->blitdesc.ddpfPixelFormat.dwBBitMask); |
| 425 | 425 | break; |
src/emu/sound/pokey.c
| r15225 | r15226 | |
| 87 | 87 | |
| 88 | 88 | #define VERBOSE 1 |
| 89 | 89 | #define VERBOSE_SOUND 0 |
| 90 | | #define VERBOSE_TIMER |
| 90 | #define VERBOSE_TIMER 1 |
| 91 | 91 | #define VERBOSE_POLY 0 |
| 92 | | #define VERBOSE_RAND 1 |
| 92 | #define VERBOSE_RAND |
| 93 | 93 | |
| 94 | 94 | #define LOG(x) do { if (VERBOSE) logerror x; } while (0) |
| 95 | 95 | |
| r15225 | r15226 | |
| 236 | 236 | INLINE pokey_state *get_safe_token(device_t *device) |
| 237 | 237 | { |
| 238 | 238 | assert(device != NULL); |
| 239 | #ifdef OLDDEVICE_FOR_MESS |
| 239 | 240 | assert(device->type() == POKEY); |
| 241 | #endif |
| 240 | 242 | return (pokey_state *)downcast<legacy_device_base *>(device)->token(); |
| 241 | 243 | } |
| 242 | 244 | |
| r15225 | r15226 | |
| 457 | 459 | |
| 458 | 460 | } |
| 459 | 461 | |
| 460 | | #if 0 |
| 461 | | static void rand_init_old(UINT8 *rng, int size, int left, int right, int add) |
| 462 | | { |
| 463 | | int mask = (1 << size) - 1; |
| 464 | | int i, x = 0; |
| 465 | 462 | |
| 466 | | LOG_RAND(("rand %d\n", size)); |
| 467 | | for( i = 0; i < mask; i++ ) |
| 468 | | { |
| 469 | | if (size == 17) |
| 470 | | *rng = x >> 6; /* use bits 6..13 */ |
| 471 | | else |
| 472 | | *rng = x; /* use bits 0..7 */ |
| 473 | | LOG_RAND(("%05x: %02x\n", x, *rng)); |
| 474 | | rng++; |
| 475 | | /* calculate next bit */ |
| 476 | | x = ((x << left) + (x >> right) + add) & mask; |
| 477 | | } |
| 478 | | } |
| 479 | | #endif |
| 480 | | |
| 481 | 463 | static void register_for_save(pokey_state *chip, device_t *device) |
| 482 | 464 | { |
| 483 | 465 | device->save_item(NAME(chip->counter)); |
| r15225 | r15226 | |
| 548 | 530 | chip->divisor[CHAN2] = 4; |
| 549 | 531 | chip->divisor[CHAN3] = 4; |
| 550 | 532 | chip->divisor[CHAN4] = 4; |
| 533 | |
| 551 | 534 | chip->clockmult = DIV_64; |
| 552 | 535 | chip->KBCODE = 0x09; /* Atari 800 'no key' */ |
| 553 | 536 | chip->SKCTL = SK_RESET; /* let the RNG run after reset */ |
| r15225 | r15226 | |
| 1271 | 1254 | } |
| 1272 | 1255 | } |
| 1273 | 1256 | |
| 1257 | #ifdef OLDDEVICE_FOR_MESS |
| 1274 | 1258 | |
| 1275 | 1259 | DEFINE_LEGACY_SOUND_DEVICE(POKEY, pokey); |
| 1276 | 1260 | |
| 1261 | #endif |
| 1277 | 1262 | |
| 1278 | 1263 | |
| 1279 | 1264 | |
| r15225 | r15226 | |
| 1288 | 1273 | |
| 1289 | 1274 | |
| 1290 | 1275 | |
| 1291 | | |
| 1292 | 1276 | // device type definition |
| 1293 | 1277 | const device_type POKEYN = &device_creator<pokeyn_device>; |
| 1294 | 1278 | |
| r15225 | r15226 | |
| 1303 | 1287 | pokeyn_device::pokeyn_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 1304 | 1288 | : device_t(mconfig, POKEYN, "POKEYN", tag, owner, clock), |
| 1305 | 1289 | device_sound_interface(mconfig, *this), |
| 1290 | #ifdef POKEY_EXEC_INTERFACE |
| 1291 | device_execute_interface(mconfig, *this), |
| 1292 | #endif |
| 1293 | m_icount(0), |
| 1306 | 1294 | m_stream(NULL) |
| 1307 | 1295 | { |
| 1308 | 1296 | } |
| r15225 | r15226 | |
| 1333 | 1321 | m_ad_time_slow = (attotime::from_nsec(64000 ) * FREQ_17_EXACT) / clock(); |
| 1334 | 1322 | |
| 1335 | 1323 | /* initialize the poly counters */ |
| 1336 | | poly_init(m_poly4, 4, 3, 1, 0x00004); |
| 1337 | | poly_init(m_poly5, 5, 3, 2, 0x00008); |
| 1338 | | poly_init(m_poly9, 9, 8, 1, 0x00180); |
| 1339 | | poly_init(m_poly17, 17,16, 1, 0x1c000); |
| 1324 | poly_init_4_5(m_poly4, 4, 1, 0); |
| 1325 | poly_init_4_5(m_poly5, 5, 2, 1); |
| 1326 | //poly_init(m_poly9, 9, 8, 1, 0x00180); |
| 1327 | //poly_init(m_poly17, 17,16, 1, 0x1c000); |
| 1340 | 1328 | |
| 1341 | | /* initialize the random arrays */ |
| 1342 | | rand_init(m_rand9, 9, 8, 1, 0x00180); |
| 1343 | | rand_init(m_rand17, 17,16, 1, 0x1c000); |
| 1329 | /* initialize 9 / 17 arrays */ |
| 1330 | poly_init_9_17(m_poly9, 9); |
| 1331 | poly_init_9_17(m_poly17, 17); |
| 1344 | 1332 | |
| 1345 | 1333 | m_divisor[CHAN1] = 4; |
| 1346 | 1334 | m_divisor[CHAN2] = 4; |
| r15225 | r15226 | |
| 1355 | 1343 | m_timer[1] = timer_alloc(1); |
| 1356 | 1344 | m_timer[2] = timer_alloc(1); |
| 1357 | 1345 | |
| 1346 | /* reset more internal state */ |
| 1347 | for (i=0; i<4; i++) |
| 1348 | { |
| 1349 | m_AUDC[i] = 0; |
| 1350 | m_AUDF[i] = 0; |
| 1351 | m_volume[i] = 0; |
| 1352 | m_borrow_cnt[i] = 0; |
| 1353 | m_counter[i] = 0; |
| 1354 | if (i<3) m_clock_cnt[i] = 0; |
| 1355 | m_filter_sample[i] = 0; |
| 1356 | m_output[i] = 0; |
| 1357 | } |
| 1358 | |
| 1358 | 1359 | for (i=0; i<8; i++) |
| 1359 | 1360 | { |
| 1360 | 1361 | m_ptimer[i] = timer_alloc(2); |
| r15225 | r15226 | |
| 1397 | 1398 | save_item(NAME(m_IRQST)); |
| 1398 | 1399 | save_item(NAME(m_IRQEN)); |
| 1399 | 1400 | save_item(NAME(m_SKSTAT)); |
| 1400 | | save_item(NAME(m_SKCTL));} |
| 1401 | save_item(NAME(m_SKCTL)); |
| 1401 | 1402 | |
| 1403 | // set our instruction counter |
| 1404 | #ifdef POKEY_EXEC_INTERFACE |
| 1405 | m_icountptr = &m_icount; |
| 1406 | #endif |
| 1402 | 1407 | |
| 1408 | } |
| 1409 | |
| 1410 | |
| 1403 | 1411 | //------------------------------------------------- |
| 1404 | 1412 | // device_reset - device-specific reset |
| 1405 | 1413 | //------------------------------------------------- |
| r15225 | r15226 | |
| 1481 | 1489 | (m_interrupt_cb)(this, IRQ_SEROC); |
| 1482 | 1490 | } |
| 1483 | 1491 | } |
| 1492 | else if (id == 5) |
| 1493 | { |
| 1494 | /* serin_ready */ |
| 1495 | if( m_IRQEN & IRQ_SERIN ) |
| 1496 | { |
| 1497 | /* set the enabled timer irq status bits */ |
| 1498 | m_IRQST |= IRQ_SERIN; |
| 1499 | /* call back an application supplied function to handle the interrupt */ |
| 1500 | if( m_interrupt_cb ) |
| 1501 | (m_interrupt_cb)(this, IRQ_SERIN); |
| 1502 | } |
| 1503 | } |
| 1484 | 1504 | else |
| 1485 | 1505 | assert_always(FALSE, "Unknown id in pokey_device::device_timer"); |
| 1486 | 1506 | } |
| r15225 | r15226 | |
| 1596 | 1616 | sum += (((m_output[ch] ^ m_filter_sample[ch]) || (m_AUDC[ch] & VOLUME_ONLY)) ? m_volume[ch] : 0 ); |
| 1597 | 1617 | } |
| 1598 | 1618 | |
| 1619 | #if 0 |
| 1620 | { |
| 1621 | static int old_sum = 0; |
| 1622 | if (sum != old_sum) |
| 1623 | { |
| 1624 | old_sum = sum; |
| 1625 | printf("sum %d\n", sum); |
| 1626 | } |
| 1627 | } |
| 1628 | #endif |
| 1629 | |
| 1599 | 1630 | /* store sum of output signals into the buffer */ |
| 1631 | |
| 1600 | 1632 | *buffer++ = (sum > 0x7fff) ? 0x7fff : sum; |
| 1601 | 1633 | samples--; |
| 1602 | 1634 | |
| r15225 | r15226 | |
| 1613 | 1645 | |
| 1614 | 1646 | READ8_MEMBER( pokeyn_device::read ) |
| 1615 | 1647 | { |
| 1648 | return read(offset); |
| 1649 | } |
| 1650 | |
| 1651 | UINT8 pokeyn_device::read(offs_t offset) |
| 1652 | { |
| 1616 | 1653 | int data = 0, pot; |
| 1617 | 1654 | UINT32 adjust = 0; |
| 1618 | 1655 | |
| r15225 | r15226 | |
| 1693 | 1730 | } |
| 1694 | 1731 | if( m_AUDCTL & POLY9 ) |
| 1695 | 1732 | { |
| 1696 | | m_RANDOM = m_rand9[m_r9]; |
| 1733 | m_RANDOM = m_poly9[m_r9] & 0xff; |
| 1697 | 1734 | LOG_RAND(("POKEY '%s' adjust %u rand9[$%05x]: $%02x\n", tag(), adjust, m_r9, m_RANDOM)); |
| 1698 | 1735 | } |
| 1699 | 1736 | else |
| 1700 | 1737 | { |
| 1701 | | m_RANDOM = m_rand17[m_r17]; |
| 1738 | m_RANDOM = (m_poly17[m_r17] >> 8) & 0xff; |
| 1702 | 1739 | LOG_RAND(("POKEY '%s' adjust %u rand17[$%05x]: $%02x\n", tag(), adjust, m_r17, m_RANDOM)); |
| 1703 | 1740 | } |
| 1704 | 1741 | if (adjust > 0) |
| r15225 | r15226 | |
| 1741 | 1778 | |
| 1742 | 1779 | WRITE8_MEMBER( pokeyn_device::write ) |
| 1743 | 1780 | { |
| 1744 | | write_cmd(offset, data); |
| 1781 | write(offset, data); |
| 1745 | 1782 | } |
| 1746 | 1783 | |
| 1747 | | void pokeyn_device::write_cmd(int offset, UINT8 data) |
| 1784 | void pokeyn_device::write(offs_t offset, UINT8 data) |
| 1748 | 1785 | { |
| 1749 | 1786 | int ch_mask = 0, new_val; |
| 1750 | 1787 | |
| r15225 | r15226 | |
| 1977 | 2014 | m_SKCTL = data; |
| 1978 | 2015 | if( !(data & SK_RESET) ) |
| 1979 | 2016 | { |
| 1980 | | write_cmd(IRQEN_C, 0); |
| 1981 | | write_cmd(SKREST_C, 0); |
| 2017 | write(IRQEN_C, 0); |
| 2018 | write(SKREST_C, 0); |
| 1982 | 2019 | } |
| 1983 | 2020 | break; |
| 1984 | 2021 | } |
| r15225 | r15226 | |
| 2071 | 2108 | } |
| 2072 | 2109 | } |
| 2073 | 2110 | |
| 2111 | void pokeyn_device::serin_ready(int after) |
| 2112 | { |
| 2113 | timer_set(m_clock_period * after, 5, 0); |
| 2114 | } |
| 2074 | 2115 | |
| 2116 | void pokeyn_device::break_w(int shift) |
| 2117 | { |
| 2118 | if( shift ) /* shift code ? */ |
| 2119 | m_SKSTAT |= SK_SHIFT; |
| 2120 | else |
| 2121 | m_SKSTAT &= ~SK_SHIFT; |
| 2122 | /* check if the break IRQ is enabled */ |
| 2123 | if( m_IRQEN & IRQ_BREAK ) |
| 2124 | { |
| 2125 | /* set break IRQ status and call back the interrupt handler */ |
| 2126 | m_IRQST |= IRQ_BREAK; |
| 2127 | if( m_interrupt_cb ) |
| 2128 | (*m_interrupt_cb)(this, IRQ_BREAK); |
| 2129 | } |
| 2130 | } |
| 2131 | |
| 2132 | void pokeyn_device::kbcode_w(int kbcode, int make) |
| 2133 | { |
| 2134 | /* make code ? */ |
| 2135 | if( make ) |
| 2136 | { |
| 2137 | m_KBCODE = kbcode; |
| 2138 | m_SKSTAT |= SK_KEYBD; |
| 2139 | if( kbcode & 0x40 ) /* shift code ? */ |
| 2140 | m_SKSTAT |= SK_SHIFT; |
| 2141 | else |
| 2142 | m_SKSTAT &= ~SK_SHIFT; |
| 2143 | |
| 2144 | if( m_IRQEN & IRQ_KEYBD ) |
| 2145 | { |
| 2146 | /* last interrupt not acknowledged ? */ |
| 2147 | if( m_IRQST & IRQ_KEYBD ) |
| 2148 | m_SKSTAT |= SK_KBERR; |
| 2149 | m_IRQST |= IRQ_KEYBD; |
| 2150 | if( m_interrupt_cb ) |
| 2151 | (*m_interrupt_cb)(this, IRQ_KEYBD); |
| 2152 | } |
| 2153 | } |
| 2154 | else |
| 2155 | { |
| 2156 | m_KBCODE = kbcode; |
| 2157 | m_SKSTAT &= ~SK_KEYBD; |
| 2158 | } |
| 2159 | } |
| 2160 | |
| 2161 | |
| 2162 | |
| 2075 | 2163 | //------------------------------------------------- |
| 2076 | 2164 | // private stuff |
| 2077 | 2165 | //------------------------------------------------- |
| r15225 | r15226 | |
| 2080 | 2168 | { |
| 2081 | 2169 | int toggle = 0; |
| 2082 | 2170 | |
| 2083 | | if( (m_AUDC[ch] & NOTPOLY5) || m_poly5[m_p5] ) |
| 2171 | if( (m_AUDC[ch] & NOTPOLY5) || (m_poly5[m_p5] & 1) ) |
| 2084 | 2172 | { |
| 2085 | 2173 | if( m_AUDC[ch] & PURE ) |
| 2086 | 2174 | toggle = 1; |
| 2087 | 2175 | else |
| 2088 | 2176 | if( m_AUDC[ch] & POLY4 ) |
| 2089 | | toggle = m_output[ch] == !m_poly4[m_p4]; |
| 2177 | toggle = m_output[ch] == !(m_poly4[m_p4] & 1); |
| 2090 | 2178 | else |
| 2091 | 2179 | if( m_AUDCTL & POLY9 ) |
| 2092 | | toggle = m_output[ch] == !m_poly9[m_p9]; |
| 2180 | toggle = m_output[ch] == !(m_poly9[m_p9] & 1); |
| 2093 | 2181 | else |
| 2094 | | toggle = m_output[ch] == !m_poly17[m_p17]; |
| 2182 | toggle = m_output[ch] == !(m_poly17[m_p17] & 1); |
| 2095 | 2183 | } |
| 2096 | 2184 | if( toggle ) |
| 2097 | 2185 | { |
| r15225 | r15226 | |
| 2163 | 2251 | } |
| 2164 | 2252 | |
| 2165 | 2253 | |
| 2166 | | void pokeyn_device::poly_init(UINT8 *poly, int size, int left, int right, int add) |
| 2254 | void pokeyn_device::poly_init_4_5(UINT32 *poly, int size, int xorbit, int invert) |
| 2167 | 2255 | { |
| 2168 | 2256 | int mask = (1 << size) - 1; |
| 2169 | | int i, x = 0; |
| 2257 | int i; |
| 2258 | UINT32 lfsr = 0; |
| 2170 | 2259 | |
| 2171 | 2260 | LOG_POLY(("poly %d\n", size)); |
| 2172 | | for( i = 0; i < mask; i++ ) |
| 2261 | for( i = 0; i < mask; i++ ) |
| 2173 | 2262 | { |
| 2174 | | *poly++ = x & 1; |
| 2175 | | LOG_POLY(("%05x: %d\n", x, x&1)); |
| 2176 | 2263 | /* calculate next bit */ |
| 2177 | | x = ((x << left) + (x >> right) + add) & mask; |
| 2264 | int in = !((lfsr >> 0) & 1) ^ ((lfsr >> xorbit) & 1); |
| 2265 | lfsr = lfsr >> 1; |
| 2266 | lfsr = (in << (size-1)) | lfsr; |
| 2267 | *poly = lfsr ^ invert; |
| 2268 | LOG_POLY(("%05x: %02x\n", lfsr, *poly)); |
| 2269 | poly++; |
| 2178 | 2270 | } |
| 2179 | 2271 | } |
| 2180 | 2272 | |
| 2181 | | void pokeyn_device::rand_init(UINT8 *rng, int size, int left, int right, int add) |
| 2273 | void pokeyn_device::poly_init_9_17(UINT32 *poly, int size) |
| 2182 | 2274 | { |
| 2183 | 2275 | int mask = (1 << size) - 1; |
| 2184 | | int i, x = 0; |
| 2276 | int i; |
| 2277 | UINT32 lfsr = 0; |
| 2185 | 2278 | |
| 2186 | 2279 | LOG_RAND(("rand %d\n", size)); |
| 2187 | | for( i = 0; i < mask; i++ ) |
| 2280 | |
| 2281 | if (size == 17) |
| 2188 | 2282 | { |
| 2189 | | if (size == 17) |
| 2190 | | *rng = x >> 6; /* use bits 6..13 */ |
| 2191 | | else |
| 2192 | | *rng = x; /* use bits 0..7 */ |
| 2193 | | LOG_RAND(("%05x: %02x\n", x, *rng)); |
| 2194 | | rng++; |
| 2195 | | /* calculate next bit */ |
| 2196 | | x = ((x << left) + (x >> right) + add) & mask; |
| 2283 | for( i = 0; i < mask; i++ ) |
| 2284 | { |
| 2285 | /* calculate next bit @ 7 */ |
| 2286 | int in8 = !((lfsr >> 8) & 1) ^ ((lfsr >> 13) & 1); |
| 2287 | int in = (lfsr & 1); |
| 2288 | lfsr = lfsr >> 1; |
| 2289 | lfsr = (lfsr & 0xff7f) | (in8 << 7); |
| 2290 | lfsr = (in << 16) | lfsr; |
| 2291 | *poly = lfsr; |
| 2292 | LOG_RAND(("%05x: %02x\n", lfsr, *poly)); |
| 2293 | poly++; |
| 2294 | } |
| 2197 | 2295 | } |
| 2296 | else |
| 2297 | { |
| 2298 | for( i = 0; i < mask; i++ ) |
| 2299 | { |
| 2300 | /* calculate next bit */ |
| 2301 | int in = !((lfsr >> 0) & 1) ^ ((lfsr >> 5) & 1); |
| 2302 | lfsr = lfsr >> 1; |
| 2303 | lfsr = (in << 8) | lfsr; |
| 2304 | *poly = lfsr; |
| 2305 | LOG_RAND(("%05x: %02x\n", lfsr, *poly)); |
| 2306 | poly++; |
| 2307 | } |
| 2308 | } |
| 2309 | |
| 2198 | 2310 | } |
| 2311 | |
| 2312 | //------------------------------------------------- |
| 2313 | // Quad Pokey support - should be in game drivers, really |
| 2314 | //------------------------------------------------- |
| 2315 | |
| 2316 | |
| 2317 | READ8_HANDLER( quad_pokeyn_r ) |
| 2318 | { |
| 2319 | static const char *const devname[4] = { "pokey1", "pokey2", "pokey3", "pokey4" }; |
| 2320 | int pokey_num = (offset >> 3) & ~0x04; |
| 2321 | int control = (offset & 0x20) >> 2; |
| 2322 | int pokey_reg = (offset % 8) | control; |
| 2323 | pokeyn_device *pokey = space->machine().device<pokeyn_device>(devname[pokey_num]); |
| 2324 | |
| 2325 | return pokey->read(pokey_reg); |
| 2326 | } |
| 2327 | |
| 2328 | WRITE8_HANDLER( quad_pokeyn_w ) |
| 2329 | { |
| 2330 | static const char *const devname[4] = { "pokey1", "pokey2", "pokey3", "pokey4" }; |
| 2331 | int pokey_num = (offset >> 3) & ~0x04; |
| 2332 | int control = (offset & 0x20) >> 2; |
| 2333 | int pokey_reg = (offset % 8) | control; |
| 2334 | pokeyn_device *pokey = space->machine().device<pokeyn_device>(devname[pokey_num]); |
| 2335 | |
| 2336 | pokey->write(pokey_reg, data); |
| 2337 | } |
| 2338 | |
src/emu/sound/pokey.h
| r15225 | r15226 | |
| 21 | 21 | |
| 22 | 22 | #include "devlegcy.h" |
| 23 | 23 | |
| 24 | /* uncomment the line below for MESS to avoid breaking compile |
| 25 | * please migrate as soon as possible to new device so that we can get rid of the legacy */ |
| 26 | |
| 27 | //#define OLDDEVICE_FOR_MESS 1 |
| 28 | |
| 29 | //#define POKEY_EXEC_INTERFACE |
| 30 | |
| 24 | 31 | /* CONSTANT DEFINITIONS */ |
| 25 | 32 | |
| 26 | 33 | /* POKEY WRITE LOGICALS */ |
| r15225 | r15226 | |
| 78 | 85 | void (*interrupt_cb)(device_t *device, int mask); |
| 79 | 86 | }; |
| 80 | 87 | |
| 81 | | |
| 88 | #ifdef OLDDEVICE_FOR_MESS |
| 82 | 89 | READ8_DEVICE_HANDLER( pokey_r ); |
| 83 | 90 | WRITE8_DEVICE_HANDLER( pokey_w ); |
| 84 | 91 | |
| r15225 | r15226 | |
| 92 | 99 | |
| 93 | 100 | DECLARE_LEGACY_SOUND_DEVICE(POKEY, pokey); |
| 94 | 101 | |
| 102 | #endif |
| 103 | |
| 95 | 104 | //************************************************************************** |
| 96 | 105 | // TYPE DEFINITIONS |
| 97 | 106 | //************************************************************************** |
| 98 | 107 | |
| 99 | | |
| 100 | 108 | // ======================> pokey_device |
| 101 | 109 | |
| 102 | 110 | class pokeyn_device : public device_t, |
| 103 | | public device_sound_interface |
| 111 | public device_sound_interface |
| 112 | #ifdef POKEY_EXEC_INTERFACE |
| 113 | public ,device_execute_interface |
| 114 | #endif |
| 104 | 115 | { |
| 105 | 116 | public: |
| 106 | 117 | // construction/destruction |
| r15225 | r15226 | |
| 109 | 120 | DECLARE_READ8_MEMBER( read ); |
| 110 | 121 | DECLARE_WRITE8_MEMBER( write ); |
| 111 | 122 | |
| 123 | UINT8 read(offs_t offset); |
| 124 | void write(offs_t offset, UINT8 data); |
| 125 | |
| 126 | void serin_ready(int after); |
| 127 | void break_w(int shift); |
| 128 | void kbcode_w(int kbcode, int make); |
| 129 | |
| 112 | 130 | protected: |
| 113 | 131 | // device-level overrides |
| 114 | 132 | virtual void device_start(); |
| r15225 | r15226 | |
| 120 | 138 | // device_sound_interface overrides |
| 121 | 139 | virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); |
| 122 | 140 | |
| 141 | #ifdef POKEY_EXEC_INTERFACE |
| 142 | virtual void execute_run() { m_icount = 0; } //printf("execute: %d\n", m_icount); m_icount = 0; } |
| 143 | #endif |
| 144 | |
| 123 | 145 | // configuration state |
| 124 | 146 | pokey_interface m_intf; |
| 125 | 147 | |
| 148 | // other internal states |
| 149 | int m_icount; |
| 150 | |
| 126 | 151 | private: |
| 127 | 152 | |
| 128 | | void poly_init(UINT8 *poly, int size, int left, int right, int add); |
| 129 | | void rand_init(UINT8 *rng, int size, int left, int right, int add); |
| 153 | void poly_init_4_5(UINT32 *poly, int size, int xorbit, int invert); |
| 154 | void poly_init_9_17(UINT32 *poly, int size); |
| 130 | 155 | inline void process_channel(int ch); |
| 131 | 156 | inline void reset_channel(int ch); |
| 132 | 157 | inline void inc_chan(int ch); |
| 133 | 158 | inline int check_borrow(int ch); |
| 134 | 159 | void pokey_potgo(void); |
| 135 | | void write_cmd(int offset, UINT8 data); |
| 136 | 160 | |
| 137 | | |
| 138 | | |
| 139 | 161 | // internal state |
| 140 | 162 | sound_stream* m_stream; |
| 141 | 163 | |
| r15225 | r15226 | |
| 181 | 203 | attotime m_ad_time_fast; |
| 182 | 204 | attotime m_ad_time_slow; |
| 183 | 205 | |
| 184 | | UINT8 m_poly4[0x0f]; |
| 185 | | UINT8 m_poly5[0x1f]; |
| 186 | | UINT8 m_poly9[0x1ff]; |
| 187 | | UINT8 m_poly17[0x1ffff]; |
| 188 | | |
| 189 | | UINT8 m_rand9[0x1ff]; |
| 190 | | UINT8 m_rand17[0x1ffff]; |
| 191 | | |
| 206 | UINT32 m_poly4[0x0f]; |
| 207 | UINT32 m_poly5[0x1f]; |
| 208 | UINT32 m_poly9[0x1ff]; |
| 209 | UINT32 m_poly17[0x1ffff]; |
| 192 | 210 | }; |
| 193 | 211 | |
| 194 | 212 | |
| r15225 | r15226 | |
| 196 | 214 | extern const device_type POKEYN; |
| 197 | 215 | |
| 198 | 216 | |
| 217 | /* fix me: eventually this should be a single device with pokey subdevices */ |
| 218 | READ8_HANDLER( quad_pokeyn_r ); |
| 219 | WRITE8_HANDLER( quad_pokeyn_w ); |
| 220 | |
| 221 | |
| 199 | 222 | #endif /* __POKEY_H__ */ |