summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author MooglyGuy <MooglyGuy@users.noreply.github.com>2022-06-04 09:14:21 +0200
committer GitHub <noreply@github.com>2022-06-04 17:14:21 +1000
commit1bc5484698bb746c6f9f7dae58b005d2472f1215 (patch)
tree54d6a10bc728cc7ce9858d771788a595e324141c
parentcd83335913a6cfe4aa2db720692fa34487b1d7a3 (diff)
- Removed device_timer, device_timer_id, et al in favor of direct callback members. (#9788)
Primarily, this removes device_t::device_timer, device_t::timer_set, device_t::synchronize, device_t::timer_expired, and device_timer_id. Use of device_timer often resulted in unnecessary trampolining in addition to switch/case overhead on a driver/device level, and additional logic to manage delegated vs. ID-based timers on a core level. In the worst cases, devices were performing a switch/case with only one valid case. device_scheduler::timer_set is marked deprecated as the only remaining direct uses are via the Lua engine and a few drivers that need refactoring anyway. The remaining uses occur via device_scheduler::synchronize. As a middle ground between the extremely short timer_alloc() and the extremely long machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(widget_device::contoso_tick), this)), a helper function in device_t has been added which can be invoked with the following syntax: timer_alloc(FUNC(widget_device::contoso_tick), this) - Additional changes/cleanups performed along the way: - Converted to use logmacro: * src/devices/bus/ieee488/hp9895.cpp * src/devices/bus/ieee488/remote488.cpp * src/devices/bus/isa/hdc.cpp * src/devices/bus/isa/omti8621.cpp * src/devices/bus/isa/sc499.cpp * src/devices/bus/vip/vp550.cpp * src/devices/cpu/i86/i186.cpp * src/devices/cpu/lc8670/lc8670.cpp * src/devices/machine/68230pit.cpp * src/devices/machine/corvushd.cpp * src/devices/machine/ds1994.cpp * src/devices/machine/ticket.cpp * src/mame/audio/pinsnd88.cpp * src/mame/drivers/notetaker.cpp * src/mame/machine/asic65.cpp * src/mame/machine/rmnimbus.cpp * src/mame/machine/victor9k_fdc.cpp * src/mame/video/uv201.cpp - Made usage of m_member prefix consistent: * src/devices/bus/isa/hdc.cpp * src/devices/bus/isa/omti8621.cpp * src/devices/bus/vme/vme_fccpu20.cpp * src/devices/machine/ds1386.cpp * src/devices/machine/i7220.cpp - Spacing consistency pass: * src/devices/bus/isa/hdc.cpp * src/devices/bus/isa/omti8621.cpp * src/devices/bus/thomson/nanoresau.cpp * src/devices/bus/ti99/internal/992board.cpp * src/devices/bus/ti99/internal/genkbd.cpp * src/devices/bus/ti99/internal/joyport/handset.cpp * src/devices/bus/vme/vme_fccpu20.cpp * src/devices/cpu/i86/i186.cpp * src/devices/cpu/lc8670/lc8670.cpp * src/devices/machine/68230pit.cpp * src/devices/machine/cop452.cpp * src/devices/machine/corvushd.cpp * src/devices/machine/hp_dc100_tape.cpp * src/devices/machine/hp_taco.cpp * src/devices/machine/meters.cpp * src/devices/machine/microtch.cpp * src/devices/machine/phi.cpp * src/devices/video/ef9365.cpp * src/devices/video/v9938.cpp * src/mame/drivers/alphaskop41xx.cpp * src/mame/drivers/myb3k.cpp * src/mame/drivers/notetaker.cpp * src/mame/drivers/wpc_an.cpp * src/mame/machine/midikbd.cpp * src/mame/machine/rmnimbus.cpp * src/mame/machine/wpc_lamp.cpp * src/mame/machine/wpc_out.cpp - Removed string-based ioport lookups: * src/devices/bus/ti99/internal/joyport/handset.cpp * src/devices/bus/ti99/internal/joyport/mecmouse.cpp * src/devices/bus/vme/vme_hcpu30.cpp * src/mame/machine/k7659kb.cpp * src/mame/machine/ti85.cpp - Adjustments to grammar/wording in comments * src/devices/bus/sms_ctrl/lphaser.cpp * src/devices/bus/sms_ctrl/sports.cpp * src/devices/bus/snes/event.cpp * src/devices/bus/snes/sa1.cpp * src/devices/bus/thomson/nanoresau.cpp * src/devices/bus/z88/z88.cpp * src/devices/machine/ds1386.cpp * src/devices/machine/vic_pl192.cpp - Favored BIT() macro for single-bit checks * src/devices/bus/ti99/internal/992board.cpp * src/devices/bus/ti99/joyport/handset.cpp * src/mame/drivers/notetaker.cpp * src/mame/machine/wpc_lamp.cpp * src/mame/machine/wpc_out.cpp - Removed C89-style variable declarations when noticed * src/devices/bus/isa/hdc.cpp * src/devices/bus/sms_ctrl/lphaser.cpp * src/devices/bus/ti99/joyport/mecmouse.cpp * src/devices/machine/acorn_vidc.cpp * src/devices/sound/ymz280b.cpp * src/devices/video/vic4567.cpp - Removed FUNCNAME to avoid compiler-specific #define checks in devices * src/devices/bus/vme/vme_fccpu20.cpp * src/devices/bus/vme/vme_hcpu30.cpp * src/devices/machine/68230pit.cpp * src/devices/machine/mc14411.cpp * src/mame/drivers/myb3k.cpp - Removed unecessary member prefixes/suffixes * src/devices/video/ef9340_1.cpp * src/mame/drivers/fuukifg2.cpp * src/mame/drivers/fuukifg3.cpp * src/mame/drivers/intv.cpp * src/mame/drivers/simpsons.cpp * src/mame/drivers/socrates.cpp * src/mame/drivers/special_gambl.cpp * src/mame/drivers/sprint4.cpp * src/mame/drivers/ti990_10.cpp * src/mame/drivers/tubep.cpp * src/mame/drivers/vectrex.cpp * src/mame/drivers/wpc_an.cpp * src/mame/drivers/wpc_dot.cpp * src/mame/drivers/wpc_flip1.cpp * src/mame/drivers/wpc_flip2.cpp * src/mame/machine/z80ne.cpp * src/mame/video/rollerg.cpp - Switched to lower-case hex constants * src/devices/video/ef9365.cpp * src/mame/machine/rmnimbus.cpp - Re-ordered driver overrides and function members * src/mame/drivers/boxer.cpp * src/mame/drivers/eurocom2.cpp * src/mame/drivers/exidy.cpp * src/mame/drivers/gpworld.cpp * src/mame/drivers/h19.cpp * src/mame/drivers/ibmpcjr.cpp * src/mame/drivers/mekd5.cpp * src/mame/drivers/mgolf.cpp * src/mame/drivers/myb3k.cpp * src/mame/drivers/nightmare.cpp * src/mame/drivers/notetaker.cpp * src/mame/drivers/ptcsol.cpp * src/mame/drivers/pwrview.cpp * src/mame/drivers/rabbit.cpp * src/mame/drivers/sitcom.cpp * src/mame/drivers/socrates.cpp * src/mame/drivers/sprint4.cpp * src/mame/drivers/techno.cpp * src/mame/drivers/thayers.cpp * src/mame/drivers/ti990_10.cpp * src/mame/drivers/ti990_4.cpp * src/mame/drivers/tv912.cpp * src/mame/drivers/tv990.cpp * src/mame/drivers/uchroma68.cpp * src/mame/drivers/vk100.cpp * src/mame/drivers/votrhv.cpp * src/mame/drivers/wicat.cpp * src/mame/drivers/wpc_an.cpp * src/mame/includes/abc80.h * src/mame/includes/asterix.h * src/mame/includes/fuukifg2.h * src/mame/includes/fuukifg3.h * src/mame/includes/gunbustr.h * src/mame/includes/intv.h * src/mame/includes/namcona1.h * src/mame/includes/newbrain.h * src/mame/includes/poly.h * src/mame/includes/prof80.h * src/mame/includes/rollerg.h * src/mame/includes/s11.h * src/mame/includes/segahang.h * src/mame/includes/simpsons.h * src/mame/includes/spacefb.h * src/mame/includes/tandy2k.h * src/mame/includes/trucocl.h * src/mame/includes/tubebp.h * src/mame/includes/vidbrain.h * src/mame/includes/wolfpack.h * src/mame/includes/wpc_dot.h - Made capitalization consistent on class members * src/devices/machine/meters.cpp * src/mame/drivers/namcona1.cpp * src/mame/drivers/notetaker.cpp -src/devices/bus/isa/hdc.cpp: * Removed fixed-size std::vector in favor of std::unique_ptr -src/devices/bus/isa/s3virge.cpp: * Moved unusually large (for a header) functions into .cpp from header -src/devices/bus/vip/vp550.cpp * Switched to required_device_array to simplify code paths -src/devices/machine/arm_iomd.cpp * Added initializers to constructor * Favored std::size over fixed static sizes -src/devices/machine/ds1386.cpp * Moved register #defines into header enums -src/devices/machine/mc68901.cpp * Removed unnecessary parameters and emu_timer::enable calls -src/devices/machine/mccs1850.cpp * Removed inline overuse -src/devices/machine/meters.cpp * Removed unused members -src/devices/machine/mos6526.cpp * Removed inline overuse -src/devices/machine/nsc810.cpp * Converted to arrays rather than individually-numbered members -src/devices/machine/pxa255.cpp * Simplified DMA transfer code -src/devices/machine/saa1043.cpp * Removed extraneous members in favor of resolve_all_safe -src/devices/machine/vic_pl192.cpp * Shifted constructors, start-up, and maps to be at the top of the source file -src/devices/machine/z8536.cpp * Removed stray uses of device_timer_id -src/devices/sound/cdp1869.cpp * Removed inline overuse -src/devices/sound/mos7360.cpp * Converted to arrays rather than individually-numbered members -src/emu/device.cpp * Removed ID-based timer_alloc * Removed timer_set * Removed synchronize * Removed timer_expired * Added shorthand timer_alloc to avoid lengthy machine().scheduler().timer_alloc() calls -src/emu/schedule.cpp * Removed now-unused m_id and m_device members -src/mame/audio/alesis.cpp * Added initializers to constructor -src/mame/drivers/alto2.cpp * Removed custom-named driver init in favor of driver_init override * Removed octal constant in favor of more standard hex -src/mame/drivers/astinvad.cpp * Fixed 'kamizake' typo -src/mame/drivers/tm990189.cpp * Removed unnecessary machine reset override -src/mame/drivers/unichamp.cpp * Removed custom-named driver init in favor of driver_init override -src/mame/drivers/votrhv.cpp * Fixed ROM_LOAD macros and region() usage in memory maps -src/mame/machine/victor9k_fdc.cpp * Made bracing style consistent across the file -src/mame/video/gime.cpp * Removed unnecessary void specifiers in function prototypes
-rw-r--r--src/devices/bus/a2bus/a2mcms.cpp24
-rw-r--r--src/devices/bus/a2bus/a2mcms.h7
-rw-r--r--src/devices/bus/a2bus/a2parprn.cpp2
-rw-r--r--src/devices/bus/a2bus/a2pic.cpp2
-rw-r--r--src/devices/bus/a2bus/a2sd.cpp4
-rw-r--r--src/devices/bus/a2bus/a2sd.h2
-rw-r--r--src/devices/bus/a2bus/agat840k_hle.cpp37
-rw-r--r--src/devices/bus/a2bus/agat840k_hle.h12
-rw-r--r--src/devices/bus/a2bus/agat_fdc.cpp25
-rw-r--r--src/devices/bus/a2bus/agat_fdc.h5
-rw-r--r--src/devices/bus/a2bus/corvfdc02.cpp4
-rw-r--r--src/devices/bus/a2bus/corvfdc02.h3
-rw-r--r--src/devices/bus/a2bus/grappler.cpp2
-rw-r--r--src/devices/bus/a2bus/transwarp.cpp4
-rw-r--r--src/devices/bus/a2bus/transwarp.h3
-rw-r--r--src/devices/bus/a2bus/uniprint.cpp2
-rw-r--r--src/devices/bus/a800/cassette.cpp38
-rw-r--r--src/devices/bus/a800/cassette.h3
-rw-r--r--src/devices/bus/abckb/abc77.cpp21
-rw-r--r--src/devices/bus/abckb/abc77.h9
-rw-r--r--src/devices/bus/abckb/abc800kb.cpp17
-rw-r--r--src/devices/bus/abckb/abc800kb.h7
-rw-r--r--src/devices/bus/abckb/abc99.cpp51
-rw-r--r--src/devices/bus/abckb/abc99.h17
-rw-r--r--src/devices/bus/amiga/keyboard/mitsumi.cpp8
-rw-r--r--src/devices/bus/astrocde/lightpen.cpp21
-rw-r--r--src/devices/bus/astrocde/lightpen.h5
-rw-r--r--src/devices/bus/ata/atahle.cpp24
-rw-r--r--src/devices/bus/ata/atahle.h4
-rw-r--r--src/devices/bus/ata/idehd.cpp2
-rw-r--r--src/devices/bus/bbc/1mhzbus/m5000.cpp4
-rw-r--r--src/devices/bus/bbc/1mhzbus/m5000.h4
-rw-r--r--src/devices/bus/bbc/joyport/mouse.cpp4
-rw-r--r--src/devices/bus/bbc/joyport/mouse.h3
-rw-r--r--src/devices/bus/bbc/userport/pointer.cpp4
-rw-r--r--src/devices/bus/bbc/userport/pointer.h3
-rw-r--r--src/devices/bus/c64/c128_partner.cpp6
-rw-r--r--src/devices/bus/c64/c128_partner.h3
-rw-r--r--src/devices/bus/c64/epyx_fast_load.cpp6
-rw-r--r--src/devices/bus/c64/epyx_fast_load.h3
-rw-r--r--src/devices/bus/c64/super_explode.cpp6
-rw-r--r--src/devices/bus/c64/super_explode.h3
-rw-r--r--src/devices/bus/c64/vw64.cpp7
-rw-r--r--src/devices/bus/c64/vw64.h3
-rw-r--r--src/devices/bus/cbus/pc9801_86.cpp26
-rw-r--r--src/devices/bus/cbus/pc9801_86.h3
-rw-r--r--src/devices/bus/centronics/epson_lx810l.cpp30
-rw-r--r--src/devices/bus/centronics/epson_lx810l.h3
-rw-r--r--src/devices/bus/centronics/printer.cpp99
-rw-r--r--src/devices/bus/centronics/printer.h9
-rw-r--r--src/devices/bus/coco/cococart.cpp53
-rw-r--r--src/devices/bus/coco/cococart.h8
-rw-r--r--src/devices/bus/compucolor/floppy.cpp6
-rw-r--r--src/devices/bus/compucolor/floppy.h2
-rw-r--r--src/devices/bus/dmv/k210.cpp6
-rw-r--r--src/devices/bus/dmv/k210.h3
-rw-r--r--src/devices/bus/ecbbus/grip.cpp19
-rw-r--r--src/devices/bus/ecbbus/grip.h3
-rw-r--r--src/devices/bus/econet/e01.cpp6
-rw-r--r--src/devices/bus/econet/e01.h4
-rw-r--r--src/devices/bus/epson_sio/pf10.cpp14
-rw-r--r--src/devices/bus/epson_sio/pf10.h3
-rw-r--r--src/devices/bus/epson_sio/tf20.cpp45
-rw-r--r--src/devices/bus/epson_sio/tf20.h4
-rw-r--r--src/devices/bus/gio64/newport.cpp9
-rw-r--r--src/devices/bus/gio64/newport.h3
-rw-r--r--src/devices/bus/hp9845_io/98035.cpp85
-rw-r--r--src/devices/bus/hp9845_io/98035.h4
-rw-r--r--src/devices/bus/hp9845_io/hp9885.cpp292
-rw-r--r--src/devices/bus/hp9845_io/hp9885.h5
-rw-r--r--src/devices/bus/ieee488/c2040fdc.cpp6
-rw-r--r--src/devices/bus/ieee488/c2040fdc.h3
-rw-r--r--src/devices/bus/ieee488/c8050fdc.cpp6
-rw-r--r--src/devices/bus/ieee488/c8050fdc.h3
-rw-r--r--src/devices/bus/ieee488/grid2102.cpp4
-rw-r--r--src/devices/bus/ieee488/grid2102.h5
-rw-r--r--src/devices/bus/ieee488/hp9122c.cpp2
-rw-r--r--src/devices/bus/ieee488/hp9895.cpp322
-rw-r--r--src/devices/bus/ieee488/hp9895.h25
-rw-r--r--src/devices/bus/ieee488/remote488.cpp85
-rw-r--r--src/devices/bus/ieee488/remote488.h16
-rw-r--r--src/devices/bus/intellec4/tapereader.cpp2
-rw-r--r--src/devices/bus/interpro/keyboard/hle.cpp16
-rw-r--r--src/devices/bus/interpro/keyboard/hle.h3
-rw-r--r--src/devices/bus/interpro/sr/gt.cpp6
-rw-r--r--src/devices/bus/iq151/staper.cpp18
-rw-r--r--src/devices/bus/iq151/staper.h4
-rw-r--r--src/devices/bus/isa/gus.cpp66
-rw-r--r--src/devices/bus/isa/gus.h31
-rw-r--r--src/devices/bus/isa/hdc.cpp638
-rw-r--r--src/devices/bus/isa/hdc.h79
-rw-r--r--src/devices/bus/isa/mc1502_fdc.cpp2
-rw-r--r--src/devices/bus/isa/omti8621.cpp386
-rw-r--r--src/devices/bus/isa/omti8621.h45
-rw-r--r--src/devices/bus/isa/s3virge.cpp111
-rw-r--r--src/devices/bus/isa/s3virge.h70
-rw-r--r--src/devices/bus/isa/sb16.cpp4
-rw-r--r--src/devices/bus/isa/sb16.h4
-rw-r--r--src/devices/bus/isa/sblaster.cpp7
-rw-r--r--src/devices/bus/isa/sblaster.h6
-rw-r--r--src/devices/bus/isa/sc499.cpp128
-rw-r--r--src/devices/bus/isa/sc499.h4
-rw-r--r--src/devices/bus/isa/stereo_fx.cpp4
-rw-r--r--src/devices/bus/isa/stereo_fx.h4
-rw-r--r--src/devices/bus/isa/trident.cpp2
-rw-r--r--src/devices/bus/kc/d004.cpp13
-rw-r--r--src/devices/bus/kc/d004.h5
-rw-r--r--src/devices/bus/mackbd/keyboard.cpp4
-rw-r--r--src/devices/bus/macpds/pds_tpdfpd.cpp4
-rw-r--r--src/devices/bus/macpds/pds_tpdfpd.h3
-rw-r--r--src/devices/bus/multibus/isbc202.cpp64
-rw-r--r--src/devices/bus/multibus/isbc202.h9
-rw-r--r--src/devices/bus/nasbus/floppy.cpp2
-rw-r--r--src/devices/bus/nes/bandai.cpp35
-rw-r--r--src/devices/bus/nes/bandai.h5
-rw-r--r--src/devices/bus/nes/batlab.cpp2
-rw-r--r--src/devices/bus/nes/batlab.h2
-rw-r--r--src/devices/bus/nes/bootleg.cpp158
-rw-r--r--src/devices/bus/nes/bootleg.h44
-rw-r--r--src/devices/bus/nes/cony.cpp17
-rw-r--r--src/devices/bus/nes/cony.h4
-rw-r--r--src/devices/bus/nes/datach.cpp48
-rw-r--r--src/devices/bus/nes/datach.h5
-rw-r--r--src/devices/bus/nes/disksys.cpp29
-rw-r--r--src/devices/bus/nes/disksys.h6
-rw-r--r--src/devices/bus/nes/event.cpp14
-rw-r--r--src/devices/bus/nes/event.h8
-rw-r--r--src/devices/bus/nes/ggenie.h4
-rw-r--r--src/devices/bus/nes/irem.cpp25
-rw-r--r--src/devices/bus/nes/irem.h4
-rw-r--r--src/devices/bus/nes/jaleco.cpp35
-rw-r--r--src/devices/bus/nes/jaleco.h4
-rw-r--r--src/devices/bus/nes/jy.cpp19
-rw-r--r--src/devices/bus/nes/jy.h8
-rw-r--r--src/devices/bus/nes/kaiser.cpp34
-rw-r--r--src/devices/bus/nes/kaiser.h8
-rw-r--r--src/devices/bus/nes/konami.cpp54
-rw-r--r--src/devices/bus/nes/konami.h8
-rw-r--r--src/devices/bus/nes/legacy.cpp21
-rw-r--r--src/devices/bus/nes/legacy.h5
-rw-r--r--src/devices/bus/nes/mmc3.cpp2
-rw-r--r--src/devices/bus/nes/mmc3.h2
-rw-r--r--src/devices/bus/nes/mmc5.cpp2
-rw-r--r--src/devices/bus/nes/mmc5.h2
-rw-r--r--src/devices/bus/nes/namcot.cpp21
-rw-r--r--src/devices/bus/nes/namcot.h5
-rw-r--r--src/devices/bus/nes/nanjing.cpp2
-rw-r--r--src/devices/bus/nes/nanjing.h2
-rw-r--r--src/devices/bus/nes/nes_slot.h4
-rw-r--r--src/devices/bus/nes/pirate.cpp4
-rw-r--r--src/devices/bus/nes/pirate.h4
-rw-r--r--src/devices/bus/nes/sunsoft.cpp28
-rw-r--r--src/devices/bus/nes/sunsoft.h8
-rw-r--r--src/devices/bus/nes/sunsoft_dcs.cpp13
-rw-r--r--src/devices/bus/nes/sunsoft_dcs.h6
-rw-r--r--src/devices/bus/nes/taito.cpp17
-rw-r--r--src/devices/bus/nes/taito.h6
-rw-r--r--src/devices/bus/nes/tengen.cpp21
-rw-r--r--src/devices/bus/nes/tengen.h6
-rw-r--r--src/devices/bus/nes/vrc_clones.cpp32
-rw-r--r--src/devices/bus/nes/vrc_clones.h8
-rw-r--r--src/devices/bus/nes_ctrl/bcbattle.cpp61
-rw-r--r--src/devices/bus/nes_ctrl/bcbattle.h5
-rw-r--r--src/devices/bus/nes_ctrl/miracle.cpp11
-rw-r--r--src/devices/bus/nes_ctrl/miracle.h5
-rw-r--r--src/devices/bus/nubus/nubus_48gc.cpp4
-rw-r--r--src/devices/bus/nubus/nubus_48gc.h3
-rw-r--r--src/devices/bus/nubus/nubus_m2hires.cpp4
-rw-r--r--src/devices/bus/nubus/nubus_m2hires.h3
-rw-r--r--src/devices/bus/nubus/nubus_m2video.cpp4
-rw-r--r--src/devices/bus/nubus/nubus_m2video.h3
-rw-r--r--src/devices/bus/nubus/nubus_radiustpd.cpp4
-rw-r--r--src/devices/bus/nubus/nubus_radiustpd.h3
-rw-r--r--src/devices/bus/nubus/nubus_spec8.cpp4
-rw-r--r--src/devices/bus/nubus/nubus_spec8.h3
-rw-r--r--src/devices/bus/nubus/nubus_specpdq.cpp4
-rw-r--r--src/devices/bus/nubus/nubus_specpdq.h3
-rw-r--r--src/devices/bus/nubus/nubus_wsportrait.cpp4
-rw-r--r--src/devices/bus/nubus/nubus_wsportrait.h3
-rw-r--r--src/devices/bus/nubus/pds30_30hr.cpp4
-rw-r--r--src/devices/bus/nubus/pds30_30hr.h3
-rw-r--r--src/devices/bus/nubus/pds30_cb264.cpp4
-rw-r--r--src/devices/bus/nubus/pds30_cb264.h3
-rw-r--r--src/devices/bus/nubus/pds30_mc30.cpp4
-rw-r--r--src/devices/bus/nubus/pds30_mc30.h3
-rw-r--r--src/devices/bus/nubus/pds30_procolor816.cpp4
-rw-r--r--src/devices/bus/nubus/pds30_procolor816.h3
-rw-r--r--src/devices/bus/nubus/pds30_sigmalview.cpp4
-rw-r--r--src/devices/bus/nubus/pds30_sigmalview.h3
-rw-r--r--src/devices/bus/pc8801/pc8801_31.cpp11
-rw-r--r--src/devices/bus/pc8801/pc8801_31.h3
-rw-r--r--src/devices/bus/pc_joy/pc_joy_sw.cpp4
-rw-r--r--src/devices/bus/pc_joy/pc_joy_sw.h3
-rw-r--r--src/devices/bus/pc_kbd/hle_mouse.cpp4
-rw-r--r--src/devices/bus/pet/c2n.cpp6
-rw-r--r--src/devices/bus/pet/c2n.h3
-rw-r--r--src/devices/bus/plus4/c1551.cpp6
-rw-r--r--src/devices/bus/plus4/c1551.h3
-rw-r--r--src/devices/bus/psx/memcard.cpp2
-rw-r--r--src/devices/bus/qbus/pc11.cpp8
-rw-r--r--src/devices/bus/qbus/pc11.h5
-rw-r--r--src/devices/bus/rs232/null_modem.cpp21
-rw-r--r--src/devices/bus/rs232/null_modem.h5
-rw-r--r--src/devices/bus/rs232/pty.cpp21
-rw-r--r--src/devices/bus/rs232/pty.h3
-rw-r--r--src/devices/bus/rs232/rs232_sync_io.cpp102
-rw-r--r--src/devices/bus/rs232/rs232_sync_io.h3
-rw-r--r--src/devices/bus/rs232/xvd701.cpp17
-rw-r--r--src/devices/bus/rs232/xvd701.h5
-rw-r--r--src/devices/bus/s100/ascsasi.cpp4
-rw-r--r--src/devices/bus/samcoupe/mouse/mouse.cpp6
-rw-r--r--src/devices/bus/samcoupe/mouse/mouse.h3
-rw-r--r--src/devices/bus/scsi/scsihle.cpp39
-rw-r--r--src/devices/bus/scsi/scsihle.h5
-rw-r--r--src/devices/bus/sg1000_exp/kblink.cpp44
-rw-r--r--src/devices/bus/sg1000_exp/kblink.h6
-rw-r--r--src/devices/bus/sgikbd/hlekbd.cpp27
-rw-r--r--src/devices/bus/sgikbd/hlekbd.h10
-rw-r--r--src/devices/bus/sms_ctrl/lphaser.cpp80
-rw-r--r--src/devices/bus/sms_ctrl/lphaser.h6
-rw-r--r--src/devices/bus/sms_ctrl/sports.cpp71
-rw-r--r--src/devices/bus/sms_ctrl/sports.h3
-rw-r--r--src/devices/bus/snes/event.cpp27
-rw-r--r--src/devices/bus/snes/event.h5
-rw-r--r--src/devices/bus/snes/sa1.cpp307
-rw-r--r--src/devices/bus/snes/sa1.h5
-rw-r--r--src/devices/bus/snes_ctrl/bcbattle.cpp65
-rw-r--r--src/devices/bus/snes_ctrl/bcbattle.h5
-rw-r--r--src/devices/bus/snes_ctrl/miracle.cpp11
-rw-r--r--src/devices/bus/snes_ctrl/miracle.h5
-rw-r--r--src/devices/bus/spc1000/fdd.cpp2
-rw-r--r--src/devices/bus/spectrum/mgt.cpp15
-rw-r--r--src/devices/bus/spectrum/mgt.h9
-rw-r--r--src/devices/bus/ss50/dc5.cpp2
-rw-r--r--src/devices/bus/ss50/mpt.cpp2
-rw-r--r--src/devices/bus/sunkbd/hlekbd.cpp19
-rw-r--r--src/devices/bus/sunkbd/hlekbd.h3
-rw-r--r--src/devices/bus/thomson/cd90_015.cpp8
-rw-r--r--src/devices/bus/thomson/cd90_015.h3
-rw-r--r--src/devices/bus/thomson/cd90_351.cpp14
-rw-r--r--src/devices/bus/thomson/cd90_351.h7
-rw-r--r--src/devices/bus/thomson/nanoreseau.cpp27
-rw-r--r--src/devices/bus/thomson/nanoreseau.h3
-rw-r--r--src/devices/bus/ti8x/bitsocket.cpp30
-rw-r--r--src/devices/bus/ti99/internal/992board.cpp118
-rw-r--r--src/devices/bus/ti99/internal/992board.h7
-rw-r--r--src/devices/bus/ti99/internal/genkbd.cpp119
-rw-r--r--src/devices/bus/ti99/internal/genkbd.h10
-rw-r--r--src/devices/bus/ti99/joyport/handset.cpp159
-rw-r--r--src/devices/bus/ti99/joyport/handset.h8
-rw-r--r--src/devices/bus/ti99/joyport/mecmouse.cpp34
-rw-r--r--src/devices/bus/ti99/joyport/mecmouse.h7
-rw-r--r--src/devices/bus/ti99/peb/hfdc.cpp6
-rw-r--r--src/devices/bus/ti99/peb/hfdc.h3
-rw-r--r--src/devices/bus/ti99/peb/tipi.cpp15
-rw-r--r--src/devices/bus/ti99/peb/tipi.h3
-rw-r--r--src/devices/bus/vcs/dpc.cpp19
-rw-r--r--src/devices/bus/vcs/dpc.h15
-rw-r--r--src/devices/bus/vip/vp550.cpp103
-rw-r--r--src/devices/bus/vip/vp550.h6
-rw-r--r--src/devices/bus/vme/vme_cp31.cpp4
-rw-r--r--src/devices/bus/vme/vme_cp31.h3
-rw-r--r--src/devices/bus/vme/vme_fccpu20.cpp106
-rw-r--r--src/devices/bus/vme/vme_fccpu20.h7
-rw-r--r--src/devices/bus/vme/vme_hcpu30.cpp67
-rw-r--r--src/devices/bus/vme/vme_hcpu30.h4
-rw-r--r--src/devices/bus/vsmile/keyboard.cpp9
-rw-r--r--src/devices/bus/vsmile/pad.cpp3
-rw-r--r--src/devices/bus/vsmile/vsmile_ctrl.cpp6
-rw-r--r--src/devices/bus/vtech/memexp/sdloader.cpp2
-rw-r--r--src/devices/bus/wswan/rom.cpp63
-rw-r--r--src/devices/bus/wswan/rom.h5
-rw-r--r--src/devices/bus/z88/z88.cpp19
-rw-r--r--src/devices/bus/z88/z88.h5
-rw-r--r--src/devices/cpu/alto2/a2disk.cpp8
-rw-r--r--src/devices/cpu/alto2/a2ether.cpp4
-rw-r--r--src/devices/cpu/amis2000/amis2000.cpp2
-rw-r--r--src/devices/cpu/arm7/upd800468.cpp4
-rw-r--r--src/devices/cpu/arm7/upd800468.h2
-rw-r--r--src/devices/cpu/cop400/cop400.cpp15
-rw-r--r--src/devices/cpu/cop400/cop400.h4
-rw-r--r--src/devices/cpu/e0c6200/e0c6s46.cpp6
-rw-r--r--src/devices/cpu/e132xs/e132xs.cpp2
-rw-r--r--src/devices/cpu/f2mc16/mb9061x.cpp6
-rw-r--r--src/devices/cpu/h8/h8_sci.cpp14
-rw-r--r--src/devices/cpu/h8/h8_sci.h3
-rw-r--r--src/devices/cpu/hd61700/hd61700.cpp804
-rw-r--r--src/devices/cpu/hd61700/hd61700.h41
-rw-r--r--src/devices/cpu/i86/i186.cpp718
-rw-r--r--src/devices/cpu/i86/i186.h7
-rw-r--r--src/devices/cpu/lc8670/lc8670.cpp240
-rw-r--r--src/devices/cpu/lc8670/lc8670.h6
-rw-r--r--src/devices/cpu/m37710/m37710.cpp4
-rw-r--r--src/devices/cpu/m6502/m3745x.cpp24
-rw-r--r--src/devices/cpu/m6502/m3745x.h3
-rw-r--r--src/devices/cpu/m6502/m5074x.cpp88
-rw-r--r--src/devices/cpu/m6502/m5074x.h9
-rw-r--r--src/devices/cpu/m6502/st2204.cpp6
-rw-r--r--src/devices/cpu/m6502/st2205u.cpp8
-rw-r--r--src/devices/cpu/m6502/st2xxx.cpp4
-rw-r--r--src/devices/cpu/m6800/m6801.cpp2
-rw-r--r--src/devices/cpu/mb88xx/mb88xx.cpp2
-rw-r--r--src/devices/cpu/melps4/m58846.cpp7
-rw-r--r--src/devices/cpu/melps4/m58846.h2
-rw-r--r--src/devices/cpu/mips/mips3.cpp2
-rw-r--r--src/devices/cpu/mips/r4000.cpp2
-rw-r--r--src/devices/cpu/mn10200/mn10200.cpp2
-rw-r--r--src/devices/cpu/nec/v25.cpp2
-rw-r--r--src/devices/cpu/powerpc/ppccom.cpp16
-rw-r--r--src/devices/cpu/psx/dma.cpp10
-rw-r--r--src/devices/cpu/psx/dma.h3
-rw-r--r--src/devices/cpu/psx/rcnt.cpp6
-rw-r--r--src/devices/cpu/psx/rcnt.h3
-rw-r--r--src/devices/cpu/psx/sio.cpp4
-rw-r--r--src/devices/cpu/psx/sio.h3
-rw-r--r--src/devices/cpu/rii/riscii.cpp4
-rw-r--r--src/devices/cpu/sc61860/sc61860.cpp2
-rw-r--r--src/devices/cpu/sh/sh2.cpp8
-rw-r--r--src/devices/cpu/sh/sh4.cpp8
-rw-r--r--src/devices/cpu/sharc/sharc.cpp4
-rw-r--r--src/devices/cpu/sm510/sm510base.cpp4
-rw-r--r--src/devices/cpu/tlcs870/tlcs870.cpp12
-rw-r--r--src/devices/cpu/tlcs90/tlcs90.cpp4
-rw-r--r--src/devices/cpu/tms34010/tms34010.cpp2
-rw-r--r--src/devices/cpu/tms7000/tms7000.cpp2
-rw-r--r--src/devices/cpu/ucom4/ucom4.cpp2
-rw-r--r--src/devices/cpu/z8/z8.cpp4
-rw-r--r--src/devices/cpu/z80/kp63.cpp24
-rw-r--r--src/devices/cpu/z80/tmpz84c015.cpp2
-rw-r--r--src/devices/imagedev/avivideo.cpp31
-rw-r--r--src/devices/imagedev/avivideo.h5
-rw-r--r--src/devices/imagedev/flopdrv.cpp9
-rw-r--r--src/devices/imagedev/flopdrv.h1
-rw-r--r--src/devices/imagedev/floppy.cpp13
-rw-r--r--src/devices/imagedev/floppy.h4
-rw-r--r--src/devices/imagedev/mfmhd.cpp129
-rw-r--r--src/devices/imagedev/mfmhd.h7
-rw-r--r--src/devices/imagedev/microdrv.cpp4
-rw-r--r--src/devices/imagedev/microdrv.h3
-rw-r--r--src/devices/imagedev/midiin.cpp93
-rw-r--r--src/devices/imagedev/midiin.h4
-rw-r--r--src/devices/imagedev/snapquik.cpp2
-rw-r--r--src/devices/machine/53c7xx.cpp6
-rw-r--r--src/devices/machine/53c7xx.h3
-rw-r--r--src/devices/machine/64h156.cpp6
-rw-r--r--src/devices/machine/64h156.h3
-rw-r--r--src/devices/machine/6522via.cpp148
-rw-r--r--src/devices/machine/6522via.h15
-rw-r--r--src/devices/machine/6532riot.cpp16
-rw-r--r--src/devices/machine/6532riot.h25
-rw-r--r--src/devices/machine/68230pit.cpp244
-rw-r--r--src/devices/machine/68230pit.h12
-rw-r--r--src/devices/machine/68307tmu.cpp6
-rw-r--r--src/devices/machine/68340sim.cpp2
-rw-r--r--src/devices/machine/68340tmu.cpp2
-rw-r--r--src/devices/machine/6840ptm.cpp65
-rw-r--r--src/devices/machine/6840ptm.h3
-rw-r--r--src/devices/machine/74123.cpp25
-rw-r--r--src/devices/machine/74123.h3
-rw-r--r--src/devices/machine/8042kbdc.cpp13
-rw-r--r--src/devices/machine/8042kbdc.h5
-rw-r--r--src/devices/machine/8364_paula.cpp2
-rw-r--r--src/devices/machine/8530scc.cpp22
-rw-r--r--src/devices/machine/8530scc.h3
-rw-r--r--src/devices/machine/acorn_ioc.cpp2
-rw-r--r--src/devices/machine/acorn_vidc.cpp70
-rw-r--r--src/devices/machine/acorn_vidc.h10
-rw-r--r--src/devices/machine/adc0804.cpp2
-rw-r--r--src/devices/machine/adc0808.cpp6
-rw-r--r--src/devices/machine/adc0808.h3
-rw-r--r--src/devices/machine/adc0844.cpp8
-rw-r--r--src/devices/machine/adc0844.h6
-rw-r--r--src/devices/machine/aic6250.cpp2
-rw-r--r--src/devices/machine/aicartc.cpp7
-rw-r--r--src/devices/machine/aicartc.h3
-rw-r--r--src/devices/machine/akiko.cpp6
-rw-r--r--src/devices/machine/am2910.cpp9
-rw-r--r--src/devices/machine/am2910.h3
-rw-r--r--src/devices/machine/am53cf96.cpp4
-rw-r--r--src/devices/machine/am53cf96.h5
-rw-r--r--src/devices/machine/am79c90.cpp2
-rw-r--r--src/devices/machine/am9513.cpp23
-rw-r--r--src/devices/machine/am9513.h10
-rw-r--r--src/devices/machine/am9519.cpp133
-rw-r--r--src/devices/machine/am9519.h8
-rw-r--r--src/devices/machine/amigafdc.cpp4
-rw-r--r--src/devices/machine/amigafdc.h3
-rw-r--r--src/devices/machine/applefdc.cpp28
-rw-r--r--src/devices/machine/applefdc.h4
-rw-r--r--src/devices/machine/applepic.cpp2
-rw-r--r--src/devices/machine/arm_iomd.cpp70
-rw-r--r--src/devices/machine/arm_iomd.h24
-rw-r--r--src/devices/machine/at28c16.cpp11
-rw-r--r--src/devices/machine/at28c16.h2
-rw-r--r--src/devices/machine/at28c64b.cpp11
-rw-r--r--src/devices/machine/at28c64b.h2
-rw-r--r--src/devices/machine/at29x.cpp9
-rw-r--r--src/devices/machine/at29x.h3
-rw-r--r--src/devices/machine/bq4847.cpp6
-rw-r--r--src/devices/machine/bq48x2.cpp6
-rw-r--r--src/devices/machine/busmouse.cpp4
-rw-r--r--src/devices/machine/busmouse.h3
-rw-r--r--src/devices/machine/cdp1852.cpp4
-rw-r--r--src/devices/machine/cdp1871.cpp6
-rw-r--r--src/devices/machine/cdp1871.h3
-rw-r--r--src/devices/machine/cdp1879.cpp6
-rw-r--r--src/devices/machine/cdp1879.h3
-rw-r--r--src/devices/machine/clock.cpp128
-rw-r--r--src/devices/machine/clock.h7
-rw-r--r--src/devices/machine/com8116.cpp51
-rw-r--r--src/devices/machine/com8116.h12
-rw-r--r--src/devices/machine/cop452.cpp97
-rw-r--r--src/devices/machine/cop452.h39
-rw-r--r--src/devices/machine/corvushd.cpp192
-rw-r--r--src/devices/machine/corvushd.h9
-rw-r--r--src/devices/machine/cr511b.cpp13
-rw-r--r--src/devices/machine/cr511b.h3
-rw-r--r--src/devices/machine/cxd1185.cpp2
-rw-r--r--src/devices/machine/diablo_hd.cpp14
-rw-r--r--src/devices/machine/diablo_hd.h3
-rw-r--r--src/devices/machine/dp83932c.cpp2
-rw-r--r--src/devices/machine/dp8573.cpp4
-rw-r--r--src/devices/machine/dp8573.h3
-rw-r--r--src/devices/machine/ds1302.cpp6
-rw-r--r--src/devices/machine/ds1302.h3
-rw-r--r--src/devices/machine/ds1386.cpp177
-rw-r--r--src/devices/machine/ds1386.h34
-rw-r--r--src/devices/machine/ds1994.cpp533
-rw-r--r--src/devices/machine/ds1994.h25
-rw-r--r--src/devices/machine/ds2401.cpp125
-rw-r--r--src/devices/machine/ds2401.h9
-rw-r--r--src/devices/machine/ds2404.cpp19
-rw-r--r--src/devices/machine/ds2404.h2
-rw-r--r--src/devices/machine/e0516.cpp7
-rw-r--r--src/devices/machine/e0516.h3
-rw-r--r--src/devices/machine/edlc.cpp4
-rw-r--r--src/devices/machine/er1400.cpp22
-rw-r--r--src/devices/machine/er1400.h3
-rw-r--r--src/devices/machine/exorterm.cpp4
-rw-r--r--src/devices/machine/exorterm.h1
-rw-r--r--src/devices/machine/f3853.cpp2
-rw-r--r--src/devices/machine/fga002.cpp67
-rw-r--r--src/devices/machine/fga002.h8
-rw-r--r--src/devices/machine/gen_fifo.cpp69
-rw-r--r--src/devices/machine/gen_fifo.h4
-rw-r--r--src/devices/machine/generalplus_gpl16250soc.cpp17
-rw-r--r--src/devices/machine/generalplus_gpl16250soc.h3
-rw-r--r--src/devices/machine/generalplus_gpl16250soc_video.cpp27
-rw-r--r--src/devices/machine/generalplus_gpl16250soc_video.h3
-rw-r--r--src/devices/machine/glukrs.cpp2
-rw-r--r--src/devices/machine/gt64xxx.cpp10
-rw-r--r--src/devices/machine/gt913_io.cpp19
-rw-r--r--src/devices/machine/gt913_io.h2
-rw-r--r--src/devices/machine/hd63450.cpp2
-rw-r--r--src/devices/machine/hd64610.cpp41
-rw-r--r--src/devices/machine/hd64610.h5
-rw-r--r--src/devices/machine/hdc92x4.cpp37
-rw-r--r--src/devices/machine/hdc92x4.h4
-rw-r--r--src/devices/machine/hp_dc100_tape.cpp263
-rw-r--r--src/devices/machine/hp_dc100_tape.h6
-rw-r--r--src/devices/machine/hp_taco.cpp216
-rw-r--r--src/devices/machine/hp_taco.h5
-rw-r--r--src/devices/machine/i7220.cpp265
-rw-r--r--src/devices/machine/i7220.h40
-rw-r--r--src/devices/machine/i8087.cpp6
-rw-r--r--src/devices/machine/i8087.h3
-rw-r--r--src/devices/machine/i8155.cpp4
-rw-r--r--src/devices/machine/i82357.cpp2
-rw-r--r--src/devices/machine/i82586.cpp14
-rw-r--r--src/devices/machine/i82586.h4
-rw-r--r--src/devices/machine/i8271.cpp34
-rw-r--r--src/devices/machine/i8271.h5
-rw-r--r--src/devices/machine/i8279.cpp2
-rw-r--r--src/devices/machine/ibm21s850.cpp23
-rw-r--r--src/devices/machine/ibm21s850.h5
-rw-r--r--src/devices/machine/icm7170.cpp12
-rw-r--r--src/devices/machine/icm7170.h3
-rw-r--r--src/devices/machine/ie15.cpp34
-rw-r--r--src/devices/machine/ie15.h45
-rw-r--r--src/devices/machine/ins8250.cpp11
-rw-r--r--src/devices/machine/ins8250.h4
-rw-r--r--src/devices/machine/intelfsh.cpp6
-rw-r--r--src/devices/machine/intelfsh.h3
-rw-r--r--src/devices/machine/iopsio2.cpp2
-rw-r--r--src/devices/machine/ioptimer.cpp4
-rw-r--r--src/devices/machine/iwm.cpp4
-rw-r--r--src/devices/machine/iwm.h3
-rw-r--r--src/devices/machine/kb3600.cpp6
-rw-r--r--src/devices/machine/kb3600.h3
-rw-r--r--src/devices/machine/kr2376.cpp15
-rw-r--r--src/devices/machine/kr2376.h8
-rw-r--r--src/devices/machine/laserdsc.cpp44
-rw-r--r--src/devices/machine/laserdsc.h12
-rw-r--r--src/devices/machine/ldpr8210.cpp156
-rw-r--r--src/devices/machine/ldpr8210.h34
-rw-r--r--src/devices/machine/ldv1000.cpp121
-rw-r--r--src/devices/machine/ldv1000.h33
-rw-r--r--src/devices/machine/ldv4200hle.cpp192
-rw-r--r--src/devices/machine/ldv4200hle.h9
-rw-r--r--src/devices/machine/ldvp931.cpp226
-rw-r--r--src/devices/machine/ldvp931.h38
-rw-r--r--src/devices/machine/m3002.cpp2
-rw-r--r--src/devices/machine/m68sfdc.cpp51
-rw-r--r--src/devices/machine/m68sfdc.h24
-rw-r--r--src/devices/machine/mb3773.cpp4
-rw-r--r--src/devices/machine/mb3773.h2
-rw-r--r--src/devices/machine/mb87030.cpp4
-rw-r--r--src/devices/machine/mb8795.cpp19
-rw-r--r--src/devices/machine/mb8795.h4
-rw-r--r--src/devices/machine/mb89352.cpp15
-rw-r--r--src/devices/machine/mb89352.h6
-rw-r--r--src/devices/machine/mc14411.cpp89
-rw-r--r--src/devices/machine/mc14411.h60
-rw-r--r--src/devices/machine/mc146818.cpp176
-rw-r--r--src/devices/machine/mc146818.h9
-rw-r--r--src/devices/machine/mc68328.cpp8
-rw-r--r--src/devices/machine/mc6843.cpp4
-rw-r--r--src/devices/machine/mc6843.h3
-rw-r--r--src/devices/machine/mc6846.cpp4
-rw-r--r--src/devices/machine/mc6854.cpp2
-rw-r--r--src/devices/machine/mc68681.cpp2
-rw-r--r--src/devices/machine/mc68901.cpp72
-rw-r--r--src/devices/machine/mc68901.h3
-rw-r--r--src/devices/machine/mccs1850.cpp21
-rw-r--r--src/devices/machine/mccs1850.h13
-rw-r--r--src/devices/machine/mcf5206e.cpp2
-rw-r--r--src/devices/machine/meters.cpp90
-rw-r--r--src/devices/machine/meters.h36
-rw-r--r--src/devices/machine/microtch.cpp118
-rw-r--r--src/devices/machine/microtch.h17
-rw-r--r--src/devices/machine/mm5307.cpp2
-rw-r--r--src/devices/machine/mm5740.cpp11
-rw-r--r--src/devices/machine/mm5740.h6
-rw-r--r--src/devices/machine/mm58167.cpp6
-rw-r--r--src/devices/machine/mm58167.h3
-rw-r--r--src/devices/machine/mm58174.cpp19
-rw-r--r--src/devices/machine/mm58174.h6
-rw-r--r--src/devices/machine/mm58274c.cpp4
-rw-r--r--src/devices/machine/mm74c922.cpp6
-rw-r--r--src/devices/machine/mm74c922.h3
-rw-r--r--src/devices/machine/mos6526.cpp44
-rw-r--r--src/devices/machine/mos6526.h35
-rw-r--r--src/devices/machine/mos6530.cpp43
-rw-r--r--src/devices/machine/mos6530.h8
-rw-r--r--src/devices/machine/mos6530n.cpp6
-rw-r--r--src/devices/machine/mos6530n.h3
-rw-r--r--src/devices/machine/mpu401.cpp6
-rw-r--r--src/devices/machine/mpu401.h3
-rw-r--r--src/devices/machine/msm5832.cpp15
-rw-r--r--src/devices/machine/msm5832.h5
-rw-r--r--src/devices/machine/msm58321.cpp79
-rw-r--r--src/devices/machine/msm58321.h9
-rw-r--r--src/devices/machine/msm6242.cpp20
-rw-r--r--src/devices/machine/msm6242.h3
-rw-r--r--src/devices/machine/myb3k_kbd.cpp51
-rw-r--r--src/devices/machine/myb3k_kbd.h19
-rw-r--r--src/devices/machine/ncr5380.cpp2
-rw-r--r--src/devices/machine/ncr5390.cpp4
-rw-r--r--src/devices/machine/ncr5390.h3
-rw-r--r--src/devices/machine/ncr539x.cpp172
-rw-r--r--src/devices/machine/ncr539x.h3
-rw-r--r--src/devices/machine/netlist.cpp26
-rw-r--r--src/devices/machine/netlist.h14
-rw-r--r--src/devices/machine/ns32081.cpp2
-rw-r--r--src/devices/machine/ns32202.cpp6
-rw-r--r--src/devices/machine/nsc810.cpp218
-rw-r--r--src/devices/machine/nsc810.h35
-rw-r--r--src/devices/machine/nscsi_bus.cpp8
-rw-r--r--src/devices/machine/nscsi_bus.h6
-rw-r--r--src/devices/machine/pcf8573.cpp6
-rw-r--r--src/devices/machine/pcf8573.h3
-rw-r--r--src/devices/machine/pcf8583.cpp13
-rw-r--r--src/devices/machine/pcf8583.h5
-rw-r--r--src/devices/machine/pcf8593.cpp19
-rw-r--r--src/devices/machine/pcf8593.h5
-rw-r--r--src/devices/machine/pckeybrd.cpp4
-rw-r--r--src/devices/machine/pckeybrd.h4
-rw-r--r--src/devices/machine/phi.cpp230
-rw-r--r--src/devices/machine/phi.h37
-rw-r--r--src/devices/machine/pic8259.cpp14
-rw-r--r--src/devices/machine/pic8259.h8
-rw-r--r--src/devices/machine/pit8253.cpp37
-rw-r--r--src/devices/machine/pit8253.h24
-rw-r--r--src/devices/machine/ps2timer.cpp4
-rw-r--r--src/devices/machine/pxa255.cpp244
-rw-r--r--src/devices/machine/pxa255.h17
-rw-r--r--src/devices/machine/pxa255defs.h11
-rw-r--r--src/devices/machine/r10788.cpp26
-rw-r--r--src/devices/machine/r10788.h5
-rw-r--r--src/devices/machine/ripple_counter.cpp14
-rw-r--r--src/devices/machine/ripple_counter.h7
-rw-r--r--src/devices/machine/rp5c01.cpp37
-rw-r--r--src/devices/machine/rp5c01.h7
-rw-r--r--src/devices/machine/rp5c15.cpp53
-rw-r--r--src/devices/machine/rp5c15.h9
-rw-r--r--src/devices/machine/rtc4543.cpp6
-rw-r--r--src/devices/machine/rtc4543.h3
-rw-r--r--src/devices/machine/rtc65271.cpp12
-rw-r--r--src/devices/machine/rtc65271.h3
-rw-r--r--src/devices/machine/rtc9701.cpp2
-rw-r--r--src/devices/machine/s3520cf.cpp2
-rw-r--r--src/devices/machine/s3c24xx.hxx16
-rw-r--r--src/devices/machine/s3c44b0.cpp22
-rw-r--r--src/devices/machine/s_smp.cpp7
-rw-r--r--src/devices/machine/s_smp.h7
-rw-r--r--src/devices/machine/sa1110.cpp20
-rw-r--r--src/devices/machine/sa1111.cpp12
-rw-r--r--src/devices/machine/saa1043.cpp47
-rw-r--r--src/devices/machine/saa1043.h76
-rw-r--r--src/devices/machine/scc2698b.cpp8
-rw-r--r--src/devices/machine/scc2698b.h1
-rw-r--r--src/devices/machine/scc68070.cpp26
-rw-r--r--src/devices/machine/scc68070.h13
-rw-r--r--src/devices/machine/scn_pci.cpp2
-rw-r--r--src/devices/machine/scnxx562.cpp149
-rw-r--r--src/devices/machine/scnxx562.h12
-rw-r--r--src/devices/machine/sega_scu.cpp40
-rw-r--r--src/devices/machine/sega_scu.h5
-rw-r--r--src/devices/machine/sensorboard.cpp4
-rw-r--r--src/devices/machine/smc91c9x.cpp2
-rw-r--r--src/devices/machine/smioc.cpp25
-rw-r--r--src/devices/machine/smioc.h4
-rw-r--r--src/devices/machine/smpc.cpp227
-rw-r--r--src/devices/machine/smpc.h13
-rw-r--r--src/devices/machine/spg290_cdservo.cpp4
-rw-r--r--src/devices/machine/spg290_cdservo.h3
-rw-r--r--src/devices/machine/spg290_i2c.cpp4
-rw-r--r--src/devices/machine/spg290_i2c.h2
-rw-r--r--src/devices/machine/spg290_timer.cpp4
-rw-r--r--src/devices/machine/spg290_timer.h2
-rw-r--r--src/devices/machine/spg2xx_audio.cpp28
-rw-r--r--src/devices/machine/spg2xx_audio.h7
-rw-r--r--src/devices/machine/spg2xx_io.cpp28
-rw-r--r--src/devices/machine/spg2xx_video.cpp27
-rw-r--r--src/devices/machine/spg2xx_video.h27
-rw-r--r--src/devices/machine/sun4c_mmu.cpp11
-rw-r--r--src/devices/machine/sun4c_mmu.h5
-rw-r--r--src/devices/machine/swim1.cpp4
-rw-r--r--src/devices/machine/swim1.h3
-rw-r--r--src/devices/machine/swim2.cpp4
-rw-r--r--src/devices/machine/swim2.h1
-rw-r--r--src/devices/machine/swim3.cpp5
-rw-r--r--src/devices/machine/swim3.h3
-rw-r--r--src/devices/machine/swtpc8212.cpp11
-rw-r--r--src/devices/machine/swtpc8212.h8
-rw-r--r--src/devices/machine/terminal.cpp11
-rw-r--r--src/devices/machine/terminal.h5
-rw-r--r--src/devices/machine/ticket.cpp20
-rw-r--r--src/devices/machine/ticket.h7
-rw-r--r--src/devices/machine/timekpr.cpp10
-rw-r--r--src/devices/machine/timekpr.h2
-rw-r--r--src/devices/machine/timer.cpp65
-rw-r--r--src/devices/machine/timer.h4
-rw-r--r--src/devices/machine/tmp68301.cpp2
-rw-r--r--src/devices/machine/tms5501.cpp44
-rw-r--r--src/devices/machine/tms5501.h3
-rw-r--r--src/devices/machine/tms9901.cpp15
-rw-r--r--src/devices/machine/tms9901.h11
-rw-r--r--src/devices/machine/tms9902.cpp64
-rw-r--r--src/devices/machine/tms9902.h5
-rw-r--r--src/devices/machine/tms9914.cpp15
-rw-r--r--src/devices/machine/tms9914.h9
-rw-r--r--src/devices/machine/upd1990a.cpp87
-rw-r--r--src/devices/machine/upd1990a.h14
-rw-r--r--src/devices/machine/upd4991a.cpp11
-rw-r--r--src/devices/machine/upd4991a.h11
-rw-r--r--src/devices/machine/upd4992.cpp11
-rw-r--r--src/devices/machine/upd4992.h11
-rw-r--r--src/devices/machine/upd7001.cpp4
-rw-r--r--src/devices/machine/upd7002.cpp41
-rw-r--r--src/devices/machine/upd7002.h8
-rw-r--r--src/devices/machine/upd7004.cpp6
-rw-r--r--src/devices/machine/upd7004.h3
-rw-r--r--src/devices/machine/upd71071.cpp2
-rw-r--r--src/devices/machine/upd765.cpp47
-rw-r--r--src/devices/machine/upd765.h9
-rw-r--r--src/devices/machine/v3021.cpp2
-rw-r--r--src/devices/machine/vic_pl192.cpp352
-rw-r--r--src/devices/machine/vic_pl192.h19
-rw-r--r--src/devices/machine/vrc4373.cpp2
-rw-r--r--src/devices/machine/vrc5074.cpp6
-rw-r--r--src/devices/machine/vrender0.cpp8
-rw-r--r--src/devices/machine/watchdog.cpp6
-rw-r--r--src/devices/machine/watchdog.h3
-rw-r--r--src/devices/machine/wd1000.cpp62
-rw-r--r--src/devices/machine/wd1000.h10
-rw-r--r--src/devices/machine/wd1010.cpp81
-rw-r--r--src/devices/machine/wd1010.h12
-rw-r--r--src/devices/machine/wd2010.cpp126
-rw-r--r--src/devices/machine/wd2010.h13
-rw-r--r--src/devices/machine/wd33c9x.cpp6
-rw-r--r--src/devices/machine/wd33c9x.h3
-rw-r--r--src/devices/machine/wd_fdc.cpp41
-rw-r--r--src/devices/machine/wd_fdc.h8
-rw-r--r--src/devices/machine/wozfdc.cpp14
-rw-r--r--src/devices/machine/wozfdc.h4
-rw-r--r--src/devices/machine/ym2148.cpp4
-rw-r--r--src/devices/machine/ym2148.h3
-rw-r--r--src/devices/machine/ym3802.cpp27
-rw-r--r--src/devices/machine/ym3802.h20
-rw-r--r--src/devices/machine/z8038.cpp2
-rw-r--r--src/devices/machine/z80ctc.cpp4
-rw-r--r--src/devices/machine/z80dma.cpp2
-rw-r--r--src/devices/machine/z80scc.cpp2
-rw-r--r--src/devices/machine/z80sio.cpp2
-rw-r--r--src/devices/machine/z80sti.cpp46
-rw-r--r--src/devices/machine/z80sti.h3
-rw-r--r--src/devices/machine/z8536.cpp24
-rw-r--r--src/devices/machine/z8536.h25
-rw-r--r--src/devices/sound/ad1848.cpp4
-rw-r--r--src/devices/sound/ad1848.h2
-rw-r--r--src/devices/sound/aica.cpp6
-rw-r--r--src/devices/sound/asc.cpp6
-rw-r--r--src/devices/sound/asc.h3
-rw-r--r--src/devices/sound/bsmt2000.cpp63
-rw-r--r--src/devices/sound/bsmt2000.h21
-rw-r--r--src/devices/sound/c140.cpp2
-rw-r--r--src/devices/sound/cdp1864.cpp130
-rw-r--r--src/devices/sound/cdp1864.h14
-rw-r--r--src/devices/sound/cdp1869.cpp74
-rw-r--r--src/devices/sound/cdp1869.h26
-rw-r--r--src/devices/sound/dave.cpp37
-rw-r--r--src/devices/sound/dave.h10
-rw-r--r--src/devices/sound/es1373.cpp6
-rw-r--r--src/devices/sound/es1373.h3
-rw-r--r--src/devices/sound/es5503.cpp6
-rw-r--r--src/devices/sound/es5503.h3
-rw-r--r--src/devices/sound/gb.cpp2
-rw-r--r--src/devices/sound/huc6230.cpp2
-rw-r--r--src/devices/sound/ics2115.cpp4
-rw-r--r--src/devices/sound/iopspu.cpp4
-rw-r--r--src/devices/sound/k053260.cpp4
-rw-r--r--src/devices/sound/k053260.h3
-rw-r--r--src/devices/sound/k054539.cpp4
-rw-r--r--src/devices/sound/k054539.h3
-rw-r--r--src/devices/sound/ks0164.cpp4
-rw-r--r--src/devices/sound/ks0164.h3
-rw-r--r--src/devices/sound/mea8000.cpp2
-rw-r--r--src/devices/sound/mm5837.cpp6
-rw-r--r--src/devices/sound/mm5837.h3
-rw-r--r--src/devices/sound/mos6560.cpp18
-rw-r--r--src/devices/sound/mos6560.h3
-rw-r--r--src/devices/sound/mos7360.cpp115
-rw-r--r--src/devices/sound/mos7360.h26
-rw-r--r--src/devices/sound/msm5205.cpp53
-rw-r--r--src/devices/sound/msm5205.h9
-rw-r--r--src/devices/sound/pokey.cpp118
-rw-r--r--src/devices/sound/pokey.h22
-rw-r--r--src/devices/sound/qs1000.cpp9
-rw-r--r--src/devices/sound/qs1000.h1
-rw-r--r--src/devices/sound/scsp.cpp6
-rw-r--r--src/devices/sound/sn76496.cpp4
-rw-r--r--src/devices/sound/sn76496.h26
-rw-r--r--src/devices/sound/sp0250.cpp6
-rw-r--r--src/devices/sound/sp0250.h6
-rw-r--r--src/devices/sound/sp0256.cpp2
-rw-r--r--src/devices/sound/tms5110.cpp22
-rw-r--r--src/devices/sound/tms5110.h4
-rw-r--r--src/devices/sound/tms5220.cpp79
-rw-r--r--src/devices/sound/tms5220.h4
-rw-r--r--src/devices/sound/upd1771.cpp2
-rw-r--r--src/devices/sound/upd7759.cpp86
-rw-r--r--src/devices/sound/upd7759.h23
-rw-r--r--src/devices/sound/votrax.cpp6
-rw-r--r--src/devices/sound/votrax.h3
-rw-r--r--src/devices/sound/ym2154.cpp6
-rw-r--r--src/devices/sound/ym2154.h3
-rw-r--r--src/devices/sound/ymf271.cpp60
-rw-r--r--src/devices/sound/ymf271.h4
-rw-r--r--src/devices/sound/ymfm_mame.h2
-rw-r--r--src/devices/sound/ymz280b.cpp54
-rw-r--r--src/devices/sound/ymz280b.h15
-rw-r--r--src/devices/video/315_5124.cpp155
-rw-r--r--src/devices/video/315_5124.h21
-rw-r--r--src/devices/video/315_5313.cpp6
-rw-r--r--src/devices/video/catseye.cpp2
-rw-r--r--src/devices/video/cdp1861.cpp128
-rw-r--r--src/devices/video/cdp1861.h12
-rw-r--r--src/devices/video/clgd542x.cpp2
-rw-r--r--src/devices/video/crt9007.cpp145
-rw-r--r--src/devices/video/crt9007.h20
-rw-r--r--src/devices/video/crtc_ega.cpp94
-rw-r--r--src/devices/video/crtc_ega.h21
-rw-r--r--src/devices/video/dp8350.cpp8
-rw-r--r--src/devices/video/ef9340_1.cpp47
-rw-r--r--src/devices/video/ef9340_1.h11
-rw-r--r--src/devices/video/ef9345.cpp23
-rw-r--r--src/devices/video/ef9345.h9
-rw-r--r--src/devices/video/ef9365.cpp730
-rw-r--r--src/devices/video/ef9365.h17
-rw-r--r--src/devices/video/epic12.cpp2
-rw-r--r--src/devices/video/fixfreq.h1
-rw-r--r--src/devices/video/gb_lcd.cpp4
-rw-r--r--src/devices/video/gb_lcd.h3
-rw-r--r--src/devices/video/gba_lcd.cpp4
-rw-r--r--src/devices/video/hd44352.cpp18
-rw-r--r--src/devices/video/hd44352.h4
-rw-r--r--src/devices/video/hd44780.cpp22
-rw-r--r--src/devices/video/hd44780.h7
-rw-r--r--src/devices/video/hd61830.cpp7
-rw-r--r--src/devices/video/hd61830.h3
-rw-r--r--src/devices/video/hd63484.h1
-rw-r--r--src/devices/video/hlcd0438.cpp7
-rw-r--r--src/devices/video/hlcd0438.h3
-rw-r--r--src/devices/video/hlcd0488.cpp4
-rw-r--r--src/devices/video/hlcd0488.h3
-rw-r--r--src/devices/video/hlcd0515.cpp6
-rw-r--r--src/devices/video/hlcd0515.h3
-rw-r--r--src/devices/video/hlcd0538.cpp7
-rw-r--r--src/devices/video/hlcd0538.h3
-rw-r--r--src/devices/video/huc6260.cpp4
-rw-r--r--src/devices/video/huc6260.h3
-rw-r--r--src/devices/video/huc6261.cpp4
-rw-r--r--src/devices/video/huc6261.h3
-rw-r--r--src/devices/video/i8244.cpp31
-rw-r--r--src/devices/video/i8244.h8
-rw-r--r--src/devices/video/i82730.cpp2
-rw-r--r--src/devices/video/i8275.cpp317
-rw-r--r--src/devices/video/i8275.h12
-rw-r--r--src/devices/video/imagetek_i4100.cpp13
-rw-r--r--src/devices/video/imagetek_i4100.h3
-rw-r--r--src/devices/video/lc7985.cpp4
-rw-r--r--src/devices/video/lc7985.h3
-rw-r--r--src/devices/video/mc6845.cpp151
-rw-r--r--src/devices/video/mc6845.h30
-rw-r--r--src/devices/video/mc6847.cpp56
-rw-r--r--src/devices/video/mc6847.h18
-rw-r--r--src/devices/video/nt7534.cpp13
-rw-r--r--src/devices/video/nt7534.h6
-rw-r--r--src/devices/video/pc_vga.cpp2
-rw-r--r--src/devices/video/pcf2100.cpp4
-rw-r--r--src/devices/video/pcf2100.h3
-rw-r--r--src/devices/video/ppu2c0x.cpp142
-rw-r--r--src/devices/video/ppu2c0x.h15
-rw-r--r--src/devices/video/pwm.cpp2
-rw-r--r--src/devices/video/scn2674.cpp6
-rw-r--r--src/devices/video/sed1500.cpp4
-rw-r--r--src/devices/video/sed1500.h3
-rw-r--r--src/devices/video/tms34061.cpp2
-rw-r--r--src/devices/video/tms9927.cpp72
-rw-r--r--src/devices/video/tms9927.h4
-rw-r--r--src/devices/video/tms9928a.cpp19
-rw-r--r--src/devices/video/tms9928a.h21
-rw-r--r--src/devices/video/topcat.cpp2
-rw-r--r--src/devices/video/upd3301.cpp61
-rw-r--r--src/devices/video/upd3301.h12
-rw-r--r--src/devices/video/upd7220.cpp83
-rw-r--r--src/devices/video/upd7220.h6
-rw-r--r--src/devices/video/v9938.cpp6
-rw-r--r--src/devices/video/v9938.h4
-rw-r--r--src/devices/video/vic4567.cpp8
-rw-r--r--src/devices/video/vic4567.h3
-rw-r--r--src/devices/video/voodoo.cpp6
-rw-r--r--src/devices/video/zeus2.cpp11
-rw-r--r--src/devices/video/zeus2.h1
-rw-r--r--src/emu/device.cpp33
-rw-r--r--src/emu/device.h10
-rw-r--r--src/emu/device.ipp5
-rw-r--r--src/emu/diexec.cpp14
-rw-r--r--src/emu/diexec.h3
-rw-r--r--src/emu/drivers/testcpu.cpp4
-rw-r--r--src/emu/schedule.cpp127
-rw-r--r--src/emu/schedule.h9
-rw-r--r--src/emu/screen.cpp87
-rw-r--r--src/emu/screen.h16
-rw-r--r--src/emu/sound.cpp2
-rw-r--r--src/mame/audio/acan.cpp4
-rw-r--r--src/mame/audio/acan.h3
-rw-r--r--src/mame/audio/ad_sound.cpp2
-rw-r--r--src/mame/audio/alesis.cpp12
-rw-r--r--src/mame/audio/cmi01a.cpp28
-rw-r--r--src/mame/audio/cmi01a.h11
-rw-r--r--src/mame/audio/csd.cpp8
-rw-r--r--src/mame/audio/csd.h9
-rw-r--r--src/mame/audio/dcs.cpp26
-rw-r--r--src/mame/audio/dcs.h9
-rw-r--r--src/mame/audio/efo_zsu.cpp6
-rw-r--r--src/mame/audio/geebee.cpp16
-rw-r--r--src/mame/audio/geebee.h7
-rw-r--r--src/mame/audio/gottlieb.cpp78
-rw-r--r--src/mame/audio/gottlieb.h56
-rw-r--r--src/mame/audio/jaguar.cpp4
-rw-r--r--src/mame/audio/midway.cpp18
-rw-r--r--src/mame/audio/midway.h9
-rw-r--r--src/mame/audio/mw8080bw.cpp2
-rw-r--r--src/mame/audio/n8080.cpp10
-rw-r--r--src/mame/audio/namco52.cpp2
-rw-r--r--src/mame/audio/pinsnd88.cpp36
-rw-r--r--src/mame/audio/pinsnd88.h4
-rw-r--r--src/mame/audio/redalert.cpp8
-rw-r--r--src/mame/audio/segag80r.cpp2
-rw-r--r--src/mame/audio/t5182.cpp24
-rw-r--r--src/mame/audio/t5182.h9
-rw-r--r--src/mame/audio/turbo.cpp9
-rw-r--r--src/mame/audio/tvc.cpp6
-rw-r--r--src/mame/audio/tvc.h23
-rw-r--r--src/mame/audio/vboy.cpp6
-rw-r--r--src/mame/audio/vboy.h3
-rw-r--r--src/mame/audio/warpwarp.cpp29
-rw-r--r--src/mame/audio/warpwarp.h10
-rw-r--r--src/mame/audio/williams.cpp99
-rw-r--r--src/mame/audio/williams.h33
-rw-r--r--src/mame/drivers/2mindril.cpp44
-rw-r--r--src/mame/drivers/a2600.cpp4
-rw-r--r--src/mame/drivers/a7800.cpp6
-rw-r--r--src/mame/drivers/abc80.cpp88
-rw-r--r--src/mame/drivers/accomm.cpp42
-rw-r--r--src/mame/drivers/acefruit.cpp95
-rw-r--r--src/mame/drivers/aces1.cpp4
-rw-r--r--src/mame/drivers/alfaskop41xx.cpp52
-rw-r--r--src/mame/drivers/alpha68k_n.cpp2
-rw-r--r--src/mame/drivers/alto2.cpp26
-rw-r--r--src/mame/drivers/amico2k.cpp2
-rw-r--r--src/mame/drivers/amiga.cpp4
-rw-r--r--src/mame/drivers/apexc.cpp16
-rw-r--r--src/mame/drivers/apple1.cpp6
-rw-r--r--src/mame/drivers/apple2e.cpp2
-rw-r--r--src/mame/drivers/aristmk4.cpp34
-rw-r--r--src/mame/drivers/aristmk5.cpp4
-rw-r--r--src/mame/drivers/artmagic.cpp15
-rw-r--r--src/mame/drivers/asterix.cpp16
-rw-r--r--src/mame/drivers/astinvad.cpp35
-rw-r--r--src/mame/drivers/asuka.cpp2
-rw-r--r--src/mame/drivers/atarist.cpp58
-rw-r--r--src/mame/drivers/atetris.cpp2
-rw-r--r--src/mame/drivers/atlantis.cpp7
-rw-r--r--src/mame/drivers/aviion88k.cpp2
-rw-r--r--src/mame/drivers/beaminv.cpp2
-rw-r--r--src/mame/drivers/beezer.cpp30
-rw-r--r--src/mame/drivers/berzerk.cpp4
-rw-r--r--src/mame/drivers/beta.cpp2
-rw-r--r--src/mame/drivers/bfcobra.cpp2
-rw-r--r--src/mame/drivers/blockade.cpp7
-rw-r--r--src/mame/drivers/boxer.cpp36
-rw-r--r--src/mame/drivers/btoads.cpp25
-rw-r--r--src/mame/drivers/bublbobl.cpp2
-rw-r--r--src/mame/drivers/capbowl.cpp2
-rw-r--r--src/mame/drivers/cat.cpp21
-rw-r--r--src/mame/drivers/cave.cpp2
-rw-r--r--src/mame/drivers/cball.cpp22
-rw-r--r--src/mame/drivers/cbm2.cpp8
-rw-r--r--src/mame/drivers/ccastles.cpp2
-rw-r--r--src/mame/drivers/cchasm.cpp22
-rw-r--r--src/mame/drivers/cgang.cpp2
-rw-r--r--src/mame/drivers/chexx.cpp23
-rw-r--r--src/mame/drivers/cidelsa.cpp15
-rw-r--r--src/mame/drivers/clayshoo.cpp4
-rw-r--r--src/mame/drivers/clickstart.cpp18
-rw-r--r--src/mame/drivers/cliffhgr.cpp2
-rw-r--r--src/mame/drivers/cloud9.cpp2
-rw-r--r--src/mame/drivers/cmi.cpp53
-rw-r--r--src/mame/drivers/coleco.cpp6
-rw-r--r--src/mame/drivers/comx35.cpp17
-rw-r--r--src/mame/drivers/cops.cpp2
-rw-r--r--src/mame/drivers/cps2.cpp2
-rw-r--r--src/mame/drivers/cvs.cpp2
-rw-r--r--src/mame/drivers/cxhumax.cpp2
-rw-r--r--src/mame/drivers/dcheese.cpp4
-rw-r--r--src/mame/drivers/dec8.cpp33
-rw-r--r--src/mame/drivers/dectalk.cpp20
-rw-r--r--src/mame/drivers/destroyr.cpp24
-rw-r--r--src/mame/drivers/dpb7000.cpp52
-rw-r--r--src/mame/drivers/dvk_kcgd.cpp34
-rw-r--r--src/mame/drivers/dvk_ksm.cpp20
-rw-r--r--src/mame/drivers/ecoinf2.cpp8
-rw-r--r--src/mame/drivers/eispc.cpp2
-rw-r--r--src/mame/drivers/enigma2.cpp4
-rw-r--r--src/mame/drivers/esh.cpp1
-rw-r--r--src/mame/drivers/eurocom2.cpp13
-rw-r--r--src/mame/drivers/exidy.cpp48
-rw-r--r--src/mame/drivers/exorciser.cpp23
-rw-r--r--src/mame/drivers/famibox.cpp4
-rw-r--r--src/mame/drivers/fgoal.cpp15
-rw-r--r--src/mame/drivers/firebeat.cpp4
-rw-r--r--src/mame/drivers/flyball.cpp33
-rw-r--r--src/mame/drivers/fm7.cpp20
-rw-r--r--src/mame/drivers/fmtowns.cpp82
-rw-r--r--src/mame/drivers/fp6000.cpp2
-rw-r--r--src/mame/drivers/fs3216.cpp2
-rw-r--r--src/mame/drivers/fuukifg2.cpp121
-rw-r--r--src/mame/drivers/fuukifg3.cpp119
-rw-r--r--src/mame/drivers/galaga.cpp2
-rw-r--r--src/mame/drivers/gamate.cpp4
-rw-r--r--src/mame/drivers/gameking.cpp4
-rw-r--r--src/mame/drivers/gameplan.cpp4
-rw-r--r--src/mame/drivers/gaplus.cpp19
-rw-r--r--src/mame/drivers/gba.cpp18
-rw-r--r--src/mame/drivers/gijoe.cpp2
-rw-r--r--src/mame/drivers/gottlieb.cpp32
-rw-r--r--src/mame/drivers/goupil.cpp22
-rw-r--r--src/mame/drivers/gp32.cpp24
-rw-r--r--src/mame/drivers/gpworld.cpp123
-rw-r--r--src/mame/drivers/gridlee.cpp8
-rw-r--r--src/mame/drivers/gticlub.cpp2
-rw-r--r--src/mame/drivers/gunbustr.cpp13
-rw-r--r--src/mame/drivers/gunpey.cpp2
-rw-r--r--src/mame/drivers/h01x.cpp2
-rw-r--r--src/mame/drivers/h19.cpp66
-rw-r--r--src/mame/drivers/halleys.cpp2
-rw-r--r--src/mame/drivers/hazeltin.cpp13
-rw-r--r--src/mame/drivers/hh_sm510.cpp2
-rw-r--r--src/mame/drivers/hng64.cpp8
-rw-r--r--src/mame/drivers/hornet.cpp2
-rw-r--r--src/mame/drivers/hp9k_3xx.cpp2
-rw-r--r--src/mame/drivers/hp_ipc.cpp7
-rw-r--r--src/mame/drivers/hyprduel.cpp2
-rw-r--r--src/mame/drivers/ibmpcjr.cpp160
-rw-r--r--src/mame/drivers/intellec4.cpp6
-rw-r--r--src/mame/drivers/intv.cpp78
-rw-r--r--src/mame/drivers/iphone2g.cpp25
-rw-r--r--src/mame/drivers/irisha.cpp2
-rw-r--r--src/mame/drivers/itech8.cpp31
-rw-r--r--src/mame/drivers/jaguar.cpp2
-rw-r--r--src/mame/drivers/jangou.cpp2
-rw-r--r--src/mame/drivers/jedi.cpp2
-rw-r--r--src/mame/drivers/jpmimpct.cpp6
-rw-r--r--src/mame/drivers/jpmsys5.cpp14
-rw-r--r--src/mame/drivers/jr100.cpp2
-rw-r--r--src/mame/drivers/jr200.cpp2
-rw-r--r--src/mame/drivers/konamigx.cpp4
-rw-r--r--src/mame/drivers/konamim2.cpp2
-rw-r--r--src/mame/drivers/krz2000.cpp2
-rw-r--r--src/mame/drivers/ksys573.cpp2
-rw-r--r--src/mame/drivers/laserbat.cpp15
-rw-r--r--src/mame/drivers/ldplayer.cpp141
-rw-r--r--src/mame/drivers/lnw80.cpp2
-rw-r--r--src/mame/drivers/lwriter.cpp2
-rw-r--r--src/mame/drivers/m10.cpp2
-rw-r--r--src/mame/drivers/m68705prg.cpp26
-rw-r--r--src/mame/drivers/m72.cpp4
-rw-r--r--src/mame/drivers/m79152pc.cpp4
-rw-r--r--src/mame/drivers/mac128.cpp4
-rw-r--r--src/mame/drivers/macprtb.cpp2
-rw-r--r--src/mame/drivers/macpwrbk030.cpp2
-rw-r--r--src/mame/drivers/macquadra700.cpp6
-rw-r--r--src/mame/drivers/magmax.cpp2
-rw-r--r--src/mame/drivers/mappy.cpp4
-rw-r--r--src/mame/drivers/mc1502.cpp3
-rw-r--r--src/mame/drivers/mdisk.cpp2
-rw-r--r--src/mame/drivers/mdt60.cpp2
-rw-r--r--src/mame/drivers/megadriv.cpp5
-rw-r--r--src/mame/drivers/megadriv_acbl.cpp2
-rw-r--r--src/mame/drivers/megadriv_rad.cpp4
-rw-r--r--src/mame/drivers/mekd1.cpp25
-rw-r--r--src/mame/drivers/mekd5.cpp42
-rw-r--r--src/mame/drivers/metro.cpp37
-rw-r--r--src/mame/drivers/mgolf.cpp32
-rw-r--r--src/mame/drivers/microterm_f8.cpp2
-rw-r--r--src/mame/drivers/midzeus.cpp6
-rw-r--r--src/mame/drivers/missile.cpp4
-rw-r--r--src/mame/drivers/mjsister.cpp22
-rw-r--r--src/mame/drivers/mlanding.cpp27
-rw-r--r--src/mame/drivers/model3.cpp24
-rw-r--r--src/mame/drivers/moo.cpp2
-rw-r--r--src/mame/drivers/mpf1.cpp2
-rw-r--r--src/mame/drivers/mpu3.cpp2
-rw-r--r--src/mame/drivers/multigam.cpp4
-rw-r--r--src/mame/drivers/mw8080bw.cpp2
-rw-r--r--src/mame/drivers/myb3k.cpp171
-rw-r--r--src/mame/drivers/namcofl.cpp6
-rw-r--r--src/mame/drivers/namcona1.cpp17
-rw-r--r--src/mame/drivers/namcos23.cpp2
-rw-r--r--src/mame/drivers/nc.cpp2
-rw-r--r--src/mame/drivers/nds.cpp6
-rw-r--r--src/mame/drivers/neogeo.cpp6
-rw-r--r--src/mame/drivers/nes_clone.cpp4
-rw-r--r--src/mame/drivers/newbrain.cpp48
-rw-r--r--src/mame/drivers/news_38xx.cpp2
-rw-r--r--src/mame/drivers/news_68k.cpp2
-rw-r--r--src/mame/drivers/news_r3k.cpp2
-rw-r--r--src/mame/drivers/next.cpp4
-rw-r--r--src/mame/drivers/nexus3d.cpp2
-rw-r--r--src/mame/drivers/ngp.cpp2
-rw-r--r--src/mame/drivers/nightgal.cpp2
-rw-r--r--src/mame/drivers/nightmare.cpp49
-rw-r--r--src/mame/drivers/nokia_3310.cpp8
-rw-r--r--src/mame/drivers/notetaker.cpp436
-rw-r--r--src/mame/drivers/novag_sexpert.cpp2
-rw-r--r--src/mame/drivers/nwk-tr.cpp2
-rw-r--r--src/mame/drivers/octopus.cpp18
-rw-r--r--src/mame/drivers/olyboss.cpp9
-rw-r--r--src/mame/drivers/olytext.cpp1
-rw-r--r--src/mame/drivers/omegrace.cpp2
-rw-r--r--src/mame/drivers/orbit.cpp2
-rw-r--r--src/mame/drivers/oric.cpp2
-rw-r--r--src/mame/drivers/osbexec.cpp2
-rw-r--r--src/mame/drivers/overdriv.cpp2
-rw-r--r--src/mame/drivers/parodius.cpp2
-rw-r--r--src/mame/drivers/pasopia.cpp2
-rw-r--r--src/mame/drivers/pasopia7.cpp4
-rw-r--r--src/mame/drivers/patinho_feio.cpp4
-rw-r--r--src/mame/drivers/pb1000.cpp2
-rw-r--r--src/mame/drivers/pbaction.cpp4
-rw-r--r--src/mame/drivers/pc4.cpp4
-rw-r--r--src/mame/drivers/pc6001.cpp4
-rw-r--r--src/mame/drivers/pc88va.cpp47
-rw-r--r--src/mame/drivers/pc9801.cpp17
-rw-r--r--src/mame/drivers/pcfx.cpp38
-rw-r--r--src/mame/drivers/pcw.cpp8
-rw-r--r--src/mame/drivers/pcxt.cpp7
-rw-r--r--src/mame/drivers/pdp1.cpp12
-rw-r--r--src/mame/drivers/pentagon.cpp2
-rw-r--r--src/mame/drivers/peplus.cpp2
-rw-r--r--src/mame/drivers/pet.cpp2
-rw-r--r--src/mame/drivers/pockstat.cpp4
-rw-r--r--src/mame/drivers/pokemini.cpp112
-rw-r--r--src/mame/drivers/poly.cpp3
-rw-r--r--src/mame/drivers/popper.cpp7
-rw-r--r--src/mame/drivers/positron.cpp25
-rw-r--r--src/mame/drivers/prof80.cpp18
-rw-r--r--src/mame/drivers/ps2sony.cpp2
-rw-r--r--src/mame/drivers/psion5.cpp65
-rw-r--r--src/mame/drivers/ptcsol.cpp38
-rw-r--r--src/mame/drivers/pv1000.cpp4
-rw-r--r--src/mame/drivers/pwrview.cpp58
-rw-r--r--src/mame/drivers/qdrmfgp.cpp2
-rw-r--r--src/mame/drivers/rabbit.cpp48
-rw-r--r--src/mame/drivers/rainbow.cpp57
-rw-r--r--src/mame/drivers/rastersp.cpp6
-rw-r--r--src/mame/drivers/rltennis.cpp2
-rw-r--r--src/mame/drivers/rollerg.cpp31
-rw-r--r--src/mame/drivers/runaway.cpp2
-rw-r--r--src/mame/drivers/s11.cpp51
-rw-r--r--src/mame/drivers/s11c.cpp3
-rw-r--r--src/mame/drivers/s6.cpp38
-rw-r--r--src/mame/drivers/s7.cpp38
-rw-r--r--src/mame/drivers/s8.cpp38
-rw-r--r--src/mame/drivers/s9.cpp38
-rw-r--r--src/mame/drivers/saitek_mark5.cpp2
-rw-r--r--src/mame/drivers/samcoupe.cpp31
-rw-r--r--src/mame/drivers/sbrkout.cpp4
-rw-r--r--src/mame/drivers/scv.cpp42
-rw-r--r--src/mame/drivers/sega_sawatte.cpp4
-rw-r--r--src/mame/drivers/segag80r.cpp2
-rw-r--r--src/mame/drivers/segahang.cpp43
-rw-r--r--src/mame/drivers/segaorun.cpp103
-rw-r--r--src/mame/drivers/segas16a.cpp46
-rw-r--r--src/mame/drivers/segas16b.cpp47
-rw-r--r--src/mame/drivers/segas18.cpp12
-rw-r--r--src/mame/drivers/segas24.cpp2
-rw-r--r--src/mame/drivers/segaxbd.cpp55
-rw-r--r--src/mame/drivers/segaybd.cpp162
-rw-r--r--src/mame/drivers/seta.cpp4
-rw-r--r--src/mame/drivers/seta2.cpp27
-rw-r--r--src/mame/drivers/sg1000.cpp3
-rw-r--r--src/mame/drivers/simpsons.cpp45
-rw-r--r--src/mame/drivers/sitcom.cpp38
-rw-r--r--src/mame/drivers/skullxbo.cpp2
-rw-r--r--src/mame/drivers/slapshot.cpp13
-rw-r--r--src/mame/drivers/socrates.cpp102
-rw-r--r--src/mame/drivers/spacefb.cpp14
-rw-r--r--src/mame/drivers/spc1500.cpp2
-rw-r--r--src/mame/drivers/special_gambl.cpp34
-rw-r--r--src/mame/drivers/spectrum.cpp29
-rw-r--r--src/mame/drivers/spg2xx_vii.cpp22
-rw-r--r--src/mame/drivers/spg2xx_wiwi.cpp40
-rw-r--r--src/mame/drivers/sprint4.cpp42
-rw-r--r--src/mame/drivers/ssfindo.cpp4
-rw-r--r--src/mame/drivers/sslam.cpp2
-rw-r--r--src/mame/drivers/starfire.cpp1
-rw-r--r--src/mame/drivers/subhuntr.cpp18
-rw-r--r--src/mame/drivers/sun4.cpp81
-rw-r--r--src/mame/drivers/supracan.cpp8
-rw-r--r--src/mame/drivers/svision.cpp6
-rw-r--r--src/mame/drivers/swyft.cpp2
-rw-r--r--src/mame/drivers/sym1.cpp2
-rw-r--r--src/mame/drivers/symbolics.cpp18
-rw-r--r--src/mame/drivers/taito_f2.cpp13
-rw-r--r--src/mame/drivers/taito_f3.cpp13
-rw-r--r--src/mame/drivers/taito_z.cpp18
-rw-r--r--src/mame/drivers/tandy2k.cpp47
-rw-r--r--src/mame/drivers/tank8.cpp4
-rw-r--r--src/mame/drivers/targeth.cpp4
-rw-r--r--src/mame/drivers/techno.cpp55
-rw-r--r--src/mame/drivers/tehkanwc.cpp13
-rw-r--r--src/mame/drivers/tekigw.cpp2
-rw-r--r--src/mame/drivers/teleray10.cpp2
-rw-r--r--src/mame/drivers/thayers.cpp63
-rw-r--r--src/mame/drivers/thunderx.cpp2
-rw-r--r--src/mame/drivers/ti990_10.cpp84
-rw-r--r--src/mame/drivers/ti990_4.cpp42
-rw-r--r--src/mame/drivers/ti99_4x.cpp6
-rw-r--r--src/mame/drivers/tickee.cpp51
-rw-r--r--src/mame/drivers/tm990189.cpp43
-rw-r--r--src/mame/drivers/tmc1800.cpp42
-rw-r--r--src/mame/drivers/tmmjprd.cpp2
-rw-r--r--src/mame/drivers/tmnt.cpp16
-rw-r--r--src/mame/drivers/toobin.cpp2
-rw-r--r--src/mame/drivers/triplhnt.cpp4
-rw-r--r--src/mame/drivers/trucocl.cpp35
-rw-r--r--src/mame/drivers/trvquest.cpp2
-rw-r--r--src/mame/drivers/tsconf.cpp4
-rw-r--r--src/mame/drivers/tubep.cpp72
-rw-r--r--src/mame/drivers/tugboat.cpp22
-rw-r--r--src/mame/drivers/turrett.cpp2
-rw-r--r--src/mame/drivers/tutor.cpp2
-rw-r--r--src/mame/drivers/tv912.cpp50
-rw-r--r--src/mame/drivers/tv990.cpp33
-rw-r--r--src/mame/drivers/tx0.cpp8
-rw-r--r--src/mame/drivers/uchroma68.cpp57
-rw-r--r--src/mame/drivers/ultratnk.cpp15
-rw-r--r--src/mame/drivers/unichamp.cpp19
-rw-r--r--src/mame/drivers/vectrex.cpp24
-rw-r--r--src/mame/drivers/vendetta.cpp2
-rw-r--r--src/mame/drivers/vg5k.cpp5
-rw-r--r--src/mame/drivers/vgmplay.cpp4
-rw-r--r--src/mame/drivers/vidbrain.cpp14
-rw-r--r--src/mame/drivers/video21.cpp2
-rw-r--r--src/mame/drivers/videopin.cpp15
-rw-r--r--src/mame/drivers/viper.cpp10
-rw-r--r--src/mame/drivers/vis.cpp9
-rw-r--r--src/mame/drivers/vk100.cpp117
-rw-r--r--src/mame/drivers/votrhv.cpp146
-rw-r--r--src/mame/drivers/vp415.cpp51
-rw-r--r--src/mame/drivers/wgp.cpp17
-rw-r--r--src/mame/drivers/wicat.cpp59
-rw-r--r--src/mame/drivers/wolfpack.cpp15
-rw-r--r--src/mame/drivers/wpc_an.cpp106
-rw-r--r--src/mame/drivers/wpc_dot.cpp47
-rw-r--r--src/mame/drivers/wpc_flip1.cpp10
-rw-r--r--src/mame/drivers/wpc_flip2.cpp10
-rw-r--r--src/mame/drivers/x07.cpp10
-rw-r--r--src/mame/drivers/x1.cpp2
-rw-r--r--src/mame/drivers/x68k.cpp52
-rw-r--r--src/mame/drivers/xavix2.cpp2
-rw-r--r--src/mame/drivers/xexex.cpp2
-rw-r--r--src/mame/drivers/z80clock.cpp2
-rw-r--r--src/mame/includes/abc80.h83
-rw-r--r--src/mame/includes/alesis.h16
-rw-r--r--src/mame/includes/amiga.h13
-rw-r--r--src/mame/includes/amstrad.h13
-rw-r--r--src/mame/includes/apexc.h6
-rw-r--r--src/mame/includes/apollo.h1
-rw-r--r--src/mame/includes/artmagic.h3
-rw-r--r--src/mame/includes/asterix.h47
-rw-r--r--src/mame/includes/astrocde.h8
-rw-r--r--src/mame/includes/balsente.h2
-rw-r--r--src/mame/includes/bebox.h7
-rw-r--r--src/mame/includes/blstroid.h9
-rw-r--r--src/mame/includes/btoads.h8
-rw-r--r--src/mame/includes/bublbobl.h9
-rw-r--r--src/mame/includes/cidelsa.h10
-rw-r--r--src/mame/includes/coco.h9
-rw-r--r--src/mame/includes/comx35.h7
-rw-r--r--src/mame/includes/dc.h1
-rw-r--r--src/mame/includes/dcheese.h11
-rw-r--r--src/mame/includes/dec8.h10
-rw-r--r--src/mame/includes/electron.h10
-rw-r--r--src/mame/includes/fgoal.h14
-rw-r--r--src/mame/includes/fmtowns.h26
-rw-r--r--src/mame/includes/fuukifg2.h53
-rw-r--r--src/mame/includes/fuukifg3.h63
-rw-r--r--src/mame/includes/gameplan.h16
-rw-r--r--src/mame/includes/gaplus.h1
-rw-r--r--src/mame/includes/gottlieb.h11
-rw-r--r--src/mame/includes/gunbustr.h32
-rw-r--r--src/mame/includes/harddriv.h177
-rw-r--r--src/mame/includes/hp48.h2
-rw-r--r--src/mame/includes/hyhoo.h7
-rw-r--r--src/mame/includes/intv.h44
-rw-r--r--src/mame/includes/itech8.h21
-rw-r--r--src/mame/includes/jaguar.h21
-rw-r--r--src/mame/includes/laserbat.h4
-rw-r--r--src/mame/includes/lethalj.h8
-rw-r--r--src/mame/includes/lisa.h31
-rw-r--r--src/mame/includes/lynx.h6
-rw-r--r--src/mame/includes/m92.h7
-rw-r--r--src/mame/includes/mcr68.h4
-rw-r--r--src/mame/includes/megadriv.h15
-rw-r--r--src/mame/includes/metro.h30
-rw-r--r--src/mame/includes/mhavoc.h1
-rw-r--r--src/mame/includes/micro3d.h9
-rw-r--r--src/mame/includes/midvunit.h9
-rw-r--r--src/mame/includes/midyunit.h7
-rw-r--r--src/mame/includes/mpu4.h7
-rw-r--r--src/mame/includes/namcona1.h26
-rw-r--r--src/mame/includes/nbmj8688.h7
-rw-r--r--src/mame/includes/nbmj8891.h7
-rw-r--r--src/mame/includes/nbmj8900.h7
-rw-r--r--src/mame/includes/nbmj8991.h7
-rw-r--r--src/mame/includes/nbmj9195.h8
-rw-r--r--src/mame/includes/newbrain.h29
-rw-r--r--src/mame/includes/next.h25
-rw-r--r--src/mame/includes/niyanpai.h7
-rw-r--r--src/mame/includes/pc4.h6
-rw-r--r--src/mame/includes/pc88va.h17
-rw-r--r--src/mame/includes/pc9801.h10
-rw-r--r--src/mame/includes/playch10.h6
-rw-r--r--src/mame/includes/pmd85.h9
-rw-r--r--src/mame/includes/pocketc.h5
-rw-r--r--src/mame/includes/poly.h15
-rw-r--r--src/mame/includes/prof80.h12
-rw-r--r--src/mame/includes/psion5.h10
-rw-r--r--src/mame/includes/rmnimbus.h45
-rw-r--r--src/mame/includes/rollerg.h25
-rw-r--r--src/mame/includes/s11.h17
-rw-r--r--src/mame/includes/saturn.h22
-rw-r--r--src/mame/includes/segag80r.h7
-rw-r--r--src/mame/includes/segahang.h30
-rw-r--r--src/mame/includes/segaorun.h17
-rw-r--r--src/mame/includes/segas16a.h33
-rw-r--r--src/mame/includes/segas16b.h33
-rw-r--r--src/mame/includes/segas18.h15
-rw-r--r--src/mame/includes/segaxbd.h10
-rw-r--r--src/mame/includes/segaybd.h8
-rw-r--r--src/mame/includes/sg1000.h5
-rw-r--r--src/mame/includes/simpsons.h48
-rw-r--r--src/mame/includes/slapshot.h20
-rw-r--r--src/mame/includes/snes.h16
-rw-r--r--src/mame/includes/sorcerer.h7
-rw-r--r--src/mame/includes/spacefb.h21
-rw-r--r--src/mame/includes/spectrum.h13
-rw-r--r--src/mame/includes/starfire.h1
-rw-r--r--src/mame/includes/stfight.h7
-rw-r--r--src/mame/includes/taito_f2.h7
-rw-r--r--src/mame/includes/taito_f3.h11
-rw-r--r--src/mame/includes/taito_z.h13
-rw-r--r--src/mame/includes/tandy2k.h37
-rw-r--r--src/mame/includes/tank8.h8
-rw-r--r--src/mame/includes/tehkanwc.h7
-rw-r--r--src/mame/includes/ti85.h8
-rw-r--r--src/mame/includes/tmc1800.h19
-rw-r--r--src/mame/includes/tmnt.h10
-rw-r--r--src/mame/includes/triplhnt.h8
-rw-r--r--src/mame/includes/trucocl.h31
-rw-r--r--src/mame/includes/tsconf.h10
-rw-r--r--src/mame/includes/tubep.h105
-rw-r--r--src/mame/includes/turbo.h1
-rw-r--r--src/mame/includes/ultratnk.h6
-rw-r--r--src/mame/includes/vectrex.h69
-rw-r--r--src/mame/includes/vidbrain.h35
-rw-r--r--src/mame/includes/videopin.h8
-rw-r--r--src/mame/includes/vp415.h5
-rw-r--r--src/mame/includes/vsnes.h2
-rw-r--r--src/mame/includes/wgp.h9
-rw-r--r--src/mame/includes/wolfpack.h35
-rw-r--r--src/mame/includes/wpc_dot.h34
-rw-r--r--src/mame/includes/x68k.h14
-rw-r--r--src/mame/includes/xbox_pci.h6
-rw-r--r--src/mame/includes/xbox_usb.h2
-rw-r--r--src/mame/includes/z80ne.h7
-rw-r--r--src/mame/includes/zx.h15
-rw-r--r--src/mame/machine/3dom2.cpp125
-rw-r--r--src/mame/machine/3dom2.h30
-rw-r--r--src/mame/machine/aim65.cpp2
-rw-r--r--src/mame/machine/amiga.cpp31
-rw-r--r--src/mame/machine/amstrad.cpp57
-rw-r--r--src/mame/machine/apollo.cpp10
-rw-r--r--src/mame/machine/apollo_kbd.cpp4
-rw-r--r--src/mame/machine/apple3.cpp4
-rw-r--r--src/mame/machine/archimedes_keyb.cpp4
-rw-r--r--src/mame/machine/archimedes_keyb.h3
-rw-r--r--src/mame/machine/asic65.cpp39
-rw-r--r--src/mame/machine/asic65.h6
-rw-r--r--src/mame/machine/atarigen.cpp14
-rw-r--r--src/mame/machine/atarigen.h11
-rw-r--r--src/mame/machine/atariscom.cpp45
-rw-r--r--src/mame/machine/atariscom.h20
-rw-r--r--src/mame/machine/ataristb.cpp2
-rw-r--r--src/mame/machine/balsente.cpp10
-rw-r--r--src/mame/machine/bbc.cpp4
-rw-r--r--src/mame/machine/bebox.cpp14
-rw-r--r--src/mame/machine/bk.cpp2
-rw-r--r--src/mame/machine/bublbobl.cpp13
-rw-r--r--src/mame/machine/cdicdic.cpp4
-rw-r--r--src/mame/machine/cdislavehle.cpp2
-rw-r--r--src/mame/machine/cedar_magnet_board.cpp8
-rw-r--r--src/mame/machine/cmi_mkbd.cpp17
-rw-r--r--src/mame/machine/cmi_mkbd.h5
-rw-r--r--src/mame/machine/coco.cpp27
-rw-r--r--src/mame/machine/cuda.cpp48
-rw-r--r--src/mame/machine/cuda.h5
-rw-r--r--src/mame/machine/dc.cpp6
-rw-r--r--src/mame/machine/dc_g2if.cpp12
-rw-r--r--src/mame/machine/dc_g2if.h3
-rw-r--r--src/mame/machine/dccons.cpp4
-rw-r--r--src/mame/machine/dec_lk201.cpp30
-rw-r--r--src/mame/machine/dec_lk201.h4
-rw-r--r--src/mame/machine/deco_irq.cpp2
-rw-r--r--src/mame/machine/decocass_tape.cpp2
-rw-r--r--src/mame/machine/decopincpu.cpp141
-rw-r--r--src/mame/machine/decopincpu.h59
-rw-r--r--src/mame/machine/dmac_0266.cpp2
-rw-r--r--src/mame/machine/dmac_0448.cpp4
-rw-r--r--src/mame/machine/egret.cpp4
-rw-r--r--src/mame/machine/egret.h14
-rw-r--r--src/mame/machine/elan_eu3a05commonsys.cpp19
-rw-r--r--src/mame/machine/elan_eu3a05commonsys.h4
-rw-r--r--src/mame/machine/electron.cpp33
-rw-r--r--src/mame/machine/esqpanel.cpp14
-rw-r--r--src/mame/machine/esqpanel.h3
-rw-r--r--src/mame/machine/esqvfd.cpp4
-rw-r--r--src/mame/machine/esqvfd.h1
-rw-r--r--src/mame/machine/f5220_kbd.cpp9
-rw-r--r--src/mame/machine/f5220_kbd.h3
-rw-r--r--src/mame/machine/fm_scsi.cpp28
-rw-r--r--src/mame/machine/fm_scsi.h9
-rw-r--r--src/mame/machine/gaelco3d.cpp10
-rw-r--r--src/mame/machine/gaelco3d.h1
-rw-r--r--src/mame/machine/gamecom.cpp6
-rw-r--r--src/mame/machine/harddriv.cpp7
-rw-r--r--src/mame/machine/hec2hrp.cpp2
-rw-r--r--src/mame/machine/hp2640_tape.cpp65
-rw-r--r--src/mame/machine/hp2640_tape.h4
-rw-r--r--src/mame/machine/hp48.cpp18
-rw-r--r--src/mame/machine/hp9845_printer.cpp4
-rw-r--r--src/mame/machine/hp9845_printer.h3
-rw-r--r--src/mame/machine/hpc3.cpp32
-rw-r--r--src/mame/machine/hpc3.h5
-rw-r--r--src/mame/machine/ibm6580_fdc.cpp4
-rw-r--r--src/mame/machine/ibm6580_fdc.h3
-rw-r--r--src/mame/machine/imm6_76.cpp6
-rw-r--r--src/mame/machine/interpro_ioga.cpp18
-rw-r--r--src/mame/machine/intv.cpp34
-rw-r--r--src/mame/machine/irobot.cpp2
-rw-r--r--src/mame/machine/iteagle_fpga.cpp9
-rw-r--r--src/mame/machine/iteagle_fpga.h3
-rw-r--r--src/mame/machine/itech8.cpp4
-rw-r--r--src/mame/machine/jaleco_ms32_sysctrl.cpp22
-rw-r--r--src/mame/machine/jaleco_ms32_sysctrl.h12
-rw-r--r--src/mame/machine/k573fpga.cpp2
-rw-r--r--src/mame/machine/k573kara.cpp4
-rw-r--r--src/mame/machine/k573kara.h1
-rw-r--r--src/mame/machine/k7659kb.cpp29
-rw-r--r--src/mame/machine/k7659kb.h4
-rw-r--r--src/mame/machine/kaneko_calc3.cpp15
-rw-r--r--src/mame/machine/kaneko_calc3.h8
-rw-r--r--src/mame/machine/kc.cpp4
-rw-r--r--src/mame/machine/kc_keyb.cpp78
-rw-r--r--src/mame/machine/kc_keyb.h5
-rw-r--r--src/mame/machine/leland.cpp4
-rw-r--r--src/mame/machine/lisa.cpp66
-rw-r--r--src/mame/machine/lynx.cpp35
-rw-r--r--src/mame/machine/m24_kbd.cpp4
-rw-r--r--src/mame/machine/m24_kbd.h3
-rw-r--r--src/mame/machine/m3comm.cpp67
-rw-r--r--src/mame/machine/m3comm.h21
-rw-r--r--src/mame/machine/mac.cpp10
-rw-r--r--src/mame/machine/macadb.cpp2
-rw-r--r--src/mame/machine/mace.cpp29
-rw-r--r--src/mame/machine/mace.h5
-rw-r--r--src/mame/machine/macpci.cpp2
-rw-r--r--src/mame/machine/macrtc.cpp6
-rw-r--r--src/mame/machine/macrtc.h3
-rw-r--r--src/mame/machine/macscsi.cpp2
-rw-r--r--src/mame/machine/maple-dc.cpp6
-rw-r--r--src/mame/machine/maple-dc.h3
-rw-r--r--src/mame/machine/mapledev.cpp13
-rw-r--r--src/mame/machine/mapledev.h5
-rw-r--r--src/mame/machine/mcr.cpp2
-rw-r--r--src/mame/machine/mcr68.cpp15
-rw-r--r--src/mame/machine/mct_adr.cpp6
-rw-r--r--src/mame/machine/mega32x.cpp2
-rw-r--r--src/mame/machine/megadriv.cpp9
-rw-r--r--src/mame/machine/mhavoc.cpp2
-rw-r--r--src/mame/machine/micro3d.cpp20
-rw-r--r--src/mame/machine/microtan.cpp2
-rw-r--r--src/mame/machine/midikbd.cpp113
-rw-r--r--src/mame/machine/midikbd.h9
-rw-r--r--src/mame/machine/midwayic.cpp2
-rw-r--r--src/mame/machine/mie.cpp11
-rw-r--r--src/mame/machine/mie.h3
-rw-r--r--src/mame/machine/mips_rambo.cpp6
-rw-r--r--src/mame/machine/mm1kb.cpp11
-rw-r--r--src/mame/machine/mm1kb.h3
-rw-r--r--src/mame/machine/mpu4.cpp21
-rw-r--r--src/mame/machine/mw8080bw.cpp2
-rw-r--r--src/mame/machine/n64.cpp12
-rw-r--r--src/mame/machine/namco06.cpp2
-rw-r--r--src/mame/machine/namcos21_dsp.cpp2
-rw-r--r--src/mame/machine/naomig1.cpp5
-rw-r--r--src/mame/machine/naomig1.h5
-rw-r--r--src/mame/machine/nb1412m2.cpp41
-rw-r--r--src/mame/machine/nb1412m2.h7
-rw-r--r--src/mame/machine/nb1413m3.cpp14
-rw-r--r--src/mame/machine/nb1413m3.h6
-rw-r--r--src/mame/machine/nes_vt_soc.cpp6
-rw-r--r--src/mame/machine/nes_vt_soc.h6
-rw-r--r--src/mame/machine/nextkbd.cpp4
-rw-r--r--src/mame/machine/nextkbd.h3
-rw-r--r--src/mame/machine/osborne1.cpp4
-rw-r--r--src/mame/machine/p2000t_mdcr.cpp4
-rw-r--r--src/mame/machine/p2000t_mdcr.h4
-rw-r--r--src/mame/machine/pc1512kb.cpp6
-rw-r--r--src/mame/machine/pc1512kb.h3
-rw-r--r--src/mame/machine/pc80s31k.cpp8
-rw-r--r--src/mame/machine/pc80s31k.h3
-rw-r--r--src/mame/machine/pc9801_kbd.cpp61
-rw-r--r--src/mame/machine/pc9801_kbd.h12
-rw-r--r--src/mame/machine/pce220_ser.cpp162
-rw-r--r--src/mame/machine/pce220_ser.h29
-rw-r--r--src/mame/machine/pce_cd.cpp17
-rw-r--r--src/mame/machine/pce_cd.h6
-rw-r--r--src/mame/machine/playch10.cpp6
-rw-r--r--src/mame/machine/pmd85.cpp14
-rw-r--r--src/mame/machine/pocketc.cpp13
-rw-r--r--src/mame/machine/poly.cpp2
-rw-r--r--src/mame/machine/psxcd.cpp437
-rw-r--r--src/mame/machine/psxcd.h45
-rw-r--r--src/mame/machine/qx10kbd.cpp4
-rw-r--r--src/mame/machine/qx10kbd.h6
-rw-r--r--src/mame/machine/rm380z.cpp2
-rw-r--r--src/mame/machine/rmnimbus.cpp12
-rw-r--r--src/mame/machine/rx01.cpp143
-rw-r--r--src/mame/machine/rx01.h1
-rw-r--r--src/mame/machine/saa7191.cpp9
-rw-r--r--src/mame/machine/saa7191.h5
-rw-r--r--src/mame/machine/sgi.cpp23
-rw-r--r--src/mame/machine/sgi.h7
-rw-r--r--src/mame/machine/simpsons.cpp16
-rw-r--r--src/mame/machine/sms.cpp2
-rw-r--r--src/mame/machine/snes.cpp61
-rw-r--r--src/mame/machine/sorcerer.cpp20
-rw-r--r--src/mame/machine/starwars.cpp2
-rw-r--r--src/mame/machine/stfight.cpp14
-rw-r--r--src/mame/machine/swtpc09.cpp2
-rw-r--r--src/mame/machine/thomson.cpp16
-rw-r--r--src/mame/machine/ti85.cpp261
-rw-r--r--src/mame/machine/trs80.cpp2
-rw-r--r--src/mame/machine/trs80m3.cpp2
-rw-r--r--src/mame/machine/tsconf.cpp71
-rw-r--r--src/mame/machine/tv955kb.cpp2
-rw-r--r--src/mame/machine/upd65031.cpp148
-rw-r--r--src/mame/machine/upd65031.h8
-rw-r--r--src/mame/machine/vectrex.cpp133
-rw-r--r--src/mame/machine/victor9k_fdc.cpp296
-rw-r--r--src/mame/machine/victor9k_fdc.h12
-rw-r--r--src/mame/machine/vino.cpp25
-rw-r--r--src/mame/machine/vino.h6
-rw-r--r--src/mame/machine/vsnes.cpp2
-rw-r--r--src/mame/machine/wpc.cpp11
-rw-r--r--src/mame/machine/wpc.h5
-rw-r--r--src/mame/machine/wpc_lamp.cpp30
-rw-r--r--src/mame/machine/wpc_lamp.h14
-rw-r--r--src/mame/machine/wpc_out.cpp61
-rw-r--r--src/mame/machine/wpc_out.h17
-rw-r--r--src/mame/machine/x68k_hdc.cpp2
-rw-r--r--src/mame/machine/xavix.cpp6
-rw-r--r--src/mame/machine/xavix_adc.cpp2
-rw-r--r--src/mame/machine/xavix_madfb_ball.cpp2
-rw-r--r--src/mame/machine/xavix_mtrk_wheel.cpp2
-rw-r--r--src/mame/machine/xbox_pci.cpp27
-rw-r--r--src/mame/machine/xbox_usb.cpp5
-rw-r--r--src/mame/machine/z80ne.cpp21
-rw-r--r--src/mame/machine/z88_impexp.cpp6
-rw-r--r--src/mame/machine/z88_impexp.h3
-rw-r--r--src/mame/machine/znmcu.cpp4
-rw-r--r--src/mame/machine/znmcu.h3
-rw-r--r--src/mame/machine/zx.cpp4
-rw-r--r--src/mame/machine/zx8302.cpp36
-rw-r--r--src/mame/machine/zx8302.h12
-rw-r--r--src/mame/video/3dom2_te.cpp20
-rw-r--r--src/mame/video/3dom2_te.h4
-rw-r--r--src/mame/video/733_asr.cpp192
-rw-r--r--src/mame/video/733_asr.h3
-rw-r--r--src/mame/video/911_vdt.cpp43
-rw-r--r--src/mame/video/911_vdt.h4
-rw-r--r--src/mame/video/abc80.cpp8
-rw-r--r--src/mame/video/antic.cpp44
-rw-r--r--src/mame/video/antic.h10
-rw-r--r--src/mame/video/apexc.cpp2
-rw-r--r--src/mame/video/astrocde.cpp22
-rw-r--r--src/mame/video/atarimo.cpp24
-rw-r--r--src/mame/video/atarimo.h9
-rw-r--r--src/mame/video/atarist.cpp4
-rw-r--r--src/mame/video/atarisy2.cpp2
-rw-r--r--src/mame/video/atarivad.cpp37
-rw-r--r--src/mame/video/atarivad.h14
-rw-r--r--src/mame/video/avgdvg.cpp4
-rw-r--r--src/mame/video/blstroid.cpp26
-rw-r--r--src/mame/video/changela.cpp2
-rw-r--r--src/mame/video/dcheese.cpp20
-rw-r--r--src/mame/video/dday.cpp2
-rw-r--r--src/mame/video/dkong.cpp2
-rw-r--r--src/mame/video/electron.cpp2
-rw-r--r--src/mame/video/esripsys.cpp4
-rw-r--r--src/mame/video/exidy440.cpp4
-rw-r--r--src/mame/video/fmtowns.cpp7
-rw-r--r--src/mame/video/fromance.cpp2
-rw-r--r--src/mame/video/fuukifg3.cpp4
-rw-r--r--src/mame/video/galaxold.cpp4
-rw-r--r--src/mame/video/galaxy.cpp2
-rw-r--r--src/mame/video/gamecom.cpp2
-rw-r--r--src/mame/video/gameplan.cpp42
-rw-r--r--src/mame/video/gic.cpp13
-rw-r--r--src/mame/video/gic.h3
-rw-r--r--src/mame/video/gime.cpp60
-rw-r--r--src/mame/video/gime.h51
-rw-r--r--src/mame/video/gp9001.cpp13
-rw-r--r--src/mame/video/gp9001.h8
-rw-r--r--src/mame/video/hyhoo.cpp13
-rw-r--r--src/mame/video/itech32.cpp4
-rw-r--r--src/mame/video/itech8.cpp15
-rw-r--r--src/mame/video/jag_blitter.cpp9
-rw-r--r--src/mame/video/jag_blitter.h3
-rw-r--r--src/mame/video/jaguar.cpp62
-rw-r--r--src/mame/video/k051960.cpp2
-rw-r--r--src/mame/video/k053250_ps.cpp4
-rw-r--r--src/mame/video/k053250_ps.h3
-rw-r--r--src/mame/video/k1ge.cpp4
-rw-r--r--src/mame/video/leland.cpp2
-rw-r--r--src/mame/video/lethalj.cpp13
-rw-r--r--src/mame/video/lockon.cpp4
-rw-r--r--src/mame/video/m92.cpp15
-rw-r--r--src/mame/video/mcd212.cpp4
-rw-r--r--src/mame/video/metro.cpp2
-rw-r--r--src/mame/video/midtunit.cpp15
-rw-r--r--src/mame/video/midtunit.h3
-rw-r--r--src/mame/video/midvunit.cpp30
-rw-r--r--src/mame/video/midyunit.cpp19
-rw-r--r--src/mame/video/mystston.cpp2
-rw-r--r--src/mame/video/n8080.cpp2
-rw-r--r--src/mame/video/namcona1.cpp6
-rw-r--r--src/mame/video/namcos22.cpp2
-rw-r--r--src/mame/video/nbmj8688.cpp13
-rw-r--r--src/mame/video/nbmj8891.cpp15
-rw-r--r--src/mame/video/nbmj8900.cpp13
-rw-r--r--src/mame/video/nbmj8991.cpp13
-rw-r--r--src/mame/video/nbmj9195.cpp15
-rw-r--r--src/mame/video/neogeo_spr.cpp4
-rw-r--r--src/mame/video/newbrain.cpp2
-rw-r--r--src/mame/video/nick.cpp6
-rw-r--r--src/mame/video/nick.h3
-rw-r--r--src/mame/video/niyanpai.cpp13
-rw-r--r--src/mame/video/nmk16.cpp2
-rw-r--r--src/mame/video/pastelg.cpp2
-rw-r--r--src/mame/video/pc4.cpp16
-rw-r--r--src/mame/video/pecom.cpp2
-rw-r--r--src/mame/video/powervr2.cpp38
-rw-r--r--src/mame/video/powervr2.h8
-rw-r--r--src/mame/video/rollerg.cpp2
-rw-r--r--src/mame/video/rpunch.cpp2
-rw-r--r--src/mame/video/saturn.cpp3
-rw-r--r--src/mame/video/segag80r.cpp11
-rw-r--r--src/mame/video/segaic16.cpp4
-rw-r--r--src/mame/video/segas32.cpp4
-rw-r--r--src/mame/video/seta2.cpp2
-rw-r--r--src/mame/video/sgi_re2.cpp2
-rw-r--r--src/mame/video/simpsons.cpp12
-rw-r--r--src/mame/video/spectrum.cpp3
-rw-r--r--src/mame/video/sprint8.cpp2
-rw-r--r--src/mame/video/starfire.cpp2
-rw-r--r--src/mame/video/tank8.cpp15
-rw-r--r--src/mame/video/tc0180vcu.cpp16
-rw-r--r--src/mame/video/tc0180vcu.h7
-rw-r--r--src/mame/video/thomson.cpp6
-rw-r--r--src/mame/video/timex.cpp3
-rw-r--r--src/mame/video/triplhnt.cpp15
-rw-r--r--src/mame/video/tubep.cpp22
-rw-r--r--src/mame/video/twin16.cpp2
-rw-r--r--src/mame/video/tx1.cpp6
-rw-r--r--src/mame/video/uv201.cpp81
-rw-r--r--src/mame/video/uv201.h13
-rw-r--r--src/mame/video/vectrex.cpp87
-rw-r--r--src/mame/video/victory.cpp2
-rw-r--r--src/mame/video/vtvideo.cpp4
-rw-r--r--src/mame/video/wswan.cpp15
-rw-r--r--src/mame/video/wswan.h6
-rw-r--r--src/mame/video/x68k_crtc.cpp10
-rw-r--r--src/mame/video/ygv608.cpp35
-rw-r--r--src/mame/video/ygv608.h4
-rw-r--r--src/mame/video/zx.cpp20
-rw-r--r--src/mame/video/zx8301.cpp26
-rw-r--r--src/mame/video/zx8301.h10
-rw-r--r--src/osd/osdnet.cpp2
1665 files changed, 17326 insertions, 21773 deletions
diff --git a/src/devices/bus/a2bus/a2mcms.cpp b/src/devices/bus/a2bus/a2mcms.cpp
index 7e154ad99f7..f23a647f4a8 100644
--- a/src/devices/bus/a2bus/a2mcms.cpp
+++ b/src/devices/bus/a2bus/a2mcms.cpp
@@ -207,8 +207,8 @@ void mcms_device::device_start()
{
m_write_irq.resolve();
m_stream = stream_alloc(0, 2, 31250);
- m_timer = timer_alloc(0);
- m_clrtimer = timer_alloc(1);
+ m_timer = timer_alloc(FUNC(mcms_device::set_irq_tick), this);
+ m_clrtimer = timer_alloc(FUNC(mcms_device::clr_irq_tick), this);
m_enabled = false;
memset(m_vols, 0, sizeof(m_vols));
memset(m_table, 0, sizeof(m_table));
@@ -238,18 +238,16 @@ void mcms_device::device_reset()
m_enabled = false;
}
-void mcms_device::device_timer(emu_timer &timer, device_timer_id tid, int param)
+TIMER_CALLBACK_MEMBER(mcms_device::set_irq_tick)
{
- if (tid == 0)
- {
- m_write_irq(ASSERT_LINE);
- // clear this IRQ in 10 cycles (?)
- m_clrtimer->adjust(attotime::from_usec(10), 0);
- }
- else if (tid == 1)
- {
- m_write_irq(CLEAR_LINE);
- }
+ m_write_irq(ASSERT_LINE);
+ // clear this IRQ in 10 cycles (?)
+ m_clrtimer->adjust(attotime::from_usec(10), 0);
+}
+
+TIMER_CALLBACK_MEMBER(mcms_device::clr_irq_tick)
+{
+ m_write_irq(CLEAR_LINE);
}
void mcms_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
diff --git a/src/devices/bus/a2bus/a2mcms.h b/src/devices/bus/a2bus/a2mcms.h
index f6244dfbf74..371c74c54fa 100644
--- a/src/devices/bus/a2bus/a2mcms.h
+++ b/src/devices/bus/a2bus/a2mcms.h
@@ -40,13 +40,16 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
+ TIMER_CALLBACK_MEMBER(set_irq_tick);
+ TIMER_CALLBACK_MEMBER(clr_irq_tick);
+
private:
sound_stream *m_stream;
- emu_timer *m_timer, *m_clrtimer;
+ emu_timer *m_timer;
+ emu_timer *m_clrtimer;
a2bus_mcms1_device *m_pBusDevice;
bool m_enabled;
uint8_t m_vols[16];
diff --git a/src/devices/bus/a2bus/a2parprn.cpp b/src/devices/bus/a2bus/a2parprn.cpp
index 7931472b732..c79f04f6da8 100644
--- a/src/devices/bus/a2bus/a2parprn.cpp
+++ b/src/devices/bus/a2bus/a2parprn.cpp
@@ -213,7 +213,7 @@ ioport_constructor a2bus_parprn_device::device_input_ports() const
void a2bus_parprn_device::device_start()
{
- m_strobe_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(a2bus_parprn_device::update_strobe), this));
+ m_strobe_timer = timer_alloc(FUNC(a2bus_parprn_device::update_strobe), this);
save_item(NAME(m_next_strobe));
save_item(NAME(m_ack_latch));
diff --git a/src/devices/bus/a2bus/a2pic.cpp b/src/devices/bus/a2bus/a2pic.cpp
index 7fe1487187e..321155f2cf8 100644
--- a/src/devices/bus/a2bus/a2pic.cpp
+++ b/src/devices/bus/a2bus/a2pic.cpp
@@ -343,7 +343,7 @@ ioport_constructor a2bus_pic_device::device_input_ports() const
void a2bus_pic_device::device_start()
{
- m_strobe_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(a2bus_pic_device::release_strobe), this));
+ m_strobe_timer = timer_alloc(FUNC(a2bus_pic_device::release_strobe), this);
m_firmware_base = 0x0100U;
m_data_latch = 0xffU;
diff --git a/src/devices/bus/a2bus/a2sd.cpp b/src/devices/bus/a2bus/a2sd.cpp
index 5d1306abab6..c5f1e743d0f 100644
--- a/src/devices/bus/a2bus/a2sd.cpp
+++ b/src/devices/bus/a2bus/a2sd.cpp
@@ -101,7 +101,7 @@ a2bus_a2sd_device::a2bus_a2sd_device(const machine_config &mconfig, const char *
void a2bus_a2sd_device::device_start()
{
- m_shift_timer = timer_alloc(0);
+ m_shift_timer = timer_alloc(FUNC(a2bus_a2sd_device::shift_tick), this);
save_item(NAME(m_datain));
save_item(NAME(m_in_latch));
@@ -119,7 +119,7 @@ void a2bus_a2sd_device::device_reset()
m_sdcard->spi_clock_w(CLEAR_LINE);
}
-void a2bus_a2sd_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(a2bus_a2sd_device::shift_tick)
{
LOGMASKED(LOG_SPI, ">>>>>>> SHIFT %d (%c)\n", m_shift_count, (m_shift_count & 1) ? 'L' : 'S');
if (!(m_shift_count & 1))
diff --git a/src/devices/bus/a2bus/a2sd.h b/src/devices/bus/a2bus/a2sd.h
index 85165248319..88414ec39d3 100644
--- a/src/devices/bus/a2bus/a2sd.h
+++ b/src/devices/bus/a2bus/a2sd.h
@@ -36,7 +36,6 @@ protected:
virtual void device_reset() override;
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// overrides of standard a2bus slot functions
virtual u8 read_c0nx(u8 offset) override;
@@ -49,6 +48,7 @@ protected:
// SPI 4-wire interface
WRITE_LINE_MEMBER(spi_miso_w) { m_in_bit = state; }
+ TIMER_CALLBACK_MEMBER(shift_tick);
private:
required_device<at28c64b_device> m_flash;
required_device<spi_sdcard_device> m_sdcard;
diff --git a/src/devices/bus/a2bus/agat840k_hle.cpp b/src/devices/bus/a2bus/agat840k_hle.cpp
index 76afe57518c..cd6d01389b4 100644
--- a/src/devices/bus/a2bus/agat840k_hle.cpp
+++ b/src/devices/bus/a2bus/agat840k_hle.cpp
@@ -89,6 +89,8 @@ a2bus_agat840k_hle_device::a2bus_agat840k_hle_device(const machine_config &mconf
, m_floppy_image(*this, "floppy%u", 0U)
, m_d14(*this, "d14")
, m_d15(*this, "d15")
+ , m_timer_wait(nullptr)
+ , m_timer_seek(nullptr)
, m_rom(nullptr)
{
}
@@ -137,8 +139,8 @@ void a2bus_agat840k_hle_device::device_start()
m_mxcs = MXCSR_SYNC;
- m_timer_wait = timer_alloc(TIMER_ID_WAIT);
- m_timer_seek = timer_alloc(TIMER_ID_SEEK);
+ m_timer_wait = timer_alloc(FUNC(a2bus_agat840k_hle_device::timer_wait_tick), this);
+ m_timer_seek = timer_alloc(FUNC(a2bus_agat840k_hle_device::timer_seek_tick), this);
m_seektime = 6000; // 6 ms, per es5323.txt
m_waittime = 32; // 16 bits x 2 us
@@ -226,29 +228,24 @@ void a2bus_agat840k_hle_device::device_reset()
m_mxcs &= ~MXCSR_TR;
}
-void a2bus_agat840k_hle_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(a2bus_agat840k_hle_device::timer_wait_tick)
{
- switch (id)
- {
- case TIMER_ID_WAIT:
- {
- m_count_read++;
- m_count_read %= 6250;
- m_d15->pc4_w(0);
- m_d15->pc4_w(1);
- if (BIT(m_tracks[(2 * m_floppy->floppy_drive_get_current_track()) + m_side][m_count_read], 15))
- m_mxcs &= ~MXCSR_SYNC;
- }
- break;
+ m_count_read++;
+ m_count_read %= 6250;
+ m_d15->pc4_w(0);
+ m_d15->pc4_w(1);
+ if (BIT(m_tracks[(2 * m_floppy->floppy_drive_get_current_track()) + m_side][m_count_read], 15))
+ m_mxcs &= ~MXCSR_SYNC;
+}
- case TIMER_ID_SEEK:
- m_floppy->floppy_stp_w(1);
- m_floppy->floppy_stp_w(0);
- break;
- }
+TIMER_CALLBACK_MEMBER(a2bus_agat840k_hle_device::timer_seek_tick)
+{
+ m_floppy->floppy_stp_w(1);
+ m_floppy->floppy_stp_w(0);
}
+
/*-------------------------------------------------
read_c0nx - called for reads from this card's c0nx space
-------------------------------------------------*/
diff --git a/src/devices/bus/a2bus/agat840k_hle.h b/src/devices/bus/a2bus/agat840k_hle.h
index f51bda3324f..a497f2bc7aa 100644
--- a/src/devices/bus/a2bus/agat840k_hle.h
+++ b/src/devices/bus/a2bus/agat840k_hle.h
@@ -55,7 +55,6 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
@@ -64,11 +63,8 @@ protected:
virtual void write_c0nx(uint8_t offset, uint8_t data) override;
virtual uint8_t read_cnxx(uint8_t offset) override;
- enum
- {
- TIMER_ID_WAIT = 0,
- TIMER_ID_SEEK
- };
+ TIMER_CALLBACK_MEMBER(timer_wait_tick);
+ TIMER_CALLBACK_MEMBER(timer_seek_tick);
required_device_array<legacy_floppy_image_device, 2> m_floppy_image;
required_device<i8255_device> m_d14;
@@ -91,8 +87,8 @@ private:
int m_seektime;
int m_waittime;
- emu_timer *m_timer_wait = nullptr;
- emu_timer *m_timer_seek = nullptr;
+ emu_timer *m_timer_wait;
+ emu_timer *m_timer_seek;
uint8_t *m_rom;
};
diff --git a/src/devices/bus/a2bus/agat_fdc.cpp b/src/devices/bus/a2bus/agat_fdc.cpp
index f6743c35964..dc88c7ea39e 100644
--- a/src/devices/bus/a2bus/agat_fdc.cpp
+++ b/src/devices/bus/a2bus/agat_fdc.cpp
@@ -140,8 +140,8 @@ void a2bus_agat_fdc_device::device_start()
m_mxcs = MXCSR_SYNC;
- m_timer_lss = timer_alloc(TIMER_ID_LSS);
- m_timer_motor = timer_alloc(TIMER_ID_MOTOR);
+ m_timer_lss = timer_alloc(FUNC(a2bus_agat_fdc_device::lss_sync), this);
+ m_timer_motor = timer_alloc(FUNC(a2bus_agat_fdc_device::motor_off), this);
m_seektime = 6; // ms, per es5323.txt
m_waittime = 32; // us - 16 bits x 2 us
@@ -162,19 +162,10 @@ void a2bus_agat_fdc_device::device_reset()
m_timer_lss->adjust(attotime::from_msec(10), 0, attotime::from_msec(10));
}
-void a2bus_agat_fdc_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(a2bus_agat_fdc_device::motor_off)
{
- switch (id)
- {
- case TIMER_ID_LSS:
- lss_sync();
- break;
-
- case TIMER_ID_MOTOR:
- active = 0;
- floppy->mon_w(1);
- break;
- }
+ active = 0;
+ floppy->mon_w(1);
}
uint64_t a2bus_agat_fdc_device::time_to_cycles(const attotime &tm)
@@ -199,7 +190,7 @@ void a2bus_agat_fdc_device::lss_start()
bits = 8;
}
-void a2bus_agat_fdc_device::lss_sync()
+TIMER_CALLBACK_MEMBER(a2bus_agat_fdc_device::lss_sync)
{
if(!active)
return;
@@ -301,7 +292,7 @@ uint8_t a2bus_agat_fdc_device::read_c0nx(uint8_t offset)
{
u8 data;
- lss_sync();
+ lss_sync(0);
switch (offset)
{
@@ -328,7 +319,7 @@ uint8_t a2bus_agat_fdc_device::read_c0nx(uint8_t offset)
void a2bus_agat_fdc_device::write_c0nx(uint8_t offset, uint8_t data)
{
- lss_sync();
+ lss_sync(0);
switch (offset)
{
diff --git a/src/devices/bus/a2bus/agat_fdc.h b/src/devices/bus/a2bus/agat_fdc.h
index e209902c709..950027151cd 100644
--- a/src/devices/bus/a2bus/agat_fdc.h
+++ b/src/devices/bus/a2bus/agat_fdc.h
@@ -49,7 +49,6 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
@@ -76,7 +75,9 @@ private:
attotime cycles_to_time(uint64_t cycles);
void lss_start();
- void lss_sync();
+ TIMER_CALLBACK_MEMBER(lss_sync);
+
+ TIMER_CALLBACK_MEMBER(motor_off);
floppy_image_device *floppy;
int active, bits;
diff --git a/src/devices/bus/a2bus/corvfdc02.cpp b/src/devices/bus/a2bus/corvfdc02.cpp
index 5f80726d1bc..12c7aed06ac 100644
--- a/src/devices/bus/a2bus/corvfdc02.cpp
+++ b/src/devices/bus/a2bus/corvfdc02.cpp
@@ -101,7 +101,7 @@ void a2bus_corvfdc02_device::device_start()
{
m_rom = device().machine().root_device().memregion(this->subtag(FDC02_ROM_REGION).c_str())->base();
- m_timer = timer_alloc(0);
+ m_timer = timer_alloc(FUNC(a2bus_corvfdc02_device::tc_tick), this);
save_item(NAME(m_fdc_local_status));
save_item(NAME(m_fdc_local_command));
@@ -118,7 +118,7 @@ void a2bus_corvfdc02_device::device_reset()
m_timer->adjust(attotime::never);
}
-void a2bus_corvfdc02_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(a2bus_corvfdc02_device::tc_tick)
{
m_fdc->tc_w(true);
m_fdc->tc_w(false);
diff --git a/src/devices/bus/a2bus/corvfdc02.h b/src/devices/bus/a2bus/corvfdc02.h
index 028770450cd..825d68d564b 100644
--- a/src/devices/bus/a2bus/corvfdc02.h
+++ b/src/devices/bus/a2bus/corvfdc02.h
@@ -35,7 +35,6 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
@@ -44,6 +43,8 @@ protected:
virtual void write_c0nx(uint8_t offset, uint8_t data) override;
virtual uint8_t read_cnxx(uint8_t offset) override;
+ TIMER_CALLBACK_MEMBER(tc_tick);
+
required_device<upd765a_device> m_fdc;
required_device<floppy_connector> m_con1;
required_device<floppy_connector> m_con2;
diff --git a/src/devices/bus/a2bus/grappler.cpp b/src/devices/bus/a2bus/grappler.cpp
index 68f49edcf37..c09ff95e8fc 100644
--- a/src/devices/bus/a2bus/grappler.cpp
+++ b/src/devices/bus/a2bus/grappler.cpp
@@ -746,7 +746,7 @@ void a2bus_grapplerplus_device::device_start()
{
a2bus_grapplerplus_device_base::device_start();
- m_strobe_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(a2bus_grapplerplus_device::update_strobe), this));
+ m_strobe_timer = timer_alloc(FUNC(a2bus_grapplerplus_device::update_strobe), this);
m_next_strobe = 1U;
diff --git a/src/devices/bus/a2bus/transwarp.cpp b/src/devices/bus/a2bus/transwarp.cpp
index 719fe7993df..a87f724a704 100644
--- a/src/devices/bus/a2bus/transwarp.cpp
+++ b/src/devices/bus/a2bus/transwarp.cpp
@@ -158,7 +158,7 @@ a2bus_transwarp_device::a2bus_transwarp_device(const machine_config &mconfig, co
void a2bus_transwarp_device::device_start()
{
- m_timer = timer_alloc(0);
+ m_timer = timer_alloc(FUNC(a2bus_transwarp_device::clock_adjust_tick), this);
save_item(NAME(m_bEnabled));
save_item(NAME(m_bReadA2ROM));
@@ -187,7 +187,7 @@ void a2bus_transwarp_device::device_reset()
}
}
-void a2bus_transwarp_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(a2bus_transwarp_device::clock_adjust_tick)
{
if (m_bIn1MHzMode)
{
diff --git a/src/devices/bus/a2bus/transwarp.h b/src/devices/bus/a2bus/transwarp.h
index 1401f61776b..1213ea26c8b 100644
--- a/src/devices/bus/a2bus/transwarp.h
+++ b/src/devices/bus/a2bus/transwarp.h
@@ -33,7 +33,6 @@ protected:
virtual void device_reset() override;
virtual void device_add_mconfig(machine_config &config) override;
virtual ioport_constructor device_input_ports() const override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual const tiny_rom_entry *device_rom_region() const override;
// overrides of standard a2bus slot functions
@@ -49,6 +48,8 @@ private:
required_region_ptr<uint8_t> m_rom;
required_ioport m_dsw1, m_dsw2;
+ TIMER_CALLBACK_MEMBER(clock_adjust_tick);
+
uint8_t dma_r(offs_t offset);
void dma_w(offs_t offset, uint8_t data);
diff --git a/src/devices/bus/a2bus/uniprint.cpp b/src/devices/bus/a2bus/uniprint.cpp
index 99b90223a42..d451a45fe89 100644
--- a/src/devices/bus/a2bus/uniprint.cpp
+++ b/src/devices/bus/a2bus/uniprint.cpp
@@ -185,7 +185,7 @@ ioport_constructor a2bus_uniprint_device::device_input_ports() const
void a2bus_uniprint_device::device_start()
{
- m_strobe_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(a2bus_uniprint_device::update_strobe), this));
+ m_strobe_timer = timer_alloc(FUNC(a2bus_uniprint_device::update_strobe), this);
m_next_strobe = 1U;
diff --git a/src/devices/bus/a800/cassette.cpp b/src/devices/bus/a800/cassette.cpp
index 6e2c0073691..32d9fe0b390 100644
--- a/src/devices/bus/a800/cassette.cpp
+++ b/src/devices/bus/a800/cassette.cpp
@@ -26,7 +26,6 @@ TODO:
//**************************************************************************
DEFINE_DEVICE_TYPE(A8SIO_CASSETTE, a8sio_cassette_device, "a8sio_cass", "Atari 8 bit cassette")
-const device_timer_id TIMER_CASSETTE_READ = 1;
void a8sio_cassette_device::device_add_mconfig(machine_config &config)
{
@@ -60,7 +59,7 @@ void a8sio_cassette_device::device_start()
save_item(NAME(m_old_cass_signal));
save_item(NAME(m_signal_count));
- m_read_timer = timer_alloc(TIMER_CASSETTE_READ);
+ m_read_timer = timer_alloc(FUNC(a8sio_cassette_device::read_tick), this);
}
void a8sio_cassette_device::device_reset()
@@ -82,27 +81,22 @@ WRITE_LINE_MEMBER( a8sio_cassette_device::motor_w )
}
}
-void a8sio_cassette_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(a8sio_cassette_device::read_tick)
{
- switch (id)
+ uint8_t cass_signal = m_cassette->input() < 0 ? 0 : 1;
+
+ if (m_signal_count < 20)
+ {
+ m_signal_count++;
+ }
+
+ if (cass_signal != m_old_cass_signal)
{
- case TIMER_CASSETTE_READ:
- uint8_t cass_signal = m_cassette->input() < 0 ? 0 : 1;
-
- if (m_signal_count < 20)
- {
- m_signal_count++;
- }
-
- if (cass_signal != m_old_cass_signal)
- {
- //printf("cass_signal: %d, count: %d, data: %d\n", cass_signal, m_signal_count, m_signal_count < 5 ? 1 : 0);
- // ~4 kHz -> 0
- // ~5 kHz -> 1
- m_a8sio->data_in_w((m_signal_count < 5) ? 1 : 0);
- m_signal_count = 0;
- m_old_cass_signal = cass_signal;
- }
- break;
+ //printf("cass_signal: %d, count: %d, data: %d\n", cass_signal, m_signal_count, m_signal_count < 5 ? 1 : 0);
+ // ~4 kHz -> 0
+ // ~5 kHz -> 1
+ m_a8sio->data_in_w((m_signal_count < 5) ? 1 : 0);
+ m_signal_count = 0;
+ m_old_cass_signal = cass_signal;
}
}
diff --git a/src/devices/bus/a800/cassette.h b/src/devices/bus/a800/cassette.h
index ed75b00bdc8..d1c91c5a2fa 100644
--- a/src/devices/bus/a800/cassette.h
+++ b/src/devices/bus/a800/cassette.h
@@ -36,9 +36,10 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_add_mconfig(machine_config &config) override;
+ TIMER_CALLBACK_MEMBER(read_tick);
+
required_device<cassette_image_device> m_cassette;
emu_timer *m_read_timer;
diff --git a/src/devices/bus/abckb/abc77.cpp b/src/devices/bus/abckb/abc77.cpp
index 0175916e700..442ff553e2f 100644
--- a/src/devices/bus/abckb/abc77.cpp
+++ b/src/devices/bus/abckb/abc77.cpp
@@ -382,7 +382,7 @@ inline void abc77_device::serial_output(int state)
// serial_clock -
//-------------------------------------------------
-inline void abc77_device::serial_clock()
+TIMER_CALLBACK_MEMBER(abc77_device::serial_clock)
{
m_clock = !m_clock;
@@ -442,10 +442,10 @@ abc77_device::abc77_device(const machine_config &mconfig, const char *tag, devic
void abc77_device::device_start()
{
// allocate timers
- m_serial_timer = timer_alloc(TIMER_SERIAL);
+ m_serial_timer = timer_alloc(FUNC(abc77_device::serial_clock), this);
m_serial_timer->adjust(attotime::from_hz(19200), 0, attotime::from_hz(19200)); // ALE/32
- m_reset_timer = timer_alloc(TIMER_RESET);
+ m_reset_timer = timer_alloc(FUNC(abc77_device::reset_tick), this);
}
@@ -469,21 +469,12 @@ void abc77_device::device_reset()
//-------------------------------------------------
-// device_timer - handler timer events
+// reset_tick - handle delayed reset
//-------------------------------------------------
-void abc77_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(abc77_device::reset_tick)
{
- switch (id)
- {
- case TIMER_SERIAL:
- serial_clock();
- break;
-
- case TIMER_RESET:
- m_maincpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE);
- break;
- }
+ m_maincpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE);
}
diff --git a/src/devices/bus/abckb/abc77.h b/src/devices/bus/abckb/abc77.h
index ccfb1b8effd..f6147c52c66 100644
--- a/src/devices/bus/abckb/abc77.h
+++ b/src/devices/bus/abckb/abc77.h
@@ -40,7 +40,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// optional information overrides
virtual const tiny_rom_entry *device_rom_region() const override;
@@ -57,9 +56,11 @@ private:
TIMER_RESET
};
- inline void serial_output(int state);
- inline void serial_clock();
- inline void key_down(int state);
+ void serial_output(int state);
+ void key_down(int state);
+
+ TIMER_CALLBACK_MEMBER(serial_clock);
+ TIMER_CALLBACK_MEMBER(reset_tick);
required_device<i8035_device> m_maincpu;
required_device<watchdog_timer_device> m_watchdog;
diff --git a/src/devices/bus/abckb/abc800kb.cpp b/src/devices/bus/abckb/abc800kb.cpp
index 21c30b245ab..571a62d5a6e 100644
--- a/src/devices/bus/abckb/abc800kb.cpp
+++ b/src/devices/bus/abckb/abc800kb.cpp
@@ -268,7 +268,7 @@ ioport_constructor abc800_keyboard_device::device_input_ports() const
// serial_output -
//-------------------------------------------------
-inline void abc800_keyboard_device::serial_output(int state)
+void abc800_keyboard_device::serial_output(int state)
{
if (m_txd != state)
{
@@ -283,7 +283,7 @@ inline void abc800_keyboard_device::serial_output(int state)
// serial_clock -
//-------------------------------------------------
-inline void abc800_keyboard_device::serial_clock()
+TIMER_CALLBACK_MEMBER(abc800_keyboard_device::serial_clock)
{
m_clk = !m_clk;
@@ -295,7 +295,7 @@ inline void abc800_keyboard_device::serial_clock()
// keydown -
//-------------------------------------------------
-inline void abc800_keyboard_device::key_down(int state)
+void abc800_keyboard_device::key_down(int state)
{
if (m_keydown != state)
{
@@ -337,7 +337,7 @@ abc800_keyboard_device::abc800_keyboard_device(const machine_config &mconfig, co
void abc800_keyboard_device::device_start()
{
// allocate timers
- m_serial_timer = timer_alloc();
+ m_serial_timer = timer_alloc(FUNC(abc800_keyboard_device::serial_clock), this);
m_serial_timer->adjust(attotime::from_hz(XTAL(5'990'400)/(3*5)/20), 0, attotime::from_hz(XTAL(5'990'400)/(3*5)/20)); // ???
// state saving
@@ -358,15 +358,6 @@ void abc800_keyboard_device::device_reset()
}
-//-------------------------------------------------
-// device_timer - handler timer events
-//-------------------------------------------------
-
-void abc800_keyboard_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- serial_clock();
-}
-
//-------------------------------------------------
// txd_w -
diff --git a/src/devices/bus/abckb/abc800kb.h b/src/devices/bus/abckb/abc800kb.h
index acbd19ef299..39f54e2f854 100644
--- a/src/devices/bus/abckb/abc800kb.h
+++ b/src/devices/bus/abckb/abc800kb.h
@@ -38,7 +38,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// optional information overrides
virtual const tiny_rom_entry *device_rom_region() const override;
@@ -46,9 +45,9 @@ protected:
virtual ioport_constructor device_input_ports() const override;
private:
- inline void serial_output(int state);
- inline void serial_clock();
- inline void key_down(int state);
+ void serial_output(int state);
+ TIMER_CALLBACK_MEMBER(serial_clock);
+ void key_down(int state);
uint8_t kb_p1_r();
void kb_p1_w(uint8_t data);
diff --git a/src/devices/bus/abckb/abc99.cpp b/src/devices/bus/abckb/abc99.cpp
index 3c05f749227..3273e625a4b 100644
--- a/src/devices/bus/abckb/abc99.cpp
+++ b/src/devices/bus/abckb/abc99.cpp
@@ -398,15 +398,11 @@ ioport_constructor abc99_device::device_input_ports() const
-//**************************************************************************
-// INLINE HELPERS
-//**************************************************************************
-
//-------------------------------------------------
// serial_input -
//-------------------------------------------------
-inline void abc99_device::serial_input()
+void abc99_device::serial_input()
{
m_maincpu->set_input_line(MCS48_INPUT_IRQ, (m_si || m_si_en) ? CLEAR_LINE : ASSERT_LINE);
m_mousecpu->set_input_line(MCS48_INPUT_IRQ, m_si ? CLEAR_LINE : ASSERT_LINE);
@@ -417,7 +413,7 @@ inline void abc99_device::serial_input()
// serial_output -
//-------------------------------------------------
-inline void abc99_device::serial_output(int state)
+void abc99_device::serial_output(int state)
{
if (m_txd != state)
{
@@ -432,7 +428,7 @@ inline void abc99_device::serial_output(int state)
// serial_clock -
//-------------------------------------------------
-inline void abc99_device::serial_clock()
+TIMER_CALLBACK_MEMBER(abc99_device::serial_clock)
{
m_slot->trxc_w(1);
m_slot->trxc_w(0);
@@ -440,25 +436,25 @@ inline void abc99_device::serial_clock()
//-------------------------------------------------
-// keydown -
+// scan_mouse -
//-------------------------------------------------
-inline void abc99_device::key_down(int state)
+TIMER_CALLBACK_MEMBER(abc99_device::scan_mouse)
{
- if (m_keydown != state)
- {
- m_slot->keydown_w(state);
- m_keydown = state;
- }
}
//-------------------------------------------------
-// scan_mouse -
+// keydown -
//-------------------------------------------------
-inline void abc99_device::scan_mouse()
+void abc99_device::key_down(int state)
{
+ if (m_keydown != state)
+ {
+ m_slot->keydown_w(state);
+ m_keydown = state;
+ }
}
@@ -502,10 +498,10 @@ void abc99_device::device_start()
{
m_leds.resolve();
// allocate timers
- m_serial_timer = timer_alloc(TIMER_SERIAL);
+ m_serial_timer = timer_alloc(FUNC(abc99_device::serial_clock), this);
m_serial_timer->adjust(MCS48_ALE_CLOCK(XTAL(6'000'000)/3), 0, MCS48_ALE_CLOCK(XTAL(6'000'000)/3));
- m_mouse_timer = timer_alloc(TIMER_MOUSE);
+ m_mouse_timer = timer_alloc(FUNC(abc99_device::scan_mouse), this);
// state saving
save_item(NAME(m_si));
@@ -536,25 +532,6 @@ void abc99_device::device_reset()
//-------------------------------------------------
-// device_timer - handler timer events
-//-------------------------------------------------
-
-void abc99_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_SERIAL:
- serial_clock();
- break;
-
- case TIMER_MOUSE:
- scan_mouse();
- break;
- }
-}
-
-
-//-------------------------------------------------
// txd_w -
//-------------------------------------------------
diff --git a/src/devices/bus/abckb/abc99.h b/src/devices/bus/abckb/abc99.h
index 7f7fbbfbd73..d2c30db1f4f 100644
--- a/src/devices/bus/abckb/abc99.h
+++ b/src/devices/bus/abckb/abc99.h
@@ -37,7 +37,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// optional information overrides
virtual const tiny_rom_entry *device_rom_region() const override;
@@ -50,12 +49,6 @@ protected:
private:
enum
{
- TIMER_SERIAL,
- TIMER_MOUSE
- };
-
- enum
- {
LED_1 = 0,
LED_2,
LED_3,
@@ -69,11 +62,11 @@ private:
LED_CAPS_LOCK
};
- inline void serial_input();
- inline void serial_output(int state);
- inline void serial_clock();
- inline void key_down(int state);
- inline void scan_mouse();
+ void serial_input();
+ void serial_output(int state);
+ TIMER_CALLBACK_MEMBER(serial_clock);
+ TIMER_CALLBACK_MEMBER(scan_mouse);
+ void key_down(int state);
void z2_p1_w(uint8_t data);
uint8_t z2_p2_r();
diff --git a/src/devices/bus/amiga/keyboard/mitsumi.cpp b/src/devices/bus/amiga/keyboard/mitsumi.cpp
index 7557d04b95c..ccc68d5d1d4 100644
--- a/src/devices/bus/amiga/keyboard/mitsumi.cpp
+++ b/src/devices/bus/amiga/keyboard/mitsumi.cpp
@@ -209,8 +209,8 @@ protected:
{
mitsumi_keyboard_base::device_start();
- m_wd_timeout = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mitsumi_watchdog_keyboard_base::wd_timeout), this));
- m_wd_pulse = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mitsumi_watchdog_keyboard_base::wd_pulse), this));
+ m_wd_timeout = timer_alloc(FUNC(mitsumi_watchdog_keyboard_base::wd_timeout), this);
+ m_wd_pulse = timer_alloc(FUNC(mitsumi_watchdog_keyboard_base::wd_pulse), this);
m_pd7 = 0x01U;
@@ -284,7 +284,7 @@ protected:
{
mitsumi_watchdog_keyboard_base::device_start();
- m_reset_pulse = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(a500_keyboard_base::reset_pulse), this));
+ m_reset_pulse = timer_alloc(FUNC(a500_keyboard_base::reset_pulse), this);
m_reset_active = 0U;
@@ -344,7 +344,7 @@ protected:
{
mitsumi_keyboard_base::device_start();
- m_reset_pulse = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(a600_keyboard_base::reset_pulse), this));
+ m_reset_pulse = timer_alloc(FUNC(a600_keyboard_base::reset_pulse), this);
m_reset_trigger = 0U;
m_reset_active = 0U;
diff --git a/src/devices/bus/astrocde/lightpen.cpp b/src/devices/bus/astrocde/lightpen.cpp
index 407f2a9e852..40a7ec415de 100644
--- a/src/devices/bus/astrocde/lightpen.cpp
+++ b/src/devices/bus/astrocde/lightpen.cpp
@@ -31,7 +31,7 @@ astrocade_lightpen_device::~astrocade_lightpen_device()
void astrocade_lightpen_device::device_start()
{
- m_pen_timer = timer_alloc(TIMER_TRIGGER);
+ m_pen_timer = timer_alloc(FUNC(astrocade_lightpen_device::trigger_tick), this);
save_item(NAME(m_retrigger));
}
@@ -42,20 +42,17 @@ void astrocade_lightpen_device::device_reset()
m_retrigger = false;
}
-void astrocade_lightpen_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(astrocade_lightpen_device::trigger_tick)
{
- if (id == TIMER_TRIGGER)
- {
- write_ltpen(1);
- write_ltpen(0);
- if (m_retrigger)
- m_pen_timer->adjust(m_screen->time_until_pos(m_lighty->read(), m_lightx->read()));
- else
- m_pen_timer->adjust(attotime::never);
- }
+ write_ltpen(1);
+ write_ltpen(0);
+ if (m_retrigger)
+ m_pen_timer->adjust(m_screen->time_until_pos(m_lighty->read(), m_lightx->read()));
+ else
+ m_pen_timer->adjust(attotime::never);
}
-INPUT_CHANGED_MEMBER( astrocade_lightpen_device::trigger )
+INPUT_CHANGED_MEMBER(astrocade_lightpen_device::trigger)
{
if (newval)
{
diff --git a/src/devices/bus/astrocde/lightpen.h b/src/devices/bus/astrocde/lightpen.h
index 136ea918a81..dd75c807443 100644
--- a/src/devices/bus/astrocde/lightpen.h
+++ b/src/devices/bus/astrocde/lightpen.h
@@ -22,16 +22,15 @@ public:
astrocade_lightpen_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock = 0U);
virtual ~astrocade_lightpen_device();
- DECLARE_INPUT_CHANGED_MEMBER( trigger );
+ DECLARE_INPUT_CHANGED_MEMBER(trigger);
protected:
// device_t implementation
virtual void device_start() override;
virtual void device_reset() override;
virtual ioport_constructor device_input_ports() const override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
- static const device_timer_id TIMER_TRIGGER = 0;
+ TIMER_CALLBACK_MEMBER(trigger_tick);
private:
required_ioport m_trigger;
diff --git a/src/devices/bus/ata/atahle.cpp b/src/devices/bus/ata/atahle.cpp
index 8a654096531..0ba22e2773b 100644
--- a/src/devices/bus/ata/atahle.cpp
+++ b/src/devices/bus/ata/atahle.cpp
@@ -110,8 +110,8 @@ void ata_hle_device::device_start()
save_item(NAME(m_identify_buffer));
- m_busy_timer = timer_alloc(TID_BUSY);
- m_buffer_empty_timer = timer_alloc(TID_BUFFER_EMPTY);
+ m_busy_timer = timer_alloc(FUNC(ata_hle_device::busy_tick), this);
+ m_buffer_empty_timer = timer_alloc(FUNC(ata_hle_device::empty_tick), this);
}
void ata_hle_device::device_reset()
@@ -151,20 +151,16 @@ void ata_hle_device::soft_reset()
start_busy(DIAGNOSTIC_TIME, PARAM_DIAGNOSTIC);
}
-void ata_hle_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(ata_hle_device::busy_tick)
{
- switch(id)
- {
- case TID_BUSY:
- m_status &= ~IDE_STATUS_BSY;
+ m_status &= ~IDE_STATUS_BSY;
+ finished_busy(param);
+}
- finished_busy(param);
- break;
- case TID_BUFFER_EMPTY:
- m_buffer_empty_timer->enable(false);
- fill_buffer();
- break;
- }
+TIMER_CALLBACK_MEMBER(ata_hle_device::empty_tick)
+{
+ m_buffer_empty_timer->enable(false);
+ fill_buffer();
}
void ata_hle_device::finished_busy(int param)
diff --git a/src/devices/bus/ata/atahle.h b/src/devices/bus/ata/atahle.h
index 2c5f2ba803c..5fcfa90c478 100644
--- a/src/devices/bus/ata/atahle.h
+++ b/src/devices/bus/ata/atahle.h
@@ -35,7 +35,9 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(busy_tick);
+ TIMER_CALLBACK_MEMBER(empty_tick);
void set_irq(int state);
void set_dmarq(int state);
diff --git a/src/devices/bus/ata/idehd.cpp b/src/devices/bus/ata/idehd.cpp
index 9b20827d4fd..ba5829e6d9c 100644
--- a/src/devices/bus/ata/idehd.cpp
+++ b/src/devices/bus/ata/idehd.cpp
@@ -812,7 +812,7 @@ void ide_hdd_device::device_start()
ata_mass_storage_device::device_start();
/* create a timer for timing status */
- m_last_status_timer = timer_alloc(TID_NULL);
+ m_last_status_timer = machine().scheduler().timer_alloc(timer_expired_delegate());
}
//-------------------------------------------------
diff --git a/src/devices/bus/bbc/1mhzbus/m5000.cpp b/src/devices/bus/bbc/1mhzbus/m5000.cpp
index 2e3a525622d..ae3fd948969 100644
--- a/src/devices/bus/bbc/1mhzbus/m5000.cpp
+++ b/src/devices/bus/bbc/1mhzbus/m5000.cpp
@@ -247,7 +247,7 @@ void htmusic_device::device_start()
m_stream = stream_alloc(0, 2, clock() / 128);
// allocate timer
- m_dsp_timer = timer_alloc(0);
+ m_dsp_timer = timer_alloc(FUNC(htmusic_device::dsp_tick), this);
// register for save states
save_item(NAME(m_wave_ram));
@@ -303,7 +303,7 @@ void htmusic_device::device_reset()
#define INVERT(c) (BIT(CTL(c), 4))
#define PAN(c) (CTL(c) & 0x0f)
-void htmusic_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(htmusic_device::dsp_tick)
{
// 4-bit channel select
uint8_t channel = (m_counter >> 3) & 0x0f;
diff --git a/src/devices/bus/bbc/1mhzbus/m5000.h b/src/devices/bus/bbc/1mhzbus/m5000.h
index f49f2804187..116bc17cebe 100644
--- a/src/devices/bus/bbc/1mhzbus/m5000.h
+++ b/src/devices/bus/bbc/1mhzbus/m5000.h
@@ -41,8 +41,6 @@ public:
void ram_w(offs_t offset, uint8_t data) { m_wave_ram[offset & 0x7ff] = data; }
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
protected:
// device-level overrides
virtual void device_start() override;
@@ -51,6 +49,8 @@ protected:
// sound stream update overrides
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
+ TIMER_CALLBACK_MEMBER(dsp_tick);
+
private:
uint16_t m_antilog[128];
uint8_t m_wave_ram[0x800];
diff --git a/src/devices/bus/bbc/joyport/mouse.cpp b/src/devices/bus/bbc/joyport/mouse.cpp
index 044722268a7..1cd91caeaa5 100644
--- a/src/devices/bus/bbc/joyport/mouse.cpp
+++ b/src/devices/bus/bbc/joyport/mouse.cpp
@@ -75,7 +75,7 @@ bbcmc_mouse_device::bbcmc_mouse_device(const machine_config &mconfig, const char
void bbcmc_mouse_device::device_start()
{
- m_mouse_timer = timer_alloc();
+ m_mouse_timer = timer_alloc(FUNC(bbcmc_mouse_device::update), this);
}
@@ -100,7 +100,7 @@ void bbcmc_mouse_device::device_reset()
// IMPLEMENTATION
//**************************************************************************
-void bbcmc_mouse_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(bbcmc_mouse_device::update)
{
int x = m_mouse_x->read();
int y = m_mouse_y->read();
diff --git a/src/devices/bus/bbc/joyport/mouse.h b/src/devices/bus/bbc/joyport/mouse.h
index d65bbbe5ffa..0e2c6947104 100644
--- a/src/devices/bus/bbc/joyport/mouse.h
+++ b/src/devices/bus/bbc/joyport/mouse.h
@@ -31,13 +31,14 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// optional information overrides
virtual ioport_constructor device_input_ports() const override;
virtual uint8_t pb_r() override;
+ TIMER_CALLBACK_MEMBER(update);
+
private:
required_ioport m_mouse_x;
required_ioport m_mouse_y;
diff --git a/src/devices/bus/bbc/userport/pointer.cpp b/src/devices/bus/bbc/userport/pointer.cpp
index 18c861265d4..cff7c1570e2 100644
--- a/src/devices/bus/bbc/userport/pointer.cpp
+++ b/src/devices/bus/bbc/userport/pointer.cpp
@@ -151,7 +151,7 @@ bbc_tracker_device::bbc_tracker_device(const machine_config &mconfig, const char
void bbc_pointer_device::device_start()
{
- m_pointer_timer = timer_alloc();
+ m_pointer_timer = timer_alloc(FUNC(bbc_pointer_device::update), this);
}
@@ -176,7 +176,7 @@ void bbc_pointer_device::device_reset()
// IMPLEMENTATION
//**************************************************************************
-void bbc_pointer_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(bbc_pointer_device::update)
{
int x = m_pointer_x->read();
int y = m_pointer_y->read();
diff --git a/src/devices/bus/bbc/userport/pointer.h b/src/devices/bus/bbc/userport/pointer.h
index c830caf7f00..865a9c91270 100644
--- a/src/devices/bus/bbc/userport/pointer.h
+++ b/src/devices/bus/bbc/userport/pointer.h
@@ -29,7 +29,8 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(update);
required_ioport m_pointer_x;
required_ioport m_pointer_y;
diff --git a/src/devices/bus/c64/c128_partner.cpp b/src/devices/bus/c64/c128_partner.cpp
index c17bf49f792..7c6cf1aea97 100644
--- a/src/devices/bus/c64/c128_partner.cpp
+++ b/src/devices/bus/c64/c128_partner.cpp
@@ -98,7 +98,7 @@ c128_partner_cartridge_device::c128_partner_cartridge_device(const machine_confi
void c128_partner_cartridge_device::device_start()
{
// simulate the 16.7ms pulse from CIA1 PB2 that would arrive thru the joystick port dongle
- t_joyb2 = timer_alloc();
+ t_joyb2 = timer_alloc(FUNC(c128_partner_cartridge_device::update_joyb2), this);
t_joyb2->adjust(attotime::from_msec(16), 0, attotime::from_msec(16));
// state saving
@@ -127,10 +127,10 @@ void c128_partner_cartridge_device::device_reset()
//-------------------------------------------------
-// device_timer -
+// update_joyb2 -
//-------------------------------------------------
-void c128_partner_cartridge_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(c128_partner_cartridge_device::update_joyb2)
{
if (m_ls74_cd)
{
diff --git a/src/devices/bus/c64/c128_partner.h b/src/devices/bus/c64/c128_partner.h
index 6f45b32a64f..3f91afbb0e9 100644
--- a/src/devices/bus/c64/c128_partner.h
+++ b/src/devices/bus/c64/c128_partner.h
@@ -39,7 +39,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_c64_expansion_card_interface overrides
virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
@@ -48,6 +47,8 @@ protected:
// device_vcs_control_port_interface overrides
virtual void vcs_joy_w(uint8_t data);
+ TIMER_CALLBACK_MEMBER(update_joyb2);
+
private:
memory_share_creator<uint8_t> m_ram;
diff --git a/src/devices/bus/c64/epyx_fast_load.cpp b/src/devices/bus/c64/epyx_fast_load.cpp
index 7f398bf1963..21352ddef63 100644
--- a/src/devices/bus/c64/epyx_fast_load.cpp
+++ b/src/devices/bus/c64/epyx_fast_load.cpp
@@ -51,7 +51,7 @@ c64_epyx_fast_load_cartridge_device::c64_epyx_fast_load_cartridge_device(const m
void c64_epyx_fast_load_cartridge_device::device_start()
{
// allocate timer
- m_exrom_timer = timer_alloc();
+ m_exrom_timer = timer_alloc(FUNC(c64_epyx_fast_load_cartridge_device::update_exrom), this);
}
@@ -67,10 +67,10 @@ void c64_epyx_fast_load_cartridge_device::device_reset()
//-------------------------------------------------
-// device_timer - handler timer events
+// update_exrom - update exrom flag
//-------------------------------------------------
-void c64_epyx_fast_load_cartridge_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(c64_epyx_fast_load_cartridge_device::update_exrom)
{
m_exrom = 1;
}
diff --git a/src/devices/bus/c64/epyx_fast_load.h b/src/devices/bus/c64/epyx_fast_load.h
index 1e825b89397..8a2ebcaa9b0 100644
--- a/src/devices/bus/c64/epyx_fast_load.h
+++ b/src/devices/bus/c64/epyx_fast_load.h
@@ -33,12 +33,13 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_c64_expansion_card_interface overrides
virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ TIMER_CALLBACK_MEMBER(update_exrom);
+
private:
emu_timer *m_exrom_timer;
};
diff --git a/src/devices/bus/c64/super_explode.cpp b/src/devices/bus/c64/super_explode.cpp
index 8867845fa52..b01e2e25fba 100644
--- a/src/devices/bus/c64/super_explode.cpp
+++ b/src/devices/bus/c64/super_explode.cpp
@@ -51,7 +51,7 @@ c64_super_explode_cartridge_device::c64_super_explode_cartridge_device(const mac
void c64_super_explode_cartridge_device::device_start()
{
// allocate timer
- m_exrom_timer = timer_alloc();
+ m_exrom_timer = timer_alloc(FUNC(c64_super_explode_cartridge_device::update_exrom), this);
// state saving
save_item(NAME(m_bank));
@@ -72,10 +72,10 @@ void c64_super_explode_cartridge_device::device_reset()
//-------------------------------------------------
-// device_timer - handler timer events
+// update_exram - update exrom flag for banking
//-------------------------------------------------
-void c64_super_explode_cartridge_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(c64_super_explode_cartridge_device::update_exrom)
{
m_exrom = 1;
}
diff --git a/src/devices/bus/c64/super_explode.h b/src/devices/bus/c64/super_explode.h
index a90a7a697ca..b2cedd35c55 100644
--- a/src/devices/bus/c64/super_explode.h
+++ b/src/devices/bus/c64/super_explode.h
@@ -33,12 +33,13 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_c64_expansion_card_interface overrides
virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ TIMER_CALLBACK_MEMBER(update_exrom);
+
private:
uint8_t m_bank;
diff --git a/src/devices/bus/c64/vw64.cpp b/src/devices/bus/c64/vw64.cpp
index 266eb3c2017..81a56e478b8 100644
--- a/src/devices/bus/c64/vw64.cpp
+++ b/src/devices/bus/c64/vw64.cpp
@@ -81,7 +81,7 @@ c64_vizawrite_cartridge_device::c64_vizawrite_cartridge_device(const machine_con
void c64_vizawrite_cartridge_device::device_start()
{
// allocate timer
- m_game_timer = timer_alloc();
+ m_game_timer = timer_alloc(FUNC(c64_vizawrite_cartridge_device::update_game), this);
}
@@ -98,10 +98,11 @@ void c64_vizawrite_cartridge_device::device_reset()
//-------------------------------------------------
-// device_timer - handler timer events
+// update_game - update mapping flags for game
+// data
//-------------------------------------------------
-void c64_vizawrite_cartridge_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(c64_vizawrite_cartridge_device::update_game)
{
m_game = 1;
}
diff --git a/src/devices/bus/c64/vw64.h b/src/devices/bus/c64/vw64.h
index 805d40a975c..00b94969413 100644
--- a/src/devices/bus/c64/vw64.h
+++ b/src/devices/bus/c64/vw64.h
@@ -33,12 +33,13 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_c64_expansion_card_interface overrides
virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
virtual int c64_exrom_r(offs_t offset, int sphi2, int ba, int rw) override { return 0; }
+ TIMER_CALLBACK_MEMBER(update_game);
+
private:
emu_timer *m_game_timer;
};
diff --git a/src/devices/bus/cbus/pc9801_86.cpp b/src/devices/bus/cbus/pc9801_86.cpp
index ab53d87cce2..ec54475ae45 100644
--- a/src/devices/bus/cbus/pc9801_86.cpp
+++ b/src/devices/bus/cbus/pc9801_86.cpp
@@ -229,7 +229,7 @@ void pc9801_86_device::device_start()
m_io_base = 0;
- m_dac_timer = timer_alloc();
+ m_dac_timer = timer_alloc(FUNC(pc9801_86_device::dac_tick), this);
save_item(NAME(m_count));
save_item(NAME(m_queue));
save_item(NAME(m_irq_rate));
@@ -382,10 +382,8 @@ u8 pc9801_86_device::queue_pop()
return ret;
}
-void pc9801_86_device::device_timer(emu_timer& timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(pc9801_86_device::dac_tick)
{
- int16_t lsample, rsample;
-
m_pcm_clk = !m_pcm_clk;
if((m_pcm_ctrl & 0x40) || !(m_pcm_ctrl & 0x80))
return;
@@ -402,24 +400,24 @@ void pc9801_86_device::device_timer(emu_timer& timer, device_timer_id id, int pa
case 0x50: // 8bit right only
m_rdac->write(queue_pop() << 8);
break;
- case 0x30: // 16bit stereo
- lsample = queue_pop() << 8;
+ case 0x30: { // 16bit stereo
+ int16_t lsample = queue_pop() << 8;
lsample |= queue_pop();
- rsample = queue_pop() << 8;
+ int16_t rsample = queue_pop() << 8;
rsample |= queue_pop();
m_ldac->write(lsample);
m_rdac->write(rsample);
- break;
- case 0x20: // 16bit left only
- lsample = queue_pop() << 8;
+ } break;
+ case 0x20: { // 16bit left only
+ int16_t lsample = queue_pop() << 8;
lsample |= queue_pop();
m_ldac->write(lsample);
- break;
- case 0x10: // 16bit right only
- rsample = queue_pop() << 8;
+ } break;
+ case 0x10: { // 16bit right only
+ int16_t rsample = queue_pop() << 8;
rsample |= queue_pop();
m_rdac->write(rsample);
- break;
+ } break;
}
if((queue_count() < m_irq_rate) && (m_pcm_ctrl & 0x20))
{
diff --git a/src/devices/bus/cbus/pc9801_86.h b/src/devices/bus/cbus/pc9801_86.h
index 858a1193c75..7903f11e0b9 100644
--- a/src/devices/bus/cbus/pc9801_86.h
+++ b/src/devices/bus/cbus/pc9801_86.h
@@ -41,10 +41,11 @@ protected:
void opna_reset_routes_config(machine_config &config);
virtual ioport_constructor device_input_ports() const override;
virtual const tiny_rom_entry *device_rom_region() const override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
void pc9801_86_config(machine_config &config);
virtual u16 read_io_base() override;
+ TIMER_CALLBACK_MEMBER(dac_tick);
+
required_device<pc9801_slot_device> m_bus;
required_device<ym2608_device> m_opna;
diff --git a/src/devices/bus/centronics/epson_lx810l.cpp b/src/devices/bus/centronics/epson_lx810l.cpp
index a1b0891dbe0..24f9b90c50f 100644
--- a/src/devices/bus/centronics/epson_lx810l.cpp
+++ b/src/devices/bus/centronics/epson_lx810l.cpp
@@ -329,7 +329,7 @@ void epson_lx810l_device::device_start()
m_online_led.resolve();
m_ready_led.resolve();
- m_cr_timer = timer_alloc(TIMER_CR);
+ m_cr_timer = timer_alloc(FUNC(epson_lx810l_device::cr_tick), this);
}
@@ -344,26 +344,22 @@ void epson_lx810l_device::device_reset()
//-------------------------------------------------
-// device_timer - device-specific timer
+// cr_tick - handle a carriage return
//-------------------------------------------------
-void epson_lx810l_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(epson_lx810l_device::cr_tick)
{
- switch (id) {
- case TIMER_CR:
- /* The firmware issues two half-steps in sequence, one immediately
- * after the other. At full speed, the motor does two half-steps at
- * each 833 microseconds. A timer fires the printhead twice, with
- * the same period as each half-step (417 microseconds), but with
- * a 356 microseconds delay relative to the motor steps.
- */
- m_in_between_offset += param;
+ /* The firmware issues two half-steps in sequence, one immediately
+ * after the other. At full speed, the motor does two half-steps at
+ * each 833 microseconds. A timer fires the printhead twice, with
+ * the same period as each half-step (417 microseconds), but with
+ * a 356 microseconds delay relative to the motor steps.
+ */
+ m_in_between_offset += param;
- m_real_cr_steps--;
- if (m_real_cr_steps)
- m_cr_timer->adjust(attotime::from_usec(400), m_bitmap_printer->m_cr_direction);
- break;
- }
+ m_real_cr_steps--;
+ if (m_real_cr_steps)
+ m_cr_timer->adjust(attotime::from_usec(400), m_bitmap_printer->m_cr_direction);
}
diff --git a/src/devices/bus/centronics/epson_lx810l.h b/src/devices/bus/centronics/epson_lx810l.h
index 82ec40cc1c2..1b5581a606b 100644
--- a/src/devices/bus/centronics/epson_lx810l.h
+++ b/src/devices/bus/centronics/epson_lx810l.h
@@ -57,7 +57,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// optional information overrides
virtual const tiny_rom_entry *device_rom_region() const override;
@@ -74,6 +73,8 @@ private:
uint8_t portc_r(offs_t offset);
void portc_w(offs_t offset, uint8_t data);
+ TIMER_CALLBACK_MEMBER(cr_tick);
+
/* fake memory I/O to get past memory reset check */
uint8_t fakemem_r();
void fakemem_w(uint8_t data);
diff --git a/src/devices/bus/centronics/printer.cpp b/src/devices/bus/centronics/printer.cpp
index c954c85c95c..b1b136cfc66 100644
--- a/src/devices/bus/centronics/printer.cpp
+++ b/src/devices/bus/centronics/printer.cpp
@@ -27,17 +27,39 @@ centronics_printer_device::centronics_printer_device(const machine_config &mconf
m_printer(*this, "printer")
{
}
+
//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
-
void centronics_printer_device::device_add_mconfig(machine_config &config)
{
PRINTER(config, m_printer, 0);
m_printer->online_callback().set(FUNC(centronics_printer_device::printer_online));
}
+void centronics_printer_device::device_start()
+{
+ m_ack_timer = timer_alloc(FUNC(centronics_printer_device::ack_timer_tick), this);
+ m_busy_timer = timer_alloc(FUNC(centronics_printer_device::busy_timer_tick), this);
+
+ /* register for state saving */
+ save_item(NAME(m_strobe));
+ save_item(NAME(m_data));
+ save_item(NAME(m_busy));
+}
+
+void centronics_printer_device::device_reset()
+{
+ m_busy = false;
+ output_busy(m_busy);
+ output_fault(1);
+ output_ack(1);
+ output_select(1);
+}
+
+
+
/*-------------------------------------------------
printer_online - callback that
sets us busy when the printer goes offline
@@ -48,58 +70,45 @@ WRITE_LINE_MEMBER(centronics_printer_device::printer_online)
output_perror(!state);
}
-void centronics_printer_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+/*-------------------------------------------------
+ ack_timer_tick - update the printer
+ acknowledge line after an appropriate delay
+-------------------------------------------------*/
+
+TIMER_CALLBACK_MEMBER(centronics_printer_device::ack_timer_tick)
{
- switch (id)
+ output_ack(param);
+
+ if (!param)
{
- case TIMER_ACK:
- output_ack(param);
-
- if (param == false)
- {
- /* data is now ready, output it */
- m_printer->output(m_data);
-
- /* ready to receive more data, return BUSY to low */
- m_busy_timer->adjust(attotime::from_usec(7), false);
- }
- break;
-
- case TIMER_BUSY:
- m_busy = param;
- output_busy(m_busy);
-
- if (param == true)
- {
- /* timer to turn ACK low to receive data */
- m_ack_timer->adjust(attotime::from_usec(10), false);
- }
- else
- {
- /* timer to return ACK to high state */
- m_ack_timer->adjust(attotime::from_usec(5), true);
- }
+ /* data is now ready, output it */
+ m_printer->output(m_data);
+
+ /* ready to receive more data, return BUSY to low */
+ m_busy_timer->adjust(attotime::from_usec(7), 0);
}
}
-void centronics_printer_device::device_start()
-{
- m_ack_timer = timer_alloc(TIMER_ACK);
- m_busy_timer = timer_alloc(TIMER_BUSY);
-
- /* register for state saving */
- save_item(NAME(m_strobe));
- save_item(NAME(m_data));
- save_item(NAME(m_busy));
-}
+/*-------------------------------------------------
+ busy_timer_tick - update the printer's
+ busy state
+-------------------------------------------------*/
-void centronics_printer_device::device_reset()
+TIMER_CALLBACK_MEMBER(centronics_printer_device::busy_timer_tick)
{
- m_busy = false;
+ m_busy = param;
output_busy(m_busy);
- output_fault(1);
- output_ack(1);
- output_select(1);
+
+ if (param)
+ {
+ /* timer to turn ACK low to receive data */
+ m_ack_timer->adjust(attotime::from_usec(10), 0);
+ }
+ else
+ {
+ /* timer to return ACK to high state */
+ m_ack_timer->adjust(attotime::from_usec(5), 1);
+ }
}
/*-------------------------------------------------
diff --git a/src/devices/bus/centronics/printer.h b/src/devices/bus/centronics/printer.h
index 7d2e1623ae9..e959959be0c 100644
--- a/src/devices/bus/centronics/printer.h
+++ b/src/devices/bus/centronics/printer.h
@@ -33,17 +33,14 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual bool supports_pin35_5v() override { return true; }
+
private:
DECLARE_WRITE_LINE_MEMBER( printer_online );
- enum
- {
- TIMER_ACK,
- TIMER_BUSY
- };
+ TIMER_CALLBACK_MEMBER(ack_timer_tick);
+ TIMER_CALLBACK_MEMBER(busy_timer_tick);
emu_timer *m_ack_timer;
emu_timer *m_busy_timer;
diff --git a/src/devices/bus/coco/cococart.cpp b/src/devices/bus/coco/cococart.cpp
index 2dbf679f363..ec387378fb8 100644
--- a/src/devices/bus/coco/cococart.cpp
+++ b/src/devices/bus/coco/cococart.cpp
@@ -90,14 +90,6 @@
CONSTANTS
***************************************************************************/
-enum
-{
- TIMER_CART,
- TIMER_NMI,
- TIMER_HALT
-};
-
-
// definitions of RPK PCBs in layout.xml
static const char *coco_rpk_pcbdefs[] =
{
@@ -149,11 +141,11 @@ cococart_slot_device::cococart_slot_device(const machine_config &mconfig, const
void cococart_slot_device::device_start()
{
- for(int i=0; i<TIMER_POOL; i++ )
+ for(int i=0; i < TIMER_POOL; i++ )
{
- m_cart_line.timer[i] = timer_alloc(TIMER_CART);
- m_nmi_line.timer[i] = timer_alloc(TIMER_NMI);
- m_halt_line.timer[i] = timer_alloc(TIMER_HALT);
+ m_cart_line.timer[i] = timer_alloc(FUNC(cococart_slot_device::cart_line_timer_tick), this);
+ m_nmi_line.timer[i] = timer_alloc(FUNC(cococart_slot_device::nmi_line_timer_tick), this);
+ m_halt_line.timer[i] = timer_alloc(FUNC(cococart_slot_device::halt_line_timer_tick), this);
}
m_cart_line.timer_index = 0;
@@ -204,28 +196,37 @@ void cococart_slot_device::device_start()
//-------------------------------------------------
-// device_timer - handle timer callbacks
+// cart_line_timer_tick - update the output
+// value for the cart's line to PIA1 CB1
//-------------------------------------------------
-void cococart_slot_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(cococart_slot_device::cart_line_timer_tick)
{
- switch(id)
- {
- case TIMER_CART:
- set_line(line::CART, m_cart_line, (line_value) param);
- break;
+ set_line(line::CART, m_cart_line, (line_value) param);
+}
- case TIMER_NMI:
- set_line(line::NMI, m_nmi_line, (line_value) param);
- break;
+//-------------------------------------------------
+// nmi_line_timer_tick - update the output
+// value sent to the CPU's NMI line
+//-------------------------------------------------
- case TIMER_HALT:
- set_line(line::HALT, m_halt_line, (line_value) param);
- break;
- }
+TIMER_CALLBACK_MEMBER(cococart_slot_device::nmi_line_timer_tick)
+{
+ set_line(line::NMI, m_nmi_line, (line_value) param);
+}
+
+//-------------------------------------------------
+// halt_line_timer_tick - update the output
+// value sent to the CPU's HALT line
+//-------------------------------------------------
+
+TIMER_CALLBACK_MEMBER(cococart_slot_device::halt_line_timer_tick)
+{
+ set_line(line::HALT, m_halt_line, (line_value) param);
}
+
//-------------------------------------------------
// cts_read
//-------------------------------------------------
diff --git a/src/devices/bus/coco/cococart.h b/src/devices/bus/coco/cococart.h
index 1918ba05c40..b686ac0748d 100644
--- a/src/devices/bus/coco/cococart.h
+++ b/src/devices/bus/coco/cococart.h
@@ -69,7 +69,6 @@ public:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// image-level overrides
virtual image_init_result call_load() override;
@@ -121,10 +120,12 @@ private:
coco_cartridge_line m_cart_line;
coco_cartridge_line m_nmi_line;
coco_cartridge_line m_halt_line;
+
public:
devcb_write_line m_cart_callback;
devcb_write_line m_nmi_callback;
devcb_write_line m_halt_callback;
+
private:
// cartridge
device_cococart_interface *m_cart;
@@ -133,6 +134,11 @@ private:
void set_line(line ln, coco_cartridge_line &line, line_value value);
void set_line_timer(coco_cartridge_line &line, line_value value);
void twiddle_line_if_q(coco_cartridge_line &line);
+
+ TIMER_CALLBACK_MEMBER(cart_line_timer_tick);
+ TIMER_CALLBACK_MEMBER(nmi_line_timer_tick);
+ TIMER_CALLBACK_MEMBER(halt_line_timer_tick);
+
public:
static const char *line_value_string(line_value value);
};
diff --git a/src/devices/bus/compucolor/floppy.cpp b/src/devices/bus/compucolor/floppy.cpp
index 99a89e4f543..9c8a33870c1 100644
--- a/src/devices/bus/compucolor/floppy.cpp
+++ b/src/devices/bus/compucolor/floppy.cpp
@@ -127,7 +127,7 @@ void compucolor_floppy_port_device::device_start()
void compucolor_floppy_device::device_start()
{
// allocate timer
- m_timer = timer_alloc();
+ m_timer = timer_alloc(FUNC(compucolor_floppy_device::rxd_tick), this);
m_timer->adjust(attotime::from_hz(9600*8), 0, attotime::from_hz(9600*8));
// state saving
@@ -138,10 +138,10 @@ void compucolor_floppy_device::device_start()
//-------------------------------------------------
-// device_timer - handle timer events
+// rxd_tick -
//-------------------------------------------------
-void compucolor_floppy_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(compucolor_floppy_device::rxd_tick)
{
if (!m_sel && !m_rw)
{
diff --git a/src/devices/bus/compucolor/floppy.h b/src/devices/bus/compucolor/floppy.h
index 8342a3668ed..66247ac9601 100644
--- a/src/devices/bus/compucolor/floppy.h
+++ b/src/devices/bus/compucolor/floppy.h
@@ -75,7 +75,6 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// optional information overrides
virtual void device_add_mconfig(machine_config &config) override;
@@ -93,6 +92,7 @@ private:
required_device<floppy_connector> m_floppy;
+ TIMER_CALLBACK_MEMBER(rxd_tick);
bool read_bit();
void write_bit(bool bit);
diff --git a/src/devices/bus/dmv/k210.cpp b/src/devices/bus/dmv/k210.cpp
index 169ce2ed5f6..90f39e5bf0e 100644
--- a/src/devices/bus/dmv/k210.cpp
+++ b/src/devices/bus/dmv/k210.cpp
@@ -46,7 +46,7 @@ dmv_k210_device::dmv_k210_device(const machine_config &mconfig, const char *tag,
void dmv_k210_device::device_start()
{
- m_clk1_timer = timer_alloc(0);
+ m_clk1_timer = timer_alloc(FUNC(dmv_k210_device::strobe_tick), this);
// register for state saving
save_item(NAME(m_portb));
@@ -65,10 +65,10 @@ void dmv_k210_device::device_reset()
}
//-------------------------------------------------
-// device_timer - handler timer events
+// strobe_tick -
//-------------------------------------------------
-void dmv_k210_device::device_timer(emu_timer &timer, device_timer_id tid, int param)
+TIMER_CALLBACK_MEMBER(dmv_k210_device::strobe_tick)
{
m_centronics->write_strobe(CLEAR_LINE);
}
diff --git a/src/devices/bus/dmv/k210.h b/src/devices/bus/dmv/k210.h
index ea29bf31f08..d49673b2415 100644
--- a/src/devices/bus/dmv/k210.h
+++ b/src/devices/bus/dmv/k210.h
@@ -28,7 +28,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id tid, int param) override;
// optional information overrides
virtual void device_add_mconfig(machine_config &config) override;
@@ -53,6 +52,8 @@ private:
DECLARE_WRITE_LINE_MEMBER(cent_autofd_w);
DECLARE_WRITE_LINE_MEMBER(cent_init_w);
+ TIMER_CALLBACK_MEMBER(strobe_tick);
+
required_device<i8255_device> m_ppi;
required_device<centronics_device> m_centronics;
required_device<input_buffer_device> m_cent_data_in;
diff --git a/src/devices/bus/ecbbus/grip.cpp b/src/devices/bus/ecbbus/grip.cpp
index b4a09f78523..6de51191cd5 100644
--- a/src/devices/bus/ecbbus/grip.cpp
+++ b/src/devices/bus/ecbbus/grip.cpp
@@ -571,7 +571,20 @@ ecb_grip21_device::ecb_grip21_device(const machine_config &mconfig, const char *
m_j3a(*this, "J3A"),
m_j3b(*this, "J3B"),
m_j7(*this, "J7"),
- m_centronics_busy(0), m_centronics_fault(0), m_vol0(0), m_vol1(0), m_ia(0), m_ib(0), m_keydata(0), m_kbf(0), m_lps(0), m_page(0), m_flash(0), m_base(0), m_ppi_pa(0), m_ppi_pc(0), m_kb_timer(nullptr)
+ m_centronics_busy(0),
+ m_centronics_fault(0),
+ m_vol0(0),
+ m_vol1(0),
+ m_ia(0),
+ m_ib(0),
+ m_keydata(0),
+ m_kbf(0),
+ m_lps(0),
+ m_page(0),
+ m_flash(0),
+ m_base(0),
+ m_ppi_pa(0),
+ m_ppi_pc(0)
{
}
@@ -585,10 +598,6 @@ void ecb_grip21_device::device_start()
membank("videoram")->configure_entries(0, 2, m_video_ram, 0x8000);
membank("videoram")->set_entry(0);
- // allocate keyboard scan timer
- m_kb_timer = timer_alloc();
- m_kb_timer->adjust(attotime::zero, 0, attotime::from_hz(2500));
-
// register for state saving
save_item(NAME(m_vol0));
save_item(NAME(m_vol1));
diff --git a/src/devices/bus/ecbbus/grip.h b/src/devices/bus/ecbbus/grip.h
index a0914f28137..024a820e4e3 100644
--- a/src/devices/bus/ecbbus/grip.h
+++ b/src/devices/bus/ecbbus/grip.h
@@ -100,9 +100,6 @@ private:
uint8_t m_ppi_pa; // PPI port A data
uint8_t m_ppi_pc; // PPI port C data
- // timers
- emu_timer *m_kb_timer;
-
void vol0_w(uint8_t data);
void vol1_w(uint8_t data);
void flash_w(uint8_t data);
diff --git a/src/devices/bus/econet/e01.cpp b/src/devices/bus/econet/e01.cpp
index 3b6d137ebf1..256e545c702 100644
--- a/src/devices/bus/econet/e01.cpp
+++ b/src/devices/bus/econet/e01.cpp
@@ -426,7 +426,7 @@ void econet_e01_device::device_start()
m_led.resolve();
// allocate timers
- m_clk_timer = timer_alloc();
+ m_clk_timer = timer_alloc(FUNC(econet_e01_device::clk_tick), this);
// register for state saving
save_item(NAME(m_adlc_ie));
@@ -451,10 +451,10 @@ void econet_e01_device::device_reset()
//-------------------------------------------------
-// device_timer - handler timer events
+// clk_tick - update our clock output
//-------------------------------------------------
-void econet_e01_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(econet_e01_device::clk_tick)
{
if (m_clk_en)
{
diff --git a/src/devices/bus/econet/e01.h b/src/devices/bus/econet/e01.h
index acffa76d13c..695e18c47cd 100644
--- a/src/devices/bus/econet/e01.h
+++ b/src/devices/bus/econet/e01.h
@@ -44,7 +44,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// optional information overrides
virtual const tiny_rom_entry *device_rom_region() const override;
@@ -65,6 +64,9 @@ private:
DECLARE_WRITE_LINE_MEMBER( fdc_drq_w );
DECLARE_WRITE_LINE_MEMBER( scsi_bsy_w );
DECLARE_WRITE_LINE_MEMBER( scsi_req_w );
+
+ TIMER_CALLBACK_MEMBER(clk_tick);
+
uint8_t read(offs_t offset);
void write(offs_t offset, uint8_t data);
uint8_t ram_select_r();
diff --git a/src/devices/bus/epson_sio/pf10.cpp b/src/devices/bus/epson_sio/pf10.cpp
index e77edae7b77..067931da4e8 100644
--- a/src/devices/bus/epson_sio/pf10.cpp
+++ b/src/devices/bus/epson_sio/pf10.cpp
@@ -109,7 +109,7 @@ epson_pf10_device::epson_pf10_device(const machine_config &mconfig, const char *
void epson_pf10_device::device_start()
{
- m_timer = timer_alloc(0);
+ m_timer = timer_alloc(FUNC(epson_pf10_device::serial_clk_tick), this);
}
//-------------------------------------------------
@@ -122,17 +122,13 @@ void epson_pf10_device::device_reset()
}
//-------------------------------------------------
-// device_timer - handler timer events
+// serial_clk_tick - tick the CPU's external
+// serial clock
//-------------------------------------------------
-void epson_pf10_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER( epson_pf10_device::serial_clk_tick )
{
- switch (id)
- {
- case 0:
- m_cpu->m6801_clock_serial();
- break;
- }
+ m_cpu->m6801_clock_serial();
}
diff --git a/src/devices/bus/epson_sio/pf10.h b/src/devices/bus/epson_sio/pf10.h
index 266705ae924..ce5f2ee6f3d 100644
--- a/src/devices/bus/epson_sio/pf10.h
+++ b/src/devices/bus/epson_sio/pf10.h
@@ -34,7 +34,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// optional information overrides
virtual const tiny_rom_entry *device_rom_region() const override;
@@ -63,6 +62,8 @@ private:
uint8_t port2_r();
void port2_w(uint8_t data);
+ TIMER_CALLBACK_MEMBER( serial_clk_tick );
+
void cpu_mem(address_map &map);
required_device<hd6303y_cpu_device> m_cpu;
diff --git a/src/devices/bus/epson_sio/tf20.cpp b/src/devices/bus/epson_sio/tf20.cpp
index cd16fe2f9b1..a2f9c2e9320 100644
--- a/src/devices/bus/epson_sio/tf20.cpp
+++ b/src/devices/bus/epson_sio/tf20.cpp
@@ -149,8 +149,8 @@ void epson_tf20_device::device_start()
if (!m_ram->started())
throw device_missing_dependencies();
- m_timer_serial = timer_alloc(0);
- m_timer_tc = timer_alloc(1);
+ m_timer_serial = timer_alloc(FUNC(epson_tf20_device::serial_tick), this);
+ m_timer_tc = timer_alloc(FUNC(epson_tf20_device::tc_tick), this);
// enable second half of ram
m_cpu->space(AS_PROGRAM).install_ram(0x8000, 0xffff, m_ram->pointer() + 0x8000);
@@ -175,31 +175,32 @@ void epson_tf20_device::device_reset()
}
//-------------------------------------------------
-// device_timer - handler timer events
+// serial_tick - update serial clocks
//-------------------------------------------------
-void epson_tf20_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER( epson_tf20_device::serial_tick )
{
- switch (id)
- {
- case 0:
- m_mpsc->rxca_w(1);
- m_mpsc->rxca_w(0);
- m_mpsc->txca_w(1);
- m_mpsc->txca_w(0);
- m_mpsc->rxcb_w(1);
- m_mpsc->rxcb_w(0);
- m_mpsc->txcb_w(1);
- m_mpsc->txcb_w(0);
- break;
-
- case 1:
- logerror("%s: tc off\n", tag());
- m_fdc->tc_w(false);
- break;
- }
+ m_mpsc->rxca_w(1);
+ m_mpsc->rxca_w(0);
+ m_mpsc->txca_w(1);
+ m_mpsc->txca_w(0);
+ m_mpsc->rxcb_w(1);
+ m_mpsc->rxcb_w(0);
+ m_mpsc->txcb_w(1);
+ m_mpsc->txcb_w(0);
}
+//-------------------------------------------------
+// tc_tick - update the FDC terminal count flag
+//-------------------------------------------------
+
+TIMER_CALLBACK_MEMBER( epson_tf20_device::tc_tick )
+{
+ logerror("%s: tc off\n", tag());
+ m_fdc->tc_w(false);
+}
+
+
//**************************************************************************
// CPU & MEMORY
diff --git a/src/devices/bus/epson_sio/tf20.h b/src/devices/bus/epson_sio/tf20.h
index 98602ec2562..906ae0a4b9c 100644
--- a/src/devices/bus/epson_sio/tf20.h
+++ b/src/devices/bus/epson_sio/tf20.h
@@ -36,7 +36,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// optional information overrides
virtual const tiny_rom_entry *device_rom_region() const override;
@@ -60,6 +59,9 @@ private:
uint8_t upd765_tc_r();
void fdc_control_w(uint8_t data);
+ TIMER_CALLBACK_MEMBER( serial_tick );
+ TIMER_CALLBACK_MEMBER( tc_tick );
+
void cpu_io(address_map &map);
void cpu_mem(address_map &map);
diff --git a/src/devices/bus/gio64/newport.cpp b/src/devices/bus/gio64/newport.cpp
index c5a071eb786..ab796ba3645 100644
--- a/src/devices/bus/gio64/newport.cpp
+++ b/src/devices/bus/gio64/newport.cpp
@@ -1111,7 +1111,7 @@ gio64_xl24_device::gio64_xl24_device(const machine_config &mconfig, const char *
void newport_base_device::device_start()
{
- m_dcb_timeout_timer = timer_alloc(DCB_TIMEOUT);
+ m_dcb_timeout_timer = timer_alloc(FUNC(newport_base_device::dcb_timeout_tick), this);
save_item(NAME(m_rex3.m_draw_mode0));
save_item(NAME(m_rex3.m_color_host));
@@ -1282,12 +1282,9 @@ void newport_base_device::stop_logging()
}
#endif
-void newport_base_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(newport_base_device::dcb_timeout_tick)
{
- if (id == DCB_TIMEOUT)
- {
- m_rex3.m_status &= ~STATUS_BACKBUSY;
- }
+ m_rex3.m_status &= ~STATUS_BACKBUSY;
}
uint32_t newport_base_device::screen_update(screen_device &device, bitmap_rgb32 &bitmap, const rectangle &cliprect)
diff --git a/src/devices/bus/gio64/newport.h b/src/devices/bus/gio64/newport.h
index 3dd1a27ba40..101ca7a6e61 100644
--- a/src/devices/bus/gio64/newport.h
+++ b/src/devices/bus/gio64/newport.h
@@ -311,7 +311,6 @@ public:
protected:
// device_t overrides
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;
@@ -319,7 +318,7 @@ protected:
void device_add_mconfig(machine_config &config, uint32_t xmap_revision, uint32_t cmap_revision, uint32_t global_mask);
void mem_map(address_map &map) override;
- static constexpr device_timer_id DCB_TIMEOUT = 0;
+ TIMER_CALLBACK_MEMBER(dcb_timeout_tick);
enum
{
diff --git a/src/devices/bus/hp9845_io/98035.cpp b/src/devices/bus/hp9845_io/98035.cpp
index ff092246ab6..79017edd4c2 100644
--- a/src/devices/bus/hp9845_io/98035.cpp
+++ b/src/devices/bus/hp9845_io/98035.cpp
@@ -186,8 +186,8 @@ void hp98035_io_card_device::device_start()
save_item(NAME(m_prev_clock_keys));
save_item(NAME(m_clock_key_cnt));
- m_msec_timer = timer_alloc(MSEC_TMR_ID);
- m_clock_timer = timer_alloc(CLOCK_TMR_ID);
+ m_msec_timer = timer_alloc(FUNC(hp98035_io_card_device::msec_tick), this);
+ m_clock_timer = timer_alloc(FUNC(hp98035_io_card_device::clock_tick), this);
}
void hp98035_io_card_device::device_reset()
@@ -207,50 +207,51 @@ void hp98035_io_card_device::device_reset()
half_init();
}
-void hp98035_io_card_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(hp98035_io_card_device::msec_tick)
{
- if (id == MSEC_TMR_ID) {
- // On real hw there's a full 4-bit decimal counter, but only the LSB is used to
- // generate interrupts
- m_np_irq = !m_np_irq;
- update_dc();
- } else if (id == CLOCK_TMR_ID) {
- // Update digit multiplexer
- if (m_clock_state == CLOCK_OFF) {
- m_clock_mux = 0;
- } else {
- m_clock_mux <<= 1;
- if ((m_clock_mux & 7) == 0) {
- m_clock_mux = 1;
- }
- }
- // Act on clock chip "keys"
- if (m_clock_keys == 0 || m_clock_keys != m_prev_clock_keys) {
- m_clock_key_cnt = 0;
- if (m_clock_keys == 0 && m_clock_state == CLOCK_HHMM) {
- // Keys released in HHMM state -> turn display off
- // In real hw there is probably 1 s delay
- m_clock_state = CLOCK_OFF;
- regen_clock_image();
- }
- } else if (m_clock_key_cnt < KEY_PRESS_LONG) {
- m_clock_key_cnt++;
- if (m_clock_key_cnt == KEY_PRESS_SHORT) {
- /// Short key press
- clock_short_press();
- } else if (m_clock_key_cnt == KEY_PRESS_LONG) {
- // Long key press
- clock_long_press();
- }
+ // On real hw there's a full 4-bit decimal counter, but only the LSB is used to
+ // generate interrupts
+ m_np_irq = !m_np_irq;
+ update_dc();
+}
+
+TIMER_CALLBACK_MEMBER(hp98035_io_card_device::clock_tick)
+{
+ // Update digit multiplexer
+ if (m_clock_state == CLOCK_OFF) {
+ m_clock_mux = 0;
+ } else {
+ m_clock_mux <<= 1;
+ if ((m_clock_mux & 7) == 0) {
+ m_clock_mux = 1;
}
- m_prev_clock_keys = m_clock_keys;
- // Count seconds
- m_clock_1s_div++;
- if (m_clock_1s_div >= DIGIT_MUX_FREQ.value()) {
- m_clock_1s_div = 0;
- advance_seconds();
+ }
+ // Act on clock chip "keys"
+ if (m_clock_keys == 0 || m_clock_keys != m_prev_clock_keys) {
+ m_clock_key_cnt = 0;
+ if (m_clock_keys == 0 && m_clock_state == CLOCK_HHMM) {
+ // Keys released in HHMM state -> turn display off
+ // In real hw there is probably 1 s delay
+ m_clock_state = CLOCK_OFF;
regen_clock_image();
}
+ } else if (m_clock_key_cnt < KEY_PRESS_LONG) {
+ m_clock_key_cnt++;
+ if (m_clock_key_cnt == KEY_PRESS_SHORT) {
+ /// Short key press
+ clock_short_press();
+ } else if (m_clock_key_cnt == KEY_PRESS_LONG) {
+ // Long key press
+ clock_long_press();
+ }
+ }
+ m_prev_clock_keys = m_clock_keys;
+ // Count seconds
+ m_clock_1s_div++;
+ if (m_clock_1s_div >= DIGIT_MUX_FREQ.value()) {
+ m_clock_1s_div = 0;
+ advance_seconds();
+ regen_clock_image();
}
}
diff --git a/src/devices/bus/hp9845_io/98035.h b/src/devices/bus/hp9845_io/98035.h
index 48091cf24e3..f92e1734047 100644
--- a/src/devices/bus/hp9845_io/98035.h
+++ b/src/devices/bus/hp9845_io/98035.h
@@ -27,7 +27,6 @@ public:
protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device-level overrides
virtual ioport_constructor device_input_ports() const override;
@@ -57,6 +56,9 @@ private:
uint8_t clr_inten_r();
void clr_inten_w(uint8_t data);
+ TIMER_CALLBACK_MEMBER(msec_tick);
+ TIMER_CALLBACK_MEMBER(clock_tick);
+
void np_io_map(address_map &map);
void np_program_map(address_map &map);
diff --git a/src/devices/bus/hp9845_io/hp9885.cpp b/src/devices/bus/hp9845_io/hp9885.cpp
index 40692291cbe..1fadbc54679 100644
--- a/src/devices/bus/hp9845_io/hp9885.cpp
+++ b/src/devices/bus/hp9845_io/hp9885.cpp
@@ -336,9 +336,9 @@ void hp9885_device::device_start()
save_item(NAME(m_am_detector));
save_item(NAME(m_crc));
- m_fsm_timer = timer_alloc(FSM_TMR_ID);
- m_head_timer = timer_alloc(HEAD_TMR_ID);
- m_bit_byte_timer = timer_alloc(BIT_BYTE_TMR_ID);
+ m_fsm_timer = timer_alloc(FUNC(hp9885_device::fsm_tick), this);
+ m_head_timer = timer_alloc(FUNC(hp9885_device::head_tick), this);
+ m_bit_byte_timer = timer_alloc(FUNC(hp9885_device::bit_byte_tick), this);
m_drive = m_drive_connector->get_device();
@@ -359,172 +359,170 @@ void hp9885_device::device_reset()
set_state(FSM_IDLE);
}
-void hp9885_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(hp9885_device::fsm_tick)
{
- LOG_TIMER("Tmr %.06f ID %d FSM %d HD %d\n" , machine().time().as_double() , id , m_fsm_state , m_head_state);
+ LOG_TIMER("Tmr %.06f ID %d FSM %d HD %d\n" , machine().time().as_double() , FSM_TMR_ID , m_fsm_state , m_head_state);
+ do_FSM();
+}
- switch (id) {
- case FSM_TMR_ID:
+TIMER_CALLBACK_MEMBER(hp9885_device::head_tick)
+{
+ LOG_TIMER("Tmr %.06f ID %d FSM %d HD %d\n" , machine().time().as_double() , HEAD_TMR_ID , m_fsm_state , m_head_state);
+ if (m_head_state == HEAD_SETTLING) {
+ LOG_HEAD("%.06f Head loaded\n" , machine().time().as_double());
+ m_head_state = HEAD_LOADED;
+ // Trigger actions to be done on head loading
do_FSM();
- break;
+ m_head_timer->adjust(attotime::from_msec(HEAD_TO_MS - HD_SETTLE_MS));
+ } else {
+ LOG_HEAD("%.06f Head unloaded\n" , machine().time().as_double());
+ m_head_state = HEAD_UNLOADED;
+ }
+}
- case HEAD_TMR_ID:
- if (m_head_state == HEAD_SETTLING) {
- LOG_HEAD("%.06f Head loaded\n" , machine().time().as_double());
- m_head_state = HEAD_LOADED;
- // Trigger actions to be done on head loading
- do_FSM();
- m_head_timer->adjust(attotime::from_msec(HEAD_TO_MS - HD_SETTLE_MS));
- } else {
- LOG_HEAD("%.06f Head unloaded\n" , machine().time().as_double());
- m_head_state = HEAD_UNLOADED;
- }
- break;
+TIMER_CALLBACK_MEMBER(hp9885_device::bit_byte_tick)
+{
+ LOG_TIMER("Tmr %.06f ID %d FSM %d HD %d\n" , machine().time().as_double() , BIT_BYTE_TMR_ID , m_fsm_state , m_head_state);
- case BIT_BYTE_TMR_ID:
+ switch (m_fsm_state) {
+ case FSM_WAIT_ID_AM:
+ case FSM_WAIT_DATA_AM:
{
- switch (m_fsm_state) {
- case FSM_WAIT_ID_AM:
- case FSM_WAIT_DATA_AM:
- {
- attotime edge;
- attotime tm;
- edge = m_drive->get_next_transition(m_pll.ctime);
- bool half_bit = m_pll.feed_read_data(tm , edge , attotime::never);
- m_am_detector <<= 1;
- m_am_detector |= half_bit;
- if (m_am_detector == 0x55552a54) {
- // ID AM
- // CDCDCDCDCDCDCDCD
- // 0 0 0 0 1 1 1 0
- // 0 1 1 1 0 0 0 0
- LOG_DISK("Got ID AM\n");
+ attotime edge;
+ attotime tm;
+ edge = m_drive->get_next_transition(m_pll.ctime);
+ bool half_bit = m_pll.feed_read_data(tm , edge , attotime::never);
+ m_am_detector <<= 1;
+ m_am_detector |= half_bit;
+ if (m_am_detector == 0x55552a54) {
+ // ID AM
+ // CDCDCDCDCDCDCDCD
+ // 0 0 0 0 1 1 1 0
+ // 0 1 1 1 0 0 0 0
+ LOG_DISK("Got ID AM\n");
+ preset_crc();
+ m_word_cnt = 2;
+ set_state(FSM_RD_ID);
+ } else if (m_am_detector == 0x55552a44) {
+ // DATA AM
+ // CDCDCDCDCDCDCDCD
+ // 0 0 0 0 1 0 1 0
+ // 0 1 1 1 0 0 0 0
+ LOG_DISK("Got Data AM\n");
+ if (m_fsm_state == FSM_WAIT_DATA_AM) {
+ m_rev_cnt = 0;
+ if (BIT(m_status , STS_XFER_COMPLETE)) {
+ output_status();
+ return;
+ } else {
preset_crc();
- m_word_cnt = 2;
- set_state(FSM_RD_ID);
- } else if (m_am_detector == 0x55552a44) {
- // DATA AM
- // CDCDCDCDCDCDCDCD
- // 0 0 0 0 1 0 1 0
- // 0 1 1 1 0 0 0 0
- LOG_DISK("Got Data AM\n");
- if (m_fsm_state == FSM_WAIT_DATA_AM) {
- m_rev_cnt = 0;
- if (BIT(m_status , STS_XFER_COMPLETE)) {
- output_status();
- return;
- } else {
- preset_crc();
- if (m_op == OP_READ) {
- m_word_cnt = 129;
- set_state(FSM_RD_DATA);
- } else {
- m_word_cnt = 130;
- set_state(FSM_WR_DATA);
- m_pll.start_writing(m_pll.ctime);
- m_had_transition = false;
- wr_word(m_input);
- set_ibf(false);
- }
- }
+ if (m_op == OP_READ) {
+ m_word_cnt = 129;
+ set_state(FSM_RD_DATA);
+ } else {
+ m_word_cnt = 130;
+ set_state(FSM_WR_DATA);
+ m_pll.start_writing(m_pll.ctime);
+ m_had_transition = false;
+ wr_word(m_input);
+ set_ibf(false);
}
}
}
- break;
+ }
+ }
+ break;
- case FSM_RD_ID:
- {
- // This is needed when state is switched to one of the AM waiting states
- m_am_detector = 0;
- auto word = rd_word();
- m_word_cnt--;
- LOG_DISK("W %04x C %u\n" , word , m_word_cnt);
- if (m_word_cnt && word != ((m_seek_sector << 8) | m_track)) {
- set_state(FSM_WAIT_ID_AM);
- } else if (m_word_cnt == 0) {
- if (m_crc) {
- LOG_DISK("Wrong CRC in ID\n");
- set_state(FSM_WAIT_ID_AM);
- } else {
- LOG_DISK("Sector found\n");
- set_state(FSM_WAIT_DATA_AM);
- }
- }
+ case FSM_RD_ID:
+ {
+ // This is needed when state is switched to one of the AM waiting states
+ m_am_detector = 0;
+ auto word = rd_word();
+ m_word_cnt--;
+ LOG_DISK("W %04x C %u\n" , word , m_word_cnt);
+ if (m_word_cnt && word != ((m_seek_sector << 8) | m_track)) {
+ set_state(FSM_WAIT_ID_AM);
+ } else if (m_word_cnt == 0) {
+ if (m_crc) {
+ LOG_DISK("Wrong CRC in ID\n");
+ set_state(FSM_WAIT_ID_AM);
+ } else {
+ LOG_DISK("Sector found\n");
+ set_state(FSM_WAIT_DATA_AM);
}
- break;
+ }
+ }
+ break;
- case FSM_RD_DATA:
- {
- auto word = rd_word();
- m_word_cnt--;
- LOG_DISK("W %04x C %u\n" , word , m_word_cnt);
- if (m_word_cnt >= 1) {
- if (!BIT(m_status , STS_XFER_COMPLETE)) {
- m_output = word;
- m_obf = true;
- update_busy();
- }
- } else if (m_word_cnt == 0) {
- if (m_crc) {
- LOG_DISK("Wrong CRC in data\n");
- }
- // Move to next sector
- adv_sector();
- if (BIT(m_status , STS_XFER_COMPLETE) || m_sector_cnt == 0) {
- BIT_SET(m_status , STS_XFER_COMPLETE);
- output_status();
- } else {
- set_state(FSM_POSITIONING);
- do_FSM();
- }
- return;
- }
+ case FSM_RD_DATA:
+ {
+ auto word = rd_word();
+ m_word_cnt--;
+ LOG_DISK("W %04x C %u\n" , word , m_word_cnt);
+ if (m_word_cnt >= 1) {
+ if (!BIT(m_status , STS_XFER_COMPLETE)) {
+ m_output = word;
+ m_obf = true;
+ update_busy();
}
- break;
+ } else if (m_word_cnt == 0) {
+ if (m_crc) {
+ LOG_DISK("Wrong CRC in data\n");
+ }
+ // Move to next sector
+ adv_sector();
+ if (BIT(m_status , STS_XFER_COMPLETE) || m_sector_cnt == 0) {
+ BIT_SET(m_status , STS_XFER_COMPLETE);
+ output_status();
+ } else {
+ set_state(FSM_POSITIONING);
+ do_FSM();
+ }
+ return;
+ }
+ }
+ break;
- case FSM_WR_DATA:
- {
- m_word_cnt--;
- if (m_word_cnt > 2) {
- if (BIT(m_status , STS_XFER_COMPLETE)) {
- wr_word(0);
- } else {
- wr_word(m_input);
- if (m_word_cnt > 3) {
- set_ibf(false);
- }
- }
- } else if (m_word_cnt == 2) {
- wr_word(m_crc);
- } else if (m_word_cnt == 1) {
- // Post-amble
- wr_word(0);
- } else {
- m_pll.stop_writing(m_drive , m_pll.ctime);
- // Move to next sector
- adv_sector();
- if (BIT(m_status , STS_XFER_COMPLETE) || m_sector_cnt == 0) {
- BIT_SET(m_status , STS_XFER_COMPLETE);
- output_status();
- } else {
- set_ibf(false);
- set_state(FSM_POSITIONING);
- do_FSM();
- }
- return;
+ case FSM_WR_DATA:
+ {
+ m_word_cnt--;
+ if (m_word_cnt > 2) {
+ if (BIT(m_status , STS_XFER_COMPLETE)) {
+ wr_word(0);
+ } else {
+ wr_word(m_input);
+ if (m_word_cnt > 3) {
+ set_ibf(false);
}
}
- break;
-
- default:
- LOG("Invalid FSM state %d\n" , m_fsm_state);
- set_state(FSM_IDLE);
+ } else if (m_word_cnt == 2) {
+ wr_word(m_crc);
+ } else if (m_word_cnt == 1) {
+ // Post-amble
+ wr_word(0);
+ } else {
+ m_pll.stop_writing(m_drive , m_pll.ctime);
+ // Move to next sector
+ adv_sector();
+ if (BIT(m_status , STS_XFER_COMPLETE) || m_sector_cnt == 0) {
+ BIT_SET(m_status , STS_XFER_COMPLETE);
+ output_status();
+ } else {
+ set_ibf(false);
+ set_state(FSM_POSITIONING);
+ do_FSM();
+ }
return;
}
- timer.adjust(m_pll.ctime - machine().time());
}
break;
+
+ default:
+ LOG("Invalid FSM state %d\n" , m_fsm_state);
+ set_state(FSM_IDLE);
+ return;
}
+ m_bit_byte_timer->adjust(m_pll.ctime - machine().time());
}
void hp9885_device::floppy_ready_cb(floppy_image_device *floppy , int state)
diff --git a/src/devices/bus/hp9845_io/hp9885.h b/src/devices/bus/hp9845_io/hp9885.h
index a782df5d7df..1c9af5c3066 100644
--- a/src/devices/bus/hp9845_io/hp9885.h
+++ b/src/devices/bus/hp9845_io/hp9885.h
@@ -38,7 +38,6 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
private:
// FSM states
@@ -106,6 +105,10 @@ private:
// PLL
fdc_pll_t m_pll;
+ TIMER_CALLBACK_MEMBER(fsm_tick);
+ TIMER_CALLBACK_MEMBER(head_tick);
+ TIMER_CALLBACK_MEMBER(bit_byte_tick);
+
void floppy_ready_cb(floppy_image_device *floppy , int state);
void floppy_index_cb(floppy_image_device *floppy , int state);
diff --git a/src/devices/bus/ieee488/c2040fdc.cpp b/src/devices/bus/ieee488/c2040fdc.cpp
index 5998bb43435..18c02bba831 100644
--- a/src/devices/bus/ieee488/c2040fdc.cpp
+++ b/src/devices/bus/ieee488/c2040fdc.cpp
@@ -111,7 +111,7 @@ void c2040_fdc_device::device_start()
m_write_error.resolve_safe();
// allocate timer
- t_gen = timer_alloc(0);
+ t_gen = timer_alloc(FUNC(c2040_fdc_device::update_state), this);
// register for state saving
save_item(NAME(m_mtr0));
@@ -149,10 +149,10 @@ void c2040_fdc_device::device_reset()
//-------------------------------------------------
-// device_timer - handler timer events
+// update_state - pump our 'live' events
//-------------------------------------------------
-void c2040_fdc_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(c2040_fdc_device::update_state)
{
live_sync();
live_run();
diff --git a/src/devices/bus/ieee488/c2040fdc.h b/src/devices/bus/ieee488/c2040fdc.h
index f7b045cc0b3..2198f6aa738 100644
--- a/src/devices/bus/ieee488/c2040fdc.h
+++ b/src/devices/bus/ieee488/c2040fdc.h
@@ -59,11 +59,12 @@ protected:
virtual void device_start() override;
virtual void device_clock_changed() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// optional information overrides
virtual const tiny_rom_entry *device_rom_region() const override;
+ TIMER_CALLBACK_MEMBER(update_state);
+
void stp_w(floppy_image_device *floppy, int mtr, int &old_stp, int stp);
enum {
diff --git a/src/devices/bus/ieee488/c8050fdc.cpp b/src/devices/bus/ieee488/c8050fdc.cpp
index f08e434ea20..eea107417c9 100644
--- a/src/devices/bus/ieee488/c8050fdc.cpp
+++ b/src/devices/bus/ieee488/c8050fdc.cpp
@@ -112,7 +112,7 @@ void c8050_fdc_device::device_start()
m_write_error.resolve_safe();
// allocate timer
- t_gen = timer_alloc(0);
+ t_gen = timer_alloc(FUNC(c8050_fdc_device::update_state), this);
// register for state saving
save_item(NAME(m_mtr0));
@@ -141,10 +141,10 @@ void c8050_fdc_device::device_reset()
//-------------------------------------------------
-// device_timer - handler timer events
+// update_state - pump our 'live' events
//-------------------------------------------------
-void c8050_fdc_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(c8050_fdc_device::update_state)
{
live_sync();
live_run();
diff --git a/src/devices/bus/ieee488/c8050fdc.h b/src/devices/bus/ieee488/c8050fdc.h
index b4c8b96c52e..dd390b1b7c5 100644
--- a/src/devices/bus/ieee488/c8050fdc.h
+++ b/src/devices/bus/ieee488/c8050fdc.h
@@ -60,11 +60,12 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// optional information overrides
virtual const tiny_rom_entry *device_rom_region() const override;
+ TIMER_CALLBACK_MEMBER(update_state);
+
void stp_w(floppy_image_device *floppy, int mtr, int &old_stp, int stp);
enum {
diff --git a/src/devices/bus/ieee488/grid2102.cpp b/src/devices/bus/ieee488/grid2102.cpp
index 9ef4fac6abf..4e6bc92c391 100644
--- a/src/devices/bus/ieee488/grid2102.cpp
+++ b/src/devices/bus/ieee488/grid2102.cpp
@@ -86,10 +86,10 @@ grid210x_device::grid210x_device(const machine_config &mconfig, device_type type
void grid210x_device::device_start() {
m_bus->ndac_w(this, 1);
m_bus->nrfd_w(this, 1);
- m_delay_timer = timer_alloc(0);
+ m_delay_timer = timer_alloc(FUNC(grid210x_device::delay_tick), this);
}
-void grid210x_device::device_timer(emu_timer &timer, device_timer_id id, int param) {
+TIMER_CALLBACK_MEMBER(grid210x_device::delay_tick) {
if (m_floppy_loop_state == GRID210X_STATE_READING_DATA) {
std::unique_ptr<uint8_t[]> data(new uint8_t[io_size]);
fseek(floppy_sector_number * 512, SEEK_SET);
diff --git a/src/devices/bus/ieee488/grid2102.h b/src/devices/bus/ieee488/grid2102.h
index 8bc475d6f84..11cdbcecdd0 100644
--- a/src/devices/bus/ieee488/grid2102.h
+++ b/src/devices/bus/ieee488/grid2102.h
@@ -33,7 +33,6 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_ieee488_interface overrides
virtual void ieee488_eoi(int state) override;
@@ -56,7 +55,10 @@ protected:
void accept_transfer();
void update_ndac(int atn);
+
private:
+ TIMER_CALLBACK_MEMBER(delay_tick);
+
int m_gpib_loop_state;
int m_floppy_loop_state;
uint8_t m_last_recv_byte;
@@ -74,6 +76,7 @@ private:
std::queue<uint8_t> m_output_data_buffer;
uint16_t io_size;
emu_timer *m_delay_timer;
+
protected:
attotime read_delay;
};
diff --git a/src/devices/bus/ieee488/hp9122c.cpp b/src/devices/bus/ieee488/hp9122c.cpp
index 2a001d2a4d0..f9619617ca1 100644
--- a/src/devices/bus/ieee488/hp9122c.cpp
+++ b/src/devices/bus/ieee488/hp9122c.cpp
@@ -91,7 +91,7 @@ void hp9122c_device::device_start()
save_item(NAME(m_ds0));
save_item(NAME(m_ds1));
- m_motor_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(hp9122c_device::motor_timeout), this));
+ m_motor_timer = timer_alloc(FUNC(hp9122c_device::motor_timeout), this);
}
TIMER_CALLBACK_MEMBER(hp9122c_device::motor_timeout)
diff --git a/src/devices/bus/ieee488/hp9895.cpp b/src/devices/bus/ieee488/hp9895.cpp
index b133c7fbf3e..3cd380d5eb8 100644
--- a/src/devices/bus/ieee488/hp9895.cpp
+++ b/src/devices/bus/ieee488/hp9895.cpp
@@ -58,11 +58,11 @@
#include "hp9895.h"
#include "formats/hpi_dsk.h"
-// Debugging
-#define VERBOSE 1
-#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
-#define VERBOSE_0 0
-#define LOG_0(x) do { if (VERBOSE_0) logerror x; } while (0)
+#define LOG_LEVEL0 (0x1U << 1)
+#define LOG_LEVEL1 (0x3U << 1)
+
+#define VERBOSE (LOG_LEVEL1)
+#include "logmacro.h"
// Macros to clear/set single bits
#define BIT_MASK(n) (1U << (n))
@@ -116,13 +116,6 @@
#define REG_SWITCHES_TIMEOUT_BIT 6 // TIMEOUT (1)
#define REG_SWITCHES_AMDT_BIT 7 // Address mark detected (1)
-// Timers
-enum {
- TIMEOUT_TMR_ID,
- BYTE_TMR_ID,
- HALF_BIT_TMR_ID
-};
-
// Timings
#define TIMEOUT_MSEC 450 // Timeout duration (ms)
#define HPMODE_BIT_FREQ 500000 // HP-mode bit frequency (Hz)
@@ -198,9 +191,9 @@ void hp9895_device::device_start()
save_item(NAME(m_hiden));
save_item(NAME(m_mgnena));
- m_timeout_timer = timer_alloc(TIMEOUT_TMR_ID);
- m_byte_timer = timer_alloc(BYTE_TMR_ID);
- m_half_bit_timer = timer_alloc(HALF_BIT_TMR_ID);
+ m_timeout_timer = timer_alloc(FUNC(hp9895_device::timeout_timer_tick), this);
+ m_byte_timer = timer_alloc(FUNC(hp9895_device::byte_timer_tick), this);
+ m_half_bit_timer = timer_alloc(FUNC(hp9895_device::half_bit_timer_tick), this);
for (auto& d : m_drives) {
d->get_device()->setup_ready_cb(floppy_image_device::ready_cb(&hp9895_device::floppy_ready_cb , this));
@@ -236,159 +229,150 @@ void hp9895_device::device_reset()
m_half_bit_timer->reset();
}
-void hp9895_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(hp9895_device::timeout_timer_tick)
{
- switch (id) {
- case TIMEOUT_TMR_ID:
- LOG(("Timeout!\n"));
- m_timeout = true;
- if (m_mgnena) {
- // CPU is resumed by timeout if MGNENA=1
- m_cpu->trigger(1);
- }
- break;
+ LOGMASKED(LOG_LEVEL1, "Timeout\n");
+ m_timeout = true;
+ if (m_mgnena) {
+ // CPU is resumed by timeout if MGNENA=1
+ m_cpu->trigger(1);
+ }
+}
- case BYTE_TMR_ID:
- {
- if (m_accdata) {
- // Resume CPU when it's waiting for SDOK
- m_cpu->trigger(1);
+TIMER_CALLBACK_MEMBER(hp9895_device::byte_timer_tick)
+{
+ if (m_accdata) {
+ // Resume CPU when it's waiting for SDOK
+ m_cpu->trigger(1);
+ } else {
+ // No access to data register by CPU
+ LOGMASKED(LOG_LEVEL1, "Data overrun\n");
+ m_overrun = true;
+ }
+ m_accdata = false;
+
+ m_crcerr_syn = m_crc != 0;
+
+ if (!BIT(m_cntl_reg , REG_CNTL_CRCON_BIT)) {
+ // CRC not enabled, keep it in preset state (all ones)
+ preset_crc();
+ }
+
+ attotime sdok_time{machine().time()};
+ LOGMASKED(LOG_LEVEL0, "SDOK @ %.06f\n" , sdok_time.as_double());
+ bool do_crc_upd = true;
+ if (BIT(m_cntl_reg , REG_CNTL_WRITON_BIT)) {
+ // Writing
+ m_pll.commit(get_write_device() , sdok_time);
+ m_pll.ctime = sdok_time;
+
+ // Check for AMDT when in loopback mode
+ if (!m_lckup && !m_amdt && BIT(m_cntl_reg , REG_CNTL_READON_BIT)) {
+ if (m_hiden) {
+ m_amdt = m_data_sr != 0xff;
} else {
- // No access to data register by CPU
- LOG(("Data overrun!\n"));
- m_overrun = true;
+ m_amdt = m_data_sr != 0;
}
- m_accdata = false;
-
- m_crcerr_syn = m_crc != 0;
+ }
- if (!BIT(m_cntl_reg , REG_CNTL_CRCON_BIT)) {
- // CRC not enabled, keep it in preset state (all ones)
- preset_crc();
+ LOGMASKED(LOG_LEVEL0, "WR D=%02x/C=%02x\n" , m_data_sr , m_clock_sr);
+ do_crc_upd = false;
+ for (unsigned i = 0; i < 8; i++) {
+ bool clock_bit;
+ bool data_bit;
+
+ clock_bit = shift_sr(m_clock_sr, false);
+ data_bit = shift_sr(m_data_sr, true);
+
+ if (BIT(m_cntl_reg , REG_CNTL_CRCOUT_BIT)) {
+ // Substitute data bits from DSR with those from CRC when CRCOUT=1
+ data_bit = BIT(m_crc , 15);
+ m_crc <<= 1;
+ } else if (BIT(m_cntl_reg , REG_CNTL_CRCON_BIT)) {
+ // Update CRC
+ update_crc(data_bit);
}
+ write_bit(data_bit, clock_bit);
+ }
+ // When shifting is done DSR is filled with 1s and CSR with 0s
+ }
+ if (BIT(m_cntl_reg , REG_CNTL_READON_BIT)) {
+ // Reading
+ m_pll.ctime = sdok_time;
- attotime sdok_time{machine().time()};
- LOG_0(("SDOK @ %.06f\n" , sdok_time.as_double()));
- bool do_crc_upd = true;
+ for (unsigned i = 0; i < 8; i++) {
+ read_bit(do_crc_upd);
+ }
+ LOGMASKED(LOG_LEVEL0, "RD D=%02x/C=%02x\n" , m_data_sr , m_clock_sr);
+ }
+ LOGMASKED(LOG_LEVEL0, "next SDOK @ %.06f\n" , m_pll.ctime.as_double());
+ m_byte_timer->adjust(m_pll.ctime - sdok_time);
+}
+
+TIMER_CALLBACK_MEMBER(hp9895_device::half_bit_timer_tick)
+{
+ m_pll.ctime = machine().time();
+ if (m_lckup) {
+ // Trying to lock on synchronization bytes
+ attotime edge;
+ attotime tm;
+ get_next_transition(m_pll.ctime, edge);
+ bool half_bit0 = m_pll.feed_read_data(tm , edge , attotime::never);
+ get_next_transition(m_pll.ctime, edge);
+ bool half_bit1 = m_pll.feed_read_data(tm , edge , attotime::never);
+ if (half_bit0 == half_bit1) {
+ // If half bits are equal, no synch
+ LOGMASKED(LOG_LEVEL0, "Reset sync_cnt\n");
+ m_sync_cnt = 0;
+ } else if (++m_sync_cnt >= MIN_SYNC_BITS) {
+ // Synchronized, now wait for AM
+ LOGMASKED(LOG_LEVEL0, "Synchronized @ %.6f\n" , machine().time().as_double());
+ m_lckup = false;
if (BIT(m_cntl_reg , REG_CNTL_WRITON_BIT)) {
- // Writing
- m_pll.commit(get_write_device() , sdok_time);
- m_pll.ctime = sdok_time;
-
- // Check for AMDT when in loopback mode
- if (!m_lckup && !m_amdt && BIT(m_cntl_reg , REG_CNTL_READON_BIT)) {
- if (m_hiden) {
- m_amdt = m_data_sr != 0xff;
- } else {
- m_amdt = m_data_sr != 0;
- }
+ // When loopback is active, leave AM detection to byte timer as
+ // byte boundary is already synchronized
+ m_half_bit_timer->reset();
+ return;
+ } else {
+ // Align with bit cell
+ // Synchronization bits in HP mode: 32x 1s -> C/D bits = 01010101...
+ // Synchronization bits in IBM mode: 32x 0s -> C/D bits = 10101010...
+ if (m_hiden != half_bit1) {
+ // Discard 1/2 bit cell if synchronization achieved in the clock part
+ get_next_transition(m_pll.ctime, edge);
+ m_pll.feed_read_data(tm , edge , attotime::never);
}
-
- LOG_0(("WR D=%02x/C=%02x\n" , m_data_sr , m_clock_sr));
- do_crc_upd = false;
- for (unsigned i = 0; i < 8; i++) {
- bool clock_bit;
- bool data_bit;
-
- clock_bit = shift_sr(m_clock_sr, false);
- data_bit = shift_sr(m_data_sr, true);
-
- if (BIT(m_cntl_reg , REG_CNTL_CRCOUT_BIT)) {
- // Substitute data bits from DSR with those from CRC when CRCOUT=1
- data_bit = BIT(m_crc , 15);
- m_crc <<= 1;
- } else if (BIT(m_cntl_reg , REG_CNTL_CRCON_BIT)) {
- // Update CRC
- update_crc(data_bit);
- }
- write_bit(data_bit, clock_bit);
+ // Load CSR & DSR as they are after synchronization bits
+ if (m_hiden) {
+ m_clock_sr = 0;
+ m_data_sr = ~0;
+ } else {
+ m_clock_sr = ~0;
+ m_data_sr = 0;
}
- // When shifting is done DSR is filled with 1s and CSR with 0s
}
- if (BIT(m_cntl_reg , REG_CNTL_READON_BIT)) {
- // Reading
- m_pll.ctime = sdok_time;
-
- for (unsigned i = 0; i < 8; i++) {
- read_bit(do_crc_upd);
- }
- LOG_0(("RD D=%02x/C=%02x\n" , m_data_sr , m_clock_sr));
- }
- LOG_0(("next SDOK @ %.06f\n" , m_pll.ctime.as_double()));
- timer.adjust(m_pll.ctime - sdok_time);
}
- break;
-
- case HALF_BIT_TMR_ID:
- {
- m_pll.ctime = machine().time();
- if (m_lckup) {
- // Trying to lock on synchronization bytes
- attotime edge;
- attotime tm;
- get_next_transition(m_pll.ctime, edge);
- bool half_bit0 = m_pll.feed_read_data(tm , edge , attotime::never);
- get_next_transition(m_pll.ctime, edge);
- bool half_bit1 = m_pll.feed_read_data(tm , edge , attotime::never);
- if (half_bit0 == half_bit1) {
- // If half bits are equal, no synch
- LOG_0(("Reset sync_cnt\n"));
- m_sync_cnt = 0;
- } else if (++m_sync_cnt >= MIN_SYNC_BITS) {
- // Synchronized, now wait for AM
- LOG_0(("Synchronized @ %.6f\n" , machine().time().as_double()));
- m_lckup = false;
- if (BIT(m_cntl_reg , REG_CNTL_WRITON_BIT)) {
- // When loopback is active, leave AM detection to byte timer as
- // byte boundary is already synchronized
- timer.reset();
- return;
- } else {
- // Align with bit cell
- // Synchronization bits in HP mode: 32x 1s -> C/D bits = 01010101...
- // Synchronization bits in IBM mode: 32x 0s -> C/D bits = 10101010...
- if (m_hiden != half_bit1) {
- // Discard 1/2 bit cell if synchronization achieved in the clock part
- get_next_transition(m_pll.ctime, edge);
- m_pll.feed_read_data(tm , edge , attotime::never);
- }
- // Load CSR & DSR as they are after synchronization bits
- if (m_hiden) {
- m_clock_sr = 0;
- m_data_sr = ~0;
- } else {
- m_clock_sr = ~0;
- m_data_sr = 0;
- }
- }
- }
- } else {
- // Looking for AM
- /// CRC is not updated because it can't be possibly enabled at this point
+ } else {
+ // Looking for AM
+ /// CRC is not updated because it can't be possibly enabled at this point
+ read_bit(false);
+ if ((m_hiden && !BIT(m_data_sr , 7)) ||
+ (!m_hiden && BIT(m_data_sr , 0))) {
+ // Got AM as soon as bits being shifted into DSR change value wrt synchronization bits
+ m_amdt = true;
+ // Finish the current byte
+ for (unsigned i = 0; i < 7; i++) {
read_bit(false);
- if ((m_hiden && !BIT(m_data_sr , 7)) ||
- (!m_hiden && BIT(m_data_sr , 0))) {
- // Got AM as soon as bits being shifted into DSR change value wrt synchronization bits
- m_amdt = true;
- // Finish the current byte
- for (unsigned i = 0; i < 7; i++) {
- read_bit(false);
- }
- attotime adjust{m_pll.ctime - machine().time()};
- LOG_0(("Got AM @ %.6f, ctime=%.6f, adj=%.6f, D=%02x/C=%02x\n" , machine().time().as_double() , m_pll.ctime.as_double() , adjust.as_double() , m_data_sr , m_clock_sr));
- // Disable half-bit timer & enable byte timer
- timer.reset();
- m_byte_timer->adjust(adjust);
- return;
- }
}
- timer.adjust(m_pll.ctime - machine().time());
+ attotime adjust{m_pll.ctime - machine().time()};
+ LOGMASKED(LOG_LEVEL0, "Got AM @ %.6f, ctime=%.6f, adj=%.6f, D=%02x/C=%02x\n" , machine().time().as_double() , m_pll.ctime.as_double() , adjust.as_double() , m_data_sr , m_clock_sr);
+ // Disable half-bit timer & enable byte timer
+ m_half_bit_timer->reset();
+ m_byte_timer->adjust(adjust);
+ return;
}
- break;
-
- default:
- break;
}
+ m_half_bit_timer->adjust(m_pll.ctime - machine().time());
}
void hp9895_device::ieee488_eoi(int state)
@@ -514,7 +498,7 @@ void hp9895_device::z80_m1_w(uint8_t data)
void hp9895_device::data_w(uint8_t data)
{
- LOG_0(("W DATA=%02x\n" , data));
+ LOGMASKED(LOG_LEVEL0, "W DATA=%02x\n" , data);
// CPU stalls until next SDOK
m_cpu->suspend_until_trigger(1 , true);
m_data_sr = data;
@@ -524,13 +508,13 @@ void hp9895_device::data_w(uint8_t data)
void hp9895_device::clock_w(uint8_t data)
{
- LOG_0(("W CLOCK=%02x\n" , data));
+ LOGMASKED(LOG_LEVEL0, "W CLOCK=%02x\n" , data);
m_clock_reg = data;
}
void hp9895_device::reset_w(uint8_t data)
{
- LOG_0(("W RESET=%02x\n" , data));
+ LOGMASKED(LOG_LEVEL0, "W RESET=%02x\n" , data);
if (BIT(data , REG_RESET_TIMEOUT_START_BIT)) {
m_timeout = false;
m_timeout_timer->adjust(attotime::from_msec(TIMEOUT_MSEC));
@@ -543,14 +527,14 @@ void hp9895_device::reset_w(uint8_t data)
void hp9895_device::leds_w(uint8_t data)
{
- LOG(("W LEDS=%02x %c%c%c%c%c\n" , data , BIT(data , 4) ? '.' : '*' , BIT(data , 3) ? '.' : '*' , BIT(data , 2) ? '.' : '*' , BIT(data , 1) ? '.' : '*' , BIT(data , 0) ? '.' : '*'));
+ LOGMASKED(LOG_LEVEL1, "W LEDS=%02x %c%c%c%c%c\n" , data , BIT(data , 4) ? '.' : '*' , BIT(data , 3) ? '.' : '*' , BIT(data , 2) ? '.' : '*' , BIT(data , 1) ? '.' : '*' , BIT(data , 0) ? '.' : '*');
// TODO:
}
void hp9895_device::cntl_w(uint8_t data)
{
if (data != m_cntl_reg) {
- LOG_0(("W CNTL=%02x -> %02x\n" , m_cntl_reg , data));
+ LOGMASKED(LOG_LEVEL0, "W CNTL=%02x -> %02x\n" , m_cntl_reg , data);
uint8_t old_cntl_reg = m_cntl_reg;
m_cntl_reg = data;
@@ -563,11 +547,11 @@ void hp9895_device::cntl_w(uint8_t data)
bool byte_timer_needed = new_writon || (new_readon && m_amdt);
if (!byte_timer_running && byte_timer_needed) {
- LOG_0(("Enable byte tmr\n"));
+ LOGMASKED(LOG_LEVEL0, "Enable byte tmr\n");
attotime byte_period = get_half_bit_cell_period() * 16;
m_byte_timer->adjust(byte_period);
} else if (byte_timer_running && !byte_timer_needed) {
- LOG_0(("Disable byte tmr\n"));
+ LOGMASKED(LOG_LEVEL0, "Disable byte tmr\n");
m_byte_timer->reset();
}
@@ -577,24 +561,24 @@ void hp9895_device::cntl_w(uint8_t data)
if (!old_writon && new_writon) {
// Writing enabled
- LOG_0(("Start writing..\n"));
+ LOGMASKED(LOG_LEVEL0, "Start writing\n");
m_pll.start_writing(machine().time());
m_wr_context = 0;
m_had_transition = false;
} else if (old_writon && !new_writon) {
// Writing disabled
- LOG_0(("Stop writing..\n"));
+ LOGMASKED(LOG_LEVEL0, "Stop writing\n");
m_pll.stop_writing(get_write_device() , machine().time());
}
if (!old_readon && new_readon) {
// Reading enabled
- LOG_0(("Start reading..\n"));
+ LOGMASKED(LOG_LEVEL0, "Start reading\n");
m_pll.read_reset(machine().time());
m_sync_cnt = 0;
m_half_bit_timer->adjust(get_half_bit_cell_period());
} else if (old_readon && !new_readon) {
// Reading disabled
- LOG_0(("Stop reading..\n"));
+ LOGMASKED(LOG_LEVEL0, "Stop reading\n");
m_half_bit_timer->reset();
m_lckup = true;
m_amdt = false;
@@ -610,7 +594,7 @@ void hp9895_device::cntl_w(uint8_t data)
void hp9895_device::drv_w(uint8_t data)
{
- LOG_0(("W DRV=%02x\n" , data));
+ LOGMASKED(LOG_LEVEL0, "W DRV=%02x\n" , data);
m_mgnena = BIT(data , REG_DRV_MGNENA_BIT);
if (m_current_drive != nullptr) {
m_current_drive->stp_w(!BIT(data , REG_DRV_STEP_BIT));
@@ -622,11 +606,11 @@ void hp9895_device::drv_w(uint8_t data)
void hp9895_device::xv_w(uint8_t data)
{
- LOG_0(("W XV=%02x\n" , data));
+ LOGMASKED(LOG_LEVEL0, "W XV=%02x\n" , data);
// Disk Changed flag is cleared when drive is ready and it is deselected
if (m_current_drive_idx < 2 && (data & xv_drive_masks[ m_current_drive_idx ]) == 0 && !m_current_drive->ready_r()) {
if (m_dskchg[ m_current_drive_idx ]) {
- LOG(("Dskchg %u cleared\n" , m_current_drive_idx));
+ LOGMASKED(LOG_LEVEL1, "Dskchg %u cleared\n" , m_current_drive_idx);
}
m_dskchg[ m_current_drive_idx ] = false;
}
@@ -648,7 +632,7 @@ uint8_t hp9895_device::data_r()
{
m_clock_reg = m_clock_sr;
m_accdata = true;
- LOG_0(("R DATA=%02x\n" , m_data_sr));
+ LOGMASKED(LOG_LEVEL0, "R DATA=%02x\n" , m_data_sr);
// CPU stalls until next SDOK
m_cpu->suspend_until_trigger(1 , true);
return m_data_sr;
@@ -689,7 +673,7 @@ uint8_t hp9895_device::drivstat_r()
if (m_overrun) {
BIT_SET(res , REG_DRIVSTAT_OVERUN_BIT);
}
- LOG_0(("R DRIVSTAT=%02x\n" , res));
+ LOGMASKED(LOG_LEVEL0, "R DRIVSTAT=%02x\n" , res);
return res;
}
@@ -711,7 +695,7 @@ void hp9895_device::floppy_ready_cb(floppy_image_device *floppy , int state)
// Set Disk Changed flag when a drive is not ready
for (unsigned i = 0; i < 2; i++) {
if (floppy == m_drives[ i ]->get_device()) {
- LOG(("Dskchg %u set\n" , i));
+ LOGMASKED(LOG_LEVEL1, "Dskchg %u set\n" , i);
m_dskchg[ i ] = true;
break;
}
diff --git a/src/devices/bus/ieee488/hp9895.h b/src/devices/bus/ieee488/hp9895.h
index 69d939940d2..1cb77d60090 100644
--- a/src/devices/bus/ieee488/hp9895.h
+++ b/src/devices/bus/ieee488/hp9895.h
@@ -29,7 +29,6 @@ public:
protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device-level overrides
virtual ioport_constructor device_input_ports() const override;
@@ -87,6 +86,20 @@ private:
// Floppy drive interface
void floppy_ready_cb(floppy_image_device *floppy , int state);
+ TIMER_CALLBACK_MEMBER(timeout_timer_tick);
+ TIMER_CALLBACK_MEMBER(byte_timer_tick);
+ TIMER_CALLBACK_MEMBER(half_bit_timer_tick);
+
+ uint8_t get_switches2(void) const;
+ attotime get_half_bit_cell_period(void) const;
+ floppy_image_device *get_write_device(void) const;
+ void preset_crc(void);
+ void update_crc(bool bit);
+ bool shift_sr(uint8_t& sr , bool input_bit);
+ void get_next_transition(const attotime& from_when , attotime& edge);
+ void read_bit(bool crc_upd);
+ void write_bit(bool data_bit , bool clock_bit);
+
void z80_io_map(address_map &map);
void z80_program_map(address_map &map);
@@ -123,16 +136,6 @@ private:
// PLL
fdc_pll_t m_pll;
-
- uint8_t get_switches2(void) const;
- attotime get_half_bit_cell_period(void) const;
- floppy_image_device *get_write_device(void) const;
- void preset_crc(void);
- void update_crc(bool bit);
- bool shift_sr(uint8_t& sr , bool input_bit);
- void get_next_transition(const attotime& from_when , attotime& edge);
- void read_bit(bool crc_upd);
- void write_bit(bool data_bit , bool clock_bit);
};
// device type definition
diff --git a/src/devices/bus/ieee488/remote488.cpp b/src/devices/bus/ieee488/remote488.cpp
index 4feaf3c0647..d559622dad6 100644
--- a/src/devices/bus/ieee488/remote488.cpp
+++ b/src/devices/bus/ieee488/remote488.cpp
@@ -188,11 +188,12 @@
#include "remote488.h"
// Debugging
-#include "logmacro.h"
-#define LOG_PARSER_MASK (LOG_GENERAL << 1)
+#define LOG_PARSER_MASK (1U << 1)
#define LOG_PARSER(...) LOGMASKED(LOG_PARSER_MASK, __VA_ARGS__)
-#undef VERBOSE
-#define VERBOSE LOG_GENERAL
+
+#define VERBOSE (LOG_GENERAL)
+
+#include "logmacro.h"
// Bit manipulation
namespace {
@@ -222,16 +223,16 @@ namespace {
}
// Message types
-constexpr char MSG_SIGNAL_CLEAR = 'R'; // I/O: Clear signal(s)
-constexpr char MSG_SIGNAL_SET = 'S'; // I/O: Set signal(s)
-constexpr char MSG_DATA_BYTE = 'D'; // I/O: Cmd/data byte (no EOI)
-constexpr char MSG_END_BYTE = 'E'; // I/O: Data byte (with EOI)
-constexpr char MSG_PP_DATA = 'P'; // I: Parallel poll data
-constexpr char MSG_PP_REQUEST = 'Q'; // O: Request PP data
-constexpr char MSG_ECHO_REQ = 'J'; // O: Heartbeat msg: echo request
-constexpr char MSG_ECHO_REPLY = 'K'; // I: Heartbeat msg: echo reply
-constexpr char MSG_CHECKPOINT = 'X'; // I/O: Checkpoint in byte stream
-constexpr char MSG_CP_REACHED = 'Y'; // I/O: Checkpoint reached
+constexpr char MSG_SIGNAL_CLEAR = 'R'; // I/O: Clear signal(s)
+constexpr char MSG_SIGNAL_SET = 'S'; // I/O: Set signal(s)
+constexpr char MSG_DATA_BYTE = 'D'; // I/O: Cmd/data byte (no EOI)
+constexpr char MSG_END_BYTE = 'E'; // I/O: Data byte (with EOI)
+constexpr char MSG_PP_DATA = 'P'; // I: Parallel poll data
+constexpr char MSG_PP_REQUEST = 'Q'; // O: Request PP data
+constexpr char MSG_ECHO_REQ = 'J'; // O: Heartbeat msg: echo request
+constexpr char MSG_ECHO_REPLY = 'K'; // I: Heartbeat msg: echo reply
+constexpr char MSG_CHECKPOINT = 'X'; // I/O: Checkpoint in byte stream
+constexpr char MSG_CHECKPOINT_REACHED = 'Y'; // I/O: Checkpoint reached
// Timings
constexpr unsigned POLL_PERIOD_US = 20; // Poll period (µs)
@@ -304,9 +305,9 @@ void remote488_device::ieee488_ren(int state)
void remote488_device::device_start()
{
- m_poll_timer = timer_alloc(TMR_ID_POLL);
- m_hb_timer = timer_alloc(TMR_ID_HEARTBEAT);
- m_ah_timer = timer_alloc(TMR_ID_AH);
+ m_poll_timer = timer_alloc(FUNC(remote488_device::process_input_msgs), this);
+ m_hb_timer = timer_alloc(FUNC(remote488_device::heartbeat_tick), this);
+ m_ah_timer = timer_alloc(FUNC(remote488_device::checkpoint_timeout_tick), this);
}
void remote488_device::device_reset()
@@ -327,7 +328,7 @@ void remote488_device::device_reset()
m_ibf = false;
m_flush_bytes = false;
- m_waiting_cp = false;
+ m_waiting_checkpoint = false;
bus_reset();
}
@@ -344,7 +345,7 @@ void remote488_device::bus_reset()
update_pp();
}
-void remote488_device::process_input_msgs()
+TIMER_CALLBACK_MEMBER(remote488_device::process_input_msgs)
{
uint8_t data;
char msg_ch;
@@ -383,13 +384,13 @@ void remote488_device::process_input_msgs()
break;
case MSG_CHECKPOINT:
- send_update(MSG_CP_REACHED , m_flush_bytes);
+ send_update(MSG_CHECKPOINT_REACHED , m_flush_bytes);
m_flush_bytes = false;
break;
- case MSG_CP_REACHED:
- if (m_waiting_cp) {
- m_waiting_cp = false;
+ case MSG_CHECKPOINT_REACHED:
+ if (m_waiting_checkpoint) {
+ m_waiting_checkpoint = false;
update_ah_fsm();
}
break;
@@ -403,29 +404,19 @@ void remote488_device::process_input_msgs()
}
}
-void remote488_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(remote488_device::heartbeat_tick)
{
- switch (id) {
- case TMR_ID_POLL:
- process_input_msgs();
- break;
-
- case TMR_ID_HEARTBEAT:
- if (m_connected && m_connect_cnt && --m_connect_cnt == 0) {
- set_connection(false);
- }
- send_update(MSG_ECHO_REQ , 0);
- break;
-
- case TMR_ID_AH:
- if (!m_waiting_cp) {
- LOG("CP T/O\n");
- ah_checkpoint();
- }
- break;
+ if (m_connected && m_connect_cnt && --m_connect_cnt == 0) {
+ set_connection(false);
+ }
+ send_update(MSG_ECHO_REQ , 0);
+}
- default:
- break;
+TIMER_CALLBACK_MEMBER(remote488_device::checkpoint_timeout_tick)
+{
+ if (!m_waiting_checkpoint) {
+ LOG("Checkpoint T/O\n");
+ ah_checkpoint();
}
}
@@ -570,7 +561,7 @@ bool remote488_device::is_msg_type(char c)
c == MSG_PP_DATA ||
c == MSG_ECHO_REPLY ||
c == MSG_CHECKPOINT ||
- c == MSG_CP_REACHED;
+ c == MSG_CHECKPOINT_REACHED;
}
bool remote488_device::is_terminator(char c)
@@ -668,7 +659,7 @@ bool remote488_device::is_local_atn_active() const
void remote488_device::ah_checkpoint()
{
- m_waiting_cp = true;
+ m_waiting_checkpoint = true;
m_ah_timer->reset();
send_update(MSG_CHECKPOINT , 0);
}
@@ -698,7 +689,7 @@ void remote488_device::update_ah_fsm()
case REM_AH_ACDS:
if (m_bus->dav_r()) {
m_ah_state = REM_AH_ACRS;
- } else if (!m_waiting_cp) {
+ } else if (!m_waiting_checkpoint) {
uint8_t dio = ~m_bus->dio_r();
if (!m_bus->eoi_r()) {
diff --git a/src/devices/bus/ieee488/remote488.h b/src/devices/bus/ieee488/remote488.h
index 9832c7d1d76..bcb64866a05 100644
--- a/src/devices/bus/ieee488/remote488.h
+++ b/src/devices/bus/ieee488/remote488.h
@@ -31,18 +31,10 @@ public:
virtual void ieee488_atn(int state) override;
virtual void ieee488_ren(int state) override;
- // Timers
- enum {
- TMR_ID_POLL,
- TMR_ID_HEARTBEAT,
- TMR_ID_AH
- };
-
protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_add_mconfig(machine_config &config) override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
private:
// Position of signals in "S/R" msgs
@@ -101,10 +93,14 @@ private:
bool m_pp_requested;
uint8_t m_pp_dio;
uint8_t m_sh_dio;
- bool m_waiting_cp;
+ bool m_waiting_checkpoint;
+
+
+ TIMER_CALLBACK_MEMBER(process_input_msgs);
+ TIMER_CALLBACK_MEMBER(heartbeat_tick);
+ TIMER_CALLBACK_MEMBER(checkpoint_timeout_tick);
void bus_reset();
- void process_input_msgs();
void set_connection(bool state);
void recvd_data_byte(uint8_t data , bool eoi);
void flush_data();
diff --git a/src/devices/bus/intellec4/tapereader.cpp b/src/devices/bus/intellec4/tapereader.cpp
index 1606c4e3e21..aa1acd9e963 100644
--- a/src/devices/bus/intellec4/tapereader.cpp
+++ b/src/devices/bus/intellec4/tapereader.cpp
@@ -85,7 +85,7 @@ void imm4_90_device::call_unload()
void imm4_90_device::device_start()
{
- m_step_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(imm4_90_device::step), this));
+ m_step_timer = timer_alloc(FUNC(imm4_90_device::step), this);
save_item(NAME(m_data));
save_item(NAME(m_ready));
diff --git a/src/devices/bus/interpro/keyboard/hle.cpp b/src/devices/bus/interpro/keyboard/hle.cpp
index 66be76a22ec..8d773a9fa85 100644
--- a/src/devices/bus/interpro/keyboard/hle.cpp
+++ b/src/devices/bus/interpro/keyboard/hle.cpp
@@ -285,7 +285,7 @@ void hle_device_base::device_add_mconfig(machine_config &config)
void hle_device_base::device_start()
{
- m_click_timer = timer_alloc(CLICK_TIMER_ID);
+ m_click_timer = timer_alloc(FUNC(hle_device_base::click_tick), this);
save_item(NAME(m_make_count));
save_item(NAME(m_rx_state));
@@ -316,18 +316,10 @@ void hle_device_base::device_reset()
start_processing(attotime::from_hz(1'200));
}
-void hle_device_base::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(hle_device_base::click_tick)
{
- switch (id)
- {
- case CLICK_TIMER_ID:
- m_beeper_state &= ~u8(BEEPER_CLICK);
- m_beeper->set_state(m_beeper_state ? 1 : 0);
- break;
-
- default:
- break;
- }
+ m_beeper_state &= ~u8(BEEPER_CLICK);
+ m_beeper->set_state(m_beeper_state ? 1 : 0);
}
void hle_device_base::tra_callback()
diff --git a/src/devices/bus/interpro/keyboard/hle.h b/src/devices/bus/interpro/keyboard/hle.h
index 5cacaf80d86..607b7b42087 100644
--- a/src/devices/bus/interpro/keyboard/hle.h
+++ b/src/devices/bus/interpro/keyboard/hle.h
@@ -31,7 +31,6 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_buffered_serial_interface overrides
virtual void tra_callback() override;
@@ -87,6 +86,8 @@ private:
COMMAND_LAYOUT = 0x0fU
};
+ TIMER_CALLBACK_MEMBER(click_tick);
+
// device_buffered_serial_interface overrides
virtual void received_byte(u8 byte) override;
diff --git a/src/devices/bus/interpro/sr/gt.cpp b/src/devices/bus/interpro/sr/gt.cpp
index 4005aca569f..15158ede040 100644
--- a/src/devices/bus/interpro/sr/gt.cpp
+++ b/src/devices/bus/interpro/sr/gt.cpp
@@ -616,9 +616,9 @@ void gt_device_base::device_start()
save_item(NAME(m_control));
// allocate timers
- m_blit_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gt_device_base::blit), this));
- m_line_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gt_device_base::line), this));
- m_done_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gt_device_base::done), this));
+ m_blit_timer = timer_alloc(FUNC(gt_device_base::blit), this);
+ m_line_timer = timer_alloc(FUNC(gt_device_base::line), this);
+ m_done_timer = timer_alloc(FUNC(gt_device_base::done), this);
}
void gt_device_base::control_w(offs_t offset, u32 data, u32 mem_mask)
diff --git a/src/devices/bus/iq151/staper.cpp b/src/devices/bus/iq151/staper.cpp
index 1381bc63d24..63a365282d0 100644
--- a/src/devices/bus/iq151/staper.cpp
+++ b/src/devices/bus/iq151/staper.cpp
@@ -52,8 +52,15 @@ iq151_staper_device::iq151_staper_device(const machine_config &mconfig, const ch
void iq151_staper_device::device_start()
{
- m_printer_timer = timer_alloc(TIMER_PRINTER);
- m_printer_timer->reset();
+ m_printer_timer = timer_alloc(FUNC(iq151_staper_device::pc2_low_tick), this);
+}
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void iq151_staper_device::device_reset()
+{
}
//-------------------------------------------------
@@ -71,13 +78,12 @@ void iq151_staper_device::device_add_mconfig(machine_config &config)
}
//-------------------------------------------------
-// device_timer - handler timer events
+// pc2_low_tick - lower PPI Port C bit 2
//-------------------------------------------------
-void iq151_staper_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(iq151_staper_device::pc2_low_tick)
{
- if (id == TIMER_PRINTER)
- m_ppi->pc2_w(0);
+ m_ppi->pc2_w(0);
}
diff --git a/src/devices/bus/iq151/staper.h b/src/devices/bus/iq151/staper.h
index 83095ee2d48..98aefb609d1 100644
--- a/src/devices/bus/iq151/staper.h
+++ b/src/devices/bus/iq151/staper.h
@@ -26,7 +26,7 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ virtual void device_reset() override;
// optional information overrides
virtual void device_add_mconfig(machine_config &config) override;
@@ -41,7 +41,7 @@ private:
void ppi_portb_w(uint8_t data);
void ppi_portc_w(uint8_t data);
- static const device_timer_id TIMER_PRINTER = 0;
+ TIMER_CALLBACK_MEMBER(pc2_low_tick);
required_device<i8255_device> m_ppi;
required_device<printer_image_device> m_printer;
diff --git a/src/devices/bus/isa/gus.cpp b/src/devices/bus/isa/gus.cpp
index b1af6dc12c6..7884ac37c8d 100644
--- a/src/devices/bus/isa/gus.cpp
+++ b/src/devices/bus/isa/gus.cpp
@@ -140,7 +140,7 @@ void gf1_device::adlib_w(offs_t offset, uint8_t data)
}
}
-void gf1_device::update_volume_ramps()
+TIMER_CALLBACK_MEMBER(gf1_device::update_volume_ramps)
{
int x;
@@ -207,45 +207,41 @@ void gf1_device::update_volume_ramps()
}
}
-void gf1_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(gf1_device::adlib_timer1_tick)
{
- switch(id)
+ if(m_adlib_timer1_enable != 0)
{
- case ADLIB_TIMER1:
- if(m_adlib_timer1_enable != 0)
+ if(m_timer1_count == 0xff)
{
- if(m_timer1_count == 0xff)
- {
- m_adlib_status |= 0xc0;
- m_timer1_count = m_timer1_value;
- if(m_timer_ctrl & 0x04)
- m_timer1_irq_handler(1);
- }
- m_timer1_count++;
+ m_adlib_status |= 0xc0;
+ m_timer1_count = m_timer1_value;
+ if(m_timer_ctrl & 0x04)
+ m_timer1_irq_handler(1);
}
- break;
- case ADLIB_TIMER2:
- if(m_adlib_timer2_enable != 0)
+ m_timer1_count++;
+ }
+}
+
+TIMER_CALLBACK_MEMBER(gf1_device::adlib_timer2_tick)
+{
+ if(m_adlib_timer2_enable != 0)
+ {
+ if(m_timer2_count == 0xff)
{
- if(m_timer2_count == 0xff)
- {
- m_adlib_status |= 0xa0;
- m_timer2_count = m_timer2_value;
- if(m_timer_ctrl & 0x08)
- m_timer2_irq_handler(1);
- }
- m_timer2_count++;
+ m_adlib_status |= 0xa0;
+ m_timer2_count = m_timer2_value;
+ if(m_timer_ctrl & 0x08)
+ m_timer2_irq_handler(1);
}
- break;
- case DMA_TIMER:
- m_drq1_handler(1);
- break;
- case VOL_RAMP_TIMER:
- update_volume_ramps();
- break;
+ m_timer2_count++;
}
}
+TIMER_CALLBACK_MEMBER(gf1_device::dma_tick)
+{
+ m_drq1_handler(1);
+}
+
void gf1_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
int x;
@@ -406,10 +402,10 @@ void gf1_device::device_start()
m_stream = stream_alloc(0,2,clock() / (14 * 16));
// init timers
- m_timer1 = timer_alloc(ADLIB_TIMER1);
- m_timer2 = timer_alloc(ADLIB_TIMER2);
- m_dmatimer = timer_alloc(DMA_TIMER);
- m_voltimer = timer_alloc(VOL_RAMP_TIMER);
+ m_timer1 = timer_alloc(FUNC(gf1_device::adlib_timer1_tick), this);
+ m_timer2 = timer_alloc(FUNC(gf1_device::adlib_timer2_tick), this);
+ m_dmatimer = timer_alloc(FUNC(gf1_device::dma_tick), this);
+ m_voltimer = timer_alloc(FUNC(gf1_device::update_volume_ramps), this);
save_item(NAME(m_wave_ram));
diff --git a/src/devices/bus/isa/gus.h b/src/devices/bus/isa/gus.h
index 3e555dfa125..c39695997da 100644
--- a/src/devices/bus/isa/gus.h
+++ b/src/devices/bus/isa/gus.h
@@ -121,11 +121,18 @@ public:
void dack_w(int line,uint8_t data);
void eop_w(int state);
- // optional information overrides
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ // device_sound_interface overrides
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
protected:
+ // device-level overrides
+ virtual void device_start() override;
+ virtual void device_reset() override;
+ virtual void device_stop() override;
+ virtual void device_clock_changed() override;
+
+ virtual void update_irq() override;
+
// voice-specific registers
gus_voice m_voice[32];
@@ -147,18 +154,13 @@ protected:
void set_irq(uint8_t source, uint8_t voice);
void reset_irq(uint8_t source);
- void update_volume_ramps();
-
- std::vector<uint8_t> m_wave_ram;
-
- // device-level overrides
- virtual void device_start() override;
- virtual void device_reset() override;
- virtual void device_stop() override;
- virtual void device_clock_changed() override;
- virtual void update_irq() override;
+ TIMER_CALLBACK_MEMBER(adlib_timer1_tick);
+ TIMER_CALLBACK_MEMBER(adlib_timer2_tick);
+ TIMER_CALLBACK_MEMBER(dma_tick);
+ TIMER_CALLBACK_MEMBER(update_volume_ramps);
+ std::vector<uint8_t> m_wave_ram;
private:
// internal state
sound_stream* m_stream;
@@ -199,11 +201,6 @@ private:
uint32_t m_dma_current;
uint16_t m_volume_table[4096];
- static const device_timer_id ADLIB_TIMER1 = 0;
- static const device_timer_id ADLIB_TIMER2 = 1;
- static const device_timer_id DMA_TIMER = 2;
- static const device_timer_id VOL_RAMP_TIMER = 3;
-
int m_txirq;
int m_rxirq;
diff --git a/src/devices/bus/isa/hdc.cpp b/src/devices/bus/isa/hdc.cpp
index d508b428b12..74d2a23d11b 100644
--- a/src/devices/bus/isa/hdc.cpp
+++ b/src/devices/bus/isa/hdc.cpp
@@ -9,9 +9,12 @@
#include "emu.h"
#include "hdc.h"
-#define LOG_HDC_STATUS 0
-#define LOG_HDC_CALL 0
-#define LOG_HDC_DATA 0
+#define LOG_HDC_STATUS (1U << 1)
+#define LOG_HDC_CALL (1U << 2)
+#define LOG_HDC_DATA (1U << 3)
+
+#define VERBOSE (0)
+#include "logmacro.h"
#define CMD_TESTREADY 0x00
#define CMD_RECALIBRATE 0x01
@@ -52,7 +55,7 @@
#define CTL_PIO 0x00
#define CTL_DMA 0x01
-static const char *const hdc_command_names[] =
+const char *const s_hdc_command_names[] =
{
"CMD_TESTREADY", /* 0x00 */
"CMD_RECALIBRATE", /* 0x01 */
@@ -153,9 +156,23 @@ xt_hdc_device::xt_hdc_device(const machine_config &mconfig, const char *tag, dev
xt_hdc_device::xt_hdc_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, type, tag, owner, clock),
- buffer_ptr(nullptr), csb(0), status(0), error(0), m_type(0), m_current_cmd(0),
+ m_buffer_ptr(nullptr),
+ m_csb(0),
+ m_status(0),
+ m_error(0),
+ m_type(0),
+ m_current_cmd(0),
m_irq_handler(*this),
- m_drq_handler(*this), drv(0), timer(nullptr), data_cnt(0), hdc_control(0), hdcdma_src(nullptr), hdcdma_dst(nullptr), hdcdma_read(0), hdcdma_write(0), hdcdma_size(0)
+ m_drq_handler(*this),
+ m_drv(0),
+ m_timer(nullptr),
+ m_data_cnt(0),
+ m_hdc_control(0),
+ m_hdcdma_src(nullptr),
+ m_hdcdma_dst(nullptr),
+ m_hdcdma_read(0),
+ m_hdcdma_write(0),
+ m_hdcdma_size(0)
{
}
@@ -177,43 +194,43 @@ st11m_device::st11m_device(const machine_config &mconfig, const char *tag, devic
void xt_hdc_device::device_start()
{
- buffer.resize(256*512); // maximum possible transfer
- timer = timer_alloc();
+ m_buffer = std::make_unique<uint8_t[]>(256*512); // maximum possible transfer
+ m_timer = timer_alloc(FUNC(xt_hdc_device::process_command), this);
m_irq_handler.resolve_safe();
m_drq_handler.resolve_safe();
}
void xt_hdc_device::device_reset()
{
- drv = 0;
- data_cnt = 0;
- buffer_ptr = nullptr;
- hdc_control = 0;
+ m_drv = 0;
+ m_data_cnt = 0;
+ m_buffer_ptr = nullptr;
+ m_hdc_control = 0;
for (int i = 0; i < 2; i++)
{
- cylinders[i] = 612;
- rwc[i] = 613;
- wp[i] = 613;
- heads[i] = 4;
- ecc[i] = 11;
+ m_cylinders[i] = 612;
+ m_rwc[i] = 613;
+ m_wp[i] = 613;
+ m_heads[i] = 4;
+ m_ecc[i] = 11;
/* indexes */
- cylinder[i] = 0;
- head[i] = 0;
- sector[i] = 0;
- sector_cnt[i] = 0;
- control[i] = 0;
+ m_cylinder[i] = 0;
+ m_head[i] = 0;
+ m_sector[i] = 0;
+ m_sector_cnt[i] = 0;
+ m_control[i] = 0;
}
- csb = 0;
- status = 0;
- error = 0;
+ m_csb = 0;
+ m_status = 0;
+ m_error = 0;
}
hard_disk_file *xt_hdc_device::pc_hdc_file(int id)
{
harddisk_image_device *img = nullptr;
- switch( id )
+ switch (id)
{
case 0:
img = subdevice<harddisk_image_device>("primary");
@@ -222,7 +239,7 @@ hard_disk_file *xt_hdc_device::pc_hdc_file(int id)
img = subdevice<harddisk_image_device>("slave");
break;
}
- if ( img == nullptr )
+ if (img == nullptr)
return nullptr;
if (!img->exists())
@@ -231,64 +248,57 @@ hard_disk_file *xt_hdc_device::pc_hdc_file(int id)
return img->get_hard_disk_file();
}
-void xt_hdc_device::pc_hdc_result(int set_error_info)
+void xt_hdc_device::pc_hdc_result(bool set_error_info)
{
- if ( ( hdc_control & 0x02 ))
+ if (m_hdc_control & 0x02)
{
// dip switch selected IRQ 5 or 2
m_irq_handler(1);
}
- if (LOG_HDC_STATUS)
- logerror("pc_hdc_result(): $%02x to $%04x\n", csb, data_cnt);
+ LOGMASKED(LOG_HDC_STATUS, "pc_hdc_result(): $%02x to $%04x\n", m_csb, m_data_cnt);
- buffer[data_cnt++] = csb;
+ m_buffer[m_data_cnt++] = m_csb;
- if (set_error_info && ( csb & CSB_ERROR ) )
+ if (set_error_info && (m_csb & CSB_ERROR))
{
- buffer[data_cnt++] = error;
- if (error & 0x80)
+ m_buffer[m_data_cnt++] = m_error;
+ if (m_error & 0x80)
{
- buffer[data_cnt++] = (drv << 5) | head[drv];
- buffer[data_cnt++] = ((cylinder[drv] >> 2) & 0xc0) | sector[drv];
- buffer[data_cnt++] = cylinder[drv] & 0xff;
+ m_buffer[m_data_cnt++] = (m_drv << 5) | m_head[m_drv];
+ m_buffer[m_data_cnt++] = ((m_cylinder[m_drv] >> 2) & 0xc0) | m_sector[m_drv];
+ m_buffer[m_data_cnt++] = m_cylinder[m_drv] & 0xff;
- if (LOG_HDC_STATUS)
- {
- logerror("pc_hdc_result(): result [%02x %02x %02x %02x]\n",
- buffer[data_cnt-4], buffer[data_cnt-3], buffer[data_cnt-2], buffer[data_cnt-1]);
- }
+ LOGMASKED(LOG_HDC_STATUS, "pc_hdc_result(): result [%02x %02x %02x %02x]\n",
+ m_buffer[m_data_cnt - 4], m_buffer[m_data_cnt - 3], m_buffer[m_data_cnt - 2], m_buffer[m_data_cnt - 1]);
}
else
{
- if (LOG_HDC_STATUS)
- logerror("pc_hdc_result(): result [%02x]\n", buffer[data_cnt-1]);
+ LOGMASKED(LOG_HDC_STATUS, "pc_hdc_result(): result [%02x]\n", m_buffer[m_data_cnt - 1]);
}
}
- status |= STA_INTERRUPT | STA_INPUT | STA_REQUEST | STA_COMMAND | STA_READY;
+ m_status |= STA_INTERRUPT | STA_INPUT | STA_REQUEST | STA_COMMAND | STA_READY;
}
-int xt_hdc_device::no_dma(void)
+bool xt_hdc_device::no_dma()
{
- return (hdc_control & CTL_DMA) == 0;
+ return (m_hdc_control & CTL_DMA) == 0;
}
int xt_hdc_device::get_lbasector()
{
- int lbasector;
-
- hard_disk_file *file = pc_hdc_file(drv);
+ hard_disk_file *file = pc_hdc_file(m_drv);
const auto &info = file->get_info();
- lbasector = cylinder[drv];
+ int lbasector = m_cylinder[m_drv];
lbasector *= info.heads;
- lbasector += head[drv];
+ lbasector += m_head[m_drv];
lbasector *= info.sectors;
- lbasector += sector[drv];
+ lbasector += m_sector[m_drv];
return lbasector;
}
@@ -304,42 +314,43 @@ int xt_hdc_device::get_lbasector()
int xt_hdc_device::dack_r()
{
- uint8_t result;
-
- hard_disk_file *file = pc_hdc_file(drv);
+ hard_disk_file *file = pc_hdc_file(m_drv);
if (!file)
return 0;
const auto &info = file->get_info();
- if (hdcdma_read == 0)
+ if (m_hdcdma_read == 0)
{
- file->read(get_lbasector(), hdcdma_data);
- hdcdma_read = 512;
- hdcdma_size -= 512;
- hdcdma_src = hdcdma_data;
- sector[drv]++;
+ file->read(get_lbasector(), m_hdcdma_data);
+ m_hdcdma_read = 512;
+ m_hdcdma_size -= 512;
+ m_hdcdma_src = m_hdcdma_data;
+ m_sector[m_drv]++;
}
- result = *(hdcdma_src++);
+ uint8_t result = *(m_hdcdma_src++);
- if( --hdcdma_read == 0 )
+ if (--m_hdcdma_read == 0)
{
/* end of cylinder ? */
- if (sector[drv] >= info.sectors)
+ if (m_sector[m_drv] >= info.sectors)
{
- sector[drv] = 0;
- if (++head[drv] >= info.heads) /* beyond heads? */
+ m_sector[m_drv] = 0;
+ if (++m_head[m_drv] >= info.heads) /* beyond heads? */
{
- head[drv] = 0; /* reset head */
- cylinder[drv]++; /* next cylinder */
+ m_head[m_drv] = 0; /* reset head */
+ m_cylinder[m_drv]++; /* next cylinder */
}
}
}
if (!no_dma())
{
- m_drq_handler((hdcdma_read || hdcdma_size ) ? 1 : 0);
- if(!(hdcdma_read || hdcdma_size)) pc_hdc_result(0);
+ m_drq_handler((m_hdcdma_read || m_hdcdma_size) ? 1 : 0);
+ if (!(m_hdcdma_read || m_hdcdma_size))
+ {
+ pc_hdc_result(false);
+ }
}
return result;
@@ -347,64 +358,68 @@ int xt_hdc_device::dack_r()
int xt_hdc_device::dack_rs()
{
- uint8_t result;
+ logerror("%s dack_rs(%d %d)\n", machine().describe_context(), m_hdcdma_read, m_hdcdma_size);
- logerror("%s dack_rs(%d %d)\n", machine().describe_context(), hdcdma_read, hdcdma_size);
-
- if (hdcdma_read == 0)
+ if (m_hdcdma_read == 0)
{
- hdcdma_read = 512;
- hdcdma_size -= 512;
- hdcdma_src = hdcdma_data;
+ m_hdcdma_read = 512;
+ m_hdcdma_size -= 512;
+ m_hdcdma_src = m_hdcdma_data;
}
- result = *(hdcdma_src++);
+ uint8_t m_result = *(m_hdcdma_src++);
- hdcdma_read--;
+ m_hdcdma_read--;
if (!no_dma())
{
- m_drq_handler((hdcdma_read) ? 1 : 0);
- if(!(hdcdma_read)) pc_hdc_result(0);
+ m_drq_handler(m_hdcdma_read ? 1 : 0);
+ if (!m_hdcdma_read)
+ {
+ pc_hdc_result(false);
+ }
}
- return result;
+ return m_result;
}
void xt_hdc_device::dack_w(int data)
{
- hard_disk_file *file = pc_hdc_file(drv);
+ hard_disk_file *file = pc_hdc_file(m_drv);
if (!file)
return;
const auto &info = file->get_info();
- *(hdcdma_dst++) = data;
+ *(m_hdcdma_dst++) = data;
- if( --hdcdma_write == 0 )
+ if (--m_hdcdma_write == 0)
{
- file->write(get_lbasector(), hdcdma_data);
- hdcdma_write = 512;
- hdcdma_size -= 512;
+ file->write(get_lbasector(), m_hdcdma_data);
+ m_hdcdma_write = 512;
+ m_hdcdma_size -= 512;
/* end of cylinder ? */
- if( ++sector[drv] >= info.sectors )
+ if (++m_sector[m_drv] >= info.sectors)
{
- sector[drv] = 0;
- if (++head[drv] >= info.heads) /* beyond heads? */
+ m_sector[m_drv] = 0;
+ if (++m_head[m_drv] >= info.heads) /* beyond heads? */
{
- head[drv] = 0; /* reset head */
- cylinder[drv]++; /* next cylinder */
+ m_head[m_drv] = 0; /* reset head */
+ m_cylinder[m_drv]++; /* next cylinder */
}
}
- hdcdma_dst = hdcdma_data;
+ m_hdcdma_dst = m_hdcdma_data;
}
if (!no_dma())
{
- m_drq_handler(hdcdma_size ? 1 : 0);
- if(!hdcdma_size) pc_hdc_result(1);
+ m_drq_handler(m_hdcdma_size ? 1 : 0);
+ if (!m_hdcdma_size)
+ {
+ pc_hdc_result(true);
+ }
}
}
@@ -412,19 +427,22 @@ void xt_hdc_device::dack_w(int data)
void xt_hdc_device::dack_ws(int data)
{
- *(hdcdma_dst++) = data;
+ *(m_hdcdma_dst++) = data;
- if( --hdcdma_write == 0 )
+ if (--m_hdcdma_write == 0)
{
- hdcdma_write = 512;
- hdcdma_size -= 512;
- hdcdma_dst = hdcdma_data;
+ m_hdcdma_write = 512;
+ m_hdcdma_size -= 512;
+ m_hdcdma_dst = m_hdcdma_data;
}
if (!no_dma())
{
- m_drq_handler(hdcdma_size ? 1 : 0);
- if(!hdcdma_size) pc_hdc_result(1);
+ m_drq_handler(m_hdcdma_size ? 1 : 0);
+ if (!m_hdcdma_size)
+ {
+ pc_hdc_result(true);
+ }
}
}
@@ -432,46 +450,48 @@ void xt_hdc_device::dack_ws(int data)
void xt_hdc_device::execute_read()
{
- hard_disk_file *disk;
- int size = sector_cnt[drv] * 512;
- int read_ = 0;
+ int size = m_sector_cnt[m_drv] * 512;
- if(sector_cnt[drv] == 0)
+ if (m_sector_cnt[m_drv] == 0)
size = 256 * 512;
- disk = pc_hdc_file(drv);
+ hard_disk_file *disk = pc_hdc_file(m_drv);
if (!disk)
return;
- status |= STA_READY; // ready to receive data
- status &= ~STA_INPUT;
- status &= ~STA_COMMAND;
+ m_status |= STA_READY; // ready to receive data
+ m_status &= ~(STA_INPUT | STA_COMMAND);
- hdcdma_src = hdcdma_data;
- hdcdma_read = read_;
- hdcdma_size = size;
+ m_hdcdma_src = m_hdcdma_data;
+ m_hdcdma_read = 0;
+ m_hdcdma_size = size;
- if(!no_dma())
+ if (!no_dma())
{
m_drq_handler(1);
- if(!hdcdma_size) pc_hdc_result(0);
+ if (!m_hdcdma_size)
+ {
+ pc_hdc_result(false);
+ }
}
}
void xt_hdc_device::execute_readsbuff()
{
- status |= STA_READY; // ready to receive data
- status &= ~STA_INPUT;
- status &= ~STA_COMMAND;
+ m_status |= STA_READY; // ready to receive data
+ m_status &= ~(STA_INPUT | STA_COMMAND);
- hdcdma_src = hdcdma_data;
- hdcdma_read = 512;
- hdcdma_size = 512;
+ m_hdcdma_src = m_hdcdma_data;
+ m_hdcdma_read = 512;
+ m_hdcdma_size = 512;
- if(!no_dma())
+ if (!no_dma())
{
m_drq_handler(1);
- if(!hdcdma_size) pc_hdc_result(0);
+ if (!m_hdcdma_size)
+ {
+ pc_hdc_result(false);
+ }
}
}
@@ -479,24 +499,22 @@ void xt_hdc_device::execute_readsbuff()
void xt_hdc_device::execute_write()
{
- hard_disk_file *disk;
- int size = sector_cnt[drv] * 512;
- int write_ = 512;
+ int size = m_sector_cnt[m_drv] * 512;
- if(sector_cnt[drv] == 0)
+ if (m_sector_cnt[m_drv] == 0)
size = 256 * 512;
- disk = pc_hdc_file(drv);
+ hard_disk_file *disk = pc_hdc_file(m_drv);
if (!disk)
return;
- status |= STA_READY; // ready to receive data
- status |= STA_INPUT;
- status &= ~STA_COMMAND;
+ m_status |= STA_READY; // ready to receive data
+ m_status |= STA_INPUT;
+ m_status &= ~STA_COMMAND;
- hdcdma_dst = hdcdma_data;
- hdcdma_write = write_;
- hdcdma_size = size;
+ m_hdcdma_dst = m_hdcdma_data;
+ m_hdcdma_write = 512;
+ m_hdcdma_size = size;
if (!no_dma())
{
@@ -508,13 +526,13 @@ void xt_hdc_device::execute_write()
void xt_hdc_device::execute_writesbuff()
{
- hdcdma_dst = hdcdma_data;
- hdcdma_write = 512;
- hdcdma_size = 512;
+ m_hdcdma_dst = m_hdcdma_data;
+ m_hdcdma_write = 512;
+ m_hdcdma_size = 512;
- status |= STA_READY; // ready to receive data
- status |= STA_INPUT;
- status &= ~STA_COMMAND;
+ m_status |= STA_READY; // ready to receive data
+ m_status |= STA_INPUT;
+ m_status &= ~STA_COMMAND;
if (!no_dma())
{
@@ -526,75 +544,76 @@ void xt_hdc_device::execute_writesbuff()
void xt_hdc_device::get_drive()
{
- drv = (buffer[1] >> 5) & 1;
- csb = (drv) ? CSB_LUN : 0x00;
+ m_drv = BIT(m_buffer[1], 5);
+ m_csb = m_drv ? CSB_LUN : 0x00;
}
void xt_hdc_device::get_chsn()
{
- head[drv] = buffer[1] & 0x1f;
- sector[drv] = buffer[2] & 0x3f;
- cylinder[drv] = (buffer[2] & 0xc0) << 2;
- cylinder[drv] |= buffer[3];
- sector_cnt[drv] = buffer[4];
- control[drv] = buffer[5]; /* 7: no retry, 6: no ecc retry, 210: step rate */
-
- error = 0x80; /* a potential error has C/H/S/N info */
+ m_head[m_drv] = m_buffer[1] & 0x1f;
+ m_sector[m_drv] = m_buffer[2] & 0x3f;
+ m_cylinder[m_drv] = (m_buffer[2] & 0xc0) << 2;
+ m_cylinder[m_drv] |= m_buffer[3];
+ m_sector_cnt[m_drv] = m_buffer[4];
+ m_control[m_drv] = m_buffer[5]; /* 7: no retry, 6: no ecc retry, 210: step rate */
+
+ m_error = 0x80; /* a potential error has C/H/S/N info */
}
-int xt_hdc_device::test_ready()
+bool xt_hdc_device::test_ready()
{
- if( !pc_hdc_file(drv) )
+ if (!pc_hdc_file(m_drv))
{
- csb |= CSB_ERROR;
- error |= 0x04; /* drive not ready */
- return 0;
+ m_csb |= CSB_ERROR;
+ m_error |= 0x04; /* drive not ready */
+ return false;
}
- return 1;
+ return true;
}
-void xt_hdc_device::command()
+TIMER_CALLBACK_MEMBER(xt_hdc_device::process_command)
{
- int set_error_info = 1;
- int old_error = error; /* Previous error data is needed for CMD_SENSE */
- const char *command_name;
+ int old_error = m_error; /* Previous error data is needed for CMD_SENSE */
- csb = 0x00;
- error = 0;
+ m_csb = 0x00;
+ m_error = 0;
- buffer_ptr = &buffer[0];
+ m_buffer_ptr = &m_buffer[0];
get_drive();
- data_cnt = 0;
+ m_data_cnt = 0;
- if (LOG_HDC_STATUS)
- {
- command_name = hdc_command_names[m_current_cmd] ? hdc_command_names[m_current_cmd] : "Unknown";
- logerror("%s pc_hdc_command(): Executing command; cmd=0x%02x (%s) drv=%d\n",
- machine().describe_context(), m_current_cmd, command_name, drv);
- }
+ LOGMASKED(LOG_HDC_STATUS, "%s pc_hdc_command(): Executing command; cmd=0x%02x (%s) drv=%d\n",
+ machine().describe_context(), m_current_cmd, s_hdc_command_names[m_current_cmd] ? s_hdc_command_names[m_current_cmd] : "Unknown", m_drv);
switch (m_current_cmd)
{
case CMD_TESTREADY:
- set_error_info = 0;
test_ready();
- if(no_dma()) pc_hdc_result(set_error_info);
+ if (no_dma())
+ {
+ pc_hdc_result(false);
+ }
break;
case CMD_SENSE:
/* Perform error code translation. This may need to be expanded in the future. */
- buffer[data_cnt++] = ( old_error & 0xC0 ) | ( ( old_error & 0x04 ) ? 0x04 : 0x00 ) ;
- buffer[data_cnt++] = (drv << 5) | head[drv];
- buffer[data_cnt++] = ((cylinder[drv] >> 2) & 0xc0) | sector[drv];
- buffer[data_cnt++] = cylinder[drv] & 0xff;
- set_error_info = 0;
- if(no_dma()) pc_hdc_result(set_error_info);
+ m_buffer[m_data_cnt++] = (old_error & 0xc0) | (old_error & 0x04);
+ m_buffer[m_data_cnt++] = (m_drv << 5) | m_head[m_drv];
+ m_buffer[m_data_cnt++] = ((m_cylinder[m_drv] >> 2) & 0xc0) | m_sector[m_drv];
+ m_buffer[m_data_cnt++] = m_cylinder[m_drv] & 0xff;
+ if (no_dma())
+ {
+ pc_hdc_result(false);
+ }
break;
case CMD_RECALIBRATE:
get_chsn();
- if(no_dma()) pc_hdc_result(set_error_info);
+ if (no_dma())
+ {
+ pc_hdc_result(true);
+ }
break;
case CMD_FORMATDRV:
@@ -605,31 +624,27 @@ void xt_hdc_device::command()
case CMD_DRIVEDIAG:
get_chsn();
test_ready();
- if(no_dma()) pc_hdc_result(set_error_info);
+ if (no_dma())
+ {
+ pc_hdc_result(true);
+ }
break;
case CMD_READ:
case CMD_READLONG:
get_chsn();
- if (LOG_HDC_STATUS)
- {
- logerror("%s hdc read D:%d C:%d H:%d S:%d N:%d CTL:$%02x\n",
- machine().describe_context(), drv, cylinder[drv], head[drv], sector[drv], sector_cnt[drv], control[drv]);
- }
+ LOGMASKED(LOG_HDC_STATUS, "%s hdc read D:%d C:%d H:%d S:%d N:%d CTL:$%02x\n",
+ machine().describe_context(), m_drv, m_cylinder[m_drv], m_head[m_drv], m_sector[m_drv], m_sector_cnt[m_drv], m_control[m_drv]);
if (test_ready())
execute_read();
else
- pc_hdc_result(1);
- set_error_info = 0;
+ pc_hdc_result(true);
break;
case CMD_READSBUFF:
- if (LOG_HDC_STATUS)
- {
- logerror("%s hdc read sector buffer\n", machine().describe_context());
- }
+ LOGMASKED(LOG_HDC_STATUS, "%s hdc read sector buffer\n", machine().describe_context());
execute_readsbuff();
break;
@@ -638,53 +653,50 @@ void xt_hdc_device::command()
case CMD_WRITELONG:
get_chsn();
- if (LOG_HDC_STATUS)
- {
- logerror("%s hdc write D:%d C:%d H:%d S:%d N:%d CTL:$%02x\n",
- machine().describe_context(), drv, cylinder[drv], head[drv], sector[drv], sector_cnt[drv], control[drv]);
- }
+ LOGMASKED(LOG_HDC_STATUS, "%s hdc write D:%d C:%d H:%d S:%d N:%d CTL:$%02x\n",
+ machine().describe_context(), m_drv, m_cylinder[m_drv], m_head[m_drv], m_sector[m_drv], m_sector_cnt[m_drv], m_control[m_drv]);
if (test_ready())
execute_write();
break;
case CMD_WRITESBUFF:
- if (LOG_HDC_STATUS)
- {
- logerror("%s hdc write sector buffer\n", machine().describe_context());
- }
+ LOGMASKED(LOG_HDC_STATUS, "%s hdc write sector buffer\n", machine().describe_context());
execute_writesbuff();
break;
case CMD_SETPARAM:
get_chsn();
- cylinders[drv] = ((buffer[6]&3)<<8) | buffer[7];
- heads[drv] = buffer[8] & 0x1f;
- rwc[drv] = ((buffer[9]&3)<<8) | buffer[10];
- wp[drv] = ((buffer[11]&3)<<8) | buffer[12];
- ecc[drv] = buffer[13];
- if(no_dma()) pc_hdc_result(set_error_info);
+ m_cylinders[m_drv] = ((m_buffer[6] & 3) << 8) | m_buffer[7];
+ m_heads[m_drv] = m_buffer[8] & 0x1f;
+ m_rwc[m_drv] = ((m_buffer[9] & 3) << 8) | m_buffer[10];
+ m_wp[m_drv] = ((m_buffer[11] & 3) << 8) | m_buffer[12];
+ m_ecc[m_drv] = m_buffer[13];
+ if (no_dma())
+ {
+ pc_hdc_result(true);
+ }
break;
case CMD_GETECC:
- buffer[data_cnt++] = ecc[drv];
- if(no_dma()) pc_hdc_result(set_error_info);
+ m_buffer[m_data_cnt++] = m_ecc[m_drv];
+ if (no_dma())
+ {
+ pc_hdc_result(true);
+ }
break;
case CMD_RAMDIAG:
case CMD_INTERNDIAG:
- if(no_dma()) pc_hdc_result(set_error_info);
+ if (no_dma())
+ {
+ pc_hdc_result(true);
+ }
break;
}
}
-void xt_hdc_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- command();
-}
-
-
/* Command format
* Bits Description
* 7 0
@@ -705,43 +717,41 @@ void xt_hdc_device::device_timer(emu_timer &timer, device_timer_id id, int param
* cccccccc write precomp l
* eeeeeeee ecc
*/
-void xt_hdc_device::data_w(int data)
+void xt_hdc_device::data_w(uint8_t data)
{
- if(!(status & STA_COMMAND) && m_current_cmd != CMD_SETPARAM)
+ if (!(m_status & STA_COMMAND) && m_current_cmd != CMD_SETPARAM)
{
- if (LOG_HDC_DATA)
- logerror("hdc_data_w PIO $%02x (%i) (%s): \n", data,data_cnt,hdc_command_names[m_current_cmd] ? hdc_command_names[m_current_cmd] : "Unknown");
+ LOGMASKED(LOG_HDC_DATA, "hdc_data_w PIO $%02x (%i) (%s): \n", data, m_data_cnt, s_hdc_command_names[m_current_cmd] ? s_hdc_command_names[m_current_cmd] : "Unknown");
// PIO data transfer
- buffer[data_cnt++] = data;
- if(data_cnt >= hdcdma_size)
+ m_buffer[m_data_cnt++] = data;
+ if (m_data_cnt >= m_hdcdma_size)
{
- data_cnt = 0;
+ m_data_cnt = 0;
// write to disk
do
{
- if(m_current_cmd == CMD_WRITESBUFF)
- dack_ws(buffer[data_cnt++]);
+ if (m_current_cmd == CMD_WRITESBUFF)
+ dack_ws(m_buffer[m_data_cnt++]);
else
- dack_w(buffer[data_cnt++]);
+ dack_w(m_buffer[m_data_cnt++]);
}
- while (hdcdma_size);
- data_cnt = 0;
- pc_hdc_result(1);
+ while (m_hdcdma_size);
+ m_data_cnt = 0;
+ pc_hdc_result(true);
}
return;
}
- if( data_cnt == 0 )
+ if (m_data_cnt == 0)
{
- buffer_ptr = &buffer[0];
+ m_buffer_ptr = &m_buffer[0];
m_current_cmd = data;
- data_cnt = 6; /* expect 6 bytes including this one */
- status &= ~STA_READY;
- status &= ~STA_INPUT;
+ m_data_cnt = 6; /* expect 6 bytes including this one */
+ m_status &= ~(STA_READY | STA_INPUT);
switch (data)
{
case CMD_SETPARAM:
- data_cnt += 8;
+ m_data_cnt += 8;
break;
case CMD_TESTREADY:
@@ -765,76 +775,73 @@ void xt_hdc_device::data_w(int data)
break;
default:
- data_cnt = 0;
- status |= STA_INPUT;
- csb |= CSB_ERROR | 0x20; /* unknown command */
- pc_hdc_result(1);
+ m_data_cnt = 0;
+ m_status |= STA_INPUT;
+ m_csb |= CSB_ERROR | 0x20; /* unknown command */
+ pc_hdc_result(true);
break;
}
- if( data_cnt )
- status |= STA_REQUEST;
+ if (m_data_cnt)
+ m_status |= STA_REQUEST;
}
- if (data_cnt)
+ if (m_data_cnt)
{
- if (LOG_HDC_DATA)
- logerror("hdc_data_w $%02x (%i) (%s): \n", data,data_cnt,hdc_command_names[m_current_cmd] ? hdc_command_names[m_current_cmd] : "Unknown");
+ LOGMASKED(LOG_HDC_DATA, "hdc_data_w $%02x (%i) (%s): \n", data, m_data_cnt, s_hdc_command_names[m_current_cmd] ? s_hdc_command_names[m_current_cmd] : "Unknown");
- *buffer_ptr++ = data;
+ *m_buffer_ptr++ = data;
// XXX ec1841 wants this
- if (m_current_cmd == CMD_SETPARAM && data_cnt == 9 && (m_type == EC1841)) {
- status &= ~STA_READY;
- } else {
- status |= STA_READY;
- if(m_current_cmd == CMD_SETPARAM && data_cnt == 9) // some controllers want geometry info as data, not as a command (true for the Seagate ST11M?)
- status &= ~STA_COMMAND;
+ if (m_current_cmd == CMD_SETPARAM && m_data_cnt == 9 && m_type == EC1841)
+ {
+ m_status &= ~STA_READY;
}
- if (--data_cnt == 0)
+ else
{
- if (LOG_HDC_STATUS)
- logerror("%s pc_hdc_data_w(): Launching command\n", machine().describe_context());
-
- status &= ~STA_COMMAND;
- status &= ~STA_REQUEST;
- status &= ~STA_READY;
- status &= ~STA_INPUT;
- timer->adjust(attotime::from_msec(1),0);
+ m_status |= STA_READY;
+ if (m_current_cmd == CMD_SETPARAM && m_data_cnt == 9) // some controllers want geometry info as data, not as a command (true for the Seagate ST11M?)
+ m_status &= ~STA_COMMAND;
+ }
+ if (--m_data_cnt == 0)
+ {
+ LOGMASKED(LOG_HDC_STATUS, "%s pc_hdc_data_w(): Launching command\n", machine().describe_context());
+
+ m_status &= ~(STA_COMMAND | STA_REQUEST | STA_READY | STA_INPUT);
+ m_timer->adjust(attotime::from_msec(1));
}
}
}
-void xt_hdc_device::reset_w(int data)
+void xt_hdc_device::reset_w(uint8_t data)
{
- cylinder[0] = cylinder[1] = 0;
- head[0] = head[1] = 0;
- sector[0] = sector[1] = 0;
- csb = 0;
- status = STA_COMMAND | STA_READY;
- memset(&buffer[0], 0, buffer.size());
- buffer_ptr = &buffer[0];
- data_cnt = 0;
+ m_cylinder[0] = m_cylinder[1] = 0;
+ m_head[0] = m_head[1] = 0;
+ m_sector[0] = m_sector[1] = 0;
+ m_csb = 0;
+ m_status = STA_COMMAND | STA_READY;
+ std::fill_n(&m_buffer[0], 256*512, 0);
+ m_buffer_ptr = &m_buffer[0];
+ m_data_cnt = 0;
}
-void xt_hdc_device::select_w(int data)
+void xt_hdc_device::select_w(uint8_t data)
{
- status &= ~STA_INTERRUPT;
- status |= STA_SELECT;
+ m_status &= ~STA_INTERRUPT;
+ m_status |= STA_SELECT;
}
-void xt_hdc_device::control_w(int data)
+void xt_hdc_device::control_w(uint8_t data)
{
- if (LOG_HDC_STATUS)
- logerror("%s: pc_hdc_control_w(): control write %d\n", machine().describe_context(), data);
+ LOGMASKED(LOG_HDC_STATUS, "%s: pc_hdc_control_w(): control write %d\n", machine().describe_context(), data);
- hdc_control = data;
+ m_hdc_control = data;
- if (!(hdc_control & 0x02))
+ if (!(m_hdc_control & 0x02))
{
m_irq_handler(0);
}
@@ -846,44 +853,40 @@ uint8_t xt_hdc_device::data_r()
{
uint8_t data = 0xff;
- if(!(status & STA_COMMAND) && (m_current_cmd == CMD_READ || m_current_cmd == CMD_READLONG || m_current_cmd == CMD_READSBUFF))
+ if (!(m_status & STA_COMMAND) && (m_current_cmd == CMD_READ || m_current_cmd == CMD_READLONG || m_current_cmd == CMD_READSBUFF))
{
// PIO data transfer
- if(data_cnt == 0)
+ if (m_data_cnt == 0)
{
do
{
if (m_current_cmd == CMD_READSBUFF)
- buffer[data_cnt++] = dack_rs();
+ m_buffer[m_data_cnt++] = dack_rs();
else
- buffer[data_cnt++] = dack_r();
- } while (hdcdma_read);
- data_cnt = 0;
+ m_buffer[m_data_cnt++] = dack_r();
+ } while (m_hdcdma_read);
+ m_data_cnt = 0;
}
- data = buffer[data_cnt++];
- if(data_cnt >= ((sector_cnt[drv]!=0) ? (sector_cnt[drv] * 512) : (256 * 512)))
+ data = m_buffer[m_data_cnt++];
+ if (m_data_cnt >= ((m_sector_cnt[m_drv] != 0) ? (m_sector_cnt[m_drv] * 512) : (256 * 512)))
{
- data_cnt = 0;
- pc_hdc_result(1);
+ m_data_cnt = 0;
+ pc_hdc_result(true);
}
- if (LOG_HDC_DATA)
- logerror("hdc_data_r PIO $%02x (%i): \n", data,data_cnt);
+ LOGMASKED(LOG_HDC_DATA, "hdc_data_r PIO $%02x (%i): \n", data, m_data_cnt);
return data;
}
- if( data_cnt )
+ if (m_data_cnt)
{
- data = *buffer_ptr++;
- status &= ~STA_INTERRUPT;
- if( --data_cnt == 0 )
+ data = *m_buffer_ptr++;
+ m_status &= ~STA_INTERRUPT;
+ if (--m_data_cnt == 0)
{
- status &= ~STA_INPUT;
- status &= ~STA_REQUEST;
- status &= ~STA_SELECT;
- status |= STA_COMMAND;
+ m_status &= ~(STA_INPUT | STA_REQUEST | STA_SELECT);
+ m_status |= STA_COMMAND;
}
- if (LOG_HDC_DATA)
- logerror("hdc_data_r $%02x (%i): \n", data,data_cnt);
+ LOGMASKED(LOG_HDC_DATA, "hdc_data_r $%02x (%i): \n", data, m_data_cnt);
}
return data;
}
@@ -892,12 +895,12 @@ uint8_t xt_hdc_device::data_r()
uint8_t xt_hdc_device::status_r()
{
- return status;
+ return m_status;
}
void xt_hdc_device::set_ready()
{
- status |= STA_READY; // XXX
+ m_status |= STA_READY; // XXX
}
//**************************************************************************
@@ -963,7 +966,8 @@ isa8_hdc_device::isa8_hdc_device(const machine_config &mconfig, const char *tag,
isa8_hdc_device::isa8_hdc_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, type, tag, owner, clock),
device_isa8_card_interface(mconfig, *this),
- m_hdc(*this,"hdc"), dip(0)
+ m_hdc(*this,"hdc"),
+ m_dip(0)
{
}
@@ -990,7 +994,7 @@ void isa8_hdc_device::device_start()
void isa8_hdc_device::device_reset()
{
- dip = ioport("HDD")->read();
+ m_dip = ioport("HDD")->read();
if (ioport("ROM")->read() == 1 && m_hdc->install_rom())
m_isa->install_rom(this, 0xc8000, 0xc9fff, "hdc");
@@ -1002,11 +1006,12 @@ void isa8_hdc_device::device_reset()
* hard disk controller
*
*************************************************************************/
+
uint8_t isa8_hdc_device::pc_hdc_r(offs_t offset)
{
uint8_t data = 0xff;
- switch( offset )
+ switch (offset)
{
case 0: data = m_hdc->data_r(); break;
case 1: data = m_hdc->status_r(); break;
@@ -1014,18 +1019,16 @@ uint8_t isa8_hdc_device::pc_hdc_r(offs_t offset)
case 3: break;
}
- if (LOG_HDC_CALL)
- logerror("%s pc_hdc_r(): offs=%d result=0x%02x\n", machine().describe_context(), offset, data);
+ LOGMASKED(LOG_HDC_CALL, "%s pc_hdc_r(): offs=%d result=0x%02x\n", machine().describe_context(), offset, data);
return data;
}
void isa8_hdc_device::pc_hdc_w(offs_t offset, uint8_t data)
{
- if (LOG_HDC_CALL)
- logerror("%s pc_hdc_w(): offs=%d data=0x%02x\n", machine().describe_context(), offset, data);
+ LOGMASKED(LOG_HDC_CALL, "%s pc_hdc_w(): offs=%d data=0x%02x\n", machine().describe_context(), offset, data);
- switch( offset )
+ switch (offset)
{
case 0: m_hdc->data_w(data); break;
case 1: m_hdc->reset_w(data); break;
@@ -1043,7 +1046,7 @@ uint8_t isa8_hdc_device::dack_r(int line)
return m_hdc->dack_r();
}
-void isa8_hdc_device::dack_w(int line,uint8_t data)
+void isa8_hdc_device::dack_w(int line, uint8_t data)
{
if (m_hdc->get_command() == CMD_WRITESBUFF)
m_hdc->dack_ws(data);
@@ -1069,20 +1072,19 @@ void isa8_hdc_device::dack_w(int line,uint8_t data)
uint8_t isa8_hdc_device::pc_hdc_dipswitch_r()
{
m_hdc->set_ready();
- if (LOG_HDC_STATUS)
- logerror("%s: pc_hdc_dipswitch_r: status $%02X\n", machine().describe_context(), m_hdc->status_r());
- return dip;
+ LOGMASKED(LOG_HDC_STATUS, "%s: pc_hdc_dipswitch_r: status $%02X\n", machine().describe_context(), m_hdc->status_r());
+ return m_dip;
}
-WRITE_LINE_MEMBER( isa8_hdc_device::irq_w )
+WRITE_LINE_MEMBER(isa8_hdc_device::irq_w)
{
- if (BIT(dip, 6))
+ if (BIT(m_dip, 6))
m_isa->irq5_w(state);
else
m_isa->irq2_w(state);
}
-WRITE_LINE_MEMBER( isa8_hdc_device::drq_w )
+WRITE_LINE_MEMBER(isa8_hdc_device::drq_w)
{
m_isa->drq3_w(state);
}
diff --git a/src/devices/bus/isa/hdc.h b/src/devices/bus/isa/hdc.h
index 64d02ee033d..0f49d2118f9 100644
--- a/src/devices/bus/isa/hdc.h
+++ b/src/devices/bus/isa/hdc.h
@@ -35,15 +35,14 @@ public:
void dack_w(int data);
void dack_ws(int data);
- virtual void command();
- void data_w(int data);
- void reset_w(int data);
- void select_w(int data);
- void control_w(int data);
+ void data_w(uint8_t data);
+ void reset_w(uint8_t data);
+ void select_w(uint8_t data);
+ void control_w(uint8_t data);
uint8_t data_r();
uint8_t status_r();
void set_ready();
- uint8_t get_command() { return buffer[0]; }
+ uint8_t get_command() { return m_buffer[0]; }
bool install_rom() { return (m_type != EC1841); }
protected:
@@ -52,10 +51,10 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
hard_disk_file *pc_hdc_file(int id);
- void pc_hdc_result(int set_error_info);
- int no_dma(void);
+ void pc_hdc_result(bool set_error_info);
+ bool no_dma();
int get_lbasector();
void execute_read();
void execute_readsbuff();
@@ -63,13 +62,15 @@ protected:
void execute_writesbuff();
void get_drive();
void get_chsn();
- int test_ready();
+ bool test_ready();
+
+ TIMER_CALLBACK_MEMBER(process_command);
- std::vector<uint8_t> buffer; /* data buffer */
- uint8_t *buffer_ptr; /* data pointer */
- int csb; /* command status byte */
- int status; /* drive status */
- int error; /* error code */
+ std::unique_ptr<uint8_t[]> m_buffer; /* data buffer */
+ uint8_t *m_buffer_ptr; /* data pointer */
+ int m_csb; /* command status byte */
+ int m_status; /* drive status */
+ int m_error; /* error code */
enum {
STANDARD,
@@ -82,31 +83,31 @@ protected:
devcb_write_line m_drq_handler;
private:
- int drv; /* 0 master, 1 slave drive */
- int cylinders[2]; /* number of cylinders */
- int rwc[2]; /* reduced write current from cyl */
- int wp[2]; /* write precompensation from cyl */
- int heads[2]; /* heads */
- int ecc[2]; /* ECC bytes */
+ int m_drv; /* 0 master, 1 slave drive */
+ int m_cylinders[2]; /* number of cylinders */
+ int m_rwc[2]; /* reduced write current from cyl */
+ int m_wp[2]; /* write precompensation from cyl */
+ int m_heads[2]; /* heads */
+ int m_ecc[2]; /* ECC bytes */
/* indexes */
- int cylinder[2]; /* current cylinder */
- int head[2]; /* current head */
- int sector[2]; /* current sector */
- int sector_cnt[2]; /* sector count */
- int control[2]; /* control */
-
- emu_timer *timer;
-
- int data_cnt; /* data count */
- uint8_t hdc_control;
-
- uint8_t hdcdma_data[512];
- uint8_t *hdcdma_src;
- uint8_t *hdcdma_dst;
- int hdcdma_read;
- int hdcdma_write;
- int hdcdma_size;
+ int m_cylinder[2]; /* current cylinder */
+ int m_head[2]; /* current head */
+ int m_sector[2]; /* current sector */
+ int m_sector_cnt[2]; /* sector count */
+ int m_control[2]; /* control */
+
+ emu_timer *m_timer;
+
+ int m_data_cnt; /* data count */
+ uint8_t m_hdc_control;
+
+ uint8_t m_hdcdma_data[512];
+ uint8_t *m_hdcdma_src;
+ uint8_t *m_hdcdma_dst;
+ int m_hdcdma_read;
+ int m_hdcdma_write;
+ int m_hdcdma_size;
};
class ec1841_device : public xt_hdc_device
@@ -166,7 +167,7 @@ public:
virtual void dack_w(int line,uint8_t data) override;
uint8_t pc_hdc_dipswitch_r();
- int dip; /* dip switches */
+ int m_dip; /* dip switches */
};
diff --git a/src/devices/bus/isa/mc1502_fdc.cpp b/src/devices/bus/isa/mc1502_fdc.cpp
index 85c8eda25aa..ad1c1bd8b8c 100644
--- a/src/devices/bus/isa/mc1502_fdc.cpp
+++ b/src/devices/bus/isa/mc1502_fdc.cpp
@@ -217,7 +217,7 @@ void mc1502_fdc_device::device_start()
m_isa->install_device(0x0048, 0x004b, read8sm_delegate(*m_fdc, FUNC(fd1793_device::read)), write8sm_delegate(*m_fdc, FUNC(fd1793_device::write)));
m_isa->install_device(0x004c, 0x004f, read8sm_delegate(*this, FUNC(mc1502_fdc_device::mc1502_fdcv2_r)), write8sm_delegate(*this, FUNC(mc1502_fdc_device::mc1502_fdc_w)));
- motor_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mc1502_fdc_device::motor_callback),this));
+ motor_timer = timer_alloc(FUNC(mc1502_fdc_device::motor_callback), this);
motor_on = 0;
m_control = 0;
}
diff --git a/src/devices/bus/isa/omti8621.cpp b/src/devices/bus/isa/omti8621.cpp
index a90df0ea019..880e4e110ea 100644
--- a/src/devices/bus/isa/omti8621.cpp
+++ b/src/devices/bus/isa/omti8621.cpp
@@ -20,14 +20,13 @@
#include "formats/naslite_dsk.h"
#include "formats/apollo_dsk.h"
-#define VERBOSE 0
+#define LOG_LEVEL0 (0x1U << 1)
+#define LOG_LEVEL1 (0x3U << 1)
+#define LOG_LEVEL2 (0x7U << 1)
+#define LOG_LEVEL3 (0xfU << 1)
-static int verbose = VERBOSE;
-
-#define LOG(x) { logerror ("%s: ", cpu_context()); logerror x; logerror ("\n"); }
-#define LOG1(x) { if (verbose > 0) LOG(x)}
-#define LOG2(x) { if (verbose > 1) LOG(x)}
-#define LOG3(x) { if (verbose > 2) LOG(x)}
+#define VERBOSE (LOG_LEVEL0)
+#include "logmacro.h"
#define OMTI_DISK_SECTOR_SIZE 1056
@@ -105,7 +104,7 @@ public:
#define OMTI_STATUS_REQ 0x01 // Request (1 = request transfer of data via data in/out register)
#define OMTI_STATUS_IO 0x02 // In/Out (1 = direction of transfer is from controller to host)
-#define OMTI_STATUS_CD 0x04 // Command/Data ( 1 = byte transferred is command or status byte)
+#define OMTI_STATUS_CD 0x04 // Command/Data (1 = byte transferred is command or status byte)
#define OMTI_STATUS_BUSY 0x08 // Busy (0 = controller is idle, 1 = controller selected)
#define OMTI_STATUS_DREQ 0x10 // Data Request (0 = no DMA request, 1 = DMA cycle requested)
#define OMTI_STATUS_IREQ 0x20 // Interrupt Request (0 = no interrupt, 1 = command complete)
@@ -281,15 +280,15 @@ ioport_constructor omti8621_device::device_input_ports() const
void omti8621_device::device_start()
{
- LOG2(("device_start"));
+ LOGMASKED(LOG_LEVEL2, "device_start");
set_isa_device();
m_installed = false;
- sector_buffer.resize(OMTI_DISK_SECTOR_SIZE*OMTI_MAX_BLOCK_COUNT);
+ m_sector_buffer.resize(OMTI_DISK_SECTOR_SIZE*OMTI_MAX_BLOCK_COUNT);
- m_timer = timer_alloc(0);
+ m_timer = timer_alloc(FUNC(omti8621_device::trigger_interrupt), this);
our_disks[0] = subdevice<omti_disk_image_device>(OMTI_DISK0_TAG);
our_disks[1] = subdevice<omti_disk_image_device>(OMTI_DISK1_TAG);
@@ -303,7 +302,7 @@ void omti8621_device::device_reset()
{
static const int io_bases[8] = { 0x320, 0x324, 0x328, 0x32c, 0x1a0, 0x1a4, 0x1a8, 0x1ac };
- LOG2(("device_reset"));
+ LOGMASKED(LOG_LEVEL2, "device_reset");
// you can't read I/O ports in device_start() even if they're required_ioport<> in your class!
if (!m_installed)
@@ -331,38 +330,38 @@ void omti8621_device::device_reset()
set_jumper(our_disks[0]->m_type);
// should go from reset to idle after 100 us
- // state->omti_state = OMTI_STATE_RESET;
- omti_state = OMTI_STATE_IDLE;
+ // m_omti_state = OMTI_STATE_RESET;
+ m_omti_state = OMTI_STATE_IDLE;
- status_port = OMTI_STATUS_NU6 | OMTI_STATUS_NU7;
- config_port = ~jumper;
- mask_port = 0;
+ m_status_port = OMTI_STATUS_NU6 | OMTI_STATUS_NU7;
+ m_config_port = ~m_jumper;
+ m_mask_port = 0;
// default the sector data buffer with model and status information
// (i.e. set sector data buffer for cmd=0x0e READ SECTOR BUFFER)
- memset(&sector_buffer[0], 0, OMTI_DISK_SECTOR_SIZE);
- memcpy(&sector_buffer[0], "8621VB.4060487xx", 0x10);
- sector_buffer[0x10] = 0; // ROM Checksum error
- sector_buffer[0x11] = 0; // Processor Register error
- sector_buffer[0x12] = 0; // Buffer RAM error
- sector_buffer[0x13] = 0; // Sequencer Register File error
- sector_buffer[0x14] = 0xc0; // 32K buffer size
+ memset(&m_sector_buffer[0], 0, OMTI_DISK_SECTOR_SIZE);
+ memcpy(&m_sector_buffer[0], "8621VB.4060487xx", 0x10);
+ m_sector_buffer[0x10] = 0; // ROM Checksum error
+ m_sector_buffer[0x11] = 0; // Processor Register error
+ m_sector_buffer[0x12] = 0; // Buffer RAM error
+ m_sector_buffer[0x13] = 0; // Sequencer Register File error
+ m_sector_buffer[0x14] = 0xc0; // 32K buffer size
// TODO: add missing Default values for LUN 0, 1 and 3
- command_length = 0;
- command_index = 0;
- command_status = 0;
+ m_command_length = 0;
+ m_command_index = 0;
+ m_command_status = 0;
- data_index = 0;
- data_length = 0;
+ m_data_index = 0;
+ m_data_length = 0;
clear_sense_data();
- diskaddr_ecc_error = 0;
- diskaddr_format_bad_track = 0;
- alternate_track_address[0] = 0;
- alternate_track_address[1] = 0;
+ m_diskaddr_ecc_error = 0;
+ m_diskaddr_format_bad_track = 0;
+ m_alternate_track_address[0] = 0;
+ m_alternate_track_address[1] = 0;
fd_moten_w(0);
fd_rate_w(0);
@@ -395,8 +394,22 @@ omti8621_device::omti8621_device(
, m_floppy(*this, OMTI_FDC_TAG":%u", 0U)
, m_iobase(*this, "IO_BASE")
, m_biosopts(*this, "BIOS_OPTS")
- , jumper(0), omti_state(0), status_port(0), config_port(0), mask_port(0), command_length(0), command_index(0), command_status(0), data_buffer(nullptr)
- , data_length(0), data_index(0), diskaddr_ecc_error(0), diskaddr_format_bad_track(0), m_timer(nullptr), m_moten(0), m_installed(false)
+ , m_jumper(0)
+ , m_omti_state(0)
+ , m_status_port(0)
+ , m_config_port(0)
+ , m_mask_port(0)
+ , m_command_length(0)
+ , m_command_index(0)
+ , m_command_status(0)
+ , m_data_buffer(nullptr)
+ , m_data_length(0)
+ , m_data_index(0)
+ , m_diskaddr_ecc_error(0)
+ , m_diskaddr_format_bad_track(0)
+ , m_timer(nullptr)
+ , m_moten(0)
+ , m_installed(false)
{
}
@@ -404,13 +417,13 @@ omti8621_device::omti8621_device(
set_interrupt - update the IRQ state
-------------------------------------------------*/
-void omti8621_device::set_interrupt(enum line_state line_state)
+void omti8621_device::set_interrupt(line_state state)
{
- LOG2(("set_interrupt: status_port=%x, line_state %d", status_port, line_state));
- m_isa->irq14_w(line_state);
+ LOGMASKED(LOG_LEVEL2, "%s: set_interrupt: status_port=%x, line_state %d", cpu_context(), m_status_port, state);
+ m_isa->irq14_w(state);
}
-void omti8621_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(omti8621_device::trigger_interrupt)
{
set_interrupt(ASSERT_LINE);
}
@@ -420,8 +433,8 @@ void omti8621_device::device_timer(emu_timer &timer, device_timer_id id, int par
***************************************************************************/
void omti8621_device::clear_sense_data() {
- LOG2(("clear_sense_data"));
- memset(sense_data, 0, sizeof(sense_data));
+ LOGMASKED(LOG_LEVEL2, "%s: clear_sense_data", cpu_context());
+ std::fill_n(m_sense_data, std::size(m_sense_data), 0);
}
/***************************************************************************
@@ -429,11 +442,11 @@ void omti8621_device::clear_sense_data() {
***************************************************************************/
void omti8621_device::set_sense_data(uint8_t code, const uint8_t * cdb) {
- LOG2(("set_sense_data code=%x", code));
- sense_data[0]=code;
- sense_data[1]=cdb[1];
- sense_data[2]=cdb[2];
- sense_data[3]=cdb[3];
+ LOGMASKED(LOG_LEVEL2, "%s: set_sense_data code=%x", cpu_context(), code);
+ m_sense_data[0] = code;
+ m_sense_data[1] = cdb[1];
+ m_sense_data[2] = cdb[2];
+ m_sense_data[3] = cdb[3];
}
/***************************************************************************
@@ -441,7 +454,7 @@ void omti8621_device::set_sense_data(uint8_t code, const uint8_t * cdb) {
***************************************************************************/
void omti8621_device::set_configuration_data(uint8_t lun) {
- LOG2(("set_configuration_data lun=%x", lun));
+ LOGMASKED(LOG_LEVEL2, "%s: set_configuration_data lun=%x", cpu_context(), lun);
// initialize the configuration data
omti_disk_image_device *disk = our_disks[lun];
@@ -485,7 +498,7 @@ uint8_t omti8621_device::check_disk_address(const uint8_t *cdb)
uint32_t disk_addr = (disk_track * disk->m_sectors) + sector;
if (block_count > OMTI_MAX_BLOCK_COUNT) {
- LOG(("########### check_disk_address: unexpected block count %x", block_count));
+ LOGMASKED(LOG_LEVEL0, "%s: ########### check_disk_address: unexpected block count %x", cpu_context(), block_count);
sense_code = OMTI_SENSE_CODE_ILLEGAL_ADDRESS | OMTI_SENSE_CODE_ADDRESS_VALID;
}
@@ -499,18 +512,18 @@ uint8_t omti8621_device::check_disk_address(const uint8_t *cdb)
sense_code = OMTI_SENSE_CODE_ILLEGAL_ADDRESS | OMTI_SENSE_CODE_ADDRESS_VALID;
} else if (cylinder >= disk->m_cylinders) {
sense_code = OMTI_SENSE_CODE_ILLEGAL_ADDRESS | OMTI_SENSE_CODE_ADDRESS_VALID;
- } else if ( disk_track == diskaddr_format_bad_track && disk_track != 0) {
+ } else if (disk_track == m_diskaddr_format_bad_track && disk_track != 0) {
sense_code = OMTI_SENSE_CODE_BAD_TRACK;
- } else if (disk_addr == diskaddr_ecc_error && disk_addr != 0) {
+ } else if (disk_addr == m_diskaddr_ecc_error && disk_addr != 0) {
sense_code = OMTI_SENSE_CODE_ECC_ERROR;
- } else if (disk_track == alternate_track_address[1] && disk_track != 0) {
+ } else if (disk_track == m_alternate_track_address[1] && disk_track != 0) {
sense_code = OMTI_SENSE_CODE_ALTERNATE_TRACK;
}
if (sense_code == OMTI_SENSE_CODE_NO_ERROR) {
clear_sense_data();
} else {
- command_status |= OMTI_COMMAND_STATUS_ERROR;
+ m_command_status |= OMTI_COMMAND_STATUS_ERROR;
set_sense_data(sense_code, cdb);
}
return sense_code == OMTI_SENSE_CODE_NO_ERROR;
@@ -544,29 +557,29 @@ uint32_t omti8621_device::get_disk_address(const uint8_t * cdb) {
void omti8621_device::set_data_transfer(uint8_t *data, uint16_t length)
{
// set controller for read data transfer
- omti_state = OMTI_STATE_DATA;
- status_port |= OMTI_STATUS_REQ | OMTI_STATUS_IO | OMTI_STATUS_BUSY;
- status_port &= ~OMTI_STATUS_CD;
+ m_omti_state = OMTI_STATE_DATA;
+ m_status_port |= OMTI_STATUS_REQ | OMTI_STATUS_IO | OMTI_STATUS_BUSY;
+ m_status_port &= ~OMTI_STATUS_CD;
- data_buffer = data;
- data_length = length;
- data_index = 0;
+ m_data_buffer = data;
+ m_data_length = length;
+ m_data_index = 0;
}
/***************************************************************************
- read_sectors_from_disk - read sectors starting at diskaddr into sector_buffer
+ read_sectors_from_disk - read sectors starting at diskaddr into m_sector_buffer
***************************************************************************/
void omti8621_device::read_sectors_from_disk(int32_t diskaddr, uint8_t count, uint8_t lun)
{
- uint8_t *data_buffer = &sector_buffer[0];
+ uint8_t *data_buffer = &m_sector_buffer[0];
device_image_interface *image = our_disks[lun]->m_image;
while (count-- > 0) {
- LOG2(("read_sectors_from_disk lun=%d diskaddr=%x", lun, diskaddr));
+ LOGMASKED(LOG_LEVEL2, "%s: read_sectors_from_disk lun=%d diskaddr=%x", cpu_context(), lun, diskaddr);
- image->fseek( diskaddr * OMTI_DISK_SECTOR_SIZE, SEEK_SET);
- image->fread( data_buffer, OMTI_DISK_SECTOR_SIZE);
+ image->fseek(diskaddr * OMTI_DISK_SECTOR_SIZE, SEEK_SET);
+ image->fread(data_buffer, OMTI_DISK_SECTOR_SIZE);
diskaddr++;
data_buffer += OMTI_DISK_SECTOR_SIZE;
@@ -574,23 +587,23 @@ void omti8621_device::read_sectors_from_disk(int32_t diskaddr, uint8_t count, ui
}
/***************************************************************************
- write_sectors_to_disk - write sectors starting at diskaddr from sector_buffer
+ write_sectors_to_disk - write sectors starting at diskaddr from m_sector_buffer
***************************************************************************/
void omti8621_device::write_sectors_to_disk(int32_t diskaddr, uint8_t count, uint8_t lun)
{
- uint8_t *data_buffer = &sector_buffer[0];
+ uint8_t *data_buffer = &m_sector_buffer[0];
device_image_interface *image = our_disks[lun]->m_image;
while (count-- > 0) {
- LOG2(("write_sectors_to_disk lun=%d diskaddr=%x", lun, diskaddr));
+ LOGMASKED(LOG_LEVEL2, "%s: write_sectors_to_disk lun=%d diskaddr=%x", cpu_context(), lun, diskaddr);
- image->fseek( diskaddr * OMTI_DISK_SECTOR_SIZE, SEEK_SET);
- image->fwrite( data_buffer, OMTI_DISK_SECTOR_SIZE);
+ image->fseek(diskaddr * OMTI_DISK_SECTOR_SIZE, SEEK_SET);
+ image->fwrite(data_buffer, OMTI_DISK_SECTOR_SIZE);
- if (diskaddr == diskaddr_ecc_error) {
+ if (diskaddr == m_diskaddr_ecc_error) {
// reset previous ECC error
- diskaddr_ecc_error = 0;
+ m_diskaddr_ecc_error = 0;
}
diskaddr++;
@@ -606,18 +619,18 @@ void omti8621_device::copy_sectors(int32_t dst_addr, int32_t src_addr, uint8_t c
{
device_image_interface *image = our_disks[lun]->m_image;
- LOG2(("copy_sectors lun=%d src_addr=%x dst_addr=%x count=%x", lun, src_addr, dst_addr, count));
+ LOGMASKED(LOG_LEVEL2, "%s: copy_sectors lun=%d src_addr=%x dst_addr=%x count=%x", cpu_context(), lun, src_addr, dst_addr, count);
while (count-- > 0) {
- image->fseek( src_addr * OMTI_DISK_SECTOR_SIZE, SEEK_SET);
- image->fread( &sector_buffer[0], OMTI_DISK_SECTOR_SIZE);
+ image->fseek(src_addr * OMTI_DISK_SECTOR_SIZE, SEEK_SET);
+ image->fread(&m_sector_buffer[0], OMTI_DISK_SECTOR_SIZE);
- image->fseek( dst_addr * OMTI_DISK_SECTOR_SIZE, SEEK_SET);
- image->fwrite( &sector_buffer[0], OMTI_DISK_SECTOR_SIZE);
+ image->fseek(dst_addr * OMTI_DISK_SECTOR_SIZE, SEEK_SET);
+ image->fwrite(&m_sector_buffer[0], OMTI_DISK_SECTOR_SIZE);
- if (dst_addr == diskaddr_ecc_error) {
+ if (dst_addr == m_diskaddr_ecc_error) {
// reset previous ECC error
- diskaddr_ecc_error = 0;
+ m_diskaddr_ecc_error = 0;
}
src_addr++;
@@ -635,29 +648,29 @@ void omti8621_device::format_track(const uint8_t * cdb)
uint32_t disk_addr = get_disk_address(cdb);
uint32_t disk_track = get_disk_track(cdb);
- if (diskaddr_ecc_error == disk_addr) {
+ if (m_diskaddr_ecc_error == disk_addr) {
// reset previous ECC error
- diskaddr_ecc_error = 0;
+ m_diskaddr_ecc_error = 0;
}
- if (diskaddr_format_bad_track == disk_track) {
+ if (m_diskaddr_format_bad_track == disk_track) {
// reset previous bad track formatting
- diskaddr_format_bad_track = 0;
+ m_diskaddr_format_bad_track = 0;
}
- if (alternate_track_address[0] == disk_track) {
+ if (m_alternate_track_address[0] == disk_track) {
// reset source of alternate track address
- alternate_track_address[0] = 0;
+ m_alternate_track_address[0] = 0;
}
- if (alternate_track_address[1] == disk_track) {
+ if (m_alternate_track_address[1] == disk_track) {
// reset alternate track address
- alternate_track_address[1] = 0;
+ m_alternate_track_address[1] = 0;
}
if (check_disk_address(cdb) ) {
if ((cdb[5] & 0x40) == 0) {
- memset(&sector_buffer[0], 0x6C, OMTI_DISK_SECTOR_SIZE * our_disks[lun]->m_sectors);
+ memset(&m_sector_buffer[0], 0x6C, OMTI_DISK_SECTOR_SIZE * our_disks[lun]->m_sectors);
}
write_sectors_to_disk(disk_addr, our_disks[lun]->m_sectors, lun);
}
@@ -696,8 +709,7 @@ void omti8621_device::logerror(Format &&fmt, Params &&... args) const
void omti8621_device::log_command(const uint8_t cdb[], const uint16_t cdb_length)
{
- if (verbose > 0) {
- int i;
+ if (VERBOSE & (LOG_LEVEL1 | LOG_LEVEL2 | LOG_LEVEL3)) {
logerror("%s: OMTI command ", cpu_context());
switch (cdb[0]) {
case OMTI_CMD_TEST_DRIVE_READY: // 0x00
@@ -770,7 +782,7 @@ void omti8621_device::log_command(const uint8_t cdb[], const uint16_t cdb_length
logerror("!!! Unexpected Command !!!");
}
// logerror(" (%02x, length=%02x)", cdb[0], cdb_length);
- for (i = 0; i < cdb_length; i++) {
+ for (int i = 0; i < cdb_length; i++) {
logerror(" %02x", cdb[i]);
}
@@ -795,15 +807,14 @@ void omti8621_device::log_command(const uint8_t cdb[], const uint16_t cdb_length
void omti8621_device::log_data()
{
- if (verbose > 0) {
- int i;
- logerror("%s: OMTI data (length=%02x)", cpu_context(),
- data_length);
- for (i = 0; i < data_length && i < OMTI_DISK_SECTOR_SIZE; i++) {
- logerror(" %02x", data_buffer[i]);
+ if (VERBOSE & LOG_LEVEL1) {
+ logerror("%s: OMTI data (length=%02x)", cpu_context(), m_data_length);
+ uint16_t i;
+ for (i = 0; i < m_data_length && i < OMTI_DISK_SECTOR_SIZE; i++) {
+ logerror(" %02x", m_data_buffer[i]);
}
- if (i < data_length) {
+ if (i < m_data_length) {
logerror(" ...");
}
logerror("\n");
@@ -820,19 +831,19 @@ void omti8621_device::do_command(const uint8_t cdb[], const uint16_t cdb_length)
omti_disk_image_device *disk = our_disks[lun];
int command_duration = 0; // ms
- log_command( cdb, cdb_length);
+ log_command(cdb, cdb_length);
// default to read status and status is successful completion
- omti_state = OMTI_STATE_STATUS;
- status_port |= OMTI_STATUS_IO | OMTI_STATUS_CD;
- command_status = lun ? OMTI_COMMAND_STATUS_LUN : 0;
+ m_omti_state = OMTI_STATE_STATUS;
+ m_status_port |= OMTI_STATUS_IO | OMTI_STATUS_CD;
+ m_command_status = lun ? OMTI_COMMAND_STATUS_LUN : 0;
- if (mask_port & OMTI_MASK_INTE) {
+ if (m_mask_port & OMTI_MASK_INTE) {
set_interrupt(CLEAR_LINE);
}
if (!disk->m_image->exists()) {
- command_status |= OMTI_COMMAND_STATUS_ERROR; // no such drive
+ m_command_status |= OMTI_COMMAND_STATUS_ERROR; // no such drive
}
switch (cdb[0]) {
@@ -847,7 +858,7 @@ void omti8621_device::do_command(const uint8_t cdb[], const uint16_t cdb_length)
break;
case OMTI_CMD_REQUEST_SENSE: // 0x03
- set_data_transfer(sense_data, sizeof(sense_data));
+ set_data_transfer(m_sense_data, sizeof(m_sense_data));
break;
case OMTI_CMD_READ_VERIFY: // 0x05
@@ -859,14 +870,14 @@ void omti8621_device::do_command(const uint8_t cdb[], const uint16_t cdb_length)
break;
case OMTI_CMD_FORMAT_BAD_TRACK: // 0x07
- diskaddr_format_bad_track = get_disk_address(cdb);
+ m_diskaddr_format_bad_track = get_disk_address(cdb);
break;
case OMTI_CMD_READ: // 0x08
if (check_disk_address(cdb)) {
// read data from controller
read_sectors_from_disk(get_disk_address(cdb), cdb[4], lun);
- set_data_transfer(&sector_buffer[0], OMTI_DISK_SECTOR_SIZE*cdb[4]);
+ set_data_transfer(&m_sector_buffer[0], OMTI_DISK_SECTOR_SIZE*cdb[4]);
}
break;
@@ -882,7 +893,7 @@ void omti8621_device::do_command(const uint8_t cdb[], const uint16_t cdb_length)
break;
case OMTI_CMD_READ_SECTOR_BUFFER: // 0x0E
- set_data_transfer(&sector_buffer[0], OMTI_DISK_SECTOR_SIZE*cdb[4]);
+ set_data_transfer(&m_sector_buffer[0], OMTI_DISK_SECTOR_SIZE*cdb[4]);
break;
case OMTI_CMD_WRITE_SECTOR_BUFFER: // 0x0F
@@ -904,8 +915,8 @@ void omti8621_device::do_command(const uint8_t cdb[], const uint16_t cdb_length)
#if 0 // this command seems unused by Domain/OS, and it's unclear what the intent of the code is (it makes some versions of GCC quite unhappy)
case OMTI_CMD_ASSIGN_ALTERNATE_TRACK: // 0x11
log_data();
- alternate_track_address[0] = get_disk_track(cdb);
- alternate_track_address[1] = get_disk_track(alternate_track_buffer-1);
+ m_alternate_track_address[0] = get_disk_track(cdb);
+ m_alternate_track_address[1] = get_disk_track(m_alternate_track_buffer - 1);
break;
#endif
@@ -935,7 +946,7 @@ void omti8621_device::do_command(const uint8_t cdb[], const uint16_t cdb_length)
if (check_disk_address(cdb)) {
// read data from controller
read_sectors_from_disk(get_disk_address(cdb), cdb[4], lun);
- set_data_transfer(&sector_buffer[0], OMTI_DISK_SECTOR_SIZE+6);
+ set_data_transfer(&m_sector_buffer[0], OMTI_DISK_SECTOR_SIZE+6);
}
break;
@@ -945,7 +956,7 @@ void omti8621_device::do_command(const uint8_t cdb[], const uint16_t cdb_length)
uint32_t diskaddr = get_disk_address(cdb);
write_sectors_to_disk(diskaddr, cdb[4], lun);
// this will spoil the ECC code
- diskaddr_ecc_error = diskaddr;
+ m_diskaddr_ecc_error = diskaddr;
}
break;
@@ -956,28 +967,28 @@ void omti8621_device::do_command(const uint8_t cdb[], const uint16_t cdb_length)
case OMTI_CMD_INVALID_COMMAND: // 0xFF
set_sense_data(OMTI_SENSE_CODE_INVALID_COMMAND, cdb);
- command_status |= OMTI_COMMAND_STATUS_ERROR;
+ m_command_status |= OMTI_COMMAND_STATUS_ERROR;
break;
default:
- LOG(("do_command: UNEXPECTED command %02x",cdb[0]));
+ LOGMASKED(LOG_LEVEL0, "%s: do_command: UNEXPECTED command %02x", cpu_context(), cdb[0]);
set_sense_data(OMTI_SENSE_CODE_INVALID_COMMAND, cdb);
- command_status |= OMTI_COMMAND_STATUS_ERROR;
+ m_command_status |= OMTI_COMMAND_STATUS_ERROR;
break;
}
- if (mask_port & OMTI_MASK_INTE) {
-// if (omti_state != OMTI_STATE_STATUS) {
-// LOG(("do_command: UNEXPECTED omti_state %02x",omti_state));
+ if (m_mask_port & OMTI_MASK_INTE) {
+// if (m_omti_state != OMTI_STATE_STATUS) {
+// LOGMASKED(LOG_LEVEL0, "%s: do_command: UNEXPECTED omti_state %02x", cpu_context(), m_omti_state));
// }
- status_port |= OMTI_STATUS_IREQ;
+ m_status_port |= OMTI_STATUS_IREQ;
if (command_duration == 0)
{
set_interrupt(ASSERT_LINE);
}
else
{
- // FIXME: should delay omti_state and status_port as well
+ // FIXME: should delay m_omti_state and m_status_port as well
m_timer->adjust(attotime::from_msec(command_duration), 0);
}
}
@@ -999,16 +1010,16 @@ uint8_t omti8621_device::get_command_length(uint8_t command_byte)
uint16_t omti8621_device::get_data()
{
uint16_t data = 0xff;
- if (data_index < data_length) {
- data = data_buffer[data_index++];
- data |= data_buffer[data_index++] << 8;
- if (data_index >= data_length) {
- omti_state = OMTI_STATE_STATUS;
- status_port |= OMTI_STATUS_IO | OMTI_STATUS_CD;
+ if (m_data_index < m_data_length) {
+ data = m_data_buffer[m_data_index++];
+ data |= m_data_buffer[m_data_index++] << 8;
+ if (m_data_index >= m_data_length) {
+ m_omti_state = OMTI_STATE_STATUS;
+ m_status_port |= OMTI_STATUS_IO | OMTI_STATUS_CD;
log_data();
}
} else {
- LOG(("UNEXPECTED reading OMTI 8621 data (buffer length exceeded)"));
+ LOGMASKED(LOG_LEVEL0, "%s: UNEXPECTED reading OMTI 8621 data (buffer length exceeded)", cpu_context());
}
return data;
}
@@ -1019,14 +1030,14 @@ uint16_t omti8621_device::get_data()
void omti8621_device::set_data(uint16_t data)
{
- if (data_index < data_length) {
- data_buffer[data_index++] = data & 0xff;
- data_buffer[data_index++] = data >> 8;
- if (data_index >= data_length) {
- do_command(command_buffer, command_index);
+ if (m_data_index < m_data_length) {
+ m_data_buffer[m_data_index++] = data & 0xff;
+ m_data_buffer[m_data_index++] = data >> 8;
+ if (m_data_index >= m_data_length) {
+ do_command(m_command_buffer, m_command_index);
}
} else {
- LOG(("UNEXPECTED writing OMTI 8621 data (buffer length exceeded)"));
+ LOGMASKED(LOG_LEVEL0, "%s: UNEXPECTED writing OMTI 8621 data (buffer length exceeded)", cpu_context());
}
}
@@ -1057,91 +1068,89 @@ void omti8621_device::write8(offs_t offset, uint8_t data)
switch (offset)
{
case OMTI_PORT_DATA_OUT: // 0x00
- switch (omti_state) {
+ switch (m_omti_state) {
case OMTI_STATE_COMMAND:
- LOG2(("writing OMTI 8621 Command Register at offset %02x = %02x", offset, data));
- if (command_index == 0) {
- command_length = get_command_length(data);
+ LOGMASKED(LOG_LEVEL2, "%s: writing OMTI 8621 Command Register at offset %02x = %02x", cpu_context(), offset, data);
+ if (m_command_index == 0) {
+ m_command_length = get_command_length(data);
}
- if (command_index < command_length) {
- command_buffer[command_index++] = data;
+ if (m_command_index < m_command_length) {
+ m_command_buffer[m_command_index++] = data;
} else {
- LOG(("UNEXPECTED writing OMTI 8621 Data Register at offset %02x = %02x (command length exceeded)", offset, data));
+ LOGMASKED(LOG_LEVEL0, "%s: UNEXPECTED writing OMTI 8621 Data Register at offset %02x = %02x (command length exceeded)", cpu_context(), offset, data);
}
- if (command_index == command_length) {
- switch (command_buffer[0]) {
+ if (m_command_index == m_command_length) {
+ switch (m_command_buffer[0]) {
case OMTI_CMD_WRITE: // 0x0A
// TODO: check diskaddr
- // Fall through
+ [[fallthrough]];
case OMTI_CMD_WRITE_SECTOR_BUFFER: // 0x0F
- set_data_transfer(&sector_buffer[0],
- OMTI_DISK_SECTOR_SIZE * command_buffer[4]);
- status_port &= ~OMTI_STATUS_IO;
+ set_data_transfer(&m_sector_buffer[0], OMTI_DISK_SECTOR_SIZE * m_command_buffer[4]);
+ m_status_port &= ~OMTI_STATUS_IO;
break;
case OMTI_CMD_ASSIGN_ALTERNATE_TRACK: // 0x11
- set_data_transfer(alternate_track_buffer, sizeof(alternate_track_buffer));
- status_port &= ~OMTI_STATUS_IO;
+ set_data_transfer(m_alternate_track_buffer, sizeof(m_alternate_track_buffer));
+ m_status_port &= ~OMTI_STATUS_IO;
break;
case OMTI_CMD_WRITE_LONG: // 0xE6
// TODO: check diskaddr
- set_data_transfer(&sector_buffer[0],
- (OMTI_DISK_SECTOR_SIZE +6) * command_buffer[4]);
- status_port &= ~OMTI_STATUS_IO;
+ set_data_transfer(&m_sector_buffer[0], (OMTI_DISK_SECTOR_SIZE +6) * m_command_buffer[4]);
+ m_status_port &= ~OMTI_STATUS_IO;
break;
default:
- do_command(command_buffer, command_index);
+ do_command(m_command_buffer, m_command_index);
break;
}
}
break;
case OMTI_STATE_DATA:
- LOG(("UNEXPECTED: writing OMTI 8621 Data Register at offset %02x = %02x", offset, data));
+ LOGMASKED(LOG_LEVEL0, "%s: UNEXPECTED: writing OMTI 8621 Data Register at offset %02x = %02x", cpu_context(), offset, data);
break;
default:
- LOG(("UNEXPECTED writing OMTI 8621 Data Register at offset %02x = %02x (omti state = %02x)", offset, data, omti_state));
+ LOGMASKED(LOG_LEVEL0, "%s: UNEXPECTED writing OMTI 8621 Data Register at offset %02x = %02x (omti state = %02x)", cpu_context(), offset, data, m_omti_state);
break;
}
break;
case OMTI_PORT_RESET: // 0x01
- LOG2(("writing OMTI 8621 Reset Register at offset %02x = %02x", offset, data));
+ LOGMASKED(LOG_LEVEL2, "%s: writing OMTI 8621 Reset Register at offset %02x = %02x", cpu_context(), offset, data);
device_reset();
break;
case OMTI_PORT_SELECT: // 0x02
- LOG2(("writing OMTI 8621 Select Register at offset %02x = %02x (omti state = %02x)", offset, data, omti_state));
- omti_state = OMTI_STATE_COMMAND;
+ LOGMASKED(LOG_LEVEL2, "%s: writing OMTI 8621 Select Register at offset %02x = %02x (omti state = %02x)", cpu_context(), offset, data, m_omti_state);
+ m_omti_state = OMTI_STATE_COMMAND;
- status_port |= OMTI_STATUS_BUSY | OMTI_STATUS_REQ | OMTI_STATUS_CD;
- status_port &= ~OMTI_STATUS_IO;
+ m_status_port |= OMTI_STATUS_BUSY | OMTI_STATUS_REQ | OMTI_STATUS_CD;
+ m_status_port &= ~OMTI_STATUS_IO;
- command_status = 0;
- command_index = 0;
+ m_command_status = 0;
+ m_command_index = 0;
break;
case OMTI_PORT_MASK: // 0x03
- LOG2(("writing OMTI 8621 Mask Register at offset %02x = %02x", offset, data));
- mask_port = data;
+ LOGMASKED(LOG_LEVEL2, "%s: writing OMTI 8621 Mask Register at offset %02x = %02x", cpu_context(), offset, data);
+ m_mask_port = data;
if ((data & OMTI_MASK_INTE) == 0) {
- status_port &= ~OMTI_STATUS_IREQ;
+ m_status_port &= ~OMTI_STATUS_IREQ;
set_interrupt(CLEAR_LINE);
}
if ((data & OMTI_MASK_DMAE) == 0) {
- status_port &= ~OMTI_STATUS_DREQ;
+ m_status_port &= ~OMTI_STATUS_DREQ;
}
break;
default:
- LOG(("UNEXPECTED writing OMTI 8621 Register at offset %02x = %02x", offset, data));
+ LOGMASKED(LOG_LEVEL0, "%s: UNEXPECTED writing OMTI 8621 Register at offset %02x = %02x", cpu_context(), offset, data);
break;
}
}
@@ -1166,69 +1175,64 @@ uint8_t omti8621_device::read8(offs_t offset)
switch (offset) {
case OMTI_PORT_DATA_IN: // 0x00
- if (status_port & OMTI_STATUS_CD)
+ if (m_status_port & OMTI_STATUS_CD)
{
- data = command_status;
- switch (omti_state)
+ data = m_command_status;
+ switch (m_omti_state)
{
case OMTI_STATE_COMMAND:
- LOG2(("reading OMTI 8621 Data Status Register 1 at offset %02x = %02x (omti state = %02x)", offset, data, omti_state));
+ LOGMASKED(LOG_LEVEL2, "%s: reading OMTI 8621 Data Status Register 1 at offset %02x = %02x (omti state = %02x)", cpu_context(), offset, data, m_omti_state);
break;
case OMTI_STATE_STATUS:
- omti_state = OMTI_STATE_IDLE;
- status_port &= ~(OMTI_STATUS_BUSY | OMTI_STATUS_CD | OMTI_STATUS_IO | OMTI_STATUS_REQ);
- LOG2(("reading OMTI 8621 Data Status Register 2 at offset %02x = %02x", offset, data));
+ m_omti_state = OMTI_STATE_IDLE;
+ m_status_port &= ~(OMTI_STATUS_BUSY | OMTI_STATUS_CD | OMTI_STATUS_IO | OMTI_STATUS_REQ);
+ LOGMASKED(LOG_LEVEL2, "%s: reading OMTI 8621 Data Status Register 2 at offset %02x = %02x", cpu_context(), offset, data);
break;
default:
- LOG(("UNEXPECTED reading OMTI 8621 Data Status Register 3 at offset %02x = %02x (omti state = %02x)", offset, data, omti_state));
+ LOGMASKED(LOG_LEVEL0, "%s: UNEXPECTED reading OMTI 8621 Data Status Register 3 at offset %02x = %02x (omti state = %02x)", cpu_context(), offset, data, m_omti_state);
break;
}
}
else
{
- LOG(("UNEXPECTED reading OMTI 8621 Data Register 4 at offset %02x = %02x (status bit C/D = 0)", offset, data));
+ LOGMASKED(LOG_LEVEL0, "%s: UNEXPECTED reading OMTI 8621 Data Register 4 at offset %02x = %02x (status bit C/D = 0)", cpu_context(), offset, data);
}
break;
case OMTI_PORT_STATUS: // 0x01
- data = status_port;
+ data = m_status_port;
// omit excessive logging
if (data != last_data)
{
- LOG2(("reading OMTI 8621 Status Register 5 at offset %02x = %02x", offset, data));
+ LOGMASKED(LOG_LEVEL2, "%s: reading OMTI 8621 Status Register 5 at offset %02x = %02x", cpu_context(), offset, data);
// last_data = data;
}
break;
case OMTI_PORT_CONFIG: // 0x02
- data = config_port;
- LOG2(("reading OMTI 8621 Configuration Register at offset %02x = %02x", offset, data));
+ data = m_config_port;
+ LOGMASKED(LOG_LEVEL2, "%s: reading OMTI 8621 Configuration Register at offset %02x = %02x", cpu_context(), offset, data);
break;
case OMTI_PORT_MASK: // 0x03
- data = mask_port ;
+ data = m_mask_port;
// win.dex will update the mask register with read-modify-write
- // LOG2(("reading OMTI 8621 Mask Register at offset %02x = %02x (UNEXPECTED!)", offset, data));
+ // LOGMASKED(LOG_LEVEL2, "%s: reading OMTI 8621 Mask Register at offset %02x = %02x (UNEXPECTED!)", cpu_context(), offset, data);
break;
default:
- LOG(("UNEXPECTED reading OMTI 8621 Register at offset %02x = %02x", offset, data));
+ LOGMASKED(LOG_LEVEL0, "%s: UNEXPECTED reading OMTI 8621 Register at offset %02x = %02x", cpu_context(), offset, data);
break;
}
return data;
}
-void omti8621_device::set_verbose(int on_off)
-{
- verbose = on_off == 0 ? 0 : VERBOSE > 1 ? VERBOSE : 1;
-}
-
/***************************************************************************
get_sector - get sector diskaddr of logical unit lun into data_buffer
***************************************************************************/
-uint32_t omti8621_apollo_device::get_sector(int32_t diskaddr, uint8_t *data_buffer, uint32_t length, uint8_t lun)
+uint32_t omti8621_apollo_device::get_sector(int32_t diskaddr, uint8_t *buffer, uint32_t length, uint8_t lun)
{
omti_disk_image_device *disk = our_disks[lun];
@@ -1238,13 +1242,13 @@ uint32_t omti8621_apollo_device::get_sector(int32_t diskaddr, uint8_t *data_buff
}
else
{
-// LOG1(("omti8621_get_sector %x on lun %d", diskaddr, lun));
+// LOGMASKED(LOG_LEVEL1, "%s: omti8621_get_sector %x on lun %d", cpu_context(), diskaddr, lun);
// restrict length to size of 1 sector (i.e. 1024 Byte)
length = length < OMTI_DISK_SECTOR_SIZE ? length : OMTI_DISK_SECTOR_SIZE;
disk->m_image->fseek(diskaddr * OMTI_DISK_SECTOR_SIZE, SEEK_SET);
- disk->m_image->fread(data_buffer, length);
+ disk->m_image->fread(buffer, length);
return length;
}
@@ -1256,17 +1260,17 @@ uint32_t omti8621_apollo_device::get_sector(int32_t diskaddr, uint8_t *data_buff
void omti8621_device::set_jumper(uint16_t disk_type)
{
- LOG1(("set_jumper: disk type=%x", disk_type));
+ LOGMASKED(LOG_LEVEL1, "%s: set_jumper: disk type=%x", cpu_context(), disk_type);
switch (disk_type)
{
case OMTI_DISK_TYPE_348_MB: // Maxtor 380 MB (348-MB FA formatted)
- jumper = OMTI_CONFIG_W22 | OMTI_CONFIG_W23;
+ m_jumper = OMTI_CONFIG_W22 | OMTI_CONFIG_W23;
break;
case OMTI_DISK_TYPE_155_MB: // Micropolis 170 MB (155-MB formatted)
default:
- jumper = OMTI_CONFIG_W20;
+ m_jumper = OMTI_CONFIG_W20;
break;
}
}
diff --git a/src/devices/bus/isa/omti8621.h b/src/devices/bus/isa/omti8621.h
index ccc4ae0785b..3e5cce1c59a 100644
--- a/src/devices/bus/isa/omti8621.h
+++ b/src/devices/bus/isa/omti8621.h
@@ -33,8 +33,6 @@ public:
uint16_t read(offs_t offset, uint16_t mem_mask = 0xffff);
void write(offs_t offset, uint16_t data, uint16_t mem_mask = 0xffff);
- static void set_verbose(int on_off);
-
protected:
static constexpr unsigned OMTI_MAX_LUN = 1;
static constexpr unsigned CDB_SIZE = 10;
@@ -50,7 +48,6 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual const tiny_rom_entry *device_rom_region() const override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_add_mconfig(machine_config &config) override;
virtual ioport_constructor device_input_ports() const override;
@@ -59,7 +56,9 @@ protected:
virtual void dack_line_w(int line, int state) override;
virtual void eop_w(int state) override;
- void set_interrupt(enum line_state line_state);
+ void set_interrupt(line_state state);
+
+ TIMER_CALLBACK_MEMBER(trigger_interrupt);
required_device<upd765a_device> m_fdc;
optional_device_array<floppy_connector, 2> m_floppy;
@@ -82,34 +81,34 @@ private:
void fdc_map(address_map &map);
- uint16_t jumper;
+ uint16_t m_jumper;
- uint8_t omti_state;
+ uint8_t m_omti_state;
- uint8_t status_port;
- uint8_t config_port;
- uint8_t mask_port;
+ uint8_t m_status_port;
+ uint8_t m_config_port;
+ uint8_t m_mask_port;
// command descriptor block
- uint8_t command_buffer[CDB_SIZE];
- int command_length;
- int command_index;
- int command_status;
+ uint8_t m_command_buffer[CDB_SIZE];
+ uint8_t m_command_length;
+ uint16_t m_command_index;
+ uint8_t m_command_status;
// data buffer
- std::vector<uint8_t> sector_buffer;
- uint8_t *data_buffer;
- int data_length;
- int data_index;
+ std::vector<uint8_t> m_sector_buffer;
+ uint8_t *m_data_buffer;
+ uint16_t m_data_length;
+ uint16_t m_data_index;
// sense data
- uint8_t sense_data[4];
+ uint8_t m_sense_data[4];
// these are used only to satisfy dex
- uint32_t diskaddr_ecc_error;
- uint32_t diskaddr_format_bad_track;
- uint8_t alternate_track_buffer[4];
- uint32_t alternate_track_address[2];
+ uint32_t m_diskaddr_ecc_error;
+ uint32_t m_diskaddr_format_bad_track;
+ uint8_t m_alternate_track_buffer[4];
+ uint32_t m_alternate_track_address[2];
emu_timer *m_timer;
@@ -162,7 +161,7 @@ public:
omti8621_apollo_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// get sector diskaddr of logical unit lun into data_buffer
- uint32_t get_sector(int32_t diskaddr, uint8_t *data_buffer, uint32_t length, uint8_t lun);
+ uint32_t get_sector(int32_t diskaddr, uint8_t *buffer, uint32_t length, uint8_t lun);
protected:
virtual void device_add_mconfig(machine_config &config) override;
diff --git a/src/devices/bus/isa/s3virge.cpp b/src/devices/bus/isa/s3virge.cpp
index 0f6edd65976..63930b308b1 100644
--- a/src/devices/bus/isa/s3virge.cpp
+++ b/src/devices/bus/isa/s3virge.cpp
@@ -83,8 +83,8 @@ void s3virge_vga_device::device_start()
save_item(vga.sequencer.data,"Sequencer Registers");
save_item(vga.attribute.data,"Attribute Registers");
- m_vblank_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vga_device::vblank_timer_cb),this));
- m_draw_timer = timer_alloc(TIMER_DRAW_STEP);
+ m_vblank_timer = timer_alloc(FUNC(vga_device::vblank_timer_cb), this);
+ m_draw_timer = timer_alloc(FUNC(s3virge_vga_device::draw_step_tick), this);
memset(&s3, 0, sizeof(s3));
memset(&s3virge, 0, sizeof(s3virge));
@@ -1427,35 +1427,96 @@ void s3virge_vga_device::bitblt_monosrc_step()
s3virge.s3d.bitblt_step_count++;
}
-void s3virge_vga_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(s3virge_vga_device::draw_step_tick)
{
// TODO: S3D state timing
- if(id == TIMER_DRAW_STEP)
+ switch(s3virge.s3d.state)
{
- switch(s3virge.s3d.state)
- {
- case S3D_STATE_IDLE:
- m_draw_timer->adjust(attotime::zero);
- break;
- case S3D_STATE_2DLINE:
- line2d_step();
- break;
- case S3D_STATE_2DPOLY:
- poly2d_step();
- break;
- case S3D_STATE_3DLINE:
- line3d_step();
- break;
- case S3D_STATE_3DPOLY:
- poly3d_step();
- break;
- case S3D_STATE_BITBLT:
- bitblt_step();
- break;
- }
+ case S3D_STATE_IDLE:
+ m_draw_timer->adjust(attotime::zero);
+ break;
+ case S3D_STATE_2DLINE:
+ line2d_step();
+ break;
+ case S3D_STATE_2DPOLY:
+ poly2d_step();
+ break;
+ case S3D_STATE_3DLINE:
+ line3d_step();
+ break;
+ case S3D_STATE_3DPOLY:
+ poly3d_step();
+ break;
+ case S3D_STATE_BITBLT:
+ bitblt_step();
+ break;
}
}
+inline void s3virge_vga_device::write_pixel32(uint32_t base, uint16_t x, uint16_t y, uint32_t val)
+{
+ if(s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x00000002)
+ if(x < s3virge.s3d.clip_l || x > s3virge.s3d.clip_r || y < s3virge.s3d.clip_t || y > s3virge.s3d.clip_b)
+ return;
+ vga.memory[(base + (x*4) + (y*dest_stride())) % vga.svga_intf.vram_size] = val & 0xff;
+ vga.memory[(base + 1 + (x*4) + (y*dest_stride())) % vga.svga_intf.vram_size] = (val >> 8) & 0xff;
+ vga.memory[(base + 2 + (x*4) + (y*dest_stride())) % vga.svga_intf.vram_size] = (val >> 16) & 0xff;
+ vga.memory[(base + 3 + (x*4) + (y*dest_stride())) % vga.svga_intf.vram_size] = (val >> 24) & 0xff;
+}
+
+inline void s3virge_vga_device::write_pixel24(uint32_t base, uint16_t x, uint16_t y, uint32_t val)
+{
+ if(s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x00000002)
+ if(x < s3virge.s3d.clip_l || x > s3virge.s3d.clip_r || y < s3virge.s3d.clip_t || y > s3virge.s3d.clip_b)
+ return;
+ vga.memory[(base + (x*3) + (y*dest_stride())) % vga.svga_intf.vram_size] = val & 0xff;
+ vga.memory[(base + 1 + (x*3) + (y*dest_stride())) % vga.svga_intf.vram_size] = (val >> 8) & 0xff;
+ vga.memory[(base + 2 + (x*3) + (y*dest_stride())) % vga.svga_intf.vram_size] = (val >> 16) & 0xff;
+}
+
+inline void s3virge_vga_device::write_pixel16(uint32_t base, uint16_t x, uint16_t y, uint16_t val)
+{
+ if(s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x00000002)
+ if(x < s3virge.s3d.clip_l || x > s3virge.s3d.clip_r || y < s3virge.s3d.clip_t || y > s3virge.s3d.clip_b)
+ return;
+ vga.memory[(base + (x*2) + (y*dest_stride())) % vga.svga_intf.vram_size] = val & 0xff;
+ vga.memory[(base + 1 + (x*2) + (y*dest_stride())) % vga.svga_intf.vram_size] = (val >> 8) & 0xff;
+}
+
+inline void s3virge_vga_device::write_pixel8(uint32_t base, uint16_t x, uint16_t y, uint8_t val)
+{
+ if(s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x00000002)
+ if(x < s3virge.s3d.clip_l || x > s3virge.s3d.clip_r || y < s3virge.s3d.clip_t || y > s3virge.s3d.clip_b)
+ return;
+ vga.memory[(base + x + (y*dest_stride())) % vga.svga_intf.vram_size] = val;
+}
+
+inline uint32_t s3virge_vga_device::read_pixel32(uint32_t base, uint16_t x, uint16_t y)
+{
+ return (vga.memory[(base + (x*4) + (y*dest_stride())) % vga.svga_intf.vram_size] << 24) |
+ (vga.memory[(base + 1 + (x*4) + (y*dest_stride())) % vga.svga_intf.vram_size] << 16) |
+ (vga.memory[(base + 2 + (x*4) + (y*dest_stride())) % vga.svga_intf.vram_size] << 8) |
+ vga.memory[(base + 3 + (x*4) + (y*dest_stride())) % vga.svga_intf.vram_size];
+}
+
+inline uint32_t s3virge_vga_device::read_pixel24(uint32_t base, uint16_t x, uint16_t y)
+{
+ return (vga.memory[(base + (x*3) + (y*dest_stride())) % vga.svga_intf.vram_size]) |
+ (vga.memory[(base + 1 + (x*3) + (y*dest_stride())) % vga.svga_intf.vram_size] << 8) |
+ (vga.memory[(base + 2 + (x*3) + (y*dest_stride())) % vga.svga_intf.vram_size] << 16);
+}
+
+inline uint16_t s3virge_vga_device::read_pixel16(uint32_t base, uint16_t x, uint16_t y)
+{
+ return (vga.memory[(base + (x*2) + (y*dest_stride()) % vga.svga_intf.vram_size)]) |
+ (vga.memory[(base + 1 + (x*2) + (y*dest_stride())) % vga.svga_intf.vram_size] << 8);
+}
+
+inline uint8_t s3virge_vga_device::read_pixel8(uint32_t base, uint16_t x, uint16_t y)
+{
+ return vga.memory[(base + x + (y*dest_stride())) % vga.svga_intf.vram_size];
+}
+
// 2D command register format - A500 (BitBLT), A900 (2D line), AD00 (2D Polygon)
// bit 0 - Autoexecute, if set command is executed when the highest relevant register is written to (A50C / A97C / AD7C)
// bit 1 - Enable hardware clipping
diff --git a/src/devices/bus/isa/s3virge.h b/src/devices/bus/isa/s3virge.h
index 89023e3bafc..aec31340d7b 100644
--- a/src/devices/bus/isa/s3virge.h
+++ b/src/devices/bus/isa/s3virge.h
@@ -74,12 +74,6 @@ public:
ibm8514a_device* get_8514() { fatalerror("s3virge requested non-existent 8514/A device\n"); return nullptr; }
- enum
- {
- TIMER_DRAW_STEP = 10
- };
-
-
protected:
s3virge_vga_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
@@ -184,59 +178,17 @@ protected:
} s3d;
} s3virge;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
- void write_pixel32(uint32_t base, uint16_t x, uint16_t y, uint32_t val)
- {
- if(s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x00000002)
- if(x < s3virge.s3d.clip_l || x > s3virge.s3d.clip_r || y < s3virge.s3d.clip_t || y > s3virge.s3d.clip_b)
- return;
- vga.memory[(base + (x*4) + (y*dest_stride())) % vga.svga_intf.vram_size] = val & 0xff;
- vga.memory[(base + 1 + (x*4) + (y*dest_stride())) % vga.svga_intf.vram_size] = (val >> 8) & 0xff;
- vga.memory[(base + 2 + (x*4) + (y*dest_stride())) % vga.svga_intf.vram_size] = (val >> 16) & 0xff;
- vga.memory[(base + 3 + (x*4) + (y*dest_stride())) % vga.svga_intf.vram_size] = (val >> 24) & 0xff;
- }
- void write_pixel24(uint32_t base, uint16_t x, uint16_t y, uint32_t val)
- {
- if(s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x00000002)
- if(x < s3virge.s3d.clip_l || x > s3virge.s3d.clip_r || y < s3virge.s3d.clip_t || y > s3virge.s3d.clip_b)
- return;
- vga.memory[(base + (x*3) + (y*dest_stride())) % vga.svga_intf.vram_size] = val & 0xff;
- vga.memory[(base + 1 + (x*3) + (y*dest_stride())) % vga.svga_intf.vram_size] = (val >> 8) & 0xff;
- vga.memory[(base + 2 + (x*3) + (y*dest_stride())) % vga.svga_intf.vram_size] = (val >> 16) & 0xff;
- }
- void write_pixel16(uint32_t base, uint16_t x, uint16_t y, uint16_t val)
- {
- if(s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x00000002)
- if(x < s3virge.s3d.clip_l || x > s3virge.s3d.clip_r || y < s3virge.s3d.clip_t || y > s3virge.s3d.clip_b)
- return;
- vga.memory[(base + (x*2) + (y*dest_stride())) % vga.svga_intf.vram_size] = val & 0xff;
- vga.memory[(base + 1 + (x*2) + (y*dest_stride())) % vga.svga_intf.vram_size] = (val >> 8) & 0xff;
- }
- void write_pixel8(uint32_t base, uint16_t x, uint16_t y, uint8_t val)
- {
- if(s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x00000002)
- if(x < s3virge.s3d.clip_l || x > s3virge.s3d.clip_r || y < s3virge.s3d.clip_t || y > s3virge.s3d.clip_b)
- return;
- vga.memory[(base + x + (y*dest_stride())) % vga.svga_intf.vram_size] = val;
- }
- uint32_t read_pixel32(uint32_t base, uint16_t x, uint16_t y)
- {
- return (vga.memory[(base + (x*4) + (y*dest_stride())) % vga.svga_intf.vram_size] << 24) | (vga.memory[(base + 1 + (x*4) + (y*dest_stride())) % vga.svga_intf.vram_size] << 16)
- | (vga.memory[(base + 2 + (x*4) + (y*dest_stride())) % vga.svga_intf.vram_size] << 8) | vga.memory[(base + 3 + (x*4) + (y*dest_stride())) % vga.svga_intf.vram_size];
- }
- uint32_t read_pixel24(uint32_t base, uint16_t x, uint16_t y)
- {
- return (vga.memory[(base + (x*3) + (y*dest_stride())) % vga.svga_intf.vram_size]) | (vga.memory[(base + 1 + (x*3) + (y*dest_stride())) % vga.svga_intf.vram_size] << 8)
- | (vga.memory[(base + 2 + (x*3) + (y*dest_stride())) % vga.svga_intf.vram_size] << 16);
- }
- uint16_t read_pixel16(uint32_t base, uint16_t x, uint16_t y)
- {
- return (vga.memory[(base + (x*2) + (y*dest_stride()) % vga.svga_intf.vram_size)]) | (vga.memory[(base + 1 + (x*2) + (y*dest_stride())) % vga.svga_intf.vram_size] << 8);
- }
- uint8_t read_pixel8(uint32_t base, uint16_t x, uint16_t y)
- {
- return vga.memory[(base + x + (y*dest_stride())) % vga.svga_intf.vram_size];
- }
+ TIMER_CALLBACK_MEMBER(draw_step_tick);
+
+ inline void write_pixel32(uint32_t base, uint16_t x, uint16_t y, uint32_t val);
+ inline void write_pixel24(uint32_t base, uint16_t x, uint16_t y, uint32_t val);
+ inline void write_pixel16(uint32_t base, uint16_t x, uint16_t y, uint16_t val);
+ inline void write_pixel8(uint32_t base, uint16_t x, uint16_t y, uint8_t val);
+ inline uint32_t read_pixel32(uint32_t base, uint16_t x, uint16_t y);
+ inline uint32_t read_pixel24(uint32_t base, uint16_t x, uint16_t y);
+ inline uint16_t read_pixel16(uint32_t base, uint16_t x, uint16_t y);
+ inline uint8_t read_pixel8(uint32_t base, uint16_t x, uint16_t y);
+
uint32_t GetROP(uint8_t rop, uint32_t src, uint32_t dst, uint32_t pat);
bool advance_pixel();
diff --git a/src/devices/bus/isa/sb16.cpp b/src/devices/bus/isa/sb16.cpp
index 25fbd3a51a5..333703f2cfc 100644
--- a/src/devices/bus/isa/sb16.cpp
+++ b/src/devices/bus/isa/sb16.cpp
@@ -717,7 +717,7 @@ void sb16_lle_device::device_start()
m_isa->install_device(0x0228, 0x0229, read8sm_delegate(ymf262, FUNC(ymf262_device::read)), write8sm_delegate(ymf262, FUNC(ymf262_device::write)));
m_isa->set_dma_channel(1, this, false);
m_isa->set_dma_channel(5, this, false);
- m_timer = timer_alloc();
+ m_timer = timer_alloc(FUNC(sb16_lle_device::timer_tick), this);
}
@@ -742,7 +742,7 @@ void sb16_lle_device::device_reset()
m_dma8_done = m_dma16_done = false;
}
-void sb16_lle_device::device_timer(emu_timer &timer, device_timer_id tid, int param)
+TIMER_CALLBACK_MEMBER(sb16_lle_device::timer_tick)
{
uint16_t dacl = 0, dacr = 0, adcl = 0, adcr = 0;
if(m_mode & 2)
diff --git a/src/devices/bus/isa/sb16.h b/src/devices/bus/isa/sb16.h
index 5e7325a2e1b..8710574ba85 100644
--- a/src/devices/bus/isa/sb16.h
+++ b/src/devices/bus/isa/sb16.h
@@ -27,8 +27,6 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
// optional information overrides
virtual const tiny_rom_entry *device_rom_region() const override;
virtual void device_add_mconfig(machine_config &config) override;
@@ -88,6 +86,8 @@ private:
void control_timer(bool start);
+ TIMER_CALLBACK_MEMBER(timer_tick);
+
required_device<dac_word_interface> m_ldac;
required_device<dac_word_interface> m_rdac;
required_device<pc_joy_device> m_joy;
diff --git a/src/devices/bus/isa/sblaster.cpp b/src/devices/bus/isa/sblaster.cpp
index 53eadc6aa99..33905e05da3 100644
--- a/src/devices/bus/isa/sblaster.cpp
+++ b/src/devices/bus/isa/sblaster.cpp
@@ -1341,7 +1341,7 @@ void isa16_sblaster16_device::device_start()
void sb_device::device_start()
{
- m_timer = timer_alloc(0);
+ m_timer = timer_alloc(FUNC(sb_device::timer_tick), this);
save_item(NAME(m_dack_out));
save_item(NAME(m_onebyte_midi));
@@ -1559,11 +1559,8 @@ void sb_device::dack_w(int line, uint8_t data)
}
}
-void sb_device::device_timer(emu_timer &timer, device_timer_id tid, int param)
+TIMER_CALLBACK_MEMBER(sb_device::timer_tick)
{
- if (tid)
- return;
-
// printf("DMA timer expire\n");
uint16_t lsample, rsample;
switch (m_dsp.flags) {
diff --git a/src/devices/bus/isa/sblaster.h b/src/devices/bus/isa/sblaster.h
index 7d5d5775f91..f09f05957be 100644
--- a/src/devices/bus/isa/sblaster.h
+++ b/src/devices/bus/isa/sblaster.h
@@ -110,13 +110,13 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
+
uint8_t dack_r(int line);
void dack_w(int line, uint8_t data);
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void drq16_w(int state) { }
virtual void drq_w(int state) { }
virtual void irq_w(int state, int source) { }
- virtual void mixer_reset() {}
+ virtual void mixer_reset() { }
void adpcm_decode(uint8_t sample, int size);
// serial overrides
@@ -126,6 +126,8 @@ protected:
static constexpr unsigned MIDI_RING_SIZE = 2048;
+ TIMER_CALLBACK_MEMBER(timer_tick);
+
required_device<dac_16bit_r2r_device> m_ldac;
required_device<dac_16bit_r2r_device> m_rdac;
required_device<pc_joy_device> m_joy;
diff --git a/src/devices/bus/isa/sc499.cpp b/src/devices/bus/isa/sc499.cpp
index 77e3497c7f8..e27b85d7fb8 100644
--- a/src/devices/bus/isa/sc499.cpp
+++ b/src/devices/bus/isa/sc499.cpp
@@ -17,15 +17,13 @@
#include "emu.h"
#include "sc499.h"
+#define LOG_LEVEL0 (0x1U << 1)
+#define LOG_LEVEL1 (0x3U << 1)
+#define LOG_LEVEL2 (0x7U << 1)
+#define LOG_LEVEL3 (0xfU << 1)
-#define VERBOSE 0
-
-static int verbose = VERBOSE;
-
-#define LOG(x) { logerror ("%s: ", cpu_context()); logerror x; logerror ("\n"); }
-#define LOG1(x) { if (verbose > 0) LOG(x)}
-#define LOG2(x) { if (verbose > 1) LOG(x)}
-#define LOG3(x) { if (verbose > 2) LOG(x)}
+#define VERBOSE (LOG_LEVEL0)
+#include "logmacro.h"
#define SC499_CTAPE_TAG "sc499_ctape"
DECLARE_DEVICE_TYPE(SC499_CTAPE, sc499_ctape_image_device)
@@ -332,20 +330,20 @@ void sc499_device::device_start()
{
set_isa_device();
- LOG1(("start sc499"));
+ LOGMASKED(LOG_LEVEL1, "%s: start sc499", cpu_context());
- m_timer = timer_alloc(0);
- m_timer1 = timer_alloc(1);
+ m_timer = timer_alloc(FUNC(sc499_device::timer_func), this);
+ m_timer1 = timer_alloc(FUNC(sc499_device::timer_func), this);
m_installed = false;
if (!m_image->is_open())
{
- LOG2(("start sc499: no cartridge tape"));
+ LOGMASKED(LOG_LEVEL2, "%s: start sc499: no cartridge tape", cpu_context());
}
else
{
- LOG2(("start sc499: cartridge tape image is %s", m_image->filename()));
+ LOGMASKED(LOG_LEVEL2, "%s: start sc499: cartridge tape image is %s", cpu_context(), m_image->filename());
}
m_ctape_block_buffer.resize(SC499_CTAPE_BLOCK_SIZE);
@@ -410,16 +408,6 @@ std::string sc499_device::cpu_context() const
}
/*-------------------------------------------------
- logerror - log an error message (w/o device tags)
- -------------------------------------------------*/
-
-template <typename Format, typename... Params>
-void sc499_device::logerror(Format &&fmt, Params &&... args) const
-{
- machine().logerror(std::forward<Format>(fmt), std::forward<Params>(args)...);
-}
-
-/*-------------------------------------------------
tape_status_clear - clear bits in tape status
-------------------------------------------------*/
@@ -472,7 +460,7 @@ void sc499_device::check_tape()
m_ctape_block_count = (uint32_t)((m_image_length + SC499_CTAPE_BLOCK_SIZE - 1) / SC499_CTAPE_BLOCK_SIZE);
}
- LOG1(("check_tape: tape image is %s with %d blocks", m_image->filename(), m_ctape_block_count));
+ LOGMASKED(LOG_LEVEL1, "%s: check_tape: tape image is %s with %d blocks", cpu_context(), m_image->filename(), m_ctape_block_count);
}
else
{
@@ -481,7 +469,7 @@ void sc499_device::check_tape()
m_image_length = 0;
m_ctape_block_count = 0;
- LOG1(("check_tape: no cartridge tape"));
+ LOGMASKED(LOG_LEVEL1, "%s: check_tape: no cartridge tape", cpu_context());
}
}
@@ -489,9 +477,9 @@ void sc499_device::check_tape()
timer_func - handle timer interrupts
-------------------------------------------------*/
-void sc499_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(sc499_device::timer_func)
{
- LOG2(("timer_func param=%d status=%x", param, m_status));
+ LOGMASKED(LOG_LEVEL2, "%s: timer_func param=%d status=%x", cpu_context(), param, m_status);
switch (param)
{
@@ -556,20 +544,20 @@ void sc499_device::device_timer(emu_timer &timer, device_timer_id id, int param)
tape_status_clear(SC499_ST_CLEAR_ALL);
tape_status_set(SC499_ST_READ_ERROR);
- LOG(("timer_func param=%d status=%x tape_pos=%d - read data underrun aborted at %d",
- param, m_status, m_tape_pos, m_underrun_counter));
+ LOGMASKED(LOG_LEVEL0, "%s: timer_func param=%d status=%x tape_pos=%d - read data underrun aborted at %d",
+ cpu_context(), param, m_status, m_tape_pos, m_underrun_counter);
}
else
{
- LOG2(("timer_func param=%d status=%x tape_pos=%d - read data underrun %d",
- param, m_status, m_tape_pos, m_underrun_counter));
+ LOGMASKED(LOG_LEVEL2, "%s: timer_func param=%d status=%x tape_pos=%d - read data underrun %d",
+ cpu_context(), param, m_status, m_tape_pos, m_underrun_counter);
}
break;
}
else if ( m_tape_pos > m_ctape_block_count || !(m_status & SC499_STAT_RDY))
{
- LOG1(("timer_func param=%d status=%x tape_pos=%d - end-of-tape or not ready",
- param, m_status, m_tape_pos));
+ LOGMASKED(LOG_LEVEL1, "%s: timer_func param=%d status=%x tape_pos=%d - end-of-tape or not ready",
+ cpu_context(), param, m_status, m_tape_pos);
m_timer1->adjust(attotime::never, param, attotime::never);
m_status &= ~SC499_STAT_EXC;
m_status &= ~SC499_STAT_DIR;
@@ -584,8 +572,8 @@ void sc499_device::device_timer(emu_timer &timer, device_timer_id id, int param)
{
if (m_underrun_counter > 0)
{
- LOG1(("timer_func param=%d status=%x tape_pos=%d - read data underrun ended at %d",
- param, m_status, m_tape_pos, m_underrun_counter));
+ LOGMASKED(LOG_LEVEL1, "%s: timer_func param=%d status=%x tape_pos=%d - read data underrun ended at %d",
+ cpu_context(), param, m_status, m_tape_pos, m_underrun_counter);
}
read_block();
@@ -623,7 +611,7 @@ void sc499_device::device_timer(emu_timer &timer, device_timer_id id, int param)
break;
default:
- LOG(("timer_func param=%d UNEXPECTED", param));
+ LOGMASKED(LOG_LEVEL0, "%s: timer_func param=%d UNEXPECTED", cpu_context(), param);
m_timer->reset();
break;
}
@@ -638,7 +626,7 @@ void sc499_device::set_interrupt(enum line_state state)
{
if (state != irq_state)
{
- LOG2(("set_interrupt(%d)",state));
+ LOGMASKED(LOG_LEVEL2, "%s: set_interrupt(%d)", cpu_context(), state);
switch (m_irq)
{
case 2: m_isa->irq2_w(state); break;
@@ -661,7 +649,7 @@ void sc499_device::set_dma_drq(enum line_state state)
{
if (state != dma_drq_state)
{
- LOG2(("set_dma_drq(%d)",state));
+ LOGMASKED(LOG_LEVEL2, "%s: set_dma_drq(%d)", cpu_context(), state);
switch (m_drq)
{
@@ -686,36 +674,36 @@ void sc499_device::log_command(uint8_t data)
case SC499_CMD_SEL_2:
case SC499_CMD_SEL_3:
case SC499_CMD_SEL_4:
- LOG1(("write_command_port: %02x Select %x", data, data & 0x1f));
+ LOGMASKED(LOG_LEVEL1, "%s: write_command_port: %02x Select %x", cpu_context(), data, data & 0x1f);
break;
case SC499_CMD_REWIND: // rewind tape
- LOG1(("write_command_port: %02x Rewind Tape", data));
+ LOGMASKED(LOG_LEVEL1, "%s: write_command_port: %02x Rewind Tape", cpu_context(), data);
break;
case SC499_CMD_ERASE: // erase tape
- LOG1(("write_command_port: %02x Erase Tape", data));
+ LOGMASKED(LOG_LEVEL1, "%s: write_command_port: %02x Erase Tape", cpu_context(), data);
break;
case SC499_CMD_RETEN: // retention tape
- LOG1(("write_command_port: %02x Retention Tape", data));
+ LOGMASKED(LOG_LEVEL1, "%s: write_command_port: %02x Retention Tape", cpu_context(), data);
break;
case SC499_CMD_WRITE_DATA:
- LOG1(("write_command_port: %02x Write Data %d ...", data, m_tape_pos));
+ LOGMASKED(LOG_LEVEL1, "%s: write_command_port: %02x Write Data %d ...", cpu_context(), data, m_tape_pos);
break;
case SC499_CMD_WRITE_FILEMARK:
- LOG1(("write_command_port: %02x Write File Mark %d", data, m_tape_pos));
+ LOGMASKED(LOG_LEVEL1, "%s: write_command_port: %02x Write File Mark %d", cpu_context(), data, m_tape_pos);
break;
case SC499_CMD_READ_DATA:
- LOG1(("write_command_port: %02x Read Data %d ...", data, m_tape_pos));
+ LOGMASKED(LOG_LEVEL1, "%s: write_command_port: %02x Read Data %d ...", cpu_context(), data, m_tape_pos);
break;
case SC499_CMD_READ_FILE_MARK:
- LOG1(("write_command_port: %02x Read File Mark %d", data, m_tape_pos));
+ LOGMASKED(LOG_LEVEL1, "%s: write_command_port: %02x Read File Mark %d", cpu_context(), data, m_tape_pos);
break;
case SC499_CMD_READ_STATUS:
- LOG1(("write_command_port: %02x Read Status (%04x %04x %04x)", data,
- m_tape_status, m_data_error_counter, m_underrun_counter));
+ LOGMASKED(LOG_LEVEL1, "%s: write_command_port: %02x Read Status (%04x %04x %04x)", cpu_context(), data,
+ m_tape_status, m_data_error_counter, m_underrun_counter);
break;
case SC499_CMD_RESERVED: // Reserved
default:
- LOG(("write_command_port: %02x Unexpected Command!", data));
+ LOGMASKED(LOG_LEVEL0, "%s: write_command_port: %02x Unexpected Command!", cpu_context(), data);
break;
}
}
@@ -784,7 +772,7 @@ void sc499_device::do_command(uint8_t data)
{
// SC499_CMD_READ_DATA pending
m_status &= ~SC499_STAT_DIR;
- LOG1(("do_command: Read data -> Read File Mark at %d", m_tape_pos));
+ LOGMASKED(LOG_LEVEL1, "%s: do_command: Read data -> Read File Mark at %d", cpu_context(), m_tape_pos);
}
else
{
@@ -819,7 +807,7 @@ void sc499_device::do_command(uint8_t data)
void sc499_device::do_reset()
{
- LOG1(("do_reset: Reset controller microprocessor"));
+ LOGMASKED(LOG_LEVEL1, "%s: do_reset: Reset controller microprocessor", cpu_context());
m_data = 0;
m_command = SC499_CMD_NO_COMMAND;
@@ -861,7 +849,7 @@ uint8_t sc499_device::read_data_port()
// omit excessive logging
if (m_last_data != m_data)
{
- LOG2(("read_data_port: %02x", m_data));
+ LOGMASKED(LOG_LEVEL2, "%s: read_data_port: %02x", cpu_context(), m_data);
m_last_data = m_data;
}
@@ -876,7 +864,7 @@ uint8_t sc499_device::read_data_port()
void sc499_device::write_control_port( uint8_t data)
{
- LOG2(("write_control_port: %02x", data));
+ LOGMASKED(LOG_LEVEL2, "%s: write_control_port: %02x", cpu_context(), data);
if ((data ^ m_control) & SC499_CTR_RST)
{
@@ -897,7 +885,7 @@ void sc499_device::write_control_port( uint8_t data)
// Request to LSI chip has changed
if (data & SC499_CTR_REQ)
{
- LOG3(("write_control_port: Request to LSI chip = On"));
+ LOGMASKED(LOG_LEVEL3, "%s: write_control_port: Request to LSI chip = On", cpu_context());
if (m_command == SC499_CMD_READ_STATUS) {
m_status |= SC499_STAT_EXC;
@@ -922,7 +910,7 @@ void sc499_device::write_control_port( uint8_t data)
}
else
{
- LOG2(("write_control_port: Request to LSI chip = Off (%d)", m_data_index));
+ LOGMASKED(LOG_LEVEL2, "%s: write_control_port: Request to LSI chip = Off (%d)", cpu_context(), m_data_index);
if (!(m_status & SC499_STAT_DIR))
{
@@ -948,7 +936,7 @@ uint8_t sc499_device::read_status_port()
// omit excessive logging
if (m_last_status != m_status)
{
- LOG2(("read_status_port: %02x", m_status));
+ LOGMASKED(LOG_LEVEL2, "%s: read_status_port: %02x", cpu_context(), m_status);
m_last_status = m_status;
}
@@ -963,7 +951,7 @@ uint8_t sc499_device::read_status_port()
void sc499_device::write_dma_go( uint8_t data)
{
- LOG2(("write_dma_go: %02x", data));
+ LOGMASKED(LOG_LEVEL2, "%s: write_dma_go: %02x", cpu_context(), data);
m_status &= ~SC499_STAT_DON;
@@ -1008,7 +996,7 @@ void sc499_device::write_dma_go( uint8_t data)
void sc499_device::write_dma_reset( uint8_t data)
{
- LOG2(("write_dma_reset: %02x", data));
+ LOGMASKED(LOG_LEVEL2, "%s: write_dma_reset: %02x", cpu_context(), data);
m_status &= ~SC499_STAT_DON;
m_control = 0;
@@ -1031,7 +1019,7 @@ void sc499_device::write(offs_t offset, uint8_t data)
write_dma_reset(data);
break;
default:
- LOG(("writing sc499 Register at offset %02x = %02x", offset, data));
+ LOGMASKED(LOG_LEVEL0, "%s: writing sc499 Register at offset %02x = %02x", cpu_context(), offset, data);
break;
}
}
@@ -1050,7 +1038,7 @@ uint8_t sc499_device::read(offs_t offset)
// set_interrupt(CLEAR_LINE);
break;
default:
- LOG(("reading sc499 Register at offset %02x = %02x", offset, data));
+ LOGMASKED(LOG_LEVEL0, "%s: reading sc499 Register at offset %02x = %02x", cpu_context(), offset, data);
break;
}
@@ -1059,7 +1047,7 @@ uint8_t sc499_device::read(offs_t offset)
void sc499_device::eop_w(int state)
{
- LOG2(("set_tc_state: block=%d state=%x", m_tape_pos-1, state));
+ LOGMASKED(LOG_LEVEL2, "%s: set_tc_state: block=%d state=%x", cpu_context(), m_tape_pos - 1, state);
if (state == 0)
{
m_status |= SC499_STAT_DON; // 37ec
@@ -1091,7 +1079,7 @@ uint8_t sc499_device::dack_r(int line)
if (m_ctape_block_index >= SC499_CTAPE_BLOCK_SIZE)
{
- LOG3(("dack_read: read_block"));
+ LOGMASKED(LOG_LEVEL3, "%s: dack_read: read_block", cpu_context());
read_block();
m_nasty_readahead++;
@@ -1106,7 +1094,7 @@ uint8_t sc499_device::dack_r(int line)
data = m_ctape_block_buffer[m_ctape_block_index++];
if (m_ctape_block_index < 2 || m_ctape_block_index > 511)
{
- LOG2(("dack_read: data[%d]=%x status=%x", m_ctape_block_index-1, data, m_status));
+ LOGMASKED(LOG_LEVEL2, "%s: dack_read: data[%d]=%x status=%x", cpu_context(), m_ctape_block_index - 1, data, m_status);
}
// if (m_ctape_block_index < SC499_CTAPE_BLOCK_SIZE)
@@ -1119,7 +1107,7 @@ uint8_t sc499_device::dack_r(int line)
void sc499_device::dack_w(int line, uint8_t data)
{
- LOG3(("dack_write: data=%x", data));
+ LOGMASKED(LOG_LEVEL3, "%s: dack_write: data=%x", cpu_context(), data);
if (m_ctape_block_index < SC499_CTAPE_BLOCK_SIZE)
{
@@ -1128,7 +1116,7 @@ void sc499_device::dack_w(int line, uint8_t data)
if (m_ctape_block_index == SC499_CTAPE_BLOCK_SIZE)
{
- LOG3(("dack_write: write_block"));
+ LOGMASKED(LOG_LEVEL3, "%s: dack_write: write_block", cpu_context());
write_block();
}
}
@@ -1141,7 +1129,7 @@ void sc499_device::log_block(const char *text)
{
int data_length = 16;
- if (verbose > 0) {
+ if (VERBOSE & (LOG_LEVEL1 | LOG_LEVEL2 | LOG_LEVEL3)) {
int i;
logerror("%s: %s %d -", cpu_context(), text, m_tape_pos);
for (i = 0; i < data_length && i < SC499_CTAPE_BLOCK_SIZE; i++) {
@@ -1190,7 +1178,7 @@ void sc499_device::read_block()
{
memcpy(&m_ctape_block_buffer[0], tape, SC499_CTAPE_BLOCK_SIZE);
- // if (verbose > 1 || m_tape_pos % 100 == 0)
+ // if (m_tape_pos % 100 == 0)
{
log_block("read_block");
}
@@ -1203,7 +1191,7 @@ void sc499_device::read_block()
// FIXME: we must read first block twice (in MD for 'di c' and 'ld' or 'ex ...')
// why is this necessary???
m_tape_pos = 0;
- LOG(("read_block - duplicating block %d", m_tape_pos));
+ LOGMASKED(LOG_LEVEL0, "%s: read_block - duplicating block %d", cpu_context(), m_tape_pos);
}
m_first_block_hack = 0;
@@ -1261,9 +1249,9 @@ int sc499_device::block_is_filemark()
static const uint8_t fm_pattern[] = {0xDE, 0xAF, 0xFA, 0xED};
int is_filemark = memcmp(&m_ctape_block_buffer[0], fm_pattern, 4) == 0 &&
- memcmp(&m_ctape_block_buffer[0], &m_ctape_block_buffer[4], SC499_CTAPE_BLOCK_SIZE-4) == 0;
+ memcmp(&m_ctape_block_buffer[0], &m_ctape_block_buffer[4], SC499_CTAPE_BLOCK_SIZE - 4) == 0;
- LOG3(("block_is_filemark for block %d = %d", m_tape_pos-1, is_filemark));
+ LOGMASKED(LOG_LEVEL3, "%s: block_is_filemark for block %d = %d", cpu_context(), m_tape_pos - 1, is_filemark);
return is_filemark;
}
diff --git a/src/devices/bus/isa/sc499.h b/src/devices/bus/isa/sc499.h
index 5d51d8cb7dd..ffcd8c37a85 100644
--- a/src/devices/bus/isa/sc499.h
+++ b/src/devices/bus/isa/sc499.h
@@ -66,7 +66,6 @@ private:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_add_mconfig(machine_config &config) override;
virtual ioport_constructor device_input_ports() const override;
@@ -76,7 +75,6 @@ private:
virtual void eop_w(int state) override;
std::string cpu_context() const;
- template <typename Format, typename... Params> void logerror(Format &&fmt, Params &&... args) const;
void tape_status_clear(uint16_t value);
void tape_status_set(uint16_t value);
@@ -108,6 +106,8 @@ private:
int block_is_filemark();
void block_set_filemark();
+ TIMER_CALLBACK_MEMBER(timer_func);
+
uint8_t m_data;
uint8_t m_command;
uint8_t m_status;
diff --git a/src/devices/bus/isa/stereo_fx.cpp b/src/devices/bus/isa/stereo_fx.cpp
index 1380055572d..70f3c5160c7 100644
--- a/src/devices/bus/isa/stereo_fx.cpp
+++ b/src/devices/bus/isa/stereo_fx.cpp
@@ -215,7 +215,7 @@ void stereo_fx_device::device_start()
m_isa->install_device(0x022e, 0x022f, read8smo_delegate(*this, FUNC(stereo_fx_device::dsp_rbuf_status_r)), write8smo_delegate(*this, FUNC(stereo_fx_device::invalid_w)));
m_isa->install_device(0x0388, 0x0389, read8sm_delegate(ym3812, FUNC(ym3812_device::read)), write8sm_delegate(ym3812, FUNC(ym3812_device::write)));
m_isa->install_device(0x0228, 0x0229, read8sm_delegate(ym3812, FUNC(ym3812_device::read)), write8sm_delegate(ym3812, FUNC(ym3812_device::write)));
- m_timer = timer_alloc();
+ m_timer = timer_alloc(FUNC(stereo_fx_device::clock_tick), this);
m_timer->adjust(attotime::from_hz(2000000), 0, attotime::from_hz(2000000));
m_isa->set_dma_channel(1, this, false);
}
@@ -232,7 +232,7 @@ void stereo_fx_device::device_reset()
m_t0 = CLEAR_LINE;
}
-void stereo_fx_device::device_timer(emu_timer &timer, device_timer_id tid, int param)
+TIMER_CALLBACK_MEMBER(stereo_fx_device::clock_tick)
{
m_t0 = !m_t0;
m_cpu->set_input_line(MCS51_T0_LINE, m_t0);
diff --git a/src/devices/bus/isa/stereo_fx.h b/src/devices/bus/isa/stereo_fx.h
index bd98ea82c85..376d5dbff98 100644
--- a/src/devices/bus/isa/stereo_fx.h
+++ b/src/devices/bus/isa/stereo_fx.h
@@ -28,8 +28,6 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
// optional information overrides
virtual const tiny_rom_entry *device_rom_region() const override;
virtual void device_add_mconfig(machine_config &config) override;
@@ -53,6 +51,8 @@ private:
uint8_t m_t0;
uint8_t m_t1;
+ TIMER_CALLBACK_MEMBER(clock_tick);
+
// mcu ports
uint8_t dev_dsp_data_r();
void dev_dsp_data_w(uint8_t data);
diff --git a/src/devices/bus/isa/trident.cpp b/src/devices/bus/isa/trident.cpp
index 693aaf5e991..943f0de3432 100644
--- a/src/devices/bus/isa/trident.cpp
+++ b/src/devices/bus/isa/trident.cpp
@@ -179,7 +179,7 @@ void trident_vga_device::device_start()
save_pointer(tri.accel_pattern,"Pattern Data", 0x80);
save_pointer(tri.lutdac_reg,"LUTDAC registers", 0x100);
- m_vblank_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vga_device::vblank_timer_cb),this));
+ m_vblank_timer = timer_alloc(FUNC(vga_device::vblank_timer_cb), this);
vga.svga_intf.seq_regcount = 0x0f;
vga.svga_intf.crtc_regcount = 0x60;
memset(&tri, 0, sizeof(tri));
diff --git a/src/devices/bus/kc/d004.cpp b/src/devices/bus/kc/d004.cpp
index a2018c5867a..45905b23b1d 100644
--- a/src/devices/bus/kc/d004.cpp
+++ b/src/devices/bus/kc/d004.cpp
@@ -131,7 +131,7 @@ void kc_d004_device::device_start()
{
m_rom = memregion(Z80_TAG)->base();
- m_reset_timer = timer_alloc(TIMER_RESET);
+ m_reset_timer = timer_alloc(FUNC(kc_d004_device::reset_tick), this);
}
//-------------------------------------------------
@@ -185,17 +185,12 @@ const tiny_rom_entry *kc_d004_device::device_rom_region() const
}
//-------------------------------------------------
-// device_timer - handler timer events
+// reset_tick - reset the main CPU when needed
//-------------------------------------------------
-void kc_d004_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(kc_d004_device::reset_tick)
{
- switch(id)
- {
- case TIMER_RESET:
- m_cpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
- break;
- }
+ m_cpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
}
/*-------------------------------------------------
diff --git a/src/devices/bus/kc/d004.h b/src/devices/bus/kc/d004.h
index 3e47cfaf4d9..570f378b4fa 100644
--- a/src/devices/bus/kc/d004.h
+++ b/src/devices/bus/kc/d004.h
@@ -34,7 +34,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// optional information overrides
virtual void device_add_mconfig(machine_config &config) override;
@@ -47,6 +46,8 @@ protected:
virtual void io_read(offs_t offset, uint8_t &data) override;
virtual void io_write(offs_t offset, uint8_t data) override;
+ TIMER_CALLBACK_MEMBER(reset_tick);
+
uint8_t hw_input_gate_r();
void fdd_select_w(uint8_t data);
void hw_terminal_count_w(uint8_t data);
@@ -61,8 +62,6 @@ private:
void kc_d004_io(address_map &map);
void kc_d004_mem(address_map &map);
- static const device_timer_id TIMER_RESET = 0;
-
required_device<upd765a_device> m_fdc;
required_device<floppy_connector> m_floppy0;
required_device<floppy_connector> m_floppy1;
diff --git a/src/devices/bus/mackbd/keyboard.cpp b/src/devices/bus/mackbd/keyboard.cpp
index 7818797904b..bda86980a05 100644
--- a/src/devices/bus/mackbd/keyboard.cpp
+++ b/src/devices/bus/mackbd/keyboard.cpp
@@ -278,8 +278,8 @@ protected:
virtual void device_start() override
{
- m_watchdog_timeout = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(peripheral_base::watchdog_timeout), this));
- m_watchdog_output = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(peripheral_base::watchdog_output), this));
+ m_watchdog_timeout = timer_alloc(FUNC(peripheral_base::watchdog_timeout), this);
+ m_watchdog_output = timer_alloc(FUNC(peripheral_base::watchdog_output), this);
m_row_drive = make_bitmask<u16>(Rows);
m_host_clock_out = 1U;
diff --git a/src/devices/bus/macpds/pds_tpdfpd.cpp b/src/devices/bus/macpds/pds_tpdfpd.cpp
index 84c2383ac49..c6eeb68c466 100644
--- a/src/devices/bus/macpds/pds_tpdfpd.cpp
+++ b/src/devices/bus/macpds/pds_tpdfpd.cpp
@@ -114,7 +114,7 @@ void macpds_sedisplay_device::device_start()
m_macpds->install_device(0x770000, 0x77000f, read16s_delegate(*this, FUNC(macpds_sedisplay_device::ramdac_r)), write16s_delegate(*this, FUNC(macpds_sedisplay_device::ramdac_w)));
m_macpds->install_device(0xc10000, 0xc2ffff, read16sm_delegate(*this, FUNC(macpds_sedisplay_device::sedisplay_r)), write16sm_delegate(*this, FUNC(macpds_sedisplay_device::sedisplay_w)));
- m_timer = timer_alloc(0);
+ m_timer = timer_alloc(FUNC(macpds_sedisplay_device::vbl_tick), this);
m_timer->adjust(screen().time_until_pos(879, 0), 0);
}
@@ -135,7 +135,7 @@ void macpds_sedisplay_device::device_reset()
}
-void macpds_sedisplay_device::device_timer(emu_timer &timer, device_timer_id tid, int param)
+TIMER_CALLBACK_MEMBER(macpds_sedisplay_device::vbl_tick)
{
if (!m_vbl_disable)
{
diff --git a/src/devices/bus/macpds/pds_tpdfpd.h b/src/devices/bus/macpds/pds_tpdfpd.h
index a46bfefcf7b..3b9fd803c7e 100644
--- a/src/devices/bus/macpds/pds_tpdfpd.h
+++ b/src/devices/bus/macpds/pds_tpdfpd.h
@@ -28,7 +28,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// optional information overrides
virtual void device_add_mconfig(machine_config &config) override;
@@ -42,6 +41,8 @@ private:
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
+ TIMER_CALLBACK_MEMBER(vbl_tick);
+
std::unique_ptr<uint8_t[]> m_vram;
uint32_t m_vbl_disable;
uint32_t m_palette[256], m_colors[3], m_count, m_clutoffs;
diff --git a/src/devices/bus/multibus/isbc202.cpp b/src/devices/bus/multibus/isbc202.cpp
index 3b4ff08808c..f537cfcbe4a 100644
--- a/src/devices/bus/multibus/isbc202.cpp
+++ b/src/devices/bus/multibus/isbc202.cpp
@@ -100,13 +100,6 @@ constexpr unsigned HALF_BIT_CELL_US = 1;// Half bit cell duration in µs
constexpr unsigned BIT_FREQUENCY = 500000; // Frequency of bit cells in Hz
constexpr uint16_t CRC_POLY = 0x1021; // CRC-CCITT
-// Timers
-enum {
- TIMEOUT_TMR_ID,
- BYTE_TMR_ID,
- F_TMR_ID
-};
-
// device type definition
DEFINE_DEVICE_TYPE(ISBC202, isbc202_device, "isbc202", "iSBC-202 floppy controller")
@@ -404,9 +397,9 @@ void isbc202_device::device_start()
d->get_device()->setup_index_pulse_cb(floppy_image_device::index_pulse_cb(&isbc202_device::floppy_index_cb , this));
}
- m_timeout_timer = timer_alloc(TIMEOUT_TMR_ID);
- m_byte_timer = timer_alloc(BYTE_TMR_ID);
- m_f_timer = timer_alloc(F_TMR_ID);
+ m_timeout_timer = timer_alloc(FUNC(isbc202_device::timeout_tick), this);
+ m_byte_timer = timer_alloc(FUNC(isbc202_device::byte_tick), this);
+ m_f_timer = timer_alloc(FUNC(isbc202_device::f_tick), this);
m_mem_space = &m_bus->space(AS_PROGRAM);
m_bus->space(AS_IO).install_readwrite_handler(0x78, 0x7f, read8m_delegate(*this, FUNC(isbc202_device::io_r)), write8m_delegate(*this, FUNC(isbc202_device::io_w)));
@@ -438,37 +431,32 @@ void isbc202_device::device_reset()
m_f_timer->reset();
}
-void isbc202_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(isbc202_device::timeout_tick)
{
- switch (id) {
- case TIMEOUT_TMR_ID:
- m_inputs[ IN_SEL_TIMEOUT ] = true;
- break;
-
- case BYTE_TMR_ID:
- m_inputs[ IN_SEL_F ] = true;
- m_f_timer->adjust(attotime::from_usec(HALF_BIT_CELL_US * 2));
- m_dlyd_amwrt = m_amwrt;
- if (m_reading) {
- m_last_f_time = machine().time();
- rd_bits(8);
- m_byte_timer->adjust(m_pll.ctime - machine().time());
- // Updating of AZ flag actually happens when F goes low
- m_inputs[ IN_SEL_AZ ] = m_crc == 0;
- }
- break;
+ m_inputs[ IN_SEL_TIMEOUT ] = true;
+}
- case F_TMR_ID:
- m_inputs[ IN_SEL_F ] = false;
- if (m_writing) {
- write_byte();
- m_data_sr = dbus_r();
- m_byte_timer->adjust(attotime::from_usec(HALF_BIT_CELL_US * 14));
- }
- break;
+TIMER_CALLBACK_MEMBER(isbc202_device::byte_tick)
+{
+ m_inputs[ IN_SEL_F ] = true;
+ m_f_timer->adjust(attotime::from_usec(HALF_BIT_CELL_US * 2));
+ m_dlyd_amwrt = m_amwrt;
+ if (m_reading) {
+ m_last_f_time = machine().time();
+ rd_bits(8);
+ m_byte_timer->adjust(m_pll.ctime - machine().time());
+ // Updating of AZ flag actually happens when F goes low
+ m_inputs[ IN_SEL_AZ ] = m_crc == 0;
+ }
+}
- default:
- break;
+TIMER_CALLBACK_MEMBER(isbc202_device::f_tick)
+{
+ m_inputs[ IN_SEL_F ] = false;
+ if (m_writing) {
+ write_byte();
+ m_data_sr = dbus_r();
+ m_byte_timer->adjust(attotime::from_usec(HALF_BIT_CELL_US * 14));
}
}
diff --git a/src/devices/bus/multibus/isbc202.h b/src/devices/bus/multibus/isbc202.h
index c1f3b1d036d..686065a9c53 100644
--- a/src/devices/bus/multibus/isbc202.h
+++ b/src/devices/bus/multibus/isbc202.h
@@ -39,16 +39,19 @@ protected:
// device_t overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual const tiny_rom_entry *device_rom_region() const override;
virtual void device_add_mconfig(machine_config &config) override;
+
// device_execute_interface overrides
virtual uint32_t execute_min_cycles() const noexcept override { return 1; }
virtual void execute_run() override;
+
// device_memory_interface overrides
virtual space_config_vector memory_space_config() const override;
+
// device_disasm_interface overrides
virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
+
// device_state_interface overrides
virtual void state_import(const device_state_entry &entry) override;
virtual void state_export(const device_state_entry &entry) override;
@@ -133,6 +136,10 @@ private:
emu_timer *m_byte_timer;
emu_timer *m_f_timer;
+ TIMER_CALLBACK_MEMBER(timeout_tick);
+ TIMER_CALLBACK_MEMBER(byte_tick);
+ TIMER_CALLBACK_MEMBER(f_tick);
+
void set_output();
unsigned selected_drive() const;
unsigned drive_idx(floppy_image_device *drive);
diff --git a/src/devices/bus/nasbus/floppy.cpp b/src/devices/bus/nasbus/floppy.cpp
index 3ada48aa19a..905f5eef087 100644
--- a/src/devices/bus/nasbus/floppy.cpp
+++ b/src/devices/bus/nasbus/floppy.cpp
@@ -80,7 +80,7 @@ nascom_fdc_device::nascom_fdc_device(const machine_config &mconfig, const char *
void nascom_fdc_device::device_start()
{
// timer to turn off the drive motor line
- m_motor = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(nascom_fdc_device::motor_off), this));
+ m_motor = timer_alloc(FUNC(nascom_fdc_device::motor_off), this);
save_item(NAME(m_select));
}
diff --git a/src/devices/bus/nes/bandai.cpp b/src/devices/bus/nes/bandai.cpp
index 1f3eb653876..9bb61da4262 100644
--- a/src/devices/bus/nes/bandai.cpp
+++ b/src/devices/bus/nes/bandai.cpp
@@ -122,7 +122,7 @@ void nes_oekakids_device::pcb_reset()
void nes_fcg_device::device_start()
{
common_start();
- irq_timer = timer_alloc(TIMER_IRQ);
+ irq_timer = timer_alloc(FUNC(nes_fcg_device::irq_timer_tick), this);
irq_timer->adjust(attotime::zero, 0, clocks_to_attotime(1));
save_item(NAME(m_irq_enable));
@@ -142,7 +142,7 @@ void nes_fcg_device::pcb_reset()
void nes_lz93d50_24c01_device::device_start()
{
common_start();
- irq_timer = timer_alloc(TIMER_IRQ);
+ irq_timer = timer_alloc(FUNC(nes_lz93d50_24c01_device::irq_timer_tick), this);
irq_timer->adjust(attotime::zero, 0, clocks_to_attotime(1));
save_item(NAME(m_irq_enable));
@@ -164,7 +164,7 @@ void nes_lz93d50_24c01_device::pcb_reset()
void nes_fjump2_device::device_start()
{
common_start();
- irq_timer = timer_alloc(TIMER_IRQ);
+ irq_timer = timer_alloc(FUNC(nes_fjump2_device::irq_timer_tick), this);
irq_timer->adjust(attotime::zero, 0, clocks_to_attotime(1));
save_item(NAME(m_reg));
@@ -278,25 +278,22 @@ void nes_oekakids_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_fcg_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nes_fcg_device::irq_timer_tick)
{
- if (id == TIMER_IRQ)
+ if (m_irq_enable)
{
- if (m_irq_enable)
+ // 16bit counter, IRQ fired when the counter goes from 1 to 0
+ // after firing, the counter is *not* reloaded, but next clock
+ // counter wraps around from 0 to 0xffff
+ if (!m_irq_count)
+ m_irq_count = 0xffff;
+ else
+ m_irq_count--;
+
+ if (!m_irq_count)
{
- // 16bit counter, IRQ fired when the counter goes from 1 to 0
- // after firing, the counter is *not* reloaded, but next clock
- // counter wraps around from 0 to 0xffff
- if (!m_irq_count)
- m_irq_count = 0xffff;
- else
- m_irq_count--;
-
- if (!m_irq_count)
- {
- set_irq_line(ASSERT_LINE);
- m_irq_enable = 0;
- }
+ set_irq_line(ASSERT_LINE);
+ m_irq_enable = 0;
}
}
}
diff --git a/src/devices/bus/nes/bandai.h b/src/devices/bus/nes/bandai.h
index 9427a7fca8e..1a21f8a3052 100644
--- a/src/devices/bus/nes/bandai.h
+++ b/src/devices/bus/nes/bandai.h
@@ -45,20 +45,19 @@ public:
// construction/destruction
nes_fcg_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
void fcg_write(offs_t offset, uint8_t data);
virtual void write_m(offs_t offset, uint8_t data) override;
virtual void pcb_reset() override;
protected:
- static constexpr device_timer_id TIMER_IRQ = 0;
-
nes_fcg_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
virtual void device_start() override;
+ TIMER_CALLBACK_MEMBER(irq_timer_tick);
+
uint16_t m_irq_count;
int m_irq_enable;
diff --git a/src/devices/bus/nes/batlab.cpp b/src/devices/bus/nes/batlab.cpp
index 868174ed232..e117e6fbf5e 100644
--- a/src/devices/bus/nes/batlab.cpp
+++ b/src/devices/bus/nes/batlab.cpp
@@ -162,7 +162,7 @@ void nes_batmap_000_device::write_h(offs_t offset, u8 data)
-------------------------------------------------*/
// IRQ based on our MMC3 implementation, details for SRR are unclear
-void nes_batmap_srrx_device::hblank_irq(int scanline, int vblank, int blanked)
+void nes_batmap_srrx_device::hblank_irq(int scanline, bool vblank, bool blanked)
{
if (scanline < ppu2c0x_device::BOTTOM_VISIBLE_SCANLINE)
{
diff --git a/src/devices/bus/nes/batlab.h b/src/devices/bus/nes/batlab.h
index 0d2e3dca507..9861afe8a87 100644
--- a/src/devices/bus/nes/batlab.h
+++ b/src/devices/bus/nes/batlab.h
@@ -35,7 +35,7 @@ public:
virtual u8 read_h(offs_t offset) override;
virtual void write_h(offs_t offset, u8 data) override;
- virtual void hblank_irq(int scanline, int vblank, int blanked) override;
+ virtual void hblank_irq(int scanline, bool vblank, bool blanked) override;
virtual void pcb_reset() override;
protected:
diff --git a/src/devices/bus/nes/bootleg.cpp b/src/devices/bus/nes/bootleg.cpp
index ba9cfc43f5d..c0ac3e1a35c 100644
--- a/src/devices/bus/nes/bootleg.cpp
+++ b/src/devices/bus/nes/bootleg.cpp
@@ -259,7 +259,7 @@ void nes_sc127_device::pcb_reset()
void nes_mbaby_device::device_start()
{
common_start();
- irq_timer = timer_alloc(TIMER_IRQ);
+ irq_timer = timer_alloc(FUNC(nes_mbaby_device::irq_timer_tick), this);
irq_timer->adjust(attotime::zero, 0, clocks_to_attotime(1));
save_item(NAME(m_irq_enable));
@@ -293,7 +293,7 @@ void nes_asn_device::pcb_reset()
void nes_smb3p_device::device_start()
{
common_start();
- irq_timer = timer_alloc(TIMER_IRQ);
+ irq_timer = timer_alloc(FUNC(nes_smb3p_device::irq_timer_tick), this);
irq_timer->adjust(attotime::zero, 0, clocks_to_attotime(1));
save_item(NAME(m_irq_enable));
@@ -316,7 +316,7 @@ void nes_smb3p_device::pcb_reset()
void nes_batmanfs_device::device_start()
{
common_start();
- irq_timer = timer_alloc(TIMER_IRQ);
+ irq_timer = timer_alloc(FUNC(nes_batmanfs_device::irq_timer_tick), this);
irq_timer->adjust(attotime::zero, 0, clocks_to_attotime(1));
save_item(NAME(m_irq_enable));
@@ -356,7 +356,7 @@ void nes_btl_dn_device::pcb_reset()
void nes_smb2j_device::device_start()
{
common_start();
- irq_timer = timer_alloc(TIMER_IRQ);
+ irq_timer = timer_alloc(FUNC(nes_smb2j_device::irq_timer_tick), this);
irq_timer->adjust(attotime::zero, 0, clocks_to_attotime(1));
save_item(NAME(m_irq_enable));
@@ -378,7 +378,7 @@ void nes_smb2j_device::pcb_reset()
void nes_smb2ja_device::device_start()
{
common_start();
- irq_timer = timer_alloc(TIMER_IRQ);
+ irq_timer = timer_alloc(FUNC(nes_smb2ja_device::irq_timer_tick), this);
irq_timer->adjust(attotime::zero, 0, clocks_to_attotime(1));
save_item(NAME(m_irq_enable));
@@ -400,7 +400,7 @@ void nes_smb2ja_device::pcb_reset()
void nes_smb2jb_device::device_start()
{
common_start();
- irq_timer = timer_alloc(TIMER_IRQ);
+ irq_timer = timer_alloc(FUNC(nes_smb2jb_device::irq_timer_tick), this);
irq_timer->adjust(attotime::zero, 0, clocks_to_attotime(1));
save_item(NAME(m_irq_enable));
@@ -445,7 +445,7 @@ void nes_0353_device::pcb_reset()
void nes_09034a_device::device_start()
{
common_start();
- irq_timer = timer_alloc(TIMER_IRQ);
+ irq_timer = timer_alloc(FUNC(nes_09034a_device::irq_timer_tick), this);
irq_timer->adjust(attotime::zero, 0, clocks_to_attotime(1));
save_item(NAME(m_irq_enable));
@@ -466,7 +466,7 @@ void nes_09034a_device::pcb_reset()
void nes_l001_device::device_start()
{
common_start();
- irq_timer = timer_alloc(TIMER_IRQ);
+ irq_timer = timer_alloc(FUNC(nes_l001_device::irq_timer_tick), this);
irq_timer->adjust(attotime::zero, 0, clocks_to_attotime(1));
save_item(NAME(m_irq_count));
@@ -587,7 +587,7 @@ void nes_lh51_device::pcb_reset()
void nes_lh53_device::device_start()
{
common_start();
- irq_timer = timer_alloc(TIMER_IRQ);
+ irq_timer = timer_alloc(FUNC(nes_lh53_device::irq_timer_tick), this);
irq_timer->adjust(attotime::zero, 0, clocks_to_attotime(1));
save_item(NAME(m_irq_enable));
@@ -645,7 +645,7 @@ void nes_rt01_device::pcb_reset()
void nes_yung08_device::device_start()
{
common_start();
- irq_timer = timer_alloc(TIMER_IRQ);
+ irq_timer = timer_alloc(FUNC(nes_yung08_device::irq_timer_tick), this);
irq_timer->adjust(attotime::zero, 0, clocks_to_attotime(1));
save_item(NAME(m_irq_count));
@@ -681,7 +681,7 @@ void nes_yung08_device::pcb_reset()
-------------------------------------------------*/
-void nes_sc127_device::hblank_irq(int scanline, int vblank, int blanked)
+void nes_sc127_device::hblank_irq(int scanline, bool vblank, bool blanked)
{
if (scanline < ppu2c0x_device::BOTTOM_VISIBLE_SCANLINE && m_irq_enable)
{
@@ -751,17 +751,14 @@ void nes_sc127_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_mbaby_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nes_mbaby_device::irq_timer_tick)
{
- if (id == TIMER_IRQ)
+ if (m_irq_enable)
{
- if (m_irq_enable)
- {
- m_irq_count = (m_irq_count + 1) & 0x7fff; // unverified 15-bit counter based on FCEUX
+ m_irq_count = (m_irq_count + 1) & 0x7fff; // unverified 15-bit counter based on FCEUX
- if (m_irq_count >= 0x6000)
- set_irq_line(ASSERT_LINE);
- }
+ if (m_irq_count >= 0x6000)
+ set_irq_line(ASSERT_LINE);
}
}
@@ -838,16 +835,13 @@ uint8_t nes_asn_device::read_m(offs_t offset)
-------------------------------------------------*/
-void nes_smb3p_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nes_smb3p_device::irq_timer_tick)
{
- if (id == TIMER_IRQ)
- {
- // counter does not stop when interrupts are disabled
- if (m_irq_count != 0xffff)
- m_irq_count++;
- else if (m_irq_enable)
- set_irq_line(ASSERT_LINE);
- }
+ // counter does not stop when interrupts are disabled
+ if (m_irq_count != 0xffff)
+ m_irq_count++;
+ else if (m_irq_enable)
+ set_irq_line(ASSERT_LINE);
}
void nes_smb3p_device::write_h(offs_t offset, u8 data)
@@ -943,7 +937,7 @@ void nes_btl_cj_device::write_h(offs_t offset, u8 data)
-------------------------------------------------*/
/* Scanline based IRQ ? */
-void nes_btl_dn_device::hblank_irq(int scanline, int vblank, int blanked )
+void nes_btl_dn_device::hblank_irq(int scanline, bool vblank, bool blanked)
{
if (!m_irq_count || ++m_irq_count < 240)
return;
@@ -1056,16 +1050,13 @@ void nes_lh31_device::write_h(offs_t offset, u8 data) // submapper 2
-------------------------------------------------*/
-void nes_smb2j_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nes_smb2j_device::irq_timer_tick)
{
- if (id == TIMER_IRQ)
+ if (m_irq_enable)
{
- if (m_irq_enable)
- {
- m_irq_count = (m_irq_count + 1) & 0xfff;
- if (!m_irq_count)
- set_irq_line(ASSERT_LINE);
- }
+ m_irq_count = (m_irq_count + 1) & 0xfff;
+ if (!m_irq_count)
+ set_irq_line(ASSERT_LINE);
}
}
@@ -1143,18 +1134,15 @@ u8 nes_smb2j_device::read_m(offs_t offset)
-------------------------------------------------*/
-void nes_smb2ja_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nes_smb2ja_device::irq_timer_tick)
{
- if (id == TIMER_IRQ)
+ if (m_irq_enable)
{
- if (m_irq_enable)
- {
- m_irq_count = (m_irq_count + 1) & 0x1fff; // 13-bit counter
- if (BIT(m_irq_count, 12))
- set_irq_line(ASSERT_LINE);
- else if (!m_irq_count)
- set_irq_line(CLEAR_LINE); // CD4020 acknowledges on overflow
- }
+ m_irq_count = (m_irq_count + 1) & 0x1fff; // 13-bit counter
+ if (BIT(m_irq_count, 12))
+ set_irq_line(ASSERT_LINE);
+ else if (!m_irq_count)
+ set_irq_line(CLEAR_LINE); // CD4020 acknowledges on overflow
}
}
@@ -1198,15 +1186,12 @@ u8 nes_smb2ja_device::read_m(offs_t offset)
-------------------------------------------------*/
-void nes_smb2jb_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nes_smb2jb_device::irq_timer_tick)
{
- if (id == TIMER_IRQ)
+ if (m_irq_enable)
{
- if (m_irq_enable)
- {
- if (BIT(++m_irq_count, 12))
- set_irq_line(ASSERT_LINE);
- }
+ if (BIT(++m_irq_count, 12))
+ set_irq_line(ASSERT_LINE);
}
}
@@ -1347,16 +1332,13 @@ void nes_0353_device::write_h(offs_t offset, u8 data)
-------------------------------------------------*/
-void nes_09034a_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nes_09034a_device::irq_timer_tick)
{
- if (id == TIMER_IRQ)
+ if (m_irq_enable)
{
- if (m_irq_enable)
- {
- m_irq_count = (m_irq_count + 1) & 0x0fff;
- if (!m_irq_count)
- set_irq_line(ASSERT_LINE);
- }
+ m_irq_count = (m_irq_count + 1) & 0x0fff;
+ if (!m_irq_count)
+ set_irq_line(ASSERT_LINE);
}
}
@@ -1419,15 +1401,12 @@ u8 nes_09034a_device::read_m(offs_t offset)
-------------------------------------------------*/
-void nes_l001_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nes_l001_device::irq_timer_tick)
{
- if (id == TIMER_IRQ)
+ if (BIT(m_irq_count, 15))
{
- if (BIT(m_irq_count, 15))
- {
- if (++m_irq_count == 0)
- set_irq_line(ASSERT_LINE);
- }
+ if (++m_irq_count == 0)
+ set_irq_line(ASSERT_LINE);
}
}
@@ -1470,15 +1449,12 @@ void nes_l001_device::write_h(offs_t offset, u8 data)
-------------------------------------------------*/
-void nes_batmanfs_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nes_batmanfs_device::irq_timer_tick)
{
- if (id == TIMER_IRQ)
- {
- // 10-bit counter does not stop when interrupts are disabled
- m_irq_count = (m_irq_count + 1) & 0x3ff;
- if (m_irq_enable && !m_irq_count)
- set_irq_line(ASSERT_LINE);
- }
+ // 10-bit counter does not stop when interrupts are disabled
+ m_irq_count = (m_irq_count + 1) & 0x3ff;
+ if (m_irq_enable && !m_irq_count)
+ set_irq_line(ASSERT_LINE);
}
void nes_batmanfs_device::write_h(offs_t offset, u8 data)
@@ -1850,18 +1826,15 @@ void nes_lh51_device::write_h(offs_t offset, u8 data)
-------------------------------------------------*/
-void nes_lh53_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nes_lh53_device::irq_timer_tick)
{
- if (id == TIMER_IRQ)
+ if (m_irq_enable)
{
- if (m_irq_enable)
+ m_irq_count++;
+ if (m_irq_count > 7560)//value from FCEUMM...
{
- m_irq_count++;
- if (m_irq_count > 7560)//value from FCEUMM...
- {
- m_irq_count = 0;
- set_irq_line(ASSERT_LINE);
- }
+ m_irq_count = 0;
+ set_irq_line(ASSERT_LINE);
}
}
}
@@ -2086,16 +2059,13 @@ uint8_t nes_rt01_device::read_h(offs_t offset)
-------------------------------------------------*/
-void nes_yung08_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nes_yung08_device::irq_timer_tick)
{
- if (id == TIMER_IRQ)
+ if (BIT(m_irq_latch, 0))
{
- if (BIT(m_irq_latch, 0))
- {
- m_irq_count = (m_irq_count + 1) & 0x0fff;
- if (!m_irq_count)
- set_irq_line(ASSERT_LINE);
- }
+ m_irq_count = (m_irq_count + 1) & 0x0fff;
+ if (!m_irq_count)
+ set_irq_line(ASSERT_LINE);
}
}
diff --git a/src/devices/bus/nes/bootleg.h b/src/devices/bus/nes/bootleg.h
index 2f97f94444e..93cdaa2ec6f 100644
--- a/src/devices/bus/nes/bootleg.h
+++ b/src/devices/bus/nes/bootleg.h
@@ -15,7 +15,7 @@ public:
nes_sc127_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual void write_h(offs_t offset, uint8_t data) override;
- virtual void hblank_irq(int scanline, int vblank, int blanked) override;
+ virtual void hblank_irq(int scanline, bool vblank, bool blanked) override;
virtual void pcb_reset() override;
protected:
@@ -44,14 +44,14 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(irq_timer_tick);
private:
u16 m_irq_count;
int m_irq_enable;
u8 m_latch;
- static constexpr device_timer_id TIMER_IRQ = 0;
emu_timer *irq_timer;
};
@@ -94,13 +94,13 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(irq_timer_tick);
private:
u16 m_irq_count;
int m_irq_enable;
- static const device_timer_id TIMER_IRQ = 0;
emu_timer *irq_timer;
};
@@ -127,7 +127,7 @@ public:
nes_btl_dn_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual void write_h(offs_t offset, uint8_t data) override;
- virtual void hblank_irq(int scanline, int vblank, int blanked) override;
+ virtual void hblank_irq(int scanline, bool vblank, bool blanked) override;
virtual void pcb_reset() override;
protected:
@@ -158,7 +158,8 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(irq_timer_tick);
private:
void update_irq(u8 data);
@@ -166,7 +167,6 @@ private:
u16 m_irq_count;
int m_irq_enable;
- static const device_timer_id TIMER_IRQ = 0;
emu_timer *irq_timer;
};
@@ -187,13 +187,13 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(irq_timer_tick);
private:
u16 m_irq_count;
int m_irq_enable;
- static const device_timer_id TIMER_IRQ = 0;
emu_timer *irq_timer;
};
@@ -217,7 +217,8 @@ protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(irq_timer_tick);
u16 m_irq_count;
int m_irq_enable;
@@ -227,7 +228,6 @@ private:
void write_45(offs_t offset, u8 data);
const u8 m_bank67;
- static const device_timer_id TIMER_IRQ = 0;
emu_timer *irq_timer;
};
@@ -285,14 +285,14 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(irq_timer_tick);
private:
u16 m_irq_count;
int m_irq_enable;
u8 m_reg;
- static const device_timer_id TIMER_IRQ = 0;
emu_timer *irq_timer;
};
@@ -312,12 +312,12 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(irq_timer_tick);
private:
u16 m_irq_count;
- static const device_timer_id TIMER_IRQ = 0;
emu_timer *irq_timer;
};
@@ -337,13 +337,13 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(irq_timer_tick);
private:
u16 m_irq_count;
int m_irq_enable;
- static const device_timer_id TIMER_IRQ = 0;
emu_timer *irq_timer;
};
@@ -583,14 +583,14 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(irq_timer_tick);
private:
uint16_t m_irq_count;
int m_irq_enable;
uint8_t m_reg;
- static const device_timer_id TIMER_IRQ = 0;
emu_timer *irq_timer;
attotime timer_freq;
};
@@ -688,14 +688,14 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(irq_timer_tick);
private:
void write_45(offs_t offset, u8 data);
u16 m_irq_count;
int m_irq_latch;
- static const device_timer_id TIMER_IRQ = 0;
emu_timer *irq_timer;
};
diff --git a/src/devices/bus/nes/cony.cpp b/src/devices/bus/nes/cony.cpp
index 4baafff89c1..3e73f35a4bf 100644
--- a/src/devices/bus/nes/cony.cpp
+++ b/src/devices/bus/nes/cony.cpp
@@ -62,7 +62,7 @@ nes_yoko_device::nes_yoko_device(const machine_config &mconfig, const char *tag,
void nes_cony_device::device_start()
{
common_start();
- irq_timer = timer_alloc(TIMER_IRQ);
+ irq_timer = timer_alloc(FUNC(nes_cony_device::irq_timer_tick), this);
irq_timer->adjust(attotime::zero, 0, clocks_to_attotime(1));
save_item(NAME(m_irq_enable));
@@ -112,18 +112,15 @@ void nes_cony_device::pcb_reset()
-------------------------------------------------*/
-void nes_cony_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nes_cony_device::irq_timer_tick)
{
- if (id == TIMER_IRQ)
+ if (m_irq_enable)
{
- if (m_irq_enable)
+ m_irq_count += BIT(m_mode_reg, 6) ? -1 : 1;
+ if (!m_irq_count)
{
- m_irq_count += BIT(m_mode_reg, 6) ? -1 : 1;
- if (!m_irq_count)
- {
- set_irq_line(ASSERT_LINE);
- m_irq_enable = 0;
- }
+ set_irq_line(ASSERT_LINE);
+ m_irq_enable = 0;
}
}
}
diff --git a/src/devices/bus/nes/cony.h b/src/devices/bus/nes/cony.h
index 29fff1908e9..8f2faea4a40 100644
--- a/src/devices/bus/nes/cony.h
+++ b/src/devices/bus/nes/cony.h
@@ -30,15 +30,15 @@ protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void set_prg();
virtual void set_chr();
+ TIMER_CALLBACK_MEMBER(irq_timer_tick);
+
u16 m_irq_count;
int m_irq_enable;
- static constexpr device_timer_id TIMER_IRQ = 0;
emu_timer *irq_timer;
u8 m_mmc_prg_bank[4];
diff --git a/src/devices/bus/nes/datach.cpp b/src/devices/bus/nes/datach.cpp
index c5f5f3c7f9a..5e71e0af6bc 100644
--- a/src/devices/bus/nes/datach.cpp
+++ b/src/devices/bus/nes/datach.cpp
@@ -231,8 +231,8 @@ nes_datach_device::nes_datach_device(const machine_config &mconfig, const char *
void nes_datach_device::device_start()
{
common_start();
- irq_timer = timer_alloc(TIMER_IRQ);
- serial_timer = timer_alloc(TIMER_SERIAL);
+ irq_timer = timer_alloc(FUNC(nes_datach_device::irq_timer_tick), this);
+ serial_timer = timer_alloc(FUNC(nes_datach_device::serial_tick), this);
irq_timer->adjust(attotime::zero, 0, clocks_to_attotime(1));
serial_timer->adjust(attotime::zero, 0, clocks_to_attotime(1000));
@@ -377,32 +377,34 @@ void nes_datach_device::device_add_mconfig(machine_config &config)
//-------------------------------------------------
-// device_timer - handler timer events
+// irq_timer_tick - handle IRQ timer
//-------------------------------------------------
-void nes_datach_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nes_datach_device::irq_timer_tick)
{
- if (id == TIMER_IRQ)
+ if (m_irq_enable)
{
- if (m_irq_enable)
+ // 16bit counter, IRQ fired when the counter goes from 1 to 0
+ // after firing, the counter is *not* reloaded, but next clock
+ // counter wraps around from 0 to 0xffff
+ if (!m_irq_count)
+ m_irq_count = 0xffff;
+ else
+ m_irq_count--;
+
+ if (!m_irq_count)
{
- // 16bit counter, IRQ fired when the counter goes from 1 to 0
- // after firing, the counter is *not* reloaded, but next clock
- // counter wraps around from 0 to 0xffff
- if (!m_irq_count)
- m_irq_count = 0xffff;
- else
- m_irq_count--;
-
- if (!m_irq_count)
- {
- set_irq_line(ASSERT_LINE);
- m_irq_enable = 0;
- }
+ set_irq_line(ASSERT_LINE);
+ m_irq_enable = 0;
}
}
- if (id == TIMER_SERIAL)
- {
- m_datach_latch = (m_reader->read_pixel() << 3);
- }
+}
+
+//-------------------------------------------------
+// serial_tick - tick in a serial bit
+//-------------------------------------------------
+
+TIMER_CALLBACK_MEMBER(nes_datach_device::serial_tick)
+{
+ m_datach_latch = (m_reader->read_pixel() << 3);
}
diff --git a/src/devices/bus/nes/datach.h b/src/devices/bus/nes/datach.h
index abdbf36bdaa..80770904596 100644
--- a/src/devices/bus/nes/datach.h
+++ b/src/devices/bus/nes/datach.h
@@ -155,9 +155,11 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_add_mconfig(machine_config &config) override;
+ TIMER_CALLBACK_MEMBER(irq_timer_tick);
+ TIMER_CALLBACK_MEMBER(serial_tick);
+
uint8_t m_datach_latch;
required_device<i2cmem_device> m_i2cmem;
required_device<barcode_reader_device> m_reader;
@@ -165,7 +167,6 @@ protected:
uint8_t m_i2c_dir;
uint8_t m_i2c_in_use;
- static const device_timer_id TIMER_SERIAL = 1;
emu_timer *serial_timer;
};
diff --git a/src/devices/bus/nes/disksys.cpp b/src/devices/bus/nes/disksys.cpp
index 71622a3a9e6..d53a2be2aab 100644
--- a/src/devices/bus/nes/disksys.cpp
+++ b/src/devices/bus/nes/disksys.cpp
@@ -121,7 +121,7 @@ void nes_disksys_device::device_start()
m_disk->floppy_install_load_proc(nes_disksys_device::load_proc);
m_disk->floppy_install_unload_proc(nes_disksys_device::unload_proc);
- irq_timer = timer_alloc(TIMER_IRQ);
+ irq_timer = timer_alloc(FUNC(nes_disksys_device::irq_timer_tick), this);
irq_timer->adjust(attotime::zero, 0, clocks_to_attotime(1));
save_item(NAME(m_fds_motor_on));
@@ -212,7 +212,7 @@ uint8_t nes_disksys_device::read_m(offs_t offset)
return m_prgram[offset];
}
-void nes_disksys_device::hblank_irq(int scanline, int vblank, int blanked)
+void nes_disksys_device::hblank_irq(int scanline, bool vblank, bool blanked)
{
// FIXME: This looks like a gross hack that ties the disk byte transfer IRQ to the PPU. Seriously?
if (m_irq_transfer)
@@ -403,25 +403,22 @@ uint8_t nes_disksys_device::read_ex(offs_t offset)
}
//-------------------------------------------------
-// device_timer - handler timer events
+// irq_timer_tick - handle IRQ timer
//-------------------------------------------------
-void nes_disksys_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nes_disksys_device::irq_timer_tick)
{
- if (id == TIMER_IRQ)
+ if (m_irq_enable)
{
- if (m_irq_enable)
+ if (m_irq_count)
+ m_irq_count--;
+ else
{
- if (m_irq_count)
- m_irq_count--;
- else
- {
- set_irq_line(ASSERT_LINE);
- m_irq_count = m_irq_count_latch;
- if (!m_irq_repeat)
- m_irq_enable = 0;
- m_fds_status0 |= 0x01;
- }
+ set_irq_line(ASSERT_LINE);
+ m_irq_count = m_irq_count_latch;
+ if (!m_irq_repeat)
+ m_irq_enable = 0;
+ m_fds_status0 |= 0x01;
}
}
}
diff --git a/src/devices/bus/nes/disksys.h b/src/devices/bus/nes/disksys.h
index 61bd9dd2048..021be514029 100644
--- a/src/devices/bus/nes/disksys.h
+++ b/src/devices/bus/nes/disksys.h
@@ -27,13 +27,12 @@ public:
virtual void disk_flip_side() override;
- virtual void hblank_irq(int scanline, int vblank, int blanked) override;
+ virtual void hblank_irq(int scanline, bool vblank, bool blanked) override;
virtual void pcb_reset() override;
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
@@ -44,11 +43,12 @@ private:
static void load_proc(device_image_interface &image, bool is_created);
static void unload_proc(device_image_interface &image);
+ TIMER_CALLBACK_MEMBER(irq_timer_tick);
+
std::unique_ptr<uint8_t[]> m_fds_data; // here, we store a copy of the disk
required_device<legacy_floppy_image_device> m_disk;
required_device<rp2c33_sound_device> m_sound;
- static const device_timer_id TIMER_IRQ = 0;
emu_timer *irq_timer;
void load_disk(device_image_interface &image);
diff --git a/src/devices/bus/nes/event.cpp b/src/devices/bus/nes/event.cpp
index 0ebc4ace30a..70aee4b90e0 100644
--- a/src/devices/bus/nes/event.cpp
+++ b/src/devices/bus/nes/event.cpp
@@ -61,7 +61,7 @@ void nes_event_device::device_start()
{
nes_sxrom_device::device_start();
- event_timer = timer_alloc(TIMER_EVENT);
+ event_timer = timer_alloc(FUNC(nes_event_device::event_tick), this);
event_timer->adjust(attotime::never);
save_item(NAME(m_nwc_init));
@@ -87,7 +87,7 @@ void nes_event2_device::device_start()
{
mmc3_start();
- event_timer = timer_alloc(TIMER_EVENT);
+ event_timer = timer_alloc(FUNC(nes_event2_device::event_tick), this);
event_timer->adjust(attotime::zero, 0, clocks_to_attotime(1));
save_item(NAME(m_tqrom_mode));
@@ -296,12 +296,12 @@ ioport_constructor nes_event2_device::device_input_ports() const
//-------------------------------------------------
-// device_timer - handler timer events
+// event_tick - tick the event timer
//-------------------------------------------------
-void nes_event_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nes_event_device::event_tick)
{
- if (id == TIMER_EVENT && m_timer_on)
+ if (m_timer_on)
{
if (++m_timer_count >= (0x10 | m_dsw->read()) << 25)
{
@@ -311,8 +311,8 @@ void nes_event_device::device_timer(emu_timer &timer, device_timer_id id, int pa
}
}
-void nes_event2_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nes_event2_device::event_tick)
{
- if (id == TIMER_EVENT && m_timer_enabled)
+ if (m_timer_enabled)
m_timer_count++;
}
diff --git a/src/devices/bus/nes/event.h b/src/devices/bus/nes/event.h
index 51875802695..b10a3f95ee1 100644
--- a/src/devices/bus/nes/event.h
+++ b/src/devices/bus/nes/event.h
@@ -22,17 +22,17 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual ioport_constructor device_input_ports() const override;
virtual void set_prg() override;
virtual void set_chr() override;
+ TIMER_CALLBACK_MEMBER(event_tick);
+
required_ioport m_dsw;
int m_nwc_init;
- static constexpr device_timer_id TIMER_EVENT = 0;
emu_timer *event_timer;
u32 m_timer_count;
@@ -58,14 +58,14 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual ioport_constructor device_input_ports() const override;
+ TIMER_CALLBACK_MEMBER(event_tick);
+
required_ioport m_dsw;
bool m_tqrom_mode;
- static constexpr device_timer_id TIMER_EVENT = 0;
emu_timer *event_timer;
u32 m_timer_count;
diff --git a/src/devices/bus/nes/ggenie.h b/src/devices/bus/nes/ggenie.h
index 49681c1ed5f..6370301d19a 100644
--- a/src/devices/bus/nes/ggenie.h
+++ b/src/devices/bus/nes/ggenie.h
@@ -28,8 +28,8 @@ public:
virtual u8 nt_r(offs_t offset) override;
virtual void nt_w(offs_t offset, u8 data) override;
- void hblank_irq(int scanline, int vblank, int blanked) override { if (m_gg_bypass && m_ggslot->m_cart) m_ggslot->m_cart->hblank_irq(scanline, vblank, blanked); }
- void scanline_irq(int scanline, int vblank, int blanked) override { if (m_gg_bypass && m_ggslot->m_cart) m_ggslot->m_cart->scanline_irq(scanline, vblank, blanked); }
+ void hblank_irq(int scanline, bool vblank, bool blanked) override { if (m_gg_bypass && m_ggslot->m_cart) m_ggslot->m_cart->hblank_irq(scanline, vblank, blanked); }
+ void scanline_irq(int scanline, bool vblank, bool blanked) override { if (m_gg_bypass && m_ggslot->m_cart) m_ggslot->m_cart->scanline_irq(scanline, vblank, blanked); }
void ppu_latch(offs_t offset) override { if (m_gg_bypass && m_ggslot->m_cart) m_ggslot->m_cart->ppu_latch(offset); }
virtual void pcb_reset() override;
diff --git a/src/devices/bus/nes/irem.cpp b/src/devices/bus/nes/irem.cpp
index d0bc4d48857..f90959825a9 100644
--- a/src/devices/bus/nes/irem.cpp
+++ b/src/devices/bus/nes/irem.cpp
@@ -115,7 +115,7 @@ void nes_g101_device::pcb_reset()
void nes_h3001_device::device_start()
{
nes_g101_device::device_start();
- irq_timer = timer_alloc(TIMER_IRQ);
+ irq_timer = timer_alloc(FUNC(nes_h3001_device::irq_timer_tick), this);
irq_timer->adjust(attotime::zero, 0, clocks_to_attotime(1));
save_item(NAME(m_irq_enable));
@@ -260,22 +260,19 @@ void nes_g101_device::write_h(offs_t offset, u8 data)
-------------------------------------------------*/
-void nes_h3001_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nes_h3001_device::irq_timer_tick)
{
- if (id == TIMER_IRQ)
+ if (m_irq_enable)
{
- if (m_irq_enable)
- {
- // 16bit counter, IRQ fired when the counter reaches 0
- // after firing, the counter is *not* reloaded and does not wrap
- if (m_irq_count)
- m_irq_count--;
+ // 16bit counter, IRQ fired when the counter reaches 0
+ // after firing, the counter is *not* reloaded and does not wrap
+ if (m_irq_count)
+ m_irq_count--;
- if (!m_irq_count)
- {
- set_irq_line(ASSERT_LINE);
- m_irq_enable = 0;
- }
+ if (!m_irq_count)
+ {
+ set_irq_line(ASSERT_LINE);
+ m_irq_enable = 0;
}
}
}
diff --git a/src/devices/bus/nes/irem.h b/src/devices/bus/nes/irem.h
index 476d85f6735..eef809ca7b5 100644
--- a/src/devices/bus/nes/irem.h
+++ b/src/devices/bus/nes/irem.h
@@ -93,13 +93,13 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(irq_timer_tick);
private:
u16 m_irq_count, m_irq_count_latch;
u8 m_irq_enable;
- static constexpr device_timer_id TIMER_IRQ = 0;
emu_timer *irq_timer;
};
diff --git a/src/devices/bus/nes/jaleco.cpp b/src/devices/bus/nes/jaleco.cpp
index e88af117c12..a83ebfb5a04 100644
--- a/src/devices/bus/nes/jaleco.cpp
+++ b/src/devices/bus/nes/jaleco.cpp
@@ -159,7 +159,7 @@ void nes_jf17_device::pcb_reset()
void nes_ss88006_device::device_start()
{
common_start();
- irq_timer = timer_alloc(TIMER_IRQ);
+ irq_timer = timer_alloc(FUNC(nes_ss88006_device::irq_timer_tick), this);
irq_timer->adjust(attotime::zero, 0, clocks_to_attotime(1));
save_item(NAME(m_mmc_prg_bank));
@@ -315,26 +315,23 @@ void nes_jf17_device::write_h(offs_t offset, u8 data)
-------------------------------------------------*/
-void nes_ss88006_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nes_ss88006_device::irq_timer_tick)
{
- if (id == TIMER_IRQ)
+ if (m_irq_enable)
{
- if (m_irq_enable)
- {
- u16 mask = 0xffff; // 16-bit counter (default)
-
- if (BIT(m_irq_mode, 3)) // 4-bit counter
- mask = 0x000f;
- else if (BIT(m_irq_mode, 2)) // 8-bit counter
- mask = 0x00ff;
- else if (BIT(m_irq_mode, 1)) // 12-bit counter
- mask = 0x0fff;
-
- m_irq_count = (m_irq_count & ~mask) | ((m_irq_count - 1) & mask);
-
- if ((m_irq_count & mask) == mask)
- set_irq_line(ASSERT_LINE);
- }
+ u16 mask = 0xffff; // 16-bit counter (default)
+
+ if (BIT(m_irq_mode, 3)) // 4-bit counter
+ mask = 0x000f;
+ else if (BIT(m_irq_mode, 2)) // 8-bit counter
+ mask = 0x00ff;
+ else if (BIT(m_irq_mode, 1)) // 12-bit counter
+ mask = 0x0fff;
+
+ m_irq_count = (m_irq_count & ~mask) | ((m_irq_count - 1) & mask);
+
+ if ((m_irq_count & mask) == mask)
+ set_irq_line(ASSERT_LINE);
}
}
diff --git a/src/devices/bus/nes/jaleco.h b/src/devices/bus/nes/jaleco.h
index 0b81626c4bf..7ed1b13d25a 100644
--- a/src/devices/bus/nes/jaleco.h
+++ b/src/devices/bus/nes/jaleco.h
@@ -135,7 +135,8 @@ protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(irq_timer_tick);
optional_device<samples_device> m_samples;
@@ -144,7 +145,6 @@ private:
u8 m_irq_mode;
u8 m_irq_enable;
- static constexpr device_timer_id TIMER_IRQ = 0;
emu_timer *irq_timer;
u8 m_mmc_prg_bank[3];
diff --git a/src/devices/bus/nes/jy.cpp b/src/devices/bus/nes/jy.cpp
index 0aae4039ff9..655634f22ef 100644
--- a/src/devices/bus/nes/jy.cpp
+++ b/src/devices/bus/nes/jy.cpp
@@ -73,7 +73,7 @@ nes_jy_typec_device::nes_jy_typec_device(const machine_config &mconfig, const ch
void nes_jy_typea_device::device_start()
{
common_start();
- irq_timer = timer_alloc(TIMER_IRQ);
+ irq_timer = timer_alloc(FUNC(nes_jy_typea_device::irq_timer_tick), this);
irq_timer->reset();
timer_freq = clocks_to_attotime(1);
@@ -146,18 +146,18 @@ void nes_jy_typea_device::pcb_reset()
uint8_t nes_jy_typea_device::nt_r(offs_t offset)
{
int page = ((offset & 0xc00) >> 10);
- irq_clock(0, 2);
+ irq_clock(false, 2);
return m_nt_access[page][offset & 0x3ff];
}
uint8_t nes_jy_typea_device::chr_r(offs_t offset)
{
int bank = offset >> 10;
- irq_clock(0, 2);
+ irq_clock(false, 2);
return m_chr_access[bank][offset & 0x3ff];
}
-void nes_jy_typea_device::irq_clock(int mode, int blanked)
+void nes_jy_typea_device::irq_clock(bool blanked, int mode)
{
bool clock = false, fire = false;
@@ -224,15 +224,12 @@ void nes_jy_typea_device::irq_clock(int mode, int blanked)
}
}
-void nes_jy_typea_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nes_jy_typea_device::irq_timer_tick)
{
- if (id == TIMER_IRQ)
- {
- irq_clock(0, 0);
- }
+ irq_clock(false, 0);
}
-void nes_jy_typea_device::scanline_irq(int scanline, int vblank, int blanked)
+void nes_jy_typea_device::scanline_irq(int scanline, bool vblank, bool blanked)
{
if (scanline < ppu2c0x_device::BOTTOM_VISIBLE_SCANLINE)
irq_clock(blanked, 1);
@@ -572,7 +569,7 @@ uint8_t nes_jy_typec_device::chr_r(offs_t offset)
{
int bank = offset >> 10;
- irq_clock(0, 2);
+ irq_clock(false, 2);
switch (offset & 0xff0)
{
case 0xfd0:
diff --git a/src/devices/bus/nes/jy.h b/src/devices/bus/nes/jy.h
index ac4cf8e397e..69c4ea8b04e 100644
--- a/src/devices/bus/nes/jy.h
+++ b/src/devices/bus/nes/jy.h
@@ -24,7 +24,7 @@ public:
virtual uint8_t chr_r(offs_t offset) override;
virtual uint8_t nt_r(offs_t offset) override;
- virtual void scanline_irq(int scanline, int vblank, int blanked) override;
+ virtual void scanline_irq(int scanline, bool vblank, bool blanked) override;
virtual void pcb_reset() override;
protected:
@@ -32,9 +32,10 @@ protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
- void irq_clock(int blanked, int mode);
+ TIMER_CALLBACK_MEMBER(irq_timer_tick);
+
+ void irq_clock(bool blanked, int mode);
void update_banks(int reg);
void update_prg();
void update_chr();
@@ -61,7 +62,6 @@ protected:
int m_irq_enable;
int m_irq_up, m_irq_down;
- static const device_timer_id TIMER_IRQ = 0;
emu_timer *irq_timer;
attotime timer_freq;
};
diff --git a/src/devices/bus/nes/kaiser.cpp b/src/devices/bus/nes/kaiser.cpp
index f0f37d2ba2b..4635c699895 100644
--- a/src/devices/bus/nes/kaiser.cpp
+++ b/src/devices/bus/nes/kaiser.cpp
@@ -188,7 +188,7 @@ void nes_ks7022_device::pcb_reset()
void nes_ks7032_device::device_start()
{
common_start();
- irq_timer = timer_alloc(TIMER_IRQ);
+ irq_timer = timer_alloc(FUNC(nes_ks7032_device::irq_timer_tick), this);
irq_timer->adjust(attotime::zero, 0, clocks_to_attotime(1));
save_item(NAME(m_latch));
@@ -230,7 +230,7 @@ void nes_ks7016_device::pcb_reset()
void nes_ks7017_device::device_start()
{
common_start();
- irq_timer = timer_alloc(TIMER_IRQ);
+ irq_timer = timer_alloc(FUNC(nes_ks7017_device::irq_timer_tick), this);
irq_timer->adjust(attotime::zero, 0, clocks_to_attotime(1));
save_item(NAME(m_latch));
@@ -443,18 +443,15 @@ u8 nes_ks7022_device::read_h(offs_t offset)
-------------------------------------------------*/
-void nes_ks7032_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nes_ks7032_device::irq_timer_tick)
{
- if (id == TIMER_IRQ)
+ if (m_irq_enable)
{
- if (m_irq_enable)
+ if (++m_irq_count == 0)
{
- if (++m_irq_count == 0)
- {
- set_irq_line(ASSERT_LINE);
- m_irq_enable = 0;
- m_irq_count = m_irq_count_latch;
- }
+ set_irq_line(ASSERT_LINE);
+ m_irq_enable = 0;
+ m_irq_count = m_irq_count_latch;
}
}
}
@@ -611,18 +608,15 @@ void nes_ks7016_device::write_h(offs_t offset, u8 data)
-------------------------------------------------*/
-void nes_ks7017_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nes_ks7017_device::irq_timer_tick)
{
- if (id == TIMER_IRQ)
+ if (m_irq_enable)
{
- if (m_irq_enable)
+ if (--m_irq_count == 0)
{
- if (--m_irq_count == 0)
- {
- set_irq_line(ASSERT_LINE);
- m_irq_enable = 0;
- m_irq_status |= 0x01;
- }
+ set_irq_line(ASSERT_LINE);
+ m_irq_enable = 0;
+ m_irq_status |= 0x01;
}
}
}
diff --git a/src/devices/bus/nes/kaiser.h b/src/devices/bus/nes/kaiser.h
index 4c19ff2c2a0..bfed01f40f9 100644
--- a/src/devices/bus/nes/kaiser.h
+++ b/src/devices/bus/nes/kaiser.h
@@ -80,7 +80,8 @@ protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(irq_timer_tick);
u8 m_reg[8];
@@ -91,7 +92,6 @@ private:
u16 m_irq_count, m_irq_count_latch;
u8 m_irq_enable;
- static const device_timer_id TIMER_IRQ = 0;
emu_timer *irq_timer;
};
@@ -162,7 +162,8 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(irq_timer_tick);
private:
u8 m_latch;
@@ -171,7 +172,6 @@ private:
u8 m_irq_status;
u8 m_irq_enable;
- static const device_timer_id TIMER_IRQ = 0;
emu_timer *irq_timer;
};
diff --git a/src/devices/bus/nes/konami.cpp b/src/devices/bus/nes/konami.cpp
index ae7c30dcb9b..64835930218 100644
--- a/src/devices/bus/nes/konami.cpp
+++ b/src/devices/bus/nes/konami.cpp
@@ -122,7 +122,7 @@ void nes_konami_vrc2_device::pcb_reset()
void nes_konami_vrc3_device::device_start()
{
common_start();
- irq_timer = timer_alloc(TIMER_IRQ);
+ irq_timer = timer_alloc(FUNC(nes_konami_vrc3_device::irq_timer_tick), this);
irq_timer->adjust(attotime::zero, 0, clocks_to_attotime(1));
save_item(NAME(m_irq_mode));
@@ -148,7 +148,7 @@ void nes_konami_vrc3_device::pcb_reset()
void nes_konami_vrc4_device::device_start()
{
common_start();
- irq_timer = timer_alloc(TIMER_IRQ);
+ irq_timer = timer_alloc(FUNC(nes_konami_vrc4_device::irq_timer_tick), this);
irq_timer->adjust(attotime::zero, 0, clocks_to_attotime(1));
save_item(NAME(m_irq_mode));
@@ -309,21 +309,18 @@ void nes_konami_vrc2_device::write_h(offs_t offset, u8 data)
-------------------------------------------------*/
-void nes_konami_vrc3_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nes_konami_vrc3_device::irq_timer_tick)
{
- if (id == TIMER_IRQ)
+ if (m_irq_enable)
{
- if (m_irq_enable)
- {
- u16 mask = m_irq_mode ? 0x00ff : 0xffff; // 8 or 16 bit mode?
+ u16 mask = m_irq_mode ? 0x00ff : 0xffff; // 8 or 16 bit mode?
- // upper byte only incremented and reloaded in 16-bit mode
- m_irq_count = (m_irq_count & ~mask) | ((m_irq_count + 1) & mask);
- if (!(m_irq_count & mask))
- {
- set_irq_line(ASSERT_LINE);
- m_irq_count = (m_irq_count & ~mask) | (m_irq_count_latch & mask);
- }
+ // upper byte only incremented and reloaded in 16-bit mode
+ m_irq_count = (m_irq_count & ~mask) | ((m_irq_count + 1) & mask);
+ if (!(m_irq_count & mask))
+ {
+ set_irq_line(ASSERT_LINE);
+ m_irq_count = (m_irq_count & ~mask) | (m_irq_count_latch & mask);
}
}
}
@@ -384,26 +381,23 @@ void nes_konami_vrc4_device::irq_tick()
m_irq_count++;
}
-void nes_konami_vrc4_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nes_konami_vrc4_device::irq_timer_tick)
{
- if (id == TIMER_IRQ)
+ if (m_irq_enable)
{
- if (m_irq_enable)
+ if (m_irq_mode) // cycle mode
+ irq_tick();
+ else // scanline mode
{
- if (m_irq_mode) // cycle mode
- irq_tick();
- else // scanline mode
+ // A prescaler divides the passing CPU cycles by 114, 114, then 113 (and repeats that order).
+ // This approximates 113+2/3 CPU cycles, which is one NTSC scanline.
+ // Since this is a CPU-based IRQ, though, it is triggered also during non visible scanlines...
+ m_irq_prescale -= 3;
+
+ if (m_irq_prescale <= 0)
{
- // A prescaler divides the passing CPU cycles by 114, 114, then 113 (and repeats that order).
- // This approximates 113+2/3 CPU cycles, which is one NTSC scanline.
- // Since this is a CPU-based IRQ, though, it is triggered also during non visible scanlines...
- m_irq_prescale -= 3;
-
- if (m_irq_prescale <= 0)
- {
- m_irq_prescale += 341;
- irq_tick();
- }
+ m_irq_prescale += 341;
+ irq_tick();
}
}
}
diff --git a/src/devices/bus/nes/konami.h b/src/devices/bus/nes/konami.h
index add13c379d9..ced0f7f4648 100644
--- a/src/devices/bus/nes/konami.h
+++ b/src/devices/bus/nes/konami.h
@@ -73,14 +73,14 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(irq_timer_tick);
private:
u16 m_irq_count, m_irq_count_latch;
int m_irq_enable, m_irq_enable_latch;
int m_irq_mode;
- static constexpr device_timer_id TIMER_IRQ = 0;
emu_timer *irq_timer;
};
@@ -105,7 +105,8 @@ protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(irq_timer_tick);
void set_mirror(u8 data);
void set_prg(int prg_base, int prg_mask);
@@ -126,7 +127,6 @@ protected:
int m_irq_mode;
int m_irq_prescale;
- static constexpr device_timer_id TIMER_IRQ = 0;
emu_timer *irq_timer;
};
diff --git a/src/devices/bus/nes/legacy.cpp b/src/devices/bus/nes/legacy.cpp
index 61ac1e6bdae..8625c4fab97 100644
--- a/src/devices/bus/nes/legacy.cpp
+++ b/src/devices/bus/nes/legacy.cpp
@@ -62,7 +62,7 @@ nes_ffe8_device::nes_ffe8_device(const machine_config &mconfig, const char *tag,
void nes_ffe4_device::device_start()
{
common_start();
- irq_timer = timer_alloc(TIMER_IRQ);
+ irq_timer = timer_alloc(FUNC(nes_ffe4_device::irq_timer_tick), this);
irq_timer->adjust(attotime::zero, 0, clocks_to_attotime(1));
save_item(NAME(m_exram));
@@ -141,21 +141,18 @@ void nes_ffe3_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_ffe4_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nes_ffe4_device::irq_timer_tick)
{
- if (id == TIMER_IRQ)
+ if (m_irq_enable)
{
- if (m_irq_enable)
+ if (m_irq_count == 0xffff)
{
- if (m_irq_count == 0xffff)
- {
- set_irq_line(ASSERT_LINE);
- m_irq_count = 0;
- m_irq_enable = 0;
- }
- else
- m_irq_count++;
+ set_irq_line(ASSERT_LINE);
+ m_irq_count = 0;
+ m_irq_enable = 0;
}
+ else
+ m_irq_count++;
}
}
diff --git a/src/devices/bus/nes/legacy.h b/src/devices/bus/nes/legacy.h
index 8f2c0419ff1..191a718da45 100644
--- a/src/devices/bus/nes/legacy.h
+++ b/src/devices/bus/nes/legacy.h
@@ -36,13 +36,12 @@ public:
virtual void pcb_reset() override;
protected:
- static constexpr device_timer_id TIMER_IRQ = 0;
-
nes_ffe4_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(irq_timer_tick);
uint16_t m_irq_count;
int m_irq_enable;
diff --git a/src/devices/bus/nes/mmc3.cpp b/src/devices/bus/nes/mmc3.cpp
index 4dd3422cb54..ff9774882fd 100644
--- a/src/devices/bus/nes/mmc3.cpp
+++ b/src/devices/bus/nes/mmc3.cpp
@@ -204,7 +204,7 @@ void nes_zz_device::pcb_reset()
-------------------------------------------------*/
/* Here, IRQ counter decrements every scanline. */
-void nes_txrom_device::hblank_irq(int scanline, int vblank, int blanked)
+void nes_txrom_device::hblank_irq(int scanline, bool vblank, bool blanked)
{
if (scanline < ppu2c0x_device::BOTTOM_VISIBLE_SCANLINE)
{
diff --git a/src/devices/bus/nes/mmc3.h b/src/devices/bus/nes/mmc3.h
index 3d5f72b63e0..1bc3cc0536c 100644
--- a/src/devices/bus/nes/mmc3.h
+++ b/src/devices/bus/nes/mmc3.h
@@ -23,7 +23,7 @@ public:
virtual void prg_cb(int start, int bank);
virtual void chr_cb(int start, int bank, int source);
- virtual void hblank_irq(int scanline, int vblank, int blanked) override;
+ virtual void hblank_irq(int scanline, bool vblank, bool blanked) override;
virtual void pcb_reset() override;
protected:
diff --git a/src/devices/bus/nes/mmc5.cpp b/src/devices/bus/nes/mmc5.cpp
index 2c923f562fd..f15b1a7658b 100644
--- a/src/devices/bus/nes/mmc5.cpp
+++ b/src/devices/bus/nes/mmc5.cpp
@@ -235,7 +235,7 @@ void nes_exrom_device::update_prg()
}
}
-void nes_exrom_device::hblank_irq(int scanline, int vblank, int blanked )
+void nes_exrom_device::hblank_irq(int scanline, bool vblank, bool blanked)
{
m_vcount = scanline;
diff --git a/src/devices/bus/nes/mmc5.h b/src/devices/bus/nes/mmc5.h
index 27a9709cafd..a806c704883 100644
--- a/src/devices/bus/nes/mmc5.h
+++ b/src/devices/bus/nes/mmc5.h
@@ -31,7 +31,7 @@ public:
virtual uint8_t nt_r(offs_t offset) override;
virtual void nt_w(offs_t offset, uint8_t data) override;
- virtual void hblank_irq(int scanline, int vblank, int blanked) override;
+ virtual void hblank_irq(int scanline, bool vblank, bool blanked) override;
virtual void pcb_reset() override;
protected:
diff --git a/src/devices/bus/nes/namcot.cpp b/src/devices/bus/nes/namcot.cpp
index 1d44b13624f..31f72761751 100644
--- a/src/devices/bus/nes/namcot.cpp
+++ b/src/devices/bus/nes/namcot.cpp
@@ -140,7 +140,7 @@ void nes_namcot3425_device::pcb_reset()
void nes_namcot340_device::device_start()
{
common_start();
- irq_timer = timer_alloc(TIMER_IRQ);
+ irq_timer = timer_alloc(FUNC(nes_namcot340_device::irq_timer_tick), this);
irq_timer->adjust(attotime::zero, 0, clocks_to_attotime(1));
save_item(NAME(m_irq_enable));
@@ -165,7 +165,7 @@ void nes_namcot340_device::pcb_reset()
void nes_namcot175_device::device_start()
{
common_start();
- irq_timer = timer_alloc(TIMER_IRQ);
+ irq_timer = timer_alloc(FUNC(nes_namcot175_device::irq_timer_tick), this);
irq_timer->adjust(attotime::zero, 0, clocks_to_attotime(1));
save_item(NAME(m_irq_enable));
@@ -192,7 +192,7 @@ void nes_namcot175_device::pcb_reset()
void nes_namcot163_device::device_start()
{
common_start();
- irq_timer = timer_alloc(TIMER_IRQ);
+ irq_timer = timer_alloc(FUNC(nes_namcot163_device::irq_timer_tick), this);
irq_timer->adjust(attotime::zero, 0, clocks_to_attotime(1));
save_item(NAME(m_irq_enable));
@@ -397,17 +397,14 @@ void nes_namcot3425_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_namcot340_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nes_namcot340_device::irq_timer_tick)
{
- if (id == TIMER_IRQ)
+ if (m_irq_enable)
{
- if (m_irq_enable)
- {
- if (m_irq_count == 0x7fff) // counter does not wrap to 0!
- set_irq_line(ASSERT_LINE);
- else
- m_irq_count++;
- }
+ if (m_irq_count == 0x7fff) // counter does not wrap to 0!
+ set_irq_line(ASSERT_LINE);
+ else
+ m_irq_count++;
}
}
diff --git a/src/devices/bus/nes/namcot.h b/src/devices/bus/nes/namcot.h
index e8fb0430fee..13d30804b8a 100644
--- a/src/devices/bus/nes/namcot.h
+++ b/src/devices/bus/nes/namcot.h
@@ -94,13 +94,12 @@ public:
virtual void pcb_reset() override;
protected:
- static constexpr device_timer_id TIMER_IRQ = 0;
-
nes_namcot340_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(irq_timer_tick);
uint16_t m_irq_count;
int m_irq_enable;
diff --git a/src/devices/bus/nes/nanjing.cpp b/src/devices/bus/nes/nanjing.cpp
index 3618024830c..6a451b3c59d 100644
--- a/src/devices/bus/nes/nanjing.cpp
+++ b/src/devices/bus/nes/nanjing.cpp
@@ -91,7 +91,7 @@ void nes_nanjing_device::pcb_reset()
-------------------------------------------------*/
-void nes_nanjing_device::hblank_irq(int scanline, int vblank, int blanked)
+void nes_nanjing_device::hblank_irq(int scanline, bool vblank, bool blanked)
{
if (BIT(m_reg[0], 7))
{
diff --git a/src/devices/bus/nes/nanjing.h b/src/devices/bus/nes/nanjing.h
index c5a71032573..979fbb1e5ee 100644
--- a/src/devices/bus/nes/nanjing.h
+++ b/src/devices/bus/nes/nanjing.h
@@ -22,7 +22,7 @@ public:
virtual uint8_t read_l(offs_t offset) override;
virtual void write_l(offs_t offset, uint8_t data) override;
- virtual void hblank_irq(int scanline, int vblank, int blanked) override;
+ virtual void hblank_irq(int scanline, bool vblank, bool blanked) override;
virtual void pcb_reset() override;
protected:
diff --git a/src/devices/bus/nes/nes_slot.h b/src/devices/bus/nes/nes_slot.h
index f87ee4273c5..932bff1d41d 100644
--- a/src/devices/bus/nes/nes_slot.h
+++ b/src/devices/bus/nes/nes_slot.h
@@ -251,8 +251,8 @@ public:
uint32_t get_misc_rom_size() const { return m_misc_rom_size; }
virtual void ppu_latch(offs_t offset) {}
- virtual void hblank_irq(int scanline, int vblank, int blanked) {}
- virtual void scanline_irq(int scanline, int vblank, int blanked) {}
+ virtual void hblank_irq(int scanline, bool vblank, bool blanked) {}
+ virtual void scanline_irq(int scanline, bool vblank, bool blanked) {}
virtual void pcb_reset() {} // many pcb expect specific PRG/CHR banking at start
virtual void pcb_start(running_machine &machine, uint8_t *ciram_ptr, bool cart_mounted);
diff --git a/src/devices/bus/nes/pirate.cpp b/src/devices/bus/nes/pirate.cpp
index f7a5fbd6362..81a06c7d655 100644
--- a/src/devices/bus/nes/pirate.cpp
+++ b/src/devices/bus/nes/pirate.cpp
@@ -372,7 +372,7 @@ uint8_t nes_fukutake_device::read_m(offs_t offset)
-------------------------------------------------*/
-void nes_futuremedia_device::hblank_irq(int scanline, int vblank, int blanked)
+void nes_futuremedia_device::hblank_irq(int scanline, bool vblank, bool blanked)
{
// if (scanline < ppu2c0x_device::BOTTOM_VISIBLE_SCANLINE)
{
@@ -577,7 +577,7 @@ uint8_t nes_edu2k_device::read_m(offs_t offset)
-------------------------------------------------*/
-void nes_jy830623c_device::hblank_irq(int scanline, int vblank, int blanked)
+void nes_jy830623c_device::hblank_irq(int scanline, bool vblank, bool blanked)
{
if (scanline < ppu2c0x_device::BOTTOM_VISIBLE_SCANLINE)
{
diff --git a/src/devices/bus/nes/pirate.h b/src/devices/bus/nes/pirate.h
index 55ce92a81be..9f7be76cc56 100644
--- a/src/devices/bus/nes/pirate.h
+++ b/src/devices/bus/nes/pirate.h
@@ -69,7 +69,7 @@ public:
virtual void write_h(offs_t offset, u8 data) override;
- virtual void hblank_irq(int scanline, int vblank, int blanked) override;
+ virtual void hblank_irq(int scanline, bool vblank, bool blanked) override;
virtual void pcb_reset() override;
protected:
@@ -177,7 +177,7 @@ public:
virtual void write_m(offs_t offset, u8 data) override;
virtual void write_h(offs_t offset, u8 data) override;
- virtual void hblank_irq(int scanline, int vblank, int blanked) override;
+ virtual void hblank_irq(int scanline, bool vblank, bool blanked) override;
virtual void pcb_reset() override;
protected:
diff --git a/src/devices/bus/nes/sunsoft.cpp b/src/devices/bus/nes/sunsoft.cpp
index 1a049a2aafd..ffe5aec9005 100644
--- a/src/devices/bus/nes/sunsoft.cpp
+++ b/src/devices/bus/nes/sunsoft.cpp
@@ -110,7 +110,7 @@ void nes_sunsoft_2_device::pcb_reset()
void nes_sunsoft_3_device::device_start()
{
common_start();
- irq_timer = timer_alloc(TIMER_IRQ);
+ irq_timer = timer_alloc(FUNC(nes_sunsoft_3_device::irq_timer_tick), this);
irq_timer->adjust(attotime::zero, 0, clocks_to_attotime(1));
save_item(NAME(m_irq_enable));
@@ -149,7 +149,7 @@ void nes_sunsoft_4_device::pcb_reset()
void nes_sunsoft_fme7_device::device_start()
{
common_start();
- irq_timer = timer_alloc(TIMER_IRQ);
+ irq_timer = timer_alloc(FUNC(nes_sunsoft_fme7_device::irq_timer_tick), this);
irq_timer->adjust(attotime::zero, 0, clocks_to_attotime(1));
save_item(NAME(m_wram_bank));
@@ -242,15 +242,12 @@ void nes_sunsoft_2_device::write_h(offs_t offset, uint8_t data)
-------------------------------------------------*/
-void nes_sunsoft_3_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nes_sunsoft_3_device::irq_timer_tick)
{
- if (id == TIMER_IRQ)
+ if (m_irq_enable && --m_irq_count == 0xffff)
{
- if (m_irq_enable && --m_irq_count == 0xffff)
- {
- set_irq_line(ASSERT_LINE);
- m_irq_enable = 0;
- }
+ set_irq_line(ASSERT_LINE);
+ m_irq_enable = 0;
}
}
@@ -382,17 +379,14 @@ u8 nes_sunsoft_4_device::read_m(offs_t offset)
-------------------------------------------------*/
-void nes_sunsoft_fme7_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nes_sunsoft_fme7_device::irq_timer_tick)
{
- if (id == TIMER_IRQ)
+ if (BIT(m_irq_enable, 7)) // counter decrement enabled
{
- if (BIT(m_irq_enable, 7)) // counter decrement enabled
+ if (--m_irq_count == 0xffff)
{
- if (--m_irq_count == 0xffff)
- {
- if (BIT(m_irq_enable, 0)) // IRQs enabled
- set_irq_line(ASSERT_LINE);
- }
+ if (BIT(m_irq_enable, 0)) // IRQs enabled
+ set_irq_line(ASSERT_LINE);
}
}
}
diff --git a/src/devices/bus/nes/sunsoft.h b/src/devices/bus/nes/sunsoft.h
index ebbb8048e83..000150922c7 100644
--- a/src/devices/bus/nes/sunsoft.h
+++ b/src/devices/bus/nes/sunsoft.h
@@ -52,13 +52,13 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(irq_timer_tick);
private:
uint16_t m_irq_count;
int m_irq_enable, m_irq_toggle;
- static const device_timer_id TIMER_IRQ = 0;
emu_timer *irq_timer;
};
@@ -113,13 +113,13 @@ protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(irq_timer_tick);
private:
uint16_t m_irq_count;
int m_irq_enable;
- static const device_timer_id TIMER_IRQ = 0;
emu_timer *irq_timer;
uint8_t m_latch;
diff --git a/src/devices/bus/nes/sunsoft_dcs.cpp b/src/devices/bus/nes/sunsoft_dcs.cpp
index e107c26b9d4..7f291e741ed 100644
--- a/src/devices/bus/nes/sunsoft_dcs.cpp
+++ b/src/devices/bus/nes/sunsoft_dcs.cpp
@@ -168,7 +168,7 @@ void nes_sunsoft_dcs_device::device_start()
{
nes_sunsoft_4_device::device_start();
- ntb_enable_timer = timer_alloc(TIMER_PROTECT);
+ ntb_enable_timer = timer_alloc(FUNC(nes_sunsoft_dcs_device::protect_tick), this);
ntb_enable_timer->reset();
timer_freq = clocks_to_attotime(107520);
@@ -281,14 +281,11 @@ void nes_sunsoft_dcs_device::device_add_mconfig(machine_config &config)
//-------------------------------------------------
-// device_timer - handler timer events
+// protect_tick - handler NTB-ROM timer elapsing
//-------------------------------------------------
-void nes_sunsoft_dcs_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nes_sunsoft_dcs_device::protect_tick)
{
- if (id == TIMER_PROTECT)
- {
- m_timer_on = 0;
- ntb_enable_timer->reset();
- }
+ m_timer_on = 0;
+ ntb_enable_timer->reset();
}
diff --git a/src/devices/bus/nes/sunsoft_dcs.h b/src/devices/bus/nes/sunsoft_dcs.h
index 983b5a97b06..e9f6594a452 100644
--- a/src/devices/bus/nes/sunsoft_dcs.h
+++ b/src/devices/bus/nes/sunsoft_dcs.h
@@ -137,13 +137,11 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
virtual void device_add_mconfig(machine_config &config) override;
-private:
- static constexpr device_timer_id TIMER_PROTECT = 0;
+ TIMER_CALLBACK_MEMBER(protect_tick);
+private:
int m_timer_on, m_exrom_enable;
required_device<nes_ntb_slot_device> m_subslot;
diff --git a/src/devices/bus/nes/taito.cpp b/src/devices/bus/nes/taito.cpp
index 4a620a09283..a3689c8f4a7 100644
--- a/src/devices/bus/nes/taito.cpp
+++ b/src/devices/bus/nes/taito.cpp
@@ -120,7 +120,7 @@ void nes_x1_005_device::pcb_reset()
void nes_x1_017_device::device_start()
{
common_start();
- irq_timer = timer_alloc(TIMER_IRQ);
+ irq_timer = timer_alloc(FUNC(nes_x1_017_device::irq_timer_tick), this);
irq_timer->adjust(attotime::zero, 0, clocks_to_attotime(1));
save_item(NAME(m_irq_enable));
@@ -217,7 +217,7 @@ void nes_tc0190fmc_device::write_h(offs_t offset, u8 data)
-------------------------------------------------*/
-void nes_tc0190fmc_pal16r4_device::hblank_irq(int scanline, int vblank, int blanked)
+void nes_tc0190fmc_pal16r4_device::hblank_irq(int scanline, bool vblank, bool blanked)
{
if (scanline < ppu2c0x_device::BOTTOM_VISIBLE_SCANLINE)
{
@@ -359,15 +359,12 @@ u8 nes_x1_005_device::read_m(offs_t offset)
-------------------------------------------------*/
-void nes_x1_017_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nes_x1_017_device::irq_timer_tick)
{
- if (id == TIMER_IRQ)
- {
- if ((m_irq_enable & 0x05) == 1 && m_irq_count) // counting enabled?
- m_irq_count--;
- if (!m_irq_count && BIT(m_irq_enable, 1))
- set_irq_line(ASSERT_LINE);
- }
+ if ((m_irq_enable & 0x05) == 1 && m_irq_count) // counting enabled?
+ m_irq_count--;
+ if (!m_irq_count && BIT(m_irq_enable, 1))
+ set_irq_line(ASSERT_LINE);
}
void nes_x1_017_device::set_chr()
diff --git a/src/devices/bus/nes/taito.h b/src/devices/bus/nes/taito.h
index 9c01438f687..6f3981aa993 100644
--- a/src/devices/bus/nes/taito.h
+++ b/src/devices/bus/nes/taito.h
@@ -35,7 +35,7 @@ public:
virtual void write_h(offs_t offset, u8 data) override;
- virtual void hblank_irq(int scanline, int vblank, int blanked) override;
+ virtual void hblank_irq(int scanline, bool vblank, bool blanked) override;
virtual void pcb_reset() override;
protected:
@@ -90,7 +90,8 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(irq_timer_tick);
private:
void set_chr();
@@ -104,7 +105,6 @@ private:
u8 m_irq_count_latch;
u8 m_irq_enable;
- static constexpr device_timer_id TIMER_IRQ = 0;
emu_timer *irq_timer;
};
diff --git a/src/devices/bus/nes/tengen.cpp b/src/devices/bus/nes/tengen.cpp
index 5281d1e2fb2..3b74a13f2cd 100644
--- a/src/devices/bus/nes/tengen.cpp
+++ b/src/devices/bus/nes/tengen.cpp
@@ -60,7 +60,7 @@ nes_tengen037_device::nes_tengen037_device(const machine_config &mconfig, const
void nes_tengen032_device::device_start()
{
common_start();
- irq_timer = timer_alloc(TIMER_IRQ);
+ irq_timer = timer_alloc(FUNC(nes_tengen032_device::irq_timer_tick), this);
timer_freq = clocks_to_attotime(4);
irq_timer->adjust(attotime::zero, 0, timer_freq);
@@ -146,23 +146,20 @@ inline void nes_tengen032_device::irq_clock(int blanked)
// we use the HBLANK IRQ latch from PPU for the scanline based IRQ mode
// and a timer for the cycle based IRQ mode, which both call irq_clock
-void nes_tengen032_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nes_tengen032_device::irq_timer_tick)
{
- if (id == TIMER_IRQ)
+ if (m_irq_pending)
{
- if (m_irq_pending)
- {
- set_irq_line(ASSERT_LINE);
- m_irq_pending = 0;
- }
-
- if (m_irq_mode)
- irq_clock(0);
+ set_irq_line(ASSERT_LINE);
+ m_irq_pending = 0;
}
+
+ if (m_irq_mode)
+ irq_clock(0);
}
-void nes_tengen032_device::hblank_irq(int scanline, int vblank, int blanked)
+void nes_tengen032_device::hblank_irq(int scanline, bool vblank, bool blanked)
{
if (!m_irq_mode) // we are in scanline mode!
{
diff --git a/src/devices/bus/nes/tengen.h b/src/devices/bus/nes/tengen.h
index 6c2af124841..d5dbec1e88b 100644
--- a/src/devices/bus/nes/tengen.h
+++ b/src/devices/bus/nes/tengen.h
@@ -16,7 +16,7 @@ public:
virtual void write_h(offs_t offset, u8 data) override;
- virtual void hblank_irq(int scanline, int vblank, int blanked) override;
+ virtual void hblank_irq(int scanline, bool vblank, bool blanked) override;
virtual void pcb_reset() override;
protected:
@@ -24,10 +24,11 @@ protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void set_chr();
+ TIMER_CALLBACK_MEMBER(irq_timer_tick);
+
u8 m_latch;
u8 m_mmc_vrom_bank[8];
@@ -41,7 +42,6 @@ private:
u8 m_mmc_prg_bank[3];
- static constexpr device_timer_id TIMER_IRQ = 0;
emu_timer *irq_timer;
attotime timer_freq;
};
diff --git a/src/devices/bus/nes/vrc_clones.cpp b/src/devices/bus/nes/vrc_clones.cpp
index c29ba0e588d..506857df85f 100644
--- a/src/devices/bus/nes/vrc_clones.cpp
+++ b/src/devices/bus/nes/vrc_clones.cpp
@@ -140,7 +140,7 @@ void nes_2yudb_device::pcb_reset()
void nes_900218_device::device_start()
{
nes_konami_vrc2_device::device_start();
- irq_timer = timer_alloc(TIMER_IRQ);
+ irq_timer = timer_alloc(FUNC(nes_900218_device::irq_timer_tick), this);
irq_timer->adjust(attotime::zero, 0, clocks_to_attotime(1));
save_item(NAME(m_irq_enable));
@@ -268,7 +268,7 @@ void nes_tf1201_device::device_start()
void nes_th21311_device::device_start()
{
nes_konami_vrc2_device::device_start();
- irq_timer = timer_alloc(TIMER_IRQ);
+ irq_timer = timer_alloc(FUNC(nes_th21311_device::irq_timer_tick), this);
irq_timer->adjust(attotime::zero, 0, clocks_to_attotime(1));
save_item(NAME(m_irq_enable));
@@ -322,15 +322,12 @@ void nes_waixing_sgz_device::device_start()
-------------------------------------------------*/
-void nes_900218_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nes_900218_device::irq_timer_tick)
{
- if (id == TIMER_IRQ)
+ if (m_irq_enable)
{
- if (m_irq_enable)
- {
- m_irq_count++;
- set_irq_line(BIT(m_irq_count, 10) ? ASSERT_LINE : CLEAR_LINE);
- }
+ m_irq_count++;
+ set_irq_line(BIT(m_irq_count, 10) ? ASSERT_LINE : CLEAR_LINE);
}
}
@@ -580,18 +577,15 @@ void nes_tf1201_device::irq_ack_w()
-------------------------------------------------*/
-void nes_th21311_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nes_th21311_device::irq_timer_tick)
{
- if (id == TIMER_IRQ)
+ if (m_irq_enable)
{
- if (m_irq_enable)
- {
- m_irq_count = (m_irq_count + 1) & 0xfff; // 12-bit counter
- if (m_irq_count == 0x800)
- m_irq_latch--;
- if (!m_irq_latch && m_irq_count < 0x800)
- set_irq_line(ASSERT_LINE);
- }
+ m_irq_count = (m_irq_count + 1) & 0xfff; // 12-bit counter
+ if (m_irq_count == 0x800)
+ m_irq_latch--;
+ if (!m_irq_latch && m_irq_count < 0x800)
+ set_irq_line(ASSERT_LINE);
}
}
diff --git a/src/devices/bus/nes/vrc_clones.h b/src/devices/bus/nes/vrc_clones.h
index 856e9b34503..c6fe5b55550 100644
--- a/src/devices/bus/nes/vrc_clones.h
+++ b/src/devices/bus/nes/vrc_clones.h
@@ -46,13 +46,13 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(irq_timer_tick);
private:
u16 m_irq_count;
int m_irq_enable;
- static const device_timer_id TIMER_IRQ = 0;
emu_timer *irq_timer;
};
@@ -246,14 +246,14 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(irq_timer_tick);
private:
u16 m_irq_count;
u8 m_irq_latch;
int m_irq_enable;
- static const device_timer_id TIMER_IRQ = 0;
emu_timer *irq_timer;
};
diff --git a/src/devices/bus/nes_ctrl/bcbattle.cpp b/src/devices/bus/nes_ctrl/bcbattle.cpp
index 7d97236b6e4..26973cfc51c 100644
--- a/src/devices/bus/nes_ctrl/bcbattle.cpp
+++ b/src/devices/bus/nes_ctrl/bcbattle.cpp
@@ -27,47 +27,44 @@ void nes_bcbattle_device::device_add_mconfig(machine_config &config)
//-------------------------------------------------
-// device_timer - handler timer events
+// scan_tick - periodic scan kludge
//-------------------------------------------------
// This part is the hacky replacement for the real Barcode unit [shared with SNES implementation]:
// code periodically checks whether a new code has been scanned and it moves it to the
// m_current_barcode array
-void nes_bcbattle_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nes_bcbattle_device::scan_tick)
{
- if (id == TIMER_BATTLER)
+ int old = m_new_code;
+ // has something new been scanned?
+ if (old < m_reader->get_pending_code())
{
- int old = m_new_code;
- // has something new been scanned?
- if (old < m_reader->get_pending_code())
+ if (m_reader->get_byte_length() == 13)
{
- if (m_reader->get_byte_length() == 13)
- {
- for (int i = 0; i < 13; i++)
- m_current_barcode[i] = m_reader->read_code() + '0';
- }
- else if (m_reader->get_byte_length() == 8)
- {
- for (int i = 0; i < 5; i++)
- m_current_barcode[i] = 0x20;
- for (int i = 5; i < 13; i++)
- m_current_barcode[i] = m_reader->read_code() + '0';
- }
- // read one more, to reset the internal byte counter
- m_reader->read_code();
-
- // the string "SUNSOFT" is accepted as well by Barcode World
- m_current_barcode[13] = 'E';
- m_current_barcode[14] = 'P';
- m_current_barcode[15] = 'O';
- m_current_barcode[16] = 'C';
- m_current_barcode[17] = 'H';
- m_current_barcode[18] = 0x0d;
- m_current_barcode[19] = 0x0a;
- m_pending_code = 1;
+ for (int i = 0; i < 13; i++)
+ m_current_barcode[i] = m_reader->read_code() + '0';
+ }
+ else if (m_reader->get_byte_length() == 8)
+ {
+ for (int i = 0; i < 5; i++)
+ m_current_barcode[i] = 0x20;
+ for (int i = 5; i < 13; i++)
+ m_current_barcode[i] = m_reader->read_code() + '0';
}
- m_new_code = m_reader->get_pending_code();
+ // read one more, to reset the internal byte counter
+ m_reader->read_code();
+
+ // the string "SUNSOFT" is accepted as well by Barcode World
+ m_current_barcode[13] = 'E';
+ m_current_barcode[14] = 'P';
+ m_current_barcode[15] = 'O';
+ m_current_barcode[16] = 'C';
+ m_current_barcode[17] = 'H';
+ m_current_barcode[18] = 0x0d;
+ m_current_barcode[19] = 0x0a;
+ m_pending_code = 1;
}
+ m_new_code = m_reader->get_pending_code();
}
//**************************************************************************
@@ -96,7 +93,7 @@ void nes_bcbattle_device::device_start()
// lacking emulation of the standalone Barcode Battler, we refresh periodically the input from the reader
// proper emulation would have the standalone unit acknowledging that a new barcode has been scanned
// and sending the proper serial bits, instead of our read_current_bit() function!
- battler_timer = timer_alloc(TIMER_BATTLER);
+ battler_timer = timer_alloc(FUNC(nes_bcbattle_device::scan_tick), this);
battler_timer->adjust(attotime::zero, 0, machine().device<cpu_device>("maincpu")->cycles_to_attotime(1000));
save_item(NAME(m_current_barcode));
diff --git a/src/devices/bus/nes_ctrl/bcbattle.h b/src/devices/bus/nes_ctrl/bcbattle.h
index cc4827477cb..c51f2db64ac 100644
--- a/src/devices/bus/nes_ctrl/bcbattle.h
+++ b/src/devices/bus/nes_ctrl/bcbattle.h
@@ -31,17 +31,16 @@ public:
virtual uint8_t read_exp(offs_t offset) override;
protected:
- static constexpr device_timer_id TIMER_BATTLER = 1;
-
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_add_mconfig(machine_config &config) override;
int read_current_bit();
+ TIMER_CALLBACK_MEMBER(scan_tick);
+
required_device<barcode_reader_device> m_reader;
uint8_t m_current_barcode[20];
int m_pending_code, m_new_code, m_transmitting, m_cur_bit, m_cur_byte;
diff --git a/src/devices/bus/nes_ctrl/miracle.cpp b/src/devices/bus/nes_ctrl/miracle.cpp
index ae5aa437de3..4945358c028 100644
--- a/src/devices/bus/nes_ctrl/miracle.cpp
+++ b/src/devices/bus/nes_ctrl/miracle.cpp
@@ -31,15 +31,12 @@ void nes_miracle_device::device_add_mconfig(machine_config &config)
//-------------------------------------------------
-// device_timer - handler timer events
+// strobe_tick - increment strobe counter
//-------------------------------------------------
-void nes_miracle_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nes_miracle_device::strobe_tick)
{
- if (id == TIMER_STROBE_ON)
- {
- m_strobe_clock++;
- }
+ m_strobe_clock++;
}
//**************************************************************************
@@ -67,7 +64,7 @@ nes_miracle_device::nes_miracle_device(const machine_config &mconfig, const char
void nes_miracle_device::device_start()
{
- strobe_timer = timer_alloc(TIMER_STROBE_ON);
+ strobe_timer = timer_alloc(FUNC(nes_miracle_device::strobe_tick), this);
strobe_timer->adjust(attotime::never);
save_item(NAME(m_strobe_on));
save_item(NAME(m_sent_bits));
diff --git a/src/devices/bus/nes_ctrl/miracle.h b/src/devices/bus/nes_ctrl/miracle.h
index 168590b4b19..f06480d9a43 100644
--- a/src/devices/bus/nes_ctrl/miracle.h
+++ b/src/devices/bus/nes_ctrl/miracle.h
@@ -38,15 +38,14 @@ public:
protected:
static constexpr int XMIT_RING_SIZE = 64;
static constexpr int RECV_RING_SIZE = 64;
- static constexpr device_timer_id TIMER_STROBE_ON = 0;
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
-
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_add_mconfig(machine_config &config) override;
+ TIMER_CALLBACK_MEMBER(strobe_tick);
+
private:
// serial overrides
virtual void rcv_complete() override; // Rx completed receiving byte
diff --git a/src/devices/bus/nubus/nubus_48gc.cpp b/src/devices/bus/nubus/nubus_48gc.cpp
index a79350687df..b9f6801e3cf 100644
--- a/src/devices/bus/nubus/nubus_48gc.cpp
+++ b/src/devices/bus/nubus/nubus_48gc.cpp
@@ -114,7 +114,7 @@ void jmfb_device::device_start()
nubus().install_device(slotspace+0x200000, slotspace+0x2003ff, read32s_delegate(*this, FUNC(jmfb_device::mac_48gc_r)), write32s_delegate(*this, FUNC(jmfb_device::mac_48gc_w)));
- m_timer = timer_alloc(0);
+ m_timer = timer_alloc(FUNC(jmfb_device::vbl_tick), this);
m_screen = nullptr; // can we look this up now?
}
@@ -143,7 +143,7 @@ void jmfb_device::device_reset()
***************************************************************************/
-void jmfb_device::device_timer(emu_timer &timer, device_timer_id tid, int param)
+TIMER_CALLBACK_MEMBER(jmfb_device::vbl_tick)
{
if (!m_vbl_disable)
{
diff --git a/src/devices/bus/nubus/nubus_48gc.h b/src/devices/bus/nubus/nubus_48gc.h
index f25c89af939..fc3cc59e8f4 100644
--- a/src/devices/bus/nubus/nubus_48gc.h
+++ b/src/devices/bus/nubus/nubus_48gc.h
@@ -25,12 +25,13 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// optional information overrides
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
+ TIMER_CALLBACK_MEMBER(vbl_tick);
+
private:
uint32_t mac_48gc_r(offs_t offset, uint32_t mem_mask = ~0);
void mac_48gc_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
diff --git a/src/devices/bus/nubus/nubus_m2hires.cpp b/src/devices/bus/nubus/nubus_m2hires.cpp
index 033d443610a..7c590595f3a 100644
--- a/src/devices/bus/nubus/nubus_m2hires.cpp
+++ b/src/devices/bus/nubus/nubus_m2hires.cpp
@@ -97,7 +97,7 @@ void nubus_m2hires_device::device_start()
nubus().install_device(slotspace+0x900000, slotspace+VRAM_SIZE-1+0x900000, read32s_delegate(*this, FUNC(nubus_m2hires_device::vram_r)), write32s_delegate(*this, FUNC(nubus_m2hires_device::vram_w)));
nubus().install_device(slotspace+0x80000, slotspace+0xeffff, read32s_delegate(*this, FUNC(nubus_m2hires_device::m2hires_r)), write32s_delegate(*this, FUNC(nubus_m2hires_device::m2hires_w)));
- m_timer = timer_alloc(0);
+ m_timer = timer_alloc(FUNC(nubus_m2hires_device::vbl_tick), this);
m_timer->adjust(screen().time_until_pos(479, 0), 0);
}
@@ -119,7 +119,7 @@ void nubus_m2hires_device::device_reset()
}
-void nubus_m2hires_device::device_timer(emu_timer &timer, device_timer_id tid, int param)
+TIMER_CALLBACK_MEMBER(nubus_m2hires_device::vbl_tick)
{
if (!m_vbl_disable)
{
diff --git a/src/devices/bus/nubus/nubus_m2hires.h b/src/devices/bus/nubus/nubus_m2hires.h
index 773ccccbe35..43870794dfb 100644
--- a/src/devices/bus/nubus/nubus_m2hires.h
+++ b/src/devices/bus/nubus/nubus_m2hires.h
@@ -28,12 +28,13 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// optional information overrides
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
+ TIMER_CALLBACK_MEMBER(vbl_tick);
+
private:
uint32_t m2hires_r(offs_t offset, uint32_t mem_mask = ~0);
void m2hires_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
diff --git a/src/devices/bus/nubus/nubus_m2video.cpp b/src/devices/bus/nubus/nubus_m2video.cpp
index 2ca21d0baee..55bc936f4d2 100644
--- a/src/devices/bus/nubus/nubus_m2video.cpp
+++ b/src/devices/bus/nubus/nubus_m2video.cpp
@@ -99,7 +99,7 @@ void nubus_m2video_device::device_start()
nubus().install_device(slotspace+0x900000, slotspace+VRAM_SIZE-1+0x900000, read32s_delegate(*this, FUNC(nubus_m2video_device::vram_r)), write32s_delegate(*this, FUNC(nubus_m2video_device::vram_w)));
nubus().install_device(slotspace+0x80000, slotspace+0xeffff, read32s_delegate(*this, FUNC(nubus_m2video_device::m2video_r)), write32s_delegate(*this, FUNC(nubus_m2video_device::m2video_w)));
- m_timer = timer_alloc(0);
+ m_timer = timer_alloc(FUNC(nubus_m2video_device::vbl_tick), this);
m_timer->adjust(screen().time_until_pos(479, 0), 0);
}
@@ -121,7 +121,7 @@ void nubus_m2video_device::device_reset()
}
-void nubus_m2video_device::device_timer(emu_timer &timer, device_timer_id tid, int param)
+TIMER_CALLBACK_MEMBER(nubus_m2video_device::vbl_tick)
{
if (!m_vbl_disable)
{
diff --git a/src/devices/bus/nubus/nubus_m2video.h b/src/devices/bus/nubus/nubus_m2video.h
index 65dfd42ed54..38467dbe75d 100644
--- a/src/devices/bus/nubus/nubus_m2video.h
+++ b/src/devices/bus/nubus/nubus_m2video.h
@@ -28,12 +28,13 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// optional information overrides
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
+ TIMER_CALLBACK_MEMBER(vbl_tick);
+
private:
uint32_t m2video_r(offs_t offset, uint32_t mem_mask = ~0);
void m2video_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
diff --git a/src/devices/bus/nubus/nubus_radiustpd.cpp b/src/devices/bus/nubus/nubus_radiustpd.cpp
index 0017a33e2f5..f2f68f4bb8c 100644
--- a/src/devices/bus/nubus/nubus_radiustpd.cpp
+++ b/src/devices/bus/nubus/nubus_radiustpd.cpp
@@ -99,7 +99,7 @@ void nubus_radiustpd_device::device_start()
nubus().install_device(slotspace+0x80000, slotspace+0xeffff, read32s_delegate(*this, FUNC(nubus_radiustpd_device::radiustpd_r)), write32s_delegate(*this, FUNC(nubus_radiustpd_device::radiustpd_w)));
nubus().install_device(slotspace+0x980000, slotspace+0x9effff, read32s_delegate(*this, FUNC(nubus_radiustpd_device::radiustpd_r)), write32s_delegate(*this, FUNC(nubus_radiustpd_device::radiustpd_w)));
- m_timer = timer_alloc(0);
+ m_timer = timer_alloc(FUNC(nubus_radiustpd_device::vbl_tick), this);
m_timer->adjust(screen().time_until_pos(479, 0), 0);
}
@@ -121,7 +121,7 @@ void nubus_radiustpd_device::device_reset()
}
-void nubus_radiustpd_device::device_timer(emu_timer &timer, device_timer_id tid, int param)
+TIMER_CALLBACK_MEMBER(nubus_radiustpd_device::vbl_tick)
{
if (!m_vbl_disable)
{
diff --git a/src/devices/bus/nubus/nubus_radiustpd.h b/src/devices/bus/nubus/nubus_radiustpd.h
index a1f0b0e9723..ef8d8fac1eb 100644
--- a/src/devices/bus/nubus/nubus_radiustpd.h
+++ b/src/devices/bus/nubus/nubus_radiustpd.h
@@ -28,12 +28,13 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// optional information overrides
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
+ TIMER_CALLBACK_MEMBER(vbl_tick);
+
private:
uint32_t radiustpd_r(offs_t offset, uint32_t mem_mask = ~0);
void radiustpd_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
diff --git a/src/devices/bus/nubus/nubus_spec8.cpp b/src/devices/bus/nubus/nubus_spec8.cpp
index 0a71dd847f7..3cbe4062578 100644
--- a/src/devices/bus/nubus/nubus_spec8.cpp
+++ b/src/devices/bus/nubus/nubus_spec8.cpp
@@ -101,7 +101,7 @@ void nubus_spec8s3_device::device_start()
nubus().install_device(slotspace+0x900000, slotspace+VRAM_SIZE-1+0x900000, read32s_delegate(*this, FUNC(nubus_spec8s3_device::vram_r)), write32s_delegate(*this, FUNC(nubus_spec8s3_device::vram_w)));
nubus().install_device(slotspace+0xd0000, slotspace+0xfffff, read32s_delegate(*this, FUNC(nubus_spec8s3_device::spec8s3_r)), write32s_delegate(*this, FUNC(nubus_spec8s3_device::spec8s3_w)));
- m_timer = timer_alloc(0);
+ m_timer = timer_alloc(FUNC(nubus_spec8s3_device::vbl_tick), this);
m_timer->adjust(screen().time_until_pos(767, 0), 0);
}
@@ -125,7 +125,7 @@ void nubus_spec8s3_device::device_reset()
}
-void nubus_spec8s3_device::device_timer(emu_timer &timer, device_timer_id tid, int param)
+TIMER_CALLBACK_MEMBER(nubus_spec8s3_device::vbl_tick)
{
if (!m_vbl_disable)
{
diff --git a/src/devices/bus/nubus/nubus_spec8.h b/src/devices/bus/nubus/nubus_spec8.h
index 88da09528e4..caf0a0ef60b 100644
--- a/src/devices/bus/nubus/nubus_spec8.h
+++ b/src/devices/bus/nubus/nubus_spec8.h
@@ -32,7 +32,8 @@ protected:
// optional information overrides
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(vbl_tick);
private:
uint32_t spec8s3_r(offs_t offset, uint32_t mem_mask = ~0);
diff --git a/src/devices/bus/nubus/nubus_specpdq.cpp b/src/devices/bus/nubus/nubus_specpdq.cpp
index cd3977022be..9f878e1b85a 100644
--- a/src/devices/bus/nubus/nubus_specpdq.cpp
+++ b/src/devices/bus/nubus/nubus_specpdq.cpp
@@ -117,7 +117,7 @@ void nubus_specpdq_device::device_start()
nubus().install_device(slotspace, slotspace+VRAM_SIZE-1, read32s_delegate(*this, FUNC(nubus_specpdq_device::vram_r)), write32s_delegate(*this, FUNC(nubus_specpdq_device::vram_w)));
nubus().install_device(slotspace+0x400000, slotspace+0xfbffff, read32s_delegate(*this, FUNC(nubus_specpdq_device::specpdq_r)), write32s_delegate(*this, FUNC(nubus_specpdq_device::specpdq_w)));
- m_timer = timer_alloc(0);
+ m_timer = timer_alloc(FUNC(nubus_specpdq_device::vbl_tick), this);
m_timer->adjust(screen().time_until_pos(843, 0), 0);
}
@@ -139,7 +139,7 @@ void nubus_specpdq_device::device_reset()
}
-void nubus_specpdq_device::device_timer(emu_timer &timer, device_timer_id tid, int param)
+TIMER_CALLBACK_MEMBER(nubus_specpdq_device::vbl_tick)
{
if (!m_vbl_disable)
{
diff --git a/src/devices/bus/nubus/nubus_specpdq.h b/src/devices/bus/nubus/nubus_specpdq.h
index fd30e112525..c133c0fa4db 100644
--- a/src/devices/bus/nubus/nubus_specpdq.h
+++ b/src/devices/bus/nubus/nubus_specpdq.h
@@ -33,7 +33,8 @@ protected:
// optional information overrides
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(vbl_tick);
private:
uint32_t specpdq_r(offs_t offset, uint32_t mem_mask = ~0);
diff --git a/src/devices/bus/nubus/nubus_wsportrait.cpp b/src/devices/bus/nubus/nubus_wsportrait.cpp
index 960db9199ae..cbbaed619c8 100644
--- a/src/devices/bus/nubus/nubus_wsportrait.cpp
+++ b/src/devices/bus/nubus/nubus_wsportrait.cpp
@@ -100,7 +100,7 @@ void nubus_wsportrait_device::device_start()
nubus().install_device(slotspace+0x900000, slotspace+0x900000+VRAM_SIZE-1, read32s_delegate(*this, FUNC(nubus_wsportrait_device::vram_r)), write32s_delegate(*this, FUNC(nubus_wsportrait_device::vram_w)));
nubus().install_device(slotspace+0x80000, slotspace+0xeffff, read32s_delegate(*this, FUNC(nubus_wsportrait_device::wsportrait_r)), write32s_delegate(*this, FUNC(nubus_wsportrait_device::wsportrait_w)));
- m_timer = timer_alloc(0);
+ m_timer = timer_alloc(FUNC(nubus_wsportrait_device::vbl_tick), this);
m_timer->adjust(screen().time_until_pos(869, 0), 0);
}
@@ -119,7 +119,7 @@ void nubus_wsportrait_device::device_reset()
}
-void nubus_wsportrait_device::device_timer(emu_timer &timer, device_timer_id tid, int param)
+TIMER_CALLBACK_MEMBER(nubus_wsportrait_device::vbl_tick)
{
if (!m_vbl_disable)
{
diff --git a/src/devices/bus/nubus/nubus_wsportrait.h b/src/devices/bus/nubus/nubus_wsportrait.h
index 0aa0aa67072..afbb7abdd67 100644
--- a/src/devices/bus/nubus/nubus_wsportrait.h
+++ b/src/devices/bus/nubus/nubus_wsportrait.h
@@ -28,12 +28,13 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// optional information overrides
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
+ TIMER_CALLBACK_MEMBER(vbl_tick);
+
private:
uint32_t wsportrait_r(offs_t offset, uint32_t mem_mask = ~0);
void wsportrait_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
diff --git a/src/devices/bus/nubus/pds30_30hr.cpp b/src/devices/bus/nubus/pds30_30hr.cpp
index f2439b56152..efbc761d4af 100644
--- a/src/devices/bus/nubus/pds30_30hr.cpp
+++ b/src/devices/bus/nubus/pds30_30hr.cpp
@@ -99,7 +99,7 @@ void nubus_xceed30hr_device::device_start()
nubus().install_device(slotspace, slotspace+VRAM_SIZE-1, read32s_delegate(*this, FUNC(nubus_xceed30hr_device::vram_r)), write32s_delegate(*this, FUNC(nubus_xceed30hr_device::vram_w)));
nubus().install_device(slotspace+0x800000, slotspace+0xefffff, read32s_delegate(*this, FUNC(nubus_xceed30hr_device::xceed30hr_r)), write32s_delegate(*this, FUNC(nubus_xceed30hr_device::xceed30hr_w)));
- m_timer = timer_alloc(0);
+ m_timer = timer_alloc(FUNC(nubus_xceed30hr_device::vbl_tick), this);
m_timer->adjust(screen().time_until_pos(479, 0), 0);
}
@@ -121,7 +121,7 @@ void nubus_xceed30hr_device::device_reset()
}
-void nubus_xceed30hr_device::device_timer(emu_timer &timer, device_timer_id tid, int param)
+TIMER_CALLBACK_MEMBER(nubus_xceed30hr_device::vbl_tick)
{
if (!m_vbl_disable)
{
diff --git a/src/devices/bus/nubus/pds30_30hr.h b/src/devices/bus/nubus/pds30_30hr.h
index 39d47215d5c..f3592acdb1c 100644
--- a/src/devices/bus/nubus/pds30_30hr.h
+++ b/src/devices/bus/nubus/pds30_30hr.h
@@ -28,12 +28,13 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// optional information overrides
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
+ TIMER_CALLBACK_MEMBER(vbl_tick);
+
private:
uint32_t xceed30hr_r(offs_t offset, uint32_t mem_mask = ~0);
void xceed30hr_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
diff --git a/src/devices/bus/nubus/pds30_cb264.cpp b/src/devices/bus/nubus/pds30_cb264.cpp
index b3f09219093..ce7a2f7372e 100644
--- a/src/devices/bus/nubus/pds30_cb264.cpp
+++ b/src/devices/bus/nubus/pds30_cb264.cpp
@@ -96,7 +96,7 @@ void nubus_cb264se30_device::device_start()
nubus().install_device(slotspace, slotspace+VRAM_SIZE-1, read32s_delegate(*this, FUNC(nubus_cb264se30_device::vram_r)), write32s_delegate(*this, FUNC(nubus_cb264se30_device::vram_w)));
nubus().install_device(slotspace+0xf00000, slotspace+0xfeffff, read32s_delegate(*this, FUNC(nubus_cb264se30_device::cb264se30_r)), write32s_delegate(*this, FUNC(nubus_cb264se30_device::cb264se30_w)));
- m_timer = timer_alloc(0);
+ m_timer = timer_alloc(FUNC(nubus_cb264se30_device::vbl_tick), this);
m_timer->adjust(screen().time_until_pos(479, 0), 0);
}
@@ -118,7 +118,7 @@ void nubus_cb264se30_device::device_reset()
}
-void nubus_cb264se30_device::device_timer(emu_timer &timer, device_timer_id tid, int param)
+TIMER_CALLBACK_MEMBER(nubus_cb264se30_device::vbl_tick)
{
if (!m_vbl_disable)
{
diff --git a/src/devices/bus/nubus/pds30_cb264.h b/src/devices/bus/nubus/pds30_cb264.h
index 275c652562f..9c94a6afc1c 100644
--- a/src/devices/bus/nubus/pds30_cb264.h
+++ b/src/devices/bus/nubus/pds30_cb264.h
@@ -28,12 +28,13 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// optional information overrides
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
+ TIMER_CALLBACK_MEMBER(vbl_tick);
+
private:
uint32_t cb264se30_r(offs_t offset, uint32_t mem_mask = ~0);
void cb264se30_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
diff --git a/src/devices/bus/nubus/pds30_mc30.cpp b/src/devices/bus/nubus/pds30_mc30.cpp
index b0d36996a09..ede7240cc9a 100644
--- a/src/devices/bus/nubus/pds30_mc30.cpp
+++ b/src/devices/bus/nubus/pds30_mc30.cpp
@@ -98,7 +98,7 @@ void nubus_xceedmc30_device::device_start()
nubus().install_device(slotspace, slotspace+VRAM_SIZE-1, read32s_delegate(*this, FUNC(nubus_xceedmc30_device::vram_r)), write32s_delegate(*this, FUNC(nubus_xceedmc30_device::vram_w)));
nubus().install_device(slotspace+0x800000, slotspace+0xefffff, read32s_delegate(*this, FUNC(nubus_xceedmc30_device::xceedmc30_r)), write32s_delegate(*this, FUNC(nubus_xceedmc30_device::xceedmc30_w)));
- m_timer = timer_alloc(0);
+ m_timer = timer_alloc(FUNC(nubus_xceedmc30_device::vbl_tick), this);
m_timer->adjust(screen().time_until_pos(479, 0), 0);
}
@@ -120,7 +120,7 @@ void nubus_xceedmc30_device::device_reset()
}
-void nubus_xceedmc30_device::device_timer(emu_timer &timer, device_timer_id tid, int param)
+TIMER_CALLBACK_MEMBER(nubus_xceedmc30_device::vbl_tick)
{
if (!m_vbl_disable)
{
diff --git a/src/devices/bus/nubus/pds30_mc30.h b/src/devices/bus/nubus/pds30_mc30.h
index 29d13b5e671..518f863667a 100644
--- a/src/devices/bus/nubus/pds30_mc30.h
+++ b/src/devices/bus/nubus/pds30_mc30.h
@@ -28,12 +28,13 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// optional information overrides
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
+ TIMER_CALLBACK_MEMBER(vbl_tick);
+
private:
uint32_t xceedmc30_r(offs_t offset, uint32_t mem_mask = ~0);
void xceedmc30_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
diff --git a/src/devices/bus/nubus/pds30_procolor816.cpp b/src/devices/bus/nubus/pds30_procolor816.cpp
index bfa655c9dbd..14fc289ec0f 100644
--- a/src/devices/bus/nubus/pds30_procolor816.cpp
+++ b/src/devices/bus/nubus/pds30_procolor816.cpp
@@ -99,7 +99,7 @@ void nubus_procolor816_device::device_start()
nubus().install_device(slotspace+0x900000, slotspace+VRAM_SIZE-1+0x900000, read32s_delegate(*this, FUNC(nubus_procolor816_device::vram_r)), write32s_delegate(*this, FUNC(nubus_procolor816_device::vram_w)));
nubus().install_device(slotspace+0xf00000, slotspace+0xff7fff, read32s_delegate(*this, FUNC(nubus_procolor816_device::procolor816_r)), write32s_delegate(*this, FUNC(nubus_procolor816_device::procolor816_w)));
- m_timer = timer_alloc(0);
+ m_timer = timer_alloc(FUNC(nubus_procolor816_device::vbl_tick), this);
m_timer->adjust(screen().time_until_pos(479, 0), 0);
}
@@ -121,7 +121,7 @@ void nubus_procolor816_device::device_reset()
}
-void nubus_procolor816_device::device_timer(emu_timer &timer, device_timer_id tid, int param)
+TIMER_CALLBACK_MEMBER(nubus_procolor816_device::vbl_tick)
{
if (!m_vbl_disable)
{
diff --git a/src/devices/bus/nubus/pds30_procolor816.h b/src/devices/bus/nubus/pds30_procolor816.h
index 631b92957f2..c5b5ec5068b 100644
--- a/src/devices/bus/nubus/pds30_procolor816.h
+++ b/src/devices/bus/nubus/pds30_procolor816.h
@@ -28,12 +28,13 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// optional information overrides
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
+ TIMER_CALLBACK_MEMBER(vbl_tick);
+
private:
uint32_t procolor816_r(offs_t offset, uint32_t mem_mask = ~0);
void procolor816_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
diff --git a/src/devices/bus/nubus/pds30_sigmalview.cpp b/src/devices/bus/nubus/pds30_sigmalview.cpp
index d13c164df1a..d116496d7ec 100644
--- a/src/devices/bus/nubus/pds30_sigmalview.cpp
+++ b/src/devices/bus/nubus/pds30_sigmalview.cpp
@@ -94,7 +94,7 @@ void nubus_lview_device::device_start()
nubus().install_device(slotspace+0x900000, slotspace+VRAM_SIZE-1+0x900000, read32s_delegate(*this, FUNC(nubus_lview_device::vram_r)), write32s_delegate(*this, FUNC(nubus_lview_device::vram_w)));
nubus().install_device(slotspace+0xb0000, slotspace+0xbffff, read32s_delegate(*this, FUNC(nubus_lview_device::lview_r)), write32s_delegate(*this, FUNC(nubus_lview_device::lview_w)));
- m_timer = timer_alloc(0);
+ m_timer = timer_alloc(FUNC(nubus_lview_device::vbl_tick), this);
m_timer->adjust(screen().time_until_pos(599, 0), 0);
}
@@ -114,7 +114,7 @@ void nubus_lview_device::device_reset()
}
-void nubus_lview_device::device_timer(emu_timer &timer, device_timer_id tid, int param)
+TIMER_CALLBACK_MEMBER(nubus_lview_device::vbl_tick)
{
if (!m_vbl_disable)
{
diff --git a/src/devices/bus/nubus/pds30_sigmalview.h b/src/devices/bus/nubus/pds30_sigmalview.h
index ca08a9d118a..677d59ee4c2 100644
--- a/src/devices/bus/nubus/pds30_sigmalview.h
+++ b/src/devices/bus/nubus/pds30_sigmalview.h
@@ -28,12 +28,13 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// optional information overrides
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
+ TIMER_CALLBACK_MEMBER(vbl_tick);
+
private:
uint32_t lview_r(offs_t offset, uint32_t mem_mask = ~0);
void lview_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
diff --git a/src/devices/bus/pc8801/pc8801_31.cpp b/src/devices/bus/pc8801/pc8801_31.cpp
index 0a490076594..f979e59162b 100644
--- a/src/devices/bus/pc8801/pc8801_31.cpp
+++ b/src/devices/bus/pc8801/pc8801_31.cpp
@@ -82,7 +82,7 @@ void pc8801_31_device::device_resolve_objects()
void pc8801_31_device::device_start()
{
- m_sel_off_timer = timer_alloc(0);
+ m_sel_off_timer = timer_alloc(FUNC(pc8801_31_device::select_off), this);
save_item(NAME(m_clock_hb));
save_item(NAME(m_cddrive_enable));
@@ -102,14 +102,9 @@ void pc8801_31_device::device_reset()
m_sel_off_timer->adjust(attotime::never);
}
-void pc8801_31_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(pc8801_31_device::select_off)
{
- switch(id)
- {
- case 0:
- m_scsibus->ctrl_w(0, 0, nscsi_device::S_SEL);
- break;
- }
+ m_scsibus->ctrl_w(0, 0, nscsi_device::S_SEL);
}
diff --git a/src/devices/bus/pc8801/pc8801_31.h b/src/devices/bus/pc8801/pc8801_31.h
index a08782df780..fd580002610 100644
--- a/src/devices/bus/pc8801/pc8801_31.h
+++ b/src/devices/bus/pc8801/pc8801_31.h
@@ -37,7 +37,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(select_off);
private:
required_device<nscsi_bus_device> m_scsibus;
diff --git a/src/devices/bus/pc_joy/pc_joy_sw.cpp b/src/devices/bus/pc_joy/pc_joy_sw.cpp
index 813f6972241..8c9b2c75d4b 100644
--- a/src/devices/bus/pc_joy/pc_joy_sw.cpp
+++ b/src/devices/bus/pc_joy/pc_joy_sw.cpp
@@ -24,7 +24,7 @@ pc_mssw_pad_device::pc_mssw_pad_device(const machine_config& mconfig, const char
void pc_mssw_pad_device::device_start()
{
- m_timer = timer_alloc();
+ m_timer = timer_alloc(FUNC(pc_mssw_pad_device::timer_tick), this);
}
void pc_mssw_pad_device::device_reset()
@@ -35,7 +35,7 @@ void pc_mssw_pad_device::device_reset()
m_timer->adjust(attotime::never, 0);
}
-void pc_mssw_pad_device::device_timer(emu_timer &timer, device_timer_id tid, int param)
+TIMER_CALLBACK_MEMBER(pc_mssw_pad_device::timer_tick)
{
uint16_t pad_state = 0;
// only multibit mode for now
diff --git a/src/devices/bus/pc_joy/pc_joy_sw.h b/src/devices/bus/pc_joy/pc_joy_sw.h
index 0d7aaa55605..5d83a10d0c1 100644
--- a/src/devices/bus/pc_joy/pc_joy_sw.h
+++ b/src/devices/bus/pc_joy/pc_joy_sw.h
@@ -19,7 +19,8 @@ public:
protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id tid, int param) override;
+
+ TIMER_CALLBACK_MEMBER(timer_tick);
private:
required_ioport m_btn1;
diff --git a/src/devices/bus/pc_kbd/hle_mouse.cpp b/src/devices/bus/pc_kbd/hle_mouse.cpp
index d56cfb3c92f..15ac7854d09 100644
--- a/src/devices/bus/pc_kbd/hle_mouse.cpp
+++ b/src/devices/bus/pc_kbd/hle_mouse.cpp
@@ -104,8 +104,8 @@ void hle_ps2_mouse_device::device_start()
set_pc_kbdc_device();
- m_serial = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(hle_ps2_mouse_device::serial), this));
- m_sample = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(hle_ps2_mouse_device::sample), this));
+ m_serial = timer_alloc(FUNC(hle_ps2_mouse_device::serial), this);
+ m_sample = timer_alloc(FUNC(hle_ps2_mouse_device::sample), this);
}
void hle_ps2_mouse_device::device_reset()
diff --git a/src/devices/bus/pet/c2n.cpp b/src/devices/bus/pet/c2n.cpp
index b89d42d9996..94f0dc4dca3 100644
--- a/src/devices/bus/pet/c2n.cpp
+++ b/src/devices/bus/pet/c2n.cpp
@@ -84,16 +84,16 @@ c1531_device::c1531_device(const machine_config &mconfig, const char *tag, devic
void c2n_device::device_start()
{
// allocate timers
- m_read_timer = timer_alloc();
+ m_read_timer = timer_alloc(FUNC(c2n_device::read_tick), this);
m_read_timer->adjust(attotime::from_hz(44100), 0, attotime::from_hz(44100));
}
//-------------------------------------------------
-// device_timer - handler timer events
+// read_tick - periodically read the datasette
//-------------------------------------------------
-void c2n_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(c2n_device::read_tick)
{
if (m_motor)
{
diff --git a/src/devices/bus/pet/c2n.h b/src/devices/bus/pet/c2n.h
index 8a8b04b4a42..86d8e5df288 100644
--- a/src/devices/bus/pet/c2n.h
+++ b/src/devices/bus/pet/c2n.h
@@ -35,7 +35,6 @@ protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// optional information overrides
virtual void device_add_mconfig(machine_config &config) override;
@@ -46,6 +45,8 @@ protected:
virtual int datassette_sense() override;
virtual void datassette_motor(int state) override;
+ TIMER_CALLBACK_MEMBER(read_tick);
+
private:
required_device<cassette_image_device> m_cassette;
diff --git a/src/devices/bus/plus4/c1551.cpp b/src/devices/bus/plus4/c1551.cpp
index 859912a5563..42bca7daa57 100644
--- a/src/devices/bus/plus4/c1551.cpp
+++ b/src/devices/bus/plus4/c1551.cpp
@@ -439,7 +439,7 @@ void c1551_device::device_start()
m_leds.resolve();
// allocate timers
- m_irq_timer = timer_alloc();
+ m_irq_timer = timer_alloc(FUNC(c1551_device::irq_timer_tick), this);
m_irq_timer->adjust(attotime::zero, CLEAR_LINE);
// install image callbacks
@@ -475,10 +475,10 @@ void c1551_device::device_reset()
//-------------------------------------------------
-// device_timer - handler timer events
+// irq_timer_tick - update IRQ line state
//-------------------------------------------------
-void c1551_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(c1551_device::irq_timer_tick)
{
m_maincpu->set_input_line(M6502_IRQ_LINE, param);
diff --git a/src/devices/bus/plus4/c1551.h b/src/devices/bus/plus4/c1551.h
index a8f65a36cfa..eddad2c8046 100644
--- a/src/devices/bus/plus4/c1551.h
+++ b/src/devices/bus/plus4/c1551.h
@@ -36,7 +36,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// optional information overrides
virtual const tiny_rom_entry *device_rom_region() const override;
@@ -47,6 +46,8 @@ protected:
virtual uint8_t plus4_cd_r(offs_t offset, uint8_t data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h) override;
virtual void plus4_cd_w(offs_t offset, uint8_t data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h) override;
+ TIMER_CALLBACK_MEMBER(irq_timer_tick);
+
private:
uint8_t port_r();
void port_w(uint8_t data);
diff --git a/src/devices/bus/psx/memcard.cpp b/src/devices/bus/psx/memcard.cpp
index b5b193931e5..682439ff76e 100644
--- a/src/devices/bus/psx/memcard.cpp
+++ b/src/devices/bus/psx/memcard.cpp
@@ -67,7 +67,7 @@ psxcard_device::psxcard_device(const machine_config &mconfig, const char *tag, d
void psxcard_device::device_start()
{
m_owner = dynamic_cast<psx_controller_port_device *>(owner());
- m_ack_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(psxcard_device::ack_timer), this));
+ m_ack_timer = timer_alloc(FUNC(psxcard_device::ack_timer), this);
m_ack = true;
m_disabled = false;
diff --git a/src/devices/bus/qbus/pc11.cpp b/src/devices/bus/qbus/pc11.cpp
index f62f8ce0073..2fc73ada4df 100644
--- a/src/devices/bus/qbus/pc11.cpp
+++ b/src/devices/bus/qbus/pc11.cpp
@@ -82,8 +82,8 @@ void pc11_device::device_start()
save_item(NAME(m_tbuf));
// about 300 cps
- emu_timer *timer = timer_alloc();
- timer->adjust(attotime::from_usec(333), 0, attotime::from_usec(333));
+ m_read_timer = timer_alloc(FUNC(pc11_device::read_tick), this);
+ m_read_timer->adjust(attotime::from_usec(333), 0, attotime::from_usec(333));
}
@@ -214,14 +214,14 @@ void pc11_device::write(offs_t offset, uint16_t data)
}
}
-void pc11_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(pc11_device::read_tick)
{
uint8_t reply;
if (!(m_rcsr & CSR_BUSY))
return;
- LOGDBG("Timer rcsr %06o id %d param %d m_fd %p\n", m_rcsr, id, param, m_fd);
+ LOGDBG("Timer rcsr %06o param %d m_fd %p\n", m_rcsr, param, m_fd);
m_rcsr = (m_rcsr | CSR_ERR) & ~CSR_BUSY;
if (m_fd && m_fd->exists() && (m_fd->fread(&reply, 1) == 1))
diff --git a/src/devices/bus/qbus/pc11.h b/src/devices/bus/qbus/pc11.h
index 8d32925f459..cbc0d134f47 100644
--- a/src/devices/bus/qbus/pc11.h
+++ b/src/devices/bus/qbus/pc11.h
@@ -50,13 +50,14 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_z80daisy_interface overrides
virtual int z80daisy_irq_state() override;
virtual int z80daisy_irq_ack() override;
virtual void z80daisy_irq_reti() override;
+ TIMER_CALLBACK_MEMBER(read_tick);
+
private:
int m_rxvec;
int m_txvec;
@@ -71,6 +72,8 @@ private:
uint16_t m_tcsr;
uint16_t m_tbuf;
+ emu_timer *m_read_timer;
+
const char *pc11_regnames[4];
};
diff --git a/src/devices/bus/rs232/null_modem.cpp b/src/devices/bus/rs232/null_modem.cpp
index f2830ef2088..5b19f1d8e29 100644
--- a/src/devices/bus/rs232/null_modem.cpp
+++ b/src/devices/bus/rs232/null_modem.cpp
@@ -50,7 +50,7 @@ ioport_constructor null_modem_device::device_input_ports() const
void null_modem_device::device_start()
{
- m_timer_poll = timer_alloc(TIMER_POLL);
+ m_timer_poll = timer_alloc(FUNC(null_modem_device::update_queue), this);
}
WRITE_LINE_MEMBER(null_modem_device::update_serial)
@@ -81,23 +81,10 @@ WRITE_LINE_MEMBER(null_modem_device::update_serial)
void null_modem_device::device_reset()
{
update_serial(0);
- queue();
+ update_queue(0);
}
-void null_modem_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_POLL:
- queue();
- break;
-
- default:
- break;
- }
-}
-
-void null_modem_device::queue()
+TIMER_CALLBACK_MEMBER(null_modem_device::update_queue)
{
if (is_transmit_register_empty())
{
@@ -131,7 +118,7 @@ void null_modem_device::tra_callback()
void null_modem_device::tra_complete()
{
- queue();
+ update_queue(0);
}
void null_modem_device::rcv_complete()
diff --git a/src/devices/bus/rs232/null_modem.h b/src/devices/bus/rs232/null_modem.h
index 206ddfa6a1c..bd9b2520fc4 100644
--- a/src/devices/bus/rs232/null_modem.h
+++ b/src/devices/bus/rs232/null_modem.h
@@ -26,7 +26,6 @@ protected:
virtual ioport_constructor device_input_ports() const override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_add_mconfig(machine_config &config) override;
virtual void tra_callback() override;
@@ -34,9 +33,7 @@ protected:
virtual void rcv_complete() override;
private:
- static constexpr int TIMER_POLL = 1;
-
- void queue();
+ TIMER_CALLBACK_MEMBER(update_queue);
required_device<bitbanger_device> m_stream;
diff --git a/src/devices/bus/rs232/pty.cpp b/src/devices/bus/rs232/pty.cpp
index 107846896e6..3cef298dc6c 100644
--- a/src/devices/bus/rs232/pty.cpp
+++ b/src/devices/bus/rs232/pty.cpp
@@ -63,7 +63,7 @@ ioport_constructor pseudo_terminal_device::device_input_ports() const
void pseudo_terminal_device::device_start()
{
- m_timer_poll = timer_alloc(TIMER_POLL);
+ m_timer_poll = timer_alloc(FUNC(pseudo_terminal_device::update_queue), this);
open();
}
@@ -76,20 +76,7 @@ void pseudo_terminal_device::device_stop()
void pseudo_terminal_device::device_reset()
{
update_serial(0);
- queue();
-}
-
-void pseudo_terminal_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_POLL:
- queue();
- break;
-
- default:
- break;
- }
+ update_queue(0);
}
void pseudo_terminal_device::tra_callback()
@@ -99,7 +86,7 @@ void pseudo_terminal_device::tra_callback()
void pseudo_terminal_device::tra_complete()
{
- queue();
+ update_queue(0);
}
void pseudo_terminal_device::rcv_complete()
@@ -108,7 +95,7 @@ void pseudo_terminal_device::rcv_complete()
write(get_received_char());
}
-void pseudo_terminal_device::queue(void)
+TIMER_CALLBACK_MEMBER(pseudo_terminal_device::update_queue)
{
if (is_transmit_register_empty())
{
diff --git a/src/devices/bus/rs232/pty.h b/src/devices/bus/rs232/pty.h
index 2037d43885d..f9fefec5e72 100644
--- a/src/devices/bus/rs232/pty.h
+++ b/src/devices/bus/rs232/pty.h
@@ -26,14 +26,13 @@ protected:
virtual void device_start() override;
virtual void device_stop() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void tra_callback() override;
virtual void tra_complete() override;
virtual void rcv_complete() override;
private:
- void queue(void);
+ TIMER_CALLBACK_MEMBER(update_queue);
required_ioport m_rs232_txbaud;
required_ioport m_rs232_rxbaud;
diff --git a/src/devices/bus/rs232/rs232_sync_io.cpp b/src/devices/bus/rs232/rs232_sync_io.cpp
index acca54df979..8403c41e2cf 100644
--- a/src/devices/bus/rs232/rs232_sync_io.cpp
+++ b/src/devices/bus/rs232/rs232_sync_io.cpp
@@ -55,11 +55,6 @@ namespace {
}
}
-// Timers
-enum {
- TMR_ID_CLK
-};
-
rs232_sync_io_device::rs232_sync_io_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig , RS232_SYNC_IO , tag , owner , clock)
, device_rs232_port_interface(mconfig , *this)
@@ -118,7 +113,7 @@ void rs232_sync_io_device::device_add_mconfig(machine_config &config)
void rs232_sync_io_device::device_start()
{
- m_clk_timer = timer_alloc(TMR_ID_CLK);
+ m_clk_timer = timer_alloc(FUNC(rs232_sync_io_device::clock_tick), this);
}
void rs232_sync_io_device::device_reset()
@@ -141,65 +136,58 @@ void rs232_sync_io_device::device_reset()
output_rxc(1);
}
-void rs232_sync_io_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(rs232_sync_io_device::clock_tick)
{
- switch (id) {
- case TMR_ID_CLK:
- m_clk = !m_clk;
- if (m_clk) {
- output_txc(1);
- output_rxc(1);
- if (m_tx_enabled) {
- // Rising edge: capture TxD
- m_tx_byte = (m_tx_byte >> 1) & 0x7f;
- if (m_txd) {
- BIT_SET(m_tx_byte , 7);
- }
- if (++m_tx_counter >= 8) {
- LOG("Tx %02x @%s\n" , m_tx_byte , machine().time().to_string());
- m_tx_counter = 0;
- m_stream->output(m_tx_byte);
- m_tx_enabled = false;
- }
- }
- } else {
- if (!m_tx_enabled) {
- m_tx_enabled = !m_rts || !m_rts_duplex->read();
- output_cts(!m_tx_enabled);
+ m_clk = !m_clk;
+ if (m_clk) {
+ output_txc(1);
+ output_rxc(1);
+ if (m_tx_enabled) {
+ // Rising edge: capture TxD
+ m_tx_byte = (m_tx_byte >> 1) & 0x7f;
+ if (m_txd) {
+ BIT_SET(m_tx_byte , 7);
}
- if (m_tx_enabled || m_txc_setting->read() == 0) {
- output_txc(0);
+ if (++m_tx_counter >= 8) {
+ LOG("Tx %02x @%s\n" , m_tx_byte , machine().time().to_string());
+ m_tx_counter = 0;
+ m_stream->output(m_tx_byte);
+ m_tx_enabled = false;
}
- if (!m_rx_enabled) {
- m_rx_enabled = m_rts || !m_rts_duplex->read();
- if (m_rx_enabled) {
- if (m_stream->input(&m_rx_byte , 1) == 0) {
- m_rx_byte = ~0;
- if (m_rxc_setting->read() == 2) {
- m_rx_enabled = false;
- }
- } else {
- LOG("Rx %02x @%s\n" , m_rx_byte , machine().time().to_string());
+ }
+ } else {
+ if (!m_tx_enabled) {
+ m_tx_enabled = !m_rts || !m_rts_duplex->read();
+ output_cts(!m_tx_enabled);
+ }
+ if (m_tx_enabled || m_txc_setting->read() == 0) {
+ output_txc(0);
+ }
+ if (!m_rx_enabled) {
+ m_rx_enabled = m_rts || !m_rts_duplex->read();
+ if (m_rx_enabled) {
+ if (m_stream->input(&m_rx_byte , 1) == 0) {
+ m_rx_byte = ~0;
+ if (m_rxc_setting->read() == 2) {
+ m_rx_enabled = false;
}
+ } else {
+ LOG("Rx %02x @%s\n" , m_rx_byte , machine().time().to_string());
}
}
- if (m_rx_enabled || m_rxc_setting->read() == 0) {
- output_rxc(0);
- }
- if (m_rx_enabled) {
- // Falling edge: update RxD
- output_rxd(BIT(m_rx_byte , 0));
- m_rx_byte >>= 1;
- if (++m_rx_counter >= 8) {
- m_rx_counter = 0;
- m_rx_enabled = false;
- }
+ }
+ if (m_rx_enabled || m_rxc_setting->read() == 0) {
+ output_rxc(0);
+ }
+ if (m_rx_enabled) {
+ // Falling edge: update RxD
+ output_rxd(BIT(m_rx_byte , 0));
+ m_rx_byte >>= 1;
+ if (++m_rx_counter >= 8) {
+ m_rx_counter = 0;
+ m_rx_enabled = false;
}
}
- break;
-
- default:
- break;
}
}
diff --git a/src/devices/bus/rs232/rs232_sync_io.h b/src/devices/bus/rs232/rs232_sync_io.h
index dce3aa4297f..a5b6818de48 100644
--- a/src/devices/bus/rs232/rs232_sync_io.h
+++ b/src/devices/bus/rs232/rs232_sync_io.h
@@ -34,7 +34,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(clock_tick);
private:
required_device<bitbanger_device> m_stream;
diff --git a/src/devices/bus/rs232/xvd701.cpp b/src/devices/bus/rs232/xvd701.cpp
index e51ff0449ce..a04365f2239 100644
--- a/src/devices/bus/rs232/xvd701.cpp
+++ b/src/devices/bus/rs232/xvd701.cpp
@@ -58,7 +58,7 @@ void jvc_xvd701_device::device_start()
output_ri(0);
output_cts(0);
- m_timer_response = timer_alloc(TIMER_RESPONSE);
+ m_timer_response = timer_alloc(FUNC(jvc_xvd701_device::send_response), this);
}
void jvc_xvd701_device::device_reset()
@@ -73,19 +73,6 @@ void jvc_xvd701_device::device_reset()
m_playback_status = STATUS_STOP;
}
-void jvc_xvd701_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_RESPONSE:
- send_response();
- break;
-
- default:
- break;
- }
-}
-
void jvc_xvd701_device::tra_callback()
{
output_rxd(transmit_register_get_data_bit());
@@ -119,7 +106,7 @@ void jvc_xvd701_device::create_packet(unsigned char status, const unsigned char
m_timer_response->adjust(attotime::from_msec(100));
}
-void jvc_xvd701_device::send_response()
+TIMER_CALLBACK_MEMBER(jvc_xvd701_device::send_response)
{
if (m_response_index < sizeof(m_response) && is_transmit_register_empty())
{
diff --git a/src/devices/bus/rs232/xvd701.h b/src/devices/bus/rs232/xvd701.h
index da9fbce0502..8e85e377f76 100644
--- a/src/devices/bus/rs232/xvd701.h
+++ b/src/devices/bus/rs232/xvd701.h
@@ -18,7 +18,6 @@ protected:
virtual ioport_constructor device_input_ports() const override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_add_mconfig(machine_config &config) override;
virtual void tra_callback() override;
@@ -26,8 +25,6 @@ protected:
virtual void rcv_complete() override;
private:
- static constexpr int TIMER_RESPONSE = 1;
-
enum jvc_xvd701_media_type : uint32_t
{
JVC_MEDIA_VCD = 0,
@@ -41,7 +38,7 @@ private:
STATUS_PAUSE = 2,
};
- void send_response();
+ TIMER_CALLBACK_MEMBER(send_response);
unsigned char sum(unsigned char *buffer, int length);
void create_packet(unsigned char status, const unsigned char response[6]);
diff --git a/src/devices/bus/s100/ascsasi.cpp b/src/devices/bus/s100/ascsasi.cpp
index ef8b2d329e3..73cacf9680a 100644
--- a/src/devices/bus/s100/ascsasi.cpp
+++ b/src/devices/bus/s100/ascsasi.cpp
@@ -89,8 +89,8 @@ asc_sasi_device::asc_sasi_device(const machine_config &mconfig, const char *tag,
void asc_sasi_device::device_start()
{
// initialize timers
- m_sel_off_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(asc_sasi_device::sel_off), this));
- m_rst_off_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(asc_sasi_device::rst_off), this));
+ m_sel_off_timer = timer_alloc(FUNC(asc_sasi_device::sel_off), this);
+ m_rst_off_timer = timer_alloc(FUNC(asc_sasi_device::rst_off), this);
// save state
save_item(NAME(m_data_latch));
diff --git a/src/devices/bus/samcoupe/mouse/mouse.cpp b/src/devices/bus/samcoupe/mouse/mouse.cpp
index 02f80626e79..fbacfa67c7a 100644
--- a/src/devices/bus/samcoupe/mouse/mouse.cpp
+++ b/src/devices/bus/samcoupe/mouse/mouse.cpp
@@ -64,7 +64,7 @@ sam_mouse_device::sam_mouse_device(const machine_config &mconfig, const char *ta
void sam_mouse_device::device_start()
{
// allocate timer
- m_reset = timer_alloc();
+ m_reset = timer_alloc(FUNC(sam_mouse_device::reset_tick), this);
// register for savestates
save_item(NAME(m_mouse_index));
@@ -85,10 +85,10 @@ void sam_mouse_device::device_reset()
}
//-------------------------------------------------
-// device_timer - handler timer events
+// reset_tick - reset the mouse index
//-------------------------------------------------
-void sam_mouse_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(sam_mouse_device::reset_tick)
{
m_mouse_index = 0;
}
diff --git a/src/devices/bus/samcoupe/mouse/mouse.h b/src/devices/bus/samcoupe/mouse/mouse.h
index 008b1f9b750..076f3035b6d 100644
--- a/src/devices/bus/samcoupe/mouse/mouse.h
+++ b/src/devices/bus/samcoupe/mouse/mouse.h
@@ -33,7 +33,8 @@ protected:
virtual ioport_constructor device_input_ports() const override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(reset_tick);
private:
required_ioport m_io_buttons;
diff --git a/src/devices/bus/scsi/scsihle.cpp b/src/devices/bus/scsi/scsihle.cpp
index a177d25ddb3..09a0fa84eca 100644
--- a/src/devices/bus/scsi/scsihle.cpp
+++ b/src/devices/bus/scsi/scsihle.cpp
@@ -82,9 +82,9 @@ void scsihle_device::device_start()
{
t10_start(*this);
- req_timer = timer_alloc(0);
- sel_timer = timer_alloc(1);
- dataout_timer = timer_alloc(2);
+ req_timer = timer_alloc(FUNC(scsihle_device::req_tick), this);
+ sel_timer = timer_alloc(FUNC(scsihle_device::sel_tick), this);
+ dataout_timer = timer_alloc(FUNC(scsihle_device::dataout_tick), this);
}
void scsihle_device::device_reset()
@@ -206,27 +206,24 @@ void scsihle_device::scsibus_write_data()
data_idx=0;
}
-void scsihle_device::device_timer(emu_timer &timer, device_timer_id tid, int param)
+TIMER_CALLBACK_MEMBER(scsihle_device::req_tick)
{
- switch (tid)
- {
- case 0:
- output_req(param);
- break;
+ output_req(param);
+}
- case 1:
- output_bsy(param);
- break;
+TIMER_CALLBACK_MEMBER(scsihle_device::sel_tick)
+{
+ output_bsy(param);
+}
- case 2:
- // Some drives, notably the ST225N and ST125N, accept fromat unit commands
- // with flags set indicating that bad block data should be transferred but
- // don't then implemnt a data in phase, this timeout it to catch these !
- if (IS_COMMAND(SCSI_CMD_FORMAT_UNIT) && (data_idx==0))
- {
- scsi_change_phase(SCSI_PHASE_STATUS);
- }
- break;
+TIMER_CALLBACK_MEMBER(scsihle_device::dataout_tick)
+{
+ // Some drives, notably the ST225N and ST125N, accept fromat unit commands
+ // with flags set indicating that bad block data should be transferred but
+ // don't then implemnt a data in phase, this timeout it to catch these
+ if (IS_COMMAND(SCSI_CMD_FORMAT_UNIT) && (data_idx==0))
+ {
+ scsi_change_phase(SCSI_PHASE_STATUS);
}
}
diff --git a/src/devices/bus/scsi/scsihle.h b/src/devices/bus/scsi/scsihle.h
index d810be70dcc..ea6f577a592 100644
--- a/src/devices/bus/scsi/scsihle.h
+++ b/src/devices/bus/scsi/scsihle.h
@@ -43,7 +43,10 @@ protected:
virtual ioport_constructor device_input_ports() const override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(req_tick);
+ TIMER_CALLBACK_MEMBER(sel_tick);
+ TIMER_CALLBACK_MEMBER(dataout_tick);
private:
required_ioport m_scsi_id;
diff --git a/src/devices/bus/sg1000_exp/kblink.cpp b/src/devices/bus/sg1000_exp/kblink.cpp
index 4a2cd10786a..8d98e006f94 100644
--- a/src/devices/bus/sg1000_exp/kblink.cpp
+++ b/src/devices/bus/sg1000_exp/kblink.cpp
@@ -81,9 +81,9 @@ sk1100_link_cable_device::sk1100_link_cable_device(const machine_config &mconfig
void sk1100_link_cable_device::device_start()
{
- m_timer_poll = timer_alloc(TIMER_POLL);
- m_timer_send = timer_alloc(TIMER_SEND);
- m_timer_read = timer_alloc(TIMER_READ);
+ m_timer_poll = timer_alloc(FUNC(sk1100_link_cable_device::update_queue), this);
+ m_timer_send = timer_alloc(FUNC(sk1100_link_cable_device::send_tick), this);
+ m_timer_read = timer_alloc(FUNC(sk1100_link_cable_device::read_tick), this);
/* register for state saving */
save_item(NAME(m_data));
@@ -103,7 +103,7 @@ void sk1100_link_cable_device::device_start()
void sk1100_link_cable_device::device_reset()
{
- queue();
+ update_queue(0);
}
@@ -116,29 +116,7 @@ void sk1100_link_cable_device::device_add_mconfig(machine_config &config)
BITBANGER(config, m_stream, 0);
}
-
-void sk1100_link_cable_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_POLL:
- queue();
- break;
-
- case TIMER_SEND:
- m_stream->output(u8(param));
- break;
-
- case TIMER_READ:
- m_update_received_data = true;
- break;
-
- default:
- break;
- }
-}
-
-void sk1100_link_cable_device::queue()
+TIMER_CALLBACK_MEMBER(sk1100_link_cable_device::update_queue)
{
if (m_input_index == m_input_count)
{
@@ -151,6 +129,16 @@ void sk1100_link_cable_device::queue()
}
}
+TIMER_CALLBACK_MEMBER(sk1100_link_cable_device::send_tick)
+{
+ m_stream->output(u8(param));
+}
+
+TIMER_CALLBACK_MEMBER(sk1100_link_cable_device::read_tick)
+{
+ m_update_received_data = true;
+}
+
void sk1100_link_cable_device::set_data_read()
{
// Check if a new byte from the input buffer was read for this timeslice.
@@ -162,7 +150,7 @@ void sk1100_link_cable_device::set_data_read()
// there is no way to read what was sent from peer as feed bit.
m_fault = BIT(byte, 0); // sent from peer as data bit
m_busy = BIT(byte, 1); // sent from peer as reset bit
- queue();
+ update_queue(0);
}
// Set to read next byte only after the end of this timeslice.
m_update_received_data = false;
diff --git a/src/devices/bus/sg1000_exp/kblink.h b/src/devices/bus/sg1000_exp/kblink.h
index 2c64dd312bf..561c1b79455 100644
--- a/src/devices/bus/sg1000_exp/kblink.h
+++ b/src/devices/bus/sg1000_exp/kblink.h
@@ -37,11 +37,9 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_add_mconfig(machine_config &config) override;
// device_sk1100_link_cable_interface overrides
-
virtual DECLARE_WRITE_LINE_MEMBER( input_data ) override { m_data = state; set_data_transfer(); }
virtual DECLARE_WRITE_LINE_MEMBER( input_reset ) override { m_reset = state; set_data_transfer(); }
virtual DECLARE_WRITE_LINE_MEMBER( input_feed ) override { m_feed = state; set_data_transfer(); }
@@ -49,6 +47,10 @@ protected:
virtual DECLARE_READ_LINE_MEMBER( output_fault ) override { set_data_read(); return m_fault; }
virtual DECLARE_READ_LINE_MEMBER( output_busy ) override { set_data_read(); return m_busy; }
+ TIMER_CALLBACK_MEMBER(update_queue);
+ TIMER_CALLBACK_MEMBER(send_tick);
+ TIMER_CALLBACK_MEMBER(read_tick);
+
private:
static constexpr int TIMER_POLL = 1;
static constexpr int TIMER_SEND = 2;
diff --git a/src/devices/bus/sgikbd/hlekbd.cpp b/src/devices/bus/sgikbd/hlekbd.cpp
index 68883f37d7d..42ffb0eb76c 100644
--- a/src/devices/bus/sgikbd/hlekbd.cpp
+++ b/src/devices/bus/sgikbd/hlekbd.cpp
@@ -201,8 +201,8 @@ void hle_device::device_add_mconfig(machine_config &config)
void hle_device::device_start()
{
m_leds.resolve();
- m_click_timer = timer_alloc(TIMER_CLICK);
- m_beep_timer = timer_alloc(TIMER_BEEP);
+ m_click_timer = timer_alloc(FUNC(hle_device::click_off), this);
+ m_beep_timer = timer_alloc(FUNC(hle_device::beep_off), this);
save_item(NAME(m_make_count));
save_item(NAME(m_keyclick));
@@ -247,23 +247,16 @@ void hle_device::device_reset()
start_processing(attotime::from_hz(600));
}
-void hle_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(hle_device::click_off)
{
- switch (id)
- {
- case TIMER_CLICK:
- m_beeper_state &= ~BEEPER_CLICK;
- m_beeper->set_state(m_beeper_state ? 1 : 0);
- break;
-
- case TIMER_BEEP:
- m_beeper_state &= ~BEEPER_BELL;
- m_beeper->set_state(m_beeper_state ? 1 : 0);
- break;
+ m_beeper_state &= ~BEEPER_CLICK;
+ m_beeper->set_state(m_beeper_state ? 1 : 0);
+}
- default:
- break;
- }
+TIMER_CALLBACK_MEMBER(hle_device::beep_off)
+{
+ m_beeper_state &= ~BEEPER_BELL;
+ m_beeper->set_state(m_beeper_state ? 1 : 0);
}
void hle_device::tra_callback()
diff --git a/src/devices/bus/sgikbd/hlekbd.h b/src/devices/bus/sgikbd/hlekbd.h
index afa9fb03949..ce066e90c55 100644
--- a/src/devices/bus/sgikbd/hlekbd.h
+++ b/src/devices/bus/sgikbd/hlekbd.h
@@ -31,7 +31,6 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual ioport_constructor device_input_ports() const override;
// device_buffered_serial_interface overrides
@@ -45,13 +44,10 @@ protected:
// customised transmit_byte method
void transmit_byte(uint8_t byte);
-private:
- enum
- {
- TIMER_CLICK = 30000,
- TIMER_BEEP = 30001
- };
+ TIMER_CALLBACK_MEMBER(click_off);
+ TIMER_CALLBACK_MEMBER(beep_off);
+private:
enum
{
LED_NUM,
diff --git a/src/devices/bus/sms_ctrl/lphaser.cpp b/src/devices/bus/sms_ctrl/lphaser.cpp
index d9fb0443ec8..7e64e7c7236 100644
--- a/src/devices/bus/sms_ctrl/lphaser.cpp
+++ b/src/devices/bus/sms_ctrl/lphaser.cpp
@@ -45,7 +45,9 @@ READ_LINE_MEMBER( sms_light_phaser_device::th_pin_r )
INPUT_CHANGED_MEMBER( sms_light_phaser_device::position_changed )
{
if (newval != oldval)
- sensor_check();
+ {
+ sensor_check(0);
+ }
}
@@ -87,7 +89,9 @@ sms_light_phaser_device::sms_light_phaser_device(const machine_config &mconfig,
device_sms_control_port_interface(mconfig, *this),
m_lphaser_pins(*this, "CTRL_PORT"),
m_lphaser_x(*this, "LPHASER_X"),
- m_lphaser_y(*this, "LPHASER_Y"), m_sensor_last_state(0), m_lphaser_timer(nullptr)
+ m_lphaser_y(*this, "LPHASER_Y"),
+ m_sensor_last_state(0),
+ m_lphaser_timer(nullptr)
{
}
@@ -99,7 +103,7 @@ sms_light_phaser_device::sms_light_phaser_device(const machine_config &mconfig,
void sms_light_phaser_device::device_start()
{
save_item(NAME(m_sensor_last_state));
- m_lphaser_timer = timer_alloc(TIMER_LPHASER);
+ m_lphaser_timer = timer_alloc(FUNC(sms_light_phaser_device::sensor_check), this);
}
@@ -121,28 +125,28 @@ uint8_t sms_light_phaser_device::peripheral_r()
/*
Light Phaser (light gun) emulation notes:
- - The sensor is activated based on color brightness of some individual
- pixels being drawn by the beam, at circular area where the gun is aiming.
+ - The sensor is activated based on the brightness of individual pixels being
+ drawn by the beam, in circular area where the gun is aiming.
- Currently, brightness is calculated based only on single pixels.
- In general, after the trigger is pressed, games draw the next frame using
- a light color pattern, to make sure sensor will be activated. If emulation
- skips that frame, sensor may stay deactivated. Frameskip set to 0 (no skip)
+ a bright pattern, to make sure the sensor will be activated. If the emulation
+ skips that frame, the sensor may stay deactivated. Setting frameskip to 0
is recommended to avoid problems.
- - When sensor switches from on (0) to off (1), a value is latched for the
+ - When the sensor switches from on (0) to off (1), a value is latched for the
HCount register.
- - When sensor switches from off to on, a flag is set. The emulation uses the
- flag to signal that TH line is activated when the status of the input port
- is read. After read, the flag is cleared, or else it is cleared later when
- the Pause status is read (end of a frame). This is necessary because the
+ - When the sensor switches from off to on, a flag is set. The emulation uses
+ this flag to signal that the TH line is activated during status reads of the
+ input port. After reading, the flag is cleared, or it is cleared when the
+ Pause status is read at the end of a frame. This is necessary because the
"Color & Switch Test" ROM only reads the TH state after VINT occurs.
- - The gun test of "Color & Switch Test" is an example that requires checks
- of sensor status independent of other events, like trigger press or TH bit
+ - The gun test in "Color & Switch Test" is an example that requires checks
+ of the sensor status independent of other events, like trigger press or TH bit
reads. Another example is the title screen of "Hang-On & Safari Hunt", where
- the game only reads HCount register in a loop, expecting a latch by the gun.
- - The whole procedure is managed by a timer callback, that always reschedule
- itself to run in some intervals when the beam is at the circular area.
+ the game only reads the HCount register in a loop, expecting a latch by the gun.
+ - The whole procedure is managed by a periodic timer callback, which is scheduled
+ to run in intervals when the beam is within the circular area.
*/
-int sms_light_phaser_device::bright_aim_area( emu_timer *timer, int lgun_x, int lgun_y )
+int sms_light_phaser_device::bright_aim_area(int lgun_x, int lgun_y)
{
const int r_x_r = LGUN_RADIUS * LGUN_RADIUS;
const rectangle &visarea = m_port->m_screen->visible_area();
@@ -151,8 +155,7 @@ int sms_light_phaser_device::bright_aim_area( emu_timer *timer, int lgun_x, int
int beam_y = m_port->m_screen->vpos();
int beam_x_orig = beam_x;
int beam_y_orig = beam_y;
- int dy, result = 1;
- double dx_radius;
+ int result = 1;
bool new_check_point = false;
aim_area.min_y = std::max(lgun_y - LGUN_RADIUS, visarea.min_y);
@@ -166,23 +169,21 @@ int sms_light_phaser_device::bright_aim_area( emu_timer *timer, int lgun_x, int
{
beam_y = aim_area.min_y;
}
- dy = abs(beam_y - lgun_y);
+ int dy = abs(beam_y - lgun_y);
/* Caculate distance in x of the radius, relative to beam's y distance.
First try some shortcuts. */
- switch (dy)
+ double dx_radius = 0;
+ if (dy == 0)
{
- case LGUN_RADIUS:
- dx_radius = 0;
- break;
- case 0:
dx_radius = LGUN_RADIUS;
- break;
- default:
+ }
+ else if (dy != LGUN_RADIUS)
+ {
/* step 1: r^2 = dx^2 + dy^2 */
/* step 2: dx^2 = r^2 - dy^2 */
/* step 3: dx = sqrt(r^2 - dy^2) */
- dx_radius = ceil((float) sqrt((float) (r_x_r - (dy * dy))));
+ dx_radius = ceil(sqrt(double(r_x_r - (dy * dy))));
}
aim_area.min_x = std::max(int32_t(lgun_x - dx_radius), visarea.min_x);
@@ -252,7 +253,7 @@ int sms_light_phaser_device::bright_aim_area( emu_timer *timer, int lgun_x, int
}
}
- timer->adjust(m_port->m_screen->time_until_pos(beam_y, beam_x));
+ m_lphaser_timer->adjust(m_port->m_screen->time_until_pos(beam_y, beam_x));
return result;
}
@@ -273,30 +274,15 @@ uint16_t sms_light_phaser_device::screen_vpos_nonscaled(int scaled_vpos)
}
-void sms_light_phaser_device::sensor_check()
+TIMER_CALLBACK_MEMBER(sms_light_phaser_device::sensor_check)
{
- int sensor_new_state;
-
const int x = screen_hpos_nonscaled(m_lphaser_x->read());
const int y = screen_vpos_nonscaled(m_lphaser_y->read());
- sensor_new_state = bright_aim_area(m_lphaser_timer, x, y);
+ int sensor_new_state = bright_aim_area(x, y);
if (sensor_new_state != m_sensor_last_state)
{
m_port->th_pin_w(sensor_new_state);
m_sensor_last_state = sensor_new_state;
}
}
-
-
-void sms_light_phaser_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_LPHASER:
- sensor_check();
- break;
- default:
- throw emu_fatalerror("sms_light_phaser_device(%s): Unknown timer ID", tag());
- }
-}
diff --git a/src/devices/bus/sms_ctrl/lphaser.h b/src/devices/bus/sms_ctrl/lphaser.h
index 3e1a4d41960..a75f4a0d042 100644
--- a/src/devices/bus/sms_ctrl/lphaser.h
+++ b/src/devices/bus/sms_ctrl/lphaser.h
@@ -39,7 +39,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_sms_control_port_interface overrides
virtual uint8_t peripheral_r() override;
@@ -51,10 +50,9 @@ private:
int m_sensor_last_state;
emu_timer *m_lphaser_timer;
- static const device_timer_id TIMER_LPHASER = 0;
- void sensor_check();
- int bright_aim_area( emu_timer *timer, int lgun_x, int lgun_y );
+ TIMER_CALLBACK_MEMBER(sensor_check);
+ int bright_aim_area(int lgun_x, int lgun_y );
uint16_t screen_hpos_nonscaled(int scaled_hpos);
uint16_t screen_vpos_nonscaled(int scaled_vpos);
};
diff --git a/src/devices/bus/sms_ctrl/sports.cpp b/src/devices/bus/sms_ctrl/sports.cpp
index 0995af24f5c..d58cfb68095 100644
--- a/src/devices/bus/sms_ctrl/sports.cpp
+++ b/src/devices/bus/sms_ctrl/sports.cpp
@@ -11,29 +11,28 @@ Release data from the Sega Retro project:
TODO:
-- For low-level emulation, a device for the TMP42C66P, a Toshiba 4bit
- microcontroller, needs to be created, but a dump of its internal ROM
- seems to be required.
+- For low-level emulation, a device for the TMP42C66P, a Toshiba 4-bit
+ microcontroller, is needed along with a dump of its internal ROM.
- Auto-repeat and Control/Sports mode switches are not emulated.
Notes:
Games designed for the US model of the Sports Pad controller use the
- TH line of the controller port to select which nibble, of the two axis
- bytes, will be read at a time. The Japanese cartridge Sports Pad Soccer
- uses a different mode when not detect a SMSJ, because the Sega Mark III
- lacks the TH line. There is a different Sports Pad model released in
- Japan and no information was found about it supporting both modes, so
+ TH line of the controller port to select which nibble of the two axis
+ to read. The Japanese cartridge Sports Pad Soccer uses a different mode
+ when it does not detect use by a Japanese SMS console, because the Sega
+ Mark III lacks the TH line. There was a different Sports Pad model released
+ in Japan and no information was found about it supporting both modes, so
that model is currently emulated as a different device (see sportsjp.c).
It was discovered that games designed for the Paddle Controller, released
- in Japan, switch to a mode incompatible with the original Paddle when
- detect the system region as Export. Similar to how the US model of the
- Sports Pad works, that mode uses the TH line as output to select which
+ in Japan, will switch to a mode incompatible with the original Paddle when
+ the system region is detected as Export. Similar to how the US model of the
+ Sports Pad works, that mode uses the TH line as an output to select which
nibble of the X axis will be read. So, on an Export console version,
paddle games are somewhat playable with the US Sport Pad model, though it
- needs to be used inverted and the trackball needs to be moved slowly, else
- the software for the paddle think it's moving backward.
+ needs to be used inverted and the trackball needs to be moved slowly,
+ otherwise the software for the paddle think it's moving backward.
See http://mametesters.org/view.php?id=5872 for discussion.
**********************************************************************/
@@ -53,28 +52,20 @@ DEFINE_DEVICE_TYPE(SMS_SPORTS_PAD, sms_sports_pad_device, "sms_sports_pad", "Seg
#define SPORTS_PAD_INTERVAL attotime::from_hz(XTAL(10'738'635)/3/512)
-void sms_sports_pad_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(sms_sports_pad_device::read_tick)
{
- switch (id)
+ // values for x and y axis need to be reset for Sports Pad games, but
+ // are not reset for paddle games, so it was assumed the reset occurs
+ // only when this timer fires after the read state reaches its maximum value.
+ if (m_read_state == 3)
{
- case TIMER_SPORTSPAD:
- // values for x and y axis need to be resetted for Sports Pad games, but
- // are not resetted for paddle games, so it was assumed the reset occurs
- // only when this timer fires after the read state reached maximum value.
- if (m_read_state == 3)
- {
- m_x_axis_reset_value = m_sports_x->read();
- m_y_axis_reset_value = m_sports_y->read();
- }
- else
- {
- // set to maximum value, so it wraps to 0 at next increment
- m_read_state = 3;
- }
-
- break;
- default:
- throw emu_fatalerror("sms_sports_pad_device(%s): Unknown timer ID", tag());
+ m_x_axis_reset_value = m_sports_x->read();
+ m_y_axis_reset_value = m_sports_y->read();
+ }
+ else
+ {
+ // set to maximum value, so it wraps to 0 at next increment
+ m_read_state = 3;
}
}
@@ -169,7 +160,7 @@ sms_sports_pad_device::sms_sports_pad_device(const machine_config &mconfig, cons
m_sports_y(*this, "SPORTS_Y"),
m_read_state(0),
m_th_pin_state(0),
- m_x_axis_reset_value(0x80), // value 0x80 helps when start playing paddle games.
+ m_x_axis_reset_value(0x80), // value 0x80 helps when starting paddle games.
m_y_axis_reset_value(0x80),
m_interval(SPORTS_PAD_INTERVAL),
m_sportspad_timer(nullptr)
@@ -183,7 +174,7 @@ sms_sports_pad_device::sms_sports_pad_device(const machine_config &mconfig, cons
void sms_sports_pad_device::device_start()
{
- m_sportspad_timer = timer_alloc(TIMER_SPORTSPAD);
+ m_sportspad_timer = timer_alloc(FUNC(sms_sports_pad_device::read_tick), this);
save_item(NAME(m_read_state));
save_item(NAME(m_th_pin_state));
@@ -191,21 +182,11 @@ void sms_sports_pad_device::device_start()
save_item(NAME(m_y_axis_reset_value));
}
-
-//-------------------------------------------------
-// sms_peripheral_r - sports pad read
-//-------------------------------------------------
-
uint8_t sms_sports_pad_device::peripheral_r()
{
return m_sports_in->read();
}
-
-//-------------------------------------------------
-// sms_peripheral_w - sports pad write
-//-------------------------------------------------
-
void sms_sports_pad_device::peripheral_w(uint8_t data)
{
m_sports_out->write(data);
diff --git a/src/devices/bus/sms_ctrl/sports.h b/src/devices/bus/sms_ctrl/sports.h
index ed7c8a97eef..cdf1202befd 100644
--- a/src/devices/bus/sms_ctrl/sports.h
+++ b/src/devices/bus/sms_ctrl/sports.h
@@ -56,9 +56,8 @@ private:
uint8_t m_y_axis_reset_value;
const attotime m_interval;
emu_timer *m_sportspad_timer;
- static const device_timer_id TIMER_SPORTSPAD = 0;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(read_tick);
};
diff --git a/src/devices/bus/snes/event.cpp b/src/devices/bus/snes/event.cpp
index 26a66971e67..5ce5bbca97c 100644
--- a/src/devices/bus/snes/event.cpp
+++ b/src/devices/bus/snes/event.cpp
@@ -4,7 +4,7 @@
Super NES/Famicom Event cartridges emulation (for SNES/SFC)
- TODO: figure out how the Test Mode switch works...
+ TODO: Figure out how the Test Mode switch works
***********************************************************************************************************/
@@ -38,7 +38,7 @@ void sns_pfest94_device::device_start()
{
m_dsp_prg.resize(0x2000/sizeof(uint32_t));
m_dsp_data.resize(0x800/sizeof(uint16_t));
- pfest94_timer = timer_alloc(TIMER_EVENT);
+ pfest94_timer = timer_alloc(FUNC(sns_pfest94_device::event_tick), this);
pfest94_timer->reset();
save_item(NAME(m_base_bank));
@@ -102,7 +102,7 @@ uint8_t sns_pfest94_device::read_h(offs_t offset)
}
-// these are used for two diff effects: both to select game from menu and to access the DSP when running SMK!
+// these are used both to select game from the menu and to access the DSP when running Super Mario Kart.
uint8_t sns_pfest94_device::chip_read(offs_t offset)
{
if (offset & 0x8000)
@@ -166,6 +166,7 @@ inline uint32_t get_prg(uint8_t *CPU, uint32_t addr)
{
return ((CPU[addr * 4] << 24) | (CPU[addr * 4 + 1] << 16) | (CPU[addr * 4 + 2] << 8) | 0x00);
}
+
inline uint16_t get_data(uint8_t *CPU, uint32_t addr)
{
return ((CPU[addr * 2] << 8) | CPU[addr * 2 + 1]);
@@ -183,7 +184,7 @@ void sns_pfest94_device::speedup_addon_bios_access()
}
-// DSP dump contains prg at offset 0 and data at offset 0x2000
+// DSP dump contains program code at offset 0 and data at offset 0x2000
uint32_t sns_pfest94_device::necdsp_prg_r(offs_t offset)
{
return get_prg(&m_bios[0], offset);
@@ -262,20 +263,12 @@ ioport_constructor sns_pfest94_device::device_input_ports() const
return INPUT_PORTS_NAME( pfest94_dsw );
}
-
-//-------------------------------------------------
-// device_timer - handler timer events
-//-------------------------------------------------
-
-void sns_pfest94_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(sns_pfest94_device::event_tick)
{
- if (id == TIMER_EVENT)
+ if (!m_count)
{
- if (!m_count)
- {
- m_status |= 2;
- pfest94_timer->reset();
- }
- m_count--;
+ m_status |= 2;
+ pfest94_timer->reset();
}
+ m_count--;
}
diff --git a/src/devices/bus/snes/event.h b/src/devices/bus/snes/event.h
index 1885b3fa328..5c075b50b27 100644
--- a/src/devices/bus/snes/event.h
+++ b/src/devices/bus/snes/event.h
@@ -19,13 +19,10 @@ public:
sns_pfest94_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected:
- static constexpr device_timer_id TIMER_EVENT = 0;
-
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_add_mconfig(machine_config &config) override;
virtual ioport_constructor device_input_ports() const override;
@@ -40,6 +37,8 @@ protected:
virtual uint32_t necdsp_prg_r(offs_t offset);
virtual uint16_t necdsp_data_r(offs_t offset);
+ TIMER_CALLBACK_MEMBER(event_tick);
+
private:
required_device<upd7725_device> m_upd7725;
required_ioport m_dsw;
diff --git a/src/devices/bus/snes/sa1.cpp b/src/devices/bus/snes/sa1.cpp
index 39b2bd080e3..43835642806 100644
--- a/src/devices/bus/snes/sa1.cpp
+++ b/src/devices/bus/snes/sa1.cpp
@@ -5,17 +5,17 @@
SA-1 add-on chip emulation (for SNES/SFC)
Note:
- - SA-1 register description below is based on no$cash docs.
- - about bankswitch handling: no matter what is ROM size, at loading the ROM is mirrored up to 8MB and a
+ - SA-1 register description below is based on nocash docs.
+ - Bankswitch handling: no matter what ROM size is used, at loading the ROM is mirrored up to 8MB and a
rom_bank_map[0x100] array is built as a lookup table for 256x32KB banks filling the 8MB accessible ROM
- area; this allows to handle any 0-7 value written to CXB/DXB/EXB/FXB SA-1 registers without any masking!
- - about BWRAM "bitmap mode": in 2bits mode
+ area; this allows any value from 0-7 being written to CXB/DXB/EXB/FXB SA-1 registers without any masking.
+ - about BWRAM "bitmap mode": in 2-bit mode
600000h.Bit0-1 mirrors to 400000h.Bit0-1
600001h.Bit0-1 mirrors to 400000h.Bit2-3
600002h.Bit0-1 mirrors to 400000h.Bit4-5
600003h.Bit0-1 mirrors to 400000h.Bit6-7
...
- in 4bits mode
+ in 4-bit mode
600000h.Bit0-3 mirrors to 400000h.Bit0-3
600001h.Bit0-3 mirrors to 400000h.Bit4-7
600002h.Bit0-3 mirrors to 400001h.Bit0-3
@@ -24,10 +24,10 @@
to handle the separate modes, bitmap accesses go to offset + 0x100000
TODO:
- - test case for BWRAM write protect (bsnes does not seem to ever protect either, so it's not implemented
+ - Test case for BWRAM write protect (bsnes does not seem to protect either, so it's not implemented
for the moment)
- - almost everything CPU related!
- - Bus conflict (also seen: https://github.com/VitorVilela7/SnesSpeedTest)
+ - Almost everything CPU related
+ - Bus conflicts
Compatibility:
asahishi: plays OK
@@ -61,8 +61,8 @@
sshogi3: plays OK
taikyoid: plays OK
takemiya: plays OK
- [Note: for Igo & Shougi games, "plays OK" means you can get ingame and the CPU replies to your moves... subtle bugs
- might indeed exist...]
+ Note: for Igo & Shougi games, "plays OK" means you can get ingame and the CPU replies to your moves; subtle bugs
+ might indeed exist.
***********************************************************************************************************/
@@ -110,7 +110,7 @@ sns_sa1_device::sns_sa1_device(const machine_config &mconfig, const char *tag, d
void sns_sa1_device::device_start()
{
m_internal_ram = make_unique_clear<u8[]>(0x800);
- m_sa1_timer = timer_alloc(TIMER_SA1);
+ m_sa1_timer = timer_alloc(FUNC(sns_sa1_device::timer_tick), this);
m_scpu_ctrl = 0;
m_nmi_vector = 0;
@@ -220,65 +220,59 @@ void sns_sa1_device::device_reset()
m_cconv1_dma_active = false;
m_cconv2_line = 0;
- // sa-1 CPU starts out not running?
+ // SA-1 CPU starts out not running
m_sa1->set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
- // timer is run parallely with CPUs
+ // Timer is run in sync with the CPU
m_sa1_timer->adjust(m_sa1->clocks_to_attotime(2), 0, m_sa1->clocks_to_attotime(2));
}
-void sns_sa1_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(sns_sa1_device::timer_tick)
{
- switch (id)
+ if (TMC_HVSELB())
{
- case TIMER_SA1:
- if (TMC_HVSELB())
- {
- // 18 bit Linear timer
- m_hpos++;
- m_vpos += m_hpos >> 9;
- m_hpos &= 0x1ff;
- m_vpos &= 0x1ff;
- }
- else
+ // 18 bit Linear timer
+ m_hpos++;
+ m_vpos += m_hpos >> 9;
+ m_hpos &= 0x1ff;
+ m_vpos &= 0x1ff;
+ }
+ else
+ {
+ // H/V timer
+ if (++m_hpos >= 341)
{
- // H/V timer
- if (++m_hpos >= 341)
- {
- m_hpos = 0;
- if (++m_vpos >= scanlines_r())
- m_vpos = 0;
- }
+ m_hpos = 0;
+ if (++m_vpos >= scanlines_r())
+ m_vpos = 0;
}
- // send timer IRQ
- if (TMC_HEN() && TMC_VEN()) // both H and V count enabled
+ }
+ // send timer IRQ
+ if (TMC_HEN() && TMC_VEN()) // both H and V count enabled
+ {
+ if ((m_hpos == m_hcount) && (m_vpos == m_vcount))
{
- if ((m_hpos == m_hcount) && (m_vpos == m_vcount))
- {
- m_sa1_flags |= SA1_IRQ_TIMER;
- recalc_irqs();
- }
+ m_sa1_flags |= SA1_IRQ_TIMER;
+ recalc_irqs();
}
- else if (TMC_HEN()) // H count only
+ }
+ else if (TMC_HEN()) // H count only
+ {
+ if (m_hpos == m_hcount)
{
- if (m_hpos == m_hcount)
- {
- m_sa1_flags |= SA1_IRQ_TIMER;
- recalc_irqs();
- }
+ m_sa1_flags |= SA1_IRQ_TIMER;
+ recalc_irqs();
}
- else if (TMC_VEN()) // V count only
+ }
+ else if (TMC_VEN()) // V count only
+ {
+ if ((m_hpos == 0) && (m_vpos == m_vcount))
{
- if ((m_hpos == 0) && (m_vpos == m_vcount))
- {
- m_sa1_flags |= SA1_IRQ_TIMER;
- recalc_irqs();
- }
+ m_sa1_flags |= SA1_IRQ_TIMER;
+ recalc_irqs();
}
- break;
- // Math & DMA timer here?
- default:
- throw emu_fatalerror("Unknown id in sns_sa1_device::device_timer");
}
+
+ // TODO: Math & DMA timer
}
/*-------------------------------------------------
@@ -309,11 +303,11 @@ void sns_sa1_device::recalc_irqs()
-------------------------------------------------*/
-// handle this separately to avoid accessing recursively the regs?
+// TODO: Handle this separately to avoid accessing the regs recursively
u8 sns_sa1_device::var_length_read(offs_t offset)
{
- // TODO: memory accessing cycle?
+ // TODO: memory access cycle
// handle 0xffea/0xffeb/0xffee/0xffef
if ((offset & 0xffffe0) == 0x00ffe0)
{
@@ -349,11 +343,9 @@ u8 sns_sa1_device::var_length_read(offs_t offset)
void sns_sa1_device::dma_transfer()
{
-// printf("DMA src %08x (%d), dst %08x (%d) cnt %d\n", m_src_addr, m_dma_ctrl & 3, m_dst_addr, m_dma_ctrl & 4, m_dma_cnt);
-
while (m_dma_cnt--)
{
- u8 data = 0; // open bus?
+ u8 data = 0; // TODO: open bus
const u32 dma_src = m_src_addr++;
const u32 dma_dst = m_dst_addr++;
@@ -363,7 +355,7 @@ void sns_sa1_device::dma_transfer()
if (((DCNT_SD()) == 1) && (DCNT_DD())) continue;
if (((DCNT_SD()) == 2) && (!(DCNT_DD()))) continue;
- int cycle = 1; // 1 cycle per memory accessing
+ int cycle = 1; // 1 cycle per memory access
switch (DCNT_SD())
{
case 0: // ROM
@@ -423,7 +415,7 @@ void sns_sa1_device::dma_cctype2_transfer()
const u32 ty = (BIT(m_cconv2_line, 0, 3) << 1);
const u32 dst_addr = (m_dst_addr & ~((1 << (7 - m_dma_cconv_bits)) - 1)) + tx + ty;
- // TODO: memory access/process cycle?
+ // TODO: memory access/process cycle
for (u8 bit = 0; bit < bpp; bit++)
{
u8 byte = 0;
@@ -462,7 +454,7 @@ u8 sns_sa1_device::host_r(offs_t offset)
u8 sns_sa1_device::read_regs(offs_t offset)
{
u8 value = 0xff; // unverified
- offset &= 0x1ff; // $2200 + offset gives the reg value to compare with docs
+ offset &= 0x1ff; // $2200 + offset gives the reg value to compare with docs
switch (offset)
{
@@ -474,11 +466,11 @@ u8 sns_sa1_device::read_regs(offs_t offset)
// H-Count Read Low
if (!machine().side_effects_disabled())
{
- //latch counters
+ // latch counters
m_hcr = m_hpos;
m_vcr = m_vpos;
}
- //then return h-count
+ // return h-count
value = (m_hcr >> 0) & 0xff;
break;
case 0x103:
@@ -494,27 +486,27 @@ u8 sns_sa1_device::read_regs(offs_t offset)
value = (m_vcr >> 8) & 0xff;
break;
case 0x106:
- // Math Result bits0-7
+ // Math Result bits 0-7
value = (u64)(m_math_res >> 0) & 0xff;
break;
case 0x107:
- // Math Result bits8-15
+ // Math Result bits 8-15
value = (u64)(m_math_res >> 8) & 0xff;
break;
case 0x108:
- // Math Result bits16-23
+ // Math Result bits 16-23
value = (u64)(m_math_res >> 16) & 0xff;
break;
case 0x109:
- // Math Result bits24-31
+ // Math Result bits 24-31
value = (u64)(m_math_res >> 24) & 0xff;
break;
case 0x10a:
- // Math Result bits32-39
+ // Math Result bits 32-39
value = (u64)(m_math_res >> 32) & 0xff;
break;
case 0x10b:
- // Math Overflow (above 40bit result)
+ // Math Overflow (above 40-bit result)
value = m_math_overflow;
break;
case 0x10c:
@@ -535,7 +527,7 @@ u8 sns_sa1_device::read_regs(offs_t offset)
{
if (m_drm)
{
- //auto-increment mode
+ // auto-increment mode
m_vbit += m_vlen;
m_vda += (m_vbit >> 3);
m_vbit &= 7;
@@ -560,20 +552,17 @@ void sns_sa1_device::host_w(offs_t offset, u8 data)
{
case 0x000:
// SA-1 control flags
-// printf("%02x to SA-1 control\n", data);
if (CCNT_SA1_CPU_RDYB() && BIT(data, 5)) // Pull up reset pin
m_sa1_reset_flag = true;
if ((BIT(data, 5, 2) != 0) && (BIT(m_sa1_ctrl, 5, 2) == 0))
{
-// printf("Engaging SA-1 reset\n");
m_sa1->set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
if (BIT(data, 5)) // Pull up reset pin
m_sa1_reset_flag = true;
}
else if ((BIT(data, 5, 2) == 0) && (BIT(m_sa1_ctrl, 5, 2) != 0))
{
-// printf("Releasing SA-1 reset\n");
m_sa1->set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
if (m_sa1_reset_flag && (!BIT(data, 5)))
{
@@ -594,13 +583,12 @@ void sns_sa1_device::host_w(offs_t offset, u8 data)
recalc_irqs();
break;
case 0x001:
- // SNES SIE 00h SNES CPU Int Enable (W)
+ // SNES CPU Int Enable
m_scpu_sie = data;
-// printf("S-CPU IE = %02x\n", data);
recalc_irqs();
break;
case 0x002:
- // SNES SIC 00h SNES CPU Int Clear (W)
+ // SNES CPU Int Clear
if (BIT(data, 7)) // ack IRQ from SA-1
m_scpu_flags &= ~SCPU_IRQ_SA1;
@@ -610,52 +598,52 @@ void sns_sa1_device::host_w(offs_t offset, u8 data)
recalc_irqs();
break;
case 0x003:
- // SNES CRV - SA-1 CPU Reset Vector Lsb (W)
+ // SA-1 CPU Reset Vector LSB
m_sa1_reset_vector &= 0xff00;
m_sa1_reset_vector |= data;
break;
case 0x004:
- // SNES CRV - SA-1 CPU Reset Vector Msb (W)
+ // SA-1 CPU Reset Vector MSB
m_sa1_reset_vector &= 0x00ff;
m_sa1_reset_vector |= (data<<8);
break;
case 0x005:
- // SNES CNV - SA-1 CPU NMI Vector Lsb (W)
+ // SA-1 CPU NMI Vector LSB
m_sa1_nmi_vector &= 0xff00;
m_sa1_nmi_vector |= data;
break;
case 0x006:
- // SNES CNV - SA-1 CPU NMI Vector Msb (W)
+ // SA-1 CPU NMI Vector MSB
m_sa1_nmi_vector &= 0x00ff;
m_sa1_nmi_vector |= (data<<8);
break;
case 0x007:
- // SNES CIV - SA-1 CPU IRQ Vector Lsb (W)
+ // SA-1 CPU IRQ Vector LSB
m_sa1_irq_vector &= 0xff00;
m_sa1_irq_vector |= data;
break;
case 0x008:
- // SNES CIV - SA-1 CPU IRQ Vector Msb (W)
+ // SA-1 CPU IRQ Vector MSB
m_sa1_irq_vector &= 0x00ff;
m_sa1_irq_vector |= (data<<8);
break;
case 0x020:
- // SNES CXB - Super MMC Bank C (W)
+ // Super MMC Bank C
m_bank_hi[0] = BIT(data, 7); // [00-1f][8000-ffff] is mirror of [c0-cf][0000-ffff] bank or first 1MB of ROM
m_bank_rom[0] = data & 0x07; // ROM 1MB bank for [c0-cf]
break;
case 0x021:
- // SNES DXB - Super MMC Bank D (W)
+ // Super MMC Bank D
m_bank_hi[1] = BIT(data, 7); // [20-3f][8000-ffff] is mirror of [d0-df][0000-ffff] bank or second 1MB of ROM
m_bank_rom[1] = data & 0x07; // ROM 1MB bank for [d0-df]
break;
case 0x022:
- // SNES EXB - Super MMC Bank E (W)
+ // Super MMC Bank E
m_bank_hi[2] = BIT(data, 7); // [80-9f][8000-ffff] is mirror of [e0-ef][0000-ffff] bank or third 1MB of ROM
m_bank_rom[2] = data & 0x07; // ROM 1MB bank for [e0-ef]
break;
case 0x023:
- // SNES FXB - Super MMC Bank F (W)
+ // Super MMC Bank F
m_bank_hi[3] = BIT(data, 7); // [a0-bf][8000-ffff] is mirror of [e0-ef][0000-ffff] bank or fourth 1MB of ROM
m_bank_rom[3] = data & 0x07; // ROM 1MB bank for [f0-ff]
break;
@@ -675,7 +663,7 @@ void sns_sa1_device::host_w(offs_t offset, u8 data)
// enable writing to IRAM from SNES (1 bit for each 0x100 chunk)
m_iram_write_snes = data;
break;
- case 0x031: // Both CDMA 00h Character Conversion DMA Parameters (W)
+ case 0x031: // Character Conversion DMA Parameters
case 0x032: // DMA Source Device Start Address Low
case 0x033: // DMA Source Device Start Address Mid
case 0x034: // DMA Source Device Start Address High
@@ -702,25 +690,21 @@ void sns_sa1_device::write_regs(offs_t offset, u8 data)
if (SCNT_SNESCPU_IRQ())
{
m_scpu_flags |= SCPU_IRQ_SA1;
-// printf("SA-1 cause S-CPU IRQ\n");
}
- // clear IRQ/NMI override flags in flags word
+ // acquire IRQ/NMI override flags from data
m_scpu_flags &= ~(SCPU_IRQV_ALT|SCPU_NMIV_ALT);
-
- // and set them
m_scpu_flags |= (data & (SCPU_IRQV_ALT|SCPU_NMIV_ALT));
recalc_irqs();
break;
case 0x00a:
- // SA-1 CIE 00h SA-1 CPU Int Enable (W)
+ // SA-1 CPU Int Enable
m_sa1_sie = data;
-// printf("SA-1 IE = %02x\n", data);
recalc_irqs();
break;
case 0x00b:
- // SA-1 CIC 00h SA-1 CPU Int Clear (W)
+ // SA-1 CPU Int Clear
if (BIT(data, 7))
m_sa1_flags &= ~SA1_IRQ_SCPU;
@@ -736,27 +720,27 @@ void sns_sa1_device::write_regs(offs_t offset, u8 data)
recalc_irqs();
break;
case 0x00c:
- // NMI Vector Low
+ // SA-1 NMI Vector Low
m_nmi_vector = (m_nmi_vector & 0xff00) | (data << 0);
break;
case 0x00d:
- // NMI Vector High
+ // SA-1 NMI Vector High
m_nmi_vector = (m_nmi_vector & 0x00ff) | (data << 8);
break;
case 0x00e:
- // IRQ Vector Low
+ // SA-1 IRQ Vector Low
m_irq_vector = (m_irq_vector & 0xff00) | (data << 0);
break;
case 0x00f:
- // IRQ Vector High
+ // SA-1 IRQ Vector High
m_irq_vector = (m_irq_vector & 0x00ff) | (data << 8);
break;
case 0x010:
- // SA-1 TMC 00h H/V Timer Control (W)
+ // H/V Timer Control
m_timer_ctrl = data;
break;
case 0x011:
- // SA-1 CTR - SA-1 CPU Timer Restart (W)
+ // CPU Timer Restart
m_hpos = m_vpos = 0;
m_sa1_timer->adjust(m_sa1->clocks_to_attotime(2), 0, m_sa1->clocks_to_attotime(2));
break;
@@ -778,8 +762,8 @@ void sns_sa1_device::write_regs(offs_t offset, u8 data)
break;
case 0x025:
// BWRAM bank & type from SA-1 side
- m_bwram_sa1_source = BIT(data, 7); // 0 = normal, 1 = bitmap?
- m_bwram_sa1 = data & 0x7f; // up to 128x8K banks here?
+ m_bwram_sa1_source = BIT(data, 7); // 0 = normal, 1 = bitmap
+ m_bwram_sa1 = data & 0x7f; // up to 128x8K banks here
break;
case 0x027:
// enable writing to BWRAM from SA-1
@@ -790,11 +774,10 @@ void sns_sa1_device::write_regs(offs_t offset, u8 data)
m_iram_write_sa1 = data;
break;
case 0x030:
- // SA-1 DCNT 00h DMA Control (W)
-// printf("%02x to SA-1 DMA control\n", data);
+ // DMA Control (W)
m_dma_ctrl = data;
break;
- case 0x031: // Both CDMA 00h Character Conversion DMA Parameters (W)
+ case 0x031: // Character Conversion DMA Parameters (W)
case 0x032: // DMA Source Device Start Address Low
case 0x033: // DMA Source Device Start Address Mid
case 0x034: // DMA Source Device Start Address High
@@ -804,18 +787,18 @@ void sns_sa1_device::write_regs(offs_t offset, u8 data)
shared_regs_w(offset, data);
break;
case 0x038:
- // SA-1 DTC - DMA Terminal Counter Lsb (W)
+ // DMA Terminal Counter LSB
m_dma_cnt &= 0xff00;
m_dma_cnt |= data;
break;
case 0x039:
- // SA-1 DTC - DMA Terminal Counter Msb (W)
+ // DMA Terminal Counter MSB
m_dma_cnt &= 0x00ff;
m_dma_cnt |= (data<<8);
break;
case 0x03f:
// Format for BWRAM when mapped to bitmap
- m_bwram_sa1_format = BIT(data, 7); // 0 = 4bit, 1 = 2bit
+ m_bwram_sa1_format = BIT(data, 7); // 0 = 4-bit, 1 = 2-bit
break;
case 0x040:
case 0x041:
@@ -839,7 +822,6 @@ void sns_sa1_device::write_regs(offs_t offset, u8 data)
{
if (DCNT_CDEN() && (!(DCNT_CDSEL()))) // CC DMA Type 2
{
-// printf("SA-1: CC DMA type 2\n");
dma_cctype2_transfer();
}
}
@@ -865,14 +847,14 @@ void sns_sa1_device::write_regs(offs_t offset, u8 data)
case 0x054:
// Math B High
m_math_b = (data << 8) | (m_math_b & 0x00ff);
- // After Math B has been written, we do math
+ // After Math B has been written, perform the operation
switch (m_math_ctlr)
{
- case 0: //signed multiplication (5 cycle required)
+ case 0: // signed multiplication (5 cycles required)
m_math_res = (s16)m_math_a * (s16)m_math_b;
m_math_b = 0;
break;
- case 1: //unsigned division (5 cycle required)
+ case 1: // unsigned division (5 cycles required)
if (m_math_b == 0)
m_math_res = 0;
else
@@ -882,7 +864,7 @@ void sns_sa1_device::write_regs(offs_t offset, u8 data)
m_math_res = (u64)((remainder << 16) | quotient);
}
break;
- case 2: //sigma (accumulative multiplication) (6 cycle required)
+ case 2: // sigma (accumulative multiplication) (6 cycles required)
case 3:
u64 acum = (s16)m_math_a * (s16)m_math_b;
u64 mask = 0xffffffffffU;
@@ -902,7 +884,7 @@ void sns_sa1_device::write_regs(offs_t offset, u8 data)
if (!m_drm)
{
- //fixed mode
+ // fixed mode
m_vbit += m_vlen;
m_vda += (m_vbit >> 3);
m_vbit &= 7;
@@ -934,7 +916,7 @@ void sns_sa1_device::shared_regs_w(offs_t offset, u8 data)
switch (offset)
{
case 0x031:
- // Both CDMA 00h Character Conversion DMA Parameters (W)
+ // Character Conversion DMA Parameters (W)
m_dma_ccparam = data;
m_dma_cconv_size = CDMA_SIZE();
m_dma_cconv_bits = CDMA_CB();
@@ -976,7 +958,6 @@ void sns_sa1_device::shared_regs_w(offs_t offset, u8 data)
{
if ((!(DCNT_CDEN())) && DCNT_DD()) // Normal DMA to BWRAM
{
-// printf("SA-1: normal DMA to BWRAM\n");
dma_transfer();
}
}
@@ -1013,7 +994,7 @@ u8 sns_sa1_device::read_cconv1_dma(offs_t offset)
const u32 tx = tile & ((1 << m_dma_cconv_size) - 1);
u32 bwram_src = m_src_addr + ty * 8 * tile_stride + tx * bpp;
- // TODO: memory access/process cycle?
+ // TODO: memory access/process cycle
for (u32 y = 0; y < 8; y++)
{
u64 raw_pixels = 0;
@@ -1062,14 +1043,14 @@ u8 sns_sa1_device::read_bwram(offs_t offset, bool bitmap)
if (m_bwram_sa1_format)
{
- // 2bits mode
+ // 2-bit mode
shift = ((offset & 3) << 1);
mask = 0x03;
offset >>= 2;
}
else
{
- // 4bits mode
+ // 4-bit mode
shift = ((offset & 1) << 2);
mask = 0x0f;
offset >>= 1;
@@ -1096,14 +1077,14 @@ void sns_sa1_device::write_bwram(offs_t offset, u8 data, bool bitmap)
if (m_bwram_sa1_format)
{
- // 2bits mode
+ // 2-bit mode
data = (data & 0x03) << ((offset & 3) << 1);
mask = 0x03 << ((offset & 3) << 1);
offset >>= 2;
}
else
{
- // 4bits mode
+ // 4-bit mode
data = (data & 0x0f) << ((offset & 1) << 2);
mask = 0x0f << ((offset & 1) << 2);
offset >>= 1;
@@ -1131,9 +1112,9 @@ u8 sns_sa1_device::rom_r(offs_t offset)
const u8 slot = (BIT(offset, 23) << 1) | BIT(offset, 21);
u8 bank; // 256 banks (64 Mbit limited)
- if (!m_bank_hi[slot]) // when HiROM mapping is disabled, we always access each 1MB here
+ if (!m_bank_hi[slot]) // when HiROM mapping is disabled, we always access each 1MB here
bank = BIT(offset, 16, 5) | (slot << 5);
- else // when HiROM mapping is enabled, we mirror [(cx,dx,ex,fx)][0000-ffff] bank
+ else // when HiROM mapping is enabled, we mirror [(cx,dx,ex,fx)][0000-ffff] bank
bank = BIT(offset, 16, 5) | (m_bank_rom[slot] << 5);
ret = m_rom[(rom_bank_map[bank] << 15) | (offset & 0x7fff)];
@@ -1174,13 +1155,13 @@ u8 sns_sa1_device::chip_read(offs_t offset)
u16 address = offset & 0xffff;
if (offset < 0x400000 && address >= 0x2200 && address < 0x2400)
- return host_r(address & 0x1ff); // SA-1 Regs
+ return host_r(address & 0x1ff); // SA-1 Regs
if (offset < 0x400000 && address >= 0x3000 && address < 0x3800)
- return read_iram(address & 0x7ff); // Internal SA-1 RAM (2K)
+ return read_iram(address & 0x7ff);
if (offset < 0x400000 && address >= 0x6000 && address < 0x8000)
- return read_bwram<false>((m_bwram_snes * 0x2000) + (offset & 0x1fff)); // SA-1 BWRAM
+ return read_bwram<false>((m_bwram_snes * 0x2000) + (offset & 0x1fff));
if (offset >= 0x400000 && offset < 0x500000)
return read_bwram<false>(offset & 0xfffff); // SA-1 BWRAM again (but not called for the [c0-cf] range, because it's not mirrored)
@@ -1194,16 +1175,16 @@ void sns_sa1_device::chip_write(offs_t offset, u8 data)
u16 address = offset & 0xffff;
if (offset < 0x400000 && address >= 0x2200 && address < 0x2400)
- host_w(address & 0x1ff, data); // SA-1 Regs
+ host_w(address & 0x1ff, data); // SA-1 Regs
if (offset < 0x400000 && address >= 0x3000 && address < 0x3800)
{
if (BIT(m_iram_write_snes, BIT(address, 8, 3)))
- write_iram(address & 0x7ff, data); // Internal SA-1 RAM (2K)
+ write_iram(address & 0x7ff, data);
}
if (offset < 0x400000 && address >= 0x6000 && address < 0x8000)
- write_bwram((m_bwram_snes * 0x2000) + (offset & 0x1fff), data); // SA-1 BWRAM
+ write_bwram((m_bwram_snes * 0x2000) + (offset & 0x1fff), data);
if (offset >= 0x400000 && offset < 0x500000)
write_bwram(offset & 0xfffff, data); // SA-1 BWRAM again (but not called for the [c0-cf] range, because it's not mirrored)
@@ -1220,7 +1201,7 @@ void sns_sa1_device::chip_write(offs_t offset, u8 data)
u8 sns_sa1_device::sa1_rom_r(offs_t offset)
{
- if (bus_conflict_rom()) // bus conflict?
+ if (bus_conflict_rom())
m_sa1->adjust_icount(-1); // wait 1 cycle
return rom_r(offset);
@@ -1228,24 +1209,24 @@ u8 sns_sa1_device::sa1_rom_r(offs_t offset)
u8 sns_sa1_device::sa1_iram_r(offs_t offset)
{
- if (bus_conflict_iram()) // bus conflict?
- m_sa1->adjust_icount(-2); // wait 2 cycle
+ if (bus_conflict_iram())
+ m_sa1->adjust_icount(-2); // wait 2 cycles
return read_iram(offset & 0x7ff);
}
void sns_sa1_device::sa1_iram_w(offs_t offset, u8 data)
{
- if (bus_conflict_iram()) // bus conflict?
- m_sa1->adjust_icount(-2); // wait 2 cycle
+ if (bus_conflict_iram())
+ m_sa1->adjust_icount(-2); // wait 2 cycles
if (BIT(m_iram_write_sa1, BIT(offset, 8, 3)))
- write_iram(offset & 0x7ff, data); // Internal SA-1 RAM (2K)
+ write_iram(offset & 0x7ff, data);
}
u8 sns_sa1_device::sa1_bwram_r(offs_t offset, bool bitmap)
{
- if (bus_conflict_bwram()) // bus conflict?
- m_sa1->adjust_icount(-3); // wait 3 cycle
+ if (bus_conflict_bwram())
+ m_sa1->adjust_icount(-3); // wait 3 cycles
else
m_sa1->adjust_icount(-1); // wait 1 cycle
@@ -1254,8 +1235,8 @@ u8 sns_sa1_device::sa1_bwram_r(offs_t offset, bool bitmap)
void sns_sa1_device::sa1_bwram_w(offs_t offset, u8 data, bool bitmap)
{
- if (bus_conflict_bwram()) // bus conflict?
- m_sa1->adjust_icount(-3); // wait 3 cycle
+ if (bus_conflict_bwram())
+ m_sa1->adjust_icount(-3); // wait 3 cycles
else
m_sa1->adjust_icount(-1); // wait 1 cycle
@@ -1272,21 +1253,21 @@ u8 sns_sa1_device::sa1_hi_r(offs_t offset)
if (address < 0x6000)
{
if (address < 0x0800)
- return sa1_iram_r(offset); // Internal SA-1 RAM (2K)
+ return sa1_iram_r(offset);
else if (address >= 0x2200 && address < 0x2400)
- return read_regs(offset & 0x1ff); // SA-1 Regs
+ return read_regs(offset & 0x1ff);
else if (address >= 0x3000 && address < 0x3800)
- return sa1_iram_r(offset); // Internal SA-1 RAM (2K)
+ return sa1_iram_r(offset);
}
else if (address < 0x8000)
- return sa1_bwram_r((m_bwram_sa1 * 0x2000) + (offset & 0x1fff), m_bwram_sa1_source); // SA-1 BWRAM
+ return sa1_bwram_r((m_bwram_sa1 * 0x2000) + (offset & 0x1fff), m_bwram_sa1_source);
else
- return sa1_rom_r(offset | 0x800000); // ROM
+ return sa1_rom_r(offset | 0x800000);
- return 0xff; // maybe open bus? same as the main system one or diff? (currently not accessible from carts anyway...)
+ return 0xff; // TOOD: Maybe open bus. Check if same as the main system or different (currently not accessible from carts anyway).
}
else
- return sa1_rom_r(offset | 0xc00000); // ROM
+ return sa1_rom_r(offset | 0xc00000);
}
u8 sns_sa1_device::sa1_lo_r(offs_t offset)
@@ -1298,17 +1279,17 @@ u8 sns_sa1_device::sa1_lo_r(offs_t offset)
if (address < 0x6000)
{
if (address < 0x0800)
- return sa1_iram_r(offset); // Internal SA-1 RAM (2K)
+ return sa1_iram_r(offset);
else if (address >= 0x2200 && address < 0x2400)
- return read_regs(offset & 0x1ff); // SA-1 Regs
+ return read_regs(offset & 0x1ff);
else if (address >= 0x3000 && address < 0x3800)
- return sa1_iram_r(offset); // Internal SA-1 RAM (2K)
+ return sa1_iram_r(offset);
}
else if (address < 0x8000)
- return sa1_bwram_r((m_bwram_sa1 * 0x2000) + (offset & 0x1fff), m_bwram_sa1_source); // SA-1 BWRAM
+ return sa1_bwram_r((m_bwram_sa1 * 0x2000) + (offset & 0x1fff), m_bwram_sa1_source); // SA-1 BWRAM
else
{
- if (bus_conflict_rom()) // bus conflict?
+ if (bus_conflict_rom())
m_sa1->adjust_icount(-1); // wait 1 cycle
if (offset == 0xffee)
@@ -1336,17 +1317,17 @@ u8 sns_sa1_device::sa1_lo_r(offs_t offset)
return m_sa1_reset_vector >> 8;
}
else
- return rom_r(offset); // ROM
+ return rom_r(offset);
}
- return 0xff; // maybe open bus? same as the main system one or diff? (currently not accessible from carts anyway...)
+ return 0xff; // TOOD: Maybe open bus. Check if same as the main system or different (currently not accessible from carts anyway).
}
else if (offset < 0x500000)
- return sa1_bwram_r(offset & 0xfffff, false); // SA-1 BWRAM (not mirrored above!)
+ return sa1_bwram_r(offset & 0xfffff, false); // SA-1 BWRAM (not mirrored above)
else if (offset >= 0x600000 && offset < 0x700000)
return sa1_bwram_r(offset & 0xfffff, true); // SA-1 BWRAM Bitmap mode
else
- return 0xff; // nothing should be mapped here, so maybe open bus?
+ return 0xff; // nothing should be mapped here, so maybe open bus
}
void sns_sa1_device::sa1_hi_w(offs_t offset, u8 data)
@@ -1357,23 +1338,23 @@ void sns_sa1_device::sa1_hi_w(offs_t offset, u8 data)
if (address < 0x6000)
{
if (address < 0x0800)
- sa1_iram_w(offset, data); // Internal SA-1 RAM (2K)
+ sa1_iram_w(offset, data);
else if (address >= 0x2200 && address < 0x2400)
- write_regs(offset & 0x1ff, data); // SA-1 Regs
+ write_regs(offset & 0x1ff, data);
else if (address >= 0x3000 && address < 0x3800)
- sa1_iram_w(offset, data); // Internal SA-1 RAM (2K)
+ sa1_iram_w(offset, data);
}
else if (address < 0x8000)
- sa1_bwram_w((m_bwram_sa1 * 0x2000) + (offset & 0x1fff), data, m_bwram_sa1_source); // SA-1 BWRAM
+ sa1_bwram_w((m_bwram_sa1 * 0x2000) + (offset & 0x1fff), data, m_bwram_sa1_source);
}
}
void sns_sa1_device::sa1_lo_w(offs_t offset, u8 data)
{
if (offset >= 0x400000 && offset < 0x500000)
- sa1_bwram_w(offset & 0xfffff, data, false); // SA-1 BWRAM (not mirrored above!)
+ sa1_bwram_w(offset & 0xfffff, data, false); // SA-1 BWRAM (not mirrored above)
else if (offset >= 0x600000 && offset < 0x700000)
- sa1_bwram_w(offset & 0xfffff, data, true); // SA-1 BWRAM Bitmap mode
+ sa1_bwram_w(offset & 0xfffff, data, true); // SA-1 BWRAM Bitmap mode
else
sa1_hi_w(offset, data);
}
diff --git a/src/devices/bus/snes/sa1.h b/src/devices/bus/snes/sa1.h
index fcc9bbd9dc1..8b68820a826 100644
--- a/src/devices/bus/snes/sa1.h
+++ b/src/devices/bus/snes/sa1.h
@@ -20,14 +20,11 @@ public:
sns_sa1_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
protected:
- static const device_timer_id TIMER_SA1 = 0; // SA-1 internal timer (18 bit linear timer or HV timer)
-
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_add_mconfig(machine_config &config) override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// reading and writing
virtual u8 read_l(offs_t offset) override;
@@ -39,6 +36,8 @@ protected:
virtual u8 chip_read(offs_t offset) override;
virtual void chip_write(offs_t offset, u8 data) override;
+ TIMER_CALLBACK_MEMBER(timer_tick);
+
private:
u8 var_length_read(offs_t offset);
void dma_transfer();
diff --git a/src/devices/bus/snes_ctrl/bcbattle.cpp b/src/devices/bus/snes_ctrl/bcbattle.cpp
index 3b8f6e8542d..c5d78bc04b3 100644
--- a/src/devices/bus/snes_ctrl/bcbattle.cpp
+++ b/src/devices/bus/snes_ctrl/bcbattle.cpp
@@ -26,47 +26,40 @@ void snes_bcbattle_device::device_add_mconfig(machine_config &config)
}
-//-------------------------------------------------
-// device_timer - handler timer events
-//-------------------------------------------------
-
-// This part is the hacky replacement for the real Barcode unit [shared with NES implementation]:
+// This part is a hacky replacement for the real Barcode unit [shared with NES implementation]:
// code periodically checks whether a new code has been scanned and it moves it to the
// m_current_barcode array
-void snes_bcbattle_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(snes_bcbattle_device::scan_tick)
{
- if (id == TIMER_BATTLER)
+ int old = m_new_code;
+ m_new_code = m_reader->get_pending_code();
+ // has something new been scanned?
+ if (old < m_new_code)
{
- int old = m_new_code;
- m_new_code = m_reader->get_pending_code();
- // has something new been scanned?
- if (old < m_new_code)
+ if (m_reader->get_byte_length() == 13)
{
- if (m_reader->get_byte_length() == 13)
- {
- for (int i = 0; i < 13; i++)
- m_current_barcode[i] = m_reader->read_code() + '0';
- }
- else if (m_reader->get_byte_length() == 8)
- {
- for (int i = 0; i < 5; i++)
- m_current_barcode[i] = 0x20;
- for (int i = 5; i < 13; i++)
- m_current_barcode[i] = m_reader->read_code() + '0';
- }
- // read one more, to reset the internal byte counter
- m_reader->read_code();
-
- // the string "SUNSOFT" is accepted as well by Barcode World
- m_current_barcode[13] = 'E';
- m_current_barcode[14] = 'P';
- m_current_barcode[15] = 'O';
- m_current_barcode[16] = 'C';
- m_current_barcode[17] = 'H';
- m_current_barcode[18] = 0x0d;
- m_current_barcode[19] = 0x0a;
- m_pending_code = 1;
+ for (int i = 0; i < 13; i++)
+ m_current_barcode[i] = m_reader->read_code() + '0';
+ }
+ else if (m_reader->get_byte_length() == 8)
+ {
+ for (int i = 0; i < 5; i++)
+ m_current_barcode[i] = 0x20;
+ for (int i = 5; i < 13; i++)
+ m_current_barcode[i] = m_reader->read_code() + '0';
}
+ // read one more, to reset the internal byte counter
+ m_reader->read_code();
+
+ // the string "SUNSOFT" is accepted as well by Barcode World
+ m_current_barcode[13] = 'E';
+ m_current_barcode[14] = 'P';
+ m_current_barcode[15] = 'O';
+ m_current_barcode[16] = 'C';
+ m_current_barcode[17] = 'H';
+ m_current_barcode[18] = 0x0d;
+ m_current_barcode[19] = 0x0a;
+ m_pending_code = 1;
}
}
@@ -98,7 +91,7 @@ void snes_bcbattle_device::device_start()
// lacking emulation of the standalone Barcode Battler, we refresh periodically the input from the reader
// proper emulation would have the standalone unit acknowledging that a new barcode has been scanned
// and sending the proper serial bits, instead of our read_current_bit() function!
- battler_timer = timer_alloc(TIMER_BATTLER);
+ battler_timer = timer_alloc(FUNC(snes_bcbattle_device::scan_tick), this);
battler_timer->adjust(attotime::zero, 0, machine().device<cpu_device>("maincpu")->cycles_to_attotime(1000));
save_item(NAME(m_current_barcode));
diff --git a/src/devices/bus/snes_ctrl/bcbattle.h b/src/devices/bus/snes_ctrl/bcbattle.h
index 13c53dd9b38..a7073ac4ba0 100644
--- a/src/devices/bus/snes_ctrl/bcbattle.h
+++ b/src/devices/bus/snes_ctrl/bcbattle.h
@@ -32,7 +32,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_add_mconfig(machine_config &config) override;
@@ -42,9 +41,9 @@ protected:
int read_current_bit();
-private:
- static constexpr device_timer_id TIMER_BATTLER = 1;
+ TIMER_CALLBACK_MEMBER(scan_tick);
+private:
required_device<barcode_reader_device> m_reader;
uint8_t m_current_barcode[20];
int m_pending_code, m_new_code, m_transmitting, m_cur_bit, m_cur_byte;
diff --git a/src/devices/bus/snes_ctrl/miracle.cpp b/src/devices/bus/snes_ctrl/miracle.cpp
index ec84ef3dc3c..f20647a10b4 100644
--- a/src/devices/bus/snes_ctrl/miracle.cpp
+++ b/src/devices/bus/snes_ctrl/miracle.cpp
@@ -32,15 +32,12 @@ void snes_miracle_device::device_add_mconfig(machine_config &config)
//-------------------------------------------------
-// device_timer - handler timer events
+// strobe_tick - increment strobe counter
//-------------------------------------------------
-void snes_miracle_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(snes_miracle_device::strobe_tick)
{
- if (id == TIMER_STROBE_ON)
- {
- m_strobe_clock++;
- }
+ m_strobe_clock++;
}
//**************************************************************************
@@ -70,7 +67,7 @@ snes_miracle_device::snes_miracle_device(const machine_config &mconfig, const ch
void snes_miracle_device::device_start()
{
- strobe_timer = timer_alloc(TIMER_STROBE_ON);
+ strobe_timer = timer_alloc(FUNC(snes_miracle_device::strobe_tick), this);
strobe_timer->adjust(attotime::never);
save_item(NAME(m_strobe_on));
save_item(NAME(m_sent_bits));
diff --git a/src/devices/bus/snes_ctrl/miracle.h b/src/devices/bus/snes_ctrl/miracle.h
index 53306d36496..b2bf08d2a49 100644
--- a/src/devices/bus/snes_ctrl/miracle.h
+++ b/src/devices/bus/snes_ctrl/miracle.h
@@ -31,15 +31,12 @@ public:
snes_miracle_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected:
- static constexpr device_timer_id TIMER_STROBE_ON = 0;
-
static constexpr int XMIT_RING_SIZE = 64;
static constexpr int RECV_RING_SIZE = 64;
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_add_mconfig(machine_config &config) override;
@@ -54,6 +51,8 @@ protected:
void xmit_char(uint8_t data);
+ TIMER_CALLBACK_MEMBER(strobe_tick);
+
required_device<midi_port_device> m_midiin, m_midiout;
emu_timer *strobe_timer;
diff --git a/src/devices/bus/spc1000/fdd.cpp b/src/devices/bus/spc1000/fdd.cpp
index 36c4c90b958..fe668127328 100644
--- a/src/devices/bus/spc1000/fdd.cpp
+++ b/src/devices/bus/spc1000/fdd.cpp
@@ -156,7 +156,7 @@ spc1000_fdd_exp_device::spc1000_fdd_exp_device(const machine_config &mconfig, co
void spc1000_fdd_exp_device::device_start()
{
- m_timer_tc = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(spc1000_fdd_exp_device::tc_off), this));
+ m_timer_tc = timer_alloc(FUNC(spc1000_fdd_exp_device::tc_off), this);
}
//-------------------------------------------------
diff --git a/src/devices/bus/spectrum/mgt.cpp b/src/devices/bus/spectrum/mgt.cpp
index e8f04df4aa0..581a748dcea 100644
--- a/src/devices/bus/spectrum/mgt.cpp
+++ b/src/devices/bus/spectrum/mgt.cpp
@@ -378,6 +378,8 @@ void spectrum_disciple_device::device_start()
save_item(NAME(m_map));
save_item(NAME(m_control));
save_item(NAME(m_reset_delay));
+
+ m_reset_timer = timer_alloc(FUNC(spectrum_disciple_device::reset_tick), this);
}
//-------------------------------------------------
@@ -394,7 +396,7 @@ void spectrum_disciple_device::device_reset()
m_romcs = 0;
m_map = false;
m_reset_delay = true;
- timer_set(attotime::from_usec(10), TIMER_RESET); // delay time is a guess
+ m_reset_timer->adjust(attotime::from_usec(10)); // delay time is a guess
}
//**************************************************************************
@@ -716,14 +718,7 @@ void spectrum_disciple_device::mreq_w(offs_t offset, uint8_t data)
m_exp->mreq_w(offset, data);
}
-void spectrum_disciple_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(spectrum_disciple_device::reset_tick)
{
- switch (id)
- {
- case TIMER_RESET:
- m_reset_delay = false;
- break;
- default:
- throw emu_fatalerror("Unknown id in spectrum_disciple_device::device_timer");
- }
+ m_reset_delay = false;
}
diff --git a/src/devices/bus/spectrum/mgt.h b/src/devices/bus/spectrum/mgt.h
index 628477c1f8a..35d168b10ae 100644
--- a/src/devices/bus/spectrum/mgt.h
+++ b/src/devices/bus/spectrum/mgt.h
@@ -74,15 +74,9 @@ public:
DECLARE_INPUT_CHANGED_MEMBER(inhibit_button) { if (!newval) m_romcs = 0; }
protected:
- enum
- {
- TIMER_RESET
- };
-
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// optional information overrides
virtual void device_add_mconfig(machine_config &config) override;
@@ -96,6 +90,8 @@ protected:
virtual void iorq_w(offs_t offset, uint8_t data) override;
virtual DECLARE_READ_LINE_MEMBER(romcs) override;
+ TIMER_CALLBACK_MEMBER(reset_tick);
+
private:
required_device<spectrum_expansion_slot_device> m_exp;
required_ioport m_joy1;
@@ -105,6 +101,7 @@ private:
bool m_map;
u8 m_control;
bool m_reset_delay;
+ emu_timer *m_reset_timer;
};
diff --git a/src/devices/bus/ss50/dc5.cpp b/src/devices/bus/ss50/dc5.cpp
index 764b6ada245..dd58758722a 100644
--- a/src/devices/bus/ss50/dc5.cpp
+++ b/src/devices/bus/ss50/dc5.cpp
@@ -292,7 +292,7 @@ void ss50_dc5_device::device_start()
m_fdc_status = 0;
m_control_register = 0;
m_fdc_side = 0;
- m_floppy_motor_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ss50_dc5_device::floppy_motor_callback),this));
+ m_floppy_motor_timer = timer_alloc(FUNC(ss50_dc5_device::floppy_motor_callback), this);
m_motor_timer_out = 0;
m_fdc->set_force_ready(0);
m_fdc_prog_clock_div = 12;
diff --git a/src/devices/bus/ss50/mpt.cpp b/src/devices/bus/ss50/mpt.cpp
index 28b8b711d50..f9078aee4ac 100644
--- a/src/devices/bus/ss50/mpt.cpp
+++ b/src/devices/bus/ss50/mpt.cpp
@@ -89,7 +89,7 @@ void ss50_mpt_device::device_add_mconfig(machine_config &config)
void ss50_mpt_device::device_start()
{
- m_mpt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ss50_mpt_device::mpt_timer_callback),this));
+ m_mpt_timer = timer_alloc(FUNC(ss50_mpt_device::mpt_timer_callback), this);
m_mpt_timer_state = 0;
save_item(NAME(m_mpt_timer_state));
diff --git a/src/devices/bus/sunkbd/hlekbd.cpp b/src/devices/bus/sunkbd/hlekbd.cpp
index 94ff16a5fce..db798a716fb 100644
--- a/src/devices/bus/sunkbd/hlekbd.cpp
+++ b/src/devices/bus/sunkbd/hlekbd.cpp
@@ -998,7 +998,7 @@ void hle_device_base::device_add_mconfig(machine_config &config)
void hle_device_base::device_start()
{
m_leds.resolve();
- m_click_timer = timer_alloc(CLICK_TIMER_ID);
+ m_click_timer = timer_alloc(FUNC(hle_device_base::click_off), this);
save_item(NAME(m_make_count));
save_item(NAME(m_rx_state));
@@ -1054,22 +1054,13 @@ void hle_device_base::device_reset()
/*--------------------------------------------------
- hle_device_base::device_timer
- handle timed events
+ click_off - turn the clicker off
--------------------------------------------------*/
-void hle_device_base::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(hle_device_base::click_off)
{
- switch (id)
- {
- case CLICK_TIMER_ID:
- m_beeper_state &= ~uint8_t(BEEPER_CLICK);
- m_beeper->set_state(m_beeper_state ? 1 : 0);
- break;
-
- default:
- break;
- }
+ m_beeper_state &= ~uint8_t(BEEPER_CLICK);
+ m_beeper->set_state(m_beeper_state ? 1 : 0);
}
diff --git a/src/devices/bus/sunkbd/hlekbd.h b/src/devices/bus/sunkbd/hlekbd.h
index b57ebec9ae5..3ed680b24c6 100644
--- a/src/devices/bus/sunkbd/hlekbd.h
+++ b/src/devices/bus/sunkbd/hlekbd.h
@@ -38,7 +38,6 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_buffered_serial_interface overrides
virtual void tra_callback() override;
@@ -51,6 +50,8 @@ protected:
// customised transmit_byte method
void transmit_byte(uint8_t byte);
+ TIMER_CALLBACK_MEMBER(click_off);
+
required_ioport m_dips;
private:
diff --git a/src/devices/bus/thomson/cd90_015.cpp b/src/devices/bus/thomson/cd90_015.cpp
index 976fb6a8884..6f9b2822647 100644
--- a/src/devices/bus/thomson/cd90_015.cpp
+++ b/src/devices/bus/thomson/cd90_015.cpp
@@ -61,15 +61,15 @@ void cd90_015_device::device_add_mconfig(machine_config &config)
FLOPPY_CONNECTOR(config, m_floppy[3], floppy_drives, nullptr, floppy_formats).enable_sound(true);
}
-void cd90_015_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(cd90_015_device::motor_tick)
{
- m_floppy[id]->get_device()->mon_w(1);
+ m_floppy[param]->get_device()->mon_w(1);
}
void cd90_015_device::device_start()
{
for(int i=0; i != 4; i++)
- m_motor_timer[i] = timer_alloc(i);
+ m_motor_timer[i] = timer_alloc(FUNC(cd90_015_device::motor_tick), this);
save_item(NAME(m_select));
}
@@ -101,7 +101,7 @@ void cd90_015_device::select_w(u8 data)
if(started & (1 << i)) {
if(m_floppy[i]->get_device()) {
m_floppy[i]->get_device()->mon_w(0);
- m_motor_timer[i]->adjust(attotime::from_seconds(5));
+ m_motor_timer[i]->adjust(attotime::from_seconds(5), i);
}
}
diff --git a/src/devices/bus/thomson/cd90_015.h b/src/devices/bus/thomson/cd90_015.h
index b8e1ff17a83..b2a4069e8cc 100644
--- a/src/devices/bus/thomson/cd90_015.h
+++ b/src/devices/bus/thomson/cd90_015.h
@@ -26,7 +26,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(motor_tick);
private:
required_device<mc6843_device> m_fdc;
diff --git a/src/devices/bus/thomson/cd90_351.cpp b/src/devices/bus/thomson/cd90_351.cpp
index c43880dbc70..44962c00115 100644
--- a/src/devices/bus/thomson/cd90_351.cpp
+++ b/src/devices/bus/thomson/cd90_351.cpp
@@ -78,7 +78,7 @@ void cd90_351_device::device_add_mconfig(machine_config &config)
void cd90_351_device::device_start()
{
m_rom_bank->configure_entries(0, 4, m_rom->base(), 0x800);
- m_timer_motoroff = timer_alloc(ID_MOTOROFF);
+ m_timer_motoroff = timer_alloc(FUNC(cd90_351_device::motor_off), this);
save_item(NAME(m_cmd0));
save_item(NAME(m_cmd1));
@@ -122,15 +122,11 @@ void cd90_351_device::device_reset()
m_cur_floppy = nullptr;
}
-void cd90_351_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(cd90_351_device::motor_off)
{
- switch(id) {
- case ID_MOTOROFF:
- logerror("motor off\n");
- if(m_cur_floppy)
- m_cur_floppy->mon_w(1);
- break;
- }
+ logerror("motor off\n");
+ if(m_cur_floppy)
+ m_cur_floppy->mon_w(1);
}
void cd90_351_device::device_post_load()
diff --git a/src/devices/bus/thomson/cd90_351.h b/src/devices/bus/thomson/cd90_351.h
index 78d0bda9033..6609eddf7a8 100644
--- a/src/devices/bus/thomson/cd90_351.h
+++ b/src/devices/bus/thomson/cd90_351.h
@@ -26,14 +26,11 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_post_load() override;
-private:
- enum {
- ID_MOTOROFF = 0,
- };
+ TIMER_CALLBACK_MEMBER(motor_off);
+private:
enum {
S0_BYTE = 0x80,
S0_END = 0x10,
diff --git a/src/devices/bus/thomson/nanoreseau.cpp b/src/devices/bus/thomson/nanoreseau.cpp
index 579400aab01..418d9ce59e5 100644
--- a/src/devices/bus/thomson/nanoreseau.cpp
+++ b/src/devices/bus/thomson/nanoreseau.cpp
@@ -86,7 +86,7 @@ void nanoreseau_device::rom_map(address_map &map)
void nanoreseau_device::io_map(address_map &map)
{
map(0, 3).rw(m_mc6854, FUNC(mc6854_device::read), FUNC(mc6854_device::write));
- if(!m_no_id)
+ if (!m_no_id)
map(8, 8).r(FUNC(nanoreseau_device::id_r));
}
@@ -108,7 +108,7 @@ void nanoreseau_device::device_add_mconfig(machine_config &config)
void nanoreseau_device::device_start()
{
- m_timer = timer_alloc(0);
+ m_timer = timer_alloc(FUNC(nanoreseau_device::answer_tick), this);
save_item(NAME(m_answer_step));
}
@@ -127,14 +127,13 @@ ioport_constructor nanoreseau_device::device_input_ports() const
/*********************** Network ************************/
/* The network extension is built as an external floppy controller.
- It uses the same ROM and I/O space, and so, it is natural to have the
- toplevel network emulation here!
-*/
+ It uses the same ROM and I/O space, so it is natural to have the
+ top-level network emulation here.
-/* NOTE: This is work in progress!
- For the moment, only hand-checks works: the TO7 can take the line, then
- perform a DKBOOT request. We do not have the server emulated yet, so,
- no way to answer the request.
+ NOTE: This is work in progress.
+ For the moment, only hand-checks work: the TO7 can take the line, then
+ perform a DKBOOT request. We do not have the server emulated yet, so
+ there is no way to answer the request.
*/
/* consigne DKBOOT
@@ -166,11 +165,11 @@ ioport_constructor nanoreseau_device::device_input_ports() const
*/
-void nanoreseau_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nanoreseau_device::answer_tick)
{
- m_answer_step ++;
+ m_answer_step++;
m_mc6854->set_cts(m_answer_step & 1);
- if(m_answer_step < 4)
+ if (m_answer_step < 4)
m_timer->adjust(attotime::from_usec(100));
}
@@ -181,7 +180,7 @@ void nanoreseau_device::got_frame(uint8_t *data, int length)
frame += util::string_format(" %02x", data[i]);
logerror("%s\n", frame);
- if(data[1] == 0xff) {
+ if (data[1] == 0xff) {
logerror("frame: %d phones %d\n", data[2], data[0]);
m_answer_step = 0;
m_timer->adjust(attotime::from_usec(100));
@@ -192,7 +191,7 @@ void nanoreseau_device::got_frame(uint8_t *data, int length)
memcpy(name, data + 12, 32);
name[32] = 0;
for(int i=0; i<32; i++)
- if(name[i] < 32 || name[i] >= 127)
+ if (name[i] < 32 || name[i] >= 127)
name[i]='.';
logerror("DKBOOT system %s appli %s\n", data[10] == 0 ? "TO7" : data[10] == 1 ? "MO5" : data[10] == 2 ? "TO7/70" : "?", name);
}
diff --git a/src/devices/bus/thomson/nanoreseau.h b/src/devices/bus/thomson/nanoreseau.h
index 85b48e02f6c..1d7cde2ce9a 100644
--- a/src/devices/bus/thomson/nanoreseau.h
+++ b/src/devices/bus/thomson/nanoreseau.h
@@ -25,7 +25,8 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual ioport_constructor device_input_ports() const override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(answer_tick);
private:
required_device<mc6854_device> m_mc6854;
diff --git a/src/devices/bus/ti8x/bitsocket.cpp b/src/devices/bus/ti8x/bitsocket.cpp
index d824bf35331..1c4feb4ed4f 100644
--- a/src/devices/bus/ti8x/bitsocket.cpp
+++ b/src/devices/bus/ti8x/bitsocket.cpp
@@ -26,18 +26,14 @@ public:
bit_socket_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock);
protected:
- enum
- {
- TIMER_ID_POLL = 1
- };
-
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual DECLARE_WRITE_LINE_MEMBER(input_tip) override;
virtual DECLARE_WRITE_LINE_MEMBER(input_ring) override;
+ TIMER_CALLBACK_MEMBER(poll_tick);
+
private:
required_device<bitbanger_device> m_stream;
emu_timer * m_poll_timer;
@@ -68,7 +64,7 @@ void bit_socket_device::device_add_mconfig(machine_config &config)
void bit_socket_device::device_start()
{
- m_poll_timer = timer_alloc(TIMER_ID_POLL);
+ m_poll_timer = timer_alloc(FUNC(bit_socket_device::poll_tick), this);
save_item(NAME(m_tip_in));
save_item(NAME(m_ring_in));
@@ -79,23 +75,13 @@ void bit_socket_device::device_start()
}
-void bit_socket_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(bit_socket_device::poll_tick)
{
- switch (id)
+ u8 data;
+ while (m_stream->input(&data, 1))
{
- case TIMER_ID_POLL:
- {
- u8 data;
- while (m_stream->input(&data, 1))
- {
- if (BIT(data, 1)) output_tip(BIT(data, 0));
- if (BIT(data, 2)) output_ring(BIT(data, 0));
- }
- }
- break;
-
- default:
- break;
+ if (BIT(data, 1)) output_tip(BIT(data, 0));
+ if (BIT(data, 2)) output_ring(BIT(data, 0));
}
}
diff --git a/src/devices/bus/ti99/internal/992board.cpp b/src/devices/bus/ti99/internal/992board.cpp
index bb1c9be5a78..7dae38759ee 100644
--- a/src/devices/bus/ti99/internal/992board.cpp
+++ b/src/devices/bus/ti99/internal/992board.cpp
@@ -20,14 +20,14 @@
#include "992board.h"
#define LOG_WARN (1U<<1) // Warnings
-#define LOG_CRU (1U<<2) // CRU logging
-#define LOG_CASSETTE (1U<<3) // Cassette logging
-#define LOG_HEXBUS (1U<<4) // Hexbus logging
-#define LOG_BANK (1U<<5) // Change ROM banks
+#define LOG_CRU (1U<<2) // CRU logging
+#define LOG_CASSETTE (1U<<3) // Cassette logging
+#define LOG_HEXBUS (1U<<4) // Hexbus logging
+#define LOG_BANK (1U<<5) // Change ROM banks
#define LOG_KEYBOARD (1U<<6) // Keyboard operation
#define LOG_EXPRAM (1U<<7) // Expansion RAM
-#define VERBOSE ( LOG_GENERAL | LOG_WARN )
+#define VERBOSE (LOG_GENERAL | LOG_WARN)
#include "logmacro.h"
@@ -165,28 +165,28 @@ std::string video992_device::tts(attotime t)
{
char buf[256];
const char *sign = "";
- if(t.seconds() < 0) {
- t = attotime::zero-t;
+ if (t.seconds() < 0) {
+ t = attotime::zero - t;
sign = "-";
}
int nsec = t.attoseconds() / ATTOSECONDS_PER_NANOSECOND;
- sprintf(buf, "%s%04d.%03d,%03d,%03d", sign, int(t.seconds()), nsec/1000000, (nsec/1000)%1000, nsec % 1000);
+ sprintf(buf, "%s%04d.%03d,%03d,%03d", sign, int(t.seconds()), nsec / 1000000, (nsec / 1000) % 1000, nsec % 1000);
return buf;
}
-
-void video992_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(video992_device::hold_cpu)
{
int raw_vpos = screen().vpos();
- if (id == HOLD_TIME)
- {
- // logerror("release time: %s, diff: %s\n", tts(machine().time()), tts(machine().time()-m_hold_time));
- // We're holding the CPU; release it until the next start
- m_hold_cb(CLEAR_LINE);
- m_free_timer->adjust(screen().time_until_pos((raw_vpos+1) % screen().height(), HORZ_DISPLAY_START));
- return;
- }
+ // logerror("release time: %s, diff: %s\n", tts(machine().time()), tts(machine().time()-m_hold_time));
+ // We're holding the CPU; release it until the next start
+ m_hold_cb(CLEAR_LINE);
+ m_free_timer->adjust(screen().time_until_pos((raw_vpos+1) % screen().height(), HORZ_DISPLAY_START));
+}
+
+TIMER_CALLBACK_MEMBER(video992_device::free_cpu)
+{
+ int raw_vpos = screen().vpos();
// logerror("hold time: %s\n", tts(machine().time()));
if (m_videna)
@@ -210,23 +210,23 @@ void video992_device::device_timer(emu_timer &timer, device_timer_id id, int par
// logerror("draw line %d\n", vpos);
// Get control byte
uint8_t control = m_mem_read_cb(0xef00);
- bool text_white = ((control & 0x04)!=0);
- bool border_white = ((control & 0x02)!=0);
- bool background_white = ((control & 0x01)!=0)? text_white : !text_white;
+ bool text_white = BIT(control, 2);
+ bool border_white = BIT(control, 1);
+ bool background_white = BIT(control, 0) ? text_white : !text_white;
int y = vpos - m_top_border;
if (y < 0 || y >= 192)
{
// Draw border colour
for (int i = 0; i < TOTAL_HORZ; i++)
- p[i] = border_white? rgb_t::white() : rgb_t::black();
+ p[i] = border_white ? rgb_t::white() : rgb_t::black();
// vblank is set at the last cycle of the first inactive line
// not confirmed by the specs, just doing like 9928A.
- if ( y == 193 )
+ if (y == 193)
{
- m_int_cb( ASSERT_LINE );
- m_int_cb( CLEAR_LINE );
+ m_int_cb(ASSERT_LINE);
+ m_int_cb(CLEAR_LINE);
}
}
else
@@ -234,12 +234,12 @@ void video992_device::device_timer(emu_timer &timer, device_timer_id id, int par
// Draw regular line
// Left border
for (int i = 0; i < HORZ_DISPLAY_START; i++)
- p[i] = border_white? rgb_t::white() : rgb_t::black();
+ p[i] = border_white ? rgb_t::white() : rgb_t::black();
int addr = ((y << 2) & 0x3e0) | 0xec00;
// Active display
- for (int x = HORZ_DISPLAY_START; x<HORZ_DISPLAY_START+256; x+=8)
+ for (int x = HORZ_DISPLAY_START; x < HORZ_DISPLAY_START + 256; x+=8)
{
uint8_t charcode = 0;
uint8_t pattern = 0;
@@ -255,16 +255,16 @@ void video992_device::device_timer(emu_timer &timer, device_timer_id id, int par
if (!endofline && m_videna)
{
// Get the pattern
- int addrp = 0x1c00 | (charcode << 3) | (y%8);
+ int addrp = 0x1c00 | (charcode << 3) | (y & 7);
pattern = m_mem_read_cb(addrp);
linelength++;
}
for (int i = 0; i < 8; i++)
{
- if ((pattern & 0x80)!=0)
- p[x+i] = text_white? rgb_t::white() : rgb_t::black();
+ if (BIT(pattern, 7))
+ p[x+i] = text_white ? rgb_t::white() : rgb_t::black();
else
- p[x+i] = background_white? rgb_t::white() : rgb_t::black();
+ p[x+i] = background_white ? rgb_t::white() : rgb_t::black();
pattern <<= 1;
}
@@ -273,27 +273,27 @@ void video992_device::device_timer(emu_timer &timer, device_timer_id id, int par
// Right border
for (int i = HORZ_DISPLAY_START + 256; i < TOTAL_HORZ; i++)
- p[i] = border_white? rgb_t::white() : rgb_t::black();
+ p[i] = border_white ? rgb_t::white() : rgb_t::black();
}
// +1 for the minimum hold time
// logerror("line length: %d\n", linelength);
- m_hold_timer->adjust(screen().time_until_pos(raw_vpos, HORZ_DISPLAY_START + linelength*8 + 1));
+ m_hold_timer->adjust(screen().time_until_pos(raw_vpos, HORZ_DISPLAY_START + linelength * 8 + 1));
}
-uint32_t video992_device::screen_update( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect )
+uint32_t video992_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
- copybitmap( bitmap, m_tmpbmp, 0, 0, 0, 0, cliprect );
+ copybitmap(bitmap, m_tmpbmp, 0, 0, 0, 0, cliprect);
return 0;
}
/*
VIDENA pin, positive logic
*/
-WRITE_LINE_MEMBER( video992_device::videna )
+WRITE_LINE_MEMBER(video992_device::videna)
{
- m_videna = (state==ASSERT_LINE);
+ m_videna = state;
}
void video992_device::device_start()
@@ -302,8 +302,8 @@ void video992_device::device_start()
m_vertical_size = TOTAL_VERT_NTSC;
m_tmpbmp.allocate(TOTAL_HORZ, TOTAL_VERT_NTSC);
- m_hold_timer = timer_alloc(HOLD_TIME);
- m_free_timer = timer_alloc(FREE_TIME);
+ m_hold_timer = timer_alloc(FUNC(video992_device::hold_cpu), this);
+ m_free_timer = timer_alloc(FUNC(video992_device::free_cpu), this);
m_border_color = rgb_t::black();
m_background_color = rgb_t::white();
@@ -463,12 +463,12 @@ void io992_device::device_start()
uint8_t io992_device::cruread(offs_t offset)
{
- int address = offset << 1;
+ offs_t address = offset << 1;
double inp = 0;
// CRU E000-E7fE: Keyboard
// Read: 1110 0*** **** xxx0 (mirror 07f0)
- if ((address & 0xf800)==0xe000)
+ if ((address & 0xf800) == 0xe000)
return BIT(m_keyboard[m_key_row]->read(), offset & 7);
// CRU E800-EFFE: Hexbus and other functions
@@ -480,21 +480,21 @@ uint8_t io992_device::cruread(offs_t offset)
case 0xe802:
case 0xe804:
case 0xe806:
- return data_bit(offset&3);
+ return data_bit(offset & 3);
case 0xe808:
- return (bus_hsk_level()==ASSERT_LINE)? 0:1;
+ return (bus_hsk_level() == ASSERT_LINE) ? 0 : 1;
case 0xe80a:
- return (bus_bav_level()==ASSERT_LINE)? 0:1;
+ return (bus_bav_level() == ASSERT_LINE) ? 0 : 1;
case 0xe80c:
// e80c (bit 6) seems to indicate that the HSK* line has been released
// and is now asserted again
- return (m_hsk_released && (bus_hsk_level()==ASSERT_LINE))? 1:0;
+ return (m_hsk_released && (bus_hsk_level() == ASSERT_LINE)) ? 1 : 0;
case 0xe80e:
inp = m_cassette->input();
LOGMASKED(LOG_CASSETTE, "value=%f\n", inp);
- return (inp > 0)? 1:0;
+ return (inp > 0) ? 1 : 0;
default:
LOGMASKED(LOG_CRU, "Invalid CRU access to %04x\n", address);
@@ -504,7 +504,7 @@ uint8_t io992_device::cruread(offs_t offset)
void io992_device::cruwrite(offs_t offset, uint8_t data)
{
- int address = (offset << 1) & 0xf80e;
+ offs_t address = (offset << 1) & 0xf80e;
LOGMASKED(LOG_CRU, "CRU %04x <- %1x\n", address, data);
@@ -519,7 +519,7 @@ void io992_device::cruwrite(offs_t offset, uint8_t data)
if (m_have_banked_rom)
{
LOGMASKED(LOG_BANK, "set bank = %d\n", data);
- m_set_rom_bank(data==1);
+ m_set_rom_bank(data == 1);
}
[[fallthrough]];
case 0xe002:
@@ -527,7 +527,7 @@ void io992_device::cruwrite(offs_t offset, uint8_t data)
case 0xe006:
case 0xe008:
case 0xe00a:
- if (data == 0) m_key_row = offset&7;
+ if (data == 0) m_key_row = offset & 7;
break;
case 0xe00c:
LOGMASKED(LOG_WARN, "Unmapped CRU write to address e00c\n");
@@ -546,12 +546,12 @@ void io992_device::cruwrite(offs_t offset, uint8_t data)
break;
case 0xe80a: // BAV
- set_bav_line(data!=0? CLEAR_LINE : ASSERT_LINE);
+ set_bav_line(data != 0 ? CLEAR_LINE : ASSERT_LINE);
break;
case 0xe808: // HSK
- set_hsk_line(data!=0? CLEAR_LINE : ASSERT_LINE);
- m_hsk_released = (bus_hsk_level()==CLEAR_LINE);
+ set_hsk_line(data != 0 ? CLEAR_LINE : ASSERT_LINE);
+ m_hsk_released = (bus_hsk_level() == CLEAR_LINE);
break;
case 0xe80c:
@@ -561,7 +561,7 @@ void io992_device::cruwrite(offs_t offset, uint8_t data)
case 0xe80e:
LOGMASKED(LOG_CRU, "Cassette output = %d\n", data);
// Tape output. See also ti99_4x.cpp.
- m_cassette->output((data==1)? +1 : -1);
+ m_cassette->output((data == 1) ? +1 : -1);
break;
}
}
@@ -580,13 +580,13 @@ void io992_device::hexbus_value_changed(uint8_t data)
{
// Only latch the incoming data when BAV* is asserted and the Hexbus
// is not inhibited
- if (own_bav_level()==ASSERT_LINE)
+ if (own_bav_level() == ASSERT_LINE)
{
- if (bus_hsk_level()==ASSERT_LINE)
+ if (bus_hsk_level() == ASSERT_LINE)
{
// According to the Hexbus spec, the incoming HSK must be latched
// by hardware
- LOGMASKED(LOG_HEXBUS, "Latching HSK*; got data %01x\n", (data>>4)|(data&3));
+ LOGMASKED(LOG_HEXBUS, "Latching HSK*; got data %01x\n", (data >> 4) | (data & 3));
latch_hsk();
}
else
@@ -596,7 +596,7 @@ void io992_device::hexbus_value_changed(uint8_t data)
}
}
else
- LOGMASKED(LOG_HEXBUS, "Ignoring Hexbus change (to %02x), BAV*=%d\n", data, (own_bav_level()==ASSERT_LINE)? 0:1);
+ LOGMASKED(LOG_HEXBUS, "Ignoring Hexbus change (to %02x), BAV*=%d\n", data, (own_bav_level() == ASSERT_LINE) ? 0 : 1);
}
ioport_constructor io992_device::device_input_ports() const
@@ -651,7 +651,7 @@ void ti992_expram_device::readz(offs_t offset, uint8_t *value)
// 011 -> 011 111 -> 111
offs_t address = offset;
if ((offset & 0x6000) != 0x6000) address ^= 0x8000;
- if ((address & 0x8000)==0)
+ if ((address & 0x8000) == 0)
{
*value = m_ram->read(address);
LOGMASKED(LOG_EXPRAM, "expram %04x -> %02x\n", offset, *value);
@@ -662,7 +662,7 @@ void ti992_expram_device::write(offs_t offset, uint8_t value)
{
offs_t address = offset;
if ((offset & 0x6000) != 0x6000) address ^= 0x8000;
- if ((address & 0x8000)==0)
+ if ((address & 0x8000) == 0)
{
m_ram->write(address, value);
LOGMASKED(LOG_EXPRAM, "expram %04x <- %02x\n", offset, value);
diff --git a/src/devices/bus/ti99/internal/992board.h b/src/devices/bus/ti99/internal/992board.h
index 78ca51193cd..5a6ab8b5a8f 100644
--- a/src/devices/bus/ti99/internal/992board.h
+++ b/src/devices/bus/ti99/internal/992board.h
@@ -59,12 +59,11 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-private:
- static const device_timer_id HOLD_TIME = 0;
- static const device_timer_id FREE_TIME = 1;
+ TIMER_CALLBACK_MEMBER(hold_cpu);
+ TIMER_CALLBACK_MEMBER(free_cpu);
+private:
std::string tts(attotime t);
devcb_read8 m_mem_read_cb; // Callback to read memory
devcb_write_line m_hold_cb;
diff --git a/src/devices/bus/ti99/internal/genkbd.cpp b/src/devices/bus/ti99/internal/genkbd.cpp
index fa65058d7c8..5e22f27ee33 100644
--- a/src/devices/bus/ti99/internal/genkbd.cpp
+++ b/src/devices/bus/ti99/internal/genkbd.cpp
@@ -35,7 +35,7 @@
#define LOG_TRANSFER (1U<<3)
#define LOG_LINES (1U<<4)
-#define VERBOSE ( LOG_GENERAL | LOG_WARN )
+#define VERBOSE (LOG_GENERAL | LOG_WARN)
#include "logmacro.h"
@@ -203,42 +203,34 @@ geneve_xt_101_hle_keyboard_device::geneve_xt_101_hle_keyboard_device(const machi
{
}
-/*
- Called by the poll timer
-*/
-void geneve_xt_101_hle_keyboard_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(geneve_xt_101_hle_keyboard_device::poll_tick)
+{
+ poll();
+ send_key();
+}
+
+TIMER_CALLBACK_MEMBER(geneve_xt_101_hle_keyboard_device::send_tick)
{
- if (id==0)
+ // Send timer
+ if (m_shift_count == 10)
{
- poll();
- send_key();
+ // Done, all sent
+ m_pc_kbdc->clock_write_from_kb(1);
+ m_pc_kbdc->data_write_from_kb(1);
+ m_send_timer->reset();
+ m_shift_count = 0;
+
+ // Adjust the queue
+ m_queue_head = (m_queue_head + 1) % KEYQUEUESIZE;
+ m_queue_length--;
}
else
{
- if (id==1)
- {
- // Send timer
- if (m_shift_count==10)
- {
- // Done, all sent
- m_pc_kbdc->clock_write_from_kb(1);
- m_pc_kbdc->data_write_from_kb(1);
- m_send_timer->reset();
- m_shift_count = 0;
-
- // Adjust the queue
- m_queue_head = (m_queue_head + 1) % KEYQUEUESIZE;
- m_queue_length--;
- }
- else
- {
- m_pc_kbdc->clock_write_from_kb(1);
- m_pc_kbdc->data_write_from_kb(m_shift_reg&1);
- m_pc_kbdc->clock_write_from_kb(0);
- m_shift_reg>>=1;
- m_shift_count++;
- }
- }
+ m_pc_kbdc->clock_write_from_kb(1);
+ m_pc_kbdc->data_write_from_kb(BIT(m_shift_reg, 0));
+ m_pc_kbdc->clock_write_from_kb(0);
+ m_shift_reg >>= 1;
+ m_shift_count++;
}
}
@@ -271,38 +263,32 @@ static const uint8_t MF1_CODE[0xe] =
void geneve_xt_101_hle_keyboard_device::poll()
{
- uint32_t keystate;
- uint32_t key_transitions;
- uint32_t mask;
- bool pressed = false;
- int keycode = 0;
-
if (m_resetting) return;
// We're testing two 16-bit ports at once
// but only if we have enough space in the queue
- for (int i=0; (i < 4) && (m_queue_length <= (KEYQUEUESIZE-MAXKEYMSGLENGTH)); i++)
+ for (uint8_t i = 0; i < 4 && m_queue_length <= (KEYQUEUESIZE - MAXKEYMSGLENGTH); i++)
{
// Get those two ports and calculate the difference
- keystate = m_keys[2*i]->read() | (m_keys[2*i + 1]->read() << 16);
- key_transitions = keystate ^ m_key_state_save[i];
+ uint32_t keystate = m_keys[2 * i]->read() | (m_keys[2 * i + 1]->read() << 16);
+ uint32_t key_transitions = keystate ^ m_key_state_save[i];
if (key_transitions != 0)
{
- mask = 0x00000001;
+ uint32_t mask = 0x00000001;
// Some key(s) has/have changed (pressed/released)
- for (int j=0; (j < 32) && (m_queue_length <= (KEYQUEUESIZE-MAXKEYMSGLENGTH)); j++)
+ for (uint8_t j = 0; j < 32 && m_queue_length <= (KEYQUEUESIZE - MAXKEYMSGLENGTH); j++)
{
- if ((key_transitions & mask)!=0)
+ if ((key_transitions & mask) != 0)
{
// Found one changed key (i is a 32-key block)
- keycode = (i<<5) | j;
- pressed = (keystate & mask)!=0;
+ uint8_t keycode = (i << 5) | j;
+ bool pressed = (bool)(keystate & mask);
// Auto-repeat
if (pressed)
{
m_autorepeat_code = keycode;
- m_autorepeat_timer = KEYAUTOREPEATDELAY+1;
+ m_autorepeat_timer = KEYAUTOREPEATDELAY + 1;
m_key_state_save[i] |= mask;
}
else
@@ -358,9 +344,9 @@ void geneve_xt_101_hle_keyboard_device::poll()
}
// Extended keycodes
- if ((keycode >= 0x60) && (keycode < 0x6e))
+ if (keycode >= 0x60 && keycode < 0x6e)
{
- if ((keycode >= 0x63) && pressed)
+ if (keycode >= 0x63 && pressed)
{
// Handle shift state
if (keycode == 0x63) // Slash
@@ -373,14 +359,14 @@ void geneve_xt_101_hle_keyboard_device::poll()
}
else
{ // Key function with NumLock=0
- if (m_numlock && (!m_left_shift) && (!m_right_shift))
+ if (m_numlock && !m_left_shift && !m_right_shift)
{
// Fake shift press if numlock is active
m_fake_shift_state = true;
}
else
{
- if ((!m_numlock) && (m_left_shift || m_right_shift))
+ if (!m_numlock && (m_left_shift || m_right_shift))
{
// Fake shift unpress if shift is down
m_fake_unshift_state = true;
@@ -400,7 +386,7 @@ void geneve_xt_101_hle_keyboard_device::poll()
post_in_key_queue(0xaa);
}
}
- keycode = MF1_CODE[keycode-0x60];
+ keycode = MF1_CODE[keycode - 0x60];
if (!pressed) keycode |= 0x80;
post_in_key_queue(0xe0);
post_in_key_queue(keycode);
@@ -422,7 +408,7 @@ void geneve_xt_101_hle_keyboard_device::poll()
else
{
// Handle shift state
- if (pressed && (!m_left_shift) && (!m_right_shift) && (!m_left_ctrl) && (!m_right_ctrl))
+ if (pressed && !m_left_shift && !m_right_shift && !m_left_ctrl && !m_right_ctrl)
{ // Fake shift press
post_in_key_queue(0xe0);
post_in_key_queue(0x2a);
@@ -481,13 +467,13 @@ void geneve_xt_101_hle_keyboard_device::poll()
if (m_autorepeat_code != 0)
{
m_autorepeat_timer--;
- if ((m_autorepeat_timer == 0) && (m_queue_length <= (KEYQUEUESIZE-MAXKEYMSGLENGTH)))
+ if (m_autorepeat_timer == 0 && m_queue_length <= (KEYQUEUESIZE - MAXKEYMSGLENGTH))
{
// Extended code
- if ((m_autorepeat_code >= 0x60) && (m_autorepeat_code < 0x6e))
+ if (m_autorepeat_code >= 0x60 && m_autorepeat_code < 0x6e)
{
post_in_key_queue(0xe0);
- post_in_key_queue(MF1_CODE[m_autorepeat_code-0x60]);
+ post_in_key_queue(MF1_CODE[m_autorepeat_code - 0x60]);
}
else
{
@@ -521,7 +507,7 @@ void geneve_xt_101_hle_keyboard_device::send_key()
if (m_clock_line == CLEAR_LINE)
{
m_reset_timer--;
- if (m_reset_timer==0)
+ if (m_reset_timer == 0)
{
LOG("Reset triggered\n");
reset_line(0);
@@ -530,7 +516,7 @@ void geneve_xt_101_hle_keyboard_device::send_key()
}
else
{
- if (m_data_line==1)
+ if (m_data_line)
{
// Dequeue a key
if (m_queue_length != 0)
@@ -558,7 +544,7 @@ void geneve_xt_101_hle_keyboard_device::post_in_key_queue(int keycode)
// clock_write -
//-------------------------------------------------
-WRITE_LINE_MEMBER( geneve_xt_101_hle_keyboard_device::clock_write )
+WRITE_LINE_MEMBER(geneve_xt_101_hle_keyboard_device::clock_write)
{
LOGMASKED(LOG_LINES, "Clock write: %d\n", state);
m_clock_line = (line_state)state;
@@ -576,7 +562,7 @@ WRITE_LINE_MEMBER( geneve_xt_101_hle_keyboard_device::clock_write )
// data_write -
//-------------------------------------------------
-WRITE_LINE_MEMBER( geneve_xt_101_hle_keyboard_device::data_write )
+WRITE_LINE_MEMBER(geneve_xt_101_hle_keyboard_device::data_write)
{
LOGMASKED(LOG_LINES, "Data write: %d\n", state);
m_data_line = (line_state)state;
@@ -590,14 +576,14 @@ WRITE_LINE_MEMBER( geneve_xt_101_hle_keyboard_device::data_write )
void geneve_xt_101_hle_keyboard_device::device_start()
{
set_pc_kbdc_device();
- m_poll_timer = timer_alloc(0);
- m_send_timer = timer_alloc(1);
+ m_poll_timer = timer_alloc(FUNC(geneve_xt_101_hle_keyboard_device::poll_tick), this);
+ m_send_timer = timer_alloc(FUNC(geneve_xt_101_hle_keyboard_device::send_tick), this);
// state saving
save_item(NAME(m_queue_length));
save_item(NAME(m_queue_head));
- save_pointer(NAME(m_key_state_save),4);
- save_pointer(NAME(m_queue),KEYQUEUESIZE);
+ save_pointer(NAME(m_key_state_save), 4);
+ save_pointer(NAME(m_queue), KEYQUEUESIZE);
}
@@ -614,9 +600,9 @@ void geneve_xt_101_hle_keyboard_device::device_reset()
}
-WRITE_LINE_MEMBER( geneve_xt_101_hle_keyboard_device::reset_line )
+WRITE_LINE_MEMBER(geneve_xt_101_hle_keyboard_device::reset_line)
{
- m_resetting = (state==0);
+ m_resetting = !state;
if (m_resetting)
{
@@ -645,4 +631,3 @@ WRITE_LINE_MEMBER( geneve_xt_101_hle_keyboard_device::reset_line )
post_in_key_queue(0xaa);
}
}
-
diff --git a/src/devices/bus/ti99/internal/genkbd.h b/src/devices/bus/ti99/internal/genkbd.h
index a54951e2134..cf67ea8ee6c 100644
--- a/src/devices/bus/ti99/internal/genkbd.h
+++ b/src/devices/bus/ti99/internal/genkbd.h
@@ -26,18 +26,20 @@ class geneve_xt_101_hle_keyboard_device : public device_t, public device_pc_kbd_
public:
// construction/destruction
geneve_xt_101_hle_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- DECLARE_WRITE_LINE_MEMBER( reset_line );
+ DECLARE_WRITE_LINE_MEMBER(reset_line);
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
virtual ioport_constructor device_input_ports() const override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_pc_kbd_interface overrides
- virtual DECLARE_WRITE_LINE_MEMBER( clock_write ) override;
- virtual DECLARE_WRITE_LINE_MEMBER( data_write ) override;
+ virtual DECLARE_WRITE_LINE_MEMBER(clock_write) override;
+ virtual DECLARE_WRITE_LINE_MEMBER(data_write) override;
+
+ TIMER_CALLBACK_MEMBER(poll_tick);
+ TIMER_CALLBACK_MEMBER(send_tick);
private:
emu_timer *m_poll_timer;
diff --git a/src/devices/bus/ti99/joyport/handset.cpp b/src/devices/bus/ti99/joyport/handset.cpp
index ab55d84f277..046873f5fe6 100644
--- a/src/devices/bus/ti99/joyport/handset.cpp
+++ b/src/devices/bus/ti99/joyport/handset.cpp
@@ -45,7 +45,7 @@
#define LOG_HANDSET (1U<<4)
#define LOG_CLOCK (1U<<5)
-#define VERBOSE ( LOG_CONFIG | LOG_WARN )
+#define VERBOSE (LOG_CONFIG | LOG_WARN)
#include "logmacro.h"
@@ -54,19 +54,17 @@ DEFINE_DEVICE_TYPE(TI99_HANDSET, bus::ti99::joyport::ti99_handset_device, "ti99_
namespace bus::ti99::joyport {
-#define TRACE_HANDSET 0
-#define TRACE_JOYSTICK 0
-
-static const char *const joynames[2][4] =
-{
- { "JOY0", "JOY2", "JOY4", "JOY6" }, // X axis
- { "JOY1", "JOY3", "JOY5", "JOY7" } // Y axis
-};
-
-static const char *const keynames[] = { "KP0", "KP1", "KP2", "KP3", "KP4" };
-
ti99_handset_device::ti99_handset_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, TI99_HANDSET, tag, owner, clock), device_ti99_joyport_interface(mconfig, *this), m_ack(0), m_clock_high(false), m_buf(0), m_buflen(0), m_delay_timer(nullptr)
+ : device_t(mconfig, TI99_HANDSET, tag, owner, clock)
+ , device_ti99_joyport_interface(mconfig, *this)
+ , m_joyx(*this, "JOYX%u", 0U)
+ , m_joyy(*this, "JOYY%u", 0U)
+ , m_keys(*this, "KP%u", 0U)
+ , m_ack(0)
+ , m_clock_high(false)
+ , m_buf(0)
+ , m_buflen(0)
+ , m_delay_timer(nullptr)
{
}
@@ -85,7 +83,7 @@ ti99_handset_device::ti99_handset_device(const machine_config &mconfig, const ch
*/
uint8_t ti99_handset_device::read_dev()
{
- return (m_buf & 0xf) | 0x10 | (m_clock_high? 0x20:0) | ( m_buflen==3? 0x00:0x40);
+ return (m_buf & 0xf) | 0x10 | (m_clock_high ? 0x20 : 0x00) | (m_buflen == 3 ? 0x00 : 0x40);
}
void ti99_handset_device::write_dev(uint8_t data)
@@ -100,7 +98,7 @@ void ti99_handset_device::write_dev(uint8_t data)
of P0 is changed, because, in one occasion, the ISR asserts the line before
it reads the data, so we need to delay the acknowledge process.
*/
-void ti99_handset_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(ti99_handset_device::delayed_data_ack)
{
m_clock_high = !m_clock_high;
m_buf >>= 4;
@@ -120,8 +118,10 @@ void ti99_handset_device::device_timer(emu_timer &timer, device_timer_id id, int
}
if (m_buflen == 0)
- /* See if we need to post a new event */
- do_task();
+ {
+ // See if we need to post a new event
+ do_task();
+ }
}
/*
@@ -129,10 +129,10 @@ void ti99_handset_device::device_timer(emu_timer &timer, device_timer_id id, int
*/
void ti99_handset_device::set_acknowledge(int data)
{
- if ((m_buflen !=0) && (data != m_ack))
+ if (m_buflen != 0 && data != m_ack)
{
m_ack = data;
- if ((data!=0) == m_clock_high)
+ if (data != 0 && m_clock_high)
{
// I don't know what the real delay is, but 30us apears to be enough
m_delay_timer->adjust(attotime::from_usec(30));
@@ -167,54 +167,58 @@ void ti99_handset_device::post_message(int message)
*/
bool ti99_handset_device::poll_keyboard(int num)
{
- uint32_t key_buf;
uint8_t current_key;
- int i;
- /* read current key state */
- key_buf = (ioport(keynames[num])->read() | (ioport(keynames[num + 1])->read() << 16) ) >> (4*num);
+ // read current key state
+ uint32_t key_buf = (m_keys[num]->read() | (m_keys[num + 1]->read() << 16)) >> (4*num);
// If a key was previously pressed, this key was not shift, and this key is
// still down, then don't change the current key press.
- if (previous_key[num] !=0 && (previous_key[num] != 0x24)
- && (key_buf & (1 << (previous_key[num] & 0x1f))))
+ if (previous_key[num] !=0 && previous_key[num] != 0x24 && BIT(key_buf, previous_key[num] & 0x1f))
{
- /* check the shift modifier state */
- if (((previous_key[num] & 0x20) != 0) == ((key_buf & 0x0008) != 0))
- /* the shift modifier state has not changed */
+ // check the shift modifier state
+ if (BIT(previous_key[num], 5) == BIT(key_buf, 3))
+ {
+ // the shift modifier state has not changed
return false;
+ }
else
{
// The shift modifier state has changed: we need to update the
// keyboard state
if (key_buf & 0x0008)
- { /* shift has been pressed down */
- previous_key[num] = current_key = previous_key[num] | 0x20;
+ {
+ // shift has been pressed down
+ current_key = previous_key[num] | 0x20;
+ previous_key[num] = current_key;
}
else
{
- previous_key[num] = current_key = previous_key[num] & ~0x20;
+ current_key = previous_key[num] & ~0x20;
+ previous_key[num] = current_key;
}
- /* post message */
- post_message((((unsigned)current_key) << 4) | (num << 1));
+ // post message
+ post_message(((uint32_t)current_key << 4) | (num << 1));
return true;
}
}
- current_key = 0; /* default value if no key is down */
- for (i=0; i<20; i++)
+ current_key = 0; // default value if no key is down
+ for (int i = 0; i < 20; i++)
{
- if (key_buf & (1 << i))
+ if (BIT(key_buf, i))
{
current_key = i + 1;
- if (key_buf & 0x0008)
- current_key |= 0x20; /* set shift flag */
+ if (BIT(key_buf, 3))
+ current_key |= 0x20; // set shift flag
if (current_key != 0x24)
+ {
// If this is the shift key, any other key we may find will
// have higher priority; otherwise, we may exit the loop and keep
// the key we have just found.
break;
+ }
}
}
@@ -222,8 +226,8 @@ bool ti99_handset_device::poll_keyboard(int num)
{
previous_key[num] = current_key;
- /* post message */
- post_message((((unsigned) current_key) << 4) | (num << 1));
+ // post message
+ post_message(((uint32_t)current_key << 4) | (num << 1));
return true;
}
return false;
@@ -238,42 +242,39 @@ bool ti99_handset_device::poll_keyboard(int num)
*/
bool ti99_handset_device::poll_joystick(int num)
{
- uint8_t current_joy;
- int current_joy_x, current_joy_y;
int message;
- /* read joystick position */
- current_joy_x = ioport(joynames[0][num])->read();
- current_joy_y = ioport(joynames[1][num])->read();
+ // read joystick position
+ uint8_t current_joy_x = m_joyx[num]->read();
+ uint8_t current_joy_y = m_joyy[num]->read();
- /* compare with last saved position */
- current_joy = current_joy_x | (current_joy_y << 4);
+ // compare with last saved position
+ uint8_t current_joy = current_joy_x | (current_joy_y << 4);
if (current_joy != previous_joy[num])
{
- /* save position */
+ // save position
previous_joy[num] = current_joy;
- /* transform position to signed quantity */
+ // transform position to signed quantity
current_joy_x -= 7;
current_joy_y -= 7;
message = 0;
- /* set sign */
- // note that we set the sign if the joystick position is 0 to work
+ // set sign, note that we set the sign if the joystick position is 0 to work
// around a bug in the ti99/4 ROMs
if (current_joy_x <= 0)
{
message |= 0x040;
- current_joy_x = - current_joy_x;
+ current_joy_x = -current_joy_x;
}
if (current_joy_y <= 0)
{
message |= 0x400;
- current_joy_y = - current_joy_y;
+ current_joy_y = -current_joy_y;
}
- /* convert absolute values to Gray code and insert in message */
+ // convert absolute values to Gray code and insert in message
if (current_joy_x & 4)
current_joy_x ^= 3;
if (current_joy_x & 2)
@@ -286,10 +287,10 @@ bool ti99_handset_device::poll_joystick(int num)
current_joy_y ^= 1;
message |= current_joy_y << 7;
- /* set joystick address */
+ // set joystick address
message |= (num << 1) | 0x1;
- /* post message */
+ // post message
post_message(message);
return true;
}
@@ -302,25 +303,23 @@ bool ti99_handset_device::poll_joystick(int num)
*/
void ti99_handset_device::do_task()
{
- int i;
-
if (m_buflen == 0)
{
- /* poll every handset */
- for (i=0; i < MAX_HANDSETS; i++)
- if (poll_joystick(i)==true) return;
- for (i=0; i < MAX_HANDSETS; i++)
- if (poll_keyboard(i)==true) return;
+ // poll every handset
+ for (int i = 0; i < MAX_HANDSETS; i++)
+ if (poll_joystick(i)) return;
+ for (int i = 0; i < MAX_HANDSETS; i++)
+ if (poll_keyboard(i)) return;
}
else if (m_buflen == 3)
{ /* update messages after they have been posted */
if (m_buf & 1)
{ /* keyboard */
- poll_keyboard((~(m_buf >> 1)) & 0x3);
+ poll_keyboard(~(m_buf >> 1) & 0x3);
}
else
{ /* joystick */
- poll_joystick((~(m_buf >> 1)) & 0x3);
+ poll_joystick(~(m_buf >> 1) & 0x3);
}
}
}
@@ -333,7 +332,7 @@ void ti99_handset_device::pulse_clock()
void ti99_handset_device::device_start()
{
- m_delay_timer = timer_alloc(DELAY_TIMER);
+ m_delay_timer = timer_alloc(FUNC(ti99_handset_device::delayed_data_ack), this);
save_item(NAME(m_ack));
save_item(NAME(m_clock_high));
save_item(NAME(m_buf));
@@ -358,28 +357,28 @@ INPUT_PORTS_START( handset )
/* 13 pseudo-ports for IR remote handsets */
/* 8 pseudo-ports for the 4 IR joysticks */
- PORT_START("JOY0") /* joystick 1, X axis */
+ PORT_START("JOYX0") /* joystick 1, X axis */
PORT_BIT( 0xf, 0x7, IPT_AD_STICK_X) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0,0xe) PORT_PLAYER(1)
- PORT_START("JOY1") /* joystick 1, Y axis */
+ PORT_START("JOYY0") /* joystick 1, Y axis */
PORT_BIT( 0xf, 0x7, IPT_AD_STICK_Y) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0,0xe) PORT_PLAYER(1) PORT_REVERSE
- PORT_START("JOY2") /* joystick 2, X axis */
+ PORT_START("JOYX1") /* joystick 2, X axis */
PORT_BIT( 0xf, 0x7, IPT_AD_STICK_X) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0,0xe) PORT_PLAYER(2)
- PORT_START("JOY3") /* joystick 2, Y axis */
+ PORT_START("JOYY1") /* joystick 2, Y axis */
PORT_BIT( 0xf, 0x7, IPT_AD_STICK_Y) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0,0xe) PORT_PLAYER(2) PORT_REVERSE
- PORT_START("JOY4") /* joystick 3, X axis */
+ PORT_START("JOYX2") /* joystick 3, X axis */
PORT_BIT( 0xf, 0x7, IPT_AD_STICK_X) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0,0xe) PORT_PLAYER(3)
- PORT_START("JOY5") /* joystick 3, Y axis */
+ PORT_START("JOYY2") /* joystick 3, Y axis */
PORT_BIT( 0xf, 0x7, IPT_AD_STICK_Y) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0,0xe) PORT_PLAYER(3) PORT_REVERSE
- PORT_START("JOY6") /* joystick 4, X axis */
+ PORT_START("JOYX3") /* joystick 4, X axis */
PORT_BIT( 0xf, 0x7, IPT_AD_STICK_X) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0,0xe) PORT_PLAYER(4)
- PORT_START("JOY7") /* joystick 4, Y axis */
+ PORT_START("JOYY3") /* joystick 4, Y axis */
PORT_BIT( 0xf, 0x7, IPT_AD_STICK_Y) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0,0xe) PORT_PLAYER(4) PORT_REVERSE
/* 5 pseudo-ports for the 4 IR remote keypads */
@@ -508,7 +507,9 @@ INPUT_PORTS_START( joysticks )
INPUT_PORTS_END
ti99_twin_joystick_device::ti99_twin_joystick_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, TI99_JOYSTICK, tag, owner, clock), device_ti99_joyport_interface(mconfig, *this), m_joystick(0)
+ : device_t(mconfig, TI99_JOYSTICK, tag, owner, clock), device_ti99_joyport_interface(mconfig, *this)
+ , m_joystick(0)
+ , m_joys(*this, "JOY%u", 1U)
{
}
@@ -524,12 +525,10 @@ void ti99_twin_joystick_device::device_start()
*/
uint8_t ti99_twin_joystick_device::read_dev()
{
- uint8_t value;
- if (m_joystick==1) value = ioport("JOY1")->read();
- else
+ uint8_t value = 0xff;
+ if (m_joystick > 0 && m_joystick <= 2)
{
- if (m_joystick==2) value = ioport("JOY2")->read();
- else value = 0xff;
+ value = m_joys[m_joystick - 1]->read();
}
LOGMASKED(LOG_JOYSTICK, "joy%d = %02x\n", m_joystick, value);
return value;
diff --git a/src/devices/bus/ti99/joyport/handset.h b/src/devices/bus/ti99/joyport/handset.h
index ca64889ec43..344f74bed7a 100644
--- a/src/devices/bus/ti99/joyport/handset.h
+++ b/src/devices/bus/ti99/joyport/handset.h
@@ -38,7 +38,7 @@ protected:
virtual void device_reset() override;
virtual ioport_constructor device_input_ports() const override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(delayed_data_ack);
private:
static constexpr unsigned MAX_HANDSETS = 4;
@@ -49,6 +49,10 @@ private:
bool poll_joystick(int num);
void set_acknowledge(int data);
+ required_ioport_array<4> m_joyx;
+ required_ioport_array<4> m_joyy;
+ required_ioport_array<5> m_keys;
+
int m_ack;
bool m_clock_high;
int m_buf;
@@ -78,6 +82,8 @@ private:
// In reality this is no latch but GND is put on one of the selector lines
// and then routed back to the port via the joystick
int m_joystick;
+
+ required_ioport_array<2> m_joys;
};
} // end namespace bus::ti99::joyport
diff --git a/src/devices/bus/ti99/joyport/mecmouse.cpp b/src/devices/bus/ti99/joyport/mecmouse.cpp
index a95162f44ea..68e17da3ec1 100644
--- a/src/devices/bus/ti99/joyport/mecmouse.cpp
+++ b/src/devices/bus/ti99/joyport/mecmouse.cpp
@@ -55,10 +55,21 @@ DEFINE_DEVICE_TYPE(TI99_MECMOUSE, bus::ti99::joyport::mecmouse_device, "ti99_mec
namespace bus::ti99::joyport {
-#define POLL_TIMER 1
-
mecmouse_device::mecmouse_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, TI99_MECMOUSE, tag, owner, clock), device_ti99_joyport_interface(mconfig, *this), m_last_select(0), m_read_y_axis(false), m_x(0), m_y(0), m_x_buf(0), m_y_buf(0), m_last_mx(0), m_last_my(0), m_poll_timer(nullptr)
+ : device_t(mconfig, TI99_MECMOUSE, tag, owner, clock)
+ , device_ti99_joyport_interface(mconfig, *this)
+ , m_mousex(*this, "MOUSEX")
+ , m_mousey(*this, "MOUSEY")
+ , m_mousebutton(*this, "MOUSE0")
+ , m_last_select(0)
+ , m_read_y_axis(false)
+ , m_x(0)
+ , m_y(0)
+ , m_x_buf(0)
+ , m_y_buf(0)
+ , m_last_mx(0)
+ , m_last_my(0)
+ , m_poll_timer(nullptr)
{
}
@@ -66,7 +77,7 @@ mecmouse_device::mecmouse_device(const machine_config &mconfig, const char *tag,
uint8_t mecmouse_device::read_dev()
{
int answer;
- int buttons = ioport("MOUSE0")->read() & 3;
+ int buttons = m_mousebutton->read() & 3;
answer = (m_read_y_axis? m_y_buf : m_x_buf) << 1;
@@ -132,17 +143,14 @@ void mecmouse_device::write_dev(uint8_t data)
}
}
-void mecmouse_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(mecmouse_device::poll_mouse)
{
// Poll the movement
- int new_mx, new_my;
- int delta_x, delta_y;
-
- new_mx = ioport("MOUSEX")->read();
- new_my = ioport("MOUSEY")->read();
+ int new_mx = m_mousex->read();
+ int new_my = m_mousey->read();
// compute x delta
- delta_x = new_mx - m_last_mx;
+ int delta_x = new_mx - m_last_mx;
// Prevent unplausible values at startup.
if (delta_x > 10000 || delta_x<-10000) delta_x = 0;
@@ -150,7 +158,7 @@ void mecmouse_device::device_timer(emu_timer &timer, device_timer_id id, int par
m_last_mx = new_mx;
// compute y delta
- delta_y = new_my - m_last_my;
+ int delta_y = new_my - m_last_my;
if (delta_y > 10000 || delta_y<-10000) delta_y = 0;
@@ -163,7 +171,7 @@ void mecmouse_device::device_timer(emu_timer &timer, device_timer_id id, int par
void mecmouse_device::device_start()
{
- m_poll_timer = timer_alloc(POLL_TIMER);
+ m_poll_timer = timer_alloc(FUNC(mecmouse_device::poll_mouse), this);
// The poll time cannot depend on the console settings, since the TI-99/4A
// has no clock line on the joystick port. The rate is not mentioned in
// the specs; however, if it is too low, the mouse pointer will do jumps
diff --git a/src/devices/bus/ti99/joyport/mecmouse.h b/src/devices/bus/ti99/joyport/mecmouse.h
index 8bbecc7d78d..0ee23ade546 100644
--- a/src/devices/bus/ti99/joyport/mecmouse.h
+++ b/src/devices/bus/ti99/joyport/mecmouse.h
@@ -30,9 +30,14 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual ioport_constructor device_input_ports() const override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(poll_mouse);
private:
+ required_ioport m_mousex;
+ required_ioport m_mousey;
+ required_ioport m_mousebutton;
+
int m_last_select;
bool m_read_y_axis;
int m_x;
diff --git a/src/devices/bus/ti99/peb/hfdc.cpp b/src/devices/bus/ti99/peb/hfdc.cpp
index 98b42c5afbb..d760f09da20 100644
--- a/src/devices/bus/ti99/peb/hfdc.cpp
+++ b/src/devices/bus/ti99/peb/hfdc.cpp
@@ -84,8 +84,6 @@ namespace bus::ti99::peb {
#define NONE -1
-#define MOTOR_TIMER 1
-
#define TAPE_ADDR 0x0fc0
#define HDC_R_ADDR 0x0fd0
#define HDC_W_ADDR 0x0fd2
@@ -507,7 +505,7 @@ void myarc_hfdc_device::cruwrite(offs_t offset, uint8_t data)
/*
Monoflop has gone back to the OFF state.
*/
-void myarc_hfdc_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(myarc_hfdc_device::motor_off)
{
set_floppy_motors_running(false);
}
@@ -885,7 +883,7 @@ void myarc_hfdc_device::write_buffer(uint8_t data)
void myarc_hfdc_device::device_start()
{
m_dsrrom = memregion(TI99_DSRROM)->base();
- m_motor_on_timer = timer_alloc(MOTOR_TIMER);
+ m_motor_on_timer = timer_alloc(FUNC(myarc_hfdc_device::motor_off), this);
// The HFDC does not use READY; it has on-board RAM for DMA
m_current_floppy = nullptr;
m_current_harddisk = nullptr;
diff --git a/src/devices/bus/ti99/peb/hfdc.h b/src/devices/bus/ti99/peb/hfdc.h
index c7c17834b79..ee167421e48 100644
--- a/src/devices/bus/ti99/peb/hfdc.h
+++ b/src/devices/bus/ti99/peb/hfdc.h
@@ -46,7 +46,6 @@ public:
protected:
virtual void device_config_complete() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_start() override;
virtual void device_reset() override;
@@ -54,6 +53,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual ioport_constructor device_input_ports() const override;
+ TIMER_CALLBACK_MEMBER(motor_off);
+
private:
DECLARE_WRITE_LINE_MEMBER( dmarq_w );
DECLARE_WRITE_LINE_MEMBER( intrq_w );
diff --git a/src/devices/bus/ti99/peb/tipi.cpp b/src/devices/bus/ti99/peb/tipi.cpp
index 5f98313b47b..1dc8b1d3c3d 100644
--- a/src/devices/bus/ti99/peb/tipi.cpp
+++ b/src/devices/bus/ti99/peb/tipi.cpp
@@ -406,7 +406,7 @@ void tipi_card_device::process_message()
Default for port is 9901.
*/
-void tipi_card_device::open_websocket()
+TIMER_CALLBACK_MEMBER(tipi_card_device::open_websocket)
{
if (m_rpiconn)
{
@@ -539,15 +539,6 @@ void tipi_card_device::websocket_error(const std::error_code& code)
}
}
-/*
- Restart the websocket connection
-*/
-void tipi_card_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- open_websocket();
-}
-
-
void tipi_card_device::websocket_closed(int i, const std::string& msg)
{
LOG("Closing connection\n");
@@ -573,7 +564,7 @@ void tipi_card_device::device_start()
save_item(NAME(m_rc));
save_item(NAME(m_lasttc));
- m_restart_timer = timer_alloc(0);
+ m_restart_timer = timer_alloc(FUNC(tipi_card_device::open_websocket), this);
m_rpiconn = (m_rpi->exists());
}
@@ -586,7 +577,7 @@ void tipi_card_device::device_reset()
m_dsr = false;
m_portaccess = false;
if (!m_rpiconn) LOGMASKED(LOG_CONFIG, "No Raspberry Pi connected\n");
- open_websocket();
+ open_websocket(0);
m_connected = false;
m_lasttc = 0;
m_attempts = 5;
diff --git a/src/devices/bus/ti99/peb/tipi.h b/src/devices/bus/ti99/peb/tipi.h
index 485ee7139a2..f0fb6753758 100644
--- a/src/devices/bus/ti99/peb/tipi.h
+++ b/src/devices/bus/ti99/peb/tipi.h
@@ -51,8 +51,7 @@ private:
void websocket_incoming(std::shared_ptr<webpp::ws_client::Message> message);
void websocket_error(const std::error_code& code);
void websocket_closed(int i, const std::string& msg);
- void open_websocket();
- void device_timer(emu_timer &timer, device_timer_id id, int param);
+ TIMER_CALLBACK_MEMBER(open_websocket);
void send(const char* message);
void send(u8* message, int len);
diff --git a/src/devices/bus/vcs/dpc.cpp b/src/devices/bus/vcs/dpc.cpp
index 26f790e754b..4e6989bf86a 100644
--- a/src/devices/bus/vcs/dpc.cpp
+++ b/src/devices/bus/vcs/dpc.cpp
@@ -2,7 +2,6 @@
// copyright-holders:Fabio Priuli
/***************************************************************************
-
Atari 2600 cart with DPC chip (Pitfall II)
***************************************************************************/
@@ -32,7 +31,7 @@ dpc_device::dpc_device(const machine_config& mconfig, const char* tag, device_t*
void dpc_device::device_start()
{
- m_oscillator = timer_alloc(TIMER_OSC);
+ m_oscillator = timer_alloc(FUNC(dpc_device::oscillator_tick), this);
m_oscillator->reset();
save_item(STRUCT_MEMBER(m_df, top));
@@ -52,7 +51,7 @@ void dpc_device::device_start()
void dpc_device::device_reset()
{
- for (auto & elem : m_df)
+ for (df_t & elem : m_df)
{
elem.osc_clk = 0;
elem.flag = 0;
@@ -88,20 +87,16 @@ void dpc_device::decrement_counter(uint8_t data_fetcher)
//-------------------------------------------------
-// device_timer - handler timer events
+// oscillator_tick
//-------------------------------------------------
-void dpc_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(dpc_device::oscillator_tick)
{
- if (id == TIMER_OSC)
+ for (int data_fetcher = 5; data_fetcher < 8; data_fetcher++)
{
- // callback
- for (int data_fetcher = 5; data_fetcher < 8; data_fetcher++)
+ if (m_df[data_fetcher].osc_clk)
{
- if (m_df[data_fetcher].osc_clk)
- {
- decrement_counter(data_fetcher);
- }
+ decrement_counter(data_fetcher);
}
}
}
diff --git a/src/devices/bus/vcs/dpc.h b/src/devices/bus/vcs/dpc.h
index 40dd844e800..1b339c98515 100644
--- a/src/devices/bus/vcs/dpc.h
+++ b/src/devices/bus/vcs/dpc.h
@@ -11,9 +11,7 @@
// TYPE DEFINITIONS
//**************************************************************************
-// TO DO: DPC should be made a separate device!
-
-// m_dpc.oscillator = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(a2600_state::modeDPC_timer_callback),this));
+// TODO: DPC should be made a separate device
class dpc_device : public device_t
{
@@ -27,7 +25,11 @@ public:
virtual void write(offs_t offset, uint8_t data);
protected:
- static constexpr device_timer_id TIMER_OSC = 0;
+ // device-level overrides
+ virtual void device_start() override;
+ virtual void device_reset() override;
+
+ TIMER_CALLBACK_MEMBER(oscillator_tick);
struct df_t {
uint8_t top;
@@ -39,11 +41,6 @@ protected:
uint8_t osc_clk; /* Only used by data fetchers 5,6, and 7 */
};
- // device-level overrides
- virtual void device_start() override;
- virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
df_t m_df[8];
uint8_t m_movamt;
uint8_t m_latch_62;
diff --git a/src/devices/bus/vip/vp550.cpp b/src/devices/bus/vip/vp550.cpp
index 66a00dbfebd..1135b1b9f9d 100644
--- a/src/devices/bus/vip/vp550.cpp
+++ b/src/devices/bus/vip/vp550.cpp
@@ -4,40 +4,18 @@
RCA VIP Super Sound System VP550 emulation
-**********************************************************************/
-
-/*
-
- TODO:
+ TODO: Implement VP551 variant
- - VP551
-
-*/
+**********************************************************************/
#include "emu.h"
#include "vp550.h"
-
#include "speaker.h"
+#define VERBOSE (0)
+#include "logmacro.h"
-//**************************************************************************
-// MACROS / CONSTANTS
-//**************************************************************************
-
-#define LOG 0
-
-
-#define CDP1863_A_TAG "u1"
-#define CDP1863_B_TAG "u2"
-
-
-enum
-{
- CHANNEL_A = 0,
- CHANNEL_B
-};
-
//**************************************************************************
// DEVICE DEFINITIONS
@@ -47,20 +25,20 @@ DEFINE_DEVICE_TYPE(VP550, vp550_device, "vp550", "VP-550 Super Sound")
//-------------------------------------------------
-// machine_config( vp550 )
+// device_add_mconfig
//-------------------------------------------------
void vp550_device::device_add_mconfig(machine_config &config)
{
SPEAKER(config, "mono").front_center();
- CDP1863(config, m_pfg_a, 0);
- m_pfg_a->set_clock2(0);
- m_pfg_a->add_route(ALL_OUTPUTS, "mono", 1.0);
+ CDP1863(config, m_pfg[0], 0);
+ m_pfg[0]->set_clock2(0);
+ m_pfg[0]->add_route(ALL_OUTPUTS, "mono", 1.0);
- CDP1863(config, m_pfg_b, 0);
- m_pfg_b->set_clock2(0);
- m_pfg_b->add_route(ALL_OUTPUTS, "mono", 1.0);
+ CDP1863(config, m_pfg[1], 0);
+ m_pfg[1]->set_clock2(0);
+ m_pfg[1]->add_route(ALL_OUTPUTS, "mono", 1.0);
}
@@ -76,8 +54,7 @@ void vp550_device::device_add_mconfig(machine_config &config)
vp550_device::vp550_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, VP550, tag, owner, clock),
device_vip_expansion_card_interface(mconfig, *this),
- m_pfg_a(*this, CDP1863_A_TAG),
- m_pfg_b(*this, CDP1863_B_TAG),
+ m_pfg(*this, "u%u", 1U),
m_sync_timer(nullptr)
{
}
@@ -90,19 +67,19 @@ vp550_device::vp550_device(const machine_config &mconfig, const char *tag, devic
void vp550_device::device_start()
{
// allocate timers
- m_sync_timer = timer_alloc();
+ m_sync_timer = timer_alloc(FUNC(vp550_device::sync_tick), this);
m_sync_timer->adjust(attotime::from_hz(50), 0, attotime::from_hz(50));
m_sync_timer->enable(0);
}
//-------------------------------------------------
-// device_timer - handler timer events
+// sync_timer - fire an interrupt on host
//-------------------------------------------------
-void vp550_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(vp550_device::sync_tick)
{
- if (LOG) logerror("VP550 '%s' Interrupt\n", tag());
+ LOG("VP550 '%s' Interrupt\n", tag());
m_slot->interrupt_w(ASSERT_LINE);
}
@@ -120,8 +97,8 @@ void vp550_device::vip_program_w(offs_t offset, uint8_t data, int cdef, int *min
switch (offset & 0x03)
{
- case 1: m_pfg_a->str_w(data); break;
- case 2: m_pfg_b->str_w(data); break;
+ case 1: m_pfg[0]->str_w(data); break;
+ case 2: m_pfg[1]->str_w(data); break;
case 3: octave_w(data); break;
}
@@ -143,7 +120,7 @@ void vp550_device::vip_sc_w(int n, int sc)
{
if (BIT(sc, 1))
{
- if (LOG) logerror("VP550 '%s' Clear Interrupt\n", tag());
+ LOG("VP550 '%s' Clear Interrupt\n", tag());
m_slot->interrupt_w(CLEAR_LINE);
}
@@ -156,8 +133,8 @@ void vp550_device::vip_sc_w(int n, int sc)
void vp550_device::vip_q_w(int state)
{
- m_pfg_a->oe_w(state);
- m_pfg_b->oe_w(state);
+ m_pfg[0]->oe_w(state);
+ m_pfg[1]->oe_w(state);
}
@@ -169,8 +146,8 @@ void vp550_device::vip_run_w(int state)
{
if (!state)
{
- m_pfg_a->reset();
- m_pfg_b->reset();
+ m_pfg[0]->reset();
+ m_pfg[1]->reset();
}
}
@@ -184,24 +161,14 @@ void vp550_device::octave_w(uint8_t data)
int channel = (data >> 2) & 0x03;
int clock2 = 0;
- if (data & 0x10)
+ if (BIT(data, 4))
{
- switch (data & 0x03)
- {
- case 0: clock2 = m_slot->clock() / 8; break;
- case 1: clock2 = m_slot->clock() / 4; break;
- case 2: clock2 = m_slot->clock() / 2; break;
- case 3: clock2 = m_slot->clock(); break;
- }
+ clock2 = m_slot->clock() >> (3 - (data & 0x03));
}
- switch (channel)
- {
- case CHANNEL_A: m_pfg_a->set_clk2(clock2); break;
- case CHANNEL_B: m_pfg_b->set_clk2(clock2); break;
- }
+ m_pfg[BIT(data, 2)]->set_clk2(clock2);
- if (LOG) logerror("VP550 '%s' Clock %c: %u Hz\n", tag(), 'A' + channel, clock2);
+ LOG("VP550 '%s' Clock %c: %u Hz\n", tag(), 'A' + channel, clock2);
}
@@ -211,11 +178,10 @@ void vp550_device::octave_w(uint8_t data)
void vp550_device::vlmna_w(uint8_t data)
{
- if (LOG) logerror("VP550 '%s' A Volume: %u\n", tag(), data & 0x0f);
+ LOG("VP550 '%s' A Volume: %u\n", tag(), data & 0x0f);
- float gain = (data & 0x0f) * 0.0666;
-
- m_pfg_a->set_output_gain(0, gain);
+ float gain = (data & 0x0f) / 15.0f;
+ m_pfg[0]->set_output_gain(0, gain);
}
@@ -225,11 +191,10 @@ void vp550_device::vlmna_w(uint8_t data)
void vp550_device::vlmnb_w(uint8_t data)
{
- if (LOG) logerror("VP550 '%s' B Volume: %u\n", tag(), data & 0x0f);
-
- float gain = (data & 0x0f) * 0.0666;
+ LOG("VP550 '%s' B Volume: %u\n", tag(), data & 0x0f);
- m_pfg_b->set_output_gain(0, gain);
+ float gain = (data & 0x0f) / 15.0f;
+ m_pfg[1]->set_output_gain(0, gain);
}
@@ -239,7 +204,7 @@ void vp550_device::vlmnb_w(uint8_t data)
void vp550_device::sync_w(uint8_t data)
{
- if (LOG) logerror("VP550 '%s' Interrupt Enable: %u\n", tag(), BIT(data, 0));
+ LOG("VP550 '%s' Interrupt Enable: %u\n", tag(), BIT(data, 0));
m_sync_timer->enable(BIT(data, 0));
}
diff --git a/src/devices/bus/vip/vp550.h b/src/devices/bus/vip/vp550.h
index 1a777ebebbb..c7f629bbf9d 100644
--- a/src/devices/bus/vip/vp550.h
+++ b/src/devices/bus/vip/vp550.h
@@ -32,7 +32,6 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_add_mconfig(machine_config &config) override;
// device_vip_expansion_card_interface overrides
@@ -41,14 +40,15 @@ protected:
virtual void vip_q_w(int state) override;
virtual void vip_run_w(int state) override;
+ TIMER_CALLBACK_MEMBER(sync_tick);
+
private:
void octave_w(uint8_t data);
void vlmna_w(uint8_t data);
void vlmnb_w(uint8_t data);
void sync_w(uint8_t data);
- required_device<cdp1863_device> m_pfg_a;
- required_device<cdp1863_device> m_pfg_b;
+ required_device_array<cdp1863_device, 2> m_pfg;
// timers
emu_timer *m_sync_timer;
diff --git a/src/devices/bus/vme/vme_cp31.cpp b/src/devices/bus/vme/vme_cp31.cpp
index 9f5d5d614b0..2a59f92b7ed 100644
--- a/src/devices/bus/vme/vme_cp31.cpp
+++ b/src/devices/bus/vme/vme_cp31.cpp
@@ -288,7 +288,7 @@ vme_cp31_card_device::vme_cp31_card_device(const machine_config &mconfig, const
void vme_cp31_card_device::device_start()
{
- m_bus_error_timer = timer_alloc(0);
+ m_bus_error_timer = timer_alloc(FUNC(vme_cp31_card_device::bus_error_off), this);
}
void vme_cp31_card_device::device_reset()
@@ -314,7 +314,7 @@ void vme_cp31_card_device::device_reset()
&m_rom_shadow_tap);
}
-void vme_cp31_card_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(vme_cp31_card_device::bus_error_off)
{
m_bus_error = false;
}
diff --git a/src/devices/bus/vme/vme_cp31.h b/src/devices/bus/vme/vme_cp31.h
index 5921eef9fe8..38ff78d69b3 100644
--- a/src/devices/bus/vme/vme_cp31.h
+++ b/src/devices/bus/vme/vme_cp31.h
@@ -32,7 +32,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
virtual ioport_constructor device_input_ports() const override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(bus_error_off);
private:
required_device<m68000_base_device> m_maincpu;
diff --git a/src/devices/bus/vme/vme_fccpu20.cpp b/src/devices/bus/vme/vme_fccpu20.cpp
index 084e5ba14e5..c85f6fd6a7f 100644
--- a/src/devices/bus/vme/vme_fccpu20.cpp
+++ b/src/devices/bus/vme/vme_fccpu20.cpp
@@ -204,11 +204,7 @@
#define LOGSETUP(...) LOGMASKED(LOG_SETUP, __VA_ARGS__)
#define LOGINT(...) LOGMASKED(LOG_INT, __VA_ARGS__)
-#ifdef _MSC_VER
-#define FUNCNAME __func__
-#else
-#define FUNCNAME __PRETTY_FUNCTION__
-#endif
+
//**************************************************************************
// GLOBAL VARIABLES
@@ -387,7 +383,7 @@ vme_fccpu20_device::vme_fccpu20_device(const machine_config &mconfig, device_typ
, m_mpcc3 (*this, "mpcc3")
, m_board_id(board_id)
{
- LOG("%s\n", FUNCNAME);
+ LOG("vme_fccpu20_device ctor\n");
}
//**************************************************************************
@@ -396,67 +392,61 @@ vme_fccpu20_device::vme_fccpu20_device(const machine_config &mconfig, device_typ
vme_fccpu20_card_device::vme_fccpu20_card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: vme_fccpu20_card_device(mconfig, VME_FCCPU20, tag, owner, clock)
{
- LOG("%s %s\n", tag, FUNCNAME);
+ LOG("vme_fccpu20_card_device ctor: %s\n", tag);
}
vme_fccpu21s_card_device::vme_fccpu21s_card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: vme_fccpu21s_card_device(mconfig, VME_FCCPU21S, tag, owner, clock)
{
- LOG("%s %s\n", tag, FUNCNAME);
+ LOG("vme_fccpu21s_card_device ctor: %s\n", tag);
}
vme_fccpu21_card_device::vme_fccpu21_card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: vme_fccpu21_card_device(mconfig, VME_FCCPU21, tag, owner, clock)
{
- LOG("%s %s\n", tag, FUNCNAME);
+ LOG("vme_fccpu21_card_device ctor: %s\n", tag);
}
vme_fccpu21a_card_device::vme_fccpu21a_card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: vme_fccpu21a_card_device(mconfig, VME_FCCPU21A, tag, owner, clock)
{
- LOG("%s %s\n", tag, FUNCNAME);
+ LOG("vme_fccpu21a_card_device ctor: %s\n", tag);
}
// TODO: Change to 2MB on board RAM and move FLME memory and find/verify memory map
vme_fccpu21ya_card_device::vme_fccpu21ya_card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: vme_fccpu21ya_card_device(mconfig, VME_FCCPU21YA, tag, owner, clock)
{
- LOG("%s %s\n", tag, FUNCNAME);
+ LOG("vme_fccpu21ya_card_device ctor: %s\n", tag);
}
vme_fccpu21b_card_device::vme_fccpu21b_card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: vme_fccpu21b_card_device(mconfig, VME_FCCPU21B, tag, owner, clock)
{
- LOG("%s %s\n", tag, FUNCNAME);
+ LOG("vme_fccpu21b_card_device ctor: %s\n", tag);
}
// TODO: Change to 2MB on board RAM and move FLME memory and find/verify memory map
vme_fccpu21yb_card_device::vme_fccpu21yb_card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: vme_fccpu21yb_card_device(mconfig, VME_FCCPU21YB, tag, owner, clock)
{
- LOG("%s %s\n", tag, FUNCNAME);
+ LOG("vme_fccpu21yb_card_device ctor: %s\n", tag);
}
-enum
-{
- TIMER_ID_BUS_GRANT
-};
-
-/* Start it up */
void vme_fccpu20_device::device_start()
{
- LOG("%s\n", FUNCNAME);
+ LOG("vme_fccpu20_device::device_start\n");
- save_pointer (NAME (m_sysrom), sizeof(m_sysrom));
- save_pointer (NAME (m_sysram), sizeof(m_sysram));
+ save_pointer(NAME(m_sysrom), sizeof(m_sysrom));
+ save_pointer(NAME(m_sysram), sizeof(m_sysram));
// save_item(NAME(m_board_id)); // TODO: Save this "non base type" item
/* TODO: setup this RAM from (not yet) optional SRAM-2x board and also support 2MB versions */
//m_maincpu->space(AS_PROGRAM).install_ram(0x80000, m_ram->size() + 0x7ffff, m_ram->pointer());
/* Setup pointer to bootvector in ROM for bootvector handler bootvect_r */
- m_sysrom = (uint32_t*)(memregion ("roms")->base());
+ m_sysrom = (uint32_t*)(memregion("roms")->base());
#if 0 // TODO: Setup VME access handlers for shared memory area
uint32_t base = 0xFFFF5000;
@@ -465,43 +455,36 @@ void vme_fccpu20_device::device_start()
m_vme->install_device(base + 2, base + 3, // Channel B - Control
read8_delegate(*subdevice<z80sio_device>("pit"), FUNC(z80sio_device::cb_r)), write8_delegate(*subdevice<z80sio_device>("pit"), FUNC(z80sio_device::cb_w)), 0x00ff);
#endif
- m_arbiter_start = timer_alloc(TIMER_ID_BUS_GRANT);
+ m_arbiter_start = timer_alloc(FUNC(vme_fccpu20_device::grant_bus), this);
}
void vme_fccpu20_device::device_reset()
{
- LOG("%s\n", FUNCNAME);
+ LOG("vme_fccpu20_device::device_reset\n");
/* We need to delay the static bus grant signal until we have it from the VME interface or MAME supports bus arbitration */
- m_arbiter_start->adjust(attotime::from_msec(10), TIMER_ID_BUS_GRANT, attotime::never);
+ m_arbiter_start->adjust(attotime::from_msec(10));
}
//-------------------------------------------------
-// device_timer - handler timer events
+// grant_bus
//-------------------------------------------------
-void vme_fccpu20_device::device_timer (emu_timer &timer, device_timer_id id, int param)
+
+TIMER_CALLBACK_MEMBER(vme_fccpu20_device::grant_bus)
{
- switch(id)
- {
- case TIMER_ID_BUS_GRANT:
- m_pit->h1_w(ASSERT_LINE); // Grant bus always
- break;
- default:
- LOG("Unhandled Timer ID %d\n", id);
- break;
- }
+ m_pit->h1_w(ASSERT_LINE); // Grant bus always
}
/* Boot vector handler, the PCB hardwires the first 8 bytes from 0xff800000 to 0x0 at reset*/
uint32_t vme_fccpu20_device::bootvect_r(offs_t offset)
{
- LOG("%s\n", FUNCNAME);
+ LOG("vme_fccpu20_device::bootvect_r\n");
return m_sysrom[offset];
}
void vme_fccpu20_device::bootvect_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
- LOG("%s\n", FUNCNAME);
+ LOG("vme_fccpu20_device::bootvect_w\n");
m_sysram[offset % std::size(m_sysram)] &= ~mem_mask;
m_sysram[offset % std::size(m_sysram)] |= (data & mem_mask);
m_sysrom = &m_sysram[0]; // redirect all upcoming accesses to masking RAM until reset.
@@ -509,29 +492,29 @@ void vme_fccpu20_device::bootvect_w(offs_t offset, uint32_t data, uint32_t mem_m
WRITE_LINE_MEMBER(vme_fccpu20_device::bim_irq_callback)
{
- LOGINT("%s(%02x)\n", FUNCNAME, state);
+ LOGINT("vme_fccpu20_device::bim_irq_callback(%02x)\n", state);
- bim_irq_state = state;
- bim_irq_level = m_bim->get_irq_level();
- LOGINT(" - BIM irq level %s\n", bim_irq_level == CLEAR_LINE ? "Cleared" : "Asserted");
+ m_bim_irq_state = state;
+ m_bim_irq_level = m_bim->get_irq_level();
+ LOGINT(" - BIM irq level %s\n", m_bim_irq_level == CLEAR_LINE ? "Cleared" : "Asserted");
update_irq_to_maincpu();
}
void vme_fccpu20_device::update_irq_to_maincpu()
{
- LOGINT("%s()\n", FUNCNAME);
- LOGINT(" - bim_irq_level: %02x\n", bim_irq_level);
- LOGINT(" - bim_irq_state: %02x\n", bim_irq_state);
- switch (bim_irq_level & 0x07)
+ LOGINT("vme_fccpu20_device::update_irq_to_maincpu()\n");
+ LOGINT(" - m_bim_irq_level: %02x\n", m_bim_irq_level);
+ LOGINT(" - m_bim_irq_state: %02x\n", m_bim_irq_state);
+ switch (m_bim_irq_level & 0x07)
{
- case 1: m_maincpu->set_input_line(M68K_IRQ_1, bim_irq_state); break;
- case 2: m_maincpu->set_input_line(M68K_IRQ_2, bim_irq_state); break;
- case 3: m_maincpu->set_input_line(M68K_IRQ_3, bim_irq_state); break;
- case 4: m_maincpu->set_input_line(M68K_IRQ_4, bim_irq_state); break;
- case 5: m_maincpu->set_input_line(M68K_IRQ_5, bim_irq_state); break;
- case 6: m_maincpu->set_input_line(M68K_IRQ_6, bim_irq_state); break;
- case 7: m_maincpu->set_input_line(M68K_IRQ_7, bim_irq_state); break;
- default: logerror("Programmatic error in %s, please report\n", FUNCNAME);
+ case 1: m_maincpu->set_input_line(M68K_IRQ_1, m_bim_irq_state); break;
+ case 2: m_maincpu->set_input_line(M68K_IRQ_2, m_bim_irq_state); break;
+ case 3: m_maincpu->set_input_line(M68K_IRQ_3, m_bim_irq_state); break;
+ case 4: m_maincpu->set_input_line(M68K_IRQ_4, m_bim_irq_state); break;
+ case 5: m_maincpu->set_input_line(M68K_IRQ_5, m_bim_irq_state); break;
+ case 6: m_maincpu->set_input_line(M68K_IRQ_6, m_bim_irq_state); break;
+ case 7: m_maincpu->set_input_line(M68K_IRQ_7, m_bim_irq_state); break;
+ default: logerror("Unsupported BIM IRQ line value 0 in vme_fccpu20_device::update_irq_to_maincpu, please report\n");
}
}
@@ -557,14 +540,14 @@ void vme_fccpu20_device::update_irq_to_maincpu()
uint8_t vme_fccpu20_device::pita_r()
{
- LOG("%s\n", FUNCNAME);
+ LOG("vme_fccpu20_device::pita_r\n");
return FORCEBUG | BR7N9600;
}
/* Enabling/Disabling of VME IRQ 1-7 */
uint8_t vme_fccpu20_device::pitb_r()
{
- LOG("%s\n", FUNCNAME);
+ LOG("vme_fccpu20_device::pitb_r\n");
return 0xff;
}
@@ -574,7 +557,7 @@ uint8_t vme_fccpu20_device::pitc_r()
{
uint8_t board_id = 0;
- LOG("%s Board id:%02x\n", FUNCNAME, m_board_id);
+ LOG("vme_fccpu20_device::pitc_r Board id:%02x\n", m_board_id);
switch (m_board_id)
{
@@ -589,8 +572,9 @@ uint8_t vme_fccpu20_device::pitc_r()
case cpu21:
board_id = CPU21;
break;
- default: logerror("Attempt to set unknown board type %02x, defaulting to CPU20\n", board_id);
+ default: logerror("Attempted to set unknown board type %02x, defaulting to CPU20\n", board_id);
board_id = CPU20;
+ break;
}
return board_id | 0xbf;
@@ -615,7 +599,7 @@ ROM_END
const tiny_rom_entry *vme_fccpu20_device::device_rom_region() const
{
- LOG("%s\n", FUNCNAME);
+ LOG("vme_fccpu20_device::device_rom_region\n");
switch (m_board_id)
{
@@ -626,7 +610,7 @@ const tiny_rom_entry *vme_fccpu20_device::device_rom_region() const
case cpu21yb: return ROM_NAME( fccpu21yb ); break;
case cpu21s: return ROM_NAME( fccpu21s ); break;
case cpu21: return ROM_NAME( fccpu21 ); break;
- default: logerror("Attempt to get rom set for unknown board type %02x, defaulting to CPU20\n", m_board_id);
+ default: logerror("Attempted to get rom set for unknown board type %02x, defaulting to CPU20\n", m_board_id);
return ROM_NAME( fccpu20 );
}
}
diff --git a/src/devices/bus/vme/vme_fccpu20.h b/src/devices/bus/vme/vme_fccpu20.h
index ae26d07eccc..42569041f87 100644
--- a/src/devices/bus/vme/vme_fccpu20.h
+++ b/src/devices/bus/vme/vme_fccpu20.h
@@ -43,14 +43,15 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// optional information overrides
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
- uint8_t bim_irq_state;
- int bim_irq_level;
+ TIMER_CALLBACK_MEMBER(grant_bus);
+
+ int m_bim_irq_state;
+ uint8_t m_bim_irq_level;
emu_timer *m_arbiter_start; // Need a startup delay because it is hooked up to the sense inputs of the PIT
diff --git a/src/devices/bus/vme/vme_hcpu30.cpp b/src/devices/bus/vme/vme_hcpu30.cpp
index 7aa814794e7..a68cdb319f2 100644
--- a/src/devices/bus/vme/vme_hcpu30.cpp
+++ b/src/devices/bus/vme/vme_hcpu30.cpp
@@ -44,12 +44,6 @@
#define LOGSETUP(...) LOGMASKED(LOG_SETUP, __VA_ARGS__)
#define LOGINT(...) LOGMASKED(LOG_INT, __VA_ARGS__)
-#ifdef _MSC_VER
-#define FUNCNAME __func__
-#else
-#define FUNCNAME __PRETTY_FUNCTION__
-#endif
-
#define DUSCC_CLOCK XTAL(14'745'600) /* XXX Unverified */
#define RS232P1_TAG "rs232p1"
@@ -117,24 +111,24 @@ void vme_hcpu30_card_device::oscpu_space_map(address_map &map)
static INPUT_PORTS_START(hcpu30)
PORT_START("SA1")
- PORT_DIPNAME(0x03, 0x00, "Console port speed")
+ PORT_DIPNAME(0x03, 0x00, "Console Port Speed")
PORT_DIPSETTING(0x00, "9600")
PORT_DIPSETTING(0x01, "19200")
PORT_DIPSETTING(0x02, "38400")
PORT_DIPSETTING(0x03, "4800")
- PORT_DIPNAME(0x04, 0x04, "Boot into...")
+ PORT_DIPNAME(0x04, 0x04, "Boot Mode")
PORT_DIPSETTING(0x00, "UNIX")
PORT_DIPSETTING(0x04, "Monitor")
PORT_DIPNAME(0x08, 0x00, "Undefined 1")
PORT_DIPSETTING(0x00, "Off")
PORT_DIPSETTING(0x08, "On")
- PORT_DIPNAME(0x10, 0x00, "VME bus width")
+ PORT_DIPNAME(0x10, 0x00, "VME Bus Width")
PORT_DIPSETTING(0x00, "32 bits")
PORT_DIPSETTING(0x10, "16 bits")
- PORT_DIPNAME(0x20, 0x00, "VME bus free")
+ PORT_DIPNAME(0x20, 0x00, "VME Bus Free")
PORT_DIPSETTING(0x00, "ROR")
PORT_DIPSETTING(0x20, "REC")
- PORT_DIPNAME(0x40, 0x00, "Cache burst mode")
+ PORT_DIPNAME(0x40, 0x00, "Cache Burst Mode")
PORT_DIPSETTING(0x00, "Off")
PORT_DIPSETTING(0x40, "On")
PORT_DIPNAME(0x80, 0x00, "Undefined 2")
@@ -265,20 +259,20 @@ uint32_t vme_hcpu30_card_device::rtc_r(offs_t offset)
if (offset == 0)
{
data &= 0xffffff;
- data |= ioport("SA1")->read() << 24;
+ data |= m_dips->read() << 24;
}
if (offset == 7)
{
data &= 0xff00ffff;
data |= (m_cent_status_in->read() ^ 0xff) << 16;
}
- LOG("%s(%02x)==%08x%s\n", FUNCNAME, offset, data, m_rtc_hack ? " hacked" : "");
+ LOG("vme_hcpu30_card_device::rtc_r(%02x) == %08x %s\n", offset, data, m_rtc_hack ? "(hacked)" : "");
return data;
}
void vme_hcpu30_card_device::rtc_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
- LOG("%s(%02x,%08x)<-%08x\n", FUNCNAME, offset, mem_mask, data);
+ LOG("vme_hcpu30_card_device::rtc_w(%02x, %08x)<-%08x\n", offset, mem_mask, data);
if (mem_mask == 0xffff0000)
{
m_rtc->write(offset << 1, (data >> 4) & 15);
@@ -293,7 +287,7 @@ void vme_hcpu30_card_device::rtc_w(offs_t offset, uint32_t data, uint32_t mem_ma
m_rtc->write((offset << 1) + 1, (data >> 20) & 15);
m_rtc_reg[(offset << 1) + 1] = (data >> 20) & 15;
}
- if (offset < 6 || (offset == 6 && mem_mask == 0xffff0000)) m_rtc_hack = true; else m_rtc_hack = false;
+ m_rtc_hack = (offset < 6 || (offset == 6 && mem_mask == 0xffff0000));
}
uint32_t vme_hcpu30_card_device::dma_r(offs_t offset)
@@ -333,46 +327,46 @@ uint32_t vme_hcpu30_card_device::trap_r(offs_t offset, uint32_t mem_mask)
void vme_hcpu30_card_device::trap_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
- LOG("%s(%08x,%08X)\n", FUNCNAME, offset << 2, data);
+ LOG("vme_hcpu30_card_device::trap_w(%08x, %08X)\n", offset << 2, data);
if (!machine().side_effects_disabled()) set_bus_error((offset << 2), false, mem_mask);
}
-// AH?
+// Active High?
WRITE_LINE_MEMBER(vme_hcpu30_card_device::dusirq_callback)
{
- LOGINT("%s(%02x)\n", FUNCNAME, state);
- m_irq_state &= ~(1 << (8+4));
- m_irq_state |= (state << (8+4));
+ LOGINT("vme_hcpu30_card_device::dusirq_callback(%02x)\n", state);
+ m_irq_state &= ~(1 << 12);
+ m_irq_state |= (state << 12);
}
-// AL?
+// Active Low?
WRITE_LINE_MEMBER(vme_hcpu30_card_device::scsiirq_callback)
{
- LOGINT("%s(%02x)\n", FUNCNAME, state);
+ LOGINT("vme_hcpu30_card_device::scsiirq_callback(%02x)\n", state);
m_irq_state &= ~(1 << 8);
m_irq_state |= (state << 8);
}
-// AL?
+// Active Low?
WRITE_LINE_MEMBER(vme_hcpu30_card_device::scsidrq_callback)
{
- LOGINT("%s(%02x)\n", FUNCNAME, state);
+ LOGINT("vme_hcpu30_card_device::scsidrq_callback(%02x)\n", state);
m_irq_state &= ~(1 << 7);
m_irq_state |= (state << 7);
}
-// AL?
+// Active Low?
WRITE_LINE_MEMBER(vme_hcpu30_card_device::fdcirq_callback)
{
- LOGINT("%s(%02x)\n", FUNCNAME, state);
+ LOGINT("vme_hcpu30_card_device::fdcirq_callback(%02x)\n", state);
m_irq_state &= ~(1 << (8+2));
m_irq_state |= (state << (8+2));
}
-// AL?
+// Active Low?
WRITE_LINE_MEMBER(vme_hcpu30_card_device::fdcdrq_callback)
{
- LOGINT("%s(%02x)\n", FUNCNAME, state);
+ LOGINT("vme_hcpu30_card_device::fdcdrq_callback(%02x)\n", state);
#if 0
if (state)
{
@@ -455,12 +449,10 @@ void vme_hcpu30_card_device::update_030_irq(int irq, line_state state)
// 15 - INTENA* "enable input" pin of LS148 priority encoder
void vme_hcpu30_card_device::irq_mask_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
- uint16_t diff;
-
data >>= 16;
- diff = data ^ m_irq_mask;
+ uint16_t diff = data ^ m_irq_mask;
- LOG("%s(%04x,%04x)\n", FUNCNAME, data, diff);
+ LOG("vme_hcpu30_card_device::irq_mask_w(%04x,%04x)\n", data, diff);
if (BIT(diff, 15))
{
@@ -551,8 +543,9 @@ vme_hcpu30_card_device::vme_hcpu30_card_device(const machine_config &mconfig, de
, m_mailbox(*this, "mailbox")
, m_p_ram(*this, "dram")
, m_sysrom(*this, "user1")
+ , m_dips(*this, "SA1")
{
- LOG("%s %s\n", tag, FUNCNAME);
+ LOG("vme_hcpu30_card_device::vme_hcpu30_card_device ctor: %s\n", tag);
m_slot = 1;
}
@@ -565,16 +558,16 @@ vme_hcpu30_card_device::vme_hcpu30_card_device(const machine_config &mconfig, co
void vme_hcpu30_card_device::device_start()
{
- LOG("%s %s\n", tag(), FUNCNAME);
+ LOG("vme_hcpu30_card_device::device_start %s\n", tag());
- m_bus_error_timer = timer_alloc(0);
+ m_bus_error_timer = timer_alloc(FUNC(vme_hcpu30_card_device::bus_error_off), this);
}
void vme_hcpu30_card_device::device_reset()
{
address_space &program = m_maincpu->space(AS_PROGRAM);
- LOG("%s %s\n", tag(), FUNCNAME);
+ LOG("vme_hcpu30_card_device::device_reset %s\n", tag());
m_irq_state = (1 << 10) | (1 << 6); // fdcirq | irq30*
m_irq_mask = 0;
m_rtc_hack = false;
@@ -600,7 +593,7 @@ void vme_hcpu30_card_device::device_reset()
&m_rom_shadow_tap);
}
-void vme_hcpu30_card_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(vme_hcpu30_card_device::bus_error_off)
{
m_bus_error = false;
}
diff --git a/src/devices/bus/vme/vme_hcpu30.h b/src/devices/bus/vme/vme_hcpu30.h
index 656e8b716b6..14c5e0059b0 100644
--- a/src/devices/bus/vme/vme_hcpu30.h
+++ b/src/devices/bus/vme/vme_hcpu30.h
@@ -36,7 +36,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
virtual ioport_constructor device_input_ports() const override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(bus_error_off);
private:
required_device<m68000_base_device> m_maincpu;
@@ -53,6 +54,7 @@ private:
required_shared_ptr<uint32_t> m_mailbox;
required_shared_ptr<uint32_t> m_p_ram;
required_region_ptr<uint32_t> m_sysrom;
+ required_ioport m_dips;
DECLARE_WRITE_LINE_MEMBER(dusirq_callback);
DECLARE_WRITE_LINE_MEMBER(scsiirq_callback);
diff --git a/src/devices/bus/vsmile/keyboard.cpp b/src/devices/bus/vsmile/keyboard.cpp
index e91ae85c967..2c2501ecd8e 100644
--- a/src/devices/bus/vsmile/keyboard.cpp
+++ b/src/devices/bus/vsmile/keyboard.cpp
@@ -67,12 +67,9 @@ void vsmile_keyboard_device::device_start()
{
vsmile_ctrl_device_base::device_start();
- m_idle_timer = machine().scheduler().timer_alloc(
- timer_expired_delegate(FUNC(vsmile_keyboard_device::handle_idle), this));
- m_hello_timer = machine().scheduler().timer_alloc(
- timer_expired_delegate(FUNC(vsmile_keyboard_device::handle_hello), this));
- m_hello_timeout_timer = machine().scheduler().timer_alloc(
- timer_expired_delegate(FUNC(vsmile_keyboard_device::handle_hello_timeout), this));
+ m_idle_timer = timer_alloc(FUNC(vsmile_keyboard_device::handle_idle), this);
+ m_hello_timer = timer_alloc(FUNC(vsmile_keyboard_device::handle_hello), this);
+ m_hello_timeout_timer = timer_alloc(FUNC(vsmile_keyboard_device::handle_hello_timeout), this);
save_item(NAME(m_state));
save_item(NAME(m_sent_joy));
diff --git a/src/devices/bus/vsmile/pad.cpp b/src/devices/bus/vsmile/pad.cpp
index 5cf7940ab39..7383de09475 100644
--- a/src/devices/bus/vsmile/pad.cpp
+++ b/src/devices/bus/vsmile/pad.cpp
@@ -49,8 +49,7 @@ void vsmile_pad_device::device_start()
{
vsmile_ctrl_device_base::device_start();
- m_idle_timer = machine().scheduler().timer_alloc(
- timer_expired_delegate(FUNC(vsmile_pad_device::handle_idle), this));
+ m_idle_timer = timer_alloc(FUNC(vsmile_pad_device::handle_idle), this);
m_idle_timer->adjust(attotime::from_seconds(1));
m_sent_joy = 0x0000U;
diff --git a/src/devices/bus/vsmile/vsmile_ctrl.cpp b/src/devices/bus/vsmile/vsmile_ctrl.cpp
index fa937beb1ad..f253e800fab 100644
--- a/src/devices/bus/vsmile/vsmile_ctrl.cpp
+++ b/src/devices/bus/vsmile/vsmile_ctrl.cpp
@@ -115,12 +115,10 @@ vsmile_ctrl_device_base::~vsmile_ctrl_device_base()
void vsmile_ctrl_device_base::device_start()
{
// allocate a timer to limit transmit rate to something realistic
- m_tx_timer = machine().scheduler().timer_alloc(
- timer_expired_delegate(FUNC(vsmile_ctrl_device_base::tx_timer_expired), this));
+ m_tx_timer = timer_alloc(FUNC(vsmile_ctrl_device_base::tx_timer_expired), this);
// allocate a timer for RTS timeouts
- m_rts_timer = machine().scheduler().timer_alloc(
- timer_expired_delegate(FUNC(vsmile_ctrl_device_base::rts_timer_expired), this));
+ m_rts_timer = timer_alloc(FUNC(vsmile_ctrl_device_base::rts_timer_expired), this);
// start with transmit queue empty
m_tx_fifo_head = m_tx_fifo_tail = 0U;
diff --git a/src/devices/bus/vtech/memexp/sdloader.cpp b/src/devices/bus/vtech/memexp/sdloader.cpp
index 1799bac84ba..84df085c86a 100644
--- a/src/devices/bus/vtech/memexp/sdloader.cpp
+++ b/src/devices/bus/vtech/memexp/sdloader.cpp
@@ -130,7 +130,7 @@ void vtech_sdloader_device::device_start()
m_expbank->configure_entry(1, m_ram.get() + 0x18000);
// allocate timer for sdcard
- m_spi_clock = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vtech_sdloader_device::spi_clock), this));
+ m_spi_clock = timer_alloc(FUNC(vtech_sdloader_device::spi_clock), this);
// register for savestates
save_item(NAME(m_spi_clock_state));
diff --git a/src/devices/bus/wswan/rom.cpp b/src/devices/bus/wswan/rom.cpp
index 3f015fbc8e1..2d089989989 100644
--- a/src/devices/bus/wswan/rom.cpp
+++ b/src/devices/bus/wswan/rom.cpp
@@ -89,7 +89,7 @@ void ws_rom_device::device_start()
// Set up RTC timer
if (m_has_rtc)
{
- rtc_timer = timer_alloc(TIMER_RTC);
+ rtc_timer = timer_alloc(FUNC(ws_rom_device::rtc_tick), this);
rtc_timer->adjust(attotime::zero, 0, attotime::from_seconds(1));
}
@@ -196,44 +196,41 @@ void ws_rom_eeprom_device::device_reset()
//-------------------------------------------------
-// device_timer - handler timer events
+// rtc_tick
//-------------------------------------------------
-void ws_rom_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(ws_rom_device::rtc_tick)
{
- if (id == TIMER_RTC)
- {
- // a second passed
- m_rtc_second++;
- if ((m_rtc_second & 0x0f) > 9)
- m_rtc_second = (m_rtc_second & 0xf0) + 0x10;
+ // a second passed
+ m_rtc_second++;
+ if ((m_rtc_second & 0x0f) > 9)
+ m_rtc_second = (m_rtc_second & 0xf0) + 0x10;
- // check for minute passed
- if (m_rtc_second >= 0x60)
- {
- m_rtc_second = 0;
- m_rtc_minute++;
- if ((m_rtc_minute & 0x0f) > 9)
- m_rtc_minute = (m_rtc_minute & 0xf0) + 0x10;
- }
+ // check for minute passed
+ if (m_rtc_second >= 0x60)
+ {
+ m_rtc_second = 0;
+ m_rtc_minute++;
+ if ((m_rtc_minute & 0x0f) > 9)
+ m_rtc_minute = (m_rtc_minute & 0xf0) + 0x10;
+ }
- // check for hour passed
- if (m_rtc_minute >= 0x60)
- {
- m_rtc_minute = 0;
- m_rtc_hour++;
- if ((m_rtc_hour & 0x0f) > 9)
- m_rtc_hour = (m_rtc_hour & 0xf0) + 0x10;
- if (m_rtc_hour == 0x12)
- m_rtc_hour |= 0x80;
- }
+ // check for hour passed
+ if (m_rtc_minute >= 0x60)
+ {
+ m_rtc_minute = 0;
+ m_rtc_hour++;
+ if ((m_rtc_hour & 0x0f) > 9)
+ m_rtc_hour = (m_rtc_hour & 0xf0) + 0x10;
+ if (m_rtc_hour == 0x12)
+ m_rtc_hour |= 0x80;
+ }
- // check for day passed
- if (m_rtc_hour >= 0x24)
- {
- m_rtc_hour = 0;
- m_rtc_day++;
- }
+ // check for day passed
+ if (m_rtc_hour >= 0x24)
+ {
+ m_rtc_hour = 0;
+ m_rtc_day++;
}
}
diff --git a/src/devices/bus/wswan/rom.h b/src/devices/bus/wswan/rom.h
index 6a99f98e3a4..9a47ebf8023 100644
--- a/src/devices/bus/wswan/rom.h
+++ b/src/devices/bus/wswan/rom.h
@@ -23,14 +23,13 @@ public:
virtual void write_io(offs_t offset, u16 data, u16 mem_mask) override;
protected:
- static constexpr device_timer_id TIMER_RTC = 0;
-
ws_rom_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(rtc_tick);
u16 m_io_regs[8];
u32 m_base20, m_base30, m_base40;
diff --git a/src/devices/bus/z88/z88.cpp b/src/devices/bus/z88/z88.cpp
index 65c71c8d686..8a12bb47b82 100644
--- a/src/devices/bus/z88/z88.cpp
+++ b/src/devices/bus/z88/z88.cpp
@@ -26,7 +26,7 @@ DEFINE_DEVICE_TYPE(Z88CART_SLOT, z88cart_slot_device, "z88cart_slot", "Z88 Cartr
//**************************************************************************
-// Z88 cartridges Interface
+// Z88 Cartridge Interface
//**************************************************************************
//-------------------------------------------------
@@ -76,22 +76,19 @@ void z88cart_slot_device::device_start()
// resolve callbacks
m_out_flp_cb.resolve_safe();
- m_flp_timer = timer_alloc(TIMER_FLP_CLEAR);
+ m_flp_timer = timer_alloc(FUNC(z88cart_slot_device::close_flap), this);
m_flp_timer->reset();
}
//-------------------------------------------------
-// device_timer - handler timer events
+// close_flap
//-------------------------------------------------
-void z88cart_slot_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(z88cart_slot_device::close_flap)
{
- if (id == TIMER_FLP_CLEAR)
- {
- // close the flap
- m_out_flp_cb(CLEAR_LINE);
- }
+ // close the flap
+ m_out_flp_cb(CLEAR_LINE);
}
/*-------------------------------------------------
@@ -126,7 +123,7 @@ image_init_result z88cart_slot_device::call_load()
// open the flap
m_out_flp_cb(ASSERT_LINE);
- // setup the timer for close the flap
+ // setup the timer to close the flap
m_flp_timer->adjust(CLOSE_FLAP_TIME);
return image_init_result::PASS;
@@ -151,7 +148,7 @@ void z88cart_slot_device::call_unload()
// open the flap
m_out_flp_cb(ASSERT_LINE);
- // setup the timer for close the flap
+ // setup the timer to close the flap
m_flp_timer->adjust(CLOSE_FLAP_TIME);
}
diff --git a/src/devices/bus/z88/z88.h b/src/devices/bus/z88/z88.h
index f4f655f1e95..bece08cbf72 100644
--- a/src/devices/bus/z88/z88.h
+++ b/src/devices/bus/z88/z88.h
@@ -124,11 +124,10 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-private:
- static constexpr device_timer_id TIMER_FLP_CLEAR = 0;
+ TIMER_CALLBACK_MEMBER(close_flap);
+private:
devcb_write_line m_out_flp_cb;
device_z88cart_interface* m_cart;
emu_timer * m_flp_timer;
diff --git a/src/devices/cpu/alto2/a2disk.cpp b/src/devices/cpu/alto2/a2disk.cpp
index 5000095ff7e..0e031a0cd85 100644
--- a/src/devices/cpu/alto2/a2disk.cpp
+++ b/src/devices/cpu/alto2/a2disk.cpp
@@ -1741,16 +1741,16 @@ void alto2_cpu_device::init_disk()
m_dsk.kcom = 066000;
- m_dsk.strobon_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(alto2_cpu_device::disk_strobon),this));
+ m_dsk.strobon_timer = timer_alloc(FUNC(alto2_cpu_device::disk_strobon), this);
m_dsk.strobon_timer->reset();
- m_dsk.seclate_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(alto2_cpu_device::disk_seclate),this));
+ m_dsk.seclate_timer = timer_alloc(FUNC(alto2_cpu_device::disk_seclate), this);
m_dsk.seclate_timer->reset();
- m_dsk.ok_to_run_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(alto2_cpu_device::disk_ok_to_run),this));
+ m_dsk.ok_to_run_timer = timer_alloc(FUNC(alto2_cpu_device::disk_ok_to_run), this);
m_dsk.ok_to_run_timer->adjust(attotime::from_nsec(35 * ALTO2_UCYCLE / 1000), 1);
- m_dsk.ready_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(alto2_cpu_device::disk_ready_mf31a),this));
+ m_dsk.ready_timer = timer_alloc(FUNC(alto2_cpu_device::disk_ready_mf31a), this);
m_dsk.ready_timer->reset();
m_dsk.bitclk_time[0] = static_cast<int>(attotime::from_nsec(300).as_attoseconds() / 1000000);
diff --git a/src/devices/cpu/alto2/a2ether.cpp b/src/devices/cpu/alto2/a2ether.cpp
index 883259d7445..87ee4268370 100644
--- a/src/devices/cpu/alto2/a2ether.cpp
+++ b/src/devices/cpu/alto2/a2ether.cpp
@@ -1325,10 +1325,10 @@ void alto2_cpu_device::init_ether(int task)
m_eth.rx_packet = std::make_unique<uint16_t[]>(sizeof(uint16_t)*ALTO2_ETHER_PACKET_SIZE);
m_eth.tx_packet = std::make_unique<uint16_t[]>(sizeof(uint16_t)*ALTO2_ETHER_PACKET_SIZE);
- m_eth.tx_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(alto2_cpu_device::tx_packet),this));
+ m_eth.tx_timer = timer_alloc(FUNC(alto2_cpu_device::tx_packet), this);
m_eth.tx_timer->reset();
- m_eth.rx_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(alto2_cpu_device::rx_breath_of_life),this));
+ m_eth.rx_timer = timer_alloc(FUNC(alto2_cpu_device::rx_breath_of_life), this);
m_eth.rx_timer->reset();
}
diff --git a/src/devices/cpu/amis2000/amis2000.cpp b/src/devices/cpu/amis2000/amis2000.cpp
index 96864b875ce..468b29acd98 100644
--- a/src/devices/cpu/amis2000/amis2000.cpp
+++ b/src/devices/cpu/amis2000/amis2000.cpp
@@ -188,7 +188,7 @@ void amis2152_cpu_device::device_start()
{
amis2000_base_device::device_start();
- m_d2f_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(amis2152_cpu_device::d2f_timer_cb), this));
+ m_d2f_timer = timer_alloc(FUNC(amis2152_cpu_device::d2f_timer_cb), this);
// zerofill
m_d2f_latch = 0;
diff --git a/src/devices/cpu/arm7/upd800468.cpp b/src/devices/cpu/arm7/upd800468.cpp
index edf483eef6e..16b6928bf7c 100644
--- a/src/devices/cpu/arm7/upd800468.cpp
+++ b/src/devices/cpu/arm7/upd800468.cpp
@@ -61,7 +61,7 @@ void upd800468_timer_device::control_w(u8 data)
void upd800468_timer_device::device_start()
{
- m_timer = timer_alloc(0);
+ m_timer = timer_alloc(FUNC(upd800468_timer_device::irq_timer_tick), this);
m_irq_cb.resolve_safe();
@@ -74,7 +74,7 @@ void upd800468_timer_device::device_reset()
m_rate = m_control = 0;
}
-void upd800468_timer_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(upd800468_timer_device::irq_timer_tick)
{
if (BIT(m_control, 0))
m_irq_cb(1);
diff --git a/src/devices/cpu/arm7/upd800468.h b/src/devices/cpu/arm7/upd800468.h
index 6e9a5db4ae3..7f662581c7f 100644
--- a/src/devices/cpu/arm7/upd800468.h
+++ b/src/devices/cpu/arm7/upd800468.h
@@ -32,7 +32,7 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(irq_timer_tick);
private:
devcb_write_line m_irq_cb;
diff --git a/src/devices/cpu/cop400/cop400.cpp b/src/devices/cpu/cop400/cop400.cpp
index 5c92d3cbc3c..dcd9a6edc0f 100644
--- a/src/devices/cpu/cop400/cop400.cpp
+++ b/src/devices/cpu/cop400/cop400.cpp
@@ -1031,7 +1031,7 @@ void cop400_cpu_device::serial_tick()
}
}
-void cop400_cpu_device::counter_tick()
+TIMER_CALLBACK_MEMBER(cop400_cpu_device::advance_counter)
{
T++;
@@ -1061,17 +1061,6 @@ void cop400_cpu_device::inil_tick()
INITIALIZATION
***************************************************************************/
-void cop400_cpu_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_COUNTER:
- counter_tick();
- break;
- }
-}
-
-
void cop400_cpu_device::device_start()
{
/* find address spaces */
@@ -1095,7 +1084,7 @@ void cop400_cpu_device::device_start()
m_counter_timer = nullptr;
if (m_has_counter)
{
- m_counter_timer = timer_alloc(TIMER_COUNTER);
+ m_counter_timer = timer_alloc(FUNC(cop400_cpu_device::advance_counter), this);
m_counter_timer->adjust(attotime::zero, 0, attotime::from_ticks(m_cki * 4, clock()));
}
diff --git a/src/devices/cpu/cop400/cop400.h b/src/devices/cpu/cop400/cop400.h
index bd068e4f367..45b2b4d0f25 100644
--- a/src/devices/cpu/cop400/cop400.h
+++ b/src/devices/cpu/cop400/cop400.h
@@ -73,8 +73,6 @@ enum cop400_cko_bond {
class cop400_cpu_device : public cpu_device
{
public:
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
// L pins: 8-bit bi-directional
auto read_l() { return m_read_l.bind(); }
auto write_l() { return m_write_l.bind(); }
@@ -154,6 +152,8 @@ protected:
// device_disasm_interface overrides
virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
+ TIMER_CALLBACK_MEMBER(advance_counter);
+
address_space_config m_program_config;
address_space_config m_data_config;
diff --git a/src/devices/cpu/e0c6200/e0c6s46.cpp b/src/devices/cpu/e0c6200/e0c6s46.cpp
index 7c5b1196fb0..5e30570ae76 100644
--- a/src/devices/cpu/e0c6200/e0c6s46.cpp
+++ b/src/devices/cpu/e0c6200/e0c6s46.cpp
@@ -83,11 +83,11 @@ void e0c6s46_device::device_start()
m_pixel_update_cb.resolve();
// create timers
- m_core_256_handle = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(e0c6s46_device::core_256_cb), this));
+ m_core_256_handle = timer_alloc(FUNC(e0c6s46_device::core_256_cb), this);
m_core_256_handle->adjust(attotime::from_ticks(64, unscaled_clock()));
- m_prgtimer_handle = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(e0c6s46_device::prgtimer_cb), this));
+ m_prgtimer_handle = timer_alloc(FUNC(e0c6s46_device::prgtimer_cb), this);
m_prgtimer_handle->adjust(attotime::never);
- m_buzzer_handle = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(e0c6s46_device::buzzer_cb), this));
+ m_buzzer_handle = timer_alloc(FUNC(e0c6s46_device::buzzer_cb), this);
m_buzzer_handle->adjust(attotime::never);
// zerofill
diff --git a/src/devices/cpu/e132xs/e132xs.cpp b/src/devices/cpu/e132xs/e132xs.cpp
index 49e09694136..1331bb1a890 100644
--- a/src/devices/cpu/e132xs/e132xs.cpp
+++ b/src/devices/cpu/e132xs/e132xs.cpp
@@ -1140,7 +1140,7 @@ void hyperstone_device::init(int scale_mask)
}
m_io = &space(AS_IO);
- m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(hyperstone_device::timer_callback), this));
+ m_timer = timer_alloc(FUNC(hyperstone_device::timer_callback), this);
m_core->clock_scale_mask = scale_mask;
for (uint8_t i = 0; i < 16; i++)
diff --git a/src/devices/cpu/f2mc16/mb9061x.cpp b/src/devices/cpu/f2mc16/mb9061x.cpp
index 9a425f7ad95..e8940162329 100644
--- a/src/devices/cpu/f2mc16/mb9061x.cpp
+++ b/src/devices/cpu/f2mc16/mb9061x.cpp
@@ -41,11 +41,11 @@ void mb9061x_device::device_start()
{
f2mc16_device::device_start();
- m_tbtc_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mb9061x_device::tbtc_tick), this));
+ m_tbtc_timer = timer_alloc(FUNC(mb9061x_device::tbtc_tick), this);
m_tbtc_timer->adjust(attotime::never);
- m_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mb9061x_device::timer0_tick), this));
+ m_timer[0] = timer_alloc(FUNC(mb9061x_device::timer0_tick), this);
m_timer[0]->adjust(attotime::never);
- m_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mb9061x_device::timer1_tick), this));
+ m_timer[1] = timer_alloc(FUNC(mb9061x_device::timer1_tick), this);
m_timer[1]->adjust(attotime::never);
}
diff --git a/src/devices/cpu/h8/h8_sci.cpp b/src/devices/cpu/h8/h8_sci.cpp
index 9faaefa08d8..6bc650af5c6 100644
--- a/src/devices/cpu/h8/h8_sci.cpp
+++ b/src/devices/cpu/h8/h8_sci.cpp
@@ -249,7 +249,7 @@ void h8_sci_device::device_start()
tx_cb.resolve_safe();
clk_cb.resolve_safe();
- sync_timer = timer_alloc(0);
+ sync_timer = timer_alloc(FUNC(h8_sci_device::sync_tick), this);
if(external_clock_period.is_never()) {
internal_to_external_ratio = 0;
@@ -309,7 +309,7 @@ void h8_sci_device::device_reset()
cur_sync_time = attotime::never;
}
-void h8_sci_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(h8_sci_device::sync_tick)
{
// Used only to force system-wide syncs
}
@@ -368,7 +368,7 @@ uint64_t h8_sci_device::internal_update(uint64_t current_time)
bool new_clock = delta >= divider;
if(new_clock != clock_value) {
- cpu->synchronize();
+ machine().scheduler().synchronize();
if((!new_clock) && (clock_state & CLK_TX))
tx_dropped_edge();
@@ -397,7 +397,7 @@ uint64_t h8_sci_device::internal_update(uint64_t current_time)
assert(delta < fp);
bool new_clock = delta >= divider*8;
if(new_clock != clock_value) {
- cpu->synchronize();
+ machine().scheduler().synchronize();
if((!new_clock) && (clock_state & CLK_TX))
tx_dropped_edge();
@@ -423,7 +423,7 @@ uint64_t h8_sci_device::internal_update(uint64_t current_time)
delta &= 1;
bool new_clock = delta >= 1;
if(new_clock != clock_value) {
- cpu->synchronize();
+ machine().scheduler().synchronize();
if((!new_clock) && (clock_state & CLK_TX))
tx_dropped_edge();
@@ -447,7 +447,7 @@ uint64_t h8_sci_device::internal_update(uint64_t current_time)
delta &= 15;
bool new_clock = delta >= 8;
if(new_clock != clock_value) {
- cpu->synchronize();
+ machine().scheduler().synchronize();
if((!new_clock) && (clock_state & CLK_TX))
tx_dropped_edge();
@@ -485,7 +485,7 @@ void h8_sci_device::clock_start(int mode)
return;
if(!clock_state) {
- cpu->synchronize();
+ machine().scheduler().synchronize();
clock_state = mode;
switch(clock_mode) {
case CLKM_INTERNAL_ASYNC:
diff --git a/src/devices/cpu/h8/h8_sci.h b/src/devices/cpu/h8/h8_sci.h
index b2a2e575738..8c07ffe5ec2 100644
--- a/src/devices/cpu/h8/h8_sci.h
+++ b/src/devices/cpu/h8/h8_sci.h
@@ -122,7 +122,8 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(sync_tick);
void clock_start(int mode);
void clock_stop(int mode);
diff --git a/src/devices/cpu/hd61700/hd61700.cpp b/src/devices/cpu/hd61700/hd61700.cpp
index 5ccdd4d79a7..2241855cf1c 100644
--- a/src/devices/cpu/hd61700/hd61700.cpp
+++ b/src/devices/cpu/hd61700/hd61700.cpp
@@ -34,8 +34,8 @@
#define REG_SX m_regsir[0]
#define REG_SY m_regsir[1]
#define REG_SZ m_regsir[2]
-#define READ_SREG(a) (m_regsir[((a)>>5) & 0x03] & 0x1f)
-#define WRITE_SREG(a,d) (m_regsir[((a)>>5) & 0x03] = (d) & 0x1f)
+#define READ_SREG(a) (m_regsir[((a) >> 5) & 0x03] & 0x1f)
+#define WRITE_SREG(a,d) (m_regsir[((a) >> 5) & 0x03] = (d) & 0x1f)
// 8 bit registers
#define REG_PE m_reg8bit[0]
@@ -60,14 +60,14 @@
#define READ_REG(a) (m_regmain[(a) & 0x1f])
#define WRITE_REG(a,d) (m_regmain[(a) & 0x1f] = d)
#define COPY_REG(d,s) (m_regmain[(d) & 0x1f] = m_regmain[(s) & 0x1f])
-#define REG_GET16(r) (((m_regmain[((r)) & 0x1f]<<0)) | (m_regmain[((r) + 1) & 0x1f]<<8))
-#define REG_PUT16(r,d) do{(m_regmain[(r) & 0x1f] = (((d)>>0) & 0xff)); (m_regmain[((r)+1)&0x1f]=(((d)>>8)&0xff));}while(0)
+#define REG_GET16(r) (m_regmain[(r) & 0x1f] | (m_regmain[((r) + 1) & 0x1f] << 8))
+#define REG_PUT16(r,d) do { m_regmain[(r) & 0x1f] = (uint8_t)(d); m_regmain[((r) + 1) & 0x1f] = (uint8_t)((d) >> 8); } while(0)
// opcode
-#define GET_REG_IDX(a,b) (((a<<2) & 0x04) | ((b>>5) & 0x03))
-#define RESTORE_REG(o,r,pr) r = (o&0x02) ? r : pr
-#define COND_WRITE_REG(o,a,d) if (o&0x08) WRITE_REG(a,d)
-#define GET_IM3(d) (((d>>5)&0x07) + 1)
+#define GET_REG_IDX(a,b) (((a << 2) & 0x04) | ((b >> 5) & 0x03))
+#define RESTORE_REG(o,r,pr) r = (o & 0x02) ? r : pr
+#define COND_WRITE_REG(o,a,d) if (o & 0x08) WRITE_REG(a,d)
+#define GET_IM3(d) (((d >> 5) & 0x07) + 1)
// flags
#define SET_FLAG_C m_flags |= FLAG_C
@@ -77,20 +77,20 @@
#define CLEAR_FLAGS m_flags &= ~(FLAG_Z | FLAG_C | FLAG_LZ | FLAG_UZ)
#define CHECK_FLAG_Z(d) if((d) != 0) CLEAR_FLAG_Z
-#define CHECK_FLAG_C(d,l) if (d > l) SET_FLAG_C
+#define CHECK_FLAG_C(d,l) if ((d) > l) SET_FLAG_C
#define CHECK_FLAGB_LZ(d) if(((d) & 0x0f) != 0) CLEAR_FLAG_LZ
#define CHECK_FLAGB_UZ(d) if(((d) & 0xf0) != 0) CLEAR_FLAG_UZ
#define CHECK_FLAGW_LZ(d) if(((d) & 0x0f00) != 0) CLEAR_FLAG_LZ
#define CHECK_FLAGW_UZ(d) if(((d) & 0xf000) != 0) CLEAR_FLAG_UZ
-#define CHECK_FLAGB_UZ_LZ(d) do{CHECK_FLAGB_LZ(d); CHECK_FLAGB_UZ(d);}while(0)
-#define CHECK_FLAGW_UZ_LZ(d) do{CHECK_FLAGW_LZ(d); CHECK_FLAGW_UZ(d);}while(0)
+#define CHECK_FLAGB_UZ_LZ(d) do{ CHECK_FLAGB_LZ(d); CHECK_FLAGB_UZ(d); } while(0)
+#define CHECK_FLAGW_UZ_LZ(d) do{ CHECK_FLAGW_LZ(d); CHECK_FLAGW_UZ(d); } while(0)
//CPU state
#define CPU_FAST 0x01
#define CPU_SLP 0x02
/* HD61700 IRQ vector */
-static const uint16_t irq_vector[] = {0x0032, 0x0042, 0x0052, 0x0062, 0x0072};
+static const uint16_t irq_vector[] = { 0x0032, 0x0042, 0x0052, 0x0062, 0x0072 };
//**************************************************************************
// HD61700 DEVICE
@@ -135,7 +135,7 @@ void hd61700_cpu_device::device_start()
{
m_program = &space(AS_PROGRAM);
- m_sec_timer = timer_alloc(SEC_TIMER);
+ m_sec_timer = timer_alloc(FUNC(hd61700_cpu_device::second_tick), this);
m_sec_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1));
m_lcd_ctrl_cb.resolve_safe();
@@ -223,33 +223,23 @@ void hd61700_cpu_device::device_reset()
elem = CLEAR_LINE;
}
-
-
-//-------------------------------------------------
-// device_timer - handler timer events
-//-------------------------------------------------
-void hd61700_cpu_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(hd61700_cpu_device::second_tick)
{
- switch(id)
+ REG_TM++;
+ if ((REG_TM & 0x3f) == 60)
{
- case SEC_TIMER:
- REG_TM++;
- if ((REG_TM&0x3f) == 60)
- {
- REG_TM = (REG_TM & 0xc0) + 0x40;
+ REG_TM = (REG_TM & 0xc0) + 0x40;
- if (((REG_IE>>3) & (1<<HD61700_TIMER_INT)))
- {
- REG_IB |= (1<<HD61700_TIMER_INT);
+ if (((REG_IE >> 3) & (1 << HD61700_TIMER_INT)))
+ {
+ REG_IB |= (1 << HD61700_TIMER_INT);
- if (REG_IB & 0x20)
- {
- m_state &= ~CPU_SLP;
- m_flags |= FLAG_APO;
- }
- }
+ if (REG_IB & 0x20)
+ {
+ m_state &= ~CPU_SLP;
+ m_flags |= FLAG_APO;
}
- break;
+ }
}
}
@@ -310,13 +300,13 @@ std::unique_ptr<util::disasm_interface> hd61700_cpu_device::create_disassembler(
bool hd61700_cpu_device::check_irqs()
{
- for (int i=4; i>=0; i--)
+ for (int i = 4; i >= 0; i--)
{
- if (REG_IB & (1<<i) && !(m_irq_status & (1<<i)))
+ if (BIT(REG_IB, i) && !BIT(m_irq_status, i))
{
- m_irq_status |= (1<<i);
- push(REG_SS, (m_pc>>8)&0xff);
- push(REG_SS, (m_pc>>0)&0xff);
+ m_irq_status |= (1 << i);
+ push(REG_SS, (uint8_t)(m_pc >> 8));
+ push(REG_SS, (uint8_t)m_pc);
set_pc(irq_vector[i]);
m_icount -= 12;
@@ -348,15 +338,13 @@ void hd61700_cpu_device::execute_run()
}
else
{
- uint8_t op;
-
check_irqs();
// instruction fetch
- op = read_op();
+ uint8_t op = read_op();
// execute the instruction
- switch ( op )
+ switch (op)
{
case 0x00: //adc
case 0x01: //sbc
@@ -365,12 +353,12 @@ void hd61700_cpu_device::execute_run()
{
uint8_t arg = read_op();
uint8_t src = READ_REG(get_sir_im8(arg));
- uint16_t res = READ_REG(arg) + ((op&1) ? -src : +src);
+ uint16_t res = READ_REG(arg) + ((op & 1) ? -src : +src);
- COND_WRITE_REG(op, arg, res & 0xff);
+ COND_WRITE_REG(op, arg, (uint8_t)res);
CLEAR_FLAGS;
- CHECK_FLAG_Z(res & 0xff);
+ CHECK_FLAG_Z((uint8_t)res);
CHECK_FLAGB_UZ_LZ(res);
CHECK_FLAG_C(res, 0xff);
@@ -405,11 +393,11 @@ void hd61700_cpu_device::execute_run()
COND_WRITE_REG(op, arg, res);
CLEAR_FLAGS;
- CHECK_FLAG_Z(res & 0xff);
+ CHECK_FLAG_Z((uint8_t)res);
CHECK_FLAGB_UZ_LZ(res);
//na(c) and or(c) always set C flag
- if ((op&3) == 1 || (op&3) == 2)
+ if ((op & 3) == 1 || (op & 3) == 2)
SET_FLAG_C;
check_optional_jr(arg);
@@ -431,7 +419,7 @@ void hd61700_cpu_device::execute_run()
WRITE_REG(arg, res & 0xff);
CLEAR_FLAGS;
- CHECK_FLAG_Z(res & 0xff);
+ CHECK_FLAG_Z((uint8_t)res);
CHECK_FLAGB_UZ_LZ(res);
CHECK_FLAG_C(res, 0xff);
@@ -446,7 +434,7 @@ void hd61700_cpu_device::execute_run()
uint8_t src = get_sir_im8(arg);
uint16_t offset = REG_GET16(src);
- mem_writebyte(REG_UA>>4, offset, READ_REG(arg));
+ mem_writebyte(REG_UA >> 4, offset, READ_REG(arg));
check_optional_jr(arg);
m_icount -= 8;
@@ -459,7 +447,7 @@ void hd61700_cpu_device::execute_run()
uint8_t src = get_sir_im8(arg);
uint16_t offset = REG_GET16(src);
- WRITE_REG(arg, mem_readbyte(REG_UA>>4, offset));
+ WRITE_REG(arg, mem_readbyte(REG_UA >> 4, offset));
check_optional_jr(arg);
m_icount -= 8;
@@ -469,7 +457,7 @@ void hd61700_cpu_device::execute_run()
case 0x12: //stl
{
uint8_t arg = read_op();
- m_lcd_write_cb((offs_t)0, READ_REG(arg));
+ m_lcd_write_cb(0, READ_REG(arg));
check_optional_jr(arg);
m_icount -= 11;
@@ -498,7 +486,7 @@ void hd61700_cpu_device::execute_run()
}
else
{
- m_lcd_ctrl_cb((offs_t)0, READ_REG(arg));
+ m_lcd_ctrl_cb(READ_REG(arg));
}
check_optional_jr(arg);
@@ -528,7 +516,7 @@ void hd61700_cpu_device::execute_run()
case 0: //PE
case 1: //PD
WRITE_REG8(idx, src);
- m_port_write_cb((offs_t)0, REG_PD & REG_PE);
+ m_port_write_cb(REG_PD & REG_PE);
break;
case 2: //IB
REG_IB = (REG_IB & 0x1f) | (src & 0xe0);
@@ -537,12 +525,12 @@ void hd61700_cpu_device::execute_run()
WRITE_REG8(idx, src);
break;
case 4: //IA
- m_kb_write_cb((offs_t)0, src);
+ m_kb_write_cb(src);
WRITE_REG8(idx, src);
break;
case 5: //IE
- REG_IB &= (((src>>3)&0x1f) | 0xe0);
- m_irq_status &= ((src>>3)&0x1f);
+ REG_IB &= 0xe0 | (src >> 3);
+ m_irq_status &= src >> 3;
WRITE_REG8(idx, src);
break;
case 6: //TM
@@ -559,24 +547,24 @@ void hd61700_cpu_device::execute_run()
case 0x18:
{
uint8_t arg = read_op();
- uint8_t op1 = (arg>>5) & 0x03;
+ uint8_t op1 = (arg >> 5) & 0x03;
switch (op1)
{
case 0x00: //rod
case 0x02: //bid
{
uint8_t src = READ_REG(arg);
- uint8_t res = (src>>1)&0x7f;
+ uint8_t res = src >> 1;
- if (!(op1&0x02))
- res = res | ((m_flags&FLAG_C) !=0 )<<7;
+ if (!(op1 & 0x02))
+ res = res | ((m_flags & FLAG_C) ? 0x80 : 0x00);
WRITE_REG(arg, res);
CLEAR_FLAGS;
- CHECK_FLAG_Z(res & 0xff);
+ CHECK_FLAG_Z((uint8_t)res);
CHECK_FLAGB_UZ_LZ(res);
- if (src&0x01) SET_FLAG_C;
+ if (src & 0x01) SET_FLAG_C;
}
break;
@@ -584,15 +572,15 @@ void hd61700_cpu_device::execute_run()
case 0x03: //biu
{
uint8_t src = READ_REG(arg);
- uint8_t res = (src<<1)&0xfe;
+ uint8_t res = src << 1;
- if (!(op1&0x02))
- res = res | ((m_flags&FLAG_C) !=0 )<<0;
+ if (!(op1 & 0x02))
+ res = res | ((m_flags & FLAG_C) ? 0x01 : 0x00);
WRITE_REG(arg, res);
CLEAR_FLAGS;
- CHECK_FLAG_Z(res & 0xff);
+ CHECK_FLAG_Z((uint8_t)res);
CHECK_FLAGB_UZ_LZ(res);
if (src&0x80) SET_FLAG_C;
}
@@ -607,7 +595,7 @@ void hd61700_cpu_device::execute_run()
case 0x1a:
{
uint8_t arg = read_op();
- uint8_t op1 = (arg>>5) & 0x03;
+ uint8_t op1 = (arg >> 5) & 0x03;
switch (op1)
{
case 0x00: //did
@@ -615,15 +603,15 @@ void hd61700_cpu_device::execute_run()
{
uint8_t res;
- if (op1&0x01)
- res = (READ_REG(arg)<<4)&0xf0;
+ if (op1 & 0x01)
+ res = READ_REG(arg) << 4;
else
- res = (READ_REG(arg)>>4)&0x0f;
+ res = READ_REG(arg) >> 4;
WRITE_REG(arg, res);
CLEAR_FLAGS;
- CHECK_FLAG_Z(res & 0xff);
+ CHECK_FLAG_Z((uint8_t)res);
CHECK_FLAGB_UZ_LZ(res);
}
break;
@@ -644,13 +632,13 @@ void hd61700_cpu_device::execute_run()
case 0x1b: //cmp/inv
{
uint8_t arg = read_op();
- uint8_t res = ~(READ_REG(arg));
+ uint8_t res = ~READ_REG(arg);
if (!(arg & 0x40)) res++;
WRITE_REG(arg, res);
CLEAR_FLAGS;
- CHECK_FLAG_Z(res & 0xff);
+ CHECK_FLAG_Z((uint8_t)res);
CHECK_FLAGB_UZ_LZ(res);
if (res || (arg & 0x40)) SET_FLAG_C;
@@ -664,14 +652,14 @@ void hd61700_cpu_device::execute_run()
uint8_t arg = read_op();
uint8_t src;
- if (arg&0x40)
+ if (arg & 0x40)
{
src = m_flags;
}
else
{
- src = m_port_read_cb(0);
- src&=(~REG_PE);
+ src = m_port_read_cb();
+ src &= ~REG_PE;
}
WRITE_REG(arg, src);
@@ -708,7 +696,7 @@ void hd61700_cpu_device::execute_run()
uint16_t prev_ir = REG_IX;
REG_IX += get_sign_mreg(arg);
- mem_writebyte(REG_UA>>4, REG_IX++, READ_REG(arg));
+ mem_writebyte(REG_UA >> 4, REG_IX++, READ_REG(arg));
RESTORE_REG(op, REG_IX, prev_ir);
@@ -723,7 +711,7 @@ void hd61700_cpu_device::execute_run()
uint16_t prev_ir = REG_IZ;
REG_IZ += get_sign_mreg(arg);
- mem_writebyte(REG_UA>>6, REG_IZ++, READ_REG(arg));
+ mem_writebyte(REG_UA >> 6, REG_IZ++, READ_REG(arg));
RESTORE_REG(op, REG_IZ, prev_ir);
@@ -736,7 +724,7 @@ void hd61700_cpu_device::execute_run()
uint8_t arg = read_op();
REG_IX += get_sign_mreg(arg);
- mem_writebyte(REG_UA>>4, REG_IX, READ_REG(arg));
+ mem_writebyte(REG_UA >> 4, REG_IX, READ_REG(arg));
m_icount -= 6;
}
break;
@@ -746,26 +734,18 @@ void hd61700_cpu_device::execute_run()
uint8_t arg = read_op();
REG_IZ += get_sign_mreg(arg);
- mem_writebyte(REG_UA>>6, REG_IZ, READ_REG(arg));
+ mem_writebyte(REG_UA >> 6, REG_IZ, READ_REG(arg));
m_icount -= 6;
}
break;
case 0x26: //phs
- {
- uint8_t arg = read_op();
-
- push(REG_SS, READ_REG(arg));
- m_icount -= 9;
- }
+ push(REG_SS, READ_REG(read_op()));
+ m_icount -= 9;
break;
case 0x27: //phu
- {
- uint8_t arg = read_op();
-
- push(REG_US, READ_REG(arg));
- m_icount -= 9;
- }
+ push(REG_US, READ_REG(read_op()));
+ m_icount -= 9;
break;
case 0x28: //ld
@@ -775,7 +755,7 @@ void hd61700_cpu_device::execute_run()
uint16_t prev_ir = REG_IX;
REG_IX += get_sign_mreg(arg);
- WRITE_REG(arg, mem_readbyte(REG_UA>>4, REG_IX++));
+ WRITE_REG(arg, mem_readbyte(REG_UA >> 4, REG_IX++));
RESTORE_REG(op, REG_IX, prev_ir);
@@ -790,7 +770,7 @@ void hd61700_cpu_device::execute_run()
uint16_t prev_ir = REG_IZ;
REG_IZ += get_sign_mreg(arg);
- WRITE_REG(arg, mem_readbyte(REG_UA>>6, REG_IZ++));
+ WRITE_REG(arg, mem_readbyte(REG_UA >> 6, REG_IZ++));
RESTORE_REG(op, REG_IZ, prev_ir);
@@ -803,7 +783,7 @@ void hd61700_cpu_device::execute_run()
uint8_t arg = read_op();
REG_IX += get_sign_mreg(arg);
- WRITE_REG(arg, mem_readbyte(REG_UA>>4, REG_IX));
+ WRITE_REG(arg, mem_readbyte(REG_UA >> 4, REG_IX));
m_icount -= 6;
}
@@ -814,7 +794,7 @@ void hd61700_cpu_device::execute_run()
uint8_t arg = read_op();
REG_IZ += get_sign_mreg(arg);
- WRITE_REG(arg, mem_readbyte(REG_UA>>6, REG_IZ));
+ WRITE_REG(arg, mem_readbyte(REG_UA >> 6, REG_IZ));
m_icount -= 6;
}
@@ -824,7 +804,6 @@ void hd61700_cpu_device::execute_run()
{
uint8_t arg = read_op();
WRITE_REG(arg, pop(REG_SS));
-
m_icount -= 11;
}
break;
@@ -832,7 +811,6 @@ void hd61700_cpu_device::execute_run()
{
uint8_t arg = read_op();
WRITE_REG(arg, pop(REG_US));
-
m_icount -= 11;
}
break;
@@ -851,7 +829,7 @@ void hd61700_cpu_device::execute_run()
uint8_t msb = read_op();
if (check_cond(op))
- set_pc((msb<<8) | lsb);
+ set_pc((msb << 8) | lsb);
m_icount -= 3;
}
break;
@@ -863,15 +841,15 @@ void hd61700_cpu_device::execute_run()
{
uint8_t arg = read_op();
uint16_t offset = REG_IX + get_sign_mreg(arg);
- uint8_t src = mem_readbyte(REG_UA>>4, offset);
+ uint8_t src = mem_readbyte(REG_UA >> 4, offset);
uint16_t res = src + ((op & 2) ? -READ_REG(arg) : +READ_REG(arg)) ;
- if ((op & 4))
- mem_writebyte(REG_UA>>4, offset, res & 0xff);
+ if (op & 4)
+ mem_writebyte(REG_UA >> 4, offset, res & 0xff);
CLEAR_FLAGS;
- CHECK_FLAG_Z(res & 0xff);
+ CHECK_FLAG_Z((uint8_t)res);
CHECK_FLAGB_UZ_LZ(res);
CHECK_FLAG_C(res, 0xff);
@@ -886,15 +864,15 @@ void hd61700_cpu_device::execute_run()
{
uint8_t arg = read_op();
uint16_t offset = REG_IZ + get_sign_mreg(arg);
- uint8_t src = mem_readbyte(REG_UA>>6, offset);
+ uint8_t src = mem_readbyte(REG_UA >> 6, offset);
uint16_t res = src + ((op & 2) ? -READ_REG(arg) : +READ_REG(arg)) ;
- if ((op & 4))
- mem_writebyte(REG_UA>>6, offset, res & 0xff);
+ if (op & 4)
+ mem_writebyte(REG_UA >> 6, offset, res & 0xff);
CLEAR_FLAGS;
- CHECK_FLAG_Z(res & 0xff);
+ CHECK_FLAG_Z((uint8_t)res);
CHECK_FLAGB_UZ_LZ(res);
CHECK_FLAG_C(res, 0xff);
@@ -909,12 +887,12 @@ void hd61700_cpu_device::execute_run()
{
uint8_t arg = read_op();
uint8_t src = read_op();
- uint16_t res = READ_REG(arg) + ((op&1) ? -src : +src);
+ uint16_t res = READ_REG(arg) + ((op & 1) ? -src : +src);
- COND_WRITE_REG(op, arg, res & 0xff);
+ COND_WRITE_REG(op, arg, (uint8_t)res);
CLEAR_FLAGS;
- CHECK_FLAG_Z(res & 0xff);
+ CHECK_FLAG_Z((uint8_t)res);
CHECK_FLAGB_UZ_LZ(res);
CHECK_FLAG_C(res, 0xff);
@@ -926,7 +904,7 @@ void hd61700_cpu_device::execute_run()
case 0x42: //ld
{
uint8_t arg = read_op();
- uint8_t src = read_op() ;
+ uint8_t src = read_op();
WRITE_REG(arg, src);
@@ -952,11 +930,11 @@ void hd61700_cpu_device::execute_run()
COND_WRITE_REG(op, arg, res);
CLEAR_FLAGS;
- CHECK_FLAG_Z(res & 0xff);
+ CHECK_FLAG_Z((uint8_t)res);
CHECK_FLAGB_UZ_LZ(res);
//na(c) and or(c) always set C flag
- if ((op&3) == 1 || (op&3) == 2)
+ if ((op & 3) == 1 || (op & 3) == 2)
SET_FLAG_C;
check_optional_jr(arg);
@@ -976,10 +954,10 @@ void hd61700_cpu_device::execute_run()
else
res = make_bcd_add(READ_REG(arg), src);
- WRITE_REG(arg, res & 0xff);
+ WRITE_REG(arg, (uint8_t)res);
CLEAR_FLAGS;
- CHECK_FLAG_Z(res & 0xff);
+ CHECK_FLAG_Z((uint8_t)res);
CHECK_FLAGB_UZ_LZ(res);
CHECK_FLAG_C(res, 0xff);
@@ -994,7 +972,7 @@ void hd61700_cpu_device::execute_run()
uint8_t src = read_op();
uint16_t offset = REG_GET16(READ_SREG(arg));
- mem_writebyte(REG_UA>>4, offset, src);
+ mem_writebyte(REG_UA >> 4, offset, src);
m_icount -= 8;
}
break;
@@ -1012,7 +990,7 @@ void hd61700_cpu_device::execute_run()
case 0x52: //stl
{
uint8_t arg = read_op();
- m_lcd_write_cb((offs_t)0, arg);
+ m_lcd_write_cb(0, arg);
m_icount -= 12;
}
@@ -1029,7 +1007,7 @@ void hd61700_cpu_device::execute_run()
}
else
{
- m_lcd_ctrl_cb((offs_t)0, src);
+ m_lcd_ctrl_cb(src);
}
m_icount -= 3;
@@ -1057,7 +1035,7 @@ void hd61700_cpu_device::execute_run()
case 0: //PE
case 1: //PD
WRITE_REG8(idx, src);
- m_port_write_cb((offs_t)0, REG_PD & REG_PE);
+ m_port_write_cb(REG_PD & REG_PE);
break;
case 2: //IB
REG_IB = (REG_IB & 0x1f) | (src & 0xe0);
@@ -1066,12 +1044,12 @@ void hd61700_cpu_device::execute_run()
WRITE_REG8(idx, src);
break;
case 4: //IA
- m_kb_write_cb((offs_t)0, src);
+ m_kb_write_cb(src);
WRITE_REG8(idx, src);
break;
case 5: //IE
- REG_IB &= (((src>>3)&0x1f) | 0xe0);
- m_irq_status &= ((src>>3)&0x1f);
+ REG_IB &= 0xe0 | (src >> 3);
+ m_irq_status &= src >> 3;
WRITE_REG8(idx, src);
break;
case 6: //TM
@@ -1088,25 +1066,24 @@ void hd61700_cpu_device::execute_run()
case 0x59: //bdns
{
uint8_t arg = read_op();
- uint8_t tmp;
uint16_t res;
for(;;)
{
- tmp = mem_readbyte(REG_UA>>4, REG_IX);
- mem_writebyte(REG_UA>>6, REG_IZ, tmp);
+ uint8_t tmp = mem_readbyte(REG_UA >> 4, REG_IX);
+ mem_writebyte(REG_UA >> 6, REG_IZ, tmp);
res = tmp - arg;
if (REG_IX == REG_IY || !res)
break;
- REG_IX += ((op&1) ? -1 : +1);
- REG_IZ += ((op&1) ? -1 : +1);
+ REG_IX += ((op & 1) ? -1 : +1);
+ REG_IZ += ((op & 1) ? -1 : +1);
m_icount -= 6;
}
CLEAR_FLAGS;
- CHECK_FLAG_Z(res & 0xff);
+ CHECK_FLAG_Z((uint8_t)res);
CHECK_FLAGB_UZ_LZ(res);
CHECK_FLAG_C(res, 0xff);
@@ -1122,17 +1099,17 @@ void hd61700_cpu_device::execute_run()
for(;;)
{
- res = mem_readbyte(REG_UA>>4, REG_IX) - arg;
+ res = mem_readbyte(REG_UA >> 4, REG_IX) - arg;
if (REG_IX == REG_IY || !res)
break;
- REG_IX += ((op&1) ? -1 : +1);
+ REG_IX += ((op & 1) ? -1 : +1);
m_icount -= 6;
}
CLEAR_FLAGS;
- CHECK_FLAG_Z(res & 0xff);
+ CHECK_FLAG_Z((uint8_t)res);
CHECK_FLAGB_UZ_LZ(res);
CHECK_FLAG_C(res, 0xff);
@@ -1147,7 +1124,7 @@ void hd61700_cpu_device::execute_run()
uint16_t prev_ir = REG_IX;
REG_IX += get_sign_im8(arg);
- mem_writebyte(REG_UA>>4, REG_IX++, READ_REG(arg));
+ mem_writebyte(REG_UA >> 4, REG_IX++, READ_REG(arg));
RESTORE_REG(op, REG_IX, prev_ir);
@@ -1162,7 +1139,7 @@ void hd61700_cpu_device::execute_run()
uint16_t prev_ir = REG_IZ;
REG_IZ += get_sign_im8(arg);
- mem_writebyte(REG_UA>>6, REG_IZ++, READ_REG(arg));
+ mem_writebyte(REG_UA >> 6, REG_IZ++, READ_REG(arg));
RESTORE_REG(op, REG_IZ, prev_ir);
m_icount -= 8;
@@ -1174,7 +1151,7 @@ void hd61700_cpu_device::execute_run()
uint8_t arg = read_op();
REG_IX += get_sign_im8(arg);
- mem_writebyte(REG_UA>>4, REG_IX, READ_REG(arg));
+ mem_writebyte(REG_UA >> 4, REG_IX, READ_REG(arg));
m_icount -= 6;
}
break;
@@ -1184,7 +1161,7 @@ void hd61700_cpu_device::execute_run()
uint8_t arg = read_op();
REG_IZ += get_sign_im8(arg);
- mem_writebyte(REG_UA>>6, REG_IZ, READ_REG(arg));
+ mem_writebyte(REG_UA >> 6, REG_IZ, READ_REG(arg));
m_icount -= 6;
}
break;
@@ -1196,7 +1173,7 @@ void hd61700_cpu_device::execute_run()
uint16_t prev_ir = REG_IX;
REG_IX += get_sign_im8(arg);
- WRITE_REG(arg, mem_readbyte(REG_UA>>4, REG_IX++));
+ WRITE_REG(arg, mem_readbyte(REG_UA >> 4, REG_IX++));
RESTORE_REG(op, REG_IX, prev_ir);
m_icount -= 8;
@@ -1210,7 +1187,7 @@ void hd61700_cpu_device::execute_run()
uint16_t prev_ir = REG_IZ;
REG_IZ += get_sign_im8(arg);
- WRITE_REG(arg, mem_readbyte(REG_UA>>6, REG_IZ++));
+ WRITE_REG(arg, mem_readbyte(REG_UA >> 6, REG_IZ++));
RESTORE_REG(op, REG_IZ, prev_ir);
m_icount -= 8;
@@ -1222,7 +1199,7 @@ void hd61700_cpu_device::execute_run()
uint8_t arg = read_op();
REG_IX += get_sign_im8(arg);
- WRITE_REG(arg, mem_readbyte(REG_UA>>4, REG_IX));
+ WRITE_REG(arg, mem_readbyte(REG_UA >> 4, REG_IX));
m_icount -= 6;
}
break;
@@ -1232,7 +1209,7 @@ void hd61700_cpu_device::execute_run()
uint8_t arg = read_op();
REG_IZ += get_sign_im8(arg);
- WRITE_REG(arg, mem_readbyte(REG_UA>>6, REG_IZ));
+ WRITE_REG(arg, mem_readbyte(REG_UA >> 6, REG_IZ));
m_icount -= 6;
}
break;
@@ -1253,10 +1230,10 @@ void hd61700_cpu_device::execute_run()
if (check_cond(op))
{
m_pc--;
- push(REG_SS, (m_pc>>8)&0xff);
- push(REG_SS, (m_pc>>0)&0xff);
+ push(REG_SS, (uint8_t)(m_pc >> 8));
+ push(REG_SS, (uint8_t)m_pc);
- set_pc((msb<<8) | lsb);
+ set_pc((msb << 8) | lsb);
m_icount -= 6;
}
m_icount -= 3;
@@ -1270,15 +1247,15 @@ void hd61700_cpu_device::execute_run()
{
uint8_t arg = read_op();
uint16_t offset = REG_IX + get_sign_im8(arg);
- uint8_t src = mem_readbyte(REG_UA>>4, offset);
+ uint8_t src = mem_readbyte(REG_UA >> 4, offset);
uint16_t res = src + ((op & 2) ? -READ_REG(arg) : +READ_REG(arg)) ;
- if ((op & 4))
- mem_writebyte(REG_UA>>4, offset, res & 0xff);
+ if (op & 4)
+ mem_writebyte(REG_UA >> 4, offset, (uint8_t)res);
CLEAR_FLAGS;
- CHECK_FLAG_Z(res & 0xff);
+ CHECK_FLAG_Z((uint8_t)res);
CHECK_FLAGB_UZ_LZ(res);
CHECK_FLAG_C(res, 0xff);
@@ -1293,15 +1270,15 @@ void hd61700_cpu_device::execute_run()
{
uint8_t arg = read_op();
uint16_t offset = REG_IZ + get_sign_im8(arg);
- uint8_t src = mem_readbyte(REG_UA>>6, offset);
+ uint8_t src = mem_readbyte(REG_UA >> 6, offset);
uint16_t res = src + ((op & 2) ? -READ_REG(arg) : +READ_REG(arg)) ;
- if ((op & 4))
- mem_writebyte(REG_UA>>6, offset, res & 0xff);
+ if (op & 4)
+ mem_writebyte(REG_UA >> 6, offset, (uint8_t)res);
CLEAR_FLAGS;
- CHECK_FLAG_Z(res & 0xff);
+ CHECK_FLAG_Z((uint8_t)res);
CHECK_FLAGB_UZ_LZ(res);
CHECK_FLAG_C(res, 0xff);
@@ -1318,10 +1295,10 @@ void hd61700_cpu_device::execute_run()
uint8_t src = get_sir_im8(arg);
uint32_t res = REG_GET16(arg) + ((op & 0x01) ? -REG_GET16(src) : +REG_GET16(src));
- if (op & 0x08) REG_PUT16(arg, res&0xffff);
+ if (op & 0x08) REG_PUT16(arg, (uint16_t)res);
CLEAR_FLAGS;
- CHECK_FLAG_Z(res & 0xffff);
+ CHECK_FLAG_Z((uint16_t)res);
CHECK_FLAGW_UZ_LZ(res);
CHECK_FLAG_C(res, 0xffff);
@@ -1336,7 +1313,7 @@ void hd61700_cpu_device::execute_run()
uint8_t src = get_sir_im8(arg);
COPY_REG(arg, src);
- COPY_REG(arg+1, src+1);
+ COPY_REG(arg + 1, src + 1);
check_optional_jr(arg);
m_icount -= 8;
@@ -1358,7 +1335,7 @@ void hd61700_cpu_device::execute_run()
uint8_t res0 = make_logic(op, READ_REG(arg), READ_REG(src));
COND_WRITE_REG(op, arg, res0);
- uint8_t res1 = make_logic(op, READ_REG(arg+1), READ_REG(src+1));
+ uint8_t res1 = make_logic(op, READ_REG(arg + 1), READ_REG(src + 1));
COND_WRITE_REG(op, arg+1, res1);
CLEAR_FLAGS;
@@ -1366,7 +1343,7 @@ void hd61700_cpu_device::execute_run()
CHECK_FLAGB_UZ_LZ(res1);
//na(c) and or(c) always set C flag
- if ((op&3) == 1 || (op&3) == 2)
+ if ((op & 3) == 1 || (op & 3) == 2)
SET_FLAG_C;
check_optional_jr(arg);
@@ -1386,16 +1363,16 @@ void hd61700_cpu_device::execute_run()
else
res0 = make_bcd_add(READ_REG(arg), READ_REG(src));
- WRITE_REG(arg, res0 & 0xff);
+ WRITE_REG(arg, (uint8_t)res0);
- res1 = (res0>0xff) ? 1 : 0 ;
+ res1 = (res0 > 0xff) ? 1 : 0;
if (op & 0x01)
- res1 = make_bcd_sub(READ_REG(arg+1), READ_REG(src+1) + res1);
+ res1 = make_bcd_sub(READ_REG(arg + 1), READ_REG(src + 1) + res1);
else
- res1 = make_bcd_add(READ_REG(arg+1), READ_REG(src+1) + res1);
+ res1 = make_bcd_add(READ_REG(arg + 1), READ_REG(src + 1) + res1);
- WRITE_REG(arg+1, res1 & 0xff);
+ WRITE_REG(arg + 1, (uint8_t)res1);
CLEAR_FLAGS;
CHECK_FLAG_Z(res0 || res1);
@@ -1413,8 +1390,8 @@ void hd61700_cpu_device::execute_run()
uint8_t src = get_sir_im8(arg);
uint16_t offset = REG_GET16(src);
- mem_writebyte(REG_UA>>4, offset+0, READ_REG(arg+0));
- mem_writebyte(REG_UA>>4, offset+1, READ_REG(arg+1));
+ mem_writebyte(REG_UA >> 4, offset, READ_REG(arg));
+ mem_writebyte(REG_UA >> 4, offset + 1, READ_REG(arg + 1));
check_optional_jr(arg);
m_icount -= 11;
@@ -1427,8 +1404,8 @@ void hd61700_cpu_device::execute_run()
uint8_t src = get_sir_im8(arg);
uint16_t offset = REG_GET16(src);
- WRITE_REG(arg+0, mem_readbyte(REG_UA>>4, offset+0));
- WRITE_REG(arg+1, mem_readbyte(REG_UA>>4, offset+1));
+ WRITE_REG(arg, mem_readbyte(REG_UA >> 4, offset));
+ WRITE_REG(arg + 1, mem_readbyte(REG_UA >> 4, offset + 1));
check_optional_jr(arg);
m_icount -= 11;
@@ -1439,8 +1416,8 @@ void hd61700_cpu_device::execute_run()
{
uint8_t arg = read_op();
- m_lcd_write_cb((offs_t)0, READ_REG(arg));
- m_lcd_write_cb((offs_t)0, READ_REG(arg+1));
+ m_lcd_write_cb(0, READ_REG(arg));
+ m_lcd_write_cb(0, READ_REG(arg + 1));
check_optional_jr(arg);
m_icount -= 19;
@@ -1450,13 +1427,12 @@ void hd61700_cpu_device::execute_run()
case 0x93: //ldcw
{
uint8_t arg = read_op();
- uint8_t reg0, reg1;
- reg0 = m_lcd_read_cb(0);
- reg1 = m_lcd_read_cb(0);
+ uint8_t reg0 = m_lcd_read_cb(0);
+ uint8_t reg1 = m_lcd_read_cb(0);
- WRITE_REG(arg+0, reg0);
- WRITE_REG(arg+1, reg1);
+ WRITE_REG(arg, reg0);
+ WRITE_REG(arg + 1, reg1);
check_optional_jr(arg);
m_icount -= 19;
@@ -1480,22 +1456,22 @@ void hd61700_cpu_device::execute_run()
case 0x98: //rodw
{
uint8_t arg = read_op();
- uint8_t op1 = (arg>>5) & 0x03;
+ uint8_t op1 = (arg >> 5) & 0x03;
switch (op1)
{
case 0x00: //rodw
case 0x02: //bidw
{
- uint16_t src = REG_GET16(arg-1);
- uint16_t res = (src>>1)&0x7fff;
+ uint16_t src = REG_GET16(arg - 1);
+ uint16_t res = src >> 1;
- if (!(op1&0x02))
- res = res | ((m_flags&FLAG_C) !=0 )<<15;
+ if (!(op1 & 0x02))
+ res = res | ((m_flags & FLAG_C) ? 0x8000 : 0x0000);
- REG_PUT16(arg-1, res);
+ REG_PUT16(arg - 1, res);
CLEAR_FLAGS;
- CHECK_FLAG_Z(res & 0xffff);
+ CHECK_FLAG_Z((uint16_t)res);
CHECK_FLAGB_UZ_LZ(res);
if (src&0x01) SET_FLAG_C;
}
@@ -1505,15 +1481,15 @@ void hd61700_cpu_device::execute_run()
case 0x03: //biuw
{
uint16_t src = REG_GET16(arg);
- uint16_t res = (src<<1)&0xfffe;
+ uint16_t res = src << 1;
- if (!(op1&0x02))
- res = res | ((m_flags&FLAG_C) !=0 )<<0;
+ if (!(op1 & 0x02))
+ res = res | ((m_flags & FLAG_C) ? 0x0001 : 0x0000);
REG_PUT16(arg, res);
CLEAR_FLAGS;
- CHECK_FLAG_Z(res & 0xffff);
+ CHECK_FLAG_Z((uint16_t)res);
CHECK_FLAGW_UZ_LZ(res);
if (src&0x8000) SET_FLAG_C;
}
@@ -1528,27 +1504,27 @@ void hd61700_cpu_device::execute_run()
case 0x9a:
{
uint8_t arg = read_op();
- uint8_t op1 = (arg>>5) & 0x03;
+ uint8_t op1 = (arg >> 5) & 0x03;
switch (op1)
{
case 0x00: //didw
{
- uint16_t src = (REG_GET16(arg-1)>>4)&0x0fff;
- REG_PUT16(arg-1, src);
+ uint16_t src = REG_GET16(arg - 1) >> 4;
+ REG_PUT16(arg - 1, src);
CLEAR_FLAGS;
- CHECK_FLAG_Z(src & 0xffff);
+ CHECK_FLAG_Z((uint16_t)src);
CHECK_FLAGB_UZ_LZ(src);
}
break;
case 0x01: //diuw
{
- uint16_t src = (REG_GET16(arg)<<4)&0xfff0;
+ uint16_t src = REG_GET16(arg) << 4;
REG_PUT16(arg, src);
CLEAR_FLAGS;
- CHECK_FLAG_Z(src & 0xffff);
+ CHECK_FLAG_Z((uint16_t)src);
CHECK_FLAGW_UZ_LZ(src);
}
break;
@@ -1558,10 +1534,10 @@ void hd61700_cpu_device::execute_run()
uint8_t src = READ_REG(arg);
WRITE_REG(arg, 0);
- WRITE_REG(arg-1, src);
+ WRITE_REG(arg - 1, src);
CLEAR_FLAGS;
- CHECK_FLAG_Z(src & 0xff);
+ CHECK_FLAG_Z((uint8_t)src);
CHECK_FLAGB_UZ_LZ(src);
}
break;
@@ -1571,10 +1547,10 @@ void hd61700_cpu_device::execute_run()
uint8_t src = READ_REG(arg);
WRITE_REG(arg, 0);
- WRITE_REG(arg+1, src);
+ WRITE_REG(arg + 1, src);
CLEAR_FLAGS;
- CHECK_FLAG_Z(src & 0xff);
+ CHECK_FLAG_Z((uint8_t)src);
CHECK_FLAGB_UZ_LZ(src);
}
break;
@@ -1588,13 +1564,13 @@ void hd61700_cpu_device::execute_run()
case 0x9b: //cmpw/invw
{
uint8_t arg = read_op();
- uint16_t res = ~(REG_GET16(arg));
+ uint16_t res = ~REG_GET16(arg);
if (!(arg & 0x40)) res++;
REG_PUT16(arg, res);
CLEAR_FLAGS;
- CHECK_FLAG_Z(res & 0xffff);
+ CHECK_FLAG_Z((uint16_t)res);
CHECK_FLAGW_UZ_LZ(res);
if (res || (arg & 0x40)) SET_FLAG_C;
@@ -1615,16 +1591,12 @@ void hd61700_cpu_device::execute_run()
}
else
{
- reg0 = m_port_read_cb(0);
- reg1 = m_port_read_cb(0);
-
- reg0&=(~REG_PE);
- reg1&=(~REG_PE);
-
+ reg0 = m_port_read_cb() & ~REG_PE;
+ reg1 = m_port_read_cb() & ~REG_PE;
}
- WRITE_REG(arg+0, reg0);
- WRITE_REG(arg+1, reg1);
+ WRITE_REG(arg, reg0);
+ WRITE_REG(arg + 1, reg1);
check_optional_jr(arg);
m_icount -= 8;
@@ -1662,8 +1634,8 @@ void hd61700_cpu_device::execute_run()
REG_IX += ((arg & 0x80) ? -ir_inc : +ir_inc);
- mem_writebyte(REG_UA>>4, REG_IX++, READ_REG(arg+0));
- mem_writebyte(REG_UA>>4, REG_IX++, READ_REG(arg+1));
+ mem_writebyte(REG_UA >> 4, REG_IX++, READ_REG(arg));
+ mem_writebyte(REG_UA >> 4, REG_IX++, READ_REG(arg + 1));
RESTORE_REG(op, REG_IX, prev_ir);
m_icount -= 11;
@@ -1679,8 +1651,8 @@ void hd61700_cpu_device::execute_run()
REG_IZ += ((arg & 0x80) ? -ir_inc : +ir_inc);
- mem_writebyte(REG_UA>>6, REG_IZ++, READ_REG(arg+0));
- mem_writebyte(REG_UA>>6, REG_IZ++, READ_REG(arg+1));
+ mem_writebyte(REG_UA >> 6, REG_IZ++, READ_REG(arg));
+ mem_writebyte(REG_UA >> 6, REG_IZ++, READ_REG(arg + 1));
RESTORE_REG(op, REG_IZ, prev_ir);
m_icount -= 11;
@@ -1694,8 +1666,8 @@ void hd61700_cpu_device::execute_run()
REG_IX += ((arg & 0x80) ? -ir_inc : +ir_inc);
- mem_writebyte(REG_UA>>4, REG_IX--, READ_REG(arg-0));
- mem_writebyte(REG_UA>>4, REG_IX, READ_REG(arg-1));
+ mem_writebyte(REG_UA >> 4, REG_IX--, READ_REG(arg));
+ mem_writebyte(REG_UA >> 4, REG_IX, READ_REG(arg - 1));
m_icount -= 9;
}
@@ -1707,8 +1679,8 @@ void hd61700_cpu_device::execute_run()
REG_IZ += ((arg & 0x80) ? -ir_inc : +ir_inc);
- mem_writebyte(REG_UA>>6, REG_IZ--, READ_REG(arg-0));
- mem_writebyte(REG_UA>>6, REG_IZ, READ_REG(arg-1));
+ mem_writebyte(REG_UA >> 6, REG_IZ--, READ_REG(arg));
+ mem_writebyte(REG_UA >> 6, REG_IZ, READ_REG(arg - 1));
m_icount -= 9;
}
@@ -1718,7 +1690,7 @@ void hd61700_cpu_device::execute_run()
{
uint8_t arg = read_op();
push(REG_SS, READ_REG(arg));
- push(REG_SS, READ_REG(arg-1));
+ push(REG_SS, READ_REG(arg - 1));
m_icount -= 12;
}
@@ -1727,7 +1699,7 @@ void hd61700_cpu_device::execute_run()
{
uint8_t arg = read_op();
push(REG_US, READ_REG(arg));
- push(REG_US, READ_REG(arg-1));
+ push(REG_US, READ_REG(arg - 1));
m_icount -= 12;
}
@@ -1742,8 +1714,8 @@ void hd61700_cpu_device::execute_run()
REG_IX += ((arg & 0x80) ? -ir_inc : +ir_inc);
- WRITE_REG(arg+0, mem_readbyte(REG_UA>>4, REG_IX++));
- WRITE_REG(arg+1, mem_readbyte(REG_UA>>4, REG_IX++));
+ WRITE_REG(arg, mem_readbyte(REG_UA >> 4, REG_IX++));
+ WRITE_REG(arg + 1, mem_readbyte(REG_UA >> 4, REG_IX++));
RESTORE_REG(op, REG_IX, prev_ir);
@@ -1760,8 +1732,8 @@ void hd61700_cpu_device::execute_run()
REG_IZ += ((arg & 0x80) ? -ir_inc : +ir_inc);
- WRITE_REG(arg+0, mem_readbyte(REG_UA>>6, REG_IZ++));
- WRITE_REG(arg+1, mem_readbyte(REG_UA>>6, REG_IZ++));
+ WRITE_REG(arg, mem_readbyte(REG_UA >> 6, REG_IZ++));
+ WRITE_REG(arg + 1, mem_readbyte(REG_UA >> 6, REG_IZ++));
RESTORE_REG(op, REG_IZ, prev_ir);
@@ -1776,8 +1748,8 @@ void hd61700_cpu_device::execute_run()
REG_IX += ((arg & 0x80) ? -ir_inc : +ir_inc);
- WRITE_REG(arg-0, mem_readbyte(REG_UA>>4, REG_IX--));
- WRITE_REG(arg-1, mem_readbyte(REG_UA>>4, REG_IX));
+ WRITE_REG(arg, mem_readbyte(REG_UA >> 4, REG_IX--));
+ WRITE_REG(arg - 1, mem_readbyte(REG_UA >> 4, REG_IX));
m_icount -= 9;
}
@@ -1790,8 +1762,8 @@ void hd61700_cpu_device::execute_run()
REG_IZ += ((arg & 0x80) ? -ir_inc : +ir_inc);
- WRITE_REG(arg-0, mem_readbyte(REG_UA>>6, REG_IZ--));
- WRITE_REG(arg-1, mem_readbyte(REG_UA>>6, REG_IZ));
+ WRITE_REG(arg, mem_readbyte(REG_UA >> 6, REG_IZ--));
+ WRITE_REG(arg - 1, mem_readbyte(REG_UA >> 6, REG_IZ));
m_icount -= 9;
}
@@ -1802,8 +1774,8 @@ void hd61700_cpu_device::execute_run()
{
uint8_t arg = read_op();
- WRITE_REG(arg, pop((op&1) ? REG_US : REG_SS));
- WRITE_REG(arg+1, pop((op&1) ? REG_US : REG_SS));
+ WRITE_REG(arg, pop((op & 1) ? REG_US : REG_SS));
+ WRITE_REG(arg + 1, pop((op & 1) ? REG_US : REG_SS));
m_icount -= 14;
}
@@ -1819,7 +1791,7 @@ void hd61700_cpu_device::execute_run()
case 0xb7: //unconditional jr
{
uint8_t arg = read_op();
- uint32_t new_pc = m_pc-1 + get_im_7(arg);
+ uint32_t new_pc = (m_pc - 1) + get_im_7(arg);
if (check_cond(op))
set_pc(new_pc);
@@ -1835,13 +1807,13 @@ void hd61700_cpu_device::execute_run()
uint16_t offset = REG_IX + ((arg & 0x80) ? -ir_inc : +ir_inc);
- uint16_t src0 = mem_readbyte(REG_UA>>4, offset) + READ_REG(arg);
- uint16_t src1 = mem_readbyte(REG_UA>>4, offset+1) + READ_REG(arg+1) + ((src0>0xff) ? 1 : 0);
+ uint16_t src0 = mem_readbyte(REG_UA >> 4, offset) + READ_REG(arg);
+ uint16_t src1 = mem_readbyte(REG_UA >> 4, offset + 1) + READ_REG(arg + 1) + ((src0 > 0xff) ? 1 : 0);
if (op&0x04)
{
- mem_writebyte(REG_UA>>4, offset+0, src0 & 0xff);
- mem_writebyte(REG_UA>>4, offset+1, src1 & 0xff);
+ mem_writebyte(REG_UA >> 4, offset, (uint8_t)src0);
+ mem_writebyte(REG_UA >> 4, offset + 1, (uint8_t)src1);
}
CLEAR_FLAGS;
@@ -1861,13 +1833,13 @@ void hd61700_cpu_device::execute_run()
uint16_t offset = REG_IX + ((arg & 0x80) ? -ir_inc : +ir_inc);
- uint16_t src0 = mem_readbyte(REG_UA>>4, offset) - READ_REG(arg);
- uint16_t src1 = mem_readbyte(REG_UA>>4, offset+1) - READ_REG(arg+1) - ((src0>0xff) ? 1 : 0);
+ uint16_t src0 = mem_readbyte(REG_UA >> 4, offset) - READ_REG(arg);
+ uint16_t src1 = mem_readbyte(REG_UA >> 4, offset+1) - READ_REG(arg + 1) - ((src0 > 0xff) ? 1 : 0);
if (op&0x04)
{
- mem_writebyte(REG_UA>>4, offset+0, src0 & 0xff);
- mem_writebyte(REG_UA>>4, offset+1, src1 & 0xff);
+ mem_writebyte(REG_UA >> 4, offset, (uint8_t)src0);
+ mem_writebyte(REG_UA >> 4, offset + 1, (uint8_t)src1);
}
CLEAR_FLAGS;
@@ -1887,13 +1859,13 @@ void hd61700_cpu_device::execute_run()
uint16_t offset = REG_IZ + ((arg & 0x80) ? -ir_inc : +ir_inc);
- uint16_t src0 = mem_readbyte(REG_UA>>6, offset) + READ_REG(arg);
- uint16_t src1 = mem_readbyte(REG_UA>>6, offset+1) + READ_REG(arg+1) + ((src0>0xff) ? 1 : 0);
+ uint16_t src0 = mem_readbyte(REG_UA >> 6, offset) + READ_REG(arg);
+ uint16_t src1 = mem_readbyte(REG_UA >> 6, offset + 1) + READ_REG(arg + 1) + ((src0 > 0xff) ? 1 : 0);
- if (op&0x04)
+ if (op & 0x04)
{
- mem_writebyte(REG_UA>>6, offset+0, src0 & 0xff);
- mem_writebyte(REG_UA>>6, offset+1, src1 & 0xff);
+ mem_writebyte(REG_UA >> 6, offset, (uint8_t)src0);
+ mem_writebyte(REG_UA >> 6, offset + 1, (uint8_t)src1);
}
CLEAR_FLAGS;
@@ -1913,13 +1885,13 @@ void hd61700_cpu_device::execute_run()
uint16_t offset = REG_IZ + ((arg & 0x80) ? -ir_inc : +ir_inc);
- uint16_t src0 = mem_readbyte(REG_UA>>6, offset) - READ_REG(arg);
- uint16_t src1 = mem_readbyte(REG_UA>>6, offset+1) - READ_REG(arg+1) - ((src0>0xff) ? 1 : 0);
+ uint16_t src0 = mem_readbyte(REG_UA >> 6, offset) - READ_REG(arg);
+ uint16_t src1 = mem_readbyte(REG_UA >> 6, offset + 1) - READ_REG(arg + 1) - ((src0 > 0xff) ? 1 : 0);
if (op&0x04)
{
- mem_writebyte(REG_UA>>6, offset+0, src0 & 0xff);
- mem_writebyte(REG_UA>>6, offset+1, src1 & 0xff);
+ mem_writebyte(REG_UA >> 6, offset, (uint8_t)src0);
+ mem_writebyte(REG_UA >> 6, offset + 1, (uint8_t)src1);
}
CLEAR_FLAGS;
@@ -1940,11 +1912,11 @@ void hd61700_cpu_device::execute_run()
uint8_t arg1 = read_op();
uint8_t dst = arg;
uint8_t src = get_sir_im8(arg, arg1);
- uint8_t c, f;
uint16_t res = 0;
- c = f = 0;
- for (int n=GET_IM3(arg1); n>0; n--)
+ uint8_t c = 0;
+ uint8_t f = 0;
+ for (int n = GET_IM3(arg1); n > 0; n--)
{
if (op & 0x01)
res = make_bcd_sub(READ_REG(dst), READ_REG(src) + c);
@@ -1953,10 +1925,11 @@ void hd61700_cpu_device::execute_run()
c = (res > 0xff) ? 1 : 0;
- COND_WRITE_REG(op, dst, res&0xff);
+ COND_WRITE_REG(op, dst, (uint8_t)res);
- f |= (res&0xff);
- dst++; src++;
+ f |= (uint8_t)res;
+ dst++;
+ src++;
m_icount -= 5;
}
@@ -1978,7 +1951,7 @@ void hd61700_cpu_device::execute_run()
uint8_t dst = arg;
uint8_t src = get_sir_im8(arg, arg1);
- for (int n=GET_IM3(arg1); n>0; n--)
+ for (int n = GET_IM3(arg1); n > 0; n--)
{
COPY_REG(dst++, src++);
m_icount -= 5;
@@ -2002,9 +1975,10 @@ void hd61700_cpu_device::execute_run()
uint8_t arg1 = read_op();
uint8_t dst = arg;
uint8_t src = get_sir_im8(arg, arg1);
- uint8_t res = 0, f = 0;
+ uint8_t res = 0;
+ uint8_t f = 0;
- for (int n=GET_IM3(arg1); n>0; n--)
+ for (int n = GET_IM3(arg1); n > 0; n--)
{
res = make_logic(op, READ_REG(dst), READ_REG(src));
@@ -2012,7 +1986,8 @@ void hd61700_cpu_device::execute_run()
f |= res;
- dst++; src++;
+ dst++;
+ src++;
m_icount -= 3;
}
@@ -2022,7 +1997,7 @@ void hd61700_cpu_device::execute_run()
CHECK_FLAGB_UZ_LZ(res);
//na(c) and or(c) always set C flag
- if ((op&3) == 1 || (op&3) == 2)
+ if ((op & 3) == 1 || (op & 3) == 2)
SET_FLAG_C;
check_optional_jr(arg);
@@ -2036,11 +2011,10 @@ void hd61700_cpu_device::execute_run()
uint8_t arg1 = read_op();
uint8_t dst = arg;
uint16_t res = 0;
- uint8_t src, f;
- src = arg1 & 0x1f;
- f = 0;
+ uint8_t src = arg1 & 0x1f;
+ uint8_t f = 0;
- for (int n=GET_IM3(arg1); n>0; n--)
+ for (int n = GET_IM3(arg1); n > 0; n--)
{
if (op & 0x01)
res = make_bcd_sub(READ_REG(dst), src);
@@ -2049,9 +2023,9 @@ void hd61700_cpu_device::execute_run()
src = (res > 0xff) ? 1 : 0;
- COND_WRITE_REG(op, dst, res&0xff);
+ COND_WRITE_REG(op, dst, (uint8_t)res);
- f |= (res&0xff);
+ f |= (uint8_t)res;
dst++;
m_icount -= 5;
@@ -2072,8 +2046,8 @@ void hd61700_cpu_device::execute_run()
uint8_t arg = read_op();
uint16_t offset = REG_GET16(READ_SREG(arg));
- mem_writebyte(REG_UA>>4, offset+0, read_op());
- mem_writebyte(REG_UA>>4, offset+1, read_op());
+ mem_writebyte(REG_UA >> 4, offset, read_op());
+ mem_writebyte(REG_UA >> 4, offset + 1, read_op());
m_icount -= 11;
}
@@ -2085,8 +2059,8 @@ void hd61700_cpu_device::execute_run()
uint8_t reg0 = read_op();
uint8_t reg1 = read_op();
- WRITE_REG(arg+0, reg0);
- WRITE_REG(arg+1, reg1);
+ WRITE_REG(arg, reg0);
+ WRITE_REG(arg + 1, reg1);
m_icount -= 11;
}
break;
@@ -2096,9 +2070,9 @@ void hd61700_cpu_device::execute_run()
uint8_t arg = read_op();
uint8_t arg1 = read_op();
- for (int n=GET_IM3(arg1); n>0; n--)
+ for (int n = GET_IM3(arg1); n > 0; n--)
{
- m_lcd_write_cb((offs_t)0, READ_REG(arg));
+ m_lcd_write_cb(0, READ_REG(arg));
arg++;
m_icount -= 8;
@@ -2112,11 +2086,10 @@ void hd61700_cpu_device::execute_run()
{
uint8_t arg = read_op();
uint8_t arg1 = read_op();
- uint8_t src;
- for (int n=GET_IM3(arg1); n>0; n--)
+ for (int n = GET_IM3(arg1); n > 0; n--)
{
- src = m_lcd_read_cb(0);
+ uint8_t src = m_lcd_read_cb(0);
WRITE_REG(arg, src++);
@@ -2136,7 +2109,7 @@ void hd61700_cpu_device::execute_run()
uint8_t idx = GET_REG_IDX(op, arg);
if (idx < 5)
- m_reg16bit[idx] = (msb<<8) | lsb;
+ m_reg16bit[idx] = (msb << 8) | lsb;
m_icount -= 8;
}
@@ -2144,41 +2117,39 @@ void hd61700_cpu_device::execute_run()
case 0xd8: //bup
case 0xd9: //bdn
+ for(;;)
{
- uint8_t src;
- for(;;)
- {
- src = mem_readbyte(REG_UA>>4, REG_IX);
- mem_writebyte(REG_UA>>6, REG_IZ, src);
+ uint8_t src = mem_readbyte(REG_UA >> 4, REG_IX);
+ mem_writebyte(REG_UA >> 6, REG_IZ, src);
- if (REG_IX == REG_IY)
- break;
+ if (REG_IX == REG_IY)
+ break;
- REG_IX += ((op&1) ? -1 : +1);
- REG_IZ += ((op&1) ? -1 : +1);
- m_icount -= 6;
- }
-
- m_icount -= 9;
+ REG_IX += ((op & 1) ? -1 : +1);
+ REG_IZ += ((op & 1) ? -1 : +1);
+ m_icount -= 6;
}
+
+ m_icount -= 9;
break;
case 0xda:
{
uint8_t arg = read_op();
- uint8_t op1 = (arg>>5) & 0x03;
+ uint8_t op1 = (arg >> 5) & 0x03;
switch (op1)
{
case 0x00: //didm
{
uint8_t arg1 = read_op();
- uint8_t r1 = 0, r2 = 0;
+ uint8_t r1 = 0;
+ uint8_t r2 = 0;
- for (int n=GET_IM3(arg1); n>0; n--)
+ for (int n = GET_IM3(arg1); n > 0; n--)
{
r2 = r1;
r1 = READ_REG(arg);
- r2 = ((r1>>4)&0x0f) | ((r2<<4)&0xf0);
+ r2 = (r1 >> 4) | (r2 << 4);
WRITE_REG(arg--, r2);
m_icount -= 5;
}
@@ -2192,13 +2163,14 @@ void hd61700_cpu_device::execute_run()
case 0x01: //dium
{
uint8_t arg1 = read_op();
- uint8_t r1 = 0, r2 = 0;
+ uint8_t r1 = 0;
+ uint8_t r2 = 0;
- for (int n=GET_IM3(arg1); n>0; n--)
+ for (int n = GET_IM3(arg1); n > 0; n--)
{
r2 = r1;
r1 = READ_REG(arg);
- r2 = ((r1<<4)&0xf0) | ((r2>>4)&0x0f);
+ r2 = (r1 << 4) | (r2 >> 4);
WRITE_REG(arg++, r2);
m_icount -= 5;
}
@@ -2212,9 +2184,11 @@ void hd61700_cpu_device::execute_run()
case 0x02: //bydm
{
uint8_t arg1 = read_op();
- uint8_t r1 = 0, r2 = 0, f = 0;
+ uint8_t r1 = 0;
+ uint8_t r2 = 0;
+ uint8_t f = 0;
- for (int n=GET_IM3(arg1); n>0; n--)
+ for (int n = GET_IM3(arg1); n > 0; n--)
{
r2 = r1;
r1 = READ_REG(arg);
@@ -2232,9 +2206,11 @@ void hd61700_cpu_device::execute_run()
case 0x03: //byum
{
uint8_t arg1 = read_op();
- uint8_t r1 = 0, r2 = 0, f = 0;
+ uint8_t r1 = 0;
+ uint8_t r2 = 0;
+ uint8_t f = 0;
- for (int n=GET_IM3(arg1); n>0; n--)
+ for (int n = GET_IM3(arg1); n > 0; n--)
{
r2 = r1;
r1 = READ_REG(arg);
@@ -2256,11 +2232,12 @@ void hd61700_cpu_device::execute_run()
{
uint8_t arg = read_op();
uint8_t arg1 = read_op();
- uint8_t r1 = 0, r2, f = 0;
+ uint8_t r1 = 0;
+ uint8_t f = 0;
- r2 = (arg&0x40) ? 0 : 1;
+ uint8_t r2 = BIT(~arg, 6);
- for (int n=GET_IM3(arg1); n>0; n--)
+ for (int n = GET_IM3(arg1); n > 0; n--)
{
r1 = r2 + (~READ_REG(arg));
WRITE_REG(arg++, r1);
@@ -2274,7 +2251,7 @@ void hd61700_cpu_device::execute_run()
CLEAR_FLAGS;
CHECK_FLAG_Z(f);
CHECK_FLAGB_UZ_LZ(r1);
- if (f != 0 || (arg & 0x40))
+ if (f != 0 || BIT(arg, 6))
SET_FLAG_C;
}
break;
@@ -2287,17 +2264,17 @@ void hd61700_cpu_device::execute_run()
for(;;)
{
- res = mem_readbyte(REG_UA>>4, REG_IX) - READ_REG(arg);
+ res = mem_readbyte(REG_UA >> 4, REG_IX) - READ_REG(arg);
if (REG_IX == REG_IY || !res)
break;
- REG_IX += ((op&1) ? -1 : +1);
+ REG_IX += ((op & 1) ? -1 : +1);
m_icount -= 6;
}
CLEAR_FLAGS;
- CHECK_FLAG_Z(res & 0xff);
+ CHECK_FLAG_Z((uint8_t)res);
CHECK_FLAGB_UZ_LZ(res);
CHECK_FLAG_C(res, 0xff);
@@ -2309,7 +2286,6 @@ void hd61700_cpu_device::execute_run()
{
uint8_t arg = read_op();
set_pc(REG_GET16(arg));
-
m_icount -= 5;
}
break;
@@ -2318,10 +2294,10 @@ void hd61700_cpu_device::execute_run()
{
uint8_t arg = read_op();
uint16_t offset = REG_GET16(arg);
- uint8_t lsb = mem_readbyte(REG_UA>>4, offset+0);
- uint8_t msb = mem_readbyte(REG_UA>>4, offset+1);
+ uint8_t lsb = mem_readbyte(REG_UA >> 4, offset);
+ uint8_t msb = mem_readbyte(REG_UA >> 4, offset + 1);
- set_pc((msb<<8) | lsb);
+ set_pc((msb << 8) | lsb);
m_icount -= 5;
}
@@ -2337,9 +2313,9 @@ void hd61700_cpu_device::execute_run()
REG_IX += ((arg & 0x80) ? -ir_inc : +ir_inc);
- for (int n=GET_IM3(arg1); n>0; n--)
+ for (int n = GET_IM3(arg1); n > 0; n--)
{
- mem_writebyte(REG_UA>>4, REG_IX++, READ_REG(arg++));
+ mem_writebyte(REG_UA >> 4, REG_IX++, READ_REG(arg++));
m_icount -= 3;
}
@@ -2359,9 +2335,9 @@ void hd61700_cpu_device::execute_run()
REG_IZ += ((arg & 0x80) ? -ir_inc : +ir_inc);
- for (int n=GET_IM3(arg1); n>0; n--)
+ for (int n = GET_IM3(arg1); n > 0; n--)
{
- mem_writebyte(REG_UA>>6, REG_IZ++, READ_REG(arg++));
+ mem_writebyte(REG_UA >> 6, REG_IZ++, READ_REG(arg++));
m_icount -= 3;
}
@@ -2379,9 +2355,9 @@ void hd61700_cpu_device::execute_run()
REG_IX += ((arg & 0x80) ? -ir_inc : +ir_inc);
- for (int n=GET_IM3(arg1); n>0; n--)
+ for (int n = GET_IM3(arg1); n > 0; n--)
{
- mem_writebyte(REG_UA>>4, REG_IX--, READ_REG(arg--));
+ mem_writebyte(REG_UA >> 4, REG_IX--, READ_REG(arg--));
m_icount -= 3;
}
@@ -2399,9 +2375,9 @@ void hd61700_cpu_device::execute_run()
REG_IZ += ((arg & 0x80) ? -ir_inc : +ir_inc);
- for (int n=GET_IM3(arg1); n>0; n--)
+ for (int n = GET_IM3(arg1); n > 0; n--)
{
- mem_writebyte(REG_UA>>6, REG_IZ--, READ_REG(arg--));
+ mem_writebyte(REG_UA >> 6, REG_IZ--, READ_REG(arg--));
m_icount -= 3;
}
@@ -2417,9 +2393,9 @@ void hd61700_cpu_device::execute_run()
uint8_t arg = read_op();
uint8_t arg1 = read_op();
- for (int n=GET_IM3(arg1); n>0; n--)
+ for (int n = GET_IM3(arg1); n > 0; n--)
{
- push((op&1) ? REG_US : REG_SS, READ_REG(arg--));
+ push((op & 1) ? REG_US : REG_SS, READ_REG(arg--));
m_icount -= 3;
}
@@ -2438,9 +2414,9 @@ void hd61700_cpu_device::execute_run()
REG_IX += ((arg & 0x80) ? -ir_inc : +ir_inc);
- for (int n=GET_IM3(arg1); n>0; n--)
+ for (int n = GET_IM3(arg1); n > 0; n--)
{
- WRITE_REG(arg++, mem_readbyte(REG_UA>>4, REG_IX++));
+ WRITE_REG(arg++, mem_readbyte(REG_UA >> 4, REG_IX++));
m_icount -= 3;
}
@@ -2460,9 +2436,9 @@ void hd61700_cpu_device::execute_run()
REG_IZ += ((arg & 0x80) ? -ir_inc : +ir_inc);
- for (int n=GET_IM3(arg1); n>0; n--)
+ for (int n = GET_IM3(arg1); n > 0; n--)
{
- WRITE_REG(arg++, mem_readbyte(REG_UA>>6, REG_IZ++));
+ WRITE_REG(arg++, mem_readbyte(REG_UA >> 6, REG_IZ++));
m_icount -= 3;
}
@@ -2480,9 +2456,9 @@ void hd61700_cpu_device::execute_run()
REG_IX += ((arg & 0x80) ? -ir_inc : +ir_inc);
- for (int n=GET_IM3(arg1); n>0; n--)
+ for (int n = GET_IM3(arg1); n > 0; n--)
{
- WRITE_REG(arg--, mem_readbyte(REG_UA>>4, REG_IX--));
+ WRITE_REG(arg--, mem_readbyte(REG_UA >> 4, REG_IX--));
m_icount -= 3;
}
@@ -2500,9 +2476,9 @@ void hd61700_cpu_device::execute_run()
REG_IZ += ((arg & 0x80) ? -ir_inc : +ir_inc);
- for (int n=GET_IM3(arg1); n>0; n--)
+ for (int n = GET_IM3(arg1); n > 0; n--)
{
- WRITE_REG(arg--, mem_readbyte(REG_UA>>6, REG_IZ--));
+ WRITE_REG(arg--, mem_readbyte(REG_UA >> 6, REG_IZ--));
m_icount -= 3;
}
@@ -2518,9 +2494,9 @@ void hd61700_cpu_device::execute_run()
uint8_t arg = read_op();
uint8_t arg1 = read_op();
- for (int n=GET_IM3(arg1); n>0; n--)
+ for (int n = GET_IM3(arg1); n > 0; n--)
{
- WRITE_REG(arg++, pop((op&1) ? REG_US : REG_SS));
+ WRITE_REG(arg++, pop((op & 1) ? REG_US : REG_SS));
m_icount -= 3;
}
@@ -2539,32 +2515,32 @@ void hd61700_cpu_device::execute_run()
{
if (check_cond(op))
{
- uint8_t lsb = pop(REG_SS) ;
+ uint8_t lsb = pop(REG_SS);
uint8_t msb = pop(REG_SS);
- set_pc((((msb<<8) | (lsb<<0)) + 1));
+ set_pc(((msb << 8) | lsb) + 1);
}
m_icount -= 3;
}
break;
case 0xf8: //nop
- m_icount -= 3;
+ m_icount -= 3;
break;
case 0xf9: //clt
- REG_TM = 0;
- m_icount -= 3;
+ REG_TM = 0;
+ m_icount -= 3;
break;
case 0xfa: //fst
- m_state |= CPU_FAST;
- m_icount -= 3;
+ m_state |= CPU_FAST;
+ m_icount -= 3;
break;
case 0xfb: //slw
- m_state &= ~CPU_FAST;
- m_icount -= 3;
+ m_state &= ~CPU_FAST;
+ m_icount -= 3;
break;
case 0xfd: //rtni
@@ -2572,58 +2548,52 @@ void hd61700_cpu_device::execute_run()
uint8_t lsb = pop(REG_SS);
uint8_t msb = pop(REG_SS);
- set_pc((msb<<8) | (lsb<<0));
+ set_pc((msb << 8) | lsb);
m_icount -= 5;
}
[[fallthrough]];
case 0xfc: //cani
+ for (uint8_t arg = 0x10; arg > 0; arg >>= 1)
{
- for (uint8_t arg=0x10; arg>0; arg>>=1)
+ if (REG_IB & arg)
{
- if (REG_IB & arg)
- {
- REG_IB &= (~arg);
- m_irq_status &= (~arg);
- break;
- }
+ REG_IB &= ~arg;
+ m_irq_status &= ~arg;
+ break;
}
-
- m_icount -= 3;
}
+
+ m_icount -= 3;
break;
case 0xfe: //off
- {
- set_pc(0);
- REG_UA = REG_IA = 0;
- REG_IX = REG_IY = REG_IZ = 0;
- REG_PE = 0;
- REG_IE = (REG_IE&0x0c) | ((REG_IB>>1) & 0x10);
- REG_IB &= 0xe3;
- if (m_flags & FLAG_SW)
- m_flags |= FLAG_APO;
- else
- m_flags &= ~FLAG_APO;
+ set_pc(0);
+ REG_UA = REG_IA = 0;
+ REG_IX = REG_IY = REG_IZ = 0;
+ REG_PE = 0;
+ REG_IE = (REG_IE & 0x0c) | ((REG_IB >> 1) & 0x10);
+ REG_IB &= 0xe3;
+ if (m_flags & FLAG_SW)
+ m_flags |= FLAG_APO;
+ else
+ m_flags &= ~FLAG_APO;
- m_state |= CPU_SLP;
+ m_state |= CPU_SLP;
- m_irq_status = 0;
- m_lcd_ctrl_cb((offs_t)0, 0);
- m_kb_write_cb((offs_t)0, 0);
- m_icount -= 3;
- }
+ m_irq_status = 0;
+ m_lcd_ctrl_cb(0);
+ m_kb_write_cb(0);
+ m_icount -= 3;
break;
case 0xff: //trp
- {
- m_pc--;
- push(REG_SS, (m_pc>>8)&0xff);
- push(REG_SS, (m_pc>>0)&0xff);
- set_pc(0x0022);
- m_icount -= 9;
- }
+ m_pc--;
+ push(REG_SS, (uint8_t)(m_pc >> 8));
+ push(REG_SS, (uint8_t)m_pc);
+ set_pc(0x0022);
+ m_icount -= 9;
break;
case 0x03:
@@ -2657,7 +2627,7 @@ void hd61700_cpu_device::execute_run()
//if is in the internal ROM align the pc
if (!WORD_ALIGNED(m_fetch_addr) && m_pc < INT_ROM)
- set_pc((m_fetch_addr+1)>>1);
+ set_pc((m_fetch_addr + 1) >> 1);
m_icount -= 3;
} while (m_icount > 0);
@@ -2685,33 +2655,33 @@ void hd61700_cpu_device::execute_set_input(int inputnum, int state)
set_pc(0x0000);
break;
case HD61700_KEY_INT: //level sensitive line
- if (((REG_IE>>3) & (1<<inputnum)) && state != CLEAR_LINE)
- REG_IB |= (1<<inputnum);
+ if (BIT(REG_IE >> 3, inputnum) && state != CLEAR_LINE)
+ REG_IB |= (1 << inputnum);
break;
case HD61700_INT1: //edge sensitive line
- if (((REG_IE>>3) & (1<<inputnum)) && (m_lines_status[inputnum] != state))
- REG_IB |= (1<<inputnum);
+ if (BIT(REG_IE >> 3, inputnum) && m_lines_status[inputnum] != state)
+ REG_IB |= (1 << inputnum);
if (m_lines_status[inputnum] == CLEAR_LINE && state != CLEAR_LINE)
REG_IE = (REG_IE & 0xfd) | 0x02; //rising edge
else if (m_lines_status[inputnum] != CLEAR_LINE && state == CLEAR_LINE)
REG_IE = (REG_IE & 0xfd) | 0x00; //falling edge
- REG_KY = (REG_KY & 0xf7ff) | ((state != CLEAR_LINE)<<11);
+ REG_KY = (REG_KY & 0xf7ff) | ((state != CLEAR_LINE) << 11);
break;
case HD61700_INT2: //level sensitive line
- if (((REG_IE>>3) & (1<<inputnum)) && state != CLEAR_LINE)
- REG_IB |= (1<<inputnum);
+ if (BIT(REG_IE >> 3, inputnum) && state != CLEAR_LINE)
+ REG_IB |= (1 << inputnum);
REG_IE = (REG_IE & 0xfe) | (state != CLEAR_LINE);
- REG_KY = (REG_KY & 0xfbff) | ((state != CLEAR_LINE)<<10);
+ REG_KY = (REG_KY & 0xfbff) | ((state != CLEAR_LINE) << 10);
break;
case HD61700_ON_INT: //level sensitive line
- if ((REG_IE>>3) & (1<<inputnum) && state != CLEAR_LINE)
- REG_IB |= (1<<inputnum);
+ if (BIT(REG_IE >> 3, inputnum) && state != CLEAR_LINE)
+ REG_IB |= (1 << inputnum);
- REG_KY = (REG_KY & 0xfdff) | ((state != CLEAR_LINE)<<9);
+ REG_KY = (REG_KY & 0xfdff) | ((state != CLEAR_LINE) << 9);
break;
case HD61700_SW: //level sensitive line
@@ -2725,7 +2695,7 @@ void hd61700_cpu_device::execute_set_input(int inputnum, int state)
}
}
- m_flags |= ((state != CLEAR_LINE)<<3);
+ m_flags |= (state != CLEAR_LINE) << 3;
break;
}
@@ -2742,43 +2712,43 @@ inline void hd61700_cpu_device::set_pc(int32_t new_pc)
m_curpc = (m_curpc & 0x30000) | new_pc;
m_pc = new_pc & 0xffff;
m_ppc = m_curpc;
- m_fetch_addr = new_pc<<1;
+ m_fetch_addr = new_pc << 1;
}
inline uint8_t hd61700_cpu_device::read_op()
{
uint16_t data;
- uint32_t addr18 = make_18bit_addr((m_irq_status) ? 0 : prev_ua, m_pc);
+ uint32_t addr18 = make_18bit_addr(m_irq_status ? 0 : prev_ua, m_pc);
if (m_pc <= INT_ROM)
{
data = m_program->read_word(addr18);
- if (!(m_fetch_addr&1))
- data = (data>>8) ;
+ if (!(m_fetch_addr & 1))
+ data >>= 8;
}
else
{
- if (m_fetch_addr&1)
+ if (m_fetch_addr & 1)
data = m_program->read_word(addr18 + 1);
else
- data = m_program->read_word(addr18 + 0);
+ data = m_program->read_word(addr18);
}
- m_fetch_addr += ((m_pc > INT_ROM) ? 2 : 1);
+ m_fetch_addr += (m_pc > INT_ROM) ? 2 : 1;
- m_pc = m_fetch_addr>>1;
+ m_pc = m_fetch_addr >> 1;
- m_curpc = make_18bit_addr((m_irq_status) ? 0 : prev_ua, m_pc);
+ m_curpc = make_18bit_addr(m_irq_status ? 0 : prev_ua, m_pc);
prev_ua = REG_UA;
- return (data&0xff);
+ return (uint8_t)data;
}
inline uint8_t hd61700_cpu_device::mem_readbyte(uint8_t segment, uint16_t offset)
{
- return m_program->read_word(make_18bit_addr(segment, offset)) & 0xff;
+ return (uint8_t)m_program->read_word(make_18bit_addr(segment, offset));
}
inline void hd61700_cpu_device::mem_writebyte(uint8_t segment, uint16_t offset, uint8_t data)
@@ -2789,7 +2759,7 @@ inline void hd61700_cpu_device::mem_writebyte(uint8_t segment, uint16_t offset,
inline uint32_t hd61700_cpu_device::make_18bit_addr(uint8_t segment, uint16_t offset)
{
if (offset >= ((REG_IB>>6) & 0x03) * 0x4000)
- return (uint32_t)((offset | ((segment&0x03)<<16)) & 0x3ffff);
+ return (uint32_t)((offset | ((segment & 0x03) << 16)) & 0x3ffff);
else
return offset;
}
@@ -2797,52 +2767,52 @@ inline uint32_t hd61700_cpu_device::make_18bit_addr(uint8_t segment, uint16_t of
inline void hd61700_cpu_device::push(uint16_t &offset, uint8_t data)
{
offset--;
- mem_writebyte(REG_UA>>2, offset, data);
+ mem_writebyte(REG_UA >> 2, offset, data);
}
inline uint8_t hd61700_cpu_device::pop(uint16_t &offset)
{
- uint8_t data = mem_readbyte(REG_UA>>2, offset);
+ uint8_t data = mem_readbyte(REG_UA >> 2, offset);
offset++;
return data;
}
inline int hd61700_cpu_device::check_cond(uint32_t op)
{
- switch ( op & 0x07 )
+ switch (op & 0x07)
{
case 0x00: // Z set
- if ( !(m_flags & FLAG_Z) )
+ if (!(m_flags & FLAG_Z))
return 1;
break;
case 0x01: // NC set
- if ( !(m_flags & FLAG_C) )
+ if (!(m_flags & FLAG_C))
return 1;
break;
case 0x02: // LZ set
- if ( !(m_flags & FLAG_LZ) )
+ if (!(m_flags & FLAG_LZ))
return 1;
break;
case 0x03: // UZ set
- if ( !(m_flags & FLAG_UZ) )
+ if (!(m_flags & FLAG_UZ))
return 1;
break;
case 0x04: // NZ set
- if ( m_flags & FLAG_Z )
+ if (m_flags & FLAG_Z)
return 1;
break;
case 0x05: // C set
- if ( m_flags & FLAG_C )
+ if (m_flags & FLAG_C)
return 1;
break;
case 0x06: // NLZ clear
- if ( m_flags & FLAG_LZ )
+ if (m_flags & FLAG_LZ)
return 1;
break;
@@ -2855,7 +2825,7 @@ inline int hd61700_cpu_device::check_cond(uint32_t op)
inline uint8_t hd61700_cpu_device::make_logic(uint8_t type, uint8_t d1, uint8_t d2)
{
- switch (type&3)
+ switch (type & 3)
{
case 0: //and
return d1 & d2;
@@ -2887,11 +2857,9 @@ inline void hd61700_cpu_device::check_optional_jr(uint8_t arg)
inline uint8_t hd61700_cpu_device::get_sir_im8(uint8_t arg)
{
- if (((arg>>5) & 0x03) == 0x03)
+ if (((arg >> 5) & 0x03) == 0x03)
{
- uint8_t arg1 = read_op();
-
- return arg1&0x1f;
+ return read_op() & 0x1f;
}
else
{
@@ -2901,9 +2869,9 @@ inline uint8_t hd61700_cpu_device::get_sir_im8(uint8_t arg)
inline uint8_t hd61700_cpu_device::get_sir_im8(uint8_t arg, uint8_t arg1)
{
- if (((arg>>5) & 0x03) == 0x03)
+ if (((arg >> 5) & 0x03) == 0x03)
{
- return arg1&0x1f;
+ return arg1 & 0x1f;
}
else
{
@@ -2931,7 +2899,7 @@ inline int hd61700_cpu_device::get_sign_im8(uint8_t arg)
inline int hd61700_cpu_device::get_im_7(uint8_t data)
{
- if (data&0x80)
+ if (data & 0x80)
return 0x80 - data;
else
return data;
@@ -2939,7 +2907,7 @@ inline int hd61700_cpu_device::get_im_7(uint8_t data)
inline uint16_t hd61700_cpu_device::make_bcd_sub(uint8_t arg1, uint8_t arg2)
{
- uint32_t ret = (arg1&0x0f) - (arg2&0x0f);
+ uint32_t ret = (arg1 & 0x0f) - (arg2 & 0x0f);
uint8_t carry;
if (ret > 0x09)
@@ -2950,24 +2918,24 @@ inline uint16_t hd61700_cpu_device::make_bcd_sub(uint8_t arg1, uint8_t arg2)
else
carry = 0;
- ret += ((arg1&0xf0) - (arg2&0xf0) - (carry<<4));
+ ret += ((arg1 & 0xf0) - (arg2 & 0xf0) - (carry << 4));
if (ret > 0x9f)
{
- ret = (ret - 0x60) & 0x0ff;
+ ret = (uint8_t)(ret - 0x60);
carry = 1;
}
else
carry = 0;
- ret -= (carry<<8);
+ ret -= carry << 8;
return ret;
}
inline uint16_t hd61700_cpu_device::make_bcd_add(uint8_t arg1, uint8_t arg2)
{
- uint32_t ret = (arg1&0x0f) + (arg2&0x0f);
+ uint32_t ret = (arg1 & 0x0f) + (arg2 & 0x0f);
uint8_t carry;
if (ret > 0x09)
@@ -2978,17 +2946,17 @@ inline uint16_t hd61700_cpu_device::make_bcd_add(uint8_t arg1, uint8_t arg2)
else
carry = 0;
- ret += ((arg1&0xf0) + (arg2&0xf0) + (carry<<4));
+ ret += ((arg1 & 0xf0) + (arg2 & 0xf0) + (carry << 4));
if (ret > 0x9f)
{
- ret = (ret + 0x60) & 0x0ff;
+ ret = (uint8_t)(ret + 0x60);
carry = 1;
}
else
carry = 0;
- ret += (carry<<8);
+ ret += carry << 8;
return ret;
}
diff --git a/src/devices/cpu/hd61700/hd61700.h b/src/devices/cpu/hd61700/hd61700.h
index d51247e7c13..6f7ef9462ff 100644
--- a/src/devices/cpu/hd61700/hd61700.h
+++ b/src/devices/cpu/hd61700/hd61700.h
@@ -47,7 +47,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_execute_interface overrides
virtual uint32_t execute_min_cycles() const noexcept override { return 1; }
@@ -69,24 +68,26 @@ protected:
// interrupts
bool check_irqs();
- // inline helpers
- inline void set_pc(int32_t new_pc);
- inline uint8_t read_op();
- inline uint8_t mem_readbyte(uint8_t segment, uint16_t offset);
- inline void mem_writebyte(uint8_t segment, uint16_t offset, uint8_t data);
- inline uint32_t make_18bit_addr(uint8_t segment, uint16_t offset);
- inline int check_cond( uint32_t op );
- inline void push(uint16_t &offset, uint8_t data);
- inline uint8_t pop(uint16_t &offset);
- inline uint8_t make_logic(uint8_t type, uint8_t d1, uint8_t d2);
- inline void check_optional_jr(uint8_t arg);
- inline uint8_t get_sir_im8(uint8_t arg);
- inline uint8_t get_sir_im8(uint8_t arg, uint8_t arg1);
- inline int get_sign_mreg(uint8_t op1);
- inline int get_sign_im8(uint8_t op1);
- inline int get_im_7(uint8_t data);
- inline uint16_t make_bcd_sub(uint8_t arg1, uint8_t arg2);
- inline uint16_t make_bcd_add(uint8_t arg1, uint8_t arg2);
+ // helpers
+ void set_pc(int32_t new_pc);
+ uint8_t read_op();
+ uint8_t mem_readbyte(uint8_t segment, uint16_t offset);
+ void mem_writebyte(uint8_t segment, uint16_t offset, uint8_t data);
+ uint32_t make_18bit_addr(uint8_t segment, uint16_t offset);
+ int check_cond( uint32_t op );
+ void push(uint16_t &offset, uint8_t data);
+ uint8_t pop(uint16_t &offset);
+ uint8_t make_logic(uint8_t type, uint8_t d1, uint8_t d2);
+ void check_optional_jr(uint8_t arg);
+ uint8_t get_sir_im8(uint8_t arg);
+ uint8_t get_sir_im8(uint8_t arg, uint8_t arg1);
+ int get_sign_mreg(uint8_t op1);
+ int get_sign_im8(uint8_t op1);
+ int get_im_7(uint8_t data);
+ uint16_t make_bcd_sub(uint8_t arg1, uint8_t arg2);
+ uint16_t make_bcd_add(uint8_t arg1, uint8_t arg2);
+
+ TIMER_CALLBACK_MEMBER(second_tick);
// registers
enum
@@ -96,8 +97,6 @@ protected:
HD61700_IY, HD61700_IZ, HD61700_US, HD61700_SS, HD61700_KY, HD61700_MAINREG
};
- static constexpr device_timer_id SEC_TIMER = 1;
-
// internal state
address_space_config m_program_config;
emu_timer *m_sec_timer;
diff --git a/src/devices/cpu/i86/i186.cpp b/src/devices/cpu/i86/i186.cpp
index 8ebcaf3b1db..477d53c3ad1 100644
--- a/src/devices/cpu/i86/i186.cpp
+++ b/src/devices/cpu/i86/i186.cpp
@@ -11,11 +11,15 @@
#include "i186.h"
#include "i86inline.h"
-#define LOG_PORTS 0
-#define LOG_INTERRUPTS 0
-#define LOG_INTERRUPTS_EXT 0
-#define LOG_TIMER 0
-#define LOG_DMA 0
+#define LOG_PORTS (1U << 1)
+#define LOG_INTERRUPTS (1U << 2)
+#define LOG_INTERRUPTS_EXT (1U << 3)
+#define LOG_TIMER (1U << 4)
+#define LOG_DMA (1U << 5)
+#define LOG_DMA_HIFREQ (1U << 6)
+
+#define VERBOSE (0)
+#include "logmacro.h"
/* external int priority masks */
@@ -154,7 +158,7 @@ i80186_cpu_device::i80186_cpu_device(const machine_config &mconfig, device_type
device_memory_interface::space_config_vector i80186_cpu_device::memory_space_config() const
{
- if(has_configured_map(AS_OPCODES))
+ if (has_configured_map(AS_OPCODES))
return space_config_vector {
std::make_pair(AS_PROGRAM, &m_program_config),
std::make_pair(AS_OPCODES, &m_opcodes_config),
@@ -176,25 +180,25 @@ uint8_t i80186_cpu_device::fetch()
void i80186_cpu_device::execute_run()
{
- while(m_icount > 0 )
+ while (m_icount > 0)
{
- if((m_dma[0].drq_state && (m_dma[0].control & ST_STOP)) || (m_dma[1].drq_state && (m_dma[1].control & ST_STOP)))
+ if ((m_dma[0].drq_state && (m_dma[0].control & ST_STOP)) || (m_dma[1].drq_state && (m_dma[1].control & ST_STOP)))
{
int channel = m_last_dma ? 0 : 1;
m_last_dma = !m_last_dma;
- if(!(m_dma[1].drq_state && (m_dma[1].control & ST_STOP)))
+ if (!(m_dma[1].drq_state && (m_dma[1].control & ST_STOP)))
channel = 0;
- else if(!(m_dma[0].drq_state && (m_dma[0].control & ST_STOP)))
+ else if (!(m_dma[0].drq_state && (m_dma[0].control & ST_STOP)))
channel = 1;
- else if((m_dma[0].control & CHANNEL_PRIORITY) && !(m_dma[1].control & CHANNEL_PRIORITY))
+ else if ((m_dma[0].control & CHANNEL_PRIORITY) && !(m_dma[1].control & CHANNEL_PRIORITY))
channel = 0;
- else if((m_dma[1].control & CHANNEL_PRIORITY) && !(m_dma[0].control & CHANNEL_PRIORITY))
+ else if ((m_dma[1].control & CHANNEL_PRIORITY) && !(m_dma[0].control & CHANNEL_PRIORITY))
channel = 1;
m_icount--;
drq_callback(channel);
continue;
}
- if ( m_seg_prefix_next )
+ if (m_seg_prefix_next)
{
m_seg_prefix = true;
m_seg_prefix_next = false;
@@ -205,15 +209,15 @@ void i80186_cpu_device::execute_run()
m_seg_prefix = false;
/* Dispatch IRQ */
- if ( m_pending_irq && m_no_interrupt == 0 )
+ if (m_pending_irq && m_no_interrupt == 0)
{
- if ( m_pending_irq & NMI_IRQ )
+ if (m_pending_irq & NMI_IRQ)
{
interrupt(2);
m_pending_irq &= ~NMI_IRQ;
m_halt = false;
}
- else if ( m_IF )
+ else if (m_IF)
{
/* the actual vector is retrieved after pushing flags */
/* and clearing the IF */
@@ -222,22 +226,22 @@ void i80186_cpu_device::execute_run()
}
}
- if(m_halt)
+ if (m_halt)
{
m_icount = 0;
return;
}
/* No interrupt allowed between last instruction and this one */
- if ( m_no_interrupt )
+ if (m_no_interrupt)
{
m_no_interrupt--;
}
/* trap should allow one instruction to be executed */
- if ( m_fire_trap )
+ if (m_fire_trap)
{
- if ( m_fire_trap >= 2 )
+ if (m_fire_trap >= 2)
{
interrupt(1);
m_fire_trap = 0;
@@ -285,12 +289,11 @@ void i80186_cpu_device::execute_run()
case 0x62: // i_bound
{
- uint32_t low,high,tmp;
m_modrm = fetch();
- low = GetRMWord();
- high = GetnextRMWord();
- tmp = RegWord();
- if (tmp<low || tmp>high)
+ uint32_t low = GetRMWord();
+ uint32_t high = GetnextRMWord();
+ uint32_t tmp = RegWord();
+ if (tmp < low || tmp > high)
interrupt(5);
CLK(BOUND);
logerror("%06x: bound %04x high %04x low %04x tmp\n", m_pc, high, low, tmp);
@@ -298,16 +301,15 @@ void i80186_cpu_device::execute_run()
break;
case 0x68: // i_push_d16
- PUSH( fetch_word() );
+ PUSH(fetch_word());
CLK(PUSH_IMM);
break;
case 0x69: // i_imul_d16
{
- uint32_t tmp;
DEF_r16w();
- tmp = fetch_word();
- m_dst = (int32_t)((int16_t)m_src)*(int32_t)((int16_t)tmp);
+ uint32_t tmp = fetch_word();
+ m_dst = (int32_t)((int16_t)m_src) * (int32_t)((int16_t)tmp);
m_CarryVal = m_OverVal = (((int32_t)m_dst) >> 15 != 0) && (((int32_t)m_dst) >> 15 != -1);
RegWord(m_dst);
CLKM(IMUL_RRI16, IMUL_RMI16);
@@ -315,16 +317,15 @@ void i80186_cpu_device::execute_run()
break;
case 0x6a: // i_push_d8
- PUSH( (uint16_t)((int16_t)((int8_t)fetch())) );
+ PUSH((uint16_t)((int16_t)((int8_t)fetch())));
CLK(PUSH_IMM);
break;
case 0x6b: // i_imul_d8
{
- uint32_t src2;
DEF_r16w();
- src2= (uint16_t)((int16_t)((int8_t)fetch()));
- m_dst = (int32_t)((int16_t)m_src)*(int32_t)((int16_t)src2);
+ uint32_t src2 = (uint16_t)(int8_t)fetch();
+ m_dst = (int32_t)((int16_t)m_src) * (int32_t)((int16_t)src2);
m_CarryVal = m_OverVal = (((int32_t)m_dst) >> 15 != 0) && (((int32_t)m_dst) >> 15 != -1);
RegWord(m_dst);
CLKM(IMUL_RRI8, IMUL_RMI8);
@@ -350,7 +351,7 @@ void i80186_cpu_device::execute_run()
case 0x8e: // i_mov_sregw
m_modrm = fetch();
m_src = GetRMWord();
- CLKM(MOV_SR,MOV_SM);
+ CLKM(MOV_SR, MOV_SM);
switch (m_modrm & 0x38)
{
case 0x00: /* mov es,ew */
@@ -373,21 +374,20 @@ void i80186_cpu_device::execute_run()
case 0xc0: // i_rotshft_bd8
{
- uint8_t c;
m_modrm = fetch();
m_src = GetRMByte();
m_dst = m_src;
- c = fetch() & 0x1f;
- CLKM(ROT_REG_BASE,ROT_M8_BASE);
+ uint8_t c = fetch() & 0x1f;
+ CLKM(ROT_REG_BASE, ROT_M8_BASE);
m_icount -= m_timing[ROT_REG_BIT] * c;
if (c)
{
- switch ( m_modrm & 0x38 )
+ switch (m_modrm & 0x38)
{
- case 0x00: do { ROL_BYTE(); c--; } while (c>0); PutbackRMByte(m_dst); break;
- case 0x08: do { ROR_BYTE(); c--; } while (c>0); PutbackRMByte(m_dst); break;
- case 0x10: do { ROLC_BYTE(); c--; } while (c>0); PutbackRMByte(m_dst); break;
- case 0x18: do { RORC_BYTE(); c--; } while (c>0); PutbackRMByte(m_dst); break;
+ case 0x00: do { ROL_BYTE(); c--; } while (c > 0); PutbackRMByte(m_dst); break;
+ case 0x08: do { ROR_BYTE(); c--; } while (c > 0); PutbackRMByte(m_dst); break;
+ case 0x10: do { ROLC_BYTE(); c--; } while (c > 0); PutbackRMByte(m_dst); break;
+ case 0x18: do { RORC_BYTE(); c--; } while (c > 0); PutbackRMByte(m_dst); break;
case 0x30:
case 0x20: SHL_BYTE(c); break;
case 0x28: SHR_BYTE(c); break;
@@ -399,21 +399,20 @@ void i80186_cpu_device::execute_run()
case 0xc1: // i_rotshft_wd8
{
- uint8_t c;
m_modrm = fetch();
m_src = GetRMWord();
m_dst = m_src;
- c = fetch() & 0x1f;
- CLKM(ROT_REG_BASE,ROT_M16_BASE);
+ uint8_t c = fetch() & 0x1f;
+ CLKM(ROT_REG_BASE, ROT_M16_BASE);
m_icount -= m_timing[ROT_REG_BIT] * c;
if (c)
{
- switch ( m_modrm & 0x38 )
+ switch (m_modrm & 0x38)
{
- case 0x00: do { ROL_WORD(); c--; } while (c>0); PutbackRMWord(m_dst); break;
- case 0x08: do { ROR_WORD(); c--; } while (c>0); PutbackRMWord(m_dst); break;
- case 0x10: do { ROLC_WORD(); c--; } while (c>0); PutbackRMWord(m_dst); break;
- case 0x18: do { RORC_WORD(); c--; } while (c>0); PutbackRMWord(m_dst); break;
+ case 0x00: do { ROL_WORD(); c--; } while (c > 0); PutbackRMWord(m_dst); break;
+ case 0x08: do { ROR_WORD(); c--; } while (c > 0); PutbackRMWord(m_dst); break;
+ case 0x10: do { ROLC_WORD(); c--; } while (c > 0); PutbackRMWord(m_dst); break;
+ case 0x18: do { RORC_WORD(); c--; } while (c > 0); PutbackRMWord(m_dst); break;
case 0x30:
case 0x20: SHL_WORD(c); break;
case 0x28: SHR_WORD(c); break;
@@ -426,19 +425,18 @@ void i80186_cpu_device::execute_run()
case 0xc8: // i_enter
{
uint16_t nb = fetch();
- uint32_t level;
-
nb |= fetch() << 8;
- level = fetch();
+
+ uint32_t level = fetch();
CLK(!level ? ENTER0 : (level == 1) ? ENTER1 : ENTER_BASE);
- if(level > 1)
+ if (level > 1)
m_icount -= level * m_timing[ENTER_COUNT];
PUSH(m_regs.w[BP]);
m_regs.w[BP] = m_regs.w[SP];
m_regs.w[SP] -= nb;
- for (int i=1; i<level; i++)
+ for (int i = 1; i < level; i++)
{
- PUSH( GetMemW(SS,m_regs.w[BP] - i*2) );
+ PUSH(GetMemW(SS, m_regs.w[BP] - i * 2));
}
if (level)
{
@@ -455,22 +453,20 @@ void i80186_cpu_device::execute_run()
case 0xd2: // i_rotshft_bcl
{
- uint8_t c;
-
m_modrm = fetch();
m_src = GetRMByte();
m_dst = m_src;
- c = m_regs.b[CL] & 0x1f;
- CLKM(ROT_REG_BASE,ROT_M16_BASE);
+ uint8_t c = m_regs.b[CL] & 0x1f;
+ CLKM(ROT_REG_BASE, ROT_M16_BASE);
m_icount -= m_timing[ROT_REG_BIT] * c;
if (c)
{
- switch ( m_modrm & 0x38 )
+ switch (m_modrm & 0x38)
{
- case 0x00: do { ROL_BYTE(); c--; } while (c>0); PutbackRMByte(m_dst); break;
- case 0x08: do { ROR_BYTE(); c--; } while (c>0); PutbackRMByte(m_dst); break;
- case 0x10: do { ROLC_BYTE(); c--; } while (c>0); PutbackRMByte(m_dst); break;
- case 0x18: do { RORC_BYTE(); c--; } while (c>0); PutbackRMByte(m_dst); break;
+ case 0x00: do { ROL_BYTE(); c--; } while (c > 0); PutbackRMByte(m_dst); break;
+ case 0x08: do { ROR_BYTE(); c--; } while (c > 0); PutbackRMByte(m_dst); break;
+ case 0x10: do { ROLC_BYTE(); c--; } while (c > 0); PutbackRMByte(m_dst); break;
+ case 0x18: do { RORC_BYTE(); c--; } while (c > 0); PutbackRMByte(m_dst); break;
case 0x30:
case 0x20: SHL_BYTE(c); break;
case 0x28: SHR_BYTE(c); break;
@@ -482,22 +478,20 @@ void i80186_cpu_device::execute_run()
case 0xd3: // i_rotshft_wcl
{
- uint8_t c;
-
m_modrm = fetch();
m_src = GetRMWord();
m_dst = m_src;
- c = m_regs.b[CL] & 0x1f;
- CLKM(ROT_REG_BASE,ROT_M16_BASE);
+ uint8_t c = m_regs.b[CL] & 0x1f;
+ CLKM(ROT_REG_BASE, ROT_M16_BASE);
m_icount -= m_timing[ROT_REG_BIT] * c;
if (c)
{
- switch ( m_modrm & 0x38 )
+ switch (m_modrm & 0x38)
{
- case 0x00: do { ROL_WORD(); c--; } while (c>0); PutbackRMWord(m_dst); break;
- case 0x08: do { ROR_WORD(); c--; } while (c>0); PutbackRMWord(m_dst); break;
- case 0x10: do { ROLC_WORD(); c--; } while (c>0); PutbackRMWord(m_dst); break;
- case 0x18: do { RORC_WORD(); c--; } while (c>0); PutbackRMWord(m_dst); break;
+ case 0x00: do { ROL_WORD(); c--; } while (c > 0); PutbackRMWord(m_dst); break;
+ case 0x08: do { ROR_WORD(); c--; } while (c > 0); PutbackRMWord(m_dst); break;
+ case 0x10: do { ROLC_WORD(); c--; } while (c > 0); PutbackRMWord(m_dst); break;
+ case 0x18: do { RORC_WORD(); c--; } while (c > 0); PutbackRMWord(m_dst); break;
case 0x30:
case 0x20: SHL_WORD(c); break;
case 0x28: SHR_WORD(c); break;
@@ -515,7 +509,7 @@ void i80186_cpu_device::execute_run()
case 0xdd:
case 0xde:
case 0xdf:
- if(m_reloc & 0x8000)
+ if (m_reloc & 0x8000)
{
m_ip = m_prev_ip;
interrupt(7);
@@ -525,7 +519,7 @@ void i80186_cpu_device::execute_run()
GetRMByte();
CLK(NOP);
// The 80187 has the FSTSW AX instruction
- if((m_modrm == 0xe0) && (op == 0xdf))
+ if ((m_modrm == 0xe0) && (op == 0xdf))
m_regs.w[AX] = 0xffff; // FPU not present
break;
@@ -548,26 +542,78 @@ void i80186_cpu_device::execute_run()
switch (next)
{
- case 0x6c: CLK(OVERRIDE); if (c) do { i_insb(); c--; } while (c>0 && m_icount>0); m_regs.w[CX]=c; m_seg_prefix = false; m_seg_prefix_next = false; break;
- case 0x6d: CLK(OVERRIDE); if (c) do { i_insw(); c--; } while (c>0 && m_icount>0); m_regs.w[CX]=c; m_seg_prefix = false; m_seg_prefix_next = false; break;
- case 0x6e: CLK(OVERRIDE); if (c) do { i_outsb(); c--; } while (c>0 && m_icount>0); m_regs.w[CX]=c; m_seg_prefix = false; m_seg_prefix_next = false; break;
- case 0x6f: CLK(OVERRIDE); if (c) do { i_outsw(); c--; } while (c>0 && m_icount>0); m_regs.w[CX]=c; m_seg_prefix = false; m_seg_prefix_next = false; break;
+ case 0x6c:
+ CLK(OVERRIDE);
+ if (c)
+ {
+ do
+ {
+ i_insb();
+ c--;
+ } while (c > 0 && m_icount > 0);
+ }
+ m_regs.w[CX] = c;
+ m_seg_prefix = false;
+ m_seg_prefix_next = false;
+ break;
+ case 0x6d:
+ CLK(OVERRIDE);
+ if (c)
+ {
+ do
+ {
+ i_insw();
+ c--;
+ } while (c > 0 && m_icount > 0);
+ }
+ m_regs.w[CX] = c;
+ m_seg_prefix = false;
+ m_seg_prefix_next = false;
+ break;
+ case 0x6e:
+ CLK(OVERRIDE);
+ if (c)
+ {
+ do
+ {
+ i_outsb();
+ c--;
+ } while (c > 0 && m_icount > 0);
+ }
+ m_regs.w[CX] = c;
+ m_seg_prefix = false;
+ m_seg_prefix_next = false;
+ break;
+ case 0x6f:
+ CLK(OVERRIDE);
+ if (c)
+ {
+ do
+ {
+ i_outsw();
+ c--;
+ } while (c > 0 && m_icount > 0);
+ }
+ m_regs.w[CX] = c;
+ m_seg_prefix = false;
+ m_seg_prefix_next = false;
+ break;
default:
// Decrement IP and pass on
m_ip -= 1 + (m_seg_prefix_next ? 1 : 0);
pass = true;
break;
}
- if(!pass)
+ if (!pass)
{
- if(c)
+ if (c)
m_ip = m_prev_ip;
break;
}
}
[[fallthrough]];
default:
- if(!common_op(op))
+ if (!common_op(op))
{
m_icount -= 10; // UD fault timing?
logerror("%06x: Invalid Opcode %02x\n", m_pc, op);
@@ -669,9 +715,9 @@ void i80186_cpu_device::device_start()
m_reloc = 0;
m_last_dma = 0;
- m_timer[0].int_timer = timer_alloc(TIMER_INT0);
- m_timer[1].int_timer = timer_alloc(TIMER_INT1);
- m_timer[2].int_timer = timer_alloc(TIMER_INT2);
+ m_timer[0].int_timer = timer_alloc(FUNC(i80186_cpu_device::timer_elapsed), this);
+ m_timer[1].int_timer = timer_alloc(FUNC(i80186_cpu_device::timer_elapsed), this);
+ m_timer[2].int_timer = timer_alloc(FUNC(i80186_cpu_device::timer_elapsed), this);
m_out_tmrout0_func.resolve_safe();
m_out_tmrout1_func.resolve_safe();
@@ -707,13 +753,13 @@ void i80186_cpu_device::device_reset()
m_reloc = 0x20ff;
m_mem.upper = 0xfffb;
- for (auto & elem : m_dma)
+ for (dma_state &elem : m_dma)
{
elem.drq_state = false;
elem.control = 0;
}
- for (auto & elem : m_timer)
+ for (timer_state &elem : m_timer)
{
elem.control = 0;
elem.maxA = 0;
@@ -724,9 +770,9 @@ void i80186_cpu_device::device_reset()
uint8_t i80186_cpu_device::read_port_byte(uint16_t port)
{
- if(!(m_reloc & 0x1000) && (port >> 8) == (m_reloc & 0xff))
+ if (!(m_reloc & 0x1000) && (port >> 8) == (m_reloc & 0xff))
{
- if(port & 1)
+ if (port & 1)
return internal_port_r((port >> 1) & 0x7f, 0xff00) >> 8;
else
return internal_port_r((port >> 1) & 0x7f, 0x00ff) & 0xff;
@@ -736,10 +782,10 @@ uint8_t i80186_cpu_device::read_port_byte(uint16_t port)
uint16_t i80186_cpu_device::read_port_word(uint16_t port)
{
- if(!(m_reloc & 0x1000) && (port >> 8) == (m_reloc & 0xff))
+ if (!(m_reloc & 0x1000) && (port >> 8) == (m_reloc & 0xff))
{
// Unaligned reads from the internal bus are swapped rather than split
- if(port & 1)
+ if (port & 1)
return swapendian_int16(internal_port_r((port >> 1) & 0x7f));
else
return internal_port_r((port >> 1) & 0x7f);
@@ -749,9 +795,9 @@ uint16_t i80186_cpu_device::read_port_word(uint16_t port)
void i80186_cpu_device::write_port_byte(uint16_t port, uint8_t data)
{
- if(!(m_reloc & 0x1000) && (port >> 8) == (m_reloc & 0xff))
+ if (!(m_reloc & 0x1000) && (port >> 8) == (m_reloc & 0xff))
{
- if(port & 1)
+ if (port & 1)
internal_port_w((port >> 1) & 0x7f, data << 8);
else
internal_port_w((port >> 1) & 0x7f, data);
@@ -762,10 +808,10 @@ void i80186_cpu_device::write_port_byte(uint16_t port, uint8_t data)
void i80186_cpu_device::write_port_byte_al(uint16_t port)
{
- if(!(m_reloc & 0x1000) && (port >> 8) == (m_reloc & 0xff))
+ if (!(m_reloc & 0x1000) && (port >> 8) == (m_reloc & 0xff))
{
// Both AH and AL are written onto the internal bus
- if(port & 1)
+ if (port & 1)
internal_port_w((port >> 1) & 0x7f, swapendian_int16(m_regs.w[AX]));
else
internal_port_w((port >> 1) & 0x7f, m_regs.w[AX]);
@@ -776,10 +822,10 @@ void i80186_cpu_device::write_port_byte_al(uint16_t port)
void i80186_cpu_device::write_port_word(uint16_t port, uint16_t data)
{
- if(!(m_reloc & 0x1000) && (port >> 8) == (m_reloc & 0xff))
+ if (!(m_reloc & 0x1000) && (port >> 8) == (m_reloc & 0xff))
{
// Unaligned writes to the internal bus are swapped rather than split
- if(port & 1)
+ if (port & 1)
internal_port_w((port >> 1) & 0x7f, swapendian_int16(data));
else
internal_port_w((port >> 1) & 0x7f, data);
@@ -790,7 +836,7 @@ void i80186_cpu_device::write_port_word(uint16_t port, uint16_t data)
uint8_t i80186_cpu_device::read_byte(uint32_t addr)
{
- if((m_reloc & 0x1000) && (addr >> 8) == (m_reloc & 0xfff))
+ if ((m_reloc & 0x1000) && (addr >> 8) == (m_reloc & 0xfff))
{
uint16_t ret = internal_port_r((addr >> 1) & 0x7f, (addr & 1) ? 0xff00 : 0x00ff);
return (addr & 1) ? (ret >> 8) : (ret & 0xff);
@@ -800,10 +846,10 @@ uint8_t i80186_cpu_device::read_byte(uint32_t addr)
uint16_t i80186_cpu_device::read_word(uint32_t addr)
{
- if((m_reloc & 0x1000) && (addr >> 8) == (m_reloc & 0xfff))
+ if ((m_reloc & 0x1000) && (addr >> 8) == (m_reloc & 0xfff))
{
// Unaligned reads from the internal bus are swapped rather than split
- if(addr & 1)
+ if (addr & 1)
return swapendian_int16(internal_port_r((addr >> 1) & 0x7f));
else
return internal_port_r((addr >> 1) & 0x7f);
@@ -813,7 +859,7 @@ uint16_t i80186_cpu_device::read_word(uint32_t addr)
void i80186_cpu_device::write_byte(uint32_t addr, uint8_t data)
{
- if((m_reloc & 0x1000) && (addr >> 8) == (m_reloc & 0xfff))
+ if ((m_reloc & 0x1000) && (addr >> 8) == (m_reloc & 0xfff))
internal_port_w((addr >> 1) & 0x7f, (addr & 1) ? (data << 8) : data);
else
m_program->write_byte(addr, data);
@@ -821,10 +867,10 @@ void i80186_cpu_device::write_byte(uint32_t addr, uint8_t data)
void i80186_cpu_device::write_word(uint32_t addr, uint16_t data)
{
- if((m_reloc & 0x1000) && (addr >> 8) == (m_reloc & 0xfff))
+ if ((m_reloc & 0x1000) && (addr >> 8) == (m_reloc & 0xfff))
{
// Unaligned writes from the internal bus are swapped rather than split
- if(addr & 1)
+ if (addr & 1)
internal_port_w((addr >> 1) & 0x7f, swapendian_int16(data));
else
internal_port_w((addr >> 1) & 0x7f, data);
@@ -851,42 +897,38 @@ IRQ_CALLBACK_MEMBER(i80186_cpu_device::inta_callback)
IRQ_CALLBACK_MEMBER(i80186_cpu_device::int_callback)
{
- uint8_t vector;
- uint16_t old;
- uint16_t oldreq;
-
- if (LOG_INTERRUPTS)
- logerror("(%f) **** Acknowledged interrupt vector %02X\n", machine().time().as_double(), m_intr.poll_status & 0x1f);
+ LOGMASKED(LOG_INTERRUPTS, "(%f) **** Acknowledged interrupt vector %02X\n", machine().time().as_double(), m_intr.poll_status & 0x1f);
/* clear the interrupt */
set_input_line(0, CLEAR_LINE);
m_intr.pending = 0;
- oldreq = m_intr.request;
+ uint16_t oldreq = m_intr.request;
/* clear the request and set the in-service bit */
- if(m_intr.ack_mask & 0xf0)
+ if (m_intr.ack_mask & 0xf0)
{
int i;
- for(i = 0; i < 4; i++)
- if((m_intr.ack_mask >> (i + 4)) & 1)
+ for (i = 0; i < 4; i++)
+ if (BIT(m_intr.ack_mask, i + 4))
break;
- if(!(m_intr.ext[i] & EXTINT_CTRL_LTM))
+ if (!(m_intr.ext[i] & EXTINT_CTRL_LTM))
m_intr.request &= ~m_intr.ack_mask;
}
else
m_intr.request &= ~m_intr.ack_mask;
- if((LOG_INTERRUPTS) && (m_intr.request!=oldreq))
- logerror("intr.request changed from %02X to %02X\n",oldreq,m_intr.request);
+ if (m_intr.request != oldreq)
+ LOGMASKED(LOG_INTERRUPTS, "intr.request changed from %02X to %02X\n", oldreq, m_intr.request);
- old = m_intr.in_service;
+ uint16_t old = m_intr.in_service;
m_intr.in_service |= m_intr.ack_mask;
- if((LOG_INTERRUPTS) && (m_intr.in_service!=old))
- logerror("intr.in_service changed from %02X to %02X\n",old,m_intr.in_service);
+ if (m_intr.in_service != old)
+ LOGMASKED(LOG_INTERRUPTS, "intr.in_service changed from %02X to %02X\n",old,m_intr.in_service);
+ uint8_t vector;
if (!BIT(m_reloc, 14))
{
if (m_intr.ack_mask == 0x0001)
@@ -914,9 +956,9 @@ IRQ_CALLBACK_MEMBER(i80186_cpu_device::int_callback)
{
if (m_intr.ack_mask & 1)
m_intr.status &= ~0x01;
- else if(m_intr.ack_mask & 0x10)
+ else if (m_intr.ack_mask & 0x10)
m_intr.status &= ~0x02;
- else if(m_intr.ack_mask & 0x20)
+ else if (m_intr.ack_mask & 0x20)
m_intr.status &= ~0x04;
}
vector = m_intr.poll_status & 0xff;
@@ -926,11 +968,8 @@ IRQ_CALLBACK_MEMBER(i80186_cpu_device::int_callback)
/* a request no longer pending */
m_intr.poll_status &= ~0x8000;
- if (LOG_INTERRUPTS)
- {
- logerror("intr.ext[0]=%04X intr.ext[1]=%04X\n",m_intr.ext[0],m_intr.ext[1]);
- logerror("Int %02X Calling vector %02X\n",m_intr.poll_status,vector);
- }
+ LOGMASKED(LOG_INTERRUPTS, "intr.ext[0]=%04X intr.ext[1]=%04X\n", m_intr.ext[0], m_intr.ext[1]);
+ LOGMASKED(LOG_INTERRUPTS, "Int %02X Calling vector %02X\n", m_intr.poll_status, vector);
return vector;
}
@@ -939,23 +978,20 @@ IRQ_CALLBACK_MEMBER(i80186_cpu_device::int_callback)
void i80186_cpu_device::update_interrupt_state()
{
int new_vector = 0;
- int Priority;
- int IntNo;
- if (LOG_INTERRUPTS)
- logerror("update_interrupt_status: req=%04X stat=%04X serv=%04X priority_mask=%4X\n", m_intr.request, m_intr.status, m_intr.in_service, m_intr.priority_mask);
+ LOGMASKED(LOG_INTERRUPTS, "update_interrupt_status: req=%04X stat=%04X serv=%04X priority_mask=%4X\n", m_intr.request, m_intr.status, m_intr.in_service, m_intr.priority_mask);
/* loop over priorities */
- for (Priority = 0; Priority <= m_intr.priority_mask; Priority++)
+ for (int priority = 0; priority <= m_intr.priority_mask; priority++)
{
/* note: by checking 4 bits, we also verify that the mask is off */
if (BIT(m_reloc, 14))
{
- for (IntNo = 0; IntNo < 3; IntNo++)
+ for (int int_num = 0; int_num < 3; int_num++)
{
- if ((m_intr.timer[IntNo] & 0x0F) == Priority)
+ if ((m_intr.timer[int_num] & 0x0f) == priority)
{
- int irq = (1 << IntNo);
+ int irq = (1 << int_num);
/* if we're already servicing something at this level, don't generate anything new */
if (m_intr.in_service & 0x01)
return;
@@ -963,9 +999,9 @@ void i80186_cpu_device::update_interrupt_state()
/* if there's something pending, generate an interrupt */
if (m_intr.status & irq)
{
- new_vector = m_intr.vector | Priority;
+ new_vector = m_intr.vector | priority;
/* set the clear mask and generate the int */
- m_intr.ack_mask = IntNo ? (8 << IntNo) : 1;
+ m_intr.ack_mask = int_num ? (8 << int_num) : 1;
goto generate_int;
}
}
@@ -973,7 +1009,7 @@ void i80186_cpu_device::update_interrupt_state()
}
else
{
- if ((m_intr.timer[0] & 0x0F) == Priority)
+ if ((m_intr.timer[0] & 0x0f) == priority)
{
/* if we're already servicing something at this level, don't generate anything new */
if (m_intr.in_service & 0x01)
@@ -999,23 +1035,23 @@ void i80186_cpu_device::update_interrupt_state()
}
/* check DMA interrupts */
- for (IntNo = 0; IntNo < 2; IntNo++)
- if ((m_intr.dma[IntNo] & 0x0F) == Priority)
+ for (int int_num = 0; int_num < 2; int_num++)
+ if ((m_intr.dma[int_num] & 0x0F) == priority)
{
/* if we're already servicing something at this level, don't generate anything new */
- if (m_intr.in_service & (0x04 << IntNo))
+ if (m_intr.in_service & (0x04 << int_num))
return;
/* if there's something pending, generate an interrupt */
- if (m_intr.request & (0x04 << IntNo))
+ if (m_intr.request & (0x04 << int_num))
{
if (BIT(m_reloc, 14))
- new_vector = m_intr.vector | Priority;
+ new_vector = m_intr.vector | priority;
else
- new_vector = 0x0a + IntNo;
+ new_vector = 0x0a + int_num;
/* set the clear mask and generate the int */
- m_intr.ack_mask = 0x0004 << IntNo;
+ m_intr.ack_mask = 0x0004 << int_num;
goto generate_int;
}
}
@@ -1024,34 +1060,33 @@ void i80186_cpu_device::update_interrupt_state()
continue;
/* check external interrupts */
- for (IntNo = 0; IntNo < 4; IntNo++)
+ for (int int_num = 0; int_num < 4; int_num++)
{
- if ((m_intr.ext[IntNo] & 0x0F) == Priority)
+ if ((m_intr.ext[int_num] & 0x0f) == priority)
{
- if (LOG_INTERRUPTS)
- logerror("Int%d priority=%d\n",IntNo,Priority);
+ LOGMASKED(LOG_INTERRUPTS, "Int%d priority=%d\n", int_num, priority);
/* if we're already servicing something at this level, don't generate anything new */
- if ((m_intr.in_service & (0x10 << IntNo)) && !(m_intr.ext[IntNo] & EXTINT_CTRL_SFNM))
+ if ((m_intr.in_service & (0x10 << int_num)) && !(m_intr.ext[int_num] & EXTINT_CTRL_SFNM))
return;
/* if there's something pending, generate an interrupt */
- if (m_intr.request & (0x10 << IntNo))
+ if (m_intr.request & (0x10 << int_num))
{
- if((IntNo >= 2) && (m_intr.ext[IntNo - 2] & EXTINT_CTRL_CASCADE))
+ if((int_num >= 2) && (m_intr.ext[int_num - 2] & EXTINT_CTRL_CASCADE))
{
- logerror("i186: %06x: irq %d use when set for cascade mode\n", m_pc, IntNo);
- m_intr.request &= ~(0x10 << IntNo);
+ logerror("i186: %06x: irq %d use when set for cascade mode\n", m_pc, int_num);
+ m_intr.request &= ~(0x10 << int_num);
continue;
}
/* otherwise, generate an interrupt for this request */
- new_vector = 0x0c + IntNo;
+ new_vector = 0x0c + int_num;
/* set the clear mask and generate the int */
- m_intr.ack_mask = 0x0010 << IntNo;
+ m_intr.ack_mask = 0x0010 << int_num;
goto generate_int;
}
- else if ((m_intr.in_service & (0x10 << IntNo)) && (m_intr.ext[IntNo] & EXTINT_CTRL_SFNM))
+ else if ((m_intr.in_service & (0x10 << int_num)) && (m_intr.ext[int_num] & EXTINT_CTRL_SFNM))
return; // if an irq is in service and sfnm is enabled, stop here
}
}
@@ -1074,15 +1109,13 @@ generate_int:
m_irmx_irq_cb(ASSERT_LINE);
}
m_intr.pending = 1;
- if (LOG_INTERRUPTS) logerror("(%f) **** Requesting interrupt vector %02X\n", machine().time().as_double(), new_vector);
+ LOGMASKED(LOG_INTERRUPTS, "(%f) **** Requesting interrupt vector %02X\n", machine().time().as_double(), new_vector);
}
void i80186_cpu_device::handle_eoi(int data)
{
- int Priority;
- int IntNo;
- int handled=0;
+ bool handled = false;
/* specific case */
if (!(data & 0x8000))
@@ -1101,58 +1134,57 @@ void i80186_cpu_device::handle_eoi(int data)
case 0x0f: m_intr.in_service &= ~0x80; break;
default: logerror("%05X:ERROR - 80186 EOI with unknown vector %02X\n", m_pc, data & 0x1f);
}
- if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for vector %02X\n", machine().time().as_double(), data & 0x1f);
+ LOGMASKED(LOG_INTERRUPTS, "(%f) **** Got EOI for vector %02X\n", machine().time().as_double(), data & 0x1f);
}
-
/* non-specific case */
else
{
/* loop over priorities */
- for (Priority = 0; ((Priority <= 7) && !handled); Priority++)
+ for (int priority = 0; priority <= 7 && !handled; priority++)
{
/* check for in-service timers */
if (BIT(m_reloc, 14))
{
- for (IntNo = 0; ((IntNo < 2) && !handled) ; IntNo++)
+ for (int int_num = 0; int_num < 2 && !handled; int_num++)
{
- int mask = IntNo ? (8 << IntNo) : 1;
- if ((m_intr.timer[IntNo] & 0x07) == Priority && (m_intr.in_service & mask))
+ int mask = int_num ? (8 << int_num) : 1;
+ if ((m_intr.timer[int_num] & 0x07) == priority && (m_intr.in_service & mask))
{
m_intr.in_service &= ~mask;
- if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for timer%d\n", machine().time().as_double(), IntNo);
- handled=1;
+ LOGMASKED(LOG_INTERRUPTS, "(%f) **** Got EOI for timer%d\n", machine().time().as_double(), int_num);
+ handled = true;
}
}
}
else
{
- if ((m_intr.timer[0] & 0x07) == Priority && (m_intr.in_service & 0x01))
+ if ((m_intr.timer[0] & 0x07) == priority && (m_intr.in_service & 0x01))
{
m_intr.in_service &= ~0x01;
- if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for timer\n", machine().time().as_double());
- handled=1;
+ LOGMASKED(LOG_INTERRUPTS, "(%f) **** Got EOI for timer\n", machine().time().as_double());
+ handled = true;
}
}
/* check for in-service DMA interrupts */
- for (IntNo = 0; ((IntNo < 2) && !handled) ; IntNo++)
- if ((m_intr.dma[IntNo] & 0x07) == Priority && (m_intr.in_service & (0x04 << IntNo)))
+ for (int int_num = 0; int_num < 2 && !handled; int_num++)
+ if ((m_intr.dma[int_num] & 0x07) == priority && (m_intr.in_service & (0x04 << int_num)))
{
- m_intr.in_service &= ~(0x04 << IntNo);
- if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for DMA%d\n", machine().time().as_double(), IntNo);
- handled=1;
+ m_intr.in_service &= ~(0x04 << int_num);
+ LOGMASKED(LOG_INTERRUPTS, "(%f) **** Got EOI for DMA%d\n", machine().time().as_double(), int_num);
+ handled = true;
}
if (BIT(m_reloc, 14))
continue;
/* check external interrupts */
- for (IntNo = 0; ((IntNo < 4) && !handled) ; IntNo++)
- if ((m_intr.ext[IntNo] & 0x07) == Priority && (m_intr.in_service & (0x10 << IntNo)))
+ for (int int_num = 0; int_num < 4 && !handled; int_num++)
+ if ((m_intr.ext[int_num] & 0x07) == priority && (m_intr.in_service & (0x10 << int_num)))
{
- m_intr.in_service &= ~(0x10 << IntNo);
- if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for INT%d\n", machine().time().as_double(), IntNo);
- handled=1;
+ m_intr.in_service &= ~(0x10 << int_num);
+ LOGMASKED(LOG_INTERRUPTS, "(%f) **** Got EOI for INT%d\n", machine().time().as_double(), int_num);
+ handled = true;
}
}
}
@@ -1160,34 +1192,34 @@ void i80186_cpu_device::handle_eoi(int data)
}
/* Trigger an external interrupt, optionally supplying the vector to take */
-void i80186_cpu_device::external_int(uint16_t intno, int state)
+void i80186_cpu_device::external_int(uint16_t int_num, int state)
{
if (BIT(m_reloc, 14))
{
- if (!intno)
+ if (!int_num)
{
set_input_line(0, state);
return;
}
- logerror("irq to line %d in irmx mode\n",intno);
+ logerror("irq to line %d in irmx mode\n", int_num);
return;
}
- if (!(m_intr.ext_state & (1 << intno)) == !state)
+ if (!(m_intr.ext_state & (1 << int_num)) == !state)
return;
- if (LOG_INTERRUPTS_EXT) logerror("generating external int %02X\n",intno);
+ LOGMASKED(LOG_INTERRUPTS_EXT, "generating external int %02X\n", int_num);
if (!state)
{
- m_intr.request &= ~(0x10 << intno);
- m_intr.ack_mask &= ~(0x10 << intno);
- m_intr.ext_state &= ~(1 << intno);
+ m_intr.request &= ~(0x10 << int_num);
+ m_intr.ack_mask &= ~(0x10 << int_num);
+ m_intr.ext_state &= ~(1 << int_num);
}
else // Turn on the requested request bit and handle interrupt
{
- m_intr.request |= (0x10 << intno);
- m_intr.ext_state |= (1 << intno);
+ m_intr.request |= 0x10 << int_num;
+ m_intr.ext_state |= 1 << int_num;
}
update_interrupt_state();
}
@@ -1198,82 +1230,70 @@ void i80186_cpu_device::external_int(uint16_t intno, int state)
*
*************************************/
-void i80186_cpu_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(i80186_cpu_device::timer_elapsed)
{
- switch(id)
- {
- case TIMER_INT0:
- case TIMER_INT1:
- case TIMER_INT2:
- {
- int which = param;
- timer_state *t = &m_timer[which];
+ int which = param;
+ timer_state *t = &m_timer[which];
- if (LOG_TIMER) logerror("Hit interrupt callback for timer %d\n", which);
+ LOGMASKED(LOG_TIMER, "Hit interrupt callback for timer %d", which);
- /* set the max count bit */
- t->control |= 0x0020;
+ /* set the max count bit */
+ t->control |= 0x0020;
- /* request an interrupt */
- if (t->control & 0x2000)
- {
- m_intr.status |= 0x01 << which;
- update_interrupt_state();
- if (LOG_TIMER) logerror(" Generating timer interrupt\n");
- }
+ /* request an interrupt */
+ if (t->control & 0x2000)
+ {
+ m_intr.status |= 0x01 << which;
+ update_interrupt_state();
+ LOGMASKED(LOG_TIMER, " Generating timer interrupt");
+ }
- if(which == 2)
- {
- if((m_dma[0].control & (TIMER_DRQ | ST_STOP)) == TIMER_DRQ)
- drq_callback(0);
- if((m_dma[1].control & (TIMER_DRQ | ST_STOP)) == TIMER_DRQ)
- drq_callback(1);
- if((m_timer[0].control & 0x800c) == 0x8008)
- inc_timer(0);
- if((m_timer[1].control & 0x800c) == 0x8008)
- inc_timer(1);
- }
+ if (which == 2)
+ {
+ if ((m_dma[0].control & (TIMER_DRQ | ST_STOP)) == TIMER_DRQ)
+ drq_callback(0);
+ if ((m_dma[1].control & (TIMER_DRQ | ST_STOP)) == TIMER_DRQ)
+ drq_callback(1);
+ if ((m_timer[0].control & 0x800c) == 0x8008)
+ inc_timer(0);
+ if ((m_timer[1].control & 0x800c) == 0x8008)
+ inc_timer(1);
+ }
+ else
+ {
+ if (!(t->control & 2))
+ {
+ if (which)
+ m_out_tmrout1_func(1);
else
- {
- if(!(t->control & 2))
- {
- if(which)
- m_out_tmrout1_func(1);
- else
- m_out_tmrout0_func(1);
- }
- else
- {
- if(which)
- m_out_tmrout1_func((t->control & 0x1000) ? 1 : 0);
- else
- m_out_tmrout0_func((t->control & 0x1000) ? 1 : 0);
- }
- }
-
- /* if we're continuous or altcounting, reset */
- if((t->control & 1) || ((t->control & 2) && !(t->control & 0x1000)))
- {
- if((t->control & 2) && !(t->control & 0x1000))
- t->control |= 0x1000;
- else
- t->control &= ~0x1000;
-
- restart_timer(which);
- if (LOG_TIMER) logerror(" Repriming interrupt\n");
- }
+ m_out_tmrout0_func(1);
+ }
+ else
+ {
+ if (which)
+ m_out_tmrout1_func((t->control & 0x1000) ? 1 : 0);
else
- {
- t->int_timer->adjust(attotime::never, which);
- t->control &= ~0x9000;
- }
- t->count = 0;
- break;
+ m_out_tmrout0_func((t->control & 0x1000) ? 1 : 0);
}
+ }
- default:
- break;
+ /* if we're continuous or altcounting, reset */
+ if ((t->control & 1) || ((t->control & 2) && !(t->control & 0x1000)))
+ {
+ if ((t->control & 2) && !(t->control & 0x1000))
+ t->control |= 0x1000;
+ else
+ t->control &= ~0x1000;
+
+ restart_timer(which);
+ LOGMASKED(LOG_TIMER, " Repriming interrupt");
+ }
+ else
+ {
+ t->int_timer->adjust(attotime::never, which);
+ t->control &= ~0x9000;
}
+ t->count = 0;
}
@@ -1281,8 +1301,8 @@ void i80186_cpu_device::restart_timer(int which)
{
timer_state *t = &m_timer[which];
int count = (t->control & 0x1000) ? t->maxB : t->maxA;
- if(!(t->control & 4))
- t->int_timer->adjust((attotime::from_hz(clock()/8) * (count ? count : 0x10000)), which);
+ if (!(t->control & 4))
+ t->int_timer->adjust((attotime::from_hz(clock() / 8) * (count ? count : 0x10000)), which);
}
void i80186_cpu_device::internal_timer_sync(int which)
@@ -1302,19 +1322,18 @@ void i80186_cpu_device::inc_timer(int which)
if (t->control & 2)
{
if (t->count == ((t->control & 0x1000) ? t->maxB : t->maxA))
- device_timer(*t->int_timer, which, which);
+ timer_elapsed(which);
}
else if (t->count == t->maxA)
- device_timer(*t->int_timer, which, which);
+ timer_elapsed(which);
}
void i80186_cpu_device::internal_timer_update(int which, int new_count, int new_maxA, int new_maxB, int new_control)
{
timer_state *t = &m_timer[which];
- int update_int_timer = 0;
+ bool update_int_timer = false;
- if (LOG_TIMER)
- logerror("internal_timer_update: %d, new_count=%d, new_maxA=%d, new_maxB=%d,new_control=%d\n", which, new_count, new_maxA, new_maxB, new_control);
+ LOGMASKED(LOG_TIMER, "internal_timer_update: %d, new_count=%d, new_maxA=%d, new_maxB=%d, new_control=%d", which, new_count, new_maxA, new_maxB, new_control);
/* if we have a new count and we're on, update things */
if (new_count != -1)
@@ -1322,7 +1341,7 @@ void i80186_cpu_device::internal_timer_update(int which, int new_count, int new_
if (t->control & 0x8000)
{
internal_timer_sync(which);
- update_int_timer = 1;
+ update_int_timer = true;
}
t->count = new_count;
}
@@ -1333,7 +1352,7 @@ void i80186_cpu_device::internal_timer_update(int which, int new_count, int new_
if (t->control & 0x8000)
{
internal_timer_sync(which);
- update_int_timer = 1;
+ update_int_timer = true;
}
t->maxA = new_maxA;
@@ -1350,7 +1369,7 @@ void i80186_cpu_device::internal_timer_update(int which, int new_count, int new_
if (t->control & 0x8000)
{
internal_timer_sync(which);
- update_int_timer = 1;
+ update_int_timer = true;
}
t->maxB = new_maxB;
@@ -1383,20 +1402,20 @@ void i80186_cpu_device::internal_timer_update(int which, int new_count, int new_
{
/* compute the final count */
internal_timer_sync(which);
- update_int_timer = 1;
+ update_int_timer = true;
}
/* if we're going on, start the timers running except with external clock or prescale */
else if ((diff & 0x8000) && (new_control & 0x8000) && !(new_control & 0xc))
{
- update_int_timer = 1;
+ update_int_timer = true;
}
/* if something about the interrupt timer changed, force an update */
if (!(diff & 0x8000) && (diff & 0x2000))
{
internal_timer_sync(which);
- update_int_timer = 1;
+ update_int_timer = true;
}
}
@@ -1417,7 +1436,7 @@ void i80186_cpu_device::internal_timer_update(int which, int new_count, int new_
if (diff <= 0)
diff += 0x10000;
t->int_timer->adjust(attotime::from_hz(clock()/8) * diff, which);
- if (LOG_TIMER) logerror("Set interrupt timer for %d\n", which);
+ LOGMASKED(LOG_TIMER, "Set interrupt timer for %d\n", which);
}
else
{
@@ -1437,7 +1456,7 @@ void i80186_cpu_device::external_tmrin(int which, int state)
{
m_timer[which].count = 0;
restart_timer(which);
- if (LOG_TIMER) logerror("Retriggered timer %d\n", which);
+ LOGMASKED(LOG_TIMER, "Retriggered timer %d\n", which);
}
}
}
@@ -1453,7 +1472,6 @@ void i80186_cpu_device::external_tmrin(int which, int state)
void i80186_cpu_device::update_dma_control(int which, int new_control)
{
dma_state *d = &m_dma[which];
- int diff;
/* handle the CHG bit */
if (!(new_control & CHG_NOCHG))
@@ -1461,11 +1479,11 @@ void i80186_cpu_device::update_dma_control(int which, int new_control)
new_control &= ~CHG_NOCHG;
/* check for control bits we don't handle */
- diff = new_control ^ d->control;
- if ((LOG_DMA) && (diff & 0x6811))
- logerror("%05X:ERROR! - unsupported DMA mode %04X\n", m_pc, new_control);
+ int diff = new_control ^ d->control;
+ if (diff & 0x6811)
+ LOGMASKED(LOG_DMA, "%05X:ERROR! - unsupported DMA mode %04X\n", m_pc, new_control);
- if (LOG_DMA) logerror("Initiated DMA %d - count = %04X, source = %04X, dest = %04X\n", which, d->count, d->source, d->dest);
+ LOGMASKED(LOG_DMA, "Initiated DMA %d - count = %04X, source = %04X, dest = %04X\n", which, d->count, d->source, d->dest);
/* set the new control register */
d->control = new_control;
@@ -1479,13 +1497,11 @@ void i80186_cpu_device::drq_callback(int which)
uint8_t dma_byte;
uint8_t incdec_size;
- if (LOG_DMA>1)
- logerror("Control=%04X, src=%05X, dest=%05X, count=%04X\n",dma->control,dma->source,dma->dest,dma->count);
+ LOGMASKED(LOG_DMA_HIFREQ, "Control=%04X, src=%05X, dest=%05X, count=%04X\n", dma->control, dma->source, dma->dest, dma->count);
if (!(dma->control & ST_STOP))
{
- if(LOG_DMA)
- logerror("%05X:ERROR! - drq%d with dma channel stopped\n", m_pc, which);
+ LOGMASKED(LOG_DMA, "%05X:ERROR! - drq%d with dma channel stopped\n", m_pc, which);
return;
}
@@ -1531,16 +1547,16 @@ void i80186_cpu_device::drq_callback(int which)
dma->count -= 1;
// Terminate if count is zero, and terminate flag set
- if (((dma->control & TERMINATE_ON_ZERO) || !(dma->control & SYNC_MASK)) && (dma->count == 0))
+ if (((dma->control & TERMINATE_ON_ZERO) || !(dma->control & SYNC_MASK)) && dma->count == 0)
{
dma->control &= ~ST_STOP;
- if (LOG_DMA) logerror("DMA terminated\n");
+ LOGMASKED(LOG_DMA, "DMA terminated\n");
}
// Interrupt if count is zero, and interrupt flag set
- if ((dma->control & INTERRUPT_ON_ZERO) && (dma->count == 0))
+ if ((dma->control & INTERRUPT_ON_ZERO) && dma->count == 0)
{
- if (LOG_DMA>1) logerror("DMA%d - requesting interrupt: count = %04X, source = %04X\n", which, dma->count, dma->source);
+ LOGMASKED(LOG_DMA_HIFREQ, "DMA%d - requesting interrupt: count = %04X, source = %04X\n", which, dma->count, dma->source);
m_intr.request |= 0x04 << which;
update_interrupt_state();
}
@@ -1553,25 +1569,25 @@ uint16_t i80186_cpu_device::internal_port_r(offs_t offset, uint16_t mem_mask)
switch (offset)
{
case 0x10:
- if (LOG_PORTS) logerror("%05X:read interrupt vector\n", m_pc);
+ LOGMASKED(LOG_PORTS, "%05X:read interrupt vector\n", m_pc);
return m_intr.vector;
case 0x11:
- if (LOG_PORTS) logerror("%05X:ERROR - read from 80186 EOI\n", m_pc);
+ LOGMASKED(LOG_PORTS, "%05X:ERROR - read from 80186 EOI\n", m_pc);
break;
case 0x12:
- if (LOG_PORTS) logerror("%05X:read 80186 interrupt poll\n", m_pc);
+ LOGMASKED(LOG_PORTS, "%05X:read 80186 interrupt poll\n", m_pc);
if (m_intr.poll_status & 0x8000)
inta_callback(*this, 0);
return m_intr.poll_status;
case 0x13:
- if (LOG_PORTS) logerror("%05X:read 80186 interrupt poll status\n", m_pc);
+ LOGMASKED(LOG_PORTS, "%05X:read 80186 interrupt poll status\n", m_pc);
return m_intr.poll_status;
case 0x14:
- if (LOG_PORTS) logerror("%05X:read 80186 interrupt mask\n", m_pc);
+ LOGMASKED(LOG_PORTS, "%05X:read 80186 interrupt mask\n", m_pc);
temp = (m_intr.timer[0] >> 3) & 0x01;
temp |= (m_intr.dma[0] >> 1) & 0x04;
temp |= (m_intr.dma[1] >> 0) & 0x08;
@@ -1590,59 +1606,59 @@ uint16_t i80186_cpu_device::internal_port_r(offs_t offset, uint16_t mem_mask)
return temp;
case 0x15:
- if (LOG_PORTS) logerror("%05X:read 80186 interrupt priority mask\n", m_pc);
+ LOGMASKED(LOG_PORTS, "%05X:read 80186 interrupt priority mask\n", m_pc);
return m_intr.priority_mask;
case 0x16:
- if (LOG_PORTS) logerror("%05X:read 80186 interrupt in-service\n", m_pc);
+ LOGMASKED(LOG_PORTS, "%05X:read 80186 interrupt in-service\n", m_pc);
return m_intr.in_service;
case 0x17:
- if (LOG_PORTS) logerror("%05X:read 80186 interrupt request\n", m_pc);
+ LOGMASKED(LOG_PORTS, "%05X:read 80186 interrupt request\n", m_pc);
temp = m_intr.request & ~0x0001;
if (m_intr.status & 0x0007)
temp |= 1;
return temp;
case 0x18:
- if (LOG_PORTS) logerror("%05X:read 80186 interrupt status\n", m_pc);
+ LOGMASKED(LOG_PORTS, "%05X:read 80186 interrupt status\n", m_pc);
return m_intr.status;
case 0x19:
- if (LOG_PORTS) logerror("%05X:read 80186 timer interrupt control\n", m_pc);
+ LOGMASKED(LOG_PORTS, "%05X:read 80186 timer interrupt control\n", m_pc);
return m_intr.timer[0];
case 0x1a:
- if (LOG_PORTS) logerror("%05X:read 80186 DMA 0 interrupt control\n", m_pc);
+ LOGMASKED(LOG_PORTS, "%05X:read 80186 DMA 0 interrupt control\n", m_pc);
return m_intr.dma[0];
case 0x1b:
- if (LOG_PORTS) logerror("%05X:read 80186 DMA 1 interrupt control\n", m_pc);
+ LOGMASKED(LOG_PORTS, "%05X:read 80186 DMA 1 interrupt control\n", m_pc);
return m_intr.dma[1];
case 0x1c:
- if (LOG_PORTS) logerror("%05X:read 80186 INT 0 interrupt control\n", m_pc);
+ LOGMASKED(LOG_PORTS, "%05X:read 80186 INT 0 interrupt control\n", m_pc);
if (BIT(m_reloc, 14))
return m_intr.timer[1];
else
return m_intr.ext[0];
case 0x1d:
- if (LOG_PORTS) logerror("%05X:read 80186 INT 1 interrupt control\n", m_pc);
+ LOGMASKED(LOG_PORTS, "%05X:read 80186 INT 1 interrupt control\n", m_pc);
if (BIT(m_reloc, 14))
return m_intr.timer[2];
else
return m_intr.ext[1];
case 0x1e:
- if (LOG_PORTS) logerror("%05X:read 80186 INT 2 interrupt control\n", m_pc);
+ LOGMASKED(LOG_PORTS, "%05X:read 80186 INT 2 interrupt control\n", m_pc);
if (BIT(m_reloc, 14))
return 0;
else
return m_intr.ext[2];
case 0x1f:
- if (LOG_PORTS) logerror("%05X:read 80186 INT 3 interrupt control\n", m_pc);
+ LOGMASKED(LOG_PORTS, "%05X:read 80186 INT 3 interrupt control\n", m_pc);
if (BIT(m_reloc, 14))
return 0;
else
@@ -1651,7 +1667,7 @@ uint16_t i80186_cpu_device::internal_port_r(offs_t offset, uint16_t mem_mask)
case 0x28:
case 0x2c:
case 0x30:
- if (LOG_PORTS) logerror("%05X:read 80186 Timer %d count\n", m_pc, (offset - 0x28) / 4);
+ LOGMASKED(LOG_PORTS, "%05X:read 80186 Timer %d count\n", m_pc, (offset - 0x28) / 4);
which = (offset - 0x28) / 4;
if (ACCESSING_BITS_0_7)
internal_timer_sync(which);
@@ -1660,76 +1676,76 @@ uint16_t i80186_cpu_device::internal_port_r(offs_t offset, uint16_t mem_mask)
case 0x29:
case 0x2d:
case 0x31:
- if (LOG_PORTS) logerror("%05X:read 80186 Timer %d max A\n", m_pc, (offset - 0x29) / 4);
+ LOGMASKED(LOG_PORTS, "%05X:read 80186 Timer %d max A\n", m_pc, (offset - 0x29) / 4);
which = (offset - 0x29) / 4;
return m_timer[which].maxA;
case 0x2a:
case 0x2e:
- if (LOG_PORTS) logerror("%05X:read 80186 Timer %d max B\n", m_pc, (offset - 0x2a) / 4);
+ LOGMASKED(LOG_PORTS, "%05X:read 80186 Timer %d max B\n", m_pc, (offset - 0x2a) / 4);
which = (offset - 0x2a) / 4;
return m_timer[which].maxB;
case 0x2b:
case 0x2f:
case 0x33:
- if (LOG_PORTS) logerror("%05X:read 80186 Timer %d control\n", m_pc, (offset - 0x2b) / 4);
+ LOGMASKED(LOG_PORTS, "%05X:read 80186 Timer %d control\n", m_pc, (offset - 0x2b) / 4);
which = (offset - 0x2b) / 4;
return m_timer[which].control;
case 0x50:
- if (LOG_PORTS) logerror("%05X:read 80186 upper chip select\n", m_pc);
+ LOGMASKED(LOG_PORTS, "%05X:read 80186 upper chip select\n", m_pc);
return m_mem.upper;
case 0x51:
- if (LOG_PORTS) logerror("%05X:read 80186 lower chip select\n", m_pc);
+ LOGMASKED(LOG_PORTS, "%05X:read 80186 lower chip select\n", m_pc);
return m_mem.lower;
case 0x52:
- if (LOG_PORTS) logerror("%05X:read 80186 peripheral chip select\n", m_pc);
+ LOGMASKED(LOG_PORTS, "%05X:read 80186 peripheral chip select\n", m_pc);
return m_mem.peripheral;
case 0x53:
- if (LOG_PORTS) logerror("%05X:read 80186 middle chip select\n", m_pc);
+ LOGMASKED(LOG_PORTS, "%05X:read 80186 middle chip select\n", m_pc);
return m_mem.middle;
case 0x54:
- if (LOG_PORTS) logerror("%05X:read 80186 middle P chip select\n", m_pc);
+ LOGMASKED(LOG_PORTS, "%05X:read 80186 middle P chip select\n", m_pc);
return m_mem.middle_size;
case 0x60:
case 0x68:
- if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower source address\n", m_pc, (offset - 0x60) / 8);
+ LOGMASKED(LOG_PORTS, "%05X:read 80186 DMA%d lower source address\n", m_pc, (offset - 0x60) / 8);
which = (offset - 0x60) / 8;
return m_dma[which].source;
case 0x61:
case 0x69:
- if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper source address\n", m_pc, (offset - 0x61) / 8);
+ LOGMASKED(LOG_PORTS, "%05X:read 80186 DMA%d upper source address\n", m_pc, (offset - 0x61) / 8);
which = (offset - 0x61) / 8;
return m_dma[which].source >> 16;
case 0x62:
case 0x6a:
- if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower dest address\n", m_pc, (offset - 0x62) / 8);
+ LOGMASKED(LOG_PORTS, "%05X:read 80186 DMA%d lower dest address\n", m_pc, (offset - 0x62) / 8);
which = (offset - 0x62) / 8;
return m_dma[which].dest;
case 0x63:
case 0x6b:
- if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper dest address\n", m_pc, (offset - 0x63) / 8);
+ LOGMASKED(LOG_PORTS, "%05X:read 80186 DMA%d upper dest address\n", m_pc, (offset - 0x63) / 8);
which = (offset - 0x63) / 8;
return m_dma[which].dest >> 16;
case 0x64:
case 0x6c:
- if (LOG_PORTS) logerror("%05X:read 80186 DMA%d transfer count\n", m_pc, (offset - 0x64) / 8);
+ LOGMASKED(LOG_PORTS, "%05X:read 80186 DMA%d transfer count\n", m_pc, (offset - 0x64) / 8);
which = (offset - 0x64) / 8;
return m_dma[which].count;
case 0x65:
case 0x6d:
- if (LOG_PORTS) logerror("%05X:read 80186 DMA%d control\n", m_pc, (offset - 0x65) / 8);
+ LOGMASKED(LOG_PORTS, "%05X:read 80186 DMA%d control\n", m_pc, (offset - 0x65) / 8);
which = (offset - 0x65) / 8;
return m_dma[which].control;
@@ -1737,7 +1753,7 @@ uint16_t i80186_cpu_device::internal_port_r(offs_t offset, uint16_t mem_mask)
return m_reloc;
default:
- if (LOG_PORTS) logerror("%05X:read 80186 port %02X\n", m_pc, offset);
+ LOGMASKED(LOG_PORTS, "%05X:read 80186 port %02X\n", m_pc, offset);
break;
}
@@ -1757,26 +1773,26 @@ void i80186_cpu_device::internal_port_w(offs_t offset, uint16_t data)
switch (offset)
{
case 0x10:
- if (LOG_PORTS) logerror("%05X:write interrupt vector = %04X\n", m_pc, data);
+ LOGMASKED(LOG_PORTS, "%05X:write interrupt vector = %04X\n", m_pc, data);
m_intr.vector = data & 0xf8;
break;
case 0x11:
- if (LOG_PORTS) logerror("%05X:80186 EOI = %04X\n", m_pc, data);
+ LOGMASKED(LOG_PORTS, "%05X:80186 EOI = %04X\n", m_pc, data);
handle_eoi(data);
update_interrupt_state();
break;
case 0x12:
- if (LOG_PORTS) logerror("%05X:ERROR - write to 80186 interrupt poll = %04X\n", m_pc, data);
+ LOGMASKED(LOG_PORTS, "%05X:ERROR - write to 80186 interrupt poll = %04X\n", m_pc, data);
break;
case 0x13:
- if (LOG_PORTS) logerror("%05X:ERROR - write to 80186 interrupt poll status = %04X\n", m_pc, data);
+ LOGMASKED(LOG_PORTS, "%05X:ERROR - write to 80186 interrupt poll status = %04X\n", m_pc, data);
break;
case 0x14:
- if (LOG_PORTS) logerror("%05X:80186 interrupt mask = %04X\n", m_pc, data);
+ LOGMASKED(LOG_PORTS, "%05X:80186 interrupt mask = %04X\n", m_pc, data);
m_intr.timer[0] = (m_intr.timer[0] & ~0x08) | ((data << 3) & 0x08);
m_intr.dma[0] = (m_intr.dma[0] & ~0x08) | ((data << 1) & 0x08);
m_intr.dma[1] = (m_intr.dma[1] & ~0x08) | ((data << 0) & 0x08);
@@ -1796,49 +1812,49 @@ void i80186_cpu_device::internal_port_w(offs_t offset, uint16_t data)
break;
case 0x15:
- if (LOG_PORTS) logerror("%05X:80186 interrupt priority mask = %04X\n", m_pc, data);
+ LOGMASKED(LOG_PORTS, "%05X:80186 interrupt priority mask = %04X\n", m_pc, data);
m_intr.priority_mask = data & 0x0007;
update_interrupt_state();
break;
case 0x16:
- if (LOG_PORTS) logerror("%05X:80186 interrupt in-service = %04X\n", m_pc, data);
+ LOGMASKED(LOG_PORTS, "%05X:80186 interrupt in-service = %04X\n", m_pc, data);
m_intr.in_service = data & 0x00ff;
update_interrupt_state();
break;
case 0x17:
- if (LOG_PORTS) logerror("%05X:80186 interrupt request = %04X\n", m_pc, data);
+ LOGMASKED(LOG_PORTS, "%05X:80186 interrupt request = %04X\n", m_pc, data);
m_intr.request = (m_intr.request & ~0x000c) | (data & 0x000c);
update_interrupt_state();
break;
case 0x18:
- if (LOG_PORTS) logerror("%05X:WARNING - wrote to 80186 interrupt status = %04X\n", m_pc, data);
+ LOGMASKED(LOG_PORTS, "%05X:WARNING - wrote to 80186 interrupt status = %04X\n", m_pc, data);
m_intr.status = (m_intr.status & ~0x8007) | (data & 0x8007);
update_interrupt_state();
break;
case 0x19:
- if (LOG_PORTS) logerror("%05X:80186 timer interrupt contol = %04X\n", m_pc, data);
+ LOGMASKED(LOG_PORTS, "%05X:80186 timer interrupt contol = %04X\n", m_pc, data);
m_intr.timer[0] = data & 0x000f;
update_interrupt_state();
break;
case 0x1a:
- if (LOG_PORTS) logerror("%05X:80186 DMA 0 interrupt control = %04X\n", m_pc, data);
+ LOGMASKED(LOG_PORTS, "%05X:80186 DMA 0 interrupt control = %04X\n", m_pc, data);
m_intr.dma[0] = data & 0x000f;
update_interrupt_state();
break;
case 0x1b:
- if (LOG_PORTS) logerror("%05X:80186 DMA 1 interrupt control = %04X\n", m_pc, data);
+ LOGMASKED(LOG_PORTS, "%05X:80186 DMA 1 interrupt control = %04X\n", m_pc, data);
m_intr.dma[1] = data & 0x000f;
update_interrupt_state();
break;
case 0x1c:
- if (LOG_PORTS) logerror("%05X:80186 INT 0 interrupt control = %04X\n", m_pc, data);
+ LOGMASKED(LOG_PORTS, "%05X:80186 INT 0 interrupt control = %04X\n", m_pc, data);
if (BIT(m_reloc, 14))
m_intr.timer[1] = data & 0x000f;
else
@@ -1847,7 +1863,7 @@ void i80186_cpu_device::internal_port_w(offs_t offset, uint16_t data)
break;
case 0x1d:
- if (LOG_PORTS) logerror("%05X:80186 INT 1 interrupt control = %04X\n", m_pc, data);
+ LOGMASKED(LOG_PORTS, "%05X:80186 INT 1 interrupt control = %04X\n", m_pc, data);
if (BIT(m_reloc, 14))
m_intr.timer[2] = data & 0x000f;
else
@@ -1856,14 +1872,14 @@ void i80186_cpu_device::internal_port_w(offs_t offset, uint16_t data)
break;
case 0x1e:
- if (LOG_PORTS) logerror("%05X:80186 INT 2 interrupt control = %04X\n", m_pc, data);
+ LOGMASKED(LOG_PORTS, "%05X:80186 INT 2 interrupt control = %04X\n", m_pc, data);
if (!BIT(m_reloc, 14))
m_intr.ext[2] = data & 0x001f;
update_interrupt_state();
break;
case 0x1f:
- if (LOG_PORTS) logerror("%05X:80186 INT 3 interrupt control = %04X\n", m_pc, data);
+ LOGMASKED(LOG_PORTS, "%05X:80186 INT 3 interrupt control = %04X\n", m_pc, data);
if (!BIT(m_reloc, 14))
m_intr.ext[3] = data & 0x001f;
update_interrupt_state();
@@ -1872,7 +1888,7 @@ void i80186_cpu_device::internal_port_w(offs_t offset, uint16_t data)
case 0x28:
case 0x2c:
case 0x30:
- if (LOG_PORTS) logerror("%05X:80186 Timer %d count = %04X\n", m_pc, (offset - 0x28) / 4, data);
+ LOGMASKED(LOG_PORTS, "%05X:80186 Timer %d count = %04X\n", m_pc, (offset - 0x28) / 4, data);
which = (offset - 0x28) / 4;
internal_timer_update(which, data, -1, -1, -1);
break;
@@ -1880,14 +1896,14 @@ void i80186_cpu_device::internal_port_w(offs_t offset, uint16_t data)
case 0x29:
case 0x2d:
case 0x31:
- if (LOG_PORTS) logerror("%05X:80186 Timer %d max A = %04X\n", m_pc, (offset - 0x29) / 4, data);
+ LOGMASKED(LOG_PORTS, "%05X:80186 Timer %d max A = %04X\n", m_pc, (offset - 0x29) / 4, data);
which = (offset - 0x29) / 4;
internal_timer_update(which, -1, data, -1, -1);
break;
case 0x2a:
case 0x2e:
- if (LOG_PORTS) logerror("%05X:80186 Timer %d max B = %04X\n", m_pc, (offset - 0x2a) / 4, data);
+ LOGMASKED(LOG_PORTS, "%05X:80186 Timer %d max B = %04X\n", m_pc, (offset - 0x2a) / 4, data);
which = (offset - 0x2a) / 4;
internal_timer_update(which, -1, -1, data, -1);
break;
@@ -1895,79 +1911,79 @@ void i80186_cpu_device::internal_port_w(offs_t offset, uint16_t data)
case 0x2b:
case 0x2f:
case 0x33:
- if (LOG_PORTS) logerror("%05X:80186 Timer %d control = %04X\n", m_pc, (offset - 0x2b) / 4, data);
+ LOGMASKED(LOG_PORTS, "%05X:80186 Timer %d control = %04X\n", m_pc, (offset - 0x2b) / 4, data);
which = (offset - 0x2b) / 4;
internal_timer_update(which, -1, -1, -1, data);
break;
case 0x50:
- if (LOG_PORTS) logerror("%05X:80186 upper chip select = %04X\n", m_pc, data);
+ LOGMASKED(LOG_PORTS, "%05X:80186 upper chip select = %04X\n", m_pc, data);
m_mem.upper = data | 0xc038;
m_out_chip_select_func(0, m_mem.upper, 0xffff);
break;
case 0x51:
- if (LOG_PORTS) logerror("%05X:80186 lower chip select = %04X\n", m_pc, data);
+ LOGMASKED(LOG_PORTS, "%05X:80186 lower chip select = %04X\n", m_pc, data);
m_mem.lower = (data & 0x3fff) | 0x0038;
m_out_chip_select_func(1, m_mem.lower, 0xffff);
break;
case 0x52:
- if (LOG_PORTS) logerror("%05X:80186 peripheral chip select = %04X\n", m_pc, data);
+ LOGMASKED(LOG_PORTS, "%05X:80186 peripheral chip select = %04X\n", m_pc, data);
m_mem.peripheral = data | 0x0038;
m_out_chip_select_func(2, m_mem.peripheral, 0xffff);
break;
case 0x53:
- if (LOG_PORTS) logerror("%05X:80186 middle chip select = %04X\n", m_pc, data);
+ LOGMASKED(LOG_PORTS, "%05X:80186 middle chip select = %04X\n", m_pc, data);
m_mem.middle = data | 0x01f8;
m_out_chip_select_func(3, m_mem.middle, 0xffff);
break;
case 0x54:
- if (LOG_PORTS) logerror("%05X:80186 middle P chip select = %04X\n", m_pc, data);
+ LOGMASKED(LOG_PORTS, "%05X:80186 middle P chip select = %04X\n", m_pc, data);
m_mem.middle_size = data | 0x8038;
m_out_chip_select_func(4, m_mem.middle_size, 0xffff);
break;
case 0x60:
case 0x68:
- if (LOG_PORTS) logerror("%05X:80186 DMA%d lower source address = %04X\n", m_pc, (offset - 0x60) / 8, data);
+ LOGMASKED(LOG_PORTS, "%05X:80186 DMA%d lower source address = %04X\n", m_pc, (offset - 0x60) / 8, data);
which = (offset - 0x60) / 8;
m_dma[which].source = (m_dma[which].source & ~0x0ffff) | (data & 0x0ffff);
break;
case 0x61:
case 0x69:
- if (LOG_PORTS) logerror("%05X:80186 DMA%d upper source address = %04X\n", m_pc, (offset - 0x61) / 8, data);
+ LOGMASKED(LOG_PORTS, "%05X:80186 DMA%d upper source address = %04X\n", m_pc, (offset - 0x61) / 8, data);
which = (offset - 0x61) / 8;
m_dma[which].source = (m_dma[which].source & ~0xf0000) | ((data << 16) & 0xf0000);
break;
case 0x62:
case 0x6a:
- if (LOG_PORTS) logerror("%05X:80186 DMA%d lower dest address = %04X\n", m_pc, (offset - 0x62) / 8, data);
+ LOGMASKED(LOG_PORTS, "%05X:80186 DMA%d lower dest address = %04X\n", m_pc, (offset - 0x62) / 8, data);
which = (offset - 0x62) / 8;
m_dma[which].dest = (m_dma[which].dest & ~0x0ffff) | (data & 0x0ffff);
break;
case 0x63:
case 0x6b:
- if (LOG_PORTS) logerror("%05X:80186 DMA%d upper dest address = %04X\n", m_pc, (offset - 0x63) / 8, data);
+ LOGMASKED(LOG_PORTS, "%05X:80186 DMA%d upper dest address = %04X\n", m_pc, (offset - 0x63) / 8, data);
which = (offset - 0x63) / 8;
m_dma[which].dest = (m_dma[which].dest & ~0xf0000) | ((data << 16) & 0xf0000);
break;
case 0x64:
case 0x6c:
- if (LOG_PORTS) logerror("%05X:80186 DMA%d transfer count = %04X\n", m_pc, (offset - 0x64) / 8, data);
+ LOGMASKED(LOG_PORTS, "%05X:80186 DMA%d transfer count = %04X\n", m_pc, (offset - 0x64) / 8, data);
which = (offset - 0x64) / 8;
m_dma[which].count = data;
break;
case 0x65:
case 0x6d:
- if (LOG_PORTS) logerror("%05X:80186 DMA%d control = %04X\n", m_pc, (offset - 0x65) / 8, data);
+ LOGMASKED(LOG_PORTS, "%05X:80186 DMA%d control = %04X\n", m_pc, (offset - 0x65) / 8, data);
which = (offset - 0x65) / 8;
update_dma_control(which, data);
if((m_dma[which].control & (SYNC_MASK | ST_STOP | TIMER_DRQ)) == ST_STOP)
@@ -1980,12 +1996,12 @@ void i80186_cpu_device::internal_port_w(offs_t offset, uint16_t data)
case 0x7f:
// 80188 byte output to this port is *not* masked!
- if (LOG_PORTS) logerror("%05X:80186 relocation register = %04X\n", m_pc, data);
+ LOGMASKED(LOG_PORTS, "%05X:80186 relocation register = %04X\n", m_pc, data);
m_reloc = data;
break;
default:
- if (LOG_PORTS) logerror("%05X:80186 port %02X = %04X\n", m_pc, offset, data);
+ LOGMASKED(LOG_PORTS, "%05X:80186 port %02X = %04X\n", m_pc, offset, data);
break;
}
}
diff --git a/src/devices/cpu/i86/i186.h b/src/devices/cpu/i86/i186.h
index 5d43d2a660e..47f258f74e4 100644
--- a/src/devices/cpu/i86/i186.h
+++ b/src/devices/cpu/i86/i186.h
@@ -65,7 +65,6 @@ protected:
virtual void execute_run() override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual uint32_t execute_input_lines() const noexcept override { return 1; }
virtual uint8_t fetch() override;
uint32_t update_pc() { return m_pc = (m_sregs[CS] << 4) + m_ip; }
@@ -96,6 +95,8 @@ private:
uint16_t internal_port_r(offs_t offset, uint16_t mem_mask = ~0);
void internal_port_w(offs_t offset, uint16_t data);
+ TIMER_CALLBACK_MEMBER(timer_elapsed);
+
struct mem_state
{
uint16_t lower;
@@ -145,10 +146,6 @@ private:
mem_state m_mem;
bool m_last_dma;
- static const device_timer_id TIMER_INT0 = 0;
- static const device_timer_id TIMER_INT1 = 1;
- static const device_timer_id TIMER_INT2 = 2;
-
uint16_t m_reloc;
address_space_config m_program_config;
diff --git a/src/devices/cpu/lc8670/lc8670.cpp b/src/devices/cpu/lc8670/lc8670.cpp
index a4d038e3bf1..613d6495881 100644
--- a/src/devices/cpu/lc8670/lc8670.cpp
+++ b/src/devices/cpu/lc8670/lc8670.cpp
@@ -19,12 +19,11 @@
#include "lc8670.h"
#include "lc8670dsm.h"
-//***************************************************************************
-// DEBUGGING
-//***************************************************************************
+#define LOG_TIMERS (1U << 1)
+#define LOG_IRQ (1U << 2)
-#define LOG_TIMERS 0
-#define LOG_IRQ 0
+#define VERBOSE (0)
+#include "logmacro.h"
//**************************************************************************
@@ -206,9 +205,9 @@ void lc8670_cpu_device::device_start()
m_lcd_update_func.resolve();
// setup timers
- m_basetimer = timer_alloc(BASE_TIMER);
+ m_basetimer = timer_alloc(FUNC(lc8670_cpu_device::base_timer_update), this);
m_basetimer->adjust(attotime::from_hz(m_clocks[unsigned(clock_source::SUB)]), 0, attotime::from_hz(m_clocks[unsigned(clock_source::SUB)]));
- m_clocktimer = timer_alloc(CLOCK_TIMER);
+ m_clocktimer = timer_alloc(FUNC(lc8670_cpu_device::clock_timer_update), this);
// register state for debugger
state_add(LC8670_PC , "PC" , m_pc).callimport().callexport().formatstr("%04X");
@@ -328,26 +327,27 @@ void lc8670_cpu_device::device_reset()
//-------------------------------------------------
-// device_timer - handler timer events
+// base_timer_update
//-------------------------------------------------
-void lc8670_cpu_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(lc8670_cpu_device::base_timer_update)
{
- switch(id)
- {
- case BASE_TIMER:
- if (!(REG_ISL & 0x10))
- base_timer_tick();
- break;
+ if (!(REG_ISL & 0x10))
+ base_timer_tick();
+}
- case CLOCK_TIMER:
- timer0_prescaler_tick();
- timer1_tick();
- if ((REG_ISL & 0x30) == 0x10)
- base_timer_tick();
- break;
- }
+//-------------------------------------------------
+// clock_timer_update
+//-------------------------------------------------
+
+TIMER_CALLBACK_MEMBER(lc8670_cpu_device::clock_timer_update)
+{
+ timer0_prescaler_tick();
+ timer1_tick();
+
+ if ((REG_ISL & 0x30) == 0x10)
+ base_timer_tick();
}
@@ -454,7 +454,7 @@ void lc8670_cpu_device::execute_run()
void lc8670_cpu_device::execute_set_input(int inputnum, int state)
{
- switch(inputnum)
+ switch (inputnum)
{
case LC8670_EXT_INT0:
if ((REG_I01CR & 0x0c) == 0x00 && m_input_lines[inputnum] && !state) // falling edge
@@ -595,13 +595,15 @@ void lc8670_cpu_device::check_irqs()
// high priority IRQ
else if ((REG_IE & 0x80) && ((REG_IP<<3) & m_irq_flag))
{
- for(int i=3; i<=10; i++)
- if ((m_irq_flag & (REG_IP<<3)) & (1<<i))
+ for(int i = 3; i <= 10; i++)
+ {
+ if (BIT(m_irq_flag & (REG_IP << 3), i))
{
irq = i;
priority = 1;
break;
}
+ }
}
// low priority IRQ
@@ -617,37 +619,39 @@ void lc8670_cpu_device::check_irqs()
}
else if (REG_IE & 0x80)
{
- for(int i=3; i<=10; i++)
- if (m_irq_flag & (1<<i))
+ for(int i = 3; i <= 10; i++)
+ {
+ if (BIT(m_irq_flag, i))
{
irq = i;
priority = 0;
break;
}
+ }
}
// IRQ with less priority of current interrupt are not executed until the end of the current interrupt routine
if (irq != 0 && ((m_irq_lev & (1<<priority)) || (priority == 0 && (m_irq_lev & 0x06)) || (priority == 1 && (m_irq_lev & 0x04))))
{
- if (LOG_IRQ) logerror("%s: interrupt %d (Priority=%d, Level=%d) delayed\n", tag(), irq, priority, m_irq_lev);
+ LOGMASKED(LOG_IRQ, "%s: interrupt %d (Priority=%d, Level=%d) delayed\n", tag(), irq, priority, m_irq_lev);
irq = 0;
}
if (irq != 0)
{
- if (LOG_IRQ) logerror("%s: interrupt %d (Priority=%d, Level=%d) executed\n", tag(), irq, priority, m_irq_lev);
+ LOGMASKED(LOG_IRQ, "%s: interrupt %d (Priority=%d, Level=%d) executed\n", tag(), irq, priority, m_irq_lev);
- m_irq_lev |= (1<<priority);
+ m_irq_lev |= (1 << priority);
- push((m_pc>>0) & 0xff);
- push((m_pc>>8) & 0xff);
+ push((uint8_t)m_pc);
+ push((uint8_t)(m_pc >> 8));
set_pc(s_irq_vectors[irq]);
REG_PCON &= ~HALT_MODE; // interrupts resume from HALT state
// clear the IRQ flag
- m_irq_flag &= ~(1<<irq);
+ m_irq_flag &= ~(1 << irq);
standard_irq_callback(irq);
}
@@ -676,14 +680,14 @@ void lc8670_cpu_device::base_timer_tick()
if (base_counter_h & 0x40)
{
- if (LOG_TIMERS) logerror("%s: base timer 0 overflow, IRQ: %d\n", tag(), BIT(REG_BTCR,0));
+ LOGMASKED(LOG_TIMERS, "%s: base timer 0 overflow, IRQ: %d\n", tag(), BIT(REG_BTCR, 0));
REG_BTCR |= 0x02;
if (REG_BTCR & 0x01)
set_irq_flag(4);
}
bool bt1_req = false;
- switch(REG_BTCR & 0x30)
+ switch (REG_BTCR & 0x30)
{
case 0x00:
if (base_counter_l & 0x20)
@@ -705,7 +709,7 @@ void lc8670_cpu_device::base_timer_tick()
if (bt1_req)
{
- if (LOG_TIMERS) logerror("%s: base timer 1 overflow, IRQ: %d\n", tag(), BIT(REG_BTCR,3));
+ LOGMASKED(LOG_TIMERS, "%s: base timer 1 overflow, IRQ: %d\n", tag(), BIT(REG_BTCR, 3));
REG_BTCR |= 0x08;
if (REG_BTCR & 0x04)
set_irq_flag(4);
@@ -716,7 +720,7 @@ void lc8670_cpu_device::base_timer_tick()
else
update_port1(m_p1_data & 0xbf);
- m_base_timer[0] = base_counter_l & 0xff;
+ m_base_timer[0] = (uint8_t)base_counter_l;
m_base_timer[1] = base_counter_h & 0x3f;
}
}
@@ -730,7 +734,7 @@ void lc8670_cpu_device::timer0_prescaler_tick()
uint16_t prescaler = m_timer0_prescaler + 1;
if (prescaler & 0x100)
{
- if (LOG_TIMERS) logerror("%s: timer0 prescaler overflow\n", tag());
+ LOGMASKED(LOG_TIMERS, "%s: timer0 prescaler overflow\n", tag());
if ((REG_ISL & 0x30) == 0x30)
base_timer_tick();
@@ -741,7 +745,7 @@ void lc8670_cpu_device::timer0_prescaler_tick()
}
else
{
- m_timer0_prescaler = prescaler & 0xff;
+ m_timer0_prescaler = (uint8_t)prescaler;
}
}
@@ -762,7 +766,7 @@ void lc8670_cpu_device::timer0_tick(bool ext_line)
if (timer0 & 0x10000)
{
- if (LOG_TIMERS) logerror("%s: timer0 long overflow, IRQ: %d\n", tag(), BIT(REG_T0CNT,3));
+ LOGMASKED(LOG_TIMERS, "%s: timer0 long overflow, IRQ: %d\n", tag(), BIT(REG_T0CNT, 3));
m_timer0[0] = REG_T0LR;
m_timer0[1] = REG_T0HR;
REG_T0CNT |= 0x0a;
@@ -771,8 +775,8 @@ void lc8670_cpu_device::timer0_tick(bool ext_line)
}
else
{
- m_timer0[0] = (timer0>>0) & 0xff;
- m_timer0[1] = (timer0>>8) & 0xff;
+ m_timer0[0] = (uint8_t)timer0;
+ m_timer0[1] = (uint8_t)(timer0 >> 8);
}
}
}
@@ -785,7 +789,7 @@ void lc8670_cpu_device::timer0_tick(bool ext_line)
if (timer0l & 0x100)
{
- if (LOG_TIMERS) logerror("%s: timer0 low overflow, IRQ: %d\n", tag(), BIT(REG_T0CNT,0));
+ LOGMASKED(LOG_TIMERS, "%s: timer0 low overflow, IRQ: %d\n", tag(), BIT(REG_T0CNT, 0));
m_timer0[0] = REG_T0LR;
REG_T0CNT |= 0x02;
if (REG_T0CNT & 0x01)
@@ -793,15 +797,15 @@ void lc8670_cpu_device::timer0_tick(bool ext_line)
}
else
{
- m_timer0[0] = timer0l & 0xff;
+ m_timer0[0] = (uint8_t)timer0l;
}
}
- if ((REG_T0CNT & 0x80) && !ext_line)
+ if ((REG_T0CNT & 0x80) && !ext_line)
{
uint16_t timer0h = m_timer0[1] + 1;
if (timer0h & 0x100)
{
- if (LOG_TIMERS) logerror("%s: timer0 high overflow, IRQ: %d\n", tag(), BIT(REG_T0CNT,3));
+ LOGMASKED(LOG_TIMERS, "%s: timer0 high overflow, IRQ: %d\n", tag(), BIT(REG_T0CNT,3));
m_timer0[1] = REG_T0HR;
REG_T0CNT |= 0x08;
if (REG_T0CNT & 0x04)
@@ -809,7 +813,7 @@ void lc8670_cpu_device::timer0_tick(bool ext_line)
}
else
{
- m_timer0[1] = timer0h & 0xff;
+ m_timer0[1] = (uint8_t)timer0h;
}
}
}
@@ -838,7 +842,7 @@ void lc8670_cpu_device::timer1_tick()
if (timer1h & 0x100)
{
- if (LOG_TIMERS) logerror("%s: timer1 long overflow, IRQ: %d\n", tag(), BIT(REG_T1CNT,3));
+ LOGMASKED(LOG_TIMERS, "%s: timer1 long overflow, IRQ: %d\n", tag(), BIT(REG_T1CNT, 3));
m_timer1[1] = REG_T1HR;
REG_T1CNT |= 0x08;
if (REG_T1CNT & 0x05)
@@ -846,12 +850,12 @@ void lc8670_cpu_device::timer1_tick()
}
else
{
- m_timer1[1] = timer1h & 0xff;
+ m_timer1[1] = (uint8_t)timer1h;
}
}
else
{
- m_timer1[0] = timer1l & 0xff;
+ m_timer1[0] = (uint8_t)timer1l;
}
}
}
@@ -867,7 +871,7 @@ void lc8670_cpu_device::timer1_tick()
if (timer1l & 0x100)
{
- if (LOG_TIMERS) logerror("%s: timer1 low overflow, IRQ: %d\n", tag(), BIT(REG_T1CNT,0));
+ LOGMASKED(LOG_TIMERS, "%s: timer1 low overflow, IRQ: %d\n", tag(), BIT(REG_T1CNT, 0));
m_timer1[0] = REG_T1LR;
update_port1(m_p1_data & 0x7f);
REG_T1CNT |= 0x02;
@@ -876,7 +880,7 @@ void lc8670_cpu_device::timer1_tick()
}
else
{
- m_timer1[0] = timer1l & 0xff;
+ m_timer1[0] = (uint8_t)timer1l;
}
}
if (REG_T1CNT & 0x80)
@@ -885,7 +889,7 @@ void lc8670_cpu_device::timer1_tick()
if (timer1h & 0x100)
{
- if (LOG_TIMERS) logerror("%s: timer1 high overflow, IRQ: %d\n", tag(), BIT(REG_T1CNT,3));
+ LOGMASKED(LOG_TIMERS, "%s: timer1 high overflow, IRQ: %d\n", tag(), BIT(REG_T1CNT, 3));
m_timer1[1] = REG_T1HR;
REG_T1CNT |= 0x08;
if (REG_T1CNT & 0x04)
@@ -893,7 +897,7 @@ void lc8670_cpu_device::timer1_tick()
}
else
{
- m_timer1[1] = timer1h & 0xff;
+ m_timer1[1] = (uint8_t)timer1h;
}
}
}
@@ -907,26 +911,26 @@ void lc8670_cpu_device::timer1_tick()
uint8_t lc8670_cpu_device::mram_r(offs_t offset)
{
- return m_mram[BIT(REG_PSW,1)*0x100 + offset];
+ return m_mram[(BIT(REG_PSW, 1) << 8) + offset];
}
void lc8670_cpu_device::mram_w(offs_t offset, uint8_t data)
{
- m_mram[BIT(REG_PSW,1)*0x100 + offset] = data;
+ m_mram[(BIT(REG_PSW, 1) << 8) + offset] = data;
}
uint8_t lc8670_cpu_device::xram_r(offs_t offset)
{
if (!(REG_VCCR & 0x40) || machine().side_effects_disabled()) // XRAM access enabled
{
- uint8_t * xram_bank = m_xram + (REG_XBNK & 0x03) * 0x60;
+ uint8_t *xram_bank = m_xram + (REG_XBNK & 0x03) * 0x60;
- switch(REG_XBNK & 0x03)
+ switch (REG_XBNK & 0x03)
{
case 0:
case 1:
if ((offset & 0x0f) < 0x0c)
- return xram_bank[(offset>>4) * 0x0c + (offset & 0x0f)];
+ return xram_bank[(offset >> 4) * 0x0c + (offset & 0x0f)];
break;
case 2:
if (offset < 0x06)
@@ -942,14 +946,14 @@ void lc8670_cpu_device::xram_w(offs_t offset, uint8_t data)
{
if (!(REG_VCCR & 0x40) || machine().side_effects_disabled()) // XRAM access enabled
{
- uint8_t * xram_bank = m_xram + (REG_XBNK & 0x03) * 0x60;
+ uint8_t *xram_bank = m_xram + (REG_XBNK & 0x03) * 0x60;
switch(REG_XBNK & 0x03)
{
case 0:
case 1:
if ((offset & 0x0f) < 0x0c)
- xram_bank[(offset>>4) * 0x0c + (offset & 0x0f)] = data;
+ xram_bank[(offset >> 4) * 0x0c + (offset & 0x0f)] = data;
break;
case 2:
if (offset < 0x06)
@@ -979,12 +983,12 @@ uint8_t lc8670_cpu_device::regs_r(offs_t offset)
return m_io.read_byte(LC8670_PORT7) | 0xf0; // 4-bit read-only port
case 0x66:
{
- uint8_t data = m_vtrbf[((REG_VRMAD2<<8) | REG_VRMAD1) & 0x1ff];
+ uint8_t data = m_vtrbf[((REG_VRMAD2 << 8) | REG_VRMAD1) & 0x1ff];
if (!machine().side_effects_disabled() && (REG_VSEL & 0x10))
{
- uint16_t vrmad = (REG_VRMAD1 | (REG_VRMAD2<<8)) + 1;
- REG_VRMAD1 = vrmad & 0xff;
- REG_VRMAD2 = (vrmad >> 8) & 0x01;
+ uint16_t vrmad = ((REG_VRMAD1 | (REG_VRMAD2 << 8)) + 1) & 0x1ff;
+ REG_VRMAD1 = (uint8_t)vrmad;
+ REG_VRMAD2 = (uint8_t)(vrmad >> 8);
}
return data;
}
@@ -1049,9 +1053,9 @@ void lc8670_cpu_device::regs_w(offs_t offset, uint8_t data)
m_vtrbf[((REG_VRMAD2<<8) | REG_VRMAD1) & 0x1ff] = data;
if (!machine().side_effects_disabled() && (REG_VSEL & 0x10))
{
- uint16_t vrmad = (REG_VRMAD1 | (REG_VRMAD2<<8)) + 1;
- REG_VRMAD1 = vrmad & 0xff;
- REG_VRMAD2 = (vrmad >> 8) & 0x01;
+ uint16_t vrmad = ((REG_VRMAD1 | (REG_VRMAD2 << 8)) + 1) & 0x1ff;
+ REG_VRMAD1 = (uint8_t)vrmad;
+ REG_VRMAD2 = (uint8_t)(vrmad >> 8);
}
break;
case 0x7f:
@@ -1144,7 +1148,7 @@ inline uint16_t lc8670_cpu_device::get_addr()
if (mode > 0x01 && mode <= 0x03)
addr = GET_D9;
else if (mode > 0x03 && mode <= 0x07)
- addr = read_data(GET_RI | ((REG_PSW>>1) & 0x0c)) | ((GET_RI & 0x02) ? 0x100 : 0x00);
+ addr = read_data(GET_RI | ((REG_PSW >> 1) & 0x0c)) | ((GET_RI & 0x02) ? 0x100 : 0x00);
else
fatalerror("%s: invalid get_addr in mode %x\n", machine().describe_context().c_str(), mode);
@@ -1191,7 +1195,7 @@ inline void lc8670_cpu_device::change_clock_source()
inline void lc8670_cpu_device::check_p_flag()
{
uint8_t p_plag = 0;
- for(int i=0; i<8; i++)
+ for(int i = 0; i < 8; i++)
p_plag ^= BIT(REG_A, i);
if (p_plag)
@@ -1215,8 +1219,8 @@ inline void lc8670_cpu_device::check_p3int()
inline void lc8670_cpu_device::set_irq_flag(int source)
{
- if (LOG_IRQ) logerror("%s: set interrupt flag: %d\n", tag(), source);
- m_irq_flag |= 1<<source;
+ LOGMASKED(LOG_IRQ, "%s: set interrupt flag: %d\n", tag(), source);
+ m_irq_flag |= 1 << source;
}
int lc8670_cpu_device::decode_op(uint8_t op)
@@ -1238,7 +1242,7 @@ int lc8670_cpu_device::decode_op(uint8_t op)
break;
}
- return ((op>>4) & 0x0f) * 5 + idx;
+ return (op >> 4) * 5 + idx;
}
//**************************************************************************
@@ -1270,8 +1274,8 @@ int lc8670_cpu_device::op_call()
{
uint16_t new_pc = GET_A12;
- push((m_pc>>0) & 0xff);
- push((m_pc>>8) & 0xff);
+ push((uint8_t)m_pc);
+ push((uint8_t)(m_pc >> 8));
set_pc((m_pc & 0xf000) | new_pc);
@@ -1282,10 +1286,10 @@ int lc8670_cpu_device::op_call()
int lc8670_cpu_device::op_callr()
{
uint16_t r16 = fetch();
- r16 |= fetch()<<8;
+ r16 |= fetch() << 8;
- push((m_pc>>0) & 0xff);
- push((m_pc>>8) & 0xff);
+ push((uint8_t)m_pc);
+ push((uint8_t)(m_pc >> 8));
set_pc(m_pc - 1 + r16);
return 4;
@@ -1294,7 +1298,7 @@ int lc8670_cpu_device::op_callr()
int lc8670_cpu_device::op_brf()
{
uint16_t r16 = fetch();
- r16 |= fetch()<<8;
+ r16 |= fetch() << 8;
set_pc(m_pc - 1 + r16);
return 4;
@@ -1309,11 +1313,11 @@ int lc8670_cpu_device::op_st()
int lc8670_cpu_device::op_callf()
{
- uint16_t a16 = fetch()<<8;
+ uint16_t a16 = fetch() << 8;
a16 |= fetch();
- push((m_pc>>0) & 0xff);
- push((m_pc>>8) & 0xff);
+ push((uint8_t)m_pc);
+ push((uint8_t)(m_pc >> 8));
set_pc(a16);
return 2;
@@ -1321,7 +1325,7 @@ int lc8670_cpu_device::op_callf()
int lc8670_cpu_device::op_jmpf()
{
- uint16_t a16 = fetch()<<8;
+ uint16_t a16 = fetch() << 8;
a16 |= fetch();
set_pc(a16);
@@ -1349,11 +1353,11 @@ int lc8670_cpu_device::op_jmp()
int lc8670_cpu_device::op_mul()
{
- uint32_t res = REG_B * ((REG_A<<8) | REG_C);
+ uint32_t res = REG_B * ((REG_A << 8) | REG_C);
- REG_A = (res>>8) & 0xff;
- REG_B = (res>>16) & 0xff;
- REG_C = (res>>0) & 0xff;
+ REG_A = (uint8_t)(res >> 8);
+ REG_B = (uint8_t)(res >> 16);
+ REG_C = (uint8_t)res;
SET_OV(REG_B != 0 ? 1 : 0);
SET_CY(0);
@@ -1396,13 +1400,13 @@ int lc8670_cpu_device::op_div()
if (REG_B != 0)
{
- uint16_t v = ((REG_A<<8) | REG_C);
+ uint16_t v = ((REG_A << 8) | REG_C);
res = v / REG_B;
mod = v % REG_B;
- REG_A = (res>>8) & 0xff;
- REG_C = (res>>0) & 0xff;
- REG_B = mod & 0xff;
+ REG_A = (uint8_t)(res >> 8);
+ REG_C = (uint8_t)res;
+ REG_B = (uint8_t)mod;
SET_OV(0);
}
else
@@ -1446,7 +1450,7 @@ int lc8670_cpu_device::op_bne_ri()
int lc8670_cpu_device::op_ldf()
{
- uint16_t addr = REG_TRL | (REG_TRH<<8);
+ uint16_t addr = REG_TRL | (REG_TRH << 8);
m_bankswitch_func(REG_FPR & 0x01 ? 2 : 1);
REG_A = m_program.read_byte(addr);
@@ -1458,7 +1462,7 @@ int lc8670_cpu_device::op_ldf()
int lc8670_cpu_device::op_stf()
{
- uint16_t addr = REG_TRL | (REG_TRH<<8);
+ uint16_t addr = REG_TRL | (REG_TRH << 8);
m_bankswitch_func(REG_FPR & 0x01 ? 2 : 1);
m_program.write_byte(addr, REG_A);
@@ -1488,9 +1492,9 @@ int lc8670_cpu_device::op_bpc()
uint8_t r8 = GET_R8;
uint8_t data = read_data_latch(d9);
- if (data & (1<<b3))
+ if (BIT(data, b3))
{
- write_data_latch(d9, data & ~(1<<b3));
+ write_data_latch(d9, data & ~(1 << b3));
set_pc(m_pc + SIGNED(r8));
}
@@ -1521,7 +1525,7 @@ int lc8670_cpu_device::op_bp()
uint16_t d9 = GET_D9B3;
uint8_t r8 = GET_R8;
- if (read_data(d9) & (1<<b3))
+ if (BIT(read_data(d9), b3))
set_pc(m_pc + SIGNED(r8));
return 2;
@@ -1564,7 +1568,7 @@ int lc8670_cpu_device::op_add()
SET_AC(((REG_A & 0x0f) + (data & 0x0f)) > 0x0f ? 1 : 0);
SET_OV((REG_A & data) & (data ^ res) & 0x80 ? 1 : 0);
- REG_A = res & 0xff;
+ REG_A = (uint8_t)res;
CHECK_P();
return 1;
@@ -1576,7 +1580,7 @@ int lc8670_cpu_device::op_bn()
uint16_t d9 = GET_D9B3;
uint8_t r8 = GET_R8;
- if (!(read_data(d9) & (1<<b3)))
+ if (!BIT(read_data(d9), b3))
set_pc(m_pc + SIGNED(r8));
return 2;
@@ -1599,7 +1603,7 @@ int lc8670_cpu_device::op_addc()
SET_CY(res > 0xff ? 1 : 0);
SET_AC(((REG_A & 0x0f) + (data & 0x0f) + GET_CY) > 0x0f ? 1 : 0);
- SET_OV(((REG_A+GET_CY) & data) & (data ^ res) & 0x80 ? 1 : 0);
+ SET_OV(((REG_A + GET_CY) & data) & (data ^ res) & 0x80 ? 1 : 0);
REG_A = res & 0xff;
CHECK_P();
@@ -1609,7 +1613,7 @@ int lc8670_cpu_device::op_addc()
int lc8670_cpu_device::op_ret()
{
- uint16_t new_pc = pop()<<8;
+ uint16_t new_pc = pop() << 8;
new_pc |= pop();
set_pc(new_pc);
@@ -1625,7 +1629,7 @@ int lc8670_cpu_device::op_sub()
SET_AC(((REG_A & 0x0f) - (data & 0x0f)) < 0x00 ? 1 : 0);
SET_OV((REG_A ^ data) & (data & res) & 0x80 ? 1 : 0);
- REG_A = res & 0xff;
+ REG_A = (uint8_t)res;
CHECK_P();
return 1;
@@ -1636,7 +1640,7 @@ int lc8670_cpu_device::op_not1()
uint16_t d9 = GET_D9B3;
uint8_t data = read_data_latch(d9);
- data ^= (1<<GET_B3);
+ data ^= (1 << GET_B3);
write_data_latch(d9, data);
return 1;
@@ -1644,17 +1648,19 @@ int lc8670_cpu_device::op_not1()
int lc8670_cpu_device::op_reti()
{
- uint16_t new_pc = pop()<<8;
+ uint16_t new_pc = pop() << 8;
new_pc |= pop();
set_pc(new_pc);
- if (LOG_IRQ) logerror("%s: RETI from level %d\n", machine().describe_context(), m_irq_lev);
- for(int i=2; i>=0; i--)
- if (m_irq_lev & (1<<i))
+ LOGMASKED(LOG_IRQ, "%s: RETI from level %d\n", machine().describe_context(), m_irq_lev);
+ for(int i = 2; i >= 0; i--)
+ {
+ if (BIT(m_irq_lev, i))
{
- m_irq_lev &= ~(1<<i);
+ m_irq_lev &= ~(1 << i);
break;
}
+ }
m_after_reti = true;
@@ -1670,7 +1676,7 @@ int lc8670_cpu_device::op_subc()
SET_AC(((REG_A & 0x0f) - (data & 0x0f) - GET_CY) < 0x00 ? 1 : 0);
SET_OV((REG_A ^ (data + GET_CY)) & (data & res) & 0x80 ? 1 : 0);
- REG_A = res & 0xff;
+ REG_A = (uint8_t)res;
CHECK_P();
return 1;
@@ -1678,7 +1684,7 @@ int lc8670_cpu_device::op_subc()
int lc8670_cpu_device::op_ror()
{
- REG_A = ((REG_A & 0x01) << 7) | (REG_A>>1);
+ REG_A = ((REG_A & 0x01) << 7) | (REG_A >> 1);
CHECK_P();
return 1;
@@ -1686,7 +1692,7 @@ int lc8670_cpu_device::op_ror()
int lc8670_cpu_device::op_ldc()
{
- REG_A = m_program.read_byte(((REG_TRH<<8) | REG_TRL) + REG_A);
+ REG_A = m_program.read_byte(((REG_TRH << 8) | REG_TRL) + REG_A);
CHECK_P();
return 2;
@@ -1709,7 +1715,7 @@ int lc8670_cpu_device::op_clr1()
uint16_t d9 = GET_D9B3;
uint8_t data = read_data_latch(d9);
- data &= ~(1<<GET_B3);
+ data &= ~(1 << GET_B3);
write_data_latch(d9, data);
return 1;
@@ -1717,9 +1723,9 @@ int lc8670_cpu_device::op_clr1()
int lc8670_cpu_device::op_rorc()
{
- uint8_t a = (REG_A>>1) | (GET_CY ? 0x80 : 0x00);
+ uint8_t a = (REG_A >> 1) | (GET_CY ? 0x80 : 0x00);
- SET_CY(BIT(REG_A,0));
+ SET_CY(BIT(REG_A, 0));
REG_A = a;
CHECK_P();
@@ -1736,7 +1742,7 @@ int lc8670_cpu_device::op_or()
int lc8670_cpu_device::op_rol()
{
- REG_A = ((REG_A & 0x80) >> 7) | (REG_A<<1);
+ REG_A = ((REG_A & 0x80) >> 7) | (REG_A << 1);
CHECK_P();
return 1;
@@ -1755,7 +1761,7 @@ int lc8670_cpu_device::op_set1()
uint16_t d9 = GET_D9B3;
uint8_t data = read_data_latch(d9);
- data |= (1<<GET_B3);
+ data |= (1 << GET_B3);
write_data_latch(d9, data);
return 1;
@@ -1763,9 +1769,9 @@ int lc8670_cpu_device::op_set1()
int lc8670_cpu_device::op_rolc()
{
- uint8_t a = (REG_A<<1) | (GET_CY ? 0x01 : 0x00);
+ uint8_t a = (REG_A << 1) | (GET_CY ? 0x01 : 0x00);
- SET_CY(BIT(REG_A,7));
+ SET_CY(BIT(REG_A, 7));
REG_A = a;
CHECK_P();
diff --git a/src/devices/cpu/lc8670/lc8670.h b/src/devices/cpu/lc8670/lc8670.h
index 37904e6ebe9..a00658a7d4d 100644
--- a/src/devices/cpu/lc8670/lc8670.h
+++ b/src/devices/cpu/lc8670/lc8670.h
@@ -93,7 +93,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_execute_interface overrides
virtual uint32_t execute_min_cycles() const noexcept override { return 1; }
@@ -112,6 +111,9 @@ protected:
// device_disasm_interface overrides
virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
+ TIMER_CALLBACK_MEMBER(base_timer_update);
+ TIMER_CALLBACK_MEMBER(clock_timer_update);
+
private:
// helpers
inline uint8_t fetch();
@@ -195,8 +197,6 @@ private:
memory_access< 8, 0, 0, ENDIANNESS_BIG>::specific m_io; // I/O ports
// timers
- static const device_timer_id BASE_TIMER = 1;
- static const device_timer_id CLOCK_TIMER = 2;
emu_timer * m_basetimer;
emu_timer * m_clocktimer;
diff --git a/src/devices/cpu/m37710/m37710.cpp b/src/devices/cpu/m37710/m37710.cpp
index e8e121c5f21..6ca096d1e4f 100644
--- a/src/devices/cpu/m37710/m37710.cpp
+++ b/src/devices/cpu/m37710/m37710.cpp
@@ -1354,12 +1354,12 @@ void m37710_cpu_device::device_start()
for (int i = 0; i < 8; i++)
{
- m_timers[i] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(m37710_cpu_device::m37710_timer_cb), this));
+ m_timers[i] = timer_alloc(FUNC(m37710_cpu_device::m37710_timer_cb), this);
m_reload[i] = attotime::never;
m_timer_out[i] = 0;
}
- m_ad_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(m37710_cpu_device::ad_timer_cb), this));
+ m_ad_timer = timer_alloc(FUNC(m37710_cpu_device::ad_timer_cb), this);
save_item(NAME(m_a));
save_item(NAME(m_b));
diff --git a/src/devices/cpu/m6502/m3745x.cpp b/src/devices/cpu/m6502/m3745x.cpp
index b591fdfcc1f..20b881f217e 100644
--- a/src/devices/cpu/m6502/m3745x.cpp
+++ b/src/devices/cpu/m6502/m3745x.cpp
@@ -62,10 +62,11 @@ void m3745x_device::device_start()
m_write_p.resolve_all_safe();
m_read_ad.resolve_all_safe(0);
- for (int i = 0; i < NUM_TIMERS; i++)
+ for (int i = TIMER_1; i <= TIMER_3; i++)
{
- m_timers[i] = timer_alloc(i);
+ m_timers[i] = machine().scheduler().timer_alloc(timer_expired_delegate());
}
+ m_timers[TIMER_ADC] = timer_alloc(FUNC(m3745x_device::adc_complete), this);
m740_device::device_start();
@@ -116,22 +117,13 @@ void m3745x_device::device_reset()
m_last_all_ints = 0;
}
-void m3745x_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(m3745x_device::adc_complete)
{
- switch (id)
- {
- case TIMER_ADC:
- m_timers[TIMER_ADC]->adjust(attotime::never);
-
- m_adctrl |= ADCTRL_COMPLETE;
- m_intreq2 |= IRQ2_ADC;
- recalc_irqs();
- break;
+ m_timers[TIMER_ADC]->adjust(attotime::never);
- default:
- printf("M3775x: unknown timer expire %d\n", id);
- break;
- }
+ m_adctrl |= ADCTRL_COMPLETE;
+ m_intreq2 |= IRQ2_ADC;
+ recalc_irqs();
}
void m3745x_device::execute_set_input(int inputnum, int state)
diff --git a/src/devices/cpu/m6502/m3745x.h b/src/devices/cpu/m6502/m3745x.h
index 6036362765b..bab3558e0a2 100644
--- a/src/devices/cpu/m6502/m3745x.h
+++ b/src/devices/cpu/m6502/m3745x.h
@@ -58,7 +58,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual space_config_vector memory_space_config() const override;
// device_execute_interface overrides
@@ -66,6 +65,8 @@ protected:
virtual uint64_t execute_cycles_to_clocks(uint64_t cycles) const noexcept override { return (cycles * 4); }
virtual void execute_set_input(int inputnum, int state) override;
+ TIMER_CALLBACK_MEMBER(adc_complete);
+
void send_port(uint8_t offset, uint8_t data);
uint8_t read_port(uint8_t offset);
diff --git a/src/devices/cpu/m6502/m5074x.cpp b/src/devices/cpu/m6502/m5074x.cpp
index 251902f3f0f..2d961b694a5 100644
--- a/src/devices/cpu/m6502/m5074x.cpp
+++ b/src/devices/cpu/m6502/m5074x.cpp
@@ -69,10 +69,10 @@ void m5074x_device::device_start()
m_read_p.resolve_all_safe(0);
m_write_p.resolve_all_safe();
- for (int i = 0; i < NUM_TIMERS; i++)
- {
- m_timers[i] = timer_alloc(i);
- }
+ m_timers[TIMER_1] = timer_alloc(FUNC(m5074x_device::timer1_tick), this);
+ m_timers[TIMER_2] = timer_alloc(FUNC(m5074x_device::timer2_tick), this);
+ m_timers[TIMER_X] = timer_alloc(FUNC(m5074x_device::timerx_tick), this);
+ m_timers[TIMER_ADC] = timer_alloc(FUNC(m5074x_device::adc_complete), this);
m740_device::device_start();
@@ -122,42 +122,39 @@ void m5074x_device::device_reset()
m_tmr1 = m_tmr2 = m_tmrx = 0;
}
-void m5074x_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(m5074x_device::timer1_tick)
{
- switch (id)
- {
- case TIMER_1:
- m_tmr1--;
+ m_tmr1--;
- if (m_tmr1 <= 0)
- {
- m_intctrl |= IRQ_TMR1REQ;
- m_tmr1 = m_tmr1latch;
- recalc_irqs();
- }
- break;
+ if (m_tmr1 <= 0)
+ {
+ m_intctrl |= IRQ_TMR1REQ;
+ m_tmr1 = m_tmr1latch;
+ recalc_irqs();
+ }
+}
- case TIMER_2:
- m_tmr2--;
+TIMER_CALLBACK_MEMBER(m5074x_device::timer2_tick)
+{
+ m_tmr2--;
- if (m_tmr2 <= 0)
- {
- m_intctrl |= IRQ_TMR2REQ;
- m_tmr2 = m_tmr2latch;
- recalc_irqs();
- }
- break;
+ if (m_tmr2 <= 0)
+ {
+ m_intctrl |= IRQ_TMR2REQ;
+ m_tmr2 = m_tmr2latch;
+ recalc_irqs();
+ }
+}
- case TIMER_X:
- m_tmrx--;
+TIMER_CALLBACK_MEMBER(m5074x_device::timerx_tick)
+{
+ m_tmrx--;
- if (m_tmrx <= 0)
- {
- m_tmrctrl |= TMRC_TMRXREQ;
- m_tmrx = m_tmrxlatch;
- recalc_irqs();
- }
- break;
+ if (m_tmrx <= 0)
+ {
+ m_tmrctrl |= TMRC_TMRXREQ;
+ m_tmrx = m_tmrxlatch;
+ recalc_irqs();
}
}
@@ -607,23 +604,14 @@ void m50753_device::execute_set_input(int inputnum, int state)
recalc_irqs();
}
-void m50753_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(m50753_device::adc_complete)
{
- switch (id)
- {
- case TIMER_ADC:
- m_timers[TIMER_ADC]->adjust(attotime::never);
+ m_timers[TIMER_ADC]->adjust(attotime::never);
- // if interrupt source is the ADC, do it.
- if (m_ad_control & 4)
- {
- m_intctrl |= IRQ_50753_INTADC;
- recalc_irqs();
- }
- break;
-
- default:
- m5074x_device::device_timer(timer, id, param);
- break;
+ // if interrupt source is the ADC, do it.
+ if (m_ad_control & 4)
+ {
+ m_intctrl |= IRQ_50753_INTADC;
+ recalc_irqs();
}
}
diff --git a/src/devices/cpu/m6502/m5074x.h b/src/devices/cpu/m6502/m5074x.h
index 72b7f918e3f..2b860a56e83 100644
--- a/src/devices/cpu/m6502/m5074x.h
+++ b/src/devices/cpu/m6502/m5074x.h
@@ -56,7 +56,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual space_config_vector memory_space_config() const override;
// device_execute_interface overrides (TODO: /8 in M50740A/41/52/57/58 SLW mode)
@@ -64,6 +63,11 @@ protected:
virtual uint64_t execute_cycles_to_clocks(uint64_t cycles) const noexcept override { return (cycles * 4); }
virtual void execute_set_input(int inputnum, int state) override;
+ TIMER_CALLBACK_MEMBER(timer1_tick);
+ TIMER_CALLBACK_MEMBER(timer2_tick);
+ TIMER_CALLBACK_MEMBER(timerx_tick);
+ virtual TIMER_CALLBACK_MEMBER(adc_complete) { }
+
void send_port(uint8_t offset, uint8_t data);
uint8_t read_port(uint8_t offset);
@@ -128,10 +132,11 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void execute_set_input(int inputnum, int state) override;
+ virtual TIMER_CALLBACK_MEMBER(adc_complete) override;
+
private:
void m50753_map(address_map &map);
diff --git a/src/devices/cpu/m6502/st2204.cpp b/src/devices/cpu/m6502/st2204.cpp
index 2523f34d5a8..0e8541be87a 100644
--- a/src/devices/cpu/m6502/st2204.cpp
+++ b/src/devices/cpu/m6502/st2204.cpp
@@ -91,9 +91,9 @@ void st2204_device::device_start()
init_base_timer(0x0020);
init_lcd_timer(0x0040);
- m_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(st2204_device::t0_interrupt), this));
- m_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(st2204_device::t1_interrupt), this));
- m_psg_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(st2204_device::psg_interrupt), this));
+ m_timer[0] = timer_alloc(FUNC(st2204_device::t0_interrupt), this);
+ m_timer[1] = timer_alloc(FUNC(st2204_device::t1_interrupt), this);
+ m_psg_timer = timer_alloc(FUNC(st2204_device::psg_interrupt), this);
save_item(NAME(m_tmode));
save_item(NAME(m_tcntr));
diff --git a/src/devices/cpu/m6502/st2205u.cpp b/src/devices/cpu/m6502/st2205u.cpp
index 0dfde79e388..ac50492e325 100644
--- a/src/devices/cpu/m6502/st2205u.cpp
+++ b/src/devices/cpu/m6502/st2205u.cpp
@@ -130,10 +130,10 @@ void st2205u_base_device::base_init(std::unique_ptr<mi_st2xxx> &&intf)
{
m_stream = stream_alloc(0, 4, 48000);
- m_timer_12bit[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(st2205u_device::t0_interrupt), this));
- m_timer_12bit[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(st2205u_device::t1_interrupt), this));
- m_timer_12bit[2] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(st2205u_device::t2_interrupt), this));
- m_timer_12bit[3] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(st2205u_device::t3_interrupt), this));
+ m_timer_12bit[0] = timer_alloc(FUNC(st2205u_device::t0_interrupt), this);
+ m_timer_12bit[1] = timer_alloc(FUNC(st2205u_device::t1_interrupt), this);
+ m_timer_12bit[2] = timer_alloc(FUNC(st2205u_device::t2_interrupt), this);
+ m_timer_12bit[3] = timer_alloc(FUNC(st2205u_device::t3_interrupt), this);
init_base_timer(0x0040);
init_lcd_timer(0x0080);
diff --git a/src/devices/cpu/m6502/st2xxx.cpp b/src/devices/cpu/m6502/st2xxx.cpp
index d0428332878..480460bbe67 100644
--- a/src/devices/cpu/m6502/st2xxx.cpp
+++ b/src/devices/cpu/m6502/st2xxx.cpp
@@ -132,7 +132,7 @@ void st2xxx_device::init_base_timer(u16 ireq)
if (st2xxx_bt_divider(n) != 0)
{
m_bt_mask |= 1 << n;
- m_base_timer[n] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(st2xxx_device::bt_interrupt), this));
+ m_base_timer[n] = timer_alloc(FUNC(st2xxx_device::bt_interrupt), this);
}
}
@@ -151,7 +151,7 @@ void st2xxx_device::init_lcd_timer(u16 ireq)
m_lcd_ireq = ireq;
assert(m_lcd_ireq != 0);
- m_lcd_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(st2xxx_device::lcd_interrupt), this));
+ m_lcd_timer = timer_alloc(FUNC(st2xxx_device::lcd_interrupt), this);
}
void st2xxx_device::save_common_registers()
diff --git a/src/devices/cpu/m6800/m6801.cpp b/src/devices/cpu/m6800/m6801.cpp
index a5e3226d770..e759a0b57cc 100644
--- a/src/devices/cpu/m6800/m6801.cpp
+++ b/src/devices/cpu/m6800/m6801.cpp
@@ -1041,7 +1041,7 @@ void m6801_cpu_device::device_start()
{
m6800_cpu_device::device_start();
- m_sci_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(m6801_cpu_device::sci_tick),this));
+ m_sci_timer = timer_alloc(FUNC(m6801_cpu_device::sci_tick), this);
m_irq_state[M6801_IS_LINE] = 0;
m_port_ddr[3] = 0;
diff --git a/src/devices/cpu/mb88xx/mb88xx.cpp b/src/devices/cpu/mb88xx/mb88xx.cpp
index 5333d7466b8..1ef53c5e00b 100644
--- a/src/devices/cpu/mb88xx/mb88xx.cpp
+++ b/src/devices/cpu/mb88xx/mb88xx.cpp
@@ -193,7 +193,7 @@ void mb88_cpu_device::device_start()
m_read_si.resolve_safe(0);
m_write_so.resolve_safe();
- m_serial = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mb88_cpu_device::serial_timer), this));
+ m_serial = timer_alloc(FUNC(mb88_cpu_device::serial_timer), this);
m_ctr = 0;
diff --git a/src/devices/cpu/melps4/m58846.cpp b/src/devices/cpu/melps4/m58846.cpp
index 7ba2dafb36a..0440375e47d 100644
--- a/src/devices/cpu/melps4/m58846.cpp
+++ b/src/devices/cpu/melps4/m58846.cpp
@@ -39,7 +39,7 @@ m58846_device::m58846_device(const machine_config &mconfig, const char *tag, dev
void m58846_device::device_start()
{
melps4_cpu_device::device_start();
- m_timer = timer_alloc(0);
+ m_timer = timer_alloc(FUNC(m58846_device::timer_update), this);
}
@@ -66,11 +66,8 @@ void m58846_device::reset_timer()
m_timer->adjust(base);
}
-void m58846_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(m58846_device::timer_update)
{
- if (id != 0)
- return;
-
// timer 1: 7-bit fixed counter (manual specifically says 127)
if (++m_tmr_count[0] == 127)
{
diff --git a/src/devices/cpu/melps4/m58846.h b/src/devices/cpu/melps4/m58846.h
index 5c365e48898..2ba855e3dd2 100644
--- a/src/devices/cpu/melps4/m58846.h
+++ b/src/devices/cpu/melps4/m58846.h
@@ -30,8 +30,8 @@ protected:
virtual void execute_one() override;
// timers
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void write_v(u8 data) override;
+ TIMER_CALLBACK_MEMBER(timer_update);
void data_128x4(address_map &map);
void program_2kx9(address_map &map);
diff --git a/src/devices/cpu/mips/mips3.cpp b/src/devices/cpu/mips/mips3.cpp
index 08ea4197a34..9b6067e5fa4 100644
--- a/src/devices/cpu/mips/mips3.cpp
+++ b/src/devices/cpu/mips/mips3.cpp
@@ -429,7 +429,7 @@ void mips3_device::device_start()
m_program->accessors(m_memory);
/* allocate a timer for the compare interrupt */
- m_compare_int_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mips3_device::compare_int_callback), this));
+ m_compare_int_timer = timer_alloc(FUNC(mips3_device::compare_int_callback), this);
uint32_t flags = 0;
/* initialize the UML generator */
diff --git a/src/devices/cpu/mips/r4000.cpp b/src/devices/cpu/mips/r4000.cpp
index 5cd174d48d5..1cf885379cc 100644
--- a/src/devices/cpu/mips/r4000.cpp
+++ b/src/devices/cpu/mips/r4000.cpp
@@ -187,7 +187,7 @@ void r4000_base_device::device_start()
m_hard_reset = true;
- m_cp0_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(r4000_base_device::cp0_timer_callback), this));
+ m_cp0_timer = timer_alloc(FUNC(r4000_base_device::cp0_timer_callback), this);
// compute icache line selection mask and allocate tag and data
unsigned const config_ic = (m_cp0[CP0_Config] & CONFIG_IC) >> 9;
diff --git a/src/devices/cpu/mn10200/mn10200.cpp b/src/devices/cpu/mn10200/mn10200.cpp
index 0dcc3aef4ec..64da0efe23f 100644
--- a/src/devices/cpu/mn10200/mn10200.cpp
+++ b/src/devices/cpu/mn10200/mn10200.cpp
@@ -150,7 +150,7 @@ void mn10200_device::device_start()
for (int tmr = 0; tmr < MN10200_NUM_TIMERS_8BIT; tmr++)
{
- m_timer_timers[tmr] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mn10200_device::simple_timer_cb), this));
+ m_timer_timers[tmr] = timer_alloc(FUNC(mn10200_device::simple_timer_cb), this);
m_timer_timers[tmr]->adjust(attotime::never, tmr);
}
diff --git a/src/devices/cpu/nec/v25.cpp b/src/devices/cpu/nec/v25.cpp
index 20a87c5c50f..4b24f752623 100644
--- a/src/devices/cpu/nec/v25.cpp
+++ b/src/devices/cpu/nec/v25.cpp
@@ -555,7 +555,7 @@ void v25_common_device::device_start()
m_E16 = 0;
for (i = 0; i < 4; i++)
- m_timers[i] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(v25_common_device::v25_timer_callback),this));
+ m_timers[i] = timer_alloc(FUNC(v25_common_device::v25_timer_callback), this);
std::fill_n(&m_intp_state[0], 3, 0);
std::fill_n(&m_ems[0], 3, 0);
diff --git a/src/devices/cpu/powerpc/ppccom.cpp b/src/devices/cpu/powerpc/ppccom.cpp
index 450b89ae643..aecc85d1709 100644
--- a/src/devices/cpu/powerpc/ppccom.cpp
+++ b/src/devices/cpu/powerpc/ppccom.cpp
@@ -754,22 +754,22 @@ void ppc_device::device_start()
/* allocate a timer for the compare interrupt */
if ((m_cap & PPCCAP_OEA) && (m_tb_divisor))
- m_decrementer_int_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ppc_device::decrementer_int_callback), this));
+ m_decrementer_int_timer = timer_alloc(FUNC(ppc_device::decrementer_int_callback), this);
/* and for the 4XX interrupts if needed */
if (m_cap & PPCCAP_4XX)
{
- m_fit_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ppc_device::ppc4xx_fit_callback), this));
- m_pit_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ppc_device::ppc4xx_pit_callback), this));
- m_spu.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ppc_device::ppc4xx_spu_callback), this));
+ m_fit_timer = timer_alloc(FUNC(ppc_device::ppc4xx_fit_callback), this);
+ m_pit_timer = timer_alloc(FUNC(ppc_device::ppc4xx_pit_callback), this);
+ m_spu.timer = timer_alloc(FUNC(ppc_device::ppc4xx_spu_callback), this);
}
if (m_cap & PPCCAP_4XX)
{
- m_buffered_dma_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ppc_device::ppc4xx_buffered_dma_callback), this));
- m_buffered_dma_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ppc_device::ppc4xx_buffered_dma_callback), this));
- m_buffered_dma_timer[2] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ppc_device::ppc4xx_buffered_dma_callback), this));
- m_buffered_dma_timer[3] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ppc_device::ppc4xx_buffered_dma_callback), this));
+ m_buffered_dma_timer[0] = timer_alloc(FUNC(ppc_device::ppc4xx_buffered_dma_callback), this);
+ m_buffered_dma_timer[1] = timer_alloc(FUNC(ppc_device::ppc4xx_buffered_dma_callback), this);
+ m_buffered_dma_timer[2] = timer_alloc(FUNC(ppc_device::ppc4xx_buffered_dma_callback), this);
+ m_buffered_dma_timer[3] = timer_alloc(FUNC(ppc_device::ppc4xx_buffered_dma_callback), this);
m_buffered_dma_rate[0] = 10000;
m_buffered_dma_rate[1] = 10000;
diff --git a/src/devices/cpu/psx/dma.cpp b/src/devices/cpu/psx/dma.cpp
index 0b69e01df37..f4376472d98 100644
--- a/src/devices/cpu/psx/dma.cpp
+++ b/src/devices/cpu/psx/dma.cpp
@@ -64,7 +64,7 @@ void psxdma_device::device_start()
{
psx_dma_channel *dma = &m_channel[ index ];
- dma->timer = timer_alloc(index);
+ dma->timer = timer_alloc( FUNC( psxdma_device::dma_finished ), this );
save_item( NAME( dma->n_base ), index );
save_item( NAME( dma->n_blockcontrol ), index );
@@ -129,8 +129,9 @@ void psxdma_device::dma_interrupt_update()
m_dicr &= 0x00ffffff | ( m_dicr << 8 );
}
-void psxdma_device::dma_finished( int index )
+TIMER_CALLBACK_MEMBER( psxdma_device::dma_finished )
{
+ const int index = param;
psx_dma_channel *dma = &m_channel[ index ];
if( dma->n_channelcontrol == 0x01000401 && index == 2 )
@@ -196,11 +197,6 @@ void psxdma_device::dma_finished( int index )
dma_stop_timer( index );
}
-void psxdma_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- dma_finished(id);
-}
-
void psxdma_device::install_read_handler( int index, read_delegate p_fn_dma_read )
{
m_channel[ index ].fn_read = p_fn_dma_read;
diff --git a/src/devices/cpu/psx/dma.h b/src/devices/cpu/psx/dma.h
index 96c6aebf46b..0d81d67da7d 100644
--- a/src/devices/cpu/psx/dma.h
+++ b/src/devices/cpu/psx/dma.h
@@ -39,7 +39,6 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_post_load() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
private:
struct psx_dma_channel
@@ -58,7 +57,7 @@ private:
void dma_stop_timer( int n_channel );
void dma_timer_adjust( int n_channel );
void dma_interrupt_update();
- void dma_finished( int n_channel );
+ TIMER_CALLBACK_MEMBER( dma_finished );
psx_dma_channel m_channel[7];
uint32_t m_dpcp;
diff --git a/src/devices/cpu/psx/rcnt.cpp b/src/devices/cpu/psx/rcnt.cpp
index 590cb49bde0..210c6359323 100644
--- a/src/devices/cpu/psx/rcnt.cpp
+++ b/src/devices/cpu/psx/rcnt.cpp
@@ -58,7 +58,7 @@ void psxrcnt_device::device_start()
for( n = 0; n < 3; n++ )
{
- root_counter[ n ].timer = timer_alloc(n);
+ root_counter[ n ].timer = timer_alloc( FUNC( psxrcnt_device::timer_update ), this );
save_item(NAME(root_counter[ n ].n_count), n);
save_item(NAME(root_counter[ n ].n_mode), n);
save_item(NAME(root_counter[ n ].n_target), n);
@@ -227,9 +227,9 @@ void psxrcnt_device::root_timer_adjust( int n_counter )
}
}
-void psxrcnt_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER( psxrcnt_device::timer_update )
{
- int n_counter = id;
+ int n_counter = param;
psx_root *root = &root_counter[ n_counter ];
verboselog( *this, 2, "root_finished( %d ) %04x\n", n_counter, root_current( n_counter ) );
diff --git a/src/devices/cpu/psx/rcnt.h b/src/devices/cpu/psx/rcnt.h
index dd9b1a3cc89..8e0a471f4e1 100644
--- a/src/devices/cpu/psx/rcnt.h
+++ b/src/devices/cpu/psx/rcnt.h
@@ -41,7 +41,8 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_post_load() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER( timer_update );
private:
struct psx_root
diff --git a/src/devices/cpu/psx/sio.cpp b/src/devices/cpu/psx/sio.cpp
index fe3fef083f6..0f6b2c39001 100644
--- a/src/devices/cpu/psx/sio.cpp
+++ b/src/devices/cpu/psx/sio.cpp
@@ -63,7 +63,7 @@ void psxsio_device::device_start()
m_dtr_handler.resolve_safe();
m_rts_handler.resolve_safe();
- m_timer = timer_alloc( 0 );
+ m_timer = timer_alloc( FUNC( psxsio_device::sio_tick ), this );
m_mode = 0;
m_control = 0;
m_baud = 0;
@@ -138,7 +138,7 @@ void psxsio_device::sio_timer_adjust()
m_timer->adjust( n_time );
}
-void psxsio_device::device_timer(emu_timer &timer, device_timer_id tid, int param)
+TIMER_CALLBACK_MEMBER( psxsio_device::sio_tick )
{
verboselog( *this, 2, "sio tick\n" );
diff --git a/src/devices/cpu/psx/sio.h b/src/devices/cpu/psx/sio.h
index 940b7737c46..482a8081d6a 100644
--- a/src/devices/cpu/psx/sio.h
+++ b/src/devices/cpu/psx/sio.h
@@ -54,9 +54,10 @@ protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_post_load() override;
+ TIMER_CALLBACK_MEMBER( sio_tick );
+
private:
void sio_interrupt();
void sio_timer_adjust();
diff --git a/src/devices/cpu/rii/riscii.cpp b/src/devices/cpu/rii/riscii.cpp
index e5e021ff90e..f7c642a2f0a 100644
--- a/src/devices/cpu/rii/riscii.cpp
+++ b/src/devices/cpu/rii/riscii.cpp
@@ -207,8 +207,8 @@ void riscii_series_device::device_start()
set_icountptr(m_icount);
- m_timer0 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(riscii_series_device::timer0), this));
- m_speech_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(riscii_series_device::speech_timer), this));
+ m_timer0 = timer_alloc(FUNC(riscii_series_device::timer0), this);
+ m_speech_timer = timer_alloc(FUNC(riscii_series_device::speech_timer), this);
state_add<u32>(RII_PC, "PC", [this]() { return m_pc; }, [this](u32 pc) { debug_set_pc(pc); }).mask(m_pcmask);
state_add<u32>(STATE_GENPC, "GENPC", [this]() { return m_pc; }, [this](u32 pc) { debug_set_pc(pc); }).mask(m_pcmask).noshow();
diff --git a/src/devices/cpu/sc61860/sc61860.cpp b/src/devices/cpu/sc61860/sc61860.cpp
index cac673f70e7..9719ebc7069 100644
--- a/src/devices/cpu/sc61860/sc61860.cpp
+++ b/src/devices/cpu/sc61860/sc61860.cpp
@@ -105,7 +105,7 @@ void sc61860_device::device_reset()
void sc61860_device::device_start()
{
- m_2ms_tick_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sc61860_device::sc61860_2ms_tick), this));
+ m_2ms_tick_timer = timer_alloc(FUNC(sc61860_device::sc61860_2ms_tick), this);
m_2ms_tick_timer->adjust(attotime::from_hz(500), 0, attotime::from_hz(500));
space(AS_PROGRAM).cache(m_cache);
diff --git a/src/devices/cpu/sh/sh2.cpp b/src/devices/cpu/sh/sh2.cpp
index 302b1082284..63a981b754b 100644
--- a/src/devices/cpu/sh/sh2.cpp
+++ b/src/devices/cpu/sh/sh2.cpp
@@ -514,15 +514,15 @@ void sh2_device::device_start()
{
sh_common_execution::device_start();
- m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sh2_device::sh2_timer_callback), this));
+ m_timer = timer_alloc(FUNC(sh2_device::sh2_timer_callback), this);
m_timer->adjust(attotime::never);
- m_wdtimer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sh2_device::sh2_wdtimer_callback), this));
+ m_wdtimer = timer_alloc(FUNC(sh2_device::sh2_wdtimer_callback), this);
m_wdtimer->adjust(attotime::never);
- m_dma_current_active_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sh2_device::sh2_dma_current_active_callback), this));
+ m_dma_current_active_timer[0] = timer_alloc(FUNC(sh2_device::sh2_dma_current_active_callback), this);
m_dma_current_active_timer[0]->adjust(attotime::never);
- m_dma_current_active_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sh2_device::sh2_dma_current_active_callback), this));
+ m_dma_current_active_timer[1] = timer_alloc(FUNC(sh2_device::sh2_dma_current_active_callback), this);
m_dma_current_active_timer[1]->adjust(attotime::never);
/* resolve callbacks */
diff --git a/src/devices/cpu/sh/sh4.cpp b/src/devices/cpu/sh/sh4.cpp
index c3dde9ed3e1..7d64546d741 100644
--- a/src/devices/cpu/sh/sh4.cpp
+++ b/src/devices/cpu/sh/sh4.cpp
@@ -2037,21 +2037,21 @@ void sh34_base_device::device_start()
for (int i = 0; i < 3; i++)
{
- m_timer[i] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sh34_base_device::sh4_timer_callback), this));
+ m_timer[i] = timer_alloc(FUNC(sh34_base_device::sh4_timer_callback), this);
m_timer[i]->adjust(attotime::never, i);
}
for (int i = 0; i < 4; i++)
{
- m_dma_timer[i] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sh34_base_device::sh4_dmac_callback), this));
+ m_dma_timer[i] = timer_alloc(FUNC(sh34_base_device::sh4_dmac_callback), this);
m_dma_timer[i]->adjust(attotime::never, i);
}
- m_refresh_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sh34_base_device::sh4_refresh_timer_callback), this));
+ m_refresh_timer = timer_alloc(FUNC(sh34_base_device::sh4_refresh_timer_callback), this);
m_refresh_timer->adjust(attotime::never);
m_refresh_timer_base = 0;
- m_rtc_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sh34_base_device::sh4_rtc_timer_callback), this));
+ m_rtc_timer = timer_alloc(FUNC(sh34_base_device::sh4_rtc_timer_callback), this);
m_rtc_timer->adjust(attotime::never);
sh4_parse_configuration();
diff --git a/src/devices/cpu/sharc/sharc.cpp b/src/devices/cpu/sharc/sharc.cpp
index a2b262d83e1..7ce22652570 100644
--- a/src/devices/cpu/sharc/sharc.cpp
+++ b/src/devices/cpu/sharc/sharc.cpp
@@ -580,7 +580,7 @@ void adsp21062_device::device_start()
m_core->cache_dirty = 1;
- m_core->delayed_iop_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(adsp21062_device::sharc_iop_delayed_write_callback), this));
+ m_core->delayed_iop_timer = timer_alloc(FUNC(adsp21062_device::sharc_iop_delayed_write_callback), this);
for (auto & elem : m_core->dma_op)
{
@@ -594,7 +594,7 @@ void adsp21062_device::device_start()
elem.pmode = 0;
elem.chained_direction = 0;
elem.active = false;
- elem.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(adsp21062_device::sharc_dma_callback), this));
+ elem.timer = timer_alloc(FUNC(adsp21062_device::sharc_dma_callback), this);
}
for (int i=0; i < 16; i++)
diff --git a/src/devices/cpu/sm510/sm510base.cpp b/src/devices/cpu/sm510/sm510base.cpp
index 6501e24d693..05768cdd95d 100644
--- a/src/devices/cpu/sm510/sm510base.cpp
+++ b/src/devices/cpu/sm510/sm510base.cpp
@@ -200,7 +200,7 @@ TIMER_CALLBACK_MEMBER(sm510_base_device::lcd_timer_cb)
void sm510_base_device::init_lcd_driver()
{
// note: in reality, this timer runs at high frequency off the main divider, strobing one segment at a time
- m_lcd_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sm510_base_device::lcd_timer_cb), this));
+ m_lcd_timer = timer_alloc(FUNC(sm510_base_device::lcd_timer_cb), this);
attotime period = attotime::from_ticks(0x20, unscaled_clock()); // default 1kHz
m_lcd_timer->adjust(period, 0, period);
}
@@ -223,7 +223,7 @@ TIMER_CALLBACK_MEMBER(sm510_base_device::div_timer_cb)
void sm510_base_device::init_divider()
{
- m_div_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sm510_base_device::div_timer_cb), this));
+ m_div_timer = timer_alloc(FUNC(sm510_base_device::div_timer_cb), this);
attotime period = attotime::from_ticks(1, unscaled_clock());
m_div_timer->adjust(period, 0, period);
}
diff --git a/src/devices/cpu/tlcs870/tlcs870.cpp b/src/devices/cpu/tlcs870/tlcs870.cpp
index 13f92343786..c010de7e03b 100644
--- a/src/devices/cpu/tlcs870/tlcs870.cpp
+++ b/src/devices/cpu/tlcs870/tlcs870.cpp
@@ -1244,13 +1244,13 @@ void tlcs870_device::device_start()
m_port_analog_in_cb.resolve_all_safe(0xff);
m_serial_out_cb.resolve_all_safe();
- m_serial_transmit_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tlcs870_device::sio0_transmit_cb), this));
- m_serial_transmit_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tlcs870_device::sio1_transmit_cb), this));
+ m_serial_transmit_timer[0] = timer_alloc(FUNC(tlcs870_device::sio0_transmit_cb), this);
+ m_serial_transmit_timer[1] = timer_alloc(FUNC(tlcs870_device::sio1_transmit_cb), this);
- m_tcx_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tlcs870_device::tc1_cb), this));
- m_tcx_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tlcs870_device::tc2_cb), this));
- m_tcx_timer[2] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tlcs870_device::tc3_cb), this));
- m_tcx_timer[3] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tlcs870_device::tc4_cb), this));
+ m_tcx_timer[0] = timer_alloc(FUNC(tlcs870_device::tc1_cb), this);
+ m_tcx_timer[1] = timer_alloc(FUNC(tlcs870_device::tc2_cb), this);
+ m_tcx_timer[2] = timer_alloc(FUNC(tlcs870_device::tc3_cb), this);
+ m_tcx_timer[3] = timer_alloc(FUNC(tlcs870_device::tc4_cb), this);
}
diff --git a/src/devices/cpu/tlcs90/tlcs90.cpp b/src/devices/cpu/tlcs90/tlcs90.cpp
index a363781636c..148f2dbd4a8 100644
--- a/src/devices/cpu/tlcs90/tlcs90.cpp
+++ b/src/devices/cpu/tlcs90/tlcs90.cpp
@@ -2950,9 +2950,9 @@ void tlcs90_device::device_start()
// Timers
for (int i = 0; i < 4; i++)
- m_timer[i] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tlcs90_device::t90_timer_callback),this));
+ m_timer[i] = timer_alloc(FUNC(tlcs90_device::t90_timer_callback), this);
- m_timer[4] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tlcs90_device::t90_timer4_callback),this));
+ m_timer[4] = timer_alloc(FUNC(tlcs90_device::t90_timer4_callback), this);
state_add( T90_PC, "PC", m_pc.w.l).formatstr("%04X");
state_add( T90_SP, "SP", m_sp.w.l).formatstr("%04X");
diff --git a/src/devices/cpu/tms34010/tms34010.cpp b/src/devices/cpu/tms34010/tms34010.cpp
index 42faac82b5d..729b6ed0bf6 100644
--- a/src/devices/cpu/tms34010/tms34010.cpp
+++ b/src/devices/cpu/tms34010/tms34010.cpp
@@ -740,7 +740,7 @@ void tms340x0_device::device_start()
}
/* allocate a scanline timer and set it to go off at the start */
- m_scantimer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tms340x0_device::scanline_callback), this));
+ m_scantimer = timer_alloc(FUNC(tms340x0_device::scanline_callback), this);
m_scantimer->adjust(attotime::zero);
save_item(NAME(m_pc));
diff --git a/src/devices/cpu/tms7000/tms7000.cpp b/src/devices/cpu/tms7000/tms7000.cpp
index 5f1cb0f1308..3ce6f001ca2 100644
--- a/src/devices/cpu/tms7000/tms7000.cpp
+++ b/src/devices/cpu/tms7000/tms7000.cpp
@@ -222,7 +222,7 @@ void tms7000_device::device_start()
for (int tmr = 0; tmr < 2; tmr++)
{
- m_timer_handle[tmr] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tms7000_device::simple_timer_cb), this));
+ m_timer_handle[tmr] = timer_alloc(FUNC(tms7000_device::simple_timer_cb), this);
m_timer_handle[tmr]->adjust(attotime::never, tmr);
m_timer_data[tmr] = 0;
diff --git a/src/devices/cpu/ucom4/ucom4.cpp b/src/devices/cpu/ucom4/ucom4.cpp
index db273f65297..ade42ba1e12 100644
--- a/src/devices/cpu/ucom4/ucom4.cpp
+++ b/src/devices/cpu/ucom4/ucom4.cpp
@@ -160,7 +160,7 @@ void ucom4_cpu_device::device_start()
m_datamask = (1 << m_datawidth) - 1;
m_dph_mask = m_datamask >> 4;
- m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ucom4_cpu_device::simple_timer_cb), this));
+ m_timer = timer_alloc(FUNC(ucom4_cpu_device::simple_timer_cb), this);
// resolve callbacks
m_read_a.resolve_safe(0);
diff --git a/src/devices/cpu/z8/z8.cpp b/src/devices/cpu/z8/z8.cpp
index ec63bb86d89..d59651b683b 100644
--- a/src/devices/cpu/z8/z8.cpp
+++ b/src/devices/cpu/z8/z8.cpp
@@ -1260,8 +1260,8 @@ void z8_device::device_start()
space(AS_IO).specific(m_regs);
/* allocate timers */
- m_internal_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(z8_device::timeout<0>), this));
- m_internal_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(z8_device::timeout<1>), this));
+ m_internal_timer[0] = timer_alloc(FUNC(z8_device::timeout<0>), this);
+ m_internal_timer[1] = timer_alloc(FUNC(z8_device::timeout<1>), this);
/* Clear state */
std::fill(std::begin(m_irq_line), std::end(m_irq_line), CLEAR_LINE);
diff --git a/src/devices/cpu/z80/kp63.cpp b/src/devices/cpu/z80/kp63.cpp
index 675586377cb..db42ef30ecb 100644
--- a/src/devices/cpu/z80/kp63.cpp
+++ b/src/devices/cpu/z80/kp63.cpp
@@ -153,20 +153,20 @@ TIMER_CALLBACK_MEMBER(kp63_device::pwm_off)
void kp63_device::device_start()
{
// Setup timers
- m_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(kp63_device::timer_expired<0>), this));
- m_strobe_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(kp63_device::strobe_off<0>), this));
- m_pwm_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(kp63_device::pwm_off<0>), this));
- m_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(kp63_device::timer_expired<1>), this));
- m_strobe_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(kp63_device::strobe_off<1>), this));
- m_pwm_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(kp63_device::pwm_off<1>), this));
- m_timer[2] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(kp63_device::timer_expired<2>), this));
- m_strobe_timer[2] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(kp63_device::strobe_off<2>), this));
- m_pwm_timer[2] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(kp63_device::pwm_off<2>), this));
+ m_timer[0] = timer_alloc(FUNC(kp63_device::timer_expired<0>), this);
+ m_strobe_timer[0] = timer_alloc(FUNC(kp63_device::strobe_off<0>), this);
+ m_pwm_timer[0] = timer_alloc(FUNC(kp63_device::pwm_off<0>), this);
+ m_timer[1] = timer_alloc(FUNC(kp63_device::timer_expired<1>), this);
+ m_strobe_timer[1] = timer_alloc(FUNC(kp63_device::strobe_off<1>), this);
+ m_pwm_timer[1] = timer_alloc(FUNC(kp63_device::pwm_off<1>), this);
+ m_timer[2] = timer_alloc(FUNC(kp63_device::timer_expired<2>), this);
+ m_strobe_timer[2] = timer_alloc(FUNC(kp63_device::strobe_off<2>), this);
+ m_pwm_timer[2] = timer_alloc(FUNC(kp63_device::pwm_off<2>), this);
if (c_num_counters > 3)
{
- m_timer[3] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(kp63_device::timer_expired<3>), this));
- m_strobe_timer[3] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(kp63_device::strobe_off<3>), this));
- m_pwm_timer[3] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(kp63_device::pwm_off<3>), this));
+ m_timer[3] = timer_alloc(FUNC(kp63_device::timer_expired<3>), this);
+ m_strobe_timer[3] = timer_alloc(FUNC(kp63_device::strobe_off<3>), this);
+ m_pwm_timer[3] = timer_alloc(FUNC(kp63_device::pwm_off<3>), this);
}
// Save state
diff --git a/src/devices/cpu/z80/tmpz84c015.cpp b/src/devices/cpu/z80/tmpz84c015.cpp
index 329aec51f9f..3df10f19c6c 100644
--- a/src/devices/cpu/z80/tmpz84c015.cpp
+++ b/src/devices/cpu/z80/tmpz84c015.cpp
@@ -116,7 +116,7 @@ void tmpz84c015_device::device_start()
m_wdtout_cb.resolve();
// setup watchdog timer
- m_watchdog_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tmpz84c015_device::watchdog_timeout), this));
+ m_watchdog_timer = timer_alloc(FUNC(tmpz84c015_device::watchdog_timeout), this);
// register for save states
save_item(NAME(m_irq_priority));
diff --git a/src/devices/imagedev/avivideo.cpp b/src/devices/imagedev/avivideo.cpp
index 5c6742d8a6e..f1a2b7e1cdc 100644
--- a/src/devices/imagedev/avivideo.cpp
+++ b/src/devices/imagedev/avivideo.cpp
@@ -46,7 +46,7 @@ avivideo_image_device::~avivideo_image_device()
void avivideo_image_device::device_start()
{
- m_frame_timer = timer_alloc(TIMER_FRAME);
+ m_frame_timer = timer_alloc(FUNC(avivideo_image_device::frame_timer), this);
m_frame_timer->adjust(attotime::never);
save_item(NAME(m_frame_count));
@@ -58,29 +58,26 @@ void avivideo_image_device::device_reset()
m_frame_num = 0;
}
-void avivideo_image_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(avivideo_image_device::frame_timer)
{
- if (id == TIMER_FRAME)
+ if (m_avi != nullptr)
{
- if (m_avi != nullptr)
+ avi_file::error avierr = m_avi->read_uncompressed_video_frame(m_frame_num, *m_frame);
+ if (avierr != avi_file::error::NONE)
{
- avi_file::error avierr = m_avi->read_uncompressed_video_frame(m_frame_num, *m_frame);
- if (avierr != avi_file::error::NONE)
- {
- m_frame_timer->adjust(attotime::never);
- return;
- }
- m_frame_num++;
- if (m_frame_num >= m_frame_count)
- {
- m_frame_num = 0;
- }
+ m_frame_timer->adjust(attotime::never);
+ return;
}
- else
+ m_frame_num++;
+ if (m_frame_num >= m_frame_count)
{
- m_frame_timer->adjust(attotime::never);
+ m_frame_num = 0;
}
}
+ else
+ {
+ m_frame_timer->adjust(attotime::never);
+ }
}
image_init_result avivideo_image_device::call_load()
diff --git a/src/devices/imagedev/avivideo.h b/src/devices/imagedev/avivideo.h
index b32a32d8bbe..5af11df4187 100644
--- a/src/devices/imagedev/avivideo.h
+++ b/src/devices/imagedev/avivideo.h
@@ -47,11 +47,10 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-private:
- static constexpr device_timer_id TIMER_FRAME = 0;
+ TIMER_CALLBACK_MEMBER(frame_timer);
+private:
bitmap_argb32 *m_frame;
avi_file::ptr m_avi;
diff --git a/src/devices/imagedev/flopdrv.cpp b/src/devices/imagedev/flopdrv.cpp
index 50214966b42..eba391f966e 100644
--- a/src/devices/imagedev/flopdrv.cpp
+++ b/src/devices/imagedev/flopdrv.cpp
@@ -129,7 +129,7 @@ void legacy_floppy_image_device::floppy_drive_init()
/* initialise flags */
m_flags = 0;
m_index_pulse_callback = nullptr;
- m_index_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(legacy_floppy_image_device::floppy_drive_index_callback),this));
+ m_index_timer = timer_alloc(FUNC(legacy_floppy_image_device::floppy_drive_index_callback), this);
m_idx = 0;
floppy_drive_set_geometry(m_config->floppy_type);
@@ -692,6 +692,9 @@ void legacy_floppy_image_device::device_start()
/* disk changed */
m_dskchg = CLEAR_LINE;
// m_out_dskchg_func(m_dskchg);
+
+ /* write-protect callback */
+ m_wpt_timer = timer_alloc(FUNC(legacy_floppy_image_device::set_wpt), this);
}
@@ -746,7 +749,7 @@ image_init_result legacy_floppy_image_device::call_load()
else
next_wpt = 0;
- machine().scheduler().timer_set(attotime::from_msec(250), timer_expired_delegate(FUNC(legacy_floppy_image_device::set_wpt),this), next_wpt);
+ m_wpt_timer->adjust(attotime::from_msec(250), next_wpt);
return retVal;
}
@@ -768,7 +771,7 @@ void legacy_floppy_image_device::call_unload()
//m_out_wpt_func(m_wpt);
/* set timer for disk eject */
- machine().scheduler().timer_set(attotime::from_msec(250), timer_expired_delegate(FUNC(legacy_floppy_image_device::set_wpt),this), 1);
+ m_wpt_timer->adjust(attotime::from_msec(250), 1);
}
bool legacy_floppy_image_device::is_creatable() const noexcept
diff --git a/src/devices/imagedev/flopdrv.h b/src/devices/imagedev/flopdrv.h
index 7582d156285..a3241cc4b89 100644
--- a/src/devices/imagedev/flopdrv.h
+++ b/src/devices/imagedev/flopdrv.h
@@ -210,6 +210,7 @@ protected:
/* rotation per minute => gives index pulse frequency */
float m_rpm;
+ emu_timer *m_wpt_timer;
int m_id_index;
device_t *m_controller;
diff --git a/src/devices/imagedev/floppy.cpp b/src/devices/imagedev/floppy.cpp
index a550a1e8f1b..d5894530337 100644
--- a/src/devices/imagedev/floppy.cpp
+++ b/src/devices/imagedev/floppy.cpp
@@ -447,7 +447,7 @@ void floppy_image_device::device_start()
stp = 1;
wpt = 0;
dskchg = exists() ? 1 : 0;
- index_timer = timer_alloc(0);
+ index_timer = timer_alloc(FUNC(floppy_image_device::index_resync), this);
image_dirty = false;
ready = true;
ready_counter = 0;
@@ -525,11 +525,6 @@ void floppy_image_device::device_reset()
cache_clear();
}
-void floppy_image_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- index_resync();
-}
-
const floppy_image_format_t *floppy_image_device::identify(std::string_view filename)
{
util::core_file::ptr fd;
@@ -565,7 +560,7 @@ void floppy_image_device::init_floppy_load(bool write_supported)
revolution_start_time = mon ? attotime::never : machine().time();
revolution_count = 0;
- index_resync();
+ index_resync(0);
wpt = 1; // disk sleeve is covering the sensor
if (!cur_wpt_cb.isnull())
@@ -875,7 +870,7 @@ void floppy_image_device::mon_w(int state)
} else {
ready_counter = 2;
}
- index_resync();
+ index_resync(0);
}
/* on -> off */
@@ -900,7 +895,7 @@ attotime floppy_image_device::time_next_index()
}
/* index pulses at rpm/60 Hz, and stays high for ~2ms at 300rpm */
-void floppy_image_device::index_resync()
+TIMER_CALLBACK_MEMBER(floppy_image_device::index_resync)
{
if(revolution_start_time.is_never()) {
if(idx) {
diff --git a/src/devices/imagedev/floppy.h b/src/devices/imagedev/floppy.h
index b9ff120e200..02b181d5540 100644
--- a/src/devices/imagedev/floppy.h
+++ b/src/devices/imagedev/floppy.h
@@ -137,7 +137,6 @@ public:
void dskchg_w(int state) { if (dskchg_writable) dskchg = state; }
void ds_w(int state) { ds = state; check_led(); }
- void index_resync();
attotime time_next_index();
attotime get_next_transition(const attotime &from_when);
void write_flux(const attotime &start, const attotime &end, int transition_count, const attotime *transitions);
@@ -169,13 +168,14 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_config_complete() override;
virtual void device_add_mconfig(machine_config &config) override;
// device_image_interface implementation
virtual const software_list_loader &get_software_list_loader() const override;
+ TIMER_CALLBACK_MEMBER(index_resync);
+
virtual void track_changed();
virtual void setup_characteristics() = 0;
diff --git a/src/devices/imagedev/mfmhd.cpp b/src/devices/imagedev/mfmhd.cpp
index de67f3eb887..7bbab1e97da 100644
--- a/src/devices/imagedev/mfmhd.cpp
+++ b/src/devices/imagedev/mfmhd.cpp
@@ -293,7 +293,6 @@
enum
{
INDEX_TM = 0,
- SPINUP_TM,
SEEK_TM,
CACHE_TM
};
@@ -350,10 +349,10 @@ mfm_harddisk_device::~mfm_harddisk_device()
void mfm_harddisk_device::device_start()
{
- m_index_timer = timer_alloc(INDEX_TM);
- m_spinup_timer = timer_alloc(SPINUP_TM);
- m_seek_timer = timer_alloc(SEEK_TM);
- m_cache_timer = timer_alloc(CACHE_TM);
+ m_index_timer = timer_alloc(FUNC(mfm_harddisk_device::index_timer), this);
+ m_spinup_timer = timer_alloc(FUNC(mfm_harddisk_device::recalibrate), this);
+ m_seek_timer = timer_alloc(FUNC(mfm_harddisk_device::seek_update), this);
+ m_cache_timer = timer_alloc(FUNC(mfm_harddisk_device::cache_update), this);
m_rev_time = attotime::from_hz(m_rpm/60);
m_index_timer->adjust(attotime::from_hz(m_rpm/60), 0, attotime::from_hz(m_rpm/60));
@@ -628,86 +627,80 @@ attotime mfm_harddisk_device::track_end_time()
return endtime;
}
-void mfm_harddisk_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(mfm_harddisk_device::index_timer)
{
- switch (id)
+ // Simple index hole handling. We assume that there is only a short pulse.
+ m_revolution_start_time = machine().time();
+ if (!m_index_pulse_cb.isnull())
{
- case INDEX_TM:
- // Simple index hole handling. We assume that there is only a short pulse.
- m_revolution_start_time = machine().time();
- if (!m_index_pulse_cb.isnull())
- {
- m_index_pulse_cb(this, ASSERT_LINE);
- m_index_pulse_cb(this, CLEAR_LINE);
- }
- break;
+ m_index_pulse_cb(this, ASSERT_LINE);
+ m_index_pulse_cb(this, CLEAR_LINE);
+ }
+}
- case SPINUP_TM:
- recalibrate();
- break;
+TIMER_CALLBACK_MEMBER(mfm_harddisk_device::recalibrate)
+{
+ LOGMASKED(LOG_STEPS, "Recalibrate to track 0\n");
+ direction_in_w(CLEAR_LINE);
+ while (-m_track_delta < m_phys_cylinders)
+ {
+ step_w(ASSERT_LINE);
+ step_w(CLEAR_LINE);
+ }
+}
- case CACHE_TM:
- m_cache->write_back_one();
+TIMER_CALLBACK_MEMBER(mfm_harddisk_device::seek_update)
+{
+ switch (m_step_phase)
+ {
+ case STEP_COLLECT:
+ // Collect timer has expired; start moving head
+ head_move();
break;
-
- case SEEK_TM:
- switch (m_step_phase)
+ case STEP_MOVING:
+ // Head has reached final position
+ // Check whether we have a new delta
+ if (m_track_delta == 0)
{
- case STEP_COLLECT:
- // Collect timer has expired; start moving head
+ // Start the settle timer
+ m_step_phase = STEP_SETTLE;
+ m_seek_timer->adjust(m_settle_time);
+ LOGMASKED(LOG_STEPSDETAIL, "Arrived at target cylinder %d, settling ...\n", m_current_cylinder);
+ }
+ else
+ {
+ // need to move the head again
head_move();
- break;
- case STEP_MOVING:
- // Head has reached final position
- // Check whether we have a new delta
- if (m_track_delta == 0)
- {
- // Start the settle timer
- m_step_phase = STEP_SETTLE;
- m_seek_timer->adjust(m_settle_time);
- LOGMASKED(LOG_STEPSDETAIL, "Arrived at target cylinder %d, settling ...\n", m_current_cylinder);
- }
- else
+ }
+ break;
+ case STEP_SETTLE:
+ // Do we have new step pulses?
+ if (m_track_delta != 0) head_move();
+ else
+ {
+ // Seek completed
+ if (!m_recalibrated)
{
- // need to move the head again
- head_move();
+ m_ready = true;
+ m_recalibrated = true;
+ LOGMASKED(LOG_CONFIG, "Spinup complete, drive recalibrated and positioned at cylinder %d; drive is READY\n", m_current_cylinder);
+ if (!m_ready_cb.isnull()) m_ready_cb(this, ASSERT_LINE);
}
- break;
- case STEP_SETTLE:
- // Do we have new step pulses?
- if (m_track_delta != 0) head_move();
else
{
- // Seek completed
- if (!m_recalibrated)
- {
- m_ready = true;
- m_recalibrated = true;
- LOGMASKED(LOG_CONFIG, "Spinup complete, drive recalibrated and positioned at cylinder %d; drive is READY\n", m_current_cylinder);
- if (!m_ready_cb.isnull()) m_ready_cb(this, ASSERT_LINE);
- }
- else
- {
- LOGMASKED(LOG_SIGNALS, "Settling done at cylinder %d, seek complete\n", m_current_cylinder);
- }
- m_seek_complete = true;
- if (!m_seek_complete_cb.isnull()) m_seek_complete_cb(this, ASSERT_LINE);
- m_step_phase = STEP_COLLECT;
+ LOGMASKED(LOG_SIGNALS, "Settling done at cylinder %d, seek complete\n", m_current_cylinder);
}
- break;
+ m_seek_complete = true;
+ if (!m_seek_complete_cb.isnull()) m_seek_complete_cb(this, ASSERT_LINE);
+ m_step_phase = STEP_COLLECT;
}
+ break;
}
}
-void mfm_harddisk_device::recalibrate()
+TIMER_CALLBACK_MEMBER(mfm_harddisk_device::cache_update)
{
- LOGMASKED(LOG_STEPS, "Recalibrate to track 0\n");
- direction_in_w(CLEAR_LINE);
- while (-m_track_delta < m_phys_cylinders)
- {
- step_w(ASSERT_LINE);
- step_w(CLEAR_LINE);
- }
+ m_cache->write_back_one();
}
void mfm_harddisk_device::head_move()
diff --git a/src/devices/imagedev/mfmhd.h b/src/devices/imagedev/mfmhd.h
index 409c70a537c..ce66a43fa3b 100644
--- a/src/devices/imagedev/mfmhd.h
+++ b/src/devices/imagedev/mfmhd.h
@@ -118,7 +118,11 @@ protected:
virtual void device_start() override;
virtual void device_stop() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(index_timer);
+ TIMER_CALLBACK_MEMBER(recalibrate);
+ TIMER_CALLBACK_MEMBER(seek_update);
+ TIMER_CALLBACK_MEMBER(cache_update);
emu_timer *m_index_timer, *m_spinup_timer, *m_seek_timer, *m_cache_timer;
index_pulse_cb m_index_pulse_cb;
@@ -166,7 +170,6 @@ private:
mfmhd_image_format_t* m_format;
chd_file *m_chd;
void head_move();
- void recalibrate();
// Common routine for read/write
bool find_position(attotime &from_when, const attotime &limit, int &bytepos, int &bitpos);
diff --git a/src/devices/imagedev/microdrv.cpp b/src/devices/imagedev/microdrv.cpp
index aecaee95f81..02168270523 100644
--- a/src/devices/imagedev/microdrv.cpp
+++ b/src/devices/imagedev/microdrv.cpp
@@ -70,7 +70,7 @@ void microdrive_image_device::device_start()
m_right = std::make_unique<uint8_t[]>(MDV_IMAGE_LENGTH / 2);
// allocate timers
- m_bit_timer = timer_alloc();
+ m_bit_timer = timer_alloc(FUNC(microdrive_image_device::bit_timer), this);
m_bit_timer->adjust(attotime::zero, 0, attotime::from_hz(MDV_BITRATE));
m_bit_timer->enable(0);
@@ -106,7 +106,7 @@ void microdrive_image_device::call_unload()
memset(m_right.get(), 0, MDV_IMAGE_LENGTH / 2);
}
-void microdrive_image_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(microdrive_image_device::bit_timer)
{
m_bit_offset++;
diff --git a/src/devices/imagedev/microdrv.h b/src/devices/imagedev/microdrv.h
index 92432051411..5bd7d6a37da 100644
--- a/src/devices/imagedev/microdrv.h
+++ b/src/devices/imagedev/microdrv.h
@@ -60,7 +60,8 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(bit_timer);
private:
devcb_write_line m_write_comms_out;
diff --git a/src/devices/imagedev/midiin.cpp b/src/devices/imagedev/midiin.cpp
index 3c2ad7f2fa1..d75d9495026 100644
--- a/src/devices/imagedev/midiin.cpp
+++ b/src/devices/imagedev/midiin.cpp
@@ -74,7 +74,7 @@ ioport_constructor midiin_device::device_input_ports() const
void midiin_device::device_start()
{
m_input_cb.resolve_safe();
- m_timer = timer_alloc(0);
+ m_timer = timer_alloc(FUNC(midiin_device::midi_update), this);
m_midi.reset();
m_timer->enable(false);
}
@@ -91,69 +91,66 @@ void midiin_device::device_reset()
}
/*-------------------------------------------------
- device_timer
+ midi_update
-------------------------------------------------*/
-void midiin_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(midiin_device::midi_update)
{
- if (id == 0)
+ // if there's a sequence playing, that takes priority
+ midi_event *event = m_sequence.current_event();
+ if (event != nullptr)
{
- // if there's a sequence playing, that takes priority
- midi_event *event = m_sequence.current_event();
- if (event != nullptr)
+ attotime curtime = m_timer->expire();
+ if (curtime < m_sequence_start)
{
- attotime curtime = timer.expire();
- if (curtime < m_sequence_start)
- {
- // we could get called before we're supposed to start; show a countdown
- attotime delta = m_sequence_start - curtime;
- popmessage("Waiting to start MIDI playback... %d", delta.seconds());
- m_timer->adjust(std::min(delta, attotime(1, 0)));
- }
- else
+ // we could get called before we're supposed to start; show a countdown
+ attotime delta = m_sequence_start - curtime;
+ popmessage("Waiting to start MIDI playback... %d", delta.seconds());
+ m_timer->adjust(std::min(delta, attotime(1, 0)));
+ }
+ else
+ {
+ // update the playback time
+ curtime -= m_sequence_start;
+ popmessage("Playing MIDI file: %d:%02d / %d:%02d", curtime.seconds() / 60, curtime.seconds() % 60, m_sequence.duration().seconds() / 60, m_sequence.duration().seconds() % 60);
+
+ // if it's time to process the current event, do it and advance
+ if (curtime >= event->time())
{
- // update the playback time
- curtime -= m_sequence_start;
- popmessage("Playing MIDI file: %d:%02d / %d:%02d", curtime.seconds() / 60, curtime.seconds() % 60, m_sequence.duration().seconds() / 60, m_sequence.duration().seconds() % 60);
+ const u8 force_channel = m_config->read();
- // if it's time to process the current event, do it and advance
- if (curtime >= event->time())
+ for (u8 curbyte : event->data())
{
- const u8 force_channel = m_config->read();
-
- for (u8 curbyte : event->data())
- {
- if (force_channel <= 15 && curbyte >= 0x80 && curbyte < 0xf0)
- curbyte = (curbyte & 0xf0) | force_channel;
+ if (force_channel <= 15 && curbyte >= 0x80 && curbyte < 0xf0)
+ curbyte = (curbyte & 0xf0) | force_channel;
- xmit_char(curbyte);
- }
- event = m_sequence.advance_event();
+ xmit_char(curbyte);
}
-
- // if there are more events, set a timer to trigger them
- // (minimum duration 1 sec so that our playback time doesn't skip)
- if (event != nullptr)
- m_timer->adjust(std::min(event->time() - curtime, attotime(1, 0)));
- else
- popmessage("End of MIDI file");
+ event = m_sequence.advance_event();
}
+
+ // if there are more events, set a timer to trigger them
+ // (minimum duration 1 sec so that our playback time doesn't skip)
+ if (event != nullptr)
+ m_timer->adjust(std::min(event->time() - curtime, attotime(1, 0)));
+ else
+ popmessage("End of MIDI file");
}
- else if (m_midi)
+ }
+ else if (m_midi)
+ {
+ uint8_t buf[8192*4];
+ int bytesRead;
+
+ while (m_midi->poll())
{
- uint8_t buf[8192*4];
- int bytesRead;
+ bytesRead = m_midi->read(buf);
- while (m_midi->poll())
+ if (bytesRead > 0)
{
- bytesRead = m_midi->read(buf);
-
- if (bytesRead > 0)
+ for (int i = 0; i < bytesRead; i++)
{
- for (int i = 0; i < bytesRead; i++)
- {
- xmit_char(buf[i]);
- }
+ xmit_char(buf[i]);
}
}
}
diff --git a/src/devices/imagedev/midiin.h b/src/devices/imagedev/midiin.h
index 22cc81f7238..3d39a88c845 100644
--- a/src/devices/imagedev/midiin.h
+++ b/src/devices/imagedev/midiin.h
@@ -50,12 +50,12 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
// serial overrides
virtual void tra_complete() override; // Tx completed sending byte
virtual void tra_callback() override; // Tx send bit
+ TIMER_CALLBACK_MEMBER(midi_update);
+
private:
static const int XMIT_RING_SIZE = (8192*4*4);
diff --git a/src/devices/imagedev/snapquik.cpp b/src/devices/imagedev/snapquik.cpp
index 1940fc7a834..53c682827ea 100644
--- a/src/devices/imagedev/snapquik.cpp
+++ b/src/devices/imagedev/snapquik.cpp
@@ -64,7 +64,7 @@ void snapshot_image_device::device_start()
m_load.resolve();
/* allocate a timer */
- m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(snapshot_image_device::process_snapshot_or_quickload),this));
+ m_timer = timer_alloc(FUNC(snapshot_image_device::process_snapshot_or_quickload), this);
}
/*-------------------------------------------------
diff --git a/src/devices/machine/53c7xx.cpp b/src/devices/machine/53c7xx.cpp
index a99b9d797cb..754d2714909 100644
--- a/src/devices/machine/53c7xx.cpp
+++ b/src/devices/machine/53c7xx.cpp
@@ -113,7 +113,7 @@ void ncr53c7xx_device::device_start()
m_host_read.resolve_safe(0);
m_host_write.resolve_safe();
- m_tm = timer_alloc(0);
+ m_tm = timer_alloc(FUNC(ncr53c7xx_device::step_timer), this);
// The SCRIPTS processor runs at ~2 MIPS so approximate this
set_unscaled_clock(2000000);
@@ -757,11 +757,11 @@ void ncr53c7xx_device::recv_byte()
//-------------------------------------------------
-// device_timer - callback to step the SCSI
+// step_timer - callback to step the SCSI
// state machine
//-------------------------------------------------
-void ncr53c7xx_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(ncr53c7xx_device::step_timer)
{
step(true);
}
diff --git a/src/devices/machine/53c7xx.h b/src/devices/machine/53c7xx.h
index 4abefb15403..2d6c695acd2 100644
--- a/src/devices/machine/53c7xx.h
+++ b/src/devices/machine/53c7xx.h
@@ -35,9 +35,10 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void execute_run() override;
+ TIMER_CALLBACK_MEMBER(step_timer);
+
int m_icount;
private:
diff --git a/src/devices/machine/64h156.cpp b/src/devices/machine/64h156.cpp
index 29e343521c1..bf859402e55 100644
--- a/src/devices/machine/64h156.cpp
+++ b/src/devices/machine/64h156.cpp
@@ -92,7 +92,7 @@ void c64h156_device::device_start()
m_write_byte.resolve_safe();
// allocate timer
- t_gen = timer_alloc(0);
+ t_gen = timer_alloc(FUNC(c64h156_device::update_tick), this);
// register for state saving
save_item(NAME(m_mtr));
@@ -130,10 +130,10 @@ void c64h156_device::device_reset()
//-------------------------------------------------
-// device_timer - handler timer events
+// update_tick - pump the device life cycle
//-------------------------------------------------
-void c64h156_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(c64h156_device::update_tick)
{
live_sync();
live_run();
diff --git a/src/devices/machine/64h156.h b/src/devices/machine/64h156.h
index b5ee42035d1..0f6508caab6 100644
--- a/src/devices/machine/64h156.h
+++ b/src/devices/machine/64h156.h
@@ -108,7 +108,8 @@ protected:
virtual void device_start() override;
virtual void device_clock_changed() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(update_tick);
private:
enum {
diff --git a/src/devices/machine/6522via.cpp b/src/devices/machine/6522via.cpp
index 81817bbbbcb..12f4a918be4 100644
--- a/src/devices/machine/6522via.cpp
+++ b/src/devices/machine/6522via.cpp
@@ -267,12 +267,12 @@ void via6522_device::device_start()
m_sr = 0;
m_time2 = m_time1 = machine().time();
- m_t1 = timer_alloc(TIMER_T1);
- m_t2 = timer_alloc(TIMER_T2);
- m_ca2_timer = timer_alloc(TIMER_CA2);
- m_cb2_timer = timer_alloc(TIMER_CB2);
- m_shift_timer = timer_alloc(TIMER_SHIFT);
- m_shift_irq_timer = timer_alloc(TIMER_SHIFT_IRQ);
+ m_t1 = timer_alloc(FUNC(via6522_device::t1_tick), this);
+ m_t2 = timer_alloc(FUNC(via6522_device::t2_tick), this);
+ m_ca2_timer = timer_alloc(FUNC(via6522_device::ca2_tick), this);
+ m_cb2_timer = machine().scheduler().timer_alloc(timer_expired_delegate());
+ m_shift_timer = timer_alloc(FUNC(via6522_device::shift_tick), this);
+ m_shift_irq_timer = timer_alloc(FUNC(via6522_device::shift_irq_tick), this);
/* save state register */
save_item(NAME(m_in_a));
@@ -426,7 +426,7 @@ void via6522_device::clear_int(int data)
/*-------------------------------------------------
- via_shift
+ shift_out
-------------------------------------------------*/
void via6522_device::shift_out()
@@ -480,81 +480,83 @@ void via6522_device::shift_in()
m_shift_counter = (m_shift_counter - 1) & 0x0f; // Count all edges
}
-void via6522_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(via6522_device::shift_irq_tick)
{
- switch (id)
+ // This timer event is a delayed IRQ for improved cycle accuracy
+ set_int(INT_SR); // triggered from shift_in or shift_out on the last rising edge
+ m_shift_irq_timer->adjust(attotime::never); // Not needed really...
+}
+
+TIMER_CALLBACK_MEMBER(via6522_device::shift_tick)
+{
+ LOGSHIFT("SHIFT timer event CB1 %s edge, %d\n", m_out_cb1 & 1 ? "falling" : "raising", m_shift_counter);
+ m_out_cb1 ^= 1;
+ m_cb1_handler(m_out_cb1);
+
+ // we call shift methods for all edges
+ if (SO_T2_RATE(m_acr) || SO_T2_CONTROL(m_acr) || SO_O2_CONTROL(m_acr))
{
- case TIMER_SHIFT_IRQ: // This timer event is a delayed IRQ for improved cycle accuracy
- set_int(INT_SR); // triggered from shift_in or shift_out on the last rising edge
- m_shift_irq_timer->adjust(attotime::never); // Not needed really...
- break;
- case TIMER_SHIFT:
- LOGSHIFT("SHIFT timer event CB1 %s edge, %d\n", m_out_cb1 & 1 ? "falling" : "raising", m_shift_counter);
- m_out_cb1 ^= 1;
- m_cb1_handler(m_out_cb1);
+ shift_out();
+ }
+ else if (SI_T2_CONTROL(m_acr) || SI_O2_CONTROL(m_acr))
+ {
+ shift_in();
+ }
- // we call shift methods for all edges
- if (SO_T2_RATE(m_acr) || SO_T2_CONTROL(m_acr) || SO_O2_CONTROL(m_acr))
- {
- shift_out();
- }
- else if (SI_T2_CONTROL(m_acr) || SI_O2_CONTROL(m_acr))
- {
- shift_in();
- }
+ // If in continous mode or the shifter is still shifting we re-arm the timer
+ if (SO_T2_RATE(m_acr) || (m_shift_counter < 0x0f))
+ {
+ if (SI_O2_CONTROL(m_acr) || SO_O2_CONTROL(m_acr))
+ {
+ m_shift_timer->adjust(clocks_to_attotime(1));
+ }
+ else if (SO_T2_RATE(m_acr) || SO_T2_CONTROL(m_acr) || SI_T2_CONTROL(m_acr))
+ {
+ m_shift_timer->adjust(clocks_to_attotime(m_t2ll + 2) / 2);
+ }
+ else // otherwise we stop it
+ {
+ m_shift_timer->adjust(attotime::never);
+ }
+ }
+}
- // If in continous mode or the shifter is still shifting we re-arm the timer
- if (SO_T2_RATE(m_acr) || (m_shift_counter < 0x0f))
- {
- if (SI_O2_CONTROL(m_acr) || SO_O2_CONTROL(m_acr))
- {
- m_shift_timer->adjust(clocks_to_attotime(1));
- }
- else if (SO_T2_RATE(m_acr) || SO_T2_CONTROL(m_acr) || SI_T2_CONTROL(m_acr))
- {
- m_shift_timer->adjust(clocks_to_attotime(m_t2ll + 2) / 2);
- }
- else // otherwise we stop it
- {
- m_shift_timer->adjust(attotime::never);
- }
- }
- break;
- case TIMER_T1:
- if (T1_CONTINUOUS (m_acr))
- {
- m_t1_pb7 = !m_t1_pb7;
- m_t1->adjust(clocks_to_attotime(TIMER1_VALUE + IFR_DELAY));
- }
- else
- {
- m_t1_pb7 = 1;
- m_t1_active = 0;
- m_time1 = machine().time();
- }
+TIMER_CALLBACK_MEMBER(via6522_device::t1_tick)
+{
+ if (T1_CONTINUOUS (m_acr))
+ {
+ m_t1_pb7 = !m_t1_pb7;
+ m_t1->adjust(clocks_to_attotime(TIMER1_VALUE + IFR_DELAY));
+ }
+ else
+ {
+ m_t1_pb7 = 1;
+ m_t1_active = 0;
+ m_time1 = machine().time();
+ }
- if (T1_SET_PB7(m_acr))
- {
- output_pb();
- }
+ if (T1_SET_PB7(m_acr))
+ {
+ output_pb();
+ }
- LOGINT("T1 INT request ");
- set_int(INT_T1);
- break;
+ LOGINT("T1 INT request ");
+ set_int(INT_T1);
+}
- case TIMER_T2:
- m_t2_active = 0;
- m_time2 = machine().time();
+TIMER_CALLBACK_MEMBER(via6522_device::t2_tick)
+{
+ m_t2_active = 0;
+ m_time2 = machine().time();
- LOGINT("T2 INT request ");
- set_int(INT_T2);
- break;
+ LOGINT("T2 INT request ");
+ set_int(INT_T2);
+}
- case TIMER_CA2:
- m_out_ca2 = 1;
- m_ca2_handler(m_out_ca2);
- break;
- }
+TIMER_CALLBACK_MEMBER(via6522_device::ca2_tick)
+{
+ m_out_ca2 = 1;
+ m_ca2_handler(m_out_ca2);
}
uint8_t via6522_device::input_pa()
diff --git a/src/devices/machine/6522via.h b/src/devices/machine/6522via.h
index c31c8fbbff2..813a74a63d5 100644
--- a/src/devices/machine/6522via.h
+++ b/src/devices/machine/6522via.h
@@ -123,17 +123,14 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
-private:
- static constexpr device_timer_id TIMER_SHIFT = 0;
- static constexpr device_timer_id TIMER_T1 = 1;
- static constexpr device_timer_id TIMER_T2 = 2;
- static constexpr device_timer_id TIMER_CA2 = 3;
- static constexpr device_timer_id TIMER_SHIFT_IRQ = 4;
- static constexpr device_timer_id TIMER_CB2 = 5;
+ TIMER_CALLBACK_MEMBER(shift_irq_tick);
+ TIMER_CALLBACK_MEMBER(shift_tick);
+ TIMER_CALLBACK_MEMBER(t1_tick);
+ TIMER_CALLBACK_MEMBER(t2_tick);
+ TIMER_CALLBACK_MEMBER(ca2_tick);
+private:
uint16_t get_counter1_value();
void counter2_decrement();
diff --git a/src/devices/machine/6532riot.cpp b/src/devices/machine/6532riot.cpp
index 4afac5fcd2a..cdeb8e673af 100644
--- a/src/devices/machine/6532riot.cpp
+++ b/src/devices/machine/6532riot.cpp
@@ -114,7 +114,7 @@ uint8_t riot6532_device::get_timer()
-void riot6532_device::timer_end()
+TIMER_CALLBACK_MEMBER(riot6532_device::timer_end)
{
assert(m_timerstate != TIMER_IDLE);
@@ -450,7 +450,7 @@ void riot6532_device::device_start()
m_irq_cb.resolve_safe();
/* allocate timers */
- m_timer = timer_alloc(TIMER_END_CB);
+ m_timer = timer_alloc(FUNC(riot6532_device::timer_end), this);
/* register for save states */
save_item(NAME(m_port[0].m_in));
@@ -501,15 +501,3 @@ void riot6532_device::device_reset()
m_timerstate = TIMER_COUNTING;
m_timer->adjust(attotime::from_ticks(256 << m_timershift, clock()));
}
-
-void riot6532_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_END_CB:
- timer_end();
- break;
- default:
- throw emu_fatalerror("Unknown id in riot6532_device::device_timer");
- }
-}
diff --git a/src/devices/machine/6532riot.h b/src/devices/machine/6532riot.h
index a14de90483a..56156f929c3 100644
--- a/src/devices/machine/6532riot.h
+++ b/src/devices/machine/6532riot.h
@@ -64,8 +64,6 @@ public:
uint8_t porta_out_get();
uint8_t portb_out_get();
- void timer_end();
-
protected:
class riot6532_port
{
@@ -80,10 +78,10 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_post_load() override { }
virtual void device_clock_changed() override { }
+ TIMER_CALLBACK_MEMBER(timer_end);
private:
void update_irqstate();
@@ -91,29 +89,24 @@ private:
void update_pa7_state();
uint8_t get_timer();
- riot6532_port m_port[2];
+ riot6532_port m_port[2];
- devcb_read8 m_in_pa_cb;
- devcb_write8 m_out_pa_cb;
- devcb_read8 m_in_pb_cb;
- devcb_write8 m_out_pb_cb;
- devcb_write_line m_irq_cb;
+ devcb_read8 m_in_pa_cb;
+ devcb_write8 m_out_pa_cb;
+ devcb_read8 m_in_pb_cb;
+ devcb_write8 m_out_pb_cb;
+ devcb_write_line m_irq_cb;
uint8_t m_irqstate;
uint8_t m_irqenable;
- int m_irq;
+ int m_irq;
uint8_t m_pa7dir; /* 0x80 = high-to-low, 0x00 = low-to-high */
uint8_t m_pa7prev;
uint8_t m_timershift;
uint8_t m_timerstate;
- emu_timer * m_timer;
-
- enum
- {
- TIMER_END_CB
- };
+ emu_timer * m_timer;
};
diff --git a/src/devices/machine/68230pit.cpp b/src/devices/machine/68230pit.cpp
index 0512464a3ab..d5aeafd4c76 100644
--- a/src/devices/machine/68230pit.cpp
+++ b/src/devices/machine/68230pit.cpp
@@ -24,12 +24,11 @@
#include "emu.h"
#include "68230pit.h"
-#define LOG_GENERAL 0x01
-#define LOG_SETUP 0x02
-#define LOG_READ 0x04
-#define LOG_BIT 0x08
-#define LOG_DR 0x10
-#define LOG_INT 0x20
+#define LOG_SETUP (1U << 1)
+#define LOG_READ (1U << 2)
+#define LOG_BIT (1U << 3)
+#define LOG_DR (1U << 4)
+#define LOG_INT (1U << 5)
#define VERBOSE 0 //(LOG_SETUP | LOG_GENERAL | LOG_INT | LOG_BIT | LOG_DR)
#include "logmacro.h"
@@ -40,12 +39,6 @@
#define LOGDR(...) LOGMASKED(LOG_DR, __VA_ARGS__)
#define LOGINT(...) LOGMASKED(LOG_INT, __VA_ARGS__)
-#ifdef _MSC_VER
-#define FUNCNAME __func__
-#else
-#define FUNCNAME __PRETTY_FUNCTION__
-#endif
-
//**************************************************************************
// DEVICE TYPE DEFINITIONS
//**************************************************************************
@@ -102,9 +95,9 @@ pit68230_device::pit68230_device(const machine_config &mconfig, const char *tag,
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
-void pit68230_device::device_start ()
+void pit68230_device::device_start()
{
- LOGSETUP("%s\n", FUNCNAME);
+ LOGSETUP("pit68230_device::device_start\n");
// NOTE:
// Not using resolve_safe for the m_px_in_cb's is a temporary way to be able to check
@@ -132,7 +125,7 @@ void pit68230_device::device_start ()
m_pirq_out_cb.resolve_safe();
// Timers
- pit_timer = timer_alloc(TIMER_ID_PIT);
+ pit_timer = timer_alloc(FUNC(pit68230_device::tick_clock), this);
// state saving
save_item(NAME(m_pgcr));
@@ -157,9 +150,9 @@ void pit68230_device::device_start ()
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
-void pit68230_device::device_reset ()
+void pit68230_device::device_reset()
{
- LOGSETUP("%s %s \n",tag(), FUNCNAME);
+ LOGSETUP("pit68230_device::device_reset %s\n", tag());
m_pgcr = 0;
m_psrr = 0;
@@ -176,7 +169,7 @@ void pit68230_device::device_reset ()
m_tcr = 0;
m_tivr = 0x0f; m_tirq_out_cb(CLEAR_LINE);
m_tsr = 0;
- LOGSETUP("%s %s DONE!\n",tag(), FUNCNAME);
+ LOGSETUP("pit68230_device::device_reset %s DONE!\n",tag());
}
/*
@@ -184,7 +177,7 @@ void pit68230_device::device_reset ()
*/
uint8_t pit68230_device::irq_piack()
{
- LOGINT("%s %s <- %02x\n",tag(), FUNCNAME, m_pivr);
+ LOGINT("%s pit68230_device::irq_piack <- %02x\n",tag(), m_pivr);
return m_pivr;
}
@@ -193,7 +186,7 @@ uint8_t pit68230_device::irq_piack()
*/
uint8_t pit68230_device::irq_tiack()
{
- LOGINT("%s %s <- %02x\n",tag(), FUNCNAME, m_tivr);
+ LOGINT("%s pit68230_device::irq_tiack <- %02x\n", tag(), m_tivr);
return m_tivr;
}
@@ -203,13 +196,13 @@ uint8_t pit68230_device::irq_tiack()
*/
void pit68230_device::trigger_interrupt(int source)
{
- LOGINT("%s %s Source: %02x\n",tag(), FUNCNAME, source);
+ LOGINT("%s pit68230_device::trigger_interrupt Source: %02x\n", tag(), source);
if (source == INT_TIMER)
{
// TODO: implement priorities and support nested interrupts
- if ( (m_tcr & REG_TCR_TOUT_TIACK_MASK) == REG_TCR_TOUT_TIACK_INT ||
- (m_tcr & REG_TCR_TOUT_TIACK_MASK) == REG_TCR_TOUT_PC7_INT )
+ if ((m_tcr & REG_TCR_TOUT_TIACK_MASK) == REG_TCR_TOUT_TIACK_INT ||
+ (m_tcr & REG_TCR_TOUT_TIACK_MASK) == REG_TCR_TOUT_PC7_INT)
{
m_tirq_out_cb(ASSERT_LINE);
}
@@ -221,7 +214,7 @@ void pit68230_device::trigger_interrupt(int source)
}
}
-void pit68230_device::tick_clock()
+TIMER_CALLBACK_MEMBER(pit68230_device::tick_clock)
{
if (m_tcr & REG_TCR_TIMER_ENABLE)
{
@@ -238,25 +231,9 @@ void pit68230_device::tick_clock()
}
}
-//-------------------------------------------------
-// device_timer - handler timer events
-//-------------------------------------------------
-void pit68230_device::device_timer (emu_timer &timer, device_timer_id id, int param)
-{
- switch(id)
- {
- case TIMER_ID_PIT:
- tick_clock();
- break;
- default:
- LOG("Unhandled Timer ID %d\n", id);
- break;
- }
-}
-
WRITE_LINE_MEMBER( pit68230_device::h1_w )
{
- LOGBIT("%s %s H1 set to %d\n", tag(), FUNCNAME, state);
+ LOGBIT("%s pit68230_device::h1_w H1 set to %d\n", tag(), state);
// Set the direct level in PSR
m_psr = ((state == 0) ? (m_psr & ~REG_PSR_H1L) : (m_psr | REG_PSR_H1L));
@@ -270,7 +247,7 @@ WRITE_LINE_MEMBER( pit68230_device::h1_w )
WRITE_LINE_MEMBER( pit68230_device::h2_w )
{
- LOGBIT("%s %s H2 set to %d\n", tag(), FUNCNAME, state);
+ LOGBIT("%s pit68230_device::h2_w H2 set to %d\n", tag(), state);
// Set the direct level in PSR
m_psr = ((state == 0) ? (m_psr & ~REG_PSR_H2L) : (m_psr | REG_PSR_H2L));
@@ -284,7 +261,7 @@ WRITE_LINE_MEMBER( pit68230_device::h2_w )
WRITE_LINE_MEMBER( pit68230_device::h3_w )
{
- LOGBIT("%s %s H3 set to %d\n", tag(), FUNCNAME, state);
+ LOGBIT("%s pit68230_device::h3_w H3 set to %d\n", tag(), state);
// Set the direct level in PSR
m_psr = ((state == 0) ? (m_psr & ~REG_PSR_H3L) : (m_psr | REG_PSR_H3L));
@@ -298,7 +275,7 @@ WRITE_LINE_MEMBER( pit68230_device::h3_w )
WRITE_LINE_MEMBER( pit68230_device::h4_w )
{
- LOGBIT("%s %s H4 set to %d\n", tag(), FUNCNAME, state);
+ LOGBIT("%s pit68230_device::h4_w H4 set to %d\n", tag(), state);
// Set the direct level in PSR
m_psr = ((state == 0) ? (m_psr & ~REG_PSR_H4L) : (m_psr | REG_PSR_H4L));
@@ -313,14 +290,17 @@ WRITE_LINE_MEMBER( pit68230_device::h4_w )
// TODO: remove this method and replace it with a call to pb_update_bit() in force68k.cpp
void pit68230_device::portb_setbit(uint8_t bit, uint8_t state)
{
- if (state) m_pbdr |= (1 << bit); else m_pbdr &= ~(1 << bit);
+ if (state)
+ m_pbdr |= (1 << bit);
+ else
+ m_pbdr &= ~(1 << bit);
}
void pit68230_device::pa_update_bit(uint8_t bit, uint8_t state)
{
- LOGBIT("%s %s bit %d to %d\n", tag(), FUNCNAME, bit, state);
+ LOGBIT("%s pit68230_device::pa_update_bit bit %d to %d\n", tag(), bit, state);
// Check if requested bit is an output bit and can't be affected
- if (m_paddr & (1 << bit))
+ if (BIT(m_paddr, bit))
{
LOG("- 68230 PIT: tried to set input bit at port A that is programmed as output!\n");
return;
@@ -339,9 +319,9 @@ void pit68230_device::pa_update_bit(uint8_t bit, uint8_t state)
void pit68230_device::pb_update_bit(uint8_t bit, uint8_t state)
{
- LOGBIT("%s %s bit %d to %d\n",tag(), FUNCNAME, bit, state);
+ LOGBIT("%s pit68230_device::pb_update_bit bit %d to %d\n", tag(), bit, state);
// Check if requested bit is an output bit and can't be affected
- if (m_pbddr & (1 << bit))
+ if (BIT(m_pbddr, bit))
{
LOG("- 68230 PIT: tried to set input bit at port B that is programmed as output!\n");
return;
@@ -361,9 +341,9 @@ void pit68230_device::pb_update_bit(uint8_t bit, uint8_t state)
// TODO: Make sure port C is in the right alternate mode
void pit68230_device::pc_update_bit(uint8_t bit, uint8_t state)
{
- LOGBIT("%s %s bit %d to %d\n",tag(), FUNCNAME, bit, state);
+ LOGBIT("%s pit68230_device::pc_update_bit bit %d to %d\n", tag(), bit, state);
// Check if requested bit is an output bit and can't be affected
- if (m_pcddr & (1 << bit))
+ if (BIT(m_pcddr, bit))
{
LOG("- 68230 PIT: tried to set input bit at port C that is programmed as output!\n");
return;
@@ -385,7 +365,7 @@ void pit68230_device::update_tin(uint8_t state)
// Tick clock on falling edge. TODO: check what flank is correct
if (state == CLEAR_LINE)
{
- tick_clock();
+ tick_clock(0);
}
pc_update_bit(REG_PCDR_TIN_BIT, state == ASSERT_LINE ? 0 : 1);
@@ -399,9 +379,9 @@ static int32_t ow_ofs = 0;
void pit68230_device::wr_pitreg_pgcr(uint8_t data)
{
- LOG("%s(%02x) \"%s\": %s - %02x\n", FUNCNAME, data, tag(), FUNCNAME, data);
- LOGSETUP("PGCR - Mode %d,", (data >> 6) & 3 );
- LOGSETUP(" H34:%s, H12:%s,", (data & 0x20) ? "enabled" : "disabled", (data & 0x10) ? "enabled" : "disabled" );
+ LOG("pit68230_device::wr_pitreg_pgcr(%02x) \"%s\": pit68230_device::wr_pitreg_pgcr - %02x\n", data, tag(), data);
+ LOGSETUP("PGCR - Mode %d,", (data >> 6) & 3);
+ LOGSETUP(" H34:%s, H12:%s,", (data & 0x20) ? "enabled" : "disabled", (data & 0x10) ? "enabled" : "disabled");
LOGSETUP(" Sense assert H4:%s, H3:%s, H2:%s, H1:%s\n",
data & 0x04 ? "Hi" : "Lo", data & 0x03 ? "Hi" : "Lo",
data & 0x02 ? "Hi" : "Lo", data & 0x01 ? "Hi" : "Lo");
@@ -410,18 +390,18 @@ void pit68230_device::wr_pitreg_pgcr(uint8_t data)
void pit68230_device::wr_pitreg_psrr(uint8_t data)
{
- LOG("%s(%02x) \"%s\": %s - %02x\n", FUNCNAME, data, tag(), FUNCNAME, data);
+ LOG("pit68230_device::wr_pitreg_psrr(%02x) \"%s\": pit68230_device::wr_pitreg_psrr - %02x\n", data, tag(), data);
LOGSETUP("PSSR - %s pin activated,", data & 0x40 ? "DMA" : "PC4");
LOGSETUP(" %s pin support %s interrupts,", data & 0x80 ? "PIRQ" : "PC5",
- data & 0x08 ? "no" : (data & 0x10 ? "vectored" : "autovectored" ) );
- LOGSETUP(" H prio mode:%d\n", data & 0x03 );
+ data & 0x08 ? "no" : (data & 0x10 ? "vectored" : "autovectored"));
+ LOGSETUP(" H prio mode:%d\n", data & 0x03);
m_psrr = data;
}
void pit68230_device::wr_pitreg_paddr(uint8_t data)
{
- LOG("%s(%02x) \"%s\": %s - %02x\n", FUNCNAME, data, tag(), FUNCNAME, data);
+ LOG("pit68230_device::wr_pitreg_paddr(%02x) \"%s\": pit68230_device::wr_pitreg_paddr - %02x\n", data, tag(), data);
LOGSETUP("%s PADDR: %02x\n", tag(), data);
m_paddr = data;
}
@@ -434,21 +414,21 @@ void pit68230_device::wr_pitreg_pbddr(uint8_t data)
void pit68230_device::wr_pitreg_pcddr(uint8_t data)
{
- LOG("%s(%02x) \"%s\": %s - %02x\n", FUNCNAME, data, tag(), FUNCNAME, data);
+ LOG("pit68230_device::wr_pitreg_pcddr(%02x) \"%s\": pit68230_device::wr_pitreg_pcddr - %02x\n", data, tag(), data);
LOGSETUP("%s PCDDR: %02x\n", tag(), data);
m_pcddr = data;
}
void pit68230_device::wr_pitreg_pivr(uint8_t data)
{
- LOG("%s(%02x) \"%s\": %s - %02x\n", FUNCNAME, data, tag(), FUNCNAME, data);
+ LOG("pit68230_device::wr_pitreg_pivr(%02x) \"%s\": pit68230_device::wr_pitreg_pivr - %02x\n", data, tag(), data);
LOGSETUP("%s PIVR: %02x\n", tag(), data);
m_pivr = data & 0xfc; // lowest two bits are read as zero
}
void pit68230_device::wr_pitreg_pacr(uint8_t data)
{
- LOG("%s(%02x) \"%s\": %s - %02x\n", FUNCNAME, data, tag(), FUNCNAME, data);
+ LOG("pit68230_device::wr_pitreg_pacr(%02x) \"%s\": pit68230_device::wr_pitreg_pacr - %02x\n", data, tag(), data);
LOGSETUP("%s PACR", tag());
m_pacr = data;
// callbacks
@@ -471,7 +451,7 @@ void pit68230_device::wr_pitreg_pacr(uint8_t data)
{
if (m_pacr & REG_PACR_H2_CTRL_IN_OUT)
{
- switch(m_pacr & REG_PACR_H2_CTRL_MASK)
+ switch (m_pacr & REG_PACR_H2_CTRL_MASK)
{
case REG_PACR_H2_CTRL_OUT_00:
LOGSETUP(" - H2 cleared\n");
@@ -487,7 +467,7 @@ void pit68230_device::wr_pitreg_pacr(uint8_t data)
case REG_PACR_H2_CTRL_OUT_11:
LOGSETUP(" - pulsed handshake not implemented\n");
break;
- default: logerror(("Undefined H2 mode, broken driver - please report!\n"));
+ default: logerror("Undefined H2 mode %02x in pit68230_device - please report\n", m_pacr & REG_PACR_H2_CTRL_MASK);
}
}
}
@@ -501,13 +481,13 @@ void pit68230_device::wr_pitreg_pacr(uint8_t data)
// TODO add support for sense status
void pit68230_device::wr_pitreg_pbcr(uint8_t data)
{
- LOG("%s(%02x) \"%s\": %s - %02x\n", FUNCNAME, data, tag(), FUNCNAME, data);
+ LOG("pit68230_device::wr_pitreg_pbcr(%02x) \"%s\": pit68230_device::wr_pitreg_pbcr - %02x\n", data, tag(), data);
m_pbcr = data;
if ((m_pgcr & REG_PGCR_H34_ENABLE) || ((m_pbcr & REG_PBCR_SUBMODE_MASK) == REG_PBCR_SUBMODE_1X))
{
if (m_pbcr & REG_PBCR_H4_CTRL_IN_OUT)
{
- switch(m_pbcr & REG_PBCR_H4_CTRL_MASK)
+ switch (m_pbcr & REG_PBCR_H4_CTRL_MASK)
{
case REG_PBCR_H4_CTRL_OUT_00:
LOG(" - H4 cleared\n");
@@ -523,7 +503,7 @@ void pit68230_device::wr_pitreg_pbcr(uint8_t data)
case REG_PBCR_H4_CTRL_OUT_11:
LOGSETUP(" - pulsed handshake not implemented\n");
break;
- default: logerror(("Undefined H4 mode, broken driver - please report!\n"));
+ default: logerror("Undefined H4 mode %02x in pit68230_device - please report\n", m_pbcr & REG_PBCR_H4_CTRL_MASK);
}
}
}
@@ -536,34 +516,34 @@ void pit68230_device::wr_pitreg_pbcr(uint8_t data)
void pit68230_device::wr_pitreg_padr(uint8_t data)
{
- LOG("%s(%02x) \"%s\": %s - %02x\n", FUNCNAME, data, tag(), FUNCNAME, data);
- m_padr = (data & m_paddr);
+ LOG("pit68230_device::wr_pitreg_padr(%02x) \"%s\": pit68230_device::wr_pitreg_padr - %02x\n", data, tag(), data);
+ m_padr = data & m_paddr;
// callback
- m_pa_out_cb ((offs_t)0, m_padr);
+ m_pa_out_cb(m_padr);
}
void pit68230_device::wr_pitreg_pbdr(uint8_t data)
{
- LOG("%s(%02x) \"%s\": %s - %02x\n", FUNCNAME, data, tag(), FUNCNAME, data);
- m_pbdr = (data & m_pbddr);
+ LOG("pit68230_device::wr_pitreg_pbdr(%02x) \"%s\": pit68230_device::wr_pitreg_pbdr - %02x\n", data, tag(), data);
+ m_pbdr = data & m_pbddr;
// callback
- m_pb_out_cb ((offs_t)0, m_pbdr & m_pbddr);
+ m_pb_out_cb(m_pbdr & m_pbddr);
}
void pit68230_device::wr_pitreg_pcdr(uint8_t data)
{
- LOG("%s(%02x) \"%s\": %s - %02x\n", FUNCNAME, data, tag(), FUNCNAME, data);
- m_pcdr = (data & m_pcddr);
+ LOG("pit68230_device::wr_pitreg_pcdr(%02x) \"%s\": pit68230_device::wr_pitreg_pcdr - %02x\n", data, tag(), data);
+ m_pcdr = data & m_pcddr;
// callback
- m_pc_out_cb ((offs_t)0, m_pcdr);
+ m_pc_out_cb(m_pcdr);
}
void pit68230_device::wr_pitreg_psr(uint8_t data)
{
- LOG("%s(%02x) \"%s\": %s - %02x\n", FUNCNAME, data, tag(), FUNCNAME, data);
+ LOG("pit68230_device::wr_pitreg_psr(%02x) \"%s\": pit68230_device::wr_pitreg_psr - %02x\n", data, tag(), data);
m_psr = data;
}
@@ -639,7 +619,7 @@ void pit68230_device::wr_pitreg_tcr(uint8_t data)
int pen = 0;
//int sqr = 0;
- LOG("%s(%02x) %s\n", FUNCNAME, data, tag());
+ LOG("pit68230_device::wr_pitreg_tcr(%02x) %s\n", data, tag());
m_tcr = data;
switch (m_tcr & REG_TCR_TOUT_TIACK_MASK)
{
@@ -674,46 +654,46 @@ void pit68230_device::wr_pitreg_tcr(uint8_t data)
if (clk == 1)
{
int rate = clock() / (psc == 1 ? 32 : 1);
- pit_timer->adjust(attotime::from_hz(rate), TIMER_ID_PIT, attotime::from_hz(rate));
+ pit_timer->adjust(attotime::from_hz(rate), 0, attotime::from_hz(rate));
LOG("PIT timer started @ rate: %d and CLK: %d,\n", rate, clock());
}
}
else
{
- pit_timer->adjust(attotime::never, TIMER_ID_PIT, attotime::never);
+ pit_timer->adjust(attotime::never, 0, attotime::never);
}
}
void pit68230_device::wr_pitreg_tivr(uint8_t data)
{
- LOG("%s(%02x) \"%s\": \n", FUNCNAME, data, tag());
+ LOG("pit68230_device::wr_pitreg_tivr(%02x) \"%s\": \n", data, tag());
m_tivr = data;
}
void pit68230_device::wr_pitreg_cprh(uint8_t data)
{
- LOG("%s(%02x) \"%s\": %s - %02x\n", FUNCNAME, data, tag(), FUNCNAME, data);
+ LOG("pit68230_device::wr_pitreg_cprh(%02x) \"%s\": pit68230_device::wr_pitreg_cprh - %02x\n", data, tag(), data);
m_cpr &= ~0xff0000;
m_cpr |= ((data << 16) & 0xff0000);
}
void pit68230_device::wr_pitreg_cprm(uint8_t data)
{
- LOG("%s(%02x) \"%s\": %s - %02x\n", FUNCNAME, data, tag(), FUNCNAME, data);
+ LOG("pit68230_device::wr_pitreg_cprm(%02x) \"%s\": pit68230_device::wr_pitreg_cprm - %02x\n", data, tag(), data);
m_cpr &= ~0x00ff00;
m_cpr |= ((data << 8) & 0x00ff00);
}
void pit68230_device::wr_pitreg_cprl(uint8_t data)
{
- LOG("%s(%02x) \"%s\": %s - %02x\n", FUNCNAME, data, tag(), FUNCNAME, data);
+ LOG("pit68230_device::wr_pitreg_cprl(%02x) \"%s\": pit68230_device::wr_pitreg_cprl - %02x\n", data, tag(), data);
m_cpr &= ~0x0000ff;
- m_cpr |= ((data << 0) & 0x0000ff);
+ m_cpr |= data & 0x0000ff;
}
void pit68230_device::wr_pitreg_tsr(uint8_t data)
{
- LOG("%s(%02x) \"%s\": \n", FUNCNAME, data, tag());
+ LOG("pit68230_device::wr_pitreg_tsr(%02x) \"%s\": \n", data, tag());
if (data & 1)
{
m_tsr = 0; // A write resets the TSR;
@@ -723,9 +703,10 @@ void pit68230_device::wr_pitreg_tsr(uint8_t data)
void pit68230_device::write(offs_t offset, uint8_t data)
{
- LOG("\"%s\" %s: Register write '%02x' -> [%02x]\n", tag(), FUNCNAME, data, offset );
+ LOG("\"%s\" pit68230_device::write: Register write '%02x' -> [%02x]\n", tag(), data, offset);
LOGSETUP(" * %s Reg %02x <- %02x \n", tag(), offset, data);
- switch (offset) {
+ switch (offset)
+ {
case PIT_68230_PGCR: wr_pitreg_pgcr(data); break;
case PIT_68230_PSRR: wr_pitreg_psrr(data); break;
case PIT_68230_PADDR: wr_pitreg_paddr(data); break;
@@ -754,7 +735,8 @@ void pit68230_device::write(offs_t offset, uint8_t data)
}
#if VERBOSE > 2
- if (offset != ow_ofs || data != ow_data || ow_cnt >= 1000) {
+ if (offset != ow_ofs || data != ow_data || ow_cnt >= 1000)
+ {
if (ow_cnt > 1)
{
logerror ("\npit68230_device::write: previous identical operation performed %02x times\n", ow_cnt);
@@ -778,49 +760,49 @@ static int32_t or_ofs = 0;
uint8_t pit68230_device::rr_pitreg_pgcr()
{
- LOGR("%s %s <- %02x\n",tag(), FUNCNAME, m_pgcr);
+ LOGR("%s pit68230_device::rr_pitreg_pgcr <- %02x\n", tag(), m_pgcr);
return m_pgcr;
}
uint8_t pit68230_device::rr_pitreg_psrr()
{
- LOGR("%s %s <- %02x\n",tag(), FUNCNAME, m_psrr);
+ LOGR("%s pit68230_device::rr_pitreg_psrr <- %02x\n", tag(), m_psrr);
return m_psrr & 0x7f; // mask out unused bits
}
uint8_t pit68230_device::rr_pitreg_paddr()
{
- LOGR("%s %s <- %02x\n",tag(), FUNCNAME, m_paddr);
+ LOGR("%s pit68230_device::rr_pitreg_paddr <- %02x\n", tag(), m_paddr);
return m_paddr;
}
uint8_t pit68230_device::rr_pitreg_pbddr()
{
- LOGR("%s %s <- %02x\n",tag(), FUNCNAME, m_pbddr);
+ LOGR("%s pit68230_device::rr_pitreg_pbddr <- %02x\n", tag(), m_pbddr);
return m_pbddr;
}
uint8_t pit68230_device::rr_pitreg_pcddr()
{
- LOGR("%s %s <- %02x\n",tag(), FUNCNAME, m_pcddr);
+ LOGR("%s pit68230_device::rr_pitreg_pcddr <- %02x\n", tag(), m_pcddr);
return m_pcddr;
}
uint8_t pit68230_device::rr_pitreg_pivr()
{
- LOGR("%s %s <- %02x\n",tag(), FUNCNAME, m_pivr);
+ LOGR("%s pit68230_device::rr_pitreg_pivr <- %02x\n", tag(), m_pivr);
return m_pivr;
}
uint8_t pit68230_device::rr_pitreg_pacr()
{
- LOGR("%s %s <- %02x\n",tag(), FUNCNAME, m_pacr);
+ LOGR("%s pit68230_device::rr_pitreg_pacr <- %02x\n", tag(), m_pacr);
return m_pacr;
}
uint8_t pit68230_device::rr_pitreg_pbcr()
{
- LOGR("%s %s <- %02x\n",tag(), FUNCNAME, m_pbcr);
+ LOGR("%s pit68230_device::rr_pitreg_pbcr <- %02x\n", tag(), m_pbcr);
return m_pbcr;
}
@@ -829,13 +811,13 @@ uint8_t pit68230_device::rr_pitreg_padr()
m_padr &= m_paddr;
if (!m_pa_in_cb.isnull())
{
- m_padr |= (m_pa_in_cb() & ~m_paddr);
+ m_padr |= m_pa_in_cb() & ~m_paddr;
}
else
{
- m_padr |= (m_pail & ~m_paddr);
+ m_padr |= m_pail & ~m_paddr;
}
- LOGDR("%s %s <- %02x\n",tag(), FUNCNAME, m_padr);
+ LOGDR("%s pit68230_device::rr_pitreg_padr <- %02x\n", tag(), m_padr);
return m_padr;
}
@@ -851,14 +833,14 @@ uint8_t pit68230_device::rr_pitreg_pbdr()
m_pbdr &= m_pbddr;
if (!m_pb_in_cb.isnull())
{
- m_pbdr |= (m_pb_in_cb() & ~m_pbddr);
+ m_pbdr |= m_pb_in_cb() & ~m_pbddr;
}
else
{
- m_pbdr |= (m_pbil & ~m_pbddr);
+ m_pbdr |= m_pbil & ~m_pbddr;
}
- LOGDR("%s %s <- %02x\n",tag(), FUNCNAME, m_pbdr);
+ LOGDR("%s pit68230_device::rr_pitreg_pbdr <- %02x\n", tag(), m_pbdr);
return m_pbdr;
}
@@ -868,14 +850,17 @@ uint8_t pit68230_device::rr_pitreg_pcdr()
m_pcdr &= m_pcddr;
if (!m_pc_in_cb.isnull()) // Port C has alternate functions that may set bits apart from callback
{
- m_pcdr |= (m_pc_in_cb() & ~m_pcddr);
+ m_pcdr |= m_pc_in_cb() & ~m_pcddr;
}
else
{
- m_pcdr |= (m_pcil & ~m_pcddr);
+ m_pcdr |= m_pcil & ~m_pcddr;
}
- if (m_pcdr != 0) { LOGDR("%s %s <- %02x\n",tag(), FUNCNAME, m_pcdr); }
+ if (m_pcdr != 0)
+ {
+ LOGDR("%s pit68230_device::rr_pitreg_pcdr <- %02x\n", tag(), m_pcdr);
+ }
return m_pcdr;
}
@@ -886,9 +871,8 @@ the instantaneous pin level is read and no input latching is performed except at
data bus interface. Writes to this address are answered with DTACK, but the data is ignored.*/
uint8_t pit68230_device::rr_pitreg_paar()
{
- uint8_t ret;
- ret = m_pa_in_cb.isnull() ? 0 : m_pa_in_cb();
- LOGR("%s %s <- %02x\n",tag(), FUNCNAME, ret);
+ uint8_t ret = m_pa_in_cb.isnull() ? 0 : m_pa_in_cb();
+ LOGR("%s pit68230_device::rr_pitreg_paar <- %02x\n", tag(), ret);
return ret;
}
@@ -898,9 +882,8 @@ the instantaneous pin level is read and no input latching is performed except at
data bus interface.Writes to this address are answered with DTACK, but the data is ignored.*/
uint8_t pit68230_device::rr_pitreg_pbar()
{
- uint8_t ret;
- ret = m_pb_in_cb.isnull() ? 0 : m_pb_in_cb();
- LOGR("%s %s <- %02x\n",tag(), FUNCNAME, ret);
+ uint8_t ret = m_pb_in_cb.isnull() ? 0 : m_pb_in_cb();
+ LOGR("%s pit68230_device::rr_pitreg_pbar <- %02x\n", tag(), ret);
return ret;
}
@@ -912,68 +895,70 @@ uint8_t pit68230_device::rr_pitreg_pbar()
* 3-0 a one is the active or asserted state. */
uint8_t pit68230_device::rr_pitreg_psr()
{
- LOGR("%s %s <- %02x\n",tag(), FUNCNAME, m_psr);
+ LOGR("%s pit68230_device::rr_pitreg_psr <- %02x\n", tag(), m_psr);
return m_psr;
}
uint8_t pit68230_device::rr_pitreg_tcr()
{
- LOGR("%s %s <- %02x\n",tag(), FUNCNAME, m_tcr);
+ LOGR("%s pit68230_device::rr_pitreg_tcr <- %02x\n", tag(), m_tcr);
return m_tcr;
}
uint8_t pit68230_device::rr_pitreg_tivr()
{
- LOGR("%s %s <- %02x\n",tag(), FUNCNAME, m_tivr);
+ LOGR("%s pit68230_device::rr_pitreg_tivr <- %02x\n", tag(), m_tivr);
return m_tivr;
}
uint8_t pit68230_device::rr_pitreg_cprh()
{
- LOGR("%s %s <- %02x\n",tag(), FUNCNAME, (m_cpr >> 16) & 0xff);
+ LOGR("%s pit68230_device::rr_pitreg_cprh <- %02x\n", tag(), (m_cpr >> 16) & 0xff);
return (m_cpr >> 16) & 0xff;
}
uint8_t pit68230_device::rr_pitreg_cprm()
{
- LOGR("%s %s <- %02x\n",tag(), FUNCNAME, (m_cpr >> 8) & 0xff);
+ LOGR("%s pit68230_device::rr_pitreg_cprm <- %02x\n", tag(), (m_cpr >> 8) & 0xff);
return (m_cpr >> 8) & 0xff;
}
uint8_t pit68230_device::rr_pitreg_cprl()
{
- LOGR("%s %s <- %02x\n",tag(), FUNCNAME, (m_cpr >> 0) & 0xff);
- return (m_cpr >> 0) & 0xff;
+ LOGR("%s pit68230_device::rr_pitreg_cprl <- %02x\n", tag(), m_cpr & 0xff);
+ return m_cpr & 0xff;
}
uint8_t pit68230_device::rr_pitreg_cntrh()
{
- LOGR("%s %s <- %02x\n",tag(), FUNCNAME, (m_cntr >> 16) & 0xff);
+ LOGR("%s pit68230_device::rr_pitreg_cntrh <- %02x\n", tag(), (m_cntr >> 16) & 0xff);
return (m_cntr >> 16) & 0xff;
}
uint8_t pit68230_device::rr_pitreg_cntrm()
{
- LOGR("%s %s <- %02x\n",tag(), FUNCNAME, (m_cntr >> 8) & 0xff);
+ LOGR("%s pit68230_device::rr_pitreg_cntrm <- %02x\n", tag(), (m_cntr >> 8) & 0xff);
return (m_cntr >> 8) & 0xff;
}
uint8_t pit68230_device::rr_pitreg_cntrl()
{
- LOGR("%s %s <- %02x\n",tag(), FUNCNAME, (m_cntr >> 0) & 0xff);
- return (m_cntr >> 0) & 0xff;
+ LOGR("%s pit68230_device::rr_pitreg_cntrl <- %02x\n", tag(), m_cntr & 0xff);
+ return m_cntr & 0xff;
}
uint8_t pit68230_device::rr_pitreg_tsr()
{
- LOGR("%s %s <- %02x\n",tag(), FUNCNAME, m_tsr);
+ LOGR("%s pit68230_device::rr_pitreg_tsr <- %02x\n", tag(), m_tsr);
return m_tsr;
}
-uint8_t pit68230_device::read(offs_t offset){
+uint8_t pit68230_device::read(offs_t offset)
+{
uint8_t data;
- switch (offset) {
+ switch (offset)
+ {
case PIT_68230_PGCR: data = rr_pitreg_pgcr(); break;
case PIT_68230_PSRR: data = rr_pitreg_psrr(); break;
case PIT_68230_PADDR: data = rr_pitreg_paddr(); break;
@@ -1003,12 +988,13 @@ uint8_t pit68230_device::read(offs_t offset){
}
#if VERBOSE > 2
- if (offset != or_ofs || data != or_data || or_cnt >= 1000) {
+ if (offset != or_ofs || data != or_data || or_cnt >= 1000)
+ {
LOGSETUP(" * %s Reg %02x -> %02x \n", tag(), offset, data);
if (or_cnt > 1)
{
- logerror ("\npit68230_device::read: previous identical operation performed %02x times\n", or_cnt);
- logerror (" - pit68230_device::read: offset=%02x data=%02x %s\n", offset, data, machine().describe_context());
+ logerror("\npit68230_device::read: previous identical operation performed %02x times\n", or_cnt);
+ logerror(" - pit68230_device::read: offset=%02x data=%02x %s\n", offset, data, machine().describe_context());
}
or_cnt = 0;
or_data = data;
diff --git a/src/devices/machine/68230pit.h b/src/devices/machine/68230pit.h
index 560006e3b18..f99c3e541ee 100644
--- a/src/devices/machine/68230pit.h
+++ b/src/devices/machine/68230pit.h
@@ -68,7 +68,7 @@
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
-class pit68230_device : public device_t//, public device_execute_interface
+class pit68230_device : public device_t
{
public:
// construction/destruction
@@ -272,19 +272,16 @@ protected:
REG_TCR_TOUT_PC7_INT = 0xe0, // 1 1 1
};
- void tick_clock();
-
pit68230_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint32_t variant);
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// Interrupt methods
void trigger_interrupt(int source);
- int m_icount;
+ TIMER_CALLBACK_MEMBER(tick_clock);
devcb_write8 m_pa_out_cb;
devcb_read8 m_pa_in_cb;
@@ -330,11 +327,6 @@ protected:
// Timers
emu_timer *pit_timer;
-
- enum
- {
- TIMER_ID_PIT
- };
};
// device type definition
diff --git a/src/devices/machine/68307tmu.cpp b/src/devices/machine/68307tmu.cpp
index 474dd2ef19b..8800387be64 100644
--- a/src/devices/machine/68307tmu.cpp
+++ b/src/devices/machine/68307tmu.cpp
@@ -132,12 +132,12 @@ void m68307_cpu_device::m68307_timer::init(m68307_cpu_device *device)
single_timer* tptr;
tptr = &singletimer[0];
- tptr->mametimer = device->machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(m68307_timer::timer0_callback),this));
+ tptr->mametimer = device->timer_alloc(FUNC(m68307_timer::timer0_callback), this);
tptr = &singletimer[1];
- tptr->mametimer = device->machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(m68307_timer::timer1_callback),this));
+ tptr->mametimer = device->timer_alloc(FUNC(m68307_timer::timer1_callback), this);
- wd_mametimer = device->machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(m68307_timer::wd_timer_callback),this));
+ wd_mametimer = device->timer_alloc(FUNC(m68307_timer::wd_timer_callback), this);
}
uint16_t m68307_cpu_device::m68307_timer::read_tcn(uint16_t mem_mask, int which)
diff --git a/src/devices/machine/68340sim.cpp b/src/devices/machine/68340sim.cpp
index 7e1f8457224..865a7eafc52 100644
--- a/src/devices/machine/68340sim.cpp
+++ b/src/devices/machine/68340sim.cpp
@@ -438,7 +438,7 @@ void m68340_cpu_device::start_68340_sim()
{
LOG("%s\n", FUNCNAME);
LOGCLOCK( " - Clock: %d [0x%08x]\n", clock(), clock());
- m_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(m68340_cpu_device::periodic_interrupt_timer_callback),this));
+ m_irq_timer = timer_alloc(FUNC(m68340_cpu_device::periodic_interrupt_timer_callback), this);
// resolve callbacks Port A
m_pa_out_cb.resolve_safe();
diff --git a/src/devices/machine/68340tmu.cpp b/src/devices/machine/68340tmu.cpp
index 96157eafc53..6eddadf6f94 100644
--- a/src/devices/machine/68340tmu.cpp
+++ b/src/devices/machine/68340tmu.cpp
@@ -312,7 +312,7 @@ void mc68340_timer_module_device::device_start()
m_cpu = downcast<m68340_cpu_device *>(owner());
- m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mc68340_timer_module_device::timer_callback),this));
+ m_timer = timer_alloc(FUNC(mc68340_timer_module_device::timer_callback), this);
// Resolve Timer callbacks
m_tout_out_cb.resolve_safe();
diff --git a/src/devices/machine/6840ptm.cpp b/src/devices/machine/6840ptm.cpp
index 9d37533917a..8d0039e2a92 100644
--- a/src/devices/machine/6840ptm.cpp
+++ b/src/devices/machine/6840ptm.cpp
@@ -95,9 +95,9 @@ void ptm6840_device::device_start()
m_out_cb.resolve_all_safe();
m_irq_cb.resolve_safe();
- m_timer[0] = timer_alloc(0);
- m_timer[1] = timer_alloc(1);
- m_timer[2] = timer_alloc(2);
+ m_timer[0] = timer_alloc(FUNC(ptm6840_device::timeout), this);
+ m_timer[1] = timer_alloc(FUNC(ptm6840_device::timeout), this);
+ m_timer[2] = timer_alloc(FUNC(ptm6840_device::timeout), this);
for (auto & elem : m_timer)
{
@@ -162,15 +162,6 @@ void ptm6840_device::device_resolve_objects()
m_gate[i] = 0;
}
-//-------------------------------------------------
-// device_timer - handle timer callbacks
-//-------------------------------------------------
-
-void ptm6840_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- timeout(id);
-}
-
//-------------------------------------------------
// subtract_from_counter - Subtract from Counter
@@ -246,7 +237,7 @@ void ptm6840_device::subtract_from_counter(int counter, int count)
{
duration *= m_t3_divisor;
}
- m_timer[counter]->adjust(duration);
+ m_timer[counter]->adjust(duration, counter);
}
}
@@ -429,7 +420,7 @@ void ptm6840_device::reload_count(int idx)
LOGMASKED(LOG_COUNTERS, "Timer #%d reload_count: output = %f\n", idx + 1, duration.as_double());
m_enabled[idx] = 1;
- m_timer[idx]->adjust(duration);
+ m_timer[idx]->adjust(duration, idx);
m_timer[idx]->enable(true);
}
}
@@ -606,57 +597,57 @@ void ptm6840_device::write(offs_t offset, uint8_t data)
// timeout - Called if timer is mature
//-------------------------------------------------
-void ptm6840_device::timeout(int idx)
+TIMER_CALLBACK_MEMBER(ptm6840_device::timeout)
{
- LOGMASKED(LOG_TIMEOUTS, "**ptm6840 t%d timeout**\n", idx + 1);
+ LOGMASKED(LOG_TIMEOUTS, "**ptm6840 t%d timeout**\n", param + 1);
// Set the interrupt flag
- m_status_reg |= (1 << idx);
- m_status_read_since_int &= ~(1 << idx);
+ m_status_reg |= (1 << param);
+ m_status_read_since_int &= ~(1 << param);
update_interrupts();
- if (m_control_reg[idx] & COUNT_OUT_EN)
+ if (m_control_reg[param] & COUNT_OUT_EN)
{
- switch (m_mode[idx])
+ switch (m_mode[param])
{
case 0:
case 2:
- if (m_control_reg[idx] & COUNT_MODE_8BIT)
+ if (m_control_reg[param] & COUNT_MODE_8BIT)
{
- m_hightime[idx] = !m_hightime[idx];
- m_output[idx] = m_hightime[idx];
- m_out_cb[idx](m_output[idx]);
+ m_hightime[param] = !m_hightime[param];
+ m_output[param] = m_hightime[param];
+ m_out_cb[param](m_output[param]);
}
else
{
- m_output[idx] = m_output[idx] ^ 1;
- m_out_cb[idx](m_output[idx]);
+ m_output[param] = m_output[param] ^ 1;
+ m_out_cb[param](m_output[param]);
}
- LOGMASKED(LOG_TIMEOUTS, "%6.6f: **ptm6840 t%d output %d **\n", machine().time().as_double(), idx + 1, m_output[idx]);
+ LOGMASKED(LOG_TIMEOUTS, "%6.6f: **ptm6840 t%d output %d **\n", machine().time().as_double(), param + 1, m_output[param]);
break;
case 4:
case 6:
- if (!m_fired[idx])
+ if (!m_fired[param])
{
- m_output[idx] = 1;
- LOGMASKED(LOG_TIMEOUTS, "**ptm6840 t%d output %d **\n", idx + 1, m_output[idx]);
+ m_output[param] = 1;
+ LOGMASKED(LOG_TIMEOUTS, "**ptm6840 t%d output %d **\n", param + 1, m_output[param]);
- m_out_cb[idx](m_output[idx]);
+ m_out_cb[param](m_output[param]);
// No changes in output until reinit
- m_fired[idx] = 1;
+ m_fired[param] = 1;
- m_status_reg |= (1 << idx);
- m_status_read_since_int &= ~(1 << idx);
+ m_status_reg |= (1 << param);
+ m_status_read_since_int &= ~(1 << param);
update_interrupts();
}
break;
}
}
- m_enabled[idx]= 0;
- reload_count(idx);
+ m_enabled[param]= 0;
+ reload_count(param);
}
@@ -737,7 +728,7 @@ void ptm6840_device::set_ext_clock(int counter, double clock)
}
m_enabled[counter] = 1;
- m_timer[counter]->adjust(duration);
+ m_timer[counter]->adjust(duration, counter);
m_timer[counter]->enable(true);
}
}
diff --git a/src/devices/machine/6840ptm.h b/src/devices/machine/6840ptm.h
index 249b71f0bba..99da9522c7b 100644
--- a/src/devices/machine/6840ptm.h
+++ b/src/devices/machine/6840ptm.h
@@ -59,12 +59,11 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_resolve_objects() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
private:
void subtract_from_counter(int counter, int count);
void tick(int counter, int count);
- void timeout(int idx);
+ TIMER_CALLBACK_MEMBER(timeout);
uint16_t compute_counter(int counter) const;
void reload_count(int idx);
diff --git a/src/devices/machine/74123.cpp b/src/devices/machine/74123.cpp
index 6596bf58bf3..d895a72c4e4 100644
--- a/src/devices/machine/74123.cpp
+++ b/src/devices/machine/74123.cpp
@@ -29,7 +29,8 @@ DEFINE_DEVICE_TYPE(TTL74123, ttl74123_device, "ttl74123", "74123 TTL")
ttl74123_device::ttl74123_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, TTL74123, tag, owner, clock),
- m_timer(nullptr),
+ m_clear_timer(nullptr),
+ m_output_timer(nullptr),
m_connection_type(TTL74123_NOT_GROUNDED_NO_DIODE),
m_res(1.0),
m_cap(1.0),
@@ -48,7 +49,8 @@ void ttl74123_device::device_start()
{
m_output_changed_cb.resolve_safe();
- m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ttl74123_device::clear_callback),this));
+ m_clear_timer = timer_alloc(FUNC(ttl74123_device::clear_callback), this);
+ m_output_timer = timer_alloc(FUNC(ttl74123_device::output_callback), this);
/* register for state saving */
save_item(NAME(m_a));
@@ -110,8 +112,7 @@ attotime ttl74123_device::compute_duration()
int ttl74123_device::timer_running()
{
- return (m_timer->remaining() > attotime::zero) &&
- (m_timer->remaining() != attotime::never);
+ return m_clear_timer->remaining() > attotime::zero && !m_clear_timer->remaining().is_never();
}
@@ -133,7 +134,7 @@ void ttl74123_device::set_output()
{
int output = timer_running();
- machine().scheduler().timer_set( attotime::zero, timer_expired_delegate(FUNC(ttl74123_device::output_callback ),this), output);
+ m_output_timer->adjust(attotime::zero, output);
LOG("74123: Output: %d\n", output);
}
@@ -163,9 +164,9 @@ void ttl74123_device::start_pulse()
/* retriggering, but not if we are called to quickly */
attotime delay_time = attotime(0, ATTOSECONDS_PER_SECOND * m_cap * 220);
- if(m_timer->elapsed() >= delay_time)
+ if(m_clear_timer->elapsed() >= delay_time)
{
- m_timer->adjust(duration);
+ m_clear_timer->adjust(duration);
LOG("74123: Retriggering pulse. Duration: %f\n", duration.as_double());
}
@@ -177,7 +178,7 @@ void ttl74123_device::start_pulse()
else
{
/* starting */
- m_timer->adjust(duration);
+ m_clear_timer->adjust(duration);
set_output();
@@ -206,7 +207,7 @@ WRITE_LINE_MEMBER( ttl74123_device::a_w )
// b_w - write register b data
//-------------------------------------------------
-WRITE_LINE_MEMBER( ttl74123_device::b_w)
+WRITE_LINE_MEMBER( ttl74123_device::b_w )
{
/* start/regtrigger pulse if A=LO and rising edge on B (while clear is HI) */
if (state && !m_b && !m_a && m_clear)
@@ -222,7 +223,7 @@ WRITE_LINE_MEMBER( ttl74123_device::b_w)
// clear_w - write register clear data
//-------------------------------------------------
-WRITE_LINE_MEMBER( ttl74123_device::clear_w)
+WRITE_LINE_MEMBER( ttl74123_device::clear_w )
{
/* start/regtrigger pulse if B=HI and A=LO and rising edge on clear */
if (state && !m_a && m_b && !m_clear)
@@ -231,7 +232,7 @@ WRITE_LINE_MEMBER( ttl74123_device::clear_w)
}
else if (!state) /* clear the output */
{
- m_timer->adjust(attotime::zero);
+ m_clear_timer->adjust(attotime::zero);
LOG("74123: Cleared\n");
}
@@ -243,7 +244,7 @@ WRITE_LINE_MEMBER( ttl74123_device::clear_w)
// reset_w - reset device
//-------------------------------------------------
-WRITE_LINE_MEMBER( ttl74123_device::reset_w)
+WRITE_LINE_MEMBER( ttl74123_device::reset_w )
{
set_output();
}
diff --git a/src/devices/machine/74123.h b/src/devices/machine/74123.h
index bdff8d29aee..1aeed9d3ef7 100644
--- a/src/devices/machine/74123.h
+++ b/src/devices/machine/74123.h
@@ -107,7 +107,8 @@ private:
void set_output();
attotime compute_duration();
- emu_timer *m_timer;
+ emu_timer *m_clear_timer;
+ emu_timer *m_output_timer;
int m_connection_type; /* the hook up type - one of the constants above */
double m_res; /* resistor connected to RCext */
double m_cap; /* capacitor connected to Cext and RCext */
diff --git a/src/devices/machine/8042kbdc.cpp b/src/devices/machine/8042kbdc.cpp
index cfc2a0f6e0f..6c918c172cb 100644
--- a/src/devices/machine/8042kbdc.cpp
+++ b/src/devices/machine/8042kbdc.cpp
@@ -80,7 +80,7 @@ void kbdc8042_device::device_start()
m_speaker = 0;
m_offset1 = 0;
- m_update_timer = timer_alloc(TIMER_UPDATE);
+ m_update_timer = timer_alloc(FUNC(kbdc8042_device::update_timer), this);
m_update_timer->adjust(attotime::never);
}
@@ -223,14 +223,11 @@ void kbdc8042_device::at_8042_clear_keyboard_received()
m_mouse.received = 0;
}
-void kbdc8042_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(kbdc8042_device::update_timer)
{
- if (id == TIMER_UPDATE)
- {
- at_8042_check_keyboard();
- if (m_mouse.on)
- at_8042_check_mouse();
- }
+ at_8042_check_keyboard();
+ if (m_mouse.on)
+ at_8042_check_mouse();
}
void kbdc8042_device::mouse_enqueue(uint8_t value)
diff --git a/src/devices/machine/8042kbdc.h b/src/devices/machine/8042kbdc.h
index 698a521a9f0..64a45c8993a 100644
--- a/src/devices/machine/8042kbdc.h
+++ b/src/devices/machine/8042kbdc.h
@@ -64,12 +64,11 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_add_mconfig(machine_config &config) override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual ioport_constructor device_input_ports() const override;
- void mouse_enqueue(uint8_t value);
+ TIMER_CALLBACK_MEMBER(update_timer);
- static const device_timer_id TIMER_UPDATE = 0;
+ void mouse_enqueue(uint8_t value);
private:
uint8_t m_inport;
diff --git a/src/devices/machine/8364_paula.cpp b/src/devices/machine/8364_paula.cpp
index d16739f0cc3..befdb45d7b6 100644
--- a/src/devices/machine/8364_paula.cpp
+++ b/src/devices/machine/8364_paula.cpp
@@ -67,7 +67,7 @@ void paula_8364_device::device_start()
for (int i = 0; i < 4; i++)
{
m_channel[i].index = i;
- m_channel[i].irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(paula_8364_device::signal_irq), this));
+ m_channel[i].irq_timer = timer_alloc(FUNC(paula_8364_device::signal_irq), this);
}
// create the stream
diff --git a/src/devices/machine/8530scc.cpp b/src/devices/machine/8530scc.cpp
index 0bdff03073e..a2e066500e3 100644
--- a/src/devices/machine/8530scc.cpp
+++ b/src/devices/machine/8530scc.cpp
@@ -111,23 +111,19 @@ void scc8530_legacy_device::resetchannel(int ch)
}
/*-------------------------------------------------
- scc8530_baud_expire - baud rate timer expiry
+ baud_expire - baud rate timer expiry
-------------------------------------------------*/
-void scc8530_legacy_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(scc8530_legacy_device::baud_expire)
{
- Chan *pChan = &channel[id];
- int brconst = pChan->reg_val[13]<<8 | pChan->reg_val[14];
- int rate;
+ Chan *pChan = &channel[param];
+ int brconst = pChan->reg_val[13] << 8 | pChan->reg_val[14];
+ int rate = 0;
if (brconst)
{
rate = clock() / brconst;
}
- else
- {
- rate = 0;
- }
// is baud counter IRQ enabled on this channel?
// always flag pending in case it's enabled after this
@@ -146,11 +142,11 @@ void scc8530_legacy_device::device_timer(emu_timer &timer, device_timer_id id, i
if (rate)
{
attotime attorate = attotime::from_hz(rate);
- timer.adjust(attorate, 0, attorate);
+ channel[param].baudtimer->adjust(attorate, param, attorate);
}
else
{
- timer.adjust(attotime::never, 0, attotime::never);
+ channel[param].baudtimer->adjust(attotime::never, param, attotime::never);
}
}
@@ -172,8 +168,8 @@ void scc8530_legacy_device::device_start()
lastIRQStat = 0;
IRQType = IRQ_NONE;
- channel[0].baudtimer = timer_alloc(0);
- channel[1].baudtimer = timer_alloc(1);
+ channel[0].baudtimer = timer_alloc(FUNC(scc8530_legacy_device::baud_expire), this);
+ channel[1].baudtimer = timer_alloc(FUNC(scc8530_legacy_device::baud_expire), this);
}
diff --git a/src/devices/machine/8530scc.h b/src/devices/machine/8530scc.h
index 29b7c138226..fb1045861be 100644
--- a/src/devices/machine/8530scc.h
+++ b/src/devices/machine/8530scc.h
@@ -46,7 +46,8 @@ public:
protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(baud_expire);
private:
struct Chan {
diff --git a/src/devices/machine/acorn_ioc.cpp b/src/devices/machine/acorn_ioc.cpp
index aa778ff7760..3f59b4a66d1 100644
--- a/src/devices/machine/acorn_ioc.cpp
+++ b/src/devices/machine/acorn_ioc.cpp
@@ -51,7 +51,7 @@ void acorn_ioc_device::device_resolve_objects()
void acorn_ioc_device::device_start()
{
for (int i=0; i <4; i++)
- m_timers[i] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(acorn_ioc_device::timer_tick), this));
+ m_timers[i] = timer_alloc(FUNC(acorn_ioc_device::timer_tick), this);
save_item(NAME(m_ir));
save_item(NAME(m_if));
diff --git a/src/devices/machine/acorn_vidc.cpp b/src/devices/machine/acorn_vidc.cpp
index cf739af4360..856106d8fc1 100644
--- a/src/devices/machine/acorn_vidc.cpp
+++ b/src/devices/machine/acorn_vidc.cpp
@@ -168,8 +168,8 @@ void acorn_vidc10_device::device_start()
save_pointer(NAME(m_cursor_vram), m_cursor_vram_size);
save_pointer(NAME(m_stereo_image), m_sound_max_channels);
- m_video_timer = timer_alloc(TIMER_VIDEO);
- m_sound_timer = timer_alloc(TIMER_SOUND);
+ m_video_timer = timer_alloc(FUNC(acorn_vidc10_device::vblank_timer), this);
+ m_sound_timer = timer_alloc(FUNC(acorn_vidc10_device::sound_drq_timer), this);
// generate u255 law lookup table
// cfr. page 48 of the VIDC20 manual, page 33 of the VIDC manual
@@ -216,22 +216,15 @@ void acorn_vidc10_device::device_reset()
m_sound_timer->adjust(attotime::never);
}
-//-------------------------------------------------
-// device_timer - device-specific timer
-//-------------------------------------------------
+TIMER_CALLBACK_MEMBER(acorn_vidc10_device::vblank_timer)
+{
+ m_vblank_cb(ASSERT_LINE);
+ screen_vblank_line_update();
+}
-void acorn_vidc10_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(acorn_vidc10_device::sound_drq_timer)
{
- switch (id)
- {
- case TIMER_VIDEO:
- m_vblank_cb(ASSERT_LINE);
- screen_vblank_line_update();
- break;
- case TIMER_SOUND:
- m_sound_drq_cb(ASSERT_LINE);
- break;
- }
+ m_sound_drq_cb(ASSERT_LINE);
}
//**************************************************************************
@@ -305,13 +298,11 @@ void acorn_vidc10_device::write(offs_t offset, u32 data, u32 mem_mask)
inline void acorn_vidc10_device::update_4bpp_palette(u16 index, u32 paldata)
{
- int r,g,b;
-
// TODO: for TV Tuner we need to output this, also check if cursor mode actually sets this up for offset = 0
// i = (paldata & 0x1000) >> 12; //supremacy bit
- b = (paldata & 0x0f00) >> 8;
- g = (paldata & 0x00f0) >> 4;
- r = (paldata & 0x000f) >> 0;
+ int b = (paldata & 0x0f00) >> 8;
+ int g = (paldata & 0x00f0) >> 4;
+ int r = (paldata & 0x000f) >> 0;
set_pen_color(index, pal4bit(r), pal4bit(g), pal4bit(b) );
screen().update_partial(screen().vpos());
@@ -444,8 +435,7 @@ void acorn_vidc10_device::sound_frequency_w(u32 data)
void acorn_vidc10_device::write_dac(u8 channel, u8 data)
{
- int16_t res;
- res = m_ulaw_lookup[data];
+ int16_t res = m_ulaw_lookup[data];
m_dac[channel & 7]->write(res);
}
@@ -505,29 +495,25 @@ void acorn_vidc10_device::draw(bitmap_rgb32 &bitmap, const rectangle &cliprect,
u32 acorn_vidc10_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
- int xstart,ystart,xend,yend;
- int xsize,ysize;
- int calc_dxs = 0,calc_dxe = 0;
-
/* border color */
bitmap.fill(pen(m_pal_border_base), cliprect);
/* define X display area through BPP mode register */
- calc_dxs = m_crtc_regs[CRTC_HDSR];
- calc_dxe = m_crtc_regs[CRTC_HDER];
+ int calc_dxs = m_crtc_regs[CRTC_HDSR];
+ int calc_dxe = m_crtc_regs[CRTC_HDER];
/* now calculate display clip rectangle start/end areas */
- xstart = (calc_dxs)-m_crtc_regs[CRTC_HBSR];
- ystart = (m_crtc_regs[CRTC_VDSR]-m_crtc_regs[CRTC_VBSR]);
- xend = (calc_dxe)+xstart;
- yend = (m_crtc_regs[CRTC_VDER] * (m_crtc_interlace+1))+ystart;
+ int xstart = (calc_dxs)-m_crtc_regs[CRTC_HBSR];
+ int ystart = (m_crtc_regs[CRTC_VDSR]-m_crtc_regs[CRTC_VBSR]);
+ int xend = (calc_dxe)+xstart;
+ int yend = (m_crtc_regs[CRTC_VDER] * (m_crtc_interlace+1))+ystart;
/* disable the screen if display params are invalid */
if(xstart > xend || ystart > yend)
return 0;
- xsize = calc_dxe-calc_dxs;
- ysize = m_crtc_regs[CRTC_VDER]-m_crtc_regs[CRTC_VDSR];
+ int xsize = calc_dxe-calc_dxs;
+ int ysize = m_crtc_regs[CRTC_VDER]-m_crtc_regs[CRTC_VDSR];
if (xsize <= 0 || ysize <= 0)
return 0;
@@ -653,12 +639,6 @@ void arm_vidc20_device::device_reset()
write_dac32(1, 0);
}
-void arm_vidc20_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- acorn_vidc10_device::device_timer(timer, id, param);
- // TODO: other timers
-}
-
inline void arm_vidc20_device::refresh_stereo_image(u8 channel)
{
// TODO: set_input_gain hampers with both QS1000 and serial DAC mode
@@ -669,13 +649,11 @@ inline void arm_vidc20_device::refresh_stereo_image(u8 channel)
inline void arm_vidc20_device::update_8bpp_palette(u16 index, u32 paldata)
{
- int r,g,b;
-
// TODO: ext hookup, supremacy plus other stuff according to the manual
// ext = (paldata & 0x0f000000) >> 24;
- b = (paldata & 0x00ff0000) >> 16;
- g = (paldata & 0x0000ff00) >> 8;
- r = (paldata & 0x000000ff) >> 0;
+ int b = (paldata & 0x00ff0000) >> 16;
+ int g = (paldata & 0x0000ff00) >> 8;
+ int r = (paldata & 0x000000ff) >> 0;
set_pen_color(index, r, g, b );
screen().update_partial(screen().vpos());
diff --git a/src/devices/machine/acorn_vidc.h b/src/devices/machine/acorn_vidc.h
index d5e86cb1e30..10584dddead 100644
--- a/src/devices/machine/acorn_vidc.h
+++ b/src/devices/machine/acorn_vidc.h
@@ -58,12 +58,15 @@ protected:
virtual void device_config_complete() override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual space_config_vector memory_space_config() const override;
u32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
virtual u32 get_pixel_clock();
+ TIMER_CALLBACK_MEMBER(vblank_timer);
+ TIMER_CALLBACK_MEMBER(sound_drq_timer);
+
address_space_config m_space_config;
+
void regs_map(address_map &map);
enum {
@@ -71,10 +74,6 @@ protected:
CRTC_VCR, CRTC_VSWR, CRTC_VBSR, CRTC_VDSR, CRTC_VDER, CRTC_VBER, CRTC_VCSR, CRTC_VCER
};
u32 m_crtc_regs[16];
- enum {
- TIMER_VIDEO = 1,
- TIMER_SOUND = 2
- };
inline void screen_vblank_line_update();
inline void screen_dynamic_res_change();
@@ -165,7 +164,6 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_config_complete() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
u32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
virtual u32 get_pixel_clock() override;
diff --git a/src/devices/machine/adc0804.cpp b/src/devices/machine/adc0804.cpp
index 048b99734b6..12eb9e7754d 100644
--- a/src/devices/machine/adc0804.cpp
+++ b/src/devices/machine/adc0804.cpp
@@ -118,7 +118,7 @@ void adc0804_device::device_start()
m_fclk_rc = attotime::from_double(m_res * m_cap / 1.1);
// create timer
- m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(adc0804_device::conversion_done), this));
+ m_timer = timer_alloc(FUNC(adc0804_device::conversion_done), this);
// save state
if (m_rd_mode == RD_BITBANGED)
diff --git a/src/devices/machine/adc0808.cpp b/src/devices/machine/adc0808.cpp
index eb8c62435b7..a55c11077c7 100644
--- a/src/devices/machine/adc0808.cpp
+++ b/src/devices/machine/adc0808.cpp
@@ -84,7 +84,7 @@ void adc0808_device::device_start()
m_in_cb.resolve_all_safe(0xff);
// allocate timers
- m_cycle_timer = timer_alloc();
+ m_cycle_timer = timer_alloc(FUNC(adc0808_device::update_state), this);
m_cycle_timer->adjust(attotime::zero, 0, attotime::from_hz(clock()));
// register for save states
@@ -96,10 +96,10 @@ void adc0808_device::device_start()
}
//-------------------------------------------------
-// device_timer - handler timer events
+// update_state
//-------------------------------------------------
-void adc0808_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(adc0808_device::update_state)
{
switch (m_state)
{
diff --git a/src/devices/machine/adc0808.h b/src/devices/machine/adc0808.h
index 5fd14efdf3e..9d69c67daef 100644
--- a/src/devices/machine/adc0808.h
+++ b/src/devices/machine/adc0808.h
@@ -65,7 +65,8 @@ protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(update_state);
private:
// callbacks
diff --git a/src/devices/machine/adc0844.cpp b/src/devices/machine/adc0844.cpp
index a4e3ce04809..bbdafc68aec 100644
--- a/src/devices/machine/adc0844.cpp
+++ b/src/devices/machine/adc0844.cpp
@@ -67,7 +67,7 @@ void adc0844_device::device_start()
m_ch4_cb.resolve_safe(0xff);
// allocate timers
- m_conversion_timer = timer_alloc();
+ m_conversion_timer = timer_alloc(FUNC(adc0844_device::conversion_complete), this);
// register for save states
save_item(NAME(m_channel));
@@ -100,10 +100,10 @@ uint8_t adc0844_device::clamp(int value)
}
//-------------------------------------------------
-// device_timer - handler timer events
+// conversion_complete - finish ADC conversion
//-------------------------------------------------
-void adc0844_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(adc0844_device::conversion_complete)
{
switch (m_channel)
{
@@ -132,7 +132,7 @@ void adc0844_device::device_timer(emu_timer &timer, device_timer_id id, int para
m_intr_cb(ASSERT_LINE);
}
-void adc0848_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(adc0848_device::conversion_complete)
{
switch (m_channel)
{
diff --git a/src/devices/machine/adc0844.h b/src/devices/machine/adc0844.h
index b8080e73d8d..98ac8b211d4 100644
--- a/src/devices/machine/adc0844.h
+++ b/src/devices/machine/adc0844.h
@@ -51,7 +51,8 @@ protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ virtual TIMER_CALLBACK_MEMBER(conversion_complete);
uint8_t clamp(int value);
@@ -83,7 +84,8 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ virtual TIMER_CALLBACK_MEMBER(conversion_complete) override;
private:
devcb_read8 m_ch5_cb, m_ch6_cb, m_ch7_cb, m_ch8_cb;
diff --git a/src/devices/machine/aic6250.cpp b/src/devices/machine/aic6250.cpp
index 71859bdee05..fb885c3b5e3 100644
--- a/src/devices/machine/aic6250.cpp
+++ b/src/devices/machine/aic6250.cpp
@@ -182,7 +182,7 @@ void aic6250_device::device_start()
m_rev_cntrl = 0x02;
- m_state_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(aic6250_device::state_loop), this));
+ m_state_timer = timer_alloc(FUNC(aic6250_device::state_loop), this);
m_state = IDLE;
m_int_asserted = false;
diff --git a/src/devices/machine/aicartc.cpp b/src/devices/machine/aicartc.cpp
index bd5f4c198d8..c4f14b0a9f4 100644
--- a/src/devices/machine/aicartc.cpp
+++ b/src/devices/machine/aicartc.cpp
@@ -54,7 +54,7 @@ void aicartc_device::device_validity_check(validity_checker &valid) const
void aicartc_device::device_start()
{
- m_clock_timer = timer_alloc();
+ m_clock_timer = timer_alloc(FUNC(aicartc_device::clock_tick), this);
m_clock_timer->adjust(attotime::from_hz(clock()), 0, attotime::from_hz(clock()));
}
@@ -107,11 +107,10 @@ void aicartc_device::device_reset()
//-------------------------------------------------
-// device_timer - handler timer events
+// clock_tick - advance the RTC counter
//-------------------------------------------------
-
-void aicartc_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(aicartc_device::clock_tick)
{
m_rtc_tick++;
if(m_rtc_tick & 0x8000)
diff --git a/src/devices/machine/aicartc.h b/src/devices/machine/aicartc.h
index 512d567f13b..fb1955ec685 100644
--- a/src/devices/machine/aicartc.h
+++ b/src/devices/machine/aicartc.h
@@ -33,13 +33,14 @@ protected:
virtual void device_validity_check(validity_checker &valid) const override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_rtc_interface overrides
virtual bool rtc_feature_y2k() const override { return true; }
virtual bool rtc_feature_leap_year() const override { return true; }
virtual void rtc_clock_updated(int year, int month, int day, int day_of_week, int hour, int minute, int second) override;
+ TIMER_CALLBACK_MEMBER(clock_tick);
+
private:
emu_timer *m_clock_timer;
};
diff --git a/src/devices/machine/akiko.cpp b/src/devices/machine/akiko.cpp
index 40e73df64d9..13ae686a972 100644
--- a/src/devices/machine/akiko.cpp
+++ b/src/devices/machine/akiko.cpp
@@ -143,8 +143,8 @@ void akiko_device::device_start()
m_cdrom_cmd_resp = 0;
m_cdrom_toc = nullptr;
- m_dma_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(akiko_device::dma_proc), this));
- m_frame_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(akiko_device::frame_proc), this));
+ m_dma_timer = timer_alloc(FUNC(akiko_device::dma_proc), this);
+ m_frame_timer = timer_alloc(FUNC(akiko_device::frame_proc), this);
}
//-------------------------------------------------
@@ -718,7 +718,7 @@ void akiko_device::update_cdrom()
{
m_cdrom_cmd_start = (m_cdrom_cmd_start + 3) & 0xff;
- machine().scheduler().timer_set( attotime::from_msec(1), timer_expired_delegate(FUNC(akiko_device::cd_delayed_cmd ), this), resp[0]);
+ machine().scheduler().timer_set( attotime::from_msec(1), timer_expired_delegate( FUNC( akiko_device::cd_delayed_cmd ), this ), resp[0] );
break;
}
diff --git a/src/devices/machine/am2910.cpp b/src/devices/machine/am2910.cpp
index eaca32a34d8..158b4b83bb7 100644
--- a/src/devices/machine/am2910.cpp
+++ b/src/devices/machine/am2910.cpp
@@ -70,7 +70,7 @@ void am2910_device::device_start()
m_vect.resolve_safe();
if (clock())
- m_execute_timer = timer_alloc(TIMER_CLOCK);
+ m_execute_timer = timer_alloc(FUNC(am2910_device::clock_tick), this);
else
m_execute_timer = nullptr;
}
@@ -86,12 +86,9 @@ void am2910_device::device_reset()
m_execute_timer->adjust(attotime::from_hz(clock()), 0, attotime::from_hz(clock()));
}
-void am2910_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(am2910_device::clock_tick)
{
- if (id == TIMER_CLOCK)
- {
- cp_w(m_cp ? 0 : 1);
- }
+ cp_w(m_cp ? 0 : 1);
}
WRITE_LINE_MEMBER(am2910_device::cc_w)
diff --git a/src/devices/machine/am2910.h b/src/devices/machine/am2910.h
index 6ff5047014c..52c075ea52a 100644
--- a/src/devices/machine/am2910.h
+++ b/src/devices/machine/am2910.h
@@ -42,9 +42,8 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
- static constexpr device_timer_id TIMER_CLOCK = 0;
+ TIMER_CALLBACK_MEMBER(clock_tick);
emu_timer *m_execute_timer;
diff --git a/src/devices/machine/am53cf96.cpp b/src/devices/machine/am53cf96.cpp
index 9d1171c3f66..41b62e145f0 100644
--- a/src/devices/machine/am53cf96.cpp
+++ b/src/devices/machine/am53cf96.cpp
@@ -47,7 +47,7 @@ uint8_t am53cf96_device::read(offs_t offset)
return rv;
}
-void am53cf96_device::device_timer(emu_timer &timer, device_timer_id tid, int param)
+TIMER_CALLBACK_MEMBER(am53cf96_device::irq_timer_tick)
{
scsi_regs[REG_IRQSTATE] = 8; // indicate success
scsi_regs[REG_STATUS] |= 0x80; // indicate IRQ
@@ -169,7 +169,7 @@ void am53cf96_device::device_start()
save_item( NAME( xfer_state ) );
save_item( NAME( last_id ) );
- m_transfer_timer = timer_alloc( TIMER_TRANSFER );
+ m_transfer_timer = timer_alloc( FUNC( am53cf96_device::irq_timer_tick ), this );
}
// retrieve data from the SCSI controller
diff --git a/src/devices/machine/am53cf96.h b/src/devices/machine/am53cf96.h
index 989da69d4c6..6fdd801f6df 100644
--- a/src/devices/machine/am53cf96.h
+++ b/src/devices/machine/am53cf96.h
@@ -51,11 +51,10 @@ protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-private:
- static constexpr device_timer_id TIMER_TRANSFER = 0;
+ TIMER_CALLBACK_MEMBER(irq_timer_tick);
+private:
uint8_t scsi_regs[32];
uint8_t fifo[16];
uint8_t fptr;
diff --git a/src/devices/machine/am79c90.cpp b/src/devices/machine/am79c90.cpp
index ce2fb4837fe..f47457680ec 100644
--- a/src/devices/machine/am79c90.cpp
+++ b/src/devices/machine/am79c90.cpp
@@ -87,7 +87,7 @@ void am7990_device_base::device_start()
m_dma_in_cb.resolve_safe(0);
m_dma_out_cb.resolve_safe();
- m_transmit_poll = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(am7990_device_base::transmit_poll), this));
+ m_transmit_poll = timer_alloc(FUNC(am7990_device_base::transmit_poll), this);
m_transmit_poll->adjust(TX_POLL_PERIOD, 0, TX_POLL_PERIOD);
save_item(NAME(m_rap));
diff --git a/src/devices/machine/am9513.cpp b/src/devices/machine/am9513.cpp
index c22eb0fc735..1c8c3692369 100644
--- a/src/devices/machine/am9513.cpp
+++ b/src/devices/machine/am9513.cpp
@@ -113,7 +113,7 @@ void am9513_device::device_start()
// Set up frequency timers
for (int f = 0; f < 5; f++)
{
- m_freq_timer[f] = timer_alloc(TIMER_F1 + f);
+ m_freq_timer[f] = timer_alloc(FUNC(am9513_device::timer_tick), this);
m_freq_timer_selected[f] = (f == 0) ? (m_fout_cb.isnull() ? 0x3e : 0x3f) : 0;
m_freq_timer_cycle[f] = 0;
}
@@ -205,9 +205,9 @@ void am9513_device::init_freq_timer(int f)
attotime freq = clocks_to_attotime(scale);
if (m_freq_timer_cycle[f] == 0)
- m_freq_timer[f]->adjust(freq, 0, freq);
+ m_freq_timer[f]->adjust(freq, f, freq);
else
- m_freq_timer[f]->adjust(freq / 2, 0, freq / 2);
+ m_freq_timer[f]->adjust(freq / 2, f, freq / 2);
m_freq_timer[f]->enable(m_freq_timer_selected[f] != 0);
LOGMASKED(LOG_GENERAL, "F%d = %f Hz (%s cycle emulation)\n", f + 1, double(clock()) / scale,
@@ -228,21 +228,18 @@ void am9513_device::device_clock_changed()
//-------------------------------------------------
-// device_timer - called whenever a device timer
-// fires
+// timer_tick - advance our counters
//-------------------------------------------------
-void am9513_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(am9513_device::timer_tick)
{
- assert(id >= TIMER_F1 && id <= TIMER_F5);
-
- int cycle = m_freq_timer_cycle[id - TIMER_F1] == 0 ? 2 : 1;
+ int cycle = m_freq_timer_cycle[param] == 0 ? 2 : 1;
while (cycle-- > 0)
{
- m_f ^= 1 << (id - TIMER_F1);
- bool level = BIT(m_f, id - TIMER_F1);
+ m_f ^= 1 << param;
+ bool level = BIT(m_f, param);
- int source = id - TIMER_F1 + 11;
+ int source = param + 11;
for (int c = 0; c < 5; c++)
{
if ((m_counter_mode[c] & 0x0f00) >> 8 == source && BIT(m_counter_mode[c], 12) == !level)
@@ -250,7 +247,7 @@ void am9513_device::device_timer(emu_timer &timer, device_timer_id id, int param
}
// FOUT Source = Fn
- if ((m_mmr & 0x00f0) >> 4 == source || ((m_mmr & 0x00f0) == 0 && id == TIMER_F1))
+ if ((m_mmr & 0x00f0) >> 4 == source || ((m_mmr & 0x00f0) == 0 && param == 0))
fout_tick();
}
}
diff --git a/src/devices/machine/am9513.h b/src/devices/machine/am9513.h
index 78e54799363..34c3cc3598c 100644
--- a/src/devices/machine/am9513.h
+++ b/src/devices/machine/am9513.h
@@ -93,11 +93,11 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_clock_changed() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
private:
// internal helpers
TIMER_CALLBACK_MEMBER(clear_outputs);
+ TIMER_CALLBACK_MEMBER(timer_tick);
void master_reset();
void init_freq_timer(int f);
void select_freq_timer(int f, int c, bool selected, bool cycle);
@@ -161,14 +161,6 @@ private:
// frequency timer
u8 m_f;
- enum
- {
- TIMER_F1,
- TIMER_F2,
- TIMER_F3,
- TIMER_F4,
- TIMER_F5
- };
emu_timer *m_freq_timer[5];
u8 m_freq_timer_selected[5];
u8 m_freq_timer_cycle[5];
diff --git a/src/devices/machine/am9519.cpp b/src/devices/machine/am9519.cpp
index 64d36a8acaa..d7b38ef6d16 100644
--- a/src/devices/machine/am9519.cpp
+++ b/src/devices/machine/am9519.cpp
@@ -11,7 +11,72 @@
//#define VERBOSE (LOG_GENERAL)
#include "logmacro.h"
-void am9519_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+
+DEFINE_DEVICE_TYPE(AM9519, am9519_device, "am9519", "AMD AM9519 Universal Interrupt Controller")
+
+am9519_device::am9519_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+ : device_t(mconfig, AM9519, tag, owner, clock)
+ , m_out_int_func(*this)
+ , m_irr(0)
+ , m_irq_lines(0)
+ , m_irq_check_timer(nullptr)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void am9519_device::device_start()
+{
+ // resolve callbacks
+ m_out_int_func.resolve_safe();
+
+ // Register save state items
+ save_item(NAME(m_isr));
+ save_item(NAME(m_irr));
+ save_item(NAME(m_prio));
+ save_item(NAME(m_imr));
+ save_item(NAME(m_irq_lines));
+ save_item(NAME(m_mode));
+ save_item(NAME(m_count));
+ save_item(NAME(m_resp));
+ save_item(NAME(m_aclear));
+ save_item(NAME(m_cmd));
+
+ m_irq_check_timer = timer_alloc(FUNC(am9519_device::check_irqs), this);
+ m_irq_check_timer->adjust(attotime::never);
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void am9519_device::device_reset()
+{
+ m_isr = 0;
+ m_irr = 0;
+ m_irq_lines = 0;
+ m_prio = 0;
+ m_imr = 0xff;
+ m_mode = 0;
+ m_aclear = 0;
+ m_cmd = 0;
+ m_curcnt = 0;
+ for(int i = 0; i < 8; i++)
+ {
+ m_count[i] = 0;
+ m_resp[i][0] = 0;
+ m_resp[i][1] = 0;
+ m_resp[i][2] = 0;
+ m_resp[i][3] = 0;
+ }
+}
+
+
+TIMER_CALLBACK_MEMBER(am9519_device::check_irqs)
{
if(!BIT(m_mode, 7)) // chip disabled
return;
@@ -63,7 +128,7 @@ void am9519_device::set_irq_line(int irq, int state)
m_irq_lines &= ~mask;
m_irr &= ~mask;
}
- set_timer();
+ m_irq_check_timer->adjust(attotime::zero);
}
@@ -82,7 +147,7 @@ u32 am9519_device::acknowledge()
m_isr |= mask;
m_irr &= ~mask;
- set_timer();
+ m_irq_check_timer->adjust(attotime::zero);
u32 ret = 0;
int irqr = BIT(m_mode, 1) ? 0 : irq;
@@ -219,7 +284,7 @@ void am9519_device::cmd_w(u8 data)
m_curcnt = 0;
break;
}
- set_timer();
+ m_irq_check_timer->adjust(attotime::zero);
}
void am9519_device::data_w(u8 data)
@@ -246,63 +311,5 @@ void am9519_device::data_w(u8 data)
}
m_cmd = 0;
}
- set_timer();
-}
-
-//-------------------------------------------------
-// device_start - device-specific startup
-//-------------------------------------------------
-
-void am9519_device::device_start()
-{
- // resolve callbacks
- m_out_int_func.resolve_safe();
-
- // Register save state items
- save_item(NAME(m_isr));
- save_item(NAME(m_irr));
- save_item(NAME(m_prio));
- save_item(NAME(m_imr));
- save_item(NAME(m_irq_lines));
- save_item(NAME(m_mode));
- save_item(NAME(m_count));
- save_item(NAME(m_resp));
- save_item(NAME(m_aclear));
- save_item(NAME(m_cmd));
-}
-
-
-//-------------------------------------------------
-// device_reset - device-specific reset
-//-------------------------------------------------
-
-void am9519_device::device_reset()
-{
- m_isr = 0;
- m_irr = 0;
- m_irq_lines = 0;
- m_prio = 0;
- m_imr = 0xff;
- m_mode = 0;
- m_aclear = 0;
- m_cmd = 0;
- m_curcnt = 0;
- for(int i = 0; i < 8; i++)
- {
- m_count[i] = 0;
- m_resp[i][0] = 0;
- m_resp[i][1] = 0;
- m_resp[i][2] = 0;
- m_resp[i][3] = 0;
- }
-}
-
-DEFINE_DEVICE_TYPE(AM9519, am9519_device, "am9519", "AMD AM9519 Universal Interrupt Controller")
-
-am9519_device::am9519_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : device_t(mconfig, AM9519, tag, owner, clock)
- , m_out_int_func(*this)
- , m_irr(0)
- , m_irq_lines(0)
-{
+ m_irq_check_timer->adjust(attotime::zero);
}
diff --git a/src/devices/machine/am9519.h b/src/devices/machine/am9519.h
index 9de7746b4c7..bccd4534faf 100644
--- a/src/devices/machine/am9519.h
+++ b/src/devices/machine/am9519.h
@@ -57,12 +57,10 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-private:
- static constexpr device_timer_id TIMER_CHECK_IRQ = 0;
+ TIMER_CALLBACK_MEMBER(check_irqs);
- inline void set_timer() { timer_set(attotime::zero, TIMER_CHECK_IRQ); }
+private:
void set_irq_line(int irq, int state);
devcb_write_line m_out_int_func;
@@ -79,6 +77,8 @@ private:
u8 m_aclear;
u8 m_count[8];
u8 m_resp[8][4];
+
+ emu_timer *m_irq_check_timer;
};
DECLARE_DEVICE_TYPE(AM9519, am9519_device)
diff --git a/src/devices/machine/amigafdc.cpp b/src/devices/machine/amigafdc.cpp
index adb31fc76ea..15694a95f49 100644
--- a/src/devices/machine/amigafdc.cpp
+++ b/src/devices/machine/amigafdc.cpp
@@ -86,7 +86,7 @@ void amiga_fdc_device::device_start()
floppy = nullptr;
- t_gen = timer_alloc(0);
+ t_gen = timer_alloc(FUNC(amiga_fdc_device::update_tick), this);
}
void amiga_fdc_device::device_reset()
@@ -485,7 +485,7 @@ uint16_t amiga_fdc_device::dskbytr_r()
return res;
}
-void amiga_fdc_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(amiga_fdc_device::update_tick)
{
live_sync();
live_run();
diff --git a/src/devices/machine/amigafdc.h b/src/devices/machine/amigafdc.h
index b6623fca16f..02e8c823539 100644
--- a/src/devices/machine/amigafdc.h
+++ b/src/devices/machine/amigafdc.h
@@ -37,7 +37,8 @@ public:
protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(update_tick);
private:
// Running states
diff --git a/src/devices/machine/applefdc.cpp b/src/devices/machine/applefdc.cpp
index bd052d18263..8b6c5fec524 100644
--- a/src/devices/machine/applefdc.cpp
+++ b/src/devices/machine/applefdc.cpp
@@ -55,10 +55,6 @@
#define IWM_Q6 0x40
#define IWM_Q7 0x80
-const device_timer_id TIMER_MOTOR_ONOFF = 1;
-
-
-
/***************************************************************************
@@ -122,7 +118,7 @@ applefdc_base_device::applefdc_base_device(applefdc_base_device::applefdc_t fdc_
void applefdc_base_device::device_start()
{
// timer
- m_motor_timer = timer_alloc(TIMER_MOTOR_ONOFF);
+ m_motor_timer = timer_alloc(FUNC(applefdc_base_device::turn_motor_onoff), this);
// state
m_write_byte = 0x00;
@@ -155,22 +151,6 @@ void applefdc_base_device::device_reset(void)
//-------------------------------------------------
-// device_timer - device-specific timer callbacks
-//-------------------------------------------------
-
-void applefdc_base_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch(id)
- {
- case TIMER_MOTOR_ONOFF:
- turn_motor_onoff(param != 0);
- break;
- }
-}
-
-
-
-//-------------------------------------------------
// get_interface - gets the interface
//-------------------------------------------------
@@ -345,12 +325,12 @@ void applefdc_base_device::write_reg(uint8_t data)
// motor on or off
//-------------------------------------------------
-void applefdc_base_device::turn_motor_onoff(bool status)
+TIMER_CALLBACK_MEMBER(applefdc_base_device::turn_motor_onoff)
{
const applefdc_interface *intf = get_interface();
int enable_lines;
- if (status)
+ if (param)
{
m_lines |= IWM_MOTOR;
enable_lines = (m_lines & IWM_DRIVE) ? 2 : 1;
@@ -370,7 +350,7 @@ void applefdc_base_device::turn_motor_onoff(bool status)
intf->set_enable_lines(this, enable_lines);
if (LOG_APPLEFDC_EXTRA)
- logerror("iwm_turnmotor_onoff(): Turning motor %s\n", status ? "on" : "off");
+ logerror("iwm_turnmotor_onoff(): Turning motor %s\n", param ? "on" : "off");
}
diff --git a/src/devices/machine/applefdc.h b/src/devices/machine/applefdc.h
index 30a2bb50fc2..80fbea87954 100644
--- a/src/devices/machine/applefdc.h
+++ b/src/devices/machine/applefdc.h
@@ -83,11 +83,11 @@ protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// other protecteds
virtual void iwm_modereg_w(uint8_t data);
+
private:
// data that is constant for the lifetime of the emulation
emu_timer * m_motor_timer;
@@ -107,7 +107,7 @@ private:
uint8_t statusreg_r();
uint8_t read_reg(int lines);
void write_reg(uint8_t data);
- void turn_motor_onoff(bool status);
+ TIMER_CALLBACK_MEMBER(turn_motor_onoff);
void iwm_access(int offset);
};
diff --git a/src/devices/machine/applepic.cpp b/src/devices/machine/applepic.cpp
index 54f68a483c7..0383bb6817c 100644
--- a/src/devices/machine/applepic.cpp
+++ b/src/devices/machine/applepic.cpp
@@ -81,7 +81,7 @@ void applepic_device::device_resolve_objects()
void applepic_device::device_start()
{
// Initialize timer
- m_timer1 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(applepic_device::timer1_callback), this));
+ m_timer1 = timer_alloc(FUNC(applepic_device::timer1_callback), this);
// Save internal state
save_item(NAME(m_timer_last_expired));
diff --git a/src/devices/machine/arm_iomd.cpp b/src/devices/machine/arm_iomd.cpp
index 0fc1c9ad174..e1c32d8d3f3 100644
--- a/src/devices/machine/arm_iomd.cpp
+++ b/src/devices/machine/arm_iomd.cpp
@@ -145,6 +145,15 @@ arm_iomd_device::arm_iomd_device(const machine_config &mconfig, device_type type
, m_iocr_write_od_cb(*this)
, m_iocr_read_id_cb(*this)
, m_iocr_write_id_cb(*this)
+ , m_sndcur(0)
+ , m_sndend(0)
+ , m_sndcur_reg{ 0, 0 }
+ , m_sndend_reg{ 0, 0 }
+ , m_sndstop_reg{ false, false }
+ , m_sndlast_reg{ false, false }
+ , m_sndbuffer_ok{ false, false }
+ , m_sound_dma_on(false)
+ , m_sndcur_buffer(0)
{
}
@@ -243,28 +252,28 @@ void arm_iomd_device::device_start()
save_item(NAME(m_videqual));
save_item(NAME(m_cursor_enable));
save_item(NAME(m_cursinit));
- save_pointer(NAME(m_irq_mask), IRQ_SOURCES_SIZE);
- save_pointer(NAME(m_irq_status), IRQ_SOURCES_SIZE);
+ save_pointer(NAME(m_irq_mask), std::size(m_irq_mask));
+ save_pointer(NAME(m_irq_status), std::size(m_irq_status));
m_host_space = &m_host_cpu->space(AS_PROGRAM);
- m_timer[0] = timer_alloc(T0_TIMER);
- m_timer[1] = timer_alloc(T1_TIMER);
- save_pointer(NAME(m_timer_in), timer_ch_size);
- save_pointer(NAME(m_timer_out), timer_ch_size);
- save_pointer(NAME(m_timer_counter), timer_ch_size);
- save_pointer(NAME(m_timer_readinc), timer_ch_size);
+ m_timer[0] = timer_alloc(FUNC(arm_iomd_device::timer_elapsed), this);
+ m_timer[1] = timer_alloc(FUNC(arm_iomd_device::timer_elapsed), this);
+ save_pointer(NAME(m_timer_in), std::size(m_timer_in));
+ save_pointer(NAME(m_timer_out), std::size(m_timer_out));
+ save_pointer(NAME(m_timer_counter), std::size(m_timer_counter));
+ save_pointer(NAME(m_timer_readinc), std::size(m_timer_readinc));
save_item(NAME(m_sndcur));
save_item(NAME(m_sndend));
save_item(NAME(m_sound_dma_on));
save_item(NAME(m_sndcur_buffer));
- save_pointer(NAME(m_sndcur_reg), sounddma_ch_size);
- save_pointer(NAME(m_sndend_reg), sounddma_ch_size);
- save_pointer(NAME(m_sndstop_reg), sounddma_ch_size);
- save_pointer(NAME(m_sndlast_reg), sounddma_ch_size);
- save_pointer(NAME(m_sndbuffer_ok), sounddma_ch_size);
+ save_pointer(NAME(m_sndcur_reg), std::size(m_sndcur_reg));
+ save_pointer(NAME(m_sndend_reg), std::size(m_sndend_reg));
+ save_pointer(NAME(m_sndstop_reg), std::size(m_sndstop_reg));
+ save_pointer(NAME(m_sndlast_reg), std::size(m_sndlast_reg));
+ save_pointer(NAME(m_sndbuffer_ok), std::size(m_sndbuffer_ok));
// TODO: jumps to EASI space at $0c0016xx for RiscPC if POR is on?
}
@@ -288,28 +297,27 @@ void arm7500fe_iomd_device::device_start()
void arm_iomd_device::device_reset()
{
- int i;
m_iocr_ddr = 0x0b;
m_video_enable = false;
// TODO: defaults for these
m_vidinita = 0;
m_vidend = 0;
- for (i=0; i<IRQ_SOURCES_SIZE; i++)
- {
- m_irq_status[i] = 0;
- m_irq_mask[i] = 0;
- }
+ std::fill_n(m_irq_status, std::size(m_irq_status), 0);
+ std::fill_n(m_irq_mask, std::size(m_irq_mask), 0);
- for (i = 0; i < timer_ch_size; i++)
+ for (int i = 0; i < std::size(m_timer); i++)
m_timer[i]->adjust(attotime::never);
+ m_sndcur = 0;
+ m_sndend = 0;
+ std::fill_n(m_sndcur_reg, std::size(m_sndcur_reg), 0);
+ std::fill_n(m_sndend_reg, std::size(m_sndend_reg), 0);
+ std::fill_n(m_sndstop_reg, std::size(m_sndstop_reg), false);
+ std::fill_n(m_sndlast_reg, std::size(m_sndlast_reg), false);
+ std::fill_n(m_sndbuffer_ok, std::size(m_sndbuffer_ok), false);
m_sound_dma_on = false;
- for (i = 0; i < sounddma_ch_size; i++)
- {
- m_sndbuffer_ok[i] = false;
- m_sndcur_reg[i] = 0;
- }
+ m_sndcur_buffer = 0;
// ...
}
@@ -324,15 +332,9 @@ void arm7500fe_iomd_device::device_reset()
m_iolines_ddr = 0xff;
}
-void arm_iomd_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(arm_iomd_device::timer_elapsed)
{
- switch(id)
- {
- case T0_TIMER:
- case T1_TIMER:
- trigger_irq<IRQA>(id == T1_TIMER ? 0x40 : 0x20);
- break;
- }
+ trigger_irq<IRQA>((uint8_t)param);
}
//**************************************************************************
@@ -500,7 +502,7 @@ inline void arm_iomd_device::trigger_timer(unsigned Which)
if(val==0)
m_timer[Which]->adjust(attotime::never);
else
- m_timer[Which]->adjust(attotime::from_usec(val), 0, attotime::from_usec(val));
+ m_timer[Which]->adjust(attotime::from_usec(val), Which ? 0x40 : 0x20, attotime::from_usec(val));
}
// TODO: live updates aren't really supported here
diff --git a/src/devices/machine/arm_iomd.h b/src/devices/machine/arm_iomd.h
index 8600c55cf22..e072a7c8a31 100644
--- a/src/devices/machine/arm_iomd.h
+++ b/src/devices/machine/arm_iomd.h
@@ -62,7 +62,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(timer_elapsed);
void base_map(address_map &map);
u16 m_id;
@@ -117,13 +118,15 @@ private:
u32 cursinit_r();
void cursinit_w(offs_t offset, u32 data, u32 mem_mask = ~0);
- static constexpr int sounddma_ch_size = 2;
- u32 m_sndcur = 0, m_sndend = 0;
- u32 m_sndcur_reg[sounddma_ch_size]{}, m_sndend_reg[sounddma_ch_size]{};
- bool m_sndstop_reg[sounddma_ch_size]{}, m_sndlast_reg[sounddma_ch_size]{};
- bool m_sndbuffer_ok[sounddma_ch_size]{};
- bool m_sound_dma_on = false;
- u8 m_sndcur_buffer = 0;
+ u32 m_sndcur;
+ u32 m_sndend;
+ u32 m_sndcur_reg[2];
+ u32 m_sndend_reg[2];
+ bool m_sndstop_reg[2];
+ bool m_sndlast_reg[2];
+ bool m_sndbuffer_ok[2];
+ bool m_sound_dma_on;
+ u8 m_sndcur_buffer;
inline void sounddma_swap_buffer();
template <unsigned Which> u32 sdcur_r();
template <unsigned Which> void sdcur_w(offs_t offset, u32 data, u32 mem_mask = ~0);
@@ -138,11 +141,6 @@ private:
inline void flush_irq(unsigned Which);
template <unsigned Which> inline void trigger_irq(u8 irq_type);
- static constexpr int timer_ch_size = 2;
- enum {
- T0_TIMER = 1,
- T1_TIMER
- };
inline void trigger_timer(unsigned Which);
u16 m_timer_in[2];
u16 m_timer_out[2];
diff --git a/src/devices/machine/at28c16.cpp b/src/devices/machine/at28c16.cpp
index 575b7e71308..38dbdc25117 100644
--- a/src/devices/machine/at28c16.cpp
+++ b/src/devices/machine/at28c16.cpp
@@ -72,7 +72,7 @@ device_memory_interface::space_config_vector at28c16_device::memory_space_config
void at28c16_device::device_start()
{
- m_write_timer = timer_alloc(0);
+ m_write_timer = timer_alloc( FUNC( at28c16_device::write_complete ), this );
save_item( NAME(m_a9_12v) );
save_item( NAME(m_oe_12v) );
@@ -229,12 +229,7 @@ WRITE_LINE_MEMBER( at28c16_device::set_oe_12v )
}
-void at28c16_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER( at28c16_device::write_complete )
{
- switch( id )
- {
- case 0:
- m_last_write = -1;
- break;
- }
+ m_last_write = -1;
}
diff --git a/src/devices/machine/at28c16.h b/src/devices/machine/at28c16.h
index cdfe55243f1..ca412d7c0af 100644
--- a/src/devices/machine/at28c16.h
+++ b/src/devices/machine/at28c16.h
@@ -35,7 +35,6 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_memory_interface overrides
virtual space_config_vector memory_space_config() const override;
@@ -57,6 +56,7 @@ private:
// I/O operations
DECLARE_WRITE_LINE_MEMBER( set_a9_12v );
DECLARE_WRITE_LINE_MEMBER( set_oe_12v );
+ TIMER_CALLBACK_MEMBER( write_complete );
void at28c16_map8(address_map &map);
};
diff --git a/src/devices/machine/at28c64b.cpp b/src/devices/machine/at28c64b.cpp
index 098454a771e..e3b33128be8 100644
--- a/src/devices/machine/at28c64b.cpp
+++ b/src/devices/machine/at28c64b.cpp
@@ -74,7 +74,7 @@ device_memory_interface::space_config_vector at28c64b_device::memory_space_confi
void at28c64b_device::device_start()
{
- m_write_timer = timer_alloc(0);
+ m_write_timer = timer_alloc( FUNC( at28c64b_device::write_complete ), this );
save_item( NAME(m_a9_12v) );
save_item( NAME(m_oe_12v) );
@@ -273,12 +273,7 @@ WRITE_LINE_MEMBER( at28c64b_device::set_oe_12v )
}
-void at28c64b_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER( at28c64b_device::write_complete )
{
- switch( id )
- {
- case 0:
- m_last_write = -1;
- break;
- }
+ m_last_write = -1;
}
diff --git a/src/devices/machine/at28c64b.h b/src/devices/machine/at28c64b.h
index 83d74cda5a4..c94ac1eec62 100644
--- a/src/devices/machine/at28c64b.h
+++ b/src/devices/machine/at28c64b.h
@@ -35,7 +35,6 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_memory_interface overrides
virtual space_config_vector memory_space_config() const override;
@@ -69,6 +68,7 @@ private:
// I/O operations
DECLARE_WRITE_LINE_MEMBER( set_a9_12v );
DECLARE_WRITE_LINE_MEMBER( set_oe_12v );
+ TIMER_CALLBACK_MEMBER( write_complete );
void at28c64b_map8(address_map &map);
};
diff --git a/src/devices/machine/at29x.cpp b/src/devices/machine/at29x.cpp
index c701c13c557..bf0544ede0f 100644
--- a/src/devices/machine/at29x.cpp
+++ b/src/devices/machine/at29x.cpp
@@ -52,11 +52,6 @@
#include "logmacro.h"
-enum
-{
- PRGTIMER = 1
-};
-
/*
Constructor for all variants
*/
@@ -138,7 +133,7 @@ bool at29x_device::nvram_write(util::write_stream &file)
/*
Programming timer callback
*/
-void at29x_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(at29x_device::step_programming)
{
switch (m_pgm)
{
@@ -482,7 +477,7 @@ void at29x_device::device_start()
{
m_programming_buffer = std::make_unique<uint8_t[]>(m_sector_size);
m_eememory = std::make_unique<uint8_t[]>(m_memory_size+2);
- m_programming_timer = timer_alloc(PRGTIMER);
+ m_programming_timer = timer_alloc(FUNC(at29x_device::step_programming), this);
// TODO: Complete 16-bit handling
m_address_mask = m_memory_size/(m_word_width/8) - 1;
diff --git a/src/devices/machine/at29x.h b/src/devices/machine/at29x.h
index d32c159b8b6..5df3672877f 100644
--- a/src/devices/machine/at29x.h
+++ b/src/devices/machine/at29x.h
@@ -29,12 +29,13 @@ protected:
virtual void device_start(void) override;
virtual void device_reset(void) override;
virtual void device_stop(void) override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void nvram_default() override;
virtual bool nvram_read(util::read_stream &file) override;
virtual bool nvram_write(util::write_stream &file) override;
+ TIMER_CALLBACK_MEMBER(step_programming);
+
int get_sector_number(offs_t address) { return address / m_sector_size; }
const int m_memory_size; // bytes
diff --git a/src/devices/machine/bq4847.cpp b/src/devices/machine/bq4847.cpp
index 7c8b2060869..91fca4b8edd 100644
--- a/src/devices/machine/bq4847.cpp
+++ b/src/devices/machine/bq4847.cpp
@@ -450,9 +450,9 @@ void bq4847_device::update_int()
void bq4847_device::device_start()
{
- m_update_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(bq4847_device::update_callback), this));
- m_periodic_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(bq4847_device::periodic_callback), this));
- m_watchdog_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(bq4847_device::watchdog_callback), this));
+ m_update_timer = timer_alloc(FUNC(bq4847_device::update_callback), this);
+ m_periodic_timer = timer_alloc(FUNC(bq4847_device::periodic_callback), this);
+ m_watchdog_timer = timer_alloc(FUNC(bq4847_device::watchdog_callback), this);
m_int_handler.resolve_safe();
m_wdo_handler.resolve_safe();
diff --git a/src/devices/machine/bq48x2.cpp b/src/devices/machine/bq48x2.cpp
index 55434819a10..849f019ce6c 100644
--- a/src/devices/machine/bq48x2.cpp
+++ b/src/devices/machine/bq48x2.cpp
@@ -507,13 +507,13 @@ int bq48x2_device::get_delay()
void bq48x2_device::device_start()
{
- m_clock_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(bq48x2_device::rtc_clock_cb), this));
+ m_clock_timer = timer_alloc(FUNC(bq48x2_device::rtc_clock_cb), this);
// Periodic timer
- m_periodic_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(bq48x2_device::rtc_periodic_cb), this));
+ m_periodic_timer = timer_alloc(FUNC(bq48x2_device::rtc_periodic_cb), this);
// Watchdog timer
- m_watchdog_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(bq48x2_device::rtc_watchdog_cb), this));
+ m_watchdog_timer = timer_alloc(FUNC(bq48x2_device::rtc_watchdog_cb), this);
// Interrupt line
m_interrupt_cb.resolve_safe();
diff --git a/src/devices/machine/busmouse.cpp b/src/devices/machine/busmouse.cpp
index 6734661b301..2def623649b 100644
--- a/src/devices/machine/busmouse.cpp
+++ b/src/devices/machine/busmouse.cpp
@@ -144,7 +144,7 @@ void bus_mouse_device::device_start()
// resolve callbacks
m_write_extint.resolve_safe();
- m_irq_timer = timer_alloc(0);
+ m_irq_timer = timer_alloc(FUNC(bus_mouse_device::irq_timer_tick), this);
}
@@ -165,7 +165,7 @@ void bus_mouse_device::device_reset()
LOG("irq rate: %d Hz\n", hz);
}
-void bus_mouse_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(bus_mouse_device::irq_timer_tick)
{
irq = !irq;
diff --git a/src/devices/machine/busmouse.h b/src/devices/machine/busmouse.h
index 3f523946358..29c20d236ee 100644
--- a/src/devices/machine/busmouse.h
+++ b/src/devices/machine/busmouse.h
@@ -28,7 +28,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_add_mconfig(machine_config &config) override;
// optional information overrides
@@ -38,6 +37,8 @@ protected:
uint8_t ppi_c_r();
void ppi_c_w(uint8_t data);
+ TIMER_CALLBACK_MEMBER(irq_timer_tick);
+
private:
emu_timer *m_irq_timer;
bool irq, irq_disabled;
diff --git a/src/devices/machine/cdp1852.cpp b/src/devices/machine/cdp1852.cpp
index b98b9a34fef..b4850ac669e 100644
--- a/src/devices/machine/cdp1852.cpp
+++ b/src/devices/machine/cdp1852.cpp
@@ -66,8 +66,8 @@ void cdp1852_device::device_start()
m_write_data.resolve_safe();
// allocate timers
- m_update_do_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(cdp1852_device::update_do), this));
- m_update_sr_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(cdp1852_device::update_sr), this));
+ m_update_do_timer = timer_alloc(FUNC(cdp1852_device::update_do), this);
+ m_update_sr_timer = timer_alloc(FUNC(cdp1852_device::update_sr), this);
// register for state saving
save_item(NAME(m_new_data));
diff --git a/src/devices/machine/cdp1871.cpp b/src/devices/machine/cdp1871.cpp
index fe1980fe004..3e32512c30f 100644
--- a/src/devices/machine/cdp1871.cpp
+++ b/src/devices/machine/cdp1871.cpp
@@ -152,7 +152,7 @@ void cdp1871_device::device_start()
change_output_lines();
// allocate timers
- m_scan_timer = timer_alloc();
+ m_scan_timer = timer_alloc(FUNC(cdp1871_device::perform_scan), this);
m_scan_timer->adjust(attotime::zero, 0, attotime::from_hz(clock()));
// register for state saving
@@ -172,10 +172,10 @@ void cdp1871_device::device_start()
//-------------------------------------------------
-// device_timer - handler timer events
+// perform_scan - periodically scan for keys
//-------------------------------------------------
-void cdp1871_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(cdp1871_device::perform_scan)
{
change_output_lines();
clock_scan_counters();
diff --git a/src/devices/machine/cdp1871.h b/src/devices/machine/cdp1871.h
index b6529479491..a359980f7fb 100644
--- a/src/devices/machine/cdp1871.h
+++ b/src/devices/machine/cdp1871.h
@@ -66,12 +66,13 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
void change_output_lines();
void clock_scan_counters();
void detect_keypress();
+ TIMER_CALLBACK_MEMBER(perform_scan);
+
private:
devcb_read8 m_read_d1;
devcb_read8 m_read_d2;
diff --git a/src/devices/machine/cdp1879.cpp b/src/devices/machine/cdp1879.cpp
index 8f9b8f6081c..f6687f73226 100644
--- a/src/devices/machine/cdp1879.cpp
+++ b/src/devices/machine/cdp1879.cpp
@@ -36,7 +36,7 @@ cdp1879_device::cdp1879_device(const machine_config &mconfig, const char *tag, d
void cdp1879_device::device_start()
{
// allocate timers
- m_clock_timer = timer_alloc();
+ m_clock_timer = timer_alloc(FUNC(cdp1879_device::clock_tick), this);
m_clock_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1));
m_irq_w.resolve_safe();
@@ -61,10 +61,10 @@ void cdp1879_device::device_reset()
//-------------------------------------------------
-// device_timer - handler timer events
+// clock_tick - advance the clock
//-------------------------------------------------
-void cdp1879_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(cdp1879_device::clock_tick)
{
advance_seconds();
diff --git a/src/devices/machine/cdp1879.h b/src/devices/machine/cdp1879.h
index 7b839cc8d44..4dc761b5fd7 100644
--- a/src/devices/machine/cdp1879.h
+++ b/src/devices/machine/cdp1879.h
@@ -29,7 +29,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_rtc_interface overrides
virtual void rtc_clock_updated(int year, int month, int day, int day_of_week, int hour, int minute, int second) override;
@@ -38,6 +37,8 @@ protected:
void set_irq(int bit);
void update_rtc();
+ TIMER_CALLBACK_MEMBER(clock_tick);
+
private:
// registers
enum
diff --git a/src/devices/machine/clock.cpp b/src/devices/machine/clock.cpp
index 9c0fd67a3ef..4c2ad3afd7a 100644
--- a/src/devices/machine/clock.cpp
+++ b/src/devices/machine/clock.cpp
@@ -44,8 +44,8 @@ void clock_device::device_start()
save_item(NAME(m_thigh));
save_item(NAME(m_tlow));
- m_timer_init = timer_alloc(TID_CLOCK_INIT);
- m_timer_tick = timer_alloc(TID_CLOCK_TICK);
+ m_timer_init = timer_alloc(FUNC(clock_device::clock_init), this);
+ m_timer_tick = timer_alloc(FUNC(clock_device::clock_tick), this);
reinit();
}
@@ -67,77 +67,67 @@ void clock_device::output()
}
}
-void clock_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(clock_device::clock_init)
{
- switch (id)
+ attotime period = (m_clock > 0) ? attotime::from_hz(m_clock) : m_period;
+ assert(!period.is_zero());
+
+ if (period.is_never())
+ {
+ m_timer_tick->adjust(attotime::never);
+ return;
+ }
+
+ if (!m_pw.is_never())
{
- case TID_CLOCK_INIT:
+ // set timing via pulse width
+ attotime pw = m_pw;
+ if (pw > period)
+ pw = period;
+
+ m_thigh = pw;
+ m_tlow = period - pw;
+ }
+ else
+ {
+ // set timing via duty cycle
+ if (m_duty == 0.5)
{
- attotime period = (m_clock > 0) ? attotime::from_hz(m_clock) : m_period;
- assert(!period.is_zero());
-
- if (period.is_never())
- {
- m_timer_tick->adjust(attotime::never);
- return;
- }
-
- if (!m_pw.is_never())
- {
- // set timing via pulse width
- attotime pw = m_pw;
- if (pw > period)
- pw = period;
-
- m_thigh = pw;
- m_tlow = period - pw;
- }
- else
- {
- // set timing via duty cycle
- if (m_duty == 0.5)
- {
- m_thigh = period / 2;
- m_tlow = m_thigh;
- }
- else if (m_duty == 0.0)
- {
- m_thigh = attotime::zero;
- m_tlow = period;
- }
- else if (m_duty == 1.0)
- {
- m_thigh = period;
- m_tlow = attotime::zero;
- }
- else
- {
- double p = period.as_double();
- m_thigh = attotime::from_double(m_duty * p);
- m_tlow = attotime::from_double((1.0 - m_duty) * p);
- }
- }
-
- attotime next = m_signal ? m_thigh : m_tlow;
- if (next < m_timer_tick->remaining())
- m_timer_tick->adjust(next);
-
- break;
+ m_thigh = period / 2;
+ m_tlow = m_thigh;
}
+ else if (m_duty == 0.0)
+ {
+ m_thigh = attotime::zero;
+ m_tlow = period;
+ }
+ else if (m_duty == 1.0)
+ {
+ m_thigh = period;
+ m_tlow = attotime::zero;
+ }
+ else
+ {
+ double p = period.as_double();
+ m_thigh = attotime::from_double(m_duty * p);
+ m_tlow = attotime::from_double((1.0 - m_duty) * p);
+ }
+ }
- case TID_CLOCK_TICK:
- if (m_thigh.is_zero())
- m_signal = 0;
- else if (m_tlow.is_zero())
- m_signal = 1;
- else
- m_signal ^= 1;
-
- m_timer_tick->adjust(m_signal ? m_thigh : m_tlow);
- output();
- break;
+ attotime next = m_signal ? m_thigh : m_tlow;
+ if (next < m_timer_tick->remaining())
+ m_timer_tick->adjust(next);
+}
- default:
- break;
- }
+TIMER_CALLBACK_MEMBER(clock_device::clock_tick)
+{
+ if (m_thigh.is_zero())
+ m_signal = 0;
+ else if (m_tlow.is_zero())
+ m_signal = 1;
+ else
+ m_signal ^= 1;
+
+ m_timer_tick->adjust(m_signal ? m_thigh : m_tlow);
+ output();
}
diff --git a/src/devices/machine/clock.h b/src/devices/machine/clock.h
index 27270653a32..1dc4739ce6c 100644
--- a/src/devices/machine/clock.h
+++ b/src/devices/machine/clock.h
@@ -26,13 +26,12 @@ public:
protected:
virtual void device_start() override;
virtual void device_reset() override { output(); }
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_clock_changed() override { reinit(); }
-private:
- static constexpr device_timer_id TID_CLOCK_INIT = 0;
- static constexpr device_timer_id TID_CLOCK_TICK = 1;
+ TIMER_CALLBACK_MEMBER(clock_init);
+ TIMER_CALLBACK_MEMBER(clock_tick);
+private:
void reinit();
void output();
diff --git a/src/devices/machine/com8116.cpp b/src/devices/machine/com8116.cpp
index 5ad58710e85..38364b4b101 100644
--- a/src/devices/machine/com8116.cpp
+++ b/src/devices/machine/com8116.cpp
@@ -142,11 +142,11 @@ void com8116_device::device_start()
// allocate timers
if (!m_fx4_handler.isnull())
{
- m_fx4_timer = timer_alloc(TIMER_FX4);
+ m_fx4_timer = timer_alloc(FUNC(com8116_device::fx4_tick), this);
m_fx4_timer->adjust(attotime::from_hz((clock() / 4) * 2), 0, attotime::from_hz((clock() / 4)) * 2);
}
- m_fr_timer = timer_alloc(TIMER_FR);
- m_ft_timer = timer_alloc(TIMER_FT);
+ m_fr_timer = timer_alloc(FUNC(com8116_device::fr_tick), this);
+ m_ft_timer = timer_alloc(FUNC(com8116_device::ft_tick), this);
for (int i = 0; i < 16; i++)
LOGMASKED(LOG_TABLE, "Output Frequency %01X: 16X %f Hz\n", i, double(clock()) / m_divisors[i] / 16.0);
@@ -171,28 +171,35 @@ void com8116_device::device_reset()
//-------------------------------------------------
-// device_timer - handler timer events
+// fx4_tick - toggle the FX4 timer output
//-------------------------------------------------
-void com8116_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(com8116_device::fx4_tick)
{
- switch (id)
- {
- case TIMER_FX4:
- m_fx4 = !m_fx4;
- m_fx4_handler(m_fx4);
- break;
-
- case TIMER_FR:
- m_fr = !m_fr;
- m_fr_handler(m_fr);
- break;
-
- case TIMER_FT:
- m_ft = !m_ft;
- m_ft_handler(m_ft);
- break;
- }
+ m_fx4 = !m_fx4;
+ m_fx4_handler(m_fx4);
+}
+
+
+//-------------------------------------------------
+// fr_tick - toggle the FR timer output
+//-------------------------------------------------
+
+TIMER_CALLBACK_MEMBER(com8116_device::fr_tick)
+{
+ m_fr = !m_fr;
+ m_fr_handler(m_fr);
+}
+
+
+//-------------------------------------------------
+// ft_tick - toggle the FT timer output
+//-------------------------------------------------
+
+TIMER_CALLBACK_MEMBER(com8116_device::ft_tick)
+{
+ m_ft = !m_ft;
+ m_ft_handler(m_ft);
}
diff --git a/src/devices/machine/com8116.h b/src/devices/machine/com8116.h
index 13131b85f41..908d7c782d2 100644
--- a/src/devices/machine/com8116.h
+++ b/src/devices/machine/com8116.h
@@ -63,16 +63,12 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int m_param) override;
-private:
- enum
- {
- TIMER_FX4,
- TIMER_FR,
- TIMER_FT
- };
+ TIMER_CALLBACK_MEMBER(fx4_tick);
+ TIMER_CALLBACK_MEMBER(fr_tick);
+ TIMER_CALLBACK_MEMBER(ft_tick);
+private:
devcb_write_line m_fx4_handler;
devcb_write_line m_fr_handler;
devcb_write_line m_ft_handler;
diff --git a/src/devices/machine/cop452.cpp b/src/devices/machine/cop452.cpp
index 7d1da25efe3..87e2d0954d5 100644
--- a/src/devices/machine/cop452.cpp
+++ b/src/devices/machine/cop452.cpp
@@ -20,7 +20,7 @@
DEFINE_DEVICE_TYPE(COP452, cop452_device, "cop452", "National Semiconductor COP452 frequency generator")
cop452_device::cop452_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
-: device_t(mconfig , COP452 , tag , owner , clock)
+: device_t(mconfig, COP452, tag, owner, clock)
, m_out_handlers(*this)
{
}
@@ -39,7 +39,7 @@ WRITE_LINE_MEMBER(cop452_device::sk_w)
{
if (!m_cs && !m_sk && state) {
// Rising edge on SK
- LOG("bit %d %u\n" , m_di , m_spi_state);
+ LOG("bit %d %u\n", m_di, m_spi_state);
if (m_spi_state == 0 && m_di) {
// Got start bit
m_spi_state = 1;
@@ -48,31 +48,31 @@ WRITE_LINE_MEMBER(cop452_device::sk_w)
m_sr = (m_sr << 1) | m_di;
m_spi_state++;
if (m_spi_state == 6) {
- LOG("Inst = %x\n" , m_sr);
+ LOG("Inst = %x\n", m_sr);
m_spi_state = 22;
- unsigned idx = !BIT(m_sr , 0);
+ unsigned idx = !BIT(m_sr, 0);
char reg = idx ? 'B' : 'A';
switch (m_sr) {
case 0b00000:
case 0b00001:
// LDRA/B
- LOG("LDR%c\n" , reg);
+ LOG("LDR%c\n", reg);
m_spi_state = 6;
- m_reg[ idx ] = 0;
+ m_reg[idx] = 0;
break;
case 0b00010:
case 0b00011:
// RDRA/B
// TODO: not implemented ATM
- LOG("RDR%c\n" , reg);
+ LOG("RDR%c\n", reg);
break;
case 0b00100:
case 0b00101:
// TRCA/B
- LOG("TRC%c\n" , reg);
- m_cnt[ idx ] = m_reg[ idx ];
+ LOG("TRC%c\n", reg);
+ m_cnt[idx] = m_reg[idx];
set_timer(idx);
break;
@@ -80,7 +80,7 @@ WRITE_LINE_MEMBER(cop452_device::sk_w)
case 0b00111:
// TCRA/B
// TODO:
- LOG("TCR%c\n" , reg);
+ LOG("TCR%c\n", reg);
break;
case 0b01000:
@@ -99,17 +99,17 @@ WRITE_LINE_MEMBER(cop452_device::sk_w)
if (m_sr & 0b10000) {
// LDM
m_mode = m_sr & 0b01111;
- LOG("LDM %x\n" , m_mode);
+ LOG("LDM %x\n", m_mode);
set_timer(0);
set_timer(1);
if (m_mode == MODE_NUMBER_PULSES) {
// Always start with OA = 1
- set_output(0 , true);
+ set_output(0, true);
} else if (m_mode == MODE_WHITE_NOISE ||
m_mode == MODE_GATED_WHITE) {
// Preset bit 15 & 16 of register A when entering
// white noise modes
- m_reg[ 0 ] |= 0x8000;
+ m_reg[0] |= 0x8000;
m_regA_b16 = true;
}
} else {
@@ -121,12 +121,11 @@ WRITE_LINE_MEMBER(cop452_device::sk_w)
}
} else if (m_spi_state >= 6 && m_spi_state < 22) {
// Loading A/B register
- unsigned idx = !BIT(m_sr , 0);
- char reg = idx ? 'B' : 'A';
- m_reg[ idx ] = (m_reg[ idx ] << 1) | m_di;
+ unsigned idx = !BIT(m_sr, 0);
+ m_reg[idx] = (m_reg[idx] << 1) | m_di;
m_spi_state++;
if (m_spi_state == 22) {
- LOG("REG%c = %04x\n" , reg , m_reg[ idx ]);
+ LOG("REG%c = %04x\n", idx ? 'B' : 'A', m_reg[idx]);
}
}
}
@@ -148,8 +147,8 @@ void cop452_device::device_start()
{
m_out_handlers.resolve_all_safe();
- m_timers[ 0 ] = timer_alloc(0);
- m_timers[ 1 ] = timer_alloc(1);
+ m_timers[0] = timer_alloc(FUNC(cop452_device::timer_tick), this);
+ m_timers[1] = timer_alloc(FUNC(cop452_device::timer_tick), this);
save_item(NAME(m_mode));
save_item(NAME(m_clk_div_4));
@@ -169,20 +168,20 @@ void cop452_device::device_reset()
// Set reset mode
m_mode = MODE_RESET;
m_clk_div_4 = true;
- m_out[ 0 ] = m_out[ 1 ] = true;
- set_output(0 , false);
- set_output(1 , false);
+ m_out[0] = m_out[1] = true;
+ set_output(0, false);
+ set_output(1, false);
m_spi_state = 0;
m_sr = 0;
- m_timers[ 0 ]->reset();
- m_timers[ 1 ]->reset();
+ m_timers[0]->reset();
+ m_timers[1]->reset();
}
-void cop452_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(cop452_device::timer_tick)
{
switch (m_mode) {
case MODE_DUAL_FREQ:
- toggle_n_reload(id);
+ toggle_n_reload(param);
break;
case MODE_TRIG_PULSE:
@@ -190,12 +189,12 @@ void cop452_device::device_timer(emu_timer &timer, device_timer_id id, int param
break;
case MODE_NUMBER_PULSES:
- if (id == 0) {
+ if (param == 0) {
toggle_n_reload(0);
- if (!m_out[ 0 ]) {
+ if (!m_out[0]) {
// It seems that cnt B decrements each time OA goes low
- if (m_cnt[ 1 ] != 0) {
- m_cnt[ 1 ]--;
+ if (m_cnt[1] != 0) {
+ m_cnt[1]--;
} else {
// End of pulse train
toggle_n_reload(1);
@@ -228,22 +227,22 @@ void cop452_device::device_timer(emu_timer &timer, device_timer_id id, int param
case MODE_WHITE_NOISE:
case MODE_GATED_WHITE:
{
- if (id == 0) {
+ if (param == 0) {
// Reg A & its 17th bit (m_regA_b16) form a 17-bit LFSR
// LFSR uses X^17+X^14+1 polynomial to generate a pseudo-random
// maximal-length sequence
- bool feedback = m_regA_b16 ^ BIT(m_reg[ 0 ] , 13);
- m_regA_b16 = BIT(m_reg[ 0 ] , 15);
- m_reg[ 0 ] <<= 1;
- m_reg[ 0 ] |= feedback;
+ bool feedback = m_regA_b16 ^ BIT(m_reg[0], 13);
+ m_regA_b16 = BIT(m_reg[0], 15);
+ m_reg[0] <<= 1;
+ m_reg[0] |= feedback;
} else {
toggle_n_reload(1);
}
bool new_out_0 = m_regA_b16;
if (m_mode == MODE_GATED_WHITE) {
- new_out_0 &= m_out[ 1 ];
+ new_out_0 &= m_out[1];
}
- set_output(0 , new_out_0);
+ set_output(0, new_out_0);
}
break;
@@ -251,7 +250,7 @@ void cop452_device::device_timer(emu_timer &timer, device_timer_id id, int param
break;
}
- set_timer(id);
+ set_timer(param);
}
attotime cop452_device::counts_to_attotime(unsigned counts) const
@@ -270,7 +269,7 @@ void cop452_device::set_timer(unsigned idx)
switch (m_mode) {
case MODE_DUAL_FREQ:
// Cnt A & B count independently
- target = counts_to_attotime(m_cnt[ idx ]);
+ target = counts_to_attotime(m_cnt[idx]);
break;
case MODE_TRIG_PULSE:
@@ -281,7 +280,7 @@ void cop452_device::set_timer(unsigned idx)
// Cnt A generates OA frequency
// Cnt B counts the periods to output
if (idx == 0) {
- target = counts_to_attotime(m_cnt[ 0 ]);
+ target = counts_to_attotime(m_cnt[0]);
}
break;
@@ -312,7 +311,7 @@ void cop452_device::set_timer(unsigned idx)
if (idx == 0) {
target = counts_to_attotime(0);
} else {
- target = counts_to_attotime(m_cnt[ 1 ]);
+ target = counts_to_attotime(m_cnt[1]);
}
break;
@@ -320,26 +319,26 @@ void cop452_device::set_timer(unsigned idx)
break;
}
- m_timers[ idx ]->adjust(target);
+ m_timers[idx]->adjust(target, idx);
}
-void cop452_device::set_output(unsigned idx , bool state)
+void cop452_device::set_output(unsigned idx, bool state)
{
- if (m_out[ idx ] != state) {
- m_out[ idx ] = state;
- LOG("OUT %u=%d @%s\n" , idx , state , machine().time().as_string());
- m_out_handlers[ idx ](state);
+ if (m_out[idx] != state) {
+ m_out[idx] = state;
+ LOG("OUT %u=%d @%s\n", idx, state, machine().time().as_string());
+ m_out_handlers[idx](state);
}
}
void cop452_device::toggle_output(unsigned idx)
{
- set_output(idx , !m_out[ idx ]);
+ set_output(idx, !m_out[idx]);
}
void cop452_device::toggle_n_reload(unsigned idx)
{
// Toggle output OA/OB and reload its associated counter
toggle_output(idx);
- m_cnt[ idx ] = m_reg[ idx ];
+ m_cnt[idx] = m_reg[idx];
}
diff --git a/src/devices/machine/cop452.h b/src/devices/machine/cop452.h
index 048c8c7d5cd..238e5c8b5ca 100644
--- a/src/devices/machine/cop452.h
+++ b/src/devices/machine/cop452.h
@@ -35,21 +35,22 @@ public:
DECLARE_READ_LINE_MEMBER(do_r);
// Signal outputs
- auto oa_w() { return m_out_handlers[ 0 ].bind(); }
- auto ob_w() { return m_out_handlers[ 1 ].bind(); }
+ auto oa_w() { return m_out_handlers[0].bind(); }
+ auto ob_w() { return m_out_handlers[1].bind(); }
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(timer_tick);
private:
// Index 0 is for "A" side, 1 is for "B" side
devcb_write_line::array<2> m_out_handlers;
// Timers
- emu_timer *m_timers[ 2 ];
+ emu_timer *m_timers[2];
// State
uint8_t m_mode;
@@ -57,10 +58,10 @@ private:
bool m_cs;
bool m_sk;
bool m_di;
- bool m_out[ 2 ];
+ bool m_out[2];
bool m_regA_b16;
- uint16_t m_reg[ 2 ];
- uint16_t m_cnt[ 2 ];
+ uint16_t m_reg[2];
+ uint16_t m_cnt[2];
// 0 : idle
// 1..5 : shifting instruction in
// 6..21: shifting register in
@@ -70,22 +71,22 @@ private:
// Operating modes
enum : uint8_t {
- MODE_DUAL_FREQ, // 0000 Dual frequency
- MODE_TRIG_PULSE, // 0001 Triggered pulse
- MODE_NUMBER_PULSES, // 0010 Number of pulses
- MODE_DUTY_CYCLE, // 0011 Duty cycle
- MODE_FREQ_COUNT, // 0100 Frequency and count
- MODE_DUAL_COUNT, // 0101 Dual count
- MODE_WAVE_MEAS, // 0110 Waveform measurement
- MODE_TRIG_COUNT, // 0111 Triggered pulse and count
- MODE_WHITE_NOISE, // 1000 White noise & frequency
- MODE_GATED_WHITE, // 1001 Gated white noise
- MODE_RESET = 15 // 1111 Reset
+ MODE_DUAL_FREQ, // 0000 Dual frequency
+ MODE_TRIG_PULSE, // 0001 Triggered pulse
+ MODE_NUMBER_PULSES, // 0010 Number of pulses
+ MODE_DUTY_CYCLE, // 0011 Duty cycle
+ MODE_FREQ_COUNT, // 0100 Frequency and count
+ MODE_DUAL_COUNT, // 0101 Dual count
+ MODE_WAVE_MEAS, // 0110 Waveform measurement
+ MODE_TRIG_COUNT, // 0111 Triggered pulse and count
+ MODE_WHITE_NOISE, // 1000 White noise & frequency
+ MODE_GATED_WHITE, // 1001 Gated white noise
+ MODE_RESET = 15 // 1111 Reset
};
attotime counts_to_attotime(unsigned counts) const;
void set_timer(unsigned idx);
- void set_output(unsigned idx , bool state);
+ void set_output(unsigned idx, bool state);
void toggle_output(unsigned idx);
void toggle_n_reload(unsigned idx);
};
diff --git a/src/devices/machine/corvushd.cpp b/src/devices/machine/corvushd.cpp
index f4194cdfb46..b0c819b33f8 100644
--- a/src/devices/machine/corvushd.cpp
+++ b/src/devices/machine/corvushd.cpp
@@ -67,6 +67,10 @@
#include "emu.h"
#include "machine/corvushd.h"
+#define LOG_RESPONSES (1U << 1)
+
+#define VERBOSE (0)
+#include "logmacro.h"
//
// Controller Commands
@@ -241,8 +245,6 @@ corvus_hdc_device::corvus_hdc_device(const machine_config &mconfig, const char *
{
}
-#define VERBOSE 0
-#define VERBOSE_RESPONSES 0
#define ROM_VERSION 1 // Controller ROM version
#define MAX_COMMAND_SIZE 4096 // The maximum size of a command packet (the controller only has 5K of RAM...)
#define SPARE_TRACKS 7 // This is a Rev B drive, so 7 it is
@@ -254,8 +256,7 @@ corvus_hdc_device::corvus_hdc_device(const machine_config &mconfig, const char *
#define INTERBYTE_DELAY 5 // Inter-byte delay in microseconds communicating between controller and host
#define INTERSECTOR_DELAY 25000 // 25ms delay between sectors (4800 RPM = 80 Rev/Second. Maximum 2 sectors transferred / Rev)
-#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
-#define LOG_BUFFER(p,s) do { if (VERBOSE) dump_buffer(p,s); } while (0)
+#define LOG_BUFFER(p,s) do { if (VERBOSE & LOG_RESPONSES) dump_buffer(p,s); } while (0)
@@ -272,26 +273,26 @@ corvus_hdc_device::corvus_hdc_device(const machine_config &mconfig, const char *
// nada
//
void corvus_hdc_device::dump_buffer(uint8_t *buffer, uint16_t length) {
- uint16_t offset;
- char ascii_dump[16];
-
- logerror("dump_buffer: Dump of %d bytes:\n", length);
- logerror("Base 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f ASCII\n");
- logerror("---- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ----------------");
-
- for(offset=0; offset < length; offset++) {
- if(offset % 16 == 0) { // WHY IS 0 % 16 == 0???
- if(offset > 0 && offset % 16 == 0)
- logerror("%16.16s", ascii_dump);
- logerror("\n%4.4x: %2.2x ", offset, *(buffer + offset));
- } else {
- logerror("%2.2x ", *(buffer + offset));
+ LOGMASKED(LOG_RESPONSES, "dump_buffer: Dump of %d bytes:\n", length);
+ LOGMASKED(LOG_RESPONSES, "Base 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f ASCII\n");
+ LOGMASKED(LOG_RESPONSES, "---- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ----------------");
+
+ char data_buf[128];
+ char ascii_buf[17];
+ for(uint16_t offset = 0; offset < length; offset += 16) {
+ int buf_offset = 0;
+ for(uint8_t byte_idx = 0; byte_idx < 16 && (offset + byte_idx) < length; byte_idx++) {
+ sprintf(data_buf + buf_offset, "%02x ", *(buffer + offset));
+ ascii_buf[byte_idx] = isprint(*(buffer + offset)) ? *(buffer + offset) : '.';
}
- ascii_dump[offset % 16] = isprint(*(buffer + offset)) ? *(buffer + offset) : '.';
+ if((length - offset) < 16) {
+ memset(data_buf + buf_offset, 0, (length - offset) * 3);
+ buf_offset += (length - offset) * 3;
+ }
+ data_buf[buf_offset] = '\0';
+ ascii_buf[16] = '\0';
+ LOGMASKED(LOG_RESPONSES, "%04x: %s%s", offset, data_buf, ascii_buf);
}
- if(offset % 16)
- logerror("%.*s", (16 - (offset % 16)) * 3, " ");
- logerror("%.*s\n", (offset % 16) ? (offset % 16) : 16, ascii_dump);
}
@@ -314,7 +315,7 @@ void corvus_hdc_device::dump_buffer(uint8_t *buffer, uint16_t length) {
bool corvus_hdc_device::parse_hdc_command(uint8_t data) {
m_awaiting_modifier = false; // This is the case by definition
- LOG(("parse_hdc_command: Called with data: 0x%2.2x, Prep mode is: %d\n", data, m_prep_mode));
+ LOG("parse_hdc_command: Called with data: 0x%2.2x, Prep mode is: %d\n", data, m_prep_mode);
if(!m_prep_mode) {
switch(data) {
@@ -340,8 +341,8 @@ bool corvus_hdc_device::parse_hdc_command(uint8_t data) {
case PREP_MODE_SELECT:
m_recv_bytes = corvus_cmd[data][0].recv_bytes;
m_xmit_bytes = corvus_cmd[data][0].xmit_bytes;
- LOG(("parse_hdc_command: Single byte command recognized: 0x%2.2x, to recv: %d, to xmit: %d\n", data,
- m_recv_bytes, m_xmit_bytes));
+ LOG("parse_hdc_command: Single byte command recognized: 0x%2.2x, to recv: %d, to xmit: %d\n", data,
+ m_recv_bytes, m_xmit_bytes);
break;
//
// Double-byte commands
@@ -363,13 +364,13 @@ bool corvus_hdc_device::parse_hdc_command(uint8_t data) {
// case DELACTIVENUM_OMNI_CODE:
// case FINDACTIVE_CODE:
m_awaiting_modifier = true;
- LOG(("parse_hdc_command: Double byte command recognized: 0x%2.2x\n", data));
+ LOG("parse_hdc_command: Double byte command recognized: 0x%2.2x\n", data);
break;
default: // This is an INVALID command
m_recv_bytes = 1;
m_xmit_bytes = 1;
- LOG(("parse_hdc_command: Invalid command detected: 0x%2.2x\n", data));
+ LOG("parse_hdc_command: Invalid command detected: 0x%2.2x\n", data);
return true;
}
} else {
@@ -386,14 +387,14 @@ bool corvus_hdc_device::parse_hdc_command(uint8_t data) {
case PREP_WRITE_FIRMWARE:
m_recv_bytes = corvus_prep_cmd[data].recv_bytes;
m_xmit_bytes = corvus_prep_cmd[data].xmit_bytes;
- LOG(("parse_hdc_command: Prep command recognized: 0x%2.2x, to recv: %d, to xmit: %d\n", data,
- m_recv_bytes, m_xmit_bytes));
+ LOG("parse_hdc_command: Prep command recognized: 0x%2.2x, to recv: %d, to xmit: %d\n", data,
+ m_recv_bytes, m_xmit_bytes);
break;
default: // This is an INVALID prep command
m_recv_bytes = 1;
m_xmit_bytes = 1;
- LOG(("parse_hdc_command: Invalid Prep command detected: 0x%2.2x\n", data));
+ LOG("parse_hdc_command: Invalid Prep command detected: 0x%2.2x\n", data);
return true;
}
} // if(!prep_mode)
@@ -423,7 +424,7 @@ uint8_t corvus_hdc_device::corvus_write_sector(uint8_t drv, uint32_t sector, uin
uint8_t tbuffer[512]; // Buffer to hold an entire sector
uint16_t cylinder; // Cylinder this sector resides on
- LOG(("corvus_write_sector: Write Drive: %d, physical sector: 0x%5.5x\n", drv, sector));
+ LOG("corvus_write_sector: Write Drive: %d, physical sector: 0x%5.5x\n", drv, sector);
disk = corvus_hdc_file(drv);
if(!disk) {
@@ -454,7 +455,7 @@ uint8_t corvus_hdc_device::corvus_write_sector(uint8_t drv, uint32_t sector, uin
m_last_cylinder = cylinder;
- LOG(("corvus_write_sector: Full sector dump on a write of %d bytes follows:\n", len));
+ LOG("corvus_write_sector: Full sector dump on a write of %d bytes follows:\n", len);
LOG_BUFFER(len == 512 ? buffer : tbuffer, 512);
return STAT_SUCCESS;
@@ -491,8 +492,8 @@ uint8_t corvus_hdc_device::corvus_write_logical_sector(dadr_t *dadr, uint8_t *bu
drv = (dadr->address_msn_and_drive & 0x0f);
sector = (dadr->address_msn_and_drive & 0xf0 << 12) | (dadr->address_mid << 8) | dadr->address_lsb;
- LOG(("corvus_write_logical_sector: Writing based on DADR: 0x%6.6x, logical sector: 0x%5.5x, drive: %d\n",
- dadr->address_msn_and_drive << 16 | dadr->address_lsb << 8 | dadr->address_mid, sector, drv));
+ LOG("corvus_write_logical_sector: Writing based on DADR: 0x%6.6x, logical sector: 0x%5.5x, drive: %d\n",
+ dadr->address_msn_and_drive << 16 | dadr->address_lsb << 8 | dadr->address_mid, sector, drv);
// Set m_tracks_per_cylinder and m_sectors_per_track
corvus_hdc_file(drv);
@@ -531,7 +532,7 @@ uint8_t corvus_hdc_device::corvus_read_sector(uint8_t drv, uint32_t sector, uint
uint8_t tbuffer[512]; // Buffer to store full sector results in
uint16_t cylinder;
- LOG(("corvus_read_sector: Read Drive: %d, physical sector: 0x%5.5x\n", drv, sector));
+ LOG("corvus_read_sector: Read Drive: %d, physical sector: 0x%5.5x\n", drv, sector);
disk = corvus_hdc_file(drv);
if(!disk) {
@@ -551,7 +552,7 @@ uint8_t corvus_hdc_device::corvus_read_sector(uint8_t drv, uint32_t sector, uint
m_last_cylinder = cylinder;
- LOG(("corvus_read_sector: Data read follows:\n"));
+ LOG("corvus_read_sector: Data read follows:\n");
LOG_BUFFER(tbuffer, len);
return STAT_SUCCESS;
@@ -588,8 +589,8 @@ uint8_t corvus_hdc_device::corvus_read_logical_sector(dadr_t *dadr, uint8_t *buf
drv = (dadr->address_msn_and_drive & 0x0f);
sector = (dadr->address_msn_and_drive & 0xf0 << 12) | (dadr->address_mid << 8) | dadr->address_lsb;
- LOG(("corvus_read_logical_sector: Reading based on DADR: 0x%6.6x, logical sector: 0x%5.5x, drive: %d\n",
- dadr->address_msn_and_drive << 16 | dadr->address_lsb << 8 | dadr->address_mid, sector, drv));
+ LOG("corvus_read_logical_sector: Reading based on DADR: 0x%6.6x, logical sector: 0x%5.5x, drive: %d\n",
+ dadr->address_msn_and_drive << 16 | dadr->address_lsb << 8 | dadr->address_mid, sector, drv);
// Set up m_tracks_per_cylinder and m_sectors_per_track
corvus_hdc_file(drv);
@@ -887,7 +888,7 @@ uint8_t corvus_hdc_device::corvus_get_drive_parameters(uint8_t drv) {
m_buffer.drive_param_response.physical_capacity.midb = (raw_capacity & 0x00ff00) >> 8;
m_buffer.drive_param_response.physical_capacity.lsb = (raw_capacity & 0x0000ff);
- LOG(("corvus_get_drive_parameters: Drive Parameter packet follows:\n"));
+ LOG("corvus_get_drive_parameters: Drive Parameter packet follows:\n");
LOG_BUFFER(m_buffer.raw_data, 110);
return STAT_SUCCESS;
@@ -907,7 +908,7 @@ uint8_t corvus_hdc_device::corvus_get_drive_parameters(uint8_t drv) {
// status: Status of read operation
//
uint8_t corvus_hdc_device::corvus_read_boot_block(uint8_t block) {
- LOG(("corvus_read_boot_block: Reading boot block: %d\n", block));
+ LOG("corvus_read_boot_block: Reading boot block: %d\n", block);
return corvus_read_sector(1, 25 + block, m_buffer.read_512_response.data, 512);
}
@@ -957,7 +958,7 @@ uint8_t corvus_hdc_device::corvus_enter_prep_mode(uint8_t drv, uint8_t *prep_blo
return STAT_FATAL_ERR | STAT_DRIVE_NOT_ONLINE;
}
- LOG(("corvus_enter_prep_mode: Prep mode entered for drive %d, prep block follows:\n", drv));
+ LOG("corvus_enter_prep_mode: Prep mode entered for drive %d, prep block follows:\n", drv);
LOG_BUFFER(prep_block, 512);
m_prep_mode = true;
@@ -976,7 +977,7 @@ uint8_t corvus_hdc_device::corvus_enter_prep_mode(uint8_t drv, uint8_t *prep_blo
// Status of command (always success)
//
uint8_t corvus_hdc_device::corvus_exit_prep_mode() {
- LOG(("corvus_exit_prep_mode: Prep mode exited\n"));
+ LOG("corvus_exit_prep_mode: Prep mode exited\n");
m_prep_mode = false;
m_prep_drv = 0;
return STAT_SUCCESS;
@@ -1002,8 +1003,8 @@ uint8_t corvus_hdc_device::corvus_read_firmware_block(uint8_t head, uint8_t sect
relative_sector = head * m_sectors_per_track + sector;
- LOG(("corvus_read_firmware_block: Reading firmware head: 0x%2.2x, sector: 0x%2.2x, relative_sector: 0x%2.2x\n",
- head, sector, relative_sector));
+ LOG("corvus_read_firmware_block: Reading firmware head: 0x%2.2x, sector: 0x%2.2x, relative_sector: 0x%2.2x\n",
+ head, sector, relative_sector);
status = corvus_read_sector(m_prep_drv, relative_sector, m_buffer.read_512_response.data, 512);
return status;
@@ -1030,8 +1031,8 @@ uint8_t corvus_hdc_device::corvus_write_firmware_block(uint8_t head, uint8_t sec
relative_sector = head * m_sectors_per_track + sector;
- LOG(("corvus_write_firmware_block: Writing firmware head: 0x%2.2x, sector: 0x%2.2x, relative_sector: 0x%2.2x\n",
- head, sector, relative_sector));
+ LOG("corvus_write_firmware_block: Writing firmware head: 0x%2.2x, sector: 0x%2.2x, relative_sector: 0x%2.2x\n",
+ head, sector, relative_sector);
status = corvus_write_sector(m_prep_drv, relative_sector, buffer, 512);
return status;
@@ -1069,7 +1070,7 @@ uint8_t corvus_hdc_device::corvus_format_drive(uint8_t *pattern, uint16_t len) {
pattern = tbuffer;
}
- LOG(("corvus_format_drive: Formatting drive with 0x%5.5x sectors, pattern buffer (passed length: %d) follows\n", max_sector, 512));
+ LOG("corvus_format_drive: Formatting drive with 0x%5.5x sectors, pattern buffer (passed length: %d) follows\n", max_sector, 512);
LOG_BUFFER(pattern, 512);
for(sector = 0; sector <= max_sector; sector++) {
@@ -1124,7 +1125,7 @@ hard_disk_file *corvus_hdc_device::corvus_hdc_file(int drv) {
m_tracks_per_cylinder = info.heads;
m_cylinders_per_drive = info.cylinders;
- LOG(("corvus_hdc_file: Attached to drive %u image: H:%d, C:%d, S:%d\n", drv, info.heads, info.cylinders, info.sectors));
+ LOG("corvus_hdc_file: Attached to drive %u image: H:%d, C:%d, S:%d\n", drv, info.heads, info.cylinders, info.sectors);
return file;
}
@@ -1143,11 +1144,8 @@ hard_disk_file *corvus_hdc_device::corvus_hdc_file(int drv) {
// Nothing
//
void corvus_hdc_device::corvus_process_command_packet(bool invalid_command_flag) {
- if (VERBOSE_RESPONSES)
- {
- LOG(("corvus_hdc_data_w: Complete packet received. Dump follows:\n"));
- LOG_BUFFER(m_buffer.raw_data, m_offset);
- }
+ LOGMASKED(LOG_RESPONSES, "corvus_hdc_data_w: Complete packet received. Dump follows:\n");
+ LOG_BUFFER(m_buffer.raw_data, m_offset);
if(!invalid_command_flag) {
if(!m_prep_mode) {
@@ -1266,12 +1264,9 @@ void corvus_hdc_device::corvus_process_command_packet(bool invalid_command_flag)
logerror("corvus_hdc_data_w: Unimplemented Prep command %02x, returning FATAL FAULT status!\n", m_buffer.command.code);
}
}
- if (VERBOSE_RESPONSES)
- {
- LOG(("corvus_hdc_data_w: Command execution complete, status: 0x%2.2x. Response dump follows:\n",
- m_buffer.single_byte_response.status));
- LOG_BUFFER(m_buffer.raw_data, m_xmit_bytes);
- }
+ LOGMASKED(LOG_RESPONSES, "corvus_hdc_data_w: Command execution complete, status: 0x%2.2x. Response dump follows:\n",
+ m_buffer.single_byte_response.status);
+ LOG_BUFFER(m_buffer.raw_data, m_xmit_bytes);
} // if(!invalid_command_flag)
@@ -1292,12 +1287,11 @@ void corvus_hdc_device::corvus_process_command_packet(bool invalid_command_flag)
//
m_offset = 0; // Point to beginning of buffer for response
- LOG(("corvus_hdc_data_w: Setting one-time mame timer of %d microseconds to simulate disk function\n", m_delay));
+ LOG("corvus_hdc_data_w: Setting one-time mame timer of %d microseconds to simulate disk function\n", m_delay);
//
// Set up timers for command completion and timeout from host
//
- //machine.scheduler().timer_set(attotime::from_usec(m_delay), FUNC(corvus_hdc_callback), CALLBACK_CTH_MODE);
m_cmd_timer->adjust(attotime::from_usec(m_delay), CALLBACK_CTH_MODE);
m_timeout_timer->enable(0); // We've received enough data, disable the timeout timer
@@ -1305,54 +1299,51 @@ void corvus_hdc_device::corvus_process_command_packet(bool invalid_command_flag)
}
+//-------------------------------------------------
+// process_timeout - handle a command timeout
+//-------------------------------------------------
-//
-// Corvus_HDC_Callback
-//
-// Callback routine for completion of controller functions
-//
-// Pass:
-// Callback Function
-//
-// Returns:
-// Nothing
-//
-void corvus_hdc_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
+TIMER_CALLBACK_MEMBER(corvus_hdc_device::process_timeout) {
+ if(m_offset < m_recv_bytes || (m_offset > m_recv_bytes && m_recv_bytes != 0)) {
+ m_buffer.single_byte_response.status = STAT_TIMEOUT;
+ m_status |= CONTROLLER_DIRECTION;
+ m_status &= ~(CONTROLLER_BUSY);
+ m_recv_bytes = 0;
+ m_xmit_bytes = 1;
+ logerror("corvus_hdc_callback: Exceeded four-second timeout for data from host, resetting communications\n");
+ } else { // if(m_recv_bytes == 0) This was a variable-size command
+ LOG("corvus_hdc_callback: Executing variable-length command via four-second timeout\n");
+ corvus_process_command_packet(0); // Process the command
+ }
+}
+
+//-------------------------------------------------
+// complete_function - callback to complete a
+// controller function
+//-------------------------------------------------
+
+TIMER_CALLBACK_MEMBER(corvus_hdc_device::complete_function) {
int function = param;
- switch(function) {
+ switch (param) {
case CALLBACK_CTH_MODE:
m_status |= CONTROLLER_DIRECTION; // Set to Controller-to-Host, Ready mode
m_status &= ~(CONTROLLER_BUSY);
- LOG(("corvus_hdc_callback: Callback executed with function CALLBACK_CTH_MODE\n"));
-
+ LOG("corvus_hdc_callback: Callback executed with function CALLBACK_CTH_MODE\n");
break;
+
case CALLBACK_HTC_MODE:
m_status &= ~(CONTROLLER_DIRECTION |
CONTROLLER_BUSY); // Set to Host-to-Controller, Ready mode
- LOG(("corvus_hdc_callback: Callback executed with function CALLBACK_HTC_MODE\n"));
-
+ LOG("corvus_hdc_callback: Callback executed with function CALLBACK_HTC_MODE\n");
break;
+
case CALLBACK_SAME_MODE:
m_status &= ~(CONTROLLER_BUSY); // Set the controller to Ready mode
-
- break;
- case CALLBACK_TIMEOUT: // We reached a four-second timeout threshold
- if(m_offset < m_recv_bytes || (m_offset > m_recv_bytes && m_recv_bytes != 0)) {
- m_buffer.single_byte_response.status = STAT_TIMEOUT;
- m_status |= CONTROLLER_DIRECTION;
- m_status &= ~(CONTROLLER_BUSY);
- m_recv_bytes = 0;
- m_xmit_bytes = 1;
- logerror("corvus_hdc_callback: Exceeded four-second timeout for data from host, resetting communications\n");
- } else { // if(m_recv_bytes == 0) This was a variable-size command
- LOG(("corvus_hdc_callback: Executing variable-length command via four-second timeout\n"));
- corvus_process_command_packet(0); // Process the command
- }
break;
+
default:
logerror("corvus_hdc_callback: FATAL ERROR -- Unknown callback function: %d\n", function);
assert(0);
@@ -1383,11 +1374,12 @@ void corvus_hdc_device::device_start() {
m_xmit_bytes = 0; // We don't have anything to say to the host
m_recv_bytes = 0; // We aren't waiting on additional data from the host
- m_timeout_timer = timer_alloc(TIMER_TIMEOUT); // Set up a timer to handle the four-second host-to-controller timeout
- m_timeout_timer->adjust(attotime::from_seconds(4), CALLBACK_TIMEOUT);
+ // Set up a timer to handle the four-second host-to-controller timeout
+ m_timeout_timer = timer_alloc(FUNC(corvus_hdc_device::process_timeout), this);
+ m_timeout_timer->adjust(attotime::from_seconds(4));
m_timeout_timer->enable(0); // Start this timer out disabled
- m_cmd_timer = timer_alloc(TIMER_COMMAND);
+ m_cmd_timer = timer_alloc(FUNC(corvus_hdc_device::complete_function), this);
//
// Define all of the packet sizes for the commands
@@ -1487,7 +1479,7 @@ void corvus_hdc_device::device_start() {
corvus_prep_cmd[PREP_WRITE_FIRMWARE].recv_bytes = 514;
corvus_prep_cmd[PREP_WRITE_FIRMWARE].xmit_bytes = 1;
- LOG(("corvus_hdc_init: Drive structures initialized\n"));
+ LOG("corvus_hdc_init: Drive structures initialized\n");
}
@@ -1537,7 +1529,7 @@ uint8_t corvus_hdc_device::read() {
result = m_buffer.raw_data[m_offset++];
if(m_offset == m_xmit_bytes) {
- LOG(("corvus_hdc_data_r: Finished transmitting %d bytes of data. Returning to idle mode.\n", m_xmit_bytes));
+ LOG("corvus_hdc_data_r: Finished transmitting %d bytes of data. Returning to idle mode.\n", m_xmit_bytes);
m_offset = 0; // We've reached the end of valid data
m_xmit_bytes = 0; // We don't have anything more to say
@@ -1589,12 +1581,12 @@ void corvus_hdc_device::write(uint8_t data) {
// We're supposed to be paying attention. Make a decision about the data received
//
if(m_offset == 0) { // First byte of a packet
- LOG(("corvus_hdc_data_w: Received a byte with m_offset == 0. Processing as command: 0x%2.2x\n", data));
+ LOG("corvus_hdc_data_w: Received a byte with m_offset == 0. Processing as command: 0x%2.2x\n", data);
m_invalid_command_flag = parse_hdc_command(data);
m_timeout_timer->reset((attotime::from_seconds(4)));
m_timeout_timer->enable(1); // Start our four-second timer
} else if(m_offset == 1 && m_awaiting_modifier) { // Second byte of a packet
- LOG(("corvus_hdc_data_w: Received a byte while awaiting modifier with m_offset == 0. Processing as modifier: 0x%2.2x\n", data));
+ LOG("corvus_hdc_data_w: Received a byte while awaiting modifier with m_offset == 0. Processing as modifier: 0x%2.2x\n", data);
m_awaiting_modifier = false;
m_recv_bytes = corvus_cmd[m_buffer.command.code][data].recv_bytes;
m_xmit_bytes = corvus_cmd[m_buffer.command.code][data].xmit_bytes;
diff --git a/src/devices/machine/corvushd.h b/src/devices/machine/corvushd.h
index 01af8f2bd52..13a86a40378 100644
--- a/src/devices/machine/corvushd.h
+++ b/src/devices/machine/corvushd.h
@@ -37,14 +37,15 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(process_timeout);
+ TIMER_CALLBACK_MEMBER(complete_function);
private:
static constexpr unsigned MAX_COMMAND_SIZE = 4096; // The maximum size of a command packet (the controller only has 5K of RAM...)
enum
{
- TIMER_TIMEOUT,
TIMER_COMMAND
};
@@ -56,18 +57,22 @@ private:
};
uint8_t m_status; // Controller status byte (DIRECTION + BUSY/READY)
+
// Prep mode
bool m_prep_mode; // Whether the controller is in Prep Mode or not
uint8_t m_prep_drv; // If in prep mode, Corvus drive id (1..15) being prepped
+
// Physical drive info
uint8_t m_sectors_per_track; // Number of sectors per track for this drive
uint8_t m_tracks_per_cylinder;// Number of tracks per cylinder (heads)
uint16_t m_cylinders_per_drive;// Number of cylinders per drive
+
// Command Processing
uint16_t m_offset; // Current offset into raw_data buffer
bool m_awaiting_modifier; // We've received a two-byte command and we're waiting for the mod
uint16_t m_recv_bytes; // Number of bytes expected to be received from Host
uint16_t m_xmit_bytes; // Number of bytes expected to be transmitted to host
+
// Timing-related values
uint16_t m_last_cylinder; // Last cylinder accessed - for calculating seek times
uint32_t m_delay; // Delay in microseconds for callback
diff --git a/src/devices/machine/cr511b.cpp b/src/devices/machine/cr511b.cpp
index 9199ca5389e..9eb07578de0 100644
--- a/src/devices/machine/cr511b.cpp
+++ b/src/devices/machine/cr511b.cpp
@@ -50,7 +50,6 @@ cr511b_device::cr511b_device(const machine_config &mconfig, const char *tag, dev
m_dten_handler(*this),
m_scor_handler(*this),
m_xaen_handler(*this),
- m_frame_timer(nullptr),
//m_motor(false),
m_enabled(-1),
m_cmd(-1)
@@ -70,9 +69,6 @@ void cr511b_device::device_start()
m_dten_handler.resolve_safe();
m_scor_handler.resolve_safe();
m_xaen_handler.resolve_safe();
-
- m_frame_timer = timer_alloc(0);
- m_frame_timer->adjust(attotime::never);
}
//-------------------------------------------------
@@ -83,15 +79,6 @@ void cr511b_device::device_reset()
{
}
-//-------------------------------------------------
-// device_timer - device-specific timer events
-//-------------------------------------------------
-
-void cr511b_device::device_timer(emu_timer &timer, device_timer_id tid, int param)
-{
-}
-
-
//**************************************************************************
// IMPLEMENTATION
//**************************************************************************
diff --git a/src/devices/machine/cr511b.h b/src/devices/machine/cr511b.h
index a2e4d7d1858..aae738145fd 100644
--- a/src/devices/machine/cr511b.h
+++ b/src/devices/machine/cr511b.h
@@ -63,7 +63,6 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_add_mconfig(machine_config &config) override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
private:
enum
@@ -88,8 +87,6 @@ private:
devcb_write_line m_scor_handler;
devcb_write_line m_xaen_handler;
- emu_timer *m_frame_timer;
-
//bool m_motor;
// state of lines
diff --git a/src/devices/machine/cxd1185.cpp b/src/devices/machine/cxd1185.cpp
index 02602aeb527..9417def1ff8 100644
--- a/src/devices/machine/cxd1185.cpp
+++ b/src/devices/machine/cxd1185.cpp
@@ -100,7 +100,7 @@ void cxd1185_device::device_start()
save_item(NAME(m_scsi_ctrl));
save_item(NAME(m_ioport));
- m_state_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(cxd1185_device::state_timer), this));
+ m_state_timer = timer_alloc(FUNC(cxd1185_device::state_timer), this);
m_state = IDLE;
m_irq_asserted = false;
diff --git a/src/devices/machine/diablo_hd.cpp b/src/devices/machine/diablo_hd.cpp
index c963d582989..2ce1707058c 100644
--- a/src/devices/machine/diablo_hd.cpp
+++ b/src/devices/machine/diablo_hd.cpp
@@ -1316,7 +1316,7 @@ void diablo_hd_device::device_start()
m_packs = 1; // FIXME: get from configuration?
m_unit = strstr(m_image->tag(), "diablo0") ? 0 : 1;
- m_timer = timer_alloc(1);
+ m_timer = timer_alloc(FUNC(diablo_hd_device::sector_mark_tick), this);
}
void diablo_hd_device::device_reset()
@@ -1386,7 +1386,7 @@ void diablo_hd_device::device_reset()
return;
// for units with a CHD assigned to them start the timer
m_bits = std::make_unique<std::unique_ptr<uint32_t[]>[]>(m_pages);
- timer_set(m_sector_time - m_sector_mark_0_time, 1, 0);
+ m_timer->adjust(m_sector_time - m_sector_mark_0_time);
read_sector();
}
@@ -1401,9 +1401,9 @@ void diablo_hd_device::device_reset()
* @param id timer id
* @param arg argument supplied to timer_insert (unused)
*/
-void diablo_hd_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(diablo_hd_device::sector_mark_tick)
{
- LOG_DRIVE(9,"[DHD%u] TIMER id=%d param=%d @%.0fns\n", m_unit, id, param, timer.elapsed().as_double() * ATTOSECONDS_PER_NANOSECOND);
+ LOG_DRIVE(9, "[DHD%u] TIMER param=%d @%.0fns\n", m_unit, param, m_timer->elapsed().as_double() * ATTOSECONDS_PER_NANOSECOND);
if (!m_disk)
return;
@@ -1412,20 +1412,20 @@ void diablo_hd_device::device_timer(emu_timer &timer, device_timer_id id, int pa
// assert sector mark
sector_mark_0();
// next sector timer event is in the middle between sector_mark going 0 and back to 1
- timer.adjust(m_sector_mark_0_time, 1);
+ m_timer->adjust(m_sector_mark_0_time, 1);
break;
case 1:
/* call the sector_callback, if any */
if (m_sector_callback)
(void)(*m_sector_callback)(m_sector_callback_cookie, m_unit);
// next sector timer event is deassert of sector_mark_0 (set to 1)
- timer.adjust(m_sector_mark_1_time, 2);
+ m_timer->adjust(m_sector_mark_1_time, 2);
break;
case 2:
// deassert sector mark
sector_mark_1();
// next sector timer event is sector_mark_0 for next sector
- timer.adjust(m_sector_time - m_sector_mark_0_time, 0);
+ m_timer->adjust(m_sector_time - m_sector_mark_0_time, 0);
break;
}
}
diff --git a/src/devices/machine/diablo_hd.h b/src/devices/machine/diablo_hd.h
index eec79c648ba..43524706967 100644
--- a/src/devices/machine/diablo_hd.h
+++ b/src/devices/machine/diablo_hd.h
@@ -67,9 +67,10 @@ public:
protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_add_mconfig(machine_config &config) override;
+ TIMER_CALLBACK_MEMBER(sector_mark_tick);
+
private:
template <typename Format, typename... Params> void logprintf(int level, Format &&fmt, Params &&... args);
diff --git a/src/devices/machine/dp83932c.cpp b/src/devices/machine/dp83932c.cpp
index cadef10e602..efe877ca4d2 100644
--- a/src/devices/machine/dp83932c.cpp
+++ b/src/devices/machine/dp83932c.cpp
@@ -82,7 +82,7 @@ void dp83932c_device::device_start()
{
m_out_int.resolve();
- m_command = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(dp83932c_device::command), this));
+ m_command = timer_alloc(FUNC(dp83932c_device::command), this);
save_item(NAME(m_int_state));
save_item(NAME(m_reg));
diff --git a/src/devices/machine/dp8573.cpp b/src/devices/machine/dp8573.cpp
index 86682d1c7a3..f862bec4deb 100644
--- a/src/devices/machine/dp8573.cpp
+++ b/src/devices/machine/dp8573.cpp
@@ -35,7 +35,7 @@ void dp8573_device::device_start()
save_item(NAME(m_pfr));
save_item(NAME(m_millis));
- m_timer = timer_alloc(TIMER_ID);
+ m_timer = timer_alloc(FUNC(dp8573_device::msec_tick), this);
m_timer->adjust(attotime::never);
m_intr_cb.resolve_safe();
@@ -79,7 +79,7 @@ void dp8573_device::save_registers()
m_ram[REG_SAVE_MONTH] = m_ram[REG_MONTH];
}
-void dp8573_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(dp8573_device::msec_tick)
{
if ((m_pfr & PFR_OSF) || !(m_ram[REG_RTMR] & RTMR_CSS))
{
diff --git a/src/devices/machine/dp8573.h b/src/devices/machine/dp8573.h
index 6a184ae8c6b..1730884e1b4 100644
--- a/src/devices/machine/dp8573.h
+++ b/src/devices/machine/dp8573.h
@@ -31,7 +31,6 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_nvram_interface overrides
virtual void nvram_default() override;
@@ -43,7 +42,7 @@ protected:
void set_interrupt(uint8_t mask);
void clear_interrupt(uint8_t mask);
- static const device_timer_id TIMER_ID = 0;
+ TIMER_CALLBACK_MEMBER(msec_tick);
enum
{
diff --git a/src/devices/machine/ds1302.cpp b/src/devices/machine/ds1302.cpp
index 7bc8689f3a2..8d32c3fd3ff 100644
--- a/src/devices/machine/ds1302.cpp
+++ b/src/devices/machine/ds1302.cpp
@@ -101,7 +101,7 @@ ds1202_device::ds1202_device(const machine_config &mconfig, const char *tag, dev
void ds1302_device::device_start()
{
// allocate timers
- m_clock_timer = timer_alloc();
+ m_clock_timer = timer_alloc(FUNC(ds1302_device::clock_tick), this);
m_clock_timer->adjust(attotime::from_hz(clock() / 32768), 0, attotime::from_hz(clock() / 32768));
m_clk = 0;
@@ -129,10 +129,10 @@ void ds1302_device::device_start()
//-------------------------------------------------
-// device_timer - handler timer events
+// clock_tick - advance the clock if enabled
//-------------------------------------------------
-void ds1302_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(ds1302_device::clock_tick)
{
if (!CLOCK_HALT)
{
diff --git a/src/devices/machine/ds1302.h b/src/devices/machine/ds1302.h
index ea0a0d4e809..9b1d09e9840 100644
--- a/src/devices/machine/ds1302.h
+++ b/src/devices/machine/ds1302.h
@@ -46,7 +46,6 @@ protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_nvram_interface overrides
virtual void nvram_default() override;
@@ -58,6 +57,8 @@ protected:
virtual bool rtc_feature_leap_year() const override { return true; }
private:
+ TIMER_CALLBACK_MEMBER(clock_tick);
+
void load_shift_register();
void input_bit();
void output_bit();
diff --git a/src/devices/machine/ds1386.cpp b/src/devices/machine/ds1386.cpp
index e9455585242..6f91625bde4 100644
--- a/src/devices/machine/ds1386.cpp
+++ b/src/devices/machine/ds1386.cpp
@@ -12,20 +12,6 @@
#include "ds1386.h"
#include "machine/timehelp.h"
-#define DISABLE_OSC (0x80)
-#define DISABLE_SQW (0x40)
-
-#define COMMAND_TE (0x80)
-#define COMMAND_IPSW (0x40)
-#define COMMAND_IBH_LO (0x20)
-#define COMMAND_PU_LVL (0x10)
-#define COMMAND_WAM (0x08)
-#define COMMAND_TDM (0x04)
-#define COMMAND_WAF (0x02)
-#define COMMAND_TDF (0x01)
-
-#define HOURS_12_24 (0x40)
-#define HOURS_AM_PM (0x20)
DEFINE_DEVICE_TYPE(DS1286, ds1286_device, "ds1286", "DS1286 Watchdog Timekeeper")
DEFINE_DEVICE_TYPE(DS1386_8K, ds1386_8k_device, "ds1386_8k", "DS1386-8K RAMified Watchdog Timekeeper")
@@ -77,48 +63,30 @@ ds1386_32k_device::ds1386_32k_device(const machine_config &mconfig, const char *
{
}
-void ds1386_device::safe_inta_cb(int state)
-{
- if (!m_inta_cb.isnull())
- m_inta_cb(state);
-}
-
-void ds1386_device::safe_intb_cb(int state)
-{
- if (!m_intb_cb.isnull())
- m_intb_cb(state);
-}
-
-void ds1386_device::safe_sqw_cb(int state)
-{
- if (!m_sqw_cb.isnull())
- m_sqw_cb(state);
-}
-
void ds1386_device::device_start()
{
- m_inta_cb.resolve();
- m_intb_cb.resolve();
- m_sqw_cb.resolve();
+ m_inta_cb.resolve_safe();
+ m_intb_cb.resolve_safe();
+ m_sqw_cb.resolve_safe();
m_tod_alarm = 0;
m_watchdog_alarm = 0;
m_square = 1;
- safe_inta_cb(0);
- safe_intb_cb(0);
- safe_sqw_cb(1);
+ m_inta_cb(0);
+ m_intb_cb(0);
+ m_sqw_cb(1);
// allocate timers
- m_clock_timer = timer_alloc(CLOCK_TIMER);
+ m_clock_timer = timer_alloc(FUNC(ds1386_device::advance_hundredths), this);
m_clock_timer->adjust(attotime::from_hz(100), 0, attotime::from_hz(100));
- m_square_timer = timer_alloc(SQUAREWAVE_TIMER);
+ m_square_timer = timer_alloc(FUNC(ds1386_device::square_tick), this);
m_square_timer->adjust(attotime::never);
- m_watchdog_timer = timer_alloc(WATCHDOG_TIMER);
+ m_watchdog_timer = timer_alloc(FUNC(ds1386_device::watchdog_tick), this);
m_watchdog_timer->adjust(attotime::never);
- m_inta_timer= timer_alloc(INTA_TIMER);
+ m_inta_timer = timer_alloc(FUNC(ds1386_device::inta_timer_elapsed), this);
m_inta_timer->adjust(attotime::never);
- m_intb_timer= timer_alloc(INTB_TIMER);
+ m_intb_timer = timer_alloc(FUNC(ds1386_device::intb_timer_elapsed), this);
m_intb_timer->adjust(attotime::never);
// state saving
@@ -160,7 +128,7 @@ void ds1386_device::time_of_day_alarm()
if (m_ram[REGISTER_COMMAND] & COMMAND_IPSW)
{
- safe_inta_cb(m_tod_alarm);
+ m_inta_cb(m_tod_alarm);
if (m_ram[REGISTER_COMMAND] & COMMAND_PU_LVL)
{
m_inta_timer->adjust(attotime::from_msec(3));
@@ -168,7 +136,7 @@ void ds1386_device::time_of_day_alarm()
}
else
{
- safe_intb_cb(m_tod_alarm);
+ m_intb_cb(m_tod_alarm);
if (m_ram[REGISTER_COMMAND] & COMMAND_PU_LVL)
{
m_intb_timer->adjust(attotime::from_msec(3));
@@ -183,7 +151,7 @@ void ds1386_device::watchdog_alarm()
if (m_ram[REGISTER_COMMAND] & COMMAND_IPSW)
{
- safe_intb_cb(m_watchdog_alarm);
+ m_intb_cb(m_watchdog_alarm);
if (m_ram[REGISTER_COMMAND] & COMMAND_PU_LVL)
{
m_intb_timer->adjust(attotime::from_msec(3));
@@ -191,7 +159,7 @@ void ds1386_device::watchdog_alarm()
}
else
{
- safe_inta_cb(m_watchdog_alarm);
+ m_inta_cb(m_watchdog_alarm);
if (m_ram[REGISTER_COMMAND] & COMMAND_PU_LVL)
{
m_inta_timer->adjust(attotime::from_msec(3));
@@ -199,51 +167,37 @@ void ds1386_device::watchdog_alarm()
}
}
-void ds1386_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(ds1386_device::square_tick)
{
- switch (id)
- {
- case CLOCK_TIMER:
- advance_hundredths();
- break;
-
- case SQUAREWAVE_TIMER:
- m_square = ((m_square == 0) ? 1 : 0);
- safe_sqw_cb(m_square);
- break;
-
- case WATCHDOG_TIMER:
- if ((m_ram[REGISTER_COMMAND] & COMMAND_WAF) == 0)
- watchdog_alarm();
- break;
-
- case INTA_TIMER:
- if (m_ram[REGISTER_COMMAND] & COMMAND_IPSW)
- {
- m_tod_alarm = 0;
- }
- else
- {
- m_watchdog_alarm = 0;
- }
- safe_inta_cb(0);
- break;
+ m_square = 1 - m_square;
+ m_sqw_cb(m_square);
+}
- case INTB_TIMER:
- if (m_ram[REGISTER_COMMAND] & COMMAND_IPSW)
- {
- m_watchdog_alarm = 0;
- }
- else
- {
- m_tod_alarm = 0;
- }
- safe_intb_cb(0);
- break;
- }
+TIMER_CALLBACK_MEMBER(ds1386_device::watchdog_tick)
+{
+ if ((m_ram[REGISTER_COMMAND] & COMMAND_WAF) == 0)
+ watchdog_alarm();
}
-void ds1386_device::advance_hundredths()
+TIMER_CALLBACK_MEMBER(ds1386_device::inta_timer_elapsed)
+{
+ if (m_ram[REGISTER_COMMAND] & COMMAND_IPSW)
+ m_tod_alarm = 0;
+ else
+ m_watchdog_alarm = 0;
+ m_inta_cb(0);
+}
+
+TIMER_CALLBACK_MEMBER(ds1386_device::intb_timer_elapsed)
+{
+ if (m_ram[REGISTER_COMMAND] & COMMAND_IPSW)
+ m_watchdog_alarm = 0;
+ else
+ m_tod_alarm = 0;
+ m_intb_cb(0);
+}
+
+TIMER_CALLBACK_MEMBER(ds1386_device::advance_hundredths)
{
if ((m_ram[REGISTER_COMMAND] & COMMAND_TE) != 0)
{
@@ -378,9 +332,6 @@ void ds1386_device::check_tod_alarm()
bool zeroes = (m_hundredths == 0 && m_seconds == 0);
if (zeroes && (m_ram[REGISTER_COMMAND] & COMMAND_TDF) == 0)
{
- bool minutes_match = (m_minutes & 0x7f) == (m_minutes_alarm & 0x7f);
- bool hours_match = (m_hours & 0x7f) == (m_hours_alarm & 0x7f);
- bool days_match = (m_days & 0x7) == (m_days_alarm & 0x07);
bool alarm_match = false;
switch (mode)
{
@@ -388,13 +339,13 @@ void ds1386_device::check_tod_alarm()
alarm_match = true;
break;
case ALARM_MINUTES_MATCH:
- alarm_match = minutes_match;
+ alarm_match = (m_minutes & 0x7f) == (m_minutes_alarm & 0x7f);
break;
case ALARM_HOURS_MATCH:
- alarm_match = hours_match;
+ alarm_match = (m_hours & 0x7f) == (m_hours_alarm & 0x7f);
break;
case ALARM_DAYS_MATCH:
- alarm_match = days_match;
+ alarm_match = (m_days & 0x7) == (m_days_alarm & 0x07);
break;
default:
break;
@@ -439,7 +390,7 @@ void ds1386_device::data_w(offs_t offset, uint8_t data)
{
case 0x00: // hundredths
case 0x03: // minutes alarm
- case 0x05: // horus alarm
+ case 0x05: // hours alarm
case 0x0a: // years
m_ram[offset] = data;
break;
@@ -470,24 +421,16 @@ void ds1386_device::data_w(offs_t offset, uint8_t data)
if (changed & DISABLE_SQW)
{
if (m_ram[offset] & DISABLE_SQW)
- {
m_square_timer->adjust(attotime::never);
- }
else
- {
m_square_timer->adjust(attotime::from_hz(2048));
- }
}
if (changed & DISABLE_OSC)
{
if (m_ram[offset] & DISABLE_OSC)
- {
m_clock_timer->adjust(attotime::never);
- }
else
- {
m_clock_timer->adjust(attotime::from_hz(100));
- }
}
break;
}
@@ -500,9 +443,9 @@ void ds1386_device::data_w(offs_t offset, uint8_t data)
m_ram[REGISTER_COMMAND] &= ~COMMAND_WAF;
m_watchdog_alarm = 0;
if (m_ram[REGISTER_COMMAND] & COMMAND_IPSW)
- safe_intb_cb(0);
+ m_intb_cb(0);
else
- safe_inta_cb(0);
+ m_inta_cb(0);
}
m_ram[offset] = data;
uint8_t wd_hundredths = m_ram[REGISTER_WATCHDOG_HUNDREDTHS];
@@ -532,16 +475,16 @@ void ds1386_device::data_w(offs_t offset, uint8_t data)
if (a_changed)
{
if (m_ram[offset] & COMMAND_IPSW)
- safe_inta_cb(m_tod_alarm);
+ m_inta_cb(m_tod_alarm);
else
- safe_inta_cb(m_watchdog_alarm);
+ m_inta_cb(m_watchdog_alarm);
}
if (b_changed)
{
if (m_ram[offset] & COMMAND_IPSW)
- safe_intb_cb(m_watchdog_alarm);
+ m_intb_cb(m_watchdog_alarm);
else
- safe_intb_cb(m_tod_alarm);
+ m_intb_cb(m_tod_alarm);
}
}
if (changed & COMMAND_WAM)
@@ -549,16 +492,16 @@ void ds1386_device::data_w(offs_t offset, uint8_t data)
if (m_ram[offset] & COMMAND_WAF)
{
if (m_ram[offset] & COMMAND_IPSW)
- safe_intb_cb(0);
+ m_intb_cb(0);
else
- safe_inta_cb(0);
+ m_inta_cb(0);
}
else if (m_watchdog_alarm)
{
if (m_ram[offset] & COMMAND_IPSW)
- safe_intb_cb(m_watchdog_alarm);
+ m_intb_cb(m_watchdog_alarm);
else
- safe_inta_cb(m_watchdog_alarm);
+ m_inta_cb(m_watchdog_alarm);
}
}
if (changed & COMMAND_TDM)
@@ -566,16 +509,16 @@ void ds1386_device::data_w(offs_t offset, uint8_t data)
if (m_ram[offset] & COMMAND_TDF)
{
if (m_ram[offset] & COMMAND_IPSW)
- safe_inta_cb(0);
+ m_inta_cb(0);
else
- safe_intb_cb(0);
+ m_intb_cb(0);
}
else if (m_tod_alarm)
{
if (m_ram[offset] & COMMAND_IPSW)
- safe_inta_cb(m_tod_alarm);
+ m_inta_cb(m_tod_alarm);
else
- safe_intb_cb(m_tod_alarm);
+ m_intb_cb(m_tod_alarm);
}
}
break;
diff --git a/src/devices/machine/ds1386.h b/src/devices/machine/ds1386.h
index 4029fe558b0..dd07c49c79f 100644
--- a/src/devices/machine/ds1386.h
+++ b/src/devices/machine/ds1386.h
@@ -125,7 +125,6 @@ protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_nvram_interface overrides
virtual void nvram_default() override;
@@ -137,13 +136,32 @@ protected:
virtual bool rtc_feature_leap_year() const override { return true; }
virtual void rtc_clock_updated(int year, int month, int day, int day_of_week, int hour, int minute, int second) override;
- static constexpr device_timer_id CLOCK_TIMER = 0;
- static constexpr device_timer_id SQUAREWAVE_TIMER = 1;
- static constexpr device_timer_id WATCHDOG_TIMER = 2;
- static constexpr device_timer_id INTA_TIMER = 3;
- static constexpr device_timer_id INTB_TIMER = 4;
-
protected:
+ enum
+ {
+ DISABLE_OSC = 0x80,
+ DISABLE_SQW = 0x40,
+
+ COMMAND_TE = 0x80,
+ COMMAND_IPSW = 0x40,
+ COMMAND_IBH_LO = 0x20,
+ COMMAND_PU_LVL = 0x10,
+ COMMAND_WAM = 0x08,
+ COMMAND_TDM = 0x04,
+ COMMAND_WAF = 0x02,
+ COMMAND_TDF = 0x01,
+
+ HOURS_12_24 = 0x40,
+ HOURS_AM_PM = 0x20
+ };
+
+
+ TIMER_CALLBACK_MEMBER(advance_hundredths);
+ TIMER_CALLBACK_MEMBER(square_tick);
+ TIMER_CALLBACK_MEMBER(watchdog_tick);
+ TIMER_CALLBACK_MEMBER(inta_timer_elapsed);
+ TIMER_CALLBACK_MEMBER(intb_timer_elapsed);
+
void safe_inta_cb(int state);
void safe_intb_cb(int state);
void safe_sqw_cb(int state);
@@ -154,8 +172,6 @@ protected:
void time_of_day_alarm();
void watchdog_alarm();
- void advance_hundredths();
-
void copy_ram_to_registers();
void copy_registers_to_ram();
diff --git a/src/devices/machine/ds1994.cpp b/src/devices/machine/ds1994.cpp
index d6dacf90815..cff5a921c05 100644
--- a/src/devices/machine/ds1994.cpp
+++ b/src/devices/machine/ds1994.cpp
@@ -10,27 +10,23 @@
*/
// FIXME: convert to device_rtc_interface and remove time.h
-// FIXME: convert logging to use logmacro.h
#include "emu.h"
#include "machine/ds1994.h"
#include <ctime>
-#define VERBOSE_LEVEL 0
+#define LOG_ERRORS (1U << 1)
+#define LOG_1WIRE (1U << 2)
+#define LOG_ROM_COMMANDS (1U << 3)
+#define LOG_COMMANDS (1U << 4)
+#define LOG_STATES (1U << 5)
+#define LOG_RESETS (1U << 6)
+#define LOG_WRITES (1U << 7)
+#define LOG_READS (1U << 8)
-inline void ds1994_device::verboselog(int n_level, const char *s_fmt, ...)
-{
- if (VERBOSE_LEVEL >= n_level)
- {
- va_list v;
- char buf[32768];
- va_start(v, s_fmt);
- vsprintf(buf, s_fmt, v);
- va_end(v);
- logerror("ds1994 %s: %s", machine().describe_context(), buf);
- }
-}
+#define VERBOSE (0)
+#include "logmacro.h"
// device type definition
DEFINE_DEVICE_TYPE(DS1994, ds1994_device, "ds1994", "DS1994 iButton 4Kb Memory Plus Time")
@@ -115,9 +111,9 @@ void ds1994_device::device_start()
elem = STATE_IDLE;
// timers
- m_timer_main = timer_alloc(TIMER_MAIN);
- m_timer_reset = timer_alloc(TIMER_RESET);
- m_timer_clock = timer_alloc(TIMER_CLOCK);
+ m_timer_main = timer_alloc(FUNC(ds1994_device::main_tick), this);
+ m_timer_reset = timer_alloc(FUNC(ds1994_device::reset_tick), this);
+ m_timer_clock = timer_alloc(FUNC(ds1994_device::clock_tick), this);
m_timer_clock->adjust(attotime::from_hz(256), 0, attotime::from_hz(256));
}
@@ -144,11 +140,11 @@ void ds1994_device::device_reset()
memcpy(m_regs, region->base() + ROM_SIZE + SPD_SIZE + DATA_SIZE + RTC_SIZE, REGS_SIZE);
return;
}
- verboselog(0, "ds1994 %s: Wrong region length for data, expected 0x%x, got 0x%x\n", tag(), ROM_SIZE + SPD_SIZE + DATA_SIZE + RTC_SIZE + REGS_SIZE, region->bytes());
+ LOGMASKED(LOG_ERRORS, "ds1994 %s: Wrong region length for data, expected 0x%x, got 0x%x\n", tag(), ROM_SIZE + SPD_SIZE + DATA_SIZE + RTC_SIZE + REGS_SIZE, region->bytes());
}
else
{
- verboselog(0, "ds1994 %s: Warning, no id provided, answer will be all zeroes.\n", tag());
+ LOGMASKED(LOG_ERRORS, "ds1994 %s: Warning, no id provided, answer will be all zeroes.\n", tag());
memset(m_rom, 0, ROM_SIZE);
memset(m_ram, 0, SPD_SIZE);
memset(m_sram, 0, DATA_SIZE);
@@ -168,11 +164,11 @@ bool ds1994_device::one_wire_tx_bit(uint8_t value)
if (!m_bit)
{
m_shift = value;
- verboselog(1, "one_wire_tx_bit: Byte to send %02x\n", m_shift);
+ LOGMASKED(LOG_1WIRE, "one_wire_tx_bit: Byte to send %02x\n", m_shift);
}
m_tx = m_shift & 1;
m_shift >>= 1;
- verboselog(1, "one_wire_tx_bit: State %d\n", m_tx);
+ LOGMASKED(LOG_1WIRE, "one_wire_tx_bit: State %d\n", m_tx);
m_bit++;
if (m_bit == 8) return true;
else
@@ -186,11 +182,11 @@ bool ds1994_device::one_wire_rx_bit(void)
{
m_shift |= 0x80;
}
- verboselog(1, "one_wire_rx_bit: State %d\n", m_rx);
+ LOGMASKED(LOG_1WIRE, "one_wire_rx_bit: State %d\n", m_rx);
m_bit++;
if (m_bit == 8)
{
- verboselog(1, "one_wire_rx_bit: Byte Received %02x\n", m_shift);
+ LOGMASKED(LOG_1WIRE, "one_wire_rx_bit: Byte Received %02x\n", m_shift);
return true;
}
else
@@ -203,29 +199,29 @@ bool ds1994_device::one_wire_rx_bit(void)
/* */
/********************************************/
-void ds1994_device::ds1994_rom_cmd(void)
+void ds1994_device::handle_rom_cmd(void)
{
- verboselog(2, "timer_main state_rom_command\n");
+ LOGMASKED(LOG_ROM_COMMANDS, "rom_cmd\n");
if (one_wire_rx_bit())
{
switch (m_shift)
{
case ROMCMD_READROM:
- verboselog(1, "timer_main rom_cmd readrom\n");
+ LOGMASKED(LOG_ROM_COMMANDS, "rom_cmd readrom\n");
m_bit = 0;
m_byte = 0;
m_state[0] = STATE_READROM;
m_state_ptr = 0;
break;
case ROMCMD_SKIPROM:
- verboselog(1, "timer_main rom_cmd skiprom\n");
+ LOGMASKED(LOG_ROM_COMMANDS, "rom_cmd skiprom\n");
m_bit = 0;
m_byte = 0;
m_state[0] = STATE_COMMAND;
m_state_ptr = 0;
break;
case ROMCMD_MATCHROM:
- verboselog(1, "timer_main rom_cmd matchrom\n");
+ LOGMASKED(LOG_ROM_COMMANDS, "rom_cmd matchrom\n");
m_bit = 0;
m_byte = 0;
m_state[0] = STATE_MATCHROM;
@@ -233,11 +229,11 @@ void ds1994_device::ds1994_rom_cmd(void)
break;
case ROMCMD_SEARCHROM:
case ROMCMD_SEARCHINT:
- verboselog(0, "timer_main rom_command not implemented %02x\n", m_shift);
+ LOGMASKED(LOG_ERRORS, "rom_command not implemented %02x\n", m_shift);
m_state[m_state_ptr] = STATE_COMMAND;
break;
default:
- verboselog(0, "timer_main rom_command not found %02x\n", m_shift);
+ LOGMASKED(LOG_ERRORS, "rom_command not found %02x\n", m_shift);
m_state[m_state_ptr] = STATE_IDLE;
break;
}
@@ -250,15 +246,15 @@ void ds1994_device::ds1994_rom_cmd(void)
/* */
/********************************************/
-void ds1994_device::ds1994_cmd(void)
+void ds1994_device::handle_cmd(void)
{
- verboselog(2, "timer_main state_command\n");
+ LOGMASKED(LOG_COMMANDS, "state_command\n");
if (one_wire_rx_bit())
{
switch (m_shift)
{
case COMMAND_READ_MEMORY:
- verboselog(1, "timer_main cmd read_memory\n");
+ LOGMASKED(LOG_COMMANDS, "cmd read_memory\n");
m_bit = 0;
m_byte = 0;
m_state[0] = STATE_ADDRESS1;
@@ -268,7 +264,7 @@ void ds1994_device::ds1994_cmd(void)
m_state_ptr = 0;
break;
case COMMAND_WRITE_SCRATCHPAD:
- verboselog(1, "timer_main cmd write_scratchpad\n");
+ LOGMASKED(LOG_COMMANDS, "cmd write_scratchpad\n");
m_bit = 0;
m_byte = 0;
m_offs_ro = false;
@@ -279,7 +275,7 @@ void ds1994_device::ds1994_cmd(void)
m_state_ptr = 0;
break;
case COMMAND_READ_SCRATCHPAD:
- verboselog(1, "timer_main cmd read_scratchpad\n");
+ LOGMASKED(LOG_COMMANDS, "cmd read_scratchpad\n");
m_bit = 0;
m_byte = 0;
m_state[0] = STATE_TXADDRESS1;
@@ -290,7 +286,7 @@ void ds1994_device::ds1994_cmd(void)
m_state_ptr = 0;
break;
case COMMAND_COPY_SCRATCHPAD:
- verboselog(1, "timer_main cmd copy_scratchpad\n");
+ LOGMASKED(LOG_COMMANDS, "cmd copy_scratchpad\n");
m_bit = 0;
m_byte = 0;
m_offs_ro = true;
@@ -303,7 +299,7 @@ void ds1994_device::ds1994_cmd(void)
m_state_ptr = 0;
break;
default:
- verboselog(0, "timer_main command not handled %02x\n", m_shift);
+ LOGMASKED(LOG_COMMANDS, "command not handled %02x\n", m_shift);
m_state[m_state_ptr] = STATE_IDLE;
break;
}
@@ -316,7 +312,7 @@ void ds1994_device::ds1994_cmd(void)
/* */
/********************************************/
-uint8_t ds1994_device::ds1994_readmem()
+uint8_t ds1994_device::readmem()
{
if (m_address < 0x200)
{
@@ -332,7 +328,7 @@ uint8_t ds1994_device::ds1994_readmem()
return 0;
}
-void ds1994_device::ds1994_writemem(uint8_t value)
+void ds1994_device::writemem(uint8_t value)
{
if (m_address < 0x200)
{
@@ -353,231 +349,232 @@ void ds1994_device::ds1994_writemem(uint8_t value)
/* */
/*************************************************/
-void ds1994_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(ds1994_device::main_tick)
{
- switch (id)
+ switch (m_state[m_state_ptr])
{
- case TIMER_CLOCK:
- for (auto & elem : m_rtc)
+ case STATE_RESET1:
+ LOGMASKED(LOG_STATES, "timer_main state_reset1 %d\n", m_rx);
+ m_tx = false;
+ m_state[m_state_ptr] = STATE_RESET2;
+ m_timer_main->adjust(t_pdl);
+ break;
+ case STATE_RESET2:
+ LOGMASKED(LOG_STATES, "timer_main state_reset2 %d\n", m_rx);
+ m_tx = true;
+ m_bit = 0;
+ m_shift = 0;
+ m_state[m_state_ptr] = STATE_ROMCMD;
+ break;
+ case STATE_ROMCMD:
+ handle_rom_cmd();
+ break;
+ case STATE_COMMAND:
+ handle_cmd();
+ break;
+ case STATE_MATCHROM:
+ LOGMASKED(LOG_STATES, "timer_main state_matchrom - Data to match: <- %d\n", m_rx);
+ if (one_wire_rx_bit())
{
- elem++;
- if (elem != 0)
+ if (m_rom[7- m_byte] == m_shift)
{
- break;
+ m_byte++;
+ m_bit = 0;
+ LOGMASKED(LOG_STATES, "timer_main state_matchrom: datamatch %x - byte=%d\n", m_shift, m_byte);
+ }
+ else
+ {
+ m_state[m_state_ptr] = STATE_IDLE;
+ LOGMASKED(LOG_STATES, "timer_main state_matchrom: no match rx=%x <> mem=%x - byte:%d\n", m_shift, m_rom[7 - m_byte], m_byte);
}
}
+ if (m_byte == ROM_SIZE)
+ {
+ LOGMASKED(LOG_STATES, "timer_main matchrom finished\n");
+ m_state[m_state_ptr] = STATE_COMMAND;
+ }
break;
- case TIMER_RESET:
- verboselog(1, "timer_reset\n");
- m_state[m_state_ptr] = STATE_RESET;
- m_timer_reset->adjust(attotime::never);
+ case STATE_ADDRESS1:
+ LOGMASKED(LOG_STATES, "timer_main state_address1\n");
+ if (one_wire_rx_bit())
+ {
+ m_bit = 0;
+ if (m_offs_ro)
+ {
+ if (m_a1 != m_shift) m_auth = false;
+ LOGMASKED(LOG_STATES, "timer_main state_address1 - TA1=%02x - Auth_Code 1=%02x\n", m_a1, m_shift);
+ }
+ else
+ {
+ m_a1 = m_shift & 0xff;
+ LOGMASKED(LOG_STATES, "timer_main state_address1 - Address1=%02x\n", m_a1);
+ }
+ m_state_ptr++;
+ }
break;
- case TIMER_MAIN:
- switch (m_state[m_state_ptr])
+ case STATE_ADDRESS2:
+ LOGMASKED(LOG_STATES, "timer_main state_address2\n");
+ if (one_wire_rx_bit())
{
- case STATE_RESET1:
- verboselog(2, "timer_main state_reset1 %d\n", m_rx);
- m_tx = false;
- m_state[m_state_ptr] = STATE_RESET2;
- m_timer_main->adjust(t_pdl);
- break;
- case STATE_RESET2:
- verboselog(2, "timer_main state_reset2 %d\n", m_rx);
- m_tx = true;
- m_bit = 0;
- m_shift = 0;
- m_state[m_state_ptr] = STATE_ROMCMD;
- break;
- case STATE_ROMCMD:
- ds1994_rom_cmd();
- break;
- case STATE_COMMAND:
- ds1994_cmd();
- break;
- case STATE_MATCHROM:
- verboselog(2, "timer_main state_matchrom - Data to match: <- %d\n", m_rx);
- if (one_wire_rx_bit())
- {
- if (m_rom[7- m_byte] == m_shift)
- {
- m_byte++;
- m_bit = 0;
- verboselog(2, "timer_main state_matchrom: datamatch %x - byte=%d\n", m_shift, m_byte);
- }
- else
- {
- m_state[m_state_ptr] = STATE_IDLE;
- verboselog(1, "timer_main state_matchrom: no match rx=%x <> mem=%x - byte:%d\n", m_shift, m_rom[7 - m_byte], m_byte);
- }
- }
- if (m_byte == ROM_SIZE)
- {
- verboselog(2, "timer_main matchrom finished\n");
- m_state[m_state_ptr] = STATE_COMMAND;
- }
- break;
- case STATE_ADDRESS1:
- verboselog(2, "timer_main state_address1\n");
- if (one_wire_rx_bit())
- {
- m_bit = 0;
- if (m_offs_ro)
- {
- if (m_a1 != m_shift) m_auth = false;
- verboselog(1, "timer_main state_address1 - TA1=%02x - Auth_Code 1=%02x\n", m_a1, m_shift);
- }
- else
- {
- m_a1 = m_shift & 0xff;
- verboselog(2, "timer_main state_address1 - Address1=%02x\n", m_a1);
- }
- m_state_ptr++;
- }
- break;
- case STATE_ADDRESS2:
- verboselog(2, "timer_main state_address2\n");
- if (one_wire_rx_bit())
- {
- m_bit = 0;
- if (m_offs_ro)
- {
- if ( m_a2 != m_shift )
- m_auth = false;
- verboselog(1, "timer_main state_address1 - TA2=%02x - Auth_Code 2=%02x\n", m_a1, m_shift);
- }
- else
- {
- m_a2 = m_shift & 0xff;
- verboselog(2, "timer_main state_address2 - Address2=%02x\n", m_a2);
- }
- m_state_ptr++;
- }
- break;
- case STATE_OFFSET:
- verboselog(2, "timer_main state_offset\n");
- if (one_wire_rx_bit())
- {
- m_bit = 0;
- if (m_offs_ro)
- {
- if (m_a2 != m_shift)
- m_auth = false;
- verboselog(1, "timer_main state_address1 - OFS_ES=%02x - Auth_Code 3=%02x\n", m_offset, m_shift);
- }
- else
- {
- m_offset = m_shift & 0x1f;
- verboselog(2, "timer_main state_address2 - Offset=%02x\n", m_offset);
- }
- m_state_ptr++;
- }
- break;
- case STATE_WRITE_SCRATCHPAD:
- verboselog(2, "timer_main state_write_scratchpad\n");
- if (one_wire_rx_bit())
- {
- m_bit = 0;
- m_ram[m_offset & 0x1f] = m_shift & 0xff;
- m_offset++;
- }
- verboselog(2, "timer_main state_write_scratchpad %d Offs=%02x\n", m_rx, m_offset);
- break;
- case STATE_READROM:
- m_tx = true;
- if (m_byte == ROM_SIZE)
- {
- verboselog(1, "timer_main readrom finished\n");
- m_state[m_state_ptr] = STATE_COMMAND;
- }
- else
- verboselog(2, "timer_main readrom window closed\n");
- break;
- case STATE_TXADDRESS1:
- m_tx = true;
- if (m_byte == 1)
- {
- verboselog(1, "timer_main txaddress1 finished m_byte=%d\n", m_byte);
- m_byte = 0;
- m_state_ptr++;
- }
- else
- verboselog(2, "timer_main txaddress1 window closed\n");
- break;
- case STATE_TXADDRESS2:
- m_tx = true;
- if (m_byte == 1)
- {
- verboselog(1, "timer_main txaddress2 finished m_byte=%d\n", m_byte);
- m_byte = 0;
- m_state_ptr++;
- }
- else
- verboselog(2, "timer_main txaddress2 window closed\n");
- break;
- case STATE_TXOFFSET:
- m_tx = true;
- if (m_byte == 1)
- {
- verboselog(1, "timer_main txoffset finished - m_byte=%d\n", m_byte);
- m_byte = 0;
- m_state_ptr++;
- }
- else
- verboselog(2, "timer_main txoffset window closed\n");
- break;
- case STATE_READ_MEMORY:
- verboselog(2, "timer_main state_readmemory\n");
- break;
- case STATE_COPY_SCRATCHPAD:
- verboselog(2, "timer_main state_copy_scratchpad\n");
- break;
- case STATE_READ_SCRATCHPAD:
- verboselog(2, "timer_main state_read_scratchpad\n");
- break;
- default:
- verboselog(0, "timer_main state not handled: %d\n", m_state[m_state_ptr]);
- break;
+ m_bit = 0;
+ if (m_offs_ro)
+ {
+ if ( m_a2 != m_shift )
+ m_auth = false;
+ LOGMASKED(LOG_STATES, "timer_main state_address1 - TA2=%02x - Auth_Code 2=%02x\n", m_a1, m_shift);
+ }
+ else
+ {
+ m_a2 = m_shift & 0xff;
+ LOGMASKED(LOG_STATES, "timer_main state_address2 - Address2=%02x\n", m_a2);
+ }
+ m_state_ptr++;
}
- if (m_state[m_state_ptr] == STATE_INIT_COMMAND)
+ break;
+ case STATE_OFFSET:
+ LOGMASKED(LOG_STATES, "timer_main state_offset\n");
+ if (one_wire_rx_bit())
{
- switch (m_state[m_state_ptr + 1])
+ m_bit = 0;
+ if (m_offs_ro)
+ {
+ if (m_a2 != m_shift)
+ m_auth = false;
+ LOGMASKED(LOG_STATES, "timer_main state_address1 - OFS_ES=%02x - Auth_Code 3=%02x\n", m_offset, m_shift);
+ }
+ else
{
- case STATE_IDLE:
- case STATE_COMMAND:
- case STATE_ADDRESS1:
- case STATE_ADDRESS2:
- case STATE_OFFSET:
- break;
- case STATE_READ_MEMORY:
- verboselog(2, "timer_main (init_cmd) -> state_read_memory - set address\n");
- m_address = (m_a2 << 8) | m_a1;
- break;
- case STATE_WRITE_SCRATCHPAD:
- verboselog(2, "timer_main (init_cmd) -> state_write_scratchpad - set address\n");
- m_offs_ro = false;
- m_offset = 0;
- break;
- case STATE_READ_SCRATCHPAD:
- verboselog(2, "timer_main (init_cmd) -> state_read_scratchpad - set address\n");
- m_address = 0;
- break;
- case STATE_COPY_SCRATCHPAD:
- verboselog(2, "timer_main (init_cmd) -> state_copy_scratchpad - do copy\n");
- if (m_auth)
- {
- m_address = (m_a2 << 8) | m_a1;
- for (int i = 0; i <= m_offset; i++)
- {
- ds1994_writemem(m_ram[i]);
- m_address++;
- }
- }
- else
- verboselog(1, "timer_main (init_cmd) -> state_copy_scratchpad - Auth-Rejected\n");
- break;
+ m_offset = m_shift & 0x1f;
+ LOGMASKED(LOG_STATES, "timer_main state_address2 - Offset=%02x\n", m_offset);
}
m_state_ptr++;
}
+ break;
+ case STATE_WRITE_SCRATCHPAD:
+ LOGMASKED(LOG_STATES, "timer_main state_write_scratchpad\n");
+ if (one_wire_rx_bit())
+ {
+ m_bit = 0;
+ m_ram[m_offset & 0x1f] = m_shift & 0xff;
+ m_offset++;
+ }
+ LOGMASKED(LOG_STATES, "timer_main state_write_scratchpad %d Offs=%02x\n", m_rx, m_offset);
+ break;
+ case STATE_READROM:
+ m_tx = true;
+ if (m_byte == ROM_SIZE)
+ {
+ LOGMASKED(LOG_STATES, "timer_main readrom finished\n");
+ m_state[m_state_ptr] = STATE_COMMAND;
+ }
+ else
+ LOGMASKED(LOG_STATES, "timer_main readrom window closed\n");
+ break;
+ case STATE_TXADDRESS1:
+ m_tx = true;
+ if (m_byte == 1)
+ {
+ LOGMASKED(LOG_STATES, "timer_main txaddress1 finished m_byte=%d\n", m_byte);
+ m_byte = 0;
+ m_state_ptr++;
+ }
+ else
+ LOGMASKED(LOG_STATES, "timer_main txaddress1 window closed\n");
+ break;
+ case STATE_TXADDRESS2:
+ m_tx = true;
+ if (m_byte == 1)
+ {
+ LOGMASKED(LOG_STATES, "timer_main txaddress2 finished m_byte=%d\n", m_byte);
+ m_byte = 0;
+ m_state_ptr++;
+ }
+ else
+ LOGMASKED(LOG_STATES, "timer_main txaddress2 window closed\n");
+ break;
+ case STATE_TXOFFSET:
+ m_tx = true;
+ if (m_byte == 1)
+ {
+ LOGMASKED(LOG_STATES, "timer_main txoffset finished - m_byte=%d\n", m_byte);
+ m_byte = 0;
+ m_state_ptr++;
+ }
+ else
+ LOGMASKED(LOG_STATES, "timer_main txoffset window closed\n");
+ break;
+ case STATE_READ_MEMORY:
+ LOGMASKED(LOG_STATES, "timer_main state_readmemory\n");
+ break;
+ case STATE_COPY_SCRATCHPAD:
+ LOGMASKED(LOG_STATES, "timer_main state_copy_scratchpad\n");
+ break;
+ case STATE_READ_SCRATCHPAD:
+ LOGMASKED(LOG_STATES, "timer_main state_read_scratchpad\n");
+ break;
+ default:
+ LOGMASKED(LOG_ERRORS, "timer_main state not handled: %d\n", m_state[m_state_ptr]);
+ break;
+ }
+
+ if (m_state[m_state_ptr] == STATE_INIT_COMMAND)
+ {
+ switch (m_state[m_state_ptr + 1])
+ {
+ case STATE_IDLE:
+ case STATE_COMMAND:
+ case STATE_ADDRESS1:
+ case STATE_ADDRESS2:
+ case STATE_OFFSET:
+ break;
+ case STATE_READ_MEMORY:
+ LOGMASKED(LOG_STATES, "timer_main (init_cmd) -> state_read_memory - set address\n");
+ m_address = (m_a2 << 8) | m_a1;
+ break;
+ case STATE_WRITE_SCRATCHPAD:
+ LOGMASKED(LOG_STATES, "timer_main (init_cmd) -> state_write_scratchpad - set address\n");
+ m_offs_ro = false;
+ m_offset = 0;
+ break;
+ case STATE_READ_SCRATCHPAD:
+ LOGMASKED(LOG_STATES, "timer_main (init_cmd) -> state_read_scratchpad - set address\n");
+ m_address = 0;
+ break;
+ case STATE_COPY_SCRATCHPAD:
+ LOGMASKED(LOG_STATES, "timer_main (init_cmd) -> state_copy_scratchpad - do copy\n");
+ if (m_auth)
+ {
+ m_address = (m_a2 << 8) | m_a1;
+ for (int i = 0; i <= m_offset; i++)
+ {
+ writemem(m_ram[i]);
+ m_address++;
+ }
+ }
+ else
+ LOGMASKED(LOG_STATES, "timer_main (init_cmd) -> state_copy_scratchpad - Auth-Rejected\n");
+ break;
+ }
+ m_state_ptr++;
+ }
+}
+
+TIMER_CALLBACK_MEMBER(ds1994_device::reset_tick)
+{
+ LOGMASKED(LOG_RESETS, "timer_reset\n");
+ m_state[m_state_ptr] = STATE_RESET;
+ m_timer_reset->adjust(attotime::never);
+}
+
+TIMER_CALLBACK_MEMBER(ds1994_device::clock_tick)
+{
+ for (uint8_t &elem : m_rtc)
+ {
+ elem++;
+ if (elem != 0)
+ {
+ break;
+ }
}
}
@@ -589,7 +586,7 @@ void ds1994_device::device_timer(emu_timer &timer, device_timer_id id, int param
WRITE_LINE_MEMBER(ds1994_device::write)
{
- verboselog(1, "write(%d)\n", state);
+ LOGMASKED(LOG_WRITES, "write(%d)\n", state);
if (!state && m_rx)
{
switch (m_state[m_state_ptr])
@@ -598,27 +595,27 @@ WRITE_LINE_MEMBER(ds1994_device::write)
case STATE_INIT_COMMAND:
break;
case STATE_ROMCMD:
- verboselog(2, "state_romcommand\n");
+ LOGMASKED(LOG_WRITES, "state_romcommand\n");
m_timer_main->adjust(t_samp);
break;
case STATE_COMMAND:
- verboselog(2, "state_command\n");
+ LOGMASKED(LOG_WRITES, "state_command\n");
m_timer_main->adjust(t_samp);
break;
case STATE_ADDRESS1:
- verboselog(2, "state_address1\n");
+ LOGMASKED(LOG_WRITES, "state_address1\n");
m_timer_main->adjust(t_samp);
break;
case STATE_ADDRESS2:
- verboselog(2, "state_address2\n");
+ LOGMASKED(LOG_WRITES, "state_address2\n");
m_timer_main->adjust(t_samp);
break;
case STATE_OFFSET:
- verboselog(2, "state_offset\n");
+ LOGMASKED(LOG_WRITES, "state_offset\n");
m_timer_main->adjust(t_samp);
break;
case STATE_TXADDRESS1:
- verboselog(2, "state_txaddress1\n");
+ LOGMASKED(LOG_WRITES, "state_txaddress1\n");
if (one_wire_tx_bit(m_a1))
{
m_bit = 0;
@@ -627,7 +624,7 @@ WRITE_LINE_MEMBER(ds1994_device::write)
m_timer_main->adjust(t_rdv);
break;
case STATE_TXADDRESS2:
- verboselog(2, "state_txaddress2\n");
+ LOGMASKED(LOG_WRITES, "state_txaddress2\n");
if (one_wire_tx_bit(m_a2))
{
m_bit = 0;
@@ -636,7 +633,7 @@ WRITE_LINE_MEMBER(ds1994_device::write)
m_timer_main->adjust(t_rdv);
break;
case STATE_TXOFFSET:
- verboselog(2, "state_txoffset\n");
+ LOGMASKED(LOG_WRITES, "state_txoffset\n");
if (one_wire_tx_bit(m_offset))
{
m_bit = 0;
@@ -645,7 +642,7 @@ WRITE_LINE_MEMBER(ds1994_device::write)
m_timer_main->adjust(t_rdv);
break;
case STATE_READROM:
- verboselog(2, "state_readrom\n");
+ LOGMASKED(LOG_WRITES, "state_readrom\n");
if (one_wire_tx_bit(m_rom[7 - m_byte]))
{
m_bit = 0;
@@ -654,8 +651,8 @@ WRITE_LINE_MEMBER(ds1994_device::write)
m_timer_main->adjust(t_rdv);
break;
case STATE_READ_MEMORY:
- verboselog(2, "state_read_memory\n");
- if (one_wire_tx_bit(ds1994_readmem()))
+ LOGMASKED(LOG_WRITES, "state_read_memory\n");
+ if (one_wire_tx_bit(readmem()))
{
m_bit = 0;
if (m_address < DATA_SIZE + RTC_SIZE + REGS_SIZE)
@@ -666,29 +663,29 @@ WRITE_LINE_MEMBER(ds1994_device::write)
m_timer_main->adjust(t_rdv);
break;
case STATE_MATCHROM:
- verboselog(2, "state_matchrom\n");
+ LOGMASKED(LOG_WRITES, "state_matchrom\n");
m_timer_main->adjust(t_rdv);
break;
case STATE_COPY_SCRATCHPAD:
if (m_auth)
{
- verboselog(2, "state_copy_scratchpad Auth_Code Match: %d\n", m_tx);
+ LOGMASKED(LOG_WRITES, "state_copy_scratchpad Auth_Code Match: %d\n", m_tx);
m_tx = true;
m_auth = false;
}
else
{
m_tx = false;
- verboselog(1, "state_copy_scratchpad Auth_Code No Match: %d\n", m_tx);
+ LOGMASKED(LOG_WRITES, "state_copy_scratchpad Auth_Code No Match: %d\n", m_tx);
}
m_timer_main->adjust(t_rdv);
break;
case STATE_WRITE_SCRATCHPAD:
- verboselog(2, "state_write_scratchpad\n");
+ LOGMASKED(LOG_WRITES, "state_write_scratchpad\n");
m_timer_main->adjust(t_samp);
break;
case STATE_READ_SCRATCHPAD:
- verboselog(2, "state_read_scratchpad\n");
+ LOGMASKED(LOG_WRITES, "state_read_scratchpad\n");
if (one_wire_tx_bit(m_ram[m_address]))
{
m_bit = 0;
@@ -700,7 +697,7 @@ WRITE_LINE_MEMBER(ds1994_device::write)
m_timer_main->adjust(t_rdv);
break;
default:
- verboselog(0, "state not handled: %d\n", m_state[m_state_ptr]);
+ LOGMASKED(LOG_ERRORS | LOG_WRITES, "state not handled: %d\n", m_state[m_state_ptr]);
break;
}
m_timer_reset->adjust(t_rstl);
@@ -728,7 +725,7 @@ WRITE_LINE_MEMBER(ds1994_device::write)
READ_LINE_MEMBER(ds1994_device::read)
{
- verboselog(2, "read %d\n", m_tx && m_rx);
+ LOGMASKED(LOG_READS, "read %d\n", m_tx && m_rx);
return m_tx && m_rx;
}
diff --git a/src/devices/machine/ds1994.h b/src/devices/machine/ds1994.h
index df5c5216e30..c6629b6fbb9 100644
--- a/src/devices/machine/ds1994.h
+++ b/src/devices/machine/ds1994.h
@@ -37,7 +37,6 @@ class ds1994_device : public device_t, public device_nvram_interface
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_nvram_interface overrides
virtual void nvram_default() override;
@@ -65,12 +64,6 @@ class ds1994_device : public device_t, public device_nvram_interface
};
enum {
- TIMER_MAIN,
- TIMER_RESET,
- TIMER_CLOCK
- };
-
- enum {
STATE_IDLE,
STATE_RESET,
STATE_RESET1,
@@ -93,14 +86,20 @@ class ds1994_device : public device_t, public device_nvram_interface
STATE_COPY_SCRATCHPAD
};
- void ds1994_rom_cmd(void);
- void ds1994_cmd(void);
+ void handle_rom_cmd(void);
+ void handle_cmd(void);
bool one_wire_tx_bit(uint8_t value);
bool one_wire_rx_bit(void);
- uint8_t ds1994_readmem();
- void ds1994_writemem(uint8_t value);
+ uint8_t readmem();
+ void writemem(uint8_t value);
- emu_timer *m_timer_main, *m_timer_reset, *m_timer_clock;
+ TIMER_CALLBACK_MEMBER(main_tick);
+ TIMER_CALLBACK_MEMBER(reset_tick);
+ TIMER_CALLBACK_MEMBER(clock_tick);
+
+ emu_timer *m_timer_main;
+ emu_timer *m_timer_reset;
+ emu_timer *m_timer_clock;
uint32_t m_ref_year;
uint8_t m_ref_month;
@@ -124,8 +123,6 @@ class ds1994_device : public device_t, public device_nvram_interface
bool m_offs_ro;
attotime t_samp, t_rdv, t_rstl, t_pdh, t_pdl;
-
- inline void verboselog(int n_level, const char *s_fmt, ...) ATTR_PRINTF(3, 4);
};
// device type definition
diff --git a/src/devices/machine/ds2401.cpp b/src/devices/machine/ds2401.cpp
index 4da3b923bbe..3ceabcb66f2 100644
--- a/src/devices/machine/ds2401.cpp
+++ b/src/devices/machine/ds2401.cpp
@@ -60,8 +60,8 @@ void ds2401_device::device_start()
save_item(NAME(m_rx));
save_item(NAME(m_tx));
- m_timer_main = timer_alloc(TIMER_MAIN);
- m_timer_reset = timer_alloc(TIMER_RESET);
+ m_timer_main = timer_alloc(FUNC(ds2401_device::main_tick), this);
+ m_timer_reset = timer_alloc(FUNC(ds2401_device::reset_tick), this);
}
void ds2401_device::device_reset()
@@ -92,81 +92,78 @@ void ds2401_device::device_reset()
memset(m_data, 0, SIZE_DATA);
}
-void ds2401_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(ds2401_device::reset_tick)
{
- switch(id)
+ verboselog(1, "timer_reset\n");
+ m_state = STATE_RESET;
+ m_timer_reset->adjust(attotime::never);
+}
+
+TIMER_CALLBACK_MEMBER(ds2401_device::main_tick)
+{
+ switch(m_state)
{
- case TIMER_RESET:
- verboselog(1, "timer_reset\n");
- m_state = STATE_RESET;
- m_timer_reset->adjust(attotime::never);
+ case STATE_RESET1:
+ verboselog(2, "timer_main state_reset1 %d\n", m_rx);
+ m_tx = false;
+ m_state = STATE_RESET2;
+ m_timer_main->adjust(t_pdl);
break;
- case TIMER_MAIN:
- switch(m_state)
- {
- case STATE_RESET1:
- verboselog(2, "timer_main state_reset1 %d\n", m_rx);
- m_tx = false;
- m_state = STATE_RESET2;
- m_timer_main->adjust(t_pdl);
- break;
+ case STATE_RESET2:
+ verboselog(2, "timer_main state_reset2 %d\n", m_rx);
+ m_tx = true;
+ m_bit = 0;
+ m_shift = 0;
+ m_state = STATE_COMMAND;
+ break;
- case STATE_RESET2:
- verboselog(2, "timer_main state_reset2 %d\n", m_rx);
- m_tx = true;
- m_bit = 0;
- m_shift = 0;
- m_state = STATE_COMMAND;
- break;
+ case STATE_COMMAND:
+ verboselog(2, "timer_main state_command %d\n", m_rx);
- case STATE_COMMAND:
- verboselog(2, "timer_main state_command %d\n", m_rx);
+ m_shift >>= 1;
+ if(m_rx)
+ {
+ m_shift |= 0x80;
+ }
- m_shift >>= 1;
- if(m_rx)
+ m_bit++;
+ if(m_bit == 8)
+ {
+ switch(m_shift)
{
- m_shift |= 0x80;
- }
+ case COMMAND_READROM:
+ case COMMAND_READROM_COMPAT:
+ verboselog(1, "timer_main readrom\n");
+ m_bit = 0;
+ m_byte = 0;
+ m_state = STATE_READROM;
+ break;
- m_bit++;
- if(m_bit == 8)
- {
- switch(m_shift)
- {
- case COMMAND_READROM:
- case COMMAND_READROM_COMPAT:
- verboselog(1, "timer_main readrom\n");
- m_bit = 0;
- m_byte = 0;
- m_state = STATE_READROM;
- break;
-
- default:
- verboselog(0, "timer_main command not handled %02x\n", m_shift);
- m_state = STATE_IDLE;
- break;
- }
+ default:
+ verboselog(0, "timer_main command not handled %02x\n", m_shift);
+ m_state = STATE_IDLE;
+ break;
}
- break;
+ }
+ break;
- case STATE_READROM:
- m_tx = true;
+ case STATE_READROM:
+ m_tx = true;
- if( m_byte == SIZE_DATA )
- {
- verboselog(1, "timer_main readrom finished\n");
- m_state = STATE_IDLE;
- }
- else
- {
- verboselog(2, "timer_main readrom window closed\n");
- }
- break;
- default:
- verboselog(0, "timer_main state not handled: %d\n", m_state);
- break;
+ if( m_byte == SIZE_DATA )
+ {
+ verboselog(1, "timer_main readrom finished\n");
+ m_state = STATE_IDLE;
}
+ else
+ {
+ verboselog(2, "timer_main readrom window closed\n");
+ }
+ break;
+ default:
+ verboselog(0, "timer_main state not handled: %d\n", m_state);
+ break;
}
}
diff --git a/src/devices/machine/ds2401.h b/src/devices/machine/ds2401.h
index a78b7471a03..f29132d381e 100644
--- a/src/devices/machine/ds2401.h
+++ b/src/devices/machine/ds2401.h
@@ -45,15 +45,12 @@ protected:
STATE_READROM
};
- enum {
- TIMER_MAIN,
- TIMER_RESET
- };
-
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(reset_tick);
+ TIMER_CALLBACK_MEMBER(main_tick);
// internal state
int m_state, m_bit, m_shift;
diff --git a/src/devices/machine/ds2404.cpp b/src/devices/machine/ds2404.cpp
index 6a279d80986..68845d86dc3 100644
--- a/src/devices/machine/ds2404.cpp
+++ b/src/devices/machine/ds2404.cpp
@@ -73,7 +73,7 @@ void ds2404_device::device_start()
for (auto & elem : m_state)
elem = STATE_IDLE;
- m_tick_timer = timer_alloc(0);
+ m_tick_timer = timer_alloc(FUNC(ds2404_device::timer_tick), this);
m_tick_timer->adjust(attotime::from_hz(256), 0, attotime::from_hz(256));
}
@@ -317,22 +317,13 @@ void ds2404_device::clk_w(uint8_t data)
}
}
-void ds2404_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(ds2404_device::timer_tick)
{
- switch(id)
+ for(uint8_t &elem : m_rtc)
{
- case 0:
- // tick
- for(auto &elem : m_rtc)
- {
- elem++;
- if(elem != 0)
- break;
- }
+ elem++;
+ if(elem != 0)
break;
-
- default:
- throw emu_fatalerror("Unknown id in ds2404_device::device_timer");
}
}
diff --git a/src/devices/machine/ds2404.h b/src/devices/machine/ds2404.h
index 4301c2a050f..1ed22887b87 100644
--- a/src/devices/machine/ds2404.h
+++ b/src/devices/machine/ds2404.h
@@ -46,7 +46,7 @@ protected:
virtual bool nvram_read(util::read_stream &file) override;
virtual bool nvram_write(util::write_stream &file) override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(timer_tick);
private:
void rom_cmd(uint8_t cmd);
diff --git a/src/devices/machine/e0516.cpp b/src/devices/machine/e0516.cpp
index baa2751cb91..29fe42e3f17 100644
--- a/src/devices/machine/e0516.cpp
+++ b/src/devices/machine/e0516.cpp
@@ -54,7 +54,7 @@ e0516_device::e0516_device(const machine_config &mconfig, const char *tag, devic
void e0516_device::device_start()
{
// allocate timers
- m_timer = timer_alloc();
+ m_timer = timer_alloc(FUNC(e0516_device::timer_tick), this);
m_timer->adjust(attotime::from_hz(clock() / 32768), 0, attotime::from_hz(clock() / 32768));
// state saving
@@ -70,10 +70,11 @@ void e0516_device::device_start()
//-------------------------------------------------
-// device_timer - handler timer events
+// timer_tick - call into dirtc at 1Hz to
+// increment the seconds counter
//-------------------------------------------------
-void e0516_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(e0516_device::timer_tick)
{
advance_seconds();
}
diff --git a/src/devices/machine/e0516.h b/src/devices/machine/e0516.h
index 8246974130d..d3807ff5968 100644
--- a/src/devices/machine/e0516.h
+++ b/src/devices/machine/e0516.h
@@ -38,11 +38,12 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_rtc_interface overrides
virtual void rtc_clock_updated(int year, int month, int day, int day_of_week, int hour, int minute, int second) override;
+ TIMER_CALLBACK_MEMBER(timer_tick);
+
private:
int m_cs; // chip select
int m_clk; // clock
diff --git a/src/devices/machine/edlc.cpp b/src/devices/machine/edlc.cpp
index 480b0520c03..956528aa8b7 100644
--- a/src/devices/machine/edlc.cpp
+++ b/src/devices/machine/edlc.cpp
@@ -67,8 +67,8 @@ void seeq8003_device::device_start()
//save_item(NAME(m_rx_fifo));
//save_item(NAME(m_tx_fifo));
- m_tx_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(seeq8003_device::transmit), this));
- m_int_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(seeq8003_device::interrupt), this));
+ m_tx_timer = timer_alloc(FUNC(seeq8003_device::transmit), this);
+ m_int_timer = timer_alloc(FUNC(seeq8003_device::interrupt), this);
m_int_state = 0;
m_reset_state = 1;
diff --git a/src/devices/machine/er1400.cpp b/src/devices/machine/er1400.cpp
index 79ec1bc7d6e..695f22ac27a 100644
--- a/src/devices/machine/er1400.cpp
+++ b/src/devices/machine/er1400.cpp
@@ -75,7 +75,7 @@ void er1400_device::device_start()
m_data_array = std::make_unique<u16[]>(100);
save_pointer(NAME(m_data_array), 100);
- m_data_propagation_timer = timer_alloc(PROPAGATION_TIMER);
+ m_data_propagation_timer = timer_alloc(FUNC(er1400_device::propagate_data), this);
}
@@ -297,24 +297,18 @@ WRITE_LINE_MEMBER(er1400_device::c3_w)
//-------------------------------------------------
-// device_timer - called whenever a device timer
-// fires
+// propagate_data - clock data out from the chip
//-------------------------------------------------
-void er1400_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(er1400_device::propagate_data)
{
- switch (id)
+ if (m_code_input == 5)
{
- case PROPAGATION_TIMER:
- if (m_code_input == 5)
- {
- m_data_output = BIT(m_data_register, 13);
- LOG("Data output %d bit\n", m_data_output);
- }
- else
- m_data_output = false;
- break;
+ m_data_output = BIT(m_data_register, 13);
+ LOG("Data output %d bit\n", m_data_output);
}
+ else
+ m_data_output = false;
}
diff --git a/src/devices/machine/er1400.h b/src/devices/machine/er1400.h
index f8c6edb5614..9988edd6744 100644
--- a/src/devices/machine/er1400.h
+++ b/src/devices/machine/er1400.h
@@ -45,13 +45,14 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_nvram_interface overrides
virtual void nvram_default() override;
virtual bool nvram_read(util::read_stream &file) override;
virtual bool nvram_write(util::write_stream &file) override;
+ TIMER_CALLBACK_MEMBER(propagate_data);
+
private:
enum
{
diff --git a/src/devices/machine/exorterm.cpp b/src/devices/machine/exorterm.cpp
index 7edb65e875b..17e0f98a662 100644
--- a/src/devices/machine/exorterm.cpp
+++ b/src/devices/machine/exorterm.cpp
@@ -755,8 +755,8 @@ void exorterm155_device::device_start()
save_item(NAME(m_kbd_start_holdoff));
// Keyboard
- m_kbd_scan_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(exorterm155_device::kbd_scan_row), this));
- m_kbd_repeat_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(exorterm155_device::kbd_repeat), this));
+ m_kbd_scan_timer = timer_alloc(FUNC(exorterm155_device::kbd_scan_row), this);
+ m_kbd_repeat_timer = timer_alloc(FUNC(exorterm155_device::kbd_repeat), this);
kbd_reset_state();
kbd_repeat_stop();
diff --git a/src/devices/machine/exorterm.h b/src/devices/machine/exorterm.h
index 784fdd83e6b..07944bff805 100644
--- a/src/devices/machine/exorterm.h
+++ b/src/devices/machine/exorterm.h
@@ -128,7 +128,6 @@ private:
void kbd_repeat_start(u8 row, u8 column);
void kbd_repeat_restart();
void kbd_repeat_stop();
- void kbd_repeat();
void kbd_send_translated(u8 code);
TIMER_CALLBACK_MEMBER(kbd_scan_row);
diff --git a/src/devices/machine/f3853.cpp b/src/devices/machine/f3853.cpp
index 4f7b6ff798b..dbea3f30533 100644
--- a/src/devices/machine/f3853.cpp
+++ b/src/devices/machine/f3853.cpp
@@ -113,7 +113,7 @@ void f3853_device::device_start()
reg = reg << 1 | (BIT(reg,7) ^ BIT(reg,5) ^ BIT(reg,4) ^ BIT(reg,3) ^ 1);
}
- m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(f3853_device::timer_callback),this));
+ m_timer = timer_alloc(FUNC(f3853_device::timer_callback), this);
// zerofill (what's not in constructor)
m_external_int_enable = false;
diff --git a/src/devices/machine/fga002.cpp b/src/devices/machine/fga002.cpp
index 3aa117736ec..14ed175fb9e 100644
--- a/src/devices/machine/fga002.cpp
+++ b/src/devices/machine/fga002.cpp
@@ -104,7 +104,7 @@ void fga002_device::device_start()
m_liack7_cb.resolve_safe(0);
// Timers
- fga_timer = timer_alloc(TIMER_ID_FGA);
+ fga_timer = timer_alloc(FUNC(fga002_device::timer_tick), this);
save_pointer (NAME (m_fga002), sizeof(m_fga002));
@@ -143,31 +143,24 @@ void fga002_device::device_reset()
}
//-------------------------------------------------
-// device_timer - handler timer events
+// timer_tick - decrement timer 0
//-------------------------------------------------
-void fga002_device::device_timer (emu_timer &timer, device_timer_id id, int param)
+
+TIMER_CALLBACK_MEMBER(fga002_device::timer_tick)
{
- switch(id)
+ if (m_tim0count-- == 0) // Zero detect
{
- case TIMER_ID_FGA:
- if (m_tim0count-- == 0) // Zero detect
+ if ((m_fga002[FGA_TIM0CTL] & REG_TIM0CTL_ZERO_STOP) == 0)
{
- if ((m_fga002[FGA_TIM0CTL] & REG_TIM0CTL_ZERO_STOP) == 0)
- {
- fga_timer->adjust(attotime::never, TIMER_ID_FGA, attotime::never);
- }
+ fga_timer->adjust(attotime::never);
+ }
+ else
+ {
+ if ((m_fga002[FGA_TIM0CTL] & REG_TIM0CTL_AUTOPRELOAD) == 0)
+ m_tim0count &= 0xff;
else
- {
- if ((m_fga002[FGA_TIM0CTL] & REG_TIM0CTL_AUTOPRELOAD) == 0)
- m_tim0count &= 0xff;
- else
- m_tim0count = m_fga002[FGA_TIM0PRELOAD];
- }
+ m_tim0count = m_fga002[FGA_TIM0PRELOAD];
}
- break;
- default:
- LOG("Unhandled Timer ID %d\n", id);
- break;
}
}
@@ -408,27 +401,27 @@ void fga002_device::do_fga002reg_tim0ctl_w(uint8_t data)
if ((data & REG_TIM0CTL_START_STOP) != (m_fga002[FGA_TIM0CTL] & REG_TIM0CTL_START_STOP))
{
if ((data & REG_TIM0CTL_START_STOP) == 0)
- fga_timer->adjust(attotime::never, TIMER_ID_FGA, attotime::never);
+ fga_timer->adjust(attotime::never);
else
{
switch (data & REG_TIM0CTL_CLK_MSK)
{
- case REG_TIM0CTL_CLK_1_MIC: fga_timer->adjust(attotime::from_usec(1), TIMER_ID_FGA, attotime::from_usec(1)); break;
- case REG_TIM0CTL_CLK_2_MIC: fga_timer->adjust(attotime::from_usec(2), TIMER_ID_FGA, attotime::from_usec(2)); break;
- case REG_TIM0CTL_CLK_4_MIC: fga_timer->adjust(attotime::from_usec(4), TIMER_ID_FGA, attotime::from_usec(4)); break;
- case REG_TIM0CTL_CLK_8_MIC: fga_timer->adjust(attotime::from_usec(8), TIMER_ID_FGA, attotime::from_usec(8)); break;
- case REG_TIM0CTL_CLK_16_MIC: fga_timer->adjust(attotime::from_usec(16), TIMER_ID_FGA, attotime::from_usec(16)); break;
- case REG_TIM0CTL_CLK_32_MIC: fga_timer->adjust(attotime::from_usec(32), TIMER_ID_FGA, attotime::from_usec(32)); break;
- case REG_TIM0CTL_CLK_64_MIC: fga_timer->adjust(attotime::from_usec(64), TIMER_ID_FGA, attotime::from_usec(64)); break;
- case REG_TIM0CTL_CLK_128_MIC: fga_timer->adjust(attotime::from_usec(128), TIMER_ID_FGA, attotime::from_usec(128)); break;
- case REG_TIM0CTL_CLK_256_MIC: fga_timer->adjust(attotime::from_usec(256), TIMER_ID_FGA, attotime::from_usec(256)); break;
- case REG_TIM0CTL_CLK_512_MIC: fga_timer->adjust(attotime::from_usec(512), TIMER_ID_FGA, attotime::from_usec(512)); break;
- case REG_TIM0CTL_CLK_2_MIL: fga_timer->adjust(attotime::from_msec(2), TIMER_ID_FGA, attotime::from_msec(2)); break;
- case REG_TIM0CTL_CLK_8_MIL: fga_timer->adjust(attotime::from_msec(8), TIMER_ID_FGA, attotime::from_msec(8)); break;
- case REG_TIM0CTL_CLK_32_MIL: fga_timer->adjust(attotime::from_msec(32), TIMER_ID_FGA, attotime::from_msec(32)); break;
- case REG_TIM0CTL_CLK_125_MIL: fga_timer->adjust(attotime::from_msec(125), TIMER_ID_FGA, attotime::from_msec(125)); break;
- case REG_TIM0CTL_CLK_500_MIL: fga_timer->adjust(attotime::from_msec(500), TIMER_ID_FGA, attotime::from_msec(500)); break;
- case REG_TIM0CTL_CLK_2_SEC: fga_timer->adjust(attotime::from_seconds(2), TIMER_ID_FGA, attotime::from_seconds(2)); break;
+ case REG_TIM0CTL_CLK_1_MIC: fga_timer->adjust(attotime::from_usec(1), 0, attotime::from_usec(1)); break;
+ case REG_TIM0CTL_CLK_2_MIC: fga_timer->adjust(attotime::from_usec(2), 0, attotime::from_usec(2)); break;
+ case REG_TIM0CTL_CLK_4_MIC: fga_timer->adjust(attotime::from_usec(4), 0, attotime::from_usec(4)); break;
+ case REG_TIM0CTL_CLK_8_MIC: fga_timer->adjust(attotime::from_usec(8), 0, attotime::from_usec(8)); break;
+ case REG_TIM0CTL_CLK_16_MIC: fga_timer->adjust(attotime::from_usec(16), 0, attotime::from_usec(16)); break;
+ case REG_TIM0CTL_CLK_32_MIC: fga_timer->adjust(attotime::from_usec(32), 0, attotime::from_usec(32)); break;
+ case REG_TIM0CTL_CLK_64_MIC: fga_timer->adjust(attotime::from_usec(64), 0, attotime::from_usec(64)); break;
+ case REG_TIM0CTL_CLK_128_MIC: fga_timer->adjust(attotime::from_usec(128), 0, attotime::from_usec(128)); break;
+ case REG_TIM0CTL_CLK_256_MIC: fga_timer->adjust(attotime::from_usec(256), 0, attotime::from_usec(256)); break;
+ case REG_TIM0CTL_CLK_512_MIC: fga_timer->adjust(attotime::from_usec(512), 0, attotime::from_usec(512)); break;
+ case REG_TIM0CTL_CLK_2_MIL: fga_timer->adjust(attotime::from_msec(2), 0, attotime::from_msec(2)); break;
+ case REG_TIM0CTL_CLK_8_MIL: fga_timer->adjust(attotime::from_msec(8), 0, attotime::from_msec(8)); break;
+ case REG_TIM0CTL_CLK_32_MIL: fga_timer->adjust(attotime::from_msec(32), 0, attotime::from_msec(32)); break;
+ case REG_TIM0CTL_CLK_125_MIL: fga_timer->adjust(attotime::from_msec(125), 0, attotime::from_msec(125)); break;
+ case REG_TIM0CTL_CLK_500_MIL: fga_timer->adjust(attotime::from_msec(500), 0, attotime::from_msec(500)); break;
+ case REG_TIM0CTL_CLK_2_SEC: fga_timer->adjust(attotime::from_seconds(2), 0, attotime::from_seconds(2)); break;
default: logerror("REG_TIM0CTL programmer error, please report\n"); break; // Should never happen
}
}
diff --git a/src/devices/machine/fga002.h b/src/devices/machine/fga002.h
index efea2f54a23..35785189421 100644
--- a/src/devices/machine/fga002.h
+++ b/src/devices/machine/fga002.h
@@ -57,7 +57,8 @@ class fga002_device : public device_t
virtual int z80daisy_irq_ack() override;
virtual void z80daisy_irq_reti() override;
#endif
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(timer_tick);
devcb_write_line m_out_int_cb;
devcb_read8 m_liack4_cb;
@@ -86,10 +87,7 @@ class fga002_device : public device_t
uint8_t do_fga002reg_istim0_r();
void do_fga002reg_istim0_w(uint8_t data);
emu_timer *fga_timer;
- enum
- {
- TIMER_ID_FGA
- };
+
enum {
REG_TIM0CTL_ZERO_STOP = 0x80,
REG_TIM0CTL_AUTOPRELOAD = 0x40,
diff --git a/src/devices/machine/gen_fifo.cpp b/src/devices/machine/gen_fifo.cpp
index 56eba309f92..6dd2c3137d4 100644
--- a/src/devices/machine/gen_fifo.cpp
+++ b/src/devices/machine/gen_fifo.cpp
@@ -52,56 +52,51 @@ template<typename T> void generic_fifo_device_base<T>::device_start()
m_empty_cb.resolve_safe();
m_full_cb.resolve_safe();
- m_sync_empty = timer_alloc(0);
- m_sync_full = timer_alloc(1);
+ m_sync_empty = timer_alloc(FUNC(generic_fifo_device_base<T>::sync_empty), this);
+ m_sync_full = timer_alloc(FUNC(generic_fifo_device_base<T>::sync_full), this);
// This is not saving the fifo, let's hope it's empty...
save_item(NAME(m_empty_triggered));
save_item(NAME(m_full_triggered));
}
-template<typename T> void generic_fifo_device_base<T>::device_timer(emu_timer &timer, device_timer_id id, int param)
+template<typename T> TIMER_CALLBACK_MEMBER(generic_fifo_device_base<T>::sync_empty)
{
- switch(id) {
- case T_FULL: {
- // Add the extra values in if there's space
- bool was_empty = is_empty();
- bool was_full = is_full();
-
- while(!m_extra_values.empty() && !is_full()) {
- T t(std::move(m_extra_values.front()));
- m_extra_values.erase(m_extra_values.begin());
- m_values.emplace_back(std::move(t));
+ // Sync was called for a fifo empty, is it still empty?
+ if(is_empty()) {
+ // If yes, stop the destination if not done yet
+ if(!m_empty_triggered) {
+ m_empty_triggered = true;
+ m_on_fifo_empty_post_sync();
}
+ }
+}
- // Adjust devcb lines as needed
- if(was_empty && !is_empty())
- m_empty_cb(false);
- if(!was_full && is_full())
- m_full_cb(true);
+template<typename T> TIMER_CALLBACK_MEMBER(generic_fifo_device_base<T>::sync_full)
+{
+ // Add the extra values in if there's space
+ bool was_empty = is_empty();
+ bool was_full = is_full();
- // Are there still values that don't fit?
- if(!m_extra_values.empty()) {
- // If yes, stop the source if not done yet
- if(!m_full_triggered) {
- m_full_triggered = true;
- m_on_fifo_full_post_sync();
- }
- }
- break;
+ while(!m_extra_values.empty() && !is_full()) {
+ T t(std::move(m_extra_values.front()));
+ m_extra_values.erase(m_extra_values.begin());
+ m_values.emplace_back(std::move(t));
}
- case T_EMPTY: {
- // Sync was called for a fifo empty, is it still empty?
- if(is_empty()) {
- // If yes, stop the destination if not done yet
- if(!m_empty_triggered) {
- m_empty_triggered = true;
- m_on_fifo_empty_post_sync();
- }
+ // Adjust devcb lines as needed
+ if(was_empty && !is_empty())
+ m_empty_cb(false);
+ if(!was_full && is_full())
+ m_full_cb(true);
+
+ // Are there still values that don't fit?
+ if(!m_extra_values.empty()) {
+ // If yes, stop the source if not done yet
+ if(!m_full_triggered) {
+ m_full_triggered = true;
+ m_on_fifo_full_post_sync();
}
- break;
- }
}
}
diff --git a/src/devices/machine/gen_fifo.h b/src/devices/machine/gen_fifo.h
index 0b9cc36244c..8e27ef73b6a 100644
--- a/src/devices/machine/gen_fifo.h
+++ b/src/devices/machine/gen_fifo.h
@@ -197,7 +197,9 @@ private:
bool m_empty_triggered, m_full_triggered;
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(sync_empty);
+ TIMER_CALLBACK_MEMBER(sync_full);
};
class generic_fifo_u32_device : public generic_fifo_device_base<u32>
diff --git a/src/devices/machine/generalplus_gpl16250soc.cpp b/src/devices/machine/generalplus_gpl16250soc.cpp
index 2c2f7062d91..7718c586d43 100644
--- a/src/devices/machine/generalplus_gpl16250soc.cpp
+++ b/src/devices/machine/generalplus_gpl16250soc.cpp
@@ -1586,7 +1586,7 @@ void sunplus_gcm394_base_device::device_start()
m_nand_read_cb.resolve_safe(0);
- m_unk_timer = timer_alloc(0);
+ m_unk_timer = timer_alloc(FUNC(sunplus_gcm394_base_device::unknown_tick), this);
m_unk_timer->adjust(attotime::never);
save_item(NAME(m_dma_params));
@@ -1785,20 +1785,13 @@ void sunplus_gcm394_base_device::checkirq6()
*/
-void sunplus_gcm394_base_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(sunplus_gcm394_base_device::unknown_tick)
{
- switch (id)
- {
- case 0:
- {
- m_7935 |= 0x0100;
- set_state_unsynced(UNSP_IRQ6_LINE, ASSERT_LINE);
- //set_state_unsynced(UNSP_IRQ4_LINE, ASSERT_LINE);
+ m_7935 |= 0x0100;
+ set_state_unsynced(UNSP_IRQ6_LINE, ASSERT_LINE);
+ //set_state_unsynced(UNSP_IRQ4_LINE, ASSERT_LINE);
// checkirq6();
- break;
- }
- }
}
diff --git a/src/devices/machine/generalplus_gpl16250soc.h b/src/devices/machine/generalplus_gpl16250soc.h
index e3dfd6aeb20..214cc7e8ace 100644
--- a/src/devices/machine/generalplus_gpl16250soc.h
+++ b/src/devices/machine/generalplus_gpl16250soc.h
@@ -360,7 +360,8 @@ private:
void checkirq6();
emu_timer *m_unk_timer;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(unknown_tick);
inline uint16_t read_space(uint32_t offset);
inline void write_space(uint32_t offset, uint16_t data);
diff --git a/src/devices/machine/generalplus_gpl16250soc_video.cpp b/src/devices/machine/generalplus_gpl16250soc_video.cpp
index 52668a71d17..7d2b7f68385 100644
--- a/src/devices/machine/generalplus_gpl16250soc_video.cpp
+++ b/src/devices/machine/generalplus_gpl16250soc_video.cpp
@@ -210,7 +210,7 @@ void gcm394_base_video_device::device_start()
m_space_read_cb.resolve_safe(0);
- m_screenpos_timer = timer_alloc(TIMER_SCREENPOS);
+ m_screenpos_timer = timer_alloc(FUNC(gcm394_base_video_device::screen_pos_reached), this);
m_screenpos_timer->adjust(attotime::never);
save_item(NAME(m_page0_addr_lsb));
@@ -1132,27 +1132,20 @@ WRITE_LINE_MEMBER(gcm394_base_video_device::vblank)
}
}
-void gcm394_base_video_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(gcm394_base_video_device::screen_pos_reached)
{
- switch (id)
+ if (m_video_irq_enable & 2)
{
- case TIMER_SCREENPOS:
- {
- if (m_video_irq_enable & 2)
- {
- m_video_irq_status |= 2;
- check_video_irq();
- }
+ m_video_irq_status |= 2;
+ check_video_irq();
+ }
- //printf("firing irq timer\n");
+ //printf("firing irq timer\n");
- m_screen->update_partial(m_screen->vpos());
+ m_screen->update_partial(m_screen->vpos());
- // fire again, jak_dbz pinball needs this
- m_screenpos_timer->adjust(m_screen->time_until_pos(m_yirqpos-19, m_xirqpos));
- break;
- }
- }
+ // fire again, jak_dbz pinball needs this
+ m_screenpos_timer->adjust(m_screen->time_until_pos(m_yirqpos-19, m_xirqpos));
}
diff --git a/src/devices/machine/generalplus_gpl16250soc_video.h b/src/devices/machine/generalplus_gpl16250soc_video.h
index 328525b7359..22b4275a990 100644
--- a/src/devices/machine/generalplus_gpl16250soc_video.h
+++ b/src/devices/machine/generalplus_gpl16250soc_video.h
@@ -140,8 +140,7 @@ public:
protected:
- static const device_timer_id TIMER_SCREENPOS = 2;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(screen_pos_reached);
inline void check_video_irq();
diff --git a/src/devices/machine/glukrs.cpp b/src/devices/machine/glukrs.cpp
index 515f448dbb9..aee7348b3e0 100644
--- a/src/devices/machine/glukrs.cpp
+++ b/src/devices/machine/glukrs.cpp
@@ -26,7 +26,7 @@ void glukrs_device::device_start()
{
m_nvram->set_base(&m_cmos, sizeof(m_cmos));
- m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(glukrs_device::timer_callback), this));
+ m_timer = timer_alloc(FUNC(glukrs_device::timer_callback), this);
m_timer->adjust(attotime::from_hz(clock() / XTAL(32'768)), 0, attotime::from_hz(clock() / XTAL(32'768)));
}
diff --git a/src/devices/machine/gt64xxx.cpp b/src/devices/machine/gt64xxx.cpp
index 4c698e12809..ea16a9b0573 100644
--- a/src/devices/machine/gt64xxx.cpp
+++ b/src/devices/machine/gt64xxx.cpp
@@ -208,7 +208,7 @@ void gt64xxx_device::device_start()
status = 0x0;
// DMA timer
- m_dma_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gt64xxx_device::perform_dma), this));
+ m_dma_timer = timer_alloc(FUNC(gt64xxx_device::perform_dma), this);
// Leave the timer disabled.
m_dma_timer->adjust(attotime::never, 0, DMA_TIMER_PERIOD);
@@ -231,10 +231,10 @@ void gt64xxx_device::device_start()
}
// allocate timers for the galileo
- m_timer[0].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gt64xxx_device::timer_callback), this));
- m_timer[1].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gt64xxx_device::timer_callback), this));
- m_timer[2].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gt64xxx_device::timer_callback), this));
- m_timer[3].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gt64xxx_device::timer_callback), this));
+ m_timer[0].timer = timer_alloc(FUNC(gt64xxx_device::timer_callback), this);
+ m_timer[1].timer = timer_alloc(FUNC(gt64xxx_device::timer_callback), this);
+ m_timer[2].timer = timer_alloc(FUNC(gt64xxx_device::timer_callback), this);
+ m_timer[3].timer = timer_alloc(FUNC(gt64xxx_device::timer_callback), this);
// Save states
save_item(NAME(m_irq_pending));
diff --git a/src/devices/machine/gt913_io.cpp b/src/devices/machine/gt913_io.cpp
index 2853a50ec98..d1b091fa308 100644
--- a/src/devices/machine/gt913_io.cpp
+++ b/src/devices/machine/gt913_io.cpp
@@ -32,8 +32,8 @@ void gt913_io_hle_device::device_start()
m_cpu_io = &m_cpu->space(AS_IO);
m_intc = siblingdevice<h8_intc_device>(m_intc_tag);
- m_timer[0] = timer_alloc(0);
- m_timer[1] = timer_alloc(1);
+ m_timer[0] = timer_alloc(FUNC(gt913_io_hle_device::irq_timer_tick), this);
+ m_timer[1] = timer_alloc(FUNC(gt913_io_hle_device::irq_timer_tick), this);
save_item(NAME(m_timer_control));
save_item(NAME(m_timer_rate));
@@ -54,10 +54,10 @@ void gt913_io_hle_device::device_reset()
m_adc_data[0] = m_adc_data[1] = 0;
}
-void gt913_io_hle_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(gt913_io_hle_device::irq_timer_tick)
{
- m_timer_irq_pending[id] = true;
- timer_check_irq(id);
+ m_timer_irq_pending[param] = true;
+ timer_check_irq((offs_t)param);
}
void gt913_io_hle_device::timer_control_w(offs_t offset, uint8_t data)
@@ -65,7 +65,7 @@ void gt913_io_hle_device::timer_control_w(offs_t offset, uint8_t data)
assert(offset < 2);
// TODO: ctk551 clears and sets bit 4 during the respective timer's IRQ, what should this do? pause/restart the timer?
m_timer_control[offset] = data;
- timer_check_irq(offset);
+ timer_check_irq((int)offset);
}
uint8_t gt913_io_hle_device::timer_control_r(offs_t offset)
@@ -106,15 +106,16 @@ void gt913_io_hle_device::timer_adjust(offs_t num)
{
default:
logerror("unknown timer %u prescaler %u (pc = %04x)\n", num, m_timer_control[num] & 0x7, m_cpu->pc());
- [[fallthrough]];
+ break;
case 0:
break;
case 2:
- clocks <<= 9; break;
+ clocks <<= 9;
+ break;
}
attotime period = m_cpu->clocks_to_attotime(clocks);
- m_timer[num]->adjust(period, 0, period);
+ m_timer[num]->adjust(period, (int)num, period);
}
}
diff --git a/src/devices/machine/gt913_io.h b/src/devices/machine/gt913_io.h
index 5bfed441c64..335c7b2719f 100644
--- a/src/devices/machine/gt913_io.h
+++ b/src/devices/machine/gt913_io.h
@@ -47,7 +47,7 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(irq_timer_tick);
private:
required_device<cpu_device> m_cpu;
diff --git a/src/devices/machine/hd63450.cpp b/src/devices/machine/hd63450.cpp
index 9d8226c3f9e..5006729badf 100644
--- a/src/devices/machine/hd63450.cpp
+++ b/src/devices/machine/hd63450.cpp
@@ -50,7 +50,7 @@ void hd63450_device::device_start()
// Initialise timers and registers
for (int x = 0; x < 4; x++)
- m_timer[x] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(hd63450_device::dma_transfer_timer), this));
+ m_timer[x] = timer_alloc(FUNC(hd63450_device::dma_transfer_timer), this);
save_item(STRUCT_MEMBER(m_reg, csr));
save_item(STRUCT_MEMBER(m_reg, cer));
diff --git a/src/devices/machine/hd64610.cpp b/src/devices/machine/hd64610.cpp
index 5090e162b41..2a2c3064705 100644
--- a/src/devices/machine/hd64610.cpp
+++ b/src/devices/machine/hd64610.cpp
@@ -175,7 +175,7 @@ void hd64610_device::device_start()
m_out_1hz_cb.resolve_safe();
// allocate timers
- m_counter_timer = timer_alloc(TIMER_UPDATE_COUNTER);
+ m_counter_timer = timer_alloc(FUNC(hd64610_device::update_counter), this);
m_counter_timer->adjust(attotime::from_hz(clock() / 256), 0, attotime::from_hz(clock() / 256));
// state saving
@@ -186,37 +186,32 @@ void hd64610_device::device_start()
//-------------------------------------------------
-// device_timer - handler timer events
+// update_counter - update our count registers
//-------------------------------------------------
-void hd64610_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(hd64610_device::update_counter)
{
- switch (id)
+ if(m_hline_state || (m_regs[REG_CRB] & CRB_S))
{
- case TIMER_UPDATE_COUNTER:
- if(m_hline_state || (m_regs[REG_CRB] & CRB_S))
- {
- m_regs[REG_64HZ]++;
+ m_regs[REG_64HZ]++;
- if (m_regs[REG_64HZ] & 0x80)
- {
- // update seconds
- advance_seconds();
+ if (m_regs[REG_64HZ] & 0x80)
+ {
+ // update seconds
+ advance_seconds();
- // set carry flag
- m_regs[REG_CRA] |= CRA_CF;
+ // set carry flag
+ m_regs[REG_CRA] |= CRA_CF;
- m_regs[REG_64HZ] &= 0x7f;
- }
+ m_regs[REG_64HZ] &= 0x7f;
+ }
- // update 1Hz out
- m_out_1hz_cb(BIT(m_regs[REG_64HZ], 6));
+ // update 1Hz out
+ m_out_1hz_cb(BIT(m_regs[REG_64HZ], 6));
- // update IRQ
- check_alarm();
- set_irq_line();
- }
- break;
+ // update IRQ
+ check_alarm();
+ set_irq_line();
}
}
diff --git a/src/devices/machine/hd64610.h b/src/devices/machine/hd64610.h
index ebbb1356042..9dda6ed03e5 100644
--- a/src/devices/machine/hd64610.h
+++ b/src/devices/machine/hd64610.h
@@ -48,7 +48,6 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_rtc_interface overrides
virtual void rtc_clock_updated(int year, int month, int day, int day_of_week, int hour, int minute, int second) override;
@@ -58,14 +57,14 @@ protected:
virtual bool nvram_read(util::read_stream &file) override;
virtual bool nvram_write(util::write_stream &file) override;
+ TIMER_CALLBACK_MEMBER(update_counter);
+
private:
void set_irq_line();
uint8_t read_counter(int counter);
void write_counter(int counter, uint8_t value);
void check_alarm();
- static const device_timer_id TIMER_UPDATE_COUNTER = 0;
-
devcb_write_line m_out_irq_cb;
devcb_write_line m_out_1hz_cb;
diff --git a/src/devices/machine/hdc92x4.cpp b/src/devices/machine/hdc92x4.cpp
index 51661ef5e2d..1abdcf02abc 100644
--- a/src/devices/machine/hdc92x4.cpp
+++ b/src/devices/machine/hdc92x4.cpp
@@ -294,15 +294,6 @@ enum
};
/*
- Timers
-*/
-enum
-{
- GEN_TIMER = 1,
- COM_TIMER
-};
-
-/*
Definition of bits in the Mode register
*/
enum {
@@ -4764,22 +4755,22 @@ void hdc92x4_device::set_clock_divider(int line, int value)
}
/*
- This is reached when a timer has expired
+ These are reached when the relevant timer has expired
*/
-void hdc92x4_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(hdc92x4_device::gen_timer_expired)
{
live_sync();
m_timed_wait = false;
- switch (id)
- {
- case GEN_TIMER:
- reenter_command_processing();
- break;
- case COM_TIMER:
- process_command();
- break;
- }
+ reenter_command_processing();
+}
+
+TIMER_CALLBACK_MEMBER(hdc92x4_device::com_timer_expired)
+{
+ live_sync();
+ m_timed_wait = false;
+
+ process_command();
}
/*
@@ -4804,9 +4795,9 @@ void hdc92x4_device::device_start()
m_in_dma.resolve_safe(0);
// allocate timers
- m_timer = timer_alloc(GEN_TIMER);
- m_cmd_timer = timer_alloc(COM_TIMER);
- // m_live_timer = timer_alloc(LIVE_TIMER);
+ m_timer = timer_alloc(FUNC(hdc92x4_device::gen_timer_expired), this);
+ m_cmd_timer = timer_alloc(FUNC(hdc92x4_device::com_timer_expired), this);
+ // m_live_timer = timer_alloc(FUNC(hdc92x4_device::live_timer_expired), this);
m_live_state.state = IDLE;
}
diff --git a/src/devices/machine/hdc92x4.h b/src/devices/machine/hdc92x4.h
index 733a59b2733..4527efc6c91 100644
--- a/src/devices/machine/hdc92x4.h
+++ b/src/devices/machine/hdc92x4.h
@@ -83,8 +83,8 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
- // Timer callback
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(gen_timer_expired);
+ TIMER_CALLBACK_MEMBER(com_timer_expired);
private:
const bool m_is_hdc9234;
diff --git a/src/devices/machine/hp_dc100_tape.cpp b/src/devices/machine/hp_dc100_tape.cpp
index 4e94a6d2999..2afd9d78beb 100644
--- a/src/devices/machine/hp_dc100_tape.cpp
+++ b/src/devices/machine/hp_dc100_tape.cpp
@@ -33,16 +33,18 @@
#include "util/ioprocsfilter.h"
// Debugging
-#include "logmacro.h"
+
#define LOG_TMR_MASK (LOG_GENERAL << 1)
-#define LOG_TMR(...) LOGMASKED(LOG_TMR_MASK, __VA_ARGS__)
#define LOG_DBG_MASK (LOG_TMR_MASK << 1)
-#define LOG_DBG(...) LOGMASKED(LOG_DBG_MASK, __VA_ARGS__)
#define LOG_RW_MASK (LOG_DBG_MASK << 1)
+
+#define LOG_TMR(...) LOGMASKED(LOG_TMR_MASK, __VA_ARGS__)
+#define LOG_DBG(...) LOGMASKED(LOG_DBG_MASK, __VA_ARGS__)
#define LOG_RW(...) LOGMASKED(LOG_RW_MASK, __VA_ARGS__)
-#undef VERBOSE
+
//#define VERBOSE (LOG_GENERAL | LOG_TMR_MASK | LOG_DBG_MASK | LOG_RW_MASK)
#define VERBOSE (LOG_GENERAL)
+#include "logmacro.h"
// Bit manipulation
namespace {
@@ -51,12 +53,12 @@ namespace {
return (T)1U << n;
}
- template<typename T> void BIT_CLR(T& w , unsigned n)
+ template<typename T> void BIT_CLR(T& w, unsigned n)
{
w &= ~BIT_MASK<T>(n);
}
- template<typename T> void BIT_SET(T& w , unsigned n)
+ template<typename T> void BIT_SET(T& w, unsigned n)
{
w |= BIT_MASK<T>(n);
}
@@ -65,20 +67,12 @@ namespace {
// Device type definition
DEFINE_DEVICE_TYPE(HP_DC100_TAPE, hp_dc100_tape_device, "hp_dc100_tape", "HP DC100 tape drive")
-// Timers
-enum {
- BIT_TMR_ID,
- TACHO_TMR_ID,
- HOLE_TMR_ID,
- MOTION_TMR_ID
-};
-
// Constants
constexpr double MOTION_MARGIN = 1e-5; // Margin to ensure motion events have passed when timer expires (10 µs)
constexpr hti_format_t::tape_pos_t TAPE_INIT_POS = 80 * hti_format_t::ONE_INCH_POS; // Initial tape position: 80" from beginning (just past the punched part)
hp_dc100_tape_device::hp_dc100_tape_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : microtape_image_device(mconfig , HP_DC100_TAPE , tag , owner , clock)
+ : microtape_image_device(mconfig, HP_DC100_TAPE, tag, owner, clock)
, m_cart_out_handler(*this)
, m_hole_handler(*this)
, m_tacho_tick_handler(*this)
@@ -103,7 +97,7 @@ image_init_result hp_dc100_tape_device::call_create(int format_type, util::optio
void hp_dc100_tape_device::call_unload()
{
- LOG("call_unload dirty=%d\n" , m_image_dirty);
+ LOG("call_unload dirty=%d\n", m_image_dirty);
device_reset();
@@ -152,7 +146,7 @@ std::string hp_dc100_tape_device::call_display()
int pos_in = get_approx_pos() / hti_format_t::ONE_INCH_POS;
- buffer += string_format("%c %c%c [%04d/1824]" , r_w , m1 , m2 , pos_in);
+ buffer += string_format("%c %c%c [%04d/1824]", r_w, m1, m2, pos_in);
return buffer;
}
@@ -167,7 +161,7 @@ void hp_dc100_tape_device::set_acceleration(double accel)
m_acceleration = accel;
}
-void hp_dc100_tape_device::set_set_points(double slow_sp , double fast_sp)
+void hp_dc100_tape_device::set_set_points(double slow_sp, double fast_sp)
{
m_slow_set_point = slow_sp;
m_fast_set_point = fast_sp;
@@ -196,7 +190,7 @@ void hp_dc100_tape_device::set_name(const std::string& name)
void hp_dc100_tape_device::set_track_no(unsigned track)
{
if (m_track != track && track < m_image.no_of_tracks()) {
- LOG_DBG("Setting track %u (op=%d)\n" , track , static_cast<int>(m_current_op));
+ LOG_DBG("Setting track %u (op=%d)\n", track, static_cast<int>(m_current_op));
auto saved_op = m_current_op;
if (m_current_op != OP_IDLE) {
// Close current op on old track
@@ -210,7 +204,7 @@ void hp_dc100_tape_device::set_track_no(unsigned track)
}
}
-bool hp_dc100_tape_device::set_speed_setpoint(tape_speed_t speed , bool fwd)
+bool hp_dc100_tape_device::set_speed_setpoint(tape_speed_t speed, bool fwd)
{
if (!m_present) {
return false;
@@ -220,7 +214,7 @@ bool hp_dc100_tape_device::set_speed_setpoint(tape_speed_t speed , bool fwd)
if (m_set_point != new_setpoint) {
update_speed_pos();
- LOG_DBG("Speed SP changed %f->%f %.6f p=%d\n" , m_set_point , new_setpoint , machine().time().as_double() , m_tape_pos);
+ LOG_DBG("Speed SP changed %f->%f %.6f p=%d\n", m_set_point, new_setpoint, machine().time().as_double(), m_tape_pos);
m_tape_speed = speed;
m_set_point = new_setpoint;
// Speed set point changed, accelerate/decelerate
@@ -240,13 +234,13 @@ bool hp_dc100_tape_device::set_speed_setpoint(tape_speed_t speed , bool fwd)
}
}
-void hp_dc100_tape_device::set_op(tape_op_t op , bool force)
+void hp_dc100_tape_device::set_op(tape_op_t op, bool force)
{
if (!m_present || m_start_time.is_never()) {
return;
}
if (!m_in_set_op && (op != m_current_op || force)) {
- LOG_DBG("Op %d->%d (f=%d)\n" , m_current_op , op , force);
+ LOG_DBG("Op %d->%d (f=%d)\n", m_current_op, op, force);
m_in_set_op = true;
update_speed_pos();
auto prev_op = m_current_op;
@@ -265,21 +259,21 @@ void hp_dc100_tape_device::set_op(tape_op_t op , bool force)
LOG("Starting RD after WR?\n");
}
if (fabs(m_speed) < m_slow_set_point) {
- LOG("Starting RD at %f speed?\n" , m_speed);
+ LOG("Starting RD at %f speed?\n", m_speed);
}
- m_rd_it_valid = m_image.next_data(get_track_no() , m_tape_pos , is_moving_fwd() , false , m_rd_it);
+ m_rd_it_valid = m_image.next_data(get_track_no(), m_tape_pos, is_moving_fwd(), false, m_rd_it);
load_rd_word();
m_gap_detect_start = m_tape_pos;
break;
case OP_WRITE:
if (m_accelerating || fabs(m_speed) != m_slow_set_point) {
- LOG("Starting WR at %f speed (acc=%d)?\n" , m_speed , m_accelerating);
+ LOG("Starting WR at %f speed (acc=%d)?\n", m_speed, m_accelerating);
}
if (prev_op == OP_READ) {
// Switching from RD to WR
// Clear out the part of m_rw_word that is going to be written
- LOG_RW("Switch RD->WR @%d, idx=%d, w=%04x\n" , m_rw_pos , m_bit_idx , m_rw_word);
+ LOG_RW("Switch RD->WR @%d, idx=%d, w=%04x\n", m_rw_pos, m_bit_idx, m_rw_word);
if (is_moving_fwd()) {
if (--m_bit_idx >= 0) {
m_rw_word &= 0xffffU << (m_bit_idx + 1);
@@ -311,7 +305,7 @@ void hp_dc100_tape_device::set_op(tape_op_t op , bool force)
break;
case OP_ERASE:
- LOG_DBG("Start GAP @%d\n" , m_tape_pos);
+ LOG_DBG("Start GAP @%d\n", m_tape_pos);
m_rw_pos = m_tape_pos;
break;
@@ -351,11 +345,11 @@ void hp_dc100_tape_device::update_speed_pos()
double acceleration = m_set_point > m_speed ? m_acceleration : -m_acceleration;
bool retrigger_motion = false;
if (delta_time_double < time_to_const_v) {
- space_const_a = const_a_space(acceleration , delta_time_double);
+ space_const_a = const_a_space(acceleration, delta_time_double);
m_speed += delta_time_double * acceleration;
time_const_v = 0.0;
} else {
- space_const_a = const_a_space(acceleration , time_to_const_v);
+ space_const_a = const_a_space(acceleration, time_to_const_v);
time_const_v = delta_time_double - time_to_const_v;
LOG_DBG("Acceleration ends\n");
m_accelerating = false;
@@ -371,13 +365,13 @@ void hp_dc100_tape_device::update_speed_pos()
(fabs(prev_speed) - m_go_threshold) * (fabs(m_speed) - m_go_threshold) < 0.0) {
// Slow speed threshold crossed
// In-motion threshold crossed
- LOG_DBG("Thr crossed %f->%f\n" , prev_speed , m_speed);
+ LOG_DBG("Thr crossed %f->%f\n", prev_speed, m_speed);
motion_event = true;
retrigger_motion = true;
}
if (prev_speed * m_speed < 0.0) {
// Direction inverted (speed sign flipped)
- LOG_DBG("Dir inverted s=%f\n" , m_speed);
+ LOG_DBG("Dir inverted s=%f\n", m_speed);
inverted = true;
retrigger_motion = true;
}
@@ -390,8 +384,8 @@ void hp_dc100_tape_device::update_speed_pos()
}
hti_format_t::tape_pos_t delta_pos = (hti_format_t::tape_pos_t)((space_const_a + m_speed * time_const_v) * hti_format_t::ONE_INCH_POS);
- LOG_DBG("dp=%d\n" , delta_pos);
- if (!hti_format_t::pos_offset(m_tape_pos , true , delta_pos)) {
+ LOG_DBG("dp=%d\n", delta_pos);
+ if (!hti_format_t::pos_offset(m_tape_pos, true, delta_pos)) {
LOG("Tape unspooled!\n");
}
@@ -418,7 +412,7 @@ hti_format_t::tape_pos_t hp_dc100_tape_device::get_approx_pos() const
attotime delta_time{ machine().time() - m_start_time };
hti_format_t::tape_pos_t delta_pos = (hti_format_t::tape_pos_t)(delta_time.as_double() * m_speed * hti_format_t::ONE_INCH_POS);
auto tape_pos = m_tape_pos;
- hti_format_t::pos_offset(tape_pos , true , delta_pos);
+ hti_format_t::pos_offset(tape_pos, true, delta_pos);
return tape_pos;
}
@@ -429,15 +423,15 @@ bool hp_dc100_tape_device::gap_reached(hti_format_t::tape_pos_t min_gap_size)
if (m_gap_detect_start != hti_format_t::NULL_TAPE_POS &&
abs(m_gap_detect_start - m_tape_pos) >= min_gap_size) {
auto tmp = m_tape_pos;
- hti_format_t::pos_offset(tmp , is_moving_fwd() , -min_gap_size);
- if (m_image.just_gap(get_track_no() , tmp , m_tape_pos)) {
+ hti_format_t::pos_offset(tmp, is_moving_fwd(), -min_gap_size);
+ if (m_image.just_gap(get_track_no(), tmp, m_tape_pos)) {
return true;
}
}
return false;
}
-void hp_dc100_tape_device::time_to_next_gap(hti_format_t::tape_pos_t min_gap_size , bool new_gap , emu_timer *target_timer)
+void hp_dc100_tape_device::time_to_next_gap(hti_format_t::tape_pos_t min_gap_size, bool new_gap, emu_timer *target_timer)
{
update_speed_pos();
@@ -446,17 +440,17 @@ void hp_dc100_tape_device::time_to_next_gap(hti_format_t::tape_pos_t min_gap_siz
bool found = true;
if (new_gap) {
hti_format_t::track_iterator_t it;
- found = m_image.next_data(get_track_no() , tmp , fwd , true , it);
+ found = m_image.next_data(get_track_no(), tmp, fwd, true, it);
if (found) {
- tmp = m_image.farthest_end(it , !fwd);
+ tmp = m_image.farthest_end(it, !fwd);
}
}
- if (found && m_image.next_gap(get_track_no() , tmp , fwd , min_gap_size)) {
+ if (found && m_image.next_gap(get_track_no(), tmp, fwd, min_gap_size)) {
hti_format_t::tape_pos_t dummy;
- LOG_DBG("TTNG T%u S%d N%d %d->%d\n" , get_track_no() , min_gap_size , new_gap , m_tape_pos , tmp);
+ LOG_DBG("TTNG T%u S%d N%d %d->%d\n", get_track_no(), min_gap_size, new_gap, m_tape_pos, tmp);
time_to_distance(tmp - m_tape_pos, dummy, target_timer);
} else {
- LOG_DBG("TTNG T%u S%d N%d %d->X\n" , get_track_no() , min_gap_size , new_gap , m_tape_pos);
+ LOG_DBG("TTNG T%u S%d N%d %d->X\n", get_track_no(), min_gap_size, new_gap, m_tape_pos);
target_timer->reset();
}
}
@@ -493,10 +487,10 @@ void hp_dc100_tape_device::device_start()
save_item(NAME(m_next_hole_pos));
save_item(NAME(m_image_dirty));
- m_bit_timer = timer_alloc(BIT_TMR_ID);
- m_tacho_timer = timer_alloc(TACHO_TMR_ID);
- m_hole_timer = timer_alloc(HOLE_TMR_ID);
- m_motion_timer = timer_alloc(MOTION_TMR_ID);
+ m_bit_timer = timer_alloc(FUNC(hp_dc100_tape_device::bit_timer_tick), this);
+ m_tacho_timer = timer_alloc(FUNC(hp_dc100_tape_device::tacho_timer_tick), this);
+ m_hole_timer = timer_alloc(FUNC(hp_dc100_tape_device::hole_timer_tick), this);
+ m_motion_timer = timer_alloc(FUNC(hp_dc100_tape_device::motion_timer_tick), this);
}
void hp_dc100_tape_device::device_reset()
@@ -504,71 +498,76 @@ void hp_dc100_tape_device::device_reset()
clear_state();
}
-void hp_dc100_tape_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(hp_dc100_tape_device::bit_timer_tick)
{
- LOG_TMR("%.6f TMR %d p=%d s=%.3f(%.3f) a=%d\n" , machine().time().as_double() , id , m_tape_pos , m_speed , m_set_point , m_accelerating);
+ LOG_TMR("%.6f TMR 0 p=%d s=%.3f(%.3f) a=%d\n", machine().time().as_double(), m_tape_pos, m_speed, m_set_point, m_accelerating);
update_speed_pos();
- switch (id) {
- case BIT_TMR_ID:
- m_tape_pos = m_next_bit_pos;
- if (m_current_op == OP_READ) {
- bool bit = BIT(m_rd_it->second , m_bit_idx);
- m_rd_bit_handler(bit);
- if (is_moving_fwd()) {
- if (--m_bit_idx >= 0) {
- time_to_distance(m_image.bit_length(BIT(m_rd_it->second , m_bit_idx)), m_next_bit_pos, m_bit_timer);
- } else {
- m_rd_it_valid = m_image.adv_it(get_track_no() , true , m_rd_it) != hti_format_t::ADV_NO_MORE_DATA;
- load_rd_word();
- }
+ m_tape_pos = m_next_bit_pos;
+ if (m_current_op == OP_READ) {
+ bool bit = BIT(m_rd_it->second, m_bit_idx);
+ m_rd_bit_handler(bit);
+ if (is_moving_fwd()) {
+ if (--m_bit_idx >= 0) {
+ time_to_distance(m_image.bit_length(BIT(m_rd_it->second, m_bit_idx)), m_next_bit_pos, m_bit_timer);
} else {
- if (++m_bit_idx < 16) {
- time_to_distance(-m_image.bit_length(BIT(m_rd_it->second , m_bit_idx)), m_next_bit_pos, m_bit_timer);
- } else {
- m_rd_it_valid = m_image.adv_it(get_track_no() , false , m_rd_it) != hti_format_t::ADV_NO_MORE_DATA;
- load_rd_word();
- }
- }
- } else if (m_current_op == OP_WRITE) {
- bool bit = m_wr_bit_handler();
- hti_format_t::tape_pos_t bit_len = m_image.bit_length(bit);
- if (bit) {
- BIT_SET(m_rw_word , m_bit_idx);
+ m_rd_it_valid = m_image.adv_it(get_track_no(), true, m_rd_it) != hti_format_t::ADV_NO_MORE_DATA;
+ load_rd_word();
}
- if (is_moving_fwd()) {
- if (--m_bit_idx < 0) {
- store_wr_word();
- }
+ } else {
+ if (++m_bit_idx < 16) {
+ time_to_distance(-m_image.bit_length(BIT(m_rd_it->second, m_bit_idx)), m_next_bit_pos, m_bit_timer);
} else {
- if (++m_bit_idx >= 16) {
- store_wr_word();
- }
- bit_len = -bit_len;
+ m_rd_it_valid = m_image.adv_it(get_track_no(), false, m_rd_it) != hti_format_t::ADV_NO_MORE_DATA;
+ load_rd_word();
}
- time_to_distance(bit_len, m_next_bit_pos, m_bit_timer);
}
- break;
+ } else if (m_current_op == OP_WRITE) {
+ bool bit = m_wr_bit_handler();
+ hti_format_t::tape_pos_t bit_len = m_image.bit_length(bit);
+ if (bit) {
+ BIT_SET(m_rw_word, m_bit_idx);
+ }
+ if (is_moving_fwd()) {
+ if (--m_bit_idx < 0) {
+ store_wr_word();
+ }
+ } else {
+ if (++m_bit_idx >= 16) {
+ store_wr_word();
+ }
+ bit_len = -bit_len;
+ }
+ time_to_distance(bit_len, m_next_bit_pos, m_bit_timer);
+ }
+}
- case TACHO_TMR_ID:
- m_tape_pos = m_next_tacho_pos;
- m_tacho_tick_handler(1);
- adjust_tacho_timer();
- break;
+TIMER_CALLBACK_MEMBER(hp_dc100_tape_device::tacho_timer_tick)
+{
+ LOG_TMR("%.6f TMR 1 p=%d s=%.3f(%.3f) a=%d\n", machine().time().as_double(), m_tape_pos, m_speed, m_set_point, m_accelerating);
+ update_speed_pos();
- case HOLE_TMR_ID:
- m_tape_pos = m_next_hole_pos;
- m_hole_handler(1);
- adjust_hole_timer();
- break;
+ m_tape_pos = m_next_tacho_pos;
+ m_tacho_tick_handler(1);
+ adjust_tacho_timer();
+}
- case MOTION_TMR_ID:
- // In itself it does nothing (all work is in update_speed_pos)
- break;
+TIMER_CALLBACK_MEMBER(hp_dc100_tape_device::hole_timer_tick)
+{
+ LOG_TMR("%.6f TMR 2 p=%d s=%.3f(%.3f) a=%d\n", machine().time().as_double(), m_tape_pos, m_speed, m_set_point, m_accelerating);
+ update_speed_pos();
- default:
- break;
- }
+ m_tape_pos = m_next_hole_pos;
+ m_hole_handler(1);
+ adjust_hole_timer();
+}
+
+TIMER_CALLBACK_MEMBER(hp_dc100_tape_device::motion_timer_tick)
+{
+ LOG_TMR("%.6f TMR 2 p=%d s=%.3f(%.3f) a=%d\n", machine().time().as_double(), m_tape_pos, m_speed, m_set_point, m_accelerating);
+ update_speed_pos();
+
+ // All work is in update_speed_pos
}
void hp_dc100_tape_device::clear_state()
@@ -599,7 +598,7 @@ void hp_dc100_tape_device::clear_state()
image_init_result hp_dc100_tape_device::internal_load(bool is_create)
{
- LOG("load %d\n" , is_create);
+ LOG("load %d\n", is_create);
device_reset();
@@ -624,7 +623,7 @@ image_init_result hp_dc100_tape_device::internal_load(bool is_create)
}
if (!m_image.load_tape(*io)) {
LOG("load failed\n");
- seterror(image_error::INVALIDIMAGE , "Wrong format");
+ seterror(image_error::INVALIDIMAGE, "Wrong format");
set_tape_present(false);
return image_init_result::FAIL;
}
@@ -645,7 +644,7 @@ void hp_dc100_tape_device::set_tape_present(bool present)
}
}
-double hp_dc100_tape_device::compute_set_point(tape_speed_t speed , bool fwd) const
+double hp_dc100_tape_device::compute_set_point(tape_speed_t speed, bool fwd) const
{
double sp;
@@ -666,7 +665,7 @@ double hp_dc100_tape_device::compute_set_point(tape_speed_t speed , bool fwd) co
void hp_dc100_tape_device::start_tape()
{
- LOG_DBG("Tape started %.6f p=%d\n" , machine().time().as_double() , m_tape_pos);
+ LOG_DBG("Tape started %.6f p=%d\n", machine().time().as_double(), m_tape_pos);
m_start_time = machine().time();
m_accelerating = true;
m_speed = 0;
@@ -674,7 +673,7 @@ void hp_dc100_tape_device::start_tape()
void hp_dc100_tape_device::stop_tape()
{
- LOG_DBG("Tape stops %.6f p=%d\n" , machine().time().as_double() , m_tape_pos);
+ LOG_DBG("Tape stops %.6f p=%d\n", machine().time().as_double(), m_tape_pos);
m_start_time = attotime::never;
m_accelerating = false;
m_speed = 0;
@@ -684,34 +683,34 @@ void hp_dc100_tape_device::stop_tape()
stop_op();
}
-double hp_dc100_tape_device::const_a_space(double a , double t) const
+double hp_dc100_tape_device::const_a_space(double a, double t) const
{
// Space traveled in time 't' at constant acceleration 'a' starting with 'm_speed' speed
return t * (m_speed + a / 2 * t);
}
-attotime hp_dc100_tape_device::time_to_threshold(double threshold , bool zero_allowed) const
+attotime hp_dc100_tape_device::time_to_threshold(double threshold, bool zero_allowed) const
{
attotime time{ attotime::never };
auto delta_sp = m_set_point - m_speed;
auto delta_t = threshold - m_speed;
- LOG_DBG("Dsp=%.6f D+th=%.6f\n" , delta_sp , delta_t);
+ LOG_DBG("Dsp=%.6f D+th=%.6f\n", delta_sp, delta_t);
if ((delta_sp * delta_t > 0.0 && fabs(delta_t) <= fabs(delta_sp)) ||
(zero_allowed && delta_t == 0.0)) {
time = attotime::from_double(fabs(delta_t) / m_acceleration);
- LOG_DBG("Time to +th: %.6f\n" , time.as_double());
+ LOG_DBG("Time to +th: %.6f\n", time.as_double());
}
delta_t = -threshold - m_speed;
- LOG_DBG("Dsp=%.6f D-th=%.6f\n" , delta_sp , delta_t);
+ LOG_DBG("Dsp=%.6f D-th=%.6f\n", delta_sp, delta_t);
if ((delta_sp * delta_t > 0.0 && fabs(delta_t) <= fabs(delta_sp)) ||
(zero_allowed && delta_t == 0.0)) {
double tm = fabs(delta_t) / m_acceleration;
if (tm < time.as_double()) {
time = attotime::from_double(tm);
- LOG_DBG("Time to -th: %.6f\n" , time.as_double());
+ LOG_DBG("Time to -th: %.6f\n", time.as_double());
}
}
return time;
@@ -728,16 +727,16 @@ void hp_dc100_tape_device::set_motion_timer()
// 3. Tape direction reverses
// 4. Set point is reached
// Motion timer is set to expire at the event that occurs first
- attotime time{ time_to_threshold(m_slow_set_point , true) };
+ attotime time{ time_to_threshold(m_slow_set_point, true) };
- attotime tmp{ time_to_threshold(m_go_threshold , false) };
+ attotime tmp{ time_to_threshold(m_go_threshold, false) };
if (tmp < time) {
time = tmp;
}
// Time to the moment when tape inverts its motion
// (i.e. when m_speed crosses 0)
- tmp = time_to_threshold(0.0 , false);
+ tmp = time_to_threshold(0.0, false);
if (tmp < time) {
time = tmp;
}
@@ -760,7 +759,7 @@ void hp_dc100_tape_device::set_motion_timer()
}
}
-void hp_dc100_tape_device::time_to_distance(hti_format_t::tape_pos_t distance , hti_format_t::tape_pos_t& target_pos , emu_timer *target_timer) const
+void hp_dc100_tape_device::time_to_distance(hti_format_t::tape_pos_t distance, hti_format_t::tape_pos_t& target_pos, emu_timer *target_timer) const
{
if (m_start_time.is_never()) {
// If tape is stopped we'll never get there..
@@ -769,7 +768,7 @@ void hp_dc100_tape_device::time_to_distance(hti_format_t::tape_pos_t distance ,
}
target_pos = m_tape_pos;
- if (!hti_format_t::pos_offset(target_pos , true , distance)) {
+ if (!hti_format_t::pos_offset(target_pos, true, distance)) {
// Beyond end of tape
target_timer->reset();
return;
@@ -792,11 +791,11 @@ void hp_dc100_tape_device::time_to_distance(hti_format_t::tape_pos_t distance ,
if (has_root) {
double time_in_const_a_pos = (sqrt(delta) - m_speed) / acceleration;
double time_in_const_a_neg = -(sqrt(delta) + m_speed) / acceleration;
- LOG_DBG("TTD %.6f %.6f\n" , time_in_const_a_pos , time_in_const_a_neg);
+ LOG_DBG("TTD %.6f %.6f\n", time_in_const_a_pos, time_in_const_a_neg);
if (time_in_const_a_pos >= 0.0) {
if (time_in_const_a_neg >= 0.0) {
// pos + neg +
- time_in_const_a = std::min(time_in_const_a_pos , time_in_const_a_neg);
+ time_in_const_a = std::min(time_in_const_a_pos, time_in_const_a_neg);
} else {
// pos + neg -
time_in_const_a = time_in_const_a_pos;
@@ -811,14 +810,14 @@ void hp_dc100_tape_device::time_to_distance(hti_format_t::tape_pos_t distance ,
}
}
}
- LOG_DBG("TTD %d %d %.6f %.6f %.6f\n" , distance , has_root , m_speed , time_to_const_v , time_in_const_a);
+ LOG_DBG("TTD %d %d %.6f %.6f %.6f\n", distance, has_root, m_speed, time_to_const_v, time_in_const_a);
if (has_root && time_in_const_a <= time_to_const_v) {
// Entirely in the constant A phase
time_const_a = time_in_const_a;
space = 0.0;
} else {
// Partly in const A & partly in const V
- double space_in_const_a = const_a_space(acceleration , time_to_const_v);
+ double space_in_const_a = const_a_space(acceleration, time_to_const_v);
space -= space_in_const_a;
time_const_a = time_to_const_v;
}
@@ -843,7 +842,7 @@ void hp_dc100_tape_device::time_to_distance(hti_format_t::tape_pos_t distance ,
} else {
time_const_v = 0.0;
}
- LOG_DBG("TTD %.6f %.6f\n" , time_const_a , time_const_v);
+ LOG_DBG("TTD %.6f %.6f\n", time_const_a, time_const_v);
target_timer->adjust(attotime::from_double(time_const_a + time_const_v));
}
@@ -864,13 +863,13 @@ void hp_dc100_tape_device::adjust_tacho_timer()
// on a tick (tick_fract == 0)
dist_to_next = -m_tick_size;
}
- LOG_DBG("Next tick @%d (pos=%d)\n" , dist_to_next , m_tape_pos);
+ LOG_DBG("Next tick @%d (pos=%d)\n", dist_to_next, m_tape_pos);
time_to_distance(dist_to_next, m_next_tacho_pos, m_tacho_timer);
}
void hp_dc100_tape_device::adjust_hole_timer()
{
- auto hole_pos = m_image.next_hole(m_tape_pos , is_moving_fwd());
+ auto hole_pos = m_image.next_hole(m_tape_pos, is_moving_fwd());
if (hole_pos == hti_format_t::NULL_TAPE_POS) {
m_hole_timer->reset();
} else {
@@ -883,8 +882,8 @@ void hp_dc100_tape_device::stop_op()
if (m_current_op == OP_WRITE) {
store_wr_word();
} else if (m_current_op == OP_ERASE) {
- LOG_DBG("Wr gap from %d to %d\n" , m_rw_pos , m_tape_pos);
- m_image.write_gap(get_track_no() , m_rw_pos , m_tape_pos);
+ LOG_DBG("Wr gap from %d to %d\n", m_rw_pos, m_tape_pos);
+ m_image.write_gap(get_track_no(), m_rw_pos, m_tape_pos);
m_image_dirty = true;
}
m_bit_timer->reset();
@@ -902,16 +901,16 @@ void hp_dc100_tape_device::load_rd_word()
m_bit_idx = 0;
}
// This is actually the nearest end (dir is inverted)
- m_rw_pos = m_next_bit_pos = m_image.farthest_end(m_rd_it , !fwd);
+ m_rw_pos = m_next_bit_pos = m_image.farthest_end(m_rd_it, !fwd);
// Compute end of bit cell
- hti_format_t::tape_pos_t bit_len = m_image.bit_length(BIT(m_rd_it->second , m_bit_idx));
+ hti_format_t::tape_pos_t bit_len = m_image.bit_length(BIT(m_rd_it->second, m_bit_idx));
if (!fwd) {
bit_len = -bit_len;
}
- time_to_distance(m_next_bit_pos + bit_len - m_tape_pos , m_next_bit_pos , m_bit_timer);
- LOG_RW("RD %04x @%d\n" , m_rd_it->second , m_next_bit_pos);
+ time_to_distance(m_next_bit_pos + bit_len - m_tape_pos, m_next_bit_pos, m_bit_timer);
+ LOG_RW("RD %04x @%d\n", m_rd_it->second, m_next_bit_pos);
} else {
- LOG_RW("End of RD data @%d\n" , m_tape_pos);
+ LOG_RW("End of RD data @%d\n", m_tape_pos);
stop_op();
m_gap_detect_start = m_tape_pos;
}
@@ -928,8 +927,8 @@ void hp_dc100_tape_device::store_wr_word()
if (!fwd) {
m_rw_pos -= word_length;
}
- LOG_RW("WR %04x @%d\n" , m_rw_word , m_rw_pos);
- m_image.write_word(get_track_no() , m_rw_pos , m_rw_word , word_length , fwd);
+ LOG_RW("WR %04x @%d\n", m_rw_word, m_rw_pos);
+ m_image.write_word(get_track_no(), m_rw_pos, m_rw_word, word_length, fwd);
m_image_dirty = true;
m_rw_word = 0;
if (fwd) {
diff --git a/src/devices/machine/hp_dc100_tape.h b/src/devices/machine/hp_dc100_tape.h
index 3ee166466ce..fd8ff3b5425 100644
--- a/src/devices/machine/hp_dc100_tape.h
+++ b/src/devices/machine/hp_dc100_tape.h
@@ -103,7 +103,11 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(bit_timer_tick);
+ TIMER_CALLBACK_MEMBER(tacho_timer_tick);
+ TIMER_CALLBACK_MEMBER(hole_timer_tick);
+ TIMER_CALLBACK_MEMBER(motion_timer_tick);
private:
devcb_write_line m_cart_out_handler;
diff --git a/src/devices/machine/hp_taco.cpp b/src/devices/machine/hp_taco.cpp
index 02cbfa2199d..8896edf0fc2 100644
--- a/src/devices/machine/hp_taco.cpp
+++ b/src/devices/machine/hp_taco.cpp
@@ -141,16 +141,18 @@
#include "hp_taco.h"
// Debugging
-#include "logmacro.h"
+
#define LOG_DBG_MASK (LOG_GENERAL << 1)
-#define LOG_DBG(...) LOGMASKED(LOG_DBG_MASK, __VA_ARGS__)
#define LOG_RW_MASK (LOG_DBG_MASK << 1)
-#define LOG_RW(...) LOGMASKED(LOG_RW_MASK, __VA_ARGS__)
#define LOG_REG_MASK (LOG_RW_MASK << 1)
+
+#define LOG_DBG(...) LOGMASKED(LOG_DBG_MASK, __VA_ARGS__)
+#define LOG_RW(...) LOGMASKED(LOG_RW_MASK, __VA_ARGS__)
#define LOG_REG(...) LOGMASKED(LOG_REG_MASK, __VA_ARGS__)
-#undef VERBOSE
+
//#define VERBOSE (LOG_GENERAL | LOG_DBG_MASK | LOG_RW_MASK | LOG_REG_MASK)
#define VERBOSE (LOG_GENERAL)
+#include "logmacro.h"
// Bit manipulation
namespace {
@@ -159,24 +161,17 @@ namespace {
return (T)1U << n;
}
- template<typename T> void BIT_CLR(T& w , unsigned n)
+ template<typename T> void BIT_CLR(T& w, unsigned n)
{
w &= ~BIT_MASK<T>(n);
}
- template<typename T> void BIT_SET(T& w , unsigned n)
+ template<typename T> void BIT_SET(T& w, unsigned n)
{
w |= BIT_MASK<T>(n);
}
}
-// Timers
-enum {
- GAP_TMR_ID,
- EVD_TMR_ID,
- ERROR_TMR_ID
-};
-
// **** Constants ****
constexpr unsigned TACH_FREQ_FAST = 87196; // Tachometer pulse frequency for fast speed (90.08 ips)
constexpr unsigned TACH_FREQ_SLOW = 21276; // Tachometer pulse frequency for slow speed (21.98 ips)
@@ -281,7 +276,7 @@ DEFINE_DEVICE_TYPE(HP_TACO, hp_taco_device, "hp_taco", "HP TACO")
// Constructors
hp_taco_device::hp_taco_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, type, tag, owner, clock)
- , m_tape(*this , "drive")
+ , m_tape(*this, "drive")
, m_irq_handler(*this)
, m_flg_handler(*this)
, m_sts_handler(*this)
@@ -300,7 +295,7 @@ void hp_taco_device::set_name(const std::string& name)
void hp_taco_device::reg_w(offs_t offset, uint16_t data)
{
- LOG_REG("wr R%u = %04x\n", 4 + offset , data);
+ LOG_REG("wr R%u = %04x\n", 4 + offset, data);
// Any I/O activity clears IRQ
irq_w(false);
@@ -344,9 +339,9 @@ uint16_t hp_taco_device::reg_r(offs_t offset)
case 1:
// Command & status register
if (m_tape->gap_reached(SHORT_GAP_LENGTH)) {
- BIT_SET(m_status_reg , CMD_ST_GAP);
+ BIT_SET(m_status_reg, CMD_ST_GAP);
} else {
- BIT_CLR(m_status_reg , CMD_ST_GAP);
+ BIT_CLR(m_status_reg, CMD_ST_GAP);
}
res = (m_cmd_reg & CMD_REG_MASK) | (m_status_reg & STATUS_REG_MASK);
break;
@@ -363,7 +358,7 @@ uint16_t hp_taco_device::reg_r(offs_t offset)
break;
}
- LOG_REG("rd R%u = %04x\n", 4 + offset , res);
+ LOG_REG("rd R%u = %04x\n", 4 + offset, res);
return res;
}
@@ -380,10 +375,10 @@ READ_LINE_MEMBER(hp_taco_device::sts_r)
WRITE_LINE_MEMBER(hp_taco_device::cart_out_w)
{
- LOG_DBG("cart_out_w %d\n" , state);
+ LOG_DBG("cart_out_w %d\n", state);
set_tape_present(!state);
if (state && m_cmd_state != CMD_IDLE) {
- set_error(true , false);
+ set_error(true, false);
m_cmd_state = CMD_IDLE;
}
}
@@ -393,10 +388,10 @@ WRITE_LINE_MEMBER(hp_taco_device::hole_w)
if (state) {
LOG_DBG("hole_w\n");
if (m_cmd_state != CMD_IDLE && m_cmd_state != CMD_STOPPING &&
- (!is_double_hole_cmd(m_cmd_reg) || BIT(m_status_reg , CMD_ST_HOLE))) {
- set_error(true , false);
+ (!is_double_hole_cmd(m_cmd_reg) || BIT(m_status_reg, CMD_ST_HOLE))) {
+ set_error(true, false);
}
- BIT_SET(m_status_reg , CMD_ST_HOLE);
+ BIT_SET(m_status_reg, CMD_ST_HOLE);
}
}
@@ -427,7 +422,7 @@ WRITE_LINE_MEMBER(hp_taco_device::tacho_tick_w)
if (m_cmd_state == CMD_PH2) {
m_tach_reg++;
if (m_tach_reg == 0) {
- if (!BIT(m_cmd_reg , CMD_ST_G0)) {
+ if (!BIT(m_cmd_reg, CMD_ST_G0)) {
irq_w(true);
}
send_stop();
@@ -465,7 +460,7 @@ WRITE_LINE_MEMBER(hp_taco_device::motion_w)
WRITE_LINE_MEMBER(hp_taco_device::rd_bit_w)
{
- LOG_RW("RD bit %d (st=%d,w=%04x,i=%u)\n" , state , m_cmd_state , m_working_reg , m_bit_idx);
+ LOG_RW("RD bit %d (st=%d,w=%04x,i=%u)\n", state, m_cmd_state, m_working_reg, m_bit_idx);
if (m_cmd_state != CMD_IDLE) {
switch (get_cmd(m_cmd_reg)) {
case CMD_RD_6UPD:
@@ -479,7 +474,7 @@ WRITE_LINE_MEMBER(hp_taco_device::rd_bit_w)
// Synchronized
LOG_RW("RD synced!\n");
m_cmd_state = CMD_PH2;
- m_bit_idx = BIT(m_cmd_reg , CMD_ST_G0) ? 17 : 15;
+ m_bit_idx = BIT(m_cmd_reg, CMD_ST_G0) ? 17 : 15;
m_working_reg = 0;
}
} else if (m_cmd_state == CMD_PH2) {
@@ -489,15 +484,15 @@ WRITE_LINE_MEMBER(hp_taco_device::rd_bit_w)
break;
} else if (m_bit_idx != 16 && state) {
// Skip 17th bit when reading in 9825 format
- BIT_SET(m_working_reg , m_bit_idx);
+ BIT_SET(m_working_reg, m_bit_idx);
}
if (adv_bit_idx()) {
m_data_reg = m_working_reg;
m_working_reg = 0;
- if (!BIT(m_cmd_reg , CMD_ST_G2)) {
+ if (!BIT(m_cmd_reg, CMD_ST_G2)) {
update_checksum(m_data_reg);
}
- LOG_RW("RD word %04x csum=%04x\n" , m_data_reg , m_checksum_reg);
+ LOG_RW("RD word %04x csum=%04x\n", m_data_reg, m_checksum_reg);
irq_w(true);
}
}
@@ -529,7 +524,7 @@ READ_LINE_MEMBER(hp_taco_device::wr_bit_r)
// HP9825 format: 17th bit
bit = true;
} else {
- bit = BIT(m_working_reg , m_bit_idx);
+ bit = BIT(m_working_reg, m_bit_idx);
}
if (adv_bit_idx()) {
m_working_reg = m_data_reg;
@@ -537,20 +532,20 @@ READ_LINE_MEMBER(hp_taco_device::wr_bit_r)
if ((get_cmd(m_cmd_reg) & ~BIT_MASK<uint8_t>(0)) != CMD_WR_CSUM) {
update_checksum(m_data_reg);
}
- LOG_RW("WR word %04x csum=%04x\n" , m_working_reg , m_checksum_reg);
+ LOG_RW("WR word %04x csum=%04x\n", m_working_reg, m_checksum_reg);
m_data_reg = m_checksum_reg;
irq_w(true);
}
}
- LOG_RW("WR bit %d (w=%04x,i=%u)\n" , bit , m_working_reg , m_bit_idx);
+ LOG_RW("WR bit %d (w=%04x,i=%u)\n", bit, m_working_reg, m_bit_idx);
return bit;
}
void hp_taco_device::device_add_mconfig(machine_config &config)
{
- HP_DC100_TAPE(config , m_tape , 0);
+ HP_DC100_TAPE(config, m_tape, 0);
m_tape->set_acceleration(ACCELERATION);
- m_tape->set_set_points(SLOW_SPEED , FAST_SPEED);
+ m_tape->set_set_points(SLOW_SPEED, FAST_SPEED);
m_tape->set_tick_size(TACH_TICK_LEN);
m_tape->set_image_format(hti_format_t::HTI_DELTA_MOD_16_BITS);
m_tape->set_go_threshold(MOVING_THRESHOLD);
@@ -583,9 +578,9 @@ void hp_taco_device::device_start()
save_item(NAME(m_working_reg));
save_item(NAME(m_bit_idx));
- m_gap_timer = timer_alloc(GAP_TMR_ID);
- m_evd_timer = timer_alloc(EVD_TMR_ID);
- m_error_timer = timer_alloc(ERROR_TMR_ID);
+ m_gap_timer = timer_alloc(FUNC(hp_taco_device::gap_timer_tick), this);
+ m_evd_timer = timer_alloc(FUNC(hp_taco_device::evd_timer_tick), this);
+ m_error_timer = timer_alloc(FUNC(hp_taco_device::error_timer_tick), this);
}
void hp_taco_device::device_reset()
@@ -600,69 +595,51 @@ void hp_taco_device::device_reset()
m_irq_handler(false);
m_flg_handler(true);
m_sts_handler(true);
- set_error(false , false);
+ set_error(false, false);
m_gap_timer->reset();
m_evd_timer->reset();
m_error_timer->reset();
}
-void hp_taco_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(hp_taco_device::gap_timer_tick)
{
- switch (id) {
- case GAP_TMR_ID:
- m_tape->update_speed_pos();
- LOG_DBG("Gap tmr @%g pos=%d cmd %02x st %d\n" , machine().time().as_double() , m_tape->get_pos() , get_cmd(m_cmd_reg) , m_cmd_state);
-
- switch (get_cmd(m_cmd_reg)) {
- case CMD_INT_ON_GAP:
- if (m_cmd_state == CMD_PH1) {
- irq_and_end();
- }
- break;
-
- case CMD_STOP_IN_GAP:
- case CMD_STOP_IN_GAP1:
- if (m_cmd_state == CMD_PH1) {
- // Count 256 ticks
- m_tach_reg = 0xff00;
- m_cmd_state = CMD_PH2;
- }
- break;
-
- case CMD_INT_N_GAP:
- if (m_cmd_state == CMD_PH1) {
- m_tach_reg++;
- if (m_tach_reg == 0) {
- irq_and_end();
- } else {
- set_gap_timer();
- }
- }
- break;
+ m_tape->update_speed_pos();
+ LOG_DBG("Gap tmr @%g pos=%d cmd %02x st %d\n", machine().time().as_double(), m_tape->get_pos(), get_cmd(m_cmd_reg), m_cmd_state);
- case CMD_RD_6UPD:
- case CMD_RD_9825_6UPD:
- case CMD_RD_CSUM_6UPD:
- case CMD_RD_9825_CSUM6:
- // Gap in read error
- set_error(false , true);
- break;
+ switch (get_cmd(m_cmd_reg)) {
+ case CMD_INT_ON_GAP:
+ if (m_cmd_state == CMD_PH1) {
+ irq_and_end();
+ }
+ break;
- default:
- break;
+ case CMD_STOP_IN_GAP:
+ case CMD_STOP_IN_GAP1:
+ if (m_cmd_state == CMD_PH1) {
+ // Count 256 ticks
+ m_tach_reg = 0xff00;
+ m_cmd_state = CMD_PH2;
}
break;
- case EVD_TMR_ID:
- m_tape->update_speed_pos();
- LOG_DBG("EVD tmr @%g pos=%d cmd %02x st %d\n" , machine().time().as_double() , m_tape->get_pos() , get_cmd(m_cmd_reg) , m_cmd_state);
- set_error(true , false);
+ case CMD_INT_N_GAP:
+ if (m_cmd_state == CMD_PH1) {
+ m_tach_reg++;
+ if (m_tach_reg == 0) {
+ irq_and_end();
+ } else {
+ set_gap_timer();
+ }
+ }
break;
- case ERROR_TMR_ID:
- LOG_DBG("Error tmr\n");
- irq_w(true);
+ case CMD_RD_6UPD:
+ case CMD_RD_9825_6UPD:
+ case CMD_RD_CSUM_6UPD:
+ case CMD_RD_9825_CSUM6:
+ // Gap in read error
+ set_error(false, true);
break;
default:
@@ -670,6 +647,19 @@ void hp_taco_device::device_timer(emu_timer &timer, device_timer_id id, int para
}
}
+TIMER_CALLBACK_MEMBER(hp_taco_device::evd_timer_tick)
+{
+ m_tape->update_speed_pos();
+ LOG_DBG("EVD tmr @%g pos=%d cmd %02x st %d\n", machine().time().as_double(), m_tape->get_pos(), get_cmd(m_cmd_reg), m_cmd_state);
+ set_error(true, false);
+}
+
+TIMER_CALLBACK_MEMBER(hp_taco_device::error_timer_tick)
+{
+ LOG_DBG("Error tmr\n");
+ irq_w(true);
+}
+
void hp_taco_device::clear_state()
{
m_data_reg = 0;
@@ -691,7 +681,7 @@ void hp_taco_device::irq_w(bool state)
if (state != m_irq) {
m_irq = state;
m_irq_handler(state);
- LOG_DBG("IRQ = %d\n" , state);
+ LOG_DBG("IRQ = %d\n", state);
}
}
@@ -700,13 +690,13 @@ void hp_taco_device::sts_w(bool state)
if (state != m_sts) {
m_sts = state;
m_sts_handler(state);
- LOG_DBG("STS = %d\n" , state);
+ LOG_DBG("STS = %d\n", state);
}
}
-void hp_taco_device::set_error(bool error , bool gap_in_read)
+void hp_taco_device::set_error(bool error, bool gap_in_read)
{
- LOG_DBG("Error %d %d\n" , error , gap_in_read);
+ LOG_DBG("Error %d %d\n", error, gap_in_read);
m_error = error;
m_gap_in_read = gap_in_read;
@@ -718,7 +708,7 @@ void hp_taco_device::set_error(bool error , bool gap_in_read)
m_cmd_state = CMD_IDLE;
}
sts_w(false);
- m_error_timer->adjust(attotime::zero , 0 , clocks_to_attotime(ERROR_IRQ_PERIOD));
+ m_error_timer->adjust(attotime::zero, 0, clocks_to_attotime(ERROR_IRQ_PERIOD));
if (m_error) {
send_stop();
}
@@ -729,17 +719,17 @@ void hp_taco_device::set_error(bool error , bool gap_in_read)
hti_format_t::tape_pos_t hp_taco_device::min_gap_size() const
{
- return BIT(m_cmd_reg , CMD_ST_FGAP) ? LONG_GAP_LENGTH : SHORT_GAP_LENGTH;
+ return BIT(m_cmd_reg, CMD_ST_FGAP) ? LONG_GAP_LENGTH : SHORT_GAP_LENGTH;
}
void hp_taco_device::set_gap_timer()
{
- m_tape->time_to_next_gap(min_gap_size() , true , m_gap_timer);
+ m_tape->time_to_next_gap(min_gap_size(), true, m_gap_timer);
}
void hp_taco_device::set_evd_timer()
{
- m_tape->time_to_next_gap(EVD_GAP_LENGTH , false , m_evd_timer);
+ m_tape->time_to_next_gap(EVD_GAP_LENGTH, false, m_evd_timer);
}
void hp_taco_device::set_tape_present(bool present)
@@ -761,18 +751,18 @@ void hp_taco_device::send_go()
{
hp_dc100_tape_device::tape_speed_t speed;
- if (BIT(m_cmd_reg , CMD_ST_FST)) {
+ if (BIT(m_cmd_reg, CMD_ST_FST)) {
speed = hp_dc100_tape_device::SP_FAST;
} else {
speed = hp_dc100_tape_device::SP_SLOW;
}
- m_tape->set_speed_setpoint(speed , BIT(m_cmd_reg , CMD_ST_FWD));
+ m_tape->set_speed_setpoint(speed, BIT(m_cmd_reg, CMD_ST_FWD));
}
void hp_taco_device::send_stop()
{
m_tape->set_op(hp_dc100_tape_device::OP_IDLE);
- if (m_tape->set_speed_setpoint(hp_dc100_tape_device::SP_STOP , false)) {
+ if (m_tape->set_speed_setpoint(hp_dc100_tape_device::SP_STOP, false)) {
m_cmd_state = CMD_STOPPING;
}
}
@@ -800,7 +790,7 @@ void hp_taco_device::start_rd()
if (m_tape->get_op() != hp_dc100_tape_device::OP_READ) {
m_tape->set_op(hp_dc100_tape_device::OP_READ);
// TODO: check
- m_tape->time_to_next_gap(GIR_GAP_LENGTH , true , m_gap_timer);
+ m_tape->time_to_next_gap(GIR_GAP_LENGTH, true, m_gap_timer);
set_evd_timer();
}
}
@@ -817,7 +807,7 @@ bool hp_taco_device::adv_bit_idx()
if (m_bit_idx) {
m_bit_idx--;
} else {
- m_bit_idx = BIT(m_cmd_reg , CMD_ST_G0) ? 16 : 15;
+ m_bit_idx = BIT(m_cmd_reg, CMD_ST_G0) ? 16 : 15;
}
return m_bit_idx == 15;
}
@@ -942,7 +932,7 @@ void hp_taco_device::cmd_fsm()
}
}
if (prev_state != m_cmd_state) {
- LOG_DBG("FSM st %d->%d\n" , prev_state , m_cmd_state);
+ LOG_DBG("FSM st %d->%d\n", prev_state, m_cmd_state);
}
}
@@ -955,17 +945,17 @@ uint8_t hp_taco_device::get_cmd(uint16_t cmd_reg)
bool hp_taco_device::is_cmd_rd_wr(uint16_t cmd_reg)
{
- return BIT(cmd_reg , CMD_ST_G1);
+ return BIT(cmd_reg, CMD_ST_G1);
}
bool hp_taco_device::is_cmd_rd(uint16_t cmd_reg)
{
- return is_cmd_rd_wr(cmd_reg) && BIT(cmd_reg , CMD_ST_G3);
+ return is_cmd_rd_wr(cmd_reg) && BIT(cmd_reg, CMD_ST_G3);
}
bool hp_taco_device::is_cmd_wr(uint16_t cmd_reg)
{
- return is_cmd_rd_wr(cmd_reg) && !BIT(cmd_reg , CMD_ST_G3);
+ return is_cmd_rd_wr(cmd_reg) && !BIT(cmd_reg, CMD_ST_G3);
}
bool hp_taco_device::is_double_hole_cmd(uint16_t cmd_reg)
@@ -975,7 +965,7 @@ bool hp_taco_device::is_double_hole_cmd(uint16_t cmd_reg)
void hp_taco_device::start_cmd_exec(uint16_t new_cmd_reg)
{
- LOG_DBG("New cmd %02x D=%d S=%d @ %g cmd %02x st %d\n" , get_cmd(new_cmd_reg) , BIT(new_cmd_reg , CMD_ST_FWD) , BIT(new_cmd_reg , CMD_ST_FST) , machine().time().as_double() , get_cmd(m_cmd_reg) , m_cmd_state);
+ LOG_DBG("New cmd %02x D=%d S=%d @ %g cmd %02x st %d\n", get_cmd(new_cmd_reg), BIT(new_cmd_reg, CMD_ST_FWD), BIT(new_cmd_reg, CMD_ST_FST), machine().time().as_double(), get_cmd(m_cmd_reg), m_cmd_state);
m_tape->update_speed_pos();
@@ -983,7 +973,7 @@ void hp_taco_device::start_cmd_exec(uint16_t new_cmd_reg)
if (new_cmd_code == CMD_CLEAR_ST) {
// Clear status
- set_error(false , false);
+ set_error(false, false);
sts_w(true);
if (!m_tape->cart_out_r()) {
BIT_CLR(m_status_reg, CMD_ST_CART_OUT);
@@ -998,7 +988,7 @@ void hp_taco_device::start_cmd_exec(uint16_t new_cmd_reg)
hp_dc100_tape_device::tape_op_t op = hp_dc100_tape_device::OP_IDLE;
if (m_gap_in_read) {
- set_error(false , false);
+ set_error(false, false);
}
m_cmd_state = CMD_PH0;
@@ -1048,11 +1038,11 @@ void hp_taco_device::start_cmd_exec(uint16_t new_cmd_reg)
case CMD_SET_TRACK:
// 1. Set A/B track
- if (BIT(new_cmd_reg , CMD_ST_MOD)) {
- BIT_SET(m_status_reg , CMD_ST_TRB);
+ if (BIT(new_cmd_reg, CMD_ST_MOD)) {
+ BIT_SET(m_status_reg, CMD_ST_TRB);
m_tape->set_track_no(1);
} else {
- BIT_CLR(m_status_reg , CMD_ST_TRB);
+ BIT_CLR(m_status_reg, CMD_ST_TRB);
m_tape->set_track_no(0);
}
start_tape = false;
@@ -1128,16 +1118,16 @@ void hp_taco_device::start_cmd_exec(uint16_t new_cmd_reg)
break;
default:
- LOG("Unrecognized command %x\n" , new_cmd_code);
+ LOG("Unrecognized command %x\n", new_cmd_code);
start_tape = false;
break;
}
if (start_tape) {
if (m_error ||
- (BIT(m_status_reg , CMD_ST_HOLE) && !is_double_hole_cmd(new_cmd_reg)) ||
- BIT(m_status_reg , CMD_ST_CART_OUT)) {
- set_error(true , false);
+ (BIT(m_status_reg, CMD_ST_HOLE) && !is_double_hole_cmd(new_cmd_reg)) ||
+ BIT(m_status_reg, CMD_ST_CART_OUT)) {
+ set_error(true, false);
return;
} else {
send_go();
diff --git a/src/devices/machine/hp_taco.h b/src/devices/machine/hp_taco.h
index e6c212b6505..f409946a988 100644
--- a/src/devices/machine/hp_taco.h
+++ b/src/devices/machine/hp_taco.h
@@ -52,7 +52,10 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(gap_timer_tick);
+ TIMER_CALLBACK_MEMBER(evd_timer_tick);
+ TIMER_CALLBACK_MEMBER(error_timer_tick);
private:
required_device<hp_dc100_tape_device> m_tape;
diff --git a/src/devices/machine/i7220.cpp b/src/devices/machine/i7220.cpp
index 64a582ddd18..9d9c788759f 100644
--- a/src/devices/machine/i7220.cpp
+++ b/src/devices/machine/i7220.cpp
@@ -79,7 +79,7 @@ void i7220_device::device_start()
intrq_cb.resolve_safe();
drq_cb.resolve_safe();
- bi.tm = timer_alloc(0);
+ m_bi.tm = timer_alloc(FUNC(i7220_device::general_continue), this);
// register for state saving
save_item(NAME(m_regs));
@@ -96,9 +96,9 @@ void i7220_device::device_start()
void i7220_device::device_reset()
{
- main_phase = PHASE_IDLE;
- bi.main_state = IDLE;
- bi.sub_state = IDLE;
+ m_main_phase = PHASE_IDLE;
+ m_bi.main_state = IDLE;
+ m_bi.sub_state = IDLE;
set_drq(false);
set_irq(false);
@@ -108,11 +108,6 @@ void i7220_device::device_reset()
memset(&m_regs, 0, sizeof(m_regs));
}
-void i7220_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- general_continue(bi);
-}
-
image_init_result i7220_device::call_load()
{
if (length() != (m_data_size * I7110_MBM_SIZE))
@@ -125,25 +120,25 @@ image_init_result i7220_device::call_load()
void i7220_device::set_drq(bool state)
{
- if (state != drq)
+ if (state != m_drq)
{
- drq = state;
- drq_cb(drq);
+ m_drq = state;
+ drq_cb(m_drq);
}
}
void i7220_device::set_irq(bool state)
{
- if (state != irq)
+ if (state != m_irq)
{
- irq = state;
- intrq_cb(irq);
+ m_irq = state;
+ intrq_cb(m_irq);
}
}
void i7220_device::update_drq()
{
- switch (bi.main_state)
+ switch (m_bi.main_state)
{
case READ_DATA:
set_drq(m_fifo_size < 22 ? false : true);
@@ -175,7 +170,7 @@ uint8_t i7220_device::fifo_pop()
{
val = m_fifo.dequeue();
m_fifo_size--;
- if (main_phase == PHASE_EXEC)
+ if (m_main_phase == PHASE_EXEC)
{
update_drq();
}
@@ -193,7 +188,7 @@ void i7220_device::fifo_push(uint8_t val)
{
m_fifo.enqueue(val);
m_fifo_size++;
- if (main_phase == PHASE_EXEC)
+ if (m_main_phase == PHASE_EXEC)
{
update_drq();
}
@@ -204,16 +199,16 @@ void i7220_device::update_regs()
{
m_blr = (m_regs[R_BLR_M] << 8) + m_regs[R_BLR_L];
m_ar = (m_regs[R_AR_M] << 8) + m_regs[R_AR_L];
- blr_count = m_blr & 0x7ff;
- blr_nfc = (m_blr >> 12) ? ((m_blr >> 12) << 1) : 1;
- ar_addr = m_ar & 0x7ff;
- ar_mbm = (m_ar >> 11) & 15;
+ m_blr_count = m_blr & 0x7ff;
+ m_blr_nfc = (m_blr >> 12) ? ((m_blr >> 12) << 1) : 1;
+ m_ar_addr = m_ar & 0x7ff;
+ m_ar_mbm = (m_ar >> 11) & 15;
}
void i7220_device::start_command(int cmd)
{
- main_phase = PHASE_EXEC;
+ m_main_phase = PHASE_EXEC;
m_str &= ~SR_CLEAR;
switch (cmd)
@@ -224,45 +219,45 @@ void i7220_device::start_command(int cmd)
// MBM GROUP SELECT bits in the AR must select the last MBM in the system.
case C_INIT:
LOG("BMC INIT: BLR %04x (NFC %d pages %d) AR %04x (MBM %d addr %03x) ER %02d\n",
- m_blr, blr_nfc, blr_count, m_ar, ar_mbm, ar_addr, m_regs[R_ER]);
- if (blr_nfc != 2)
+ m_blr, m_blr_nfc, m_blr_count, m_ar, m_ar_mbm, m_ar_addr, m_regs[R_ER]);
+ if (m_blr_nfc != 2)
{
- command_fail_start(bi);
+ command_fail_start();
}
else
{
- init_start(bi);
+ init_start();
}
break;
case C_READ_FSA_STATUS:
- read_fsa_start(bi);
+ read_fsa_start();
break;
// all parametric registers must be properly set up before issuing Read Bubble Data command
case C_READ:
LOG("BMC RBD: BLR %04x (NFC %d pages %d) AR %04x (MBM %d addr %03x) ER %02d\n",
- m_blr, blr_nfc, blr_count, m_ar, ar_mbm, ar_addr, m_regs[R_ER]);
- if (ar_mbm >= m_data_size || blr_nfc != 2)
+ m_blr, m_blr_nfc, m_blr_count, m_ar, m_ar_mbm, m_ar_addr, m_regs[R_ER]);
+ if (m_ar_mbm >= m_data_size || m_blr_nfc != 2)
{
- command_fail_start(bi);
+ command_fail_start();
}
else
{
- read_data_start(bi);
+ read_data_start();
}
break;
case C_WRITE:
LOG("BMC WBD: BLR %04x (NFC %d pages %d) AR %04x (MBM %d addr %03x) ER %02d\n",
- m_blr, blr_nfc, blr_count, m_ar, ar_mbm, ar_addr, m_regs[R_ER]);
- if (ar_mbm >= m_data_size || blr_nfc != 2)
+ m_blr, m_blr_nfc, m_blr_count, m_ar, m_ar_mbm, m_ar_addr, m_regs[R_ER]);
+ if (m_ar_mbm >= m_data_size || m_blr_nfc != 2)
{
- command_fail_start(bi);
+ command_fail_start();
}
else
{
- write_data_start(bi);
+ write_data_start();
}
break;
@@ -271,28 +266,28 @@ void i7220_device::start_command(int cmd)
m_regs[R_AR_L] = 0;
m_regs[R_AR_M] &= ~7;
update_regs();
- main_phase = PHASE_RESULT;
+ m_main_phase = PHASE_RESULT;
m_str |= SR_DONE;
break;
// controlled termination of currently executing command. command accepted in BUSY state.
// if not BUSY, clears FIFO.
case C_ABORT:
- if (main_phase == PHASE_IDLE)
+ if (m_main_phase == PHASE_IDLE)
{
fifo_clear();
}
else
{
- main_phase = PHASE_RESULT;
- bi.main_state = bi.sub_state = IDLE;
+ m_main_phase = PHASE_RESULT;
+ m_bi.main_state = m_bi.sub_state = IDLE;
}
m_str |= SR_DONE;
break;
case C_RESET_FIFO:
fifo_clear();
- main_phase = PHASE_RESULT;
+ m_main_phase = PHASE_RESULT;
m_str |= SR_DONE;
break;
@@ -300,45 +295,45 @@ void i7220_device::start_command(int cmd)
case C_RESET:
m_regs[R_UR] = 0;
fifo_clear();
- main_phase = PHASE_RESULT;
+ m_main_phase = PHASE_RESULT;
m_str |= SR_DONE;
break;
default:
- command_fail_start(bi);
+ command_fail_start();
break;
}
}
-void i7220_device::general_continue(bubble_info &bi)
+TIMER_CALLBACK_MEMBER(i7220_device::general_continue)
{
- switch (bi.main_state)
+ switch (m_bi.main_state)
{
case IDLE:
break;
case INIT:
- init_continue(bi);
+ init_continue();
break;
case FAIL:
- command_fail_continue(bi);
+ command_fail_continue();
break;
case READ_FSA:
- read_fsa_continue(bi);
+ read_fsa_continue();
break;
case READ_DATA:
- read_data_continue(bi);
+ read_data_continue();
break;
case WRITE_DATA:
- write_data_continue(bi);
+ write_data_continue();
break;
default:
- LOG("BMC general_continue on unknown main-state %d\n", bi.main_state);
+ LOG("BMC general_continue on unknown main-state %d\n", m_bi.main_state);
break;
}
}
@@ -348,11 +343,11 @@ void i7220_device::delay_cycles(emu_timer *tm, int cycles)
tm->adjust(attotime::from_double(double(cycles) / clock()));
}
-void i7220_device::command_end(bubble_info &bi, bool success)
+void i7220_device::command_end(bool success)
{
LOG("command done (%s) - %02x\n", success ? "success" : "fail", m_str);
- main_phase = PHASE_RESULT;
- bi.main_state = bi.sub_state = IDLE;
+ m_main_phase = PHASE_RESULT;
+ m_bi.main_state = m_bi.sub_state = IDLE;
if (success)
{
m_str |= SR_DONE;
@@ -364,88 +359,88 @@ void i7220_device::command_end(bubble_info &bi, bool success)
}
-void i7220_device::command_fail_start(bubble_info &bi)
+void i7220_device::command_fail_start()
{
- bi.main_state = FAIL;
- bi.sub_state = INITIALIZE;
+ m_bi.main_state = FAIL;
+ m_bi.sub_state = INITIALIZE;
- command_fail_continue(bi);
+ command_fail_continue();
}
-void i7220_device::command_fail_continue(bubble_info &bi)
+void i7220_device::command_fail_continue()
{
- switch (bi.sub_state)
+ switch (m_bi.sub_state)
{
case INITIALIZE:
- bi.sub_state = COMMAND_DONE;
- delay_cycles(bi.tm, 1200); // XXX
+ m_bi.sub_state = COMMAND_DONE;
+ delay_cycles(m_bi.tm, 1200); // XXX
return;
case COMMAND_DONE:
- command_end(bi, false);
+ command_end(false);
return;
default:
- LOG("BMC fail unknown sub-state %d\n", bi.sub_state);
+ LOG("BMC fail unknown sub-state %d\n", m_bi.sub_state);
return;
}
}
-void i7220_device::init_start(bubble_info &bi)
+void i7220_device::init_start()
{
- bi.main_state = INIT;
- bi.sub_state = INITIALIZE;
+ m_bi.main_state = INIT;
+ m_bi.sub_state = INITIALIZE;
- init_continue(bi);
+ init_continue();
}
-void i7220_device::init_continue(bubble_info &bi)
+void i7220_device::init_continue()
{
for (;;)
{
- switch (bi.sub_state)
+ switch (m_bi.sub_state)
{
case INITIALIZE:
- bi.sub_state = WAIT_FSA_REPLY;
- delay_cycles(bi.tm, m_data_size * 60); // p. 4-16 of BPK72UM
+ m_bi.sub_state = WAIT_FSA_REPLY;
+ delay_cycles(m_bi.tm, m_data_size * 60); // p. 4-16 of BPK72UM
return;
case WAIT_FSA_REPLY:
- bi.sub_state = COMMAND_DONE;
+ m_bi.sub_state = COMMAND_DONE;
break;
case COMMAND_DONE:
- command_end(bi, true);
+ command_end(true);
return;
default:
- LOG("BMC init unknown sub-state %d\n", bi.sub_state);
+ LOG("BMC init unknown sub-state %d\n", m_bi.sub_state);
return;
}
}
}
-void i7220_device::read_fsa_start(bubble_info &bi)
+void i7220_device::read_fsa_start()
{
- bi.main_state = READ_FSA;
- bi.sub_state = INITIALIZE;
+ m_bi.main_state = READ_FSA;
+ m_bi.sub_state = INITIALIZE;
- read_fsa_continue(bi);
+ read_fsa_continue();
}
-void i7220_device::read_fsa_continue(bubble_info &bi)
+void i7220_device::read_fsa_continue()
{
for (;;)
{
- switch (bi.sub_state)
+ switch (m_bi.sub_state)
{
case INITIALIZE:
- bi.sub_state = WAIT_FSA_REPLY;
- delay_cycles(bi.tm, m_data_size * 60); // p. 4-16 of BPK72UM
+ m_bi.sub_state = WAIT_FSA_REPLY;
+ delay_cycles(m_bi.tm, m_data_size * 60); // p. 4-16 of BPK72UM
return;
case WAIT_FSA_REPLY:
- bi.sub_state = COMMAND_DONE;
+ m_bi.sub_state = COMMAND_DONE;
break;
case COMMAND_DONE:
@@ -455,113 +450,113 @@ void i7220_device::read_fsa_continue(bubble_info &bi)
fifo_push(0x28); // FIFOMT | ECF/F
fifo_push(0x28);
}
- command_end(bi, true);
+ command_end(true);
return;
default:
- LOG("BMC read fsa unknown sub-state %d\n", bi.sub_state);
+ LOG("BMC read fsa unknown sub-state %d\n", m_bi.sub_state);
return;
}
}
}
-void i7220_device::read_data_start(bubble_info &bi)
+void i7220_device::read_data_start()
{
- bi.main_state = READ_DATA;
- bi.sub_state = INITIALIZE;
+ m_bi.main_state = READ_DATA;
+ m_bi.sub_state = INITIALIZE;
- read_data_continue(bi);
+ read_data_continue();
}
-void i7220_device::read_data_continue(bubble_info &bi)
+void i7220_device::read_data_continue()
{
for (;;)
{
- switch (bi.sub_state)
+ switch (m_bi.sub_state)
{
case INITIALIZE:
- bi.sub_state = SECTOR_READ;
- bi.counter = 0; // 256-bit pages
- bi.limit = blr_count * blr_nfc;
- fseek((ar_addr * 32 * blr_nfc) + (ar_mbm * I7110_MBM_SIZE) + (bi.counter * 32), SEEK_SET);
+ m_bi.sub_state = SECTOR_READ;
+ m_bi.counter = 0; // 256-bit pages
+ m_bi.limit = m_blr_count * m_blr_nfc;
+ fseek((m_ar_addr * 32 * m_blr_nfc) + (m_ar_mbm * I7110_MBM_SIZE) + (m_bi.counter * 32), SEEK_SET);
break;
case SECTOR_READ:
- fread(buf, 32);
- bi.sub_state = WAIT_FSA_REPLY;
- delay_cycles(bi.tm, 270 * 20); // p. 4-14 of BPK72UM
+ fread(m_buf, 32);
+ m_bi.sub_state = WAIT_FSA_REPLY;
+ delay_cycles(m_bi.tm, 270 * 20); // p. 4-14 of BPK72UM
break;
case WAIT_FSA_REPLY:
- LOGDBG("BMC read data: ct %02d limit %02d\n", bi.counter, bi.limit);
- if (bi.counter < bi.limit)
+ LOGDBG("BMC read data: ct %02d limit %02d\n", m_bi.counter, m_bi.limit);
+ if (m_bi.counter < m_bi.limit)
{
for (int a = 0; a < 32; a++)
- fifo_push(buf[a]);
- bi.sub_state = SECTOR_READ;
- bi.counter++;
- delay_cycles(bi.tm, 270 * 20); // p. 4-14 of BPK72UM
+ fifo_push(m_buf[a]);
+ m_bi.sub_state = SECTOR_READ;
+ m_bi.counter++;
+ delay_cycles(m_bi.tm, 270 * 20); // p. 4-14 of BPK72UM
return;
}
- bi.sub_state = COMMAND_DONE;
+ m_bi.sub_state = COMMAND_DONE;
break;
case COMMAND_DONE:
- command_end(bi, true);
+ command_end(true);
return;
default:
- LOG("BMC read data unknown sub-state %d\n", bi.sub_state);
+ LOG("BMC read data unknown sub-state %d\n", m_bi.sub_state);
return;
}
}
}
-void i7220_device::write_data_start(bubble_info &bi)
+void i7220_device::write_data_start()
{
- bi.main_state = WRITE_DATA;
- bi.sub_state = INITIALIZE;
+ m_bi.main_state = WRITE_DATA;
+ m_bi.sub_state = INITIALIZE;
- write_data_continue(bi);
+ write_data_continue();
}
-void i7220_device::write_data_continue(bubble_info &bi)
+void i7220_device::write_data_continue()
{
for (;;)
{
- switch (bi.sub_state)
+ switch (m_bi.sub_state)
{
case INITIALIZE:
- bi.sub_state = WAIT_FIFO;
- bi.counter = 0;
- bi.limit = blr_count * blr_nfc * 32;
- delay_cycles(bi.tm, 270 * 20); // p. 4-14 of BPK72UM
+ m_bi.sub_state = WAIT_FIFO;
+ m_bi.counter = 0;
+ m_bi.limit = m_blr_count * m_blr_nfc * 32;
+ delay_cycles(m_bi.tm, 270 * 20); // p. 4-14 of BPK72UM
return;
case WAIT_FIFO:
- LOGDBG("BMC write data: fifo %02d ct %02d limit %02d\n", m_fifo_size, bi.counter, bi.limit);
+ LOGDBG("BMC write data: fifo %02d ct %02d limit %02d\n", m_fifo_size, m_bi.counter, m_bi.limit);
if (m_fifo_size >= 32)
{
for (int a = 0; a < 32; a++)
- buf[a] = fifo_pop();
- fseek((ar_addr * 32 * blr_nfc) + (ar_mbm * I7110_MBM_SIZE) + bi.counter, SEEK_SET);
- fwrite(buf, 32);
- bi.counter += 32;
+ m_buf[a] = fifo_pop();
+ fseek((m_ar_addr * 32 * m_blr_nfc) + (m_ar_mbm * I7110_MBM_SIZE) + m_bi.counter, SEEK_SET);
+ fwrite(m_buf, 32);
+ m_bi.counter += 32;
}
- if (bi.counter < bi.limit)
+ if (m_bi.counter < m_bi.limit)
{
- delay_cycles(bi.tm, 270 * 20); // p. 4-14 of BPK72UM
+ delay_cycles(m_bi.tm, 270 * 20); // p. 4-14 of BPK72UM
return;
}
- bi.sub_state = COMMAND_DONE;
+ m_bi.sub_state = COMMAND_DONE;
break;
case COMMAND_DONE:
- command_end(bi, true);
+ command_end(true);
return;
default:
- LOG("BMC write data unknown sub-state %d\n", bi.sub_state);
+ LOG("BMC write data unknown sub-state %d\n", m_bi.sub_state);
return;
}
}
@@ -595,10 +590,10 @@ uint8_t i7220_device::read(offs_t offset)
case 1:
data = m_str;
- if (main_phase == PHASE_EXEC)
+ if (m_main_phase == PHASE_EXEC)
{
data |= SR_BUSY;
- switch (bi.main_state)
+ switch (m_bi.main_state)
{
case READ_DATA:
if (!m_fifo.empty()) // XXX
@@ -623,10 +618,10 @@ uint8_t i7220_device::read(offs_t offset)
}
}
LOGREG("BMC R status == %02x (phase %d state %d:%d fifo %d drq %d)\n",
- data, main_phase, bi.main_state, bi.sub_state, m_fifo_size, drq);
- if (main_phase == PHASE_RESULT)
+ data, m_main_phase, m_bi.main_state, m_bi.sub_state, m_fifo_size, m_drq);
+ if (m_main_phase == PHASE_RESULT)
{
- main_phase = PHASE_IDLE;
+ m_main_phase = PHASE_IDLE;
}
break;
}
@@ -689,10 +684,10 @@ void i7220_device::write(offs_t offset, uint8_t data)
else if (BIT(data, 4))
{
m_cmdr = data & 15;
- if (main_phase == PHASE_IDLE)
+ if (m_main_phase == PHASE_IDLE)
{
LOG("BMC command %02x '%s'\n", data, commands[m_cmdr]);
- main_phase = PHASE_CMD;
+ m_main_phase = PHASE_CMD;
start_command(m_cmdr);
}
}
diff --git a/src/devices/machine/i7220.h b/src/devices/machine/i7220.h
index 99d8466226c..f961d64559e 100644
--- a/src/devices/machine/i7220.h
+++ b/src/devices/machine/i7220.h
@@ -67,7 +67,8 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(general_continue);
int m_data_size;
@@ -168,34 +169,37 @@ private:
void update_drq();
void start_command(int cmd);
- void general_continue(bubble_info &bi);
- void command_end(bubble_info &bi, bool success);
+ void command_end(bool success);
- void command_fail_start(bubble_info &bi);
- void command_fail_continue(bubble_info &bi);
+ void command_fail_start();
+ void command_fail_continue();
- void init_start(bubble_info &bi);
- void init_continue(bubble_info &bi);
+ void init_start();
+ void init_continue();
- void read_fsa_start(bubble_info &bi);
- void read_fsa_continue(bubble_info &bi);
+ void read_fsa_start();
+ void read_fsa_continue();
- void read_data_start(bubble_info &bi);
- void read_data_continue(bubble_info &bi);
+ void read_data_start();
+ void read_data_continue();
- void write_data_start(bubble_info &bi);
- void write_data_continue(bubble_info &bi);
+ void write_data_start();
+ void write_data_continue();
void fifo_clear();
void fifo_push(uint8_t val);
uint8_t fifo_pop();
- int main_phase;
- bool drq, irq;
- bubble_info bi;
+ int m_main_phase;
+ bool m_drq;
+ bool m_irq;
+ bubble_info m_bi;
- uint8_t buf[32];
- int blr_count, blr_nfc, ar_addr, ar_mbm;
+ uint8_t m_buf[32];
+ int m_blr_count;
+ int m_blr_nfc;
+ int m_ar_addr;
+ int m_ar_mbm;
devcb_write_line intrq_cb;
devcb_write_line drq_cb;
diff --git a/src/devices/machine/i8087.cpp b/src/devices/machine/i8087.cpp
index 30015f0bb0c..4235d734d7e 100644
--- a/src/devices/machine/i8087.cpp
+++ b/src/devices/machine/i8087.cpp
@@ -209,13 +209,11 @@ void i8087_device::device_start()
m_int_handler.resolve_safe();
m_busy_handler.resolve_safe();
- m_int_handler(0);
- m_busy_handler(1);
- m_timer = timer_alloc();
+ m_timer = timer_alloc(FUNC(i8087_device::release_busy), this);
build_opcode_table();
}
-void i8087_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(i8087_device::release_busy)
{
m_busy_handler(1);
}
diff --git a/src/devices/machine/i8087.h b/src/devices/machine/i8087.h
index c9bab30b0db..af3dea07f08 100644
--- a/src/devices/machine/i8087.h
+++ b/src/devices/machine/i8087.h
@@ -26,7 +26,8 @@ protected:
i8087_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(release_busy);
private:
address_space &space() { return *m_space; }
diff --git a/src/devices/machine/i8155.cpp b/src/devices/machine/i8155.cpp
index 996faed2f42..fee07c4a919 100644
--- a/src/devices/machine/i8155.cpp
+++ b/src/devices/machine/i8155.cpp
@@ -321,8 +321,8 @@ void i8155_device::device_start()
m_ram = make_unique_clear<uint8_t[]>(256);
// allocate timers
- m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(i8155_device::timer_half_counted), this));
- m_timer_tc = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(i8155_device::timer_tc), this));
+ m_timer = timer_alloc(FUNC(i8155_device::timer_half_counted), this);
+ m_timer_tc = timer_alloc(FUNC(i8155_device::timer_tc), this);
// register for state saving
save_item(NAME(m_io_m));
diff --git a/src/devices/machine/i82357.cpp b/src/devices/machine/i82357.cpp
index 80319a8a52a..91de890a03d 100644
--- a/src/devices/machine/i82357.cpp
+++ b/src/devices/machine/i82357.cpp
@@ -210,7 +210,7 @@ void i82357_device::device_start()
m_out_nmi.resolve_safe();
m_out_spkr.resolve_safe();
- m_nmi_check = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(i82357_device::nmi_check), this));
+ m_nmi_check = timer_alloc(FUNC(i82357_device::nmi_check), this);
}
void i82357_device::device_reset()
diff --git a/src/devices/machine/i82586.cpp b/src/devices/machine/i82586.cpp
index 360d404836c..b95ec84b9a1 100644
--- a/src/devices/machine/i82586.cpp
+++ b/src/devices/machine/i82586.cpp
@@ -164,7 +164,7 @@ void i82586_base_device::device_start()
m_out_irq.resolve_safe();
- m_cu_timer = timer_alloc(CU_TIMER);
+ m_cu_timer = timer_alloc(FUNC(i82586_base_device::cu_execute), this);
m_cu_timer->enable(false);
save_item(NAME(m_cx));
@@ -204,16 +204,6 @@ void i82586_base_device::device_reset()
m_mac_multi = 0;
}
-void i82586_base_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case CU_TIMER:
- cu_execute();
- break;
- }
-}
-
device_memory_interface::space_config_vector i82586_base_device::memory_space_config() const
{
return space_config_vector {
@@ -407,7 +397,7 @@ void i82586_base_device::update_scb()
set_irq(m_cx || m_fr || m_cna || m_rnr);
}
-void i82586_base_device::cu_execute()
+TIMER_CALLBACK_MEMBER(i82586_base_device::cu_execute)
{
// fetch the command block command/status
const u32 cb_cs = m_space->read_dword(m_cba);
diff --git a/src/devices/machine/i82586.h b/src/devices/machine/i82586.h
index 65ecff63329..f05547662c6 100644
--- a/src/devices/machine/i82586.h
+++ b/src/devices/machine/i82586.h
@@ -167,7 +167,6 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual space_config_vector memory_space_config() const override;
// device_network_interface overrides
@@ -181,7 +180,7 @@ protected:
virtual void update_scb();
// command unit
- virtual void cu_execute();
+ virtual TIMER_CALLBACK_MEMBER(cu_execute);
virtual void cu_complete(const u16 status);
virtual bool cu_iasetup() = 0;
virtual bool cu_configure() = 0;
@@ -211,7 +210,6 @@ protected:
address_space *m_space;
devcb_write_line m_out_irq;
- static const device_timer_id CU_TIMER = 0;
emu_timer *m_cu_timer;
// interrupt state
diff --git a/src/devices/machine/i8271.cpp b/src/devices/machine/i8271.cpp
index 70e27fa9bfd..48d734288f4 100644
--- a/src/devices/machine/i8271.cpp
+++ b/src/devices/machine/i8271.cpp
@@ -47,7 +47,7 @@ void i8271_device::device_start()
for(int i=0; i != 2; i++) {
char name[2];
- flopi[i].tm = timer_alloc(i);
+ flopi[i].tm = timer_alloc(FUNC(i8271_device::floppy_tick), this);
flopi[i].id = i;
if(select_connected) {
name[0] = '0'+i;
@@ -316,7 +316,7 @@ void i8271_device::live_delay(int state)
{
cur_live.next_state = state;
if(cur_live.tm != machine().time())
- cur_live.fi->tm->adjust(cur_live.tm - machine().time());
+ cur_live.fi->tm->adjust(cur_live.tm - machine().time(), cur_live.fi->id);
else
live_sync();
}
@@ -380,7 +380,7 @@ void i8271_device::live_run(attotime limit)
// infinity looking for data too.
limit = machine().time() + attotime::from_msec(1);
- cur_live.fi->tm->adjust(attotime::from_msec(1));
+ cur_live.fi->tm->adjust(attotime::from_msec(1), cur_live.fi->id);
}
}
@@ -945,9 +945,9 @@ void i8271_device::seek_start(floppy_info &fi)
seek_continue(fi);
}
-void i8271_device::delay_cycles(emu_timer *tm, int cycles)
+void i8271_device::delay_cycles(floppy_info &fi, int cycles)
{
- tm->adjust(attotime::from_double(double(cycles)/cur_rate));
+ fi.tm->adjust(attotime::from_double(double(cycles)/cur_rate), fi.id);
}
void i8271_device::seek_continue(floppy_info &fi)
@@ -960,7 +960,7 @@ void i8271_device::seek_continue(floppy_info &fi)
fi.dev->stp_w(0);
}
fi.sub_state = SEEK_WAIT_STEP_SIGNAL_TIME;
- fi.tm->adjust(attotime::from_nsec(2500));
+ fi.tm->adjust(attotime::from_nsec(2500), fi.id);
return;
case SEEK_WAIT_STEP_SIGNAL_TIME:
@@ -977,7 +977,7 @@ void i8271_device::seek_continue(floppy_info &fi)
fi.pcn++;
} while((fi.pcn == fi.badtrack[0]) || (fi.pcn == fi.badtrack[1]));
fi.sub_state = SEEK_WAIT_STEP_TIME;
- delay_cycles(fi.tm, 500*srate);
+ delay_cycles(fi, 500*srate);
return;
case SEEK_WAIT_STEP_TIME:
@@ -1115,7 +1115,7 @@ void i8271_device::read_data_continue(floppy_info &fi)
fi.dev->stp_w(0);
}
fi.sub_state = SEEK_WAIT_STEP_SIGNAL_TIME;
- fi.tm->adjust(attotime::from_nsec(2500));
+ fi.tm->adjust(attotime::from_nsec(2500), fi.id);
return;
case SEEK_WAIT_STEP_SIGNAL_TIME:
@@ -1126,7 +1126,7 @@ void i8271_device::read_data_continue(floppy_info &fi)
fi.dev->stp_w(1);
fi.sub_state = SEEK_WAIT_STEP_TIME;
- delay_cycles(fi.tm, 500*srate);
+ delay_cycles(fi, 500*srate);
return;
case SEEK_WAIT_STEP_TIME:
@@ -1256,7 +1256,7 @@ void i8271_device::write_data_continue(floppy_info &fi)
fi.dev->stp_w(0);
}
fi.sub_state = SEEK_WAIT_STEP_SIGNAL_TIME;
- fi.tm->adjust(attotime::from_nsec(2500));
+ fi.tm->adjust(attotime::from_nsec(2500), fi.id);
return;
case SEEK_WAIT_STEP_SIGNAL_TIME:
@@ -1267,7 +1267,7 @@ void i8271_device::write_data_continue(floppy_info &fi)
fi.dev->stp_w(1);
fi.sub_state = SEEK_WAIT_STEP_TIME;
- delay_cycles(fi.tm, 500*srate);
+ delay_cycles(fi, 500*srate);
return;
case SEEK_WAIT_STEP_TIME:
@@ -1383,7 +1383,7 @@ void i8271_device::format_track_continue(floppy_info &fi)
fi.dev->stp_w(0);
}
fi.sub_state = SEEK_WAIT_STEP_SIGNAL_TIME;
- fi.tm->adjust(attotime::from_nsec(2500));
+ fi.tm->adjust(attotime::from_nsec(2500), fi.id);
return;
case SEEK_WAIT_STEP_SIGNAL_TIME:
@@ -1394,7 +1394,7 @@ void i8271_device::format_track_continue(floppy_info &fi)
fi.dev->stp_w(1);
fi.sub_state = SEEK_WAIT_STEP_TIME;
- delay_cycles(fi.tm, 500*srate);
+ delay_cycles(fi, 500*srate);
return;
case SEEK_WAIT_STEP_TIME:
@@ -1476,7 +1476,7 @@ void i8271_device::read_id_continue(floppy_info &fi)
fi.dev->stp_w(0);
}
fi.sub_state = SEEK_WAIT_STEP_SIGNAL_TIME;
- fi.tm->adjust(attotime::from_nsec(2500));
+ fi.tm->adjust(attotime::from_nsec(2500), fi.id);
return;
case SEEK_WAIT_STEP_SIGNAL_TIME:
@@ -1487,7 +1487,7 @@ void i8271_device::read_id_continue(floppy_info &fi)
fi.dev->stp_w(1);
fi.sub_state = SEEK_WAIT_STEP_TIME;
- delay_cycles(fi.tm, 500*srate);
+ delay_cycles(fi, 500*srate);
return;
case SEEK_WAIT_STEP_TIME:
@@ -1546,11 +1546,11 @@ std::string i8271_device::ttsn() const
return machine().time().to_string();
}
-void i8271_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(i8271_device::floppy_tick)
{
live_sync();
- floppy_info &fi = flopi[id];
+ floppy_info &fi = flopi[param];
switch(fi.sub_state) {
case SEEK_WAIT_STEP_SIGNAL_TIME:
fi.sub_state = SEEK_WAIT_STEP_SIGNAL_TIME_DONE;
diff --git a/src/devices/machine/i8271.h b/src/devices/machine/i8271.h
index c337ac98df4..92880af57d4 100644
--- a/src/devices/machine/i8271.h
+++ b/src/devices/machine/i8271.h
@@ -44,7 +44,8 @@ public:
protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(floppy_tick);
private:
enum {
@@ -234,7 +235,7 @@ private:
void cmd_w(uint8_t data);
void param_w(uint8_t data);
- void delay_cycles(emu_timer *tm, int cycles);
+ void delay_cycles(floppy_info &fi, int cycles);
void set_drq(bool state);
void set_irq(bool state);
bool get_ready(int fid);
diff --git a/src/devices/machine/i8279.cpp b/src/devices/machine/i8279.cpp
index 474dfbbf170..9de96d806e0 100644
--- a/src/devices/machine/i8279.cpp
+++ b/src/devices/machine/i8279.cpp
@@ -120,7 +120,7 @@ void i8279_device::device_start()
m_in_shift_cb.resolve();
m_in_ctrl_cb.resolve();
m_scanclock = clock();
- m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(i8279_device::timerproc_callback), this));
+ m_timer = timer_alloc(FUNC(i8279_device::timerproc_callback), this);
// save state
save_item(NAME(m_d_ram));
diff --git a/src/devices/machine/ibm21s850.cpp b/src/devices/machine/ibm21s850.cpp
index cd44591645c..c58622cace6 100644
--- a/src/devices/machine/ibm21s850.cpp
+++ b/src/devices/machine/ibm21s850.cpp
@@ -43,7 +43,7 @@ void ibm21s85x_base_device::device_start()
{
save_item(NAME(m_regs));
- m_reset_timer = timer_alloc(TIMER_RESET);
+ m_reset_timer = timer_alloc(FUNC(ibm21s85x_base_device::reset_tick), this);
m_reset_cb.resolve_safe();
}
@@ -81,20 +81,17 @@ void ibm21s851_device::device_reset()
m_regs[REG_COUNT_OFFS] |= 0x0b; // 11 registers following the standard block on 21S851
}
-void ibm21s85x_base_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(ibm21s85x_base_device::reset_tick)
{
- if (id == TIMER_RESET)
+ if (param)
{
- if (param)
- {
- m_reset_cb(0);
- m_reset_timer->adjust(attotime::never);
- }
- else
- {
- m_reset_cb(1);
- m_reset_timer->adjust(attotime::from_usec(26266), 1); // RC reset circuit, 3.3V in, 2.3V out, 10KOhm resistor, 2.2uF capacitor
- }
+ m_reset_cb(0);
+ m_reset_timer->adjust(attotime::never);
+ }
+ else
+ {
+ m_reset_cb(1);
+ m_reset_timer->adjust(attotime::from_usec(26266), 1); // RC reset circuit, 3.3V in, 2.3V out, 10KOhm resistor, 2.2uF capacitor
}
}
diff --git a/src/devices/machine/ibm21s850.h b/src/devices/machine/ibm21s850.h
index e0725a7cbd3..dde6cf59a4d 100644
--- a/src/devices/machine/ibm21s850.h
+++ b/src/devices/machine/ibm21s850.h
@@ -30,11 +30,10 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
- void power_on_reset();
+ TIMER_CALLBACK_MEMBER(reset_tick);
- static const device_timer_id TIMER_RESET = 0;
+ void power_on_reset();
enum : uint32_t
{
diff --git a/src/devices/machine/icm7170.cpp b/src/devices/machine/icm7170.cpp
index 3960545ee94..3abcf04ea38 100644
--- a/src/devices/machine/icm7170.cpp
+++ b/src/devices/machine/icm7170.cpp
@@ -60,8 +60,6 @@ enum
IRQ_BIT_ALARM = 0x01
};
-static constexpr int ICM7170_TIMER_ID = 0;
-
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
@@ -88,7 +86,7 @@ void icm7170_device::device_start()
// resolve callbacks
m_out_irq_cb.resolve_safe();
- m_timer = timer_alloc(ICM7170_TIMER_ID);
+ m_timer = timer_alloc(FUNC(icm7170_device::clock_tick), this);
// TODO: frequency should be based on input clock and divisor
m_timer->adjust(attotime::from_hz(100), 0, attotime::from_hz(100));
@@ -110,10 +108,10 @@ void icm7170_device::device_reset()
}
//-------------------------------------------------
-// device_timer - handles timer events
+// clock_tick - advance the RTC's counters
//-------------------------------------------------
-void icm7170_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(icm7170_device::clock_tick)
{
// advance hundredths
m_irq_status |= IRQ_BIT_100TH_SECOND;
@@ -122,11 +120,11 @@ void icm7170_device::device_timer(emu_timer &timer, device_timer_id id, int para
m_regs[REG_CNT_100TH_SEC] = 0;
if (m_regs[REG_COMMAND] & CMD_REG_24_HOUR)
- LOG("device_timer %02d-%02d-%02d %02d:%02d:%02d\n",
+ LOG("clock_tick %02d-%02d-%02d %02d:%02d:%02d\n",
m_regs[REG_CNT_YEAR], m_regs[REG_CNT_MONTH], m_regs[REG_CNT_DAY],
m_regs[REG_CNT_HOURS], m_regs[REG_CNT_MINUTES], m_regs[REG_CNT_SECONDS]);
else
- LOG("device_timer %02d-%02d-%02d %02d:%02d:%02d %s\n",
+ LOG("clock_tick %02d-%02d-%02d %02d:%02d:%02d %s\n",
m_regs[REG_CNT_YEAR], m_regs[REG_CNT_MONTH], m_regs[REG_CNT_DAY],
m_regs[REG_CNT_HOURS] & 0xf, m_regs[REG_CNT_MINUTES], m_regs[REG_CNT_SECONDS],
(m_regs[REG_CNT_HOURS] & 0x80) ? "pm" : "am");
diff --git a/src/devices/machine/icm7170.h b/src/devices/machine/icm7170.h
index 384dd00af8b..2fef930fa04 100644
--- a/src/devices/machine/icm7170.h
+++ b/src/devices/machine/icm7170.h
@@ -61,7 +61,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_rtc_interface overrides
virtual void rtc_clock_updated(int year, int month, int day, int day_of_week, int hour, int minute, int second) override;
@@ -71,6 +70,8 @@ protected:
virtual bool nvram_read(util::read_stream &file) override;
virtual bool nvram_write(util::write_stream &file) override;
+ TIMER_CALLBACK_MEMBER(clock_tick);
+
private:
void recalc_irqs();
diff --git a/src/devices/machine/ie15.cpp b/src/devices/machine/ie15.cpp
index a8a77900e51..603c6034ca9 100644
--- a/src/devices/machine/ie15.cpp
+++ b/src/devices/machine/ie15.cpp
@@ -166,7 +166,7 @@ void ie15_device::beep_w(uint8_t data)
{
LOG("beep (%s)\n", m_long_beep ? "short" : "long");
}
- machine().scheduler().timer_set(attotime::from_msec(length), timer_expired_delegate(FUNC(ie15_device::ie15_beepoff),this));
+ m_beepoff_timer->adjust(attotime::from_msec(length));
m_beeper->set_state(1);
}
@@ -229,28 +229,23 @@ uint8_t ie15_device::kb_s_lin_r()
return m_io_keyboard->read() & ie15_keyboard_device::IE_KB_LIN ? IE_TRUE : 0;
}
-/* serial port */
-
-void ie15_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(ie15_device::hblank_onoff_tick)
{
- switch (id)
+ if (m_hblank) // Transitioning from in blanking to out of blanking
{
- case TIMER_HBLANK:
- if (m_hblank) // Transitioning from in blanking to out of blanking
- {
- m_hblank = 0;
- m_hblank_timer->adjust(m_screen->time_until_pos((m_vpos + 1) % IE15_TOTAL_VERT, 0));
- scanline_callback();
- }
- else // Transitioning from out of blanking to in blanking
- {
- m_hblank = 1;
- m_hblank_timer->adjust(m_screen->time_until_pos(m_vpos, IE15_HORZ_START));
- }
- break;
+ m_hblank = 0;
+ m_hblank_timer->adjust(m_screen->time_until_pos((m_vpos + 1) % IE15_TOTAL_VERT, 0));
+ scanline_callback();
+ }
+ else // Transitioning from out of blanking to in blanking
+ {
+ m_hblank = 1;
+ m_hblank_timer->adjust(m_screen->time_until_pos(m_vpos, IE15_HORZ_START));
}
}
+/* serial port */
+
WRITE_LINE_MEMBER(ie15_device::rs232_conn_rxd_w)
{
device_serial_interface::rx_w(state);
@@ -494,9 +489,10 @@ void ie15_device::device_start()
m_sdv_led.resolve();
m_prd_led.resolve();
- m_hblank_timer = timer_alloc(TIMER_HBLANK);
+ m_hblank_timer = timer_alloc(FUNC(ie15_device::hblank_onoff_tick), this);
m_hblank_timer->adjust(attotime::never);
+ m_beepoff_timer = timer_alloc(FUNC(ie15_device::ie15_beepoff), this);
m_video.ptr1 = m_video.ptr2 = m_latch = 0;
m_tmpbmp = std::make_unique<uint32_t[]>(IE15_TOTAL_HORZ * IE15_TOTAL_VERT);
diff --git a/src/devices/machine/ie15.h b/src/devices/machine/ie15.h
index 496874c5a86..89eaf0cfd8b 100644
--- a/src/devices/machine/ie15.h
+++ b/src/devices/machine/ie15.h
@@ -56,18 +56,18 @@ protected:
virtual void device_resolve_objects() override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_add_mconfig(machine_config &config) override;
virtual ioport_constructor device_input_ports() const override;
virtual const tiny_rom_entry *device_rom_region() const override;
+ TIMER_CALLBACK_MEMBER(hblank_onoff_tick);
+
virtual void rcv_complete() override;
virtual void tra_callback() override;
virtual void tra_complete() override;
private:
- static const device_timer_id TIMER_HBLANK = 0;
void scanline_callback();
void update_leds();
void draw_scanline(uint32_t *p, uint16_t offset, uint8_t scanline);
@@ -106,32 +106,33 @@ private:
std::unique_ptr<uint32_t[]> m_tmpbmp;
- emu_timer *m_hblank_timer;
+ emu_timer *m_hblank_timer = nullptr;
+ emu_timer *m_beepoff_timer = nullptr;
- uint8_t m_long_beep;
- uint8_t m_kb_control;
- uint8_t m_kb_data;
- uint8_t m_kb_flag0;
- uint8_t m_kb_flag;
- uint8_t m_kb_ruslat;
- uint8_t m_latch;
+ uint8_t m_long_beep = 0;
+ uint8_t m_kb_control = 0;
+ uint8_t m_kb_data = 0;
+ uint8_t m_kb_flag0 = 0;
+ uint8_t m_kb_flag = 0;
+ uint8_t m_kb_ruslat = 0;
+ uint8_t m_latch = 0;
struct
{
- uint8_t cursor;
- uint8_t enable;
- uint8_t line25;
- uint32_t ptr1;
- uint32_t ptr2;
+ uint8_t cursor = 0;
+ uint8_t enable = 0;
+ uint8_t line25 = 0;
+ uint32_t ptr1 = 0;
+ uint32_t ptr2 = 0;
} m_video;
- uint8_t m_serial_rx_ready;
- uint8_t m_serial_rx_char;
- uint8_t m_serial_tx_ready;
- int m_hblank;
- int m_vpos;
- int m_marker_scanline;
- bool m_kbd_sdv;
+ uint8_t m_serial_rx_ready = 0;
+ uint8_t m_serial_rx_char = 0;
+ uint8_t m_serial_tx_ready = 0;
+ int m_hblank = 0;
+ int m_vpos = 0;
+ int m_marker_scanline = 0;
+ bool m_kbd_sdv = 0;
required_device<cpu_device> m_maincpu;
required_region_ptr<u8> m_p_videoram;
diff --git a/src/devices/machine/ins8250.cpp b/src/devices/machine/ins8250.cpp
index 0d766619254..63a68550e2d 100644
--- a/src/devices/machine/ins8250.cpp
+++ b/src/devices/machine/ins8250.cpp
@@ -689,7 +689,7 @@ void ins8250_uart_device::device_reset()
void ns16550_device::device_start()
{
- m_timeout = timer_alloc();
+ m_timeout = timer_alloc(FUNC(ns16550_device::timeout_expired), this);
ins8250_uart_device::device_start();
save_item(NAME(m_rintlvl));
save_item(NAME(m_rfifo));
@@ -713,13 +713,10 @@ void ns16550_device::device_reset()
ins8250_uart_device::device_reset();
}
-void ns16550_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(ns16550_device::timeout_expired)
{
- if(!id)
- {
- trigger_int(COM_INT_PENDING_CHAR_TIMEOUT);
- m_timeout->adjust(attotime::never);
- }
+ trigger_int(COM_INT_PENDING_CHAR_TIMEOUT);
+ m_timeout->adjust(attotime::never);
}
void ns16550_device::push_tx(u8 data)
diff --git a/src/devices/machine/ins8250.h b/src/devices/machine/ins8250.h
index b40ff23ef65..f79715decc3 100644
--- a/src/devices/machine/ins8250.h
+++ b/src/devices/machine/ins8250.h
@@ -117,12 +117,14 @@ public:
protected:
virtual void device_start() override;
virtual void device_reset() override;
+
virtual void rcv_complete() override;
virtual void tra_complete() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void set_fcr(u8 data) override;
virtual void push_tx(u8 data) override;
virtual u8 pop_rx() override;
+
+ TIMER_CALLBACK_MEMBER(timeout_expired);
private:
void set_timer() { m_timeout->adjust(attotime::from_hz((clock()*4*8)/(m_regs.dl*16))); }
int m_rintlvl;
diff --git a/src/devices/machine/intelfsh.cpp b/src/devices/machine/intelfsh.cpp
index abbee1b0a39..9c4b86abe21 100644
--- a/src/devices/machine/intelfsh.cpp
+++ b/src/devices/machine/intelfsh.cpp
@@ -531,7 +531,7 @@ tms_29f040_device::tms_29f040_device(const machine_config &mconfig, const char *
void intelfsh_device::device_start()
{
m_data = std::make_unique<uint8_t []>(m_size);
- m_timer = timer_alloc();
+ m_timer = timer_alloc(FUNC(intelfsh_device::delay_tick), this);
save_item( NAME(m_status) );
save_item( NAME(m_flash_mode) );
@@ -541,10 +541,10 @@ void intelfsh_device::device_start()
//-------------------------------------------------
-// device_timer - handler timer events
+// delay_tick - handle delayed commands/events
//-------------------------------------------------
-void intelfsh_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(intelfsh_device::delay_tick)
{
switch( m_flash_mode )
{
diff --git a/src/devices/machine/intelfsh.h b/src/devices/machine/intelfsh.h
index 7752a6d8379..31f1475cf90 100644
--- a/src/devices/machine/intelfsh.h
+++ b/src/devices/machine/intelfsh.h
@@ -66,7 +66,6 @@ protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_nvram_interface overrides
virtual void nvram_default() override;
@@ -77,6 +76,8 @@ protected:
uint32_t read_full(uint32_t offset);
void write_full(uint32_t offset, uint32_t data);
+ TIMER_CALLBACK_MEMBER(delay_tick);
+
optional_memory_region m_region;
// configuration state
diff --git a/src/devices/machine/iopsio2.cpp b/src/devices/machine/iopsio2.cpp
index 6ffe90c0737..c5b6de09546 100644
--- a/src/devices/machine/iopsio2.cpp
+++ b/src/devices/machine/iopsio2.cpp
@@ -32,7 +32,7 @@ iop_sio2_device::~iop_sio2_device()
void iop_sio2_device::device_start()
{
if (!m_response_timer)
- m_response_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(iop_sio2_device::response_timer), this));
+ m_response_timer = timer_alloc(FUNC(iop_sio2_device::response_timer), this);
save_item(NAME(m_buffer));
save_item(NAME(m_curr_byte));
diff --git a/src/devices/machine/ioptimer.cpp b/src/devices/machine/ioptimer.cpp
index 487c795ef26..54864a00901 100644
--- a/src/devices/machine/ioptimer.cpp
+++ b/src/devices/machine/ioptimer.cpp
@@ -39,10 +39,10 @@ void iop_timer_device::device_start()
m_int_cb.resolve_safe();
if (!m_compare_timer)
- m_compare_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(iop_timer_device::compare), this));
+ m_compare_timer = timer_alloc(FUNC(iop_timer_device::compare), this);
if (!m_overflow_timer)
- m_overflow_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(iop_timer_device::overflow), this));
+ m_overflow_timer = timer_alloc(FUNC(iop_timer_device::overflow), this);
}
void iop_timer_device::device_reset()
diff --git a/src/devices/machine/iwm.cpp b/src/devices/machine/iwm.cpp
index 331305dab4f..b52c01eec83 100644
--- a/src/devices/machine/iwm.cpp
+++ b/src/devices/machine/iwm.cpp
@@ -34,7 +34,7 @@ void iwm_device::device_start()
{
applefdintf_device::device_start();
- m_timer = timer_alloc();
+ m_timer = timer_alloc(FUNC(iwm_device::update_timer_tick), this);
save_item(NAME(m_last_sync));
save_item(NAME(m_next_state_change));
save_item(NAME(m_sync_update));
@@ -82,7 +82,7 @@ void iwm_device::device_reset()
m_q3_clock_active = false;
}
-void iwm_device::device_timer(emu_timer &, device_timer_id, int)
+TIMER_CALLBACK_MEMBER(iwm_device::update_timer_tick)
{
if(m_active == MODE_DELAY) {
flush_write();
diff --git a/src/devices/machine/iwm.h b/src/devices/machine/iwm.h
index c4f13c09e6d..73045890d0d 100644
--- a/src/devices/machine/iwm.h
+++ b/src/devices/machine/iwm.h
@@ -37,7 +37,8 @@ public:
protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(update_timer_tick);
private:
enum {
diff --git a/src/devices/machine/kb3600.cpp b/src/devices/machine/kb3600.cpp
index c0e450f601a..9be5846e0c8 100644
--- a/src/devices/machine/kb3600.cpp
+++ b/src/devices/machine/kb3600.cpp
@@ -82,7 +82,7 @@ void ay3600_device::device_start()
m_write_ako.resolve_safe();
// allocate timers
- m_scan_timer = timer_alloc();
+ m_scan_timer = timer_alloc(FUNC(ay3600_device::perform_scan), this);
m_scan_timer->adjust(attotime::from_hz(60), 0, attotime::from_hz(60));
m_ako = 0;
@@ -103,10 +103,10 @@ void ay3600_device::device_reset()
}
//-------------------------------------------------
-// device_timer - handler timer events
+// perform_scan - scan the keyboard matrix
//-------------------------------------------------
-void ay3600_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(ay3600_device::perform_scan)
{
int ako = 0;
diff --git a/src/devices/machine/kb3600.h b/src/devices/machine/kb3600.h
index 35a2a192a5c..c65bbea3a6f 100644
--- a/src/devices/machine/kb3600.h
+++ b/src/devices/machine/kb3600.h
@@ -83,7 +83,8 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(perform_scan);
devcb_read16 m_read_x0, m_read_x1, m_read_x2, m_read_x3, m_read_x4, m_read_x5, m_read_x6, m_read_x7, m_read_x8;
devcb_read_line m_read_shift, m_read_control;
diff --git a/src/devices/machine/kr2376.cpp b/src/devices/machine/kr2376.cpp
index 8f6b6a4b4fd..f77bf3d93dc 100644
--- a/src/devices/machine/kr2376.cpp
+++ b/src/devices/machine/kr2376.cpp
@@ -158,7 +158,7 @@ void kr2376_device::device_start()
change_output_lines();
/* create the timers */
- m_scan_timer = timer_alloc(TIMER_SCAN_TICK);
+ m_scan_timer = timer_alloc(FUNC(kr2376_device::perform_scan), this);
m_scan_timer->adjust(attotime::zero, 0, attotime::from_hz(clock()));
/* register for state saving */
@@ -263,16 +263,11 @@ void kr2376_device::detect_keypress()
}
}
-void kr2376_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(kr2376_device::perform_scan)
{
- switch (id)
- {
- case TIMER_SCAN_TICK:
- change_output_lines();
- clock_scan_counters();
- detect_keypress();
- break;
- }
+ change_output_lines();
+ clock_scan_counters();
+ detect_keypress();
}
/* Keyboard Data */
diff --git a/src/devices/machine/kr2376.h b/src/devices/machine/kr2376.h
index 9b9715a8742..6f8306bb30d 100644
--- a/src/devices/machine/kr2376.h
+++ b/src/devices/machine/kr2376.h
@@ -71,9 +71,10 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual uint8_t key_codes(int mode, int x, int y) { return 0x00; }
+ TIMER_CALLBACK_MEMBER(perform_scan);
+
private:
// internal state
int m_pins[41];
@@ -92,11 +93,6 @@ private:
devcb_read_line m_read_shift, m_read_control;
devcb_write_line m_write_strobe;
- enum
- {
- TIMER_SCAN_TICK
- };
-
void change_output_lines();
void clock_scan_counters();
void detect_keypress();
diff --git a/src/devices/machine/laserdsc.cpp b/src/devices/machine/laserdsc.cpp
index 45304a428f7..596d8689f68 100644
--- a/src/devices/machine/laserdsc.cpp
+++ b/src/devices/machine/laserdsc.cpp
@@ -226,6 +226,9 @@ void laserdisc_device::device_start()
init_video();
init_audio();
+ // register our timer
+ m_vbi_fetch_timer = timer_alloc(FUNC(laserdisc_device::fetch_vbi_data), this);
+
// register callbacks
machine().configuration().config_register(
"laserdisc",
@@ -349,35 +352,30 @@ void laserdisc_device::device_validity_check(validity_checker &valid) const
{
}
+
//-------------------------------------------------
-// device_timer - handle timers set by this
-// device
+// fetch_vbi_data - perform an update and
+// process the track that was read, including
+// VBI data
//-------------------------------------------------
-void laserdisc_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(laserdisc_device::fetch_vbi_data)
{
- switch (id)
- {
- case TID_VBI_FETCH:
- {
- // wait for previous read and decode to finish
- process_track_data();
+ // wait for previous read and decode to finish
+ process_track_data();
- // update current track based on slider speed
- update_slider_pos();
+ // update current track based on slider speed
+ update_slider_pos();
- // update the state
- add_and_clamp_track(player_update(m_metadata[m_fieldnum], m_fieldnum, machine().time()));
+ // update the state
+ add_and_clamp_track(player_update(m_metadata[m_fieldnum], m_fieldnum, machine().time()));
- // flush any audio before we read more
- m_stream->update();
+ // flush any audio before we read more
+ m_stream->update();
- // start reading the track data for the next round
- m_fieldnum ^= 1;
- read_track_data();
- break;
- }
- }
+ // start reading the track data for the next round
+ m_fieldnum ^= 1;
+ read_track_data();
}
@@ -948,8 +946,8 @@ void laserdisc_device::vblank_state_changed(screen_device &screen, bool vblank_s
// call the player's VSYNC callback
player_vsync(m_metadata[m_fieldnum], m_fieldnum, machine().time());
- // set a timer to begin fetching the next frame just before the VBI data would be fetched
- timer_set(screen.time_until_pos(16*2), TID_VBI_FETCH);
+ // set our timer to begin fetching the next frame just before the VBI data would be fetched
+ m_vbi_fetch_timer->adjust(screen.time_until_pos(16*2));
}
}
diff --git a/src/devices/machine/laserdsc.h b/src/devices/machine/laserdsc.h
index 15a107804f1..abc536a3be0 100644
--- a/src/devices/machine/laserdsc.h
+++ b/src/devices/machine/laserdsc.h
@@ -150,13 +150,6 @@ public:
}
protected:
- // timer IDs
- enum
- {
- TID_VBI_FETCH,
- TID_FIRST_PLAYER_TIMER
- };
-
// common laserdisc states
enum player_state : uint32_t
{
@@ -218,12 +211,13 @@ protected:
virtual void device_start() override;
virtual void device_stop() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_validity_check(validity_checker &valid) const override;
// device_sound_interface overrides
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
+ virtual TIMER_CALLBACK_MEMBER(fetch_vbi_data);
+
// subclass helpers
void set_audio_squelch(bool squelchleft, bool squelchright) { m_stream->update(); m_audiosquelch = (squelchleft ? 1 : 0) | (squelchright ? 2 : 0); }
void set_video_squelch(bool squelch) { m_videosquelch = squelch; }
@@ -241,6 +235,8 @@ protected:
player_state_info m_player_state; // active state
player_state_info m_saved_state; // saved state during temporary operations
+ emu_timer *m_vbi_fetch_timer; // fetcher for our VBI data
+
private:
// internal type definitions
struct frame_data
diff --git a/src/devices/machine/ldpr8210.cpp b/src/devices/machine/ldpr8210.cpp
index 360b7d93a45..a51d84b19ea 100644
--- a/src/devices/machine/ldpr8210.cpp
+++ b/src/devices/machine/ldpr8210.cpp
@@ -276,6 +276,10 @@ void pioneer_pr8210_device::control_w(uint8_t data)
void pioneer_pr8210_device::device_start()
{
+ // alocate timers
+ m_process_vbi_timer = timer_alloc(FUNC(pioneer_pr8210_device::process_vbi_data), this);
+ m_vsync_off_timer = timer_alloc(FUNC(pioneer_pr8210_device::vsync_off), this);
+
// resolve outputs
m_audio1.resolve();
m_audio2.resolve();
@@ -312,71 +316,66 @@ void pioneer_pr8210_device::device_reset()
//-------------------------------------------------
-// device_timer - handle timers set by this
-// device
+// process_vbi_data - process VBI data which was
+// fetched by the parent device
//-------------------------------------------------
-void pioneer_pr8210_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(pioneer_pr8210_device::process_vbi_data)
{
- switch (id)
+ // update the VBI data in the PIA as soon as it is ready;
+ // this must happen early in the frame because the player
+ // logic relies on fetching it here
+
+ // logging
+ if (LOG_VBLANK_VBI)
{
- // update the VBI data in the PIA as soon as it is ready;
- // this must happen early in the frame because the player
- // logic relies on fetching it here
- case TID_VBI_DATA_FETCH:
+ uint32_t line1718 = get_field_code(LASERDISC_CODE_LINE1718, false);
+ if ((line1718 & VBI_MASK_CAV_PICTURE) == VBI_CODE_CAV_PICTURE)
+ logerror("%3d:VBI(%05d)\n", screen().vpos(), VBI_CAV_PICTURE(line1718));
+ else
+ logerror("%3d:VBI()\n", screen().vpos());
+ }
- // logging
- if (LOG_VBLANK_VBI)
- {
- uint32_t line1718 = get_field_code(LASERDISC_CODE_LINE1718, false);
- if ((line1718 & VBI_MASK_CAV_PICTURE) == VBI_CODE_CAV_PICTURE)
- logerror("%3d:VBI(%05d)\n", screen().vpos(), VBI_CAV_PICTURE(line1718));
- else
- logerror("%3d:VBI()\n", screen().vpos());
- }
+ // update PIA registers based on vbi code
+ m_pia.vbi1 = 0xff;
+ m_pia.vbi2 = 0xff;
+ if (focus_on() && laser_on())
+ {
+ uint32_t line16 = get_field_code(LASERDISC_CODE_LINE16, false);
+ uint32_t line1718 = get_field_code(LASERDISC_CODE_LINE1718, false);
+ if (line1718 == VBI_CODE_LEADIN)
+ m_pia.vbi1 &= ~0x01;
+ if (line1718 == VBI_CODE_LEADOUT)
+ m_pia.vbi1 &= ~0x02;
+ if (line16 == VBI_CODE_STOP)
+ m_pia.vbi1 &= ~0x04;
+ // unsure what this bit means: m_pia.vbi1 &= ~0x08;
+ if ((line1718 & VBI_MASK_CAV_PICTURE) == VBI_CODE_CAV_PICTURE)
+ {
+ m_pia.vbi1 &= ~0x10;
+ m_pia.frame[2] = 0xf0 | ((line1718 >> 16) & 0x07);
+ m_pia.frame[3] = 0xf0 | ((line1718 >> 12) & 0x0f);
+ m_pia.frame[4] = 0xf0 | ((line1718 >> 8) & 0x0f);
+ m_pia.frame[5] = 0xf0 | ((line1718 >> 4) & 0x0f);
+ m_pia.frame[6] = 0xf0 | ((line1718 >> 0) & 0x0f);
+ }
+ if ((line1718 & VBI_MASK_CHAPTER) == VBI_CODE_CHAPTER)
+ {
+ m_pia.vbi2 &= ~0x01;
+ m_pia.frame[0] = 0xf0 | ((line1718 >> 16) & 0x07);
+ m_pia.frame[1] = 0xf0 | ((line1718 >> 12) & 0x0f);
+ }
+ }
+}
- // update PIA registers based on vbi code
- m_pia.vbi1 = 0xff;
- m_pia.vbi2 = 0xff;
- if (focus_on() && laser_on())
- {
- uint32_t line16 = get_field_code(LASERDISC_CODE_LINE16, false);
- uint32_t line1718 = get_field_code(LASERDISC_CODE_LINE1718, false);
- if (line1718 == VBI_CODE_LEADIN)
- m_pia.vbi1 &= ~0x01;
- if (line1718 == VBI_CODE_LEADOUT)
- m_pia.vbi1 &= ~0x02;
- if (line16 == VBI_CODE_STOP)
- m_pia.vbi1 &= ~0x04;
- // unsure what this bit means: m_pia.vbi1 &= ~0x08;
- if ((line1718 & VBI_MASK_CAV_PICTURE) == VBI_CODE_CAV_PICTURE)
- {
- m_pia.vbi1 &= ~0x10;
- m_pia.frame[2] = 0xf0 | ((line1718 >> 16) & 0x07);
- m_pia.frame[3] = 0xf0 | ((line1718 >> 12) & 0x0f);
- m_pia.frame[4] = 0xf0 | ((line1718 >> 8) & 0x0f);
- m_pia.frame[5] = 0xf0 | ((line1718 >> 4) & 0x0f);
- m_pia.frame[6] = 0xf0 | ((line1718 >> 0) & 0x0f);
- }
- if ((line1718 & VBI_MASK_CHAPTER) == VBI_CODE_CHAPTER)
- {
- m_pia.vbi2 &= ~0x01;
- m_pia.frame[0] = 0xf0 | ((line1718 >> 16) & 0x07);
- m_pia.frame[1] = 0xf0 | ((line1718 >> 12) & 0x0f);
- }
- }
- break;
- // clear the VSYNC flag
- case TID_VSYNC_OFF:
- m_vsync = false;
- break;
+//-------------------------------------------------
+// vsync_off - clear the VSYNC flag
+//-------------------------------------------------
- // pass everything else onto the parent
- default:
- laserdisc_device::device_timer(timer, id, param);
- break;
- }
+TIMER_CALLBACK_MEMBER(pioneer_pr8210_device::vsync_off)
+{
+ m_vsync = false;
}
@@ -425,10 +424,10 @@ void pioneer_pr8210_device::player_vsync(const vbi_metadata &vbi, int fieldnum,
// signal VSYNC and set a timer to turn it off
m_vsync = true;
- timer_set(screen().scan_period() * 4, TID_VSYNC_OFF);
+ m_vsync_off_timer->adjust(screen().scan_period() * 4);
// also set a timer to fetch the VBI data when it is ready
- timer_set(screen().time_until_pos(19*2), TID_VBI_DATA_FETCH);
+ m_process_vbi_timer->adjust(screen().time_until_pos(19*2));
}
@@ -905,7 +904,7 @@ simutrek_special_device::simutrek_special_device(const machine_config &mconfig,
void simutrek_special_device::data_w(uint8_t data)
{
- synchronize(TID_LATCH_DATA, data);
+ m_latch_data_timer->adjust(attotime::zero, data);
if (LOG_SIMUTREK)
logerror("%03d:**** Simutrek Command = %02X\n", screen().vpos(), data);
}
@@ -950,7 +949,7 @@ void simutrek_special_device::player_vsync(const vbi_metadata &vbi, int fieldnum
if (LOG_SIMUTREK)
logerror("%3d:VSYNC IRQ\n", screen().vpos());
m_i8748_cpu->set_input_line(MCS48_INPUT_IRQ, ASSERT_LINE);
- timer_set(screen().scan_period(), TID_IRQ_OFF);
+ m_irq_off_timer->adjust(screen().scan_period());
}
}
@@ -961,6 +960,10 @@ void simutrek_special_device::player_vsync(const vbi_metadata &vbi, int fieldnum
void simutrek_special_device::device_start()
{
+ // alocate timers
+ m_irq_off_timer = timer_alloc(FUNC(simutrek_special_device::irq_off), this);
+ m_latch_data_timer = timer_alloc(FUNC(simutrek_special_device::latch_data), this);
+
// pass through to the parent
pioneer_pr8210_device::device_start();
}
@@ -982,30 +985,23 @@ void simutrek_special_device::device_reset()
//-------------------------------------------------
-// device_timer - handle timers set by this
-// device
+// irq_off - clear the 8748 IRQ
//-------------------------------------------------
-void simutrek_special_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(simutrek_special_device::irq_off)
{
- switch (id)
- {
- // clear the 8748 IRQ
- case TID_IRQ_OFF:
- m_i8748_cpu->set_input_line(MCS48_INPUT_IRQ, CLEAR_LINE);
- break;
+ m_i8748_cpu->set_input_line(MCS48_INPUT_IRQ, CLEAR_LINE);
+}
- // latch data
- case TID_LATCH_DATA:
- m_data = param;
- m_data_ready = true;
- break;
- // pass everything else onto the parent
- default:
- pioneer_pr8210_device::device_timer(timer, id, param);
- break;
- }
+//-------------------------------------------------
+// latch_data - perform delayed latching of data
+//-------------------------------------------------
+
+TIMER_CALLBACK_MEMBER(simutrek_special_device::latch_data)
+{
+ m_data = param;
+ m_data_ready = true;
}
diff --git a/src/devices/machine/ldpr8210.h b/src/devices/machine/ldpr8210.h
index 79453d5604b..4bc4615c03c 100644
--- a/src/devices/machine/ldpr8210.h
+++ b/src/devices/machine/ldpr8210.h
@@ -44,20 +44,11 @@ public:
void control_w(uint8_t data);
protected:
- // timer IDs
- enum
- {
- TID_VSYNC_OFF = TID_FIRST_PLAYER_TIMER,
- TID_VBI_DATA_FETCH,
- TID_FIRST_SUBCLASS_TIMER
- };
-
pioneer_pr8210_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual const tiny_rom_entry *device_rom_region() const override;
virtual void device_add_mconfig(machine_config &config) override;
@@ -67,6 +58,8 @@ protected:
virtual void player_overlay(bitmap_yuy16 &bitmap) override;
// internal helpers
+ TIMER_CALLBACK_MEMBER(process_vbi_data);
+ TIMER_CALLBACK_MEMBER(vsync_off);
bool focus_on() const { return !(m_i8049_port1 & 0x08); }
bool spdl_on() const { return !(m_i8049_port1 & 0x10); }
bool laser_on() const { return !(m_i8049_port2 & 0x01); }
@@ -115,6 +108,10 @@ protected:
output_finder<> m_pause;
output_finder<> m_standby;
+ // timers
+ emu_timer *m_process_vbi_timer;
+ emu_timer *m_vsync_off_timer;
+
// internal state
uint8_t m_control; // control line state
uint8_t m_lastcommand; // last command seen
@@ -153,20 +150,12 @@ public:
void set_external_audio_squelch(int state);
protected:
- // timer IDs
- enum
- {
- TID_IRQ_OFF = TID_FIRST_SUBCLASS_TIMER,
- TID_LATCH_DATA
- };
-
// subclass overrides
virtual void player_vsync(const vbi_metadata &vbi, int fieldnum, const attotime &curtime) override;
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual const tiny_rom_entry *device_rom_region() const override;
virtual void device_add_mconfig(machine_config &config) override;
@@ -175,6 +164,9 @@ protected:
virtual void update_audio_squelch() override { set_audio_squelch(m_audio_squelch, m_audio_squelch); }
private:
+ TIMER_CALLBACK_MEMBER(irq_off);
+ TIMER_CALLBACK_MEMBER(latch_data);
+
// internal read/write handlers
uint8_t i8748_data_r();
uint8_t i8748_port2_r();
@@ -185,10 +177,12 @@ private:
// internal state
required_device<i8748_device> m_i8748_cpu;
- uint8_t m_audio_squelch; // audio squelch value
+ emu_timer *m_irq_off_timer;
+ emu_timer *m_latch_data_timer;
+ uint8_t m_audio_squelch; // audio squelch value
uint8_t m_data; // parallel data for simutrek
- bool m_data_ready; // ready flag for simutrek data
- uint8_t m_i8748_port2; // 8748 port 2 state
+ bool m_data_ready; // ready flag for simutrek data
+ uint8_t m_i8748_port2; // 8748 port 2 state
uint8_t m_controlnext; // latch to control next pair of fields
uint8_t m_controlthis; // latched value for our control over the current pair of fields
};
diff --git a/src/devices/machine/ldv1000.cpp b/src/devices/machine/ldv1000.cpp
index 5ef4a5cd1a9..3c866118c76 100644
--- a/src/devices/machine/ldv1000.cpp
+++ b/src/devices/machine/ldv1000.cpp
@@ -155,7 +155,9 @@ void pioneer_ldv1000_device::device_start()
laserdisc_device::device_start();
// allocate timers
- m_multitimer = timer_alloc(TID_MULTIJUMP);
+ m_multitimer = timer_alloc(FUNC(pioneer_ldv1000_device::multijump_tick), this);
+ m_vsync_off_timer = timer_alloc(FUNC(pioneer_ldv1000_device::vsync_off), this);
+ m_process_vbi_timer = timer_alloc(FUNC(pioneer_ldv1000_device::process_vbi_data), this);
m_command_strobe_cb.resolve_safe();
}
@@ -187,73 +189,72 @@ void pioneer_ldv1000_device::device_reset()
//-------------------------------------------------
-// device_timer - handle timers set by this
-// device
+// vsync_off - clear the VSYNC flag
//-------------------------------------------------
-void pioneer_ldv1000_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(pioneer_ldv1000_device::vsync_off)
{
- switch (id)
- {
- case TID_MULTIJUMP:
- {
- // bit 5 of port B on PPI 1 selects the direction of slider movement
- int direction = (m_portb1 & 0x20) ? 1 : -1;
- advance_slider(direction);
-
- // update down counter and reschedule
- if (--m_counter != 0)
- timer.adjust(MULTIJUMP_TRACK_TIME);
- break;
- }
+ m_vsync = false;
+}
+
+
+//-------------------------------------------------
+// multijump_tick - move the slider across
+// multiple tracks
+//-------------------------------------------------
+
+TIMER_CALLBACK_MEMBER(pioneer_ldv1000_device::multijump_tick)
+{
+ // bit 5 of port B on PPI 1 selects the direction of slider movement
+ int direction = (m_portb1 & 0x20) ? 1 : -1;
+ advance_slider(direction);
+
+ // update down counter and reschedule
+ if (--m_counter != 0)
+ m_multitimer->adjust(MULTIJUMP_TRACK_TIME);
+}
+
- case TID_VSYNC_OFF:
- m_vsync = false;
- break;
+//-------------------------------------------------
+// process_vbi_data - process VBI data which was
+// fetched by the parent device
+//-------------------------------------------------
- case TID_VBI_DATA_FETCH:
+TIMER_CALLBACK_MEMBER(pioneer_ldv1000_device::process_vbi_data)
+{
+ // appears to return data in reverse order
+ uint32_t lines[3];
+ lines[0] = get_field_code(LASERDISC_CODE_LINE1718, false);
+ lines[1] = get_field_code(LASERDISC_CODE_LINE17, false);
+ lines[2] = get_field_code(LASERDISC_CODE_LINE16, false);
+
+ // fill in the details
+ memset(m_vbi, 0, sizeof(m_vbi));
+ if (focus_on() && laser_on())
+ {
+ // loop over lines
+ for (int line = 0; line < 3; line++)
{
- // appears to return data in reverse order
- uint32_t lines[3];
- lines[0] = get_field_code(LASERDISC_CODE_LINE1718, false);
- lines[1] = get_field_code(LASERDISC_CODE_LINE17, false);
- lines[2] = get_field_code(LASERDISC_CODE_LINE16, false);
-
- // fill in the details
- memset(m_vbi, 0, sizeof(m_vbi));
- if (focus_on() && laser_on())
+ uint8_t *dest = &m_vbi[line * 7];
+ uint32_t data = lines[line];
+
+ // the logic only processes leadin/leadout/frame number codes
+ if (data == VBI_CODE_LEADIN || data == VBI_CODE_LEADOUT || (data & VBI_MASK_CAV_PICTURE) == VBI_CODE_CAV_PICTURE)
{
- // loop over lines
- for (int line = 0; line < 3; line++)
- {
- uint8_t *dest = &m_vbi[line * 7];
- uint32_t data = lines[line];
-
- // the logic only processes leadin/leadout/frame number codes
- if (data == VBI_CODE_LEADIN || data == VBI_CODE_LEADOUT || (data & VBI_MASK_CAV_PICTURE) == VBI_CODE_CAV_PICTURE)
- {
- *dest++ = 0x09 | (((data & VBI_MASK_CAV_PICTURE) == VBI_CODE_CAV_PICTURE) ? 0x02 : 0x00);
- *dest++ = 0x08;
- *dest++ = (data >> 16) & 0x0f;
- *dest++ = (data >> 12) & 0x0f;
- *dest++ = (data >> 8) & 0x0f;
- *dest++ = (data >> 4) & 0x0f;
- *dest++ = (data >> 0) & 0x0f;
- }
- }
+ *dest++ = 0x09 | (((data & VBI_MASK_CAV_PICTURE) == VBI_CODE_CAV_PICTURE) ? 0x02 : 0x00);
+ *dest++ = 0x08;
+ *dest++ = (data >> 16) & 0x0f;
+ *dest++ = (data >> 12) & 0x0f;
+ *dest++ = (data >> 8) & 0x0f;
+ *dest++ = (data >> 4) & 0x0f;
+ *dest++ = (data >> 0) & 0x0f;
}
-
- // signal that data is ready and reset the readback index
- m_vbiready = true;
- m_vbiindex = 0;
- break;
}
-
- // pass everything else onto the parent
- default:
- laserdisc_device::device_timer(timer, id, param);
- break;
}
+
+ // signal that data is ready and reset the readback index
+ m_vbiready = true;
+ m_vbiindex = 0;
}
@@ -309,10 +310,10 @@ void pioneer_ldv1000_device::player_vsync(const vbi_metadata &vbi, int fieldnum,
// signal VSYNC and set a timer to turn it off
m_vsync = true;
- timer_set(screen().scan_period() * 4, TID_VSYNC_OFF);
+ m_vsync_off_timer->adjust(screen().scan_period() * 4);
// also set a timer to fetch the VBI data when it is ready
- timer_set(screen().time_until_pos(19*2), TID_VBI_DATA_FETCH);
+ m_process_vbi_timer->adjust(screen().time_until_pos(19*2));
// boost interleave for the first 1ms to improve communications
machine().scheduler().boost_interleave(attotime::zero, attotime::from_msec(1));
diff --git a/src/devices/machine/ldv1000.h b/src/devices/machine/ldv1000.h
index a4ea232429a..a4ffa12f5b2 100644
--- a/src/devices/machine/ldv1000.h
+++ b/src/devices/machine/ldv1000.h
@@ -51,18 +51,9 @@ public:
uint8_t command_strobe_r() const { return (m_portc1 & 0x10) ? ASSERT_LINE : CLEAR_LINE; }
protected:
- // timer IDs
- enum
- {
- TID_MULTIJUMP = TID_FIRST_PLAYER_TIMER,
- TID_VSYNC_OFF,
- TID_VBI_DATA_FETCH
- };
-
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual const tiny_rom_entry *device_rom_region() const override;
virtual void device_add_mconfig(machine_config &config) override;
@@ -71,6 +62,10 @@ protected:
virtual int32_t player_update(const vbi_metadata &vbi, int fieldnum, const attotime &curtime) override;
virtual void player_overlay(bitmap_yuy16 &bitmap) override { }
+ TIMER_CALLBACK_MEMBER(vsync_off);
+ TIMER_CALLBACK_MEMBER(multijump_tick);
+ TIMER_CALLBACK_MEMBER(process_vbi_data);
+
private:
// internal helpers
bool focus_on() const { return !(m_portb1 & 0x01); }
@@ -97,19 +92,21 @@ private:
void ldv1000_portmap(address_map &map);
// internal state
- required_device<z80_device> m_z80_cpu; /* CPU index of the Z80 */
- required_device<z80ctc_device> m_z80_ctc; /* CTC device */
- emu_timer * m_multitimer; /* multi-jump timer device */
+ required_device<z80_device> m_z80_cpu; /* CPU index of the Z80 */
+ required_device<z80ctc_device> m_z80_ctc; /* CTC device */
+ emu_timer * m_multitimer; /* multi-jump timer device */
+ emu_timer * m_vsync_off_timer; /* vsync-shutoff timer device */
+ emu_timer * m_process_vbi_timer; /* VBI processing timer device */
devcb_write_line m_command_strobe_cb;
/* communication status */
- uint8_t m_command; /* command byte to the player */
+ uint8_t m_command; /* command byte to the player */
uint8_t m_status; /* status byte from the player */
- bool m_vsync; /* VSYNC state */
+ bool m_vsync; /* VSYNC state */
/* I/O port states */
uint8_t m_counter_start; /* starting value for counter */
- uint8_t m_counter; /* current counter value */
+ uint8_t m_counter; /* current counter value */
uint8_t m_portc0; /* port C on PPI 0 */
uint8_t m_portb1; /* port B on PPI 1 */
uint8_t m_portc1; /* port C on PPI 1 */
@@ -118,9 +115,9 @@ private:
uint8_t m_portselect; /* selection of which port to access */
uint8_t m_display[2][20]; /* display lines */
uint8_t m_dispindex; /* index within the display line */
- uint8_t m_vbi[7*3]; /* VBI data */
- bool m_vbiready; /* VBI ready flag */
- uint8_t m_vbiindex; /* index within the VBI data */
+ uint8_t m_vbi[7*3]; /* VBI data */
+ bool m_vbiready; /* VBI ready flag */
+ uint8_t m_vbiindex; /* index within the VBI data */
};
diff --git a/src/devices/machine/ldv4200hle.cpp b/src/devices/machine/ldv4200hle.cpp
index fba4c1750a2..db8f86a2a03 100644
--- a/src/devices/machine/ldv4200hle.cpp
+++ b/src/devices/machine/ldv4200hle.cpp
@@ -683,7 +683,7 @@ void pioneer_ldv4200hle_device::device_start()
m_serial_tx.resolve_safe();
// allocate timers
- m_vbi_fetch = timer_alloc(TID_VBI_DATA_FETCH);
+ m_vbi_fetch = timer_alloc(FUNC(pioneer_ldv4200hle_device::process_vbi_data), this);
// register state saving
save_item(NAME(m_cmd_buffer));
@@ -771,124 +771,112 @@ void pioneer_ldv4200hle_device::device_reset()
//-------------------------------------------------
-// device_timer - handle timers set by this
-// device
+// process_vbi_data - process VBI data and
+// act on search/play seeking
//-------------------------------------------------
-void pioneer_ldv4200hle_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(pioneer_ldv4200hle_device::process_vbi_data)
{
- switch (id)
+ uint32_t line = get_field_code(LASERDISC_CODE_LINE1718, false);
+ if ((line & 0xf80000) == 0xf80000 || line == VBI_CODE_LEADIN || line == VBI_CODE_LEADOUT)
{
- case TID_VBI_DATA_FETCH:
+ uint32_t old_frame = m_curr_frame;
+ if (line == VBI_CODE_LEADIN)
+ m_curr_frame = 0;
+ else if (line == VBI_CODE_LEADOUT)
+ m_curr_frame = 54000;
+ else
+ m_curr_frame = bcd_to_literal(line & 0x7ffff);
+
+ LOGMASKED(LOG_FRAMES, "Current frame is %d (VBI 16: %06x, VBI 17: %06x, VBI 18: %06x, VBI 1718: %06x\n", m_curr_frame,
+ get_field_code(LASERDISC_CODE_LINE16, false),
+ get_field_code(LASERDISC_CODE_LINE17, false),
+ get_field_code(LASERDISC_CODE_LINE18, false),
+ line);
+
+ if (m_mode != MODE_STILL && m_mode != MODE_PAUSE)
{
- uint32_t line = get_field_code(LASERDISC_CODE_LINE1718, false);
- if ((line & 0xf80000) == 0xf80000 || line == VBI_CODE_LEADIN || line == VBI_CODE_LEADOUT)
+ if (m_mark_frame != ~uint32_t(0) && m_search_frame == ~uint32_t(0))
{
- uint32_t old_frame = m_curr_frame;
- if (line == VBI_CODE_LEADIN)
- m_curr_frame = 0;
- else if (line == VBI_CODE_LEADOUT)
- m_curr_frame = 54000;
- else
- m_curr_frame = bcd_to_literal(line & 0x7ffff);
+ int32_t old_delta = (int32_t)m_mark_frame - (int32_t)old_frame;
+ int32_t curr_delta = (int32_t)m_mark_frame - (int32_t)m_curr_frame;
+ LOGMASKED(LOG_STOPS, "%s: Stop Mark is currently %d, old frame is %d, current frame is %d, old delta %d, curr delta %d\n", machine().describe_context(), m_mark_frame, old_frame, m_curr_frame, old_delta, curr_delta);
+ if (curr_delta == 0 || std::signbit(old_delta) != std::signbit(curr_delta))
+ {
+ m_mark_frame = ~uint32_t(0);
+ if (is_cav_disc())
+ {
+ LOGMASKED(LOG_STOPS | LOG_SQUELCHES, "%s: Stop Mark: Zero delta w/ CAV disc, entering still mode and squelching audio\n", machine().describe_context());
+ m_mode = MODE_STILL;
+ update_video_enable();
+ }
+ else
+ {
+ LOGMASKED(LOG_STOPS | LOG_SQUELCHES, "%s: Stop Mark: Zero delta w/ CLV disc, entering still mode and squelching video+audio\n", machine().describe_context());
+ m_mode = MODE_PAUSE;
+ video_enable(false);
+ }
+
+ set_audio_squelch(true, true);
- LOGMASKED(LOG_FRAMES, "Current frame is %d (VBI 16: %06x, VBI 17: %06x, VBI 18: %06x, VBI 1718: %06x\n", m_curr_frame,
- get_field_code(LASERDISC_CODE_LINE16, false),
- get_field_code(LASERDISC_CODE_LINE17, false),
- get_field_code(LASERDISC_CODE_LINE18, false),
- line);
+ if (m_cmd_running)
+ {
+ LOGMASKED(LOG_SEARCHES | LOG_COMMANDS, "%s: Stop Mark: Command running, sending reply\n", machine().describe_context());
+ m_cmd_running = false;
+ queue_reply("R\x0d");
+ }
+ }
+ }
- if (m_mode != MODE_STILL && m_mode != MODE_PAUSE)
+ if (m_search_frame != ~uint32_t(0))
+ {
+ // TODO: Chapter-search support
+ int32_t delta = (int32_t)m_search_frame - (int32_t)m_curr_frame;
+ LOGMASKED(LOG_SEARCHES, "%s: Searching from current frame %d with delta %d\n", machine().describe_context(), m_curr_frame, delta);
+ if (delta == 0)
{
- if (m_mark_frame != ~uint32_t(0) && m_search_frame == ~uint32_t(0))
+ // We've found our frame, enter play, pause or still mode.
+ m_search_frame = ~uint32_t(0);
+ if (is_cav_disc())
{
- int32_t old_delta = (int32_t)m_mark_frame - (int32_t)old_frame;
- int32_t curr_delta = (int32_t)m_mark_frame - (int32_t)m_curr_frame;
- LOGMASKED(LOG_STOPS, "%s: Stop Mark is currently %d, old frame is %d, current frame is %d, old delta %d, curr delta %d\n", machine().describe_context(), m_mark_frame, old_frame, m_curr_frame, old_delta, curr_delta);
- if (curr_delta == 0 || std::signbit(old_delta) != std::signbit(curr_delta))
- {
- m_mark_frame = ~uint32_t(0);
- if (is_cav_disc())
- {
- LOGMASKED(LOG_STOPS | LOG_SQUELCHES, "%s: Stop Mark: Zero delta w/ CAV disc, entering still mode and squelching audio\n", machine().describe_context());
- m_mode = MODE_STILL;
- update_video_enable();
- }
- else
- {
- LOGMASKED(LOG_STOPS | LOG_SQUELCHES, "%s: Stop Mark: Zero delta w/ CLV disc, entering still mode and squelching video+audio\n", machine().describe_context());
- m_mode = MODE_PAUSE;
- video_enable(false);
- }
-
- set_audio_squelch(true, true);
-
- if (m_cmd_running)
- {
- LOGMASKED(LOG_SEARCHES | LOG_COMMANDS, "%s: Stop Mark: Command running, sending reply\n", machine().describe_context());
- m_cmd_running = false;
- queue_reply("R\x0d");
- }
- }
+ LOGMASKED(LOG_SEARCHES | LOG_SQUELCHES, "%s: Search Mark: Zero delta w/ CAV disc, entering still mode and squelching audio\n", machine().describe_context());
+ m_mode = MODE_STILL;
+ update_video_enable();
}
+ else
+ {
+ LOGMASKED(LOG_SEARCHES | LOG_SQUELCHES, "%s: Search Mark: Zero delta w/ CLV disc, entering still mode and squelching video+audio\n", machine().describe_context());
+ m_mode = MODE_PAUSE;
+ video_enable(false);
+ }
+
+ set_audio_squelch(true, true);
- if (m_search_frame != ~uint32_t(0))
+ if (m_cmd_running)
{
- // TODO: Chapter-search support
- int32_t delta = (int32_t)m_search_frame - (int32_t)m_curr_frame;
- LOGMASKED(LOG_SEARCHES, "%s: Searching from current frame %d with delta %d\n", machine().describe_context(), m_curr_frame, delta);
- if (delta == 0)
- {
- // We've found our frame, enter play, pause or still mode.
- m_search_frame = ~uint32_t(0);
- if (is_cav_disc())
- {
- LOGMASKED(LOG_SEARCHES | LOG_SQUELCHES, "%s: Search Mark: Zero delta w/ CAV disc, entering still mode and squelching audio\n", machine().describe_context());
- m_mode = MODE_STILL;
- update_video_enable();
- }
- else
- {
- LOGMASKED(LOG_SEARCHES | LOG_SQUELCHES, "%s: Search Mark: Zero delta w/ CLV disc, entering still mode and squelching video+audio\n", machine().describe_context());
- m_mode = MODE_PAUSE;
- video_enable(false);
- }
-
- set_audio_squelch(true, true);
-
- if (m_cmd_running)
- {
- LOGMASKED(LOG_SEARCHES | LOG_COMMANDS, "%s: Search Mark: Command running, sending reply\n", machine().describe_context());
- m_cmd_running = false;
- queue_reply("R\x0d");
- }
- }
- else if (delta <= 2 && delta > 0)
- {
- LOGMASKED(LOG_SEARCHES, "%s: Positive near delta, letting disc run to current\n", machine().describe_context());
- // We're approaching our frame, let it run up.
- }
- else
- {
- if (delta < 0)
- {
- advance_slider(std::min(-2, delta / 2));
- }
- else
- {
- advance_slider(std::max(1, delta / 2));
- }
- }
+ LOGMASKED(LOG_SEARCHES | LOG_COMMANDS, "%s: Search Mark: Command running, sending reply\n", machine().describe_context());
+ m_cmd_running = false;
+ queue_reply("R\x0d");
+ }
+ }
+ else if (delta <= 2 && delta > 0)
+ {
+ LOGMASKED(LOG_SEARCHES, "%s: Positive near delta, letting disc run to current\n", machine().describe_context());
+ // We're approaching our frame, let it run up.
+ }
+ else
+ {
+ if (delta < 0)
+ {
+ advance_slider(std::min(-2, delta / 2));
+ }
+ else
+ {
+ advance_slider(std::max(1, delta / 2));
}
}
}
- break;
}
-
- // pass everything else onto the parent
- default:
- laserdisc_device::device_timer(timer, id, param);
- break;
}
}
diff --git a/src/devices/machine/ldv4200hle.h b/src/devices/machine/ldv4200hle.h
index f57763698eb..c7ee5738e2a 100644
--- a/src/devices/machine/ldv4200hle.h
+++ b/src/devices/machine/ldv4200hle.h
@@ -51,16 +51,9 @@ public:
auto serial_tx() { return m_serial_tx.bind(); }
protected:
- // timer IDs
- enum
- {
- TID_VBI_DATA_FETCH = TID_FIRST_PLAYER_TIMER
- };
-
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// laserdisc overrides
virtual void player_vsync(const vbi_metadata &vbi, int fieldnum, const attotime &curtime) override;
@@ -72,6 +65,8 @@ protected:
virtual void tra_complete() override;
virtual void tra_callback() override;
+ TIMER_CALLBACK_MEMBER(process_vbi_data);
+
private:
enum player_command : uint16_t
{
diff --git a/src/devices/machine/ldvp931.cpp b/src/devices/machine/ldvp931.cpp
index 056a6b1d2ab..d610ed1bc1d 100644
--- a/src/devices/machine/ldvp931.cpp
+++ b/src/devices/machine/ldvp931.cpp
@@ -80,7 +80,11 @@ ROM_END
philips_22vp931_device::philips_22vp931_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: laserdisc_device(mconfig, PHILIPS_22VP931, tag, owner, clock),
m_i8049_cpu(*this, "vp931"),
- m_tracktimer(nullptr),
+ m_process_vbi_timer(nullptr),
+ m_irq_off_timer(nullptr),
+ m_strobe_off_timer(nullptr),
+ m_erp_off_timer(nullptr),
+ m_track_timer(nullptr),
m_i8049_out0(0),
m_i8049_out1(0),
m_i8049_port1(0),
@@ -144,8 +148,13 @@ void philips_22vp931_device::device_start()
// pass through to the parent
laserdisc_device::device_start();
- // allocate a timer
- m_tracktimer = timer_alloc(TID_HALF_TRACK);
+ // allocate timers
+ m_initial_vbi_timer = timer_alloc(FUNC(philips_22vp931_device::process_vbi_data), this);
+ m_process_vbi_timer = timer_alloc(FUNC(philips_22vp931_device::process_vbi_data), this);
+ m_irq_off_timer = timer_alloc(FUNC(philips_22vp931_device::irq_off), this);
+ m_strobe_off_timer = timer_alloc(FUNC(philips_22vp931_device::data_strobe_off), this);
+ m_erp_off_timer = timer_alloc(FUNC(philips_22vp931_device::erp_off), this);
+ m_track_timer = timer_alloc(FUNC(philips_22vp931_device::half_track_tick), this);
}
@@ -181,92 +190,110 @@ void philips_22vp931_device::device_reset()
//-------------------------------------------------
-// device_timer - handle timers set by this
-// device
+// process_vbi_data - process VBI data which was
+// fetched by the parent device
//-------------------------------------------------
-void philips_22vp931_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(philips_22vp931_device::process_vbi_data)
{
- switch (id)
+ uint32_t line = param >> 2;
+ int which = param & 3;
+ uint32_t code = 0;
+
+ // fetch the code and compute the DATIC latched value
+ if (line >= LASERDISC_CODE_LINE16 && line <= LASERDISC_CODE_LINE18)
+ code = get_field_code(laserdisc_field_code(line), false);
+
+ // at the start of each line, signal an interrupt and use a timer to turn it off
+ if (which == 0)
{
- case TID_VBI_DATA_FETCH:
- {
- uint32_t line = param >> 2;
- int which = param & 3;
- uint32_t code = 0;
-
- // fetch the code and compute the DATIC latched value
- if (line >= LASERDISC_CODE_LINE16 && line <= LASERDISC_CODE_LINE18)
- code = get_field_code(laserdisc_field_code(line), false);
-
- // at the start of each line, signal an interrupt and use a timer to turn it off
- if (which == 0)
- {
- m_i8049_cpu->set_input_line(MCS48_INPUT_IRQ, ASSERT_LINE);
- timer_set(attotime::from_nsec(5580), TID_IRQ_OFF);
- }
-
- // clock the data strobe on each subsequent callback
- else if (code != 0)
- {
- m_daticval = code >> (8 * (3 - which));
- m_datastrobe = 1;
- timer_set(attotime::from_nsec(5000), TID_DATA_STROBE_OFF);
- }
-
- // determine the next bit to fetch and reprime ourself
- if (++which == 4)
- {
- which = 0;
- line++;
- }
- if (line <= LASERDISC_CODE_LINE18 + 1)
- timer_set(screen().time_until_pos(line*2, which * 2 * screen().width() / 4), TID_VBI_DATA_FETCH, (line << 2) + which);
- break;
- }
+ m_i8049_cpu->set_input_line(MCS48_INPUT_IRQ, ASSERT_LINE);
+ m_irq_off_timer->adjust(attotime::from_nsec(5580));
+ }
+
+ // clock the data strobe on each subsequent callback
+ else if (code != 0)
+ {
+ m_daticval = code >> (8 * (3 - which));
+ m_datastrobe = 1;
+ m_strobe_off_timer->adjust(attotime::from_nsec(5000));
+ }
+
+ // determine the next bit to fetch and reprime ourself
+ if (++which == 4)
+ {
+ which = 0;
+ line++;
+ }
+ if (line <= LASERDISC_CODE_LINE18 + 1)
+ m_process_vbi_timer->adjust(screen().time_until_pos(line*2, which * 2 * screen().width() / 4), (line << 2) + which);
+}
+
+
+//-------------------------------------------------
+// process_deferred_data -
+//-------------------------------------------------
+
+TIMER_CALLBACK_MEMBER(philips_22vp931_device::process_deferred_data)
+{
+ // set the value and mark it pending
+ if (LOG_COMMANDS && m_fromcontroller_pending)
+ printf("Dropped previous command byte\n");
+ m_fromcontroller = param;
+ m_fromcontroller_pending = true;
+
+ // track the commands for debugging purposes
+ if (m_cmdcount < std::size(m_cmdbuf))
+ {
+ m_cmdbuf[m_cmdcount++ % 3] = param;
+ if (LOG_COMMANDS && m_cmdcount % 3 == 0)
+ printf("Cmd: %02X %02X %02X\n", m_cmdbuf[0], m_cmdbuf[1], m_cmdbuf[2]);
+ }
+}
+
+
+//-------------------------------------------------
+// irq_off -
+//-------------------------------------------------
+
+TIMER_CALLBACK_MEMBER(philips_22vp931_device::irq_off)
+{
+ m_i8049_cpu->set_input_line(MCS48_INPUT_IRQ, CLEAR_LINE);
+}
+
+
+//-------------------------------------------------
+// data_strobe_off -
+//-------------------------------------------------
+
+TIMER_CALLBACK_MEMBER(philips_22vp931_device::data_strobe_off)
+{
+ m_datastrobe = 0;
+}
- case TID_DEFERRED_DATA:
- // set the value and mark it pending
- if (LOG_COMMANDS && m_fromcontroller_pending)
- printf("Dropped previous command byte\n");
- m_fromcontroller = param;
- m_fromcontroller_pending = true;
-
- // track the commands for debugging purposes
- if (m_cmdcount < std::size(m_cmdbuf))
- {
- m_cmdbuf[m_cmdcount++ % 3] = param;
- if (LOG_COMMANDS && m_cmdcount % 3 == 0)
- printf("Cmd: %02X %02X %02X\n", m_cmdbuf[0], m_cmdbuf[1], m_cmdbuf[2]);
- }
- break;
-
- case TID_IRQ_OFF:
- m_i8049_cpu->set_input_line(MCS48_INPUT_IRQ, CLEAR_LINE);
- break;
-
- case TID_DATA_STROBE_OFF:
- m_datastrobe = 0;
- break;
-
- case TID_ERP_OFF:
- m_daticerp = 0;
- break;
-
- case TID_HALF_TRACK:
- // advance by the count and toggle the state
- m_trackstate ^= 1;
- if ((m_trackdir < 0 && !m_trackstate) || (m_trackdir > 0 && m_trackstate))
- {
- advance_slider(m_trackdir);
- m_advanced += m_trackdir;
- }
- break;
-
- // pass everything else onto the parent
- default:
- laserdisc_device::device_timer(timer, id, param);
- break;
+
+//-------------------------------------------------
+// erp_off -
+//-------------------------------------------------
+
+TIMER_CALLBACK_MEMBER(philips_22vp931_device::erp_off)
+{
+ m_daticerp = 0;
+}
+
+
+//-------------------------------------------------
+// half_track_tick - advance the slider by the
+// current count and toggle the track state
+//-------------------------------------------------
+
+TIMER_CALLBACK_MEMBER(philips_22vp931_device::half_track_tick)
+{
+ m_trackstate ^= 1;
+ if ((m_trackdir < 0 && !m_trackstate) || (m_trackdir > 0 && m_trackstate))
+ {
+ advance_slider(m_trackdir);
+ m_advanced += m_trackdir;
}
}
@@ -311,7 +338,7 @@ void philips_22vp931_device::player_vsync(const vbi_metadata &vbi, int fieldnum,
// set the ERP signal to 1 to indicate start of frame, and set a timer to turn it off
m_daticerp = 1;
- timer_set(screen().time_until_pos(15*2), TID_ERP_OFF);
+ m_erp_off_timer->adjust(screen().time_until_pos(15*2));
}
@@ -322,8 +349,9 @@ void philips_22vp931_device::player_vsync(const vbi_metadata &vbi, int fieldnum,
int32_t philips_22vp931_device::player_update(const vbi_metadata &vbi, int fieldnum, const attotime &curtime)
{
- // set the first VBI timer to go at the start of line 16
- timer_set(screen().time_until_pos(16*2), TID_VBI_DATA_FETCH, LASERDISC_CODE_LINE16 << 2);
+ // player_update is invoked by the parent device at line 16, so call our VBI processing timer directly
+ m_initial_vbi_timer->adjust(screen().time_until_pos(16*2), LASERDISC_CODE_LINE16 << 2);
+ //process_vbi_data(LASERDISC_CODE_LINE16 << 2);
// play forward by default
return fieldnum;
@@ -572,22 +600,18 @@ void philips_22vp931_device::i8049_port1_w(uint8_t data)
}
}
- // if we have a timer, adjust it
- if (m_tracktimer != nullptr)
- {
- // turn it off if we're not tracking
- if (m_trackdir == 0)
- m_tracktimer->reset();
+ // turn off the track timer if we're not tracking
+ if (m_trackdir == 0)
+ m_track_timer->reset();
- // if we just started tracking, or if the speed was changed, reprime the timer
- else if (((m_i8049_port1 ^ data) & 0x11) != 0)
- {
- // speeds here are just guesses, but work with the player logic; this is the time per half-track
- attotime speed = (data & 0x10) ? attotime::from_usec(60) : attotime::from_usec(10);
+ // if we just started tracking, or if the speed was changed, reprime the timer
+ else if (((m_i8049_port1 ^ data) & 0x11) != 0)
+ {
+ // speeds here are just guesses, but work with the player logic; this is the time per half-track
+ attotime speed = (data & 0x10) ? attotime::from_usec(60) : attotime::from_usec(10);
- // always start with an initial long delay; the code expects this
- m_tracktimer->adjust(attotime::from_usec(100), 0, speed);
- }
+ // always start with an initial long delay; the code expects this
+ m_track_timer->adjust(attotime::from_usec(100), 0, speed);
}
m_i8049_port1 = data;
diff --git a/src/devices/machine/ldvp931.h b/src/devices/machine/ldvp931.h
index a1eee3be52e..cffc81cc9dc 100644
--- a/src/devices/machine/ldvp931.h
+++ b/src/devices/machine/ldvp931.h
@@ -43,7 +43,7 @@ public:
philips_22vp931_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// input and output
- void data_w(uint8_t data) { synchronize(TID_DEFERRED_DATA, data); }
+ void data_w(uint8_t data) { machine().scheduler().synchronize(timer_expired_delegate(FUNC(philips_22vp931_device::process_deferred_data), this), data); }
void reset_w(uint8_t data);
uint8_t data_r();
uint8_t ready_r() { return m_fromcontroller_pending ? CLEAR_LINE : ASSERT_LINE; }
@@ -53,21 +53,9 @@ public:
void set_data_ready_callback(data_ready_delegate callback) { m_data_ready = callback; }
protected:
- // timer IDs
- enum
- {
- TID_IRQ_OFF = TID_FIRST_PLAYER_TIMER,
- TID_DATA_STROBE_OFF,
- TID_ERP_OFF,
- TID_HALF_TRACK,
- TID_VBI_DATA_FETCH,
- TID_DEFERRED_DATA
- };
-
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual const tiny_rom_entry *device_rom_region() const override;
virtual void device_add_mconfig(machine_config &config) override;
@@ -76,6 +64,13 @@ protected:
virtual int32_t player_update(const vbi_metadata &vbi, int fieldnum, const attotime &curtime) override;
virtual void player_overlay(bitmap_yuy16 &bitmap) override { }
+ TIMER_CALLBACK_MEMBER(process_vbi_data);
+ TIMER_CALLBACK_MEMBER(process_deferred_data);
+ TIMER_CALLBACK_MEMBER(irq_off);
+ TIMER_CALLBACK_MEMBER(data_strobe_off);
+ TIMER_CALLBACK_MEMBER(erp_off);
+ TIMER_CALLBACK_MEMBER(half_track_tick);
+
private:
// internal read/write handlers
void i8049_output0_w(uint8_t data);
@@ -96,9 +91,14 @@ private:
void vp931_portmap(address_map &map);
// internal state
- required_device<i8049_device> m_i8049_cpu; // CPU index of the 8049
- emu_timer * m_tracktimer; // timer device
- data_ready_delegate m_data_ready; // data ready callback
+ required_device<i8049_device> m_i8049_cpu; // CPU index of the 8049
+ emu_timer * m_initial_vbi_timer;
+ emu_timer * m_process_vbi_timer;
+ emu_timer * m_irq_off_timer;
+ emu_timer * m_strobe_off_timer;
+ emu_timer * m_erp_off_timer;
+ emu_timer * m_track_timer; // half-track timer device
+ data_ready_delegate m_data_ready; // data ready callback
// I/O port states
uint8_t m_i8049_out0; // output 0 state
@@ -111,11 +111,11 @@ private:
uint8_t m_datastrobe; // DATA STROBE line from DATIC
// communication status
- //uint8_t m_reset_state; // state of the reset input
+ //uint8_t m_reset_state; // state of the reset input
uint8_t m_fromcontroller; // command byte from the controller
- bool m_fromcontroller_pending; // true if data is pending
+ bool m_fromcontroller_pending; // true if data is pending
uint8_t m_tocontroller; // command byte to the controller
- bool m_tocontroller_pending; // true if data is pending
+ bool m_tocontroller_pending; // true if data is pending
// tracking
int8_t m_trackdir; // direction of tracking
diff --git a/src/devices/machine/m3002.cpp b/src/devices/machine/m3002.cpp
index a6a674c19e3..1e021571896 100644
--- a/src/devices/machine/m3002.cpp
+++ b/src/devices/machine/m3002.cpp
@@ -83,7 +83,7 @@ void m3002_device::device_resolve_objects()
void m3002_device::device_start()
{
// Setup timer
- m_second_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(m3002_device::second_timer), this));
+ m_second_timer = timer_alloc(FUNC(m3002_device::second_timer), this);
// Save internal state
save_item(NAME(m_ram));
diff --git a/src/devices/machine/m68sfdc.cpp b/src/devices/machine/m68sfdc.cpp
index 51fbc23f5e7..99a0b3b4580 100644
--- a/src/devices/machine/m68sfdc.cpp
+++ b/src/devices/machine/m68sfdc.cpp
@@ -73,8 +73,8 @@ void m68sfdc_device::device_start()
m_irq_handler.resolve_safe();
m_nmi_handler.resolve_safe();
- m_timer_head_load = timer_alloc(TM_HEAD_LOAD);
- m_timer_timeout = timer_alloc(TM_TIMEOUT);
+ m_timer_head_load = timer_alloc(FUNC(m68sfdc_device::head_load_update), this);
+ m_timer_timeout = timer_alloc(FUNC(m68sfdc_device::timeout_expired), this);
save_item(NAME(m_select_0));
save_item(NAME(m_select_1));
save_item(NAME(m_select_2));
@@ -97,7 +97,7 @@ void m68sfdc_device::device_start()
m_floppy = nullptr;
- t_gen = timer_alloc(TM_GEN);
+ t_gen = timer_alloc(FUNC(m68sfdc_device::general_update), this);
}
void m68sfdc_device::device_reset()
@@ -148,37 +148,30 @@ WRITE_LINE_MEMBER(m68sfdc_device::handle_nmi)
m_nmi_handler(state);
}
-void m68sfdc_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(m68sfdc_device::head_load_update)
{
- switch (id)
- {
- case TM_HEAD_LOAD:
- {
- live_sync();
- m_head_load2 = 0;
- u8 head_load = m_head_load1 && m_head_load2;
- if (head_load != m_head_load)
- {
- // TODO sound?
- m_head_load = head_load;
- }
- break;
- }
- case TM_TIMEOUT:
+ live_sync();
+ m_head_load2 = 0;
+ u8 head_load = m_head_load1 && m_head_load2;
+ if (head_load != m_head_load)
{
- live_sync();
- m_pia->ca1_w(0);
- break;
- }
- case TM_GEN:
- live_sync();
- live_run();
- break;
- default:
- throw emu_fatalerror("Unknown id in m68sfdc_device::device_timer");
+ // TODO sound?
+ m_head_load = head_load;
}
}
+TIMER_CALLBACK_MEMBER(m68sfdc_device::timeout_expired)
+{
+ live_sync();
+ m_pia->ca1_w(0);
+}
+
+TIMER_CALLBACK_MEMBER(m68sfdc_device::general_update)
+{
+ live_sync();
+ live_run();
+}
+
uint8_t m68sfdc_device::flip_bits(uint8_t data)
diff --git a/src/devices/machine/m68sfdc.h b/src/devices/machine/m68sfdc.h
index 81a26a1de58..605ac628583 100644
--- a/src/devices/machine/m68sfdc.h
+++ b/src/devices/machine/m68sfdc.h
@@ -30,6 +30,12 @@ public:
void set_floppies_4(floppy_connector*, floppy_connector*, floppy_connector*, floppy_connector*);
private:
+ virtual void device_start() override;
+ virtual void device_reset() override;
+ virtual void device_resolve_objects() override;
+ virtual void device_add_mconfig(machine_config &config) override;
+ virtual ioport_constructor device_input_ports() const override;
+
required_device<pia6821_device> m_pia;
required_device<mc6852_device> m_ssda;
emu_timer *m_timer_head_load;
@@ -37,6 +43,7 @@ private:
devcb_write_line m_irq_handler;
devcb_write_line m_nmi_handler;
+
DECLARE_WRITE_LINE_MEMBER(handle_irq);
DECLARE_WRITE_LINE_MEMBER(handle_nmi);
@@ -79,16 +86,12 @@ private:
floppy_connector *m_floppy0, *m_floppy1, *m_floppy2, *m_floppy3;
floppy_image_device *m_floppy; // Currently selected floppy.
- virtual void device_resolve_objects() override;
- virtual void device_start() override;
- virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
- virtual void device_add_mconfig(machine_config &config) override;
- virtual ioport_constructor device_input_ports() const override;
-
- enum { TM_HEAD_LOAD, TM_TIMEOUT, TM_GEN };
+ TIMER_CALLBACK_MEMBER(head_load_update);
+ TIMER_CALLBACK_MEMBER(timeout_expired);
+ TIMER_CALLBACK_MEMBER(general_update);
- enum {
+ enum
+ {
// General "doing nothing" state
IDLE,
@@ -103,7 +106,8 @@ private:
WRITE_BITS,
};
- struct live_info {
+ struct live_info
+ {
enum { PT_NONE, PT_CRC_1, PT_CRC_2 };
attotime tm;
diff --git a/src/devices/machine/mb3773.cpp b/src/devices/machine/mb3773.cpp
index b23b2c2ca20..e5ce23e13e6 100644
--- a/src/devices/machine/mb3773.cpp
+++ b/src/devices/machine/mb3773.cpp
@@ -41,7 +41,7 @@ mb3773_device::mb3773_device( const machine_config &mconfig, const char *tag, de
void mb3773_device::device_start()
{
- m_watchdog_timer = timer_alloc();
+ m_watchdog_timer = timer_alloc(FUNC(mb3773_device::watchdog_expired), this);
save_item( NAME(m_ck) );
}
@@ -56,7 +56,7 @@ void mb3773_device::device_reset()
reset_timer();
}
-void mb3773_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(mb3773_device::watchdog_expired)
{
logerror("Reset caused by watchdog\n");
diff --git a/src/devices/machine/mb3773.h b/src/devices/machine/mb3773.h
index 377c705f6b0..5955c1fa372 100644
--- a/src/devices/machine/mb3773.h
+++ b/src/devices/machine/mb3773.h
@@ -27,7 +27,7 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(watchdog_expired);
private:
void reset_timer();
diff --git a/src/devices/machine/mb87030.cpp b/src/devices/machine/mb87030.cpp
index a9c87cfc11b..1898f69ec67 100644
--- a/src/devices/machine/mb87030.cpp
+++ b/src/devices/machine/mb87030.cpp
@@ -433,8 +433,8 @@ void mb87030_device::step(bool timeout)
void mb87030_device::device_start()
{
- m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mb87030_device::timeout), this));
- m_delay_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mb87030_device::delay_timeout), this));
+ m_timer = timer_alloc(FUNC(mb87030_device::timeout), this);
+ m_delay_timer = timer_alloc(FUNC(mb87030_device::delay_timeout), this);
m_irq_handler.resolve_safe();
m_dreq_handler.resolve_safe();
diff --git a/src/devices/machine/mb8795.cpp b/src/devices/machine/mb8795.cpp
index 544d954f35e..957b53a2655 100644
--- a/src/devices/machine/mb8795.cpp
+++ b/src/devices/machine/mb8795.cpp
@@ -52,8 +52,8 @@ void mb8795_device::device_start()
drq_rx_cb.resolve();
memset(mac, 0, 6);
- timer_tx = timer_alloc(TIMER_TX);
- timer_rx = timer_alloc(TIMER_RX);
+ timer_tx = timer_alloc(FUNC(mb8795_device::tx_update), this);
+ timer_rx = timer_alloc(FUNC(mb8795_device::rx_update), this);
}
void mb8795_device::device_reset()
@@ -323,15 +323,16 @@ bool mb8795_device::recv_is_multicast()
return rxbuf[0] & 0x01;
}
-void mb8795_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(mb8795_device::tx_update)
{
- if(id == TIMER_TX) {
- drq_tx = true;
- if(!drq_tx_cb.isnull())
- drq_tx_cb(drq_tx);
- }
+ drq_tx = true;
+ if(!drq_tx_cb.isnull())
+ drq_tx_cb(drq_tx);
+}
- if(id == TIMER_RX && rxlen) {
+TIMER_CALLBACK_MEMBER(mb8795_device::rx_update)
+{
+ if(rxlen) {
drq_rx = true;
if(!drq_rx_cb.isnull())
drq_rx_cb(drq_rx);
diff --git a/src/devices/machine/mb8795.h b/src/devices/machine/mb8795.h
index ba590d776f3..7129f047ebe 100644
--- a/src/devices/machine/mb8795.h
+++ b/src/devices/machine/mb8795.h
@@ -22,10 +22,12 @@ public:
protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void recv_cb(uint8_t *buf, int len) override;
+ TIMER_CALLBACK_MEMBER(tx_update);
+ TIMER_CALLBACK_MEMBER(rx_update);
+
private:
enum { TIMER_TX, TIMER_RX };
diff --git a/src/devices/machine/mb89352.cpp b/src/devices/machine/mb89352.cpp
index 4412cf8bd44..24777cd0289 100644
--- a/src/devices/machine/mb89352.cpp
+++ b/src/devices/machine/mb89352.cpp
@@ -181,7 +181,7 @@ void mb89352_device::device_start()
m_drq_cb.resolve_safe();
// allocate read timer
- m_transfer_timer = timer_alloc(TIMER_TRANSFER);
+ m_transfer_timer = timer_alloc(FUNC(mb89352_device::transfer_tick), this);
}
void mb89352_device::device_reset()
@@ -217,17 +217,10 @@ int mb89352_device::get_scsi_cmd_len(uint8_t cbyte)
//return 6;
}
-void mb89352_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(mb89352_device::transfer_tick)
{
- switch(id)
- {
- case TIMER_TRANSFER:
- // TODO: check interrupts are actually enabled
- {
- m_drq_cb(1);
- }
- break;
- }
+ // TODO: check interrupts are actually enabled
+ m_drq_cb(1);
}
void mb89352_device::set_phase(int phase)
diff --git a/src/devices/machine/mb89352.h b/src/devices/machine/mb89352.h
index 9ce98c6380f..1032dd547d7 100644
--- a/src/devices/machine/mb89352.h
+++ b/src/devices/machine/mb89352.h
@@ -31,12 +31,10 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_stop() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-private:
- // internal device state goes here
- static const device_timer_id TIMER_TRANSFER = 0;
+ TIMER_CALLBACK_MEMBER(transfer_tick);
+private:
int get_scsi_cmd_len(uint8_t cbyte);
//void set_ints(uint8_t flag);
diff --git a/src/devices/machine/mc14411.cpp b/src/devices/machine/mc14411.cpp
index 9d4cb73bf12..722de11b35e 100644
--- a/src/devices/machine/mc14411.cpp
+++ b/src/devices/machine/mc14411.cpp
@@ -44,12 +44,6 @@
//#define LOG(...) LOGMASKED(LOG_GENERAL, __VA_ARGS__) // Already defined in logmacro.h
#define LOGSETUP(...) LOGMASKED(LOG_SETUP, __VA_ARGS__)
-#ifdef _MSC_VER
-#define FUNCNAME __func__
-#else
-#define FUNCNAME __PRETTY_FUNCTION__
-#endif
-
/***************************************************************************
INTERNAL TABLES
@@ -115,20 +109,21 @@ mc14411_device::mc14411_device(const machine_config &mconfig, device_type type,
void mc14411_device::device_start()
{
- LOGSETUP("%s\n", FUNCNAME);
+ LOGSETUP("mc14411_device::device_start\n");
for (int i = TIMER_F1; i <= TIMER_F16; i++)
{
+ m_fx_timers[i].timer = timer_alloc(FUNC(mc14411_device::timer_tick), this);
+ m_fx_timers[i].enabled = true;
m_out_fx_cbs[i].resolve();
- m_fx_timer[i] = timer_alloc(i);
- m_timer_enabled[i] = !m_out_fx_cbs[i].isnull();
}
save_item(NAME(m_divider));
save_item(NAME(m_reset));
- save_item(NAME(m_timer_enabled));
+ save_item(STRUCT_MEMBER(m_fx_timers, state));
+ save_item(STRUCT_MEMBER(m_fx_timers, enabled));
- m_reset_timer = timer_alloc(TIMER_ID_RESET);
+ m_reset_timer = timer_alloc(FUNC(mc14411_device::reset_tick), this);
}
@@ -141,7 +136,7 @@ void mc14411_device::device_clock_changed()
{
for (int i = TIMER_F1; i <= TIMER_F16; i++)
{
- if (m_timer_enabled[i])
+ if (m_fx_timers[i].enabled)
arm_timer(i);
}
}
@@ -154,18 +149,18 @@ void mc14411_device::device_clock_changed()
void mc14411_device::timer_enable(timer_id i, bool enable)
{
assert(i >= TIMER_F1 && i <= TIMER_F16);
- m_timer_enabled[i] = enable;
+ m_fx_timers[i].enabled = enable;
if (!enable)
- m_fx_timer[i]->enable(false);
- else if (!m_fx_timer[i]->enabled())
+ m_fx_timers[i].timer->enable(false);
+ else if (!m_fx_timers[i].timer->enabled())
arm_timer(i);
}
void mc14411_device::timer_disable_all()
{
for (int i = TIMER_F1; i <= TIMER_F16; i++)
- timer_enable((timer_id) i, false);
+ timer_enable((timer_id)i, false);
}
//-------------------------------------------------
@@ -175,13 +170,13 @@ void mc14411_device::timer_disable_all()
void mc14411_device::arm_timer(int i)
{
- assert(!m_out_fx_cbs[i].isnull());
-
+ if (m_out_fx_cbs[i].isnull())
+ return;
int divider = s_counter_divider[i];
if (i < TIMER_F15)
divider *= s_divider_select[m_divider];
attotime half_cycle = clocks_to_attotime(divider) / 2; // 2 flanks per cycle
- m_fx_timer[i]->adjust(half_cycle, i, half_cycle);
+ m_fx_timers[i].timer->adjust(half_cycle, i, half_cycle);
LOGSETUP(" - arming timer for F%d at %fHz (/%d)\n", i + 1, double(clock()) / divider, divider);
}
@@ -193,47 +188,47 @@ void mc14411_device::arm_timer(int i)
void mc14411_device::device_reset()
{
- LOGSETUP("%s\n", FUNCNAME);
+ LOGSETUP("mc14411_device::device_reset\n");
for (int i = TIMER_F1; i <= TIMER_F16; i++)
{
+ // Reset line according to datasheet and remember it for transitions to come
+ m_fx_timers[i].state = !(i < TIMER_F15);
if (!m_out_fx_cbs[i].isnull())
- {
- // Reset line according to datasheet and remember it for transitions to come
- (m_out_fx_cbs[i])(m_fx_state[i] = (i < TIMER_F15 ? 0 : 1));
- }
+ m_out_fx_cbs[i](m_fx_timers[i].state);
}
if (m_reset == ASSERT_LINE)
{
- m_reset_timer->adjust(attotime::from_nsec((double)900), TIMER_ID_RESET, attotime::from_nsec((double)900));
+ m_reset_timer->adjust(attotime::from_nsec(900));
}
}
//-------------------------------------------------
-// device_timer - handler timer events
+// timer_tick - update the output state for a
+// given Fx timer
//-------------------------------------------------
-void mc14411_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(mc14411_device::timer_tick)
{
- if (id >= TIMER_F1 && id <= TIMER_F16)
- {
- (m_out_fx_cbs[id])(m_fx_state[id]++ & 1);
- }
- else if (id == TIMER_ID_RESET)
- {
- // NOTE: This check could be triggered by either faulty hardware design or non accurate emulation so is just informative if the reset line is handled
- // explicitelly instead of relying on calling device_reset
- if (!(m_reset == ASSERT_LINE))
- {
- LOG("Reset pulse is too short, should be 900nS minimum");
- logerror("Reset pulse is too short, should be 900nS minimum");
- }
- }
- else
+ m_out_fx_cbs[param](m_fx_timers[param].state);
+ m_fx_timers[param].state = !m_fx_timers[param].state;
+}
+
+
+//-------------------------------------------------
+// reset_tick - log information if the device's
+// reset pulse is too short
+//-------------------------------------------------
+
+TIMER_CALLBACK_MEMBER(mc14411_device::reset_tick)
+{
+ // NOTE: This check could be triggered by either faulty hardware design or non accurate emulation so is just informative if the reset line is handled
+ // explicitelly instead of relying on calling device_reset
+ if (!(m_reset == ASSERT_LINE))
{
- LOG("Unhandled Timer ID %d\n", id);
+ LOG("Reset pulse is too short, should be 900nS minimum");
}
}
@@ -246,7 +241,7 @@ void mc14411_device::device_timer(emu_timer &timer, device_timer_id id, int para
void mc14411_device::rate_select_w(uint8_t data)
{
- LOGSETUP("%s %02x\n", FUNCNAME, data);
+ LOGSETUP("mc14411_device::rate_select_w %02x\n", data);
if (m_divider != (data & 3))
{
@@ -263,7 +258,7 @@ void mc14411_device::rate_select_w(uint8_t data)
void mc14411_device::rsa_w(int state)
{
- LOGSETUP("%s %02x\n", FUNCNAME, state);
+ LOGSETUP("mc14411_device::rsa_w %02x\n", state);
if ((m_divider & RSA) != (state == ASSERT_LINE ? RSA : 0))
{
@@ -280,7 +275,7 @@ void mc14411_device::rsa_w(int state)
void mc14411_device::rsb_w(int state)
{
- LOGSETUP("%s %02x\n", FUNCNAME, state);
+ LOGSETUP("mc14411_device::rsb_w %02x\n", state);
if ((m_divider & RSB) != (state == ASSERT_LINE ? RSB : 0))
{
@@ -297,7 +292,7 @@ void mc14411_device::rsb_w(int state)
void mc14411_device::reset_w(int state)
{
- LOGSETUP("%s %02x\n", FUNCNAME, state);
+ LOGSETUP("mc14411_device::reset_w %02x\n", state);
m_reset = state;
diff --git a/src/devices/machine/mc14411.h b/src/devices/machine/mc14411.h
index 47d081b128b..422e381bcb2 100644
--- a/src/devices/machine/mc14411.h
+++ b/src/devices/machine/mc14411.h
@@ -29,26 +29,25 @@
class mc14411_device : public device_t
{
public:
- // timers
- enum timer_id // indexes
+ // timer indices
+ enum timer_id : int
{
- TIMER_F1 = 0,
- TIMER_F2 = 1,
- TIMER_F3 = 2,
- TIMER_F4 = 3,
- TIMER_F5 = 4,
- TIMER_F6 = 5,
- TIMER_F7 = 6,
- TIMER_F8 = 7,
- TIMER_F9 = 8,
- TIMER_F10 = 9,
- TIMER_F11 = 10,
- TIMER_F12 = 11,
- TIMER_F13 = 12,
- TIMER_F14 = 13,
- TIMER_F15 = 14,
- TIMER_F16 = 15,
- TIMER_ID_RESET = 16
+ TIMER_F1,
+ TIMER_F2,
+ TIMER_F3,
+ TIMER_F4,
+ TIMER_F5,
+ TIMER_F6,
+ TIMER_F7,
+ TIMER_F8,
+ TIMER_F9,
+ TIMER_F10,
+ TIMER_F11,
+ TIMER_F12,
+ TIMER_F13,
+ TIMER_F14,
+ TIMER_F15,
+ TIMER_F16
};
// rate select inputs
@@ -78,26 +77,31 @@ protected:
virtual void device_start() override;
virtual void device_clock_changed() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(timer_tick);
+ TIMER_CALLBACK_MEMBER(reset_tick);
private:
void arm_timer(int i);
- emu_timer *m_fx_timer[16];
- emu_timer *m_reset_timer;
-
- uint32_t m_fx_state[16]; // F1-F16 output line states
+ struct fx_timer
+ {
+ emu_timer *timer;
+ bool state;
+ bool enabled;
+ };
- // divider matrix
- static const int s_counter_divider[16];
- static const int s_divider_select[4];
+ fx_timer m_fx_timers[16];
+ emu_timer *m_reset_timer;
devcb_write_line::array<16> m_out_fx_cbs;
uint32_t m_divider; // main divider to use, 0-3 column index into counter_divider
uint32_t m_reset; // Reset line state
- bool m_timer_enabled[16];
+ // divider matrix
+ static const int s_counter_divider[16];
+ static const int s_divider_select[4];
};
DECLARE_DEVICE_TYPE(MC14411, mc14411_device)
diff --git a/src/devices/machine/mc146818.cpp b/src/devices/machine/mc146818.cpp
index ead6f1de5a7..c5cabdfd528 100644
--- a/src/devices/machine/mc146818.cpp
+++ b/src/devices/machine/mc146818.cpp
@@ -54,7 +54,9 @@ mc146818_device::mc146818_device(const machine_config &mconfig, device_type type
device_nvram_interface(mconfig, *this),
m_region(*this, DEVICE_SELF),
m_index(0),
- m_clock_timer(nullptr), m_update_timer(nullptr), m_periodic_timer(nullptr),
+ m_clock_timer(nullptr),
+ m_update_timer(nullptr),
+ m_periodic_timer(nullptr),
m_write_irq(*this),
m_write_sqw(*this),
m_century_index(-1),
@@ -75,9 +77,9 @@ mc146818_device::mc146818_device(const machine_config &mconfig, device_type type
void mc146818_device::device_start()
{
m_data = make_unique_clear<uint8_t[]>(data_size());
- m_clock_timer = timer_alloc(TIMER_CLOCK);
- m_update_timer = timer_alloc(TIMER_UPDATE);
- m_periodic_timer = timer_alloc(TIMER_PERIODIC);
+ m_clock_timer = timer_alloc(FUNC(mc146818_device::clock_tick), this);
+ m_update_timer = timer_alloc(FUNC(mc146818_device::time_tick), this);
+ m_periodic_timer = timer_alloc(FUNC(mc146818_device::periodic_tick), this);
m_write_irq.resolve_safe();
m_write_sqw.resolve_safe();
@@ -105,141 +107,137 @@ void mc146818_device::device_reset()
}
//-------------------------------------------------
-// device_timer - handler timer events
+// timer events
//-------------------------------------------------
-void mc146818_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(mc146818_device::periodic_tick)
{
- switch (id)
+ m_sqw_state = !m_sqw_state;
+
+ if (m_data[REG_B] & REG_B_SQWE)
+ m_write_sqw(m_sqw_state);
+
+ // periodic flag/interrupt on rising edge of periodic timer
+ if (m_sqw_state)
{
- case TIMER_PERIODIC:
- m_sqw_state = !m_sqw_state;
+ m_data[REG_C] |= REG_C_PF;
+ update_irq();
+ }
+}
- if (m_data[REG_B] & REG_B_SQWE)
- m_write_sqw(m_sqw_state);
+TIMER_CALLBACK_MEMBER(mc146818_device::clock_tick)
+{
+ if (!(m_data[REG_B] & REG_B_SET))
+ {
+ m_data[REG_A] |= REG_A_UIP;
- // periodic flag/interrupt on rising edge of periodic timer
- if (m_sqw_state)
- {
- m_data[REG_C] |= REG_C_PF;
- update_irq();
- }
- break;
+ m_update_timer->adjust(attotime::from_usec(244));
+ }
+}
- case TIMER_CLOCK:
- if (!(m_data[REG_B] & REG_B_SET))
+TIMER_CALLBACK_MEMBER(mc146818_device::time_tick)
+{
+ if (!param)
+ {
+ /// TODO: find out how the real chip deals with updates when binary/bcd values are already outside the normal range
+ int seconds = get_seconds() + 1;
+ if (seconds < 60)
{
- m_data[REG_A] |= REG_A_UIP;
-
- m_update_timer->adjust(attotime::from_usec(244));
+ set_seconds(seconds);
}
- break;
-
- case TIMER_UPDATE:
- if (!param)
+ else
{
- /// TODO: find out how the real chip deals with updates when binary/bcd values are already outside the normal range
- int seconds = get_seconds() + 1;
- if (seconds < 60)
+ set_seconds(0);
+
+ int minutes = get_minutes() + 1;
+ if (minutes < 60)
{
- set_seconds(seconds);
+ set_minutes(minutes);
}
else
{
- set_seconds(0);
+ set_minutes(0);
- int minutes = get_minutes() + 1;
- if (minutes < 60)
+ int hours = get_hours() + 1;
+ if (hours < 24)
{
- set_minutes(minutes);
+ set_hours(hours);
}
else
{
- set_minutes(0);
+ set_hours(0);
- int hours = get_hours() + 1;
- if (hours < 24)
+ int dayofweek = get_dayofweek() + 1;
+ if (dayofweek <= 7)
{
- set_hours(hours);
+ set_dayofweek(dayofweek);
}
else
{
- set_hours(0);
+ set_dayofweek(1);
+ }
- int dayofweek = get_dayofweek() + 1;
- if (dayofweek <= 7)
- {
- set_dayofweek(dayofweek);
- }
- else
- {
- set_dayofweek(1);
- }
+ int dayofmonth = get_dayofmonth() + 1;
+ if (dayofmonth <= gregorian_days_in_month(get_month(), get_year() + 2000))
+ {
+ set_dayofmonth(dayofmonth);
+ }
+ else
+ {
+ set_dayofmonth(1);
- int dayofmonth = get_dayofmonth() + 1;
- if (dayofmonth <= gregorian_days_in_month(get_month(), get_year() + 2000))
+ int month = get_month() + 1;
+ if (month <= 12)
{
- set_dayofmonth(dayofmonth);
+ set_month(month);
}
else
{
- set_dayofmonth(1);
+ set_month(1);
- int month = get_month() + 1;
- if (month <= 12)
+ int year = get_year() + 1;
+ if (year <= 99)
{
- set_month(month);
+ set_year(year);
}
else
{
- set_month(1);
+ set_year(0);
- int year = get_year() + 1;
- if (year <= 99)
+ if (century_count_enabled())
{
- set_year(year);
- }
- else
- {
- set_year(0);
-
- if (century_count_enabled())
- {
- set_century((get_century() + 1) % 100);
- }
+ set_century((get_century() + 1) % 100);
}
}
}
}
}
}
+ }
- if ((m_data[REG_ALARM_SECONDS] == m_data[REG_SECONDS] || (m_data[REG_ALARM_SECONDS] & ALARM_DONTCARE) == ALARM_DONTCARE) &&
- (m_data[REG_ALARM_MINUTES] == m_data[REG_MINUTES] || (m_data[REG_ALARM_MINUTES] & ALARM_DONTCARE) == ALARM_DONTCARE) &&
- (m_data[REG_ALARM_HOURS] == m_data[REG_HOURS] || (m_data[REG_ALARM_HOURS] & ALARM_DONTCARE) == ALARM_DONTCARE))
- {
- // set the alarm interrupt flag AF
- m_data[REG_C] |= REG_C_AF;
- }
+ if ((m_data[REG_ALARM_SECONDS] == m_data[REG_SECONDS] || (m_data[REG_ALARM_SECONDS] & ALARM_DONTCARE) == ALARM_DONTCARE) &&
+ (m_data[REG_ALARM_MINUTES] == m_data[REG_MINUTES] || (m_data[REG_ALARM_MINUTES] & ALARM_DONTCARE) == ALARM_DONTCARE) &&
+ (m_data[REG_ALARM_HOURS] == m_data[REG_HOURS] || (m_data[REG_ALARM_HOURS] & ALARM_DONTCARE) == ALARM_DONTCARE))
+ {
+ // set the alarm interrupt flag AF
+ m_data[REG_C] |= REG_C_AF;
+ }
- // defer the update end sequence if update cycle time is non-zero
- if (m_tuc)
- {
- m_update_timer->adjust(attotime::from_usec(m_tuc), 1);
- break;
- }
+ // defer the update end sequence if update cycle time is non-zero
+ if (m_tuc)
+ {
+ m_update_timer->adjust(attotime::from_usec(m_tuc), 1);
+ return;
}
+ }
- // clear update in progress and set update ended
- m_data[REG_A] &= ~REG_A_UIP;
- m_data[REG_C] |= REG_C_UF;
+ // clear update in progress and set update ended
+ m_data[REG_A] &= ~REG_A_UIP;
+ m_data[REG_C] |= REG_C_UF;
- update_irq();
- break;
- }
+ update_irq();
}
-
//-------------------------------------------------
// nvram_default - called to initialize NVRAM to
// its default state
diff --git a/src/devices/machine/mc146818.h b/src/devices/machine/mc146818.h
index cceb83b8848..44eb0a54337 100644
--- a/src/devices/machine/mc146818.h
+++ b/src/devices/machine/mc146818.h
@@ -53,7 +53,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_nvram_interface overrides
virtual void nvram_default() override;
@@ -71,6 +70,10 @@ protected:
virtual uint8_t internal_read(offs_t offset);
virtual void internal_write(offs_t offset, uint8_t data);
+ TIMER_CALLBACK_MEMBER(periodic_tick);
+ TIMER_CALLBACK_MEMBER(clock_tick);
+ TIMER_CALLBACK_MEMBER(time_tick);
+
enum
{
REG_SECONDS = 0,
@@ -157,10 +160,6 @@ protected:
uint8_t m_index;
std::unique_ptr<uint8_t[]> m_data;
- static const device_timer_id TIMER_CLOCK = 0;
- static const device_timer_id TIMER_UPDATE = 1;
- static const device_timer_id TIMER_PERIODIC = 2;
-
emu_timer *m_clock_timer;
emu_timer *m_update_timer;
emu_timer *m_periodic_timer;
diff --git a/src/devices/machine/mc68328.cpp b/src/devices/machine/mc68328.cpp
index 2a6546c51c5..e1753110d56 100644
--- a/src/devices/machine/mc68328.cpp
+++ b/src/devices/machine/mc68328.cpp
@@ -289,10 +289,10 @@ void mc68328_device::device_start()
{
m68000_device::device_start();
- m_gptimer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mc68328_device::timer_tick<0>),this));
- m_gptimer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mc68328_device::timer_tick<1>),this));
- m_rtc = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mc68328_device::rtc_tick),this));
- m_pwm = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mc68328_device::pwm_tick),this));
+ m_gptimer[0] = timer_alloc(FUNC(mc68328_device::timer_tick<0>), this);
+ m_gptimer[1] = timer_alloc(FUNC(mc68328_device::timer_tick<1>), this);
+ m_rtc = timer_alloc(FUNC(mc68328_device::rtc_tick), this);
+ m_pwm = timer_alloc(FUNC(mc68328_device::pwm_tick), this);
register_state_save();
}
diff --git a/src/devices/machine/mc6843.cpp b/src/devices/machine/mc6843.cpp
index e169049a0d3..0987b494a27 100644
--- a/src/devices/machine/mc6843.cpp
+++ b/src/devices/machine/mc6843.cpp
@@ -18,7 +18,7 @@ mc6843_device::mc6843_device(const machine_config &mconfig, const char *tag, dev
void mc6843_device::device_start()
{
m_irq.resolve_safe();
- m_timer = timer_alloc(0);
+ m_timer = timer_alloc(FUNC(mc6843_device::update_tick), this);
m_floppy = nullptr;
m_dir = 0x00;
@@ -300,7 +300,7 @@ void mc6843_device::ready_callback(floppy_image_device *floppy, int state)
}
}
-void mc6843_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(mc6843_device::update_tick)
{
live_sync();
run(true, false, false);
diff --git a/src/devices/machine/mc6843.h b/src/devices/machine/mc6843.h
index 63b03a8aa44..86a92757279 100644
--- a/src/devices/machine/mc6843.h
+++ b/src/devices/machine/mc6843.h
@@ -30,7 +30,8 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(update_tick);
private:
// Status flags
diff --git a/src/devices/machine/mc6846.cpp b/src/devices/machine/mc6846.cpp
index 72b3f1added..7cacedc9656 100644
--- a/src/devices/machine/mc6846.cpp
+++ b/src/devices/machine/mc6846.cpp
@@ -62,8 +62,8 @@ mc6846_device::mc6846_device(const machine_config &mconfig, const char *tag, dev
void mc6846_device::device_start()
{
- m_interval = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mc6846_device::timer_expire), this));
- m_one_shot = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mc6846_device::timer_one_shot), this));
+ m_interval = timer_alloc(FUNC(mc6846_device::timer_expire), this);
+ m_one_shot = timer_alloc(FUNC(mc6846_device::timer_one_shot), this);
m_out_port_cb.resolve(); /* 8-bit output */
m_out_cp2_cb.resolve(); /* 1-bit output */
diff --git a/src/devices/machine/mc6854.cpp b/src/devices/machine/mc6854.cpp
index ed5eb02b8b5..55418ee0d23 100644
--- a/src/devices/machine/mc6854.cpp
+++ b/src/devices/machine/mc6854.cpp
@@ -194,7 +194,7 @@ void mc6854_device::device_start()
m_out_rts_cb.resolve_safe();
m_out_dtr_cb.resolve_safe();
- m_ttimer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mc6854_device::tfifo_cb), this));
+ m_ttimer = timer_alloc(FUNC(mc6854_device::tfifo_cb), this);
save_item(NAME(m_cr1));
save_item(NAME(m_cr2));
diff --git a/src/devices/machine/mc68681.cpp b/src/devices/machine/mc68681.cpp
index 9d78834d166..8e647f4c2ab 100644
--- a/src/devices/machine/mc68681.cpp
+++ b/src/devices/machine/mc68681.cpp
@@ -208,7 +208,7 @@ void duart_base_device::device_start()
read_inport.resolve();
write_outport.resolve_safe();
- duart_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(duart_base_device::duart_timer_callback),this));
+ duart_timer = timer_alloc(FUNC(duart_base_device::duart_timer_callback), this);
save_item(NAME(ACR));
save_item(NAME(IMR));
diff --git a/src/devices/machine/mc68901.cpp b/src/devices/machine/mc68901.cpp
index 5160e27eee9..ed0282770e9 100644
--- a/src/devices/machine/mc68901.cpp
+++ b/src/devices/machine/mc68901.cpp
@@ -152,7 +152,6 @@ enum : u8 {
#define DIVISOR PRESCALER[data & 0x07]
-
const u16 mc68901_device::INT_MASK_GPIO[] =
{
IR_GPIP_0, IR_GPIP_1, IR_GPIP_2, IR_GPIP_3,
@@ -230,34 +229,34 @@ inline void mc68901_device::rx_error()
}
}
-inline void mc68901_device::timer_count(int index)
+TIMER_CALLBACK_MEMBER(mc68901_device::timer_count)
{
- if (m_tmc[index] == 0x01)
+ if (m_tmc[param] == 0x01)
{
/* toggle timer output signal */
- m_to[index] = !m_to[index];
+ m_to[param] = !m_to[param];
- switch (index)
+ switch (param)
{
- case TIMER_A: m_out_tao_cb(m_to[index]); break;
- case TIMER_B: m_out_tbo_cb(m_to[index]); break;
- case TIMER_C: m_out_tco_cb(m_to[index]); break;
- case TIMER_D: m_out_tdo_cb(m_to[index]); break;
+ case TIMER_A: m_out_tao_cb(m_to[param]); break;
+ case TIMER_B: m_out_tbo_cb(m_to[param]); break;
+ case TIMER_C: m_out_tco_cb(m_to[param]); break;
+ case TIMER_D: m_out_tdo_cb(m_to[param]); break;
}
- if (m_ier & INT_MASK_TIMER[index])
+ if (m_ier & INT_MASK_TIMER[param])
{
/* signal timer elapsed interrupt */
- take_interrupt(INT_MASK_TIMER[index]);
+ take_interrupt(INT_MASK_TIMER[param]);
}
/* load main counter */
- m_tmc[index] = m_tdr[index];
+ m_tmc[param] = m_tdr[param];
}
else
{
/* count down */
- m_tmc[index]--;
+ m_tmc[param]--;
}
}
@@ -406,10 +405,10 @@ void mc68901_device::device_start()
m_iack_chain_cb.resolve();
/* create the timers */
- m_timer[TIMER_A] = timer_alloc(TIMER_A);
- m_timer[TIMER_B] = timer_alloc(TIMER_B);
- m_timer[TIMER_C] = timer_alloc(TIMER_C);
- m_timer[TIMER_D] = timer_alloc(TIMER_D);
+ m_timer[TIMER_A] = timer_alloc(FUNC(mc68901_device::timer_count), this);
+ m_timer[TIMER_B] = timer_alloc(FUNC(mc68901_device::timer_count), this);
+ m_timer[TIMER_C] = timer_alloc(FUNC(mc68901_device::timer_count), this);
+ m_timer[TIMER_D] = timer_alloc(FUNC(mc68901_device::timer_count), this);
/* register for state saving */
save_item(NAME(m_gpip));
@@ -500,17 +499,6 @@ void mc68901_device::device_reset()
//-------------------------------------------------
-// device_timer - handler timer events
-//-------------------------------------------------
-
-void mc68901_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- if(id >= TIMER_A && id <= TIMER_D)
- timer_count(id);
-}
-
-
-//-------------------------------------------------
// read - read from one MFP register
//-------------------------------------------------
@@ -696,7 +684,7 @@ void mc68901_device::write(offs_t offset, u8 data)
{
int divisor = PRESCALER[m_tacr & 0x07];
LOG("MC68901 Timer A Delay Mode : %u Prescale\n", divisor);
- m_timer[TIMER_A]->adjust(attotime::from_hz(m_timer_clock / divisor), 0, attotime::from_hz(m_timer_clock / divisor));
+ m_timer[TIMER_A]->adjust(attotime::from_hz(m_timer_clock / divisor), TIMER_A, attotime::from_hz(m_timer_clock / divisor));
}
break;
@@ -712,12 +700,8 @@ void mc68901_device::write(offs_t offset, u8 data)
case TCR_TIMER_PULSE_64:
case TCR_TIMER_PULSE_100:
case TCR_TIMER_PULSE_200:
- {
- int divisor = PRESCALER[m_tacr & 0x07];
- LOG("MC68901 Timer A Pulse Width Mode : %u Prescale\n", divisor);
- m_timer[TIMER_A]->adjust(attotime::never, 0, attotime::from_hz(m_timer_clock / divisor));
- m_timer[TIMER_A]->enable(false);
- }
+ LOG("MC68901 Timer A Pulse Width Mode\n");
+ m_timer[TIMER_A]->adjust(attotime::never);
break;
}
@@ -749,9 +733,9 @@ void mc68901_device::write(offs_t offset, u8 data)
case TCR_TIMER_DELAY_100:
case TCR_TIMER_DELAY_200:
{
- int divisor = PRESCALER[m_tbcr & 0x07];
- LOG("MC68901 Timer B Delay Mode : %u Prescale\n", divisor);
- m_timer[TIMER_B]->adjust(attotime::from_hz(m_timer_clock / divisor), 0, attotime::from_hz(m_timer_clock / divisor));
+ int divisor = PRESCALER[m_tbcr & 0x07];
+ LOG("MC68901 Timer B Delay Mode : %u Prescale\n", divisor);
+ m_timer[TIMER_B]->adjust(attotime::from_hz(m_timer_clock / divisor), TIMER_B, attotime::from_hz(m_timer_clock / divisor));
}
break;
@@ -767,12 +751,8 @@ void mc68901_device::write(offs_t offset, u8 data)
case TCR_TIMER_PULSE_64:
case TCR_TIMER_PULSE_100:
case TCR_TIMER_PULSE_200:
- {
- int divisor = PRESCALER[m_tbcr & 0x07];
- LOG("MC68901 Timer B Pulse Width Mode : %u Prescale\n", DIVISOR);
- m_timer[TIMER_B]->adjust(attotime::never, 0, attotime::from_hz(m_timer_clock / divisor));
- m_timer[TIMER_B]->enable(false);
- }
+ LOG("MC68901 Timer B Pulse Width Mode\n");
+ m_timer[TIMER_B]->adjust(attotime::never);
break;
}
@@ -806,7 +786,7 @@ void mc68901_device::write(offs_t offset, u8 data)
{
int divisor = PRESCALER[m_tcdcr & 0x07];
LOG("MC68901 Timer D Delay Mode : %u Prescale\n", divisor);
- m_timer[TIMER_D]->adjust(attotime::from_hz(m_timer_clock / divisor), 0, attotime::from_hz(m_timer_clock / divisor));
+ m_timer[TIMER_D]->adjust(attotime::from_hz(m_timer_clock / divisor), TIMER_D, attotime::from_hz(m_timer_clock / divisor));
}
break;
}
@@ -828,7 +808,7 @@ void mc68901_device::write(offs_t offset, u8 data)
{
int divisor = PRESCALER[(m_tcdcr >> 4) & 0x07];
LOG("MC68901 Timer C Delay Mode : %u Prescale\n", divisor);
- m_timer[TIMER_C]->adjust(attotime::from_hz(m_timer_clock / divisor), 0, attotime::from_hz(m_timer_clock / divisor));
+ m_timer[TIMER_C]->adjust(attotime::from_hz(m_timer_clock / divisor), TIMER_C, attotime::from_hz(m_timer_clock / divisor));
}
break;
}
diff --git a/src/devices/machine/mc68901.h b/src/devices/machine/mc68901.h
index de640fac657..0e992c78941 100644
--- a/src/devices/machine/mc68901.h
+++ b/src/devices/machine/mc68901.h
@@ -91,7 +91,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
void check_interrupts();
void take_interrupt(u16 mask);
@@ -99,7 +98,7 @@ protected:
void tx_error();
void rx_buffer_full();
void rx_error();
- void timer_count(int index);
+ TIMER_CALLBACK_MEMBER(timer_count);
void timer_input(int index, int value);
void gpio_input(int bit, int state);
void gpio_output();
diff --git a/src/devices/machine/mccs1850.cpp b/src/devices/machine/mccs1850.cpp
index abbddf5b9be..367b58af135 100644
--- a/src/devices/machine/mccs1850.cpp
+++ b/src/devices/machine/mccs1850.cpp
@@ -105,7 +105,7 @@ DEFINE_DEVICE_TYPE(MCCS1850, mccs1850_device, "mccs1850", "MCCS1850 RTC")
//**************************************************************************
-// INLINE HELPERS
+// DEVICE FUNCTIONS
//**************************************************************************
//-------------------------------------------------
@@ -247,7 +247,7 @@ inline void mccs1850_device::write_register(offs_t offset, uint8_t data)
// advance_seconds -
//-------------------------------------------------
-inline void mccs1850_device::advance_seconds()
+TIMER_CALLBACK_MEMBER(mccs1850_device::advance_seconds)
{
uint32_t alarm = (m_ram[REGISTER_ALARM_LATCH] << 24) | (m_ram[REGISTER_ALARM_LATCH + 1] << 16) | (m_ram[REGISTER_ALARM_LATCH + 2] << 8) | m_ram[REGISTER_ALARM_LATCH + 3];
@@ -324,7 +324,7 @@ void mccs1850_device::device_start()
nuc_cb.resolve();
// allocate timers
- m_clock_timer = timer_alloc(TIMER_CLOCK);
+ m_clock_timer = timer_alloc(FUNC(mccs1850_device::advance_seconds), this);
m_clock_timer->adjust(attotime::from_hz(clock() / 32768), 0, attotime::from_hz(clock() / 32768));
// state saving
@@ -356,21 +356,6 @@ void mccs1850_device::device_reset()
//-------------------------------------------------
-// device_timer - handler timer events
-//-------------------------------------------------
-
-void mccs1850_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_CLOCK:
- advance_seconds();
- break;
- }
-}
-
-
-//-------------------------------------------------
// nvram_default - called to initialize NVRAM to
// its default state
//-------------------------------------------------
diff --git a/src/devices/machine/mccs1850.h b/src/devices/machine/mccs1850.h
index 87def943008..cdd3b2853bc 100644
--- a/src/devices/machine/mccs1850.h
+++ b/src/devices/machine/mccs1850.h
@@ -55,7 +55,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_nvram_interface overrides
virtual void nvram_default() override;
@@ -66,13 +65,11 @@ protected:
virtual void rtc_clock_updated(int year, int month, int day, int day_of_week, int hour, int minute, int second) override;
private:
- inline void check_interrupt();
- inline void set_pse_line(bool state);
- inline uint8_t read_register(offs_t offset);
- inline void write_register(offs_t offset, uint8_t data);
- inline void advance_seconds();
-
- static const device_timer_id TIMER_CLOCK = 0;
+ void check_interrupt();
+ void set_pse_line(bool state);
+ uint8_t read_register(offs_t offset);
+ void write_register(offs_t offset, uint8_t data);
+ TIMER_CALLBACK_MEMBER(advance_seconds);
devcb_write_line int_cb, pse_cb, nuc_cb;
diff --git a/src/devices/machine/mcf5206e.cpp b/src/devices/machine/mcf5206e.cpp
index 640550fcdec..eb4695be03a 100644
--- a/src/devices/machine/mcf5206e.cpp
+++ b/src/devices/machine/mcf5206e.cpp
@@ -846,7 +846,7 @@ void mcf5206e_peripheral_device::device_start()
{
init_regs(true);
- m_timer1 = machine().scheduler().timer_alloc( timer_expired_delegate( FUNC( mcf5206e_peripheral_device::timer1_callback ), this) );
+ m_timer1 = timer_alloc( FUNC( mcf5206e_peripheral_device::timer1_callback ), this );
save_item(NAME(m_ICR));
save_item(NAME(m_CSAR));
diff --git a/src/devices/machine/meters.cpp b/src/devices/machine/meters.cpp
index a1c9a77b076..fca2abc6e2a 100644
--- a/src/devices/machine/meters.cpp
+++ b/src/devices/machine/meters.cpp
@@ -1,11 +1,10 @@
// license:BSD-3-Clause
// copyright-holders:James Wallace
-///////////////////////////////////////////////////////////////////////////
-// //
-// Electro mechanical meters //
-// //
-// //
-///////////////////////////////////////////////////////////////////////////
+/**********************************************************************
+
+ Electromechanical Meter device
+
+**********************************************************************/
#include "emu.h"
#include "meters.h"
@@ -30,19 +29,17 @@ meters_device::meters_device(const machine_config &mconfig, const char *tag, dev
void meters_device::device_start()
{
- if ( m_number_mtr > MAXMECHMETERS )
+ if (m_number_mtr > MAXMECHMETERS)
m_number_mtr = MAXMECHMETERS;
- for ( int i = 0; i < m_number_mtr; i++ )
+ for (int i = 0; i < m_number_mtr; i++)
{
m_meter_info[i].reacttime = METERREACTTIME;
m_meter_info[i].state = 0;
m_meter_info[i].count = 0;
m_meter_info[i].on = 0;
- m_meter_info[i].meter_timer = timer_alloc(i);
- m_meter_info[i].meter_timer->reset();
+ m_meter_info[i].meter_timer = timer_alloc(FUNC(meters_device::count_tick), this);
- //save_item(NAME(m_meter_info[i].reacttime), i); //enable if void ReactTime(int id, int32_t cycles) gets used
save_item(NAME(m_meter_info[i].state), i);
save_item(NAME(m_meter_info[i].count), i);
save_item(NAME(m_meter_info[i].on), i);
@@ -58,89 +55,42 @@ void meters_device::device_reset()
}
//-------------------------------------------------
-// device_timer - device-specific timer events
+// count_tick - advance the meter's counter
//-------------------------------------------------
-void meters_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(meters_device::count_tick)
{
- if (id >= m_number_mtr)
- throw emu_fatalerror("Unknown id in meters_device::device_timer");
-
m_meter_info[param].count++;
}
-///////////////////////////////////////////////////////////////////////////
-
-int meters_device::GetNumberMeters(void) // currently unused
-{
- return m_number_mtr;
-}
-
-///////////////////////////////////////////////////////////////////////////
-
-void meters_device::Setcount(int id, int32_t count) // currently unused
-{
- if ( id >= m_number_mtr )
- return;
-
- m_meter_info[id].count = count;
-}
-
-///////////////////////////////////////////////////////////////////////////
-
-int32_t meters_device::Getcount(int id) // currently unused
-{
- int32_t result = 0;
-
- if ( id < m_number_mtr )
- result = m_meter_info[id].count;
-
- return result;
-}
-
-///////////////////////////////////////////////////////////////////////////
-
-void meters_device::ReactTime(int id, int32_t cycles) // currently unused
-{
- if ( id >= m_number_mtr )
- return;
-
- m_meter_info[id].reacttime = cycles;
-}
-
-///////////////////////////////////////////////////////////////////////////
-
-int meters_device::GetActivity(int id)
+int meters_device::get_activity(int id)
{
return m_meter_info[id].on;
}
-///////////////////////////////////////////////////////////////////////////
-
int meters_device::update(int id, int state)
{
- int res = 0;
-
- if ( id >= m_number_mtr )
- return res;
+ if (id >= m_number_mtr)
+ return 0;
- state = state?1:0;
+ state = state ? 1 : 0;
- if ( m_meter_info[id].state != state )
+ if (m_meter_info[id].state != state)
{ // meter state is changing
m_meter_info[id].state = state;
- if ( state )
+ if (state)
{
- m_meter_info[id].on =1;
+ m_meter_info[id].on = true;
m_meter_info[id].meter_timer->adjust(attotime::from_seconds(m_meter_info[id].reacttime), id);
}
else
{
- m_meter_info[id].on =0;
- m_meter_info[id].meter_timer->adjust(attotime::never, id);
+ m_meter_info[id].on = false;
+ m_meter_info[id].meter_timer->adjust(attotime::never);
}
}
+
return m_meter_info[id].on;
}
diff --git a/src/devices/machine/meters.h b/src/devices/machine/meters.h
index b8da53bfe1b..e7dda1802d0 100644
--- a/src/devices/machine/meters.h
+++ b/src/devices/machine/meters.h
@@ -1,13 +1,10 @@
// license:BSD-3-Clause
// copyright-holders:James Wallace
-///////////////////////////////////////////////////////////////////////////
-// //
-// Electro mechanical meters //
-// //
-// 23-07-2004: Re-Animator //
-// //
-// //
-///////////////////////////////////////////////////////////////////////////
+/**********************************************************************
+
+ Electromechanical Meter device
+
+**********************************************************************/
#ifndef MAME_MACHINE_METERS_H
#define MAME_MACHINE_METERS_H
@@ -18,36 +15,31 @@
class meters_device : public device_t
{
public:
- static constexpr unsigned MAXMECHMETERS = 8;
-
- static constexpr double METERREACTTIME = 0.025; // number of seconds meter has to be active to tick
-
meters_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
void set_number(int number) { m_number_mtr = number; }
int update(int id, int state);
- int GetActivity(int id);
-
- int GetNumberMeters(void); // currently unused
- void Setcount(int id, int32_t count); // currently unused
- int32_t Getcount(int id); // currently unused
- void ReactTime(int id, int32_t cycles); // currently unused
+ int get_activity(int id);
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(count_tick);
private:
+ static constexpr unsigned MAXMECHMETERS = 8;
+ static constexpr double METERREACTTIME = 0.025; // number of seconds meter has to be active to tick
+
// internal state
struct meter_info
{
- bool on; // Activity of reel
+ bool on; // Reel active
int32_t reacttime;
- int32_t count; // mechmeter value
- bool state; // state 0/1
+ int32_t count; // Meter value
+ bool state;
emu_timer *meter_timer;
};
diff --git a/src/devices/machine/microtch.cpp b/src/devices/machine/microtch.cpp
index dfcf1e52d3d..7f4562f02f1 100644
--- a/src/devices/machine/microtch.cpp
+++ b/src/devices/machine/microtch.cpp
@@ -80,10 +80,10 @@ microtouch_device::microtouch_device(const machine_config &mconfig, const char *
int microtouch_device::check_command( const char* commandtocheck, int command_len, uint8_t* command_data )
{
- if ( (command_len == (strlen(commandtocheck) + 2)) &&
+ if ((command_len == (strlen(commandtocheck) + 2)) &&
(command_data[0] == 0x01) &&
(strncmp(commandtocheck, (const char*)command_data + 1, strlen(commandtocheck)) == 0) &&
- (command_data[command_len-1] == 0x0d) )
+ (command_data[command_len-1] == 0x0d))
{
return 1;
}
@@ -111,10 +111,10 @@ void microtouch_device::send_format_decimal_packet(int x, int y)
int decx, decy;
decx = x / 16;
- if ( decx > 999 )
+ if (decx > 999)
decx = 999;
decy = y / 16;
- if ( decy > 999 )
+ if (decy > 999)
decy = 999;
// header byte
@@ -138,12 +138,11 @@ void microtouch_device::send_touch_packet()
int tx = m_touchx->read();
int ty = m_touchy->read();
- if ( m_out_touch_cb.isnull() ||
- m_out_touch_cb( &tx, &ty ) != 0 )
+ if (m_out_touch_cb.isnull() || m_out_touch_cb(&tx, &ty) != 0)
{
ty = 0x4000 - ty;
- switch( m_format )
+ switch (m_format)
{
case FORMAT_TABLET:
send_format_table_packet(0xc8, tx, ty);
@@ -160,54 +159,49 @@ void microtouch_device::send_touch_packet()
}
}
-void microtouch_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(microtouch_device::update_output)
{
- if (!id)
+ if (m_tx_buffer_ptr < m_tx_buffer_num)
{
- if ( m_tx_buffer_ptr < m_tx_buffer_num )
+ if (is_transmit_register_empty())
{
- if(is_transmit_register_empty())
- {
- m_output = m_tx_buffer[m_tx_buffer_ptr++];
- m_output_valid = true;
- tra_complete();
- }
-
- if ( m_tx_buffer_ptr == m_tx_buffer_num )
- {
- m_tx_buffer_ptr = m_tx_buffer_num = 0;
- }
- return;
+ m_output = m_tx_buffer[m_tx_buffer_ptr++];
+ m_output_valid = true;
+ tra_complete();
}
- if ( (m_reset_done == 0) ||
- (m_format == FORMAT_UNKNOWN) ||
- (m_mode != MODE_STREAM))
+ if (m_tx_buffer_ptr == m_tx_buffer_num)
{
- return;
+ m_tx_buffer_ptr = m_tx_buffer_num = 0;
}
+ return;
+ }
- // send format tablet packet
- if (m_touch->read())
- {
- send_touch_packet();
- }
- else
+ if (m_reset_done == 0 || m_format == FORMAT_UNKNOWN || m_mode != MODE_STREAM)
+ {
+ return;
+ }
+
+ // send format tablet packet
+ if (m_touch->read())
+ {
+ send_touch_packet();
+ }
+ else
+ {
+ if (m_last_touch_state == 1)
{
- if ( m_last_touch_state == 1 )
+ m_last_touch_state = 0;
+ switch (m_format)
{
- m_last_touch_state = 0;
- switch( m_format )
- {
- case FORMAT_TABLET:
- send_format_table_packet(0x88, m_last_x, m_last_y);
- break;
- case FORMAT_DECIMAL:
- send_format_decimal_packet(m_last_x, m_last_y);
- break;
- case FORMAT_UNKNOWN:
- break;
- }
+ case FORMAT_TABLET:
+ send_format_table_packet(0x88, m_last_x, m_last_y);
+ break;
+ case FORMAT_DECIMAL:
+ send_format_decimal_packet(m_last_x, m_last_y);
+ break;
+ case FORMAT_UNKNOWN:
+ break;
}
}
}
@@ -227,7 +221,7 @@ void microtouch_device::device_start()
m_last_y = 0;
m_last_touch_state = -1;
- m_timer = timer_alloc();
+ m_timer = timer_alloc(FUNC(microtouch_device::update_output), this);
m_timer->adjust(attotime::from_hz(167*5), 0, attotime::from_hz(167*5));
m_format = FORMAT_UNKNOWN;
@@ -261,10 +255,10 @@ void microtouch_device::rcv_complete()
receive_register_extract();
m_rx_buffer[m_rx_buffer_ptr] = get_received_char();
m_rx_buffer_ptr++;
- if(m_rx_buffer_ptr == 16)
+ if (m_rx_buffer_ptr == 16)
return;
- if (m_rx_buffer_ptr > 0 && (m_rx_buffer[m_rx_buffer_ptr-1] == 0x0d))
+ if (m_rx_buffer_ptr > 0 && m_rx_buffer[m_rx_buffer_ptr-1] == 0x0d)
{
if (VERBOSE)
{
@@ -274,32 +268,32 @@ void microtouch_device::rcv_complete()
LOG("Microtouch: received command %s\n", command);
}
// check command
- if ( check_command( "MS", m_rx_buffer_ptr, m_rx_buffer ) )
+ if (check_command("MS", m_rx_buffer_ptr, m_rx_buffer))
{
m_mode = MODE_STREAM;
}
- else if ( check_command( "MI", m_rx_buffer_ptr, m_rx_buffer ) )
+ else if (check_command("MI", m_rx_buffer_ptr, m_rx_buffer))
{
m_mode = MODE_INACTIVE;
}
- else if ( check_command( "MP", m_rx_buffer_ptr, m_rx_buffer ) )
+ else if (check_command("MP", m_rx_buffer_ptr, m_rx_buffer))
{
m_mode = MODE_POINT;
}
- else if ( check_command( "R", m_rx_buffer_ptr, m_rx_buffer ) )
+ else if (check_command("R", m_rx_buffer_ptr, m_rx_buffer))
{
m_tx_buffer_num = 0;
m_reset_done = 1;
}
- else if ( check_command( "FT", m_rx_buffer_ptr, m_rx_buffer ) )
+ else if (check_command("FT", m_rx_buffer_ptr, m_rx_buffer))
{
m_format = FORMAT_TABLET;
}
- else if ( check_command( "FD", m_rx_buffer_ptr, m_rx_buffer ) )
+ else if (check_command("FD", m_rx_buffer_ptr, m_rx_buffer))
{
m_format = FORMAT_DECIMAL;
}
- else if ( check_command("OI", m_rx_buffer_ptr, m_rx_buffer ) )
+ else if (check_command("OI", m_rx_buffer_ptr, m_rx_buffer))
{
// output identity - SMT3, ver 01.00
m_tx_buffer[m_tx_buffer_num++] = 0x01;
@@ -313,7 +307,7 @@ void microtouch_device::rcv_complete()
m_rx_buffer_ptr = 0;
return;
}
- else if ( check_command("OS", m_rx_buffer_ptr, m_rx_buffer ) )
+ else if (check_command("OS", m_rx_buffer_ptr, m_rx_buffer))
{
// output status
m_tx_buffer[m_tx_buffer_num++] = 0x01;
@@ -347,9 +341,9 @@ void microtouch_device::rcv_complete()
}
}
-INPUT_CHANGED_MEMBER( microtouch_device::touch )
+INPUT_CHANGED_MEMBER(microtouch_device::touch)
{
- if ( newval && ( m_mode == MODE_POINT ) )
+ if (newval && (m_mode == MODE_POINT))
{
send_touch_packet();
}
@@ -368,11 +362,11 @@ ROM_END
static INPUT_PORTS_START(microtouch)
PORT_START("TOUCH")
- PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME( "Touch screen" ) PORT_CHANGED_MEMBER( DEVICE_SELF,microtouch_device, touch, 0 )
+ PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Touch screen") PORT_CHANGED_MEMBER(DEVICE_SELF, microtouch_device, touch, 0)
PORT_START("TOUCH_X")
- PORT_BIT( 0x3fff, 0x2000, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(45) PORT_KEYDELTA(15)
+ PORT_BIT(0x3fff, 0x2000, IPT_LIGHTGUN_X) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(45) PORT_KEYDELTA(15)
PORT_START("TOUCH_Y")
- PORT_BIT( 0x3fff, 0x2000, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(45) PORT_KEYDELTA(15)
+ PORT_BIT(0x3fff, 0x2000, IPT_LIGHTGUN_Y) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(45) PORT_KEYDELTA(15)
INPUT_PORTS_END
ioport_constructor microtouch_device::device_input_ports() const
@@ -387,7 +381,7 @@ void microtouch_device::tra_callback()
void microtouch_device::tra_complete()
{
- if(m_output_valid)
+ if (m_output_valid)
{
transmit_register_setup(m_output);
m_output_valid = false;
diff --git a/src/devices/machine/microtch.h b/src/devices/machine/microtch.h
index 3eba8bfbb68..b7242f4cca3 100644
--- a/src/devices/machine/microtch.h
+++ b/src/devices/machine/microtch.h
@@ -26,7 +26,6 @@ protected:
// device_t implementation
virtual ioport_constructor device_input_ports() const override;
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_serial_interface implementation
virtual void tra_callback() override;
@@ -36,6 +35,8 @@ protected:
// ROM region (unused, as the device is HLE'd)
virtual const tiny_rom_entry *device_rom_region() const override;
+ TIMER_CALLBACK_MEMBER(update_output);
+
private:
int check_command( const char* commandtocheck, int command_len, uint8_t* command_data );
void send_format_table_packet(uint8_t flag, int x, int y);
@@ -56,25 +57,25 @@ private:
MODE_POINT
};
- uint8_t m_rx_buffer[16];
+ uint8_t m_rx_buffer[16];
int m_rx_buffer_ptr;
- uint8_t m_tx_buffer[16];
- uint8_t m_tx_buffer_num;
- uint8_t m_tx_buffer_ptr;
+ uint8_t m_tx_buffer[16];
+ uint8_t m_tx_buffer_num;
+ uint8_t m_tx_buffer_ptr;
int m_reset_done;
int m_format;
int m_mode;
int m_last_touch_state;
int m_last_x;
int m_last_y;
- touch_cb m_out_touch_cb;
+ touch_cb m_out_touch_cb;
devcb_write_line m_out_stx_func;
required_ioport m_touch;
required_ioport m_touchx;
required_ioport m_touchy;
emu_timer* m_timer;
- bool m_output_valid;
- uint8_t m_output;
+ bool m_output_valid;
+ uint8_t m_output;
};
DECLARE_DEVICE_TYPE(MICROTOUCH, microtouch_device)
diff --git a/src/devices/machine/mm5307.cpp b/src/devices/machine/mm5307.cpp
index 312d7cff86b..30032913ad0 100644
--- a/src/devices/machine/mm5307.cpp
+++ b/src/devices/machine/mm5307.cpp
@@ -140,7 +140,7 @@ void mm5307_device::device_resolve_objects()
void mm5307_device::device_start()
{
// Create timer
- m_periodic_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mm5307_device::periodic_update), this));
+ m_periodic_timer = timer_alloc(FUNC(mm5307_device::periodic_update), this);
// Register for saving
save_item(NAME(m_freq_control));
diff --git a/src/devices/machine/mm5740.cpp b/src/devices/machine/mm5740.cpp
index 43a44024200..feabf787fe0 100644
--- a/src/devices/machine/mm5740.cpp
+++ b/src/devices/machine/mm5740.cpp
@@ -79,7 +79,7 @@ void mm5740_device::device_start()
m_write_data_ready.resolve_safe();
// allocate timers
- m_scan_timer = timer_alloc();
+ m_scan_timer = timer_alloc(FUNC(mm5740_device::perform_scan), this);
m_scan_timer->adjust(attotime::from_hz(clock()), 0, attotime::from_hz(clock()));
// state saving
@@ -97,12 +97,12 @@ void mm5740_device::device_reset()
}
//-------------------------------------------------
-// device_timer - handler timer events
+// perform_scan - scan the keyboard matrix
//-------------------------------------------------
-void mm5740_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(mm5740_device::perform_scan)
{
- int ako = 0;
+ bool ako = false;
for (int x = 0; x < 9; x++)
{
@@ -116,7 +116,6 @@ void mm5740_device::device_timer(emu_timer &timer, device_timer_id id, int param
for (int y = 0; y < 10; y++)
{
-
if (BIT(data, y))
{
uint8_t *rom = m_rom->base();
@@ -131,7 +130,7 @@ void mm5740_device::device_timer(emu_timer &timer, device_timer_id id, int param
uint16_t b = (((common & 0x10) << 4) | ((uniq & 0x0f) << 4) | (common & 0x0f)) ^ 0x1ff;
- ako = 1;
+ ako = true;
if (!BIT(m_x_mask[x], y))
{
diff --git a/src/devices/machine/mm5740.h b/src/devices/machine/mm5740.h
index 91d2280f3fb..c1e4eb81f70 100644
--- a/src/devices/machine/mm5740.h
+++ b/src/devices/machine/mm5740.h
@@ -105,13 +105,15 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual const tiny_rom_entry *device_rom_region() const override;
+ TIMER_CALLBACK_MEMBER(perform_scan);
+
private:
devcb_read16::array<9> m_read_x;
- devcb_read_line m_read_shift, m_read_control;
+ devcb_read_line m_read_shift;
+ devcb_read_line m_read_control;
devcb_write_line m_write_data_ready;
required_memory_region m_rom; // Internal ROM
diff --git a/src/devices/machine/mm58167.cpp b/src/devices/machine/mm58167.cpp
index b4f311408be..152a23de195 100644
--- a/src/devices/machine/mm58167.cpp
+++ b/src/devices/machine/mm58167.cpp
@@ -67,7 +67,7 @@ mm58167_device::mm58167_device(const machine_config &mconfig, const char *tag, d
void mm58167_device::device_start()
{
// allocate timers
- m_clock_timer = timer_alloc();
+ m_clock_timer = timer_alloc(FUNC(mm58167_device::clock_tick), this);
m_clock_timer->adjust(attotime::from_hz(clock() / 32.768f), 0, attotime::from_hz(clock() / 32.768f));
m_irq_w.resolve_safe();
@@ -94,10 +94,10 @@ void mm58167_device::device_reset()
//-------------------------------------------------
-// device_timer - handler timer events
+// clock_tick - advance the RTC's registers
//-------------------------------------------------
-void mm58167_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(mm58167_device::clock_tick)
{
m_milliseconds++;
diff --git a/src/devices/machine/mm58167.h b/src/devices/machine/mm58167.h
index 08def7cd569..82cf173ca95 100644
--- a/src/devices/machine/mm58167.h
+++ b/src/devices/machine/mm58167.h
@@ -38,12 +38,13 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_rtc_interface overrides
virtual void rtc_clock_updated(int year, int month, int day, int day_of_week, int hour, int minute, int second) override;
virtual bool rtc_feature_leap_year() const override { return true; }
+ TIMER_CALLBACK_MEMBER(clock_tick);
+
void set_irq(int bit);
void update_rtc();
diff --git a/src/devices/machine/mm58174.cpp b/src/devices/machine/mm58174.cpp
index bf0759bea22..3d15060666a 100644
--- a/src/devices/machine/mm58174.cpp
+++ b/src/devices/machine/mm58174.cpp
@@ -50,9 +50,9 @@ mm58174_device::mm58174_device(const machine_config &mconfig, const char *tag, d
void mm58174_device::device_start()
{
- m_increment_rtc = timer_alloc();
- m_increment_rtc->adjust(attotime::zero, 0, attotime::from_msec(100));
- m_interrupt_timer = timer_alloc();
+ m_rtc_timer = timer_alloc(FUNC(mm58174_device::clock_tick), this);
+ m_rtc_timer->adjust(attotime::zero, 0, attotime::from_msec(100));
+ m_interrupt_timer = timer_alloc(FUNC(mm58174_device::scheduler_sync), this);
// register for state saving
save_item(NAME(m_control));
@@ -282,10 +282,8 @@ void mm58174_device::write(offs_t offset, uint8_t data)
// Increment RTC clock (timed interrupt every 1/10s)
-void mm58174_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(mm58174_device::clock_tick)
{
- if (id > 0) return;
-
if (m_control & ctl_clkrun)
{
if ((++m_tenths) == 10)
@@ -295,3 +293,12 @@ void mm58174_device::device_timer(emu_timer &timer, device_timer_id id, int para
}
}
}
+
+// TODO: Investigate if this is necessary, or if there's missing functionality from the device.
+// Prior to the device_timer removal, m_interrupt_timer was being allocated with the same default ID as m_rtc_timer.
+// As there was no interrupt-related logic in the existing device_timer implementation, the only possible thing that
+// m_interrupt_timer could possibly do, functionally, is force a scheduler sync by elapsing, and also cause the
+// RTC to tick at an erroneous rate.
+TIMER_CALLBACK_MEMBER(mm58174_device::scheduler_sync)
+{
+}
diff --git a/src/devices/machine/mm58174.h b/src/devices/machine/mm58174.h
index 01db657255d..72fbfc85502 100644
--- a/src/devices/machine/mm58174.h
+++ b/src/devices/machine/mm58174.h
@@ -23,12 +23,14 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_rtc_interface overrides
virtual void rtc_clock_updated(int year, int month, int day, int day_of_week, int hour, int minute, int second) override;
virtual bool rtc_feature_leap_year() const override { return true; }
+ TIMER_CALLBACK_MEMBER(clock_tick);
+ TIMER_CALLBACK_MEMBER(scheduler_sync);
+
void update_rtc();
private:
@@ -54,7 +56,7 @@ private:
int m_seconds2;
int m_tenths; /* tenths of second (BCD : 0-9) */
- emu_timer *m_increment_rtc;
+ emu_timer *m_rtc_timer;
emu_timer *m_interrupt_timer;
};
diff --git a/src/devices/machine/mm58274c.cpp b/src/devices/machine/mm58274c.cpp
index c7e7f49a78e..cfc50472653 100644
--- a/src/devices/machine/mm58274c.cpp
+++ b/src/devices/machine/mm58274c.cpp
@@ -61,9 +61,9 @@ mm58274c_device::mm58274c_device(const machine_config &mconfig, const char *tag,
void mm58274c_device::device_start()
{
- m_increment_rtc = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mm58274c_device::rtc_increment_cb),this));
+ m_increment_rtc = timer_alloc(FUNC(mm58274c_device::rtc_increment_cb), this);
m_increment_rtc->adjust(attotime::zero, 0, attotime::from_msec(100));
- m_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mm58274c_device::rtc_interrupt_cb),this));
+ m_interrupt_timer = timer_alloc(FUNC(mm58274c_device::rtc_interrupt_cb), this);
// register for state saving
save_item(NAME(m_mode24));
diff --git a/src/devices/machine/mm74c922.cpp b/src/devices/machine/mm74c922.cpp
index af3fd1047d6..add765a1b1e 100644
--- a/src/devices/machine/mm74c922.cpp
+++ b/src/devices/machine/mm74c922.cpp
@@ -72,7 +72,7 @@ void mm74c922_device::device_start()
change_output_lines();
// allocate timers
- m_scan_timer = timer_alloc();
+ m_scan_timer = timer_alloc(FUNC(mm74c922_device::perform_scan), this);
m_scan_timer->adjust(attotime::zero, 0, attotime::from_hz(500)); // approximate rate from a 100n capacitor
// register for state saving
@@ -87,10 +87,10 @@ void mm74c922_device::device_start()
//-------------------------------------------------
-// device_timer - handler timer events
+// perform_scan - scan the keyboard matrix
//-------------------------------------------------
-void mm74c922_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(mm74c922_device::perform_scan)
{
change_output_lines();
clock_scan_counters();
diff --git a/src/devices/machine/mm74c922.h b/src/devices/machine/mm74c922.h
index bd265b87bfa..43c958bb4b7 100644
--- a/src/devices/machine/mm74c922.h
+++ b/src/devices/machine/mm74c922.h
@@ -67,7 +67,8 @@ protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(perform_scan);
private:
void change_output_lines();
diff --git a/src/devices/machine/mos6526.cpp b/src/devices/machine/mos6526.cpp
index 0ccb524d233..a35d9a9c573 100644
--- a/src/devices/machine/mos6526.cpp
+++ b/src/devices/machine/mos6526.cpp
@@ -120,14 +120,14 @@ DEFINE_DEVICE_TYPE(MOS5710, mos5710_device, "mos5710", "MOS 5710 CIA")
//**************************************************************************
-// INLINE HELPERS
+// DEVICE FUNCTIONS
//**************************************************************************
//-------------------------------------------------
// update_pa - update port A
//-------------------------------------------------
-inline void mos6526_device::update_pa()
+void mos6526_device::update_pa()
{
uint8_t pa = m_pra | (m_pa_in & ~m_ddra);
@@ -143,7 +143,7 @@ inline void mos6526_device::update_pa()
// update_pb - update port B
//-------------------------------------------------
-inline void mos6526_device::update_pb()
+void mos6526_device::update_pb()
{
uint8_t pb = m_prb | (m_pb_in & ~m_ddrb);
@@ -175,7 +175,7 @@ inline void mos6526_device::update_pb()
// set_cra - control register A write
//-------------------------------------------------
-inline void mos6526_device::set_cra(uint8_t data)
+void mos6526_device::set_cra(uint8_t data)
{
if (!CRA_STARTED && (data & CRA_START))
{
@@ -205,7 +205,7 @@ inline void mos6526_device::set_cra(uint8_t data)
// set_crb - control register B write
//-------------------------------------------------
-inline void mos6526_device::set_crb(uint8_t data)
+void mos6526_device::set_crb(uint8_t data)
{
if (!CRB_STARTED && (data & CRB_START))
{
@@ -221,7 +221,7 @@ inline void mos6526_device::set_crb(uint8_t data)
// bcd_increment -
//-------------------------------------------------
-inline uint8_t mos6526_device::bcd_increment(uint8_t value)
+uint8_t mos6526_device::bcd_increment(uint8_t value)
{
value++;
@@ -236,7 +236,7 @@ inline uint8_t mos6526_device::bcd_increment(uint8_t value)
// clock_tod - time-of-day clock pulse
//-------------------------------------------------
-inline void mos6526_device::clock_tod()
+void mos6526_device::clock_tod()
{
uint8_t subsecond = (uint8_t) (m_tod >> 0);
uint8_t second = (uint8_t) (m_tod >> 8);
@@ -290,7 +290,7 @@ inline void mos6526_device::clock_tod()
// clock_tod - time-of-day clock pulse
//-------------------------------------------------
-inline void mos8520_device::clock_tod()
+void mos8520_device::clock_tod()
{
m_tod++;
m_tod &= 0xffffff;
@@ -301,7 +301,7 @@ inline void mos8520_device::clock_tod()
// read_tod - time-of-day read
//-------------------------------------------------
-inline uint8_t mos6526_device::read_tod(int offset)
+uint8_t mos6526_device::read_tod(int offset)
{
int shift = 8 * offset;
@@ -320,7 +320,7 @@ inline uint8_t mos6526_device::read_tod(int offset)
// write_tod - time-of-day write
//-------------------------------------------------
-inline void mos6526_device::write_tod(int offset, uint8_t data)
+void mos6526_device::write_tod(int offset, uint8_t data)
{
int shift = 8 * offset;
@@ -339,7 +339,7 @@ inline void mos6526_device::write_tod(int offset, uint8_t data)
// serial_input -
//-------------------------------------------------
-inline void mos6526_device::serial_input()
+void mos6526_device::serial_input()
{
m_shift <<= 1;
m_bits++;
@@ -360,7 +360,7 @@ inline void mos6526_device::serial_input()
// clock_ta - clock timer A
//-------------------------------------------------
-inline void mos6526_device::clock_ta()
+void mos6526_device::clock_ta()
{
if (m_count_a3)
{
@@ -394,7 +394,7 @@ inline void mos6526_device::clock_ta()
// serial_output -
//-------------------------------------------------
-inline void mos6526_device::serial_output()
+void mos6526_device::serial_output()
{
if (m_ta_out && CRA_SPMODE)
{
@@ -438,7 +438,7 @@ inline void mos6526_device::serial_output()
// clock_tb - clock timer B
//-------------------------------------------------
-inline void mos6526_device::clock_tb()
+void mos6526_device::clock_tb()
{
if (m_count_b3)
{
@@ -472,7 +472,7 @@ inline void mos6526_device::clock_tb()
// update_interrupt -
//-------------------------------------------------
-inline void mos6526_device::update_interrupt()
+void mos6526_device::update_interrupt()
{
if (!m_irq && m_ir1)
{
@@ -498,7 +498,7 @@ inline void mos6526_device::update_interrupt()
// clock_pipeline - clock pipeline
//-------------------------------------------------
-inline void mos6526_device::clock_pipeline()
+void mos6526_device::clock_pipeline()
{
// timer A pipeline
m_count_a3 = m_count_a2;
@@ -556,7 +556,7 @@ inline void mos6526_device::clock_pipeline()
// synchronize -
//-------------------------------------------------
-inline void mos6526_device::synchronize()
+void mos6526_device::synchronize()
{
if (!m_pc)
{
@@ -642,9 +642,9 @@ void mos6526_device::device_start()
m_write_pb.resolve_safe();
// allocate timer
- if (m_tod_clock > 0)
+ if (m_tod_clock != 0)
{
- m_tod_timer = timer_alloc();
+ m_tod_timer = timer_alloc(FUNC(mos6526_device::advance_tod_clock), this);
m_tod_timer->adjust(attotime::from_hz(m_tod_clock), 0, attotime::from_hz(m_tod_clock));
}
@@ -758,11 +758,7 @@ void mos6526_device::device_reset()
}
-//-------------------------------------------------
-// device_timer - handler timer events
-//-------------------------------------------------
-
-void mos6526_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(mos6526_device::advance_tod_clock)
{
tod_w(1);
tod_w(0);
diff --git a/src/devices/machine/mos6526.h b/src/devices/machine/mos6526.h
index f86cf960461..1f515271537 100644
--- a/src/devices/machine/mos6526.h
+++ b/src/devices/machine/mos6526.h
@@ -113,28 +113,29 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void execute_run() override;
+ TIMER_CALLBACK_MEMBER(advance_tod_clock);
+
int m_icount;
const int m_variant;
int m_tod_clock;
- inline void update_interrupt();
- inline void update_pa();
- inline void update_pb();
- inline void set_cra(uint8_t data);
- inline void set_crb(uint8_t data);
- inline void serial_input();
- inline void serial_output();
- inline void clock_ta();
- inline void clock_tb();
- inline void clock_pipeline();
- inline uint8_t bcd_increment(uint8_t value);
- virtual inline void clock_tod();
- inline uint8_t read_tod(int offset);
- inline void write_tod(int offset, uint8_t data);
- inline void synchronize();
+ void update_interrupt();
+ void update_pa();
+ void update_pb();
+ void set_cra(uint8_t data);
+ void set_crb(uint8_t data);
+ void serial_input();
+ void serial_output();
+ void clock_ta();
+ void clock_tb();
+ void clock_pipeline();
+ uint8_t bcd_increment(uint8_t value);
+ virtual void clock_tod();
+ uint8_t read_tod(int offset);
+ void write_tod(int offset, uint8_t data);
+ void synchronize();
devcb_write_line m_write_irq;
devcb_write_line m_write_pc;
@@ -232,7 +233,7 @@ public:
void write(offs_t offset, uint8_t data);
protected:
- virtual inline void clock_tod() override;
+ virtual void clock_tod() override;
};
diff --git a/src/devices/machine/mos6530.cpp b/src/devices/machine/mos6530.cpp
index 45d2ec6cf29..3862b0699e8 100644
--- a/src/devices/machine/mos6530.cpp
+++ b/src/devices/machine/mos6530.cpp
@@ -66,7 +66,7 @@ void mos6530_device::device_start()
m_out_pb_cb.resolve_safe();
/* allocate timers */
- m_timer = timer_alloc(TIMER_END_CALLBACK);
+ m_timer = timer_alloc(FUNC(mos6530_device::end_state), this);
/* register for save states */
save_item(NAME(m_port[0].m_in));
@@ -153,36 +153,29 @@ uint8_t mos6530_device::get_timer()
***************************************************************************/
/*-------------------------------------------------
- timer_end_callback - callback to process the
- timer
+ end_state - callback to process the timer
-------------------------------------------------*/
-void mos6530_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(mos6530_device::end_state)
{
- switch (id)
- {
- // deferred reset
- case TIMER_END_CALLBACK:
- assert(m_timerstate != TIMER_IDLE);
+ assert(m_timerstate != TIMER_IDLE);
- /* if we finished counting, switch to the finishing state */
- if (m_timerstate == TIMER_COUNTING)
- {
- m_timerstate = TIMER_FINISHING;
- m_timer->adjust(attotime::from_ticks(256, m_clock));
+ /* if we finished counting, switch to the finishing state */
+ if (m_timerstate == TIMER_COUNTING)
+ {
+ m_timerstate = TIMER_FINISHING;
+ m_timer->adjust(attotime::from_ticks(256, m_clock));
- /* signal timer IRQ as well */
- m_irqstate |= TIMER_FLAG;
- update_irqstate();
- }
+ /* signal timer IRQ as well */
+ m_irqstate |= TIMER_FLAG;
+ update_irqstate();
+ }
- /* if we finished finishing, switch to the idle state */
- else if (m_timerstate == TIMER_FINISHING)
- {
- m_timerstate = TIMER_IDLE;
- m_timer->adjust(attotime::never);
- }
- break;
+ /* if we finished finishing, switch to the idle state */
+ else if (m_timerstate == TIMER_FINISHING)
+ {
+ m_timerstate = TIMER_IDLE;
+ m_timer->adjust(attotime::never);
}
}
diff --git a/src/devices/machine/mos6530.h b/src/devices/machine/mos6530.h
index f6385a32ec6..25e11a38f97 100644
--- a/src/devices/machine/mos6530.h
+++ b/src/devices/machine/mos6530.h
@@ -66,14 +66,10 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-private:
- enum
- {
- TIMER_END_CALLBACK
- };
+ TIMER_CALLBACK_MEMBER(end_state);
+private:
struct mos6530_port
{
uint8_t m_in;
diff --git a/src/devices/machine/mos6530n.cpp b/src/devices/machine/mos6530n.cpp
index 384b35375a8..aeaef720af5 100644
--- a/src/devices/machine/mos6530n.cpp
+++ b/src/devices/machine/mos6530n.cpp
@@ -184,7 +184,7 @@ void mos6530_device_base::device_start()
m_out_pb_cb.resolve_all_safe();
// allocate timer
- t_gen = timer_alloc(0);
+ t_gen = timer_alloc(FUNC(mos6530_device_base::update), this);
// state saving
save_item(NAME(m_pa_in));
@@ -239,10 +239,10 @@ void mos6530_device_base::device_reset()
//-------------------------------------------------
-// device_timer - handler timer events
+// update - update the current device state
//-------------------------------------------------
-void mos6530_device_base::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(mos6530_device_base::update)
{
live_sync();
live_run();
diff --git a/src/devices/machine/mos6530n.h b/src/devices/machine/mos6530n.h
index ee246e1eb69..0f1aa96a05e 100644
--- a/src/devices/machine/mos6530n.h
+++ b/src/devices/machine/mos6530n.h
@@ -101,7 +101,8 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(update);
enum
{
diff --git a/src/devices/machine/mpu401.cpp b/src/devices/machine/mpu401.cpp
index e4099571fc4..e2959a432a9 100644
--- a/src/devices/machine/mpu401.cpp
+++ b/src/devices/machine/mpu401.cpp
@@ -127,7 +127,7 @@ mpu401_device::mpu401_device(const machine_config &mconfig, const char *tag, dev
void mpu401_device::device_start()
{
write_irq.resolve_safe();
- m_timer = timer_alloc(0);
+ m_timer = timer_alloc(FUNC(mpu401_device::serial_tick), this);
}
//-------------------------------------------------
@@ -145,10 +145,10 @@ void mpu401_device::device_reset()
}
//-------------------------------------------------
-// device_timer - called when our device timer expires
+// serial_tick - update the 6801's serial clock
//-------------------------------------------------
-void mpu401_device::device_timer(emu_timer &timer, device_timer_id tid, int param)
+TIMER_CALLBACK_MEMBER(mpu401_device::serial_tick)
{
m_ourcpu->m6801_clock_serial();
}
diff --git a/src/devices/machine/mpu401.h b/src/devices/machine/mpu401.h
index e2a0cd5cdab..a76cc53dcdd 100644
--- a/src/devices/machine/mpu401.h
+++ b/src/devices/machine/mpu401.h
@@ -28,9 +28,10 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual const tiny_rom_entry *device_rom_region() const override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_add_mconfig(machine_config &config) override;
+ TIMER_CALLBACK_MEMBER(serial_tick);
+
private:
void midi_rx_w(int state);
diff --git a/src/devices/machine/msm5832.cpp b/src/devices/machine/msm5832.cpp
index 5459fd77fc6..65db2dda469 100644
--- a/src/devices/machine/msm5832.cpp
+++ b/src/devices/machine/msm5832.cpp
@@ -110,7 +110,7 @@ msm5832_device::msm5832_device(const machine_config &mconfig, const char *tag, d
void msm5832_device::device_start()
{
// allocate timers
- m_clock_timer = timer_alloc(TIMER_CLOCK);
+ m_clock_timer = timer_alloc(FUNC(msm5832_device::clock_tick), this);
m_clock_timer->adjust(attotime::from_hz(clock() / 32768), 0, attotime::from_hz(clock() / 32768));
// state saving
@@ -125,19 +125,14 @@ void msm5832_device::device_start()
//-------------------------------------------------
-// device_timer - handler timer events
+// clock_tick - advance the RTC if enabled
//-------------------------------------------------
-void msm5832_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(msm5832_device::clock_tick)
{
- switch (id)
+ if (!m_hold)
{
- case TIMER_CLOCK:
- if (!m_hold)
- {
- advance_seconds();
- }
- break;
+ advance_seconds();
}
}
diff --git a/src/devices/machine/msm5832.h b/src/devices/machine/msm5832.h
index 82988d5b023..2e55dc21b97 100644
--- a/src/devices/machine/msm5832.h
+++ b/src/devices/machine/msm5832.h
@@ -56,14 +56,13 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_rtc_interface overrides
virtual void rtc_clock_updated(int year, int month, int day, int day_of_week, int hour, int minute, int second) override;
-private:
- static constexpr device_timer_id TIMER_CLOCK = 0;
+ TIMER_CALLBACK_MEMBER(clock_tick);
+private:
inline int read_counter(int counter);
inline void write_counter(int counter, int value);
diff --git a/src/devices/machine/msm58321.cpp b/src/devices/machine/msm58321.cpp
index 9dc1f8df642..72aa2b09d33 100644
--- a/src/devices/machine/msm58321.cpp
+++ b/src/devices/machine/msm58321.cpp
@@ -209,15 +209,15 @@ void msm58321_device::device_start()
m_busy_handler.resolve_safe();
// allocate timers
- m_clock_timer = timer_alloc(TIMER_CLOCK);
+ m_clock_timer = timer_alloc(FUNC(msm58321_device::clock_tick), this);
m_clock_timer->adjust(clocks_to_attotime(32768/1024), 0, clocks_to_attotime(32768/1024));
// busy signal active period is approximately 427 µs
- m_busy_timer = timer_alloc(TIMER_BUSY);
+ m_busy_timer = timer_alloc(FUNC(msm58321_device::release_busy), this);
m_busy_timer->adjust(clocks_to_attotime(32768 - 14), 0, clocks_to_attotime(32768));
// standard signal active period is approximately 122 µs
- m_standard_timer = timer_alloc(TIMER_STANDARD);
+ m_standard_timer = timer_alloc(FUNC(msm58321_device::assert_standard), this);
m_standard_timer->adjust(clocks_to_attotime(32768-4), 0, clocks_to_attotime(32768));
// state saving
@@ -244,56 +244,59 @@ void msm58321_device::device_start()
//-------------------------------------------------
-// device_timer - handler timer events
+// clock_tick - advance the RTC
//-------------------------------------------------
-void msm58321_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(msm58321_device::clock_tick)
{
- switch (id)
+ if (m_khz_ctr & 1)
{
- case TIMER_CLOCK:
+ m_reg[REGISTER_REF0] |= 1;
+ m_reg[REGISTER_REF1] |= 1;
+ }
+ else
+ {
+ m_reg[REGISTER_REF0] &= ~1;
+ m_reg[REGISTER_REF1] &= ~1;
+ }
- if (m_khz_ctr & 1)
+ if (++m_khz_ctr >= 1024)
+ {
+ m_khz_ctr = 0;
+ if (!m_stop)
{
- m_reg[REGISTER_REF0] |= 1;
- m_reg[REGISTER_REF1] |= 1;
+ advance_seconds();
}
- else
+
+ if (!m_busy)
{
- m_reg[REGISTER_REF0] &= ~1;
- m_reg[REGISTER_REF1] &= ~1;
+ m_busy = 1;
+ m_busy_handler(m_busy);
}
+ }
+}
- if (++m_khz_ctr >= 1024)
- {
- m_khz_ctr = 0;
- if (!m_stop)
- {
- advance_seconds();
- }
- if (!m_busy)
- {
- m_busy = 1;
- m_busy_handler(m_busy);
- }
- }
- break;
+//-------------------------------------------------
+// release_busy - release the 'busy' line after
+// an appropriate amount of time
+//-------------------------------------------------
- case TIMER_BUSY:
- if (!m_cs1 || !m_cs2 || !m_write || m_address != REGISTER_RESET)
- {
- m_busy = 0;
- m_busy_handler(m_busy);
- }
- break;
- case TIMER_STANDARD:
- m_reg[REGISTER_REF0] = 0x0e;
- m_reg[REGISTER_REF1] = 0x0e;
- break;
+TIMER_CALLBACK_MEMBER(msm58321_device::release_busy)
+{
+ if (!m_cs1 || !m_cs2 || !m_write || m_address != REGISTER_RESET)
+ {
+ m_busy = 0;
+ m_busy_handler(m_busy);
}
}
+TIMER_CALLBACK_MEMBER(msm58321_device::assert_standard)
+{
+ m_reg[REGISTER_REF0] = 0x0e;
+ m_reg[REGISTER_REF1] = 0x0e;
+}
+
void msm58321_device::update_standard()
{
uint8_t reg = 0;
diff --git a/src/devices/machine/msm58321.h b/src/devices/machine/msm58321.h
index 323e2e9daa2..6f28b05eecf 100644
--- a/src/devices/machine/msm58321.h
+++ b/src/devices/machine/msm58321.h
@@ -73,7 +73,6 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_rtc_interface overrides
virtual void rtc_clock_updated(int year, int month, int day, int day_of_week, int hour, int minute, int second) override;
@@ -85,11 +84,11 @@ protected:
virtual bool nvram_write(util::write_stream &file) override;
virtual bool rtc_feature_leap_year() const override { return true; }
-private:
- static constexpr device_timer_id TIMER_CLOCK = 0;
- static constexpr device_timer_id TIMER_BUSY = 1;
- static constexpr device_timer_id TIMER_STANDARD = 2;
+ TIMER_CALLBACK_MEMBER(clock_tick);
+ TIMER_CALLBACK_MEMBER(release_busy);
+ TIMER_CALLBACK_MEMBER(assert_standard);
+private:
void update_input();
void update_output();
void update_standard();
diff --git a/src/devices/machine/msm6242.cpp b/src/devices/machine/msm6242.cpp
index 14f206d15c7..c7beb22694a 100644
--- a/src/devices/machine/msm6242.cpp
+++ b/src/devices/machine/msm6242.cpp
@@ -100,7 +100,7 @@ void msm6242_device::device_start()
m_out_int_handler.resolve();
// let's call the timer callback every tick
- m_timer = timer_alloc(TIMER_RTC_CALLBACK);
+ m_timer = timer_alloc(FUNC(msm6242_device::rtc_timer_callback), this);
m_timer->adjust(attotime::zero);
// set up registers
@@ -164,22 +164,6 @@ void msm6242_device::device_post_load()
//-------------------------------------------------
-// device_timer - called whenever a device timer
-// fires
-//-------------------------------------------------
-
-void msm6242_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch(id)
- {
- case TIMER_RTC_CALLBACK:
- rtc_timer_callback();
- break;
- }
-}
-
-
-//-------------------------------------------------
// set_irq - set the IRQ flag and output
//-------------------------------------------------
@@ -377,7 +361,7 @@ void msm6242_device::rtc_clock_updated(int year, int month, int day, int day_of_
// rtc_timer_callback
//-------------------------------------------------
-void msm6242_device::rtc_timer_callback()
+TIMER_CALLBACK_MEMBER(msm6242_device::rtc_timer_callback)
{
update_rtc_registers();
update_timer();
diff --git a/src/devices/machine/msm6242.h b/src/devices/machine/msm6242.h
index 17afe8794d2..427a2337d24 100644
--- a/src/devices/machine/msm6242.h
+++ b/src/devices/machine/msm6242.h
@@ -62,7 +62,6 @@ protected:
virtual void device_reset() override;
virtual void device_pre_save() override;
virtual void device_post_load() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// rtc overrides
virtual void rtc_clock_updated(int year, int month, int day, int day_of_week, int hour, int minute, int second) override;
@@ -87,7 +86,7 @@ private:
u64 m_last_update_time; // last update time, in clock cycles
// methods
- void rtc_timer_callback();
+ TIMER_CALLBACK_MEMBER(rtc_timer_callback);
u64 current_time();
void set_irq(bool active);
void irq(u8 irq_type);
diff --git a/src/devices/machine/myb3k_kbd.cpp b/src/devices/machine/myb3k_kbd.cpp
index 9fb46201fd2..768ae3bda91 100644
--- a/src/devices/machine/myb3k_kbd.cpp
+++ b/src/devices/machine/myb3k_kbd.cpp
@@ -124,7 +124,6 @@
#include "emu.h"
#include "myb3k_kbd.h"
-//#define LOG_GENERAL (1U << 0) //defined in logmacro.h already
#define LOG_MOD (1U << 1)
#define LOG_BYTES (1U << 2)
@@ -356,13 +355,16 @@ ioport_constructor myb3k_keyboard_device::device_input_ports() const
void myb3k_keyboard_device::device_start()
{
m_keyboard_cb.resolve();
+ m_scan_timer = timer_alloc(FUNC(myb3k_keyboard_device::scan_keys), this);
+ m_first_byte_timer = timer_alloc(FUNC(myb3k_keyboard_device::send_first_byte), this);
+ m_second_byte_timer = timer_alloc(FUNC(myb3k_keyboard_device::send_second_byte), this);
}
void myb3k_keyboard_device::device_reset()
{
m_modifier_keys = 0;
memset(m_io_kbd_state, 0, sizeof(m_io_kbd_state));
- timer_set(attotime::from_msec(100), TIMER_ID_SCAN_KEYS);
+ m_scan_timer->adjust(attotime::from_msec(100));
m_modifier_keys = 0;
}
@@ -391,7 +393,7 @@ void myb3k_keyboard_device::key_changed(int x, int y, bool pressed)
(y & 0x7);
}
-void myb3k_keyboard_device::scan_keys()
+TIMER_CALLBACK_MEMBER(myb3k_keyboard_device::scan_keys)
{
// Iterate over all columns (m_x)
// and for each column iterate over all rows (m_y)
@@ -408,7 +410,7 @@ void myb3k_keyboard_device::scan_keys()
update_modifiers(m_y, bit);
}
- timer_set(attotime::from_msec(3), TIMER_ID_FIRST_BYTE);
+ m_first_byte_timer->adjust(attotime::from_msec(3));
wait_for_timer = true;
}
@@ -420,7 +422,7 @@ void myb3k_keyboard_device::scan_keys()
m_y = 0;
// Done scanning the matrix. Now sleep for a while,
// then start scanning again. Scan ~50 times per second.
- timer_set(attotime::from_msec(20), TIMER_ID_SCAN_KEYS);
+ m_scan_timer->adjust(attotime::from_msec(20));
wait_for_timer = true;
// (The final switch x=11 y=7 is not electrically connected.
// Thus if we get here, then there can be no key changed
@@ -456,31 +458,24 @@ void myb3k_keyboard_device::update_modifiers(int y, bool down)
m_modifier_keys = (m_modifier_keys & mask) | (down?bit:0);
}
-void myb3k_keyboard_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(myb3k_keyboard_device::send_first_byte)
{
- switch (id)
- {
- case TIMER_ID_SCAN_KEYS:
- scan_keys();
- break;
+ LOGBYTES("FIRST_BYTE %02x %s (with modifiers %s%s%s%s%s)\n", m_first_byte,
+ (m_first_byte&MYB3K_KEY_ON)?"Pressed":"Released",
+ (m_first_byte&MYB3K_KEY_CTRL)?"CTRL ":"",
+ (m_first_byte&MYB3K_KEY_GRAPH)?"GRAPH ":"",
+ (m_first_byte&MYB3K_KEY_LSHIFT)?"LSHIFT ":"",
+ (m_first_byte&MYB3K_KEY_RSHIFT)?"RSHIFT ":"",
+ (m_first_byte&MYB3K_KEY_CAP)?"CAP ":"");
+ send_byte(m_first_byte);
+ m_second_byte_timer->adjust(attotime::from_msec(3));
+}
- case TIMER_ID_FIRST_BYTE:
- LOGBYTES("FIRST_BYTE %02x %s (with modifiers %s%s%s%s%s)\n", m_first_byte,
- (m_first_byte&MYB3K_KEY_ON)?"Pressed":"Released",
- (m_first_byte&MYB3K_KEY_CTRL)?"CTRL ":"",
- (m_first_byte&MYB3K_KEY_GRAPH)?"GRAPH ":"",
- (m_first_byte&MYB3K_KEY_LSHIFT)?"LSHIFT ":"",
- (m_first_byte&MYB3K_KEY_RSHIFT)?"RSHIFT ":"",
- (m_first_byte&MYB3K_KEY_CAP)?"CAP ":"");
- send_byte(m_first_byte);
- timer_set(attotime::from_msec(3), TIMER_ID_SECOND_BYTE);
- break;
- case TIMER_ID_SECOND_BYTE:
- LOGBYTES("SECOND_BYTE %02x x=%d y=%d \n\n\n", m_second_byte, (m_second_byte >> 3)&0xf, (m_second_byte)&0x7);
- send_byte(m_second_byte);
- timer_set(attotime::from_msec(10), TIMER_ID_SCAN_KEYS);
- break;
- }
+TIMER_CALLBACK_MEMBER(myb3k_keyboard_device::send_second_byte)
+{
+ LOGBYTES("SECOND_BYTE %02x x=%d y=%d \n\n\n", m_second_byte, (m_second_byte >> 3)&0xf, (m_second_byte)&0x7);
+ send_byte(m_second_byte);
+ m_scan_timer->adjust(attotime::from_msec(10));
}
stepone_keyboard_device::stepone_keyboard_device(
diff --git a/src/devices/machine/myb3k_kbd.h b/src/devices/machine/myb3k_kbd.h
index 752c8e32546..fa8f6570640 100644
--- a/src/devices/machine/myb3k_kbd.h
+++ b/src/devices/machine/myb3k_kbd.h
@@ -36,13 +36,6 @@ public:
device_t *owner,
u32 clock);
- enum
- {
- TIMER_ID_SCAN_KEYS,
- TIMER_ID_FIRST_BYTE,
- TIMER_ID_SECOND_BYTE
- };
-
template <typename... T>
void set_keyboard_callback(T &&... args)
{
@@ -61,15 +54,21 @@ protected:
virtual void device_reset() override;
virtual void send_byte(u8 code);
void key_changed(int x, int y, bool down);
- void scan_keys();
void update_modifiers(int y, bool down);
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(scan_keys);
+ TIMER_CALLBACK_MEMBER(send_first_byte);
+ TIMER_CALLBACK_MEMBER(send_second_byte);
output_delegate m_keyboard_cb;
required_ioport_array<12> m_io_kbd_t;
u8 m_io_kbd_state[12][8];
- int m_x, m_y;
+ emu_timer *m_scan_timer;
+ emu_timer *m_first_byte_timer;
+ emu_timer *m_second_byte_timer;
+ int m_x;
+ int m_y;
u8 m_first_byte;
u8 m_second_byte;
u8 m_modifier_keys;
diff --git a/src/devices/machine/ncr5380.cpp b/src/devices/machine/ncr5380.cpp
index 9eeafad0587..96a1c549bf7 100644
--- a/src/devices/machine/ncr5380.cpp
+++ b/src/devices/machine/ncr5380.cpp
@@ -72,7 +72,7 @@ void ncr5380_device::device_start()
m_irq_handler.resolve_safe();
m_drq_handler.resolve_safe();
- m_state_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ncr5380_device::state_timer), this));
+ m_state_timer = timer_alloc(FUNC(ncr5380_device::state_timer), this);
save_item(NAME(m_state));
diff --git a/src/devices/machine/ncr5390.cpp b/src/devices/machine/ncr5390.cpp
index c9f55ad655e..7a52d237982 100644
--- a/src/devices/machine/ncr5390.cpp
+++ b/src/devices/machine/ncr5390.cpp
@@ -199,7 +199,7 @@ void ncr5390_device::device_start()
config = 0;
bus_id = 0;
select_timeout = 0;
- tm = timer_alloc(0);
+ tm = timer_alloc(FUNC(ncr5390_device::update_tick), this);
}
void ncr5390_device::device_reset()
@@ -251,7 +251,7 @@ void ncr5390_device::scsi_ctrl_changed()
step(false);
}
-void ncr5390_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(ncr5390_device::update_tick)
{
step(true);
}
diff --git a/src/devices/machine/ncr5390.h b/src/devices/machine/ncr5390.h
index 98a4cb40701..ba38e1b52cf 100644
--- a/src/devices/machine/ncr5390.h
+++ b/src/devices/machine/ncr5390.h
@@ -52,7 +52,8 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(update_tick);
enum { MODE_D, MODE_T, MODE_I };
enum { IDLE };
diff --git a/src/devices/machine/ncr539x.cpp b/src/devices/machine/ncr539x.cpp
index 90b2e6bb8ec..67cfdadae76 100644
--- a/src/devices/machine/ncr539x.cpp
+++ b/src/devices/machine/ncr539x.cpp
@@ -137,7 +137,7 @@ void ncr539x_device::device_start()
m_out_irq_cb.resolve_safe();
m_out_drq_cb.resolve_safe();
- m_operation_timer = timer_alloc(0);
+ m_operation_timer = timer_alloc(FUNC(ncr539x_device::execute_operation), this);
}
//-------------------------------------------------
@@ -177,107 +177,99 @@ void ncr539x_device::dma_write_data(int bytes, uint8_t *pData)
write_data(pData, bytes);
}
-void ncr539x_device::device_timer(emu_timer &timer, device_timer_id tid, int param)
+TIMER_CALLBACK_MEMBER(ncr539x_device::execute_operation)
{
- //printf("539X: device_timer expired, param = %d, m_command = %02x\n", param, m_command);
+ //printf("539X: m_operation_timer expired, param = %d, m_command = %02x\n", param, m_command);
- switch (param)
+ // if this is a DMA command, raise DRQ now
+ if (m_command & 0x80)
{
- case TIMER_539X_COMMAND:
- // if this is a DMA command, raise DRQ now
- if (m_command & 0x80)
- {
- m_out_drq_cb(ASSERT_LINE);
- }
+ m_out_drq_cb(ASSERT_LINE);
+ }
- switch (m_command & 0x7f)
+ switch (m_command & 0x7f)
+ {
+ case 0x41: // select without ATN steps
+ if (select(m_last_id))
{
- case 0x41: // select without ATN steps
- if (select(m_last_id))
- {
- m_irq_status |= IRQ_STATUS_SERVICE_REQUEST | IRQ_STATUS_SUCCESS;
- // we should now be in the command phase
- m_status &= ~7; // clear bus phases
- m_status |= MAIN_STATUS_INTERRUPT | SCSI_PHASE_COMMAND;
- m_fifo_ptr = 0;
- m_selected = true;
-
- LOG("Selecting w/o ATN, irq_status = %02x, status = %02x!\n", m_irq_status, m_status);
-
- // if DMA is not enabled, there should already be a command loaded into the FIFO
- if (!(m_command & 0x80))
- {
- exec_fifo();
- }
- update_fifo_internal_state(0);
- }
- else
- {
- LOG("Select failed, no device @ ID %d!\n", m_last_id);
- m_status |= MAIN_STATUS_INTERRUPT;
- m_irq_status |= IRQ_STATUS_DISCONNECTED;
- }
- m_out_irq_cb(ASSERT_LINE);
- break;
+ m_irq_status |= IRQ_STATUS_SERVICE_REQUEST | IRQ_STATUS_SUCCESS;
+ // we should now be in the command phase
+ m_status &= ~7; // clear bus phases
+ m_status |= MAIN_STATUS_INTERRUPT | SCSI_PHASE_COMMAND;
+ m_fifo_ptr = 0;
+ m_selected = true;
- case 0x42: // Select with ATN steps
- if (select(m_last_id))
- {
- m_irq_status |= IRQ_STATUS_SERVICE_REQUEST | IRQ_STATUS_SUCCESS;
- // we should now be in the command phase
- m_status &= ~7; // clear bus phases
- m_status |= MAIN_STATUS_INTERRUPT | SCSI_PHASE_COMMAND;
- m_fifo_ptr = 0;
- m_selected = true;
- LOG("Selecting with ATN, irq_status = %02x, status = %02x!\n", m_irq_status, m_status);
+ LOG("Selecting w/o ATN, irq_status = %02x, status = %02x!\n", m_irq_status, m_status);
- // if DMA is not enabled, there should already be a command loaded into the FIFO
- if (!(m_command & 0x80))
- {
- exec_fifo();
- }
- update_fifo_internal_state(0);
- }
- else
- {
- LOG("Select failed, no device @ ID %d!\n", m_last_id);
- m_status |= MAIN_STATUS_INTERRUPT;
- m_irq_status |= IRQ_STATUS_DISCONNECTED;
- }
- m_out_irq_cb(ASSERT_LINE);
- break;
+ // if DMA is not enabled, there should already be a command loaded into the FIFO
+ if (!(m_command & 0x80))
+ {
+ exec_fifo();
+ }
+ update_fifo_internal_state(0);
+ }
+ else
+ {
+ LOG("Select failed, no device @ ID %d!\n", m_last_id);
+ m_status |= MAIN_STATUS_INTERRUPT;
+ m_irq_status |= IRQ_STATUS_DISCONNECTED;
+ }
+ m_out_irq_cb(ASSERT_LINE);
+ break;
- case 0x11: // initiator command complete
- LOG("Initiator command complete\n");
- m_irq_status = IRQ_STATUS_SERVICE_REQUEST;
- m_status &= ~7; // clear phase bits
- m_status |= MAIN_STATUS_INTERRUPT | SCSI_PHASE_DATAIN; // go to data in phase (?)
- m_out_irq_cb(ASSERT_LINE);
+ case 0x42: // Select with ATN steps
+ if (select(m_last_id))
+ {
+ m_irq_status |= IRQ_STATUS_SERVICE_REQUEST | IRQ_STATUS_SUCCESS;
+ // we should now be in the command phase
+ m_status &= ~7; // clear bus phases
+ m_status |= MAIN_STATUS_INTERRUPT | SCSI_PHASE_COMMAND;
+ m_fifo_ptr = 0;
+ m_selected = true;
+ LOG("Selecting with ATN, irq_status = %02x, status = %02x!\n", m_irq_status, m_status);
+
+ // if DMA is not enabled, there should already be a command loaded into the FIFO
+ if (!(m_command & 0x80))
+ {
+ exec_fifo();
+ }
+ update_fifo_internal_state(0);
+ }
+ else
+ {
+ LOG("Select failed, no device @ ID %d!\n", m_last_id);
+ m_status |= MAIN_STATUS_INTERRUPT;
+ m_irq_status |= IRQ_STATUS_DISCONNECTED;
+ }
+ m_out_irq_cb(ASSERT_LINE);
+ break;
- // this puts status and message bytes into the FIFO (todo: what are these?)
- m_fifo_ptr = 0;
- m_xfer_count = 2;
- m_buffer_remaining = m_total_data = 0;
- m_fifo[0] = 0; // status byte
- m_fifo[1] = 0; // message byte
- m_selected = false;
- update_fifo_internal_state(2);
- break;
+ case 0x11: // initiator command complete
+ LOG("Initiator command complete\n");
+ m_irq_status = IRQ_STATUS_SERVICE_REQUEST;
+ m_status &= ~7; // clear phase bits
+ m_status |= MAIN_STATUS_INTERRUPT | SCSI_PHASE_DATAIN; // go to data in phase (?)
+ m_out_irq_cb(ASSERT_LINE);
- case 0x12: // message accepted
- LOG("Message accepted\n");
- m_irq_status = IRQ_STATUS_SERVICE_REQUEST;
- m_status |= MAIN_STATUS_INTERRUPT;
- m_out_irq_cb(ASSERT_LINE);
- break;
+ // this puts status and message bytes into the FIFO (todo: what are these?)
+ m_fifo_ptr = 0;
+ m_xfer_count = 2;
+ m_buffer_remaining = m_total_data = 0;
+ m_fifo[0] = 0; // status byte
+ m_fifo[1] = 0; // message byte
+ m_selected = false;
+ update_fifo_internal_state(2);
+ break;
- default:
- fatalerror("539x: Unhandled command %02x\n", m_command);
- }
+ case 0x12: // message accepted
+ LOG("Message accepted\n");
+ m_irq_status = IRQ_STATUS_SERVICE_REQUEST;
+ m_status |= MAIN_STATUS_INTERRUPT;
+ m_out_irq_cb(ASSERT_LINE);
break;
default:
- break;
+ fatalerror("539x: Unhandled command %02x\n", m_command);
}
}
@@ -614,11 +606,11 @@ void ncr539x_device::write(offs_t offset, uint8_t data)
// 1x commands happen much faster
if ((m_command & 0x70) == 0x10)
{
- m_operation_timer->adjust(attotime::from_hz(65536), TIMER_539X_COMMAND);
+ m_operation_timer->adjust(attotime::from_hz(65536));
}
else
{
- m_operation_timer->adjust(attotime::from_hz(16384), TIMER_539X_COMMAND);
+ m_operation_timer->adjust(attotime::from_hz(16384));
}
break;
}
diff --git a/src/devices/machine/ncr539x.h b/src/devices/machine/ncr539x.h
index 62fd58a8e47..9ba24b3ba47 100644
--- a/src/devices/machine/ncr539x.h
+++ b/src/devices/machine/ncr539x.h
@@ -35,7 +35,8 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(execute_operation);
private:
void fifo_write(uint8_t data);
diff --git a/src/devices/machine/netlist.cpp b/src/devices/machine/netlist.cpp
index 536d97367b9..973a5f2cb25 100644
--- a/src/devices/machine/netlist.cpp
+++ b/src/devices/machine/netlist.cpp
@@ -343,18 +343,18 @@ void netlist_mame_device::register_memregion_source(netlist::nlparse_t &parser,
void netlist_mame_analog_input_device::write(const double val)
{
- m_value_for_device_timer = val * m_mult + m_offset;
- if (m_value_for_device_timer != (*m_param)())
+ m_value_to_sync = val * m_mult + m_offset;
+ if (m_value_to_sync != (*m_param)())
{
- synchronize();
+ machine().scheduler().synchronize(timer_expired_delegate(FUNC(netlist_mame_analog_input_device::sync_callback), this));
}
}
-void netlist_mame_analog_input_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(netlist_mame_analog_input_device::sync_callback)
{
update_to_current_time();
- nl_owner().log_csv().log_add(m_param_name, m_value_for_device_timer, true);
- m_param->set(m_value_for_device_timer);
+ nl_owner().log_csv().log_add(m_param_name, m_value_to_sync, true);
+ m_param->set(m_value_to_sync);
}
void netlist_mame_int_input_device::write(const uint32_t val)
@@ -363,7 +363,7 @@ void netlist_mame_int_input_device::write(const uint32_t val)
if (v != (*m_param)())
{
LOGDEBUG("write %s\n", this->tag());
- synchronize(0, v);
+ machine().scheduler().synchronize(timer_expired_delegate(FUNC(netlist_mame_int_input_device::sync_callback), this), v);
}
}
@@ -373,25 +373,25 @@ void netlist_mame_logic_input_device::write(const uint32_t val)
if (v != (*m_param)())
{
LOGDEBUG("write %s\n", this->tag());
- synchronize(0, v);
+ machine().scheduler().synchronize(timer_expired_delegate(FUNC(netlist_mame_logic_input_device::sync_callback), this), v);
}
}
-void netlist_mame_int_input_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(netlist_mame_int_input_device::sync_callback)
{
update_to_current_time();
nl_owner().log_csv().log_add(m_param_name, param, false);
m_param->set(param);
}
-void netlist_mame_logic_input_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(netlist_mame_logic_input_device::sync_callback)
{
update_to_current_time();
nl_owner().log_csv().log_add(m_param_name, param, false);
m_param->set(param);
}
-void netlist_mame_ram_pointer_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(netlist_mame_ram_pointer_device::sync_callback)
{
m_data = (*m_param)();
}
@@ -432,7 +432,7 @@ netlist_mame_analog_input_device::netlist_mame_analog_input_device(const machine
, m_param(nullptr)
, m_auto_port(true)
, m_param_name(param_name)
- , m_value_for_device_timer(0)
+ , m_value_to_sync(0)
{
}
@@ -442,7 +442,7 @@ netlist_mame_analog_input_device::netlist_mame_analog_input_device(const machine
, m_param(nullptr)
, m_auto_port(true)
, m_param_name("")
- , m_value_for_device_timer(0)
+ , m_value_to_sync(0)
{
}
diff --git a/src/devices/machine/netlist.h b/src/devices/machine/netlist.h
index f14095deaab..dc1f651e1c4 100644
--- a/src/devices/machine/netlist.h
+++ b/src/devices/machine/netlist.h
@@ -407,13 +407,14 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(sync_callback);
private:
netlist::param_num_t<netlist::nl_fptype> *m_param;
bool m_auto_port;
const char *m_param_name;
- double m_value_for_device_timer;
+ double m_value_to_sync;
};
// ----------------------------------------------------------------------------------------
@@ -507,7 +508,8 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(sync_callback);
private:
netlist::param_num_t<int> *m_param;
@@ -548,7 +550,8 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(sync_callback);
private:
netlist::param_num_t<bool> *m_param;
@@ -576,7 +579,8 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(sync_callback);
private:
netlist::param_ptr_t *m_param;
diff --git a/src/devices/machine/ns32081.cpp b/src/devices/machine/ns32081.cpp
index 39bd7a80aae..c158a7e8942 100644
--- a/src/devices/machine/ns32081.cpp
+++ b/src/devices/machine/ns32081.cpp
@@ -102,7 +102,7 @@ void ns32081_device::device_start()
save_item(NAME(m_state));
save_item(NAME(m_tcy));
- m_complete = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ns32081_device::complete), this));
+ m_complete = timer_alloc(FUNC(ns32081_device::complete), this);
}
void ns32081_device::device_reset()
diff --git a/src/devices/machine/ns32202.cpp b/src/devices/machine/ns32202.cpp
index 14dae99c348..ba97c22ab06 100644
--- a/src/devices/machine/ns32202.cpp
+++ b/src/devices/machine/ns32202.cpp
@@ -103,9 +103,9 @@ void ns32202_device::device_start()
save_item(NAME(m_out_int_state));
save_item(NAME(m_out_cout_state));
- m_interrupt = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ns32202_device::interrupt), this));
- m_counter[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ns32202_device::counter<0>), this));
- m_counter[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ns32202_device::counter<1>), this));
+ m_interrupt = timer_alloc(FUNC(ns32202_device::interrupt), this);
+ m_counter[0] = timer_alloc(FUNC(ns32202_device::counter<0>), this);
+ m_counter[1] = timer_alloc(FUNC(ns32202_device::counter<1>), this);
}
void ns32202_device::device_reset()
diff --git a/src/devices/machine/nsc810.cpp b/src/devices/machine/nsc810.cpp
index c077a86eff1..a416e6ccca4 100644
--- a/src/devices/machine/nsc810.cpp
+++ b/src/devices/machine/nsc810.cpp
@@ -29,12 +29,6 @@ nsc810_device::nsc810_device(const machine_config &mconfig, const char *tag, dev
m_portA_latch(0), m_portB_latch(0), m_portC_latch(0),
m_ddrA(0), m_ddrB(0), m_ddrC(0),
m_mode(0),
- m_timer0(nullptr), m_timer1(nullptr),
- m_timer0_mode(0), m_timer1_mode(0),
- m_timer0_counter(0), m_timer1_counter(0),
- m_timer0_base(0), m_timer1_base(0),
- m_timer0_running(false), m_timer1_running(false),
- m_timer0_clock(0), m_timer1_clock(0),
m_ramselect(false),
m_portA_r(*this),
m_portB_r(*this),
@@ -42,9 +36,14 @@ nsc810_device::nsc810_device(const machine_config &mconfig, const char *tag, dev
m_portA_w(*this),
m_portB_w(*this),
m_portC_w(*this),
- m_timer0_out(*this),
- m_timer1_out(*this)
+ m_timer_out(*this)
{
+ std::fill(std::begin(m_timer), std::end(m_timer), nullptr);
+ std::fill(std::begin(m_timer_mode), std::end(m_timer_mode), 0);
+ std::fill(std::begin(m_timer_counter), std::end(m_timer_counter), 0);
+ std::fill(std::begin(m_timer_base), std::end(m_timer_base), 0);
+ std::fill(std::begin(m_timer_running), std::end(m_timer_running), false);
+ std::fill(std::begin(m_timer_clock), std::end(m_timer_clock), 0);
}
void nsc810_device::device_start()
@@ -55,17 +54,16 @@ void nsc810_device::device_start()
m_portA_w.resolve_safe();
m_portB_w.resolve_safe();
m_portC_w.resolve_safe();
- m_timer0_out.resolve_safe();
- m_timer1_out.resolve_safe();
+ m_timer_out.resolve_all_safe();
m_portA_w(0);
m_portB_w(0);
m_portC_w(0);
- m_timer0_out(0);
- m_timer1_out(0);
+ m_timer_out[0](0);
+ m_timer_out[1](0);
- m_timer0 = timer_alloc(TIMER0_CLOCK);
- m_timer1 = timer_alloc(TIMER1_CLOCK);
+ m_timer[0] = timer_alloc(FUNC(nsc810_device::timer_tick<0>), this);
+ m_timer[1] = timer_alloc(FUNC(nsc810_device::timer_tick<1>), this);
}
void nsc810_device::device_reset()
@@ -77,43 +75,27 @@ void nsc810_device::device_reset()
m_ddrB = 0;
m_ddrC = 0;
m_mode = 0;
- m_timer0_mode = 0;
- m_timer1_mode = 0;
- m_timer0_counter = 0;
- m_timer1_counter = 0;
- m_timer0_running = false;
- m_timer1_running = false;
+ m_timer_mode[0] = 0;
+ m_timer_mode[1] = 0;
+ m_timer_counter[0] = 0;
+ m_timer_counter[1] = 0;
+ m_timer_running[0] = false;
+ m_timer_running[1] = false;
m_ramselect = false;
}
-void nsc810_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+template <int Timer>
+TIMER_CALLBACK_MEMBER(nsc810_device::timer_tick)
{
- switch(id)
+ m_timer_counter[Timer]--;
+ if ((m_timer_mode[Timer] & 0x07) == 0x01 || (m_timer_mode[Timer] & 0x07) == 0x02)
{
- case TIMER0_CLOCK:
- m_timer0_counter--;
- if((m_timer0_mode & 0x07) == 0x01 || (m_timer0_mode & 0x07) == 0x02)
+ if (m_timer_counter[Timer] == 0)
{
- if(m_timer0_counter == 0)
- {
- m_timer0_out(ASSERT_LINE);
- m_timer0_counter = m_timer0_base;
- LOG("NSC810: Timer 0 output set\n");
- }
- }
- break;
- case TIMER1_CLOCK:
- m_timer1_counter--;
- if((m_timer1_mode & 0x07) == 0x01 || (m_timer1_mode & 0x07) == 0x02)
- {
- if(m_timer1_counter == 0)
- {
- m_timer1_out(ASSERT_LINE);
- m_timer1_counter = m_timer1_base;
- LOG("NSC810: Timer 1 output set\n");
- }
+ m_timer_out[Timer](ASSERT_LINE);
+ m_timer_counter[Timer] = m_timer_base[Timer];
+ LOG("NSC810: Timer %d output set\n", Timer);
}
- break;
}
}
@@ -121,70 +103,70 @@ uint8_t nsc810_device::read(offs_t offset)
{
uint8_t res = 0xff;
- if(m_ramselect)
+ if (m_ramselect)
{
// TODO: 128 byte RAM access
}
else
{
// Register access
- switch(offset & 0x1f)
+ switch (offset & 0x1f)
{
case REG_PORTA:
res = m_portA_latch &= m_ddrA;
res |= (m_portA_r() & ~m_ddrA);
- //LOG("NSC810: Port A data read %02x\n",res);
+ //LOG("NSC810: Port A data read %02x\n", res);
break;
case REG_PORTB:
res = m_portB_latch &= m_ddrB;
res |= (m_portB_r() & ~m_ddrB);
- //LOG("NSC810: Port B data read %02x\n",res);
+ //LOG("NSC810: Port B data read %02x\n", res);
break;
case REG_PORTC:
res = m_portC_latch &= m_ddrC;
res |= (m_portC_r() & ~m_ddrC);
- //LOG("NSC810: Port C data read %02x\n",res);
+ //LOG("NSC810: Port C data read %02x\n", res);
break;
case REG_MODE_TIMER0:
- res = m_timer0_mode;
+ res = m_timer_mode[0];
break;
case REG_MODE_TIMER1:
- res = m_timer1_mode;
+ res = m_timer_mode[1];
break;
case REG_TIMER0_LOW:
- res = m_timer0_counter & 0xff;
- if((m_timer0_mode & 0x07) == 0x01 || (m_timer0_mode & 0x07) == 0x02)
+ res = m_timer_counter[0] & 0xff;
+ if ((m_timer_mode[0] & 0x07) == 0x01 || (m_timer_mode[0] & 0x07) == 0x02)
{
- m_timer0_out(CLEAR_LINE);
+ m_timer_out[0](CLEAR_LINE);
LOG("NSC810: Timer 0 output reset\n");
}
break;
case REG_TIMER0_HIGH:
- res = m_timer0_counter >> 8;
- if((m_timer0_mode & 0x07) == 0x01 || (m_timer0_mode & 0x07) == 0x02)
+ res = m_timer_counter[0] >> 8;
+ if ((m_timer_mode[0] & 0x07) == 0x01 || (m_timer_mode[0] & 0x07) == 0x02)
{
- m_timer0_out(CLEAR_LINE);
+ m_timer_out[0](CLEAR_LINE);
LOG("NSC810: Timer 0 output reset\n");
}
break;
case REG_TIMER1_LOW:
- res = m_timer1_counter & 0xff;
- if((m_timer1_mode & 0x07) == 0x01 || (m_timer1_mode & 0x07) == 0x02)
+ res = m_timer_counter[1] & 0xff;
+ if ((m_timer_mode[1] & 0x07) == 0x01 || (m_timer_mode[1] & 0x07) == 0x02)
{
- m_timer1_out(0);
+ m_timer_out[1](0);
LOG("NSC810: Timer 1 output reset\n");
}
break;
case REG_TIMER1_HIGH:
- res = m_timer1_counter >> 8;
- if((m_timer1_mode & 0x07) == 0x01 || (m_timer1_mode & 0x07) == 0x02)
+ res = m_timer_counter[1] >> 8;
+ if ((m_timer_mode[1] & 0x07) == 0x01 || (m_timer_mode[1] & 0x07) == 0x02)
{
- m_timer1_out(0);
+ m_timer_out[1](0);
LOG("NSC810: Timer 1 output reset\n");
}
break;
default:
- LOG("NSC810: unused port %02x read\n",offset);
+ LOG("NSC810: unused port %02x read\n", offset);
}
}
return res;
@@ -194,41 +176,41 @@ void nsc810_device::write(offs_t offset, uint8_t data)
{
uint32_t rate;
- if(m_ramselect)
+ if (m_ramselect)
{
// TODO: 128 byte RAM access
}
else
{
// Register access
- switch(offset & 0x1f)
+ switch (offset & 0x1f)
{
case REG_PORTA:
m_portA_latch = data & ~m_ddrA;
m_portA_w((0xff & ~m_ddrA) | (data & m_ddrA));
- LOG("NSC810: Port A data write %02x\n",data);
+ LOG("NSC810: Port A data write %02x\n", data);
break;
case REG_PORTB:
m_portB_latch = data & ~m_ddrB;
m_portB_w((0xff & ~m_ddrB) | (data & m_ddrB));
- LOG("NSC810: Port B data write %02x\n",data);
+ LOG("NSC810: Port B data write %02x\n", data);
break;
case REG_PORTC:
m_portC_latch = data & ~m_ddrC;
m_portC_w((0xff & ~m_ddrC) | (data & m_ddrC));
- LOG("NSC810: Port C data write %02x\n",data);
+ LOG("NSC810: Port C data write %02x\n", data);
break;
case REG_DDRA:
m_ddrA = data;
- LOG("NSC810: Port A direction write %02x\n",data);
+ LOG("NSC810: Port A direction write %02x\n", data);
break;
case REG_DDRB:
m_ddrB = data;
- LOG("NSC810: Port B direction write %02x\n",data);
+ LOG("NSC810: Port B direction write %02x\n", data);
break;
case REG_DDRC:
m_ddrC = data;
- LOG("NSC810: Port C direction write %02x\n",data);
+ LOG("NSC810: Port C direction write %02x\n", data);
break;
case REG_MODE_DEF:
if ((data & 0x01) == 0x00)
@@ -239,106 +221,106 @@ void nsc810_device::write(offs_t offset, uint8_t data)
m_mode = 2;
else if ((data & 0x07) == 0x07)
m_mode = 3;
- LOG("NSC810: Mode Definition write %02x\n",data);
+ LOG("NSC810: Mode Definition write %02x\n", data);
break;
case REG_PORTA_BITCLR:
m_portA_latch &= ~data;
m_portA_w((0xff & ~m_ddrA) | (m_portA_latch & m_ddrA));
- LOG("NSC810: Port A bit-clear write %02x (PA=%02x)\n",data,m_portA_latch);
+ LOG("NSC810: Port A bit-clear write %02x (PA=%02x)\n", data, m_portA_latch);
break;
case REG_PORTB_BITCLR:
m_portB_latch &= ~data;
m_portB_w((0xff & ~m_ddrB) | (m_portB_latch & m_ddrB));
- LOG("NSC810: Port B bit-clear write %02x (PB=%02x)\n",data,m_portB_latch);
+ LOG("NSC810: Port B bit-clear write %02x (PB=%02x)\n", data, m_portB_latch);
break;
case REG_PORTC_BITCLR:
m_portC_latch &= ~data;
m_portC_w((0xff & ~m_ddrC) | (m_portC_latch & m_ddrC));
- LOG("NSC810: Port C bit-clear write %02x (PC=%02x)\n",data,m_portC_latch);
+ LOG("NSC810: Port C bit-clear write %02x (PC=%02x)\n", data, m_portC_latch);
break;
case REG_PORTA_BITSET:
m_portA_latch |= data;
m_portA_w((0xff & ~m_ddrA) | (m_portA_latch & m_ddrA));
- LOG("NSC810: Port A bit-set write %02x (PA=%02x)\n",data,m_portA_latch);
+ LOG("NSC810: Port A bit-set write %02x (PA=%02x)\n", data, m_portA_latch);
break;
case REG_PORTB_BITSET:
m_portB_latch |= data;
m_portB_w((0xff & ~m_ddrB) | (m_portB_latch & m_ddrB));
- LOG("NSC810: Port B bit-set write %02x (PB=%02x)\n",data,m_portB_latch);
+ LOG("NSC810: Port B bit-set write %02x (PB=%02x)\n", data, m_portB_latch);
break;
case REG_PORTC_BITSET:
m_portC_latch |= data;
m_portC_w((0xff & ~m_ddrC) | (m_portC_latch & m_ddrC));
- LOG("NSC810: Port C bit-set write %02x (PC=%02x)\n",data,m_portC_latch);
+ LOG("NSC810: Port C bit-set write %02x (PC=%02x)\n", data, m_portC_latch);
break;
case REG_TIMER0_LOW:
- m_timer0_base = (m_timer0_base & 0xff00) | data;
- m_timer0_counter = (m_timer0_counter & 0xff00) | data;
- LOG("NSC810: Timer 0 low-byte write %02x (base=%04x)\n",data,m_timer0_base);
+ m_timer_base[0] = (m_timer_base[0] & 0xff00) | data;
+ m_timer_counter[0] = (m_timer_counter[0] & 0xff00) | data;
+ LOG("NSC810: Timer 0 low-byte write %02x (base=%04x)\n", data, m_timer_base[0]);
break;
case REG_TIMER0_HIGH:
- m_timer0_base = (m_timer0_base & 0x00ff) | (data << 8);
- m_timer0_counter = (m_timer0_counter & 0x00ff) | (data << 8);
- LOG("NSC810: Timer 0 high-byte write %02x (base=%04x)\n",data,m_timer0_base);
+ m_timer_base[0] = (m_timer_base[0] & 0x00ff) | (data << 8);
+ m_timer_counter[0] = (m_timer_counter[0] & 0x00ff) | (data << 8);
+ LOG("NSC810: Timer 0 high-byte write %02x (base=%04x)\n", data, m_timer_base[0]);
break;
case REG_TIMER1_LOW:
- m_timer1_base = (m_timer1_base & 0xff00) | data;
- m_timer1_counter = (m_timer1_counter & 0xff00) | data;
- LOG("NSC810: Timer 1 low-byte write %02x (base=%04x)\n",data,m_timer1_base);
+ m_timer_base[1] = (m_timer_base[1] & 0xff00) | data;
+ m_timer_counter[1] = (m_timer_counter[1] & 0xff00) | data;
+ LOG("NSC810: Timer 1 low-byte write %02x (base=%04x)\n", data, m_timer_base[1]);
break;
case REG_TIMER1_HIGH:
- m_timer1_base = (m_timer1_base & 0x00ff) | (data << 8);
- m_timer1_counter = (m_timer1_counter & 0x00ff) | (data << 8);
- LOG("NSC810: Timer 1 high-byte write %02x (base=%04x)\n",data,m_timer1_base);
+ m_timer_base[1] = (m_timer_base[1] & 0x00ff) | (data << 8);
+ m_timer_counter[1] = (m_timer_counter[1] & 0x00ff) | (data << 8);
+ LOG("NSC810: Timer 1 high-byte write %02x (base=%04x)\n", data, m_timer_base[1]);
break;
case REG_TIMER0_STOP:
- m_timer0_running = false;
- m_timer0->reset();
- LOG("NSC810: Timer 0 Stop write %02x\n",tag(),data);
+ m_timer_running[0] = false;
+ m_timer[0]->reset();
+ LOG("NSC810: Timer 0 Stop write %02x\n", tag(), data);
break;
case REG_TIMER0_START:
- if((m_timer0_mode & 0x07) != 0x00 && (m_timer0_mode & 0x07) != 0x07)
+ if ((m_timer_mode[0] & 0x07) != 0x00 && (m_timer_mode[0] & 0x07) != 0x07)
{
- m_timer0_running = true;
- if(m_timer0_mode & 0x10)
- rate = m_timer0_clock / 64;
+ m_timer_running[0] = true;
+ if (m_timer_mode[0] & 0x10)
+ rate = m_timer_clock[0] / 64;
else
- if(m_timer0_mode & 0x08)
- rate = m_timer0_clock / 2;
+ if (m_timer_mode[0] & 0x08)
+ rate = m_timer_clock[0] / 2;
else
- rate = m_timer0_clock;
- m_timer0->adjust(attotime::zero,0,attotime::from_hz(rate));
+ rate = m_timer_clock[0];
+ m_timer[0]->adjust(attotime::zero, 0, attotime::from_hz(rate));
}
- LOG("NSC810: Timer 0 Start write %02x\n",data);
+ LOG("NSC810: Timer 0 Start write %02x\n", data);
break;
case REG_TIMER1_STOP:
- m_timer1_running = false;
- m_timer1->reset();
- LOG("NSC810: Timer 1 Stop write %02x\n",data);
+ m_timer_running[1] = false;
+ m_timer[1]->reset();
+ LOG("NSC810: Timer 1 Stop write %02x\n", data);
break;
case REG_TIMER1_START:
- if((m_timer1_mode & 0x07) != 0x00 && (m_timer1_mode & 0x07) != 0x07)
+ if ((m_timer_mode[1] & 0x07) != 0x00 && (m_timer_mode[1] & 0x07) != 0x07)
{
- m_timer1_running = true;
+ m_timer_running[1] = true;
// no /64 prescaler on timer 1
- if(m_timer0_mode & 0x08)
- rate = m_timer0_clock / 2;
+ if (m_timer_mode[0] & 0x08)
+ rate = m_timer_clock[0] / 2;
else
- rate = m_timer0_clock;
- m_timer1->adjust(attotime::zero,0,attotime::from_hz(rate));
+ rate = m_timer_clock[0];
+ m_timer[1]->adjust(attotime::zero, 0, attotime::from_hz(rate));
}
- LOG("NSC810: Timer 1 Start write %02x\n",data);
+ LOG("NSC810: Timer 1 Start write %02x\n", data);
break;
case REG_MODE_TIMER0:
- m_timer0_mode = data;
- LOG("NSC810: Timer 0 Mode write %02x\n",data);
+ m_timer_mode[0] = data;
+ LOG("NSC810: Timer 0 Mode write %02x\n", data);
break;
case REG_MODE_TIMER1:
- m_timer1_mode = data;
- LOG("NSC810: Timer 1 Mode write %02x\n",data);
+ m_timer_mode[1] = data;
+ LOG("NSC810: Timer 1 Mode write %02x\n", data);
break;
default:
- logerror("NSC810: Unused register %02x write %02x\n",offset,data);
+ logerror("NSC810: Unused register %02x write %02x\n", offset, data);
}
}
}
diff --git a/src/devices/machine/nsc810.h b/src/devices/machine/nsc810.h
index f6ad2042959..08a35465cc4 100644
--- a/src/devices/machine/nsc810.h
+++ b/src/devices/machine/nsc810.h
@@ -38,12 +38,12 @@ public:
auto portA_write_callback() { return m_portA_w.bind(); }
auto portB_write_callback() { return m_portB_w.bind(); }
auto portC_write_callback() { return m_portC_w.bind(); }
- auto timer0_callback() { return m_timer0_out.bind(); }
- auto timer1_callback() { return m_timer1_out.bind(); }
+ auto timer0_callback() { return m_timer_out[0].bind(); }
+ auto timer1_callback() { return m_timer_out[1].bind(); }
- void set_timer0_clock(uint32_t clk) { m_timer0_clock = clk; }
+ void set_timer0_clock(uint32_t clk) { m_timer_clock[0] = clk; }
void set_timer0_clock(const XTAL &clk) { set_timer0_clock(clk.value()); }
- void set_timer1_clock(uint32_t clk) { m_timer1_clock = clk; }
+ void set_timer1_clock(uint32_t clk) { m_timer_clock[1] = clk; }
void set_timer1_clock(const XTAL &clk) { set_timer1_clock(clk.value()); }
uint8_t read(offs_t offset);
@@ -52,7 +52,8 @@ public:
protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ template <int Timer> TIMER_CALLBACK_MEMBER(timer_tick);
private:
uint8_t m_portA_latch;
@@ -62,18 +63,12 @@ private:
uint8_t m_ddrB;
uint8_t m_ddrC;
uint8_t m_mode;
- emu_timer* m_timer0;
- emu_timer* m_timer1;
- uint8_t m_timer0_mode;
- uint8_t m_timer1_mode;
- uint16_t m_timer0_counter;
- uint16_t m_timer1_counter;
- uint16_t m_timer0_base;
- uint16_t m_timer1_base;
- bool m_timer0_running;
- bool m_timer1_running;
- uint32_t m_timer0_clock;
- uint32_t m_timer1_clock;
+ emu_timer* m_timer[2];
+ uint8_t m_timer_mode[2];
+ uint16_t m_timer_counter[2];
+ uint16_t m_timer_base[2];
+ bool m_timer_running[2];
+ uint32_t m_timer_clock[2];
bool m_ramselect;
devcb_read8 m_portA_r;
@@ -82,11 +77,7 @@ private:
devcb_write8 m_portA_w;
devcb_write8 m_portB_w;
devcb_write8 m_portC_w;
- devcb_write_line m_timer0_out;
- devcb_write_line m_timer1_out;
-
- static constexpr device_timer_id TIMER0_CLOCK = 0;
- static constexpr device_timer_id TIMER1_CLOCK = 1;
+ devcb_write_line::array<2> m_timer_out;
enum
{
diff --git a/src/devices/machine/nscsi_bus.cpp b/src/devices/machine/nscsi_bus.cpp
index 89f18a902e2..eeaf2c2722a 100644
--- a/src/devices/machine/nscsi_bus.cpp
+++ b/src/devices/machine/nscsi_bus.cpp
@@ -233,7 +233,7 @@ const char *const nscsi_full_device::command_names[256] = {
void nscsi_full_device::device_start()
{
nscsi_device::device_start();
- scsi_timer = timer_alloc(SCSI_TIMER);
+ scsi_timer = timer_alloc(FUNC(nscsi_full_device::update_tick), this);
save_item(NAME(scsi_cmdbuf));
save_item(NAME(scsi_sense_buffer));
save_item(NAME(scsi_cmdsize));
@@ -266,13 +266,9 @@ void nscsi_full_device::device_reset()
sense(false, SK_NO_SENSE);
}
-void nscsi_full_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nscsi_full_device::update_tick)
{
- if(id != SCSI_TIMER)
- return;
-
step(true);
-
}
void nscsi_full_device::scsi_ctrl_changed()
diff --git a/src/devices/machine/nscsi_bus.h b/src/devices/machine/nscsi_bus.h
index 997844c4342..6cd99732bf9 100644
--- a/src/devices/machine/nscsi_bus.h
+++ b/src/devices/machine/nscsi_bus.h
@@ -144,9 +144,8 @@ class nscsi_full_device : public nscsi_device, public nscsi_slot_card_interface
{
public:
virtual void scsi_ctrl_changed() override;
-protected:
- enum { SCSI_TIMER = 100 };
+protected:
// SCSI status returns
enum {
SS_GOOD = 0x00,
@@ -316,12 +315,13 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void scsi_message();
virtual void scsi_command();
virtual bool scsi_command_done(uint8_t command, uint8_t length);
+ TIMER_CALLBACK_MEMBER(update_tick);
+
void scsi_unknown_command();
void scsi_status_complete(uint8_t st);
void scsi_data_in(int buf, int size);
diff --git a/src/devices/machine/pcf8573.cpp b/src/devices/machine/pcf8573.cpp
index 09cb4c340d3..791336b4bf5 100644
--- a/src/devices/machine/pcf8573.cpp
+++ b/src/devices/machine/pcf8573.cpp
@@ -61,7 +61,7 @@ void pcf8573_device::device_start()
m_sec_cb.resolve_safe();
// allocate timers
- m_clock_timer = timer_alloc();
+ m_clock_timer = timer_alloc(FUNC(pcf8573_device::clock_tick), this);
m_clock_timer->adjust(attotime::from_hz(clock() / 32768), 0, attotime::from_hz(clock() / 32768));
// state saving
@@ -80,10 +80,10 @@ void pcf8573_device::device_start()
}
//-------------------------------------------------
-// device_timer - handler timer events
+// clock_tick - advance the RTC
//-------------------------------------------------
-void pcf8573_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(pcf8573_device::clock_tick)
{
advance_seconds();
diff --git a/src/devices/machine/pcf8573.h b/src/devices/machine/pcf8573.h
index d5b3bc5283e..a6b31e83ed7 100644
--- a/src/devices/machine/pcf8573.h
+++ b/src/devices/machine/pcf8573.h
@@ -64,11 +64,12 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_rtc_interface overrides
virtual void rtc_clock_updated(int year, int month, int day, int day_of_week, int hour, int minute, int second) override;
+ TIMER_CALLBACK_MEMBER(clock_tick);
+
private:
static constexpr uint8_t PCF8573_SLAVE_ADDRESS = 0xd0;
diff --git a/src/devices/machine/pcf8583.cpp b/src/devices/machine/pcf8583.cpp
index 63a755d1077..c09a6fce138 100644
--- a/src/devices/machine/pcf8583.cpp
+++ b/src/devices/machine/pcf8583.cpp
@@ -55,7 +55,7 @@ pcf8583_device::pcf8583_device(const machine_config &mconfig, const char *tag, d
void pcf8583_device::device_start()
{
- m_timer = timer_alloc(TIMER_TICK);
+ m_timer = timer_alloc(FUNC(pcf8583_device::clock_tick), this);
m_timer->adjust(attotime::from_hz(100), 0, attotime::from_hz(100));
save_item(NAME(m_scl));
@@ -73,15 +73,10 @@ void pcf8583_device::device_start()
m_irq_cb.resolve_safe();
}
-void pcf8583_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(pcf8583_device::clock_tick)
{
- switch (id)
- {
- case TIMER_TICK:
- if (!BIT(m_data[REG_CONTROL], CONTROL_STOP_BIT))
- advance_hundredths();
- break;
- }
+ if (!BIT(m_data[REG_CONTROL], CONTROL_STOP_BIT))
+ advance_hundredths();
}
void pcf8583_device::advance_hundredths()
diff --git a/src/devices/machine/pcf8583.h b/src/devices/machine/pcf8583.h
index 900ea145c10..d5018160788 100644
--- a/src/devices/machine/pcf8583.h
+++ b/src/devices/machine/pcf8583.h
@@ -88,7 +88,6 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_rtc_interface overrides
virtual bool rtc_feature_y2k() const override { return true; }
@@ -100,6 +99,8 @@ protected:
virtual bool nvram_read(util::read_stream &file) override;
virtual bool nvram_write(util::write_stream &file) override;
+ TIMER_CALLBACK_MEMBER(clock_tick);
+
private:
static constexpr uint8_t PCF8583_SLAVE_ADDRESS = 0xa0;
@@ -128,8 +129,6 @@ private:
CONTROL_STOP_BIT = 7
};
- static const device_timer_id TIMER_TICK = 0;
-
// get/set date
uint8_t get_date_year() { return (m_data[REG_YEAR_DATE] >> 6) & 3; }
void set_date_year(uint8_t year) { m_data[REG_YEAR_DATE] = (m_data[REG_YEAR_DATE] & 0x3f) | ((year % 4) << 6); }
diff --git a/src/devices/machine/pcf8593.cpp b/src/devices/machine/pcf8593.cpp
index cc2e372d4b8..3ba4f1af89b 100644
--- a/src/devices/machine/pcf8593.cpp
+++ b/src/devices/machine/pcf8593.cpp
@@ -63,7 +63,7 @@ void pcf8593_device::device_start()
{
_logerror( 0, ("pcf8593_init\n"));
memset(m_register, 0, sizeof(m_register));
- m_timer = timer_alloc(TIMER_UPDATE_COUNTER);
+ m_timer = timer_alloc(FUNC(pcf8593_device::clock_tick), this);
m_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1));
}
@@ -87,20 +87,15 @@ void pcf8593_device::device_reset()
//-------------------------------------------------
-// device_timer - handler timer events
+// clock_tick - advance the RTC if enabled
//-------------------------------------------------
-void pcf8593_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(pcf8593_device::clock_tick)
{
- switch(id)
- {
- case TIMER_UPDATE_COUNTER:
- _logerror( 2, ("pcf8593_timer_callback (%d)\n", param));
- // check if counting is enabled
- if (!(m_data[0] & 0x80))
- advance_seconds();
- break;
- }
+ _logerror( 2, ("pcf8593_timer_callback (%d)\n", param));
+ // check if counting is enabled
+ if (!(m_data[0] & 0x80))
+ advance_seconds();
}
diff --git a/src/devices/machine/pcf8593.h b/src/devices/machine/pcf8593.h
index 419aebad224..3720ac1bb53 100644
--- a/src/devices/machine/pcf8593.h
+++ b/src/devices/machine/pcf8593.h
@@ -32,7 +32,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_rtc_interface overrides
virtual bool rtc_feature_y2k() const override { return true; }
@@ -43,11 +42,11 @@ protected:
virtual bool nvram_read(util::read_stream &file) override;
virtual bool nvram_write(util::write_stream &file) override;
+ TIMER_CALLBACK_MEMBER(clock_tick);
+
private:
void clear_buffer_rx();
- static const device_timer_id TIMER_UPDATE_COUNTER = 0;
-
// internal state
uint8_t m_data[16];
int m_pin_scl;
diff --git a/src/devices/machine/pckeybrd.cpp b/src/devices/machine/pckeybrd.cpp
index 8defcd0297e..c2b46fbe4b7 100644
--- a/src/devices/machine/pckeybrd.cpp
+++ b/src/devices/machine/pckeybrd.cpp
@@ -300,7 +300,7 @@ at_keyboard_device::at_keyboard_device(const machine_config &mconfig, const char
}
-void pc_keyboard_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(pc_keyboard_device::poll_keys)
{
polling();
if(!charqueue_empty())
@@ -326,7 +326,7 @@ void pc_keyboard_device::device_start()
ioport_charqueue_empty_delegate(&pc_keyboard_device::charqueue_empty, this));
m_out_keypress_func.resolve_safe();
- m_keyboard_timer = timer_alloc();
+ m_keyboard_timer = timer_alloc(FUNC(at_keyboard_device::poll_keys), this);
}
void at_keyboard_device::device_start()
diff --git a/src/devices/machine/pckeybrd.h b/src/devices/machine/pckeybrd.h
index eb685ec175e..e52981b10c4 100644
--- a/src/devices/machine/pckeybrd.h
+++ b/src/devices/machine/pckeybrd.h
@@ -40,7 +40,9 @@ protected:
virtual ioport_constructor device_input_ports() const override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(poll_keys);
+
void queue_insert(uint8_t data);
void clear_buffer();
diff --git a/src/devices/machine/phi.cpp b/src/devices/machine/phi.cpp
index 8e44c2fb49b..7659a0359a1 100644
--- a/src/devices/machine/phi.cpp
+++ b/src/devices/machine/phi.cpp
@@ -48,12 +48,12 @@ namespace {
return (T)1U << n;
}
- template<typename T> void BIT_CLR(T& w , unsigned n)
+ template<typename T> void BIT_CLR(T& w, unsigned n)
{
w &= ~BIT_MASK<T>(n);
}
- template<typename T> void BIT_SET(T& w , unsigned n)
+ template<typename T> void BIT_SET(T& w, unsigned n)
{
w |= BIT_MASK<T>(n);
}
@@ -205,42 +205,42 @@ phi_device::phi_device(const machine_config &mconfig, const char *tag, device_t
WRITE_LINE_MEMBER(phi_device::eoi_w)
{
- set_ext_signal(PHI_488_EOI , state);
+ set_ext_signal(PHI_488_EOI, state);
}
WRITE_LINE_MEMBER(phi_device::dav_w)
{
- set_ext_signal(PHI_488_DAV , state);
+ set_ext_signal(PHI_488_DAV, state);
}
WRITE_LINE_MEMBER(phi_device::nrfd_w)
{
- set_ext_signal(PHI_488_NRFD , state);
+ set_ext_signal(PHI_488_NRFD, state);
}
WRITE_LINE_MEMBER(phi_device::ndac_w)
{
- set_ext_signal(PHI_488_NDAC , state);
+ set_ext_signal(PHI_488_NDAC, state);
}
WRITE_LINE_MEMBER(phi_device::ifc_w)
{
- set_ext_signal(PHI_488_IFC , state);
+ set_ext_signal(PHI_488_IFC, state);
}
WRITE_LINE_MEMBER(phi_device::srq_w)
{
- set_ext_signal(PHI_488_SRQ , state);
+ set_ext_signal(PHI_488_SRQ, state);
}
WRITE_LINE_MEMBER(phi_device::atn_w)
{
- set_ext_signal(PHI_488_ATN , state);
+ set_ext_signal(PHI_488_ATN, state);
}
WRITE_LINE_MEMBER(phi_device::ren_w)
{
- set_ext_signal(PHI_488_REN , state);
+ set_ext_signal(PHI_488_REN, state);
}
void phi_device::bus_dio_w(uint8_t data)
@@ -248,27 +248,27 @@ void phi_device::bus_dio_w(uint8_t data)
update_pp();
}
-void phi_device::set_ext_signal(phi_488_signal_t signal , int state)
+void phi_device::set_ext_signal(phi_488_signal_t signal, int state)
{
state = !state;
- if (m_ext_signals[ signal ] != state) {
- m_ext_signals[ signal ] = state;
- LOG_NOISY("EXT EOI %d DAV %d NRFD %d NDAC %d IFC %d SRQ %d ATN %d REN %d\n" ,
- m_ext_signals[ PHI_488_EOI ] ,
- m_ext_signals[ PHI_488_DAV ] ,
- m_ext_signals[ PHI_488_NRFD ] ,
- m_ext_signals[ PHI_488_NDAC ] ,
- m_ext_signals[ PHI_488_IFC ] ,
- m_ext_signals[ PHI_488_SRQ ] ,
- m_ext_signals[ PHI_488_ATN ] ,
- m_ext_signals[ PHI_488_REN ]);
+ if (m_ext_signals[signal] != state) {
+ m_ext_signals[signal] = state;
+ LOG_NOISY("EXT EOI %d DAV %d NRFD %d NDAC %d IFC %d SRQ %d ATN %d REN %d\n",
+ m_ext_signals[PHI_488_EOI],
+ m_ext_signals[PHI_488_DAV],
+ m_ext_signals[PHI_488_NRFD],
+ m_ext_signals[PHI_488_NDAC],
+ m_ext_signals[PHI_488_IFC],
+ m_ext_signals[PHI_488_SRQ],
+ m_ext_signals[PHI_488_ATN],
+ m_ext_signals[PHI_488_REN]);
update_fsm();
}
}
void phi_device::reg16_w(offs_t offset, uint16_t data)
{
- int_reg_w(offset , data & REG_ALL_MASK);
+ int_reg_w(offset, data & REG_ALL_MASK);
}
uint16_t phi_device::reg16_r(offs_t offset)
@@ -330,13 +330,13 @@ uint16_t phi_device::reg16_r(offs_t offset)
((res & REG_D0D1_MASK) >> (REG_D0D1_SHIFT - REG_STATUS_D0D1_BIT));
}
- LOG_REG("R %u=%04x\n" , offset , res);
+ LOG_REG("R %u=%04x\n", offset, res);
return res;
}
void phi_device::reg8_w(offs_t offset, uint8_t data)
{
- int_reg_w(offset , data);
+ int_reg_w(offset, data);
}
uint8_t phi_device::reg8_r(offs_t offset)
@@ -381,8 +381,8 @@ void phi_device::device_start()
m_dmarq_write_func.resolve_safe();
m_sys_cntrl_read_func.resolve_safe(0);
- m_sh_dly_timer = timer_alloc(SH_DELAY_TMR_ID);
- m_c_dly_timer = timer_alloc(C_DELAY_TMR_ID);
+ m_sh_dly_timer = timer_alloc(FUNC(phi_device::delayed_update), this);
+ m_c_dly_timer = timer_alloc(FUNC(phi_device::delayed_update), this);
}
void phi_device::device_reset()
@@ -417,20 +417,20 @@ void phi_device::device_reset()
update_488();
}
-void phi_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(phi_device::delayed_update)
{
- LOG_NOISY("tmr %d enabled %d\n" , id , timer.enabled());
+ LOG_NOISY("tmr %d enabled\n", param);
update_fsm();
}
-void phi_device::int_reg_w(offs_t offset , uint16_t data)
+void phi_device::int_reg_w(offs_t offset, uint16_t data)
{
- if (BIT(m_reg_control , REG_CTRL_8BIT_PROC_BIT)) {
+ if (BIT(m_reg_control, REG_CTRL_8BIT_PROC_BIT)) {
// In 8-bit mode, D0/D1 come from status register
data = (data & REG_D08D15_MASK) | ((m_reg_status << (REG_D0D1_SHIFT - REG_STATUS_D0D1_BIT)) & REG_D0D1_MASK);
}
- LOG_REG("W %u=%04x\n" , offset , data);
+ LOG_REG("W %u=%04x\n", offset, data);
switch (offset) {
case REG_W_INT_COND:
@@ -457,7 +457,7 @@ void phi_device::int_reg_w(offs_t offset , uint16_t data)
// Copy D0/D1 access bits into status register
m_reg_status = (m_reg_status & ~(3U << REG_STATUS_D0D1_BIT)) |
(data & (3U << REG_STATUS_D0D1_BIT));
- if (BIT(data , REG_STATUS_DATA_FREEZE_BIT) && m_fifo_in.empty()) {
+ if (BIT(data, REG_STATUS_DATA_FREEZE_BIT) && m_fifo_in.empty()) {
BIT_CLR(m_reg_status, REG_STATUS_DATA_FREEZE_BIT);
}
update_fsm();
@@ -466,17 +466,17 @@ void phi_device::int_reg_w(offs_t offset , uint16_t data)
case REG_W_CONTROL:
// D0/D1/D15 are not mapped into register
m_reg_control = data & 0xfe;
- if (BIT(data , REG_CTRL_INIT_OFIFO_BIT)) {
+ if (BIT(data, REG_CTRL_INIT_OFIFO_BIT)) {
m_fifo_out.clear();
if (m_c_state == PHI_C_CSBS) {
// Take control asynchronously
m_c_state = PHI_C_CSWS;
- m_c_dly_timer->adjust(attotime::from_nsec(DELAY_T7));
+ m_c_dly_timer->adjust(attotime::from_nsec(DELAY_T7), 1);
}
}
if (m_loopback) {
// TODO: better?
- m_id_enabled = BIT(m_reg_control , REG_CTRL_PP_RESPONSE_BIT);
+ m_id_enabled = BIT(m_reg_control, REG_CTRL_PP_RESPONSE_BIT);
}
update_fsm();
break;
@@ -485,18 +485,18 @@ void phi_device::int_reg_w(offs_t offset , uint16_t data)
{
// No D0/D1 in register
data &= REG_D08D15_MASK;
- bool prev_ol = BIT(m_reg_address , REG_ADDR_ONLINE_BIT);
+ bool prev_ol = BIT(m_reg_address, REG_ADDR_ONLINE_BIT);
m_reg_address = data;
- bool current_ol = BIT(m_reg_address , REG_ADDR_ONLINE_BIT);
+ bool current_ol = BIT(m_reg_address, REG_ADDR_ONLINE_BIT);
m_sys_controller = !current_ol || m_sys_cntrl_read_func();
m_loopback = !current_ol;
if (!current_ol) {
// IDENTIFY is enabled by PP_RESPONSE bit in control register
- m_id_enabled = BIT(m_reg_control , REG_CTRL_PP_RESPONSE_BIT);
+ m_id_enabled = BIT(m_reg_control, REG_CTRL_PP_RESPONSE_BIT);
} else if (!prev_ol) {
// Going on-line
pon_msg();
- m_id_enabled = BIT(m_reg_control , REG_CTRL_PP_RESPONSE_BIT);
+ m_id_enabled = BIT(m_reg_control, REG_CTRL_PP_RESPONSE_BIT);
}
configure_pp_response();
if (prev_ol != current_ol) {
@@ -536,7 +536,7 @@ uint8_t phi_device::get_dio(void)
void phi_device::set_dio(uint8_t data)
{
if (data != m_dio) {
- LOG_NOISY("DIO=%02x\n" , data);
+ LOG_NOISY("DIO=%02x\n", data);
m_dio = data;
if (!m_loopback) {
m_dio_write_func(~data);
@@ -547,27 +547,27 @@ void phi_device::set_dio(uint8_t data)
bool phi_device::get_signal(phi_488_signal_t signal)
{
if (m_loopback) {
- return m_signals[ signal ];
+ return m_signals[signal];
} else {
- return m_ext_signals[ signal ];
+ return m_ext_signals[signal];
}
}
-void phi_device::set_signal(phi_488_signal_t signal , bool state)
+void phi_device::set_signal(phi_488_signal_t signal, bool state)
{
- if (state != m_signals[ signal ]) {
- m_signals[ signal ] = state;
- LOG_NOISY("INT EOI %d DAV %d NRFD %d NDAC %d IFC %d SRQ %d ATN %d REN %d\n" ,
- m_signals[ PHI_488_EOI ] ,
- m_signals[ PHI_488_DAV ] ,
- m_signals[ PHI_488_NRFD ] ,
- m_signals[ PHI_488_NDAC ] ,
- m_signals[ PHI_488_IFC ] ,
- m_signals[ PHI_488_SRQ ] ,
- m_signals[ PHI_488_ATN ] ,
- m_signals[ PHI_488_REN ]);
+ if (state != m_signals[signal]) {
+ m_signals[signal] = state;
+ LOG_NOISY("INT EOI %d DAV %d NRFD %d NDAC %d IFC %d SRQ %d ATN %d REN %d\n",
+ m_signals[PHI_488_EOI],
+ m_signals[PHI_488_DAV],
+ m_signals[PHI_488_NRFD],
+ m_signals[PHI_488_NDAC],
+ m_signals[PHI_488_IFC],
+ m_signals[PHI_488_SRQ],
+ m_signals[PHI_488_ATN],
+ m_signals[PHI_488_REN]);
if (!m_loopback) {
- m_signal_wr_fns[ signal ](!state);
+ m_signal_wr_fns[signal](!state);
}
}
}
@@ -598,7 +598,7 @@ void phi_device::update_488(void)
} else {
m_dio_write_func(~m_dio);
for (unsigned i = 0; i < PHI_488_SIGNAL_COUNT; i++) {
- m_signal_wr_fns[ i ](!m_signals[ i ]);
+ m_signal_wr_fns[i](!m_signals[i]);
}
}
}
@@ -612,13 +612,13 @@ void phi_device::update_fsm(void)
}
m_no_recursion = true;
- set_signal(PHI_488_IFC , m_sys_controller && BIT(m_reg_control , REG_CTRL_IFC_BIT));
- set_signal(PHI_488_REN , m_sys_controller && BIT(m_reg_control , REG_CTRL_REN_BIT));
+ set_signal(PHI_488_IFC, m_sys_controller && BIT(m_reg_control, REG_CTRL_IFC_BIT));
+ set_signal(PHI_488_REN, m_sys_controller && BIT(m_reg_control, REG_CTRL_REN_BIT));
// TODO: improve (see SR FSM)
// This is not entirely correct but it works for now (on HP64K, the only system
// where it's relevant)
- set_signal(PHI_488_SRQ , BIT(m_reg_control , REG_CTRL_SERVICE_REQ_BIT));
+ set_signal(PHI_488_SRQ, BIT(m_reg_control, REG_CTRL_SERVICE_REQ_BIT));
bool changed = true;
int prev_state;
@@ -628,10 +628,10 @@ void phi_device::update_fsm(void)
// TODO: SR FSM
// Loop until all changes settle
while (changed) {
- LOG_NOISY("SH %d AH %d T %d SPMS %d L %d SR %d PP %d PPR %u S %d C %d SA %d\n" ,
- m_sh_state , m_ah_state , m_t_state , m_t_spms , m_l_state , m_sr_state ,
- m_pp_state , m_ppr_msg , m_s_sense , m_c_state , m_sa_state);
- LOG_NOISY("O E/F=%d/%d I E/F=%d/%d\n" , m_fifo_out.empty() , m_fifo_out.full() , m_fifo_in.empty() , m_fifo_in.full());
+ LOG_NOISY("SH %d AH %d T %d SPMS %d L %d SR %d PP %d PPR %u S %d C %d SA %d\n",
+ m_sh_state, m_ah_state, m_t_state, m_t_spms, m_l_state, m_sr_state,
+ m_pp_state, m_ppr_msg, m_s_sense, m_c_state, m_sa_state);
+ LOG_NOISY("O E/F=%d/%d I E/F=%d/%d\n", m_fifo_out.empty(), m_fifo_out.full(), m_fifo_in.empty(), m_fifo_in.full());
changed = false;
// SH FSM
@@ -656,10 +656,10 @@ void phi_device::update_fsm(void)
break;
case PHI_SH_SGNS:
- if ((m_nba_origin = nba_msg(new_byte , new_eoi)) != NBA_NONE) {
+ if ((m_nba_origin = nba_msg(new_byte, new_eoi)) != NBA_NONE) {
m_sh_state = PHI_SH_SDYS;
- m_sh_dly_timer->adjust(attotime::from_nsec(DELAY_T1));
- LOG_NOISY("SH DLY enabled %d\n" , m_sh_dly_timer->enabled());
+ m_sh_dly_timer->adjust(attotime::from_nsec(DELAY_T1), 0);
+ LOG_NOISY("SH DLY enabled %d\n", m_sh_dly_timer->enabled());
}
break;
@@ -671,14 +671,14 @@ void phi_device::update_fsm(void)
case PHI_SH_STRS:
if (!get_signal(PHI_488_NDAC)) {
- LOG("%.6f TX %02x/%d\n" , machine().time().as_double() , m_dio , m_signals[ PHI_488_EOI ]);
+ LOG("%.6f TX %02x/%d\n", machine().time().as_double(), m_dio, m_signals[PHI_488_EOI]);
m_sh_state = PHI_SH_SGNS;
clear_nba((nba_origin_t)m_nba_origin);
}
break;
default:
- logerror("Invalid SH state %d\n" , m_sh_state);
+ logerror("Invalid SH state %d\n", m_sh_state);
m_sh_state = PHI_SH_SIDS;
}
}
@@ -690,9 +690,9 @@ void phi_device::update_fsm(void)
// EOI is controlled by SH & C FSMs
bool eoi_signal = false;
uint8_t dio_byte = 0;
- set_signal(PHI_488_DAV , m_sh_state == PHI_SH_STRS);
+ set_signal(PHI_488_DAV, m_sh_state == PHI_SH_STRS);
if (m_sh_state == PHI_SH_SDYS || m_sh_state == PHI_SH_STRS) {
- nba_msg(new_byte , new_eoi);
+ nba_msg(new_byte, new_eoi);
dio_byte = new_byte;
eoi_signal = new_eoi;
}
@@ -733,9 +733,9 @@ void phi_device::update_fsm(void)
uint8_t if_cmd = get_dio();
bool parity_ok = odd_parity(if_cmd);
if (!parity_ok) {
- BIT_SET(m_reg_int_cond , REG_INT_PARITY_ERR_BIT);
+ BIT_SET(m_reg_int_cond, REG_INT_PARITY_ERR_BIT);
}
- if (BIT(m_reg_control , REG_CTRL_PAR_FREEZE_BIT) && !parity_ok) {
+ if (BIT(m_reg_control, REG_CTRL_PAR_FREEZE_BIT) && !parity_ok) {
// With even parity and PARITY FREEZE set, command is ignored and
// AH FSM freezes in ACDS
m_ah_state = PHI_AH_ACDS_FROZEN;
@@ -746,7 +746,7 @@ void phi_device::update_fsm(void)
m_ah_state = PHI_AH_AWNS;
}
}
- } else if (byte_received(get_dio() , get_signal(PHI_488_EOI))) {
+ } else if (byte_received(get_dio(), get_signal(PHI_488_EOI))) {
m_ah_state = PHI_AH_AWNS;
}
break;
@@ -759,7 +759,7 @@ void phi_device::update_fsm(void)
break;
default:
- logerror("Invalid AH state %d\n" , m_ah_state);
+ logerror("Invalid AH state %d\n", m_ah_state);
m_ah_state = PHI_AH_AIDS;
}
}
@@ -767,8 +767,8 @@ void phi_device::update_fsm(void)
changed = true;
}
// AH outputs
- set_signal(PHI_488_NRFD , m_ah_state == PHI_AH_ANRS || m_ah_state == PHI_AH_ACDS || m_ah_state == PHI_AH_ACDS_FROZEN || m_ah_state == PHI_AH_AWNS);
- set_signal(PHI_488_NDAC , m_ah_state == PHI_AH_ANRS || m_ah_state == PHI_AH_ACRS || m_ah_state == PHI_AH_ACDS || m_ah_state == PHI_AH_ACDS_FROZEN);
+ set_signal(PHI_488_NRFD, m_ah_state == PHI_AH_ANRS || m_ah_state == PHI_AH_ACDS || m_ah_state == PHI_AH_ACDS_FROZEN || m_ah_state == PHI_AH_AWNS);
+ set_signal(PHI_488_NDAC, m_ah_state == PHI_AH_ANRS || m_ah_state == PHI_AH_ACRS || m_ah_state == PHI_AH_ACDS || m_ah_state == PHI_AH_ACDS_FROZEN);
// T FSM
prev_state = m_t_state;
@@ -828,7 +828,7 @@ void phi_device::update_fsm(void)
break;
default:
- logerror("Invalid T state %d\n" , m_t_state);
+ logerror("Invalid T state %d\n", m_t_state);
m_t_state = PHI_T_TIDS;
}
}
@@ -862,7 +862,7 @@ void phi_device::update_fsm(void)
break;
default:
- logerror("Invalid L state %d\n" , m_l_state);
+ logerror("Invalid L state %d\n", m_l_state);
m_l_state = PHI_L_LIDS;
}
}
@@ -897,15 +897,15 @@ void phi_device::update_fsm(void)
break;
default:
- logerror("Invalid PP state %d\n" , m_pp_state);
+ logerror("Invalid PP state %d\n", m_pp_state);
m_pp_state = PHI_PP_PPIS;
}
if (m_pp_state != prev_state) {
changed = true;
}
// PP outputs
- if (m_pp_state == PHI_PP_PPAS && m_s_sense == !!BIT(m_reg_control , REG_CTRL_PP_RESPONSE_BIT)) {
- LOG("%.6f PP %u\n" , machine().time().as_double() , m_ppr_msg);
+ if (m_pp_state == PHI_PP_PPAS && m_s_sense == !!BIT(m_reg_control, REG_CTRL_PP_RESPONSE_BIT)) {
+ LOG("%.6f PP %u\n", machine().time().as_double(), m_ppr_msg);
dio_byte |= BIT_MASK<uint8_t>(m_ppr_msg);
}
@@ -931,7 +931,7 @@ void phi_device::update_fsm(void)
case PHI_C_CACS:
// If there are ifcmds to send, just stay in CACS
// else wait for SH to finish its current transfer then decide what to do
- if (nba_msg(new_byte , new_eoi) != NBA_CMD_FROM_OFIFO &&
+ if (nba_msg(new_byte, new_eoi) != NBA_CMD_FROM_OFIFO &&
m_sh_state != PHI_SH_STRS && m_sh_state != PHI_SH_SDYS) {
if (!m_fifo_out.empty()) {
// Possible cases
@@ -953,14 +953,14 @@ void phi_device::update_fsm(void)
case PHI_C_CPPS:
if (!rpp_msg()) {
m_c_state = PHI_C_CAWS;
- m_c_dly_timer->adjust(attotime::from_nsec(DELAY_T9));
+ m_c_dly_timer->adjust(attotime::from_nsec(DELAY_T9), 1);
}
break;
case PHI_C_CSBS:
if (tcs_msg() && m_ah_state == PHI_AH_ANRS) {
m_c_state = PHI_C_CSHS;
- m_c_dly_timer->adjust(attotime::from_nsec(DELAY_T10));
+ m_c_dly_timer->adjust(attotime::from_nsec(DELAY_T10), 1);
}
break;
@@ -968,7 +968,7 @@ void phi_device::update_fsm(void)
// tcs_msg cannot go false here
if (!m_c_dly_timer->enabled()) {
m_c_state = PHI_C_CSWS;
- m_c_dly_timer->adjust(attotime::from_nsec(DELAY_T7));
+ m_c_dly_timer->adjust(attotime::from_nsec(DELAY_T7), 1);
}
break;
@@ -990,12 +990,12 @@ void phi_device::update_fsm(void)
case PHI_C_CSWS:
if (m_t_state == PHI_T_TADS || !m_c_dly_timer->enabled()) {
m_c_state = PHI_C_CAWS;
- m_c_dly_timer->adjust(attotime::from_nsec(DELAY_T9));
+ m_c_dly_timer->adjust(attotime::from_nsec(DELAY_T9), 1);
}
break;
default:
- logerror("Invalid C state %d\n" , m_c_state);
+ logerror("Invalid C state %d\n", m_c_state);
m_c_state = PHI_C_CIDS;
}
}
@@ -1003,11 +1003,11 @@ void phi_device::update_fsm(void)
changed = true;
}
// C outputs
- set_signal(PHI_488_ATN , m_c_state == PHI_C_CACS ||
+ set_signal(PHI_488_ATN, m_c_state == PHI_C_CACS ||
m_c_state == PHI_C_CPPS || m_c_state == PHI_C_CSWS ||
m_c_state == PHI_C_CAWS || m_c_state == PHI_C_CTRS);
eoi_signal = eoi_signal || m_c_state == PHI_C_CPPS;
- set_signal(PHI_488_EOI , eoi_signal);
+ set_signal(PHI_488_EOI, eoi_signal);
set_dio(dio_byte);
}
@@ -1035,7 +1035,7 @@ void phi_device::update_fsm(void)
}
m_reg_int_cond &= ~REG_INT_STATE_MASK;
if (m_fifo_out.empty()) {
- BIT_SET(m_reg_int_cond , REG_INT_FIFO_IDLE_BIT);
+ BIT_SET(m_reg_int_cond, REG_INT_FIFO_IDLE_BIT);
}
if (!m_fifo_in.empty()) {
BIT_SET(m_reg_int_cond, REG_INT_FIFO_AV_BIT);
@@ -1053,7 +1053,7 @@ void phi_device::update_fsm(void)
m_no_recursion = false;
}
-phi_device::nba_origin_t phi_device::nba_msg(uint8_t& new_byte , bool& new_eoi) const
+phi_device::nba_origin_t phi_device::nba_msg(uint8_t& new_byte, bool& new_eoi) const
{
if (controller_in_charge() && m_c_state == PHI_C_CACS && !m_fifo_out.empty()) {
uint16_t word = m_fifo_out.peek();
@@ -1070,14 +1070,14 @@ phi_device::nba_origin_t phi_device::nba_msg(uint8_t& new_byte , bool& new_eoi)
switch (m_t_state) {
case PHI_T_TACS:
- if (!BIT(m_reg_status , REG_STATUS_DATA_FREEZE_BIT) &&
- !BIT(m_reg_int_cond , REG_INT_DEV_CLEAR_BIT) &&
+ if (!BIT(m_reg_status, REG_STATUS_DATA_FREEZE_BIT) &&
+ !BIT(m_reg_int_cond, REG_INT_DEV_CLEAR_BIT) &&
!m_fifo_out.empty()) {
uint16_t word = m_fifo_out.peek();
- if (!BIT(word , REG_OFIFO_SPECIAL_BIT)) {
+ if (!BIT(word, REG_OFIFO_SPECIAL_BIT)) {
// Talker sends a data byte
new_byte = (uint8_t)word;
- new_eoi = BIT(word , REG_OFIFO_END_BIT);
+ new_eoi = BIT(word, REG_OFIFO_END_BIT);
return NBA_BYTE_FROM_OFIFO;
}
}
@@ -1131,7 +1131,7 @@ void phi_device::clear_nba(nba_origin_t origin)
bool phi_device::if_cmd_received(uint8_t byte)
{
- LOG("%.6f RX cmd: %02x\n" , machine().time().as_double() , byte);
+ LOG("%.6f RX cmd: %02x\n", machine().time().as_double(), byte);
bool accepted = true;
@@ -1264,9 +1264,9 @@ bool phi_device::if_cmd_received(uint8_t byte)
case PHI_SA_PACS:
if ((byte & IFCMD_PPX_MASK) == IFCMD_PPE_VALUE && m_pp_state == PHI_PP_PPIS) {
// PPE
- m_s_sense = BIT(byte , IFCMD_PPE_S_BIT);
+ m_s_sense = BIT(byte, IFCMD_PPE_S_BIT);
m_ppr_msg = byte & IFCMD_PPE_PPR_MASK;
- LOG("PPE s=%d ppr=%u\n" , m_s_sense , m_ppr_msg);
+ LOG("PPE s=%d ppr=%u\n", m_s_sense, m_ppr_msg);
m_pp_state = PHI_PP_PPSS;
} else if ((byte & IFCMD_PPX_MASK) == IFCMD_PPD_VALUE && m_pp_state == PHI_PP_PPSS) {
// PPD
@@ -1277,7 +1277,7 @@ bool phi_device::if_cmd_received(uint8_t byte)
case PHI_SA_TPAS:
case PHI_SA_LPAS:
// command is a secondary address after MTA or MLA
- if (m_fifo_in.full() || BIT(m_reg_int_cond , REG_INT_DEV_CLEAR_BIT)) {
+ if (m_fifo_in.full() || BIT(m_reg_int_cond, REG_INT_DEV_CLEAR_BIT)) {
// No room for secondary address in FIFO, stall handshake
accepted = false;
} else {
@@ -1304,7 +1304,7 @@ bool phi_device::if_cmd_received(uint8_t byte)
return accepted;
}
-bool phi_device::byte_received(uint8_t byte , bool eoi)
+bool phi_device::byte_received(uint8_t byte, bool eoi)
{
// Start with D0/D1 = 00
uint16_t word = byte;
@@ -1321,7 +1321,7 @@ bool phi_device::byte_received(uint8_t byte , bool eoi)
// Monitoring bytes being transferred on the bus
if (eoi) {
end_of_transfer = true;
- } else if (!BIT(be_word , REG_OFIFO_LF_INH_BIT) && byte == 0x0a) {
+ } else if (!BIT(be_word, REG_OFIFO_LF_INH_BIT) && byte == 0x0a) {
// LF received -> D0/D1 = 11
word |= REG_IFIFO_LAST_MASK;
end_of_transfer = true;
@@ -1332,10 +1332,10 @@ bool phi_device::byte_received(uint8_t byte , bool eoi)
}
}
- LOG("%.6f RX word:%04x\n" , machine().time().as_double() , word);
+ LOG("%.6f RX word:%04x\n", machine().time().as_double(), word);
if (m_l_state == PHI_L_LACS) {
- if (m_fifo_in.full() || BIT(m_reg_int_cond , REG_INT_DEV_CLEAR_BIT)) {
+ if (m_fifo_in.full() || BIT(m_reg_int_cond, REG_INT_DEV_CLEAR_BIT)) {
// No room for received byte, stall handshake
LOG_NOISY("..stalled\n");
return false;
@@ -1366,12 +1366,12 @@ void phi_device::rx_n_data_freeze(uint16_t word)
bool phi_device::ton_msg(void) const
{
- return BIT(m_reg_address , REG_ADDR_TA_BIT);
+ return BIT(m_reg_address, REG_ADDR_TA_BIT);
}
bool phi_device::lon_msg(void) const
{
- return BIT(m_reg_address , REG_ADDR_LA_BIT);
+ return BIT(m_reg_address, REG_ADDR_LA_BIT);
}
bool phi_device::odd_parity(uint8_t byte) const
@@ -1401,7 +1401,7 @@ bool phi_device::tcs_msg(void) const
// * There's an interface command to be sent at head of OFIFO
return (m_c_state == PHI_C_CSBS || m_c_state == PHI_C_CSHS || m_c_state == PHI_C_CSWS) &&
(rpp_msg() ||
- nba_msg(new_byte , new_eoi) == NBA_CMD_FROM_OFIFO);
+ nba_msg(new_byte, new_eoi) == NBA_CMD_FROM_OFIFO);
}
bool phi_device::rpp_msg(void) const
@@ -1437,9 +1437,9 @@ void phi_device::update_pp()
{
if (m_c_state == PHI_C_CPPS) {
if (m_fifo_in.empty() && get_pp_response()) {
- BIT_SET(m_reg_int_cond , REG_INT_PP_RESPONSE_BIT);
+ BIT_SET(m_reg_int_cond, REG_INT_PP_RESPONSE_BIT);
} else {
- BIT_CLR(m_reg_int_cond , REG_INT_PP_RESPONSE_BIT);
+ BIT_CLR(m_reg_int_cond, REG_INT_PP_RESPONSE_BIT);
}
update_interrupt();
}
@@ -1451,7 +1451,7 @@ void phi_device::update_interrupt()
bool int_line = false;
if (int_pending) {
BIT_SET(m_reg_int_cond, REG_INT_PENDING_BIT);
- if (BIT(m_reg_int_mask , REG_INT_PENDING_BIT)) {
+ if (BIT(m_reg_int_mask, REG_INT_PENDING_BIT)) {
int_line = true;
}
} else {
@@ -1459,7 +1459,7 @@ void phi_device::update_interrupt()
}
if (int_line != m_int_line) {
m_int_line = int_line;
- LOG_INT("INT %d\n" , m_int_line);
+ LOG_INT("INT %d\n", m_int_line);
m_int_write_func(m_int_line);
}
}
@@ -1467,14 +1467,14 @@ void phi_device::update_interrupt()
void phi_device::update_dmarq()
{
bool new_dmarq_line;
- if (BIT(m_reg_control , REG_CTRL_DMA_FIFO_BIT)) {
- new_dmarq_line = BIT(m_reg_int_cond , REG_INT_FIFO_ROOM_BIT);
+ if (BIT(m_reg_control, REG_CTRL_DMA_FIFO_BIT)) {
+ new_dmarq_line = BIT(m_reg_int_cond, REG_INT_FIFO_ROOM_BIT);
} else {
- new_dmarq_line = BIT(m_reg_int_cond , REG_INT_FIFO_AV_BIT);
+ new_dmarq_line = BIT(m_reg_int_cond, REG_INT_FIFO_AV_BIT);
}
if (new_dmarq_line != m_dmarq_line) {
m_dmarq_line = new_dmarq_line;
- LOG_INT("DRQ %d\n" , m_dmarq_line);
+ LOG_INT("DRQ %d\n", m_dmarq_line);
m_dmarq_write_func(m_dmarq_line);
}
}
diff --git a/src/devices/machine/phi.h b/src/devices/machine/phi.h
index 6e6e1cf54cf..4eb74b6bbca 100644
--- a/src/devices/machine/phi.h
+++ b/src/devices/machine/phi.h
@@ -36,14 +36,14 @@ public:
auto dio_read_cb() { return m_dio_read_func.bind(); }
auto dio_write_cb() { return m_dio_write_func.bind(); }
// Set write callbacks to access uniline signals on IEEE-488
- auto eoi_write_cb() { return m_signal_wr_fns[ PHI_488_EOI ].bind(); }
- auto dav_write_cb() { return m_signal_wr_fns[ PHI_488_DAV ].bind(); }
- auto nrfd_write_cb() { return m_signal_wr_fns[ PHI_488_NRFD ].bind(); }
- auto ndac_write_cb() { return m_signal_wr_fns[ PHI_488_NDAC ].bind(); }
- auto ifc_write_cb() { return m_signal_wr_fns[ PHI_488_IFC ].bind(); }
- auto srq_write_cb() { return m_signal_wr_fns[ PHI_488_SRQ ].bind(); }
- auto atn_write_cb() { return m_signal_wr_fns[ PHI_488_ATN ].bind(); }
- auto ren_write_cb() { return m_signal_wr_fns[ PHI_488_REN ].bind(); }
+ auto eoi_write_cb() { return m_signal_wr_fns[PHI_488_EOI].bind(); }
+ auto dav_write_cb() { return m_signal_wr_fns[PHI_488_DAV].bind(); }
+ auto nrfd_write_cb() { return m_signal_wr_fns[PHI_488_NRFD].bind(); }
+ auto ndac_write_cb() { return m_signal_wr_fns[PHI_488_NDAC].bind(); }
+ auto ifc_write_cb() { return m_signal_wr_fns[PHI_488_IFC].bind(); }
+ auto srq_write_cb() { return m_signal_wr_fns[PHI_488_SRQ].bind(); }
+ auto atn_write_cb() { return m_signal_wr_fns[PHI_488_ATN].bind(); }
+ auto ren_write_cb() { return m_signal_wr_fns[PHI_488_REN].bind(); }
// Set write callback for INT signal
auto int_write_cb() { return m_int_write_func.bind(); }
// Set write callback for DMARQ signal
@@ -62,7 +62,7 @@ public:
void bus_dio_w(uint8_t data);
- void set_ext_signal(phi_488_signal_t signal , int state);
+ void set_ext_signal(phi_488_signal_t signal, int state);
// Register read/write
// Mapping of PHI register bits:
@@ -95,7 +95,8 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(delayed_update);
private:
// Depth of inbound/outbound FIFOs
@@ -113,8 +114,8 @@ private:
// Internal copy of bus signals
// These signals have the "right" polarity (i.e. the opposite of bus signals, 1=L)
uint8_t m_dio;
- bool m_signals[ PHI_488_SIGNAL_COUNT ];
- bool m_ext_signals[ PHI_488_SIGNAL_COUNT ];
+ bool m_signals[PHI_488_SIGNAL_COUNT];
+ bool m_ext_signals[PHI_488_SIGNAL_COUNT];
bool m_no_recursion;
@@ -227,8 +228,8 @@ private:
uint16_t m_reg_2nd_id;
uint16_t m_reg_control;
uint16_t m_reg_address;
- util::fifo<uint16_t , FIFO_SIZE> m_fifo_in;
- util::fifo<uint16_t , FIFO_SIZE> m_fifo_out;
+ util::fifo<uint16_t, FIFO_SIZE> m_fifo_in;
+ util::fifo<uint16_t, FIFO_SIZE> m_fifo_out;
typedef enum {
NBA_NONE,
@@ -245,20 +246,20 @@ private:
emu_timer *m_sh_dly_timer;
emu_timer *m_c_dly_timer;
- void int_reg_w(offs_t offset , uint16_t data);
+ void int_reg_w(offs_t offset, uint16_t data);
uint8_t get_dio(void);
void set_dio(uint8_t data);
bool get_signal(phi_488_signal_t signal);
- void set_signal(phi_488_signal_t signal , bool state);
+ void set_signal(phi_488_signal_t signal, bool state);
void pon_msg(void);
void update_488(void);
void update_fsm(void);
- nba_origin_t nba_msg(uint8_t& new_byte , bool& new_eoi) const;
+ nba_origin_t nba_msg(uint8_t& new_byte, bool& new_eoi) const;
void clear_nba(nba_origin_t origin);
bool if_cmd_received(uint8_t byte);
- bool byte_received(uint8_t byte , bool eoi);
+ bool byte_received(uint8_t byte, bool eoi);
void rx_n_data_freeze(uint16_t word);
bool ton_msg(void) const;
bool lon_msg(void) const;
diff --git a/src/devices/machine/pic8259.cpp b/src/devices/machine/pic8259.cpp
index 591336e4a20..385f38cfbdb 100644
--- a/src/devices/machine/pic8259.cpp
+++ b/src/devices/machine/pic8259.cpp
@@ -29,7 +29,7 @@
ALLOW_SAVE_TYPE(pic8259_device::state_t); // allow save_item on a non-fundamental type
-void pic8259_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(pic8259_device::irq_timer_tick)
{
/* check the various IRQs */
for (int n = 0, irq = m_prio; n < 8; n++, irq = (irq + 1) & 7)
@@ -84,7 +84,7 @@ void pic8259_device::set_irq_line(int irq, int state)
}
if (m_inta_sequence == 0)
- set_timer();
+ m_irq_timer->adjust(attotime::zero);
}
@@ -105,7 +105,7 @@ uint8_t pic8259_device::acknowledge()
if (!m_auto_eoi)
m_isr |= mask;
- set_timer();
+ m_irq_timer->adjust(attotime::zero);
}
if ((m_cascade!=0) && (m_master!=0) && (mask & m_slave))
@@ -167,7 +167,7 @@ uint8_t pic8259_device::acknowledge()
m_inta_sequence = 0;
if (m_auto_eoi && m_current_level != -1)
m_isr &= ~(1 << m_current_level);
- set_timer();
+ m_irq_timer->adjust(attotime::zero);
}
if (m_cascade && m_master && m_current_level != -1 && BIT(m_slave, m_current_level))
return m_read_slave_ack_func(m_current_level);
@@ -205,7 +205,7 @@ uint8_t pic8259_device::read(offs_t offset)
if (!m_auto_eoi)
m_isr |= 1 << m_current_level;
- set_timer();
+ m_irq_timer->adjust(attotime::zero);
}
}
else
@@ -376,7 +376,7 @@ void pic8259_device::write(offs_t offset, uint8_t data)
}
break;
}
- set_timer();
+ m_irq_timer->adjust(attotime::zero);
}
@@ -427,6 +427,8 @@ void pic8259_device::device_start()
save_item(NAME(m_inta_sequence));
m_inta_sequence = 0;
+
+ m_irq_timer = timer_alloc(FUNC(pic8259_device::irq_timer_tick), this);
}
diff --git a/src/devices/machine/pic8259.h b/src/devices/machine/pic8259.h
index daa846b871e..333cadced09 100644
--- a/src/devices/machine/pic8259.h
+++ b/src/devices/machine/pic8259.h
@@ -59,17 +59,14 @@ protected:
virtual void device_resolve_objects() override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual bool is_x86() const { return m_is_x86; }
-private:
- static constexpr device_timer_id TIMER_CHECK_IRQ = 0;
+ TIMER_CALLBACK_MEMBER(irq_timer_tick);
- inline void set_timer() { timer_set(attotime::zero, TIMER_CHECK_IRQ); }
+private:
void set_irq_line(int irq, int state);
-
enum class state_t : u8
{
ICW1,
@@ -83,6 +80,7 @@ private:
devcb_read_line m_in_sp_func;
devcb_read8 m_read_slave_ack_func;
+ emu_timer *m_irq_timer;
state_t m_state;
uint8_t m_isr;
diff --git a/src/devices/machine/pit8253.cpp b/src/devices/machine/pit8253.cpp
index f09684f782a..fc7c79cc289 100644
--- a/src/devices/machine/pit8253.cpp
+++ b/src/devices/machine/pit8253.cpp
@@ -112,8 +112,8 @@ void pit8253_device::device_resolve_objects()
void pit_counter_device::device_start()
{
- /* initialize timer */
- m_updatetimer = timer_alloc(TID_UPDATE);
+ /* initialize timers */
+ m_update_timer = timer_alloc(FUNC(pit_counter_device::update_tick), this);
adjust_timer(attotime::never);
/* set up state save values */
@@ -204,7 +204,7 @@ inline void pit_counter_device::adjust_timer(attotime target)
// if (target != m_next_update)
{
m_next_update = target;
- m_updatetimer->adjust(target - machine().time());
+ m_update_timer->adjust(target - machine().time());
}
}
@@ -972,30 +972,15 @@ void pit8254_device::readback_command(uint8_t data)
m_counter[timer]->readback(read_command);
}
-void pit_counter_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(pit_counter_device::update_tick)
{
update();
- switch (id)
- {
- case TID_UPDATE:
- break;
-
- case TID_CONTROL:
- control_w_deferred(param);
- break;
-
- case TID_COUNT:
- count_w_deferred(param);
- break;
-
- case TID_GATE:
- gate_w_deferred(param);
- break;
- }
}
-void pit_counter_device::control_w_deferred(uint8_t data)
+TIMER_CALLBACK_MEMBER(pit_counter_device::control_w_deferred)
{
+ update();
+ uint8_t data = (uint8_t)param;
if (CTRL_ACCESS(data) == 0)
{
LOG1("write(): readback\n");
@@ -1017,8 +1002,10 @@ void pit_counter_device::control_w_deferred(uint8_t data)
}
}
-void pit_counter_device::count_w_deferred(uint8_t data)
+TIMER_CALLBACK_MEMBER(pit_counter_device::count_w_deferred)
{
+ update();
+ uint8_t data = (uint8_t)param;
bool middle_of_a_cycle = (machine().time() > m_last_updated && m_clockin != 0);
switch (CTRL_ACCESS(m_control))
@@ -1102,8 +1089,10 @@ void pit8253_device::write(offs_t offset, uint8_t data)
m_counter[offset]->count_w(data);
}
-void pit_counter_device::gate_w_deferred(int state)
+TIMER_CALLBACK_MEMBER(pit_counter_device::gate_w_deferred)
{
+ update();
+ int state = param;
LOG2("gate_w(): state=%d\n", state);
if (state != m_gate)
diff --git a/src/devices/machine/pit8253.h b/src/devices/machine/pit8253.h
index 430563ebebf..0c069a217d8 100644
--- a/src/devices/machine/pit8253.h
+++ b/src/devices/machine/pit8253.h
@@ -42,14 +42,6 @@ class pit_counter_device : public device_t
friend class pit8253_device;
friend class pit8254_device;
- enum
- {
- TID_UPDATE = 1,
- TID_CONTROL,
- TID_COUNT,
- TID_GATE
- };
-
public:
// construction/destruction
pit_counter_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
@@ -58,7 +50,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
private:
inline uint32_t adjusted_count() const;
@@ -67,17 +58,18 @@ private:
void load_counter_value();
void set_output(int output);
void simulate(int64_t elapsed_cycles);
+ TIMER_CALLBACK_MEMBER(update_tick);
void update();
uint16_t masked_value() const;
uint8_t read();
void load_count(uint16_t newcount);
void readback(int command);
- void control_w(uint8_t data) { synchronize(TID_CONTROL, data); }
- void control_w_deferred(uint8_t data);
- void count_w(uint8_t data) { synchronize(TID_COUNT, data); }
- void count_w_deferred(uint8_t data);
- void gate_w(int state) { synchronize(TID_GATE, state); }
- void gate_w_deferred(int state);
+ void control_w(uint8_t data) { machine().scheduler().synchronize(timer_expired_delegate(FUNC(pit_counter_device::control_w_deferred), this), data); }
+ TIMER_CALLBACK_MEMBER(control_w_deferred);
+ void count_w(uint8_t data) { machine().scheduler().synchronize(timer_expired_delegate(FUNC(pit_counter_device::count_w_deferred), this), data); }
+ TIMER_CALLBACK_MEMBER(count_w_deferred);
+ void gate_w(int state) { machine().scheduler().synchronize(timer_expired_delegate(FUNC(pit_counter_device::gate_w_deferred), this), state); }
+ TIMER_CALLBACK_MEMBER(gate_w_deferred);
void set_clock_signal(int state);
void set_clockin(double new_clockin);
@@ -90,7 +82,7 @@ private:
attotime m_last_updated; // time when last updated
attotime m_next_update; // time of next update
- emu_timer *m_updatetimer; // MAME timer to process updates
+ emu_timer *m_update_timer; // MAME timer to process updates
uint16_t m_value; // current counter value ("CE" in Intel docs)
uint16_t m_latch; // latched counter value ("OL" in Intel docs)
diff --git a/src/devices/machine/ps2timer.cpp b/src/devices/machine/ps2timer.cpp
index 2f7111b1a22..667fed7622c 100644
--- a/src/devices/machine/ps2timer.cpp
+++ b/src/devices/machine/ps2timer.cpp
@@ -42,10 +42,10 @@ ps2_timer_device::ps2_timer_device(const machine_config &mconfig, const char *ta
void ps2_timer_device::device_start()
{
if (!m_compare_timer)
- m_compare_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ps2_timer_device::compare), this));
+ m_compare_timer = timer_alloc(FUNC(ps2_timer_device::compare), this);
if (!m_overflow_timer)
- m_overflow_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ps2_timer_device::overflow), this));
+ m_overflow_timer = timer_alloc(FUNC(ps2_timer_device::overflow), this);
}
void ps2_timer_device::device_reset()
diff --git a/src/devices/machine/pxa255.cpp b/src/devices/machine/pxa255.cpp
index 55aba8af310..d387347dd98 100644
--- a/src/devices/machine/pxa255.cpp
+++ b/src/devices/machine/pxa255.cpp
@@ -57,7 +57,7 @@ pxa255_periphs_device::pxa255_periphs_device(const machine_config &mconfig, cons
uint32_t pxa255_periphs_device::i2s_r(offs_t offset, uint32_t mem_mask)
{
- switch(PXA255_I2S_BASE_ADDR | (offset << 2))
+ switch (PXA255_I2S_BASE_ADDR | (offset << 2))
{
case PXA255_SACR0:
LOGMASKED(LOG_I2S, "pxa255_i2s_r: Serial Audio Controller Global Control Register: %08x & %08x\n", m_i2s_regs.sacr0, mem_mask);
@@ -89,7 +89,7 @@ uint32_t pxa255_periphs_device::i2s_r(offs_t offset, uint32_t mem_mask)
void pxa255_periphs_device::i2s_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
- switch(PXA255_I2S_BASE_ADDR | (offset << 2))
+ switch (PXA255_I2S_BASE_ADDR | (offset << 2))
{
case PXA255_SACR0:
LOGMASKED(LOG_I2S, "pxa255_i2s_w: Serial Audio Controller Global Control Register: %08x & %08x\n", data, mem_mask);
@@ -109,11 +109,11 @@ void pxa255_periphs_device::i2s_w(offs_t offset, uint32_t data, uint32_t mem_mas
break;
case PXA255_SAICR:
LOGMASKED(LOG_I2S, "pxa255_i2s_w: Serial Audio Interrupt Clear Register: %08x & %08x\n", data, mem_mask);
- if(m_i2s_regs.saicr & PXA255_SAICR_ROR)
+ if (m_i2s_regs.saicr & PXA255_SAICR_ROR)
{
m_i2s_regs.sasr0 &= ~PXA255_SASR0_ROR;
}
- if(m_i2s_regs.saicr & PXA255_SAICR_TUR)
+ if (m_i2s_regs.saicr & PXA255_SAICR_TUR)
{
m_i2s_regs.sasr0 &= ~PXA255_SASR0_TUR;
}
@@ -182,7 +182,7 @@ void pxa255_periphs_device::dma_load_descriptor_and_start(int channel)
m_dma_regs.ddadr[channel] = space.read_dword(m_dma_regs.ddadr[channel]);
// Start our end-of-transfer timer
- switch(channel)
+ switch (channel)
{
case 3:
m_dma_regs.timer[channel]->adjust(attotime::from_hz((147600000 / m_i2s_regs.sadiv) / (4 * 64)) * (m_dma_regs.dcmd[channel] & 0x00001fff), channel);
@@ -193,7 +193,7 @@ void pxa255_periphs_device::dma_load_descriptor_and_start(int channel)
}
// Interrupt as necessary
- if(m_dma_regs.dcmd[channel] & PXA255_DCMD_STARTIRQEN)
+ if (m_dma_regs.dcmd[channel] & PXA255_DCMD_STARTIRQEN)
{
m_dma_regs.dcsr[channel] |= PXA255_DCSR_STARTINTR;
}
@@ -201,89 +201,69 @@ void pxa255_periphs_device::dma_load_descriptor_and_start(int channel)
m_dma_regs.dcsr[channel] &= ~PXA255_DCSR_STOPSTATE;
}
-void pxa255_periphs_device::dma_end_tick(int channel)
+TIMER_CALLBACK_MEMBER(pxa255_periphs_device::audio_dma_end_tick)
{
- uint32_t sadr = m_dma_regs.dsadr[channel];
- uint32_t tadr = m_dma_regs.dtadr[channel];
- uint32_t count = m_dma_regs.dcmd[channel] & 0x00001fff;
-
address_space &space = m_maincpu->space(AS_PROGRAM);
- switch (channel)
+ const uint32_t count = m_dma_regs.dcmd[3] & 0x00001fff;
+ uint32_t sadr = m_dma_regs.dsadr[3];
+
+ int16_t *out_samples = &m_samples[0];
+ for (uint32_t index = 0; index < count; index += 4, sadr += 4)
{
- case 3:
- for (uint32_t index = 0; index < count; index += 4)
- {
- m_words[index >> 2] = space.read_dword(sadr);
- m_samples[(index >> 1) + 0] = (int16_t)(m_words[index >> 2] >> 16);
- m_samples[(index >> 1) + 1] = (int16_t)(m_words[index >> 2] & 0xffff);
- sadr += 4;
- }
- for (int index = 0; index < 2; index++)
- {
- m_dmadac[index]->flush();
- m_dmadac[index]->transfer(index, 2, 2, count/4, m_samples.get());
- }
- break;
- default:
- for (uint32_t index = 0; index < count;)
- {
- switch (m_dma_regs.dcmd[channel] & PXA255_DCMD_SIZE)
- {
- case PXA255_DCMD_SIZE_8:
- space.write_byte(tadr, space.read_byte(sadr));
- index++;
- break;
- case PXA255_DCMD_SIZE_16:
- space.write_word(tadr, space.read_word(sadr));
- index += 2;
- break;
- case PXA255_DCMD_SIZE_32:
- space.write_dword(tadr, space.read_dword(sadr));
- index += 4;
- break;
- default:
- logerror( "pxa255_dma_dma_end: Unsupported DMA size\n" );
- break;
- }
+ const uint32_t word = space.read_dword(sadr);
+ *out_samples++ = (int16_t)(word >> 16);
+ *out_samples++ = (int16_t)(word & 0xffff);
+ }
- if (m_dma_regs.dcmd[channel] & PXA255_DCMD_INCSRCADDR)
- {
- switch(m_dma_regs.dcmd[channel] & PXA255_DCMD_SIZE)
- {
- case PXA255_DCMD_SIZE_8:
- sadr++;
- break;
- case PXA255_DCMD_SIZE_16:
- sadr += 2;
- break;
- case PXA255_DCMD_SIZE_32:
- sadr += 4;
- break;
- default:
- break;
- }
- }
- if(m_dma_regs.dcmd[channel] & PXA255_DCMD_INCTRGADDR)
- {
- switch(m_dma_regs.dcmd[channel] & PXA255_DCMD_SIZE)
- {
- case PXA255_DCMD_SIZE_8:
- tadr++;
- break;
- case PXA255_DCMD_SIZE_16:
- tadr += 2;
- break;
- case PXA255_DCMD_SIZE_32:
- tadr += 4;
- break;
- default:
- break;
- }
- }
- }
- break;
+ for (int index = 0; index < 2; index++)
+ {
+ m_dmadac[index]->flush();
+ m_dmadac[index]->transfer(index, 2, 2, count/4, m_samples.get());
}
+ dma_finish(param);
+}
+
+TIMER_CALLBACK_MEMBER(pxa255_periphs_device::dma_end_tick)
+{
+ address_space &space = m_maincpu->space(AS_PROGRAM);
+ const uint32_t count = m_dma_regs.dcmd[param] & 0x00001fff;
+ uint32_t sadr = m_dma_regs.dsadr[param];
+ uint32_t tadr = m_dma_regs.dtadr[param];
+
+ static const uint32_t s_inc_size[4] = { 0, 1, 2, 4 };
+ const uint32_t inc_index = (m_dma_regs.dcmd[param] >> PXA255_DCMD_SIZE_SHIFT) & PXA255_DCMD_SIZE_MASK;
+ const uint32_t inc_val = s_inc_size[inc_index];
+ const uint32_t sadr_inc = (m_dma_regs.dcmd[param] & PXA255_DCMD_INCSRCADDR) ? inc_val : 0;
+ const uint32_t tadr_inc = (m_dma_regs.dcmd[param] & PXA255_DCMD_INCTRGADDR) ? inc_val : 0;
+
+ if (inc_val > 0)
+ {
+ switch (inc_val)
+ {
+ case PXA255_DCMD_SIZE_8:
+ for (uint32_t index = 0; index < count; index += inc_val, sadr += sadr_inc, tadr += tadr_inc)
+ space.write_byte(tadr, space.read_byte(sadr));
+ break;
+ case PXA255_DCMD_SIZE_16:
+ for (uint32_t index = 0; index < count; index += inc_val, sadr += sadr_inc, tadr += tadr_inc)
+ space.write_word(tadr, space.read_byte(sadr));
+ break;
+ case PXA255_DCMD_SIZE_32:
+ for (uint32_t index = 0; index < count; index += inc_val, sadr += sadr_inc, tadr += tadr_inc)
+ space.write_dword(tadr, space.read_byte(sadr));
+ break;
+ default:
+ logerror( "pxa255_dma_dma_end: Unsupported DMA size\n" );
+ break;
+ }
+ }
+
+ dma_finish(param);
+}
+
+void pxa255_periphs_device::dma_finish(int channel)
+{
if (m_dma_regs.dcmd[channel] & PXA255_DCMD_ENDIRQEN)
{
m_dma_regs.dcsr[channel] |= PXA255_DCSR_ENDINTR;
@@ -312,7 +292,7 @@ void pxa255_periphs_device::dma_end_tick(int channel)
uint32_t pxa255_periphs_device::dma_r(offs_t offset, uint32_t mem_mask)
{
- switch(PXA255_DMA_BASE_ADDR | (offset << 2))
+ switch (PXA255_DMA_BASE_ADDR | (offset << 2))
{
case PXA255_DCSR0: case PXA255_DCSR1: case PXA255_DCSR2: case PXA255_DCSR3:
case PXA255_DCSR4: case PXA255_DCSR5: case PXA255_DCSR6: case PXA255_DCSR7:
@@ -389,7 +369,7 @@ void pxa255_periphs_device::dma_w(offs_t offset, uint32_t data, uint32_t mem_mas
dma_load_descriptor_and_start(offset);
}
- else if(!(data & PXA255_DCSR_RUN))
+ else if (!(data & PXA255_DCSR_RUN))
{
m_dma_regs.dcsr[offset] &= ~PXA255_DCSR_RUN;
}
@@ -455,7 +435,7 @@ void pxa255_periphs_device::dma_w(offs_t offset, uint32_t data, uint32_t mem_mas
*/
-void pxa255_periphs_device::rtc_tick()
+TIMER_CALLBACK_MEMBER(pxa255_periphs_device::rtc_tick)
{
m_rtc_regs.rcnr++;
if (BIT(m_rtc_regs.rtsr, 3))
@@ -476,7 +456,7 @@ void pxa255_periphs_device::rtc_tick()
uint32_t pxa255_periphs_device::rtc_r(offs_t offset, uint32_t mem_mask)
{
- switch(PXA255_RTC_BASE_ADDR | (offset << 2))
+ switch (PXA255_RTC_BASE_ADDR | (offset << 2))
{
case PXA255_RCNR:
LOGMASKED(LOG_RTC, "%s: pxa255 rtc_r: RTC Counter Register: %08x\n", machine().describe_context(), m_rtc_regs.rcnr);
@@ -499,7 +479,7 @@ uint32_t pxa255_periphs_device::rtc_r(offs_t offset, uint32_t mem_mask)
void pxa255_periphs_device::rtc_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
- switch(PXA255_RTC_BASE_ADDR | (offset << 2))
+ switch (PXA255_RTC_BASE_ADDR | (offset << 2))
{
case PXA255_RCNR:
LOGMASKED(LOG_RTC, "pxa255 rtc_w: RTC Counter Register: %08x & %08x\n", machine().describe_context(), data, mem_mask);
@@ -552,16 +532,16 @@ void pxa255_periphs_device::ostimer_irq_check()
//set_irq_line(PXA255_INT_OSTIMER3, (m_ostimer_regs.oier & PXA255_OIER_E3) ? ((m_ostimer_regs.ossr & PXA255_OSSR_M3) ? 1 : 0) : 0);
}
-void pxa255_periphs_device::ostimer_match_tick(int channel)
+TIMER_CALLBACK_MEMBER(pxa255_periphs_device::ostimer_match_tick)
{
- m_ostimer_regs.ossr |= (1 << channel);
- m_ostimer_regs.oscr = m_ostimer_regs.osmr[channel];
+ m_ostimer_regs.ossr |= (1 << param);
+ m_ostimer_regs.oscr = m_ostimer_regs.osmr[param];
ostimer_irq_check();
}
uint32_t pxa255_periphs_device::ostimer_r(offs_t offset, uint32_t mem_mask)
{
- switch(PXA255_OSTMR_BASE_ADDR | (offset << 2))
+ switch (PXA255_OSTMR_BASE_ADDR | (offset << 2))
{
case PXA255_OSMR0:
LOGMASKED(LOG_OSTIMER, "pxa255_ostimer_r: OS Timer Match Register 0: %08x & %08x\n", m_ostimer_regs.osmr[0], mem_mask);
@@ -598,14 +578,14 @@ uint32_t pxa255_periphs_device::ostimer_r(offs_t offset, uint32_t mem_mask)
void pxa255_periphs_device::ostimer_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
- switch(PXA255_OSTMR_BASE_ADDR | (offset << 2))
+ switch (PXA255_OSTMR_BASE_ADDR | (offset << 2))
{
case PXA255_OSMR0:
LOGMASKED(LOG_OSTIMER, "pxa255_ostimer_w: OS Timer Match Register 0: %08x & %08x\n", data, mem_mask);
m_ostimer_regs.osmr[0] = data;
if (m_ostimer_regs.oier & PXA255_OIER_E0)
{
- m_ostimer_regs.timer[0]->adjust(attotime::from_hz(3846400) * (m_ostimer_regs.osmr[0] - m_ostimer_regs.oscr));
+ m_ostimer_regs.timer[0]->adjust(attotime::from_hz(3846400) * (m_ostimer_regs.osmr[0] - m_ostimer_regs.oscr), 0);
}
break;
case PXA255_OSMR1:
@@ -828,7 +808,7 @@ void pxa255_periphs_device::gpio_bit_w(offs_t offset, uint8_t data, uint8_t mem_
uint32_t pxa255_periphs_device::gpio_r(offs_t offset, uint32_t mem_mask)
{
- switch(PXA255_GPIO_BASE_ADDR | (offset << 2))
+ switch (PXA255_GPIO_BASE_ADDR | (offset << 2))
{
case PXA255_GPLR0:
{
@@ -929,7 +909,7 @@ uint32_t pxa255_periphs_device::gpio_r(offs_t offset, uint32_t mem_mask)
void pxa255_periphs_device::gpio_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
- switch(PXA255_GPIO_BASE_ADDR | (offset << 2))
+ switch (PXA255_GPIO_BASE_ADDR | (offset << 2))
{
case PXA255_GPLR0:
LOGMASKED(LOG_GPIO, "pxa255_gpio_w: (Invalid Write) GPIO Pin-Level Register 0: %08x & %08x\n", data, mem_mask);
@@ -1093,7 +1073,7 @@ void pxa255_periphs_device::lcd_load_dma_descriptor(address_space & space, uint3
void pxa255_periphs_device::lcd_irq_check()
{
- if(((m_lcd_regs.lcsr & PXA255_LCSR_BS) != 0 && (m_lcd_regs.lccr0 & PXA255_LCCR0_BM) == 0) ||
+ if (((m_lcd_regs.lcsr & PXA255_LCSR_BS) != 0 && (m_lcd_regs.lccr0 & PXA255_LCCR0_BM) == 0) ||
((m_lcd_regs.lcsr & PXA255_LCSR_EOF) != 0 && (m_lcd_regs.lccr0 & PXA255_LCCR0_EFM) == 0) ||
((m_lcd_regs.lcsr & PXA255_LCSR_SOF) != 0 && (m_lcd_regs.lccr0 & PXA255_LCCR0_SFM) == 0))
{
@@ -1107,20 +1087,20 @@ void pxa255_periphs_device::lcd_irq_check()
void pxa255_periphs_device::lcd_dma_kickoff(int channel)
{
- if(m_lcd_regs.dma[channel].fdadr != 0)
+ if (m_lcd_regs.dma[channel].fdadr != 0)
{
attotime period = attotime::from_hz(20000000) * (m_lcd_regs.dma[channel].ldcmd & 0x000fffff);
m_lcd_regs.dma[channel].eof->adjust(period, channel);
- if(m_lcd_regs.dma[channel].ldcmd & PXA255_LDCMD_SOFINT)
+ if (m_lcd_regs.dma[channel].ldcmd & PXA255_LDCMD_SOFINT)
{
m_lcd_regs.liidr = m_lcd_regs.dma[channel].fidr;
m_lcd_regs.lcsr |= PXA255_LCSR_SOF;
lcd_irq_check();
}
- if(m_lcd_regs.dma[channel].ldcmd & PXA255_LDCMD_PAL)
+ if (m_lcd_regs.dma[channel].ldcmd & PXA255_LDCMD_PAL)
{
address_space &space = m_maincpu->space(AS_PROGRAM);
int length = m_lcd_regs.dma[channel].ldcmd & 0x000fffff;
@@ -1147,7 +1127,7 @@ void pxa255_periphs_device::lcd_dma_kickoff(int channel)
void pxa255_periphs_device::lcd_check_load_next_branch(int channel)
{
- if(m_lcd_regs.fbr[channel] & 1)
+ if (m_lcd_regs.fbr[channel] & 1)
{
LOGMASKED(LOG_LCD_DMA, "lcd_check_load_next_branch: Taking branch\n" );
m_lcd_regs.fbr[channel] &= ~1;
@@ -1157,10 +1137,10 @@ void pxa255_periphs_device::lcd_check_load_next_branch(int channel)
lcd_load_dma_descriptor(space, m_lcd_regs.fbr[channel] & 0xfffffff0, 0);
m_lcd_regs.fbr[channel] = (space.read_dword(m_lcd_regs.fbr[channel] & 0xfffffff0) & 0xfffffff0) | (m_lcd_regs.fbr[channel] & 0x00000003);
lcd_dma_kickoff(0);
- if(m_lcd_regs.fbr[channel] & 2)
+ if (m_lcd_regs.fbr[channel] & 2)
{
m_lcd_regs.fbr[channel] &= ~2;
- if(!(m_lcd_regs.lccr0 & PXA255_LCCR0_BM))
+ if (!(m_lcd_regs.lccr0 & PXA255_LCCR0_BM))
{
m_lcd_regs.lcsr |= PXA255_LCSR_BS;
}
@@ -1172,21 +1152,21 @@ void pxa255_periphs_device::lcd_check_load_next_branch(int channel)
}
}
-void pxa255_periphs_device::lcd_dma_eof_tick(int channel)
+TIMER_CALLBACK_MEMBER(pxa255_periphs_device::lcd_dma_eof_tick)
{
LOGMASKED(LOG_LCD_DMA, "End of frame callback\n" );
- if(m_lcd_regs.dma[channel].ldcmd & PXA255_LDCMD_EOFINT)
+ if (m_lcd_regs.dma[param].ldcmd & PXA255_LDCMD_EOFINT)
{
- m_lcd_regs.liidr = m_lcd_regs.dma[channel].fidr;
+ m_lcd_regs.liidr = m_lcd_regs.dma[param].fidr;
m_lcd_regs.lcsr |= PXA255_LCSR_EOF;
}
- lcd_check_load_next_branch(channel);
+ lcd_check_load_next_branch(param);
lcd_irq_check();
}
uint32_t pxa255_periphs_device::lcd_r(offs_t offset, uint32_t mem_mask)
{
- switch(PXA255_LCD_BASE_ADDR | (offset << 2))
+ switch (PXA255_LCD_BASE_ADDR | (offset << 2))
{
case PXA255_LCCR0: // 0x44000000
LOGMASKED(LOG_LCD, "pxa255_lcd_r: LCD Control 0: %08x & %08x\n", m_lcd_regs.lccr0, mem_mask);
@@ -1251,7 +1231,7 @@ uint32_t pxa255_periphs_device::lcd_r(offs_t offset, uint32_t mem_mask)
void pxa255_periphs_device::lcd_w(address_space &space, offs_t offset, uint32_t data, uint32_t mem_mask)
{
- switch(PXA255_LCD_BASE_ADDR | (offset << 2))
+ switch (PXA255_LCD_BASE_ADDR | (offset << 2))
{
case PXA255_LCCR0: // 0x44000000
LOGMASKED(LOG_LCD, "pxa255_lcd_w: LCD Control 0: %08x & %08x\n", data, mem_mask);
@@ -1272,7 +1252,7 @@ void pxa255_periphs_device::lcd_w(address_space &space, offs_t offset, uint32_t
case PXA255_FBR0: // 0x44000020
LOGMASKED(LOG_LCD, "pxa255_lcd_w: LCD Frame Branch Register 0: %08x & %08x\n", data, mem_mask);
m_lcd_regs.fbr[0] = data & 0xfffffff3;
- if(!m_lcd_regs.dma[0].eof->enabled())
+ if (!m_lcd_regs.dma[0].eof->enabled())
{
LOGMASKED(LOG_LCD, "ch0 EOF timer is not enabled, taking branch now\n" );
lcd_check_load_next_branch(0);
@@ -1282,7 +1262,7 @@ void pxa255_periphs_device::lcd_w(address_space &space, offs_t offset, uint32_t
case PXA255_FBR1: // 0x44000024
LOGMASKED(LOG_LCD, "pxa255_lcd_w: LCD Frame Branch Register 1: %08x & %08x\n", data, mem_mask);
m_lcd_regs.fbr[1] = data & 0xfffffff3;
- if(!m_lcd_regs.dma[1].eof->enabled())
+ if (!m_lcd_regs.dma[1].eof->enabled())
{
LOGMASKED(LOG_LCD, "ch1 EOF timer is not enabled, taking branch now\n" );
lcd_check_load_next_branch(1);
@@ -1307,7 +1287,7 @@ void pxa255_periphs_device::lcd_w(address_space &space, offs_t offset, uint32_t
break;
case PXA255_FDADR0: // 0x44000200
LOGMASKED(LOG_LCD, "pxa255_lcd_w: LCD DMA Frame Descriptor Address Register 0: %08x & %08x\n", data, mem_mask);
- if(!m_lcd_regs.dma[0].eof->enabled())
+ if (!m_lcd_regs.dma[0].eof->enabled())
{
lcd_load_dma_descriptor(space, data & 0xfffffff0, 0);
}
@@ -1328,7 +1308,7 @@ void pxa255_periphs_device::lcd_w(address_space &space, offs_t offset, uint32_t
break;
case PXA255_FDADR1: // 0x44000210
LOGMASKED(LOG_LCD, "pxa255_lcd_w: LCD DMA Frame Descriptor Address Register 1: %08x & %08x\n", data, mem_mask);
- if(!m_lcd_regs.dma[1].eof->enabled())
+ if (!m_lcd_regs.dma[1].eof->enabled())
{
lcd_load_dma_descriptor(space, data & 0xfffffff0, 1);
}
@@ -1355,7 +1335,7 @@ void pxa255_periphs_device::lcd_w(address_space &space, offs_t offset, uint32_t
uint32_t pxa255_periphs_device::power_r(offs_t offset, uint32_t mem_mask)
{
- switch(PXA255_POWER_BASE_ADDR | (offset << 2))
+ switch (PXA255_POWER_BASE_ADDR | (offset << 2))
{
case PXA255_PMCR:
LOGMASKED(LOG_POWER, "%s: power_r: Power Manager Control Register: %08x\n", machine().describe_context(), m_power_regs.pmcr);
@@ -1405,7 +1385,7 @@ uint32_t pxa255_periphs_device::power_r(offs_t offset, uint32_t mem_mask)
void pxa255_periphs_device::power_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
- switch(PXA255_POWER_BASE_ADDR | (offset << 2))
+ switch (PXA255_POWER_BASE_ADDR | (offset << 2))
{
case PXA255_PMCR:
LOGMASKED(LOG_POWER, "%s: power_w: Power Manager Control Register = %08x & %08x\n", machine().describe_context(), data, mem_mask);
@@ -1471,7 +1451,7 @@ void pxa255_periphs_device::power_w(offs_t offset, uint32_t data, uint32_t mem_m
uint32_t pxa255_periphs_device::clocks_r(offs_t offset, uint32_t mem_mask)
{
- switch(PXA255_CLOCKS_BASE_ADDR | (offset << 2))
+ switch (PXA255_CLOCKS_BASE_ADDR | (offset << 2))
{
case PXA255_CCCR:
LOGMASKED(LOG_CLOCKS, "%s: clocks_r: Core Clock Configuration Register: %08x\n", machine().describe_context(), m_clocks_regs.cccr);
@@ -1491,7 +1471,7 @@ uint32_t pxa255_periphs_device::clocks_r(offs_t offset, uint32_t mem_mask)
void pxa255_periphs_device::clocks_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
- switch(PXA255_CLOCKS_BASE_ADDR | (offset << 2))
+ switch (PXA255_CLOCKS_BASE_ADDR | (offset << 2))
{
case PXA255_CCCR:
LOGMASKED(LOG_CLOCKS, "%s: clocks_w: Core Clock Configuration Register = %08x & %08x\n", machine().describe_context(), data, mem_mask);
@@ -1519,20 +1499,26 @@ void pxa255_periphs_device::device_start()
{
for (int index = 0; index < 16; index++)
{
- m_dma_regs.timer[index] = timer_alloc(TIMER_DMA0 + index);
+ if (index != 3)
+ {
+ m_dma_regs.timer[index] = timer_alloc(FUNC(pxa255_periphs_device::dma_end_tick), this);
+ }
+ else
+ {
+ m_dma_regs.timer[index] = timer_alloc(FUNC(pxa255_periphs_device::audio_dma_end_tick), this);
+ }
}
for (int index = 0; index < 4; index++)
{
- m_ostimer_regs.timer[index] = timer_alloc(TIMER_OSTIMER0 + index);
+ m_ostimer_regs.timer[index] = timer_alloc(FUNC(pxa255_periphs_device::ostimer_match_tick), this);
}
- m_lcd_regs.dma[0].eof = timer_alloc(TIMER_LCD_EOF0);
- m_lcd_regs.dma[1].eof = timer_alloc(TIMER_LCD_EOF0 + 1);
+ m_lcd_regs.dma[0].eof = timer_alloc(FUNC(pxa255_periphs_device::lcd_dma_eof_tick), this);
+ m_lcd_regs.dma[1].eof = timer_alloc(FUNC(pxa255_periphs_device::lcd_dma_eof_tick), this);
m_lcd_palette = make_unique_clear<uint32_t[]>(0x100);
m_lcd_framebuffer = make_unique_clear<uint8_t[]>(0x100000);
- m_words = make_unique_clear<uint32_t[]>(0x800);
m_samples = make_unique_clear<int16_t[]>(0x1000);
m_gpio0_w.resolve_safe();
@@ -1542,7 +1528,7 @@ void pxa255_periphs_device::device_start()
m_gpio1_r.resolve_safe(0xffffffff);
m_gpio2_r.resolve_safe(0xffffffff);
- m_rtc_regs.timer = timer_alloc(TIMER_RTC);
+ m_rtc_regs.timer = timer_alloc(FUNC(pxa255_periphs_device::rtc_tick), this);
}
void pxa255_periphs_device::device_reset()
@@ -1567,18 +1553,6 @@ void pxa255_periphs_device::device_reset()
memset(&m_clocks_regs, 0, sizeof(m_clocks_regs));
}
-void pxa255_periphs_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- if (id < TIMER_OSTIMER0)
- dma_end_tick(id);
- else if (id < TIMER_LCD_EOF0)
- ostimer_match_tick(id - TIMER_OSTIMER0);
- else if (id < TIMER_RTC)
- lcd_dma_eof_tick(id - TIMER_LCD_EOF0);
- else if (id == TIMER_RTC)
- rtc_tick();
-}
-
uint32_t pxa255_periphs_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
for (int y = 0; y <= (m_lcd_regs.lccr2 & PXA255_LCCR2_LPP); y++)
diff --git a/src/devices/machine/pxa255.h b/src/devices/machine/pxa255.h
index 22ee82a4b8a..75eadbac2c5 100644
--- a/src/devices/machine/pxa255.h
+++ b/src/devices/machine/pxa255.h
@@ -65,12 +65,6 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
- static const device_timer_id TIMER_DMA0 = 0;
- static const device_timer_id TIMER_OSTIMER0 = 16;
- static const device_timer_id TIMER_LCD_EOF0 = 20;
- static const device_timer_id TIMER_RTC = 22;
void dma_irq_check();
void dma_load_descriptor_and_start(int channel);
@@ -83,11 +77,13 @@ protected:
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
- void dma_end_tick(int channel);
- void ostimer_match_tick(int channel);
- void lcd_dma_eof_tick(int channel);
- void rtc_tick();
+ TIMER_CALLBACK_MEMBER(dma_end_tick);
+ TIMER_CALLBACK_MEMBER(audio_dma_end_tick);
+ TIMER_CALLBACK_MEMBER(ostimer_match_tick);
+ TIMER_CALLBACK_MEMBER(lcd_dma_eof_tick);
+ TIMER_CALLBACK_MEMBER(rtc_tick);
+ void dma_finish(int channel);
void set_irq_line(uint32_t line, int state);
struct dma_regs
@@ -269,7 +265,6 @@ protected:
std::unique_ptr<uint32_t[]> m_lcd_palette; // 0x100
std::unique_ptr<uint8_t[]> m_lcd_framebuffer; // 0x100000
- std::unique_ptr<uint32_t[]> m_words; // 0x800
std::unique_ptr<int16_t[]> m_samples; // 0x1000
};
diff --git a/src/devices/machine/pxa255defs.h b/src/devices/machine/pxa255defs.h
index 9857a0871d3..424eeb0c53c 100644
--- a/src/devices/machine/pxa255defs.h
+++ b/src/devices/machine/pxa255defs.h
@@ -156,11 +156,12 @@
#define PXA255_DCMD_STARTIRQEN (0x00400000)
#define PXA255_DCMD_ENDIRQEN (0x00200000)
#define PXA255_DCMD_ENDIAN (0x00040000)
- #define PXA255_DCMD_SIZE (0x00030000)
- #define PXA255_DCMD_SIZE_0 (0x00000000)
- #define PXA255_DCMD_SIZE_8 (0x00010000)
- #define PXA255_DCMD_SIZE_16 (0x00020000)
- #define PXA255_DCMD_SIZE_32 (0x00030000)
+ #define PXA255_DCMD_SIZE_SHIFT (16)
+ #define PXA255_DCMD_SIZE_MASK (0x00000003)
+ #define PXA255_DCMD_SIZE_0 (0x00000000)
+ #define PXA255_DCMD_SIZE_8 (0x00000001)
+ #define PXA255_DCMD_SIZE_16 (0x00000002)
+ #define PXA255_DCMD_SIZE_32 (0x00000003)
#define PXA255_DCMD_WIDTH (0x0000c000)
#define PXA255_DCMD_WIDTH_0 (0x00000000)
#define PXA255_DCMD_WIDTH_1 (0x00004000)
diff --git a/src/devices/machine/r10788.cpp b/src/devices/machine/r10788.cpp
index cb1b7d9a374..4a8a8161ad5 100644
--- a/src/devices/machine/r10788.cpp
+++ b/src/devices/machine/r10788.cpp
@@ -80,7 +80,7 @@ void r10788_device::device_start()
save_item(NAME(m_io_counter));
save_item(NAME(m_scan_counter));
- m_timer = timer_alloc(TIMER_DISPLAY);
+ m_timer = timer_alloc(FUNC(r10788_device::display_update), this);
// recurring timer every 36 cycles
m_timer->adjust(clocks_to_attotime(36), 0, clocks_to_attotime(36));
}
@@ -102,27 +102,11 @@ void r10788_device::device_reset()
}
-/**
- * @brief r10788_device::device_timer timer event callback
- * @param timer emu_timer which fired
- * @param id timer identifier
- * @param param parameter
- * @param ptr pointer parameter
- */
-void r10788_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(r10788_device::display_update)
{
- uint8_t data;
- switch (id)
- {
- case TIMER_DISPLAY:
- data = (m_reg[0][m_scan_counter] & m_mask_a) +
- 16 * (m_reg[1][m_scan_counter] & m_mask_b);
- LOG("%s: scan counter:%2d data:%02x\n", __FUNCTION__, m_scan_counter, data);
- m_display(m_scan_counter, data, 0xff);
- break;
- default:
- LOG("%s: invalid timer id:%d\n", __FUNCTION__, id);
- }
+ uint8_t data = ((m_reg[1][m_scan_counter] & m_mask_b) << 4) | (m_reg[0][m_scan_counter] & m_mask_a);
+ LOG("display_update: scan counter:%2d data:%02x\n", m_scan_counter, data);
+ m_display(m_scan_counter, data, 0xff);
m_scan_counter = (m_scan_counter + 1) % 16;
}
diff --git a/src/devices/machine/r10788.h b/src/devices/machine/r10788.h
index 452d9e14429..9a94ad65b5c 100644
--- a/src/devices/machine/r10788.h
+++ b/src/devices/machine/r10788.h
@@ -43,11 +43,10 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-private:
- static const device_timer_id TIMER_DISPLAY = 0;
+ TIMER_CALLBACK_MEMBER(display_update);
+private:
uint8_t m_reg[2][16]; //!< display registers
uint8_t m_ktr; //!< transfer keyboard return value
uint8_t m_kts; //!< transfer keyboard strobe value
diff --git a/src/devices/machine/ripple_counter.cpp b/src/devices/machine/ripple_counter.cpp
index 32db0862b93..e8fc5ad544f 100644
--- a/src/devices/machine/ripple_counter.cpp
+++ b/src/devices/machine/ripple_counter.cpp
@@ -94,7 +94,7 @@ void ripple_counter_device::device_resolve_objects()
void ripple_counter_device::device_start()
{
// initialize timers
- m_count_timer = timer_alloc(TIMER_COUNT);
+ m_count_timer = timer_alloc(FUNC(ripple_counter_device::advance_counter), this);
// register internal state
save_item(NAME(m_count));
@@ -174,16 +174,10 @@ WRITE_LINE_MEMBER(ripple_counter_device::reset_w)
//-------------------------------------------------
-// device_timer - called whenever a device timer
-// fires
+// advance_counter -
//-------------------------------------------------
-void ripple_counter_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(ripple_counter_device::advance_counter)
{
- switch (id)
- {
- case TIMER_COUNT:
- set_count((m_count + 1) & m_count_mask);
- break;
- }
+ set_count((m_count + 1) & m_count_mask);
}
diff --git a/src/devices/machine/ripple_counter.h b/src/devices/machine/ripple_counter.h
index 6436723d738..dd0ee3adced 100644
--- a/src/devices/machine/ripple_counter.h
+++ b/src/devices/machine/ripple_counter.h
@@ -43,12 +43,13 @@ protected:
virtual void device_resolve_objects() override;
virtual void device_start() override;
virtual void device_clock_changed() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_rom_interface overrides
virtual space_config_vector memory_space_config() const override;
virtual void rom_bank_updated() override;
+ TIMER_CALLBACK_MEMBER(advance_counter);
+
private:
// internal helpers
void set_count(u32 count);
@@ -58,10 +59,6 @@ private:
devcb_write8 m_rom_out_cb;
// device timers
- enum
- {
- TIMER_COUNT
- };
emu_timer *m_count_timer;
// configuration parameters
diff --git a/src/devices/machine/rp5c01.cpp b/src/devices/machine/rp5c01.cpp
index 50443421ba5..8a59f07e9f8 100644
--- a/src/devices/machine/rp5c01.cpp
+++ b/src/devices/machine/rp5c01.cpp
@@ -201,10 +201,10 @@ void rp5c01_device::device_start()
// allocate timers
if (clock() > 0)
{
- m_clock_timer = timer_alloc(TIMER_CLOCK);
+ m_clock_timer = timer_alloc(FUNC(rp5c01_device::advance_1hz_clock), this);
m_clock_timer->adjust(attotime::from_hz(clock() / 16384), 0, attotime::from_hz(clock() / 16384));
- m_16hz_timer = timer_alloc(TIMER_16HZ);
+ m_16hz_timer = timer_alloc(FUNC(rp5c01_device::advance_16hz_clock), this);
m_16hz_timer->adjust(attotime::from_hz(clock() / 1024), 0, attotime::from_hz(clock() / 1024));
}
@@ -227,28 +227,29 @@ void rp5c01_device::device_start()
//-------------------------------------------------
-// device_timer - handler timer events
+// advance_1hz_clock -
//-------------------------------------------------
-void rp5c01_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(rp5c01_device::advance_1hz_clock)
{
- switch (id)
+ if (m_1hz && (m_mode & MODE_TIMER_EN))
{
- case TIMER_CLOCK:
- if (m_1hz && (m_mode & MODE_TIMER_EN))
- {
- advance_seconds();
- }
+ advance_seconds();
+ }
- m_1hz = !m_1hz;
- set_alarm_line();
- break;
+ m_1hz = !m_1hz;
+ set_alarm_line();
+}
- case TIMER_16HZ:
- m_16hz = !m_16hz;
- set_alarm_line();
- break;
- }
+
+//-------------------------------------------------
+// advance_16hz_clock -
+//-------------------------------------------------
+
+TIMER_CALLBACK_MEMBER(rp5c01_device::advance_16hz_clock)
+{
+ m_16hz = !m_16hz;
+ set_alarm_line();
}
diff --git a/src/devices/machine/rp5c01.h b/src/devices/machine/rp5c01.h
index 14c44b385a5..0cbcdf4d2a5 100644
--- a/src/devices/machine/rp5c01.h
+++ b/src/devices/machine/rp5c01.h
@@ -54,7 +54,6 @@ protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_rtc_interface overrides
virtual bool rtc_feature_leap_year() const override { return true; }
@@ -67,15 +66,15 @@ protected:
virtual bool nvram_write(util::write_stream &file) override;
virtual bool nvram_can_write() override { return m_battery_backed; }
+ TIMER_CALLBACK_MEMBER(advance_1hz_clock);
+ TIMER_CALLBACK_MEMBER(advance_16hz_clock);
+
private:
inline void set_alarm_line();
inline int read_counter(int counter);
inline void write_counter(int counter, int value);
inline void check_alarm();
- static const device_timer_id TIMER_CLOCK = 0;
- static const device_timer_id TIMER_16HZ = 1;
-
devcb_write_line m_out_alarm_cb;
bool m_battery_backed;
diff --git a/src/devices/machine/rp5c15.cpp b/src/devices/machine/rp5c15.cpp
index a0700a3069f..a37b779c6fd 100644
--- a/src/devices/machine/rp5c15.cpp
+++ b/src/devices/machine/rp5c15.cpp
@@ -207,13 +207,13 @@ void rp5c15_device::device_start()
m_out_clkout_cb.resolve_safe();
// allocate timers
- m_clock_timer = timer_alloc(TIMER_CLOCK);
+ m_clock_timer = timer_alloc(FUNC(rp5c15_device::advance_1hz_clock), this);
m_clock_timer->adjust(attotime::from_hz(clock() / 16384), 0, attotime::from_hz(clock() / 16384));
- m_16hz_timer = timer_alloc(TIMER_16HZ);
+ m_16hz_timer = timer_alloc(FUNC(rp5c15_device::advance_16hz_clock), this);
m_16hz_timer->adjust(attotime::from_hz(clock() / 1024), 0, attotime::from_hz(clock() / 1024));
- m_clkout_timer = timer_alloc(TIMER_CLKOUT);
+ m_clkout_timer = timer_alloc(FUNC(rp5c15_device::advance_output_clock), this);
memset(m_reg, 0, sizeof(m_reg));
memset(m_ram, 0, sizeof(m_ram));
@@ -239,33 +239,40 @@ void rp5c15_device::device_start()
//-------------------------------------------------
-// device_timer - handler timer events
+// advance_1hz_clock -
//-------------------------------------------------
-void rp5c15_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(rp5c15_device::advance_1hz_clock)
{
- switch (id)
+ if (m_1hz && (m_mode & MODE_TIMER_EN))
{
- case TIMER_CLOCK:
- if (m_1hz && (m_mode & MODE_TIMER_EN))
- {
- advance_seconds();
- }
+ advance_seconds();
+ }
- m_1hz = !m_1hz;
- set_alarm_line();
- break;
+ m_1hz = !m_1hz;
+ set_alarm_line();
+}
- case TIMER_16HZ:
- m_16hz = !m_16hz;
- set_alarm_line();
- break;
- case TIMER_CLKOUT:
- m_clkout = !m_clkout;
- m_out_clkout_cb(m_clkout);
- break;
- }
+//-------------------------------------------------
+// advance_16hz_clock -
+//-------------------------------------------------
+
+TIMER_CALLBACK_MEMBER(rp5c15_device::advance_16hz_clock)
+{
+ m_16hz = !m_16hz;
+ set_alarm_line();
+}
+
+
+//-------------------------------------------------
+// advance_output_clock -
+//-------------------------------------------------
+
+TIMER_CALLBACK_MEMBER(rp5c15_device::advance_output_clock)
+{
+ m_clkout = !m_clkout;
+ m_out_clkout_cb(m_clkout);
}
diff --git a/src/devices/machine/rp5c15.h b/src/devices/machine/rp5c15.h
index 7d981a9ec87..15936a02445 100644
--- a/src/devices/machine/rp5c15.h
+++ b/src/devices/machine/rp5c15.h
@@ -41,22 +41,21 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_rtc_interface overrides
virtual bool rtc_feature_leap_year() const override { return true; }
virtual void rtc_clock_updated(int year, int month, int day, int day_of_week, int hour, int minute, int second) override;
+ TIMER_CALLBACK_MEMBER(advance_1hz_clock);
+ TIMER_CALLBACK_MEMBER(advance_16hz_clock);
+ TIMER_CALLBACK_MEMBER(advance_output_clock);
+
private:
inline void set_alarm_line();
inline int read_counter(int counter);
inline void write_counter(int counter, int value);
inline void check_alarm();
- static const device_timer_id TIMER_CLOCK = 0;
- static const device_timer_id TIMER_16HZ = 1;
- static const device_timer_id TIMER_CLKOUT = 2;
-
devcb_write_line m_out_alarm_cb;
devcb_write_line m_out_clkout_cb;
diff --git a/src/devices/machine/rtc4543.cpp b/src/devices/machine/rtc4543.cpp
index 32ae1a7a3dd..773724a4170 100644
--- a/src/devices/machine/rtc4543.cpp
+++ b/src/devices/machine/rtc4543.cpp
@@ -73,7 +73,7 @@ void rtc4543_device::device_start()
m_data_cb.resolve_safe();
// allocate timers
- m_clock_timer = timer_alloc();
+ m_clock_timer = timer_alloc(FUNC(rtc4543_device::advance_clock), this);
m_clock_timer->adjust(attotime::from_hz(clock() / 32768), 0, attotime::from_hz(clock() / 32768));
// state saving
@@ -101,10 +101,10 @@ void rtc4543_device::device_reset()
//-------------------------------------------------
-// device_timer - handler timer events
+// advance_clock -
//-------------------------------------------------
-void rtc4543_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(rtc4543_device::advance_clock)
{
advance_seconds();
}
diff --git a/src/devices/machine/rtc4543.h b/src/devices/machine/rtc4543.h
index 0f2d7b689f8..a29cbb9ec30 100644
--- a/src/devices/machine/rtc4543.h
+++ b/src/devices/machine/rtc4543.h
@@ -44,7 +44,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_rtc_interface overrides
virtual void rtc_clock_updated(int year, int month, int day, int day_of_week, int hour, int minute, int second) override;
@@ -60,6 +59,8 @@ protected:
void advance_bit();
void update_effective();
+ TIMER_CALLBACK_MEMBER(advance_clock);
+
devcb_write_line m_data_cb;
int m_ce;
diff --git a/src/devices/machine/rtc65271.cpp b/src/devices/machine/rtc65271.cpp
index 5ddc59ddb5f..dc7aad8d210 100644
--- a/src/devices/machine/rtc65271.cpp
+++ b/src/devices/machine/rtc65271.cpp
@@ -405,7 +405,7 @@ void rtc65271_device::write(int xramsel, offs_t offset, uint8_t data)
{
attotime period = attotime::from_hz(SQW_freq_table[data & reg_A_RS]);
attotime half_period = period / 2;
- attotime elapsed = m_update_timer->elapsed();
+ attotime elapsed = m_begin_update_timer->elapsed();
if (half_period > elapsed)
m_SQW_timer->adjust(half_period - elapsed);
@@ -510,7 +510,7 @@ TIMER_CALLBACK_MEMBER(rtc65271_device::rtc_begin_update_cb)
m_regs[reg_A] |= reg_A_UIP;
/* schedule end of update cycle */
- machine().scheduler().timer_set(UPDATE_CYCLE_TIME, timer_expired_delegate(FUNC(rtc65271_device::rtc_end_update_cb), this));
+ m_end_update_timer->adjust(UPDATE_CYCLE_TIME);
}
}
@@ -682,9 +682,11 @@ rtc65271_device::rtc65271_device(const machine_config &mconfig, const char *tag,
//-------------------------------------------------
void rtc65271_device::device_start()
{
- m_update_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(rtc65271_device::rtc_begin_update_cb), this));
- m_update_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1));
- m_SQW_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(rtc65271_device::rtc_SQW_cb), this));
+ m_begin_update_timer = timer_alloc(FUNC(rtc65271_device::rtc_begin_update_cb), this);
+ m_begin_update_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1));
+ m_end_update_timer = timer_alloc(FUNC(rtc65271_device::rtc_end_update_cb), this);
+ m_end_update_timer->adjust(attotime::never);
+ m_SQW_timer = timer_alloc(FUNC(rtc65271_device::rtc_SQW_cb), this);
m_interrupt_cb.resolve();
save_item(NAME(m_regs));
diff --git a/src/devices/machine/rtc65271.h b/src/devices/machine/rtc65271.h
index 70ea033953e..a3d77bf3fa9 100644
--- a/src/devices/machine/rtc65271.h
+++ b/src/devices/machine/rtc65271.h
@@ -55,7 +55,8 @@ private:
uint8_t m_cur_xram_page;
/* update timer: called every second */
- emu_timer *m_update_timer;
+ emu_timer *m_begin_update_timer = nullptr;
+ emu_timer *m_end_update_timer = nullptr;
/* SQW timer: called every periodic clock half-period */
emu_timer *m_SQW_timer;
diff --git a/src/devices/machine/rtc9701.cpp b/src/devices/machine/rtc9701.cpp
index a16ce296dde..3dab4bd1835 100644
--- a/src/devices/machine/rtc9701.cpp
+++ b/src/devices/machine/rtc9701.cpp
@@ -92,7 +92,7 @@ void rtc9701_device::device_validity_check(validity_checker &valid) const
void rtc9701_device::device_start()
{
/* let's call the timer callback every second */
- m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(rtc9701_device::timer_callback), this));
+ m_timer = timer_alloc(FUNC(rtc9701_device::timer_callback), this);
m_timer->adjust(attotime::from_hz(clock() / XTAL(32'768)), 0, attotime::from_hz(clock() / XTAL(32'768)));
system_time systime;
diff --git a/src/devices/machine/s3520cf.cpp b/src/devices/machine/s3520cf.cpp
index 6bc9bbf64eb..86676ca3d2b 100644
--- a/src/devices/machine/s3520cf.cpp
+++ b/src/devices/machine/s3520cf.cpp
@@ -105,7 +105,7 @@ void s3520cf_device::device_validity_check(validity_checker &valid) const
void s3520cf_device::device_start()
{
/* let's call the timer callback every second for now */
- m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(s3520cf_device::timer_callback), this));
+ m_timer = timer_alloc(FUNC(s3520cf_device::timer_callback), this);
m_timer->adjust(attotime::from_hz(clock() / XTAL(32'768)), 0, attotime::from_hz(clock() / XTAL(32'768)));
system_time systime;
diff --git a/src/devices/machine/s3c24xx.hxx b/src/devices/machine/s3c24xx.hxx
index acddd0ad7e0..b5ad9be6312 100644
--- a/src/devices/machine/s3c24xx.hxx
+++ b/src/devices/machine/s3c24xx.hxx
@@ -3272,15 +3272,15 @@ void S3C24_CLASS_NAME::s3c24xx_device_start()
m_nand_data_w_cb.resolve();
#endif
for (int i = 0; i < 5; i++)
- m_pwm.timer[i] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(S3C24_CLASS_NAME::s3c24xx_pwm_timer_exp), this));
+ m_pwm.timer[i] = timer_alloc(FUNC(S3C24_CLASS_NAME::s3c24xx_pwm_timer_exp), this);
for (auto & elem : m_dma)
- elem.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(S3C24_CLASS_NAME::s3c24xx_dma_timer_exp), this));
- m_iic.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(S3C24_CLASS_NAME::s3c24xx_iic_timer_exp), this));
- m_iis.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(S3C24_CLASS_NAME::s3c24xx_iis_timer_exp), this));
- m_lcd.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(S3C24_CLASS_NAME::s3c24xx_lcd_timer_exp), this));
- m_rtc.timer_tick_count = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(S3C24_CLASS_NAME::s3c24xx_rtc_timer_tick_count_exp), this));
- m_rtc.timer_update = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(S3C24_CLASS_NAME::s3c24xx_rtc_timer_update_exp), this));
- m_wdt.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(S3C24_CLASS_NAME::s3c24xx_wdt_timer_exp), this));
+ elem.timer = timer_alloc(FUNC(S3C24_CLASS_NAME::s3c24xx_dma_timer_exp), this);
+ m_iic.timer = timer_alloc(FUNC(S3C24_CLASS_NAME::s3c24xx_iic_timer_exp), this);
+ m_iis.timer = timer_alloc(FUNC(S3C24_CLASS_NAME::s3c24xx_iis_timer_exp), this);
+ m_lcd.timer = timer_alloc(FUNC(S3C24_CLASS_NAME::s3c24xx_lcd_timer_exp), this);
+ m_rtc.timer_tick_count = timer_alloc(FUNC(S3C24_CLASS_NAME::s3c24xx_rtc_timer_tick_count_exp), this);
+ m_rtc.timer_update = timer_alloc(FUNC(S3C24_CLASS_NAME::s3c24xx_rtc_timer_update_exp), this);
+ m_wdt.timer = timer_alloc(FUNC(S3C24_CLASS_NAME::s3c24xx_wdt_timer_exp), this);
#if defined(DEVICE_S3C2410) || defined(DEVICE_S3C2440)
int om0 = iface_core_pin_r(S3C24XX_CORE_PIN_OM0);
diff --git a/src/devices/machine/s3c44b0.cpp b/src/devices/machine/s3c44b0.cpp
index 746c6ba0e32..f3ea869bdd5 100644
--- a/src/devices/machine/s3c44b0.cpp
+++ b/src/devices/machine/s3c44b0.cpp
@@ -266,17 +266,17 @@ void s3c44b0_device::device_start()
m_cpu->space(AS_PROGRAM).cache(m_cache);
- for (int i = 0; i < 6; i++) m_pwm.timer[i] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(s3c44b0_device::pwm_timer_exp),this));
- for (auto & elem : m_uart) elem.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(s3c44b0_device::uart_timer_exp),this));
- for (auto & elem : m_zdma) elem.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(s3c44b0_device::zdma_timer_exp),this));
- for (auto & elem : m_bdma) elem.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(s3c44b0_device::bdma_timer_exp),this));
-
- m_lcd.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(s3c44b0_device::lcd_timer_exp),this));
- m_wdt.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(s3c44b0_device::wdt_timer_exp),this));
- m_sio.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(s3c44b0_device::sio_timer_exp),this));
- m_adc.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(s3c44b0_device::adc_timer_exp),this));
- m_iic.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(s3c44b0_device::iic_timer_exp),this));
- m_iis.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(s3c44b0_device::iis_timer_exp),this));
+ for (int i = 0; i < 6; i++) m_pwm.timer[i] = timer_alloc(FUNC(s3c44b0_device::pwm_timer_exp), this);
+ for (auto & elem : m_uart) elem.timer = timer_alloc(FUNC(s3c44b0_device::uart_timer_exp), this);
+ for (auto & elem : m_zdma) elem.timer = timer_alloc(FUNC(s3c44b0_device::zdma_timer_exp), this);
+ for (auto & elem : m_bdma) elem.timer = timer_alloc(FUNC(s3c44b0_device::bdma_timer_exp), this);
+
+ m_lcd.timer = timer_alloc(FUNC(s3c44b0_device::lcd_timer_exp), this);
+ m_wdt.timer = timer_alloc(FUNC(s3c44b0_device::wdt_timer_exp), this);
+ m_sio.timer = timer_alloc(FUNC(s3c44b0_device::sio_timer_exp), this);
+ m_adc.timer = timer_alloc(FUNC(s3c44b0_device::adc_timer_exp), this);
+ m_iic.timer = timer_alloc(FUNC(s3c44b0_device::iic_timer_exp), this);
+ m_iis.timer = timer_alloc(FUNC(s3c44b0_device::iis_timer_exp), this);
video_start();
diff --git a/src/devices/machine/s_smp.cpp b/src/devices/machine/s_smp.cpp
index 277d40f3533..d6693943c1c 100644
--- a/src/devices/machine/s_smp.cpp
+++ b/src/devices/machine/s_smp.cpp
@@ -89,7 +89,7 @@ void s_smp_device::device_start()
space(AS_DATA).specific(m_data);
space(AS_DATA).cache(m_dcache);
- m_tick_timer = timer_alloc(TIMER_TICK_ID);
+ m_tick_timer = timer_alloc(FUNC(s_smp_device::update_timers), this);
save_item(NAME(m_timer_enabled));
save_item(NAME(m_subcounter));
@@ -179,11 +179,8 @@ inline void s_smp_device::update_timer_tick(u8 which)
}
}
-void s_smp_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(s_smp_device::update_timers)
{
- if (id != TIMER_TICK_ID)
- throw emu_fatalerror("Unknown id in s_smp_device::device_timer");
-
for (int ch = 0; ch < 3; ch++)
update_timer_tick(ch);
}
diff --git a/src/devices/machine/s_smp.h b/src/devices/machine/s_smp.h
index 2654db91776..45f83755507 100644
--- a/src/devices/machine/s_smp.h
+++ b/src/devices/machine/s_smp.h
@@ -31,7 +31,8 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_clock_changed() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(update_timers);
// device_memory_interface configuration
virtual space_config_vector memory_space_config() const override;
@@ -56,10 +57,6 @@ private:
u8 io_r(offs_t offset);
void io_w(offs_t offset, u8 data);
- enum
- {
- TIMER_TICK_ID = 1
- };
/* timers */
emu_timer *m_tick_timer;
bool m_timer_enabled[3];
diff --git a/src/devices/machine/sa1110.cpp b/src/devices/machine/sa1110.cpp
index 11afedeef51..5bcc62ba456 100644
--- a/src/devices/machine/sa1110.cpp
+++ b/src/devices/machine/sa1110.cpp
@@ -2314,12 +2314,12 @@ void sa1110_periphs_device::device_start()
save_item(NAME(m_icp_regs.uart.rx_fifo_read_idx));
save_item(NAME(m_icp_regs.uart.rx_fifo_write_idx));
save_item(NAME(m_icp_regs.uart.rx_fifo_count));
- m_icp_regs.uart_rx_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sa1110_periphs_device::icp_rx_callback), this));
+ m_icp_regs.uart_rx_timer = timer_alloc(FUNC(sa1110_periphs_device::icp_rx_callback), this);
save_item(NAME(m_icp_regs.uart.tx_fifo));
save_item(NAME(m_icp_regs.uart.tx_fifo_read_idx));
save_item(NAME(m_icp_regs.uart.tx_fifo_write_idx));
save_item(NAME(m_icp_regs.uart.tx_fifo_count));
- m_icp_regs.uart_tx_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sa1110_periphs_device::icp_tx_callback), this));
+ m_icp_regs.uart_tx_timer = timer_alloc(FUNC(sa1110_periphs_device::icp_tx_callback), this);
save_item(NAME(m_icp_regs.uart.rx_break_interlock));
save_item(NAME(m_icp_regs.utcr4));
@@ -2331,12 +2331,12 @@ void sa1110_periphs_device::device_start()
save_item(NAME(m_icp_regs.hssp.rx_fifo_read_idx));
save_item(NAME(m_icp_regs.hssp.rx_fifo_write_idx));
save_item(NAME(m_icp_regs.hssp.rx_fifo_count));
- m_icp_regs.hssp.rx_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sa1110_periphs_device::hssp_rx_callback), this));
+ m_icp_regs.hssp.rx_timer = timer_alloc(FUNC(sa1110_periphs_device::hssp_rx_callback), this);
save_item(NAME(m_icp_regs.hssp.tx_fifo));
save_item(NAME(m_icp_regs.hssp.tx_fifo_read_idx));
save_item(NAME(m_icp_regs.hssp.tx_fifo_write_idx));
save_item(NAME(m_icp_regs.hssp.tx_fifo_count));
- m_icp_regs.hssp.tx_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sa1110_periphs_device::hssp_tx_callback), this));
+ m_icp_regs.hssp.tx_timer = timer_alloc(FUNC(sa1110_periphs_device::hssp_tx_callback), this);
save_item(NAME(m_uart_regs.utcr));
save_item(NAME(m_uart_regs.utsr0));
@@ -2363,7 +2363,7 @@ void sa1110_periphs_device::device_start()
save_item(NAME(m_mcp_regs.audio_tx_fifo_read_idx));
save_item(NAME(m_mcp_regs.audio_tx_fifo_write_idx));
save_item(NAME(m_mcp_regs.audio_tx_fifo_count));
- m_mcp_regs.audio_tx_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sa1110_periphs_device::mcp_audio_tx_callback), this));
+ m_mcp_regs.audio_tx_timer = timer_alloc(FUNC(sa1110_periphs_device::mcp_audio_tx_callback), this);
save_item(NAME(m_mcp_regs.telecom_rx_fifo));
save_item(NAME(m_mcp_regs.telecom_rx_fifo_read_idx));
save_item(NAME(m_mcp_regs.telecom_rx_fifo_write_idx));
@@ -2372,7 +2372,7 @@ void sa1110_periphs_device::device_start()
save_item(NAME(m_mcp_regs.telecom_tx_fifo_read_idx));
save_item(NAME(m_mcp_regs.telecom_tx_fifo_write_idx));
save_item(NAME(m_mcp_regs.telecom_tx_fifo_count));
- m_mcp_regs.telecom_tx_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sa1110_periphs_device::mcp_telecom_tx_callback), this));
+ m_mcp_regs.telecom_tx_timer = timer_alloc(FUNC(sa1110_periphs_device::mcp_telecom_tx_callback), this);
save_item(NAME(m_ssp_regs.sscr0));
save_item(NAME(m_ssp_regs.sscr1));
@@ -2381,12 +2381,12 @@ void sa1110_periphs_device::device_start()
save_item(NAME(m_ssp_regs.rx_fifo_read_idx));
save_item(NAME(m_ssp_regs.rx_fifo_write_idx));
save_item(NAME(m_ssp_regs.rx_fifo_count));
- m_ssp_regs.rx_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sa1110_periphs_device::ssp_rx_callback), this));
+ m_ssp_regs.rx_timer = timer_alloc(FUNC(sa1110_periphs_device::ssp_rx_callback), this);
save_item(NAME(m_ssp_regs.tx_fifo));
save_item(NAME(m_ssp_regs.tx_fifo_read_idx));
save_item(NAME(m_ssp_regs.tx_fifo_write_idx));
save_item(NAME(m_ssp_regs.tx_fifo_count));
- m_ssp_regs.tx_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sa1110_periphs_device::ssp_tx_callback), this));
+ m_ssp_regs.tx_timer = timer_alloc(FUNC(sa1110_periphs_device::ssp_tx_callback), this);
save_item(NAME(m_ostmr_regs.osmr));
save_item(NAME(m_ostmr_regs.oscr));
@@ -2395,14 +2395,14 @@ void sa1110_periphs_device::device_start()
save_item(NAME(m_ostmr_regs.oier));
for (int i = 0; i < 4; i++)
{
- m_ostmr_regs.timer[i] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sa1110_periphs_device::ostimer_tick_cb), this));
+ m_ostmr_regs.timer[i] = timer_alloc(FUNC(sa1110_periphs_device::ostimer_tick_cb), this);
}
save_item(NAME(m_rtc_regs.rtar));
save_item(NAME(m_rtc_regs.rcnr));
save_item(NAME(m_rtc_regs.rttr));
save_item(NAME(m_rtc_regs.rtsr));
- m_rtc_regs.tick_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sa1110_periphs_device::rtc_tick_cb), this));
+ m_rtc_regs.tick_timer = timer_alloc(FUNC(sa1110_periphs_device::rtc_tick_cb), this);
save_item(NAME(m_power_regs.pmcr));
save_item(NAME(m_power_regs.pssr));
diff --git a/src/devices/machine/sa1111.cpp b/src/devices/machine/sa1111.cpp
index 89ebf0a1784..3a2dd300f78 100644
--- a/src/devices/machine/sa1111.cpp
+++ b/src/devices/machine/sa1111.cpp
@@ -2080,13 +2080,13 @@ void sa1111_device::device_start()
save_item(NAME(m_card_regs.pcssr));
save_item(NAME(m_card_regs.pcsr));
- m_audio_regs.rx_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sa1111_device::audio_rx_callback), this));
- m_audio_regs.rx_dma_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sa1111_device::audio_rx_dma_callback), this));
- m_audio_regs.tx_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sa1111_device::audio_tx_callback), this));
- m_audio_regs.tx_dma_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sa1111_device::audio_tx_dma_callback), this));
+ m_audio_regs.rx_timer = timer_alloc(FUNC(sa1111_device::audio_rx_callback), this);
+ m_audio_regs.rx_dma_timer = timer_alloc(FUNC(sa1111_device::audio_rx_dma_callback), this);
+ m_audio_regs.tx_timer = timer_alloc(FUNC(sa1111_device::audio_tx_callback), this);
+ m_audio_regs.tx_dma_timer = timer_alloc(FUNC(sa1111_device::audio_tx_dma_callback), this);
- m_ssp_regs.rx_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sa1111_device::ssp_rx_callback), this));
- m_ssp_regs.tx_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sa1111_device::ssp_tx_callback), this));
+ m_ssp_regs.rx_timer = timer_alloc(FUNC(sa1111_device::ssp_rx_callback), this);
+ m_ssp_regs.tx_timer = timer_alloc(FUNC(sa1111_device::ssp_tx_callback), this);
m_irq_out.resolve_safe();
m_gpio_out.resolve_all_safe();
diff --git a/src/devices/machine/saa1043.cpp b/src/devices/machine/saa1043.cpp
index 1c310643dcc..053945c9a7e 100644
--- a/src/devices/machine/saa1043.cpp
+++ b/src/devices/machine/saa1043.cpp
@@ -24,7 +24,6 @@ saa1043_device::saa1043_device(const machine_config &mconfig, const char *tag, d
, m_outputs(*this)
, m_type(PAL)
{
- std::fill(std::begin(m_outputs_hooked), std::end(m_outputs_hooked), false);
}
void saa1043_device::device_start()
@@ -32,50 +31,26 @@ void saa1043_device::device_start()
m_h = attotime::from_ticks(320, clock() * 2);
m_line_count = s_line_counts[m_type];
- // resolve callbacks
- for (uint32_t i = 0; i < OUT_COUNT; i++)
- {
- m_outputs[i].resolve_safe();
- if (m_outputs_hooked[i])
- {
- m_timers[i] = timer_alloc(i);
- switch(i)
- {
- case V2:
- m_timers[V2]->adjust(m_h * 6, 1);
- break;
- default:
- // Not yet implemented
- break;
- }
- }
- }
+ m_outputs.resolve_all_safe();
+
+ m_timers[OUT_V2] = timer_alloc(FUNC(saa1043_device::toggle_v2), this);
+ m_timers[OUT_V2]->adjust(m_h * 6, 1);
}
void saa1043_device::device_reset()
{
- // Clear any existing clock states
for (uint32_t i = 0; i < OUT_COUNT; i++)
{
m_outputs[i](CLEAR_LINE);
}
- m_outputs[V2](ASSERT_LINE);
+ m_outputs[OUT_V2](ASSERT_LINE);
}
-void saa1043_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(saa1043_device::toggle_v2)
{
- switch (id)
- {
- case V2:
- m_outputs[V2](1 - param);
- if (param)
- m_timers[V2]->adjust(m_h * (m_line_count - 9), 0);
- else
- m_timers[V2]->adjust(m_h * 9, 1);
- break;
-
- default:
- // Not yet implemented
- break;
- }
+ m_outputs[OUT_V2](1 - param);
+ if (param)
+ m_timers[OUT_V2]->adjust(m_h * (m_line_count - 9), 0);
+ else
+ m_timers[OUT_V2]->adjust(m_h * 9, 1);
}
diff --git a/src/devices/machine/saa1043.h b/src/devices/machine/saa1043.h
index d6b7271dce7..3a5851d0f42 100644
--- a/src/devices/machine/saa1043.h
+++ b/src/devices/machine/saa1043.h
@@ -46,24 +46,24 @@ public:
enum outputs : uint32_t
{
- BC,
- FH2,
- FH3,
- FH80,
- PH,
- NS,
- RI,
- WMP,
- RR,
- V1,
- V2,
- CLP,
- DL,
- H1,
- H2,
- CB,
- CS,
- ID,
+ OUT_BC,
+ OUT_FH2,
+ OUT_FH3,
+ OUT_FH80,
+ OUT_PH,
+ OUT_NS,
+ OUT_RI,
+ OUT_WMP,
+ OUT_RR,
+ OUT_V1,
+ OUT_V2,
+ OUT_CLP,
+ OUT_DL,
+ OUT_H1,
+ OUT_H2,
+ OUT_CB,
+ OUT_CS,
+ OUT_ID,
OUT_COUNT
};
@@ -78,34 +78,34 @@ public:
void set_type(signal_type type) { m_type = type; }
- auto bc_callback() { m_outputs_hooked[BC] = true; return m_outputs[BC].bind(); }
- auto fh2_callback() { m_outputs_hooked[FH2] = true; return m_outputs[FH2].bind(); }
- auto fh3_callback() { m_outputs_hooked[FH3] = true; return m_outputs[FH3].bind(); }
- auto fh80_callback() { m_outputs_hooked[FH80] = true; return m_outputs[FH80].bind(); }
- auto ph_callback() { m_outputs_hooked[PH] = true; return m_outputs[PH].bind(); }
- auto ns_callback() { m_outputs_hooked[NS] = true; return m_outputs[NS].bind(); }
- auto ri_callback() { m_outputs_hooked[RI] = true; return m_outputs[RI].bind(); }
- auto wmp_callback() { m_outputs_hooked[WMP] = true; return m_outputs[WMP].bind(); }
- auto rr_callback() { m_outputs_hooked[RR] = true; return m_outputs[RR].bind(); }
- auto v1_callback() { m_outputs_hooked[V1] = true; return m_outputs[V1].bind(); }
- auto v2_callback() { m_outputs_hooked[V2] = true; return m_outputs[V2].bind(); }
- auto clp_callback() { m_outputs_hooked[CLP] = true; return m_outputs[CLP].bind(); }
- auto dl_callback() { m_outputs_hooked[DL] = true; return m_outputs[DL].bind(); }
- auto h1_callback() { m_outputs_hooked[H1] = true; return m_outputs[H1].bind(); }
- auto h2_callback() { m_outputs_hooked[H2] = true; return m_outputs[H2].bind(); }
- auto cb_callback() { m_outputs_hooked[CB] = true; return m_outputs[CB].bind(); }
- auto cs_callback() { m_outputs_hooked[CS] = true; return m_outputs[CS].bind(); }
- auto id_callback() { m_outputs_hooked[ID] = true; return m_outputs[ID].bind(); }
+ auto bc_callback() { return m_outputs[OUT_BC].bind(); }
+ auto fh2_callback() { return m_outputs[OUT_FH2].bind(); }
+ auto fh3_callback() { return m_outputs[OUT_FH3].bind(); }
+ auto fh80_callback() { return m_outputs[OUT_FH80].bind(); }
+ auto ph_callback() { return m_outputs[OUT_PH].bind(); }
+ auto ns_callback() { return m_outputs[OUT_NS].bind(); }
+ auto ri_callback() { return m_outputs[OUT_RI].bind(); }
+ auto wmp_callback() { return m_outputs[OUT_WMP].bind(); }
+ auto rr_callback() { return m_outputs[OUT_RR].bind(); }
+ auto v1_callback() { return m_outputs[OUT_V1].bind(); }
+ auto v2_callback() { return m_outputs[OUT_V2].bind(); }
+ auto clp_callback() { return m_outputs[OUT_CLP].bind(); }
+ auto dl_callback() { return m_outputs[OUT_DL].bind(); }
+ auto h1_callback() { return m_outputs[OUT_H1].bind(); }
+ auto h2_callback() { return m_outputs[OUT_H2].bind(); }
+ auto cb_callback() { return m_outputs[OUT_CB].bind(); }
+ auto cs_callback() { return m_outputs[OUT_CS].bind(); }
+ auto id_callback() { return m_outputs[OUT_ID].bind(); }
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(toggle_v2);
private:
devcb_write_line::array<OUT_COUNT> m_outputs;
- bool m_outputs_hooked[OUT_COUNT];
emu_timer *m_timers[OUT_COUNT];
signal_type m_type;
diff --git a/src/devices/machine/scc2698b.cpp b/src/devices/machine/scc2698b.cpp
index db7ed52d4aa..892c37c24bf 100644
--- a/src/devices/machine/scc2698b.cpp
+++ b/src/devices/machine/scc2698b.cpp
@@ -364,17 +364,10 @@ scc2698b_device::scc2698b_device(const machine_config &mconfig, const char *tag,
write_mpp2(*this),
write_mpo(*this)
{
-
}
-void scc2698b_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
-
-}
-
-
void scc2698b_device::device_start()
{
write_intr_A.resolve_safe();
@@ -398,7 +391,6 @@ void scc2698b_device::device_start()
void scc2698b_device::device_reset()
{
-
}
diff --git a/src/devices/machine/scc2698b.h b/src/devices/machine/scc2698b.h
index 8b2921e3224..d883b45d0b9 100644
--- a/src/devices/machine/scc2698b.h
+++ b/src/devices/machine/scc2698b.h
@@ -114,7 +114,6 @@ public:
protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_add_mconfig(machine_config &config) override;
devcb_write_line write_intr_A, write_intr_B, write_intr_C, write_intr_D;
diff --git a/src/devices/machine/scc68070.cpp b/src/devices/machine/scc68070.cpp
index 9bde1e65982..63c7dc01dce 100644
--- a/src/devices/machine/scc68070.cpp
+++ b/src/devices/machine/scc68070.cpp
@@ -183,13 +183,13 @@ void scc68070_device::device_start()
save_item(STRUCT_MEMBER(m_mmu.desc, segment));
save_item(STRUCT_MEMBER(m_mmu.desc, base));
- m_timers.timer0_timer = timer_alloc(TIMER_TMR0);
+ m_timers.timer0_timer = timer_alloc(FUNC(scc68070_device::timer0_callback), this);
m_timers.timer0_timer->adjust(attotime::never);
- m_uart.rx_timer = timer_alloc(TIMER_UART_RX);
+ m_uart.rx_timer = timer_alloc(FUNC(scc68070_device::rx_callback), this);
m_uart.rx_timer->adjust(attotime::never);
- m_uart.tx_timer = timer_alloc(TIMER_UART_TX);
+ m_uart.tx_timer = timer_alloc(FUNC(scc68070_device::tx_callback), this);
m_uart.tx_timer->adjust(attotime::never);
}
@@ -263,20 +263,6 @@ void scc68070_device::device_reset()
m_timers.timer0_timer->adjust(attotime::never);
}
-//-------------------------------------------------
-// device_timer - device-specific timer callback
-//-------------------------------------------------
-
-void scc68070_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- if (id == TIMER_TMR0)
- timer0_callback();
- else if (id == TIMER_UART_RX)
- rx_callback();
- else if (id == TIMER_UART_TX)
- tx_callback();
-}
-
void scc68070_device::m68k_reset_peripherals()
{
m_lir = 0;
@@ -469,7 +455,7 @@ void scc68070_device::set_timer_callback(int channel)
}
}
-void scc68070_device::timer0_callback()
+TIMER_CALLBACK_MEMBER(scc68070_device::timer0_callback)
{
m_timers.timer0 = m_timers.reload_register;
m_timers.timer_status_register |= TSR_OV0;
@@ -500,7 +486,7 @@ void scc68070_device::uart_tx(uint8_t data)
m_uart.status_register &= ~USR_TXEMT;
}
-void scc68070_device::rx_callback()
+TIMER_CALLBACK_MEMBER(scc68070_device::rx_callback)
{
if ((m_uart.command_register & 3) == 1)
{
@@ -535,7 +521,7 @@ void scc68070_device::rx_callback()
}
}
-void scc68070_device::tx_callback()
+TIMER_CALLBACK_MEMBER(scc68070_device::tx_callback)
{
if (((m_uart.command_register >> 2) & 3) == 1)
{
diff --git a/src/devices/machine/scc68070.h b/src/devices/machine/scc68070.h
index 77e46e9d45f..5fe621abd64 100644
--- a/src/devices/machine/scc68070.h
+++ b/src/devices/machine/scc68070.h
@@ -149,14 +149,14 @@ public:
DECLARE_WRITE_LINE_MEMBER(int1_w);
DECLARE_WRITE_LINE_MEMBER(int2_w);
+ TIMER_CALLBACK_MEMBER(timer0_callback);
+ TIMER_CALLBACK_MEMBER(rx_callback);
+ TIMER_CALLBACK_MEMBER(tx_callback);
+
// external callbacks
void uart_rx(uint8_t data);
void uart_ctsn(int state);
- void timer0_callback();
- void rx_callback();
- void tx_callback();
-
// register structures
struct i2c_regs_t
{
@@ -264,7 +264,6 @@ protected:
virtual void device_resolve_objects() override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_execute_interface overrides
virtual u64 execute_clocks_to_cycles(u64 clocks) const noexcept override { return (clocks + 2 - 1) / 2; }
@@ -277,10 +276,6 @@ private:
void internal_map(address_map &map);
void cpu_space_map(address_map &map);
- static constexpr device_timer_id TIMER_TMR0 = 0;
- static constexpr device_timer_id TIMER_UART_RX = 1;
- static constexpr device_timer_id TIMER_UART_TX = 2;
-
void update_ipl();
uint8_t iack_r(offs_t offset);
diff --git a/src/devices/machine/scn_pci.cpp b/src/devices/machine/scn_pci.cpp
index 73ef2590e66..43d450c4738 100644
--- a/src/devices/machine/scn_pci.cpp
+++ b/src/devices/machine/scn_pci.cpp
@@ -303,7 +303,7 @@ void scn2641_device::device_resolve_objects()
void scn_pci_device::device_start()
{
// Create timer for baud rate generator
- m_brg_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(scn_pci_device::brg_tick), this));
+ m_brg_timer = timer_alloc(FUNC(scn_pci_device::brg_tick), this);
// Save state
save_item(NAME(m_rhr));
diff --git a/src/devices/machine/scnxx562.cpp b/src/devices/machine/scnxx562.cpp
index 1b936cc85e7..4f2da74c258 100644
--- a/src/devices/machine/scnxx562.cpp
+++ b/src/devices/machine/scnxx562.cpp
@@ -618,9 +618,9 @@ void duscc_channel::device_start()
m_cid = (m_uart->m_variant & duscc_device::SET_CMOS) ? 0x7f : 0xff; // TODO: support CMOS rev A = 0xbf
// Timers
- duscc_timer = timer_alloc(TIMER_ID);
- rtxc_timer = timer_alloc(TIMER_ID_RTXC);
- trxc_timer = timer_alloc(TIMER_ID_TRXC);
+ duscc_timer = timer_alloc(FUNC(duscc_channel::check_zero_detect), this);
+ rtxc_timer = timer_alloc(FUNC(duscc_channel::rtxc_tick), this);
+ trxc_timer = timer_alloc(FUNC(duscc_channel::trxc_tick), this);
// state saving
save_item(NAME(m_cmr1));
@@ -745,95 +745,90 @@ void duscc_channel::device_reset()
m_a7 = 0;
}
-void duscc_channel::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(duscc_channel::check_zero_detect)
{
- switch(id)
+ if (m_ct-- == 0) // Zero detect
{
- case TIMER_ID:
- if (m_ct-- == 0) // Zero detect
+ m_ictsr |= REG_ICTSR_ZERO_DET; // set zero detection bit
+
+ // Generate interrupt?
+ if ( ( (m_ctcr & REG_CTCR_ZERO_DET_INT) == REG_CTCR_ZERO_DET_INT ) &&
+ ( (m_uart->m_icr & (m_index == duscc_device::CHANNEL_A ? duscc_device::REG_ICR_CHA : duscc_device::REG_ICR_CHB) ) != 0) )
{
- m_ictsr |= REG_ICTSR_ZERO_DET; // set zero detection bit
+ LOG("Zero Detect Interrupt pending\n");
+ m_uart->trigger_interrupt(m_index, INT_EXTCTSTAT);
+ }
- // Generate interrupt?
- if ( ( (m_ctcr & REG_CTCR_ZERO_DET_INT) == REG_CTCR_ZERO_DET_INT ) &&
- ( (m_uart->m_icr & (m_index == duscc_device::CHANNEL_A ? duscc_device::REG_ICR_CHA : duscc_device::REG_ICR_CHB) ) != 0) )
- {
- LOG("Zero Detect Interrupt pending\n");
- m_uart->trigger_interrupt(m_index, INT_EXTCTSTAT);
- }
+ // Preload or rollover?
+ if (( m_ctcr & REG_CTCR_ZERO_DET_CTL) == 0)
+ {
+ m_ct = m_ctpr;
+ }
+ else
+ {
+ m_ct = 0xffff;
+ }
- // Preload or rollover?
- if (( m_ctcr & REG_CTCR_ZERO_DET_CTL) == 0)
+ // Is Counter/Timer output on the RTxC pin?
+ if (( m_pcr & REG_PCR_RTXC_MASK) == REG_PCR_RTXC_CNTR_OUT)
+ {
+ if ((m_ctcr & REG_CTCR_TIM_OC) == 0) // Toggle?
{
- m_ct = m_ctpr;
+ m_rtxc = (~m_rtxc) & 1;
}
- else
+ else // Pulse!
{
- m_ct = 0xffff;
+ m_rtxc = 1;
+ rtxc_timer->adjust(attotime::from_hz(clock()), 0, attotime::from_hz(clock()));
}
+ if (m_index == duscc_device::CHANNEL_A)
+ m_uart->m_out_rtxca_cb(m_rtxc);
+ else
+ m_uart->m_out_rtxcb_cb(m_rtxc);
+ }
- // Is Counter/Timer output on the RTxC pin?
- if (( m_pcr & REG_PCR_RTXC_MASK) == REG_PCR_RTXC_CNTR_OUT)
+ // Is Counter/Timer output on the TRXC pin?
+ if (( m_pcr & REG_PCR_TRXC_MASK) == REG_PCR_TRXC_CNTR_OUT)
+ {
+ if ((m_ctcr & REG_CTCR_TIM_OC) == 0) // Toggle?
{
- if ((m_ctcr & REG_CTCR_TIM_OC) == 0) // Toggle?
- {
- m_rtxc = (~m_rtxc) & 1;
- }
- else // Pulse!
- {
- m_rtxc = 1;
- rtxc_timer->adjust(attotime::from_hz(clock()), TIMER_ID_RTXC, attotime::from_hz(clock()));
- }
- if (m_index == duscc_device::CHANNEL_A)
- m_uart->m_out_rtxca_cb(m_rtxc);
- else
- m_uart->m_out_rtxcb_cb(m_rtxc);
+ m_trxc = (~m_trxc) & 1;
}
-
- // Is Counter/Timer output on the TRXC pin?
- if (( m_pcr & REG_PCR_TRXC_MASK) == REG_PCR_TRXC_CNTR_OUT)
+ else // Pulse!
{
- if ((m_ctcr & REG_CTCR_TIM_OC) == 0) // Toggle?
- {
- m_trxc = (~m_trxc) & 1;
- }
- else // Pulse!
- {
- m_trxc = 1;
- trxc_timer->adjust(attotime::from_hz(clock()), TIMER_ID_TRXC, attotime::from_hz(clock()));
- }
- if (m_index == duscc_device::CHANNEL_A)
- m_uart->m_out_trxca_cb(m_trxc);
- else
- m_uart->m_out_trxcb_cb(m_trxc);
+ m_trxc = 1;
+ trxc_timer->adjust(attotime::from_hz(clock()), 0, attotime::from_hz(clock()));
}
+ if (m_index == duscc_device::CHANNEL_A)
+ m_uart->m_out_trxca_cb(m_trxc);
+ else
+ m_uart->m_out_trxcb_cb(m_trxc);
}
- else
- { // clear zero detection bit
- m_ictsr &= ~REG_ICTSR_ZERO_DET;
- }
- break;
- case TIMER_ID_RTXC: // Terminate zero detection pulse
- m_rtxc = 0;
- rtxc_timer->adjust(attotime::never);
- if (m_index == duscc_device::CHANNEL_A)
- m_uart->m_out_rtxca_cb(m_rtxc);
- else
- m_uart->m_out_rtxcb_cb(m_rtxc);
- break;
- case TIMER_ID_TRXC: // Terminate zero detection pulse
- m_trxc = 0;
- trxc_timer->adjust(attotime::never);
- if (m_index == duscc_device::CHANNEL_A)
- m_uart->m_out_trxca_cb(m_trxc);
- else
- m_uart->m_out_trxcb_cb(m_trxc);
- break;
- default:
- LOGR("Unhandled Timer ID %d\n", id);
- break;
}
- // LOG("%s %d\n", FUNCNAME, id);
+ else
+ { // clear zero detection bit
+ m_ictsr &= ~REG_ICTSR_ZERO_DET;
+ }
+}
+
+TIMER_CALLBACK_MEMBER(duscc_channel::rtxc_tick)
+{
+ m_rtxc = 0;
+ rtxc_timer->adjust(attotime::never);
+ if (m_index == duscc_device::CHANNEL_A)
+ m_uart->m_out_rtxca_cb(m_rtxc);
+ else
+ m_uart->m_out_rtxcb_cb(m_rtxc);
+}
+
+TIMER_CALLBACK_MEMBER(duscc_channel::trxc_tick)
+{
+ m_trxc = 0;
+ trxc_timer->adjust(attotime::never);
+ if (m_index == duscc_device::CHANNEL_A)
+ m_uart->m_out_trxca_cb(m_trxc);
+ else
+ m_uart->m_out_trxcb_cb(m_trxc);
}
/* The DUSCC 16 bit Timer
@@ -2037,7 +2032,7 @@ void duscc_channel::do_dusccreg_ccr_w(uint8_t data)
/* Start. Starts the counteritimer and prescaler. */
case REG_CCR_START_TIMER: LOG("- Start Counter/Timer\n");
rate = 100; // TODO: calculate correct rate
- duscc_timer->adjust(attotime::from_hz(rate), TIMER_ID_RTXC, attotime::from_hz(rate));
+ duscc_timer->adjust(attotime::from_hz(rate), 0, attotime::from_hz(rate));
break;
/* Stop. Stops the counter/timer and prescaler. Since the command may be asynchronous with the selected clock source,
diff --git a/src/devices/machine/scnxx562.h b/src/devices/machine/scnxx562.h
index 9df50f0d16e..c9ac458b44c 100644
--- a/src/devices/machine/scnxx562.h
+++ b/src/devices/machine/scnxx562.h
@@ -152,7 +152,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_serial_interface overrides
virtual void tra_callback() override;
@@ -160,6 +159,10 @@ protected:
virtual void rcv_callback() override;
virtual void rcv_complete() override;
+ TIMER_CALLBACK_MEMBER(check_zero_detect);
+ TIMER_CALLBACK_MEMBER(rtxc_tick);
+ TIMER_CALLBACK_MEMBER(trxc_tick);
+
int m_rxc;
int m_txc;
int m_tra;
@@ -435,13 +438,6 @@ protected:
REG_CTCR_TIM_OC = 0x20,
};
- enum
- {
- TIMER_ID,
- TIMER_ID_RTXC,
- TIMER_ID_TRXC
- };
-
uint16_t m_brg_rx_rate;
uint16_t m_brg_tx_rate;
uint16_t m_brg_const;
diff --git a/src/devices/machine/sega_scu.cpp b/src/devices/machine/sega_scu.cpp
index 7b049c7425f..c2e7191d7cb 100644
--- a/src/devices/machine/sega_scu.cpp
+++ b/src/devices/machine/sega_scu.cpp
@@ -235,9 +235,9 @@ void sega_scu_device::device_start()
m_hostspace = &m_hostcpu->space(AS_PROGRAM);
- m_dma_timer[0] = timer_alloc(DMALV0_ID);
- m_dma_timer[1] = timer_alloc(DMALV1_ID);
- m_dma_timer[2] = timer_alloc(DMALV2_ID);
+ m_dma_timer[0] = timer_alloc(FUNC(sega_scu_device::dma_tick<DMALV0_ID>), this);
+ m_dma_timer[1] = timer_alloc(FUNC(sega_scu_device::dma_tick<DMALV1_ID>), this);
+ m_dma_timer[2] = timer_alloc(FUNC(sega_scu_device::dma_tick<DMALV2_ID>), this);
}
@@ -269,32 +269,20 @@ void sega_scu_device::device_reset_after_children()
m_scudsp->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
}
-
-void sega_scu_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+template <int Level>
+TIMER_CALLBACK_MEMBER(sega_scu_device::dma_tick)
{
+ const int irqlevel = Level == 0 ? 5 : 6;
+ const int irqvector = 0x4b - Level;
+ const uint16_t irqmask = 1 << (11 - Level);
- switch(id)
- {
- case DMALV0_ID:
- case DMALV1_ID:
- case DMALV2_ID:
- {
- const int irqlevel = id == 0 ? 5 : 6;
- const int irqvector = 0x4b - id;
- const uint16_t irqmask = 1 << (11-id);
-
- if(!(m_ism & irqmask))
- m_hostcpu->set_input_line_and_vector(irqlevel, HOLD_LINE, irqvector); // SH2
- else
- m_ist |= (irqmask);
+ if(!(m_ism & irqmask))
+ m_hostcpu->set_input_line_and_vector(irqlevel, HOLD_LINE, irqvector); // SH2
+ else
+ m_ist |= (irqmask);
- update_dma_status(id,false);
- machine().scheduler().synchronize(); // force resync
- break;
- }
- default:
- break;
- }
+ update_dma_status((uint8_t)Level,false);
+ machine().scheduler().synchronize(); // force resync
}
//**************************************************************************
diff --git a/src/devices/machine/sega_scu.h b/src/devices/machine/sega_scu.h
index c454862bea0..4ee8dd1f08d 100644
--- a/src/devices/machine/sega_scu.h
+++ b/src/devices/machine/sega_scu.h
@@ -63,12 +63,13 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_reset_after_children() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ template <int Level> TIMER_CALLBACK_MEMBER(dma_tick);
private:
required_device<scudsp_cpu_device> m_scudsp;
- enum {
+ enum dma_id : int {
DMALV0_ID = 0,
DMALV1_ID,
DMALV2_ID
diff --git a/src/devices/machine/sensorboard.cpp b/src/devices/machine/sensorboard.cpp
index e9edf3a892a..a729aa4c126 100644
--- a/src/devices/machine/sensorboard.cpp
+++ b/src/devices/machine/sensorboard.cpp
@@ -114,8 +114,8 @@ void sensorboard_device::device_start()
m_out_count.resolve();
}
- m_undotimer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sensorboard_device::undo_tick),this));
- m_sensortimer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sensorboard_device::sensor_off),this));
+ m_undotimer = timer_alloc(FUNC(sensorboard_device::undo_tick), this);
+ m_sensortimer = timer_alloc(FUNC(sensorboard_device::sensor_off), this);
cancel_sensor();
u16 wmask = ~((1 << m_width) - 1);
diff --git a/src/devices/machine/smc91c9x.cpp b/src/devices/machine/smc91c9x.cpp
index 3b661933e42..3ca3fbeed13 100644
--- a/src/devices/machine/smc91c9x.cpp
+++ b/src/devices/machine/smc91c9x.cpp
@@ -82,7 +82,7 @@ void smc91c9x_device::device_start()
m_buffer = std::make_unique<u8[]>(ETHER_BUFFER_SIZE * m_num_ebuf);
// TX timer
- m_tx_poll = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(smc91c9x_device::tx_poll), this));
+ m_tx_poll = timer_alloc(FUNC(smc91c9x_device::tx_poll), this);
m_irq_handler.resolve_safe();
diff --git a/src/devices/machine/smioc.cpp b/src/devices/machine/smioc.cpp
index cd871e3d0a8..06c3e03adb1 100644
--- a/src/devices/machine/smioc.cpp
+++ b/src/devices/machine/smioc.cpp
@@ -214,8 +214,8 @@ smioc_device::smioc_device(const machine_config &mconfig, const char *tag, devic
void smioc_device::device_start()
{
- m_dma_timer = timer_alloc(0);
- m_451_timer = timer_alloc(1);
+ m_dma_timer = timer_alloc(FUNC(smioc_device::raise_drq), this);
+ m_451_timer = timer_alloc(FUNC(smioc_device::raise_int1), this);
/* Resolve callbacks */
m_m68k_r_cb.resolve_safe(0);
@@ -245,20 +245,17 @@ void smioc_device::SoftReset()
m_deviceBusy = 1;
}
-
-void smioc_device::device_timer(emu_timer &timer, device_timer_id tid, int param)
+TIMER_CALLBACK_MEMBER(smioc_device::raise_drq)
{
- switch (tid)
- {
- case 0: // DMA Timer
- m_smioccpu->drq0_w(1);
- break;
+ // DMA Timer
+ m_smioccpu->drq0_w(1);
+}
- case 1: // 451 emulation timer - Trigger the SMIOC to read from C0180 and store data
- m_smioccpu->int1_w(CLEAR_LINE);
- m_smioccpu->int1_w(HOLD_LINE);
- break;
- }
+TIMER_CALLBACK_MEMBER(smioc_device::raise_int1)
+{
+ // 451 emulation timer - Trigger the SMIOC to read from C0180 and store data
+ m_smioccpu->int1_w(CLEAR_LINE);
+ m_smioccpu->int1_w(HOLD_LINE);
}
void smioc_device::SendCommand(u16 command)
diff --git a/src/devices/machine/smioc.h b/src/devices/machine/smioc.h
index 4939fb53b1b..73dd874d149 100644
--- a/src/devices/machine/smioc.h
+++ b/src/devices/machine/smioc.h
@@ -108,7 +108,9 @@ protected:
/* Optional information overrides */
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(raise_drq);
+ TIMER_CALLBACK_MEMBER(raise_int1);
u16 ReadDmaParameter(smioc_dma_parameter_t param);
int DmaParameterAddress(smioc_dma_parameter_t param);
diff --git a/src/devices/machine/smpc.cpp b/src/devices/machine/smpc.cpp
index 30047cb51f1..7161d97b7f9 100644
--- a/src/devices/machine/smpc.cpp
+++ b/src/devices/machine/smpc.cpp
@@ -285,10 +285,10 @@ void smpc_hle_device::device_start()
save_item(NAME(m_rtc_data));
save_item(NAME(m_smem));
- m_cmd_timer = timer_alloc(COMMAND_ID);
- m_rtc_timer = timer_alloc(RTC_ID);
- m_intback_timer = timer_alloc(INTBACK_ID);
- m_sndres_timer = timer_alloc(SNDRES_ID);
+ m_cmd_timer = timer_alloc(FUNC(smpc_hle_device::handle_command), this);
+ m_rtc_timer = timer_alloc(FUNC(smpc_hle_device::handle_rtc_increment), this);
+ m_intback_timer = timer_alloc(FUNC(smpc_hle_device::intback_continue_request), this);
+ m_sndres_timer = timer_alloc(FUNC(smpc_hle_device::sound_reset), this);
m_rtc_data[0] = DectoBCD(systime.local_time.year / 100);
m_rtc_data[1] = DectoBCD(systime.local_time.year % 100);
@@ -564,132 +564,119 @@ void smpc_hle_device::command_register_w(uint8_t data)
}
-void smpc_hle_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(smpc_hle_device::handle_command)
{
- switch(id)
+ switch(m_comreg)
{
- case COMMAND_ID:
- {
- switch(m_comreg)
- {
- case 0x00: // MSHON
- // enable Master SH2
- m_mshres(m_comreg & 1);
- break;
-
- case 0x02: // SSHON
- case 0x03: // SSHOFF
- // enable or disable Slave SH2
- m_sshres(m_comreg & 1);
- break;
-
- case 0x06: // SNDON
- case 0x07: // SNDOFF
- // enable or disable 68k
- m_sndres(m_comreg & 1);
- break;
-
- case 0x08: // CDON
- case 0x09: // CDOFF
- // ...
- m_command_in_progress = false;
- m_oreg[31] = m_comreg;
- // TODO: diagnostic also wants this to have bit 3 high
- sf_ack(true); //set hand-shake flag
- return;
-
- case 0x0a: // NETLINKON
- // TODO: understand where NetLink actually lies and implement delegation accordingly
- // (is it really an SH1 device like suggested by the space access or it overlays on CS2 bus?)
- popmessage("%s: NetLink enabled", this->tag());
- [[fallthrough]];
- case 0x0b: // NETLINKOFF
- break;
-
- case 0x0d: // SYSRES
- // send a 1 -> 0 to device reset lines
- m_sysres(1);
- m_sysres(0);
-
- // send a 1 -> 0 transition to reset line (was PULSE_LINE)
- m_mshres(1);
- m_mshres(0);
- break;
-
- case 0x0e: // CKCHG352
- case 0x0f: // CKCHG320
- m_dotsel(m_comreg & 1);
-
- // assert Slave SH2 line
- m_sshres(1);
- // clear PLL system halt
- m_syshalt(0);
-
- // setup the new dot select
- m_cur_dotsel = (m_comreg & 1) ^ 1;
-
- // send a NMI to Master SH2 if enabled
- // it is unconditionally requested:
- // bigichig, capgen1, capgen4 and capgen5 triggers a SLEEP opcode from BIOS call and expects this to wake them up.
- //if(m_NMI_reset == false)
- master_sh2_nmi();
- break;
-
- case 0x10: // INTBACK
- resolve_intback();
- return;
-
- case 0x16: // SETTIME
- {
- for(int i=0;i<7;i++)
- m_rtc_data[i] = m_ireg[i];
- break;
- }
-
- case 0x17: // SETSMEM
- {
- for(int i=0;i<4;i++)
- m_smem[i] = m_ireg[i];
-
- // clear the SETIME variable, simulate a cr2032 battery alive in the system
- m_smem[4] = 0xff;
- break;
- }
-
- case 0x18: // NMIREQ
- // NMI is unconditionally requested
- master_sh2_nmi();
- break;
-
- case 0x19: // RESENAB
- case 0x1a: // RESDISA
- m_NMI_reset = m_comreg & 1;
- break;
-
- default:
- logerror("%s: unemulated %02x command\n",this->tag(),m_comreg);
- return;
- }
+ case 0x00: // MSHON
+ // enable Master SH2
+ m_mshres(m_comreg & 1);
+ break;
+ case 0x02: // SSHON
+ case 0x03: // SSHOFF
+ // enable or disable Slave SH2
+ m_sshres(m_comreg & 1);
+ break;
+
+ case 0x06: // SNDON
+ case 0x07: // SNDOFF
+ // enable or disable 68k
+ m_sndres(m_comreg & 1);
+ break;
+
+ case 0x08: // CDON
+ case 0x09: // CDOFF
+ // ...
m_command_in_progress = false;
m_oreg[31] = m_comreg;
- sf_ack(false);
+ // TODO: diagnostic also wants this to have bit 3 high
+ sf_ack(true); //set hand-shake flag
+ return;
+
+ case 0x0a: // NETLINKON
+ // TODO: understand where NetLink actually lies and implement delegation accordingly
+ // (is it really an SH1 device like suggested by the space access or it overlays on CS2 bus?)
+ popmessage("%s: NetLink enabled", this->tag());
+ [[fallthrough]];
+ case 0x0b: // NETLINKOFF
+ break;
+
+ case 0x0d: // SYSRES
+ // send a 1 -> 0 to device reset lines
+ m_sysres(1);
+ m_sysres(0);
+
+ // send a 1 -> 0 transition to reset line (was PULSE_LINE)
+ m_mshres(1);
+ m_mshres(0);
+ break;
+
+ case 0x0e: // CKCHG352
+ case 0x0f: // CKCHG320
+ m_dotsel(m_comreg & 1);
+
+ // assert Slave SH2 line
+ m_sshres(1);
+ // clear PLL system halt
+ m_syshalt(0);
+
+ // setup the new dot select
+ m_cur_dotsel = (m_comreg & 1) ^ 1;
+
+ // send a NMI to Master SH2 if enabled
+ // it is unconditionally requested:
+ // bigichig, capgen1, capgen4 and capgen5 triggers a SLEEP opcode from BIOS call and expects this to wake them up.
+ //if(m_NMI_reset == false)
+ master_sh2_nmi();
+ break;
+
+ case 0x10: // INTBACK
+ resolve_intback();
+ return;
+
+ case 0x16: // SETTIME
+ {
+ for(int i=0;i<7;i++)
+ m_rtc_data[i] = m_ireg[i];
break;
}
- case INTBACK_ID: intback_continue_request(); break;
- case RTC_ID: handle_rtc_increment(); break;
+ case 0x17: // SETSMEM
+ {
+ for(int i=0;i<4;i++)
+ m_smem[i] = m_ireg[i];
+
+ // clear the SETIME variable, simulate a cr2032 battery alive in the system
+ m_smem[4] = 0xff;
+ break;
+ }
- // from m68k reset opcode trigger
- case SNDRES_ID:
- m_sndres(1);
- m_sndres(0);
+ case 0x18: // NMIREQ
+ // NMI is unconditionally requested
+ master_sh2_nmi();
break;
- default:
- printf("%d\n",id);
+ case 0x19: // RESENAB
+ case 0x1a: // RESDISA
+ m_NMI_reset = m_comreg & 1;
break;
+
+ default:
+ logerror("%s: unemulated %02x command\n",this->tag(),m_comreg);
+ return;
}
+
+ m_command_in_progress = false;
+ m_oreg[31] = m_comreg;
+ sf_ack(false);
+}
+
+TIMER_CALLBACK_MEMBER(smpc_hle_device::sound_reset)
+{
+ // from m68k reset opcode trigger
+ m_sndres(1);
+ m_sndres(0);
}
void smpc_hle_device::resolve_intback()
@@ -749,7 +736,7 @@ void smpc_hle_device::resolve_intback()
m_intback_stage = (m_intback_buf[1] & 8) >> 3; // first peripheral
sr_set(0x40);
m_oreg[31] = 0x10;
- intback_continue_request();
+ intback_continue_request(0);
}
else
{
@@ -759,7 +746,7 @@ void smpc_hle_device::resolve_intback()
}
}
-void smpc_hle_device::intback_continue_request()
+TIMER_CALLBACK_MEMBER(smpc_hle_device::intback_continue_request)
{
if( m_has_ctrl_ports == true )
read_saturn_ports();
@@ -801,7 +788,7 @@ int smpc_hle_device::DectoBCD(int num)
// RTC handling
//**************************************************************************
-void smpc_hle_device::handle_rtc_increment()
+TIMER_CALLBACK_MEMBER(smpc_hle_device::handle_rtc_increment)
{
const uint8_t dpm[12] = { 0x31, 0x28, 0x31, 0x30, 0x31, 0x30, 0x31, 0x31, 0x30, 0x31, 0x30, 0x31 };
int year_num, year_count;
diff --git a/src/devices/machine/smpc.h b/src/devices/machine/smpc.h
index a2f7c140ef0..60b461b6ad3 100644
--- a/src/devices/machine/smpc.h
+++ b/src/devices/machine/smpc.h
@@ -86,18 +86,11 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual space_config_vector memory_space_config() const override;
private:
const address_space_config m_space_config;
- enum {
- COMMAND_ID = 1,
- RTC_ID,
- INTBACK_ID,
- SNDRES_ID
- };
emu_timer *m_cmd_timer;
emu_timer *m_rtc_timer;
@@ -142,8 +135,10 @@ private:
void irq_request();
void resolve_intback();
- void intback_continue_request();
- void handle_rtc_increment();
+ TIMER_CALLBACK_MEMBER(intback_continue_request);
+ TIMER_CALLBACK_MEMBER(handle_rtc_increment);
+ TIMER_CALLBACK_MEMBER(sound_reset);
+ TIMER_CALLBACK_MEMBER(handle_command);
void read_saturn_ports();
void sr_set(uint8_t data);
diff --git a/src/devices/machine/spg290_cdservo.cpp b/src/devices/machine/spg290_cdservo.cpp
index 3370724ece2..7d03836a486 100644
--- a/src/devices/machine/spg290_cdservo.cpp
+++ b/src/devices/machine/spg290_cdservo.cpp
@@ -36,7 +36,7 @@ void spg290_cdservo_device::device_start()
m_irq_cb.resolve_safe();
m_space_write_cb.resolve_safe();
- m_cdtimer = timer_alloc();
+ m_cdtimer = timer_alloc(FUNC(spg290_cdservo_device::cd_update), this);
m_dsp_memory = std::make_unique<uint32_t[]>(0x10000);
save_item(NAME(m_addr));
@@ -101,7 +101,7 @@ void spg290_cdservo_device::device_reset()
change_status();
}
-void spg290_cdservo_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(spg290_cdservo_device::cd_update)
{
if (!(m_control1 & 0x04) && m_cur_sector == m_seek_lba + SPG290_LEADIN_LEN)
{
diff --git a/src/devices/machine/spg290_cdservo.h b/src/devices/machine/spg290_cdservo.h
index aff8cb62447..aa1d8077407 100644
--- a/src/devices/machine/spg290_cdservo.h
+++ b/src/devices/machine/spg290_cdservo.h
@@ -31,7 +31,8 @@ public:
protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(cd_update);
private:
void change_status();
diff --git a/src/devices/machine/spg290_i2c.cpp b/src/devices/machine/spg290_i2c.cpp
index 0475824c9bc..e360a451736 100644
--- a/src/devices/machine/spg290_i2c.cpp
+++ b/src/devices/machine/spg290_i2c.cpp
@@ -26,7 +26,7 @@ void spg290_i2c_device::device_start()
m_irq_cb.resolve_safe();
m_i2c_read_cb.resolve_safe(0);
m_i2c_write_cb.resolve_safe();
- m_i2c_timer = timer_alloc();
+ m_i2c_timer = timer_alloc(FUNC(spg290_i2c_device::i2c_update), this);
save_item(NAME(m_config));
save_item(NAME(m_irq_control));
@@ -52,7 +52,7 @@ void spg290_i2c_device::device_reset()
m_irq_cb(CLEAR_LINE);
}
-void spg290_i2c_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(spg290_i2c_device::i2c_update)
{
if (m_config & 0x40)
m_rdata = m_i2c_read_cb(m_port_addr);
diff --git a/src/devices/machine/spg290_i2c.h b/src/devices/machine/spg290_i2c.h
index 5e9fd0b3347..2dca1d145f4 100644
--- a/src/devices/machine/spg290_i2c.h
+++ b/src/devices/machine/spg290_i2c.h
@@ -23,7 +23,7 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(i2c_update);
private:
devcb_write_line m_irq_cb;
diff --git a/src/devices/machine/spg290_timer.cpp b/src/devices/machine/spg290_timer.cpp
index e574f3fcf39..8b02f751696 100644
--- a/src/devices/machine/spg290_timer.cpp
+++ b/src/devices/machine/spg290_timer.cpp
@@ -22,7 +22,7 @@ spg290_timer_device::spg290_timer_device(const machine_config &mconfig, const ch
void spg290_timer_device::device_start()
{
m_irq_cb.resolve_safe();
- m_tick_timer = timer_alloc();
+ m_tick_timer = timer_alloc(FUNC(spg290_timer_device::timer_update), this);
save_item(NAME(m_enabled));
save_item(NAME(m_control));
@@ -56,7 +56,7 @@ void spg290_timer_device::device_clock_changed()
m_tick_timer->adjust(attotime::never);
}
-void spg290_timer_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(spg290_timer_device::timer_update)
{
if (!BIT(m_control, 31))
return;
diff --git a/src/devices/machine/spg290_timer.h b/src/devices/machine/spg290_timer.h
index 9f3c3fe1e80..486011cb90b 100644
--- a/src/devices/machine/spg290_timer.h
+++ b/src/devices/machine/spg290_timer.h
@@ -22,7 +22,7 @@ protected:
virtual void device_reset() override;
virtual void device_clock_changed() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(timer_update);
private:
devcb_write_line m_irq_cb;
diff --git a/src/devices/machine/spg2xx_audio.cpp b/src/devices/machine/spg2xx_audio.cpp
index 8c6c76c3fab..e8518bdaa59 100644
--- a/src/devices/machine/spg2xx_audio.cpp
+++ b/src/devices/machine/spg2xx_audio.cpp
@@ -73,7 +73,7 @@ sunplus_gcm394_audio_device::sunplus_gcm394_audio_device(const machine_config &m
void spg2xx_audio_device::device_start()
{
- m_audio_beat = timer_alloc(TIMER_BEAT);
+ m_audio_beat = timer_alloc(FUNC(spg2xx_audio_device::audio_beat_tick), this);
m_audio_beat->adjust(attotime::never);
m_stream = stream_alloc(0, 2, 281250/4);
@@ -107,7 +107,7 @@ void spg2xx_audio_device::device_start()
memset(m_adpcm36_state + i, 0, sizeof(adpcm36_state));
- m_channel_irq[i] = timer_alloc(TIMER_IRQ + i);
+ m_channel_irq[i] = timer_alloc(FUNC(spg2xx_audio_device::irq_tick), this);
m_channel_irq[i]->adjust(attotime::never);
}
@@ -159,24 +159,12 @@ void spg2xx_audio_device::device_stop()
#endif
}
-void spg2xx_audio_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(spg2xx_audio_device::irq_tick)
{
- if (id >= TIMER_IRQ && id < (TIMER_IRQ + 16))
+ if (!BIT(m_audio_ctrl_regs[AUDIO_CHANNEL_FIQ_STATUS], param))
{
- const uint32_t bit = id - TIMER_IRQ;
- if (!BIT(m_audio_ctrl_regs[AUDIO_CHANNEL_FIQ_STATUS], bit))
- {
- m_audio_ctrl_regs[AUDIO_CHANNEL_FIQ_STATUS] |= (1 << (id - TIMER_IRQ));
- m_ch_irq_cb(1);
- }
- return;
- }
-
- switch (id)
- {
- case TIMER_BEAT:
- audio_beat_tick();
- break;
+ m_audio_ctrl_regs[AUDIO_CHANNEL_FIQ_STATUS] |= (1 << param);
+ m_ch_irq_cb(1);
}
}
@@ -480,7 +468,7 @@ void spg2xx_audio_device::audio_ctrl_w(offs_t offset, uint16_t data)
m_audio_ctrl_regs[offset] |= mask;
if (BIT(m_audio_ctrl_regs[AUDIO_CHANNEL_FIQ_ENABLE], channel_bit))
{
- m_channel_irq[channel_bit]->adjust(attotime::from_hz(m_channel_rate[channel_bit]), 0, attotime::from_hz(m_channel_rate[channel_bit]));
+ m_channel_irq[channel_bit]->adjust(attotime::from_hz(m_channel_rate[channel_bit]), channel_bit, attotime::from_hz(m_channel_rate[channel_bit]));
}
else
{
@@ -1250,7 +1238,7 @@ inline void spg2xx_audio_device::loop_channel(const uint32_t channel)
LOGMASKED(LOG_SAMPLES, "Channel %d: Looping to address %08x\n", channel, m_sample_addr[channel]);
}
-void spg2xx_audio_device::audio_beat_tick()
+TIMER_CALLBACK_MEMBER(spg2xx_audio_device::audio_beat_tick)
{
if (m_audio_curr_beat_base_count > 0)
{
diff --git a/src/devices/machine/spg2xx_audio.h b/src/devices/machine/spg2xx_audio.h
index 72d9fd736d5..d0712139134 100644
--- a/src/devices/machine/spg2xx_audio.h
+++ b/src/devices/machine/spg2xx_audio.h
@@ -35,7 +35,8 @@ protected:
// sound stream update overrides
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
- void audio_beat_tick();
+ TIMER_CALLBACK_MEMBER(irq_tick);
+ TIMER_CALLBACK_MEMBER(audio_beat_tick);
void audio_rampdown_tick(const uint32_t channel);
bool audio_envelope_tick(const uint32_t channel);
inline uint32_t get_rampdown_frame_count(const uint32_t channel);
@@ -329,15 +330,11 @@ protected:
int16_t m_prevsamp[2];
};
- static const device_timer_id TIMER_BEAT = 3;
- static const device_timer_id TIMER_IRQ = 4;
-
void check_irqs(const uint16_t changed);
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_stop() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
uint16_t read_space(offs_t offset);
diff --git a/src/devices/machine/spg2xx_io.cpp b/src/devices/machine/spg2xx_io.cpp
index b465fdcc546..13fa8a04c4f 100644
--- a/src/devices/machine/spg2xx_io.cpp
+++ b/src/devices/machine/spg2xx_io.cpp
@@ -99,24 +99,24 @@ void spg2xx_io_device::device_start()
m_fiq_vector_w.resolve_safe();
- m_tmb1 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(spg2xx_io_device::tmb_timer_tick<0>), this));
- m_tmb2 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(spg2xx_io_device::tmb_timer_tick<1>), this));
+ m_tmb1 = timer_alloc(FUNC(spg2xx_io_device::tmb_timer_tick<0>), this);
+ m_tmb2 = timer_alloc(FUNC(spg2xx_io_device::tmb_timer_tick<1>), this);
- m_uart_tx_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(spg2xx_io_device::uart_transmit_tick), this));
- m_uart_rx_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(spg2xx_io_device::uart_receive_tick), this));
+ m_uart_tx_timer = timer_alloc(FUNC(spg2xx_io_device::uart_transmit_tick), this);
+ m_uart_rx_timer = timer_alloc(FUNC(spg2xx_io_device::uart_receive_tick), this);
- m_4khz_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(spg2xx_io_device::system_timer_tick), this));
+ m_4khz_timer = timer_alloc(FUNC(spg2xx_io_device::system_timer_tick), this);
- m_timer_src_ab = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(spg2xx_io_device::timer_ab_tick), this));
- m_timer_src_c = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(spg2xx_io_device::timer_c_tick), this));
- m_rng_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(spg2xx_io_device::rng_clock_tick), this));
- m_watchdog_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(spg2xx_io_device::watchdog_tick), this));
- m_spi_tx_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(spg2xx_io_device::spi_tx_tick), this));
+ m_timer_src_ab = timer_alloc(FUNC(spg2xx_io_device::timer_ab_tick), this);
+ m_timer_src_c = timer_alloc(FUNC(spg2xx_io_device::timer_c_tick), this);
+ m_rng_timer = timer_alloc(FUNC(spg2xx_io_device::rng_clock_tick), this);
+ m_watchdog_timer = timer_alloc(FUNC(spg2xx_io_device::watchdog_tick), this);
+ m_spi_tx_timer = timer_alloc(FUNC(spg2xx_io_device::spi_tx_tick), this);
- m_adc_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(spg2xx_io_device::adc_convert_tick<0>), this));
- m_adc_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(spg2xx_io_device::adc_convert_tick<1>), this));
- m_adc_timer[2] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(spg2xx_io_device::adc_convert_tick<2>), this));
- m_adc_timer[3] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(spg2xx_io_device::adc_convert_tick<3>), this));
+ m_adc_timer[0] = timer_alloc(FUNC(spg2xx_io_device::adc_convert_tick<0>), this);
+ m_adc_timer[1] = timer_alloc(FUNC(spg2xx_io_device::adc_convert_tick<1>), this);
+ m_adc_timer[2] = timer_alloc(FUNC(spg2xx_io_device::adc_convert_tick<2>), this);
+ m_adc_timer[3] = timer_alloc(FUNC(spg2xx_io_device::adc_convert_tick<3>), this);
save_item(NAME(m_io_regs));
diff --git a/src/devices/machine/spg2xx_video.cpp b/src/devices/machine/spg2xx_video.cpp
index cdf93b52c51..b8d9fa2d22d 100644
--- a/src/devices/machine/spg2xx_video.cpp
+++ b/src/devices/machine/spg2xx_video.cpp
@@ -31,13 +31,13 @@ spg2xx_video_device::spg2xx_video_device(const machine_config &mconfig, device_t
m_guny_in(*this),
m_gunx_in(*this),
m_sprlimit_read_cb(*this),
+ m_video_irq_cb(*this),
m_cpu(*this, finder_base::DUMMY_TAG),
m_screen(*this, finder_base::DUMMY_TAG),
m_scrollram(*this, "scrollram"),
m_hcompram(*this, "hcompram"),
m_paletteram(*this, "paletteram"),
m_spriteram(*this, "spriteram"),
- m_video_irq_cb(*this),
m_renderer(*this, "renderer")
{
}
@@ -52,7 +52,7 @@ void spg2xx_video_device::device_start()
m_guny_in.resolve_safe(0);
m_gunx_in.resolve_safe(0);
- m_screenpos_timer = timer_alloc(TIMER_SCREENPOS);
+ m_screenpos_timer = timer_alloc(FUNC(spg2xx_video_device::screenpos_hit), this);
m_screenpos_timer->adjust(attotime::never);
save_item(NAME(m_video_regs));
@@ -463,24 +463,17 @@ void spg2xx_video_device::check_video_irq()
m_video_irq_cb((VIDEO_IRQ_STATUS & VIDEO_IRQ_ENABLE) ? ASSERT_LINE : CLEAR_LINE);
}
-void spg2xx_video_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(spg2xx_video_device::screenpos_hit)
{
- switch (id)
+ if (VIDEO_IRQ_ENABLE & 2)
{
- case TIMER_SCREENPOS:
- {
- if (VIDEO_IRQ_ENABLE & 2)
- {
- VIDEO_IRQ_STATUS |= 2;
- check_video_irq();
- }
- m_screen->update_partial(m_screen->vpos());
-
- // fire again, jak_dbz pinball needs this
- m_screenpos_timer->adjust(m_screen->time_until_pos(m_video_regs[0x36], m_video_regs[0x37] << 1));
- break;
- }
+ VIDEO_IRQ_STATUS |= 2;
+ check_video_irq();
}
+ m_screen->update_partial(m_screen->vpos());
+
+ // fire again, jak_dbz pinball needs this
+ m_screenpos_timer->adjust(m_screen->time_until_pos(m_video_regs[0x36], m_video_regs[0x37] << 1));
}
diff --git a/src/devices/machine/spg2xx_video.h b/src/devices/machine/spg2xx_video.h
index f4d3e5e93b6..b484c42d1af 100644
--- a/src/devices/machine/spg2xx_video.h
+++ b/src/devices/machine/spg2xx_video.h
@@ -35,26 +35,19 @@ public:
auto write_video_irq_callback() { return m_video_irq_cb.bind(); }
protected:
- virtual void device_add_mconfig(machine_config &config) override;
-
- devcb_read16 m_guny_in;
- devcb_read16 m_gunx_in;
-
- inline void check_video_irq();
-
- static const device_timer_id TIMER_SCREENPOS = 2;
-
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ virtual void device_add_mconfig(machine_config &config) override;
- void do_sprite_dma(uint32_t len);
+ void check_video_irq();
+ TIMER_CALLBACK_MEMBER(screenpos_hit);
- uint16_t m_video_regs[0x100];
+ void do_sprite_dma(uint32_t len);
+ devcb_read16 m_guny_in;
+ devcb_read16 m_gunx_in;
devcb_read16 m_sprlimit_read_cb;
-
- emu_timer *m_screenpos_timer;
+ devcb_write_line m_video_irq_cb;
required_device<unsp_device> m_cpu;
required_device<screen_device> m_screen;
@@ -62,10 +55,10 @@ protected:
required_shared_ptr<uint16_t> m_hcompram;
required_shared_ptr<uint16_t> m_paletteram;
required_shared_ptr<uint16_t> m_spriteram;
-
- devcb_write_line m_video_irq_cb;
-
required_device<spg_renderer_device> m_renderer;
+
+ emu_timer *m_screenpos_timer;
+ uint16_t m_video_regs[0x100];
};
class spg24x_video_device : public spg2xx_video_device
diff --git a/src/devices/machine/sun4c_mmu.cpp b/src/devices/machine/sun4c_mmu.cpp
index 655326ccc1a..16b63c17dc1 100644
--- a/src/devices/machine/sun4c_mmu.cpp
+++ b/src/devices/machine/sun4c_mmu.cpp
@@ -100,7 +100,7 @@ void sun4_mmu_base_device::device_start()
m_type1_w.resolve_safe();
// allocate timer for system reset
- m_reset_timer = timer_alloc(TIMER_RESET);
+ m_reset_timer = timer_alloc(FUNC(sun4_mmu_base_device::reset_off_tick), this);
m_reset_timer->adjust(attotime::never);
m_segmap = std::make_unique<std::unique_ptr<uint8_t[]>[]>(16);
@@ -221,13 +221,10 @@ void sun4_mmu_base_device::device_reset()
memset(&m_cachedata[0], 0, sizeof(uint32_t) * 16384);
}
-void sun4_mmu_base_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(sun4_mmu_base_device::reset_off_tick)
{
- if (id == TIMER_RESET)
- {
- m_reset_timer->adjust(attotime::never);
- m_cpu->set_input_line(SPARC_RESET, CLEAR_LINE);
- }
+ m_reset_timer->adjust(attotime::never);
+ m_cpu->set_input_line(SPARC_RESET, CLEAR_LINE);
}
uint32_t sun4_mmu_base_device::fetch_insn(const bool supervisor, uint32_t offset)
diff --git a/src/devices/machine/sun4c_mmu.h b/src/devices/machine/sun4c_mmu.h
index 10e6afe8812..48f8517f33b 100644
--- a/src/devices/machine/sun4c_mmu.h
+++ b/src/devices/machine/sun4c_mmu.h
@@ -122,12 +122,11 @@ protected:
uint8_t pad[3];
};
- static const device_timer_id TIMER_RESET = 0;
-
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_stop() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(reset_off_tick);
uint32_t page_entry_to_uint(uint32_t index);
void merge_page_entry(uint32_t index, uint32_t data, uint32_t mem_mask);
diff --git a/src/devices/machine/swim1.cpp b/src/devices/machine/swim1.cpp
index d3d36dfd777..2d0adc04c60 100644
--- a/src/devices/machine/swim1.cpp
+++ b/src/devices/machine/swim1.cpp
@@ -22,7 +22,7 @@ void swim1_device::device_start()
{
applefdintf_device::device_start();
- m_timer = timer_alloc();
+ m_timer = timer_alloc(FUNC(swim1_device::update), this);
save_item(NAME(m_last_sync));
save_item(NAME(m_flux_write_start));
save_item(NAME(m_flux_write));
@@ -381,7 +381,7 @@ void swim1_device::ism_write(offs_t offset, u8 data)
}
}
-void swim1_device::device_timer(emu_timer &, device_timer_id, int)
+TIMER_CALLBACK_MEMBER(swim1_device::update)
{
if(m_iwm_active == MODE_DELAY) {
flush_write();
diff --git a/src/devices/machine/swim1.h b/src/devices/machine/swim1.h
index dd87bf3fb43..dd0b372d54f 100644
--- a/src/devices/machine/swim1.h
+++ b/src/devices/machine/swim1.h
@@ -35,7 +35,8 @@ public:
protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(update);
private:
enum {
diff --git a/src/devices/machine/swim2.cpp b/src/devices/machine/swim2.cpp
index 45d8447c367..d1834aad676 100644
--- a/src/devices/machine/swim2.cpp
+++ b/src/devices/machine/swim2.cpp
@@ -79,10 +79,6 @@ void swim2_device::device_reset()
m_last_sync = machine().time().as_ticks(clock());
}
-void swim2_device::device_timer(emu_timer &, device_timer_id, int)
-{
-}
-
void swim2_device::set_floppy(floppy_image_device *floppy)
{
if(m_floppy == floppy)
diff --git a/src/devices/machine/swim2.h b/src/devices/machine/swim2.h
index 8cf665986c8..bab440e4ec9 100644
--- a/src/devices/machine/swim2.h
+++ b/src/devices/machine/swim2.h
@@ -36,7 +36,6 @@ public:
protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
private:
enum {
diff --git a/src/devices/machine/swim3.cpp b/src/devices/machine/swim3.cpp
index 41f313c3ee5..6c93ee6b0c4 100644
--- a/src/devices/machine/swim3.cpp
+++ b/src/devices/machine/swim3.cpp
@@ -24,7 +24,7 @@ void swim3_device::device_start()
m_irq_cb.resolve_safe();
m_drq_cb.resolve_safe();
- m_timer = timer_alloc(0);
+ m_timer = timer_alloc(FUNC(swim3_device::update), this);
save_item(NAME(m_mode));
save_item(NAME(m_setup));
@@ -300,7 +300,8 @@ void swim3_device::index_callback(floppy_image_device *floppy, int state)
run(false, true);
}
}
-void swim3_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+
+TIMER_CALLBACK_MEMBER(swim3_device::update)
{
sync();
run(true, false);
diff --git a/src/devices/machine/swim3.h b/src/devices/machine/swim3.h
index e6a1cba19d1..61e280850e0 100644
--- a/src/devices/machine/swim3.h
+++ b/src/devices/machine/swim3.h
@@ -42,7 +42,8 @@ public:
protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(update);
private:
enum {
diff --git a/src/devices/machine/swtpc8212.cpp b/src/devices/machine/swtpc8212.cpp
index f33176f8771..4d214e43175 100644
--- a/src/devices/machine/swtpc8212.cpp
+++ b/src/devices/machine/swtpc8212.cpp
@@ -323,14 +323,9 @@ MC6845_UPDATE_ROW(swtpc8212_device::update_row)
}
}
-void swtpc8212_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(swtpc8212_device::bell_off)
{
- switch (id)
- {
- case BELL_TIMER_ID:
- m_beeper->set_state(0);
- break;
- }
+ m_beeper->set_state(0);
}
void swtpc8212_device::rs232_conn_dcd_w(int state)
@@ -382,7 +377,7 @@ void swtpc8212_device::device_resolve_objects()
void swtpc8212_device::device_start()
{
- m_bell_timer = timer_alloc(BELL_TIMER_ID);
+ m_bell_timer = timer_alloc(FUNC(swtpc8212_device::bell_off), this);
save_item(NAME(m_latch_data));
save_item(NAME(m_keyboard_data));
diff --git a/src/devices/machine/swtpc8212.h b/src/devices/machine/swtpc8212.h
index 673a958b4ef..0d363860c14 100644
--- a/src/devices/machine/swtpc8212.h
+++ b/src/devices/machine/swtpc8212.h
@@ -39,18 +39,14 @@ protected:
virtual void device_resolve_objects() override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_add_mconfig(machine_config &config) override;
virtual ioport_constructor device_input_ports() const override;
virtual const tiny_rom_entry *device_rom_region() const override;
-private:
- enum
- {
- BELL_TIMER_ID = 1
- };
+ TIMER_CALLBACK_MEMBER(bell_off);
+private:
void mem_map(address_map &map);
required_device<m6802_cpu_device> m_maincpu;
diff --git a/src/devices/machine/terminal.cpp b/src/devices/machine/terminal.cpp
index 9dd98c13a00..fc1b5cf3092 100644
--- a/src/devices/machine/terminal.cpp
+++ b/src/devices/machine/terminal.cpp
@@ -346,7 +346,7 @@ void generic_terminal_device::device_add_mconfig(machine_config &config)
void generic_terminal_device::device_start()
{
m_buffer = std::make_unique<uint8_t []>(m_width * m_height);
- m_bell_timer = timer_alloc(BELL_TIMER_ID);
+ m_bell_timer = timer_alloc(FUNC(generic_terminal_device::bell_off), this);
m_keyboard_cb.resolve();
save_pointer(NAME(m_buffer), m_width * m_height);
save_item(NAME(m_x_pos));
@@ -361,14 +361,9 @@ void generic_terminal_device::device_reset()
m_framecnt = 0;
}
-void generic_terminal_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(generic_terminal_device::bell_off)
{
- switch (id)
- {
- case BELL_TIMER_ID:
- m_beeper->set_state(0);
- break;
- }
+ m_beeper->set_state(0);
}
/*
diff --git a/src/devices/machine/terminal.h b/src/devices/machine/terminal.h
index 620d04c3c1e..5ebf1468b22 100644
--- a/src/devices/machine/terminal.h
+++ b/src/devices/machine/terminal.h
@@ -34,18 +34,17 @@ public:
void kbd_put(u8 data);
protected:
- enum { BELL_TIMER_ID = 20'000 };
-
generic_terminal_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, unsigned w, unsigned h);
virtual void term_write(uint8_t data);
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual ioport_constructor device_input_ports() const override;
virtual void device_add_mconfig(machine_config &config) override;
virtual void send_key(uint8_t code) { if (!m_keyboard_cb.isnull()) m_keyboard_cb(code); }
+ TIMER_CALLBACK_MEMBER(bell_off);
+
required_ioport m_io_term_conf;
static constexpr unsigned TERMINAL_WIDTH = 80;
diff --git a/src/devices/machine/ticket.cpp b/src/devices/machine/ticket.cpp
index a3ab3072393..35c5d5625a8 100644
--- a/src/devices/machine/ticket.cpp
+++ b/src/devices/machine/ticket.cpp
@@ -17,7 +17,9 @@
//**************************************************************************
#define DEBUG_TICKET 0
-#define LOG(x) do { if (DEBUG_TICKET) logerror x; } while (0)
+
+#define VERBOSE (DEBUG_TICKET)
+#include "logmacro.h"
@@ -99,7 +101,7 @@ WRITE_LINE_MEMBER( ticket_dispenser_device::motor_w )
{
if (!m_power)
{
- LOG(("%s: Ticket Power On\n", machine().describe_context()));
+ LOG("%s: Ticket Power On\n", machine().describe_context());
m_timer->adjust(m_period);
m_power = true;
m_status = m_ticketnotdispensed;
@@ -111,7 +113,7 @@ WRITE_LINE_MEMBER( ticket_dispenser_device::motor_w )
{
if (m_hopper_type == false || m_status == m_ticketnotdispensed)
{
- LOG(("%s: Ticket Power Off\n", machine().describe_context()));
+ LOG("%s: Ticket Power Off\n", machine().describe_context());
m_timer->adjust(attotime::never);
m_output = 0;
}
@@ -135,7 +137,7 @@ void ticket_dispenser_device::device_start()
m_ticketdispensed = (m_status_sense == TICKET_STATUS_ACTIVE_HIGH);
m_ticketnotdispensed = !m_ticketdispensed;
- m_timer = timer_alloc();
+ m_timer = timer_alloc(FUNC(ticket_dispenser_device::update_output_state), this);
m_output.resolve();
@@ -156,22 +158,22 @@ void ticket_dispenser_device::device_reset()
//-------------------------------------------------
-// device_timer - handle timer callbacks
+// update_output_state -
//-------------------------------------------------
-void ticket_dispenser_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(ticket_dispenser_device::update_output_state)
{
// if we still have power, keep toggling ticket states
if (m_power)
{
m_status = !m_status;
- LOG(("Ticket Status Changed to %02X\n", m_status));
+ LOG("Ticket Status Changed to %02X\n", m_status);
m_timer->adjust(m_period);
}
else if (m_hopper_type)
{
m_status = !m_status;
- LOG(("%s: Ticket Power Off\n", machine().describe_context()));
+ LOG("%s: Ticket Power Off\n", machine().describe_context());
m_timer->adjust(attotime::never);
m_output = 0;
}
@@ -183,6 +185,6 @@ void ticket_dispenser_device::device_timer(emu_timer &timer, device_timer_id id,
if (m_status == m_ticketdispensed)
{
machine().bookkeeping().increment_dispensed_tickets(1);
- LOG(("Ticket Dispensed\n"));
+ LOG("Ticket Dispensed\n");
}
}
diff --git a/src/devices/machine/ticket.h b/src/devices/machine/ticket.h
index ee4e2bfed1d..0bf9dd106c3 100644
--- a/src/devices/machine/ticket.h
+++ b/src/devices/machine/ticket.h
@@ -69,9 +69,10 @@ protected:
ticket_dispenser_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock = 0);
// device-level overrides
- virtual void device_start() override ATTR_COLD;
- virtual void device_reset() override ATTR_COLD;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ virtual void device_start() override;
+ virtual void device_reset() override;
+
+ TIMER_CALLBACK_MEMBER(update_output_state);
// configuration state
uint8_t m_motor_sense;
diff --git a/src/devices/machine/timekpr.cpp b/src/devices/machine/timekpr.cpp
index 645a4604c8a..5825aa72100 100644
--- a/src/devices/machine/timekpr.cpp
+++ b/src/devices/machine/timekpr.cpp
@@ -227,10 +227,10 @@ void timekeeper_device::device_start()
save_item(NAME(m_data));
save_item(NAME(m_watchdog_delay));
- emu_timer *timer = timer_alloc();
+ emu_timer *timer = timer_alloc(FUNC(timekeeper_device::timer_tick), this);
timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1));
- m_watchdog_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(timekeeper_device::watchdog_callback), this));
+ m_watchdog_timer = timer_alloc(FUNC(timekeeper_device::watchdog_callback), this);
m_watchdog_timer->adjust(attotime::never);
m_reset_cb.resolve_safe();
m_irq_cb.resolve_safe();
@@ -240,7 +240,9 @@ void timekeeper_device::device_start()
// device_reset - device-specific reset
//-------------------------------------------------
-void timekeeper_device::device_reset() { }
+void timekeeper_device::device_reset()
+{
+}
void timekeeper_device::counters_to_ram()
{
@@ -268,7 +270,7 @@ void timekeeper_device::counters_from_ram()
m_century = counter_from_ram(&m_data[0], m_offset_century);
}
-void timekeeper_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(timekeeper_device::timer_tick)
{
LOGMASKED(LOG_TICKS, "Tick\n");
if ((m_seconds & SECONDS_ST) != 0 ||
diff --git a/src/devices/machine/timekpr.h b/src/devices/machine/timekpr.h
index 4c38a4e1784..9d6d04fafb4 100644
--- a/src/devices/machine/timekpr.h
+++ b/src/devices/machine/timekpr.h
@@ -46,13 +46,13 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_nvram_interface overrides
virtual void nvram_default() override;
virtual bool nvram_read(util::read_stream &file) override;
virtual bool nvram_write(util::write_stream &file) override;
+ TIMER_CALLBACK_MEMBER(timer_tick);
TIMER_CALLBACK_MEMBER(watchdog_callback);
devcb_write_line m_reset_cb;
devcb_write_line m_irq_cb;
diff --git a/src/devices/machine/timer.cpp b/src/devices/machine/timer.cpp
index d5e0efe9394..67621f1085f 100644
--- a/src/devices/machine/timer.cpp
+++ b/src/devices/machine/timer.cpp
@@ -102,8 +102,10 @@ void timer_device::device_validity_check(validity_checker &valid) const
void timer_device::device_start()
{
- // allocate the timer
- m_timer = timer_alloc();
+ if (m_type == TIMER_TYPE_SCANLINE)
+ m_timer = timer_alloc(FUNC(timer_device::scanline_tick), this);
+ else
+ m_timer = timer_alloc(FUNC(timer_device::generic_tick), this);
m_callback.resolve();
@@ -153,44 +155,31 @@ void timer_device::device_reset()
}
-//-------------------------------------------------
-// device_timer - handle timer expiration events
-//-------------------------------------------------
-
-void timer_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(timer_device::generic_tick)
{
- switch (m_type)
- {
- // general periodic timers just call through
- case TIMER_TYPE_GENERIC:
- case TIMER_TYPE_PERIODIC:
- if (!m_callback.isnull())
- (m_callback)(*this, param);
- break;
-
- // scanline timers have to do some additional bookkeeping
- case TIMER_TYPE_SCANLINE:
- {
- // by default, we fire at the first position
- int next_vpos = m_first_vpos;
+ if (!m_callback.isnull())
+ (m_callback)(*this, param);
+}
- // the first time through we just go with the default position
- if (!m_first_time)
- {
- // call the real callback
- int vpos = m_screen->vpos();
- if (!m_callback.isnull())
- (m_callback)(*this, vpos);
-
- // advance by the increment only if we will still be within the screen bounds
- if (m_increment != 0 && (vpos + m_increment) < m_screen->height())
- next_vpos = vpos + m_increment;
- }
- m_first_time = false;
+TIMER_CALLBACK_MEMBER(timer_device::scanline_tick)
+{
+ // by default, we fire at the first position
+ int next_vpos = m_first_vpos;
- // adjust the timer
- m_timer->adjust(m_screen->time_until_pos(next_vpos));
- break;
- }
+ // the first time through we just go with the default position
+ if (!m_first_time)
+ {
+ // call the real callback
+ int vpos = m_screen->vpos();
+ if (!m_callback.isnull())
+ (m_callback)(*this, vpos);
+
+ // advance by the increment only if we will still be within the screen bounds
+ if (m_increment != 0 && (vpos + m_increment) < m_screen->height())
+ next_vpos = vpos + m_increment;
}
+ m_first_time = false;
+
+ // adjust the timer
+ m_timer->adjust(m_screen->time_until_pos(next_vpos));
}
diff --git a/src/devices/machine/timer.h b/src/devices/machine/timer.h
index c2e5bcefa6c..c002bd3148a 100644
--- a/src/devices/machine/timer.h
+++ b/src/devices/machine/timer.h
@@ -108,7 +108,9 @@ private:
virtual void device_validity_check(validity_checker &valid) const override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(generic_tick);
+ TIMER_CALLBACK_MEMBER(scanline_tick);
// timer types
enum timer_type
diff --git a/src/devices/machine/tmp68301.cpp b/src/devices/machine/tmp68301.cpp
index f6cd84dd318..bd3d2dc06f1 100644
--- a/src/devices/machine/tmp68301.cpp
+++ b/src/devices/machine/tmp68301.cpp
@@ -161,7 +161,7 @@ void tmp68301_device::device_start()
m68000_device::device_start();
for (int i = 0; i < 3; i++)
- m_tmp68301_timer[i] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tmp68301_device::timer_callback), this));
+ m_tmp68301_timer[i] = timer_alloc(FUNC(tmp68301_device::timer_callback), this);
m_in_parallel_cb.resolve_safe(0);
m_out_parallel_cb.resolve_safe();
diff --git a/src/devices/machine/tms5501.cpp b/src/devices/machine/tms5501.cpp
index 43d30a2c2d0..f5844d1c8bf 100644
--- a/src/devices/machine/tms5501.cpp
+++ b/src/devices/machine/tms5501.cpp
@@ -88,11 +88,11 @@ void tms5501_device::device_start()
m_write_xo.resolve_safe();
// create timers
- m_timer[TIMER_1] = timer_alloc(TIMER_1);
- m_timer[TIMER_2] = timer_alloc(TIMER_2);
- m_timer[TIMER_3] = timer_alloc(TIMER_3);
- m_timer[TIMER_4] = timer_alloc(TIMER_4);
- m_timer[TIMER_5] = timer_alloc(TIMER_5);
+ m_timer[TIMER_1] = timer_alloc(FUNC(tms5501_device::timer_expired), this);
+ m_timer[TIMER_2] = timer_alloc(FUNC(tms5501_device::timer_expired), this);
+ m_timer[TIMER_3] = timer_alloc(FUNC(tms5501_device::timer_expired), this);
+ m_timer[TIMER_4] = timer_alloc(FUNC(tms5501_device::timer_expired), this);
+ m_timer[TIMER_5] = timer_alloc(FUNC(tms5501_device::timer_expired), this);
// state saving
save_item(NAME(m_rb));
@@ -122,38 +122,22 @@ void tms5501_device::device_reset()
//-------------------------------------------------
-// device_timer - handle timer events
+// timer_expired -
//-------------------------------------------------
-void tms5501_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(tms5501_device::timer_expired)
{
- switch (id)
+ if (param == TIMER_5)
{
- case TIMER_1:
- set_interrupt(IRQ_TMR1);
- break;
-
- case TIMER_2:
- set_interrupt(IRQ_TMR2);
- break;
-
- case TIMER_3:
- set_interrupt(IRQ_TMR3);
- break;
-
- case TIMER_4:
- set_interrupt(IRQ_TMR4);
- break;
-
- case TIMER_5:
if (!(m_cmd & CMD_XI7))
{
set_interrupt(IRQ_TMR5);
}
- break;
-
- default:
- break;
+ }
+ else
+ {
+ static uint8_t const s_irq_ids[4] = { IRQ_TMR1, IRQ_TMR2, IRQ_TMR3, IRQ_TMR4 };
+ set_interrupt(s_irq_ids[param]);
}
}
@@ -406,7 +390,7 @@ void tms5501_device::tmr_w(offs_t offset, uint8_t data)
{
if (LOG) logerror("TMS5501 '%s' Timer %u %02x\n", tag(), offset, data);
- m_timer[offset]->adjust(attotime::from_double((double) data / (clock() / 128.0)));
+ m_timer[offset]->adjust(attotime::from_double((double) data / (clock() / 128.0)), (int)offset);
}
diff --git a/src/devices/machine/tms5501.h b/src/devices/machine/tms5501.h
index f2acc942478..e916141d12c 100644
--- a/src/devices/machine/tms5501.h
+++ b/src/devices/machine/tms5501.h
@@ -80,13 +80,14 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_serial_interface overrides
virtual void tra_callback() override;
virtual void tra_complete() override;
virtual void rcv_complete() override;
+ TIMER_CALLBACK_MEMBER(timer_expired);
+
private:
enum
{
diff --git a/src/devices/machine/tms9901.cpp b/src/devices/machine/tms9901.cpp
index e09d546cc4c..6714945fa2a 100644
--- a/src/devices/machine/tms9901.cpp
+++ b/src/devices/machine/tms9901.cpp
@@ -161,7 +161,7 @@ Clock mode:
#define LOG_INT (1U << 4)
#define LOG_CLOCK (1U << 5)
-#define VERBOSE ( LOG_GENERAL )
+#define VERBOSE (LOG_GENERAL)
#include "logmacro.h"
/*
@@ -466,17 +466,14 @@ void tms9901_device::update_clock()
}
/*
- Timer callback
+ decrement_tick
Decrementer counts down the value set in clock mode; when it reaches 0,
raises an interrupt and resets to the start value
*/
-void tms9901_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(tms9901_device::decrement_tick)
{
- if (id==DECREMENTER) // we have only that one
- {
- timer_clock_in(ASSERT_LINE);
- timer_clock_in(CLEAR_LINE);
- }
+ timer_clock_in(ASSERT_LINE);
+ timer_clock_in(CLEAR_LINE);
}
void tms9901_device::timer_clock_in(line_state clk)
@@ -627,7 +624,7 @@ void tms9901_device::device_start()
// Allow for using asynchronous and synchronous clocks
if (clock() != 0)
{
- m_decrementer = timer_alloc(DECREMENTER);
+ m_decrementer = timer_alloc(FUNC(tms9901_device::decrement_tick), this);
m_decrementer->adjust(attotime::from_hz(clock() / 64.), 0, attotime::from_hz(clock() / 64.));
}
diff --git a/src/devices/machine/tms9901.h b/src/devices/machine/tms9901.h
index 68a8b1cd4cd..3d4808654a3 100644
--- a/src/devices/machine/tms9901.h
+++ b/src/devices/machine/tms9901.h
@@ -89,14 +89,13 @@ public:
void update_clock();
private:
- static constexpr device_timer_id DECREMENTER = 0;
+ virtual void device_start() override;
+ virtual void device_stop() override;
+ virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
- void soft_reset();
+ TIMER_CALLBACK_MEMBER(decrement_tick);
- void device_start() override;
- void device_stop() override;
- void device_reset() override;
+ void soft_reset();
// Common method for device_reset and rst1_line
void do_reset();
diff --git a/src/devices/machine/tms9902.cpp b/src/devices/machine/tms9902.cpp
index 6c5b54a6095..68c0f671155 100644
--- a/src/devices/machine/tms9902.cpp
+++ b/src/devices/machine/tms9902.cpp
@@ -63,13 +63,6 @@
#define LOGSETTING(...) LOGMASKED(LOG_SETTING, __VA_ARGS__)
-enum
-{
- DECTIMER,
- RECVTIMER,
- SENDTIMER
-};
-
// Polling frequency. We use a much higher value to allow for line state changes
// happening between character transmissions (which happen in parallel in real
// communications but which must be serialized here)
@@ -254,39 +247,36 @@ void tms9902_device::rcv_break(bool value)
//------------------------------------------------
/*
- Timer callback
+ Timer callbacks
*/
-void tms9902_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+
+TIMER_CALLBACK_MEMBER(tms9902_device::decrementer_expired)
{
- switch (id)
- {
- // This call-back is called by the MAME timer system when the decrementer
- // reaches 0.
- case DECTIMER:
- m_TIMERR = m_TIMELP;
- m_TIMELP = true;
- field_interrupts();
- break;
+ // This call-back is called when the decrementer reaches 0.
+ m_TIMERR = m_TIMELP;
+ m_TIMELP = true;
+ field_interrupts();
+}
+TIMER_CALLBACK_MEMBER(tms9902_device::recv_tick)
+{
// Callback for the autonomous operations of the chip. This is normally
// controlled by an external clock of 3-4 MHz, internally divided by 3 or 4,
// depending on CLK4M. With this timer, reception of characters becomes
// possible.
- case RECVTIMER:
- m_rcv_cb(ASSERT_LINE);
- break;
+ m_rcv_cb(ASSERT_LINE);
+}
- case SENDTIMER:
- // Byte has been sent
- m_XSRE = true;
+TIMER_CALLBACK_MEMBER(tms9902_device::send_tick)
+{
+ // Byte has been sent
+ m_XSRE = true;
- // In the meantime, the CPU may have pushed a new byte into the XBR
- // so we loop until all data are transferred
- if (!m_XBRE && m_CTSin)
- {
- initiate_transmit();
- }
- break;
+ // In the meantime, the CPU may have pushed a new byte into the XBR
+ // so we loop until all data are transferred
+ if (!m_XBRE && m_CTSin)
+ {
+ initiate_transmit();
}
}
@@ -297,10 +287,8 @@ void tms9902_device::reload_interval_timer()
{
if (m_TMR)
{ /* reset clock interval */
- m_dectimer->adjust(
- attotime::from_double((double) m_TMR / (m_clock_rate / ((m_CLK4M) ? 4. : 3.) / 64.)),
- 0,
- attotime::from_double((double) m_TMR / (m_clock_rate / ((m_CLK4M) ? 4. : 3.) / 64.)));
+ attotime rate = attotime::from_double((double) m_TMR / (m_clock_rate / ((m_CLK4M) ? 4. : 3.) / 64.));
+ m_dectimer->adjust(rate, 0, rate);
}
else
{ /* clock interval == 0 -> no timer */
@@ -925,9 +913,9 @@ void tms9902_device::device_start()
m_xmit_cb.resolve_safe();
m_ctrl_cb.resolve_safe();
- m_dectimer = timer_alloc(DECTIMER);
- m_recvtimer = timer_alloc(RECVTIMER);
- m_sendtimer = timer_alloc(SENDTIMER);
+ m_dectimer = timer_alloc(FUNC(tms9902_device::decrementer_expired), this);
+ m_recvtimer = timer_alloc(FUNC(tms9902_device::recv_tick), this);
+ m_sendtimer = timer_alloc(FUNC(tms9902_device::send_tick), this);
save_item(NAME(m_LDCTRL));
save_item(NAME(m_LDIR));
diff --git a/src/devices/machine/tms9902.h b/src/devices/machine/tms9902.h
index 37570b9ba5e..c784687bbe8 100644
--- a/src/devices/machine/tms9902.h
+++ b/src/devices/machine/tms9902.h
@@ -73,11 +73,14 @@ public:
void cruwrite(offs_t offset, uint8_t data);
protected:
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_stop() override;
+ TIMER_CALLBACK_MEMBER(decrementer_expired);
+ TIMER_CALLBACK_MEMBER(recv_tick);
+ TIMER_CALLBACK_MEMBER(send_tick);
+
private:
void field_interrupts();
void reload_interval_timer();
diff --git a/src/devices/machine/tms9914.cpp b/src/devices/machine/tms9914.cpp
index 0c230efebeb..14cfcb7b039 100644
--- a/src/devices/machine/tms9914.cpp
+++ b/src/devices/machine/tms9914.cpp
@@ -20,11 +20,13 @@
// Debugging
#define LOG_NOISY_MASK (LOG_GENERAL << 1)
-#define LOG_NOISY(...) LOGMASKED(LOG_NOISY_MASK, __VA_ARGS__)
#define LOG_REG_MASK (LOG_NOISY_MASK << 1)
-#define LOG_REG(...) LOGMASKED(LOG_REG_MASK, __VA_ARGS__)
#define LOG_INT_MASK (LOG_REG_MASK << 1)
+
+#define LOG_NOISY(...) LOGMASKED(LOG_NOISY_MASK, __VA_ARGS__)
+#define LOG_REG(...) LOGMASKED(LOG_REG_MASK, __VA_ARGS__)
#define LOG_INT(...) LOGMASKED(LOG_INT_MASK, __VA_ARGS__)
+
//#define VERBOSE (LOG_GENERAL)
#include "logmacro.h"
@@ -530,9 +532,9 @@ void tms9914_device::device_start()
m_int_write_func.resolve_safe();
m_accrq_write_func.resolve_safe();
- m_sh_dly_timer = timer_alloc(SH_DELAY_TMR_ID);
- m_ah_dly_timer = timer_alloc(AH_DELAY_TMR_ID);
- m_c_dly_timer = timer_alloc(C_DELAY_TMR_ID);
+ m_sh_dly_timer = timer_alloc(FUNC(tms9914_device::fsm_tick), this);
+ m_ah_dly_timer = timer_alloc(FUNC(tms9914_device::fsm_tick), this);
+ m_c_dly_timer = timer_alloc(FUNC(tms9914_device::fsm_tick), this);
}
void tms9914_device::device_reset()
@@ -593,9 +595,8 @@ void tms9914_device::device_reset()
update_ren();
}
-void tms9914_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(tms9914_device::fsm_tick)
{
- LOG_NOISY("tmr %d\n" , id);
update_fsm();
}
diff --git a/src/devices/machine/tms9914.h b/src/devices/machine/tms9914.h
index 7b346a2e1d3..d67b85de025 100644
--- a/src/devices/machine/tms9914.h
+++ b/src/devices/machine/tms9914.h
@@ -94,7 +94,8 @@ private:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(fsm_tick);
devcb_read8 m_dio_read_func;
devcb_write8 m_dio_write_func;
@@ -239,12 +240,6 @@ private:
int m_c_state;
// Timers
- enum {
- SH_DELAY_TMR_ID,
- AH_DELAY_TMR_ID,
- C_DELAY_TMR_ID
- };
-
emu_timer *m_sh_dly_timer;
emu_timer *m_ah_dly_timer;
emu_timer *m_c_dly_timer;
diff --git a/src/devices/machine/upd1990a.cpp b/src/devices/machine/upd1990a.cpp
index 8cad6a3bd3f..191d2b634cb 100644
--- a/src/devices/machine/upd1990a.cpp
+++ b/src/devices/machine/upd1990a.cpp
@@ -92,11 +92,11 @@ void upd1990a_device::device_start()
m_testmode = false;
// allocate timers
- m_timer_clock = timer_alloc(TIMER_CLOCK);
+ m_timer_clock = timer_alloc(FUNC(upd1990a_device::clock_tick), this);
m_timer_clock->adjust(attotime::from_hz(clock() / 32768.0), 0, attotime::from_hz(clock() / 32768.0)); // 1 second on XTAL(32'768)
- m_timer_tp = timer_alloc(TIMER_TP);
- m_timer_data_out = timer_alloc(TIMER_DATA_OUT);
- m_timer_test_mode = timer_alloc(TIMER_TEST_MODE);
+ m_timer_tp = timer_alloc(FUNC(upd1990a_device::tp_tick), this);
+ m_timer_data_out = timer_alloc(FUNC(upd1990a_device::data_out_tick), this);
+ m_timer_test_mode = timer_alloc(FUNC(upd1990a_device::test_tick), this);
// state saving
save_item(NAME(m_time_counter));
@@ -130,58 +130,55 @@ void upd1990a_device::rtc_clock_updated(int year, int month, int day, int day_of
//-------------------------------------------------
-// device_timer - handler timer events
+// timer handlers
//-------------------------------------------------
-void upd1990a_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(upd1990a_device::clock_tick)
{
- switch (id)
- {
- case TIMER_CLOCK:
- advance_seconds();
- break;
+ advance_seconds();
+}
- case TIMER_TP:
- m_tp = !m_tp;
- m_write_tp(m_tp);
- break;
+TIMER_CALLBACK_MEMBER(upd1990a_device::tp_tick)
+{
+ m_tp = !m_tp;
+ m_write_tp(m_tp);
+}
+
+TIMER_CALLBACK_MEMBER(upd1990a_device::data_out_tick)
+{
+ m_data_out = !m_data_out;
+ m_write_data(get_data_out());
+}
- case TIMER_DATA_OUT:
- m_data_out = !m_data_out;
+TIMER_CALLBACK_MEMBER(upd1990a_device::test_tick)
+{
+ if (m_oe)
+ {
+ /* TODO: completely untested */
+ /* time counter is advanced from "Second" counter input */
+ int max_shift = is_serial_mode() ? 6 : 5;
+ m_data_out = (m_time_counter[max_shift - 1] == 0);
m_write_data(get_data_out());
- break;
- case TIMER_TEST_MODE:
- if (m_oe)
+ for (int i = 0; i < max_shift; i++)
{
- /* TODO: completely untested */
- /* time counter is advanced from "Second" counter input */
- int max_shift = is_serial_mode() ? 6 : 5;
- m_data_out = (m_time_counter[max_shift - 1] == 0);
- m_write_data(get_data_out());
-
- for (int i = 0; i < max_shift; i++)
- {
- m_time_counter[i]++;
- if (m_time_counter[i] != 0)
- return;
- }
+ m_time_counter[i]++;
+ if (m_time_counter[i] != 0)
+ return;
}
- else
- {
- /* each counter is advanced in parallel, overflow carry does not affect next counter */
- m_data_out = 0;
+ }
+ else
+ {
+ /* each counter is advanced in parallel, overflow carry does not affect next counter */
+ m_data_out = 0;
- int max_shift = is_serial_mode() ? 6 : 5;
- for (int i = 0; i < max_shift; i++)
- {
- m_time_counter[i]++;
- m_data_out |= (m_time_counter[i] == 0);
- }
- m_write_data(get_data_out());
+ int max_shift = is_serial_mode() ? 6 : 5;
+ for (int i = 0; i < max_shift; i++)
+ {
+ m_time_counter[i]++;
+ m_data_out |= (m_time_counter[i] == 0);
}
-
- break;
+ m_write_data(get_data_out());
}
}
diff --git a/src/devices/machine/upd1990a.h b/src/devices/machine/upd1990a.h
index 9d41cf24f56..8a170a15021 100644
--- a/src/devices/machine/upd1990a.h
+++ b/src/devices/machine/upd1990a.h
@@ -55,11 +55,15 @@ protected:
upd1990a_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint32_t variant);
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_rtc_interface overrides
virtual void rtc_clock_updated(int year, int month, int day, int day_of_week, int hour, int minute, int second) override;
+ TIMER_CALLBACK_MEMBER(clock_tick);
+ TIMER_CALLBACK_MEMBER(tp_tick);
+ TIMER_CALLBACK_MEMBER(data_out_tick);
+ TIMER_CALLBACK_MEMBER(test_tick);
+
enum
{
TYPE_1990A = 0,
@@ -69,14 +73,6 @@ protected:
private:
enum
{
- TIMER_CLOCK,
- TIMER_TP,
- TIMER_DATA_OUT,
- TIMER_TEST_MODE
- };
-
- enum
- {
MODE_REGISTER_HOLD = 0,
MODE_SHIFT,
MODE_TIME_SET,
diff --git a/src/devices/machine/upd4991a.cpp b/src/devices/machine/upd4991a.cpp
index 0252ccb2266..0f1419d7270 100644
--- a/src/devices/machine/upd4991a.cpp
+++ b/src/devices/machine/upd4991a.cpp
@@ -62,21 +62,16 @@ void upd4991a_device::device_validity_check(validity_checker &valid) const
void upd4991a_device::device_start()
{
- m_timer_clock = timer_alloc(TIMER_CLOCK);
+ m_timer_clock = timer_alloc(FUNC(upd4991a_device::clock_tick), this);
m_timer_clock->adjust(attotime::from_hz(clock() / 32768), 0, attotime::from_hz(clock() / 32768));
save_item(NAME(m_address));
}
-void upd4991a_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(upd4991a_device::clock_tick)
{
- switch (id)
- {
- case TIMER_CLOCK:
- advance_seconds();
- break;
- }
+ advance_seconds();
}
//-------------------------------------------------
diff --git a/src/devices/machine/upd4991a.h b/src/devices/machine/upd4991a.h
index 9b2d797ac7b..9a9da912279 100644
--- a/src/devices/machine/upd4991a.h
+++ b/src/devices/machine/upd4991a.h
@@ -35,18 +35,11 @@ protected:
// device-level overrides
virtual void device_validity_check(validity_checker &valid) const override;
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void rtc_clock_updated(int year, int month, int day, int day_of_week, int hour, int minute, int second) override;
-private:
- enum
- {
- TIMER_CLOCK
- //TIMER_TP,
- //TIMER_DATA_OUT,
- //TIMER_TEST_MODE
- };
+ TIMER_CALLBACK_MEMBER(clock_tick);
+private:
emu_timer *m_timer_clock;
u8 m_rtc_regs[8];
u8 m_address;
diff --git a/src/devices/machine/upd4992.cpp b/src/devices/machine/upd4992.cpp
index 04ffb207350..52e3f8d9f10 100644
--- a/src/devices/machine/upd4992.cpp
+++ b/src/devices/machine/upd4992.cpp
@@ -58,19 +58,14 @@ void upd4992_device::device_validity_check(validity_checker &valid) const
void upd4992_device::device_start()
{
- m_timer_clock = timer_alloc(TIMER_CLOCK);
+ m_timer_clock = timer_alloc(FUNC(upd4992_device::clock_tick), this);
m_timer_clock->adjust(attotime::from_hz(clock() / 32768), 0, attotime::from_hz(clock() / 32768));
}
-void upd4992_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(upd4992_device::clock_tick)
{
- switch (id)
- {
- case TIMER_CLOCK:
- advance_seconds();
- break;
- }
+ advance_seconds();
}
//-------------------------------------------------
diff --git a/src/devices/machine/upd4992.h b/src/devices/machine/upd4992.h
index edf58cbeb3e..3151aa12eaa 100644
--- a/src/devices/machine/upd4992.h
+++ b/src/devices/machine/upd4992.h
@@ -34,18 +34,11 @@ protected:
// device-level overrides
virtual void device_validity_check(validity_checker &valid) const override;
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void rtc_clock_updated(int year, int month, int day, int day_of_week, int hour, int minute, int second) override;
-private:
- enum
- {
- TIMER_CLOCK
- //TIMER_TP,
- //TIMER_DATA_OUT,
- //TIMER_TEST_MODE
- };
+ TIMER_CALLBACK_MEMBER(clock_tick);
+private:
emu_timer *m_timer_clock;
u8 m_rtc_regs[8];
};
diff --git a/src/devices/machine/upd7001.cpp b/src/devices/machine/upd7001.cpp
index d4607e7a479..a6ae938b64c 100644
--- a/src/devices/machine/upd7001.cpp
+++ b/src/devices/machine/upd7001.cpp
@@ -85,8 +85,8 @@ void upd7001_device::device_start()
m_fck_rc = attotime::from_double(m_res * m_cap * 1.97);
// initialize timers
- m_conv_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(upd7001_device::conversion_done), this));
- m_scsk_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(upd7001_device::output_enabled), this));
+ m_conv_timer = timer_alloc(FUNC(upd7001_device::conversion_done), this);
+ m_scsk_timer = timer_alloc(FUNC(upd7001_device::output_enabled), this);
// save state
save_item(NAME(m_cs_active));
diff --git a/src/devices/machine/upd7002.cpp b/src/devices/machine/upd7002.cpp
index 4288035eeba..da1036d109d 100644
--- a/src/devices/machine/upd7002.cpp
+++ b/src/devices/machine/upd7002.cpp
@@ -32,6 +32,7 @@ upd7002_device::upd7002_device(const machine_config &mconfig, const char *tag, d
void upd7002_device::device_start()
{
+ m_conversion_timer = timer_alloc(FUNC(upd7002_device::conversion_complete), this);
m_get_analogue_cb.resolve();
m_eoc_cb.resolve();
@@ -68,31 +69,21 @@ READ_LINE_MEMBER( upd7002_device::eoc_r )
}
-void upd7002_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(upd7002_device::conversion_complete)
{
- switch (id)
+ if (param == m_conversion_counter)
{
- case TIMER_CONVERSION_COMPLETE:
- {
- int counter_value = param;
- if (counter_value == m_conversion_counter)
- {
- // this really always does a 12 bit conversion
- m_data1 = m_digitalvalue >> 8;
- m_data0 = m_digitalvalue & 0xf0;
-
- // set the status register with top 2 MSB, not busy and conversion complete
- m_status = (m_status & 0x0f) | ((m_data1 & 0xc0) >> 2) | 0x40;
-
- // call the EOC function with EOC from status
- // eoc_r(0) this has just been set to 0
- if (!m_eoc_cb.isnull()) m_eoc_cb(0);
- m_conversion_counter=0;
- }
- }
- break;
- default:
- throw emu_fatalerror("Unknown id in upd7002_device::device_timer");
+ // this really always does a 12 bit conversion
+ m_data1 = m_digitalvalue >> 8;
+ m_data0 = m_digitalvalue & 0xf0;
+
+ // set the status register with top 2 MSB, not busy and conversion complete
+ m_status = (m_status & 0x0f) | ((m_data1 & 0xc0) >> 2) | 0x40;
+
+ // call the EOC function with EOC from status
+ // eoc_r(0) this has just been set to 0
+ if (!m_eoc_cb.isnull()) m_eoc_cb(0);
+ m_conversion_counter = 0;
}
}
@@ -155,12 +146,12 @@ void upd7002_device::write(offs_t offset, uint8_t data)
if (m_status & 0x08)
{
// 12 bit conversion takes 10ms
- timer_set(attotime::from_msec(10), TIMER_CONVERSION_COMPLETE, m_conversion_counter);
+ m_conversion_timer->adjust(attotime::from_msec(10), m_conversion_counter);
}
else
{
// 8 bit conversion takes 4ms
- timer_set(attotime::from_msec(4), TIMER_CONVERSION_COMPLETE, m_conversion_counter);
+ m_conversion_timer->adjust(attotime::from_msec(4), m_conversion_counter);
}
break;
diff --git a/src/devices/machine/upd7002.h b/src/devices/machine/upd7002.h
index 06d353ca1fd..7069a68361d 100644
--- a/src/devices/machine/upd7002.h
+++ b/src/devices/machine/upd7002.h
@@ -38,7 +38,8 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(conversion_complete);
private:
// internal state
@@ -77,10 +78,7 @@ private:
get_analogue_delegate m_get_analogue_cb;
eoc_delegate m_eoc_cb;
- enum
- {
- TIMER_CONVERSION_COMPLETE
- };
+ emu_timer *m_conversion_timer;
};
DECLARE_DEVICE_TYPE(UPD7002, upd7002_device)
diff --git a/src/devices/machine/upd7004.cpp b/src/devices/machine/upd7004.cpp
index bd3df848884..a5fb2cba78f 100644
--- a/src/devices/machine/upd7004.cpp
+++ b/src/devices/machine/upd7004.cpp
@@ -59,7 +59,7 @@ void upd7004_device::device_start()
m_in_cb.resolve_all_safe(0x3ff);
// allocate timers
- m_cycle_timer = timer_alloc();
+ m_cycle_timer = timer_alloc(FUNC(upd7004_device::update_state), this);
m_cycle_timer->adjust(attotime::never);
// register for save states
@@ -71,10 +71,10 @@ void upd7004_device::device_start()
}
//-------------------------------------------------
-// device_timer - handler timer events
+// update_state -
//-------------------------------------------------
-void upd7004_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(upd7004_device::update_state)
{
switch (m_state)
{
diff --git a/src/devices/machine/upd7004.h b/src/devices/machine/upd7004.h
index 6f52e1533a3..78d7eae559c 100644
--- a/src/devices/machine/upd7004.h
+++ b/src/devices/machine/upd7004.h
@@ -49,7 +49,8 @@ public:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(update_state);
private:
// callbacks
diff --git a/src/devices/machine/upd71071.cpp b/src/devices/machine/upd71071.cpp
index de46ffe53c5..0a928be5361 100644
--- a/src/devices/machine/upd71071.cpp
+++ b/src/devices/machine/upd71071.cpp
@@ -117,7 +117,7 @@ void upd71071_device::device_start()
m_dma_write_cb.resolve_all_safe();
m_out_dack_cb.resolve_all_safe();
for (auto &elem : m_timer)
- elem = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(upd71071_device::dma_transfer_timer), this));
+ elem = timer_alloc(FUNC(upd71071_device::dma_transfer_timer), this);
m_selected_channel = 0;
m_reg.device_control = 0;
diff --git a/src/devices/machine/upd765.cpp b/src/devices/machine/upd765.cpp
index 0db88c35c6e..b65afca6de1 100644
--- a/src/devices/machine/upd765.cpp
+++ b/src/devices/machine/upd765.cpp
@@ -216,7 +216,7 @@ void upd765_family_device::device_start()
for(int i=0; i != 4; i++) {
char name[2];
- flopi[i].tm = timer_alloc(i);
+ flopi[i].tm = timer_alloc(FUNC(upd765_family_device::update_floppy), this);
flopi[i].id = i;
if(select_connected) {
name[0] = '0'+i;
@@ -257,7 +257,7 @@ void upd765_family_device::device_start()
cur_live.fi = nullptr;
if(ready_polled) {
- poll_timer = timer_alloc(TIMER_DRIVE_READY_POLLING);
+ poll_timer = timer_alloc(FUNC(upd765_family_device::run_drive_ready_polling), this);
poll_timer->adjust(attotime::from_usec(100), 0, attotime::from_usec(1024));
} else
poll_timer = nullptr;
@@ -767,7 +767,7 @@ void upd765_family_device::live_delay(int state)
{
cur_live.next_state = state;
if(cur_live.tm != machine().time())
- cur_live.fi->tm->adjust(cur_live.tm - machine().time());
+ cur_live.fi->tm->adjust(cur_live.tm - machine().time(), cur_live.fi->id);
else
live_sync();
}
@@ -831,7 +831,7 @@ void upd765_family_device::live_run(attotime limit)
// infinity looking for data too.
limit = machine().time() + attotime::from_msec(1);
- cur_live.fi->tm->adjust(attotime::from_msec(1));
+ cur_live.fi->tm->adjust(attotime::from_msec(1), cur_live.fi->id);
}
}
@@ -1618,9 +1618,9 @@ void upd765_family_device::seek_start(floppy_info &fi)
seek_continue(fi);
}
-void upd765_family_device::delay_cycles(emu_timer *tm, int cycles)
+void upd765_family_device::delay_cycles(floppy_info &fi, int cycles)
{
- tm->adjust(attotime::from_double(double(cycles)/cur_rate));
+ fi.tm->adjust(attotime::from_double(double(cycles)/cur_rate), fi.id);
}
void upd765_family_device::seek_continue(floppy_info &fi)
@@ -1634,7 +1634,7 @@ void upd765_family_device::seek_continue(floppy_info &fi)
fi.dev->stp_w(0);
}
fi.sub_state = SEEK_WAIT_STEP_SIGNAL_TIME;
- fi.tm->adjust(attotime::from_nsec(2500));
+ fi.tm->adjust(attotime::from_nsec(2500), fi.id);
return;
case SEEK_WAIT_STEP_SIGNAL_TIME:
@@ -1653,7 +1653,7 @@ void upd765_family_device::seek_continue(floppy_info &fi)
fi.pcn++;
}
fi.sub_state = SEEK_WAIT_STEP_TIME;
- delay_cycles(fi.tm, 500*(16-(spec >> 12)));
+ delay_cycles(fi, 500*(16-(spec >> 12)));
return;
case SEEK_WAIT_STEP_TIME:
@@ -1684,7 +1684,7 @@ void upd765_family_device::seek_continue(floppy_info &fi)
if(done) {
fi.sub_state = SEEK_WAIT_DONE;
// recalibrate and seek takes some time, even if we don't move
- fi.tm->adjust(attotime::from_nsec((fi.main_state == RECALIBRATE) ? 20000 : 10000));
+ fi.tm->adjust(attotime::from_nsec((fi.main_state == RECALIBRATE) ? 20000 : 10000), fi.id);
return;
}
fi.sub_state = SEEK_MOVE;
@@ -1796,7 +1796,7 @@ void upd765_family_device::read_data_continue(floppy_info &fi)
switch(fi.sub_state) {
case HEAD_LOAD:
LOGSTATE("HEAD_LOAD\n");
- delay_cycles(fi.tm, 500*(spec & 0x00fe));
+ delay_cycles(fi, 500*(spec & 0x00fe));
fi.sub_state = HEAD_LOAD_DONE;
break;
case HEAD_LOAD_DONE:
@@ -1811,7 +1811,7 @@ void upd765_family_device::read_data_continue(floppy_info &fi)
fi.dev->stp_w(0);
}
fi.sub_state = SEEK_WAIT_STEP_SIGNAL_TIME;
- fi.tm->adjust(attotime::from_nsec(2500));
+ fi.tm->adjust(attotime::from_nsec(2500), fi.id);
return;
case SEEK_WAIT_STEP_SIGNAL_TIME:
@@ -1824,7 +1824,7 @@ void upd765_family_device::read_data_continue(floppy_info &fi)
fi.dev->stp_w(1);
fi.sub_state = SEEK_WAIT_STEP_TIME;
- delay_cycles(fi.tm, 500*(16-(spec >> 12)));
+ delay_cycles(fi, 500*(16-(spec >> 12)));
return;
case SEEK_WAIT_STEP_TIME:
@@ -2027,7 +2027,7 @@ void upd765_family_device::write_data_continue(floppy_info &fi)
switch(fi.sub_state) {
case HEAD_LOAD:
LOGSTATE("HEAD_LOAD\n");
- delay_cycles(fi.tm, 500*(spec & 0x00fe));
+ delay_cycles(fi, 500*(spec & 0x00fe));
fi.sub_state = HEAD_LOAD_DONE;
break;
case HEAD_LOAD_DONE:
@@ -2168,7 +2168,7 @@ void upd765_family_device::read_track_continue(floppy_info &fi)
switch(fi.sub_state) {
case HEAD_LOAD:
LOGSTATE("HEAD_LOAD\n");
- delay_cycles(fi.tm, 500*(spec & 0x00fe));
+ delay_cycles(fi, 500*(spec & 0x00fe));
fi.sub_state = HEAD_LOAD_DONE;
break;
case HEAD_LOAD_DONE:
@@ -2183,7 +2183,7 @@ void upd765_family_device::read_track_continue(floppy_info &fi)
fi.dev->stp_w(0);
}
fi.sub_state = SEEK_WAIT_STEP_SIGNAL_TIME;
- fi.tm->adjust(attotime::from_nsec(2500));
+ fi.tm->adjust(attotime::from_nsec(2500), fi.id);
return;
case SEEK_WAIT_STEP_SIGNAL_TIME:
@@ -2196,7 +2196,7 @@ void upd765_family_device::read_track_continue(floppy_info &fi)
fi.dev->stp_w(1);
fi.sub_state = SEEK_WAIT_STEP_TIME;
- delay_cycles(fi.tm, 500*(16-(spec >> 12)));
+ delay_cycles(fi, 500*(16-(spec >> 12)));
return;
case SEEK_WAIT_STEP_TIME:
@@ -2357,7 +2357,7 @@ void upd765_family_device::format_track_continue(floppy_info &fi)
switch(fi.sub_state) {
case HEAD_LOAD:
LOGSTATE("HEAD_LOAD\n");
- delay_cycles(fi.tm, 500*(spec & 0x00fe));
+ delay_cycles(fi, 500*(spec & 0x00fe));
fi.sub_state = HEAD_LOAD_DONE;
break;
case HEAD_LOAD_DONE:
@@ -2442,7 +2442,7 @@ void upd765_family_device::read_id_continue(floppy_info &fi)
switch(fi.sub_state) {
case HEAD_LOAD:
LOGSTATE("HEAD_LOAD\n");
- delay_cycles(fi.tm, 500*(spec & 0x00fe));
+ delay_cycles(fi, 500*(spec & 0x00fe));
fi.sub_state = HEAD_LOAD_DONE;
break;
case HEAD_LOAD_DONE:
@@ -2526,16 +2526,11 @@ std::string upd765_family_device::ttsn() const
return machine().time().to_string();
}
-void upd765_family_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(upd765_family_device::update_floppy)
{
- if(id == TIMER_DRIVE_READY_POLLING) {
- run_drive_ready_polling();
- return;
- }
-
live_sync();
- floppy_info &fi = flopi[id];
+ floppy_info &fi = flopi[param];
switch(fi.sub_state) {
case SEEK_WAIT_STEP_SIGNAL_TIME:
fi.sub_state = SEEK_WAIT_STEP_SIGNAL_TIME_DONE;
@@ -2548,7 +2543,7 @@ void upd765_family_device::device_timer(emu_timer &timer, device_timer_id id, in
general_continue(fi);
}
-void upd765_family_device::run_drive_ready_polling()
+TIMER_CALLBACK_MEMBER(upd765_family_device::run_drive_ready_polling)
{
if(main_phase != PHASE_CMD || (fifocfg & FIF_POLL) || command_pos)
return;
diff --git a/src/devices/machine/upd765.h b/src/devices/machine/upd765.h
index b8840e712a2..f4441e72543 100644
--- a/src/devices/machine/upd765.h
+++ b/src/devices/machine/upd765.h
@@ -64,11 +64,8 @@ protected:
virtual void device_resolve_objects() override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
- enum {
- TIMER_DRIVE_READY_POLLING = 4
- };
+ TIMER_CALLBACK_MEMBER(update_floppy);
enum {
PHASE_CMD, PHASE_EXEC, PHASE_RESULT
@@ -290,7 +287,7 @@ protected:
void end_reset();
- void delay_cycles(emu_timer *tm, int cycles);
+ void delay_cycles(floppy_info &fi, int cycles);
void check_irq();
void fifo_expect(int size, bool write);
void fifo_push(uint8_t data, bool internal);
@@ -303,7 +300,7 @@ protected:
void disable_transfer();
int calc_sector_size(uint8_t size);
- void run_drive_ready_polling();
+ TIMER_CALLBACK_MEMBER(run_drive_ready_polling);
virtual int check_command();
virtual void start_command(int cmd);
diff --git a/src/devices/machine/v3021.cpp b/src/devices/machine/v3021.cpp
index 559a617340a..6d84109e2ec 100644
--- a/src/devices/machine/v3021.cpp
+++ b/src/devices/machine/v3021.cpp
@@ -153,7 +153,7 @@ void v3021_device::device_validity_check(validity_checker &valid) const
void v3021_device::device_start()
{
/* let's call the timer callback every second */
- m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(v3021_device::timer_callback), this));
+ m_timer = timer_alloc(FUNC(v3021_device::timer_callback), this);
m_timer->adjust(attotime::from_hz(clock() / XTAL(32'768)), 0, attotime::from_hz(clock() / XTAL(32'768)));
copy_clock_to_ram();
diff --git a/src/devices/machine/vic_pl192.cpp b/src/devices/machine/vic_pl192.cpp
index 23cae3a5445..2e7a2f4ad85 100644
--- a/src/devices/machine/vic_pl192.cpp
+++ b/src/devices/machine/vic_pl192.cpp
@@ -1,13 +1,11 @@
// license:BSD-3-Clause
// copyright-holders:Devin Acker, Melissa Goad
-// ARM PrimeCell PL910/PL192 VIC emulation
+// ARM PrimeCell PL190/PL192 VIC emulation
#include "emu.h"
#include "machine/vic_pl192.h"
-#define LOG_GENERAL (1U << 0)
-
#define VERBOSE (LOG_GENERAL)
#include "logmacro.h"
@@ -15,31 +13,188 @@ DEFINE_DEVICE_TYPE(PL190_VIC, vic_pl190_device, "vic_pl190", "ARM PL190 VIC")
DEFINE_DEVICE_TYPE(UPD800468_VIC, vic_upd800468_device, "vic_upd800468", "NEC uPD800468 VIC")
DEFINE_DEVICE_TYPE(PL192_VIC, vic_pl192_device, "vic_pl192", "ARM PL192 VIC")
-void vic_pl190_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+vic_pl190_device::vic_pl190_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
+ : device_t(mconfig, type, tag, owner, clock)
+ , device_memory_interface(mconfig, *this)
+ , num_vectors(16)
+ , periph_id{0x92, 0x11, 0x04, 0x00}
+ , pcell_id{0x0d, 0xf0, 0x05, 0xb1}
+ , m_irq_sync_timer(nullptr)
+ , m_mmio_config("mmio", ENDIANNESS_LITTLE, 32, 32, 0)
+ , m_out_irq_func(*this)
+ , m_out_fiq_func(*this)
+{
+}
+
+vic_pl190_device::vic_pl190_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : vic_pl190_device(mconfig, PL190_VIC, tag, owner, clock)
+{
+}
+
+vic_upd800468_device::vic_upd800468_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : vic_pl190_device(mconfig, UPD800468_VIC, tag, owner, clock)
+{
+ num_vectors = 32;
+}
+
+vic_pl192_device::vic_pl192_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : vic_pl190_device(mconfig, PL192_VIC, tag, owner, clock)
+{
+ num_vectors = 32;
+}
+
+void vic_pl190_device::device_start()
+{
+ save_item(NAME(raw_intr));
+ save_item(NAME(intr_select));
+ save_item(NAME(intr_en));
+ save_item(NAME(soft_intr));
+ save_item(NAME(vectaddr));
+ save_item(NAME(defaddress));
+ save_item(NAME(vicaddress));
+ save_item(NAME(priority_mask));
+ save_item(NAME(priority));
+ save_item(NAME(protection));
+
+ m_irq_sync_timer = timer_alloc(FUNC(vic_pl190_device::irq_sync_tick), this);
+}
+
+void vic_pl192_device::device_start()
+{
+ vic_pl190_device::device_start();
+
+ save_item(NAME(sw_priority_mask));
+ save_item(NAME(daisy_priority));
+}
+
+void vic_pl190_device::device_reset()
+{
+ raw_intr = intr_select = intr_en = soft_intr = 0;
+ defaddress = vicaddress = protection = 0;
+
+ priority_mask = ~0;
+ priority = ~0;
+
+ for(int i = 0; i < 32; i++)
+ {
+ vectaddr[i] = 0;
+ vectctl[i] = 0;
+ }
+}
+
+void vic_pl192_device::device_reset()
+{
+ vic_pl190_device::device_reset();
+
+ sw_priority_mask = 0xffff;
+ daisy_priority = 0xf;
+
+ for (int i = 0; i < 32; i++)
+ {
+ vectctl[i] = 0xf;
+ }
+}
+
+device_memory_interface::space_config_vector vic_pl190_device::memory_space_config() const
+{
+ return space_config_vector{
+ std::make_pair(0, &m_mmio_config)
+ };
+}
+
+void vic_pl190_device::device_resolve_objects()
+{
+ // resolve callbacks
+ m_out_irq_func.resolve_safe();
+ m_out_fiq_func.resolve_safe();
+}
+
+void vic_pl190_device::map(address_map &map)
+{
+ map(0x000, 0x003).r(FUNC(vic_pl190_device::irq_status_r));
+ map(0x004, 0x007).r(FUNC(vic_pl190_device::fiq_status_r));
+ map(0x008, 0x00b).r(FUNC(vic_pl190_device::raw_intr_r));
+ map(0x00c, 0x00f).rw(FUNC(vic_pl190_device::int_select_r), FUNC(vic_pl190_device::int_select_w));
+ map(0x010, 0x013).rw(FUNC(vic_pl190_device::int_enable_r), FUNC(vic_pl190_device::int_enable_w));
+ map(0x014, 0x017).w(FUNC(vic_pl190_device::int_en_clear_w));
+ map(0x018, 0x01b).rw(FUNC(vic_pl190_device::soft_int_r), FUNC(vic_pl190_device::soft_int_w));
+ map(0x01c, 0x01f).w(FUNC(vic_pl190_device::soft_int_clear_w));
+ map(0x020, 0x020).rw(FUNC(vic_pl190_device::protection_r), FUNC(vic_pl190_device::protection_w)).umask32(0x000000ff);
+ map(0x030, 0x033).rw(FUNC(vic_pl190_device::cur_vect_addr_r), FUNC(vic_pl190_device::cur_vect_addr_w));
+ map(0x034, 0x037).rw(FUNC(vic_pl190_device::def_vect_addr_r), FUNC(vic_pl190_device::def_vect_addr_w));
+ map(0x100, 0x13f).rw(FUNC(vic_pl190_device::vect_addr_r), FUNC(vic_pl190_device::vect_addr_w));
+ map(0x200, 0x23f).rw(FUNC(vic_pl190_device::vect_ctl_r), FUNC(vic_pl190_device::vect_ctl_w));
+ map(0xfe0, 0xfe0).lr8([this](offs_t offset){ return periph_id[0]; }, "periph_id0").umask32(0x000000ff);
+ map(0xfe4, 0xfe4).lr8([this](offs_t offset){ return periph_id[1]; }, "periph_id1").umask32(0x000000ff);
+ map(0xfe8, 0xfe8).lr8([this](offs_t offset){ return periph_id[2]; }, "periph_id2").umask32(0x000000ff);
+ map(0xfec, 0xfec).lr8([this](offs_t offset){ return periph_id[3]; }, "periph_id3").umask32(0x000000ff);
+ map(0xff0, 0xff0).lr8([this](offs_t offset){ return pcell_id[0]; }, "pcell_id0").umask32(0x000000ff);
+ map(0xff4, 0xff4).lr8([this](offs_t offset){ return pcell_id[1]; }, "pcell_id1").umask32(0x000000ff);
+ map(0xff8, 0xff8).lr8([this](offs_t offset){ return pcell_id[2]; }, "pcell_id2").umask32(0x000000ff);
+ map(0xffc, 0xffc).lr8([this](offs_t offset){ return pcell_id[3]; }, "pcell_id3").umask32(0x000000ff);
+}
+
+void vic_upd800468_device::map(address_map &map)
+{
+ vic_pl190_device::map(map);
+
+ map(0x100, 0x17f).rw(FUNC(vic_pl190_device::vect_addr_r), FUNC(vic_pl190_device::vect_addr_w));
+ map(0x200, 0x27f).rw(FUNC(vic_pl190_device::vect_ctl_r), FUNC(vic_pl190_device::vect_ctl_w));
+ map(0x2c8, 0x2cb).w(FUNC(vic_upd800468_device::int_clear_w));
+}
+
+void vic_pl192_device::map(address_map &map)
+{
+ map(0x000, 0x003).r(FUNC(vic_pl190_device::irq_status_r));
+ map(0x004, 0x007).r(FUNC(vic_pl190_device::fiq_status_r));
+ map(0x008, 0x00b).r(FUNC(vic_pl190_device::raw_intr_r));
+ map(0x00c, 0x00f).rw(FUNC(vic_pl190_device::int_select_r), FUNC(vic_pl190_device::int_select_w));
+ map(0x010, 0x013).rw(FUNC(vic_pl190_device::int_enable_r), FUNC(vic_pl190_device::int_enable_w));
+ map(0x014, 0x017).w(FUNC(vic_pl190_device::int_en_clear_w));
+ map(0x018, 0x01b).rw(FUNC(vic_pl190_device::soft_int_r), FUNC(vic_pl190_device::soft_int_w));
+ map(0x01c, 0x01f).w(FUNC(vic_pl190_device::soft_int_clear_w));
+ map(0x020, 0x020).rw(FUNC(vic_pl190_device::protection_r), FUNC(vic_pl190_device::protection_w)).umask32(0x000000ff);
+ map(0x024, 0x025).rw(FUNC(vic_pl192_device::sw_priority_r), FUNC(vic_pl192_device::sw_priority_w)).umask32(0x0000ffff);
+ map(0x028, 0x028).rw(FUNC(vic_pl192_device::daisy_priority_r), FUNC(vic_pl192_device::daisy_priority_w)).umask32(0x000000ff);
+ map(0x100, 0x17f).rw(FUNC(vic_pl190_device::vect_addr_r), FUNC(vic_pl190_device::vect_addr_w));
+ map(0x200, 0x27f).rw(FUNC(vic_pl190_device::vect_ctl_r), FUNC(vic_pl190_device::vect_ctl_w));
+ map(0xf00, 0xf03).rw(FUNC(vic_pl190_device::cur_vect_addr_r), FUNC(vic_pl190_device::cur_vect_addr_w));
+ map(0xfe0, 0xfe0).lr8([this](offs_t offset) { return periph_id[0]; }, "periph_id0").umask32(0x000000ff);
+ map(0xfe4, 0xfe4).lr8([this](offs_t offset) { return periph_id[1]; }, "periph_id1").umask32(0x000000ff);
+ map(0xfe8, 0xfe8).lr8([this](offs_t offset) { return periph_id[2]; }, "periph_id2").umask32(0x000000ff);
+ map(0xfec, 0xfec).lr8([this](offs_t offset) { return periph_id[3]; }, "periph_id3").umask32(0x000000ff);
+ map(0xff0, 0xff0).lr8([this](offs_t offset) { return pcell_id[0]; }, "pcell_id0").umask32(0x000000ff);
+ map(0xff4, 0xff4).lr8([this](offs_t offset) { return pcell_id[1]; }, "pcell_id1").umask32(0x000000ff);
+ map(0xff8, 0xff8).lr8([this](offs_t offset) { return pcell_id[2]; }, "pcell_id2").umask32(0x000000ff);
+ map(0xffc, 0xffc).lr8([this](offs_t offset) { return pcell_id[3]; }, "pcell_id3").umask32(0x000000ff);
+}
+
+TIMER_CALLBACK_MEMBER(vic_pl190_device::irq_sync_tick)
{
u32 intrs = (raw_intr | soft_intr) & intr_en;
- if (intrs & intr_select) m_out_fiq_func(1);
- else m_out_fiq_func(0);
+ if (intrs & intr_select)
+ m_out_fiq_func(1);
+ else
+ m_out_fiq_func(0);
- if (intrs & ~intr_select & priority_mask) m_out_irq_func(1);
- else m_out_irq_func(0);
+ if (intrs & ~intr_select & priority_mask)
+ m_out_irq_func(1);
+ else
+ m_out_irq_func(0);
}
void vic_pl190_device::set_irq_line(int irq, int state)
{
u32 mask = (1 << irq);
- if(state)
- {
+ if (state)
raw_intr |= mask;
- }
else
- {
raw_intr &= ~mask;
- }
- timer_set(attotime::zero, TIMER_CHECK_IRQ);
+
+ m_irq_sync_timer->adjust(attotime::zero);
}
u32 vic_pl190_device::irq_status_r()
@@ -65,7 +220,7 @@ u32 vic_pl190_device::int_select_r()
void vic_pl190_device::int_select_w(u32 data)
{
intr_select = data;
- timer_set(attotime::zero, TIMER_CHECK_IRQ);
+ m_irq_sync_timer->adjust(attotime::zero);
}
u32 vic_pl190_device::int_enable_r()
@@ -76,13 +231,13 @@ u32 vic_pl190_device::int_enable_r()
void vic_pl190_device::int_enable_w(u32 data)
{
intr_en |= data;
- timer_set(attotime::zero, TIMER_CHECK_IRQ);
+ m_irq_sync_timer->adjust(attotime::zero);
}
void vic_pl190_device::int_en_clear_w(u32 data)
{
intr_en &= ~data;
- timer_set(attotime::zero, TIMER_CHECK_IRQ);
+ m_irq_sync_timer->adjust(attotime::zero);
}
u32 vic_pl190_device::soft_int_r()
@@ -93,13 +248,13 @@ u32 vic_pl190_device::soft_int_r()
void vic_pl190_device::soft_int_w(u32 data)
{
soft_intr |= data;
- timer_set(attotime::zero, TIMER_CHECK_IRQ);
+ m_irq_sync_timer->adjust(attotime::zero);
}
void vic_pl190_device::soft_int_clear_w(u32 data)
{
soft_intr &= ~data;
- timer_set(attotime::zero, TIMER_CHECK_IRQ);
+ m_irq_sync_timer->adjust(attotime::zero);
}
u8 vic_pl190_device::protection_r()
@@ -124,7 +279,7 @@ void vic_pl190_device::cur_vect_addr_w(u32 data)
{
priority_mask = ~0;
priority = ~0;
- timer_set(attotime::zero, TIMER_CHECK_IRQ);
+ m_irq_sync_timer->adjust(attotime::zero);
}
u32 vic_pl190_device::def_vect_addr_r()
@@ -194,114 +349,12 @@ void vic_pl190_device::update_vector()
vicaddress = defaddress;
}
-void vic_pl190_device::map(address_map &map)
-{
- map(0x000, 0x003).r(FUNC(vic_pl190_device::irq_status_r));
- map(0x004, 0x007).r(FUNC(vic_pl190_device::fiq_status_r));
- map(0x008, 0x00b).r(FUNC(vic_pl190_device::raw_intr_r));
- map(0x00c, 0x00f).rw(FUNC(vic_pl190_device::int_select_r), FUNC(vic_pl190_device::int_select_w));
- map(0x010, 0x013).rw(FUNC(vic_pl190_device::int_enable_r), FUNC(vic_pl190_device::int_enable_w));
- map(0x014, 0x017).w(FUNC(vic_pl190_device::int_en_clear_w));
- map(0x018, 0x01b).rw(FUNC(vic_pl190_device::soft_int_r), FUNC(vic_pl190_device::soft_int_w));
- map(0x01c, 0x01f).w(FUNC(vic_pl190_device::soft_int_clear_w));
- map(0x020, 0x020).rw(FUNC(vic_pl190_device::protection_r), FUNC(vic_pl190_device::protection_w)).umask32(0x000000ff);
- map(0x030, 0x033).rw(FUNC(vic_pl190_device::cur_vect_addr_r), FUNC(vic_pl190_device::cur_vect_addr_w));
- map(0x034, 0x037).rw(FUNC(vic_pl190_device::def_vect_addr_r), FUNC(vic_pl190_device::def_vect_addr_w));
- map(0x100, 0x13f).rw(FUNC(vic_pl190_device::vect_addr_r), FUNC(vic_pl190_device::vect_addr_w));
- map(0x200, 0x23f).rw(FUNC(vic_pl190_device::vect_ctl_r), FUNC(vic_pl190_device::vect_ctl_w));
- map(0xfe0, 0xfe0).lr8([this](offs_t offset){ return periph_id[0]; }, "periph_id0").umask32(0x000000ff);
- map(0xfe4, 0xfe4).lr8([this](offs_t offset){ return periph_id[1]; }, "periph_id1").umask32(0x000000ff);
- map(0xfe8, 0xfe8).lr8([this](offs_t offset){ return periph_id[2]; }, "periph_id2").umask32(0x000000ff);
- map(0xfec, 0xfec).lr8([this](offs_t offset){ return periph_id[3]; }, "periph_id3").umask32(0x000000ff);
- map(0xff0, 0xff0).lr8([this](offs_t offset){ return pcell_id[0]; }, "pcell_id0").umask32(0x000000ff);
- map(0xff4, 0xff4).lr8([this](offs_t offset){ return pcell_id[1]; }, "pcell_id1").umask32(0x000000ff);
- map(0xff8, 0xff8).lr8([this](offs_t offset){ return pcell_id[2]; }, "pcell_id2").umask32(0x000000ff);
- map(0xffc, 0xffc).lr8([this](offs_t offset){ return pcell_id[3]; }, "pcell_id3").umask32(0x000000ff);
-}
-
-device_memory_interface::space_config_vector vic_pl190_device::memory_space_config() const
-{
- return space_config_vector{
- std::make_pair(0, &m_mmio_config)
- };
-}
-
-void vic_pl190_device::device_resolve_objects()
-{
- // resolve callbacks
- m_out_irq_func.resolve_safe();
- m_out_fiq_func.resolve_safe();
-}
-
-void vic_pl190_device::device_start()
-{
- save_item(NAME(raw_intr));
- save_item(NAME(intr_select));
- save_item(NAME(intr_en));
- save_item(NAME(soft_intr));
- save_item(NAME(vectaddr));
- save_item(NAME(defaddress));
- save_item(NAME(vicaddress));
- save_item(NAME(priority_mask));
- save_item(NAME(priority));
- save_item(NAME(protection));
-}
-
-void vic_pl190_device::device_reset()
-{
- raw_intr = intr_select = intr_en = soft_intr = 0;
- defaddress = vicaddress = protection = 0;
-
- priority_mask = ~0;
- priority = ~0;
-
- for(int i = 0; i < 32; i++)
- {
- vectaddr[i] = 0;
- vectctl[i] = 0;
- }
-}
-
-vic_pl190_device::vic_pl190_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, type, tag, owner, clock)
- , device_memory_interface(mconfig, *this)
- , num_vectors(16)
- , periph_id{0x92, 0x11, 0x04, 0x00}
- , pcell_id{0x0d, 0xf0, 0x05, 0xb1}
- , m_mmio_config("mmio", ENDIANNESS_LITTLE, 32, 32, 0)
- , m_out_irq_func(*this)
- , m_out_fiq_func(*this)
-{
-}
-
-vic_pl190_device::vic_pl190_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : vic_pl190_device(mconfig, PL190_VIC, tag, owner, clock)
-{
-}
-
-
-
-
void vic_upd800468_device::int_clear_w(u32 data)
{
raw_intr &= ~data;
- timer_set(attotime::zero, TIMER_CHECK_IRQ);
-}
-
-void vic_upd800468_device::map(address_map &map)
-{
- vic_pl190_device::map(map);
-
- map(0x100, 0x17f).rw(FUNC(vic_pl190_device::vect_addr_r), FUNC(vic_pl190_device::vect_addr_w));
- map(0x200, 0x27f).rw(FUNC(vic_pl190_device::vect_ctl_r), FUNC(vic_pl190_device::vect_ctl_w));
- map(0x2c8, 0x2cb).w(FUNC(vic_upd800468_device::int_clear_w));
+ m_irq_sync_timer->adjust(attotime::zero);
}
-vic_upd800468_device::vic_upd800468_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : vic_pl190_device(mconfig, UPD800468_VIC, tag, owner, clock)
-{
- num_vectors = 32;
-}
@@ -354,56 +407,3 @@ void vic_pl192_device::update_vector()
}
priority_mask = newmask;
}
-
-void vic_pl192_device::map(address_map &map)
-{
- map(0x000, 0x003).r(FUNC(vic_pl190_device::irq_status_r));
- map(0x004, 0x007).r(FUNC(vic_pl190_device::fiq_status_r));
- map(0x008, 0x00b).r(FUNC(vic_pl190_device::raw_intr_r));
- map(0x00c, 0x00f).rw(FUNC(vic_pl190_device::int_select_r), FUNC(vic_pl190_device::int_select_w));
- map(0x010, 0x013).rw(FUNC(vic_pl190_device::int_enable_r), FUNC(vic_pl190_device::int_enable_w));
- map(0x014, 0x017).w(FUNC(vic_pl190_device::int_en_clear_w));
- map(0x018, 0x01b).rw(FUNC(vic_pl190_device::soft_int_r), FUNC(vic_pl190_device::soft_int_w));
- map(0x01c, 0x01f).w(FUNC(vic_pl190_device::soft_int_clear_w));
- map(0x020, 0x020).rw(FUNC(vic_pl190_device::protection_r), FUNC(vic_pl190_device::protection_w)).umask32(0x000000ff);
- map(0x024, 0x025).rw(FUNC(vic_pl192_device::sw_priority_r), FUNC(vic_pl192_device::sw_priority_w)).umask32(0x0000ffff);
- map(0x028, 0x028).rw(FUNC(vic_pl192_device::daisy_priority_r), FUNC(vic_pl192_device::daisy_priority_w)).umask32(0x000000ff);
- map(0x100, 0x17f).rw(FUNC(vic_pl190_device::vect_addr_r), FUNC(vic_pl190_device::vect_addr_w));
- map(0x200, 0x27f).rw(FUNC(vic_pl190_device::vect_ctl_r), FUNC(vic_pl190_device::vect_ctl_w));
- map(0xf00, 0xf03).rw(FUNC(vic_pl190_device::cur_vect_addr_r), FUNC(vic_pl190_device::cur_vect_addr_w));
- map(0xfe0, 0xfe0).lr8([this](offs_t offset) { return periph_id[0]; }, "periph_id0").umask32(0x000000ff);
- map(0xfe4, 0xfe4).lr8([this](offs_t offset) { return periph_id[1]; }, "periph_id1").umask32(0x000000ff);
- map(0xfe8, 0xfe8).lr8([this](offs_t offset) { return periph_id[2]; }, "periph_id2").umask32(0x000000ff);
- map(0xfec, 0xfec).lr8([this](offs_t offset) { return periph_id[3]; }, "periph_id3").umask32(0x000000ff);
- map(0xff0, 0xff0).lr8([this](offs_t offset) { return pcell_id[0]; }, "pcell_id0").umask32(0x000000ff);
- map(0xff4, 0xff4).lr8([this](offs_t offset) { return pcell_id[1]; }, "pcell_id1").umask32(0x000000ff);
- map(0xff8, 0xff8).lr8([this](offs_t offset) { return pcell_id[2]; }, "pcell_id2").umask32(0x000000ff);
- map(0xffc, 0xffc).lr8([this](offs_t offset) { return pcell_id[3]; }, "pcell_id3").umask32(0x000000ff);
-}
-
-void vic_pl192_device::device_start()
-{
- vic_pl190_device::device_start();
-
- save_item(NAME(sw_priority_mask));
- save_item(NAME(daisy_priority));
-}
-
-void vic_pl192_device::device_reset()
-{
- vic_pl190_device::device_reset();
-
- sw_priority_mask = 0xffff;
- daisy_priority = 0xf;
-
- for (int i = 0; i < 32; i++)
- {
- vectctl[i] = 0xf;
- }
-}
-
-vic_pl192_device::vic_pl192_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : vic_pl190_device(mconfig, PL192_VIC, tag, owner, clock)
-{
- num_vectors = 32;
-}
diff --git a/src/devices/machine/vic_pl192.h b/src/devices/machine/vic_pl192.h
index 01c58e9d241..6ef01a3a935 100644
--- a/src/devices/machine/vic_pl192.h
+++ b/src/devices/machine/vic_pl192.h
@@ -50,12 +50,19 @@ public:
void vect_ctl_w(offs_t offset, u32 data);
protected:
- static constexpr device_timer_id TIMER_CHECK_IRQ = 0;
-
vic_pl190_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
+ // device-level overrides
+ virtual void device_start() override;
+ virtual void device_reset() override;
+ virtual void device_resolve_objects() override;
+
+ virtual space_config_vector memory_space_config() const override;
+
virtual void update_vector();
+ TIMER_CALLBACK_MEMBER(irq_sync_tick);
+
u8 num_vectors; // number of available vectored interrupts
u32 raw_intr, intr_select, intr_en, soft_intr;
@@ -66,13 +73,7 @@ protected:
u8 priority; // priority level of the current interrupt, if any
u8 periph_id[4], pcell_id[4];
- // device-level overrides
- virtual void device_resolve_objects() override;
- virtual void device_start() override;
- virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
- virtual space_config_vector memory_space_config() const override;
+ emu_timer *m_irq_sync_timer;
private:
void set_irq_line(int irq, int state);
diff --git a/src/devices/machine/vrc4373.cpp b/src/devices/machine/vrc4373.cpp
index d0dbb96e55a..1100df8b375 100644
--- a/src/devices/machine/vrc4373.cpp
+++ b/src/devices/machine/vrc4373.cpp
@@ -151,7 +151,7 @@ void vrc4373_device::device_start()
m_cpu->add_fastram(0x1fc00000, 0x1fcfffff, true, m_romRegion->base());
// DMA timer
- m_dma_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vrc4373_device::dma_transfer), this));
+ m_dma_timer = timer_alloc(FUNC(vrc4373_device::dma_transfer), this);
// Leave the timer disabled.
m_dma_timer->adjust(attotime::never, 0, DMA_TIMER_PERIOD);
diff --git a/src/devices/machine/vrc5074.cpp b/src/devices/machine/vrc5074.cpp
index a2e1c0ea061..e812cf20d25 100644
--- a/src/devices/machine/vrc5074.cpp
+++ b/src/devices/machine/vrc5074.cpp
@@ -230,14 +230,14 @@ void vrc5074_device::device_start()
m_cpu->add_fastram(0x1fc00000, 0x1fcfffff, true, m_romRegion->base());
// DMA timer
- m_dma_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vrc5074_device::dma_transfer), this));
+ m_dma_timer = timer_alloc(FUNC(vrc5074_device::dma_transfer), this);
// Leave the timer disabled.
m_dma_timer->adjust(attotime::never, 0, DMA_TIMER_PERIOD);
/* allocate timers for the NILE */
m_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate());
m_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate());
- m_timer[2] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vrc5074_device::nile_timer_callback), this));
- m_timer[3] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vrc5074_device::nile_timer_callback), this));
+ m_timer[2] = timer_alloc(FUNC(vrc5074_device::nile_timer_callback), this);
+ m_timer[3] = timer_alloc(FUNC(vrc5074_device::nile_timer_callback), this);
// Save states
// m_sdram
diff --git a/src/devices/machine/vrender0.cpp b/src/devices/machine/vrender0.cpp
index c4e1c3ce5e1..f59edbe4a2e 100644
--- a/src/devices/machine/vrender0.cpp
+++ b/src/devices/machine/vrender0.cpp
@@ -164,10 +164,10 @@ void vrender0soc_device::device_start()
if (this->clock() == 0)
fatalerror("%s: bus clock not setup properly",this->tag());
- m_Timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vrender0soc_device::Timercb<0>),this));
- m_Timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vrender0soc_device::Timercb<1>),this));
- m_Timer[2] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vrender0soc_device::Timercb<2>),this));
- m_Timer[3] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vrender0soc_device::Timercb<3>),this));
+ m_Timer[0] = timer_alloc(FUNC(vrender0soc_device::Timercb<0>), this);
+ m_Timer[1] = timer_alloc(FUNC(vrender0soc_device::Timercb<1>), this);
+ m_Timer[2] = timer_alloc(FUNC(vrender0soc_device::Timercb<2>), this);
+ m_Timer[3] = timer_alloc(FUNC(vrender0soc_device::Timercb<3>), this);
write_tx.resolve_all_safe();
diff --git a/src/devices/machine/watchdog.cpp b/src/devices/machine/watchdog.cpp
index 01f363b0a28..3d7e17178d4 100644
--- a/src/devices/machine/watchdog.cpp
+++ b/src/devices/machine/watchdog.cpp
@@ -60,7 +60,7 @@ void watchdog_timer_device::device_start()
{
// initialize the watchdog
m_counter = 0;
- m_timer = timer_alloc();
+ m_timer = timer_alloc(FUNC(watchdog_timer_device::watchdog_expired), this);
if (m_vblank_count != 0)
{
@@ -87,10 +87,10 @@ void watchdog_timer_device::device_reset()
//-------------------------------------------------
-// device_timer - handle timer expiration events
+// watchdog_expired - handle expired timer
//-------------------------------------------------
-void watchdog_timer_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(watchdog_timer_device::watchdog_expired)
{
watchdog_fired();
}
diff --git a/src/devices/machine/watchdog.h b/src/devices/machine/watchdog.h
index a140b13e319..aaeed0fa494 100644
--- a/src/devices/machine/watchdog.h
+++ b/src/devices/machine/watchdog.h
@@ -42,7 +42,8 @@ protected:
virtual void device_validity_check(validity_checker &valid) const override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(watchdog_expired);
private:
// internal helpers
diff --git a/src/devices/machine/wd1000.cpp b/src/devices/machine/wd1000.cpp
index dcb620720e5..848c368e6b6 100644
--- a/src/devices/machine/wd1000.cpp
+++ b/src/devices/machine/wd1000.cpp
@@ -62,8 +62,8 @@ void wd1000_device::device_start()
m_drq_cb.resolve();
// Allocate timers
- m_seek_timer = timer_alloc(TIMER_SEEK);
- m_drq_timer = timer_alloc(TIMER_DRQ);
+ m_seek_timer = timer_alloc(FUNC(wd1000_device::update_seek), this);
+ m_drq_timer = timer_alloc(FUNC(wd1000_device::delayed_drq), this);
// Empty buffer.
m_buffer_index = 0;
@@ -111,49 +111,47 @@ void wd1000_device::device_reset()
}
//-------------------------------------------------
-// device_timer - device-specific timer
+// update_seek -
//-------------------------------------------------
-void wd1000_device::device_timer(emu_timer &timer, device_timer_id tid, int param)
+TIMER_CALLBACK_MEMBER(wd1000_device::update_seek)
{
- switch (tid)
- {
- case TIMER_SEEK:
-
- m_drive_cylinder[drive()] = param;
- m_status |= S_SC;
-
- switch (m_command >> 4)
- {
- case CMD_RESTORE:
- cmd_restore();
- break;
-
- case CMD_SEEK:
- cmd_seek();
- break;
+ m_drive_cylinder[drive()] = param;
+ m_status |= S_SC;
- case CMD_READ_SECTOR:
- cmd_read_sector();
- break;
+ switch (m_command >> 4)
+ {
+ case CMD_RESTORE:
+ cmd_restore();
+ break;
- case CMD_WRITE_SECTOR:
- cmd_write_sector();
- break;
+ case CMD_SEEK:
+ cmd_seek();
+ break;
- case CMD_WRITE_FORMAT:
- cmd_format_sector();
- break;
- }
+ case CMD_READ_SECTOR:
+ cmd_read_sector();
+ break;
+ case CMD_WRITE_SECTOR:
+ cmd_write_sector();
break;
- case TIMER_DRQ:
- set_drq();
+ case CMD_WRITE_FORMAT:
+ cmd_format_sector();
break;
}
}
+//-------------------------------------------------
+// delayed_drq - set DRQ after a necessary delay
+//-------------------------------------------------
+
+TIMER_CALLBACK_MEMBER(wd1000_device::delayed_drq)
+{
+ set_drq();
+}
+
void wd1000_device::set_error(int error)
{
if (error)
diff --git a/src/devices/machine/wd1000.h b/src/devices/machine/wd1000.h
index 6b12f325b1c..4e2882ee81c 100644
--- a/src/devices/machine/wd1000.h
+++ b/src/devices/machine/wd1000.h
@@ -45,7 +45,9 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(update_seek);
+ TIMER_CALLBACK_MEMBER(delayed_drq);
private:
enum
@@ -77,12 +79,6 @@ private:
CMD_SEEK = 7
};
- enum
- {
- TIMER_SEEK,
- TIMER_DRQ,
- };
-
void set_error(int error);
void set_intrq(int state);
void set_drq();
diff --git a/src/devices/machine/wd1010.cpp b/src/devices/machine/wd1010.cpp
index 859b5bbe2bf..cef0b5d9dd2 100644
--- a/src/devices/machine/wd1010.cpp
+++ b/src/devices/machine/wd1010.cpp
@@ -96,9 +96,9 @@ void wd1010_device::device_start()
m_out_data_cb.resolve_safe();
// allocate timer
- m_seek_timer = timer_alloc(TIMER_SEEK);
- m_read_timer = timer_alloc(TIMER_READ);
- m_write_timer = timer_alloc(TIMER_WRITE);
+ m_seek_timer = timer_alloc(FUNC(wd1010_device::update_seek), this);
+ m_read_timer = timer_alloc(FUNC(wd1010_device::delayed_read), this);
+ m_write_timer = timer_alloc(FUNC(wd1010_device::delayed_write), this);
// register for save states
save_item(NAME(m_intrq));
@@ -124,59 +124,62 @@ void wd1010_device::device_reset()
}
//-------------------------------------------------
-// device_timer - device-specific timer
+// update_seek -
//-------------------------------------------------
-void wd1010_device::device_timer(emu_timer &timer, device_timer_id tid, int param)
+TIMER_CALLBACK_MEMBER(wd1010_device::update_seek)
{
- switch (tid)
+ if ((m_command >> 4) != CMD_SCAN_ID)
{
- case TIMER_SEEK:
-
- if ((m_command >> 4) != CMD_SCAN_ID)
- {
- LOGSEEK("Seek complete\n");
- m_drives[drive()].cylinder = param;
- m_status |= STATUS_SC;
- }
+ LOGSEEK("Seek complete\n");
+ m_drives[drive()].cylinder = param;
+ m_status |= STATUS_SC;
+ }
- switch (m_command >> 4)
- {
- case CMD_RESTORE:
- cmd_restore();
- break;
-
- case CMD_SEEK:
- cmd_seek();
- break;
-
- case CMD_READ_SECTOR:
- cmd_read_sector();
- break;
-
- case CMD_WRITE_SECTOR:
- case CMD_WRITE_FORMAT:
- cmd_write_sector();
- break;
-
- case CMD_SCAN_ID:
- cmd_scan_id();
- break;
- }
+ switch (m_command >> 4)
+ {
+ case CMD_RESTORE:
+ cmd_restore();
+ break;
+ case CMD_SEEK:
+ cmd_seek();
break;
- case TIMER_READ:
+ case CMD_READ_SECTOR:
cmd_read_sector();
break;
- case TIMER_WRITE:
+ case CMD_WRITE_SECTOR:
+ case CMD_WRITE_FORMAT:
cmd_write_sector();
break;
+
+ case CMD_SCAN_ID:
+ cmd_scan_id();
+ break;
}
}
//-------------------------------------------------
+// delayed_read -
+//-------------------------------------------------
+
+TIMER_CALLBACK_MEMBER(wd1010_device::delayed_read)
+{
+ cmd_read_sector();
+}
+
+//-------------------------------------------------
+// delayed_write -
+//-------------------------------------------------
+
+TIMER_CALLBACK_MEMBER(wd1010_device::delayed_write)
+{
+ cmd_write_sector();
+}
+
+//-------------------------------------------------
// set_error - set error and adjust status
//-------------------------------------------------
diff --git a/src/devices/machine/wd1010.h b/src/devices/machine/wd1010.h
index 980c0518f32..70d8a687163 100644
--- a/src/devices/machine/wd1010.h
+++ b/src/devices/machine/wd1010.h
@@ -54,7 +54,10 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(update_seek);
+ TIMER_CALLBACK_MEMBER(delayed_read);
+ TIMER_CALLBACK_MEMBER(delayed_write);
private:
enum
@@ -91,13 +94,6 @@ private:
CMD_SEEK = 7
};
- enum
- {
- TIMER_SEEK,
- TIMER_READ,
- TIMER_WRITE
- };
-
void set_error(int error);
void set_intrq(int state);
void set_bdrq(int state);
diff --git a/src/devices/machine/wd2010.cpp b/src/devices/machine/wd2010.cpp
index fd4fbac41a1..840d0f6f4d8 100644
--- a/src/devices/machine/wd2010.cpp
+++ b/src/devices/machine/wd2010.cpp
@@ -202,18 +202,12 @@ void wd2010_device::device_start()
m_in_sc_cb.resolve_safe(0);
/* allocate a timer for commands */
- cmd_timer = timer_alloc(0);
- complete_write_when_buffer_ready_high = timer_alloc(1);
- deassert_write_when_buffer_ready_low = timer_alloc(2);
- deassert_read_when_buffer_ready_high = timer_alloc(3);
+ m_cmd_timer = timer_alloc(FUNC(wd2010_device::command_complete), this);
+ m_complete_write_timer = timer_alloc(FUNC(wd2010_device::complete_write), this);
+ m_deassert_write_timer = timer_alloc(FUNC(wd2010_device::deassert_write), this);
+ m_deassert_read_timer = timer_alloc(FUNC(wd2010_device::deassert_read), this);
}
-// timers
-#define COMMAND_TIMER 0
-#define COMPLETE_WRITE_SECTOR 1
-#define DE_ASSERT_WRITE 2
-#define DE_ASSERT_READ 3
-
//-------------------------------------------------
// device_reset - device-specific reset
@@ -430,7 +424,7 @@ void wd2010_device::restore(uint8_t data)
// NOTE: calculation needs 'data' (extracted from command register)
float step_ms = SETTLING_MS + LATENCY_MS + ( (float)sqrt(1.0 * step_pulses) * STEP_RATE_MS );
- cmd_timer->adjust(attotime::from_usec(1000 * step_ms), newstatus);
+ m_cmd_timer->adjust(attotime::from_usec(1000 * step_ms), newstatus);
return;
}
@@ -532,7 +526,7 @@ void wd2010_device::seek(uint8_t data)
m_task_file[TASK_FILE_CYLINDER_LOW] = (m_present_cylinder - ((m_task_file[TASK_FILE_CYLINDER_HIGH] << 8) )) & 0xff;
//LOGERROR("SEEK (END) - m_present_cylinder = %u SDH CYL L/H %02x / %02x\n", m_present_cylinder,m_task_file[TASK_FILE_CYLINDER_LOW],m_task_file[TASK_FILE_CYLINDER_HIGH]);
- cmd_timer->adjust(attotime::from_usec(1000 * step_ms), newstatus);
+ m_cmd_timer->adjust(attotime::from_usec(1000 * step_ms), newstatus);
}
//-------------------------------------------------
@@ -644,7 +638,7 @@ void wd2010_device::read_sector(uint8_t data)
// NOTE : (intrq_at_end = 0) - INTRQ occurs when the command is completed
newstatus |= (m_status & ~(STATUS_CIP | STATUS_DRQ)) | intrq_at_end; // de-assert CIP + DRQ (BSY already reset)
- deassert_read_when_buffer_ready_high->adjust(attotime::from_usec(1), newstatus); // complete command ON *RISING EDGE * OF BUFFER_READY
+ m_deassert_read_timer->adjust(attotime::from_usec(1), newstatus); // complete command ON *RISING EDGE * OF BUFFER_READY
}
@@ -671,7 +665,7 @@ void wd2010_device::write_sector(uint8_t data)
m_out_bdrq_cb(1);
// WAIT UNTIL BRDY ASSERTED (-> timer):
- complete_write_when_buffer_ready_high->adjust(attotime::from_usec(1), data); // 1 usec
+ m_complete_write_timer->adjust(attotime::from_usec(1), data); // 1 usec
}
@@ -728,7 +722,7 @@ void wd2010_device::complete_write_sector(uint8_t data)
} // --------------------------------------------------------
// 'complete_cmd' ON THE FALLING EDGE OF _BUFFER_READY_ ( set by WRITE_SECTOR ) !
- deassert_write_when_buffer_ready_low->adjust(attotime::from_usec(1), newstatus);
+ m_deassert_write_timer->adjust(attotime::from_usec(1), newstatus);
}
// ******************************************************
@@ -862,7 +856,7 @@ void wd2010_device::format(uint8_t data)
m_out_wg_cb(0); // (transition from WG 1 -> 0). Actual write.
// ** DELAY INTRQ UNTIL WRITE IS COMPLETE :
- complete_write_when_buffer_ready_high->adjust(attotime::from_usec(1), newstatus | STATUS_DRQ); // 1 USECs
+ m_complete_write_timer->adjust(attotime::from_usec(1), newstatus | STATUS_DRQ); // 1 USECs
}
@@ -875,65 +869,63 @@ void wd2010_device::buffer_ready(bool state)
}
-void wd2010_device::device_timer(emu_timer &timer, device_timer_id tid, int param)
+TIMER_CALLBACK_MEMBER(wd2010_device::command_complete)
{
- switch (tid)
- {
- case COMMAND_TIMER:
- cmd_timer->adjust(attotime::never);
- complete_immediate(param);
- break;
-
- case COMPLETE_WRITE_SECTOR: // when BUFFER_READY -> HIGH
- if (is_buffer_ready)
- {
- complete_write_when_buffer_ready_high->adjust(attotime::never);
- complete_write_sector(param);
- }
- else
- {
- complete_write_when_buffer_ready_high->reset();
- complete_write_when_buffer_ready_high->adjust(attotime::from_usec(1), param); // DELAY ANOTHER 1 USEC (!)
- }
- break;
+ m_cmd_timer->adjust(attotime::never);
+ complete_immediate(param);
+}
- case DE_ASSERT_WRITE: // waiting for BUFFER_READY -> LOW
- if (!(is_buffer_ready))
- {
- deassert_write_when_buffer_ready_low->adjust(attotime::never);
- complete_immediate(param);
- }
- else
- {
- deassert_write_when_buffer_ready_low->reset();
- deassert_write_when_buffer_ready_low->adjust(attotime::from_usec(1), param); // DELAY ANOTHER 1 USEC (!)
- }
- break;
+TIMER_CALLBACK_MEMBER(wd2010_device::complete_write)
+{
+ // when BUFFER_READY -> HIGH
+ if (is_buffer_ready)
+ {
+ m_complete_write_timer->adjust(attotime::never);
+ complete_write_sector(param);
+ }
+ else
+ {
+ m_complete_write_timer->reset();
+ m_complete_write_timer->adjust(attotime::from_usec(1), param); // DELAY ANOTHER 1 USEC (!)
+ }
+}
- case DE_ASSERT_READ: // when BUFFER_READY -> HIGH
- if (is_buffer_ready)
- {
- deassert_read_when_buffer_ready_high->adjust(attotime::never);
+TIMER_CALLBACK_MEMBER(wd2010_device::deassert_write)
+{
+ // waiting for BUFFER_READY -> LOW
+ if (!(is_buffer_ready))
+ {
+ m_deassert_write_timer->adjust(attotime::never);
+ complete_immediate(param);
+ }
+ else
+ {
+ m_deassert_write_timer->reset();
+ m_deassert_write_timer->adjust(attotime::from_usec(1), param); // DELAY ANOTHER 1 USEC (!)
+ }
+}
- m_error &= ~ERROR_ID;
- param &= ~STATUS_ERR;
+TIMER_CALLBACK_MEMBER(wd2010_device::deassert_read)
+{
+ // when BUFFER_READY -> HIGH
+ if (is_buffer_ready)
+ {
+ m_deassert_read_timer->adjust(attotime::never);
- m_out_bdrq_cb(0);
- complete_immediate(param);
- }
- else
- {
- deassert_read_when_buffer_ready_high->reset();
- deassert_read_when_buffer_ready_high->adjust(attotime::from_usec(1), param); // DELAY ANOTHER 1 USEC (!)
- }
- break;
+ m_error &= ~ERROR_ID;
+ param &= ~STATUS_ERR;
- default:
- break;
+ m_out_bdrq_cb(0);
+ complete_immediate(param);
+ }
+ else
+ {
+ m_deassert_read_timer->reset();
+ m_deassert_read_timer->adjust(attotime::from_usec(1), param); // DELAY ANOTHER 1 USEC (!)
}
}
-// Called by 'device_timer' -
+// Called by timer callbacks -
void wd2010_device::complete_immediate(uint8_t status)
{
// re-evaluate external signals at end of command
@@ -964,5 +956,5 @@ void wd2010_device::complete_immediate(uint8_t status)
void wd2010_device::complete_cmd(uint8_t status)
{
- cmd_timer->adjust(attotime::from_msec(1), status);
+ m_cmd_timer->adjust(attotime::from_msec(1), status);
}
diff --git a/src/devices/machine/wd2010.h b/src/devices/machine/wd2010.h
index 5f5acc6ebfd..a39935326ba 100644
--- a/src/devices/machine/wd2010.h
+++ b/src/devices/machine/wd2010.h
@@ -50,7 +50,10 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(command_complete);
+ TIMER_CALLBACK_MEMBER(complete_write);
+ TIMER_CALLBACK_MEMBER(deassert_write);
+ TIMER_CALLBACK_MEMBER(deassert_read);
private:
void compute_correction(uint8_t data);
@@ -84,10 +87,10 @@ private:
uint8_t m_error;
uint8_t m_task_file[8];
- emu_timer *cmd_timer;
- emu_timer *complete_write_when_buffer_ready_high;
- emu_timer *deassert_write_when_buffer_ready_low;
- emu_timer *deassert_read_when_buffer_ready_high;
+ emu_timer *m_cmd_timer;
+ emu_timer *m_complete_write_timer;
+ emu_timer *m_deassert_write_timer;
+ emu_timer *m_deassert_read_timer;
void complete_write_sector(uint8_t status);
void complete_cmd(uint8_t status);
diff --git a/src/devices/machine/wd33c9x.cpp b/src/devices/machine/wd33c9x.cpp
index dd7fa07a7c4..cb59256cea1 100644
--- a/src/devices/machine/wd33c9x.cpp
+++ b/src/devices/machine/wd33c9x.cpp
@@ -390,7 +390,7 @@ void wd33c9x_base_device::device_start()
{
m_irq_cb.resolve_safe();
m_drq_cb.resolve_safe();
- m_timer = timer_alloc(0);
+ m_timer = timer_alloc(FUNC(wd33c9x_base_device::update_step), this);
save_item(NAME(m_addr));
save_item(NAME(m_regs));
save_item(NAME(m_command_length));
@@ -443,10 +443,10 @@ void wd33c9x_base_device::device_reset()
//-------------------------------------------------
-// device_timer - device-specific timer handler
+// update_step -
//-------------------------------------------------
-void wd33c9x_base_device::device_timer(emu_timer &timer, device_timer_id tid, int param)
+TIMER_CALLBACK_MEMBER(wd33c9x_base_device::update_step)
{
step(true);
}
diff --git a/src/devices/machine/wd33c9x.h b/src/devices/machine/wd33c9x.h
index fcc3e50051a..8fb9e8ea78a 100644
--- a/src/devices/machine/wd33c9x.h
+++ b/src/devices/machine/wd33c9x.h
@@ -43,7 +43,8 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(update_step);
virtual void scsi_ctrl_changed() override;
diff --git a/src/devices/machine/wd_fdc.cpp b/src/devices/machine/wd_fdc.cpp
index fa1b4013f49..c942f0b82c2 100644
--- a/src/devices/machine/wd_fdc.cpp
+++ b/src/devices/machine/wd_fdc.cpp
@@ -175,10 +175,10 @@ void wd_fdc_device_base::device_start()
if (!has_enmf && !enmf_cb.isnull())
logerror("Warning, this chip doesn't have an ENMF line.\n");
- t_gen = timer_alloc(TM_GEN);
- t_cmd = timer_alloc(TM_CMD);
- t_track = timer_alloc(TM_TRACK);
- t_sector = timer_alloc(TM_SECTOR);
+ t_gen = timer_alloc(FUNC(wd_fdc_device_base::generic_tick), this);
+ t_cmd = timer_alloc(FUNC(wd_fdc_device_base::cmd_w_tick), this);
+ t_track = timer_alloc(FUNC(wd_fdc_device_base::track_w_tick), this);
+ t_sector = timer_alloc(FUNC(wd_fdc_device_base::sector_w_tick), this);
dden = disable_mfm;
enmf = false;
floppy = nullptr;
@@ -315,18 +315,35 @@ WRITE_LINE_MEMBER(wd_fdc_device_base::dden_w)
}
}
-void wd_fdc_device_base::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(wd_fdc_device_base::generic_tick)
{
- LOGEVENT("Event fired for timer %s\n", (id==TM_GEN)? "TM_GEN" : (id==TM_CMD)? "TM_CMD" : (id==TM_TRACK)? "TM_TRACK" : "TM_SECTOR");
+ LOGEVENT("Event fired for TM_GEN\n");
live_sync();
+ do_generic();
+ general_continue();
+}
- switch(id) {
- case TM_GEN: do_generic(); break;
- case TM_CMD: do_cmd_w(); break;
- case TM_TRACK: do_track_w(); break;
- case TM_SECTOR: do_sector_w(); break;
- }
+TIMER_CALLBACK_MEMBER(wd_fdc_device_base::cmd_w_tick)
+{
+ LOGEVENT("Event fired for TM_CMD\n");
+ live_sync();
+ do_cmd_w();
+ general_continue();
+}
+TIMER_CALLBACK_MEMBER(wd_fdc_device_base::track_w_tick)
+{
+ LOGEVENT("Event fired for TM_TRACK\n");
+ live_sync();
+ do_track_w();
+ general_continue();
+}
+
+TIMER_CALLBACK_MEMBER(wd_fdc_device_base::sector_w_tick)
+{
+ LOGEVENT("Event fired for TM_SECTOR\n");
+ live_sync();
+ do_sector_w();
general_continue();
}
diff --git a/src/devices/machine/wd_fdc.h b/src/devices/machine/wd_fdc.h
index c205bfe3afd..8cb047b4518 100644
--- a/src/devices/machine/wd_fdc.h
+++ b/src/devices/machine/wd_fdc.h
@@ -117,7 +117,6 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual int calc_sector_size(uint8_t size, uint8_t command) const;
virtual int settle_time() const;
@@ -131,9 +130,12 @@ protected:
virtual void pll_save_checkpoint() = 0;
virtual void pll_retrieve_checkpoint() = 0;
-private:
- enum { TM_GEN, TM_CMD, TM_TRACK, TM_SECTOR };
+ TIMER_CALLBACK_MEMBER(generic_tick);
+ TIMER_CALLBACK_MEMBER(cmd_w_tick);
+ TIMER_CALLBACK_MEMBER(track_w_tick);
+ TIMER_CALLBACK_MEMBER(sector_w_tick);
+private:
// State machine general behaviour:
//
// There are three levels of state.
diff --git a/src/devices/machine/wozfdc.cpp b/src/devices/machine/wozfdc.cpp
index 9b3aa213dbf..bb28baba13e 100644
--- a/src/devices/machine/wozfdc.cpp
+++ b/src/devices/machine/wozfdc.cpp
@@ -79,8 +79,8 @@ void wozfdc_device::device_start()
{
m_rom_p6 = machine().root_device().memregion(this->subtag(DISKII_P6_REGION).c_str())->base();
- timer = timer_alloc(0);
- delay_timer = timer_alloc(1);
+ timer = timer_alloc(FUNC(wozfdc_device::generic_tick), this);
+ delay_timer = timer_alloc(FUNC(wozfdc_device::delayed_tick), this);
save_item(NAME(last_6502_write));
save_item(NAME(mode_write));
@@ -178,12 +178,18 @@ void appleiii_fdc_device::device_reset()
enable1 = 1;
}
-void wozfdc_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(wozfdc_device::generic_tick)
+{
+ if(active)
+ lss_sync();
+}
+
+TIMER_CALLBACK_MEMBER(wozfdc_device::delayed_tick)
{
if(active)
lss_sync();
- if(id == 1 && active == MODE_DELAY) {
+ if(active == MODE_DELAY) {
if(floppy)
floppy->mon_w(true);
active = MODE_IDLE;
diff --git a/src/devices/machine/wozfdc.h b/src/devices/machine/wozfdc.h
index ad638ec16f0..f92ccaec39f 100644
--- a/src/devices/machine/wozfdc.h
+++ b/src/devices/machine/wozfdc.h
@@ -39,7 +39,9 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(generic_tick);
+ TIMER_CALLBACK_MEMBER(delayed_tick);
void control(int offset);
void set_phase(uint8_t data);
diff --git a/src/devices/machine/ym2148.cpp b/src/devices/machine/ym2148.cpp
index bc07d809f19..88f7db02b1e 100644
--- a/src/devices/machine/ym2148.cpp
+++ b/src/devices/machine/ym2148.cpp
@@ -45,7 +45,7 @@ void ym2148_device::device_start()
// Start a timer to trigger at clock / 8 / 16
const attotime rate = clocks_to_attotime(8 * 16);
- m_timer = timer_alloc(0);
+ m_timer = timer_alloc(FUNC(ym2148_device::serial_clock_tick), this);
m_timer->adjust(rate, 0, rate);
}
@@ -136,7 +136,7 @@ void ym2148_device::update_irq()
}
-void ym2148_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(ym2148_device::serial_clock_tick)
{
receive_clock();
transmit_clock();
diff --git a/src/devices/machine/ym2148.h b/src/devices/machine/ym2148.h
index 70130ce3f5d..07cacfbc589 100644
--- a/src/devices/machine/ym2148.h
+++ b/src/devices/machine/ym2148.h
@@ -40,7 +40,8 @@ public:
protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(serial_clock_tick);
private:
devcb_write_line m_txd_handler;
diff --git a/src/devices/machine/ym3802.cpp b/src/devices/machine/ym3802.cpp
index 85a0bea0292..4a8f6a7ffae 100644
--- a/src/devices/machine/ym3802.cpp
+++ b/src/devices/machine/ym3802.cpp
@@ -30,17 +30,16 @@ ym3802_device::ym3802_device(const machine_config &mconfig, const char *tag, dev
, m_vector(0)
, m_clkm_rate(500000) // TODO: make these configurable
, m_clkf_rate(614400)
- {
- }
+{
+}
void ym3802_device::device_start()
{
m_irq_handler.resolve_safe();
m_txd_handler.resolve_safe();
m_rxd_handler.resolve_safe(0xff);
- m_clock_timer = timer_alloc(TIMER_SYSTEM_CLOCK);
- m_midi_timer = timer_alloc(TIMER_TX_CLOCK);
- m_midi_counter_timer = timer_alloc(TIMER_MIDI_CLOCK);
+ m_midi_timer = timer_alloc(FUNC(ym3802_device::transmit_clk), this);
+ m_midi_counter_timer = timer_alloc(FUNC(ym3802_device::midi_clk), this);
save_item(NAME(m_reg));
}
@@ -54,20 +53,6 @@ void ym3802_device::device_reset()
set_comms_mode();
}
-void ym3802_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- // TODO: support clock and timers
- switch(id)
- {
- case TIMER_TX_CLOCK:
- transmit_clk();
- break;
- case TIMER_MIDI_CLOCK:
- midi_clk();
- break;
- }
-}
-
void ym3802_device::set_irq(uint8_t irq)
{
uint8_t x;
@@ -90,7 +75,7 @@ void ym3802_device::reset_irq(uint8_t irq)
m_irq_handler(CLEAR_LINE);
}
-void ym3802_device::transmit_clk()
+TIMER_CALLBACK_MEMBER(ym3802_device::transmit_clk)
{
if(m_reg[REG_TCR] & 0x01) // Tx Enable
{
@@ -116,7 +101,7 @@ void ym3802_device::transmit_clk()
}
}
-void ym3802_device::midi_clk()
+TIMER_CALLBACK_MEMBER(ym3802_device::midi_clk)
{
if(m_midi_counter_base > 1) // counter is not guaranteed to work if set to 0 or 1.
{
diff --git a/src/devices/machine/ym3802.h b/src/devices/machine/ym3802.h
index 05adada6b4f..00e6683ed25 100644
--- a/src/devices/machine/ym3802.h
+++ b/src/devices/machine/ym3802.h
@@ -3,7 +3,10 @@
/*
* ym3802.h - Yamaha YM3802/YM3523 MCS MIDI Communication and Service Controller
*
- * * Registers:
+ * CLK input - anywhere from 1MHz up to 4MHz
+ * CLKM input - usually either 1MHz or 0.5MHz, or CLKF input - usually 614.4kHz
+ *
+ * Registers:
* reg0 : IVR (read-only)
* reg1 : RGR (bit 8 = reset, bits 0-3 = register bank select)
* reg2 : ISR (read-only)
@@ -26,7 +29,7 @@
class ym3802_device : public device_t, public device_serial_interface
{
public:
- // construction/destruction
+ // construction/destruction
ym3802_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// configuration helpers
@@ -41,7 +44,6 @@ public:
protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
private:
enum
@@ -118,15 +120,8 @@ private:
IRQ_GENERAL_TIMER = 0x80
};
- enum
- {
- TIMER_SYSTEM_CLOCK = 0x200, // CLK input - anywhere from 1MHz up to 4MHz
- TIMER_TX_CLOCK,
- TIMER_MIDI_CLOCK // CLKM input - usually either 1MHz or 0.5MHz, or CLKF input - usually 614.4kHz
- };
-
- void transmit_clk();
- void midi_clk();
+ TIMER_CALLBACK_MEMBER(transmit_clk);
+ TIMER_CALLBACK_MEMBER(midi_clk);
void reset_midi_timer();
void set_comms_mode();
void set_irq(uint8_t irq);
@@ -135,7 +130,6 @@ private:
devcb_write_line m_irq_handler;
devcb_write_line m_txd_handler;
devcb_read_line m_rxd_handler;
- emu_timer* m_clock_timer;
emu_timer* m_midi_timer;
emu_timer* m_midi_counter_timer;
diff --git a/src/devices/machine/z8038.cpp b/src/devices/machine/z8038.cpp
index e8e8203049b..699c43898ca 100644
--- a/src/devices/machine/z8038.cpp
+++ b/src/devices/machine/z8038.cpp
@@ -91,7 +91,7 @@ void z8038_device::device_start()
//save_item(NAME(m_fifo));
- m_int_check = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(z8038_device::int_check), this));
+ m_int_check = timer_alloc(FUNC(z8038_device::int_check), this);
// suppress startup interrupt line changes
m_port[0].int_asserted = false;
diff --git a/src/devices/machine/z80ctc.cpp b/src/devices/machine/z80ctc.cpp
index 3dbd8b25ad1..6a6e728d548 100644
--- a/src/devices/machine/z80ctc.cpp
+++ b/src/devices/machine/z80ctc.cpp
@@ -308,8 +308,8 @@ z80ctc_channel_device::z80ctc_channel_device(const machine_config &mconfig, cons
void z80ctc_channel_device::device_start()
{
// initialize state
- m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(z80ctc_channel_device::timer_callback), this));
- m_zc_to_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(z80ctc_channel_device::zc_to_callback), this));
+ m_timer = timer_alloc(FUNC(z80ctc_channel_device::timer_callback), this);
+ m_zc_to_timer = timer_alloc(FUNC(z80ctc_channel_device::zc_to_callback), this);
// register for save states
save_item(NAME(m_mode));
diff --git a/src/devices/machine/z80dma.cpp b/src/devices/machine/z80dma.cpp
index 38148ff6350..65da965144e 100644
--- a/src/devices/machine/z80dma.cpp
+++ b/src/devices/machine/z80dma.cpp
@@ -181,7 +181,7 @@ void z80dma_device::device_start()
m_out_iorq_cb.resolve_safe();
// allocate timer
- m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(z80dma_device::timerproc), this));
+ m_timer = timer_alloc(FUNC(z80dma_device::timerproc), this);
// register for state saving
save_item(NAME(m_regs));
diff --git a/src/devices/machine/z80scc.cpp b/src/devices/machine/z80scc.cpp
index 731571602d6..746bc7ee757 100644
--- a/src/devices/machine/z80scc.cpp
+++ b/src/devices/machine/z80scc.cpp
@@ -1072,7 +1072,7 @@ void z80scc_channel::device_start()
m_rxc = 0x00;
m_txc = 0x00;
- m_baudtimer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(z80scc_channel::brg_tick), this));
+ m_baudtimer = timer_alloc(FUNC(z80scc_channel::brg_tick), this);
// state saving
save_item(NAME(m_rr0));
diff --git a/src/devices/machine/z80sio.cpp b/src/devices/machine/z80sio.cpp
index 5095dd4cb9b..8306c48bab4 100644
--- a/src/devices/machine/z80sio.cpp
+++ b/src/devices/machine/z80sio.cpp
@@ -1087,7 +1087,7 @@ void mk68564_channel::device_start()
{
z80sio_channel::device_start();
- m_brg_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mk68564_channel::brg_timeout), this));
+ m_brg_timer = timer_alloc(FUNC(mk68564_channel::brg_timeout), this);
save_item(NAME(m_tx_auto_enable));
save_item(NAME(m_brg_tc));
diff --git a/src/devices/machine/z80sti.cpp b/src/devices/machine/z80sti.cpp
index f049c3d19fa..a72a370ec79 100644
--- a/src/devices/machine/z80sti.cpp
+++ b/src/devices/machine/z80sti.cpp
@@ -121,10 +121,10 @@ void z80sti_device::device_start()
m_out_tdo_cb.resolve_safe();
// create the counter timers
- m_timer[TIMER_A] = timer_alloc(TIMER_A);
- m_timer[TIMER_B] = timer_alloc(TIMER_B);
- m_timer[TIMER_C] = timer_alloc(TIMER_C);
- m_timer[TIMER_D] = timer_alloc(TIMER_D);
+ m_timer[TIMER_A] = timer_alloc(FUNC(z80sti_device::timer_count), this);
+ m_timer[TIMER_B] = timer_alloc(FUNC(z80sti_device::timer_count), this);
+ m_timer[TIMER_C] = timer_alloc(FUNC(z80sti_device::timer_count), this);
+ m_timer[TIMER_D] = timer_alloc(FUNC(z80sti_device::timer_count), this);
// create serial receive clock timer
if (m_rx_clock > 0)
@@ -176,16 +176,6 @@ void z80sti_device::device_reset()
//-------------------------------------------------
-// device_timer - handler timer events
-//-------------------------------------------------
-
-void z80sti_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- timer_count(id);
-}
-
-
-//-------------------------------------------------
// tra_callback -
//-------------------------------------------------
@@ -618,46 +608,46 @@ void z80sti_device::write(offs_t offset, uint8_t data)
// timer_count - timer count down
//-------------------------------------------------
-void z80sti_device::timer_count(int index)
+TIMER_CALLBACK_MEMBER(z80sti_device::timer_count)
{
- if (m_tmc[index] == 0x01)
+ if (m_tmc[param] == 0x01)
{
- //LOG("Z80STI Timer %c Expired\n", 'A' + index);
+ //LOG("Z80STI Timer %c Expired\n", 'A' + param);
// toggle timer output signal
- m_to[index] = !m_to[index];
+ m_to[param] = !m_to[param];
- switch (index)
+ switch (param)
{
case TIMER_A:
- m_out_tao_cb(m_to[index]);
+ m_out_tao_cb(m_to[param]);
break;
case TIMER_B:
- m_out_tbo_cb(m_to[index]);
+ m_out_tbo_cb(m_to[param]);
break;
case TIMER_C:
- m_out_tco_cb(m_to[index]);
+ m_out_tco_cb(m_to[param]);
break;
case TIMER_D:
- m_out_tdo_cb(m_to[index]);
+ m_out_tdo_cb(m_to[param]);
break;
}
- if (m_ier & (1 << INT_LEVEL_TIMER[index]))
+ if (m_ier & (1 << INT_LEVEL_TIMER[param]))
{
- LOG("Z80STI for Timer %c\n", 'A' + index);
+ LOG("Z80STI for Timer %c\n", 'A' + param);
// signal timer elapsed interrupt
- take_interrupt(INT_LEVEL_TIMER[index]);
+ take_interrupt(INT_LEVEL_TIMER[param]);
}
// load timer main counter
- m_tmc[index] = m_tdr[index];
+ m_tmc[param] = m_tdr[param];
}
else
{
// count down
- m_tmc[index]--;
+ m_tmc[param]--;
}
}
diff --git a/src/devices/machine/z80sti.h b/src/devices/machine/z80sti.h
index 2d5dba0f397..9cd0ff40d59 100644
--- a/src/devices/machine/z80sti.h
+++ b/src/devices/machine/z80sti.h
@@ -148,7 +148,6 @@ private:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_serial_interface overrides
virtual void tra_callback() override;
@@ -163,7 +162,7 @@ private:
// internal helpers
void check_interrupts();
void take_interrupt(int level);
- void timer_count(int index);
+ TIMER_CALLBACK_MEMBER(timer_count);
void gpip_input(int bit, int state);
// device callbacks
diff --git a/src/devices/machine/z8536.cpp b/src/devices/machine/z8536.cpp
index e95dfe7574a..c30868d0dbb 100644
--- a/src/devices/machine/z8536.cpp
+++ b/src/devices/machine/z8536.cpp
@@ -564,7 +564,7 @@ void cio_base_device::write_register(offs_t offset, u8 data, u8 mask)
// counter_enabled - is counter enabled?
//-------------------------------------------------
-bool cio_base_device::counter_enabled(device_timer_id id)
+bool cio_base_device::counter_enabled(int id)
{
bool enabled = false;
@@ -591,7 +591,7 @@ bool cio_base_device::counter_enabled(device_timer_id id)
// counter_external_output -
//-------------------------------------------------
-bool cio_base_device::counter_external_output(device_timer_id id)
+bool cio_base_device::counter_external_output(int id)
{
return (m_register[COUNTER_TIMER_1_MODE_SPECIFICATION + id] & CTMS_EOE) ? true : false;
}
@@ -601,7 +601,7 @@ bool cio_base_device::counter_external_output(device_timer_id id)
// counter_external_count -
//-------------------------------------------------
-bool cio_base_device::counter_external_count(device_timer_id id)
+bool cio_base_device::counter_external_count(int id)
{
return (m_register[COUNTER_TIMER_1_MODE_SPECIFICATION + id] & CTMS_ECE) ? true : false;
}
@@ -611,7 +611,7 @@ bool cio_base_device::counter_external_count(device_timer_id id)
// counter_external_trigger -
//-------------------------------------------------
-bool cio_base_device::counter_external_trigger(device_timer_id id)
+bool cio_base_device::counter_external_trigger(int id)
{
return (m_register[COUNTER_TIMER_1_MODE_SPECIFICATION + id] & CTMS_ETE) ? true : false;
}
@@ -621,7 +621,7 @@ bool cio_base_device::counter_external_trigger(device_timer_id id)
// counter_external_gate -
//-------------------------------------------------
-bool cio_base_device::counter_external_gate(device_timer_id id)
+bool cio_base_device::counter_external_gate(int id)
{
return (m_register[COUNTER_TIMER_1_MODE_SPECIFICATION + id] & CTMS_EDE) ? true : false;
}
@@ -631,7 +631,7 @@ bool cio_base_device::counter_external_gate(device_timer_id id)
// counter_gated -
//-------------------------------------------------
-bool cio_base_device::counter_gated(device_timer_id id)
+bool cio_base_device::counter_gated(int id)
{
return (m_register[COUNTER_TIMER_1_COMMAND_AND_STATUS + id] & CTCS_GCB) ? true : false;
}
@@ -641,7 +641,7 @@ bool cio_base_device::counter_gated(device_timer_id id)
// count - count down
//-------------------------------------------------
-void cio_base_device::count(device_timer_id id)
+void cio_base_device::count(int id)
{
if (!counter_gated(id)) return;
if (!(m_register[COUNTER_TIMER_1_COMMAND_AND_STATUS + id] & CTCS_CIP)) return;
@@ -686,7 +686,7 @@ void cio_base_device::count(device_timer_id id)
// trigger -
//-------------------------------------------------
-void cio_base_device::trigger(device_timer_id id)
+void cio_base_device::trigger(int id)
{
// ignore triggers during countdown if retrigger is disabled
if (!(m_register[COUNTER_TIMER_1_MODE_SPECIFICATION + id] & CTMS_REB) && (m_register[COUNTER_TIMER_1_COMMAND_AND_STATUS + id] & CTCS_CIP)) return;
@@ -705,7 +705,7 @@ void cio_base_device::trigger(device_timer_id id)
// gate -
//-------------------------------------------------
-void cio_base_device::gate(device_timer_id id, int state)
+void cio_base_device::gate(int id, int state)
{
// TODO
}
@@ -826,7 +826,7 @@ void cio_base_device::device_start()
}
// allocate timer
- m_timer = timer_alloc();
+ m_timer = timer_alloc(FUNC(cio_base_device::advance_counters), this);
m_timer->adjust(attotime::from_hz(clock() / 2), 0, attotime::from_hz(clock() / 2));
// resolve callbacks
@@ -885,10 +885,10 @@ void z8536_device::device_reset()
//-------------------------------------------------
-// device_timer - handler timer events
+// advance_counters -
//-------------------------------------------------
-void cio_base_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(cio_base_device::advance_counters)
{
if (counter_enabled(TIMER_1) && !counter_external_count(TIMER_1))
{
diff --git a/src/devices/machine/z8536.h b/src/devices/machine/z8536.h
index 442b3e7a00f..382649a15f9 100644
--- a/src/devices/machine/z8536.h
+++ b/src/devices/machine/z8536.h
@@ -109,11 +109,12 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(advance_counters);
bool is_reset() const { return (m_register[MASTER_INTERRUPT_CONTROL] & MICR_RESET) != 0; }
- enum
+ enum : int
{
TIMER_1 = 0,
TIMER_2,
@@ -121,7 +122,7 @@ protected:
};
// ports
- enum
+ enum : int
{
PORT_A = 0,
PORT_B,
@@ -369,15 +370,15 @@ protected:
void write_register(offs_t offset, u8 data);
void write_register(offs_t offset, u8 data, u8 mask);
- bool counter_enabled(device_timer_id id);
- bool counter_external_output(device_timer_id id);
- bool counter_external_count(device_timer_id id);
- bool counter_external_trigger(device_timer_id id);
- bool counter_external_gate(device_timer_id id);
- bool counter_gated(device_timer_id id);
- void count(device_timer_id id);
- void trigger(device_timer_id id);
- void gate(device_timer_id id, int state);
+ bool counter_enabled(int id);
+ bool counter_external_output(int id);
+ bool counter_external_count(int id);
+ bool counter_external_trigger(int id);
+ bool counter_external_gate(int id);
+ bool counter_gated(int id);
+ void count(int id);
+ void trigger(int id);
+ void gate(int id, int state);
void match_pattern(int port);
void external_port_w(int port, int bit, int state);
diff --git a/src/devices/sound/ad1848.cpp b/src/devices/sound/ad1848.cpp
index 414edc6ecb0..7c62b4912ef 100644
--- a/src/devices/sound/ad1848.cpp
+++ b/src/devices/sound/ad1848.cpp
@@ -32,7 +32,7 @@ void ad1848_device::device_add_mconfig(machine_config &config)
void ad1848_device::device_start()
{
- m_timer = timer_alloc(0);
+ m_timer = timer_alloc(FUNC(ad1848_device::update_tick), this);
m_irq_cb.resolve_safe();
m_drq_cb.resolve_safe();
save_item(NAME(m_regs.idx));
@@ -156,7 +156,7 @@ void ad1848_device::dack_w(uint8_t data)
m_drq_cb(CLEAR_LINE);
}
-void ad1848_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(ad1848_device::update_tick)
{
if(!m_play)
return;
diff --git a/src/devices/sound/ad1848.h b/src/devices/sound/ad1848.h
index ad50c964556..1fd354c3427 100644
--- a/src/devices/sound/ad1848.h
+++ b/src/devices/sound/ad1848.h
@@ -24,9 +24,9 @@ public:
protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_add_mconfig(machine_config &config) override;
+ TIMER_CALLBACK_MEMBER(update_tick);
private:
union {
diff --git a/src/devices/sound/aica.cpp b/src/devices/sound/aica.cpp
index 235ce7a5acc..a746f80eae0 100644
--- a/src/devices/sound/aica.cpp
+++ b/src/devices/sound/aica.cpp
@@ -444,9 +444,9 @@ void aica_device::Init()
space().specific(m_DSP.space);
space().cache(m_DSP.cache);
- m_timerA = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(aica_device::timerA_cb), this));
- m_timerB = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(aica_device::timerB_cb), this));
- m_timerC = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(aica_device::timerC_cb), this));
+ m_timerA = timer_alloc(FUNC(aica_device::timerA_cb), this);
+ m_timerB = timer_alloc(FUNC(aica_device::timerB_cb), this);
+ m_timerC = timer_alloc(FUNC(aica_device::timerC_cb), this);
for (i = 0; i < 0x400; ++i)
{
diff --git a/src/devices/sound/asc.cpp b/src/devices/sound/asc.cpp
index aee85be2d45..255d6043dcf 100644
--- a/src/devices/sound/asc.cpp
+++ b/src/devices/sound/asc.cpp
@@ -66,7 +66,7 @@ void asc_device::device_start()
memset(m_regs, 0, sizeof(m_regs));
- m_timer = timer_alloc(0);
+ m_timer = timer_alloc(FUNC(asc_device::delayed_stream_update), this);
save_item(NAME(m_fifo_a_rdptr));
save_item(NAME(m_fifo_b_rdptr));
@@ -104,10 +104,10 @@ void asc_device::device_reset()
}
//-------------------------------------------------
-// device_timer - called when our device timer expires
+// delayed_stream_update -
//-------------------------------------------------
-void asc_device::device_timer(emu_timer &timer, device_timer_id tid, int param)
+TIMER_CALLBACK_MEMBER(asc_device::delayed_stream_update)
{
m_stream->update();
}
diff --git a/src/devices/sound/asc.h b/src/devices/sound/asc.h
index c6293366f1c..591c95d71af 100644
--- a/src/devices/sound/asc.h
+++ b/src/devices/sound/asc.h
@@ -76,10 +76,11 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
+ TIMER_CALLBACK_MEMBER(delayed_stream_update);
+
devcb_write_line write_irq;
sound_stream *m_stream;
diff --git a/src/devices/sound/bsmt2000.cpp b/src/devices/sound/bsmt2000.cpp
index 5ffa2209c66..ee7e4e4ee86 100644
--- a/src/devices/sound/bsmt2000.cpp
+++ b/src/devices/sound/bsmt2000.cpp
@@ -126,6 +126,11 @@ void bsmt2000_device::device_start()
save_item(NAME(m_left_data));
save_item(NAME(m_right_data));
save_item(NAME(m_write_pending));
+
+ // allocate timers
+ m_deferred_reset = timer_alloc(FUNC(bsmt2000_device::deferred_reset), this);
+ m_deferred_reg_write = timer_alloc(FUNC(bsmt2000_device::deferred_reg_write), this);
+ m_deferred_data_write = timer_alloc(FUNC(bsmt2000_device::deferred_data_write), this);
}
@@ -135,41 +140,47 @@ void bsmt2000_device::device_start()
void bsmt2000_device::device_reset()
{
- synchronize(TIMER_ID_RESET);
+ m_deferred_reset->adjust(attotime::zero);
+}
+
+
+
+//-------------------------------------------------
+// deferred_reset -
+//-------------------------------------------------
+
+TIMER_CALLBACK_MEMBER(bsmt2000_device::deferred_reset)
+{
+ m_stream->update();
+ m_cpu->reset();
}
//-------------------------------------------------
-// device_timer - handle deferred writes and
-// resets as a timer callback
+// deferred_reg_write -
//-------------------------------------------------
-void bsmt2000_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(bsmt2000_device::deferred_reg_write)
{
- switch (id)
- {
- // deferred reset
- case TIMER_ID_RESET:
- m_stream->update();
- m_cpu->reset();
- break;
-
- // deferred register write
- case TIMER_ID_REG_WRITE:
- m_register_select = param & 0xffff;
- break;
-
- // deferred data write
- case TIMER_ID_DATA_WRITE:
- m_write_data = param & 0xffff;
- if (m_write_pending) logerror("BSMT2000: Missed data\n");
- m_write_pending = true;
- break;
- }
+ m_register_select = param & 0xffff;
}
+
+//-------------------------------------------------
+// deferred_data_write -
+//-------------------------------------------------
+
+TIMER_CALLBACK_MEMBER(bsmt2000_device::deferred_data_write)
+{
+ m_write_data = param & 0xffff;
+ if (m_write_pending) logerror("BSMT2000: Missed data\n");
+ m_write_pending = true;
+}
+
+
+
//-------------------------------------------------
// sound_stream_update - handle update requests
// for our sound stream
@@ -211,7 +222,7 @@ uint16_t bsmt2000_device::read_status()
void bsmt2000_device::write_reg(uint16_t data)
{
- synchronize(TIMER_ID_REG_WRITE, data);
+ m_deferred_reg_write->adjust(attotime::zero, data);
}
@@ -222,7 +233,7 @@ void bsmt2000_device::write_reg(uint16_t data)
void bsmt2000_device::write_data(uint16_t data)
{
- synchronize(TIMER_ID_DATA_WRITE, data);
+ m_deferred_data_write->adjust(attotime::zero, data);
// boost the interleave on a write so that the caller detects the status more accurately
machine().scheduler().boost_interleave(attotime::from_usec(1), attotime::from_usec(10));
diff --git a/src/devices/sound/bsmt2000.h b/src/devices/sound/bsmt2000.h
index abf084d7ae1..777a06c8ac6 100644
--- a/src/devices/sound/bsmt2000.h
+++ b/src/devices/sound/bsmt2000.h
@@ -50,7 +50,6 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_sound_interface overrides
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
@@ -58,6 +57,10 @@ protected:
// device_rom_interface overrides
virtual void rom_bank_updated() override;
+ TIMER_CALLBACK_MEMBER(deferred_reset);
+ TIMER_CALLBACK_MEMBER(deferred_reg_write);
+ TIMER_CALLBACK_MEMBER(deferred_data_write);
+
public:
// internal TMS I/O callbacks
uint16_t tms_register_r();
@@ -72,7 +75,6 @@ private:
// timers
enum
{
- TIMER_ID_RESET,
TIMER_ID_REG_WRITE,
TIMER_ID_DATA_WRITE
};
@@ -83,13 +85,16 @@ private:
// internal state
sound_stream * m_stream;
required_device<tms32015_device> m_cpu;
- uint16_t m_register_select;
- uint16_t m_write_data;
- uint16_t m_rom_address;
- uint16_t m_rom_bank;
- int16_t m_left_data;
- int16_t m_right_data;
+ uint16_t m_register_select;
+ uint16_t m_write_data;
+ uint16_t m_rom_address;
+ uint16_t m_rom_bank;
+ int16_t m_left_data;
+ int16_t m_right_data;
bool m_write_pending;
+ emu_timer * m_deferred_reset;
+ emu_timer * m_deferred_reg_write;
+ emu_timer * m_deferred_data_write;
DECLARE_READ_LINE_MEMBER( tms_write_pending_r );
};
diff --git a/src/devices/sound/c140.cpp b/src/devices/sound/c140.cpp
index b04a35a0f31..28eea0d508b 100644
--- a/src/devices/sound/c140.cpp
+++ b/src/devices/sound/c140.cpp
@@ -117,7 +117,7 @@ void c140_device::device_start()
m_sample_rate = m_baserate = clock();
m_int1_callback.resolve_safe();
- m_int1_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(c140_device::int1_on), this));
+ m_int1_timer = timer_alloc(FUNC(c140_device::int1_on), this);
m_stream = stream_alloc(0, 2, m_sample_rate);
diff --git a/src/devices/sound/cdp1864.cpp b/src/devices/sound/cdp1864.cpp
index 87b5ea830d0..a3e8f5c037f 100644
--- a/src/devices/sound/cdp1864.cpp
+++ b/src/devices/sound/cdp1864.cpp
@@ -122,10 +122,9 @@ void cdp1864_device::device_start()
m_stream = stream_alloc(0, 1, SAMPLE_RATE_OUTPUT_ADAPTIVE);
// allocate timers
- m_int_timer = timer_alloc(TIMER_INT);
- m_efx_timer = timer_alloc(TIMER_EFX);
- m_dma_timer = timer_alloc(TIMER_DMA);
- m_hsync_timer = timer_alloc(TIMER_HSYNC);
+ m_int_timer = timer_alloc(FUNC(cdp1864_device::int_tick), this);
+ m_efx_timer = timer_alloc(FUNC(cdp1864_device::efx_tick), this);
+ m_dma_timer = timer_alloc(FUNC(cdp1864_device::dma_tick), this);
// find devices
screen().register_screen_bitmap(m_bitmap);
@@ -163,91 +162,88 @@ void cdp1864_device::device_reset()
//-------------------------------------------------
-// device_timer - handle timer events
+// timer events
//-------------------------------------------------
-void cdp1864_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(cdp1864_device::int_tick)
{
- int scanline = screen().vpos();
-
- switch (id)
+ if (screen().vpos() == SCANLINE_INT_START)
{
- case TIMER_INT:
- if (scanline == SCANLINE_INT_START)
+ if (m_disp)
{
- if (m_disp)
- {
- m_write_int(ASSERT_LINE);
- }
-
- m_int_timer->adjust(screen().time_until_pos(SCANLINE_INT_END, 0));
+ m_write_int(ASSERT_LINE);
}
- else
- {
- if (m_disp)
- {
- m_write_int(CLEAR_LINE);
- }
- m_int_timer->adjust(screen().time_until_pos(SCANLINE_INT_START, 0));
+ m_int_timer->adjust(screen().time_until_pos(SCANLINE_INT_END, 0));
+ }
+ else
+ {
+ if (m_disp)
+ {
+ m_write_int(CLEAR_LINE);
}
+
+ m_int_timer->adjust(screen().time_until_pos(SCANLINE_INT_START, 0));
+ }
+}
+
+TIMER_CALLBACK_MEMBER(cdp1864_device::efx_tick)
+{
+ int scanline = screen().vpos();
+ switch (scanline)
+ {
+ case SCANLINE_EFX_TOP_START:
+ m_write_efx(ASSERT_LINE);
+ m_efx_timer->adjust(screen().time_until_pos(SCANLINE_EFX_TOP_END, 0));
break;
- case TIMER_EFX:
- switch (scanline)
- {
- case SCANLINE_EFX_TOP_START:
- m_write_efx(ASSERT_LINE);
- m_efx_timer->adjust(screen().time_until_pos(SCANLINE_EFX_TOP_END, 0));
- break;
-
- case SCANLINE_EFX_TOP_END:
- m_write_efx(CLEAR_LINE);
- m_efx_timer->adjust(screen().time_until_pos(SCANLINE_EFX_BOTTOM_START, 0));
- break;
-
- case SCANLINE_EFX_BOTTOM_START:
- m_write_efx(ASSERT_LINE);
- m_efx_timer->adjust(screen().time_until_pos(SCANLINE_EFX_BOTTOM_END, 0));
- break;
-
- case SCANLINE_EFX_BOTTOM_END:
- m_write_efx(CLEAR_LINE);
- m_efx_timer->adjust(screen().time_until_pos(SCANLINE_EFX_TOP_START, 0));
- break;
- }
+ case SCANLINE_EFX_TOP_END:
+ m_write_efx(CLEAR_LINE);
+ m_efx_timer->adjust(screen().time_until_pos(SCANLINE_EFX_BOTTOM_START, 0));
+ break;
+
+ case SCANLINE_EFX_BOTTOM_START:
+ m_write_efx(ASSERT_LINE);
+ m_efx_timer->adjust(screen().time_until_pos(SCANLINE_EFX_BOTTOM_END, 0));
+ break;
+
+ case SCANLINE_EFX_BOTTOM_END:
+ m_write_efx(CLEAR_LINE);
+ m_efx_timer->adjust(screen().time_until_pos(SCANLINE_EFX_TOP_START, 0));
break;
+ }
+}
- case TIMER_DMA:
- if (m_dmaout)
+TIMER_CALLBACK_MEMBER(cdp1864_device::dma_tick)
+{
+ int scanline = screen().vpos();
+ if (m_dmaout)
+ {
+ if (m_disp)
{
- if (m_disp)
+ if (scanline >= SCANLINE_DISPLAY_START && scanline < SCANLINE_DISPLAY_END)
{
- if (scanline >= SCANLINE_DISPLAY_START && scanline < SCANLINE_DISPLAY_END)
- {
- m_write_dma_out(CLEAR_LINE);
- }
+ m_write_dma_out(CLEAR_LINE);
}
+ }
- m_dma_timer->adjust(clocks_to_attotime(CDP1864_CYCLES_DMA_WAIT));
+ m_dma_timer->adjust(clocks_to_attotime(CDP1864_CYCLES_DMA_WAIT));
- m_dmaout = 0;
- }
- else
+ m_dmaout = 0;
+ }
+ else
+ {
+ if (m_disp)
{
- if (m_disp)
+ if (scanline >= SCANLINE_DISPLAY_START && scanline < SCANLINE_DISPLAY_END)
{
- if (scanline >= SCANLINE_DISPLAY_START && scanline < SCANLINE_DISPLAY_END)
- {
- m_write_dma_out(ASSERT_LINE);
- }
+ m_write_dma_out(ASSERT_LINE);
}
+ }
- m_dma_timer->adjust(clocks_to_attotime(CDP1864_CYCLES_DMA_ACTIVE));
+ m_dma_timer->adjust(clocks_to_attotime(CDP1864_CYCLES_DMA_ACTIVE));
- m_dmaout = 1;
- }
- break;
+ m_dmaout = 1;
}
}
diff --git a/src/devices/sound/cdp1864.h b/src/devices/sound/cdp1864.h
index db2bd156f3a..8dc1eb04e8e 100644
--- a/src/devices/sound/cdp1864.h
+++ b/src/devices/sound/cdp1864.h
@@ -112,20 +112,15 @@ protected:
virtual void device_config_complete() override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// internal callbacks
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
-private:
- enum
- {
- TIMER_INT,
- TIMER_EFX,
- TIMER_DMA,
- TIMER_HSYNC
- };
+ TIMER_CALLBACK_MEMBER(int_tick);
+ TIMER_CALLBACK_MEMBER(efx_tick);
+ TIMER_CALLBACK_MEMBER(dma_tick);
+private:
void initialize_palette();
static constexpr int bckgnd[4] = { 2, 0, 4, 1 };
@@ -164,7 +159,6 @@ private:
emu_timer *m_int_timer;
emu_timer *m_efx_timer;
emu_timer *m_dma_timer;
- emu_timer *m_hsync_timer;
};
diff --git a/src/devices/sound/cdp1869.cpp b/src/devices/sound/cdp1869.cpp
index ac7533ac316..70e4718f212 100644
--- a/src/devices/sound/cdp1869.cpp
+++ b/src/devices/sound/cdp1869.cpp
@@ -95,14 +95,36 @@ void cdp1869_device::cdp1869(address_map &map)
//**************************************************************************
-// INLINE HELPERS
+// DEVICE FUNCTIONS
//**************************************************************************
//-------------------------------------------------
+// get_rgb - get RGB value
+//-------------------------------------------------
+
+rgb_t cdp1869_device::get_rgb(int i, int c, int l)
+{
+ int luma = 0;
+
+ luma += (l & 4) ? CDP1869_WEIGHT_RED : 0;
+ luma += (l & 1) ? CDP1869_WEIGHT_GREEN : 0;
+ luma += (l & 2) ? CDP1869_WEIGHT_BLUE : 0;
+
+ luma = (luma * 0xff) / 100;
+
+ int const r = (c & 4) ? luma : 0;
+ int const g = (c & 1) ? luma : 0;
+ int const b = (c & 2) ? luma : 0;
+
+ return rgb_t(r, g, b);
+}
+
+
+//-------------------------------------------------
// is_ntsc - is device in NTSC mode
//-------------------------------------------------
-inline bool cdp1869_device::is_ntsc()
+bool cdp1869_device::is_ntsc()
{
return m_read_pal_ntsc() ? false : true;
}
@@ -113,7 +135,7 @@ inline bool cdp1869_device::is_ntsc()
// the given address
//-------------------------------------------------
-inline uint8_t cdp1869_device::read_page_ram_byte(offs_t pma)
+uint8_t cdp1869_device::read_page_ram_byte(offs_t pma)
{
return space().read_byte(pma);
}
@@ -124,7 +146,7 @@ inline uint8_t cdp1869_device::read_page_ram_byte(offs_t pma)
// the given address
//-------------------------------------------------
-inline void cdp1869_device::write_page_ram_byte(offs_t pma, uint8_t data)
+void cdp1869_device::write_page_ram_byte(offs_t pma, uint8_t data)
{
space().write_byte(pma, data);
}
@@ -135,7 +157,7 @@ inline void cdp1869_device::write_page_ram_byte(offs_t pma, uint8_t data)
// the given address
//-------------------------------------------------
-inline uint8_t cdp1869_device::read_char_ram_byte(offs_t pma, offs_t cma, uint8_t pmd)
+uint8_t cdp1869_device::read_char_ram_byte(offs_t pma, offs_t cma, uint8_t pmd)
{
uint8_t data = 0;
@@ -153,7 +175,7 @@ inline uint8_t cdp1869_device::read_char_ram_byte(offs_t pma, offs_t cma, uint8_
// the given address
//-------------------------------------------------
-inline void cdp1869_device::write_char_ram_byte(offs_t pma, offs_t cma, uint8_t pmd, uint8_t data)
+void cdp1869_device::write_char_ram_byte(offs_t pma, offs_t cma, uint8_t pmd, uint8_t data)
{
if (!m_out_char_ram_func.isnull())
{
@@ -166,7 +188,7 @@ inline void cdp1869_device::write_char_ram_byte(offs_t pma, offs_t cma, uint8_t
// read_pcb - read page control bit
//-------------------------------------------------
-inline int cdp1869_device::read_pcb(offs_t pma, offs_t cma, uint8_t pmd)
+int cdp1869_device::read_pcb(offs_t pma, offs_t cma, uint8_t pmd)
{
int pcb = 0;
@@ -183,7 +205,7 @@ inline int cdp1869_device::read_pcb(offs_t pma, offs_t cma, uint8_t pmd)
// update_prd_changed_timer -
//-------------------------------------------------
-inline void cdp1869_device::update_prd_changed_timer()
+void cdp1869_device::update_prd_changed_timer()
{
int start = SCANLINE_PREDISPLAY_START_PAL;
int end = SCANLINE_PREDISPLAY_END_PAL;
@@ -224,32 +246,10 @@ inline void cdp1869_device::update_prd_changed_timer()
//-------------------------------------------------
-// get_rgb - get RGB value
-//-------------------------------------------------
-
-inline rgb_t cdp1869_device::get_rgb(int i, int c, int l)
-{
- int luma = 0;
-
- luma += (l & 4) ? CDP1869_WEIGHT_RED : 0;
- luma += (l & 1) ? CDP1869_WEIGHT_GREEN : 0;
- luma += (l & 2) ? CDP1869_WEIGHT_BLUE : 0;
-
- luma = (luma * 0xff) / 100;
-
- int const r = (c & 4) ? luma : 0;
- int const g = (c & 1) ? luma : 0;
- int const b = (c & 2) ? luma : 0;
-
- return rgb_t(r, g, b);
-}
-
-
-//-------------------------------------------------
// get_lines - get number of character lines
//-------------------------------------------------
-inline int cdp1869_device::get_lines()
+int cdp1869_device::get_lines()
{
if (m_line16 && !m_dblpage)
{
@@ -270,7 +270,7 @@ inline int cdp1869_device::get_lines()
// get_pmemsize - get page memory size
//-------------------------------------------------
-inline uint16_t cdp1869_device::get_pmemsize(int cols, int rows)
+uint16_t cdp1869_device::get_pmemsize(int cols, int rows)
{
int pmemsize = cols * rows;
@@ -285,7 +285,7 @@ inline uint16_t cdp1869_device::get_pmemsize(int cols, int rows)
// get_pma - get page memory address
//-------------------------------------------------
-inline uint16_t cdp1869_device::get_pma()
+uint16_t cdp1869_device::get_pma()
{
if (m_dblpage)
{
@@ -302,7 +302,7 @@ inline uint16_t cdp1869_device::get_pma()
// get_pen - get pen for color bits
//-------------------------------------------------
-inline int cdp1869_device::get_pen(int ccb0, int ccb1, int pcb)
+int cdp1869_device::get_pen(int ccb0, int ccb1, int pcb)
{
int r = 0, g = 0, b = 0;
@@ -392,7 +392,7 @@ void cdp1869_device::device_start()
m_out_char_ram_func.resolve();
// allocate timers
- m_prd_timer = timer_alloc();
+ m_prd_timer = timer_alloc(FUNC(cdp1869_device::prd_update), this);
m_dispoff = 0;
update_prd_changed_timer();
@@ -456,10 +456,10 @@ void cdp1869_device::device_post_load()
//-------------------------------------------------
-// device_timer - handler timer events
+// prd_update -
//-------------------------------------------------
-void cdp1869_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(cdp1869_device::prd_update)
{
m_write_prd(param);
m_prd = param;
diff --git a/src/devices/sound/cdp1869.h b/src/devices/sound/cdp1869.h
index e40a9705333..6ce373a6931 100644
--- a/src/devices/sound/cdp1869.h
+++ b/src/devices/sound/cdp1869.h
@@ -210,7 +210,6 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_post_load() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_memory_interface overrides
virtual space_config_vector memory_space_config() const override;
@@ -218,18 +217,21 @@ protected:
// device_sound_interface callbacks
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
- inline bool is_ntsc();
- inline uint8_t read_page_ram_byte(offs_t address);
- inline void write_page_ram_byte(offs_t address, uint8_t data);
- inline uint8_t read_char_ram_byte(offs_t pma, offs_t cma, uint8_t pmd);
- inline void write_char_ram_byte(offs_t pma, offs_t cma, uint8_t pmd, uint8_t data);
- inline int read_pcb(offs_t pma, offs_t cma, uint8_t pmd);
- inline void update_prd_changed_timer();
+ TIMER_CALLBACK_MEMBER(prd_update);
+
static rgb_t get_rgb(int i, int c, int l);
- inline int get_lines();
- inline uint16_t get_pmemsize(int cols, int rows);
- inline uint16_t get_pma();
- inline int get_pen(int ccb0, int ccb1, int pcb);
+
+ bool is_ntsc();
+ uint8_t read_page_ram_byte(offs_t address);
+ void write_page_ram_byte(offs_t address, uint8_t data);
+ uint8_t read_char_ram_byte(offs_t pma, offs_t cma, uint8_t pmd);
+ void write_char_ram_byte(offs_t pma, offs_t cma, uint8_t pmd, uint8_t data);
+ int read_pcb(offs_t pma, offs_t cma, uint8_t pmd);
+ void update_prd_changed_timer();
+ int get_lines();
+ uint16_t get_pmemsize(int cols, int rows);
+ uint16_t get_pma();
+ int get_pen(int ccb0, int ccb1, int pcb);
void draw_line(bitmap_rgb32 &bitmap, const rectangle &rect, int x, int y, uint8_t data, int color);
void draw_char(bitmap_rgb32 &bitmap, const rectangle &rect, int x, int y, uint16_t pma);
diff --git a/src/devices/sound/dave.cpp b/src/devices/sound/dave.cpp
index 8a7386e640b..44719ab4584 100644
--- a/src/devices/sound/dave.cpp
+++ b/src/devices/sound/dave.cpp
@@ -83,10 +83,10 @@ void dave_device::device_start()
m_write_rh.resolve_safe();
// allocate timers
- m_timer_1hz = timer_alloc(TIMER_1HZ);
+ m_timer_1hz = timer_alloc(FUNC(dave_device::update_1hz_timer), this);
m_timer_1hz->adjust(attotime::from_hz(2), 0, attotime::from_hz(2));
- m_timer_50hz = timer_alloc(TIMER_50HZ);
+ m_timer_50hz = timer_alloc(FUNC(dave_device::update_50hz_timer), this);
m_timer_50hz->adjust(attotime::from_hz(2000), 0, attotime::from_hz(2000));
// state saving
@@ -146,27 +146,30 @@ void dave_device::device_reset()
//-------------------------------------------------
-// device_timer - handler timer events
+// update_1hz_timer -
//-------------------------------------------------
-void dave_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(dave_device::update_1hz_timer)
{
- switch (id)
- {
- case TIMER_1HZ:
- m_irq_status ^= IRQ_1HZ_DIVIDER;
+ m_irq_status ^= IRQ_1HZ_DIVIDER;
- if (m_irq_status & IRQ_1HZ_DIVIDER)
- m_irq_status |= IRQ_1HZ_LATCH;
- break;
+ if (m_irq_status & IRQ_1HZ_DIVIDER)
+ m_irq_status |= IRQ_1HZ_LATCH;
- case TIMER_50HZ:
- m_irq_status ^= IRQ_50HZ_DIVIDER;
+ update_interrupt();
+}
- if (m_irq_status & IRQ_50HZ_DIVIDER)
- m_irq_status |= IRQ_50HZ_LATCH;
- break;
- }
+
+//-------------------------------------------------
+// update_50hz_timer -
+//-------------------------------------------------
+
+TIMER_CALLBACK_MEMBER(dave_device::update_50hz_timer)
+{
+ m_irq_status ^= IRQ_50HZ_DIVIDER;
+
+ if (m_irq_status & IRQ_50HZ_DIVIDER)
+ m_irq_status |= IRQ_50HZ_LATCH;
update_interrupt();
}
diff --git a/src/devices/sound/dave.h b/src/devices/sound/dave.h
index 7a6a521738f..82c024f748e 100644
--- a/src/devices/sound/dave.h
+++ b/src/devices/sound/dave.h
@@ -41,7 +41,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_memory_interface overrides
virtual space_config_vector memory_space_config() const override;
@@ -49,6 +48,9 @@ protected:
// sound stream update overrides
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
+ TIMER_CALLBACK_MEMBER(update_1hz_timer);
+ TIMER_CALLBACK_MEMBER(update_50hz_timer);
+
uint8_t program_r(offs_t offset);
void program_w(offs_t offset, uint8_t data);
@@ -58,12 +60,6 @@ protected:
private:
enum
{
- TIMER_1HZ,
- TIMER_50HZ
- };
-
- enum
- {
IRQ_50HZ_DIVIDER = 0x01,
IRQ_50HZ_LATCH = 0x02,
IRQ_1HZ_DIVIDER = 0x04,
diff --git a/src/devices/sound/es1373.cpp b/src/devices/sound/es1373.cpp
index d6baac9ad01..d254527b0bc 100644
--- a/src/devices/sound/es1373.cpp
+++ b/src/devices/sound/es1373.cpp
@@ -122,7 +122,7 @@ void es1373_device::device_start()
// create the stream
m_stream = stream_alloc(0, 2, 44100/2);
- m_timer = timer_alloc(0);
+ m_timer = timer_alloc(FUNC(es1373_device::delayed_stream_update), this);
m_timer->adjust(attotime::zero, 0, attotime::from_hz(44100/2/16));
// Save states
@@ -222,9 +222,9 @@ void es1373_device::map_extra(uint64_t memory_window_start, uint64_t memory_wind
}
//-------------------------------------------------
-// device_timer - called when our device timer expires
+// delayed_stream_update -
//-------------------------------------------------
-void es1373_device::device_timer(emu_timer &timer, device_timer_id tid, int param)
+TIMER_CALLBACK_MEMBER(es1373_device::delayed_stream_update)
{
m_stream->update();
}
diff --git a/src/devices/sound/es1373.h b/src/devices/sound/es1373.h
index ba246a05535..6d493391ae4 100644
--- a/src/devices/sound/es1373.h
+++ b/src/devices/sound/es1373.h
@@ -26,11 +26,12 @@ protected:
virtual void device_start() override;
virtual void device_stop() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_post_load() override;
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
+ TIMER_CALLBACK_MEMBER(delayed_stream_update);
+
// Sound stream
sound_stream *m_stream;
diff --git a/src/devices/sound/es5503.cpp b/src/devices/sound/es5503.cpp
index 365254301b6..50bef4568d2 100644
--- a/src/devices/sound/es5503.cpp
+++ b/src/devices/sound/es5503.cpp
@@ -67,10 +67,10 @@ es5503_device::es5503_device(const machine_config &mconfig, const char *tag, dev
//-------------------------------------------------
-// device_timer - called when our device timer expires
+// delayed_stream_update -
//-------------------------------------------------
-void es5503_device::device_timer(emu_timer &timer, device_timer_id tid, int param)
+TIMER_CALLBACK_MEMBER(es5503_device::delayed_stream_update)
{
m_stream->update();
}
@@ -235,7 +235,7 @@ void es5503_device::device_start()
output_rate = (clock() / 8) / (oscsenabled + 2);
m_stream = stream_alloc(0, output_channels, output_rate);
- m_timer = timer_alloc(0);
+ m_timer = timer_alloc(FUNC(es5503_device::delayed_stream_update), this);
}
void es5503_device::device_clock_changed()
diff --git a/src/devices/sound/es5503.h b/src/devices/sound/es5503.h
index fde389ef250..153e0a79fe1 100644
--- a/src/devices/sound/es5503.h
+++ b/src/devices/sound/es5503.h
@@ -33,7 +33,6 @@ protected:
virtual void device_start() override;
virtual void device_clock_changed() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id tid, int param) override;
// device_sound_interface overrides
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
@@ -41,6 +40,8 @@ protected:
// device_rom_interface overrides
virtual void rom_bank_updated() override;
+ TIMER_CALLBACK_MEMBER(delayed_stream_update);
+
sound_stream *m_stream;
devcb_write_line m_irq_func;
diff --git a/src/devices/sound/gb.cpp b/src/devices/sound/gb.cpp
index a139b72ca3e..643ecf9ec68 100644
--- a/src/devices/sound/gb.cpp
+++ b/src/devices/sound/gb.cpp
@@ -143,7 +143,7 @@ cgb04_apu_device::cgb04_apu_device(const machine_config &mconfig, const char *ta
void gameboy_sound_device::device_start()
{
m_channel = stream_alloc(0, 2, SAMPLE_RATE_OUTPUT_ADAPTIVE);
- m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gameboy_sound_device::timer_callback),this));
+ m_timer = timer_alloc(FUNC(gameboy_sound_device::timer_callback), this);
m_timer->adjust(clocks_to_attotime(FRAME_CYCLES/128), 0, clocks_to_attotime(FRAME_CYCLES/128));
save_item(NAME(m_last_updated));
diff --git a/src/devices/sound/huc6230.cpp b/src/devices/sound/huc6230.cpp
index ed297c36cf8..d257572f79e 100644
--- a/src/devices/sound/huc6230.cpp
+++ b/src/devices/sound/huc6230.cpp
@@ -181,7 +181,7 @@ void huc6230_device::device_start()
m_vca_cb.resolve_safe();
m_stream = stream_alloc(2, 2, clock() / 6);
- m_adpcm_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(huc6230_device::adpcm_timer),this));
+ m_adpcm_timer = timer_alloc(FUNC(huc6230_device::adpcm_timer), this);
for (int i = 0; i < 2; i++)
{
diff --git a/src/devices/sound/ics2115.cpp b/src/devices/sound/ics2115.cpp
index 9eca1102f88..4b9f1ef152b 100644
--- a/src/devices/sound/ics2115.cpp
+++ b/src/devices/sound/ics2115.cpp
@@ -59,8 +59,8 @@ void ics2115_device::device_start()
space(0).cache(m_cache);
- m_timer[0].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ics2115_device::timer_cb_0),this));
- m_timer[1].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ics2115_device::timer_cb_1),this));
+ m_timer[0].timer = timer_alloc(FUNC(ics2115_device::timer_cb_0), this);
+ m_timer[1].timer = timer_alloc(FUNC(ics2115_device::timer_cb_1), this);
m_stream = stream_alloc(0, 2, clock() / (32 * 32));
m_irq_cb.resolve_safe();
diff --git a/src/devices/sound/iopspu.cpp b/src/devices/sound/iopspu.cpp
index b2599eae2cd..55e6cd3b789 100644
--- a/src/devices/sound/iopspu.cpp
+++ b/src/devices/sound/iopspu.cpp
@@ -31,10 +31,10 @@ void iop_spu_device::device_start()
m_ram = std::make_unique<uint16_t[]>(2 * 1024 * 1024); // ?
if (!m_core[0].m_autodma_done_timer_hack)
- m_core[0].m_autodma_done_timer_hack = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(iop_spu_device::autodma_done_timer_hack), this));
+ m_core[0].m_autodma_done_timer_hack = timer_alloc(FUNC(iop_spu_device::autodma_done_timer_hack), this);
if (!m_core[1].m_autodma_done_timer_hack)
- m_core[1].m_autodma_done_timer_hack = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(iop_spu_device::autodma_done_timer_hack), this));
+ m_core[1].m_autodma_done_timer_hack = timer_alloc(FUNC(iop_spu_device::autodma_done_timer_hack), this);
save_item(NAME(m_core[0].m_status));
save_item(NAME(m_core[0].m_start_port_addr));
diff --git a/src/devices/sound/k053260.cpp b/src/devices/sound/k053260.cpp
index b2e1e6cb0a0..9a85fa97811 100644
--- a/src/devices/sound/k053260.cpp
+++ b/src/devices/sound/k053260.cpp
@@ -126,7 +126,7 @@ void k053260_device::device_start()
for (int i = 0; i < 4; i++)
m_voice[i].voice_start(i);
- m_timer = timer_alloc(0);
+ m_timer = timer_alloc(FUNC(k053260_device::update_state_outputs), this);
}
@@ -164,7 +164,7 @@ void k053260_device::rom_bank_updated()
}
-void k053260_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(k053260_device::update_state_outputs)
{
switch(m_timer_state) {
case 0: m_sh1_cb(ASSERT_LINE); break;
diff --git a/src/devices/sound/k053260.h b/src/devices/sound/k053260.h
index dc8d918117e..401d3d2e34f 100644
--- a/src/devices/sound/k053260.h
+++ b/src/devices/sound/k053260.h
@@ -39,7 +39,6 @@ protected:
virtual void device_start() override;
virtual void device_clock_changed() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// sound stream update overrides
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
@@ -47,6 +46,8 @@ protected:
// device_rom_interface overrides
virtual void rom_bank_updated() override;
+ TIMER_CALLBACK_MEMBER(update_state_outputs);
+
private:
// Pan multipliers
static const int pan_mul[8][2];
diff --git a/src/devices/sound/k054539.cpp b/src/devices/sound/k054539.cpp
index b30dbcbc724..ae0ac92e310 100644
--- a/src/devices/sound/k054539.cpp
+++ b/src/devices/sound/k054539.cpp
@@ -307,7 +307,7 @@ void k054539_device::sound_stream_update(sound_stream &stream, std::vector<read_
}
-void k054539_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(k054539_device::call_timer_handler)
{
if (regs[0x22f] & 0x20)
m_timer_handler(m_timer_state ^= 1);
@@ -507,7 +507,7 @@ u8 k054539_device::read(offs_t offset)
void k054539_device::device_start()
{
- m_timer = timer_alloc(0);
+ m_timer = timer_alloc(FUNC(k054539_device::call_timer_handler), this);
// resolve / bind callbacks
m_timer_handler.resolve_safe();
diff --git a/src/devices/sound/k054539.h b/src/devices/sound/k054539.h
index c58f6021af3..406836af65a 100644
--- a/src/devices/sound/k054539.h
+++ b/src/devices/sound/k054539.h
@@ -64,7 +64,6 @@ protected:
virtual void device_clock_changed() override;
virtual void device_reset() override;
virtual void device_post_load() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_sound_interface overrides
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
@@ -72,6 +71,8 @@ protected:
// device_rom_interface overrides
virtual void rom_bank_updated() override;
+ TIMER_CALLBACK_MEMBER(call_timer_handler);
+
private:
struct channel {
uint32_t pos;
diff --git a/src/devices/sound/ks0164.cpp b/src/devices/sound/ks0164.cpp
index 99cb75ab878..f5c3c4d02e9 100644
--- a/src/devices/sound/ks0164.cpp
+++ b/src/devices/sound/ks0164.cpp
@@ -54,7 +54,7 @@ void ks0164_device::device_start()
m_stream = stream_alloc(0, 2, clock()/3/2/2/32);
space().cache(m_mem_cache);
- m_timer = timer_alloc(0);
+ m_timer = timer_alloc(FUNC(ks0164_device::irq_timer_tick), this);
m_midi_tx.resolve_safe();
@@ -98,7 +98,7 @@ void ks0164_device::device_reset()
m_timer->adjust(attotime::from_msec(1), 0, attotime::from_msec(1));
}
-void ks0164_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(ks0164_device::irq_timer_tick)
{
m_timer_interrupt = true;
if(m_irqen_76 & 0x40)
diff --git a/src/devices/sound/ks0164.h b/src/devices/sound/ks0164.h
index 6024ae62669..208176c6e2e 100644
--- a/src/devices/sound/ks0164.h
+++ b/src/devices/sound/ks0164.h
@@ -30,12 +30,13 @@ protected:
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
virtual void device_add_mconfig(machine_config &config) override;
virtual space_config_vector memory_space_config() const override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void tra_callback() override;
virtual void tra_complete() override;
virtual void rcv_complete() override;
+ TIMER_CALLBACK_MEMBER(irq_timer_tick);
+
private:
enum {
MPUS_RX_FULL = 0x01,
diff --git a/src/devices/sound/mea8000.cpp b/src/devices/sound/mea8000.cpp
index 3cf2ad51a6e..e557d046db4 100644
--- a/src/devices/sound/mea8000.cpp
+++ b/src/devices/sound/mea8000.cpp
@@ -137,7 +137,7 @@ void mea8000_device::device_start()
m_stream = stream_alloc(0, 1, clock() / 60);
save_item(NAME(m_output));
- m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mea8000_device::timer_expire),this));
+ m_timer = timer_alloc(FUNC(mea8000_device::timer_expire), this);
save_item(NAME(m_state));
save_item(NAME(m_buf));
diff --git a/src/devices/sound/mm5837.cpp b/src/devices/sound/mm5837.cpp
index b9125b5c616..ae6687655f3 100644
--- a/src/devices/sound/mm5837.cpp
+++ b/src/devices/sound/mm5837.cpp
@@ -47,7 +47,7 @@ void mm5837_device::device_start()
m_output_cb.resolve_safe();
// get timer
- m_timer = timer_alloc(0);
+ m_timer = timer_alloc(FUNC(mm5837_device::update_clock_output), this);
// register for save states
save_item(NAME(m_source.m_shift));
@@ -70,10 +70,10 @@ void mm5837_device::device_reset()
//-------------------------------------------------
-// device_timer - handle timer callbacks
+// update_clock_output -
//-------------------------------------------------
-void mm5837_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(mm5837_device::update_clock_output)
{
m_output_cb(m_source.clock());
}
diff --git a/src/devices/sound/mm5837.h b/src/devices/sound/mm5837.h
index 21d37596c45..df76f6171fd 100644
--- a/src/devices/sound/mm5837.h
+++ b/src/devices/sound/mm5837.h
@@ -168,7 +168,8 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(update_clock_output);
private:
// internal state
diff --git a/src/devices/sound/mos6560.cpp b/src/devices/sound/mos6560.cpp
index 1a007c80693..bd35429c31c 100644
--- a/src/devices/sound/mos6560.cpp
+++ b/src/devices/sound/mos6560.cpp
@@ -459,7 +459,7 @@ uint8_t mos6560_device::bus_r()
mos6560_raster_interrupt_gen
-------------------------------------------------*/
-void mos6560_device::raster_interrupt_gen()
+TIMER_CALLBACK_MEMBER(mos6560_device::raster_interrupt_gen)
{
m_rasterline++;
if (m_rasterline >= m_total_lines)
@@ -760,7 +760,7 @@ void mos6560_device::device_start()
}
// allocate timers
- m_line_timer = timer_alloc(TIMER_LINE);
+ m_line_timer = timer_alloc(FUNC(mos6560_device::raster_interrupt_gen), this);
m_line_timer->adjust(screen().scan_period(), 0, screen().scan_period());
// initialize sound
@@ -862,20 +862,6 @@ void mos6560_device::device_reset()
//-------------------------------------------------
-// device_timer - handler timer events
-//-------------------------------------------------
-
-void mos6560_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_LINE:
- raster_interrupt_gen();
- break;
- }
-}
-
-//-------------------------------------------------
// sound_stream_update - handle a stream update
//-------------------------------------------------
diff --git a/src/devices/sound/mos6560.h b/src/devices/sound/mos6560.h
index eb902f5471e..fa950450389 100644
--- a/src/devices/sound/mos6560.h
+++ b/src/devices/sound/mos6560.h
@@ -121,7 +121,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// sound stream update overrides
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
@@ -134,7 +133,7 @@ protected:
void drawlines( int first, int last );
void soundport_w( int offset, int data );
void sound_start();
- void raster_interrupt_gen();
+ TIMER_CALLBACK_MEMBER(raster_interrupt_gen);
const int m_variant;
diff --git a/src/devices/sound/mos7360.cpp b/src/devices/sound/mos7360.cpp
index c4749b2fb9b..c76e1d8adb7 100644
--- a/src/devices/sound/mos7360.cpp
+++ b/src/devices/sound/mos7360.cpp
@@ -285,12 +285,12 @@ void mos7360_device::device_start()
m_read_k.resolve_safe(0xff);
// allocate timers
- m_timer1 = timer_alloc(TIMER_ID_1);
- m_timer2 = timer_alloc(TIMER_ID_2);
- m_timer3 = timer_alloc(TIMER_ID_3);
- m_line_timer = timer_alloc(TIMER_LINE);
+ m_timer[TIMER_ID_1] = timer_alloc(FUNC(mos7360_device::timer_expired), this);
+ m_timer[TIMER_ID_2] = timer_alloc(FUNC(mos7360_device::timer_expired), this);
+ m_timer[TIMER_ID_3] = timer_alloc(FUNC(mos7360_device::timer_expired), this);
+ m_line_timer = timer_alloc(FUNC(mos7360_device::raster_interrupt_gen), this);
m_line_timer->adjust(screen().scan_period(), 0, screen().scan_period());
- m_frame_timer = timer_alloc(TIMER_FRAME);
+ m_frame_timer = timer_alloc(FUNC(mos7360_device::frame_interrupt_gen), this);
m_frame_timer->adjust(screen().frame_period(), 0, screen().frame_period());
// allocate screen bitmap
@@ -340,9 +340,7 @@ void mos7360_device::device_start()
save_item(NAME(m_rom));
save_item(NAME(m_frame_count));
save_item(NAME(m_lines));
- save_item(NAME(m_timer1_active));
- save_item(NAME(m_timer2_active));
- save_item(NAME(m_timer3_active));
+ save_item(NAME(m_timer_active));
save_item(NAME(m_cursor1));
save_item(NAME(m_chargenaddr));
save_item(NAME(m_bitmapaddr));
@@ -382,8 +380,10 @@ void mos7360_device::device_reset()
m_rom = 1; // FIXME: at start should be RAM or ROM? old c16 code set it to ROM at init: is it correct?
m_lines = TED7360_LINES;
- m_chargenaddr = m_bitmapaddr = m_videoaddr = 0;
- m_timer1_active = m_timer2_active = m_timer3_active = 0;
+ m_chargenaddr = 0;
+ m_bitmapaddr = 0;
+ m_videoaddr = 0;
+ std::fill(std::begin(m_timer_active), std::end(m_timer_active), false);
m_cursor1 = 0;
m_rasterline = 0;
@@ -416,40 +416,25 @@ void mos7360_device::device_reset()
//-------------------------------------------------
-// device_timer - handler timer events
+// timer_expired -
//-------------------------------------------------
-void mos7360_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(mos7360_device::timer_expired)
{
- switch (id)
- {
- case TIMER_ID_1:
- // proved by digisound of several intros like eoroidpro
- m_timer1->adjust(clocks_to_attotime(TIMER1), 1);
- m_timer1_active = 1;
- set_interrupt(0x08);
- break;
-
- case TIMER_ID_2:
- m_timer2->adjust(clocks_to_attotime(0x10000), 2);
- m_timer2_active = 1;
- set_interrupt(0x10);
- break;
-
- case TIMER_ID_3:
- m_timer3->adjust(clocks_to_attotime(0x10000), 3);
- m_timer3_active = 1;
- set_interrupt(0x40);
- break;
-
- case TIMER_LINE:
- raster_interrupt_gen();
- break;
+ static const uint8_t s_irq_values[3] = { 0x08, 0x10, 0x40 };
- case TIMER_FRAME:
- frame_interrupt_gen();
- break;
+ if (param == TIMER_ID_1)
+ {
+ // proven by digital sound of several intros like eoroidpro
+ m_timer[param]->adjust(clocks_to_attotime(TIMER1), param);
}
+ else
+ {
+ m_timer[param]->adjust(clocks_to_attotime(0x10000), param);
+ }
+
+ m_timer_active[param] = true;
+ set_interrupt(s_irq_values[param]);
}
@@ -825,22 +810,22 @@ uint8_t mos7360_device::read(offs_t offset, int &cs0, int &cs1)
switch (offset)
{
case 0xff00:
- val = attotime_to_clocks(m_timer1->remaining()) & 0xff;
+ val = attotime_to_clocks(m_timer[0]->remaining()) & 0xff;
break;
case 0xff01:
- val = attotime_to_clocks(m_timer1->remaining()) >> 8;
+ val = attotime_to_clocks(m_timer[0]->remaining()) >> 8;
break;
case 0xff02:
- val = attotime_to_clocks(m_timer2->remaining()) & 0xff;
+ val = attotime_to_clocks(m_timer[1]->remaining()) & 0xff;
break;
case 0xff03:
- val = attotime_to_clocks(m_timer2->remaining()) >> 8;
+ val = attotime_to_clocks(m_timer[1]->remaining()) >> 8;
break;
case 0xff04:
- val = attotime_to_clocks(m_timer3->remaining()) & 0xff;
+ val = attotime_to_clocks(m_timer[2]->remaining()) & 0xff;
break;
case 0xff05:
- val = attotime_to_clocks(m_timer3->remaining()) >> 8;
+ val = attotime_to_clocks(m_timer[2]->remaining()) >> 8;
break;
case 0xff07:
val = (m_reg[offset & 0x1f] & ~0x40);
@@ -922,45 +907,45 @@ void mos7360_device::write(offs_t offset, uint8_t data, int &cs0, int &cs1)
case 0xff00: /* stop timer 1 */
m_reg[offset & 0x1f] = data;
- if (m_timer1_active)
+ if (m_timer_active[0])
{
- m_reg[1] = attotime_to_clocks(m_timer1->remaining()) >> 8;
- m_timer1->reset();
- m_timer1_active = 0;
+ m_reg[1] = attotime_to_clocks(m_timer[0]->remaining()) >> 8;
+ m_timer[0]->reset();
+ m_timer_active[0] = false;
}
break;
case 0xff01: /* start timer 1 */
m_reg[offset & 0x1f] = data;
- m_timer1->adjust(clocks_to_attotime(TIMER1), 1);
- m_timer1_active = 1;
+ m_timer[0]->adjust(clocks_to_attotime(TIMER1), TIMER_ID_1);
+ m_timer_active[0] = true;
break;
case 0xff02: /* stop timer 2 */
m_reg[offset & 0x1f] = data;
- if (m_timer2_active)
+ if (m_timer_active[1])
{
- m_reg[3] = attotime_to_clocks(m_timer2->remaining()) >> 8;
- m_timer2->reset();
- m_timer2_active = 0;
+ m_reg[3] = attotime_to_clocks(m_timer[1]->remaining()) >> 8;
+ m_timer[1]->reset();
+ m_timer_active[1] = false;
}
break;
case 0xff03: /* start timer 2 */
m_reg[offset & 0x1f] = data;
- m_timer2->adjust(clocks_to_attotime(TIMER2), 2);
- m_timer2_active = 1;
+ m_timer[1]->adjust(clocks_to_attotime(TIMER2), TIMER_ID_2);
+ m_timer_active[1] = true;
break;
case 0xff04: /* stop timer 3 */
m_reg[offset & 0x1f] = data;
- if (m_timer3_active)
+ if (m_timer_active[2])
{
- m_reg[5] = attotime_to_clocks(m_timer3->remaining()) >> 8;
- m_timer3->reset();
- m_timer3_active = 0;
+ m_reg[5] = attotime_to_clocks(m_timer[2]->remaining()) >> 8;
+ m_timer[2]->reset();
+ m_timer_active[2] = false;
}
break;
case 0xff05: /* start timer 3 */
m_reg[offset & 0x1f] = data;
- m_timer3->adjust(clocks_to_attotime(TIMER3), 3);
- m_timer3_active = 1;
+ m_timer[2]->adjust(clocks_to_attotime(TIMER3), TIMER_ID_2);
+ m_timer_active[2] = true;
break;
case 0xff06:
if (m_reg[offset & 0x1f] != data)
@@ -1145,7 +1130,7 @@ uint32_t mos7360_device::screen_update(screen_device &screen, bitmap_rgb32 &bitm
return 0;
}
-void mos7360_device::frame_interrupt_gen()
+TIMER_CALLBACK_MEMBER(mos7360_device::frame_interrupt_gen)
{
if ((m_reg[0x1f] & 0xf) >= 0x0f)
{
@@ -1158,7 +1143,7 @@ void mos7360_device::frame_interrupt_gen()
m_reg[0x1f]++;
}
-void mos7360_device::raster_interrupt_gen()
+TIMER_CALLBACK_MEMBER(mos7360_device::raster_interrupt_gen)
{
m_rasterline++;
m_rastertime = machine().time().as_double();
diff --git a/src/devices/sound/mos7360.h b/src/devices/sound/mos7360.h
index c34dd2036f4..fd0a51f597b 100644
--- a/src/devices/sound/mos7360.h
+++ b/src/devices/sound/mos7360.h
@@ -99,15 +99,12 @@ protected:
{
TIMER_ID_1,
TIMER_ID_2,
- TIMER_ID_3,
- TIMER_LINE,
- TIMER_FRAME
+ TIMER_ID_3
};
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_sound_interface callbacks
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
@@ -125,8 +122,9 @@ protected:
void draw_cursor(int ybegin, int yend, int yoff, int xoff, int color);
void drawlines(int first, int last);
void soundport_w(int offset, int data);
- void frame_interrupt_gen();
- void raster_interrupt_gen();
+ TIMER_CALLBACK_MEMBER(timer_expired);
+ TIMER_CALLBACK_MEMBER(frame_interrupt_gen);
+ TIMER_CALLBACK_MEMBER(raster_interrupt_gen);
int cs0_r(offs_t offset);
int cs1_r(offs_t offset);
@@ -147,16 +145,24 @@ protected:
int m_frame_count;
int m_lines;
- int m_timer1_active, m_timer2_active, m_timer3_active;
- emu_timer *m_timer1, *m_timer2, *m_timer3;
+ bool m_timer_active[3];
+ emu_timer *m_timer[3];
int m_cursor1;
- int m_chargenaddr, m_bitmapaddr, m_videoaddr;
+ int m_chargenaddr;
+ int m_bitmapaddr;
+ int m_videoaddr;
int m_x_begin, m_x_end;
int m_y_begin, m_y_end;
- uint16_t m_c16_bitmap[2], m_bitmapmulti[4], m_mono[2], m_monoinversed[2], m_multi[4], m_ecmcolor[2], m_colors[5];
+ uint16_t m_c16_bitmap[2];
+ uint16_t m_bitmapmulti[4];
+ uint16_t m_mono[2];
+ uint16_t m_monoinversed[2];
+ uint16_t m_multi[4];
+ uint16_t m_ecmcolor[2];
+ uint16_t m_colors[5];
int m_rasterline, m_lastline;
double m_rastertime;
diff --git a/src/devices/sound/msm5205.cpp b/src/devices/sound/msm5205.cpp
index 382e69ca54e..ba196a419a3 100644
--- a/src/devices/sound/msm5205.cpp
+++ b/src/devices/sound/msm5205.cpp
@@ -99,8 +99,8 @@ void msm5205_device::device_start()
/* stream system initialize */
m_stream = stream_alloc(0, 1, clock());
- m_vck_timer = timer_alloc(TIMER_VCK);
- m_capture_timer = timer_alloc(TIMER_ADPCM_CAPTURE);
+ m_vck_timer = timer_alloc(FUNC(msm5205_device::toggle_vck), this);
+ m_capture_timer = timer_alloc(FUNC(msm5205_device::update_adpcm), this);
/* register for save states */
save_item(NAME(m_data));
@@ -172,29 +172,19 @@ void msm5205_device::compute_tables()
//-------------------------------------------------
-// device_timer - called whenever a device timer
-// fires
+// toggle_vck -
//-------------------------------------------------
-void msm5205_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(msm5205_device::toggle_vck)
{
- switch (id)
- {
- case TIMER_VCK:
- m_vck = !m_vck;
- m_vck_cb(m_vck);
- if (!m_vck)
- m_capture_timer->adjust(attotime::from_hz(clock()/6)); // 15.6 usec at 384KHz
- break;
-
- case TIMER_ADPCM_CAPTURE:
- update_adpcm();
- break;
- }
+ m_vck = !m_vck;
+ m_vck_cb(m_vck);
+ if (!m_vck)
+ m_capture_timer->adjust(attotime::from_hz(clock() / adpcm_capture_divisor()));
}
// timer callback at VCK low edge on MSM5205 (at rising edge on MSM6585)
-void msm5205_device::update_adpcm()
+TIMER_CALLBACK_MEMBER(msm5205_device::update_adpcm)
{
int val;
int new_signal;
@@ -226,7 +216,7 @@ void msm5205_device::update_adpcm()
}
/* update when signal changed */
- if( m_signal != new_signal)
+ if (m_signal != new_signal)
{
m_stream->update();
m_signal = new_signal;
@@ -378,29 +368,6 @@ void msm5205_device::sound_stream_update(sound_stream &stream, std::vector<read_
//-------------------------------------------------
-// device_timer - called whenever a device timer
-// fires
-//-------------------------------------------------
-
-void msm6585_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_VCK:
- m_vck = !m_vck;
- m_vck_cb(m_vck);
- if (m_vck)
- m_capture_timer->adjust(attotime::from_hz(clock()/2)); // 3 usec at 640KHz
- break;
-
- case TIMER_ADPCM_CAPTURE:
- update_adpcm();
- break;
- }
-}
-
-
-//-------------------------------------------------
// sound_stream_update - handle a stream update
//-------------------------------------------------
diff --git a/src/devices/sound/msm5205.h b/src/devices/sound/msm5205.h
index 1bbe1f56036..d38fc6e530d 100644
--- a/src/devices/sound/msm5205.h
+++ b/src/devices/sound/msm5205.h
@@ -60,15 +60,16 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_clock_changed() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
- void update_adpcm();
+ TIMER_CALLBACK_MEMBER(toggle_vck);
+ TIMER_CALLBACK_MEMBER(update_adpcm);
// sound stream update overrides
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
void compute_tables();
virtual int get_prescaler() const;
+ virtual double adpcm_capture_divisor() const { return 6.0; }
// internal state
sound_stream *m_stream; // number of stream system
@@ -103,9 +104,7 @@ public:
protected:
virtual int get_prescaler() const override;
-
- // device-level overrides
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ virtual double adpcm_capture_divisor() const override { return 2.0; }
// sound stream update overrides
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
diff --git a/src/devices/sound/pokey.cpp b/src/devices/sound/pokey.cpp
index d90504499a9..d80e17f74d2 100644
--- a/src/devices/sound/pokey.cpp
+++ b/src/devices/sound/pokey.cpp
@@ -180,7 +180,10 @@ pokey_device::pokey_device(const machine_config &mconfig, const char *tag, devic
m_serout_w_cb(*this),
m_keyboard_r(*this),
m_irq_f(*this),
- m_output_type(LEGACY_LINEAR)
+ m_output_type(LEGACY_LINEAR),
+ m_serout_ready_timer(nullptr),
+ m_serout_complete_timer(nullptr),
+ m_serin_ready_timer(nullptr)
{
}
@@ -258,10 +261,9 @@ void pokey_device::device_start()
m_stream = stream_alloc(0, 1, clock());
- timer_alloc(SYNC_WRITE); /* timer for sync operation */
- timer_alloc(SYNC_NOOP);
- timer_alloc(SYNC_POT);
- timer_alloc(SYNC_SET_IRQST);
+ m_serout_ready_timer = timer_alloc(FUNC(pokey_device::serout_ready_irq), this);
+ m_serout_complete_timer = timer_alloc(FUNC(pokey_device::serout_complete_irq), this);
+ m_serin_ready_timer = timer_alloc(FUNC(pokey_device::serin_ready_irq), this);
save_item(STRUCT_MEMBER(m_channel, m_borrow_cnt));
save_item(STRUCT_MEMBER(m_channel, m_counter));
@@ -354,63 +356,57 @@ void pokey_device::device_clock_changed()
}
//-------------------------------------------------
-// stream_generate - handle update requests for
-// our sound stream
+// timer callbacks
//-------------------------------------------------
-void pokey_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(pokey_device::serout_ready_irq)
{
- switch (id)
+ if (m_IRQEN & IRQ_SEROR)
{
- case 3:
- /* serout_ready_cb */
- if (m_IRQEN & IRQ_SEROR)
- {
- m_IRQST |= IRQ_SEROR;
- if (!m_irq_f.isnull())
- m_irq_f(IRQ_SEROR);
- }
- break;
- case 4:
- /* serout_complete */
- if (m_IRQEN & IRQ_SEROC)
- {
- m_IRQST |= IRQ_SEROC;
- if (!m_irq_f.isnull())
- m_irq_f(IRQ_SEROC);
- }
- break;
- case 5:
- /* serin_ready */
- if (m_IRQEN & IRQ_SERIN)
- {
- m_IRQST |= IRQ_SERIN;
- if (!m_irq_f.isnull())
- m_irq_f(IRQ_SERIN);
- }
- break;
- case SYNC_WRITE:
- {
- offs_t offset = (param >> 8) & 0xff;
- uint8_t data = param & 0xff;
- write_internal(offset, data);
- }
- break;
- case SYNC_NOOP:
- /* do nothing, caused by a forced resync */
- break;
- case SYNC_POT:
- //logerror("x %02x \n", (param & 0x20));
- m_ALLPOT |= (param & 0xff);
- break;
- case SYNC_SET_IRQST:
- m_IRQST |= (param & 0xff);
- break;
- default:
- throw emu_fatalerror("Unknown id in pokey_device::device_timer");
+ m_IRQST |= IRQ_SEROR;
+ if (!m_irq_f.isnull())
+ m_irq_f(IRQ_SEROR);
+ }
+}
+
+TIMER_CALLBACK_MEMBER(pokey_device::serout_complete_irq)
+{
+ if (m_IRQEN & IRQ_SEROC)
+ {
+ m_IRQST |= IRQ_SEROC;
+ if (!m_irq_f.isnull())
+ m_irq_f(IRQ_SEROC);
+ }
+}
+
+TIMER_CALLBACK_MEMBER(pokey_device::serin_ready_irq)
+{
+ if (m_IRQEN & IRQ_SERIN)
+ {
+ m_IRQST |= IRQ_SERIN;
+ if (!m_irq_f.isnull())
+ m_irq_f(IRQ_SERIN);
}
}
+TIMER_CALLBACK_MEMBER(pokey_device::sync_write)
+{
+ offs_t offset = (param >> 8) & 0xff;
+ uint8_t data = param & 0xff;
+ write_internal(offset, data);
+}
+
+TIMER_CALLBACK_MEMBER(pokey_device::sync_pot)
+{
+ //logerror("x %02x \n", (param & 0x20));
+ m_ALLPOT |= (param & 0xff);
+}
+
+TIMER_CALLBACK_MEMBER(pokey_device::sync_set_irqst)
+{
+ m_IRQST |= (param & 0xff);
+}
+
void pokey_device::execute_run()
{
do
@@ -531,7 +527,7 @@ void pokey_device::step_pot()
}
// some pots latched?
if (upd != 0)
- synchronize(SYNC_POT, upd);
+ machine().scheduler().synchronize(timer_expired_delegate(FUNC(pokey_device::sync_pot), this), upd);
}
/*
@@ -755,7 +751,7 @@ uint8_t pokey_device::read(offs_t offset)
{
int data, pot;
- synchronize(SYNC_NOOP); /* force resync */
+ machine().scheduler().synchronize(); /* force resync */
switch (offset & 15)
{
@@ -849,7 +845,7 @@ uint8_t pokey_device::read(offs_t offset)
void pokey_device::write(offs_t offset, uint8_t data)
{
- synchronize(SYNC_WRITE, (offset << 8) | data);
+ machine().scheduler().synchronize(timer_expired_delegate(FUNC(pokey_device::sync_write), this), (offset << 8) | data);
}
void pokey_device::write_internal(offs_t offset, uint8_t data)
@@ -946,9 +942,9 @@ void pokey_device::write_internal(offs_t offset, uint8_t data)
* loaders from Ballblazer and Escape from Fractalus
* The real times are unknown
*/
- timer_set(attotime::from_usec(200), 3);
+ m_serout_ready_timer->adjust(attotime::from_usec(200));
/* 10 bits (assumption 1 start, 8 data and 1 stop bit) take how long? */
- timer_set(attotime::from_usec(2000), 4);// FUNC(pokey_serout_complete), 0, p);
+ m_serout_complete_timer->adjust(attotime::from_usec(2000));
break;
case IRQEN_C:
@@ -1023,7 +1019,7 @@ WRITE_LINE_MEMBER( pokey_device::sid_w )
void pokey_device::serin_ready(int after)
{
- timer_set(m_clock_period * after, 5, 0);
+ m_serin_ready_timer->adjust(m_clock_period * after, 0);
}
//-------------------------------------------------
diff --git a/src/devices/sound/pokey.h b/src/devices/sound/pokey.h
index c9d58e18eeb..1a111646df1 100644
--- a/src/devices/sound/pokey.h
+++ b/src/devices/sound/pokey.h
@@ -114,14 +114,6 @@ public:
SKSTAT_C = 0x0F
};
- enum /* sync-operations */
- {
- SYNC_NOOP = 11,
- SYNC_SET_IRQST = 12,
- SYNC_POT = 13,
- SYNC_WRITE = 14
- };
-
enum output_type
{
LEGACY_LINEAR = 0,
@@ -190,7 +182,6 @@ protected:
virtual void device_reset() override;
virtual void device_post_load() override;
virtual void device_clock_changed() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_sound_interface overrides
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
@@ -201,6 +192,13 @@ protected:
// other internal states
int m_icount;
+ TIMER_CALLBACK_MEMBER(serout_ready_irq);
+ TIMER_CALLBACK_MEMBER(serout_complete_irq);
+ TIMER_CALLBACK_MEMBER(serin_ready_irq);
+ TIMER_CALLBACK_MEMBER(sync_write);
+ TIMER_CALLBACK_MEMBER(sync_pot);
+ TIMER_CALLBACK_MEMBER(sync_set_irqst);
+
private:
class pokey_channel
@@ -228,7 +226,7 @@ private:
if (m_parent->m_IRQEN & m_INTMask)
{
/* Exposed state has changed: This should only be updated after a resync ... */
- m_parent->synchronize(SYNC_SET_IRQST, m_INTMask);
+ m_parent->machine().scheduler().synchronize(timer_expired_delegate(FUNC(pokey_device::sync_set_irqst), m_parent), m_INTMask);
}
}
}
@@ -312,6 +310,10 @@ private:
double m_r_pullup;
double m_cap;
double m_v_ref;
+
+ emu_timer *m_serout_ready_timer;
+ emu_timer *m_serout_complete_timer;
+ emu_timer *m_serin_ready_timer;
};
diff --git a/src/devices/sound/qs1000.cpp b/src/devices/sound/qs1000.cpp
index 8a98b85111a..ff45ec51093 100644
--- a/src/devices/sound/qs1000.cpp
+++ b/src/devices/sound/qs1000.cpp
@@ -312,15 +312,6 @@ void qs1000_device::device_reset()
//-------------------------------------------------
-// device_timer - handle deferred writes and
-// resets as a timer callback
-//-------------------------------------------------
-void qs1000_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
-}
-
-
-//-------------------------------------------------
// p0_r
//-------------------------------------------------
uint8_t qs1000_device::p0_r()
diff --git a/src/devices/sound/qs1000.h b/src/devices/sound/qs1000.h
index d992c6a9e7b..2624d893739 100644
--- a/src/devices/sound/qs1000.h
+++ b/src/devices/sound/qs1000.h
@@ -70,7 +70,6 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_sound_interface overrides
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
diff --git a/src/devices/sound/scsp.cpp b/src/devices/sound/scsp.cpp
index 1b9a5a8cb8f..f58907b8611 100644
--- a/src/devices/sound/scsp.cpp
+++ b/src/devices/sound/scsp.cpp
@@ -579,9 +579,9 @@ void scsp_device::init()
m_MidiOutR = m_MidiOutW = 0;
m_DSP.space = &this->space();
- m_timerA = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(scsp_device::timerA_cb), this));
- m_timerB = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(scsp_device::timerB_cb), this));
- m_timerC = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(scsp_device::timerC_cb), this));
+ m_timerA = timer_alloc(FUNC(scsp_device::timerA_cb), this);
+ m_timerB = timer_alloc(FUNC(scsp_device::timerB_cb), this);
+ m_timerC = timer_alloc(FUNC(scsp_device::timerC_cb), this);
for (i = 0; i < 0x400; ++i)
{
diff --git a/src/devices/sound/sn76496.cpp b/src/devices/sound/sn76496.cpp
index e204b0355cb..96c6a3ba789 100644
--- a/src/devices/sound/sn76496.cpp
+++ b/src/devices/sound/sn76496.cpp
@@ -280,7 +280,7 @@ void sn76496_base_device::device_start()
m_ready_state = true;
- m_ready_timer = timer_alloc(0);
+ m_ready_timer = timer_alloc(FUNC(sn76496_base_device::delayed_ready), this);
m_ready_handler(ASSERT_LINE);
register_for_save_states();
@@ -298,7 +298,7 @@ void sn76496_base_device::stereo_w(u8 data)
else fatalerror("sn76496_base_device: Call to stereo write with mono chip!\n");
}
-void sn76496_base_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(sn76496_base_device::delayed_ready)
{
m_ready_state = true;
m_ready_handler(ASSERT_LINE);
diff --git a/src/devices/sound/sn76496.h b/src/devices/sound/sn76496.h
index d8cc4442314..f5484248715 100644
--- a/src/devices/sound/sn76496.h
+++ b/src/devices/sound/sn76496.h
@@ -27,26 +27,16 @@ public:
DECLARE_READ_LINE_MEMBER( ready_r ) { return m_ready_state ? 1 : 0; }
protected:
- sn76496_base_device(
- const machine_config &mconfig,
- device_type type,
- const char *tag,
- int feedbackmask,
- int noisetap1,
- int noisetap2,
- bool negate,
- bool stereo,
- int clockdivider,
- bool ncr,
- bool sega,
- device_t *owner,
- uint32_t clock);
-
- virtual void device_start() override;
- virtual void device_clock_changed() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ sn76496_base_device(const machine_config &mconfig, device_type type, const char *tag,
+ int feedbackmask, int noisetap1, int noisetap2, bool negate, bool stereo, int clockdivider,
+ bool ncr, bool sega, device_t *owner, uint32_t clock);
+
+ virtual void device_start() override;
+ virtual void device_clock_changed() override;
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
+ TIMER_CALLBACK_MEMBER(delayed_ready);
+
private:
inline bool in_noise_mode();
void register_for_save_states();
diff --git a/src/devices/sound/sp0250.cpp b/src/devices/sound/sp0250.cpp
index 6d9ed63ecd3..9544adb3c38 100644
--- a/src/devices/sound/sp0250.cpp
+++ b/src/devices/sound/sp0250.cpp
@@ -25,6 +25,7 @@ DEFINE_DEVICE_TYPE(SP0250, sp0250_device, "sp0250", "GI SP0250 LPC")
sp0250_device::sp0250_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, SP0250, tag, owner, clock),
device_sound_interface(mconfig, *this),
+ m_timer(nullptr),
m_pwm_mode(false),
m_pwm_index(PWM_CLOCKS),
m_pwm_count(0),
@@ -72,7 +73,8 @@ void sp0250_device::device_start()
{
m_drq(ASSERT_LINE);
attotime period = attotime::from_hz(frame_rate);
- timer_alloc()->adjust(period, 0, period);
+ m_timer = timer_alloc(FUNC(sp0250_device::delayed_stream_update), this);
+ m_timer->adjust(period, 0, period);
}
// PWM state
@@ -108,7 +110,7 @@ void sp0250_device::device_reset()
load_values();
}
-void sp0250_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(sp0250_device::delayed_stream_update)
{
m_stream->update();
}
diff --git a/src/devices/sound/sp0250.h b/src/devices/sound/sp0250.h
index 260e77ad695..31c32ef4d5d 100644
--- a/src/devices/sound/sp0250.h
+++ b/src/devices/sound/sp0250.h
@@ -20,11 +20,12 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// sound stream update overrides
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
+ TIMER_CALLBACK_MEMBER(delayed_stream_update);
+
private:
// internal helpers
int8_t next();
@@ -47,6 +48,9 @@ private:
int16_t z1, z2;
};
+ // timer for stream updates
+ emu_timer *m_timer;
+
// PWM state
bool m_pwm_mode;
uint8_t m_pwm_index;
diff --git a/src/devices/sound/sp0256.cpp b/src/devices/sound/sp0256.cpp
index b1219f70cd7..7f709ec90c0 100644
--- a/src/devices/sound/sp0256.cpp
+++ b/src/devices/sound/sp0256.cpp
@@ -106,7 +106,7 @@ void sp0256_device::device_start()
// TODO: because of this, check if the bitrev functions are even used anywhere else
// bitrevbuff(m_rom, 0, 0xffff);
- m_lrq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sp0256_device::set_lrq_timer_proc),this));
+ m_lrq_timer = timer_alloc(FUNC(sp0256_device::set_lrq_timer_proc), this);
// save device variables
save_item(NAME(m_sby_line));
diff --git a/src/devices/sound/tms5110.cpp b/src/devices/sound/tms5110.cpp
index e96a9c6e736..a9d3395a4d2 100644
--- a/src/devices/sound/tms5110.cpp
+++ b/src/devices/sound/tms5110.cpp
@@ -1051,7 +1051,7 @@ void tms5110_device::device_start()
m_stream = stream_alloc(0, 1, clock() / 80);
m_state = CTL_STATE_INPUT; /* most probably not defined */
- m_romclk_hack_timer = timer_alloc(0);
+ m_romclk_hack_timer = timer_alloc(FUNC(tms5110_device::romclk_hack_toggle), this);
register_for_save_states();
}
@@ -1187,17 +1187,15 @@ uint8_t m58817_device::status_r()
return (TALK_STATUS() << 0); /*CTL1 = still talking ? */
}
-/******************************************************************************
-
- tms5110_romclk_hack_r -- read status of romclk
-
-******************************************************************************/
-
-void tms5110_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(tms5110_device::romclk_hack_toggle)
{
m_romclk_hack_state = !m_romclk_hack_state;
}
+//-------------------------------------------------
+// romclk_hack_r - read status of romclk
+//-------------------------------------------------
+
int tms5110_device::romclk_hack_r()
{
/* bring up to date first */
@@ -1322,7 +1320,7 @@ void tmsprom_device::update_prom_cnt()
m_prom_cnt &= 0x0f;
}
-void tmsprom_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(tmsprom_device::update_romclk)
{
/* only 16 bytes needed ... The original dump is bad. This
* is what is needed to get speech to work. The prom data has
@@ -1332,10 +1330,8 @@ void tmsprom_device::device_timer(emu_timer &timer, device_timer_id id, int para
* static const int prom[16] = {0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00,
* 0x02, 0x00, 0x40, 0x00, 0x04, 0x06, 0x04, 0x84 };
*/
- uint16_t ctrl;
-
update_prom_cnt();
- ctrl = (m_prom[m_prom_cnt] | 0x200);
+ uint16_t ctrl = (m_prom[m_prom_cnt] | 0x200);
//if (m_enable && m_prom_cnt < 0x10) printf("ctrl %04x, enable %d cnt %d\n", ctrl, m_enable, m_prom_cnt);
m_prom_cnt = ((m_prom_cnt + 1) & 0x0f) | (m_prom_cnt & 0x10);
@@ -1359,7 +1355,7 @@ void tmsprom_device::device_start()
m_pdc_cb.resolve_safe();
m_ctl_cb.resolve_safe();
- m_romclk_timer = timer_alloc(0);
+ m_romclk_timer = timer_alloc(FUNC(tmsprom_device::update_romclk), this);
m_romclk_timer->adjust(attotime::zero, 0, attotime::from_hz(clock()));
m_bit = 0;
diff --git a/src/devices/sound/tms5110.h b/src/devices/sound/tms5110.h
index e49ea9e93cc..9d907668a70 100644
--- a/src/devices/sound/tms5110.h
+++ b/src/devices/sound/tms5110.h
@@ -57,7 +57,7 @@ protected:
virtual void device_reset() override;
virtual void device_clock_changed() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(romclk_hack_toggle);
// sound stream update overrides
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
@@ -285,7 +285,7 @@ protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(update_romclk);
private:
void register_for_save_states();
diff --git a/src/devices/sound/tms5220.cpp b/src/devices/sound/tms5220.cpp
index 47d1ab02fc2..77622b12fef 100644
--- a/src/devices/sound/tms5220.cpp
+++ b/src/devices/sound/tms5220.cpp
@@ -1653,7 +1653,7 @@ void tms5220_device::device_start()
/* initialize a stream */
m_stream = stream_alloc(0, 1, clock() / 80);
- m_timer_io_ready = timer_alloc(0);
+ m_timer_io_ready = timer_alloc(FUNC(tms5220_device::set_io_ready), this);
/* not during reset which is called from within a write! */
m_io_ready = true;
@@ -1729,60 +1729,49 @@ void tms5220_device::device_reset()
}
-/**********************************************************************************************
-
- True timing
-
-***********************************************************************************************/
-
-void tms5220_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(tms5220_device::set_io_ready)
{
- switch(id)
+ /* bring up to date first */
+ m_stream->update();
+ LOGMASKED(LOG_IO_READY, "m_timer_io_ready timer fired, param = %02x, m_rs_ws = %02x\n", param, m_rs_ws);
+ if (param) // low->high ready state
{
- case 0: // m_timer_io_ready
- /* bring up to date first */
- m_stream->update();
- LOGMASKED(LOG_IO_READY, "m_timer_io_ready timer fired, param = %02x, m_rs_ws = %02x\n", param, m_rs_ws);
- if (param) // low->high ready state
+ switch (m_rs_ws)
{
- switch (m_rs_ws)
+ case 0x02:
+ /* Write */
+ LOGMASKED(LOG_IO_READY, "m_timer_io_ready: Attempting to service write...\n");
+ if ((m_fifo_count >= FIFO_SIZE) && m_DDIS) // if FIFO is full and we're in speak external mode
{
- case 0x02:
- /* Write */
- LOGMASKED(LOG_IO_READY, "m_timer_io_ready: Attempting to service write...\n");
- if ((m_fifo_count >= FIFO_SIZE) && m_DDIS) // if FIFO is full and we're in speak external mode
- {
- LOGMASKED(LOG_IO_READY, "m_timer_io_ready: in SPKEXT and FIFO was full! cannot service write now, delaying 16 cycles...\n");
- m_timer_io_ready->adjust(clocks_to_attotime(16), 1);
- break;
- }
- else
- {
- LOGMASKED(LOG_IO_READY, "m_timer_io_ready: Serviced write: %02x\n", m_write_latch);
- data_write(m_write_latch);
- m_io_ready = param;
- break;
- }
- case 0x01:
- /* Read */
- m_read_latch = status_read(true);
- LOGMASKED(LOG_IO_READY, "m_timer_io_ready: Serviced read, returning %02x\n", m_read_latch);
- m_io_ready = param;
- break;
- case 0x03:
- /* High Impedance */
- m_io_ready = param;
+ LOGMASKED(LOG_IO_READY, "m_timer_io_ready: in SPKEXT and FIFO was full! cannot service write now, delaying 16 cycles...\n");
+ m_timer_io_ready->adjust(clocks_to_attotime(16), 1);
break;
- case 0x00:
- /* illegal */
+ }
+ else
+ {
+ LOGMASKED(LOG_IO_READY, "m_timer_io_ready: Serviced write: %02x\n", m_write_latch);
+ data_write(m_write_latch);
m_io_ready = param;
break;
}
+ case 0x01:
+ /* Read */
+ m_read_latch = status_read(true);
+ LOGMASKED(LOG_IO_READY, "m_timer_io_ready: Serviced read, returning %02x\n", m_read_latch);
+ m_io_ready = param;
+ break;
+ case 0x03:
+ /* High Impedance */
+ m_io_ready = param;
+ break;
+ case 0x00:
+ /* illegal */
+ m_io_ready = param;
+ break;
}
-
- update_ready_state();
- break;
}
+
+ update_ready_state();
}
/*
diff --git a/src/devices/sound/tms5220.h b/src/devices/sound/tms5220.h
index 826a78ec291..82a589c486d 100644
--- a/src/devices/sound/tms5220.h
+++ b/src/devices/sound/tms5220.h
@@ -72,11 +72,11 @@ protected:
virtual void device_reset() override;
virtual void device_clock_changed() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
// sound stream update overrides
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
+ TIMER_CALLBACK_MEMBER(set_io_ready);
+
private:
static constexpr unsigned FIFO_SIZE = 16;
diff --git a/src/devices/sound/upd1771.cpp b/src/devices/sound/upd1771.cpp
index 2ec1d767ba0..4e865ea2c42 100644
--- a/src/devices/sound/upd1771.cpp
+++ b/src/devices/sound/upd1771.cpp
@@ -253,7 +253,7 @@ void upd1771c_device::device_start()
/* resolve callbacks */
m_ack_handler.resolve_safe();
- m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(upd1771c_device::ack_callback),this));
+ m_timer = timer_alloc(FUNC(upd1771c_device::ack_callback), this);
m_channel = stream_alloc(0, 1, clock() / 4);
diff --git a/src/devices/sound/upd7759.cpp b/src/devices/sound/upd7759.cpp
index 36738f029a5..2da49639c82 100644
--- a/src/devices/sound/upd7759.cpp
+++ b/src/devices/sound/upd7759.cpp
@@ -268,21 +268,12 @@ void upd7759_device::device_start()
m_sample_offset_shift = 1;
- m_timer = timer_alloc(TID_SLAVE_UPDATE);
+ m_timer = timer_alloc(FUNC(upd7759_device::drq_update), this);
m_drqcallback.resolve_safe();
-
- device_reset();
}
-void upd7756_device::device_start()
-{
- upd775x_device::device_start();
-
- device_reset();
-}
-
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
@@ -574,54 +565,29 @@ void upd775x_device::advance_state()
}
}
-/************************************************************
-
- DRQ callback
-
-*************************************************************/
+TIMER_CALLBACK_MEMBER(upd775x_device::sync_port_write)
+{
+ m_fifo_in = param;
+}
-void upd7759_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(upd7759_device::drq_update)
{
uint8_t olddrq = m_drq;
int old_state = m_state;
- switch (id)
- {
- case TID_PORT_WRITE:
- m_fifo_in = param;
- break;
-
- case TID_RESET_WRITE:
- internal_reset_w(param);
- break;
-
- case TID_START_WRITE:
- internal_start_w(param);
- break;
-
- case TID_MD_WRITE:
- internal_md_w(param);
- break;
-
- case TID_SLAVE_UPDATE:
- m_channel->update();
-
- advance_state();
-
- LOG_STATE("upd7759_slave_update: DRQ %d->%d\n", olddrq, m_drq);
- if (olddrq != m_drq)
- {
- LOG_DRQ("DRQ changed %d->%d\n", olddrq, m_drq);
- m_drqcallback(m_drq);
- }
+ m_channel->update();
- if (m_state != STATE_IDLE || old_state != STATE_IDLE)
- m_timer->adjust(m_clock_period * m_clocks_left);
- break;
+ advance_state();
- default:
- throw emu_fatalerror("Unknown id in upd7759_device::device_timer");
+ LOG_STATE("upd7759_slave_update: DRQ %d->%d\n", olddrq, m_drq);
+ if (olddrq != m_drq)
+ {
+ LOG_DRQ("DRQ changed %d->%d\n", olddrq, m_drq);
+ m_drqcallback(m_drq);
}
+
+ if (m_state != STATE_IDLE || old_state != STATE_IDLE)
+ m_timer->adjust(m_clock_period * m_clocks_left);
}
/************************************************************
@@ -632,13 +598,13 @@ void upd7759_device::device_timer(emu_timer &timer, device_timer_id id, int para
WRITE_LINE_MEMBER( upd775x_device::reset_w )
{
- synchronize(TID_RESET_WRITE, state);
+ machine().scheduler().synchronize(timer_expired_delegate(FUNC(upd775x_device::internal_reset_w), this), state);
}
-void upd775x_device::internal_reset_w(int state)
+TIMER_CALLBACK_MEMBER(upd775x_device::internal_reset_w)
{
uint8_t oldreset = m_reset;
- m_reset = (state != 0);
+ m_reset = (param != 0);
m_channel->update();
@@ -646,10 +612,10 @@ void upd775x_device::internal_reset_w(int state)
device_reset();
}
-void upd7759_device::internal_reset_w(int state)
+TIMER_CALLBACK_MEMBER(upd7759_device::internal_reset_w)
{
uint8_t oldreset = m_reset;
- upd775x_device::internal_reset_w(state);
+ upd775x_device::internal_reset_w(param);
if (!oldreset && m_reset)
{
@@ -664,7 +630,7 @@ void upd7759_device::internal_reset_w(int state)
WRITE_LINE_MEMBER( upd775x_device::start_w )
{
- synchronize(TID_START_WRITE, state);
+ machine().scheduler().synchronize(timer_expired_delegate(FUNC(upd775x_device::internal_start_w), this), state);
}
void upd7759_device::internal_start_w(int state)
@@ -710,14 +676,14 @@ WRITE_LINE_MEMBER(upd7759_device::md_w)
m_md = state;
return;
}
- synchronize(TID_MD_WRITE, state);
+ machine().scheduler().synchronize(timer_expired_delegate(FUNC(upd7759_device::internal_md_w), this), state);
}
-void upd7759_device::internal_md_w(int state)
+TIMER_CALLBACK_MEMBER(upd7759_device::internal_md_w)
{
uint8_t old_md = m_md;
- m_md = (state != 0);
+ m_md = (param != 0);
LOG_STATE("upd7759_md_w: %d->%d\n", old_md, m_md);
@@ -741,7 +707,7 @@ void upd7759_device::internal_md_w(int state)
void upd775x_device::port_w(u8 data)
{
- synchronize(TID_PORT_WRITE, data);
+ machine().scheduler().synchronize(timer_expired_delegate(FUNC(upd775x_device::sync_port_write), this), data);
}
diff --git a/src/devices/sound/upd7759.h b/src/devices/sound/upd7759.h
index 23f24ad1ae5..1f1d0e38dfd 100644
--- a/src/devices/sound/upd7759.h
+++ b/src/devices/sound/upd7759.h
@@ -27,8 +27,8 @@ public:
void set_start_delay(uint32_t data) { m_start_delay = data; }
protected:
- virtual void internal_start_w(int state) = 0;
- virtual void internal_reset_w(int state);
+ virtual TIMER_CALLBACK_MEMBER(internal_start_w) = 0;
+ virtual TIMER_CALLBACK_MEMBER(internal_reset_w);
enum
{
@@ -78,6 +78,8 @@ protected:
void update_adpcm(int data);
virtual void advance_state();
+ TIMER_CALLBACK_MEMBER(sync_port_write);
+
// internal state
sound_stream *m_channel; // stream channel for playback
@@ -131,14 +133,15 @@ public:
DECLARE_WRITE_LINE_MEMBER( md_w );
protected:
- virtual void internal_start_w(int state) override;
- virtual void internal_reset_w(int state) override;
-
upd7759_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ virtual TIMER_CALLBACK_MEMBER(internal_start_w) override;
+ virtual TIMER_CALLBACK_MEMBER(internal_reset_w) override;
+
+ TIMER_CALLBACK_MEMBER(drq_update);
void internal_md_w(int state);
@@ -151,14 +154,12 @@ class upd7756_device : public upd775x_device
public:
upd7756_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = STANDARD_CLOCK);
- virtual void device_reset() override;
-
protected:
- virtual void internal_start_w(int state) override;
-
upd7756_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
- virtual void device_start() override;
+ virtual void device_reset() override;
+
+ virtual TIMER_CALLBACK_MEMBER(internal_start_w) override;
};
DECLARE_DEVICE_TYPE(UPD7759, upd7759_device)
diff --git a/src/devices/sound/votrax.cpp b/src/devices/sound/votrax.cpp
index ee4a21a3c9f..1ec2343f72f 100644
--- a/src/devices/sound/votrax.cpp
+++ b/src/devices/sound/votrax.cpp
@@ -170,7 +170,7 @@ void votrax_sc01_device::device_start()
m_sclock = m_mainclock / 18.0;
m_cclock = m_mainclock / 36.0;
m_stream = stream_alloc(0, 1, m_sclock);
- m_timer = timer_alloc();
+ m_timer = timer_alloc(FUNC(votrax_sc01_device::phone_tick), this);
// reset outputs
m_ar_cb.resolve_safe();
@@ -331,10 +331,10 @@ void votrax_sc01_device::device_clock_changed()
//-------------------------------------------------
-// device_timer - handle device timer
+// phone_tick - process transitions
//-------------------------------------------------
-void votrax_sc01_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(votrax_sc01_device::phone_tick)
{
m_stream->update();
diff --git a/src/devices/sound/votrax.h b/src/devices/sound/votrax.h
index 87c466b1875..2dcc7d087da 100644
--- a/src/devices/sound/votrax.h
+++ b/src/devices/sound/votrax.h
@@ -34,11 +34,12 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_clock_changed() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_sound_interface overrides
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
+ TIMER_CALLBACK_MEMBER(phone_tick);
+
private:
// Possible timer parameters
enum {
diff --git a/src/devices/sound/ym2154.cpp b/src/devices/sound/ym2154.cpp
index 8be2888175b..287529aeeec 100644
--- a/src/devices/sound/ym2154.cpp
+++ b/src/devices/sound/ym2154.cpp
@@ -177,7 +177,7 @@ void ym2154_device::write(offs_t offset, u8 data)
void ym2154_device::device_start()
{
// allocate our timer
- m_timer = timer_alloc(0);
+ m_timer = timer_alloc(FUNC(ym2154_device::delayed_irq), this);
// resolve the handlers
m_update_irq.resolve();
@@ -237,10 +237,10 @@ void ym2154_device::device_clock_changed()
//-------------------------------------------------
-// sound_stream_update - generate sound data
+// delayed_irq -
//-------------------------------------------------
-void ym2154_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(ym2154_device::delayed_irq)
{
update_irq_state(1);
m_timer->adjust((2048 - m_timer_count) * attotime::from_hz(sample_rate()));
diff --git a/src/devices/sound/ym2154.h b/src/devices/sound/ym2154.h
index 3736b6aa367..e7f287409fa 100644
--- a/src/devices/sound/ym2154.h
+++ b/src/devices/sound/ym2154.h
@@ -37,7 +37,6 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_clock_changed() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// sound overrides
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
@@ -45,6 +44,8 @@ protected:
// memory space configuration
virtual space_config_vector memory_space_config() const override;
+ TIMER_CALLBACK_MEMBER(delayed_irq);
+
private:
struct channel
{
diff --git a/src/devices/sound/ymf271.cpp b/src/devices/sound/ymf271.cpp
index 6e82ee97607..b8240df9c72 100644
--- a/src/devices/sound/ymf271.cpp
+++ b/src/devices/sound/ymf271.cpp
@@ -1309,46 +1309,38 @@ void ymf271_device::ymf271_write_pcm(uint8_t address, uint8_t data)
}
}
-void ymf271_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(ymf271_device::timer_a_expired)
{
- switch(id)
- {
- case 0:
- m_status |= 1;
-
- // assert IRQ
- if (m_enable & 4)
- {
- m_irqstate |= 1;
-
- if (!m_irq_handler.isnull())
- m_irq_handler(1);
- }
+ m_status |= 1;
- // reload timer
- m_timA->adjust(clocks_to_attotime(384 * (1024 - m_timerA)), 0);
- break;
+ // assert IRQ
+ if (m_enable & 4)
+ {
+ m_irqstate |= 1;
- case 1:
- m_status |= 2;
+ if (!m_irq_handler.isnull())
+ m_irq_handler(1);
+ }
- // assert IRQ
- if (m_enable & 8)
- {
- m_irqstate |= 2;
+ // reload timer
+ m_timA->adjust(clocks_to_attotime(384 * (1024 - m_timerA)), 0);
+}
- if (!m_irq_handler.isnull())
- m_irq_handler(1);
- }
+TIMER_CALLBACK_MEMBER(ymf271_device::timer_b_expired)
+{
+ m_status |= 2;
- // reload timer
- m_timB->adjust(clocks_to_attotime(384 * 16 * (256 - m_timerB)), 0);
- break;
+ // assert IRQ
+ if (m_enable & 8)
+ {
+ m_irqstate |= 2;
- default:
- throw emu_fatalerror("Unknown id in ymf271_device::device_timer");
- break;
+ if (!m_irq_handler.isnull())
+ m_irq_handler(1);
}
+
+ // reload timer
+ m_timB->adjust(clocks_to_attotime(384 * 16 * (256 - m_timerB)), 0);
}
void ymf271_device::ymf271_write_timer(uint8_t address, uint8_t data)
@@ -1732,8 +1724,8 @@ void ymf271_device::init_state()
void ymf271_device::device_start()
{
- m_timA = timer_alloc(0);
- m_timB = timer_alloc(1);
+ m_timA = timer_alloc(FUNC(ymf271_device::timer_a_expired), this);
+ m_timB = timer_alloc(FUNC(ymf271_device::timer_b_expired), this);
m_irq_handler.resolve();
diff --git a/src/devices/sound/ymf271.h b/src/devices/sound/ymf271.h
index 6dbf1a9408f..5c6e432649b 100644
--- a/src/devices/sound/ymf271.h
+++ b/src/devices/sound/ymf271.h
@@ -24,7 +24,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_clock_changed() override;
// sound stream update overrides
@@ -33,6 +32,9 @@ protected:
// device_rom_interface overrides
virtual void rom_bank_updated() override;
+ TIMER_CALLBACK_MEMBER(timer_a_expired);
+ TIMER_CALLBACK_MEMBER(timer_b_expired);
+
private:
struct YMF271Slot
{
diff --git a/src/devices/sound/ymfm_mame.h b/src/devices/sound/ymfm_mame.h
index d22fc9ad8b2..d0161426619 100644
--- a/src/devices/sound/ymfm_mame.h
+++ b/src/devices/sound/ymfm_mame.h
@@ -138,7 +138,7 @@ protected:
{
// allocate our timers
for (int tnum = 0; tnum < 2; tnum++)
- m_timer[tnum] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ym_generic_device::fm_timer_handler), this));
+ m_timer[tnum] = timer_alloc(FUNC(ym_generic_device::fm_timer_handler), this);
// resolve the handlers
m_update_irq.resolve();
diff --git a/src/devices/sound/ymz280b.cpp b/src/devices/sound/ymz280b.cpp
index f6e6a0e3935..319b03a381b 100644
--- a/src/devices/sound/ymz280b.cpp
+++ b/src/devices/sound/ymz280b.cpp
@@ -81,7 +81,7 @@ void ymz280b_device::update_irq_state()
}
-void ymz280b_device::update_step(struct YMZ280BVoice *voice)
+void ymz280b_device::update_step(YMZ280BVoice *voice)
{
int frequency;
@@ -94,7 +94,7 @@ void ymz280b_device::update_step(struct YMZ280BVoice *voice)
}
-void ymz280b_device::update_volumes(struct YMZ280BVoice *voice)
+void ymz280b_device::update_volumes(YMZ280BVoice *voice)
{
if (voice->pan == 8)
{
@@ -118,24 +118,24 @@ void ymz280b_device::update_volumes(struct YMZ280BVoice *voice)
void ymz280b_device::device_post_load()
{
- for (auto & elem : m_voice)
+ for (size_t i = 0; i < std::size(m_voice); i++)
{
- struct YMZ280BVoice *voice = &elem;
+ YMZ280BVoice *voice = &m_voice[i];
update_step(voice);
if(voice->irq_schedule)
- voice->timer->adjust(attotime::zero);
+ voice->timer->adjust(attotime::zero, i);
}
}
-void ymz280b_device::update_irq_state_timer_common(int voicenum)
+TIMER_CALLBACK_MEMBER(ymz280b_device::update_irq_state_timer_common)
{
- struct YMZ280BVoice *voice = &m_voice[voicenum];
+ YMZ280BVoice *voice = &m_voice[param];
if(!voice->irq_schedule) return;
voice->playing = 0;
- m_status_register |= 1 << voicenum;
+ m_status_register |= 1 << param;
update_irq_state();
voice->irq_schedule = 0;
}
@@ -164,7 +164,7 @@ static void compute_tables()
***********************************************************************************************/
-int ymz280b_device::generate_adpcm(struct YMZ280BVoice *voice, s16 *buffer, int samples)
+int ymz280b_device::generate_adpcm(YMZ280BVoice *voice, s16 *buffer, int samples)
{
int position = voice->position;
int signal = voice->signal;
@@ -276,7 +276,7 @@ int ymz280b_device::generate_adpcm(struct YMZ280BVoice *voice, s16 *buffer, int
***********************************************************************************************/
-int ymz280b_device::generate_pcm8(struct YMZ280BVoice *voice, s16 *buffer, int samples)
+int ymz280b_device::generate_pcm8(YMZ280BVoice *voice, s16 *buffer, int samples)
{
int position = voice->position;
int val;
@@ -346,7 +346,7 @@ int ymz280b_device::generate_pcm8(struct YMZ280BVoice *voice, s16 *buffer, int s
***********************************************************************************************/
-int ymz280b_device::generate_pcm16(struct YMZ280BVoice *voice, s16 *buffer, int samples)
+int ymz280b_device::generate_pcm16(YMZ280BVoice *voice, s16 *buffer, int samples)
{
int position = voice->position;
int val;
@@ -428,7 +428,7 @@ void ymz280b_device::sound_stream_update(sound_stream &stream, std::vector<read_
/* loop over voices */
for (v = 0; v < 8; v++)
{
- struct YMZ280BVoice *voice = &m_voice[v];
+ YMZ280BVoice *voice = &m_voice[v];
s16 prev = voice->last_sample;
s16 curr = voice->curr_sample;
s16 *curr_data = m_scratch.get();
@@ -501,7 +501,7 @@ void ymz280b_device::sound_stream_update(sound_stream &stream, std::vector<read_
voice->playing = 0;
/* set update_irq_state_timer. IRQ is signaled on next CPU execution. */
- voice->timer->adjust(attotime::zero);
+ voice->timer->adjust(attotime::zero, v);
voice->irq_schedule = 1;
}
}
@@ -556,7 +556,7 @@ void ymz280b_device::device_start()
for (int i = 0; i < 8; i++)
{
- m_voice[i].timer = timer_alloc(i);
+ m_voice[i].timer = timer_alloc(FUNC(ymz280b_device::update_irq_state_timer_common), this);
}
/* create the stream */
@@ -629,7 +629,7 @@ void ymz280b_device::device_reset()
/* clear other voice parameters */
for (auto &elem : m_voice)
{
- struct YMZ280BVoice *voice = &elem;
+ YMZ280BVoice *voice = &elem;
voice->curr_sample = 0;
voice->last_sample = 0;
@@ -639,15 +639,6 @@ void ymz280b_device::device_reset()
}
-void ymz280b_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- if (id < 8)
- update_irq_state_timer_common( id );
- else
- throw emu_fatalerror("Unknown id in ymz280b_device::device_timer");
-}
-
-
void ymz280b_device::device_clock_changed()
{
m_master_clock = (double)clock() / 384.0;
@@ -669,13 +660,10 @@ void ymz280b_device::rom_bank_updated()
void ymz280b_device::write_to_register(int data)
{
- struct YMZ280BVoice *voice;
- int i;
-
/* lower registers follow a pattern */
if (m_current_register < 0x80)
{
- voice = &m_voice[(m_current_register >> 2) & 7];
+ YMZ280BVoice *voice = &m_voice[(m_current_register >> 2) & 7];
switch (m_current_register & 0xe3)
{
@@ -687,8 +675,10 @@ void ymz280b_device::write_to_register(int data)
case 0x01: /* pitch upper 1 bit, loop, key on, mode */
voice->fnum = (voice->fnum & 0xff) | ((data & 0x01) << 8);
voice->looping = (data & 0x10) >> 4;
- if ((data & 0x60) == 0) data &= 0x7f; /* ignore mode setting and set to same state as KON=0 */
- else voice->mode = (data & 0x60) >> 5;
+ if ((data & 0x60) == 0)
+ data &= 0x7f; /* ignore mode setting and set to same state as KON=0 */
+ else
+ voice->mode = (data & 0x60) >> 5;
if (!voice->keyon && (data & 0x80) && m_keyon_enable)
{
voice->playing = 1;
@@ -822,7 +812,7 @@ void ymz280b_device::write_to_register(int data)
if (m_keyon_enable && !(data & 0x80))
{
- for (i = 0; i < 8; i++)
+ for (int i = 0; i < 8; i++)
{
m_voice[i].playing = 0;
@@ -832,7 +822,7 @@ void ymz280b_device::write_to_register(int data)
}
else if (!m_keyon_enable && (data & 0x80))
{
- for (i = 0; i < 8; i++)
+ for (int i = 0; i < 8; i++)
{
if (m_voice[i].keyon && m_voice[i].looping)
m_voice[i].playing = 1;
diff --git a/src/devices/sound/ymz280b.h b/src/devices/sound/ymz280b.h
index c35d4be20fc..04b229de4d3 100644
--- a/src/devices/sound/ymz280b.h
+++ b/src/devices/sound/ymz280b.h
@@ -32,7 +32,6 @@ protected:
virtual void device_start() override;
virtual void device_post_load() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_clock_changed() override;
// sound stream update overrides
@@ -80,17 +79,17 @@ private:
};
void update_irq_state();
- void update_step(struct YMZ280BVoice *voice);
- void update_volumes(struct YMZ280BVoice *voice);
- void update_irq_state_timer_common(int voicenum);
- int generate_adpcm(struct YMZ280BVoice *voice, s16 *buffer, int samples);
- int generate_pcm8(struct YMZ280BVoice *voice, s16 *buffer, int samples);
- int generate_pcm16(struct YMZ280BVoice *voice, s16 *buffer, int samples);
+ void update_step(YMZ280BVoice *voice);
+ void update_volumes(YMZ280BVoice *voice);
+ TIMER_CALLBACK_MEMBER(update_irq_state_timer_common);
+ int generate_adpcm(YMZ280BVoice *voice, s16 *buffer, int samples);
+ int generate_pcm8(YMZ280BVoice *voice, s16 *buffer, int samples);
+ int generate_pcm16(YMZ280BVoice *voice, s16 *buffer, int samples);
void write_to_register(int data);
int compute_status();
// internal state
- struct YMZ280BVoice m_voice[8]; /* the 8 voices */
+ YMZ280BVoice m_voice[8]; /* the 8 voices */
u8 m_current_register; /* currently accessible register */
u8 m_status_register; /* current status register */
u8 m_irq_state; /* current IRQ state */
diff --git a/src/devices/video/315_5124.cpp b/src/devices/video/315_5124.cpp
index 9afe518b6bc..7bb4fd18407 100644
--- a/src/devices/video/315_5124.cpp
+++ b/src/devices/video/315_5124.cpp
@@ -478,94 +478,81 @@ void sega315_5377_device::set_sega315_5124_compatibility_mode(bool sega315_5124_
}
-void sega315_5124_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(sega315_5124_device::eol_flag_check)
{
- switch (id)
- {
- case TIMER_LINE:
- process_line_timer();
- break;
-
- case TIMER_FLAGS:
- /* Activate flags that were pending until the end of the line. */
- check_pending_flags();
- break;
-
- case TIMER_DRAW:
- update_palette();
- draw_scanline(LBORDER_START + LBORDER_WIDTH, param, screen().vpos() - param);
- break;
+ /* Activate flags that were pending until the end of the line. */
+ check_pending_flags();
+}
- case TIMER_LBORDER:
- {
- rectangle rec;
- rec.min_y = rec.max_y = param;
+TIMER_CALLBACK_MEMBER(sega315_5124_device::draw_lborder)
+{
+ rectangle rec;
+ rec.min_y = rec.max_y = param;
- update_palette();
+ update_palette();
- /* Draw left border */
- rec.min_x = LBORDER_START;
- rec.max_x = LBORDER_START + LBORDER_WIDTH - 1;
- m_tmpbitmap.fill(m_palette_lut->pen(m_current_palette[BACKDROP_COLOR]), rec);
- m_y1_bitmap.fill((m_reg[0x07] & 0x0f) ? 1 : 0, rec);
- }
- break;
+ /* Draw left border */
+ rec.min_x = LBORDER_START;
+ rec.max_x = LBORDER_START + LBORDER_WIDTH - 1;
+ m_tmpbitmap.fill(m_palette_lut->pen(m_current_palette[BACKDROP_COLOR]), rec);
+ m_y1_bitmap.fill((m_reg[0x07] & 0x0f) ? 1 : 0, rec);
+}
- case TIMER_RBORDER:
- {
- rectangle rec;
- rec.min_y = rec.max_y = param;
+TIMER_CALLBACK_MEMBER(sega315_5124_device::draw_rborder)
+{
+ rectangle rec;
+ rec.min_y = rec.max_y = param;
- update_palette();
+ update_palette();
- /* Draw right border */
- rec.min_x = LBORDER_START + LBORDER_WIDTH + 256;
- rec.max_x = rec.min_x + RBORDER_WIDTH - 1;
- m_tmpbitmap.fill(m_palette_lut->pen(m_current_palette[BACKDROP_COLOR]), rec);
- m_y1_bitmap.fill((m_reg[0x07] & 0x0f) ? 1 : 0, rec);
- }
- break;
+ /* Draw right border */
+ rec.min_x = LBORDER_START + LBORDER_WIDTH + 256;
+ rec.max_x = rec.min_x + RBORDER_WIDTH - 1;
+ m_tmpbitmap.fill(m_palette_lut->pen(m_current_palette[BACKDROP_COLOR]), rec);
+ m_y1_bitmap.fill((m_reg[0x07] & 0x0f) ? 1 : 0, rec);
+}
- case TIMER_HINT:
- if (m_pending_hint || m_hint_occurred)
+TIMER_CALLBACK_MEMBER(sega315_5124_device::trigger_hint)
+{
+ if (m_pending_hint || m_hint_occurred)
+ {
+ if (BIT(m_reg[0x00], 4))
{
- if (BIT(m_reg[0x00], 4))
- {
- m_n_int_state = 0;
+ m_n_int_state = 0;
- if (!m_n_int_cb.isnull())
- m_n_int_cb(ASSERT_LINE);
- }
+ if (!m_n_int_cb.isnull())
+ m_n_int_cb(ASSERT_LINE);
}
- break;
+ }
+}
- case TIMER_VINT:
- if ((m_pending_status & STATUS_VINT) || (m_status & STATUS_VINT))
+TIMER_CALLBACK_MEMBER(sega315_5124_device::trigger_vint)
+{
+ if ((m_pending_status & STATUS_VINT) || (m_status & STATUS_VINT))
+ {
+ if (BIT(m_reg[0x01], 5))
{
- if (BIT(m_reg[0x01], 5))
- {
- m_n_int_state = 0;
+ m_n_int_state = 0;
- if (!m_n_int_cb.isnull())
- m_n_int_cb(ASSERT_LINE);
- }
+ if (!m_n_int_cb.isnull())
+ m_n_int_cb(ASSERT_LINE);
}
- break;
+ }
+}
- case TIMER_NMI:
- if (!m_n_nmi_in_state)
- {
- if (m_n_nmi_state)
- m_n_nmi_cb(ASSERT_LINE);
- }
- else
- {
- if (!m_n_nmi_state)
- m_n_nmi_cb(CLEAR_LINE);
- }
- m_n_nmi_state = m_n_nmi_in_state;
- break;
+TIMER_CALLBACK_MEMBER(sega315_5124_device::update_nmi)
+{
+ if (!m_n_nmi_in_state)
+ {
+ if (m_n_nmi_state)
+ m_n_nmi_cb(ASSERT_LINE);
}
+ else
+ {
+ if (!m_n_nmi_state)
+ m_n_nmi_cb(CLEAR_LINE);
+ }
+ m_n_nmi_state = m_n_nmi_in_state;
}
@@ -583,7 +570,7 @@ void sega315_5377_device::vblank_end(int vpos)
}
-void sega315_5124_device::process_line_timer()
+TIMER_CALLBACK_MEMBER(sega315_5124_device::process_line_timer)
{
const int vpos = screen().vpos();
int vpos_limit = m_frame_timing[VERTICAL_SYNC] + m_frame_timing[TOP_BLANKING]
@@ -1723,8 +1710,14 @@ void sega315_5124_device::draw_scanline_mode3(int *line_buffer, int line)
}
-void sega315_5124_device::draw_scanline(int pixel_offset_x, int pixel_plot_y, int line)
+TIMER_CALLBACK_MEMBER(sega315_5124_device::draw_scanline)
{
+ int pixel_offset_x = LBORDER_START + LBORDER_WIDTH;
+ int pixel_plot_y = param;
+ int line = screen().vpos() - param;
+
+ update_palette();
+
int blitline_buffer[256];
int priority_selected[256];
@@ -2021,16 +2014,16 @@ void sega315_5124_device::device_start()
screen().register_screen_bitmap(m_tmpbitmap);
screen().register_screen_bitmap(m_y1_bitmap);
- m_display_timer = timer_alloc(TIMER_LINE);
+ m_display_timer = timer_alloc(FUNC(sega315_5124_device::process_line_timer), this);
m_display_timer->adjust(screen().time_until_pos(0, DISPLAY_CB_HPOS), 0, screen().scan_period());
- m_pending_flags_timer = timer_alloc(TIMER_FLAGS);
+ m_pending_flags_timer = timer_alloc(FUNC(sega315_5124_device::eol_flag_check), this);
m_pending_flags_timer->adjust(screen().time_until_pos(0, WIDTH - 1), 0, screen().scan_period());
- m_draw_timer = timer_alloc(TIMER_DRAW);
- m_lborder_timer = timer_alloc(TIMER_LBORDER);
- m_rborder_timer = timer_alloc(TIMER_RBORDER);
- m_hint_timer = timer_alloc(TIMER_HINT);
- m_vint_timer = timer_alloc(TIMER_VINT);
- m_nmi_timer = timer_alloc(TIMER_NMI);
+ m_draw_timer = timer_alloc(FUNC(sega315_5124_device::draw_scanline), this);
+ m_lborder_timer = timer_alloc(FUNC(sega315_5124_device::draw_lborder), this);
+ m_rborder_timer = timer_alloc(FUNC(sega315_5124_device::draw_rborder), this);
+ m_hint_timer = timer_alloc(FUNC(sega315_5124_device::trigger_hint), this);
+ m_vint_timer = timer_alloc(FUNC(sega315_5124_device::trigger_vint), this);
+ m_nmi_timer = timer_alloc(FUNC(sega315_5124_device::update_nmi), this);
save_item(NAME(m_status));
save_item(NAME(m_pending_status));
diff --git a/src/devices/video/315_5124.h b/src/devices/video/315_5124.h
index eaa78b0ac03..913fdb71e18 100644
--- a/src/devices/video/315_5124.h
+++ b/src/devices/video/315_5124.h
@@ -94,7 +94,6 @@ protected:
virtual void device_post_load() override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_add_mconfig(machine_config &config) override;
virtual space_config_vector memory_space_config() const override;
@@ -116,7 +115,6 @@ protected:
virtual void select_sprites(int line);
virtual void sprite_collision(int line, int sprite_col_x);
virtual void sprite_count_overflow(int line, int sprite_index);
- virtual void draw_scanline(int pixel_offset_x, int pixel_plot_y, int line);
virtual void blit_scanline(int *line_buffer, int *priority_selected, int pixel_offset_x, int pixel_plot_y, int line);
virtual void draw_leftmost_pixels_mode4(int *line_buffer, int *priority_selected, int fine_x_scroll, int palette_selected, int tile_line);
virtual u16 name_row_mode4(u16 row);
@@ -124,7 +122,14 @@ protected:
virtual u16 tile2_select_mode4(u16 tile_number);
virtual u8 sprite_attribute_extra_offset_mode4(u8 offset);
virtual u8 sprite_tile_select_mode4(u8 tile_number);
- void process_line_timer();
+ TIMER_CALLBACK_MEMBER(process_line_timer);
+ TIMER_CALLBACK_MEMBER(eol_flag_check);
+ TIMER_CALLBACK_MEMBER(draw_lborder);
+ TIMER_CALLBACK_MEMBER(draw_rborder);
+ TIMER_CALLBACK_MEMBER(trigger_hint);
+ TIMER_CALLBACK_MEMBER(trigger_vint);
+ TIMER_CALLBACK_MEMBER(update_nmi);
+ TIMER_CALLBACK_MEMBER(draw_scanline);
void draw_scanline_mode4(int *line_buffer, int *priority_selected, int line);
void draw_sprites_mode4(int *line_buffer, int *priority_selected, int line);
void draw_sprites_tms9918_mode(int *line_buffer, int line);
@@ -198,16 +203,6 @@ protected:
const address_space_config m_space_config;
- /* Timers */
- static constexpr device_timer_id TIMER_LINE = 0;
- static constexpr device_timer_id TIMER_DRAW = 1;
- static constexpr device_timer_id TIMER_LBORDER = 2;
- static constexpr device_timer_id TIMER_RBORDER = 3;
- static constexpr device_timer_id TIMER_HINT = 4;
- static constexpr device_timer_id TIMER_VINT = 5;
- static constexpr device_timer_id TIMER_NMI = 6;
- static constexpr device_timer_id TIMER_FLAGS = 7;
-
required_device<palette_device> m_palette_lut;
required_device<sn76496_base_device> m_snsnd;
};
diff --git a/src/devices/video/315_5313.cpp b/src/devices/video/315_5313.cpp
index fad6d4a39de..c42ab3815e5 100644
--- a/src/devices/video/315_5313.cpp
+++ b/src/devices/video/315_5313.cpp
@@ -370,9 +370,9 @@ void sega315_5313_device::device_start()
if (m_use_alt_timing)
save_pointer(NAME(m_render_line), 1280);
- m_irq6_on_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sega315_5313_device::irq6_on_timer_callback), this));
- m_irq4_on_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sega315_5313_device::irq4_on_timer_callback), this));
- m_render_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sega315_5313_device::render_scanline), this));
+ m_irq6_on_timer = timer_alloc(FUNC(sega315_5313_device::irq6_on_timer_callback), this);
+ m_irq4_on_timer = timer_alloc(FUNC(sega315_5313_device::irq4_on_timer_callback), this);
+ m_render_timer = timer_alloc(FUNC(sega315_5313_device::render_scanline), this);
m_space68k = &m_cpu68k->space();
diff --git a/src/devices/video/catseye.cpp b/src/devices/video/catseye.cpp
index dba0c6ac43f..46eeb917f37 100644
--- a/src/devices/video/catseye.cpp
+++ b/src/devices/video/catseye.cpp
@@ -70,7 +70,7 @@ void catseye_device::device_start()
{
m_int_write_func.resolve_safe();
- m_blink_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(catseye_device::blink_callback), this));
+ m_blink_timer = timer_alloc(FUNC(catseye_device::blink_callback), this);
m_blink_timer->adjust(attotime::from_hz(3));
save_item(NAME(m_changed));
diff --git a/src/devices/video/cdp1861.cpp b/src/devices/video/cdp1861.cpp
index d8318896412..e19074045aa 100644
--- a/src/devices/video/cdp1861.cpp
+++ b/src/devices/video/cdp1861.cpp
@@ -115,9 +115,9 @@ void cdp1861_device::device_start()
m_write_efx.resolve_safe();
// allocate timers
- m_int_timer = timer_alloc(TIMER_INT);
- m_efx_timer = timer_alloc(TIMER_EFX);
- m_dma_timer = timer_alloc(TIMER_DMA);
+ m_int_timer = timer_alloc(FUNC(cdp1861_device::int_tick), this);
+ m_efx_timer = timer_alloc(FUNC(cdp1861_device::efx_tick), this);
+ m_dma_timer = timer_alloc(FUNC(cdp1861_device::dma_tick), this);
// find devices
screen().register_screen_bitmap(m_bitmap);
@@ -151,91 +151,87 @@ void cdp1861_device::device_reset()
//-------------------------------------------------
-// device_timer - handle timer events
+// timer events
//-------------------------------------------------
-void cdp1861_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(cdp1861_device::int_tick)
{
- int scanline = screen().vpos();
-
- switch (id)
+ if (screen().vpos() == SCANLINE_INT_START)
{
- case TIMER_INT:
- if (scanline == SCANLINE_INT_START)
+ if (m_disp)
{
- if (m_disp)
- {
- m_write_int(ASSERT_LINE);
- }
-
- m_int_timer->adjust(screen().time_until_pos( SCANLINE_INT_END, 0));
+ m_write_int(ASSERT_LINE);
}
- else
- {
- if (m_disp)
- {
- m_write_int(CLEAR_LINE);
- }
- m_int_timer->adjust(screen().time_until_pos(SCANLINE_INT_START, 0));
+ m_int_timer->adjust(screen().time_until_pos( SCANLINE_INT_END, 0));
+ }
+ else
+ {
+ if (m_disp)
+ {
+ m_write_int(CLEAR_LINE);
}
+
+ m_int_timer->adjust(screen().time_until_pos(SCANLINE_INT_START, 0));
+ }
+}
+
+TIMER_CALLBACK_MEMBER(cdp1861_device::efx_tick)
+{
+ switch (screen().vpos())
+ {
+ case SCANLINE_EFX_TOP_START:
+ m_write_efx(ASSERT_LINE);
+ m_efx_timer->adjust(screen().time_until_pos(SCANLINE_EFX_TOP_END, 0));
break;
- case TIMER_EFX:
- switch (scanline)
- {
- case SCANLINE_EFX_TOP_START:
- m_write_efx(ASSERT_LINE);
- m_efx_timer->adjust(screen().time_until_pos(SCANLINE_EFX_TOP_END, 0));
- break;
-
- case SCANLINE_EFX_TOP_END:
- m_write_efx(CLEAR_LINE);
- m_efx_timer->adjust(screen().time_until_pos(SCANLINE_EFX_BOTTOM_START, 0));
- break;
-
- case SCANLINE_EFX_BOTTOM_START:
- m_write_efx(ASSERT_LINE);
- m_efx_timer->adjust(screen().time_until_pos(SCANLINE_EFX_BOTTOM_END, 0));
- break;
-
- case SCANLINE_EFX_BOTTOM_END:
- m_write_efx(CLEAR_LINE);
- m_efx_timer->adjust(screen().time_until_pos(SCANLINE_EFX_TOP_START, 0));
- break;
- }
+ case SCANLINE_EFX_TOP_END:
+ m_write_efx(CLEAR_LINE);
+ m_efx_timer->adjust(screen().time_until_pos(SCANLINE_EFX_BOTTOM_START, 0));
+ break;
+
+ case SCANLINE_EFX_BOTTOM_START:
+ m_write_efx(ASSERT_LINE);
+ m_efx_timer->adjust(screen().time_until_pos(SCANLINE_EFX_BOTTOM_END, 0));
break;
- case TIMER_DMA:
- if (m_dmaout)
+ case SCANLINE_EFX_BOTTOM_END:
+ m_write_efx(CLEAR_LINE);
+ m_efx_timer->adjust(screen().time_until_pos(SCANLINE_EFX_TOP_START, 0));
+ break;
+ }
+}
+
+TIMER_CALLBACK_MEMBER(cdp1861_device::dma_tick)
+{
+ int scanline = screen().vpos();
+ if (m_dmaout)
+ {
+ if (m_disp)
{
- if (m_disp)
+ if (scanline >= SCANLINE_DISPLAY_START && scanline < SCANLINE_DISPLAY_END)
{
- if (scanline >= SCANLINE_DISPLAY_START && scanline < SCANLINE_DISPLAY_END)
- {
- m_write_dma_out(CLEAR_LINE);
- }
+ m_write_dma_out(CLEAR_LINE);
}
+ }
- m_dma_timer->adjust(clocks_to_attotime(CDP1861_CYCLES_DMA_WAIT));
+ m_dma_timer->adjust(clocks_to_attotime(CDP1861_CYCLES_DMA_WAIT));
- m_dmaout = CLEAR_LINE;
- }
- else
+ m_dmaout = CLEAR_LINE;
+ }
+ else
+ {
+ if (m_disp)
{
- if (m_disp)
+ if (scanline >= SCANLINE_DISPLAY_START && scanline < SCANLINE_DISPLAY_END)
{
- if (scanline >= SCANLINE_DISPLAY_START && scanline < SCANLINE_DISPLAY_END)
- {
- m_write_dma_out(ASSERT_LINE);
- }
+ m_write_dma_out(ASSERT_LINE);
}
+ }
- m_dma_timer->adjust(clocks_to_attotime(CDP1861_CYCLES_DMA_ACTIVE));
+ m_dma_timer->adjust(clocks_to_attotime(CDP1861_CYCLES_DMA_ACTIVE));
- m_dmaout = ASSERT_LINE;
- }
- break;
+ m_dmaout = ASSERT_LINE;
}
}
diff --git a/src/devices/video/cdp1861.h b/src/devices/video/cdp1861.h
index 5e7eca7f8fc..c038223a50e 100644
--- a/src/devices/video/cdp1861.h
+++ b/src/devices/video/cdp1861.h
@@ -81,16 +81,12 @@ protected:
virtual void device_config_complete() override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-private:
- enum
- {
- TIMER_INT,
- TIMER_EFX,
- TIMER_DMA
- };
+ TIMER_CALLBACK_MEMBER(int_tick);
+ TIMER_CALLBACK_MEMBER(efx_tick);
+ TIMER_CALLBACK_MEMBER(dma_tick);
+private:
devcb_write_line m_write_int;
devcb_write_line m_write_dma_out;
devcb_write_line m_write_efx;
diff --git a/src/devices/video/clgd542x.cpp b/src/devices/video/clgd542x.cpp
index d7e20f1cd2d..978e38e792e 100644
--- a/src/devices/video/clgd542x.cpp
+++ b/src/devices/video/clgd542x.cpp
@@ -89,7 +89,7 @@ void cirrus_gd5428_device::device_start()
save_pointer(vga.attribute.data,"Attribute Registers", 0x15);
save_item(NAME(m_chip_id));
- m_vblank_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vga_device::vblank_timer_cb),this));
+ m_vblank_timer = timer_alloc(FUNC(vga_device::vblank_timer_cb), this);
m_chip_id = 0x98; // GD5428 - Rev 0
}
diff --git a/src/devices/video/crt9007.cpp b/src/devices/video/crt9007.cpp
index de8d7554b1a..347a06382a1 100644
--- a/src/devices/video/crt9007.cpp
+++ b/src/devices/video/crt9007.cpp
@@ -505,13 +505,13 @@ void crt9007_device::device_resolve_objects()
void crt9007_device::device_start()
{
// allocate timers
- m_hsync_timer = timer_alloc(TIMER_HSYNC);
- m_vsync_timer = timer_alloc(TIMER_VSYNC);
- m_vlt_timer = timer_alloc(TIMER_VLT);
- m_curs_timer = timer_alloc(TIMER_CURS);
- m_drb_timer = timer_alloc(TIMER_DRB);
- m_dma_timer = timer_alloc(TIMER_DMA);
- m_frame_timer = timer_alloc(TIMER_FRAME);
+ m_hsync_timer = timer_alloc(FUNC(crt9007_device::hsync_update), this);
+ m_vsync_timer = timer_alloc(FUNC(crt9007_device::vsync_update), this);
+ m_vlt_timer = timer_alloc(FUNC(crt9007_device::vlt_update), this);
+ m_curs_timer = timer_alloc(FUNC(crt9007_device::cursor_update), this);
+ m_drb_timer = timer_alloc(FUNC(crt9007_device::drb_update), this);
+ m_dma_timer = timer_alloc(FUNC(crt9007_device::dma_update), this);
+ m_frame_timer = timer_alloc(FUNC(crt9007_device::frame_update), this);
// save state
save_item(NAME(m_reg));
@@ -605,100 +605,97 @@ void crt9007_device::device_clock_changed()
//-------------------------------------------------
-// device_timer - handle timer events
+// timer events
//-------------------------------------------------
-void crt9007_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(crt9007_device::hsync_update)
{
- int x = screen().hpos();
- int y = screen().vpos();
-
- switch (id)
- {
- case TIMER_HSYNC:
- m_hs = bool(param);
-
- LOG("CRT9007 y %03u x %04u : HS %u\n", y, x, m_hs);
+ m_hs = bool(param);
- m_write_hs(m_hs);
+ LOG("CRT9007 y %03u x %04u : HS %u\n", screen().vpos(), screen().hpos(), m_hs);
- update_cblank_line();
+ m_write_hs(m_hs);
- update_hsync_timer(m_hs);
- break;
+ update_cblank_line();
- case TIMER_VSYNC:
- m_vs = bool(param);
+ update_hsync_timer(m_hs);
+}
- LOG("CRT9007 y %03u x %04u : VS %u\n", y, x, m_vs);
+TIMER_CALLBACK_MEMBER(crt9007_device::vsync_update)
+{
+ m_vs = bool(param);
- m_write_vs(m_vs);
+ LOG("CRT9007 y %03u x %04u : VS %u\n", screen().vpos(), screen().hpos(), m_vs);
- if (m_vs)
- {
- // reset all other bits except Light Pen Update to logic 0
- m_status &= (STATUS_LIGHT_PEN_UPDATE | STATUS_INTERRUPT_PENDING);
- }
- else
- {
- trigger_interrupt(IE_VERTICAL_RETRACE);
+ m_write_vs(m_vs);
- update_cblank_line();
- }
+ if (m_vs)
+ {
+ // reset all other bits except Light Pen Update to logic 0
+ m_status &= (STATUS_LIGHT_PEN_UPDATE | STATUS_INTERRUPT_PENDING);
+ }
+ else
+ {
+ trigger_interrupt(IE_VERTICAL_RETRACE);
- update_vsync_timer(m_vs);
- break;
+ update_cblank_line();
+ }
- case TIMER_VLT:
- m_vlt = bool(param);
+ update_vsync_timer(m_vs);
+}
- LOG("CRT9007 y %03u x %04u : VLT %u\n", y, x, m_vlt);
+TIMER_CALLBACK_MEMBER(crt9007_device::vlt_update)
+{
+ m_vlt = bool(param);
- m_write_vlt(m_vlt);
+ LOG("CRT9007 y %03u x %04u : VLT %u\n", screen().vpos(), screen().hpos(), m_vlt);
- update_vlt_timer(m_vlt);
- break;
+ m_write_vlt(m_vlt);
- case TIMER_CURS:
- LOG("CRT9007 y %03u x %04u : CURS %u\n", y, x, param);
+ update_vlt_timer(m_vlt);
+}
- m_write_curs(param);
+TIMER_CALLBACK_MEMBER(crt9007_device::cursor_update)
+{
+ LOG("CRT9007 y %03u x %04u : CURS %u\n", screen().vpos(), screen().hpos(), param);
- update_curs_timer(param);
- break;
+ m_write_curs(param);
- case TIMER_DRB:
- m_drb = bool(param);
+ update_curs_timer(param);
+}
- LOG("CRT9007 y %03u x %04u : DRB %u\n", y, x, m_drb);
+TIMER_CALLBACK_MEMBER(crt9007_device::drb_update)
+{
+ m_drb = bool(param);
- m_write_drb(m_drb);
+ LOG("CRT9007 y %03u x %04u : DRB %u\n", screen().vpos(), screen().hpos(), m_drb);
- if (!m_drb && !DMA_DISABLE)
- {
- // start DMA burst sequence
- m_dma_count = CHARACTERS_PER_DATA_ROW;
- m_dma_burst = DMA_BURST_COUNT ? (DMA_BURST_COUNT * 4) : CHARACTERS_PER_DATA_ROW;
- m_dma_delay = DMA_BURST_DELAY;
- m_dmar = true;
-
- LOG("CRT9007 DMAR 1\n");
- m_write_dmar(ASSERT_LINE);
- }
+ m_write_drb(m_drb);
- update_drb_timer(m_drb);
- break;
+ if (!m_drb && !DMA_DISABLE)
+ {
+ // start DMA burst sequence
+ m_dma_count = CHARACTERS_PER_DATA_ROW;
+ m_dma_burst = DMA_BURST_COUNT ? (DMA_BURST_COUNT * 4) : CHARACTERS_PER_DATA_ROW;
+ m_dma_delay = DMA_BURST_DELAY;
+ m_dmar = true;
+
+ LOG("CRT9007 DMAR 1\n");
+ m_write_dmar(ASSERT_LINE);
+ }
- case TIMER_DMA:
- readbyte(AUXILIARY_ADDRESS_2);
+ update_drb_timer(m_drb);
+}
- update_dma_timer();
- break;
+TIMER_CALLBACK_MEMBER(crt9007_device::dma_update)
+{
+ readbyte(AUXILIARY_ADDRESS_2);
+ update_dma_timer();
+}
- case TIMER_FRAME:
- trigger_interrupt(IE_FRAME_TIMER);
- break;
- }
+TIMER_CALLBACK_MEMBER(crt9007_device::frame_update)
+{
+ trigger_interrupt(IE_FRAME_TIMER);
}
diff --git a/src/devices/video/crt9007.h b/src/devices/video/crt9007.h
index efa591bd1d0..433ca521f01 100644
--- a/src/devices/video/crt9007.h
+++ b/src/devices/video/crt9007.h
@@ -78,23 +78,19 @@ protected:
virtual void device_reset() override;
virtual void device_post_load() override;
virtual void device_clock_changed() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_memory_interface overrides
virtual space_config_vector memory_space_config() const override;
-private:
- enum
- {
- TIMER_HSYNC,
- TIMER_VSYNC,
- TIMER_VLT,
- TIMER_CURS,
- TIMER_DRB,
- TIMER_DMA,
- TIMER_FRAME
- };
+ TIMER_CALLBACK_MEMBER(hsync_update);
+ TIMER_CALLBACK_MEMBER(vsync_update);
+ TIMER_CALLBACK_MEMBER(vlt_update);
+ TIMER_CALLBACK_MEMBER(cursor_update);
+ TIMER_CALLBACK_MEMBER(drb_update);
+ TIMER_CALLBACK_MEMBER(dma_update);
+ TIMER_CALLBACK_MEMBER(frame_update);
+private:
void crt9007(address_map &map);
inline uint8_t readbyte(offs_t address);
diff --git a/src/devices/video/crtc_ega.cpp b/src/devices/video/crtc_ega.cpp
index 184800f2ef9..9e0accfc870 100644
--- a/src/devices/video/crtc_ega.cpp
+++ b/src/devices/video/crtc_ega.cpp
@@ -38,7 +38,8 @@ crtc_ega_device::crtc_ega_device(const machine_config &mconfig, const char *tag,
, m_hpixels_per_column(0), m_cur(0), m_hsync(0), m_vsync(0), m_vblank(0), m_de(0)
, m_character_counter(0), m_hsync_width_counter(0), m_line_counter(0), m_raster_counter(0), m_vsync_width_counter(0)
, m_line_enable_ff(false), m_vsync_ff(0), m_adjust_active(0), m_line_address(0), m_cursor_x(0)
- , m_line_timer(nullptr), m_de_off_timer(nullptr), m_cur_on_timer(nullptr), m_cur_off_timer(nullptr), m_hsync_on_timer(nullptr), m_hsync_off_timer(nullptr), m_light_pen_latch_timer(nullptr)
+ , m_line_timer(nullptr), m_de_off_timer(nullptr), m_cursor_on_timer(nullptr), m_cursor_off_timer(nullptr)
+ , m_hsync_on_timer(nullptr), m_hsync_off_timer(nullptr), m_light_pen_latch_timer(nullptr)
, m_horiz_pix_total(0), m_vert_pix_total(0), m_max_visible_x(0), m_max_visible_y(0)
, m_hsync_on_pos(0), m_hsync_off_pos(0), m_vsync_on_pos(0), m_vsync_off_pos(0)
, m_current_disp_addr(0), m_light_pen_latched(0), m_has_valid_parameters(false)
@@ -298,7 +299,7 @@ void crtc_ega_device::set_cur(int state)
}
-void crtc_ega_device::handle_line_timer()
+TIMER_CALLBACK_MEMBER(crtc_ega_device::handle_line_timer)
{
int new_vsync = m_vsync;
@@ -375,7 +376,7 @@ void crtc_ega_device::handle_line_timer()
m_cursor_x = m_cursor_addr - m_line_address;
/* Schedule CURSOR ON signal */
- m_cur_on_timer->adjust( attotime::from_ticks( m_cursor_x, m_clock ) );
+ m_cursor_on_timer->adjust( attotime::from_ticks( m_cursor_x, m_clock ), 1 );
}
}
@@ -396,56 +397,49 @@ void crtc_ega_device::handle_line_timer()
set_de( m_line_enable_ff ? true : false );
}
-
-void crtc_ega_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(crtc_ega_device::de_off_tick)
{
- switch (id)
- {
- case TIMER_LINE:
- handle_line_timer();
- break;
-
- case TIMER_DE_OFF:
- set_de( false );
- break;
+ set_de( false );
+}
- case TIMER_CUR_ON:
- set_cur( true );
+TIMER_CALLBACK_MEMBER(crtc_ega_device::cursor_on)
+{
+ set_cur( true );
- /* Schedule CURSOR off signal */
- m_cur_off_timer->adjust( attotime::from_ticks( 1, m_clock ) );
- break;
+ /* Schedule CURSOR off signal */
+ m_cursor_off_timer->adjust( attotime::from_ticks( 1, m_clock ), 0 );
+}
- case TIMER_CUR_OFF:
- set_cur( false );
- break;
+TIMER_CALLBACK_MEMBER(crtc_ega_device::cursor_off)
+{
+ set_cur( false );
+}
- case TIMER_HSYNC_ON:
- {
- int8_t hsync_width = ( 0x20 | m_horiz_blank_end ) - ( m_horiz_blank_start & 0x1f );
+TIMER_CALLBACK_MEMBER(crtc_ega_device::hsync_on)
+{
+ int8_t hsync_width = ( 0x20 | m_horiz_blank_end ) - ( m_horiz_blank_start & 0x1f );
- if ( hsync_width <= 0 )
- {
- hsync_width += 0x20;
- }
+ if ( hsync_width <= 0 )
+ {
+ hsync_width += 0x20;
+ }
- m_hsync_width_counter = 0;
- set_hsync( true );
+ m_hsync_width_counter = 0;
+ set_hsync( true );
- /* Schedule HSYNC off signal */
- m_hsync_off_timer->adjust( attotime::from_ticks( hsync_width, m_clock ) );
- }
- break;
+ /* Schedule HSYNC off signal */
+ m_hsync_off_timer->adjust( attotime::from_ticks( hsync_width, m_clock ) );
+}
- case TIMER_HSYNC_OFF:
- set_hsync( false );
- break;
+TIMER_CALLBACK_MEMBER(crtc_ega_device::hsync_off)
+{
+ set_hsync( false );
+}
- case TIMER_LIGHT_PEN_LATCH:
- m_light_pen_addr = get_ma();
- m_light_pen_latched = true;
- break;
- }
+TIMER_CALLBACK_MEMBER(crtc_ega_device::latch_light_pen)
+{
+ m_light_pen_addr = get_ma();
+ m_light_pen_latched = true;
}
@@ -605,13 +599,13 @@ void crtc_ega_device::device_start()
m_end_update_cb.resolve();
/* create the timers */
- m_line_timer = timer_alloc(TIMER_LINE);
- m_de_off_timer = timer_alloc(TIMER_DE_OFF);
- m_cur_on_timer = timer_alloc(TIMER_CUR_ON);
- m_cur_off_timer = timer_alloc(TIMER_CUR_OFF);
- m_hsync_on_timer = timer_alloc(TIMER_HSYNC_ON);
- m_hsync_off_timer = timer_alloc(TIMER_HSYNC_OFF);
- m_light_pen_latch_timer = timer_alloc(TIMER_LIGHT_PEN_LATCH);
+ m_line_timer = timer_alloc(FUNC(crtc_ega_device::handle_line_timer), this);
+ m_de_off_timer = timer_alloc(FUNC(crtc_ega_device::de_off_tick), this);
+ m_cursor_on_timer = timer_alloc(FUNC(crtc_ega_device::cursor_on), this);
+ m_cursor_off_timer = timer_alloc(FUNC(crtc_ega_device::cursor_off), this);
+ m_hsync_on_timer = timer_alloc(FUNC(crtc_ega_device::hsync_on), this);
+ m_hsync_off_timer = timer_alloc(FUNC(crtc_ega_device::hsync_off), this);
+ m_light_pen_latch_timer = timer_alloc(FUNC(crtc_ega_device::latch_light_pen), this);
/* Use some large startup values */
m_horiz_char_total = 0xff;
diff --git a/src/devices/video/crtc_ega.h b/src/devices/video/crtc_ega.h
index 1f1e65597ae..0a18cf7014a 100644
--- a/src/devices/video/crtc_ega.h
+++ b/src/devices/video/crtc_ega.h
@@ -73,7 +73,6 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_post_load() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
private:
devcb_write_line m_res_out_de_cb;
@@ -155,18 +154,10 @@ private:
int16_t m_cursor_x;
/* timers */
- static constexpr device_timer_id TIMER_LINE = 0;
- static constexpr device_timer_id TIMER_DE_OFF = 1;
- static constexpr device_timer_id TIMER_CUR_ON = 2;
- static constexpr device_timer_id TIMER_CUR_OFF = 3;
- static constexpr device_timer_id TIMER_HSYNC_ON = 4;
- static constexpr device_timer_id TIMER_HSYNC_OFF = 5;
- static constexpr device_timer_id TIMER_LIGHT_PEN_LATCH = 6;
-
emu_timer *m_line_timer;
emu_timer *m_de_off_timer;
- emu_timer *m_cur_on_timer;
- emu_timer *m_cur_off_timer;
+ emu_timer *m_cursor_on_timer;
+ emu_timer *m_cursor_off_timer;
emu_timer *m_hsync_on_timer;
emu_timer *m_hsync_off_timer;
emu_timer *m_light_pen_latch_timer;
@@ -191,7 +182,13 @@ private:
void set_vsync(int state);
void set_vblank(int state);
void set_cur(int state);
- void handle_line_timer();
+ TIMER_CALLBACK_MEMBER(handle_line_timer);
+ TIMER_CALLBACK_MEMBER(de_off_tick);
+ TIMER_CALLBACK_MEMBER(cursor_on);
+ TIMER_CALLBACK_MEMBER(cursor_off);
+ TIMER_CALLBACK_MEMBER(hsync_on);
+ TIMER_CALLBACK_MEMBER(hsync_off);
+ TIMER_CALLBACK_MEMBER(latch_light_pen);
void update_cursor_state();
};
diff --git a/src/devices/video/dp8350.cpp b/src/devices/video/dp8350.cpp
index 22e918b3374..e93960b5662 100644
--- a/src/devices/video/dp8350.cpp
+++ b/src/devices/video/dp8350.cpp
@@ -218,10 +218,10 @@ void dp835x_device::device_resolve_objects()
void dp835x_device::device_start()
{
// create timers
- m_hblank_start_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(dp835x_device::hblank_start), this));
- m_hblank_near_end_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(dp835x_device::hblank_near_end), this));
- m_hsync_on_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(dp835x_device::hsync_update), this));
- m_hsync_off_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(dp835x_device::hsync_update), this));
+ m_hblank_start_timer = timer_alloc(FUNC(dp835x_device::hblank_start), this);
+ m_hblank_near_end_timer = timer_alloc(FUNC(dp835x_device::hblank_near_end), this);
+ m_hsync_on_timer = timer_alloc(FUNC(dp835x_device::hsync_update), this);
+ m_hsync_off_timer = timer_alloc(FUNC(dp835x_device::hsync_update), this);
// save state
save_item(NAME(m_60hz_refresh));
diff --git a/src/devices/video/ef9340_1.cpp b/src/devices/video/ef9340_1.cpp
index 19a636d6ffb..05415b68c19 100644
--- a/src/devices/video/ef9340_1.cpp
+++ b/src/devices/video/ef9340_1.cpp
@@ -65,10 +65,10 @@ void ef9340_1_device::device_start()
// let the screen create our temporary bitmap with the screen's dimensions
screen().register_screen_bitmap(m_tmp_bitmap);
- m_line_timer = timer_alloc(TIMER_LINE);
+ m_line_timer = timer_alloc(FUNC(ef9340_1_device::draw_scanline), this);
m_line_timer->adjust(screen().time_until_pos(0, 0), 0, screen().scan_period());
- m_blink_timer = timer_alloc(TIMER_BLINK);
+ m_blink_timer = timer_alloc(FUNC(ef9340_1_device::blink_update), this);
m_blink_timer->adjust(screen().time_until_pos(0, 0), 0, screen().frame_period());
// zerofill
@@ -107,29 +107,19 @@ void ef9340_1_device::device_start()
}
-void ef9340_1_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(ef9340_1_device::blink_update)
{
- switch (id)
- {
- case TIMER_LINE:
- ef9340_scanline(screen().vpos());
- break;
-
- case TIMER_BLINK:
- // blink rate is approximately 0.5s
- m_ef9340.blink_prescaler = (m_ef9340.blink_prescaler + 1) & 0x1f;
- if (m_ef9340.R & 0x40 && m_ef9340.blink_prescaler == 24)
- m_ef9340.blink_prescaler = 0;
+ // blink rate is approximately 0.5s
+ m_ef9340.blink_prescaler = (m_ef9340.blink_prescaler + 1) & 0x1f;
+ if (m_ef9340.R & 0x40 && m_ef9340.blink_prescaler == 24)
+ m_ef9340.blink_prescaler = 0;
- if (m_ef9340.blink_prescaler == 0)
- m_ef9340.blink = !m_ef9340.blink;
-
- break;
- }
+ if (m_ef9340.blink_prescaler == 0)
+ m_ef9340.blink = !m_ef9340.blink;
}
-u16 ef9340_1_device::ef9340_get_c_addr(u8 x, u8 y)
+u16 ef9340_1_device::get_c_addr(u8 x, u8 y)
{
if ((y & 0x18) == 0x18)
{
@@ -143,7 +133,7 @@ u16 ef9340_1_device::ef9340_get_c_addr(u8 x, u8 y)
}
-void ef9340_1_device::ef9340_inc_c()
+void ef9340_1_device::inc_c()
{
m_ef9340.X++;
if (m_ef9340.X == 40 || m_ef9340.X == 48 || m_ef9340.X == 56 || m_ef9340.X == 64)
@@ -181,7 +171,7 @@ void ef9340_1_device::ef9341_write(u8 command, u8 b, u8 data)
m_ef9340.X = m_ef9341.TA & 0x3f;
break;
case 0x60: // increment C
- ef9340_inc_c();
+ inc_c();
break;
case 0x80: // load M
m_ef9340.M = m_ef9341.TA;
@@ -206,7 +196,7 @@ void ef9340_1_device::ef9341_write(u8 command, u8 b, u8 data)
{
if (b)
{
- u16 addr = ef9340_get_c_addr(m_ef9340.X, m_ef9340.Y) & 0x3ff;
+ u16 addr = get_c_addr(m_ef9340.X, m_ef9340.Y) & 0x3ff;
m_ef9341.TB = data;
m_ef9341.busy = true;
@@ -215,7 +205,7 @@ void ef9340_1_device::ef9341_write(u8 command, u8 b, u8 data)
case 0x00: // write
m_ram_a[addr] = m_ef9341.TA;
m_ram_b[addr] = m_ef9341.TB;
- ef9340_inc_c();
+ inc_c();
break;
case 0x40: // write without increment
@@ -271,7 +261,7 @@ u8 ef9340_1_device::ef9341_read(u8 command, u8 b)
{
if (b)
{
- u16 addr = ef9340_get_c_addr(m_ef9340.X, m_ef9340.Y) & 0x3ff;
+ u16 addr = get_c_addr(m_ef9340.X, m_ef9340.Y) & 0x3ff;
data = m_ef9341.TB;
m_ef9341.busy = true;
@@ -280,7 +270,7 @@ u8 ef9340_1_device::ef9341_read(u8 command, u8 b)
case 0x20: // read
m_ef9341.TA = m_ram_a[addr];
m_ef9341.TB = m_ram_b[addr];
- ef9340_inc_c();
+ inc_c();
break;
case 0x60: // read without increment
@@ -321,8 +311,9 @@ u8 ef9340_1_device::ef9341_read(u8 command, u8 b)
}
-void ef9340_1_device::ef9340_scanline(int vpos)
+TIMER_CALLBACK_MEMBER(ef9340_1_device::draw_scanline)
{
+ int vpos = screen().vpos();
vpos -= m_offset_y;
if (vpos < 0)
return;
@@ -370,7 +361,7 @@ void ef9340_1_device::ef9340_scanline(int vpos)
for (int x = 0; x < 40; x++)
{
int s = slice;
- u16 addr = ef9340_get_c_addr(x, y_row);
+ u16 addr = get_c_addr(x, y_row);
u8 a = m_ram_a[addr];
u8 b = m_ram_b[addr];
bool blink = m_ef9340.R & 0x80 && m_ef9340.blink;
diff --git a/src/devices/video/ef9340_1.h b/src/devices/video/ef9340_1.h
index 8f5c12e17fe..82e82eade27 100644
--- a/src/devices/video/ef9340_1.h
+++ b/src/devices/video/ef9340_1.h
@@ -68,18 +68,15 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual const tiny_rom_entry *device_rom_region() const override;
- inline u16 ef9340_get_c_addr(u8 x, u8 y);
- inline void ef9340_inc_c();
+ inline u16 get_c_addr(u8 x, u8 y);
+ inline void inc_c();
- void ef9340_scanline(int vpos);
+ TIMER_CALLBACK_MEMBER(draw_scanline);
+ TIMER_CALLBACK_MEMBER(blink_update);
// timers
- static constexpr device_timer_id TIMER_LINE = 0;
- static constexpr device_timer_id TIMER_BLINK = 1;
-
emu_timer *m_line_timer;
emu_timer *m_blink_timer;
diff --git a/src/devices/video/ef9345.cpp b/src/devices/video/ef9345.cpp
index 981b40f0c5e..df596e7f7a4 100644
--- a/src/devices/video/ef9345.cpp
+++ b/src/devices/video/ef9345.cpp
@@ -132,8 +132,8 @@ ts9347_device::ts9347_device(const machine_config &mconfig, const char *tag, dev
void ef9345_device::device_start()
{
- m_busy_timer = timer_alloc(BUSY_TIMER);
- m_blink_timer = timer_alloc(BLINKING_TIMER);
+ m_busy_timer = timer_alloc(FUNC(ef9345_device::clear_busy_flag), this);
+ m_blink_timer = timer_alloc(FUNC(ef9345_device::blink_tick), this);
m_videoram = &space(0);
@@ -192,20 +192,17 @@ void ef9345_device::device_reset()
}
//-------------------------------------------------
-// device_timer - handler timer events
+// timer events
//-------------------------------------------------
-void ef9345_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+
+TIMER_CALLBACK_MEMBER(ef9345_device::clear_busy_flag)
{
- switch(id)
- {
- case BUSY_TIMER:
- m_bf = 0;
- break;
+ m_bf = 0;
+}
- case BLINKING_TIMER:
- m_blink = !m_blink;
- break;
- }
+TIMER_CALLBACK_MEMBER(ef9345_device::blink_tick)
+{
+ m_blink = !m_blink;
}
diff --git a/src/devices/video/ef9345.h b/src/devices/video/ef9345.h
index 7c2f923574c..05db63cc150 100644
--- a/src/devices/video/ef9345.h
+++ b/src/devices/video/ef9345.h
@@ -52,7 +52,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_config_memory_interface overrides
virtual space_config_vector memory_space_config() const override;
@@ -60,12 +59,15 @@ protected:
// address space configurations
const address_space_config m_space_config;
- // inline helper
+ // inline helpers
inline uint16_t indexram(uint8_t r);
inline uint16_t indexrom(uint8_t r);
inline void inc_x(uint8_t r);
inline void inc_y(uint8_t r);
+ TIMER_CALLBACK_MEMBER(clear_busy_flag);
+ TIMER_CALLBACK_MEMBER(blink_tick);
+
private:
void set_busy_flag(int period);
void draw_char_40(uint8_t *c, uint16_t x, uint16_t y);
@@ -89,9 +91,6 @@ private:
void ef9345(address_map &map);
// internal state
- static const device_timer_id BUSY_TIMER = 0;
- static const device_timer_id BLINKING_TIMER = 1;
-
required_region_ptr<uint8_t> m_charset;
address_space *m_videoram;
diff --git a/src/devices/video/ef9365.cpp b/src/devices/video/ef9365.cpp
index 774437e15ff..bb1495836c9 100644
--- a/src/devices/video/ef9365.cpp
+++ b/src/devices/video/ef9365.cpp
@@ -12,7 +12,7 @@
This is natively a "black and white" chip (1 bitplane),
but it is possible to add more bitplanes to have colors with a
hardware trick. The system don't have direct access to the video
- memory, but indirect access is possible through the 0x0F command
+ memory, but indirect access is possible through the 0x0f command
and some hardware glue logics.
The current implementation emulate the main functions :
@@ -39,7 +39,7 @@
- Clear Screen
- Fill Screen
- Clear X & Y registers
- - Video RAM readback supported (Command 0x0F)
+ - Video RAM readback supported (Command 0x0f)
What is NOT yet currently implemented:
- Light pen support
@@ -80,10 +80,10 @@ namespace {
#define EF936X_REG_DELTAY 0x07
#define EF936X_REG_X_MSB 0x08
#define EF936X_REG_X_LSB 0x09
-#define EF936X_REG_Y_MSB 0x0A
-#define EF936X_REG_Y_LSB 0x0B
-#define EF936X_REG_XLP 0x0C
-#define EF936X_REG_YLP 0x0D
+#define EF936X_REG_Y_MSB 0x0a
+#define EF936X_REG_Y_LSB 0x0b
+#define EF936X_REG_XLP 0x0c
+#define EF936X_REG_YLP 0x0d
//-------------------------------------------------
@@ -144,8 +144,8 @@ const char *const commands_names[]=
DEFINE_DEVICE_TYPE(EF9365, ef9365_device, "ef9365", "Thomson EF9365")
ROM_START( ef9365 )
- ROM_REGION( 0x1E0, "ef9365", 0 )
- ROM_LOAD( "charset_ef9365.rom", 0x0000, 0x01E0, CRC(8d3053be) SHA1(0f9a64d217a0f7f04ee0720d49c5b680ad0ae359) )
+ ROM_REGION( 0x1e0, "ef9365", 0 )
+ ROM_LOAD( "charset_ef9365.rom", 0x0000, 0x01e0, CRC(8d3053be) SHA1(0f9a64d217a0f7f04ee0720d49c5b680ad0ae359) )
ROM_END
//-------------------------------------------------
@@ -211,7 +211,7 @@ ef9365_device::ef9365_device(const machine_config &mconfig, const char *tag, dev
void ef9365_device::set_nb_bitplanes(int nb_bitplanes)
{
- if( nb_bitplanes > 0 && nb_bitplanes <= 8 )
+ if (nb_bitplanes > 0 && nb_bitplanes <= 8)
{
nb_of_bitplanes = nb_bitplanes;
nb_of_colors = pow(2, nb_bitplanes);
@@ -230,44 +230,44 @@ void ef9365_device::set_display_mode(int display_mode)
bitplane_xres = 256;
bitplane_yres = 256;
vsync_scanline_pos = 250;
- overflow_mask_x = 0xFF00;
- overflow_mask_y = 0xFF00;
+ overflow_mask_x = 0xff00;
+ overflow_mask_y = 0xff00;
break;
case DISPLAY_MODE_512x512:
bitplane_xres = 512;
bitplane_yres = 512;
vsync_scanline_pos = 506;
- overflow_mask_x = 0xFE00;
- overflow_mask_y = 0xFE00;
+ overflow_mask_x = 0xfe00;
+ overflow_mask_y = 0xfe00;
break;
case DISPLAY_MODE_512x256:
bitplane_xres = 512;
bitplane_yres = 256;
vsync_scanline_pos = 250;
- overflow_mask_x = 0xFE00;
- overflow_mask_y = 0xFF00;
+ overflow_mask_x = 0xfe00;
+ overflow_mask_y = 0xff00;
break;
case DISPLAY_MODE_128x128:
bitplane_xres = 128;
bitplane_yres = 128;
vsync_scanline_pos = 124;
- overflow_mask_x = 0xFF80;
- overflow_mask_y = 0xFF80;
+ overflow_mask_x = 0xff80;
+ overflow_mask_y = 0xff80;
break;
case DISPLAY_MODE_64x64:
bitplane_xres = 64;
bitplane_yres = 64;
vsync_scanline_pos = 62;
- overflow_mask_x = 0xFFC0;
- overflow_mask_y = 0xFFC0;
+ overflow_mask_x = 0xffc0;
+ overflow_mask_y = 0xffc0;
break;
default:
logerror("Invalid EF9365 Display mode: %02x\n", display_mode);
bitplane_xres = 256;
bitplane_yres = 256;
vsync_scanline_pos = 250;
- overflow_mask_x = 0xFF00;
- overflow_mask_y = 0xFF00;
+ overflow_mask_x = 0xff00;
+ overflow_mask_y = 0xff00;
break;
}
}
@@ -277,9 +277,9 @@ void ef9365_device::set_display_mode(int display_mode)
// into the palette
//-------------------------------------------------
-void ef9365_device::set_color_entry( int index, uint8_t r, uint8_t g, uint8_t b )
+void ef9365_device::set_color_entry(int index, uint8_t r, uint8_t g, uint8_t b)
{
- if( index < nb_of_colors )
+ if (index < nb_of_colors)
{
m_palette->set_pen_color(index, rgb_t(r, g, b));
}
@@ -294,7 +294,7 @@ void ef9365_device::set_color_entry( int index, uint8_t r, uint8_t g, uint8_t b
// used by the chip to draw/fill the memory
//-------------------------------------------------
-void ef9365_device::set_color_filler( uint8_t color )
+void ef9365_device::set_color_filler(uint8_t color)
{
m_current_color = color;
}
@@ -307,7 +307,7 @@ void ef9365_device::device_start()
{
m_irq_handler.resolve_safe();
- m_busy_timer = timer_alloc(BUSY_TIMER);
+ m_busy_timer = timer_alloc(FUNC(ef9365_device::clear_busy_flag), this);
m_videoram = &space(0);
m_current_color = 0x00;
@@ -317,7 +317,7 @@ void ef9365_device::device_start()
m_irq_rdy = 0;
m_irq_state = 0;
- m_screen_out.allocate( bitplane_xres, screen().height() );
+ m_screen_out.allocate(bitplane_xres, screen().height());
save_item(NAME(m_border));
save_item(NAME(m_registers));
@@ -362,9 +362,9 @@ void ef9365_device::device_reset()
//-------------------------------------------------
void ef9365_device::update_interrupts()
{
- int new_state = ( m_irq_vb && (m_registers[EF936X_REG_CTRL1] & 0x20) )
- || ( m_irq_rdy && (m_registers[EF936X_REG_CTRL1] & 0x40) )
- || ( m_irq_lb && (m_registers[EF936X_REG_CTRL1] & 0x10) );
+ int new_state = (m_irq_vb && (m_registers[EF936X_REG_CTRL1] & 0x20))
+ || (m_irq_rdy && (m_registers[EF936X_REG_CTRL1] & 0x40))
+ || (m_irq_lb && (m_registers[EF936X_REG_CTRL1] & 0x10));
if (new_state != m_irq_state)
{
@@ -374,25 +374,19 @@ void ef9365_device::update_interrupts()
}
//-------------------------------------------------
-// device_timer - handler timer events
+// clear_busy_flag -
//-------------------------------------------------
-void ef9365_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(ef9365_device::clear_busy_flag)
{
- switch(id)
- {
- case BUSY_TIMER:
- m_bf = 0;
-
- if( m_registers[EF936X_REG_CTRL1] & 0x40 )
- {
- m_irq_rdy = 1;
- }
-
- update_interrupts();
+ m_bf = 0;
- break;
+ if (m_registers[EF936X_REG_CTRL1] & 0x40)
+ {
+ m_irq_rdy = 1;
}
+
+ update_interrupts();
}
//-------------------------------------------------
@@ -412,7 +406,7 @@ void ef9365_device::set_busy_flag(int period)
uint16_t ef9365_device::get_x_reg()
{
- return ((m_registers[EF936X_REG_X_MSB] & 0x0F)<<8) | m_registers[EF936X_REG_X_LSB];
+ return ((m_registers[EF936X_REG_X_MSB] & 0x0f) << 8) | m_registers[EF936X_REG_X_LSB];
}
//-------------------------------------------------
@@ -421,7 +415,7 @@ uint16_t ef9365_device::get_x_reg()
uint16_t ef9365_device::get_y_reg()
{
- return ((m_registers[EF936X_REG_Y_MSB] & 0x0F)<<8) | m_registers[EF936X_REG_Y_LSB];
+ return ((m_registers[EF936X_REG_Y_MSB] & 0x0f) << 8) | m_registers[EF936X_REG_Y_LSB];
}
//-------------------------------------------------
@@ -430,8 +424,8 @@ uint16_t ef9365_device::get_y_reg()
void ef9365_device::set_x_reg(uint16_t x)
{
- m_registers[EF936X_REG_X_MSB] = ( x >> 8 ) & 0x0F;
- m_registers[EF936X_REG_X_LSB] = x & 0xFF;
+ m_registers[EF936X_REG_X_MSB] = (x >> 8) & 0x0f;
+ m_registers[EF936X_REG_X_LSB] = x & 0xff;
}
//-------------------------------------------------
@@ -440,8 +434,8 @@ void ef9365_device::set_x_reg(uint16_t x)
void ef9365_device::set_y_reg(uint16_t y)
{
- m_registers[EF936X_REG_Y_MSB] = ( y >> 8 ) & 0x0F;
- m_registers[EF936X_REG_Y_LSB] = y & 0xFF;
+ m_registers[EF936X_REG_Y_MSB] = (y >> 8) & 0x0f;
+ m_registers[EF936X_REG_Y_LSB] = y & 0xff;
}
//-------------------------------------------------
@@ -469,12 +463,12 @@ void ef9365_device::set_video_mode(void)
// bitplane words
//-------------------------------------------------
-uint8_t ef9365_device::get_last_readback_word(int bitplane_number, int * pixel_offset)
+uint8_t ef9365_device::get_last_readback_word(int bitplane_number, int *pixel_offset)
{
- if( pixel_offset )
+ if (pixel_offset)
*pixel_offset = m_readback_latch_pix_offset;
- if( bitplane_number < nb_of_bitplanes )
+ if (bitplane_number < nb_of_bitplanes)
{
return m_readback_latch[bitplane_number];
}
@@ -486,7 +480,7 @@ uint8_t ef9365_device::get_last_readback_word(int bitplane_number, int * pixel_o
//-------------------------------------------------
// draw_border: Draw the left and right borders
-// ( No border for the moment ;) )
+// ( No border for the moment )
//-------------------------------------------------
void ef9365_device::draw_border(uint16_t line)
@@ -498,33 +492,35 @@ void ef9365_device::draw_border(uint16_t line)
// at the x & y position with the m_current_color color
//-------------------------------------------------
-void ef9365_device::plot(int x_pos,int y_pos)
+void ef9365_device::plot(int x_pos, int y_pos)
{
- int p;
-
- if( ( x_pos >= 0 && y_pos >= 0 ) && ( x_pos < bitplane_xres && y_pos < bitplane_yres ) )
+ if ((x_pos >= 0 && y_pos >= 0) && (x_pos < bitplane_xres && y_pos < bitplane_yres))
{
- if ( m_registers[EF936X_REG_CTRL1] & 0x01 )
+ if (m_registers[EF936X_REG_CTRL1] & 0x01)
{
- y_pos = ( (bitplane_yres - 1) - y_pos );
+ y_pos = (bitplane_yres - 1) - y_pos;
- if( (m_registers[EF936X_REG_CTRL1] & 0x02) )
+ if (m_registers[EF936X_REG_CTRL1] & 0x02)
{
// Pen
- for( p = 0 ; p < nb_of_bitplanes ; p++ )
+ for (int p = 0; p < nb_of_bitplanes; p++)
{
- if( m_current_color & (0x01 << p) )
- m_videoram->write_byte ( (BITPLANE_MAX_SIZE*p) + (((y_pos*bitplane_xres) + x_pos)>>3), m_videoram->read_byte( (BITPLANE_MAX_SIZE*p) + (((y_pos*bitplane_xres) + x_pos)>>3)) | (0x80 >> (((y_pos*bitplane_xres) + x_pos)&7) ) );
+ offs_t offset = BITPLANE_MAX_SIZE * p + ((y_pos * bitplane_xres + x_pos) >> 3);
+ uint8_t current_pix = m_videoram->read_byte(offset);
+ if (BIT(m_current_color, p))
+ m_videoram->write_byte(offset, current_pix | (0x80 >> ((y_pos * bitplane_xres + x_pos) & 7)));
else
- m_videoram->write_byte ( (BITPLANE_MAX_SIZE*p) + (((y_pos*bitplane_xres) + x_pos)>>3), m_videoram->read_byte( (BITPLANE_MAX_SIZE*p) + (((y_pos*bitplane_xres) + x_pos)>>3)) & ~(0x80 >> (((y_pos*bitplane_xres) + x_pos)&7) ) );
+ m_videoram->write_byte(offset, current_pix & ~(0x80 >> ((y_pos * bitplane_xres + x_pos) & 7)));
}
}
else
{
// Eraser
- for( p = 0 ; p < nb_of_bitplanes ; p++ )
+ for (int p = 0; p < nb_of_bitplanes; p++)
{
- m_videoram->write_byte ( (BITPLANE_MAX_SIZE*p) + (((y_pos*bitplane_xres) + x_pos)>>3), m_videoram->read_byte( (BITPLANE_MAX_SIZE*p) + (((y_pos*bitplane_xres) + x_pos)>>3)) | (0x80 >> (((y_pos*bitplane_xres) + x_pos)&7) ) );
+ offs_t offset = BITPLANE_MAX_SIZE * p + ((y_pos * bitplane_xres + x_pos) >> 3);
+ uint8_t current_pix = m_videoram->read_byte(offset);
+ m_videoram->write_byte(offset, current_pix | (0x80 >> ((y_pos * bitplane_xres + x_pos) & 7)));
}
}
}
@@ -532,68 +528,46 @@ void ef9365_device::plot(int x_pos,int y_pos)
}
-const static unsigned int vectortype_code[][8] =
+const static uint8_t vectortype_code[4][8] =
{
- {0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // Continuous drawing
- {0x82,0x02,0x00,0x00,0x00,0x00,0x00,0x00}, // Dotted - 2 dots on, 2 dots off
- {0x84,0x04,0x00,0x00,0x00,0x00,0x00,0x00}, // Dashed - 4 dots on, 4 dots off
- {0x8A,0x02,0x82,0x02,0x00,0x00,0x00,0x00} // Dotted-Dashed - 10 dots on, 2 dots off, 2 dots on, 2 dots off
+ { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, // Continuous drawing
+ { 0x82, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, // Dotted - 2 dots on, 2 dots off
+ { 0x84, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, // Dashed - 4 dots on, 4 dots off
+ { 0x8a, 0x02, 0x82, 0x02, 0x00, 0x00, 0x00, 0x00 } // Dotted-Dashed - 10 dots on, 2 dots off, 2 dots on, 2 dots off
};
//-------------------------------------------------
// draw_vector: Vector drawing function
-// from the start_x & start_y position to the start_x+delta_x & start_y+delta_y position
-// with the m_current_color color
+// from (start_x, start_y) to (start_x + delta_x, start_y + delta_y)
+// with m_current_color
// (Bresenham's line algorithm)
//-------------------------------------------------
-int ef9365_device::draw_vector(uint16_t start_x,uint16_t start_y,short delta_x,short delta_y)
+int ef9365_device::draw_vector(uint16_t start_x, uint16_t start_y, int16_t delta_x, int16_t delta_y)
{
- int dx;
- int dy,t;
- int e;
- int x,y,dest_x,dest_y,end_x,end_y;
- int incy;
- int diago,horiz;
- unsigned char c1;
+ LOG("EF9365 draw_vector : Start=(%d,%d) End=(%d,%d)\n", start_x, start_y, start_x + delta_x, start_y + delta_y);
- int pen_state;
- unsigned int state_counter;
- int dot_code_ptr;
- int compute_cycles;
+ int compute_cycles = 0;
- LOG("EF9365 draw_vector : Start=(%d,%d) End=(%d,%d)\n", start_x,start_y,start_x+delta_x,start_y+delta_y);
+ int16_t dest_x = start_x + delta_x;
+ int16_t dest_y = start_y + delta_y;
- compute_cycles = 0;
+ int16_t end_x = dest_x;
+ int16_t end_y = dest_y;
- dest_x = start_x + delta_x;
- dest_y = start_y + delta_y;
+ uint8_t c1 = 0;
+ int16_t incy = 1;
- end_x = dest_x;
- end_y = dest_y;
-
- c1=0;
- incy=1;
-
- dot_code_ptr = 0;
- state_counter = vectortype_code[m_registers[EF936X_REG_CTRL2] & 0x3][dot_code_ptr&7];
- if(state_counter&0x80)
- pen_state = 1;
- else
- pen_state = 0;
+ uint8_t dot_code_ptr = 0;
+ uint8_t state_counter = vectortype_code[m_registers[EF936X_REG_CTRL2] & 3][dot_code_ptr & 7];
+ uint8_t pen_state = BIT(state_counter, 7);
state_counter &= ~0x80;
- if( dest_x > start_x )
- dx = dest_x - start_x;
- else
- dx = start_x - dest_x;
-
- if( dest_y > start_y )
- dy = dest_y - start_y;
- else
- dy = start_y - dest_y;
+ int16_t dx = (dest_x > start_x) ? (dest_x - start_x) : (start_x - dest_x);
+ int16_t dy = (dest_y > start_y) ? (dest_y - start_y) : (start_y - dest_y);
- if( dy > dx )
+ int16_t t;
+ if (dy > dx)
{
t = dest_y;
dest_y = dest_x;
@@ -610,7 +584,7 @@ int ef9365_device::draw_vector(uint16_t start_x,uint16_t start_y,short delta_x,s
c1 = 1;
}
- if( start_x > dest_x )
+ if (start_x > dest_x)
{
t = dest_y;
dest_y = start_y;
@@ -621,23 +595,23 @@ int ef9365_device::draw_vector(uint16_t start_x,uint16_t start_y,short delta_x,s
dest_x = t;
}
- horiz = dy<<1;
- diago = ( dy - dx )<<1;
- e = ( dy<<1 ) - dx;
+ int16_t horiz = dy << 1;
+ int16_t diago = (dy - dx) << 1;
+ int16_t e = (dy << 1) - dx;
- if( start_y <= dest_y )
+ if (start_y <= dest_y)
incy = 1;
else
incy = -1;
- x = start_x;
- y = start_y;
+ int16_t x = start_x;
+ int16_t y = start_y;
- if(c1)
+ if (c1)
{
do
{
- if(pen_state)
+ if (pen_state)
plot(y % bitplane_xres, x % bitplane_yres);
compute_cycles++;
@@ -647,31 +621,23 @@ int ef9365_device::draw_vector(uint16_t start_x,uint16_t start_y,short delta_x,s
state_counter--;
- if( !state_counter )
+ if (!state_counter)
{
dot_code_ptr++;
- state_counter = vectortype_code[m_registers[EF936X_REG_CTRL2] & 0x3][dot_code_ptr&7];
+ state_counter = vectortype_code[m_registers[EF936X_REG_CTRL2] & 3][dot_code_ptr & 7];
- if(!state_counter)
+ if (!state_counter)
{
dot_code_ptr = 0;
- state_counter = vectortype_code[m_registers[EF936X_REG_CTRL2] & 0x3][dot_code_ptr&7];
- }
-
- if( state_counter & 0x80 )
- {
- pen_state = 1;
- }
- else
- {
- pen_state = 0;
+ state_counter = vectortype_code[m_registers[EF936X_REG_CTRL2] & 3][dot_code_ptr & 7];
}
+ pen_state = BIT(state_counter, 7);
state_counter &= ~0x80;
}
- if( e > 0 )
+ if (e > 0)
{
y = y + incy;
e = e + diago;
@@ -689,7 +655,7 @@ int ef9365_device::draw_vector(uint16_t start_x,uint16_t start_y,short delta_x,s
{
do
{
- if(pen_state)
+ if (pen_state)
plot(x % bitplane_xres, y % bitplane_yres);
compute_cycles++;
@@ -699,31 +665,23 @@ int ef9365_device::draw_vector(uint16_t start_x,uint16_t start_y,short delta_x,s
state_counter--;
- if( !state_counter )
+ if (!state_counter)
{
dot_code_ptr++;
- state_counter = vectortype_code[m_registers[EF936X_REG_CTRL2] & 0x3][dot_code_ptr&7];
+ state_counter = vectortype_code[m_registers[EF936X_REG_CTRL2] & 3][dot_code_ptr&7];
- if(!state_counter)
+ if (!state_counter)
{
dot_code_ptr = 0;
- state_counter = vectortype_code[m_registers[EF936X_REG_CTRL2] & 0x3][dot_code_ptr&7];
- }
-
- if( state_counter & 0x80 )
- {
- pen_state = 1;
- }
- else
- {
- pen_state = 0;
+ state_counter = vectortype_code[m_registers[EF936X_REG_CTRL2] & 3][dot_code_ptr&7];
}
+ pen_state = BIT(state_counter, 7);
state_counter &= ~0x80;
}
- if( e > 0 )
+ if (e > 0)
{
y = y + incy;
e = e + diago;
@@ -749,18 +707,16 @@ int ef9365_device::draw_vector(uint16_t start_x,uint16_t start_y,short delta_x,s
// from the charset.
//-------------------------------------------------
-int ef9365_device::get_char_pix( unsigned char c, int x, int y )
+int ef9365_device::get_char_pix(uint8_t c, int x, int y)
{
- int char_base,char_pix;
-
- if(c<96)
+ if (c < 96)
{
- if( x < 5 && y < 8 )
+ if (x < 5 && y < 8)
{
- char_base = c * 5;
- char_pix = ( y * 5 ) + x;
+ uint32_t char_base = c * 5;
+ uint32_t char_pix = (y * 5) + x;
- if ( m_charset[char_base + (char_pix>>3)] & ( 0x80 >> (char_pix&7)) )
+ if (BIT(m_charset[char_base + (char_pix >> 3)], ~char_pix & 7))
return 1;
else
return 0;
@@ -776,87 +732,73 @@ int ef9365_device::get_char_pix( unsigned char c, int x, int y )
// Set block to draw a 5x8 block
//-------------------------------------------------
-int ef9365_device::draw_character( unsigned char c, int block, int smallblock )
+int ef9365_device::draw_character(uint8_t c, bool block, bool smallblock)
{
- int x_char,y_char;
- unsigned int x, y;
- int x_char_res,y_char_res;
- int p_factor,q_factor,p,q;
- int compute_cycles;
-
- x = get_x_reg();
- y = get_y_reg();
+ uint16_t x = get_x_reg();
+ uint16_t y = get_y_reg();
- x_char_res = 5;
- y_char_res = 8;
+ int x_char_res = 5;
+ int y_char_res = 8;
- if( smallblock )
+ if (smallblock)
{
- block = 1;
+ block = true;
x_char_res = 4;
y_char_res = 4;
}
- p_factor = (m_registers[EF936X_REG_CSIZE] >> 4);
- if(!p_factor)
+ uint8_t p_factor = m_registers[EF936X_REG_CSIZE] >> 4;
+ if (!p_factor)
p_factor = 16;
- q_factor = (m_registers[EF936X_REG_CSIZE] & 0xF);
- if(!q_factor)
+ uint8_t q_factor = m_registers[EF936X_REG_CSIZE] & 0xf;
+ if (!q_factor)
q_factor = 16;
- compute_cycles = ( ( x_char_res + 1 ) * p_factor ) * ( y_char_res * q_factor );
+ int compute_cycles = ((x_char_res + 1) * p_factor) * (y_char_res * q_factor);
- if(c<96)
+ if (c < 0x60)
{
- for( x_char=0 ; x_char < x_char_res ; x_char++ )
+ for (int x_char = 0; x_char < x_char_res; x_char++)
{
- for( y_char = y_char_res - 1 ; y_char >= 0 ; y_char-- )
+ for (int y_char = y_char_res - 1; y_char >= 0; y_char--)
{
- if ( block || get_char_pix( c, x_char, ( (y_char_res - 1) - y_char ) ) )
+ if (block || get_char_pix(c, x_char, ((y_char_res - 1) - y_char)))
{
- if( m_registers[EF936X_REG_CTRL2] & 0x04) // Tilted character
+ if (m_registers[EF936X_REG_CTRL2] & 0x04) // Oblique mode
{
- for(q = 0; q < q_factor; q++)
+ for (uint16_t q = 0; q < q_factor; q++)
{
- for(p = 0; p < p_factor; p++)
+ for (uint16_t p = 0; p < p_factor; p++)
{
- if( !(m_registers[EF936X_REG_CTRL2] & 0x08) )
- { // Tilted - Horizontal orientation
- plot(
- x + ( (y_char*q_factor) + q ) + ( (x_char*p_factor) + p ),
- y + ( (y_char*q_factor) + q )
- );
+ if (!(m_registers[EF936X_REG_CTRL2] & 0x08))
+ {
+ // Oblique - Horizontal orientation
+ plot(x + ((y_char * q_factor) + q) + ((x_char * p_factor) + p), y + ((y_char * q_factor) + q));
}
else
- { // Tilted - Vertical orientation
- plot(
- x - ( (y_char*q_factor)+ q ),
- y + ( (x_char*p_factor)+ p ) - ( ( ( (y_char_res - 1 ) - y_char) * q_factor ) + ( q_factor - q ) )
- );
+ {
+ // Oblique - Vertical orientation
+ plot(x - ((y_char * q_factor) + q), y + ((x_char * p_factor) + p) - ((((y_char_res - 1) - y_char) * q_factor) + (q_factor - q)));
}
}
}
}
else
{
- for(q = 0; q < q_factor; q++)
+ for (uint16_t q = 0; q < q_factor; q++)
{
- for(p = 0; p < p_factor; p++)
+ for (uint16_t p = 0; p < p_factor; p++)
{
- if( !(m_registers[EF936X_REG_CTRL2] & 0x08) )
- { // Normal - Horizontal orientation
- plot(
- x + ( (x_char*p_factor) + p ),
- y + ( (y_char*q_factor) + q )
- );
+ if (!(m_registers[EF936X_REG_CTRL2] & 0x08))
+ {
+ // Normal - Horizontal orientation
+ plot(x + ((x_char * p_factor) + p), y + ((y_char * q_factor) + q));
}
else
- { // Normal - Vertical orientation
- plot(
- x - ( (y_char*q_factor) + q ),
- y + ( (x_char*p_factor) + p )
- );
+ {
+ // Normal - Vertical orientation
+ plot(x - ((y_char * q_factor) + q), y + ((x_char * p_factor) + p));
}
}
}
@@ -864,17 +806,15 @@ int ef9365_device::draw_character( unsigned char c, int block, int smallblock )
}
}
}
+ }
- if(!(m_registers[EF936X_REG_CTRL2] & 0x08))
- {
- x = x + ( (x_char_res + 1 ) * p_factor ) ;
- set_x_reg(x);
- }
- else
- {
- y = y + ( (x_char_res + 1 ) * p_factor ) ;
- set_y_reg(y);
- }
+ if (!(m_registers[EF936X_REG_CTRL2] & 0x08))
+ {
+ set_x_reg(x + (x_char_res + 1) * p_factor);
+ }
+ else
+ {
+ set_y_reg(y + (x_char_res + 1) * p_factor);
}
return compute_cycles;
@@ -886,7 +826,7 @@ int ef9365_device::draw_character( unsigned char c, int block, int smallblock )
int ef9365_device::cycles_to_us(int cycles)
{
- return ( (float)cycles * ( (float)1000000 / (float)clock_freq ) );
+ return (int)(cycles * (1000000.f / clock_freq));
}
//-------------------------------------------------
@@ -897,62 +837,66 @@ int ef9365_device::cycles_to_us(int cycles)
void ef9365_device::dump_bitplanes_word()
{
- int p;
- int pixel_ptr;
+ int pixel_ptr = (((bitplane_yres - 1) - (get_y_reg() & (bitplane_yres - 1))) * bitplane_xres) + (get_x_reg() & (bitplane_xres - 1));
- pixel_ptr = ( ( ( ( bitplane_yres - 1 ) - ( get_y_reg() & ( bitplane_yres - 1 ) ) ) * bitplane_xres ) + ( get_x_reg() & ( bitplane_xres - 1 ) ) );
+ LOG("dump : x = %d , y = %d\n", get_x_reg(), get_y_reg());
- LOG("dump : x = %d , y = %d\n", get_x_reg() ,get_y_reg());
-
- for( p = 0; p < nb_of_bitplanes ; p++ )
+ for (int p = 0; p < nb_of_bitplanes; p++)
{
- if( pixel_ptr & 0x4 )
+ const uint8_t value = m_videoram->read_byte(BITPLANE_MAX_SIZE * p + (pixel_ptr >> 3));
+ if (pixel_ptr & 0x4)
{
- m_readback_latch[p] = ( m_videoram->read_byte( (BITPLANE_MAX_SIZE*p) + (pixel_ptr>>3) ) ) & 0xF ;
+ m_readback_latch[p] = value & 0xf;
}
else
{
- m_readback_latch[p] = ( m_videoram->read_byte( (BITPLANE_MAX_SIZE*p) + (pixel_ptr>>3) ) >> 4 ) & 0xF ;
+ m_readback_latch[p] = (value >> 4) & 0xf;
}
}
- m_readback_latch_pix_offset = pixel_ptr & 0x3;
+ m_readback_latch_pix_offset = pixel_ptr & 3;
}
//-------------------------------------------------
// screen_scanning: Fill / Clear framebuffer memory
//-------------------------------------------------
-void ef9365_device::screen_scanning( int force_clear )
+void ef9365_device::screen_scanning(bool force_clear)
{
- int x,y,p;
-
- if( (m_registers[EF936X_REG_CTRL1] & 0x02) && !force_clear )
+ if ((m_registers[EF936X_REG_CTRL1] & 0x02) && !force_clear)
{
- for( y = 0; y < bitplane_yres; y++ )
+ for (int y = 0; y < bitplane_yres; y++)
{
- for( x = 0; x < bitplane_xres; x++ )
+ for (int x = 0; x < bitplane_xres; x++)
{
- for( p = 0 ; p < nb_of_bitplanes ; p++ )
+ for (int p = 0; p < nb_of_bitplanes; p++)
{
- if( m_current_color & (0x01 << p) )
- m_videoram->write_byte ( (BITPLANE_MAX_SIZE*p) + (((y*bitplane_xres) + x)>>3), m_videoram->read_byte( (BITPLANE_MAX_SIZE*p) + (((y*bitplane_xres) + x)>>3)) | (0x80 >> (((y*bitplane_xres) + x)&7) ) );
+ offs_t offset = BITPLANE_MAX_SIZE * p + ((y * bitplane_xres + x) >> 3);
+ uint8_t current_pix = m_videoram->read_byte(offset);
+ if (BIT(m_current_color, p))
+ {
+ m_videoram->write_byte(offset, current_pix | (0x80 >> ((y * bitplane_xres + x) & 7)));
+ }
else
- m_videoram->write_byte ( (BITPLANE_MAX_SIZE*p) + (((y*bitplane_xres) + x)>>3), m_videoram->read_byte( (BITPLANE_MAX_SIZE*p) + (((y*bitplane_xres) + x)>>3)) & ~(0x80 >> (((y*bitplane_xres) + x)&7) ) );
+ {
+ m_videoram->write_byte(offset, current_pix & ~(0x80 >> ((y * bitplane_xres + x) & 7)));
+ }
}
}
}
}
else
{
- for( y = 0; y < bitplane_yres; y++)
+ for (int y = 0; y < bitplane_yres; y++)
{
- for( x = 0; x < bitplane_xres; x++)
+ for (int x = 0; x < bitplane_xres; x++)
{
- for( p = 0 ; p < nb_of_bitplanes ; p++ )
+ for (int p = 0; p < nb_of_bitplanes; p++)
{
- m_videoram->write_byte ( (BITPLANE_MAX_SIZE*p) + (((y*bitplane_xres) + x)>>3), m_videoram->read_byte( (BITPLANE_MAX_SIZE*p) + (((y*bitplane_xres) + x)>>3)) | (0x80 >> (((y*bitplane_xres) + x)&7) ) );
+ offs_t offset = BITPLANE_MAX_SIZE * p + ((y * bitplane_xres + x) >> 3);
+ uint8_t current_pix = m_videoram->read_byte(offset);
+ m_videoram->write_byte(offset, current_pix | (0x80 >> ((y * bitplane_xres + x) & 7)));
}
}
}
@@ -965,177 +909,177 @@ void ef9365_device::screen_scanning( int force_clear )
void ef9365_device::ef9365_exec(uint8_t cmd)
{
- int tmp_delta_x,tmp_delta_y;
- int busy_cycles = 0;
m_state = 0;
- if( ( cmd>>4 ) == 0 )
+ if ((cmd >> 4) == 0)
{
- LOG("EF9365 Command : %s\n", commands_names[cmd & 0xF]);
+ LOG("EF9365 Command : %s\n", commands_names[cmd & 0xf]);
- switch(cmd & 0xF)
+ // All commands need time checked on the real hardware
+ int busy_cycles = 4;
+ switch(cmd & 0xf)
{
case 0x0: // Set bit 1 of CTRL1 : Pen Selection
m_registers[EF936X_REG_CTRL1] |= 0x02;
- set_busy_flag( cycles_to_us( 4 ) ); // Timing to check on the real hardware
- break;
+ break;
case 0x1: // Clear bit 1 of CTRL1 : Eraser Selection
m_registers[EF936X_REG_CTRL1] &= (~0x02);
- set_busy_flag( cycles_to_us( 4 ) ); // Timing to check on the real hardware
- break;
+ break;
case 0x2: // Set bit 0 of CTRL1 : Pen/Eraser down selection
m_registers[EF936X_REG_CTRL1] |= 0x01;
- set_busy_flag( cycles_to_us( 4 ) ); // Timing to check on the real hardware
- break;
+ break;
case 0x3: // Clear bit 0 of CTRL1 : Pen/Eraser up selection
m_registers[EF936X_REG_CTRL1] &= (~0x01);
- set_busy_flag( cycles_to_us( 4 ) ); // Timing to check on the real hardware
- break;
+ break;
case 0x4: // Clear screen
screen_scanning(1);
- set_busy_flag( cycles_to_us( bitplane_xres*bitplane_yres ) ); // Timing to check on the real hardware
- break;
+ busy_cycles = bitplane_xres * bitplane_yres;
+ break;
case 0x5: // X and Y registers reset to 0
set_x_reg(0);
set_y_reg(0);
- set_busy_flag( cycles_to_us( 4 ) ); // Timing to check on the real hardware
- break;
+ break;
case 0x6: // X and Y registers reset to 0 and clear screen
set_x_reg(0);
set_y_reg(0);
screen_scanning(1);
- set_busy_flag( cycles_to_us( bitplane_xres*bitplane_yres ) ); // Timing to check on the real hardware
- break;
+ busy_cycles = bitplane_xres * bitplane_yres;
+ break;
case 0x7: // Clear screen, set CSIZE to code "minsize". All other registers reset to 0
m_registers[EF936X_REG_CSIZE] = 0x11;
screen_scanning(1);
- set_busy_flag( cycles_to_us( bitplane_xres*bitplane_yres ) ); // Timing to check on the real hardware
- break;
+ busy_cycles = bitplane_xres * bitplane_yres;
+ break;
case 0x8: // Light-pen initialization (/White forced low)
- set_busy_flag( cycles_to_us( 4 ) ); // Timing to check on the real hardware
- break;
+ break;
case 0x9: // Light-pen initialization
- set_busy_flag( cycles_to_us( 4 ) ); // Timing to check on the real hardware
- break;
- case 0xA: // 5x8 block drawing (size according to CSIZE)
- busy_cycles = draw_character( 0x00 , 1 , 0 );
- set_busy_flag( cycles_to_us( busy_cycles ) );
- break;
- case 0xB: // 4x4 block drawing (size according to CSIZE)
- busy_cycles = draw_character( 0x00 , 1 , 1 );
- set_busy_flag( cycles_to_us( busy_cycles ) );
- break;
- case 0xC: // Screen scanning : pen or Eraser as defined by CTRL1
+ break;
+ case 0xa: // 5x8 block drawing (size according to CSIZE)
+ busy_cycles = draw_character(0x00, true, false);
+ break;
+ case 0xb: // 4x4 block drawing (size according to CSIZE)
+ busy_cycles = draw_character(0x00, true, true);
+ break;
+ case 0xc: // Screen scanning : pen or Eraser as defined by CTRL1
screen_scanning(0);
- set_busy_flag( cycles_to_us( bitplane_xres*bitplane_yres ) ); // Timing to check on the real hardware
- break;
- case 0xD: // X reset to 0
+ busy_cycles = bitplane_xres * bitplane_yres;
+ break;
+ case 0xd: // X reset to 0
set_x_reg(0);
- set_busy_flag( cycles_to_us( 4 ) ); // Timing to check on the real hardware
- break;
- case 0xE: // Y reset to 0
+ break;
+ case 0xe: // Y reset to 0
set_y_reg(0);
- set_busy_flag( cycles_to_us( 4 ) ); // Timing to check on the real hardware
- break;
- case 0xF: // Direct image memory access request for the next free cycle.
- set_busy_flag( cycles_to_us( 64 ) ); // Timing to check on the real hardware
+ break;
+ case 0xf: // Direct image memory access request for the next free cycle.
+ busy_cycles = 64;
dump_bitplanes_word();
- break;
+ break;
default:
logerror("Unemulated EF9365 cmd: %02x\n", cmd);
+ busy_cycles = 0;
+ break;
+ }
+
+ if (busy_cycles)
+ {
+ set_busy_flag(cycles_to_us(busy_cycles));
}
}
else
{
- if ( ( cmd>>4 ) == 1 )
+ if ((cmd >> 4) == 1)
{
- if( cmd & 0x08 )
+ int busy_cycles = 0;
+
+ if (cmd & 0x08)
LOG("EF9365 Command : [0x%.2X] %s\n", cmd, commands_names[0x11]);
else
LOG("EF9365 Command : [0x%.2X] %s\n", cmd, commands_names[0x10]);
- tmp_delta_x = m_registers[EF936X_REG_DELTAX];
- tmp_delta_y = m_registers[EF936X_REG_DELTAY];
+ int tmp_delta_x = m_registers[EF936X_REG_DELTAX];
+ int tmp_delta_y = m_registers[EF936X_REG_DELTAY];
- if( cmd & 0x08 )
+ if (cmd & 0x08)
{
- if(tmp_delta_x > tmp_delta_y )
+ if (tmp_delta_x > tmp_delta_y)
tmp_delta_y = tmp_delta_x;
- if(tmp_delta_y > tmp_delta_x )
+ if (tmp_delta_y > tmp_delta_x)
tmp_delta_y = tmp_delta_x;
}
// Vector / Special direction vector generation
- switch ( cmd & 0x7 ) // Direction code
+ switch (cmd & 0x7) // Direction code
{
case 0x1:
- busy_cycles = draw_vector ( get_x_reg(), get_y_reg(), tmp_delta_x, tmp_delta_y );
- break;
+ busy_cycles = draw_vector(get_x_reg(), get_y_reg(), tmp_delta_x, tmp_delta_y);
+ break;
case 0x3:
- busy_cycles = draw_vector ( get_x_reg(), get_y_reg(), -tmp_delta_x, tmp_delta_y );
- break;
+ busy_cycles = draw_vector(get_x_reg(), get_y_reg(), -tmp_delta_x, tmp_delta_y);
+ break;
case 0x5:
- busy_cycles = draw_vector ( get_x_reg(), get_y_reg(), tmp_delta_x, -tmp_delta_y );
- break;
+ busy_cycles = draw_vector(get_x_reg(), get_y_reg(), tmp_delta_x, -tmp_delta_y);
+ break;
case 0x7:
- busy_cycles = draw_vector ( get_x_reg(), get_y_reg(), -tmp_delta_x, -tmp_delta_y );
- break;
+ busy_cycles = draw_vector(get_x_reg(), get_y_reg(), -tmp_delta_x, -tmp_delta_y);
+ break;
case 0x0:
- busy_cycles = draw_vector ( get_x_reg(), get_y_reg(), tmp_delta_x, 0 );
- break;
+ busy_cycles = draw_vector(get_x_reg(), get_y_reg(), tmp_delta_x, 0);
+ break;
case 0x2:
- busy_cycles = draw_vector ( get_x_reg(), get_y_reg(), 0, tmp_delta_y );
- break;
+ busy_cycles = draw_vector(get_x_reg(), get_y_reg(), 0, tmp_delta_y);
+ break;
case 0x4:
- busy_cycles = draw_vector ( get_x_reg(), get_y_reg(), 0, -tmp_delta_y );
- break;
+ busy_cycles = draw_vector(get_x_reg(), get_y_reg(), 0, -tmp_delta_y);
+ break;
case 0x6:
- busy_cycles = draw_vector ( get_x_reg(), get_y_reg(), -tmp_delta_x , 0 );
- break;
+ busy_cycles = draw_vector(get_x_reg(), get_y_reg(), -tmp_delta_x, 0);
+ break;
}
- set_busy_flag( cycles_to_us( busy_cycles ) );
+ set_busy_flag(cycles_to_us(busy_cycles));
}
else
{
- if( ( cmd>>4 ) >= 0x8 )
+ if ((cmd >> 4) >= 0x8)
{
+ int busy_cycles = 0;
+
LOG("EF9365 Command : [0x%.2X] %s\n", cmd, commands_names[0x13]);
- tmp_delta_x = ( cmd >> 5 ) & 3;
- tmp_delta_y = ( cmd >> 3 ) & 3;
+ int tmp_delta_x = (cmd >> 5) & 3;
+ int tmp_delta_y = (cmd >> 3) & 3;
// Small vector.
- switch ( cmd & 0x7 ) // Direction code
+ switch (cmd & 0x7) // Direction code
{
case 0x1:
- busy_cycles = draw_vector ( get_x_reg(), get_y_reg(), tmp_delta_x, tmp_delta_y );
- break;
+ busy_cycles = draw_vector(get_x_reg(), get_y_reg(), tmp_delta_x, tmp_delta_y);
+ break;
case 0x3:
- busy_cycles = draw_vector ( get_x_reg(), get_y_reg(), -tmp_delta_x, tmp_delta_y );
- break;
+ busy_cycles = draw_vector(get_x_reg(), get_y_reg(), -tmp_delta_x, tmp_delta_y);
+ break;
case 0x5:
- busy_cycles = draw_vector ( get_x_reg(), get_y_reg(), tmp_delta_x, -tmp_delta_y );
- break;
+ busy_cycles = draw_vector(get_x_reg(), get_y_reg(), tmp_delta_x, -tmp_delta_y);
+ break;
case 0x7:
- busy_cycles = draw_vector ( get_x_reg(), get_y_reg(), -tmp_delta_x, -tmp_delta_y );
- break;
+ busy_cycles = draw_vector(get_x_reg(), get_y_reg(), -tmp_delta_x, -tmp_delta_y);
+ break;
case 0x0:
- busy_cycles = draw_vector ( get_x_reg(), get_y_reg(), tmp_delta_x, 0 );
- break;
+ busy_cycles = draw_vector(get_x_reg(), get_y_reg(), tmp_delta_x, 0);
+ break;
case 0x2:
- busy_cycles = draw_vector ( get_x_reg(), get_y_reg(), 0, tmp_delta_y );
- break;
+ busy_cycles = draw_vector(get_x_reg(), get_y_reg(), 0, tmp_delta_y);
+ break;
case 0x4:
- busy_cycles = draw_vector ( get_x_reg(), get_y_reg(), 0, -tmp_delta_y );
- break;
+ busy_cycles = draw_vector(get_x_reg(), get_y_reg(), 0, -tmp_delta_y);
+ break;
case 0x6:
- busy_cycles = draw_vector ( get_x_reg(), get_y_reg(), -tmp_delta_x, 0 );
- break;
+ busy_cycles = draw_vector(get_x_reg(), get_y_reg(), -tmp_delta_x, 0);
+ break;
}
- set_busy_flag( cycles_to_us( busy_cycles ) );
+ set_busy_flag(cycles_to_us(busy_cycles));
}
else
{
@@ -1143,8 +1087,8 @@ void ef9365_device::ef9365_exec(uint8_t cmd)
LOG("EF9365 Command : [0x%.2X] %s\n", cmd, commands_names[0x12]);
- busy_cycles = draw_character( cmd - 0x20, 0 , 0 );
- set_busy_flag( cycles_to_us( busy_cycles ) );
+ int busy_cycles = draw_character(cmd - 0x20, false, false);
+ set_busy_flag(cycles_to_us(busy_cycles));
}
}
}
@@ -1156,23 +1100,23 @@ void ef9365_device::ef9365_exec(uint8_t cmd)
uint32_t ef9365_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
- for(int j=0;j<bitplane_yres;j++)
+ for (int j = 0; j < bitplane_yres; j++)
{
- for(int i=0;i<bitplane_xres;i++)
+ for (int i = 0; i < bitplane_xres; i++)
{
- unsigned char color_index = 0x00;
+ uint8_t color_index = 0x00;
- int ptr = ( bitplane_xres * j ) + i;
+ int ptr = (bitplane_xres * j) + i;
- for(int p = 0; p < nb_of_bitplanes; p++)
+ for (int p = 0; p < nb_of_bitplanes; p++)
{
- if( m_videoram->read_byte( (BITPLANE_MAX_SIZE*p) + (ptr>>3)) & (0x80>>(ptr&7)))
+ if (BIT(m_videoram->read_byte(BITPLANE_MAX_SIZE * p + (ptr >> 3)), ~ptr & 7))
{
- color_index |= (0x01<<p);
+ color_index |= 0x01 << p;
}
}
- m_screen_out.pix(j, i) = m_palette->pen( color_index );
+ m_screen_out.pix(j, i) = m_palette->pen(color_index);
}
}
@@ -1188,8 +1132,8 @@ void ef9365_device::update_scanline(uint16_t scanline)
{
if (scanline == vsync_scanline_pos)
{
- m_state |= (0x02); // vsync
- if( m_registers[EF936X_REG_CTRL1] & 0x20 )
+ m_state |= 0x02; // vsync
+ if (m_registers[EF936X_REG_CTRL1] & 0x20)
{
m_irq_vb = 1;
}
@@ -1199,7 +1143,7 @@ void ef9365_device::update_scanline(uint16_t scanline)
if (scanline == 0)
{
- m_state &= (~0x02);
+ m_state &= ~0x02;
draw_border(0);
}
}
@@ -1210,39 +1154,39 @@ void ef9365_device::update_scanline(uint16_t scanline)
uint8_t ef9365_device::data_r(offs_t offset)
{
- unsigned char return_value;
+ uint8_t return_value;
- switch(offset & 0xF)
+ switch (offset & 0xf)
{
case EF936X_REG_STATUS:
if (m_bf)
- m_state &= (~0x04);
+ m_state &= ~0x04;
else
m_state |= 0x04;
- if ( ( overflow_mask_x & get_x_reg() ) || ( overflow_mask_y & get_y_reg() ) )
+ if ((overflow_mask_x & get_x_reg()) || (overflow_mask_y & get_y_reg()))
{
m_state |= 0x08;
}
- if( m_irq_vb || m_irq_lb || m_irq_rdy )
+ if (m_irq_vb || m_irq_lb || m_irq_rdy)
{
m_state |= 0x80;
}
- if( m_irq_lb )
+ if (m_irq_lb)
{
m_state |= 0x10;
m_irq_lb = 0;
}
- if( m_irq_vb )
+ if (m_irq_vb)
{
m_state |= 0x20;
m_irq_vb = 0;
}
- if( m_irq_rdy )
+ if (m_irq_rdy)
{
m_state |= 0x40;
m_irq_rdy = 0;
@@ -1251,46 +1195,46 @@ uint8_t ef9365_device::data_r(offs_t offset)
update_interrupts();
return_value = m_state;
- break;
+ break;
case EF936X_REG_CTRL1:
- return_value = m_registers[EF936X_REG_CTRL1] & 0x7F;
- break;
+ return_value = m_registers[EF936X_REG_CTRL1] & 0x7f;
+ break;
case EF936X_REG_CTRL2:
- return_value = m_registers[EF936X_REG_CTRL2] & 0x0F;
- break;
+ return_value = m_registers[EF936X_REG_CTRL2] & 0x0f;
+ break;
case EF936X_REG_CSIZE:
return_value = m_registers[EF936X_REG_CSIZE];
- break;
+ break;
case EF936X_REG_DELTAX:
return_value = m_registers[EF936X_REG_DELTAX];
- break;
+ break;
case EF936X_REG_DELTAY:
return_value = m_registers[EF936X_REG_DELTAY];
- break;
+ break;
case EF936X_REG_X_MSB:
- return_value = m_registers[EF936X_REG_X_MSB] & 0x0F;
- break;
+ return_value = m_registers[EF936X_REG_X_MSB] & 0x0f;
+ break;
case EF936X_REG_X_LSB:
return_value = m_registers[EF936X_REG_X_LSB];
- break;
+ break;
case EF936X_REG_Y_MSB:
- return_value = m_registers[EF936X_REG_Y_MSB] & 0x0F;
- break;
+ return_value = m_registers[EF936X_REG_Y_MSB] & 0x0f;
+ break;
case EF936X_REG_Y_LSB:
return_value = m_registers[EF936X_REG_Y_LSB];
- break;
+ break;
case EF936X_REG_XLP:
- return_value = m_registers[EF936X_REG_XLP] & 0xFD;
- break;
+ return_value = m_registers[EF936X_REG_XLP] & 0xfd;
+ break;
case EF936X_REG_YLP:
return_value = m_registers[EF936X_REG_YLP];
- break;
+ break;
default:
- return_value = 0xFF;
- break;
+ return_value = 0xff;
+ break;
}
- LOG("EF9365 [ %s ] RD> [ 0x%.2X ] - %s\n", register_names[offset&0xF],return_value, machine().describe_context() );
+ LOG("EF9365 [ %s ] RD> [ 0x%.2X ] - %s\n", register_names[offset & 0xf], return_value, machine().describe_context());
return return_value;
}
@@ -1301,45 +1245,45 @@ uint8_t ef9365_device::data_r(offs_t offset)
void ef9365_device::data_w(offs_t offset, uint8_t data)
{
- LOG("EF9365 [ %s ] <WR [ 0x%.2X ] - %s\n", register_names[offset&0xF],data, machine().describe_context() );
+ LOG("EF9365 [ %s ] <WR [ 0x%.2X ] - %s\n", register_names[offset & 0xf], data, machine().describe_context());
- switch(offset & 0xF)
+ switch (offset & 0xf)
{
case EF936X_REG_CMD:
- ef9365_exec( data & 0xff);
- break;
+ ef9365_exec(data & 0xff);
+ break;
case EF936X_REG_CTRL1:
- m_registers[EF936X_REG_CTRL1] = data & 0x7F;
- break;
+ m_registers[EF936X_REG_CTRL1] = data & 0x7f;
+ break;
case EF936X_REG_CTRL2:
- m_registers[EF936X_REG_CTRL2] = data & 0x0F;
- break;
+ m_registers[EF936X_REG_CTRL2] = data & 0x0f;
+ break;
case EF936X_REG_CSIZE:
m_registers[EF936X_REG_CSIZE] = data;
- break;
+ break;
case EF936X_REG_DELTAX:
m_registers[EF936X_REG_DELTAX] = data;
- break;
+ break;
case EF936X_REG_DELTAY:
m_registers[EF936X_REG_DELTAY] = data;
- break;
+ break;
case EF936X_REG_X_MSB:
- m_registers[EF936X_REG_X_MSB] = data & 0x0F;
- break;
+ m_registers[EF936X_REG_X_MSB] = data & 0x0f;
+ break;
case EF936X_REG_X_LSB:
m_registers[EF936X_REG_X_LSB] = data;
- break;
+ break;
case EF936X_REG_Y_MSB:
- m_registers[EF936X_REG_Y_MSB] = data & 0x0F;
- break;
+ m_registers[EF936X_REG_Y_MSB] = data & 0x0f;
+ break;
case EF936X_REG_Y_LSB:
m_registers[EF936X_REG_Y_LSB] = data;
- break;
+ break;
case EF936X_REG_XLP:
- break;
+ break;
case EF936X_REG_YLP:
- break;
+ break;
default:
- break;
+ break;
}
}
diff --git a/src/devices/video/ef9365.h b/src/devices/video/ef9365.h
index 7017b4e4587..fd3e7497e11 100644
--- a/src/devices/video/ef9365.h
+++ b/src/devices/video/ef9365.h
@@ -61,7 +61,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual const tiny_rom_entry *device_rom_region() const override;
// device_config_memory_interface overrides
@@ -70,18 +69,20 @@ protected:
// address space configurations
const address_space_config m_space_config;
+ TIMER_CALLBACK_MEMBER(clear_busy_flag);
+
private:
- int get_char_pix( unsigned char c, int x, int y );
- void plot(int x_pos,int y_pos);
- int draw_character( unsigned char c, int block, int smallblock );
- int draw_vector(uint16_t start_x,uint16_t start_y,short delta_x,short delta_y);
+ int get_char_pix(uint8_t c, int x, int y);
+ void plot(int x_pos, int y_pos);
+ int draw_character(uint8_t c, bool block, bool smallblock);
+ int draw_vector(uint16_t start_x, uint16_t start_y, int16_t delta_x, int16_t delta_y);
uint16_t get_x_reg();
uint16_t get_y_reg();
void set_x_reg(uint16_t x);
void set_y_reg(uint16_t y);
- void screen_scanning( int force_clear );
+ void screen_scanning(bool force_clear);
void set_busy_flag(int period);
- void set_video_mode(void);
+ void set_video_mode();
void draw_border(uint16_t line);
void ef9365_exec(uint8_t cmd);
int cycles_to_us(int cycles);
@@ -91,8 +92,6 @@ private:
void ef9365(address_map &map);
// internal state
- static constexpr device_timer_id BUSY_TIMER = 0;
-
required_region_ptr<uint8_t> m_charset;
address_space *m_videoram;
diff --git a/src/devices/video/epic12.cpp b/src/devices/video/epic12.cpp
index d48e8a7726d..d0dfbf1fcae 100644
--- a/src/devices/video/epic12.cpp
+++ b/src/devices/video/epic12.cpp
@@ -58,7 +58,7 @@ void epic12_device::device_start()
m_ram16_copy = std::make_unique<u16[]>(m_main_ramsize / 2);
- m_blitter_delay_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(epic12_device::blitter_delay_callback),this));
+ m_blitter_delay_timer = timer_alloc(FUNC(epic12_device::blitter_delay_callback), this);
m_blitter_delay_timer->adjust(attotime::never);
m_firmware_pos = 0;
diff --git a/src/devices/video/fixfreq.h b/src/devices/video/fixfreq.h
index f0f279a2832..bb2fdde34a9 100644
--- a/src/devices/video/fixfreq.h
+++ b/src/devices/video/fixfreq.h
@@ -301,7 +301,6 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_post_load() override;
- //virtual void device_timer(emu_timer &timer, device_timer_id id, int param);
virtual ioport_constructor device_input_ports() const override;
diff --git a/src/devices/video/gb_lcd.cpp b/src/devices/video/gb_lcd.cpp
index baa139b0803..ac81c1398f3 100644
--- a/src/devices/video/gb_lcd.cpp
+++ b/src/devices/video/gb_lcd.cpp
@@ -365,7 +365,7 @@ void dmg_ppu_device::common_start()
m_vram = make_unique_clear<uint8_t[]>(m_vram_size);
machine().save().register_postload(save_prepost_delegate(FUNC(dmg_ppu_device::videoptr_restore), this));
- m_lcd_timer = timer_alloc();
+ m_lcd_timer = timer_alloc(FUNC(dmg_ppu_device::update_tick), this);
m_program_space = &m_lr35902->space(AS_PROGRAM);
@@ -1917,7 +1917,7 @@ void dmg_ppu_device::increment_scanline()
}
-void dmg_ppu_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(dmg_ppu_device::update_tick)
{
update_state();
}
diff --git a/src/devices/video/gb_lcd.h b/src/devices/video/gb_lcd.h
index d3f98ac1265..418868e5ce0 100644
--- a/src/devices/video/gb_lcd.h
+++ b/src/devices/video/gb_lcd.h
@@ -80,7 +80,8 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(update_tick);
void common_start();
void common_reset();
diff --git a/src/devices/video/gba_lcd.cpp b/src/devices/video/gba_lcd.cpp
index f5df7fa01e6..2d5f79306ef 100644
--- a/src/devices/video/gba_lcd.cpp
+++ b/src/devices/video/gba_lcd.cpp
@@ -1765,8 +1765,8 @@ void gba_lcd_device::device_start()
screen().register_screen_bitmap(m_bitmap);
/* create a timer to fire scanline functions */
- m_scan_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_lcd_device::perform_scan),this));
- m_hbl_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_lcd_device::perform_hbl),this));
+ m_scan_timer = timer_alloc(FUNC(gba_lcd_device::perform_scan), this);
+ m_hbl_timer = timer_alloc(FUNC(gba_lcd_device::perform_hbl), this);
m_scan_timer->adjust(screen().time_until_pos(0, 0));
save_item(NAME(m_regs));
diff --git a/src/devices/video/hd44352.cpp b/src/devices/video/hd44352.cpp
index 404119e6c71..12d431b21ef 100644
--- a/src/devices/video/hd44352.cpp
+++ b/src/devices/video/hd44352.cpp
@@ -57,7 +57,7 @@ void hd44352_device::device_start()
{
m_on_cb.resolve_safe();
- m_on_timer = timer_alloc(ON_TIMER);
+ m_on_timer = timer_alloc(FUNC(hd44352_device::on_tick), this);
m_on_timer->adjust(attotime::from_hz(m_clock/16384), 0, attotime::from_hz(m_clock/16384));
save_item( NAME(m_control_lines));
@@ -112,20 +112,12 @@ void hd44352_device::device_reset()
}
-//-------------------------------------------------
-// device_timer - handler timer events
-//-------------------------------------------------
-void hd44352_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(hd44352_device::on_tick)
{
- switch(id)
+ if (m_control_lines & 0x40)
{
- case ON_TIMER:
- if (m_control_lines & 0x40)
- {
- m_on_cb(ASSERT_LINE);
- m_on_cb(CLEAR_LINE);
- }
- break;
+ m_on_cb(ASSERT_LINE);
+ m_on_cb(CLEAR_LINE);
}
}
diff --git a/src/devices/video/hd44352.h b/src/devices/video/hd44352.h
index 2b81a5345de..a5b311c0e9f 100644
--- a/src/devices/video/hd44352.h
+++ b/src/devices/video/hd44352.h
@@ -36,14 +36,14 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_validity_check(validity_checker &valid) const override;
+ TIMER_CALLBACK_MEMBER(on_tick);
+
private:
uint8_t compute_newval(uint8_t type, uint8_t oldval, uint8_t newval);
uint8_t get_char(uint16_t pos);
- static const device_timer_id ON_TIMER = 1;
emu_timer *m_on_timer;
uint8_t m_video_ram[2][0x180];
diff --git a/src/devices/video/hd44780.cpp b/src/devices/video/hd44780.cpp
index 3fbea6e8349..7a543cf5077 100644
--- a/src/devices/video/hd44780.cpp
+++ b/src/devices/video/hd44780.cpp
@@ -113,8 +113,8 @@ void hd44780_device::device_start()
m_pixel_update_cb.resolve();
- m_busy_timer = timer_alloc(TIMER_BUSY);
- m_blink_timer = timer_alloc(TIMER_BLINKING);
+ m_busy_timer = timer_alloc(FUNC(hd44780_device::clear_busy_flag), this);
+ m_blink_timer = timer_alloc(FUNC(hd44780_device::blink_tick), this);
m_blink_timer->adjust(attotime::from_msec(409), 0, attotime::from_msec(409));
// state saving
@@ -178,21 +178,17 @@ void hd44780_device::device_reset()
//-------------------------------------------------
-// device_timer - handler timer events
+// timer events
//-------------------------------------------------
-void hd44780_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(hd44780_device::clear_busy_flag)
{
- switch (id)
- {
- case TIMER_BUSY:
- m_busy_flag = false;
- break;
+ m_busy_flag = false;
+}
- case TIMER_BLINKING:
- m_blink = !m_blink;
- break;
- }
+TIMER_CALLBACK_MEMBER(hd44780_device::blink_tick)
+{
+ m_blink = !m_blink;
}
diff --git a/src/devices/video/hd44780.h b/src/devices/video/hd44780.h
index f09747c2583..b1731ca6198 100644
--- a/src/devices/video/hd44780.h
+++ b/src/devices/video/hd44780.h
@@ -58,11 +58,13 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// optional information overrides
virtual const tiny_rom_entry *device_rom_region() const override;
+ TIMER_CALLBACK_MEMBER(clear_busy_flag);
+ TIMER_CALLBACK_MEMBER(blink_tick);
+
// charset
enum
{
@@ -96,9 +98,6 @@ private:
void pixel_update(bitmap_ind16 &bitmap, u8 line, u8 pos, u8 y, u8 x, int state);
// internal state
- static constexpr device_timer_id TIMER_BUSY = 0;
- static constexpr device_timer_id TIMER_BLINKING = 1;
-
emu_timer * m_blink_timer;
emu_timer * m_busy_timer;
diff --git a/src/devices/video/hd61830.cpp b/src/devices/video/hd61830.cpp
index 14fff0b3dff..9d2a8a5eb67 100644
--- a/src/devices/video/hd61830.cpp
+++ b/src/devices/video/hd61830.cpp
@@ -97,7 +97,7 @@ hd61830_device::hd61830_device(const machine_config &mconfig, const char *tag, d
void hd61830_device::device_start()
{
// allocate timers
- m_busy_timer = timer_alloc();
+ m_busy_timer = timer_alloc(FUNC(hd61830_device::clear_busy_flag), this);
// resolve callbacks
m_read_rd.resolve_safe(0);
@@ -134,12 +134,11 @@ void hd61830_device::device_reset()
//-------------------------------------------------
-// device_timer - handler timer events
+// clear_busy_flag -
//-------------------------------------------------
-void hd61830_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(hd61830_device::clear_busy_flag)
{
- // clear busy flag
m_bf = false;
}
diff --git a/src/devices/video/hd61830.h b/src/devices/video/hd61830.h
index c1177a908fc..83f5639ca14 100644
--- a/src/devices/video/hd61830.h
+++ b/src/devices/video/hd61830.h
@@ -41,7 +41,6 @@ protected:
virtual const tiny_rom_entry *device_rom_region() const override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_memory_interface overrides
virtual space_config_vector memory_space_config() const override;
@@ -49,6 +48,8 @@ protected:
uint8_t readbyte(offs_t address) { return space().read_byte(address); }
void writebyte(offs_t address, uint8_t data) { space().write_byte(address, data); }
+ TIMER_CALLBACK_MEMBER(clear_busy_flag);
+
private:
enum
{
diff --git a/src/devices/video/hd63484.h b/src/devices/video/hd63484.h
index 816aa6a8ce5..67383810bf6 100644
--- a/src/devices/video/hd63484.h
+++ b/src/devices/video/hd63484.h
@@ -47,7 +47,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- //virtual void device_timer(emu_timer &timer, device_timer_id id, int param);
inline uint16_t readword(offs_t address);
inline void writeword(offs_t address, uint16_t data);
diff --git a/src/devices/video/hlcd0438.cpp b/src/devices/video/hlcd0438.cpp
index 42317ddb087..fadc164dcb6 100644
--- a/src/devices/video/hlcd0438.cpp
+++ b/src/devices/video/hlcd0438.cpp
@@ -36,7 +36,7 @@ void hlcd0438_device::device_start()
m_write_data.resolve_safe();
// timer (when LCD pin is oscillator)
- m_lcd_timer = timer_alloc();
+ m_lcd_timer = timer_alloc(FUNC(hlcd0438_device::toggle_lcd), this);
attotime period = (clock() != 0) ? attotime::from_hz(2 * clock()) : attotime::never;
m_lcd_timer->adjust(period, 0, period);
@@ -55,6 +55,11 @@ void hlcd0438_device::device_start()
// handlers
//-------------------------------------------------
+TIMER_CALLBACK_MEMBER(hlcd0438_device::toggle_lcd)
+{
+ lcd_w(!m_lcd);
+}
+
void hlcd0438_device::clock_w(int state)
{
state = state ? 1 : 0;
diff --git a/src/devices/video/hlcd0438.h b/src/devices/video/hlcd0438.h
index c76bb4835ed..da6da51da39 100644
--- a/src/devices/video/hlcd0438.h
+++ b/src/devices/video/hlcd0438.h
@@ -58,7 +58,8 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override { lcd_w(!m_lcd); }
+
+ TIMER_CALLBACK_MEMBER(toggle_lcd);
private:
emu_timer *m_lcd_timer;
diff --git a/src/devices/video/hlcd0488.cpp b/src/devices/video/hlcd0488.cpp
index 984a5600e6c..98ab3937f54 100644
--- a/src/devices/video/hlcd0488.cpp
+++ b/src/devices/video/hlcd0488.cpp
@@ -37,7 +37,7 @@ hlcd0488_device::hlcd0488_device(const machine_config &mconfig, const char *tag,
void hlcd0488_device::device_start()
{
m_write_cols.resolve_safe();
- m_sync_timer = timer_alloc();
+ m_sync_timer = timer_alloc(FUNC(hlcd0488_device::sync_update), this);
// register for savestates
save_item(NAME(m_latch_pulse));
@@ -55,7 +55,7 @@ void hlcd0488_device::device_start()
// handlers
//-------------------------------------------------
-void hlcd0488_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(hlcd0488_device::sync_update)
{
// Latch pulse, when high, resets the %8 latch address counter
if (m_latch_pulse)
diff --git a/src/devices/video/hlcd0488.h b/src/devices/video/hlcd0488.h
index 66d72616374..c2302fbc88b 100644
--- a/src/devices/video/hlcd0488.h
+++ b/src/devices/video/hlcd0488.h
@@ -54,7 +54,8 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(sync_update);
private:
// pin state
diff --git a/src/devices/video/hlcd0515.cpp b/src/devices/video/hlcd0515.cpp
index 55a0183a11c..7af99f99657 100644
--- a/src/devices/video/hlcd0515.cpp
+++ b/src/devices/video/hlcd0515.cpp
@@ -63,7 +63,7 @@ void hlcd0515_device::device_start()
m_write_data.resolve_safe();
// timer
- m_lcd_timer = timer_alloc();
+ m_lcd_timer = timer_alloc(FUNC(hlcd0515_device::scan_lcd), this);
attotime period = attotime::from_hz(clock() / 2);
m_lcd_timer->adjust(period, 0, period);
@@ -99,10 +99,10 @@ void hlcd0515_device::device_start()
//-------------------------------------------------
-// device_timer - handle timer events
+// scan_lcd -
//-------------------------------------------------
-void hlcd0515_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(hlcd0515_device::scan_lcd)
{
if (m_rowout > m_rowmax)
m_rowout = 0;
diff --git a/src/devices/video/hlcd0515.h b/src/devices/video/hlcd0515.h
index fd1a5d2c147..c6ef5e118bf 100644
--- a/src/devices/video/hlcd0515.h
+++ b/src/devices/video/hlcd0515.h
@@ -60,7 +60,8 @@ protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(scan_lcd);
virtual void set_control();
void clock_data(int col = 0);
diff --git a/src/devices/video/hlcd0538.cpp b/src/devices/video/hlcd0538.cpp
index a5f731313e9..3cf1fd4a6f6 100644
--- a/src/devices/video/hlcd0538.cpp
+++ b/src/devices/video/hlcd0538.cpp
@@ -51,7 +51,7 @@ void hlcd0538_device::device_start()
m_write_interrupt.resolve_safe();
// timer (when LCD pin is oscillator)
- m_lcd_timer = timer_alloc();
+ m_lcd_timer = timer_alloc(FUNC(hlcd0538_device::toggle_lcd), this);
attotime period = (clock() != 0) ? attotime::from_hz(2 * clock()) : attotime::never;
m_lcd_timer->adjust(period, 0, period);
@@ -67,6 +67,11 @@ void hlcd0538_device::device_start()
// handlers
//-------------------------------------------------
+TIMER_CALLBACK_MEMBER(hlcd0538_device::toggle_lcd)
+{
+ lcd_w(!m_lcd);
+}
+
WRITE_LINE_MEMBER(hlcd0538_device::clk_w)
{
state = (state) ? 1 : 0;
diff --git a/src/devices/video/hlcd0538.h b/src/devices/video/hlcd0538.h
index f14598ac6c8..08a2f8ef437 100644
--- a/src/devices/video/hlcd0538.h
+++ b/src/devices/video/hlcd0538.h
@@ -58,7 +58,8 @@ protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override { lcd_w(!m_lcd); }
+
+ TIMER_CALLBACK_MEMBER(toggle_lcd);
emu_timer *m_lcd_timer;
diff --git a/src/devices/video/huc6260.cpp b/src/devices/video/huc6260.cpp
index 0830aa2bf90..cc41b86ac1d 100644
--- a/src/devices/video/huc6260.cpp
+++ b/src/devices/video/huc6260.cpp
@@ -63,7 +63,7 @@ huc6260_device::huc6260_device(const machine_config &mconfig, const char *tag, d
}
-void huc6260_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(huc6260_device::update_events)
{
int vpos = screen().vpos();
int hpos = screen().hpos();
@@ -255,7 +255,7 @@ void huc6260_device::write(offs_t offset, uint8_t data)
void huc6260_device::device_start()
{
- m_timer = timer_alloc();
+ m_timer = timer_alloc(FUNC(huc6260_device::update_events), this);
m_bmp = std::make_unique<bitmap_ind16>(WPF, LPF);
/* Resolve callbacks */
diff --git a/src/devices/video/huc6260.h b/src/devices/video/huc6260.h
index ef33f7a5cea..387bc6cd7f7 100644
--- a/src/devices/video/huc6260.h
+++ b/src/devices/video/huc6260.h
@@ -43,10 +43,11 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual uint32_t palette_entries() const override { return PALETTE_SIZE; }
+ TIMER_CALLBACK_MEMBER(update_events);
+
private:
void palette_init();
diff --git a/src/devices/video/huc6261.cpp b/src/devices/video/huc6261.cpp
index 546f117cf2d..27bd06c7e33 100644
--- a/src/devices/video/huc6261.cpp
+++ b/src/devices/video/huc6261.cpp
@@ -94,7 +94,7 @@ void huc6261_device::apply_pal_offs(uint16_t *pix_data)
*pix_data &= 0x1ff;
}
-void huc6261_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(huc6261_device::update_events)
{
int vpos = screen().vpos();
int hpos = screen().hpos();
@@ -414,7 +414,7 @@ void huc6261_device::write(offs_t offset, uint16_t data)
void huc6261_device::device_start()
{
- m_timer = timer_alloc();
+ m_timer = timer_alloc(FUNC(huc6261_device::update_events), this);
m_bmp = std::make_unique<bitmap_rgb32>(WPF, LPF);
diff --git a/src/devices/video/huc6261.h b/src/devices/video/huc6261.h
index b9d9b351c80..9995a20673b 100644
--- a/src/devices/video/huc6261.h
+++ b/src/devices/video/huc6261.h
@@ -38,7 +38,8 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(update_events);
private:
required_device<huc6270_device> m_huc6270_a;
diff --git a/src/devices/video/i8244.cpp b/src/devices/video/i8244.cpp
index 8ec529afee5..bea7014d9ad 100644
--- a/src/devices/video/i8244.cpp
+++ b/src/devices/video/i8244.cpp
@@ -153,10 +153,10 @@ void i8244_device::device_start()
m_irq_func.resolve_safe();
// allocate timers
- m_vblank_timer = timer_alloc(TIMER_VBLANK_START);
+ m_vblank_timer = timer_alloc(FUNC(i8244_device::vblank_start), this);
m_vblank_timer->adjust(screen().time_until_pos(m_vblank_start, m_hblank_start - 1), 0, screen().frame_period());
- m_hblank_timer = timer_alloc(TIMER_HBLANK_START);
+ m_hblank_timer = timer_alloc(FUNC(i8244_device::hblank_start), this);
m_hblank_timer->adjust(screen().time_until_pos(0, m_hblank_start), 0, screen().scan_period());
// allocate a stream
@@ -185,27 +185,20 @@ void i8244_device::device_start()
//-------------------------------------------------
-// device_timer - handle timer callbacks
+// timer events
//-------------------------------------------------
-void i8244_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(i8244_device::hblank_start)
{
- switch (id)
- {
- case TIMER_HBLANK_START:
- // hblank starts (updates sound shift register)
- sound_update();
- break;
-
- case TIMER_VBLANK_START:
- // vblank starts
- m_control_status |= 0x08;
- m_irq_func(ASSERT_LINE);
- break;
+ // hblank starts (updates sound shift register)
+ sound_update();
+}
- default:
- break;
- }
+TIMER_CALLBACK_MEMBER(i8244_device::vblank_start)
+{
+ // vblank starts
+ m_control_status |= 0x08;
+ m_irq_func(ASSERT_LINE);
}
diff --git a/src/devices/video/i8244.h b/src/devices/video/i8244.h
index 909d39b057d..f87382fa461 100644
--- a/src/devices/video/i8244.h
+++ b/src/devices/video/i8244.h
@@ -111,12 +111,14 @@ protected:
// device-level overrides
virtual void device_config_complete() override;
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual const tiny_rom_entry *device_rom_region() const override;
// device_sound_interface overrides
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
+ TIMER_CALLBACK_MEMBER(hblank_start);
+ TIMER_CALLBACK_MEMBER(vblank_start);
+
virtual void set_default_params();
inline bool is_ntsc() { return m_vtotal == 263; }
@@ -129,10 +131,6 @@ protected:
void draw_minor(int scanline, bitmap_ind16 &bitmap, const rectangle &cliprect);
void char_pixel(u8 index, int x, int y, u8 pixel, u16 color, bitmap_ind16 &bitmap, const rectangle &cliprect);
- /* timers */
- static constexpr device_timer_id TIMER_VBLANK_START = 0;
- static constexpr device_timer_id TIMER_HBLANK_START = 1;
-
// callbacks
devcb_write_line m_irq_func;
diff --git a/src/devices/video/i82730.cpp b/src/devices/video/i82730.cpp
index 70feabd7909..ba853c41680 100644
--- a/src/devices/video/i82730.cpp
+++ b/src/devices/video/i82730.cpp
@@ -81,7 +81,7 @@ void i82730_device::device_start()
m_update_row_cb.resolve();
// allocate row timer
- m_row_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(i82730_device::row_update), this));
+ m_row_timer = timer_alloc(FUNC(i82730_device::row_update), this);
}
//-------------------------------------------------
diff --git a/src/devices/video/i8275.cpp b/src/devices/video/i8275.cpp
index 2ea9570d712..1e080986e22 100644
--- a/src/devices/video/i8275.cpp
+++ b/src/devices/video/i8275.cpp
@@ -158,9 +158,9 @@ void i8275_device::device_start()
m_display_cb.resolve();
// allocate timers
- m_hrtc_on_timer = timer_alloc(TIMER_HRTC_ON);
- m_drq_on_timer = timer_alloc(TIMER_DRQ_ON);
- m_scanline_timer = timer_alloc(TIMER_SCANLINE);
+ m_hrtc_on_timer = timer_alloc(FUNC(i8275_device::hrtc_on), this);
+ m_drq_on_timer = timer_alloc(FUNC(i8275_device::drq_on), this);
+ m_scanline_timer = timer_alloc(FUNC(i8275_device::scanline_tick), this);
// state saving
save_item(NAME(m_status));
@@ -260,209 +260,198 @@ void i8275_device::dma_start()
//-------------------------------------------------
-// device_timer - handle timer events
+// timer events
//-------------------------------------------------
-void i8275_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(i8275_device::hrtc_on)
{
- //int y = screen().vpos();
- //int x = screen().hpos();
- int rc = m_scanline / SCANLINES_PER_ROW;
- int lc = m_scanline % SCANLINES_PER_ROW;
+ m_write_hrtc(1);
+}
- switch (id)
- {
- case TIMER_HRTC_ON:
- //LOG("I8275 y %u x %u HRTC 1\n", y, x);
- m_write_hrtc(1);
- break;
+TIMER_CALLBACK_MEMBER(i8275_device::drq_on)
+{
+ m_write_drq(1);
+}
- case TIMER_DRQ_ON:
- //LOG("I8275 y %u x %u DRQ 1\n", y, x);
- m_write_drq(1);
- break;
+TIMER_CALLBACK_MEMBER(i8275_device::scanline_tick)
+{
+ int rc = m_scanline / SCANLINES_PER_ROW;
+ int lc = m_scanline % SCANLINES_PER_ROW;
- case TIMER_SCANLINE:
- //LOG("I8275 y %u x %u HRTC 0\n", y, x);
- int line_counter = OFFSET_LINE_COUNTER ? ((lc - 1) % SCANLINES_PER_ROW) : lc;
- m_write_lc(line_counter);
- m_write_hrtc(0);
+ int line_counter = OFFSET_LINE_COUNTER ? ((lc - 1) % SCANLINES_PER_ROW) : lc;
+ m_write_lc(line_counter);
+ m_write_hrtc(0);
- if (m_scanline == 0)
- vrtc_end();
+ if (m_scanline == 0)
+ vrtc_end();
- if (lc == 0 && m_scanline < m_vrtc_scanline)
+ if (lc == 0 && m_scanline < m_vrtc_scanline)
+ {
+ if (!m_dma_stop && m_buffer_idx < CHARACTERS_PER_ROW)
{
- if (!m_dma_stop && m_buffer_idx < CHARACTERS_PER_ROW)
- {
- m_status |= ST_DU;
- m_dma_stop = true;
-
- // blank screen until after VRTC
- m_end_of_screen = true;
-
- //LOG("I8275 y %u x %u DMA Underrun\n", y, x);
-
- m_write_drq(0);
- }
-
- if (!m_dma_stop)
- {
- // swap line buffers
- m_buffer_dma = !m_buffer_dma;
+ m_status |= ST_DU;
+ m_dma_stop = true;
- if (m_scanline < (m_vrtc_scanline - SCANLINES_PER_ROW))
- dma_start();
- }
- }
+ // blank screen until after VRTC
+ m_end_of_screen = true;
- if ((m_status & ST_IE) && !(m_status & ST_IR) && m_scanline == m_irq_scanline)
- {
- //LOG("I8275 y %u x %u IRQ 1\n", y, x);
- m_status |= ST_IR;
- m_write_irq(ASSERT_LINE);
+ m_write_drq(0);
}
- if (m_scanline == m_vrtc_scanline)
- vrtc_start();
-
- if (!m_dma_stop && m_scanline == m_vrtc_drq_scanline)
+ if (!m_dma_stop)
{
// swap line buffers
m_buffer_dma = !m_buffer_dma;
- // start DMA burst
- dma_start();
+ if (m_scanline < (m_vrtc_scanline - SCANLINES_PER_ROW))
+ dma_start();
}
+ }
+
+ if ((m_status & ST_IE) && !(m_status & ST_IR) && m_scanline == m_irq_scanline)
+ {
+ m_status |= ST_IR;
+ m_write_irq(ASSERT_LINE);
+ }
+
+ if (m_scanline == m_vrtc_scanline)
+ vrtc_start();
- if ((m_status & ST_VE) && m_scanline < m_vrtc_scanline)
+ if (!m_dma_stop && m_scanline == m_vrtc_drq_scanline)
+ {
+ // swap line buffers
+ m_buffer_dma = !m_buffer_dma;
+
+ // start DMA burst
+ dma_start();
+ }
+
+ if ((m_status & ST_VE) && m_scanline < m_vrtc_scanline)
+ {
+ bool end_of_row = false;
+ bool blank_row = (UNDERLINE >= 8) && ((lc == 0) || (lc == SCANLINES_PER_ROW - 1));
+ int fifo_idx = 0;
+ m_field_attr = m_stored_attr;
+
+ for (int sx = 0; sx < CHARACTERS_PER_ROW; sx++)
{
- bool end_of_row = false;
- bool blank_row = (UNDERLINE >= 8) && ((lc == 0) || (lc == SCANLINES_PER_ROW - 1));
- int fifo_idx = 0;
- m_field_attr = m_stored_attr;
+ int lineattr = 0;
- for (int sx = 0; sx < CHARACTERS_PER_ROW; sx++)
- {
- int lineattr = 0;
+ uint8_t data = (end_of_row || m_end_of_screen) ? 0 : m_buffer[!m_buffer_dma][sx];
+ uint8_t attr = m_field_attr;
- uint8_t data = (end_of_row || m_end_of_screen) ? 0 : m_buffer[!m_buffer_dma][sx];
- uint8_t attr = m_field_attr;
+ if ((data & 0xc0) == 0x80)
+ {
+ // field attribute code
+ m_field_attr = data & (FAC_H | FAC_B | FAC_GG | FAC_R | FAC_U);
- if ((data & 0xc0) == 0x80)
+ if (!VISIBLE_FIELD_ATTRIBUTE)
{
- // field attribute code
- m_field_attr = data & (FAC_H | FAC_B | FAC_GG | FAC_R | FAC_U);
-
- if (!VISIBLE_FIELD_ATTRIBUTE)
- {
- attr = m_field_attr;
- data = m_fifo[!m_buffer_dma][fifo_idx];
-
- fifo_idx++;
- fifo_idx &= 0xf;
-
- if (blank_row)
- attr |= FAC_B;
- else if (!(m_char_blink < 32))
- attr &= ~FAC_B;
- if (lc != UNDERLINE)
- attr &= ~FAC_U;
- }
- else
- {
- // simply blank the attribute character itself
- attr = FAC_B;
- }
+ attr = m_field_attr;
+ data = m_fifo[!m_buffer_dma][fifo_idx];
+
+ fifo_idx++;
+ fifo_idx &= 0xf;
+
+ if (blank_row)
+ attr |= FAC_B;
+ else if (!(m_char_blink < 32))
+ attr &= ~FAC_B;
+ if (lc != UNDERLINE)
+ attr &= ~FAC_U;
}
- else if (data >= 0xf0 || end_of_row || m_end_of_screen)
+ else
{
- // special control character
- switch (data)
- {
- case SCC_END_OF_ROW:
- case SCC_END_OF_ROW_DMA:
- end_of_row = true;
- break;
-
- case SCC_END_OF_SCREEN:
- case SCC_END_OF_SCREEN_DMA:
- m_end_of_screen = true;
- break;
- }
+ // simply blank the attribute character itself
attr = FAC_B;
}
- else if (data >= 0xc0)
+ }
+ else if (data >= 0xf0 || end_of_row || m_end_of_screen)
+ {
+ // special control character
+ switch (data)
{
- // character attribute code
- attr = data & (m_char_blink < 32 ? (CA_H | CA_B) : CA_H);
-
- uint8_t ca;
- int cccc = (data >> 2) & 0x0f;
-
- if (lc < UNDERLINE)
- {
- ca = character_attribute[0][cccc];
- }
- else if (lc == UNDERLINE)
- {
- ca = character_attribute[1][cccc];
- }
- else
- {
- ca = character_attribute[2][cccc];
- }
+ case SCC_END_OF_ROW:
+ case SCC_END_OF_ROW_DMA:
+ end_of_row = true;
+ break;
+
+ case SCC_END_OF_SCREEN:
+ case SCC_END_OF_SCREEN_DMA:
+ m_end_of_screen = true;
+ break;
+ }
+ attr = FAC_B;
+ }
+ else if (data >= 0xc0)
+ {
+ // character attribute code
+ attr = data & (m_char_blink < 32 ? (CA_H | CA_B) : CA_H);
- if (ca & CA_LTEN)
- attr |= FAC_U;
- if (ca & CA_VSP)
- attr |= FAC_B;
- lineattr = ca >> 2;
+ uint8_t ca;
+ int cccc = (data >> 2) & 0x0f;
+
+ if (lc < UNDERLINE)
+ {
+ ca = character_attribute[0][cccc];
+ }
+ else if (lc == UNDERLINE)
+ {
+ ca = character_attribute[1][cccc];
}
else
{
- if (blank_row)
- attr |= FAC_B;
- else if (!(m_char_blink < 32))
- attr &= ~FAC_B;
- if (lc != UNDERLINE)
- attr &= ~FAC_U;
+ ca = character_attribute[2][cccc];
}
- if ((rc == m_param[REG_CUR_ROW]) && (sx == m_param[REG_CUR_COL]))
+ if (ca & CA_LTEN)
+ attr |= FAC_U;
+ if (ca & CA_VSP)
+ attr |= FAC_B;
+ lineattr = ca >> 2;
+ }
+ else
+ {
+ if (blank_row)
+ attr |= FAC_B;
+ else if (!(m_char_blink < 32))
+ attr &= ~FAC_B;
+ if (lc != UNDERLINE)
+ attr &= ~FAC_U;
+ }
+
+ if ((rc == m_param[REG_CUR_ROW]) && (sx == m_param[REG_CUR_COL]))
+ {
+ if ((CURSOR_FORMAT & 0x02) || (m_cursor_blink < 16))
{
- if ((CURSOR_FORMAT & 0x02) || (m_cursor_blink < 16))
- {
- if (CURSOR_FORMAT & 0x01)
- attr |= (lc == UNDERLINE) ? FAC_U : 0;
- else
- attr ^= FAC_R;
- }
+ if (CURSOR_FORMAT & 0x01)
+ attr |= (lc == UNDERLINE) ? FAC_U : 0;
+ else
+ attr ^= FAC_R;
}
-
- if (!m_display_cb.isnull())
- m_display_cb(m_bitmap,
- sx * m_hpixels_per_column, // x position on screen of starting point
- m_scanline, // y position on screen
- line_counter, // current line of char
- (data & 0x7f), // char code to be displayed
- lineattr, // line attribute code
- (attr & FAC_U) ? 1 : 0, // light enable signal
- (attr & FAC_R) ? 1 : 0, // reverse video signal
- (attr & FAC_B) ? 1 : 0, // video suppression
- (attr & FAC_GG) >> 2, // general purpose attribute code
- (attr & FAC_H) ? 1 : 0 // highlight
- );
}
- if ((SCANLINES_PER_ROW - lc) == 1)
- m_stored_attr = m_field_attr;
+ if (!m_display_cb.isnull())
+ m_display_cb(m_bitmap,
+ sx * m_hpixels_per_column, // x position on screen of starting point
+ m_scanline, // y position on screen
+ line_counter, // current line of char
+ (data & 0x7f), // char code to be displayed
+ lineattr, // line attribute code
+ (attr & FAC_U) ? 1 : 0, // light enable signal
+ (attr & FAC_R) ? 1 : 0, // reverse video signal
+ (attr & FAC_B) ? 1 : 0, // video suppression
+ (attr & FAC_GG) >> 2, // general purpose attribute code
+ (attr & FAC_H) ? 1 : 0 // highlight
+ );
}
- m_scanline++;
- m_scanline %= ((CHARACTER_ROWS_PER_FRAME + VRTC_ROW_COUNT) * SCANLINES_PER_ROW);
- break;
+ if ((SCANLINES_PER_ROW - lc) == 1)
+ m_stored_attr = m_field_attr;
}
+
+ m_scanline++;
+ m_scanline %= ((CHARACTER_ROWS_PER_FRAME + VRTC_ROW_COUNT) * SCANLINES_PER_ROW);
}
diff --git a/src/devices/video/i8275.h b/src/devices/video/i8275.h
index 34f7f24419b..2b49dee6362 100644
--- a/src/devices/video/i8275.h
+++ b/src/devices/video/i8275.h
@@ -85,7 +85,10 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(hrtc_on);
+ TIMER_CALLBACK_MEMBER(drq_on);
+ TIMER_CALLBACK_MEMBER(scanline_tick);
void vrtc_start();
void vrtc_end();
@@ -95,13 +98,6 @@ protected:
enum
{
- TIMER_HRTC_ON,
- TIMER_DRQ_ON,
- TIMER_SCANLINE
- };
-
- enum
- {
ST_IE = 0x40,
ST_IR = 0x20,
ST_LP = 0x10,
diff --git a/src/devices/video/imagetek_i4100.cpp b/src/devices/video/imagetek_i4100.cpp
index 080d2159553..5b9cc568e03 100644
--- a/src/devices/video/imagetek_i4100.cpp
+++ b/src/devices/video/imagetek_i4100.cpp
@@ -384,7 +384,7 @@ void imagetek_i4100_device::device_start()
m_gfxrom_size = m_gfxrom.bytes();
m_irq_cb.resolve_safe();
- m_blit_done_timer = timer_alloc(TIMER_BLIT_END);
+ m_blit_done_timer = timer_alloc(FUNC(imagetek_i4100_device::blit_done), this);
m_spritelist = std::make_unique<sprite_t []>(0x1000 / 8);
m_sprite_end = m_spritelist.get();
@@ -533,15 +533,10 @@ void imagetek_i4300_device::update_irq_state()
m_irq_cb(level);
}
-void imagetek_i4100_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(imagetek_i4100_device::blit_done)
{
- switch (id)
- {
- case TIMER_BLIT_END:
- if (m_blit_irq_level != -1)
- set_irq(m_blit_irq_level);
- break;
- }
+ if (m_blit_irq_level != -1)
+ set_irq(m_blit_irq_level);
}
//**************************************************************************
diff --git a/src/devices/video/imagetek_i4100.h b/src/devices/video/imagetek_i4100.h
index f8c0f78c034..94635dee733 100644
--- a/src/devices/video/imagetek_i4100.h
+++ b/src/devices/video/imagetek_i4100.h
@@ -78,10 +78,11 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void update_irq_state();
+ TIMER_CALLBACK_MEMBER(blit_done);
+
required_shared_ptr_array<u16, 3> m_vram;
required_shared_ptr<u16> m_scratchram;
required_shared_ptr<u16> m_blitter_regs;
diff --git a/src/devices/video/lc7985.cpp b/src/devices/video/lc7985.cpp
index 6608ad6fc71..ef01cbb6a2c 100644
--- a/src/devices/video/lc7985.cpp
+++ b/src/devices/video/lc7985.cpp
@@ -31,7 +31,7 @@ const tiny_rom_entry *lc7985_device::device_rom_region() const
void lc7985_device::device_start()
{
m_cgrom = m_cgrom_region.found() ? m_cgrom_region : memregion("cgrom")->base();
- m_busy_timer = timer_alloc(0);
+ m_busy_timer = timer_alloc(FUNC(lc7985_device::clear_busy_flag), this);
save_item(NAME(m_ddram));
save_item(NAME(m_cgram));
@@ -66,7 +66,7 @@ void lc7985_device::busy(attotime time)
m_busy_timer->adjust(time);
}
-void lc7985_device::device_timer(emu_timer &, device_timer_id, int)
+TIMER_CALLBACK_MEMBER(lc7985_device::clear_busy_flag)
{
m_busy_flag = false;
}
diff --git a/src/devices/video/lc7985.h b/src/devices/video/lc7985.h
index 1d989e83e85..353822e7462 100644
--- a/src/devices/video/lc7985.h
+++ b/src/devices/video/lc7985.h
@@ -27,9 +27,10 @@ public:
protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual const tiny_rom_entry *device_rom_region() const override;
+ TIMER_CALLBACK_MEMBER(clear_busy_flag);
+
private:
optional_region_ptr<u8> m_cgrom_region; // internal chargen ROM
u8 m_render_buffer[16*40];
diff --git a/src/devices/video/mc6845.cpp b/src/devices/video/mc6845.cpp
index c1e3ca971aa..553839da2b1 100644
--- a/src/devices/video/mc6845.cpp
+++ b/src/devices/video/mc6845.cpp
@@ -843,7 +843,7 @@ bool hd6845s_device::check_cursor_visible(uint16_t ra, uint16_t line_addr)
}
-void mc6845_device::handle_line_timer()
+TIMER_CALLBACK_MEMBER(mc6845_device::handle_line_timer)
{
bool new_vsync = m_vsync;
@@ -932,7 +932,7 @@ void mc6845_device::handle_line_timer()
m_cursor_x = m_cursor_addr - m_line_address;
/* Schedule CURSOR ON signal */
- m_cur_on_timer->adjust(cclks_to_attotime(m_cursor_x));
+ m_cursor_on_timer->adjust(cclks_to_attotime(m_cursor_x));
}
}
@@ -948,99 +948,82 @@ void mc6845_device::handle_line_timer()
}
-void mc6845_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(mc6845_device::de_off_tick)
{
- switch (id)
- {
- case TIMER_LINE:
- handle_line_timer();
- break;
-
- case TIMER_DE_OFF:
- set_de( false );
- break;
-
- case TIMER_CUR_ON:
- set_cur( true );
+ set_de( false );
+}
- /* Schedule CURSOR off signal */
- m_cur_off_timer->adjust(cclks_to_attotime(1));
- break;
+TIMER_CALLBACK_MEMBER(mc6845_device::cursor_on)
+{
+ set_cur(true);
- case TIMER_CUR_OFF:
- set_cur( false );
- break;
+ /* Schedule CURSOR off signal */
+ m_cursor_off_timer->adjust(cclks_to_attotime(1));
+}
- case TIMER_HSYNC_ON:
- {
- uint8_t hsync_width = ( m_sync_width & 0x0f ) ? ( m_sync_width & 0x0f ) : 0x10;
+TIMER_CALLBACK_MEMBER(mc6845_device::cursor_off)
+{
+ set_cur(false);
+}
- m_hsync_width_counter = 0;
- set_hsync( true );
+TIMER_CALLBACK_MEMBER(mc6845_device::hsync_on)
+{
+ uint8_t hsync_width = ( m_sync_width & 0x0f ) ? ( m_sync_width & 0x0f ) : 0x10;
- /* Schedule HSYNC off signal */
- m_hsync_off_timer->adjust(cclks_to_attotime(hsync_width));
- }
- break;
+ m_hsync_width_counter = 0;
+ set_hsync( true );
- case TIMER_HSYNC_OFF:
- set_hsync( false );
- break;
+ /* Schedule HSYNC off signal */
+ m_hsync_off_timer->adjust(cclks_to_attotime(hsync_width));
+}
- case TIMER_LIGHT_PEN_LATCH:
- m_light_pen_addr = get_ma();
- m_light_pen_latched = true;
- break;
+TIMER_CALLBACK_MEMBER(mc6845_device::hsync_off)
+{
+ set_hsync( false );
+}
- case TIMER_UPD_ADR:
- /* fire a update address strobe */
- call_on_update_address(MODE_UPDATE_STROBE);
- break;
+TIMER_CALLBACK_MEMBER(mc6845_device::latch_light_pen)
+{
+ m_light_pen_addr = get_ma();
+ m_light_pen_latched = true;
+}
- case TIMER_UPD_TRANS:
- {
- int addr = (param >> 8);
- int strobe = (param & 0xff);
+TIMER_CALLBACK_MEMBER(mc6845_device::adr_update_tick)
+{
+ /* fire a update address strobe */
+ call_on_update_address(MODE_UPDATE_STROBE);
+}
- /* call the callback function -- we know it exists */
- m_on_update_addr_changed_cb(addr, strobe);
+TIMER_CALLBACK_MEMBER(mc6845_device::transparent_update_tick)
+{
+ int addr = (param >> 8);
+ int strobe = (param & 0xff);
- if(!m_update_ready_bit && MODE_TRANSPARENT_BLANK)
- {
- m_update_addr++;
- m_update_addr &= 0x3fff;
- m_update_ready_bit = true;
- }
- }
- break;
+ /* call the callback function -- we know it exists */
+ m_on_update_addr_changed_cb(addr, strobe);
+ if(!m_update_ready_bit && MODE_TRANSPARENT_BLANK)
+ {
+ m_update_addr++;
+ m_update_addr &= 0x3fff;
+ m_update_ready_bit = true;
}
}
-void mos8563_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(mos8563_device::block_copy_tick)
{
- switch (id)
- {
- case TIMER_BLOCK_COPY:
- {
- uint8_t data = VSS_COPY ? read_videoram(m_block_addr++) : m_data;
+ uint8_t data = VSS_COPY ? read_videoram(m_block_addr++) : m_data;
- write_videoram(m_update_addr++, data);
+ write_videoram(m_update_addr++, data);
- if (--m_word_count)
- {
- m_block_copy_timer->adjust(cclks_to_attotime(1));
- }
- else
- {
- m_update_ready_bit = 1;
- }
- break;
+ if (--m_word_count)
+ {
+ m_block_copy_timer->adjust(cclks_to_attotime(1));
}
- default:
- mc6845_device::device_timer(timer, id, param);
- break;
+ else
+ {
+ m_update_ready_bit = 1;
}
}
@@ -1237,15 +1220,15 @@ void mc6845_device::device_start()
m_out_vsync_cb.resolve_safe();
/* create the timers */
- m_line_timer = timer_alloc(TIMER_LINE);
- m_de_off_timer = timer_alloc(TIMER_DE_OFF);
- m_cur_on_timer = timer_alloc(TIMER_CUR_ON);
- m_cur_off_timer = timer_alloc(TIMER_CUR_OFF);
- m_hsync_on_timer = timer_alloc(TIMER_HSYNC_ON);
- m_hsync_off_timer = timer_alloc(TIMER_HSYNC_OFF);
- m_light_pen_latch_timer = timer_alloc(TIMER_LIGHT_PEN_LATCH);
- m_upd_adr_timer = timer_alloc(TIMER_UPD_ADR);
- m_upd_trans_timer = timer_alloc(TIMER_UPD_TRANS);
+ m_line_timer = timer_alloc(FUNC(mc6845_device::handle_line_timer), this);
+ m_de_off_timer = timer_alloc(FUNC(mc6845_device::de_off_tick), this);
+ m_cursor_on_timer = timer_alloc(FUNC(mc6845_device::cursor_on), this);
+ m_cursor_off_timer = timer_alloc(FUNC(mc6845_device::cursor_off), this);
+ m_hsync_on_timer = timer_alloc(FUNC(mc6845_device::hsync_on), this);
+ m_hsync_off_timer = timer_alloc(FUNC(mc6845_device::hsync_off), this);
+ m_light_pen_latch_timer = timer_alloc(FUNC(mc6845_device::latch_light_pen), this);
+ m_upd_adr_timer = timer_alloc(FUNC(mc6845_device::adr_update_tick), this);
+ m_upd_trans_timer = timer_alloc(FUNC(mc6845_device::transparent_update_tick), this);
/* Use some large startup values */
m_horiz_char_total = 0xff;
@@ -1475,7 +1458,7 @@ void mos8563_device::device_start()
mc6845_device::device_start();
/* create the timers */
- m_block_copy_timer = timer_alloc(TIMER_BLOCK_COPY);
+ m_block_copy_timer = timer_alloc(FUNC(mos8563_device::block_copy_tick), this);
m_supports_status_reg_d5 = true;
m_supports_status_reg_d6 = true;
diff --git a/src/devices/video/mc6845.h b/src/devices/video/mc6845.h
index 3be35da59c3..bfbf4715e96 100644
--- a/src/devices/video/mc6845.h
+++ b/src/devices/video/mc6845.h
@@ -132,7 +132,6 @@ protected:
virtual void device_reset() override;
virtual void device_post_load() override;
virtual void device_clock_changed() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
attotime cclks_to_attotime(uint64_t clocks) const { return clocks_to_attotime(clocks * m_clk_scale); }
uint64_t attotime_to_cclks(const attotime &duration) const { return attotime_to_clocks(duration) / m_clk_scale; }
@@ -188,20 +187,10 @@ protected:
int16_t m_cursor_x;
/* timers */
- static const device_timer_id TIMER_LINE = 0;
- static const device_timer_id TIMER_DE_OFF = 1;
- static const device_timer_id TIMER_CUR_ON = 2;
- static const device_timer_id TIMER_CUR_OFF = 3;
- static const device_timer_id TIMER_HSYNC_ON = 4;
- static const device_timer_id TIMER_HSYNC_OFF = 5;
- static const device_timer_id TIMER_LIGHT_PEN_LATCH = 6;
- static const device_timer_id TIMER_UPD_ADR = 7;
- static const device_timer_id TIMER_UPD_TRANS = 8;
-
emu_timer *m_line_timer;
emu_timer *m_de_off_timer;
- emu_timer *m_cur_on_timer;
- emu_timer *m_cur_off_timer;
+ emu_timer *m_cursor_on_timer;
+ emu_timer *m_cursor_off_timer;
emu_timer *m_hsync_on_timer;
emu_timer *m_hsync_off_timer;
emu_timer *m_light_pen_latch_timer;
@@ -237,7 +226,15 @@ protected:
void set_cur(int state);
bool match_line();
virtual bool check_cursor_visible(uint16_t ra, uint16_t line_addr);
- void handle_line_timer();
+ TIMER_CALLBACK_MEMBER(handle_line_timer);
+ TIMER_CALLBACK_MEMBER(de_off_tick);
+ TIMER_CALLBACK_MEMBER(cursor_on);
+ TIMER_CALLBACK_MEMBER(cursor_off);
+ TIMER_CALLBACK_MEMBER(hsync_on);
+ TIMER_CALLBACK_MEMBER(hsync_off);
+ TIMER_CALLBACK_MEMBER(latch_light_pen);
+ TIMER_CALLBACK_MEMBER(adr_update_tick);
+ TIMER_CALLBACK_MEMBER(transparent_update_tick);
virtual void update_cursor_state();
virtual uint8_t draw_scanline(int y, bitmap_rgb32 &bitmap, const rectangle &cliprect);
@@ -425,7 +422,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_memory_interface overrides
virtual space_config_vector memory_space_config() const override;
@@ -433,6 +429,8 @@ protected:
// device_palette_interface overrides
virtual uint32_t palette_entries() const override { return 16; }
+ TIMER_CALLBACK_MEMBER(block_copy_tick);
+
const address_space_config m_videoram_space_config;
uint8_t m_char_buffer[80];
@@ -463,8 +461,6 @@ protected:
virtual void update_cursor_state() override;
virtual uint8_t draw_scanline(int y, bitmap_rgb32 &bitmap, const rectangle &cliprect) override;
- static const device_timer_id TIMER_BLOCK_COPY = 9;
-
emu_timer *m_block_copy_timer;
void mos8563_videoram_map(address_map &map);
diff --git a/src/devices/video/mc6847.cpp b/src/devices/video/mc6847.cpp
index 972e77d0165..eb3b6f355cc 100644
--- a/src/devices/video/mc6847.cpp
+++ b/src/devices/video/mc6847.cpp
@@ -148,23 +148,6 @@ mc6847_friend_device::mc6847_friend_device(const machine_config &mconfig, device
//-------------------------------------------------
-// setup_timer - sets up a single timer relative
-// to the clock
-//-------------------------------------------------
-
-inline emu_timer *mc6847_friend_device::setup_timer(device_timer_id id, double offset, double period)
-{
- emu_timer *timer = timer_alloc(id);
- timer->adjust(
- clocks_to_attotime(offset * m_divider),
- 0,
- clocks_to_attotime(period * m_divider));
- return timer;
-}
-
-
-
-//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
@@ -174,10 +157,14 @@ void mc6847_friend_device::device_start()
m_write_fsync.resolve_safe();
/* create the timers */
- m_frame_timer = setup_timer( TIMER_FRAME, 0, m_tpfs * TIMER_HSYNC_PERIOD);
- m_hsync_on_timer = setup_timer( TIMER_HSYNC_ON, TIMER_HSYNC_ON_TIME, TIMER_HSYNC_PERIOD);
- m_hsync_off_timer = setup_timer(TIMER_HSYNC_OFF, TIMER_HSYNC_OFF_TIME, TIMER_HSYNC_PERIOD);
- m_fsync_timer = timer_alloc(TIMER_FSYNC);
+ m_frame_timer = timer_alloc(FUNC(mc6847_friend_device::new_frame), this);
+ m_hsync_on_timer = timer_alloc(FUNC(mc6847_friend_device::change_horizontal_sync), this);
+ m_hsync_off_timer = timer_alloc(FUNC(mc6847_friend_device::change_horizontal_sync), this);
+ m_fsync_timer = timer_alloc(FUNC(mc6847_friend_device::change_field_sync), this);
+
+ m_frame_timer->adjust(clocks_to_attotime(0), 0, clocks_to_attotime(m_tpfs * TIMER_HSYNC_PERIOD * m_divider));
+ m_hsync_on_timer->adjust(clocks_to_attotime(TIMER_HSYNC_ON_TIME * m_divider), 1, clocks_to_attotime(TIMER_HSYNC_PERIOD * m_divider));
+ m_hsync_off_timer->adjust(clocks_to_attotime(TIMER_HSYNC_OFF_TIME * m_divider), 0, clocks_to_attotime(TIMER_HSYNC_PERIOD * m_divider));
m_top_border_scanlines = 0;
m_body_scanlines = 0;
@@ -250,27 +237,10 @@ void mc6847_friend_device::update_field_sync_timer()
//-------------------------------------------------
-// device_timer
-//-------------------------------------------------
-
-void mc6847_friend_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch(id)
- {
- case TIMER_FRAME: new_frame(); break;
- case TIMER_HSYNC_ON: change_horizontal_sync(true); break;
- case TIMER_HSYNC_OFF: change_horizontal_sync(false); break;
- case TIMER_FSYNC: change_field_sync(param != 0); break;
- }
-}
-
-
-
-//-------------------------------------------------
// new_frame
//-------------------------------------------------
-inline void mc6847_friend_device::new_frame()
+TIMER_CALLBACK_MEMBER(mc6847_friend_device::new_frame)
{
m_physical_scanline = 0;
m_logical_scanline = 0;
@@ -306,8 +276,9 @@ std::string mc6847_friend_device::scanline_zone_string(scanline_zone zone) const
// change_horizontal_sync
//-------------------------------------------------
-inline void mc6847_friend_device::change_horizontal_sync(bool line)
+TIMER_CALLBACK_MEMBER(mc6847_friend_device::change_horizontal_sync)
{
+ bool line = (bool)param;
g_profiler.start(PROFILER_USER1);
// are we on a rising edge?
@@ -374,8 +345,9 @@ inline void mc6847_friend_device::change_horizontal_sync(bool line)
// change_field_sync
//-------------------------------------------------
-inline void mc6847_friend_device::change_field_sync(bool line)
+TIMER_CALLBACK_MEMBER(mc6847_friend_device::change_field_sync)
{
+ bool line = (bool)param;
/* output field sync */
if (line != m_field_sync)
{
@@ -446,7 +418,7 @@ inline void mc6847_friend_device::next_scanline()
// horizontal_sync_changed
//-------------------------------------------------
-void mc6847_friend_device::horizontal_sync_changed(bool line)
+TIMER_CALLBACK_MEMBER(mc6847_friend_device::horizontal_sync_changed)
{
}
diff --git a/src/devices/video/mc6847.h b/src/devices/video/mc6847.h
index c26582fc4c6..03fb55084a5 100644
--- a/src/devices/video/mc6847.h
+++ b/src/devices/video/mc6847.h
@@ -60,12 +60,6 @@ protected:
mc6847_friend_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock,
const uint8_t *fontdata, bool is_mc6847t1, double tpfs, int field_sync_falling_edge_scanline, int divider, bool supports_partial_body_scanlines);
- // timer constants
- static constexpr device_timer_id TIMER_FRAME = 0;
- static constexpr device_timer_id TIMER_HSYNC_OFF = 1;
- static constexpr device_timer_id TIMER_HSYNC_ON = 2;
- static constexpr device_timer_id TIMER_FSYNC = 3;
-
// fonts
static const uint8_t pal_round_fontdata8x12[];
static const uint8_t pal_square_fontdata8x12[];
@@ -275,13 +269,12 @@ protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_reset() override;
virtual void device_post_load() override;
// other overridables
- virtual void new_frame();
- virtual void horizontal_sync_changed(bool line);
+ virtual TIMER_CALLBACK_MEMBER(new_frame);
+ virtual TIMER_CALLBACK_MEMBER(horizontal_sync_changed);
virtual void field_sync_changed(bool line);
virtual void enter_bottom_border();
virtual void record_border_scanline(uint16_t physical_scanline);
@@ -292,9 +285,6 @@ protected:
void video_flush();
std::string describe_context() const;
- // setup functions
- emu_timer *setup_timer(device_timer_id id, double offset, double period);
-
// converts to B&W
static pixel_t black_and_white(rgb_t color)
{
@@ -499,8 +489,8 @@ private:
uint32_t m_partial_scanline_clocks;
// functions
- void change_horizontal_sync(bool line);
- void change_field_sync(bool line);
+ virtual TIMER_CALLBACK_MEMBER(change_horizontal_sync);
+ TIMER_CALLBACK_MEMBER(change_field_sync);
void update_field_sync_timer();
void next_scanline();
int32_t get_clocks_since_hsync();
diff --git a/src/devices/video/nt7534.cpp b/src/devices/video/nt7534.cpp
index d72bdbe2b4a..e1065376860 100644
--- a/src/devices/video/nt7534.cpp
+++ b/src/devices/video/nt7534.cpp
@@ -44,7 +44,7 @@ nt7534_device::nt7534_device(const machine_config &mconfig, device_type type, co
void nt7534_device::device_start()
{
- m_busy_timer = timer_alloc(TIMER_BUSY);
+ m_busy_timer = timer_alloc(FUNC(nt7534_device::clear_busy_flag), this);
m_pixel_update_cb.resolve();
@@ -97,17 +97,12 @@ void nt7534_device::device_reset()
//-------------------------------------------------
-// device_timer - handler timer events
+// clear_busy_flag -
//-------------------------------------------------
-void nt7534_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nt7534_device::clear_busy_flag)
{
- switch (id)
- {
- case TIMER_BUSY:
- m_busy_flag = false;
- break;
- }
+ m_busy_flag = false;
}
diff --git a/src/devices/video/nt7534.h b/src/devices/video/nt7534.h
index 7b4db9d51c9..126d5dfff92 100644
--- a/src/devices/video/nt7534.h
+++ b/src/devices/video/nt7534.h
@@ -48,15 +48,15 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(clear_busy_flag);
+
private:
// internal helper
void set_busy_flag(uint16_t usec);
void update_nibble(int rs, int rw);
// internal state
- static constexpr device_timer_id TIMER_BUSY = 0;
-
emu_timer * m_busy_timer;
pixel_update_delegate m_pixel_update_cb; // pixel update callback
diff --git a/src/devices/video/pc_vga.cpp b/src/devices/video/pc_vga.cpp
index a553813a8d7..35c2f6e5d0b 100644
--- a/src/devices/video/pc_vga.cpp
+++ b/src/devices/video/pc_vga.cpp
@@ -351,7 +351,7 @@ void vga_device::device_start()
save_item(NAME(vga.dac.color));
save_item(NAME(vga.dac.dirty));
- m_vblank_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vga_device::vblank_timer_cb),this));
+ m_vblank_timer = timer_alloc(FUNC(vga_device::vblank_timer_cb), this);
}
void svga_device::device_start()
diff --git a/src/devices/video/pcf2100.cpp b/src/devices/video/pcf2100.cpp
index 12df4488d0a..7cdcd044c6f 100644
--- a/src/devices/video/pcf2100.cpp
+++ b/src/devices/video/pcf2100.cpp
@@ -59,7 +59,7 @@ void pcf2100_device::device_start()
m_write_segs.resolve_safe();
// timer
- m_lcd_timer = timer_alloc();
+ m_lcd_timer = timer_alloc(FUNC(pcf2100_device::update_output_latches), this);
attotime period = attotime::from_hz(clock());
m_lcd_timer->adjust(period, 0, period);
@@ -78,7 +78,7 @@ void pcf2100_device::device_start()
// handlers
//-------------------------------------------------
-void pcf2100_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(pcf2100_device::update_output_latches)
{
// transfer latches to output
m_write_segs(m_bpout, m_latch[m_bpout]);
diff --git a/src/devices/video/pcf2100.h b/src/devices/video/pcf2100.h
index 74a830f0712..c4e657fef19 100644
--- a/src/devices/video/pcf2100.h
+++ b/src/devices/video/pcf2100.h
@@ -47,7 +47,8 @@ protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(update_output_latches);
emu_timer *m_lcd_timer;
diff --git a/src/devices/video/ppu2c0x.cpp b/src/devices/video/ppu2c0x.cpp
index ce52232d372..d8f3ca4748b 100644
--- a/src/devices/video/ppu2c0x.cpp
+++ b/src/devices/video/ppu2c0x.cpp
@@ -220,9 +220,9 @@ void ppu2c0x_device::start_nopalram()
m_int_callback.resolve_safe();
// allocate timers
- m_hblank_timer = timer_alloc(TIMER_HBLANK);
- m_nmi_timer = timer_alloc(TIMER_NMI);
- m_scanline_timer = timer_alloc(TIMER_SCANLINE);
+ m_hblank_timer = timer_alloc(FUNC(ppu2c0x_device::hblank_tick), this);
+ m_nmi_timer = timer_alloc(FUNC(ppu2c0x_device::nmi_tick), this);
+ m_scanline_timer = timer_alloc(FUNC(ppu2c0x_device::scanline_tick), this);
/* initialize the scanline handling portion */
m_scanline_timer->adjust(screen().time_until_pos(1));
@@ -492,100 +492,94 @@ void ppu2c04_clone_device::init_palette_tables()
*************************************/
//-------------------------------------------------
-// device_timer - handle timer events
+// timer events
//-------------------------------------------------
-void ppu2c0x_device::device_timer(emu_timer& timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(ppu2c0x_device::hblank_tick)
{
- int blanked, vblank;
+ bool blanked = (m_regs[PPU_CONTROL1] & (PPU_CONTROL1_BACKGROUND | PPU_CONTROL1_SPRITES)) == 0;
+ bool vblank = (m_scanline >= m_vblank_first_scanline - 1) && (m_scanline < m_scanlines_per_frame - 1);
- switch (id)
- {
- case TIMER_HBLANK:
- blanked = (m_regs[PPU_CONTROL1] & (PPU_CONTROL1_BACKGROUND | PPU_CONTROL1_SPRITES)) == 0;
- vblank = ((m_scanline >= m_vblank_first_scanline - 1) && (m_scanline < m_scanlines_per_frame - 1)) ? 1 : 0;
+ //update_scanline();
- //update_scanline();
+ if (!m_hblank_callback_proc.isnull())
+ m_hblank_callback_proc(m_scanline, vblank, blanked);
- if (!m_hblank_callback_proc.isnull())
- m_hblank_callback_proc(m_scanline, vblank, blanked);
+ m_hblank_timer->adjust(attotime::never);
+}
- m_hblank_timer->adjust(attotime::never);
- break;
+TIMER_CALLBACK_MEMBER(ppu2c0x_device::nmi_tick)
+{
+ // Actually fire the VMI
+ m_int_callback(ASSERT_LINE);
+ m_int_callback(CLEAR_LINE);
- case TIMER_NMI:
- // Actually fire the VMI
- m_int_callback(ASSERT_LINE);
- m_int_callback(CLEAR_LINE);
+ m_nmi_timer->adjust(attotime::never);
+}
- m_nmi_timer->adjust(attotime::never);
- break;
+TIMER_CALLBACK_MEMBER(ppu2c0x_device::scanline_tick)
+{
+ bool blanked = (m_regs[PPU_CONTROL1] & (PPU_CONTROL1_BACKGROUND | PPU_CONTROL1_SPRITES)) == 0;
+ bool vblank = ((m_scanline >= m_vblank_first_scanline - 1) && (m_scanline < m_scanlines_per_frame - 1)) ? 1 : 0;
- case TIMER_SCANLINE:
- blanked = (m_regs[PPU_CONTROL1] & (PPU_CONTROL1_BACKGROUND | PPU_CONTROL1_SPRITES)) == 0;
- vblank = ((m_scanline >= m_vblank_first_scanline - 1) && (m_scanline < m_scanlines_per_frame - 1)) ? 1 : 0;
- int next_scanline;
+ /* if a callback is available, call it */
+ if (!m_scanline_callback_proc.isnull())
+ m_scanline_callback_proc(m_scanline, vblank, blanked);
- /* if a callback is available, call it */
- if (!m_scanline_callback_proc.isnull())
- m_scanline_callback_proc(m_scanline, vblank, blanked);
+ /* update the scanline that just went by */
+ update_scanline();
- /* update the scanline that just went by */
- update_scanline();
+ /* increment our scanline count */
+ m_scanline++;
- /* increment our scanline count */
- m_scanline++;
+ //logerror("starting scanline %d (MAME %d, beam %d)\n", m_scanline, device->screen().vpos(), device->screen().hpos());
- //logerror("starting scanline %d (MAME %d, beam %d)\n", m_scanline, device->screen().vpos(), device->screen().hpos());
+ /* Note: this is called at the _end_ of each scanline */
+ if (m_scanline == m_vblank_first_scanline)
+ {
+ // logerror("vblank starting\n");
+ /* We just entered VBLANK */
+ m_regs[PPU_STATUS] |= PPU_STATUS_VBLANK;
- /* Note: this is called at the _end_ of each scanline */
- if (m_scanline == m_vblank_first_scanline)
+ /* If NMI's are set to be triggered, go for it */
+ if (m_regs[PPU_CONTROL0] & PPU_CONTROL0_NMI)
{
- // logerror("vblank starting\n");
- /* We just entered VBLANK */
- m_regs[PPU_STATUS] |= PPU_STATUS_VBLANK;
-
- /* If NMI's are set to be triggered, go for it */
- if (m_regs[PPU_CONTROL0] & PPU_CONTROL0_NMI)
- {
- // We need an ever-so-slight delay between entering vblank and firing an NMI - enough so that
- // a game can read the high bit of $2002 before the NMI is called (potentially resetting the bit
- // via a read from $2002 in the NMI handler).
- // B-Wings is an example game that needs this.
- m_nmi_timer->adjust(m_cpu->cycles_to_attotime(4));
- }
+ // We need an ever-so-slight delay between entering vblank and firing an NMI - enough so that
+ // a game can read the high bit of $2002 before the NMI is called (potentially resetting the bit
+ // via a read from $2002 in the NMI handler).
+ // B-Wings is an example game that needs this.
+ m_nmi_timer->adjust(m_cpu->cycles_to_attotime(4));
}
+ }
- if (m_scanline == m_scanlines_per_frame - 1)
- {
- //logerror("vblank ending\n");
- /* clear the vblank & sprite hit flag */
- m_regs[PPU_STATUS] &= ~(PPU_STATUS_VBLANK | PPU_STATUS_SPRITE0_HIT | PPU_STATUS_8SPRITES);
- }
+ if (m_scanline == m_scanlines_per_frame - 1)
+ {
+ //logerror("vblank ending\n");
+ /* clear the vblank & sprite hit flag */
+ m_regs[PPU_STATUS] &= ~(PPU_STATUS_VBLANK | PPU_STATUS_SPRITE0_HIT | PPU_STATUS_8SPRITES);
+ }
- /* see if we rolled */
- else if (m_scanline == m_scanlines_per_frame)
- {
- /* if background or sprites are enabled, copy the ppu address latch */
- if (!blanked)
- m_refresh_data = m_refresh_latch;
+ /* see if we rolled */
+ else if (m_scanline == m_scanlines_per_frame)
+ {
+ /* if background or sprites are enabled, copy the ppu address latch */
+ if (!blanked)
+ m_refresh_data = m_refresh_latch;
- /* reset the scanline count */
- m_scanline = 0;
- //logerror("sprite 0 x: %d y: %d num: %d\n", m_spriteram[3], m_spriteram[0] + 1, m_spriteram[1]);
- }
+ /* reset the scanline count */
+ m_scanline = 0;
+ //logerror("sprite 0 x: %d y: %d num: %d\n", m_spriteram[3], m_spriteram[0] + 1, m_spriteram[1]);
+ }
- next_scanline = m_scanline + 1;
- if (next_scanline == m_scanlines_per_frame)
- next_scanline = 0;
+ int next_scanline = m_scanline + 1;
+ if (next_scanline == m_scanlines_per_frame)
+ next_scanline = 0;
- // Call us back when the hblank starts for this scanline
- m_hblank_timer->adjust(m_cpu->cycles_to_attotime(260) / 3); // ??? FIXME - hardcoding NTSC, need better calculation
+ // Call us back when the hblank starts for this scanline
+ m_hblank_timer->adjust(m_cpu->cycles_to_attotime(260) / 3); // ??? FIXME - hardcoding NTSC, need better calculation
- // trigger again at the start of the next scanline
- m_scanline_timer->adjust(screen().time_until_pos(next_scanline * m_scan_scale));
- break;
- }
+ // trigger again at the start of the next scanline
+ m_scanline_timer->adjust(screen().time_until_pos(next_scanline * m_scan_scale));
}
diff --git a/src/devices/video/ppu2c0x.h b/src/devices/video/ppu2c0x.h
index e1e3fb07367..0be6231b97d 100644
--- a/src/devices/video/ppu2c0x.h
+++ b/src/devices/video/ppu2c0x.h
@@ -45,8 +45,8 @@ class ppu2c0x_device : public device_t,
public device_video_interface
{
public:
- typedef device_delegate<void (int scanline, int vblank, int blanked)> scanline_delegate;
- typedef device_delegate<void (int scanline, int vblank, int blanked)> hblank_delegate;
+ typedef device_delegate<void (int scanline, bool vblank, bool blanked)> scanline_delegate;
+ typedef device_delegate<void (int scanline, bool vblank, bool blanked)> hblank_delegate;
typedef device_delegate<void (int *ppu_regs)> nmi_delegate;
typedef device_delegate<int (int address, int data)> vidaccess_delegate;
typedef device_delegate<void (offs_t offset)> latch_delegate;
@@ -177,12 +177,15 @@ protected:
ppu2c0x_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock = 0);
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_config_complete() override;
// device_config_memory_interface overrides
virtual space_config_vector memory_space_config() const override;
+ TIMER_CALLBACK_MEMBER(hblank_tick);
+ TIMER_CALLBACK_MEMBER(nmi_tick);
+ TIMER_CALLBACK_MEMBER(scanline_tick);
+
// address space configurations
const address_space_config m_space_config;
@@ -214,15 +217,11 @@ protected:
int m_tilecount; /* MMC5 can change attributes to subsets of the 34 visible tiles */
latch_delegate m_latch;
-
uint8_t readbyte(offs_t address);
uint32_t m_nespens[0x40*8];
-private:
- static constexpr device_timer_id TIMER_HBLANK = 0;
- static constexpr device_timer_id TIMER_NMI = 1;
- static constexpr device_timer_id TIMER_SCANLINE = 2;
+private:
inline void writebyte(offs_t address, uint8_t data);
inline uint16_t apply_grayscale_and_emphasis(uint8_t color);
diff --git a/src/devices/video/pwm.cpp b/src/devices/video/pwm.cpp
index 70fc9f44724..5258b204392 100644
--- a/src/devices/video/pwm.cpp
+++ b/src/devices/video/pwm.cpp
@@ -98,7 +98,7 @@ void pwm_display_device::device_start()
for (auto &bri : m_bri)
std::fill(std::begin(bri), std::end(bri), 0.0);
- m_frame_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pwm_display_device::frame_tick),this));
+ m_frame_timer = timer_alloc(FUNC(pwm_display_device::frame_tick), this);
m_sync_time = machine().time();
// register for savestates
diff --git a/src/devices/video/scn2674.cpp b/src/devices/video/scn2674.cpp
index 96e1e7d3ca5..3461a15083c 100644
--- a/src/devices/video/scn2674.cpp
+++ b/src/devices/video/scn2674.cpp
@@ -112,9 +112,9 @@ void scn2674_device::device_start()
m_mbc_cb.resolve_safe();
m_mbc_char_cb.resolve();
m_mbc_attr_cb.resolve();
- m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(scn2674_device::scanline_timer), this));
- m_breq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(scn2674_device::breq_timer), this));
- m_vblank_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(scn2674_device::vblank_timer), this));
+ m_scanline_timer = timer_alloc(FUNC(scn2674_device::scanline_timer), this);
+ m_breq_timer = timer_alloc(FUNC(scn2674_device::breq_timer), this);
+ m_vblank_timer = timer_alloc(FUNC(scn2674_device::vblank_timer), this);
screen().register_screen_bitmap(m_bitmap);
m_char_space = &space(0);
diff --git a/src/devices/video/sed1500.cpp b/src/devices/video/sed1500.cpp
index abea4b94bc9..57f7a026e4c 100644
--- a/src/devices/video/sed1500.cpp
+++ b/src/devices/video/sed1500.cpp
@@ -69,7 +69,7 @@ void sed1500_device::device_start()
m_write_segs.resolve_safe();
// timer
- m_lcd_timer = timer_alloc();
+ m_lcd_timer = timer_alloc(FUNC(sed1500_device::update_segs), this);
attotime period = attotime::from_hz(clock() / 64);
m_lcd_timer->adjust(period, 0, period);
@@ -84,7 +84,7 @@ void sed1500_device::device_start()
// handlers
//-------------------------------------------------
-void sed1500_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(sed1500_device::update_segs)
{
u64 data = 0;
diff --git a/src/devices/video/sed1500.h b/src/devices/video/sed1500.h
index 1186cbc7e14..21981c35034 100644
--- a/src/devices/video/sed1500.h
+++ b/src/devices/video/sed1500.h
@@ -44,7 +44,8 @@ protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(update_segs);
emu_timer *m_lcd_timer;
diff --git a/src/devices/video/tms34061.cpp b/src/devices/video/tms34061.cpp
index 16d7ba65fa8..8d987b06701 100644
--- a/src/devices/video/tms34061.cpp
+++ b/src/devices/video/tms34061.cpp
@@ -97,7 +97,7 @@ void tms34061_device::device_start()
m_regs[TMS34061_VERCOUNTER] = 0x0000;
/* start vertical interrupt timer */
- m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tms34061_device::interrupt), this));
+ m_timer = timer_alloc(FUNC(tms34061_device::interrupt), this);
save_item(NAME(m_regs));
save_item(NAME(m_xmask));
diff --git a/src/devices/video/tms9927.cpp b/src/devices/video/tms9927.cpp
index 7ef7fb143ca..6ae31a1a9d5 100644
--- a/src/devices/video/tms9927.cpp
+++ b/src/devices/video/tms9927.cpp
@@ -89,8 +89,8 @@ void tms9927_device::device_start()
m_write_hsyn.resolve();
// allocate timers
- m_vsync_timer = timer_alloc(TIMER_VSYNC);
- m_hsync_timer = timer_alloc(TIMER_HSYNC);
+ m_vsync_timer = timer_alloc(FUNC(tms9927_device::toggle_vsync), this);
+ m_hsync_timer = timer_alloc(FUNC(tms9927_device::toggle_hsync), this);
// register for state saving
save_item(NAME(m_reg));
@@ -137,46 +137,42 @@ void tms9927_device::device_stop()
//-------------------------------------------------
-// device_timer - handle timer events
+// timer events
//-------------------------------------------------
-void tms9927_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(tms9927_device::toggle_vsync)
{
- switch (id)
+ m_vsyn = !m_vsyn;
+ m_write_vsyn(m_vsyn ? 1 : 0);
+
+ if (m_vsyn)
{
- case TIMER_VSYNC:
- m_vsyn = !m_vsyn;
- m_write_vsyn(m_vsyn ? 1 : 0);
-
- if (m_vsyn)
- {
- m_vsync_timer->adjust(screen().time_until_pos(m_vsyn_end, m_hsyn_start));
- }
- else
- {
- m_vsync_timer->adjust(screen().time_until_pos(m_vsyn_start, m_hsyn_start));
- }
- break;
-
- case TIMER_HSYNC:
- m_hsyn = !m_hsyn;
- m_write_hsyn(m_hsyn ? 1 : 0);
-
- uint16_t vpos = screen().vpos();
- if (m_hsyn)
- {
- screen().update_now();
- if (screen().hpos() > m_hsyn_end)
- vpos = (vpos + 1) % m_total_vpix;
- m_hsync_timer->adjust(screen().time_until_pos(vpos, m_hsyn_end));
- }
- else
- {
- if (screen().hpos() > m_hsyn_start)
- vpos = (vpos + 1) % m_total_vpix;
- m_hsync_timer->adjust(screen().time_until_pos(vpos, m_hsyn_start));
- }
- break;
+ m_vsync_timer->adjust(screen().time_until_pos(m_vsyn_end, m_hsyn_start));
+ }
+ else
+ {
+ m_vsync_timer->adjust(screen().time_until_pos(m_vsyn_start, m_hsyn_start));
+ }
+}
+
+TIMER_CALLBACK_MEMBER(tms9927_device::toggle_hsync)
+{
+ m_hsyn = !m_hsyn;
+ m_write_hsyn(m_hsyn ? 1 : 0);
+
+ uint16_t vpos = screen().vpos();
+ if (m_hsyn)
+ {
+ screen().update_now();
+ if (screen().hpos() > m_hsyn_end)
+ vpos = (vpos + 1) % m_total_vpix;
+ m_hsync_timer->adjust(screen().time_until_pos(vpos, m_hsyn_end));
+ }
+ else
+ {
+ if (screen().hpos() > m_hsyn_start)
+ vpos = (vpos + 1) % m_total_vpix;
+ m_hsync_timer->adjust(screen().time_until_pos(vpos, m_hsyn_start));
}
}
diff --git a/src/devices/video/tms9927.h b/src/devices/video/tms9927.h
index f407cddb15f..79e42685494 100644
--- a/src/devices/video/tms9927.h
+++ b/src/devices/video/tms9927.h
@@ -45,9 +45,11 @@ protected:
virtual void device_stop() override;
virtual void device_reset() override;
virtual void device_clock_changed() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_post_load() override;
+ TIMER_CALLBACK_MEMBER(toggle_vsync);
+ TIMER_CALLBACK_MEMBER(toggle_hsync);
+
private:
enum
{
diff --git a/src/devices/video/tms9928a.cpp b/src/devices/video/tms9928a.cpp
index 9ff0bbbfa52..dffe7b8ba72 100644
--- a/src/devices/video/tms9928a.cpp
+++ b/src/devices/video/tms9928a.cpp
@@ -351,17 +351,14 @@ void tms9928a_device::register_write(u8 data)
}
}
-void tms9928a_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(tms9928a_device::clock_grom)
{
- // Handle GROM clock if present
- if (id==GROMCLK)
- {
- // Pulse it
- m_out_gromclk_cb(ASSERT_LINE);
- m_out_gromclk_cb(CLEAR_LINE);
- return;
- }
+ m_out_gromclk_cb(ASSERT_LINE);
+ m_out_gromclk_cb(CLEAR_LINE);
+}
+TIMER_CALLBACK_MEMBER(tms9928a_device::update_line)
+{
int raw_vpos = screen().vpos();
int vpos = raw_vpos * m_vertical_size / screen().height();
uint16_t BackColour = m_Regs[7] & 15;
@@ -737,8 +734,8 @@ void tms9928a_device::device_start()
/* back bitmap */
m_tmpbmp.allocate(m_total_horz, TOTAL_VERT_PAL);
- m_line_timer = timer_alloc(TIMER_LINE);
- m_gromclk_timer = timer_alloc(GROMCLK);
+ m_line_timer = timer_alloc(FUNC(tms9928a_device::update_line), this);
+ m_gromclk_timer = timer_alloc(FUNC(tms9928a_device::clock_grom), this);
m_INT = 1; // force initial update
diff --git a/src/devices/video/tms9928a.h b/src/devices/video/tms9928a.h
index addae9e0a20..34dfc7d270f 100644
--- a/src/devices/video/tms9928a.h
+++ b/src/devices/video/tms9928a.h
@@ -95,7 +95,6 @@ protected:
virtual void device_config_complete() override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_memory_interface overrides
virtual space_config_vector memory_space_config() const override;
@@ -103,6 +102,9 @@ protected:
// device_palette_interface overrides
virtual uint32_t palette_entries() const override { return 16; }
+ TIMER_CALLBACK_MEMBER(clock_grom);
+ TIMER_CALLBACK_MEMBER(update_line);
+
private:
void change_register(uint8_t reg, uint8_t val);
void check_interrupt();
@@ -112,11 +114,8 @@ private:
void memmap(address_map &map);
- static const device_timer_id TIMER_LINE = 0;
- static const device_timer_id GROMCLK = 1;
-
int m_vram_size; /* 4K, 8K, or 16K. This should be replaced by fetching data from an address space? */
- devcb_write_line m_out_int_line_cb; /* Callback is called whenever the state of the INT output changes */
+ devcb_write_line m_out_int_line_cb; /* Callback is called whenever the state of the INT output changes */
devcb_write_line m_out_gromclk_cb; // GROMCLK line is optional; if present, pulse it by XTAL/24 rate
/* TMS9928A internal settings */
@@ -132,12 +131,12 @@ private:
uint16_t m_nametbl;
uint16_t m_spriteattribute;
uint16_t m_spritepattern;
- int m_colourmask;
- int m_patternmask;
+ int m_colourmask;
+ int m_patternmask;
const uint16_t m_total_horz;
- const bool m_50hz;
- const bool m_reva;
- const bool m_99;
+ const bool m_50hz;
+ const bool m_reva;
+ const bool m_99;
/* memory */
const address_space_config m_space_config;
@@ -146,7 +145,7 @@ private:
bitmap_rgb32 m_tmpbmp;
emu_timer *m_line_timer;
emu_timer *m_gromclk_timer;
- uint8_t m_mode;
+ uint8_t m_mode;
/* emulation settings */
int m_top_border;
diff --git a/src/devices/video/topcat.cpp b/src/devices/video/topcat.cpp
index 79b679b8e77..5ba43d81e44 100644
--- a/src/devices/video/topcat.cpp
+++ b/src/devices/video/topcat.cpp
@@ -25,7 +25,7 @@ topcat_device::topcat_device(const machine_config &mconfig, const char *tag, dev
void topcat_device::device_start()
{
m_int_write_func.resolve_safe();
- m_cursor_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(topcat_device::cursor_callback), this));
+ m_cursor_timer = timer_alloc(FUNC(topcat_device::cursor_callback), this);
m_cursor_timer->adjust(attotime::from_hz(3));
save_item(NAME(m_vblank));
diff --git a/src/devices/video/upd3301.cpp b/src/devices/video/upd3301.cpp
index 3e40384e387..9e213a6c292 100644
--- a/src/devices/video/upd3301.cpp
+++ b/src/devices/video/upd3301.cpp
@@ -152,9 +152,8 @@ void upd3301_device::device_start()
m_attr_fetch_cb.resolve();
// allocate timers
- m_hrtc_timer = timer_alloc(TIMER_HRTC);
- m_vrtc_timer = timer_alloc(TIMER_VRTC);
- m_drq_timer = timer_alloc(TIMER_DRQ);
+ m_hrtc_timer = timer_alloc(FUNC(upd3301_device::hrtc_update), this);
+ m_vrtc_timer = timer_alloc(FUNC(upd3301_device::vrtc_update), this);
// state saving
save_item(NAME(m_y));
@@ -223,7 +222,7 @@ void upd3301_device::device_clock_changed()
//-------------------------------------------------
-// device_timer - handle timer events
+// timer events
//-------------------------------------------------
// this snipped was inside screen_update fn
@@ -254,45 +253,37 @@ inline void upd3301_device::reset_fifo_vrtc()
m_bitmap.fill(0, screen().visible_area());
}
-void upd3301_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(upd3301_device::hrtc_update)
{
- switch (id)
- {
- case TIMER_HRTC:
- LOGHRTC("HRTC: %u at beam %d x %d\n", param, screen().hpos(), screen().vpos());
-
- m_write_hrtc(param);
- m_hrtc = param;
+ LOGHRTC("HRTC: %u at beam %d x %d\n", param, screen().hpos(), screen().vpos());
- update_hrtc_timer(param);
- break;
+ m_write_hrtc(param);
+ m_hrtc = param;
- case TIMER_VRTC:
- LOGINT("VRTC: %u at y %d\n", param, screen().vpos());
-
- m_write_vrtc(param);
- m_vrtc = param;
+ update_hrtc_timer(param);
+}
- update_vrtc_timer(param);
- if(!get_display_status())
- break;
+TIMER_CALLBACK_MEMBER(upd3301_device::vrtc_update)
+{
+ LOGINT("VRTC: %u at y %d\n", param, screen().vpos());
- if (!param)
- {
- reset_fifo_vrtc();
- set_drq(1);
- }
+ m_write_vrtc(param);
+ m_vrtc = param;
- if (param && !m_me)
- {
- m_status |= STATUS_E;
- set_interrupt(1);
- }
+ update_vrtc_timer(param);
+ if (!get_display_status())
+ return;
- break;
+ if (!param)
+ {
+ reset_fifo_vrtc();
+ set_drq(1);
+ }
- case TIMER_DRQ:
- break;
+ if (param && !m_me)
+ {
+ m_status |= STATUS_E;
+ set_interrupt(1);
}
}
diff --git a/src/devices/video/upd3301.h b/src/devices/video/upd3301.h
index 93f0910cf01..9343f6275b2 100644
--- a/src/devices/video/upd3301.h
+++ b/src/devices/video/upd3301.h
@@ -91,16 +91,11 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_clock_changed() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-private:
- enum
- {
- TIMER_HRTC,
- TIMER_VRTC,
- TIMER_DRQ
- };
+ TIMER_CALLBACK_MEMBER(hrtc_update);
+ TIMER_CALLBACK_MEMBER(vrtc_update);
+private:
void set_interrupt(int state);
void set_drq(int state);
void set_display(int state);
@@ -177,7 +172,6 @@ private:
// timers
emu_timer *m_hrtc_timer;
emu_timer *m_vrtc_timer;
- emu_timer *m_drq_timer;
};
diff --git a/src/devices/video/upd7220.cpp b/src/devices/video/upd7220.cpp
index fb4da2002ac..9925dc60da8 100644
--- a/src/devices/video/upd7220.cpp
+++ b/src/devices/video/upd7220.cpp
@@ -673,9 +673,9 @@ void upd7220_device::device_start()
m_write_blank.resolve_safe();
// allocate timers
- m_vsync_timer = timer_alloc(TIMER_VSYNC);
- m_hsync_timer = timer_alloc(TIMER_HSYNC);
- m_blank_timer = timer_alloc(TIMER_BLANK);
+ m_vsync_timer = timer_alloc(FUNC(upd7220_device::vsync_update), this);
+ m_hsync_timer = timer_alloc(FUNC(upd7220_device::hsync_update), this);
+ m_blank_timer = timer_alloc(FUNC(upd7220_device::blank_update), this);
// register for state saving
save_item(NAME(m_ra));
@@ -735,58 +735,55 @@ void upd7220_device::device_reset()
//-------------------------------------------------
-// device_timer - handler timer events
+// timer events
//-------------------------------------------------
-void upd7220_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(upd7220_device::hsync_update)
{
- switch (id)
+ if (param)
{
- case TIMER_HSYNC:
- if (param)
- {
- m_sr |= UPD7220_SR_HBLANK_ACTIVE;
- }
- else
- {
- m_sr &= ~UPD7220_SR_HBLANK_ACTIVE;
- }
+ m_sr |= UPD7220_SR_HBLANK_ACTIVE;
+ }
+ else
+ {
+ m_sr &= ~UPD7220_SR_HBLANK_ACTIVE;
+ }
- m_write_hsync(param);
+ m_write_hsync(param);
- update_hsync_timer(param);
- break;
+ update_hsync_timer(param);
+}
- case TIMER_VSYNC:
- if (param)
- {
- m_sr |= UPD7220_SR_VSYNC_ACTIVE;
- }
- else
- {
- m_sr &= ~UPD7220_SR_VSYNC_ACTIVE;
- }
+TIMER_CALLBACK_MEMBER(upd7220_device::vsync_update)
+{
+ if (param)
+ {
+ m_sr |= UPD7220_SR_VSYNC_ACTIVE;
+ }
+ else
+ {
+ m_sr &= ~UPD7220_SR_VSYNC_ACTIVE;
+ }
- m_write_vsync(param);
+ m_write_vsync(param);
- update_vsync_timer(param);
- break;
+ update_vsync_timer(param);
+}
- case TIMER_BLANK:
- if (param)
- {
- m_sr |= UPD7220_SR_HBLANK_ACTIVE;
- }
- else
- {
- m_sr &= ~UPD7220_SR_HBLANK_ACTIVE;
- }
+TIMER_CALLBACK_MEMBER(upd7220_device::blank_update)
+{
+ if (param)
+ {
+ m_sr |= UPD7220_SR_HBLANK_ACTIVE;
+ }
+ else
+ {
+ m_sr &= ~UPD7220_SR_HBLANK_ACTIVE;
+ }
- m_write_blank(param);
+ m_write_blank(param);
- update_blank_timer(param);
- break;
- }
+ update_blank_timer(param);
}
diff --git a/src/devices/video/upd7220.h b/src/devices/video/upd7220.h
index 67c370aecb5..fa476bb3662 100644
--- a/src/devices/video/upd7220.h
+++ b/src/devices/video/upd7220.h
@@ -85,13 +85,17 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual const tiny_rom_entry *device_rom_region() const override;
virtual space_config_vector memory_space_config() const override;
+ TIMER_CALLBACK_MEMBER(hsync_update);
+ TIMER_CALLBACK_MEMBER(vsync_update);
+ TIMER_CALLBACK_MEMBER(blank_update);
+
void start_dma();
void stop_dma();
+
private:
enum
{
diff --git a/src/devices/video/v9938.cpp b/src/devices/video/v9938.cpp
index 9aa2d4b0aa8..906e92353f7 100644
--- a/src/devices/video/v9938.cpp
+++ b/src/devices/video/v9938.cpp
@@ -172,11 +172,11 @@ void v99x8_device::device_config_complete()
}
-void v99x8_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(v99x8_device::update_line)
{
int scanline = (m_scanline - (m_scanline_start + m_offset_y));
- update_command ();
+ update_command();
// set flags
if (m_scanline == (m_scanline_start + m_offset_y))
@@ -626,7 +626,7 @@ void v99x8_device::device_start()
for (int addr = m_vram_size; addr < 0x30000; addr++) m_vram_space->write_byte(addr, 0xff);
}
- m_line_timer = timer_alloc(TIMER_LINE);
+ m_line_timer = timer_alloc(FUNC(v99x8_device::update_line), this);
palette_init();
diff --git a/src/devices/video/v9938.h b/src/devices/video/v9938.h
index 0e41ced86ab..b4ac02771da 100644
--- a/src/devices/video/v9938.h
+++ b/src/devices/video/v9938.h
@@ -88,7 +88,6 @@ protected:
// construction/destruction
v99x8_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int model);
- static constexpr device_timer_id TIMER_LINE = 0;
const address_space_config m_space_config;
address_space* m_vram_space;
@@ -100,7 +99,6 @@ protected:
virtual void device_config_complete() override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_post_load() override;
// device_memory_interface overrides
@@ -109,6 +107,8 @@ protected:
virtual void palette_init() = 0;
virtual u32 palette_entries() const override { return 16 + 256; }
+ TIMER_CALLBACK_MEMBER(update_line);
+
void configure_pal_ntsc();
void set_screen_parameters();
diff --git a/src/devices/video/vic4567.cpp b/src/devices/video/vic4567.cpp
index 99f2e5af476..5f1c756c50d 100644
--- a/src/devices/video/vic4567.cpp
+++ b/src/devices/video/vic4567.cpp
@@ -172,10 +172,8 @@ vic3_device::vic3_device(const machine_config &mconfig, const char *tag, device_
void vic3_device::device_start()
{
- int width, height;
-
- width = screen().width();
- height = screen().height();
+ int width = screen().width();
+ int height = screen().height();
m_bitmap = std::make_unique<bitmap_ind16>(width, height);
@@ -1983,7 +1981,7 @@ void vic3_device::raster_interrupt_gen()
if (LIGHTPEN_BUTTON)
{
/* lightpen timer start */
- machine().scheduler().timer_set(attotime(0, 0), timer_expired_delegate(FUNC(vic3_device::timer_timeout),this), 1);
+ machine().scheduler().synchronize(timer_expired_delegate(FUNC(vic3_device::timer_timeout), this), 1);
}
}
diff --git a/src/devices/video/vic4567.h b/src/devices/video/vic4567.h
index 64fedb3da16..8afe986c41c 100644
--- a/src/devices/video/vic4567.h
+++ b/src/devices/video/vic4567.h
@@ -191,7 +191,8 @@ private:
uint16_t m_c64_bitmap[2], m_bitmapmulti[4], m_mono[2], m_multi[4], m_ecmcolor[2], m_colors[4], m_spritemulti[4];
- int m_lastline, m_rasterline;
+ int m_lastline;
+ int m_rasterline;
int m_interlace;
int m_columns, m_rows;
diff --git a/src/devices/video/voodoo.cpp b/src/devices/video/voodoo.cpp
index 23b44b4c90b..94c9a5ca7c7 100644
--- a/src/devices/video/voodoo.cpp
+++ b/src/devices/video/voodoo.cpp
@@ -924,8 +924,8 @@ void voodoo_1_device::device_start()
m_stall_trigger = 51324 + index;
// allocate timers for VBLANK
- m_vsync_stop_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(voodoo_1_device::vblank_stop), this));
- m_vsync_start_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(voodoo_1_device::vblank_start),this));
+ m_vsync_stop_timer = timer_alloc(FUNC(voodoo_1_device::vblank_stop), this);
+ m_vsync_start_timer = timer_alloc(FUNC(voodoo_1_device::vblank_start),this);
// add TMUs to the chipmask if memory is specified (later chips leave
// the tmumem values at 0 and set the chipmask directly to indicate
@@ -1011,7 +1011,7 @@ void voodoo_1_device::device_start()
// set up the PCI FIFO
m_pci_fifo.configure(m_pci_fifo_mem, 64*2);
m_stall_state = NOT_STALLED;
- m_stall_resume_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(voodoo_1_device::stall_resume_callback), this));
+ m_stall_resume_timer = timer_alloc(FUNC(voodoo_1_device::stall_resume_callback), this);
// initialize registers
m_init_enable = 0;
diff --git a/src/devices/video/zeus2.cpp b/src/devices/video/zeus2.cpp
index 2772c4d1c12..300b5ad2d0c 100644
--- a/src/devices/video/zeus2.cpp
+++ b/src/devices/video/zeus2.cpp
@@ -49,16 +49,13 @@ TIMER_CALLBACK_MEMBER(zeus2_device::display_irq_off)
// vblank_period = screen().frame_period();
//vblank_timer->adjust(vblank_period);
vblank_timer->adjust(screen().time_until_vblank_start());
- //machine().scheduler().timer_set(attotime::from_hz(30000000), timer_expired_delegate(FUNC(zeus2_device::display_irq), this));
}
TIMER_CALLBACK_MEMBER(zeus2_device::display_irq)
{
m_vblank(ASSERT_LINE);
/* set a timer for the next off state */
- //machine().scheduler().timer_set(screen().time_until_pos(0), timer_expired_delegate(FUNC(zeus2_device::display_irq_off), this));
- machine().scheduler().timer_set(screen().time_until_vblank_end(), timer_expired_delegate(FUNC(zeus2_device::display_irq_off), this));
- //machine().scheduler().timer_set(attotime::from_hz(30000000), timer_expired_delegate(FUNC(zeus2_device::display_irq_off), this));
+ vblank_off_timer->adjust(screen().time_until_vblank_end());
}
TIMER_CALLBACK_MEMBER(zeus2_device::int_timer_callback)
@@ -88,9 +85,9 @@ void zeus2_device::device_start()
/* we need to cleanup on exit */
//machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(&zeus2_device::exit_handler2, this));
- int_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(zeus2_device::int_timer_callback), this));
-
- vblank_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(zeus2_device::display_irq), this));
+ int_timer = timer_alloc(FUNC(zeus2_device::int_timer_callback), this);
+ vblank_timer = timer_alloc(FUNC(zeus2_device::display_irq), this);
+ vblank_off_timer = timer_alloc(FUNC(zeus2_device::display_irq_off), this);
//printf("%s\n", machine().system().name);
// Set system type
diff --git a/src/devices/video/zeus2.h b/src/devices/video/zeus2.h
index cdc38aa2227..459fff99799 100644
--- a/src/devices/video/zeus2.h
+++ b/src/devices/video/zeus2.h
@@ -147,6 +147,7 @@ public:
emu_timer *int_timer;
emu_timer *vblank_timer;
+ emu_timer *vblank_off_timer;
int yoffs;
int texel_width;
float zbase;
diff --git a/src/emu/device.cpp b/src/emu/device.cpp
index 6a4b0d4b685..425ce52d461 100644
--- a/src/emu/device.cpp
+++ b/src/emu/device.cpp
@@ -460,28 +460,6 @@ u64 device_t::attotime_to_clocks(const attotime &duration) const noexcept
//-------------------------------------------------
-// timer_alloc - allocate a timer for our device
-// callback
-//-------------------------------------------------
-
-emu_timer *device_t::timer_alloc(device_timer_id id)
-{
- return machine().scheduler().timer_alloc(*this, id);
-}
-
-
-//-------------------------------------------------
-// timer_set - set a temporary timer that will
-// call our device callback
-//-------------------------------------------------
-
-void device_t::timer_set(const attotime &duration, device_timer_id id, int param)
-{
- machine().scheduler().timer_set(duration, *this, id, param);
-}
-
-
-//-------------------------------------------------
// set_machine - notify that the machine now
// exists
//-------------------------------------------------
@@ -882,17 +860,6 @@ void device_t::device_debug_setup()
//-------------------------------------------------
-// device_timer - called whenever a device timer
-// fires
-//-------------------------------------------------
-
-void device_t::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- // do nothing by default
-}
-
-
-//-------------------------------------------------
// subdevice_slow - perform a slow name lookup,
// caching the results
//-------------------------------------------------
diff --git a/src/emu/device.h b/src/emu/device.h
index 4ea1a940320..402bbb1ccff 100644
--- a/src/emu/device.h
+++ b/src/emu/device.h
@@ -468,10 +468,6 @@ constexpr auto driver_device_creator = &emu::detail::driver_tag_func<DriverClass
class device_missing_dependencies : public emu_exception { };
-// timer IDs for devices
-typedef u32 device_timer_id;
-
-
/// \brief Base class for devices
///
/// The base class for all device implementations in MAME's modular
@@ -706,10 +702,7 @@ public:
u64 attotime_to_clocks(const attotime &duration) const noexcept;
// timer interfaces
- emu_timer *timer_alloc(device_timer_id id = 0);
- void timer_set(const attotime &duration, device_timer_id id = 0, int param = 0);
- void synchronize(device_timer_id id = 0, int param = 0) { timer_set(attotime::zero, id, param); }
- void timer_expired(emu_timer &timer, device_timer_id id, int param) { device_timer(timer, id, param); }
+ template <typename... T> emu_timer *timer_alloc(T &&... args);
/// \brief Register data for save states
///
@@ -977,7 +970,6 @@ protected:
virtual void device_clock_changed();
virtual void device_debug_setup();
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param);
//------------------- end derived class overrides
diff --git a/src/emu/device.ipp b/src/emu/device.ipp
index 820f81093d0..c7b2d43346b 100644
--- a/src/emu/device.ipp
+++ b/src/emu/device.ipp
@@ -75,6 +75,11 @@ inline void device_delegate_helper::set_tag(device_finder<DeviceClass, Required>
} // namespace emu::detail
+template <typename... T>
+inline emu_timer *device_t::timer_alloc(T &&... args)
+{
+ return machine().scheduler().timer_alloc(timer_expired_delegate(std::forward<T>(args)...));
+}
template <typename Format, typename... Params>
inline void device_t::popmessage(Format &&fmt, Params &&... args) const
diff --git a/src/emu/diexec.cpp b/src/emu/diexec.cpp
index 0e9074fe3b2..b1f885e2b9d 100644
--- a/src/emu/diexec.cpp
+++ b/src/emu/diexec.cpp
@@ -68,6 +68,7 @@ device_execute_interface::device_execute_interface(const machine_config &mconfig
, m_divshift(0)
, m_cycles_per_second(0)
, m_attoseconds_per_cycle(0)
+ , m_spin_end_timer(nullptr)
{
memset(&m_localtime, 0, sizeof(m_localtime));
@@ -164,7 +165,7 @@ void device_execute_interface::spin_until_time(const attotime &duration)
suspend_until_trigger(TRIGGER_SUSPENDTIME + timetrig, true);
// then set a timer for it
- m_scheduler->timer_set(duration, timer_expired_delegate(FUNC(device_execute_interface::timed_trigger_callback),this), TRIGGER_SUSPENDTIME + timetrig);
+ m_spin_end_timer->adjust(duration, TRIGGER_SUSPENDTIME + timetrig);
timetrig = (timetrig + 1) % 256;
}
@@ -384,9 +385,16 @@ void device_execute_interface::interface_pre_start()
m_profiler = profile_type(index + PROFILER_DEVICE_FIRST);
m_inttrigger = index + TRIGGER_INT;
- // allocate timers if we need them
+ // allocate a timed-interrupt timer if we need it
if (m_timed_interrupt_period != attotime::zero)
m_timedint_timer = m_scheduler->timer_alloc(timer_expired_delegate(FUNC(device_execute_interface::trigger_periodic_interrupt), this));
+
+ // allocate a timer for triggering the end of spin-until conditions
+ m_spin_end_timer = m_scheduler->timer_alloc(timer_expired_delegate(FUNC(device_execute_interface::timed_trigger_callback), this));
+
+ // allocate input-pulse timers if we have input lines
+ for (u32 i = 0; i < MAX_INPUT_LINES; i++)
+ m_pulse_end_timers[i] = m_scheduler->timer_alloc(timer_expired_delegate(FUNC(device_execute_interface::irq_pulse_clear), this));
}
@@ -619,7 +627,7 @@ void device_execute_interface::pulse_input_line(int irqline, const attotime &dur
set_input_line(irqline, ASSERT_LINE);
attotime target_time = local_time() + duration;
- m_scheduler->timer_set(target_time - m_scheduler->time(), timer_expired_delegate(FUNC(device_execute_interface::irq_pulse_clear), this), irqline);
+ m_pulse_end_timers[irqline]->adjust(target_time - m_scheduler->time(), irqline);
}
}
diff --git a/src/emu/diexec.h b/src/emu/diexec.h
index 1490c20389d..5d3fb93ed59 100644
--- a/src/emu/diexec.h
+++ b/src/emu/diexec.h
@@ -324,6 +324,9 @@ private:
u32 m_cycles_per_second; // cycles per second, adjusted for multipliers
attoseconds_t m_attoseconds_per_cycle; // attoseconds per adjusted clock cycle
+ emu_timer * m_spin_end_timer; // timer for triggering the end of spin_until_time
+ emu_timer * m_pulse_end_timers[MAX_INPUT_LINES]; // timer for ending input-line pulses
+
// callbacks
TIMER_CALLBACK_MEMBER(timed_trigger_callback) { trigger(param); }
diff --git a/src/emu/drivers/testcpu.cpp b/src/emu/drivers/testcpu.cpp
index 1cdb945db88..95e3d5a1ec2 100644
--- a/src/emu/drivers/testcpu.cpp
+++ b/src/emu/drivers/testcpu.cpp
@@ -38,7 +38,7 @@ public:
}
// timer callback; used to wrest control of the system
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override
+ TIMER_CALLBACK_MEMBER(timer_tick)
{
static const u32 sample_instructions[] =
{
@@ -101,7 +101,7 @@ public:
m_cpu->ppcdrc_set_options(PPCDRC_COMPATIBLE_OPTIONS);
// set a timer to go off right away
- timer_set(attotime::zero);
+ timer_alloc(FUNC(timer_tick), this)->adjust(attotime::zero);
}
// dump the current CPU state
diff --git a/src/emu/schedule.cpp b/src/emu/schedule.cpp
index dd72dfa13b0..ef3961c84f4 100644
--- a/src/emu/schedule.cpp
+++ b/src/emu/schedule.cpp
@@ -53,9 +53,7 @@ emu_timer::emu_timer() :
m_temporary(false),
m_period(attotime::zero),
m_start(attotime::zero),
- m_expire(attotime::never),
- m_device(nullptr),
- m_id(0)
+ m_expire(attotime::never)
{
}
@@ -87,8 +85,6 @@ inline emu_timer &emu_timer::init(running_machine &machine, timer_expired_delega
m_period = attotime::never;
m_start = machine.time();
m_expire = attotime::never;
- m_device = nullptr;
- m_id = 0;
// if we're not temporary, register ourselves with the save state system
if (!m_temporary)
@@ -101,37 +97,6 @@ inline emu_timer &emu_timer::init(running_machine &machine, timer_expired_delega
//-------------------------------------------------
-// init - completely initialize the state when
-// re-allocated as a device timer
-//-------------------------------------------------
-
-inline emu_timer &emu_timer::init(device_t &device, device_timer_id id, bool temporary)
-{
- // ensure the entire timer state is clean
- m_machine = &device.machine();
- m_next = nullptr;
- m_prev = nullptr;
- m_callback = timer_expired_delegate(FUNC(emu_timer::device_timer_expired), this);
- m_param = 0;
- m_enabled = false;
- m_temporary = temporary;
- m_period = attotime::never;
- m_start = machine().time();
- m_expire = attotime::never;
- m_device = &device;
- m_id = id;
-
- // if we're not temporary, register ourselves with the save state system
- if (!m_temporary)
- register_save();
-
- // insert into the list
- machine().scheduler().timer_list_insert(*this);
- return *this;
-}
-
-
-//-------------------------------------------------
// release - release us from the global list
// management when deallocating
//-------------------------------------------------
@@ -233,38 +198,24 @@ attotime emu_timer::remaining() const noexcept
void emu_timer::register_save()
{
- // determine our instance number and name
+ // determine our instance number - timers are indexed based on the callback function name
int index = 0;
- std::string name;
-
- if (m_device == nullptr)
- {
- // for non-device timers, it is an index based on the callback function name
- name = m_callback.name() ? m_callback.name() : "unnamed";
- for (emu_timer *curtimer = machine().scheduler().first_timer(); curtimer != nullptr; curtimer = curtimer->next())
- if (!curtimer->m_temporary && curtimer->m_device == nullptr)
- {
- if (curtimer->m_callback.name() != nullptr && m_callback.name() != nullptr && strcmp(curtimer->m_callback.name(), m_callback.name()) == 0)
- index++;
- else if (curtimer->m_callback.name() == nullptr && m_callback.name() == nullptr)
- index++;
- }
- }
- else
- {
- // for device timers, it is an index based on the device and timer ID
- name = string_format("%s/%d", m_device->tag(), m_id);
- for (emu_timer *curtimer = machine().scheduler().first_timer(); curtimer != nullptr; curtimer = curtimer->next())
- if (!curtimer->m_temporary && curtimer->m_device == m_device && curtimer->m_id == m_id)
+ std::string name = m_callback.name() ? m_callback.name() : "unnamed";
+ for (emu_timer *curtimer = machine().scheduler().first_timer(); curtimer != nullptr; curtimer = curtimer->next())
+ if (!curtimer->m_temporary)
+ {
+ if (curtimer->m_callback.name() != nullptr && m_callback.name() != nullptr && strcmp(curtimer->m_callback.name(), m_callback.name()) == 0)
index++;
- }
+ else if (curtimer->m_callback.name() == nullptr && m_callback.name() == nullptr)
+ index++;
+ }
// save the bits
- machine().save().save_item(m_device, "timer", name.c_str(), index, NAME(m_param));
- machine().save().save_item(m_device, "timer", name.c_str(), index, NAME(m_enabled));
- machine().save().save_item(m_device, "timer", name.c_str(), index, NAME(m_period));
- machine().save().save_item(m_device, "timer", name.c_str(), index, NAME(m_start));
- machine().save().save_item(m_device, "timer", name.c_str(), index, NAME(m_expire));
+ machine().save().save_item(nullptr, "timer", name.c_str(), index, NAME(m_param));
+ machine().save().save_item(nullptr, "timer", name.c_str(), index, NAME(m_enabled));
+ machine().save().save_item(nullptr, "timer", name.c_str(), index, NAME(m_period));
+ machine().save().save_item(nullptr, "timer", name.c_str(), index, NAME(m_start));
+ machine().save().save_item(nullptr, "timer", name.c_str(), index, NAME(m_expire));
}
@@ -294,24 +245,10 @@ inline void emu_timer::schedule_next_period()
void emu_timer::dump() const
{
machine().logerror("%p: en=%d temp=%d exp=%15s start=%15s per=%15s param=%d", this, m_enabled, m_temporary, m_expire.as_string(PRECISION), m_start.as_string(PRECISION), m_period.as_string(PRECISION), m_param);
- if (m_device == nullptr)
- if (m_callback.name() == nullptr)
- machine().logerror(" cb=NULL\n");
- else
- machine().logerror(" cb=%s\n", m_callback.name());
+ if (m_callback.name() == nullptr)
+ machine().logerror(" cb=NULL\n");
else
- machine().logerror(" dev=%s id=%d\n", m_device->tag(), m_id);
-}
-
-
-//-------------------------------------------------
-// device_timer_expired - trampoline to avoid a
-// conditional jump on the hot path
-//-------------------------------------------------
-
-void emu_timer::device_timer_expired(emu_timer &timer, s32 param)
-{
- timer.m_device->timer_expired(timer, timer.m_id, param);
+ machine().logerror(" cb=%s\n", m_callback.name());
}
@@ -613,29 +550,6 @@ void device_scheduler::timer_set(const attotime &duration, timer_expired_delegat
//-------------------------------------------------
-// timer_alloc - allocate a global device timer
-// and return a pointer
-//-------------------------------------------------
-
-emu_timer *device_scheduler::timer_alloc(device_t &device, device_timer_id id)
-{
- return &m_timer_allocator.alloc()->init(device, id, false);
-}
-
-
-//-------------------------------------------------
-// timer_set - allocate an anonymous device timer
-// and set it to go off after the given amount of
-// time
-//-------------------------------------------------
-
-void device_scheduler::timer_set(const attotime &duration, device_t &device, device_timer_id id, int param)
-{
- m_timer_allocator.alloc()->init(device, id, true).adjust(duration, param);
-}
-
-
-//-------------------------------------------------
// eat_all_cycles - eat a ton of cycles on all
// CPUs to force a quick exit
//-------------------------------------------------
@@ -897,10 +811,7 @@ inline void device_scheduler::execute_timers()
if (!timer.m_callback.isnull())
{
- if (timer.m_device != nullptr)
- LOG("execute_timers: timer device %s timer %d\n", timer.m_device->tag(), timer.m_id);
- else
- LOG("execute_timers: timer callback %s\n", timer.m_callback.name());
+ LOG("execute_timers: timer callback %s\n", timer.m_callback.name());
timer.m_callback(timer.m_param);
}
diff --git a/src/emu/schedule.h b/src/emu/schedule.h
index b194c8b2d1c..e009850cf34 100644
--- a/src/emu/schedule.h
+++ b/src/emu/schedule.h
@@ -46,7 +46,6 @@ class emu_timer
// allocation and re-use
emu_timer &init(running_machine &machine, timer_expired_delegate callback, bool temporary);
- emu_timer &init(device_t &device, device_timer_id id, bool temporary);
emu_timer &release();
public:
@@ -76,7 +75,6 @@ private:
void register_save();
void schedule_next_period();
void dump() const;
- static void device_timer_expired(emu_timer &timer, s32 param);
// internal state
running_machine * m_machine; // reference to the owning machine
@@ -89,8 +87,6 @@ private:
attotime m_period; // the repeat frequency of the timer
attotime m_start; // time when the timer was started
attotime m_expire; // time when the timer will expire
- device_t * m_device; // for device timers, a pointer to the device
- device_timer_id m_id; // for device timers, the ID of the timer
};
@@ -122,13 +118,10 @@ public:
// timers, specified by callback/name
emu_timer *timer_alloc(timer_expired_delegate callback);
+ [[deprecated("timer_set is deprecated; please avoid anonymous timers. Use TIMER_CALLBACK_MEMBER and an allocated emu_timer instead.")]]
void timer_set(const attotime &duration, timer_expired_delegate callback, int param = 0);
void synchronize(timer_expired_delegate callback = timer_expired_delegate(), int param = 0) { timer_set(attotime::zero, callback, param); }
- // timers, specified by device/id; generally devices should use the device_t methods instead
- emu_timer *timer_alloc(device_t &device, device_timer_id id = 0);
- void timer_set(const attotime &duration, device_t &device, device_timer_id id = 0, int param = 0);
-
// debugging
void dump_timers() const;
diff --git a/src/emu/screen.cpp b/src/emu/screen.cpp
index 77ae6fbea02..f69a03ac13e 100644
--- a/src/emu/screen.cpp
+++ b/src/emu/screen.cpp
@@ -835,15 +835,15 @@ void screen_device::device_start()
m_container->set_user_settings(settings);
// allocate the VBLANK timers
- m_vblank_begin_timer = timer_alloc(TID_VBLANK_START);
- m_vblank_end_timer = timer_alloc(TID_VBLANK_END);
+ m_vblank_begin_timer = timer_alloc(FUNC(screen_device::vblank_begin), this);
+ m_vblank_end_timer = timer_alloc(FUNC(screen_device::vblank_end), this);
// allocate a timer to reset partial updates
- m_scanline0_timer = timer_alloc(TID_SCANLINE0);
+ m_scanline0_timer = timer_alloc(FUNC(screen_device::first_scanline_tick), this);
// allocate a timer to generate per-scanline updates
if ((m_video_attributes & VIDEO_UPDATE_SCANLINE) != 0 || m_scanline_cb)
- m_scanline_timer = timer_alloc(TID_SCANLINE);
+ m_scanline_timer = timer_alloc(FUNC(screen_device::scanline_tick), this);
// configure the screen with the default parameters
configure(m_width, m_height, m_visarea, m_refresh);
@@ -931,54 +931,39 @@ void screen_device::device_post_load()
//-------------------------------------------------
-// device_timer - called whenever a device timer
-// fires
+// timer events
//-------------------------------------------------
-void screen_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(screen_device::first_scanline_tick)
{
- switch (id)
+ // first scanline
+ reset_partial_updates();
+ if (m_video_attributes & VIDEO_VARIABLE_WIDTH)
{
- // signal VBLANK start
- case TID_VBLANK_START:
- vblank_begin();
- break;
-
- // signal VBLANK end
- case TID_VBLANK_END:
- vblank_end();
- break;
-
- // first scanline
- case TID_SCANLINE0:
- reset_partial_updates();
- if (m_video_attributes & VIDEO_VARIABLE_WIDTH)
- {
- pre_update_scanline(0);
- }
- break;
+ pre_update_scanline(0);
+ }
+}
- // subsequent scanlines when scanline updates are enabled
- case TID_SCANLINE:
- if (m_video_attributes & VIDEO_VARIABLE_WIDTH)
- {
- pre_update_scanline(param);
- }
- if (m_video_attributes & VIDEO_UPDATE_SCANLINE)
- {
- // force a partial update to the current scanline
- update_partial(param);
- }
- if (m_scanline_cb)
- m_scanline_cb(param);
-
- // compute the next visible scanline
- param++;
- if (param > m_visarea.bottom())
- param = m_visarea.top();
- m_scanline_timer->adjust(time_until_pos(param), param);
- break;
+TIMER_CALLBACK_MEMBER(screen_device::scanline_tick)
+{
+ // subsequent scanlines when scanline updates are enabled
+ if (m_video_attributes & VIDEO_VARIABLE_WIDTH)
+ {
+ pre_update_scanline(param);
+ }
+ if (m_video_attributes & VIDEO_UPDATE_SCANLINE)
+ {
+ // force a partial update to the current scanline
+ update_partial(param);
}
+ if (m_scanline_cb)
+ m_scanline_cb(param);
+
+ // compute the next visible scanline
+ param++;
+ if (param > m_visarea.bottom())
+ param = m_visarea.top();
+ m_scanline_timer->adjust(time_until_pos(param), param);
}
@@ -1027,7 +1012,7 @@ void screen_device::configure(int width, int height, const rectangle &visarea, a
// call the VBLANK start timer now; otherwise, adjust it for the future
attoseconds_t delta = (machine().time() - m_vblank_start_time).as_attoseconds();
if (delta >= m_frame_period)
- vblank_begin();
+ vblank_begin(0);
else
m_vblank_begin_timer->adjust(time_until_vblank_start());
@@ -1065,7 +1050,7 @@ void screen_device::reset_origin(int beamy, int beamx)
// if we are resetting relative to (visarea.bottom() + 1, 0) == VBLANK start,
// call the VBLANK start timer now; otherwise, adjust it for the future
if (beamy == ((m_visarea.bottom() + 1) % m_height) && beamx == 0)
- vblank_begin();
+ vblank_begin(0);
else
m_vblank_begin_timer->adjust(time_until_vblank_start());
}
@@ -1650,7 +1635,7 @@ void screen_device::register_screen_bitmap(bitmap_t &bitmap)
// signal the VBLANK period has begun
//-------------------------------------------------
-void screen_device::vblank_begin()
+TIMER_CALLBACK_MEMBER(screen_device::vblank_begin)
{
// reset the starting VBLANK time
m_vblank_start_time = machine().time();
@@ -1670,7 +1655,7 @@ void screen_device::vblank_begin()
// if no VBLANK period, call the VBLANK end callback immediately, otherwise reset the timer
if (m_vblank_period == 0)
- vblank_end();
+ vblank_end(0);
else
m_vblank_end_timer->adjust(time_until_vblank_end());
}
@@ -1681,7 +1666,7 @@ void screen_device::vblank_begin()
// signal the VBLANK period has ended
//-------------------------------------------------
-void screen_device::vblank_end()
+TIMER_CALLBACK_MEMBER(screen_device::vblank_end)
{
// call the screen specific callbacks
for (auto &item : m_callback_list)
diff --git a/src/emu/screen.h b/src/emu/screen.h
index f5fa859a8c2..685d4c913a9 100644
--- a/src/emu/screen.h
+++ b/src/emu/screen.h
@@ -424,15 +424,6 @@ public:
private:
class svg_renderer;
- // timer IDs
- enum
- {
- TID_VBLANK_START,
- TID_VBLANK_END,
- TID_SCANLINE0,
- TID_SCANLINE
- };
-
// device-level overrides
virtual void device_validity_check(validity_checker &valid) const override;
virtual void device_config_complete() override;
@@ -441,13 +432,14 @@ private:
virtual void device_reset() override;
virtual void device_stop() override;
virtual void device_post_load() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// internal helpers
void set_container(render_container &container) { m_container = &container; }
void realloc_screen_bitmaps();
- void vblank_begin();
- void vblank_end();
+ TIMER_CALLBACK_MEMBER(vblank_begin);
+ TIMER_CALLBACK_MEMBER(vblank_end);
+ TIMER_CALLBACK_MEMBER(first_scanline_tick);
+ TIMER_CALLBACK_MEMBER(scanline_tick);
void finalize_burnin();
void load_effect_overlay(const char *filename);
void update_scan_bitmap_size(int y);
diff --git a/src/emu/sound.cpp b/src/emu/sound.cpp
index a4cb5041d8f..88cdade710d 100644
--- a/src/emu/sound.cpp
+++ b/src/emu/sound.cpp
@@ -602,7 +602,7 @@ sound_stream::sound_stream(device_t &device, u32 inputs, u32 outputs, u32 output
// create an update timer for synchronous streams
if (synchronous())
- m_sync_timer = m_device.machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sound_stream::sync_update), this));
+ m_sync_timer = m_device.timer_alloc(FUNC(sound_stream::sync_update), this);
// force an update to the sample rates
sample_rate_changed();
diff --git a/src/mame/audio/acan.cpp b/src/mame/audio/acan.cpp
index f9e559236a1..9afd46a1292 100644
--- a/src/mame/audio/acan.cpp
+++ b/src/mame/audio/acan.cpp
@@ -35,7 +35,7 @@ void acan_sound_device::device_start()
{
m_stream = stream_alloc(0, 2, clock() / 16 / 5);
m_mix = std::make_unique<int32_t[]>((clock() / 16 / 5) * 2);
- m_timer = timer_alloc(0);
+ m_timer = timer_alloc(FUNC(acan_sound_device::channel_irq), this);
m_timer_irq_handler.resolve_safe();
m_dma_irq_handler.resolve_safe();
@@ -71,7 +71,7 @@ void acan_sound_device::device_reset()
m_dma_irq_handler(0);
}
-void acan_sound_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(acan_sound_device::channel_irq)
{
if (m_regs[0x14] & 0x40)
{
diff --git a/src/mame/audio/acan.h b/src/mame/audio/acan.h
index b56ffd1cebe..f3cbe74b1f4 100644
--- a/src/mame/audio/acan.h
+++ b/src/mame/audio/acan.h
@@ -27,11 +27,12 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// sound stream update overrides
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
+ TIMER_CALLBACK_MEMBER(channel_irq);
+
private:
struct acan_channel
{
diff --git a/src/mame/audio/ad_sound.cpp b/src/mame/audio/ad_sound.cpp
index 3f249326cd8..61700edd1b6 100644
--- a/src/mame/audio/ad_sound.cpp
+++ b/src/mame/audio/ad_sound.cpp
@@ -407,7 +407,7 @@ void ad_59mc07_device::device_start()
save_item(NAME(m_cymvol));
save_item(NAME(m_hihatvol));
- m_adjuster_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ad_59mc07_device::frq_adjuster_callback), this));
+ m_adjuster_timer = timer_alloc(FUNC(ad_59mc07_device::frq_adjuster_callback), this);
m_adjuster_timer->adjust(attotime::from_hz(60), 0, attotime::from_hz(60));
}
diff --git a/src/mame/audio/alesis.cpp b/src/mame/audio/alesis.cpp
index 102de6566bb..ee38f6bea76 100644
--- a/src/mame/audio/alesis.cpp
+++ b/src/mame/audio/alesis.cpp
@@ -33,6 +33,11 @@ alesis_dm3ag_device::alesis_dm3ag_device(const machine_config &mconfig, const ch
: device_t(mconfig, ALESIS_DM3AG, tag, owner, clock)
, m_dac(*this, "dac")
, m_samples(*this, DEVICE_SELF)
+ , m_dac_update_timer(nullptr)
+ , m_output_active(false)
+ , m_count(0)
+ , m_shift(0)
+ , m_cur_sample(0)
{
}
@@ -55,7 +60,7 @@ void alesis_dm3ag_device::device_add_mconfig(machine_config &config)
void alesis_dm3ag_device::device_start()
{
- m_dac_update_timer = timer_alloc(TIMER_DAC_UPDATE);
+ m_dac_update_timer = timer_alloc(FUNC(alesis_dm3ag_device::dac_update), this);
}
//-------------------------------------------------
@@ -75,9 +80,10 @@ void alesis_dm3ag_device::device_reset()
}
//-------------------------------------------------
-// device_timer - handler timer events
+// dac_update - update the DAC output
//-------------------------------------------------
-void alesis_dm3ag_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+
+TIMER_CALLBACK_MEMBER(alesis_dm3ag_device::dac_update)
{
if (m_output_active)
{
diff --git a/src/mame/audio/cmi01a.cpp b/src/mame/audio/cmi01a.cpp
index c51fedcbf67..786d3f38048 100644
--- a/src/mame/audio/cmi01a.cpp
+++ b/src/mame/audio/cmi01a.cpp
@@ -166,9 +166,9 @@ void cmi01a_device::device_start()
{
m_wave_ram = std::make_unique<uint8_t[]>(0x4000);
- m_zx_timer = timer_alloc(TIMER_ZX);
- m_eosi_timer = timer_alloc(TIMER_EOSI);
- m_bcas_timer = timer_alloc(TIMER_BCAS);
+ m_zx_timer = timer_alloc(FUNC(cmi01a_device::zx_timer_cb), this);
+ m_eosi_timer = timer_alloc(FUNC(cmi01a_device::eosi_timer_cb), this);
+ m_bcas_timer = timer_alloc(FUNC(cmi01a_device::bcas_tick), this);
m_zx_timer->adjust(attotime::never);
m_eosi_timer->adjust(attotime::never);
@@ -340,21 +340,6 @@ WRITE_LINE_MEMBER( cmi01a_device::cmi01a_irq )
m_irq_cb(state ? ASSERT_LINE : CLEAR_LINE);
}
-void cmi01a_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch(id)
- {
- case TIMER_ZX:
- zx_timer_cb();
- break;
- case TIMER_EOSI:
- eosi_timer_cb();
- break;
- case TIMER_BCAS:
- bcas_tick();
- }
-}
-
void cmi01a_device::reset_bcas_counter()
{
m_bcas_q1_ticks = 2;
@@ -367,13 +352,14 @@ void cmi01a_device::reset_bcas_counter()
m_ptm->set_clock(2, 0);
}
-void cmi01a_device::bcas_tick()
+TIMER_CALLBACK_MEMBER(cmi01a_device::bcas_tick)
{
if (m_ptm_o1 != m_zx_ff)
return;
+ // TODO
}
-void cmi01a_device::eosi_timer_cb()
+TIMER_CALLBACK_MEMBER(cmi01a_device::eosi_timer_cb)
{
m_stream->update();
m_segment_cnt &= ~0x4000;
@@ -382,7 +368,7 @@ void cmi01a_device::eosi_timer_cb()
if (m_channel == 5) LOG("CH%d: End of sound\n", m_channel);
}
-void cmi01a_device::zx_timer_cb()
+TIMER_CALLBACK_MEMBER(cmi01a_device::zx_timer_cb)
{
// Toggle ZX
m_zx_flag ^= 1;
diff --git a/src/mame/audio/cmi01a.h b/src/mame/audio/cmi01a.h
index 73c7881724c..a884b568ace 100644
--- a/src/mame/audio/cmi01a.h
+++ b/src/mame/audio/cmi01a.h
@@ -41,11 +41,6 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_add_mconfig(machine_config &config) override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
- static const device_timer_id TIMER_ZX = 0;
- static const device_timer_id TIMER_EOSI = 1;
- static const device_timer_id TIMER_BCAS = 2;
required_device<input_merger_device> m_irq_merger;
required_device_array<pia6821_device, 2> m_pia;
@@ -58,7 +53,7 @@ protected:
private:
DECLARE_WRITE_LINE_MEMBER(cmi01a_irq);
- void bcas_tick();
+ TIMER_CALLBACK_MEMBER(bcas_tick);
void reset_bcas_counter();
void clock_envelope();
@@ -73,8 +68,8 @@ private:
void wpe_w(int state);
void load_w(int state);
- void zx_timer_cb();
- void eosi_timer_cb();
+ TIMER_CALLBACK_MEMBER(zx_timer_cb);
+ TIMER_CALLBACK_MEMBER(eosi_timer_cb);
void run_voice();
void update_wave_addr(int inc);
diff --git a/src/mame/audio/csd.cpp b/src/mame/audio/csd.cpp
index 755d463abcd..722e15f23e1 100644
--- a/src/mame/audio/csd.cpp
+++ b/src/mame/audio/csd.cpp
@@ -86,13 +86,15 @@ void midway_cheap_squeak_deluxe_device::device_start()
{
save_item(NAME(m_status));
save_item(NAME(m_dacval));
+
+ m_pia_sync_timer = timer_alloc(FUNC(midway_cheap_squeak_deluxe_device::sync_pia), this);
}
//-------------------------------------------------
-// device_timer - timer callbacks
+// sync_pia
//-------------------------------------------------
-void midway_cheap_squeak_deluxe_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(midway_cheap_squeak_deluxe_device::sync_pia)
{
m_pia->ca1_w(param);
@@ -134,7 +136,7 @@ void midway_cheap_squeak_deluxe_device::sr_w(u8 data)
WRITE_LINE_MEMBER( midway_cheap_squeak_deluxe_device::sirq_w )
{
- synchronize(0, !state);
+ m_pia_sync_timer->adjust(attotime::zero, !state);
}
//-------------------------------------------------
diff --git a/src/mame/audio/csd.h b/src/mame/audio/csd.h
index ed20b78f2aa..4b5952b5369 100644
--- a/src/mame/audio/csd.h
+++ b/src/mame/audio/csd.h
@@ -38,12 +38,14 @@ public:
DECLARE_WRITE_LINE_MEMBER(reset_w);
void csdeluxe_map(address_map &map);
+
protected:
// device-level overrides
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(sync_pia);
private:
// devices
@@ -52,8 +54,9 @@ private:
required_device<dac_word_interface> m_dac;
// internal state
- uint8_t m_status;
- uint16_t m_dacval;
+ uint8_t m_status;
+ uint16_t m_dacval;
+ emu_timer *m_pia_sync_timer;
// internal communications
void porta_w(uint8_t data);
diff --git a/src/mame/audio/dcs.cpp b/src/mame/audio/dcs.cpp
index 36b65f4808b..424a239d3d8 100644
--- a/src/mame/audio/dcs.cpp
+++ b/src/mame/audio/dcs.cpp
@@ -747,6 +747,10 @@ dcs_audio_device::dcs_audio_device(const machine_config &mconfig, device_type ty
void dcs_audio_device::device_reset()
{
dcs_reset(0);
+
+ m_s1_ack_timer->adjust(attotime::never);
+ m_s1_ack2_timer->adjust(attotime::never);
+ m_s2_ack_timer->adjust(attotime::never);
}
void dcs_audio_device::device_start()
@@ -790,6 +794,11 @@ void dcs_audio_device::device_start()
m_data_bank->configure_entries(0, m_sounddata_banks, m_sounddata, 0x800*2);
}
+ /* allocate timers */
+ m_s1_ack_timer = timer_alloc(FUNC(dcs_audio_device::s1_ack_callback1), this);
+ m_s1_ack2_timer = timer_alloc(FUNC(dcs_audio_device::s1_ack_callback2), this);
+ m_s2_ack_timer = timer_alloc(FUNC(dcs_audio_device::s2_ack_callback), this);
+
/* non-RAM based automatically acks */
m_auto_ack = true;
/* register for save states */
@@ -889,6 +898,11 @@ void dcs2_audio_device::device_start()
if (m_transfer.hle_enabled)
m_transfer.watchdog = subdevice<timer_device>("dcs_hle_timer");
+ /* allocate timers */
+ m_s1_ack_timer = timer_alloc(FUNC(dcs_audio_device::s1_ack_callback1), this);
+ m_s1_ack2_timer = timer_alloc(FUNC(dcs_audio_device::s1_ack_callback2), this);
+ m_s2_ack_timer = timer_alloc(FUNC(dcs_audio_device::s2_ack_callback), this);
+
/* register for save states */
dcs_register_state();
@@ -2207,7 +2221,7 @@ TIMER_CALLBACK_MEMBER( dcs_audio_device::s1_ack_callback2 )
/* if the output is full, stall for a usec */
if (IS_OUTPUT_FULL())
{
- machine().scheduler().timer_set(attotime::from_usec(1), timer_expired_delegate(FUNC(dcs_audio_device::s1_ack_callback2),this), param);
+ m_s1_ack2_timer->adjust(attotime::from_usec(1), param);
return;
}
output_latch_w(0x000a);
@@ -2219,13 +2233,13 @@ TIMER_CALLBACK_MEMBER( dcs_audio_device::s1_ack_callback1 )
/* if the output is full, stall for a usec */
if (IS_OUTPUT_FULL())
{
- machine().scheduler().timer_set(attotime::from_usec(1), timer_expired_delegate(FUNC(dcs_audio_device::s1_ack_callback1),this), param);
+ m_s1_ack_timer->adjust(attotime::from_usec(1), param);
return;
}
output_latch_w(param);
/* chain to the next word we need to write back */
- machine().scheduler().timer_set(attotime::from_usec(1), timer_expired_delegate(FUNC(dcs_audio_device::s1_ack_callback2),this));
+ m_s1_ack2_timer->adjust(attotime::from_usec(1));
}
@@ -2343,7 +2357,7 @@ int dcs_audio_device::preprocess_stage_1(uint16_t data)
/* if we're done, start a timer to send the response words */
if (transfer.state == 0)
- machine().scheduler().timer_set(attotime::from_usec(1), timer_expired_delegate(FUNC(dcs_audio_device::s1_ack_callback1),this), transfer.sum);
+ m_s1_ack_timer->adjust(attotime::from_usec(1), transfer.sum);
return 1;
}
break;
@@ -2357,7 +2371,7 @@ TIMER_CALLBACK_MEMBER( dcs_audio_device::s2_ack_callback )
/* if the output is full, stall for a usec */
if (IS_OUTPUT_FULL())
{
- machine().scheduler().timer_set(attotime::from_usec(1), timer_expired_delegate(FUNC(dcs_audio_device::s2_ack_callback),this), param);
+ m_s2_ack_timer->adjust(attotime::from_usec(1), param);
return;
}
output_latch_w(param);
@@ -2456,7 +2470,7 @@ int dcs_audio_device::preprocess_stage_2(uint16_t data)
/* if we're done, start a timer to send the response words */
if (transfer.state == 0)
{
- machine().scheduler().timer_set(attotime::from_usec(1), timer_expired_delegate(FUNC(dcs_audio_device::s2_ack_callback),this), transfer.sum);
+ m_s2_ack_timer->adjust(attotime::from_usec(1), transfer.sum);
transfer.watchdog->reset();
}
return 1;
diff --git a/src/mame/audio/dcs.h b/src/mame/audio/dcs.h
index 38bd283a768..21a565899c1 100644
--- a/src/mame/audio/dcs.h
+++ b/src/mame/audio/dcs.h
@@ -174,7 +174,7 @@ protected:
address_space *m_program;
address_space *m_data;
uint8_t m_rev;
- offs_t m_polling_offset;
+ offs_t m_polling_offset;
uint32_t m_polling_count;
/* sound output */
uint8_t m_channels;
@@ -213,12 +213,15 @@ protected:
uint8_t m_last_output_full;
uint8_t m_last_input_empty;
uint16_t m_progflags;
+ emu_timer * m_s1_ack_timer;
+ emu_timer * m_s1_ack2_timer;
+ emu_timer * m_s2_ack_timer;
write_line_delegate m_output_full_cb;
write_line_delegate m_input_empty_cb;
- read16smo_delegate m_fifo_data_r;
- read16mo_delegate m_fifo_status_r;
+ read16smo_delegate m_fifo_data_r;
+ read16mo_delegate m_fifo_status_r;
write_line_delegate m_fifo_reset_w;
/* timers */
diff --git a/src/mame/audio/efo_zsu.cpp b/src/mame/audio/efo_zsu.cpp
index 5be098b0e51..db397b191da 100644
--- a/src/mame/audio/efo_zsu.cpp
+++ b/src/mame/audio/efo_zsu.cpp
@@ -308,9 +308,9 @@ void efo_zsu_device::device_start()
membank("rombank")->set_entry(3); // 10K/+5 pullups on banking lines
}
- m_fifo_shift_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(efo_zsu_device::fifo_shift), this));
- m_adpcm_clock_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(efo_zsu_device::adpcm_clock), this));
- m_ctc0_ck0_restart_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(efo_zsu_device::ctc0_ck0_restart), this));
+ m_fifo_shift_timer = timer_alloc(FUNC(efo_zsu_device::fifo_shift), this);
+ m_adpcm_clock_timer = timer_alloc(FUNC(efo_zsu_device::adpcm_clock), this);
+ m_ctc0_ck0_restart_timer = timer_alloc(FUNC(efo_zsu_device::ctc0_ck0_restart), this);
save_item(NAME(m_ay1_porta));
}
diff --git a/src/mame/audio/geebee.cpp b/src/mame/audio/geebee.cpp
index 3ac70c3947c..1c6c77c070e 100644
--- a/src/mame/audio/geebee.cpp
+++ b/src/mame/audio/geebee.cpp
@@ -45,7 +45,7 @@ void geebee_sound_device::device_start()
m_channel = stream_alloc(0, 1, clock() / 3 / 2 / 384);
m_vcount = 0;
- m_volume_timer = timer_alloc(TIMER_VOLUME_DECAY);
+ m_volume_timer = timer_alloc(FUNC(geebee_sound_device::volume_decay_tick), this);
save_item(NAME(m_sound_latch));
save_item(NAME(m_sound_signal));
@@ -54,18 +54,10 @@ void geebee_sound_device::device_start()
save_item(NAME(m_vcount));
}
-void geebee_sound_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(geebee_sound_device::volume_decay_tick)
{
- switch (id)
- {
- case TIMER_VOLUME_DECAY:
- if (--m_volume < 0)
- m_volume = 0;
- break;
-
- default:
- throw emu_fatalerror("Unknown id in geebee_device::device_timer");
- }
+ if (--m_volume < 0)
+ m_volume = 0;
}
void geebee_sound_device::sound_w(u8 data)
diff --git a/src/mame/audio/geebee.h b/src/mame/audio/geebee.h
index aaa49a0278d..a0aab1ef412 100644
--- a/src/mame/audio/geebee.h
+++ b/src/mame/audio/geebee.h
@@ -10,11 +10,6 @@ class geebee_sound_device : public device_t, public device_sound_interface
public:
geebee_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- enum
- {
- TIMER_VOLUME_DECAY
- };
-
void sound_w(u8 data);
protected:
@@ -24,7 +19,7 @@ protected:
// sound stream update overrides
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(volume_decay_tick);
private:
// internal state
diff --git a/src/mame/audio/gottlieb.cpp b/src/mame/audio/gottlieb.cpp
index 43a4658e79b..eee39b1ce51 100644
--- a/src/mame/audio/gottlieb.cpp
+++ b/src/mame/audio/gottlieb.cpp
@@ -712,12 +712,7 @@ gottlieb_sound_p4_device::gottlieb_sound_p4_device(const machine_config &mconfig
{
}
-gottlieb_sound_p4_device::gottlieb_sound_p4_device(
- const machine_config &mconfig,
- device_type type,
- const char *tag,
- device_t *owner,
- uint32_t clock)
+gottlieb_sound_p4_device::gottlieb_sound_p4_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, type, tag, owner, clock)
, device_mixer_interface(mconfig, *this)
, m_dcpu(*this, "audiocpu")
@@ -726,6 +721,8 @@ gottlieb_sound_p4_device::gottlieb_sound_p4_device(
, m_ay1(*this, "ay1")
, m_ay2(*this, "ay2")
, m_nmi_timer(nullptr)
+ , m_nmi_clear_timer(nullptr)
+ , m_latch_timer(nullptr)
, m_nmi_rate(0)
, m_nmi_state(0)
, m_dcpu_latch(0)
@@ -748,8 +745,8 @@ void gottlieb_sound_p4_device::write(u8 data)
// when data is not 0xff, the transparent latch at A3 allows it to pass through unmolested
if (data != 0xff)
{
- // latch data on a timer
- synchronize(TID_SOUND_LATCH_WRITE, data);
+ // sync the latch data write
+ m_latch_timer->adjust(attotime::zero, data);
// if the previous data was 0xff, clock an IRQ on each
if (m_last_command == 0xff)
@@ -970,11 +967,15 @@ void gottlieb_sound_p4_device::device_add_mconfig(machine_config &config)
void gottlieb_sound_p4_device::device_start()
{
- // set up the NMI timer
- m_nmi_timer = timer_alloc(TID_NMI_GENERATE);
+ // set up the NMI timers
+ m_nmi_timer = timer_alloc(FUNC(gottlieb_sound_p4_device::set_nmi), this);
+ m_nmi_clear_timer = timer_alloc(FUNC(gottlieb_sound_p4_device::clear_nmi), this);
m_nmi_rate = 0;
nmi_timer_adjust();
+ // set up other timers
+ m_latch_timer = timer_alloc(FUNC(gottlieb_sound_p4_device::update_latch), this);
+
// register for save states
save_item(NAME(m_nmi_rate));
save_item(NAME(m_nmi_state));
@@ -987,39 +988,36 @@ void gottlieb_sound_p4_device::device_start()
//-------------------------------------------------
-// device_timer - handle timer-based behaviors
+// handle timer-based behaviors
//-------------------------------------------------
-void gottlieb_sound_p4_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(gottlieb_sound_p4_device::set_nmi)
{
- switch (id)
- {
- case TID_NMI_GENERATE:
- // update state
- m_nmi_state = 1;
- nmi_state_update();
-
- // set a timer to turn it off again on the next SOUND_CLOCK/16
- timer_set(attotime::from_hz(SOUND2_CLOCK/16), TID_NMI_CLEAR);
-
- // adjust the NMI timer for the next time
- nmi_timer_adjust();
- break;
-
- case TID_NMI_CLEAR:
- // update state
- m_nmi_state = 0;
- nmi_state_update();
- break;
-
- case TID_SOUND_LATCH_WRITE:
- // each CPU has its own latch
- m_dcpu_latch = param;
- m_ycpu_latch = param;
- if (m_dcpu2)
- m_dcpu2_latch = param;
- break;
- }
+ // update state
+ m_nmi_state = 1;
+ nmi_state_update();
+
+ // set a timer to turn it off again on the next SOUND_CLOCK/16
+ m_nmi_clear_timer->adjust(attotime::from_hz(SOUND2_CLOCK/16));
+
+ // adjust the NMI timer for the next time
+ nmi_timer_adjust();
+}
+
+TIMER_CALLBACK_MEMBER(gottlieb_sound_p4_device::clear_nmi)
+{
+ // update state
+ m_nmi_state = 0;
+ nmi_state_update();
+}
+
+TIMER_CALLBACK_MEMBER(gottlieb_sound_p4_device::update_latch)
+{
+ // each CPU has its own latch
+ m_dcpu_latch = param;
+ m_ycpu_latch = param;
+ if (m_dcpu2)
+ m_dcpu2_latch = param;
}
diff --git a/src/mame/audio/gottlieb.h b/src/mame/audio/gottlieb.h
index 59963b09c8d..4f098e695b1 100644
--- a/src/mame/audio/gottlieb.h
+++ b/src/mame/audio/gottlieb.h
@@ -112,12 +112,7 @@ public:
void write(u8 data);
protected:
- gottlieb_sound_r1_device(
- const machine_config &mconfig,
- device_type type,
- const char *tag,
- device_t *owner,
- uint32_t clock);
+ gottlieb_sound_r1_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
virtual void device_add_mconfig(machine_config &config) override;
@@ -180,17 +175,15 @@ public:
void write(u8 data);
protected:
- gottlieb_sound_p4_device(
- const machine_config &mconfig,
- device_type type,
- const char *tag,
- device_t *owner,
- uint32_t clock);
+ gottlieb_sound_p4_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(set_nmi);
+ TIMER_CALLBACK_MEMBER(clear_nmi);
+ TIMER_CALLBACK_MEMBER(update_latch);
// internal communications
uint8_t speech_data_r();
@@ -208,14 +201,6 @@ protected:
void nmi_timer_adjust();
void nmi_state_update();
- // timer IDs
- enum
- {
- TID_NMI_GENERATE,
- TID_NMI_CLEAR,
- TID_SOUND_LATCH_WRITE
- };
-
// devices
required_device<m6502_device> m_dcpu;
optional_device<m6502_device> m_dcpu2;
@@ -224,16 +209,18 @@ protected:
required_device<ay8913_device> m_ay2;
// internal state
- emu_timer * m_nmi_timer = 0;
- uint8_t m_nmi_rate = 0;
- uint8_t m_nmi_state = 0;
- uint8_t m_dcpu_latch = 0;
- uint8_t m_ycpu_latch = 0;
- uint8_t m_speech_control = 0;
- uint8_t m_last_command = 0;
- uint8_t m_psg_latch = 0;
- uint8_t m_psg_data_latch = 0;
- uint8_t m_dcpu2_latch = 0;
+ emu_timer * m_nmi_timer;
+ emu_timer * m_nmi_clear_timer;
+ emu_timer * m_latch_timer;
+ uint8_t m_nmi_rate;
+ uint8_t m_nmi_state;
+ uint8_t m_dcpu_latch;
+ uint8_t m_ycpu_latch;
+ uint8_t m_speech_control;
+ uint8_t m_last_command;
+ uint8_t m_psg_latch;
+ uint8_t m_psg_data_latch;
+ uint8_t m_dcpu2_latch;
};
@@ -284,12 +271,7 @@ public:
gottlieb_sound_p5_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
protected:
- gottlieb_sound_p5_device(
- const machine_config &mconfig,
- device_type type,
- const char *tag,
- device_t *owner,
- uint32_t clock);
+ gottlieb_sound_p5_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
virtual void device_add_mconfig(machine_config &config) override;
diff --git a/src/mame/audio/jaguar.cpp b/src/mame/audio/jaguar.cpp
index 670ce4f2a5d..863eb63f398 100644
--- a/src/mame/audio/jaguar.cpp
+++ b/src/mame/audio/jaguar.cpp
@@ -199,7 +199,7 @@ WRITE_LINE_MEMBER( jaguar_state::external_int )
void jaguar_state::sound_start()
{
- m_serial_timer = timer_alloc(TID_SERIAL);
+ m_serial_timer = timer_alloc(FUNC(jaguar_state::serial_update), this);
m_gpu_irq_state = 0;
@@ -289,7 +289,7 @@ void jaguar_state::dsp_flags_w(address_space &space, offs_t offset, uint32_t dat
*
*************************************/
-void jaguar_state::serial_update()
+TIMER_CALLBACK_MEMBER(jaguar_state::serial_update)
{
if (m_hacks_enabled)
{
diff --git a/src/mame/audio/midway.cpp b/src/mame/audio/midway.cpp
index a6a67710cde..077ab7f03da 100644
--- a/src/mame/audio/midway.cpp
+++ b/src/mame/audio/midway.cpp
@@ -91,7 +91,7 @@ uint8_t midway_ssio_device::read()
void midway_ssio_device::write(offs_t offset, uint8_t data)
{
- synchronize(0, (offset << 8) | (data & 0xff));
+ machine().scheduler().synchronize(timer_expired_delegate(FUNC(midway_ssio_device::synced_write), this), (offset << 8) | (data & 0xff));
}
@@ -460,10 +460,10 @@ void midway_ssio_device::device_reset()
//-------------------------------------------------
-// device_timer - timer callbacks
+// synced_write
//-------------------------------------------------
-void midway_ssio_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(midway_ssio_device::synced_write)
{
m_data[param >> 8] = param & 0xff;
}
@@ -508,7 +508,7 @@ uint8_t midway_sounds_good_device::read()
void midway_sounds_good_device::write(uint8_t data)
{
- synchronize(0, data);
+ machine().scheduler().synchronize(timer_expired_delegate(FUNC(midway_sounds_good_device::synced_write), this), data);
}
@@ -650,10 +650,10 @@ void midway_sounds_good_device::device_reset()
//-------------------------------------------------
-// device_timer - timer callbacks
+// synced_write
//-------------------------------------------------
-void midway_sounds_good_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(midway_sounds_good_device::synced_write)
{
m_pia->portb_w((param >> 1) & 0x0f);
m_pia->ca1_w(~param & 0x01);
@@ -703,7 +703,7 @@ uint8_t midway_turbo_cheap_squeak_device::read()
void midway_turbo_cheap_squeak_device::write(uint8_t data)
{
- synchronize(0, data);
+ machine().scheduler().synchronize(timer_expired_delegate(FUNC(midway_turbo_cheap_squeak_device::synced_write), this), data);
}
@@ -817,10 +817,10 @@ void midway_turbo_cheap_squeak_device::device_reset()
//-------------------------------------------------
-// device_timer - timer callbacks
+// synced_write
//-------------------------------------------------
-void midway_turbo_cheap_squeak_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(midway_turbo_cheap_squeak_device::synced_write)
{
m_pia->portb_w((param >> 1) & 0x0f);
m_pia->ca1_w(~param & 0x01);
diff --git a/src/mame/audio/midway.h b/src/mame/audio/midway.h
index 38021a863e2..26cb92cde25 100644
--- a/src/mame/audio/midway.h
+++ b/src/mame/audio/midway.h
@@ -85,7 +85,8 @@ protected:
virtual ioport_constructor device_input_ports() const override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(synced_write);
private:
// internal helpers
@@ -143,7 +144,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(synced_write);
private:
// devices
@@ -183,7 +185,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(synced_write);
private:
// devices
diff --git a/src/mame/audio/mw8080bw.cpp b/src/mame/audio/mw8080bw.cpp
index 0d35eb4194a..1b3722156c6 100644
--- a/src/mame/audio/mw8080bw.cpp
+++ b/src/mame/audio/mw8080bw.cpp
@@ -3109,7 +3109,7 @@ void spcenctr_audio_device::device_start()
m_lamp.resolve();
m_strobe.resolve();
- m_strobe_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(spcenctr_audio_device::strobe_callback), this));
+ m_strobe_timer = timer_alloc(FUNC(spcenctr_audio_device::strobe_callback), this);
m_strobe_enable = 0U;
diff --git a/src/mame/audio/n8080.cpp b/src/mame/audio/n8080.cpp
index 8296a4d6735..41f95175986 100644
--- a/src/mame/audio/n8080.cpp
+++ b/src/mame/audio/n8080.cpp
@@ -374,9 +374,9 @@ TIMER_DEVICE_CALLBACK_MEMBER(helifire_state::dac_volume_timer)
void spacefev_state::sound_start()
{
- m_sound_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(spacefev_state::stop_mono_flop_callback), this));
- m_sound_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(spacefev_state::stop_mono_flop_callback), this));
- m_sound_timer[2] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(spacefev_state::stop_mono_flop_callback), this));
+ m_sound_timer[0] = timer_alloc(FUNC(spacefev_state::stop_mono_flop_callback), this);
+ m_sound_timer[1] = timer_alloc(FUNC(spacefev_state::stop_mono_flop_callback), this);
+ m_sound_timer[2] = timer_alloc(FUNC(spacefev_state::stop_mono_flop_callback), this);
save_item(NAME(m_prev_snd_data));
save_item(NAME(m_prev_sound_pins));
@@ -400,8 +400,8 @@ void spacefev_state::sound_reset()
void sheriff_state::sound_start()
{
- m_sound_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sheriff_state::stop_mono_flop_callback), this));
- m_sound_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sheriff_state::stop_mono_flop_callback), this));
+ m_sound_timer[0] = timer_alloc(FUNC(sheriff_state::stop_mono_flop_callback), this);
+ m_sound_timer[1] = timer_alloc(FUNC(sheriff_state::stop_mono_flop_callback), this);
save_item(NAME(m_prev_snd_data));
save_item(NAME(m_prev_sound_pins));
diff --git a/src/mame/audio/namco52.cpp b/src/mame/audio/namco52.cpp
index 48513fb6b2e..564b25cd82c 100644
--- a/src/mame/audio/namco52.cpp
+++ b/src/mame/audio/namco52.cpp
@@ -161,7 +161,7 @@ void namco_52xx_device::device_start()
/* start the external clock */
if (m_extclock != 0)
{
- m_extclock_pulse_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(namco_52xx_device::external_clock_pulse), this));
+ m_extclock_pulse_timer = timer_alloc(FUNC(namco_52xx_device::external_clock_pulse), this);
m_extclock_pulse_timer->adjust(attotime(0, m_extclock), 0, attotime(0, m_extclock));
}
diff --git a/src/mame/audio/pinsnd88.cpp b/src/mame/audio/pinsnd88.cpp
index 45f12c09024..c556353844c 100644
--- a/src/mame/audio/pinsnd88.cpp
+++ b/src/mame/audio/pinsnd88.cpp
@@ -105,6 +105,8 @@
#include "emu.h"
#include "pinsnd88.h"
+#define VERBOSE (0)
+#include "logmacro.h"
DEFINE_DEVICE_TYPE(PINSND88, pinsnd88_device, "pinsnd88", "Williams Pin Sound '88 Audio Board")
@@ -159,31 +161,17 @@ void pinsnd88_device::pinsnd88_map(address_map &map)
map(0xc000, 0xffff).rom().region("cpu",0x3c000); // fixed bank
}
-void pinsnd88_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(pinsnd88_device::sync_callback)
{
- switch(id)
- {
- case TIMER_SYNC:
- if (!m_syncq_cb.isnull())
- {
- logerror("pinsnd88 sync cleared!\n");
- m_syncq_cb(ASSERT_LINE);
- m_sync_timer->adjust(attotime::never);
- }
- break;
- }
+ LOG("pinsnd88 sync cleared!\n");
+ m_syncq_cb(ASSERT_LINE);
}
TIMER_CALLBACK_MEMBER(pinsnd88_device::deferred_sync_w)
{
- if (!m_syncq_cb.isnull())
- {
- logerror("pinsnd88 sync asserted!\n");
- m_syncq_cb(CLEAR_LINE);
- m_sync_timer->adjust(attotime::from_usec(2));
- }
- else
- logerror("pinsnd88 sync writeback called, but callback is not registered!\n");
+ LOG("pinsnd88 sync asserted!\n");
+ m_syncq_cb(CLEAR_LINE);
+ m_sync_timer->adjust(attotime::from_usec(2));
}
void pinsnd88_device::sync_w(uint8_t data)
@@ -205,7 +193,7 @@ WRITE_LINE_MEMBER(pinsnd88_device::resetq_w)
{
if ((m_old_resetq_state != CLEAR_LINE) && (state == CLEAR_LINE))
{
- logerror("PINSND88 device received reset request\n");
+ LOG("PINSND88 device received reset request\n");
common_reset();
}
m_old_resetq_state = state;
@@ -237,10 +225,12 @@ void pinsnd88_device::device_start()
u8 *rom = memregion("cpu")->base();
m_cpubank->configure_entries(0, 8, &rom[0x0], 0x8000);
m_cpubank->set_entry(0);
+
/* resolve lines */
- m_syncq_cb.resolve();
+ m_syncq_cb.resolve_safe();
+
/* timer */
- m_sync_timer = timer_alloc(TIMER_SYNC);
+ m_sync_timer = timer_alloc(FUNC(pinsnd88_device::sync_callback), this);
m_sync_timer->adjust(attotime::never);
save_item(NAME(m_old_resetq_state));
save_item(NAME(m_data_in));
diff --git a/src/mame/audio/pinsnd88.h b/src/mame/audio/pinsnd88.h
index f6fc88790dd..f73eac1e73c 100644
--- a/src/mame/audio/pinsnd88.h
+++ b/src/mame/audio/pinsnd88.h
@@ -52,10 +52,8 @@ protected:
required_device<ym2151_device> m_ym2151;
required_memory_bank m_cpubank;
- static const device_timer_id TIMER_SYNC = 0;
private:
- // overrides
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(sync_callback);
// members
devcb_write_line m_syncq_cb;
diff --git a/src/mame/audio/redalert.cpp b/src/mame/audio/redalert.cpp
index 3c4405dc953..6ed6cd5e2a3 100644
--- a/src/mame/audio/redalert.cpp
+++ b/src/mame/audio/redalert.cpp
@@ -219,8 +219,8 @@ void panther_audio_device::panther_audio_map(address_map &map)
void irem_m37b_audio_device::device_start()
{
- m_audio_irq_on_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(irem_m37b_audio_device::audio_irq_on), this));
- m_audio_irq_off_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(irem_m37b_audio_device::audio_irq_off), this));
+ m_audio_irq_on_timer = timer_alloc(FUNC(irem_m37b_audio_device::audio_irq_on), this);
+ m_audio_irq_off_timer = timer_alloc(FUNC(irem_m37b_audio_device::audio_irq_off), this);
m_audio_irq_on_timer->adjust(REDALERT_AUDIO_CPU_IRQ_FREQ, 0, REDALERT_AUDIO_CPU_IRQ_FREQ);
@@ -318,8 +318,8 @@ void panther_audio_device::device_add_mconfig(machine_config &config)
void demoneye_audio_device::device_start()
{
- m_audio_irq_on_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(demoneye_audio_device::audio_irq_on), this));
- m_audio_irq_off_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(demoneye_audio_device::audio_irq_off), this));
+ m_audio_irq_on_timer = timer_alloc(FUNC(demoneye_audio_device::audio_irq_on), this);
+ m_audio_irq_off_timer = timer_alloc(FUNC(demoneye_audio_device::audio_irq_off), this);
m_audio_irq_on_timer->adjust(REDALERT_AUDIO_CPU_IRQ_FREQ, 0, REDALERT_AUDIO_CPU_IRQ_FREQ);
diff --git a/src/mame/audio/segag80r.cpp b/src/mame/audio/segag80r.cpp
index 32088ede5a4..cbf62d8a510 100644
--- a/src/mame/audio/segag80r.cpp
+++ b/src/mame/audio/segag80r.cpp
@@ -48,7 +48,7 @@ void sega005_sound_device::device_start()
m_sega005_stream = stream_alloc(0, 1, SEGA005_COUNTER_FREQ);
/* create a timer for the 555 */
- m_sega005_sound_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sega005_sound_device::sega005_auto_timer), this));
+ m_sega005_sound_timer = timer_alloc(FUNC(sega005_sound_device::sega005_auto_timer), this);
/* set the initial sound data */
state->m_sound_data = 0x00;
diff --git a/src/mame/audio/t5182.cpp b/src/mame/audio/t5182.cpp
index 2b5c4f65bf0..4debad2a609 100644
--- a/src/mame/audio/t5182.cpp
+++ b/src/mame/audio/t5182.cpp
@@ -170,8 +170,6 @@ t5182_device::t5182_device(const machine_config &mconfig, const char *tag, devic
void t5182_device::device_start()
{
- m_setirq_cb = timer_alloc(SETIRQ_CB);
-
save_item(NAME(m_irqstate));
save_item(NAME(m_semaphore_main));
save_item(NAME(m_semaphore_snd));
@@ -221,39 +219,27 @@ TIMER_CALLBACK_MEMBER( t5182_device::setirq_callback )
m_ourcpu->set_input_line(0,ASSERT_LINE);
}
-void t5182_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case SETIRQ_CB:
- setirq_callback(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in t5182_device::device_timer");
- }
-}
-
void t5182_device::sound_irq_w(uint8_t data)
{
- synchronize(SETIRQ_CB, CPU_ASSERT);
+ machine().scheduler().synchronize(timer_expired_delegate(FUNC(t5182_device::setirq_callback), this), CPU_ASSERT);
}
void t5182_device::ym2151_irq_ack_w(uint8_t data)
{
- synchronize(SETIRQ_CB, YM2151_ACK);
+ machine().scheduler().synchronize(timer_expired_delegate(FUNC(t5182_device::setirq_callback), this), YM2151_ACK);
}
void t5182_device::cpu_irq_ack_w(uint8_t data)
{
- synchronize(SETIRQ_CB, CPU_CLEAR);
+ machine().scheduler().synchronize(timer_expired_delegate(FUNC(t5182_device::setirq_callback), this), CPU_CLEAR);
}
WRITE_LINE_MEMBER(t5182_device::ym2151_irq_handler)
{
if (state)
- synchronize(SETIRQ_CB, YM2151_ASSERT);
+ machine().scheduler().synchronize(timer_expired_delegate(FUNC(t5182_device::setirq_callback), this), YM2151_ASSERT);
else
- synchronize(SETIRQ_CB, YM2151_CLEAR);
+ machine().scheduler().synchronize(timer_expired_delegate(FUNC(t5182_device::setirq_callback), this), YM2151_CLEAR);
}
uint8_t t5182_device::sharedram_semaphore_snd_r()
diff --git a/src/mame/audio/t5182.h b/src/mame/audio/t5182.h
index 082d3914bd5..f5f2e1c941c 100644
--- a/src/mame/audio/t5182.h
+++ b/src/mame/audio/t5182.h
@@ -24,11 +24,6 @@ public:
CPU_CLEAR
};
- enum
- {
- SETIRQ_CB
- };
-
void sound_irq_w(uint8_t data);
uint8_t sharedram_semaphore_snd_r();
void sharedram_semaphore_main_acquire_w(uint8_t data);
@@ -42,7 +37,6 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual const tiny_rom_entry *device_rom_region() const override;
virtual ioport_constructor device_input_ports() const override;
virtual void device_add_mconfig(machine_config &config) override;
@@ -54,8 +48,7 @@ private:
int m_irqstate;
int m_semaphore_main;
int m_semaphore_snd;
- emu_timer *m_setirq_cb = nullptr;
- TIMER_CALLBACK_MEMBER( setirq_callback );
+ TIMER_CALLBACK_MEMBER(setirq_callback);
void sharedram_semaphore_snd_acquire_w(uint8_t data);
void sharedram_semaphore_snd_release_w(uint8_t data);
diff --git a/src/mame/audio/turbo.cpp b/src/mame/audio/turbo.cpp
index d002916213e..f1732c80acd 100644
--- a/src/mame/audio/turbo.cpp
+++ b/src/mame/audio/turbo.cpp
@@ -61,6 +61,10 @@ if (!((data >> 4) & 1)) osd_printf_debug("/TRIG4\n");
// osel = (osel & 6) | ((data >> 5) & 1);
// update_samples(samples);
}
+#else
+TIMER_CALLBACK_MEMBER(turbo_state::update_sound_a)
+{
+}
#endif
@@ -112,9 +116,14 @@ void turbo_state::sound_a_w(uint8_t data)
#else
if (((data ^ m_last_sound_a) & 0x1e) && (m_last_sound_a & 0x1e) != 0x1e)
+ {
+ // TODO: This looks like a hack, in that it models a transport delay only when certain bits to the sound latch control change.
machine().scheduler().timer_set(attotime::from_hz(20000), FUNC(update_sound_a), data);
+ }
else
+ {
update_sound_a(data);
+ }
m_last_sound_a = data;
diff --git a/src/mame/audio/tvc.cpp b/src/mame/audio/tvc.cpp
index 7baad1f6401..eb11d69ef86 100644
--- a/src/mame/audio/tvc.cpp
+++ b/src/mame/audio/tvc.cpp
@@ -32,7 +32,7 @@ void tvc_sound_device::device_start()
m_write_sndint.resolve_safe();
m_stream = stream_alloc(0, 1, machine().sample_rate());
- m_sndint_timer = timer_alloc(TIMER_SNDINT);
+ m_sndint_timer = timer_alloc(FUNC(tvc_sound_device::trigger_int), this);
}
//-------------------------------------------------
@@ -49,10 +49,10 @@ void tvc_sound_device::device_reset()
//-------------------------------------------------
-// device_timer - handler timer events
+// trigger_int
//-------------------------------------------------
-void tvc_sound_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(tvc_sound_device::trigger_int)
{
m_write_sndint(1);
}
diff --git a/src/mame/audio/tvc.h b/src/mame/audio/tvc.h
index 8ad34a97e21..7aba16f91d3 100644
--- a/src/mame/audio/tvc.h
+++ b/src/mame/audio/tvc.h
@@ -33,21 +33,20 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
+ TIMER_CALLBACK_MEMBER(trigger_int);
+
private:
- static const device_timer_id TIMER_SNDINT = 0;
-
- sound_stream * m_stream;
- int m_freq;
- int m_enabled;
- int m_volume;
- int m_incr;
- int m_signal;
- uint8_t m_ports[3];
- emu_timer * m_sndint_timer;
- devcb_write_line m_write_sndint;
+ sound_stream * m_stream;
+ int m_freq;
+ int m_enabled;
+ int m_volume;
+ int m_incr;
+ int m_signal;
+ uint8_t m_ports[3];
+ emu_timer * m_sndint_timer;
+ devcb_write_line m_write_sndint;
};
// device type definition
diff --git a/src/mame/audio/vboy.cpp b/src/mame/audio/vboy.cpp
index 1b4a32d8185..cbbac32c88a 100644
--- a/src/mame/audio/vboy.cpp
+++ b/src/mame/audio/vboy.cpp
@@ -211,7 +211,7 @@ void vboysnd_device::device_start()
// create the stream
m_stream = stream_alloc(0, 2, rate);
- m_timer = timer_alloc(0);
+ m_timer = timer_alloc(FUNC(vboysnd_device::delayed_stream_update), this);
m_timer->adjust(attotime::zero, 0, rate ? attotime::from_hz(rate / 4) : attotime::never);
for (int i=0; i<2048; i++)
@@ -256,10 +256,10 @@ void vboysnd_device::device_reset()
}
//-------------------------------------------------
-// device_timer - called when our device timer expires
+// delayed_stream_update
//-------------------------------------------------
-void vboysnd_device::device_timer(emu_timer &timer, device_timer_id tid, int param)
+TIMER_CALLBACK_MEMBER(vboysnd_device::delayed_stream_update)
{
m_stream->update();
}
diff --git a/src/mame/audio/vboy.h b/src/mame/audio/vboy.h
index 112d8326b10..11f8dbc44b8 100644
--- a/src/mame/audio/vboy.h
+++ b/src/mame/audio/vboy.h
@@ -70,10 +70,11 @@ protected:
virtual void device_start() override;
virtual void device_clock_changed() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
+ TIMER_CALLBACK_MEMBER(delayed_stream_update);
+
s_snd_channel snd_channel[5];
uint16_t waveFreq2LenTbl[2048];
diff --git a/src/mame/audio/warpwarp.cpp b/src/mame/audio/warpwarp.cpp
index c7c0845ff66..a8154c98861 100644
--- a/src/mame/audio/warpwarp.cpp
+++ b/src/mame/audio/warpwarp.cpp
@@ -54,8 +54,8 @@ void warpwarp_sound_device::device_start()
m_clock_1v = clock() / 3 / 2 / 384;
m_channel = stream_alloc(0, 1, m_clock_16h);
- m_sound_volume_timer = timer_alloc(TIMER_SOUND_VOLUME_DECAY);
- m_music_volume_timer = timer_alloc(TIMER_MUSIC_VOLUME_DECAY);
+ m_sound_volume_timer = timer_alloc(FUNC(warpwarp_sound_device::sound_decay_tick), this);
+ m_music_volume_timer = timer_alloc(FUNC(warpwarp_sound_device::music_decay_tick), this);
save_item(NAME(m_sound_latch));
save_item(NAME(m_music1_latch));
@@ -71,23 +71,16 @@ void warpwarp_sound_device::device_start()
save_item(NAME(m_mcount));
}
-void warpwarp_sound_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(warpwarp_sound_device::sound_decay_tick)
{
- switch (id)
- {
- case TIMER_SOUND_VOLUME_DECAY:
- if (--m_sound_volume < 0)
- m_sound_volume = 0;
- break;
-
- case TIMER_MUSIC_VOLUME_DECAY:
- if (--m_music_volume < 0)
- m_music_volume = 0;
- break;
-
- default:
- throw emu_fatalerror("Unknown id in warpwarp_sound_device::device_timer");
- }
+ if (--m_sound_volume < 0)
+ m_sound_volume = 0;
+}
+
+TIMER_CALLBACK_MEMBER(warpwarp_sound_device::music_decay_tick)
+{
+ if (--m_music_volume < 0)
+ m_music_volume = 0;
}
void warpwarp_sound_device::sound_w(u8 data)
diff --git a/src/mame/audio/warpwarp.h b/src/mame/audio/warpwarp.h
index 8047ee037c2..41f369ca2c7 100644
--- a/src/mame/audio/warpwarp.h
+++ b/src/mame/audio/warpwarp.h
@@ -11,13 +11,6 @@ class warpwarp_sound_device : public device_t, public device_sound_interface
public:
warpwarp_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- enum
- {
- TIMER_SOUND_VOLUME_DECAY,
- TIMER_MUSIC_VOLUME_DECAY
- };
-
-
void sound_w(u8 data);
void music1_w(u8 data);
void music2_w(u8 data);
@@ -29,7 +22,8 @@ protected:
// sound stream update overrides
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(sound_decay_tick);
+ TIMER_CALLBACK_MEMBER(music_decay_tick);
private:
// internal state
diff --git a/src/mame/audio/williams.cpp b/src/mame/audio/williams.cpp
index 660c620421b..31bf48f279c 100644
--- a/src/mame/audio/williams.cpp
+++ b/src/mame/audio/williams.cpp
@@ -95,7 +95,7 @@ williams_cvsd_sound_device::williams_cvsd_sound_device(const machine_config &mco
void williams_cvsd_sound_device::write(u16 data)
{
- synchronize(0, data);
+ m_sync_write_timer->adjust(attotime::zero, data);
}
@@ -230,6 +230,9 @@ void williams_cvsd_sound_device::device_start()
// register for save states
save_item(NAME(m_talkback));
+
+ // allocate timers
+ m_sync_write_timer = timer_alloc(FUNC(williams_cvsd_sound_device::sync_write), this);
}
@@ -247,10 +250,10 @@ void williams_cvsd_sound_device::device_reset()
//-------------------------------------------------
-// device_timer - timer callbacks
+// sync_write
//-------------------------------------------------
-void williams_cvsd_sound_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(williams_cvsd_sound_device::sync_write)
{
// process incoming data write
m_pia->portb_w(param & 0xff);
@@ -302,7 +305,7 @@ u16 williams_narc_sound_device::read()
void williams_narc_sound_device::write(u16 data)
{
- synchronize(TID_MASTER_COMMAND, data);
+ m_sync_master_timer->adjust(attotime::zero, data);
}
@@ -373,7 +376,7 @@ u8 williams_narc_sound_device::command_r()
void williams_narc_sound_device::command2_w(u8 data)
{
- synchronize(TID_SLAVE_COMMAND, data);
+ m_sync_slave_timer->adjust(attotime::zero, data);
}
@@ -408,7 +411,7 @@ void williams_narc_sound_device::master_talkback_w(u8 data)
void williams_narc_sound_device::master_sync_w(u8 data)
{
- timer_set(attotime::from_double(TIME_OF_74LS123(180000, 0.000001)), TID_SYNC_CLEAR, 0x01);
+ m_sync_clear_timer->adjust(attotime::from_double(TIME_OF_74LS123(180000, 0.000001)), 0x01);
m_audio_sync |= 0x01;
logerror("Master sync = %02X\n", data);
}
@@ -432,7 +435,7 @@ void williams_narc_sound_device::slave_talkback_w(u8 data)
void williams_narc_sound_device::slave_sync_w(u8 data)
{
- timer_set(attotime::from_double(TIME_OF_74LS123(180000, 0.000001)), TID_SYNC_CLEAR, 0x02);
+ m_sync_clear_timer->adjust(attotime::from_double(TIME_OF_74LS123(180000, 0.000001)), 0x02);
m_audio_sync |= 0x02;
logerror("Slave sync = %02X\n", data);
}
@@ -562,6 +565,11 @@ void williams_narc_sound_device::device_start()
save_item(NAME(m_talkback));
save_item(NAME(m_audio_sync));
save_item(NAME(m_sound_int_state));
+
+ // allocate timers
+ m_sync_master_timer = timer_alloc(FUNC(williams_narc_sound_device::sync_master_command), this);
+ m_sync_slave_timer = timer_alloc(FUNC(williams_narc_sound_device::sync_slave_command), this);
+ m_sync_clear_timer = timer_alloc(FUNC(williams_narc_sound_device::sync_clear), this);
}
@@ -583,34 +591,31 @@ void williams_narc_sound_device::device_reset()
//-------------------------------------------------
-// device_timer - timer callbacks
+// timer callbacks
//-------------------------------------------------
-void williams_narc_sound_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(williams_narc_sound_device::sync_master_command)
{
- switch (id)
+ m_latch = param & 0xff;
+ m_cpu[0]->set_input_line(INPUT_LINE_NMI, (param & 0x100) ? CLEAR_LINE : ASSERT_LINE);
+ if ((param & 0x200) == 0)
{
- case TID_MASTER_COMMAND:
- m_latch = param & 0xff;
- m_cpu[0]->set_input_line(INPUT_LINE_NMI, (param & 0x100) ? CLEAR_LINE : ASSERT_LINE);
- if ((param & 0x200) == 0)
- {
- m_cpu[0]->set_input_line(M6809_IRQ_LINE, ASSERT_LINE);
- m_sound_int_state = 1;
- }
- break;
-
- case TID_SLAVE_COMMAND:
- m_latch2 = param & 0xff;
- m_cpu[1]->set_input_line(M6809_FIRQ_LINE, ASSERT_LINE);
- break;
-
- case TID_SYNC_CLEAR:
- m_audio_sync &= ~param;
- break;
+ m_cpu[0]->set_input_line(M6809_IRQ_LINE, ASSERT_LINE);
+ m_sound_int_state = 1;
}
}
+TIMER_CALLBACK_MEMBER(williams_narc_sound_device::sync_slave_command)
+{
+ m_latch2 = param & 0xff;
+ m_cpu[1]->set_input_line(M6809_FIRQ_LINE, ASSERT_LINE);
+}
+
+TIMER_CALLBACK_MEMBER(williams_narc_sound_device::sync_clear)
+{
+ m_audio_sync &= ~param;
+}
+
//**************************************************************************
// ADPCM SOUND BOARD
@@ -640,7 +645,7 @@ williams_adpcm_sound_device::williams_adpcm_sound_device(const machine_config &m
void williams_adpcm_sound_device::write(u16 data)
{
- synchronize(TID_COMMAND, data);
+ m_sync_command_timer->adjust(attotime::zero, data);
}
@@ -707,7 +712,7 @@ u8 williams_adpcm_sound_device::command_r()
// don't clear the external IRQ state for a short while; this allows the
// self-tests to pass
- timer_set(attotime::from_usec(10), TID_IRQ_CLEAR);
+ m_irq_clear_timer->adjust(attotime::from_usec(10));
return m_latch;
}
@@ -801,6 +806,9 @@ void williams_adpcm_sound_device::device_start()
save_item(NAME(m_latch));
save_item(NAME(m_talkback));
save_item(NAME(m_sound_int_state));
+
+ m_sync_command_timer = timer_alloc(FUNC(williams_adpcm_sound_device::sync_command), this);
+ m_irq_clear_timer = timer_alloc(FUNC(williams_adpcm_sound_device::irq_clear), this);
}
@@ -815,33 +823,32 @@ void williams_adpcm_sound_device::device_reset()
m_cpu->set_input_line(M6809_FIRQ_LINE, CLEAR_LINE);
m_cpu->set_input_line(M6809_IRQ_LINE, CLEAR_LINE);
m_cpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
+
+ m_sync_command_timer->adjust(attotime::never);
+ m_irq_clear_timer->adjust(attotime::never);
}
//-------------------------------------------------
-// device_timer - timer callbacks
+// timer callbacks
//-------------------------------------------------
-void williams_adpcm_sound_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(williams_adpcm_sound_device::sync_command)
{
- switch (id)
+ m_latch = param & 0xff;
+ if (!(param & 0x200))
{
- case TID_COMMAND:
- m_latch = param & 0xff;
- if (!(param & 0x200))
- {
- m_cpu->set_input_line(M6809_IRQ_LINE, ASSERT_LINE);
- m_sound_int_state = 1;
- machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(100));
- }
- break;
-
- case TID_IRQ_CLEAR:
- m_sound_int_state = 0;
- break;
+ m_cpu->set_input_line(M6809_IRQ_LINE, ASSERT_LINE);
+ m_sound_int_state = 1;
+ machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(100));
}
}
+TIMER_CALLBACK_MEMBER(williams_adpcm_sound_device::irq_clear)
+{
+ m_sound_int_state = 0;
+}
+
//**************************************************************************
diff --git a/src/mame/audio/williams.h b/src/mame/audio/williams.h
index b0f7e597794..8f499b803d8 100644
--- a/src/mame/audio/williams.h
+++ b/src/mame/audio/williams.h
@@ -62,7 +62,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(sync_write);
private:
// devices
@@ -74,6 +75,7 @@ private:
required_memory_bank m_rombank;
// internal state
+ emu_timer *m_sync_write_timer;
u8 m_talkback;
void talkback_w(u8 data);
@@ -117,17 +119,12 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-private:
- // timer IDs
- enum
- {
- TID_MASTER_COMMAND,
- TID_SLAVE_COMMAND,
- TID_SYNC_CLEAR
- };
+ TIMER_CALLBACK_MEMBER(sync_master_command);
+ TIMER_CALLBACK_MEMBER(sync_slave_command);
+ TIMER_CALLBACK_MEMBER(sync_clear);
+private:
// devices
required_device_array<mc6809e_device, 2> m_cpu;
required_device<hc55516_device> m_hc55516;
@@ -136,6 +133,9 @@ private:
required_memory_bank m_slavebank;
// internal state
+ emu_timer *m_sync_master_timer;
+ emu_timer *m_sync_slave_timer;
+ emu_timer *m_sync_clear_timer;
u8 m_latch;
u8 m_latch2;
u8 m_talkback;
@@ -170,18 +170,13 @@ public:
mc6809e_device *get_cpu() { return m_cpu; }
protected:
- // timer IDs
- enum
- {
- TID_COMMAND,
- TID_IRQ_CLEAR
- };
-
// device-level overrides
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(sync_command);
+ TIMER_CALLBACK_MEMBER(irq_clear);
private:
// devices
@@ -191,6 +186,8 @@ private:
required_memory_bank m_okibank;
// internal state
+ emu_timer *m_sync_command_timer;
+ emu_timer *m_irq_clear_timer;
u8 m_latch;
u8 m_talkback;
u8 m_sound_int_state;
diff --git a/src/mame/drivers/2mindril.cpp b/src/mame/drivers/2mindril.cpp
index a102fd6df03..0a98e0c861f 100644
--- a/src/mame/drivers/2mindril.cpp
+++ b/src/mame/drivers/2mindril.cpp
@@ -81,14 +81,12 @@ private:
void drill_map(address_map &map);
#ifdef UNUSED_FUNCTION
- enum
- {
- TIMER_SHUTTER_REQ,
- TIMER_DEFENDER_REQ
- };
-
protected:
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(set_shutter_req);
+ TIMER_CALLBACK_MEMBER(set_defender_req);
+
+ emu_timer *m_shutter_req_timer;
+ emu_timer *m_defender_req_timer;
#endif
};
@@ -132,19 +130,14 @@ void _2mindril_state::coins_w(u8 data)
PORT_DIPSETTING( 0x0800, DEF_STR( On ) )
*/
#ifdef UNUSED_FUNCTION
-void _2mindril_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(_2mindril_state::set_shutter_req)
{
- switch (id)
- {
- case TIMER_SHUTTER_REQ:
- m_shutter_sensor = param;
- break;
- case TIMER_DEFENDER_REQ:
- m_defender_sensor = param;
- break;
- default:
- throw emu_fatalerror("Unknown id in _2mindril_state::device_timer");
- }
+ m_shutter_sensor = param;
+}
+
+TIMER_CALLBACK_MEMBER(_2mindril_state::set_defender_req)
+{
+ m_defender_sensor = param;
}
#endif
@@ -154,23 +147,23 @@ void _2mindril_state::sensors_w(u16 data)
/*---- ---- ---- -x-- lamp*/
if (data & 1)
{
- //timer_set( attotime::from_seconds(2), TIMER_SHUTTER_REQ, 0x01);
+ //m_shutter_req_timer->adjust(attotime::from_seconds(2), 0x01);
m_shutter_sensor = 0x01;
}
else if (data & 2)
{
- //timer_set( attotime::from_seconds(2), TIMER_SHUTTER_REQ, 0x02);
+ //m_shutter_req_timer->adjust(attotime::from_seconds(2), 0x02);
m_shutter_sensor = 0x02;
}
if (data & 0x1000 || data & 0x4000)
{
- //timer_set( attotime::from_seconds(2), TIMER_DEFENDER_REQ, 0x08);
+ //m_defender_req_timer->adjust(attotime::from_seconds(2), 0x08);
m_defender_sensor = 0x08;
}
else if (data & 0x2000 || data & 0x8000)
{
- //timer_set( attotime::from_seconds(2), TIMER_DEFENDER_REQ, 0x04);
+ //m_defender_req_timer->adjust(attotime::from_seconds(2), 0x04);
m_defender_sensor = 0x04;
}
}
@@ -341,6 +334,11 @@ void _2mindril_state::machine_start()
save_item(NAME(m_defender_sensor));
save_item(NAME(m_shutter_sensor));
save_item(NAME(m_irq_reg));
+
+#ifdef UNUSED_FUNCTION
+ m_shutter_req_timer = timer_alloc(FUNC(_2mindril_state::set_shutter_req), this);
+ m_defender_req_timer = timer_alloc(FUNC(_2mindril_state::set_defender_req), this);
+#endif
}
void _2mindril_state::machine_reset()
diff --git a/src/mame/drivers/a2600.cpp b/src/mame/drivers/a2600.cpp
index 6a9a2f7aa44..8ede846dad3 100644
--- a/src/mame/drivers/a2600.cpp
+++ b/src/mame/drivers/a2600.cpp
@@ -503,8 +503,8 @@ void a2600_pop_state::machine_start()
a2600_base_state::machine_start();
m_bank->configure_entries(0, 48, memregion("maincpu")->base(), 0x1000);
m_bank->set_entry(0);
- m_reset_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(a2600_pop_state::reset_timer_callback),this));
- m_game_select_button_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(a2600_pop_state::game_select_button_timer_callback),this));
+ m_reset_timer = timer_alloc(FUNC(a2600_pop_state::reset_timer_callback), this);
+ m_game_select_button_timer = timer_alloc(FUNC(a2600_pop_state::game_select_button_timer_callback), this);
}
diff --git a/src/mame/drivers/a7800.cpp b/src/mame/drivers/a7800.cpp
index 83cda394676..a1aa0ad908b 100644
--- a/src/mame/drivers/a7800.cpp
+++ b/src/mame/drivers/a7800.cpp
@@ -157,6 +157,8 @@ protected:
int m_p2_one_button;
int m_bios_enabled;
+ emu_timer *m_dma_start_timer = nullptr;
+
required_device<cpu_device> m_maincpu;
required_device<tia_device> m_tia;
required_device<atari_maria_device> m_maria;
@@ -276,7 +278,7 @@ void a7800_state::tia_w(offs_t offset, uint8_t data)
TIMER_DEVICE_CALLBACK_MEMBER(a7800_state::interrupt)
{
// DMA Begins 7 cycles after hblank
- machine().scheduler().timer_set(m_maincpu->cycles_to_attotime(7), timer_expired_delegate(FUNC(a7800_state::maria_startdma), this));
+ m_dma_start_timer->adjust(m_maincpu->cycles_to_attotime(7));
m_maria->interrupt(m_lines);
}
@@ -1364,6 +1366,8 @@ void a7800_state::machine_start()
break;
}
}
+
+ m_dma_start_timer = timer_alloc(FUNC(a7800_state::maria_startdma), this);
}
void a7800_state::machine_reset()
diff --git a/src/mame/drivers/abc80.cpp b/src/mame/drivers/abc80.cpp
index df28cb13058..9860410d024 100644
--- a/src/mame/drivers/abc80.cpp
+++ b/src/mame/drivers/abc80.cpp
@@ -365,7 +365,7 @@ void abc80_state::kbd_w(u8 data)
u8 pio_data = 0x80 | data;
m_pio->port_a_write(pio_data);
- timer_set(attotime::from_msec(50), TIMER_ID_FAKE_KEYBOARD_CLEAR);
+ m_keyboard_clear_timer->adjust(attotime::from_msec(50));
}
@@ -375,74 +375,74 @@ void abc80_state::kbd_w(u8 data)
//**************************************************************************
//-------------------------------------------------
-// device_timer - handler timer events
+// timer events
//-------------------------------------------------
-void abc80_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(abc80_state::scanline_tick)
{
- switch (id)
- {
- case TIMER_ID_SCANLINE:
- draw_scanline(m_bitmap, m_screen->vpos());
+ draw_scanline(m_bitmap, m_screen->vpos());
- m_pio_astb = !m_pio_astb;
+ m_pio_astb = !m_pio_astb;
- m_pio->strobe_a(m_pio_astb);
- break;
+ m_pio->strobe_a(m_pio_astb);
+}
- case TIMER_ID_CASSETTE:
- {
- if (!m_motor) return;
+TIMER_CALLBACK_MEMBER(abc80_state::cassette_update)
+{
+ if (!m_motor)
+ return;
- int tape_in = m_cassette->input() > 0;
+ int tape_in = m_cassette->input() > 0;
- if (m_tape_in != tape_in)
- if (LOG) logerror("%s tape flank %u\n", machine().time().as_string(), tape_in);
+ if (m_tape_in != tape_in)
+ if (LOG) logerror("%s tape flank %u\n", machine().time().as_string(), tape_in);
- if (m_tape_in_latch && (m_tape_in != tape_in))
- {
- if (LOG) logerror("%s set tape in latch\n", machine().time().as_string());
- m_tape_in_latch = 0;
+ if (m_tape_in_latch && (m_tape_in != tape_in))
+ {
+ if (LOG) logerror("%s set tape in latch\n", machine().time().as_string());
+ m_tape_in_latch = 0;
- m_pio->port_b_write(m_tape_in_latch << 7);
- }
+ m_pio->port_b_write(m_tape_in_latch << 7);
+ }
- m_tape_in = tape_in;
- }
- break;
+ m_tape_in = tape_in;
+}
- case TIMER_ID_BLINK:
- m_blink = !m_blink;
- break;
+TIMER_CALLBACK_MEMBER(abc80_state::blink_tick)
+{
+ m_blink = !m_blink;
+}
- case TIMER_ID_VSYNC_ON:
- if (LOG) logerror("%s vsync 1\n", machine().time().as_string());
- m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
- break;
+TIMER_CALLBACK_MEMBER(abc80_state::vsync_on)
+{
+ if (LOG) logerror("%s vsync 1\n", machine().time().as_string());
+ m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
+}
- case TIMER_ID_VSYNC_OFF:
- if (LOG) logerror("%s vsync 0\n", machine().time().as_string());
- m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
- break;
+TIMER_CALLBACK_MEMBER(abc80_state::vsync_off)
+{
+ if (LOG) logerror("%s vsync 0\n", machine().time().as_string());
+ m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
+}
- case TIMER_ID_FAKE_KEYBOARD_CLEAR:
- m_pio->port_a_write(m_key_data);
- m_key_strobe = 0;
- m_key_data = 0;
- break;
- }
+TIMER_CALLBACK_MEMBER(abc80_state::clear_keyboard)
+{
+ m_pio->port_a_write(m_key_data);
+ m_key_strobe = 0;
+ m_key_data = 0;
}
//-------------------------------------------------
-// MACHINE_START( abc80 )
+// machine_start
//-------------------------------------------------
void abc80_state::machine_start()
{
// start timers
- m_cassette_timer = timer_alloc(TIMER_ID_CASSETTE);
+ m_cassette_timer = timer_alloc(FUNC(abc80_state::cassette_update), this);
m_cassette_timer->adjust(attotime::from_hz(44100), 0, attotime::from_hz(44100));
+ m_keyboard_clear_timer = timer_alloc(FUNC(abc80_state::clear_keyboard), this);
// register for state saving
save_item(NAME(m_key_data));
diff --git a/src/mame/drivers/accomm.cpp b/src/mame/drivers/accomm.cpp
index 5ee911fa734..22a5865c606 100644
--- a/src/mame/drivers/accomm.cpp
+++ b/src/mame/drivers/accomm.cpp
@@ -94,7 +94,7 @@ protected:
virtual void machine_start() override;
virtual void video_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(scanline_interrupt_check);
private:
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
@@ -138,11 +138,6 @@ private:
bool m_ch00rom_enabled;
- enum
- {
- TIMER_SCANLINE_INTERRUPT
- };
-
/* ULA context */
struct ULA
@@ -256,12 +251,12 @@ void accomm_state::machine_start()
void accomm_state::video_start()
{
- int i;
- for( i = 0; i < 256; i++ ) {
+ for( int i = 0; i < 256; i++ ) {
m_map4[i] = ( ( i & 0x10 ) >> 3 ) | ( i & 0x01 );
m_map16[i] = ( ( i & 0x40 ) >> 3 ) | ( ( i & 0x10 ) >> 2 ) | ( ( i & 0x04 ) >> 1 ) | ( i & 0x01 );
}
- m_scanline_timer = timer_alloc(TIMER_SCANLINE_INTERRUPT);
+
+ m_scanline_timer = timer_alloc(FUNC(accomm_state::scanline_interrupt_check), this);
m_scanline_timer->adjust( m_screen->time_until_pos(0), 0, m_screen->scan_period() );
}
@@ -481,24 +476,21 @@ uint32_t accomm_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap
}
-void accomm_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(accomm_state::scanline_interrupt_check)
{
- if (id == TIMER_SCANLINE_INTERRUPT)
+ switch (m_screen->vpos())
{
- switch (m_screen->vpos())
- {
- case 99:
- interrupt_handler( INT_SET, INT_RTC );
- break;
- case 249:
- case 255:
- if ( m_screen->vpos() == m_ula.screen_dispend )
- interrupt_handler( INT_SET, INT_DISPLAY_END );
- break;
- case 311:
- m_ula.screen_addr = m_ula.screen_start;
- break;
- }
+ case 99:
+ interrupt_handler( INT_SET, INT_RTC );
+ break;
+ case 249:
+ case 255:
+ if ( m_screen->vpos() == m_ula.screen_dispend )
+ interrupt_handler( INT_SET, INT_DISPLAY_END );
+ break;
+ case 311:
+ m_ula.screen_addr = m_ula.screen_start;
+ break;
}
}
diff --git a/src/mame/drivers/acefruit.cpp b/src/mame/drivers/acefruit.cpp
index 313f087f3bc..a7a9829d3d1 100644
--- a/src/mame/drivers/acefruit.cpp
+++ b/src/mame/drivers/acefruit.cpp
@@ -48,29 +48,25 @@ public:
template <int Mask> DECLARE_READ_LINE_MEMBER(starspnr_payout_r);
protected:
- enum
- {
- TIMER_ACEFRUIT_REFRESH
- };
-
virtual void machine_start() override;
virtual void video_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(refresh_tick);
private:
- void acefruit_colorram_w(offs_t offset, uint8_t data);
- void acefruit_coin_w(uint8_t data);
- void acefruit_sound_w(uint8_t data);
- void acefruit_lamp_w(offs_t offset, uint8_t data);
- void acefruit_solenoid_w(uint8_t data);
+ void colorram_w(offs_t offset, uint8_t data);
+ void coin_w(uint8_t data);
+ void sound_w(uint8_t data);
+ void lamp_w(offs_t offset, uint8_t data);
+ void solenoid_w(uint8_t data);
- void acefruit_palette(palette_device &palette) const;
- uint32_t screen_update_acefruit(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- INTERRUPT_GEN_MEMBER(acefruit_vblank);
- void acefruit_update_irq(int vpos);
+ void palette_init(palette_device &palette) const;
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ INTERRUPT_GEN_MEMBER(vblank);
+ void update_irq(int vpos);
- void acefruit_io(address_map &map);
- void acefruit_map(address_map &map);
+ void main_io(address_map &map);
+ void main_map(address_map &map);
required_device<cpu_device> m_maincpu;
required_shared_ptr<uint8_t> m_videoram;
@@ -88,7 +84,7 @@ private:
-void acefruit_state::acefruit_update_irq(int vpos)
+void acefruit_state::update_irq(int vpos)
{
int row = vpos / 8;
@@ -106,25 +102,16 @@ void acefruit_state::acefruit_update_irq(int vpos)
}
}
-
-void acefruit_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(acefruit_state::refresh_tick)
{
int vpos = m_screen->vpos();
- switch(id)
- {
- case TIMER_ACEFRUIT_REFRESH:
-
- m_screen->update_partial(vpos);
- acefruit_update_irq(vpos);
+ m_screen->update_partial(vpos);
+ update_irq(vpos);
- vpos = ((vpos / 8) + 1) * 8;
+ vpos = ((vpos / 8) + 1) * 8;
- m_refresh_timer->adjust(m_screen->time_until_pos(vpos));
- break;
- default:
- throw emu_fatalerror("Unknown id in acefruit_state::device_timer");
- }
+ m_refresh_timer->adjust(m_screen->time_until_pos(vpos));
}
void acefruit_state::machine_start()
@@ -135,16 +122,16 @@ void acefruit_state::machine_start()
void acefruit_state::video_start()
{
- m_refresh_timer = timer_alloc(TIMER_ACEFRUIT_REFRESH);
+ m_refresh_timer = timer_alloc(FUNC(acefruit_state::refresh_tick), this);
}
-INTERRUPT_GEN_MEMBER(acefruit_state::acefruit_vblank)
+INTERRUPT_GEN_MEMBER(acefruit_state::vblank)
{
device.execute().set_input_line(0, HOLD_LINE );
m_refresh_timer->adjust( attotime::zero );
}
-uint32_t acefruit_state::screen_update_acefruit(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+uint32_t acefruit_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
int startrow = cliprect.min_y / 8;
int endrow = cliprect.max_y / 8;
@@ -212,7 +199,7 @@ uint32_t acefruit_state::screen_update_acefruit(screen_device &screen, bitmap_in
}
else if( color == 0xc )
{
- /* irq generated in acefruit_update_irq() */
+ /* irq generated in update_irq() */
}
}
}
@@ -251,34 +238,34 @@ int acefruit_state::starspnr_payout_r()
return 0;
}
-void acefruit_state::acefruit_colorram_w(offs_t offset, uint8_t data)
+void acefruit_state::colorram_w(offs_t offset, uint8_t data)
{
m_colorram[ offset ] = data & 0xf;
}
-void acefruit_state::acefruit_coin_w(uint8_t data)
+void acefruit_state::coin_w(uint8_t data)
{
/* TODO: ? */
}
-void acefruit_state::acefruit_sound_w(uint8_t data)
+void acefruit_state::sound_w(uint8_t data)
{
/* TODO: ? */
}
-void acefruit_state::acefruit_lamp_w(offs_t offset, uint8_t data)
+void acefruit_state::lamp_w(offs_t offset, uint8_t data)
{
for (int i = 0; i < 8; i++)
m_lamps[(offset << 3) | i] = BIT(data, i);
}
-void acefruit_state::acefruit_solenoid_w(uint8_t data)
+void acefruit_state::solenoid_w(uint8_t data)
{
for (int i = 0; i < 8; i++)
m_solenoids[i] = BIT(data, i);
}
-void acefruit_state::acefruit_palette(palette_device &palette) const
+void acefruit_state::palette_init(palette_device &palette) const
{
/* sprites */
palette.set_pen_color( 0, rgb_t(0x00, 0x00, 0x00) );
@@ -301,12 +288,12 @@ void acefruit_state::acefruit_palette(palette_device &palette) const
palette.set_pen_color( 15, rgb_t(0xff, 0x00, 0x00) );
}
-void acefruit_state::acefruit_map(address_map &map)
+void acefruit_state::main_map(address_map &map)
{
map(0x0000, 0x1fff).rom();
map(0x2000, 0x20ff).ram().share("nvram");
map(0x4000, 0x43ff).ram().share("videoram");
- map(0x4400, 0x47ff).ram().w(FUNC(acefruit_state::acefruit_colorram_w)).share("colorram");
+ map(0x4400, 0x47ff).ram().w(FUNC(acefruit_state::colorram_w)).share("colorram");
map(0x8000, 0x8000).portr("IN0");
map(0x8001, 0x8001).portr("IN1");
map(0x8002, 0x8002).portr("IN2");
@@ -316,15 +303,15 @@ void acefruit_state::acefruit_map(address_map &map)
map(0x8006, 0x8006).portr("IN6");
map(0x8007, 0x8007).portr("IN7");
map(0x6000, 0x6005).ram().share("spriteram");
- map(0xa000, 0xa001).w(FUNC(acefruit_state::acefruit_lamp_w));
- map(0xa002, 0xa003).w(FUNC(acefruit_state::acefruit_coin_w));
- map(0xa004, 0xa004).w(FUNC(acefruit_state::acefruit_solenoid_w));
- map(0xa005, 0xa006).w(FUNC(acefruit_state::acefruit_sound_w));
+ map(0xa000, 0xa001).w(FUNC(acefruit_state::lamp_w));
+ map(0xa002, 0xa003).w(FUNC(acefruit_state::coin_w));
+ map(0xa004, 0xa004).w(FUNC(acefruit_state::solenoid_w));
+ map(0xa005, 0xa006).w(FUNC(acefruit_state::sound_w));
map(0xc000, 0xc000).w("watchdog", FUNC(watchdog_timer_device::reset_w));
map(0xe000, 0xffff).rom();
}
-void acefruit_state::acefruit_io(address_map &map)
+void acefruit_state::main_io(address_map &map)
{
map.global_mask(0xff);
map(0x00, 0x00).noprw(); /* ? */
@@ -598,9 +585,9 @@ void acefruit_state::acefruit(machine_config &config)
{
/* basic machine hardware */
Z80(config, m_maincpu, 2500000); /* 2.5MHz */
- m_maincpu->set_addrmap(AS_PROGRAM, &acefruit_state::acefruit_map);
- m_maincpu->set_addrmap(AS_IO, &acefruit_state::acefruit_io);
- m_maincpu->set_vblank_int("screen", FUNC(acefruit_state::acefruit_vblank));
+ m_maincpu->set_addrmap(AS_PROGRAM, &acefruit_state::main_map);
+ m_maincpu->set_addrmap(AS_IO, &acefruit_state::main_io);
+ m_maincpu->set_vblank_int("screen", FUNC(acefruit_state::vblank));
WATCHDOG_TIMER(config, "watchdog");
@@ -612,10 +599,10 @@ void acefruit_state::acefruit(machine_config &config)
m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(2500) /* not accurate */);
m_screen->set_size(512, 256);
m_screen->set_visarea_full();
- m_screen->set_screen_update(FUNC(acefruit_state::screen_update_acefruit));
+ m_screen->set_screen_update(FUNC(acefruit_state::screen_update));
m_screen->set_palette(m_palette);
- PALETTE(config, m_palette, FUNC(acefruit_state::acefruit_palette), 16);
+ PALETTE(config, m_palette, FUNC(acefruit_state::palette_init), 16);
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
diff --git a/src/mame/drivers/aces1.cpp b/src/mame/drivers/aces1.cpp
index fe26d5cf3ef..1d2742bf760 100644
--- a/src/mame/drivers/aces1.cpp
+++ b/src/mame/drivers/aces1.cpp
@@ -263,8 +263,8 @@ void aces1_state::machine_start()
m_reel_clock[reel] =0;
m_reel_phase[reel] =0;
}
- m_aces1_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(aces1_state::m_aces1_irq_timer_callback),this));
- m_aces1_nmi_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(aces1_state::m_aces1_nmi_timer_callback),this));
+ m_aces1_irq_timer = timer_alloc(FUNC(aces1_state::m_aces1_irq_timer_callback), this);
+ m_aces1_nmi_timer = timer_alloc(FUNC(aces1_state::m_aces1_nmi_timer_callback), this);
m_digits.resolve();
m_lamps.resolve();
diff --git a/src/mame/drivers/alfaskop41xx.cpp b/src/mame/drivers/alfaskop41xx.cpp
index cacc30138fc..b65a28fe6a8 100644
--- a/src/mame/drivers/alfaskop41xx.cpp
+++ b/src/mame/drivers/alfaskop41xx.cpp
@@ -110,13 +110,9 @@ private:
uint8_t m_imsk;
/* Debug stuff */
- /* Timer */
- enum
- {
- TIMER_POLL_START,
- TIMER_POLL_BIT
- };
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ /* Timer callbacks */
+ TIMER_CALLBACK_MEMBER(poll_start);
+ TIMER_CALLBACK_MEMBER(poll_bit);
// DEBUG stuff, will be removed when hooked up towards remote peer
/* zero extended SDLC poll message frame to feed into receiver as a test
@@ -130,6 +126,8 @@ private:
0 1 1 1 1 1 1 0 ; closing flag 0x7e
*/
uint8_t txBuf[10] = {0x7e, 0x00, 0xff, 0xc0, 0xa0, 0x8d, 0x55, 0x7e};
+ emu_timer *m_poll_start_timer = nullptr;
+ emu_timer *m_poll_bit_timer = nullptr;
int index = 0;
int pos = 0;
int ones = 0;
@@ -477,23 +475,27 @@ void alfaskop4110_state::machine_start()
{
save_item(NAME(m_irq));
save_item(NAME(m_imsk));
- timer_set(attotime::from_msec(5000), TIMER_POLL_START);
+
+ m_poll_start_timer = timer_alloc(FUNC(alfaskop4110_state::poll_start), this);
+ m_poll_start_timer->adjust(attotime::from_msec(5000));
+
+ m_poll_bit_timer = timer_alloc(FUNC(alfaskop4110_state::poll_bit), this);
+ m_poll_bit_timer->adjust(attotime::never);
+}
+
+// Debug - inserts a poll SDLC frame through the ADLC, it ends up at address 0x140 in RAM through DMA
+TIMER_CALLBACK_MEMBER(alfaskop4110_state::poll_start)
+{
+ /* The serial transfer of 8 bits is complete. Now trigger INT7. */
+ LOGADLC("Starting poll message\n");
+ m_tia_adlc->set_rx(0);
+ m_poll_bit_timer->adjust(attotime::from_hz(300000));
}
-void alfaskop4110_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(alfaskop4110_state::poll_bit)
{
- // Debug, inserts a poll SDLC frame through the ADLC, it ends up at address 0x140 in RAM through DMA
- switch (id)
+ if (flank)
{
- case TIMER_POLL_START:
- /* The serial transfer of 8 bits is complete. Now trigger INT7. */
- LOGADLC("Starting poll message\n");
- m_tia_adlc->set_rx(0);
- timer_set(attotime::from_hz(300000), TIMER_POLL_BIT);
- break;
- case TIMER_POLL_BIT:
- if (flank)
- {
if (index != 0 && index != 7 && BIT(txBuf[index], (pos % 8)) && ones == 5)
{
LOGADLC("%d%c", 2, (pos % 8) == 7 ? '\n' : ' ');
@@ -511,13 +513,11 @@ void alfaskop4110_state::device_timer(emu_timer &timer, device_timer_id id, int
pos++;
index = pos / 8;
}
- }
- m_tia_adlc->rxc_w(flank ? 1 : 0);
- if (index < 8)
- timer_set(attotime::from_hz(300000) / 2, TIMER_POLL_BIT);
- flank = !flank;
- break;
}
+ m_tia_adlc->rxc_w(flank ? 1 : 0);
+ if (index < 8)
+ m_poll_bit_timer->adjust(attotime::from_hz(300000) / 2);
+ flank = !flank;
}
void alfaskop4110_state::machine_reset()
diff --git a/src/mame/drivers/alpha68k_n.cpp b/src/mame/drivers/alpha68k_n.cpp
index a56e258b295..6915c623786 100644
--- a/src/mame/drivers/alpha68k_n.cpp
+++ b/src/mame/drivers/alpha68k_n.cpp
@@ -1025,7 +1025,7 @@ void sstingray_state::init_sstingry()
m_coin_id = 0x22 | (0x22 << 8);
m_game_id = 0;
- m_alpha8511_sync_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sstingray_state::alpha8511_sync), this));
+ m_alpha8511_sync_timer = timer_alloc(FUNC(sstingray_state::alpha8511_sync), this);
save_item(NAME(m_alpha8511_address));
save_item(NAME(m_alpha8511_control));
save_item(NAME(m_alpha8511_read_mode));
diff --git a/src/mame/drivers/alto2.cpp b/src/mame/drivers/alto2.cpp
index 6c10a9edf5a..91b60bbdb14 100644
--- a/src/mame/drivers/alto2.cpp
+++ b/src/mame/drivers/alto2.cpp
@@ -26,12 +26,12 @@ public:
m_io_config(*this, "CONFIG")
{ }
- void init_alto2();
-
void alto2(machine_config &config);
protected:
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ virtual void driver_init() override;
+
+ TIMER_CALLBACK_MEMBER(handle_vblank);
private:
u16 kb_r(offs_t offset);
@@ -41,7 +41,6 @@ private:
required_device<speaker_sound_device> m_speaker;
required_ioport_array<8> m_io_row;
optional_ioport m_io_config;
- static const device_timer_id TIMER_VBLANK = 0;
emu_timer* m_vblank_timer;
};
@@ -297,23 +296,16 @@ void alto2_state::alto2(machine_config &config)
DIABLO_HD(config, DIABLO_HD_1, 3333333);
}
-/* Driver Init */
-
-void alto2_state::init_alto2()
+void alto2_state::driver_init()
{
// Create a timer which fires twice per frame, once for each field
- m_vblank_timer = timer_alloc(TIMER_VBLANK);
- m_vblank_timer->adjust(attotime::from_hz(2*30),0,attotime::from_hz(30*2));
+ m_vblank_timer = timer_alloc(FUNC(alto2_state::handle_vblank), this);
+ m_vblank_timer->adjust(attotime::from_hz(30*2), 0, attotime::from_hz(30*2));
}
-void alto2_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(alto2_state::handle_vblank)
{
- alto2_cpu_device* cpu = downcast<alto2_cpu_device *>(m_maincpu.target());
- switch (id) {
- case TIMER_VBLANK:
- cpu->screen_vblank();
- break;
- }
+ m_maincpu->screen_vblank();
}
} // Anonymous namespace
@@ -321,4 +313,4 @@ void alto2_state::device_timer(emu_timer &timer, device_timer_id id, int param)
/* Game Drivers */
// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS
-COMP( 1977, alto2, 0, 0, alto2, alto2, alto2_state, init_alto2, "Xerox", "Alto-II", 0 )
+COMP( 1977, alto2, 0, 0, alto2, alto2, alto2_state, empty_init, "Xerox", "Alto-II", 0 )
diff --git a/src/mame/drivers/amico2k.cpp b/src/mame/drivers/amico2k.cpp
index 825cd1648b5..78dc197e8ae 100644
--- a/src/mame/drivers/amico2k.cpp
+++ b/src/mame/drivers/amico2k.cpp
@@ -208,7 +208,7 @@ void amico2k_state::ppi_pb_w(uint8_t data)
void amico2k_state::machine_start()
{
m_digits.resolve();
- m_led_refresh_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(amico2k_state::led_refresh),this));
+ m_led_refresh_timer = timer_alloc(FUNC(amico2k_state::led_refresh), this);
// state saving
save_item(NAME(m_ls145_p));
diff --git a/src/mame/drivers/amiga.cpp b/src/mame/drivers/amiga.cpp
index d360b3baacb..14ab6176fb3 100644
--- a/src/mame/drivers/amiga.cpp
+++ b/src/mame/drivers/amiga.cpp
@@ -150,8 +150,8 @@ protected:
virtual void device_start() override
{
// allocate resources
- m_c813_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(a1000_kbreset_device::c813_charged), this));
- m_c814_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(a1000_kbreset_device::c814_charged), this));
+ m_c813_timer = timer_alloc(FUNC(a1000_kbreset_device::c813_charged), this);
+ m_c814_timer = timer_alloc(FUNC(a1000_kbreset_device::c814_charged), this);
// start in idle state
m_kbclk = 1U;
diff --git a/src/mame/drivers/apexc.cpp b/src/mame/drivers/apexc.cpp
index f63dce84782..4a6e31ceb6f 100644
--- a/src/mame/drivers/apexc.cpp
+++ b/src/mame/drivers/apexc.cpp
@@ -11,13 +11,11 @@
#include "emu.h"
#include "includes/apexc.h"
-/*static*/ const device_timer_id apexc_state::TIMER_POLL_INPUTS = 1;
-
void apexc_state::machine_start()
{
teletyper_init();
- m_input_timer = timer_alloc(TIMER_POLL_INPUTS);
+ m_input_timer = timer_alloc(FUNC(apexc_state::check_inputs), this);
m_input_timer->adjust(attotime::from_hz(60), 0, attotime::from_hz(60));
m_panel_data_reg = 0;
@@ -139,15 +137,7 @@ static INPUT_PORTS_START(apexc)
PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #32") PORT_CODE(KEYCODE_C)
INPUT_PORTS_END
-void apexc_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- if (id == TIMER_POLL_INPUTS)
- {
- check_inputs();
- }
-}
-
-void apexc_state::check_inputs()
+TIMER_CALLBACK_MEMBER(apexc_state::check_inputs)
{
/* read new state of edit keys */
uint32_t edit_keys = m_data_port->read();
@@ -375,7 +365,7 @@ void apexc_state::apexc(machine_config &config)
m_screen->set_size(256, 192);
m_screen->set_visarea(0, 256-1, 0, 192-1);
m_screen->set_palette(m_palette);
- m_screen->set_screen_update(FUNC(apexc_state::screen_update_apexc));
+ m_screen->set_screen_update(FUNC(apexc_state::screen_update));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_apexc);
diff --git a/src/mame/drivers/apple1.cpp b/src/mame/drivers/apple1.cpp
index dc9ce6b320f..418c333779f 100644
--- a/src/mame/drivers/apple1.cpp
+++ b/src/mame/drivers/apple1.cpp
@@ -386,9 +386,9 @@ void apple1_state::machine_start()
m_reset_down = m_clear_down = false;
- m_ready_start_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(apple1_state::ready_start_cb), this));
- m_ready_end_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(apple1_state::ready_end_cb), this));
- m_kbd_strobe_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(apple1_state::keyboard_strobe_cb), this));
+ m_ready_start_timer = timer_alloc(FUNC(apple1_state::ready_start_cb), this);
+ m_ready_end_timer = timer_alloc(FUNC(apple1_state::ready_end_cb), this);
+ m_kbd_strobe_timer = timer_alloc(FUNC(apple1_state::keyboard_strobe_cb), this);
// setup save states
save_item(NAME(m_vram));
diff --git a/src/mame/drivers/apple2e.cpp b/src/mame/drivers/apple2e.cpp
index c3c1ea8a9a6..e500723a6ff 100644
--- a/src/mame/drivers/apple2e.cpp
+++ b/src/mame/drivers/apple2e.cpp
@@ -1056,7 +1056,7 @@ void apple2e_state::machine_start()
if ((m_has_laser_mouse) || (m_isace500) || (m_isace2200))
{
- m_strobe_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(apple2e_state::update_laserprn_strobe), this));
+ m_strobe_timer = timer_alloc(FUNC(apple2e_state::update_laserprn_strobe), this);
m_next_strobe = 1U;
}
diff --git a/src/mame/drivers/aristmk4.cpp b/src/mame/drivers/aristmk4.cpp
index 7deff52da01..5f53816b824 100644
--- a/src/mame/drivers/aristmk4.cpp
+++ b/src/mame/drivers/aristmk4.cpp
@@ -378,13 +378,6 @@ public:
void init_aristmk4();
private:
- enum
- {
- TIMER_POWER_FAIL
- };
-
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
required_device<cpu_device> m_maincpu;
required_device<mc146818_device> m_rtc;
required_device<ay8910_device> m_ay1;
@@ -417,6 +410,9 @@ private:
int m_cashcade_c = 0;
int m_printer_motor = 0;
emu_timer *m_power_timer = nullptr;
+ emu_timer *m_note_reset_timer = nullptr;
+ emu_timer *m_coin_reset_timer = nullptr;
+ emu_timer *m_hopper_reset_timer = nullptr;
uint8_t ldsw();
uint8_t cgdrr();
@@ -457,7 +453,7 @@ private:
TIMER_CALLBACK_MEMBER(note_input_reset);
TIMER_CALLBACK_MEMBER(coin_input_reset);
TIMER_CALLBACK_MEMBER(hopper_reset);
- void power_fail();
+ TIMER_CALLBACK_MEMBER(power_fail);
inline void uBackgroundColour();
void slots_mem(address_map &map);
@@ -634,7 +630,7 @@ uint8_t aristmk4_state::bv_p0()
case 0x02:
bv_p0_ret=0x89;
m_insnote++;
- machine().scheduler().timer_set(attotime::from_msec(150), timer_expired_delegate(FUNC(aristmk4_state::note_input_reset),this));
+ m_note_reset_timer->adjust(attotime::from_msec(150));
break;
default:
break; //timer will reset the input
@@ -834,7 +830,7 @@ uint8_t aristmk4_state::via_b_r()
case 0x02:
ret=ret^0x20;
m_inscrd++;
- machine().scheduler().timer_set(attotime::from_msec(150), timer_expired_delegate(FUNC(aristmk4_state::coin_input_reset),this));
+ m_coin_reset_timer->adjust(attotime::from_msec(150));
break;
default:
break; //timer will reset the input
@@ -846,7 +842,7 @@ uint8_t aristmk4_state::via_b_r()
{
case 0x00:
ret=ret^0x40;
- machine().scheduler().timer_set(attotime::from_msec(175), timer_expired_delegate(FUNC(aristmk4_state::hopper_reset),this));
+ m_hopper_reset_timer->adjust(attotime::from_msec(175));
m_hopper_motor = 0x02;
m_hopper_motor_out = 2;
break;
@@ -1728,7 +1724,10 @@ void aristmk4_state::machine_start()
m_credit_out_meter.resolve();
m_hopper_motor_out.resolve();
m_lamps.resolve();
- m_power_timer = timer_alloc(TIMER_POWER_FAIL);
+ m_power_timer = timer_alloc(FUNC(aristmk4_state::power_fail), this);
+ m_note_reset_timer = timer_alloc(FUNC(aristmk4_state::note_input_reset), this);
+ m_coin_reset_timer = timer_alloc(FUNC(aristmk4_state::coin_input_reset), this);
+ m_hopper_reset_timer = timer_alloc(FUNC(aristmk4_state::hopper_reset), this);
}
void aristmk4_state::machine_reset()
@@ -1747,16 +1746,7 @@ void aristmk4_state::machine_reset()
m_power_timer->adjust(attotime::from_hz(1), 0, attotime::from_hz(1));
}
-void aristmk4_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_POWER_FAIL: power_fail(); break;
- default: throw emu_fatalerror("Unknown id in aristmk4_state::device_timer");
- }
-}
-
-void aristmk4_state::power_fail()
+TIMER_CALLBACK_MEMBER(aristmk4_state::power_fail)
{
/*
IRQ generator pulses the NMI signal to CPU in the event of power down or power failure.
diff --git a/src/mame/drivers/aristmk5.cpp b/src/mame/drivers/aristmk5.cpp
index e8794f29d06..5c699ed4155 100644
--- a/src/mame/drivers/aristmk5.cpp
+++ b/src/mame/drivers/aristmk5.cpp
@@ -2270,8 +2270,8 @@ void aristmk5_state::machine_start()
m_coin_start_cycles = 0ULL;
- m_mk5_2KHz_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(aristmk5_state::mk5_2KHz_callback),this));
- m_spi_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(aristmk5_state::spi_timer), this));
+ m_mk5_2KHz_timer = timer_alloc(FUNC(aristmk5_state::mk5_2KHz_callback), this);
+ m_spi_timer = timer_alloc(FUNC(aristmk5_state::spi_timer), this);
m_lamps.resolve();
}
diff --git a/src/mame/drivers/artmagic.cpp b/src/mame/drivers/artmagic.cpp
index 5e979dd188a..1d1e3639b79 100644
--- a/src/mame/drivers/artmagic.cpp
+++ b/src/mame/drivers/artmagic.cpp
@@ -71,7 +71,7 @@ WRITE_LINE_MEMBER(artmagic_state::m68k_gen_int)
void artmagic_state::machine_start()
{
- m_irq_off_timer = timer_alloc(TIMER_IRQ_OFF);
+ m_irq_off_timer = timer_alloc(FUNC(artmagic_state::irq_off), this);
save_item(NAME(m_tms_irq));
save_item(NAME(m_hack_irq));
@@ -119,17 +119,10 @@ void artmagic_state::control_w(offs_t offset, uint16_t data, uint16_t mem_mask)
*
*************************************/
-void artmagic_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(artmagic_state::irq_off)
{
- switch (id)
- {
- case TIMER_IRQ_OFF:
- m_hack_irq = 0;
- update_irq_state();
- break;
- default:
- throw emu_fatalerror("Unknown id in artmagic_state::device_timer");
- }
+ m_hack_irq = 0;
+ update_irq_state();
}
diff --git a/src/mame/drivers/asterix.cpp b/src/mame/drivers/asterix.cpp
index b7b5d33b086..e43e75dbade 100644
--- a/src/mame/drivers/asterix.cpp
+++ b/src/mame/drivers/asterix.cpp
@@ -65,22 +65,16 @@ INTERRUPT_GEN_MEMBER(asterix_state::asterix_interrupt)
device.execute().set_input_line(5, HOLD_LINE); /* ??? All irqs have the same vector, and the mask used is 0 or 7 */
}
-void asterix_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(asterix_state::audio_nmi)
{
- switch (id)
- {
- case TIMER_NMI:
- m_audiocpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
- break;
- default:
- throw emu_fatalerror("Unknown id in asterix_state::device_timer");
- }
+ m_audiocpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
}
void asterix_state::sound_arm_nmi_w(uint8_t data)
{
m_audiocpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
- timer_set(attotime::from_usec(5), TIMER_NMI);
+ if (!m_audio_nmi_timer->remaining().is_never())
+ m_audio_nmi_timer->adjust(attotime::from_usec(5));
}
void asterix_state::sound_irq_w(uint16_t data)
@@ -238,6 +232,8 @@ void asterix_state::machine_start()
save_item(NAME(m_layer_colorbase));
save_item(NAME(m_tilebanks));
save_item(NAME(m_spritebanks));
+
+ m_audio_nmi_timer = timer_alloc(FUNC(asterix_state::audio_nmi), this);
}
void asterix_state::machine_reset()
diff --git a/src/mame/drivers/astinvad.cpp b/src/mame/drivers/astinvad.cpp
index b8df134590d..128c9e3e1f8 100644
--- a/src/mame/drivers/astinvad.cpp
+++ b/src/mame/drivers/astinvad.cpp
@@ -72,12 +72,6 @@ public:
DECLARE_INPUT_CHANGED_MEMBER(spaceint_coin_inserted);
private:
- enum
- {
- TIMER_INT_OFF,
- TIMER_INT_GEN
- };
-
void color_latch_w(uint8_t data);
void spaceint_videoram_w(offs_t offset, uint8_t data);
uint8_t kamikaze_ppi_r(offs_t offset);
@@ -98,19 +92,18 @@ private:
uint32_t screen_update_spcking2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
uint32_t screen_update_spaceint(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(kamikaze_int_off);
- TIMER_CALLBACK_MEMBER(kamizake_int_gen);
+ TIMER_CALLBACK_MEMBER(kamikaze_int_gen);
void kamikaze_map(address_map &map);
void kamikaze_portmap(address_map &map);
void spaceint_map(address_map &map);
void spaceint_portmap(address_map &map);
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
void plot_byte( bitmap_rgb32 &bitmap, uint8_t y, uint8_t x, uint8_t data, uint8_t color );
std::unique_ptr<uint8_t[]> m_colorram{};
- emu_timer *m_int_timer = nullptr;
- emu_timer *m_int_off_timer = nullptr;
+ emu_timer *m_int_timer = nullptr;
+ emu_timer *m_int_off_timer = nullptr;
uint8_t m_sound_state[2]{};
uint8_t m_screen_flip = 0;
uint8_t m_screen_red = 0;
@@ -251,29 +244,13 @@ uint32_t astinvad_state::screen_update_spaceint(screen_device &screen, bitmap_rg
*
*************************************/
-void astinvad_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_INT_OFF:
- kamikaze_int_off(param);
- break;
- case TIMER_INT_GEN:
- kamizake_int_gen(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in astinvad_state::device_timer");
- }
-}
-
-
TIMER_CALLBACK_MEMBER(astinvad_state::kamikaze_int_off)
{
m_maincpu->set_input_line(0, CLEAR_LINE);
}
-TIMER_CALLBACK_MEMBER(astinvad_state::kamizake_int_gen)
+TIMER_CALLBACK_MEMBER(astinvad_state::kamikaze_int_gen)
{
/* interrupts are asserted on every state change of the 128V line */
m_maincpu->set_input_line(0, ASSERT_LINE);
@@ -287,9 +264,9 @@ TIMER_CALLBACK_MEMBER(astinvad_state::kamizake_int_gen)
MACHINE_START_MEMBER(astinvad_state,kamikaze)
{
- m_int_timer = timer_alloc(TIMER_INT_GEN);
+ m_int_timer = timer_alloc(FUNC(astinvad_state::kamikaze_int_gen), this);
m_int_timer->adjust(m_screen->time_until_pos(128), 128);
- m_int_off_timer = timer_alloc(TIMER_INT_OFF);
+ m_int_off_timer = timer_alloc(FUNC(astinvad_state::kamikaze_int_off), this);
save_item(NAME(m_screen_flip));
save_item(NAME(m_screen_red));
diff --git a/src/mame/drivers/asuka.cpp b/src/mame/drivers/asuka.cpp
index 478bff7bf58..051d8b703b5 100644
--- a/src/mame/drivers/asuka.cpp
+++ b/src/mame/drivers/asuka.cpp
@@ -1046,7 +1046,7 @@ void cadash_state::machine_start()
{
base_state::machine_start();
- m_int5_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(cadash_state::interrupt5), this));
+ m_int5_timer = timer_alloc(FUNC(cadash_state::interrupt5), this);
}
WRITE_LINE_MEMBER(base_state::screen_vblank)
diff --git a/src/mame/drivers/atarist.cpp b/src/mame/drivers/atarist.cpp
index c98a4877a92..abf5ecaadac 100644
--- a/src/mame/drivers/atarist.cpp
+++ b/src/mame/drivers/atarist.cpp
@@ -122,11 +122,6 @@ enum
class st_state : public driver_device
{
public:
- enum
- {
- TIMER_MOUSE_TICK
- };
-
st_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, M68000_TAG),
@@ -181,7 +176,7 @@ protected:
optional_ioport m_mousey;
optional_ioport m_config;
- void mouse_tick();
+ TIMER_CALLBACK_MEMBER(mouse_tick);
// driver
uint16_t fdc_data_r(offs_t offset);
@@ -263,7 +258,6 @@ protected:
uint16_t fpu_r();
void fpu_w(uint16_t data);
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void machine_start() override;
output_finder<> m_led;
@@ -312,9 +306,9 @@ public:
DECLARE_WRITE_LINE_MEMBER( write_monochrome );
void dmasound_set_state(int level);
- void dmasound_tick();
+ TIMER_CALLBACK_MEMBER(dmasound_tick);
void microwire_shift();
- void microwire_tick();
+ TIMER_CALLBACK_MEMBER(microwire_tick);
void state_save();
/* microwire state */
@@ -344,7 +338,6 @@ public:
void ste(machine_config &config);
void ste_map(address_map &map);
protected:
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void machine_start() override;
};
@@ -388,23 +381,6 @@ protected:
//**************************************************************************
-// TIMERS
-//**************************************************************************
-
-void st_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_MOUSE_TICK:
- mouse_tick();
- break;
- default:
- throw emu_fatalerror("Unknown id in st_state::device_timer");
- }
-}
-
-
-//**************************************************************************
// FLOPPY
//**************************************************************************
@@ -789,7 +765,7 @@ uint16_t st_state::berr_r()
// mouse_tick -
//-------------------------------------------------
-void st_state::mouse_tick()
+TIMER_CALLBACK_MEMBER(st_state::mouse_tick)
{
/*
@@ -1097,7 +1073,7 @@ WRITE_LINE_MEMBER( ste_state::write_monochrome )
// dmasound_tick -
//-------------------------------------------------
-void ste_state::dmasound_tick()
+TIMER_CALLBACK_MEMBER(ste_state::dmasound_tick)
{
if (m_dmasnd_samples == 0)
{
@@ -1145,22 +1121,6 @@ void ste_state::dmasound_tick()
}
-void ste_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_DMASOUND_TICK:
- dmasound_tick();
- break;
- case TIMER_MICROWIRE_TICK:
- microwire_tick();
- break;
- default:
- st_state::device_timer(timer, id, param);
- }
-}
-
-
//-------------------------------------------------
// sound_dma_control_r -
//-------------------------------------------------
@@ -1377,7 +1337,7 @@ void ste_state::microwire_shift()
// microwire_tick -
//-------------------------------------------------
-void ste_state::microwire_tick()
+TIMER_CALLBACK_MEMBER(ste_state::microwire_tick)
{
switch (m_mw_shift)
{
@@ -2210,7 +2170,7 @@ void st_state::machine_start()
// allocate timers
if (m_mousex.found())
{
- m_mouse_timer = timer_alloc(TIMER_MOUSE_TICK);
+ m_mouse_timer = timer_alloc(FUNC(st_state::mouse_tick), this);
m_mouse_timer->adjust(attotime::zero, 0, attotime::from_hz(500));
}
@@ -2264,8 +2224,8 @@ void ste_state::machine_start()
m_maincpu->space(AS_PROGRAM).install_read_handler(0xfa0000, 0xfbffff, read16s_delegate(*m_cart, FUNC(generic_slot_device::read16_rom)));
/* allocate timers */
- m_dmasound_timer = timer_alloc(TIMER_DMASOUND_TICK);
- m_microwire_timer = timer_alloc(TIMER_MICROWIRE_TICK);
+ m_dmasound_timer = timer_alloc(FUNC(ste_state::dmasound_tick), this);
+ m_microwire_timer = timer_alloc(FUNC(ste_state::microwire_tick), this);
/* register for state saving */
state_save();
diff --git a/src/mame/drivers/atetris.cpp b/src/mame/drivers/atetris.cpp
index bac7cebbcf5..3d1c08893d8 100644
--- a/src/mame/drivers/atetris.cpp
+++ b/src/mame/drivers/atetris.cpp
@@ -316,7 +316,7 @@ void atetris_state::machine_start()
}
// Allocate interrupt timer
- m_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(atetris_state::interrupt_gen), this));
+ m_interrupt_timer = timer_alloc(FUNC(atetris_state::interrupt_gen), this);
}
diff --git a/src/mame/drivers/atlantis.cpp b/src/mame/drivers/atlantis.cpp
index 4fa450c8350..02df73d300d 100644
--- a/src/mame/drivers/atlantis.cpp
+++ b/src/mame/drivers/atlantis.cpp
@@ -124,7 +124,8 @@ public:
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(adc_ready);
private:
required_device<mips3_device> m_maincpu;
@@ -628,7 +629,7 @@ void atlantis_state::machine_start()
m_maincpu->mips3drc_set_options(MIPS3DRC_FASTEST_OPTIONS | MIPS3DRC_STRICT_VERIFY | MIPS3DRC_EXTRA_INSTR_CHECK);
// Allocate adc timer
- m_adc_ready_timer = timer_alloc(0);
+ m_adc_ready_timer = timer_alloc(FUNC(atlantis_state::adc_ready), this);
// Save states
save_item(NAME(m_cmos_write_enabled));
@@ -659,7 +660,7 @@ void atlantis_state::machine_reset()
/*************************************
* Timer
*************************************/
-void atlantis_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(atlantis_state::adc_ready)
{
// ADC Ready Timer
board_ctrl[STATUS] |= (1 << A2D_IRQ_SHIFT);
diff --git a/src/mame/drivers/aviion88k.cpp b/src/mame/drivers/aviion88k.cpp
index 6b290b62f43..e0225b951ec 100644
--- a/src/mame/drivers/aviion88k.cpp
+++ b/src/mame/drivers/aviion88k.cpp
@@ -134,7 +134,7 @@ void aviion88k_state::machine_start()
m_leds.resolve();
for (emu_timer *&pit : m_pit)
- pit = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(aviion88k_state::pit_timer), this));
+ pit = timer_alloc(FUNC(aviion88k_state::pit_timer), this);
}
void aviion88k_state::machine_reset()
diff --git a/src/mame/drivers/beaminv.cpp b/src/mame/drivers/beaminv.cpp
index de9e205db85..3ff0fbf0dec 100644
--- a/src/mame/drivers/beaminv.cpp
+++ b/src/mame/drivers/beaminv.cpp
@@ -134,7 +134,7 @@ TIMER_CALLBACK_MEMBER(beaminv_state::interrupt_callback)
void beaminv_state::create_interrupt_timer()
{
- m_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(beaminv_state::interrupt_callback),this));
+ m_interrupt_timer = timer_alloc(FUNC(beaminv_state::interrupt_callback), this);
}
diff --git a/src/mame/drivers/beezer.cpp b/src/mame/drivers/beezer.cpp
index efedc688fed..8b282da9d29 100644
--- a/src/mame/drivers/beezer.cpp
+++ b/src/mame/drivers/beezer.cpp
@@ -69,8 +69,8 @@ public:
m_dac_data[0] = m_dac_data[1] = m_dac_data[2] = m_dac_data[3] = 0;
}
- void scanline_cb();
- void dac_update_cb();
+ TIMER_CALLBACK_MEMBER(scanline_cb);
+ TIMER_CALLBACK_MEMBER(dac_update_cb);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void palette_init(palette_device &palette);
void palette_w(offs_t offset, uint8_t data);
@@ -100,14 +100,6 @@ protected:
virtual void machine_start() override;
virtual void machine_reset() override;
- enum
- {
- TIMER_DAC,
- TIMER_SCANLINE
- };
-
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
private:
required_device<cpu_device> m_maincpu;
memory_view m_sysbank;
@@ -228,7 +220,7 @@ INPUT_PORTS_END
// VIDEO EMULATION
//**************************************************************************
-void beezer_state::scanline_cb()
+TIMER_CALLBACK_MEMBER( beezer_state::scanline_cb )
{
const int scanline = m_screen->vpos();
@@ -291,17 +283,7 @@ uint8_t beezer_state::line_r()
// AUDIO
//**************************************************************************
-void beezer_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_DAC: dac_update_cb(); break;
- case TIMER_SCANLINE: scanline_cb(); break;
- default: throw emu_fatalerror("Unknown id in beezer_state::device_timer");
- }
-}
-
-void beezer_state::dac_update_cb()
+TIMER_CALLBACK_MEMBER( beezer_state::dac_update_cb )
{
// channel multiplexer at u52
int ch = m_count++ & 3;
@@ -458,8 +440,8 @@ void beezer_state::machine_start()
m_rombank[i]->configure_entries(0, 2, m_banked_roms->base() + (i * 0x2000), 0x1000);
// allocate timers
- m_dac_timer = timer_alloc(TIMER_DAC);
- m_scanline_timer = timer_alloc(TIMER_SCANLINE);
+ m_dac_timer = timer_alloc(FUNC(beezer_state::dac_update_cb), this);
+ m_scanline_timer = timer_alloc(FUNC(beezer_state::scanline_cb), this);
// register for state saving
save_item(NAME(m_ch_sign));
diff --git a/src/mame/drivers/berzerk.cpp b/src/mame/drivers/berzerk.cpp
index e3c41937063..2c4fc593348 100644
--- a/src/mame/drivers/berzerk.cpp
+++ b/src/mame/drivers/berzerk.cpp
@@ -249,7 +249,7 @@ TIMER_CALLBACK_MEMBER(berzerk_state::irq_callback)
void berzerk_state::create_irq_timer()
{
- m_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(berzerk_state::irq_callback),this));
+ m_irq_timer = timer_alloc(FUNC(berzerk_state::irq_callback), this);
}
@@ -326,7 +326,7 @@ TIMER_CALLBACK_MEMBER(berzerk_state::nmi_callback)
void berzerk_state::create_nmi_timer()
{
- m_nmi_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(berzerk_state::nmi_callback),this));
+ m_nmi_timer = timer_alloc(FUNC(berzerk_state::nmi_callback), this);
}
diff --git a/src/mame/drivers/beta.cpp b/src/mame/drivers/beta.cpp
index f2869615987..c009f460201 100644
--- a/src/mame/drivers/beta.cpp
+++ b/src/mame/drivers/beta.cpp
@@ -320,7 +320,7 @@ void beta_state::machine_start()
m_digits.resolve();
m_leds.resolve();
- m_led_refresh_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(beta_state::led_refresh),this));
+ m_led_refresh_timer = timer_alloc(FUNC(beta_state::led_refresh), this);
m_eprom_rom.resize(0x800);
diff --git a/src/mame/drivers/bfcobra.cpp b/src/mame/drivers/bfcobra.cpp
index 60eab2fd41d..5741b50af9c 100644
--- a/src/mame/drivers/bfcobra.cpp
+++ b/src/mame/drivers/bfcobra.cpp
@@ -1841,7 +1841,7 @@ void bfcobjam_state::init_bfcobjam()
membank("bank2")->set_base(memregion("user1")->base()+0x08000);
membank("bank3")->set_base(memregion("user1")->base()+0x0c000);
- m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(bfcobjam_state::scanline_callback),this));
+ m_scanline_timer = timer_alloc(FUNC(bfcobjam_state::scanline_callback), this);
/* Finish this */
save_item(NAME(m_data_r));
diff --git a/src/mame/drivers/blockade.cpp b/src/mame/drivers/blockade.cpp
index 8faf7f5b7ed..45a9c9a8952 100644
--- a/src/mame/drivers/blockade.cpp
+++ b/src/mame/drivers/blockade.cpp
@@ -62,7 +62,8 @@ public:
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(vblank_tick);
private:
required_device<cpu_device> m_maincpu;
@@ -442,7 +443,7 @@ void blockade_state::machine_start()
{
m_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(blockade_state::tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
- m_vblank_timer = timer_alloc(0);
+ m_vblank_timer = timer_alloc(FUNC(blockade_state::vblank_tick), this);
// register for save states
save_item(NAME(m_coin_latch));
@@ -455,7 +456,7 @@ void blockade_state::machine_reset()
m_coin_inserted = 0;
}
-void blockade_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(blockade_state::vblank_tick)
{
// resume cpu, on the real system, this is connected the READY input
m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
diff --git a/src/mame/drivers/boxer.cpp b/src/mame/drivers/boxer.cpp
index f40601c7764..b76b3d61bae 100644
--- a/src/mame/drivers/boxer.cpp
+++ b/src/mame/drivers/boxer.cpp
@@ -27,12 +27,6 @@
class boxer_state : public driver_device
{
public:
- enum
- {
- TIMER_POT_INTERRUPT,
- TIMER_PERIODIC
- };
-
boxer_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_tile_ram(*this, "tile_ram"),
@@ -47,6 +41,11 @@ public:
void boxer(machine_config &config);
protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
+ void boxer_map(address_map &map);
+
uint8_t input_r(offs_t offset);
uint8_t misc_r(offs_t offset);
void bell_w(uint8_t data);
@@ -61,12 +60,6 @@ protected:
TIMER_CALLBACK_MEMBER(periodic_callback);
void draw(bitmap_ind16 &bitmap, const rectangle &cliprect);
- virtual void machine_start() override;
- virtual void machine_reset() override;
- void boxer_map(address_map &map);
-
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
private:
/* memory pointers */
required_shared_ptr<uint8_t> m_tile_ram;
@@ -92,21 +85,6 @@ private:
*
*************************************/
-void boxer_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch(id)
- {
- case TIMER_POT_INTERRUPT:
- pot_interrupt(param);
- break;
- case TIMER_PERIODIC:
- periodic_callback(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in boxer_state::device_timer");
- }
-}
-
TIMER_CALLBACK_MEMBER(boxer_state::pot_interrupt)
{
int mask = param;
@@ -475,8 +453,8 @@ GFXDECODE_END
void boxer_state::machine_start()
{
m_leds.resolve();
- m_pot_interrupt = timer_alloc(TIMER_POT_INTERRUPT);
- m_periodic_timer = timer_alloc(TIMER_PERIODIC);
+ m_pot_interrupt = timer_alloc(FUNC(boxer_state::pot_interrupt), this);
+ m_periodic_timer = timer_alloc(FUNC(boxer_state::periodic_callback), this);
save_item(NAME(m_pot_state));
save_item(NAME(m_pot_latch));
diff --git a/src/mame/drivers/btoads.cpp b/src/mame/drivers/btoads.cpp
index 1857e9b4497..cfc28a0b29c 100644
--- a/src/mame/drivers/btoads.cpp
+++ b/src/mame/drivers/btoads.cpp
@@ -37,6 +37,9 @@ void btoads_state::machine_start()
save_item(NAME(m_sound_to_main_ready));
save_item(NAME(m_sound_int_state));
save_pointer(NAME(m_nvram_data), 0x2000);
+
+ m_delayed_sound_timer = timer_alloc(FUNC(btoads_state::delayed_sound), this);
+ m_audio_sync_timer = timer_alloc(FUNC(btoads_state::audio_sync), this);
}
@@ -66,26 +69,20 @@ uint8_t btoads_state::nvram_r(offs_t offset)
*
*************************************/
-void btoads_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(btoads_state::delayed_sound)
{
- switch (id)
- {
- case TIMER_ID_DELAYED_SOUND:
- m_main_to_sound_data = param;
- m_main_to_sound_ready = 1;
- m_audiocpu->signal_interrupt_trigger();
-
- // use a timer to make long transfers faster
- timer_set(attotime::from_usec(50), TIMER_ID_NOP);
- break;
- }
-}
+ m_main_to_sound_data = param;
+ m_main_to_sound_ready = 1;
+ m_audiocpu->signal_interrupt_trigger();
+ // use a timer to make long transfers faster
+ m_audio_sync_timer->adjust(attotime::from_usec(50));
+}
void btoads_state::main_sound_w(offs_t offset, uint16_t data, uint16_t mem_mask)
{
if (ACCESSING_BITS_0_7)
- synchronize(TIMER_ID_DELAYED_SOUND, data & 0xff);
+ m_delayed_sound_timer->adjust(attotime::zero, data & 0xff);
}
diff --git a/src/mame/drivers/bublbobl.cpp b/src/mame/drivers/bublbobl.cpp
index f3e7caca020..782d121a883 100644
--- a/src/mame/drivers/bublbobl.cpp
+++ b/src/mame/drivers/bublbobl.cpp
@@ -806,6 +806,8 @@ MACHINE_START_MEMBER(bublbobl_state,common)
m_sreset_old = CLEAR_LINE;
save_item(NAME(m_video_enable));
save_item(NAME(m_sreset_old));
+
+ m_irq_ack_timer = timer_alloc(FUNC(bublbobl_state::irq_ack), this);
}
MACHINE_RESET_MEMBER(bublbobl_state,common) // things common on both tokio and bubble bobble hw
diff --git a/src/mame/drivers/capbowl.cpp b/src/mame/drivers/capbowl.cpp
index b6be42dbecc..ba198ab2ee2 100644
--- a/src/mame/drivers/capbowl.cpp
+++ b/src/mame/drivers/capbowl.cpp
@@ -535,7 +535,7 @@ INPUT_PORTS_END
void capbowl_base_state::machine_start()
{
- m_update_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(capbowl_base_state::update), this));
+ m_update_timer = timer_alloc(FUNC(capbowl_base_state::update), this);
save_item(NAME(m_last_trackball_val));
}
diff --git a/src/mame/drivers/cat.cpp b/src/mame/drivers/cat.cpp
index c8611469ef8..9abaaf2b50f 100644
--- a/src/mame/drivers/cat.cpp
+++ b/src/mame/drivers/cat.cpp
@@ -242,12 +242,6 @@ namespace {
class cat_state : public driver_device
{
public:
- enum
- {
- TIMER_KEYBOARD,
- TIMER_COUNTER_6MS
- };
-
cat_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
@@ -277,7 +271,6 @@ protected:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
private:
required_device<cpu_device> m_maincpu;
@@ -898,18 +891,6 @@ static INPUT_PORTS_START( cat )
INPUT_PORTS_END
-void cat_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_COUNTER_6MS:
- counter_6ms_callback(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in cat_state::device_timer");
- }
-}
-
TIMER_CALLBACK_MEMBER(cat_state::counter_6ms_callback)
{
// This is effectively also the KTOBF (guessed: acronym for "Keyboard Timer Out Bit Flip")
@@ -935,7 +916,7 @@ void cat_state::machine_start()
m_wdt_counter = 0;
m_video_enable = 1;
m_video_invert = 0;
- m_6ms_timer = timer_alloc(TIMER_COUNTER_6MS);
+ m_6ms_timer = timer_alloc(FUNC(cat_state::counter_6ms_callback), this);
subdevice<nvram_device>("nvram")->set_base(m_svram, 0x4000);
}
diff --git a/src/mame/drivers/cave.cpp b/src/mame/drivers/cave.cpp
index 368b3d14d97..3bed3f529f2 100644
--- a/src/mame/drivers/cave.cpp
+++ b/src/mame/drivers/cave.cpp
@@ -2033,7 +2033,7 @@ GFXDECODE_END
void cave_state::machine_start()
{
m_led_outputs.resolve();
- m_vblank_end_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(cave_state::vblank_end), this));
+ m_vblank_end_timer = timer_alloc(FUNC(cave_state::vblank_end), this);
save_item(NAME(m_soundbuf_wptr));
save_item(NAME(m_soundbuf_rptr));
diff --git a/src/mame/drivers/cball.cpp b/src/mame/drivers/cball.cpp
index 99ea2c8541e..2b24dd6c626 100644
--- a/src/mame/drivers/cball.cpp
+++ b/src/mame/drivers/cball.cpp
@@ -16,11 +16,6 @@
class cball_state : public driver_device
{
public:
- enum
- {
- TIMER_INTERRUPT
- };
-
cball_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
@@ -60,8 +55,6 @@ public:
void cball(machine_config &config);
void cpu_map(address_map &map);
-protected:
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
};
@@ -102,19 +95,6 @@ uint32_t cball_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap,
}
-void cball_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_INTERRUPT:
- interrupt_callback(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in cball_state::device_timer");
- }
-}
-
-
TIMER_CALLBACK_MEMBER(cball_state::interrupt_callback)
{
int scanline = param;
@@ -132,7 +112,7 @@ TIMER_CALLBACK_MEMBER(cball_state::interrupt_callback)
void cball_state::machine_start()
{
- m_int_timer = timer_alloc(TIMER_INTERRUPT);
+ m_int_timer = timer_alloc(FUNC(cball_state::interrupt_callback), this);
}
void cball_state::machine_reset()
diff --git a/src/mame/drivers/cbm2.cpp b/src/mame/drivers/cbm2.cpp
index 48f9a1874cc..021dbfa8779 100644
--- a/src/mame/drivers/cbm2.cpp
+++ b/src/mame/drivers/cbm2.cpp
@@ -139,7 +139,7 @@ public:
required_ioport_array<8> m_pb;
required_ioport m_lock;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER( tod_tick );
DECLARE_MACHINE_START( cbm2 );
DECLARE_MACHINE_START( cbm2_ntsc );
@@ -2043,10 +2043,10 @@ void cbm2_state::ext_cia_pb_w(uint8_t data)
//**************************************************************************
//-------------------------------------------------
-// device_timer - handler timer events
+// tod_tick - advance the TOD clock
//-------------------------------------------------
-void cbm2_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(cbm2_state::tod_tick)
{
m_tpi1->i0_w(m_todclk);
@@ -2065,7 +2065,7 @@ MACHINE_START_MEMBER( cbm2_state, cbm2 )
// allocate timer
int todclk = (m_ntsc ? 60 : 50) * 2;
- m_todclk_timer = timer_alloc();
+ m_todclk_timer = timer_alloc(FUNC(cbm2_state::tod_tick), this);
m_todclk_timer->adjust(attotime::from_hz(todclk), 0, attotime::from_hz(todclk));
// state saving
diff --git a/src/mame/drivers/ccastles.cpp b/src/mame/drivers/ccastles.cpp
index b6c2b02f545..e31d09f0047 100644
--- a/src/mame/drivers/ccastles.cpp
+++ b/src/mame/drivers/ccastles.cpp
@@ -215,7 +215,7 @@ void ccastles_state::machine_start()
membank("bank1")->configure_entries(0, 2, memregion("maincpu")->base() + 0xa000, 0x6000);
/* create a timer for IRQs and set up the first callback */
- m_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ccastles_state::clock_irq),this));
+ m_irq_timer = timer_alloc(FUNC(ccastles_state::clock_irq), this);
m_irq_state = 0;
schedule_next_irq(0);
diff --git a/src/mame/drivers/cchasm.cpp b/src/mame/drivers/cchasm.cpp
index 920a7d21c02..a67396c9923 100644
--- a/src/mame/drivers/cchasm.cpp
+++ b/src/mame/drivers/cchasm.cpp
@@ -59,15 +59,10 @@ public:
INPUT_CHANGED_MEMBER(set_coin_flag);
protected:
- enum
- {
- TIMER_REFRESH_END
- };
-
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
virtual void machine_start() override;
+ TIMER_CALLBACK_MEMBER(refresh_end);
+
private:
required_device<cpu_device> m_maincpu;
required_device<z80ctc_device> m_ctc;
@@ -319,16 +314,9 @@ WRITE_LINE_MEMBER(cchasm_state::ctc_timer_2_w)
}
-void cchasm_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(cchasm_state::refresh_end)
{
- switch (id)
- {
- case TIMER_REFRESH_END:
- m_maincpu->set_input_line(2, ASSERT_LINE);
- break;
- default:
- throw emu_fatalerror("Unknown id in cchasm_state::device_timer");
- }
+ m_maincpu->set_input_line(2, ASSERT_LINE);
}
@@ -437,7 +425,7 @@ void cchasm_state::machine_start()
m_xcenter = visarea.xcenter() << 16;
m_ycenter = visarea.ycenter() << 16;
- m_refresh_end_timer = timer_alloc(TIMER_REFRESH_END);
+ m_refresh_end_timer = timer_alloc(FUNC(cchasm_state::refresh_end), this);
m_coin_flag = 0;
m_sound_flags = 0;
diff --git a/src/mame/drivers/cgang.cpp b/src/mame/drivers/cgang.cpp
index fd3f42c719c..ea0f38afac3 100644
--- a/src/mame/drivers/cgang.cpp
+++ b/src/mame/drivers/cgang.cpp
@@ -203,7 +203,7 @@ private:
void cgang_state::machine_start()
{
for (int i = 0; i < 5; i++)
- m_sol_filter[i] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(cgang_state::output_sol),this));
+ m_sol_filter[i] = timer_alloc(FUNC(cgang_state::output_sol), this);
// resolve outputs
m_gun_lamps.resolve();
diff --git a/src/mame/drivers/chexx.cpp b/src/mame/drivers/chexx.cpp
index 8bfc66cc97f..1253d835c9f 100644
--- a/src/mame/drivers/chexx.cpp
+++ b/src/mame/drivers/chexx.cpp
@@ -126,14 +126,7 @@ public:
void mem(address_map &map);
protected:
- enum
- {
- TIMER_UPDATE
- };
-
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
- void update();
+ TIMER_CALLBACK_MEMBER(update);
// digitalker
void digitalker_set_bank(uint8_t bank);
@@ -283,16 +276,6 @@ void chexx_state::mem(address_map &map)
map(0xf800, 0xffff).rom().region("maincpu", 0);
}
-void chexx_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_UPDATE:
- update();
- break;
- }
-}
-
void chexx_state::lamp_w(uint8_t data)
{
m_lamp = data;
@@ -373,7 +356,7 @@ void chexx_state::machine_start()
m_leds.resolve();
m_lamps.resolve();
- m_update_timer = timer_alloc(TIMER_UPDATE);
+ m_update_timer = timer_alloc(FUNC(chexx_state::update), this);
}
void chexx_state::digitalker_set_bank(uint8_t bank)
@@ -396,7 +379,7 @@ void chexx_state::machine_reset()
m_update_timer->adjust(attotime::from_hz(60), 0, attotime::from_hz(60));
}
-void chexx_state::update()
+TIMER_CALLBACK_MEMBER(chexx_state::update)
{
// NMI on coin-in
uint8_t coin = (~m_coin->read()) & 0x03;
diff --git a/src/mame/drivers/cidelsa.cpp b/src/mame/drivers/cidelsa.cpp
index 8a18ee987cb..2624f148781 100644
--- a/src/mame/drivers/cidelsa.cpp
+++ b/src/mame/drivers/cidelsa.cpp
@@ -356,16 +356,9 @@ INPUT_PORTS_END
/* Machine Start */
-void cidelsa_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(cidelsa_state::reset_done)
{
- switch (id)
- {
- case TIMER_SET_CPU_MODE:
- m_reset = 1;
- break;
- default:
- throw emu_fatalerror("Unknown id in cidelsa_state::device_timer");
- }
+ m_reset = 1;
}
void cidelsa_state::machine_start()
@@ -374,6 +367,8 @@ void cidelsa_state::machine_start()
/* register for state saving */
save_item(NAME(m_reset));
+
+ m_reset_timer = timer_alloc(FUNC(cidelsa_state::reset_done), this);
}
void draco_state::machine_start()
@@ -395,7 +390,7 @@ void cidelsa_state::machine_reset()
{
/* reset the CPU */
m_reset = 0;
- timer_set(attotime::from_msec(200), TIMER_SET_CPU_MODE);
+ m_reset_timer->adjust(attotime::from_msec(200));
}
/* Machine Drivers */
diff --git a/src/mame/drivers/clayshoo.cpp b/src/mame/drivers/clayshoo.cpp
index 05fa46ff7d5..22aaf533664 100644
--- a/src/mame/drivers/clayshoo.cpp
+++ b/src/mame/drivers/clayshoo.cpp
@@ -153,8 +153,8 @@ uint8_t clayshoo_state::analog_r()
void clayshoo_state::create_analog_timers( )
{
- m_analog_timer_1 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(clayshoo_state::reset_analog_bit),this));
- m_analog_timer_2 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(clayshoo_state::reset_analog_bit),this));
+ m_analog_timer_1 = timer_alloc(FUNC(clayshoo_state::reset_analog_bit), this);
+ m_analog_timer_2 = timer_alloc(FUNC(clayshoo_state::reset_analog_bit), this);
}
diff --git a/src/mame/drivers/clickstart.cpp b/src/mame/drivers/clickstart.cpp
index ac11809785e..495fccfcb75 100644
--- a/src/mame/drivers/clickstart.cpp
+++ b/src/mame/drivers/clickstart.cpp
@@ -101,10 +101,6 @@ public:
DECLARE_INPUT_CHANGED_MEMBER(key_update);
private:
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
- static const device_timer_id TIMER_UART_TX = 0;
-
virtual void machine_start() override;
virtual void machine_reset() override;
@@ -123,7 +119,7 @@ private:
void chip_sel_w(uint8_t data);
- void handle_uart_tx();
+ TIMER_CALLBACK_MEMBER(handle_uart_tx);
void uart_tx_fifo_push(uint8_t value);
void update_mouse_buffer();
@@ -174,7 +170,7 @@ void clickstart_state::machine_start()
save_item(NAME(m_unk_portc_toggle));
- m_uart_tx_timer = timer_alloc(TIMER_UART_TX);
+ m_uart_tx_timer = timer_alloc(FUNC(clickstart_state::handle_uart_tx), this);
m_uart_tx_timer->adjust(attotime::never);
}
@@ -205,15 +201,7 @@ DEVICE_IMAGE_LOAD_MEMBER(clickstart_state::cart_load)
return image_init_result::PASS;
}
-void clickstart_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- if (id == TIMER_UART_TX)
- {
- handle_uart_tx();
- }
-}
-
-void clickstart_state::handle_uart_tx()
+TIMER_CALLBACK_MEMBER(clickstart_state::handle_uart_tx)
{
if (m_uart_tx_fifo_count == 0)
return;
diff --git a/src/mame/drivers/cliffhgr.cpp b/src/mame/drivers/cliffhgr.cpp
index a6998b477de..05bc7555b96 100644
--- a/src/mame/drivers/cliffhgr.cpp
+++ b/src/mame/drivers/cliffhgr.cpp
@@ -235,7 +235,7 @@ TIMER_CALLBACK_MEMBER(cliffhgr_state::irq_callback)
void cliffhgr_state::machine_start()
{
m_led.resolve();
- m_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(cliffhgr_state::irq_callback),this));
+ m_irq_timer = timer_alloc(FUNC(cliffhgr_state::irq_callback), this);
save_item(NAME(m_port_bank));
save_item(NAME(m_philips_code));
diff --git a/src/mame/drivers/cloud9.cpp b/src/mame/drivers/cloud9.cpp
index fb28a5eca59..d4ef47dca59 100644
--- a/src/mame/drivers/cloud9.cpp
+++ b/src/mame/drivers/cloud9.cpp
@@ -183,7 +183,7 @@ void cloud9_state::machine_start()
m_screen->configure(320, 256, visarea, HZ_TO_ATTOSECONDS(PIXEL_CLOCK) * VTOTAL * HTOTAL);
/* create a timer for IRQs and set up the first callback */
- m_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(cloud9_state::clock_irq),this));
+ m_irq_timer = timer_alloc(FUNC(cloud9_state::clock_irq), this);
m_irq_state = 0;
schedule_next_irq(0-64);
diff --git a/src/mame/drivers/cmi.cpp b/src/mame/drivers/cmi.cpp
index 9f42eef286a..aaecd61bb13 100644
--- a/src/mame/drivers/cmi.cpp
+++ b/src/mame/drivers/cmi.cpp
@@ -224,15 +224,10 @@ public:
{
}
- void set_interrupt(int cpunum, int level, int state);
-
virtual void machine_reset() override;
virtual void machine_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
- static const device_timer_id TIMER_MAP_SWITCH = 0;
- static const device_timer_id TIMER_HBLANK = 1;
- static const device_timer_id TIMER_JAM_TIMEOUT = 2;
+ void set_interrupt(int cpunum, int level, int state);
void init_cmi2x();
@@ -413,11 +408,13 @@ private:
uint8_t m_video_data = 0;
// Memory
+ TIMER_CALLBACK_MEMBER(switch_map);
+ TIMER_CALLBACK_MEMBER(jam_timeout);
bool map_is_active(int cpunum, int map, uint8_t *map_info);
void update_address_space(int cpunum, uint8_t mapinfo);
// Video
- void hblank();
+ TIMER_CALLBACK_MEMBER(hblank);
template <int Y, int X, bool ByteSize> void update_video_pos();
// Floppy
@@ -514,7 +511,7 @@ uint32_t cmi_state::screen_update_cmi2x(screen_device &screen, bitmap_rgb32 &bit
return 0;
}
-void cmi_state::hblank()
+TIMER_CALLBACK_MEMBER(cmi_state::hblank)
{
int v = m_screen->vpos();
@@ -964,30 +961,20 @@ template<int cpunum> void cmi_state::irq_ram_w(offs_t offset, uint8_t data)
m_scratch_ram[cpunum][0xf8 + offset] = data;
}
-void cmi_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(cmi_state::switch_map)
{
- switch (id)
- {
- case TIMER_MAP_SWITCH:
- {
- m_cpu_active_space[param] = m_cpu_map_switch[param];
- uint8_t map_info = (m_cpu_map_switch[param] == MAPPING_A) ?
- m_map_sel[param ? MAPSEL_P2_A : MAPSEL_P1_A] :
- m_map_sel[param ? MAPSEL_P2_B : MAPSEL_P1_B];
- update_address_space(param, map_info);
- m_map_switch_timer->adjust(attotime::never);
- break;
- }
-
- case TIMER_HBLANK:
- hblank();
- break;
+ m_cpu_active_space[param] = m_cpu_map_switch[param];
+ uint8_t map_info = (m_cpu_map_switch[param] == MAPPING_A) ?
+ m_map_sel[param ? MAPSEL_P2_A : MAPSEL_P1_A] :
+ m_map_sel[param ? MAPSEL_P2_B : MAPSEL_P1_B];
+ update_address_space(param, map_info);
+ m_map_switch_timer->adjust(attotime::never);
+}
- case TIMER_JAM_TIMEOUT:
- m_maincpu2->set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
- m_jam_timeout_timer->adjust(attotime::never);
- break;
- }
+TIMER_CALLBACK_MEMBER(cmi_state::jam_timeout)
+{
+ m_maincpu2->set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
+ m_jam_timeout_timer->adjust(attotime::never);
}
uint8_t cmi_state::atomic_r()
@@ -2066,9 +2053,9 @@ void cmi_state::machine_start()
m_q133_rom = (uint8_t *)m_q133_region->base();
// allocate timers for the built-in two channel timer
- m_map_switch_timer = timer_alloc(TIMER_MAP_SWITCH);
- m_hblank_timer = timer_alloc(TIMER_HBLANK);
- m_jam_timeout_timer = timer_alloc(TIMER_JAM_TIMEOUT);
+ m_map_switch_timer = timer_alloc(FUNC(cmi_state::switch_map), this);
+ m_hblank_timer = timer_alloc(FUNC(cmi_state::hblank), this);
+ m_jam_timeout_timer = timer_alloc(FUNC(cmi_state::jam_timeout), this);
m_map_switch_timer->adjust(attotime::never);
m_hblank_timer->adjust(attotime::never);
diff --git a/src/mame/drivers/coleco.cpp b/src/mame/drivers/coleco.cpp
index 57fde86a123..9d3f8e53f44 100644
--- a/src/mame/drivers/coleco.cpp
+++ b/src/mame/drivers/coleco.cpp
@@ -511,9 +511,9 @@ void coleco_state::machine_start()
// init paddles
for (int port = 0; port < 2; port++)
{
- m_joy_pulse_timer[port] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(coleco_state::paddle_pulse_callback),this));
- m_joy_d7_timer[port] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(coleco_state::paddle_d7reset_callback),this));
- m_joy_irq_timer[port] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(coleco_state::paddle_irqreset_callback),this));
+ m_joy_pulse_timer[port] = timer_alloc(FUNC(coleco_state::paddle_pulse_callback), this);
+ m_joy_d7_timer[port] = timer_alloc(FUNC(coleco_state::paddle_d7reset_callback), this);
+ m_joy_irq_timer[port] = timer_alloc(FUNC(coleco_state::paddle_irqreset_callback), this);
m_joy_irq_state[port] = 0;
m_joy_d7_state[port] = 0;
diff --git a/src/mame/drivers/comx35.cpp b/src/mame/drivers/comx35.cpp
index 7b729a18cbb..f54f82cb915 100644
--- a/src/mame/drivers/comx35.cpp
+++ b/src/mame/drivers/comx35.cpp
@@ -540,22 +540,17 @@ WRITE_LINE_MEMBER( comx35_state::irq_w )
//**************************************************************************
//-------------------------------------------------
-// device_timer - handler timer events
+// reset_done - flag that reset is complete
//-------------------------------------------------
-void comx35_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(comx35_state::reset_done)
{
- switch (id)
- {
- case TIMER_ID_RESET:
- m_clear = 1;
- break;
- }
+ m_clear = 1;
}
//-------------------------------------------------
-// MACHINE_START( comx35 )
+// machine_start
//-------------------------------------------------
void comx35_state::machine_start()
@@ -572,6 +567,8 @@ void comx35_state::machine_start()
save_item(NAME(m_int));
save_item(NAME(m_prd));
save_item(NAME(m_cr1));
+
+ m_reset_done_timer = timer_alloc(FUNC(comx35_state::reset_done), this);
}
@@ -587,7 +584,7 @@ void comx35_state::machine_reset()
m_int = CLEAR_LINE;
m_prd = CLEAR_LINE;
- timer_set(attotime::from_msec(t), TIMER_ID_RESET);
+ m_reset_done_timer->adjust(attotime::from_msec(t));
}
diff --git a/src/mame/drivers/cops.cpp b/src/mame/drivers/cops.cpp
index ac23064fdf7..e118dd5ce89 100644
--- a/src/mame/drivers/cops.cpp
+++ b/src/mame/drivers/cops.cpp
@@ -876,7 +876,7 @@ void cops_state::machine_start()
{
m_digits.resolve();
- m_ld_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(cops_state::ld_timer_callback),this));
+ m_ld_timer = timer_alloc(FUNC(cops_state::ld_timer_callback), this);
m_ld_timer->adjust(attotime::from_hz(167*5), 0, attotime::from_hz(167*5));
diff --git a/src/mame/drivers/cps2.cpp b/src/mame/drivers/cps2.cpp
index 36553d9ee2a..6e7a2cafcc2 100644
--- a/src/mame/drivers/cps2.cpp
+++ b/src/mame/drivers/cps2.cpp
@@ -10753,7 +10753,7 @@ void cps2_state::init_digital_volume()
m_cps2disabledigitalvolume = 0;
// create a timer to update our volume state from the fake switches - read it every 6 frames or so to enable some granularity
- m_digital_volume_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(cps2_state::cps2_update_digital_volume), this));
+ m_digital_volume_timer = timer_alloc(FUNC(cps2_state::cps2_update_digital_volume), this);
m_digital_volume_timer->adjust(attotime::from_msec(100), 0, attotime::from_msec(100));
}
diff --git a/src/mame/drivers/cvs.cpp b/src/mame/drivers/cvs.cpp
index e1b9d5d4af6..11ea09a25c9 100644
--- a/src/mame/drivers/cvs.cpp
+++ b/src/mame/drivers/cvs.cpp
@@ -296,7 +296,7 @@ TIMER_CALLBACK_MEMBER(cvs_state::cvs_393hz_timer_cb)
void cvs_state::start_393hz_timer()
{
- m_cvs_393hz_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(cvs_state::cvs_393hz_timer_cb),this));
+ m_cvs_393hz_timer = timer_alloc(FUNC(cvs_state::cvs_393hz_timer_cb), this);
m_cvs_393hz_timer->adjust(attotime::from_hz(30*393), 0, attotime::from_hz(30*393));
}
diff --git a/src/mame/drivers/cxhumax.cpp b/src/mame/drivers/cxhumax.cpp
index a7d9f7c9054..40123dbf8de 100644
--- a/src/mame/drivers/cxhumax.cpp
+++ b/src/mame/drivers/cxhumax.cpp
@@ -986,7 +986,7 @@ void cxhumax_state::machine_start()
int index = 0;
for(index = 0; index < MAX_CX_TIMERS; index++)
{
- m_timer_regs.timer[index].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(cxhumax_state::timer_tick),this));
+ m_timer_regs.timer[index].timer = timer_alloc(FUNC(cxhumax_state::timer_tick), this);
m_timer_regs.timer[index].timer->adjust(attotime::never, index);
}
}
diff --git a/src/mame/drivers/dcheese.cpp b/src/mame/drivers/dcheese.cpp
index 403b1ecc2f3..eab2aaddf15 100644
--- a/src/mame/drivers/dcheese.cpp
+++ b/src/mame/drivers/dcheese.cpp
@@ -72,9 +72,9 @@ u8 dcheese_state::iack_r(offs_t offset)
}
-void dcheese_state::signal_irq(u8 which)
+TIMER_CALLBACK_MEMBER(dcheese_state::signal_irq)
{
- m_irq_state[which] = 1;
+ m_irq_state[param] = 1;
update_irq_state();
}
diff --git a/src/mame/drivers/dec8.cpp b/src/mame/drivers/dec8.cpp
index c85e0d1598b..f60ba7336d9 100644
--- a/src/mame/drivers/dec8.cpp
+++ b/src/mame/drivers/dec8.cpp
@@ -128,27 +128,22 @@ uint8_t dec8_state::gondo_player_2_r(offs_t offset)
/***************************************************
*
-* Hook-up for games that we have a proper MCU dump.
+* Hook-up for games that have a proper MCU dump.
*
***************************************************/
-void dec8_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(dec8_state::mcu_irq_clear)
{
- switch (id)
- {
- case TIMER_DEC8_I8751:
- // The schematics show a clocked LS194 shift register (3A) is used to automatically
- // clear the IRQ request. The MCU does not clear it itself.
- m_mcu->set_input_line(MCS51_INT1_LINE, CLEAR_LINE);
- break;
- case TIMER_DEC8_M6502:
- // Gondomania schematics show a LS194 for the sound IRQ, sharing the 6502 clock
- // S1=H, S0=L, LSI=H, and QA is the only output connected (to NMI)
- m_audiocpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
- break;
- default:
- throw emu_fatalerror("Unknown id in dec8_state::device_timer");
- }
+ // The schematics show a clocked LS194 shift register (3A) is used to automatically
+ // clear the IRQ request. The MCU does not clear it itself.
+ m_mcu->set_input_line(MCS51_INT1_LINE, CLEAR_LINE);
+}
+
+TIMER_CALLBACK_MEMBER(dec8_state::audiocpu_nmi_clear)
+{
+ // Gondomania schematics show a LS194 for the sound IRQ, sharing the 6502 clock
+ // S1=H, S0=L, LSI=H, and QA is the only output connected (to NMI)
+ m_audiocpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
}
void dec8_state::dec8_i8751_w(offs_t offset, uint8_t data)
@@ -1796,8 +1791,8 @@ void dec8_state::machine_start()
uint32_t max_bank = (memregion("maincpu")->bytes() - 0x10000) / 0x4000;
m_mainbank->configure_entries(0, max_bank, &ROM[0x10000], 0x4000);
- m_i8751_timer = timer_alloc(TIMER_DEC8_I8751);
- m_m6502_timer = timer_alloc(TIMER_DEC8_M6502);
+ m_i8751_timer = timer_alloc(FUNC(dec8_state::mcu_irq_clear), this);
+ m_m6502_timer = timer_alloc(FUNC(dec8_state::audiocpu_nmi_clear), this);
m_i8751_p2 = 0xff;
m_latch = 0;
diff --git a/src/mame/drivers/dectalk.cpp b/src/mame/drivers/dectalk.cpp
index 0f4991f3a26..f52b04d6899 100644
--- a/src/mame/drivers/dectalk.cpp
+++ b/src/mame/drivers/dectalk.cpp
@@ -264,11 +264,6 @@ public:
void dectalk(machine_config &config);
private:
- enum
- {
- TIMER_OUTFIFO_READ
- };
-
// input fifo, between m68k and tms32010
uint16_t m_infifo[32]{}; // technically eight 74LS224 4bit*16stage FIFO chips, arranged as a 32 stage, 16-bit wide fifo
uint8_t m_infifo_count = 0;
@@ -325,8 +320,6 @@ private:
void m68k_mem(address_map &map);
void tms32010_io(address_map &map);
void tms32010_mem(address_map &map);
-
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
};
@@ -449,7 +442,7 @@ WRITE_LINE_MEMBER(dectalk_state::dectalk_reset)
void dectalk_state::machine_start()
{
- m_outfifo_read_timer = timer_alloc(TIMER_OUTFIFO_READ);
+ m_outfifo_read_timer = timer_alloc(FUNC(dectalk_state::outfifo_read_cb), this);
m_outfifo_read_timer->adjust(attotime::from_hz(10000));
save_item(NAME(m_infifo));
save_item(NAME(m_infifo_count));
@@ -839,17 +832,6 @@ INPUT_PORTS_END
/******************************************************************************
Machine Drivers
******************************************************************************/
-void dectalk_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_OUTFIFO_READ:
- outfifo_read_cb(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in dectalk_state::device_timer");
- }
-}
TIMER_CALLBACK_MEMBER(dectalk_state::outfifo_read_cb)
{
diff --git a/src/mame/drivers/destroyr.cpp b/src/mame/drivers/destroyr.cpp
index 4120b27e342..62561c2a314 100644
--- a/src/mame/drivers/destroyr.cpp
+++ b/src/mame/drivers/destroyr.cpp
@@ -56,10 +56,6 @@ public:
private:
virtual void machine_start() override;
virtual void machine_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
- static const device_timer_id TIMER_DIAL = 0;
- static const device_timer_id TIMER_FRAME = 1;
void main_map(address_map &map);
@@ -180,22 +176,6 @@ uint32_t destroyr_state::screen_update(screen_device &screen, bitmap_ind16 &bitm
}
-void destroyr_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_DIAL:
- dial_callback(param);
- break;
- case TIMER_FRAME:
- frame_callback(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in destroyr_state::device_timer");
- }
-}
-
-
TIMER_CALLBACK_MEMBER(destroyr_state::dial_callback)
{
int dial = param;
@@ -476,8 +456,8 @@ void destroyr_state::palette_init(palette_device &palette) const
void destroyr_state::machine_start()
{
- m_dial_timer = timer_alloc(TIMER_DIAL);
- m_frame_timer = timer_alloc(TIMER_FRAME);
+ m_dial_timer = timer_alloc(FUNC(destroyr_state::dial_callback), this);
+ m_frame_timer = timer_alloc(FUNC(destroyr_state::frame_callback), this);
save_item(NAME(m_cursor));
save_item(NAME(m_wavemod));
diff --git a/src/mame/drivers/dpb7000.cpp b/src/mame/drivers/dpb7000.cpp
index 2e5f59c96f5..d56bf759739 100644
--- a/src/mame/drivers/dpb7000.cpp
+++ b/src/mame/drivers/dpb7000.cpp
@@ -111,16 +111,9 @@ public:
private:
virtual void machine_start() override;
virtual void machine_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
template <int StoreNum> uint32_t store_screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
- static constexpr device_timer_id TIMER_DISKSEQ_COMPLETE = 0;
- static constexpr device_timer_id TIMER_FIELD_IN = 1;
- static constexpr device_timer_id TIMER_FIELD_OUT = 2;
- static constexpr device_timer_id TIMER_TABLET_TX = 3;
- static constexpr device_timer_id TIMER_TABLET_IRQ = 4;
-
void main_map(address_map &map);
void fddcpu_map(address_map &map);
void keybcpu_map(address_map &map);
@@ -152,6 +145,10 @@ private:
void store_address_w(uint8_t card, uint16_t data);
void combiner_reg_w(uint16_t data);
+ TIMER_CALLBACK_MEMBER(diskseq_complete);
+ TIMER_CALLBACK_MEMBER(field_in);
+ TIMER_CALLBACK_MEMBER(field_out);
+
enum : uint16_t
{
SYSCTRL_AUTO_START = 0x0001,
@@ -361,7 +358,7 @@ private:
uint8_t tds_adc_r();
uint8_t tds_pen_switches_r();
DECLARE_WRITE_LINE_MEMBER(duart_b_w);
- void tablet_tx_tick();
+ TIMER_CALLBACK_MEMBER(tablet_tx_tick);
uint8_t m_tds_dac_value;
uint8_t m_tds_adc_value;
uint8_t m_tds_p1_data;
@@ -376,7 +373,7 @@ private:
void tablet_p2_w(offs_t offset, uint8_t data, uint8_t mem_mask);
uint8_t tablet_p3_r(offs_t offset, uint8_t mem_mask);
void tablet_p3_w(offs_t offset, uint8_t data, uint8_t mem_mask);
- void tablet_irq_tick();
+ TIMER_CALLBACK_MEMBER(tablet_irq_tick);
uint8_t tablet_rdl_r();
uint8_t tablet_rdh_r();
uint8_t m_tablet_p2_data;
@@ -757,10 +754,10 @@ void dpb7000_state::machine_start()
save_item(NAME(m_csr));
save_item(NAME(m_sys_ctrl));
- m_field_in_clk = timer_alloc(TIMER_FIELD_IN);
+ m_field_in_clk = timer_alloc(FUNC(dpb7000_state::field_in), this);
m_field_in_clk->adjust(attotime::never);
- m_field_out_clk = timer_alloc(TIMER_FIELD_OUT);
+ m_field_out_clk = timer_alloc(FUNC(dpb7000_state::field_out), this);
m_field_out_clk->adjust(attotime::never);
// Disc Sequencer Card
@@ -780,7 +777,7 @@ void dpb7000_state::machine_start()
save_item(NAME(m_diskseq_ucode_latch));
save_item(NAME(m_diskseq_cc_inputs));
save_item(NAME(m_diskseq_cyl_read_pending));
- m_diskseq_complete_clk = timer_alloc(TIMER_DISKSEQ_COMPLETE);
+ m_diskseq_complete_clk = timer_alloc(FUNC(dpb7000_state::diskseq_complete), this);
m_diskseq_complete_clk->adjust(attotime::never);
// Floppy Disc Controller Card
@@ -894,9 +891,9 @@ void dpb7000_state::machine_start()
save_item(NAME(m_tablet_tx_bit));
save_item(NAME(m_tablet_pen_in_proximity));
save_item(NAME(m_tablet_state));
- m_tablet_tx_timer = timer_alloc(TIMER_TABLET_TX);
+ m_tablet_tx_timer = timer_alloc(FUNC(dpb7000_state::tablet_tx_tick), this);
m_tablet_tx_timer->adjust(attotime::never);
- m_tablet_irq_timer = timer_alloc(TIMER_TABLET_IRQ);
+ m_tablet_irq_timer = timer_alloc(FUNC(dpb7000_state::tablet_irq_tick), this);
m_tablet_irq_timer->adjust(attotime::never);
m_yuv_lut = std::make_unique<uint32_t[]>(0x1000000);
@@ -1062,18 +1059,19 @@ void dpb7000_state::machine_reset()
m_tablet_state = 0;
}
-void dpb7000_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(dpb7000_state::diskseq_complete)
{
- if (id == TIMER_DISKSEQ_COMPLETE)
- req_b_w(1);
- else if (id == TIMER_FIELD_IN)
- req_a_w(1);
- else if (id == TIMER_FIELD_OUT)
- req_a_w(0);
- else if (id == TIMER_TABLET_TX)
- tablet_tx_tick();
- else if (id == TIMER_TABLET_IRQ)
- tablet_irq_tick();
+ req_b_w(1);
+}
+
+TIMER_CALLBACK_MEMBER(dpb7000_state::field_in)
+{
+ req_a_w(1);
+}
+
+TIMER_CALLBACK_MEMBER(dpb7000_state::field_out)
+{
+ req_a_w(0);
}
MC6845_UPDATE_ROW(dpb7000_state::crtc_update_row)
@@ -2243,7 +2241,7 @@ uint8_t dpb7000_state::tds_pen_switches_r()
return data;
}
-void dpb7000_state::tablet_tx_tick()
+TIMER_CALLBACK_MEMBER(dpb7000_state::tablet_tx_tick)
{
m_tds_duart->rx_b_w(m_tablet_tx_bit);
}
@@ -2345,7 +2343,7 @@ void dpb7000_state::tablet_p2_w(offs_t offset, uint8_t data, uint8_t mem_mask)
}
}
-void dpb7000_state::tablet_irq_tick()
+TIMER_CALLBACK_MEMBER(dpb7000_state::tablet_irq_tick)
{
LOGMASKED(LOG_TABLET, "Triggering tablet CPU IRQ\n");
m_tablet_cpu->set_input_line(INPUT_LINE_IRQ1, ASSERT_LINE);
diff --git a/src/mame/drivers/dvk_kcgd.cpp b/src/mame/drivers/dvk_kcgd.cpp
index e1362e4a281..e0564c892f0 100644
--- a/src/mame/drivers/dvk_kcgd.cpp
+++ b/src/mame/drivers/dvk_kcgd.cpp
@@ -89,15 +89,14 @@ public:
private:
virtual void machine_reset() override;
virtual void machine_start() override;
+
+ //TIMER_CALLBACK_MEMBER(vsync_tick);
+ TIMER_CALLBACK_MEMBER(toggle_500hz);
+
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(scanline_callback);
void kcgd_palette(palette_device &palette) const;
- enum timer_ids : unsigned
- {
- TIMER_ID_VSYNC,
- TIMER_ID_500HZ
- };
enum status_bits : unsigned
{
KCGD_STATUS_PAGE = 0,
@@ -108,8 +107,6 @@ private:
KCGD_STATUS_TIMER_VAL = 15
};
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
uint16_t vram_addr_r();
uint16_t vram_data_r();
uint16_t vram_mmap_r(offs_t offset);
@@ -187,19 +184,16 @@ static DEVICE_INPUT_DEFAULTS_START( host_rs232_defaults )
DEVICE_INPUT_DEFAULTS_END
-void kcgd_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
/*
- case TIMER_ID_VSYNC:
- m_maincpu->set_input_line(INPUT_LINE_EVNT, ASSERT_LINE);
- break;
+TIMER_CALLBACK_MEMBER(kcgd_state::vsync_tick)
+{
+ m_maincpu->set_input_line(INPUT_LINE_EVNT, ASSERT_LINE);
+}
*/
- case TIMER_ID_500HZ:
- m_video.status ^= (1 << KCGD_STATUS_TIMER_VAL);
- break;
- }
+
+TIMER_CALLBACK_MEMBER(kcgd_state::toggle_500hz)
+{
+ m_video.status ^= (1 << KCGD_STATUS_TIMER_VAL);
}
void kcgd_state::machine_reset()
@@ -215,9 +209,9 @@ void kcgd_state::machine_start()
m_tmpclip = rectangle(0, KCGD_DISP_HORZ - 1, 0, KCGD_DISP_VERT - 1);
m_tmpbmp.allocate(KCGD_DISP_HORZ, KCGD_DISP_VERT);
// future
-// m_vsync_on_timer = timer_alloc(TIMER_ID_VSYNC);
+// m_vsync_on_timer = timer_alloc(FUNC(kcgd_state::vsync_tick), this);
// m_vsync_on_timer->adjust(m_screen->time_until_pos(0, 0), 0, m_screen->frame_period());
- m_500hz_timer = timer_alloc(TIMER_ID_500HZ);
+ m_500hz_timer = timer_alloc(FUNC(kcgd_state::toggle_500hz), this);
m_500hz_timer->adjust(attotime::from_hz(500), 0, attotime::from_hz(500));
}
diff --git a/src/mame/drivers/dvk_ksm.cpp b/src/mame/drivers/dvk_ksm.cpp
index 0a558016f64..16bf05ad422 100644
--- a/src/mame/drivers/dvk_ksm.cpp
+++ b/src/mame/drivers/dvk_ksm.cpp
@@ -116,7 +116,7 @@ private:
virtual void machine_start() override;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(clock_brg);
DECLARE_WRITE_LINE_MEMBER(write_keyboard_clock);
@@ -140,11 +140,6 @@ private:
uint16_t ptr = 0;
} m_video;
- enum
- {
- TIMER_ID_BRG = 0
- };
-
bool brg_state = false;
int brga = 0, brgb = 0, brgc = 0;
emu_timer *m_brg = nullptr;
@@ -221,14 +216,11 @@ static INPUT_PORTS_START( ksm )
PORT_DIPSETTING(0x0E, "75")
INPUT_PORTS_END
-void ksm_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(ksm_state::clock_brg)
{
- if (id == TIMER_ID_BRG)
- {
- brg_state = !brg_state;
- m_i8251line->write_txc(brg_state);
- m_i8251line->write_rxc(brg_state);
- }
+ brg_state = !brg_state;
+ m_i8251line->write_txc(brg_state);
+ m_i8251line->write_rxc(brg_state);
}
void ksm_state::machine_reset()
@@ -245,7 +237,7 @@ void ksm_state::machine_start()
m_tmpclip = rectangle(0, KSM_DISP_HORZ - 1, 0, KSM_DISP_VERT - 1);
m_tmpbmp.allocate(KSM_DISP_HORZ, KSM_DISP_VERT);
- m_brg = timer_alloc(TIMER_ID_BRG);
+ m_brg = timer_alloc(FUNC(ksm_state::clock_brg), this);
}
void ksm_state::ksm_ppi_porta_w(uint8_t data)
diff --git a/src/mame/drivers/ecoinf2.cpp b/src/mame/drivers/ecoinf2.cpp
index e744552fea1..4b7f78040ce 100644
--- a/src/mame/drivers/ecoinf2.cpp
+++ b/src/mame/drivers/ecoinf2.cpp
@@ -123,10 +123,10 @@ private:
}
uint8_t ppi8255_ic22_read_c_misc()
{
- int combined_meter = m_meters->GetActivity(0) | m_meters->GetActivity(1) |
- m_meters->GetActivity(2) | m_meters->GetActivity(3) |
- m_meters->GetActivity(4) | m_meters->GetActivity(5) |
- m_meters->GetActivity(6) | m_meters->GetActivity(7);
+ int combined_meter = m_meters->get_activity(0) | m_meters->get_activity(1) |
+ m_meters->get_activity(2) | m_meters->get_activity(3) |
+ m_meters->get_activity(4) | m_meters->get_activity(5) |
+ m_meters->get_activity(6) | m_meters->get_activity(7);
if(combined_meter)
{
diff --git a/src/mame/drivers/eispc.cpp b/src/mame/drivers/eispc.cpp
index 4ec53e01520..3690e5757ef 100644
--- a/src/mame/drivers/eispc.cpp
+++ b/src/mame/drivers/eispc.cpp
@@ -527,7 +527,7 @@ void epc_state::machine_reset()
void epc_state::init_epc()
{
/* Keyboard UART Rxc/Txc is 19.2 kHz from x960 divider */
- m_kbdclk_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(epc_state::rxtxclk_w), this));
+ m_kbdclk_timer = timer_alloc(FUNC(epc_state::rxtxclk_w), this);
m_kbdclk_timer->adjust(attotime::from_hz(XTAL(18'432'000) / 960) / 2);
}
diff --git a/src/mame/drivers/enigma2.cpp b/src/mame/drivers/enigma2.cpp
index 01dbcb4337c..4bb3e66cf14 100644
--- a/src/mame/drivers/enigma2.cpp
+++ b/src/mame/drivers/enigma2.cpp
@@ -278,8 +278,8 @@ TIMER_CALLBACK_MEMBER(enigma2_state::interrupt_assert_callback)
void enigma2_state::create_interrupt_timers( )
{
- m_interrupt_clear_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(enigma2_state::interrupt_clear_callback),this));
- m_interrupt_assert_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(enigma2_state::interrupt_assert_callback),this));
+ m_interrupt_clear_timer = timer_alloc(FUNC(enigma2_state::interrupt_clear_callback), this);
+ m_interrupt_assert_timer = timer_alloc(FUNC(enigma2_state::interrupt_assert_callback), this);
}
diff --git a/src/mame/drivers/esh.cpp b/src/mame/drivers/esh.cpp
index 615a7fbbdb1..5677a091818 100644
--- a/src/mame/drivers/esh.cpp
+++ b/src/mame/drivers/esh.cpp
@@ -55,7 +55,6 @@ public:
protected:
virtual void machine_start() override;
- //virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
private:
required_device<pioneer_ldv1000_device> m_laserdisc;
diff --git a/src/mame/drivers/eurocom2.cpp b/src/mame/drivers/eurocom2.cpp
index a81ff72a3db..01432c5d09d 100644
--- a/src/mame/drivers/eurocom2.cpp
+++ b/src/mame/drivers/eurocom2.cpp
@@ -84,6 +84,10 @@ public:
void microtrol(machine_config &config);
protected:
+ // driver_device overrides
+ virtual void machine_reset() override;
+ virtual void machine_start() override;
+
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint8_t fdc_aux_r(offs_t offset);
@@ -99,10 +103,7 @@ protected:
void eurocom2_map(address_map &map);
- // driver_device overrides
- virtual void machine_reset() override;
- virtual void machine_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(toggle_sst);
emu_timer *m_sst = nullptr;
@@ -226,7 +227,7 @@ WRITE_LINE_MEMBER(eurocom2_state::pia1_cb2_w)
// reset single-step timer
}
-void eurocom2_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(eurocom2_state::toggle_sst)
{
m_sst_state = !m_sst_state;
m_pia1->ca2_w(m_sst_state);
@@ -393,7 +394,7 @@ void eurocom2_state::machine_reset()
void eurocom2_state::machine_start()
{
- m_sst = timer_alloc(0);
+ m_sst = timer_alloc(FUNC(eurocom2_state::toggle_sst), this);
m_tmpbmp.allocate(VC_DISP_HORZ, VC_DISP_VERT);
m_kbd_data = 0;
}
diff --git a/src/mame/drivers/exidy.cpp b/src/mame/drivers/exidy.cpp
index 365671d6b5a..cd723f659e6 100644
--- a/src/mame/drivers/exidy.cpp
+++ b/src/mame/drivers/exidy.cpp
@@ -181,11 +181,6 @@ namespace {
class exidy_state : public driver_device
{
public:
- enum
- {
- TIMER_COLLISION_IRQ
- };
-
exidy_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_dsw(*this, "DSW"),
@@ -213,6 +208,9 @@ public:
DECLARE_CUSTOM_INPUT_MEMBER(intsource_coins_r);
protected:
+ virtual void machine_start() override;
+ virtual void video_start() override;
+
required_ioport m_dsw;
required_ioport m_in0;
required_device<cpu_device> m_maincpu;
@@ -221,9 +219,6 @@ protected:
required_device<palette_device> m_palette;
required_shared_ptr<uint8_t> m_color_latch;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
- virtual void video_start() override;
-
void base(machine_config &config);
void exidy_video_config(uint8_t _collision_mask, uint8_t _collision_invert, int _is_2bpp);
@@ -242,6 +237,8 @@ private:
required_shared_ptr<uint8_t> m_sprite_enable;
optional_shared_ptr<uint8_t> m_characterram;
+ emu_timer *m_collision_mob_timer = nullptr;
+ emu_timer *m_collision_bg_timer = nullptr;
uint8_t m_collision_mask = 0;
uint8_t m_collision_invert = 0;
int m_is_2bpp = 0;
@@ -253,10 +250,11 @@ private:
void mtrap_ocl_w(uint8_t data);
- uint32_t screen_update_exidy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(exidy_vblank_interrupt);
+ TIMER_CALLBACK_MEMBER(latch_collision);
void latch_condition(int collision);
void set_1_color(int index, int which);
void set_colors();
@@ -1319,21 +1317,13 @@ void exidy_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
***************************************************************************/
-void exidy_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(exidy_state::latch_collision)
{
- switch (id)
- {
- case TIMER_COLLISION_IRQ:
- /* latch the collision bits */
- latch_condition(param);
-
- /* set the IRQ line */
- m_maincpu->set_input_line(0, ASSERT_LINE);
+ /* latch the collision bits */
+ latch_condition(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in exidy_state::device_timer");
- }
+ /* set the IRQ line */
+ m_maincpu->set_input_line(0, ASSERT_LINE);
}
@@ -1398,7 +1388,7 @@ void exidy_state::check_collision()
/* if we got one, trigger an interrupt */
if ((current_collision_mask & m_collision_mask) && (count++ < 128))
- timer_set(m_screen->time_until_pos(org_1_x + sx, org_1_y + sy), TIMER_COLLISION_IRQ, current_collision_mask);
+ m_collision_mob_timer->adjust(m_screen->time_until_pos(org_1_x + sx, org_1_y + sy), current_collision_mask);
}
if (m_motion_object_2_vid.pix(sy, sx) != 0xff)
@@ -1406,7 +1396,7 @@ void exidy_state::check_collision()
/* check for background collision (M2CHAR) */
if (m_background_bitmap.pix(org_2_y + sy, org_2_x + sx) != 0)
if ((m_collision_mask & 0x08) && (count++ < 128))
- timer_set(m_screen->time_until_pos(org_2_x + sx, org_2_y + sy), TIMER_COLLISION_IRQ, 0x08);
+ m_collision_bg_timer->adjust(m_screen->time_until_pos(org_2_x + sx, org_2_y + sy), 0x08);
}
}
}
@@ -1419,7 +1409,7 @@ void exidy_state::check_collision()
*
*************************************/
-uint32_t exidy_state::screen_update_exidy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+uint32_t exidy_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
/* refresh the colors from the palette (static or dynamic) */
set_colors();
@@ -1445,6 +1435,12 @@ uint32_t exidy_state::screen_update_exidy(screen_device &screen, bitmap_ind16 &b
*
*************************************/
+void exidy_state::machine_start()
+{
+ m_collision_mob_timer = timer_alloc(FUNC(exidy_state::latch_collision), this);
+ m_collision_bg_timer = timer_alloc(FUNC(exidy_state::latch_collision), this);
+}
+
void spectar_state::machine_start()
{
exidy_state::machine_start();
@@ -1509,7 +1505,7 @@ void exidy_state::base(machine_config &config)
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_video_attributes(VIDEO_ALWAYS_UPDATE);
m_screen->set_raw(EXIDY_PIXEL_CLOCK, EXIDY_HTOTAL, EXIDY_HBEND, EXIDY_HBSTART, EXIDY_VTOTAL, EXIDY_VBEND, EXIDY_VBSTART);
- m_screen->set_screen_update(FUNC(exidy_state::screen_update_exidy));
+ m_screen->set_screen_update(FUNC(exidy_state::screen_update));
m_screen->set_palette(m_palette);
}
diff --git a/src/mame/drivers/exorciser.cpp b/src/mame/drivers/exorciser.cpp
index 81fa1c2bd2a..11e3abd59b7 100644
--- a/src/mame/drivers/exorciser.cpp
+++ b/src/mame/drivers/exorciser.cpp
@@ -168,11 +168,6 @@ public:
, m_floppy3(*this, "floppy3")
{ }
- enum
- {
- TIMER_TRACE,
- };
-
void exorciser(machine_config &config);
DECLARE_INPUT_CHANGED_MEMBER(maincpu_clock_change);
@@ -221,7 +216,8 @@ private:
u8 m_restart_count;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ emu_timer *m_trace_timer;
+ TIMER_CALLBACK_MEMBER(assert_trace);
void pia_dbg_pa_w(u8 data);
DECLARE_READ_LINE_MEMBER(pia_dbg_ca1_r);
@@ -509,16 +505,9 @@ WRITE_LINE_MEMBER(exorciser_state::pia_dbg_ca2_w)
}
-void exorciser_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(exorciser_state::assert_trace)
{
- switch (id)
- {
- case TIMER_TRACE:
- m_mainnmi->input_merger_device::in_w<1>(ASSERT_LINE);
- break;
- default:
- throw emu_fatalerror("Unknown id in exorciser_state::device_timer");
- }
+ m_mainnmi->input_merger_device::in_w<1>(ASSERT_LINE);
}
// Note the trace timer delay is actually 11 cycles, but is stretched to 16
@@ -534,7 +523,7 @@ WRITE_LINE_MEMBER(exorciser_state::pia_dbg_cb2_w)
if (!maincpu_clock)
maincpu_clock = 10000000;
- timer_set(attotime::from_ticks(16, maincpu_clock), TIMER_TRACE);
+ m_trace_timer->adjust(attotime::from_ticks(16, maincpu_clock));
}
else
m_mainnmi->input_merger_device::in_w<1>(CLEAR_LINE);
@@ -627,6 +616,8 @@ void exorciser_state::machine_start()
save_item(NAME(m_stop_enabled));
save_item(NAME(m_printer_data));
save_item(NAME(m_printer_data_ready));
+
+ m_trace_timer = timer_alloc(FUNC(exorciser_state::assert_trace), this);
}
static DEVICE_INPUT_DEFAULTS_START(exorterm)
diff --git a/src/mame/drivers/famibox.cpp b/src/mame/drivers/famibox.cpp
index 597ccaabdfc..c3146538d9c 100644
--- a/src/mame/drivers/famibox.cpp
+++ b/src/mame/drivers/famibox.cpp
@@ -508,8 +508,8 @@ void famibox_state::machine_start()
for (int i = 0; i < 4; i++)
m_nt_page[i]->configure_entries(0, 2, m_nt_ram.get(), 0x400);
- m_attract_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(famibox_state::famicombox_attract_timer_callback),this));
- m_gameplay_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(famibox_state::famicombox_gameplay_timer_callback),this));
+ m_attract_timer = timer_alloc(FUNC(famibox_state::famicombox_attract_timer_callback), this);
+ m_gameplay_timer = timer_alloc(FUNC(famibox_state::famicombox_gameplay_timer_callback), this);
m_exception_cause = 0xff;
m_exception_mask = 0;
m_attract_timer_period = 0;
diff --git a/src/mame/drivers/fgoal.cpp b/src/mame/drivers/fgoal.cpp
index f451e738afd..c43f5dd30a2 100644
--- a/src/mame/drivers/fgoal.cpp
+++ b/src/mame/drivers/fgoal.cpp
@@ -64,19 +64,6 @@ void fgoal_state::fgoal_palette(palette_device &palette) const
}
-void fgoal_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_INTERRUPT:
- interrupt_callback(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in fgoal_state::device_timer");
- }
-}
-
-
TIMER_CALLBACK_MEMBER(fgoal_state::interrupt_callback)
{
int scanline;
@@ -335,7 +322,7 @@ GFXDECODE_END
void fgoal_state::machine_start()
{
- m_interrupt_timer = timer_alloc(TIMER_INTERRUPT);
+ m_interrupt_timer = timer_alloc(FUNC(fgoal_state::interrupt_callback), this);
save_item(NAME(m_xpos));
save_item(NAME(m_ypos));
diff --git a/src/mame/drivers/firebeat.cpp b/src/mame/drivers/firebeat.cpp
index f85d5dd8b4c..13bae4b1178 100644
--- a/src/mame/drivers/firebeat.cpp
+++ b/src/mame/drivers/firebeat.cpp
@@ -1216,7 +1216,7 @@ WRITE_LINE_MEMBER(firebeat_state::sound_irq_callback)
void firebeat_spu_state::machine_start()
{
firebeat_state::machine_start();
- m_dma_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(firebeat_spu_state::spu_dma_callback), this));
+ m_dma_timer = timer_alloc(FUNC(firebeat_spu_state::spu_dma_callback), this);
}
void firebeat_spu_state::machine_reset()
@@ -1814,7 +1814,7 @@ void firebeat_kbm_state::init_kbm_overseas()
void firebeat_kbm_state::init_keyboard()
{
// set keyboard timer
-// m_keyboard_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(firebeat_state::keyboard_timer_callback),this));
+// m_keyboard_timer = timer_alloc(FUNC(firebeat_state::keyboard_timer_callback), this);
// m_keyboard_timer->adjust(attotime::from_msec(10), 0, attotime::from_msec(10));
}
diff --git a/src/mame/drivers/flyball.cpp b/src/mame/drivers/flyball.cpp
index f6f8b29f963..4e6138ee824 100644
--- a/src/mame/drivers/flyball.cpp
+++ b/src/mame/drivers/flyball.cpp
@@ -51,13 +51,6 @@ public:
void flyball(machine_config &config);
private:
- enum
- {
- TIMER_POT_ASSERT,
- TIMER_POT_CLEAR,
- TIMER_QUARTER
- };
-
uint8_t input_r();
uint8_t scanline_r();
uint8_t potsense_r();
@@ -81,10 +74,10 @@ private:
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(joystick_callback);
+ TIMER_CALLBACK_MEMBER(pot_clear_callback);
TIMER_CALLBACK_MEMBER(quarter_callback);
void flyball_map(address_map &map);
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
/* devices */
required_device<cpu_device> m_maincpu;
@@ -181,23 +174,9 @@ uint32_t flyball_state::screen_update(screen_device &screen, bitmap_ind16 &bitma
}
-void flyball_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(flyball_state::pot_clear_callback)
{
- switch (id)
- {
- case TIMER_POT_ASSERT:
- joystick_callback(param);
- break;
- case TIMER_POT_CLEAR:
- m_maincpu->set_input_line(0, CLEAR_LINE);
- break;
- case TIMER_QUARTER:
- quarter_callback(param);
- break;
-
- default:
- throw emu_fatalerror("Unknown id in flyball_state::device_timer");
- }
+ m_maincpu->set_input_line(0, CLEAR_LINE);
}
@@ -448,9 +427,9 @@ void flyball_state::machine_start()
memcpy(ROM, &buf[0], len);
for (int i = 0; i < 64; i++)
- m_pot_assert_timer[i] = timer_alloc(TIMER_POT_ASSERT);
- m_pot_clear_timer = timer_alloc(TIMER_POT_CLEAR);
- m_quarter_timer = timer_alloc(TIMER_QUARTER);
+ m_pot_assert_timer[i] = timer_alloc(FUNC(flyball_state::joystick_callback), this);
+ m_pot_clear_timer = timer_alloc(FUNC(flyball_state::pot_clear_callback), this);
+ m_quarter_timer = timer_alloc(FUNC(flyball_state::quarter_callback), this);
m_lamp.resolve();
save_item(NAME(m_pitcher_vert));
diff --git a/src/mame/drivers/fm7.cpp b/src/mame/drivers/fm7.cpp
index 32426d8df85..ee8ce06f813 100644
--- a/src/mame/drivers/fm7.cpp
+++ b/src/mame/drivers/fm7.cpp
@@ -1723,10 +1723,10 @@ void fm7_state::init_fm7()
{
// m_shared_ram = std::make_unique<uint8_t[]>(0x80);
m_video_ram = make_unique_clear<uint8_t[]>(0x18000); // 2 pages on some systems
- m_beeper_off_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(fm7_state::beeper_off), this));
- m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(fm7_state::timer_irq), this));
- m_subtimer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(fm7_state::subtimer_irq), this));
- m_keyboard_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(fm7_state::keyboard_poll), this));
+ m_beeper_off_timer = timer_alloc(FUNC(fm7_state::beeper_off), this);
+ m_timer = timer_alloc(FUNC(fm7_state::timer_irq), this);
+ m_subtimer = timer_alloc(FUNC(fm7_state::subtimer_irq), this);
+ m_keyboard_timer = timer_alloc(FUNC(fm7_state::keyboard_poll), this);
m_init_rom_en = false;
}
@@ -1746,9 +1746,9 @@ MACHINE_START_MEMBER(fm7_state,fm7)
MACHINE_START_MEMBER(fm77_state,fm77av)
{
- m_encoder_ack_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(fm77_state::av_encoder_ack), this));
- m_alu_task_end_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(fm77_state::av_alu_task_end), this));
- m_vsync_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(fm77_state::av_vsync), this));
+ m_encoder_ack_timer = timer_alloc(FUNC(fm77_state::av_encoder_ack), this);
+ m_alu_task_end_timer = timer_alloc(FUNC(fm77_state::av_alu_task_end), this);
+ m_vsync_timer = timer_alloc(FUNC(fm77_state::av_vsync), this);
memset(m_shared_ram,0xff,0x80);
@@ -1765,9 +1765,9 @@ MACHINE_START_MEMBER(fm77_state,fm77av)
MACHINE_START_MEMBER(fm11_state,fm11)
{
- m_encoder_ack_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(fm11_state::av_encoder_ack), this));
- m_alu_task_end_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(fm11_state::av_alu_task_end), this));
- m_vsync_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(fm11_state::av_vsync), this));
+ m_encoder_ack_timer = timer_alloc(FUNC(fm11_state::av_encoder_ack), this);
+ m_alu_task_end_timer = timer_alloc(FUNC(fm11_state::av_alu_task_end), this);
+ m_vsync_timer = timer_alloc(FUNC(fm11_state::av_vsync), this);
memset(m_shared_ram,0xff,0x80);
m_type = SYS_FM11;
diff --git a/src/mame/drivers/fmtowns.cpp b/src/mame/drivers/fmtowns.cpp
index 60af7838709..eaf43755706 100644
--- a/src/mame/drivers/fmtowns.cpp
+++ b/src/mame/drivers/fmtowns.cpp
@@ -439,47 +439,17 @@ uint8_t towns_state::towns_intervaltimer2_r(offs_t offset)
return 0xff;
}
-void towns_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch(id)
- {
- case TIMER_FREERUN:
- freerun_inc();
- break;
- case TIMER_INTERVAL2:
- intervaltimer2_timeout();
- break;
- case TIMER_KEYBOARD:
- poll_keyboard();
- break;
- case TIMER_MOUSE:
- mouse_timeout();
- break;
- case TIMER_WAIT:
- wait_end();
- break;
- case TIMER_CDSTATUS:
- towns_cd_status_ready();
- break;
- case TIMER_CDDA:
- towns_delay_cdda(m_cdrom.target());
- break;
- case TIMER_SPRITES:
- draw_sprites();
- break;
- }
-}
-void towns_state::freerun_inc()
+TIMER_CALLBACK_MEMBER(towns_state::freerun_inc)
{
m_freerun_timer++;
}
-void towns_state::intervaltimer2_timeout()
+TIMER_CALLBACK_MEMBER(towns_state::intervaltimer2_timeout)
{
m_intervaltimer2_timeout_flag = 1;
}
-void towns_state::wait_end()
+TIMER_CALLBACK_MEMBER(towns_state::wait_end)
{
m_maincpu->set_input_line(INPUT_LINE_HALT,CLEAR_LINE);
}
@@ -726,24 +696,20 @@ void towns_state::kb_sendcode(uint8_t scancode, int release)
//logerror("KB: sending scancode 0x%02x\n",scancode);
}
-void towns_state::poll_keyboard()
+TIMER_CALLBACK_MEMBER(towns_state::poll_keyboard)
{
- int port,bit;
- uint8_t scan;
- uint32_t portval;
-
- scan = 0;
- for(port=0;port<4;port++)
+ uint8_t scan = 0;
+ for(int port = 0; port < 4; port++)
{
- portval = m_kb_ports[port]->read();
- for(bit=0;bit<32;bit++)
+ uint32_t portval = m_kb_ports[port]->read();
+ for(int bit = 0; bit < 32; bit++)
{
- if(((portval & (1<<bit))) != ((m_kb_prev[port] & (1<<bit))))
+ if(BIT(portval, bit) != BIT(m_kb_prev[port], bit))
{ // bit changed
- if((portval & (1<<bit)) == 0) // release
- kb_sendcode(scan,1);
+ if(BIT(portval, bit) == 0) // release
+ kb_sendcode(scan, 1);
else
- kb_sendcode(scan,0);
+ kb_sendcode(scan, 0);
}
scan++;
}
@@ -929,7 +895,7 @@ void towns_state::towns_sound_ctrl_w(offs_t offset, uint8_t data)
// Controller ports
// Joysticks are multiplexed, with fire buttons available when bits 0 and 1 of port 0x4d6 are high. (bits 2 and 3 for second port?)
-void towns_state::mouse_timeout()
+TIMER_CALLBACK_MEMBER(towns_state::mouse_timeout)
{
m_towns_mouse_output = MOUSE_START; // reset mouse data
}
@@ -1421,7 +1387,7 @@ void towns_state::towns_cdrom_set_irq(int line,int state)
}
}
-void towns_state::towns_cd_status_ready()
+TIMER_CALLBACK_MEMBER(towns_state::towns_cd_status_ready)
{
m_towns_cd.status |= 0x02; // status read request
m_towns_cd.status |= 0x01; // ready
@@ -1631,9 +1597,9 @@ void towns_state::towns_cdrom_play_cdda(cdrom_image_device* device)
}
}
-void towns_state::towns_delay_cdda(cdrom_image_device* dev)
+TIMER_CALLBACK_MEMBER(towns_state::towns_delay_cdda)
{
- towns_cdrom_play_cdda(dev);
+ towns_cdrom_play_cdda(m_cdrom.target());
}
void towns_state::towns_cdrom_execute_command(cdrom_image_device* device)
@@ -2734,19 +2700,19 @@ void towns_state::driver_start()
//towns_sprram = std::make_unique<uint8_t[]>(0x20000);
m_towns_serial_rom = std::make_unique<uint8_t[]>(256/8);
init_serial_rom();
- m_towns_kb_timer = timer_alloc(TIMER_KEYBOARD);
- m_towns_mouse_timer = timer_alloc(TIMER_MOUSE);
- m_towns_wait_timer = timer_alloc(TIMER_WAIT);
- m_towns_freerun_counter = timer_alloc(TIMER_FREERUN);
- m_towns_intervaltimer2 = timer_alloc(TIMER_INTERVAL2);
- m_towns_status_timer = timer_alloc(TIMER_CDSTATUS);
- m_towns_cdda_timer = timer_alloc(TIMER_CDDA);
+ m_towns_kb_timer = timer_alloc(FUNC(towns_state::poll_keyboard), this);
+ m_towns_mouse_timer = timer_alloc(FUNC(towns_state::mouse_timeout), this);
+ m_towns_wait_timer = timer_alloc(FUNC(towns_state::wait_end), this);
+ m_towns_freerun_counter = timer_alloc(FUNC(towns_state::freerun_inc), this);
+ m_towns_intervaltimer2 = timer_alloc(FUNC(towns_state::intervaltimer2_timeout), this);
+ m_towns_status_timer = timer_alloc(FUNC(towns_state::towns_cd_status_ready), this);
+ m_towns_cdda_timer = timer_alloc(FUNC(towns_state::towns_delay_cdda), this);
memset(&m_video,0,sizeof(struct towns_video_controller));
memset(&m_towns_cd,0,sizeof(struct towns_cdrom_controller));
m_towns_cd.status = 0x01; // CDROM controller ready
m_towns_cd.buffer_ptr = -1;
- m_towns_cd.read_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(towns_state::towns_cdrom_read_byte),this));
+ m_towns_cd.read_timer = timer_alloc(FUNC(towns_state::towns_cdrom_read_byte), this);
save_pointer(m_video.towns_crtc_reg,"CRTC registers",32);
save_pointer(m_video.towns_video_reg,"Video registers",2);
diff --git a/src/mame/drivers/fp6000.cpp b/src/mame/drivers/fp6000.cpp
index c673160cd7d..8516d758cba 100644
--- a/src/mame/drivers/fp6000.cpp
+++ b/src/mame/drivers/fp6000.cpp
@@ -439,7 +439,7 @@ void fp6000_state::pit_timer2_w(int state)
void fp6000_state::machine_start()
{
- m_pit_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(fp6000_state::pit_timer0_clear), this));
+ m_pit_timer = timer_alloc(FUNC(fp6000_state::pit_timer0_clear), this);
}
void fp6000_state::machine_reset()
diff --git a/src/mame/drivers/fs3216.cpp b/src/mame/drivers/fs3216.cpp
index b44ae1962b9..11afcfc89fd 100644
--- a/src/mame/drivers/fs3216.cpp
+++ b/src/mame/drivers/fs3216.cpp
@@ -119,7 +119,7 @@ void fs3216_state::machine_start()
m_fdc_select = 0;
m_fdc_dma_count = 0;
- m_fdc_dma_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(fs3216_state::fdc_dma), this));
+ m_fdc_dma_timer = timer_alloc(FUNC(fs3216_state::fdc_dma), this);
save_item(NAME(m_mmu_reg));
save_item(NAME(m_from_reset));
diff --git a/src/mame/drivers/fuukifg2.cpp b/src/mame/drivers/fuukifg2.cpp
index 97b1d9d0676..087df8ac464 100644
--- a/src/mame/drivers/fuukifg2.cpp
+++ b/src/mame/drivers/fuukifg2.cpp
@@ -55,13 +55,9 @@ To Do:
#include "speaker.h"
-/***************************************************************************
-
-
- Memory Maps - Main CPU
-
-
-***************************************************************************/
+//-------------------------------------------------
+// memory - main CPU
+//-------------------------------------------------
void fuuki16_state::vregs_w(offs_t offset, u16 data, u16 mem_mask)
{
@@ -107,7 +103,7 @@ void fuuki16_state::vram_buffered_w(offs_t offset, u16 data, u16 mem_mask)
m_tilemap[2]->mark_tile_dirty(offset / 2);
}
-void fuuki16_state::fuuki16_map(address_map &map)
+void fuuki16_state::main_map(address_map &map)
{
map(0x000000, 0x0fffff).rom(); // ROM
map(0x400000, 0x40ffff).ram(); // RAM
@@ -127,13 +123,9 @@ void fuuki16_state::fuuki16_map(address_map &map)
}
-/***************************************************************************
-
-
- Memory Maps - Sound CPU
-
-
-***************************************************************************/
+//-------------------------------------------------
+// memory - sound CPU
+//-------------------------------------------------
void fuuki16_state::sound_rombank_w(u8 data)
{
@@ -153,14 +145,14 @@ void fuuki16_state::oki_banking_w(u8 data)
m_oki->set_rom_bank((data & 6) >> 1);
}
-void fuuki16_state::fuuki16_sound_map(address_map &map)
+void fuuki16_state::sound_map(address_map &map)
{
map(0x0000, 0x5fff).rom(); // ROM
map(0x6000, 0x7fff).ram(); // RAM
map(0x8000, 0xffff).bankr("soundbank"); // Banked ROM
}
-void fuuki16_state::fuuki16_sound_io_map(address_map &map)
+void fuuki16_state::sound_io_map(address_map &map)
{
map.global_mask(0xff);
map(0x00, 0x00).w(FUNC(fuuki16_state::sound_rombank_w)); // ROM Bank
@@ -174,13 +166,9 @@ void fuuki16_state::fuuki16_sound_io_map(address_map &map)
}
-/***************************************************************************
-
-
- Input Ports
-
-
-***************************************************************************/
+//-------------------------------------------------
+// input ports
+//-------------------------------------------------
static INPUT_PORTS_START( gogomile )
PORT_START("SYSTEM") // $800000.w
@@ -345,13 +333,9 @@ INPUT_PORTS_END
-/***************************************************************************
-
-
- Graphics Layouts
-
-
-***************************************************************************/
+//-------------------------------------------------
+// graphics layouts
+//-------------------------------------------------
/* 16x16x4 */
static const gfx_layout layout_16x16x4 =
@@ -384,13 +368,9 @@ static GFXDECODE_START( gfx_fuuki16 )
GFXDECODE_END
-/***************************************************************************
-
-
- Machine Drivers
-
-
-***************************************************************************/
+//-------------------------------------------------
+// driver functions
+//-------------------------------------------------
/*
- Interrupts (pbancho) -
@@ -404,26 +384,23 @@ GFXDECODE_END
also used for water effects and titlescreen linescroll on gogomile
*/
-void fuuki16_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(fuuki16_state::level1_interrupt)
{
- switch (id)
- {
- case TIMER_LEVEL_1_INTERRUPT:
- m_maincpu->set_input_line(1, HOLD_LINE);
- m_level_1_interrupt_timer->adjust(m_screen->time_until_pos(248));
- break;
- case TIMER_VBLANK_INTERRUPT:
- m_maincpu->set_input_line(3, HOLD_LINE); // VBlank IRQ
- m_vblank_interrupt_timer->adjust(m_screen->time_until_vblank_start());
- break;
- case TIMER_RASTER_INTERRUPT:
- m_maincpu->set_input_line(5, HOLD_LINE); // Raster Line IRQ
- m_screen->update_partial(m_screen->vpos());
- m_raster_interrupt_timer->adjust(m_screen->frame_period());
- break;
- default:
- throw emu_fatalerror("Unknown id in fuuki16_state::device_timer");
- }
+ m_maincpu->set_input_line(1, HOLD_LINE);
+ m_level_1_interrupt_timer->adjust(m_screen->time_until_pos(248));
+}
+
+TIMER_CALLBACK_MEMBER(fuuki16_state::vblank_interrupt)
+{
+ m_maincpu->set_input_line(3, HOLD_LINE); // VBlank IRQ
+ m_vblank_interrupt_timer->adjust(m_screen->time_until_vblank_start());
+}
+
+TIMER_CALLBACK_MEMBER(fuuki16_state::raster_interrupt)
+{
+ m_maincpu->set_input_line(5, HOLD_LINE); // Raster Line IRQ
+ m_screen->update_partial(m_screen->vpos());
+ m_raster_interrupt_timer->adjust(m_screen->frame_period());
}
@@ -433,9 +410,9 @@ void fuuki16_state::machine_start()
m_soundbank->configure_entries(0, 3, &ROM[0x8000], 0x8000);
- m_level_1_interrupt_timer = timer_alloc(TIMER_LEVEL_1_INTERRUPT);
- m_vblank_interrupt_timer = timer_alloc(TIMER_VBLANK_INTERRUPT);
- m_raster_interrupt_timer = timer_alloc(TIMER_RASTER_INTERRUPT);
+ m_level_1_interrupt_timer = timer_alloc(FUNC(fuuki16_state::level1_interrupt), this);
+ m_vblank_interrupt_timer = timer_alloc(FUNC(fuuki16_state::vblank_interrupt), this);
+ m_raster_interrupt_timer = timer_alloc(FUNC(fuuki16_state::raster_interrupt), this);
}
@@ -453,11 +430,11 @@ void fuuki16_state::fuuki16(machine_config &config)
{
/* basic machine hardware */
M68000(config, m_maincpu, XTAL(32'000'000) / 2); /* 16 MHz */
- m_maincpu->set_addrmap(AS_PROGRAM, &fuuki16_state::fuuki16_map);
+ m_maincpu->set_addrmap(AS_PROGRAM, &fuuki16_state::main_map);
Z80(config, m_audiocpu, XTAL(12'000'000) / 2); /* 6 MHz */
- m_audiocpu->set_addrmap(AS_PROGRAM, &fuuki16_state::fuuki16_sound_map);
- m_audiocpu->set_addrmap(AS_IO, &fuuki16_state::fuuki16_sound_io_map);
+ m_audiocpu->set_addrmap(AS_PROGRAM, &fuuki16_state::sound_map);
+ m_audiocpu->set_addrmap(AS_IO, &fuuki16_state::sound_io_map);
/* video hardware */
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
@@ -493,11 +470,9 @@ void fuuki16_state::fuuki16(machine_config &config)
}
-/***************************************************************************
-
- ROM Loading
-
-***************************************************************************/
+//-------------------------------------------------
+// ROM loading
+//-------------------------------------------------
/***************************************************************************
@@ -661,13 +636,9 @@ ROM_START( pbancho )
ROM_END
-/***************************************************************************
-
-
- Game Drivers
-
-
-***************************************************************************/
+//-------------------------------------------------
+// game drivers
+//-------------------------------------------------
GAME( 1995, gogomile, 0, fuuki16, gogomile, fuuki16_state, empty_init, ROT0, "Fuuki", "Susume! Mile Smile / Go Go! Mile Smile (newer)", MACHINE_SUPPORTS_SAVE )
GAME( 1995, gogomileo, gogomile, fuuki16, gogomileo, fuuki16_state, empty_init, ROT0, "Fuuki", "Susume! Mile Smile / Go Go! Mile Smile (older)", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/fuukifg3.cpp b/src/mame/drivers/fuukifg3.cpp
index 06990bbeab6..bcb2c1c808e 100644
--- a/src/mame/drivers/fuukifg3.cpp
+++ b/src/mame/drivers/fuukifg3.cpp
@@ -172,13 +172,9 @@ There is an Asura Buster known to exist on a FG3-SUB-EP containing all EPROMs
#include "speaker.h"
-/***************************************************************************
-
-
- Memory Maps - Main CPU
-
-
-***************************************************************************/
+//-------------------------------------------------
+// memory - main CPU
+//-------------------------------------------------
/* Sound comms */
u8 fuuki32_state::snd_020_r(offs_t offset)
@@ -234,7 +230,7 @@ void fuuki32_state::vram_buffered_w(offs_t offset, u32 data, u32 mem_mask)
m_tilemap[2]->mark_tile_dirty(offset);
}
-void fuuki32_state::fuuki32_map(address_map &map)
+void fuuki32_state::main_map(address_map &map)
{
map(0x000000, 0x1fffff).rom(); // ROM
map(0x400000, 0x40ffff).ram(); // Work RAM
@@ -261,18 +257,16 @@ void fuuki32_state::fuuki32_map(address_map &map)
}
-/***************************************************************************
-
- Memory Maps - Sound CPU
-
-***************************************************************************/
+//-------------------------------------------------
+// memory - sound CPU
+//-------------------------------------------------
void fuuki32_state::sound_bw_w(u8 data)
{
m_soundbank->set_entry(data);
}
-void fuuki32_state::fuuki32_sound_map(address_map &map)
+void fuuki32_state::sound_map(address_map &map)
{
map(0x0000, 0x5fff).rom(); // ROM
map(0x6000, 0x6fff).ram(); // RAM
@@ -280,7 +274,7 @@ void fuuki32_state::fuuki32_sound_map(address_map &map)
map(0x8000, 0xffff).bankr("soundbank"); // ROM
}
-void fuuki32_state::fuuki32_sound_io_map(address_map &map)
+void fuuki32_state::sound_io_map(address_map &map)
{
map.global_mask(0xff);
map(0x00, 0x00).w(FUNC(fuuki32_state::sound_bw_w));
@@ -288,13 +282,10 @@ void fuuki32_state::fuuki32_sound_io_map(address_map &map)
map(0x40, 0x45).rw("ymf", FUNC(ymf278b_device::read), FUNC(ymf278b_device::write));
}
-/***************************************************************************
-
-
- Input Ports
-
-***************************************************************************/
+//-------------------------------------------------
+// input ports
+//-------------------------------------------------
static INPUT_PORTS_START( asurabld )
PORT_START("SYSTEM")
@@ -434,13 +425,9 @@ static INPUT_PORTS_START( asurabusa )
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
INPUT_PORTS_END
-/***************************************************************************
-
-
- Graphics Layouts
-
-
-***************************************************************************/
+//-------------------------------------------------
+// graphics layouts
+//-------------------------------------------------
/* 16x16x8 */
static const gfx_layout layout_16x16x8 =
@@ -461,34 +448,27 @@ static GFXDECODE_START( gfx_fuuki32 )
GFXDECODE_END
-/***************************************************************************
-
-
- Machine Drivers
+//-------------------------------------------------
+// driver functions
+//-------------------------------------------------
+TIMER_CALLBACK_MEMBER(fuuki32_state::level1_interrupt)
+{
+ m_maincpu->set_input_line(1, HOLD_LINE);
+ m_level_1_interrupt_timer->adjust(m_screen->time_until_pos(248));
+}
-***************************************************************************/
+TIMER_CALLBACK_MEMBER(fuuki32_state::vblank_interrupt)
+{
+ m_maincpu->set_input_line(3, HOLD_LINE); // VBlank IRQ
+ m_vblank_interrupt_timer->adjust(m_screen->time_until_vblank_start());
+}
-void fuuki32_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(fuuki32_state::raster_interrupt)
{
- switch (id)
- {
- case TIMER_LEVEL_1_INTERRUPT:
- m_maincpu->set_input_line(1, HOLD_LINE);
- m_level_1_interrupt_timer->adjust(m_screen->time_until_pos(248));
- break;
- case TIMER_VBLANK_INTERRUPT:
- m_maincpu->set_input_line(3, HOLD_LINE); // VBlank IRQ
- m_vblank_interrupt_timer->adjust(m_screen->time_until_vblank_start());
- break;
- case TIMER_RASTER_INTERRUPT:
- m_maincpu->set_input_line(5, HOLD_LINE); // Raster Line IRQ
- m_screen->update_partial(m_screen->vpos());
- m_raster_interrupt_timer->adjust(m_screen->frame_period());
- break;
- default:
- throw emu_fatalerror("Unknown id in fuuki32_state::device_timer");
- }
+ m_maincpu->set_input_line(5, HOLD_LINE); // Raster Line IRQ
+ m_screen->update_partial(m_screen->vpos());
+ m_raster_interrupt_timer->adjust(m_screen->frame_period());
}
@@ -498,9 +478,9 @@ void fuuki32_state::machine_start()
m_soundbank->configure_entries(0, 0x10, &ROM[0], 0x8000);
- m_level_1_interrupt_timer = timer_alloc(TIMER_LEVEL_1_INTERRUPT);
- m_vblank_interrupt_timer = timer_alloc(TIMER_VBLANK_INTERRUPT);
- m_raster_interrupt_timer = timer_alloc(TIMER_RASTER_INTERRUPT);
+ m_level_1_interrupt_timer = timer_alloc(FUNC(fuuki32_state::level1_interrupt), this);
+ m_vblank_interrupt_timer = timer_alloc(FUNC(fuuki32_state::vblank_interrupt), this);
+ m_raster_interrupt_timer = timer_alloc(FUNC(fuuki32_state::raster_interrupt), this);
save_item(NAME(m_spr_buffered_tilebank));
}
@@ -519,11 +499,11 @@ void fuuki32_state::fuuki32(machine_config &config)
{
/* basic machine hardware */
M68EC020(config, m_maincpu, CPU_CLOCK); /* 20MHz verified */
- m_maincpu->set_addrmap(AS_PROGRAM, &fuuki32_state::fuuki32_map);
+ m_maincpu->set_addrmap(AS_PROGRAM, &fuuki32_state::main_map);
z80_device &soundcpu(Z80(config, "soundcpu", SOUND_CPU_CLOCK)); /* 6MHz verified */
- soundcpu.set_addrmap(AS_PROGRAM, &fuuki32_state::fuuki32_sound_map);
- soundcpu.set_addrmap(AS_IO, &fuuki32_state::fuuki32_sound_io_map);
+ soundcpu.set_addrmap(AS_PROGRAM, &fuuki32_state::sound_map);
+ soundcpu.set_addrmap(AS_IO, &fuuki32_state::sound_io_map);
/* video hardware */
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
@@ -541,8 +521,8 @@ void fuuki32_state::fuuki32(machine_config &config)
m_fuukivid->set_palette(m_palette);
m_fuukivid->set_color_base(0x400*2);
m_fuukivid->set_color_num(0x40);
- m_fuukivid->set_tile_callback(FUNC(fuuki32_state::fuuki32_tile_cb));
- m_fuukivid->set_colpri_callback(FUNC(fuuki32_state::fuuki32_colpri_cb));
+ m_fuukivid->set_tile_callback(FUNC(fuuki32_state::tile_cb));
+ m_fuukivid->set_colpri_callback(FUNC(fuuki32_state::colpri_cb));
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
@@ -558,13 +538,9 @@ void fuuki32_state::fuuki32(machine_config &config)
ymf.add_route(5, "rspeaker", 0.50);
}
-/***************************************************************************
-
-
- ROMs Loading
-
-
-***************************************************************************/
+//-------------------------------------------------
+// ROM loading
+//-------------------------------------------------
/***************************************************************************
@@ -756,13 +732,10 @@ ROM_START( asurabusjr ) // ARCADIA review build
ROM_LOAD( "opm.u6", 0x00000, 0x400000, CRC(31b05be4) SHA1(d0f4f387f84a74591224b0f42b7f5c538a3dc498) )
ROM_END
-/***************************************************************************
-
-
- Game Drivers
-
-***************************************************************************/
+//-------------------------------------------------
+// game drivers
+//-------------------------------------------------
GAME( 1998, asurabld, 0, fuuki32, asurabld, fuuki32_state, empty_init, ROT0, "Fuuki", "Asura Blade - Sword of Dynasty (Japan)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/galaga.cpp b/src/mame/drivers/galaga.cpp
index 38f5c2c1165..34a41ba656b 100644
--- a/src/mame/drivers/galaga.cpp
+++ b/src/mame/drivers/galaga.cpp
@@ -827,7 +827,7 @@ void galaga_state::machine_start()
{
m_leds.resolve();
/* create the interrupt timer */
- m_cpu3_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(galaga_state::cpu3_interrupt_callback),this));
+ m_cpu3_interrupt_timer = timer_alloc(FUNC(galaga_state::cpu3_interrupt_callback), this);
save_item(NAME(m_main_irq_mask));
save_item(NAME(m_sub_irq_mask));
save_item(NAME(m_sub2_nmi_mask));
diff --git a/src/mame/drivers/gamate.cpp b/src/mame/drivers/gamate.cpp
index cc91f567ce8..3f737193d1b 100644
--- a/src/mame/drivers/gamate.cpp
+++ b/src/mame/drivers/gamate.cpp
@@ -147,8 +147,8 @@ INPUT_PORTS_END
void gamate_state::init_gamate()
{
- timer1 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gamate_state::gamate_timer),this));
- timer2 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gamate_state::gamate_timer2),this));
+ timer1 = timer_alloc(FUNC(gamate_state::gamate_timer), this);
+ timer2 = timer_alloc(FUNC(gamate_state::gamate_timer2), this);
}
void gamate_state::machine_start()
diff --git a/src/mame/drivers/gameking.cpp b/src/mame/drivers/gameking.cpp
index c2a2567a317..d799254dd28 100644
--- a/src/mame/drivers/gameking.cpp
+++ b/src/mame/drivers/gameking.cpp
@@ -234,8 +234,8 @@ uint32_t gameking_state::screen_update_gameking3(screen_device& screen, bitmap_r
void gameking_state::init_gameking()
{
- timer1 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gameking_state::gameking_timer), this));
- timer2 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gameking_state::gameking_timer2), this));
+ timer1 = timer_alloc(FUNC(gameking_state::gameking_timer), this);
+ timer2 = timer_alloc(FUNC(gameking_state::gameking_timer2), this);
}
TIMER_CALLBACK_MEMBER(gameking_state::gameking_timer)
diff --git a/src/mame/drivers/gameplan.cpp b/src/mame/drivers/gameplan.cpp
index d6e55864a45..ad75cbdbbb1 100644
--- a/src/mame/drivers/gameplan.cpp
+++ b/src/mame/drivers/gameplan.cpp
@@ -69,8 +69,6 @@ TODO:
- The board has, instead of a watchdog, a timed reset that has to be disabled
on startup. The disable line is tied to CA2 of VIA2, but I don't see writes
to that pin in the log. Missing support in machine/6522via.cpp?
-- Kaos needs a kludge to avoid a deadlock (see the via_irq() function below).
- I don't know if this is a shortcoming of the driver or of 6522via.cpp.
- Investigate and document the 8910 dip switches
- Fix the input ports of Kaos
@@ -982,7 +980,7 @@ void gameplan_state::gameplan(machine_config &config)
m_via_0->writepa_handler().set(FUNC(gameplan_state::video_data_w));
m_via_0->writepb_handler().set(FUNC(gameplan_state::gameplan_video_command_w));
m_via_0->ca2_handler().set(FUNC(gameplan_state::video_command_trigger_w));
- m_via_0->irq_handler().set(FUNC(gameplan_state::via_irq));
+ m_via_0->irq_handler().set_inputline(m_maincpu, 0);
MOS6522(config, m_via_1, GAMEPLAN_MAIN_CPU_CLOCK);
m_via_1->readpa_handler().set(FUNC(gameplan_state::io_port_r));
diff --git a/src/mame/drivers/gaplus.cpp b/src/mame/drivers/gaplus.cpp
index c4aac509478..cc765545f43 100644
--- a/src/mame/drivers/gaplus.cpp
+++ b/src/mame/drivers/gaplus.cpp
@@ -210,21 +210,6 @@ void gaplus_base_state::machine_reset()
m_subcpu->set_input_line(0, CLEAR_LINE);
}
-void gaplus_base_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_NAMCOIO0_RUN:
- namcoio0_run(param);
- break;
- case TIMER_NAMCOIO1_RUN:
- namcoio1_run(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in gaplus_base_state::device_timer");
- }
-}
-
TIMER_CALLBACK_MEMBER(gaplus_base_state::namcoio0_run)
{
m_namco58xx->customio_run();
@@ -499,8 +484,8 @@ void gaplus_state::out_lamps1(uint8_t data)
void gaplus_base_state::machine_start()
{
- m_namcoio0_run_timer = timer_alloc(TIMER_NAMCOIO0_RUN);
- m_namcoio1_run_timer = timer_alloc(TIMER_NAMCOIO1_RUN);
+ m_namcoio0_run_timer = timer_alloc(FUNC(gaplus_base_state::namcoio0_run), this);
+ m_namcoio1_run_timer = timer_alloc(FUNC(gaplus_base_state::namcoio1_run), this);
save_item(NAME(m_main_irq_mask));
save_item(NAME(m_sub_irq_mask));
diff --git a/src/mame/drivers/gba.cpp b/src/mame/drivers/gba.cpp
index 3ea6e6f8166..15e3519dc1b 100644
--- a/src/mame/drivers/gba.cpp
+++ b/src/mame/drivers/gba.cpp
@@ -1324,27 +1324,27 @@ void gba_state::machine_reset()
void gba_state::machine_start()
{
/* and one for each DMA channel */
- m_dma_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::dma_complete),this));
- m_dma_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::dma_complete),this));
- m_dma_timer[2] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::dma_complete),this));
- m_dma_timer[3] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::dma_complete),this));
+ m_dma_timer[0] = timer_alloc(FUNC(gba_state::dma_complete), this);
+ m_dma_timer[1] = timer_alloc(FUNC(gba_state::dma_complete), this);
+ m_dma_timer[2] = timer_alloc(FUNC(gba_state::dma_complete), this);
+ m_dma_timer[3] = timer_alloc(FUNC(gba_state::dma_complete), this);
m_dma_timer[0]->adjust(attotime::never);
m_dma_timer[1]->adjust(attotime::never, 1);
m_dma_timer[2]->adjust(attotime::never, 2);
m_dma_timer[3]->adjust(attotime::never, 3);
/* also one for each timer (heh) */
- m_tmr_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::timer_expire),this));
- m_tmr_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::timer_expire),this));
- m_tmr_timer[2] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::timer_expire),this));
- m_tmr_timer[3] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::timer_expire),this));
+ m_tmr_timer[0] = timer_alloc(FUNC(gba_state::timer_expire), this);
+ m_tmr_timer[1] = timer_alloc(FUNC(gba_state::timer_expire), this);
+ m_tmr_timer[2] = timer_alloc(FUNC(gba_state::timer_expire), this);
+ m_tmr_timer[3] = timer_alloc(FUNC(gba_state::timer_expire), this);
m_tmr_timer[0]->adjust(attotime::never);
m_tmr_timer[1]->adjust(attotime::never, 1);
m_tmr_timer[2]->adjust(attotime::never, 2);
m_tmr_timer[3]->adjust(attotime::never, 3);
/* and an IRQ handling timer */
- m_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::handle_irq),this));
+ m_irq_timer = timer_alloc(FUNC(gba_state::handle_irq), this);
m_irq_timer->adjust(attotime::never);
save_item(NAME(m_regs));
diff --git a/src/mame/drivers/gijoe.cpp b/src/mame/drivers/gijoe.cpp
index 9097877a9f6..2f42c42486d 100644
--- a/src/mame/drivers/gijoe.cpp
+++ b/src/mame/drivers/gijoe.cpp
@@ -281,7 +281,7 @@ INPUT_PORTS_END
void gijoe_state::machine_start()
{
- m_dmadelay_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gijoe_state::dmaend_callback),this));
+ m_dmadelay_timer = timer_alloc(FUNC(gijoe_state::dmaend_callback), this);
save_item(NAME(m_cur_control2));
}
diff --git a/src/mame/drivers/gottlieb.cpp b/src/mame/drivers/gottlieb.cpp
index e035a147ce6..80058da3fc3 100644
--- a/src/mame/drivers/gottlieb.cpp
+++ b/src/mame/drivers/gottlieb.cpp
@@ -235,6 +235,8 @@ void gottlieb_state::machine_start()
save_item(NAME(m_gfxcharhi));
save_item(NAME(m_weights));
+ m_nmi_clear_timer = timer_alloc(FUNC(gottlieb_state::nmi_clear), this);
+
/* see if we have a laserdisc */
if (m_laserdisc != nullptr)
{
@@ -244,8 +246,9 @@ void gottlieb_state::machine_start()
m_maincpu->space(AS_PROGRAM).install_write_handler(0x05806, 0x05806, 0, 0x07f8, 0, write8smo_delegate(*this, FUNC(gottlieb_state::laserdisc_select_w)));
/* allocate a timer for serial transmission, and one for philips code processing */
- m_laserdisc_bit_timer = timer_alloc(TIMER_LASERDISC_BIT);
- m_laserdisc_philips_timer = timer_alloc(TIMER_LASERDISC_PHILIPS);
+ m_laserdisc_bit_timer = timer_alloc(FUNC(gottlieb_state::laserdisc_bit_callback), this);
+ m_laserdisc_bit_off_timer = timer_alloc(FUNC(gottlieb_state::laserdisc_bit_off_callback), this);
+ m_laserdisc_philips_timer = timer_alloc(FUNC(gottlieb_state::laserdisc_philips_callback), this);
/* create some audio RAM */
m_laserdisc_audio_buffer = std::make_unique<u8[]>(AUDIORAM_SIZE);
@@ -463,7 +466,7 @@ TIMER_CALLBACK_MEMBER(gottlieb_state::laserdisc_bit_callback)
/* assert the line and set a timer for deassertion */
m_laserdisc->control_w(ASSERT_LINE);
- timer_set(LASERDISC_CLOCK * 10, TIMER_LASERDISC_BIT_OFF);
+ m_laserdisc_bit_off_timer->adjust(LASERDISC_CLOCK * 10);
/* determine how long for the next command; there is a 555 timer with a
variable resistor controlling the timing of the pulses. Nominally, the
@@ -697,27 +700,6 @@ void gottlieb_state::qbert_knocker(machine_config &config)
*
*************************************/
-void gottlieb_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_LASERDISC_PHILIPS:
- laserdisc_philips_callback(param);
- break;
- case TIMER_LASERDISC_BIT_OFF:
- laserdisc_bit_off_callback(param);
- break;
- case TIMER_LASERDISC_BIT:
- laserdisc_bit_callback(param);
- break;
- case TIMER_NMI_CLEAR:
- nmi_clear(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in gottlieb_state::device_timer");
- }
-}
-
TIMER_CALLBACK_MEMBER(gottlieb_state::nmi_clear)
{
m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
@@ -728,7 +710,7 @@ INTERRUPT_GEN_MEMBER(gottlieb_state::interrupt)
{
/* assert the NMI and set a timer to clear it at the first visible line */
device.execute().set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
- timer_set(m_screen->time_until_pos(0), TIMER_NMI_CLEAR);
+ m_nmi_clear_timer->adjust(m_screen->time_until_pos(0));
/* if we have a laserdisc, update it */
if (m_laserdisc != nullptr)
diff --git a/src/mame/drivers/goupil.cpp b/src/mame/drivers/goupil.cpp
index a4e142b048a..c2272e3e88b 100644
--- a/src/mame/drivers/goupil.cpp
+++ b/src/mame/drivers/goupil.cpp
@@ -114,12 +114,7 @@ protected:
virtual void machine_start() override;
virtual void machine_reset() override;
- enum
- {
- TIMER_SCANLINE
- };
-
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(scanline_tick);
private:
void mem(address_map &map);
@@ -165,17 +160,10 @@ private:
* Keyboard I/O Handlers *
***********************************/
-void goupil_g1_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(goupil_g1_state::scanline_tick)
{
- switch (id)
- {
- case TIMER_SCANLINE:
- m_ef9364->update_scanline((uint16_t)m_screen->vpos());
- m_scanline_timer->adjust(m_screen->time_until_pos(m_screen->vpos() + 10));
- break;
- default:
- throw emu_fatalerror("Unknown id in goupil_g1_state::device_timer");
- }
+ m_ef9364->update_scanline((uint16_t)m_screen->vpos());
+ m_scanline_timer->adjust(m_screen->time_until_pos(m_screen->vpos() + 10));
}
void goupil_g1_state::mem(address_map &map)
@@ -453,7 +441,7 @@ void goupil_base_state::machine_reset()
void goupil_g1_state::machine_start()
{
- m_scanline_timer = timer_alloc(TIMER_SCANLINE);
+ m_scanline_timer = timer_alloc(FUNC(goupil_g1_state::scanline_tick), this);
}
void goupil_g1_state::machine_reset()
diff --git a/src/mame/drivers/gp32.cpp b/src/mame/drivers/gp32.cpp
index 9e78be20031..aaafd025e63 100644
--- a/src/mame/drivers/gp32.cpp
+++ b/src/mame/drivers/gp32.cpp
@@ -1606,18 +1606,18 @@ void gp32_state::s3c240x_mmc_w(offs_t offset, uint32_t data, uint32_t mem_mask)
void gp32_state::s3c240x_machine_start()
{
- m_s3c240x_pwm_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_pwm_timer_exp),this));
- m_s3c240x_pwm_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_pwm_timer_exp),this));
- m_s3c240x_pwm_timer[2] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_pwm_timer_exp),this));
- m_s3c240x_pwm_timer[3] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_pwm_timer_exp),this));
- m_s3c240x_pwm_timer[4] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_pwm_timer_exp),this));
- m_s3c240x_dma_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_dma_timer_exp),this));
- m_s3c240x_dma_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_dma_timer_exp),this));
- m_s3c240x_dma_timer[2] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_dma_timer_exp),this));
- m_s3c240x_dma_timer[3] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_dma_timer_exp),this));
- m_s3c240x_iic_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_iic_timer_exp),this));
- m_s3c240x_iis_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_iis_timer_exp),this));
- m_s3c240x_lcd_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_lcd_timer_exp),this));
+ m_s3c240x_pwm_timer[0] = timer_alloc(FUNC(gp32_state::s3c240x_pwm_timer_exp), this);
+ m_s3c240x_pwm_timer[1] = timer_alloc(FUNC(gp32_state::s3c240x_pwm_timer_exp), this);
+ m_s3c240x_pwm_timer[2] = timer_alloc(FUNC(gp32_state::s3c240x_pwm_timer_exp), this);
+ m_s3c240x_pwm_timer[3] = timer_alloc(FUNC(gp32_state::s3c240x_pwm_timer_exp), this);
+ m_s3c240x_pwm_timer[4] = timer_alloc(FUNC(gp32_state::s3c240x_pwm_timer_exp), this);
+ m_s3c240x_dma_timer[0] = timer_alloc(FUNC(gp32_state::s3c240x_dma_timer_exp), this);
+ m_s3c240x_dma_timer[1] = timer_alloc(FUNC(gp32_state::s3c240x_dma_timer_exp), this);
+ m_s3c240x_dma_timer[2] = timer_alloc(FUNC(gp32_state::s3c240x_dma_timer_exp), this);
+ m_s3c240x_dma_timer[3] = timer_alloc(FUNC(gp32_state::s3c240x_dma_timer_exp), this);
+ m_s3c240x_iic_timer = timer_alloc(FUNC(gp32_state::s3c240x_iic_timer_exp), this);
+ m_s3c240x_iis_timer = timer_alloc(FUNC(gp32_state::s3c240x_iis_timer_exp), this);
+ m_s3c240x_lcd_timer = timer_alloc(FUNC(gp32_state::s3c240x_lcd_timer_exp), this);
m_eeprom_data = std::make_unique<uint8_t[]>(0x2000); // a dump of the EEPROM (S524AB0X91) resulted to be 0x1000
m_nvram->set_base(m_eeprom_data.get(), 0x2000);
smc_init();
diff --git a/src/mame/drivers/gpworld.cpp b/src/mame/drivers/gpworld.cpp
index b5e1481cd88..fb120d40715 100644
--- a/src/mame/drivers/gpworld.cpp
+++ b/src/mame/drivers/gpworld.cpp
@@ -51,56 +51,57 @@ Dumping Notes:
class gpworld_state : public driver_device
{
public:
- enum
- {
- TIMER_IRQ_STOP
- };
-
gpworld_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
- m_laserdisc(*this, "laserdisc") ,
+ m_laserdisc(*this, "laserdisc"),
m_sprite_ram(*this, "sprite_ram"),
m_palette_ram(*this, "palette_ram"),
m_tile_ram(*this, "tile_ram"),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette") { }
+ m_palette(*this, "palette")
+ {
+ }
void gpworld(machine_config &config);
- void init_gpworld();
-
private:
- uint8_t m_nmi_enable = 0;
- uint8_t m_start_lamp = 0;
- uint8_t m_ldp_read_latch = 0;
- uint8_t m_ldp_write_latch = 0;
- uint8_t m_brake_gas = 0;
- emu_timer *m_irq_stop_timer = nullptr;
- required_device<pioneer_ldv1000_device> m_laserdisc;
- required_shared_ptr<uint8_t> m_sprite_ram;
- required_shared_ptr<uint8_t> m_palette_ram;
- required_shared_ptr<uint8_t> m_tile_ram;
- uint8_t ldp_read();
- uint8_t pedal_in();
+ virtual void machine_start() override;
+ virtual void driver_init() override;
+
+ void mainmem(address_map &map);
+ void mainport(address_map &map);
+
+ TIMER_CALLBACK_MEMBER(irq_stop);
+
void ldp_write(uint8_t data);
void misc_io_write(uint8_t data);
void brake_gas_write(uint8_t data);
void palette_write(offs_t offset, uint8_t data);
- virtual void machine_start() override;
+
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(vblank_callback);
- void draw_tiles(bitmap_rgb32 &bitmap,const rectangle &cliprect);
- inline void draw_pixel(bitmap_rgb32 &bitmap,const rectangle &cliprect,int x,int y,int color,int flip);
+ void draw_tiles(bitmap_rgb32 &bitmap, const rectangle &cliprect);
+ void draw_pixel(bitmap_rgb32 &bitmap, const rectangle &cliprect, int x, int y, int color, int flip);
void draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect);
+
+ emu_timer *m_irq_stop_timer = nullptr;
+
+ required_device<pioneer_ldv1000_device> m_laserdisc;
+ required_shared_ptr<uint8_t> m_sprite_ram;
+ required_shared_ptr<uint8_t> m_palette_ram;
+ required_shared_ptr<uint8_t> m_tile_ram;
required_device<cpu_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
- void mainmem(address_map &map);
- void mainport(address_map &map);
-
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ uint8_t m_nmi_enable = 0;
+ uint8_t m_start_lamp = 0;
+ uint8_t m_ldp_read_latch = 0;
+ uint8_t m_ldp_write_latch = 0;
+ uint8_t m_brake_gas = 0;
+ uint8_t ldp_read();
+ uint8_t pedal_in();
};
@@ -129,7 +130,7 @@ void gpworld_state::draw_tiles(bitmap_rgb32 &bitmap,const rectangle &cliprect)
}
}
-void gpworld_state::draw_pixel(bitmap_rgb32 &bitmap,const rectangle &cliprect,int x,int y,int color,int flip)
+void gpworld_state::draw_pixel(bitmap_rgb32 &bitmap, const rectangle &cliprect, int x, int y, int color, int flip)
{
if (flip)
{
@@ -153,19 +154,15 @@ void gpworld_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect
const int SPR_GFXOFS_HI = 7;
int flip = flip_screen();
- int i;
-
uint8_t *GFX = memregion("gfx2")->base();
/* Heisted from Daphne which heisted it from MAME */
- for (i = 0; i < 0x800; i += 8)
+ for (int i = 0; i < 0x800; i += 8)
{
uint8_t *spr_reg = m_sprite_ram + i;
if (spr_reg[SPR_Y_BOTTOM] && spr_reg[SPR_X_LO] != 0xff)
{
- int row;
-
int src = spr_reg[SPR_GFXOFS_LO] + (spr_reg[SPR_GFXOFS_HI] << 8);
int skip = spr_reg[SPR_SKIP_LO] + (spr_reg[SPR_SKIP_HI] << 8);
@@ -185,28 +182,23 @@ void gpworld_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect
draw_pixel(bitmap,cliprect,sx,sy,0xffffffff,flip);
*/
- for (row = 0; row < height; row++)
+ for (int row = 0; row < height; row++)
{
- int x, y;
- int src2;
-
- src = src2 = src + skip;
+ int src2 = src + skip;
+ src = src2;
- x = sx;
- y = sy+row;
+ int x = sx;
+ int y = sy+row;
while (1)
{
- int data_lo, data_high;
- uint8_t pixel1, pixel2, pixel3, pixel4;
+ uint8_t data_lo = GFX[(src2 & 0x7fff) | (sprite_bank << 16)];
+ uint8_t data_high = GFX[(src2 & 0x7fff) | 0x8000 | (sprite_bank << 16)];
- data_lo = GFX[(src2 & 0x7fff) | (sprite_bank << 16)];
- data_high = GFX[(src2 & 0x7fff) | 0x8000 | (sprite_bank << 16)];
-
- pixel1 = data_high >> 0x04;
- pixel2 = data_high & 0x0f;
- pixel3 = data_lo >> 0x04;
- pixel4 = data_lo & 0x0f;
+ uint8_t pixel1 = data_high >> 0x04;
+ uint8_t pixel2 = data_high & 0x0f;
+ uint8_t pixel3 = data_lo >> 0x04;
+ uint8_t pixel4 = data_lo & 0x0f;
/* we'll see if this is still applicable */
if (src & 0x8000)
@@ -228,19 +220,19 @@ void gpworld_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect
}
/* Daphne says "don't draw the pixel if it's black". */
- draw_pixel(bitmap,cliprect,x+0,y,m_palette->pen_color(pixel1 + (sprite_color*0x10 + 0x200)),flip);
- draw_pixel(bitmap,cliprect,x+1,y,m_palette->pen_color(pixel2 + (sprite_color*0x10 + 0x200)),flip);
- draw_pixel(bitmap,cliprect,x+2,y,m_palette->pen_color(pixel3 + (sprite_color*0x10 + 0x200)),flip);
- draw_pixel(bitmap,cliprect,x+3,y,m_palette->pen_color(pixel4 + (sprite_color*0x10 + 0x200)),flip);
+ draw_pixel(bitmap, cliprect, x+0, y, m_palette->pen_color(pixel1 + sprite_color * 0x10 + 0x200), flip);
+ draw_pixel(bitmap, cliprect, x+1, y, m_palette->pen_color(pixel2 + sprite_color * 0x10 + 0x200), flip);
+ draw_pixel(bitmap, cliprect, x+2, y, m_palette->pen_color(pixel3 + sprite_color * 0x10 + 0x200), flip);
+ draw_pixel(bitmap, cliprect, x+3, y, m_palette->pen_color(pixel4 + sprite_color * 0x10 + 0x200), flip);
x += 4;
/* stop drawing when the sprite data is 0xf */
- if (((data_lo & 0x0f) == 0x0f) && (!(src & 0x8000)))
+ if ((data_lo & 0x0f) == 0x0f && !(src & 0x8000))
{
break;
}
- else if ((src & 0x8000) && ((data_high & 0xf0) == 0xf0))
+ else if ((src & 0x8000) && (data_high & 0xf0) == 0xf0)
{
break;
}
@@ -264,7 +256,7 @@ uint32_t gpworld_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma
void gpworld_state::machine_start()
{
- m_irq_stop_timer = timer_alloc(TIMER_IRQ_STOP);
+ m_irq_stop_timer = timer_alloc(FUNC(gpworld_state::irq_stop), this);
}
@@ -454,16 +446,9 @@ static INPUT_PORTS_START( gpworld )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
INPUT_PORTS_END
-void gpworld_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(gpworld_state::irq_stop)
{
- switch (id)
- {
- case TIMER_IRQ_STOP:
- m_maincpu->set_input_line(0, CLEAR_LINE);
- break;
- default:
- throw emu_fatalerror("Unknown id in gpworld_state::device_timer");
- }
+ m_maincpu->set_input_line(0, CLEAR_LINE);
}
INTERRUPT_GEN_MEMBER(gpworld_state::vblank_callback)
@@ -559,7 +544,7 @@ ROM_START( gpworld )
ROM_END
-void gpworld_state::init_gpworld()
+void gpworld_state::driver_init()
{
m_nmi_enable = 0;
m_start_lamp = 0;
@@ -568,5 +553,5 @@ void gpworld_state::init_gpworld()
}
-/* YEAR NAME PARENT MACHINE INPUT STATE INIT MONITOR COMPANY FULLNAME FLAGS) */
-GAME( 1984, gpworld, 0, gpworld, gpworld, gpworld_state, init_gpworld, ROT0, "Sega", "GP World", MACHINE_NOT_WORKING|MACHINE_NO_SOUND)
+/* YEAR NAME PARENT MACHINE INPUT STATE INIT MONITOR COMPANY FULLNAME FLAGS) */
+GAME( 1984, gpworld, 0, gpworld, gpworld, gpworld_state, empty_init, ROT0, "Sega", "GP World", MACHINE_NOT_WORKING|MACHINE_NO_SOUND)
diff --git a/src/mame/drivers/gridlee.cpp b/src/mame/drivers/gridlee.cpp
index e2c7413dbff..c064a7fb669 100644
--- a/src/mame/drivers/gridlee.cpp
+++ b/src/mame/drivers/gridlee.cpp
@@ -146,10 +146,10 @@ void gridlee_state::machine_start()
save_item(NAME(m_last_analog_input));
save_item(NAME(m_last_analog_output));
- m_irq_off = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gridlee_state::irq_off_tick),this));
- m_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gridlee_state::irq_timer_tick),this));
- m_firq_off = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gridlee_state::firq_off_tick),this));
- m_firq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gridlee_state::firq_timer_tick),this));
+ m_irq_off = timer_alloc(FUNC(gridlee_state::irq_off_tick), this);
+ m_irq_timer = timer_alloc(FUNC(gridlee_state::irq_timer_tick), this);
+ m_firq_off = timer_alloc(FUNC(gridlee_state::firq_off_tick), this);
+ m_firq_timer = timer_alloc(FUNC(gridlee_state::firq_timer_tick), this);
}
diff --git a/src/mame/drivers/gticlub.cpp b/src/mame/drivers/gticlub.cpp
index e9284a806e6..658bf7706dd 100644
--- a/src/mame/drivers/gticlub.cpp
+++ b/src/mame/drivers/gticlub.cpp
@@ -466,7 +466,7 @@ void gticlub_state::machine_start()
// configure fast RAM regions for DRC
m_maincpu->ppcdrc_add_fastram(0x00000000, 0x000fffff, false, m_work_ram);
- m_sound_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gticlub_state::sound_irq), this));
+ m_sound_irq_timer = timer_alloc(FUNC(gticlub_state::sound_irq), this);
}
void gticlub_state::gticlub_map(address_map &map)
diff --git a/src/mame/drivers/gunbustr.cpp b/src/mame/drivers/gunbustr.cpp
index 2f34266348b..e6b7d0611cb 100644
--- a/src/mame/drivers/gunbustr.cpp
+++ b/src/mame/drivers/gunbustr.cpp
@@ -59,16 +59,9 @@
/*********************************************************************/
-void gunbustr_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(gunbustr_state::trigger_irq5)
{
- switch (id)
- {
- case TIMER_GUNBUSTR_INTERRUPT5:
- m_maincpu->set_input_line(5, HOLD_LINE);
- break;
- default:
- throw emu_fatalerror("Unknown id in gunbustr_state::device_timer");
- }
+ m_maincpu->set_input_line(5, HOLD_LINE);
}
INTERRUPT_GEN_MEMBER(gunbustr_state::gunbustr_interrupt)
@@ -381,7 +374,7 @@ void gunbustr_state::init_gunbustr()
/* Speedup handler */
m_maincpu->space(AS_PROGRAM).install_read_handler(0x203acc, 0x203acf, read32smo_delegate(*this, FUNC(gunbustr_state::main_cycle_r)));
- m_interrupt5_timer = timer_alloc(TIMER_GUNBUSTR_INTERRUPT5);
+ m_interrupt5_timer = timer_alloc(FUNC(gunbustr_state::trigger_irq5), this);
}
void gunbustr_state::init_gunbustrj()
diff --git a/src/mame/drivers/gunpey.cpp b/src/mame/drivers/gunpey.cpp
index 6b61f4ac72e..454fe910fa2 100644
--- a/src/mame/drivers/gunpey.cpp
+++ b/src/mame/drivers/gunpey.cpp
@@ -352,7 +352,7 @@ void gunpey_state::video_start()
m_vram = std::make_unique<u8[]>(0x400000);
std::fill_n(&m_vram[0], 0x400000, 0xff);
- m_blitter_end_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gunpey_state::blitter_end), this));
+ m_blitter_end_timer = timer_alloc(FUNC(gunpey_state::blitter_end), this);
save_item(NAME(m_vram_bank));
save_item(NAME(m_vreg_addr));
diff --git a/src/mame/drivers/h01x.cpp b/src/mame/drivers/h01x.cpp
index d8aac2a3898..c2c9625c48c 100644
--- a/src/mame/drivers/h01x.cpp
+++ b/src/mame/drivers/h01x.cpp
@@ -444,7 +444,7 @@ void h01x_state::machine_start()
save_item(NAME(m_bank));
save_item(NAME(m_cassette_data));
- m_cassette_data_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(h01x_state::cassette_data_callback), this));
+ m_cassette_data_timer = timer_alloc(FUNC(h01x_state::cassette_data_callback), this);
m_cassette_data_timer->adjust(attotime::zero, 0, attotime::from_hz(48000));
}
diff --git a/src/mame/drivers/h19.cpp b/src/mame/drivers/h19.cpp
index 1f2bb71d819..8fdf9a97109 100644
--- a/src/mame/drivers/h19.cpp
+++ b/src/mame/drivers/h19.cpp
@@ -78,12 +78,6 @@ Address Description
class h19_state : public driver_device
{
public:
- enum
- {
- TIMER_KEY_CLICK_OFF,
- TIMER_BELL_OFF
- };
-
h19_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag)
, m_palette(*this, "palette")
@@ -102,8 +96,13 @@ public:
void h19(machine_config &config);
private:
- void h19_keyclick_w(uint8_t data);
- void h19_bell_w(uint8_t data);
+ virtual void machine_start() override;
+
+ void mem_map(address_map &map);
+ void io_map(address_map &map);
+
+ void key_click_w(uint8_t data);
+ void bell_w(uint8_t data);
uint8_t kbd_key_r();
uint8_t kbd_flags_r();
DECLARE_READ_LINE_MEMBER(mm5740_shift_r);
@@ -112,11 +111,11 @@ private:
MC6845_UPDATE_ROW(crtc_update_row);
- void io_map(address_map &map);
- void mem_map(address_map &map);
+ TIMER_CALLBACK_MEMBER(key_click_off);
+ TIMER_CALLBACK_MEMBER(bell_off);
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
- virtual void machine_start() override;
+ emu_timer *m_key_click_timer = nullptr;
+ emu_timer *m_bell_timer = nullptr;
required_device<palette_device> m_palette;
required_device<cpu_device> m_maincpu;
@@ -137,19 +136,17 @@ private:
uint16_t translate_mm5740_b(uint16_t b);
};
-void h19_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(h19_state::key_click_off)
{
- switch (id)
- {
- case TIMER_KEY_CLICK_OFF:
- m_keyclickactive = false;
- break;
- case TIMER_BELL_OFF:
- m_bellactive = false;
- break;
- default:
- throw emu_fatalerror("Unknown id in h19_state::device_timer");
- }
+ m_keyclickactive = false;
+
+ if (!m_keyclickactive && !m_bellactive)
+ m_beep->set_state(0);
+}
+
+TIMER_CALLBACK_MEMBER(h19_state::bell_off)
+{
+ m_keyclickactive = false;
if (!m_keyclickactive && !m_bellactive)
m_beep->set_state(0);
@@ -175,9 +172,9 @@ void h19_state::io_map(address_map &map)
map(0x60, 0x60).mirror(0x1E).w(m_crtc, FUNC(mc6845_device::address_w));
map(0x61, 0x61).mirror(0x1E).rw(m_crtc, FUNC(mc6845_device::register_r), FUNC(mc6845_device::register_w));
map(0x80, 0x80).mirror(0x1f).r(FUNC(h19_state::kbd_key_r));
- map(0xA0, 0xA0).mirror(0x1f).r(FUNC(h19_state::kbd_flags_r));
- map(0xC0, 0xC0).mirror(0x1f).w(FUNC(h19_state::h19_keyclick_w));
- map(0xE0, 0xE0).mirror(0x1f).w(FUNC(h19_state::h19_bell_w));
+ map(0xa0, 0xa0).mirror(0x1f).r(FUNC(h19_state::kbd_flags_r));
+ map(0xc0, 0xc0).mirror(0x1f).w(FUNC(h19_state::key_click_w));
+ map(0xe0, 0xe0).mirror(0x1f).w(FUNC(h19_state::bell_w));
}
/* Input ports */
@@ -357,7 +354,7 @@ static INPUT_PORTS_START( h19 )
INPUT_PORTS_END
// Keyboard encoder masks
-#define KB_ENCODER_KEY_VALUE_MASK 0x7F
+#define KB_ENCODER_KEY_VALUE_MASK 0x7f
#define KB_ENCODER_CONTROL_KEY_MASK 0x80
// Keyboard flag masks
@@ -375,25 +372,28 @@ void h19_state::machine_start()
save_item(NAME(m_strobe));
save_item(NAME(m_keyclickactive));
save_item(NAME(m_bellactive));
+
+ m_key_click_timer = timer_alloc(FUNC(h19_state::key_click_off), this);
+ m_bell_timer = timer_alloc(FUNC(h19_state::bell_off), this);
}
-void h19_state::h19_keyclick_w(uint8_t data)
+void h19_state::key_click_w(uint8_t data)
{
/* Keyclick - 6 mSec */
m_beep->set_state(1);
m_keyclickactive = true;
- timer_set(attotime::from_msec(6), TIMER_KEY_CLICK_OFF);
+ m_key_click_timer->adjust(attotime::from_msec(6));
}
-void h19_state::h19_bell_w(uint8_t data)
+void h19_state::bell_w(uint8_t data)
{
/* Bell (^G) - 200 mSec */
m_beep->set_state(1);
m_bellactive = true;
- timer_set(attotime::from_msec(200), TIMER_BELL_OFF);
+ m_bell_timer->adjust(attotime::from_msec(200));
}
@@ -433,7 +433,7 @@ uint8_t h19_state::kbd_flags_r()
uint8_t rv = modifiers & 0x7f;
// check both shifts
- if (((modifiers & 0x020) == 0) || ((modifiers & 0x100) == 0))
+ if ((modifiers & 0x020) == 0 || (modifiers & 0x100) == 0)
{
rv |= KB_STATUS_SHIFT_KEYS_MASK;
}
diff --git a/src/mame/drivers/halleys.cpp b/src/mame/drivers/halleys.cpp
index 412c8a3140b..9dc32c9da45 100644
--- a/src/mame/drivers/halleys.cpp
+++ b/src/mame/drivers/halleys.cpp
@@ -2248,7 +2248,7 @@ void halleys_state::init_benberob()
init_common();
- m_blitter_reset_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(halleys_state::blitter_reset),this));
+ m_blitter_reset_timer = timer_alloc(FUNC(halleys_state::blitter_reset), this);
}
diff --git a/src/mame/drivers/hazeltin.cpp b/src/mame/drivers/hazeltin.cpp
index 79ced7c59d9..6a0e59f61e3 100644
--- a/src/mame/drivers/hazeltin.cpp
+++ b/src/mame/drivers/hazeltin.cpp
@@ -141,9 +141,6 @@ public:
private:
virtual void machine_start() override;
virtual void machine_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
- static const device_timer_id TIMER_IOWQ = 0;
uint32_t screen_update_hazl1500(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
@@ -172,6 +169,8 @@ private:
void hazl1500_io(address_map &map);
void hazl1500_mem(address_map &map);
+ TIMER_CALLBACK_MEMBER(update_iowq);
+
required_device<cpu_device> m_maincpu;
required_device<netlist_mame_device> m_video_board;
required_device<netlist_mame_ram_pointer_device> m_u9;
@@ -233,7 +232,7 @@ void hazl1500_state::machine_start()
{
m_screen_buf = std::make_unique<float[]>(SCREEN_HTOTAL * SCREEN_VTOTAL);
- m_iowq_timer = timer_alloc(TIMER_IOWQ);
+ m_iowq_timer = timer_alloc(FUNC(hazl1500_state::update_iowq), this);
m_iowq_timer->adjust(attotime::never);
m_uart->write_swe(0);
@@ -253,7 +252,7 @@ void hazl1500_state::machine_reset()
m_kbd_status_latch = 0;
}
-void hazl1500_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(hazl1500_state::update_iowq)
{
m_cpu_iowq->write(1);
m_cpu_ba4->write(1);
@@ -394,7 +393,6 @@ WRITE_LINE_MEMBER(hazl1500_state::ay3600_data_ready_w)
NETDEV_ANALOG_CALLBACK_MEMBER(hazl1500_state::vblank_cb)
{
- synchronize();
if (int(data) > 1)
{
m_kbd_status_latch &= ~KBD_STATUS_TV_UB;
@@ -407,7 +405,6 @@ NETDEV_ANALOG_CALLBACK_MEMBER(hazl1500_state::vblank_cb)
NETDEV_ANALOG_CALLBACK_MEMBER(hazl1500_state::tvinterq_cb)
{
- synchronize();
if (int(data) > 1)
{
m_kbd_status_latch &= ~KBD_STATUS_TV_INT;
@@ -422,7 +419,6 @@ NETDEV_ANALOG_CALLBACK_MEMBER(hazl1500_state::tvinterq_cb)
NETDEV_ANALOG_CALLBACK_MEMBER(hazl1500_state::video_out_cb)
{
- synchronize();
attotime second_fraction(0, time.attoseconds());
attotime frame_fraction(0, (second_fraction * 60).attoseconds());
attotime pixel_time = frame_fraction * (SCREEN_HTOTAL * SCREEN_VTOTAL);
@@ -461,7 +457,6 @@ NETDEV_ANALOG_CALLBACK_MEMBER(hazl1500_state::video_out_cb)
void hazl1500_state::refresh_address_w(uint8_t data)
{
- synchronize();
//printf("refresh: %02x, %d, %d\n", data, m_screen->hpos(), m_screen->vpos());
m_iowq_timer->adjust(attotime::from_hz(XTAL(18'000'000)/9));
m_cpu_iowq->write(0);
diff --git a/src/mame/drivers/hh_sm510.cpp b/src/mame/drivers/hh_sm510.cpp
index 7f65e88ec8a..3ba1fa0192d 100644
--- a/src/mame/drivers/hh_sm510.cpp
+++ b/src/mame/drivers/hh_sm510.cpp
@@ -171,7 +171,7 @@ void hh_sm510_state::machine_start()
}
// 1kHz display decay ticks
- m_display_decay_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(hh_sm510_state::display_decay_tick),this));
+ m_display_decay_timer = timer_alloc(FUNC(hh_sm510_state::display_decay_tick), this);
m_display_decay_timer->adjust(attotime::from_hz(1024), 0, attotime::from_hz(1024));
// register for savestates
diff --git a/src/mame/drivers/hng64.cpp b/src/mame/drivers/hng64.cpp
index 12d1509ab98..3809c0cbb0d 100644
--- a/src/mame/drivers/hng64.cpp
+++ b/src/mame/drivers/hng64.cpp
@@ -2047,8 +2047,8 @@ void hng64_state::machine_start()
m_irq_pending = 0;
- m_3dfifo_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(hng64_state::hng64_3dfifo_processed), this));
- m_comhack_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(hng64_state::comhack_callback), this));
+ m_3dfifo_timer = timer_alloc(FUNC(hng64_state::hng64_3dfifo_processed), this);
+ m_comhack_timer = timer_alloc(FUNC(hng64_state::comhack_callback), this);
init_io();
}
@@ -2350,8 +2350,8 @@ TIMER_CALLBACK_MEMBER(hng64_state::tempio_irqoff_callback)
void hng64_state::init_io()
{
- m_tempio_irqon_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(hng64_state::tempio_irqon_callback), this));
- m_tempio_irqoff_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(hng64_state::tempio_irqoff_callback), this));
+ m_tempio_irqon_timer = timer_alloc(FUNC(hng64_state::tempio_irqon_callback), this);
+ m_tempio_irqoff_timer = timer_alloc(FUNC(hng64_state::tempio_irqoff_callback), this);
m_port7 = 0x00;
m_port1 = 0x00;
diff --git a/src/mame/drivers/hornet.cpp b/src/mame/drivers/hornet.cpp
index 80abb1d9433..7558d64634d 100644
--- a/src/mame/drivers/hornet.cpp
+++ b/src/mame/drivers/hornet.cpp
@@ -1067,7 +1067,7 @@ void hornet_state::machine_start()
save_pointer(NAME(m_jvs_sdata), 1024);
save_item(NAME(m_jvs_sdata_ptr));
- m_sound_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(hornet_state::sound_irq), this));
+ m_sound_irq_timer = timer_alloc(FUNC(hornet_state::sound_irq), this);
}
void hornet_state::machine_reset()
diff --git a/src/mame/drivers/hp9k_3xx.cpp b/src/mame/drivers/hp9k_3xx.cpp
index 0bfe6f09e88..d97f31c0eb1 100644
--- a/src/mame/drivers/hp9k_3xx.cpp
+++ b/src/mame/drivers/hp9k_3xx.cpp
@@ -233,7 +233,7 @@ void hp9k3xx_state::machine_reset()
void hp9k3xx_state::machine_start()
{
- m_bus_error_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(hp9k3xx_state::bus_error_timeout), this));
+ m_bus_error_timer = timer_alloc(FUNC(hp9k3xx_state::bus_error_timeout), this);
m_bus_error = false;
save_item(NAME(m_bus_error));
}
diff --git a/src/mame/drivers/hp_ipc.cpp b/src/mame/drivers/hp_ipc.cpp
index 9dbe616aaf0..3c554d83f98 100644
--- a/src/mame/drivers/hp_ipc.cpp
+++ b/src/mame/drivers/hp_ipc.cpp
@@ -413,7 +413,8 @@ public:
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(clear_bus_error);
private:
uint16_t mem_r(offs_t offset, uint16_t mem_mask);
@@ -478,7 +479,7 @@ private:
};
-void hp_ipc_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(hp_ipc_state::clear_bus_error)
{
m_bus_error = false;
}
@@ -735,7 +736,7 @@ WRITE_LINE_MEMBER(hp_ipc_state::irq_7)
void hp_ipc_state::machine_start()
{
- m_bus_error_timer = timer_alloc(0);
+ m_bus_error_timer = timer_alloc(FUNC(hp_ipc_state::clear_bus_error), this);
m_bus_error = false;
m_bankdev->set_bank(1);
diff --git a/src/mame/drivers/hyprduel.cpp b/src/mame/drivers/hyprduel.cpp
index 37a5df62d31..7cde490f9ff 100644
--- a/src/mame/drivers/hyprduel.cpp
+++ b/src/mame/drivers/hyprduel.cpp
@@ -399,7 +399,7 @@ void hyprduel_state::machine_start()
save_item(NAME(m_subcpu_resetline));
save_item(NAME(m_cpu_trigger));
- m_vblank_end_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(hyprduel_state::vblank_end_callback), this));
+ m_vblank_end_timer = timer_alloc(FUNC(hyprduel_state::vblank_end_callback), this);
}
void hyprduel_state::i4220_config(machine_config &config)
diff --git a/src/mame/drivers/ibmpcjr.cpp b/src/mame/drivers/ibmpcjr.cpp
index b2dded4d58b..3122a3343af 100644
--- a/src/mame/drivers/ibmpcjr.cpp
+++ b/src/mame/drivers/ibmpcjr.cpp
@@ -49,9 +49,20 @@ public:
void ibmpcjx(machine_config &config);
void ibmpcjr(machine_config &config);
- void init_pcjr();
-
private:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void driver_init() override;
+
+ void ibmpcjr_io(address_map &map);
+ void ibmpcjr_map(address_map &map);
+ void ibmpcjx_io(address_map &map);
+ void ibmpcjx_map(address_map &map);
+
+ TIMER_CALLBACK_MEMBER(delayed_irq);
+ TIMER_CALLBACK_MEMBER(watchdog_expired);
+ TIMER_CALLBACK_MEMBER(kb_signal);
+
required_device<cpu_device> m_maincpu;
required_device<pic8259_device> m_pic8259;
required_device<pit8253_device> m_pit8253;
@@ -99,23 +110,9 @@ private:
int m_signal_count = 0;
uint8_t m_nmi_enabled = 0;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
emu_timer *m_pc_int_delay_timer = nullptr;
emu_timer *m_pcjr_watchdog = nullptr;
emu_timer *m_keyb_signal_timer = nullptr;
-
- enum
- {
- TIMER_IRQ_DELAY,
- TIMER_WATCHDOG,
- TIMER_KB_SIGNAL
- };
-
- void machine_reset() override;
- void ibmpcjr_io(address_map &map);
- void ibmpcjr_map(address_map &map);
- void ibmpcjx_io(address_map &map);
- void ibmpcjx_map(address_map &map);
};
static INPUT_PORTS_START( ibmpcjr )
@@ -125,14 +122,18 @@ static INPUT_PORTS_START( ibmpcjr )
PORT_BIT ( 0x07, 0x07, IPT_UNUSED )
INPUT_PORTS_END
-void pcjr_state::init_pcjr()
+void pcjr_state::driver_init()
{
- m_pc_int_delay_timer = timer_alloc(TIMER_IRQ_DELAY);
- m_pcjr_watchdog = timer_alloc(TIMER_WATCHDOG);
- m_keyb_signal_timer = timer_alloc(TIMER_KB_SIGNAL);
m_maincpu->space(AS_PROGRAM).install_ram(0, m_ram->size() - 1, m_ram->pointer());
}
+void pcjr_state::machine_start()
+{
+ m_pc_int_delay_timer = timer_alloc(FUNC(pcjr_state::delayed_irq), this);
+ m_pcjr_watchdog = timer_alloc(FUNC(pcjr_state::watchdog_expired), this);
+ m_keyb_signal_timer = timer_alloc(FUNC(pcjr_state::kb_signal), this);
+}
+
void pcjr_state::machine_reset()
{
m_pc_spkrdata = 0;
@@ -153,31 +154,28 @@ void pcjr_state::machine_reset()
m_nmi_enabled = 0x80;
}
-void pcjr_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(pcjr_state::delayed_irq)
{
- switch(id)
+ m_maincpu->set_input_line(0, param ? ASSERT_LINE : CLEAR_LINE);
+}
+
+TIMER_CALLBACK_MEMBER(pcjr_state::watchdog_expired)
+{
+ if (m_pcjr_dor & 0x20)
+ m_pic8259->ir6_w(1);
+ else
+ m_pic8259->ir6_w(0);
+}
+
+TIMER_CALLBACK_MEMBER(pcjr_state::kb_signal)
+{
+ m_raw_keyb_data = m_raw_keyb_data >> 1;
+ m_signal_count--;
+
+ if (m_signal_count <= 0)
{
- case TIMER_IRQ_DELAY:
- m_maincpu->set_input_line(0, param ? ASSERT_LINE : CLEAR_LINE);
- break;
-
- case TIMER_WATCHDOG:
- if(m_pcjr_dor & 0x20)
- m_pic8259->ir6_w(1);
- else
- m_pic8259->ir6_w(0);
- break;
-
- case TIMER_KB_SIGNAL:
- m_raw_keyb_data = m_raw_keyb_data >> 1;
- m_signal_count--;
-
- if ( m_signal_count <= 0 )
- {
- m_keyb_signal_timer->adjust( attotime::never, 0, attotime::never );
- m_transferring = 0;
- }
- break;
+ m_keyb_signal_timer->adjust(attotime::never, 0, attotime::never);
+ m_transferring = 0;
}
}
@@ -269,11 +267,8 @@ WRITE_LINE_MEMBER(pcjr_state::keyb_interrupt)
{
int data;
- if(state && (data = m_keyboard->read()))
+ if (state && (data = m_keyboard->read()))
{
- uint8_t parity = 0;
- int i;
-
m_latch = 1;
if(m_transferring)
@@ -282,29 +277,30 @@ WRITE_LINE_MEMBER(pcjr_state::keyb_interrupt)
m_pc_keyb_data = data;
/* Calculate the raw data */
- for( i = 0; i < 8; i++ )
+ uint8_t parity = 0;
+ for (int i = 0; i < 8; i++)
{
- if ( ( 1 << i ) & data )
+ if (BIT(data, i))
{
parity ^= 1;
}
}
m_raw_keyb_data = 0;
- m_raw_keyb_data = ( m_raw_keyb_data << 2 ) | ( parity ? 1 : 2 );
- for( i = 0; i < 8; i++ )
+ m_raw_keyb_data = (m_raw_keyb_data << 2) | (parity ? 1 : 2);
+ for (int i = 0; i < 8; i++)
{
- m_raw_keyb_data = ( m_raw_keyb_data << 2 ) | ( ( data & 0x80 ) ? 1 : 2 );
+ m_raw_keyb_data = (m_raw_keyb_data << 2) | ((data & 0x80) ? 1 : 2);
data <<= 1;
}
/* Insert start bit */
- m_raw_keyb_data = ( m_raw_keyb_data << 2 ) | 1;
+ m_raw_keyb_data = (m_raw_keyb_data << 2) | 1;
m_signal_count = 20 + 22;
/* we are now transferring a byte of keyboard data */
m_transferring = 1;
/* Set timer */
- m_keyb_signal_timer->adjust( attotime::from_usec(220), 0, attotime::from_usec(220) );
+ m_keyb_signal_timer->adjust(attotime::from_usec(220), 0, attotime::from_usec(220));
m_maincpu->set_input_line(INPUT_LINE_NMI, m_nmi_enabled && m_latch);
}
}
@@ -328,9 +324,9 @@ void pcjr_state::pcjr_ppi_portb_w(uint8_t data)
m_ppi_portb = data;
m_ppi_portc_switch_high = data & 0x08;
m_pit8253->write_gate2(BIT(data, 0));
- pc_speaker_set_spkrdata( data & 0x02 );
+ pc_speaker_set_spkrdata(data & 0x02);
- m_cassette->change_state(( data & 0x08 ) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR);
+ m_cassette->change_state((data & 0x08) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR);
}
/*
@@ -346,18 +342,18 @@ void pcjr_state::pcjr_ppi_portb_w(uint8_t data)
*/
uint8_t pcjr_state::pcjr_ppi_portc_r()
{
- int data=0xff;
+ int data = 0xff;
- data&=~0x80;
+ data &= ~0x80;
data &= ~0x04; /* floppy drive installed */
- if ( m_ram->size() > 64 * 1024 ) /* more than 64KB ram installed */
+ if (m_ram->size() > 64 * 1024) /* more than 64KB ram installed */
data &= ~0x08;
- data = ( data & ~0x01 ) | ( m_latch ? 0x01: 0x00 );
- if ( ! ( m_ppi_portb & 0x08 ) )
+ data = (data & ~0x01) | (m_latch ? 0x01 : 0x00);
+ if (!(m_ppi_portb & 0x08))
{
double tap_val = m_cassette->input();
- if ( tap_val < 0 )
+ if (tap_val < 0)
{
data &= ~0x10;
}
@@ -368,13 +364,13 @@ uint8_t pcjr_state::pcjr_ppi_portc_r()
}
else
{
- if ( m_ppi_portb & 0x01 )
+ if (m_ppi_portb & 0x01)
{
- data = ( data & ~0x10 ) | ( m_pit_out2 ? 0x10 : 0x00 );
+ data = (data & ~0x10) | (m_pit_out2 ? 0x10 : 0x00);
}
}
- data = ( data & ~0x20 ) | ( m_pit_out2 ? 0x20 : 0x00 );
- data = ( data & ~0x40 ) | ( ( m_raw_keyb_data & 0x01 ) ? 0x40 : 0x00 );
+ data = (data & ~0x20) | (m_pit_out2 ? 0x20 : 0x00);
+ data = (data & ~0x40) | ((m_raw_keyb_data & 0x01) ? 0x40 : 0x00);
return data;
}
@@ -386,28 +382,31 @@ void pcjr_state::pcjr_fdc_dor_w(uint8_t data)
floppy_image_device *floppy0 = m_fdc->subdevice<floppy_connector>("0")->get_device();
floppy_image_device *floppy1 = nullptr;
- if(m_fdc->subdevice("1"))
+ if (m_fdc->subdevice("1"))
floppy1 = m_fdc->subdevice<floppy_connector>("1")->get_device();
m_pcjr_dor = data;
- if(floppy0)
+ if (floppy0)
floppy0->mon_w(!(m_pcjr_dor & 1));
- if(floppy1)
+ if (floppy1)
floppy1->mon_w(!(m_pcjr_dor & 2));
- if(m_pcjr_dor & 1)
+ if (m_pcjr_dor & 1)
m_fdc->set_floppy(floppy0);
- else if(m_pcjr_dor & 2)
+ else if (m_pcjr_dor & 2)
m_fdc->set_floppy(floppy1);
else
m_fdc->set_floppy(nullptr);
m_fdc->reset_w(!BIT(m_pcjr_dor, 7));
- if(m_pcjr_dor & 0x20) {
- if((pdor & 0x40) && !(m_pcjr_dor & 0x40))
+ if (m_pcjr_dor & 0x20)
+ {
+ if ((pdor & 0x40) && !(m_pcjr_dor & 0x40))
m_pcjr_watchdog->adjust(attotime::from_seconds(3));
- } else {
+ }
+ else
+ {
m_pcjr_watchdog->adjust(attotime::never);
m_pic8259->ir6_w(0);
}
@@ -422,7 +421,8 @@ void pcjr_state::pcjx_set_bank(int unk1, int unk2, int unk3)
void pcjr_state::pcjx_port_1ff_w(uint8_t data)
{
- switch(m_pcjx_1ff_count) {
+ switch (m_pcjx_1ff_count)
+ {
case 0:
m_pcjx_1ff_bankval = data;
m_pcjx_1ff_count++;
@@ -441,7 +441,7 @@ void pcjr_state::pcjx_port_1ff_w(uint8_t data)
uint8_t pcjr_state::pcjx_port_1ff_r()
{
- if(m_pcjx_1ff_count == 2)
+ if (m_pcjx_1ff_count == 2)
pcjx_set_bank(m_pcjx_1ff_bankval, m_pcjx_1ff_bank[m_pcjx_1ff_bankval & 0x1f][0], m_pcjx_1ff_bank[m_pcjx_1ff_bankval & 0x1f][1]);
m_pcjx_1ff_count = 0;
@@ -547,7 +547,7 @@ static const gfx_layout kanji_layout =
};
static GFXDECODE_START( gfx_pcjr )
- GFXDECODE_ENTRY( "gfx1", 0x0000, pc_8_charlayout, 3, 1 )
+ GFXDECODE_ENTRY("gfx1", 0x0000, pc_8_charlayout, 3, 1)
GFXDECODE_END
@@ -727,6 +727,6 @@ ROM_START( ibmpcjx )
ROM_LOAD("kanji.rom", 0x00000, 0x38000, BAD_DUMP CRC(eaa6e3c3) SHA1(35554587d02d947fae8446964b1886fff5c9d67f)) // hand-made rom
ROM_END
-// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS
-COMP( 1983, ibmpcjr, ibm5150, 0, ibmpcjr, ibmpcjr, pcjr_state, init_pcjr, "International Business Machines", "IBM PC Jr", MACHINE_IMPERFECT_COLORS )
-COMP( 1985, ibmpcjx, ibm5150, 0, ibmpcjx, ibmpcjr, pcjr_state, init_pcjr, "International Business Machines", "IBM PC JX", MACHINE_IMPERFECT_COLORS | MACHINE_NOT_WORKING)
+// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS
+COMP( 1983, ibmpcjr, ibm5150, 0, ibmpcjr, ibmpcjr, pcjr_state, empty_init, "International Business Machines", "IBM PC Jr", MACHINE_IMPERFECT_COLORS )
+COMP( 1985, ibmpcjx, ibm5150, 0, ibmpcjx, ibmpcjr, pcjr_state, empty_init, "International Business Machines", "IBM PC JX", MACHINE_IMPERFECT_COLORS | MACHINE_NOT_WORKING)
diff --git a/src/mame/drivers/intellec4.cpp b/src/mame/drivers/intellec4.cpp
index 2362381aa41..fc87a1a3606 100644
--- a/src/mame/drivers/intellec4.cpp
+++ b/src/mame/drivers/intellec4.cpp
@@ -639,7 +639,7 @@ INPUT_CHANGED_MEMBER(intellec4_state::sw_do_enable)
void intellec4_state::driver_start()
{
- m_reset_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(intellec4_state::reset_expired), this));
+ m_reset_timer = timer_alloc(FUNC(intellec4_state::reset_expired), this);
m_led_address.resolve();
m_led_instruction.resolve();
@@ -1170,7 +1170,7 @@ void mod4_state::driver_start()
m_led_status_cpu.resolve();
- m_one_shot_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mod4_state::one_shot_expired), this));
+ m_one_shot_timer = timer_alloc(FUNC(mod4_state::one_shot_expired), this);
save_item(NAME(m_one_shot));
@@ -1400,7 +1400,7 @@ void mod40_state::driver_start()
m_led_status_run.resolve();
- m_single_step_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mod40_state::single_step_expired), this));
+ m_single_step_timer = timer_alloc(FUNC(mod40_state::single_step_expired), this);
save_item(NAME(m_stp_ack));
save_item(NAME(m_single_step));
diff --git a/src/mame/drivers/intv.cpp b/src/mame/drivers/intv.cpp
index 0104aa6d9d4..fbba9b7dccc 100644
--- a/src/mame/drivers/intv.cpp
+++ b/src/mame/drivers/intv.cpp
@@ -277,16 +277,16 @@ INPUT_PORTS_END
void intv_state::intv_mem(address_map &map)
{
- map(0x0000, 0x003f).rw(FUNC(intv_state::intv_stic_r), FUNC(intv_state::intv_stic_w));
- map(0x0100, 0x01ef).rw(FUNC(intv_state::intv_ram8_r), FUNC(intv_state::intv_ram8_w));
+ map(0x0000, 0x003f).rw(FUNC(intv_state::stic_r), FUNC(intv_state::stic_w));
+ map(0x0100, 0x01ef).rw(FUNC(intv_state::ram8_r), FUNC(intv_state::ram8_w));
map(0x01f0, 0x01ff).rw(m_sound, FUNC(ay8914_device::read), FUNC(ay8914_device::write)).umask16(0x00ff);
- map(0x0200, 0x035f).rw(FUNC(intv_state::intv_ram16_r), FUNC(intv_state::intv_ram16_w));
+ map(0x0200, 0x035f).rw(FUNC(intv_state::ram16_r), FUNC(intv_state::ram16_w));
map(0x0400, 0x04ff).r(m_cart, FUNC(intv_cart_slot_device::read_rom04));
map(0x1000, 0x1fff).rom().region("maincpu", 0x1000 << 1); // Exec ROM, 10-bits wide
map(0x2000, 0x2fff).r(m_cart, FUNC(intv_cart_slot_device::read_rom20));
map(0x3000, 0x37ff).r(m_stic, FUNC(stic_device::grom_read)); // GROM, 8-bits wide
- map(0x3800, 0x39ff).rw(FUNC(intv_state::intv_gram_r), FUNC(intv_state::intv_gram_w)); // GRAM, 8-bits wide
- map(0x3a00, 0x3bff).rw(FUNC(intv_state::intv_gram_r), FUNC(intv_state::intv_gram_w)); // GRAM Alias, 8-bits wide
+ map(0x3800, 0x39ff).rw(FUNC(intv_state::gram_r), FUNC(intv_state::gram_w)); // GRAM, 8-bits wide
+ map(0x3a00, 0x3bff).rw(FUNC(intv_state::gram_r), FUNC(intv_state::gram_w)); // GRAM Alias, 8-bits wide
map(0x4000, 0x47ff).r(m_cart, FUNC(intv_cart_slot_device::read_rom40));
map(0x4800, 0x4fff).r(m_cart, FUNC(intv_cart_slot_device::read_rom48));
map(0x5000, 0x5fff).r(m_cart, FUNC(intv_cart_slot_device::read_rom50));
@@ -304,17 +304,17 @@ void intv_state::intv_mem(address_map &map)
void intv_state::intvoice_mem(address_map &map)
{
- map(0x0000, 0x003f).rw(FUNC(intv_state::intv_stic_r), FUNC(intv_state::intv_stic_w));
+ map(0x0000, 0x003f).rw(FUNC(intv_state::stic_r), FUNC(intv_state::stic_w));
map(0x0080, 0x0081).rw("voice", FUNC(intv_voice_device::read_speech), FUNC(intv_voice_device::write_speech)); // Intellivoice
- map(0x0100, 0x01ef).rw(FUNC(intv_state::intv_ram8_r), FUNC(intv_state::intv_ram8_w));
+ map(0x0100, 0x01ef).rw(FUNC(intv_state::ram8_r), FUNC(intv_state::ram8_w));
map(0x01f0, 0x01ff).rw(m_sound, FUNC(ay8914_device::read), FUNC(ay8914_device::write)).umask16(0x00ff);
- map(0x0200, 0x035f).rw(FUNC(intv_state::intv_ram16_r), FUNC(intv_state::intv_ram16_w));
+ map(0x0200, 0x035f).rw(FUNC(intv_state::ram16_r), FUNC(intv_state::ram16_w));
map(0x0400, 0x04ff).r("voice", FUNC(intv_voice_device::read_rom04));
map(0x1000, 0x1fff).rom().region("maincpu", 0x1000 << 1); // Exec ROM, 10-bits wide
map(0x2000, 0x2fff).r("voice", FUNC(intv_voice_device::read_rom20));
map(0x3000, 0x37ff).r(m_stic, FUNC(stic_device::grom_read)); // GROM, 8-bits wide
- map(0x3800, 0x39ff).rw(FUNC(intv_state::intv_gram_r), FUNC(intv_state::intv_gram_w)); // GRAM, 8-bits wide
- map(0x3a00, 0x3bff).rw(FUNC(intv_state::intv_gram_r), FUNC(intv_state::intv_gram_w)); // GRAM Alias, 8-bits wide
+ map(0x3800, 0x39ff).rw(FUNC(intv_state::gram_r), FUNC(intv_state::gram_w)); // GRAM, 8-bits wide
+ map(0x3a00, 0x3bff).rw(FUNC(intv_state::gram_r), FUNC(intv_state::gram_w)); // GRAM Alias, 8-bits wide
map(0x4000, 0x47ff).r("voice", FUNC(intv_voice_device::read_rom40));
map(0x4800, 0x4fff).r("voice", FUNC(intv_voice_device::read_rom48));
map(0x5000, 0x5fff).r("voice", FUNC(intv_voice_device::read_rom50));
@@ -332,16 +332,16 @@ void intv_state::intvoice_mem(address_map &map)
void intv_state::intv2_mem(address_map &map)
{
- map(0x0000, 0x003f).rw(FUNC(intv_state::intv_stic_r), FUNC(intv_state::intv_stic_w));
- map(0x0100, 0x01ef).rw(FUNC(intv_state::intv_ram8_r), FUNC(intv_state::intv_ram8_w));
+ map(0x0000, 0x003f).rw(FUNC(intv_state::stic_r), FUNC(intv_state::stic_w));
+ map(0x0100, 0x01ef).rw(FUNC(intv_state::ram8_r), FUNC(intv_state::ram8_w));
map(0x01f0, 0x01ff).rw(m_sound, FUNC(ay8914_device::read), FUNC(ay8914_device::write)).umask16(0x00ff);
- map(0x0200, 0x035f).rw(FUNC(intv_state::intv_ram16_r), FUNC(intv_state::intv_ram16_w));
+ map(0x0200, 0x035f).rw(FUNC(intv_state::ram16_r), FUNC(intv_state::ram16_w));
map(0x0400, 0x04ff).rom().region("maincpu", 0x400 << 1); // Exec ROM, 10-bits wide
map(0x1000, 0x1fff).rom().region("maincpu", 0x1000 << 1); // Exec ROM, 10-bits wide
map(0x2000, 0x2fff).r(m_cart, FUNC(intv_cart_slot_device::read_rom20));
map(0x3000, 0x37ff).r(m_stic, FUNC(stic_device::grom_read)); // GROM, 8-bits wide
- map(0x3800, 0x39ff).rw(FUNC(intv_state::intv_gram_r), FUNC(intv_state::intv_gram_w)); // GRAM, 8-bits wide
- map(0x3a00, 0x3bff).rw(FUNC(intv_state::intv_gram_r), FUNC(intv_state::intv_gram_w)); // GRAM Alias, 8-bits wide
+ map(0x3800, 0x39ff).rw(FUNC(intv_state::gram_r), FUNC(intv_state::gram_w)); // GRAM, 8-bits wide
+ map(0x3a00, 0x3bff).rw(FUNC(intv_state::gram_r), FUNC(intv_state::gram_w)); // GRAM Alias, 8-bits wide
map(0x4000, 0x47ff).r(m_cart, FUNC(intv_cart_slot_device::read_rom40));
map(0x4800, 0x4fff).r(m_cart, FUNC(intv_cart_slot_device::read_rom48));
map(0x5000, 0x5fff).r(m_cart, FUNC(intv_cart_slot_device::read_rom50));
@@ -359,19 +359,19 @@ void intv_state::intv2_mem(address_map &map)
void intv_state::intvecs_mem(address_map &map)
{
- map(0x0000, 0x003f).rw(FUNC(intv_state::intv_stic_r), FUNC(intv_state::intv_stic_w));
+ map(0x0000, 0x003f).rw(FUNC(intv_state::stic_r), FUNC(intv_state::stic_w));
map(0x0080, 0x0081).rw("speech", FUNC(sp0256_device::spb640_r), FUNC(sp0256_device::spb640_w)); /* Intellivoice */
// map(0x00e0, 0x00e3).rw(FUNC(intv_state::intv_ecs_uart_r), FUNC(intv_state::intv_ecs_uart_w));
map(0x00f0, 0x00ff).rw("ecs", FUNC(intv_ecs_device::read_ay), FUNC(intv_ecs_device::write_ay)); /* ecs psg */
- map(0x0100, 0x01ef).rw(FUNC(intv_state::intv_ram8_r), FUNC(intv_state::intv_ram8_w));
+ map(0x0100, 0x01ef).rw(FUNC(intv_state::ram8_r), FUNC(intv_state::ram8_w));
map(0x01f0, 0x01ff).rw(m_sound, FUNC(ay8914_device::read), FUNC(ay8914_device::write)).umask16(0x00ff);
- map(0x0200, 0x035f).rw(FUNC(intv_state::intv_ram16_r), FUNC(intv_state::intv_ram16_w));
+ map(0x0200, 0x035f).rw(FUNC(intv_state::ram16_r), FUNC(intv_state::ram16_w));
map(0x0400, 0x04ff).r("ecs", FUNC(intv_ecs_device::read_rom04));
map(0x1000, 0x1fff).rom().region("maincpu", 0x1000<<1); /* Exec ROM, 10-bits wide */
map(0x2000, 0x2fff).rw("ecs", FUNC(intv_ecs_device::read_rom20), FUNC(intv_ecs_device::write_rom20));
map(0x3000, 0x37ff).r(m_stic, FUNC(stic_device::grom_read)); /* GROM, 8-bits wide */
- map(0x3800, 0x39ff).rw(FUNC(intv_state::intv_gram_r), FUNC(intv_state::intv_gram_w)); /* GRAM, 8-bits wide */
- map(0x3a00, 0x3bff).rw(FUNC(intv_state::intv_gram_r), FUNC(intv_state::intv_gram_w)); /* GRAM Alias, 8-bits wide */
+ map(0x3800, 0x39ff).rw(FUNC(intv_state::gram_r), FUNC(intv_state::gram_w)); /* GRAM, 8-bits wide */
+ map(0x3a00, 0x3bff).rw(FUNC(intv_state::gram_r), FUNC(intv_state::gram_w)); /* GRAM Alias, 8-bits wide */
map(0x4000, 0x47ff).rw("ecs", FUNC(intv_ecs_device::read_ram), FUNC(intv_ecs_device::write_ram));
map(0x4800, 0x4fff).r("ecs", FUNC(intv_ecs_device::read_rom48));
map(0x5000, 0x5fff).r("ecs", FUNC(intv_ecs_device::read_rom50));
@@ -389,16 +389,16 @@ void intv_state::intvecs_mem(address_map &map)
void intv_state::intvkbd_mem(address_map &map)
{
- map(0x0000, 0x003f).rw(FUNC(intv_state::intv_stic_r), FUNC(intv_state::intv_stic_w));
- map(0x0100, 0x01ef).rw(FUNC(intv_state::intv_ram8_r), FUNC(intv_state::intv_ram8_w));
+ map(0x0000, 0x003f).rw(FUNC(intv_state::stic_r), FUNC(intv_state::stic_w));
+ map(0x0100, 0x01ef).rw(FUNC(intv_state::ram8_r), FUNC(intv_state::ram8_w));
map(0x01f0, 0x01ff).rw(m_sound, FUNC(ay8914_device::read), FUNC(ay8914_device::write)).umask16(0x00ff);
- map(0x0200, 0x035f).rw(FUNC(intv_state::intv_ram16_r), FUNC(intv_state::intv_ram16_w));
+ map(0x0200, 0x035f).rw(FUNC(intv_state::ram16_r), FUNC(intv_state::ram16_w));
map(0x0400, 0x04ff).r(m_cart, FUNC(intv_cart_slot_device::read_rom04));
map(0x1000, 0x1fff).rom().region("maincpu", 0x1000<<1); /* Exec ROM, 10-bits wide */
map(0x2000, 0x2fff).r(m_cart, FUNC(intv_cart_slot_device::read_rom20));
map(0x3000, 0x37ff).r(m_stic, FUNC(stic_device::grom_read)); /* GROM, 8-bits wide */
- map(0x3800, 0x39ff).rw(FUNC(intv_state::intv_gram_r), FUNC(intv_state::intv_gram_w)); /* GRAM, 8-bits wide */
- map(0x3a00, 0x3bff).rw(FUNC(intv_state::intv_gram_r), FUNC(intv_state::intv_gram_w)); /* GRAM Alias, 8-bits wide */
+ map(0x3800, 0x39ff).rw(FUNC(intv_state::gram_r), FUNC(intv_state::gram_w)); /* GRAM, 8-bits wide */
+ map(0x3a00, 0x3bff).rw(FUNC(intv_state::gram_r), FUNC(intv_state::gram_w)); /* GRAM Alias, 8-bits wide */
map(0x4000, 0x47ff).r(m_cart, FUNC(intv_cart_slot_device::read_rom40));
map(0x4800, 0x4fff).r(m_cart, FUNC(intv_cart_slot_device::read_rom48));
map(0x5000, 0x5fff).r(m_cart, FUNC(intv_cart_slot_device::read_rom50));
@@ -424,37 +424,19 @@ void intv_state::intvkbd2_mem(address_map &map)
map(0xe000, 0xffff).r(FUNC(intv_state::intvkb_iocart_r));
}
-void intv_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_INTV_INTERRUPT2_COMPLETE:
- intv_interrupt2_complete(param);
- break;
- case TIMER_INTV_INTERRUPT_COMPLETE:
- intv_interrupt_complete(param);
- break;
- case TIMER_INTV_BTB_FILL:
- intv_btb_fill(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in intv_state::device_timer");
- }
-}
-
/* This is needed because MAME core does not allow PULSE_LINE.
The time interval is not critical, although it should be below 1000. */
-TIMER_CALLBACK_MEMBER(intv_state::intv_interrupt2_complete)
+TIMER_CALLBACK_MEMBER(intv_state::interrupt2_complete)
{
m_keyboard->set_input_line(0, CLEAR_LINE);
}
-INTERRUPT_GEN_MEMBER(intv_state::intv_interrupt2)
+INTERRUPT_GEN_MEMBER(intv_state::interrupt2)
{
m_keyboard->set_input_line(0, ASSERT_LINE);
- timer_set(m_keyboard->cycles_to_attotime(100), TIMER_INTV_INTERRUPT2_COMPLETE);
+ m_int2_complete_timer->adjust(m_keyboard->cycles_to_attotime(100));
}
void intv_state::intv(machine_config &config)
@@ -462,7 +444,7 @@ void intv_state::intv(machine_config &config)
/* basic machine hardware */
cp1610_cpu_device &maincpu(CP1610(config, m_maincpu, XTAL(3'579'545)/4)); /* Colorburst/4 */
maincpu.set_addrmap(AS_PROGRAM, &intv_state::intv_mem);
- maincpu.set_vblank_int("screen", FUNC(intv_state::intv_interrupt));
+ maincpu.set_vblank_int("screen", FUNC(intv_state::interrupt));
maincpu.iab().set(FUNC(intv_state::iab_r));
config.set_maximum_quantum(attotime::from_hz(60));
@@ -541,7 +523,7 @@ void intv_state::intvkbd(machine_config &config)
M6502(config, m_keyboard, XTAL(7'159'090)/8);
m_keyboard->set_addrmap(AS_PROGRAM, &intv_state::intvkbd2_mem);
- m_keyboard->set_vblank_int("screen", FUNC(intv_state::intv_interrupt2));
+ m_keyboard->set_vblank_int("screen", FUNC(intv_state::interrupt2));
config.set_maximum_quantum(attotime::from_hz(6000));
diff --git a/src/mame/drivers/iphone2g.cpp b/src/mame/drivers/iphone2g.cpp
index 995272bfbce..b68aac7ed8a 100644
--- a/src/mame/drivers/iphone2g.cpp
+++ b/src/mame/drivers/iphone2g.cpp
@@ -31,25 +31,26 @@ protected:
virtual void device_resolve_objects() override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual space_config_vector memory_space_config() const override;
-private:
- static constexpr device_timer_id TIMER_SEND_IRQ = 0;
+ TIMER_CALLBACK_MEMBER(send_irq);
+private:
address_space_config m_mmio_config;
devcb_write_line m_out_irq_func;
- u8 m_cmd = 0, m_tx_data = 0;
+ emu_timer *m_irq_timer;
+ u8 m_cmd = 0;
+ u8 m_tx_data = 0;
u32 m_ctrl = 0;
u16 m_status = 0;
};
DECLARE_DEVICE_TYPE(IPHONE2G_SPI, iphone2g_spi_device)
-void iphone2g_spi_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(iphone2g_spi_device::send_irq)
{
m_out_irq_func(1);
}
@@ -61,7 +62,7 @@ void iphone2g_spi_device::map(address_map &map)
{
m_status |= 0xfff2;
m_cmd = m_tx_data;
- timer_set(attotime::from_hz(1'000), TIMER_SEND_IRQ);
+ m_irq_timer->adjust(attotime::from_hz(1'000));
}
m_ctrl = data;
}));
@@ -99,6 +100,8 @@ void iphone2g_spi_device::device_start()
save_item(NAME(m_ctrl));
save_item(NAME(m_tx_data));
save_item(NAME(m_status));
+
+ m_irq_timer = timer_alloc(FUNC(iphone2g_spi_device::send_irq), this);
}
void iphone2g_spi_device::device_reset()
@@ -138,17 +141,18 @@ protected:
virtual void device_resolve_objects() override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual space_config_vector memory_space_config() const override;
-private:
- static constexpr device_timer_id TIMER_TICK = 0;
+ TIMER_CALLBACK_MEMBER(send_irq);
+private:
address_space_config m_mmio_config;
devcb_write_line m_out_irq_func;
+ emu_timer *m_irq_timer;
+
struct timer
{
u16 config = 0;
@@ -161,7 +165,7 @@ private:
DECLARE_DEVICE_TYPE(IPHONE2G_TIMER, iphone2g_timer_device)
-void iphone2g_timer_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(iphone2g_timer_device::send_irq)
{
m_out_irq_func(1);
}
@@ -185,6 +189,7 @@ void iphone2g_timer_device::device_resolve_objects()
void iphone2g_timer_device::device_start()
{
+ m_irq_timer = timer_alloc(FUNC(iphone2g_timer_device::send_irq), this);
}
void iphone2g_timer_device::device_reset()
diff --git a/src/mame/drivers/irisha.cpp b/src/mame/drivers/irisha.cpp
index b2365a11a6a..fd8319d1aec 100644
--- a/src/mame/drivers/irisha.cpp
+++ b/src/mame/drivers/irisha.cpp
@@ -355,7 +355,7 @@ uint8_t irisha_state::keyboard_r()
void irisha_state::machine_start()
{
- m_key_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(irisha_state::irisha_key),this));
+ m_key_timer = timer_alloc(FUNC(irisha_state::irisha_key), this);
m_key_timer->adjust(attotime::from_msec(30), 0, attotime::from_msec(30));
save_item(NAME(m_sg1_line));
save_item(NAME(m_keypressed));
diff --git a/src/mame/drivers/itech8.cpp b/src/mame/drivers/itech8.cpp
index c7a526493b3..512d5625685 100644
--- a/src/mame/drivers/itech8.cpp
+++ b/src/mame/drivers/itech8.cpp
@@ -605,7 +605,7 @@ void itech8_state::nmi_ack_w(uint8_t data)
MACHINE_START_MEMBER(itech8_state,sstrike)
{
/* we need to update behind the beam as well */
- m_behind_beam_update_timer = timer_alloc(TIMER_BEHIND_BEAM_UPDATE);
+ m_behind_beam_update_timer = timer_alloc(FUNC(itech8_state::behind_the_beam_update), this);
m_behind_beam_update_timer->adjust(m_screen->time_until_pos(0), 32);
itech8_state::machine_start();
@@ -633,8 +633,8 @@ void itech8_state::machine_start()
m_fixed->set_entry(0);
}
- m_irq_off_timer = timer_alloc(TIMER_IRQ_OFF);
- m_blitter_done_timer = timer_alloc(TIMER_BLITTER_DONE);
+ m_irq_off_timer = timer_alloc(FUNC(itech8_state::irq_off), this);
+ m_blitter_done_timer = timer_alloc(FUNC(itech8_state::blitter_done), this);
save_item(NAME(m_grom_bank));
save_item(NAME(m_blitter_int));
@@ -648,7 +648,7 @@ void grmatch_state::machine_start()
{
itech8_state::machine_start();
- m_palette_timer = timer_alloc(TIMER_PALETTE);
+ m_palette_timer = timer_alloc(FUNC(grmatch_state::palette_update), this);
}
void itech8_state::machine_reset()
@@ -674,27 +674,6 @@ void grmatch_state::machine_reset()
m_palette_timer->adjust(m_screen->time_until_pos(m_screen->vpos()+1));
}
-void itech8_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_IRQ_OFF:
- irq_off(param);
- break;
- case TIMER_BEHIND_BEAM_UPDATE:
- behind_the_beam_update(param);
- break;
- case TIMER_BLITTER_DONE:
- blitter_done(param);
- break;
- case TIMER_DELAYED_Z80_CONTROL:
- delayed_z80_control_w(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in itech8_state::device_timer");
- }
-}
-
/*************************************
*
@@ -2707,8 +2686,6 @@ void grmatch_state::driver_init()
void itech8_state::init_slikshot()
{
- m_delayed_z80_control_timer = timer_alloc(TIMER_DELAYED_Z80_CONTROL);
-
save_item(NAME(m_z80_ctrl));
save_item(NAME(m_z80_port_val));
save_item(NAME(m_z80_clear_to_send));
diff --git a/src/mame/drivers/jaguar.cpp b/src/mame/drivers/jaguar.cpp
index b6771efe453..cb888ceb78d 100644
--- a/src/mame/drivers/jaguar.cpp
+++ b/src/mame/drivers/jaguar.cpp
@@ -879,7 +879,7 @@ void jaguar_state::gpu_jump_w(offs_t offset, uint32_t data, uint32_t mem_mask)
gpu_resume();
/* start the sync timer going, and note that there is a command pending */
- synchronize(TID_GPU_SYNC);
+ m_gpu_sync_timer->adjust(attotime::zero);
m_gpu_command_pending = true;
}
diff --git a/src/mame/drivers/jangou.cpp b/src/mame/drivers/jangou.cpp
index 0cf9eee06d1..4db40597213 100644
--- a/src/mame/drivers/jangou.cpp
+++ b/src/mame/drivers/jangou.cpp
@@ -914,7 +914,7 @@ void jangou_state::machine_start()
save_item(NAME(m_cvsd_shift_cnt));
/* Create a timer to feed the CVSD DAC with sample bits */
- m_cvsd_bit_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(jangou_state::cvsd_bit_timer_callback), this));
+ m_cvsd_bit_timer = timer_alloc(FUNC(jangou_state::cvsd_bit_timer_callback), this);
m_cvsd_bit_timer->adjust(attotime::from_hz(MASTER_CLOCK / 1024), 0, attotime::from_hz(MASTER_CLOCK / 1024));
}
diff --git a/src/mame/drivers/jedi.cpp b/src/mame/drivers/jedi.cpp
index a6c35a061d5..7981afd62d0 100644
--- a/src/mame/drivers/jedi.cpp
+++ b/src/mame/drivers/jedi.cpp
@@ -158,7 +158,7 @@ void jedi_state::main_irq_ack_w(u8 data)
void jedi_state::machine_start()
{
/* set a timer to run the interrupts */
- m_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(jedi_state::generate_interrupt),this));
+ m_interrupt_timer = timer_alloc(FUNC(jedi_state::generate_interrupt), this);
m_interrupt_timer->adjust(m_screen->time_until_pos(32), 32);
/* configure the banks */
diff --git a/src/mame/drivers/jpmimpct.cpp b/src/mame/drivers/jpmimpct.cpp
index 84a6dad9633..273b57306a3 100644
--- a/src/mame/drivers/jpmimpct.cpp
+++ b/src/mame/drivers/jpmimpct.cpp
@@ -468,9 +468,9 @@ void jpmimpct_state::slides_non_video_w(offs_t offset, uint16_t data, uint16_t m
}
}
- int combined_meter = m_meters->GetActivity(0) | m_meters->GetActivity(1) |
- m_meters->GetActivity(2) | m_meters->GetActivity(3) |
- m_meters->GetActivity(4);
+ int combined_meter = m_meters->get_activity(0) | m_meters->get_activity(1) |
+ m_meters->get_activity(2) | m_meters->get_activity(3) |
+ m_meters->get_activity(4);
if (combined_meter)
{
diff --git a/src/mame/drivers/jpmsys5.cpp b/src/mame/drivers/jpmsys5.cpp
index a37e0ebe4d9..ca6686d6c3a 100644
--- a/src/mame/drivers/jpmsys5.cpp
+++ b/src/mame/drivers/jpmsys5.cpp
@@ -638,17 +638,17 @@ WRITE_LINE_MEMBER(jpmsys5_state::pia_irq)
uint8_t jpmsys5_state::u29_porta_r()
{
- int meter_bit =0;
+ int meter_bit = 0;
if (m_meters)
{
- int combined_meter = m_meters->GetActivity(0) | m_meters->GetActivity(1) |
- m_meters->GetActivity(2) | m_meters->GetActivity(3) |
- m_meters->GetActivity(4) | m_meters->GetActivity(5) |
- m_meters->GetActivity(6) | m_meters->GetActivity(7);
+ int combined_meter = m_meters->get_activity(0) | m_meters->get_activity(1) |
+ m_meters->get_activity(2) | m_meters->get_activity(3) |
+ m_meters->get_activity(4) | m_meters->get_activity(5) |
+ m_meters->get_activity(6) | m_meters->get_activity(7);
if (combined_meter)
- meter_bit = 0x80;
+ meter_bit = 0x80;
}
return m_direct_port->read() | meter_bit;
@@ -734,7 +734,7 @@ void jpmsys5v_state::machine_start()
m_rombank->configure_entries(0, 32, memregion("maincpu")->base() + 0x20000, 0x20000);
m_rombank->set_entry(0);
- m_touch_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(jpmsys5v_state::touch_cb),this));
+ m_touch_timer = timer_alloc(FUNC(jpmsys5v_state::touch_cb), this);
}
void jpmsys5v_state::machine_reset()
diff --git a/src/mame/drivers/jr100.cpp b/src/mame/drivers/jr100.cpp
index 6e7a64f15df..0680cff4eb8 100644
--- a/src/mame/drivers/jr100.cpp
+++ b/src/mame/drivers/jr100.cpp
@@ -206,7 +206,7 @@ INPUT_PORTS_END
void jr100_state::machine_start()
{
if (!m_sound_timer)
- m_sound_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(jr100_state::sound_tick), this));
+ m_sound_timer = timer_alloc(FUNC(jr100_state::sound_tick), this);
save_item(NAME(m_keyboard_line));
save_item(NAME(m_use_pcg));
diff --git a/src/mame/drivers/jr200.cpp b/src/mame/drivers/jr200.cpp
index 0afe165d6d3..0babb34d2d6 100644
--- a/src/mame/drivers/jr200.cpp
+++ b/src/mame/drivers/jr200.cpp
@@ -575,7 +575,7 @@ GFXDECODE_END
void jr200_state::machine_start()
{
- m_timer_d = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(jr200_state::timer_d_callback),this));
+ m_timer_d = timer_alloc(FUNC(jr200_state::timer_d_callback), this);
save_item(NAME(m_border_col));
save_item(NAME(m_old_keydata));
save_item(NAME(m_freq_reg));
diff --git a/src/mame/drivers/konamigx.cpp b/src/mame/drivers/konamigx.cpp
index b089bc726f4..381c538640c 100644
--- a/src/mame/drivers/konamigx.cpp
+++ b/src/mame/drivers/konamigx.cpp
@@ -3954,8 +3954,8 @@ void konamigx_state::init_konamigx()
m_esc_cb = nullptr;
m_resume_trigger = 0;
- m_dmadelay_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(konamigx_state::dmaend_callback),this));
- m_boothack_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(konamigx_state::boothack_callback),this));
+ m_dmadelay_timer = timer_alloc(FUNC(konamigx_state::dmaend_callback), this);
+ m_boothack_timer = timer_alloc(FUNC(konamigx_state::boothack_callback), this);
int i = 0, match = 0, readback = 0;
while ((gameDefs[i].cfgport != 0xff) && (!match))
diff --git a/src/mame/drivers/konamim2.cpp b/src/mame/drivers/konamim2.cpp
index 043db5b7c4a..90fd8e36dfb 100644
--- a/src/mame/drivers/konamim2.cpp
+++ b/src/mame/drivers/konamim2.cpp
@@ -700,7 +700,7 @@ void konamim2_state::machine_start()
m_available_cdroms = chd ? new cdrom_file(chd) : nullptr;
// TODO: REMOVE
- m_atapi_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(konamim2_state::atapi_delay), this));
+ m_atapi_timer = timer_alloc(FUNC(konamim2_state::atapi_delay), this);
m_atapi_timer->adjust( attotime::never );
if (machine().debug_flags & DEBUG_FLAG_ENABLED)
diff --git a/src/mame/drivers/krz2000.cpp b/src/mame/drivers/krz2000.cpp
index e03039775cd..2fdb8da2f08 100644
--- a/src/mame/drivers/krz2000.cpp
+++ b/src/mame/drivers/krz2000.cpp
@@ -166,7 +166,7 @@ void k2000_state::hobbes1_write(offs_t offset, uint16_t data)
void k2000_state::machine_start()
{
- m_boot_hack_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(k2000_state::boot_hack_timer), this));
+ m_boot_hack_timer = timer_alloc(FUNC(k2000_state::boot_hack_timer), this);
m_boot_hack_timer->adjust(attotime::from_seconds(2), 0, attotime::never);
}
diff --git a/src/mame/drivers/ksys573.cpp b/src/mame/drivers/ksys573.cpp
index 0aaa6c2d05e..5c1be4ef0a1 100644
--- a/src/mame/drivers/ksys573.cpp
+++ b/src/mame/drivers/ksys573.cpp
@@ -1105,7 +1105,7 @@ void ksys573_state::update_disc()
void ksys573_state::driver_start()
{
- m_atapi_timer = machine().scheduler().timer_alloc( timer_expired_delegate( FUNC( ksys573_state::atapi_xfer_end ),this ) );
+ m_atapi_timer = timer_alloc( FUNC( ksys573_state::atapi_xfer_end ), this );
m_atapi_timer->adjust( attotime::never );
for (int i = 0; i < 2; i++)
diff --git a/src/mame/drivers/laserbat.cpp b/src/mame/drivers/laserbat.cpp
index f8057fcb8da..c46c0f26ea2 100644
--- a/src/mame/drivers/laserbat.cpp
+++ b/src/mame/drivers/laserbat.cpp
@@ -421,7 +421,7 @@ void laserbat_state_base::machine_start()
{
// start rendering scanlines
m_screen->register_screen_bitmap(m_bitmap);
- m_scanline_timer = timer_alloc(TIMER_SCANLINE);
+ m_scanline_timer = timer_alloc(FUNC(laserbat_state_base::video_line), this);
m_scanline_timer->adjust(m_screen->time_until_pos(1, 0));
save_item(NAME(m_gfx2_base));
@@ -459,19 +459,6 @@ void laserbat_state::machine_start()
save_item(NAME(m_keys));
}
-void laserbat_state_base::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_SCANLINE:
- video_line(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in laserbat_state_base::device_timer");
- }
-}
-
-
void laserbat_state_base::laserbat_base(machine_config &config)
{
// basic machine hardware
diff --git a/src/mame/drivers/ldplayer.cpp b/src/mame/drivers/ldplayer.cpp
index 7bb45afaaa0..b65a94c5a3e 100644
--- a/src/mame/drivers/ldplayer.cpp
+++ b/src/mame/drivers/ldplayer.cpp
@@ -43,7 +43,6 @@ public:
protected:
// device overrides
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void machine_start() override;
virtual void machine_reset() override;
@@ -56,12 +55,12 @@ protected:
// derived classes
virtual void execute_command(int command) { assert(false); }
- // timer IDs
- enum
- {
- TIMER_ID_AUTOPLAY,
- TIMER_ID_VSYNC_UPDATE
- };
+ // timers
+ TIMER_CALLBACK_MEMBER(vsync_update);
+ TIMER_CALLBACK_MEMBER(autoplay);
+
+ emu_timer *m_vsync_update_timer;
+ emu_timer *m_autoplay_timer;
// commands
enum
@@ -114,7 +113,6 @@ public:
void pr8210(machine_config &config);
protected:
// device overrides
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void machine_start() override;
virtual void machine_reset() override;
@@ -124,17 +122,15 @@ protected:
// internal helpers
inline void add_command(uint8_t command);
- // timer IDs
- enum
- {
- TIMER_ID_BIT = 100,
- TIMER_ID_BIT_OFF
- };
+ // timers
+ TIMER_CALLBACK_MEMBER(bit_on);
+ TIMER_CALLBACK_MEMBER(bit_off);
required_device<pioneer_pr8210_device> m_laserdisc;
// internal state
emu_timer *m_bit_timer = nullptr;
+ emu_timer *m_bit_off_timer = nullptr;
uint32_t m_command_buffer_in;
uint32_t m_command_buffer_out;
uint8_t m_command_buffer[10]{};
@@ -295,43 +291,41 @@ void ldplayer_state::process_commands()
}
-void ldplayer_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(ldplayer_state::vsync_update)
{
- switch (id)
- {
- case TIMER_ID_VSYNC_UPDATE:
- {
- // handle commands
- if (param == 0)
- process_commands();
-
- // set a timer to go off on the next VBLANK
- int vblank_scanline = m_screen->visible_area().max_y + 1;
- attotime target = m_screen->time_until_pos(vblank_scanline);
- timer_set(target, TIMER_ID_VSYNC_UPDATE);
- break;
- }
+ // handle commands
+ if (param == 0)
+ process_commands();
+
+ // set a timer to go off on the next VBLANK
+ int vblank_scanline = m_screen->visible_area().max_y + 1;
+ attotime target = m_screen->time_until_pos(vblank_scanline);
+ m_vsync_update_timer->adjust(target);
+}
- case TIMER_ID_AUTOPLAY:
- // start playing
- execute_command(CMD_PLAY);
- m_playing = true;
- break;
- }
+
+TIMER_CALLBACK_MEMBER(ldplayer_state::autoplay)
+{
+ // start playing
+ execute_command(CMD_PLAY);
+ m_playing = true;
}
void ldplayer_state::machine_start()
{
- // start the vsync timer going
- timer_set(attotime::zero, TIMER_ID_VSYNC_UPDATE, 1);
+ m_vsync_update_timer = timer_alloc(FUNC(ldplayer_state::vsync_update), this);
+ m_autoplay_timer = timer_alloc(FUNC(ldplayer_state::autoplay), this);
}
void ldplayer_state::machine_reset()
{
// set up a timer to start playing immediately
- timer_set(attotime::zero, TIMER_ID_AUTOPLAY);
+ m_autoplay_timer->adjust(attotime::zero);
+
+ // start the vsync timer going
+ m_vsync_update_timer->adjust(attotime::zero, 1);
// indicate the name of the file we opened
popmessage("Opened %s\n", m_filename);
@@ -351,62 +345,51 @@ void pr8210_state::add_command(uint8_t command)
m_command_buffer[m_command_buffer_in++ % std::size(m_command_buffer)] = 0x00 | 0x20;
}
-
-void pr8210_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(pr8210_state::bit_on)
{
- switch (id)
- {
- case TIMER_ID_BIT:
- {
- attotime duration = attotime::from_msec(30);
- uint8_t bitsleft = param >> 16;
- uint8_t data = param;
-
- // if we have bits, process
- if (bitsleft != 0)
- {
- // assert the line and set a timer for deassertion
- m_laserdisc->control_w(ASSERT_LINE);
- timer_set(attotime::from_usec(250), TIMER_ID_BIT_OFF);
-
- // space 0 bits apart by 1msec, and 1 bits by 2msec
- duration = attotime::from_msec((data & 0x80) ? 2 : 1);
- data <<= 1;
- bitsleft--;
- }
+ attotime duration = attotime::from_msec(30);
+ uint8_t bitsleft = param >> 16;
+ uint8_t data = param;
- // if we're out of bits, queue up the next command
- else if (bitsleft == 0 && m_command_buffer_in != m_command_buffer_out)
- {
- data = m_command_buffer[m_command_buffer_out++ % std::size(m_command_buffer)];
- bitsleft = 12;
- }
- m_bit_timer->adjust(duration, (bitsleft << 16) | data);
- break;
- }
-
- // deassert the control line
- case TIMER_ID_BIT_OFF:
- m_laserdisc->control_w(CLEAR_LINE);
- break;
+ // if we have bits, process
+ if (bitsleft != 0)
+ {
+ // assert the line and set a timer for deassertion
+ m_laserdisc->control_w(ASSERT_LINE);
+ m_bit_off_timer->adjust(attotime::from_usec(250));
+
+ // space 0 bits apart by 1msec, and 1 bits by 2msec
+ duration = attotime::from_msec((data & 0x80) ? 2 : 1);
+ data <<= 1;
+ bitsleft--;
+ }
- // others to the parent class
- default:
- ldplayer_state::device_timer(timer, id, param);
- break;
+ // if we're out of bits, queue up the next command
+ else if (bitsleft == 0 && m_command_buffer_in != m_command_buffer_out)
+ {
+ data = m_command_buffer[m_command_buffer_out++ % std::size(m_command_buffer)];
+ bitsleft = 12;
}
+ m_bit_timer->adjust(duration, (bitsleft << 16) | data);
+}
+
+TIMER_CALLBACK_MEMBER(pr8210_state::bit_off)
+{
+ m_laserdisc->control_w(CLEAR_LINE);
}
void pr8210_state::machine_start()
{
ldplayer_state::machine_start();
- m_bit_timer = timer_alloc(TIMER_ID_BIT);
+ m_bit_timer = timer_alloc(FUNC(pr8210_state::bit_on), this);
+ m_bit_off_timer = timer_alloc(FUNC(pr8210_state::bit_off), this);
}
void pr8210_state::machine_reset()
{
ldplayer_state::machine_reset();
m_bit_timer->adjust(attotime::zero);
+ m_bit_off_timer->adjust(attotime::never);
}
diff --git a/src/mame/drivers/lnw80.cpp b/src/mame/drivers/lnw80.cpp
index ef8b5e4af5f..8c4e67a01ef 100644
--- a/src/mame/drivers/lnw80.cpp
+++ b/src/mame/drivers/lnw80.cpp
@@ -325,7 +325,7 @@ void lnw80_state::machine_start()
m_reg_load=1;
- m_cassette_data_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(lnw80_state::cassette_data_callback),this));
+ m_cassette_data_timer = timer_alloc(FUNC(lnw80_state::cassette_data_callback), this);
m_cassette_data_timer->adjust( attotime::zero, 0, attotime::from_hz(11025) );
}
diff --git a/src/mame/drivers/lwriter.cpp b/src/mame/drivers/lwriter.cpp
index 50451570e09..1964c633fb5 100644
--- a/src/mame/drivers/lwriter.cpp
+++ b/src/mame/drivers/lwriter.cpp
@@ -313,7 +313,7 @@ void lwriter_state::machine_start()
m_vram = make_unique_clear<uint8_t []>(FB_WIDTH * FB_HEIGHT / 8);
// do stuff here later on like setting up printer mechanisms HLE timers etc
- m_pb6_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(lwriter_state::pb6_tick), this));
+ m_pb6_timer = timer_alloc(FUNC(lwriter_state::pb6_tick), this);
m_pb6_timer->adjust(attotime::from_hz(PB6_CLK));
// Initialize ca1 to 1 so that we don't miss the first interrupt/transition to 0
diff --git a/src/mame/drivers/m10.cpp b/src/mame/drivers/m10.cpp
index 05b90831b70..e01078229f6 100644
--- a/src/mame/drivers/m10.cpp
+++ b/src/mame/drivers/m10.cpp
@@ -162,7 +162,7 @@ void m1x_state::palette(palette_device &palette) const
void m1x_state::machine_start()
{
- m_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(m1x_state::interrupt_callback), this));
+ m_interrupt_timer = timer_alloc(FUNC(m1x_state::interrupt_callback), this);
save_item(NAME(m_flip));
save_item(NAME(m_last));
diff --git a/src/mame/drivers/m68705prg.cpp b/src/mame/drivers/m68705prg.cpp
index a7a5df71bf3..96e09fdb913 100644
--- a/src/mame/drivers/m68705prg.cpp
+++ b/src/mame/drivers/m68705prg.cpp
@@ -54,11 +54,6 @@ public:
}
protected:
- enum
- {
- TIMER_INPUT_POLL
- };
-
void m68705prg(machine_config &config);
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(eprom_load)
@@ -99,14 +94,13 @@ protected:
m_digits.resolve();
m_leds.resolve();
- m_input_poll_timer = timer_alloc(TIMER_INPUT_POLL);
-
save_item(NAME(m_addr));
save_item(NAME(m_pb_val));
m_addr = 0x0000;
m_pb_val = 0xff;
+ m_input_poll_timer = timer_alloc(FUNC(m68705prg_state_base::input_poll_callback), this);
m_input_poll_timer->adjust(attotime::from_hz(120), 0, attotime::from_hz(120));
}
@@ -117,6 +111,10 @@ protected:
m_digits[2] = s_7seg[(m_addr >> 8) & 0x0f];
}
+ virtual TIMER_CALLBACK_MEMBER(input_poll_callback)
+ {
+ }
+
required_ioport m_sw;
required_region_ptr<u8> m_mcu_region;
required_device<generic_slot_device> m_eprom_image;
@@ -191,19 +189,7 @@ protected:
m_mcu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
}
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override
- {
- switch (id)
- {
- case TIMER_INPUT_POLL:
- input_poll_callback(param);
- break;
- default:
- driver_device::device_timer(timer, id, param);
- }
- }
-
- TIMER_CALLBACK_MEMBER(input_poll_callback)
+ virtual TIMER_CALLBACK_MEMBER(input_poll_callback) override
{
ioport_value const switches(m_sw->read());
bool const reset(!BIT(switches, 0));
diff --git a/src/mame/drivers/m72.cpp b/src/mame/drivers/m72.cpp
index 98bc85d4926..d039b19f864 100644
--- a/src/mame/drivers/m72.cpp
+++ b/src/mame/drivers/m72.cpp
@@ -209,12 +209,12 @@ other supported games as well.
void m72_state::machine_start()
{
- m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(m72_state::scanline_interrupt),this));
+ m_scanline_timer = timer_alloc(FUNC(m72_state::scanline_interrupt), this);
}
MACHINE_START_MEMBER(m72_state,kengo)
{
- m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(m72_state::kengo_scanline_interrupt),this));
+ m_scanline_timer = timer_alloc(FUNC(m72_state::kengo_scanline_interrupt), this);
}
TIMER_CALLBACK_MEMBER(m72_state::synch_callback)
diff --git a/src/mame/drivers/m79152pc.cpp b/src/mame/drivers/m79152pc.cpp
index 96342676af0..bdd535b525e 100644
--- a/src/mame/drivers/m79152pc.cpp
+++ b/src/mame/drivers/m79152pc.cpp
@@ -246,8 +246,8 @@ void m79152pc_state::machine_start()
m_line_count = 0;
m_hsync = false;
- m_hsync_on_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(m79152pc_state::hsync_on), this));
- m_hsync_off_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(m79152pc_state::hsync_off), this));
+ m_hsync_on_timer = timer_alloc(FUNC(m79152pc_state::hsync_on), this);
+ m_hsync_off_timer = timer_alloc(FUNC(m79152pc_state::hsync_off), this);
m_hsync_off_timer->adjust(m_screen->time_until_pos(9, 0), 0, m_screen->scan_period());
save_item(NAME(m_latch_full));
diff --git a/src/mame/drivers/mac128.cpp b/src/mame/drivers/mac128.cpp
index 91fb3a530fd..c62ddc12ff8 100644
--- a/src/mame/drivers/mac128.cpp
+++ b/src/mame/drivers/mac128.cpp
@@ -282,8 +282,8 @@ void mac128_state::machine_start()
m_ram_mask = m_ram_size - 1;
m_rom_ptr = (u16*)memregion("bootrom")->base();
- m_scan_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mac128_state::mac_scanline), this));
- m_hblank_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mac128_state::mac_hblank), this));
+ m_scan_timer = timer_alloc(FUNC(mac128_state::mac_scanline), this);
+ m_hblank_timer = timer_alloc(FUNC(mac128_state::mac_hblank), this);
save_item(NAME(m_overlay));
save_item(NAME(m_irq_count));
diff --git a/src/mame/drivers/macprtb.cpp b/src/mame/drivers/macprtb.cpp
index 2d0103b179e..8af17fc1532 100644
--- a/src/mame/drivers/macprtb.cpp
+++ b/src/mame/drivers/macprtb.cpp
@@ -291,7 +291,7 @@ void macportable_state::machine_start()
m_pmu_ack = m_pmu_req = 0;
m_adb_line = 1;
- m_6015_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(macportable_state::mac_6015_tick),this));
+ m_6015_timer = timer_alloc(FUNC(macportable_state::mac_6015_tick), this);
m_6015_timer->adjust(attotime::never);
}
diff --git a/src/mame/drivers/macpwrbk030.cpp b/src/mame/drivers/macpwrbk030.cpp
index 685dfe103e5..92727d14a6e 100644
--- a/src/mame/drivers/macpwrbk030.cpp
+++ b/src/mame/drivers/macpwrbk030.cpp
@@ -390,7 +390,7 @@ void macpb030_state::machine_start()
m_last_taken_interrupt = -1;
m_irq_count = m_ca1_data = m_ca2_data = 0;
- m_6015_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(macpb030_state::mac_6015_tick),this));
+ m_6015_timer = timer_alloc(FUNC(macpb030_state::mac_6015_tick), this);
m_6015_timer->adjust(attotime::never);
}
diff --git a/src/mame/drivers/macquadra700.cpp b/src/mame/drivers/macquadra700.cpp
index f718cba94ff..eec06d4d949 100644
--- a/src/mame/drivers/macquadra700.cpp
+++ b/src/mame/drivers/macquadra700.cpp
@@ -247,7 +247,7 @@ void macquadra_state::machine_start()
m_last_taken_interrupt = -1;
m_irq_count = m_ca2_data = 0;
- m_6015_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(macquadra_state::mac_6015_tick),this));
+ m_6015_timer = timer_alloc(FUNC(macquadra_state::mac_6015_tick), this);
m_6015_timer->adjust(attotime::never);
}
@@ -351,8 +351,8 @@ TIMER_CALLBACK_MEMBER(macquadra_state::dafb_cursor_tick)
void macquadra_state::video_start() // DAFB
{
- m_vbl_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(macquadra_state::dafb_vbl_tick),this));
- m_cursor_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(macquadra_state::dafb_cursor_tick),this));
+ m_vbl_timer = timer_alloc(FUNC(macquadra_state::dafb_vbl_tick), this);
+ m_cursor_timer = timer_alloc(FUNC(macquadra_state::dafb_cursor_tick), this);
m_vbl_timer->adjust(attotime::never);
m_cursor_timer->adjust(attotime::never);
diff --git a/src/mame/drivers/magmax.cpp b/src/mame/drivers/magmax.cpp
index 2e5aafef7bb..6ce7be0b4c5 100644
--- a/src/mame/drivers/magmax.cpp
+++ b/src/mame/drivers/magmax.cpp
@@ -69,7 +69,7 @@ TIMER_CALLBACK_MEMBER(magmax_state::scanline_callback)
void magmax_state::machine_start()
{
// Create interrupt timer
- m_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(magmax_state::scanline_callback),this));
+ m_interrupt_timer = timer_alloc(FUNC(magmax_state::scanline_callback), this);
// Set up save state
save_item(NAME(m_sound_latch));
diff --git a/src/mame/drivers/mappy.cpp b/src/mame/drivers/mappy.cpp
index bd4a0b76f8c..7e42d607eca 100644
--- a/src/mame/drivers/mappy.cpp
+++ b/src/mame/drivers/mappy.cpp
@@ -1306,8 +1306,8 @@ void mappy_state::machine_start()
{
m_leds.resolve();
- m_namcoio_run_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mappy_state::namcoio_run_timer<0>), this));
- m_namcoio_run_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mappy_state::namcoio_run_timer<1>), this));
+ m_namcoio_run_timer[0] = timer_alloc(FUNC(mappy_state::namcoio_run_timer<0>), this);
+ m_namcoio_run_timer[1] = timer_alloc(FUNC(mappy_state::namcoio_run_timer<1>), this);
save_item(NAME(m_main_irq_mask));
save_item(NAME(m_sub_irq_mask));
diff --git a/src/mame/drivers/mc1502.cpp b/src/mame/drivers/mc1502.cpp
index 9f007bd6d0c..f49dc15b7a7 100644
--- a/src/mame/drivers/mc1502.cpp
+++ b/src/mame/drivers/mc1502.cpp
@@ -276,8 +276,7 @@ void mc1502_state::machine_start()
*/
m_pic8259->ir1_w(1);
memset(&m_kbd, 0, sizeof(m_kbd));
- m_kbd.keyb_signal_timer =
- machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mc1502_state::keyb_signal_callback), this));
+ m_kbd.keyb_signal_timer = timer_alloc(FUNC(mc1502_state::keyb_signal_callback), this);
m_kbd.keyb_signal_timer->adjust(attotime::from_msec(20), 0, attotime::from_msec(20));
}
diff --git a/src/mame/drivers/mdisk.cpp b/src/mame/drivers/mdisk.cpp
index 067457d713e..3910b08ccf3 100644
--- a/src/mame/drivers/mdisk.cpp
+++ b/src/mame/drivers/mdisk.cpp
@@ -130,7 +130,7 @@ void mdisk_state::fdc_side_w(uint8_t data)
void mdisk_state::machine_start()
{
// timer to switch rom to ram
- m_rom_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mdisk_state::rom_timer_callback), this));
+ m_rom_timer = timer_alloc(FUNC(mdisk_state::rom_timer_callback), this);
// register for save states
save_item(NAME(m_uart1_rxrdy));
diff --git a/src/mame/drivers/mdt60.cpp b/src/mame/drivers/mdt60.cpp
index 45623589d4f..a6a6b78c379 100644
--- a/src/mame/drivers/mdt60.cpp
+++ b/src/mame/drivers/mdt60.cpp
@@ -75,7 +75,7 @@ private:
void mdt60_state::machine_start()
{
- m_baud_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mdt60_state::baud_timer), this));
+ m_baud_timer = timer_alloc(FUNC(mdt60_state::baud_timer), this);
m_baud_timer->adjust(attotime::zero);
save_item(NAME(m_keyin));
diff --git a/src/mame/drivers/megadriv.cpp b/src/mame/drivers/megadriv.cpp
index 6bdb5332d8b..1c44eb8dc5a 100644
--- a/src/mame/drivers/megadriv.cpp
+++ b/src/mame/drivers/megadriv.cpp
@@ -287,12 +287,15 @@ void md_cons_state::machine_start()
// setup timers for 6 button pads
for (int i = 0; i < 3; i++)
- m_io_timeout[i] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(md_base_state::io_timeout_timer_callback),this));
+ m_io_timeout[i] = timer_alloc(FUNC(md_base_state::io_timeout_timer_callback), this);
m_vdp->stop_timers();
if (m_cart)
m_cart->save_nvram();
+
+ if (m_z80snd)
+ m_genz80.z80_run_timer = timer_alloc(FUNC(md_base_state::megadriv_z80_run_state), this);
}
void md_cons_state::install_cartslot()
diff --git a/src/mame/drivers/megadriv_acbl.cpp b/src/mame/drivers/megadriv_acbl.cpp
index 7299c40b9e4..045a3b2cf94 100644
--- a/src/mame/drivers/megadriv_acbl.cpp
+++ b/src/mame/drivers/megadriv_acbl.cpp
@@ -1129,7 +1129,7 @@ void md_boot_6button_state::machine_start()
// Setup timers for 6 button pads
for (int i = 0; i < 3; i++)
- m_io_timeout[i] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(md_base_state::io_timeout_timer_callback),this));
+ m_io_timeout[i] = timer_alloc(FUNC(md_base_state::io_timeout_timer_callback), this);
}
void md_boot_6button_state::megadrvb_6b(machine_config &config)
diff --git a/src/mame/drivers/megadriv_rad.cpp b/src/mame/drivers/megadriv_rad.cpp
index 0ef0949cdbc..4668d5a841b 100644
--- a/src/mame/drivers/megadriv_rad.cpp
+++ b/src/mame/drivers/megadriv_rad.cpp
@@ -363,7 +363,7 @@ void megadriv_radica_6button_state::machine_start()
// setup timers for 6 button pads
for (int i = 0; i < 3; i++)
- m_io_timeout[i] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(md_base_state::io_timeout_timer_callback),this));
+ m_io_timeout[i] = timer_alloc(FUNC(md_base_state::io_timeout_timer_callback), this);
save_item(NAME(m_bank));
}
@@ -395,7 +395,7 @@ void megadriv_ra145_state::machine_start()
// setup timers for 6 button pads
for (int i = 0; i < 3; i++)
- m_io_timeout[i] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(md_base_state::io_timeout_timer_callback),this));
+ m_io_timeout[i] = timer_alloc(FUNC(md_base_state::io_timeout_timer_callback), this);
m_a1630a = 0;
save_item(NAME(m_a1630a));
diff --git a/src/mame/drivers/mekd1.cpp b/src/mame/drivers/mekd1.cpp
index 9bdb9604e9d..d530168f718 100644
--- a/src/mame/drivers/mekd1.cpp
+++ b/src/mame/drivers/mekd1.cpp
@@ -150,7 +150,8 @@ private:
DECLARE_WRITE_LINE_MEMBER(write_f11_clock);
DECLARE_WRITE_LINE_MEMBER(write_f13_clock);
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(bit_rate);
+ TIMER_CALLBACK_MEMBER(bit_rate_half);
emu_timer *m_bit_rate_timer;
emu_timer *m_bit_rate_half_timer;
@@ -277,21 +278,15 @@ WRITE_LINE_MEMBER(mekd1_state::pia0_cb2_w)
// This is a tape reader control line.
}
-void mekd1_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(mekd1_state::bit_rate)
{
- switch (id)
- {
- case TIMER_BIT_RATE:
- m_bit_rate_out = 1;
- break;
- case TIMER_BIT_RATE_HALF:
- m_bit_rate_half_out = 1;
- break;
- default:
- throw emu_fatalerror("Unknown id in mekd1_state::device_timer");
- }
+ m_bit_rate_out = 1;
}
+TIMER_CALLBACK_MEMBER(mekd1_state::bit_rate_half)
+{
+ m_bit_rate_half_out = 1;
+}
WRITE_LINE_MEMBER(mekd1_state::write_f1_clock)
{
@@ -392,8 +387,8 @@ void mekd1_state::machine_reset()
void mekd1_state::machine_start()
{
// Allocate timers
- m_bit_rate_timer = timer_alloc(TIMER_BIT_RATE);
- m_bit_rate_half_timer = timer_alloc(TIMER_BIT_RATE_HALF);
+ m_bit_rate_timer = timer_alloc(FUNC(mekd1_state::bit_rate), this);
+ m_bit_rate_half_timer = timer_alloc(FUNC(mekd1_state::bit_rate_half), this);
save_item(NAME(m_bit_rate_out));
save_item(NAME(m_bit_rate_half_out));
diff --git a/src/mame/drivers/mekd5.cpp b/src/mame/drivers/mekd5.cpp
index 5e80af3d563..36c4a8e3e11 100644
--- a/src/mame/drivers/mekd5.cpp
+++ b/src/mame/drivers/mekd5.cpp
@@ -113,12 +113,14 @@ public:
{ }
void mekd5(machine_config &config);
- void init_mekd5();
DECLARE_WRITE_LINE_MEMBER(reset_key_w);
DECLARE_INPUT_CHANGED_MEMBER(keypad_changed);
private:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
DECLARE_WRITE_LINE_MEMBER(trace_timer_clear_w);
DECLARE_READ_LINE_MEMBER(keypad_cb1_r);
@@ -139,11 +141,12 @@ private:
bool keypad_key_pressed();
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(trace_tick);
+
+ emu_timer *m_trace_timer = nullptr;
uint8_t m_segment;
uint8_t m_digit;
- virtual void machine_start() override;
- virtual void machine_reset() override;
+
required_device<m6802_cpu_device> m_maincpu;
required_device<pia6821_device> m_kpd_pia;
required_device<pia6821_device> m_user_pia;
@@ -240,21 +243,14 @@ INPUT_PORTS_END
************************************************************/
-void mekd5_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(mekd5_state::trace_tick)
{
- switch (id)
- {
- case TIMER_TRACE:
- // CB2 is programmed to trigger on the falling edge, so after
- // a count of 16. CB2 input comes from a counter, so the duty
- // cycle should be 50/50, but it makes no difference to rise
- // and fall here.
- m_kpd_pia->cb2_w(1);
- m_kpd_pia->cb2_w(0);
- break;
- default:
- throw emu_fatalerror("Unknown id in mekd5_state::device_timer");
- }
+ // CB2 is programmed to trigger on the falling edge, so after
+ // a count of 16. CB2 input comes from a counter, so the duty
+ // cycle should be 50/50, but it makes no difference to rise
+ // and fall here.
+ m_kpd_pia->cb2_w(1);
+ m_kpd_pia->cb2_w(0);
}
@@ -267,7 +263,7 @@ WRITE_LINE_MEMBER(mekd5_state::trace_timer_clear_w)
if (state)
m_kpd_pia->cb2_w(0);
else
- timer_set(attotime::from_ticks(21, XTAL_MEKD5 / 4), TIMER_TRACE);
+ m_trace_timer->adjust(attotime::from_ticks(21, XTAL_MEKD5 / 4));
}
/***********************************************************
@@ -417,14 +413,12 @@ WRITE_LINE_MEMBER(mekd5_state::write_f13_clock)
************************************************************/
-void mekd5_state::init_mekd5()
-{
-}
-
void mekd5_state::machine_start()
{
save_item(NAME(m_segment));
save_item(NAME(m_digit));
+
+ m_trace_timer = timer_alloc(FUNC(mekd5_state::trace_tick), this);
}
void mekd5_state::machine_reset()
@@ -526,4 +520,4 @@ ROM_END
***************************************************************************/
// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS
-COMP( 1980, mekd5, 0, 0, mekd5, mekd5, mekd5_state, init_mekd5, "Motorola", "MEK6802D5" , MACHINE_NO_SOUND )
+COMP( 1980, mekd5, 0, 0, mekd5, mekd5, mekd5_state, empty_init, "Motorola", "MEK6802D5" , MACHINE_NO_SOUND )
diff --git a/src/mame/drivers/metro.cpp b/src/mame/drivers/metro.cpp
index 4d81248f82c..8ca1da5ee47 100644
--- a/src/mame/drivers/metro.cpp
+++ b/src/mame/drivers/metro.cpp
@@ -131,18 +131,11 @@ void metro_state::cpu_space_map(address_map &map)
}
-void metro_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(metro_state::mouja_irq)
{
- switch (id)
- {
- case TIMER_MOUJA_IRQ:
- if (m_vdp) m_vdp->set_irq(0);
- if (m_vdp2) m_vdp2->set_irq(0);
- if (m_vdp3) m_vdp3->set_irq(0);
- break;
- default:
- throw emu_fatalerror("Unknown id in metro_state::device_timer");
- }
+ if (m_vdp) m_vdp->set_irq(0);
+ if (m_vdp2) m_vdp2->set_irq(0);
+ if (m_vdp3) m_vdp3->set_irq(0);
}
WRITE_LINE_MEMBER(metro_state::vblank_irq)
@@ -210,7 +203,7 @@ WRITE_LINE_MEMBER(metro_state::ext_irq5_enable_w)
m_ext_irq_enable = state;
}
-void metro_state::mouja_irq_timer_ctrl_w(uint16_t data)
+void metro_state::mouja_irq_timer_ctrl_w(u16 data)
{
double freq = 58.0 + (0xff - (data & 0xff)) / 2.2; /* 0xff=58Hz, 0x80=116Hz? */
@@ -414,7 +407,7 @@ void metro_state::coin_lockout_1word_w(u8 data)
// value written doesn't matter, also each counted coin gets reported after one full second.
// TODO: maybe the counter also controls lockout?
-void metro_state::coin_lockout_4words_w(offs_t offset, uint16_t data)
+void metro_state::coin_lockout_4words_w(offs_t offset, u16 data)
{
machine().bookkeeping().coin_counter_w((offset >> 1) & 1, offset & 1);
// machine().bookkeeping().coin_lockout_w((offset >> 1) & 1, offset & 1);
@@ -458,11 +451,11 @@ void metro_state::ymf278_map(address_map &map)
***************************************************************************/
/* Really weird way of mapping 3 DSWs */
-uint16_t metro_state::balcube_dsw_r(offs_t offset)
+u16 metro_state::balcube_dsw_r(offs_t offset)
{
- uint16_t dsw1 = ioport("DSW0")->read() >> 0;
- uint16_t dsw2 = ioport("DSW0")->read() >> 8;
- uint16_t dsw3 = ioport("IN2")->read();
+ u16 dsw1 = ioport("DSW0")->read() >> 0;
+ u16 dsw2 = ioport("DSW0")->read() >> 8;
+ u16 dsw3 = ioport("IN2")->read();
switch (offset * 2)
{
@@ -721,9 +714,9 @@ void metro_state::gakusai_oki_bank_lo_w(u8 data)
}
-uint16_t metro_state::gakusai_input_r()
+u16 metro_state::gakusai_input_r()
{
- uint16_t input_sel = (*m_input_sel) ^ 0x3e;
+ u16 input_sel = (*m_input_sel) ^ 0x3e;
// Bit 0 ??
if (input_sel & 0x0002) return ioport("KEY0")->read();
if (input_sel & 0x0004) return ioport("KEY1")->read();
@@ -1040,7 +1033,7 @@ void metro_state::mouja_okimap(address_map &map)
Puzzlet
***************************************************************************/
-void metro_state::puzzlet_irq_enable_w(uint8_t data)
+void metro_state::puzzlet_irq_enable_w(u8 data)
{
m_vdp2->irq_enable_w(data ^ 0xff);
}
@@ -1070,7 +1063,7 @@ void metro_state::puzzlet_map(address_map &map)
}
-void metro_state::puzzlet_portb_w(uint16_t data)
+void metro_state::puzzlet_portb_w(u16 data)
{
// popmessage("PORTB %02x", data);
}
@@ -5422,7 +5415,7 @@ void metro_state::init_vmetal()
void metro_state::init_mouja()
{
- m_mouja_irq_timer = timer_alloc(TIMER_MOUJA_IRQ);
+ m_mouja_irq_timer = timer_alloc(FUNC(metro_state::mouja_irq), this);
m_okibank->configure_entries(0, 8, memregion("oki")->base(), 0x20000);
}
diff --git a/src/mame/drivers/mgolf.cpp b/src/mame/drivers/mgolf.cpp
index f5923330dd7..645aadc752c 100644
--- a/src/mame/drivers/mgolf.cpp
+++ b/src/mame/drivers/mgolf.cpp
@@ -15,11 +15,6 @@
class mgolf_state : public driver_device
{
public:
- enum
- {
- TIMER_INTERRUPT
- };
-
mgolf_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
@@ -32,6 +27,12 @@ public:
void mgolf(machine_config &config);
private:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
+ void cpu_map(address_map &map);
+
void vram_w(offs_t offset, uint8_t data);
uint8_t wram_r(offs_t offset);
uint8_t dial_r();
@@ -49,12 +50,6 @@ private:
void update_plunger();
double calc_plunger_pos();
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void video_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
- void cpu_map(address_map &map);
-
/* devices */
required_device<cpu_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
@@ -146,19 +141,6 @@ void mgolf_state::update_plunger( )
}
-void mgolf_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_INTERRUPT:
- interrupt_callback(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in mgolf_state::device_timer");
- }
-}
-
-
TIMER_CALLBACK_MEMBER(mgolf_state::interrupt_callback)
{
int scanline = param;
@@ -346,7 +328,7 @@ GFXDECODE_END
void mgolf_state::machine_start()
{
- m_interrupt_timer = timer_alloc(TIMER_INTERRUPT);
+ m_interrupt_timer = timer_alloc(FUNC(mgolf_state::interrupt_callback), this);
save_item(NAME(m_prev));
save_item(NAME(m_mask));
diff --git a/src/mame/drivers/microterm_f8.cpp b/src/mame/drivers/microterm_f8.cpp
index cc64197d59c..42c358703d6 100644
--- a/src/mame/drivers/microterm_f8.cpp
+++ b/src/mame/drivers/microterm_f8.cpp
@@ -93,7 +93,7 @@ void microterm_f8_state::machine_start()
m_attrlatch = 0;
m_vram = make_unique_clear<u16[]>(0x800); // 6x MM2114 with weird addressing
- m_baud_clock = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(microterm_f8_state::baud_clock), this));
+ m_baud_clock = timer_alloc(FUNC(microterm_f8_state::baud_clock), this);
m_baud_clock->adjust(attotime::zero, 0);
save_item(NAME(m_port00));
diff --git a/src/mame/drivers/midzeus.cpp b/src/mame/drivers/midzeus.cpp
index 9c951065bf8..44983db7f79 100644
--- a/src/mame/drivers/midzeus.cpp
+++ b/src/mame/drivers/midzeus.cpp
@@ -140,10 +140,10 @@ void midzeus_state::machine_start()
m_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate());
m_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate());
- m_gun_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(midzeus_state::invasn_gun_callback), this));
- m_gun_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(midzeus_state::invasn_gun_callback), this));
+ m_gun_timer[0] = timer_alloc(FUNC(midzeus_state::invasn_gun_callback), this);
+ m_gun_timer[1] = timer_alloc(FUNC(midzeus_state::invasn_gun_callback), this);
- m_display_irq_off_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(midzeus_state::display_irq_off), this));
+ m_display_irq_off_timer = timer_alloc(FUNC(midzeus_state::display_irq_off), this);
save_item(NAME(m_crusnexo_leds_select));
save_item(NAME(m_disk_asic_jr));
diff --git a/src/mame/drivers/missile.cpp b/src/mame/drivers/missile.cpp
index 406519cd6f8..80769627836 100644
--- a/src/mame/drivers/missile.cpp
+++ b/src/mame/drivers/missile.cpp
@@ -551,11 +551,11 @@ void missile_state::machine_start()
m_ctrld = 0;
/* create a timer to speed/slow the CPU */
- m_cpu_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(missile_state::adjust_cpu_speed),this));
+ m_cpu_timer = timer_alloc(FUNC(missile_state::adjust_cpu_speed), this);
m_cpu_timer->adjust(m_screen->time_until_pos(v_to_scanline(0), 0));
/* create a timer for IRQs and set up the first callback */
- m_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(missile_state::clock_irq),this));
+ m_irq_timer = timer_alloc(FUNC(missile_state::clock_irq), this);
m_irq_state = 0;
schedule_next_irq(-32);
diff --git a/src/mame/drivers/mjsister.cpp b/src/mame/drivers/mjsister.cpp
index d69d9a19e7e..3cc21ff6559 100644
--- a/src/mame/drivers/mjsister.cpp
+++ b/src/mame/drivers/mjsister.cpp
@@ -41,14 +41,8 @@ public:
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
private:
- enum
- {
- TIMER_DAC
- };
-
/* video-related */
bool m_video_enable;
int m_colorbank;
@@ -160,18 +154,6 @@ MC6845_UPDATE_ROW( mjsister_state::crtc_update_row )
*
*************************************/
-void mjsister_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch(id)
- {
- case TIMER_DAC:
- dac_callback(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in mjsister_state::device_timer");
- }
-}
-
TIMER_CALLBACK_MEMBER(mjsister_state::dac_callback)
{
uint8_t *DACROM = memregion("samples")->base();
@@ -195,7 +177,7 @@ void mjsister_state::dac_adr_e_w(uint8_t data)
m_dac_adr = m_dac_adr_s << 8;
if (m_dac_busy == 0)
- synchronize(TIMER_DAC);
+ m_dac_timer->adjust(attotime::zero);
m_dac_busy = 1;
}
@@ -409,7 +391,7 @@ void mjsister_state::machine_start()
m_vram = make_unique_clear<uint8_t[]>(0x10000);
m_vrambank->configure_entries(0, 2, m_vram.get(), 0x8000);
- m_dac_timer = timer_alloc(TIMER_DAC);
+ m_dac_timer = timer_alloc(FUNC(mjsister_state::dac_callback), this);
save_pointer(NAME(m_vram), 0x10000);
save_item(NAME(m_dac_busy));
diff --git a/src/mame/drivers/mlanding.cpp b/src/mame/drivers/mlanding.cpp
index 1ed2502a22a..964e56150ce 100644
--- a/src/mame/drivers/mlanding.cpp
+++ b/src/mame/drivers/mlanding.cpp
@@ -103,14 +103,9 @@ protected:
virtual void machine_start() override;
virtual void machine_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(dma_complete);
private:
- enum
- {
- TIMER_DMA_COMPLETE
- };
-
static constexpr u32 c_dma_bank_words = 0x2000;
required_device<cpu_device> m_maincpu;
@@ -140,6 +135,7 @@ private:
u8 m_dma_cpu_bank;
u8 m_dma_busy;
u16 m_dsp_hold_signal;
+ emu_timer *m_dma_done_timer;
u32 m_msm_pos[2];
u8 m_msm_reset[2];
@@ -212,6 +208,9 @@ void mlanding_state::machine_start()
save_item(NAME(m_msm_nibble));
save_item(NAME(m_msm2_vck));
save_item(NAME(m_msm2_vck2));
+
+ // Allocate DMA timers
+ m_dma_done_timer = timer_alloc(FUNC(mlanding_state::dma_complete), this);
}
@@ -282,7 +281,7 @@ void mlanding_state::dma_start_w(u16 data)
m_dma_busy = 1;
// This is a rather crude estimate!
- timer_set(attotime::from_hz(16000000) * pixels, TIMER_DMA_COMPLETE);
+ m_dma_done_timer->adjust(attotime::from_hz(16000000) * pixels);
}
}
@@ -290,7 +289,7 @@ void mlanding_state::dma_start_w(u16 data)
void mlanding_state::dma_stop_w(u16 data)
{
m_dma_busy = 0;
- timer_set(attotime::never);
+ m_dma_done_timer->adjust(attotime::never);
}
@@ -424,17 +423,9 @@ u32 mlanding_state::exec_dma()
}
-void mlanding_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(mlanding_state::dma_complete)
{
- switch (id)
- {
- case TIMER_DMA_COMPLETE:
- m_dma_busy = 0;
- break;
-
- default:
- throw emu_fatalerror("Unknown id in mlanding_state::device_timer");
- }
+ m_dma_busy = 0;
}
diff --git a/src/mame/drivers/model3.cpp b/src/mame/drivers/model3.cpp
index 582b3703516..620868c807c 100644
--- a/src/mame/drivers/model3.cpp
+++ b/src/mame/drivers/model3.cpp
@@ -1325,33 +1325,33 @@ MACHINE_START_MEMBER(model3_state,model3_10)
{
configure_fast_ram();
- m_sound_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(model3_state::model3_sound_timer_tick),this));
- m_real3d_dma_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(model3_state::real3d_dma_timer_callback),this));
- m_scan_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(model3_state::model3_scan_timer_tick),this));
+ m_sound_timer = timer_alloc(FUNC(model3_state::model3_sound_timer_tick), this);
+ m_real3d_dma_timer = timer_alloc(FUNC(model3_state::real3d_dma_timer_callback), this);
+ m_scan_timer = timer_alloc(FUNC(model3_state::model3_scan_timer_tick), this);
}
MACHINE_START_MEMBER(model3_state,model3_15)
{
configure_fast_ram();
- m_sound_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(model3_state::model3_sound_timer_tick),this));
- m_real3d_dma_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(model3_state::real3d_dma_timer_callback),this));
- m_scan_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(model3_state::model3_scan_timer_tick),this));
+ m_sound_timer = timer_alloc(FUNC(model3_state::model3_sound_timer_tick), this);
+ m_real3d_dma_timer = timer_alloc(FUNC(model3_state::real3d_dma_timer_callback), this);
+ m_scan_timer = timer_alloc(FUNC(model3_state::model3_scan_timer_tick), this);
}
MACHINE_START_MEMBER(model3_state,model3_20)
{
configure_fast_ram();
- m_sound_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(model3_state::model3_sound_timer_tick),this));
- m_real3d_dma_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(model3_state::real3d_dma_timer_callback),this));
- m_scan_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(model3_state::model3_scan_timer_tick),this));
+ m_sound_timer = timer_alloc(FUNC(model3_state::model3_sound_timer_tick), this);
+ m_real3d_dma_timer = timer_alloc(FUNC(model3_state::real3d_dma_timer_callback), this);
+ m_scan_timer = timer_alloc(FUNC(model3_state::model3_scan_timer_tick), this);
}
MACHINE_START_MEMBER(model3_state,model3_21)
{
configure_fast_ram();
- m_sound_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(model3_state::model3_sound_timer_tick),this));
- m_real3d_dma_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(model3_state::real3d_dma_timer_callback),this));
- m_scan_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(model3_state::model3_scan_timer_tick),this));
+ m_sound_timer = timer_alloc(FUNC(model3_state::model3_sound_timer_tick), this);
+ m_real3d_dma_timer = timer_alloc(FUNC(model3_state::real3d_dma_timer_callback), this);
+ m_scan_timer = timer_alloc(FUNC(model3_state::model3_scan_timer_tick), this);
}
void model3_state::model3_init(int step)
diff --git a/src/mame/drivers/moo.cpp b/src/mame/drivers/moo.cpp
index 00746a0e5f8..bfb62dae79d 100644
--- a/src/mame/drivers/moo.cpp
+++ b/src/mame/drivers/moo.cpp
@@ -473,7 +473,7 @@ MACHINE_START_MEMBER(moo_state,moo)
save_item(NAME(m_layerpri));
save_item(NAME(m_protram));
- m_dmaend_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(moo_state::dmaend_callback),this));
+ m_dmaend_timer = timer_alloc(FUNC(moo_state::dmaend_callback), this);
}
MACHINE_RESET_MEMBER(moo_state,moo)
diff --git a/src/mame/drivers/mpf1.cpp b/src/mame/drivers/mpf1.cpp
index ee1192aeff5..974d612709c 100644
--- a/src/mame/drivers/mpf1.cpp
+++ b/src/mame/drivers/mpf1.cpp
@@ -338,7 +338,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(mpf1_state::check_halt_callback)
void mpf1_state::machine_start()
{
- m_led_refresh_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mpf1_state::led_refresh),this));
+ m_led_refresh_timer = timer_alloc(FUNC(mpf1_state::led_refresh), this);
m_digits.resolve();
m_leds.resolve();
diff --git a/src/mame/drivers/mpu3.cpp b/src/mame/drivers/mpu3.cpp
index 2fb62b71fab..86b9d11c526 100644
--- a/src/mame/drivers/mpu3.cpp
+++ b/src/mame/drivers/mpu3.cpp
@@ -726,7 +726,7 @@ INPUT_PORTS_END
/* Common configurations */
void mpu3_state::machine_start()
{
- m_ic21_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mpu3_state::ic21_timeout),this));
+ m_ic21_timer = timer_alloc(FUNC(mpu3_state::ic21_timeout), this);
m_triac.resolve();
m_digit.resolve();
diff --git a/src/mame/drivers/multigam.cpp b/src/mame/drivers/multigam.cpp
index 49aa9792262..1d90449a3df 100644
--- a/src/mame/drivers/multigam.cpp
+++ b/src/mame/drivers/multigam.cpp
@@ -219,7 +219,7 @@ private:
void multigam_init_mmc1(uint8_t *prg_base, int prg_size, int chr_bank_base);
void supergm3_set_bank();
void multigm3_decrypt(uint8_t* mem, int memsize, const uint8_t* decode_nibble);
- void multigam3_mmc3_scanline_cb(int scanline, int vblank, int blanked);
+ void multigam3_mmc3_scanline_cb(int scanline, bool vblank, bool blanked);
void multigam_map(address_map &map);
void multigm3_map(address_map &map);
void multigmt_map(address_map &map);
@@ -441,7 +441,7 @@ void multigam_state::ppu_map(address_map &map)
*******************************************************/
-void multigam_state::multigam3_mmc3_scanline_cb( int scanline, int vblank, int blanked )
+void multigam_state::multigam3_mmc3_scanline_cb(int scanline, bool vblank, bool blanked)
{
if (!vblank && !blanked)
{
diff --git a/src/mame/drivers/mw8080bw.cpp b/src/mame/drivers/mw8080bw.cpp
index 604863c7919..74ce44b8eff 100644
--- a/src/mame/drivers/mw8080bw.cpp
+++ b/src/mame/drivers/mw8080bw.cpp
@@ -887,7 +887,7 @@ MACHINE_START_MEMBER(mw8080bw_state,maze)
mw8080bw_state::machine_start();
/* create astable timer for IC B1 */
- m_maze_tone_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mw8080bw_state::maze_tone_timing_timer_callback), this));
+ m_maze_tone_timer = timer_alloc(FUNC(mw8080bw_state::maze_tone_timing_timer_callback), this);
m_maze_tone_timer->adjust(MAZE_555_B1_PERIOD, 0, MAZE_555_B1_PERIOD);
/* initialize state of Tone Timing FF, IC C1 */
diff --git a/src/mame/drivers/myb3k.cpp b/src/mame/drivers/myb3k.cpp
index 968d8f079a1..abe48efca6e 100644
--- a/src/mame/drivers/myb3k.cpp
+++ b/src/mame/drivers/myb3k.cpp
@@ -79,12 +79,6 @@
#define LOGCENT(...) LOGMASKED(LOG_CENT, __VA_ARGS__)
#define LOGRAM(...) LOGMASKED(LOG_RAM, __VA_ARGS__)
-#ifdef _MSC_VER
-#define FUNCNAME __func__
-#else
-#define FUNCNAME __PRETTY_FUNCTION__
-#endif
-
class myb3k_state : public driver_device
{
public:
@@ -117,6 +111,12 @@ public:
DECLARE_INPUT_CHANGED_MEMBER(monitor_changed);
private:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
+ void myb3k_io(address_map &map);
+ void myb3k_map(address_map &map);
+
/* Interrupt controller */
DECLARE_WRITE_LINE_MEMBER( pic_int_w );
@@ -130,18 +130,18 @@ private:
void dma_segment_w(uint8_t data);
uint8_t dma_memory_read_byte(offs_t offset);
void dma_memory_write_byte(offs_t offset, uint8_t data);
- uint8_t io_dack0_r() { uint8_t tmp = m_isabus->dack_r(0); LOGDMA("%s: %02x\n", FUNCNAME, tmp); return tmp; }
- uint8_t io_dack1_r() { uint8_t tmp = m_isabus->dack_r(1); LOGDMA("%s: %02x\n", FUNCNAME, tmp); return tmp; }
- uint8_t io_dack2_r() { uint8_t tmp = m_isabus->dack_r(2); LOGDMA("%s: %02x\n", FUNCNAME, tmp); return tmp; }
- uint8_t io_dack3_r() { uint8_t tmp = m_isabus->dack_r(3); LOGDMA("%s: %02x\n", FUNCNAME, tmp); return tmp; }
- void io_dack0_w(uint8_t data) { LOGDMA("%s: %02x\n", FUNCNAME, data); m_isabus->dack_w(0,data); }
- void io_dack1_w(uint8_t data) { LOGDMA("%s: %02x\n", FUNCNAME, data); m_isabus->dack_w(1,data); }
- void io_dack2_w(uint8_t data) { LOGDMA("%s: %02x\n", FUNCNAME, data); m_isabus->dack_w(2,data); }
- void io_dack3_w(uint8_t data) { LOGDMA("%s: %02x\n", FUNCNAME, data); m_isabus->dack_w(3,data); }
- DECLARE_WRITE_LINE_MEMBER( dack0_w ){ LOGDMA("%s: %d\n", FUNCNAME, state); select_dma_channel(0, state); }
- DECLARE_WRITE_LINE_MEMBER( dack1_w ){ LOGDMA("%s: %d\n", FUNCNAME, state); select_dma_channel(1, state); }
- DECLARE_WRITE_LINE_MEMBER( dack2_w ){ LOGDMA("%s: %d\n", FUNCNAME, state); select_dma_channel(2, state); }
- DECLARE_WRITE_LINE_MEMBER( dack3_w ){ LOGDMA("%s: %d\n", FUNCNAME, state); select_dma_channel(3, state); }
+ uint8_t io_dack0_r() { uint8_t tmp = m_isabus->dack_r(0); LOGDMA("io_dack0_r: %02x\n", tmp); return tmp; }
+ uint8_t io_dack1_r() { uint8_t tmp = m_isabus->dack_r(1); LOGDMA("io_dack1_r: %02x\n", tmp); return tmp; }
+ uint8_t io_dack2_r() { uint8_t tmp = m_isabus->dack_r(2); LOGDMA("io_dack2_r: %02x\n", tmp); return tmp; }
+ uint8_t io_dack3_r() { uint8_t tmp = m_isabus->dack_r(3); LOGDMA("io_dack3_r: %02x\n", tmp); return tmp; }
+ void io_dack0_w(uint8_t data) { LOGDMA("io_dack0_w: %02x\n", data); m_isabus->dack_w(0, data); }
+ void io_dack1_w(uint8_t data) { LOGDMA("io_dack1_w: %02x\n", data); m_isabus->dack_w(1, data); }
+ void io_dack2_w(uint8_t data) { LOGDMA("io_dack2_w: %02x\n", data); m_isabus->dack_w(2, data); }
+ void io_dack3_w(uint8_t data) { LOGDMA("io_dack3_w: %02x\n", data); m_isabus->dack_w(3, data); }
+ DECLARE_WRITE_LINE_MEMBER( dack0_w ){ LOGDMA("dack0_w: %d\n", state); select_dma_channel(0, state); }
+ DECLARE_WRITE_LINE_MEMBER( dack1_w ){ LOGDMA("dack1_w: %d\n", state); select_dma_channel(1, state); }
+ DECLARE_WRITE_LINE_MEMBER( dack2_w ){ LOGDMA("dack2_w: %d\n", state); select_dma_channel(2, state); }
+ DECLARE_WRITE_LINE_MEMBER( dack3_w ){ LOGDMA("dack3_w: %d\n", state); select_dma_channel(3, state); }
/* Timer */
DECLARE_WRITE_LINE_MEMBER( pit_out1_changed );
@@ -169,12 +169,6 @@ private:
/* Status bits */
uint8_t myb3k_io_status_r();
- void myb3k_io(address_map &map);
- void myb3k_map(address_map &map);
-
- virtual void machine_start() override;
- virtual void machine_reset() override;
-
/* Interrupt Controller */
void pic_ir5_w(int source, int state);
void pic_ir7_w(int source, int state);
@@ -205,11 +199,7 @@ private:
void select_dma_channel(int channel, bool state);
/* Timer */
- enum
- {
- TIMER_ID_KEY_INTERRUPT
- };
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(key_interrupt);
/* Status bits */
enum
@@ -249,17 +239,18 @@ private:
uint8_t m_portc;
uint8_t m_dma_page[4]; // a 74670, 4 x 4 bit storage latch
int8_t m_io_status;
+ emu_timer *m_key_timer = nullptr;
};
uint8_t myb3k_state::myb3k_io_status_r()
{
- LOGCENT("%s\n", FUNCNAME);
+ LOGCENT("myb3k_io_status_r\n");
return m_io_status & 0x0f;
}
uint8_t myb3k_state::myb3k_kbd_r()
{
- LOGKBD("%s: %02x\n", FUNCNAME, m_kbd_data);
+ LOGKBD("myb3k_kbd_r: %02x\n", m_kbd_data);
/* IN from port 0x04 enables a 74LS244 buffer that
presents to the CPU the parallel bits from the 74LS164
@@ -268,8 +259,9 @@ uint8_t myb3k_state::myb3k_kbd_r()
return m_kbd_data;
}
-void myb3k_state::kbd_set_data_and_interrupt(u8 data) {
- LOGKBD("%s: %02x\n", FUNCNAME, data);
+void myb3k_state::kbd_set_data_and_interrupt(u8 data)
+{
+ LOGKBD("kbd_set_data_and_interrupt: %02x\n", data);
m_kbd_data = data;
/* The INT7 line is pulled low when a clock is detected from the keyboard. */
@@ -278,18 +270,13 @@ void myb3k_state::kbd_set_data_and_interrupt(u8 data) {
/* When the clock stops, the INT7 line goes back high. This triggers the interrupt.
We simulate the time it takes to send the 8 bits over the serial line
here. It should be 0.8ms but is rounded off to 1ms. */
- timer_set(attotime::from_msec(1), TIMER_ID_KEY_INTERRUPT);
+ m_key_timer->adjust(attotime::from_msec(1));
}
-void myb3k_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(myb3k_state::key_interrupt)
{
- switch (id)
- {
- case TIMER_ID_KEY_INTERRUPT:
- /* The serial transfer of 8 bits is complete. Now trigger INT7. */
- m_pic8259->ir1_w(ASSERT_LINE);
- break;
- }
+ /* The serial transfer of 8 bits is complete. Now trigger INT7. */
+ m_pic8259->ir1_w(ASSERT_LINE);
}
MC6845_UPDATE_ROW( myb3k_state::crtc_update_row )
@@ -441,7 +428,7 @@ MC6845_UPDATE_ROW( myb3k_state::crtc_update_row )
void myb3k_state::myb3k_video_mode_w(uint8_t data)
{
- LOG("%s: %02x\n", FUNCNAME, data);
+ LOG("myb3k_video_mode_w: %02x\n", data);
LOGVMOD("Video Mode %02x\n", data);
/* ---- -x-- interlace mode */
@@ -674,7 +661,7 @@ INPUT_CHANGED_MEMBER(myb3k_state::monitor_changed)
void myb3k_state::machine_start()
{
- LOG("%s\n", FUNCNAME);
+ LOG("machine_start\n");
/* Color palette for use with a RGB color CRT monitor such as the 12" Ericsson DU4720:
76 degrees deflection, WxHxD: 373x375x428mm, Weight 12.8 Kg, 215x134.4mm display area,
@@ -724,62 +711,67 @@ void myb3k_state::machine_start()
/* No key presses allowed yet */
m_kbd_data = 0;
- save_item (NAME (m_dma_channel));
- save_item (NAME (m_cur_tc));
- save_item (NAME (m_kbd_data));
- save_item (NAME (m_vmode));
- save_item (NAME (m_portc));
- save_item (NAME (*m_pal));
+ save_item(NAME(m_dma_channel));
+ save_item(NAME(m_cur_tc));
+ save_item(NAME(m_kbd_data));
+ save_item(NAME(m_vmode));
+ save_item(NAME(m_portc));
+ save_item(NAME(*m_pal));
save_pointer(NAME(m_mpal), sizeof(m_mpal));
save_pointer(NAME(m_cpal), sizeof(m_cpal));
save_pointer(NAME(m_dma_page), sizeof(m_dma_page));
- save_item (NAME (m_io_status));
+ save_item(NAME(m_io_status));
+
+ m_key_timer = timer_alloc(FUNC(myb3k_state::key_interrupt), this);
}
void myb3k_state::machine_reset()
{
- LOG("%s\n", FUNCNAME);
+ LOG("machine_reset\n");
m_cur_tc = false;
m_dma_channel = -1;
m_vmode = 0;
m_portc = 0;
memset(m_dma_page, 0, sizeof(m_dma_page));
- m_pal = (m_io_monitor-> read() & 1) == 1 ? &m_mpal : &m_cpal;
+ m_pal = (m_io_monitor->read() & 1) ? &m_mpal : &m_cpal;
}
void myb3k_state::select_dma_channel(int channel, bool state)
{
- LOGDMA("%s: %d:%d\n", FUNCNAME, channel, state);
- if(!state) {
+ LOGDMA("select_dma_channel: %d:%d\n", channel, state);
+ if (!state)
+ {
m_dma_channel = channel;
- if(!m_cur_tc)
- m_isabus->eop_w(channel, ASSERT_LINE );
+ if (!m_cur_tc)
+ m_isabus->eop_w(channel, ASSERT_LINE);
- } else if(m_dma_channel == channel) {
+ }
+ else if (m_dma_channel == channel)
+ {
m_dma_channel = -1;
if(m_cur_tc)
- m_isabus->eop_w(channel, CLEAR_LINE );
+ m_isabus->eop_w(channel, CLEAR_LINE);
}
}
WRITE_LINE_MEMBER( myb3k_state::tc_w )
{
- LOGDMA("%s: %d\n", FUNCNAME, state);
- if(m_dma_channel != -1 && (state == ASSERT_LINE) != m_cur_tc)
- m_isabus->eop_w(m_dma_channel, m_cur_tc ? ASSERT_LINE : CLEAR_LINE );
+ LOGDMA("tc_w: %d\n", state);
+ if (m_dma_channel != -1 && (state == ASSERT_LINE) != m_cur_tc)
+ m_isabus->eop_w(m_dma_channel, m_cur_tc ? ASSERT_LINE : CLEAR_LINE);
m_cur_tc = state == ASSERT_LINE;
}
WRITE_LINE_MEMBER(myb3k_state::pic_int_w)
{
- LOGPIC("%s: %d\n", FUNCNAME, state);
+ LOGPIC("pic_int_w: %d\n", state);
m_maincpu->set_input_line(0, state);
}
/* pic_ir5_w - select interrupt source depending on jumper J4 setting, either ISA IRQ5 or PPI PC3 (Light Pen) */
void myb3k_state::pic_ir5_w(int source, int state)
{
- LOGPIC("%s: %d\n", FUNCNAME, state);
+ LOGPIC("pic_ir5_w: %d\n", state);
if (!machine().paused() && (source & m_io_j4->read()))
m_pic8259->ir5_w(state);
}
@@ -787,26 +779,26 @@ void myb3k_state::pic_ir5_w(int source, int state)
/* pic_ir7_w - select interrupt source depending on jumper J5 setting, either ISA IRQ7 or Centronics Ack */
void myb3k_state::pic_ir7_w(int source, int state)
{
- LOGPIC("%s: %d\n", FUNCNAME, state);
+ LOGPIC("pic_ir7_w: %d\n", state);
if (!machine().paused() && (source & m_io_j5->read()))
m_pic8259->ir7_w(state);
}
WRITE_LINE_MEMBER( myb3k_state::pit_out1_changed )
{
- LOGPIT("%s: %d\n", FUNCNAME, state);
- m_speaker->level_w(state ? 1 : 0);
+ LOGPIT("pit_out1_changed: %d\n", state);
+ m_speaker->level_w(state);
}
void myb3k_state::dma_segment_w(uint8_t data)
{
- LOGDMA("%s: %02x\n", FUNCNAME, data);
- m_dma_page[(data >> 6) & 3] = (data & 0x0f);
+ LOGDMA("dma_segment_w: %02x\n", data);
+ m_dma_page[(data >> 6) & 3] = data & 0x0f;
}
WRITE_LINE_MEMBER(myb3k_state::hrq_w)
{
- LOGDMA("%s: %d\n", FUNCNAME, state);
+ LOGDMA("hrq_w: %d\n", state);
// Should connect to hold input clocked by DMA clock but hold isn't emulated
m_maincpu->set_input_line(INPUT_LINE_HALT, state);
@@ -821,7 +813,7 @@ uint8_t myb3k_state::dma_memory_read_byte(offs_t offset)
address_space& prog_space = m_maincpu->space(AS_PROGRAM);
uint8_t tmp = prog_space.read_byte(offset | m_dma_page[m_dma_channel & 3] << 16);
- LOGDMA("%s: %x:%04x => %02x\n", FUNCNAME, m_dma_channel, offset, tmp);
+ LOGDMA("dma_memory_read_byte: %x:%04x => %02x\n", m_dma_channel, offset, tmp);
return tmp;
}
@@ -831,21 +823,21 @@ void myb3k_state::dma_memory_write_byte(offs_t offset, uint8_t data)
assert(m_dma_channel != -1);
address_space& prog_space = m_maincpu->space(AS_PROGRAM);
- LOGDMA("%s: %x:%04x <= %02x\n", FUNCNAME, m_dma_channel, offset, data);
+ LOGDMA("dma_memory_write_byte: %x:%04x <= %02x\n", m_dma_channel, offset, data);
return prog_space.write_byte(offset | m_dma_page[m_dma_channel & 3] << 16, data);
}
uint8_t myb3k_state::ppi_portb_r()
{
- LOGPPI("%s\n", FUNCNAME);
+ LOGPPI("ppi_portb_r\n");
return m_io_dsw1->read();
}
void myb3k_state::ppi_portc_w(uint8_t data)
{
- LOGPPI("%s: %02x\n", FUNCNAME, data);
+ LOGPPI("ppi_portc_w: %02x\n", data);
LOGPPI(" - STROBE : %d\n", (data & PC0_STROBE) ? 1 : 0);
LOGPPI(" - SETPAGE: %d\n", (data & PC1_SETPAGE) ? 1 : 0);
LOGPPI(" - DISPST : %d\n", (data & PC2_DISPST) ? 1 : 0);
@@ -854,7 +846,7 @@ void myb3k_state::ppi_portc_w(uint8_t data)
LOGPPI(" - BUZON : %d\n", (data & PC5_BUZON) ? 1 : 0);
LOGPPI(" - CMTWRD : %d\n", (data & PC6_CMTWRD) ? 1 : 0);
LOGPPI(" - CMTEN : %d\n", (data & PC7_CMTEN) ? 1 : 0);
- LOGPPI(" => CMTEN: %d BUZON: %d\n", (data & PC7_CMTEN) ? 1 : 0, (data & PC5_BUZON)? 1 : 0);
+ LOGPPI(" => CMTEN: %d BUZON: %d\n", (data & PC7_CMTEN) ? 1 : 0, (data & PC5_BUZON) ? 1 : 0);
/* Centronics strobe signal */
LOGCENT("Centronics strobe %d\n", (data & PC0_STROBE) ? 1 : 0);
@@ -867,7 +859,7 @@ void myb3k_state::ppi_portc_w(uint8_t data)
* (CMTEN is active low and CMTRD is inactive high)
* and CMTRD is low). Problem is that the schematics fails to show where CMTRD comes from so only the first case is emulated
*/
- m_pit8253->write_gate1(!(data & PC5_BUZON) && (data & PC7_CMTEN)? 1 : 0);
+ m_pit8253->write_gate1(!(data & PC5_BUZON) && (data & PC7_CMTEN) ? 1 : 0);
/* Update light pen interrupt */
pic_ir5_w(PPI_PC3, (data & PC3_LPENB) ? 1 : 0);
@@ -880,29 +872,30 @@ void myb3k_state::ppi_portc_w(uint8_t data)
/* ISA IRQ5 handler */
WRITE_LINE_MEMBER (myb3k_state::isa_irq5_w)
{
- LOGCENT("%s %d\n", FUNCNAME, state);
- pic_ir5_w(ISA_IRQ5, state);
+ LOGCENT("isa_irq5_w %d\n", state);
+ pic_ir5_w(ISA_IRQ5, state);
}
/* ISA IRQ7 handler */
WRITE_LINE_MEMBER (myb3k_state::isa_irq7_w)
{
- LOGCENT("%s %d\n", FUNCNAME, state);
- pic_ir7_w(ISA_IRQ7, state);
+ LOGCENT("isa_irq7_w %d\n", state);
+ pic_ir7_w(ISA_IRQ7, state);
}
/* Centronics ACK handler */
WRITE_LINE_MEMBER (myb3k_state::centronics_ack_w)
{
- LOGCENT("%s %d\n", FUNCNAME, state);
- pic_ir7_w(CENT_ACK, state);
+ LOGCENT("centronics_ack_w %d\n", state);
+ pic_ir7_w(CENT_ACK, state);
}
/* Centronics BUSY handler
* The busy line is enterring the schematics from the connector but is lost to its way to the status latch
* but there is only two possibilities, either D0 or D1 */
-WRITE_LINE_MEMBER (myb3k_state::centronics_busy_w){
- LOGCENT("%s %d\n", FUNCNAME, state);
+WRITE_LINE_MEMBER (myb3k_state::centronics_busy_w)
+{
+ LOGCENT("centronics_busy_w %d\n", state);
if (state == ASSERT_LINE)
m_io_status &= ~IOSTAT_BUSY;
else
@@ -910,8 +903,9 @@ WRITE_LINE_MEMBER (myb3k_state::centronics_busy_w){
}
/* Centronics PERROR handler */
-WRITE_LINE_MEMBER (myb3k_state::centronics_perror_w){
- LOGCENT("%s %d\n", FUNCNAME, state);
+WRITE_LINE_MEMBER (myb3k_state::centronics_perror_w)
+{
+ LOGCENT("centronics_perror_w %d\n", state);
if (state == ASSERT_LINE)
m_io_status &= ~IOSTAT_FAULT;
else
@@ -919,8 +913,9 @@ WRITE_LINE_MEMBER (myb3k_state::centronics_perror_w){
}
/* Centronics SELECT handler - The centronics select signal is not used by this hardware */
-WRITE_LINE_MEMBER (myb3k_state::centronics_select_w){
- LOGCENT("%s %d - not used by machine\n", FUNCNAME, state);
+WRITE_LINE_MEMBER (myb3k_state::centronics_select_w)
+{
+ LOGCENT("centronics_select_w %d - not used by machine\n", state);
}
static void stepone_isa_cards(device_slot_interface &device)
diff --git a/src/mame/drivers/namcofl.cpp b/src/mame/drivers/namcofl.cpp
index 5b401a92df4..5d904687d25 100644
--- a/src/mame/drivers/namcofl.cpp
+++ b/src/mame/drivers/namcofl.cpp
@@ -493,9 +493,9 @@ TIMER_DEVICE_CALLBACK_MEMBER(namcofl_state::mcu_irq2_cb)
void namcofl_state::machine_start()
{
- m_raster_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(namcofl_state::raster_interrupt_callback),this));
- m_network_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(namcofl_state::network_interrupt_callback),this));
- m_vblank_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(namcofl_state::vblank_interrupt_callback),this));
+ m_raster_interrupt_timer = timer_alloc(FUNC(namcofl_state::raster_interrupt_callback), this);
+ m_network_interrupt_timer = timer_alloc(FUNC(namcofl_state::network_interrupt_callback), this);
+ m_vblank_interrupt_timer = timer_alloc(FUNC(namcofl_state::vblank_interrupt_callback), this);
m_mainbank.select(1);
}
diff --git a/src/mame/drivers/namcona1.cpp b/src/mame/drivers/namcona1.cpp
index 5176dd04bae..286d9650a3a 100644
--- a/src/mame/drivers/namcona1.cpp
+++ b/src/mame/drivers/namcona1.cpp
@@ -520,7 +520,7 @@ void namcona1_state::vreg_w(offs_t offset, u16 data, u16 mem_mask)
break;
case 0x1a / 2:
- m_mEnableInterrupts = 1;
+ m_enable_interrupts = 1;
/* interrupt enable mask; 0 enables INT level */
break;
case 0xb0 / 2:
@@ -746,9 +746,9 @@ void namcona1_state::port8_w(u8 data)
void namcona1_state::machine_start()
{
- m_mEnableInterrupts = 0;
+ m_enable_interrupts = 0;
std::fill(std::begin(m_mcu_mailbox), std::end(m_mcu_mailbox), 0);
- save_item(NAME(m_mEnableInterrupts));
+ save_item(NAME(m_enable_interrupts));
save_item(NAME(m_count));
save_item(NAME(m_mcu_mailbox));
save_item(NAME(m_mcu_port4));
@@ -756,7 +756,7 @@ void namcona1_state::machine_start()
save_item(NAME(m_mcu_port6));
save_item(NAME(m_mcu_port8));
- m_scan_timer = timer_alloc(TIMER_SCANLINE);
+ m_scan_timer = timer_alloc(FUNC(namcona1_state::set_scanline_interrupt), this);
}
// the MCU boots the 68000
@@ -991,7 +991,7 @@ GFXDECODE_END
void namcona1_state::scanline_interrupt(int scanline)
{
- const u16 enabled = m_mEnableInterrupts ? ~m_vreg[0x1a / 2] : 0;
+ const u16 enabled = m_enable_interrupts ? ~m_vreg[0x1a / 2] : 0;
// vblank
if (scanline == 224)
@@ -1013,12 +1013,9 @@ void namcona1_state::scanline_interrupt(int scanline)
}
}
-void namcona1_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(namcona1_state::set_scanline_interrupt)
{
- if (id == TIMER_SCANLINE)
- {
- scanline_interrupt(m_screen->vpos());
- }
+ scanline_interrupt(m_screen->vpos());
}
void namcona1_state::c69(machine_config &config)
diff --git a/src/mame/drivers/namcos23.cpp b/src/mame/drivers/namcos23.cpp
index 26cd813a92c..659e6481d27 100644
--- a/src/mame/drivers/namcos23.cpp
+++ b/src/mame/drivers/namcos23.cpp
@@ -3518,7 +3518,7 @@ void namcos23_state::machine_start()
{
m_lamps.resolve();
- m_c361.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(namcos23_state::c361_timer_cb),this));
+ m_c361.timer = timer_alloc(FUNC(namcos23_state::c361_timer_cb), this);
m_c361.timer->adjust(attotime::never);
m_maincpu->add_fastram(0, m_mainram.bytes()-1, false, reinterpret_cast<uint32_t *>(memshare("mainram")->ptr()));
diff --git a/src/mame/drivers/nc.cpp b/src/mame/drivers/nc.cpp
index 8be5d21d178..49d147692fc 100644
--- a/src/mame/drivers/nc.cpp
+++ b/src/mame/drivers/nc.cpp
@@ -1102,7 +1102,7 @@ void nc_state::machine_start()
m_card_size = 0;
/* keyboard timer */
- m_keyboard_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(nc_state::nc_keyboard_timer_callback),this));
+ m_keyboard_timer = timer_alloc(FUNC(nc_state::nc_keyboard_timer_callback), this);
m_keyboard_timer->adjust(attotime::from_msec(10));
m_nvram->set_base(m_ram->pointer(), m_ram->size());
diff --git a/src/mame/drivers/nds.cpp b/src/mame/drivers/nds.cpp
index 0e7086c74a5..8936ea5a47b 100644
--- a/src/mame/drivers/nds.cpp
+++ b/src/mame/drivers/nds.cpp
@@ -647,14 +647,14 @@ void nds_state::machine_start()
for (i = 0; i < 8; i++)
{
- m_dma_timer[i] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(nds_state::dma_complete),this));
+ m_dma_timer[i] = timer_alloc(FUNC(nds_state::dma_complete), this);
m_dma_timer[i]->adjust(attotime::never, i);
- m_tmr_timer[i] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(nds_state::timer_expire),this));
+ m_tmr_timer[i] = timer_alloc(FUNC(nds_state::timer_expire), this);
m_tmr_timer[i]->adjust(attotime::never, i);
}
- m_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(nds_state::handle_irq),this));
+ m_irq_timer = timer_alloc(FUNC(nds_state::handle_irq), this);
m_irq_timer->adjust(attotime::never);
}
diff --git a/src/mame/drivers/neogeo.cpp b/src/mame/drivers/neogeo.cpp
index 24908de2a84..2a9f5f5944a 100644
--- a/src/mame/drivers/neogeo.cpp
+++ b/src/mame/drivers/neogeo.cpp
@@ -860,9 +860,9 @@ TIMER_CALLBACK_MEMBER(neogeo_base_state::vblank_interrupt_callback)
void neogeo_base_state::create_interrupt_timers()
{
- m_display_position_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(neogeo_base_state::display_position_interrupt_callback),this));
- m_display_position_vblank_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(neogeo_base_state::display_position_vblank_callback),this));
- m_vblank_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(neogeo_base_state::vblank_interrupt_callback),this));
+ m_display_position_interrupt_timer = timer_alloc(FUNC(neogeo_base_state::display_position_interrupt_callback), this);
+ m_display_position_vblank_timer = timer_alloc(FUNC(neogeo_base_state::display_position_vblank_callback), this);
+ m_vblank_interrupt_timer = timer_alloc(FUNC(neogeo_base_state::vblank_interrupt_callback), this);
}
diff --git a/src/mame/drivers/nes_clone.cpp b/src/mame/drivers/nes_clone.cpp
index 10d1b393271..75975dc4a34 100644
--- a/src/mame/drivers/nes_clone.cpp
+++ b/src/mame/drivers/nes_clone.cpp
@@ -220,7 +220,7 @@ private:
uint8_t m_extraregs[4];
void update_banks();
- void mmc3_scanline_cb(int scanline, int vblank, int blanked);
+ void mmc3_scanline_cb(int scanline, bool vblank, bool blanked);
int16_t m_mmc3_scanline_counter = 0;
uint8_t m_mmc3_scanline_latch = 0;
uint8_t m_mmc3_irq_enable = 0;
@@ -831,7 +831,7 @@ void nes_clone_afbm7800_state::mapper_e001_w(uint8_t data)
-void nes_clone_afbm7800_state::mmc3_scanline_cb( int scanline, int vblank, int blanked )
+void nes_clone_afbm7800_state::mmc3_scanline_cb(int scanline, bool vblank, bool blanked)
{
if (m_mmc3_irq_enable)
{
diff --git a/src/mame/drivers/newbrain.cpp b/src/mame/drivers/newbrain.cpp
index 92341ae2af4..4f7c0e2ae7d 100644
--- a/src/mame/drivers/newbrain.cpp
+++ b/src/mame/drivers/newbrain.cpp
@@ -732,8 +732,12 @@ void newbrain_state::machine_start()
{
m_digits.resolve();
- // set power up timer
- timer_set(attotime::from_usec(get_pwrup_t()), TIMER_ID_PWRUP);
+ // initialize timers
+ m_reset_timer = timer_alloc(FUNC(newbrain_state::clear_reset), this);
+ m_power_timer = timer_alloc(FUNC(newbrain_state::power_on), this);
+
+ m_reset_timer->adjust(attotime::never);
+ m_power_timer->adjust(attotime::from_usec(get_pwrup_t()));
// state saving
save_item(NAME(m_clk));
@@ -769,38 +773,32 @@ void newbrain_state::machine_reset()
enrg_w(0);
- timer_set(attotime::from_usec(get_reset_t()), TIMER_ID_RESET);
+ m_reset_timer->adjust(attotime::from_usec(get_reset_t()));
}
//-------------------------------------------------
-// device_timer - handler timer events
+// timer events
//-------------------------------------------------
-void newbrain_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(newbrain_state::clear_reset)
{
- switch (id)
- {
- case TIMER_ID_RESET:
- LOG("%s %s RESET 1\n", machine().time().as_string(), machine().describe_context());
-
- m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
- m_cop->set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
- break;
-
- case TIMER_ID_PWRUP:
- LOG("%s %s PWRUP 1\n", machine().time().as_string(), machine().describe_context());
-
- m_pwrup = 1;
- break;
+ LOG("%s %s RESET 1\n", machine().time().as_string(), machine().describe_context());
+ m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
+ m_cop->set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
+}
- case TIMER_ID_CLKINT:
- LOG("%s CLKINT\n", machine().time().as_string());
+TIMER_CALLBACK_MEMBER(newbrain_state::power_on)
+{
+ LOG("%s %s PWRUP 1\n", machine().time().as_string(), machine().describe_context());
+ m_pwrup = 1;
+}
- m_clkint = 0;
- check_interrupt();
- break;
- }
+TIMER_CALLBACK_MEMBER(newbrain_state::clear_clkint)
+{
+ LOG("%s CLKINT\n", machine().time().as_string());
+ m_clkint = 0;
+ check_interrupt();
}
diff --git a/src/mame/drivers/news_38xx.cpp b/src/mame/drivers/news_38xx.cpp
index 4f5aef02ac6..12dcfb5d463 100644
--- a/src/mame/drivers/news_38xx.cpp
+++ b/src/mame/drivers/news_38xx.cpp
@@ -161,7 +161,7 @@ void news_38xx_state::machine_start()
save_item(NAME(m_inten));
save_item(NAME(m_int_state));
- m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(news_38xx_state::timer), this));
+ m_timer = timer_alloc(FUNC(news_38xx_state::timer), this);
m_intst = 0;
m_inten = 0x6d;
diff --git a/src/mame/drivers/news_68k.cpp b/src/mame/drivers/news_68k.cpp
index e7da0b70e6d..c35e0e7607b 100644
--- a/src/mame/drivers/news_68k.cpp
+++ b/src/mame/drivers/news_68k.cpp
@@ -158,7 +158,7 @@ void news_68k_state::machine_start()
m_net_ram = std::make_unique<u16[]>(8192);
- m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(news_68k_state::timer), this));
+ m_timer = timer_alloc(FUNC(news_68k_state::timer), this);
m_intst = 0;
for (bool &int_state : m_int_state)
diff --git a/src/mame/drivers/news_r3k.cpp b/src/mame/drivers/news_r3k.cpp
index 3d3204e1ae9..16bd9971315 100644
--- a/src/mame/drivers/news_r3k.cpp
+++ b/src/mame/drivers/news_r3k.cpp
@@ -173,7 +173,7 @@ void news_r3k_state::machine_start()
save_item(NAME(m_lcd_enable));
save_item(NAME(m_lcd_dim));
- m_itimer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(news_r3k_state::itimer), this));
+ m_itimer = timer_alloc(FUNC(news_r3k_state::itimer), this);
for (bool &int_state : m_int_state)
int_state = false;
diff --git a/src/mame/drivers/next.cpp b/src/mame/drivers/next.cpp
index fe8f6b9066f..ef78cf74f2d 100644
--- a/src/mame/drivers/next.cpp
+++ b/src/mame/drivers/next.cpp
@@ -660,7 +660,7 @@ void next_state::phy_w(offs_t offset, uint32_t data, uint32_t mem_mask)
logerror("phy_w %d %08x (%08x)\n", offset, phy[offset], maincpu->pc());
}
-void next_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(next_state::timer_tick)
{
irq_set(29, true);
timer_data = timer_next_data;
@@ -862,7 +862,7 @@ void next_state::machine_start()
save_item(NAME(dma_slots[i].drq), i);
}
- timer_tm = timer_alloc(0);
+ timer_tm = timer_alloc(FUNC(next_state::timer_tick), this);
}
void next_state::machine_reset()
diff --git a/src/mame/drivers/nexus3d.cpp b/src/mame/drivers/nexus3d.cpp
index bcffee5451e..0868d5eb465 100644
--- a/src/mame/drivers/nexus3d.cpp
+++ b/src/mame/drivers/nexus3d.cpp
@@ -290,7 +290,7 @@ INPUT_PORTS_END
void nexus3d_state::machine_start()
{
- m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(nexus3d_state::timercb),this));
+ m_timer = timer_alloc(FUNC(nexus3d_state::timercb), this);
}
diff --git a/src/mame/drivers/ngp.cpp b/src/mame/drivers/ngp.cpp
index 6739569a331..a64738bbffd 100644
--- a/src/mame/drivers/ngp.cpp
+++ b/src/mame/drivers/ngp.cpp
@@ -706,7 +706,7 @@ void ngp_state::machine_start()
m_maincpu->space(AS_PROGRAM).unmap_read(0x800000, 0x9fffff);
}
- m_seconds_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ngp_state::ngp_seconds_callback),this));
+ m_seconds_timer = timer_alloc(FUNC(ngp_state::ngp_seconds_callback), this);
m_seconds_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1));
save_item(NAME(m_io_reg));
diff --git a/src/mame/drivers/nightgal.cpp b/src/mame/drivers/nightgal.cpp
index 9bf50774721..fd42c7219e3 100644
--- a/src/mame/drivers/nightgal.cpp
+++ b/src/mame/drivers/nightgal.cpp
@@ -765,7 +765,7 @@ INPUT_PORTS_END
void nightgal_state::machine_start()
{
- m_z80_wait_ack_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(nightgal_state::z80_wait_ack_cb), this));
+ m_z80_wait_ack_timer = timer_alloc(FUNC(nightgal_state::z80_wait_ack_cb), this);
save_item(NAME(m_nsc_latch));
save_item(NAME(m_z80_latch));
diff --git a/src/mame/drivers/nightmare.cpp b/src/mame/drivers/nightmare.cpp
index f6db4aaecde..64ffc9da820 100644
--- a/src/mame/drivers/nightmare.cpp
+++ b/src/mame/drivers/nightmare.cpp
@@ -236,6 +236,11 @@ public:
void nightmare(machine_config &config);
protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
+ TIMER_CALLBACK_MEMBER(clear_reset);
+
DECLARE_READ_LINE_MEMBER( clear_r );
DECLARE_READ_LINE_MEMBER( ef1_r );
DECLARE_READ_LINE_MEMBER( ef2_r );
@@ -243,16 +248,12 @@ protected:
void ic10_w(uint8_t data);
void unkout_w(uint8_t data);
- void nightmare_map(address_map &map);
- void nightmare_io_map(address_map &map);
- void nightmare_sound_map(address_map &map);
- void nightmare_sound_io_map(address_map &map);
+ void main_map(address_map &map);
+ void io_map(address_map &map);
+ void sound_map(address_map &map);
+ void sound_io_map(address_map &map);
uint32_t screen_update_nightmare(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
- virtual void machine_start() override;
- virtual void machine_reset() override;
-
required_device<cosmac_device> m_maincpu;
required_device<cosmac_device> m_soundcpu;
required_device<tms9928a_device> m_vdc;
@@ -261,24 +262,19 @@ protected:
// cpu state
int m_reset = 0;
+ emu_timer *m_reset_timer = nullptr;
};
-void nightmare_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nightmare_state::clear_reset)
{
- switch (id)
- {
- case TIMER_SET_CPU_MODE:
- m_reset = 1;
- break;
- default:
- throw emu_fatalerror("Unknown id in nightmare_state::device_timer");
- }
+ m_reset = 1;
}
void nightmare_state::machine_start()
{
save_item(NAME(m_reset));
+ m_reset_timer = timer_alloc(FUNC(nightmare_state::clear_reset), this);
}
/* Machine Reset */
@@ -286,7 +282,7 @@ void nightmare_state::machine_start()
void nightmare_state::machine_reset()
{
m_reset = 0;
- timer_set(attotime::from_msec(200), TIMER_SET_CPU_MODE);
+ m_reset_timer->adjust(attotime::from_msec(200));
}
/* CDP1802 Interface */
@@ -339,13 +335,13 @@ void nightmare_state::unkout_w(uint8_t data)
// J3
}
-void nightmare_state::nightmare_map(address_map &map)
+void nightmare_state::main_map(address_map &map)
{
map(0x0000, 0x5fff).rom();
map(0x8000, 0x83ff).ram();
}
-void nightmare_state::nightmare_io_map(address_map &map)
+void nightmare_state::io_map(address_map &map)
{
map(1, 1).r("ic8", FUNC(cdp1852_device::read)).w(FUNC(nightmare_state::unkout_w));
map(2, 2).r("ic9", FUNC(cdp1852_device::read)).w("ic10", FUNC(cdp1852_device::write));
@@ -354,14 +350,13 @@ void nightmare_state::nightmare_io_map(address_map &map)
map(6, 7).rw(m_vdc2, FUNC(tms9928a_device::read), FUNC(tms9928a_device::write));
}
-void nightmare_state::nightmare_sound_map(address_map &map)
+void nightmare_state::sound_map(address_map &map)
{
map(0x0000, 0x3fff).rom();
}
-void nightmare_state::nightmare_sound_io_map(address_map &map)
+void nightmare_state::sound_io_map(address_map &map)
{
-
}
uint32_t nightmare_state::screen_update_nightmare(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
@@ -422,8 +417,8 @@ void nightmare_state::nightmare(machine_config &config)
{
/* main cpu */
CDP1802(config, m_maincpu, MASTER_CLOCK/3);
- m_maincpu->set_addrmap(AS_PROGRAM, &nightmare_state::nightmare_map);
- m_maincpu->set_addrmap(AS_IO, &nightmare_state::nightmare_io_map);
+ m_maincpu->set_addrmap(AS_PROGRAM, &nightmare_state::main_map);
+ m_maincpu->set_addrmap(AS_IO, &nightmare_state::io_map);
m_maincpu->wait_cb().set_constant(1);
m_maincpu->clear_cb().set(FUNC(nightmare_state::clear_r));
m_maincpu->q_cb().set(FUNC(nightmare_state::q_w));
@@ -433,8 +428,8 @@ void nightmare_state::nightmare(machine_config &config)
/* sound cpu */
CDP1802(config, m_soundcpu, SOUND_CLOCK);
- m_soundcpu->set_addrmap(AS_PROGRAM, &nightmare_state::nightmare_sound_map);
- m_soundcpu->set_addrmap(AS_IO, &nightmare_state::nightmare_sound_io_map);
+ m_soundcpu->set_addrmap(AS_PROGRAM, &nightmare_state::sound_map);
+ m_soundcpu->set_addrmap(AS_IO, &nightmare_state::sound_io_map);
m_soundcpu->set_disable();
/* i/o hardware */
diff --git a/src/mame/drivers/nokia_3310.cpp b/src/mame/drivers/nokia_3310.cpp
index 0007ecba6ed..9bd90f2c260 100644
--- a/src/mame/drivers/nokia_3310.cpp
+++ b/src/mame/drivers/nokia_3310.cpp
@@ -232,10 +232,10 @@ void noki3310_state::machine_start()
m_dsp_ram = std::make_unique<uint16_t[]>(0x800); // DSP shared RAM
// allocate timers
- m_timer0 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(noki3310_state::timer0), this));
- m_timer1 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(noki3310_state::timer1), this));
- m_timer_watchdog = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(noki3310_state::timer_watchdog), this));
- m_timer_fiq8 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(noki3310_state::timer_fiq8), this));
+ m_timer0 = timer_alloc(FUNC(noki3310_state::timer0), this);
+ m_timer1 = timer_alloc(FUNC(noki3310_state::timer1), this);
+ m_timer_watchdog = timer_alloc(FUNC(noki3310_state::timer_watchdog), this);
+ m_timer_fiq8 = timer_alloc(FUNC(noki3310_state::timer_fiq8), this);
}
void noki3310_state::machine_reset()
diff --git a/src/mame/drivers/notetaker.cpp b/src/mame/drivers/notetaker.cpp
index 7b9e4ca7510..080776d876d 100644
--- a/src/mame/drivers/notetaker.cpp
+++ b/src/mame/drivers/notetaker.cpp
@@ -113,6 +113,14 @@ DONE:
#include "screen.h"
#include "speaker.h"
+#define LOG_VIDEO (1U << 1)
+#define LOG_READOP_STATUS (1U << 2)
+#define LOG_FIFO (1U << 3)
+#define LOG_SPC_DSP (1U << 4)
+#define LOG_FIFO_VERBOSE (1U << 5)
+
+#define VERBOSE (0)
+#include "logmacro.h"
class notetaker_state : public driver_device
{
@@ -135,15 +143,17 @@ public:
void notetakr(machine_config &config);
- void init_notetakr();
-
private:
- enum
- {
- TIMER_FIFOCLK,
- };
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void driver_init() override;
+
+ void iop_io(address_map &map);
+ void iop_mem(address_map &map);
+ void ep_io(address_map &map);
+ void ep_mem(address_map &map);
-// devices
+ // devices
required_device<cpu_device> m_iop_cpu;
required_device<pic8259_device> m_iop_pic;
required_device<cpu_device> m_ep_cpu;
@@ -158,136 +168,115 @@ private:
std::unique_ptr<uint16_t[]> m_mainram;
-//declarations
// screen
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
// basic io
- void IPConReg_w(uint16_t data);
- void EPConReg_w(uint16_t data);
- void FIFOReg_w(uint16_t data);
- void FIFOBus_w(uint16_t data);
- void DiskReg_w(uint16_t data);
- void LoadDispAddr_w(uint16_t data);
+ void ipcon_reg_w(uint16_t data);
+ void epcon_reg_w(uint16_t data);
+ void fifo_reg_w(uint16_t data);
+ void fifo_bus_w(uint16_t data);
+ void disk_reg_w(uint16_t data);
+ void load_disp_addr_w(uint16_t data);
// uarts
- uint16_t ReadOPStatus_r();
- void LoadKeyCtlReg_w(uint16_t data);
- void KeyDataReset_w(uint16_t data);
- void KeyChipReset_w(uint16_t data);
- uint16_t ReadEIAStatus_r();
- void LoadEIACtlReg_w(uint16_t data);
- void EIADataReset_w(uint16_t data);
- void EIAChipReset_w(uint16_t data);
+ uint16_t read_op_status_r();
+ void load_key_ctl_reg_w(uint16_t data);
+ void key_data_reset_w(uint16_t data);
+ void key_chip_reset_w(uint16_t data);
+ uint16_t read_eia_status_r();
+ void load_eia_ctl_reg_w(uint16_t data);
+ void eia_data_reset_w(uint16_t data);
+ void eia_chip_reset_w(uint16_t data);
+
// mem map stuff
uint16_t iop_r(offs_t offset);
void iop_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
uint16_t ep_mainram_r(offs_t offset, uint16_t mem_mask);
void ep_mainram_w(offs_t offset, uint16_t data, uint16_t mem_mask);
- //variables
- // IPConReg
- uint8_t m_BootSeqDone = 0;
- uint8_t m_ProcLock = 0;
- uint8_t m_CharCtr = 0;
- uint8_t m_DisableROM = 0;
- uint8_t m_CorrOn_q = 0;
- uint8_t m_LedInd6 = 0;
- uint8_t m_LedInd7 = 0;
- uint8_t m_LedInd8 = 0;
+
+ // IPConReg
+ uint8_t m_boot_seq_done = 0;
+ uint8_t m_proc_lock = 0;
+ uint8_t m_char_ctr = 0;
+ uint8_t m_disable_rom = 0;
+ uint8_t m_corr_on_q = 0;
+ uint8_t m_led_ind6 = 0;
+ uint8_t m_led_ind7 = 0;
+ uint8_t m_led_ind8 = 0;
+
// FIFOReg
- uint8_t m_TabletYOn = 0;
- uint8_t m_TabletXOn = 0;
- uint8_t m_FrSel2 = 0;
- uint8_t m_FrSel1 = 0;
- uint8_t m_FrSel0 = 0;
- uint8_t m_SHConB = 0;
- uint8_t m_SHConA = 0;
- uint8_t m_SetSH = 0;
+ uint8_t m_tablet_y_on = 0;
+ uint8_t m_tablet_x_on = 0;
+ uint8_t m_fr_sel2 = 0;
+ uint8_t m_fr_sel1 = 0;
+ uint8_t m_fr_sel0 = 0;
+ uint8_t m_sh_conb = 0;
+ uint8_t m_sh_cona = 0;
+ uint8_t m_set_sh = 0;
+
// DiskReg
- uint8_t m_ADCSpd0 = 0;
- uint8_t m_ADCSpd1 = 0;
- uint8_t m_StopWordClock_q = 0;
- uint8_t m_ClrDiskCont_q = 0;
- uint8_t m_ProgBitClk1 = 0;
- uint8_t m_ProgBitClk2 = 0;
- uint8_t m_ProgBitClk3 = 0;
- uint8_t m_AnSel4 = 0;
- uint8_t m_AnSel2 = 0;
- uint8_t m_AnSel1 = 0;
- uint8_t m_DriveSel1 = 0;
- uint8_t m_DriveSel2 = 0;
- uint8_t m_DriveSel3 = 0;
- uint8_t m_SideSelect = 0;
- uint8_t m_Disk5VOn = 0;
- uint8_t m_Disk12VOn = 0;
+ uint8_t m_adc_spd0 = 0;
+ uint8_t m_adc_spd1 = 0;
+ uint8_t m_stopword_clock_q = 0;
+ uint8_t m_clr_diskcont_q = 0;
+ uint8_t m_prog_bitclk1 = 0;
+ uint8_t m_prog_bitclk2 = 0;
+ uint8_t m_prog_bitclk3 = 0;
+ uint8_t m_an_sel4 = 0;
+ uint8_t m_an_sel2 = 0;
+ uint8_t m_an_sel1 = 0;
+ uint8_t m_drive_sel1 = 0;
+ uint8_t m_drive_sel2 = 0;
+ uint8_t m_drive_sel3 = 0;
+ uint8_t m_side_select = 0;
+ uint8_t m_disk_5v_on = 0;
+ uint8_t m_disk_12v_on = 0;
+
// output fifo, for DAC
uint16_t m_outfifo[16]; // technically three 74LS225 5bit*16stage FIFO chips, arranged as a 16 stage, 12-bit wide fifo (one bit unused per chip)
uint8_t m_outfifo_count = 0;
uint8_t m_outfifo_tail_ptr = 0;
uint8_t m_outfifo_head_ptr = 0;
+
// fifo timer
- emu_timer *m_FIFO_timer = nullptr;
+ emu_timer *m_fifo_timer = nullptr;
TIMER_CALLBACK_MEMBER(timer_fifoclk);
+
// framebuffer display starting address
- uint16_t m_DispAddr = 0;
+ uint16_t m_disp_addr = 0;
-// separate cpu resets
void iop_reset();
void ep_reset();
-
-// overrides
- virtual void machine_start() override;
- virtual void machine_reset() override;
-
- void iop_io(address_map &map);
- void iop_mem(address_map &map);
- void ep_io(address_map &map);
- void ep_mem(address_map &map);
-
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
};
-void notetaker_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_FIFOCLK:
- timer_fifoclk(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in notetaker_state::device_timer");
- }
-}
-
TIMER_CALLBACK_MEMBER(notetaker_state::timer_fifoclk)
{
- uint16_t data;
//pop a value off the fifo and send it to the dac.
-#ifdef FIFO_VERBOSE
- if (m_outfifo_count == 0) logerror("output fifo is EMPTY! repeating previous sample!\n");
-#endif
- data = m_outfifo[m_outfifo_tail_ptr];
+ if (m_outfifo_count == 0)
+ LOGMASKED(LOG_FIFO_VERBOSE, "output fifo is EMPTY! repeating previous sample!\n");
+
+ uint16_t data = m_outfifo[m_outfifo_tail_ptr];
// if fifo is empty (tail ptr == head ptr), do not increment the tail ptr, otherwise do.
if (m_outfifo_count > 0)
{
m_outfifo_tail_ptr++;
m_outfifo_count--;
}
- m_outfifo_tail_ptr&=0xF;
+ m_outfifo_tail_ptr &= 0xf;
m_dac->write(data);
- m_FIFO_timer->adjust(attotime::from_hz(((960_kHz_XTAL/10)/4)/((m_FrSel0<<3)+(m_FrSel1<<2)+(m_FrSel2<<1)+1)));
+ m_fifo_timer->adjust(attotime::from_hz(((960_kHz_XTAL / 10) / 4) / ((m_fr_sel0 << 3) + (m_fr_sel1 << 2) + (m_fr_sel2 << 1) + 1)));
}
uint32_t notetaker_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
// have to figure out what resolution we're drawing to here and draw appropriately to screen
// code borrowed/stolen from video/mac.cpp
- uint32_t const video_base = (m_DispAddr << 3) & 0x1ffff;
-#ifdef DEBUG_VIDEO
- logerror("Video Base = 0x%05x\n", video_base);
-#endif
+ uint32_t const video_base = (m_disp_addr << 3) & 0x1ffff;
uint16_t const *video_ram_field1 = &m_mainram[video_base / 2];
uint16_t const *video_ram_field2 = &m_mainram[(video_base + 0x4b00) / 2];
+ LOGMASKED(LOG_VIDEO, "Video Base = 0x%05x\n", video_base);
+
for (int y = 0; y < 480; y++)
{
uint16_t *const line = &bitmap.pix(y);
@@ -304,36 +293,36 @@ uint32_t notetaker_state::screen_update(screen_device &screen, bitmap_ind16 &bit
return 0;
}
-void notetaker_state::IPConReg_w(uint16_t data)
+void notetaker_state::ipcon_reg_w(uint16_t data)
{
- m_BootSeqDone = BIT(data, 7);
- m_ProcLock = BIT(data, 6); // bus lock for this processor (hold other processor in wait state)
- m_CharCtr = BIT(data, 5); // battery charge control (incorrectly called 'Char counter' in source code)
- m_DisableROM = BIT(data, 4); // disable rom at 0000-0fff
- m_CorrOn_q = BIT(data, 3); // CorrectionOn (ECC correction enabled); also LedInd5
- m_LedInd6 = BIT(data, 2);
- m_LedInd7 = BIT(data, 1);
- m_LedInd8 = BIT(data, 0);
+ m_boot_seq_done = BIT(data, 7);
+ m_proc_lock = BIT(data, 6); // bus lock for this processor (hold other processor in wait state)
+ m_char_ctr = BIT(data, 5); // battery charge control (incorrectly called 'Char counter' in source code)
+ m_disable_rom = BIT(data, 4); // disable rom at 0000-0fff
+ m_corr_on_q = BIT(data, 3); // CorrectionOn (ECC correction enabled); also LedInd5
+ m_led_ind6 = BIT(data, 2);
+ m_led_ind7 = BIT(data, 1);
+ m_led_ind8 = BIT(data, 0);
popmessage("LEDS: CR1: %d, CR2: %d, CR3: %d, CR4: %d", BIT(data, 2), BIT(data, 3), BIT(data, 1), BIT(data, 0)); // cr1 and 2 are in the reverse order as expected, according to the schematic
}
/* handlers for the two system hd6402s (ay-5-1013 equivalent) */
/* * Keyboard hd6402 */
-uint16_t notetaker_state::ReadOPStatus_r() // 74ls368 hex inverter at #l7 provides 4 bits, inverted
+uint16_t notetaker_state::read_op_status_r() // 74ls368 hex inverter at #l7 provides 4 bits, inverted
{
- uint16_t data = 0xFFF0;
- data |= (m_outfifo_count >= 1) ? 0 : 0x08; // m_FIFOOutRdy is true if the fifo has at least 1 word in it, false otherwise
- data |= (m_outfifo_count < 16) ? 0 : 0x04; // m_FIFOInRdy is true if the fifo has less than 16 words in it, false otherwise
+ uint16_t data = 0xfff0;
+ data |= (m_outfifo_count >= 1) ? 0 : 0x08; // m_fifo_out_rdy is true if the fifo has at least 1 word in it, false otherwise
+ data |= (m_outfifo_count < 16) ? 0 : 0x04; // m_fifo_in_rdy is true if the fifo has less than 16 words in it, false otherwise
// note /SWE is permanently enabled, so we don't enable it here for HD6402 reading
- data |= m_kbduart->dav_r( ) ? 0 : 0x02; // DR - pin 19
+ data |= m_kbduart->dav_r() ? 0 : 0x02; // DR - pin 19
data |= m_kbduart->tbmt_r() ? 0 : 0x01; // TBRE - pin 22
-#ifdef DEBUG_READOPSTATUS
- logerror("ReadOPStatus read, returning %04x\n", data);
-#endif
+
+ LOGMASKED(LOG_READOP_STATUS, "ReadOPStatus read, returning %04x\n", data);
+
return data;
}
-void notetaker_state::LoadKeyCtlReg_w(uint16_t data)
+void notetaker_state::load_key_ctl_reg_w(uint16_t data)
{
m_kbduart->write_cs(0);
m_kbduart->write_np(BIT(data, 4)); // PI - pin 35
@@ -344,45 +333,43 @@ void notetaker_state::LoadKeyCtlReg_w(uint16_t data)
m_kbduart->write_cs(1);
}
-void notetaker_state::KeyDataReset_w(uint16_t data)
+void notetaker_state::key_data_reset_w(uint16_t data)
{
m_kbduart->write_rdav(0); // DDR - pin 18
m_kbduart->write_rdav(1); // ''
}
-void notetaker_state::KeyChipReset_w(uint16_t data)
+void notetaker_state::key_chip_reset_w(uint16_t data)
{
m_kbduart->write_xr(0); // MR - pin 21
m_kbduart->write_xr(1); // ''
}
/* FIFO (DAC) Stuff and ADC stuff */
-void notetaker_state::FIFOReg_w(uint16_t data)
-{
- m_SetSH = (data&0x8000)?1:0;
- m_SHConA = (data&0x4000)?1:0;
- m_SHConB = (data&0x2000)?1:0;
- m_FrSel0 = (data&0x1000)?1:0;
- m_FrSel1 = (data&0x0800)?1:0;
- m_FrSel2 = (data&0x0400)?1:0;
- m_TabletXOn = (data&0x0200)?1:0;
- m_TabletYOn = (data&0x0100)?1:0;
- m_FIFO_timer->adjust(attotime::from_hz(((960_kHz_XTAL/10)/4)/((m_FrSel0<<3)+(m_FrSel1<<2)+(m_FrSel2<<1)+1)));
+void notetaker_state::fifo_reg_w(uint16_t data)
+{
+ m_set_sh = BIT(data, 15);
+ m_sh_cona = BIT(data, 14);
+ m_sh_conb = BIT(data, 13);
+ m_fr_sel0 = BIT(data, 12);
+ m_fr_sel1 = BIT(data, 11);
+ m_fr_sel2 = BIT(data, 10);
+ m_tablet_x_on = BIT(data, 9);
+ m_tablet_y_on = BIT(data, 8);
+ m_fifo_timer->adjust(attotime::from_hz(((960_kHz_XTAL / 10) / 4) / ((m_fr_sel0 << 3) + (m_fr_sel1 << 2) + (m_fr_sel2 << 1) + 1)));
/* FIFO timer is clocked by 960khz divided by 10 (74ls162 decade counter),
divided by 4 (mc14568B with divider 1 pins set to 4), divided by
1,3,5,7,9,11,13,15 (or 0,2,4,6,8,10,12,14?)
*/
// todo: handle tablet and sample/hold stuff as well
- logerror("Write to 0x60 FIFOReg_w of %04x; fifo timer set to %d hz\n", data, ((((960'000)/10)/4)/((m_FrSel0<<3)+(m_FrSel1<<2)+(m_FrSel2<<1)+1)));
+ LOGMASKED(LOG_FIFO, "Write to 0x60 fifo_reg_w of %04x; fifo timer set to %d hz\n", data, ((960'000 / 10) / 4) / ((m_fr_sel0 << 3) + (m_fr_sel1 << 2) + (m_fr_sel2 << 1) + 1));
}
-void notetaker_state::FIFOBus_w(uint16_t data)
+void notetaker_state::fifo_bus_w(uint16_t data)
{
if (m_outfifo_count == 16)
{
-#ifdef SPC_LOG_DSP
- logerror("outfifo was full, write ignored!\n");
-#endif
+ LOGMASKED(LOG_SPC_DSP, "outfifo was full, write ignored!\n");
return;
}
m_outfifo[m_outfifo_head_ptr] = data >> 4;
@@ -391,7 +378,7 @@ void notetaker_state::FIFOBus_w(uint16_t data)
m_outfifo_head_ptr&=0xF;
}
-void notetaker_state::DiskReg_w(uint16_t data)
+void notetaker_state::disk_reg_w(uint16_t data)
{
/* See http://bitsavers.trailing-edge.com/pdf/xerox/notetaker/memos/19781023_More_NoteTaker_IO_Information.pdf
but note that bit 12 (called bit 3 in documentation) was changed between
@@ -399,23 +386,23 @@ void notetaker_state::DiskReg_w(uint16_t data)
ClrDiskCont' rather than acting as ProgBitClk0, which is permanently
wired high instead, meaning only the 4.5Mhz - 18Mhz dot clocks are
available for the CRTC. */
- m_ADCSpd0 = (data&0x8000)?1:0;
- m_ADCSpd1 = (data&0x4000)?1:0;
- m_StopWordClock_q = (data&0x2000)?1:0;
- //if ((!(m_ClrDiskCont_q)) && (data&0x1000)) m_floppy->device_reset(); // reset on rising edge
- m_ClrDiskCont_q = (data&0x1000)?1:0; // originally ProgBitClk0, but co-opted later to reset the FDC's external PLL
- m_ProgBitClk1 = (data&0x0800)?1:0;
- m_ProgBitClk2 = (data&0x0400)?1:0;
- m_ProgBitClk3 = (data&0x0200)?1:0;
- m_AnSel4 = (data&0x0100)?1:0;
- m_AnSel2 = (data&0x80)?1:0;
- m_AnSel1 = (data&0x40)?1:0;
- m_DriveSel1 = (data&0x20)?1:0;
- m_DriveSel2 = (data&0x10)?1:0; // drive 2 not present on hardware, but could work if present
- m_DriveSel3 = (data&0x08)?1:0; // drive 3 not present on hardware, but could work if present
- m_SideSelect = (data&0x04)?1:0;
- m_Disk5VOn = (data&0x02)?1:0;
- m_Disk12VOn = (data&0x01)?1:0;
+ m_adc_spd0 = BIT(data, 15);
+ m_adc_spd1 = BIT(data, 14);
+ m_stopword_clock_q = BIT(data, 13);
+ //if (!(m_clr_diskcont_q) && (data & 0x1000)) m_floppy->device_reset(); // reset on rising edge
+ m_clr_diskcont_q = BIT(data, 12); // originally ProgBitClk0, but co-opted later to reset the FDC's external PLL
+ m_prog_bitclk1 = BIT(data, 11);
+ m_prog_bitclk2 = BIT(data, 10);
+ m_prog_bitclk3 = BIT(data, 9);
+ m_an_sel4 = BIT(data, 8);
+ m_an_sel2 = BIT(data, 7);
+ m_an_sel1 = BIT(data, 6);
+ m_drive_sel1 = BIT(data, 5);
+ m_drive_sel2 = BIT(data, 4); // drive 2 not present on hardware, but could work if present
+ m_drive_sel3 = BIT(data, 3); // drive 3 not present on hardware, but could work if present
+ m_side_select = BIT(data, 2);
+ m_disk_5v_on = BIT(data, 1);
+ m_disk_12v_on = BIT(data, 0);
// ADC stuff
//TODO
@@ -423,45 +410,49 @@ void notetaker_state::DiskReg_w(uint16_t data)
// FDC stuff
// first handle the motor stuff; we'll clobber whatever was in m_floppy, then reset it to what it should be
m_floppy = m_floppy0->get_device();
+
// Disk5VOn and 12VOn can be thought of as a crude MotorOn signal as the motor won't run with either? of them missing.
// However, a tech note involves adding a patch so that MotorOn is only activated if the drive is actually selected.
- m_floppy->mon_w(!(m_Disk5VOn && m_Disk12VOn && m_DriveSel1));
+ m_floppy->mon_w(!(m_disk_5v_on && m_disk_12v_on && m_drive_sel1));
+
//m_floppy = m_floppy1->get_device();
- //m_floppy->mon_w(!(m_Disk5VOn && m_Disk12VOn && m_DriveSel2)); // Disk5VOn and 12VOn can be thought of as a crude MotorOn signal as the motor won't run with either? of them missing.
+ //m_floppy->mon_w(!(m_disk_5v_on && m_disk_12v_on && m_drive_sel2)); // Disk5VOn and 12VOn can be thought of as a crude MotorOn signal as the motor won't run with either? of them missing.
//m_floppy = m_floppy2->get_device();
- //m_floppy->mon_w(!(m_Disk5VOn && m_Disk12VOn && m_DriveSel3)); // Disk5VOn and 12VOn can be thought of as a crude MotorOn signal as the motor won't run with either? of them missing.
+ //m_floppy->mon_w(!(m_disk_5v_on && m_disk_12v_on && m_drive_sel3)); // Disk5VOn and 12VOn can be thought of as a crude MotorOn signal as the motor won't run with either? of them missing.
+
// now restore m_floppy state to what it should be
- if (m_DriveSel1) m_floppy = m_floppy0->get_device();
- //else if (m_DriveSel2) m_floppy = m_floppy1->get_device();
- //else if (m_DriveSel3) m_floppy = m_floppy2->get_device();
- else m_floppy = nullptr;
+ if (m_drive_sel1)
+ m_floppy = m_floppy0->get_device();
+ else
+ m_floppy = nullptr;
+
m_fdc->set_floppy(m_floppy); // select the floppy
if (m_floppy)
{
- m_floppy->ss_w(m_SideSelect);
+ m_floppy->ss_w(m_side_select);
}
// CRTC clock rate stuff
//TODO
}
-void notetaker_state::LoadDispAddr_w(uint16_t data)
+void notetaker_state::load_disp_addr_w(uint16_t data)
{
- m_DispAddr = data;
+ m_disp_addr = data;
// for future low level emulation: clear the current counter position here as well, as well as empty/reset the display fifo, and the setmemrq state.
}
/* EIA hd6402 */
-uint16_t notetaker_state::ReadEIAStatus_r() // 74ls368 hex inverter at #f1 provides 2 bits, inverted
+uint16_t notetaker_state::read_eia_status_r() // 74ls368 hex inverter at #f1 provides 2 bits, inverted
{
- uint16_t data = 0xFFFC;
+ uint16_t data = 0xfffc;
// note /SWE is permanently enabled, so we don't enable it here for HD6402 reading
- data |= m_eiauart->dav_r( ) ? 0 : 0x02; // DR - pin 19
+ data |= m_eiauart->dav_r() ? 0 : 0x02; // DR - pin 19
data |= m_eiauart->tbmt_r() ? 0 : 0x01; // TBRE - pin 22
return data;
}
-void notetaker_state::LoadEIACtlReg_w(uint16_t data)
+void notetaker_state::load_eia_ctl_reg_w(uint16_t data)
{
m_eiauart->write_cs(0);
m_eiauart->write_np(BIT(data, 4)); // PI - pin 35
@@ -472,13 +463,13 @@ void notetaker_state::LoadEIACtlReg_w(uint16_t data)
m_eiauart->write_cs(1);
}
-void notetaker_state::EIADataReset_w(uint16_t data)
+void notetaker_state::eia_data_reset_w(uint16_t data)
{
m_eiauart->write_rdav(0); // DDR - pin 18
m_eiauart->write_rdav(1); // ''
}
-void notetaker_state::EIAChipReset_w(uint16_t data)
+void notetaker_state::eia_chip_reset_w(uint16_t data)
{
m_eiauart->write_xr(0); // MR - pin 21
m_eiauart->write_xr(1); // ''
@@ -491,15 +482,19 @@ uint16_t notetaker_state::iop_r(offs_t offset)
uint16_t *rom = (uint16_t *)(memregion("iop")->base());
rom += 0x7f800;
uint16_t *ram = m_mainram.get();
- if ( (m_BootSeqDone == 0) || ((m_DisableROM == 0) && ((offset&0x7F800) == 0)) )
+ if (m_boot_seq_done == 0 || (m_disable_rom == 0 && (offset & 0x7f800) == 0))
{
- rom += (offset&0x7FF);
+ rom += offset & 0x7ff;
return *rom;
}
else
{
// are we in the FFFE8-FFFEF area where the parity/int/reset/etc stuff lives?
- if (offset >= 0x7fff4) { logerror("attempt to read processor control regs at %d\n", offset<<1); return 0xFFFF; }
+ if (offset >= 0x7fff4)
+ {
+ logerror("attempt to read processor control regs at %d\n", offset << 1);
+ return 0xffff;
+ }
ram += offset;
return *ram;
}
@@ -509,13 +504,16 @@ void notetaker_state::iop_w(offs_t offset, uint16_t data, uint16_t mem_mask)
{
//uint16_t tempword;
uint16_t *ram = m_mainram.get();
- if ( (m_BootSeqDone == 0) || ((m_DisableROM == 0) && ((offset&0x7F800) == 0)) )
+ if (m_boot_seq_done == 0 || (m_disable_rom == 0 && (offset & 0x7f800) == 0))
{
- logerror("attempt to write %04X to ROM-mapped area at %06X ignored\n", data, offset<<1);
+ logerror("attempt to write %04X to ROM-mapped area at %06X ignored\n", data, offset << 1);
return;
}
// are we in the FFFE8-FFFEF area where the parity/int/reset/etc stuff lives?
- if (offset >= 0x7fff4) { logerror("attempt to write processor control regs at %d with %02X ignored\n", offset<<1, data); }
+ if (offset >= 0x7fff4)
+ {
+ logerror("attempt to write processor control regs at %d with %02X ignored\n", offset << 1, data);
+ }
COMBINE_DATA(&ram[offset]);
}
@@ -596,26 +594,26 @@ void notetaker_state::iop_io(address_map &map)
{
map.unmap_value_high();
map(0x00, 0x03).mirror(0x7e1c).rw(m_iop_pic, FUNC(pic8259_device::read), FUNC(pic8259_device::write)).umask16(0x00ff);
- map(0x20, 0x21).mirror(0x7e1e).w(FUNC(notetaker_state::IPConReg_w)); // I/O processor (rom mapping, etc) control register
+ map(0x20, 0x21).mirror(0x7e1e).w(FUNC(notetaker_state::ipcon_reg_w)); // I/O processor (rom mapping, etc) control register
map(0x42, 0x42).mirror(0x7e10).r(m_kbduart, FUNC(ay31015_device::receive)); // read keyboard data
- map(0x44, 0x45).mirror(0x7e10).r(FUNC(notetaker_state::ReadOPStatus_r)); // read keyboard fifo state
- map(0x48, 0x49).mirror(0x7e10).w(FUNC(notetaker_state::LoadKeyCtlReg_w)); // kbd uart control register
+ map(0x44, 0x45).mirror(0x7e10).r(FUNC(notetaker_state::read_op_status_r)); // read keyboard fifo state
+ map(0x48, 0x49).mirror(0x7e10).w(FUNC(notetaker_state::load_key_ctl_reg_w)); // kbd uart control register
map(0x4a, 0x4a).mirror(0x7e10).w(m_kbduart, FUNC(ay31015_device::transmit)); // kbd uart data register
- map(0x4c, 0x4d).mirror(0x7e10).w(FUNC(notetaker_state::KeyDataReset_w)); // kbd uart ddr switch (data reset)
- map(0x4e, 0x4f).mirror(0x7e10).w(FUNC(notetaker_state::KeyChipReset_w)); // kbd uart reset
- map(0x60, 0x61).mirror(0x7e1e).w(FUNC(notetaker_state::FIFOReg_w)); // DAC sample and hold and frequency setup
+ map(0x4c, 0x4d).mirror(0x7e10).w(FUNC(notetaker_state::key_data_reset_w)); // kbd uart ddr switch (data reset)
+ map(0x4e, 0x4f).mirror(0x7e10).w(FUNC(notetaker_state::key_chip_reset_w)); // kbd uart reset
+ map(0x60, 0x61).mirror(0x7e1e).w(FUNC(notetaker_state::fifo_reg_w)); // DAC sample and hold and frequency setup
//map(0xa0, 0xa1).mirror(0x7e18).rw("debug8255", FUNC(8255_device::read), FUNC(8255_device::write)); // debugger board 8255
- map(0xc0, 0xc1).mirror(0x7e1e).w(FUNC(notetaker_state::FIFOBus_w)); // DAC data write to FIFO
- map(0x100, 0x101).mirror(0x7e1e).w(FUNC(notetaker_state::DiskReg_w)); // I/O register (adc speed, crtc pixel clock and clock enable, +5 and +12v relays for floppy, etc)
+ map(0xc0, 0xc1).mirror(0x7e1e).w(FUNC(notetaker_state::fifo_bus_w)); // DAC data write to FIFO
+ map(0x100, 0x101).mirror(0x7e1e).w(FUNC(notetaker_state::disk_reg_w)); // I/O register (adc speed, crtc pixel clock and clock enable, +5 and +12v relays for floppy, etc)
map(0x120, 0x127).mirror(0x7e18).rw(m_fdc, FUNC(fd1791_device::read), FUNC(fd1791_device::write)).umask16(0x00ff); // floppy controller
map(0x140, 0x15f).mirror(0x7e00).rw(m_crtc, FUNC(crt5027_device::read), FUNC(crt5027_device::write)).umask16(0x00ff); // crt controller
- map(0x160, 0x161).mirror(0x7e1e).w(FUNC(notetaker_state::LoadDispAddr_w)); // loads the start address for the display framebuffer
- map(0x1a0, 0x1a1).mirror(0x7e10).r(FUNC(notetaker_state::ReadEIAStatus_r)); // read eia fifo state
+ map(0x160, 0x161).mirror(0x7e1e).w(FUNC(notetaker_state::load_disp_addr_w)); // loads the start address for the display framebuffer
+ map(0x1a0, 0x1a1).mirror(0x7e10).r(FUNC(notetaker_state::read_eia_status_r)); // read eia fifo state
map(0x1a2, 0x1a2).mirror(0x7e10).r(m_eiauart, FUNC(ay31015_device::receive)); // read eia data
- map(0x1a8, 0x1a9).mirror(0x7e10).w(FUNC(notetaker_state::LoadEIACtlReg_w)); // eia uart control register
+ map(0x1a8, 0x1a9).mirror(0x7e10).w(FUNC(notetaker_state::load_eia_ctl_reg_w)); // eia uart control register
map(0x1aa, 0x1aa).mirror(0x7e10).w(m_eiauart, FUNC(ay31015_device::transmit)); // eia uart data register
- map(0x1ac, 0x1ad).mirror(0x7e10).w(FUNC(notetaker_state::EIADataReset_w)); // eia uart ddr switch (data reset)
- map(0x1ae, 0x1af).mirror(0x7e10).w(FUNC(notetaker_state::EIAChipReset_w)); // eia uart reset
+ map(0x1ac, 0x1ad).mirror(0x7e10).w(FUNC(notetaker_state::eia_data_reset_w)); // eia uart ddr switch (data reset)
+ map(0x1ae, 0x1af).mirror(0x7e10).w(FUNC(notetaker_state::eia_chip_reset_w)); // eia uart reset
//map(0x1c0, 0x1c1).mirror(0x7e1e).r(FUNC(notetaker_state::SelADCHi_r)); // ADC read
//map(0x1e0, 0x1e1).mirror(0x7e1e).r(FUNC(notetaker_state::CRTSwitch_w)); // CRT power enable?
}
@@ -674,7 +672,7 @@ read from 0x44 (byte wide) to check input fifo status
/* Emulator CPU */
-void notetaker_state::EPConReg_w(uint16_t data)
+void notetaker_state::epcon_reg_w(uint16_t data)
{
/*m_EP_LED1 = m_EP_ParityError; // if parity checking is enabled AND the last access was to the low 8k AND there was a parity error, the parity error latch is latched here. It triggers an interrupt.
m_EP_LED2 = (data&0x40)?1:0;
@@ -740,7 +738,7 @@ void notetaker_state::ep_io(address_map &map)
map.unmap_value_high();
map(0x800, 0x803).mirror(0x07fc).rw(m_ep_pic, FUNC(pic8259_device::read), FUNC(pic8259_device::write)).umask16(0x00ff);
//map(0x1000, 0x1001).mirror(0x07fe).rw("debug8255", FUNC(8255_device::read), FUNC(8255_device::write)); // debugger board 8255, is this the same one as the iop accesses? or are these two 8255s on separate cards?
- map(0x2000, 0x2001).mirror(0x07fe).w(FUNC(notetaker_state::EPConReg_w)); // emu processor control reg & leds
+ map(0x2000, 0x2001).mirror(0x07fe).w(FUNC(notetaker_state::epcon_reg_w)); // emu processor control reg & leds
//map(0x4000, 0x4001).mirror(0x07fe).w(FUNC(notetaker_state::EmuClearParity_w)); // writes here clear the local 8k-ram parity error register
}
@@ -757,17 +755,21 @@ void notetaker_state::machine_start()
{
// allocate RAM
m_mainram = make_unique_clear<uint16_t[]>(0x100000/2);
+
// allocate the DAC timer, and set it to fire NEVER. We'll set it up properly in IPReset.
- m_FIFO_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(notetaker_state::timer_fifoclk),this));
- m_FIFO_timer->adjust(attotime::never);
+ m_fifo_timer = timer_alloc(FUNC(notetaker_state::timer_fifoclk), this);
+ m_fifo_timer->adjust(attotime::never);
+
// FDC: /DDEN is tied permanently LOW so MFM mode is ALWAYS ON
m_fdc->dden_w(0);
+
// Keyboard UART: /SWE is tied permanently LOW
m_kbduart->write_swe(0); // status word outputs are permanently enabled (pin 16 SFD(SWE) tied low, active)
+
// EIA UART: /SWE is tied permanently LOW
m_eiauart->write_swe(0); // status word outputs are permanently enabled (pin 16 SFD(SWE) tied low, active)
- // savestate stuff
- // TODO: add me!
+
+ // TODO: register savestate items
}
/* Machine Reset; this emulates the full system reset, triggered by ExtReset' (cardcage pin <50>) or the PowerOnReset' circuit */
@@ -783,26 +785,36 @@ void notetaker_state::iop_reset()
// reset the Keyboard UART
m_kbduart->write_xr(0); // MR - pin 21
m_kbduart->write_xr(1); // ''
+
// reset the EIA UART
m_eiauart->write_xr(0); // MR - pin 21
m_eiauart->write_xr(1); // ''
+
// reset the IPConReg ls273 latch at #f1
- IPConReg_w(0x0000);
+ ipcon_reg_w(0x0000);
+
// Clear the DAC FIFO
- for (int i=0; i<16; i++) m_outfifo[i] = 0;
- m_outfifo_count = m_outfifo_tail_ptr = m_outfifo_head_ptr = 0;
+ for (int i = 0; i < 16; i++)
+ m_outfifo[i] = 0;
+ m_outfifo_count = 0;
+ m_outfifo_tail_ptr = 0;
+ m_outfifo_head_ptr = 0;
+
// reset the FIFOReg latch at #h9
- FIFOReg_w(0x0000);
+ fifo_reg_w(0x0000);
+
// reset the DiskReg latches at #c4 and #b4 on the disk/display/eia controller board
- DiskReg_w(0x0000);
+ disk_reg_w(0x0000);
+
// reset the framebuffer display address counter:
- m_DispAddr = 0;
+ m_disp_addr = 0;
}
/* EP Reset; this emulates the EPReset' signal */
void notetaker_state::ep_reset()
{
- //TODO: force ep into reset and hold it there, until the iop releases it. there's 6 'state' bits controllable by the memory mapped cpu control reg, which need to be reset for epcpu and iocpu separately
+ // TODO: force ep into reset and hold it there, until the iop releases it.
+ // there's 6 'state' bits controllable by the memory mapped cpu control reg, which need to be reset for epcpu and iocpu separately
}
/* Input ports */
@@ -854,7 +866,8 @@ void notetaker_state::notetakr(machine_config &config)
written with 101, changing the divider to (36mhz/4)/8 */
// TODO: for now, we just hack it to the latter setting from start; this should be handled correctly in iop_reset();
m_crtc->set_char_width(8); //(8 pixels per column/halfword, 16 pixels per fullword)
- // TODO: below is HACKED to trigger the odd/even int ir4 instead of vblank int ir7 since ir4 is required for anything to be drawn to screen! hence with the hack this interrupt triggers twice as often as it should
+ // TODO: below is HACKED to trigger the odd/even int ir4 instead of vblank int ir7 since ir4 is required for anything to be drawn to screen.
+ // hence with the hack this interrupt triggers twice as often as it should
m_crtc->vsyn_callback().set(m_iop_pic, FUNC(pic8259_device::ir4_w)); // note this triggers interrupts on both the iop (ir7) and emulatorcpu (ir4)
m_crtc->set_screen("screen");
@@ -868,12 +881,13 @@ void notetaker_state::notetakr(machine_config &config)
AY31015(config, m_eiauart); // HD6402, == AY-3-1015D
m_eiauart->write_dav_callback().set(m_iop_pic, FUNC(pic8259_device::ir3_w)); // EIADataReady = EIAInt
- clock_device &eiaclock(CLOCK(config, "eiaclock", ((960_kHz_XTAL/10)/4)/5)); // hard-wired through an mc14568b divider set to divide by 4, the result set to divide by 5; this resulting 4800hz signal being 300 baud (16 clocks per baud)
+ // hard-wired through an mc14568b divider set to divide by 4, the result set to divide by 5; this resulting 4800hz signal being 300 baud (16 clocks per baud)
+ clock_device &eiaclock(CLOCK(config, "eiaclock", ((960_kHz_XTAL / 10) / 4) / 5));
eiaclock.signal_handler().set(m_eiauart, FUNC(ay31015_device::write_rcp));
eiaclock.signal_handler().append(m_eiauart, FUNC(ay31015_device::write_tcp));
/* Floppy */
- FD1791(config, m_fdc, (((24_MHz_XTAL/3)/2)/2)); // 2mhz, from 24mhz ip clock divided by 6 via 8284, an additional 2 by LS161 at #e1 on display/floppy board
+ FD1791(config, m_fdc, (((24_MHz_XTAL / 3) / 2) / 2)); // 2mhz, from 24mhz ip clock divided by 6 via 8284, an additional 2 by LS161 at #e1 on display/floppy board
FLOPPY_CONNECTOR(config, "wd1791:0", notetaker_floppies, "525dd", floppy_image_device::default_mfm_floppy_formats);
/* sound hardware */
@@ -883,7 +897,7 @@ void notetaker_state::notetakr(machine_config &config)
DAC1200(config, m_dac, 0).add_route(ALL_OUTPUTS, "lspeaker", 0.5).add_route(ALL_OUTPUTS, "rspeaker", 0.5); // unknown DAC
}
-void notetaker_state::init_notetakr()
+void notetaker_state::driver_init()
{
// descramble the rom; the whole thing is a gigantic scrambled mess either to ease
// interfacing with older xerox technologies which used A0 and D0 as the MSB bits
@@ -897,7 +911,7 @@ void notetaker_state::init_notetakr()
{
uint16_t wordtemp = bitswap<16>(*romsrc, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); // data bus is completely reversed
uint16_t addrtemp = bitswap<11>(i, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); // address bus is completely reversed; 11-15 should always be zero
- uint16_t *temppointer = romdst+(addrtemp&0x7FF);
+ uint16_t *temppointer = romdst + (addrtemp & 0x7ff);
*temppointer = wordtemp;
romsrc++;
}
@@ -921,10 +935,14 @@ ROM_START( notetakr )
ROM_SYSTEM_BIOS( 1, "v1.50", "Bootable IO Monitor v1.50" ) // typed from the source listing at http://bitsavers.trailing-edge.com/pdf/xerox/notetaker/memos/19790620_Z-IOP_1.5_ls.pdf and scrambled
ROMX_LOAD( "z-iop_1.50_hi.h1", 0x0000, 0x0800, CRC(122ffb5b) SHA1(b957fe24620e1aa98b3158dbcf459937dbd54bac), ROM_SKIP(1) | ROM_BIOS(1))
ROMX_LOAD( "z-iop_1.50_lo.g1", 0x0001, 0x0800, CRC(2cb79a67) SHA1(692aafd2aeea27533f6288dbb1cb8678ea08fade), ROM_SKIP(1) | ROM_BIOS(1))
+
ROM_REGION( 0x100000, "iop", ROMREGION_ERASEFF ) // area for descrambled roms
// main ram, on 2 cards with parity/ecc/syndrome/timing/bus arbitration on another 2 cards
+
+ // keyboard mcu which handles key scanning as well as reading the mouse quadratures, and issues state responses if requested by the iop
ROM_REGION( 0x400, "kbmcu", ROMREGION_ERASEFF )
- ROM_LOAD( "keyboard.i8748.a10a", 0x000, 0x400, NO_DUMP ) // keyboard mcu which handles key scanning as well as reading the mouse quadratures, and issues state responses if requested by the iop
+ ROM_LOAD( "keyboard.i8748.a10a", 0x000, 0x400, NO_DUMP )
+
ROM_REGION( 0x500, "proms", ROMREGION_ERASEFF )
/* disk data separator prom from the disk/display module board:
there are two different versions of this prom, both generated by BCPL programs,
@@ -935,9 +953,16 @@ ROM_START( notetakr )
thing that ever sees the prom data bus, this prom will work even if the
bit order for those bits is backwards.
*/
- ROM_LOAD( "disksep.82s147.a4", 0x000, 0x200, CRC(38363714) SHA1(c995d2702573f5afb5fc919150d3a5661013f999) ) // 1979 version
- ROM_LOAD( "timingprom.82s147.b1", 0x200, 0x200, CRC(3003b50a) SHA1(77d9ffe4716c2297708b8e5ebce7f930619c3cc3) ) // memory cas/ras/write state machine prom from the memory address logic board; the contents of this are listed in http://www.bitsavers.org/pdf/xerox/notetaker/schematics/19781027_Memory_Address_Timing.pdf
- ROM_LOAD( "memreqprom.82s126.d9", 0x400, 0x100, CRC(56b2be8b) SHA1(5df0579ed8afeb59113700be6f2982ef85f64b44) ) // SETMEMRQ memory timing prom from the disk/display module board; The equations for this one are actually listed on the schematic and the prom dump can be generated from these:
+ // 1979 version
+ ROM_LOAD( "disksep.82s147.a4", 0x000, 0x200, CRC(38363714) SHA1(c995d2702573f5afb5fc919150d3a5661013f999) )
+
+ // memory cas/ras/write state machine prom from the memory address logic board; the contents of this are listed in:
+ // http://www.bitsavers.org/pdf/xerox/notetaker/schematics/19781027_Memory_Address_Timing.pdf
+ ROM_LOAD( "timingprom.82s147.b1", 0x200, 0x200, CRC(3003b50a) SHA1(77d9ffe4716c2297708b8e5ebce7f930619c3cc3) )
+
+ // SETMEMRQ memory timing prom from the disk/display module board; The equations for this one are actually listed on the schematic and the prom dump can be generated from these:
+ ROM_LOAD( "memreqprom.82s126.d9", 0x400, 0x100, CRC(56b2be8b) SHA1(5df0579ed8afeb59113700be6f2982ef85f64b44) )
+
/*
SetMemRq:
Address:
@@ -970,5 +995,4 @@ ROM_END
/* Driver */
// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS
-COMP( 1978, notetakr, 0, 0, notetakr, notetakr, notetaker_state, init_notetakr, "Xerox", "NoteTaker", MACHINE_IS_SKELETON)
-
+COMP( 1978, notetakr, 0, 0, notetakr, notetakr, notetaker_state, empty_init, "Xerox", "NoteTaker", MACHINE_IS_SKELETON)
diff --git a/src/mame/drivers/novag_sexpert.cpp b/src/mame/drivers/novag_sexpert.cpp
index 5482dcd9416..b795f690611 100644
--- a/src/mame/drivers/novag_sexpert.cpp
+++ b/src/mame/drivers/novag_sexpert.cpp
@@ -182,7 +182,7 @@ private:
void sforte_state::machine_start()
{
sexpert_state::machine_start();
- m_beeptimer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sforte_state::beep),this));
+ m_beeptimer = timer_alloc(FUNC(sforte_state::beep), this);
}
diff --git a/src/mame/drivers/nwk-tr.cpp b/src/mame/drivers/nwk-tr.cpp
index 109258a358a..47a80b8c6ae 100644
--- a/src/mame/drivers/nwk-tr.cpp
+++ b/src/mame/drivers/nwk-tr.cpp
@@ -507,7 +507,7 @@ void nwktr_state::machine_start()
// configure fast RAM regions for DRC
m_maincpu->ppcdrc_add_fastram(0x00000000, 0x003fffff, false, m_work_ram);
- m_sound_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(nwktr_state::sound_irq), this));
+ m_sound_irq_timer = timer_alloc(FUNC(nwktr_state::sound_irq), this);
m_exrgb = false;
diff --git a/src/mame/drivers/octopus.cpp b/src/mame/drivers/octopus.cpp
index 5b7edb0bf2f..f8aa2a1c5f7 100644
--- a/src/mame/drivers/octopus.cpp
+++ b/src/mame/drivers/octopus.cpp
@@ -222,18 +222,13 @@ private:
DECLARE_WRITE_LINE_MEMBER(dack6_w) { m_dma1->hack_w(state ? 0 : 1); }
DECLARE_WRITE_LINE_MEMBER(dack7_w) { m_dma1->hack_w(state ? 0 : 1); }
- enum
- {
- BEEP_TIMER = 100
- };
-
void octopus_io(address_map &map);
void octopus_mem(address_map &map);
void octopus_sub_io(address_map &map);
void octopus_sub_mem(address_map &map);
void octopus_vram(address_map &map);
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(beep_off);
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_subcpu;
@@ -369,14 +364,9 @@ static INPUT_PORTS_START( octopus )
PORT_DIPSETTING( 0x80, DEF_STR( Yes ) )
INPUT_PORTS_END
-void octopus_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(octopus_state::beep_off)
{
- switch(id)
- {
- case BEEP_TIMER: // switch off speaker
- m_beep_active = false;
- break;
- }
+ m_beep_active = false;
}
void octopus_state::vram_w(offs_t offset, uint8_t data)
@@ -756,7 +746,7 @@ IRQ_CALLBACK_MEMBER(octopus_state::x86_irq_cb)
void octopus_state::machine_start()
{
- m_timer_beep = timer_alloc(BEEP_TIMER);
+ m_timer_beep = timer_alloc(FUNC(octopus_state::beep_off), this);
m_vidctrl = 0xff;
// install RAM
diff --git a/src/mame/drivers/olyboss.cpp b/src/mame/drivers/olyboss.cpp
index 9cb0e724cd4..5b547312b24 100644
--- a/src/mame/drivers/olyboss.cpp
+++ b/src/mame/drivers/olyboss.cpp
@@ -84,7 +84,8 @@ public:
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(toggle_tim);
private:
u8 keyboard_read();
@@ -139,7 +140,7 @@ private:
void olyboss_state::machine_reset()
{
- m_keybhit=false;
+ m_keybhit = false;
m_romen = true;
m_timstate = false;
@@ -149,7 +150,7 @@ void olyboss_state::machine_reset()
m_timer->adjust(attotime::from_hz(30), 0, attotime::from_hz(30)); // unknown timer freq, possibly com2651 BRCLK
}
-void olyboss_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(olyboss_state::toggle_tim)
{
m_timstate = !m_timstate;
if(m_pic)
@@ -300,7 +301,7 @@ void olyboss_state::ppic_w(u8 data)
void olyboss_state::machine_start()
{
- m_timer = timer_alloc();
+ m_timer = timer_alloc(FUNC(olyboss_state::toggle_tim), this);
const char *type = m_fdd0->get_device()->shortname();
if(!strncmp(type, "floppy_525_qd", 13))
m_fdctype = 0xa0;
diff --git a/src/mame/drivers/olytext.cpp b/src/mame/drivers/olytext.cpp
index d22c9706e20..8eab41a390a 100644
--- a/src/mame/drivers/olytext.cpp
+++ b/src/mame/drivers/olytext.cpp
@@ -51,7 +51,6 @@ public:
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
-// virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
private:
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/drivers/omegrace.cpp b/src/mame/drivers/omegrace.cpp
index 54c221f154e..9c1a71d42e8 100644
--- a/src/mame/drivers/omegrace.cpp
+++ b/src/mame/drivers/omegrace.cpp
@@ -286,7 +286,7 @@ void omegrace_state::machine_start()
// Interrupt caused by overflow pulses from 74LS161 clocked by 74LS393 dividing .75 MHz output of 74LS161
attotime period = attotime::from_hz(12_MHz_XTAL/16/256/12); // ~250 Hz
- m_gbnmi = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(omegrace_state::periodic_int), this));
+ m_gbnmi = timer_alloc(FUNC(omegrace_state::periodic_int), this);
m_gbnmi->adjust(period, 0, period); // first NMI must not arrive immediately
}
diff --git a/src/mame/drivers/orbit.cpp b/src/mame/drivers/orbit.cpp
index 1cd1a45117e..295bf643bdf 100644
--- a/src/mame/drivers/orbit.cpp
+++ b/src/mame/drivers/orbit.cpp
@@ -248,7 +248,7 @@ GFXDECODE_END
void orbit_state::machine_start()
{
- m_irq_off_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(orbit_state::irq_off), this));
+ m_irq_off_timer = timer_alloc(FUNC(orbit_state::irq_off), this);
save_item(NAME(m_flip_screen));
}
diff --git a/src/mame/drivers/oric.cpp b/src/mame/drivers/oric.cpp
index 3781bc85a44..cd8b16d9b35 100644
--- a/src/mame/drivers/oric.cpp
+++ b/src/mame/drivers/oric.cpp
@@ -401,7 +401,7 @@ void oric_state::machine_start_common()
m_ext_irq = false;
if (!m_tape_timer)
- m_tape_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(oric_state::update_tape), this));
+ m_tape_timer = timer_alloc(FUNC(oric_state::update_tape), this);
save_item(NAME(m_blink_counter));
save_item(NAME(m_pattr));
diff --git a/src/mame/drivers/osbexec.cpp b/src/mame/drivers/osbexec.cpp
index 50afe939dd8..8e77b14843e 100644
--- a/src/mame/drivers/osbexec.cpp
+++ b/src/mame/drivers/osbexec.cpp
@@ -504,7 +504,7 @@ void osbexec_state::init_osbexec()
m_vram = make_unique_clear<uint8_t[]>(0x2000);
m_fontram = make_unique_clear<uint8_t[]>(0x1000);
- m_video_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(osbexec_state::osbexec_video_callback),this));
+ m_video_timer = timer_alloc(FUNC(osbexec_state::osbexec_video_callback), this);
}
diff --git a/src/mame/drivers/overdriv.cpp b/src/mame/drivers/overdriv.cpp
index e281bc9dbd7..25e9e8d0b2b 100644
--- a/src/mame/drivers/overdriv.cpp
+++ b/src/mame/drivers/overdriv.cpp
@@ -417,7 +417,7 @@ INPUT_PORTS_END
void overdriv_state::machine_start()
{
m_led.resolve();
- m_objdma_end_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(overdriv_state::objdma_end_cb), this));
+ m_objdma_end_timer = timer_alloc(FUNC(overdriv_state::objdma_end_cb), this);
save_item(NAME(m_cpuB_ctrl));
save_item(NAME(m_sprite_colorbase));
diff --git a/src/mame/drivers/parodius.cpp b/src/mame/drivers/parodius.cpp
index bd59070b59d..efcecf0c84f 100644
--- a/src/mame/drivers/parodius.cpp
+++ b/src/mame/drivers/parodius.cpp
@@ -319,7 +319,7 @@ void parodius_state::machine_start()
m_mainbank->configure_entries(0, 16, memregion("maincpu")->base(), 0x4000);
m_mainbank->set_entry(0);
- m_nmi_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(parodius_state::nmi_timer), this));
+ m_nmi_timer = timer_alloc(FUNC(parodius_state::nmi_timer), this);
save_item(NAME(m_sprite_colorbase));
save_item(NAME(m_layer_colorbase));
diff --git a/src/mame/drivers/pasopia.cpp b/src/mame/drivers/pasopia.cpp
index e03b8788b32..a65f5664e90 100644
--- a/src/mame/drivers/pasopia.cpp
+++ b/src/mame/drivers/pasopia.cpp
@@ -218,7 +218,7 @@ void pasopia_state::machine_start()
{
m_p_vram = make_unique_clear<u16[]>(0x4000);
- m_pio_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pasopia_state::pio_timer), this));
+ m_pio_timer = timer_alloc(FUNC(pasopia_state::pio_timer), this);
m_pio_timer->adjust(attotime::from_hz(50), 0, attotime::from_hz(50));
m_hblank = 0;
diff --git a/src/mame/drivers/pasopia7.cpp b/src/mame/drivers/pasopia7.cpp
index eb41c2e2a37..a13163faedf 100644
--- a/src/mame/drivers/pasopia7.cpp
+++ b/src/mame/drivers/pasopia7.cpp
@@ -918,14 +918,14 @@ ROM_END
void pasopia7_state::init_p7_raster()
{
m_screen_type = 1;
- m_pio_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pasopia7_state::pio_timer), this));
+ m_pio_timer = timer_alloc(FUNC(pasopia7_state::pio_timer), this);
m_pio_timer->adjust(attotime::from_hz(5000), 0, attotime::from_hz(5000));
}
void pasopia7_state::init_p7_lcd()
{
m_screen_type = 0;
- m_pio_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pasopia7_state::pio_timer), this));
+ m_pio_timer = timer_alloc(FUNC(pasopia7_state::pio_timer), this);
m_pio_timer->adjust(attotime::from_hz(5000), 0, attotime::from_hz(5000));
}
diff --git a/src/mame/drivers/patinho_feio.cpp b/src/mame/drivers/patinho_feio.cpp
index f9f7154caca..dc52a3bf575 100644
--- a/src/mame/drivers/patinho_feio.cpp
+++ b/src/mame/drivers/patinho_feio.cpp
@@ -186,8 +186,8 @@ DEVICE_IMAGE_LOAD_MEMBER( patinho_feio_state::tape_load )
}
void patinho_feio_state::machine_start(){
- m_teletype_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(patinho_feio_state::teletype_callback),this));
- m_decwriter_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(patinho_feio_state::decwriter_callback),this));
+ m_teletype_timer = timer_alloc(FUNC(patinho_feio_state::teletype_callback), this);
+ m_decwriter_timer = timer_alloc(FUNC(patinho_feio_state::decwriter_callback), this);
// Copy some programs directly into RAM.
// This is a hack for setting up the computer
diff --git a/src/mame/drivers/pb1000.cpp b/src/mame/drivers/pb1000.cpp
index 8a048428cb8..e6e06a02817 100644
--- a/src/mame/drivers/pb1000.cpp
+++ b/src/mame/drivers/pb1000.cpp
@@ -455,7 +455,7 @@ void pb1000_state::machine_start()
membank("bank1")->set_base(m_rom_reg->base());
- m_kb_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pb1000_state::keyboard_timer),this));
+ m_kb_timer = timer_alloc(FUNC(pb1000_state::keyboard_timer), this);
m_kb_timer->adjust(attotime::from_hz(192), 0, attotime::from_hz(192));
}
diff --git a/src/mame/drivers/pbaction.cpp b/src/mame/drivers/pbaction.cpp
index 033cdd32271..19b1afe1ab0 100644
--- a/src/mame/drivers/pbaction.cpp
+++ b/src/mame/drivers/pbaction.cpp
@@ -418,7 +418,7 @@ GFXDECODE_END
void pbaction_state::machine_start()
{
- m_soundcommand_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pbaction_state::sound_trigger), this));
+ m_soundcommand_timer = timer_alloc(FUNC(pbaction_state::sound_trigger), this);
save_item(NAME(m_nmi_mask));
save_item(NAME(m_scroll));
}
@@ -508,7 +508,7 @@ void pbaction_tecfri_state::machine_start()
{
pbaction_state::machine_start();
- m_subcommand_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pbaction_tecfri_state::sub_trigger), this));
+ m_subcommand_timer = timer_alloc(FUNC(pbaction_tecfri_state::sub_trigger), this);
m_digits.resolve();
}
diff --git a/src/mame/drivers/pc4.cpp b/src/mame/drivers/pc4.cpp
index 99f3745b145..90894a86ea9 100644
--- a/src/mame/drivers/pc4.cpp
+++ b/src/mame/drivers/pc4.cpp
@@ -198,8 +198,8 @@ void pc4_state::machine_start()
m_rombank->configure_entries(0, 8, rom_base, 0x4000);
m_rombank->set_entry(0);
- m_busy_timer = timer_alloc(BUSY_TIMER);
- m_blink_timer = timer_alloc(BLINKING_TIMER);
+ m_busy_timer = timer_alloc(FUNC(pc4_state::clear_busy_flag), this);
+ m_blink_timer = timer_alloc(FUNC(pc4_state::blink_tick), this);
m_blink_timer->adjust(attotime::from_msec(409), 0, attotime::from_msec(409));
for (int i=0; i<8; i++)
diff --git a/src/mame/drivers/pc6001.cpp b/src/mame/drivers/pc6001.cpp
index f7bb3228ec2..7a5630e87c8 100644
--- a/src/mame/drivers/pc6001.cpp
+++ b/src/mame/drivers/pc6001.cpp
@@ -1504,8 +1504,8 @@ TIMER_DEVICE_CALLBACK_MEMBER(pc6001_state::keyboard_callback)
void pc6001_state::machine_start()
{
- m_timer_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pc6001_state::audio_callback),this));
- m_sub_trig_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pc6001_state::sub_trig_callback),this));
+ m_timer_irq_timer = timer_alloc(FUNC(pc6001_state::audio_callback), this);
+ m_sub_trig_timer = timer_alloc(FUNC(pc6001_state::sub_trig_callback), this);
}
inline void pc6001_state::set_videoram_bank(uint32_t offs)
diff --git a/src/mame/drivers/pc88va.cpp b/src/mame/drivers/pc88va.cpp
index bd36671052e..6da9ac140e3 100644
--- a/src/mame/drivers/pc88va.cpp
+++ b/src/mame/drivers/pc88va.cpp
@@ -374,31 +374,6 @@ uint32_t pc88va_state::screen_update_pc88va(screen_device &screen, bitmap_rgb32
return 0;
}
-void pc88va_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_PC8801FD_UPD765_TC_TO_ZERO:
- pc8801fd_upd765_tc_to_zero(param);
- break;
- case TIMER_T3_MOUSE_CALLBACK:
- t3_mouse_callback(param);
- break;
- case TIMER_PC88VA_FDC_TIMER:
- pc88va_fdc_timer(param);
- break;
- case TIMER_PC88VA_FDC_MOTOR_START_0:
- pc88va_fdc_motor_start_0(param);
- break;
- case TIMER_PC88VA_FDC_MOTOR_START_1:
- pc88va_fdc_motor_start_1(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in pc88va_state::device_timer");
- }
-}
-
-
void pc88va_state::pc88va_map(address_map &map)
{
map(0x00000, 0x7ffff).ram();
@@ -893,7 +868,7 @@ void pc88va_state::pc88va_fdc_w(offs_t offset, uint8_t data)
{
m_fdd[0]->get_device()->mon_w(1);
if(m_fdc_motor_status[0] == 0)
- timer_set(attotime::from_msec(505), TIMER_PC88VA_FDC_MOTOR_START_0);
+ m_motor_start_timer[0]->adjust(attotime::from_msec(505));
else
m_fdc_motor_status[0] = 0;
}
@@ -902,7 +877,7 @@ void pc88va_state::pc88va_fdc_w(offs_t offset, uint8_t data)
{
m_fdd[1]->get_device()->mon_w(1);
if(m_fdc_motor_status[1] == 0)
- timer_set(attotime::from_msec(505), TIMER_PC88VA_FDC_MOTOR_START_1);
+ m_motor_start_timer[1]->adjust(attotime::from_msec(505));
else
m_fdc_motor_status[1] = 0;
}
@@ -918,7 +893,7 @@ void pc88va_state::pc88va_fdc_w(offs_t offset, uint8_t data)
case 0x06:
//printf("%02x\n",data);
if(data & 1)
- timer_set(attotime::from_msec(100), TIMER_PC88VA_FDC_TIMER);
+ m_fdc_timer->adjust(attotime::from_msec(100));
if((m_fdc_ctrl_2 & 0x10) != (data & 0x10))
m_dmac->dreq2_w(1);
@@ -1100,7 +1075,7 @@ void pc88va_state::pc88va_z80_map(address_map &map)
uint8_t pc88va_state::upd765_tc_r()
{
m_fdc->tc_w(true);
- timer_set(attotime::from_usec(50), TIMER_PC8801FD_UPD765_TC_TO_ZERO);
+ m_tc_clear_timer->adjust(attotime::from_usec(50));
return 0;
}
@@ -1440,8 +1415,20 @@ uint8_t pc88va_state::get_slave_ack(offs_t offset)
void pc88va_state::machine_start()
{
- m_t3_mouse_timer = timer_alloc(TIMER_T3_MOUSE_CALLBACK);
+ m_tc_clear_timer = timer_alloc(FUNC(pc88va_state::pc8801fd_upd765_tc_to_zero), this);
+ m_tc_clear_timer->adjust(attotime::never);
+
+ m_fdc_timer = timer_alloc(FUNC(pc88va_state::pc88va_fdc_timer), this);
+ m_fdc_timer->adjust(attotime::never);
+
+ m_motor_start_timer[0] = timer_alloc(FUNC(pc88va_state::pc88va_fdc_motor_start_0), this);
+ m_motor_start_timer[1] = timer_alloc(FUNC(pc88va_state::pc88va_fdc_motor_start_1), this);
+ m_motor_start_timer[0]->adjust(attotime::never);
+ m_motor_start_timer[1]->adjust(attotime::never);
+
+ m_t3_mouse_timer = timer_alloc(FUNC(pc88va_state::t3_mouse_callback), this);
m_t3_mouse_timer->adjust(attotime::never);
+
floppy_image_device *floppy;
floppy = m_fdd[0]->get_device();
if(floppy)
diff --git a/src/mame/drivers/pc9801.cpp b/src/mame/drivers/pc9801.cpp
index eccc464a64e..6946d67923f 100644
--- a/src/mame/drivers/pc9801.cpp
+++ b/src/mame/drivers/pc9801.cpp
@@ -946,18 +946,13 @@ template <unsigned port> u8 pc9801vm_state::fdc_2hd_2dd_ctrl_r()
return res;
}
-void pc9801vm_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(pc9801vm_state::fdc_trigger)
{
- switch (id)
+ // TODO: sorcer definitely expects this irq to be taken
+ if (BIT(m_fdc_2hd_ctrl, 2))
{
- case TIMER_FDC_TRIGGER:
- // TODO: sorcer definitely expects this irq to be taken
- if (bool(BIT(m_fdc_2hd_ctrl, 2)))
- {
- m_pic2->ir2_w(0);
- m_pic2->ir2_w(1);
- }
- break;
+ m_pic2->ir2_w(0);
+ m_pic2->ir2_w(1);
}
}
@@ -1922,7 +1917,7 @@ MACHINE_START_MEMBER(pc9801vm_state,pc9801rs)
m_sys_type = 0x80 >> 6;
- m_fdc_timer = timer_alloc(TIMER_FDC_TRIGGER);
+ m_fdc_timer = timer_alloc(FUNC(pc9801vm_state::fdc_trigger), this);
save_item(NAME(m_dac1bit_disable));
diff --git a/src/mame/drivers/pcfx.cpp b/src/mame/drivers/pcfx.cpp
index 0ac66bfd9c6..c7a2c8e044d 100644
--- a/src/mame/drivers/pcfx.cpp
+++ b/src/mame/drivers/pcfx.cpp
@@ -28,20 +28,16 @@ public:
pcfx_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
- m_huc6261(*this, "huc6261") { }
+ m_huc6261(*this, "huc6261"),
+ m_pads(*this, "P%u", 1U) { }
void pcfx(machine_config &config);
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
private:
- enum
- {
- TIMER_PAD_FUNC
- };
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
uint16_t irq_read(offs_t offset);
@@ -59,7 +55,7 @@ private:
DECLARE_WRITE_LINE_MEMBER( irq13_w );
DECLARE_WRITE_LINE_MEMBER( irq14_w );
[[maybe_unused]] DECLARE_WRITE_LINE_MEMBER( irq15_w );
- TIMER_CALLBACK_MEMBER(pad_func);
+ template <int Pad> TIMER_CALLBACK_MEMBER(pad_func);
void pcfx_io(address_map &map);
void pcfx_mem(address_map &map);
@@ -77,12 +73,14 @@ private:
};
pcfx_pad_t m_pad;
+ emu_timer *m_pad_timers[2];
inline void check_irqs();
inline void set_irq_line(int line, int state);
required_device<cpu_device> m_maincpu;
required_device<huc6261_device> m_huc6261;
+ required_ioport_array<2> m_pads;
};
@@ -141,25 +139,12 @@ uint16_t pcfx_state::pad_r(offs_t offset)
return res;
}
-void pcfx_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_PAD_FUNC:
- pad_func(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in pcfx_state::device_timer");
- }
-}
-
+template <int Pad>
TIMER_CALLBACK_MEMBER(pcfx_state::pad_func)
{
- const char *const padnames[] = { "P1", "P2" };
-
- m_pad.latch[param] = ioport(padnames[param])->read();
- m_pad.status[param] |= 8;
- m_pad.ctrl[param] &= ~1; // ack TX line
+ m_pad.latch[Pad] = m_pads[Pad]->read();
+ m_pad.status[Pad] |= 8;
+ m_pad.ctrl[Pad] &= ~1; // ack TX line
// TODO: pad IRQ
set_irq_line(11, 1);
}
@@ -178,7 +163,7 @@ void pcfx_state::pad_w(offs_t offset, uint16_t data)
*/
if(data & 1 && (!(m_pad.ctrl[port_type] & 1)))
{
- timer_set(attotime::from_usec(1000), TIMER_PAD_FUNC, port_type); // TODO: time
+ m_pad_timers[port_type]->adjust(attotime::from_usec(1000)); // TODO: time
}
m_pad.ctrl[port_type] = data & 7;
@@ -415,6 +400,9 @@ void pcfx_state::machine_start()
m_pad.status[i] = 0;
m_pad.latch[i] = 0;
};
+
+ m_pad_timers[0] = timer_alloc(FUNC(pcfx_state::pad_func<0>), this);
+ m_pad_timers[1] = timer_alloc(FUNC(pcfx_state::pad_func<1>), this);
}
void pcfx_state::machine_reset()
diff --git a/src/mame/drivers/pcw.cpp b/src/mame/drivers/pcw.cpp
index 6cd4baab83b..1c4dc92b6af 100644
--- a/src/mame/drivers/pcw.cpp
+++ b/src/mame/drivers/pcw.cpp
@@ -1030,12 +1030,12 @@ void pcw_state::init_pcw()
m_roller_ram_offset = 0;
/* timer interrupt */
- m_beep_setup_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pcw_state::setup_beep), this));
+ m_beep_setup_timer = timer_alloc(FUNC(pcw_state::setup_beep), this);
m_beep_setup_timer->adjust(attotime::zero);
- m_prn_stepper = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pcw_state::pcw_stepper_callback), this));
- m_prn_pins = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pcw_state::pcw_pins_callback), this));
- m_pulse_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pcw_state::pcw_timer_pulse), this));
+ m_prn_stepper = timer_alloc(FUNC(pcw_state::pcw_stepper_callback), this);
+ m_prn_pins = timer_alloc(FUNC(pcw_state::pcw_pins_callback), this);
+ m_pulse_timer = timer_alloc(FUNC(pcw_state::pcw_timer_pulse), this);
}
diff --git a/src/mame/drivers/pcxt.cpp b/src/mame/drivers/pcxt.cpp
index 3dfd02025e9..06e288bfb56 100644
--- a/src/mame/drivers/pcxt.cpp
+++ b/src/mame/drivers/pcxt.cpp
@@ -83,7 +83,8 @@ public:
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(sample_tick);
private:
int m_lastvalue;
@@ -509,7 +510,7 @@ static INPUT_PORTS_START( tetriskr )
PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED )
INPUT_PORTS_END
-void pcxt_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(pcxt_state::sample_tick)
{
m_cvsd->digit_w(BIT(m_samples->as_u8(m_vaddr), m_bit));
m_cvsd->clock_w(1);
@@ -526,7 +527,7 @@ void pcxt_state::device_timer(emu_timer &timer, device_timer_id id, int param)
void pcxt_state::machine_start()
{
- m_sample = timer_alloc();
+ m_sample = timer_alloc(FUNC(pcxt_state::sample_tick), this);
m_status = 0;
m_clr_status = 0;
diff --git a/src/mame/drivers/pdp1.cpp b/src/mame/drivers/pdp1.cpp
index 176611ee3a8..93936b961d2 100644
--- a/src/mame/drivers/pdp1.cpp
+++ b/src/mame/drivers/pdp1.cpp
@@ -600,7 +600,7 @@ void pdp1_state::machine_start()
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(&pdp1_state::pdp1_machine_stop,this));
- m_dpy_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pdp1_state::dpy_callback),this));
+ m_dpy_timer = timer_alloc(FUNC(pdp1_state::dpy_callback), this);
}
@@ -625,7 +625,7 @@ void pdp1_readtape_image_device::device_resolve_objects()
void pdp1_readtape_image_device::device_start()
{
- m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pdp1_readtape_image_device::reader_callback),this));
+ m_timer = timer_alloc(FUNC(pdp1_readtape_image_device::reader_callback), this);
m_timer->adjust(attotime::zero, 0, attotime::from_hz(2500));
m_timer->enable(0);
}
@@ -648,7 +648,7 @@ void pdp1_punchtape_image_device::device_resolve_objects()
void pdp1_punchtape_image_device::device_start()
{
- m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pdp1_punchtape_image_device::puncher_callback),this));
+ m_timer = timer_alloc(FUNC(pdp1_punchtape_image_device::puncher_callback), this);
}
@@ -674,7 +674,7 @@ void pdp1_typewriter_device::device_resolve_objects()
void pdp1_typewriter_device::device_start()
{
- m_tyo_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pdp1_typewriter_device::tyo_callback),this));
+ m_tyo_timer = timer_alloc(FUNC(pdp1_typewriter_device::tyo_callback), this);
m_color = m_pos = m_case_shift = 0;
}
@@ -1316,10 +1316,10 @@ TIMER_CALLBACK_MEMBER(pdp1_cylinder_image_device::il_timer_callback)
void pdp1_cylinder_image_device::parallel_drum_init()
{
- m_rotation_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pdp1_cylinder_image_device::rotation_timer_callback), this));
+ m_rotation_timer = timer_alloc(FUNC(pdp1_cylinder_image_device::rotation_timer_callback), this);
m_rotation_timer->adjust(PARALLEL_DRUM_ROTATION_TIME, 0, PARALLEL_DRUM_ROTATION_TIME);
- m_il_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pdp1_cylinder_image_device::il_timer_callback), this));
+ m_il_timer = timer_alloc(FUNC(pdp1_cylinder_image_device::il_timer_callback), this);
set_il(0);
}
diff --git a/src/mame/drivers/pentagon.cpp b/src/mame/drivers/pentagon.cpp
index 22df60484dd..46bc7b3ff7a 100644
--- a/src/mame/drivers/pentagon.cpp
+++ b/src/mame/drivers/pentagon.cpp
@@ -123,7 +123,7 @@ rectangle pentagon_state::get_screen_area()
INTERRUPT_GEN_MEMBER(pentagon_state::pentagon_interrupt)
{
- timer_set(m_screen->time_until_pos(0) + /*???*/ m_maincpu->clocks_to_attotime(3), TIMER_IRQ_ON, 0);
+ m_irq_on_timer->adjust(m_screen->time_until_pos(0) + /*???*/ m_maincpu->clocks_to_attotime(3));
}
uint8_t pentagon_state::beta_neutral_r(offs_t offset)
diff --git a/src/mame/drivers/peplus.cpp b/src/mame/drivers/peplus.cpp
index 3d1b38b0e6c..1b95ad588a6 100644
--- a/src/mame/drivers/peplus.cpp
+++ b/src/mame/drivers/peplus.cpp
@@ -1340,7 +1340,7 @@ void peplus_state::machine_start()
m_bnkb.resolve();
m_bnkc.resolve();
- m_assert_lp_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(peplus_state::assert_lp), this));
+ m_assert_lp_timer = timer_alloc(FUNC(peplus_state::assert_lp), this);
save_item(NAME(m_last_cycles));
save_item(NAME(m_coin_state));
diff --git a/src/mame/drivers/pet.cpp b/src/mame/drivers/pet.cpp
index 35a2329f175..77b4974916b 100644
--- a/src/mame/drivers/pet.cpp
+++ b/src/mame/drivers/pet.cpp
@@ -1536,7 +1536,7 @@ MACHINE_START_MEMBER( pet_state, pet )
}
if (!m_sync_timer)
- m_sync_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pet_state::sync_tick), this));
+ m_sync_timer = timer_alloc(FUNC(pet_state::sync_tick), this);
// state saving
save_item(NAME(m_key));
diff --git a/src/mame/drivers/pockstat.cpp b/src/mame/drivers/pockstat.cpp
index 27feb4f8676..1a7f70d7b21 100644
--- a/src/mame/drivers/pockstat.cpp
+++ b/src/mame/drivers/pockstat.cpp
@@ -882,7 +882,7 @@ void pockstat_state::machine_start()
{
for (uint32_t index = 0; index < TIMER_COUNT; index++)
{
- m_timers[index].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pockstat_state::timer_tick), this));
+ m_timers[index].timer = timer_alloc(FUNC(pockstat_state::timer_tick), this);
m_timers[index].timer->adjust(attotime::never, index);
m_timers[index].count = 0;
}
@@ -890,7 +890,7 @@ void pockstat_state::machine_start()
m_rtc_regs.time = 0x01000000;
m_rtc_regs.date = 0x19990101;
- m_rtc_regs.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pockstat_state::rtc_tick),this));
+ m_rtc_regs.timer = timer_alloc(FUNC(pockstat_state::rtc_tick), this);
m_rtc_regs.timer->adjust(attotime::from_hz(1), TIMER_COUNT);
std::string region_tag;
diff --git a/src/mame/drivers/pokemini.cpp b/src/mame/drivers/pokemini.cpp
index a09fedf8537..7eccbea2e1d 100644
--- a/src/mame/drivers/pokemini.cpp
+++ b/src/mame/drivers/pokemini.cpp
@@ -38,21 +38,6 @@ public:
void pokemini(machine_config &config);
protected:
- enum
- {
- TIMER_SECONDS,
- TIMER_256HZ,
- TIMER_1,
- TIMER_1_HI,
- TIMER_2,
- TIMER_2_HI,
- TIMER_3,
- TIMER_3_HI,
- TIMER_PRC
- };
-
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
virtual void video_start() override;
virtual void machine_start() override;
@@ -110,15 +95,15 @@ private:
void check_irqs();
void update_sound();
- void seconds_timer_callback();
- void timer_256hz_callback();
- void timer1_callback();
- void timer1_hi_callback();
- void timer2_callback();
- void timer2_hi_callback();
- void timer3_callback();
- void timer3_hi_callback();
- void prc_counter_callback();
+ TIMER_CALLBACK_MEMBER(seconds_timer_callback);
+ TIMER_CALLBACK_MEMBER(timer_256hz_callback);
+ TIMER_CALLBACK_MEMBER(timer1_callback);
+ TIMER_CALLBACK_MEMBER(timer1_hi_callback);
+ TIMER_CALLBACK_MEMBER(timer2_callback);
+ TIMER_CALLBACK_MEMBER(timer2_hi_callback);
+ TIMER_CALLBACK_MEMBER(timer3_callback);
+ TIMER_CALLBACK_MEMBER(timer3_hi_callback);
+ TIMER_CALLBACK_MEMBER(prc_counter_callback);
};
@@ -335,7 +320,7 @@ void pokemini_state::update_sound()
}
-void pokemini_state::seconds_timer_callback()
+TIMER_CALLBACK_MEMBER(pokemini_state::seconds_timer_callback)
{
if ( m_pm_reg[0x08] & 0x01 )
{
@@ -352,7 +337,7 @@ void pokemini_state::seconds_timer_callback()
}
-void pokemini_state::timer_256hz_callback()
+TIMER_CALLBACK_MEMBER(pokemini_state::timer_256hz_callback)
{
if ( m_pm_reg[0x40] & 0x01 )
{
@@ -386,7 +371,7 @@ void pokemini_state::timer_256hz_callback()
}
-void pokemini_state::timer1_callback()
+TIMER_CALLBACK_MEMBER(pokemini_state::timer1_callback)
{
m_pm_reg[0x36] -= 1;
/* Check for underflow of timer */
@@ -414,7 +399,7 @@ void pokemini_state::timer1_callback()
}
-void pokemini_state::timer1_hi_callback()
+TIMER_CALLBACK_MEMBER(pokemini_state::timer1_hi_callback)
{
m_pm_reg[0x37] -= 1;
/* Check for underflow of timer */
@@ -427,7 +412,7 @@ void pokemini_state::timer1_hi_callback()
}
-void pokemini_state::timer2_callback()
+TIMER_CALLBACK_MEMBER(pokemini_state::timer2_callback)
{
m_pm_reg[0x3E] -= 1;
/* Check for underflow of timer */
@@ -455,7 +440,7 @@ void pokemini_state::timer2_callback()
}
-void pokemini_state::timer2_hi_callback()
+TIMER_CALLBACK_MEMBER(pokemini_state::timer2_hi_callback)
{
m_pm_reg[0x3F] -= 1;
/* Check for underfow of timer */
@@ -468,7 +453,7 @@ void pokemini_state::timer2_hi_callback()
}
-void pokemini_state::timer3_callback()
+TIMER_CALLBACK_MEMBER(pokemini_state::timer3_callback)
{
m_pm_reg[0x4E] -= 1;
/* Check for underflow of timer */
@@ -504,7 +489,7 @@ void pokemini_state::timer3_callback()
}
-void pokemini_state::timer3_hi_callback()
+TIMER_CALLBACK_MEMBER(pokemini_state::timer3_hi_callback)
{
m_pm_reg[0x4F] -= 1;
/* Check for underflow of timer */
@@ -1533,7 +1518,7 @@ DEVICE_IMAGE_LOAD_MEMBER( pokemini_state::cart_load )
}
-void pokemini_state::prc_counter_callback()
+TIMER_CALLBACK_MEMBER(pokemini_state::prc_counter_callback)
{
address_space &space = m_maincpu->space( AS_PROGRAM );
m_prc.count++;
@@ -1675,69 +1660,26 @@ void pokemini_state::machine_start()
memset( m_pm_reg, 0, sizeof(m_pm_reg) );
/* Set up timers */
- m_timers.seconds_timer = timer_alloc(TIMER_SECONDS);
+ m_timers.seconds_timer = timer_alloc(FUNC(pokemini_state::seconds_timer_callback), this);
m_timers.seconds_timer->adjust(attotime::zero, 0, attotime::from_seconds(1));
- m_timers.hz256_timer = timer_alloc(TIMER_256HZ);
+ m_timers.hz256_timer = timer_alloc(FUNC(pokemini_state::timer_256hz_callback), this);
m_timers.hz256_timer->adjust(attotime::zero, 0, attotime::from_hz(256));
- m_timers.timer1 = timer_alloc(TIMER_1);
- m_timers.timer1_hi = timer_alloc(TIMER_1_HI);
- m_timers.timer2 = timer_alloc(TIMER_2);
- m_timers.timer2_hi = timer_alloc(TIMER_2_HI);
- m_timers.timer3 = timer_alloc(TIMER_3);
- m_timers.timer3_hi = timer_alloc(TIMER_3_HI);
+ m_timers.timer1 = timer_alloc(FUNC(pokemini_state::timer1_callback), this);
+ m_timers.timer1_hi = timer_alloc(FUNC(pokemini_state::timer1_hi_callback), this);
+ m_timers.timer2 = timer_alloc(FUNC(pokemini_state::timer2_callback), this);
+ m_timers.timer2_hi = timer_alloc(FUNC(pokemini_state::timer2_hi_callback), this);
+ m_timers.timer3 = timer_alloc(FUNC(pokemini_state::timer3_callback), this);
+ m_timers.timer3_hi = timer_alloc(FUNC(pokemini_state::timer3_hi_callback), this);
/* Set up the PRC */
m_prc.max_frame_count = 2;
- m_prc.count_timer = timer_alloc(TIMER_PRC);
+ m_prc.count_timer = timer_alloc(FUNC(pokemini_state::prc_counter_callback), this);
m_prc.count_timer->adjust( attotime::zero, 0, m_maincpu->cycles_to_attotime(55640 / 65) );
}
-void pokemini_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_SECONDS:
- seconds_timer_callback();
- break;
-
- case TIMER_256HZ:
- timer_256hz_callback();
- break;
-
- case TIMER_1:
- timer1_callback();
- break;
-
- case TIMER_1_HI:
- timer1_hi_callback();
- break;
-
- case TIMER_2:
- timer2_callback();
- break;
-
- case TIMER_2_HI:
- timer2_hi_callback();
- break;
-
- case TIMER_3:
- timer3_callback();
- break;
-
- case TIMER_3_HI:
- timer3_hi_callback();
- break;
-
- case TIMER_PRC:
- prc_counter_callback();
- break;
- }
-}
-
-
static const double speaker_levels[] = {-1.0, 0.0, 1.0};
void pokemini_state::video_start()
diff --git a/src/mame/drivers/poly.cpp b/src/mame/drivers/poly.cpp
index 8e72e7fbeba..4f6265ec99c 100644
--- a/src/mame/drivers/poly.cpp
+++ b/src/mame/drivers/poly.cpp
@@ -196,11 +196,14 @@ INPUT_PORTS_END
void poly_state::machine_start()
{
m_dat_bank = 0;
+ m_protect_timer = timer_alloc(FUNC(poly_state::set_protect), this);
}
void poly_state::machine_reset()
{
+ m_protect_timer->adjust(attotime::never);
+
//m_kr2376->set_input_pin(kr2376_device::KR2376_DSII, 0);
//m_kr2376->set_input_pin(kr2376_device::KR2376_PII, 0);
diff --git a/src/mame/drivers/popper.cpp b/src/mame/drivers/popper.cpp
index b1f44889f48..e9e696fa2c2 100644
--- a/src/mame/drivers/popper.cpp
+++ b/src/mame/drivers/popper.cpp
@@ -76,7 +76,8 @@ public:
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(scanline_tick);
private:
required_device<z80_device> m_maincpu;
@@ -291,7 +292,7 @@ void popper_state::popper_palette(palette_device &palette) const
// VIDEO EMULATION
//**************************************************************************
-void popper_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(popper_state::scanline_tick)
{
int y = m_screen->vpos();
@@ -514,7 +515,7 @@ void popper_state::machine_start()
m_layer1_tilemap->set_transparent_pen(0);
// allocate and start scanline timer
- m_scanline_timer = timer_alloc(0);
+ m_scanline_timer = timer_alloc(FUNC(popper_state::scanline_tick), this);
m_scanline_timer->adjust(m_screen->time_until_pos(0, 0));
// register for save states
diff --git a/src/mame/drivers/positron.cpp b/src/mame/drivers/positron.cpp
index 5f35367ebab..17ec3eeb60f 100644
--- a/src/mame/drivers/positron.cpp
+++ b/src/mame/drivers/positron.cpp
@@ -65,14 +65,10 @@ public:
void positron(machine_config &config);
private:
- enum
- {
- TIMER_FUSE
- };
-
virtual void machine_reset() override;
virtual void machine_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(fuse_update); // TODO: Does nothing
// disassembly override
offs_t os9_dasm_override(std::ostream &stream, offs_t pc, const util::disasm_interface::data_buffer &opcodes, const util::disasm_interface::data_buffer &params);
@@ -125,7 +121,7 @@ void positron_state::machine_start()
// select task 0
m_mmu.active_key = 0;
- m_fuse_timer = timer_alloc(TIMER_FUSE);
+ m_fuse_timer = timer_alloc(FUNC(positron_state::fuse_update), this);
m_fuse_timer->adjust(attotime::never);
m_fuse_timer_running = false;
m_irq_ack = false;
@@ -180,18 +176,11 @@ void positron_state::machine_reset()
}
-void positron_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(positron_state::fuse_update)
{
- switch (id)
- {
- case TIMER_FUSE:
- //m_mmu.active_key = m_mmu.operate_key;
- //m_mmu.sbit = false;
- m_fuse_timer->adjust(attotime::never);
- break;
- default:
- throw emu_fatalerror("Unknown id in positron_state::device_timer");
- }
+ //m_mmu.active_key = m_mmu.operate_key;
+ //m_mmu.sbit = false;
+ m_fuse_timer->adjust(attotime::never);
}
//-------------------------------------------------
diff --git a/src/mame/drivers/prof80.cpp b/src/mame/drivers/prof80.cpp
index 9a8d531226a..0a211bac96f 100644
--- a/src/mame/drivers/prof80.cpp
+++ b/src/mame/drivers/prof80.cpp
@@ -401,22 +401,18 @@ static void prof80_floppies(device_slot_interface &device)
//**************************************************************************
//-------------------------------------------------
-// device_timer - handler timer events
+// motor_off - disable the floppy motor after
+// a delay
//-------------------------------------------------
-void prof80_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(prof80_state::motor_off)
{
- switch (id)
- {
- case TIMER_ID_MOTOR:
- motor(1);
- break;
- }
+ motor(1);
}
//-------------------------------------------------
-// MACHINE_START( prof80 )
+// machine_start
//-------------------------------------------------
void prof80_state::machine_start()
@@ -426,7 +422,7 @@ void prof80_state::machine_start()
m_rtc->oe_w(1);
// create timer
- m_floppy_motor_off_timer = timer_alloc(TIMER_ID_MOTOR);
+ m_floppy_motor_off_timer = timer_alloc(FUNC(prof80_state::motor_off), this);
// register for state saving
save_item(NAME(m_motor));
@@ -441,7 +437,7 @@ void prof80_state::machine_start()
//**************************************************************************
//-------------------------------------------------
-// machine_config( prof80 )
+// machine_config
//-------------------------------------------------
void prof80_state::prof80(machine_config &config)
diff --git a/src/mame/drivers/ps2sony.cpp b/src/mame/drivers/ps2sony.cpp
index 49a5192b7d4..c1af2fc912e 100644
--- a/src/mame/drivers/ps2sony.cpp
+++ b/src/mame/drivers/ps2sony.cpp
@@ -537,7 +537,7 @@ void ps2sony_state::machine_start()
save_item(NAME(m_ipu_out_fifo_index));
if (!m_vblank_timer)
- m_vblank_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ps2sony_state::vblank), this));
+ m_vblank_timer = timer_alloc(FUNC(ps2sony_state::vblank), this);
}
void ps2sony_state::machine_reset()
diff --git a/src/mame/drivers/psion5.cpp b/src/mame/drivers/psion5.cpp
index 66f579fd57e..bdc2adc84d8 100644
--- a/src/mame/drivers/psion5.cpp
+++ b/src/mame/drivers/psion5.cpp
@@ -80,10 +80,10 @@ void psion5mx_state::machine_start()
save_item(NAME(m_ports));
- m_timers[0] = timer_alloc(TID_TIMER1);
- m_timers[1] = timer_alloc(TID_TIMER2);
- m_periodic = timer_alloc(TID_PERIODIC);
- m_rtc_ticker = timer_alloc(TID_RTC_TICKER);
+ m_timers[0] = timer_alloc(FUNC(psion5mx_state::update_timer1), this);
+ m_timers[1] = timer_alloc(FUNC(psion5mx_state::update_timer2), this);
+ m_periodic = timer_alloc(FUNC(psion5mx_state::update_periodic_irq), this);
+ m_rtc_ticker = timer_alloc(FUNC(psion5mx_state::update_rtc), this);
}
void psion5mx_state::machine_reset()
@@ -127,36 +127,37 @@ void psion5mx_state::check_interrupts()
m_maincpu->set_input_line(ARM7_IRQ_LINE, m_pending_ints & m_int_mask & IRQ_IRQ_MASK ? ASSERT_LINE : CLEAR_LINE);
}
-void psion5mx_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(psion5mx_state::update_timer1)
{
- switch (id)
+ update_timer(0);
+ if (BIT(m_buzzer_ctrl, 1))
{
- case TID_TIMER1:
- update_timer(0);
- if (BIT(m_buzzer_ctrl, 1))
- {
- m_speaker->level_w(BIT(m_timer_value[0], 15));
- }
- break;
- case TID_TIMER2:
- update_timer(1);
- break;
- case TID_PERIODIC:
- LOGMASKED(LOG_IRQ, "Flagging periodic IRQ\n");
- m_pending_ints |= (1 << IRQ_TINT);
- check_interrupts();
- break;
- case TID_RTC_TICKER:
- if ((m_pwrsr & 0x3f) == 0x3f)
- {
- m_rtc++;
- m_pwrsr &= ~0x3f;
- }
- else
- {
- m_pwrsr++;
- }
- break;
+ m_speaker->level_w(BIT(m_timer_value[0], 15));
+ }
+}
+
+TIMER_CALLBACK_MEMBER(psion5mx_state::update_timer2)
+{
+ update_timer(1);
+}
+
+TIMER_CALLBACK_MEMBER(psion5mx_state::update_periodic_irq)
+{
+ LOGMASKED(LOG_IRQ, "Flagging periodic IRQ\n");
+ m_pending_ints |= (1 << IRQ_TINT);
+ check_interrupts();
+}
+
+TIMER_CALLBACK_MEMBER(psion5mx_state::update_rtc)
+{
+ if ((m_pwrsr & 0x3f) == 0x3f)
+ {
+ m_rtc++;
+ m_pwrsr &= ~0x3f;
+ }
+ else
+ {
+ m_pwrsr++;
}
}
diff --git a/src/mame/drivers/ptcsol.cpp b/src/mame/drivers/ptcsol.cpp
index fecc200db48..3b427e2dc95 100644
--- a/src/mame/drivers/ptcsol.cpp
+++ b/src/mame/drivers/ptcsol.cpp
@@ -164,19 +164,22 @@ public:
void sol20(machine_config &config);
private:
- enum
- {
- TIMER_SOL20_CASSETTE_TC,
- };
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
+ void mem_map(address_map &map);
+ void io_map(address_map &map);
struct cass_data_t
{
- struct {
+ struct
+ {
int length = 0; /* time cassette level is at input.level */
int level = 0; /* cassette level */
int bit = 0; /* bit being read */
} input;
- struct {
+ struct
+ {
int length = 0; /* time cassette level is at output.level */
int level = 0; /* cassette level */
int bit = 0; /* bit to output */
@@ -195,12 +198,6 @@ private:
TIMER_CALLBACK_MEMBER(sol20_cassette_tc);
u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- void io_map(address_map &map);
- void mem_map(address_map &map);
-
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
- virtual void machine_reset() override;
- virtual void machine_start() override;
u8 m_sol20_fa = 0U;
u8 m_sol20_fc = 0U;
u8 m_sol20_fe = 0U;
@@ -243,19 +240,6 @@ cassette_image_device *sol20_state::cassette_device_image()
}
-void sol20_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_SOL20_CASSETTE_TC:
- sol20_cassette_tc(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in sol20_state::device_timer");
- }
-}
-
-
// identical to sorcerer
TIMER_CALLBACK_MEMBER(sol20_state::sol20_cassette_tc)
{
@@ -347,7 +331,7 @@ TIMER_CALLBACK_MEMBER(sol20_state::sol20_cassette_tc)
u8 sol20_state::sol20_f8_r()
{
-// d7 - TBMT; d6 - DAV; d5 - CTS; d4 - OE; d3 - PE; d2 - FE; d1 - DSR; d0 - CD
+ // d7 - TBMT; d6 - DAV; d5 - CTS; d4 - OE; d3 - PE; d2 - FE; d1 - DSR; d0 - CD
u8 data = 0;
m_uart_s->write_swe(0);
@@ -563,7 +547,7 @@ INPUT_PORTS_END
void sol20_state::machine_start()
{
- m_cassette_timer = timer_alloc(TIMER_SOL20_CASSETTE_TC);
+ m_cassette_timer = timer_alloc(FUNC(sol20_state::sol20_cassette_tc), this);
save_item(NAME(m_sol20_fa));
save_item(NAME(m_sol20_fc));
save_item(NAME(m_sol20_fe));
diff --git a/src/mame/drivers/pv1000.cpp b/src/mame/drivers/pv1000.cpp
index c8435a0d817..a100a0776db 100644
--- a/src/mame/drivers/pv1000.cpp
+++ b/src/mame/drivers/pv1000.cpp
@@ -386,8 +386,8 @@ void pv1000_state::pv1000_postload()
void pv1000_state::machine_start()
{
- m_irq_on_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pv1000_state::d65010_irq_on_cb),this));
- m_irq_off_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pv1000_state::d65010_irq_off_cb),this));
+ m_irq_on_timer = timer_alloc(FUNC(pv1000_state::d65010_irq_on_cb), this);
+ m_irq_off_timer = timer_alloc(FUNC(pv1000_state::d65010_irq_off_cb), this);
m_gfxram = memregion("gfxram")->base();
save_pointer(NAME(m_gfxram), 0x400);
diff --git a/src/mame/drivers/pwrview.cpp b/src/mame/drivers/pwrview.cpp
index 604f2336bb9..75a02aa778c 100644
--- a/src/mame/drivers/pwrview.cpp
+++ b/src/mame/drivers/pwrview.cpp
@@ -35,6 +35,12 @@ public:
void pwrview(machine_config &config);
private:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
+ TIMER_CALLBACK_MEMBER(update_tmr0);
+ TIMER_CALLBACK_MEMBER(update_kbd);
+
u16 bank0_r(offs_t offset);
void bank0_w(offs_t offset, u16 data, u16 mem_mask = ~0);
u8 unk1_r();
@@ -65,10 +71,6 @@ private:
void pwrview_io(address_map &map);
void pwrview_map(address_map &map);
- virtual void device_start() override;
- virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
required_device<i80186_cpu_device> m_maincpu;
required_device<pit8253_device> m_pit;
required_device<i8251_device> m_uart;
@@ -77,26 +79,29 @@ private:
required_device<address_map_bank_device> m_biosbank;
std::vector<u16> m_vram;
u8 m_leds[2];
- u8 m_switch, m_c001, m_c009, m_c280, m_c080, m_errcode, m_vramwin[2];
- bool m_dtr, m_rts;
+ u8 m_switch;
+ u8 m_c001;
+ u8 m_c009;
+ u8 m_c280;
+ u8 m_c080;
+ u8 m_errcode;
+ u8 m_vramwin[2];
+ bool m_dtr;
+ bool m_rts;
emu_timer *m_tmr0ext;
emu_timer *m_tmrkbd;
- enum {
- TMR0_TIMER,
- KBD_TIMER
- };
};
-void pwrview_state::device_start()
+void pwrview_state::machine_start()
{
save_item(NAME(m_vram));
- m_tmr0ext = timer_alloc(TMR0_TIMER);
- m_tmrkbd = timer_alloc(KBD_TIMER);
+ m_tmr0ext = timer_alloc(FUNC(pwrview_state::update_tmr0), this);
+ m_tmrkbd = timer_alloc(FUNC(pwrview_state::update_kbd), this);
membank("vram1")->configure_entries(0, 0x400, &m_vram[0], 0x80);
membank("vram2")->configure_entries(0, 0x400, &m_vram[0], 0x80);
}
-void pwrview_state::device_reset()
+void pwrview_state::machine_reset()
{
m_leds[0] = m_leds[1] = 0;
m_switch = 0xe0;
@@ -110,21 +115,18 @@ void pwrview_state::device_reset()
m_tmrkbd->adjust(attotime::from_hz(9600*16), 0, attotime::from_hz(9600*16)); // kbd baud is guess
}
-void pwrview_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(pwrview_state::update_tmr0)
{
- switch(id)
- {
- case TMR0_TIMER:
- m_maincpu->tmrin0_w(ASSERT_LINE);
- m_maincpu->tmrin0_w(CLEAR_LINE);
- break;
- case KBD_TIMER:
- m_uart->write_rxc(ASSERT_LINE);
- m_uart->write_txc(ASSERT_LINE);
- m_uart->write_rxc(CLEAR_LINE);
- m_uart->write_txc(CLEAR_LINE);
- break;
- }
+ m_maincpu->tmrin0_w(ASSERT_LINE);
+ m_maincpu->tmrin0_w(CLEAR_LINE);
+}
+
+TIMER_CALLBACK_MEMBER(pwrview_state::update_kbd)
+{
+ m_uart->write_rxc(ASSERT_LINE);
+ m_uart->write_txc(ASSERT_LINE);
+ m_uart->write_rxc(CLEAR_LINE);
+ m_uart->write_txc(CLEAR_LINE);
}
MC6845_UPDATE_ROW(pwrview_state::update_row)
diff --git a/src/mame/drivers/qdrmfgp.cpp b/src/mame/drivers/qdrmfgp.cpp
index 72c2b47804f..3bd60a7d6c2 100644
--- a/src/mame/drivers/qdrmfgp.cpp
+++ b/src/mame/drivers/qdrmfgp.cpp
@@ -504,7 +504,7 @@ MACHINE_START_MEMBER(qdrmfgp_state,qdrmfgp)
MACHINE_START_MEMBER(qdrmfgp_state,qdrmfgp2)
{
/* sound irq (CCU? 240Hz) */
- m_gp2_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(qdrmfgp_state::gp2_timer_callback), this));
+ m_gp2_timer = timer_alloc(FUNC(qdrmfgp_state::gp2_timer_callback), this);
m_gp2_timer->adjust(attotime::from_hz(XTAL(18'432'000)/76800), 0, attotime::from_hz(XTAL(18'432'000)/76800));
MACHINE_START_CALL_MEMBER( qdrmfgp );
diff --git a/src/mame/drivers/rabbit.cpp b/src/mame/drivers/rabbit.cpp
index 9f2d98140e6..f726f96ce4e 100644
--- a/src/mame/drivers/rabbit.cpp
+++ b/src/mame/drivers/rabbit.cpp
@@ -116,9 +116,12 @@ public:
void rabbit(machine_config &config);
- void init_rabbit();
-
private:
+ virtual void machine_start() override;
+ virtual void video_start() override;
+
+ TIMER_CALLBACK_MEMBER(blit_done);
+
void tilemap0_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
void tilemap1_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
void tilemap2_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
@@ -134,9 +137,6 @@ private:
void rabbit_map(address_map &map);
- virtual void video_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
required_device<cpu_device> m_maincpu;
required_device<eeprom_serial_93cxx_device> m_eeprom;
required_device<gfxdecode_device> m_gfxdecode;
@@ -177,6 +177,13 @@ private:
void do_blit();
};
+void rabbit_state::machine_start()
+{
+ m_banking = 1;
+ m_vblirqlevel = 6;
+ m_bltirqlevel = 4;
+ /* 5 and 1 are also valid and might be raster related */
+}
/* call with tilesize = 0 for 8x8 or 1 for 16x16 */
void rabbit_state::get_tilemap_info(tile_data &tileinfo, int tile_index, int whichtilemap, int tilesize)
@@ -432,7 +439,7 @@ void rabbit_state::video_start()
m_sprite_bitmap = std::make_unique<bitmap_ind16>(0x1000,0x1000);
m_sprite_clip.set(0, 0x1000-1, 0, 0x1000-1);
- m_blit_done_timer = timer_alloc(TIMER_BLIT_DONE);
+ m_blit_done_timer = timer_alloc(FUNC(rabbit_state::blit_done), this);
save_pointer(NAME(m_tilemap_ram[0]), 0x20000/4);
save_pointer(NAME(m_tilemap_ram[1]), 0x20000/4);
@@ -570,16 +577,9 @@ void rabbit_state::rombank_w(uint32_t data)
#define BLITCMDLOG 0
#define BLITLOG 0
-void rabbit_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(rabbit_state::blit_done)
{
- switch (id)
- {
- case TIMER_BLIT_DONE:
- m_maincpu->set_input_line(m_bltirqlevel, HOLD_LINE);
- break;
- default:
- throw emu_fatalerror("Unknown id in rabbit_state::device_timer");
- }
+ m_maincpu->set_input_line(m_bltirqlevel, HOLD_LINE);
}
void rabbit_state::do_blit()
@@ -913,16 +913,6 @@ void rabbit_state::rabbit(machine_config &config)
-void rabbit_state::init_rabbit()
-{
- m_banking = 1;
- m_vblirqlevel = 6;
- m_bltirqlevel = 4;
- /* 5 and 1 are also valid and might be raster related */
-}
-
-
-
ROM_START( rabbit ) // This is the Asian version sold in Korea but the devs forgot to update the region disclaimer.
ROM_REGION( 0x200000, "maincpu", 0 ) /* 68020 Code */
ROM_LOAD32_BYTE( "jpr0.0", 0x000000, 0x080000, CRC(52bb18c0) SHA1(625bc8a4daa6d08cacd92d9110cf67a95a91325a) )
@@ -1099,7 +1089,7 @@ ROM_START( rabbitjt )
ROM_LOAD( "epm7032.u1", 0x0000, 0x0798, CRC(bb1c930e) SHA1(7513ed6a0d797276dab1e3446fe346a9c340e69d) ) // unprotected
ROM_END
-GAME( 1997, rabbit, 0, rabbit, rabbit, rabbit_state, init_rabbit, ROT0, "Aorn / Electronic Arts", "Rabbit (Asia 3/6)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) // For use in Japan notice, English text, (C) 1997
-GAME( 1996, rabbita, rabbit, rabbit, rabbit, rabbit_state, init_rabbit, ROT0, "Aorn / Electronic Arts", "Rabbit (Asia 1/28?)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) // For use in Japan notice, English text, (C) 1996
-GAME( 1997, rabbitj, rabbit, rabbit, rabbit, rabbit_state, init_rabbit, ROT0, "Aorn / Electronic Arts", "Rabbit (Japan 3/6?)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) // For use in Japan notice, Japanese text, (C) 1997
-GAME( 1996, rabbitjt, rabbit, rabbit, rabbit, rabbit_state, init_rabbit, ROT0, "Aorn / Electronic Arts", "Rabbit (Japan 1/28, location test)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) // For use in Japan notice, Japanese text, (C) 1996
+GAME( 1997, rabbit, 0, rabbit, rabbit, rabbit_state, empty_init, ROT0, "Aorn / Electronic Arts", "Rabbit (Asia 3/6)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) // For use in Japan notice, English text, (C) 1997
+GAME( 1996, rabbita, rabbit, rabbit, rabbit, rabbit_state, empty_init, ROT0, "Aorn / Electronic Arts", "Rabbit (Asia 1/28?)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) // For use in Japan notice, English text, (C) 1996
+GAME( 1997, rabbitj, rabbit, rabbit, rabbit, rabbit_state, empty_init, ROT0, "Aorn / Electronic Arts", "Rabbit (Japan 3/6?)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) // For use in Japan notice, Japanese text, (C) 1997
+GAME( 1996, rabbitjt, rabbit, rabbit, rabbit, rabbit_state, empty_init, ROT0, "Aorn / Electronic Arts", "Rabbit (Japan 1/28, location test)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) // For use in Japan notice, Japanese text, (C) 1996
diff --git a/src/mame/drivers/rainbow.cpp b/src/mame/drivers/rainbow.cpp
index 501b3ccab38..242c289fb7d 100644
--- a/src/mame/drivers/rainbow.cpp
+++ b/src/mame/drivers/rainbow.cpp
@@ -508,7 +508,9 @@ public:
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(command_tick);
+ TIMER_CALLBACK_MEMBER(switch_off_tick);
void rainbow8088_base_map(address_map &map);
void rainbow8088_base_io(address_map &map);
@@ -890,10 +892,10 @@ static void rainbow_floppies(device_slot_interface &device)
void rainbow_base_state::machine_start()
{
m_power_good = false; // Simulate AC_OK signal from power supply.
- cmd_timer = timer_alloc(0);
+ cmd_timer = timer_alloc(FUNC(rainbow_base_state::command_tick), this);
cmd_timer->adjust(attotime::from_msec(MS_TO_POWER_GOOD));
- switch_off_timer = timer_alloc(1);
+ switch_off_timer = timer_alloc(FUNC(rainbow_base_state::switch_off_tick), this);
switch_off_timer->adjust(attotime::from_msec(10));
m_digits.resolve();
@@ -1278,40 +1280,29 @@ void rainbow_modelb_state::machine_reset()
}
// Simulate AC_OK signal (power good) and RESET after ~ 108 ms.
-void rainbow_base_state::device_timer(emu_timer &timer, device_timer_id tid, int param)
+TIMER_CALLBACK_MEMBER(rainbow_base_state::command_tick)
{
- switch (tid)
+ if (m_power_good == false)
{
- case 0:
- cmd_timer->adjust(attotime::never);
-
- if (m_power_good == false)
- {
- m_power_good = true;
- logerror("**** POWER GOOD ****\n");
- }
- else
- {
- logerror("**** WATCHDOG: CPU RESET ****\n");
- m_i8088->reset(); // gives 'ERROR_16 - INTERRUPTS OFF' (indicates hardware failure or software bug).
- }
- break; // case 0
-
- case 1:
-
- switch_off_timer->adjust(attotime::never);
-
- m_driveleds[0] = 0; // DRIVE 0 (A)
- m_driveleds[1] = 0; // DRIVE 1 (B)
- m_driveleds[2] = 0; // DRIVE 2 (C)
- m_driveleds[3] = 0; // DRIVE 3 (D)
-
- m_leds[0] = 1; // 1 = OFF (One of the CPU LEDs as drive LED for DEC hard disk)
- m_leds[1] = 1; // 1 = OFF (One of the CPU LEDs as drive LED for Corvus HD)
+ m_power_good = true;
+ logerror("**** POWER GOOD ****\n");
+ }
+ else
+ {
+ logerror("**** WATCHDOG: CPU RESET ****\n");
+ m_i8088->reset(); // gives 'ERROR_16 - INTERRUPTS OFF' (indicates hardware failure or software bug).
+ }
+}
- break; // case 1
+TIMER_CALLBACK_MEMBER(rainbow_base_state::switch_off_tick)
+{
+ m_driveleds[0] = 0; // DRIVE 0 (A)
+ m_driveleds[1] = 0; // DRIVE 1 (B)
+ m_driveleds[2] = 0; // DRIVE 2 (C)
+ m_driveleds[3] = 0; // DRIVE 3 (D)
- } // switch (timer ID)
+ m_leds[0] = 1; // 1 = OFF (One of the CPU LEDs as drive LED for DEC hard disk)
+ m_leds[1] = 1; // 1 = OFF (One of the CPU LEDs as drive LED for Corvus HD)
}
uint32_t rainbow_base_state::screen_update_rainbow(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
diff --git a/src/mame/drivers/rastersp.cpp b/src/mame/drivers/rastersp.cpp
index 05ee8b417cc..4b42f285fb9 100644
--- a/src/mame/drivers/rastersp.cpp
+++ b/src/mame/drivers/rastersp.cpp
@@ -250,10 +250,10 @@ void rastersp_state::machine_start()
//membank("bank3")->set_base(&m_dram[0x300000/4]);
if (!m_tms_timer1)
- m_tms_timer1 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(rastersp_state::tms_timer1), this));
+ m_tms_timer1 = timer_alloc(FUNC(rastersp_state::tms_timer1), this);
if (!m_tms_tx_timer)
- m_tms_tx_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(rastersp_state::tms_tx_timer), this));
+ m_tms_tx_timer = timer_alloc(FUNC(rastersp_state::tms_tx_timer), this);
#if USE_SPEEDUP_HACK
m_dsp->space(AS_PROGRAM).install_read_handler(0x809923, 0x809923, read32smo_delegate(*this, FUNC(rastersp_state::dsp_speedup_r)));
@@ -278,7 +278,7 @@ void fbcrazy_state::machine_start()
{
rastersp_state::machine_start();
- m_trackball_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(fbcrazy_state::trackball_timer), this));
+ m_trackball_timer = timer_alloc(FUNC(fbcrazy_state::trackball_timer), this);
save_item(NAME(m_aux_port3_data));
save_item(NAME(m_trackball_ctr));
diff --git a/src/mame/drivers/rltennis.cpp b/src/mame/drivers/rltennis.cpp
index f082dc18b26..15ee5131c2f 100644
--- a/src/mame/drivers/rltennis.cpp
+++ b/src/mame/drivers/rltennis.cpp
@@ -160,7 +160,7 @@ INTERRUPT_GEN_MEMBER(rltennis_state::interrupt)
void rltennis_state::machine_start()
{
- m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(rltennis_state::sample_player),this));
+ m_timer = timer_alloc(FUNC(rltennis_state::sample_player), this);
save_item(NAME(m_data760000));
save_item(NAME(m_data740000));
diff --git a/src/mame/drivers/rollerg.cpp b/src/mame/drivers/rollerg.cpp
index 7ee72145885..20ba0ea1261 100644
--- a/src/mame/drivers/rollerg.cpp
+++ b/src/mame/drivers/rollerg.cpp
@@ -24,7 +24,7 @@
#include "speaker.h"
-void rollerg_state::rollerg_0010_w(uint8_t data)
+void rollerg_state::ext_enable_w(uint8_t data)
{
logerror("%04x: write %02x to 0010\n",m_maincpu->pc(), data);
@@ -41,7 +41,7 @@ void rollerg_state::rollerg_0010_w(uint8_t data)
/* other bits unknown */
}
-uint8_t rollerg_state::rollerg_k051316_r(offs_t offset)
+uint8_t rollerg_state::k051316_r(offs_t offset)
{
if (m_readzoomroms)
return m_k051316->rom_r(offset);
@@ -54,16 +54,9 @@ void rollerg_state::soundirq_w(uint8_t data)
m_audiocpu->set_input_line_and_vector(0, HOLD_LINE, 0xff); // Z80
}
-void rollerg_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(rollerg_state::sound_nmi)
{
- switch (id)
- {
- case TIMER_NMI:
- m_audiocpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
- break;
- default:
- throw emu_fatalerror("Unknown id in rollerg_state::device_timer");
- }
+ m_audiocpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
}
void rollerg_state::sound_arm_nmi_w(uint8_t data)
@@ -77,9 +70,9 @@ uint8_t rollerg_state::pip_r()
return 0x7f;
}
-void rollerg_state::rollerg_map(address_map &map)
+void rollerg_state::main_map(address_map &map)
{
- map(0x0010, 0x0010).w(FUNC(rollerg_state::rollerg_0010_w));
+ map(0x0010, 0x0010).w(FUNC(rollerg_state::ext_enable_w));
map(0x0020, 0x0020).rw("watchdog", FUNC(watchdog_timer_device::reset_r), FUNC(watchdog_timer_device::reset_w));
map(0x0030, 0x0031).rw("k053260", FUNC(k053260_device::main_read), FUNC(k053260_device::main_write));
map(0x0040, 0x0040).w(FUNC(rollerg_state::soundirq_w));
@@ -92,7 +85,7 @@ void rollerg_state::rollerg_map(address_map &map)
map(0x0100, 0x010f).rw(m_k053252, FUNC(k053252_device::read), FUNC(k053252_device::write)); /* 053252? */
map(0x0200, 0x020f).w(m_k051316, FUNC(k051316_device::ctrl_w));
map(0x0300, 0x030f).rw(m_k053244, FUNC(k05324x_device::k053244_r), FUNC(k05324x_device::k053244_w));
- map(0x0800, 0x0fff).r(FUNC(rollerg_state::rollerg_k051316_r)).w(m_k051316, FUNC(k051316_device::write));
+ map(0x0800, 0x0fff).r(FUNC(rollerg_state::k051316_r)).w(m_k051316, FUNC(k051316_device::write));
map(0x1000, 0x17ff).rw(m_k053244, FUNC(k05324x_device::k053245_r), FUNC(k05324x_device::k053245_w));
map(0x1800, 0x1fff).ram().w("palette", FUNC(palette_device::write8)).share("palette");
map(0x2000, 0x3aff).ram();
@@ -100,7 +93,7 @@ void rollerg_state::rollerg_map(address_map &map)
map(0x8000, 0xffff).rom();
}
-void rollerg_state::rollerg_sound_map(address_map &map)
+void rollerg_state::sound_map(address_map &map)
{
map(0x0000, 0x7fff).rom();
map(0x8000, 0x87ff).ram();
@@ -228,7 +221,7 @@ void rollerg_state::machine_start()
membank("bank1")->configure_entries(6, 2, &ROM[0x10000], 0x4000);
membank("bank1")->set_entry(0);
- m_nmi_timer = timer_alloc(TIMER_NMI);
+ m_nmi_timer = timer_alloc(FUNC(rollerg_state::sound_nmi), this);
save_item(NAME(m_readzoomroms));
}
@@ -247,12 +240,12 @@ void rollerg_state::rollerg(machine_config &config)
{
/* basic machine hardware */
KONAMI(config, m_maincpu, 3000000); /* ? */
- m_maincpu->set_addrmap(AS_PROGRAM, &rollerg_state::rollerg_map);
+ m_maincpu->set_addrmap(AS_PROGRAM, &rollerg_state::main_map);
m_maincpu->set_vblank_int("screen", FUNC(rollerg_state::irq0_line_assert));
m_maincpu->line().set(FUNC(rollerg_state::banking_callback));
Z80(config, m_audiocpu, 3579545);
- m_audiocpu->set_addrmap(AS_PROGRAM, &rollerg_state::rollerg_sound_map); /* NMIs are generated by the 053260 */
+ m_audiocpu->set_addrmap(AS_PROGRAM, &rollerg_state::sound_map); /* NMIs are generated by the 053260 */
WATCHDOG_TIMER(config, "watchdog");
@@ -262,7 +255,7 @@ void rollerg_state::rollerg(machine_config &config)
screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); /* not accurate */
screen.set_size(64*8, 32*8);
screen.set_visarea(14*8, (64-14)*8-1, 2*8, 30*8-1);
- screen.set_screen_update(FUNC(rollerg_state::screen_update_rollerg));
+ screen.set_screen_update(FUNC(rollerg_state::screen_update));
screen.set_palette("palette");
PALETTE(config, "palette").set_format(palette_device::xBGR_555, 1024).enable_shadows();
diff --git a/src/mame/drivers/runaway.cpp b/src/mame/drivers/runaway.cpp
index 2c56db77c41..b1640603a0d 100644
--- a/src/mame/drivers/runaway.cpp
+++ b/src/mame/drivers/runaway.cpp
@@ -122,7 +122,7 @@ TIMER_CALLBACK_MEMBER(qwak_state::interrupt_callback)
void qwak_state::machine_start()
{
- m_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(runaway_state::interrupt_callback),this));
+ m_interrupt_timer = timer_alloc(FUNC(runaway_state::interrupt_callback), this);
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(qwak_state::get_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 30);
}
diff --git a/src/mame/drivers/s11.cpp b/src/mame/drivers/s11.cpp
index 49ce6e58e7b..a81ad390295 100644
--- a/src/mame/drivers/s11.cpp
+++ b/src/mame/drivers/s11.cpp
@@ -159,37 +159,32 @@ static INPUT_PORTS_START( s11 )
PORT_CONFSETTING( 0x10, "English" )
INPUT_PORTS_END
-void s11_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(s11_state::irq_timer)
{
- switch(id)
+ // handle the cd4020 14-bit timer irq counter; this timer fires on the rising and falling edges of Q5, every 32 clocks
+ m_timer_count += 0x20;
+ m_timer_count &= 0x3fff;
+ // handle the reset case (happens on the high level of Eclock, so supersedes the firing of the timer int)
+ if (BIT(m_timer_count, 5) && (m_timer_irq_active || m_pia_irq_active))
+ {
+ m_timer_count = 0;
+ m_timer_irq_active = false;
+ }
+ else // handle the timer int firing case
{
- case TIMER_IRQ:
- // handle the cd4020 14-bit timer irq counter; this timer fires on the rising and falling edges of Q5, every 32 clocks
- m_timer_count += 0x20;
- m_timer_count &= 0x3fff;
- // handle the reset case (happens on the high level of Eclock, so supersedes the firing of the timer int)
- if (BIT(m_timer_count, 5) && (m_timer_irq_active || m_pia_irq_active))
- {
- m_timer_count = 0;
- m_timer_irq_active = false;
- }
- else // handle the timer int firing case
- {
#ifndef S11_W15
- // W14 jumper present (Q7), W15 absent (Q10)
- m_timer_irq_active = (BIT(m_timer_count, 7, 3) == 7);
+ // W14 jumper present (Q7), W15 absent (Q10)
+ m_timer_irq_active = (BIT(m_timer_count, 7, 3) == 7);
#else
- // W14 jumper absent (Q7), W15 present (Q10)
- m_timer_irq_active = (BIT(m_timer_count, 8, 3) == 7);
+ // W14 jumper absent (Q7), W15 present (Q10)
+ m_timer_irq_active = (BIT(m_timer_count, 8, 3) == 7);
#endif
- }
-
- m_mainirq->in_w<0>(m_timer_irq_active);
- if(m_pias)
- m_pias->cb1_w(m_timer_irq_active);
- m_irq_timer->adjust(attotime::from_ticks(32,E_CLOCK),0);
- break;
}
+
+ m_mainirq->in_w<0>(m_timer_irq_active);
+ if (m_pias)
+ m_pias->cb1_w(m_timer_irq_active);
+ m_irq_timer->adjust(attotime::from_ticks(32,E_CLOCK),0);
}
INPUT_CHANGED_MEMBER( s11_state::main_nmi )
@@ -408,8 +403,8 @@ void s11_state::machine_start()
save_item(NAME(m_row));
save_item(NAME(m_lamp_data));
- m_irq_timer = timer_alloc(TIMER_IRQ);
- m_irq_timer->adjust(attotime::from_ticks(980,1e6),1);
+ m_irq_timer = timer_alloc(FUNC(s11_state::irq_timer), this);
+ m_irq_timer->adjust(attotime::from_ticks(32,E_CLOCK),0);
}
void s11_state::machine_reset()
@@ -429,8 +424,6 @@ void s11_state::init_s11()
membank("bank1")->configure_entries(0, 2, &ROM[0x8000], 0x4000);
membank("bank0")->set_entry(0);
membank("bank1")->set_entry(0);
- m_irq_timer = timer_alloc(TIMER_IRQ);
- m_irq_timer->adjust(attotime::from_ticks(32,E_CLOCK),0);
}
void s11_state::s11(machine_config &config)
diff --git a/src/mame/drivers/s11c.cpp b/src/mame/drivers/s11c.cpp
index 554402d8024..d935b721d4d 100644
--- a/src/mame/drivers/s11c.cpp
+++ b/src/mame/drivers/s11c.cpp
@@ -145,10 +145,7 @@ void s11c_state::machine_reset()
void s11c_state::init_s11c()
{
- emu_timer* timer = timer_alloc(TIMER_IRQ);
set_invert(true);
- set_timer(timer);
- timer->adjust(attotime::from_ticks(32,E_CLOCK),0);
}
void s11c_state::init_s11c7()
diff --git a/src/mame/drivers/s6.cpp b/src/mame/drivers/s6.cpp
index 567601d4dfe..f325a78248e 100644
--- a/src/mame/drivers/s6.cpp
+++ b/src/mame/drivers/s6.cpp
@@ -95,7 +95,8 @@ public:
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(irq_timer);
private:
void dig0_w(u8 data);
@@ -124,7 +125,7 @@ private:
bool m_data_ok = false;
u8 m_lamp_data = 0;
emu_timer* m_irq_timer = nullptr;
- static const device_timer_id TIMER_IRQ = 0;
+
required_device<cpu_device> m_maincpu;
required_device<williams_s6_sound_device> m_s6sound;
required_device<pia6821_device> m_pia22;
@@ -440,7 +441,7 @@ void s6_state::machine_start()
save_item(NAME(m_data_ok));
save_item(NAME(m_lamp_data));
- m_irq_timer = timer_alloc(TIMER_IRQ);
+ m_irq_timer = timer_alloc(FUNC(s6_state::irq_timer), this);
m_irq_timer->adjust(attotime::from_ticks(980,3580000/4),1);
}
@@ -451,26 +452,21 @@ void s6_state::machine_reset()
m_io_outputs[i] = 0;
}
-void s6_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(s6_state::irq_timer)
{
- switch(id)
+ if(param == 1)
+ {
+ m_maincpu->set_input_line(M6808_IRQ_LINE, ASSERT_LINE);
+ m_irq_timer->adjust(attotime::from_ticks(32,3580000/4),0);
+ m_pia28->ca1_w(BIT(ioport("DIAGS")->read(), 2)); // Advance
+ m_pia28->cb1_w(BIT(ioport("DIAGS")->read(), 3)); // Up/Down
+ }
+ else
{
- case TIMER_IRQ:
- if(param == 1)
- {
- m_maincpu->set_input_line(M6808_IRQ_LINE, ASSERT_LINE);
- m_irq_timer->adjust(attotime::from_ticks(32,3580000/4),0);
- m_pia28->ca1_w(BIT(ioport("DIAGS")->read(), 2)); // Advance
- m_pia28->cb1_w(BIT(ioport("DIAGS")->read(), 3)); // Up/Down
- }
- else
- {
- m_maincpu->set_input_line(M6808_IRQ_LINE, CLEAR_LINE);
- m_irq_timer->adjust(attotime::from_ticks(980,3580000/4),1);
- m_pia28->ca1_w(1);
- m_pia28->cb1_w(1);
- }
- break;
+ m_maincpu->set_input_line(M6808_IRQ_LINE, CLEAR_LINE);
+ m_irq_timer->adjust(attotime::from_ticks(980,3580000/4),1);
+ m_pia28->ca1_w(1);
+ m_pia28->cb1_w(1);
}
}
diff --git a/src/mame/drivers/s7.cpp b/src/mame/drivers/s7.cpp
index ae674f92c9b..34c667092f3 100644
--- a/src/mame/drivers/s7.cpp
+++ b/src/mame/drivers/s7.cpp
@@ -115,7 +115,8 @@ public:
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(irq_timer);
private:
void dig0_w(u8 data);
@@ -153,7 +154,7 @@ private:
bool m_memprotect = false;
u8 m_game = 0U;
emu_timer* m_irq_timer = nullptr;
- static const device_timer_id TIMER_IRQ = 0;
+
required_device<cpu_device> m_maincpu;
required_device<williams_s6_sound_device> m_s6sound;
required_device<pia6821_device> m_pia21;
@@ -624,26 +625,21 @@ WRITE_LINE_MEMBER( s7_state::pia_irq )
}
}
-void s7_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(s7_state::irq_timer)
{
- switch(id)
+ if(param == 1)
+ {
+ m_maincpu->set_input_line(M6808_IRQ_LINE, ASSERT_LINE);
+ m_irq_timer->adjust(attotime::from_ticks(32,3580000/4),0);
+ m_pia28->ca1_w(BIT(ioport("DIAGS")->read(), 2)); // Advance
+ m_pia28->cb1_w(BIT(ioport("DIAGS")->read(), 3)); // Up/Down
+ }
+ else
{
- case TIMER_IRQ:
- if(param == 1)
- {
- m_maincpu->set_input_line(M6808_IRQ_LINE, ASSERT_LINE);
- m_irq_timer->adjust(attotime::from_ticks(32,3580000/4),0);
- m_pia28->ca1_w(BIT(ioport("DIAGS")->read(), 2)); // Advance
- m_pia28->cb1_w(BIT(ioport("DIAGS")->read(), 3)); // Up/Down
- }
- else
- {
- m_maincpu->set_input_line(M6808_IRQ_LINE, CLEAR_LINE);
- m_irq_timer->adjust(attotime::from_ticks(980,3580000/4),1);
- m_pia28->ca1_w(1);
- m_pia28->cb1_w(1);
- }
- break;
+ m_maincpu->set_input_line(M6808_IRQ_LINE, CLEAR_LINE);
+ m_irq_timer->adjust(attotime::from_ticks(980,3580000/4),1);
+ m_pia28->ca1_w(1);
+ m_pia28->cb1_w(1);
}
}
@@ -662,7 +658,7 @@ void s7_state::machine_start()
save_item(NAME(m_game));
save_item(NAME(m_comma));
- m_irq_timer = timer_alloc(TIMER_IRQ);
+ m_irq_timer = timer_alloc(FUNC(s7_state::irq_timer), this);
m_irq_timer->adjust(attotime::from_ticks(980,3580000/4),1);
subdevice<nvram_device>("nvram")->set_base(m_nvram, sizeof(m_nvram));
}
diff --git a/src/mame/drivers/s8.cpp b/src/mame/drivers/s8.cpp
index ab1541b6e49..891c30b868e 100644
--- a/src/mame/drivers/s8.cpp
+++ b/src/mame/drivers/s8.cpp
@@ -155,7 +155,8 @@ public:
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(irq_timer);
private:
u8 sound_r();
@@ -189,7 +190,7 @@ private:
bool m_data_ok = false;
u8 m_lamp_data = 0U;
emu_timer* m_irq_timer = nullptr;
- static const device_timer_id TIMER_IRQ = 0;
+
required_device<m6802_cpu_device> m_maincpu;
optional_device<cpu_device> m_audiocpu;
optional_device<pia6821_device> m_pias;
@@ -519,26 +520,21 @@ WRITE_LINE_MEMBER( s8_state::pia_irq )
}
}
-void s8_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(s8_state::irq_timer)
{
- switch(id)
+ if(param == 1)
+ {
+ m_maincpu->set_input_line(M6802_IRQ_LINE, ASSERT_LINE);
+ m_irq_timer->adjust(attotime::from_ticks(32,1e6),0);
+ m_pia28->ca1_w(BIT(ioport("DIAGS")->read(), 2)); // Advance
+ m_pia28->cb1_w(BIT(ioport("DIAGS")->read(), 3)); // Up/Down
+ }
+ else
{
- case TIMER_IRQ:
- if(param == 1)
- {
- m_maincpu->set_input_line(M6802_IRQ_LINE, ASSERT_LINE);
- m_irq_timer->adjust(attotime::from_ticks(32,1e6),0);
- m_pia28->ca1_w(BIT(ioport("DIAGS")->read(), 2)); // Advance
- m_pia28->cb1_w(BIT(ioport("DIAGS")->read(), 3)); // Up/Down
- }
- else
- {
- m_maincpu->set_input_line(M6802_IRQ_LINE, CLEAR_LINE);
- m_irq_timer->adjust(attotime::from_ticks(980,1e6),1);
- m_pia28->ca1_w(1);
- m_pia28->cb1_w(1);
- }
- break;
+ m_maincpu->set_input_line(M6802_IRQ_LINE, CLEAR_LINE);
+ m_irq_timer->adjust(attotime::from_ticks(980,1e6),1);
+ m_pia28->ca1_w(1);
+ m_pia28->cb1_w(1);
}
}
@@ -558,7 +554,7 @@ void s8_state::machine_start()
save_item(NAME(m_comma12));
save_item(NAME(m_comma34));
- m_irq_timer = timer_alloc(TIMER_IRQ);
+ m_irq_timer = timer_alloc(FUNC(s8_state::irq_timer), this);
m_irq_timer->adjust(attotime::from_ticks(980,1e6),1);
}
diff --git a/src/mame/drivers/s9.cpp b/src/mame/drivers/s9.cpp
index f43f1e1777d..fede832b032 100644
--- a/src/mame/drivers/s9.cpp
+++ b/src/mame/drivers/s9.cpp
@@ -70,7 +70,8 @@ public:
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(irq_timer);
private:
void dig0_w(u8 data);
@@ -97,7 +98,7 @@ private:
bool m_data_ok = false;
u8 m_lamp_data = 0U;
emu_timer* m_irq_timer = nullptr;
- static const device_timer_id TIMER_IRQ = 0;
+
required_device<cpu_device> m_maincpu;
required_device<williams_s9_sound_device> m_s9sound;
required_device<pia6821_device> m_pia21;
@@ -307,26 +308,21 @@ WRITE_LINE_MEMBER( s9_state::pia_irq )
}
}
-void s9_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(s9_state::irq_timer)
{
- switch(id)
+ if(param == 1)
+ {
+ m_maincpu->set_input_line(M6808_IRQ_LINE, ASSERT_LINE);
+ m_irq_timer->adjust(attotime::from_ticks(32,1e6),0);
+ m_pia28->ca1_w(BIT(ioport("DIAGS")->read(), 2)); // Advance
+ m_pia28->cb1_w(BIT(ioport("DIAGS")->read(), 3)); // Up/Down
+ }
+ else
{
- case TIMER_IRQ:
- if(param == 1)
- {
- m_maincpu->set_input_line(M6808_IRQ_LINE, ASSERT_LINE);
- m_irq_timer->adjust(attotime::from_ticks(32,1e6),0);
- m_pia28->ca1_w(BIT(ioport("DIAGS")->read(), 2)); // Advance
- m_pia28->cb1_w(BIT(ioport("DIAGS")->read(), 3)); // Up/Down
- }
- else
- {
- m_maincpu->set_input_line(M6808_IRQ_LINE, CLEAR_LINE);
- m_irq_timer->adjust(attotime::from_ticks(980,1e6),1);
- m_pia28->ca1_w(1);
- m_pia28->cb1_w(1);
- }
- break;
+ m_maincpu->set_input_line(M6808_IRQ_LINE, CLEAR_LINE);
+ m_irq_timer->adjust(attotime::from_ticks(980,1e6),1);
+ m_pia28->ca1_w(1);
+ m_pia28->cb1_w(1);
}
}
@@ -343,7 +339,7 @@ void s9_state::machine_start()
save_item(NAME(m_comma12));
save_item(NAME(m_comma34));
- m_irq_timer = timer_alloc(TIMER_IRQ);
+ m_irq_timer = timer_alloc(FUNC(s9_state::irq_timer), this);
m_irq_timer->adjust(attotime::from_ticks(980,1e6),1);
}
diff --git a/src/mame/drivers/saitek_mark5.cpp b/src/mame/drivers/saitek_mark5.cpp
index 35139268aba..0c68a64f820 100644
--- a/src/mame/drivers/saitek_mark5.cpp
+++ b/src/mame/drivers/saitek_mark5.cpp
@@ -134,7 +134,7 @@ private:
void mark5_state::machine_start()
{
m_out_x.resolve();
- m_irqtimer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mark5_state::interrupt),this));
+ m_irqtimer = timer_alloc(FUNC(mark5_state::interrupt), this);
// register for savestates
save_item(NAME(m_dac_data));
diff --git a/src/mame/drivers/samcoupe.cpp b/src/mame/drivers/samcoupe.cpp
index faa9a5d639c..a7fa5665cc0 100644
--- a/src/mame/drivers/samcoupe.cpp
+++ b/src/mame/drivers/samcoupe.cpp
@@ -88,7 +88,6 @@ protected:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
private:
required_device<cpu_device> m_maincpu;
@@ -109,12 +108,6 @@ private:
enum
{
- TIMER_IRQ_OFF,
- TIMER_VIDEO_UPDATE
- };
-
- enum
- {
INT_LINE = 0x01,
INT_MOUSE = 0x02,
INT_MIDIIN = 0x04,
@@ -130,6 +123,7 @@ private:
bitmap_ind16 m_bitmap;
emu_timer *m_video_update_timer;
+ emu_timer *m_irq_off_timer;
uint8_t m_lmpr, m_hmpr, m_vmpr; /* memory pages */
uint8_t m_border; /* border */
@@ -510,21 +504,6 @@ TIMER_CALLBACK_MEMBER(samcoupe_state::sam_video_update_callback)
// MACHINE EMULATION
//**************************************************************************
-void samcoupe_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_IRQ_OFF:
- irq_off(param);
- break;
- case TIMER_VIDEO_UPDATE:
- sam_video_update_callback(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in samcoupe_state::device_timer");
- }
-}
-
TIMER_CALLBACK_MEMBER(samcoupe_state::irq_off)
{
/* adjust STATUS register */
@@ -539,7 +518,7 @@ void samcoupe_state::samcoupe_irq(uint8_t src)
{
/* assert irq and a timer to set it off again */
m_maincpu->set_input_line(0, ASSERT_LINE);
- timer_set(attotime::from_usec(20), TIMER_IRQ_OFF, src);
+ m_irq_off_timer->adjust(attotime::from_usec(20), src);
/* adjust STATUS register */
m_status &= ~src;
@@ -566,7 +545,7 @@ void samcoupe_state::machine_start()
m_pages = m_ram->size() / 0x4000; // 16 or 32
/* schedule our video updates */
- m_video_update_timer = timer_alloc(TIMER_VIDEO_UPDATE);
+ m_video_update_timer = timer_alloc(FUNC(samcoupe_state::sam_video_update_callback), this);
m_video_update_timer->adjust(m_screen->time_until_pos(0, 0));
// register for save states
@@ -580,6 +559,10 @@ void samcoupe_state::machine_start()
save_item(NAME(m_attribute));
machine().save().register_postload(save_prepost_delegate(FUNC(samcoupe_state::postload), this));
+
+ // allocate machine timers
+ m_irq_off_timer = timer_alloc(FUNC(samcoupe_state::irq_off), this);
+ m_irq_off_timer->adjust(attotime::never);
}
void samcoupe_state::machine_reset()
diff --git a/src/mame/drivers/sbrkout.cpp b/src/mame/drivers/sbrkout.cpp
index 04bf494fcd8..6c6de61b814 100644
--- a/src/mame/drivers/sbrkout.cpp
+++ b/src/mame/drivers/sbrkout.cpp
@@ -134,8 +134,8 @@ static constexpr XTAL MAIN_CLOCK = 12.096_MHz_XTAL;
void sbrkout_state::machine_start()
{
membank("bank1")->set_base(&m_videoram[0x380]);
- m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sbrkout_state::scanline_callback),this));
- m_pot_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sbrkout_state::pot_trigger_callback),this));
+ m_scanline_timer = timer_alloc(FUNC(sbrkout_state::scanline_callback), this);
+ m_pot_timer = timer_alloc(FUNC(sbrkout_state::pot_trigger_callback), this);
save_item(NAME(m_sync2_value));
save_item(NAME(m_pot_mask));
diff --git a/src/mame/drivers/scv.cpp b/src/mame/drivers/scv.cpp
index 4d00ebf8da0..6e6a25c7f24 100644
--- a/src/mame/drivers/scv.cpp
+++ b/src/mame/drivers/scv.cpp
@@ -38,7 +38,8 @@ public:
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(vblank_update);
private:
void porta_w(uint8_t data);
@@ -57,11 +58,6 @@ private:
void scv_mem(address_map &map);
- enum
- {
- TIMER_VB
- };
-
uint8_t m_porta;
uint8_t m_portc;
emu_timer *m_vb_timer;
@@ -265,31 +261,21 @@ void scv_state::scv_palette(palette_device &palette) const
}
-void scv_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER( scv_state::vblank_update )
{
- switch (id)
- {
- case TIMER_VB:
- {
- int vpos = m_screen->vpos();
+ int vpos = m_screen->vpos();
- switch( vpos )
- {
- case 240:
- m_maincpu->set_input_line(UPD7810_INTF2, ASSERT_LINE);
- break;
- case 0:
- m_maincpu->set_input_line(UPD7810_INTF2, CLEAR_LINE);
- break;
- }
-
- m_vb_timer->adjust(m_screen->time_until_pos((vpos + 1) % 262, 0));
- }
+ switch ( vpos )
+ {
+ case 240:
+ m_maincpu->set_input_line(UPD7810_INTF2, ASSERT_LINE);
+ break;
+ case 0:
+ m_maincpu->set_input_line(UPD7810_INTF2, CLEAR_LINE);
break;
-
- default:
- throw emu_fatalerror("Unknown id in scv_state::device_timer");
}
+
+ m_vb_timer->adjust(m_screen->time_until_pos((vpos + 1) % 262, 0));
}
@@ -596,7 +582,7 @@ WRITE_LINE_MEMBER( scv_state::upd1771_ack_w )
void scv_state::machine_start()
{
- m_vb_timer = timer_alloc(TIMER_VB);
+ m_vb_timer = timer_alloc(FUNC(scv_state::vblank_update), this);
save_item(NAME(m_porta));
save_item(NAME(m_portc));
diff --git a/src/mame/drivers/sega_sawatte.cpp b/src/mame/drivers/sega_sawatte.cpp
index 8e96f53a811..9e6cde13b8c 100644
--- a/src/mame/drivers/sega_sawatte.cpp
+++ b/src/mame/drivers/sega_sawatte.cpp
@@ -85,8 +85,8 @@ private:
void sawatte_state::machine_start()
{
- m_irq3_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sawatte_state::irq3_timer), this));
- m_irq4_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sawatte_state::irq4_timer), this));
+ m_irq3_timer = timer_alloc(FUNC(sawatte_state::irq3_timer), this);
+ m_irq4_timer = timer_alloc(FUNC(sawatte_state::irq4_timer), this);
save_item(NAME(m_data_bank));
save_item(NAME(m_prog_bank));
diff --git a/src/mame/drivers/segag80r.cpp b/src/mame/drivers/segag80r.cpp
index 4d9ae3d94c5..3efe30ae378 100644
--- a/src/mame/drivers/segag80r.cpp
+++ b/src/mame/drivers/segag80r.cpp
@@ -159,7 +159,7 @@ INPUT_CHANGED_MEMBER(segag80r_state::service_switch)
void segag80r_state::machine_start()
{
- m_vblank_latch_clear_timer = timer_alloc(TIMER_VBLANK_LATCH_CLEAR);
+ m_vblank_latch_clear_timer = timer_alloc(FUNC(segag80r_state::vblank_latch_clear), this);
m_scrambled_write_pc = 0xffff;
/* register for save states */
diff --git a/src/mame/drivers/segahang.cpp b/src/mame/drivers/segahang.cpp
index 17896479296..3e08832ef30 100644
--- a/src/mame/drivers/segahang.cpp
+++ b/src/mame/drivers/segahang.cpp
@@ -199,7 +199,7 @@ void segahang_state::sync_ppi_w(offs_t offset, uint8_t data)
{
// the port C handshaking signals control the Z80 NMI,
// so we have to sync whenever we access this PPI
- synchronize(TID_PPI_WRITE, ((offset & 3) << 8) | data);
+ machine().scheduler().synchronize(timer_expired_delegate(FUNC(segahang_state::ppi_sync), this), ((offset & 3) << 8) | data);
}
@@ -299,7 +299,19 @@ void segahang_state::i8751_p1_w(uint8_t data)
//**************************************************************************
//-------------------------------------------------
-// machine_reset - reset the state of the machine
+// machine_start
+//-------------------------------------------------
+
+void segahang_state::machine_start()
+{
+ m_lamps.resolve();
+
+ m_i8751_sync_timer = timer_alloc(FUNC(segahang_state::i8751_sync), this);
+}
+
+
+//-------------------------------------------------
+// machine_reset
//-------------------------------------------------
void segahang_state::machine_reset()
@@ -308,7 +320,7 @@ void segahang_state::machine_reset()
m_segaic16vid->tilemap_reset(*m_screen);
// queue up a timer to boost interleave
- synchronize(TID_INIT_I8751);
+ m_i8751_sync_timer->adjust(attotime::zero);
// reset global state
m_adc_select = 0;
@@ -316,24 +328,19 @@ void segahang_state::machine_reset()
//-------------------------------------------------
-// device_timer - handle device timers
+// timer events
//-------------------------------------------------
-void segahang_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(segahang_state::i8751_sync)
+{
+ if (m_mcu != nullptr)
+ machine().scheduler().boost_interleave(attotime::zero, attotime::from_msec(10));
+}
+
+TIMER_CALLBACK_MEMBER(segahang_state::ppi_sync)
{
- switch (id)
- {
- // crank the interleave
- case TID_INIT_I8751:
- if (m_mcu != nullptr)
- machine().scheduler().boost_interleave(attotime::zero, attotime::from_msec(10));
- break;
-
- // synchronize writes to the 8255 PPI
- case TID_PPI_WRITE:
- m_i8255_1->write(param >> 8, param & 0xff);
- break;
- }
+ // synchronize writes to the 8255 PPI
+ m_i8255_1->write(param >> 8, param & 0xff);
}
diff --git a/src/mame/drivers/segaorun.cpp b/src/mame/drivers/segaorun.cpp
index 13f1b77ed51..bf74894ec2d 100644
--- a/src/mame/drivers/segaorun.cpp
+++ b/src/mame/drivers/segaorun.cpp
@@ -550,72 +550,63 @@ void segaorun_state::machine_reset()
//-------------------------------------------------
-// device_timer - handle device timers
+// timer events
//-------------------------------------------------
-void segaorun_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(segaorun_state::irq2_gen_tick)
{
- switch (id)
+ // set the IRQ2 line
+ m_irq2_state = 1;
+ update_main_irqs();
+}
+
+TIMER_CALLBACK_MEMBER(segaorun_state::scanline_tick)
+{
+ int scanline = param;
+ int next_scanline = scanline;
+
+ // trigger IRQs on certain scanlines
+ switch (scanline)
{
- case TID_IRQ2_GEN:
- // set the IRQ2 line
- m_irq2_state = 1;
- update_main_irqs();
+ // IRQ2 triggers on HBLANK of scanlines 65, 129, 193
+ case 65:
+ case 129:
+ case 193:
+ m_irq2_gen_timer->adjust(m_screen->time_until_pos(scanline, m_screen->visible_area().max_x + 1));
+ next_scanline = scanline + 1;
break;
- case TID_SCANLINE:
- {
- int scanline = param;
- int next_scanline = scanline;
-
- // trigger IRQs on certain scanlines
- switch (scanline)
- {
- // IRQ2 triggers on HBLANK of scanlines 65, 129, 193
- case 65:
- case 129:
- case 193:
- m_irq2_gen_timer->adjust(m_screen->time_until_pos(scanline, m_screen->visible_area().max_x + 1));
- next_scanline = scanline + 1;
- break;
-
- // IRQ2 turns off at the start of scanlines 66, 130, 194
- case 66:
- case 130:
- case 194:
- m_irq2_state = 0;
- next_scanline = (scanline == 194) ? 223 : (scanline + 63);
- break;
-
- // VBLANK triggers on scanline 223
- case 223:
- m_vblank_irq_state = 1;
- next_scanline = scanline + 1;
- m_subcpu->set_input_line(4, ASSERT_LINE);
- break;
-
- // VBLANK turns off at the start of scanline 224
- case 224:
- m_vblank_irq_state = 0;
- next_scanline = 65;
- m_subcpu->set_input_line(4, CLEAR_LINE);
- break;
-
- default:
- break;
- }
+ // IRQ2 turns off at the start of scanlines 66, 130, 194
+ case 66:
+ case 130:
+ case 194:
+ m_irq2_state = 0;
+ next_scanline = (scanline == 194) ? 223 : (scanline + 63);
+ break;
- // update IRQs on the main CPU
- update_main_irqs();
+ // VBLANK triggers on scanline 223
+ case 223:
+ m_vblank_irq_state = 1;
+ next_scanline = scanline + 1;
+ m_subcpu->set_input_line(4, ASSERT_LINE);
+ break;
- // come back at the next targeted scanline
- timer.adjust(m_screen->time_until_pos(next_scanline), next_scanline);
+ // VBLANK turns off at the start of scanline 224
+ case 224:
+ m_vblank_irq_state = 0;
+ next_scanline = 65;
+ m_subcpu->set_input_line(4, CLEAR_LINE);
break;
- }
default:
- throw emu_fatalerror("Unknown id in segaorun_state::device_timer");
+ break;
}
+
+ // update IRQs on the main CPU
+ update_main_irqs();
+
+ // come back at the next targeted scanline
+ m_scanline_timer->adjust(m_screen->time_until_pos(next_scanline), next_scanline);
}
@@ -3032,9 +3023,9 @@ ROM_END
void segaorun_state::init_generic()
{
// allocate a scanline timer
- m_scanline_timer = timer_alloc(TID_SCANLINE);
+ m_scanline_timer = timer_alloc(FUNC(segaorun_state::scanline_tick), this);
- m_irq2_gen_timer = timer_alloc(TID_IRQ2_GEN);
+ m_irq2_gen_timer = timer_alloc(FUNC(segaorun_state::irq2_gen_tick), this);
// configure the NVRAM to point to our workram
if (m_nvram != nullptr)
diff --git a/src/mame/drivers/segas16a.cpp b/src/mame/drivers/segas16a.cpp
index 62c13911ec9..b3482ab0b71 100644
--- a/src/mame/drivers/segas16a.cpp
+++ b/src/mame/drivers/segas16a.cpp
@@ -276,7 +276,7 @@ void segas16a_state::standard_io_w(offs_t offset, uint16_t data, uint16_t mem_ma
// the port C handshaking signals control the Z80 NMI,
// so we have to sync whenever we access this PPI
if (ACCESSING_BITS_0_7)
- synchronize(TID_PPI_WRITE, ((offset & 3) << 8) | (data & 0xff));
+ machine().scheduler().synchronize(timer_expired_delegate(FUNC(segas16a_state::ppi_sync), this), ((offset & 3) << 8) | (data & 0xff));
return;
}
//logerror("%06X:standard_io_w - unknown write access to address %04X = %04X & %04X\n", m_maincpu->state_int(STATE_GENPC), offset * 2, data, mem_mask);
@@ -604,13 +604,25 @@ WRITE_LINE_MEMBER(segas16a_state::i8751_main_cpu_vblank_w)
//**************************************************************************
//-------------------------------------------------
-// machine_reset - reset the state of the machine
+// machine_start
+//-------------------------------------------------
+
+void segas16a_state::machine_start()
+{
+ m_lamps.resolve();
+
+ m_i8751_sync_timer = timer_alloc(FUNC(segas16a_state::i8751_sync), this);
+}
+
+
+//-------------------------------------------------
+// machine_reset
//-------------------------------------------------
void segas16a_state::machine_reset()
{
// queue up a timer to either boost interleave or disable the MCU
- synchronize(TID_INIT_I8751);
+ m_i8751_sync_timer->adjust(attotime::zero);
m_video_control = 0;
m_mcu_control = 0x00;
m_n7751_command = 0;
@@ -623,26 +635,22 @@ void segas16a_state::machine_reset()
//-------------------------------------------------
-// device_timer - handle device timers
+// timer events
//-------------------------------------------------
-void segas16a_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(segas16a_state::i8751_sync)
{
- switch (id)
- {
- // if we have a fake i8751 handler, disable the actual 8751, otherwise crank the interleave
- case TID_INIT_I8751:
- if (!m_i8751_vblank_hook.isnull())
- m_mcu->suspend(SUSPEND_REASON_DISABLE, 1);
- else if (m_mcu != nullptr)
- machine().scheduler().boost_interleave(attotime::zero, attotime::from_msec(10));
- break;
+ // if we have a fake i8751 handler, disable the actual 8751, otherwise crank the interleave
+ if (!m_i8751_vblank_hook.isnull())
+ m_mcu->suspend(SUSPEND_REASON_DISABLE, 1);
+ else if (m_mcu != nullptr)
+ machine().scheduler().boost_interleave(attotime::zero, attotime::from_msec(10));
+}
- // synchronize writes to the 8255 PPI
- case TID_PPI_WRITE:
- m_i8255->write(param >> 8, param & 0xff);
- break;
- }
+TIMER_CALLBACK_MEMBER(segas16a_state::ppi_sync)
+{
+ // synchronize writes to the 8255 PPI
+ m_i8255->write(param >> 8, param & 0xff);
}
diff --git a/src/mame/drivers/segas16b.cpp b/src/mame/drivers/segas16b.cpp
index 484c559b25c..d42c3567877 100644
--- a/src/mame/drivers/segas16b.cpp
+++ b/src/mame/drivers/segas16b.cpp
@@ -1263,8 +1263,15 @@ INTERRUPT_GEN_MEMBER( segas16b_state::i8751_main_cpu_vblank )
// DRIVER OVERRIDES
//**************************************************************************
+void segas16b_state::machine_start()
+{
+ m_lamps.resolve();
+
+ m_i8751_sync_timer = timer_alloc(FUNC(segas16b_state::i8751_sync), this);
+}
+
//-------------------------------------------------
-// machine_reset - reset the state of the machine
+// machine_reset
//-------------------------------------------------
void segas16b_state::machine_reset()
@@ -1278,7 +1285,7 @@ void segas16b_state::machine_reset()
m_mapper->configure_explicit(m_i8751_initial_config);
// queue up a timer to either boost interleave or disable the MCU
- synchronize(TID_INIT_I8751);
+ m_i8751_sync_timer->adjust(attotime::zero);
// reset tilemap state
m_segaic16vid->tilemap_reset(*m_screen);
@@ -1300,29 +1307,25 @@ void segas16b_state::machine_reset()
//-------------------------------------------------
-// device_timer - handle device timers
+// timer events
//-------------------------------------------------
-void segas16b_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(segas16b_state::i8751_sync)
{
- switch (id)
- {
- // if we have a fake i8751 handler, disable the actual 8751, otherwise crank the interleave
- case TID_INIT_I8751:
- if (!m_i8751_vblank_hook.isnull())
- m_mcu->suspend(SUSPEND_REASON_DISABLE, 1);
- else if (m_mcu != nullptr)
- machine().scheduler().boost_interleave(attotime::zero, attotime::from_msec(10));
- break;
+ // if we have a fake i8751 handler, disable the actual 8751, otherwise crank the interleave
+ if (!m_i8751_vblank_hook.isnull())
+ m_mcu->suspend(SUSPEND_REASON_DISABLE, 1);
+ else if (m_mcu != nullptr)
+ machine().scheduler().boost_interleave(attotime::zero, attotime::from_msec(10));
+}
- // generate a periodic IRQ to the sound CPU
- case TID_ATOMICP_SOUND_IRQ:
- if (++m_atomicp_sound_count >= m_atomicp_sound_divisor)
- {
- m_maincpu->set_input_line(2, HOLD_LINE);
- m_atomicp_sound_count = 0;
- }
- break;
+TIMER_CALLBACK_MEMBER(segas16b_state::atomicp_sound_irq)
+{
+ // generate a periodic IRQ to the sound CPU
+ if (++m_atomicp_sound_count >= m_atomicp_sound_divisor)
+ {
+ m_maincpu->set_input_line(2, HOLD_LINE);
+ m_atomicp_sound_count = 0;
}
}
@@ -9671,7 +9674,7 @@ void segas16b_state::init_generic_korean()
m_segaic16vid->m_display_enable = 1;
// allocate a sound timer
- emu_timer *timer = timer_alloc(TID_ATOMICP_SOUND_IRQ);
+ emu_timer *timer = timer_alloc(FUNC(segas16b_state::atomicp_sound_irq), this);
timer->adjust(attotime::from_hz(10000), 0, attotime::from_hz(10000));
}
void segas16b_state::init_lockonph()
diff --git a/src/mame/drivers/segas18.cpp b/src/mame/drivers/segas18.cpp
index 38f813cfb44..aca0dc63a1e 100644
--- a/src/mame/drivers/segas18.cpp
+++ b/src/mame/drivers/segas18.cpp
@@ -153,20 +153,16 @@ void segas18_state::init_generic(segas18_rom_board rom_board)
*
*************************************/
-void segas18_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(segas18_state::initial_boost)
{
- switch (id)
- {
- case TID_INITIAL_BOOST:
- machine().scheduler().boost_interleave(attotime::zero, attotime::from_msec(10));
- break;
- }
+ machine().scheduler().boost_interleave(attotime::zero, attotime::from_msec(10));
}
void segas18_state::machine_start()
{
m_gun_recoil.resolve(); // lghost
m_soundbank->configure_entries(0, 256, memregion("soundcpu")->base(), 0x2000);
+ m_init_boost_timer = timer_alloc(FUNC(segas18_state::initial_boost), this);
}
void segas18_state::machine_reset()
@@ -177,7 +173,7 @@ void segas18_state::machine_reset()
// if we are running with a real live 8751, we need to boost the interleave at startup
if (m_mcu != nullptr && m_mcu->type() == I8751)
- synchronize(TID_INITIAL_BOOST);
+ m_init_boost_timer->adjust(attotime::zero);
}
diff --git a/src/mame/drivers/segas24.cpp b/src/mame/drivers/segas24.cpp
index bbde009376d..20bfb50f229 100644
--- a/src/mame/drivers/segas24.cpp
+++ b/src/mame/drivers/segas24.cpp
@@ -2532,7 +2532,7 @@ void segas24_state::init_gground()
m_mlatch_table = nullptr;
m_track_size = 0x2d00;
- m_gground_hack_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(segas24_state::gground_hack_timer_callback), this));
+ m_gground_hack_timer = timer_alloc(FUNC(segas24_state::gground_hack_timer_callback), this);
}
void segas24_state::init_crkdown()
diff --git a/src/mame/drivers/segaxbd.cpp b/src/mame/drivers/segaxbd.cpp
index aaf803ca4b8..72c9c7d993e 100644
--- a/src/mame/drivers/segaxbd.cpp
+++ b/src/mame/drivers/segaxbd.cpp
@@ -330,7 +330,7 @@ void segaxbd_state::device_start()
video_start();
// allocate a scanline timer
- m_scanline_timer = timer_alloc(TID_SCANLINE);
+ m_scanline_timer = timer_alloc(FUNC(segaxbd_state::scanline_tick), this);
// save state
save_item(NAME(m_timer_irq_state));
@@ -594,41 +594,34 @@ void segaxbd_state::smgp_excs_w(offs_t offset, uint16_t data, uint16_t mem_mask)
//**************************************************************************
//-------------------------------------------------
-// device_timer - handle device timers
+// scanline_tick
//-------------------------------------------------
-void segaxbd_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(segaxbd_state::scanline_tick)
{
- switch (id)
+ int scanline = param;
+ int next_scanline = (scanline + 1) % 262;
+
+ // clock the timer with V0
+ m_cmptimer_1->exck_w(scanline % 2);
+
+ // set VBLANK on scanline 223
+ if (scanline == 223)
{
- case TID_SCANLINE:
- {
- int scanline = param;
- int next_scanline = (scanline + 1) % 262;
-
- // clock the timer with V0
- m_cmptimer_1->exck_w(scanline % 2);
-
- // set VBLANK on scanline 223
- if (scanline == 223)
- {
- m_vblank_irq_state = 1;
- m_subcpu->set_input_line(4, ASSERT_LINE);
- update_main_irqs();
- }
-
- // clear VBLANK on scanline 224
- else if (scanline == 224)
- {
- m_vblank_irq_state = 0;
- m_subcpu->set_input_line(4, CLEAR_LINE);
- update_main_irqs();
- }
-
- m_scanline_timer->adjust(m_screen->time_until_pos(next_scanline), next_scanline);
- break;
- }
+ m_vblank_irq_state = 1;
+ m_subcpu->set_input_line(4, ASSERT_LINE);
+ update_main_irqs();
}
+
+ // clear VBLANK on scanline 224
+ else if (scanline == 224)
+ {
+ m_vblank_irq_state = 0;
+ m_subcpu->set_input_line(4, CLEAR_LINE);
+ update_main_irqs();
+ }
+
+ m_scanline_timer->adjust(m_screen->time_until_pos(next_scanline), next_scanline);
}
diff --git a/src/mame/drivers/segaybd.cpp b/src/mame/drivers/segaybd.cpp
index 1826f285477..da819bcd135 100644
--- a/src/mame/drivers/segaybd.cpp
+++ b/src/mame/drivers/segaybd.cpp
@@ -168,100 +168,94 @@ void segaybd_state::machine_reset()
//-------------------------------------------------
-// device_timer - handle device timers
+// irq2_gen_tick - generate IRQ2 for the main CPU
//-------------------------------------------------
-void segaybd_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(segaybd_state::irq2_gen_tick)
{
- switch (id)
+ //
+ // IRQ2 timing: the timing of this interrupt is VERY sensitive! If it is at the
+ // wrong time, many games will screw up their rendering. Also, since there is
+ // no ack on the interrupt, it only fires for a single scanline, so if it fires
+ // too early, it's possible it could be missed.
+ //
+ // As far as I can tell, the interrupt is not programmable. It comes from the
+ // pair of rotation/video sync chips. There is no obvious location in the
+ // rotation RAM where it is specified, so I am assuming it is a hard-coded
+ // interrupt.
+ //
+ // Through trial and error, here is what I have found. Scanline 170 seems to
+ // be the earliest we can fire it and have it work reliably. Firing it later
+ // seems to introduce some glitches. Firing it too early means it will get
+ // missed and even worse things happen.
+ //
+ // Enable the TWEAK_IRQ2_SCANLINE define at the top of this file to fiddle with
+ // the timing.
+ //
+ // pdrift:
+ // 100-110 = glitchy logo
+ // 120 = glitchy logo + flickering 16B during logo
+ // 150-170 = ok, very little logo glitching
+ // 180-200 = ok, slightly glitchy logo
+ // 210-220 = ok, but no palette fade
+ //
+ // gforce2:
+ // 140 = no palette fade up
+ // 150-200 = ok
+ //
+ // strkfgtr:
+ // 150-200 = ok
+ //
+
+ // on scanline 'irq2_scanline' generate an IRQ2
+ int scanline = param;
+ if (scanline == m_irq2_scanline)
{
- case TID_IRQ2_GEN:
- //
- // IRQ2 timing: the timing of this interrupt is VERY sensitive! If it is at the
- // wrong time, many games will screw up their rendering. Also, since there is
- // no ack on the interrupt, it only fires for a single scanline, so if it fires
- // too early, it's possible it could be missed.
- //
- // As far as I can tell, the interrupt is not programmable. It comes from the
- // pair of rotation/video sync chips. There is no obvious location in the
- // rotation RAM where it is specified, so I am assuming it is a hard-coded
- // interrupt.
- //
- // Through trial and error, here is what I have found. Scanline 170 seems to
- // be the earliest we can fire it and have it work reliably. Firing it later
- // seems to introduce some glitches. Firing it too early means it will get
- // missed and even worse things happen.
- //
- // Enable the TWEAK_IRQ2_SCANLINE define at the top of this file to fiddle with
- // the timing.
- //
- // pdrift:
- // 100-110 = glitchy logo
- // 120 = glitchy logo + flickering 16B during logo
- // 150-170 = ok, very little logo glitching
- // 180-200 = ok, slightly glitchy logo
- // 210-220 = ok, but no palette fade
- //
- // gforce2:
- // 140 = no palette fade up
- // 150-200 = ok
- //
- // strkfgtr:
- // 150-200 = ok
- //
- {
- // on scanline 'irq2_scanline' generate an IRQ2
- int scanline = param;
- if (scanline == m_irq2_scanline)
- {
- m_timer_irq_state = 1;
- scanline = m_irq2_scanline + 1;
- }
+ m_timer_irq_state = 1;
+ scanline = m_irq2_scanline + 1;
+ }
- // on scanline 'irq2_scanline' + 1, clear the IRQ2
- else if (scanline == m_irq2_scanline + 1)
- {
- m_timer_irq_state = 0;
- scanline = 223;
- }
+ // on scanline 'irq2_scanline' + 1, clear the IRQ2
+ else if (scanline == m_irq2_scanline + 1)
+ {
+ m_timer_irq_state = 0;
+ scanline = 223;
+ }
- // on scanline 223 generate VBLANK for all CPUs
- else if (scanline == 223)
- {
- m_vblank_irq_state = 1;
- scanline = 224;
- }
+ // on scanline 223 generate VBLANK for all CPUs
+ else if (scanline == 223)
+ {
+ m_vblank_irq_state = 1;
+ scanline = 224;
+ }
- // on scanline 224 we turn it off
- else if (scanline == 224)
- {
- m_vblank_irq_state = 0;
- scanline = m_irq2_scanline;
- }
+ // on scanline 224 we turn it off
+ else if (scanline == 224)
+ {
+ m_vblank_irq_state = 0;
+ scanline = m_irq2_scanline;
+ }
- // update IRQs on the main CPU
- update_irqs();
+ // update IRQs on the main CPU
+ update_irqs();
- // come back at the next appropriate scanline
- m_scanline_timer->adjust(m_screen->time_until_pos(scanline), scanline);
+ // come back at the next appropriate scanline
+ m_scanline_timer->adjust(m_screen->time_until_pos(scanline), scanline);
- #if TWEAK_IRQ2_SCANLINE
- if (scanline == 223)
- {
- int old = m_irq2_scanline;
-
- // Q = -10 scanlines, W = -1 scanline, E = +1 scanline, R = +10 scanlines
- if (machine().input().code_pressed(KEYCODE_Q)) { while (machine().input().code_pressed(KEYCODE_Q)) ; m_irq2_scanline -= 10; }
- if (machine().input().code_pressed(KEYCODE_W)) { while (machine().input().code_pressed(KEYCODE_W)) ; m_irq2_scanline -= 1; }
- if (machine().input().code_pressed(KEYCODE_E)) { while (machine().input().code_pressed(KEYCODE_E)) ; m_irq2_scanline += 1; }
- if (machine().input().code_pressed(KEYCODE_R)) { while (machine().input().code_pressed(KEYCODE_R)) ; m_irq2_scanline += 10; }
- if (old != m_irq2_scanline)
- popmessage("scanline = %d", m_irq2_scanline);
- }
- #endif
- }
- break;
+#if TWEAK_IRQ2_SCANLINE
+ if (scanline == 223)
+ {
+ int old = m_irq2_scanline;
+
+ // Q = -10 scanlines, W = -1 scanline, E = +1 scanline, R = +10 scanlines
+ if (machine().input().code_pressed(KEYCODE_Q)) { while (machine().input().code_pressed(KEYCODE_Q)) ; m_irq2_scanline -= 10; }
+ if (machine().input().code_pressed(KEYCODE_W)) { while (machine().input().code_pressed(KEYCODE_W)) ; m_irq2_scanline -= 1; }
+ if (machine().input().code_pressed(KEYCODE_E)) { while (machine().input().code_pressed(KEYCODE_E)) ; m_irq2_scanline += 1; }
+ if (machine().input().code_pressed(KEYCODE_R)) { while (machine().input().code_pressed(KEYCODE_R)) ; m_irq2_scanline += 10; }
+ if (old != m_irq2_scanline)
+ popmessage("scanline = %d", m_irq2_scanline);
}
+#endif
}
@@ -2757,7 +2751,7 @@ ROM_END
void segaybd_state::init_generic()
{
// allocate a scanline timer
- m_scanline_timer = timer_alloc(TID_IRQ2_GEN);
+ m_scanline_timer = timer_alloc(FUNC(segaybd_state::irq2_gen_tick), this);
// save state
save_item(NAME(m_pdrift_bank));
diff --git a/src/mame/drivers/seta.cpp b/src/mame/drivers/seta.cpp
index 9d20b48dfba..06486e6ba05 100644
--- a/src/mame/drivers/seta.cpp
+++ b/src/mame/drivers/seta.cpp
@@ -1566,7 +1566,7 @@ void seta_state::uPD71054_timer_init()
uPD71054->max[no] = 0xffff;
for (int no = 0; no < USED_TIMER_NUM; no++)
- uPD71054->timer[no] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(seta_state::uPD71054_timer_callback),this));
+ uPD71054->timer[no] = timer_alloc(FUNC(seta_state::uPD71054_timer_callback), this);
}
@@ -2338,7 +2338,7 @@ void seta_state::keroppi_map(address_map &map)
MACHINE_START_MEMBER(seta_state,keroppi)
{
- m_keroppi_prize_hop_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(seta_state::keroppi_prize_hop_callback), this));
+ m_keroppi_prize_hop_timer = timer_alloc(FUNC(seta_state::keroppi_prize_hop_callback), this);
m_keroppi_prize_hop = 0;
m_keroppi_protection_count = 0;
diff --git a/src/mame/drivers/seta2.cpp b/src/mame/drivers/seta2.cpp
index b4d8542e982..76c81dbddd6 100644
--- a/src/mame/drivers/seta2.cpp
+++ b/src/mame/drivers/seta2.cpp
@@ -690,11 +690,12 @@ public:
protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void tra_complete() override;
virtual void tra_callback() override;
+ TIMER_CALLBACK_MEMBER(read_buttons);
+
private:
devcb_write_line m_tx_cb;
required_ioport m_x;
@@ -739,7 +740,7 @@ void funcube_touchscreen_device::device_start()
set_data_frame(1, 8, PARITY_NONE, STOP_BITS_1);
set_tra_rate(9600);
m_button_state = 0x00;
- emu_timer *tm = timer_alloc(0);
+ emu_timer *tm = timer_alloc(FUNC(funcube_touchscreen_device::read_buttons), this);
tm->adjust(attotime::from_ticks(1, clock()), 0, attotime::from_ticks(1, clock()));
m_tx_cb.resolve_safe();
@@ -755,19 +756,17 @@ void funcube_touchscreen_device::device_reset()
m_tx_cb(1);
}
-void funcube_touchscreen_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(funcube_touchscreen_device::read_buttons)
{
- if(!id) {
- uint8_t button_state = m_btn->read();
- if(m_button_state != button_state) {
- m_button_state = button_state;
- m_serial[0] = button_state ? 0xfe : 0xfd;
- m_serial[1] = m_x->read();
- m_serial[2] = m_y->read();
- m_serial[3] = 0xff;
- m_serial_pos = 0;
- transmit_register_setup(m_serial[m_serial_pos++]);
- }
+ uint8_t button_state = m_btn->read();
+ if(m_button_state != button_state) {
+ m_button_state = button_state;
+ m_serial[0] = button_state ? 0xfe : 0xfd;
+ m_serial[1] = m_x->read();
+ m_serial[2] = m_y->read();
+ m_serial[3] = 0xff;
+ m_serial_pos = 0;
+ transmit_register_setup(m_serial[m_serial_pos++]);
}
}
diff --git a/src/mame/drivers/sg1000.cpp b/src/mame/drivers/sg1000.cpp
index 70493244682..4ad502b9d87 100644
--- a/src/mame/drivers/sg1000.cpp
+++ b/src/mame/drivers/sg1000.cpp
@@ -479,9 +479,6 @@ void sg1000_state::machine_start()
void sc3000_state::machine_start()
{
- /* toggle light gun crosshair */
- timer_set(attotime::zero, TIMER_LIGHTGUN_TICK);
-
if (m_cart && m_cart->exists() && (m_cart->get_type() == SEGA8_BASIC_L3 || m_cart->get_type() == SEGA8_MUSIC_EDITOR
|| m_cart->get_type() == SEGA8_DAHJEE_TYPEA || m_cart->get_type() == SEGA8_DAHJEE_TYPEB
|| m_cart->get_type() == SEGA8_MULTICART || m_cart->get_type() == SEGA8_MEGACART))
diff --git a/src/mame/drivers/simpsons.cpp b/src/mame/drivers/simpsons.cpp
index 51722732155..0daafdc244b 100644
--- a/src/mame/drivers/simpsons.cpp
+++ b/src/mame/drivers/simpsons.cpp
@@ -128,15 +128,15 @@ void simpsons_state::main_map(address_map &map)
map(0x1f93, 0x1f93).portr("P4");
map(0x1fa0, 0x1fa7).w(m_k053246, FUNC(k053247_device::k053246_w));
map(0x1fb0, 0x1fbf).w(m_k053251, FUNC(k053251_device::write));
- map(0x1fc0, 0x1fc0).w(FUNC(simpsons_state::simpsons_coin_counter_w));
- map(0x1fc2, 0x1fc2).w(FUNC(simpsons_state::simpsons_eeprom_w));
- map(0x1fc4, 0x1fc4).r(FUNC(simpsons_state::simpsons_sound_interrupt_r));
+ map(0x1fc0, 0x1fc0).w(FUNC(simpsons_state::coin_counter_w));
+ map(0x1fc2, 0x1fc2).w(FUNC(simpsons_state::eeprom_w));
+ map(0x1fc4, 0x1fc4).r(FUNC(simpsons_state::sound_interrupt_r));
map(0x1fc6, 0x1fc7).rw("k053260", FUNC(k053260_device::main_read), FUNC(k053260_device::main_write));
map(0x1fc8, 0x1fc9).r(m_k053246, FUNC(k053247_device::k053246_r));
map(0x1fca, 0x1fca).r("watchdog", FUNC(watchdog_timer_device::reset_r));
map(0x2000, 0x3fff).view(m_video_view);
- m_video_view[0](0x2000, 0x3fff).rw(FUNC(simpsons_state::simpsons_k052109_r), FUNC(simpsons_state::simpsons_k052109_w));
- m_video_view[1](0x2000, 0x2fff).rw(FUNC(simpsons_state::simpsons_k053247_r), FUNC(simpsons_state::simpsons_k053247_w));
+ m_video_view[0](0x2000, 0x3fff).rw(FUNC(simpsons_state::k052109_r), FUNC(simpsons_state::k052109_w));
+ m_video_view[1](0x2000, 0x2fff).rw(FUNC(simpsons_state::k053247_r), FUNC(simpsons_state::k053247_w));
m_video_view[1](0x3000, 0x3fff).ram();
map(0x4000, 0x5fff).ram();
map(0x6000, 0x7fff).bankr("bank1");
@@ -149,20 +149,15 @@ void simpsons_state::z80_bankswitch_w(uint8_t data)
}
-void simpsons_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(simpsons_state::dma_start)
{
- switch (id)
- {
- case TIMER_DMASTART:
- if (m_firq_enabled)
- m_maincpu->set_input_line(KONAMI_FIRQ_LINE, ASSERT_LINE);
- break;
- case TIMER_DMAEND:
- m_maincpu->set_input_line(KONAMI_FIRQ_LINE, CLEAR_LINE);
- break;
- default:
- throw emu_fatalerror("Unknown id in simpsons_state::device_timer");
- }
+ if (m_firq_enabled)
+ m_maincpu->set_input_line(KONAMI_FIRQ_LINE, ASSERT_LINE);
+}
+
+TIMER_CALLBACK_MEMBER(simpsons_state::dma_end)
+{
+ m_maincpu->set_input_line(KONAMI_FIRQ_LINE, CLEAR_LINE);
}
@@ -283,7 +278,7 @@ INPUT_PORTS_END
***************************************************************************/
-void simpsons_state::simpsons_objdma( )
+void simpsons_state::object_dma()
{
int counter, num_inactive;
uint16_t *src, *dst;
@@ -307,13 +302,13 @@ void simpsons_state::simpsons_objdma( )
if (num_inactive) do { *dst = 0; dst += 8; } while (--num_inactive);
}
-INTERRUPT_GEN_MEMBER(simpsons_state::simpsons_irq)
+INTERRUPT_GEN_MEMBER(simpsons_state::periodic_irq)
{
if (m_k053246->k053246_is_irq_enabled())
{
- simpsons_objdma();
- timer_set(attotime::from_ticks(256, XTAL(24'000'000)/4), TIMER_DMASTART);
- timer_set(attotime::from_ticks(256+2048, XTAL(24'000'000)/4), TIMER_DMAEND);
+ object_dma();
+ m_dma_start_timer->adjust(attotime::from_ticks(256, XTAL(24'000'000)/4));
+ m_dma_end_timer->adjust(attotime::from_ticks(256+2048, XTAL(24'000'000)/4));
}
}
@@ -322,7 +317,7 @@ void simpsons_state::simpsons(machine_config &config)
/* basic machine hardware */
KONAMI(config, m_maincpu, XTAL(24'000'000)/2/4); /* 053248, the clock input is 12MHz, and internal CPU divider of 4 */
m_maincpu->set_addrmap(AS_PROGRAM, &simpsons_state::main_map);
- m_maincpu->set_vblank_int("screen", FUNC(simpsons_state::simpsons_irq)); /* IRQ triggered by the 052109, FIRQ by the sprite hardware */
+ m_maincpu->set_vblank_int("screen", FUNC(simpsons_state::periodic_irq)); /* IRQ triggered by the 052109, FIRQ by the sprite hardware */
m_maincpu->line().set(FUNC(simpsons_state::banking_callback));
Z80(config, m_audiocpu, XTAL(3'579'545)); /* verified on pcb */
@@ -341,7 +336,7 @@ void simpsons_state::simpsons(machine_config &config)
// vertical: 16 lines front porch, 8 lines sync, 16 lines back porch
screen.set_raw(XTAL(24'000'000)/4, 384, 0+16, 320-16, 264, 0, 224);
screen.set_video_attributes(VIDEO_UPDATE_AFTER_VBLANK);
- screen.set_screen_update(FUNC(simpsons_state::screen_update_simpsons));
+ screen.set_screen_update(FUNC(simpsons_state::screen_update));
screen.set_palette("palette");
PALETTE(config, "palette").set_format(palette_device::xBGR_555, 2048).enable_shadows().enable_hilights();
diff --git a/src/mame/drivers/sitcom.cpp b/src/mame/drivers/sitcom.cpp
index 389d4fcb5a8..c1b6d1608d0 100644
--- a/src/mame/drivers/sitcom.cpp
+++ b/src/mame/drivers/sitcom.cpp
@@ -68,6 +68,12 @@ public:
DECLARE_INPUT_CHANGED_MEMBER(update_buttons);
protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
+ virtual void update_ppi_pa(uint8_t data);
+ virtual void update_ppi_pb(uint8_t data);
+
void sitcom_mem(address_map &map);
void sitcom_io(address_map &map);
@@ -75,12 +81,6 @@ protected:
DECLARE_WRITE_LINE_MEMBER(update_rxd) { m_rxd = bool(state); }
DECLARE_READ_LINE_MEMBER(sid_line) { return m_rxd ? 1 : 0; }
- virtual void update_ppi_pa(uint8_t data);
- virtual void update_ppi_pb(uint8_t data);
-
- virtual void machine_start() override;
- virtual void machine_reset() override;
-
static void sitcom_null_modem(device_t *device)
{
device->subdevice<bitbanger_device>("stream")->set_interface("rs232");
@@ -99,11 +99,6 @@ protected:
class sitcom_timer_state : public sitcom_state
{
public:
- enum
- {
- TIMER_SHUTTER
- };
-
sitcom_timer_state(const machine_config &mconfig, device_type type, const char *tag)
: sitcom_state(mconfig, type, tag)
, m_speed(*this, "SPEED")
@@ -125,13 +120,13 @@ public:
void sitcomtmr(machine_config &config);
protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
virtual void update_ppi_pa(uint8_t data) override;
virtual void update_ppi_pb(uint8_t data) override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
- virtual void machine_start() override;
- virtual void machine_reset() override;
+ TIMER_CALLBACK_MEMBER(shutter_tick);
void update_dac(uint8_t value);
@@ -299,16 +294,9 @@ INPUT_CHANGED_MEMBER( sitcom_timer_state::update_speed )
}
}
-void sitcom_timer_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(sitcom_timer_state::shutter_tick)
{
- switch (id)
- {
- case TIMER_SHUTTER:
- m_shutter = false;
- break;
- default:
- sitcom_state::device_timer(timer, id, param);
- }
+ m_shutter = false;
}
void sitcom_timer_state::machine_start()
@@ -318,7 +306,7 @@ void sitcom_timer_state::machine_start()
m_test_led.resolve();
m_dac.resolve();
- m_shutter_timer = timer_alloc(TIMER_SHUTTER);
+ m_shutter_timer = timer_alloc(FUNC(sitcom_timer_state::shutter_tick), this);
save_item(NAME(m_shutter));
save_item(NAME(m_dac_cs));
diff --git a/src/mame/drivers/skullxbo.cpp b/src/mame/drivers/skullxbo.cpp
index ab2912527d8..e45a86b200a 100644
--- a/src/mame/drivers/skullxbo.cpp
+++ b/src/mame/drivers/skullxbo.cpp
@@ -82,7 +82,7 @@ void skullxbo_state::machine_start()
{
atarigen_state::machine_start();
- m_scanline_int_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(skullxbo_state::scanline_interrupt), this));
+ m_scanline_int_timer = timer_alloc(FUNC(skullxbo_state::scanline_interrupt), this);
save_item(NAME(m_scanline_int_state));
}
diff --git a/src/mame/drivers/slapshot.cpp b/src/mame/drivers/slapshot.cpp
index 3bf2b166275..d6df5ec23af 100644
--- a/src/mame/drivers/slapshot.cpp
+++ b/src/mame/drivers/slapshot.cpp
@@ -147,16 +147,9 @@ Region byte at offset 0x031:
INTERRUPTS
***********************************************************/
-void slapshot_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(slapshot_state::trigger_int6)
{
- switch (id)
- {
- case TIMER_SLAPSHOT_INTERRUPT6:
- m_maincpu->set_input_line(6, HOLD_LINE);
- break;
- default:
- throw emu_fatalerror("Unknown id in slapshot_state::device_timer");
- }
+ m_maincpu->set_input_line(6, HOLD_LINE);
}
@@ -398,7 +391,7 @@ void slapshot_state::machine_start()
{
m_z80bank->configure_entries(0, 4, memregion("audiocpu")->base(), 0x4000);
- m_int6_timer = timer_alloc(TIMER_SLAPSHOT_INTERRUPT6);
+ m_int6_timer = timer_alloc(FUNC(slapshot_state::trigger_int6), this);
}
diff --git a/src/mame/drivers/socrates.cpp b/src/mame/drivers/socrates.cpp
index 519cc22d5b2..79a4e8c94e7 100644
--- a/src/mame/drivers/socrates.cpp
+++ b/src/mame/drivers/socrates.cpp
@@ -126,12 +126,14 @@ public:
void init_vpainter();
protected:
- enum
- {
- TIMER_KBMCU_SIM,
- TIMER_CLEAR_SPEECH,
- TIMER_CLEAR_IRQ
- };
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
+ void socrates_mem(address_map &map);
+ void socrates_io(address_map &map);
+ void socrates_rambank_map(address_map &map);
+ void socrates_rombank_map(address_map &map);
required_device<cpu_device> m_maincpu;
required_device<socrates_snd_device> m_sound;
@@ -174,16 +176,16 @@ protected:
uint8_t count;
} m_kb_queue;
- void socrates_palette(palette_device &palete) const;
+ void palette_init(palette_device &palete) const;
uint8_t common_rom_bank_r(offs_t offset);
void common_rom_bank_w(offs_t offset, uint8_t data);
uint8_t common_ram_bank_r();
void common_ram_bank_w(uint8_t data);
- uint8_t socrates_cart_r(offs_t offset);
+ uint8_t cart_r(offs_t offset);
uint8_t read_f3();
void kbmcu_reset(uint8_t data);
- uint8_t socrates_status_r();
+ uint8_t status_r();
void speech_command(uint8_t data);
uint8_t keyboard_buffer_read(offs_t offset);
void keyboard_buffer_update(uint8_t data);
@@ -193,28 +195,16 @@ protected:
uint16_t kbmcu_sim_fifo_peek();
void kbmcu_sim_fifo_head_clear();
void reset_speech(uint8_t data);
- void socrates_scroll_w(offs_t offset, uint8_t data);
- void socrates_sound_w(offs_t offset, uint8_t data);
+ void scroll_w(offs_t offset, uint8_t data);
+ void sound_w(offs_t offset, uint8_t data);
- virtual void machine_reset() override;
- virtual void machine_start() override;
- virtual void video_start() override;
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- uint32_t screen_update_socrates(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(assert_irq);
TIMER_CALLBACK_MEMBER(kbmcu_sim_cb);
TIMER_CALLBACK_MEMBER(clear_speech_cb);
TIMER_CALLBACK_MEMBER(clear_irq_cb);
- void socrates_update_kb();
- void socrates_check_kb_latch();
- static rgb_t socrates_create_color(uint8_t color);
-
- void socrates_rambank_map(address_map &map);
- void socrates_rombank_map(address_map &map);
- void socrates_io(address_map &map);
- void socrates_mem(address_map &map);
-
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ static rgb_t create_color(uint8_t color);
};
@@ -343,10 +333,10 @@ void socrates_state::kbmcu_sim_fifo_head_clear()
void socrates_state::machine_start()
{
- m_kbmcu_sim_timer = timer_alloc(TIMER_KBMCU_SIM);
+ m_kbmcu_sim_timer = timer_alloc(FUNC(socrates_state::kbmcu_sim_cb), this);
m_kbmcu_sim_timer->adjust(attotime::from_hz((XTAL(21'477'272)/6)/3000)); // timer rate is a massive guess, depends on instructions per loop of mcu
- m_clear_speech_timer = timer_alloc(TIMER_CLEAR_SPEECH);
- m_clear_irq_timer = timer_alloc(TIMER_CLEAR_IRQ);
+ m_clear_speech_timer = timer_alloc(FUNC(socrates_state::clear_speech_cb), this);
+ m_clear_irq_timer = timer_alloc(FUNC(socrates_state::clear_irq_cb), this);
save_item(NAME(m_rom_bank));
save_item(NAME(m_ram_bank));
save_item(NAME(m_scroll_offset));
@@ -386,24 +376,6 @@ void socrates_state::machine_reset()
m_speech_load_settings_count = 0;
}
-void socrates_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_KBMCU_SIM:
- kbmcu_sim_cb(param);
- break;
- case TIMER_CLEAR_SPEECH:
- clear_speech_cb(param);
- break;
- case TIMER_CLEAR_IRQ:
- clear_irq_cb(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in socrates_state::device_timer");
- }
-}
-
void socrates_state::init_socrates()
{
/* fill vram with its init powerup bit pattern, so startup has the checkerboard screen */
@@ -457,7 +429,7 @@ void socrates_state::common_ram_bank_w(uint8_t data)
m_rambank2->set_bank(((data>>4) & 0x0c) | ((data>>2) & 0x03));
}
-uint8_t socrates_state::socrates_cart_r(offs_t offset)
+uint8_t socrates_state::cart_r(offs_t offset)
{
///TODO: do m_rombank->space(AS_PROGRAM).install_write_handler(0x0002, 0x0002, write8_delegate(FUNC(dac_byte_interface::data_w), (dac_byte_interface *)m_dac)); style stuff
// demangle the offset, offset passed is bits 11111111 11111111 00000000 00000000
@@ -484,7 +456,7 @@ void socrates_state::kbmcu_reset(uint8_t data) // reset the keyboard MCU, clear
kbmcu_sim_reset();
}
-uint8_t socrates_state::socrates_status_r()// read 0x4x, some sort of status reg
+uint8_t socrates_state::status_r()// read 0x4x, some sort of status reg
{
// bit 7 - speech status: high when speech is playing, low when it is not (or when speech cart is not present)
// bit 6 - unknown, usually set, possibly mcu ready state?
@@ -683,7 +655,7 @@ logerror("write to i/o 0x60 of %x\n",data);
0x21 - W - msb offset of screen display
resulting screen line is one of 512 total offsets on 128-byte boundaries in the whole 64k ram
*/
-void socrates_state::socrates_scroll_w(offs_t offset, uint8_t data)
+void socrates_state::scroll_w(offs_t offset, uint8_t data)
{
if (offset == 0)
m_scroll_offset = (m_scroll_offset&0x100) | data;
@@ -710,7 +682,7 @@ void socrates_state::socrates_scroll_w(offs_t offset, uint8_t data)
// gamma: this needs to be messed with... may differ on different systems... attach to slider somehow?
#define GAMMA 1.5
-rgb_t socrates_state::socrates_create_color(uint8_t color)
+rgb_t socrates_state::create_color(uint8_t color)
{
static constexpr double lumatable[256] = {
LUMA_COL_0
@@ -790,10 +762,10 @@ rgb_t socrates_state::socrates_create_color(uint8_t color)
}
-void socrates_state::socrates_palette(palette_device &palette) const
+void socrates_state::palette_init(palette_device &palette) const
{
for (int i = 0; i < 256; i++)
- palette.set_pen_color(i, socrates_create_color(i));
+ palette.set_pen_color(i, create_color(i));
}
void socrates_state::video_start()
@@ -801,7 +773,7 @@ void socrates_state::video_start()
m_scroll_offset = 0;
}
-uint32_t socrates_state::screen_update_socrates(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+uint32_t socrates_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
static const uint8_t fixedcolors[8] = {
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0xF7 };
@@ -837,7 +809,7 @@ uint32_t socrates_state::screen_update_socrates(screen_device &screen, bitmap_in
/* below belongs in audio/socrates.cpp */
-void socrates_state::socrates_sound_w(offs_t offset, uint8_t data)
+void socrates_state::sound_w(offs_t offset, uint8_t data)
{
switch(offset)
{
@@ -1003,7 +975,7 @@ void socrates_state::socrates_rombank_map(address_map &map)
{
map.unmap_value_high();
map(0x000000, 0x03ffff).rom().region("maincpu", 0).mirror(0xF00000); // xxxx 00** **** **** **** ****
- map(0x040000, 0x07ffff).r(FUNC(socrates_state::socrates_cart_r)).select(0xF80000); // **** *1** **** **** **** ****
+ map(0x040000, 0x07ffff).r(FUNC(socrates_state::cart_r)).select(0xF80000); // **** *1** **** **** **** ****
map(0x080000, 0x0bffff).r(FUNC(socrates_state::read_f3)); // xxxx 10** **** **** **** ****
}
@@ -1019,7 +991,7 @@ void socrates_state::socrates_io(address_map &map)
map.global_mask(0xff);
map(0x00, 0x00).rw(FUNC(socrates_state::common_rom_bank_r), FUNC(socrates_state::common_rom_bank_w)).mirror(0x7); /* rom bank select - RW - 8 bits */
map(0x08, 0x08).rw(FUNC(socrates_state::common_ram_bank_r), FUNC(socrates_state::common_ram_bank_w)).mirror(0x7); /* ram banks select - RW - 4 low bits; Format: 0b****HHLL where LL controls whether window 0 points at ram area: 0b00: 0x0000-0x3fff; 0b01: 0x4000-0x7fff; 0b10: 0x8000-0xbfff; 0b11: 0xc000-0xffff. HH controls the same thing for window 1 */
- map(0x10, 0x17).rw(FUNC(socrates_state::read_f3), FUNC(socrates_state::socrates_sound_w)).mirror(0x8); /* sound section:
+ map(0x10, 0x17).rw(FUNC(socrates_state::read_f3), FUNC(socrates_state::sound_w)).mirror(0x8); /* sound section:
0x10 - W - frequency control for channel 1 (louder channel) - 01=high pitch, ff=low; time between 1->0/0->1 transitions = (XTAL(21'477'272)/(512+256) / (freq_reg+1)) (note that this is double the actual frequency since each full low and high squarewave pulse is two transitions)
0x11 - W - frequency control for channel 2 (softer channel) - 01=high pitch, ff=low; same equation as above
0x12 - W - 0b***EVVVV enable, volume control for channel 1
@@ -1031,9 +1003,9 @@ void socrates_state::socrates_io(address_map &map)
0xC0 produces a DMC wave read from an unknown address at around 342hz
<todo: test the others, maybe take samples?>
*/
- map(0x20, 0x21).rw(FUNC(socrates_state::read_f3), FUNC(socrates_state::socrates_scroll_w)).mirror(0xE);
+ map(0x20, 0x21).rw(FUNC(socrates_state::read_f3), FUNC(socrates_state::scroll_w)).mirror(0xE);
map(0x30, 0x30).rw(FUNC(socrates_state::read_f3), FUNC(socrates_state::kbmcu_reset)).mirror(0xF); /* resets the keyboard IR decoder MCU */
- map(0x40, 0x40).rw(FUNC(socrates_state::socrates_status_r), FUNC(socrates_state::speech_command)).mirror(0xF); /* reads status register for vblank/hblank/speech, also reads and writes speech module */
+ map(0x40, 0x40).rw(FUNC(socrates_state::status_r), FUNC(socrates_state::speech_command)).mirror(0xF); /* reads status register for vblank/hblank/speech, also reads and writes speech module */
map(0x50, 0x51).rw(FUNC(socrates_state::keyboard_buffer_read), FUNC(socrates_state::keyboard_buffer_update)).mirror(0xE); /* Keyboard fifo read, pop fifo on write */
map(0x60, 0x60).rw(FUNC(socrates_state::read_f3), FUNC(socrates_state::reset_speech)).mirror(0xF); /* reset the speech module, or perhaps fire an NMI? */
map(0x70, 0xFF).r(FUNC(socrates_state::read_f3)); // nothing mapped here afaik
@@ -1052,7 +1024,7 @@ void iqunlimz_state::iqunlimz_rombank_map(address_map &map)
{
map.unmap_value_high();
map(0x000000, 0x03ffff).rom().region("maincpu", 0).mirror(0xF00000); // xxxx 00** **** **** **** ****
- map(0x040000, 0x07ffff).r(FUNC(iqunlimz_state::socrates_cart_r)).select(0xF80000); // **** *1** **** **** **** ****
+ map(0x040000, 0x07ffff).r(FUNC(iqunlimz_state::cart_r)).select(0xF80000); // **** *1** **** **** **** ****
map(0x080000, 0x0bffff).rom().region("maincpu", 0x40000).mirror(0xF00000);// xxxx 10** **** **** **** ****
}
@@ -1068,8 +1040,8 @@ void iqunlimz_state::iqunlimz_io(address_map &map)
map.global_mask(0xff);
map(0x00, 0x01).rw(FUNC(iqunlimz_state::common_rom_bank_r), FUNC(iqunlimz_state::common_rom_bank_w)).mirror(0x06);
map(0x08, 0x08).rw(FUNC(iqunlimz_state::common_ram_bank_r), FUNC(iqunlimz_state::common_ram_bank_w)).mirror(0x07);
- map(0x10, 0x17).w(FUNC(iqunlimz_state::socrates_sound_w)).mirror(0x08);
- map(0x20, 0x21).w(FUNC(iqunlimz_state::socrates_scroll_w)).mirror(0x0E);
+ map(0x10, 0x17).w(FUNC(iqunlimz_state::sound_w)).mirror(0x08);
+ map(0x20, 0x21).w(FUNC(iqunlimz_state::scroll_w)).mirror(0x0E);
// 30: writes an incrementing value here, once per keypress?
// 40: some sort of serial select/reset or enable, related to 0x60
map(0x50, 0x51).rw(FUNC(iqunlimz_state::keyboard_buffer_read), FUNC(iqunlimz_state::keyboard_buffer_update)).mirror(0xE);
@@ -1494,10 +1466,10 @@ void socrates_state::socrates(machine_config &config)
m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(2500)); /* not accurate */
m_screen->set_size(264, 228); // technically the screen size is 256x228 but super painter abuses what I suspect is a hardware bug to display repeated pixels of the very last pixel beyond this horizontal space, well into hblank
m_screen->set_visarea(0, 263, 0, 219); // the last few rows are usually cut off by the screen bottom but are indeed displayed if you mess with v-hold
- m_screen->set_screen_update(FUNC(socrates_state::screen_update_socrates));
+ m_screen->set_screen_update(FUNC(socrates_state::screen_update));
m_screen->set_palette("palette");
- PALETTE(config, "palette", FUNC(socrates_state::socrates_palette), 256);
+ PALETTE(config, "palette", FUNC(socrates_state::palette_init), 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -1521,7 +1493,7 @@ void socrates_state::socrates_pal(machine_config &config)
m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(2500)); // not accurate
m_screen->set_size(264, 238); // technically the screen size is 256x228 but super painter abuses what I suspect is a hardware bug to display repeated pixels of the very last pixel beyond this horizontal space, well into hblank
m_screen->set_visarea(0, 263, 0, 229); // the last few rows are usually cut off by the screen bottom but are indeed displayed if you mess with v-hold
- m_screen->set_screen_update(FUNC(socrates_state::screen_update_socrates));
+ m_screen->set_screen_update(FUNC(socrates_state::screen_update));
m_sound->set_clock(XTAL(26'601'712)/(512+256)); // this is correct, as strange as it sounds.
}
@@ -1556,7 +1528,7 @@ void iqunlimz_state::iqunlimz(machine_config &config)
m_screen->set_visarea(0, 256-1, 0, 224-1);
m_screen->set_palette("palette");
- PALETTE(config, "palette", FUNC(iqunlimz_state::socrates_palette), 256);
+ PALETTE(config, "palette", FUNC(iqunlimz_state::palette_init), 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/spacefb.cpp b/src/mame/drivers/spacefb.cpp
index 938be5ad45c..8bec6ef5cc8 100644
--- a/src/mame/drivers/spacefb.cpp
+++ b/src/mame/drivers/spacefb.cpp
@@ -128,18 +128,6 @@
*************************************/
-void spacefb_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch(id)
- {
- case TIMER_INTERRUPT:
- interrupt_callback(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in spacefb_state::device_timer");
- }
-}
-
TIMER_CALLBACK_MEMBER(spacefb_state::interrupt_callback)
{
int next_vpos;
@@ -173,7 +161,7 @@ void spacefb_state::start_interrupt_timer()
void spacefb_state::machine_start()
{
- m_interrupt_timer = timer_alloc(TIMER_INTERRUPT);
+ m_interrupt_timer = timer_alloc(FUNC(spacefb_state::interrupt_callback), this);
save_item(NAME(m_sound_latch));
}
diff --git a/src/mame/drivers/spc1500.cpp b/src/mame/drivers/spc1500.cpp
index 37c6d1bfdeb..e109d8ab2d4 100644
--- a/src/mame/drivers/spc1500.cpp
+++ b/src/mame/drivers/spc1500.cpp
@@ -828,7 +828,7 @@ void spc1500_state::machine_start()
// intialize banks 2, 3, 4 (write banks)
membank("bank2")->set_base(m_p_ram);
membank("bank4")->set_base(m_p_ram + 0x8000);
- m_timer = timer_alloc(0);
+ m_timer = machine().scheduler().timer_alloc(timer_expired_delegate());
m_timer->adjust(attotime::zero);
}
diff --git a/src/mame/drivers/special_gambl.cpp b/src/mame/drivers/special_gambl.cpp
index 13c4599a39f..48406e1cd61 100644
--- a/src/mame/drivers/special_gambl.cpp
+++ b/src/mame/drivers/special_gambl.cpp
@@ -60,16 +60,12 @@ public:
DECLARE_INPUT_CHANGED_MEMBER(ram_test) { m_maincpu->set_input_line(INPUT_LINE_NMI, newval ? ASSERT_LINE : CLEAR_LINE); }
protected:
- enum
- {
- TIMER_COLD_BOOT
- };
-
void machine_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
- void dice_palette(palette_device &palette) const;
- u32 screen_update_dice(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ TIMER_CALLBACK_MEMBER(update_boot_flag);
+
+ void palette_init(palette_device &palette) const;
+ u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void dice_mem(address_map &map);
void dice_io(address_map &map);
@@ -122,16 +118,9 @@ static INPUT_PORTS_START(dice)
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_SERVICE3) PORT_NAME("RAM Test") PORT_CHANGED_MEMBER(DEVICE_SELF, dinaris_state, ram_test, 0)
INPUT_PORTS_END
-void dinaris_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(dinaris_state::update_boot_flag)
{
- switch (id)
- {
- case TIMER_COLD_BOOT:
- m_cold_boot = 1;
- break;
- default:
- throw emu_fatalerror("Unknown id in dinaris_state::device_timer");
- }
+ m_cold_boot = 1;
}
void dinaris_state::machine_start()
@@ -146,7 +135,8 @@ void dinaris_state::machine_start()
save_item(NAME(m_sram_en));
save_item(NAME(m_cold_boot));
- timer_set(attotime::from_msec(100), TIMER_COLD_BOOT);
+ emu_timer *cold_boot_timer = timer_alloc(FUNC(dinaris_state::update_boot_flag), this);
+ cold_boot_timer->adjust(attotime::from_msec(100));
}
void dinaris_state::dice_mem(address_map &map)
@@ -185,12 +175,12 @@ static constexpr rgb_t specimx_pens[16] = {
{ 0xff, 0xff, 0xff } // F
};
-void dinaris_state::dice_palette(palette_device &palette) const
+void dinaris_state::palette_init(palette_device &palette) const
{
palette.set_pen_colors(0, specimx_pens);
}
-u32 dinaris_state::screen_update_dice(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+u32 dinaris_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
// note: attribute area bytes set colors for 4x2 pix screen elements, not 8x1 like Specialist MX.
for (int x = 0; x < 48; x++)
@@ -253,10 +243,10 @@ void dinaris_state::dice(machine_config &config)
// Video
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_raw(XTAL(8'000'000), 512, 0, 384, 312, 0, 256);
- screen.set_screen_update(FUNC(dinaris_state::screen_update_dice));
+ screen.set_screen_update(FUNC(dinaris_state::screen_update));
screen.set_palette(m_palette);
- PALETTE(config, m_palette, FUNC(dinaris_state::dice_palette), 16);
+ PALETTE(config, m_palette, FUNC(dinaris_state::palette_init), 16);
// Sound
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/spectrum.cpp b/src/mame/drivers/spectrum.cpp
index b99227983df..b13b8f7b287 100644
--- a/src/mame/drivers/spectrum.cpp
+++ b/src/mame/drivers/spectrum.cpp
@@ -737,6 +737,8 @@ void spectrum_state::machine_reset()
m_port_fe_data = -1;
m_port_7ffd_data = -1;
m_port_1ffd_data = -1;
+ m_irq_on_timer->adjust(attotime::never);
+ m_irq_off_timer->adjust(attotime::never);
}
/* F4 Character Displayer */
@@ -755,27 +757,22 @@ static GFXDECODE_START( gfx_spectrum )
GFXDECODE_ENTRY( "maincpu", 0x3d00, spectrum_charlayout, 7, 8 )
GFXDECODE_END
-void spectrum_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(spectrum_state::irq_on)
{
- switch (id)
- {
- case TIMER_IRQ_ON:
- m_int_at = m_maincpu->total_cycles();
- m_int_at -= m_maincpu->attotime_to_cycles(m_maincpu->local_time() - machine().time());
- m_maincpu->set_input_line(0, ASSERT_LINE);
- m_irq_off_timer->adjust(m_maincpu->clocks_to_attotime(32));
- break;
- case TIMER_IRQ_OFF:
- m_maincpu->set_input_line(0, CLEAR_LINE);
- break;
- default:
- throw emu_fatalerror("Unknown id in spectrum_state::device_timer");
- }
+ m_int_at = m_maincpu->total_cycles();
+ m_int_at -= m_maincpu->attotime_to_cycles(m_maincpu->local_time() - machine().time());
+ m_maincpu->set_input_line(0, ASSERT_LINE);
+ m_irq_off_timer->adjust(m_maincpu->clocks_to_attotime(32));
+}
+
+TIMER_CALLBACK_MEMBER(spectrum_state::irq_off)
+{
+ m_maincpu->set_input_line(0, CLEAR_LINE);
}
INTERRUPT_GEN_MEMBER(spectrum_state::spec_interrupt)
{
- timer_set(m_screen->time_until_pos(0, get_screen_area().left()), TIMER_IRQ_ON);
+ m_irq_on_timer->adjust(m_screen->time_until_pos(0, get_screen_area().left()));
}
void spectrum_state::spectrum_common(machine_config &config)
diff --git a/src/mame/drivers/spg2xx_vii.cpp b/src/mame/drivers/spg2xx_vii.cpp
index 5693353c94c..968a170fb86 100644
--- a/src/mame/drivers/spg2xx_vii.cpp
+++ b/src/mame/drivers/spg2xx_vii.cpp
@@ -28,14 +28,11 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
- static const device_timer_id TIMER_CTRL_POLL = 0;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
void vii_portb_w(uint16_t data);
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(cart_load_vii);
- virtual void poll_controls();
+ TIMER_CALLBACK_MEMBER(poll_controls);
required_device<generic_slot_device> m_cart;
required_ioport m_io_motionx;
@@ -48,19 +45,6 @@ private:
};
-void vii_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_CTRL_POLL:
- poll_controls();
- break;
- default:
- logerror("Unknown timer ID: %d\n", id);
- break;
- }
-}
-
void vii_state::vii_portb_w(uint16_t data)
{
switch_bank(((data & 0x80) >> 7) | ((data & 0x20) >> 4));
@@ -101,7 +85,7 @@ void vii_state::machine_start()
m_bank->set_entry(0);
}
- m_ctrl_poll_timer = timer_alloc(TIMER_CTRL_POLL);
+ m_ctrl_poll_timer = timer_alloc(FUNC(vii_state::poll_controls), this);
m_ctrl_poll_timer->adjust(attotime::never);
save_item(NAME(m_controller_input));
@@ -120,7 +104,7 @@ void vii_state::machine_reset()
}
-void vii_state::poll_controls()
+TIMER_CALLBACK_MEMBER(vii_state::poll_controls)
{
int32_t x = m_io_motionx ? ((int32_t)m_io_motionx->read() - 0x200) : 0;
int32_t y = m_io_motiony ? ((int32_t)m_io_motiony->read() - 0x200) : 0;
diff --git a/src/mame/drivers/spg2xx_wiwi.cpp b/src/mame/drivers/spg2xx_wiwi.cpp
index 7f76ebbcd7d..c06992988ae 100644
--- a/src/mame/drivers/spg2xx_wiwi.cpp
+++ b/src/mame/drivers/spg2xx_wiwi.cpp
@@ -48,19 +48,16 @@ protected:
void machine_start() override;
void machine_reset() override;
- virtual void device_timer(emu_timer& timer, device_timer_id id, int param) override;
-
virtual uint16_t porta_r();
virtual void porta_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0) override;
virtual void portb_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0) override;
+ TIMER_CALLBACK_MEMBER(toggle_tick);
+
uint16_t m_prev_porta;
uint16_t m_prev_portb;
bool m_toggle;
emu_timer *m_pulse_timer = nullptr;
-
-private:
-
};
class spg2xx_game_guitrbus_state : public spg2xx_game_marc101_state
@@ -110,49 +107,32 @@ protected:
void machine_start() override;
void machine_reset() override;
- virtual void device_timer(emu_timer& timer, device_timer_id id, int param) override;
-
virtual uint16_t porta_r() override;
virtual void porta_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0) override;
virtual void portb_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0) override;
+ TIMER_CALLBACK_MEMBER(toggle2_tick);
+
private:
bool m_toggle2;
emu_timer *m_pulse_timer2 = nullptr;
};
-void spg2xx_game_marc101_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(spg2xx_game_marc101_state::toggle_tick)
{
- switch (id)
- {
- case 0:
- m_toggle = !m_toggle;
- //printf("toggle\n");
- break;
- }
+ m_toggle = !m_toggle;
}
-void spg2xx_game_marc250_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(spg2xx_game_marc250_state::toggle2_tick)
{
- switch (id)
- {
- case 0:
- m_toggle = !m_toggle;
- //printf("toggle\n");
- break;
-
- case 1:
- m_toggle2 = !m_toggle2;
- //printf("toggle\n");
- break;
- }
+ m_toggle2 = !m_toggle2;
}
void spg2xx_game_marc101_state::machine_start()
{
spg2xx_game_state::machine_start();
- m_pulse_timer = timer_alloc(0);
+ m_pulse_timer = timer_alloc(FUNC(spg2xx_game_marc101_state::toggle_tick), this);
m_pulse_timer->adjust(attotime::never);
}
@@ -169,7 +149,7 @@ void spg2xx_game_marc101_state::machine_reset()
void spg2xx_game_marc250_state::machine_start()
{
spg2xx_game_marc101_state::machine_start();
- m_pulse_timer2 = timer_alloc(1);
+ m_pulse_timer2 = timer_alloc(FUNC(spg2xx_game_marc250_state::toggle2_tick), this);
m_pulse_timer2->adjust(attotime::never);
// hack, makes x-racer3 and some others more stable, TODO: find out what is really wrong
diff --git a/src/mame/drivers/sprint4.cpp b/src/mame/drivers/sprint4.cpp
index 80ef418d1ae..f5e5049ead3 100644
--- a/src/mame/drivers/sprint4.cpp
+++ b/src/mame/drivers/sprint4.cpp
@@ -32,11 +32,6 @@ namespace {
class sprint4_state : public driver_device
{
public:
- enum
- {
- TIMER_NMI
- };
-
sprint4_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
@@ -62,6 +57,12 @@ public:
template <int N> DECLARE_READ_LINE_MEMBER(collision_flipflop_r);
private:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
+ void cpu_map(address_map &map);
+
uint8_t wram_r(offs_t offset);
uint8_t analog_r(offs_t offset);
uint8_t coin_r(offs_t offset);
@@ -75,19 +76,13 @@ private:
void bang_w(uint8_t data);
void attract_w(uint8_t data);
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void video_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
- void sprint4_palette(palette_device &palette) const;
+ void palette_init(palette_device &palette) const;
TILE_GET_INFO_MEMBER(tile_info);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(screen_vblank);
TIMER_CALLBACK_MEMBER(nmi_callback);
- void sprint4_cpu_map(address_map &map);
-
required_device<cpu_device> m_maincpu;
required_device<watchdog_timer_device> m_watchdog;
required_device<discrete_sound_device> m_discrete;
@@ -138,19 +133,6 @@ READ_LINE_MEMBER(sprint4_state::collision_flipflop_r)
}
-void sprint4_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_NMI:
- nmi_callback(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in sprint4_state::device_timer");
- }
-}
-
-
TIMER_CALLBACK_MEMBER(sprint4_state::nmi_callback)
{
int scanline = param;
@@ -204,7 +186,7 @@ TIMER_CALLBACK_MEMBER(sprint4_state::nmi_callback)
void sprint4_state::machine_start()
{
- m_nmi_timer = timer_alloc(TIMER_NMI);
+ m_nmi_timer = timer_alloc(FUNC(sprint4_state::nmi_callback), this);
save_item(NAME(m_da_latch));
save_item(NAME(m_steer_FF1));
@@ -294,7 +276,7 @@ void sprint4_state::attract_w(uint8_t data)
}
-void sprint4_state::sprint4_palette(palette_device &palette) const
+void sprint4_state::palette_init(palette_device &palette) const
{
palette.set_indirect_color(0, rgb_t(0x00, 0x00, 0x00)); // black
palette.set_indirect_color(1, rgb_t(0xfc, 0xdf, 0x80)); // peach
@@ -420,7 +402,7 @@ void sprint4_state::video_ram_w(offs_t offset, uint8_t data)
}
-void sprint4_state::sprint4_cpu_map(address_map &map)
+void sprint4_state::cpu_map(address_map &map)
{
map.global_mask(0x3fff);
@@ -586,7 +568,7 @@ void sprint4_state::sprint4(machine_config &config)
{
/* basic machine hardware */
M6502(config, m_maincpu, PIXEL_CLOCK / 8);
- m_maincpu->set_addrmap(AS_PROGRAM, &sprint4_state::sprint4_cpu_map);
+ m_maincpu->set_addrmap(AS_PROGRAM, &sprint4_state::cpu_map);
WATCHDOG_TIMER(config, m_watchdog).set_vblank_count(m_screen, 8);
@@ -598,7 +580,7 @@ void sprint4_state::sprint4(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_sprint4);
- PALETTE(config, m_palette, FUNC(sprint4_state::sprint4_palette), 10, 6);
+ PALETTE(config, m_palette, FUNC(sprint4_state::palette_init), 10, 6);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/ssfindo.cpp b/src/mame/drivers/ssfindo.cpp
index ce06865870f..c6f2b63029d 100644
--- a/src/mame/drivers/ssfindo.cpp
+++ b/src/mame/drivers/ssfindo.cpp
@@ -708,8 +708,8 @@ ROM_END
void ssfindo_state::init_common()
{
m_speedup = nullptr;
- //m_PS7500timer0 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ssfindo_state::PS7500_Timer0_callback),this));
- //m_PS7500timer1 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ssfindo_state::PS7500_Timer1_callback),this));
+ //m_PS7500timer0 = timer_alloc(FUNC(ssfindo_state::PS7500_Timer0_callback), this);
+ //m_PS7500timer1 = timer_alloc(FUNC(ssfindo_state::PS7500_Timer1_callback), this);
//save_item(NAME(m_PS7500_IO));
//save_item(NAME(m_PS7500_FIFO));
diff --git a/src/mame/drivers/sslam.cpp b/src/mame/drivers/sslam.cpp
index e984cd3c363..ebc445e5fe0 100644
--- a/src/mame/drivers/sslam.cpp
+++ b/src/mame/drivers/sslam.cpp
@@ -704,7 +704,7 @@ void sslam_state::machine_start()
save_item(NAME(m_snd_bank));
save_item(NAME(m_unk_458));
- m_music_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sslam_state::music_playback),this));
+ m_music_timer = timer_alloc(FUNC(sslam_state::music_playback), this);
}
void powerbls_state::machine_start()
diff --git a/src/mame/drivers/starfire.cpp b/src/mame/drivers/starfire.cpp
index 085b1130fea..1953fd70081 100644
--- a/src/mame/drivers/starfire.cpp
+++ b/src/mame/drivers/starfire.cpp
@@ -113,7 +113,6 @@ void starfire_state::sound_w(offs_t offset, uint8_t data)
m_sound_lock->write(BIT(data, 5));
m_sound_scanner->write(BIT(data, 6));
m_sound_overheat->write(BIT(data, 7));
- synchronize();
}
void fireone_state::sound_w(offs_t offset, uint8_t data)
diff --git a/src/mame/drivers/subhuntr.cpp b/src/mame/drivers/subhuntr.cpp
index af122902cb3..752b58c6c6e 100644
--- a/src/mame/drivers/subhuntr.cpp
+++ b/src/mame/drivers/subhuntr.cpp
@@ -58,10 +58,6 @@ public:
void subhuntr(machine_config &config);
protected:
- enum { TIMER_VIDEO };
-
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
virtual void machine_start() override;
virtual void machine_reset() override;
@@ -107,21 +103,9 @@ private:
***************************************************************************/
-void subhuntr_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_VIDEO:
- video_callback(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in subhuntr_state::device_timer");
- }
-}
-
void subhuntr_state::machine_start()
{
- m_video_timer = timer_alloc(TIMER_VIDEO);
+ m_video_timer = timer_alloc(FUNC(subhuntr_state::video_callback), this);
m_tilemap = &machine().tilemap().create(*m_gfx, tilemap_get_info_delegate(*this, FUNC(subhuntr_state::tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 8);
m_tilemap->set_transparent_pen(0);
diff --git a/src/mame/drivers/sun4.cpp b/src/mame/drivers/sun4.cpp
index b54fd89a7ff..24e00283cb6 100644
--- a/src/mame/drivers/sun4.cpp
+++ b/src/mame/drivers/sun4.cpp
@@ -545,10 +545,9 @@ public:
protected:
virtual void machine_reset() override;
virtual void machine_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
- static const device_timer_id TIMER_0 = 0;
- static const device_timer_id TIMER_1 = 1;
+ TIMER_CALLBACK_MEMBER(timer0_tick);
+ TIMER_CALLBACK_MEMBER(timer1_tick);
uint32_t debugger_r(offs_t offset, uint32_t mem_mask = ~0);
void debugger_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
@@ -838,8 +837,8 @@ void sun4_base_state::machine_start()
}
// allocate timers for the built-in two channel timer
- m_c0_timer = timer_alloc(TIMER_0);
- m_c1_timer = timer_alloc(TIMER_1);
+ m_c0_timer = timer_alloc(FUNC(sun4_base_state::timer0_tick), this);
+ m_c1_timer = timer_alloc(FUNC(sun4_base_state::timer1_tick), this);
m_c0_timer->adjust(attotime::from_usec(1), 0, attotime::from_usec(1));
m_c1_timer->adjust(attotime::from_usec(1), 0, attotime::from_usec(1));
@@ -1021,47 +1020,43 @@ WRITE_LINE_MEMBER( sun4_base_state::scc2_int )
m_maincpu->set_input_line(SPARC_IRQ12, ((m_scc1_int || m_scc2_int) && (m_irq_reg & 0x01)) ? ASSERT_LINE : CLEAR_LINE);
}
-void sun4_base_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(sun4_base_state::timer0_tick)
{
- switch (id)
+ //logerror("Timer 0 expired\n");
+ m_counter[0] += 1 << 10;
+ if ((m_counter[0] & 0x7fffffff) == (m_counter[1] & 0x7fffffff))
{
- case TIMER_0:
- //logerror("Timer 0 expired\n");
- m_counter[0] += 1 << 10;
- if ((m_counter[0] & 0x7fffffff) == (m_counter[1] & 0x7fffffff))
- {
- m_counter[0] = 0x80000000 | (1 << 10);
- m_counter[1] |= 0x80000000;
- if ((m_irq_reg & 0x21) == 0x21)
- {
- m_maincpu->set_input_line(SPARC_IRQ10, ASSERT_LINE);
- //logerror("Taking INT10\n");
- }
- else
- {
- //logerror("Not taking INT10\n");
- }
- }
- break;
+ m_counter[0] = 0x80000000 | (1 << 10);
+ m_counter[1] |= 0x80000000;
+ if ((m_irq_reg & 0x21) == 0x21)
+ {
+ m_maincpu->set_input_line(SPARC_IRQ10, ASSERT_LINE);
+ //logerror("Taking INT10\n");
+ }
+ else
+ {
+ //logerror("Not taking INT10\n");
+ }
+ }
+}
- case TIMER_1:
- //logerror("Timer 1 expired\n");
- m_counter[2] += 1 << 10;
- if ((m_counter[2] & 0x7fffffff) == (m_counter[3] & 0x7fffffff))
- {
- m_counter[2] = 0x80000000 | (1 << 10);
- m_counter[3] |= 0x80000000;
- if ((m_irq_reg & 0x81) == 0x81)
- {
- m_maincpu->set_input_line(SPARC_IRQ14, ASSERT_LINE);
- //logerror("Taking INT14\n");
- }
- else
- {
- //logerror("Not taking INT14\n");
- }
- }
- break;
+TIMER_CALLBACK_MEMBER(sun4_base_state::timer1_tick)
+{
+ //logerror("Timer 1 expired\n");
+ m_counter[2] += 1 << 10;
+ if ((m_counter[2] & 0x7fffffff) == (m_counter[3] & 0x7fffffff))
+ {
+ m_counter[2] = 0x80000000 | (1 << 10);
+ m_counter[3] |= 0x80000000;
+ if ((m_irq_reg & 0x81) == 0x81)
+ {
+ m_maincpu->set_input_line(SPARC_IRQ14, ASSERT_LINE);
+ //logerror("Taking INT14\n");
+ }
+ else
+ {
+ //logerror("Not taking INT14\n");
+ }
}
}
diff --git a/src/mame/drivers/supracan.cpp b/src/mame/drivers/supracan.cpp
index 9b0ad918776..4f2e218dff9 100644
--- a/src/mame/drivers/supracan.cpp
+++ b/src/mame/drivers/supracan.cpp
@@ -1988,10 +1988,10 @@ void supracan_state::machine_start()
save_item(NAME(m_video_regs));
- m_video_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(supracan_state::video_callback), this));
- m_hbl_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(supracan_state::hbl_callback), this));
- m_line_on_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(supracan_state::line_on_callback), this));
- m_line_off_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(supracan_state::line_off_callback), this));
+ m_video_timer = timer_alloc(FUNC(supracan_state::video_callback), this);
+ m_hbl_timer = timer_alloc(FUNC(supracan_state::hbl_callback), this);
+ m_line_on_timer = timer_alloc(FUNC(supracan_state::line_on_callback), this);
+ m_line_off_timer = timer_alloc(FUNC(supracan_state::line_off_callback), this);
if (m_cart->exists())
m_maincpu->space(AS_PROGRAM).install_read_handler(0x000000, 0x3fffff, read16s_delegate(*m_cart, FUNC(generic_slot_device::read16_rom)));
diff --git a/src/mame/drivers/svision.cpp b/src/mame/drivers/svision.cpp
index d4b2dea971c..98541f08d10 100644
--- a/src/mame/drivers/svision.cpp
+++ b/src/mame/drivers/svision.cpp
@@ -430,17 +430,17 @@ WRITE_LINE_MEMBER(svision_state::frame_int_w)
void svision_state::init_svision()
{
- m_svision.timer1 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(svision_state::svision_timer),this));
+ m_svision.timer1 = timer_alloc(FUNC(svision_state::svision_timer), this);
m_dma_finished = false;
m_pet.on = false;
}
void svision_state::init_svisions()
{
- m_svision.timer1 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(svision_state::svision_timer),this));
+ m_svision.timer1 = timer_alloc(FUNC(svision_state::svision_timer), this);
m_dma_finished = false;
m_pet.on = true;
- m_pet.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(svision_state::svision_pet_timer),this));
+ m_pet.timer = timer_alloc(FUNC(svision_state::svision_pet_timer), this);
}
DEVICE_IMAGE_LOAD_MEMBER( svision_state::cart_load )
diff --git a/src/mame/drivers/swyft.cpp b/src/mame/drivers/swyft.cpp
index 2ad7217729c..b52c8b92667 100644
--- a/src/mame/drivers/swyft.cpp
+++ b/src/mame/drivers/swyft.cpp
@@ -377,8 +377,6 @@ private:
DECLARE_WRITE_LINE_MEMBER(write_acia_clock);
void swyft_mem(address_map &map);
-
- //virtual void device_timer(emu_timer &timer, device_timer_id id, int param);
};
diff --git a/src/mame/drivers/sym1.cpp b/src/mame/drivers/sym1.cpp
index 04327694839..8c07ffa0e33 100644
--- a/src/mame/drivers/sym1.cpp
+++ b/src/mame/drivers/sym1.cpp
@@ -352,7 +352,7 @@ void sym1_state::init_sym1()
bank->set_entry(1);
// allocate a timer to refresh the led display
- m_led_update = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sym1_state::led_refresh), this));
+ m_led_update = timer_alloc(FUNC(sym1_state::led_refresh), this);
}
void sym1_state::machine_reset()
diff --git a/src/mame/drivers/symbolics.cpp b/src/mame/drivers/symbolics.cpp
index e09bbf40e5c..07e8213271c 100644
--- a/src/mame/drivers/symbolics.cpp
+++ b/src/mame/drivers/symbolics.cpp
@@ -104,6 +104,7 @@ private:
//uint16_t ram_parity_hack_r(offs_t offset);
//void ram_parity_hack_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
//bool m_parity_error_has_occurred[0x20000];
+ //emu_timer *m_outfifo_timer = nullptr;
// overrides
virtual void machine_start() override;
@@ -111,7 +112,7 @@ private:
void m68k_mem(address_map &map);
- // virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ //TIMER_CALLBACK_MEMBER(outfifo_read_cb);
};
uint16_t symbolics_state::buserror_r()
@@ -281,19 +282,7 @@ INPUT_PORTS_END
/******************************************************************************
Machine Drivers
******************************************************************************/
-/*void symbolics_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_OUTFIFO_READ:
- outfifo_read_cb(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in symbolics_state::device_timer");
- }
-}
-
-TIMER_CALLBACK_MEMBER(symbolics_state::outfifo_read_cb)
+/*TIMER_CALLBACK_MEMBER(symbolics_state::outfifo_read_cb)
{
uint16_t data;
}
@@ -308,6 +297,7 @@ void symbolics_state::init_symbolics()
void symbolics_state::machine_start()
{
//save_item(NAME(m_parity_error_has_occurred));
+ //m_outfifo_timer = timer_alloc(FUNC(symbolics_state::outfifo_read_cb), this);
}
/* reset */
diff --git a/src/mame/drivers/taito_f2.cpp b/src/mame/drivers/taito_f2.cpp
index 60dca28dc2d..5f6cfb1e0d2 100644
--- a/src/mame/drivers/taito_f2.cpp
+++ b/src/mame/drivers/taito_f2.cpp
@@ -528,16 +528,9 @@ driftout 8000 0000/8 0000 0000 The first control changes from 8000 to 0000
******************************************************************/
-void taitof2_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(taitof2_state::trigger_int6)
{
- switch (id)
- {
- case TIMER_INTERRUPT6:
- m_maincpu->set_input_line(6, HOLD_LINE);
- break;
- default:
- throw emu_fatalerror("Unknown id in taitof2_state::device_timer");
- }
+ m_maincpu->set_input_line(6, HOLD_LINE);
}
INTERRUPT_GEN_MEMBER(taitof2_state::interrupt)
@@ -2775,7 +2768,7 @@ void taitof2_state::machine_start()
}
}
- m_int6_timer = timer_alloc(TIMER_INTERRUPT6);
+ m_int6_timer = timer_alloc(FUNC(taitof2_state::trigger_int6), this);
}
void taitof2_state::taito_f2(machine_config &config)
diff --git a/src/mame/drivers/taito_f3.cpp b/src/mame/drivers/taito_f3.cpp
index 1315d52aa26..f70d5a59b9f 100644
--- a/src/mame/drivers/taito_f3.cpp
+++ b/src/mame/drivers/taito_f3.cpp
@@ -424,16 +424,9 @@ GFXDECODE_END
/******************************************************************************/
-void taito_f3_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(taito_f3_state::trigger_int3)
{
- switch (id)
- {
- case TIMER_F3_INTERRUPT3:
- m_maincpu->set_input_line(3, HOLD_LINE); // some signal from video hardware?
- break;
- default:
- throw emu_fatalerror("Unknown id in taito_f3_state::device_timer");
- }
+ m_maincpu->set_input_line(3, HOLD_LINE); // some signal from video hardware?
}
INTERRUPT_GEN_MEMBER(taito_f3_state::interrupt2)
@@ -444,7 +437,7 @@ INTERRUPT_GEN_MEMBER(taito_f3_state::interrupt2)
void taito_f3_state::machine_start()
{
- m_interrupt3_timer = timer_alloc(TIMER_F3_INTERRUPT3);
+ m_interrupt3_timer = timer_alloc(FUNC(taito_f3_state::trigger_int3), this);
save_item(NAME(m_coin_word));
}
diff --git a/src/mame/drivers/taito_z.cpp b/src/mame/drivers/taito_z.cpp
index 480aa89fad6..9b3cd1c26ca 100644
--- a/src/mame/drivers/taito_z.cpp
+++ b/src/mame/drivers/taito_z.cpp
@@ -1320,17 +1320,10 @@ void dblaxle_state::dblaxle_cpua_ctrl_w(offs_t offset, u16 data, u16 mem_mask)
INTERRUPTS
***********************************************************/
-void sci_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(sci_state::trigger_int6)
{
- switch (id)
- {
- case TIMER_TAITOZ_INTERRUPT6:
- /* 68000 A */
- m_maincpu->set_input_line(6, HOLD_LINE);
- break;
- default:
- throw emu_fatalerror("Unknown id in taitoz_state::device_timer");
- }
+ /* 68000 A */
+ m_maincpu->set_input_line(6, HOLD_LINE);
}
/***** Routines for particular games *****/
@@ -1344,7 +1337,7 @@ INTERRUPT_GEN_MEMBER(sci_state::sci_interrupt)
m_sci_int6 = !m_sci_int6;
if (m_sci_int6)
- timer_set(downcast<cpu_device *>(&device)->cycles_to_attotime(200000 - 500), TIMER_TAITOZ_INTERRUPT6);
+ m_int6_timer->adjust(downcast<cpu_device *>(&device)->cycles_to_attotime(200000 - 500));
device.execute().set_input_line(4, HOLD_LINE);
}
@@ -3169,6 +3162,8 @@ void sci_state::machine_start()
taitoz_z80_sound_state::machine_start();
save_item(NAME(m_sci_int6));
+
+ m_int6_timer = timer_alloc(FUNC(sci_state::trigger_int6), this);
}
void nightstr_state::machine_start()
@@ -3208,6 +3203,7 @@ void sci_state::machine_reset()
taitoz_z80_sound_state::machine_reset();
m_sci_int6 = 0;
+ m_int6_timer->adjust(attotime::never);
}
void taitoz_state::screen_config(machine_config &config, int vdisp_start, int vdisp_end)
diff --git a/src/mame/drivers/tandy2k.cpp b/src/mame/drivers/tandy2k.cpp
index 31b92084f0b..f373a0731eb 100644
--- a/src/mame/drivers/tandy2k.cpp
+++ b/src/mame/drivers/tandy2k.cpp
@@ -924,8 +924,8 @@ void tandy2k_state::machine_start()
program.install_ram(0x00000, ram_size - 1, ram);
- m_mouse_timer = timer_alloc(MOUS_TIMER);
- m_mcu_delay = timer_alloc(MCU_DELAY);
+ m_mouse_timer = timer_alloc(FUNC(tandy2k_state::update_mouse), this);
+ m_mcu_delay = timer_alloc(FUNC(tandy2k_state::mcu_delay_cb), this);
// register for state saving
save_item(NAME(m_dma_mux));
@@ -961,31 +961,26 @@ void tandy2k_state::device_reset_after_children()
m_pc_keyboard->enable(0);
}
-void tandy2k_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(tandy2k_state::update_mouse)
{
- switch (id)
- {
- case MOUS_TIMER:
- {
- uint16_t x = m_x_axis->read();
- uint16_t y = m_y_axis->read();
- uint16_t dx = x - m_mouse_x;
- uint16_t dy = y - m_mouse_y;
- m_mouse_x = x;
- m_mouse_y = y;
- m_clkmouse_cnt = 5;
- m_clkmouse_cmd[4] = 'A';
- m_clkmouse_cmd[3] = dx & 0xff;
- m_clkmouse_cmd[2] = dx >> 8;
- m_clkmouse_cmd[1] = dy & 0xff;
- m_clkmouse_cmd[0] = dy >> 8;
- m_pic1->ir2_w(1);
- break;
- }
- case MCU_DELAY:
- m_pic1->ir2_w(1);
- break;
- }
+ uint16_t x = m_x_axis->read();
+ uint16_t y = m_y_axis->read();
+ uint16_t dx = x - m_mouse_x;
+ uint16_t dy = y - m_mouse_y;
+ m_mouse_x = x;
+ m_mouse_y = y;
+ m_clkmouse_cnt = 5;
+ m_clkmouse_cmd[4] = 'A';
+ m_clkmouse_cmd[3] = dx & 0xff;
+ m_clkmouse_cmd[2] = dx >> 8;
+ m_clkmouse_cmd[1] = dy & 0xff;
+ m_clkmouse_cmd[0] = dy >> 8;
+ m_pic1->ir2_w(1);
+}
+
+TIMER_CALLBACK_MEMBER(tandy2k_state::mcu_delay_cb)
+{
+ m_pic1->ir2_w(1);
}
rgb_t tandy2k_state::IRGB(uint32_t raw)
diff --git a/src/mame/drivers/tank8.cpp b/src/mame/drivers/tank8.cpp
index 9035c27a1bf..06114fc4d39 100644
--- a/src/mame/drivers/tank8.cpp
+++ b/src/mame/drivers/tank8.cpp
@@ -15,11 +15,11 @@ Atari Tank 8 driver
-void tank8_state::set_collision(int index)
+TIMER_CALLBACK_MEMBER(tank8_state::set_collision)
{
m_maincpu->set_input_line(0, ASSERT_LINE);
- m_collision_index = index;
+ m_collision_index = param;
}
diff --git a/src/mame/drivers/targeth.cpp b/src/mame/drivers/targeth.cpp
index 072079fc2c1..3c520c4d268 100644
--- a/src/mame/drivers/targeth.cpp
+++ b/src/mame/drivers/targeth.cpp
@@ -176,8 +176,8 @@ void targeth_state::machine_start()
{
m_okibank->configure_entries(0, 16, memregion("oki")->base(), 0x10000);
- m_gun_irq_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(targeth_state::gun1_irq), this));
- m_gun_irq_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(targeth_state::gun2_irq), this));
+ m_gun_irq_timer[0] = timer_alloc(FUNC(targeth_state::gun1_irq), this);
+ m_gun_irq_timer[1] = timer_alloc(FUNC(targeth_state::gun2_irq), this);
m_gun_irq_timer[0]->adjust(m_screen->time_until_pos(128, 0));
m_gun_irq_timer[1]->adjust(m_screen->time_until_pos(160, 0));
diff --git a/src/mame/drivers/techno.cpp b/src/mame/drivers/techno.cpp
index 5ba1bdea36d..0fb0442a97f 100644
--- a/src/mame/drivers/techno.cpp
+++ b/src/mame/drivers/techno.cpp
@@ -55,11 +55,15 @@ public:
void techno(machine_config &config);
private:
- enum
- {
- IRQ_SET_TIMER,
- IRQ_ADVANCE_TIMER
- };
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
+ void mem_map(address_map &map);
+ void audio_map(address_map &map);
+ void cpu_space_map(address_map &map);
+
+ TIMER_CALLBACK_MEMBER(set_irq1);
+ TIMER_CALLBACK_MEMBER(clear_irq1);
u16 key_r();
u16 rtrg_r();
@@ -76,14 +80,6 @@ private:
u8 pa_r();
void pb_w(u8);
- void mem_map(address_map &map);
- void audio_map(address_map &map);
- void cpu_space_map(address_map &map);
-
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
- virtual void machine_start() override;
- virtual void machine_reset() override;
-
required_device<m68000_device> m_maincpu;
required_device<tms7000_device> m_audiocpu;
required_device<dac_byte_interface> m_dac;
@@ -314,23 +310,21 @@ static INPUT_PORTS_START( techno )
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("Fix top left target middle")
INPUT_PORTS_END
-void techno_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(techno_state::clear_irq1)
{
- if (id == IRQ_ADVANCE_TIMER)
- {
- // vectors change per int: 88-8F, 98-9F)
- if ((m_vector & 7) == 7)
- m_vector = (m_vector ^ 0x10) & 0x97;
- m_vector++;
+ // vectors change per int: 88-8F, 98-9F)
+ if ((m_vector & 7) == 7)
+ m_vector = (m_vector ^ 0x10) & 0x97;
+ m_vector++;
- // schematics show a 74HC74 cleared only upon IRQ acknowledgment or reset, but this is clearly incorrect for xforce
- m_maincpu->set_input_line(M68K_IRQ_1, CLEAR_LINE);
- }
- else if (id == IRQ_SET_TIMER)
- {
- m_maincpu->set_input_line(M68K_IRQ_1, ASSERT_LINE);
- m_irq_advance_timer->adjust(attotime::from_hz(XTAL(8'000'000) / 32));
- }
+ // schematics show a 74HC74 cleared only upon IRQ acknowledgment or reset, but this is clearly incorrect for xforce
+ m_maincpu->set_input_line(M68K_IRQ_1, CLEAR_LINE);
+}
+
+TIMER_CALLBACK_MEMBER(techno_state::set_irq1)
+{
+ m_maincpu->set_input_line(M68K_IRQ_1, ASSERT_LINE);
+ m_irq_advance_timer->adjust(attotime::from_hz(XTAL(8'000'000) / 32));
}
// E04C
@@ -368,8 +362,8 @@ void techno_state::machine_start()
save_item(NAME(m_snd_ack));
save_item(NAME(m_last_solenoid));
- m_irq_set_timer = timer_alloc(IRQ_SET_TIMER);
- m_irq_advance_timer = timer_alloc(IRQ_ADVANCE_TIMER);
+ m_irq_set_timer = timer_alloc(FUNC(techno_state::set_irq1), this);
+ m_irq_advance_timer = timer_alloc(FUNC(techno_state::clear_irq1), this);
}
void techno_state::machine_reset()
@@ -384,6 +378,7 @@ void techno_state::machine_reset()
attotime freq = attotime::from_hz(XTAL(8'000'000) / 256); // 31250Hz
m_irq_set_timer->adjust(freq, 0, freq);
+ m_irq_advance_timer->adjust(attotime::never);
m_maincpu->set_input_line(M68K_IRQ_1, CLEAR_LINE);
}
diff --git a/src/mame/drivers/tehkanwc.cpp b/src/mame/drivers/tehkanwc.cpp
index f254973d3c8..806a3504016 100644
--- a/src/mame/drivers/tehkanwc.cpp
+++ b/src/mame/drivers/tehkanwc.cpp
@@ -102,7 +102,7 @@ TO DO :
void tehkanwc_state::machine_start()
{
- m_reset_timer = timer_alloc(TIMER_RESET);
+ m_reset_timer = timer_alloc(FUNC(tehkanwc_state::reset_audiocpu), this);
save_item(NAME(m_track0));
save_item(NAME(m_track1));
@@ -161,16 +161,9 @@ void tehkanwc_state::sound_command_w(uint8_t data)
m_audiocpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero);
}
-void tehkanwc_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(tehkanwc_state::reset_audiocpu)
{
- switch (id)
- {
- case TIMER_RESET:
- m_audiocpu->pulse_input_line(INPUT_LINE_RESET, attotime::zero);
- break;
- default:
- throw emu_fatalerror("Unknown id in tehkanwc_state::device_timer");
- }
+ m_audiocpu->pulse_input_line(INPUT_LINE_RESET, attotime::zero);
}
void tehkanwc_state::sound_answer_w(uint8_t data)
diff --git a/src/mame/drivers/tekigw.cpp b/src/mame/drivers/tekigw.cpp
index bb2789e2733..3000d55ccd3 100644
--- a/src/mame/drivers/tekigw.cpp
+++ b/src/mame/drivers/tekigw.cpp
@@ -236,7 +236,7 @@ void tekigw_state_base::machine_start()
m_parity_check = false;
- m_buserror = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tek4132_state::buserror), this));
+ m_buserror = timer_alloc(FUNC(tek4132_state::buserror), this);
}
void tekigw_state_base::machine_reset()
diff --git a/src/mame/drivers/teleray10.cpp b/src/mame/drivers/teleray10.cpp
index 2aa362e4dec..5f9876781de 100644
--- a/src/mame/drivers/teleray10.cpp
+++ b/src/mame/drivers/teleray10.cpp
@@ -88,7 +88,7 @@ private:
void teleray10_state::machine_start()
{
- m_bell_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(teleray10_state::bell_toggle), this));
+ m_bell_timer = timer_alloc(FUNC(teleray10_state::bell_toggle), this);
m_topr = 0;
m_timer_expired = false;
diff --git a/src/mame/drivers/thayers.cpp b/src/mame/drivers/thayers.cpp
index 97f343071a9..5b5ce89b9cf 100644
--- a/src/mame/drivers/thayers.cpp
+++ b/src/mame/drivers/thayers.cpp
@@ -56,14 +56,23 @@ public:
DECLARE_READ_LINE_MEMBER(laserdisc_ready_r);
private:
- enum
- {
- TIMER_INTRQ_TICK,
- TIMER_SSI263_PHONEME_TICK
- };
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
+ void thayers_map(address_map &map);
+ void thayers_io_map(address_map &map);
+
+ TIMER_CALLBACK_MEMBER(intrq_tick);
+ TIMER_CALLBACK_MEMBER(phoneme_tick);
optional_device<pioneer_pr7820_device> m_pr7820;
optional_device<pioneer_ldv1000_device> m_ldv1000;
+ required_device<cpu_device> m_maincpu;
+ required_ioport_array<10> m_row;
+ output_finder<16> m_digits;
+
+ emu_timer *m_intrq_timer = nullptr;
+ emu_timer *m_phoneme_timer = nullptr;
uint8_t m_laserdisc_data = 0;
int m_rx_bit = 0;
int m_keylatch = 0;
@@ -80,6 +89,7 @@ private:
int m_cart_present = 0;
int m_pr7820_enter = 0;
struct ssi263_t m_ssi263;
+
void intrq_w(uint8_t data);
uint8_t irqstate_r();
void timer_int_ack_w(uint8_t data);
@@ -104,37 +114,22 @@ private:
void ssi263_register_w(offs_t offset, uint8_t data);
uint8_t ssi263_register_r();
- virtual void machine_start() override;
- virtual void machine_reset() override;
void check_interrupt();
- required_device<cpu_device> m_maincpu;
- required_ioport_array<10> m_row;
- output_finder<16> m_digits;
-
- void thayers_io_map(address_map &map);
- void thayers_map(address_map &map);
-
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
};
static const uint8_t led_map[16] = { 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7c, 0x07, 0x7f, 0x67, 0x77, 0x7c, 0x39, 0x5e, 0x79, 0x00 };
/* Interrupts */
-void thayers_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(thayers_state::intrq_tick)
{
- switch (id)
- {
- case TIMER_INTRQ_TICK:
- m_maincpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE);
- break;
- case TIMER_SSI263_PHONEME_TICK:
- m_ssi_data_request = 0;
- check_interrupt();
- break;
- default:
- throw emu_fatalerror("Unknown id in thayers_state::device_timer");
- }
+ m_maincpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE);
+}
+
+TIMER_CALLBACK_MEMBER(thayers_state::phoneme_tick)
+{
+ m_ssi_data_request = 0;
+ check_interrupt();
}
void thayers_state::check_interrupt()
@@ -155,7 +150,7 @@ void thayers_state::intrq_w(uint8_t data)
m_maincpu->set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE);
- timer_set(attotime::from_usec(8250), TIMER_INTRQ_TICK);
+ m_intrq_timer->adjust(attotime::from_usec(8250));
}
uint8_t thayers_state::irqstate_r()
@@ -533,11 +528,11 @@ void thayers_state::ssi263_register_w(offs_t offset, uint8_t data)
case 0:
case 1:
// phoneme timing response
- timer_set(attotime::from_usec(phoneme_time), TIMER_SSI263_PHONEME_TICK);
+ m_phoneme_timer->adjust(attotime::from_usec(phoneme_time));
break;
case 2:
// frame timing response
- timer_set(attotime::from_usec(frame_time), TIMER_SSI263_PHONEME_TICK);
+ m_phoneme_timer->adjust(attotime::from_usec(frame_time));
break;
case 3:
// disable A/_R output
@@ -772,6 +767,9 @@ void thayers_state::machine_start()
{
m_digits.resolve();
memset(&m_ssi263, 0, sizeof(m_ssi263));
+
+ m_intrq_timer = timer_alloc(FUNC(thayers_state::intrq_tick), this);
+ m_phoneme_timer = timer_alloc(FUNC(thayers_state::phoneme_tick), this);
}
void thayers_state::machine_reset()
@@ -794,6 +792,9 @@ void thayers_state::machine_reset()
m_cart_present = 0;
m_pr7820_enter = 0;
+
+ m_intrq_timer->adjust(attotime::never);
+ m_phoneme_timer->adjust(attotime::never);
}
/* Machine Driver */
diff --git a/src/mame/drivers/thunderx.cpp b/src/mame/drivers/thunderx.cpp
index f2fa77c45e5..2295ef4f80d 100644
--- a/src/mame/drivers/thunderx.cpp
+++ b/src/mame/drivers/thunderx.cpp
@@ -1057,7 +1057,7 @@ ROM_END
void thunderx_state::init_thunderx()
{
- m_thunderx_firq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(thunderx_state::thunderx_firq_cb), this));
+ m_thunderx_firq_timer = timer_alloc(FUNC(thunderx_state::thunderx_firq_cb), this);
}
/***************************************************************************/
diff --git a/src/mame/drivers/ti990_10.cpp b/src/mame/drivers/ti990_10.cpp
index 3faa96751b4..b16f9ee9dd3 100644
--- a/src/mame/drivers/ti990_10.cpp
+++ b/src/mame/drivers/ti990_10.cpp
@@ -88,33 +88,34 @@ public:
, m_intlines(0)
, m_ckon_state(0) { }
- void init_ti990_10();
-
void ti990_10(machine_config &config);
protected:
+ virtual void machine_start() override;
virtual void machine_reset() override;
private:
+ void main_map(address_map &map);
+ void io_map(address_map &map);
+
WRITE_LINE_MEMBER( key_interrupt );
WRITE_LINE_MEMBER( line_interrupt );
WRITE_LINE_MEMBER( tape_interrupt );
- WRITE_LINE_MEMBER(ti990_set_int13);
- WRITE_LINE_MEMBER(ti990_ckon_ckof_callback);
- uint8_t ti990_panel_read(offs_t offset);
- void ti990_panel_write(uint8_t data);
+ WRITE_LINE_MEMBER( set_int13 );
+ WRITE_LINE_MEMBER( ckon_ckof_callback );
+ uint8_t panel_read(offs_t offset);
+ void panel_write(uint8_t data);
TIMER_CALLBACK_MEMBER(clear_load);
- void ti990_hold_load();
- void ti990_set_int_line(int line, int state);
+ void hold_load();
+ void set_int_line(int line, int state);
required_device<cpu_device> m_maincpu;
required_device<vdt911_device> m_terminal;
uint16_t m_intlines;
int m_ckon_state;
- void ti990_10_io(address_map &map);
- void ti990_10_memmap(address_map &map);
+ emu_timer* m_load_timer = nullptr;
};
@@ -122,7 +123,7 @@ private:
Interrupt priority encoder. Actually part of the CPU board.
*/
-void ti990_10_state::ti990_set_int_line(int line, int state)
+void ti990_10_state::set_int_line(int line, int state)
{
int level;
@@ -143,9 +144,9 @@ void ti990_10_state::ti990_set_int_line(int line, int state)
}
-WRITE_LINE_MEMBER(ti990_10_state::ti990_set_int13)
+WRITE_LINE_MEMBER(ti990_10_state::set_int13)
{
- ti990_set_int_line(13, state);
+ set_int_line(13, state);
}
/*
@@ -157,10 +158,10 @@ TIMER_CALLBACK_MEMBER(ti990_10_state::clear_load)
m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
}
-void ti990_10_state::ti990_hold_load()
+void ti990_10_state::hold_load()
{
m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
- machine().scheduler().timer_set(attotime::from_msec(100), timer_expired_delegate(FUNC(ti990_10_state::clear_load),this));
+ m_load_timer->adjust(attotime::from_msec(100));
}
/*
@@ -173,14 +174,14 @@ WRITE_LINE_MEMBER(ti990_10_state::line_interrupt)
{
// set_int10(state);
if (m_ckon_state)
- ti990_set_int_line(5, 1);
+ set_int_line(5, 1);
}
-WRITE_LINE_MEMBER(ti990_10_state::ti990_ckon_ckof_callback)
+WRITE_LINE_MEMBER(ti990_10_state::ckon_ckof_callback)
{
m_ckon_state = state;
if (! m_ckon_state)
- ti990_set_int_line(5, 0);
+ set_int_line(5, 0);
}
@@ -230,7 +231,7 @@ WRITE_LINE_MEMBER(ti990_10_state::ti990_ckon_ckof_callback)
F: flag (according to 990 handbook)
*/
-uint8_t ti990_10_state::ti990_panel_read(offs_t offset)
+uint8_t ti990_10_state::panel_read(offs_t offset)
{
if (offset == 1)
return 0x48;
@@ -238,14 +239,25 @@ uint8_t ti990_10_state::ti990_panel_read(offs_t offset)
return 0;
}
-void ti990_10_state::ti990_panel_write(uint8_t data)
+void ti990_10_state::panel_write(uint8_t data)
{
}
+void ti990_10_state::machine_start()
+{
+ m_load_timer = timer_alloc(FUNC(ti990_10_state::clear_load), this);
+
+#if 0
+ /* load specific ti990/12 rom page */
+ const int page = 3;
+
+ memmove(memregion("maincpu")->base() + 0x1ffc00, memregion("maincpu")->base() + 0x1ffc00 + page * 0x400, 0x400);
+#endif
+}
void ti990_10_state::machine_reset()
{
- ti990_hold_load();
+ hold_load();
}
/*
@@ -259,7 +271,7 @@ void ti990_10_state::rset_callback)
void ti990_10_state::lrex_callback)
{
// right???
- ti990_hold_load();
+ hold_load();
}
*/
@@ -278,7 +290,7 @@ WRITE_LINE_MEMBER(ti990_10_state::key_interrupt)
Memory map - see description above
*/
-void ti990_10_state::ti990_10_memmap(address_map &map)
+void ti990_10_state::main_map(address_map &map)
{
map(0x000000, 0x0fffff).ram(); /* let's say we have 1MB of RAM */
@@ -296,16 +308,16 @@ void ti990_10_state::ti990_10_memmap(address_map &map)
CRU map
*/
-void ti990_10_state::ti990_10_io(address_map &map)
+void ti990_10_state::io_map(address_map &map)
{
map(0x10, 0x11).r(m_terminal, FUNC(vdt911_device::cru_r));
map(0x80, 0x8f).w(m_terminal, FUNC(vdt911_device::cru_w));
map(0x1fa, 0x1fb).noprw(); // .r(FUNC(ti990_10_state::ti990_10_mapper_cru_r));
map(0x1fc, 0x1fd).noprw(); // .r(FUNC(ti990_10_state::ti990_10_eir_cru_r));
- map(0x1fe, 0x1ff).r(FUNC(ti990_10_state::ti990_panel_read));
+ map(0x1fe, 0x1ff).r(FUNC(ti990_10_state::panel_read));
map(0xfd0, 0xfdf).noprw(); // .w(FUNC(ti990_10_state::ti990_10_mapper_cru_w));
map(0xfe0, 0xfef).noprw(); // .w(FUNC(ti990_10_state::ti990_10_eir_cru_w));
- map(0xff0, 0xfff).w(FUNC(ti990_10_state::ti990_panel_write));
+ map(0xff0, 0xfff).w(FUNC(ti990_10_state::panel_write));
}
@@ -322,8 +334,8 @@ void ti990_10_state::ti990_10(machine_config &config)
/* basic machine hardware */
/* TI990/10 CPU @ 4.0(???) MHz */
TI990_10(config, m_maincpu, 4000000);
- m_maincpu->set_addrmap(AS_PROGRAM, &ti990_10_state::ti990_10_memmap);
- m_maincpu->set_addrmap(AS_IO, &ti990_10_state::ti990_10_io);
+ m_maincpu->set_addrmap(AS_PROGRAM, &ti990_10_state::main_map);
+ m_maincpu->set_addrmap(AS_IO, &ti990_10_state::io_map);
// VDT 911 terminal
VDT911(config, m_terminal, 0);
@@ -333,7 +345,7 @@ void ti990_10_state::ti990_10(machine_config &config)
// Hard disk
ti990_hdc_device &hdc(TI990_HDC(config, "hdc", 0));
hdc.set_memory_space(m_maincpu, AS_PROGRAM);
- hdc.int_cb().set(FUNC(ti990_10_state::ti990_set_int13));
+ hdc.int_cb().set(FUNC(ti990_10_state::set_int13));
// Tape controller
tap_990_device &tpc(TI990_TAPE_CTRL(config, "tpc", 0));
@@ -386,15 +398,5 @@ ROM_START(ti990_10)
ROM_END
-void ti990_10_state::init_ti990_10()
-{
-#if 0
- /* load specific ti990/12 rom page */
- const int page = 3;
-
- memmove(memregion("maincpu")->base()+0x1FFC00, memregion("maincpu")->base()+0x1FFC00+(page*0x400), 0x400);
-#endif
-}
-
-// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS
-COMP( 1975, ti990_10, 0, 0, ti990_10, 0, ti990_10_state, init_ti990_10, "Texas Instruments", "TI Model 990/10 Minicomputer System", MACHINE_NOT_WORKING )
+// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS
+COMP( 1975, ti990_10, 0, 0, ti990_10, 0, ti990_10_state, empty_init, "Texas Instruments", "TI Model 990/10 Minicomputer System", MACHINE_NOT_WORKING )
diff --git a/src/mame/drivers/ti990_4.cpp b/src/mame/drivers/ti990_4.cpp
index 8af87c0ef33..8e82cc5c2b3 100644
--- a/src/mame/drivers/ti990_4.cpp
+++ b/src/mame/drivers/ti990_4.cpp
@@ -58,10 +58,10 @@ public:
void ti990_4v(machine_config &config);
void ti990_4(machine_config &config);
- void init_ti990_4();
- void init_ti990_4v();
-
private:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
uint8_t panel_read(offs_t offset);
void panel_write(offs_t offset, uint8_t data);
void external_operation(offs_t offset, uint8_t data);
@@ -71,17 +71,16 @@ private:
DECLARE_WRITE_LINE_MEMBER( vdtkey_interrupt );
DECLARE_WRITE_LINE_MEMBER( line_interrupt );
- DECLARE_MACHINE_RESET(ti990_4);
-
void crumap(address_map &map);
void crumap_v(address_map &map);
void memmap(address_map &map);
void hold_load();
- void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(clear_load);
+
int m_intlines = 0;
int m_int_level = 0;
- emu_timer* m_nmi_timer = nullptr;
+ emu_timer* m_load_timer = nullptr;
void reset_int_lines();
void set_int_line(int line, int state);
@@ -92,22 +91,17 @@ private:
required_device<fd800_legacy_device> m_fd800;
};
-enum
-{
- NMI_TIMER_ID = 1
-};
-
void ti990_4_state::hold_load()
{
m_maincpu->set_input_line(INT_9900_LOAD, ASSERT_LINE);
logerror("ti990_4: Triggering LOAD interrupt\n");
- m_nmi_timer->adjust(attotime::from_msec(100));
+ m_load_timer->adjust(attotime::from_msec(100));
}
/*
LOAD interrupt trigger callback
*/
-void ti990_4_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(ti990_4_state::clear_load)
{
m_maincpu->set_input_line(INT_9900_LOAD, CLEAR_LINE);
logerror("ti990_4: Released LOAD interrupt\n");
@@ -268,7 +262,12 @@ void ti990_4_state::crumap_v(address_map &map)
nullptr
}; */
-MACHINE_RESET_MEMBER(ti990_4_state,ti990_4)
+void ti990_4_state::machine_start()
+{
+ m_load_timer = timer_alloc(FUNC(ti990_4_state::clear_load), this);
+}
+
+void ti990_4_state::machine_reset()
{
hold_load();
reset_int_lines();
@@ -276,11 +275,6 @@ MACHINE_RESET_MEMBER(ti990_4_state,ti990_4)
m_maincpu->set_ready(ASSERT_LINE);
}
-void ti990_4_state::init_ti990_4()
-{
- m_nmi_timer = timer_alloc(NMI_TIMER_ID);
-}
-
void ti990_4_state::ti990_4(machine_config &config)
{
/* basic machine hardware */
@@ -291,8 +285,6 @@ void ti990_4_state::ti990_4(machine_config &config)
m_maincpu->extop_cb().set(FUNC(ti990_4_state::external_operation));
m_maincpu->intlevel_cb().set(FUNC(ti990_4_state::interrupt_level));
- MCFG_MACHINE_RESET_OVERRIDE(ti990_4_state, ti990_4 )
-
// Terminal
asr733_device& term(ASR733(config, "asr733", 0));
term.keyint_cb().set(FUNC(ti990_4_state::asrkey_interrupt));
@@ -365,6 +357,6 @@ ROM_START(ti990_4v)
ROM_REGION(vdt911_device::chr_region_len, vdt911_chr_region, ROMREGION_ERASEFF)
ROM_END
-// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS
-COMP( 1976, ti990_4, 0, 0, ti990_4, 0, ti990_4_state, init_ti990_4, "Texas Instruments", "TI Model 990/4 Microcomputer System", MACHINE_NOT_WORKING | MACHINE_NO_SOUND )
-COMP( 1976, ti990_4v, ti990_4, 0, ti990_4v, 0, ti990_4_state, init_ti990_4, "Texas Instruments", "TI Model 990/4 Microcomputer System with Video Display Terminal", MACHINE_NOT_WORKING | MACHINE_NO_SOUND )
+// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS
+COMP( 1976, ti990_4, 0, 0, ti990_4, 0, ti990_4_state, empty_init, "Texas Instruments", "TI Model 990/4 Microcomputer System", MACHINE_NOT_WORKING | MACHINE_NO_SOUND )
+COMP( 1976, ti990_4v, ti990_4, 0, ti990_4v, 0, ti990_4_state, empty_init, "Texas Instruments", "TI Model 990/4 Microcomputer System with Video Display Terminal", MACHINE_NOT_WORKING | MACHINE_NO_SOUND )
diff --git a/src/mame/drivers/ti99_4x.cpp b/src/mame/drivers/ti99_4x.cpp
index 463c2498bff..d2caef21afc 100644
--- a/src/mame/drivers/ti99_4x.cpp
+++ b/src/mame/drivers/ti99_4x.cpp
@@ -162,7 +162,7 @@ private:
// Used by EVPC
DECLARE_WRITE_LINE_MEMBER( video_interrupt_evpc_in );
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(gromclk_tick);
void crumap(address_map &map);
void memmap(address_map &map);
@@ -722,7 +722,7 @@ WRITE_LINE_MEMBER( ti99_4x_state::gromclk_in )
/*
Used by the EVPC
*/
-void ti99_4x_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(ti99_4x_state::gromclk_tick)
{
// Pulse it
if (m_datamux != nullptr)
@@ -863,7 +863,7 @@ void ti99_4x_state::driver_start()
// Removing the TMS9928a requires to add a replacement for the GROMCLK.
// In the real hardware this is a circuit (REPL99x) that fits into the VDP socket
if (m_model == MODEL_4EV)
- m_gromclk_timer = timer_alloc(0);
+ m_gromclk_timer = timer_alloc(FUNC(ti99_4x_state::gromclk_tick), this);
save_item(NAME(m_keyboard_column));
save_item(NAME(m_check_alphalock));
diff --git a/src/mame/drivers/tickee.cpp b/src/mame/drivers/tickee.cpp
index fb8dadde19d..9f4603f2a40 100644
--- a/src/mame/drivers/tickee.cpp
+++ b/src/mame/drivers/tickee.cpp
@@ -69,6 +69,8 @@ private:
optional_shared_ptr<uint16_t> m_control;
emu_timer *m_setup_gun_timer = nullptr;
+ emu_timer *m_set_gun_int_timer[2]{};
+ emu_timer *m_clear_gun_int_timer[2]{};
int m_beamxadd = 0;
int m_beamyadd = 0;
int m_palette_bank = 0;
@@ -87,6 +89,7 @@ private:
void sound_bank_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
DECLARE_MACHINE_RESET(tickee);
DECLARE_VIDEO_START(tickee);
+ DECLARE_VIDEO_RESET(tickee);
DECLARE_MACHINE_RESET(rapidfir);
TIMER_CALLBACK_MEMBER(trigger_gun_interrupt);
TIMER_CALLBACK_MEMBER(clear_gun_interrupt);
@@ -101,8 +104,6 @@ private:
void mouseatk_map(address_map &map);
void rapidfir_map(address_map &map);
void tickee_map(address_map &map);
-
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
};
@@ -133,25 +134,6 @@ inline void tickee_state::get_crosshair_xy(int player, int &x, int &y)
*
*************************************/
-void tickee_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_TRIGGER_GUN_INTERRUPT:
- trigger_gun_interrupt(param);
- break;
- case TIMER_CLEAR_GUN_INTERRUPT:
- clear_gun_interrupt(param);
- break;
- case TIMER_SETUP_GUN_INTERRUPTS:
- setup_gun_interrupts(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in tickee_state::device_timer");
- }
-}
-
-
TIMER_CALLBACK_MEMBER(tickee_state::trigger_gun_interrupt)
{
int which = param & 1;
@@ -186,13 +168,13 @@ TIMER_CALLBACK_MEMBER(tickee_state::setup_gun_interrupts)
/* generate interrupts for player 1's gun */
get_crosshair_xy(0, beamx, beamy);
- timer_set(m_screen->time_until_pos(beamy + m_beamyadd, beamx + m_beamxadd), TIMER_TRIGGER_GUN_INTERRUPT, 0);
- timer_set(m_screen->time_until_pos(beamy + m_beamyadd + 1, beamx + m_beamxadd), TIMER_CLEAR_GUN_INTERRUPT, 0);
+ m_set_gun_int_timer[0]->adjust(m_screen->time_until_pos(beamy + m_beamyadd, beamx + m_beamxadd), 0);
+ m_clear_gun_int_timer[0]->adjust(m_screen->time_until_pos(beamy + m_beamyadd + 1, beamx + m_beamxadd), 0);
/* generate interrupts for player 2's gun */
get_crosshair_xy(1, beamx, beamy);
- timer_set(m_screen->time_until_pos(beamy + m_beamyadd, beamx + m_beamxadd), TIMER_TRIGGER_GUN_INTERRUPT, 1);
- timer_set(m_screen->time_until_pos(beamy + m_beamyadd + 1, beamx + m_beamxadd), TIMER_CLEAR_GUN_INTERRUPT, 1);
+ m_set_gun_int_timer[1]->adjust(m_screen->time_until_pos(beamy + m_beamyadd, beamx + m_beamxadd), 1);
+ m_clear_gun_int_timer[1]->adjust(m_screen->time_until_pos(beamy + m_beamyadd + 1, beamx + m_beamxadd), 1);
}
@@ -206,10 +188,24 @@ TIMER_CALLBACK_MEMBER(tickee_state::setup_gun_interrupts)
VIDEO_START_MEMBER(tickee_state,tickee)
{
/* start a timer going on the first scanline of every frame */
- m_setup_gun_timer = timer_alloc(TIMER_SETUP_GUN_INTERRUPTS);
- m_setup_gun_timer->adjust(m_screen->time_until_pos(0));
+ m_setup_gun_timer = timer_alloc(FUNC(tickee_state::setup_gun_interrupts), this);
+
+ /* initialize gun set/clear interrupts for both players */
+ m_set_gun_int_timer[0] = timer_alloc(FUNC(tickee_state::trigger_gun_interrupt), this);
+ m_set_gun_int_timer[1] = timer_alloc(FUNC(tickee_state::trigger_gun_interrupt), this);
+ m_clear_gun_int_timer[0] = timer_alloc(FUNC(tickee_state::clear_gun_interrupt), this);
+ m_clear_gun_int_timer[1] = timer_alloc(FUNC(tickee_state::clear_gun_interrupt), this);
}
+VIDEO_RESET_MEMBER(tickee_state,tickee)
+{
+ m_setup_gun_timer->adjust(m_screen->time_until_pos(0));
+
+ m_set_gun_int_timer[0]->adjust(attotime::never);
+ m_set_gun_int_timer[1]->adjust(attotime::never);
+ m_clear_gun_int_timer[0]->adjust(attotime::never);
+ m_clear_gun_int_timer[1]->adjust(attotime::never);
+}
/*************************************
@@ -772,6 +768,7 @@ void tickee_state::tickee(machine_config &config)
TLC34076(config, m_tlc34076, tlc34076_device::TLC34076_6_BIT);
MCFG_VIDEO_START_OVERRIDE(tickee_state,tickee)
+ MCFG_VIDEO_RESET_OVERRIDE(tickee_state,tickee)
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_raw(VIDEO_CLOCK/2, 444, 0, 320, 233, 0, 200);
diff --git a/src/mame/drivers/tm990189.cpp b/src/mame/drivers/tm990189.cpp
index ee9c3673305..e725dc252f8 100644
--- a/src/mame/drivers/tm990189.cpp
+++ b/src/mame/drivers/tm990189.cpp
@@ -102,6 +102,8 @@ public:
DECLARE_INPUT_CHANGED_MEMBER( load_interrupt );
private:
+ virtual void machine_reset() override;
+
uint8_t video_vdp_r(offs_t offset);
void video_vdp_w(offs_t offset, uint8_t data);
uint8_t video_joy_r();
@@ -138,11 +140,9 @@ private:
void xmit_callback(uint8_t data);
DECLARE_MACHINE_START(tm990_189);
- DECLARE_MACHINE_RESET(tm990_189);
DECLARE_MACHINE_START(tm990_189_v);
- DECLARE_MACHINE_RESET(tm990_189_v);
- emu_timer *m_rs232_input_timer = 0;
+ emu_timer *m_load_timer = nullptr;
void tm990_189_cru_map(address_map &map);
void tm990_189_memmap(address_map &map);
@@ -188,13 +188,6 @@ private:
#define displayena_duration attotime::from_usec(4500) /* Can anyone confirm this? 74LS123 connected to C=0.1uF and R=100kOhm */
-MACHINE_RESET_MEMBER(tm990189_state,tm990_189)
-{
- m_tms9980a->set_ready(ASSERT_LINE);
- m_tms9980a->set_hold(CLEAR_LINE);
- hold_load();
-}
-
MACHINE_START_MEMBER(tm990189_state,tm990_189)
{
m_digits.resolve();
@@ -203,24 +196,21 @@ MACHINE_START_MEMBER(tm990189_state,tm990_189)
m_digitsel = 0;
m_LED_state = 0;
+
+ m_load_timer = timer_alloc(FUNC(tm990189_state::clear_load), this);
}
MACHINE_START_MEMBER(tm990189_state,tm990_189_v)
{
- m_digits.resolve();
- m_leds.resolve();
- m_displayena_timer = machine().scheduler().timer_alloc(timer_expired_delegate());
+ MACHINE_START_CALL_MEMBER(tm990_189);
m_joy1x_timer = machine().scheduler().timer_alloc(timer_expired_delegate());
m_joy1y_timer = machine().scheduler().timer_alloc(timer_expired_delegate());
m_joy2x_timer = machine().scheduler().timer_alloc(timer_expired_delegate());
m_joy2y_timer = machine().scheduler().timer_alloc(timer_expired_delegate());
-
- m_digitsel = 0;
- m_LED_state = 0;
}
-MACHINE_RESET_MEMBER(tm990189_state,tm990_189_v)
+void tm990189_state::machine_reset()
{
m_tms9980a->set_ready(ASSERT_LINE);
m_tms9980a->set_hold(CLEAR_LINE);
@@ -241,7 +231,7 @@ void tm990189_state::hold_load()
{
m_load_state = true;
m_tms9980a->set_input_line(INT_9980A_LOAD, ASSERT_LINE);
- machine().scheduler().timer_set(attotime::from_msec(100), timer_expired_delegate(FUNC(tm990189_state::clear_load),this));
+ m_load_timer->adjust(attotime::from_msec(100));
}
/*
@@ -496,9 +486,11 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(rs232_input_tick);
required_device<tms9902_device> m_tms9902;
+ emu_timer *m_rs232_input_timer = nullptr;
};
DEFINE_DEVICE_TYPE(TM990_189_RS232, tm990_189_rs232_image_device, "tm990_189_rs232_image", "TM990/189 RS232 port")
@@ -512,9 +504,10 @@ tm990_189_rs232_image_device::tm990_189_rs232_image_device(const machine_config
void tm990_189_rs232_image_device::device_start()
{
+ m_rs232_input_timer = timer_alloc(FUNC(tm990_189_rs232_image_device::rs232_input_tick), this);
}
-void tm990_189_rs232_image_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(tm990_189_rs232_image_device::rs232_input_tick)
{
uint8_t buf;
if (/*m_rs232_rts &&*/ /*(mame_ftell(m_rs232_fp) < mame_fsize(m_rs232_fp))*/1)
@@ -526,20 +519,16 @@ void tm990_189_rs232_image_device::device_timer(emu_timer &timer, device_timer_i
image_init_result tm990_189_rs232_image_device::call_load()
{
- tm990189_state *state = machine().driver_data<tm990189_state>();
m_tms9902->rcv_dsr(ASSERT_LINE);
- state->m_rs232_input_timer = timer_alloc();
- state->m_rs232_input_timer->adjust(attotime::zero, 0, attotime::from_msec(10));
+ m_rs232_input_timer->adjust(attotime::zero, 0, attotime::from_msec(10));
return image_init_result::PASS;
}
void tm990_189_rs232_image_device::call_unload()
{
- tm990189_state *state = machine().driver_data<tm990189_state>();
m_tms9902->rcv_dsr(CLEAR_LINE);
-
- state->m_rs232_input_timer->reset(); /* FIXME - timers should only be allocated once */
+ m_rs232_input_timer->adjust(attotime::never);
}
@@ -850,7 +839,6 @@ void tm990189_state::tm990_189(machine_config &config)
m_tms9980a->extop_cb().set(FUNC(tm990189_state::external_operation));
MCFG_MACHINE_START_OVERRIDE(tm990189_state, tm990_189 )
- MCFG_MACHINE_RESET_OVERRIDE(tm990189_state, tm990_189 )
/* Video hardware */
config.set_default_layout(layout_tm990189);
@@ -909,7 +897,6 @@ void tm990189_state::tm990_189_v(machine_config &config)
m_tms9980a->extop_cb().set(FUNC(tm990189_state::external_operation));
MCFG_MACHINE_START_OVERRIDE(tm990189_state, tm990_189_v )
- MCFG_MACHINE_RESET_OVERRIDE(tm990189_state, tm990_189_v )
/* video hardware */
tms9918_device &vdp(TMS9918(config, "tms9918", XTAL(10'738'635)));
diff --git a/src/mame/drivers/tmc1800.cpp b/src/mame/drivers/tmc1800.cpp
index d8fa8e346c7..9f361088f05 100644
--- a/src/mame/drivers/tmc1800.cpp
+++ b/src/mame/drivers/tmc1800.cpp
@@ -515,7 +515,7 @@ INPUT_CHANGED_MEMBER( nano_state::monitor_pressed )
{
// TODO: what are the correct values?
int t = RES_K(27) * CAP_U(1) * 1000; // t = R26 * C1
- timer_set(attotime::from_msec(t), TIMER_ID_EF4);
+ m_ef4_timer->adjust(attotime::from_msec(t));
}
}
@@ -683,6 +683,10 @@ void tmc1800_state::machine_reset()
{
/* reset CDP1861 */
m_vdc->reset();
+
+ /* initialize beeper */
+ m_beeper->set_state(0);
+ m_beeper->set_clock(0);
}
// OSCOM 1000B
@@ -728,14 +732,9 @@ void tmc2000_state::machine_reset()
// OSCOM Nano
-void nano_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nano_state::assert_ef4)
{
- switch (id)
- {
- case TIMER_ID_EF4:
- m_maincpu->set_input_line(COSMAC_INPUT_LINE_EF4, ASSERT_LINE);
- break;
- }
+ m_maincpu->set_input_line(COSMAC_INPUT_LINE_EF4, ASSERT_LINE);
}
void nano_state::machine_start()
@@ -744,12 +743,15 @@ void nano_state::machine_start()
/* register for state saving */
save_item(NAME(m_keylatch));
+
+ /* allocate timers */
+ m_ef4_timer = timer_alloc(FUNC(nano_state::assert_ef4), this);
}
void nano_state::machine_reset()
{
/* assert EF4 */
- m_maincpu->set_input_line(COSMAC_INPUT_LINE_EF4, ASSERT_LINE);
+ m_ef4_timer->adjust(attotime::zero);
/* reset CDP1864 */
m_cti->reset();
@@ -925,30 +927,10 @@ ROM_START( nano )
ROM_LOAD( "mmi6349.ic", 0x000, 0x200, BAD_DUMP CRC(1ec1b432) SHA1(ac41f5e38bcd4b80bd7a5b277a2c600899fd5fb8) ) // equivalent to 82S141
ROM_END
-/* Driver Initialization */
-
-void tmc1800_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_SETUP_BEEP:
- m_beeper->set_state(0);
- m_beeper->set_clock(0);
- break;
- default:
- throw emu_fatalerror("Unknown id in tmc1800_state::device_timer");
- }
-}
-
-void tmc1800_state::init_tmc1800()
-{
- timer_set(attotime::zero, TIMER_SETUP_BEEP);
-}
-
/* System Drivers */
// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS
-COMP( 1977, tmc1800, 0, 0, tmc1800, tmc1800, tmc1800_state, init_tmc1800, "Telercas Oy", "Telmac 1800", MACHINE_NOT_WORKING )
+COMP( 1977, tmc1800, 0, 0, tmc1800, tmc1800, tmc1800_state, empty_init, "Telercas Oy", "Telmac 1800", MACHINE_NOT_WORKING )
COMP( 1977, osc1000b, tmc1800, 0, osc1000b, tmc1800, osc1000b_state, empty_init, "OSCOM Oy", "OSCOM 1000B", MACHINE_NOT_WORKING )
COMP( 1980, tmc2000, 0, 0, tmc2000, tmc2000, tmc2000_state, empty_init, "Telercas Oy", "Telmac 2000", MACHINE_SUPPORTS_SAVE )
COMP( 1980, nano, tmc2000, 0, nano, nano, nano_state, empty_init, "OSCOM Oy", "OSCOM Nano", MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/tmmjprd.cpp b/src/mame/drivers/tmmjprd.cpp
index 2730a5c1bab..b5a8d4fada5 100644
--- a/src/mame/drivers/tmmjprd.cpp
+++ b/src/mame/drivers/tmmjprd.cpp
@@ -506,7 +506,7 @@ void tmmjprd_state::blitter_w(offs_t offset, uint32_t data, uint32_t mem_mask)
void tmmjprd_state::machine_start()
{
#if EMULATE_BLITTER
- m_blit_done_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tmmjprd_state::blit_done), this));
+ m_blit_done_timer = timer_alloc(FUNC(tmmjprd_state::blit_done), this);
#endif
save_item(NAME(m_mux_data));
diff --git a/src/mame/drivers/tmnt.cpp b/src/mame/drivers/tmnt.cpp
index b8c07eb9167..e43c6b68593 100644
--- a/src/mame/drivers/tmnt.cpp
+++ b/src/mame/drivers/tmnt.cpp
@@ -337,23 +337,16 @@ void tmnt_state::sound_nmi_callback( int param )
}
#endif
-void tmnt_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(tmnt_state::audio_nmi)
{
- switch (id)
- {
- case TIMER_NMI:
- m_audiocpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
- break;
- default:
- throw emu_fatalerror("Unknown id in tmnt_state::device_timer");
- }
+ m_audiocpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
}
void tmnt_state::sound_arm_nmi_w(uint8_t data)
{
// sound_nmi_enabled = 1;
m_audiocpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
- timer_set(attotime::from_usec(50), TIMER_NMI); /* kludge until the K053260 is emulated correctly */
+ m_audio_nmi_timer->adjust(attotime::from_usec(50)); /* kludge until the K053260 is emulated correctly */
}
@@ -2000,6 +1993,8 @@ void tmnt_state::machine_start()
save_item(NAME(m_layerpri));
save_item(NAME(m_sorted_layer));
save_item(NAME(m_irq5_mask));
+
+ m_audio_nmi_timer = timer_alloc(FUNC(tmnt_state::audio_nmi), this);
}
MACHINE_RESET_MEMBER(tmnt_state,common)
@@ -2008,6 +2003,7 @@ MACHINE_RESET_MEMBER(tmnt_state,common)
m_last = 0;
m_tmnt_soundlatch = 0;
m_irq5_mask = 0;
+ m_audio_nmi_timer->adjust(attotime::never);
}
void tmnt_state::cuebrick(machine_config &config)
diff --git a/src/mame/drivers/toobin.cpp b/src/mame/drivers/toobin.cpp
index 811b038cc11..68f34218255 100644
--- a/src/mame/drivers/toobin.cpp
+++ b/src/mame/drivers/toobin.cpp
@@ -48,7 +48,7 @@ TIMER_CALLBACK_MEMBER(toobin_state::scanline_interrupt)
void toobin_state::machine_start()
{
- m_scanline_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(toobin_state::scanline_interrupt), this));
+ m_scanline_interrupt_timer = timer_alloc(FUNC(toobin_state::scanline_interrupt), this);
}
diff --git a/src/mame/drivers/triplhnt.cpp b/src/mame/drivers/triplhnt.cpp
index b26b9cbdbfd..f36f59ae742 100644
--- a/src/mame/drivers/triplhnt.cpp
+++ b/src/mame/drivers/triplhnt.cpp
@@ -22,9 +22,9 @@ void triplhnt_state::init_triplhnt()
}
-void triplhnt_state::set_collision(int code)
+TIMER_CALLBACK_MEMBER(triplhnt_state::set_collision)
{
- m_hit_code = code;
+ m_hit_code = param;
m_maincpu->set_input_line(0, HOLD_LINE);
}
diff --git a/src/mame/drivers/trucocl.cpp b/src/mame/drivers/trucocl.cpp
index d4b9471c233..fec9b43b7d0 100644
--- a/src/mame/drivers/trucocl.cpp
+++ b/src/mame/drivers/trucocl.cpp
@@ -50,16 +50,9 @@ void trucocl_state::irq_enable_w(uint8_t data)
}
-void trucocl_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(trucocl_state::dac_irq)
{
- switch (id)
- {
- case TIMER_DAC_IRQ:
- m_maincpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero);
- break;
- default:
- throw emu_fatalerror("Unknown id in trucocl_state::device_timer");
- }
+ m_maincpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero);
}
@@ -168,9 +161,16 @@ static GFXDECODE_START( gfx_trucocl )
GFXDECODE_ENTRY( "gfx1", 0x10000, tilelayout, 0, 2 )
GFXDECODE_END
+void trucocl_state::machine_start()
+{
+ m_dac_irq_timer = timer_alloc(FUNC(trucocl_state::dac_irq), this);
+}
+
void trucocl_state::machine_reset()
{
- // ...
+ m_cur_dac_address = -1;
+ m_cur_dac_address_index = 0;
+ m_dac_irq_timer->adjust(attotime::never);
}
INTERRUPT_GEN_MEMBER(trucocl_state::trucocl_interrupt)
@@ -209,7 +209,7 @@ void trucocl_state::trucocl(machine_config &config)
/***************************************************************************
- Game driver(s)
+ ROM definitions
***************************************************************************/
@@ -232,16 +232,5 @@ ROM_END
*
*************************************/
-void trucocl_state::init_trucocl()
-{
- m_cur_dac_address = -1;
- m_cur_dac_address_index = 0;
-
- m_dac_irq_timer = timer_alloc(TIMER_DAC_IRQ);
-}
-
-
-
-/******************************************************************************/
// YEAR NAME PARENT MACHINE INPUT STATE INIT MONITOR
-GAME( 1991, trucocl, 0, trucocl, trucocl, trucocl_state, init_trucocl, ROT0, "Miky SRL", "Truco Clemente", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
+GAME( 1991, trucocl, 0, trucocl, trucocl, trucocl_state, empty_init, ROT0, "Miky SRL", "Truco Clemente", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
diff --git a/src/mame/drivers/trvquest.cpp b/src/mame/drivers/trvquest.cpp
index 3c7e64e2218..e14b46a3563 100644
--- a/src/mame/drivers/trvquest.cpp
+++ b/src/mame/drivers/trvquest.cpp
@@ -191,7 +191,7 @@ void trvquest_state::trvquest(machine_config &config)
m_via_2->readpa_handler().set_ioport("UNK");
m_via_2->readpb_handler().set_ioport("DSW");
m_via_2->ca2_handler().set(FUNC(trvquest_state::misc_w));
- m_via_2->irq_handler().set(FUNC(trvquest_state::via_irq));
+ m_via_2->irq_handler().set_inputline(m_maincpu, 0);
}
ROM_START( trvquest )
diff --git a/src/mame/drivers/tsconf.cpp b/src/mame/drivers/tsconf.cpp
index 8e0abd86ae3..0d03b957543 100644
--- a/src/mame/drivers/tsconf.cpp
+++ b/src/mame/drivers/tsconf.cpp
@@ -195,8 +195,8 @@ void tsconf_state::video_start()
m_ts_tilemap[TM_TILES1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(tsconf_state::get_tile_info_16c<1>)), TILEMAP_SCAN_ROWS, 8, 8, 64, 64);
m_ts_tilemap[TM_TILES1]->set_transparent_pen(0);
- m_frame_irq_timer = timer_alloc(TIMER_IRQ_FRAME);
- m_line_irq_timer = timer_alloc(TIMER_IRQ_SCANLINE);
+ m_frame_irq_timer = timer_alloc(FUNC(tsconf_state::irq_frame), this);
+ m_line_irq_timer = timer_alloc(FUNC(tsconf_state::irq_scanline), this);
}
void tsconf_state::machine_start()
diff --git a/src/mame/drivers/tubep.cpp b/src/mame/drivers/tubep.cpp
index b5c7006874c..f4d2ecfb523 100644
--- a/src/mame/drivers/tubep.cpp
+++ b/src/mame/drivers/tubep.cpp
@@ -187,8 +187,8 @@ void tubep_state::second_cpu_irq_line_clear_w(uint8_t data)
void tubep_state::tubep_second_map(address_map &map)
{
map(0x0000, 0x7fff).rom();
- map(0xa000, 0xa000).w(FUNC(tubep_state::tubep_background_a000_w));
- map(0xc000, 0xc000).w(FUNC(tubep_state::tubep_background_c000_w));
+ map(0xa000, 0xa000).w(FUNC(tubep_state::background_a000_w));
+ map(0xc000, 0xc000).w(FUNC(tubep_state::background_c000_w));
map(0xe000, 0xe7ff).ram().share("share1"); /* 6116 #1 */
map(0xe800, 0xebff).writeonly().share("backgroundram"); /* row of 8 x 2147 RAMs on main PCB */
map(0xf000, 0xf3ff).lw8([this](offs_t off, u8 data) { m_sprite_colorsharedram[off] = data; }, "sc_w"); /* sprites color lookup table */
@@ -235,26 +235,12 @@ void tubep_state::tubep_sound_portmap(address_map &map)
}
-void tubep_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(tubep_state::assert_sprite_int)
{
- switch (id)
- {
- case TIMER_SPRITE:
- m_mcu->set_input_line(0, ASSERT_LINE);
- break;
- case TIMER_TUBEP_SCANLINE:
- tubep_scanline_callback(param);
- break;
- case TIMER_RJAMMER_SCANLINE:
- rjammer_scanline_callback(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in tubep_state::device_timer");
- }
+ m_mcu->set_input_line(0, ASSERT_LINE);
}
-
-TIMER_CALLBACK_MEMBER(tubep_state::tubep_scanline_callback)
+TIMER_CALLBACK_MEMBER(tubep_state::scanline_callback)
{
int scanline = param;
@@ -283,7 +269,7 @@ TIMER_CALLBACK_MEMBER(tubep_state::tubep_scanline_callback)
if (scanline == 16)
{
LOGIRQ("/nmi CPU#3\n");
- tubep_vblank_end(); /* switch buffered sprite RAM page */
+ vblank_end(); /* switch buffered sprite RAM page */
m_mcu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
}
/* CPU #3 MS2010-A NMI */
@@ -320,7 +306,7 @@ TIMER_CALLBACK_MEMBER(tubep_state::tubep_scanline_callback)
void tubep_state::machine_start()
{
// Create interrupt timer
- m_interrupt_timer = timer_alloc(TIMER_TUBEP_SCANLINE);
+ m_interrupt_timer = timer_alloc(FUNC(tubep_state::scanline_callback), this);
}
@@ -342,7 +328,7 @@ void tubep_state::nsc_map(address_map &map)
{
map(0x0000, 0x03ff).ram().share("sprite_color");
map(0x0800, 0x0fff).ram().share("share2");
- map(0x2000, 0x2009).w(FUNC(tubep_state::tubep_sprite_control_w));
+ map(0x2000, 0x2009).w(FUNC(tubep_state::sprite_control_w));
map(0x200a, 0x200b).nopw(); /* not used by the games - perhaps designed for debugging */
map(0xc000, 0xffff).rom();
}
@@ -401,12 +387,12 @@ void rjammer_state::rjammer_second_map(address_map &map)
void rjammer_state::rjammer_second_portmap(address_map &map)
{
map.global_mask(0xff);
- map(0xb0, 0xb0).w(FUNC(rjammer_state::rjammer_background_page_w));
- map(0xd0, 0xd0).w(FUNC(rjammer_state::rjammer_background_LS377_w));
+ map(0xb0, 0xb0).w(FUNC(rjammer_state::background_page_w));
+ map(0xd0, 0xd0).w(FUNC(rjammer_state::background_ls377_w));
}
-TIMER_CALLBACK_MEMBER(tubep_state::rjammer_scanline_callback)
+TIMER_CALLBACK_MEMBER(rjammer_state::scanline_callback)
{
int scanline = param;
@@ -435,7 +421,7 @@ TIMER_CALLBACK_MEMBER(tubep_state::rjammer_scanline_callback)
if (scanline == 16)
{
LOGIRQ("/nmi CPU#3\n");
- tubep_vblank_end(); /* switch buffered sprite RAM page */
+ vblank_end(); /* switch buffered sprite RAM page */
m_mcu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
}
/* CPU #3 MS2010-A NMI */
@@ -470,7 +456,7 @@ TIMER_CALLBACK_MEMBER(tubep_state::rjammer_scanline_callback)
void rjammer_state::machine_start()
{
// Create interrupt timer
- m_interrupt_timer = timer_alloc(TIMER_RJAMMER_SCANLINE);
+ m_interrupt_timer = timer_alloc(FUNC(rjammer_state::scanline_callback), this);
// Set up save state
save_item(NAME(m_msm5205_toggle));
@@ -483,8 +469,8 @@ void rjammer_state::machine_reset()
m_msm5205_toggle = false;
m_adpcm_mux->select_w(0);
- rjammer_voice_startstop_w(0);
- rjammer_voice_frequency_select_w(0);
+ voice_startstop_w(0);
+ voice_frequency_select_w(0);
}
@@ -495,7 +481,7 @@ void rjammer_state::machine_reset()
*
*************************************/
-void rjammer_state::rjammer_voice_startstop_w(uint8_t data)
+void rjammer_state::voice_startstop_w(uint8_t data)
{
/* bit 0 of data selects voice start/stop (reset pin on MSM5205)*/
// 0 -stop; 1-start
@@ -503,7 +489,7 @@ void rjammer_state::rjammer_voice_startstop_w(uint8_t data)
}
-void rjammer_state::rjammer_voice_frequency_select_w(uint8_t data)
+void rjammer_state::voice_frequency_select_w(uint8_t data)
{
// bit 0 of data selects voice frequency on MSM5205 (pin 1)
// 0 -4 KHz; 1- 8KHz
@@ -514,7 +500,7 @@ void rjammer_state::rjammer_voice_frequency_select_w(uint8_t data)
}
-WRITE_LINE_MEMBER(rjammer_state::rjammer_adpcm_vck_w)
+WRITE_LINE_MEMBER(rjammer_state::adpcm_vck_w)
{
if (state)
{
@@ -527,7 +513,7 @@ WRITE_LINE_MEMBER(rjammer_state::rjammer_adpcm_vck_w)
}
-void rjammer_state::rjammer_voice_input_w(uint8_t data)
+void rjammer_state::voice_input_w(uint8_t data)
{
/* 8 bits of adpcm data for MSM5205 */
/* need to buffer the data, and switch two nibbles on two following interrupts*/
@@ -542,7 +528,7 @@ void rjammer_state::rjammer_voice_input_w(uint8_t data)
}
-void rjammer_state::rjammer_voice_intensity_control_w(uint8_t data)
+void rjammer_state::voice_intensity_control_w(uint8_t data)
{
/* 4 LSB bits select the intensity (analog circuit that alters the output from MSM5205) */
/* need to buffer the data */
@@ -560,13 +546,13 @@ void rjammer_state::rjammer_sound_portmap(address_map &map)
{
map.global_mask(0xff);
map(0x00, 0x00).r("soundlatch", FUNC(generic_latch_8_device::read));
- map(0x10, 0x10).w(FUNC(rjammer_state::rjammer_voice_startstop_w));
- map(0x18, 0x18).w(FUNC(rjammer_state::rjammer_voice_frequency_select_w));
- map(0x80, 0x80).w(FUNC(rjammer_state::rjammer_voice_input_w));
+ map(0x10, 0x10).w(FUNC(rjammer_state::voice_startstop_w));
+ map(0x18, 0x18).w(FUNC(rjammer_state::voice_frequency_select_w));
+ map(0x80, 0x80).w(FUNC(rjammer_state::voice_input_w));
map(0x90, 0x91).w("ay1", FUNC(ay8910_device::address_data_w));
map(0x92, 0x93).w("ay2", FUNC(ay8910_device::address_data_w));
map(0x94, 0x95).w("ay3", FUNC(ay8910_device::address_data_w));
- map(0x96, 0x96).w(FUNC(rjammer_state::rjammer_voice_intensity_control_w));
+ map(0x96, 0x96).w(FUNC(rjammer_state::voice_intensity_control_w));
}
@@ -831,10 +817,10 @@ void tubep_state::tubep(machine_config &config)
m_screen->set_refresh_hz(60);
m_screen->set_size(256, 264);
m_screen->set_visarea(0*8, 32*8-1, 2*8, 30*8-1);
- m_screen->set_screen_update(FUNC(tubep_state::screen_update_tubep));
+ m_screen->set_screen_update(FUNC(tubep_state::screen_update));
m_screen->set_palette("palette");
- PALETTE(config, "palette", FUNC(tubep_state::tubep_palette), 32 + 256*64);
+ PALETTE(config, "palette", FUNC(tubep_state::palette_init), 32 + 256*64);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -895,10 +881,10 @@ void rjammer_state::rjammer(machine_config &config)
/* video hardware */
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_raw(19968000 / 4, 320, 0, 256, 264, 16, 240);
- m_screen->set_screen_update(FUNC(rjammer_state::screen_update_rjammer));
+ m_screen->set_screen_update(FUNC(rjammer_state::screen_update));
m_screen->set_palette("palette");
- PALETTE(config, "palette", FUNC(rjammer_state::rjammer_palette), 64);
+ PALETTE(config, "palette", FUNC(rjammer_state::palette_init), 64);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -919,7 +905,7 @@ void rjammer_state::rjammer(machine_config &config)
ay3.add_route(ALL_OUTPUTS, "mono", 0.075);
MSM5205(config, m_msm, 384_kHz_XTAL);
- m_msm->vck_callback().set(FUNC(rjammer_state::rjammer_adpcm_vck_w));
+ m_msm->vck_callback().set(FUNC(rjammer_state::adpcm_vck_w));
m_msm->set_prescaler_selector(msm5205_device::S48_4B); // 8 KHz (changes at run time)
m_msm->add_route(ALL_OUTPUTS, "mono", 0.325);
diff --git a/src/mame/drivers/tugboat.cpp b/src/mame/drivers/tugboat.cpp
index a15180f53ea..516ad959c4c 100644
--- a/src/mame/drivers/tugboat.cpp
+++ b/src/mame/drivers/tugboat.cpp
@@ -48,16 +48,11 @@ public:
void tugboat(machine_config &config);
protected:
- enum
- {
- TIMER_INTERRUPT
- };
-
virtual void machine_start() override;
virtual void video_start() override;
virtual void machine_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(trigger_int);
private:
required_device<cpu_device> m_maincpu;
@@ -91,7 +86,7 @@ private:
void tugboat_state::machine_start()
{
- m_interrupt_timer = timer_alloc(TIMER_INTERRUPT);
+ m_interrupt_timer = timer_alloc(FUNC(tugboat_state::trigger_int), this);
m_maincpu->space(AS_PROGRAM).specific(m_program);
save_item(NAME(m_hd46505_0_reg));
@@ -212,17 +207,10 @@ void tugboat_state::ctrl_w(uint8_t data)
m_ctrl = data;
}
-void tugboat_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(tugboat_state::trigger_int)
{
- switch (id)
- {
- case TIMER_INTERRUPT:
- m_maincpu->set_input_line(0, HOLD_LINE);
- m_interrupt_timer->adjust(m_screen->frame_period());
- break;
- default:
- throw emu_fatalerror("Unknown id in tugboat_state::device_timer");
- }
+ m_maincpu->set_input_line(0, HOLD_LINE);
+ m_interrupt_timer->adjust(m_screen->frame_period());
}
void tugboat_state::machine_reset()
diff --git a/src/mame/drivers/turrett.cpp b/src/mame/drivers/turrett.cpp
index 865da9b99f2..6855101dcbc 100644
--- a/src/mame/drivers/turrett.cpp
+++ b/src/mame/drivers/turrett.cpp
@@ -61,7 +61,7 @@ void turrett_state::machine_start()
save_item(NAME(m_frame));
save_item(NAME(m_adc));
- m_dma_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(turrett_state::dma_complete), this));
+ m_dma_timer = timer_alloc(FUNC(turrett_state::dma_complete), this);
}
diff --git a/src/mame/drivers/tutor.cpp b/src/mame/drivers/tutor.cpp
index 6389448287c..bb566795c0e 100644
--- a/src/mame/drivers/tutor.cpp
+++ b/src/mame/drivers/tutor.cpp
@@ -249,7 +249,7 @@ void tutor_state::machine_start()
std::string region_tag;
m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG));
- m_tape_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tutor_state::tape_interrupt_handler),this));
+ m_tape_interrupt_timer = timer_alloc(FUNC(tutor_state::tape_interrupt_handler), this);
m_bank1->configure_entry(0, memregion("maincpu")->base() + 0x4000);
m_bank1->set_entry(0);
diff --git a/src/mame/drivers/tv912.cpp b/src/mame/drivers/tv912.cpp
index 237af70ef9f..26db9236908 100644
--- a/src/mame/drivers/tv912.cpp
+++ b/src/mame/drivers/tv912.cpp
@@ -103,6 +103,15 @@ public:
DECLARE_INPUT_CHANGED_MEMBER(uart_settings_changed);
private:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
+ void prog_map(address_map &map);
+ void io_map(address_map &map);
+ void bank_map(address_map &map);
+
+ TIMER_CALLBACK_MEMBER(update_baudgen);
+
void p1_w(u8 data);
u8 p2_r();
void p2_w(u8 data);
@@ -114,19 +123,6 @@ private:
u32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
- void bank_map(address_map &map);
- void io_map(address_map &map);
- void prog_map(address_map &map);
-
- enum
- {
- TIMER_BAUDGEN
- };
-
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
required_device<cpu_device> m_maincpu;
required_device<tms9927_device> m_crtc;
required_device<ay51013_device> m_uart;
@@ -253,26 +249,20 @@ void tv912_state::output_40c(u8 data)
m_dispram_bank->set_entry(BIT(data, 0));
}
-void tv912_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(tv912_state::update_baudgen)
{
- switch (id)
- {
- case TIMER_BAUDGEN:
- m_uart->write_rcp(param);
- m_uart->write_tcp(param);
+ m_uart->write_rcp(param);
+ m_uart->write_tcp(param);
- ioport_value sel = (m_lpt_select ? m_printer_baud : m_modem_baud)->read();
- for (int b = 0; b < 10; b++)
+ ioport_value sel = (m_lpt_select ? m_printer_baud : m_modem_baud)->read();
+ for (int b = 0; b < 10; b++)
+ {
+ if (!BIT(sel, b))
{
- if (!BIT(sel, b))
- {
- unsigned divisor = 11 * (b < 9 ? 1 << b : 176);
- m_baudgen_timer->adjust(attotime::from_hz(23.814_MHz_XTAL / 3.5 / divisor), !param);
- break;
- }
+ unsigned divisor = 11 * (b < 9 ? 1 << b : 176);
+ m_baudgen_timer->adjust(attotime::from_hz(23.814_MHz_XTAL / 3.5 / divisor), !param);
+ break;
}
-
- break;
}
}
@@ -379,7 +369,7 @@ void tv912_state::machine_start()
m_dispram = make_unique_clear<u8[]>(0x1000);
m_dispram_bank->configure_entries(0, 2, m_dispram.get(), 0x800);
- m_baudgen_timer = timer_alloc(TIMER_BAUDGEN);
+ m_baudgen_timer = timer_alloc(FUNC(tv912_state::update_baudgen), this);
m_baudgen_timer->adjust(attotime::zero, 0);
save_item(NAME(m_force_blank));
diff --git a/src/mame/drivers/tv990.cpp b/src/mame/drivers/tv990.cpp
index 0c550372e4a..07a86a293da 100644
--- a/src/mame/drivers/tv990.cpp
+++ b/src/mame/drivers/tv990.cpp
@@ -67,20 +67,14 @@ public:
DECLARE_INPUT_CHANGED_MEMBER(color);
private:
- required_device<m68000_device> m_maincpu;
- required_shared_ptr<uint16_t> m_vram;
- required_shared_ptr<uint16_t> m_fontram;
- required_device_array<ns16450_device, 2> m_uart;
- required_device<screen_device> m_screen;
- required_device<kbdc8042_device> m_kbdc;
- required_device<palette_device> m_palette;
- required_device<beep_device> m_beep;
-
- virtual void machine_reset() override;
virtual void machine_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ virtual void machine_reset() override;
virtual void device_post_load() override;
+ void tv990_mem(address_map &map);
+
+ TIMER_CALLBACK_MEMBER(trigger_row_irq);
+
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
uint16_t tvi1111_r(offs_t offset);
@@ -93,11 +87,20 @@ private:
DECLARE_WRITE_LINE_MEMBER(lpt_irq);
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
- void tv990_mem(address_map &map);
+ required_device<m68000_device> m_maincpu;
+ required_shared_ptr<uint16_t> m_vram;
+ required_shared_ptr<uint16_t> m_fontram;
+ required_device_array<ns16450_device, 2> m_uart;
+ required_device<screen_device> m_screen;
+ required_device<kbdc8042_device> m_kbdc;
+ required_device<palette_device> m_palette;
+ required_device<beep_device> m_beep;
uint16_t tvi1111_regs[(0x100/2)+2];
emu_timer *m_rowtimer = nullptr;
- int m_rowh = 0, m_width = 0, m_height = 0;
+ int m_rowh = 0;
+ int m_width = 0;
+ int m_height = 0;
};
WRITE_LINE_MEMBER(tv990_state::vblank_irq)
@@ -112,7 +115,7 @@ WRITE_LINE_MEMBER(tv990_state::vblank_irq)
void tv990_state::machine_start()
{
- m_rowtimer = timer_alloc();
+ m_rowtimer = timer_alloc(FUNC(tv990_state::trigger_row_irq), this);
save_item(NAME(tvi1111_regs));
save_item(NAME(m_rowh));
@@ -120,7 +123,7 @@ void tv990_state::machine_start()
save_item(NAME(m_height));
}
-void tv990_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(tv990_state::trigger_row_irq)
{
m_rowtimer->adjust(m_screen->time_until_pos(m_screen->vpos() + m_rowh));
m_maincpu->set_input_line(M68K_IRQ_6, ASSERT_LINE);
diff --git a/src/mame/drivers/tx0.cpp b/src/mame/drivers/tx0.cpp
index 529d1b7e12a..c03f40c4f1f 100644
--- a/src/mame/drivers/tx0.cpp
+++ b/src/mame/drivers/tx0.cpp
@@ -348,10 +348,10 @@ void tx0_state::tx0_machine_stop()
void tx0_state::machine_start()
{
- m_tape_reader.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tx0_state::reader_callback),this));
- m_tape_puncher.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tx0_state::puncher_callback),this));
- m_typewriter.prt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tx0_state::prt_callback),this));
- m_dis_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tx0_state::dis_callback),this));
+ m_tape_reader.timer = timer_alloc(FUNC(tx0_state::reader_callback), this);
+ m_tape_puncher.timer = timer_alloc(FUNC(tx0_state::puncher_callback), this);
+ m_typewriter.prt_timer = timer_alloc(FUNC(tx0_state::prt_callback), this);
+ m_dis_timer = timer_alloc(FUNC(tx0_state::dis_callback), this);
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(&tx0_state::tx0_machine_stop,this));
}
diff --git a/src/mame/drivers/uchroma68.cpp b/src/mame/drivers/uchroma68.cpp
index 84acf52ff13..e45e2fcb59e 100644
--- a/src/mame/drivers/uchroma68.cpp
+++ b/src/mame/drivers/uchroma68.cpp
@@ -153,28 +153,13 @@ public:
void uchroma68(machine_config &config);
- enum
- {
- TIMER_KBD_STROBE
- };
-
private:
- required_device<cpu_device> m_maincpu;
- required_device<mc6846_device> m_mc6846;
- required_device<mc6847_ntsc_device> m_mc6847;
- required_device<pia6821_device> m_pia;
- required_device<acia6850_device> m_acia;
- required_device<clock_device> m_acia_tx_clock;
- required_device<screen_device> m_screen;
- required_shared_ptr<uint8_t> m_video_ram;
- required_device<cassette_image_device> m_cass;
- required_ioport m_semi_graphics_six_mod;
-
- void uchroma68_mem(address_map &map);
virtual void machine_start() override;
virtual void machine_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ void uchroma68_mem(address_map &map);
+
+ TIMER_CALLBACK_MEMBER(kbd_strobe);
uint8_t mc6847_videoram_r(offs_t offset);
uint8_t pia_pa_r();
@@ -188,8 +173,25 @@ private:
TIMER_DEVICE_CALLBACK_MEMBER(kansas_r);
DECLARE_WRITE_LINE_MEMBER(kansas_w);
- uint8_t m_cass_rx_clock_count, m_cass_rx_period, m_cass_txcount;
- bool m_cass_in, m_cass_inbit, m_cass_txbit, m_cass_last_txbit;
+
+ required_device<cpu_device> m_maincpu;
+ required_device<mc6846_device> m_mc6846;
+ required_device<mc6847_ntsc_device> m_mc6847;
+ required_device<pia6821_device> m_pia;
+ required_device<acia6850_device> m_acia;
+ required_device<clock_device> m_acia_tx_clock;
+ required_device<screen_device> m_screen;
+ required_shared_ptr<uint8_t> m_video_ram;
+ required_device<cassette_image_device> m_cass;
+ required_ioport m_semi_graphics_six_mod;
+
+ uint8_t m_cass_rx_clock_count;
+ uint8_t m_cass_rx_period;
+ uint8_t m_cass_txcount;
+ bool m_cass_in;
+ bool m_cass_inbit;
+ bool m_cass_txbit;
+ bool m_cass_last_txbit;
};
@@ -249,17 +251,10 @@ INPUT_PORTS_END
************************************************************/
-void uchroma68_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(uchroma68_state::kbd_strobe)
{
- switch (id)
- {
- case TIMER_KBD_STROBE:
- m_kbd_strobe = 1;
- m_kbd_data = 0;
- break;
- default:
- throw emu_fatalerror("Unknown id in uchroma68_state::device_timer");
- }
+ m_kbd_strobe = 1;
+ m_kbd_data = 0;
}
void uchroma68_state::mc6846_out_w(uint8_t data)
@@ -388,7 +383,7 @@ WRITE_LINE_MEMBER(uchroma68_state::kansas_w)
void uchroma68_state::machine_start()
{
- m_kbd_strobe_timer = timer_alloc(TIMER_KBD_STROBE);
+ m_kbd_strobe_timer = timer_alloc(FUNC(uchroma68_state::kbd_strobe), this);
m_kbd_strobe = 1;
save_item(NAME(m_kbd_strobe));
diff --git a/src/mame/drivers/ultratnk.cpp b/src/mame/drivers/ultratnk.cpp
index da9e350aebb..19be1b1f5b0 100644
--- a/src/mame/drivers/ultratnk.cpp
+++ b/src/mame/drivers/ultratnk.cpp
@@ -48,19 +48,6 @@ READ_LINE_MEMBER(ultratnk_state::joystick_r)
}
-void ultratnk_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_NMI:
- nmi_callback(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in ultratnk_state::device_timer");
- }
-}
-
-
TIMER_CALLBACK_MEMBER(ultratnk_state::nmi_callback)
{
int scanline = param + 64;
@@ -81,7 +68,7 @@ TIMER_CALLBACK_MEMBER(ultratnk_state::nmi_callback)
void ultratnk_state::machine_start()
{
- m_nmi_timer = timer_alloc(TIMER_NMI);
+ m_nmi_timer = timer_alloc(FUNC(ultratnk_state::nmi_callback), this);
save_item(NAME(m_da_latch));
save_item(NAME(m_collision));
diff --git a/src/mame/drivers/unichamp.cpp b/src/mame/drivers/unichamp.cpp
index ad634ee6a0f..7790766c6b1 100644
--- a/src/mame/drivers/unichamp.cpp
+++ b/src/mame/drivers/unichamp.cpp
@@ -34,6 +34,9 @@
* This first CPU slice only last 3ms, then the GIC sets the CPU's BUSRQ low,
* stalling it for 12.36ms, then sets it high for 4.33ms etc...
* 59.95 times a second - NTSC
+ *
+ * TODO: Should we add an explicit Reset button like the controller has?
+ *
************************************************************************/
#include "emu.h"
@@ -63,13 +66,9 @@ public:
void unichamp(machine_config &config);
- void init_unichamp();
-
protected:
virtual void machine_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
private:
required_device<cp1610_cpu_device> m_maincpu;
required_device<gic_device> m_gic;
@@ -138,12 +137,6 @@ static INPUT_PORTS_START( unichamp )
INPUT_PORTS_END
-void unichamp_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- //TODO should we add an explicit Reset button in there just like the controller?
-}
-
-
uint8_t unichamp_state::bext_r(offs_t offset)
{
//The BEXT instruction pushes a user-defined nibble out on the four EBCA pins (EBCA0 to EBCA3)
@@ -165,10 +158,6 @@ uint8_t unichamp_state::bext_r(offs_t offset)
}
-void unichamp_state::init_unichamp()
-{
-}
-
uint16_t unichamp_state::read_ff()
{
return 0xffff;
@@ -290,4 +279,4 @@ ROM_START(unichamp)
ROM_END
-CONS( 1977, unichamp, 0, 0, unichamp, unichamp, unichamp_state, init_unichamp, "Unisonic", "Champion 2711", 0/*MACHINE_IMPERFECT_GRAPHICS*/ )
+CONS( 1977, unichamp, 0, 0, unichamp, unichamp, unichamp_state, empty_init, "Unisonic", "Champion 2711", 0/*MACHINE_IMPERFECT_GRAPHICS*/ )
diff --git a/src/mame/drivers/vectrex.cpp b/src/mame/drivers/vectrex.cpp
index e2ff7013950..58023960a86 100644
--- a/src/mame/drivers/vectrex.cpp
+++ b/src/mame/drivers/vectrex.cpp
@@ -27,7 +27,7 @@ void vectrex_state::vectrex_map(address_map &map)
{
map(0x0000, 0x7fff).noprw(); // cart area, handled at machine_start
map(0xc800, 0xcbff).ram().mirror(0x0400).share("gce_vectorram");
- map(0xd000, 0xd7ff).rw(FUNC(vectrex_state::vectrex_via_r), FUNC(vectrex_state::vectrex_via_w));
+ map(0xd000, 0xd7ff).rw(FUNC(vectrex_state::via_r), FUNC(vectrex_state::via_w));
map(0xe000, 0xffff).rom().region("maincpu", 0);
}
@@ -106,7 +106,7 @@ void vectrex_base_state::vectrex_base(machine_config &config)
m_screen->set_refresh_hz(60);
m_screen->set_size(400, 300);
m_screen->set_visarea(0, 399, 0, 299);
- m_screen->set_screen_update(FUNC(vectrex_base_state::screen_update_vectrex));
+ m_screen->set_screen_update(FUNC(vectrex_base_state::screen_update));
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@@ -114,18 +114,18 @@ void vectrex_base_state::vectrex_base(machine_config &config)
AY8912(config, m_ay8912, 6_MHz_XTAL / 4);
m_ay8912->port_a_read_callback().set_ioport("BUTTONS");
- m_ay8912->port_a_write_callback().set(FUNC(vectrex_base_state::vectrex_psg_port_w));
+ m_ay8912->port_a_write_callback().set(FUNC(vectrex_base_state::psg_port_w));
m_ay8912->add_route(ALL_OUTPUTS, "speaker", 0.2);
/* via */
MOS6522(config, m_via6522_0, 6_MHz_XTAL / 4);
- m_via6522_0->readpa_handler().set(FUNC(vectrex_base_state::vectrex_via_pa_r));
- m_via6522_0->readpb_handler().set(FUNC(vectrex_base_state::vectrex_via_pb_r));
- m_via6522_0->writepa_handler().set(FUNC(vectrex_base_state::v_via_pa_w));
- m_via6522_0->writepb_handler().set(FUNC(vectrex_base_state::v_via_pb_w));
- m_via6522_0->ca2_handler().set(FUNC(vectrex_base_state::v_via_ca2_w));
- m_via6522_0->cb2_handler().set(FUNC(vectrex_base_state::v_via_cb2_w));
- m_via6522_0->irq_handler().set(FUNC(vectrex_base_state::vectrex_via_irq));
+ m_via6522_0->readpa_handler().set(FUNC(vectrex_base_state::via_pa_r));
+ m_via6522_0->readpb_handler().set(FUNC(vectrex_base_state::via_pb_r));
+ m_via6522_0->writepa_handler().set(FUNC(vectrex_base_state::via_pa_w));
+ m_via6522_0->writepb_handler().set(FUNC(vectrex_base_state::via_pb_w));
+ m_via6522_0->ca2_handler().set(FUNC(vectrex_base_state::via_ca2_w));
+ m_via6522_0->cb2_handler().set(FUNC(vectrex_base_state::via_cb2_w));
+ m_via6522_0->irq_handler().set(FUNC(vectrex_base_state::via_irq));
}
void vectrex_state::vectrex(machine_config &config)
@@ -198,7 +198,7 @@ void raaspec_state::raaspec_map(address_map &map)
map(0x8000, 0x87ff).ram().share("nvram");
map(0xa000, 0xa000).w(FUNC(raaspec_state::raaspec_led_w));
map(0xc800, 0xcbff).ram().mirror(0x0400).share("gce_vectorram");
- map(0xd000, 0xd7ff).rw(FUNC(raaspec_state::vectrex_via_r), FUNC(raaspec_state::vectrex_via_w));
+ map(0xd000, 0xd7ff).rw(FUNC(raaspec_state::via_r), FUNC(raaspec_state::via_w));
map(0xe000, 0xffff).rom();
}
@@ -229,7 +229,7 @@ void raaspec_state::raaspec(machine_config &config)
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
- m_via6522_0->readpb_handler().set(FUNC(raaspec_state::vectrex_s1_via_pb_r));
+ m_via6522_0->readpb_handler().set(FUNC(raaspec_state::s1_via_pb_r));
}
ROM_START(raaspec)
diff --git a/src/mame/drivers/vendetta.cpp b/src/mame/drivers/vendetta.cpp
index 8882c58752c..f16501c8d51 100644
--- a/src/mame/drivers/vendetta.cpp
+++ b/src/mame/drivers/vendetta.cpp
@@ -557,7 +557,7 @@ void vendetta_state::machine_start()
m_mainbank->configure_entries(0, 28, memregion("maincpu")->base(), 0x2000);
m_mainbank->set_entry(0);
- m_z80_nmi_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vendetta_state::z80_nmi), this));
+ m_z80_nmi_timer = timer_alloc(FUNC(vendetta_state::z80_nmi), this);
save_item(NAME(m_irq_enabled));
save_item(NAME(m_sprite_colorbase));
diff --git a/src/mame/drivers/vg5k.cpp b/src/mame/drivers/vg5k.cpp
index d6671cd1531..315b0c6da98 100644
--- a/src/mame/drivers/vg5k.cpp
+++ b/src/mame/drivers/vg5k.cpp
@@ -94,6 +94,7 @@ private:
offs_t m_ef9345_offset = 0;
uint8_t m_printer_latch = 0;
uint8_t m_printer_signal = 0;
+ emu_timer *m_z80_irq_clear_timer = nullptr;
virtual void machine_start() override;
virtual void machine_reset() override;
@@ -334,7 +335,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(vg5k_state::z80_irq)
{
m_maincpu->set_input_line(0, ASSERT_LINE);
- machine().scheduler().timer_set(attotime::from_usec(100), timer_expired_delegate(FUNC(vg5k_state::z80_irq_clear),this));
+ m_z80_irq_clear_timer->adjust(attotime::from_usec(100));
}
TIMER_DEVICE_CALLBACK_MEMBER(vg5k_state::vg5k_scanline)
@@ -356,6 +357,8 @@ void vg5k_state::machine_start()
save_item(NAME(m_ef9345_offset));
save_item(NAME(m_printer_latch));
save_item(NAME(m_printer_signal));
+
+ m_z80_irq_clear_timer = timer_alloc(FUNC(vg5k_state::z80_irq_clear), this);
}
void vg5k_state::machine_reset()
diff --git a/src/mame/drivers/vgmplay.cpp b/src/mame/drivers/vgmplay.cpp
index 653d023d8d5..ddfb6d23da9 100644
--- a/src/mame/drivers/vgmplay.cpp
+++ b/src/mame/drivers/vgmplay.cpp
@@ -558,10 +558,10 @@ void vgmplay_device::device_start()
for (vgm_chip led = vgm_chip(0); led != CT_COUNT; led = vgm_chip(led + 1))
m_act_led_index[led] = m_act_led_expiries.emplace(m_act_led_expiries.end(), led, attotime::never);
m_act_led_off = m_act_led_expiries.begin();
- m_act_led_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vgmplay_device::act_led_expired), this));
+ m_act_led_timer = timer_alloc(FUNC(vgmplay_device::act_led_expired), this);
for (int i = 0; i < 0xff; i++)
- m_streams[i].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vgmplay_device::stream_timer_expired), this));
+ m_streams[i].timer = timer_alloc(FUNC(vgmplay_device::stream_timer_expired), this);
save_item(NAME(m_pc));
//save_item(NAME(m_streams));
diff --git a/src/mame/drivers/vidbrain.cpp b/src/mame/drivers/vidbrain.cpp
index f52bb6ff9be..c342f11db28 100644
--- a/src/mame/drivers/vidbrain.cpp
+++ b/src/mame/drivers/vidbrain.cpp
@@ -320,10 +320,6 @@ INPUT_PORTS_END
// DEVICE CONFIGURATION
//**************************************************************************
-//-------------------------------------------------
-// UV201_INTERFACE( uv_intf )
-//-------------------------------------------------
-
WRITE_LINE_MEMBER( vidbrain_state::ext_int_w )
{
if (state)
@@ -334,7 +330,7 @@ WRITE_LINE_MEMBER( vidbrain_state::ext_int_w )
WRITE_LINE_MEMBER( vidbrain_state::hblank_w )
{
- if (state && m_joy_enable && !m_timer_ne555->enabled())
+ if (state && m_joy_enable)
{
uint8_t joydata = 0;
@@ -353,7 +349,7 @@ WRITE_LINE_MEMBER( vidbrain_state::hblank_w )
// t = 1.1 * R * C
double t = 1.1 * (RES_K(3.9) + RES_K(joydata)) * 3;
- timer_set(attotime::from_nsec(t), TIMER_JOYSTICK);
+ m_timer_ne555->adjust(attotime::from_nsec(t));
}
}
@@ -370,10 +366,10 @@ uint8_t vidbrain_state::memory_read_byte(offs_t offset)
//**************************************************************************
//-------------------------------------------------
-// device_timer - handler timer events
+// timer events
//-------------------------------------------------
-void vidbrain_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(vidbrain_state::joystick_tick)
{
m_uv->ext_int_w(0);
m_smi->ext_int_w(0);
@@ -387,7 +383,7 @@ void vidbrain_state::device_timer(emu_timer &timer, device_timer_id id, int para
void vidbrain_state::machine_start()
{
// allocate timers
- m_timer_ne555 = timer_alloc(TIMER_JOYSTICK);
+ m_timer_ne555 = timer_alloc(FUNC(vidbrain_state::joystick_tick), this);
// register for state saving
save_item(NAME(m_keylatch));
diff --git a/src/mame/drivers/video21.cpp b/src/mame/drivers/video21.cpp
index 87752e85a86..f9d1cf15def 100644
--- a/src/mame/drivers/video21.cpp
+++ b/src/mame/drivers/video21.cpp
@@ -244,7 +244,7 @@ GFXDECODE_END
void video21_state::machine_start()
{
- m_hopper_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(video21_state::hopper_coinout),this));
+ m_hopper_timer = timer_alloc(FUNC(video21_state::hopper_coinout), this);
m_lamps.resolve();
diff --git a/src/mame/drivers/videopin.cpp b/src/mame/drivers/videopin.cpp
index c937bac16e8..d2dee57baf4 100644
--- a/src/mame/drivers/videopin.cpp
+++ b/src/mame/drivers/videopin.cpp
@@ -49,19 +49,6 @@ void videopin_state::update_plunger()
}
-void videopin_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_INTERRUPT:
- interrupt_callback(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in videopin_state::device_timer");
- }
-}
-
-
TIMER_CALLBACK_MEMBER(videopin_state::interrupt_callback)
{
int scanline = param;
@@ -82,7 +69,7 @@ TIMER_CALLBACK_MEMBER(videopin_state::interrupt_callback)
void videopin_state::machine_start()
{
m_leds.resolve();
- m_interrupt_timer = timer_alloc(TIMER_INTERRUPT);
+ m_interrupt_timer = timer_alloc(FUNC(videopin_state::interrupt_callback), this);
save_item(NAME(m_time_pushed));
save_item(NAME(m_time_released));
diff --git a/src/mame/drivers/viper.cpp b/src/mame/drivers/viper.cpp
index 4e114bbd02d..54577e8cdff 100644
--- a/src/mame/drivers/viper.cpp
+++ b/src/mame/drivers/viper.cpp
@@ -1395,10 +1395,10 @@ void viper_state::mpc8240_interrupt(int irq)
void viper_state::mpc8240_epic_init()
{
memset(&m_epic, 0, sizeof(m_epic));
- m_epic.global_timer[0].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(viper_state::epic_global_timer_callback),this));
- m_epic.global_timer[1].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(viper_state::epic_global_timer_callback),this));
- m_epic.global_timer[2].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(viper_state::epic_global_timer_callback),this));
- m_epic.global_timer[3].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(viper_state::epic_global_timer_callback),this));
+ m_epic.global_timer[0].timer = timer_alloc(FUNC(viper_state::epic_global_timer_callback), this);
+ m_epic.global_timer[1].timer = timer_alloc(FUNC(viper_state::epic_global_timer_callback), this);
+ m_epic.global_timer[2].timer = timer_alloc(FUNC(viper_state::epic_global_timer_callback), this);
+ m_epic.global_timer[3].timer = timer_alloc(FUNC(viper_state::epic_global_timer_callback), this);
}
void viper_state::mpc8240_epic_reset(void)
@@ -2586,7 +2586,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(viper_state::sound_timer_callback)
void viper_state::machine_start()
{
- m_ds2430_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(viper_state::ds2430_timer_callback),this));
+ m_ds2430_timer = timer_alloc(FUNC(viper_state::ds2430_timer_callback), this);
mpc8240_epic_init();
/* set conservative DRC options */
diff --git a/src/mame/drivers/vis.cpp b/src/mame/drivers/vis.cpp
index 80241d6f625..f214fa57330 100644
--- a/src/mame/drivers/vis.cpp
+++ b/src/mame/drivers/vis.cpp
@@ -27,9 +27,11 @@ public:
protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void dack16_w(int line, uint16_t data) override;
virtual void device_add_mconfig(machine_config &config) override;
+
+ TIMER_CALLBACK_MEMBER(pcm_update);
+
private:
required_device<dac_16bit_r2r_device> m_rdac;
required_device<dac_16bit_r2r_device> m_ldac;
@@ -61,7 +63,7 @@ void vis_audio_device::device_start()
m_isa->set_dma_channel(7, this, false);
m_isa->install_device(0x0220, 0x022f, read8sm_delegate(*this, FUNC(vis_audio_device::pcm_r)), write8sm_delegate(*this, FUNC(vis_audio_device::pcm_w)));
m_isa->install_device(0x0388, 0x038b, read8sm_delegate(*subdevice<ymf262_device>("ymf262"), FUNC(ymf262_device::read)), write8sm_delegate(*subdevice<ymf262_device>("ymf262"), FUNC(ymf262_device::write)));
- m_pcm = timer_alloc();
+ m_pcm = timer_alloc(FUNC(vis_audio_device::pcm_update), this);
m_pcm->adjust(attotime::never);
}
@@ -83,10 +85,11 @@ void vis_audio_device::dack16_w(int line, uint16_t data)
m_isa->drq7_w(CLEAR_LINE);
}
-void vis_audio_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(vis_audio_device::pcm_update)
{
if(((m_samples < 2) && (m_mode & 8)) || !m_samples)
return;
+
switch(m_mode & 0x88)
{
case 0x80: // 8bit mono
diff --git a/src/mame/drivers/vk100.cpp b/src/mame/drivers/vk100.cpp
index 5a7249897c0..ce2535aac6e 100644
--- a/src/mame/drivers/vk100.cpp
+++ b/src/mame/drivers/vk100.cpp
@@ -174,9 +174,6 @@ public:
m_crtc(*this, "crtc"),
m_speaker(*this, "beeper"),
m_uart(*this, "i8251"),
- //m_i8251_rx_timer(nullptr),
- //m_i8251_tx_timer(nullptr),
- //m_sync_timer(nullptr),
m_capsshift(*this, "CAPSSHIFT"),
m_dipsw(*this, "SWITCHES"),
@@ -186,27 +183,50 @@ public:
m_basic_led(*this, "basic_led"),
m_hardcopy_led(*this, "hardcopy_led"),
m_l1_led(*this, "l1_led"),
- m_l2_led(*this, "l2_led")
+ m_l2_led(*this, "l2_led"),
+ m_vg_timer(nullptr)
+ //m_i8251_rx_timer(nullptr),
+ //m_i8251_tx_timer(nullptr),
+ //m_i8251_sync_timer(nullptr)
{
}
void vk100(machine_config &config);
- void init_vk100();
-
private:
- enum
- {
- TIMER_EXECUTE_VG
- };
+ virtual void machine_start() override;
+ virtual void video_start() override;
+
+ void vk100_mem(address_map &map);
+ void vk100_io(address_map &map);
+
+ void vgLD_X(offs_t offset, uint8_t data);
+ void vgLD_Y(offs_t offset, uint8_t data);
+ void vgERR(uint8_t data);
+ void vgSOPS(uint8_t data);
+ void vgPAT(uint8_t data);
+ void vgPMUL(uint8_t data);
+ void vgREG(offs_t offset, uint8_t data);
+ void vgEX(offs_t offset, uint8_t data);
+ void KBDW(uint8_t data);
+ uint8_t vk100_keyboard_column_r(offs_t offset);
+ uint8_t SYSTAT_A(offs_t offset);
+ uint8_t SYSTAT_B();
+
+ TIMER_CALLBACK_MEMBER(execute_vg);
+ DECLARE_WRITE_LINE_MEMBER(crtc_vsync);
+ DECLARE_WRITE_LINE_MEMBER(i8251_rxrdy_int);
+ DECLARE_WRITE_LINE_MEMBER(i8251_txrdy_int);
+ DECLARE_WRITE_LINE_MEMBER(i8251_rts);
+ uint8_t vram_read();
+ uint8_t vram_attr_read();
+ MC6845_UPDATE_ROW(crtc_update_row);
+ void vram_write(uint8_t data);
required_device<cpu_device> m_maincpu;
required_device<mc6845_device> m_crtc;
required_device<beep_device> m_speaker;
required_device<i8251_device> m_uart;
- //required_device<> m_i8251_rx_timer;
- //required_device<> m_i8251_tx_timer;
- //required_device<> m_sync_timer;
required_ioport m_capsshift;
required_ioport m_dipsw;
@@ -219,6 +239,10 @@ private:
output_finder<> m_l1_led;
output_finder<> m_l2_led;
+ emu_timer* m_vg_timer;
+ //emu_timer* m_i8251_rx_timer;
+ //emu_timer* m_i8251_tx_timer;
+ //emu_timer* m_i8251_sync_timer;
uint8_t* m_vram;
uint8_t* m_trans;
uint8_t* m_pattern;
@@ -248,36 +272,6 @@ private:
uint8_t m_ACTS;
uint8_t m_ADSR;
ioport_port* m_col_array[16];
-
- void vgLD_X(offs_t offset, uint8_t data);
- void vgLD_Y(offs_t offset, uint8_t data);
- void vgERR(uint8_t data);
- void vgSOPS(uint8_t data);
- void vgPAT(uint8_t data);
- void vgPMUL(uint8_t data);
- void vgREG(offs_t offset, uint8_t data);
- void vgEX(offs_t offset, uint8_t data);
- void KBDW(uint8_t data);
- uint8_t vk100_keyboard_column_r(offs_t offset);
- uint8_t SYSTAT_A(offs_t offset);
- uint8_t SYSTAT_B();
-
- virtual void machine_start() override;
- virtual void video_start() override;
- TIMER_CALLBACK_MEMBER(execute_vg);
- DECLARE_WRITE_LINE_MEMBER(crtc_vsync);
- DECLARE_WRITE_LINE_MEMBER(i8251_rxrdy_int);
- DECLARE_WRITE_LINE_MEMBER(i8251_txrdy_int);
- DECLARE_WRITE_LINE_MEMBER(i8251_rts);
- uint8_t vram_read();
- uint8_t vram_attr_read();
- MC6845_UPDATE_ROW(crtc_update_row);
- void vram_write(uint8_t data);
-
- void vk100_io(address_map &map);
- void vk100_mem(address_map &map);
-
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
};
// vram access functions:
@@ -349,18 +343,6 @@ void vk100_state::vram_write(uint8_t data)
m_vram[(EA<<1)] = (block&0xFF00)>>8; // ''
}
-void vk100_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_EXECUTE_VG:
- execute_vg(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in vk100_state::device_timer");
- }
-}
-
/* this is the "DIRECTION ROM" == mb6309 (256x8, 82s135)
* see figure 5-24 on page 5-39
* It tells the direction and enable for counting on the X and Y counters
@@ -441,7 +423,11 @@ TIMER_CALLBACK_MEMBER(vk100_state::execute_vg)
m_vgPAT_Mask >>= 1; // shift the mask
if (m_vgPAT_Mask == 0) m_vgPAT_Mask = 0x80; // reset mask if it hits 0
}
- if (m_vgGO) timer_set(attotime::from_hz(XTAL(45'619'200)/3/12/2), TIMER_EXECUTE_VG); // /3/12/2 is correct. the sync counter is clocked by the dot clock, despite the error on figure 5-21
+ if (m_vgGO)
+ {
+ // /3/12/2 is correct. the sync counter is clocked by the dot clock, despite the error on figure 5-21
+ m_vg_timer->adjust(attotime::from_hz(XTAL(45'619'200)/3/12/2));
+ }
}
/* ports 0x40 and 0x41: load low and high bytes of vector gen X register */
@@ -564,7 +550,7 @@ void vk100_state::vgEX(offs_t offset, uint8_t data)
m_vgDownCount = VG_DU; // set down counter to length of major vector
m_VG_MODE = offset&3;
m_vgGO = 1;
- timer_set(attotime::zero, TIMER_EXECUTE_VG);
+ m_vg_timer->adjust(attotime::zero);
}
@@ -980,6 +966,12 @@ void vk100_state::machine_start()
sprintf(kbdcol,"COL%X", i);
m_col_array[i] = ioport(kbdcol);
}
+
+ m_vg_timer = timer_alloc(FUNC(vk100_state::execute_vg), this);
+ // TODO: figure out the best way to bring up the i8251 timers
+ //m_i8251_rx_timer = timer_alloc(FUNC(vk100_state::i8251_rx_tick), this);
+ //m_i8251_tx_timer = timer_alloc(FUNC(vk100_state::i8251_tx_tick), this);
+ //m_i8251_sync_timer = timer_alloc(FUNC(vk100_state::i8251_sync), this);
}
WRITE_LINE_MEMBER(vk100_state::crtc_vsync)
@@ -1005,15 +997,6 @@ WRITE_LINE_MEMBER(vk100_state::i8251_rts)
m_ACTS = state;
}
-void vk100_state::init_vk100()
-{
- // figure out how the heck to initialize the timers here
- //m_i8251_rx_timer = timer_alloc(TID_I8251_RX);
- //m_i8251_tx_timer = timer_alloc(TID_I8251_TX);
- //m_i8251_sync_timer = timer_alloc(TID_SYNC);
- //machine().scheduler().timer_set(attotime::from_hz(10000), FUNC(i8251_rx_clk));
-}
-
void vk100_state::video_start()
{
m_vram = memregion("vram")->base();
@@ -1290,4 +1273,4 @@ ROM_END
/* Driver */
/* YEAR NAME PARENT COMPAT MACHINE INPUT STATE INIT COMPANY FULLNAME FLAGS */
-COMP( 1980, vk100, 0, 0, vk100, vk100, vk100_state, init_vk100, "Digital Equipment Corporation", "VK100 'GIGI'", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND)
+COMP( 1980, vk100, 0, 0, vk100, vk100, vk100_state, empty_init, "Digital Equipment Corporation", "VK100 'GIGI'", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND)
diff --git a/src/mame/drivers/votrhv.cpp b/src/mame/drivers/votrhv.cpp
index 6fc43b07490..5a52563e518 100644
--- a/src/mame/drivers/votrhv.cpp
+++ b/src/mame/drivers/votrhv.cpp
@@ -81,11 +81,7 @@ class votrhv_state : public driver_device
public:
votrhv_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag)
- , m_maincpu(*this, "maincpu")
- , m_votrax(*this, "votrax")
, m_reset(*this, "reset")
- , m_swarray(*this, "SW.%u", 0U)
- , m_leds(*this, "led_%u", 0U)
, m_latchx(0)
, m_latchy(0)
, m_latcha_flop(false)
@@ -93,11 +89,12 @@ public:
, m_latcha_in(false)
, m_latchb_in(false)
, m_scanflag(false)
+ , m_maincpu(*this, "maincpu")
+ , m_votrax(*this, "votrax")
+ , m_swarray(*this, "SW.%u", 0U)
+ , m_leds(*this, "led_%u", 0U)
{ }
- // overrides
- virtual void device_start() override;
-
void votrhv(machine_config &config);
void hc110(machine_config &config);
@@ -105,19 +102,28 @@ public:
DECLARE_WRITE_LINE_MEMBER(key_pressed);
DECLARE_WRITE_LINE_MEMBER(pho_done);
- static const device_timer_id TIMER_RESUME = 0;
- static const device_timer_id TIMER_SCAN = 1;
-private:
- // overrides
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
+ required_device<input_merger_device> m_reset;
+
+ uint8_t m_latchx;
+ uint8_t m_latchy;
+ bool m_latcha_flop;
+ bool m_latchb_flop;
+ bool m_latcha_in;
+ bool m_latchb_in;
+ bool m_scanflag;
+private:
void mem_map(address_map &map);
required_device<m6800_cpu_device> m_maincpu;
required_device<votrax_sc01_device> m_votrax;
-protected:
- required_device<input_merger_device> m_reset;
-private:
+
+ TIMER_CALLBACK_MEMBER(resume_tick);
+
optional_ioport_array<16> m_swarray;
output_finder<5> m_leds;
@@ -128,16 +134,6 @@ private:
uint8_t latcha_rst_r();
uint8_t latchb_rst_r();
-protected:
- uint8_t m_latchx;
- uint8_t m_latchy;
- bool m_latcha_flop;
- bool m_latchb_flop;
- bool m_latcha_in;
- bool m_latchb_in;
- bool m_scanflag;
- emu_timer* m_scan_timer = nullptr;
-private:
emu_timer* m_resume_timer = nullptr;
};
@@ -147,11 +143,18 @@ public:
hc120_state(const machine_config &mconfig, device_type type, const char *tag)
: votrhv_state(mconfig, type, tag)
{ }
+
private:
- virtual void device_start() override;
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
virtual void key_check() override;
virtual uint8_t input_r() override;
virtual void latchx_w(uint8_t data) override;
+
+ TIMER_CALLBACK_MEMBER(scan_keys);
+
+ emu_timer* m_scan_timer = nullptr;
};
/******************************************************************************
@@ -192,12 +195,12 @@ void votrhv_state::mem_map(address_map &map)
// 2800-2fff open bus
map(0x3000, 0x3000).mirror(0x87ff).w(FUNC(votrhv_state::latchy_w));
// 3800-3fff open bus
- map(0x4000, 0x5fff).mirror(0x8000).rom().region("maincpu",0x4000); // Mask ROMs
+ map(0x4000, 0x5fff).mirror(0x8000).rom().region("maskrom", 0);
map(0x6000, 0x6000).mirror(0x87ff).r(FUNC(votrhv_state::latcha_rst_r));
map(0x6800, 0x6800).mirror(0x87ff).r(FUNC(votrhv_state::latchb_rst_r));
// 7000-77ff open bus
// 7800-79ff open bus
- map(0x7a00, 0x7fff).mirror(0x8000).rom().region("maincpu",0x7a00); // boot PROMs
+ map(0x7a00, 0x7fff).mirror(0x8000).rom().region("bootrom", 0);
}
@@ -391,30 +394,23 @@ INPUT_PORTS_END
Timer and machine/start/reset handlers
******************************************************************************/
-void votrhv_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(votrhv_state::resume_tick)
{
- switch(id)
- {
- case TIMER_RESUME:
- // shut the timer OFF
- m_resume_timer->adjust(attotime::never);
- m_resume_timer->enable(false);
- // pull the cpu out of reset
- m_maincpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE);
- break;
- case TIMER_SCAN:
- // invert the scan state bit
- m_scanflag = !m_scanflag;
- if (m_scan_timer) m_scan_timer->adjust(attotime::from_seconds(1));
- break;
- }
+ // pull the cpu out of reset
+ m_maincpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE);
}
-void votrhv_state::device_start()
+TIMER_CALLBACK_MEMBER(hc120_state::scan_keys)
{
- m_resume_timer = timer_alloc(TIMER_RESUME);
- m_resume_timer->adjust(attotime::never);
- m_resume_timer->enable(false);
+ // invert the scan state bit
+ m_scanflag = !m_scanflag;
+ m_scan_timer->adjust(attotime::from_seconds(1));
+}
+
+void votrhv_state::machine_start()
+{
+ m_resume_timer = timer_alloc(FUNC(votrhv_state::resume_tick), this);
+
m_leds.resolve();
save_item(NAME(m_latchx));
@@ -426,12 +422,22 @@ void votrhv_state::device_start()
save_item(NAME(m_scanflag));
}
+void votrhv_state::machine_reset()
+{
+ m_resume_timer->adjust(attotime::never);
+}
+
// hc-120 variant for scan_timer
-void hc120_state::device_start()
+void hc120_state::machine_start()
+{
+ votrhv_state::machine_start();
+
+ m_scan_timer = timer_alloc(FUNC(hc120_state::scan_keys), this);
+}
+
+void hc120_state::machine_reset()
{
- m_scan_timer = timer_alloc(TIMER_SCAN);
m_scan_timer->adjust(attotime::from_seconds(1)); // hc-120 specific; adjustable, guessed 1hz to 2hz? needs measurement
- votrhv_state::device_start();
}
/******************************************************************************
@@ -442,8 +448,8 @@ WRITE_LINE_MEMBER( votrhv_state::reset_counter )
{
if (state == CLEAR_LINE)
{
- // is the timer already running/non-zero? if not, start it.
- if (!m_resume_timer->enabled())
+ // if the timer is not already running, start it.
+ if (m_resume_timer->remaining().is_never())
{
m_resume_timer->adjust(attotime::from_hz(2'000'000/2/0x20));
}
@@ -692,15 +698,17 @@ void votrhv_state::hc110(machine_config &config)
******************************************************************************/
ROM_START(hc110)
- ROM_REGION(0x8000, "maincpu", 0) // 4x EA8316 (2316 equivalent) CMOS Mask ROMs and 2x 512x8 SN74S472 PROMs
- //ROM_LOAD("ea8316e030.ic9", 0x4000, 0x0800, CRC(fd8cbf7d) SHA1(a2e1406c498a1821cacfcda254534f8e8d6b8260)) // used on older firmware?
- ROM_LOAD("ea8316e144.ic9", 0x4000, 0x0800, CRC(636415ee) SHA1(9699ea75eed566447d8682f52665b01c1e876981))
- ROM_LOAD("ea8316e031.ic8", 0x4800, 0x0800, CRC(f2de4e3b) SHA1(0cdc71a4d01d73e403cdf283c6eeb53f97ca5623))
- ROM_LOAD("ea8316e032.ic7", 0x5000, 0x0800, CRC(5df1270c) SHA1(5c81fcb2bb2c0bf509aa9fc11a92071cd469e407))
- ROM_LOAD("ea8316e033.ic6", 0x5800, 0x0800, CRC(0d7e246c) SHA1(1454c6c7ef3743320443c7bd1f37df6a25ff7795))
+ ROM_REGION(0x8000, "maskrom", 0) // 4x EA8316 (2316 equivalent) CMOS Mask ROMs and 2x 512x8 SN74S472 PROMs
+ //ROM_LOAD("ea8316e030.ic9", 0x0000, 0x0800, CRC(fd8cbf7d) SHA1(a2e1406c498a1821cacfcda254534f8e8d6b8260)) // used on older firmware?
+ ROM_LOAD("ea8316e144.ic9", 0x0000, 0x0800, CRC(636415ee) SHA1(9699ea75eed566447d8682f52665b01c1e876981))
+ ROM_LOAD("ea8316e031.ic8", 0x0800, 0x0800, CRC(f2de4e3b) SHA1(0cdc71a4d01d73e403cdf283c6eeb53f97ca5623))
+ ROM_LOAD("ea8316e032.ic7", 0x1000, 0x0800, CRC(5df1270c) SHA1(5c81fcb2bb2c0bf509aa9fc11a92071cd469e407))
+ ROM_LOAD("ea8316e033.ic6", 0x1800, 0x0800, CRC(0d7e246c) SHA1(1454c6c7ef3743320443c7bd1f37df6a25ff7795))
+
+ ROM_REGION(0x0600, "bootrom", 0)
// ic12 is unpopulated
- ROM_LOAD("7031r2.sn74s472.ic11", 0x7c00, 0x0200, CRC(6ef744c9) SHA1(6a92e520adb3c47b849241648ec2ca4107edfd8f))
- ROM_LOAD("7031r3.sn74s472.ic10", 0x7e00, 0x0200, CRC(0800b0e6) SHA1(9e0481bf6c5feaf6506ac241a2baf83fb9342033))
+ ROM_LOAD("7031r2.sn74s472.ic11", 0x0200, 0x0200, CRC(6ef744c9) SHA1(6a92e520adb3c47b849241648ec2ca4107edfd8f))
+ ROM_LOAD("7031r3.sn74s472.ic10", 0x0400, 0x0200, CRC(0800b0e6) SHA1(9e0481bf6c5feaf6506ac241a2baf83fb9342033))
ROM_REGION16_BE(0x200, "s1818c", 0) // 1818C SYNTHESIZER BOARD; MCM14524 CMOS 256x4 mask ROMs holding the phoneme data
ROMX_LOAD("scm46109pk.mcm14524.u30", 0x000, 0x100, CRC(6a1292fe) SHA1(67c8ac71e22de134a651dd5cad06d26b27894154), ROM_SKIP(1) | ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO)
@@ -709,14 +717,16 @@ ROM_START(hc110)
ROM_END
ROM_START(hc120) // ic10 and ic11 are Rev B? is there an older revision undumped?
- ROM_REGION(0x8000, "maincpu", 0) // 4x EA8316 (2316 equivalent) CMOS Mask ROMs and 2x 512x8 SN74S472 PROMs
- ROM_LOAD("ea8316e030.ic9", 0x4000, 0x0800, CRC(fd8cbf7d) SHA1(a2e1406c498a1821cacfcda254534f8e8d6b8260))
- ROM_LOAD("ea8316e031.ic8", 0x4800, 0x0800, CRC(f2de4e3b) SHA1(0cdc71a4d01d73e403cdf283c6eeb53f97ca5623))
- ROM_LOAD("ea8316e032.ic7", 0x5000, 0x0800, CRC(5df1270c) SHA1(5c81fcb2bb2c0bf509aa9fc11a92071cd469e407))
- ROM_LOAD("ea8316e033.ic6", 0x5800, 0x0800, CRC(0d7e246c) SHA1(1454c6c7ef3743320443c7bd1f37df6a25ff7795))
+ ROM_REGION(0x2000, "maskrom", 0) // 4x EA8316 (2316 equivalent) CMOS Mask ROMs and 2x 512x8 SN74S472 PROMs
+ ROM_LOAD("ea8316e030.ic9", 0x0000, 0x0800, CRC(fd8cbf7d) SHA1(a2e1406c498a1821cacfcda254534f8e8d6b8260))
+ ROM_LOAD("ea8316e031.ic8", 0x0800, 0x0800, CRC(f2de4e3b) SHA1(0cdc71a4d01d73e403cdf283c6eeb53f97ca5623))
+ ROM_LOAD("ea8316e032.ic7", 0x1000, 0x0800, CRC(5df1270c) SHA1(5c81fcb2bb2c0bf509aa9fc11a92071cd469e407))
+ ROM_LOAD("ea8316e033.ic6", 0x1800, 0x0800, CRC(0d7e246c) SHA1(1454c6c7ef3743320443c7bd1f37df6a25ff7795))
+
+ ROM_REGION(0x0600, "bootrom", 0)
// ic12 is unpopulated
- ROM_LOAD("7037__r2b.sn74s472.ic11", 0x7c00, 0x0200, CRC(44de1bb1) SHA1(53e6811baf37af5da0648e906fee6c6acf259b82))
- ROM_LOAD("7037__r3b.sn74s472.ic10", 0x7e00, 0x0200, CRC(688be8c7) SHA1(c9bdc7472cabcdddc23e63f45afbfcc835bb8f69))
+ ROM_LOAD("7037__r2b.sn74s472.ic11", 0x0200, 0x0200, CRC(44de1bb1) SHA1(53e6811baf37af5da0648e906fee6c6acf259b82))
+ ROM_LOAD("7037__r3b.sn74s472.ic10", 0x0400, 0x0200, CRC(688be8c7) SHA1(c9bdc7472cabcdddc23e63f45afbfcc835bb8f69))
ROM_REGION16_BE(0x200, "s1818c", 0) // 1818C SYNTHESIZER BOARD; MCM14524 CMOS 256x4 mask ROMs holding the phoneme data
ROMX_LOAD("scm46109pk.mcm14524.u30", 0x000, 0x100, CRC(6a1292fe) SHA1(67c8ac71e22de134a651dd5cad06d26b27894154), ROM_SKIP(1) | ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO)
diff --git a/src/mame/drivers/vp415.cpp b/src/mame/drivers/vp415.cpp
index fa623b81ac8..d13d41c5153 100644
--- a/src/mame/drivers/vp415.cpp
+++ b/src/mame/drivers/vp415.cpp
@@ -41,25 +41,23 @@
#include "emu.h"
#include "includes/vp415.h"
-/*static*/ const char *const vp415_state::DATACPU_TAG = "datacpu";
-/*static*/ const char *const vp415_state::DATAMCU_TAG = "datamcu";
-/*static*/ const char *const vp415_state::DATARAM_TAG = "dataram";
-/*static*/ const char *const vp415_state::SCSI_TAG = "ncr5385";
-/*static*/ const char *const vp415_state::CTRLCPU_TAG = "ctrlcpu";
-/*static*/ const char *const vp415_state::CTRLMCU_TAG = "ctrlmcu";
-/*static*/ const char *const vp415_state::CTRLRAM_TAG = "ctrlram";
-/*static*/ const char *const vp415_state::DRIVECPU_TAG = "drivecpu";
-/*static*/ const char *const vp415_state::DESCRAMBLE_ROM_TAG = "descramblerom";
-/*static*/ const char *const vp415_state::SYNC_ROM_TAG = "syncrom";
-/*static*/ const char *const vp415_state::DRIVE_ROM_TAG = "driverom";
-/*static*/ const char *const vp415_state::CONTROL_ROM_TAG = "controlrom";
-/*static*/ const char *const vp415_state::SWITCHES_TAG = "SWITCHES";
-/*static*/ const char *const vp415_state::I8155_TAG = "i8155";
-/*static*/ const char *const vp415_state::I8255_TAG = "i8255";
-/*static*/ const char *const vp415_state::CHARGEN_TAG = "mb88303";
-/*static*/ const char *const vp415_state::SYNCGEN_TAG = "saa1043";
-
-/*static*/ const device_timer_id vp415_state::DRIVE_2PPR_ID = 0;
+const char *const vp415_state::DATACPU_TAG = "datacpu";
+const char *const vp415_state::DATAMCU_TAG = "datamcu";
+const char *const vp415_state::DATARAM_TAG = "dataram";
+const char *const vp415_state::SCSI_TAG = "ncr5385";
+const char *const vp415_state::CTRLCPU_TAG = "ctrlcpu";
+const char *const vp415_state::CTRLMCU_TAG = "ctrlmcu";
+const char *const vp415_state::CTRLRAM_TAG = "ctrlram";
+const char *const vp415_state::DRIVECPU_TAG = "drivecpu";
+const char *const vp415_state::DESCRAMBLE_ROM_TAG = "descramblerom";
+const char *const vp415_state::SYNC_ROM_TAG = "syncrom";
+const char *const vp415_state::DRIVE_ROM_TAG = "driverom";
+const char *const vp415_state::CONTROL_ROM_TAG = "controlrom";
+const char *const vp415_state::SWITCHES_TAG = "SWITCHES";
+const char *const vp415_state::I8155_TAG = "i8155";
+const char *const vp415_state::I8255_TAG = "i8255";
+const char *const vp415_state::CHARGEN_TAG = "mb88303";
+const char *const vp415_state::SYNCGEN_TAG = "saa1043";
vp415_state::vp415_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag)
@@ -102,20 +100,13 @@ void vp415_state::machine_reset()
void vp415_state::machine_start()
{
- m_drive_2ppr_timer = timer_alloc(DRIVE_2PPR_ID);
+ m_drive_2ppr_timer = timer_alloc(FUNC(vp415_state::drive_2ppr_tick), this);
}
-void vp415_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(vp415_state::drive_2ppr_tick)
{
- switch (id)
- {
- case DRIVE_2PPR_ID:
- m_drive_2ppr ^= I8155PB_2PPR;
- m_drive_2ppr_timer->adjust(attotime::from_msec(10));
- break;
- default:
- break;
- }
+ m_drive_2ppr ^= I8155PB_2PPR;
+ m_drive_2ppr_timer->adjust(attotime::from_msec(10));
}
WRITE_LINE_MEMBER(vp415_state::refv_w)
diff --git a/src/mame/drivers/wgp.cpp b/src/mame/drivers/wgp.cpp
index d63ec5779f1..df65cec64f0 100644
--- a/src/mame/drivers/wgp.cpp
+++ b/src/mame/drivers/wgp.cpp
@@ -435,21 +435,10 @@ void wgp_state::cpua_ctrl_w(u16 data)/* assumes Z80 sandwiched between 68Ks */
INTERRUPTS
***********************************************************/
-void wgp_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(wgp_state::trigger_cpu_b_int6)
{
- switch (id)
- {
- /* 68000 A */
- case TIMER_INTERRUPT4:
- m_maincpu->set_input_line(4, HOLD_LINE);
- break;
/* 68000 B */
- case TIMER_CPUB_INTERRUPT6:
- m_subcpu->set_input_line(6, HOLD_LINE); /* assumes Z80 sandwiched between the 68Ks */
- break;
- default:
- throw emu_fatalerror("Unknown id in wgp_state::device_timer");
- }
+ m_subcpu->set_input_line(6, HOLD_LINE); /* assumes Z80 sandwiched between the 68Ks */
}
@@ -851,7 +840,7 @@ void wgp_state::machine_start()
{
m_z80bank->configure_entries(0, 4, memregion("audiocpu")->base(), 0x4000);
- m_cpub_int6_timer = timer_alloc(TIMER_CPUB_INTERRUPT6);
+ m_cpub_int6_timer = timer_alloc(FUNC(wgp_state::trigger_cpu_b_int6), this);
save_item(NAME(m_cpua_ctrl));
save_item(NAME(m_port_sel));
diff --git a/src/mame/drivers/wicat.cpp b/src/mame/drivers/wicat.cpp
index 60d828fdaf5..db3110aac62 100644
--- a/src/mame/drivers/wicat.cpp
+++ b/src/mame/drivers/wicat.cpp
@@ -66,6 +66,23 @@ public:
void wicat(machine_config &config);
private:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void driver_start() override;
+
+ void main_mem(address_map &map);
+ void video_io(address_map &map);
+ void video_mem(address_map &map);
+ void wd1000_io(address_map &map);
+ void wd1000_mem(address_map &map);
+
+ TIMER_CALLBACK_MEMBER(poll_kb);
+ TIMER_CALLBACK_MEMBER(kb_serial_tick);
+
+ uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { return 0; }
+
+ void send_key(uint8_t val);
+
uint16_t invalid_r(offs_t offset);
void invalid_w(offs_t offset, uint16_t data);
uint16_t memmap_r();
@@ -109,26 +126,8 @@ private:
required_memory_region m_chargen;
required_device<fd1795_device> m_fdc;
- uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { return 0; }
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
- void main_mem(address_map &map);
- void video_io(address_map &map);
- void video_mem(address_map &map);
- void wd1000_io(address_map &map);
- void wd1000_mem(address_map &map);
-
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void driver_start() override;
-
- void poll_kb();
- void send_key(uint8_t val);
-
emu_timer* m_kb_timer;
emu_timer* m_kb_serial_timer;
- static const device_timer_id KB_TIMER = 1;
- static const device_timer_id KB_SERIAL_TIMER = 2;
uint8_t m_portA;
uint8_t m_portB;
@@ -276,8 +275,8 @@ static void wicat_floppies(device_slot_interface &device)
void wicat_state::driver_start()
{
- m_kb_timer = timer_alloc(KB_TIMER);
- m_kb_serial_timer = timer_alloc(KB_SERIAL_TIMER);
+ m_kb_timer = timer_alloc(FUNC(wicat_state::poll_kb), this);
+ m_kb_serial_timer = timer_alloc(FUNC(wicat_state::kb_serial_tick), this);
}
void wicat_state::machine_start()
@@ -305,25 +304,17 @@ void wicat_state::machine_reset()
elem = 0;
}
-void wicat_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(wicat_state::kb_serial_tick)
{
- switch (id)
+ m_videouart->write_rri((m_kb_data >> (m_kb_bit)) & 0x01);
+ m_kb_bit++;
+ if(m_kb_bit > 10)
{
- case KB_TIMER:
- poll_kb();
- break;
- case KB_SERIAL_TIMER:
- m_videouart->write_rri((m_kb_data >> (m_kb_bit)) & 0x01);
- m_kb_bit++;
- if(m_kb_bit > 10)
- {
- m_kb_serial_timer->reset();
- }
- break;
+ m_kb_serial_timer->reset();
}
}
-void wicat_state::poll_kb()
+TIMER_CALLBACK_MEMBER(wicat_state::poll_kb)
{
uint8_t line;
uint8_t val = 0;
diff --git a/src/mame/drivers/wolfpack.cpp b/src/mame/drivers/wolfpack.cpp
index 76dbca4a6c5..bc7291a2abb 100644
--- a/src/mame/drivers/wolfpack.cpp
+++ b/src/mame/drivers/wolfpack.cpp
@@ -14,19 +14,6 @@
#include "speaker.h"
-void wolfpack_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_PERIODIC:
- periodic_callback(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in wolfpack_state::device_timer");
- }
-}
-
-
TIMER_CALLBACK_MEMBER(wolfpack_state::periodic_callback)
{
int scanline = param;
@@ -44,7 +31,7 @@ TIMER_CALLBACK_MEMBER(wolfpack_state::periodic_callback)
void wolfpack_state::machine_start()
{
m_led.resolve();
- m_periodic_timer = timer_alloc(TIMER_PERIODIC);
+ m_periodic_timer = timer_alloc(FUNC(wolfpack_state::periodic_callback), this);
}
void wolfpack_state::machine_reset()
diff --git a/src/mame/drivers/wpc_an.cpp b/src/mame/drivers/wpc_an.cpp
index 7a6369984df..ec33b35076b 100644
--- a/src/mame/drivers/wpc_an.cpp
+++ b/src/mame/drivers/wpc_an.cpp
@@ -119,8 +119,27 @@ public:
void init_wpc_an();
private:
+ // driver_device overrides
+ virtual void machine_reset() override;
+ virtual void machine_start() override;
+
void wpc_an_map(address_map &map);
+ TIMER_CALLBACK_MEMBER(vblank_tick);
+ TIMER_CALLBACK_MEMBER(trigger_irq);
+
+ uint8_t ram_r(offs_t offset);
+ void ram_w(offs_t offset, uint8_t data);
+ DECLARE_WRITE_LINE_MEMBER(snd_reply_w);
+ DECLARE_WRITE_LINE_MEMBER(irq_w);
+ DECLARE_WRITE_LINE_MEMBER(firq_w);
+ uint8_t sound_ctrl_r();
+ void sound_ctrl_w(uint8_t data);
+ uint8_t sound_data_r();
+ void sound_data_w(uint8_t data);
+ void sound_s11_w(uint8_t data);
+ void rombank_w(uint8_t data);
+
// devices
required_device<cpu_device> m_maincpu;
optional_device<s11c_bg_device> m_bg; // only used w/ Dr. Dude and Funhouse Proto
@@ -129,25 +148,6 @@ private:
required_device<wpc_device> m_wpc;
output_finder<32> m_digits;
- // driver_device overrides
- virtual void machine_reset() override;
- virtual void machine_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
- static const device_timer_id TIMER_VBLANK = 0;
- static const device_timer_id TIMER_IRQ = 1;
-
- uint8_t ram_r(offs_t offset);
- void ram_w(offs_t offset, uint8_t data);
- DECLARE_WRITE_LINE_MEMBER(wpcsnd_reply_w);
- DECLARE_WRITE_LINE_MEMBER(wpc_irq_w);
- DECLARE_WRITE_LINE_MEMBER(wpc_firq_w);
- uint8_t wpc_sound_ctrl_r();
- void wpc_sound_ctrl_w(uint8_t data);
- uint8_t wpc_sound_data_r();
- void wpc_sound_data_w(uint8_t data);
- void wpc_sound_s11_w(uint8_t data);
- void wpc_rombank_w(uint8_t data);
-
uint16_t m_vblank_count = 0U;
uint32_t m_irq_count = 0U;
uint8_t m_bankmask = 0U;
@@ -283,56 +283,52 @@ static INPUT_PORTS_START( wpc_an )
INPUT_PORTS_END
-void wpc_an_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(wpc_an_state::vblank_tick)
{
- int x;
- switch(id)
+ // update LED segments
+ for(int x = 0; x < 16; x++)
{
- case TIMER_VBLANK:
- // update LED segments
- for(x=0;x<16;x++)
- {
- m_digits[x] = bitswap<16>(m_wpc->get_alphanumeric(x), 15, 7, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0);
- m_digits[x+16] = bitswap<16>(m_wpc->get_alphanumeric(20+x), 15, 7, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0);
- }
- m_wpc->reset_alphanumeric();
- m_vblank_count++;
- break;
- case TIMER_IRQ:
- m_maincpu->set_input_line(M6809_IRQ_LINE,ASSERT_LINE);
- break;
+ m_digits[x] = bitswap<16>(m_wpc->get_alphanumeric(x), 15, 7, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0);
+ m_digits[x+16] = bitswap<16>(m_wpc->get_alphanumeric(20+x), 15, 7, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0);
}
+ m_wpc->reset_alphanumeric();
+ m_vblank_count++;
+}
+
+TIMER_CALLBACK_MEMBER(wpc_an_state::trigger_irq)
+{
+ m_maincpu->set_input_line(M6809_IRQ_LINE, ASSERT_LINE);
}
-void wpc_an_state::wpc_rombank_w(uint8_t data)
+void wpc_an_state::rombank_w(uint8_t data)
{
m_cpubank->set_entry(data & m_bankmask);
}
-WRITE_LINE_MEMBER(wpc_an_state::wpcsnd_reply_w)
+WRITE_LINE_MEMBER(wpc_an_state::snd_reply_w)
{
if(state)
m_maincpu->set_input_line(M6809_FIRQ_LINE,ASSERT_LINE);
}
-WRITE_LINE_MEMBER(wpc_an_state::wpc_irq_w)
+WRITE_LINE_MEMBER(wpc_an_state::irq_w)
{
m_maincpu->set_input_line(M6809_IRQ_LINE,CLEAR_LINE);
}
-WRITE_LINE_MEMBER(wpc_an_state::wpc_firq_w)
+WRITE_LINE_MEMBER(wpc_an_state::firq_w)
{
m_maincpu->set_input_line(M6809_FIRQ_LINE,CLEAR_LINE);
}
-uint8_t wpc_an_state::wpc_sound_ctrl_r()
+uint8_t wpc_an_state::sound_ctrl_r()
{
if(m_wpcsnd)
return m_wpcsnd->ctrl_r(); // ack FIRQ?
return 0;
}
-void wpc_an_state::wpc_sound_ctrl_w(uint8_t data)
+void wpc_an_state::sound_ctrl_w(uint8_t data)
{
if(m_bg)
{
@@ -343,14 +339,14 @@ void wpc_an_state::wpc_sound_ctrl_w(uint8_t data)
m_wpcsnd->ctrl_w(data);
}
-uint8_t wpc_an_state::wpc_sound_data_r()
+uint8_t wpc_an_state::sound_data_r()
{
if(m_wpcsnd)
return m_wpcsnd->data_r();
return 0;
}
-void wpc_an_state::wpc_sound_data_w(uint8_t data)
+void wpc_an_state::sound_data_w(uint8_t data)
{
if(m_bg)
{
@@ -361,7 +357,7 @@ void wpc_an_state::wpc_sound_data_w(uint8_t data)
m_wpcsnd->data_w(data);
}
-void wpc_an_state::wpc_sound_s11_w(uint8_t data)
+void wpc_an_state::sound_s11_w(uint8_t data)
{
if(m_bg)
{
@@ -409,9 +405,9 @@ void wpc_an_state::init_wpc_an()
m_cpubank->configure_entries(0, 32, &ROM[0x10000], 0x4000);
m_cpubank->set_entry(0);
- m_vblank_timer = timer_alloc(TIMER_VBLANK);
+ m_vblank_timer = timer_alloc(FUNC(wpc_an_state::vblank_tick), this);
m_vblank_timer->adjust(attotime::from_hz(60),0,attotime::from_hz(60));
- m_irq_timer = timer_alloc(TIMER_IRQ);
+ m_irq_timer = timer_alloc(FUNC(wpc_an_state::trigger_irq), this);
m_irq_timer->adjust(attotime::from_hz(976),0,attotime::from_hz(976));
m_bankmask = ((memregion("maincpu")->bytes()-0x10000) >> 14) - 1;
@@ -429,14 +425,14 @@ void wpc_an_state::wpc_an_base(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &wpc_an_state::wpc_an_map);
WPCASIC(config, m_wpc, 0);
- m_wpc->irq_callback().set(FUNC(wpc_an_state::wpc_irq_w));
- m_wpc->firq_callback().set(FUNC(wpc_an_state::wpc_firq_w));
- m_wpc->bank_write().set(FUNC(wpc_an_state::wpc_rombank_w));
- m_wpc->sound_ctrl_read().set(FUNC(wpc_an_state::wpc_sound_ctrl_r));
- m_wpc->sound_ctrl_write().set(FUNC(wpc_an_state::wpc_sound_ctrl_w));
- m_wpc->sound_data_read().set(FUNC(wpc_an_state::wpc_sound_data_r));
- m_wpc->sound_data_write().set(FUNC(wpc_an_state::wpc_sound_data_w));
- m_wpc->sound_s11_write().set(FUNC(wpc_an_state::wpc_sound_s11_w));
+ m_wpc->irq_callback().set(FUNC(wpc_an_state::irq_w));
+ m_wpc->firq_callback().set(FUNC(wpc_an_state::firq_w));
+ m_wpc->bank_write().set(FUNC(wpc_an_state::rombank_w));
+ m_wpc->sound_ctrl_read().set(FUNC(wpc_an_state::sound_ctrl_r));
+ m_wpc->sound_ctrl_write().set(FUNC(wpc_an_state::sound_ctrl_w));
+ m_wpc->sound_data_read().set(FUNC(wpc_an_state::sound_data_r));
+ m_wpc->sound_data_write().set(FUNC(wpc_an_state::sound_data_w));
+ m_wpc->sound_s11_write().set(FUNC(wpc_an_state::sound_s11_w));
config.set_default_layout(layout_wpc_an);
}
@@ -448,7 +444,7 @@ void wpc_an_state::wpc_an(machine_config &config)
SPEAKER(config, "speaker").front_center();
WPCSND(config, m_wpcsnd);
m_wpcsnd->set_romregion("sound1");
- m_wpcsnd->reply_callback().set(FUNC(wpc_an_state::wpcsnd_reply_w));
+ m_wpcsnd->reply_callback().set(FUNC(wpc_an_state::snd_reply_w));
m_wpcsnd->add_route(ALL_OUTPUTS, "speaker", 1.0);
}
diff --git a/src/mame/drivers/wpc_dot.cpp b/src/mame/drivers/wpc_dot.cpp
index 3aa4b8e1a31..c327fe1c2c2 100644
--- a/src/mame/drivers/wpc_dot.cpp
+++ b/src/mame/drivers/wpc_dot.cpp
@@ -174,22 +174,19 @@ static INPUT_PORTS_START( wpc_dot )
PORT_DIPSETTING(0xf0,"USA 2")
INPUT_PORTS_END
-void wpc_dot_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(wpc_dot_state::vblank_tick)
{
- switch(id)
+ if((m_vblank_count % 4) == (m_wpc->get_dmd_firq_line() * 4 / 32))
{
- case TIMER_VBLANK:
- if((m_vblank_count % 4) == (m_wpc->get_dmd_firq_line()*4/32))
- {
- m_maincpu->set_input_line(M6809_FIRQ_LINE,ASSERT_LINE);
- m_wpc->set_dmd_firq();
- }
- m_vblank_count++;
- break;
- case TIMER_IRQ:
- m_maincpu->set_input_line(M6809_IRQ_LINE,ASSERT_LINE);
- break;
+ m_maincpu->set_input_line(M6809_FIRQ_LINE, ASSERT_LINE);
+ m_wpc->set_dmd_firq();
}
+ m_vblank_count++;
+}
+
+TIMER_CALLBACK_MEMBER(wpc_dot_state::trigger_irq)
+{
+ m_maincpu->set_input_line(M6809_IRQ_LINE, ASSERT_LINE);
}
void wpc_dot_state::machine_start()
@@ -228,9 +225,9 @@ void wpc_dot_state::init_wpc_dot()
m_dmdbanks[4]->set_entry(4);
m_dmdbanks[5]->configure_entries(0, 16, &m_dmdram[0x0000],0x200);
m_dmdbanks[5]->set_entry(5);
- m_vblank_timer = timer_alloc(TIMER_VBLANK);
+ m_vblank_timer = timer_alloc(FUNC(wpc_dot_state::vblank_tick), this);
m_vblank_timer->adjust(attotime::from_hz(60),0,attotime::from_hz(60*4));
- m_irq_timer = timer_alloc(TIMER_IRQ);
+ m_irq_timer = timer_alloc(FUNC(wpc_dot_state::trigger_irq), this);
m_irq_timer->adjust(attotime::from_hz(976),0,attotime::from_hz(976));
m_bankmask = (memregion("code")->bytes() >> 14) - 1;
logerror("WPC: ROM bank mask = %02x\n",m_bankmask);
@@ -252,12 +249,12 @@ void wpc_dot_state::ram_w(offs_t offset, uint8_t data)
logerror("WPC: Memory protection violation at 0x%04x (mask=0x%04x)\n",offset,m_wpc->get_memprotect_mask());
}
-void wpc_dot_state::wpc_rombank_w(uint8_t data)
+void wpc_dot_state::rombank_w(uint8_t data)
{
m_cpubank->set_entry(data & m_bankmask);
}
-void wpc_dot_state::wpc_dmdbank_w(offs_t offset, uint8_t data)
+void wpc_dot_state::dmdbank_w(offs_t offset, uint8_t data)
{
uint8_t const bank(offset & 0x07);
uint8_t const page(offset >> 4);
@@ -274,7 +271,7 @@ void wpc_dot_state::wpc_dmdbank_w(offs_t offset, uint8_t data)
}
}
-WRITE_LINE_MEMBER(wpc_dot_state::wpcsnd_reply_w)
+WRITE_LINE_MEMBER(wpc_dot_state::snd_reply_w)
{
if(state)
{
@@ -283,12 +280,12 @@ WRITE_LINE_MEMBER(wpc_dot_state::wpcsnd_reply_w)
}
}
-WRITE_LINE_MEMBER(wpc_dot_state::wpc_irq_w)
+WRITE_LINE_MEMBER(wpc_dot_state::irq_w)
{
m_maincpu->set_input_line(M6809_IRQ_LINE,CLEAR_LINE);
}
-WRITE_LINE_MEMBER(wpc_dot_state::wpc_firq_w)
+WRITE_LINE_MEMBER(wpc_dot_state::firq_w)
{
m_maincpu->set_input_line(M6809_FIRQ_LINE,CLEAR_LINE);
}
@@ -319,19 +316,19 @@ void wpc_dot_state::wpc_dot(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &wpc_dot_state::wpc_dot_map);
WPCASIC(config, m_wpc, 0);
- m_wpc->irq_callback().set(FUNC(wpc_dot_state::wpc_irq_w));
- m_wpc->firq_callback().set(FUNC(wpc_dot_state::wpc_firq_w));
- m_wpc->bank_write().set(FUNC(wpc_dot_state::wpc_rombank_w));
+ m_wpc->irq_callback().set(FUNC(wpc_dot_state::irq_w));
+ m_wpc->firq_callback().set(FUNC(wpc_dot_state::firq_w));
+ m_wpc->bank_write().set(FUNC(wpc_dot_state::rombank_w));
m_wpc->sound_ctrl_read().set(m_wpcsnd, FUNC(wpcsnd_device::ctrl_r)); // ack FIRQ?
m_wpc->sound_ctrl_write().set(m_wpcsnd, FUNC(wpcsnd_device::ctrl_w));
m_wpc->sound_data_read().set(m_wpcsnd, FUNC(wpcsnd_device::data_r));
m_wpc->sound_data_write().set(m_wpcsnd, FUNC(wpcsnd_device::data_w));
- m_wpc->dmdbank_write().set(FUNC(wpc_dot_state::wpc_dmdbank_w));
+ m_wpc->dmdbank_write().set(FUNC(wpc_dot_state::dmdbank_w));
SPEAKER(config, "speaker").front_center();
WPCSND(config, m_wpcsnd);
m_wpcsnd->set_romregion("sound1");
- m_wpcsnd->reply_callback().set(FUNC(wpc_dot_state::wpcsnd_reply_w));
+ m_wpcsnd->reply_callback().set(FUNC(wpc_dot_state::snd_reply_w));
m_wpcsnd->add_route(ALL_OUTPUTS, "speaker", 1.0);
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
diff --git a/src/mame/drivers/wpc_flip1.cpp b/src/mame/drivers/wpc_flip1.cpp
index 70b2aad861b..13eb2e70a8f 100644
--- a/src/mame/drivers/wpc_flip1.cpp
+++ b/src/mame/drivers/wpc_flip1.cpp
@@ -184,19 +184,19 @@ void wpc_flip1_state::wpc_flip1(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &wpc_flip1_state::wpc_flip1_map);
WPCASIC(config, m_wpc, 0);
- m_wpc->irq_callback().set(FUNC(wpc_flip1_state::wpc_irq_w));
- m_wpc->firq_callback().set(FUNC(wpc_flip1_state::wpc_firq_w));
- m_wpc->bank_write().set(FUNC(wpc_flip1_state::wpc_rombank_w));
+ m_wpc->irq_callback().set(FUNC(wpc_flip1_state::irq_w));
+ m_wpc->firq_callback().set(FUNC(wpc_flip1_state::firq_w));
+ m_wpc->bank_write().set(FUNC(wpc_flip1_state::rombank_w));
m_wpc->sound_ctrl_read().set(m_wpcsnd, FUNC(wpcsnd_device::ctrl_r));
m_wpc->sound_ctrl_write().set(m_wpcsnd, FUNC(wpcsnd_device::ctrl_w));
m_wpc->sound_data_read().set(m_wpcsnd, FUNC(wpcsnd_device::data_r));
m_wpc->sound_data_write().set(m_wpcsnd, FUNC(wpcsnd_device::data_w));
- m_wpc->dmdbank_write().set(FUNC(wpc_flip1_state::wpc_dmdbank_w));
+ m_wpc->dmdbank_write().set(FUNC(wpc_flip1_state::dmdbank_w));
SPEAKER(config, "speaker").front_center();
WPCSND(config, m_wpcsnd);
m_wpcsnd->set_romregion("sound1");
- m_wpcsnd->reply_callback().set(FUNC(wpc_flip1_state::wpcsnd_reply_w));
+ m_wpcsnd->reply_callback().set(FUNC(wpc_flip1_state::snd_reply_w));
m_wpcsnd->add_route(ALL_OUTPUTS, "speaker", 1.0);
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
diff --git a/src/mame/drivers/wpc_flip2.cpp b/src/mame/drivers/wpc_flip2.cpp
index 0108880ad8b..57d11e7e152 100644
--- a/src/mame/drivers/wpc_flip2.cpp
+++ b/src/mame/drivers/wpc_flip2.cpp
@@ -226,19 +226,19 @@ void wpc_flip2_state::wpc_flip2(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &wpc_flip2_state::wpc_flip2_map);
WPCASIC(config, m_wpc, 0);
- m_wpc->irq_callback().set(FUNC(wpc_flip2_state::wpc_irq_w));
- m_wpc->firq_callback().set(FUNC(wpc_flip2_state::wpc_firq_w));
- m_wpc->bank_write().set(FUNC(wpc_flip2_state::wpc_rombank_w));
+ m_wpc->irq_callback().set(FUNC(wpc_flip2_state::irq_w));
+ m_wpc->firq_callback().set(FUNC(wpc_flip2_state::firq_w));
+ m_wpc->bank_write().set(FUNC(wpc_flip2_state::rombank_w));
m_wpc->sound_ctrl_read().set(m_wpcsnd, FUNC(wpcsnd_device::ctrl_r));
m_wpc->sound_ctrl_write().set(m_wpcsnd, FUNC(wpcsnd_device::ctrl_w));
m_wpc->sound_data_read().set(m_wpcsnd, FUNC(wpcsnd_device::data_r));
m_wpc->sound_data_write().set(m_wpcsnd, FUNC(wpcsnd_device::data_w));
- m_wpc->dmdbank_write().set(FUNC(wpc_flip2_state::wpc_dmdbank_w));
+ m_wpc->dmdbank_write().set(FUNC(wpc_flip2_state::dmdbank_w));
SPEAKER(config, "speaker").front_center();
WPCSND(config, m_wpcsnd);
m_wpcsnd->set_romregion("sound1");
- m_wpcsnd->reply_callback().set(FUNC(wpc_flip2_state::wpcsnd_reply_w));
+ m_wpcsnd->reply_callback().set(FUNC(wpc_flip2_state::snd_reply_w));
m_wpcsnd->add_route(ALL_OUTPUTS, "speaker", 1.0);
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
diff --git a/src/mame/drivers/x07.cpp b/src/mame/drivers/x07.cpp
index 381ea73d1e8..c5e17aa5ab8 100644
--- a/src/mame/drivers/x07.cpp
+++ b/src/mame/drivers/x07.cpp
@@ -1378,11 +1378,11 @@ GFXDECODE_END
void x07_state::machine_start()
{
uint32_t ram_size = m_ram->size();
- m_rsta_clear = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x07_state::rsta_clear),this));
- m_rstb_clear = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x07_state::rstb_clear),this));
- m_beep_stop = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x07_state::beep_stop),this));
- m_cass_poll = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x07_state::cassette_poll),this));
- m_cass_tick = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x07_state::cassette_tick),this));
+ m_rsta_clear = timer_alloc(FUNC(x07_state::rsta_clear), this);
+ m_rstb_clear = timer_alloc(FUNC(x07_state::rstb_clear), this);
+ m_beep_stop = timer_alloc(FUNC(x07_state::beep_stop), this);
+ m_cass_poll = timer_alloc(FUNC(x07_state::cassette_poll), this);
+ m_cass_tick = timer_alloc(FUNC(x07_state::cassette_tick), this);
m_nvram1->set_base(&m_t6834_ram, 0x800);
m_nvram2->set_base(m_ram->pointer(), ram_size);
diff --git a/src/mame/drivers/x1.cpp b/src/mame/drivers/x1.cpp
index 1852a94dd30..a454d4b3124 100644
--- a/src/mame/drivers/x1.cpp
+++ b/src/mame/drivers/x1.cpp
@@ -2133,7 +2133,7 @@ void x1_state::machine_start()
m_rtc.min = ((systime.local_time.minute / 10)<<4) | ((systime.local_time.minute % 10) & 0xf);
m_rtc.sec = ((systime.local_time.second / 10)<<4) | ((systime.local_time.second % 10) & 0xf);
- m_rtc_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x1_state::x1_rtc_increment),this));
+ m_rtc_timer = timer_alloc(FUNC(x1_state::x1_rtc_increment), this);
}
m_work_ram = make_unique_clear<uint8_t[]>(0x10000*0x10);
diff --git a/src/mame/drivers/x68k.cpp b/src/mame/drivers/x68k.cpp
index d782e63a6e8..ea060b0599d 100644
--- a/src/mame/drivers/x68k.cpp
+++ b/src/mame/drivers/x68k.cpp
@@ -147,36 +147,16 @@
static constexpr uint32_t adpcm_clock[2] = { 8000000, 4000000 };
static constexpr uint32_t adpcm_div[4] = { 1024, 768, 512, /* Reserved */512 };
-void x68k_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(x68k_state::floppy_tc_tick)
{
- switch (id)
- {
- case TIMER_X68K_LED:
- led_callback(param);
- break;
- case TIMER_X68K_SCC_ACK:
- scc_ack(param);
- break;
- case TIMER_MD_6BUTTON_PORT1_TIMEOUT:
- md_6button_port1_timeout(param);
- break;
- case TIMER_MD_6BUTTON_PORT2_TIMEOUT:
- md_6button_port2_timeout(param);
- break;
- case TIMER_X68K_BUS_ERROR:
- bus_error(param);
- break;
- case TIMER_X68K_FDC_TC:
- m_upd72065->tc_w(ASSERT_LINE);
- m_upd72065->tc_w(CLEAR_LINE);
- break;
- case TIMER_X68K_ADPCM:
- m_hd63450->drq3_w(1);
- m_hd63450->drq3_w(0);
- break;
- default:
- throw emu_fatalerror("Unknown id in x68k_state::device_timer");
- }
+ m_upd72065->tc_w(ASSERT_LINE);
+ m_upd72065->tc_w(CLEAR_LINE);
+}
+
+TIMER_CALLBACK_MEMBER(x68k_state::adpcm_drq_tick)
+{
+ m_hd63450->drq3_w(1);
+ m_hd63450->drq3_w(0);
}
// LED timer callback
@@ -373,8 +353,8 @@ TIMER_CALLBACK_MEMBER(x68k_state::md_6button_port2_timeout)
void x68k_state::md_6button_init()
{
- m_mdctrl.io_timeout1 = timer_alloc(TIMER_MD_6BUTTON_PORT1_TIMEOUT);
- m_mdctrl.io_timeout2 = timer_alloc(TIMER_MD_6BUTTON_PORT2_TIMEOUT);
+ m_mdctrl.io_timeout1 = timer_alloc(FUNC(x68k_state::md_6button_port1_timeout), this);
+ m_mdctrl.io_timeout2 = timer_alloc(FUNC(x68k_state::md_6button_port2_timeout), this);
}
uint8_t x68k_state::md_6button_r(int port)
@@ -1580,11 +1560,11 @@ void x68k_state::driver_init()
// copy last half of BIOS to a user region, to use for initial startup
memcpy(user2,(rom+0xff0000),0x10000);
- m_mouse_timer = timer_alloc(TIMER_X68K_SCC_ACK);
- m_led_timer = timer_alloc(TIMER_X68K_LED);
- m_fdc_tc = timer_alloc(TIMER_X68K_FDC_TC);
- m_adpcm_timer = timer_alloc(TIMER_X68K_ADPCM);
- m_bus_error_timer = timer_alloc(TIMER_X68K_BUS_ERROR);
+ m_mouse_timer = timer_alloc(FUNC(x68ksupr_state::scc_ack), this);
+ m_led_timer = timer_alloc(FUNC(x68ksupr_state::led_callback), this);
+ m_fdc_tc = timer_alloc(FUNC(x68ksupr_state::floppy_tc_tick), this);
+ m_adpcm_timer = timer_alloc(FUNC(x68ksupr_state::adpcm_drq_tick), this);
+ m_bus_error_timer = timer_alloc(FUNC(x68ksupr_state::bus_error), this);
// Initialise timers for 6-button MD controllers
md_6button_init();
diff --git a/src/mame/drivers/xavix2.cpp b/src/mame/drivers/xavix2.cpp
index b515aa8c910..56f30c5447e 100644
--- a/src/mame/drivers/xavix2.cpp
+++ b/src/mame/drivers/xavix2.cpp
@@ -618,7 +618,7 @@ uint32_t xavix2_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap
void xavix2_state::machine_start()
{
- m_dma_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(xavix2_state::dma_end), this));
+ m_dma_timer = timer_alloc(FUNC(xavix2_state::dma_end), this);
}
void xavix2_state::machine_reset()
diff --git a/src/mame/drivers/xexex.cpp b/src/mame/drivers/xexex.cpp
index e8ca567e95a..78c1717cb00 100644
--- a/src/mame/drivers/xexex.cpp
+++ b/src/mame/drivers/xexex.cpp
@@ -450,7 +450,7 @@ void xexex_state::machine_start()
save_item(NAME(m_cur_control2));
machine().save().register_postload(save_prepost_delegate(FUNC(xexex_state::xexex_postload), this));
- m_dmadelay_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(xexex_state::dmaend_callback),this));
+ m_dmadelay_timer = timer_alloc(FUNC(xexex_state::dmaend_callback), this);
}
void xexex_state::machine_reset()
diff --git a/src/mame/drivers/z80clock.cpp b/src/mame/drivers/z80clock.cpp
index f5bde81fcc5..a06c5c1e1b4 100644
--- a/src/mame/drivers/z80clock.cpp
+++ b/src/mame/drivers/z80clock.cpp
@@ -142,7 +142,7 @@ protected:
save_item(NAME(m_shift));
- m_clear_display_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(z80clock_state::clear_display), this));
+ m_clear_display_timer = timer_alloc(FUNC(z80clock_state::clear_display), this);
m_clear_display_timer->adjust(attotime::zero, 0, attotime::from_hz(240));
m_clear_display_count.resize(3);
diff --git a/src/mame/includes/abc80.h b/src/mame/includes/abc80.h
index 7536c596b13..5b10576295f 100644
--- a/src/mame/includes/abc80.h
+++ b/src/mame/includes/abc80.h
@@ -90,49 +90,25 @@ public:
m_tape_in_latch(1)
{ }
- static constexpr feature_type imperfect_features() { return feature::KEYBOARD; }
-
- required_device<z80_device> m_maincpu;
- required_device<z80pio_device> m_pio;
- required_device<sn76477_device> m_csg;
- required_device<cassette_image_device> m_cassette;
- required_device<abcbus_slot_device> m_bus;
- required_device<abc80_keyboard_device> m_kb;
- required_device<ram_device> m_ram;
- required_device<rs232_port_device> m_rs232;
- required_device<palette_device> m_palette;
- required_device<screen_device> m_screen;
- required_memory_region m_rom;
- required_memory_region m_mmu_rom;
- required_memory_region m_char_rom;
- required_memory_region m_hsync_prom;
- required_memory_region m_vsync_prom;
- required_memory_region m_line_prom;
- required_memory_region m_attr_prom;
- memory_share_creator<uint8_t> m_video_ram;
+ void abc80(machine_config &config);
+ void abc80_video(machine_config &config);
- enum
- {
- TIMER_ID_SCANLINE,
- TIMER_ID_CASSETTE,
- TIMER_ID_BLINK,
- TIMER_ID_VSYNC_ON,
- TIMER_ID_VSYNC_OFF,
- TIMER_ID_FAKE_KEYBOARD_CLEAR
- };
+ static constexpr feature_type imperfect_features() { return feature::KEYBOARD; }
- enum
- {
- BOFA = 0xfe1c,
- EOFA = 0xfe1e,
- HEAD = 0xfe20
- };
+protected:
+ virtual void machine_start() override;
+ virtual void video_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ void abc80_mem(address_map &map);
+ void abc80_io(address_map &map);
- virtual void machine_start() override;
+ TIMER_CALLBACK_MEMBER(scanline_tick);
+ TIMER_CALLBACK_MEMBER(cassette_update);
+ TIMER_CALLBACK_MEMBER(blink_tick);
+ TIMER_CALLBACK_MEMBER(vsync_on);
+ TIMER_CALLBACK_MEMBER(vsync_off);
+ TIMER_CALLBACK_MEMBER(clear_keyboard);
- virtual void video_start() override;
u32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void draw_scanline(bitmap_rgb32 &bitmap, int y);
@@ -154,12 +130,38 @@ public:
enum
{
+ BOFA = 0xfe1c,
+ EOFA = 0xfe1e,
+ HEAD = 0xfe20
+ };
+
+ enum
+ {
MMU_XM = 0x01,
MMU_ROM = 0x02,
MMU_VRAMS = 0x04,
MMU_RAM = 0x08
};
+ required_device<z80_device> m_maincpu;
+ required_device<z80pio_device> m_pio;
+ required_device<sn76477_device> m_csg;
+ required_device<cassette_image_device> m_cassette;
+ required_device<abcbus_slot_device> m_bus;
+ required_device<abc80_keyboard_device> m_kb;
+ required_device<ram_device> m_ram;
+ required_device<rs232_port_device> m_rs232;
+ required_device<palette_device> m_palette;
+ required_device<screen_device> m_screen;
+ required_memory_region m_rom;
+ required_memory_region m_mmu_rom;
+ required_memory_region m_char_rom;
+ required_memory_region m_hsync_prom;
+ required_memory_region m_vsync_prom;
+ required_memory_region m_line_prom;
+ required_memory_region m_attr_prom;
+ memory_share_creator<uint8_t> m_video_ram;
+
// keyboard state
int m_key_data = 0;
int m_key_strobe = 0;
@@ -184,10 +186,7 @@ public:
emu_timer *m_blink_timer = nullptr;
emu_timer *m_vsync_on_timer = nullptr;
emu_timer *m_vsync_off_timer = nullptr;
- void abc80(machine_config &config);
- void abc80_video(machine_config &config);
- void abc80_io(address_map &map);
- void abc80_mem(address_map &map);
+ emu_timer *m_keyboard_clear_timer = nullptr;
};
#endif // MAME_INCLUDES_ABC80_H
diff --git a/src/mame/includes/alesis.h b/src/mame/includes/alesis.h
index d2978699fd2..0d1ef4ac055 100644
--- a/src/mame/includes/alesis.h
+++ b/src/mame/includes/alesis.h
@@ -34,20 +34,20 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_add_mconfig(machine_config &config) override;
+ TIMER_CALLBACK_MEMBER(dac_update);
+
private:
- static const device_timer_id TIMER_DAC_UPDATE = 1;
required_device<dac_word_interface> m_dac;
required_region_ptr<int8_t> m_samples;
- emu_timer * m_dac_update_timer = nullptr;
- bool m_output_active = false;
- int m_count = 0;
- int m_shift = 0;
- uint32_t m_cur_sample = 0;
- uint8_t m_cmd[5]{};
+ emu_timer * m_dac_update_timer;
+ bool m_output_active;
+ int m_count;
+ int m_shift;
+ uint32_t m_cur_sample;
+ uint8_t m_cmd[5]{};
};
diff --git a/src/mame/includes/amiga.h b/src/mame/includes/amiga.h
index 3261d856d4a..3bdcf6db361 100644
--- a/src/mame/includes/amiga.h
+++ b/src/mame/includes/amiga.h
@@ -555,9 +555,6 @@ protected:
virtual void machine_start() override;
virtual void machine_reset() override;
- // device_t overrides
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
void custom_chip_reset();
// interrupts
@@ -662,14 +659,6 @@ private:
enum
{
- TIMER_SCANLINE,
- TIMER_AMIGA_IRQ,
- TIMER_AMIGA_BLITTER,
- TIMER_SERIAL
- };
-
- enum
- {
VPOSR_LOF = 0x8000 // long frame
};
@@ -731,7 +720,7 @@ private:
int m_rs232_cts = 0;
void serial_adjust();
- void serial_shift();
+ TIMER_CALLBACK_MEMBER(serial_shift);
void rx_write(int level);
uint32_t amiga_gethvpos();
diff --git a/src/mame/includes/amstrad.h b/src/mame/includes/amstrad.h
index fa6718a73eb..dbbb75fe064 100644
--- a/src/mame/includes/amstrad.h
+++ b/src/mame/includes/amstrad.h
@@ -96,15 +96,7 @@ public:
optional_device<cpc_expansion_slot_device> m_exp; // not on a GX4000; accessed by a static function in machine/amstrad.cpp
protected:
- enum
- {
- TIMER_PC2_LOW,
- TIMER_VIDEO_UPDATE,
- TIMER_SET_RESOLUTION
- };
-
virtual void video_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
private:
required_device<z80_device> m_maincpu;
@@ -123,6 +115,10 @@ private:
uint8_t m_aleste_mode = 0;
int m_plus_irq_cause = 0;
+ emu_timer *m_pc2_low_timer = nullptr;
+ emu_timer *m_video_update_timer = nullptr;
+ emu_timer *m_set_resolution_timer = nullptr;
+
/****************************
* Gate Array data (CPC) -
****************************/
@@ -213,6 +209,7 @@ private:
unsigned char m_Psg_FunctionSelected = 0;
int m_previous_ppi_portc_w = 0;
uint8_t m_amx_mouse_data = 0;
+ void alloc_timers();
void amstrad_plus_asic_4000_w(offs_t offset, uint8_t data);
void amstrad_plus_asic_6000_w(offs_t offset, uint8_t data);
uint8_t amstrad_plus_asic_4000_r(offs_t offset);
diff --git a/src/mame/includes/apexc.h b/src/mame/includes/apexc.h
index 99cf68ae507..b5ac0d31113 100644
--- a/src/mame/includes/apexc.h
+++ b/src/mame/includes/apexc.h
@@ -36,13 +36,12 @@ public:
protected:
virtual void machine_start() override;
virtual void video_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
- void check_inputs();
+ TIMER_CALLBACK_MEMBER(check_inputs);
private:
void apexc_palette(palette_device &palette) const;
- uint32_t screen_update_apexc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(apexc_interrupt);
void tape_write(uint8_t data);
void draw_led(bitmap_ind16 &bitmap, int x, int y, int state);
@@ -79,7 +78,6 @@ private:
emu_timer *m_input_timer = nullptr;
- static const device_timer_id TIMER_POLL_INPUTS;
static const rgb_t palette_table[4];
};
diff --git a/src/mame/includes/apollo.h b/src/mame/includes/apollo.h
index 257c4bf0f50..d6cad534343 100644
--- a/src/mame/includes/apollo.h
+++ b/src/mame/includes/apollo.h
@@ -690,7 +690,6 @@ private:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// serial overrides
virtual void rcv_complete() override; // Rx completed receiving byte
diff --git a/src/mame/includes/artmagic.h b/src/mame/includes/artmagic.h
index 313b9b84ad1..8d8c5e7b8a3 100644
--- a/src/mame/includes/artmagic.h
+++ b/src/mame/includes/artmagic.h
@@ -95,6 +95,7 @@ private:
void stonebal_map(address_map &map);
void stonebal_tms_map(address_map &map);
void tms_map(address_map &map);
+
protected:
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(irq_off);
};
diff --git a/src/mame/includes/asterix.h b/src/mame/includes/asterix.h
index a81030025c0..bc302748375 100644
--- a/src/mame/includes/asterix.h
+++ b/src/mame/includes/asterix.h
@@ -18,11 +18,6 @@
class asterix_state : public driver_device
{
public:
- enum
- {
- TIMER_NMI
- };
-
asterix_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
@@ -36,17 +31,36 @@ public:
void init_asterix();
private:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
+ void main_map(address_map &map);
+ void sound_map(address_map &map);
+
+ void control2_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
+ void sound_arm_nmi_w(uint8_t data);
+ void sound_irq_w(uint16_t data);
+ void protection_w(address_space &space, offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
+ void asterix_spritebank_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
+ uint32_t screen_update_asterix(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ INTERRUPT_GEN_MEMBER(asterix_interrupt);
+ K05324X_CB_MEMBER(sprite_callback);
+ K056832_CB_MEMBER(tile_callback);
+ void reset_spritebank();
+ TIMER_CALLBACK_MEMBER(audio_nmi);
+
/* video-related */
int m_sprite_colorbase = 0;
int m_layer_colorbase[4]{};
int m_layerpri[3]{};
- uint16_t m_spritebank = 0U;
+ uint16_t m_spritebank = 0U;
int m_tilebanks[4]{};
int m_spritebanks[4]{};
/* misc */
- uint8_t m_cur_control2 = 0U;
- uint16_t m_prot[2]{};
+ uint8_t m_cur_control2 = 0U;
+ uint16_t m_prot[2]{};
+ emu_timer *m_audio_nmi_timer = nullptr;
/* devices */
required_device<cpu_device> m_maincpu;
@@ -54,23 +68,6 @@ private:
required_device<k056832_device> m_k056832;
required_device<k05324x_device> m_k053244;
required_device<k053251_device> m_k053251;
- void control2_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
- void sound_arm_nmi_w(uint8_t data);
- void sound_irq_w(uint16_t data);
- void protection_w(address_space &space, offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
- void asterix_spritebank_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
- virtual void machine_start() override;
- virtual void machine_reset() override;
- uint32_t screen_update_asterix(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- INTERRUPT_GEN_MEMBER(asterix_interrupt);
- K05324X_CB_MEMBER(sprite_callback);
- K056832_CB_MEMBER(tile_callback);
- void reset_spritebank();
-
- void main_map(address_map &map);
- void sound_map(address_map &map);
-protected:
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
};
#endif // MAME_INCLUDES_ASTERIX_H
diff --git a/src/mame/includes/astrocde.h b/src/mame/includes/astrocde.h
index 3f0640a6392..587e505e211 100644
--- a/src/mame/includes/astrocde.h
+++ b/src/mame/includes/astrocde.h
@@ -30,12 +30,6 @@
class astrocde_state : public driver_device
{
public:
- enum
- {
- TIMER_INTERRUPT_OFF,
- TIMER_SCANLINE
- };
-
astrocde_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
@@ -148,6 +142,7 @@ public:
void profpac_palette(palette_device &palette) const;
uint32_t screen_update_astrocde(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_profpac(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ TIMER_CALLBACK_MEMBER(interrupt_off);
TIMER_CALLBACK_MEMBER(scanline_callback);
inline int mame_vpos_to_astrocade_vpos(int scanline);
void init_savestate();
@@ -186,7 +181,6 @@ public:
protected:
virtual void machine_start() override;
virtual void video_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
};
class seawolf2_state : public astrocde_state
diff --git a/src/mame/includes/balsente.h b/src/mame/includes/balsente.h
index d35f92d45d8..4831bb0a196 100644
--- a/src/mame/includes/balsente.h
+++ b/src/mame/includes/balsente.h
@@ -163,6 +163,7 @@ private:
uint8_t m_shooter_x = 0;
uint8_t m_shooter_y = 0;
uint8_t m_adc_shift = 0;
+ emu_timer *m_irq_off_timer = nullptr;
/* random number generator states */
uint8_t m_rand17[POLY17_SIZE + 1]{};
@@ -170,6 +171,7 @@ private:
/* ADC I/O states */
int8_t m_analog_input_data[4]{};
uint8_t m_adc_value = 0;
+ emu_timer *m_adc_timer = nullptr;
/* game-specific states */
uint8_t m_nstocker_bits = 0;
diff --git a/src/mame/includes/bebox.h b/src/mame/includes/bebox.h
index 4a4b74998c7..59f850dba3d 100644
--- a/src/mame/includes/bebox.h
+++ b/src/mame/includes/bebox.h
@@ -59,13 +59,6 @@ protected:
virtual void machine_start() override;
virtual void machine_reset() override;
- enum
- {
- TIMER_GET_DEVICES
- };
-
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
private:
required_device_array<ppc_device, 2> m_ppc;
required_device<lsi53c810_device> m_lsi53c810;
diff --git a/src/mame/includes/blstroid.h b/src/mame/includes/blstroid.h
index 23431b20182..c3b475c7e52 100644
--- a/src/mame/includes/blstroid.h
+++ b/src/mame/includes/blstroid.h
@@ -19,12 +19,6 @@
class blstroid_state : public atarigen_state
{
public:
- enum
- {
- TIMER_IRQ_OFF = TID_ATARIGEN_LAST,
- TIMER_IRQ_ON
- };
-
blstroid_state(const machine_config &mconfig, device_type type, const char *tag) :
atarigen_state(mconfig, type, tag),
m_playfield_tilemap(*this, "playfield"),
@@ -40,7 +34,8 @@ protected:
virtual void machine_reset() override;
virtual void video_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(irq_off);
+ TIMER_CALLBACK_MEMBER(irq_on);
private:
TIMER_DEVICE_CALLBACK_MEMBER(scanline_update);
diff --git a/src/mame/includes/btoads.h b/src/mame/includes/btoads.h
index 5a5d2e14da4..4e55b288454 100644
--- a/src/mame/includes/btoads.h
+++ b/src/mame/includes/btoads.h
@@ -40,13 +40,13 @@ public:
void btoads(machine_config &config);
protected:
- // device overrides
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
// driver_device overrides
virtual void machine_start() override;
virtual void video_start() override;
+ TIMER_CALLBACK_MEMBER(delayed_sound);
+ TIMER_CALLBACK_MEMBER(audio_sync) { }
+
private:
// timer IDs
enum
@@ -83,6 +83,8 @@ private:
uint16_t m_misc_control = 0;
int m_xcount = 0;
std::unique_ptr<uint8_t[]> m_nvram_data;
+ emu_timer *m_delayed_sound_timer;
+ emu_timer *m_audio_sync_timer;
// in drivers/btoads
void nvram_w(offs_t offset, uint8_t data);
diff --git a/src/mame/includes/bublbobl.h b/src/mame/includes/bublbobl.h
index f0489e4f808..7c92f401812 100644
--- a/src/mame/includes/bublbobl.h
+++ b/src/mame/includes/bublbobl.h
@@ -21,11 +21,6 @@
class bublbobl_state : public driver_device
{
public:
- enum
- {
- TIMER_M68705_IRQ_ACK
- };
-
bublbobl_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag)
, m_videoram(*this, "videoram")
@@ -74,6 +69,7 @@ public:
uint8_t m_port2_out = 0U;
uint8_t m_port3_out = 0U;
uint8_t m_port4_out = 0U;
+ emu_timer *m_irq_ack_timer = nullptr;
/* Bobble Bobble */
int m_ic43_a = 0;
int m_ic43_b = 0;
@@ -134,8 +130,9 @@ public:
void tokio_map_mcu(address_map &map);
void tokio_sound_map(address_map &map);
void tokio_subcpu_map(address_map &map);
+
protected:
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(irq_ack);
};
diff --git a/src/mame/includes/cidelsa.h b/src/mame/includes/cidelsa.h
index 0f1593e7aa5..f9f12d8b557 100644
--- a/src/mame/includes/cidelsa.h
+++ b/src/mame/includes/cidelsa.h
@@ -40,11 +40,6 @@
class cidelsa_state : public driver_device
{
public:
- enum
- {
- TIMER_SET_CPU_MODE
- };
-
cidelsa_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag)
, m_maincpu(*this, CDP1802_TAG)
@@ -79,18 +74,19 @@ public:
void destryera_map(address_map &map);
protected:
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void machine_start() override;
virtual void machine_reset() override;
-
virtual void video_start() override;
+ TIMER_CALLBACK_MEMBER(reset_done);
+
required_device<cosmac_device> m_maincpu;
required_device<cdp1869_device> m_vis;
output_finder<3> m_leds;
// cpu state
int m_reset = 0;
+ emu_timer *m_reset_timer = nullptr;
// video state
int m_cdp1802_q = 0;
diff --git a/src/mame/includes/coco.h b/src/mame/includes/coco.h
index e12095ab8f1..78e54f40f0c 100644
--- a/src/mame/includes/coco.h
+++ b/src/mame/includes/coco.h
@@ -132,12 +132,14 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// changed handlers
virtual void pia1_pa_changed(uint8_t data);
virtual void pia1_pb_changed(uint8_t data);
+ TIMER_CALLBACK_MEMBER(diecom_lightgun_hit);
+ TIMER_CALLBACK_MEMBER(joystick_update);
+
// accessors
pia6821_device &pia_0() { return *m_pia_0; }
pia6821_device &pia_1() { return *m_pia_1; }
@@ -150,11 +152,6 @@ protected:
virtual void update_cart_base(uint8_t *cart_base) { }
protected:
- // timer constants
- static const device_timer_id TIMER_HIRES_JOYSTICK_X = 0;
- static const device_timer_id TIMER_HIRES_JOYSTICK_Y = 1;
- static const device_timer_id TIMER_DIECOM_LIGHTGUN = 2;
-
enum soundmux_status_t
{
SOUNDMUX_SEL1 = 1,
diff --git a/src/mame/includes/comx35.h b/src/mame/includes/comx35.h
index a4f27a0df29..c09e9299c7d 100644
--- a/src/mame/includes/comx35.h
+++ b/src/mame/includes/comx35.h
@@ -61,17 +61,14 @@ private:
memory_share_creator<uint8_t> m_char_ram;
required_ioport m_d6;
required_ioport m_modifiers;
+ emu_timer *m_reset_done_timer = nullptr;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- enum
- {
- TIMER_ID_RESET
- };
+ TIMER_CALLBACK_MEMBER(reset_done);
void check_interrupt();
diff --git a/src/mame/includes/dc.h b/src/mame/includes/dc.h
index f880cace5b3..bb1cac0e0e7 100644
--- a/src/mame/includes/dc.h
+++ b/src/mame/includes/dc.h
@@ -43,6 +43,7 @@ public:
/* machine related */
uint32_t dc_sysctrl_regs[0x200/4]{};
uint8_t m_armrst = 0U;
+ emu_timer *m_ch2_dma_irq_timer = nullptr;
virtual void machine_start() override;
virtual void machine_reset() override;
diff --git a/src/mame/includes/dcheese.h b/src/mame/includes/dcheese.h
index 75bd58f4ed0..a8554ebc2ce 100644
--- a/src/mame/includes/dcheese.h
+++ b/src/mame/includes/dcheese.h
@@ -37,17 +37,9 @@ public:
void dcheese(machine_config &config);
protected:
- enum
- {
- TIMER_BLITTER_SCANLINE,
- TIMER_SIGNAL_IRQ
- };
-
virtual void machine_start() override;
virtual void video_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
private:
required_region_ptr<u16> m_palrom;
required_region_ptr<u8> m_gfxrom;
@@ -90,7 +82,8 @@ private:
void dcheese_palette(palette_device &palette) const;
u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(vblank);
- void signal_irq(u8 which);
+ TIMER_CALLBACK_MEMBER(blitter_done);
+ TIMER_CALLBACK_MEMBER(signal_irq);
void update_irq_state();
uint8_t iack_r(offs_t offset);
void update_scanline_irq();
diff --git a/src/mame/includes/dec8.h b/src/mame/includes/dec8.h
index 1fd75d3d8bf..bcfe503ef72 100644
--- a/src/mame/includes/dec8.h
+++ b/src/mame/includes/dec8.h
@@ -20,12 +20,6 @@
class dec8_state : public driver_device
{
public:
- enum
- {
- TIMER_DEC8_I8751,
- TIMER_DEC8_M6502
- };
-
dec8_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
@@ -58,10 +52,12 @@ public:
void gondo(machine_config &config);
protected:
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void machine_start() override;
virtual void machine_reset() override;
+ TIMER_CALLBACK_MEMBER(mcu_irq_clear);
+ TIMER_CALLBACK_MEMBER(audiocpu_nmi_clear);
+
uint8_t i8751_h_r();
uint8_t i8751_l_r();
void dec8_i8751_w(offs_t offset, uint8_t data);
diff --git a/src/mame/includes/electron.h b/src/mame/includes/electron.h
index 1dacccbe2f0..4d2d9719ef6 100644
--- a/src/mame/includes/electron.h
+++ b/src/mame/includes/electron.h
@@ -63,14 +63,8 @@ public:
DECLARE_INPUT_CHANGED_MEMBER( trigger_reset );
protected:
- enum
- {
- TIMER_TAPE_HANDLER,
- TIMER_SETUP_BEEP,
- TIMER_SCANLINE_INTERRUPT
- };
-
emu_timer *m_tape_timer = nullptr;
+ emu_timer *m_beep_timer = nullptr;
int m_map4[256]{};
int m_map16[256]{};
emu_timer *m_scanline_timer = nullptr;
@@ -106,8 +100,6 @@ protected:
virtual void machine_reset() override;
virtual void video_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
required_device<cpu_device> m_maincpu;
required_device<input_merger_device> m_irqs;
required_device<screen_device> m_screen;
diff --git a/src/mame/includes/fgoal.h b/src/mame/includes/fgoal.h
index b313bffc136..7543236a487 100644
--- a/src/mame/includes/fgoal.h
+++ b/src/mame/includes/fgoal.h
@@ -48,18 +48,18 @@ private:
required_shared_ptr<uint8_t> m_video_ram;
/* video-related */
- bitmap_ind16 m_bgbitmap{};
- bitmap_ind16 m_fgbitmap{};
+ bitmap_ind16 m_bgbitmap{};
+ bitmap_ind16 m_fgbitmap{};
uint8_t m_xpos = 0U;
uint8_t m_ypos = 0U;
- int m_current_color = 0;
+ int m_current_color = 0;
/* misc */
- int m_player = 0;
+ int m_player = 0;
uint8_t m_row = 0U;
uint8_t m_col = 0U;
- int m_prev_coin = 0;
- emu_timer *m_interrupt_timer = nullptr;
+ int m_prev_coin = 0;
+ emu_timer *m_interrupt_timer = nullptr;
uint8_t analog_r();
uint8_t nmi_reset_r();
@@ -86,8 +86,6 @@ private:
unsigned video_ram_address();
void cpu_map(address_map &map);
-
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
};
#endif // MAME_INCLUDES_FGOAL_H
diff --git a/src/mame/includes/fmtowns.h b/src/mame/includes/fmtowns.h
index a0661f70163..3d41c7cccec 100644
--- a/src/mame/includes/fmtowns.h
+++ b/src/mame/includes/fmtowns.h
@@ -86,6 +86,7 @@ struct towns_video_controller
uint8_t towns_vblank_flag = 0;
uint8_t towns_layer_ctrl = 0;
emu_timer* sprite_timer = nullptr;
+ emu_timer* vblank_end_timer = nullptr;
};
class towns_state : public driver_device
@@ -280,7 +281,6 @@ private:
optional_shared_ptr<uint16_t> m_nvram16;
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
uint8_t towns_system_r(offs_t offset);
void towns_system_w(offs_t offset, uint8_t data);
@@ -387,25 +387,17 @@ private:
required_memory_region m_user;
optional_memory_region m_serial;
- static const device_timer_id TIMER_FREERUN = 1;
- static const device_timer_id TIMER_INTERVAL2 = 2;
- static const device_timer_id TIMER_KEYBOARD = 3;
- static const device_timer_id TIMER_MOUSE = 4;
- static const device_timer_id TIMER_WAIT = 5;
- static const device_timer_id TIMER_CDSTATUS = 6;
- static const device_timer_id TIMER_CDDA = 7;
- static const device_timer_id TIMER_SPRITES = 8;
- void freerun_inc();
- void intervaltimer2_timeout();
- void poll_keyboard();
- void mouse_timeout();
- void wait_end();
+ TIMER_CALLBACK_MEMBER(freerun_inc);
+ TIMER_CALLBACK_MEMBER(intervaltimer2_timeout);
+ TIMER_CALLBACK_MEMBER(poll_keyboard);
+ TIMER_CALLBACK_MEMBER(mouse_timeout);
+ TIMER_CALLBACK_MEMBER(wait_end);
void towns_cd_set_status(uint8_t st0, uint8_t st1, uint8_t st2, uint8_t st3);
void towns_cdrom_execute_command(cdrom_image_device* device);
void towns_cdrom_play_cdda(cdrom_image_device* device);
void towns_cdrom_read(cdrom_image_device* device);
- void towns_cd_status_ready();
- void towns_delay_cdda(cdrom_image_device* dev);
+ TIMER_CALLBACK_MEMBER(towns_cd_status_ready);
+ TIMER_CALLBACK_MEMBER(towns_delay_cdda);
u8 m_rtc_d = 0;
bool m_rtc_busy = false;
@@ -414,7 +406,7 @@ private:
TIMER_CALLBACK_MEMBER(towns_cdrom_read_byte);
TIMER_CALLBACK_MEMBER(towns_vblank_end);
- void draw_sprites();
+ TIMER_CALLBACK_MEMBER(draw_sprites);
DECLARE_WRITE_LINE_MEMBER(towns_pit_out0_changed);
DECLARE_WRITE_LINE_MEMBER(towns_pit_out1_changed);
DECLARE_WRITE_LINE_MEMBER(pit2_out1_changed);
diff --git a/src/mame/includes/fuukifg2.h b/src/mame/includes/fuukifg2.h
index d30f4d35ad4..6565c367c8c 100644
--- a/src/mame/includes/fuukifg2.h
+++ b/src/mame/includes/fuukifg2.h
@@ -36,12 +36,30 @@ public:
void fuuki16(machine_config &config);
private:
- enum
- {
- TIMER_LEVEL_1_INTERRUPT,
- TIMER_VBLANK_INTERRUPT,
- TIMER_RASTER_INTERRUPT
- };
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
+ void main_map(address_map &map);
+ void sound_io_map(address_map &map);
+ void sound_map(address_map &map);
+
+ TIMER_CALLBACK_MEMBER(level1_interrupt);
+ TIMER_CALLBACK_MEMBER(vblank_interrupt);
+ TIMER_CALLBACK_MEMBER(raster_interrupt);
+
+ void vregs_w(offs_t offset, u16 data, u16 mem_mask = ~0);
+ void sound_command_w(u8 data);
+ void sound_rombank_w(u8 data);
+ template<int Layer> void vram_w(offs_t offset, u16 data, u16 mem_mask = ~0);
+ template<int Layer> void vram_buffered_w(offs_t offset, u16 data, u16 mem_mask = ~0);
+ void oki_banking_w(u8 data);
+
+ template<int Layer> TILE_GET_INFO_MEMBER(get_tile_info);
+
+ void fuuki16_colpri_cb(u32 &colour, u32 &pri_mask);
+ u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ void draw_layer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, u8 i, int flag, u8 pri, u8 primask = 0xff);
/* devices */
required_device<cpu_device> m_maincpu;
@@ -69,29 +87,6 @@ private:
emu_timer *m_level_1_interrupt_timer = nullptr;
emu_timer *m_vblank_interrupt_timer = nullptr;
emu_timer *m_raster_interrupt_timer = nullptr;
-
- void vregs_w(offs_t offset, u16 data, u16 mem_mask = ~0);
- void sound_command_w(u8 data);
- void sound_rombank_w(u8 data);
- template<int Layer> void vram_w(offs_t offset, u16 data, u16 mem_mask = ~0);
- template<int Layer> void vram_buffered_w(offs_t offset, u16 data, u16 mem_mask = ~0);
- void oki_banking_w(u8 data);
-
- template<int Layer> TILE_GET_INFO_MEMBER(get_tile_info);
-
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void video_start() override;
-
- void fuuki16_colpri_cb(u32 &colour, u32 &pri_mask);
- u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- void draw_layer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, u8 i, int flag, u8 pri, u8 primask = 0xff);
-
- void fuuki16_map(address_map &map);
- void fuuki16_sound_io_map(address_map &map);
- void fuuki16_sound_map(address_map &map);
-
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
};
#endif // MAME_INCLUDES_FUUKIFG2_H
diff --git a/src/mame/includes/fuukifg3.h b/src/mame/includes/fuukifg3.h
index 8995f0ac408..5bce3f0ea9b 100644
--- a/src/mame/includes/fuukifg3.h
+++ b/src/mame/includes/fuukifg3.h
@@ -42,12 +42,35 @@ public:
void fuuki32(machine_config &config);
private:
- enum
- {
- TIMER_LEVEL_1_INTERRUPT,
- TIMER_VBLANK_INTERRUPT,
- TIMER_RASTER_INTERRUPT
- };
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
+ void main_map(address_map &map);
+ void sound_io_map(address_map &map);
+ void sound_map(address_map &map);
+
+ TIMER_CALLBACK_MEMBER(level1_interrupt);
+ TIMER_CALLBACK_MEMBER(vblank_interrupt);
+ TIMER_CALLBACK_MEMBER(raster_interrupt);
+
+ u8 snd_020_r(offs_t offset);
+ void snd_020_w(offs_t offset, u8 data, u8 mem_mask = ~0);
+ void sprram_w(offs_t offset, u16 data, u16 mem_mask = ~0);
+ u16 sprram_r(offs_t offset);
+ u16 vregs_r(offs_t offset);
+ void vregs_w(offs_t offset, u16 data, u16 mem_mask = ~0);
+ void sound_bw_w(u8 data);
+ template<int Layer> void vram_w(offs_t offset, u32 data, u32 mem_mask = ~0);
+ template<int Layer> void vram_buffered_w(offs_t offset, u32 data, u32 mem_mask = ~0);
+
+ template<int Layer, int ColShift> TILE_GET_INFO_MEMBER(get_tile_info);
+
+ void tile_cb(u32 &code);
+ void colpri_cb(u32 &colour, u32 &pri_mask);
+ u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ DECLARE_WRITE_LINE_MEMBER(screen_vblank);
+ void draw_layer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, u8 i, int flag, u8 pri, u8 primask = 0xff);
/* devices */
required_device<cpu_device> m_maincpu;
@@ -80,34 +103,6 @@ private:
emu_timer *m_level_1_interrupt_timer = nullptr;
emu_timer *m_vblank_interrupt_timer = nullptr;
emu_timer *m_raster_interrupt_timer = nullptr;
-
- u8 snd_020_r(offs_t offset);
- void snd_020_w(offs_t offset, u8 data, u8 mem_mask = ~0);
- void sprram_w(offs_t offset, u16 data, u16 mem_mask = ~0);
- u16 sprram_r(offs_t offset);
- u16 vregs_r(offs_t offset);
- void vregs_w(offs_t offset, u16 data, u16 mem_mask = ~0);
- void sound_bw_w(u8 data);
- template<int Layer> void vram_w(offs_t offset, u32 data, u32 mem_mask = ~0);
- template<int Layer> void vram_buffered_w(offs_t offset, u32 data, u32 mem_mask = ~0);
-
- template<int Layer, int ColShift> TILE_GET_INFO_MEMBER(get_tile_info);
-
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void video_start() override;
-
- void fuuki32_tile_cb(u32 &code);
- void fuuki32_colpri_cb(u32 &colour, u32 &pri_mask);
- u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- DECLARE_WRITE_LINE_MEMBER(screen_vblank);
- void draw_layer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, u8 i, int flag, u8 pri, u8 primask = 0xff);
-
- void fuuki32_map(address_map &map);
- void fuuki32_sound_io_map(address_map &map);
- void fuuki32_sound_map(address_map &map);
-
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
};
#endif // MAME_INCLUDES_FUUKIFG3_H
diff --git a/src/mame/includes/gameplan.h b/src/mame/includes/gameplan.h
index 5e3cc88c2c4..3e8ff26ab9e 100644
--- a/src/mame/includes/gameplan.h
+++ b/src/mame/includes/gameplan.h
@@ -29,13 +29,6 @@ driver by Chris Moore
class gameplan_state : public driver_device
{
public:
- enum
- {
- TIMER_CLEAR_SCREEN_DONE,
- TIMER_VIA_IRQ_DELAYED,
- TIMER_VIA_0_CAL
- };
-
gameplan_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
@@ -56,7 +49,6 @@ protected:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
required_device<cpu_device> m_maincpu;
required_device<via6522_device> m_via_0;
@@ -67,28 +59,27 @@ protected:
void video_data_w(uint8_t data);
void gameplan_video_command_w(uint8_t data);
DECLARE_WRITE_LINE_MEMBER(video_command_trigger_w);
- DECLARE_WRITE_LINE_MEMBER(via_irq);
uint32_t screen_update_gameplan(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
private:
/* machine state */
- uint8_t m_current_port = 0U;
+ uint8_t m_current_port = 0U;
/* video state */
std::unique_ptr<uint8_t[]> m_videoram{};
- size_t m_videoram_size = 0U;
+ size_t m_videoram_size = 0U;
uint8_t m_video_x = 0U;
uint8_t m_video_y = 0U;
uint8_t m_video_command = 0U;
uint8_t m_video_data = 0U;
uint8_t m_video_previous = 0U;
+ emu_timer *m_clear_done_timer;
/* devices */
optional_device<cpu_device> m_audiocpu;
optional_device<riot6532_device> m_riot;
optional_device<generic_latch_8_device> m_soundlatch;
-
void io_select_w(uint8_t data);
uint8_t io_port_r();
DECLARE_WRITE_LINE_MEMBER(coin_w);
@@ -99,7 +90,6 @@ private:
uint32_t screen_update_leprechn(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(clear_screen_done_callback);
- TIMER_CALLBACK_MEMBER(via_irq_delayed);
void leprechn_video_command_w(uint8_t data);
uint8_t leprechn_videoram_r();
void gameplan_get_pens( pen_t *pens );
diff --git a/src/mame/includes/gaplus.h b/src/mame/includes/gaplus.h
index d69ca5c2564..14978b4e861 100644
--- a/src/mame/includes/gaplus.h
+++ b/src/mame/includes/gaplus.h
@@ -81,7 +81,6 @@ public:
virtual void driver_init() override;
protected:
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
diff --git a/src/mame/includes/gottlieb.h b/src/mame/includes/gottlieb.h
index dc4c7122361..d9385698367 100644
--- a/src/mame/includes/gottlieb.h
+++ b/src/mame/includes/gottlieb.h
@@ -79,17 +79,8 @@ protected:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
private:
- enum
- {
- TIMER_LASERDISC_PHILIPS,
- TIMER_LASERDISC_BIT_OFF,
- TIMER_LASERDISC_BIT,
- TIMER_NMI_CLEAR
- };
-
void qbert_knocker(u8 knock);
void analog_reset_w(u8 data);
@@ -153,7 +144,9 @@ private:
u8 m_joystick_select = 0U;
u8 m_track[2]{};
emu_timer *m_laserdisc_bit_timer = nullptr;
+ emu_timer *m_laserdisc_bit_off_timer = nullptr;
emu_timer *m_laserdisc_philips_timer = nullptr;
+ emu_timer *m_nmi_clear_timer = nullptr;
u8 m_laserdisc_select = 0U;
u8 m_laserdisc_status = 0U;
uint16_t m_laserdisc_philips_code = 0U;
diff --git a/src/mame/includes/gunbustr.h b/src/mame/includes/gunbustr.h
index 10578e1d04c..a51be91e5f7 100644
--- a/src/mame/includes/gunbustr.h
+++ b/src/mame/includes/gunbustr.h
@@ -44,10 +44,20 @@ public:
void init_gunbustr();
private:
- enum
- {
- TIMER_GUNBUSTR_INTERRUPT5
- };
+ virtual void video_start() override;
+
+ void gunbustr_map(address_map &map);
+
+ TIMER_CALLBACK_MEMBER(trigger_irq5);
+
+ void motor_control_w(u32 data);
+ u32 gun_r();
+ void gun_w(u32 data);
+ u32 main_cycle_r();
+ void coin_word_w(u8 data);
+ u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ INTERRUPT_GEN_MEMBER(gunbustr_interrupt);
+ void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap,const rectangle &cliprect,const u32 *primasks,int x_offs,int y_offs);
required_device<cpu_device> m_maincpu;
required_device<tc0480scp_device> m_tc0480scp;
@@ -64,20 +74,6 @@ private:
bool m_coin_lockout;
std::unique_ptr<gb_tempsprite[]> m_spritelist{};
emu_timer *m_interrupt5_timer = nullptr;
-
- void motor_control_w(u32 data);
- u32 gun_r();
- void gun_w(u32 data);
- u32 main_cycle_r();
- void coin_word_w(u8 data);
- virtual void video_start() override;
- u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- INTERRUPT_GEN_MEMBER(gunbustr_interrupt);
- void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap,const rectangle &cliprect,const u32 *primasks,int x_offs,int y_offs);
-
- void gunbustr_map(address_map &map);
-
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
};
#endif // MAME_INCLUDES_GUNBUSTR_H
diff --git a/src/mame/includes/harddriv.h b/src/mame/includes/harddriv.h
index 59fcc4f3211..c4757b09902 100644
--- a/src/mame/includes/harddriv.h
+++ b/src/mame/includes/harddriv.h
@@ -190,7 +190,7 @@ protected:
uint16_t hdds3_xdsp_control_r(offs_t offset);
void hdds3_xdsp_control_w(offs_t offset, uint16_t data);
- TIMER_CALLBACK_MEMBER( xsdp_sport1_irq_off_callback );
+ TIMER_CALLBACK_MEMBER( xdsp_sport1_irq_off_callback );
uint16_t hdgsp_control_lo_r(offs_t offset);
void hdgsp_control_lo_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
@@ -306,18 +306,18 @@ protected:
output_finder<4> m_sel;
output_finder<> m_wheel;
- uint8_t m_hd34010_host_access = 0;
+ uint8_t m_hd34010_host_access = 0;
optional_shared_ptr<uint16_t> m_msp_ram;
- uint16_t * m_dsk_ram = nullptr;
- uint16_t * m_dsk_rom = nullptr;
+ uint16_t * m_dsk_ram = nullptr;
+ uint16_t * m_dsk_rom = nullptr;
optional_device<eeprom_parallel_28xx_device> m_dsk_10c;
optional_device<eeprom_parallel_28xx_device> m_dsk_30c;
- uint8_t m_dsk_pio_access = 0;
+ uint8_t m_dsk_pio_access = 0;
- uint16_t * m_m68k_sloop_base = nullptr;
- uint16_t * m_m68k_sloop_alt_base = nullptr;
+ uint16_t * m_m68k_sloop_base = nullptr;
+ uint16_t * m_m68k_sloop_alt_base = nullptr;
required_device<timekeeper_device> m_200e;
required_device<eeprom_parallel_28xx_device> m_210e;
@@ -331,25 +331,25 @@ protected:
optional_shared_ptr<uint32_t> m_dsp32_ram;
- uint16_t * m_gsp_protection = nullptr;
+ uint16_t * m_gsp_protection = nullptr;
- uint16_t * m_gsp_speedup_addr[2]{};
+ uint16_t * m_gsp_speedup_addr[2]{};
offs_t m_gsp_speedup_pc = 0;
- uint16_t * m_msp_speedup_addr = nullptr;
+ uint16_t * m_msp_speedup_addr = nullptr;
offs_t m_msp_speedup_pc = 0;
- uint16_t * m_ds3_speedup_addr = nullptr;
+ uint16_t * m_ds3_speedup_addr = nullptr;
offs_t m_ds3_speedup_pc = 0;
offs_t m_ds3_transfer_pc = 0;
- uint32_t * m_rddsp32_sync[2]{};
+ uint32_t * m_rddsp32_sync[2]{};
- uint32_t m_gsp_speedup_count[4]{};
- uint32_t m_msp_speedup_count[4]{};
- uint32_t m_adsp_speedup_count[4]{};
+ uint32_t m_gsp_speedup_count[4]{};
+ uint32_t m_msp_speedup_count[4]{};
+ uint32_t m_adsp_speedup_count[4]{};
- uint8_t m_gsp_multisync = 0;
+ uint8_t m_gsp_multisync = 0;
optional_shared_ptr<uint16_t> m_gsp_vram;
optional_shared_ptr<uint16_t> m_gsp_control_lo;
optional_shared_ptr<uint16_t> m_gsp_control_hi;
@@ -362,97 +362,98 @@ protected:
optional_ioport_array<4> m_12badc;
/* machine state */
- uint8_t m_irq_state = 0;
- uint8_t m_gsp_irq_state = 0;
- uint8_t m_msp_irq_state = 0;
- uint8_t m_adsp_irq_state = 0;
- uint8_t m_ds3sdsp_irq_state = 0;
- uint8_t m_duart_irq_state = 0;
-
- uint8_t m_last_gsp_shiftreg = 0;
-
- uint8_t m_m68k_zp1 = 0;
- uint8_t m_m68k_zp2 = 0;
- uint8_t m_m68k_adsp_buffer_bank = 0;
-
- uint8_t m_adsp_halt = 0;
- uint8_t m_adsp_br = 0;
- uint8_t m_adsp_xflag = 0;
- uint16_t m_adsp_sim_address = 0;
- uint16_t m_adsp_som_address = 0;
- uint32_t m_adsp_eprom_base = 0;
+ uint8_t m_irq_state = 0;
+ uint8_t m_gsp_irq_state = 0;
+ uint8_t m_msp_irq_state = 0;
+ uint8_t m_adsp_irq_state = 0;
+ uint8_t m_ds3sdsp_irq_state = 0;
+ uint8_t m_duart_irq_state = 0;
+
+ uint8_t m_last_gsp_shiftreg = 0;
+
+ uint8_t m_m68k_zp1 = 0;
+ uint8_t m_m68k_zp2 = 0;
+ uint8_t m_m68k_adsp_buffer_bank = 0;
+
+ uint8_t m_adsp_halt = 0;
+ uint8_t m_adsp_br = 0;
+ uint8_t m_adsp_xflag = 0;
+ uint16_t m_adsp_sim_address = 0;
+ uint16_t m_adsp_som_address = 0;
+ uint32_t m_adsp_eprom_base = 0;
required_region_ptr<uint16_t> m_sim_memory;
- uint16_t m_som_memory[0x8000/2]{};
- uint16_t * m_adsp_pgm_memory_word = 0;
-
- uint16_t * m_ds3_sdata_memory = 0;
- uint32_t m_ds3_sdata_memory_size = 0;
-
- uint8_t m_ds3_gcmd = 0;
- uint8_t m_ds3_gflag = 0;
- uint8_t m_ds3_g68irqs = 0;
- uint8_t m_ds3_gfirqs = 0;
- uint8_t m_ds3_g68flag = 0;
- uint8_t m_ds3_send = 0;
- uint8_t m_ds3_reset = 0;
- uint16_t m_ds3_gdata = 0;
- uint16_t m_ds3_g68data = 0;
- uint32_t m_ds3_sim_address = 0;
-
- uint8_t m_ds3_scmd = 0;
- uint8_t m_ds3_sflag = 0;
- uint8_t m_ds3_s68irqs = 0;
- uint8_t m_ds3_sfirqs = 0;
- uint8_t m_ds3_s68flag = 0;
- uint8_t m_ds3_sreset = 0;
- uint16_t m_ds3_sdata = 0;
- uint16_t m_ds3_s68data = 0;
- uint32_t m_ds3_sdata_address = 0;
- uint16_t m_ds3sdsp_regs[32]{};
- uint16_t m_ds3sdsp_timer_en = 0;
- uint16_t m_ds3sdsp_sdata = 0;
+ uint16_t m_som_memory[0x8000/2]{};
+ uint16_t * m_adsp_pgm_memory_word = 0;
+
+ uint16_t * m_ds3_sdata_memory = 0;
+ uint32_t m_ds3_sdata_memory_size = 0;
+
+ uint8_t m_ds3_gcmd = 0;
+ uint8_t m_ds3_gflag = 0;
+ uint8_t m_ds3_g68irqs = 0;
+ uint8_t m_ds3_gfirqs = 0;
+ uint8_t m_ds3_g68flag = 0;
+ uint8_t m_ds3_send = 0;
+ uint8_t m_ds3_reset = 0;
+ uint16_t m_ds3_gdata = 0;
+ uint16_t m_ds3_g68data = 0;
+ uint32_t m_ds3_sim_address = 0;
+
+ uint8_t m_ds3_scmd = 0;
+ uint8_t m_ds3_sflag = 0;
+ uint8_t m_ds3_s68irqs = 0;
+ uint8_t m_ds3_sfirqs = 0;
+ uint8_t m_ds3_s68flag = 0;
+ uint8_t m_ds3_sreset = 0;
+ uint16_t m_ds3_sdata = 0;
+ uint16_t m_ds3_s68data = 0;
+ uint32_t m_ds3_sdata_address = 0;
+ uint16_t m_ds3sdsp_regs[32]{};
+ uint16_t m_ds3sdsp_timer_en = 0;
+ uint16_t m_ds3sdsp_sdata = 0;
optional_device<timer_device> m_ds3sdsp_internal_timer;
- uint16_t m_ds3xdsp_regs[32]{};
- uint16_t m_ds3xdsp_timer_en = 0;
- uint16_t m_ds3xdsp_sdata = 0;
+ uint16_t m_ds3xdsp_regs[32]{};
+ uint16_t m_ds3xdsp_timer_en = 0;
+ uint16_t m_ds3xdsp_sdata = 0;
optional_device<timer_device> m_ds3xdsp_internal_timer;
+ emu_timer * m_xdsp_serial_irq_off_timer = nullptr;
- uint16_t m_adc_control = 0;
- uint8_t m_adc12_select = 0;
- uint8_t m_adc12_byte = 0;
- uint16_t m_adc12_data = 0;
+ uint16_t m_adc_control = 0;
+ uint8_t m_adc12_select = 0;
+ uint8_t m_adc12_byte = 0;
+ uint16_t m_adc12_data = 0;
- uint16_t m_hdc68k_last_wheel = 0;
- uint16_t m_hdc68k_last_port1 = 0;
- uint8_t m_hdc68k_wheel_edge = 0;
- uint8_t m_hdc68k_shifter_state = 0;
+ uint16_t m_hdc68k_last_wheel = 0;
+ uint16_t m_hdc68k_last_port1 = 0;
+ uint8_t m_hdc68k_wheel_edge = 0;
+ uint8_t m_hdc68k_shifter_state = 0;
- uint8_t m_st68k_sloop_bank = 0;
+ uint8_t m_st68k_sloop_bank = 0;
offs_t m_st68k_last_alt_sloop_offset = 0;
- uint8_t m_sel_select = 0;
- uint8_t m_sel1_data = 0;
- uint8_t m_sel2_data = 0;
- uint8_t m_sel3_data = 0;
- uint8_t m_sel4_data = 0;
+ uint8_t m_sel_select = 0;
+ uint8_t m_sel1_data = 0;
+ uint8_t m_sel2_data = 0;
+ uint8_t m_sel3_data = 0;
+ uint8_t m_sel4_data = 0;
#define MAX_MSP_SYNC 16
- uint32_t * m_dataptr[MAX_MSP_SYNC]{};
- uint32_t m_dataval[MAX_MSP_SYNC]{};
+ uint32_t * m_dataptr[MAX_MSP_SYNC]{};
+ uint32_t m_dataval[MAX_MSP_SYNC]{};
int m_next_msp_sync = 0;
/* video state */
offs_t m_vram_mask = 0;
- uint8_t m_shiftreg_enable = 0;
+ uint8_t m_shiftreg_enable = 0;
- uint32_t m_mask_table[65536 * 4]{};
- uint16_t * m_gsp_shiftreg_source = 0;
+ uint32_t m_mask_table[65536 * 4]{};
+ uint16_t * m_gsp_shiftreg_source = 0;
- int8_t m_gfx_finescroll = 0;
- uint8_t m_gfx_palettebank = 0;
+ int8_t m_gfx_finescroll = 0;
+ uint8_t m_gfx_palettebank = 0;
virtual void update_interrupts();
void init_driver();
void init_multisync(int compact_inputs);
diff --git a/src/mame/includes/hp48.h b/src/mame/includes/hp48.h
index b30694c1b2a..ade82d9492f 100644
--- a/src/mame/includes/hp48.h
+++ b/src/mame/includes/hp48.h
@@ -174,6 +174,8 @@ private:
emu_timer *m_1st_timer = nullptr;
emu_timer *m_2nd_timer = nullptr;
emu_timer *m_kbd_timer = nullptr;
+ emu_timer *m_recv_done_timer = nullptr;
+ emu_timer *m_send_done_timer = nullptr;
std::unique_ptr<uint8_t[]> m_allocated_ram{};
std::unique_ptr<uint8_t[]> m_allocated_rom{};
};
diff --git a/src/mame/includes/hyhoo.h b/src/mame/includes/hyhoo.h
index f280cd64121..0b0d73a5748 100644
--- a/src/mame/includes/hyhoo.h
+++ b/src/mame/includes/hyhoo.h
@@ -17,11 +17,6 @@ public:
void hyhoo2(machine_config &config);
private:
- enum
- {
- TIMER_BLITTER
- };
-
required_device<cpu_device> m_maincpu;
required_device<nb1413m3_device> m_nb1413m3;
required_device<screen_device> m_screen;
@@ -52,5 +47,5 @@ private:
void hyhoo_io_map(address_map &map);
void hyhoo_map(address_map &map);
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(clear_busy_flag);
};
diff --git a/src/mame/includes/intv.h b/src/mame/includes/intv.h
index 898bd18d70e..25bed009c10 100644
--- a/src/mame/includes/intv.h
+++ b/src/mame/includes/intv.h
@@ -61,12 +61,13 @@ public:
void init_intv();
private:
- enum
- {
- TIMER_INTV_INTERRUPT2_COMPLETE,
- TIMER_INTV_INTERRUPT_COMPLETE,
- TIMER_INTV_BTB_FILL
- };
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
+ emu_timer *m_int_complete_timer;
+ emu_timer *m_int2_complete_timer;
+ emu_timer *m_btb_fill_timers[stic_device::BACKTAB_HEIGHT];
required_device<cpu_device> m_maincpu;
required_device<ay8914_device> m_sound;
@@ -76,14 +77,14 @@ private:
optional_shared_ptr<uint16_t> m_intvkbd_dualport_ram;
optional_shared_ptr<uint8_t> m_videoram;
- uint16_t intv_stic_r(offs_t offset);
- void intv_stic_w(offs_t offset, uint16_t data);
- uint16_t intv_gram_r(offs_t offset);
- void intv_gram_w(offs_t offset, uint16_t data);
- uint16_t intv_ram8_r(offs_t offset);
- void intv_ram8_w(offs_t offset, uint16_t data);
- uint16_t intv_ram16_r(offs_t offset);
- void intv_ram16_w(offs_t offset, uint16_t data);
+ uint16_t stic_r(offs_t offset);
+ void stic_w(offs_t offset, uint16_t data);
+ uint16_t gram_r(offs_t offset);
+ void gram_w(offs_t offset, uint16_t data);
+ uint16_t ram8_r(offs_t offset);
+ void ram8_w(offs_t offset, uint16_t data);
+ uint16_t ram16_r(offs_t offset);
+ void ram16_w(offs_t offset, uint16_t data);
uint8_t intvkb_iocart_r(offs_t offset);
uint8_t m_bus_copy_mode = 0;
@@ -116,17 +117,14 @@ private:
int m_tape_interrupts_enabled = 0;
int m_tape_motor_mode = 0;
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void video_start() override;
void intv_palette(palette_device &palette) const;
uint32_t screen_update_intv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_intvkbd(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- INTERRUPT_GEN_MEMBER(intv_interrupt2);
- INTERRUPT_GEN_MEMBER(intv_interrupt);
- TIMER_CALLBACK_MEMBER(intv_interrupt2_complete);
- TIMER_CALLBACK_MEMBER(intv_interrupt_complete);
- TIMER_CALLBACK_MEMBER(intv_btb_fill);
+ INTERRUPT_GEN_MEMBER(interrupt2);
+ INTERRUPT_GEN_MEMBER(interrupt);
+ TIMER_CALLBACK_MEMBER(interrupt2_complete);
+ TIMER_CALLBACK_MEMBER(interrupt_complete);
+ TIMER_CALLBACK_MEMBER(btb_fill);
void intv2_mem(address_map &map);
void intv_mem(address_map &map);
@@ -148,8 +146,6 @@ private:
required_device<palette_device> m_palette;
ioport_port *m_intv_keyboard[10];
-
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
};
#endif // MAME_INCLUDES_INTV_H
diff --git a/src/mame/includes/itech8.h b/src/mame/includes/itech8.h
index 3770b01236b..b9fd8e29dbb 100644
--- a/src/mame/includes/itech8.h
+++ b/src/mame/includes/itech8.h
@@ -70,15 +70,6 @@ protected:
static constexpr uint32_t VRAM_SIZE = 0x40000;
static constexpr uint32_t VRAM_MASK = VRAM_SIZE - 1;
- enum
- {
- TIMER_IRQ_OFF,
- TIMER_BEHIND_BEAM_UPDATE,
- TIMER_BLITTER_DONE,
- TIMER_DELAYED_Z80_CONTROL,
- TIMER_BASE_LAST = TIMER_DELAYED_Z80_CONTROL
- };
-
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_soundcpu;
optional_device<cpu_device> m_subcpu;
@@ -131,7 +122,6 @@ protected:
emu_timer *m_irq_off_timer = nullptr;
emu_timer *m_behind_beam_update_timer = nullptr;
emu_timer *m_blitter_done_timer = nullptr;
- emu_timer *m_delayed_z80_control_timer = nullptr;
int m_bankxor = 0;
// common
@@ -221,8 +211,6 @@ protected:
void sound3812_external_map(address_map &map);
void sound3812_map(address_map &map);
void sstrike_map(address_map &map);
-
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
};
class grmatch_state : public itech8_state
@@ -242,19 +230,12 @@ protected:
void machine_start() override;
void machine_reset() override;
- enum
- {
- TIMER_PALETTE = TIMER_BASE_LAST+1,
- };
-
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
void palette_w(uint8_t data);
void xscroll_w(uint8_t data);
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
- void palette_update();
+ TIMER_CALLBACK_MEMBER(palette_update);
emu_timer *m_palette_timer = nullptr;
uint8_t m_palcontrol = 0U;
diff --git a/src/mame/includes/jaguar.h b/src/mame/includes/jaguar.h
index a1447575599..fc72c1d408c 100644
--- a/src/mame/includes/jaguar.h
+++ b/src/mame/includes/jaguar.h
@@ -111,7 +111,6 @@ protected:
virtual void sound_start() override;
virtual void video_start() override;
virtual void device_postload();
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
void video_config(machine_config &config, const XTAL clock);
@@ -180,6 +179,9 @@ private:
uint32_t m_blitter_regs[40]{};
uint16_t m_gpu_regs[0x100/2]{};
emu_timer *m_object_timer = nullptr;
+ emu_timer *m_blitter_done_timer = nullptr;
+ emu_timer *m_pit_timer = nullptr;
+ emu_timer *m_gpu_sync_timer = nullptr;
uint8_t m_cpu_irq_state = 0;
bitmap_rgb32 m_screen_bitmap;
uint8_t m_blitter_status = 0;
@@ -251,7 +253,7 @@ private:
void jerry_regs_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
uint32_t serial_r(offs_t offset);
void serial_w(offs_t offset, uint32_t data);
- void serial_update();
+ TIMER_CALLBACK_MEMBER(serial_update);
// from video/jaguar.cpp
uint32_t blitter_r(offs_t offset, uint32_t mem_mask = ~0);
@@ -261,6 +263,9 @@ private:
uint32_t cojag_gun_input_r(offs_t offset);
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void jagpal_ycc(palette_device &palette) const;
+ TIMER_CALLBACK_MEMBER(blitter_done);
+ TIMER_CALLBACK_MEMBER(pit_update);
+ TIMER_CALLBACK_MEMBER(gpu_sync);
DECLARE_WRITE_LINE_MEMBER( gpu_cpu_int );
DECLARE_WRITE_LINE_MEMBER( dsp_cpu_int );
@@ -279,16 +284,6 @@ private:
void r3000_map(address_map &map);
void r3000_rom_map(address_map &map);
- // timer IDs
- enum
- {
- TID_SCANLINE,
- TID_BLITTER_DONE,
- TID_PIT,
- TID_SERIAL,
- TID_GPU_SYNC
- };
-
void gpu_suspend() { m_gpu->suspend(SUSPEND_REASON_SPIN, 1); }
void gpu_resume() { m_gpu->resume(SUSPEND_REASON_SPIN); }
void dsp_suspend() { m_dsp->suspend(SUSPEND_REASON_SPIN, 1); }
@@ -310,7 +305,7 @@ private:
inline void verify_host_cpu_irq();
uint8_t *memory_base(uint32_t offset) { return reinterpret_cast<uint8_t *>(m_gpu->space(AS_PROGRAM).get_read_ptr(offset)); }
void blitter_run();
- void scanline_update(int param);
+ TIMER_CALLBACK_MEMBER(scanline_update);
void set_palette(uint16_t vmode);
/* from jagobj.cpp */
diff --git a/src/mame/includes/laserbat.h b/src/mame/includes/laserbat.h
index acc07b378ff..b7fdae178d1 100644
--- a/src/mame/includes/laserbat.h
+++ b/src/mame/includes/laserbat.h
@@ -34,8 +34,6 @@ public:
void laserbat_map(address_map &map);
protected:
- enum { TIMER_SCANLINE };
-
laserbat_state_base(const machine_config &mconfig, device_type type, const char *tag, uint8_t eff2_mask)
: driver_device(mconfig, type, tag)
, m_mux_ports(*this, {"ROW0", "ROW1", "SW1", "SW2"})
@@ -76,8 +74,6 @@ protected:
virtual void machine_start() override;
uint32_t screen_update_laserbat(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
// video functions
TIMER_CALLBACK_MEMBER(video_line);
diff --git a/src/mame/includes/lethalj.h b/src/mame/includes/lethalj.h
index 771fb98b6cf..c699c386a63 100644
--- a/src/mame/includes/lethalj.h
+++ b/src/mame/includes/lethalj.h
@@ -18,11 +18,6 @@
class lethalj_state : public driver_device
{
public:
- enum
- {
- TIMER_GEN_EXT1_INT
- };
-
lethalj_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
@@ -59,9 +54,10 @@ private:
void lethalj_map(address_map &map);
virtual void machine_start() override { m_lamps.resolve(); }
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void video_start() override;
+ TIMER_CALLBACK_MEMBER(gen_ext1_int);
+
required_device<tms34010_device> m_maincpu;
required_device<screen_device> m_screen;
required_device<ticket_dispenser_device> m_ticket;
diff --git a/src/mame/includes/lisa.h b/src/mame/includes/lisa.h
index 98167a14249..b55b3a6cb94 100644
--- a/src/mame/includes/lisa.h
+++ b/src/mame/includes/lisa.h
@@ -79,22 +79,22 @@ struct clock_regs_t
struct lisa_features_t
{
- unsigned int has_fast_timers : 1; /* I/O board VIAs are clocked at 1.25 MHz (?) instead of .5 MHz (?) (Lisa 2/10, Mac XL) */
- /* Note that the beep routine in boot ROMs implies that
- VIA clock is 1.25 times faster with fast timers than with
- slow timers. I read the schematics again and again, and
- I simply don't understand : in one case the VIA is
- connected to the 68k E clock, which is CPUCK/10, and in
- another case, to a generated PH2 clock which is CPUCK/4,
- with additional logic to keep it in phase with the 68k
- memory cycle. After hearing the beep when MacWorks XL
- boots, I bet the correct values are .625 MHz and .5 MHz.
- Maybe the schematics are wrong, and PH2 is CPUCK/8.
- Maybe the board uses a 6522 variant with different
- timings. */
+ bool has_fast_timers; /* I/O board VIAs are clocked at 1.25 MHz (?) instead of .5 MHz (?) (Lisa 2/10, Mac XL) */
+ /* Note that the beep routine in boot ROMs implies that
+ VIA clock is 1.25 times faster with fast timers than with
+ slow timers. I read the schematics again and again, and
+ I simply don't understand : in one case the VIA is
+ connected to the 68k E clock, which is CPUCK/10, and in
+ another case, to a generated PH2 clock which is CPUCK/4,
+ with additional logic to keep it in phase with the 68k
+ memory cycle. After hearing the beep when MacWorks XL
+ boots, I bet the correct values are .625 MHz and .5 MHz.
+ Maybe the schematics are wrong, and PH2 is CPUCK/8.
+ Maybe the board uses a 6522 variant with different
+ timings. */
floppy_hardware_t floppy_hardware;
- unsigned int has_double_sided_floppy : 1; /* true on lisa 1 and *hacked* lisa 2/10 / Mac XL */
- unsigned int has_mac_xl_video : 1; /* modified video for MacXL */
+ bool has_double_sided_floppy; /* true on lisa 1 and *hacked* lisa 2/10 / Mac XL */
+ bool has_mac_xl_video; /* modified video for MacXL */
};
@@ -162,6 +162,7 @@ private:
required_device<palette_device> m_palette;
required_device<screen_device> m_screen;
+ emu_timer *m_cops_cmd_timer = nullptr;
uint8_t *m_ram_ptr = nullptr;
uint8_t *m_rom_ptr = nullptr;
uint8_t *m_videoROM_ptr = nullptr;
diff --git a/src/mame/includes/lynx.h b/src/mame/includes/lynx.h
index dc8262dae21..ffce5bdb741 100644
--- a/src/mame/includes/lynx.h
+++ b/src/mame/includes/lynx.h
@@ -49,7 +49,6 @@ protected:
virtual void machine_reset() override;
virtual void video_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_post_load() override;
private:
@@ -238,6 +237,11 @@ private:
required_ioport m_joy_io;
required_ioport m_pause_io;
+ // timers
+ emu_timer *m_blitter_timer = nullptr;
+ emu_timer *m_loopback_timer = nullptr;
+ emu_timer *m_uart_timer = nullptr;
+
// connected to cartridge slot
inline u32 get_cart_addr() { return (BIT(m_mikey.IODAT(), 4) * m_audin_offset) + (m_cart_addr_block * m_granularity) + m_cart_addr_counter; }
u8 m_cart_addr_block = 0; // Address block (74HC164 at schematics, connected to cartridge slot A12...A19)
diff --git a/src/mame/includes/m92.h b/src/mame/includes/m92.h
index aaa13052a60..08efd2eac9c 100644
--- a/src/mame/includes/m92.h
+++ b/src/mame/includes/m92.h
@@ -30,11 +30,6 @@ struct M92_pf_layer_info
class m92_state : public driver_device
{
public:
- enum
- {
- TIMER_SPRITEBUFFER
- };
-
m92_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_spriteram(*this, "spriteram"),
@@ -132,7 +127,7 @@ private:
void ppan_portmap(address_map &map);
void sound_map(address_map &map);
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(spritebuffer_done);
};
#endif // MAME_INCLUDES_M92_H
diff --git a/src/mame/includes/mcr68.h b/src/mame/includes/mcr68.h
index dfd1676ffbe..03ebedf9f78 100644
--- a/src/mame/includes/mcr68.h
+++ b/src/mame/includes/mcr68.h
@@ -54,6 +54,7 @@ public:
void init_archrivlb();
protected:
+ virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
@@ -74,7 +75,8 @@ private:
attotime m_timing_factor;
uint8_t m_sprite_clip = 0;
int8_t m_sprite_xoffset = 0;
- timer_expired_delegate m_v493_callback;
+ emu_timer *m_493_on_timer = nullptr;
+ emu_timer *m_493_off_timer = nullptr;
tilemap_t *m_bg_tilemap = nullptr;
tilemap_t *m_fg_tilemap = nullptr;
void xenophobe_control_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
diff --git a/src/mame/includes/megadriv.h b/src/mame/includes/megadriv.h
index 52456e876a5..0e3efdc0c21 100644
--- a/src/mame/includes/megadriv.h
+++ b/src/mame/includes/megadriv.h
@@ -61,13 +61,14 @@ public:
ioport_port *m_io_pad_3b[4];
ioport_port *m_io_pad_6b[4];
-struct genesis_z80_vars
-{
- int z80_is_reset = 0;
- int z80_has_bus = 0;
- uint32_t z80_bank_addr = 0;
- std::unique_ptr<uint8_t[]> z80_prgram;
-};
+ struct genesis_z80_vars
+ {
+ int z80_is_reset = 0;
+ int z80_has_bus = 0;
+ uint32_t z80_bank_addr = 0;
+ std::unique_ptr<uint8_t[]> z80_prgram;
+ emu_timer *z80_run_timer = nullptr;
+ };
genesis_z80_vars m_genz80;
int m_version_hi_nibble;
diff --git a/src/mame/includes/metro.h b/src/mame/includes/metro.h
index c7306cdb17a..dff6f0fe5c4 100644
--- a/src/mame/includes/metro.h
+++ b/src/mame/includes/metro.h
@@ -95,13 +95,10 @@ public:
DECLARE_READ_LINE_MEMBER(custom_soundstatus_r);
private:
- enum
- {
- TIMER_MOUJA_IRQ
- };
+ virtual void machine_start() override;
void ipl_w(u8 data);
- void mouja_irq_timer_ctrl_w(uint16_t data);
+ void mouja_irq_timer_ctrl_w(u16 data);
void sound_data_w(u8 data);
TIMER_CALLBACK_MEMBER(sound_data_sync);
u8 soundstatus_r();
@@ -112,13 +109,13 @@ private:
void upd7810_portb_w(u8 data);
void daitorid_portb_w(u8 data);
void coin_lockout_1word_w(u8 data);
- void coin_lockout_4words_w(offs_t offset, uint16_t data);
- uint16_t balcube_dsw_r(offs_t offset);
- uint16_t gakusai_input_r();
+ void coin_lockout_4words_w(offs_t offset, u16 data);
+ u16 balcube_dsw_r(offs_t offset);
+ u16 gakusai_input_r();
void blzntrnd_sh_bankswitch_w(u8 data);
- void puzzlet_irq_enable_w(uint8_t data);
- void puzzlet_portb_w(uint16_t data);
- void k053936_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
+ void puzzlet_irq_enable_w(u8 data);
+ void puzzlet_portb_w(u16 data);
+ void k053936_w(offs_t offset, u16 data, u16 mem_mask = ~0);
void gakusai_oki_bank_hi_w(u8 data);
void gakusai_oki_bank_lo_w(u8 data);
u8 gakusai_eeprom_r();
@@ -178,8 +175,7 @@ private:
void vmetal_map(address_map &map);
void ymf278_map(address_map &map);
- virtual void machine_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(mouja_irq);
/* devices */
required_device<cpu_device> m_maincpu;
@@ -198,8 +194,8 @@ private:
optional_device<generic_latch_8_device> m_soundlatch;
/* memory pointers */
- optional_shared_ptr<uint16_t> m_input_sel;
- optional_shared_ptr<uint16_t> m_k053936_ram;
+ optional_shared_ptr<u16> m_input_sel;
+ optional_shared_ptr<u16> m_k053936_ram;
optional_memory_bank m_audiobank;
optional_memory_bank m_okibank;
@@ -211,8 +207,8 @@ private:
emu_timer *m_mouja_irq_timer = nullptr;
/* sound related */
- u8 m_sound_data = 0;
- uint16_t m_soundstatus = 0;
+ u8 m_sound_data = 0;
+ u16 m_soundstatus = 0;
int m_porta = 0;
int m_portb = 0;
int m_busy_sndcpu = 0;
diff --git a/src/mame/includes/mhavoc.h b/src/mame/includes/mhavoc.h
index 72d8bb848f6..2b32b03dded 100644
--- a/src/mame/includes/mhavoc.h
+++ b/src/mame/includes/mhavoc.h
@@ -100,4 +100,5 @@ private:
uint8_t m_gamma_irq_clock = 0;
uint8_t m_has_gamma_cpu = 0;
uint8_t m_speech_write_buffer = 0;
+ emu_timer *m_gamma_sync_timer = nullptr;
};
diff --git a/src/mame/includes/micro3d.h b/src/mame/includes/micro3d.h
index 2efd43ac45c..1ef5029bd54 100644
--- a/src/mame/includes/micro3d.h
+++ b/src/mame/includes/micro3d.h
@@ -61,17 +61,11 @@ public:
DECLARE_READ_LINE_MEMBER(botss_hwchk_r);
protected:
- enum
- {
- TIMER_MAC_DONE
- };
-
+ virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
virtual void video_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
private:
enum planes
{
@@ -118,6 +112,7 @@ private:
/* MAC */
required_shared_ptr<uint32_t> m_mac_sram;
+ emu_timer *m_mac_done_timer = nullptr;
uint32_t m_sram_r_addr = 0;
uint32_t m_sram_w_addr = 0;
uint32_t m_vtx_addr = 0;
diff --git a/src/mame/includes/midvunit.h b/src/mame/includes/midvunit.h
index cff1a020ae4..c39c7a422e9 100644
--- a/src/mame/includes/midvunit.h
+++ b/src/mame/includes/midvunit.h
@@ -96,11 +96,6 @@ public:
DECLARE_CUSTOM_INPUT_MEMBER(motion_r);
private:
- enum
- {
- TIMER_SCANLINE
- };
-
optional_shared_ptr<uint32_t> m_nvram;
required_shared_ptr<uint32_t> m_ram_base;
optional_shared_ptr<uint32_t> m_fastram_base;
@@ -119,6 +114,7 @@ private:
uint16_t m_video_regs[16]{};
uint8_t m_dma_data_index = 0;
emu_timer *m_scanline_timer = nullptr;
+ emu_timer *m_eoi_timer = nullptr;
std::unique_ptr<midvunit_renderer> m_poly;
uint8_t m_galil_input_index = 0;
uint8_t m_galil_input_length = 0;
@@ -176,6 +172,7 @@ private:
DECLARE_MACHINE_RESET(midvplus);
uint32_t screen_update_midvunit(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(scanline_timer_cb);
+ TIMER_CALLBACK_MEMBER(eoi_timer_cb);
required_device<tms32031_device> m_maincpu;
required_device<watchdog_timer_device> m_watchdog;
required_device<palette_device> m_palette;
@@ -197,6 +194,4 @@ private:
void midvplus_map(address_map &map);
void midvunit_map(address_map &map);
-
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
};
diff --git a/src/mame/includes/midyunit.h b/src/mame/includes/midyunit.h
index 80a5c4dad1a..0ab28e54537 100644
--- a/src/mame/includes/midyunit.h
+++ b/src/mame/includes/midyunit.h
@@ -93,12 +93,6 @@ private:
uint16_t color = 0; // current foreground color with palette
};
- enum
- {
- TIMER_DMA,
- TIMER_AUTOERASE_LINE
- };
-
required_device<tms34010_device> m_maincpu;
optional_device<cpu_device> m_audiocpu;
optional_device<okim6295_device> m_oki;
@@ -175,7 +169,6 @@ private:
void main_map(address_map &map);
void yawdim_sound_map(address_map &map);
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
void dma_draw(uint16_t command);
void init_generic(int bpp, int sound, int prot_start, int prot_end);
void term2_init_common(write16s_delegate hack_w);
diff --git a/src/mame/includes/mpu4.h b/src/mame/includes/mpu4.h
index 6110efc1d43..af880b97c99 100644
--- a/src/mame/includes/mpu4.h
+++ b/src/mame/includes/mpu4.h
@@ -235,7 +235,7 @@ public:
void mpu4base(machine_config &config);
protected:
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(update_ic24);
void mpu4_memmap(address_map &map);
void lamp_extend_small(int data);
@@ -364,11 +364,6 @@ protected:
output_finder<8> m_triacs;
- enum
- {
- TIMER_IC24
- };
-
int m_mod_number = 0;
int m_mmtr_data = 0;
int m_ay8913_address = 0;
diff --git a/src/mame/includes/namcona1.h b/src/mame/includes/namcona1.h
index 74dafcbf449..8b5a288a9c6 100644
--- a/src/mame/includes/namcona1.h
+++ b/src/mame/includes/namcona1.h
@@ -61,6 +61,14 @@ public:
void namcona1_mcu_map(address_map &map);
protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+ virtual void device_post_load() override;
+
+ TIMER_CALLBACK_MEMBER(set_scanline_interrupt);
+ void scanline_interrupt(int scanline);
+
u16 custom_key_r(offs_t offset);
void custom_key_w(u16 data);
void vreg_w(offs_t offset, u16 data, u16 mem_mask = ~0);
@@ -85,20 +93,11 @@ protected:
u16 gfxram_r(offs_t offset);
void gfxram_w(offs_t offset, u16 data, u16 mem_mask = ~0);
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
- virtual void device_post_load() override;
-
u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- void scanline_interrupt(int scanline);
-
void namcona1_main_map(address_map &map);
void namcona1_c219_map(address_map &map);
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void video_start() override;
-
enum
{
NAMCO_CGANGPZL,
@@ -115,11 +114,6 @@ protected:
NAMCO_SWCOURTB
};
- enum
- {
- TIMER_SCANLINE
- };
-
int m_gametype;
required_device<cpu_device> m_maincpu;
@@ -147,7 +141,7 @@ protected:
// this has to be u8 to be in the right byte order for the tilemap system
std::vector<u8> m_shaperam;
- int m_mEnableInterrupts;
+ int m_enable_interrupts;
u16 m_count;
u32 m_keyval;
u16 m_mcu_mailbox[8];
@@ -163,7 +157,7 @@ protected:
int transfer_dword(u32 dest, u32 source);
void blit();
- void UpdatePalette(int offset);
+ void update_palette(int offset);
void pdraw_tile(screen_device &screen, bitmap_ind16 &dest_bmp, const rectangle &clip, u32 code, u32 color,
int sx, int sy, bool flipx, bool flipy, u8 priority, bool bShadow, bool bOpaque, u8 gfx_region);
void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/nbmj8688.h b/src/mame/includes/nbmj8688.h
index 7108af01f60..bd4e713fb2b 100644
--- a/src/mame/includes/nbmj8688.h
+++ b/src/mame/includes/nbmj8688.h
@@ -12,11 +12,6 @@
class nbmj8688_state : public driver_device
{
public:
- enum
- {
- TIMER_BLITTER
- };
-
nbmj8688_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
@@ -158,7 +153,7 @@ private:
void secolove_map(address_map &map);
void seiha_io_map(address_map &map);
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(clear_busy_flag);
};
#endif // MAME_INCLUDES_NBMJ8688_H
diff --git a/src/mame/includes/nbmj8891.h b/src/mame/includes/nbmj8891.h
index fdb263d078c..5e814009f1e 100644
--- a/src/mame/includes/nbmj8891.h
+++ b/src/mame/includes/nbmj8891.h
@@ -8,11 +8,6 @@
class nbmj8891_state : public driver_device
{
public:
- enum
- {
- TIMER_BLITTER
- };
-
nbmj8891_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag)
, m_maincpu(*this, "maincpu")
@@ -155,5 +150,5 @@ private:
void taiwanmb_io_map(address_map &map);
void taiwanmb_map(address_map &map);
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(clear_busy_flag);
};
diff --git a/src/mame/includes/nbmj8900.h b/src/mame/includes/nbmj8900.h
index 9a96ab8b631..be53917e5f7 100644
--- a/src/mame/includes/nbmj8900.h
+++ b/src/mame/includes/nbmj8900.h
@@ -27,11 +27,6 @@ public:
void init_ohpaipee();
private:
- enum
- {
- TIMER_BLITTER
- };
-
required_device<cpu_device> m_maincpu;
required_device<nb1413m3_device> m_nb1413m3;
required_device<screen_device> m_screen;
@@ -90,7 +85,7 @@ private:
void ohpaipee_map(address_map &map);
void togenkyo_map(address_map &map);
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(clear_busy_flag);
};
#endif // MAME_INCLUDES_NBMJ8900_H
diff --git a/src/mame/includes/nbmj8991.h b/src/mame/includes/nbmj8991.h
index 6292c4308c1..68b43384d8b 100644
--- a/src/mame/includes/nbmj8991.h
+++ b/src/mame/includes/nbmj8991.h
@@ -56,11 +56,6 @@ private:
required_shared_ptr<uint8_t> m_generic_paletteram_8;
- enum
- {
- TIMER_BLITTER
- };
-
int m_scrollx = 0;
int m_scrolly = 0;
int m_blitter_destx = 0;
@@ -116,5 +111,5 @@ private:
void triplew1_map(address_map &map);
void triplew2_map(address_map &map);
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(clear_busy_flag);
};
diff --git a/src/mame/includes/nbmj9195.h b/src/mame/includes/nbmj9195.h
index 2fa126340a8..52b8cda28cf 100644
--- a/src/mame/includes/nbmj9195.h
+++ b/src/mame/includes/nbmj9195.h
@@ -25,11 +25,6 @@
class nbmj9195_state : public driver_device
{
public:
- enum
- {
- TIMER_BLITTER
- };
-
nbmj9195_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
@@ -79,7 +74,8 @@ protected:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(clear_busy_flag);
private:
required_device<tmpz84c011_device> m_maincpu;
diff --git a/src/mame/includes/newbrain.h b/src/mame/includes/newbrain.h
index 9167c16dd0a..7f12a9b4e75 100644
--- a/src/mame/includes/newbrain.h
+++ b/src/mame/includes/newbrain.h
@@ -56,6 +56,17 @@ public:
void newbrain_video(machine_config &config);
private:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
+ void newbrain_iorq(address_map &map);
+ void newbrain_mreq(address_map &map);
+
+ TIMER_CALLBACK_MEMBER(clear_reset);
+ TIMER_CALLBACK_MEMBER(power_on);
+ TIMER_CALLBACK_MEMBER(clear_clkint);
+
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
uint8_t mreq_r(offs_t offset);
@@ -76,22 +87,6 @@ private:
DECLARE_READ_LINE_MEMBER( tdi_r );
DECLARE_WRITE_LINE_MEMBER( k1_w );
- void newbrain_iorq(address_map &map);
- void newbrain_mreq(address_map &map);
-
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
- virtual void machine_start() override;
- virtual void machine_reset() override;
-
- virtual void video_start() override;
-
- enum
- {
- TIMER_ID_RESET,
- TIMER_ID_PWRUP,
- TIMER_ID_CLKINT
- };
-
void check_interrupt();
void clclk();
int tpin();
@@ -142,6 +137,8 @@ private:
int m_80l = 0;
uint16_t m_tvl = 0;
+ emu_timer *m_reset_timer = nullptr;
+ emu_timer *m_power_timer = nullptr;
emu_timer *m_clkint_timer = nullptr;
};
diff --git a/src/mame/includes/next.h b/src/mame/includes/next.h
index cb7b384ac26..2cc98bc0763 100644
--- a/src/mame/includes/next.h
+++ b/src/mame/includes/next.h
@@ -73,6 +73,9 @@ private:
optional_device<n82077aa_device> fdc; // 040 only
optional_device<floppy_connector> floppy0; // 040 only
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void setup(uint32_t scr1, int size_x, int size_y, int skip, bool color);
@@ -114,7 +117,8 @@ private:
attotime timer_tbase;
uint16_t timer_vbase = 0;
- uint32_t timer_data = 0, timer_next_data = 0;
+ uint32_t timer_data = 0;
+ uint32_t timer_next_data = 0;
uint32_t timer_ctrl = 0;
emu_timer *timer_tm = nullptr;
@@ -155,9 +159,15 @@ private:
void next_mem(address_map &map);
struct dma_slot {
- uint32_t start = 0, limit = 0, chain_start = 0, chain_limit = 0, current = 0;
+ uint32_t start = 0;
+ uint32_t limit = 0;
+ uint32_t chain_start = 0;
+ uint32_t chain_limit = 0;
+ uint32_t current = 0;
uint8_t state = 0;
- bool supdate = false, restart = false, drq = false;
+ bool supdate = false;
+ bool restart = false;
+ bool drq = false;
};
enum {
@@ -186,14 +196,13 @@ private:
dma_slot dma_slots[0x20];
uint32_t esp = 0;
- int screen_sx = 0, screen_sy = 0, screen_skip = 0;
+ int screen_sx = 0;
+ int screen_sy = 0;
+ int screen_skip = 0;
bool screen_color = false;
bool vbl_enabled = false;
- virtual void machine_start() override;
- virtual void machine_reset() override;
-
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(timer_tick);
void timer_start();
void timer_update();
diff --git a/src/mame/includes/niyanpai.h b/src/mame/includes/niyanpai.h
index 52b5322a0da..4cd805d5307 100644
--- a/src/mame/includes/niyanpai.h
+++ b/src/mame/includes/niyanpai.h
@@ -28,11 +28,6 @@ public:
DECLARE_READ_LINE_MEMBER(musobana_outcoin_flag_r);
private:
- enum
- {
- TIMER_BLITTER
- };
-
required_device<tmp68301_device> m_maincpu;
required_device<screen_device> m_screen;
required_device<palette_device> m_palette;
@@ -109,5 +104,5 @@ private:
void niyanpai_map(address_map &map);
void zokumahj_map(address_map &map);
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(clear_busy_flag);
};
diff --git a/src/mame/includes/pc4.h b/src/mame/includes/pc4.h
index 6ef53155564..4bb2120ca11 100644
--- a/src/mame/includes/pc4.h
+++ b/src/mame/includes/pc4.h
@@ -28,12 +28,10 @@ public:
void pc4(machine_config &config);
protected:
- static const device_timer_id BUSY_TIMER = 0;
- static const device_timer_id BLINKING_TIMER = 1;
-
virtual void machine_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(clear_busy_flag);
+ TIMER_CALLBACK_MEMBER(blink_tick);
private:
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/pc88va.h b/src/mame/includes/pc88va.h
index 2f628957df4..0bb75fb62b5 100644
--- a/src/mame/includes/pc88va.h
+++ b/src/mame/includes/pc88va.h
@@ -39,15 +39,6 @@
class pc88va_state : public driver_device
{
public:
- enum
- {
- TIMER_PC8801FD_UPD765_TC_TO_ZERO,
- TIMER_T3_MOUSE_CALLBACK,
- TIMER_PC88VA_FDC_TIMER,
- TIMER_PC88VA_FDC_MOTOR_START_0,
- TIMER_PC88VA_FDC_MOTOR_START_1
- };
-
pc88va_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
@@ -87,9 +78,9 @@ protected:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
private:
+
required_device<cpu_device> m_maincpu;
required_device<screen_device> m_screen;
required_device<upd765a_device> m_fdc;
@@ -102,6 +93,7 @@ private:
required_shared_ptr<uint16_t> m_tvram;
required_shared_ptr<uint16_t> m_gvram;
std::unique_ptr<uint8_t[]> m_kanjiram;
+
uint16_t m_bank_reg = 0;
uint16_t m_screen_ctrl_reg = 0;
uint8_t m_timer3_io_reg = 0;
@@ -116,6 +108,11 @@ private:
uint8_t m_portc_test = 0;
uint8_t m_fdc_motor_status[2]{};
+ /* timers */
+ emu_timer *m_tc_clear_timer = nullptr;
+ emu_timer *m_fdc_timer = nullptr;
+ emu_timer *m_motor_start_timer[2]{};
+
/* floppy state */
uint8_t m_i8255_0_pc = 0;
uint8_t m_i8255_1_pc = 0;
diff --git a/src/mame/includes/pc9801.h b/src/mame/includes/pc9801.h
index 367227a38df..a8636f7d748 100644
--- a/src/mame/includes/pc9801.h
+++ b/src/mame/includes/pc9801.h
@@ -288,13 +288,7 @@ protected:
struct {
uint8_t mode = 0;
uint8_t tile[4]{}, tile_index = 0;
- }m_grcg;
-
- enum
- {
- TIMER_VBIRQ,
- TIMER_FDC_TRIGGER
- };
+ } m_grcg;
uint16_t tvram_r(offs_t offset, uint16_t mem_mask = ~0);
void tvram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
@@ -382,7 +376,7 @@ public:
void init_pc9801vm_kanji();
protected:
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(fdc_trigger);
void pc9801rs_io(address_map &map);
void pc9801rs_map(address_map &map);
diff --git a/src/mame/includes/playch10.h b/src/mame/includes/playch10.h
index 58fc37bba6f..4ffb240bc49 100644
--- a/src/mame/includes/playch10.h
+++ b/src/mame/includes/playch10.h
@@ -128,9 +128,9 @@ private:
void playch10_palette(palette_device &palette) const;
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
- void pc10_set_videorom_bank( int first, int count, int bank, int size );
- void set_videoram_bank( int first, int count, int bank, int size );
- void gboard_scanline_cb( int scanline, int vblank, int blanked );
+ void pc10_set_videorom_bank(int first, int count, int bank, int size);
+ void set_videoram_bank(int first, int count, int bank, int size);
+ void gboard_scanline_cb(int scanline, bool vblank, bool blanked);
DECLARE_WRITE_LINE_MEMBER(int_detect_w);
void mapper9_latch(offs_t offset);
void pc10_set_mirroring(int mirroring);
diff --git a/src/mame/includes/pmd85.h b/src/mame/includes/pmd85.h
index 48d3c98d3f5..ec50c9967d7 100644
--- a/src/mame/includes/pmd85.h
+++ b/src/mame/includes/pmd85.h
@@ -62,12 +62,8 @@ public:
DECLARE_INPUT_CHANGED_MEMBER(pmd85_reset);
private:
- enum
- {
- TIMER_CASSETTE
- };
-
- bool m_txd = false, m_rts = false;
+ bool m_txd = false;
+ bool m_rts = false;
uint8_t m_rom_module_present = 0;
uint8_t m_ppi_port_outputs[4][3]{};
uint8_t m_startup_mem_map = 0;
@@ -132,7 +128,6 @@ private:
void mato_update_memory();
void c2717_update_memory();
void common_driver_init();
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
required_device<cpu_device> m_maincpu;
required_region_ptr<u8> m_rom;
diff --git a/src/mame/includes/pocketc.h b/src/mame/includes/pocketc.h
index e4811b9ede6..56e31b8d072 100644
--- a/src/mame/includes/pocketc.h
+++ b/src/mame/includes/pocketc.h
@@ -34,11 +34,10 @@ public:
void pocketc_base(machine_config &config);
protected:
- static const device_timer_id TIMER_POWER_UP = 0;
-
virtual void machine_start() override;
virtual void machine_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(power_up_done);
void pocketc_palette(palette_device &palette) const;
diff --git a/src/mame/includes/poly.h b/src/mame/includes/poly.h
index 598b8df6e48..a39c91ef979 100644
--- a/src/mame/includes/poly.h
+++ b/src/mame/includes/poly.h
@@ -79,6 +79,7 @@ public:
, m_dat(*this, "dat")
, m_acia(*this, "acia")
, m_acia_clock(*this, "acia_clock")
+ , m_protect_timer(nullptr)
{
}
@@ -92,6 +93,11 @@ public:
virtual void poly_bank(address_map &map);
private:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
+ void poly_mem(address_map &map);
+
uint8_t logical_mem_r(offs_t offset);
void logical_mem_w(offs_t offset, uint8_t data);
uint8_t vector_r(offs_t offset);
@@ -117,11 +123,6 @@ private:
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
- void poly_mem(address_map &map);
-
- virtual void machine_start() override;
- virtual void machine_reset() override;
-
required_device<cpu_device> m_maincpu;
required_device<address_map_bank_device> m_bankdev;
required_device<ram_device> m_ram;
@@ -140,8 +141,10 @@ private:
required_shared_ptr<uint8_t> m_dat;
optional_device<acia6850_device> m_acia;
optional_device<clock_device> m_acia_clock;
- uint8_t m_video_pa = 0U, m_video_pb = 0U;
+ uint8_t m_video_pa = 0U;
+ uint8_t m_video_pb = 0U;
uint8_t m_term_data = 0U;
+ emu_timer *m_protect_timer;
inline offs_t physical(offs_t offset);
diff --git a/src/mame/includes/prof80.h b/src/mame/includes/prof80.h
index adba900a2bf..8dcefe0c7e8 100644
--- a/src/mame/includes/prof80.h
+++ b/src/mame/includes/prof80.h
@@ -53,6 +53,10 @@ public:
void prof80(machine_config &config);
private:
+ virtual void machine_start() override;
+
+ TIMER_CALLBACK_MEMBER(motor_off);
+
required_device<cpu_device> m_maincpu;
required_device<prof80_mmu_device> m_mmu;
required_device<upd1990a_device> m_rtc;
@@ -68,14 +72,6 @@ private:
required_ioport m_j4;
required_ioport m_j5;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
- virtual void machine_start() override;
-
- enum
- {
- TIMER_ID_MOTOR
- };
-
void flr_w(uint8_t data);
uint8_t status_r();
uint8_t status2_r();
diff --git a/src/mame/includes/psion5.h b/src/mame/includes/psion5.h
index 943546dc4ec..150a7919f41 100644
--- a/src/mame/includes/psion5.h
+++ b/src/mame/includes/psion5.h
@@ -48,7 +48,10 @@ protected:
virtual void machine_start() override;
virtual void machine_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(update_timer1);
+ TIMER_CALLBACK_MEMBER(update_timer2);
+ TIMER_CALLBACK_MEMBER(update_periodic_irq);
+ TIMER_CALLBACK_MEMBER(update_rtc);
private:
void palette_init(palette_device &palette);
@@ -60,11 +63,6 @@ private:
void set_timer_ctrl(int timer, uint32_t value);
void check_interrupts();
- static constexpr device_timer_id TID_TIMER1 = 0;
- static constexpr device_timer_id TID_TIMER2 = 1;
- static constexpr device_timer_id TID_PERIODIC = 2;
- static constexpr device_timer_id TID_RTC_TICKER = 3;
-
enum
{
REG_MEMCFG1 = 0x0000,
diff --git a/src/mame/includes/rmnimbus.h b/src/mame/includes/rmnimbus.h
index 564ea532693..8f5d355f13e 100644
--- a/src/mame/includes/rmnimbus.h
+++ b/src/mame/includes/rmnimbus.h
@@ -123,8 +123,12 @@ private:
uint8_t m_last_playmode = 0;
uint8_t m_ay8910_a = 0;
uint8_t m_ay8910_b = 0;
- uint16_t m_x = 0, m_y = 0, m_yline = 0;
- uint8_t m_colours = 0, m_mode = 0, m_upmode = 0;
+ uint16_t m_x = 0;
+ uint16_t m_y = 0;
+ uint16_t m_yline = 0;
+ uint8_t m_colours = 0;
+ uint8_t m_mode = 0;
+ uint8_t m_upmode = 0;
uint32_t m_debug_video = 0;
uint8_t m_vector = 0;
uint8_t m_eeprom_bits = 0;
@@ -183,7 +187,7 @@ private:
void set_pixel40(uint16_t x, uint16_t y, uint8_t colour);
void write_pixel_line(uint16_t x, uint16_t y, uint16_t, uint8_t pixels, uint8_t bpp);
void move_pixel_line(uint16_t x, uint16_t y, uint8_t width);
- void write_pixel_data(uint16_t x, uint16_t y, uint16_t data);
+ void write_pixel_data(uint16_t x, uint16_t y, uint16_t data);
void change_palette(uint8_t bank, uint16_t colours);
void external_int(uint8_t vector, bool state);
uint8_t cascade_callback();
@@ -210,43 +214,36 @@ private:
int m_scsi_req = 0;
int m_scsi_reqlat = 0;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
- enum
- {
- TIMER_MOUSE
- };
-
// Static data related to Floppy and SCSI hard disks
struct
{
- uint8_t reg400 = 0;
+ uint8_t reg400 = 0;
} m_nimbus_drives;
/* 8031 Peripheral controller */
struct
{
- uint8_t ipc_in = 0;
- uint8_t ipc_out = 0;
- uint8_t status_in = 0;
- uint8_t status_out = 0;
+ uint8_t ipc_in = 0;
+ uint8_t ipc_out = 0;
+ uint8_t status_in = 0;
+ uint8_t status_out = 0;
} m_ipc_interface;
/* Mouse/Joystick */
struct
{
- uint8_t m_mouse_x = 0;
- uint8_t m_mouse_y = 0;
+ uint8_t m_mouse_x = 0;
+ uint8_t m_mouse_y = 0;
- uint8_t m_mouse_pcx = 0;
- uint8_t m_mouse_pcy = 0;
+ uint8_t m_mouse_pcx = 0;
+ uint8_t m_mouse_pcy = 0;
- uint8_t m_intstate_x = 0;
- uint8_t m_intstate_y = 0;
+ uint8_t m_intstate_x = 0;
+ uint8_t m_intstate_y = 0;
- uint8_t m_reg0a4 = 0;
+ uint8_t m_reg0a4 = 0;
- emu_timer *m_mouse_timer = nullptr;
+ emu_timer *m_mouse_timer = nullptr;
} m_nimbus_mouse;
bool m_voice_enabled = false;
@@ -268,7 +265,7 @@ private:
void video_debug(const std::vector<std::string> &params);
offs_t dasm_override(std::ostream &stream, offs_t pc, const util::disasm_interface::data_buffer &opcodes, const util::disasm_interface::data_buffer &params);
- void do_mouse();
+ TIMER_CALLBACK_MEMBER(do_mouse);
};
#endif // MAME_INCLUDES_RMNIMBUS_H
diff --git a/src/mame/includes/rollerg.h b/src/mame/includes/rollerg.h
index af3f2ca44d3..354815bf04d 100644
--- a/src/mame/includes/rollerg.h
+++ b/src/mame/includes/rollerg.h
@@ -31,10 +31,13 @@ public:
void rollerg(machine_config &config);
private:
- enum
- {
- TIMER_NMI
- };
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
+ void main_map(address_map &map);
+ void sound_map(address_map &map);
+
+ TIMER_CALLBACK_MEMBER(sound_nmi);
/* misc */
int m_readzoomroms = 0;
@@ -46,23 +49,17 @@ private:
required_device<k05324x_device> m_k053244;
required_device<k051316_device> m_k051316;
required_device<k053252_device> m_k053252;
- void rollerg_0010_w(uint8_t data);
- uint8_t rollerg_k051316_r(offs_t offset);
+
+ void ext_enable_w(uint8_t data);
+ uint8_t k051316_r(offs_t offset);
void soundirq_w(uint8_t data);
void sound_arm_nmi_w(uint8_t data);
uint8_t pip_r();
DECLARE_WRITE_LINE_MEMBER(rollerg_irq_ack_w);
- virtual void machine_start() override;
- virtual void machine_reset() override;
- uint32_t screen_update_rollerg(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
K05324X_CB_MEMBER(sprite_callback);
K051316_CB_MEMBER(zoom_callback);
void banking_callback(uint8_t data);
-
- void rollerg_map(address_map &map);
- void rollerg_sound_map(address_map &map);
-
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
};
#endif // MAME_INCLUDES_ROLLERG_H
diff --git a/src/mame/includes/s11.h b/src/mame/includes/s11.h
index 869412e4720..f83372a7738 100644
--- a/src/mame/includes/s11.h
+++ b/src/mame/includes/s11.h
@@ -75,6 +75,13 @@ public:
DECLARE_INPUT_CHANGED_MEMBER(audio_nmi);
protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
+ void s11_main_map(address_map &map);
+ void s11_audio_map(address_map &map);
+
+ TIMER_CALLBACK_MEMBER(irq_timer);
u8 sound_r();
void bank_w(u8 data);
@@ -110,13 +117,6 @@ protected:
void switch_w(u8 data);
u8 pia28_w7_r();
- void s11_main_map(address_map &map);
- void s11_audio_map(address_map &map);
-
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
// devices
required_device<cpu_device> m_maincpu;
required_device<input_merger_device> m_mainirq;
@@ -151,9 +151,6 @@ protected:
void set_segment1(u32 s) { m_segment1 = s; }
u32 get_segment2() { return m_segment2; }
void set_segment2(u32 s) { m_segment2 = s; }
- void set_timer(emu_timer* t) { m_irq_timer = t; }
-
- static const device_timer_id TIMER_IRQ = 0;
u8 m_sound_data = 0U;
u8 m_strobe = 0U;
diff --git a/src/mame/includes/saturn.h b/src/mame/includes/saturn.h
index 11700cd8520..14ec8f79dac 100644
--- a/src/mame/includes/saturn.h
+++ b/src/mame/includes/saturn.h
@@ -86,14 +86,14 @@ protected:
struct {
std::unique_ptr<uint16_t * []> framebuffer_display_lines;
- int framebuffer_mode = 0;
- int framebuffer_double_interlace = 0;
- int fbcr_accessed = 0;
- int framebuffer_width = 0;
- int framebuffer_height = 0;
- int framebuffer_current_display = 0;
- int framebuffer_current_draw = 0;
- int framebuffer_clear_on_next_frame = 0;
+ int framebuffer_mode = 0;
+ int framebuffer_double_interlace = 0;
+ int fbcr_accessed = 0;
+ int framebuffer_width = 0;
+ int framebuffer_height = 0;
+ int framebuffer_current_display = 0;
+ int framebuffer_current_draw = 0;
+ int framebuffer_clear_on_next_frame = 0;
rectangle system_cliprect;
rectangle user_cliprect;
std::unique_ptr<uint16_t []> framebuffer[2];
@@ -103,8 +103,10 @@ protected:
uint16_t copr = 0;
uint16_t ewdr = 0;
- int local_x = 0;
- int local_y = 0;
+ int local_x = 0;
+ int local_y = 0;
+
+ emu_timer * draw_end_timer = nullptr;
}m_vdp1;
struct {
diff --git a/src/mame/includes/segag80r.h b/src/mame/includes/segag80r.h
index cc6f2851665..976b422918c 100644
--- a/src/mame/includes/segag80r.h
+++ b/src/mame/includes/segag80r.h
@@ -82,11 +82,6 @@ public:
inline void sega005_update_sound_data();
private:
- enum
- {
- TIMER_VBLANK_LATCH_CLEAR
- };
-
required_shared_ptr<uint8_t> m_mainram;
required_shared_ptr<uint8_t> m_videoram;
@@ -172,6 +167,7 @@ private:
void sega005_sound_a_w(uint8_t data);
void sega005_sound_b_w(uint8_t data);
+ TIMER_CALLBACK_MEMBER(vblank_latch_clear);
void vblank_latch_set();
void g80_set_palette_entry(int entry, uint8_t data);
void spaceod_bg_init_palette();
@@ -191,7 +187,6 @@ private:
void sindbadm_portmap(address_map &map);
void sindbadm_sound_map(address_map &map);
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
emu_timer *m_vblank_latch_clear_timer = nullptr;
};
diff --git a/src/mame/includes/segahang.h b/src/mame/includes/segahang.h
index 164f00695da..a6ac60158fc 100644
--- a/src/mame/includes/segahang.h
+++ b/src/mame/includes/segahang.h
@@ -72,6 +72,14 @@ public:
void init_endurob2();
private:
+ // driver overrides
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
+ TIMER_CALLBACK_MEMBER(i8751_sync);
+ TIMER_CALLBACK_MEMBER(ppi_sync);
+
// PPI read/write callbacks
void video_lamps_w(uint8_t data);
void tilemap_sound_w(uint8_t data);
@@ -110,19 +118,6 @@ private:
void sound_portmap_2203x2(address_map &map);
void sub_map(address_map &map);
- // timer IDs
- enum
- {
- TID_INIT_I8751,
- TID_PPI_WRITE
- };
-
- // driver overrides
- virtual void video_start() override;
- virtual void machine_start() override { m_lamps.resolve(); }
- virtual void machine_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
// devices
required_device<m68000_device> m_maincpu;
required_device<m68000_device> m_subcpu;
@@ -141,12 +136,13 @@ private:
required_shared_ptr<uint16_t> m_workram;
// configuration
- bool m_sharrier_video = false;
+ bool m_sharrier_video = false;
// internal state
- uint8_t m_adc_select = 0;
+ emu_timer * m_i8751_sync_timer = nullptr;
+ uint8_t m_adc_select = 0;
optional_ioport_array<4> m_adc_ports;
- bool m_shadow = false;
+ bool m_shadow = false;
optional_shared_ptr<uint16_t> m_decrypted_opcodes;
- output_finder<2> m_lamps;
+ output_finder<2> m_lamps;
};
diff --git a/src/mame/includes/segaorun.h b/src/mame/includes/segaorun.h
index 0aaffeff78f..cfbd01fe588 100644
--- a/src/mame/includes/segaorun.h
+++ b/src/mame/includes/segaorun.h
@@ -49,6 +49,7 @@ public:
m_custom_map(nullptr),
m_shangon_video(false),
m_scanline_timer(nullptr),
+ m_irq2_gen_timer(nullptr),
m_irq2_state(0),
m_adc_select(0),
m_vblank_irq_state(0),
@@ -108,18 +109,12 @@ protected:
void sound_portmap(address_map &map);
void sub_map(address_map &map);
- // timer IDs
- enum
- {
- TID_SCANLINE,
- TID_IRQ2_GEN,
- TID_SOUND_WRITE
- };
-
// device overrides
virtual void machine_reset() override;
virtual void video_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(irq2_gen_tick);
+ TIMER_CALLBACK_MEMBER(scanline_tick);
// internal helpers
void update_main_irqs();
@@ -155,14 +150,14 @@ protected:
required_shared_ptr<uint16_t> m_workram;
// configuration
- read16m_delegate m_custom_io_r;
+ read16m_delegate m_custom_io_r;
write16s_delegate m_custom_io_w;
const uint8_t * m_custom_map;
bool m_shangon_video;
// internal state
emu_timer * m_scanline_timer;
- emu_timer * m_irq2_gen_timer = nullptr;
+ emu_timer * m_irq2_gen_timer;
uint8_t m_irq2_state;
uint8_t m_adc_select;
uint8_t m_vblank_irq_state;
diff --git a/src/mame/includes/segas16a.h b/src/mame/includes/segas16a.h
index 6f4395876b1..c2c1b31f1ee 100644
--- a/src/mame/includes/segas16a.h
+++ b/src/mame/includes/segas16a.h
@@ -127,22 +127,18 @@ private:
typedef delegate<void ()> i8751_sim_delegate;
typedef delegate<void (uint8_t, uint8_t)> lamp_changed_delegate;
- // timer IDs
- enum
- {
- TID_INIT_I8751,
- TID_PPI_WRITE
- };
-
// driver overrides
virtual void video_start() override;
- virtual void machine_start() override { m_lamps.resolve(); }
+ virtual void machine_start() override;
virtual void machine_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// I8751 simulations
void dumpmtmt_i8751_sim();
+ // timer handlers
+ TIMER_CALLBACK_MEMBER(i8751_sync);
+ TIMER_CALLBACK_MEMBER(ppi_sync);
+
// custom I/O handlers
uint16_t aceattaca_custom_io_r(offs_t offset);
void aceattaca_custom_io_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
@@ -173,20 +169,21 @@ private:
optional_shared_ptr<uint8_t> m_sound_decrypted_opcodes;
// configuration
- read16sm_delegate m_custom_io_r;
+ read16sm_delegate m_custom_io_r;
write16s_delegate m_custom_io_w;
i8751_sim_delegate m_i8751_vblank_hook;
lamp_changed_delegate m_lamp_changed_w;
// internal state
- uint8_t m_video_control = 0;
- uint8_t m_mcu_control = 0;
- uint8_t m_n7751_command = 0;
- uint32_t m_n7751_rom_address = 0;
- uint8_t m_last_buttons1 = 0;
- uint8_t m_last_buttons2 = 0;
- uint8_t m_read_port = 0;
- uint8_t m_mj_input_num = 0;
+ emu_timer * m_i8751_sync_timer = nullptr;
+ uint8_t m_video_control = 0;
+ uint8_t m_mcu_control = 0;
+ uint8_t m_n7751_command = 0;
+ uint32_t m_n7751_rom_address = 0;
+ uint8_t m_last_buttons1 = 0;
+ uint8_t m_last_buttons2 = 0;
+ uint8_t m_read_port = 0;
+ uint8_t m_mj_input_num = 0;
optional_ioport_array<6> m_mj_inputs;
output_finder<2> m_lamps;
};
diff --git a/src/mame/includes/segas16b.h b/src/mame/includes/segas16b.h
index e4b0a042590..0bf47d04b36 100644
--- a/src/mame/includes/segas16b.h
+++ b/src/mame/includes/segas16b.h
@@ -54,6 +54,7 @@ public:
, m_cxdio(*this, "cxdio")
, m_upd4701a(*this, "upd4701a%u", 1U)
, m_workram(*this, "workram")
+ , m_i8751_sync_timer(nullptr)
, m_romboard(ROM_BOARD_INVALID)
, m_tilemap_type(segaic16_video_device::TILEMAP_16B)
, m_custom_io_r(*this)
@@ -188,13 +189,6 @@ protected:
// internal types
typedef delegate<void ()> i8751_sim_delegate;
- // timer IDs
- enum
- {
- TID_INIT_I8751,
- TID_ATOMICP_SOUND_IRQ
- };
-
// rom board types
enum segas16b_rom_board
{
@@ -209,9 +203,11 @@ protected:
// device overrides
virtual void video_start() override;
- virtual void machine_start() override { m_lamps.resolve(); }
+ virtual void machine_start() override;
virtual void machine_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(i8751_sync);
+ TIMER_CALLBACK_MEMBER(atomicp_sound_irq);
// internal helpers
void init_generic(segas16b_rom_board rom_board);
@@ -253,26 +249,29 @@ protected:
// memory pointers
required_shared_ptr<uint16_t> m_workram;
+ // timers
+ emu_timer * m_i8751_sync_timer;
+
// configuration
segas16b_rom_board m_romboard;
int m_tilemap_type;
- read16_delegate m_custom_io_r;
+ read16_delegate m_custom_io_r;
write16_delegate m_custom_io_w;
bool m_disable_screen_blanking;
- const uint8_t * m_i8751_initial_config;
+ const uint8_t * m_i8751_initial_config;
i8751_sim_delegate m_i8751_vblank_hook;
- uint8_t m_atomicp_sound_divisor;
+ uint8_t m_atomicp_sound_divisor;
// game-specific state
- uint8_t m_atomicp_sound_count;
- uint8_t m_hwc_input_value;
+ uint8_t m_atomicp_sound_count;
+ uint8_t m_hwc_input_value;
optional_ioport m_hwc_monitor;
optional_ioport m_hwc_left;
optional_ioport m_hwc_right;
optional_ioport m_hwc_left_limit;
optional_ioport m_hwc_right_limit;
- uint8_t m_mj_input_num;
- uint8_t m_mj_last_val;
+ uint8_t m_mj_input_num;
+ uint8_t m_mj_last_val;
optional_ioport_array<6> m_mj_inputs;
int m_spritepalbase;
@@ -403,7 +402,7 @@ private:
uint16_t m_security_latch;
uint8_t m_rle_control_position;
uint8_t m_rle_control_byte;
- bool m_rle_latched;
+ bool m_rle_latched;
uint8_t m_rle_byte;
void isgsm_map(address_map &map);
};
diff --git a/src/mame/includes/segas18.h b/src/mame/includes/segas18.h
index f5f63e3d9af..9db5cd1371a 100644
--- a/src/mame/includes/segas18.h
+++ b/src/mame/includes/segas18.h
@@ -120,12 +120,6 @@ private:
void sound_portmap(address_map &map);
void system18_map(address_map &map);
- // timer IDs
- enum
- {
- TID_INITIAL_BOOST
- };
-
// rom board types
enum segas18_rom_board
{
@@ -140,9 +134,9 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// internal helpers
+ TIMER_CALLBACK_MEMBER(initial_boost);
void init_generic(segas18_rom_board rom_board);
void set_vdp_mixing(uint8_t mixing);
void draw_vdp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int priority);
@@ -176,14 +170,15 @@ private:
write16sm_delegate m_custom_io_w;
// internal state
+ emu_timer * m_init_boost_timer = nullptr;
int m_grayscale_enable = 0;
int m_vdp_enable = 0;
- uint8_t m_vdp_mixing = 0;
+ uint8_t m_vdp_mixing = 0;
bitmap_ind16 m_temp_bitmap;
// game-specific state
- uint8_t m_lghost_value = 0;
- uint8_t m_lghost_select = 0;
+ uint8_t m_lghost_value = 0;
+ uint8_t m_lghost_select = 0;
};
#endif // MAME_INCLUDES_SEGAS18_H
diff --git a/src/mame/includes/segaxbd.h b/src/mame/includes/segaxbd.h
index 9e66918f7ac..1cb30b526e9 100644
--- a/src/mame/includes/segaxbd.h
+++ b/src/mame/includes/segaxbd.h
@@ -81,19 +81,13 @@ protected:
void sound_portmap(address_map &map);
void sub_map(address_map &map);
- // timer IDs
- enum
- {
- TID_SCANLINE,
- TID_IRQ2_GEN
- };
-
segaxbd_state(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
// device overrides
// virtual void machine_reset();
virtual void video_start();
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(scanline_tick);
// internal helpers
void update_main_irqs();
diff --git a/src/mame/includes/segaybd.h b/src/mame/includes/segaybd.h
index 728c817b1da..bea65ac14a7 100644
--- a/src/mame/includes/segaybd.h
+++ b/src/mame/includes/segaybd.h
@@ -101,18 +101,12 @@ private:
// internal types
typedef delegate<void (uint16_t)> output_delegate;
- // timer IDs
- enum
- {
- TID_IRQ2_GEN
- };
-
// device overrides
virtual void machine_reset() override;
virtual void video_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// internal helpers
+ TIMER_CALLBACK_MEMBER(irq2_gen_tick);
void update_irqs();
// devices
diff --git a/src/mame/includes/sg1000.h b/src/mame/includes/sg1000.h
index fca581678e8..11e1a6ab851 100644
--- a/src/mame/includes/sg1000.h
+++ b/src/mame/includes/sg1000.h
@@ -54,11 +54,6 @@ public:
DECLARE_INPUT_CHANGED_MEMBER( trigger_nmi );
protected:
- enum
- {
- TIMER_LIGHTGUN_TICK
- };
-
required_device<cpu_device> m_maincpu;
required_device<ram_device> m_ram;
required_memory_region m_rom;
diff --git a/src/mame/includes/simpsons.h b/src/mame/includes/simpsons.h
index 2dd9cc26c7e..83ee79d33f5 100644
--- a/src/mame/includes/simpsons.h
+++ b/src/mame/includes/simpsons.h
@@ -28,11 +28,16 @@ public:
void simpsons(machine_config &config);
private:
- enum
- {
- TIMER_DMASTART,
- TIMER_DMAEND
- };
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
+ void bank0000_map(address_map &map);
+ void bank2000_map(address_map &map);
+ void main_map(address_map &map);
+ void z80_map(address_map &map);
+
+ TIMER_CALLBACK_MEMBER(dma_start);
+ TIMER_CALLBACK_MEMBER(dma_end);
/* memory pointers */
std::unique_ptr<uint16_t[]> m_spriteram;
@@ -41,6 +46,8 @@ private:
int m_sprite_colorbase = 0;
int m_layer_colorbase[3]{};
int m_layerpri[3]{};
+ emu_timer *m_dma_start_timer;
+ emu_timer *m_dma_end_timer;
/* misc */
int m_firq_enabled = 0;
@@ -58,30 +65,21 @@ private:
required_device<k053251_device> m_k053251;
void z80_bankswitch_w(uint8_t data);
void z80_arm_nmi_w(uint8_t data);
- void simpsons_eeprom_w(uint8_t data);
- void simpsons_coin_counter_w(uint8_t data);
- uint8_t simpsons_sound_interrupt_r();
- uint8_t simpsons_k052109_r(offs_t offset);
- void simpsons_k052109_w(offs_t offset, uint8_t data);
- uint8_t simpsons_k053247_r(offs_t offset);
- void simpsons_k053247_w(offs_t offset, uint8_t data);
- virtual void machine_start() override;
- virtual void machine_reset() override;
- uint32_t screen_update_simpsons(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- INTERRUPT_GEN_MEMBER(simpsons_irq);
- void simpsons_video_banking(int bank);
- void simpsons_objdma();
+ void eeprom_w(uint8_t data);
+ void coin_counter_w(uint8_t data);
+ uint8_t sound_interrupt_r();
+ uint8_t k052109_r(offs_t offset);
+ void k052109_w(offs_t offset, uint8_t data);
+ uint8_t k053247_r(offs_t offset);
+ void k053247_w(offs_t offset, uint8_t data);
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ INTERRUPT_GEN_MEMBER(periodic_irq);
+ void video_bank_select(int bank);
+ void object_dma();
void z80_nmi_w(int state);
K052109_CB_MEMBER(tile_callback);
void banking_callback(u8 data);
K053246_CB_MEMBER(sprite_callback);
-
- void bank0000_map(address_map &map);
- void bank2000_map(address_map &map);
- void main_map(address_map &map);
- void z80_map(address_map &map);
-
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
};
#endif // MAME_INCLUDES_SIMPSONS_H
diff --git a/src/mame/includes/slapshot.h b/src/mame/includes/slapshot.h
index 46a99a0fa0e..995cf4fd3e3 100644
--- a/src/mame/includes/slapshot.h
+++ b/src/mame/includes/slapshot.h
@@ -41,23 +41,23 @@ public:
void driver_init() override;
protected:
- enum
- {
- TIMER_SLAPSHOT_INTERRUPT6
- };
-
virtual void machine_start() override;
virtual void video_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(trigger_int6);
private:
struct slapshot_tempsprite
{
u8 gfx = 0;
- u32 code = 0, color = 0;
- bool flipx = false, flipy = false;
- int x = 0, y = 0;
- int zoomx = 0, zoomy = 0;
+ u32 code = 0;
+ u32 color = 0;
+ bool flipx = false;
+ bool flipy = false;
+ int x = 0;
+ int y = 0;
+ int zoomx = 0;
+ int zoomy = 0;
u32 primask = 0;
};
diff --git a/src/mame/includes/snes.h b/src/mame/includes/snes.h
index 0d1a762c012..6669b7b12d3 100644
--- a/src/mame/includes/snes.h
+++ b/src/mame/includes/snes.h
@@ -322,20 +322,6 @@ protected:
virtual void machine_start() override;
virtual void machine_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
- enum
- {
- TIMER_NMI_TICK,
- TIMER_HIRQ_TICK,
- TIMER_RESET_OAM_ADDRESS,
- TIMER_RESET_HDMA,
- TIMER_UPDATE_IO,
- TIMER_SCANLINE_TICK,
- TIMER_HBLANK_TICK,
- TIMER_SNES_LAST
- };
-
/* misc */
uint16_t m_hblank_offset = 0;
uint32_t m_wram_address = 0;
@@ -358,6 +344,8 @@ protected:
// emu_timer *m_div_timer = nullptr;
// emu_timer *m_mult_timer = nullptr;
emu_timer *m_io_timer = nullptr;
+ emu_timer *m_oam_reset_addr_timer = nullptr;
+ emu_timer *m_hdma_reset_timer = nullptr;
/* DMA/HDMA-related */
struct
diff --git a/src/mame/includes/sorcerer.h b/src/mame/includes/sorcerer.h
index 4e4ddcceebf..8c3c78560fc 100644
--- a/src/mame/includes/sorcerer.h
+++ b/src/mame/includes/sorcerer.h
@@ -85,12 +85,6 @@ public:
void sorcererb(machine_config &config);
protected:
- enum
- {
- TIMER_SERIAL,
- TIMER_CASSETTE,
- };
-
u8 portfd_r();
u8 portfe_r();
void portfd_w(u8 data);
@@ -114,7 +108,6 @@ protected:
emu_timer *m_serial_timer = nullptr;
emu_timer *m_cassette_timer = nullptr;
cass_data_t m_cass_data;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
required_device<z80_device> m_maincpu;
required_region_ptr<u8> m_rom;
required_shared_ptr<u8> m_pcg;
diff --git a/src/mame/includes/spacefb.h b/src/mame/includes/spacefb.h
index 94350e47134..84317cbcb57 100644
--- a/src/mame/includes/spacefb.h
+++ b/src/mame/includes/spacefb.h
@@ -49,10 +49,13 @@ public:
void spacefb_audio(machine_config &config);
private:
- enum
- {
- TIMER_INTERRUPT
- };
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
+ void spacefb_main_map(address_map &map);
+ void spacefb_main_io_map(address_map &map);
+ void spacefb_audio_map(address_map &map);
required_device<cpu_device> m_maincpu;
required_device<i8035_device> m_audiocpu;
@@ -77,10 +80,6 @@ private:
DECLARE_READ_LINE_MEMBER(audio_t0_r);
DECLARE_READ_LINE_MEMBER(audio_t1_r);
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void video_start() override;
-
TIMER_CALLBACK_MEMBER(interrupt_callback);
void start_interrupt_timer();
@@ -92,12 +91,6 @@ private:
void draw_bullet(offs_t offs, pen_t pen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int flip);
void draw_sprite(offs_t offs, pen_t *pens, bitmap_rgb32 &bitmap, const rectangle &cliprect, int flip);
void draw_objects(bitmap_rgb32 &bitmap, const rectangle &cliprect);
-
- void spacefb_audio_map(address_map &map);
- void spacefb_main_io_map(address_map &map);
- void spacefb_main_map(address_map &map);
-
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
};
#endif // MAME_INCLUDES_SPACEFB
diff --git a/src/mame/includes/spectrum.h b/src/mame/includes/spectrum.h
index 27fa6e3be3a..478aaf28b1d 100644
--- a/src/mame/includes/spectrum.h
+++ b/src/mame/includes/spectrum.h
@@ -89,18 +89,17 @@ protected:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// until machine/spec_snqk.cpp gets somehow disentangled
virtual void plus3_update_memory() { }
virtual void spectrum_128_update_memory() { }
virtual void ts2068_update_memory() { }
- enum
- {
- TIMER_IRQ_ON,
- TIMER_IRQ_OFF // tsconf assumes it last know. if need more add above or fix references in clones
- };
+ TIMER_CALLBACK_MEMBER(irq_on);
+ TIMER_CALLBACK_MEMBER(irq_off);
+
+ emu_timer *m_irq_on_timer;
+ emu_timer *m_irq_off_timer;
int m_port_fe_data;
int m_port_7ffd_data;
@@ -121,8 +120,6 @@ protected:
s8 m_contention_offset = -1;
u64 m_int_at;
- emu_timer *m_irq_off_timer;
-
uint8_t m_ram_disabled_by_beta;
uint8_t pre_opcode_fetch_r(offs_t offset);
void spectrum_rom_w(offs_t offset, uint8_t data);
diff --git a/src/mame/includes/starfire.h b/src/mame/includes/starfire.h
index 950ccc1bc04..4b45180e6be 100644
--- a/src/mame/includes/starfire.h
+++ b/src/mame/includes/starfire.h
@@ -78,7 +78,6 @@ protected:
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(scanline_callback);
void get_pens(pen_t *pens);
- void scanline_callback(uint32_t data);
};
class starfire_state : public starfire_base_state
diff --git a/src/mame/includes/stfight.h b/src/mame/includes/stfight.h
index e047c57236b..2d2d880a8a7 100644
--- a/src/mame/includes/stfight.h
+++ b/src/mame/includes/stfight.h
@@ -44,15 +44,10 @@ public:
void init_stfight();
protected:
- enum
- {
- TIMER_STFIGHT_INTERRUPT_1
- };
-
virtual void machine_start() override;
virtual void machine_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(rst08_tick);
private:
DECLARE_WRITE_LINE_MEMBER(stfight_adpcm_int);
diff --git a/src/mame/includes/taito_f2.h b/src/mame/includes/taito_f2.h
index 01e7223a8f8..e722cfc8d2b 100644
--- a/src/mame/includes/taito_f2.h
+++ b/src/mame/includes/taito_f2.h
@@ -99,10 +99,7 @@ protected:
virtual void machine_start() override;
virtual void video_start() override;
- enum
- {
- TIMER_INTERRUPT6
- };
+ TIMER_CALLBACK_MEMBER(trigger_int6);
struct f2_tempsprite
{
@@ -288,8 +285,6 @@ protected:
void thundfox_map(address_map &map);
void yesnoj_map(address_map &map);
void yuyugogo_map(address_map &map);
-
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
};
#endif // MAME_INCLUDES_TAITO_F2_H
diff --git a/src/mame/includes/taito_f3.h b/src/mame/includes/taito_f3.h
index dc7f78bebf0..0f2c173822e 100644
--- a/src/mame/includes/taito_f3.h
+++ b/src/mame/includes/taito_f3.h
@@ -134,17 +134,12 @@ public:
DECLARE_CUSTOM_INPUT_MEMBER(eeprom_read);
protected:
- enum
- {
- TIMER_F3_INTERRUPT3
- };
-
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
- virtual void device_post_load(void) override;
-
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
+ virtual void device_post_load(void) override;
+
+ TIMER_CALLBACK_MEMBER(trigger_int3);
required_device<cpu_device> m_maincpu;
optional_device<watchdog_timer_device> m_watchdog;
diff --git a/src/mame/includes/taito_z.h b/src/mame/includes/taito_z.h
index c8ec0b28a34..a1352a6aca9 100644
--- a/src/mame/includes/taito_z.h
+++ b/src/mame/includes/taito_z.h
@@ -222,16 +222,12 @@ public:
void racingb(machine_config &config);
protected:
- enum
- {
- TIMER_TAITOZ_INTERRUPT6,
- };
-
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
+ TIMER_CALLBACK_MEMBER(trigger_int6);
+
private:
u16 sci_steer_input_r(offs_t offset);
u16 sci_spriteframe_r();
@@ -248,8 +244,9 @@ private:
void racingb_map(address_map &map);
void racingb_cpub_map(address_map &map);
- int m_sci_spriteframe = 0;
- s32 m_sci_int6 = 0;
+ int m_sci_spriteframe = 0;
+ s32 m_sci_int6 = 0;
+ emu_timer *m_int6_timer = nullptr;
};
diff --git a/src/mame/includes/tandy2k.h b/src/mame/includes/tandy2k.h
index e685f15c6cc..7e3313af8b6 100644
--- a/src/mame/includes/tandy2k.h
+++ b/src/mame/includes/tandy2k.h
@@ -116,6 +116,19 @@ public:
DECLARE_INPUT_CHANGED_MEMBER(input_changed);
private:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void device_reset_after_children() override;
+
+ void tandy2k_mem(address_map &map);
+ void tandy2k_io(address_map &map);
+ void tandy2k_hd_io(address_map &map);
+ void vpac_mem(address_map &map);
+ void vrambank_mem(address_map &map);
+
+ TIMER_CALLBACK_MEMBER(update_mouse);
+ TIMER_CALLBACK_MEMBER(mcu_delay_cb);
+
required_device<i80186_cpu_device> m_maincpu;
required_device<i8251_device> m_uart;
required_device<i8255_device> m_i8255a;
@@ -141,11 +154,6 @@ private:
memory_share_creator<uint8_t> m_char_ram;
required_device<pc_keyboard_device> m_pc_keyboard; // temporary until the tandy keyboard has a rom dump
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void device_reset_after_children() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void update_drq();
@@ -253,26 +261,17 @@ private:
BT_IRQ = 2
};
- enum
- {
- MOUS_TIMER,
- MCU_DELAY
- };
-
uint8_t m_clkmouse_cmd[8]{};
int m_clkmouse_cnt = 0;
uint8_t m_clkmouse_irq = 0;
- uint16_t m_mouse_x = 0, m_mouse_y = 0;
+ uint16_t m_mouse_x = 0;
+ uint16_t m_mouse_y = 0;
emu_timer *m_mouse_timer = nullptr;
emu_timer *m_mcu_delay = nullptr;
- void tandy2k_hd_io(address_map &map);
- void tandy2k_io(address_map &map);
- void tandy2k_mem(address_map &map);
- void vpac_mem(address_map &map);
- void vrambank_mem(address_map &map);
-
- required_ioport m_buttons, m_x_axis, m_y_axis;
+ required_ioport m_buttons;
+ required_ioport m_x_axis;
+ required_ioport m_y_axis;
};
#endif // MAME_INCLUDES_TANDY2K_H
diff --git a/src/mame/includes/tank8.h b/src/mame/includes/tank8.h
index ebacd73c172..48d32a612b6 100644
--- a/src/mame/includes/tank8.h
+++ b/src/mame/includes/tank8.h
@@ -54,11 +54,6 @@ public:
void init_decode();
private:
- enum
- {
- TIMER_COLLISION
- };
-
uint8_t collision_r();
void lockout_w(offs_t offset, uint8_t data);
void int_reset_w(uint8_t data);
@@ -83,9 +78,8 @@ private:
inline int get_y_pos(int n);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect);
- void set_collision(int index);
+ TIMER_CALLBACK_MEMBER(set_collision);
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
void tank8_cpu_map(address_map &map);
required_device<cpu_device> m_maincpu;
diff --git a/src/mame/includes/tehkanwc.h b/src/mame/includes/tehkanwc.h
index dcb82141610..39e18348e03 100644
--- a/src/mame/includes/tehkanwc.h
+++ b/src/mame/includes/tehkanwc.h
@@ -36,15 +36,10 @@ public:
void init_teedoff();
protected:
- enum
- {
- TIMER_RESET
- };
-
virtual void machine_start() override;
virtual void video_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(reset_audiocpu);
private:
required_device<cpu_device> m_maincpu;
diff --git a/src/mame/includes/ti85.h b/src/mame/includes/ti85.h
index 7aa9c1c8a69..45d3f62be52 100644
--- a/src/mame/includes/ti85.h
+++ b/src/mame/includes/ti85.h
@@ -63,6 +63,8 @@ public:
, m_nvram(*this, "nvram")
, m_flash(*this, "flash")
, m_membank(*this, "membank%u", 0U)
+ , m_on_button(*this, "ON")
+ , m_keys(*this, "BIT%u", 0U)
{
}
@@ -86,6 +88,8 @@ private:
optional_shared_ptr<uint8_t> m_nvram;
optional_device<intelfsh8_device> m_flash;
optional_device_array<address_map_bank_device, 4> m_membank;
+ required_ioport m_on_button;
+ required_ioport_array<8> m_keys;
ti85_model m_model{};
@@ -125,6 +129,7 @@ private:
emu_timer *m_ti85_timer = nullptr;
emu_timer *m_ti83_1st_timer = nullptr;
emu_timer *m_ti83_2nd_timer = nullptr;
+
uint8_t ti85_port_0000_r();
uint8_t ti8x_keypad_r();
uint8_t ti85_port_0006_r();
@@ -196,8 +201,9 @@ private:
TIMER_CALLBACK_MEMBER(ti83_timer1_callback);
TIMER_CALLBACK_MEMBER(ti83_timer2_callback);
+ TIMER_CALLBACK_MEMBER(crystal_timer_tick);
+
//crystal timers
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
void ti83pse_count(uint8_t timer, uint8_t data);
emu_timer *m_crystal_timer1 = nullptr;
diff --git a/src/mame/includes/tmc1800.h b/src/mame/includes/tmc1800.h
index 66f898e77dd..559a99ae1f7 100644
--- a/src/mame/includes/tmc1800.h
+++ b/src/mame/includes/tmc1800.h
@@ -49,11 +49,6 @@ protected:
class tmc1800_state : public tmc1800_base_state
{
public:
- enum
- {
- TIMER_SETUP_BEEP
- };
-
tmc1800_state(const machine_config &mconfig, device_type type, const char *tag)
: tmc1800_base_state(mconfig, type, tag)
, m_vdc(*this, CDP1861_TAG)
@@ -67,8 +62,6 @@ public:
DECLARE_READ_LINE_MEMBER( ef3_r );
DECLARE_WRITE_LINE_MEMBER( q_w );
- void init_tmc1800();
-
void tmc1800(machine_config &config);
void tmc1800_video(machine_config &config);
void tmc1800_io_map(address_map &map);
@@ -77,7 +70,6 @@ public:
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
required_device<cdp1861_device> m_vdc;
/* keyboard state */
@@ -175,11 +167,6 @@ public:
, m_led(*this, "led1")
{ }
- enum
- {
- TIMER_ID_EF4
- };
-
void keylatch_w(uint8_t data);
void bankswitch_w(uint8_t data);
DECLARE_READ_LINE_MEMBER( clear_r );
@@ -195,15 +182,19 @@ public:
void nano_map(address_map &map);
protected:
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void machine_start() override;
virtual void machine_reset() override;
+ TIMER_CALLBACK_MEMBER(assert_ef4);
+
required_device<cdp1864_device> m_cti;
required_ioport m_ny0;
required_ioport m_ny1;
required_ioport m_monitor;
output_finder<> m_led;
+
+ emu_timer *m_ef4_timer = nullptr;
+
/* keyboard state */
int m_keylatch = 0;
};
diff --git a/src/mame/includes/tmnt.h b/src/mame/includes/tmnt.h
index 014f18eeab6..4e9b3a2aa89 100644
--- a/src/mame/includes/tmnt.h
+++ b/src/mame/includes/tmnt.h
@@ -66,10 +66,7 @@ public:
protected:
virtual void machine_start() override;
- enum
- {
- TIMER_NMI
- };
+ TIMER_CALLBACK_MEMBER(audio_nmi);
/* memory pointers */
optional_shared_ptr<uint16_t> m_spriteram;
@@ -93,10 +90,11 @@ protected:
int m_dim_v = 0; /* lgtnfght, ssriders, tmnt2 only */
/* misc */
+ emu_timer *m_audio_nmi_timer = nullptr;
int m_tmnt_soundlatch = 0;
int m_toggle = 0;
int m_last = 0;
- uint16_t m_cuebrick_nvram[0x400 * 0x20 / 2]; // 32k paged in a 1k window
+ uint16_t m_cuebrick_nvram[0x400 * 0x20 / 2]; // 32k paged in a 1k window
/* devices */
required_device<cpu_device> m_maincpu;
@@ -203,8 +201,6 @@ protected:
void tmnt_audio_map(address_map &map);
void tmntucbl_audio_map(address_map &map);
void tmnt_main_map(address_map &map);
-
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
};
class glfgreat_state : public tmnt_state
diff --git a/src/mame/includes/triplhnt.h b/src/mame/includes/triplhnt.h
index 17a48f0fc24..9f09e05595f 100644
--- a/src/mame/includes/triplhnt.h
+++ b/src/mame/includes/triplhnt.h
@@ -53,16 +53,10 @@ public:
void init_triplhnt();
protected:
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void machine_start() override;
virtual void video_start() override;
private:
- enum
- {
- TIMER_HIT
- };
-
DECLARE_WRITE_LINE_MEMBER(coin_lockout_w);
DECLARE_WRITE_LINE_MEMBER(tape_control_w);
@@ -76,7 +70,7 @@ private:
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
- void set_collision(int code);
+ TIMER_CALLBACK_MEMBER(set_collision);
void triplhnt_map(address_map &map);
diff --git a/src/mame/includes/trucocl.h b/src/mame/includes/trucocl.h
index 72419330b8e..0d7e948836f 100644
--- a/src/mame/includes/trucocl.h
+++ b/src/mame/includes/trucocl.h
@@ -25,25 +25,15 @@ public:
void init_trucocl();
protected:
- enum
- {
- TIMER_DAC_IRQ
- };
-
+ virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(dac_irq);
private:
- int m_cur_dac_address = 0;
- int m_cur_dac_address_index = 0;
- required_shared_ptr<uint8_t> m_videoram;
- required_shared_ptr<uint8_t> m_colorram;
- tilemap_t *m_bg_tilemap = nullptr;
-
- uint8_t m_irq_mask = 0;
- emu_timer *m_dac_irq_timer = nullptr;
+ void main_map(address_map &map);
+ void main_io(address_map &map);
void irq_enable_w(uint8_t data);
void trucocl_videoram_w(offs_t offset, uint8_t data);
@@ -53,12 +43,19 @@ private:
void trucocl_palette(palette_device &palette) const;
uint32_t screen_update_trucocl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(trucocl_interrupt);
+
+ int m_cur_dac_address = 0;
+ int m_cur_dac_address_index = 0;
+ required_shared_ptr<uint8_t> m_videoram;
+ required_shared_ptr<uint8_t> m_colorram;
+ tilemap_t *m_bg_tilemap = nullptr;
+
+ uint8_t m_irq_mask = 0;
+ emu_timer *m_dac_irq_timer = nullptr;
+
required_device<cpu_device> m_maincpu;
required_device<dac_byte_interface> m_dac;
required_device<gfxdecode_device> m_gfxdecode;
-
- void main_map(address_map &map);
- void main_io(address_map &map);
};
#endif // MAME_INCLUDES_TRUCOCL_H
diff --git a/src/mame/includes/tsconf.h b/src/mame/includes/tsconf.h
index 5eaab848c05..2c111644f76 100644
--- a/src/mame/includes/tsconf.h
+++ b/src/mame/includes/tsconf.h
@@ -46,15 +46,11 @@ protected:
virtual void video_start() override;
virtual void machine_start() override;
virtual void machine_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-private:
- enum timer_id : u8
- {
- TIMER_IRQ_FRAME = TIMER_IRQ_OFF + 1,
- TIMER_IRQ_SCANLINE
- };
+ TIMER_CALLBACK_MEMBER(irq_frame);
+ TIMER_CALLBACK_MEMBER(irq_scanline);
+private:
enum gluk_ext : u8
{
CONF_VERSION = 0x00,
diff --git a/src/mame/includes/tubep.h b/src/mame/includes/tubep.h
index 8a6c8c905fd..57ccdf94f47 100644
--- a/src/mame/includes/tubep.h
+++ b/src/mame/includes/tubep.h
@@ -35,12 +35,45 @@ protected:
virtual void machine_start() override;
virtual void machine_reset() override;
- enum
- {
- TIMER_TUBEP_SCANLINE,
- TIMER_RJAMMER_SCANLINE,
- TIMER_SPRITE
- };
+ TIMER_CALLBACK_MEMBER(assert_sprite_int);
+
+ void tubep_main_map(address_map &map);
+ void tubep_main_portmap(address_map &map);
+ void tubep_second_map(address_map &map);
+ void tubep_second_portmap(address_map &map);
+ void tubep_sound_map(address_map &map);
+ void tubep_sound_portmap(address_map &map);
+
+ void nsc_map(address_map &map);
+
+ DECLARE_WRITE_LINE_MEMBER(coin1_counter_w);
+ DECLARE_WRITE_LINE_MEMBER(coin2_counter_w);
+ void main_cpu_irq_line_clear_w(uint8_t data);
+ void second_cpu_irq_line_clear_w(uint8_t data);
+ uint8_t tubep_soundlatch_r();
+ uint8_t tubep_sound_irq_ack();
+ void tubep_textram_w(offs_t offset, uint8_t data);
+ DECLARE_WRITE_LINE_MEMBER(screen_flip_w);
+ DECLARE_WRITE_LINE_MEMBER(background_romselect_w);
+ DECLARE_WRITE_LINE_MEMBER(colorproms_A4_line_w);
+ void background_a000_w(uint8_t data);
+ void background_c000_w(uint8_t data);
+ void sprite_control_w(offs_t offset, uint8_t data);
+
+ void ay8910_portA_0_w(uint8_t data);
+ void ay8910_portB_0_w(uint8_t data);
+ void ay8910_portA_1_w(uint8_t data);
+ void ay8910_portB_1_w(uint8_t data);
+ void ay8910_portA_2_w(uint8_t data);
+ void ay8910_portB_2_w(uint8_t data);
+ virtual void video_start() override;
+ virtual void video_reset() override;
+ void palette_init(palette_device &palette);
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ virtual TIMER_CALLBACK_MEMBER(scanline_callback);
+ void draw_sprite();
+ void vblank_end();
+ void setup_save_state();
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_soundcpu;
@@ -78,46 +111,6 @@ protected:
uint8_t m_ls175_e8 = 0;
uint8_t m_ls377_data = 0;
uint32_t m_page = 0;
- DECLARE_WRITE_LINE_MEMBER(coin1_counter_w);
- DECLARE_WRITE_LINE_MEMBER(coin2_counter_w);
- void main_cpu_irq_line_clear_w(uint8_t data);
- void second_cpu_irq_line_clear_w(uint8_t data);
- uint8_t tubep_soundlatch_r();
- uint8_t tubep_sound_irq_ack();
- void tubep_textram_w(offs_t offset, uint8_t data);
- DECLARE_WRITE_LINE_MEMBER(screen_flip_w);
- DECLARE_WRITE_LINE_MEMBER(background_romselect_w);
- DECLARE_WRITE_LINE_MEMBER(colorproms_A4_line_w);
- void tubep_background_a000_w(uint8_t data);
- void tubep_background_c000_w(uint8_t data);
- void tubep_sprite_control_w(offs_t offset, uint8_t data);
-
- void ay8910_portA_0_w(uint8_t data);
- void ay8910_portB_0_w(uint8_t data);
- void ay8910_portA_1_w(uint8_t data);
- void ay8910_portB_1_w(uint8_t data);
- void ay8910_portA_2_w(uint8_t data);
- void ay8910_portB_2_w(uint8_t data);
- virtual void video_start() override;
- virtual void video_reset() override;
- void tubep_palette(palette_device &palette);
- uint32_t screen_update_tubep(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- TIMER_CALLBACK_MEMBER(tubep_scanline_callback);
- TIMER_CALLBACK_MEMBER(rjammer_scanline_callback); // called from common device_timer function so can't be moved out of here yet
- void draw_sprite();
- void tubep_vblank_end();
- void tubep_setup_save_state();
-
- void nsc_map(address_map &map);
-
- void tubep_main_map(address_map &map);
- void tubep_main_portmap(address_map &map);
- void tubep_second_map(address_map &map);
- void tubep_second_portmap(address_map &map);
- void tubep_sound_map(address_map &map);
- void tubep_sound_portmap(address_map &map);
-
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
};
class rjammer_state : public tubep_state
@@ -137,21 +130,23 @@ protected:
virtual void machine_reset() override;
private:
+ virtual TIMER_CALLBACK_MEMBER(scanline_callback) override;
+
void soundlatch_nmi_w(uint8_t data);
- void rjammer_background_LS377_w(uint8_t data);
- void rjammer_background_page_w(uint8_t data);
- void rjammer_voice_startstop_w(uint8_t data);
- void rjammer_voice_frequency_select_w(uint8_t data);
+ void background_ls377_w(uint8_t data);
+ void background_page_w(uint8_t data);
+ void voice_startstop_w(uint8_t data);
+ void voice_frequency_select_w(uint8_t data);
- void rjammer_voice_input_w(uint8_t data);
- void rjammer_voice_intensity_control_w(uint8_t data);
+ void voice_input_w(uint8_t data);
+ void voice_intensity_control_w(uint8_t data);
- DECLARE_WRITE_LINE_MEMBER(rjammer_adpcm_vck_w);
+ DECLARE_WRITE_LINE_MEMBER(adpcm_vck_w);
- uint32_t screen_update_rjammer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- void rjammer_palette(palette_device &palette) const;
+ void palette_init(palette_device &palette) const;
void rjammer_main_map(address_map &map);
void rjammer_main_portmap(address_map &map);
diff --git a/src/mame/includes/turbo.h b/src/mame/includes/turbo.h
index 3832ea78d22..38f4fa36137 100644
--- a/src/mame/includes/turbo.h
+++ b/src/mame/includes/turbo.h
@@ -267,6 +267,7 @@ private:
uint32_t get_sprite_bits(uint8_t road);
void rom_decode();
void update_samples();
+ TIMER_CALLBACK_MEMBER(update_sound_a);
void prg_map(address_map &map);
};
diff --git a/src/mame/includes/ultratnk.h b/src/mame/includes/ultratnk.h
index f55783acb58..345f074135d 100644
--- a/src/mame/includes/ultratnk.h
+++ b/src/mame/includes/ultratnk.h
@@ -39,14 +39,8 @@ protected:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
private:
- enum
- {
- TIMER_NMI
- };
-
uint8_t wram_r(offs_t offset);
uint8_t analog_r(offs_t offset);
uint8_t coin_r(offs_t offset);
diff --git a/src/mame/includes/vectrex.h b/src/mame/includes/vectrex.h
index 19b9ac66cd7..2f45331f00a 100644
--- a/src/mame/includes/vectrex.h
+++ b/src/mame/includes/vectrex.h
@@ -25,20 +25,6 @@
class vectrex_base_state : public driver_device
{
public:
- enum
- {
- TIMER_VECTREX_IMAGER_CHANGE_COLOR,
- TIMER_UPDATE_LEVEL,
- TIMER_VECTREX_IMAGER_EYE,
- TIMER_LIGHTPEN_TRIGGER,
- TIMER_VECTREX_REFRESH,
- TIMER_VECTREX_ZERO_INTEGRATORS,
- TIMER_UPDATE_ANALOG,
- TIMER_UPDATE_BLANK,
- TIMER_UPDATE_MUX_ENABLE,
- TIMER_UPDATE_RAMP
- };
-
void vectrex_cart(device_slot_interface &device);
protected:
@@ -60,37 +46,40 @@ protected:
m_screen(*this, "screen")
{ }
- void vectrex_psg_port_w(uint8_t data);
- uint8_t vectrex_via_r(offs_t offset);
- void vectrex_via_w(offs_t offset, uint8_t data);
+ void psg_port_w(uint8_t data);
+ uint8_t via_r(offs_t offset);
+ void via_w(offs_t offset, uint8_t data);
virtual void driver_start() override;
virtual void video_start() override;
- uint32_t screen_update_vectrex(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
- TIMER_CALLBACK_MEMBER(vectrex_imager_change_color);
+ uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
+ TIMER_CALLBACK_MEMBER(imager_change_color);
TIMER_CALLBACK_MEMBER(update_level);
- TIMER_CALLBACK_MEMBER(vectrex_imager_eye);
+ TIMER_CALLBACK_MEMBER(imager_eye);
+ TIMER_CALLBACK_MEMBER(imager_index);
TIMER_CALLBACK_MEMBER(lightpen_trigger);
- TIMER_CALLBACK_MEMBER(vectrex_refresh);
- TIMER_CALLBACK_MEMBER(vectrex_zero_integrators);
+ TIMER_CALLBACK_MEMBER(refresh);
+ TIMER_CALLBACK_MEMBER(zero_integrators);
+ TIMER_CALLBACK_MEMBER(update_analog);
+ TIMER_CALLBACK_MEMBER(update_blank);
+ TIMER_CALLBACK_MEMBER(update_mux_enable);
+ TIMER_CALLBACK_MEMBER(update_ramp);
void update_vector();
- uint8_t vectrex_via_pb_r();
- uint8_t vectrex_via_pa_r();
- void v_via_pb_w(uint8_t data);
- void v_via_pa_w(uint8_t data);
- DECLARE_WRITE_LINE_MEMBER(v_via_ca2_w);
- DECLARE_WRITE_LINE_MEMBER(v_via_cb2_w);
+ uint8_t via_pb_r();
+ uint8_t via_pa_r();
+ void via_pb_w(uint8_t data);
+ void via_pa_w(uint8_t data);
+ DECLARE_WRITE_LINE_MEMBER(via_ca2_w);
+ DECLARE_WRITE_LINE_MEMBER(via_cb2_w);
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(cart_load);
- DECLARE_WRITE_LINE_MEMBER(vectrex_via_irq);
+ DECLARE_WRITE_LINE_MEMBER(via_irq);
void vectrex_base(machine_config &config);
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
void configure_imager(bool reset_refresh, const double *imager_angles);
- void vectrex_configuration();
- void vectrex_multiplexer(int mux);
- void vectrex_add_point(int x, int y, rgb_t color, int intensity);
- void vectrex_add_point_stereo(int x, int y, rgb_t color, int intensity);
+ void screen_configuration();
+ void multiplexer(int mux);
+ void add_point(int x, int y, rgb_t color, int intensity);
+ void add_point_stereo(int x, int y, rgb_t color, int intensity);
unsigned char m_via_out[2];
@@ -98,7 +87,10 @@ protected:
optional_device<vectrex_cart_slot_device> m_cart;
double m_imager_freq = 0;
- emu_timer *m_imager_timer = nullptr;
+ emu_timer *m_imager_color_timers[3]{};
+ emu_timer *m_imager_eye_timer = nullptr;
+ emu_timer *m_imager_index_timer = nullptr;
+ emu_timer *m_imager_level_timer = nullptr;
emu_timer *m_lp_t = nullptr;
required_device<via6522_device> m_via6522_0;
@@ -133,6 +125,9 @@ private:
int m_pen_x = 0;
int m_pen_y = 0;
emu_timer *m_refresh = nullptr;
+ emu_timer *m_zero_integrators_timer = nullptr;
+ emu_timer *m_update_blank_timer = nullptr;
+ emu_timer *m_update_mux_enable_timer = nullptr;
uint8_t m_blank = 0;
uint8_t m_ramp = 0;
int8_t m_analog[5]{};
@@ -188,7 +183,7 @@ public:
private:
void raaspec_led_w(uint8_t data);
- uint8_t vectrex_s1_via_pb_r();
+ uint8_t s1_via_pb_r();
void raaspec_map(address_map &map);
diff --git a/src/mame/includes/vidbrain.h b/src/mame/includes/vidbrain.h
index 1073b13de06..22d42450789 100644
--- a/src/mame/includes/vidbrain.h
+++ b/src/mame/includes/vidbrain.h
@@ -47,6 +47,22 @@ public:
DECLARE_INPUT_CHANGED_MEMBER( trigger_reset );
private:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
+ void vidbrain_mem(address_map &map);
+ void vidbrain_io(address_map &map);
+
+ TIMER_CALLBACK_MEMBER(joystick_tick);
+
+ void keyboard_w(uint8_t data);
+ uint8_t keyboard_r();
+ void sound_w(uint8_t data);
+
+ DECLARE_WRITE_LINE_MEMBER( ext_int_w );
+ DECLARE_WRITE_LINE_MEMBER( hblank_w );
+ uint8_t memory_read_byte(offs_t offset);
+
required_device<cpu_device> m_maincpu;
required_device<f3853_device> m_smi;
required_device<uv201_device> m_uv;
@@ -64,23 +80,6 @@ private:
required_ioport m_joy4_x;
required_ioport m_joy4_y;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
- virtual void machine_start() override;
- virtual void machine_reset() override;
-
- enum
- {
- TIMER_JOYSTICK
- };
-
- void keyboard_w(uint8_t data);
- uint8_t keyboard_r();
- void sound_w(uint8_t data);
-
- DECLARE_WRITE_LINE_MEMBER( ext_int_w );
- DECLARE_WRITE_LINE_MEMBER( hblank_w );
- uint8_t memory_read_byte(offs_t offset);
-
// keyboard state
uint8_t m_keylatch = 0;
int m_joy_enable = 0;
@@ -90,8 +89,6 @@ private:
// timers
emu_timer *m_timer_ne555 = nullptr;
- void vidbrain_io(address_map &map);
- void vidbrain_mem(address_map &map);
};
#endif
diff --git a/src/mame/includes/videopin.h b/src/mame/includes/videopin.h
index 6f69b8d21d2..246933a4ed1 100644
--- a/src/mame/includes/videopin.h
+++ b/src/mame/includes/videopin.h
@@ -44,13 +44,9 @@ protected:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
private:
- enum
- {
- TIMER_INTERRUPT
- };
+ void main_map(address_map &map);
uint8_t misc_r();
void led_w(uint8_t data);
@@ -63,8 +59,6 @@ private:
TILEMAP_MAPPER_MEMBER(get_memory_offset);
TILE_GET_INFO_MEMBER(get_tile_info);
- void main_map(address_map &map);
-
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(interrupt_callback);
diff --git a/src/mame/includes/vp415.h b/src/mame/includes/vp415.h
index 85ccf42c811..37f682e5209 100644
--- a/src/mame/includes/vp415.h
+++ b/src/mame/includes/vp415.h
@@ -79,7 +79,8 @@ public:
private:
virtual void machine_reset() override;
virtual void machine_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(drive_2ppr_tick);
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
@@ -274,8 +275,6 @@ private:
static const char *const I8255_TAG;
static const char *const CHARGEN_TAG;
static const char *const SYNCGEN_TAG;
-
- static const device_timer_id DRIVE_2PPR_ID;
};
#endif // MAME_INCLUDES_VP415_H
diff --git a/src/mame/includes/vsnes.h b/src/mame/includes/vsnes.h
index 3ff81a919ab..63658957130 100644
--- a/src/mame/includes/vsnes.h
+++ b/src/mame/includes/vsnes.h
@@ -114,7 +114,7 @@ private:
void bootleg_sound_write(offs_t offset, uint8_t data);
uint8_t vsnes_bootleg_z80_data_r();
uint8_t vsnes_bootleg_z80_address_r(offs_t offset);
- void vsnes_bootleg_scanline(int scanline, int vblank, int blanked);
+ void vsnes_bootleg_scanline(int scanline, bool vblank, bool blanked);
uint8_t vsnes_bootleg_ppudata();
void vsnes_bootleg_z80_map(address_map &map);
diff --git a/src/mame/includes/wgp.h b/src/mame/includes/wgp.h
index fdcba55786f..ab6b77fabfa 100644
--- a/src/mame/includes/wgp.h
+++ b/src/mame/includes/wgp.h
@@ -47,18 +47,13 @@ public:
void init_wgp2();
protected:
- enum
- {
- TIMER_INTERRUPT4,
- TIMER_CPUB_INTERRUPT6
- };
-
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_post_load() override;
+ TIMER_CALLBACK_MEMBER(trigger_cpu_b_int6);
+
private:
void coins_w(u8 data);
void cpua_ctrl_w(u16 data);
diff --git a/src/mame/includes/wolfpack.h b/src/mame/includes/wolfpack.h
index 27f44c96707..2df3fd34824 100644
--- a/src/mame/includes/wolfpack.h
+++ b/src/mame/includes/wolfpack.h
@@ -33,10 +33,21 @@ public:
template <int Bit> DECLARE_READ_LINE_MEMBER(dial_r);
private:
- enum
- {
- TIMER_PERIODIC
- };
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
+ void main_map(address_map &map);
+
+ void wolfpack_palette(palette_device &palette) const;
+
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ DECLARE_WRITE_LINE_MEMBER(screen_vblank);
+ TIMER_CALLBACK_MEMBER(periodic_callback);
+ void draw_ship(bitmap_ind16 &bitmap, const rectangle &cliprect);
+ void draw_torpedo(bitmap_ind16 &bitmap, const rectangle &cliprect);
+ void draw_pt(bitmap_ind16 &bitmap, const rectangle &cliprect);
+ void draw_water(palette_device &palette, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint8_t misc_r();
void high_explo_w(uint8_t data);
@@ -67,22 +78,6 @@ private:
void word_w(uint8_t data);
void start_speech_w(uint8_t data);
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void video_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
- void wolfpack_palette(palette_device &palette) const;
-
- uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- DECLARE_WRITE_LINE_MEMBER(screen_vblank);
- TIMER_CALLBACK_MEMBER(periodic_callback);
- void draw_ship(bitmap_ind16 &bitmap, const rectangle &cliprect);
- void draw_torpedo(bitmap_ind16 &bitmap, const rectangle &cliprect);
- void draw_pt(bitmap_ind16 &bitmap, const rectangle &cliprect);
- void draw_water(palette_device &palette, bitmap_ind16 &bitmap, const rectangle &cliprect);
-
- void main_map(address_map &map);
-
// devices, pointers
required_shared_ptr<uint8_t> m_alpha_num_ram;
required_device<cpu_device> m_maincpu;
diff --git a/src/mame/includes/wpc_dot.h b/src/mame/includes/wpc_dot.h
index 1a61dca00cf..e59249a45f2 100644
--- a/src/mame/includes/wpc_dot.h
+++ b/src/mame/includes/wpc_dot.h
@@ -34,8 +34,25 @@ public:
void wpc_dot(machine_config &config);
protected:
+ // driver_device overrides
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
void wpc_dot_map(address_map &map);
+ TIMER_CALLBACK_MEMBER(vblank_tick);
+ TIMER_CALLBACK_MEMBER(trigger_irq);
+
+ uint8_t ram_r(offs_t offset);
+ void ram_w(offs_t offset, uint8_t data);
+ DECLARE_WRITE_LINE_MEMBER(snd_reply_w);
+ DECLARE_WRITE_LINE_MEMBER(irq_w);
+ DECLARE_WRITE_LINE_MEMBER(firq_w);
+ void rombank_w(uint8_t data);
+ void dmdbank_w(offs_t offset, uint8_t data);
+
+ uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
+
// devices
required_device<cpu_device> m_maincpu;
optional_device<wpcsnd_device> m_wpcsnd;
@@ -44,23 +61,6 @@ protected:
required_memory_bank m_fixedbank;
required_memory_bank_array<6> m_dmdbanks;
- // driver_device overrides
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
- static const device_timer_id TIMER_VBLANK = 0;
- static const device_timer_id TIMER_IRQ = 1;
-
- uint8_t ram_r(offs_t offset);
- void ram_w(offs_t offset, uint8_t data);
- DECLARE_WRITE_LINE_MEMBER(wpcsnd_reply_w);
- DECLARE_WRITE_LINE_MEMBER(wpc_irq_w);
- DECLARE_WRITE_LINE_MEMBER(wpc_firq_w);
- void wpc_rombank_w(uint8_t data);
- void wpc_dmdbank_w(offs_t offset, uint8_t data);
-
- uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
-
private:
uint16_t m_vblank_count = 0U;
uint32_t m_irq_count = 0U;
diff --git a/src/mame/includes/x68k.h b/src/mame/includes/x68k.h
index 9dfa22a4023..e4b98390125 100644
--- a/src/mame/includes/x68k.h
+++ b/src/mame/includes/x68k.h
@@ -85,17 +85,6 @@ public:
virtual void driver_init() override;
protected:
- enum
- {
- TIMER_X68K_LED,
- TIMER_X68K_SCC_ACK,
- TIMER_MD_6BUTTON_PORT1_TIMEOUT,
- TIMER_MD_6BUTTON_PORT2_TIMEOUT,
- TIMER_X68K_BUS_ERROR,
- TIMER_X68K_FDC_TC,
- TIMER_X68K_ADPCM
- };
-
template <typename CpuType, typename AddrMap, typename Clock>
void add_cpu(machine_config &config, CpuType &&type, AddrMap &&map, Clock &&clock)
{
@@ -256,6 +245,8 @@ protected:
TILE_GET_INFO_MEMBER(get_bg1_tile_16);
virtual void video_start() override;
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
+ TIMER_CALLBACK_MEMBER(floppy_tc_tick);
+ TIMER_CALLBACK_MEMBER(adpcm_drq_tick);
TIMER_CALLBACK_MEMBER(led_callback);
TIMER_CALLBACK_MEMBER(scc_ack);
TIMER_CALLBACK_MEMBER(md_6button_port1_timeout);
@@ -340,7 +331,6 @@ public:
static rgb_t GGGGGRRRRRBBBBBI(uint32_t raw);
protected:
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void machine_start() override;
virtual void machine_reset() override;
void set_bus_error(uint32_t address, bool write, uint16_t mem_mask);
diff --git a/src/mame/includes/xbox_pci.h b/src/mame/includes/xbox_pci.h
index dff3a712147..52e9e5c4a52 100644
--- a/src/mame/includes/xbox_pci.h
+++ b/src/mame/includes/xbox_pci.h
@@ -228,10 +228,11 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_config_complete() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void config_map(address_map &map) override;
+ TIMER_CALLBACK_MEMBER(usb_update);
+
private:
ohci_usb_controller *ohci_usb;
devcb_write_line m_interrupt_handler;
@@ -296,10 +297,11 @@ public:
protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void config_map(address_map &map) override;
+ TIMER_CALLBACK_MEMBER(audio_update);
+
private:
required_device<device_memory_interface> cpu;
// APU contains 3 dsps: voice processor (VP) global processor (GP) encode processor (EP)
diff --git a/src/mame/includes/xbox_usb.h b/src/mame/includes/xbox_usb.h
index bcf44703cbc..495e68ad749 100644
--- a/src/mame/includes/xbox_usb.h
+++ b/src/mame/includes/xbox_usb.h
@@ -362,7 +362,7 @@ public:
void start();
void reset();
- void timer(emu_timer &timer, device_timer_id id, int param);
+ void timer(int param);
uint32_t read(offs_t offset);
void write(offs_t offset, uint32_t data);
diff --git a/src/mame/includes/z80ne.h b/src/mame/includes/z80ne.h
index ded6791f7f3..307ef676741 100644
--- a/src/mame/includes/z80ne.h
+++ b/src/mame/includes/z80ne.h
@@ -115,10 +115,9 @@ protected:
void lx385_ctrl_w(uint8_t data);
DECLARE_WRITE_LINE_MEMBER(lx385_uart_tx_clock_w);
- TIMER_CALLBACK_MEMBER(z80ne_cassette_tc);
- TIMER_CALLBACK_MEMBER(z80ne_kbd_scan);
-
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(cassette_tc);
+ TIMER_CALLBACK_MEMBER(kbd_scan);
+ TIMER_CALLBACK_MEMBER(pulse_nmi);
memory_passthrough_handler m_rom_shadow_tap;
required_device<ay31015_device> m_uart;
diff --git a/src/mame/includes/zx.h b/src/mame/includes/zx.h
index 32a0e96a3cb..7385ee3bf84 100644
--- a/src/mame/includes/zx.h
+++ b/src/mame/includes/zx.h
@@ -68,8 +68,8 @@ private:
void zx80_io_w(offs_t offset, uint8_t data);
void zx81_io_w(offs_t offset, uint8_t data);
- void zx_tape_input();
- void zx_ula_hsync();
+ TIMER_CALLBACK_MEMBER(zx_tape_input);
+ TIMER_CALLBACK_MEMBER(zx_ula_hsync);
void pc8300_io_map(address_map &map);
void pow3000_io_map(address_map &map);
@@ -79,12 +79,6 @@ private:
void zx81_io_map(address_map &map);
void zx81_map(address_map &map);
- enum
- {
- TIMER_TAPE_INPUT,
- TIMER_ULA_HSYNC
- };
-
required_device<z80_device> m_maincpu;
required_device<ram_device> m_ram;
required_device<cassette_image_device> m_cassette;
@@ -97,7 +91,8 @@ private:
required_device<screen_device> m_screen;
address_space *m_program = nullptr;
- emu_timer *m_tape_input = nullptr, *m_ula_hsync = nullptr;
+ emu_timer *m_tape_input = nullptr;
+ emu_timer *m_ula_hsync = nullptr;
bool m_vsync_active = false, m_hsync_active = false;
bool m_nmi_on = false, m_nmi_generator_active = false;
@@ -113,8 +108,6 @@ private:
uint16_t m_ula_char_buffer = 0;
double m_cassette_cur_level = 0;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
void drop_sync();
void recalc_hsync();
};
diff --git a/src/mame/machine/3dom2.cpp b/src/mame/machine/3dom2.cpp
index bbe7638ad46..a93fdf1acab 100644
--- a/src/mame/machine/3dom2.cpp
+++ b/src/mame/machine/3dom2.cpp
@@ -252,7 +252,7 @@ void m2_bda_device::device_start()
save_pointer(NAME(m_ram), ram_size / sizeof(uint32_t));
// Set a timer to pull data from the DSPP FIFO into the DACs
- m_dac_timer = timer_alloc(0);
+ m_dac_timer = timer_alloc(FUNC(m2_bda_device::dac_update), this);
m_dac_timer->adjust(attotime::from_hz(16.9345));
}
@@ -311,21 +311,14 @@ void m2_bda_device::device_add_mconfig(machine_config &config)
//-------------------------------------------------
-// device_timer - device-specific timers
+// dac_update - pull DAC data from the DSPP
//-------------------------------------------------
-void m2_bda_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(m2_bda_device::dac_update)
{
- switch (id)
- {
- case 0:
- {
- m_dac_l(m_dspp->read_output_fifo());
- m_dac_r(m_dspp->read_output_fifo());
- m_dac_timer->adjust(attotime::from_hz(44100));
- break;
- }
- }
+ m_dac_l(m_dspp->read_output_fifo());
+ m_dac_r(m_dspp->read_output_fifo());
+ m_dac_timer->adjust(attotime::from_hz(44100));
}
@@ -813,8 +806,8 @@ void m2_vdu_device::device_start()
m_vint1_int_handler.resolve_safe();
// Initialize line interrupt timers
- m_vint0_timer = timer_alloc(TIMER_ID_VINT0);
- m_vint1_timer = timer_alloc(TIMER_ID_VINT1);
+ m_vint0_timer = timer_alloc(FUNC(m2_vdu_device::vint0_set), this);
+ m_vint1_timer = timer_alloc(FUNC(m2_vdu_device::vint1_set), this);
// Calculate H/V count bias values (1 = start of blanking)
const rectangle visarea = m_screen->visible_area();
@@ -861,28 +854,21 @@ void m2_vdu_device::device_reset()
//-------------------------------------------------
-// device_timer - device-specific timers
+// vertical interrupt timer callbacks
//-------------------------------------------------
-void m2_vdu_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(m2_vdu_device::vint0_set)
{
- switch (id)
- {
- case TIMER_ID_VINT0:
- {
- m_vint |= VDU_VINT_VINT0;
- m_vint0_int_handler(ASSERT_LINE);
- set_vint_timer(0);
- break;
- }
- case TIMER_ID_VINT1:
- {
- m_vint |= VDU_VINT_VINT1;
- m_vint1_int_handler(ASSERT_LINE);
- set_vint_timer(1);
- break;
- }
- }
+ m_vint |= VDU_VINT_VINT0;
+ m_vint0_int_handler(ASSERT_LINE);
+ set_vint_timer(0);
+}
+
+TIMER_CALLBACK_MEMBER(m2_vdu_device::vint1_set)
+{
+ m_vint |= VDU_VINT_VINT1;
+ m_vint1_int_handler(ASSERT_LINE);
+ set_vint_timer(1);
}
@@ -1493,7 +1479,8 @@ m2_cde_device::m2_cde_device(const machine_config &mconfig, const char *tag, dev
m_cpu1(*this, finder_base::DUMMY_TAG),
m_bda(*this, finder_base::DUMMY_TAG),
m_int_handler(*this),
- m_sdbg_out_handler(*this)
+ m_sdbg_out_handler(*this),
+ m_cd_ready_timer(nullptr)
{
}
@@ -1509,8 +1496,8 @@ void m2_cde_device::device_start()
m_sdbg_out_handler.resolve_safe();
// Init DMA
- m_dma[0].m_timer = timer_alloc(TIMER_ID_DMA1);
- m_dma[1].m_timer = timer_alloc(TIMER_ID_DMA2);
+ m_dma[0].m_timer = timer_alloc(FUNC(m2_cde_device::next_dma), this);
+ m_dma[1].m_timer = timer_alloc(FUNC(m2_cde_device::next_dma), this);
// Register state for saving
save_item(NAME(m_sdbg_cntl));
@@ -1534,8 +1521,10 @@ void m2_cde_device::device_start()
save_item(NAME(m_dma[i].m_nbad), i);
save_item(NAME(m_dma[i].m_npad), i);
save_item(NAME(m_dma[i].m_ncnt), i);
- // timer
}
+
+ // Allocate other timers
+ m_cd_ready_timer = timer_alloc(FUNC(m2_cde_device::trigger_ready_int), this);
}
//-------------------------------------------------
@@ -1568,29 +1557,13 @@ void m2_cde_device::device_post_load()
//-------------------------------------------------
-// device_timer - a timer
+// trigger_ready_int - flag CD ready
//-------------------------------------------------
-void m2_cde_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(m2_cde_device::trigger_ready_int)
{
- switch (id)
- {
- case TIMER_ID_READY:
- // TODO ?
- set_interrupt(CDE_ID_READY);
- break;
-
- case TIMER_ID_DMA1:
- next_dma(0);
- break;
-
- case TIMER_ID_DMA2:
- next_dma(1);
- break;
-
- default:
- throw emu_fatalerror("m2_cde_device::device_timer: Unknown CDE timer ID");
- }
+ // TODO: Do we need to do more things here?
+ set_interrupt(CDE_ID_READY);
}
@@ -1743,31 +1716,22 @@ void m2_cde_device::write(address_space &space, offs_t offset, uint32_t data, ui
switch (byte_offs)
{
case CDE_SDBG_CNTL:
- {
// ........ ........ xxxxxxxx xxxx.... Clock scaler (written with 33MHz/38400 = 868)
write_m2_reg(m_sdbg_cntl, data, wm_cw);
break;
- }
case CDE_SDBG_WRT:
- {
m_sdbg_out_handler(data);
set_interrupt(CDE_SDBG_WRT_DONE);
break;
- }
case CDE_INT_STS:
- {
write_m2_reg(m_int_status, data, wm_cw);
update_interrupts();
break;
- }
case CDE_INT_ENABLE:
- {
write_m2_reg(m_int_enable, data, wm_cs);
update_interrupts();
break;
- }
case CDE_RESET_CNTL:
- {
if (data & 1)
{
// TODO: Should we reset both CPUs?
@@ -1782,23 +1746,16 @@ void m2_cde_device::write(address_space &space, offs_t offset, uint32_t data, ui
}
break;
- }
case CDE_CD_CMD_WRT:
- {
//set_interrupt(CDE_CD_CMD_WRT_DONE); // ?
//set_interrupt(CDE_CD_STS_FL_DONE); // ?
break;
- };
case CDE_UNIQ_ID_CMD:
- {
// TODO: What is this?
- timer_set(attotime::from_usec(250), TIMER_ID_READY);
+ m_cd_ready_timer->adjust(attotime::from_usec(250));
break;
- }
case CDE_BBLOCK:
- {
break;
- }
case CDE_DEV0_SETUP:
case CDE_DEV1_SETUP:
@@ -1830,18 +1787,14 @@ void m2_cde_device::write(address_space &space, offs_t offset, uint32_t data, ui
// case CDE_SYSTEM_CONF:
case CDE_VISA_DIS:
- {
write_m2_reg(m_visa_dis, data, wm_cw);
break;
- }
case CDE_MICRO_RWS:
case CDE_MICRO_WI:
case CDE_MICRO_WOB:
case CDE_MICRO_WO:
case CDE_MICRO_STATUS:
- {
break;
- }
case CDE_DMA1_CNTL:
case CDE_DMA2_CNTL:
@@ -1861,26 +1814,19 @@ void m2_cde_device::write(address_space &space, offs_t offset, uint32_t data, ui
}
case CDE_DMA1_CBAD:
case CDE_DMA2_CBAD:
- {
write_m2_reg(m_dma[dmach].m_cbad, data, wm_cw);
break;
- }
case CDE_DMA1_CPAD:
case CDE_DMA2_CPAD:
- {
write_m2_reg(m_dma[dmach].m_cpad, data, wm_cw);
break;
- }
case CDE_DMA1_CCNT:
case CDE_DMA2_CCNT:
- {
write_m2_reg(m_dma[dmach].m_ccnt, data, wm_cw);
break;
- }
default:
- {
//logerror("%s: CDE_W UNHANDLED: 0x%.8x 0x%.8x 0x%.8x\n", machine().describe_context(), byte_offs, data, mem_mask);
- }
+ break;
}
}
@@ -1926,7 +1872,7 @@ void m2_cde_device::start_dma(uint32_t ch)
attotime delay = attotime::from_nsec(10);// * dma_ch.m_ccnt;
// attotime delay = clocks_to_attotime(4 * dma_ch.m_ccnt);
- dma_ch.m_timer->adjust(delay);
+ dma_ch.m_timer->adjust(delay, (int)ch);
if (dma_ch.m_cntl & CDE_DMA_DIRECTION)
{
@@ -1989,8 +1935,9 @@ void m2_cde_device::start_dma(uint32_t ch)
// next_dma - Start the next DMA if set
//-------------------------------------------------
-void m2_cde_device::next_dma(uint32_t ch)
+TIMER_CALLBACK_MEMBER(m2_cde_device::next_dma)
{
+ const uint32_t ch = (uint32_t)param;
dma_channel &dma_ch = m_dma[ch];
// TODO: HACK!
diff --git a/src/mame/machine/3dom2.h b/src/mame/machine/3dom2.h
index 25df60b11bc..5c3ba784e2c 100644
--- a/src/mame/machine/3dom2.h
+++ b/src/mame/machine/3dom2.h
@@ -164,7 +164,8 @@ protected:
virtual void device_reset() override;
virtual void device_post_load() override;
virtual void device_add_mconfig(machine_config &config) override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(dac_update);
private:
enum base_addr
@@ -400,16 +401,11 @@ public:
protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-private:
- enum timer_id
- {
- TIMER_ID_VBLANK,
- TIMER_ID_VINT0,
- TIMER_ID_VINT1,
- };
+ TIMER_CALLBACK_MEMBER(vint0_set);
+ TIMER_CALLBACK_MEMBER(vint1_set);
+private:
void set_vint_timer(uint32_t id);
void parse_dc_word(uint32_t data);
void parse_av_word(uint32_t data);
@@ -525,19 +521,8 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_post_load() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
private:
-
- enum timer_id
- {
- TIMER_ID_READY,
- TIMER_ID_CD_DMA1,
- TIMER_ID_CD_DMA2,
- TIMER_ID_DMA1,
- TIMER_ID_DMA2,
- };
-
enum reg_offs
{
// Miscellaneous
@@ -684,7 +669,8 @@ private:
void reset_dma(uint32_t ch);
void start_dma(uint32_t ch);
- void next_dma(uint32_t ch);
+ TIMER_CALLBACK_MEMBER(next_dma);
+ TIMER_CALLBACK_MEMBER(trigger_ready_int);
static uint32_t address_to_biobus_slot(uint32_t addr)
{
@@ -699,6 +685,8 @@ private:
devcb_write_line m_int_handler;
devcb_write32 m_sdbg_out_handler;
+ // Timers
+ emu_timer *m_cd_ready_timer;
// Registers
uint32_t m_sdbg_in;
diff --git a/src/mame/machine/aim65.cpp b/src/mame/machine/aim65.cpp
index cf7b14ba9e1..031d5272c06 100644
--- a/src/mame/machine/aim65.cpp
+++ b/src/mame/machine/aim65.cpp
@@ -142,7 +142,7 @@ void aim65_state::machine_start()
save_item(NAME(m_printer_y));
save_item(NAME(m_printer_flag));
save_item(NAME(m_printer_level));
- m_print_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(aim65_state::printer_timer),this));
+ m_print_timer = timer_alloc(FUNC(aim65_state::printer_timer), this);
m_printerRAM = make_unique_clear<uint16_t[]>(64*100);
save_pointer(NAME(m_printerRAM), 64*100);
}
diff --git a/src/mame/machine/amiga.cpp b/src/mame/machine/amiga.cpp
index e1a21ae7fc9..bf729fe3d58 100644
--- a/src/mame/machine/amiga.cpp
+++ b/src/mame/machine/amiga.cpp
@@ -163,10 +163,10 @@ void amiga_state::machine_start()
m_chip_ram_mask = (m_chip_ram.bytes() - 1) & ~1;
// set up the timers
- m_irq_timer = timer_alloc(TIMER_AMIGA_IRQ);
- m_blitter_timer = timer_alloc(TIMER_AMIGA_BLITTER);
- m_serial_timer = timer_alloc(TIMER_SERIAL);
- m_scanline_timer = timer_alloc(TIMER_SCANLINE);
+ m_irq_timer = timer_alloc(FUNC(amiga_state::amiga_irq_proc), this);
+ m_blitter_timer = timer_alloc(FUNC(amiga_state::amiga_blitter_proc), this);
+ m_serial_timer = timer_alloc(FUNC(amiga_state::serial_shift), this);
+ m_scanline_timer = timer_alloc(FUNC(amiga_state::scanline_callback), this);
// start the scanline timer
m_scanline_timer->adjust(m_screen->time_until_pos(0));
@@ -226,27 +226,6 @@ uint32_t amiga_state::rom_mirror32_r(offs_t offset, uint32_t mem_mask)
return m_maincpu->space(AS_PROGRAM).read_dword(offset + 0xf80000, mem_mask);
}
-void amiga_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_SCANLINE:
- scanline_callback(param);
- break;
- case TIMER_AMIGA_IRQ:
- amiga_irq_proc(param);
- break;
- case TIMER_AMIGA_BLITTER:
- amiga_blitter_proc(param);
- break;
- case TIMER_SERIAL:
- serial_shift();
- break;
- default:
- fatalerror("Invalid timer: %d\n", id);
- }
-}
-
/*************************************
*
@@ -1725,7 +1704,7 @@ void amiga_state::serial_adjust()
m_serial_timer->adjust(attotime::from_hz(baud) / 2, 0, attotime::from_hz(baud));
}
-void amiga_state::serial_shift()
+TIMER_CALLBACK_MEMBER(amiga_state::serial_shift)
{
if (CUSTOM_REG(REG_ADKCON) & ADKCON_UARTBRK)
{
diff --git a/src/mame/machine/amstrad.cpp b/src/mame/machine/amstrad.cpp
index 07c3eb31352..0910624225e 100644
--- a/src/mame/machine/amstrad.cpp
+++ b/src/mame/machine/amstrad.cpp
@@ -221,25 +221,6 @@ TIMER_CALLBACK_MEMBER(amstrad_state::amstrad_pc2_low)
}
-void amstrad_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_PC2_LOW:
- amstrad_pc2_low(param);
- break;
- case TIMER_VIDEO_UPDATE:
- amstrad_video_update_timer(param);
- break;
- case TIMER_SET_RESOLUTION:
- cb_set_resolution(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in amstrad_state::device_timer");
- }
-}
-
-
/*************************************************************************/
/* KC Compact
@@ -589,7 +570,7 @@ void amstrad_state::amstrad_vh_update_colour(int PenIndex, uint16_t hw_colour_in
{
int val;
- timer_set(attotime::from_usec(0), TIMER_VIDEO_UPDATE, 1);
+ m_video_update_timer->adjust(attotime::from_usec(0), 1);
/* CPC+/GX4000 - normal palette changes through the Gate Array also makes the corresponding change in the ASIC palette */
val = (amstrad_palette[hw_colour_index] & 0xf00000) >> 16; /* red */
@@ -600,7 +581,7 @@ void amstrad_state::amstrad_vh_update_colour(int PenIndex, uint16_t hw_colour_in
}
else
{
- timer_set(attotime::from_usec(0), TIMER_VIDEO_UPDATE, 0);
+ m_video_update_timer->adjust(attotime::from_usec(0), 0);
}
m_GateArray_render_colours[PenIndex] = hw_colour_index;
}
@@ -608,7 +589,7 @@ void amstrad_state::amstrad_vh_update_colour(int PenIndex, uint16_t hw_colour_in
void amstrad_state::aleste_vh_update_colour(int PenIndex, uint16_t hw_colour_index)
{
- timer_set(attotime::from_usec(0), TIMER_VIDEO_UPDATE, 0);
+ m_video_update_timer->adjust(attotime::from_usec(0), 0);
m_GateArray_render_colours[PenIndex] = hw_colour_index+32;
}
@@ -975,7 +956,7 @@ WRITE_LINE_MEMBER(amstrad_state::amstrad_vsync_changed)
m_gate_array.vsync = state ? 1 : 0;
/* Schedule a write to PC2 */
- timer_set(attotime::zero, TIMER_PC2_LOW);
+ m_pc2_low_timer->adjust(attotime::zero);
}
@@ -996,7 +977,7 @@ WRITE_LINE_MEMBER(amstrad_state::amstrad_plus_vsync_changed)
m_gate_array.vsync = state ? 1 : 0;
/* Schedule a write to PC2 */
- timer_set(attotime::zero, TIMER_PC2_LOW);
+ m_pc2_low_timer->adjust(attotime::zero);
}
@@ -1075,6 +1056,8 @@ void amstrad_state::video_start()
m_gate_array.bitmap = std::make_unique<bitmap_ind16>(m_screen->width(), m_screen->height() );
m_gate_array.hsync_after_vsync_counter = 3;
std::fill(std::begin(m_GateArray_render_colours), std::end(m_GateArray_render_colours), 0);
+
+ m_video_update_timer = timer_alloc(FUNC(amstrad_state::amstrad_video_update_timer), this);
}
@@ -2056,9 +2039,9 @@ void amstrad_state::amstrad_cpc_io_w(offs_t offset, uint8_t data)
break;
case 0x01: /* Write to selected internal 6845 register Write Only */
if ( m_system_type == SYSTEM_PLUS || m_system_type == SYSTEM_GX4000 )
- timer_set(attotime::from_usec(0), TIMER_VIDEO_UPDATE, 1);
+ m_video_update_timer->adjust(attotime::from_usec(0), 1);
else
- timer_set(attotime::from_usec(0), TIMER_VIDEO_UPDATE, 0);
+ m_video_update_timer->adjust(attotime::from_usec(0), 0);
m_crtc->register_w(data);
/* printer port bit 8 */
@@ -2609,7 +2592,7 @@ uint8_t amstrad_state::amstrad_ppi_portb_r()
//logerror("amstrad_ppi_portb_r\n");
/* Schedule a write to PC2 */
- timer_set(attotime::zero, TIMER_PC2_LOW);
+ m_pc2_low_timer->adjust(attotime::zero);
return data;
}
@@ -3099,9 +3082,15 @@ TIMER_CALLBACK_MEMBER(amstrad_state::cb_set_resolution)
m_screen->configure( 1024, height, visarea, refresh );
}
+void amstrad_state::alloc_timers()
+{
+ m_pc2_low_timer = timer_alloc(FUNC(amstrad_state::amstrad_pc2_low), this);
+ m_set_resolution_timer = timer_alloc(FUNC(amstrad_state::cb_set_resolution), this);
+}
MACHINE_START_MEMBER(amstrad_state,amstrad)
{
+ alloc_timers();
m_system_type = SYSTEM_CPC;
m_centronics->write_data7(0);
}
@@ -3118,12 +3107,13 @@ MACHINE_RESET_MEMBER(amstrad_state,amstrad)
m_gate_array.hsync = 0;
m_gate_array.vsync = 0;
- timer_set(attotime::zero, TIMER_SET_RESOLUTION);
+ m_set_resolution_timer->adjust(attotime::zero);
}
MACHINE_START_MEMBER(amstrad_state,plus)
{
+ alloc_timers();
m_asic.ram = m_region_user1->base(); // 16kB RAM for ASIC, memory-mapped registers.
m_system_type = SYSTEM_PLUS;
m_centronics->write_data7(0);
@@ -3166,11 +3156,12 @@ MACHINE_RESET_MEMBER(amstrad_state,plus)
space.install_write_handler(0x6000, 0x7fff, write8sm_delegate(*this, FUNC(amstrad_state::amstrad_plus_asic_6000_w)));
// multiface_init();
- timer_set(attotime::zero, TIMER_SET_RESOLUTION);
+ m_set_resolution_timer->adjust(attotime::zero);
}
MACHINE_START_MEMBER(amstrad_state,gx4000)
{
+ alloc_timers();
m_asic.ram = m_region_user1->base(); // 16kB RAM for ASIC, memory-mapped registers.
m_system_type = SYSTEM_GX4000;
@@ -3208,11 +3199,12 @@ MACHINE_RESET_MEMBER(amstrad_state,gx4000)
space.install_write_handler(0x4000, 0x5fff, write8sm_delegate(*this, FUNC(amstrad_state::amstrad_plus_asic_4000_w)));
space.install_write_handler(0x6000, 0x7fff, write8sm_delegate(*this, FUNC(amstrad_state::amstrad_plus_asic_6000_w)));
- timer_set(attotime::zero, TIMER_SET_RESOLUTION);
+ m_set_resolution_timer->adjust(attotime::zero);
}
MACHINE_START_MEMBER(amstrad_state,kccomp)
{
+ alloc_timers();
m_system_type = SYSTEM_CPC;
m_centronics->write_data7(0);
@@ -3221,7 +3213,7 @@ MACHINE_START_MEMBER(amstrad_state,kccomp)
m_gate_array.hsync = 0;
m_gate_array.vsync = 0;
- timer_set(attotime::zero, TIMER_SET_RESOLUTION);
+ m_set_resolution_timer->adjust(attotime::zero);
}
@@ -3242,6 +3234,7 @@ MACHINE_RESET_MEMBER(amstrad_state,kccomp)
MACHINE_START_MEMBER(amstrad_state,aleste)
{
+ alloc_timers();
m_system_type = SYSTEM_ALESTE;
m_centronics->write_data7(0);
}
@@ -3251,7 +3244,7 @@ MACHINE_RESET_MEMBER(amstrad_state,aleste)
amstrad_common_init();
amstrad_reset_machine();
- timer_set(attotime::zero, TIMER_SET_RESOLUTION);
+ m_set_resolution_timer->adjust(attotime::zero);
}
diff --git a/src/mame/machine/apollo.cpp b/src/mame/machine/apollo.cpp
index 1b4f63013f1..9c6adb99b53 100644
--- a/src/mame/machine/apollo.cpp
+++ b/src/mame/machine/apollo.cpp
@@ -1276,8 +1276,7 @@ void apollo_stdio_device::device_start()
m_tx_w.resolve_safe();
- m_poll_timer = machine().scheduler().timer_alloc(timer_expired_delegate(
- FUNC(apollo_stdio_device::poll_timer), this));
+ m_poll_timer = timer_alloc(FUNC(apollo_stdio_device::poll_timer), this);
}
//-------------------------------------------------
@@ -1306,13 +1305,6 @@ void apollo_stdio_device::device_reset()
m_poll_timer->adjust(attotime::zero, 0, attotime::from_msec(1)); // every 1ms
}
-void apollo_stdio_device::device_timer(emu_timer &timer, device_timer_id id,
- int param)
-{
-// FIXME?
-// device_serial_interface::device_timer(timer, id, param);
-}
-
void apollo_stdio_device::rcv_complete() // Rx completed receiving byte
{
receive_register_extract();
diff --git a/src/mame/machine/apollo_kbd.cpp b/src/mame/machine/apollo_kbd.cpp
index 54302827fea..5e7e577325a 100644
--- a/src/mame/machine/apollo_kbd.cpp
+++ b/src/mame/machine/apollo_kbd.cpp
@@ -240,7 +240,7 @@ void apollo_kbd_device::device_start()
m_beeper.start(this);
m_mouse.start(this);
- m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(apollo_kbd_device::kbd_scan_timer), this));
+ m_timer = timer_alloc(FUNC(apollo_kbd_device::kbd_scan_timer), this);
}
//-------------------------------------------------
@@ -315,7 +315,7 @@ void apollo_kbd_device::beeper::start(apollo_kbd_device *device)
m_device = device;
LOG2(("start apollo_kbd::beeper"));
m_beeper = m_device->m_beep.target();
- m_timer = m_device->machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(apollo_kbd_device::beeper::beeper_callback), this));
+ m_timer = m_device->timer_alloc(FUNC(apollo_kbd_device::beeper::beeper_callback), this);
}
void apollo_kbd_device::beeper::reset()
diff --git a/src/mame/machine/apple3.cpp b/src/mame/machine/apple3.cpp
index d3467664e76..3d6045d8d12 100644
--- a/src/mame/machine/apple3.cpp
+++ b/src/mame/machine/apple3.cpp
@@ -729,8 +729,8 @@ void apple3_state::init_apple3()
m_via[1]->write_pb6(1);
m_via[1]->write_pb7(1);
- m_scanstart = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(apple3_state::scanstart_cb),this));
- m_scanend = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(apple3_state::scanend_cb),this));
+ m_scanstart = timer_alloc(FUNC(apple3_state::scanstart_cb), this);
+ m_scanend = timer_alloc(FUNC(apple3_state::scanend_cb), this);
apple3_update_memory();
diff --git a/src/mame/machine/archimedes_keyb.cpp b/src/mame/machine/archimedes_keyb.cpp
index 6b1a2e55f6a..a6aa8278969 100644
--- a/src/mame/machine/archimedes_keyb.cpp
+++ b/src/mame/machine/archimedes_keyb.cpp
@@ -254,7 +254,7 @@ void archimedes_keyboard_device::device_start()
set_data_frame(1, 8, PARITY_NONE, STOP_BITS_2);
set_rate(31250);
- m_mouse_timer = timer_alloc();
+ m_mouse_timer = timer_alloc(FUNC(archimedes_keyboard_device::update_mouse), this);
save_item(NAME(m_mouse_x));
save_item(NAME(m_mouse_y));
@@ -337,7 +337,7 @@ void archimedes_keyboard_device::tra_callback()
m_kout(transmit_register_get_data_bit());
}
-void archimedes_keyboard_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(archimedes_keyboard_device::update_mouse)
{
// Mouse quadrature signals
// Increase Decrease
diff --git a/src/mame/machine/archimedes_keyb.h b/src/mame/machine/archimedes_keyb.h
index 821d929bd07..7acf6ae8d59 100644
--- a/src/mame/machine/archimedes_keyb.h
+++ b/src/mame/machine/archimedes_keyb.h
@@ -36,7 +36,6 @@ protected:
virtual void device_resolve_objects() override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// optional information overrides
virtual const tiny_rom_entry *device_rom_region() const override;
@@ -48,6 +47,8 @@ protected:
virtual void tra_complete() override;
virtual void rcv_complete() override;
+ TIMER_CALLBACK_MEMBER(update_mouse);
+
private:
void tx_w(uint8_t data);
uint8_t mouse_r();
diff --git a/src/mame/machine/asic65.cpp b/src/mame/machine/asic65.cpp
index 52c080ed0a9..32de7641d53 100644
--- a/src/mame/machine/asic65.cpp
+++ b/src/mame/machine/asic65.cpp
@@ -11,8 +11,10 @@
#include <algorithm>
-#define LOG_ASIC 0
+#define LOG_ASIC (1U << 1)
+#define VERBOSE (0)
+#include "logmacro.h"
#define PARAM_WRITE 0
#define COMMAND_WRITE 1
@@ -87,6 +89,7 @@ DEFINE_DEVICE_TYPE(ASIC65, asic65_device, "asic65", "Atari ASIC65")
asic65_device::asic65_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: device_t(mconfig, ASIC65, tag, owner, clock)
+ , m_synced_write_timer(nullptr)
, m_asic65_type(0)
, m_command(0)
, m_yorigin(0x1800)
@@ -101,7 +104,6 @@ asic65_device::asic65_device(const machine_config &mconfig, const char *tag, dev
, m_xflg(0)
, m_68data(0)
, m_tdata(0)
- , m_log(nullptr)
{
std::fill(std::begin(m_param), std::end(m_param), 0);
}
@@ -126,6 +128,8 @@ void asic65_device::device_start()
save_item(NAME(m_68data));
save_item(NAME(m_tdata));
save_item(NAME(m_param));
+
+ m_synced_write_timer = timer_alloc(FUNC(asic65_device::synced_write), this);
}
//-------------------------------------------------
@@ -169,32 +173,22 @@ void asic65_device::reset_line(int state)
*
*************************************/
-void asic65_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(asic65_device::synced_write)
{
- switch (id)
- {
- case TIMER_M68K_ASIC65_DEFERRED_W:
- m_tfull = 1;
- m_cmd = param >> 16;
- m_tdata = param;
- if (m_asic65_type == ASIC65_ROMBASED)
- m_ourcpu->set_input_line(0, ASSERT_LINE);
- break;
- default:
- throw emu_fatalerror("Unknown id in asic65_device::device_timer");
- }
+ m_tfull = 1;
+ m_cmd = param >> 16;
+ m_tdata = param;
+ if (m_asic65_type == ASIC65_ROMBASED)
+ m_ourcpu->set_input_line(0, ASSERT_LINE);
}
void asic65_device::data_w(offs_t offset, u16 data)
{
- /* logging */
- if (LOG_ASIC && !m_log) m_log = fopen("m_log", "w");
-
/* rom-based use a deferred write mechanism */
if (m_asic65_type == ASIC65_ROMBASED)
{
- synchronize(TIMER_M68K_ASIC65_DEFERRED_W, data | (offset << 16));
+ m_synced_write_timer->adjust(attotime::zero, data | (offset << 16));
machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(20));
return;
}
@@ -202,7 +196,7 @@ void asic65_device::data_w(offs_t offset, u16 data)
/* parameters go to offset 0 */
if (!(offset & 1))
{
- if (m_log) fprintf(m_log, " W=%04X", data);
+ LOGMASKED(LOG_ASIC, "%s: Write %04X", machine().describe_context(), data);
/* add to the parameter list, but don't overflow */
m_param[m_param_index++] = data;
@@ -214,7 +208,7 @@ void asic65_device::data_w(offs_t offset, u16 data)
else
{
int command = (data < MAX_COMMANDS) ? command_map[m_asic65_type][data] : OP_UNKNOWN;
- if (m_log) fprintf(m_log, "\n%s %c%04X:", machine().describe_context().c_str(), (command == OP_UNKNOWN) ? '*' : ' ', data);
+ LOGMASKED(LOG_ASIC, "%s: Command %c %04X", machine().describe_context(), (command == OP_UNKNOWN) ? '*' : ' ', data);
/* set the command number and reset the parameter/result indices */
m_command = data;
@@ -452,8 +446,7 @@ u16 asic65_device::read()
}
}
- if (LOG_ASIC && !m_log) m_log = fopen("m_log", "w");
- if (m_log) fprintf(m_log, " (R=%04X)", result);
+ LOGMASKED(LOG_ASIC, "%s: Read %04X", machine().describe_context(), result);
return result;
}
diff --git a/src/mame/machine/asic65.h b/src/mame/machine/asic65.h
index 3c333e8497b..8599620235f 100644
--- a/src/mame/machine/asic65.h
+++ b/src/mame/machine/asic65.h
@@ -55,9 +55,11 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_add_mconfig(machine_config &config) override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(synced_write);
private:
+ emu_timer *m_synced_write_timer;
u8 m_asic65_type;
int m_command;
u16 m_param[32];
@@ -76,8 +78,6 @@ private:
u16 m_68data;
u16 m_tdata;
- FILE * m_log;
-
DECLARE_READ_LINE_MEMBER( get_bio );
};
diff --git a/src/mame/machine/atarigen.cpp b/src/mame/machine/atarigen.cpp
index 604c7c240c6..89b95d021bc 100644
--- a/src/mame/machine/atarigen.cpp
+++ b/src/mame/machine/atarigen.cpp
@@ -22,11 +22,13 @@ atarigen_state::atarigen_state(const machine_config &mconfig, device_type type,
, m_maincpu(*this, "maincpu")
, m_gfxdecode(*this, "gfxdecode")
, m_screen(*this, "screen")
+ , m_unhalt_cpu_timer(nullptr)
{
}
void atarigen_state::machine_start()
{
+ m_unhalt_cpu_timer = timer_alloc(FUNC(atarigen_state::unhalt_cpu), this);
}
@@ -35,15 +37,9 @@ void atarigen_state::machine_reset()
}
-void atarigen_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(atarigen_state::unhalt_cpu)
{
- switch (id)
- {
- // unhalt the CPU
- case TID_UNHALT_CPU:
- m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
- break;
- }
+ m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
}
@@ -70,7 +66,7 @@ void atarigen_state::halt_until_hblank_0(device_t &device, screen_device &screen
// halt and set a timer to wake up
m_maincpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
- timer_set(screen.scan_period() * (hblank - hpos) / width, TID_UNHALT_CPU);
+ m_unhalt_cpu_timer->adjust(screen.scan_period() * (hblank - hpos) / width);
}
diff --git a/src/mame/machine/atarigen.h b/src/mame/machine/atarigen.h
index e03c3e43136..32aafb7b9f6 100644
--- a/src/mame/machine/atarigen.h
+++ b/src/mame/machine/atarigen.h
@@ -28,20 +28,13 @@ protected:
// users must call through to these
virtual void machine_start() override;
virtual void machine_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// video helpers
void halt_until_hblank_0(device_t &device, screen_device &screen);
// misc helpers
void blend_gfx(int gfx0, int gfx1, int mask0, int mask1);
-
- // timer IDs
- enum
- {
- TID_UNHALT_CPU,
- TID_ATARIGEN_LAST
- };
+ TIMER_CALLBACK_MEMBER(unhalt_cpu);
required_device<cpu_device> m_maincpu;
@@ -49,6 +42,8 @@ protected:
optional_device<screen_device> m_screen;
std::unique_ptr<u8[]> m_blended_data;
+
+ emu_timer *m_unhalt_cpu_timer;
};
diff --git a/src/mame/machine/atariscom.cpp b/src/mame/machine/atariscom.cpp
index 4c55b43a1ee..6f282192725 100644
--- a/src/mame/machine/atariscom.cpp
+++ b/src/mame/machine/atariscom.cpp
@@ -60,6 +60,11 @@ void atari_sound_comm_device::device_start()
save_item(NAME(m_sound_to_main_ready));
save_item(NAME(m_main_to_sound_data));
save_item(NAME(m_sound_to_main_data));
+
+ // allocate timers
+ m_sound_reset_timer = timer_alloc(FUNC(atari_sound_comm_device::delayed_sound_reset), this);
+ m_sound_write_timer = timer_alloc(FUNC(atari_sound_comm_device::delayed_sound_write), this);
+ m_6502_write_timer = timer_alloc(FUNC(atari_sound_comm_device::delayed_6502_write), this);
}
@@ -77,37 +82,13 @@ void atari_sound_comm_device::device_reset()
//-------------------------------------------------
-// device_timer: Handle device-specific timer
-// calbacks
-//-------------------------------------------------
-
-void atari_sound_comm_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TID_SOUND_RESET:
- delayed_sound_reset(param);
- break;
-
- case TID_SOUND_WRITE:
- delayed_sound_write(param);
- break;
-
- case TID_6502_WRITE:
- delayed_6502_write(param);
- break;
- }
-}
-
-
-//-------------------------------------------------
// sound_reset_w: Write handler which resets the
// sound CPU in response.
//-------------------------------------------------
void atari_sound_comm_device::sound_reset_w(u16 data)
{
- synchronize(TID_SOUND_RESET);
+ m_sound_reset_timer->adjust(attotime::zero);
}
@@ -120,7 +101,7 @@ void atari_sound_comm_device::sound_reset_w(u16 data)
void atari_sound_comm_device::main_command_w(u8 data)
{
- synchronize(TID_SOUND_WRITE, data);
+ m_sound_write_timer->adjust(attotime::zero, data);
}
@@ -149,7 +130,7 @@ u8 atari_sound_comm_device::main_response_r()
void atari_sound_comm_device::sound_response_w(u8 data)
{
- synchronize(TID_6502_WRITE, data);
+ m_6502_write_timer->adjust(attotime::zero, data);
}
@@ -175,7 +156,7 @@ u8 atari_sound_comm_device::sound_command_r()
// reset command between the two CPUs.
//-------------------------------------------------
-void atari_sound_comm_device::delayed_sound_reset(int param)
+TIMER_CALLBACK_MEMBER(atari_sound_comm_device::delayed_sound_reset)
{
// unhalt and reset the sound CPU
if (param == 0)
@@ -199,14 +180,14 @@ void atari_sound_comm_device::delayed_sound_reset(int param)
// from the main CPU to the sound CPU.
//-------------------------------------------------
-void atari_sound_comm_device::delayed_sound_write(int data)
+TIMER_CALLBACK_MEMBER(atari_sound_comm_device::delayed_sound_write)
{
// warn if we missed something
if (m_main_to_sound_ready)
logerror("Missed command from 680x0\n");
// set up the states and signal an NMI to the sound CPU
- m_main_to_sound_data = data;
+ m_main_to_sound_data = param;
m_main_to_sound_ready = true;
m_sound_cpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
@@ -221,14 +202,14 @@ void atari_sound_comm_device::delayed_sound_write(int data)
// from the sound CPU to the main CPU.
//-------------------------------------------------
-void atari_sound_comm_device::delayed_6502_write(int data)
+TIMER_CALLBACK_MEMBER(atari_sound_comm_device::delayed_6502_write)
{
// warn if we missed something
if (m_sound_to_main_ready)
logerror("Missed result from 6502\n");
// set up the states and signal the sound interrupt to the main CPU
- m_sound_to_main_data = data;
+ m_sound_to_main_data = param;
m_sound_to_main_ready = true;
m_main_int_cb(ASSERT_LINE);
}
diff --git a/src/mame/machine/atariscom.h b/src/mame/machine/atariscom.h
index abc0f8931e8..39633550b75 100644
--- a/src/mame/machine/atariscom.h
+++ b/src/mame/machine/atariscom.h
@@ -56,35 +56,29 @@ public:
void sound_reset_w(u16 data = 0);
// sound cpu accessors
- void sound_cpu_reset() { synchronize(TID_SOUND_RESET, 1); }
+ void sound_cpu_reset() { m_sound_reset_timer->adjust(attotime::zero, 1); }
void sound_response_w(u8 data);
u8 sound_command_r();
protected:
// sound I/O helpers
- void delayed_sound_reset(int param);
- void delayed_sound_write(int data);
- void delayed_6502_write(int data);
+ TIMER_CALLBACK_MEMBER(delayed_sound_reset);
+ TIMER_CALLBACK_MEMBER(delayed_sound_write);
+ TIMER_CALLBACK_MEMBER(delayed_6502_write);
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
private:
- // timer IDs
- enum
- {
- TID_SOUND_RESET,
- TID_SOUND_WRITE,
- TID_6502_WRITE
- };
-
// configuration state
devcb_write_line m_main_int_cb;
// internal state
required_device<cpu_device> m_sound_cpu;
+ emu_timer *m_sound_reset_timer;
+ emu_timer *m_sound_write_timer;
+ emu_timer *m_6502_write_timer;
bool m_main_to_sound_ready;
bool m_sound_to_main_ready;
u8 m_main_to_sound_data;
diff --git a/src/mame/machine/ataristb.cpp b/src/mame/machine/ataristb.cpp
index 483a11f0410..e1daa535a5d 100644
--- a/src/mame/machine/ataristb.cpp
+++ b/src/mame/machine/ataristb.cpp
@@ -526,7 +526,7 @@ void st_blitter_device::device_resolve_objects()
void st_blitter_device::device_start()
{
- m_blitter_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(st_blitter_device::blitter_tick), this));
+ m_blitter_timer = timer_alloc(FUNC(st_blitter_device::blitter_tick), this);
// register for state saving
save_item(NAME(m_halftone));
diff --git a/src/mame/machine/balsente.cpp b/src/mame/machine/balsente.cpp
index 4724cbec2fa..6889918cd42 100644
--- a/src/mame/machine/balsente.cpp
+++ b/src/mame/machine/balsente.cpp
@@ -37,7 +37,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(balsente_state::interrupt_timer)
m_maincpu->set_input_line(M6809_IRQ_LINE, ASSERT_LINE);
/* it will turn off on the next HBLANK */
- machine().scheduler().timer_set(m_screen->time_until_pos(param, BALSENTE_HBSTART), timer_expired_delegate(FUNC(balsente_state::irq_off),this));
+ m_irq_off_timer->adjust(m_screen->time_until_pos(param, BALSENTE_HBSTART));
/* if this is Grudge Match, update the steering */
if (m_grudge_steering_result & 0x80)
@@ -78,6 +78,9 @@ void balsente_state::machine_start()
save_item(NAME(m_spiker_expand_bits));
save_item(NAME(m_grudge_steering_result));
save_item(NAME(m_grudge_last_steering));
+
+ m_irq_off_timer = timer_alloc(FUNC(balsente_state::irq_off), this);
+ m_adc_timer = timer_alloc(FUNC(balsente_state::adc_finished), this);
}
@@ -100,6 +103,9 @@ void balsente_state::machine_reset()
/* start a timer to generate interrupts */
m_scanline_timer->adjust(m_screen->time_until_pos(0));
+
+ m_irq_off_timer->adjust(attotime::never);
+ m_adc_timer->adjust(attotime::never);
}
@@ -318,7 +324,7 @@ void balsente_state::adc_select_w(offs_t offset, uint8_t data)
/* set a timer to go off and read the value after 50us */
/* it's important that we do this for Mini Golf */
logerror("adc_select %d\n", offset & 7);
- machine().scheduler().timer_set(attotime::from_usec(50), timer_expired_delegate(FUNC(balsente_state::adc_finished),this), offset & 7);
+ m_adc_timer->adjust(attotime::from_usec(50), offset & 7);
}
uint8_t balsente_state::teamht_extra_r()
diff --git a/src/mame/machine/bbc.cpp b/src/mame/machine/bbc.cpp
index 3cd5f5f24c1..3bc221a57c1 100644
--- a/src/mame/machine/bbc.cpp
+++ b/src/mame/machine/bbc.cpp
@@ -1374,8 +1374,8 @@ void bbc_state::init_bbc()
m_nr_high_tones = 0;
m_serproc_data = 0;
m_cass_out_enabled = 0;
- m_tape_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(bbc_state::tape_timer_cb), this));
- m_reset_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(bbc_state::reset_timer_cb), this));
+ m_tape_timer = timer_alloc(FUNC(bbc_state::tape_timer_cb), this);
+ m_reset_timer = timer_alloc(FUNC(bbc_state::reset_timer_cb), this);
/* vertical sync pulse from video circuit */
m_via6522_0->write_ca1(1);
diff --git a/src/mame/machine/bebox.cpp b/src/mame/machine/bebox.cpp
index 97998b73473..dda04ddb2b0 100644
--- a/src/mame/machine/bebox.cpp
+++ b/src/mame/machine/bebox.cpp
@@ -726,18 +726,6 @@ void bebox_state::scsi53c810_pci_write(int function, int offset, uint32_t data,
}
-void bebox_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_GET_DEVICES:
- break;
- default:
- throw emu_fatalerror("Unknown id in bebox_state::device_timer");
- }
-}
-
-
/*************************************
*
* Driver main
@@ -746,8 +734,6 @@ void bebox_state::device_timer(emu_timer &timer, device_timer_id id, int param)
void bebox_state::machine_reset()
{
- timer_set(attotime::zero, TIMER_GET_DEVICES);
-
m_ppc[0]->set_input_line(INPUT_LINE_RESET, CLEAR_LINE);
m_ppc[1]->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
diff --git a/src/mame/machine/bk.cpp b/src/mame/machine/bk.cpp
index d9c5a7c6907..9a5ab095316 100644
--- a/src/mame/machine/bk.cpp
+++ b/src/mame/machine/bk.cpp
@@ -63,7 +63,7 @@ void bk_state::machine_start()
m_maincpu->set_input_line(t11_device::VEC_LINE, ASSERT_LINE);
- m_kbd_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(bk_state::keyboard_callback), this));
+ m_kbd_timer = timer_alloc(FUNC(bk_state::keyboard_callback), this);
m_kbd_timer->adjust(attotime::from_hz(2400), 0, attotime::from_hz(2400));
}
diff --git a/src/mame/machine/bublbobl.cpp b/src/mame/machine/bublbobl.cpp
index 59784418ca3..659bcda1027 100644
--- a/src/mame/machine/bublbobl.cpp
+++ b/src/mame/machine/bublbobl.cpp
@@ -127,16 +127,9 @@ uint8_t bublbobl_state::tokiob_mcu_r()
}
-void bublbobl_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(bublbobl_state::irq_ack)
{
- switch (id)
- {
- case TIMER_M68705_IRQ_ACK:
- m_mcu->set_input_line(0, CLEAR_LINE);
- break;
- default:
- throw emu_fatalerror("Unknown id in bublbobl_state::device_timer");
- }
+ m_mcu->set_input_line(0, CLEAR_LINE);
}
void bublbobl_state::bublbobl_soundcpu_reset_w(uint8_t data)
@@ -331,7 +324,7 @@ uint8_t bublbobl_state::boblbobl_ic43_b_r(offs_t offset)
INTERRUPT_GEN_MEMBER(bub68705_state::bublbobl_m68705_interrupt)
{
device.execute().set_input_line(M68705_IRQ_LINE, ASSERT_LINE);
- timer_set(attotime::from_msec(1000/60), TIMER_M68705_IRQ_ACK); /* TODO: understand how this is ack'ed */
+ m_irq_ack_timer->adjust(attotime::from_msec(1000/60)); /* TODO: understand how this is ack'ed */
}
diff --git a/src/mame/machine/cdicdic.cpp b/src/mame/machine/cdicdic.cpp
index 6786f3c69b4..95b181e1475 100644
--- a/src/mame/machine/cdicdic.cpp
+++ b/src/mame/machine/cdicdic.cpp
@@ -1527,10 +1527,10 @@ void cdicdic_device::device_start()
save_item(NAME(m_xa_last));
- m_audio_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(cdicdic_device::audio_tick), this));
+ m_audio_timer = timer_alloc(FUNC(cdicdic_device::audio_tick), this);
m_audio_timer->adjust(attotime::never);
- m_sector_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(cdicdic_device::sector_tick), this));
+ m_sector_timer = timer_alloc(FUNC(cdicdic_device::sector_tick), this);
m_sector_timer->adjust(attotime::never);
}
diff --git a/src/mame/machine/cdislavehle.cpp b/src/mame/machine/cdislavehle.cpp
index 4c103f24a37..21812cc85f5 100644
--- a/src/mame/machine/cdislavehle.cpp
+++ b/src/mame/machine/cdislavehle.cpp
@@ -471,7 +471,7 @@ void cdislave_hle_device::device_start()
save_item(NAME(m_device_mouse_x));
save_item(NAME(m_device_mouse_y));
- m_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(cdislave_hle_device::trigger_readback_int), this));
+ m_interrupt_timer = timer_alloc(FUNC(cdislave_hle_device::trigger_readback_int), this);
m_interrupt_timer->adjust(attotime::never);
}
diff --git a/src/mame/machine/cedar_magnet_board.cpp b/src/mame/machine/cedar_magnet_board.cpp
index 2cffb11abb3..f4dc1c723af 100644
--- a/src/mame/machine/cedar_magnet_board.cpp
+++ b/src/mame/machine/cedar_magnet_board.cpp
@@ -82,8 +82,8 @@ void cedar_magnet_board_interface::interface_pre_reset()
void cedar_magnet_board_interface::interface_pre_start()
{
- m_halt_assert_timer = device().machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(cedar_magnet_board_interface::halt_assert_callback), this));
- m_halt_clear_timer = device().machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(cedar_magnet_board_interface::halt_clear_callback), this));
- m_reset_assert_timer = device().machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(cedar_magnet_board_interface::reset_assert_callback), this));
- m_reset_clear_timer = device().machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(cedar_magnet_board_interface::reset_clear_callback), this));
+ m_halt_assert_timer = device().timer_alloc(FUNC(cedar_magnet_board_interface::halt_assert_callback), this);
+ m_halt_clear_timer = device().timer_alloc(FUNC(cedar_magnet_board_interface::halt_clear_callback), this);
+ m_reset_assert_timer = device().timer_alloc(FUNC(cedar_magnet_board_interface::reset_assert_callback), this);
+ m_reset_clear_timer = device().timer_alloc(FUNC(cedar_magnet_board_interface::reset_clear_callback), this);
}
diff --git a/src/mame/machine/cmi_mkbd.cpp b/src/mame/machine/cmi_mkbd.cpp
index 126b8da9e93..f4b3a2a987a 100644
--- a/src/mame/machine/cmi_mkbd.cpp
+++ b/src/mame/machine/cmi_mkbd.cpp
@@ -73,22 +73,17 @@ void cmi_music_keyboard_device::device_resolve_objects()
void cmi_music_keyboard_device::device_start()
{
- m_cmi10_scnd_timer = timer_alloc(TIMER_CMI10_SCND);
-
+ m_cmi10_scnd_timer = timer_alloc(FUNC(cmi_music_keyboard_device::scnd_update), this);
m_cmi10_scnd_timer->adjust(attotime::from_hz(4000000 / 4 / 2048 / 2), 0, attotime::from_hz(4000000 / 4 / 2048 / 2));
+
m_scnd = 0;
}
-void cmi_music_keyboard_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(cmi_music_keyboard_device::scnd_update)
{
- switch (id)
- {
- case TIMER_CMI10_SCND:
- m_cmi10_pia_u20->ca1_w(m_scnd);
- m_scnd ^= 1;
- m_cmi10_pia_u21->ca1_w(m_scnd);
- break;
- }
+ m_cmi10_pia_u20->ca1_w(m_scnd);
+ m_scnd ^= 1;
+ m_cmi10_pia_u21->ca1_w(m_scnd);
}
/*
diff --git a/src/mame/machine/cmi_mkbd.h b/src/mame/machine/cmi_mkbd.h
index e1ab74bd6ac..8891f0cd090 100644
--- a/src/mame/machine/cmi_mkbd.h
+++ b/src/mame/machine/cmi_mkbd.h
@@ -17,8 +17,6 @@
class cmi_music_keyboard_device : public device_t
{
- static const device_timer_id TIMER_CMI10_SCND = 0;
-
public:
cmi_music_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0);
@@ -38,7 +36,8 @@ protected:
virtual ioport_constructor device_input_ports() const override;
virtual void device_resolve_objects() override;
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(scnd_update);
private:
void cmi10_u20_a_w(u8 data);
diff --git a/src/mame/machine/coco.cpp b/src/mame/machine/coco.cpp
index ee2d19a1b62..c2de273d41e 100644
--- a/src/mame/machine/coco.cpp
+++ b/src/mame/machine/coco.cpp
@@ -137,9 +137,9 @@ void coco_state::device_start()
DIECOM_LIGHTGUN_LX_TAG, DIECOM_LIGHTGUN_LY_TAG, DIECOM_LIGHTGUN_BUTTONS_TAG);
// timers
- m_hiresjoy_transition_timer[0] = timer_alloc(TIMER_HIRES_JOYSTICK_X);
- m_hiresjoy_transition_timer[1] = timer_alloc(TIMER_HIRES_JOYSTICK_Y);
- m_diecom_lightgun_timer = timer_alloc(TIMER_DIECOM_LIGHTGUN);
+ m_hiresjoy_transition_timer[0] = timer_alloc(FUNC(coco_state::joystick_update), this);
+ m_hiresjoy_transition_timer[1] = timer_alloc(FUNC(coco_state::joystick_update), this);
+ m_diecom_lightgun_timer = timer_alloc(FUNC(coco_state::diecom_lightgun_hit), this);
// cart slot
m_cococart->set_cart_base_update(cococart_base_update_delegate(&coco_state::update_cart_base, this));
@@ -187,21 +187,18 @@ void coco_state::device_reset()
//-------------------------------------------------
-// device_timer
+// timer callbacks
//-------------------------------------------------
-void coco_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(coco_state::diecom_lightgun_hit)
{
- switch(id)
- {
- case TIMER_DIECOM_LIGHTGUN:
- m_dclg_output_h |= 0x02;
- [[fallthrough]];
- case TIMER_HIRES_JOYSTICK_X:
- case TIMER_HIRES_JOYSTICK_Y:
- poll_keyboard();
- break;
- }
+ m_dclg_output_h |= 0x02;
+ poll_keyboard();
+}
+
+TIMER_CALLBACK_MEMBER(coco_state::joystick_update)
+{
+ poll_keyboard();
}
diff --git a/src/mame/machine/cuda.cpp b/src/mame/machine/cuda.cpp
index 39cad3032c0..d91112fe5fb 100644
--- a/src/mame/machine/cuda.cpp
+++ b/src/mame/machine/cuda.cpp
@@ -395,8 +395,8 @@ void cuda_device::device_start()
write_via_clock.resolve_safe();
write_via_data.resolve_safe();
- m_timer = timer_alloc(0);
- m_prog_timer = timer_alloc(1);
+ m_timer = timer_alloc(FUNC(cuda_device::seconds_tick), this);
+ m_prog_timer = timer_alloc(FUNC(cuda_device::timer_tick), this);
save_item(NAME(ddrs[0]));
save_item(NAME(ddrs[1]));
save_item(NAME(ddrs[2]));
@@ -457,37 +457,35 @@ void cuda_device::device_reset()
last_adb = 0;
}
-void cuda_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(cuda_device::seconds_tick)
{
- if (id == 0)
+ onesec |= 0x40;
+
+ if (onesec & 0x10)
{
- onesec |= 0x40;
+ m_maincpu->set_input_line(M68HC05EG_INT_CPI, ASSERT_LINE);
+ }
+}
- if (onesec & 0x10)
- {
- m_maincpu->set_input_line(M68HC05EG_INT_CPI, ASSERT_LINE);
- }
+TIMER_CALLBACK_MEMBER(cuda_device::timer_tick)
+{
+ timer_ctrl |= 0x80;
+
+ if (timer_ctrl & 0x20)
+ {
+ m_maincpu->set_input_line(M68HC05EG_INT_TIMER, ASSERT_LINE);
}
- else
+
+ ripple_counter--;
+ if (ripple_counter <= 0)
{
- timer_ctrl |= 0x80;
+ timer_ctrl |= 0x40;
- if (timer_ctrl & 0x20)
- {
- m_maincpu->set_input_line(M68HC05EG_INT_TIMER, ASSERT_LINE);
- }
+ ripple_counter = timer_counter;
- ripple_counter--;
- if (ripple_counter <= 0)
+ if (timer_ctrl & 0x10)
{
- timer_ctrl |= 0x40;
-
- ripple_counter = timer_counter;
-
- if (timer_ctrl & 0x10)
- {
- m_maincpu->set_input_line(M68HC05EG_INT_TIMER, ASSERT_LINE);
- }
+ m_maincpu->set_input_line(M68HC05EG_INT_TIMER, ASSERT_LINE);
}
}
}
diff --git a/src/mame/machine/cuda.h b/src/mame/machine/cuda.h
index db22197f20b..b6ccf42a755 100644
--- a/src/mame/machine/cuda.h
+++ b/src/mame/machine/cuda.h
@@ -85,9 +85,10 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
- required_device<cpu_device> m_maincpu;
+ TIMER_CALLBACK_MEMBER(seconds_tick);
+ TIMER_CALLBACK_MEMBER(timer_tick);
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ required_device<cpu_device> m_maincpu;
private:
uint8_t ddrs[3]{};
diff --git a/src/mame/machine/dc.cpp b/src/mame/machine/dc.cpp
index 0698f187d3b..c0faebb7673 100644
--- a/src/mame/machine/dc.cpp
+++ b/src/mame/machine/dc.cpp
@@ -407,7 +407,7 @@ void dc_state::dc_sysctrl_w(offs_t offset, uint64_t data, uint64_t mem_mask)
dc_sysctrl_regs[SB_C2DSTAT]=address+ddtdata.length;
/* TODO: timing is a guess */
- machine().scheduler().timer_set(m_maincpu->cycles_to_attotime(ddtdata.length/4), timer_expired_delegate(FUNC(dc_state::ch2_dma_irq),this));
+ m_ch2_dma_irq_timer->adjust(m_maincpu->cycles_to_attotime(ddtdata.length/4));
}
break;
@@ -548,6 +548,8 @@ void dc_state::machine_start()
// save states
save_pointer(NAME(dc_sysctrl_regs), 0x200/4);
+
+ m_ch2_dma_irq_timer = timer_alloc(FUNC(dc_state::ch2_dma_irq), this);
}
void dc_state::machine_reset()
@@ -559,6 +561,8 @@ void dc_state::machine_reset()
memset(dc_sysctrl_regs, 0, sizeof(dc_sysctrl_regs));
dc_sysctrl_regs[SB_SBREV] = 0x0b;
+
+ m_ch2_dma_irq_timer->adjust(attotime::never);
}
uint32_t dc_state::dc_aica_reg_r(offs_t offset, uint32_t mem_mask)
diff --git a/src/mame/machine/dc_g2if.cpp b/src/mame/machine/dc_g2if.cpp
index a75bf4b0f37..9929a2844fc 100644
--- a/src/mame/machine/dc_g2if.cpp
+++ b/src/mame/machine/dc_g2if.cpp
@@ -74,7 +74,7 @@ void dc_g2if_device::device_start()
{
for (int i = 0; i < 4; i++)
{
- m_dma[i].end_timer = timer_alloc(i);
+ m_dma[i].end_timer = timer_alloc(FUNC(dc_g2if_device::dma_end_tick), this);
}
m_int_w.resolve();
@@ -121,13 +121,13 @@ void dc_g2if_device::device_reset()
}
}
-void dc_g2if_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(dc_g2if_device::dma_end_tick)
{
- u8 channel = (u8)id;
- bool dma_result = (param == 1);
+ u8 channel = (u8)(param >> 1);
+ bool dma_result = (param & 1);
m_dma[channel].in_progress = false;
m_dma[channel].start = false;
- LOGDMAEND("DMA%d %s\n", id, dma_result ? "normal end" : "overflow error");
+ LOGDMAEND("DMA%d %s\n", channel, dma_result ? "normal end" : "overflow error");
if (dma_result)
m_int_w(channel, 1);
@@ -510,7 +510,7 @@ void dc_g2if_device::dma_execute(u8 channel)
if (m_dma[channel].mode == true)
m_dma[channel].enable = false;
- m_dma[channel].end_timer->adjust(dma_time, dma_result);
+ m_dma[channel].end_timer->adjust(dma_time, (channel << 1) | (dma_result ? 1 : 0));
}
/*
diff --git a/src/mame/machine/dc_g2if.h b/src/mame/machine/dc_g2if.h
index 5cf0888b563..c598307b441 100644
--- a/src/mame/machine/dc_g2if.h
+++ b/src/mame/machine/dc_g2if.h
@@ -35,7 +35,8 @@ protected:
//virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(dma_end_tick);
private:
required_address_space m_host_space;
diff --git a/src/mame/machine/dccons.cpp b/src/mame/machine/dccons.cpp
index ba8ed4ba1c2..07c1a95afde 100644
--- a/src/mame/machine/dccons.cpp
+++ b/src/mame/machine/dccons.cpp
@@ -104,9 +104,7 @@ TIMER_CALLBACK_MEMBER(dc_cons_state::atapi_xfer_end )
void dc_cons_state::dreamcast_atapi_init()
{
- atapi_timer = machine().scheduler().timer_alloc(
- timer_expired_delegate(FUNC(dc_cons_state::atapi_xfer_end), this)
- );
+ atapi_timer = timer_alloc(FUNC(dc_cons_state::atapi_xfer_end), this);
atapi_timer->adjust(attotime::never);
save_item(NAME(atapi_xferlen));
save_item(NAME(atapi_xferbase));
diff --git a/src/mame/machine/dec_lk201.cpp b/src/mame/machine/dec_lk201.cpp
index 4bf0ad985bc..1e1a87a3011 100644
--- a/src/mame/machine/dec_lk201.cpp
+++ b/src/mame/machine/dec_lk201.cpp
@@ -523,10 +523,10 @@ lk201_device::lk201_device(const machine_config &mconfig, const char *tag, devic
void lk201_device::device_start()
{
- m_count = timer_alloc(1);
+ m_count = timer_alloc(FUNC(lk201_device::timer_irq), this);
m_tx_handler.resolve_safe();
- m_beeper = timer_alloc(2);
+ m_beeper = timer_alloc(FUNC(lk201_device::beeper_off), this);
m_led_wait.resolve();
m_led_compose.resolve();
@@ -572,27 +572,19 @@ void lk201_device::device_reset()
m_led_hold = 0; // led11
}
-void lk201_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(lk201_device::timer_irq)
{
- switch (id)
- {
- case 1:
- m_timer.tsr |= TSR_OCFL;
-
- if ((m_timer.tcr & TCR_OCIE) && (m_timer.tsr & TSR_OCFL))
- m_maincpu->set_input_line(M68HC05EG_INT_TIMER, ASSERT_LINE);
- break;
+ m_timer.tsr |= TSR_OCFL;
- case 2:
- m_speaker->set_output_gain(0, 0);
- m_speaker->set_state(0);
- break;
-
- default:
- break;
- }
+ if ((m_timer.tcr & TCR_OCIE) && (m_timer.tsr & TSR_OCFL))
+ m_maincpu->set_input_line(M68HC05EG_INT_TIMER, ASSERT_LINE);
}
+TIMER_CALLBACK_MEMBER(lk201_device::beeper_off)
+{
+ m_speaker->set_output_gain(0, 0);
+ m_speaker->set_state(0);
+}
void lk201_device::rcv_complete()
{
diff --git a/src/mame/machine/dec_lk201.h b/src/mame/machine/dec_lk201.h
index 59881d309a4..9ed6d7c5368 100644
--- a/src/mame/machine/dec_lk201.h
+++ b/src/mame/machine/dec_lk201.h
@@ -67,13 +67,15 @@ protected:
virtual ioport_constructor device_input_ports() const override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_serial overrides
virtual void rcv_complete() override; // Rx completed receiving byte
virtual void tra_complete() override; // Tx completed sending byte
virtual void tra_callback() override; // Tx send bit
+ TIMER_CALLBACK_MEMBER(timer_irq);
+ TIMER_CALLBACK_MEMBER(beeper_off);
+
private:
uint8_t ddrs[3];
uint8_t ports[3];
diff --git a/src/mame/machine/deco_irq.cpp b/src/mame/machine/deco_irq.cpp
index ce4bac5c0a2..f164e481444 100644
--- a/src/mame/machine/deco_irq.cpp
+++ b/src/mame/machine/deco_irq.cpp
@@ -74,7 +74,7 @@ void deco_irq_device::device_start()
m_vblank_irq_cb.resolve_safe();
// allocate scanline timer and start it
- m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(deco_irq_device::scanline_callback), this));
+ m_scanline_timer = timer_alloc(FUNC(deco_irq_device::scanline_callback), this);
m_scanline_timer->adjust(m_screen->time_until_pos(0));
// register for save states
diff --git a/src/mame/machine/decocass_tape.cpp b/src/mame/machine/decocass_tape.cpp
index a42c44639e6..1dc296ae3f4 100644
--- a/src/mame/machine/decocass_tape.cpp
+++ b/src/mame/machine/decocass_tape.cpp
@@ -84,7 +84,7 @@ void decocass_tape_device::device_start()
int curblock, offs, numblocks;
/* fetch the data pointer */
- m_tape_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(decocass_tape_device::tape_clock_callback), this));
+ m_tape_timer = timer_alloc(FUNC(decocass_tape_device::tape_clock_callback), this);
if (!m_tape_data.found())
return;
diff --git a/src/mame/machine/decopincpu.cpp b/src/mame/machine/decopincpu.cpp
index 138c8b683c5..ee86912bc33 100644
--- a/src/mame/machine/decopincpu.cpp
+++ b/src/mame/machine/decopincpu.cpp
@@ -56,28 +56,23 @@ static INPUT_PORTS_START( decocpu1 )
PORT_CONFSETTING( 0x10, "English" )
INPUT_PORTS_END
-void decocpu_type1_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(decocpu_type1_device::irq_trigger)
{
- switch(id)
+ if (param == 1)
{
- case TIMER_IRQ:
- if(param == 1)
- {
- m_cpu->set_input_line(M6808_IRQ_LINE, ASSERT_LINE);
- m_irq_timer->adjust(attotime::from_ticks(32,E_CLOCK),0);
- m_irq_active = true;
- m_pia28->ca1_w(BIT(ioport("DIAGS")->read(), 2));
- m_pia28->cb1_w(BIT(ioport("DIAGS")->read(), 3));
- }
- else
- {
- m_cpu->set_input_line(M6808_IRQ_LINE, CLEAR_LINE);
- m_irq_timer->adjust(attotime::from_ticks(S11_IRQ_CYCLES,E_CLOCK),1);
- m_irq_active = false;
- m_pia28->ca1_w(1);
- m_pia28->cb1_w(1);
- }
- break;
+ m_cpu->set_input_line(M6808_IRQ_LINE, ASSERT_LINE);
+ m_irq_timer->adjust(attotime::from_ticks(32, E_CLOCK), 0);
+ m_irq_active = true;
+ m_pia28->ca1_w(BIT(m_diags->read(), 2));
+ m_pia28->cb1_w(BIT(m_diags->read(), 3));
+ }
+ else
+ {
+ m_cpu->set_input_line(M6808_IRQ_LINE, CLEAR_LINE);
+ m_irq_timer->adjust(attotime::from_ticks(S11_IRQ_CYCLES, E_CLOCK), 1);
+ m_irq_active = false;
+ m_pia28->ca1_w(1);
+ m_pia28->cb1_w(1);
}
}
@@ -90,10 +85,10 @@ INPUT_CHANGED_MEMBER( decocpu_type1_device::main_nmi )
WRITE_LINE_MEMBER(decocpu_type1_device::cpu_pia_irq)
{
- if(state == CLEAR_LINE)
+ if (state == CLEAR_LINE)
{
// restart IRQ timer
- m_irq_timer->adjust(attotime::from_ticks(S11_IRQ_CYCLES,E_CLOCK),1);
+ m_irq_timer->adjust(attotime::from_ticks(S11_IRQ_CYCLES, E_CLOCK), 1);
m_irq_active = false;
}
else
@@ -105,93 +100,93 @@ WRITE_LINE_MEMBER(decocpu_type1_device::cpu_pia_irq)
}
}
-void decocpu_type1_device::lamp0_w(uint8_t data)
+void decocpu_type1_device::lamp0_w(u8 data)
{
m_cpu->set_input_line(M6808_IRQ_LINE, CLEAR_LINE);
m_lamp_data = data ^ 0xff;
- m_write_lamp(0,data,0xff);
+ m_write_lamp(0, data, 0xff);
}
-void decocpu_type1_device::lamp1_w(uint8_t data)
+void decocpu_type1_device::lamp1_w(u8 data)
{
for (u8 i = 0; i < 8; i++)
if (BIT(data, i))
for (u8 j = 0; j < 8; j++)
- m_io_outputs[22U+i*8U+j] = BIT(m_lamp_data, j);
+ m_io_outputs[22 + i * 8 + j] = BIT(m_lamp_data, j);
- m_write_lamp(1,data,0xff);
+ m_write_lamp(1, data, 0xff);
}
-uint8_t decocpu_type1_device::display_strobe_r()
+u8 decocpu_type1_device::display_strobe_r()
{
- uint8_t ret = 0x80;
+ u8 ret = 0x80;
- if(BIT(ioport("DIAGS")->read(), 4)) // W7 Jumper
+ if (BIT(m_diags->read(), 4)) // W7 Jumper
ret &= ~0x80;
return ret | (m_read_display(0) & 0x7f);
}
-void decocpu_type1_device::display_strobe_w(uint8_t data)
+void decocpu_type1_device::display_strobe_w(u8 data)
{
- m_write_display(0,data,0xff);
+ m_write_display(0, data, 0xff);
}
-void decocpu_type1_device::display_out1_w(uint8_t data)
+void decocpu_type1_device::display_out1_w(u8 data)
{
- m_write_display(1,data,0xff);
+ m_write_display(1, data, 0xff);
}
-void decocpu_type1_device::display_out2_w(uint8_t data)
+void decocpu_type1_device::display_out2_w(u8 data)
{
- m_write_display(2,data,0xff);
+ m_write_display(2, data, 0xff);
}
-void decocpu_type1_device::display_out3_w(uint8_t data)
+void decocpu_type1_device::display_out3_w(u8 data)
{
- m_write_display(3,data,0xff);
+ m_write_display(3, data, 0xff);
}
-uint8_t decocpu_type1_device::display_in3_r()
+u8 decocpu_type1_device::display_in3_r()
{
return m_read_display(3);
}
-void decocpu_type1_device::switch_w(uint8_t data)
+void decocpu_type1_device::switch_w(u8 data)
{
- m_write_switch(0,data,0xff);
+ m_write_switch(0, data, 0xff);
}
-uint8_t decocpu_type1_device::switch_r()
+u8 decocpu_type1_device::switch_r()
{
return m_read_switch(0);
}
-uint8_t decocpu_type1_device::dmdstatus_r()
+u8 decocpu_type1_device::dmdstatus_r()
{
return m_read_dmdstatus(0);
}
-void decocpu_type1_device::display_out4_w(uint8_t data)
+void decocpu_type1_device::display_out4_w(u8 data)
{
- m_write_display(4,data,0xff);
+ m_write_display(4, data, 0xff);
}
-void decocpu_type1_device::sound_w(uint8_t data)
+void decocpu_type1_device::sound_w(u8 data)
{
- m_write_soundlatch(0,data,0xff);
+ m_write_soundlatch(0, data, 0xff);
}
-void decocpu_type1_device::solenoid1_w(uint8_t data)
+void decocpu_type1_device::solenoid1_w(u8 data)
{
- m_write_solenoid(1,data,0xff);
+ m_write_solenoid(1, data, 0xff);
for (u8 i = 0; i < 8; i++)
- m_io_outputs[i+8] = BIT(data, i);
+ m_io_outputs[i + 8] = BIT(data, i);
}
-void decocpu_type1_device::solenoid0_w(uint8_t data)
+void decocpu_type1_device::solenoid0_w(u8 data)
{
- m_write_solenoid(0,data,0xff);
+ m_write_solenoid(0, data, 0xff);
for (u8 i = 0; i < 8; i++)
m_io_outputs[i] = BIT(data, i);
}
@@ -257,11 +252,12 @@ ioport_constructor decocpu_type1_device::device_input_ports() const
return INPUT_PORTS_NAME( decocpu1 );
}
-decocpu_type1_device::decocpu_type1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+decocpu_type1_device::decocpu_type1_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: decocpu_type1_device(mconfig, DECOCPU1, tag, owner, clock)
-{}
+{
+}
-decocpu_type1_device::decocpu_type1_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
+decocpu_type1_device::decocpu_type1_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock)
: device_t(mconfig, type, tag, owner, clock)
, m_cpu(*this,"maincpu")
, m_pia21(*this, "pia21")
@@ -271,6 +267,7 @@ decocpu_type1_device::decocpu_type1_device(const machine_config &mconfig, device
, m_pia30(*this, "pia30")
, m_pia34(*this, "pia34")
, m_rom(*this, finder_base::DUMMY_TAG)
+ , m_diags(*this, "DIAGS")
, m_read_display(*this)
, m_write_display(*this)
, m_read_dmdstatus(*this)
@@ -280,7 +277,8 @@ decocpu_type1_device::decocpu_type1_device(const machine_config &mconfig, device
, m_write_lamp(*this)
, m_write_solenoid(*this)
, m_io_outputs(*this, "out%d", 0U)
-{}
+{
+}
void decocpu_type1_device::device_start()
{
@@ -294,23 +292,25 @@ void decocpu_type1_device::device_start()
m_write_lamp.resolve_safe();
m_write_solenoid.resolve_safe();
- m_irq_timer = timer_alloc(TIMER_IRQ);
- m_irq_timer->adjust(attotime::from_ticks(S11_IRQ_CYCLES,E_CLOCK),1);
+ m_irq_timer = timer_alloc(FUNC(decocpu_type1_device::irq_trigger), this);
+ m_irq_timer->adjust(attotime::from_ticks(S11_IRQ_CYCLES, E_CLOCK), 1);
m_irq_active = false;
- m_cpu->space(AS_PROGRAM).install_rom(0x4000,0xffff,&m_rom[0x4000]);
+ m_cpu->space(AS_PROGRAM).install_rom(0x4000, 0xffff, &m_rom[0x4000]);
m_io_outputs.resolve();
save_item(NAME(m_lamp_data));
}
-decocpu_type2_device::decocpu_type2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+decocpu_type2_device::decocpu_type2_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: decocpu_type2_device(mconfig, DECOCPU2, tag, owner, clock)
-{}
+{
+}
-decocpu_type2_device::decocpu_type2_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
+decocpu_type2_device::decocpu_type2_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock)
: decocpu_type1_device(mconfig, type, tag, owner, clock)
-{}
+{
+}
void decocpu_type2_device::device_add_mconfig(machine_config &config)
{
@@ -325,22 +325,25 @@ void decocpu_type2_device::device_start()
decocpu_type1_device::device_start();
}
-decocpu_type3_device::decocpu_type3_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+decocpu_type3_device::decocpu_type3_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: decocpu_type3_device(mconfig, DECOCPU3, tag, owner, clock)
-{}
+{
+}
-decocpu_type3_device::decocpu_type3_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
+decocpu_type3_device::decocpu_type3_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock)
: decocpu_type2_device(mconfig, type, tag, owner, clock)
-{}
+{
+}
void decocpu_type3_device::device_start()
{
decocpu_type1_device::device_start();
}
-decocpu_type3b_device::decocpu_type3b_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+decocpu_type3b_device::decocpu_type3b_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: decocpu_type3_device(mconfig, DECOCPU3B, tag, owner, clock)
-{}
+{
+}
void decocpu_type3b_device::device_start()
{
diff --git a/src/mame/machine/decopincpu.h b/src/mame/machine/decopincpu.h
index 754919195a2..e74a0fe06a2 100644
--- a/src/mame/machine/decopincpu.h
+++ b/src/mame/machine/decopincpu.h
@@ -29,13 +29,13 @@ class decocpu_type1_device : public device_t
{
public:
template <typename T>
- decocpu_type1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&cpuregion_tag)
+ decocpu_type1_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock, T &&cpuregion_tag)
: decocpu_type1_device(mconfig, tag, owner, clock)
{
set_cpuregion(std::forward<T>(cpuregion_tag));
}
- decocpu_type1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ decocpu_type1_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
// callbacks
auto display_read_callback() { return m_read_display.bind(); }
@@ -52,16 +52,16 @@ public:
template <typename T> void set_cpuregion(T &&tag) { m_rom.set_tag(std::forward<T>(tag)); } // region for cpu board code and data
protected:
- static constexpr device_timer_id TIMER_IRQ = 0;
- void solenoid0_w(uint8_t data);
+ void solenoid0_w(u8 data);
- decocpu_type1_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
+ decocpu_type1_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
// overrides
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual ioport_constructor device_input_ports() const override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(irq_trigger);
void decocpu1_map(address_map &map);
@@ -72,7 +72,8 @@ protected:
required_device<pia6821_device> m_pia2c;
required_device<pia6821_device> m_pia30;
required_device<pia6821_device> m_pia34;
- required_region_ptr<uint8_t> m_rom;
+ required_region_ptr<u8> m_rom;
+ required_ioport m_diags;
private:
emu_timer* m_irq_timer = 0;
@@ -98,37 +99,37 @@ private:
DECLARE_WRITE_LINE_MEMBER(pia2c_cb2_w) { m_io_outputs[17] = state; }
DECLARE_WRITE_LINE_MEMBER(pia30_ca2_w) { m_io_outputs[19] = state; }
DECLARE_WRITE_LINE_MEMBER(pia30_cb2_w) { m_io_outputs[16] = state; }
- void lamp0_w(uint8_t data);
- void lamp1_w(uint8_t data);
- uint8_t display_strobe_r();
- void display_strobe_w(uint8_t data);
- void display_out1_w(uint8_t data);
- void display_out2_w(uint8_t data);
- void display_out3_w(uint8_t data);
- void display_out4_w(uint8_t data);
- uint8_t display_in3_r();
- void switch_w(uint8_t data);
- uint8_t switch_r();
- uint8_t dmdstatus_r();
- void sound_w(uint8_t data);
- void solenoid1_w(uint8_t data);
+ void lamp0_w(u8 data);
+ void lamp1_w(u8 data);
+ u8 display_strobe_r();
+ void display_strobe_w(u8 data);
+ void display_out1_w(u8 data);
+ void display_out2_w(u8 data);
+ void display_out3_w(u8 data);
+ void display_out4_w(u8 data);
+ u8 display_in3_r();
+ void switch_w(u8 data);
+ u8 switch_r();
+ u8 dmdstatus_r();
+ void sound_w(u8 data);
+ void solenoid1_w(u8 data);
};
class decocpu_type2_device : public decocpu_type1_device
{
public:
template <typename T>
- decocpu_type2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&cpuregion_tag)
+ decocpu_type2_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock, T &&cpuregion_tag)
: decocpu_type2_device(mconfig, tag, owner, clock)
{
set_cpuregion(std::forward<T>(cpuregion_tag));
}
- decocpu_type2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ decocpu_type2_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
void decocpu2_map(address_map &map);
protected:
- decocpu_type2_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
+ decocpu_type2_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
// overrides
virtual void device_add_mconfig(machine_config &config) override;
@@ -139,16 +140,16 @@ class decocpu_type3_device : public decocpu_type2_device
{
public:
template <typename T>
- decocpu_type3_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&cpuregion_tag)
+ decocpu_type3_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock, T &&cpuregion_tag)
: decocpu_type3_device(mconfig, tag, owner, clock)
{
set_cpuregion(std::forward<T>(cpuregion_tag));
}
- decocpu_type3_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ decocpu_type3_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
protected:
- decocpu_type3_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
+ decocpu_type3_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
// overrides
virtual void device_start() override;
@@ -158,13 +159,13 @@ class decocpu_type3b_device : public decocpu_type3_device
{
public:
template <typename T>
- decocpu_type3b_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&cpuregion_tag)
+ decocpu_type3b_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock, T &&cpuregion_tag)
: decocpu_type3b_device(mconfig, tag, owner, clock)
{
set_cpuregion(std::forward<T>(cpuregion_tag));
}
- decocpu_type3b_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ decocpu_type3b_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
protected:
// overrides
diff --git a/src/mame/machine/dmac_0266.cpp b/src/mame/machine/dmac_0266.cpp
index 8b873924cfa..22f1402ad0a 100644
--- a/src/mame/machine/dmac_0266.cpp
+++ b/src/mame/machine/dmac_0266.cpp
@@ -58,7 +58,7 @@ void dmac_0266_device::device_start()
save_item(NAME(m_req_state));
- m_dma_check = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(dmac_0266_device::dma_check), this));
+ m_dma_check = timer_alloc(FUNC(dmac_0266_device::dma_check), this);
m_req_state = false;
}
diff --git a/src/mame/machine/dmac_0448.cpp b/src/mame/machine/dmac_0448.cpp
index 95c64e9f530..365df3e9582 100644
--- a/src/mame/machine/dmac_0448.cpp
+++ b/src/mame/machine/dmac_0448.cpp
@@ -54,8 +54,8 @@ void dmac_0448_device::device_start()
m_dma_r.resolve_all_safe(0);
m_dma_w.resolve_all_safe();
- m_irq_check = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(dmac_0448_device::irq_check), this));
- m_dma_check = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(dmac_0448_device::dma_check), this));
+ m_irq_check = timer_alloc(FUNC(dmac_0448_device::irq_check), this);
+ m_dma_check = timer_alloc(FUNC(dmac_0448_device::dma_check), this);
m_out_int_state = false;
m_gsel = 0;
diff --git a/src/mame/machine/egret.cpp b/src/mame/machine/egret.cpp
index 9af4be4d36e..3abaa99260f 100644
--- a/src/mame/machine/egret.cpp
+++ b/src/mame/machine/egret.cpp
@@ -399,7 +399,7 @@ void egret_device::device_start()
}
#endif
- m_timer = timer_alloc(0);
+ m_timer = timer_alloc(FUNC(egret_device::seconds_tick), this);
save_item(NAME(ddrs[0]));
save_item(NAME(ddrs[1]));
save_item(NAME(ddrs[2]));
@@ -468,7 +468,7 @@ void egret_device::device_reset()
last_adb = 0;
}
-void egret_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(egret_device::seconds_tick)
{
onesec |= 0x40;
diff --git a/src/mame/machine/egret.h b/src/mame/machine/egret.h
index 91fc4fd0683..f82c4a2e203 100644
--- a/src/mame/machine/egret.h
+++ b/src/mame/machine/egret.h
@@ -96,9 +96,9 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
- required_device<cpu_device> m_maincpu;
+ TIMER_CALLBACK_MEMBER(seconds_tick);
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ required_device<cpu_device> m_maincpu;
private:
uint8_t ddrs[3]{};
@@ -107,14 +107,20 @@ private:
uint8_t timer_ctrl = 0;
uint8_t timer_counter = 0;
uint8_t onesec = 0;
- uint8_t xcvr_session = 0, via_full = 0, sys_session = 0, via_data = 0, via_clock = 0, last_adb = 0;
+ uint8_t xcvr_session = 0;
+ uint8_t via_full = 0;
+ uint8_t sys_session = 0;
+ uint8_t via_data = 0;
+ uint8_t via_clock = 0;
+ uint8_t last_adb = 0;
uint64_t last_adb_time = 0;
bool egret_controls_power = false;
bool adb_in = false;
int reset_line = 0;
int m_adb_dtime = 0;
emu_timer *m_timer = nullptr;
- uint8_t pram[0x100]{}, disk_pram[0x100]{};
+ uint8_t pram[0x100]{};
+ uint8_t disk_pram[0x100]{};
bool pram_loaded = false;
#if USE_BUS_ADB
diff --git a/src/mame/machine/elan_eu3a05commonsys.cpp b/src/mame/machine/elan_eu3a05commonsys.cpp
index 638bbe6e459..f785ad2fe75 100644
--- a/src/mame/machine/elan_eu3a05commonsys.cpp
+++ b/src/mame/machine/elan_eu3a05commonsys.cpp
@@ -228,19 +228,12 @@ void elan_eu3a05commonsys_device::map(address_map &map)
}
-void elan_eu3a05commonsys_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(elan_eu3a05commonsys_device::unknown_timer_tick)
{
- switch (id)
- {
- case TIMER_UNK:
- {
- // rad_bb3 unmasks the interrupt, but the jumps use pointers in RAM, which haven't been set up at the time
- // of unmasking, so we need to find some kind of global enable / disable, or timer enable.
- if (m_allow_timer_irq)
- generate_custom_interrupt(m_whichtimer);
- break;
- }
- }
+ // rad_bb3 unmasks the interrupt, but the jumps use pointers in RAM, which haven't been set up at the time
+ // of unmasking, so we need to find some kind of global enable / disable, or timer enable.
+ if (m_allow_timer_irq)
+ generate_custom_interrupt(m_whichtimer);
}
@@ -254,7 +247,7 @@ void elan_eu3a05commonsys_device::device_start()
save_item(NAME(m_custom_irq_vector));
save_item(NAME(m_custom_nmi_vector));
- m_unk_timer = timer_alloc(TIMER_UNK);
+ m_unk_timer = timer_alloc(FUNC(elan_eu3a05commonsys_device::unknown_timer_tick), this);
m_unk_timer->adjust(attotime::never);
}
diff --git a/src/mame/machine/elan_eu3a05commonsys.h b/src/mame/machine/elan_eu3a05commonsys.h
index 3e62c48d556..77c185b72ee 100644
--- a/src/mame/machine/elan_eu3a05commonsys.h
+++ b/src/mame/machine/elan_eu3a05commonsys.h
@@ -31,7 +31,8 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(unknown_timer_tick);
required_device<m6502_device> m_cpu;
required_device<address_map_bank_device> m_bank;
@@ -63,7 +64,6 @@ private:
uint8_t radica_5009_unk_r() { return machine().rand(); }
emu_timer *m_unk_timer = nullptr;
- static const device_timer_id TIMER_UNK = 0;
int m_whichtimer;
};
diff --git a/src/mame/machine/electron.cpp b/src/mame/machine/electron.cpp
index 2bd23ed3a57..32d92743410 100644
--- a/src/mame/machine/electron.cpp
+++ b/src/mame/machine/electron.cpp
@@ -24,26 +24,12 @@ void electron_state::waitforramsync()
m_maincpu->adjust_icount(-cycles);
}
-
-void electron_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(electron_state::setup_beep)
{
- switch (id)
- {
- case TIMER_TAPE_HANDLER:
- electron_tape_timer_handler(param);
- break;
- case TIMER_SETUP_BEEP:
- setup_beep(param);
- break;
- case TIMER_SCANLINE_INTERRUPT:
- electron_scanline_interrupt(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in electron_state::device_timer");
- }
+ m_beeper->set_state( 0 );
+ m_beeper->set_clock( 300 );
}
-
void electron_state::electron_tape_start()
{
if (m_ula.tape_running )
@@ -583,20 +569,14 @@ void electron_state::electron_interrupt_handler(int mode, int interrupt)
Machine Initialisation functions
***************************************/
-TIMER_CALLBACK_MEMBER(electron_state::setup_beep)
-{
- m_beeper->set_state( 0 );
- m_beeper->set_clock( 300 );
-}
-
void electron_state::machine_start()
{
m_capslock_led.resolve();
m_ula.interrupt_status = 0x82;
m_ula.interrupt_control = 0x00;
- timer_set(attotime::zero, TIMER_SETUP_BEEP);
- m_tape_timer = timer_alloc(TIMER_TAPE_HANDLER);
+ m_tape_timer = timer_alloc(FUNC(electron_state::electron_tape_timer_handler), this);
+ m_beep_timer = timer_alloc(FUNC(electron_state::setup_beep), this);
/* register save states */
save_item(STRUCT_MEMBER(m_ula, interrupt_status));
@@ -630,6 +610,9 @@ void electron_state::machine_reset()
m_mrb_mapped = true;
m_vdu_drivers = false;
+
+ m_tape_timer->adjust(attotime::never);
+ m_beep_timer->adjust(attotime::never);
}
void electronsp_state::machine_start()
diff --git a/src/mame/machine/esqpanel.cpp b/src/mame/machine/esqpanel.cpp
index 338c7be5712..ba33ee64e2f 100644
--- a/src/mame/machine/esqpanel.cpp
+++ b/src/mame/machine/esqpanel.cpp
@@ -7,8 +7,6 @@
#include "http.h"
#include "esqpanel.h"
-#define ESQPANEL_EXTERNAL_TIMER_ID 47000
-
//**************************************************************************
// External panel support
//**************************************************************************
@@ -441,7 +439,7 @@ void esqpanel_device::device_start()
return write_contents(o);
});
- m_external_timer = timer_alloc(ESQPANEL_EXTERNAL_TIMER_ID);
+ m_external_timer = timer_alloc(FUNC(esqpanel_device::check_external_panel_server), this);
m_external_timer->enable(false);
}
}
@@ -484,14 +482,6 @@ void esqpanel_device::device_stop()
m_external_panel_server = nullptr;
}
-void esqpanel_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- if (ESQPANEL_EXTERNAL_TIMER_ID == id)
- {
- check_external_panel_server();
- }
-}
-
void esqpanel_device::rcv_complete() // Rx completed receiving byte
{
receive_register_extract();
@@ -618,7 +608,7 @@ void esqpanel_device::xmit_char(uint8_t data)
}
}
-void esqpanel_device::check_external_panel_server() {
+TIMER_CALLBACK_MEMBER(esqpanel_device::check_external_panel_server) {
while (m_external_panel_server->has_commands())
{
std::string command = m_external_panel_server->get_next_command();
diff --git a/src/mame/machine/esqpanel.h b/src/mame/machine/esqpanel.h
index f902266afee..52481a12d10 100644
--- a/src/mame/machine/esqpanel.h
+++ b/src/mame/machine/esqpanel.h
@@ -40,7 +40,6 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_stop() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// serial overrides
virtual void rcv_complete() override; // Rx completed receiving byte
@@ -49,7 +48,7 @@ protected:
virtual void send_to_display(uint8_t data) = 0;
- void check_external_panel_server();
+ TIMER_CALLBACK_MEMBER(check_external_panel_server);
virtual const std::string get_front_panel_html_file() const { return ""; }
virtual const std::string get_front_panel_js_file() const { return ""; }
diff --git a/src/mame/machine/esqvfd.cpp b/src/mame/machine/esqvfd.cpp
index 5e2797cbd6e..68b913f9c22 100644
--- a/src/mame/machine/esqvfd.cpp
+++ b/src/mame/machine/esqvfd.cpp
@@ -140,10 +140,6 @@ void esqvfd_device::device_reset()
memset(m_dirty, 1, sizeof(m_attrs));
}
-void esqvfd_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
-}
-
// generic display update; can override from child classes if not good enough
void esqvfd_device::update_display()
{
diff --git a/src/mame/machine/esqvfd.h b/src/mame/machine/esqvfd.h
index 5b827b335b2..ec6c7772173 100644
--- a/src/mame/machine/esqvfd.h
+++ b/src/mame/machine/esqvfd.h
@@ -48,7 +48,6 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
output_helper::ptr m_vfds;
int m_cursx = 0, m_cursy = 0;
diff --git a/src/mame/machine/f5220_kbd.cpp b/src/mame/machine/f5220_kbd.cpp
index 91c590e402d..df6f81ea62b 100644
--- a/src/mame/machine/f5220_kbd.cpp
+++ b/src/mame/machine/f5220_kbd.cpp
@@ -203,7 +203,7 @@ void f5220_kbd_device::device_start()
m_int_handler.resolve_safe();
// timer for initial keyboard data
- m_reset_timer = timer_alloc(0);
+ m_reset_timer = timer_alloc(FUNC(f5220_kbd_device::reset_done), this);
m_reset_timer->adjust(attotime::from_msec(1000));
// register for state saving
@@ -224,12 +224,13 @@ void f5220_kbd_device::device_reset()
}
//-------------------------------------------------
-// device_timer - device-specific timer
+// reset_done - flag an interrupt to indicate
+// the device has come out of reset
//-------------------------------------------------
-void f5220_kbd_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(f5220_kbd_device::reset_done)
{
- logerror("Reset\n");
+ logerror("Reset Done\n");
m_int_handler(1);
m_int_handler(0);
diff --git a/src/mame/machine/f5220_kbd.h b/src/mame/machine/f5220_kbd.h
index 2d3d22d1ef2..3cf1c050cbc 100644
--- a/src/mame/machine/f5220_kbd.h
+++ b/src/mame/machine/f5220_kbd.h
@@ -36,13 +36,14 @@ protected:
virtual ioport_constructor device_input_ports() const override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_matrix_keyboard_interface overrides
virtual void key_make(uint8_t row, uint8_t column) override;
virtual void key_break(uint8_t row, uint8_t column) override;
virtual void key_repeat(uint8_t row, uint8_t column) override;
+ TIMER_CALLBACK_MEMBER(reset_done);
+
private:
devcb_write_line m_int_handler;
diff --git a/src/mame/machine/fm_scsi.cpp b/src/mame/machine/fm_scsi.cpp
index c370c232964..d2b8fcd266f 100644
--- a/src/mame/machine/fm_scsi.cpp
+++ b/src/mame/machine/fm_scsi.cpp
@@ -79,8 +79,8 @@ void fmscsi_device::device_start()
m_drq_handler.resolve_safe();
// allocate read timer
- m_transfer_timer = timer_alloc(TIMER_TRANSFER);
- m_phase_timer = timer_alloc(TIMER_PHASE);
+ m_transfer_timer = timer_alloc(FUNC(fmscsi_device::update_transfer), this);
+ m_phase_timer = timer_alloc(FUNC(fmscsi_device::set_phase), this);
}
void fmscsi_device::device_reset()
@@ -117,21 +117,13 @@ int fmscsi_device::get_scsi_cmd_len(uint8_t cbyte)
//return 6;
}
-void fmscsi_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(fmscsi_device::update_transfer)
{
- switch(id)
+ set_input_line(FMSCSI_LINE_REQ,1);
+ //logerror("FMSCSI: timer triggered: %i/%i\n",m_result_index,m_result_length);
+ if(m_output_lines & FMSCSI_LINE_DMAE)
{
- case TIMER_TRANSFER:
- set_input_line(FMSCSI_LINE_REQ,1);
- //logerror("FMSCSI: timer triggered: %i/%i\n",m_result_index,m_result_length);
- if(m_output_lines & FMSCSI_LINE_DMAE)
- {
- m_drq_handler(1);
- }
- break;
- case TIMER_PHASE:
- set_phase(param);
- break;
+ m_drq_handler(1);
}
}
@@ -256,12 +248,12 @@ void fmscsi_device::fmscsi_data_w(uint8_t data)
}
}
-void fmscsi_device::set_phase(int phase)
+TIMER_CALLBACK_MEMBER(fmscsi_device::set_phase)
{
- m_phase = phase;
+ m_phase = param;
logerror("FMSCSI: phase set to %i\n",m_phase);
// set input lines accordingly
- switch(phase)
+ switch(param)
{
case SCSI_PHASE_BUS_FREE:
set_input_line(FMSCSI_LINE_BSY,0);
diff --git a/src/mame/machine/fm_scsi.h b/src/mame/machine/fm_scsi.h
index 5b3b06866f0..9a3df8c0ba6 100644
--- a/src/mame/machine/fm_scsi.h
+++ b/src/mame/machine/fm_scsi.h
@@ -31,7 +31,7 @@ public:
uint8_t fmscsi_r(offs_t offset);
void fmscsi_w(offs_t offset, uint8_t data);
- void set_phase(int phase);
+ TIMER_CALLBACK_MEMBER(set_phase);
int get_phase(void);
void set_input_line(uint8_t line, uint8_t state);
uint8_t get_input_line(uint8_t line);
@@ -42,13 +42,10 @@ protected:
// device-level overrides (none are required, but these are common)
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-private:
- // internal device state goes here
- static const device_timer_id TIMER_TRANSFER = 0;
- static const device_timer_id TIMER_PHASE = 1;
+ TIMER_CALLBACK_MEMBER(update_transfer);
+private:
int get_scsi_cmd_len(uint8_t cbyte);
void stop_transfer();
diff --git a/src/mame/machine/gaelco3d.cpp b/src/mame/machine/gaelco3d.cpp
index 9e3c106fca4..a2d195782c1 100644
--- a/src/mame/machine/gaelco3d.cpp
+++ b/src/mame/machine/gaelco3d.cpp
@@ -189,6 +189,7 @@ gaelco_serial_device::gaelco_serial_device(const machine_config &mconfig, const
m_last_in_msg_cnt(0),
m_slack_cnt(0),
m_sync_timer(nullptr),
+ m_status_set_timer(nullptr),
m_in_ptr(nullptr),
m_out_ptr(nullptr),
m_os_shmem(nullptr),
@@ -206,7 +207,8 @@ void gaelco_serial_device::device_start()
assert(strlen(tag()) < 20);
m_irq_handler.resolve_safe();
- m_sync_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gaelco_serial_device::link_cb), this));
+ m_sync_timer = timer_alloc(FUNC(gaelco_serial_device::link_cb), this);
+ m_status_set_timer = timer_alloc(FUNC(gaelco_serial_device::set_status_cb), this);
/* register for save states */
//save_item(NAME(earom->offset));
@@ -239,7 +241,9 @@ void gaelco_serial_device::device_start()
void gaelco_serial_device::device_reset()
{
- m_status = GAELCOSER_STATUS_READY |GAELCOSER_STATUS_IRQ_ENABLE ;
+ m_status_set_timer->adjust(attotime::never);
+
+ m_status = GAELCOSER_STATUS_READY | GAELCOSER_STATUS_IRQ_ENABLE;
m_last_in_msg_cnt = -1;
m_slack_cnt = LINK_SLACK_B;
@@ -274,7 +278,7 @@ TIMER_CALLBACK_MEMBER( gaelco_serial_device::set_status_cb )
void gaelco_serial_device::set_status(uint8_t mask, uint8_t set, int wait)
{
- machine().scheduler().timer_set(attotime::from_hz(wait), timer_expired_delegate(FUNC(gaelco_serial_device::set_status_cb), this), (mask << 8)|set);
+ m_status_set_timer->adjust(attotime::from_hz(wait), (mask << 8) | set);
}
void gaelco_serial_device::process_in()
diff --git a/src/mame/machine/gaelco3d.h b/src/mame/machine/gaelco3d.h
index 05a09a8ee0a..b30856e6bf9 100644
--- a/src/mame/machine/gaelco3d.h
+++ b/src/mame/machine/gaelco3d.h
@@ -88,6 +88,7 @@ private:
int m_slack_cnt;
emu_timer *m_sync_timer;
+ emu_timer *m_status_set_timer;
buf_t *m_in_ptr;
buf_t *m_out_ptr;
diff --git a/src/mame/machine/gamecom.cpp b/src/mame/machine/gamecom.cpp
index 727f4f8e8ab..6ff53ee45f2 100644
--- a/src/mame/machine/gamecom.cpp
+++ b/src/mame/machine/gamecom.cpp
@@ -611,9 +611,9 @@ void gamecom_state::gamecom_update_timers(uint8_t data)
void gamecom_state::init_gamecom()
{
- m_clock_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gamecom_state::gamecom_clock_timer_callback),this));
- m_sound0_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gamecom_state::gamecom_sound0_timer_callback),this));
- m_sound1_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gamecom_state::gamecom_sound1_timer_callback),this));
+ m_clock_timer = timer_alloc(FUNC(gamecom_state::gamecom_clock_timer_callback), this);
+ m_sound0_timer = timer_alloc(FUNC(gamecom_state::gamecom_sound0_timer_callback), this);
+ m_sound1_timer = timer_alloc(FUNC(gamecom_state::gamecom_sound1_timer_callback), this);
m_sound0_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1));
m_sound1_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1));
m_p_ram = m_share_maincpu; // required here because pio_w gets called before machine_reset
diff --git a/src/mame/machine/harddriv.cpp b/src/mame/machine/harddriv.cpp
index 7745c5a8d9f..57abbcd7a0a 100644
--- a/src/mame/machine/harddriv.cpp
+++ b/src/mame/machine/harddriv.cpp
@@ -45,6 +45,7 @@ void harddriv_state::device_start()
init_video();
+ m_xdsp_serial_irq_off_timer = timer_alloc(FUNC(harddriv_state::xdsp_sport1_irq_off_callback), this);
}
@@ -79,6 +80,8 @@ void harddriv_state::device_reset()
m_ds3xdsp_timer_en = 0;
m_ds3xdsp_internal_timer->adjust(attotime::never);
}
+
+ m_xdsp_serial_irq_off_timer->adjust(attotime::never);
}
@@ -1322,7 +1325,7 @@ WRITE_LINE_MEMBER(harddriv_state::hdds3xdsp_timer_enable_callback)
/*
TODO: The following does not work correctly
*/
-TIMER_CALLBACK_MEMBER(harddriv_state::xsdp_sport1_irq_off_callback)
+TIMER_CALLBACK_MEMBER(harddriv_state::xdsp_sport1_irq_off_callback)
{
m_ds3xdsp->set_input_line(ADSP2105_SPORT1_RX, CLEAR_LINE);
}
@@ -1336,7 +1339,7 @@ void harddriv_state::hdds3sdsp_serial_tx_callback(uint32_t data)
m_ds3sdsp_sdata = data;
m_ds3xdsp->set_input_line(ADSP2105_SPORT1_RX, ASSERT_LINE);
- machine().scheduler().timer_set(attotime::from_nsec(200), timer_expired_delegate(FUNC(harddriv_state::xsdp_sport1_irq_off_callback), this));
+ m_xdsp_serial_irq_off_timer->adjust(attotime::from_nsec(200));
}
diff --git a/src/mame/machine/hec2hrp.cpp b/src/mame/machine/hec2hrp.cpp
index c2fb3794580..064de7de28d 100644
--- a/src/mame/machine/hec2hrp.cpp
+++ b/src/mame/machine/hec2hrp.cpp
@@ -812,7 +812,7 @@ void hec2hrp_state::hector_init()
m_pot0 = m_pot1 = 0x40;
/* for cassette sync */
- m_cassette_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(hec2hrp_state::cassette_clock),this));
+ m_cassette_timer = timer_alloc(FUNC(hec2hrp_state::cassette_clock), this);
m_cassette_timer->adjust(attotime::from_msec(100), 0, attotime::from_usec(64));/* => real sync scan speed for 15,624Khz*/
init_sn76477(); /* init R/C values */
diff --git a/src/mame/machine/hp2640_tape.cpp b/src/mame/machine/hp2640_tape.cpp
index 45fcc5caff7..a9a7630c4fe 100644
--- a/src/mame/machine/hp2640_tape.cpp
+++ b/src/mame/machine/hp2640_tape.cpp
@@ -45,11 +45,12 @@
#include "hp2640_tape.h"
// Debugging
-#include "logmacro.h"
-#undef VERBOSE
-#define VERBOSE 0
+
//#define VERBOSE (LOG_GENERAL)
+#define VERBOSE (0)
+#include "logmacro.h"
+
// Bit manipulation
namespace {
template<typename T> constexpr T BIT_MASK(unsigned n)
@@ -68,12 +69,6 @@ namespace {
}
}
-// Timers
-enum {
- GAP_TMR_ID,
- CELL_TMR_ID
-};
-
// Constants
constexpr double FAST_SPEED = 60.0; // Fast speed: 60 ips
constexpr double SLOW_SPEED = 10.0; // Slow speed: 10 ips
@@ -258,8 +253,8 @@ void hp2640_tape_device::device_start()
m_led0_handler.resolve_safe();
m_led1_handler.resolve_safe();
- m_gap_timer = timer_alloc(GAP_TMR_ID);
- m_cell_timer = timer_alloc(CELL_TMR_ID);
+ m_gap_timer = timer_alloc(FUNC(hp2640_tape_device::gap_timer_tick), this);
+ m_cell_timer = timer_alloc(FUNC(hp2640_tape_device::cell_timer_tick), this);
save_item(NAME(m_selected_drive));
save_item(NAME(m_cmd_reg));
@@ -311,37 +306,33 @@ void hp2640_tape_device::device_reset()
m_cell_timer->reset();
}
-void hp2640_tape_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(hp2640_tape_device::gap_timer_tick)
{
- LOG("TMR %d @%s\n" , id , machine().time().to_string());
+ LOG("TMR 0 @%s\n", machine().time().to_string());
- switch (id) {
- case GAP_TMR_ID:
- m_gap = !m_gap;
- if (m_gap) {
- set_gap();
- } else {
- LOG("GAP ENDS\n");
- load_gap_timer();
- if (m_isf) {
- load_modulus();
- }
+ m_gap = !m_gap;
+ if (m_gap) {
+ set_gap();
+ } else {
+ LOG("GAP ENDS\n");
+ load_gap_timer();
+ if (m_isf) {
+ load_modulus();
}
- break;
+ }
+}
- case CELL_TMR_ID:
- if (m_current_op == hp_dc100_tape_device::OP_READ) {
- m_cell_cnt++;
- if (m_cell_cnt == 15) {
- restart_cell_cnt();
- } else {
- load_modulus();
- }
- }
- break;
+TIMER_CALLBACK_MEMBER(hp2640_tape_device::cell_timer_tick)
+{
+ LOG("TMR 1 @%s\n", machine().time().to_string());
- default:
- break;
+ if (m_current_op == hp_dc100_tape_device::OP_READ) {
+ m_cell_cnt++;
+ if (m_cell_cnt == 15) {
+ restart_cell_cnt();
+ } else {
+ load_modulus();
+ }
}
}
diff --git a/src/mame/machine/hp2640_tape.h b/src/mame/machine/hp2640_tape.h
index 9c6ff7e382a..30c511c4a8f 100644
--- a/src/mame/machine/hp2640_tape.h
+++ b/src/mame/machine/hp2640_tape.h
@@ -38,7 +38,9 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(gap_timer_tick);
+ TIMER_CALLBACK_MEMBER(cell_timer_tick);
private:
devcb_write_line m_irq_handler;
diff --git a/src/mame/machine/hp48.cpp b/src/mame/machine/hp48.cpp
index 41b44ba5727..4c0a561a78f 100644
--- a/src/mame/machine/hp48.cpp
+++ b/src/mame/machine/hp48.cpp
@@ -108,7 +108,7 @@ void hp48_state::rs232_start_recv_byte(uint8_t data)
}
/* schedule end of reception */
- machine().scheduler().timer_set(RS232_DELAY, timer_expired_delegate(FUNC(hp48_state::rs232_byte_recv_cb),this), data);
+ m_recv_done_timer->adjust(RS232_DELAY, data);
}
@@ -137,7 +137,7 @@ void hp48_state::rs232_send_byte()
m_io[0x12] |= 3;
/* schedule transmission */
- machine().scheduler().timer_set(RS232_DELAY, timer_expired_delegate(FUNC(hp48_state::rs232_byte_sent_cb),this), data);
+ m_send_done_timer->adjust(RS232_DELAY, data);
}
@@ -976,16 +976,24 @@ void hp48_state::base_machine_start(hp48_models model)
}
/* timers */
- m_1st_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(hp48_state::timer1_cb), this));
+ m_1st_timer = timer_alloc(FUNC(hp48_state::timer1_cb), this);
m_1st_timer->adjust(attotime::from_hz(16), 0, attotime::from_hz(16));
- m_2nd_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(hp48_state::timer2_cb), this));
+ m_2nd_timer = timer_alloc(FUNC(hp48_state::timer2_cb), this);
m_2nd_timer->adjust(attotime::from_hz(8192), 0, attotime::from_hz(8192));
/* 1ms keyboard polling */
- m_kbd_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(hp48_state::kbd_cb), this));
+ m_kbd_timer = timer_alloc(FUNC(hp48_state::kbd_cb), this);
m_kbd_timer->adjust(attotime::from_msec(1), 0, attotime::from_msec(1));
+ /* serial receive done */
+ m_recv_done_timer = timer_alloc(FUNC(hp48_state::rs232_byte_recv_cb), this);
+ m_recv_done_timer->adjust(attotime::never);
+
+ /* serial send done */
+ m_send_done_timer = timer_alloc(FUNC(hp48_state::rs232_byte_sent_cb), this);
+ m_send_done_timer->adjust(attotime::never);
+
m_lshift0.resolve();
m_rshift0.resolve();
m_alpha0.resolve();
diff --git a/src/mame/machine/hp9845_printer.cpp b/src/mame/machine/hp9845_printer.cpp
index c3b17acfaec..27cafb9df07 100644
--- a/src/mame/machine/hp9845_printer.cpp
+++ b/src/mame/machine/hp9845_printer.cpp
@@ -172,7 +172,7 @@ void hp9845_printer_device::device_start()
save_item(NAME(m_fsm_state));
save_item(NAME(m_cur_line));
- m_timer = timer_alloc(0);
+ m_timer = timer_alloc(FUNC(hp9845_printer_device::clear_busy_flag), this);
}
void hp9845_printer_device::device_reset()
@@ -186,7 +186,7 @@ void hp9845_printer_device::device_reset()
m_sts_handler(true);
}
-void hp9845_printer_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(hp9845_printer_device::clear_busy_flag)
{
m_busy = false;
update_fsm();
diff --git a/src/mame/machine/hp9845_printer.h b/src/mame/machine/hp9845_printer.h
index ce8fce69084..b3da40da833 100644
--- a/src/mame/machine/hp9845_printer.h
+++ b/src/mame/machine/hp9845_printer.h
@@ -31,7 +31,8 @@ public:
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(clear_busy_flag);
// PPU access
uint16_t printer_r(offs_t offset);
diff --git a/src/mame/machine/hpc3.cpp b/src/mame/machine/hpc3.cpp
index dcab7432baa..89e736c698c 100644
--- a/src/mame/machine/hpc3.cpp
+++ b/src/mame/machine/hpc3.cpp
@@ -150,7 +150,7 @@ void hpc3_device::device_start()
save_item(NAME(m_pbus_dma[i].m_config), i);
save_item(NAME(m_pbus_dma[i].m_control), i);
- m_pbus_dma[i].m_timer = timer_alloc(TIMER_PBUS_DMA + i);
+ m_pbus_dma[i].m_timer = timer_alloc(FUNC(hpc3_device::do_pbus_dma), this);
m_pbus_dma[i].m_timer->adjust(attotime::never);
}
@@ -166,7 +166,7 @@ void hpc3_device::device_start()
save_pointer(NAME(m_enet_fifo[ENET_RECV]), 32);
save_pointer(NAME(m_enet_fifo[ENET_XMIT]), 40);
- m_enet_tx_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(hpc3_device::enet_transmit), this));
+ m_enet_tx_timer = timer_alloc(FUNC(hpc3_device::enet_transmit), this);
}
void hpc3_device::device_reset()
@@ -218,29 +218,9 @@ void hpc3_device::map(address_map &map)
map(0x00060000, 0x0007ffff).rw(FUNC(hpc3_device::bbram_r), FUNC(hpc3_device::bbram_w));
}
-void hpc3_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_PBUS_DMA+0:
- case TIMER_PBUS_DMA+1:
- case TIMER_PBUS_DMA+2:
- case TIMER_PBUS_DMA+3:
- do_pbus_dma(id - TIMER_PBUS_DMA);
- break;
- case TIMER_PBUS_DMA+4:
- case TIMER_PBUS_DMA+5:
- case TIMER_PBUS_DMA+6:
- case TIMER_PBUS_DMA+7:
- LOGMASKED(LOG_UNKNOWN, "HPC3: Ignoring active PBUS DMA on channel %d\n", id - TIMER_PBUS_DMA);
- break;
- default:
- throw emu_fatalerror("Unknown id in hpc3_device::device_timer");
- }
-}
-
-void hpc3_device::do_pbus_dma(uint32_t channel)
+TIMER_CALLBACK_MEMBER(hpc3_device::do_pbus_dma)
{
+ uint32_t channel = (uint32_t)param;
pbus_dma_t &dma = m_pbus_dma[channel];
if (dma.m_active && channel < 4)
@@ -280,7 +260,7 @@ void hpc3_device::do_pbus_dma(uint32_t channel)
return;
}
}
- dma.m_timer->adjust(m_hal2->get_rate(channel));
+ dma.m_timer->adjust(m_hal2->get_rate(channel), (int)channel);
}
else
{
@@ -881,7 +861,7 @@ void hpc3_device::pbusdma_w(address_space &space, offs_t offset, uint32_t data,
attotime rate = m_hal2->get_rate(channel);
if (rate != attotime::zero)
{
- dma.m_timer->adjust(rate);
+ dma.m_timer->adjust(rate, (int)channel);
dma.m_active = true;
}
}
diff --git a/src/mame/machine/hpc3.h b/src/mame/machine/hpc3.h
index c0d53ca5ac6..7a37648fbbc 100644
--- a/src/mame/machine/hpc3.h
+++ b/src/mame/machine/hpc3.h
@@ -71,7 +71,6 @@ protected:
virtual void device_resolve_objects() override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual space_config_vector memory_space_config() const override;
@@ -109,7 +108,7 @@ protected:
uint32_t bbram_r(offs_t offset);
void bbram_w(offs_t offset, uint32_t data);
- void do_pbus_dma(uint32_t channel);
+ TIMER_CALLBACK_MEMBER(do_pbus_dma);
void do_scsi_dma(int channel);
void dump_chain(uint32_t base);
@@ -123,8 +122,6 @@ protected:
void enet_misc_w(u32 data);
bool enet_rx_bc_dec(unsigned const count = 1);
- static const device_timer_id TIMER_PBUS_DMA = 0;
-
struct pbus_dma_t
{
bool m_active = false;
diff --git a/src/mame/machine/ibm6580_fdc.cpp b/src/mame/machine/ibm6580_fdc.cpp
index 5abc6573705..0cc35e56532 100644
--- a/src/mame/machine/ibm6580_fdc.cpp
+++ b/src/mame/machine/ibm6580_fdc.cpp
@@ -61,7 +61,7 @@ void dw_fdc_device::device_start()
m_out_data.resolve_safe();
m_out_clock.resolve_safe();
m_out_strobe.resolve_safe();
- m_reset_timer = timer_alloc();
+ m_reset_timer = timer_alloc(FUNC(dw_fdc_device::assert_reset_line), this);
}
void dw_fdc_device::device_reset()
@@ -69,7 +69,7 @@ void dw_fdc_device::device_reset()
m_p1 = m_p2 = m_t0 = m_t1 = 0;
}
-void dw_fdc_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(dw_fdc_device::assert_reset_line)
{
m_mcu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
}
diff --git a/src/mame/machine/ibm6580_fdc.h b/src/mame/machine/ibm6580_fdc.h
index b5c9fa8b6fc..64dcb85ffa7 100644
--- a/src/mame/machine/ibm6580_fdc.h
+++ b/src/mame/machine/ibm6580_fdc.h
@@ -28,7 +28,8 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(assert_reset_line);
private:
uint8_t m_bus, m_t0, m_t1, m_p1, m_p2;
diff --git a/src/mame/machine/imm6_76.cpp b/src/mame/machine/imm6_76.cpp
index db4cdcbd236..19a8d4ad5c8 100644
--- a/src/mame/machine/imm6_76.cpp
+++ b/src/mame/machine/imm6_76.cpp
@@ -29,9 +29,9 @@ intel_imm6_76_device::intel_imm6_76_device(
void intel_imm6_76_device::device_start()
{
- m_cycle_tmr = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(intel_imm6_76_device::cycle_expired), this));
- m_cycle_a_tmr = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(intel_imm6_76_device::cycle_a_expired), this));
- m_prg_tmr = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(intel_imm6_76_device::prg_expired), this));
+ m_cycle_tmr = timer_alloc(FUNC(intel_imm6_76_device::cycle_expired), this);
+ m_cycle_a_tmr = timer_alloc(FUNC(intel_imm6_76_device::cycle_a_expired), this);
+ m_prg_tmr = timer_alloc(FUNC(intel_imm6_76_device::prg_expired), this);
save_item(NAME(m_data));
save_item(NAME(m_di));
diff --git a/src/mame/machine/interpro_ioga.cpp b/src/mame/machine/interpro_ioga.cpp
index 0ab14ca6997..22e493c4f93 100644
--- a/src/mame/machine/interpro_ioga.cpp
+++ b/src/mame/machine/interpro_ioga.cpp
@@ -194,24 +194,24 @@ void interpro_ioga_device::device_start()
}
// allocate timers
- m_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(interpro_ioga_device::interrupt_check), this));
- m_dma_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(interpro_ioga_device::dma), this));
- m_serial_dma_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(interpro_ioga_device::serial_dma), this));
+ m_interrupt_timer = timer_alloc(FUNC(interpro_ioga_device::interrupt_check), this);
+ m_dma_timer = timer_alloc(FUNC(interpro_ioga_device::dma), this);
+ m_serial_dma_timer = timer_alloc(FUNC(interpro_ioga_device::serial_dma), this);
- m_timer0 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(interpro_ioga_device::timer0), this));
- m_timer1 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(interpro_ioga_device::timer1), this));
+ m_timer0 = timer_alloc(FUNC(interpro_ioga_device::timer0), this);
+ m_timer1 = timer_alloc(FUNC(interpro_ioga_device::timer1), this);
- m_timer_60hz = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(interpro_ioga_device::timer_60hz), this));
+ m_timer_60hz = timer_alloc(FUNC(interpro_ioga_device::timer_60hz), this);
- m_eth_reset_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(interpro_ioga_device::eth_reset), this));
+ m_eth_reset_timer = timer_alloc(FUNC(interpro_ioga_device::eth_reset), this);
}
void sapphire_ioga_device::device_start()
{
interpro_ioga_device::device_start();
- m_timer2 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sapphire_ioga_device::timer2), this));
- m_timer3 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sapphire_ioga_device::timer3), this));
+ m_timer2 = timer_alloc(FUNC(sapphire_ioga_device::timer2), this);
+ m_timer3 = timer_alloc(FUNC(sapphire_ioga_device::timer3), this);
}
void interpro_ioga_device::device_reset()
diff --git a/src/mame/machine/intv.cpp b/src/mame/machine/intv.cpp
index c580b93dc37..a73293b29f4 100644
--- a/src/mame/machine/intv.cpp
+++ b/src/mame/machine/intv.cpp
@@ -481,7 +481,7 @@ void intv_state::intvkbd_periph_w(offs_t offset, uint8_t data)
}
}
-uint16_t intv_state::intv_stic_r(offs_t offset)
+uint16_t intv_state::stic_r(offs_t offset)
{
if (m_bus_copy_mode || !m_stic->read_stic_handshake())
return m_stic->read(offset);
@@ -489,14 +489,14 @@ uint16_t intv_state::intv_stic_r(offs_t offset)
return offset;
}
-void intv_state::intv_stic_w(offs_t offset, uint16_t data)
+void intv_state::stic_w(offs_t offset, uint16_t data)
{
if (m_bus_copy_mode || !m_stic->read_stic_handshake())
m_stic->write(offset, data);
}
-uint16_t intv_state::intv_gram_r(offs_t offset)
+uint16_t intv_state::gram_r(offs_t offset)
{
//logerror("read: %d = GRAM(%d)\n",state->m_gram[offset],offset);
if (m_bus_copy_mode || !m_stic->read_stic_handshake())
@@ -505,31 +505,31 @@ uint16_t intv_state::intv_gram_r(offs_t offset)
return offset;
}
-void intv_state::intv_gram_w(offs_t offset, uint16_t data)
+void intv_state::gram_w(offs_t offset, uint16_t data)
{
if (m_bus_copy_mode || !m_stic->read_stic_handshake())
m_stic->gram_write(offset, data);
}
-uint16_t intv_state::intv_ram8_r(offs_t offset)
+uint16_t intv_state::ram8_r(offs_t offset)
{
//logerror("%x = ram8_r(%x)\n",state->m_ram8[offset],offset);
return (int)m_ram8[offset];
}
-void intv_state::intv_ram8_w(offs_t offset, uint16_t data)
+void intv_state::ram8_w(offs_t offset, uint16_t data)
{
//logerror("ram8_w(%x) = %x\n",offset,data);
m_ram8[offset] = data&0xff;
}
-uint16_t intv_state::intv_ram16_r(offs_t offset)
+uint16_t intv_state::ram16_r(offs_t offset)
{
//logerror("%x = ram16_r(%x)\n",state->m_ram16[offset],offset);
return (int)m_ram16[offset];
}
-void intv_state::intv_ram16_w(offs_t offset, uint16_t data)
+void intv_state::ram16_w(offs_t offset, uint16_t data)
{
//logerror("%g: WRITING TO GRAM offset = %d\n",machine.time(),offset);
//logerror("ram16_w(%x) = %x\n",offset,data);
@@ -639,16 +639,21 @@ void intv_state::machine_start()
m_cart->save_ram();
}
+
+ m_int2_complete_timer = timer_alloc(FUNC(intv_state::interrupt2_complete), this);
+ m_int_complete_timer = timer_alloc(FUNC(intv_state::interrupt_complete), this);
+ for (int row = 0; row < stic_device::BACKTAB_HEIGHT; row++)
+ m_btb_fill_timers[row] = timer_alloc(FUNC(intv_state::btb_fill), this);
}
-TIMER_CALLBACK_MEMBER(intv_state::intv_interrupt_complete)
+TIMER_CALLBACK_MEMBER(intv_state::interrupt_complete)
{
m_maincpu->set_input_line(CP1610_INT_INTRM, CLEAR_LINE);
m_bus_copy_mode = 0;
}
-TIMER_CALLBACK_MEMBER(intv_state::intv_btb_fill)
+TIMER_CALLBACK_MEMBER(intv_state::btb_fill)
{
uint8_t row = m_backtab_row;
//m_maincpu->adjust_icount(-STIC_ROW_FETCH);
@@ -659,7 +664,7 @@ TIMER_CALLBACK_MEMBER(intv_state::intv_btb_fill)
m_backtab_row += 1;
}
-INTERRUPT_GEN_MEMBER(intv_state::intv_interrupt)
+INTERRUPT_GEN_MEMBER(intv_state::interrupt)
{
int delay = m_stic->read_row_delay();
m_maincpu->set_input_line(CP1610_INT_INTRM, ASSERT_LINE);
@@ -668,10 +673,13 @@ INTERRUPT_GEN_MEMBER(intv_state::intv_interrupt)
m_backtab_row = 0;
m_maincpu->adjust_icount(-(12*stic_device::ROW_BUSRQ+stic_device::FRAME_BUSRQ)); // Account for stic cycle stealing
- timer_set(m_maincpu->cycles_to_attotime(stic_device::VBLANK_END), TIMER_INTV_INTERRUPT_COMPLETE);
+ m_int_complete_timer->adjust(m_maincpu->cycles_to_attotime(stic_device::VBLANK_END));
for (int row = 0; row < stic_device::BACKTAB_HEIGHT; row++)
{
- timer_set(m_maincpu->cycles_to_attotime(stic_device::FIRST_FETCH-stic_device::FRAME_BUSRQ+stic_device::CYCLES_PER_SCANLINE*stic_device::Y_SCALE*delay + (stic_device::CYCLES_PER_SCANLINE*stic_device::Y_SCALE*stic_device::CARD_HEIGHT - stic_device::ROW_BUSRQ)*row), TIMER_INTV_BTB_FILL);
+ const uint32_t row_cycles = (stic_device::CYCLES_PER_SCANLINE * stic_device::Y_SCALE * stic_device::CARD_HEIGHT - stic_device::ROW_BUSRQ) * row;
+ const uint32_t total_cycles = stic_device::FIRST_FETCH - stic_device::FRAME_BUSRQ + stic_device::CYCLES_PER_SCANLINE * stic_device::Y_SCALE * delay + row_cycles;
+ attotime duration = m_maincpu->cycles_to_attotime(total_cycles);
+ m_btb_fill_timers[row]->adjust(duration);
}
if (delay == 0)
diff --git a/src/mame/machine/irobot.cpp b/src/mame/machine/irobot.cpp
index 0f041f37e5a..ba136b8b43e 100644
--- a/src/mame/machine/irobot.cpp
+++ b/src/mame/machine/irobot.cpp
@@ -170,7 +170,7 @@ void irobot_state::machine_start()
m_statwr = 0;
/* set an initial timer to go off on scanline 0 */
- m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(irobot_state::scanline_callback), this));
+ m_scanline_timer = timer_alloc(FUNC(irobot_state::scanline_callback), this);
m_scanline_timer->adjust(m_screen->time_until_pos(0));
}
diff --git a/src/mame/machine/iteagle_fpga.cpp b/src/mame/machine/iteagle_fpga.cpp
index 9626de12edd..6b914ea1dd3 100644
--- a/src/mame/machine/iteagle_fpga.cpp
+++ b/src/mame/machine/iteagle_fpga.cpp
@@ -113,7 +113,7 @@ void iteagle_fpga_device::device_start()
// RAM defaults to base address 0x000e0000
bank_infos[2].adr = 0x000e0000 & (~(bank_infos[2].size - 1));
- m_timer = timer_alloc(0);
+ m_timer = timer_alloc(FUNC(iteagle_fpga_device::assert_vblank_irq), this);
// Switch IO
m_in_cb.resolve_all_safe(0xffff);
@@ -215,9 +215,10 @@ void iteagle_fpga_device::update_sequence_eg1(uint32_t data)
}
//-------------------------------------------------
-// device_timer - called when our device timer expires
+// assert_vblank_irq -
//-------------------------------------------------
-void iteagle_fpga_device::device_timer(emu_timer &timer, device_timer_id tid, int param)
+
+TIMER_CALLBACK_MEMBER(iteagle_fpga_device::assert_vblank_irq)
{
//int beamy = m_screen->vpos();
//const rectangle &visarea = m_screen->visible_area();
@@ -229,7 +230,7 @@ void iteagle_fpga_device::device_timer(emu_timer &timer, device_timer_id tid, in
m_fpga_regs[0x04 / 4] |= 0x00080000;
m_cpu->set_input_line(m_irq_num, ASSERT_LINE);
if (LOG_FPGA)
- logerror("%s:fpga device_timer Setting interrupt(%i)\n", machine().describe_context(), m_irq_num);
+ logerror("%s:fpga assert_vblank_irq Setting interrupt(%i)\n", machine().describe_context(), m_irq_num);
}
WRITE_LINE_MEMBER(iteagle_fpga_device::vblank_update)
diff --git a/src/mame/machine/iteagle_fpga.h b/src/mame/machine/iteagle_fpga.h
index 391934e7898..e7d4ead2a82 100644
--- a/src/mame/machine/iteagle_fpga.h
+++ b/src/mame/machine/iteagle_fpga.h
@@ -64,9 +64,10 @@ public:
protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_add_mconfig(machine_config &config) override;
+ TIMER_CALLBACK_MEMBER(assert_vblank_irq);
+
private:
required_device<nvram_device> m_rtc;
optional_device<nvram_device> m_e1_nvram;
diff --git a/src/mame/machine/itech8.cpp b/src/mame/machine/itech8.cpp
index 4a3e2e5dcef..22b9685dfde 100644
--- a/src/mame/machine/itech8.cpp
+++ b/src/mame/machine/itech8.cpp
@@ -482,7 +482,7 @@ uint8_t itech8_state::slikshot_z80_control_r()
*
*************************************/
-TIMER_CALLBACK_MEMBER( itech8_state::delayed_z80_control_w )
+TIMER_CALLBACK_MEMBER(itech8_state::delayed_z80_control_w)
{
int data = param;
@@ -509,7 +509,7 @@ TIMER_CALLBACK_MEMBER( itech8_state::delayed_z80_control_w )
void itech8_state::slikshot_z80_control_w(uint8_t data)
{
- synchronize(TIMER_DELAYED_Z80_CONTROL, data);
+ machine().scheduler().synchronize(timer_expired_delegate(FUNC(itech8_state::delayed_z80_control_w), this), data);
}
diff --git a/src/mame/machine/jaleco_ms32_sysctrl.cpp b/src/mame/machine/jaleco_ms32_sysctrl.cpp
index 17884d9efec..1ef2c744750 100644
--- a/src/mame/machine/jaleco_ms32_sysctrl.cpp
+++ b/src/mame/machine/jaleco_ms32_sysctrl.cpp
@@ -130,8 +130,8 @@ void jaleco_ms32_sysctrl_device::device_start()
save_item(NAME(m_timer.irq_enable));
save_item(NAME(m_timer.interval));
- m_timer.prg_irq = timer_alloc(PRG_TIMER);
- m_timer_scanline = timer_alloc(SCANLINE_TIMER);
+ m_timer.prg_irq = timer_alloc(FUNC(jaleco_ms32_sysctrl_device::prg_timer_tick), this);
+ m_timer_scanline = timer_alloc(FUNC(jaleco_ms32_sysctrl_device::flush_scanline_timer), this);
}
@@ -177,8 +177,10 @@ void jaleco_ms32_sysctrl_device::flush_prg_timer()
m_timer.prg_irq->adjust(step);
}
-void jaleco_ms32_sysctrl_device::flush_scanline_timer(int current_scanline)
+TIMER_CALLBACK_MEMBER(jaleco_ms32_sysctrl_device::flush_scanline_timer)
{
+ int current_scanline = param;
+
// in typical Jaleco fashion (cfr. mega system 1), both irqs are somehow configurable (a pin?).
// Examples are tp2ms32 and wpksocv2, wanting vblank as vector 9 and field as 10 otherwise they runs
// at half speed, but then their config can't possibly work with p47aces (i.e. wants 10 and 9 respectively),
@@ -197,18 +199,10 @@ void jaleco_ms32_sysctrl_device::flush_scanline_timer(int current_scanline)
m_timer_scanline->adjust(m_screen->time_until_pos(next_scanline), next_scanline);
}
-void jaleco_ms32_sysctrl_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(jaleco_ms32_sysctrl_device::prg_timer_tick)
{
- switch (id)
- {
- case SCANLINE_TIMER:
- flush_scanline_timer(param);
- break;
- case PRG_TIMER:
- m_prg_timer_cb(1);
- flush_prg_timer();
- break;
- }
+ m_prg_timer_cb(1);
+ flush_prg_timer();
}
//*****************************************************************************
diff --git a/src/mame/machine/jaleco_ms32_sysctrl.h b/src/mame/machine/jaleco_ms32_sysctrl.h
index 8f10db9a887..8a303747ffe 100644
--- a/src/mame/machine/jaleco_ms32_sysctrl.h
+++ b/src/mame/machine/jaleco_ms32_sysctrl.h
@@ -51,7 +51,8 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(prg_timer_tick);
private:
required_device<screen_device> m_screen;
@@ -94,14 +95,9 @@ private:
}m_timer;
emu_timer *m_timer_scanline;
- enum timer_id
- {
- SCANLINE_TIMER = 1,
- PRG_TIMER
- };
- inline void flush_prg_timer();
- inline void flush_scanline_timer(int current_scanline);
+ void flush_prg_timer();
+ TIMER_CALLBACK_MEMBER(flush_scanline_timer);
bool m_invert_vblank_lines;
};
diff --git a/src/mame/machine/k573fpga.cpp b/src/mame/machine/k573fpga.cpp
index f11b80eebd6..4e85563af1f 100644
--- a/src/mame/machine/k573fpga.cpp
+++ b/src/mame/machine/k573fpga.cpp
@@ -50,7 +50,7 @@ void k573fpga_device::device_start()
save_item(NAME(counter_base));
save_item(NAME(is_mpeg_frame_synced));
- m_stream_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(k573fpga_device::update_stream), this));
+ m_stream_timer = timer_alloc(FUNC(k573fpga_device::update_stream), this);
m_stream_timer->adjust(attotime::never);
}
diff --git a/src/mame/machine/k573kara.cpp b/src/mame/machine/k573kara.cpp
index 3f38fa3ac66..6421c85b58b 100644
--- a/src/mame/machine/k573kara.cpp
+++ b/src/mame/machine/k573kara.cpp
@@ -112,10 +112,6 @@ void k573kara_device::device_add_mconfig(machine_config &config)
duart_chan0.out_rts_callback().set("rs232_chan0", FUNC(rs232_port_device::write_rts));
}
-void k573kara_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
-}
-
uint16_t k573kara_device::io_r()
{
// Stage platforms can be connected through the RJ45 ports and the data returned through here.
diff --git a/src/mame/machine/k573kara.h b/src/mame/machine/k573kara.h
index c551b5b088a..fb8d3e64865 100644
--- a/src/mame/machine/k573kara.h
+++ b/src/mame/machine/k573kara.h
@@ -20,7 +20,6 @@ protected:
virtual void device_reset() override;
virtual const tiny_rom_entry *device_rom_region() const override;
virtual void device_add_mconfig(machine_config &config) override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
private:
uint16_t uart_r(offs_t offset);
diff --git a/src/mame/machine/k7659kb.cpp b/src/mame/machine/k7659kb.cpp
index f5aaadde9a9..9ff45834d8b 100644
--- a/src/mame/machine/k7659kb.cpp
+++ b/src/mame/machine/k7659kb.cpp
@@ -197,6 +197,7 @@ ioport_constructor k7659_keyboard_device::device_input_ports() const
k7659_keyboard_device::k7659_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, K7659_KEYBOARD, tag, owner, clock)
+ , m_keys(*this, "A%u", 1U)
{}
@@ -206,7 +207,7 @@ k7659_keyboard_device::k7659_keyboard_device(const machine_config &mconfig, cons
void k7659_keyboard_device::device_start()
{
- m_timer = timer_alloc();
+ m_timer = timer_alloc(FUNC(k7659_keyboard_device::scan_keyboard), this);
// state saving
save_item(NAME(m_lookup));
save_item(NAME(m_key));
@@ -224,21 +225,21 @@ void k7659_keyboard_device::device_reset()
m_timer->adjust(attotime::from_hz(200), 0, attotime::from_hz(200));
}
-void k7659_keyboard_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(k7659_keyboard_device::scan_keyboard)
{
uint8_t retVal = 0;//m_lookup;
- uint8_t a1 = ioport("A1")->read();
- uint8_t a2 = ioport("A2")->read();
- uint8_t a3 = ioport("A3")->read();
- uint8_t a4 = ioport("A4")->read();
- uint8_t a5 = ioport("A5")->read();
- uint8_t a6 = ioport("A6")->read();
- uint8_t a7 = ioport("A7")->read();
- uint8_t a8 = ioport("A8")->read();
- uint8_t a9 = ioport("A9")->read();
- uint8_t a10 = ioport("A10")->read();
- uint8_t a11 = ioport("A11")->read();
- uint8_t a12 = ioport("A12")->read();
+ uint8_t a1 = m_keys[0]->read();
+ uint8_t a2 = m_keys[1]->read();
+ uint8_t a3 = m_keys[2]->read();
+ uint8_t a4 = m_keys[3]->read();
+ uint8_t a5 = m_keys[4]->read();
+ uint8_t a6 = m_keys[5]->read();
+ uint8_t a7 = m_keys[6]->read();
+ uint8_t a8 = m_keys[7]->read();
+ uint8_t a9 = m_keys[8]->read();
+ uint8_t a10 = m_keys[9]->read();
+ uint8_t a11 = m_keys[10]->read();
+ uint8_t a12 = m_keys[11]->read();
uint16_t code = 0;
if (a1)
code = 0x10 + key_pos(a1);
diff --git a/src/mame/machine/k7659kb.h b/src/mame/machine/k7659kb.h
index 24e5bed5cb8..e01ba695418 100644
--- a/src/mame/machine/k7659kb.h
+++ b/src/mame/machine/k7659kb.h
@@ -39,16 +39,18 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// optional information overrides
virtual const tiny_rom_entry *device_rom_region() const override;
virtual void device_add_mconfig(machine_config &config) override;
virtual ioport_constructor device_input_ports() const override;
+ TIMER_CALLBACK_MEMBER(scan_keyboard);
+
emu_timer *m_timer = nullptr;
private:
+ required_ioport_array<12> m_keys;
uint8_t key_pos(uint8_t val);
uint8_t m_lookup = 0;
uint8_t m_key = 0;
diff --git a/src/mame/machine/kaneko_calc3.cpp b/src/mame/machine/kaneko_calc3.cpp
index 5daf0485142..306e81b190b 100644
--- a/src/mame/machine/kaneko_calc3.cpp
+++ b/src/mame/machine/kaneko_calc3.cpp
@@ -62,7 +62,7 @@ kaneko_calc3_device::kaneko_calc3_device(const machine_config &mconfig, const ch
void kaneko_calc3_device::device_start()
{
initial_scan_tables();
- m_runtimer = timer_alloc(MCU_RUN_TIMER);
+ m_runtimer = timer_alloc(FUNC(kaneko_calc3_device::mcu_run_trigger), this);
save_item(NAME(m_mcu_status));
save_item(NAME(m_mcu_command_offset));
@@ -95,17 +95,10 @@ void kaneko_calc3_device::reset_run_timer()
m_runtimer->adjust(attotime::from_hz(59.1854));
}
-void kaneko_calc3_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(kaneko_calc3_device::mcu_run_trigger)
{
- switch(id)
- {
- case MCU_RUN_TIMER:
- mcu_run();
- reset_run_timer();
- break;
- default:
- throw emu_fatalerror("Unknown id in kaneko_calc3_device::device_timer");
- }
+ mcu_run();
+ reset_run_timer();
}
/*
diff --git a/src/mame/machine/kaneko_calc3.h b/src/mame/machine/kaneko_calc3.h
index ca9fc97f8ef..49b317504f4 100644
--- a/src/mame/machine/kaneko_calc3.h
+++ b/src/mame/machine/kaneko_calc3.h
@@ -33,7 +33,8 @@ public:
protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(mcu_run_trigger);
private:
required_device<cpu_device> m_maincpu;
@@ -60,11 +61,6 @@ private:
uint16_t m_checksumaddress;
emu_timer* m_runtimer;
- enum
- {
- MCU_RUN_TIMER
- };
-
void mcu_init();
void initial_scan_tables();
void mcu_com_w(offs_t offset, uint16_t data, uint16_t mem_mask, int _n_);
diff --git a/src/mame/machine/kc.cpp b/src/mame/machine/kc.cpp
index 4d1ebef7004..febbb1b5d14 100644
--- a/src/mame/machine/kc.cpp
+++ b/src/mame/machine/kc.cpp
@@ -732,8 +732,8 @@ WRITE_LINE_MEMBER( kc_state::keyboard_cb )
void kc_state::machine_start()
{
- m_cassette_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(kc_state::kc_cassette_timer_callback),this));
- m_cassette_oneshot_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(kc_state::kc_cassette_oneshot_timer),this));
+ m_cassette_timer = timer_alloc(FUNC(kc_state::kc_cassette_timer_callback), this);
+ m_cassette_oneshot_timer = timer_alloc(FUNC(kc_state::kc_cassette_oneshot_timer), this);
m_ram_base = m_ram->pointer();
}
diff --git a/src/mame/machine/kc_keyb.cpp b/src/mame/machine/kc_keyb.cpp
index e2de504f367..2c8190e7d4e 100644
--- a/src/mame/machine/kc_keyb.cpp
+++ b/src/mame/machine/kc_keyb.cpp
@@ -458,8 +458,7 @@ void kc_keyboard_device::device_start()
// resolve callbacks
m_write_out.resolve_safe();
- m_timer_transmit_pulse = timer_alloc(TIMER_TRANSMIT_PULSE);
-
+ m_timer_transmit_pulse = timer_alloc(FUNC(kc_keyboard_device::transmit_pulse), this);
m_timer_transmit_pulse->adjust(attotime::from_usec(1024), 0, attotime::from_usec(1024));
}
@@ -488,61 +487,56 @@ ioport_constructor kc_keyboard_device::device_input_ports() const
}
//-------------------------------------------------
-// device_timer - handler timer events
+// transmit_pulse - update transmit state
//-------------------------------------------------
-void kc_keyboard_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(kc_keyboard_device::transmit_pulse)
{
- switch(id)
+ if (m_transmit_buffer.pulse_sent < m_transmit_buffer.pulse_count)
{
- case TIMER_TRANSMIT_PULSE:
- if (m_transmit_buffer.pulse_sent < m_transmit_buffer.pulse_count)
- {
- // byte containing pulse state
- int pulse_byte_count = m_transmit_buffer.pulse_sent>>3;
- // bit within byte containing pulse state
- int pulse_bit_count = 7 - (m_transmit_buffer.pulse_sent & 0x07);
+ // byte containing pulse state
+ int pulse_byte_count = m_transmit_buffer.pulse_sent>>3;
+ // bit within byte containing pulse state
+ int pulse_bit_count = 7 - (m_transmit_buffer.pulse_sent & 0x07);
- // get current pulse state
- int pulse_state = (m_transmit_buffer.data[pulse_byte_count]>>pulse_bit_count) & 0x01;
+ // get current pulse state
+ int pulse_state = (m_transmit_buffer.data[pulse_byte_count]>>pulse_bit_count) & 0x01;
- LOG("KC keyboard sending pulse: %02x\n", pulse_state);
+ LOG("KC keyboard sending pulse: %02x\n", pulse_state);
- // send pulse
- m_write_out(pulse_state ? ASSERT_LINE : CLEAR_LINE);
+ // send pulse
+ m_write_out(pulse_state ? ASSERT_LINE : CLEAR_LINE);
- // update counts
- m_transmit_buffer.pulse_sent++;
- }
- else
- {
- // if there is nothing to send, rescan the keyboard
- static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", "KEY5", "KEY6", "KEY7" };
+ // update counts
+ m_transmit_buffer.pulse_sent++;
+ }
+ else
+ {
+ // if there is nothing to send, rescan the keyboard
+ static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", "KEY5", "KEY6", "KEY7" };
- m_transmit_buffer.pulse_sent = 0;
- m_transmit_buffer.pulse_count = 0;
+ m_transmit_buffer.pulse_sent = 0;
+ m_transmit_buffer.pulse_count = 0;
- // scan all lines (excluding shift)
- for (int i=0; i<8; i++)
- {
- uint8_t keyboard_line_data = ioport(keynames[i])->read();
+ // scan all lines (excluding shift)
+ for (int i=0; i<8; i++)
+ {
+ uint8_t keyboard_line_data = ioport(keynames[i])->read();
- // scan through each bit
- for (int b=0; b<8; b++)
+ // scan through each bit
+ for (int b=0; b<8; b++)
+ {
+ // is pressed?
+ if ((keyboard_line_data & (1<<b)) != 0)
{
- // is pressed?
- if ((keyboard_line_data & (1<<b)) != 0)
- {
- // generate fake code
- uint8_t code = (i<<3) | b;
- LOG("Code: %02x\n",code);
-
- transmit_scancode(code);
- }
+ // generate fake code
+ uint8_t code = (i<<3) | b;
+ LOG("Code: %02x\n",code);
+
+ transmit_scancode(code);
}
}
}
- break;
}
}
diff --git a/src/mame/machine/kc_keyb.h b/src/mame/machine/kc_keyb.h
index 13ebee7f9e1..c05cb8c1e5e 100644
--- a/src/mame/machine/kc_keyb.h
+++ b/src/mame/machine/kc_keyb.h
@@ -37,15 +37,14 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(transmit_pulse);
void add_pulse_to_transmit_buffer(int pulse_state, int pulse_number = 1);
void add_bit(int bit);
void transmit_scancode(uint8_t scan_code);
private:
- static constexpr device_timer_id TIMER_TRANSMIT_PULSE = 1;
-
// internal state
emu_timer * m_timer_transmit_pulse;
devcb_write_line m_write_out;
diff --git a/src/mame/machine/leland.cpp b/src/mame/machine/leland.cpp
index 894e9771252..29bdba56f70 100644
--- a/src/mame/machine/leland.cpp
+++ b/src/mame/machine/leland.cpp
@@ -306,7 +306,7 @@ void ataxx_state::indyheat_analog_w(offs_t offset, u8 data)
void leland_state::machine_start()
{
/* start scanline interrupts going */
- m_master_int_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(leland_state::leland_interrupt_callback),this));
+ m_master_int_timer = timer_alloc(FUNC(leland_state::leland_interrupt_callback), this);
save_item(NAME(m_dac_control));
save_item(NAME(m_wcol_enable));
@@ -365,7 +365,7 @@ void ataxx_state::machine_start()
m_extra_tram = std::make_unique<u8[]>(ATAXX_EXTRA_TRAM_SIZE);
/* start scanline interrupts going */
- m_master_int_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(leland_state::ataxx_interrupt_callback),this));
+ m_master_int_timer = timer_alloc(FUNC(leland_state::ataxx_interrupt_callback), this);
save_item(NAME(m_wcol_enable));
save_item(NAME(m_dial_last_input));
diff --git a/src/mame/machine/lisa.cpp b/src/mame/machine/lisa.cpp
index 86f472ee854..4fbce2e6555 100644
--- a/src/mame/machine/lisa.cpp
+++ b/src/mame/machine/lisa.cpp
@@ -43,60 +43,30 @@
#include "screen.h"
-/*
- pointers with RAM & ROM location
-*/
-
/* up to 2MB of 68k RAM (normally 1MB or 512kb), generally 16kb of ROM */
/* offsets in "maincpu" */
#define RAM_OFFSET 0x004000
#define ROM_OFFSET 0x000000
-/* 1kb of RAM for 6504 floppy disk controller (shared with 68000), and 4kb of
-ROM (8kb on some boards, but then only one 4kb bank is selected, according to
-the drive type (TWIGGY or 3.5'')) */
-
-/* special ROM (includes S/N) */
-
-
/*
- MMU regs
-*/
-
-
-
+ 1kb of RAM for 6504 floppy disk controller (shared with 68000), and 4kb of
+ ROM (8kb on some boards, but then only one 4kb bank is selected, according to
+ the drive type (TWIGGY or 3.5''))
+ special ROM (includes S/N)
-/*
parity logic - only hard errors are emulated for now, since
a) the ROMs power-up test only tests hard errors
b) most memory boards do not use soft errors (i.e. they only generate 1
parity bit to detect errors, instead of generating several ECC bits to
fix errors)
-*/
-
-
-
-/*
- video
-*/
-
-
-/*
2 vias : one is used for communication with COPS ; the other may be used to interface
a hard disk
*/
/*
- floppy disk interface
-*/
-
-
-
-
-/*
lisa model identification
*/
enum lisa_model_t
@@ -110,14 +80,6 @@ enum lisa_model_t
/*
- protos
-*/
-
-
-
-
-
-/*
Interrupt handling
*/
@@ -558,7 +520,7 @@ TIMER_CALLBACK_MEMBER(lisa_state::set_COPS_ready)
m_via0->write_pb6(m_COPS_Ready);
/* impulsion width : +/- 20us */
- machine().scheduler().timer_set(attotime::from_usec(20), timer_expired_delegate(FUNC(lisa_state::read_COPS_command),this));
+ m_cops_cmd_timer->adjust(attotime::from_usec(20));
}
void lisa_state::reset_COPS()
@@ -934,12 +896,15 @@ void lisa_state::init_mac_xl()
void lisa_state::machine_start()
{
- m_mouse_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(lisa_state::handle_mouse),this));
+ m_mouse_timer = timer_alloc(FUNC(lisa_state::handle_mouse), this);
/* read command every ms (don't know the real value) */
- m_cops_ready_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(lisa_state::set_COPS_ready), this));
+ m_cops_ready_timer = timer_alloc(FUNC(lisa_state::set_COPS_ready), this);
m_cops_ready_timer->adjust(attotime::from_msec(1), 0, attotime::from_msec(1));
+ m_cops_cmd_timer = timer_alloc(FUNC(lisa_state::read_COPS_command), this);
+ m_cops_cmd_timer->adjust(attotime::never);
+
m_nvram->set_base(m_fdc_ram, 1024);
m_fifo_tail = 0;
@@ -989,17 +954,14 @@ void lisa_state::machine_reset()
/* reset COPS keyboard/mouse controller */
init_COPS();
+ m_cops_cmd_timer->adjust(attotime::never);
- {
- COPS_via_out_ca2(0); /* VIA core forgets to do so */
- }
+ COPS_via_out_ca2(0); /* VIA core forgets to do so */
/* initialize floppy */
+ if (m_features.floppy_hardware == sony_lisa2)
{
- if (m_features.floppy_hardware == sony_lisa2)
- {
- sony_set_enable_lines(m_fdc, 1); /* on lisa2, drive unit 1 is always selected (?) */
- }
+ sony_set_enable_lines(m_fdc, 1); /* on lisa2, drive unit 1 is always selected (?) */
}
}
diff --git a/src/mame/machine/lynx.cpp b/src/mame/machine/lynx.cpp
index c00a1accdac..efec05ee408 100644
--- a/src/mame/machine/lynx.cpp
+++ b/src/mame/machine/lynx.cpp
@@ -533,27 +533,6 @@ void lynx_state::blit_lines()
}
}
-void lynx_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_BLITTER:
- blitter_timer(param);
- break;
- case TIMER_SHOT:
- timer_shot(param);
- break;
- case TIMER_UART_LOOPBACK:
- uart_loopback_timer(param);
- break;
- case TIMER_UART:
- uart_timer(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in lynx_state::device_timer");
- }
-}
-
TIMER_CALLBACK_MEMBER(lynx_state::blitter_timer)
{
m_blitter.busy = false; // blitter finished
@@ -730,7 +709,7 @@ void lynx_state::blitter()
}
}
- timer_set(m_maincpu->cycles_to_attotime(m_blitter.memory_accesses), TIMER_BLITTER);
+ m_blitter_timer->adjust(m_maincpu->cycles_to_attotime(m_blitter.memory_accesses));
}
@@ -1342,7 +1321,7 @@ TIM_BORROWOUT EQU %00000001
void lynx_state::timer_init(int which)
{
memset(&m_timer[which], 0, sizeof(LYNX_TIMER));
- m_timer[which].timer = timer_alloc(TIMER_SHOT);
+ m_timer[which].timer = timer_alloc(FUNC(lynx_state::timer_shot), this);
save_item(NAME(m_timer[which].bakup), which);
save_item(NAME(m_timer[which].cntrl1), which);
@@ -1592,14 +1571,14 @@ TIMER_CALLBACK_MEMBER(lynx_state::uart_timer)
{
m_uart.data_to_send = m_uart.buffer;
m_uart.buffer_loaded = false;
- timer_set(attotime::from_usec(11*16), TIMER_UART);
+ m_uart_timer->adjust(attotime::from_usec(11*16));
}
else
{
m_uart.sending = false;
m_uart.received = true;
m_uart.data_received = m_uart.data_to_send;
- timer_set(attotime::from_usec(11*16), TIMER_UART_LOOPBACK);
+ m_loopback_timer->adjust(attotime::from_usec(11*16));
if (m_uart.RXINTEN())
{
interrupt_set(4);
@@ -1659,7 +1638,7 @@ void lynx_state::uart_w(offs_t offset, u8 data)
m_uart.sending = true;
m_uart.data_to_send = data;
// timing not accurate, baude rate should be calculated from timer 4 backup value and clock rate
- timer_set(attotime::from_usec(11*16), TIMER_UART);
+ m_uart_timer->adjust(attotime::from_usec(11*16));
}
break;
}
@@ -2009,6 +1988,10 @@ void lynx_state::machine_start()
for (int i = 0; i < NR_LYNX_TIMERS; i++)
timer_init(i);
+
+ m_blitter_timer = timer_alloc(FUNC(lynx_state::blitter_timer), this);
+ m_loopback_timer = timer_alloc(FUNC(lynx_state::uart_loopback_timer), this);
+ m_uart_timer = timer_alloc(FUNC(lynx_state::uart_timer), this);
}
diff --git a/src/mame/machine/m24_kbd.cpp b/src/mame/machine/m24_kbd.cpp
index bc19f619453..dc45fec3c3c 100644
--- a/src/mame/machine/m24_kbd.cpp
+++ b/src/mame/machine/m24_kbd.cpp
@@ -217,7 +217,7 @@ void m24_keyboard_device::device_start()
{
m_out_data.resolve_safe();
m_out_data(1);
- m_reset_timer = timer_alloc();
+ m_reset_timer = timer_alloc(FUNC(m24_keyboard_device::reset_mcu), this);
}
void m24_keyboard_device::device_reset()
@@ -225,7 +225,7 @@ void m24_keyboard_device::device_reset()
m_kbcdata = true;
}
-void m24_keyboard_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(m24_keyboard_device::reset_mcu)
{
m_mcu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
m_out_data(1);
diff --git a/src/mame/machine/m24_kbd.h b/src/mame/machine/m24_kbd.h
index 69083734950..3e6d44dd540 100644
--- a/src/mame/machine/m24_kbd.h
+++ b/src/mame/machine/m24_kbd.h
@@ -21,11 +21,12 @@ public:
protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual const tiny_rom_entry *device_rom_region() const override;
virtual void device_add_mconfig(machine_config &config) override;
virtual ioport_constructor device_input_ports() const override;
+ TIMER_CALLBACK_MEMBER(reset_mcu);
+
private:
required_ioport_array<16> m_rows;
required_ioport m_mousebtn;
diff --git a/src/mame/machine/m3comm.cpp b/src/mame/machine/m3comm.cpp
index ccd7a84ff74..8b9eeaa40a3 100644
--- a/src/mame/machine/m3comm.cpp
+++ b/src/mame/machine/m3comm.cpp
@@ -138,7 +138,7 @@ m3comm_device::m3comm_device(const machine_config &mconfig, const char *tag, dev
device_t(mconfig, M3COMM, tag, owner, clock),
m_line_rx(OPEN_FLAG_WRITE | OPEN_FLAG_CREATE ),
m_line_tx(OPEN_FLAG_READ),
- m68k_ram(*this, "m68k_ram"),
+ m_68k_ram(*this, "m68k_ram"),
m_commcpu(*this, M68K_TAG),
m_ram(*this, RAM_TAG)
{
@@ -163,8 +163,8 @@ m3comm_device::m3comm_device(const machine_config &mconfig, const char *tag, dev
void m3comm_device::device_start()
{
- timer = timer_alloc(TIMER_IRQ5);
- timer->adjust(attotime::from_usec(10000));
+ m_timer = timer_alloc(FUNC(m3comm_device::trigger_irq5), this);
+ m_timer->adjust(attotime::from_usec(10000));
}
//-------------------------------------------------
@@ -173,8 +173,8 @@ void m3comm_device::device_start()
void m3comm_device::device_reset()
{
- naomi_control = 0xC000;
- naomi_offset = 0;
+ m_naomi_control = 0xC000;
+ m_naomi_offset = 0;
m_status0 = 0;
m_status1 = 0;
m_commbank = 0;
@@ -194,13 +194,10 @@ uint16_t swapb16(uint16_t data)
}
-void m3comm_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(m3comm_device::trigger_irq5)
{
- if(id != TIMER_IRQ5)
- return;
-
m_commcpu->set_input_line(M68K_IRQ_5, ASSERT_LINE);
- timer.adjust(attotime::from_usec(10000)); // there is it from actually ??????
+ m_timer->adjust(attotime::from_usec(10000)); // Where is this timing from, actually?
}
///////////// Internal MMIO
@@ -267,7 +264,7 @@ void m3comm_device::ioregs_w(offs_t offset, uint16_t data, uint16_t mem_mask)
break; // it seems one of these ^v is IRQ6 ON/ACK, another is data transfer enable
case 0x16 / 2: // written 8C at data receive enable, 0 at IRQ6 handler
if ((data & 0xFF) == 0x8C) {
- LOG("M3COMM Receive offs %04x size %04x\n", recv_offset, recv_size);
+ LOG("M3COMM Receive offs %04x size %04x\n", m_recv_offset, m_recv_size);
/*
if (!m_line_rx.is_open())
{
@@ -277,7 +274,7 @@ void m3comm_device::ioregs_w(offs_t offset, uint16_t data, uint16_t mem_mask)
if (m_line_rx.is_open())
{
uint8_t *commram = (uint8_t*)membank("comm_ram")->base();
- m_line_rx.read(&commram[recv_offset], recv_size);
+ m_line_rx.read(&commram[m_recv_offset], m_recv_size);
}
*/
m_commcpu->set_input_line(M68K_IRQ_6, ASSERT_LINE); // debug hack
@@ -287,7 +284,7 @@ void m3comm_device::ioregs_w(offs_t offset, uint16_t data, uint16_t mem_mask)
break; // it seems one of these ^v is IRQ4 ON/ACK, another is data transfer enable
case 0x1C / 2: // written 8C at data transmit enable, 0 at IRQ4 handler
if ((data & 0xFF) == 0x8C) {
- LOG("M3COMM Send offs %04x size %04x\n", send_offset, send_size);
+ LOG("M3COMM Send offs %04x size %04x\n", m_send_offset, m_send_size);
/*
if (!m_line_tx.is_open())
{
@@ -297,23 +294,23 @@ void m3comm_device::ioregs_w(offs_t offset, uint16_t data, uint16_t mem_mask)
if (m_line_tx.is_open())
{
uint8_t *commram = (uint8_t*)membank("comm_ram")->base();
- m_line_tx.write(&commram[send_offset], send_size);
+ m_line_tx.write(&commram[m_send_offset], m_send_size);
}
*/
}
m_commcpu->set_input_line(M68K_IRQ_4, ((data & 0xFF) == 0x8C) ? ASSERT_LINE : CLEAR_LINE); // debug hack
break;
case 0x40 / 2:
- recv_offset = (recv_offset >> 8) | (data << 8);
+ m_recv_offset = (m_recv_offset >> 8) | (data << 8);
break;
case 0x42 / 2:
- recv_size = (recv_size >> 8) | (data << 8);
+ m_recv_size = (m_recv_size >> 8) | (data << 8);
break;
case 0x44 / 2:
- send_offset = (send_offset >> 8) | (data << 8);
+ m_send_offset = (m_send_offset >> 8) | (data << 8);
break;
case 0x46 / 2:
- send_size = (send_size >> 8) | (data << 8);
+ m_send_size = (m_send_size >> 8) | (data << 8);
break;
case 0x88 / 2:
COMBINE_DATA(&m_status0);
@@ -334,12 +331,12 @@ void m3comm_device::ioregs_w(offs_t offset, uint16_t data, uint16_t mem_mask)
uint16_t m3comm_device::m3_m68k_ram_r(offs_t offset)
{
- uint16_t value = m68k_ram[offset]; // FIXME endian
+ uint16_t value = m_68k_ram[offset]; // FIXME endian
return swapb16(value);
}
void m3comm_device::m3_m68k_ram_w(offs_t offset, uint16_t data)
{
- m68k_ram[offset] = swapb16(data); // FIXME endian
+ m_68k_ram[offset] = swapb16(data); // FIXME endian
}
uint8_t m3comm_device::m3_comm_ram_r(offs_t offset)
{
@@ -373,21 +370,21 @@ uint16_t m3comm_device::naomi_r(offs_t offset)
switch (offset)
{
case 0: // 5F7018
- return naomi_control;
+ return m_naomi_control;
case 1: // 5F701C
- return naomi_offset;
+ return m_naomi_offset;
case 2: // 5F7020
{
-// LOG("M3COMM read @ %08x\n", (naomi_control << 16) | naomi_offset);
+// LOG("M3COMM read @ %08x\n", (m_naomi_control << 16) | m_naomi_offset);
uint16_t value;
- if (naomi_control & 1)
- value = m68k_ram[naomi_offset / 2]; // FIXME endian
+ if (m_naomi_control & 1)
+ value = m_68k_ram[m_naomi_offset / 2]; // FIXME endian
else {
uint16_t *commram = (uint16_t*)membank("comm_ram")->base();
- value = commram[naomi_offset / 2]; // FIXME endian
+ value = commram[m_naomi_offset / 2]; // FIXME endian
}
- naomi_offset += 2;
+ m_naomi_offset += 2;
return value;
}
case 3: // 5F7024
@@ -411,21 +408,21 @@ void m3comm_device::naomi_w(offs_t offset, uint16_t data)
// bit 14: G1 DMA bus master 0 - active / 1 - disabled
// bit 15: 0 - enable / 1 - disable this device ???
// LOG("M3COMM control write %04x\n", data);
- naomi_control = data;
- m_commcpu->set_input_line(INPUT_LINE_RESET, (naomi_control & 0x20) ? CLEAR_LINE : ASSERT_LINE);
+ m_naomi_control = data;
+ m_commcpu->set_input_line(INPUT_LINE_RESET, (m_naomi_control & 0x20) ? CLEAR_LINE : ASSERT_LINE);
break;
case 1: // 5F701C
- naomi_offset = data;
+ m_naomi_offset = data;
break;
case 2: // 5F7020
-// LOG("M3COMM write @ %08x %04x\n", (naomi_control << 16) | naomi_offset, data);
- if (naomi_control & 1)
- m68k_ram[naomi_offset / 2] = data; // FIXME endian
+// LOG("M3COMM write @ %08x %04x\n", (m_naomi_control << 16) | m_naomi_offset, data);
+ if (m_naomi_control & 1)
+ m_68k_ram[m_naomi_offset / 2] = data; // FIXME endian
else {
uint16_t *commram = (uint16_t*)membank("comm_ram")->base();
- commram[naomi_offset / 2] = data; // FIXME endian
+ commram[m_naomi_offset / 2] = data; // FIXME endian
}
- naomi_offset += 2;
+ m_naomi_offset += 2;
break;
case 3: // 5F7024
m_status0 = data;
diff --git a/src/mame/machine/m3comm.h b/src/mame/machine/m3comm.h
index 7f63d698424..db1684bdcae 100644
--- a/src/mame/machine/m3comm.h
+++ b/src/mame/machine/m3comm.h
@@ -41,26 +41,25 @@ public:
void m3comm_mem(address_map &map);
protected:
- enum { TIMER_IRQ5 = 1 };
-
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_reset_after_children() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_add_mconfig(machine_config &config) override;
+ TIMER_CALLBACK_MEMBER(trigger_irq5);
+
private:
- uint16_t naomi_control = 0;
- uint16_t naomi_offset = 0;
+ uint16_t m_naomi_control = 0;
+ uint16_t m_naomi_offset = 0;
uint16_t m_status0 = 0;
uint16_t m_status1 = 0;
uint16_t m_commbank = 0;
- uint16_t recv_offset = 0;
- uint16_t recv_size = 0;
- uint16_t send_offset = 0;
- uint16_t send_size = 0;
+ uint16_t m_recv_offset = 0;
+ uint16_t m_recv_size = 0;
+ uint16_t m_send_offset = 0;
+ uint16_t m_send_size = 0;
emu_file m_line_rx; // rx line - can be either differential, simple serial or toslink
@@ -68,9 +67,9 @@ private:
char m_localhost[256]{};
char m_remotehost[256]{};
- emu_timer *timer = nullptr;
+ emu_timer *m_timer = nullptr;
- required_shared_ptr<uint16_t> m68k_ram;
+ required_shared_ptr<uint16_t> m_68k_ram;
required_device<m68000_device> m_commcpu;
required_device<ram_device> m_ram;
};
diff --git a/src/mame/machine/mac.cpp b/src/mame/machine/mac.cpp
index 24d129f8ce3..32206173d16 100644
--- a/src/mame/machine/mac.cpp
+++ b/src/mame/machine/mac.cpp
@@ -1020,19 +1020,19 @@ void mac_state::machine_start()
{
if (m_screen)
{
- this->m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mac_state::mac_scanline_tick),this));
+ this->m_scanline_timer = timer_alloc(FUNC(mac_state::mac_scanline_tick), this);
this->m_scanline_timer->adjust(m_screen->time_until_pos(0, 0));
}
else
{
- m_adbupdate_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mac_state::mac_adbrefresh_tick),this));
+ m_adbupdate_timer = timer_alloc(FUNC(mac_state::mac_adbrefresh_tick), this);
m_adbupdate_timer->adjust(attotime::from_hz(70));
}
if (m_model != MODEL_MAC_IIFX)
- m_6015_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mac_state::mac_6015_tick),this));
+ m_6015_timer = timer_alloc(FUNC(mac_state::mac_6015_tick), this);
else
- m_6015_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mac_state::oss_6015_tick),this));
+ m_6015_timer = timer_alloc(FUNC(mac_state::oss_6015_tick), this);
m_6015_timer->adjust(attotime::never);
}
@@ -1210,7 +1210,7 @@ void mac_state::mac_driver_init(model_t model)
if ((model == MODEL_MAC_CLASSIC_II) || (model == MODEL_MAC_LC) || (model == MODEL_MAC_COLOR_CLASSIC) || (model >= MODEL_MAC_LC_475 && model <= MODEL_MAC_LC_580) ||
(model == MODEL_MAC_LC_II) || (model == MODEL_MAC_LC_III) || (model == MODEL_MAC_LC_III_PLUS) || ((m_model >= MODEL_MAC_II) && (m_model <= MODEL_MAC_SE30)))
{
- m_overlay_timeout = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mac_state::overlay_timeout_func),this));
+ m_overlay_timeout = timer_alloc(FUNC(mac_state::overlay_timeout_func), this);
}
else
{
diff --git a/src/mame/machine/macadb.cpp b/src/mame/machine/macadb.cpp
index 28debf54c4b..0c7ff21b46b 100644
--- a/src/mame/machine/macadb.cpp
+++ b/src/mame/machine/macadb.cpp
@@ -222,7 +222,7 @@ void macadb_device::device_start()
write_adb_data.resolve_safe();
write_adb_irq.resolve_safe();
- this->m_adb_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(macadb_device::mac_adb_tick),this));
+ this->m_adb_timer = timer_alloc(FUNC(macadb_device::mac_adb_tick), this);
this->m_adb_timer->adjust(attotime::never);
std::fill(std::begin(m_adb_buffer), std::end(m_adb_buffer), 0);
diff --git a/src/mame/machine/mace.cpp b/src/mame/machine/mace.cpp
index d2a1f8c12c3..86d5ffebd10 100644
--- a/src/mame/machine/mace.cpp
+++ b/src/mame/machine/mace.cpp
@@ -86,8 +86,8 @@ void mace_device::device_start()
save_item(NAME(m_ust_msc.m_vin2_msc_ust));
save_item(NAME(m_ust_msc.m_vout_msc_ust));
- m_timer_ust = timer_alloc(TIMER_UST);
- m_timer_msc = timer_alloc(TIMER_MSC);
+ m_timer_ust = timer_alloc(FUNC(mace_device::ust_tick), this);
+ m_timer_msc = timer_alloc(FUNC(mace_device::msc_tick), this);
m_timer_ust->adjust(attotime::never);
m_timer_msc->adjust(attotime::never);
}
@@ -440,20 +440,19 @@ void mace_device::rtc_w(offs_t offset, uint64_t data, uint64_t mem_mask)
// TIMERS
//**************************************************************************
-void mace_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(mace_device::ust_tick)
{
- if (id == TIMER_UST)
- {
- m_ust_msc.m_ust++;
- m_ust_msc.m_ust_msc &= 0x00000000ffffffffULL;
- m_ust_msc.m_ust_msc |= (uint64_t)m_ust_msc.m_ust << 32;
- }
- else if (id == TIMER_MSC)
- {
- m_ust_msc.m_msc++;
- m_ust_msc.m_ust_msc &= 0xffffffff00000000ULL;
- m_ust_msc.m_ust_msc |= m_ust_msc.m_msc;
- }
+ m_ust_msc.m_ust++;
+ m_ust_msc.m_ust_msc &= 0x00000000ffffffffULL;
+ m_ust_msc.m_ust_msc |= (uint64_t)m_ust_msc.m_ust << 32;
+ check_ust_msc_compare();
+}
+
+TIMER_CALLBACK_MEMBER(mace_device::msc_tick)
+{
+ m_ust_msc.m_msc++;
+ m_ust_msc.m_ust_msc &= 0xffffffff00000000ULL;
+ m_ust_msc.m_ust_msc |= m_ust_msc.m_msc;
check_ust_msc_compare();
}
diff --git a/src/mame/machine/mace.h b/src/mame/machine/mace.h
index 74ed78030c8..f2a29d94726 100644
--- a/src/mame/machine/mace.h
+++ b/src/mame/machine/mace.h
@@ -35,10 +35,9 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_add_mconfig(machine_config &config) override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
- static const device_timer_id TIMER_MSC = 0;
- static const device_timer_id TIMER_UST = 1;
+ TIMER_CALLBACK_MEMBER(ust_tick);
+ TIMER_CALLBACK_MEMBER(msc_tick);
// UST/MSC Timer
void check_ust_msc_compare();
diff --git a/src/mame/machine/macpci.cpp b/src/mame/machine/macpci.cpp
index 570ca958039..034828222d6 100644
--- a/src/mame/machine/macpci.cpp
+++ b/src/mame/machine/macpci.cpp
@@ -107,7 +107,7 @@ WRITE_LINE_MEMBER(macpci_state::mac_adb_via_out_cb2)
void macpci_state::machine_start()
{
- m_6015_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(macpci_state::mac_6015_tick),this));
+ m_6015_timer = timer_alloc(FUNC(macpci_state::mac_6015_tick), this);
m_6015_timer->adjust(attotime::never);
}
diff --git a/src/mame/machine/macrtc.cpp b/src/mame/machine/macrtc.cpp
index 0d31c3585fd..c286aaf438f 100644
--- a/src/mame/machine/macrtc.cpp
+++ b/src/mame/machine/macrtc.cpp
@@ -54,7 +54,7 @@ rtc3430042_device::rtc3430042_device(const machine_config &mconfig, const char *
void rtc3430042_device::device_start()
{
// allocate timers
- m_clock_timer = timer_alloc();
+ m_clock_timer = timer_alloc(FUNC(rtc3430042_device::seconds_tick), this);
m_clock_timer->adjust(attotime::from_hz(clock() / 32768), 0, attotime::from_hz(clock() / 32768));
// state saving
@@ -76,10 +76,10 @@ void rtc3430042_device::device_reset()
}
//-------------------------------------------------
-// device_timer - handler timer events
+// seconds_tick -
//-------------------------------------------------
-void rtc3430042_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(rtc3430042_device::seconds_tick)
{
advance_seconds();
}
diff --git a/src/mame/machine/macrtc.h b/src/mame/machine/macrtc.h
index f921e7b76b6..66476e63c4c 100644
--- a/src/mame/machine/macrtc.h
+++ b/src/mame/machine/macrtc.h
@@ -38,7 +38,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_rtc_interface overrides
virtual void rtc_clock_updated(int year, int month, int day, int day_of_week, int hour, int minute, int second) override;
@@ -49,6 +48,8 @@ protected:
virtual bool nvram_read(util::read_stream &file) override;
virtual bool nvram_write(util::write_stream &file) override;
+ TIMER_CALLBACK_MEMBER(seconds_tick);
+
private:
/* state of rTCEnb and rTCClk lines */
uint8_t m_rtc_rTCEnb = 0;
diff --git a/src/mame/machine/macscsi.cpp b/src/mame/machine/macscsi.cpp
index 7a06b246ad2..3bc17a15fad 100644
--- a/src/mame/machine/macscsi.cpp
+++ b/src/mame/machine/macscsi.cpp
@@ -96,7 +96,7 @@ void mac_scsi_helper_device::device_resolve_objects()
void mac_scsi_helper_device::device_start()
{
- m_pseudo_dma_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mac_scsi_helper_device::timer_callback), this));
+ m_pseudo_dma_timer = timer_alloc(FUNC(mac_scsi_helper_device::timer_callback), this);
save_item(NAME(m_mode));
save_item(NAME(m_read_fifo_bytes));
diff --git a/src/mame/machine/maple-dc.cpp b/src/mame/machine/maple-dc.cpp
index 60f7008d243..47e44386efd 100644
--- a/src/mame/machine/maple-dc.cpp
+++ b/src/mame/machine/maple-dc.cpp
@@ -38,7 +38,7 @@ void maple_dc_device::register_port(int port, maple_device *device)
void maple_dc_device::device_start()
{
logerror("maple_dc_device started\n");
- timer = timer_alloc(0);
+ timer = timer_alloc(FUNC(maple_dc_device::dma_timer_tick), this);
irq_cb.resolve_safe();
mdstar = 0;
@@ -68,10 +68,8 @@ void maple_dc_device::device_reset()
dma_endflag = false;
}
-void maple_dc_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(maple_dc_device::dma_timer_tick)
{
- timer.adjust(attotime::never);
-
switch(dma_state) {
case DMA_WAIT_REPLY:
dma_state = DMA_TIMEOUT;
diff --git a/src/mame/machine/maple-dc.h b/src/mame/machine/maple-dc.h
index deb405b58d3..45d2efbbec1 100644
--- a/src/mame/machine/maple-dc.h
+++ b/src/mame/machine/maple-dc.h
@@ -49,7 +49,8 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(dma_timer_tick);
private:
enum {
diff --git a/src/mame/machine/mapledev.cpp b/src/mame/machine/mapledev.cpp
index b2a6d11135d..ee4340ee56f 100644
--- a/src/mame/machine/mapledev.cpp
+++ b/src/mame/machine/mapledev.cpp
@@ -14,7 +14,7 @@ void maple_device::device_start()
{
host->register_port(host_port, this);
- timer = timer_alloc(TIMER_ID);
+ timer = timer_alloc(FUNC(maple_device::reply_ready), this);
save_item(NAME(reply_buffer));
save_item(NAME(reply_size));
@@ -26,15 +26,6 @@ void maple_device::maple_reset()
device_reset();
}
-void maple_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- if(id != TIMER_ID)
- return;
-
- timer.adjust(attotime::never);
- reply_ready();
-}
-
void maple_device::reply_ready_with_delay()
{
// Arbitrary delay to avoid instant replies
@@ -43,7 +34,7 @@ void maple_device::reply_ready_with_delay()
timer->adjust(attotime::from_usec(100));
}
-void maple_device::reply_ready()
+TIMER_CALLBACK_MEMBER(maple_device::reply_ready)
{
host->end_of_reply();
}
diff --git a/src/mame/machine/mapledev.h b/src/mame/machine/mapledev.h
index c7bab8597df..2bc3f6d4676 100644
--- a/src/mame/machine/mapledev.h
+++ b/src/mame/machine/mapledev.h
@@ -16,8 +16,6 @@ public:
virtual void maple_reset();
protected:
- enum { TIMER_ID = 1000 };
-
maple_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
uint32_t reply_size = 0;
@@ -26,9 +24,8 @@ protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
- void reply_ready();
+ TIMER_CALLBACK_MEMBER(reply_ready);
void reply_ready_with_delay();
// Copy a string and complete it with spaces up to size len
diff --git a/src/mame/machine/mcr.cpp b/src/mame/machine/mcr.cpp
index 3b4323d94fe..61e99cbe5d3 100644
--- a/src/mame/machine/mcr.cpp
+++ b/src/mame/machine/mcr.cpp
@@ -86,7 +86,7 @@ void mcr_state::machine_start()
void mcr_nflfoot_state::machine_start()
{
/* allocate a timer for the IPU watchdog */
- m_ipu_watchdog_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mcr_nflfoot_state::ipu_watchdog_reset), this));
+ m_ipu_watchdog_timer = timer_alloc(FUNC(mcr_nflfoot_state::ipu_watchdog_reset), this);
}
diff --git a/src/mame/machine/mcr68.cpp b/src/mame/machine/mcr68.cpp
index 9523ebe169f..c8578c5a1ba 100644
--- a/src/mame/machine/mcr68.cpp
+++ b/src/mame/machine/mcr68.cpp
@@ -20,9 +20,16 @@
*
*************************************/
+void mcr68_state::machine_start()
+{
+ m_493_on_timer = timer_alloc(FUNC(mcr68_state::mcr68_493_callback), this);
+ m_493_off_timer = timer_alloc(FUNC(mcr68_state::mcr68_493_off_callback), this);
+}
+
void mcr68_state::machine_reset()
-{ /* for the most part all MCR/68k games are the same */
- m_v493_callback = timer_expired_delegate(FUNC(mcr68_state::mcr68_493_callback),this);
+{
+ m_493_on_timer->adjust(attotime::never);
+ m_493_off_timer->adjust(attotime::never);
}
@@ -47,7 +54,7 @@ TIMER_DEVICE_CALLBACK_MEMBER( mcr68_state::scanline_cb )
/* also set a timer to generate the 493 signal at a specific time before the next VBLANK */
/* the timing of this is crucial for Blasted and Tri-Sports, which check the timing of */
/* VBLANK and 493 using counter 2 */
- machine().scheduler().timer_set(attotime::from_hz(30) - m_timing_factor, m_v493_callback);
+ m_493_on_timer->adjust(attotime::from_hz(30) - m_timing_factor);
}
// HSYNC
@@ -72,7 +79,7 @@ TIMER_CALLBACK_MEMBER(mcr68_state::mcr68_493_off_callback)
TIMER_CALLBACK_MEMBER(mcr68_state::mcr68_493_callback)
{
m_maincpu->set_input_line(1, ASSERT_LINE);
- machine().scheduler().timer_set(m_screen->scan_period(), timer_expired_delegate(FUNC(mcr68_state::mcr68_493_off_callback),this));
+ m_493_off_timer->adjust(m_screen->scan_period());
if (VERBOSE)
logerror("--- (INT1) ---\n");
diff --git a/src/mame/machine/mct_adr.cpp b/src/mame/machine/mct_adr.cpp
index 81dc3db6907..943f512931c 100644
--- a/src/mame/machine/mct_adr.cpp
+++ b/src/mame/machine/mct_adr.cpp
@@ -152,9 +152,9 @@ void mct_adr_device::device_start()
m_ioc_physical_tag = 0;
m_ioc_logical_tag = 0;
- m_irq_check = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mct_adr_device::irq_check), this));
- m_dma_check = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mct_adr_device::dma_check), this));
- m_interval_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mct_adr_device::interval_timer), this));
+ m_irq_check = timer_alloc(FUNC(mct_adr_device::irq_check), this);
+ m_dma_check = timer_alloc(FUNC(mct_adr_device::dma_check), this);
+ m_interval_timer = timer_alloc(FUNC(mct_adr_device::interval_timer), this);
m_out_int_timer_asserted = false;
m_out_int_device_asserted = false;
diff --git a/src/mame/machine/mega32x.cpp b/src/mame/machine/mega32x.cpp
index 75cd4728eb5..bf741a87502 100644
--- a/src/mame/machine/mega32x.cpp
+++ b/src/mame/machine/mega32x.cpp
@@ -1734,7 +1734,7 @@ void sega_32x_device::device_start()
}
m_stream = stream_alloc(2, 2, 48000 * 4);
- m_32x_pwm_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sega_32x_device::handle_pwm_callback), this));
+ m_32x_pwm_timer = timer_alloc(FUNC(sega_32x_device::handle_pwm_callback), this);
m_32x_dram0 = std::make_unique<uint16_t[]>(0x40000/2);
m_32x_dram1 = std::make_unique<uint16_t[]>(0x40000/2);
diff --git a/src/mame/machine/megadriv.cpp b/src/mame/machine/megadriv.cpp
index 3f4d649db2c..f7513e21b51 100644
--- a/src/mame/machine/megadriv.cpp
+++ b/src/mame/machine/megadriv.cpp
@@ -649,7 +649,7 @@ void md_base_state::megadriv_68k_req_z80_bus(offs_t offset, uint16_t data, uint1
/* If the z80 is running, sync the z80 execution state */
if (!m_genz80.z80_is_reset)
- machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(md_base_state::megadriv_z80_run_state),this));
+ m_genz80.z80_run_timer->adjust(attotime::zero);
}
void md_base_state::megadriv_68k_req_z80_reset(offs_t offset, uint16_t data, uint16_t mem_mask)
@@ -693,7 +693,7 @@ void md_base_state::megadriv_68k_req_z80_reset(offs_t offset, uint16_t data, uin
m_genz80.z80_is_reset = 1;
}
}
- machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(md_base_state::megadriv_z80_run_state),this));
+ m_genz80.z80_run_timer->adjust(attotime::zero);
}
@@ -824,6 +824,9 @@ void md_base_state::machine_start()
save_item(NAME(m_megadrive_io_data_regs));
save_item(NAME(m_megadrive_io_ctrl_regs));
save_item(NAME(m_megadrive_io_tx_regs));
+
+ if (m_z80snd)
+ m_genz80.z80_run_timer = timer_alloc(FUNC(md_base_state::megadriv_z80_run_state), this);
}
void md_base_state::machine_reset()
@@ -837,7 +840,7 @@ void md_base_state::machine_reset()
m_genz80.z80_has_bus = 1;
m_genz80.z80_bank_addr = 0;
m_vdp->set_scanline_counter(-1);
- machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(md_base_state::megadriv_z80_run_state),this));
+ m_genz80.z80_run_timer->adjust(attotime::zero);
}
megadrive_reset_io();
diff --git a/src/mame/machine/mhavoc.cpp b/src/mame/machine/mhavoc.cpp
index 60bdc933683..49419f2bd3c 100644
--- a/src/mame/machine/mhavoc.cpp
+++ b/src/mame/machine/mhavoc.cpp
@@ -79,6 +79,8 @@ void mhavoc_state::machine_start()
save_item(NAME(m_gamma_irq_clock));
save_item(NAME(m_speech_write_buffer));
+
+ m_gamma_sync_timer = machine().scheduler().timer_alloc(timer_expired_delegate());
}
diff --git a/src/mame/machine/micro3d.cpp b/src/mame/machine/micro3d.cpp
index 5b4758b8767..a5103f2135b 100644
--- a/src/mame/machine/micro3d.cpp
+++ b/src/mame/machine/micro3d.cpp
@@ -125,18 +125,6 @@ static inline int64_t normalised_multiply(int32_t a, int32_t b)
return result >> 14;
}
-void micro3d_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_MAC_DONE:
- mac_done_callback(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in micro3d_state::device_timer");
- }
-}
-
TIMER_CALLBACK_MEMBER(micro3d_state::mac_done_callback)
{
m_drmath->set_input_line(AM29000_INTR0, ASSERT_LINE);
@@ -334,7 +322,7 @@ void micro3d_state::micro3d_mac2_w(uint32_t data)
/* TODO: Calculate a better estimate for timing */
if (m_mac_stat)
- timer_set(attotime::from_hz(MAC_CLK) * mac_cycles, TIMER_MAC_DONE);
+ m_mac_done_timer->adjust(attotime::from_hz(MAC_CLK) * mac_cycles);
m_mrab11 = mrab11;
m_vtx_addr = vtx_addr;
@@ -530,9 +518,15 @@ void micro3d_state::init_botss()
init_micro3d();
}
+void micro3d_state::machine_start()
+{
+ m_mac_done_timer = timer_alloc(FUNC(micro3d_state::mac_done_callback), this);
+}
+
void micro3d_state::machine_reset()
{
m_vgb->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
m_drmath->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
m_audiocpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
+ m_mac_done_timer->adjust(attotime::never);
}
diff --git a/src/mame/machine/microtan.cpp b/src/mame/machine/microtan.cpp
index 2c9504c5ff4..0a3c2f07feb 100644
--- a/src/mame/machine/microtan.cpp
+++ b/src/mame/machine/microtan.cpp
@@ -365,7 +365,7 @@ void microtan_state::init_microtan()
{
init_gfx2();
- m_pulse_nmi_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(microtan_state::pulse_nmi), this));
+ m_pulse_nmi_timer = timer_alloc(FUNC(microtan_state::pulse_nmi), this);
}
void microtan_state::machine_start()
diff --git a/src/mame/machine/midikbd.cpp b/src/mame/machine/midikbd.cpp
index 5fd3cbdb85c..3ec87ae9613 100644
--- a/src/mame/machine/midikbd.cpp
+++ b/src/mame/machine/midikbd.cpp
@@ -13,71 +13,66 @@ midi_keyboard_device::midi_keyboard_device(const machine_config &mconfig, const
{
}
-void midi_keyboard_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(midi_keyboard_device::scan_keyboard)
{
- if(!id)
+ const int keyboard_notes[24] =
{
- const int keyboard_notes[24] =
- {
- 0x3c, // C1
- 0x3d, // C1#
- 0x3e, // D1
- 0x3f, // D1#
- 0x40, // E1
- 0x41, // F1
- 0x42, // F1#
- 0x43, // G1
- 0x44, // G1#
- 0x45, // A1
- 0x46, // A1#
- 0x47, // B1
- 0x48, // C2
- 0x49, // C2#
- 0x4a, // D2
- 0x4b, // D2#
- 0x4c, // E2
- 0x4d, // F2
- 0x4e, // F2#
- 0x4f, // G2
- 0x50, // G2#
- 0x51, // A2
- 0x52, // A2#
- 0x53, // B2
- };
-
- int i;
+ 0x3c, // C1
+ 0x3d, // C1#
+ 0x3e, // D1
+ 0x3f, // D1#
+ 0x40, // E1
+ 0x41, // F1
+ 0x42, // F1#
+ 0x43, // G1
+ 0x44, // G1#
+ 0x45, // A1
+ 0x46, // A1#
+ 0x47, // B1
+ 0x48, // C2
+ 0x49, // C2#
+ 0x4a, // D2
+ 0x4b, // D2#
+ 0x4c, // E2
+ 0x4d, // F2
+ 0x4e, // F2#
+ 0x4f, // G2
+ 0x50, // G2#
+ 0x51, // A2
+ 0x52, // A2#
+ 0x53, // B2
+ };
- uint32_t kbstate = m_keyboard->read();
- if(kbstate != m_keyboard_state)
+ uint32_t kbstate = m_keyboard->read();
+ if (kbstate != m_keyboard_state)
+ {
+ for (int i = 0; i < 24; i++)
{
- for (i=0; i < 24; i++)
- {
- int kbnote = keyboard_notes[i];
+ int kbnote = keyboard_notes[i];
- if ((m_keyboard_state & (1 << i)) != 0 && (kbstate & (1 << i)) == 0)
- {
- // key was on, now off -> send Note Off message
- push_tx(0x80);
- push_tx(kbnote);
- push_tx(0x7f);
- }
- else if ((m_keyboard_state & (1 << i)) == 0 && (kbstate & (1 << i)) != 0)
- {
- // key was off, now on -> send Note On message
- push_tx(0x90);
- push_tx(kbnote);
- push_tx(0x7f);
- }
+ if ((m_keyboard_state & (1 << i)) != 0 && (kbstate & (1 << i)) == 0)
+ {
+ // key was on, now off -> send Note Off message
+ push_tx(0x80);
+ push_tx(kbnote);
+ push_tx(0x7f);
+ }
+ else if ((m_keyboard_state & (1 << i)) == 0 && (kbstate & (1 << i)) != 0)
+ {
+ // key was off, now on -> send Note On message
+ push_tx(0x90);
+ push_tx(kbnote);
+ push_tx(0x7f);
}
}
- else
- // no messages, send Active Sense message instead
- push_tx(0xfe);
-
- m_keyboard_state = kbstate;
- if(is_transmit_register_empty())
- tra_complete();
}
+ else
+ // no messages, send Active Sense message instead
+ push_tx(0xfe);
+
+ m_keyboard_state = kbstate;
+ if (is_transmit_register_empty())
+ tra_complete();
}
void midi_keyboard_device::device_start()
@@ -86,7 +81,7 @@ void midi_keyboard_device::device_start()
set_tra_rate(clock());
m_out_tx_func.resolve_safe();
m_head = m_tail = 0;
- m_keyboard_timer = timer_alloc();
+ m_keyboard_timer = timer_alloc(FUNC(midi_keyboard_device::scan_keyboard), this);
m_keyboard_timer->adjust(attotime::from_msec(10), 0, attotime::from_msec(10));
}
@@ -97,7 +92,7 @@ void midi_keyboard_device::tra_callback()
void midi_keyboard_device::tra_complete()
{
- if(m_head != m_tail)
+ if (m_head != m_tail)
{
transmit_register_setup(m_buffer[m_tail]);
++m_tail %= 16;
diff --git a/src/mame/machine/midikbd.h b/src/mame/machine/midikbd.h
index f9cdc05fed3..9048153f530 100644
--- a/src/mame/machine/midikbd.h
+++ b/src/mame/machine/midikbd.h
@@ -17,10 +17,11 @@ public:
auto tx_callback() { return m_out_tx_func.bind(); }
protected:
- void device_start() override;
- void tra_callback() override;
- void tra_complete() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ virtual void device_start() override;
+ virtual void tra_callback() override;
+ virtual void tra_complete() override;
+
+ TIMER_CALLBACK_MEMBER(scan_keyboard);
private:
void push_tx(uint8_t data) { ++m_head %= 16; m_buffer[m_head] = data; }
diff --git a/src/mame/machine/midwayic.cpp b/src/mame/machine/midwayic.cpp
index 5ea2fe4d74d..eae2ab7d165 100644
--- a/src/mame/machine/midwayic.cpp
+++ b/src/mame/machine/midwayic.cpp
@@ -375,7 +375,7 @@ void midway_serial_pic2_device::device_start()
//m_yearoffs = yearoffs;
m_time_just_written = 0;
- m_time_write_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(midway_serial_pic2_device::reset_timer),this));
+ m_time_write_timer = timer_alloc(FUNC(midway_serial_pic2_device::reset_timer), this);
memset(m_default_nvram, 0xff, sizeof(m_default_nvram));
}
diff --git a/src/mame/machine/mie.cpp b/src/mame/machine/mie.cpp
index 9ea80066912..77639bd5ea8 100644
--- a/src/mame/machine/mie.cpp
+++ b/src/mame/machine/mie.cpp
@@ -89,7 +89,7 @@ mie_device::mie_device(const machine_config &mconfig, const char *tag, device_t
void mie_device::device_start()
{
maple_device::device_start();
- timer = timer_alloc(0);
+ timer = timer_alloc(FUNC(mie_device::update_irq_reply), this);
save_item(NAME(gpiodir));
save_item(NAME(gpio_val));
@@ -143,16 +143,15 @@ void mie_device::control_w(offs_t offset, uint8_t data)
}
}
-void mie_device::device_timer(emu_timer &_timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(mie_device::update_irq_reply)
{
- timer->adjust(attotime::never);
if(control & CTRL_RXB) {
control &= ~CTRL_RXB;
control |= CTRL_RFB;
raise_irq(maple_irqlevel);
}
if(control & (CTRL_TXB|CTRL_CTXB)) {
- reply_ready();
+ reply_ready(0);
lreg -= reply_size;
if(reply_partial) {
control &= ~CTRL_CTXB;
@@ -312,7 +311,7 @@ void mie_device::lreg_w(uint8_t data)
uint8_t mie_device::jvs_r()
{
- if (jvs_lcr & 0x80)
+ if(jvs_lcr & 0x80)
return 0;
const uint8_t *buf;
@@ -325,7 +324,7 @@ uint8_t mie_device::jvs_r()
void mie_device::jvs_w(uint8_t data)
{
- if (jvs_lcr & 0x80)
+ if(jvs_lcr & 0x80)
return;
jvs->push(data);
diff --git a/src/mame/machine/mie.h b/src/mame/machine/mie.h
index 1f72056cf9a..17dc7ddad8d 100644
--- a/src/mame/machine/mie.h
+++ b/src/mame/machine/mie.h
@@ -83,12 +83,13 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// optional information overrides
virtual const tiny_rom_entry *device_rom_region() const override;
virtual void device_add_mconfig(machine_config &config) override;
+ TIMER_CALLBACK_MEMBER(update_irq_reply);
+
private:
enum { TBUF_SIZE = 8 };
diff --git a/src/mame/machine/mips_rambo.cpp b/src/mame/machine/mips_rambo.cpp
index 017d24fef77..892575ced58 100644
--- a/src/mame/machine/mips_rambo.cpp
+++ b/src/mame/machine/mips_rambo.cpp
@@ -73,9 +73,9 @@ void mips_rambo_device::device_start()
ch.write_cb.resolve_safe();
}
- m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mips_rambo_device::timer), this));
- m_dma = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mips_rambo_device::dma), this));
- m_buzzer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mips_rambo_device::buzzer), this));
+ m_timer = timer_alloc(FUNC(mips_rambo_device::timer), this);
+ m_dma = timer_alloc(FUNC(mips_rambo_device::dma), this);
+ m_buzzer = timer_alloc(FUNC(mips_rambo_device::buzzer), this);
}
void mips_rambo_device::device_reset()
diff --git a/src/mame/machine/mm1kb.cpp b/src/mame/machine/mm1kb.cpp
index 800b73c5b30..9b7c2080223 100644
--- a/src/mame/machine/mm1kb.cpp
+++ b/src/mame/machine/mm1kb.cpp
@@ -211,11 +211,6 @@ mm1_keyboard_device::mm1_keyboard_device(const machine_config &mconfig, const ch
{
}
-enum
-{
- SCAN_TIMER,
-};
-
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
@@ -226,7 +221,7 @@ void mm1_keyboard_device::device_start()
m_write_kbst.resolve_safe();
// allocate timers
- m_scan_timer = timer_alloc(SCAN_TIMER);
+ m_scan_timer = timer_alloc(FUNC(mm1_keyboard_device::scan_keyboard), this);
m_scan_timer->adjust(attotime::from_hz(clock()), 0, attotime::from_hz(clock()));
// add notification request for system shut down (to play back the power switch sound once more)
@@ -244,10 +239,10 @@ void mm1_keyboard_device::shut_down_mm1()
}
//-------------------------------------------------
-// device_timer - handler timer events
+// scan_keyboard
//-------------------------------------------------
-void mm1_keyboard_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(mm1_keyboard_device::scan_keyboard)
{
// handle scan timer
uint8_t data = 0xff;
diff --git a/src/mame/machine/mm1kb.h b/src/mame/machine/mm1kb.h
index 5d019c3daa4..3a38b086a0a 100644
--- a/src/mame/machine/mm1kb.h
+++ b/src/mame/machine/mm1kb.h
@@ -48,13 +48,14 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// optional information overrides
virtual const tiny_rom_entry *device_rom_region() const override;
virtual void device_add_mconfig(machine_config &config) override;
virtual ioport_constructor device_input_ports() const override;
+ TIMER_CALLBACK_MEMBER(scan_keyboard);
+
private:
devcb_write_line m_write_kbst;
diff --git a/src/mame/machine/mpu4.cpp b/src/mame/machine/mpu4.cpp
index 00e59359ef8..9d2ccbdc2e6 100644
--- a/src/mame/machine/mpu4.cpp
+++ b/src/mame/machine/mpu4.cpp
@@ -693,15 +693,10 @@ void mpu4_state::ic24_setup()
}
-void mpu4_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(mpu4_state::update_ic24)
{
- switch(id)
- {
- case TIMER_IC24:
- m_ic23_active=0;
- ic24_output(1);
- break;
- }
+ m_ic23_active=0;
+ ic24_output(1);
}
@@ -1256,10 +1251,10 @@ all eight meters are driven from this port, giving the 8 line driver chip
//This may be overkill, but the meter sensing is VERY picky
- int combined_meter = m_meters->GetActivity(0) | m_meters->GetActivity(1) |
- m_meters->GetActivity(2) | m_meters->GetActivity(3) |
- m_meters->GetActivity(4) | m_meters->GetActivity(5) |
- m_meters->GetActivity(6) | m_meters->GetActivity(7);
+ int combined_meter = m_meters->get_activity(0) | m_meters->get_activity(1) |
+ m_meters->get_activity(2) | m_meters->get_activity(3) |
+ m_meters->get_activity(4) | m_meters->get_activity(5) |
+ m_meters->get_activity(6) | m_meters->get_activity(7);
if(combined_meter)
{
@@ -2167,7 +2162,7 @@ void mpu4_state::mpu4_config_common()
m_digits.resolve();
m_triacs.resolve();
- m_ic24_timer = timer_alloc(TIMER_IC24);
+ m_ic24_timer = timer_alloc(FUNC(mpu4_state::update_ic24), this);
m_lamp_strobe_ext_persistence = 0;
}
diff --git a/src/mame/machine/mw8080bw.cpp b/src/mame/machine/mw8080bw.cpp
index cbdd0f70a65..482b7f1bb9a 100644
--- a/src/mame/machine/mw8080bw.cpp
+++ b/src/mame/machine/mw8080bw.cpp
@@ -99,7 +99,7 @@ IRQ_CALLBACK_MEMBER(mw8080bw_state::interrupt_vector)
void mw8080bw_state::mw8080bw_create_interrupt_timer( )
{
- m_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mw8080bw_state::interrupt_trigger),this));
+ m_interrupt_timer = timer_alloc(FUNC(mw8080bw_state::interrupt_trigger), this);
}
diff --git a/src/mame/machine/n64.cpp b/src/mame/machine/n64.cpp
index e29569aa1b0..ea066f44335 100644
--- a/src/mame/machine/n64.cpp
+++ b/src/mame/machine/n64.cpp
@@ -116,12 +116,12 @@ void n64_periphs::poll_reset_button(bool button)
void n64_periphs::device_start()
{
- ai_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(n64_periphs::ai_timer_callback),this));
- pi_dma_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(n64_periphs::pi_dma_callback),this));
- si_dma_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(n64_periphs::si_dma_callback),this));
- vi_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(n64_periphs::vi_scanline_callback),this));
- dp_delay_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(n64_periphs::dp_delay_callback),this));
- reset_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(n64_periphs::reset_timer_callback),this));
+ ai_timer = timer_alloc(FUNC(n64_periphs::ai_timer_callback), this);
+ pi_dma_timer = timer_alloc(FUNC(n64_periphs::pi_dma_callback), this);
+ si_dma_timer = timer_alloc(FUNC(n64_periphs::si_dma_callback), this);
+ vi_scanline_timer = timer_alloc(FUNC(n64_periphs::vi_scanline_callback), this);
+ dp_delay_timer = timer_alloc(FUNC(n64_periphs::dp_delay_callback), this);
+ reset_timer = timer_alloc(FUNC(n64_periphs::reset_timer_callback), this);
m_n64 = machine().driver_data<n64_state>();
}
diff --git a/src/mame/machine/namco06.cpp b/src/mame/machine/namco06.cpp
index df37c79d1c6..a64e5c45e7d 100644
--- a/src/mame/machine/namco06.cpp
+++ b/src/mame/machine/namco06.cpp
@@ -268,7 +268,7 @@ void namco_06xx_device::device_start()
m_write.resolve_all_safe();
/* allocate a timer */
- m_nmi_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(namco_06xx_device::nmi_generate),this));
+ m_nmi_timer = timer_alloc(FUNC(namco_06xx_device::nmi_generate), this);
save_item(NAME(m_control));
save_item(NAME(m_next_timer_state));
diff --git a/src/mame/machine/namcos21_dsp.cpp b/src/mame/machine/namcos21_dsp.cpp
index 14810b43f07..49ee6e38777 100644
--- a/src/mame/machine/namcos21_dsp.cpp
+++ b/src/mame/machine/namcos21_dsp.cpp
@@ -29,7 +29,7 @@ namcos21_dsp_device::namcos21_dsp_device(const machine_config &mconfig, const ch
void namcos21_dsp_device::device_start()
{
m_winrun_dspcomram = std::make_unique<uint16_t[]>(0x1000*2);
- m_suspend_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(namcos21_dsp_device::suspend_callback),this));
+ m_suspend_timer = timer_alloc(FUNC(namcos21_dsp_device::suspend_callback), this);
m_pointram = std::make_unique<uint8_t[]>(PTRAM_SIZE);
m_pointram_idx = 0;
diff --git a/src/mame/machine/naomig1.cpp b/src/mame/machine/naomig1.cpp
index 716714e1da2..2b8ccab0845 100644
--- a/src/mame/machine/naomig1.cpp
+++ b/src/mame/machine/naomig1.cpp
@@ -36,7 +36,7 @@ naomi_g1_device::naomi_g1_device(const machine_config &mconfig, device_type type
void naomi_g1_device::device_start()
{
- timer = timer_alloc(G1_TIMER_ID);
+ timer = timer_alloc(FUNC(naomi_g1_device::trigger_gdrom_irq), this);
irq_cb.resolve_safe();
ext_irq_cb.resolve_safe();
reset_out_cb.resolve_safe();
@@ -58,9 +58,8 @@ void naomi_g1_device::device_reset()
set_ext_irq(CLEAR_LINE);
}
-void naomi_g1_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(naomi_g1_device::trigger_gdrom_irq)
{
- timer.adjust(attotime::never);
if(!gdst)
return;
gdst = 0;
diff --git a/src/mame/machine/naomig1.h b/src/mame/machine/naomig1.h
index 32560d4eab9..924c3712aa5 100644
--- a/src/mame/machine/naomig1.h
+++ b/src/mame/machine/naomig1.h
@@ -51,13 +51,10 @@ public:
uint32_t sb_gdlend_r(offs_t offset, uint32_t mem_mask = ~0); // 5f74f8
protected:
- enum { G1_TIMER_ID = 0x42 };
-
naomi_g1_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void dma_get_position(uint8_t *&base, uint32_t &limit, bool to_maincpu) = 0;
virtual void dma_advance(uint32_t size) = 0;
@@ -65,6 +62,8 @@ protected:
void set_ext_irq(int state) { ext_irq_cb(state); }
void set_reset_out() { reset_out_cb(ASSERT_LINE); }
+ TIMER_CALLBACK_MEMBER(trigger_gdrom_irq);
+
private:
uint32_t gdstar, gdlen, gddir, gden, gdst;
diff --git a/src/mame/machine/nb1412m2.cpp b/src/mame/machine/nb1412m2.cpp
index 9e4ea2761d3..dd1a134df68 100644
--- a/src/mame/machine/nb1412m2.cpp
+++ b/src/mame/machine/nb1412m2.cpp
@@ -158,9 +158,9 @@ void nb1412m2_device::device_start()
save_item(NAME(m_const90));
save_item(NAME(m_timer_rate));
- m_timer = timer_alloc(TIMER_MAIN);
+ m_timer = timer_alloc(FUNC(nb1412m2_device::main_timer_tick), this);
m_timer->adjust(attotime::never);
- m_dac_timer = timer_alloc(TIMER_DAC);
+ m_dac_timer = timer_alloc(FUNC(nb1412m2_device::update_dac), this);
m_dac_cb.resolve_safe();
}
@@ -184,29 +184,24 @@ void nb1412m2_device::device_reset()
m_dac_timer->adjust(attotime::never);
}
-void nb1412m2_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nb1412m2_device::main_timer_tick)
{
- switch (id)
+ m_timer_reg = true;
+}
+
+TIMER_CALLBACK_MEMBER(nb1412m2_device::update_dac)
+{
+ if(m_dac_playback == true)
{
- case TIMER_MAIN:
- m_timer_reg = true;
- m_timer->adjust(attotime::never);
- break;
- case TIMER_DAC:
- if(m_dac_playback == true)
- {
- uint8_t dac_value;
- dac_value = m_data[m_dac_current_address];
- m_dac_cb(dac_value);
- m_dac_current_address++;
- m_dac_current_address &= m_data.length() - 1;
- if(dac_value == 0x80)
- m_dac_playback = false;
- }
-
- break;
- default:
- throw emu_fatalerror("Unknown id in nb1412m2_device::device_timer");
+ uint8_t dac_value;
+ dac_value = m_data[m_dac_current_address];
+ m_dac_cb(dac_value);
+ m_dac_current_address++;
+ m_dac_current_address &= m_data.length() - 1;
+ if(dac_value == 0x80)
+ {
+ m_dac_playback = false;
+ }
}
}
diff --git a/src/mame/machine/nb1412m2.h b/src/mame/machine/nb1412m2.h
index ca6074c3ccb..f91b3110767 100644
--- a/src/mame/machine/nb1412m2.h
+++ b/src/mame/machine/nb1412m2.h
@@ -39,9 +39,11 @@ protected:
// virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual space_config_vector memory_space_config() const override;
+ TIMER_CALLBACK_MEMBER(main_timer_tick);
+ TIMER_CALLBACK_MEMBER(update_dac);
+
private:
uint8_t m_command;
uint16_t m_rom_address;
@@ -60,9 +62,6 @@ private:
required_region_ptr<uint8_t> m_data;
devcb_write8 m_dac_cb;
- static const device_timer_id TIMER_MAIN = 1;
- static const device_timer_id TIMER_DAC = 2;
-
void rom_address_w(offs_t offset, uint8_t data);
uint8_t rom_decrypt_r();
void rom_op_w(uint8_t data);
diff --git a/src/mame/machine/nb1413m3.cpp b/src/mame/machine/nb1413m3.cpp
index cf7a26baa54..03400207522 100644
--- a/src/mame/machine/nb1413m3.cpp
+++ b/src/mame/machine/nb1413m3.cpp
@@ -55,7 +55,7 @@ nb1413m3_device::nb1413m3_device(const machine_config &mconfig, const char *tag,
void nb1413m3_device::device_start()
{
m_led.resolve();
- m_timer_cb = timer_alloc(TIMER_CB);
+ m_timer_cb = timer_alloc(FUNC(nb1413m3_device::timer_callback), this);
m_timer_cb->adjust(attotime::zero);
save_item(NAME(m_nb1413m3_type));
@@ -103,18 +103,6 @@ void nb1413m3_device::device_reset()
DEVICE HANDLERS
*****************************************************************************/
-void nb1413m3_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_CB:
- timer_callback(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in nb1413m3_device::device_timer");
- }
-}
-
/* TODO: is all of this actually programmable? */
TIMER_CALLBACK_MEMBER( nb1413m3_device::timer_callback )
{
diff --git a/src/mame/machine/nb1413m3.h b/src/mame/machine/nb1413m3.h
index b33033d3c0c..baa1d51b660 100644
--- a/src/mame/machine/nb1413m3.h
+++ b/src/mame/machine/nb1413m3.h
@@ -139,11 +139,6 @@ public:
// configuration helpers
void set_type(int type) { m_nb1413m3_type = type; }
- enum
- {
- TIMER_CB
- };
-
void nmi_clock_w(uint8_t data);
uint8_t sndrom_r(address_space &space, offs_t offset);
void sndrombank1_w(uint8_t data);
@@ -180,7 +175,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
private:
diff --git a/src/mame/machine/nes_vt_soc.cpp b/src/mame/machine/nes_vt_soc.cpp
index a3b87525f5b..4f86276c97d 100644
--- a/src/mame/machine/nes_vt_soc.cpp
+++ b/src/mame/machine/nes_vt_soc.cpp
@@ -427,17 +427,17 @@ void nes_vt02_vt03_soc_device::chr_w(offs_t offset, uint8_t data)
-void nes_vt02_vt03_soc_device::scanline_irq(int scanline, int vblank, int blanked)
+void nes_vt02_vt03_soc_device::scanline_irq(int scanline, bool vblank, bool blanked)
{
video_irq(false, scanline, vblank, blanked);
}
-void nes_vt02_vt03_soc_device::hblank_irq(int scanline, int vblank, int blanked)
+void nes_vt02_vt03_soc_device::hblank_irq(int scanline, bool vblank, bool blanked)
{
video_irq(true, scanline, vblank, blanked);
}
-void nes_vt02_vt03_soc_device::video_irq(bool hblank, int scanline, int vblank, int blanked)
+void nes_vt02_vt03_soc_device::video_irq(bool hblank, int scanline, bool vblank, bool blanked)
{
//TSYNEN
if (((m_410x[0xb] >> 7) & 0x01) == hblank)
diff --git a/src/mame/machine/nes_vt_soc.h b/src/mame/machine/nes_vt_soc.h
index 8fd5e21acf6..9a1cb3f6caf 100644
--- a/src/mame/machine/nes_vt_soc.h
+++ b/src/mame/machine/nes_vt_soc.h
@@ -80,9 +80,9 @@ protected:
uint8_t spr_r(offs_t offset);
uint8_t chr_r(offs_t offset);
void chr_w(offs_t offset, uint8_t data);
- void scanline_irq(int scanline, int vblank, int blanked);
- void hblank_irq(int scanline, int vblank, int blanked);
- void video_irq(bool hblank, int scanline, int vblank, int blanked);
+ void scanline_irq(int scanline, bool vblank, bool blanked);
+ void hblank_irq(int scanline, bool vblank, bool blanked);
+ void video_irq(bool hblank, int scanline, bool vblank, bool blanked);
uint8_t nt_r(offs_t offset);
void nt_w(offs_t offset, uint8_t data);
int calculate_real_video_address(int addr, int extended, int readtype);
diff --git a/src/mame/machine/nextkbd.cpp b/src/mame/machine/nextkbd.cpp
index eadc0606563..deb6036f76c 100644
--- a/src/mame/machine/nextkbd.cpp
+++ b/src/mame/machine/nextkbd.cpp
@@ -33,7 +33,7 @@ void nextkbd_device::device_start()
int_power_cb.resolve_safe();
int_nmi_cb.resolve_safe();
- poll_timer = timer_alloc(0);
+ poll_timer = timer_alloc(FUNC(nextkbd_device::update_tick), this);
save_item(NAME(ctrl_snd));
save_item(NAME(ctrl_kms));
@@ -124,7 +124,7 @@ void nextkbd_device::update_mouse(bool force_update)
send();
}
-void nextkbd_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nextkbd_device::update_tick)
{
if(!fifo_empty())
send();
diff --git a/src/mame/machine/nextkbd.h b/src/mame/machine/nextkbd.h
index 60e6d84735e..f07afaf405a 100644
--- a/src/mame/machine/nextkbd.h
+++ b/src/mame/machine/nextkbd.h
@@ -35,9 +35,10 @@ public:
protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual ioport_constructor device_input_ports() const override;
+ TIMER_CALLBACK_MEMBER(update_tick);
+
private:
// Big thanks to the previous emulator for that information
enum {
diff --git a/src/mame/machine/osborne1.cpp b/src/mame/machine/osborne1.cpp
index 0b18cfe1193..840ff50d22f 100644
--- a/src/mame/machine/osborne1.cpp
+++ b/src/mame/machine/osborne1.cpp
@@ -279,13 +279,13 @@ void osborne1_state::machine_start()
m_bank_fxxx->configure_entries(0, 1, m_ram->pointer() + 0xF000, 0);
m_bank_fxxx->configure_entries(1, 1, m_ram->pointer() + 0x10000, 0);
- m_video_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(osborne1_state::video_callback), this));
+ m_video_timer = timer_alloc(FUNC(osborne1_state::video_callback), this);
m_tilemap = &machine().tilemap().create(
*m_gfxdecode,
tilemap_get_info_delegate(*this, FUNC(osborne1_state::get_tile_info)), TILEMAP_SCAN_ROWS,
8, 10, 128, 32);
- m_acia_rxc_txc_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(osborne1_state::acia_rxc_txc_callback), this));
+ m_acia_rxc_txc_timer = timer_alloc(FUNC(osborne1_state::acia_rxc_txc_callback), this);
m_maincpu->space(AS_PROGRAM).cache(m_mem_cache);
diff --git a/src/mame/machine/p2000t_mdcr.cpp b/src/mame/machine/p2000t_mdcr.cpp
index 8e6fa4d2a83..c9559ab50ed 100644
--- a/src/mame/machine/p2000t_mdcr.cpp
+++ b/src/mame/machine/p2000t_mdcr.cpp
@@ -101,7 +101,7 @@ mdcr_device::mdcr_device(machine_config const &mconfig, char const *tag, device_
void mdcr_device::device_start()
{
- m_read_timer = timer_alloc();
+ m_read_timer = timer_alloc(FUNC(mdcr_device::read_timer_tick), this);
m_read_timer->adjust(attotime::from_hz(44100), 0, attotime::from_hz(44100));
save_item(NAME(m_fwd));
@@ -132,7 +132,7 @@ void mdcr_device::device_post_load()
m_cassette->seek(m_save_tape_time, SEEK_SET);
}
-void mdcr_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(mdcr_device::read_timer_tick)
{
if (!m_recording && m_cassette->motor_on())
{
diff --git a/src/mame/machine/p2000t_mdcr.h b/src/mame/machine/p2000t_mdcr.h
index d114414e257..4c5ebce9d39 100644
--- a/src/mame/machine/p2000t_mdcr.h
+++ b/src/mame/machine/p2000t_mdcr.h
@@ -75,10 +75,10 @@ protected:
virtual void device_start() override;
virtual void device_pre_save() override;
virtual void device_post_load() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
virtual void device_add_mconfig(machine_config &config) override;
+ TIMER_CALLBACK_MEMBER(read_timer_tick);
+
private:
/// \brief A Phase Decoder used in a Philips MDCR220 Mini Cassette Recorder
///
diff --git a/src/mame/machine/pc1512kb.cpp b/src/mame/machine/pc1512kb.cpp
index 288bdb476ac..91dc17bea62 100644
--- a/src/mame/machine/pc1512kb.cpp
+++ b/src/mame/machine/pc1512kb.cpp
@@ -226,7 +226,7 @@ void pc1512_keyboard_device::device_start()
{
m_leds.resolve();
// allocate timers
- m_reset_timer = timer_alloc();
+ m_reset_timer = timer_alloc(FUNC(pc1512_keyboard_device::reset_timer_tick), this);
// resolve callbacks
m_write_clock.resolve_safe();
@@ -253,10 +253,10 @@ void pc1512_keyboard_device::device_reset()
//-------------------------------------------------
-// device_timer - handler timer events
+// reset_timer_tick - reset the keyboard
//-------------------------------------------------
-void pc1512_keyboard_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(pc1512_keyboard_device::reset_timer_tick)
{
if (!m_clock_in)
{
diff --git a/src/mame/machine/pc1512kb.h b/src/mame/machine/pc1512kb.h
index 538f8c51998..d6a69f29061 100644
--- a/src/mame/machine/pc1512kb.h
+++ b/src/mame/machine/pc1512kb.h
@@ -48,13 +48,14 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// optional information overrides
virtual const tiny_rom_entry *device_rom_region() const override;
virtual void device_add_mconfig(machine_config &config) override;
virtual ioport_constructor device_input_ports() const override;
+ TIMER_CALLBACK_MEMBER(reset_timer_tick);
+
private:
enum
{
diff --git a/src/mame/machine/pc80s31k.cpp b/src/mame/machine/pc80s31k.cpp
index bb3004c8204..1b85cff8daa 100644
--- a/src/mame/machine/pc80s31k.cpp
+++ b/src/mame/machine/pc80s31k.cpp
@@ -295,13 +295,11 @@ void pc80s31_device::device_add_mconfig(machine_config &config)
}
//-------------------------------------------------
-// device_timer - device-specific timers
+// tc_zero_tick
//-------------------------------------------------
-void pc80s31_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(pc80s31_device::tc_zero_tick)
{
- assert(id == 0);
-
m_fdc->tc_w(false);
// several games tries to scan invalid IDs from their structures, if this hits then
@@ -326,7 +324,7 @@ void pc80s31_device::device_timer(emu_timer &timer, device_timer_id id, int para
void pc80s31_device::device_start()
{
- m_tc_zero_timer = timer_alloc(0);
+ m_tc_zero_timer = timer_alloc(FUNC(pc80s31_device::tc_zero_tick), this);
save_item(NAME(m_irq_vector));
}
diff --git a/src/mame/machine/pc80s31k.h b/src/mame/machine/pc80s31k.h
index 4d08610455b..f54d0d511bb 100644
--- a/src/mame/machine/pc80s31k.h
+++ b/src/mame/machine/pc80s31k.h
@@ -38,10 +38,11 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual const tiny_rom_entry *device_rom_region() const override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void fdc_io(address_map &map);
+ TIMER_CALLBACK_MEMBER(tc_zero_tick);
+
required_device<upd765a_device> m_fdc;
required_device_array<floppy_connector, 2> m_floppy;
u8 m_irq_vector = 0;
diff --git a/src/mame/machine/pc9801_kbd.cpp b/src/mame/machine/pc9801_kbd.cpp
index 12dc4eaa2e9..26ce6a92409 100644
--- a/src/mame/machine/pc9801_kbd.cpp
+++ b/src/mame/machine/pc9801_kbd.cpp
@@ -47,11 +47,11 @@ pc9801_kbd_device::pc9801_kbd_device(const machine_config &mconfig, const char *
INPUT_CHANGED_MEMBER(pc9801_kbd_device::key_stroke)
{
- if(newval && !oldval)
- m_rx_buf[uint8_t(param) & 0x7f] = 1;
+ if (newval && !oldval)
+ m_rx_buf[param & 0x7f] = 1;
- if(oldval && !newval)
- m_rx_buf[uint8_t(param) & 0x7f] = 2;
+ if (oldval && !newval)
+ m_rx_buf[param & 0x7f] = 2;
}
static INPUT_PORTS_START( pc9801_kbd )
@@ -240,7 +240,7 @@ void pc9801_kbd_device::device_start()
{
m_write_irq.resolve_safe();
- m_rxtimer = timer_alloc(RX_TIMER);
+ m_rxtimer = timer_alloc(FUNC(pc9801_kbd_device::rx_timer_tick), this);
m_rxtimer->adjust(attotime::from_hz(clock()), 0, attotime::from_hz(clock()));
}
@@ -251,9 +251,7 @@ void pc9801_kbd_device::device_start()
void pc9801_kbd_device::device_reset()
{
- int i;
-
- for(i=0;i<0x80;i++)
+ for (int i = 0; i < 0x80; i++)
m_rx_buf[i] = 0;
m_keyb_tx = 0xff;
@@ -262,39 +260,34 @@ void pc9801_kbd_device::device_reset()
}
//-------------------------------------------------
-// device_timer - handler timer events
+// rx_timer_tick
//-------------------------------------------------
-void pc9801_kbd_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(pc9801_kbd_device::rx_timer_tick)
{
- if(id == RX_TIMER)
+ /* key up */
+ for (int i = 0; i < 0x80; i++)
{
- int i;
-
- /* key up */
- for(i=0;i<0x80;i++)
+ if (m_rx_buf[i] == 2)
{
- if(m_rx_buf[i] == 2)
- {
- m_keyb_tx = i | 0x80;
- m_write_irq(ASSERT_LINE);
- m_key_avail = true;
- m_rx_buf[i] = 0;
- return;
- }
+ m_keyb_tx = i | 0x80;
+ m_write_irq(ASSERT_LINE);
+ m_key_avail = true;
+ m_rx_buf[i] = 0;
+ return;
}
+ }
- /* key down */
- for(i=0x7f;i>=0;i--)
+ /* key down */
+ for (int i = 0x7f; i >= 0; i--)
+ {
+ if (m_rx_buf[i] == 1)
{
- if(m_rx_buf[i] == 1)
- {
- m_keyb_tx = i;
- m_write_irq(ASSERT_LINE);
- m_key_avail = true;
- m_rx_buf[i] = 0;
- return;
- }
+ m_keyb_tx = i;
+ m_write_irq(ASSERT_LINE);
+ m_key_avail = true;
+ m_rx_buf[i] = 0;
+ return;
}
}
}
@@ -306,7 +299,7 @@ void pc9801_kbd_device::device_timer(emu_timer &timer, device_timer_id id, int p
uint8_t pc9801_kbd_device::rx_r(offs_t offset)
{
m_write_irq(CLEAR_LINE);
- if(!offset)
+ if (!offset)
{
m_key_avail = false;
return m_keyb_tx;
diff --git a/src/mame/machine/pc9801_kbd.h b/src/mame/machine/pc9801_kbd.h
index 80c8aaa81d2..b9c0aaa9523 100644
--- a/src/mame/machine/pc9801_kbd.h
+++ b/src/mame/machine/pc9801_kbd.h
@@ -37,15 +37,15 @@ protected:
virtual void device_validity_check(validity_checker &valid) const override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
- devcb_write_line m_write_irq;
+ TIMER_CALLBACK_MEMBER(rx_timer_tick);
+
+ devcb_write_line m_write_irq;
- static const device_timer_id RX_TIMER = 1;
emu_timer * m_rxtimer;
- uint8_t m_rx_buf[0x80];
- uint8_t m_keyb_tx;
- uint8_t m_keyb_rx;
+ uint8_t m_rx_buf[0x80];
+ uint8_t m_keyb_tx;
+ uint8_t m_keyb_rx;
bool m_key_avail;
};
diff --git a/src/mame/machine/pce220_ser.cpp b/src/mame/machine/pce220_ser.cpp
index 7854fdc8c09..b88088fcafd 100644
--- a/src/mame/machine/pce220_ser.cpp
+++ b/src/mame/machine/pce220_ser.cpp
@@ -64,8 +64,8 @@ pce220_serial_device::~pce220_serial_device()
void pce220_serial_device::device_start()
{
- m_send_timer = timer_alloc(TIMER_SEND);
- m_receive_timer = timer_alloc(TIMER_RECEIVE);
+ m_send_timer = timer_alloc(FUNC(pce220_serial_device::send_tick), this);
+ m_receive_timer = timer_alloc(FUNC(pce220_serial_device::receive_tick), this);
m_send_timer->reset();
m_receive_timer->reset();
}
@@ -85,85 +85,31 @@ void pce220_serial_device::device_reset()
//-------------------------------------------------
-// device_timer - handler timer events
+// timer events
//-------------------------------------------------
-void pce220_serial_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(pce220_serial_device::send_tick)
{
- if (id == TIMER_SEND && m_enabled)
+ if (!m_enabled)
{
- //send data
- if (m_bytes_count <= length())
- {
- switch(m_state)
- {
- case SIO_WAIT:
- m_ack = 1; //data send request
- //waits until is ready to receive
- if(!m_busy)
- return;
- break;
- case SIO_SEND_START:
- //send start bit
- m_xin = 1;
- break;
- case SIO_SEND_BIT0:
- case SIO_SEND_BIT1:
- case SIO_SEND_BIT2:
- case SIO_SEND_BIT3:
- case SIO_SEND_BIT4:
- case SIO_SEND_BIT5:
- case SIO_SEND_BIT6:
- case SIO_SEND_BIT7:
- m_xin = BIT(~m_current_byte, m_state - SIO_SEND_BIT0);
- break;
- case SIO_SEND_PARITY:
- m_xin = calc_parity(m_current_byte);
- break;
- case SIO_SEND_STOP1:
- case SIO_SEND_STOP2:
- //stop bit
- m_xin = m_ack = 0;
- break;
- }
-
- if (m_state == (SIO_SEND_PARITY + SIO_STOP_BIT))
- {
- //next byte
- m_bytes_count++;
- popmessage("Send %d/%d bytes\n", m_bytes_count , (uint32_t)length());
- m_state = SIO_WAIT;
- if (m_bytes_count < length())
- fread(&m_current_byte, 1);
- else
- m_current_byte = SIO_EOT_BYTE;
- }
- else
- {
- m_state = get_next_state();
- }
-
- }
- else
- {
- m_din = m_xin = m_ack = 0;
- }
+ m_din = m_xin = m_ack = 0;
+ return;
}
- else if (id == TIMER_RECEIVE && m_enabled)
+
+ //send data
+ if (m_bytes_count <= length())
{
- //receive data
switch(m_state)
{
case SIO_WAIT:
- //wait send request
- if(m_busy)
+ m_ack = 1; //data send request
+ //waits until is ready to receive
+ if(!m_busy)
return;
- m_ack = 1; //acknowledge
break;
case SIO_SEND_START:
- //wait for the start bit
- if (!m_xout)
- return;
+ //send start bit
+ m_xin = 1;
break;
case SIO_SEND_BIT0:
case SIO_SEND_BIT1:
@@ -173,16 +119,15 @@ void pce220_serial_device::device_timer(emu_timer &timer, device_timer_id id, in
case SIO_SEND_BIT5:
case SIO_SEND_BIT6:
case SIO_SEND_BIT7:
- m_current_byte |= ((~m_xout)&1) << (m_state - SIO_SEND_BIT0);
+ m_xin = BIT(~m_current_byte, m_state - SIO_SEND_BIT0);
break;
case SIO_SEND_PARITY:
- if (m_xout != calc_parity(m_current_byte))
- logerror("SIO %s: byte %d has wrong parity!\n", tag(), m_bytes_count);
+ m_xin = calc_parity(m_current_byte);
break;
case SIO_SEND_STOP1:
case SIO_SEND_STOP2:
- //receive stop bit
- m_ack = 0;
+ //stop bit
+ m_xin = m_ack = 0;
break;
}
@@ -190,16 +135,18 @@ void pce220_serial_device::device_timer(emu_timer &timer, device_timer_id id, in
{
//next byte
m_bytes_count++;
- popmessage("Received %d bytes\n", m_bytes_count);
+ popmessage("Send %d/%d bytes\n", m_bytes_count , (uint32_t)length());
m_state = SIO_WAIT;
- if (m_current_byte != SIO_EOT_BYTE)
- fwrite(&m_current_byte, 1);
- m_current_byte = 0;
+ if (m_bytes_count < length())
+ fread(&m_current_byte, 1);
+ else
+ m_current_byte = SIO_EOT_BYTE;
}
else
{
m_state = get_next_state();
}
+
}
else
{
@@ -207,6 +154,65 @@ void pce220_serial_device::device_timer(emu_timer &timer, device_timer_id id, in
}
}
+TIMER_CALLBACK_MEMBER(pce220_serial_device::receive_tick)
+{
+ if (!m_enabled)
+ {
+ m_din = m_xin = m_ack = 0;
+ return;
+ }
+
+ //receive data
+ switch(m_state)
+ {
+ case SIO_WAIT:
+ //wait send request
+ if(m_busy)
+ return;
+ m_ack = 1; //acknowledge
+ break;
+ case SIO_SEND_START:
+ //wait for the start bit
+ if (!m_xout)
+ return;
+ break;
+ case SIO_SEND_BIT0:
+ case SIO_SEND_BIT1:
+ case SIO_SEND_BIT2:
+ case SIO_SEND_BIT3:
+ case SIO_SEND_BIT4:
+ case SIO_SEND_BIT5:
+ case SIO_SEND_BIT6:
+ case SIO_SEND_BIT7:
+ m_current_byte |= ((~m_xout)&1) << (m_state - SIO_SEND_BIT0);
+ break;
+ case SIO_SEND_PARITY:
+ if (m_xout != calc_parity(m_current_byte))
+ logerror("SIO %s: byte %d has wrong parity!\n", tag(), m_bytes_count);
+ break;
+ case SIO_SEND_STOP1:
+ case SIO_SEND_STOP2:
+ //receive stop bit
+ m_ack = 0;
+ break;
+ }
+
+ if (m_state == (SIO_SEND_PARITY + SIO_STOP_BIT))
+ {
+ //next byte
+ m_bytes_count++;
+ popmessage("Received %d bytes\n", m_bytes_count);
+ m_state = SIO_WAIT;
+ if (m_current_byte != SIO_EOT_BYTE)
+ fwrite(&m_current_byte, 1);
+ m_current_byte = 0;
+ }
+ else
+ {
+ m_state = get_next_state();
+ }
+}
+
/*-------------------------------------------------
DEVICE_IMAGE_LOAD( pce220_serial )
-------------------------------------------------*/
diff --git a/src/mame/machine/pce220_ser.h b/src/mame/machine/pce220_ser.h
index f9e5e3c927c..9ba165cd0af 100644
--- a/src/mame/machine/pce220_ser.h
+++ b/src/mame/machine/pce220_ser.h
@@ -59,26 +59,25 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(send_tick);
+ TIMER_CALLBACK_MEMBER(receive_tick);
private:
// internal device state
- static const device_timer_id TIMER_SEND = 0;
- static const device_timer_id TIMER_RECEIVE = 1;
-
emu_timer* m_send_timer = nullptr; // timer for send data
emu_timer* m_receive_timer = nullptr; // timer for receive data
- uint8_t m_state = 0; // transfer status
- uint32_t m_bytes_count = 0; // number of bytes transferred
- uint8_t m_current_byte = 0; // byte in transfer
- uint8_t m_enabled = 0; // enable/disable
-
- uint8_t m_busy = 0; // CTS
- uint8_t m_dout = 0; // DTR
- uint8_t m_xout = 0; // TXD
- uint8_t m_xin = 0; // RXD
- uint8_t m_din = 0; // DSR
- uint8_t m_ack = 0; // RTS
+ uint8_t m_state = 0; // transfer status
+ uint32_t m_bytes_count = 0; // number of bytes transferred
+ uint8_t m_current_byte = 0; // byte in transfer
+ uint8_t m_enabled = 0; // enable/disable
+
+ uint8_t m_busy = 0; // CTS
+ uint8_t m_dout = 0; // DTR
+ uint8_t m_xout = 0; // TXD
+ uint8_t m_xin = 0; // RXD
+ uint8_t m_din = 0; // DSR
+ uint8_t m_ack = 0; // RTS
};
// device type definition
diff --git a/src/mame/machine/pce_cd.cpp b/src/mame/machine/pce_cd.cpp
index 8667f48fc53..5b82e4fc944 100644
--- a/src/mame/machine/pce_cd.cpp
+++ b/src/mame/machine/pce_cd.cpp
@@ -145,21 +145,24 @@ void pce_cd_device::device_start()
m_subcode_buffer = std::make_unique<uint8_t[]>(96);
- m_data_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pce_cd_device::data_timer_callback),this));
+ m_data_timer = timer_alloc(FUNC(pce_cd_device::data_timer_callback), this);
m_data_timer->adjust(attotime::never);
- m_adpcm_dma_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pce_cd_device::adpcm_dma_timer_callback),this));
+ m_adpcm_dma_timer = timer_alloc(FUNC(pce_cd_device::adpcm_dma_timer_callback), this);
m_adpcm_dma_timer->adjust(attotime::never);
- m_cdda_fadeout_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pce_cd_device::cdda_fadeout_callback),this));
+ m_cdda_fadeout_timer = timer_alloc(FUNC(pce_cd_device::cdda_fadeout_callback), this);
m_cdda_fadeout_timer->adjust(attotime::never);
- m_cdda_fadein_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pce_cd_device::cdda_fadein_callback),this));
+ m_cdda_fadein_timer = timer_alloc(FUNC(pce_cd_device::cdda_fadein_callback), this);
m_cdda_fadein_timer->adjust(attotime::never);
- m_adpcm_fadeout_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pce_cd_device::adpcm_fadeout_callback),this));
+ m_adpcm_fadeout_timer = timer_alloc(FUNC(pce_cd_device::adpcm_fadeout_callback), this);
m_adpcm_fadeout_timer->adjust(attotime::never);
- m_adpcm_fadein_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pce_cd_device::adpcm_fadein_callback),this));
+ m_adpcm_fadein_timer = timer_alloc(FUNC(pce_cd_device::adpcm_fadein_callback), this);
m_adpcm_fadein_timer->adjust(attotime::never);
+ m_ack_clear_timer = timer_alloc(FUNC(pce_cd_device::clear_ack), this);
+ m_ack_clear_timer->adjust(attotime::never);
+
// m_cd_file pointer is setup at a later stage because it is still empty when this function is called
// TODO: add proper restore for the cd data...
@@ -1446,7 +1449,7 @@ uint8_t pce_cd_device::get_cd_data_byte()
if (m_scsi_IO)
{
m_scsi_ACK = 1;
- machine().scheduler().timer_set(m_maincpu->cycles_to_attotime(15), timer_expired_delegate(FUNC(pce_cd_device::clear_ack),this));
+ m_ack_clear_timer->adjust(m_maincpu->cycles_to_attotime(15));
}
}
return data;
diff --git a/src/mame/machine/pce_cd.h b/src/mame/machine/pce_cd.h
index e9d9595349c..30882f1d099 100644
--- a/src/mame/machine/pce_cd.h
+++ b/src/mame/machine/pce_cd.h
@@ -205,10 +205,12 @@ private:
emu_timer *m_cdda_fadeout_timer = nullptr;
emu_timer *m_cdda_fadein_timer = nullptr;
- double m_cdda_volume = 0;
+ double m_cdda_volume = 0;
emu_timer *m_adpcm_fadeout_timer = nullptr;
emu_timer *m_adpcm_fadein_timer = nullptr;
- double m_adpcm_volume = 0;
+ double m_adpcm_volume = 0;
+
+ emu_timer *m_ack_clear_timer = nullptr;
DECLARE_WRITE_LINE_MEMBER(msm5205_int);
void nvram_init(nvram_device &nvram, void *data, size_t size);
diff --git a/src/mame/machine/playch10.cpp b/src/mame/machine/playch10.cpp
index 7e625b4df08..5f26d5f1b0f 100644
--- a/src/mame/machine/playch10.cpp
+++ b/src/mame/machine/playch10.cpp
@@ -272,7 +272,7 @@ void playch10_state::pc10_set_mirroring(int mirroring)
* 64 1 *
\*****************/
-void playch10_state::pc10_set_videorom_bank( int first, int count, int bank, int size )
+void playch10_state::pc10_set_videorom_bank(int first, int count, int bank, int size)
{
int i, len;
/* first = first bank to map */
@@ -301,7 +301,7 @@ void playch10_state::pc10_set_videorom_bank( int first, int count, int bank, int
}
}
-void playch10_state::set_videoram_bank( int first, int count, int bank, int size )
+void playch10_state::set_videoram_bank(int first, int count, int bank, int size)
{
int i;
/* first = first bank to map */
@@ -650,7 +650,7 @@ void playch10_state::init_pcfboard()
//**********************************************************************************
// G Board (MMC3) games (Super Mario Bros. 3, etc)
-void playch10_state::gboard_scanline_cb( int scanline, int vblank, int blanked )
+void playch10_state::gboard_scanline_cb(int scanline, bool vblank, bool blanked)
{
if (scanline < ppu2c0x_device::BOTTOM_VISIBLE_SCANLINE)
{
diff --git a/src/mame/machine/pmd85.cpp b/src/mame/machine/pmd85.cpp
index 8e3829a64c5..1d8157bda59 100644
--- a/src/mame/machine/pmd85.cpp
+++ b/src/mame/machine/pmd85.cpp
@@ -624,18 +624,6 @@ void pmd85_state::mato_io_w(offs_t offset, uint8_t data)
}
}
-void pmd85_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_CASSETTE:
- cassette_timer_callback(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in pmd85_state::device_timer");
- }
-}
-
TIMER_CALLBACK_MEMBER(pmd85_state::cassette_timer_callback)
{
bool data;
@@ -708,7 +696,7 @@ void pmd85_state::common_driver_init()
{
m_previous_level = 0;
m_clk_level = m_clk_level_tape = 1;
- m_cassette_timer = timer_alloc(TIMER_CASSETTE);
+ m_cassette_timer = timer_alloc(FUNC(pmd85_state::cassette_timer_callback), this);
m_cassette_timer->adjust(attotime::zero, 0, attotime::from_hz(2400));
}
diff --git a/src/mame/machine/pocketc.cpp b/src/mame/machine/pocketc.cpp
index 3530366960d..e16ee649c90 100644
--- a/src/mame/machine/pocketc.cpp
+++ b/src/mame/machine/pocketc.cpp
@@ -14,22 +14,15 @@ READ_LINE_MEMBER(pocketc_state::brk_r)
return BIT(m_extra->read(), 0);
}
-void pocketc_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(pocketc_state::power_up_done)
{
- switch (id)
- {
- case TIMER_POWER_UP:
- m_power = 0;
- break;
- default:
- throw emu_fatalerror("Unknown id in pocketc_state::device_timer");
- }
+ m_power = 0;
}
void pocketc_state::machine_start()
{
m_cpu_nvram->set_base(m_maincpu->internal_ram(), 96);
- m_power_timer = timer_alloc(TIMER_POWER_UP);
+ m_power_timer = timer_alloc(FUNC(pocketc_state::power_up_done), this);
}
void pocketc_state::machine_reset()
diff --git a/src/mame/machine/poly.cpp b/src/mame/machine/poly.cpp
index cb1bbc5379c..babd159b9ec 100644
--- a/src/mame/machine/poly.cpp
+++ b/src/mame/machine/poly.cpp
@@ -44,7 +44,7 @@ TIMER_CALLBACK_MEMBER(poly_state::set_protect)
void poly_state::set_protect_w(uint8_t data)
{
/* set protect after 1 E cycle */
- machine().scheduler().timer_set(m_maincpu->cycles_to_attotime(2), timer_expired_delegate(FUNC(poly_state::set_protect), this));
+ m_protect_timer->adjust(m_maincpu->cycles_to_attotime(2));
}
diff --git a/src/mame/machine/psxcd.cpp b/src/mame/machine/psxcd.cpp
index 503df61339c..43a4a732184 100644
--- a/src/mame/machine/psxcd.cpp
+++ b/src/mame/machine/psxcd.cpp
@@ -8,7 +8,7 @@
static inline void ATTR_PRINTF(3,4) verboselog( device_t& device, int n_level, const char *s_fmt, ... )
{
- if( VERBOSE_LEVEL >= n_level )
+ if (VERBOSE_LEVEL >= n_level)
{
va_list v;
char buf[ 32768 ];
@@ -21,62 +21,65 @@ static inline void ATTR_PRINTF(3,4) verboselog( device_t& device, int n_level, c
enum cdrom_events
{
- event_cmd_complete=0,
- event_read_sector,
- event_play_sector,
- event_change_disk
+ EVENT_CMD_COMPLETE,
+ EVENT_READ_SECTOR,
+ EVENT_PLAY_SECTOR,
+ EVENT_CHANGE_DISK
};
enum intr_status
{
- intr_nointr=0,
- intr_dataready,
- intr_acknowledge,
- intr_complete,
- intr_dataend,
- intr_diskerror
+ INTR_NOINTR,
+ INTR_DATAREADY,
+ INTR_ACKNOWLEDGE,
+ INTR_COMPLETE,
+ INTR_DATAEND,
+ INTR_DISKERROR
};
enum mode_flags
{
- mode_double_speed=0x80,
- mode_adpcm=0x40,
- mode_size=0x20,
- mode_size2=0x10,
- mode_size_mask=0x30,
- mode_channel=0x08,
- mode_report=0x04,
- mode_autopause=0x02,
- mode_cdda=0x01
+ MODE_DOUBLE_SPEED = 0x80,
+ MODE_ADPCM = 0x40,
+ MODE_SIZE = 0x20,
+ MODE_SIZE2 = 0x10,
+ MODE_SIZE_MASK = 0x30,
+ MODE_CHANNEL = 0x08,
+ MODE_REPORT = 0x04,
+ MODE_AUTOPAUSE = 0x02,
+ MODE_CDDA = 0x01
};
enum status_f
{
- status_playing=0x80,
- status_seeking=0x40,
- status_reading=0x20,
- status_shellopen=0x10,
- status_invalid=0x08,
- status_seekerror=0x04,
- status_standby=0x02,
- status_error=0x01
+ STATUS_PLAYING = 0x80,
+ STATUS_SEEKING = 0x40,
+ STATUS_READING = 0x20,
+ STATUS_SHELLOPEN = 0x10,
+ STATUS_INVALID = 0x08,
+ STATUS_SEEKERROR = 0x04,
+ STATUS_STANDBY = 0x02,
+ STATUS_ERROR = 0x01
};
struct subheader
{
- uint8_t file, channel, submode, coding;
+ uint8_t file;
+ uint8_t channel;
+ uint8_t submode;
+ uint8_t coding;
};
enum submode_flags
{
- submode_eof=0x80,
- submode_realtime=0x40,
- submode_form=0x20,
- submode_trigger=0x10,
- submode_data=0x08,
- submode_audio=0x04,
- submode_video=0x02,
- submode_eor=0x01
+ SUBMODE_EOF = 0x80,
+ SUBMODE_REALTIME = 0x40,
+ SUBMODE_FORM = 0x20,
+ SUBMODE_TRIGGER = 0x10,
+ SUBMODE_DATA = 0x08,
+ SUBMODE_AUDIO = 0x04,
+ SUBMODE_VIDEO = 0x02,
+ SUBMODE_EOR = 0x01
};
//**************************************************************************
@@ -100,21 +103,21 @@ void psxcd_device::device_start()
cdrom_image_device::device_start();
m_irq_handler.resolve_safe();
- unsigned int sysclk=m_maincpu->clock()/2;
- start_read_delay=(sysclk/60);
- read_sector_cycles=(sysclk/75);
- preread_delay=(read_sector_cycles>>2)-500;
+ uint32_t sysclk = m_maincpu->clock() / 2;
+ start_read_delay = (sysclk / 60);
+ read_sector_cycles = (sysclk / 75);
+ preread_delay = (read_sector_cycles >> 2) - 500;
m_sysclock = sysclk;
res_queue = nullptr;
rdp = 0;
- status=status_shellopen;
- mode=0;
+ status = STATUS_SHELLOPEN;
+ mode = 0;
for (int i = 0; i < MAX_PSXCD_TIMERS; i++)
{
- m_timers[i] = timer_alloc(i);
+ m_timers[i] = timer_alloc(FUNC(psxcd_device::handle_event), this);
m_timerinuse[i] = false;
m_results[i] = nullptr;
}
@@ -146,10 +149,10 @@ void psxcd_device::device_stop()
{
for (int i = 0; i < MAX_PSXCD_TIMERS; i++)
{
- if(m_timerinuse[i] && m_results[i])
+ if (m_timerinuse[i] && m_results[i])
delete m_results[i];
}
- while(res_queue)
+ while (res_queue)
{
command_result *res = res_queue->next;
delete res_queue;
@@ -164,16 +167,16 @@ void psxcd_device::device_reset()
for (int i = 0; i < MAX_PSXCD_TIMERS; i++)
{
- if(m_timerinuse[i] && m_results[i])
+ if (m_timerinuse[i] && m_results[i])
delete m_results[i];
- m_timers[i]->adjust(attotime::never, 0, attotime::never);
+ m_timers[i]->adjust(attotime::never);
m_timerinuse[i] = false;
}
open = true;
- if(m_cdrom_handle)
- add_system_event(event_change_disk, m_sysclock, nullptr);
+ if (m_cdrom_handle)
+ add_system_event(EVENT_CHANGE_DISK, m_sysclock, nullptr);
- while(res_queue)
+ while (res_queue)
{
command_result *res = res_queue->next;
delete res_queue;
@@ -196,8 +199,8 @@ image_init_result psxcd_device::call_load()
{
image_init_result ret = cdrom_image_device::call_load();
open = true;
- if(ret == image_init_result::PASS)
- add_system_event(event_change_disk, m_sysclock, nullptr); // 1 sec to spin up the disk
+ if (ret == image_init_result::PASS)
+ add_system_event(EVENT_CHANGE_DISK, m_sysclock, nullptr); // 1 sec to spin up the disk
return ret;
}
@@ -206,8 +209,8 @@ void psxcd_device::call_unload()
stop_read();
cdrom_image_device::call_unload();
open = true;
- status = status_shellopen;
- send_result(intr_diskerror);
+ status = STATUS_SHELLOPEN;
+ send_result(INTR_DISKERROR);
}
uint8_t psxcd_device::read(offs_t offset)
@@ -231,7 +234,7 @@ uint8_t psxcd_device::read(offs_t offset)
if ((res_queue) && (rdp < res_queue->sz))
{
ret = res_queue->data[rdp++];
- if(rdp == res_queue->sz)
+ if (rdp == res_queue->sz)
m_regs.sr &= ~0x20;
else
m_regs.sr |= 0x20;
@@ -241,12 +244,12 @@ uint8_t psxcd_device::read(offs_t offset)
break;
case 2:
- if(!m_dmaload)
+ if (!m_dmaload)
ret = 0;
else
{
ret = m_transbuf[m_transcurr++];
- if(m_transcurr >= raw_sector_size)
+ if (m_transcurr >= raw_sector_size)
{
m_dmaload = false;
m_regs.sr &= ~0x40;
@@ -255,7 +258,7 @@ uint8_t psxcd_device::read(offs_t offset)
break;
case 3:
- if(m_regs.sr & 1)
+ if (m_regs.sr & 1)
ret = m_regs.ir | 0xe0;
else
ret = m_regs.imr | 0xe0;
@@ -316,7 +319,7 @@ void psxcd_device::write(offs_t offset, uint8_t data)
---- -xxx Response received
*/
case 0x03:
- if((data & 0x80) && !m_dmaload)
+ if ((data & 0x80) && !m_dmaload)
{
m_dmaload = true;
memcpy(m_transbuf, secbuf[m_cursec], raw_sector_size);
@@ -325,7 +328,7 @@ void psxcd_device::write(offs_t offset, uint8_t data)
m_cursec++;
m_cursec %= sector_buffer_size;
- switch(mode & mode_size_mask)
+ switch (mode & MODE_SIZE_MASK)
{
case 0x00:
default:
@@ -345,7 +348,7 @@ void psxcd_device::write(offs_t offset, uint8_t data)
verboselog(*this, 1, "psxcd: request data=%s\n",str);
#endif
}
- else if(!(data & 0x80))
+ else if (!(data & 0x80))
{
m_dmaload = false;
m_regs.sr &= ~0x40;
@@ -353,21 +356,21 @@ void psxcd_device::write(offs_t offset, uint8_t data)
break;
case 0x13:
- if(data & 0x1f)
+ if (data & 0x1f)
{
m_regs.ir &= ~(data & 0x1f);
- if(res_queue && !m_regs.ir)
+ if (res_queue && !m_regs.ir)
{
command_result *res = res_queue;
- if(res == m_int1)
+ if (res == m_int1)
m_int1 = nullptr;
res_queue = res->next;
delete res;
m_regs.sr &= ~0x20;
rdp = 0;
- if(res_queue)
+ if (res_queue)
{
m_regs.sr |= 0x20;
m_regs.ir = res_queue->res;
@@ -375,7 +378,7 @@ void psxcd_device::write(offs_t offset, uint8_t data)
verboselog(*this, 1, "psxcd: nextres\n");
}
}
- if(data & 0x40)
+ if (data & 0x40)
m_param_count = 0;
break;
@@ -425,7 +428,7 @@ const psxcd_device::cdcmd psxcd_device::cmd_table[]=
void psxcd_device::write_command(uint8_t byte)
{
- if(byte > 30) // coverity 140157
+ if (byte > 30) // coverity 140157
illegalcmd(byte);
else
(this->*cmd_table[byte])();
@@ -437,7 +440,7 @@ void psxcd_device::cdcmd_sync()
verboselog(*this, 1, "psxcd: sync\n");
stop_read();
- send_result(intr_acknowledge);
+ send_result(INTR_ACKNOWLEDGE);
}
void psxcd_device::cdcmd_nop()
@@ -445,9 +448,9 @@ void psxcd_device::cdcmd_nop()
verboselog(*this, 1, "psxcd: nop\n");
if (!open)
- status &= ~status_shellopen;
+ status &= ~STATUS_SHELLOPEN;
- send_result(intr_complete);
+ send_result(INTR_COMPLETE);
}
void psxcd_device::cdcmd_setloc()
@@ -467,12 +470,12 @@ void psxcd_device::cdcmd_setloc()
else
verboselog(*this, 0, "psxcd: setloc out of range: %02d:%02d:%02d\n",l.b[M],l.b[S],l.b[F]);
- send_result(intr_complete);
+ send_result(INTR_COMPLETE);
}
void psxcd_device::cdcmd_play()
{
- if(cmdbuf[0] && m_param_count)
+ if (cmdbuf[0] && m_param_count)
loc.w = lba_to_msf_ps(m_cdrom_handle->get_track_start(bcd_to_decimal(cmdbuf[0]) - 1));
curpos.w = loc.w;
@@ -483,7 +486,7 @@ void psxcd_device::cdcmd_play()
stop_read();
start_play();
- send_result(intr_complete);
+ send_result(INTR_COMPLETE);
}
void psxcd_device::cdcmd_forward()
@@ -498,7 +501,7 @@ void psxcd_device::cdcmd_backward()
void psxcd_device::cdcmd_readn()
{
- if(!open)
+ if (!open)
{
verboselog(*this, 1, "psxcd: readn\n");
@@ -506,9 +509,10 @@ void psxcd_device::cdcmd_readn()
stop_read();
start_read();
- } else
+ }
+ else
{
- send_result(intr_diskerror, nullptr, 0, 0x80);
+ send_result(INTR_DISKERROR, nullptr, 0, 0x80);
}
}
@@ -517,7 +521,7 @@ void psxcd_device::cdcmd_standby()
verboselog(*this, 1, "psxcd: standby\n");
stop_read();
- send_result(intr_acknowledge);
+ send_result(INTR_ACKNOWLEDGE);
}
void psxcd_device::cdcmd_stop()
@@ -525,7 +529,7 @@ void psxcd_device::cdcmd_stop()
verboselog(*this, 1, "psxcd: stop\n");
stop_read();
- send_result(intr_acknowledge);
+ send_result(INTR_ACKNOWLEDGE);
}
void psxcd_device::cdcmd_pause()
@@ -534,7 +538,7 @@ void psxcd_device::cdcmd_pause()
stop_read();
- send_result(intr_acknowledge);
+ send_result(INTR_ACKNOWLEDGE);
}
void psxcd_device::cdcmd_init()
@@ -545,7 +549,7 @@ void psxcd_device::cdcmd_init()
mode=0;
m_regs.sr |= 0x10;
- send_result(intr_acknowledge);
+ send_result(INTR_ACKNOWLEDGE);
}
void psxcd_device::cdcmd_mute()
@@ -553,7 +557,7 @@ void psxcd_device::cdcmd_mute()
verboselog(*this, 1, "psxcd: mute\n");
m_mute = true;
- send_result(intr_complete);
+ send_result(INTR_COMPLETE);
}
void psxcd_device::cdcmd_demute()
@@ -561,7 +565,7 @@ void psxcd_device::cdcmd_demute()
verboselog(*this, 1, "psxcd: demute\n");
m_mute = false;
- send_result(intr_complete);
+ send_result(INTR_COMPLETE);
}
void psxcd_device::cdcmd_setfilter()
@@ -571,7 +575,7 @@ void psxcd_device::cdcmd_setfilter()
filter_file=cmdbuf[0];
filter_channel=cmdbuf[1];
- send_result(intr_acknowledge);
+ send_result(INTR_ACKNOWLEDGE);
}
void psxcd_device::cdcmd_setmode()
@@ -579,7 +583,7 @@ void psxcd_device::cdcmd_setmode()
verboselog(*this, 1, "psxcd: setmode %08x\n",cmdbuf[0]);
mode=cmdbuf[0];
- send_result(intr_complete);
+ send_result(INTR_COMPLETE);
}
void psxcd_device::cdcmd_getparam()
@@ -597,7 +601,7 @@ void psxcd_device::cdcmd_getparam()
verboselog(*this, 1, "psxcd: getparam [%02x %02x %02x %02x %02x %02x]\n",
data[0], data[1], data[2], data[3], data[4], data[5]);
- send_result(intr_complete,data,6);
+ send_result(INTR_COMPLETE, data, 6);
}
uint32_t psxcd_device::sub_loc(CDPOS src1, CDPOS src2)
@@ -625,7 +629,7 @@ void psxcd_device::cdcmd_getlocl()
lastsechdr[0], lastsechdr[1], lastsechdr[2], lastsechdr[3],
lastsechdr[4], lastsechdr[5], lastsechdr[6], lastsechdr[7]);
- send_result(intr_complete,lastsechdr,8);
+ send_result(INTR_COMPLETE, lastsechdr, 8);
}
void psxcd_device::cdcmd_getlocp()
@@ -635,7 +639,7 @@ void psxcd_device::cdcmd_getlocp()
start.w = (track == 1) ? 0x000200 : lba_to_msf_ps(m_cdrom_handle->get_track_start(track - 1));
tloc.w = sub_loc(loc, start);
- unsigned char data[8]=
+ unsigned char data[8] =
{
decimal_to_bcd(track), // track
0x01, // index
@@ -650,7 +654,7 @@ void psxcd_device::cdcmd_getlocp()
verboselog(*this, 1, "psxcd: getlocp [%02x %02x %02x %02x %02x %02x %02x %02x]\n",
data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]);
- send_result(intr_complete,data,8);
+ send_result(INTR_COMPLETE, data, 8);
}
void psxcd_device::cdcmd_gettn()
@@ -658,20 +662,20 @@ void psxcd_device::cdcmd_gettn()
verboselog(*this, 1, "psxcd: gettn\n");
- if(!open)
+ if (!open)
{
- unsigned char data[3]=
+ unsigned char data[3] =
{
status,
decimal_to_bcd(1),
decimal_to_bcd(m_cdrom_handle->get_last_track())
};
- send_result(intr_complete,data,3);
+ send_result(INTR_COMPLETE, data, 3);
}
else
{
- send_result(intr_diskerror, nullptr, 0, 0x80);
+ send_result(INTR_DISKERROR, nullptr, 0, 0x80);
}
}
@@ -679,15 +683,15 @@ void psxcd_device::cdcmd_gettd()
{
uint8_t track = bcd_to_decimal(cmdbuf[0]);
uint8_t last = m_cdrom_handle->get_last_track();
- if(track <= last)
+ if (track <= last)
{
CDPOS trkstart;
- if(!track) // length of disk
+ if (!track) // length of disk
trkstart.w = lba_to_msf_ps(m_cdrom_handle->get_track_start(0xaa));
else
trkstart.w = lba_to_msf_ps(m_cdrom_handle->get_track_start(track - 1));
- unsigned char data[3]=
+ unsigned char data[3] =
{
status,
decimal_to_bcd(trkstart.b[M]),
@@ -696,11 +700,11 @@ void psxcd_device::cdcmd_gettd()
verboselog(*this, 1, "psxcd: gettd %02x [%02x %02x %02x]\n", cmdbuf[0], data[0], data[1], data[2]);
- send_result(intr_acknowledge,data,3);
+ send_result(INTR_ACKNOWLEDGE, data, 3);
}
else
{
- send_result(intr_diskerror, nullptr, 0, 0x80);
+ send_result(INTR_DISKERROR, nullptr, 0, 0x80);
}
}
@@ -708,29 +712,29 @@ void psxcd_device::cdcmd_seekl()
{
verboselog(*this, 1, "psxcd: seekl [%02d:%02d:%02d]\n", loc.b[M], loc.b[S], loc.b[F]);
- curpos.w=loc.w;
+ curpos.w = loc.w;
- send_result(intr_acknowledge);
+ send_result(INTR_ACKNOWLEDGE);
}
void psxcd_device::cdcmd_seekp()
{
verboselog(*this, 1, "psxcd: seekp\n");
- curpos.w=loc.w;
+ curpos.w = loc.w;
- send_result(intr_acknowledge);
+ send_result(INTR_ACKNOWLEDGE);
}
void psxcd_device::cdcmd_test()
{
verboselog(*this, 1, "psxcd: test %02x\n", cmdbuf[0]);
- switch(cmdbuf[0])
+ switch (cmdbuf[0])
{
case 0x20:
{
- static uint8_t data[4]=
+ static uint8_t data[4] =
{
0x95,
0x07,
@@ -738,13 +742,13 @@ void psxcd_device::cdcmd_test()
0xff
};
- send_result(intr_complete,data,4);
+ send_result(INTR_COMPLETE, data, 4);
break;
}
default:
verboselog(*this, 0, "psxcd: unimplemented test cmd %02x\n", cmdbuf[0]);
- cmd_complete(prepare_result(intr_diskerror, nullptr, 0, 0x10));
+ cmd_complete(prepare_result(INTR_DISKERROR, nullptr, 0, 0x10));
break;
}
}
@@ -759,33 +763,33 @@ void psxcd_device::cdcmd_id()
int irq;
memset(cdid, '\0', 8);
- send_result(intr_complete);
- if(m_cdrom_handle->get_track_type(0) == cdrom_file::CD_TRACK_AUDIO)
+ send_result(INTR_COMPLETE);
+ if (m_cdrom_handle->get_track_type(0) == cdrom_file::CD_TRACK_AUDIO)
{
- irq = intr_diskerror;
- cdid[0] = status | status_invalid;
+ irq = INTR_DISKERROR;
+ cdid[0] = status | STATUS_INVALID;
cdid[1] = 0x90;
}
else
{
- irq = intr_acknowledge;
+ irq = INTR_ACKNOWLEDGE;
cdid[0] = status;
cdid[4] = 'S';
cdid[5] = 'C';
cdid[6] = 'E';
cdid[7] = 'A';
}
- send_result(irq,cdid,8,default_irq_delay*3);
+ send_result(irq, cdid, 8, default_irq_delay * 3);
}
else
{
- send_result(intr_diskerror, nullptr, 0, 0x80);
+ send_result(INTR_DISKERROR, nullptr, 0, 0x80);
}
}
void psxcd_device::cdcmd_reads()
{
- if(!open)
+ if (!open)
{
verboselog(*this, 1, "psxcd: reads\n");
@@ -793,9 +797,10 @@ void psxcd_device::cdcmd_reads()
stop_read();
start_read();
- } else
+ }
+ else
{
- send_result(intr_diskerror, nullptr, 0, 0x80);
+ send_result(INTR_DISKERROR, nullptr, 0, 0x80);
}
}
@@ -808,18 +813,18 @@ void psxcd_device::cdcmd_readtoc()
{
verboselog(*this, 1, "psxcd: readtoc\n");
- send_result(intr_complete);
- send_result(intr_acknowledge, nullptr, 0, default_irq_delay*3); // ?
+ send_result(INTR_COMPLETE);
+ send_result(INTR_ACKNOWLEDGE, nullptr, 0, default_irq_delay * 3); // ?
}
void psxcd_device::cdcmd_unknown12()
{
verboselog(*this, 1, "psxcd: unknown 12\n");
// set session? readt?
- if(cmdbuf[0] == 1)
- send_result(intr_complete);
+ if (cmdbuf[0] == 1)
+ send_result(INTR_COMPLETE);
else
- send_result(intr_diskerror, nullptr, 0, 0x40);
+ send_result(INTR_DISKERROR, nullptr, 0, 0x40);
}
void psxcd_device::cdcmd_illegal17()
@@ -841,7 +846,7 @@ void psxcd_device::illegalcmd(uint8_t cmd)
{
verboselog(*this, 0, "psxcd: unimplemented cd command %02x\n", cmd);
- send_result(intr_diskerror, nullptr, 0, 0x40);
+ send_result(INTR_DISKERROR, nullptr, 0, 0x40);
}
void psxcd_device::cmd_complete(command_result *res)
@@ -859,7 +864,7 @@ void psxcd_device::cmd_complete(command_result *res)
{
res_queue = res;
m_regs.ir = res_queue->res;
- if(m_regs.ir & m_regs.imr)
+ if (m_regs.ir & m_regs.imr)
m_irq_handler(1);
m_regs.sr |= 0x20;
}
@@ -868,19 +873,20 @@ void psxcd_device::cmd_complete(command_result *res)
psxcd_device::command_result *psxcd_device::prepare_result(uint8_t res, uint8_t *data, int sz, uint8_t errcode)
{
- auto cr=new command_result;
+ auto cr = new command_result;
- cr->res=res;
+ cr->res = res;
if (sz)
{
assert(sz<sizeof(cr->data));
- memcpy(cr->data,data,sz);
- cr->sz=sz;
- } else
+ memcpy(cr->data, data, sz);
+ cr->sz = sz;
+ }
+ else
{
- if((res == intr_diskerror) && errcode)
+ if ((res == INTR_DISKERROR) && errcode)
{
- cr->data[0] = status | status_error;
+ cr->data[0] = status | STATUS_ERROR;
cr->data[1] = errcode;
cr->sz = 2;
}
@@ -890,7 +896,7 @@ psxcd_device::command_result *psxcd_device::prepare_result(uint8_t res, uint8_t
cr->sz=1;
}
}
- status &= ~status_error;
+ status &= ~STATUS_ERROR;
return cr;
}
@@ -901,13 +907,20 @@ void psxcd_device::send_result(uint8_t res, uint8_t *data, int sz, int delay, ui
// delay the sector read slightly if necessary
uint64_t systime = m_maincpu->total_cycles();
- if ((next_read_event != -1) && ((systime+delay)>(next_sector_t)))
+ if ((next_read_event != -1) && ((systime + delay)>(next_sector_t)))
{
uint32_t hz = m_sysclock / (delay + 2000);
- m_timers[next_read_event]->adjust(attotime::from_hz(hz), 0, attotime::never);
+ if (status & STATUS_PLAYING)
+ {
+ m_timers[next_read_event]->adjust(attotime::from_hz(hz), (next_read_event << 2) | EVENT_PLAY_SECTOR);
+ }
+ else if (status & STATUS_READING)
+ {
+ m_timers[next_read_event]->adjust(attotime::from_hz(hz), (next_read_event << 2) | EVENT_READ_SECTOR);
+ }
}
- add_system_event(event_cmd_complete, delay, prepare_result(res, data, sz, errcode));
+ add_system_event(EVENT_CMD_COMPLETE, delay, prepare_result(res, data, sz, errcode));
}
void psxcd_device::start_dma(uint8_t *mainram, uint32_t size)
@@ -915,10 +928,10 @@ void psxcd_device::start_dma(uint8_t *mainram, uint32_t size)
uint32_t sector_size;
verboselog(*this, 1, "psxcd: start dma %d bytes at %d\n", size, m_transcurr);
- if(!m_dmaload)
+ if (!m_dmaload)
return;
- switch(mode & mode_size_mask)
+ switch (mode & MODE_SIZE_MASK)
{
case 0x00:
default:
@@ -932,13 +945,13 @@ void psxcd_device::start_dma(uint8_t *mainram, uint32_t size)
break;
}
- if(size > (sector_size - m_transcurr))
+ if (size > (sector_size - m_transcurr))
size = (sector_size - m_transcurr);
memcpy(mainram, &m_transbuf[m_transcurr], size);
m_transcurr += size;
- if(sector_size <= m_transcurr)
+ if (sector_size <= m_transcurr)
{
m_dmaload = false;
m_regs.sr &= ~0x40;
@@ -949,49 +962,48 @@ void psxcd_device::read_sector()
{
next_read_event=-1;
- if (status & status_reading)
+ if (status & STATUS_READING)
{
bool isend = false;
uint32_t sector = msf_to_lba_ps(curpos.w);
uint8_t *buf = secbuf[sectail];
if (m_cdrom_handle->read_data(sector, buf, cdrom_file::CD_TRACK_RAW_DONTCARE))
{
- subheader *sub=(subheader *)(buf+16);
- memcpy(lastsechdr, buf+12, 8);
+ subheader *sub = (subheader *)(buf + 16);
+ memcpy(lastsechdr, buf + 12, 8);
verboselog(*this, 2, "psxcd: subheader file=%02x chan=%02x submode=%02x coding=%02x [%02x%02x%02x%02x]\n",
sub->file, sub->channel, sub->submode, sub->coding, buf[0xc], buf[0xd], buf[0xe], buf[0xf]);
- if ((mode & mode_adpcm) && (sub->submode & submode_audio))
+ if ((mode & MODE_ADPCM) && (sub->submode & SUBMODE_AUDIO))
{
- if ((sub->submode & submode_eof) && (mode & mode_autopause))
+ if ((sub->submode & SUBMODE_EOF) && (mode & MODE_AUTOPAUSE))
{
isend=true;
//printf("end of file\n");
}
- if((!(mode & mode_channel) ||
- ((sub->file == filter_file) && (sub->channel == filter_channel))) && !m_mute)
- m_spu->play_xa(0,buf+16);
+ if ((!(mode & MODE_CHANNEL) || ((sub->file == filter_file) && (sub->channel == filter_channel))) && !m_mute)
+ m_spu->play_xa(0, buf + 16);
}
else
{
- if(!m_int1)
+ if (!m_int1)
m_cursec = sectail;
- m_int1 = prepare_result(intr_dataready);
+ m_int1 = prepare_result(INTR_DATAREADY);
cmd_complete(m_int1);
sectail++;
sectail %= sector_buffer_size;
}
curpos.b[F]++;
- if (curpos.b[F]==75)
+ if (curpos.b[F] == 75)
{
- curpos.b[F]=0;
+ curpos.b[F] = 0;
curpos.b[S]++;
- if (curpos.b[S]==60)
+ if (curpos.b[S] == 60)
{
- curpos.b[S]=0;
+ curpos.b[S] = 0;
curpos.b[M]++;
}
}
@@ -1001,19 +1013,21 @@ void psxcd_device::read_sector()
else
isend = true;
- if (! isend)
+ if (!isend)
{
- unsigned int cyc=read_sector_cycles;
- if (mode&mode_double_speed) cyc>>=1;
+ uint32_t cyc = read_sector_cycles;
+ if (mode & MODE_DOUBLE_SPEED)
+ cyc >>= 1;
- next_sector_t+=cyc;
+ next_sector_t += cyc;
- next_read_event = add_system_event(event_read_sector, cyc, nullptr);
- } else
+ next_read_event = add_system_event(EVENT_READ_SECTOR, cyc, nullptr);
+ }
+ else
{
verboselog(*this, 1, "psxcd: autopause xa\n");
- cmd_complete(prepare_result(intr_dataend));
+ cmd_complete(prepare_result(INTR_DATAEND));
stop_read();
}
}
@@ -1021,23 +1035,23 @@ void psxcd_device::read_sector()
void psxcd_device::play_sector()
{
- next_read_event=-1;
+ next_read_event = -1;
- if (status&status_playing)
+ if (status & STATUS_PLAYING)
{
uint32_t sector = msf_to_lba_ps(curpos.w);
- if(m_cdrom_handle->read_data(sector, secbuf[sectail], cdrom_file::CD_TRACK_AUDIO))
+ if (m_cdrom_handle->read_data(sector, secbuf[sectail], cdrom_file::CD_TRACK_AUDIO))
{
- if(!m_mute)
+ if (!m_mute)
m_spu->play_cdda(0, secbuf[sectail]);
}
else
{
- if(!m_cdrom_handle->read_data(sector, secbuf[sectail], cdrom_file::CD_TRACK_RAW_DONTCARE))
+ if (!m_cdrom_handle->read_data(sector, secbuf[sectail], cdrom_file::CD_TRACK_RAW_DONTCARE))
{
stop_read(); // assume we've reached the end
- cmd_complete(prepare_result(intr_dataend));
+ cmd_complete(prepare_result(INTR_DATAEND));
return;
}
}
@@ -1054,33 +1068,33 @@ void psxcd_device::play_sector()
}
}
- loc.w=curpos.w;
+ loc.w = curpos.w;
sector++;
sectail++;
sectail %= sector_buffer_size;
- if (mode&mode_autopause)
+ if (mode & MODE_AUTOPAUSE)
{
- if (sector>=autopause_sector)
+ if (sector >= autopause_sector)
{
verboselog(*this, 1, "psxcd: autopause cdda\n");
stop_read();
- cmd_complete(prepare_result(intr_dataend));
+ cmd_complete(prepare_result(INTR_DATAEND));
return;
}
}
- if ((mode&mode_report) && !(sector & 15)) // slow the int rate
+ if ((mode & MODE_REPORT) && !(sector & 15)) // slow the int rate
{
- auto res=new command_result;
+ auto res = new command_result;
uint8_t track = m_cdrom_handle->get_track(sector) + 1;
- res->res=intr_dataready;
+ res->res = INTR_DATAREADY;
res->data[0]=status;
res->data[1]=decimal_to_bcd(track);
res->data[2]=1;
- if(sector & 0x10)
+ if (sector & 0x10)
{
CDPOS tloc, start;
start.w = (track == 1) ? 0x000200 : lba_to_msf_ps(m_cdrom_handle->get_track_start(track - 1));
@@ -1101,11 +1115,11 @@ void psxcd_device::play_sector()
cmd_complete(res);
}
- unsigned int cyc=read_sector_cycles;
+ uint32_t cyc = read_sector_cycles;
- next_sector_t+=cyc>>1;
+ next_sector_t += cyc >> 1;
- next_read_event = add_system_event(event_play_sector, next_sector_t - m_maincpu->total_cycles(), nullptr);
+ next_read_event = add_system_event(EVENT_PLAY_SECTOR, next_sector_t - m_maincpu->total_cycles(), nullptr);
}
}
@@ -1113,78 +1127,80 @@ void psxcd_device::start_read()
{
uint32_t sector = msf_to_lba_ps(curpos.w);
- assert((status&(status_reading|status_playing))==0);
+ assert((status & (STATUS_READING | STATUS_PLAYING)) == 0);
- if(!(mode & mode_cdda) && (m_cdrom_handle->get_track_type(m_cdrom_handle->get_track(sector + 150)) == cdrom_file::CD_TRACK_AUDIO))
+ if (!(mode & MODE_CDDA) && (m_cdrom_handle->get_track_type(m_cdrom_handle->get_track(sector + 150)) == cdrom_file::CD_TRACK_AUDIO))
{
stop_read();
- cmd_complete(prepare_result(intr_diskerror, nullptr, 0, 0x40));
+ cmd_complete(prepare_result(INTR_DISKERROR, nullptr, 0, 0x40));
return;
}
- send_result(intr_complete);
- status |= status_reading;
+ send_result(INTR_COMPLETE);
+ status |= STATUS_READING;
m_cursec=sectail=0;
- unsigned int cyc=read_sector_cycles;
- if (mode&mode_double_speed) cyc>>=1;
+ uint32_t cyc = read_sector_cycles;
+ if (mode & MODE_DOUBLE_SPEED)
+ cyc >>= 1;
- int64_t systime=m_maincpu->total_cycles();
+ int64_t systime = m_maincpu->total_cycles();
- systime+=start_read_delay;
+ systime += start_read_delay;
- next_sector_t=systime+cyc;
- next_read_event = add_system_event(event_read_sector, start_read_delay+preread_delay, nullptr);
+ next_sector_t = systime + cyc;
+ next_read_event = add_system_event(EVENT_READ_SECTOR, start_read_delay + preread_delay, nullptr);
}
void psxcd_device::start_play()
{
uint8_t track = m_cdrom_handle->get_track(msf_to_lba_ps(curpos.w) + 150);
- if(m_cdrom_handle->get_track_type(track) != cdrom_file::CD_TRACK_AUDIO)
+ if (m_cdrom_handle->get_track_type(track) != cdrom_file::CD_TRACK_AUDIO)
verboselog(*this, 0, "psxcd: playing data track\n");
- status|=status_playing;
+ status |= STATUS_PLAYING;
- m_cursec=sectail=0;
+ m_cursec = sectail = 0;
- if (mode&mode_autopause)
+ if (mode & MODE_AUTOPAUSE)
{
const auto &toc = m_cdrom_handle->get_toc();
autopause_sector = m_cdrom_handle->get_track_start(track) + toc.tracks[track].logframes;
// printf("pos=%d auto=%d\n",pos,autopause_sector);
}
- unsigned int cyc=read_sector_cycles;
+ uint32_t cyc = read_sector_cycles;
- next_sector_t=m_maincpu->total_cycles()+cyc;
+ next_sector_t = m_maincpu->total_cycles() + cyc;
- next_sector_t+=cyc>>1;
+ next_sector_t += cyc >> 1;
- next_read_event = add_system_event(event_play_sector, next_sector_t - m_maincpu->total_cycles(), nullptr);
+ next_read_event = add_system_event(EVENT_PLAY_SECTOR, next_sector_t - m_maincpu->total_cycles(), nullptr);
}
void psxcd_device::stop_read()
{
- if (status & (status_reading|status_playing))
+ if (status & (STATUS_READING | STATUS_PLAYING))
verboselog(*this, 1, "psxcd: stop read\n");
- status&=~(status_reading|status_playing);
+ status &= ~(STATUS_READING | STATUS_PLAYING);
if (next_read_event != -1)
{
- m_timers[next_read_event]->adjust(attotime::never, 0, attotime::never);
+ m_timers[next_read_event]->adjust(attotime::never);
m_timerinuse[next_read_event] = false;
next_read_event = -1;
}
- uint32_t sector=msf_to_lba_ps(curpos.w);
+ uint32_t sector = msf_to_lba_ps(curpos.w);
m_spu->flush_xa(sector);
m_spu->flush_cdda(sector);
}
-void psxcd_device::device_timer(emu_timer &timer, device_timer_id tid, int param)
+TIMER_CALLBACK_MEMBER(psxcd_device::handle_event)
{
+ int tid = param >> 2;
if (!m_timerinuse[tid])
{
verboselog(*this, 0, "psxcd: timer fired for free event\n");
@@ -1192,27 +1208,24 @@ void psxcd_device::device_timer(emu_timer &timer, device_timer_id tid, int param
}
m_timerinuse[tid] = false;
- switch (param)
+ switch (param & 3)
{
- case event_cmd_complete:
- {
+ case EVENT_CMD_COMPLETE:
verboselog(*this, 1, "psxcd: event cmd complete\n");
-
cmd_complete(m_results[tid]);
break;
- }
- case event_read_sector:
+ case EVENT_READ_SECTOR:
read_sector();
break;
- case event_play_sector:
+ case EVENT_PLAY_SECTOR:
play_sector();
break;
- case event_change_disk:
+ case EVENT_CHANGE_DISK:
open = false;
- status |= status_standby;
+ status |= STATUS_STANDBY;
break;
}
}
@@ -1221,11 +1234,11 @@ int psxcd_device::add_system_event(int type, uint64_t t, command_result *ptr)
{
// t is in maincpu clock cycles
uint32_t hz = m_sysclock / t;
- for(int i = 0; i < MAX_PSXCD_TIMERS; i++)
+ for (int i = 0; i < MAX_PSXCD_TIMERS; i++)
{
- if(!m_timerinuse[i])
+ if (!m_timerinuse[i])
{
- m_timers[i]->adjust(attotime::from_hz(hz), type, attotime::never);
+ m_timers[i]->adjust(attotime::from_hz(hz), (i << 2) | type, attotime::never);
m_results[i] = ptr;
m_timerinuse[i] = true;
return i;
diff --git a/src/mame/machine/psxcd.h b/src/mame/machine/psxcd.h
index 79b9e493efe..9bfd55f3489 100644
--- a/src/mame/machine/psxcd.h
+++ b/src/mame/machine/psxcd.h
@@ -35,9 +35,10 @@ protected:
virtual void device_start() override;
virtual void device_stop() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual const tiny_rom_entry *device_rom_region() const override;
+ TIMER_CALLBACK_MEMBER(handle_event);
+
private:
static constexpr unsigned MAX_PSXCD_TIMERS = 4;
@@ -106,25 +107,38 @@ private:
uint32_t msf_to_lba_ps(uint32_t msf) { msf = cdrom_file::msf_to_lba(msf); return (msf>150)?(msf-150):msf; }
uint32_t lba_to_msf_ps(uint32_t lba) { return cdrom_file::lba_to_msf_alt(lba+150); }
- static const unsigned int sector_buffer_size=16, default_irq_delay=16000; //480; //8000; //2000<<2;
- static const unsigned int raw_sector_size=2352;
-
- uint8_t cmdbuf[64]{}, mode = 0, secbuf[sector_buffer_size][raw_sector_size]{};
- uint8_t filter_file = 0, filter_channel = 0, lastsechdr[8]{}, status = 0;
+ static const uint32_t sector_buffer_size = 16;
+ static const uint32_t default_irq_delay = 16000;
+ static const uint32_t raw_sector_size = 2352;
+
+ uint8_t cmdbuf[64]{};
+ uint8_t mode = 0;
+ uint8_t secbuf[sector_buffer_size][raw_sector_size]{};
+ uint8_t filter_file = 0;
+ uint8_t filter_channel = 0;
+ uint8_t lastsechdr[8]{};
+ uint8_t status = 0;
int rdp = 0;
uint8_t m_cursec = 0, sectail = 0;
uint16_t m_transcurr = 0;
uint8_t m_transbuf[raw_sector_size]{};
- command_result *res_queue = nullptr, *m_int1 = nullptr;
+ command_result *res_queue = nullptr;
+ command_result *m_int1 = nullptr;
struct {
- uint8_t sr = 0, ir = 0, imr = 0;
+ uint8_t sr = 0;
+ uint8_t ir = 0;
+ uint8_t imr = 0;
struct {
- uint8_t ll = 0, lr = 0, rl = 0, rr = 0;
+ uint8_t ll = 0;
+ uint8_t lr = 0;
+ uint8_t rl = 0;
+ uint8_t rr = 0;
} vol;
} m_regs;
- CDPOS loc, curpos;
+ CDPOS loc;
+ CDPOS curpos;
#ifdef LSB_FIRST
enum {
@@ -140,10 +154,15 @@ private:
};
#endif
- bool open = false, m_mute = false, m_dmaload = false;
- device_timer_id next_read_event{};
+ bool open = false;
+ bool m_mute = false;
+ bool m_dmaload = false;
+ int next_read_event{};
int64_t next_sector_t = 0;
- unsigned int autopause_sector = 0, start_read_delay = 0, read_sector_cycles = 0, preread_delay = 0;
+ uint32_t autopause_sector = 0;
+ uint32_t start_read_delay = 0;
+ uint32_t read_sector_cycles = 0;
+ uint32_t preread_delay = 0;
uint32_t m_param_count = 0;
uint32_t m_sysclock = 0;
diff --git a/src/mame/machine/qx10kbd.cpp b/src/mame/machine/qx10kbd.cpp
index a3ffff7c637..64105686b9e 100644
--- a/src/mame/machine/qx10kbd.cpp
+++ b/src/mame/machine/qx10kbd.cpp
@@ -27,7 +27,7 @@ tiny_rom_entry const *qx10_keyboard_device::device_rom_region() const
void qx10_keyboard_device::device_start()
{
- m_bit_timer = timer_alloc();
+ m_bit_timer = timer_alloc(FUNC(qx10_keyboard_device::toggle_clk), this);
m_bit_timer->adjust(attotime::from_hz(2400), 0, attotime::from_hz(2400));
m_clk_state = 0;
}
@@ -37,7 +37,7 @@ WRITE_LINE_MEMBER(qx10_keyboard_device::input_txd)
m_rxd = state;
}
-void qx10_keyboard_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(qx10_keyboard_device::toggle_clk)
{
m_clk_state = !m_clk_state;
}
diff --git a/src/mame/machine/qx10kbd.h b/src/mame/machine/qx10kbd.h
index 846829fd5a3..6e7d15a701a 100644
--- a/src/mame/machine/qx10kbd.h
+++ b/src/mame/machine/qx10kbd.h
@@ -22,15 +22,17 @@ public:
protected:
virtual const tiny_rom_entry *device_rom_region() const override;
virtual void device_add_mconfig(machine_config &config) override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_start() override;
+ TIMER_CALLBACK_MEMBER(toggle_clk);
+
private:
required_ioport_array<16> m_rows;
required_device<cpu_device> m_mcu;
emu_timer *m_bit_timer = nullptr;
u8 m_rxd = 0;
- int m_row = 0, m_clk_state = 0;
+ int m_row = 0;
+ int m_clk_state = 0;
};
DECLARE_DEVICE_TYPE(QX10_KEYBOARD, qx10_keyboard_device)
diff --git a/src/mame/machine/rm380z.cpp b/src/mame/machine/rm380z.cpp
index 4d8d57a1405..76651b1547d 100644
--- a/src/mame/machine/rm380z.cpp
+++ b/src/mame/machine/rm380z.cpp
@@ -226,7 +226,7 @@ void rm380z_state::disk_0_control(uint8_t data)
void rm380z_state::machine_start()
{
- m_static_vblank_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(rm380z_state::static_vblank_timer), this));
+ m_static_vblank_timer = timer_alloc(FUNC(rm380z_state::static_vblank_timer), this);
m_static_vblank_timer->adjust(attotime::from_hz(TIMER_SPEED), 0, attotime::from_hz(TIMER_SPEED));
}
diff --git a/src/mame/machine/rmnimbus.cpp b/src/mame/machine/rmnimbus.cpp
index 9805cb0a4ef..557422c38ff 100644
--- a/src/mame/machine/rmnimbus.cpp
+++ b/src/mame/machine/rmnimbus.cpp
@@ -215,7 +215,7 @@ void rmnimbus_state::machine_reset()
void rmnimbus_state::machine_start()
{
- m_nimbus_mouse.m_mouse_timer=timer_alloc(TIMER_MOUSE);
+ m_nimbus_mouse.m_mouse_timer = timer_alloc(FUNC(rmnimbus_state::do_mouse), this);
/* setup debug commands */
if (machine().debug_flags & DEBUG_FLAG_ENABLED)
@@ -1669,18 +1669,10 @@ WRITE_LINE_MEMBER(rmnimbus_state::nimbus_msm5205_vck)
external_int(EXTERNAL_INT_MSM5205,state);
}
-void rmnimbus_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch(id)
- {
- case TIMER_MOUSE : do_mouse(); break;
- }
-}
-
static const int MOUSE_XYA[4] = { 1, 1, 0, 0 };
static const int MOUSE_XYB[4] = { 0, 1, 1, 0 };
-void rmnimbus_state::do_mouse()
+TIMER_CALLBACK_MEMBER(rmnimbus_state::do_mouse)
{
uint8_t mouse_x; // Current mouse X and Y
uint8_t mouse_y;
diff --git a/src/mame/machine/rx01.cpp b/src/mame/machine/rx01.cpp
index 48497995804..d791bd0fb80 100644
--- a/src/mame/machine/rx01.cpp
+++ b/src/mame/machine/rx01.cpp
@@ -81,6 +81,7 @@ void rx01_device::device_add_mconfig(machine_config &config)
void rx01_device::device_start()
{
+ m_command_timer = timer_alloc(FUNC(rx01_device::service_command), this);
}
@@ -90,7 +91,9 @@ void rx01_device::device_start()
void rx01_device::device_reset()
{
- for(auto & elem : m_image)
+ m_command_timer->adjust(attotime::never);
+
+ for (auto & elem : m_image)
{
elem->floppy_mon_w(0); // turn it on
elem->floppy_drive_set_controller(this);
@@ -107,7 +110,8 @@ void rx01_device::device_reset()
uint16_t rx01_device::read(offs_t offset)
{
- switch(offset & 1) {
+ switch (offset & 1)
+ {
case 0: return status_read();
default: return data_read();
}
@@ -121,7 +125,8 @@ uint16_t rx01_device::read(offs_t offset)
void rx01_device::write(offs_t offset, uint16_t data)
{
- switch(offset & 1) {
+ switch (offset & 1)
+ {
case 0: command_write(data); break;
case 1: data_write(data); break;
}
@@ -130,50 +135,51 @@ void rx01_device::write(offs_t offset, uint16_t data)
void rx01_device::command_write(uint16_t data)
{
printf("command_write %04x\n",data);
- m_unit = BIT(data,4);
- m_interrupt = BIT(data,6);
+ m_unit = BIT(data, 4);
+ m_interrupt = BIT(data, 6);
- m_image[m_unit]->floppy_drive_set_ready_state(1,0);
+ m_image[m_unit]->floppy_drive_set_ready_state(1, 0);
- if (BIT(data,14)) // Initialize
+ if (BIT(data, 14)) // Initialize
{
printf("initialize\n");
m_state = RX01_INIT;
}
else if (BIT(data,1)) // If GO bit is selected
{
- m_rxcs &= ~(1<<5); // Clear done bit
+ m_rxcs &= ~(1 << 5); // Clear done bit
m_buf_pos = 0; // Point to start of buffer
- switch((data >> 1) & 7) {
+ switch ((data >> 1) & 7)
+ {
case 0: // Fill Buffer
- m_rxcs |= (1<<7); // Set TR Bit
- m_state = RX01_FILL;
- break;
+ m_rxcs |= (1 << 7); // Set TR Bit
+ m_state = RX01_FILL;
+ break;
case 1: // Empty Buffer
- m_state = RX01_EMPTY;
- break;
+ m_state = RX01_EMPTY;
+ break;
case 2: // Write Sector
case 3: // Read Sector
case 6: // Write Deleted Data Sector
- m_rxes &= ~(1<<6 | 1<<1 | 1<<0);// Reset bits 0, 1 and 6
- m_state = RX01_SET_SECTOR;
- break;
+ m_rxes &= ~(1 << 6 | 1 << 1 | 1 << 0);// Reset bits 0, 1 and 6
+ m_state = RX01_SET_SECTOR;
+ break;
case 4: // Not Used
- m_state = RX01_COMPLETE;
- break;
+ m_state = RX01_COMPLETE;
+ break;
case 5: // Read Status
- m_state = RX01_COMPLETE;
- m_rxdb = m_rxes;
- break;
+ m_state = RX01_COMPLETE;
+ m_rxdb = m_rxes;
+ break;
case 7: // Read Error Register
- m_state = RX01_COMPLETE;
- // set ready signal according to current drive status
- m_rxes |= m_image[m_unit]->floppy_drive_get_flag_state(FLOPPY_DRIVE_READY) << 7;
- break;
+ m_state = RX01_COMPLETE;
+ // set ready signal according to current drive status
+ m_rxes |= m_image[m_unit]->floppy_drive_get_flag_state(FLOPPY_DRIVE_READY) << 7;
+ break;
}
}
- machine().scheduler().timer_set(attotime::from_msec(100), timer_expired_delegate(FUNC(rx01_device::service_command),this));
+ m_command_timer->adjust(attotime::from_msec(100));
}
uint16_t rx01_device::status_read()
@@ -186,13 +192,15 @@ void rx01_device::data_write(uint16_t data)
{
// printf("data_write %04x\n",data);
// data can be written only if TR is set
- if (BIT(m_rxcs,7)) m_rxdb = data;
- machine().scheduler().timer_set(attotime::from_msec(100), timer_expired_delegate(FUNC(rx01_device::service_command),this));
+ if (BIT(m_rxcs,7))
+ m_rxdb = data;
+ machine().scheduler().timer_set(attotime::from_msec(100), timer_expired_delegate(FUNC(rx01_device::service_command), this));
}
uint16_t rx01_device::data_read()
{
- if (m_state==RX01_EMPTY && BIT(m_rxcs,7)) m_rxcs &= (1<<7); // clear TR bit;
+ if (m_state == RX01_EMPTY && BIT(m_rxcs, 7))
+ m_rxcs &= (1 << 7); // clear TR bit;
// printf("data_read %04x\n",m_rxdb);
return m_rxdb;
}
@@ -201,46 +209,51 @@ TIMER_CALLBACK_MEMBER(rx01_device::service_command)
{
printf("service_command %d\n",m_state);
m_rxes |= m_image[m_unit]->floppy_drive_get_flag_state(FLOPPY_DRIVE_READY) << 7;
- switch(m_state) {
- case RX01_FILL :
- m_buffer[m_buf_pos] = m_rxdb & 0xff;
- m_buf_pos++;
- if (m_buf_pos<128)
- {
- m_rxcs |= (1<<7); // Set TR Bit
- } else {
- //finished
- }
- break;
- case RX01_EMPTY :
- if (m_buf_pos>=128)
- {
- //finished
- } else {
- m_buffer[m_buf_pos] = m_rxdb & 0xff;
- m_buf_pos++;
- m_rxcs |= (1<<7); // Set TR Bit
- }
- break;
+ switch (m_state)
+ {
+ case RX01_FILL:
+ m_buffer[m_buf_pos] = m_rxdb & 0xff;
+ m_buf_pos++;
+ if (m_buf_pos < 128)
+ {
+ m_rxcs |= (1 << 7); // Set TR Bit
+ }
+ else
+ {
+ //finished
+ }
+ break;
+ case RX01_EMPTY:
+ if (m_buf_pos >= 128)
+ {
+ //finished
+ }
+ else
+ {
+ m_buffer[m_buf_pos] = m_rxdb & 0xff;
+ m_buf_pos++;
+ m_rxcs |= (1 << 7); // Set TR Bit
+ }
+ break;
case RX01_SET_SECTOR:
- m_rxsa = m_rxdb & 0x1f;
- m_rxcs |= (1<<7); // Set TR Bit
- m_state = RX01_SET_TRACK;
- break;
+ m_rxsa = m_rxdb & 0x1f;
+ m_rxcs |= (1 << 7); // Set TR Bit
+ m_state = RX01_SET_TRACK;
+ break;
case RX01_SET_TRACK:
- m_rxta = m_rxdb & 0x7f;
- m_rxcs |= (1<<7); // Set TR Bit
- m_state = RX01_TRANSFER;
- position_head();
- break;
+ m_rxta = m_rxdb & 0x7f;
+ m_rxcs |= (1 << 7); // Set TR Bit
+ m_state = RX01_TRANSFER;
+ position_head();
+ break;
case RX01_TRANSFER:
- break;
+ break;
case RX01_COMPLETE:
- break;
+ break;
case RX01_INIT:
- m_rxes |= (1<<2); // Set init done flag
- m_rxcs |= (1<<5); // Set operation done
- break;
+ m_rxes |= (1 << 2); // Set init done flag
+ m_rxcs |= (1 << 5); // Set operation done
+ break;
}
}
diff --git a/src/mame/machine/rx01.h b/src/mame/machine/rx01.h
index e4fc2fe59a6..a6c128f71e8 100644
--- a/src/mame/machine/rx01.h
+++ b/src/mame/machine/rx01.h
@@ -67,6 +67,7 @@ private:
uint8_t m_buffer[128]{};
int m_buf_pos = 0;
+ emu_timer *m_command_timer = nullptr;
uint16_t m_rxcs = 0; // Command and Status Register
uint16_t m_rxdb = 0; // Data Buffer Register
uint16_t m_rxta = 0; // RX Track Address
diff --git a/src/mame/machine/saa7191.cpp b/src/mame/machine/saa7191.cpp
index 96a2e72315b..a879506e84b 100644
--- a/src/mame/machine/saa7191.cpp
+++ b/src/mame/machine/saa7191.cpp
@@ -53,9 +53,6 @@ void saa7191_device::device_start()
m_uv_out.resolve_safe();
m_hs_out.resolve_safe();
m_vs_out.resolve_safe();
-
- m_input_clock = timer_alloc(TIMER_INPUT_CLOCK);
- m_input_clock->adjust(attotime::never);
}
void saa7191_device::device_reset()
@@ -67,12 +64,6 @@ void saa7191_device::device_reset()
m_i2c_read_addr = 0x8b;
m_i2c_subaddr = 0x00;
m_i2c_state = I2C_STATE_IDLE;
-
- m_input_clock->adjust(attotime::never);
-}
-
-void saa7191_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
}
void saa7191_device::i2c_data_w(uint8_t data)
diff --git a/src/mame/machine/saa7191.h b/src/mame/machine/saa7191.h
index 51a16b43a3b..907edfdc3b0 100644
--- a/src/mame/machine/saa7191.h
+++ b/src/mame/machine/saa7191.h
@@ -39,7 +39,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
private:
void reg_w(uint8_t data);
@@ -151,10 +150,6 @@ private:
I2C_STATE_DATA_WRITE
};
- static constexpr device_timer_id TIMER_INPUT_CLOCK = 0;
-
- emu_timer *m_input_clock;
-
uint8_t m_status;
uint8_t m_regs[REG_COUNT];
diff --git a/src/mame/machine/sgi.cpp b/src/mame/machine/sgi.cpp
index 21eb109832d..0b943ae4d90 100644
--- a/src/mame/machine/sgi.cpp
+++ b/src/mame/machine/sgi.cpp
@@ -86,10 +86,10 @@ void sgi_mc_device::device_start()
m_sys_id = 0x03; // rev. C MC
m_sys_id |= m_eisa_present() << 4;
- m_rpss_timer = timer_alloc(TIMER_RPSS);
+ m_rpss_timer = timer_alloc(FUNC(sgi_mc_device::rpss_tick), this);
m_rpss_timer->adjust(attotime::never);
- m_dma_timer = timer_alloc(TIMER_DMA);
+ m_dma_timer = timer_alloc(FUNC(sgi_mc_device::perform_dma), this);
m_dma_timer->adjust(attotime::never);
save_item(NAME(m_cpu_control));
@@ -211,7 +211,7 @@ uint32_t sgi_mc_device::dma_translate(uint32_t address)
return 0;
}
-void sgi_mc_device::dma_immediate()
+TIMER_CALLBACK_MEMBER(sgi_mc_device::perform_dma)
{
uint32_t memory_addr = m_dma_mem_addr;
uint32_t linecount = get_line_count();
@@ -721,19 +721,12 @@ void sgi_mc_device::write(offs_t offset, uint32_t data, uint32_t mem_mask)
}
}
-void sgi_mc_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(sgi_mc_device::rpss_tick)
{
- if (id == TIMER_RPSS)
+ m_rpss_divide_counter--;
+ if (m_rpss_divide_counter < 0)
{
- m_rpss_divide_counter--;
- if (m_rpss_divide_counter < 0)
- {
- m_rpss_divide_counter = m_rpss_divide_count;
- m_rpss_counter += m_rpss_increment;
- }
- }
- else if (id == TIMER_DMA)
- {
- dma_immediate();
+ m_rpss_divide_counter = m_rpss_divide_count;
+ m_rpss_counter += m_rpss_increment;
}
}
diff --git a/src/mame/machine/sgi.h b/src/mame/machine/sgi.h
index 0f5fd99e670..c634e353108 100644
--- a/src/mame/machine/sgi.h
+++ b/src/mame/machine/sgi.h
@@ -41,10 +41,6 @@ protected:
virtual void device_resolve_objects() override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
- static const device_timer_id TIMER_RPSS = 0;
- static const device_timer_id TIMER_DMA = 1;
private:
enum
@@ -57,7 +53,8 @@ private:
};
uint32_t dma_translate(uint32_t address);
- void dma_immediate();
+ TIMER_CALLBACK_MEMBER(perform_dma);
+ TIMER_CALLBACK_MEMBER(rpss_tick);
uint32_t get_line_count() { return m_dma_size >> 16; }
uint32_t get_line_width() { return (uint16_t)m_dma_size; }
diff --git a/src/mame/machine/simpsons.cpp b/src/mame/machine/simpsons.cpp
index 9d6610a0b6d..995363e6fb6 100644
--- a/src/mame/machine/simpsons.cpp
+++ b/src/mame/machine/simpsons.cpp
@@ -12,14 +12,14 @@
***************************************************************************/
-void simpsons_state::simpsons_eeprom_w(uint8_t data)
+void simpsons_state::eeprom_w(uint8_t data)
{
if (data == 0xff)
return;
ioport("EEPROMOUT")->write(data, 0xff);
- simpsons_video_banking(data & 0x03);
+ video_bank_select(data & 0x03);
m_firq_enabled = data & 0x04;
if (!m_firq_enabled)
@@ -32,7 +32,7 @@ void simpsons_state::simpsons_eeprom_w(uint8_t data)
***************************************************************************/
-void simpsons_state::simpsons_coin_counter_w(uint8_t data)
+void simpsons_state::coin_counter_w(uint8_t data)
{
/* bit 0,1 coin counters */
machine().bookkeeping().coin_counter_w(0, data & 0x01);
@@ -45,7 +45,7 @@ void simpsons_state::simpsons_coin_counter_w(uint8_t data)
m_k053246->k053246_set_objcha_line((~data & 0x20) ? ASSERT_LINE : CLEAR_LINE);
}
-uint8_t simpsons_state::simpsons_sound_interrupt_r()
+uint8_t simpsons_state::sound_interrupt_r()
{
m_audiocpu->set_input_line_and_vector(0, HOLD_LINE, 0xff ); // Z80
return 0x00;
@@ -78,6 +78,9 @@ void simpsons_state::machine_start()
save_item(NAME(m_layer_colorbase));
save_item(NAME(m_layerpri));
save_pointer(NAME(m_spriteram), 0x1000 / 2);
+
+ m_dma_start_timer = timer_alloc(FUNC(simpsons_state::dma_start), this);
+ m_dma_end_timer = timer_alloc(FUNC(simpsons_state::dma_end), this);
}
void simpsons_state::machine_reset()
@@ -95,5 +98,8 @@ void simpsons_state::machine_reset()
/* init the default banks */
membank("bank1")->set_entry(0);
membank("bank2")->set_entry(0);
- simpsons_video_banking(0);
+ video_bank_select(0);
+
+ m_dma_start_timer->adjust(attotime::never);
+ m_dma_end_timer->adjust(attotime::never);
}
diff --git a/src/mame/machine/sms.cpp b/src/mame/machine/sms.cpp
index 1a2a2a3a94b..465147d6eb2 100644
--- a/src/mame/machine/sms.cpp
+++ b/src/mame/machine/sms.cpp
@@ -1041,7 +1041,7 @@ void sms_state::machine_start()
}
}
- m_lphaser_th_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sms_state::lphaser_th_generate),this));
+ m_lphaser_th_timer = timer_alloc(FUNC(sms_state::lphaser_th_generate), this);
save_item(NAME(m_mapper));
save_item(NAME(m_port_dc_reg));
diff --git a/src/mame/machine/snes.cpp b/src/mame/machine/snes.cpp
index d8bdd2bf16c..fe2a810c5ee 100644
--- a/src/mame/machine/snes.cpp
+++ b/src/mame/machine/snes.cpp
@@ -52,44 +52,10 @@ void snes_state::scpu_irq_refresh()
}
-void snes_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_NMI_TICK:
- snes_nmi_tick(param);
- break;
- case TIMER_HIRQ_TICK:
- snes_hirq_tick_callback(param);
- break;
- case TIMER_RESET_OAM_ADDRESS:
- snes_reset_oam_address(param);
- break;
- case TIMER_RESET_HDMA:
- snes_reset_hdma(param);
- break;
- case TIMER_UPDATE_IO:
- snes_update_io(param);
- break;
- case TIMER_SCANLINE_TICK:
- snes_scanline_tick(param);
- break;
- case TIMER_HBLANK_TICK:
- snes_hblank_tick(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in snes_state::device_timer");
- }
-}
-
-
TIMER_CALLBACK_MEMBER(snes_state::snes_nmi_tick)
{
// pull NMI
m_maincpu->set_input_line(G65816_LINE_NMI, ASSERT_LINE);
-
- // don't happen again
- m_nmi_timer->adjust(attotime::never);
}
void snes_state::hirq_tick()
@@ -99,9 +65,6 @@ void snes_state::hirq_tick()
m_ppu->set_latch_hv(m_ppu->current_x(), m_ppu->current_y());
SNES_CPU_REG(TIMEUP) = 0x80; /* Indicate that irq occurred */
scpu_irq_refresh();
-
- // don't happen again
- m_hirq_timer->adjust(attotime::never);
}
TIMER_CALLBACK_MEMBER(snes_state::snes_hirq_tick_callback)
@@ -125,8 +88,6 @@ TIMER_CALLBACK_MEMBER(snes_state::snes_update_io)
{
io_read();
SNES_CPU_REG(HVBJOY) &= 0xfe; /* Clear busy bit */
-
- m_io_timer->adjust(attotime::never);
}
TIMER_CALLBACK_MEMBER(snes_state::snes_scanline_tick)
@@ -180,7 +141,7 @@ TIMER_CALLBACK_MEMBER(snes_state::snes_scanline_tick)
/* Start of VBlank */
if (m_ppu->current_vert() == m_ppu->last_visible_line())
{
- timer_set(m_screen->time_until_pos(m_ppu->current_vert(), 10), TIMER_RESET_OAM_ADDRESS);
+ m_oam_reset_addr_timer->adjust(m_screen->time_until_pos(m_ppu->current_vert(), 10));
SNES_CPU_REG(HVBJOY) |= 0x81; /* Set vblank bit to on & indicate controllers being read */
SNES_CPU_REG(RDNMI) |= 0x80; /* Set NMI occurred bit */
@@ -212,7 +173,6 @@ TIMER_CALLBACK_MEMBER(snes_state::snes_scanline_tick)
m_maincpu->set_input_line(G65816_LINE_NMI, CLEAR_LINE );
}
- m_scanline_timer->adjust(attotime::never);
m_hblank_timer->adjust(m_screen->time_until_pos(m_ppu->current_vert(), m_hblank_offset * m_ppu->htmult()));
// printf("%02x %d\n",SNES_CPU_REG(HVBJOY),m_ppu->current_vert());
@@ -226,9 +186,6 @@ TIMER_CALLBACK_MEMBER(snes_state::snes_hblank_tick)
m_ppu->set_current_vert(m_screen->vpos());
- /* make sure we halt */
- m_hblank_timer->adjust(attotime::never);
-
/* draw a scanline */
if (m_ppu->current_vert() <= m_ppu->last_visible_line())
{
@@ -559,7 +516,7 @@ void snes_state::snes_w_io(address_space &space, offs_t offset, uint8_t data)
return;
case HDMAEN: /* HDMA channel designation */
if (data != SNES_CPU_REG(HDMAEN)) //if a HDMA is enabled, data is inited at the next scanline
- timer_set(m_screen->time_until_pos(m_ppu->current_vert() + 1), TIMER_RESET_HDMA);
+ m_hdma_reset_timer->adjust(m_screen->time_until_pos(m_ppu->current_vert() + 1));
SNES_CPU_REG(HDMAEN) = data;
return;
case TIMEUP: // IRQ Flag is cleared on both read and write
@@ -1018,20 +975,24 @@ uint8_t snes_state::oldjoy2_read(int latched)
void snes_state::snes_init_timers()
{
/* init timers and stop them */
- m_scanline_timer = timer_alloc(TIMER_SCANLINE_TICK);
+ m_scanline_timer = timer_alloc(FUNC(snes_state::snes_scanline_tick), this);
m_scanline_timer->adjust(attotime::never);
- m_hblank_timer = timer_alloc(TIMER_HBLANK_TICK);
+ m_hblank_timer = timer_alloc(FUNC(snes_state::snes_hblank_tick), this);
m_hblank_timer->adjust(attotime::never);
- m_nmi_timer = timer_alloc(TIMER_NMI_TICK);
+ m_nmi_timer = timer_alloc(FUNC(snes_state::snes_nmi_tick), this);
m_nmi_timer->adjust(attotime::never);
- m_hirq_timer = timer_alloc(TIMER_HIRQ_TICK);
+ m_hirq_timer = timer_alloc(FUNC(snes_state::snes_hirq_tick_callback), this);
m_hirq_timer->adjust(attotime::never);
//m_div_timer = timer_alloc(TIMER_DIV);
//m_div_timer->adjust(attotime::never);
//m_mult_timer = timer_alloc(TIMER_MULT);
//m_mult_timer->adjust(attotime::never);
- m_io_timer = timer_alloc(TIMER_UPDATE_IO);
+ m_io_timer = timer_alloc(FUNC(snes_state::snes_update_io), this);
m_io_timer->adjust(attotime::never);
+ m_oam_reset_addr_timer = timer_alloc(FUNC(snes_state::snes_reset_oam_address), this);
+ m_oam_reset_addr_timer->adjust(attotime::never);
+ m_hdma_reset_timer = timer_alloc(FUNC(snes_state::snes_reset_hdma), this);
+ m_hdma_reset_timer->adjust(attotime::never);
// SNES hcounter has a 0-339 range. hblank starts at counter 260.
// clayfighter sets an HIRQ at 260, apparently it wants it to be before hdma kicks off, so we'll delay 2 pixels.
diff --git a/src/mame/machine/sorcerer.cpp b/src/mame/machine/sorcerer.cpp
index 85729ba7041..fdd3273b58d 100644
--- a/src/mame/machine/sorcerer.cpp
+++ b/src/mame/machine/sorcerer.cpp
@@ -28,22 +28,6 @@ TIMER_CALLBACK_MEMBER(sorcerer_state::serial_tc)
}
-void sorcerer_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_SERIAL:
- serial_tc(param);
- break;
- case TIMER_CASSETTE:
- cassette_tc(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in sorcerer_state::device_timer");
- }
-}
-
-
/* timer to read cassette waveforms */
TIMER_CALLBACK_MEMBER(sorcerer_state::cassette_tc)
@@ -437,8 +421,8 @@ u8 sorcerer_state::portfe_r()
// ************ MACHINE **************
void sorcerer_state::machine_start_common(offs_t endmem)
{
- m_cassette_timer = timer_alloc(TIMER_CASSETTE);
- m_serial_timer = timer_alloc(TIMER_SERIAL);
+ m_cassette_timer = timer_alloc(FUNC(sorcerer_state::cassette_tc), this);
+ m_serial_timer = timer_alloc(FUNC(sorcerer_state::serial_tc), this);
m_halt = false;
diff --git a/src/mame/machine/starwars.cpp b/src/mame/machine/starwars.cpp
index dcaf2205f3a..93836c10d2e 100644
--- a/src/mame/machine/starwars.cpp
+++ b/src/mame/machine/starwars.cpp
@@ -115,7 +115,7 @@ void starwars_state::starwars_mproc_init()
m_PROM_AM[cnt] = (val >> 7) & 0x0001;
}
- m_math_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(starwars_state::math_run_clear),this));
+ m_math_timer = timer_alloc(FUNC(starwars_state::math_run_clear), this);
}
diff --git a/src/mame/machine/stfight.cpp b/src/mame/machine/stfight.cpp
index c20c656e0d5..1267445e71f 100644
--- a/src/mame/machine/stfight.cpp
+++ b/src/mame/machine/stfight.cpp
@@ -72,7 +72,7 @@ void stfight_state::machine_start()
m_main_bank->configure_entries(0, 4, memregion("maincpu")->base() + 0x10000, 0x4000);
m_main_bank->set_entry(0);
- m_int1_timer = timer_alloc(TIMER_STFIGHT_INTERRUPT_1);
+ m_int1_timer = timer_alloc(FUNC(stfight_state::rst08_tick), this);
save_item(NAME(m_coin_state));
save_item(NAME(m_fm_data));
@@ -109,17 +109,9 @@ void stfight_state::stfight_bank_w(uint8_t data)
* CPU 1 timed interrupt - 60Hz???
*/
-void stfight_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(stfight_state::rst08_tick)
{
- switch (id)
- {
- case TIMER_STFIGHT_INTERRUPT_1:
- // Do a RST08
- m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 0xd7); // Z80
- break;
- default:
- throw emu_fatalerror("Unknown id in stfight_state::device_timer");
- }
+ m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 0xd7); // Z80
}
INTERRUPT_GEN_MEMBER(stfight_state::stfight_vb_interrupt)
diff --git a/src/mame/machine/swtpc09.cpp b/src/mame/machine/swtpc09.cpp
index 2741a6f5e3c..fe7b02b9d80 100644
--- a/src/mame/machine/swtpc09.cpp
+++ b/src/mame/machine/swtpc09.cpp
@@ -1010,7 +1010,7 @@ void swtpc09_state::machine_start()
m_dmaf_high_address[2] = 0;
m_dmaf_high_address[3] = 0;
- m_floppy_motor_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(swtpc09_state::floppy_motor_callback),this));
+ m_floppy_motor_timer = timer_alloc(FUNC(swtpc09_state::floppy_motor_callback), this);
m_floppy_motor_on = 0;
// reset the 6844
diff --git a/src/mame/machine/thomson.cpp b/src/mame/machine/thomson.cpp
index 378bf038f1a..78dc3f877e6 100644
--- a/src/mame/machine/thomson.cpp
+++ b/src/mame/machine/thomson.cpp
@@ -867,7 +867,7 @@ TIMER_CALLBACK_MEMBER(thomson_state::to7_game_update_cb)
void thomson_state::to7_game_init()
{
LOG (( "to7_game_init called\n" ));
- m_to7_game_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(thomson_state::to7_game_update_cb),this));
+ m_to7_game_timer = timer_alloc(FUNC(thomson_state::to7_game_update_cb), this);
m_to7_game_timer->adjust(TO7_GAME_POLL_PERIOD, 0, TO7_GAME_POLL_PERIOD);
save_item(NAME(m_to7_game_sound));
save_item(NAME(m_to7_game_mute));
@@ -1597,7 +1597,7 @@ MACHINE_START_MEMBER( mo5_state, mo5 )
to7_game_init();
to7_modem_init();
to7_midi_init();
- m_mo5_periodic_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mo5_state::mo5_periodic_cb),this));
+ m_mo5_periodic_timer = timer_alloc(FUNC(mo5_state::mo5_periodic_cb), this);
m_extension->rom_map(m_maincpu->space(AS_PROGRAM), 0xa000, 0xa7bf);
m_extension->io_map (m_maincpu->space(AS_PROGRAM), 0xa7d0, 0xa7df);
@@ -2423,7 +2423,7 @@ void to9_state::to9_kbd_reset()
void to9_state::to9_kbd_init()
{
LOG(( "to9_kbd_init called\n" ));
- m_to9_kbd_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(to9_state::to9_kbd_timer_cb),this));
+ m_to9_kbd_timer = timer_alloc(FUNC(to9_state::to9_kbd_timer_cb), this);
save_item(NAME(m_to9_kbd_parity));
save_item(NAME(m_to9_kbd_intr));
save_item(NAME(m_to9_kbd_in));
@@ -2877,7 +2877,7 @@ void to9_state::to8_kbd_reset()
void to9_state::to8_kbd_init()
{
- m_to8_kbd_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(to9_state::to8_kbd_timer_cb),this));
+ m_to8_kbd_timer = timer_alloc(FUNC(to9_state::to8_kbd_timer_cb), this);
m_to8_kbd_signal = machine().scheduler().timer_alloc(timer_expired_delegate());
save_item(NAME(m_to8_kbd_ack));
save_item(NAME(m_to8_kbd_data));
@@ -4001,7 +4001,7 @@ TIMER_CALLBACK_MEMBER(mo6_state::mo6_game_update_cb)
void mo6_state::mo6_game_init()
{
LOG (( "mo6_game_init called\n" ));
- m_to7_game_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mo6_state::mo6_game_update_cb),this));
+ m_to7_game_timer = timer_alloc(FUNC(mo6_state::mo6_game_update_cb), this);
m_to7_game_timer->adjust(TO7_GAME_POLL_PERIOD, 0, TO7_GAME_POLL_PERIOD);
save_item(NAME(m_to7_game_sound));
save_item(NAME(m_to7_game_mute));
@@ -4303,7 +4303,7 @@ MACHINE_START_MEMBER( mo6_state, mo6 )
to9_palette_init();
to7_modem_init();
to7_midi_init();
- m_mo5_periodic_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mo6_state::mo5_periodic_cb),this));
+ m_mo5_periodic_timer = timer_alloc(FUNC(mo6_state::mo5_periodic_cb), this);
m_extension->rom_map(m_maincpu->space(AS_PROGRAM), 0xa000, 0xa7bf);
m_extension->io_map (m_maincpu->space(AS_PROGRAM), 0xa7d0, 0xa7df);
@@ -4423,7 +4423,7 @@ void mo5nr_state::mo5nr_sys_porta_out(uint8_t data)
void mo5nr_state::mo5nr_game_init()
{
LOG (( "mo5nr_game_init called\n" ));
- m_to7_game_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mo5nr_state::mo6_game_update_cb),this));
+ m_to7_game_timer = timer_alloc(FUNC(mo5nr_state::mo6_game_update_cb), this);
m_to7_game_timer->adjust( TO7_GAME_POLL_PERIOD, 0, TO7_GAME_POLL_PERIOD );
save_item(NAME(m_to7_game_sound));
save_item(NAME(m_to7_game_mute));
@@ -4505,7 +4505,7 @@ MACHINE_START_MEMBER( mo5nr_state, mo5nr )
to9_palette_init();
to7_modem_init();
to7_midi_init();
- m_mo5_periodic_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mo5nr_state::mo5_periodic_cb),this));
+ m_mo5_periodic_timer = timer_alloc(FUNC(mo5nr_state::mo5_periodic_cb), this);
m_extension->rom_map(m_extension_view[0], 0xa000, 0xa7bf);
m_extension->io_map (m_extension_view[0], 0xa7d0, 0xa7df);
diff --git a/src/mame/machine/ti85.cpp b/src/mame/machine/ti85.cpp
index a9c473ba3c5..3906581466b 100644
--- a/src/mame/machine/ti85.cpp
+++ b/src/mame/machine/ti85.cpp
@@ -71,66 +71,34 @@ TIMER_CALLBACK_MEMBER(ti85_state::ti83_timer2_callback)
}
}
-void ti85_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(ti85_state::crystal_timer_tick)
{
- switch (id)
+ int id = param;
+
+ if (m_ctimer[id].count)
{
- case CRYSTAL_TIMER3:
- case CRYSTAL_TIMER2:
- case CRYSTAL_TIMER1:
- if (m_ctimer[id].count)
+ m_ctimer[id].count--;
+ if (!m_ctimer[id].count)
{
- m_ctimer[id].count--;
- if (!m_ctimer[id].count)
+ if (!(m_ctimer[id].loop & 4))
{
- if (!(m_ctimer[id].loop & 4))
+ if (!(m_ctimer[id].loop & 1))
{
- if (!(m_ctimer[id].loop & 1))
- {
- m_ctimer[id].setup = 0;
- }
- else
- {
- ti83pse_count(id, m_ctimer[id].max);
- }
- if (!(m_ctimer[id].loop & 2))
- {
- //generate interrupt
- m_ctimer_interrupt_status |= (0x20 << id);
- m_maincpu->set_input_line(0, HOLD_LINE);
- }
- m_ctimer[id].loop &= 2;
+ m_ctimer[id].setup = 0;
}
+ else
+ {
+ ti83pse_count(id, m_ctimer[id].max);
+ }
+ if (!(m_ctimer[id].loop & 2))
+ {
+ //generate interrupt
+ m_ctimer_interrupt_status |= (0x20 << id);
+ m_maincpu->set_input_line(0, HOLD_LINE);
+ }
+ m_ctimer[id].loop &= 2;
}
}
- break;
- case HW_TIMER1:
- if (ioport("ON")->read() & 0x01)
- {
- if (m_ON_interrupt_mask && !m_ON_pressed)
- {
- m_maincpu->set_input_line(0, HOLD_LINE);
- m_ON_interrupt_status = 1;
- }
- m_ON_pressed = 1;
- return;
- }
- else
- {
- m_ON_pressed = 0;
- }
- if (m_timer_interrupt_mask & 2)
- {
- m_maincpu->set_input_line(0, HOLD_LINE);
- m_timer_interrupt_status = m_timer_interrupt_status | 2;
- }
- break;
- case HW_TIMER2:
- if (m_timer_interrupt_mask & 4)
- {
- m_maincpu->set_input_line(0, HOLD_LINE);
- m_timer_interrupt_status = m_timer_interrupt_status | 4;
- }
}
}
@@ -255,7 +223,7 @@ void ti85_state::machine_start()
m_port4_bit0 = 0;
m_ti81_port_7_data = 0;
- m_ti85_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ti85_state::ti85_timer_callback), this));
+ m_ti85_timer = timer_alloc(FUNC(ti85_state::ti85_timer_callback), this);
m_ti85_timer->adjust(attotime::from_hz(256), 0, attotime::from_hz(256));
space.unmap_write(0x0000, 0x3fff);
@@ -360,9 +328,9 @@ MACHINE_START_MEMBER(ti85_state,ti83p)
ti85_state::update_ti83p_memory();
- m_ti83_1st_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ti85_state::ti83_timer1_callback), this));
+ m_ti83_1st_timer = timer_alloc(FUNC(ti85_state::ti83_timer1_callback), this);
m_ti83_1st_timer->adjust(attotime::from_hz(256), 0, attotime::from_hz(256));
- m_ti83_2nd_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ti85_state::ti83_timer2_callback), this));
+ m_ti83_2nd_timer = timer_alloc(FUNC(ti85_state::ti83_timer2_callback), this);
m_ti83_2nd_timer->adjust(attotime::from_hz(512), 0, attotime::from_hz(512));
/* save states and debugging */
@@ -400,14 +368,14 @@ void ti85_state::ti8xpse_init_common()
ti85_state::update_ti83pse_memory();
- m_ti83_1st_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ti85_state::ti83_timer1_callback), this));
+ m_ti83_1st_timer = timer_alloc(FUNC(ti85_state::ti83_timer1_callback), this);
m_ti83_1st_timer->adjust(attotime::from_hz(256), 0, attotime::from_hz(256));
- m_ti83_2nd_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ti85_state::ti83_timer2_callback), this));
+ m_ti83_2nd_timer = timer_alloc(FUNC(ti85_state::ti83_timer2_callback), this);
m_ti83_2nd_timer->adjust(attotime::from_hz(512), 0, attotime::from_hz(512));
- m_crystal_timer1 = timer_alloc(CRYSTAL_TIMER1);
- m_crystal_timer2 = timer_alloc(CRYSTAL_TIMER2);
- m_crystal_timer3 = timer_alloc(CRYSTAL_TIMER3);
+ m_crystal_timer1 = timer_alloc(FUNC(ti85_state::crystal_timer_tick), this);
+ m_crystal_timer2 = timer_alloc(FUNC(ti85_state::crystal_timer_tick), this);
+ m_crystal_timer3 = timer_alloc(FUNC(ti85_state::crystal_timer_tick), this);
/* save states and debugging */
save_item(NAME(m_ctimer_interrupt_status));
@@ -472,7 +440,7 @@ MACHINE_START_MEMBER(ti85_state,ti86)
membank("bank4")->set_base(m_ti8x_ram.get());
subdevice<nvram_device>("nvram")->set_base(m_ti8x_ram.get(), sizeof(uint8_t)*128*1024);
- m_ti85_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ti85_state::ti85_timer_callback), this));
+ m_ti85_timer = timer_alloc(FUNC(ti85_state::ti85_timer_callback), this);
m_ti85_timer->adjust(attotime::from_hz(256), 0, attotime::from_hz(256));
}
@@ -486,34 +454,31 @@ uint8_t ti85_state::ti85_port_0000_r()
uint8_t ti85_state::ti8x_keypad_r()
{
- int data = 0xff;
- int port;
- int bit;
- static const char *const bitnames[] = { "BIT0", "BIT1", "BIT2", "BIT3", "BIT4", "BIT5", "BIT6", "BIT7" };
+ uint8_t data = 0xff;
if (m_keypad_mask == 0x7f) return data;
- for (bit = 0; bit < 7; bit++)
+ for (int bit = 0; bit < 7; bit++)
{
- if (~m_keypad_mask&(0x01<<bit))
+ if (BIT(~m_keypad_mask, bit))
{
- for (port = 0; port < 8; port++)
+ for (int port = 0; port < 8; port++)
{
- data ^= ioport(bitnames[port])->read() & (0x01<<bit) ? 0x01<<port : 0x00;
+ data ^= BIT(m_keys[port]->read(), bit) ? (1 << port) : 0x00;
}
}
}
return data;
}
- uint8_t ti85_state::ti85_port_0002_r()
+uint8_t ti85_state::ti85_port_0002_r()
{
return 0xff;
}
- uint8_t ti85_state::ti85_port_0003_r()
+uint8_t ti85_state::ti85_port_0003_r()
{
- int data = 0;
+ uint8_t data = 0;
if (m_LCD_status)
data |= m_LCD_mask;
@@ -528,12 +493,12 @@ uint8_t ti85_state::ti8x_keypad_r()
return data;
}
- uint8_t ti85_state::ti85_port_0004_r()
+uint8_t ti85_state::ti85_port_0004_r()
{
return 0xff;
}
- uint8_t ti85_state::ti85_port_0005_r()
+uint8_t ti85_state::ti85_port_0005_r()
{
return m_ti8x_memory_page_1;
}
@@ -592,7 +557,7 @@ uint8_t ti85_state::ti83_port_0002_r()
uint8_t ti85_state::ti83_port_0003_r()
{
- int data = 0;
+ uint8_t data = 0;
if (m_ON_interrupt_status)
data |= 0x01;
@@ -623,12 +588,12 @@ uint8_t ti85_state::ti8x_plus_serial_r()
uint8_t ti85_state::ti83p_port_0002_r()
{
- return m_ti8x_port2|3;
+ return m_ti8x_port2 | 3;
}
uint8_t ti85_state::ti83p_port_0004_r()
{
- int data = 0;
+ uint8_t data = 0;
//data |= m_LCD_mask;
@@ -656,7 +621,7 @@ uint8_t ti85_state::ti83p_port_0004_r()
uint8_t ti85_state::ti83pse_port_0002_r()
{
- return 0xC3 | (m_flash_unlocked << 2);
+ return 0xc3 | (m_flash_unlocked << 2);
}
uint8_t ti85_state::ti83pse_port_0009_r()
@@ -682,28 +647,29 @@ void ti85_state::ti85_port_0000_w(uint8_t data)
void ti85_state::ti8x_keypad_w(uint8_t data)
{
- m_keypad_mask = data&0x7f;
+ m_keypad_mask = data & 0x7f;
}
void ti85_state::ti85_port_0002_w(uint8_t data)
{
- m_LCD_contrast = data&0x1f;
+ m_LCD_contrast = data & 0x1f;
}
void ti85_state::ti85_port_0003_w(uint8_t data)
{
- if (m_LCD_status && !(data&0x08)) m_timer_interrupt_mask = 0;
- m_ON_interrupt_mask = data&0x01;
-// m_timer_interrupt_mask = data&0x04;
- m_LCD_mask = data&0x02;
- m_LCD_status = data&0x08;
+ if (m_LCD_status && !(data & 0x08))
+ m_timer_interrupt_mask = 0;
+ m_ON_interrupt_mask = data & 0x01;
+// m_timer_interrupt_mask = data & 0x04;
+ m_LCD_mask = data & 0x02;
+ m_LCD_status = data & 0x08;
}
void ti85_state::ti85_port_0004_w(uint8_t data)
{
- m_video_buffer_width = (data>>3)&0x03;
- m_interrupt_speed = (data>>1)&0x03;
- m_port4_bit0 = data&0x01;
+ m_video_buffer_width = (data >> 3) & 0x03;
+ m_interrupt_speed = (data >> 1) & 0x03;
+ m_port4_bit0 = data & 0x01;
}
void ti85_state::ti85_port_0005_w(uint8_t data)
@@ -740,19 +706,19 @@ void ti85_state::ti8x_serial_w(uint8_t data)
void ti85_state::ti86_port_0005_w(uint8_t data)
{
- m_ti8x_memory_page_1 = data&((data&0x40)?0x47:0x4f);
+ m_ti8x_memory_page_1 = data & ((data & 0x40) ? 0x47 : 0x4f);
update_ti86_memory();
}
void ti85_state::ti86_port_0006_w(uint8_t data)
{
- m_ti8x_memory_page_2 = data&((data&0x40)?0x47:0x4f);
+ m_ti8x_memory_page_2 = data & ((data & 0x40) ? 0x47 : 0x4f);
update_ti86_memory();
}
void ti85_state::ti82_port_0002_w(uint8_t data)
{
- m_ti8x_memory_page_1 = (data & 0x07);
+ m_ti8x_memory_page_1 = data & 0x07;
update_ti85_memory();
m_ti8x_port2 = data;
}
@@ -772,11 +738,12 @@ void ti85_state::ti83_port_0002_w(uint8_t data)
void ti85_state::ti83_port_0003_w(uint8_t data)
{
- if (m_LCD_status && !(data&0x08)) m_timer_interrupt_mask = 0;
- m_ON_interrupt_mask = data&0x01;
- //m_timer_interrupt_mask = data&0x04;
- m_LCD_mask = data&0x02;
- m_LCD_status = data&0x08;
+ if (m_LCD_status && !(data & 0x08))
+ m_timer_interrupt_mask = 0;
+ m_ON_interrupt_mask = data & 0x01;
+ //m_timer_interrupt_mask = data & 0x04;
+ m_LCD_mask = data & 0x02;
+ m_LCD_status = data & 0x08;
}
void ti85_state::ti8x_plus_serial_w(uint8_t data)
@@ -801,14 +768,14 @@ void ti85_state::ti8x_plus_serial_w(uint8_t data)
void ti85_state::ti83pse_int_ack_w(uint8_t data)
{
- //Lets ignore this for now, I think it'll be fine.
+ //Lets ignore this for now, it should be fine.
m_ON_interrupt_status = data & 1;
m_timer_interrupt_status = data & 0x06;
}
void ti85_state::ti83p_int_mask_w(uint8_t data)
{
- //m_LCD_mask = (data&0x08) >> 2;
+ //m_LCD_mask = (data & 0x08) >> 2;
m_ON_interrupt_mask = data & 0x01;
m_ON_interrupt_status &= m_ON_interrupt_mask;
@@ -825,13 +792,13 @@ void ti85_state::ti83p_port_0004_w(uint8_t data)
void ti85_state::ti83p_port_0006_w(uint8_t data)
{
- m_ti8x_memory_page_1 = data & ((data&0x40) ? 0x41 : 0x5f);
+ m_ti8x_memory_page_1 = data & ((data & 0x40) ? 0x41 : 0x5f);
update_ti83p_memory();
}
void ti85_state::ti83p_port_0007_w(uint8_t data)
{
- m_ti8x_memory_page_2 = data & ((data&0x40) ? 0x41 : 0x5f);
+ m_ti8x_memory_page_2 = data & ((data & 0x40) ? 0x41 : 0x5f);
update_ti83p_memory();
}
@@ -849,7 +816,7 @@ void ti85_state::ti83pse_port_0005_w(uint8_t data)
void ti85_state::ti83pse_port_0006_w(uint8_t data)
{
- if ((m_model == TI84P) && (data < 0x80))
+ if (m_model == TI84P && data < 0x80)
{
m_ti8x_memory_page_1 = data & 0x3f;
}
@@ -862,7 +829,7 @@ void ti85_state::ti83pse_port_0006_w(uint8_t data)
void ti85_state::ti83pse_port_0007_w(uint8_t data)
{
- if ((m_model == TI84P) && (data < 0x80))
+ if (m_model == TI84P && data < 0x80)
{
m_ti8x_memory_page_2 = data & 0x3f;
}
@@ -882,7 +849,7 @@ void ti85_state::ti83p_port_0014_w(uint8_t data)
void ti85_state::ti83pse_port_0020_w(uint8_t data)
{
m_cpu_speed = data;
- if(data)
+ if (data)
{
m_maincpu->set_unscaled_clock(15000000);
}
@@ -955,15 +922,15 @@ void ti85_state::ti83pse_count( uint8_t timer, uint8_t data)
switch (timer)
{
case CRYSTAL_TIMER1:
- m_crystal_timer1->adjust(attotime::zero, 0, attotime::from_hz( 32768.0f/m_ctimer[timer].divsor));
+ m_crystal_timer1->adjust(attotime::zero, CRYSTAL_TIMER1, attotime::from_hz(32768.0f / m_ctimer[timer].divsor));
m_crystal_timer1->enable(true);
break;
case CRYSTAL_TIMER2:
- m_crystal_timer2->adjust(attotime::zero, 0, attotime::from_hz( 32768.0f/m_ctimer[timer].divsor));
+ m_crystal_timer2->adjust(attotime::zero, CRYSTAL_TIMER2, attotime::from_hz(32768.0f / m_ctimer[timer].divsor));
m_crystal_timer2->enable(true);
break;
case CRYSTAL_TIMER3:
- m_crystal_timer3->adjust(attotime::zero, 0, attotime::from_hz( 32768.0f/m_ctimer[timer].divsor));
+ m_crystal_timer3->adjust(attotime::zero, CRYSTAL_TIMER3, attotime::from_hz(32768.0f / m_ctimer[timer].divsor));
m_crystal_timer3->enable(true);
break;
@@ -1081,14 +1048,13 @@ void ti85_state::ti83pse_ctimer3_count_w(uint8_t data)
TI calculators snapshot files (SAV)
***************************************************************************/
-void ti85_state::ti8x_snapshot_setup_registers (uint8_t * data)
+void ti85_state::ti8x_snapshot_setup_registers(uint8_t *data)
{
- unsigned char lo,hi;
- unsigned char * reg = data + 0x40;
+ uint8_t *reg = data + 0x40;
/* Set registers */
- lo = reg[0x00] & 0x0ff;
- hi = reg[0x01] & 0x0ff;
+ uint8_t lo = reg[0x00] & 0x0ff;
+ uint8_t hi = reg[0x01] & 0x0ff;
m_maincpu->set_state_int(Z80_AF, (hi << 8) | lo);
lo = reg[0x04] & 0x0ff;
hi = reg[0x05] & 0x0ff;
@@ -1123,47 +1089,46 @@ void ti85_state::ti8x_snapshot_setup_registers (uint8_t * data)
lo = reg[0x2c] & 0x0ff;
hi = reg[0x2d] & 0x0ff;
m_maincpu->set_state_int(Z80_HL2, (hi << 8) | lo);
- m_maincpu->set_state_int(Z80_IFF1, reg[0x30]&0x0ff);
- m_maincpu->set_state_int(Z80_IFF2, reg[0x34]&0x0ff);
- m_maincpu->set_state_int(Z80_HALT, reg[0x38]&0x0ff);
- m_maincpu->set_state_int(Z80_IM, reg[0x3c]&0x0ff);
- m_maincpu->set_state_int(Z80_I, reg[0x40]&0x0ff);
+ m_maincpu->set_state_int(Z80_IFF1, reg[0x30] & 0x0ff);
+ m_maincpu->set_state_int(Z80_IFF2, reg[0x34] & 0x0ff);
+ m_maincpu->set_state_int(Z80_HALT, reg[0x38] & 0x0ff);
+ m_maincpu->set_state_int(Z80_IM, reg[0x3c] & 0x0ff);
+ m_maincpu->set_state_int(Z80_I, reg[0x40] & 0x0ff);
- m_maincpu->set_state_int(Z80_R, (reg[0x44]&0x7f) | (reg[0x48]&0x80));
+ m_maincpu->set_state_int(Z80_R, (reg[0x44] & 0x7f) | (reg[0x48] & 0x80));
m_maincpu->set_input_line(0, 0);
m_maincpu->set_input_line(INPUT_LINE_NMI, 0);
m_maincpu->set_input_line(INPUT_LINE_HALT, 0);
}
-void ti85_state::ti85_setup_snapshot (uint8_t * data)
+void ti85_state::ti85_setup_snapshot(uint8_t *data)
{
address_space &space = m_maincpu->space(AS_PROGRAM);
- int i;
- unsigned char lo,hi;
- unsigned char * hdw = data + 0x8000 + 0x94;
+ uint8_t *hdw = data + 0x8000 + 0x94;
- ti8x_snapshot_setup_registers (data);
+ ti8x_snapshot_setup_registers(data);
/* Memory dump */
- for (i = 0; i < 0x8000; i++)
- space.write_byte(i + 0x8000, data[i+0x94]);
+ for (int i = 0; i < 0x8000; i++)
+ space.write_byte(i + 0x8000, data[i + 0x94]);
- m_keypad_mask = hdw[0x00]&0x7f;
+ m_keypad_mask = hdw[0x00] & 0x7f;
- m_ti8x_memory_page_1 = hdw[0x08]&0xff;
+ m_ti8x_memory_page_1 = hdw[0x08] & 0xff;
update_ti85_memory();
- m_power_mode = hdw[0x14]&0xff;
+ m_power_mode = hdw[0x14] & 0xff;
- lo = hdw[0x28] & 0x0ff;
- hi = hdw[0x29] & 0x0ff;
- m_LCD_memory_base = (((hi << 8) | lo)-0xc000)>>8;
+ uint8_t lo = hdw[0x28] & 0x0ff;
+ uint8_t hi = hdw[0x29] & 0x0ff;
+ m_LCD_memory_base = (((hi << 8) | lo) - 0xc000) >> 8;
- m_LCD_status = hdw[0x2c]&0xff ? 0 : 0x08;
- if (m_LCD_status) m_LCD_mask = 0x02;
+ m_LCD_status = hdw[0x2c] & 0xff ? 0 : 0x08;
+ if (m_LCD_status)
+ m_LCD_mask = 0x02;
- m_LCD_contrast = hdw[0x30]&0xff;
+ m_LCD_contrast = hdw[0x30] & 0xff;
m_timer_interrupt_mask = !hdw[0x38];
m_timer_interrupt_status = 0;
@@ -1176,10 +1141,9 @@ void ti85_state::ti85_setup_snapshot (uint8_t * data)
m_interrupt_speed = 0x03;
}
-void ti85_state::ti86_setup_snapshot (uint8_t * data)
+void ti85_state::ti86_setup_snapshot(uint8_t *data)
{
- unsigned char lo,hi;
- unsigned char * hdw = data + 0x20000 + 0x94;
+ uint8_t *hdw = data + 0x20000 + 0x94;
ti8x_snapshot_setup_registers ( data);
@@ -1188,22 +1152,23 @@ void ti85_state::ti86_setup_snapshot (uint8_t * data)
m_keypad_mask = hdw[0x00]&0x7f;
- m_ti8x_memory_page_1 = hdw[0x04]&0xff ? 0x40 : 0x00;
- m_ti8x_memory_page_1 |= hdw[0x08]&0x0f;
+ m_ti8x_memory_page_1 = hdw[0x04] & 0xff ? 0x40 : 0x00;
+ m_ti8x_memory_page_1 |= hdw[0x08] & 0x0f;
- m_ti8x_memory_page_2 = hdw[0x0c]&0xff ? 0x40 : 0x00;
- m_ti8x_memory_page_2 |= hdw[0x10]&0x0f;
+ m_ti8x_memory_page_2 = hdw[0x0c] & 0xff ? 0x40 : 0x00;
+ m_ti8x_memory_page_2 |= hdw[0x10] & 0x0f;
update_ti86_memory();
- lo = hdw[0x2c] & 0x0ff;
- hi = hdw[0x2d] & 0x0ff;
- m_LCD_memory_base = (((hi << 8) | lo)-0xc000)>>8;
+ uint8_t lo = hdw[0x2c] & 0x0ff;
+ uint8_t hi = hdw[0x2d] & 0x0ff;
+ m_LCD_memory_base = (((hi << 8) | lo) - 0xc000) >> 8;
- m_LCD_status = hdw[0x30]&0xff ? 0 : 0x08;
- if (m_LCD_status) m_LCD_mask = 0x02;
+ m_LCD_status = hdw[0x30] & 0xff ? 0 : 0x08;
+ if (m_LCD_status)
+ m_LCD_mask = 0x02;
- m_LCD_contrast = hdw[0x34]&0xff;
+ m_LCD_contrast = hdw[0x34] & 0xff;
m_timer_interrupt_mask = !hdw[0x3c];
m_timer_interrupt_status = 0;
@@ -1229,12 +1194,12 @@ SNAPSHOT_LOAD_MEMBER(ti85_state::snapshot_cb)
if (image.length() != expected_snapshot_size)
{
- logerror ("Incomplete snapshot file\n");
+ logerror("Incomplete snapshot file\n");
return image_init_result::FAIL;
}
std::vector<uint8_t> ti8x_snapshot_data(image.length());
- image.fread( &ti8x_snapshot_data[0], image.length());
+ image.fread(&ti8x_snapshot_data[0], image.length());
if (!strncmp(machine().system().name, "ti85", 4))
ti85_setup_snapshot(&ti8x_snapshot_data[0]);
diff --git a/src/mame/machine/trs80.cpp b/src/mame/machine/trs80.cpp
index 1f6e17979f4..21723f95ddd 100644
--- a/src/mame/machine/trs80.cpp
+++ b/src/mame/machine/trs80.cpp
@@ -332,7 +332,7 @@ void trs80_state::machine_start()
m_tape_unit = 1;
m_reg_load = 1;
- m_cassette_data_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(trs80_state::cassette_data_callback),this));
+ m_cassette_data_timer = timer_alloc(FUNC(trs80_state::cassette_data_callback), this);
m_cassette_data_timer->adjust( attotime::zero, 0, attotime::from_hz(11025) );
}
diff --git a/src/mame/machine/trs80m3.cpp b/src/mame/machine/trs80m3.cpp
index 842f210bb17..fed0e9d0ff3 100644
--- a/src/mame/machine/trs80m3.cpp
+++ b/src/mame/machine/trs80m3.cpp
@@ -578,7 +578,7 @@ void trs80m3_state::machine_start()
if (!BIT(m_model4, 2)) // Model 4P has no cassette hardware
{
- m_cassette_data_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(trs80m3_state::cassette_data_callback),this));
+ m_cassette_data_timer = timer_alloc(FUNC(trs80m3_state::cassette_data_callback), this);
m_cassette_data_timer->adjust( attotime::zero, 0, attotime::from_hz(11025) );
}
diff --git a/src/mame/machine/tsconf.cpp b/src/mame/machine/tsconf.cpp
index 3540708fbf8..1204fa16140 100644
--- a/src/mame/machine/tsconf.cpp
+++ b/src/mame/machine/tsconf.cpp
@@ -767,56 +767,47 @@ void tsconf_state::dma_ready(int line)
}
}
-void tsconf_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(tsconf_state::irq_frame)
{
- switch (id)
+ if (BIT(m_regs[INT_MASK], 0))
{
- case TIMER_IRQ_FRAME:
+ m_maincpu->set_input_line_and_vector(0, ASSERT_LINE, 0xff);
+ m_irq_off_timer->adjust(m_maincpu->clocks_to_attotime(32 * (1 << (m_regs[SYS_CONFIG] & 0x03))));
+ }
+}
+
+TIMER_CALLBACK_MEMBER(tsconf_state::irq_scanline)
+{
+ u16 screen_vpos = m_screen->vpos();
+ m_line_irq_timer->adjust(m_screen->time_until_pos(screen_vpos + 1));
+ if (BIT(m_regs[INT_MASK], 1))
{
- if (BIT(m_regs[INT_MASK], 0))
- {
- m_maincpu->set_input_line_and_vector(0, ASSERT_LINE, 0xff);
- m_irq_off_timer->adjust(m_maincpu->clocks_to_attotime(32 * (1 << (m_regs[SYS_CONFIG] & 0x03))));
- }
- break;
+ m_maincpu->set_input_line_and_vector(0, ASSERT_LINE, 0xfd);
+ // Not quite precise. Scanline can't be skipped.
+ m_irq_off_timer->adjust(m_maincpu->clocks_to_attotime(32 * (1 << (m_regs[SYS_CONFIG] & 0x03))));
}
- case TIMER_IRQ_SCANLINE:
+ if (BIT(m_regs[INT_MASK], 0) && OFFS_512(VS_INT_L) == screen_vpos && m_regs[HS_INT] == 0)
{
- u16 screen_vpos = m_screen->vpos();
- m_line_irq_timer->adjust(m_screen->time_until_pos(screen_vpos + 1));
- if (BIT(m_regs[INT_MASK], 1))
- {
- m_maincpu->set_input_line_and_vector(0, ASSERT_LINE, 0xfd);
- // Not quite precise. Scanline can't be skipped.
- m_irq_off_timer->adjust(m_maincpu->clocks_to_attotime(32 * (1 << (m_regs[SYS_CONFIG] & 0x03))));
- }
- if (BIT(m_regs[INT_MASK], 0) && OFFS_512(VS_INT_L) == screen_vpos && m_regs[HS_INT] == 0)
- {
- m_maincpu->set_input_line_and_vector(0, ASSERT_LINE, 0xff);
- m_irq_off_timer->adjust(m_maincpu->clocks_to_attotime(32 * (1 << (m_regs[SYS_CONFIG] & 0x03))));
- }
+ m_maincpu->set_input_line_and_vector(0, ASSERT_LINE, 0xff);
+ m_irq_off_timer->adjust(m_maincpu->clocks_to_attotime(32 * (1 << (m_regs[SYS_CONFIG] & 0x03))));
+ }
- m_screen->update_now();
- for (const auto &[reg, val] : m_scanline_delayed_regs_update)
+ m_screen->update_now();
+ for (const auto &[reg, val] : m_scanline_delayed_regs_update)
+ {
+ m_regs[reg] = val;
+ switch (reg)
{
- m_regs[reg] = val;
- switch (reg)
- {
- case G_Y_OFFS_L:
- case G_Y_OFFS_H:
- m_gfx_y_frame_offset = get_screen_area().top() - m_screen->vpos();
- break;
+ case G_Y_OFFS_L:
+ case G_Y_OFFS_H:
+ m_gfx_y_frame_offset = get_screen_area().top() - m_screen->vpos();
+ break;
- default:
- break;
- }
+ default:
+ break;
}
- m_scanline_delayed_regs_update.clear();
- break;
- }
- default:
- spectrum_state::device_timer(timer, id, param);
}
+ m_scanline_delayed_regs_update.clear();
}
u8 tsconf_state::beta_neutral_r(offs_t offset)
diff --git a/src/mame/machine/tv955kb.cpp b/src/mame/machine/tv955kb.cpp
index 4ad8e08431e..aaaf968bebe 100644
--- a/src/mame/machine/tv955kb.cpp
+++ b/src/mame/machine/tv955kb.cpp
@@ -40,7 +40,7 @@ void tv955kb_device::device_resolve_objects()
void tv955kb_device::device_start()
{
- m_bell_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tv955kb_device::bell_q8), this));
+ m_bell_timer = timer_alloc(FUNC(tv955kb_device::bell_q8), this);
save_item(NAME(m_bell_on));
diff --git a/src/mame/machine/upd65031.cpp b/src/mame/machine/upd65031.cpp
index cc4b33e90d2..9811769901d 100644
--- a/src/mame/machine/upd65031.cpp
+++ b/src/mame/machine/upd65031.cpp
@@ -305,9 +305,9 @@ void upd65031_device::device_start()
m_out_mem_cb.resolve();
// allocate timers
- m_rtc_timer = timer_alloc(TIMER_RTC);
- m_flash_timer = timer_alloc(TIMER_FLASH);
- m_speaker_timer = timer_alloc(TIMER_SPEAKER);
+ m_rtc_timer = timer_alloc(FUNC(upd65031_device::rtc_tick), this);
+ m_flash_timer = timer_alloc(FUNC(upd65031_device::flash_tick), this);
+ m_speaker_timer = timer_alloc(FUNC(upd65031_device::speaker_tick), this);
m_rtc_timer->adjust(attotime::from_msec(5), 0, attotime::from_msec(5));
m_flash_timer->adjust(attotime::from_hz(2), 0, attotime::from_hz(2));
m_speaker_timer->reset();
@@ -380,116 +380,104 @@ void upd65031_device::device_reset()
//-------------------------------------------------
-// device_timer - handler timer events
+// timer events
//-------------------------------------------------
-void upd65031_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(upd65031_device::rtc_tick)
{
- switch (id)
+ // if a key is pressed sets the interrupt
+ if ((m_int & INT_GINT) && (m_int & INT_KEY) && m_read_kb(0) != 0xff)
{
- case TIMER_RTC:
+ LOG("%s: Keyboard interrupt!\n", machine().describe_context());
- // if a key is pressed sets the interrupt
- if ((m_int & INT_GINT) && (m_int & INT_KEY) && m_read_kb(0) != 0xff)
- {
- LOG("%s: Keyboard interrupt!\n", machine().describe_context());
-
- // awakes CPU from snooze on key down
- if (m_mode == STATE_SNOOZE)
- set_mode(STATE_AWAKE);
+ // awakes CPU from snooze on key down
+ if (m_mode == STATE_SNOOZE)
+ set_mode(STATE_AWAKE);
- m_sta |= STA_KEY;
- }
- else
- {
- m_sta &= ~STA_KEY;
- }
+ m_sta |= STA_KEY;
+ }
+ else
+ {
+ m_sta &= ~STA_KEY;
+ }
- // hold clock at reset? - in this mode it doesn't update
- if (!(m_com & COM_RESTIM))
- {
- bool irq_change = false;
+ // hold clock at reset? - in this mode it doesn't update
+ if (!(m_com & COM_RESTIM))
+ {
+ bool irq_change = false;
- // update 5 millisecond counter
- m_tim[0]++;
+ // update 5 millisecond counter
+ m_tim[0]++;
- // tick
- if (m_tim[0] & 1)
+ // tick
+ if (m_tim[0] & 1)
+ {
+ // set tick int has occurred
+ if (m_tmk & TSTA_TICK)
{
- // set tick int has occurred
- if (m_tmk & TSTA_TICK)
- {
- m_tsta |= TSTA_TICK;
- irq_change = true;
- }
+ m_tsta |= TSTA_TICK;
+ irq_change = true;
}
+ }
+
+ if (m_tim[0] == 200)
+ {
+ m_tim[0] = 0;
+ m_tim[1]++;
- if (m_tim[0] == 128) // on the rising edge of TIM0 bit 7
+ if (m_tim[1] == 32) // on the rising edge of TIM1 bit 5
{
- // set seconds int has occurred
- if (m_tmk & TSTA_SEC)
+ // set minutes int has occurred
+ if (m_tmk & TSTA_MIN)
{
- m_tsta |= TSTA_SEC;
+ m_tsta |= TSTA_MIN;
irq_change = true;
}
}
- if (m_tim[0] == 200)
+ if (m_tim[1] == 60)
{
- m_tim[0] = 0;
- m_tim[1]++;
+ m_tim[1] = 0;
+ m_tim[2]++;
- if (m_tim[1] == 32) // on the rising edge of TIM1 bit 5
+ if (m_tim[2] == 0) // overflowed from 255
{
- // set minutes int has occurred
- if (m_tmk & TSTA_MIN)
- {
- m_tsta |= TSTA_MIN;
- irq_change = true;
- }
- }
-
- if (m_tim[1] == 60)
- {
- m_tim[1] = 0;
- m_tim[2]++;
+ m_tim[3]++;
- if (m_tim[2] == 0) // overflowed from 255
+ if (m_tim[3] == 0) // overflowed from 255
{
- m_tim[3]++;
+ m_tim[4]++;
- if (m_tim[3] == 0) // overflowed from 255
- {
- m_tim[4]++;
-
- if (m_tim[4] == 32)
- m_tim[4] = 0;
- }
+ if (m_tim[4] == 32)
+ m_tim[4] = 0;
}
}
}
+ }
- if ((m_int & INT_GINT) && (m_int & INT_TIME) && irq_change && !(m_sta & STA_FLAPOPEN))
- {
- set_mode(STATE_AWAKE);
-
- update_rtc_interrupt();
- }
+ if ((m_int & INT_GINT) && (m_int & INT_TIME) && irq_change && !(m_sta & STA_FLAPOPEN))
+ {
+ set_mode(STATE_AWAKE);
- // refresh interrupt
- interrupt_refresh();
+ update_rtc_interrupt();
}
- break;
- case TIMER_FLASH:
- m_flash = !m_flash;
- break;
- case TIMER_SPEAKER:
- m_speaker_state = !m_speaker_state;
- m_write_spkr(m_speaker_state ? 1 : 0);
- break;
+
+ // refresh interrupt
+ interrupt_refresh();
}
}
+TIMER_CALLBACK_MEMBER(upd65031_device::flash_tick)
+{
+ m_flash = !m_flash;
+}
+
+TIMER_CALLBACK_MEMBER(upd65031_device::speaker_tick)
+{
+ m_speaker_state = !m_speaker_state;
+ m_write_spkr(m_speaker_state ? 1 : 0);
+}
+
//-------------------------------------------------
// screen_update
diff --git a/src/mame/machine/upd65031.h b/src/mame/machine/upd65031.h
index 70436c53366..427ba877408 100644
--- a/src/mame/machine/upd65031.h
+++ b/src/mame/machine/upd65031.h
@@ -58,7 +58,10 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(rtc_tick);
+ TIMER_CALLBACK_MEMBER(flash_tick);
+ TIMER_CALLBACK_MEMBER(speaker_tick);
virtual void tra_callback() override;
virtual void tra_complete() override;
@@ -70,9 +73,6 @@ private:
inline void update_uart_interrupt();
inline void update_tx(int state);
inline void set_mode(int mode);
- static const device_timer_id TIMER_RTC = 0;
- static const device_timer_id TIMER_FLASH = 1;
- static const device_timer_id TIMER_SPEAKER = 2;
devcb_read8 m_read_kb;
devcb_write_line m_write_int;
diff --git a/src/mame/machine/vectrex.cpp b/src/mame/machine/vectrex.cpp
index b73eed6e20c..e37b90339a4 100644
--- a/src/mame/machine/vectrex.cpp
+++ b/src/mame/machine/vectrex.cpp
@@ -46,48 +46,27 @@ static const double crazy_coaster_angles[3] = {0, 0.1631, 0.3305};
static const double unknown_game_angles[3] = {0,0.16666666, 0.33333333};
+TIMER_CALLBACK_MEMBER(vectrex_base_state::update_analog)
+{
+ update_vector();
+ m_analog[param] = m_via_out[PORTA];
+}
+TIMER_CALLBACK_MEMBER(vectrex_base_state::update_blank)
+{
+ update_vector();
+ m_blank = param;
+}
-void vectrex_base_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(vectrex_base_state::update_mux_enable)
{
- switch (id)
- {
- case TIMER_VECTREX_IMAGER_CHANGE_COLOR:
- vectrex_imager_change_color(param);
- break;
- case TIMER_UPDATE_LEVEL:
- update_level(param);
- break;
- case TIMER_VECTREX_IMAGER_EYE:
- vectrex_imager_eye(param);
- break;
- case TIMER_LIGHTPEN_TRIGGER:
- lightpen_trigger(param);
- break;
- case TIMER_VECTREX_REFRESH:
- vectrex_refresh(param);
- break;
- case TIMER_VECTREX_ZERO_INTEGRATORS:
- vectrex_zero_integrators(param);
- break;
- case TIMER_UPDATE_ANALOG:
- update_vector();
- m_analog[param] = m_via_out[PORTA];
- break;
- case TIMER_UPDATE_BLANK:
- update_vector();
- m_blank = param;
- break;
- case TIMER_UPDATE_MUX_ENABLE:
- update_vector();
- break;
- case TIMER_UPDATE_RAMP:
- update_vector();
- m_ramp = param;
- break;
- default:
- fatalerror("Unknown id in vectrex_base_state::device_timer");
- }
+ update_vector();
+}
+
+TIMER_CALLBACK_MEMBER(vectrex_base_state::update_ramp)
+{
+ update_vector();
+ m_ramp = param;
}
@@ -104,7 +83,7 @@ void vectrex_base_state::configure_imager(bool reset_refresh, const double *imag
m_imager_angles = imager_angles;
}
-void vectrex_base_state::vectrex_configuration()
+void vectrex_base_state::screen_configuration()
{
unsigned char cport = m_io_3dconf->read();
@@ -116,7 +95,7 @@ void vectrex_base_state::vectrex_configuration()
if (m_imager_status == 0)
m_imager_status = cport & 0x01;
- vector_add_point_function = cport & 0x02 ? &vectrex_base_state::vectrex_add_point_stereo: &vectrex_base_state::vectrex_add_point;
+ vector_add_point_function = cport & 0x02 ? &vectrex_base_state::add_point_stereo: &vectrex_base_state::add_point;
switch ((cport >> 2) & 0x07)
{
@@ -179,7 +158,7 @@ void vectrex_base_state::vectrex_configuration()
}
else
{
- vector_add_point_function = &vectrex_base_state::vectrex_add_point;
+ vector_add_point_function = &vectrex_base_state::add_point;
m_beam_color = rgb_t::white();
m_imager_colors[0] = m_imager_colors[1] = m_imager_colors[2] = m_imager_colors[3] = m_imager_colors[4] = m_imager_colors[5] = rgb_t::white();
}
@@ -193,13 +172,13 @@ void vectrex_base_state::vectrex_configuration()
*********************************************************************/
-WRITE_LINE_MEMBER(vectrex_base_state::vectrex_via_irq)
+WRITE_LINE_MEMBER(vectrex_base_state::via_irq)
{
m_maincpu->set_input_line(M6809_IRQ_LINE, state);
}
-uint8_t vectrex_base_state::vectrex_via_pb_r()
+uint8_t vectrex_base_state::via_pb_r()
{
int pot = m_io_contr[(m_via_out[PORTB] & 0x6) >> 1]->read() - 0x80;
@@ -212,7 +191,7 @@ uint8_t vectrex_base_state::vectrex_via_pb_r()
}
-uint8_t vectrex_base_state::vectrex_via_pa_r()
+uint8_t vectrex_base_state::via_pa_r()
{
if ((!(m_via_out[PORTB] & 0x10)) && (m_via_out[PORTB] & 0x08))
/* BDIR inactive, we can read the PSG. BC1 has to be active. */
@@ -224,7 +203,7 @@ uint8_t vectrex_base_state::vectrex_via_pa_r()
}
-uint8_t raaspec_state::vectrex_s1_via_pb_r()
+uint8_t raaspec_state::s1_via_pb_r()
{
return (m_via_out[PORTB] & ~0x40) | (m_io_coin->read() & 0x40);
}
@@ -236,7 +215,7 @@ uint8_t raaspec_state::vectrex_s1_via_pb_r()
*********************************************************************/
-TIMER_CALLBACK_MEMBER(vectrex_base_state::vectrex_imager_change_color)
+TIMER_CALLBACK_MEMBER(vectrex_base_state::imager_change_color)
{
m_beam_color = param;
}
@@ -247,46 +226,47 @@ TIMER_CALLBACK_MEMBER(vectrex_base_state::update_level)
m_imager_pinlevel = param;
}
+TIMER_CALLBACK_MEMBER(vectrex_base_state::imager_eye)
+{
+ if (m_imager_status > 0)
+ {
+ const int coffset = param > 1 ? 3: 0;
+ const double rtime = (1.0 / m_imager_freq);
+
+ m_imager_status = param;
+ m_imager_color_timers[0]->adjust(attotime::from_double(rtime * m_imager_angles[0]), m_imager_colors[coffset+2]);
+ m_imager_color_timers[1]->adjust(attotime::from_double(rtime * m_imager_angles[1]), m_imager_colors[coffset+1]);
+ m_imager_color_timers[2]->adjust(attotime::from_double(rtime * m_imager_angles[2]), m_imager_colors[coffset]);
+ }
+}
-TIMER_CALLBACK_MEMBER(vectrex_base_state::vectrex_imager_eye)
+TIMER_CALLBACK_MEMBER(vectrex_base_state::imager_index)
{
- int coffset;
- double rtime = (1.0 / m_imager_freq);
+ imager_eye(param);
if (m_imager_status > 0)
{
- m_imager_status = param;
- coffset = param > 1? 3: 0;
- timer_set(attotime::from_double(rtime * m_imager_angles[0]), TIMER_VECTREX_IMAGER_CHANGE_COLOR, m_imager_colors[coffset+2]);
- timer_set(attotime::from_double(rtime * m_imager_angles[1]), TIMER_VECTREX_IMAGER_CHANGE_COLOR, m_imager_colors[coffset+1]);
- timer_set(attotime::from_double(rtime * m_imager_angles[2]), TIMER_VECTREX_IMAGER_CHANGE_COLOR, m_imager_colors[coffset]);
+ const double rtime = (1.0 / m_imager_freq);
- if (param == 2)
- {
- timer_set(attotime::from_double(rtime * 0.50), TIMER_VECTREX_IMAGER_EYE, 1);
+ m_imager_eye_timer->adjust(attotime::from_double(rtime * 0.50), 1);
- /* Index hole sensor is connected to IO7 which triggers also CA1 of VIA */
- m_via6522_0->write_ca1(1);
- m_via6522_0->write_ca1(0);
- m_imager_pinlevel |= 0x80;
- timer_set(attotime::from_double(rtime / 360.0), TIMER_UPDATE_LEVEL, 0);
- }
+ /* Index hole sensor is connected to IO7 which triggers also CA1 of VIA */
+ m_via6522_0->write_ca1(1);
+ m_via6522_0->write_ca1(0);
+ m_imager_pinlevel |= 0x80;
+ m_imager_level_timer->adjust(attotime::from_double(rtime / 360.0));
}
}
-
-void vectrex_base_state::vectrex_psg_port_w(uint8_t data)
+void vectrex_base_state::psg_port_w(uint8_t data)
{
- double wavel, ang_acc, tmp;
- int mcontrol;
-
- mcontrol = data & 0x40; /* IO6 controls the imager motor */
+ uint8_t mcontrol = data & 0x40; /* IO6 controls the imager motor */
if (!mcontrol && mcontrol ^ m_old_mcontrol)
{
m_old_mcontrol = mcontrol;
- tmp = machine().time().as_double();
- wavel = tmp - m_sl;
+ double tmp = machine().time().as_double();
+ double wavel = tmp - m_sl;
m_sl = tmp;
if (wavel < 1)
@@ -297,15 +277,14 @@ void vectrex_base_state::vectrex_psg_port_w(uint8_t data)
of the whole thing and some constants of the motor's torque/speed curve.
pwl is the negative pulse width and wavel is the whole wavelength. */
- ang_acc = (50.0 - 1.55 * m_imager_freq) / MMI;
+ double ang_acc = (50.0 - 1.55 * m_imager_freq) / MMI;
m_imager_freq += ang_acc * m_pwl + DAMPC * m_imager_freq / MMI * wavel;
if (m_imager_freq > 1)
{
- m_imager_timer->adjust(
- attotime::from_double(std::min(1.0 / m_imager_freq, m_imager_timer->remaining().as_double())),
- 2,
- attotime::from_double(1.0 / m_imager_freq));
+ attotime eye_time = attotime::from_double(std::min(1.0 / m_imager_freq, m_imager_eye_timer->remaining().as_double()));
+ attotime eye_period = attotime::from_double(1.0 / m_imager_freq);
+ m_imager_eye_timer->adjust(eye_time, 2, eye_period);
}
}
}
diff --git a/src/mame/machine/victor9k_fdc.cpp b/src/mame/machine/victor9k_fdc.cpp
index 413fe8373a0..a2c305e2989 100644
--- a/src/mame/machine/victor9k_fdc.cpp
+++ b/src/mame/machine/victor9k_fdc.cpp
@@ -49,14 +49,16 @@
// MACROS / CONSTANTS
//**************************************************************************
-#define LOG 0
-#define LOG_VIA 0
+#define LOG_VIA (1U << 1)
+#define LOG_SCP (1U << 2)
+#define LOG_BITS (1U << 3)
+
#ifdef USE_SCP
-#define LOG_SCP 1
+#define VERBOSE (LOG_SCP)
#else
-#define LOG_SCP 0
+#define VERBOSE (0)
#endif
-#define LOG_BITS 0
+#include "logmacro.h"
#define I8048_TAG "5d"
#define M6522_4_TAG "1f"
@@ -269,9 +271,9 @@ void victor_9000_fdc_device::device_start()
m_lbrdy_cb.resolve_safe();
// allocate timer
- t_gen = timer_alloc(TM_GEN);
- t_tach0 = timer_alloc(TM_TACH0);
- t_tach1 = timer_alloc(TM_TACH1);
+ t_gen = timer_alloc(FUNC(victor_9000_fdc_device::gen_tick), this);
+ t_tach0 = timer_alloc(FUNC(victor_9000_fdc_device::tach0_tick), this);
+ t_tach1 = timer_alloc(FUNC(victor_9000_fdc_device::tach1_tick), this);
// state saving
save_item(NAME(m_da));
@@ -338,28 +340,25 @@ void victor_9000_fdc_device::device_reset()
//-------------------------------------------------
-// device_timer - handler timer events
+// timer events
//-------------------------------------------------
-void victor_9000_fdc_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(victor_9000_fdc_device::gen_tick)
{
- switch (id)
- {
- case TM_GEN:
- live_sync();
- live_run();
- break;
+ live_sync();
+ live_run();
+}
- case TM_TACH0:
- m_tach0 = !m_tach0;
- if (LOG_SCP) logerror("%s TACH0 %u\n", machine().time().as_string(), m_tach0);
- break;
+TIMER_CALLBACK_MEMBER(victor_9000_fdc_device::tach0_tick)
+{
+ m_tach0 = !m_tach0;
+ LOGMASKED(LOG_SCP, "%s TACH0 %u\n", machine().time().as_string(), m_tach0);
+}
- case TM_TACH1:
- m_tach1 = !m_tach1;
- if (LOG_SCP) logerror("%s TACH1 %u\n", machine().time().as_string(), m_tach1);
- break;
- }
+TIMER_CALLBACK_MEMBER(victor_9000_fdc_device::tach1_tick)
+{
+ m_tach1 = !m_tach1;
+ LOGMASKED(LOG_SCP, "%s TACH1 %u\n", machine().time().as_string(), m_tach1);
}
@@ -491,7 +490,7 @@ void victor_9000_fdc_device::floppy_p2_w(uint8_t data)
m_scp_rdy1 = BIT(data, 7);
update_rdy();
- if (LOG_SCP) logerror("%s %s START0/STOP0/SEL0/RDY0 %u/%u/%u/%u START1/STOP1/SEL1/RDY1 %u/%u/%u/%u\n", machine().time().as_string(), machine().describe_context(), start0, stop0, sel0, m_rdy0, start1, stop1, sel1, m_rdy1);
+ LOGMASKED(LOG_SCP, "%s %s START0/STOP0/SEL0/RDY0 %u/%u/%u/%u START1/STOP1/SEL1/RDY1 %u/%u/%u/%u\n", machine().time().as_string(), machine().describe_context(), start0, stop0, sel0, m_rdy0, start1, stop1, sel1, m_rdy1);
if (sync)
{
@@ -511,11 +510,15 @@ void victor_9000_fdc_device::floppy_p2_w(uint8_t data)
checkpoint();
- if ((m_floppy0->get_device() && !m_floppy0->get_device()->mon_r()) || (m_floppy1->get_device() && !m_floppy1->get_device()->mon_r())) {
- if(cur_live.state == IDLE) {
+ if ((m_floppy0->get_device() && !m_floppy0->get_device()->mon_r()) || (m_floppy1->get_device() && !m_floppy1->get_device()->mon_r()))
+ {
+ if(cur_live.state == IDLE)
+ {
live_start();
}
- } else {
+ }
+ else
+ {
live_abort();
}
@@ -530,7 +533,7 @@ void victor_9000_fdc_device::floppy_p2_w(uint8_t data)
READ_LINE_MEMBER(victor_9000_fdc_device::tach0_r)
{
- if (LOG_SCP) logerror("%s %s Read TACH0 %u\n", machine().time().as_string(), machine().describe_context(), m_tach0);
+ LOGMASKED(LOG_SCP, "%s %s Read TACH0 %u\n", machine().time().as_string(), machine().describe_context(), m_tach0);
return m_tach0;
}
@@ -541,7 +544,7 @@ READ_LINE_MEMBER(victor_9000_fdc_device::tach0_r)
READ_LINE_MEMBER(victor_9000_fdc_device::tach1_r)
{
- if (LOG_SCP) logerror("%s %s Read TACH1 %u\n", machine().time().as_string(), machine().describe_context(), m_tach1);
+ LOGMASKED(LOG_SCP, "%s %s Read TACH1 %u\n", machine().time().as_string(), machine().describe_context(), m_tach1);
return m_tach1;
}
@@ -579,12 +582,15 @@ void victor_9000_fdc_device::update_stepper_motor(floppy_image_device *floppy, i
void victor_9000_fdc_device::update_spindle_motor(floppy_image_device *floppy, emu_timer *t_tach, bool start, bool stop, bool sel, uint8_t &da)
{
#ifdef USE_SCP
- if (start && !stop && floppy->mon_r()) {
- if (LOG_SCP) logerror("%s: motor start\n", floppy->tag());
+ if (start && !stop && floppy->mon_r())
+ {
+ LOGMASKED(LOG_SCP, "%s: motor start\n", floppy->tag());
floppy->mon_w(0);
t_tach->enable(true);
- } else if (stop && !floppy->mon_r()) {
- if (LOG_SCP) logerror("%s: motor stop\n", floppy->tag());
+ }
+ else if (stop && !floppy->mon_r())
+ {
+ LOGMASKED(LOG_SCP, "%s: motor stop\n", floppy->tag());
floppy->mon_w(1);
t_tach->enable(false);
}
@@ -594,12 +600,13 @@ void victor_9000_fdc_device::update_spindle_motor(floppy_image_device *floppy, e
void victor_9000_fdc_device::update_rpm(floppy_image_device *floppy, emu_timer *t_tach, bool sel, uint8_t &da)
{
#ifdef USE_SCP
- if (sel) {
+ if (sel)
+ {
da = m_da;
float tach = rpm[da] / 60.0 * SPINDLE_RATIO * MOTOR_POLES;
- if (LOG_SCP) logerror("%s: motor speed %u rpm / tach %0.1f hz %0.9f s (DA %02x)\n", floppy->tag(), rpm[da], (double) tach, 1.0/(double)tach, da);
+ LOGMASKED(LOG_SCP, "%s: motor speed %u rpm / tach %0.1f hz %0.9f s (DA %02x)\n", floppy->tag(), rpm[da], (double) tach, 1.0/(double)tach, da);
floppy->set_rpm(rpm[da]);
@@ -623,7 +630,7 @@ void victor_9000_fdc_device::update_rdy()
void victor_9000_fdc_device::da_w(uint8_t data)
{
- if (LOG_SCP) logerror("%s %s DA %02x SEL0 %u SEL1 %u\n", machine().time().as_string(), machine().describe_context(), data, m_sel0, m_sel1);
+ LOGMASKED(LOG_SCP, "%s %s DA %02x SEL0 %u SEL1 %u\n", machine().time().as_string(), machine().describe_context(), data, m_sel0, m_sel1);
live_sync();
m_da = data;
@@ -673,20 +680,19 @@ void victor_9000_fdc_device::via4_pa_w(uint8_t data)
m_via_l0ms = data & 0x0f;
#ifndef USE_SCP
- { // HACK to bypass SCP
- if (m_floppy0->get_device())
- {
- m_floppy0->get_device()->mon_w((m_via_l0ms == 0xf) ? 1 : 0);
- m_floppy0->get_device()->set_rpm(victor9k_format::get_rpm(m_side, m_floppy0->get_device()->get_cyl()));
- }
- m_rdy0 = (m_via_l0ms == 0xf) ? 0 : 1;
- update_rdy();
+ // HACK to bypass SCP
+ if (m_floppy0->get_device())
+ {
+ m_floppy0->get_device()->mon_w((m_via_l0ms == 0xf) ? 1 : 0);
+ m_floppy0->get_device()->set_rpm(victor9k_format::get_rpm(m_side, m_floppy0->get_device()->get_cyl()));
}
+ m_rdy0 = (m_via_l0ms == 0xf) ? 0 : 1;
+ update_rdy();
#endif
uint8_t st0 = data >> 4;
- if (LOG_VIA) logerror("%s %s L0MS %01x ST0 %01x\n", machine().time().as_string(), machine().describe_context(), m_via_l0ms, st0);
+ LOGMASKED(LOG_VIA, "%s %s L0MS %01x ST0 %01x\n", machine().time().as_string(), machine().describe_context(), m_via_l0ms, st0);
if (m_st0 != st0)
{
@@ -738,20 +744,19 @@ void victor_9000_fdc_device::via4_pb_w(uint8_t data)
m_via_l1ms = data & 0x0f;
#ifndef USE_SCP
- { // HACK to bypass SCP
- if (m_floppy1->get_device())
- {
- m_floppy1->get_device()->mon_w((m_via_l1ms == 0xf) ? 1 : 0);
- m_floppy1->get_device()->set_rpm(victor9k_format::get_rpm(m_side, m_floppy1->get_device()->get_cyl()));
- }
- m_rdy1 = (m_via_l1ms == 0xf) ? 0 : 1;
- update_rdy();
+ // HACK to bypass SCP
+ if (m_floppy1->get_device())
+ {
+ m_floppy1->get_device()->mon_w((m_via_l1ms == 0xf) ? 1 : 0);
+ m_floppy1->get_device()->set_rpm(victor9k_format::get_rpm(m_side, m_floppy1->get_device()->get_cyl()));
}
+ m_rdy1 = (m_via_l1ms == 0xf) ? 0 : 1;
+ update_rdy();
#endif
uint8_t st1 = data >> 4;
- if (LOG_VIA) logerror("%s %s L1MS %01x ST1 %01x\n", machine().time().as_string(), machine().describe_context(), m_via_l1ms, st1);
+ LOGMASKED(LOG_VIA, "%s %s L1MS %01x ST1 %01x\n", machine().time().as_string(), machine().describe_context(), m_via_l1ms, st1);
if (m_st1 != st1)
{
@@ -771,7 +776,7 @@ WRITE_LINE_MEMBER( victor_9000_fdc_device::wrsync_w )
m_wrsync = state;
cur_live.wrsync = state;
checkpoint();
- if (LOG_VIA) logerror("%s %s WRSYNC %u\n", machine().time().as_string(), machine().describe_context(), state);
+ LOGMASKED(LOG_VIA, "%s %s WRSYNC %u\n", machine().time().as_string(), machine().describe_context(), state);
live_run();
}
}
@@ -820,7 +825,7 @@ void victor_9000_fdc_device::via5_pb_w(uint8_t data)
*/
- if (LOG_VIA) logerror("%s %s WD %02x\n", machine().time().as_string(), machine().describe_context(), data);
+ LOGMASKED(LOG_VIA, "%s %s WD %02x\n", machine().time().as_string(), machine().describe_context(), data);
m_via5->write_cb1(BIT(data, 7));
@@ -858,7 +863,7 @@ uint8_t victor_9000_fdc_device::via6_pa_r()
*/
- if (LOG_VIA) logerror("%s %s TRK0D0 %u TRK0D1 %u SYNC %u\n", machine().time().as_string(), machine().describe_context(), m_floppy0->get_device() ? m_floppy0->get_device()->trk00_r() : 0, m_floppy1->get_device() ? m_floppy1->get_device()->trk00_r() : 0, checkpoint_live.sync);
+ LOGMASKED(LOG_VIA, "%s %s TRK0D0 %u TRK0D1 %u SYNC %u\n", machine().time().as_string(), machine().describe_context(), m_floppy0->get_device() ? m_floppy0->get_device()->trk00_r() : 0, m_floppy1->get_device() ? m_floppy1->get_device()->trk00_r() : 0, checkpoint_live.sync);
uint8_t data = 0;
@@ -904,11 +909,13 @@ void victor_9000_fdc_device::via6_pa_w(uint8_t data)
// dual side select
int side = BIT(data, 4);
- if (m_side != side) sync = true;
+ if (m_side != side)
+ sync = true;
// select drive A/B
int drive = BIT(data, 5);
- if (m_drive != drive) sync = true;
+ if (m_drive != drive)
+ sync = true;
if (sync)
{
@@ -916,13 +923,15 @@ void victor_9000_fdc_device::via6_pa_w(uint8_t data)
m_side = side;
cur_live.side = side;
- if (m_floppy0->get_device()) m_floppy0->get_device()->ss_w(side);
- if (m_floppy1->get_device()) m_floppy1->get_device()->ss_w(side);
+ if (m_floppy0->get_device())
+ m_floppy0->get_device()->ss_w(side);
+ if (m_floppy1->get_device())
+ m_floppy1->get_device()->ss_w(side);
m_drive = drive;
cur_live.drive = drive;
- if (LOG_VIA) logerror("%s %s SIDE %u DRIVE %u\n", machine().time().as_string(), machine().describe_context(), side, drive);
+ LOGMASKED(LOG_VIA, "%s %s SIDE %u DRIVE %u\n", machine().time().as_string(), machine().describe_context(), side, drive);
checkpoint();
live_run();
@@ -995,11 +1004,13 @@ void victor_9000_fdc_device::via6_pb_w(uint8_t data)
// stepper enable A
int stp0 = BIT(data, 6);
- if (m_stp0 != stp0) sync = true;
+ if (m_stp0 != stp0)
+ sync = true;
// stepper enable B
int stp1 = BIT(data, 7);
- if (m_stp1 != stp1) sync = true;
+ if (m_stp1 != stp1)
+ sync = true;
m_via6->write_cb1(stp1);
if (sync)
@@ -1007,12 +1018,14 @@ void victor_9000_fdc_device::via6_pb_w(uint8_t data)
live_sync();
m_stp0 = stp0;
- if (m_floppy0->get_device()) update_stepper_motor(m_floppy0->get_device(), m_stp0, m_st0, m_st0);
+ if (m_floppy0->get_device())
+ update_stepper_motor(m_floppy0->get_device(), m_stp0, m_st0, m_st0);
m_stp1 = stp1;
- if (m_floppy1->get_device()) update_stepper_motor(m_floppy1->get_device(), m_stp1, m_st1, m_st1);
+ if (m_floppy1->get_device())
+ update_stepper_motor(m_floppy1->get_device(), m_stp1, m_st1, m_st1);
- if (LOG_VIA) logerror("%s %s STP0 %u STP1 %u\n", machine().time().as_string(), machine().describe_context(), stp0, stp1);
+ LOGMASKED(LOG_VIA, "%s %s STP0 %u STP1 %u\n", machine().time().as_string(), machine().describe_context(), stp0, stp1);
checkpoint();
live_run();
@@ -1026,10 +1039,13 @@ WRITE_LINE_MEMBER( victor_9000_fdc_device::drw_w )
live_sync();
m_drw = cur_live.drw = state;
checkpoint();
- if (LOG_VIA) logerror("%s %s DRW %u\n", machine().time().as_string(), machine().describe_context(), state);
- if (state) {
+ LOGMASKED(LOG_VIA, "%s %s DRW %u\n", machine().time().as_string(), machine().describe_context(), state);
+ if (state)
+ {
pll_stop_writing(get_floppy(), machine().time());
- } else {
+ }
+ else
+ {
pll_start_writing(machine().time());
}
live_run();
@@ -1043,7 +1059,7 @@ WRITE_LINE_MEMBER( victor_9000_fdc_device::erase_w )
live_sync();
m_erase = cur_live.erase = state;
checkpoint();
- if (LOG_VIA) logerror("%s %s ERASE %u\n", machine().time().as_string(), machine().describe_context(), state);
+ LOGMASKED(LOG_VIA, "%s %s ERASE %u\n", machine().time().as_string(), machine().describe_context(), state);
live_run();
}
}
@@ -1059,7 +1075,7 @@ uint8_t victor_9000_fdc_device::cs7_r(offs_t offset)
{
m_lbrdy_cb(1);
- if (LOG_VIA) logerror("%s %s LBRDY 1 : %02x\n", machine().time().as_string(), machine().describe_context(), m_via5->read(offset));
+ LOGMASKED(LOG_VIA, "%s %s LBRDY 1 : %02x\n", machine().time().as_string(), machine().describe_context(), m_via5->read(offset));
return m_via5->read(offset);
}
@@ -1068,7 +1084,7 @@ void victor_9000_fdc_device::cs7_w(offs_t offset, uint8_t data)
{
m_lbrdy_cb(1);
- if (LOG_VIA) logerror("%s %s LBRDY 1\n", machine().time().as_string(), machine().describe_context());
+ LOGMASKED(LOG_VIA, "%s %s LBRDY 1\n", machine().time().as_string(), machine().describe_context());
m_via5->write(offset, data);
}
@@ -1171,18 +1187,24 @@ void victor_9000_fdc_device::live_delay(int state)
void victor_9000_fdc_device::live_sync()
{
- if(!cur_live.tm.is_never()) {
- if(cur_live.tm > machine().time()) {
+ if(!cur_live.tm.is_never())
+ {
+ if(cur_live.tm > machine().time())
+ {
rollback();
live_run(machine().time());
pll_commit(get_floppy(), cur_live.tm);
- } else {
+ }
+ else
+ {
pll_commit(get_floppy(), cur_live.tm);
- if(cur_live.next_state != -1) {
+ if(cur_live.next_state != -1)
+ {
cur_live.state = cur_live.next_state;
cur_live.next_state = -1;
}
- if(cur_live.state == IDLE) {
+ if(cur_live.state == IDLE)
+ {
pll_stop_writing(get_floppy(), cur_live.tm);
cur_live.tm = attotime::never;
}
@@ -1194,7 +1216,8 @@ void victor_9000_fdc_device::live_sync()
void victor_9000_fdc_device::live_abort()
{
- if(!cur_live.tm.is_never() && cur_live.tm > machine().time()) {
+ if(!cur_live.tm.is_never() && cur_live.tm > machine().time())
+ {
rollback();
live_run(machine().time());
}
@@ -1218,9 +1241,12 @@ void victor_9000_fdc_device::live_run(const attotime &limit)
if(cur_live.state == IDLE || cur_live.next_state != -1)
return;
- for(;;) {
- switch(cur_live.state) {
- case RUNNING: {
+ for(;;)
+ {
+ switch(cur_live.state)
+ {
+ case RUNNING:
+ {
bool syncpoint = false;
if (cur_live.tm > limit)
@@ -1228,7 +1254,8 @@ void victor_9000_fdc_device::live_run(const attotime &limit)
// read bit
int bit = 0;
- if (cur_live.drw) {
+ if (cur_live.drw)
+ {
bit = pll_get_next_bit(cur_live.tm, get_floppy(), limit);
if(bit < 0)
return;
@@ -1236,7 +1263,8 @@ void victor_9000_fdc_device::live_run(const attotime &limit)
// write bit
int write_bit = 0;
- if (!cur_live.drw) { // TODO WPS
+ if (!cur_live.drw) // TODO WPS
+ {
write_bit = BIT(cur_live.shift_reg_write, 9);
if (pll_write_next_bit(write_bit, cur_live.tm, get_floppy(), limit))
return;
@@ -1251,32 +1279,45 @@ void victor_9000_fdc_device::live_run(const attotime &limit)
int sync = !(cur_live.shift_reg == 0x3ff);
// bit counter
- if (cur_live.drw) {
- if (!sync) {
+ if (cur_live.drw)
+ {
+ if (!sync)
+ {
cur_live.bit_counter = 0;
- } else if (cur_live.sync) {
+ }
+ else if (cur_live.sync)
+ {
cur_live.bit_counter++;
- if (cur_live.bit_counter == 10) {
+ if (cur_live.bit_counter == 10)
+ {
cur_live.bit_counter = 0;
}
}
- } else {
+ }
+ else
+ {
cur_live.bit_counter++;
- if (cur_live.bit_counter == 10) {
+ if (cur_live.bit_counter == 10)
+ {
cur_live.bit_counter = 0;
}
}
// sync counter
- if (sync) {
+ if (sync)
+ {
cur_live.sync_bit_counter = 0;
cur_live.sync_byte_counter = 10; // TODO 9 in schematics
- } else if (!cur_live.sync) {
+ }
+ else if (!cur_live.sync)
+ {
cur_live.sync_bit_counter++;
- if (cur_live.sync_bit_counter == 10) {
+ if (cur_live.sync_bit_counter == 10)
+ {
cur_live.sync_bit_counter = 0;
cur_live.sync_byte_counter++;
- if (cur_live.sync_byte_counter == 16) {
+ if (cur_live.sync_byte_counter == 16)
+ {
cur_live.sync_byte_counter = 0;
}
}
@@ -1286,16 +1327,19 @@ void victor_9000_fdc_device::live_run(const attotime &limit)
int syn = !(cur_live.sync_byte_counter == 15);
// GCR decoder
- if (cur_live.drw) {
+ if (cur_live.drw)
+ {
cur_live.i = cur_live.drw << 10 | cur_live.shift_reg;
- } else {
+ }
+ else
+ {
cur_live.i = cur_live.drw << 10 | 0x200 | ((cur_live.wd & 0xf0) << 1) | cur_live.wrsync << 4 | (cur_live.wd & 0x0f);
}
cur_live.e = m_gcr_rom->base()[cur_live.i];
attotime next = cur_live.tm + m_period;
- if (LOG) logerror("%s:%s cyl %u bit %u sync %u bc %u sr %03x sbc %u sBC %u syn %u i %03x e %02x\n",cur_live.tm.as_string(),next.as_string(),get_floppy()->get_cyl(),bit,sync,cur_live.bit_counter,cur_live.shift_reg,cur_live.sync_bit_counter,cur_live.sync_byte_counter,syn,cur_live.i,cur_live.e);
+ LOGMASKED(LOG_GENERAL, "%s:%s cyl %u bit %u sync %u bc %u sr %03x sbc %u sBC %u syn %u i %03x e %02x\n",cur_live.tm.as_string(),next.as_string(),get_floppy()->get_cyl(),bit,sync,cur_live.bit_counter,cur_live.shift_reg,cur_live.sync_bit_counter,cur_live.sync_byte_counter,syn,cur_live.i,cur_live.e);
// byte ready
int brdy = !(cur_live.bit_counter == 9);
@@ -1303,69 +1347,77 @@ void victor_9000_fdc_device::live_run(const attotime &limit)
// GCR error
int gcr_err = !(brdy || BIT(cur_live.e, 3));
- if (LOG_BITS) {
- if (cur_live.drw) {
- logerror("%s cyl %u bit %u sync %u bc %u sr %03x i %03x e %02x\n",cur_live.tm.as_string(),get_floppy()->get_cyl(),bit,sync,cur_live.bit_counter,cur_live.shift_reg,cur_live.i,cur_live.e);
- } else {
- logerror("%s cyl %u writing bit %u bc %u sr %03x i %03x e %02x\n",cur_live.tm.as_string(),get_floppy()->get_cyl(),write_bit,cur_live.bit_counter,cur_live.shift_reg_write,cur_live.i,cur_live.e);
- }
- }
+ if (cur_live.drw)
+ LOGMASKED(LOG_BITS, "%s cyl %u bit %u sync %u bc %u sr %03x i %03x e %02x\n",cur_live.tm.as_string(),get_floppy()->get_cyl(),bit,sync,cur_live.bit_counter,cur_live.shift_reg,cur_live.i,cur_live.e);
+ else
+ LOGMASKED(LOG_BITS, "%s cyl %u writing bit %u bc %u sr %03x i %03x e %02x\n",cur_live.tm.as_string(),get_floppy()->get_cyl(),write_bit,cur_live.bit_counter,cur_live.shift_reg_write,cur_live.i,cur_live.e);
- if (!brdy) {
+ if (!brdy)
+ {
// load write shift register
cur_live.shift_reg_write = GCR_ENCODE(cur_live.e, cur_live.i);
- if (LOG) logerror("%s load write shift register %03x\n",cur_live.tm.as_string(),cur_live.shift_reg_write);
- } else {
+ LOGMASKED(LOG_GENERAL, "%s load write shift register %03x\n",cur_live.tm.as_string(),cur_live.shift_reg_write);
+ }
+ else
+ {
// clock write shift register
cur_live.shift_reg_write <<= 1;
cur_live.shift_reg_write &= 0x3ff;
}
- if (brdy != cur_live.brdy) {
- if (LOG) logerror("%s BRDY %u\n", cur_live.tm.as_string(),brdy);
+ if (brdy != cur_live.brdy)
+ {
+ LOGMASKED(LOG_GENERAL, "%s BRDY %u\n", cur_live.tm.as_string(),brdy);
if (!brdy)
{
cur_live.lbrdy_changed = true;
- if (LOG_VIA) logerror("%s LBRDY 0 : %02x\n", cur_live.tm.as_string(), GCR_DECODE(cur_live.e, cur_live.i));
+ LOGMASKED(LOG_VIA, "%s LBRDY 0 : %02x\n", cur_live.tm.as_string(), GCR_DECODE(cur_live.e, cur_live.i));
}
cur_live.brdy = brdy;
syncpoint = true;
}
- if (sync != cur_live.sync) {
- if (LOG) logerror("%s SYNC %u\n", cur_live.tm.as_string(),sync);
+ if (sync != cur_live.sync)
+ {
+ LOGMASKED(LOG_GENERAL, "%s SYNC %u\n", cur_live.tm.as_string(),sync);
cur_live.sync = sync;
syncpoint = true;
}
- if (syn != cur_live.syn) {
- if (LOG) logerror("%s SYN %u\n", cur_live.tm.as_string(),syn);
+ if (syn != cur_live.syn)
+ {
+ LOGMASKED(LOG_GENERAL, "%s SYN %u\n", cur_live.tm.as_string(),syn);
cur_live.syn = syn;
cur_live.syn_changed = true;
syncpoint = true;
}
- if (gcr_err != cur_live.gcr_err) {
- if (LOG) logerror("%s GCR ERR %u\n", cur_live.tm.as_string(),gcr_err);
+ if (gcr_err != cur_live.gcr_err)
+ {
+ LOGMASKED(LOG_GENERAL, "%s GCR ERR %u\n", cur_live.tm.as_string(),gcr_err);
cur_live.gcr_err = gcr_err;
syncpoint = true;
}
- if (syncpoint) {
+ if (syncpoint)
+ {
live_delay(RUNNING_SYNCPOINT);
return;
}
break;
}
- case RUNNING_SYNCPOINT: {
- if (cur_live.lbrdy_changed) {
+ case RUNNING_SYNCPOINT:
+ {
+ if (cur_live.lbrdy_changed)
+ {
m_lbrdy_cb(0);
cur_live.lbrdy_changed = false;
}
- if (cur_live.syn_changed) {
+ if (cur_live.syn_changed)
+ {
m_syn_cb(cur_live.syn);
cur_live.syn_changed = false;
}
diff --git a/src/mame/machine/victor9k_fdc.h b/src/mame/machine/victor9k_fdc.h
index 67105ba4318..6f91f426d48 100644
--- a/src/mame/machine/victor9k_fdc.h
+++ b/src/mame/machine/victor9k_fdc.h
@@ -46,12 +46,15 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// optional information overrides
virtual const tiny_rom_entry *device_rom_region() const override;
virtual void device_add_mconfig(machine_config &config) override;
+ TIMER_CALLBACK_MEMBER(gen_tick);
+ TIMER_CALLBACK_MEMBER(tach0_tick);
+ TIMER_CALLBACK_MEMBER(tach1_tick);
+
private:
static const int rpm[0x100];
@@ -59,13 +62,6 @@ private:
enum
{
- TM_GEN,
- TM_TACH0,
- TM_TACH1
- };
-
- enum
- {
LED_A = 0,
LED_B
};
diff --git a/src/mame/machine/vino.cpp b/src/mame/machine/vino.cpp
index ef9d72acc68..5de93c7fb78 100644
--- a/src/mame/machine/vino.cpp
+++ b/src/mame/machine/vino.cpp
@@ -49,8 +49,8 @@ vino_device::vino_device(const machine_config &mconfig, const char *tag, device_
void vino_device::device_start()
{
- m_channels[0].m_fetch_timer = timer_alloc(TIMER_FETCH_CHA);
- m_channels[1].m_fetch_timer = timer_alloc(TIMER_FETCH_CHB);
+ m_channels[0].m_fetch_timer = timer_alloc(FUNC(vino_device::fetch_pixel<0>), this);
+ m_channels[1].m_fetch_timer = timer_alloc(FUNC(vino_device::fetch_pixel<1>), this);
save_item(NAME(m_rev_id));
save_item(NAME(m_control));
@@ -146,12 +146,6 @@ void vino_device::device_add_mconfig(machine_config &config)
IMAGE_AVIVIDEO(config, m_avivideo);
}
-void vino_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- if (id == TIMER_FETCH_CHA || id == TIMER_FETCH_CHB)
- fetch_pixel((int)id);
-}
-
uint32_t vino_device::read(offs_t offset, uint32_t mem_mask)
{
switch (offset & ~1)
@@ -800,26 +794,27 @@ void vino_device::input_pixel(int channel, int32_t &y, int32_t &u, int32_t &v)
}
}
-void vino_device::fetch_pixel(int channel)
+template <int Channel>
+TIMER_CALLBACK_MEMBER(vino_device::fetch_pixel)
{
- channel_t &chan = m_channels[channel];
+ channel_t &chan = m_channels[Channel];
if (chan.m_decimation > 1 && (chan.m_field_x % chan.m_decimation) != 0)
{
- count_pixel(channel);
+ count_pixel(Channel);
return;
}
if (BIT(chan.m_frame_mask_shifter, 0))
{
int32_t y = 0, u = 0, v = 0;
- input_pixel(channel, y, u, v);
- process_pixel(channel, y, u, v);
+ input_pixel(Channel, y, u, v);
+ process_pixel(Channel, y, u, v);
}
else
{
- count_pixel(channel);
+ count_pixel(Channel);
if (chan.m_end_of_field)
{
- end_of_field(channel);
+ end_of_field(Channel);
chan.m_end_of_field = false;
}
}
diff --git a/src/mame/machine/vino.h b/src/mame/machine/vino.h
index f88e406bc38..bec1474421d 100644
--- a/src/mame/machine/vino.h
+++ b/src/mame/machine/vino.h
@@ -37,12 +37,8 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_add_mconfig(machine_config &config) override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
private:
- static constexpr device_timer_id TIMER_FETCH_CHA = 0;
- static constexpr device_timer_id TIMER_FETCH_CHB = 1;
-
enum channel_num_t : uint32_t
{
CHAN_A,
@@ -218,7 +214,7 @@ private:
uint32_t linear_rgb(uint32_t a, uint32_t b, float f);
uint32_t bilinear_pixel(float s, float t);
void input_pixel(int channel, int32_t &y, int32_t &u, int32_t &v);
- void fetch_pixel(int channel);
+ template <int Channel> TIMER_CALLBACK_MEMBER(fetch_pixel);
attotime calculate_field_rate(int channel);
attotime calculate_fetch_rate(int channel);
diff --git a/src/mame/machine/vsnes.cpp b/src/mame/machine/vsnes.cpp
index a406ef4b3b2..b3d9b7d1269 100644
--- a/src/mame/machine/vsnes.cpp
+++ b/src/mame/machine/vsnes.cpp
@@ -549,7 +549,7 @@ void vsnes_state::init_vsdual()
//**********************************************************************************
// Vs. Super Mario Bros (Bootleg)
-void vsnes_state::vsnes_bootleg_scanline(int scanline, int vblank, int blanked)
+void vsnes_state::vsnes_bootleg_scanline(int scanline, bool vblank, bool blanked)
{
// Z80 IRQ is controlled by two factors:
// - bit 6 of current (next) scanline number
diff --git a/src/mame/machine/wpc.cpp b/src/mame/machine/wpc.cpp
index 987d75c6258..9647a526192 100644
--- a/src/mame/machine/wpc.cpp
+++ b/src/mame/machine/wpc.cpp
@@ -43,7 +43,7 @@ void wpc_device::device_start()
m_bank_w.resolve_safe();
m_dmdbank_w.resolve_safe();
- m_zc_timer = timer_alloc(TIMER_ZEROCROSS);
+ m_zc_timer = timer_alloc(FUNC(wpc_device::zerocross_set), this);
m_zc_timer->adjust(attotime::from_hz(120),0,attotime::from_hz(120));
}
@@ -55,14 +55,9 @@ void wpc_device::device_reset()
m_alpha_pos = 0;
}
-void wpc_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(wpc_device::zerocross_set)
{
- switch(id)
- {
- case TIMER_ZEROCROSS:
- m_zerocross = true;
- break;
- }
+ m_zerocross = true;
}
uint8_t wpc_device::read(offs_t offset)
diff --git a/src/mame/machine/wpc.h b/src/mame/machine/wpc.h
index 8a87278bacf..014dbb19f9c 100644
--- a/src/mame/machine/wpc.h
+++ b/src/mame/machine/wpc.h
@@ -78,9 +78,6 @@
class wpc_device : public device_t
{
public:
- static constexpr device_timer_id TIMER_IRQ = 1;
- static constexpr device_timer_id TIMER_ZEROCROSS = 2;
-
wpc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
uint8_t read(offs_t offset);
@@ -111,7 +108,7 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(zerocross_set);
private:
uint8_t m_shift_addr_high;
diff --git a/src/mame/machine/wpc_lamp.cpp b/src/mame/machine/wpc_lamp.cpp
index 8aaa2455285..1222d98c24c 100644
--- a/src/mame/machine/wpc_lamp.cpp
+++ b/src/mame/machine/wpc_lamp.cpp
@@ -23,11 +23,19 @@ void wpc_lamp_device::set_names(const char *const *_names)
void wpc_lamp_device::update()
{
- for(int i=0; i<8; i++)
- if(row & (1 << i))
- for(int j=0; j<8; j++)
- if(col & (1 << j))
- state[(j<<3)|i] |= 0x80;
+ for (int i = 0; i < 8; i++)
+ {
+ if (row & (1 << i))
+ {
+ for (int j = 0; j < 8; j++)
+ {
+ if (BIT(col, j))
+ {
+ state[(j << 3) | i] |= 0x80;
+ }
+ }
+ }
+ }
}
void wpc_lamp_device::row_w(uint8_t data)
@@ -48,7 +56,7 @@ void wpc_lamp_device::device_start()
save_item(NAME(col));
save_item(NAME(row));
- timer = timer_alloc(0);
+ timer = timer_alloc(FUNC(wpc_lamp_device::update_lamps), this);
}
void wpc_lamp_device::device_reset()
@@ -57,14 +65,16 @@ void wpc_lamp_device::device_reset()
timer->adjust(attotime::from_hz(60), 0, attotime::from_hz(60));
}
-void wpc_lamp_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(wpc_lamp_device::update_lamps)
{
- for(int i=0; i<64; i++) {
+ for (int i = 0; i < 64; i++)
+ {
uint8_t s = state[i];
state[i] = s >> 1;
- if((s & 0xc0) == 0x40 || (s & 0xc0) == 0x80) {
+ if ((s & 0xc0) == 0x40 || (s & 0xc0) == 0x80)
+ {
char buffer[256];
- if(names && names[i])
+ if (names && names[i])
sprintf(buffer, "l:%s", names[i]);
else
sprintf(buffer, "l:%d%d", 1+(i >> 3), 1 + (i & 7));
diff --git a/src/mame/machine/wpc_lamp.h b/src/mame/machine/wpc_lamp.h
index 64f9b535b8a..1e32196e44d 100644
--- a/src/mame/machine/wpc_lamp.h
+++ b/src/mame/machine/wpc_lamp.h
@@ -20,16 +20,18 @@ public:
void set_names(const char *const *lamp_names);
protected:
- uint8_t state[64]{};
- uint8_t col = 0, row = 0;
- emu_timer *timer = nullptr;
- const char *const *names;
-
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(update_lamps);
void update();
+
+ uint8_t state[64]{};
+ uint8_t col = 0;
+ uint8_t row = 0;
+ emu_timer *timer = nullptr;
+ const char *const *names;
};
DECLARE_DEVICE_TYPE(WPC_LAMP, wpc_lamp_device)
diff --git a/src/mame/machine/wpc_out.cpp b/src/mame/machine/wpc_out.cpp
index 9de9b6988ac..3f0ceef78ac 100644
--- a/src/mame/machine/wpc_out.cpp
+++ b/src/mame/machine/wpc_out.cpp
@@ -36,9 +36,13 @@ void wpc_out_device::gi_update()
attotime now = machine().time();
attotime delta = now - previous_gi_update;
uint32_t delta_us = delta.as_ticks(1e6);
- for(int i=0; i<gi_count; i++)
- if(gi & (1 <<i))
+ for (int i = 0; i < gi_count; i++)
+ {
+ if (BIT(gi, i))
+ {
gi_time[i] += delta_us;
+ }
+ }
previous_gi_update = now;
}
@@ -49,15 +53,18 @@ void wpc_out_device::send_output(int sid, int state)
char buffer[32];
const char *name;
- if(names && names[sid-1] && strcmp(names[sid-1], "s:"))
- name = names[sid-1];
- else {
+ if (names && names[sid - 1] && strcmp(names[sid - 1], "s:"))
+ {
+ name = names[sid - 1];
+ }
+ else
+ {
sprintf(buffer, "u:output %02d", sid);
name = buffer;
}
machine().output().set_value(name, state);
- if(sid == 41)
+ if (sid == 41)
machine().bookkeeping().coin_counter_w(0, state);
}
@@ -66,28 +73,33 @@ void wpc_out_device::out_w(offs_t offset, uint8_t data)
first_after_led = false;
uint8_t diff = state[offset] ^ data;
state[offset] = data;
- if(diff)
- for(int i=0; i<8; i++)
- if(diff & (1 << i)) {
+ if (diff)
+ {
+ for (int i = 0; i < 8; i++)
+ {
+ if (BIT(diff, i))
+ {
int id = (offset << 3) | i;
int sid;
- if(id <= 3)
+ if (id <= 3)
sid = id + 25;
- else if(id <= 7)
+ else if (id <= 7)
sid = id + 33;
- else if(id <= 15)
- sid = id-7;
- else if(id <= 23)
- sid = id+1;
- else if(id <= 31)
- sid = id-15;
- else if(id <= 39)
- sid = id-3;
+ else if (id <= 15)
+ sid = id - 7;
+ else if (id <= 23)
+ sid = id + 1;
+ else if (id <= 31)
+ sid = id - 15;
+ else if (id <= 39)
+ sid = id - 3;
else
- sid = id+2;
+ sid = id + 2;
- send_output(sid, (data & (1<<i)) != 0);
+ send_output(sid, BIT(data, i));
}
+ }
+ }
}
void wpc_out_device::out4_w(uint8_t data)
@@ -119,7 +131,7 @@ void wpc_out_device::device_start()
save_item(NAME(previous_gi_update));
save_item(NAME(gi_time));
- timer = timer_alloc(0);
+ timer = timer_alloc(FUNC(wpc_out_device::update_outputs), this);
}
void wpc_out_device::device_reset()
@@ -132,10 +144,11 @@ void wpc_out_device::device_reset()
timer->adjust(attotime::from_hz(10), 0, attotime::from_hz(10));
}
-void wpc_out_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(wpc_out_device::update_outputs)
{
gi_update();
- for(int i=0; i<gi_count; i++) {
+ for (int i = 0; i < gi_count; i++)
+ {
// fprintf(stderr, "gi[%d] = %d\n", i, gi_time[i]);
gi_time[i] = 0;
}
diff --git a/src/mame/machine/wpc_out.h b/src/mame/machine/wpc_out.h
index a45cd05d98b..e51a9722161 100644
--- a/src/mame/machine/wpc_out.h
+++ b/src/mame/machine/wpc_out.h
@@ -32,6 +32,15 @@ public:
void set_gi_count(int _count);
protected:
+ virtual void device_start() override;
+ virtual void device_reset() override;
+
+ TIMER_CALLBACK_MEMBER(update_outputs);
+
+ void gi_update();
+
+ void send_output(int sid, int state);
+
uint8_t state[6]{}, gi = 0;
bool first_after_led = false;
attotime previous_gi_update;
@@ -40,14 +49,6 @@ protected:
emu_timer *timer = nullptr;
const char *const *names;
handler_t handler_cb;
-
- void send_output(int sid, int state);
-
- virtual void device_start() override;
- virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-
- void gi_update();
};
DECLARE_DEVICE_TYPE(WPC_OUT, wpc_out_device)
diff --git a/src/mame/machine/x68k_hdc.cpp b/src/mame/machine/x68k_hdc.cpp
index d3f108cb40b..f4e74b08c22 100644
--- a/src/mame/machine/x68k_hdc.cpp
+++ b/src/mame/machine/x68k_hdc.cpp
@@ -41,7 +41,7 @@ void x68k_hdc_image_device::device_start()
m_status = 0x00;
m_status_port = 0x00;
m_phase = sasi_phase::BUSFREE;
- m_req_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x68k_hdc_image_device::req_timer_callback), this));
+ m_req_timer = timer_alloc(FUNC(x68k_hdc_image_device::req_timer_callback), this);
save_item(NAME(m_phase));
save_item(NAME(m_status_port));
diff --git a/src/mame/machine/xavix.cpp b/src/mame/machine/xavix.cpp
index 317e5a3ee9e..d56ef68366e 100644
--- a/src/mame/machine/xavix.cpp
+++ b/src/mame/machine/xavix.cpp
@@ -784,12 +784,12 @@ void xavix_state::machine_start()
// don't do this every reset or it breaks the baseball 2 secret mode toggle which flips a bit in RAM
std::fill_n(&m_mainram[0], 0x4000 - nvram_size, 0xff);
- m_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(xavix_state::interrupt_gen), this));
- m_freq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(xavix_state::freq_timer_done), this));
+ m_interrupt_timer = timer_alloc(FUNC(xavix_state::interrupt_gen), this);
+ m_freq_timer = timer_alloc(FUNC(xavix_state::freq_timer_done), this);
for (int i = 0; i < 4; i++)
{
- m_sound_timer[i] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(xavix_state::sound_timer_done), this));
+ m_sound_timer[i] = timer_alloc(FUNC(xavix_state::sound_timer_done), this);
}
if (m_nvram)
diff --git a/src/mame/machine/xavix_adc.cpp b/src/mame/machine/xavix_adc.cpp
index 527f6d542e2..e1271e39e47 100644
--- a/src/mame/machine/xavix_adc.cpp
+++ b/src/mame/machine/xavix_adc.cpp
@@ -33,7 +33,7 @@ void xavix_adc_device::device_start()
m_in6_cb.resolve_safe(0xff);
m_in7_cb.resolve_safe(0xff);
- m_adc_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(xavix_adc_device::adc_timer_done), this));
+ m_adc_timer = timer_alloc(FUNC(xavix_adc_device::adc_timer_done), this);
save_item(NAME(m_adc_control));
save_item(NAME(m_adc_inlatch));
diff --git a/src/mame/machine/xavix_madfb_ball.cpp b/src/mame/machine/xavix_madfb_ball.cpp
index 48b76ecdc68..b773460c990 100644
--- a/src/mame/machine/xavix_madfb_ball.cpp
+++ b/src/mame/machine/xavix_madfb_ball.cpp
@@ -77,7 +77,7 @@ ioport_constructor xavix_madfb_ball_device::device_input_ports() const
void xavix_madfb_ball_device::device_start()
{
m_event_out_cb.resolve_safe();
- m_event_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(xavix_madfb_ball_device::event_timer), this));
+ m_event_timer = timer_alloc(FUNC(xavix_madfb_ball_device::event_timer), this);
}
void xavix_madfb_ball_device::device_reset()
diff --git a/src/mame/machine/xavix_mtrk_wheel.cpp b/src/mame/machine/xavix_mtrk_wheel.cpp
index 7816bf3b06c..ad3e8b7982e 100644
--- a/src/mame/machine/xavix_mtrk_wheel.cpp
+++ b/src/mame/machine/xavix_mtrk_wheel.cpp
@@ -75,7 +75,7 @@ ioport_constructor xavix_mtrk_wheel_device::device_input_ports() const
void xavix_mtrk_wheel_device::device_start()
{
m_event_out_cb.resolve_safe();
- m_event_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(xavix_mtrk_wheel_device::event_timer), this));
+ m_event_timer = timer_alloc(FUNC(xavix_mtrk_wheel_device::event_timer), this);
}
void xavix_mtrk_wheel_device::device_reset()
diff --git a/src/mame/machine/xbox_pci.cpp b/src/mame/machine/xbox_pci.cpp
index 6027ab02591..b2d1f125cd7 100644
--- a/src/mame/machine/xbox_pci.cpp
+++ b/src/mame/machine/xbox_pci.cpp
@@ -722,7 +722,7 @@ void mcpx_ohci_device::device_start()
m_interrupt_handler(state);
}
);
- timer = timer_alloc(0);
+ timer = timer_alloc(FUNC(mcpx_ohci_device::usb_update), this);
ohci_usb->set_timer(timer);
ohci_usb->start();
for (int i=0;i < connecteds_count;i++)
@@ -757,10 +757,10 @@ void mcpx_ohci_device::device_config_complete()
}
}
-void mcpx_ohci_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(mcpx_ohci_device::usb_update)
{
if (ohci_usb)
- ohci_usb->timer(timer, id, param);
+ ohci_usb->timer(param);
}
uint32_t mcpx_ohci_device::ohci_r(offs_t offset)
@@ -874,7 +874,7 @@ void mcpx_apu_device::device_start()
memset(apust.voices_position_end, 0, sizeof(apust.voices_position_end));
memset(apust.voices_position_increment, 0, sizeof(apust.voices_position_increment));
apust.space = &cpu->space();
- apust.timer = timer_alloc(0);
+ apust.timer = timer_alloc(FUNC(mcpx_apu_device::audio_update), this);
apust.timer->enable(false);
}
@@ -883,30 +883,25 @@ void mcpx_apu_device::device_reset()
pci_device::device_reset();
}
-void mcpx_apu_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(mcpx_apu_device::audio_update)
{
- int cmd;
- int bb, b, v;
- uint64_t bv;
- uint32_t phys;
-
// this works only for outr2
// value at 0x810 is modified by the firmware that has been loaded on the gp dsp
- cmd = apust.space->read_dword(apust.gpdsp_address + 0x800 + 0x10);
+ int cmd = apust.space->read_dword(apust.gpdsp_address + 0x800 + 0x10);
if (cmd == 3)
apust.space->write_dword(apust.gpdsp_address + 0x800 + 0x10, 0);
/*else
logerror("Audio_APU: unexpected value at address %d\n",apust.gpdsp_address+0x800+0x10);*/
// check all the 256 possible voices
- for (b = 0; b < 4; b++) {
- bv = 1;
- for (bb = 0; bb < 64; bb++) {
+ for (int b = 0; b < 4; b++) {
+ uint64_t bv = 1;
+ for (int bb = 0; bb < 64; bb++) {
if (apust.voices_active[b] & bv) {
- v = bb + (b << 6);
+ int v = bb + (b << 6);
apust.voices_position[v] += apust.voices_position_increment[v];
while (apust.voices_position[v] >= apust.voices_position_end[v])
apust.voices_position[v] = apust.voices_position_start[v] + apust.voices_position[v] - apust.voices_position_end[v] - 1000;
- phys = apust.voicedata_address + 0x80 * v;
+ uint32_t phys = apust.voicedata_address + 0x80 * v;
apust.space->write_dword(phys + 0x58, apust.voices_position[v] / 1000);
}
bv = bv << 1;
diff --git a/src/mame/machine/xbox_usb.cpp b/src/mame/machine/xbox_usb.cpp
index 5b2dca2be6e..aefa352a12a 100644
--- a/src/mame/machine/xbox_usb.cpp
+++ b/src/mame/machine/xbox_usb.cpp
@@ -220,9 +220,8 @@ void ohci_usb_controller::write(offs_t offset, uint32_t data)
ohcist.hc_regs[offset] = data;
}
-void ohci_usb_controller::timer(emu_timer &timer, device_timer_id id, int param)
+void ohci_usb_controller::timer(int param)
{
- uint32_t hcca;
uint32_t plh;
int changed = 0;
int list = 1;
@@ -230,7 +229,7 @@ void ohci_usb_controller::timer(emu_timer &timer, device_timer_id id, int param)
bool retire = false;
int pid, remain, mps, done;
- hcca = ohcist.hc_regs[HcHCCA];
+ uint32_t hcca = ohcist.hc_regs[HcHCCA];
if (ohcist.state == UsbOperational) {
// increment frame number
ohcist.framenumber = (ohcist.framenumber + 1) & 0xffff;
diff --git a/src/mame/machine/z80ne.cpp b/src/mame/machine/z80ne.cpp
index e2159af8010..5cdc78a3727 100644
--- a/src/mame/machine/z80ne.cpp
+++ b/src/mame/machine/z80ne.cpp
@@ -30,7 +30,7 @@ cassette_image_device* z80ne_state::cassette_device_image()
return m_cassette1;
}
-TIMER_CALLBACK_MEMBER(z80ne_state::z80ne_cassette_tc)
+TIMER_CALLBACK_MEMBER(z80ne_state::cassette_tc)
{
uint8_t cass_ws = 0;
m_cass_data.input.length++;
@@ -100,7 +100,7 @@ void z80netf_state::driver_init()
}
-TIMER_CALLBACK_MEMBER(z80ne_state::z80ne_kbd_scan)
+TIMER_CALLBACK_MEMBER(z80ne_state::kbd_scan)
{
/*
* NE555 is connected to a 74LS93 binary counter
@@ -144,16 +144,9 @@ TIMER_CALLBACK_MEMBER(z80ne_state::z80ne_kbd_scan)
}
}
-void z80ne_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(z80ne_state::pulse_nmi)
{
- switch (id)
- {
- case 0:
- m_maincpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero);
- break;
- default:
- printf("Invalid timer %d encountered\n",id);
- }
+ m_maincpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero);
}
void z80net_state::reset_lx387()
@@ -342,13 +335,13 @@ INPUT_CHANGED_MEMBER(z80net_state::z80net_nmi)
void z80ne_state::machine_start()
{
- m_timer_nmi = timer_alloc(0);
+ m_timer_nmi = timer_alloc(FUNC(z80ne_state::pulse_nmi), this);
m_lx383_digits.resolve();
m_lx385_ctrl = 0x1f;
- m_cassette_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(z80ne_state::z80ne_cassette_tc), this));
- m_kbd_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(z80ne_state::z80ne_kbd_scan), this));
+ m_cassette_timer = timer_alloc(FUNC(z80ne_state::cassette_tc), this);
+ m_kbd_timer = timer_alloc(FUNC(z80ne_state::kbd_scan), this);
m_kbd_timer->adjust(attotime::from_hz(1000), 0, attotime::from_hz(1000));
}
diff --git a/src/mame/machine/z88_impexp.cpp b/src/mame/machine/z88_impexp.cpp
index 431fae75197..fbbdf8f80ad 100644
--- a/src/mame/machine/z88_impexp.cpp
+++ b/src/mame/machine/z88_impexp.cpp
@@ -51,7 +51,7 @@ z88_impexp_device::z88_impexp_device(const machine_config &mconfig, const char *
void z88_impexp_device::device_start()
{
- m_timer_poll = timer_alloc();
+ m_timer_poll = timer_alloc(FUNC(z88_impexp_device::poll_queue), this);
}
//-------------------------------------------------
@@ -74,10 +74,10 @@ void z88_impexp_device::device_reset()
}
//-------------------------------------------------
-// device_timer - handler timer events
+// poll_queue - periodically update the queue
//-------------------------------------------------
-void z88_impexp_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(z88_impexp_device::poll_queue)
{
queue();
}
diff --git a/src/mame/machine/z88_impexp.h b/src/mame/machine/z88_impexp.h
index 67a818467bf..c73bc04a041 100644
--- a/src/mame/machine/z88_impexp.h
+++ b/src/mame/machine/z88_impexp.h
@@ -27,7 +27,6 @@ public:
protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_serial_interface overrides
virtual void tra_callback() override;
@@ -47,6 +46,8 @@ protected:
virtual const char *image_type_name() const noexcept override { return "serial"; }
virtual const char *image_brief_type_name() const noexcept override { return "serl"; }
+ TIMER_CALLBACK_MEMBER(poll_queue);
+
private:
void check_filename(std::string &filename);
void queue();
diff --git a/src/mame/machine/znmcu.cpp b/src/mame/machine/znmcu.cpp
index a008ae0f954..75288a8af79 100644
--- a/src/mame/machine/znmcu.cpp
+++ b/src/mame/machine/znmcu.cpp
@@ -28,7 +28,7 @@ void znmcu_device::device_start()
m_dataout_handler.resolve_safe();
m_dsr_handler.resolve_safe();
- m_mcu_timer = timer_alloc(0);
+ m_mcu_timer = timer_alloc(FUNC(znmcu_device::mcu_tick), this);
m_dataout_handler(1);
m_dsr_handler(1);
@@ -96,7 +96,7 @@ WRITE_LINE_MEMBER(znmcu_device::write_clock)
}
}
-void znmcu_device::device_timer(emu_timer &timer, device_timer_id tid, int param)
+TIMER_CALLBACK_MEMBER(znmcu_device::mcu_tick)
{
m_dsr_handler(param);
diff --git a/src/mame/machine/znmcu.h b/src/mame/machine/znmcu.h
index f956ae87115..60166999897 100644
--- a/src/mame/machine/znmcu.h
+++ b/src/mame/machine/znmcu.h
@@ -26,7 +26,8 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(mcu_tick);
private:
devcb_read8 m_dsw_handler;
diff --git a/src/mame/machine/zx.cpp b/src/mame/machine/zx.cpp
index cd00c2673b8..cf08590c0fa 100644
--- a/src/mame/machine/zx.cpp
+++ b/src/mame/machine/zx.cpp
@@ -14,7 +14,7 @@
void zx_state::init_zx()
{
m_program = &m_maincpu->space(AS_PROGRAM);
- m_tape_input = timer_alloc(TIMER_TAPE_INPUT);
+ m_tape_input = timer_alloc(FUNC(zx_state::zx_tape_input), this);
if(m_ram->size() == 32768)
m_program->unmap_readwrite(0x8000, 0xbfff);
@@ -41,7 +41,7 @@ void zx_state::machine_reset()
m_tape_input->adjust(attotime::from_hz(44100), 0, attotime::from_hz(44100));
}
-void zx_state::zx_tape_input()
+TIMER_CALLBACK_MEMBER(zx_state::zx_tape_input)
{
m_cassette_cur_level = m_cassette->input();
}
diff --git a/src/mame/machine/zx8302.cpp b/src/mame/machine/zx8302.cpp
index b2fd9acbfe2..49e0d9dde94 100644
--- a/src/mame/machine/zx8302.cpp
+++ b/src/mame/machine/zx8302.cpp
@@ -188,9 +188,9 @@ void zx8302_device::device_start()
m_in_raw2_cb.resolve_safe(0);
// allocate timers
- m_baudx4_timer = timer_alloc(TIMER_BAUDX4);
- m_rtc_timer = timer_alloc(TIMER_RTC);
- m_gap_timer = timer_alloc(TIMER_GAP);
+ m_baudx4_timer = timer_alloc(FUNC(zx8302_device::baudx4_tick), this);
+ m_rtc_timer = timer_alloc(FUNC(zx8302_device::rtc_tick), this);
+ m_gap_timer = timer_alloc(FUNC(zx8302_device::trigger_gap_int), this);
m_rtc_timer->adjust(attotime::zero, 0, attotime::from_hz(m_rtc_clock / 32768));
m_gap_timer->adjust(attotime::zero, 0, attotime::from_msec(31));
@@ -217,29 +217,23 @@ void zx8302_device::device_start()
//-------------------------------------------------
-// device_timer - handler timer events
+// timer events
//-------------------------------------------------
-void zx8302_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(zx8302_device::baudx4_tick)
{
- switch (id)
- {
- case TIMER_BAUDX4:
- m_baudx4 = !m_baudx4;
- m_out_baudx4_cb(m_baudx4);
- break;
-
- case TIMER_RTC:
- m_ctr++;
- break;
+ m_baudx4 = !m_baudx4;
+ m_out_baudx4_cb(m_baudx4);
+}
- case TIMER_GAP:
- trigger_interrupt(INT_GAP);
- break;
+TIMER_CALLBACK_MEMBER(zx8302_device::rtc_tick)
+{
+ m_ctr++;
+}
- default:
- break;
- }
+TIMER_CALLBACK_MEMBER(zx8302_device::trigger_gap_int)
+{
+ trigger_interrupt(INT_GAP);
}
diff --git a/src/mame/machine/zx8302.h b/src/mame/machine/zx8302.h
index 7aa922a4b3a..5ec95729d17 100644
--- a/src/mame/machine/zx8302.h
+++ b/src/mame/machine/zx8302.h
@@ -89,7 +89,6 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_serial_interface overrides
virtual void tra_callback() override;
@@ -97,19 +96,16 @@ protected:
virtual void rcv_callback() override;
virtual void rcv_complete() override;
+ TIMER_CALLBACK_MEMBER(baudx4_tick);
+ TIMER_CALLBACK_MEMBER(rtc_tick);
+ TIMER_CALLBACK_MEMBER(trigger_gap_int);
+
inline void trigger_interrupt(uint8_t line);
inline void transmit_ipc_data();
private:
enum
{
- TIMER_BAUDX4 = 0,
- TIMER_RTC,
- TIMER_GAP
- };
-
- enum
- {
IPC_START,
IPC_DATA,
IPC_STOP
diff --git a/src/mame/video/3dom2_te.cpp b/src/mame/video/3dom2_te.cpp
index 8bd8412a8ad..5405f91c851 100644
--- a/src/mame/video/3dom2_te.cpp
+++ b/src/mame/video/3dom2_te.cpp
@@ -725,14 +725,13 @@ void m2_te_device::device_start()
// Allocate PIP RAM
m_pipram = std::make_unique<uint32_t[]>(PIP_RAM_WORDS);
- // TODO
+ // Clear our state; TODO: Proper reset values
memset(&m_gc, 0, sizeof(m_gc));
memset(&m_se, 0, sizeof(m_se));
memset(&m_es, 0, sizeof(m_es));
memset(&m_tm, 0, sizeof(m_tm));
memset(&m_db, 0, sizeof(m_db));
-
// Register state for saving
save_pointer(NAME(m_tram), TEXTURE_RAM_WORDS);
save_pointer(NAME(m_pipram), PIP_RAM_WORDS);
@@ -742,6 +741,9 @@ void m2_te_device::device_start()
save_item(NAME(m_es.m_regs));
save_item(NAME(m_tm.m_regs));
save_item(NAME(m_db.m_regs));
+
+ // Allocate timers
+ m_done_timer = timer_alloc(FUNC(m2_te_device::command_done), this);
}
@@ -3461,7 +3463,7 @@ void m2_te_device::execute()
logerror("Z writes: %u\n", g_statistics[STAT_ZBUFFER_STORES]);
logerror("Total: %u cycles (%fusec)\n", total_cycles, clocks_to_attotime(total_cycles).as_double()*1.0e6);
#endif
- timer_set(clocks_to_attotime(total_cycles), 0);
+ m_done_timer->adjust(clocks_to_attotime(total_cycles));
#else
// Interrupt after stopping?
if (m_gc.te_master_mode & TEICNTL_INT)
@@ -3896,14 +3898,8 @@ void m2_te_device::load_texture()
TIMERS
***************************************************************************/
-void m2_te_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(m2_te_device::command_done)
{
- switch (id)
- {
- case 0:
- if (m_gc.te_master_mode & TEICNTL_INT)
- set_interrupt(INTSTAT_IMMEDIATE_INSTR);
- break;
- }
-
+ if (m_gc.te_master_mode & TEICNTL_INT)
+ set_interrupt(INTSTAT_IMMEDIATE_INSTR);
}
diff --git a/src/mame/video/3dom2_te.h b/src/mame/video/3dom2_te.h
index 8c25c45c043..4f20d9de67c 100644
--- a/src/mame/video/3dom2_te.h
+++ b/src/mame/video/3dom2_te.h
@@ -48,7 +48,8 @@ public:
protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+
+ TIMER_CALLBACK_MEMBER(command_done);
private:
@@ -188,6 +189,7 @@ private:
uint32_t readbits_from_ram(uint32_t & src_addr, uint32_t & bit_offs, uint32_t bits);
void load_texture();
+ emu_timer *m_done_timer;
m2_bda_device *m_bda;
devcb_write_line m_general_int_handler;
diff --git a/src/mame/video/733_asr.cpp b/src/mame/video/733_asr.cpp
index 5ec30527ff4..08f28ed486f 100644
--- a/src/mame/video/733_asr.cpp
+++ b/src/mame/video/733_asr.cpp
@@ -103,7 +103,7 @@ void asr733_device::device_start()
m_keyint_line.resolve();
m_lineint_line.resolve();
- m_line_timer = timer_alloc(0);
+ m_line_timer = timer_alloc(FUNC(asr733_device::line_tick), this);
uint8_t *dst;
@@ -395,19 +395,21 @@ void asr733_device::cru_w(offs_t offset, uint8_t data)
}
}
-/*
- Video refresh
-*/
+//-------------------------------------------------
+// video refresh
+//-------------------------------------------------
+
void asr733_device::refresh(bitmap_ind16 &bitmap, int x, int y)
{
copybitmap(bitmap, *m_bitmap, 0, 0, x, y, m_bitmap->cliprect());
}
-/*
- Time callbacks
-*/
-void asr733_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+//-------------------------------------------------
+// line_tick - check the keyboard
+//-------------------------------------------------
+
+TIMER_CALLBACK_MEMBER(asr733_device::line_tick)
{
check_keyboard();
m_lineint_line(ASSERT_LINE);
@@ -417,174 +419,24 @@ void asr733_device::device_timer(emu_timer &timer, device_timer_id id, int param
static const unsigned char key_translate[3][51] =
{
{ /* unshifted */
- '1',
- '2',
- '3',
- '4',
- '5',
- '6',
- '7',
- '8',
- '9',
- '0',
- ':',
- '-',
-
- 0x1b,
- 'Q',
- 'W',
- 'E',
- 'R',
- 'T',
- 'Y',
- 'U',
- 'I',
- 'O',
- 'P',
- 0x0a,
- 0x0d,
-
- 0,
- 'A',
- 'S',
- 'D',
- 'F',
- 'G',
- 'H',
- 'J',
- 'K',
- 'L',
- ';',
- 0x08,
- 0,
-
- 0,
- 'Z',
- 'X',
- 'C',
- 'V',
- 'B',
- 'N',
- 'M',
- ',',
- '.',
- '/',
- 0,
-
+ '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', ':', '-',
+ 0x1b, 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 0x0a, 0x0d,
+ 0, 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ';', 0x08, 0,
+ 0, 'Z', 'X', 'C', 'V', 'B', 'N', 'M', ',', '.', '/', 0,
' '
},
{ /* shifted */
- '!',
- '"',
- '#',
- '$',
- '%',
- '&',
- '^',
- '(',
- ')',
- ' ',
- '*',
- '=',
-
- 0x1b,
- 'Q',
- 'W',
- 'E',
- 'R',
- 'T',
- 'Y',
- 'U',
- 'I',
- '_',
- '@',
- 0x0a,
- 0x0d,
-
- 0,
- 'A',
- 'S',
- 'D',
- 'F',
- 'G',
- 'H',
- 'J',
- 0,
- '/',
- '+',
- 0x08,
- 0,
-
- 0,
- 'Z',
- 'X',
- 'C',
- 'V',
- 'B',
- '^',
- '|',
- '<',
- '>',
- '?',
- 0,
-
+ '!', '"', '#', '$', '%', '&', '^', '(', ')', ' ', '*', '=',
+ 0x1b, 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', '_', '@', 0x0a, 0x0d,
+ 0, 'A', 'S', 'D', 'F', 'G', 'H', 'J', 0, '/', '+', 0x08, 0,
+ 0, 'Z', 'X', 'C', 'V', 'B', '^', '|', '<', '>', '?', 0,
' '
},
{ /* control */
- '1',
- '2',
- '3',
- '4',
- '5',
- '6',
- '7',
- '8',
- '9',
- '0',
- ':',
- '-',
-
- 0x1b,
- 0x11,
- 0x17,
- 0x05,
- 0x12,
- 0x14,
- 0x19,
- 0x15,
- 0x09,
- 0x0f,
- 0x10,
- 0x0a,
- 0x0d,
-
- 0,
- 0x01,
- 0x13,
- 0x04,
- 0x06,
- 0x07,
- 0x08,
- 0x0a,
- 0x0b,
- 0x0c,
- ';',
- 0x08,
- 0,
-
- 0,
- 0x1a,
- 0x18,
- 0x03,
- 0x16,
- 0x02,
- 0x0e,
- 0x0d,
- ',',
- '.',
- '/',
- 0,
-
+ '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', ':', '-',
+ 0x1b, 0x11, 0x17, 0x05, 0x12, 0x14, 0x19, 0x15, 0x09, 0x0f, 0x10, 0x0a, 0x0d,
+ 0, 0x01, 0x13, 0x04, 0x06, 0x07, 0x08, 0x0a, 0x0b, 0x0c, ';', 0x08, 0,
+ 0, 0x1a, 0x18, 0x03, 0x16, 0x02, 0x0e, 0x0d, ',', '.', '/', 0,
' '
}
};
diff --git a/src/mame/video/733_asr.h b/src/mame/video/733_asr.h
index aa004ff0579..a15bf0e0037 100644
--- a/src/mame/video/733_asr.h
+++ b/src/mame/video/733_asr.h
@@ -32,9 +32,10 @@ protected:
void device_start() override;
void device_reset() override;
virtual void device_add_mconfig(machine_config &config) override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
ioport_constructor device_input_ports() const override;
+ TIMER_CALLBACK_MEMBER(line_tick);
+
private:
// internal state
#if 0
diff --git a/src/mame/video/911_vdt.cpp b/src/mame/video/911_vdt.cpp
index c95c9180d02..f9dacb65181 100644
--- a/src/mame/video/911_vdt.cpp
+++ b/src/mame/video/911_vdt.cpp
@@ -152,13 +152,6 @@ vdt911_device::vdt911_device(const machine_config &mconfig, const char *tag, dev
{
}
-enum
-{
- BLINK_TIMER,
- BEEP_TIMER,
- LINE_TIMER
-};
-
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
@@ -177,9 +170,9 @@ void vdt911_device::device_start()
/* set up cursor blink clock. 2Hz frequency -> .25s half-period. */
/*m_blink_clock =*/
- m_blink_timer = timer_alloc(BLINK_TIMER);
- m_beep_timer = timer_alloc(BEEP_TIMER);
- m_line_timer = timer_alloc(LINE_TIMER);
+ m_blink_timer = timer_alloc(FUNC(vdt911_device::blink_tick), this);
+ m_beep_timer = timer_alloc(FUNC(vdt911_device::beep_off), this);
+ m_line_timer = timer_alloc(FUNC(vdt911_device::line_tick), this);
m_blink_timer->adjust(attotime::from_msec(0), 0, attotime::from_msec(250));
@@ -255,22 +248,22 @@ void vdt911_device::device_reset()
/*
Timer callbacks
*/
-void vdt911_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+
+TIMER_CALLBACK_MEMBER(vdt911_device::blink_tick)
{
- switch (id)
- {
- case BLINK_TIMER:
- m_blink_state = !m_blink_state;
- break;
- case BEEP_TIMER:
- m_beeper->set_state(0);
- break;
- case LINE_TIMER:
- check_keyboard();
- m_lineint_line(ASSERT_LINE);
- m_lineint_line(CLEAR_LINE);
- break;
- }
+ m_blink_state = !m_blink_state;
+}
+
+TIMER_CALLBACK_MEMBER(vdt911_device::beep_off)
+{
+ m_beeper->set_state(0);
+}
+
+TIMER_CALLBACK_MEMBER(vdt911_device::line_tick)
+{
+ check_keyboard();
+ m_lineint_line(ASSERT_LINE);
+ m_lineint_line(CLEAR_LINE);
}
/*
diff --git a/src/mame/video/911_vdt.h b/src/mame/video/911_vdt.h
index b1d364d4053..7b45480124c 100644
--- a/src/mame/video/911_vdt.h
+++ b/src/mame/video/911_vdt.h
@@ -60,7 +60,9 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
ioport_constructor device_input_ports() const override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(blink_tick);
+ TIMER_CALLBACK_MEMBER(beep_off);
+ TIMER_CALLBACK_MEMBER(line_tick);
private:
void refresh(bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y);
diff --git a/src/mame/video/abc80.cpp b/src/mame/video/abc80.cpp
index 98f3675146f..31f182c9bb9 100644
--- a/src/mame/video/abc80.cpp
+++ b/src/mame/video/abc80.cpp
@@ -159,16 +159,16 @@ void abc80_state::video_start()
m_screen->register_screen_bitmap(m_bitmap);
// start timers
- m_scanline_timer = timer_alloc(TIMER_ID_SCANLINE);
+ m_scanline_timer = timer_alloc(FUNC(abc80_state::scanline_tick), this);
m_scanline_timer->adjust(m_screen->time_until_pos(0, ABC80_HBEND), 0, m_screen->scan_period());
- m_blink_timer = timer_alloc(TIMER_ID_BLINK);
+ m_blink_timer = timer_alloc(FUNC(abc80_state::blink_tick), this);
m_blink_timer->adjust(attotime::from_hz(XTAL(11'980'800)/2/6/64/312/16), 0, attotime::from_hz(XTAL(11'980'800)/2/6/64/312/16));
- m_vsync_on_timer = timer_alloc(TIMER_ID_VSYNC_ON);
+ m_vsync_on_timer = timer_alloc(FUNC(abc80_state::vsync_on), this);
m_vsync_on_timer->adjust(m_screen->time_until_pos(0, 0), 0, m_screen->frame_period());
- m_vsync_off_timer = timer_alloc(TIMER_ID_VSYNC_OFF);
+ m_vsync_off_timer = timer_alloc(FUNC(abc80_state::vsync_off), this);
m_vsync_off_timer->adjust(m_screen->time_until_pos(16, 0), 0, m_screen->frame_period());
}
diff --git a/src/mame/video/antic.cpp b/src/mame/video/antic.cpp
index 1917ae15b80..b8e0aa7da3b 100644
--- a/src/mame/video/antic.cpp
+++ b/src/mame/video/antic.cpp
@@ -314,6 +314,10 @@ antic_device::antic_device(const machine_config &mconfig, const char *tag, devic
m_render1(0),
m_render2(0),
m_render3(0),
+ m_cycle_steal_timer(nullptr),
+ m_issue_dli_timer(nullptr),
+ m_scanline_timer(nullptr),
+ m_line_done_timer(nullptr),
m_cmd(0),
m_steal_cycles(0),
m_vscrol_old(0),
@@ -409,6 +413,17 @@ void antic_device::device_start()
save_pointer(NAME(m_cclk_expand), 21 * 256);
save_pointer(NAME(m_used_colors), 21 * 256);
+
+ /* timers */
+ m_cycle_steal_timer = timer_alloc(FUNC(antic_device::steal_cycles), this);
+ m_issue_dli_timer = timer_alloc(FUNC(antic_device::issue_dli), this);
+ m_scanline_timer = timer_alloc(FUNC(antic_device::scanline_render), this);
+ m_line_done_timer = timer_alloc(FUNC(antic_device::line_done), this);
+
+ m_cycle_steal_timer->adjust(attotime::never);
+ m_issue_dli_timer->adjust(attotime::never);
+ m_scanline_timer->adjust(attotime::never);
+ m_line_done_timer->adjust(attotime::never);
}
@@ -1936,25 +1951,6 @@ void antic_device::linerefresh()
#define ANTIC_TIME_FROM_CYCLES(cycles) \
(attotime)(screen().scan_period() * (cycles) / CYCLES_PER_LINE)
-void antic_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_CYCLE_STEAL:
- steal_cycles(param);
- break;
- case TIMER_ISSUE_DLI:
- issue_dli(param);
- break;
- case TIMER_LINE_REND:
- scanline_render(param);
- break;
- case TIMER_LINE_DONE:
- line_done(param);
- break;
- }
-}
-
int antic_device::cycle()
{
return screen().hpos() * CYCLES_PER_LINE / screen().width();
@@ -2011,7 +2007,7 @@ TIMER_CALLBACK_MEMBER( antic_device::line_done )
TIMER_CALLBACK_MEMBER( antic_device::steal_cycles )
{
LOG(" @cycle #%3d steal %d cycles\n", cycle(), m_steal_cycles);
- timer_set(ANTIC_TIME_FROM_CYCLES(m_steal_cycles), TIMER_LINE_DONE);
+ m_line_done_timer->adjust(ANTIC_TIME_FROM_CYCLES(m_steal_cycles));
m_steal_cycles = 0;
m_maincpu->spin_until_trigger(TRIGGER_STEAL);
}
@@ -2082,7 +2078,7 @@ TIMER_CALLBACK_MEMBER( antic_device::scanline_render )
m_steal_cycles += CYCLES_REFRESH;
LOG(" run CPU for %d cycles\n", CYCLES_HSYNC - CYCLES_HSTART - m_steal_cycles);
- timer_set(ANTIC_TIME_FROM_CYCLES(CYCLES_HSYNC - CYCLES_HSTART - m_steal_cycles), TIMER_CYCLE_STEAL);
+ m_cycle_steal_timer->adjust(ANTIC_TIME_FROM_CYCLES(CYCLES_HSYNC - CYCLES_HSTART - m_steal_cycles));
}
@@ -2195,7 +2191,7 @@ void antic_device::scanline_dma(int param)
{
/* remove the DLI bit */
new_cmd &= ~ANTIC_DLI;
- timer_set(ANTIC_TIME_FROM_CYCLES(CYCLES_DLI_NMI), TIMER_ISSUE_DLI);
+ m_issue_dli_timer->adjust(ANTIC_TIME_FROM_CYCLES(CYCLES_DLI_NMI));
}
/* load memory scan bit set ? */
if( new_cmd & ANTIC_LMS )
@@ -2331,9 +2327,9 @@ void antic_device::scanline_dma(int param)
m_r.nmist &= ~DLI_NMI;
if (m_modelines == 1 && (m_cmd & m_w.nmien & DLI_NMI))
- timer_set(ANTIC_TIME_FROM_CYCLES(CYCLES_DLI_NMI), TIMER_ISSUE_DLI);
+ m_issue_dli_timer->adjust(ANTIC_TIME_FROM_CYCLES(CYCLES_DLI_NMI));
- timer_set(ANTIC_TIME_FROM_CYCLES(CYCLES_HSTART), TIMER_LINE_REND);
+ m_scanline_timer->adjust(ANTIC_TIME_FROM_CYCLES(CYCLES_HSTART));
}
/*****************************************************************************
diff --git a/src/mame/video/antic.h b/src/mame/video/antic.h
index 7d3290f5cab..982ad8dfa1d 100644
--- a/src/mame/video/antic.h
+++ b/src/mame/video/antic.h
@@ -48,7 +48,6 @@ public:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
template <typename T> void set_gtia_tag(T &&tag) { m_gtia.set_tag(std::forward<T>(tag)); }
@@ -59,11 +58,6 @@ public:
void generic_interrupt(int button_count);
private:
- static constexpr device_timer_id TIMER_CYCLE_STEAL = 0;
- static constexpr device_timer_id TIMER_ISSUE_DLI = 1;
- static constexpr device_timer_id TIMER_LINE_REND = 2;
- static constexpr device_timer_id TIMER_LINE_DONE = 3;
-
static constexpr unsigned HCHARS = 44; // visible characters per line
static constexpr unsigned VCHARS = (VDATA_END - VDATA_START + 7) / 8;
static constexpr unsigned BUF_OFFS0 = (HWIDTH - HCHARS) / 2;
@@ -140,6 +134,10 @@ private:
inline void mode_gtia2(address_space &space, VIDEO *video, int bytes, int erase);
inline void mode_gtia3(address_space &space, VIDEO *video, int bytes, int erase);
+ emu_timer *m_cycle_steal_timer;
+ emu_timer *m_issue_dli_timer;
+ emu_timer *m_scanline_timer;
+ emu_timer *m_line_done_timer;
uint32_t m_cmd; /* currently executed display list command */
uint32_t m_steal_cycles; /* steal how many cpu cycles for this line ? */
uint32_t m_vscrol_old; /* old vscrol value */
diff --git a/src/mame/video/apexc.cpp b/src/mame/video/apexc.cpp
index 683e55e642b..fbc7561f043 100644
--- a/src/mame/video/apexc.cpp
+++ b/src/mame/video/apexc.cpp
@@ -94,7 +94,7 @@ void apexc_state::draw_string(bitmap_ind16 &bitmap, const char *buf, int x, int
}
-uint32_t apexc_state::screen_update_apexc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+uint32_t apexc_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
bitmap.fill(0, /*machine().visible_area*/panel_window);
draw_string(bitmap, "power", 8, 0, 0);
diff --git a/src/mame/video/astrocde.cpp b/src/mame/video/astrocde.cpp
index fc49e7d4d6f..2d8d5def8ec 100644
--- a/src/mame/video/astrocde.cpp
+++ b/src/mame/video/astrocde.cpp
@@ -175,9 +175,9 @@ void astrocde_state::profpac_palette(palette_device &palette) const
void astrocde_state::video_start()
{
/* allocate timers */
- m_scanline_timer = timer_alloc(TIMER_SCANLINE);
+ m_scanline_timer = timer_alloc(FUNC(astrocde_state::scanline_callback), this);
m_scanline_timer->adjust(m_screen->time_until_pos(1), 1);
- m_intoff_timer = timer_alloc(TIMER_INTERRUPT_OFF);
+ m_intoff_timer = timer_alloc(FUNC(astrocde_state::interrupt_off), this);
/* register for save states */
init_savestate();
@@ -191,9 +191,9 @@ void astrocde_state::video_start()
VIDEO_START_MEMBER(astrocde_state,profpac)
{
/* allocate timers */
- m_scanline_timer = timer_alloc(TIMER_SCANLINE);
+ m_scanline_timer = timer_alloc(FUNC(astrocde_state::scanline_callback), this);
m_scanline_timer->adjust(m_screen->time_until_pos(1), 1);
- m_intoff_timer = timer_alloc(TIMER_INTERRUPT_OFF);
+ m_intoff_timer = timer_alloc(FUNC(astrocde_state::interrupt_off), this);
/* allocate videoram */
m_profpac_videoram = std::make_unique<uint16_t[]>(0x4000 * 4);
@@ -379,19 +379,9 @@ uint32_t astrocde_state::screen_update_profpac(screen_device &screen, bitmap_ind
*
*************************************/
-void astrocde_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(astrocde_state::interrupt_off)
{
- switch (id)
- {
- case TIMER_INTERRUPT_OFF:
- m_maincpu->set_input_line(0, CLEAR_LINE);
- break;
- case TIMER_SCANLINE:
- scanline_callback(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in astrocde_state::device_timer");
- }
+ m_maincpu->set_input_line(0, CLEAR_LINE);
}
WRITE_LINE_MEMBER(astrocde_state::lightpen_trigger_w)
diff --git a/src/mame/video/atarimo.cpp b/src/mame/video/atarimo.cpp
index f0771aeedad..74701174253 100644
--- a/src/mame/video/atarimo.cpp
+++ b/src/mame/video/atarimo.cpp
@@ -326,7 +326,7 @@ void atari_motion_objects_device::device_start()
m_gfxlookup[i] = m_gfxindex;
// allocate a timer to periodically force update
- m_force_update_timer = timer_alloc(TID_FORCE_UPDATE);
+ m_force_update_timer = timer_alloc(FUNC(atari_motion_objects_device::force_update), this);
m_force_update_timer->adjust(screen().time_until_pos(0));
// register for save states
@@ -352,23 +352,17 @@ void atari_motion_objects_device::device_reset()
//-------------------------------------------------
-// device_timer: Handle device-specific timer
-// calbacks
+// force_update - periodically force an update
//-------------------------------------------------
-void atari_motion_objects_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(atari_motion_objects_device::force_update)
{
- switch (id)
- {
- case TID_FORCE_UPDATE:
- if (param > 0)
- screen().update_partial(param - 1);
- param += 64;
- if (param >= screen().visible_area().bottom())
- param = 0;
- timer.adjust(screen().time_until_pos(param), param);
- break;
- }
+ if (param > 0)
+ screen().update_partial(param - 1);
+ param += 64;
+ if (param >= screen().visible_area().bottom())
+ param = 0;
+ m_force_update_timer->adjust(screen().time_until_pos(param), param);
}
diff --git a/src/mame/video/atarimo.h b/src/mame/video/atarimo.h
index d4587b1c157..8c3c38ca44c 100644
--- a/src/mame/video/atarimo.h
+++ b/src/mame/video/atarimo.h
@@ -116,15 +116,10 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-private:
- // timer IDs
- enum
- {
- TID_FORCE_UPDATE
- };
+ TIMER_CALLBACK_MEMBER(force_update);
+private:
// internal helpers
int compute_log(int value);
int round_to_powerof2(int value);
diff --git a/src/mame/video/atarist.cpp b/src/mame/video/atarist.cpp
index 19ecad5aefa..c1c3abc4f53 100644
--- a/src/mame/video/atarist.cpp
+++ b/src/mame/video/atarist.cpp
@@ -625,8 +625,8 @@ void st_video_device::device_resolve_objects()
void st_video_device::device_start()
{
- m_shifter_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(st_video_device::shifter_tick), this));
- m_glue_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(st_video_device::glue_tick), this));
+ m_shifter_timer = timer_alloc(FUNC(st_video_device::shifter_tick), this);
+ m_glue_timer = timer_alloc(FUNC(st_video_device::glue_tick), this);
// m_shifter_timer->adjust(screen().time_until_pos(0), 0, clocks_to_attotime(4)); // 125 ns
m_glue_timer->adjust(screen().time_until_pos(0), 0, clocks_to_attotime(16)); // 500 ns
diff --git a/src/mame/video/atarisy2.cpp b/src/mame/video/atarisy2.cpp
index 05770e32924..d106fcc1e93 100644
--- a/src/mame/video/atarisy2.cpp
+++ b/src/mame/video/atarisy2.cpp
@@ -78,7 +78,7 @@ const atari_motion_objects_config atarisy2_state::s_mob_config =
void atarisy2_state::video_start()
{
// reset the statics
- m_yscroll_reset_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(atarisy2_state::reset_yscroll_callback),this));
+ m_yscroll_reset_timer = timer_alloc(FUNC(atarisy2_state::reset_yscroll_callback), this);
// save states
save_item(NAME(m_playfield_tile_bank));
diff --git a/src/mame/video/atarivad.cpp b/src/mame/video/atarivad.cpp
index f3f4e94315b..15385cfc93b 100644
--- a/src/mame/video/atarivad.cpp
+++ b/src/mame/video/atarivad.cpp
@@ -168,9 +168,9 @@ void atari_vad_device::device_start()
m_scanline_int_cb.resolve_safe();
// allocate timers
- m_scanline_int_timer = timer_alloc(TID_SCANLINE_INT);
- m_tilerow_update_timer = timer_alloc(TID_TILEROW_UPDATE);
- m_eof_timer = timer_alloc(TID_EOF);
+ m_scanline_int_timer = timer_alloc(FUNC(atari_vad_device::scanline_int), this);
+ m_tilerow_update_timer = timer_alloc(FUNC(atari_vad_device::update_tilerow), this);
+ m_eof_timer = timer_alloc(FUNC(atari_vad_device::eof_update), this);
// register for save states
save_item(NAME(m_palette_bank)); // which palette bank is enabled
@@ -208,29 +208,16 @@ void atari_vad_device::device_reset()
//-------------------------------------------------
-// device_timer: Handle device-specific timer
-// calbacks
+// scanline_int - trigger a scanline interrupt
//-------------------------------------------------
-void atari_vad_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(atari_vad_device::scanline_int)
{
- switch (id)
- {
- case TID_SCANLINE_INT:
- m_scanline_int_cb(ASSERT_LINE);
- break;
-
- case TID_TILEROW_UPDATE:
- update_tilerow(timer, param);
- break;
-
- case TID_EOF:
- eof_update(timer);
- break;
- }
+ m_scanline_int_cb(ASSERT_LINE);
}
+
//-------------------------------------------------
// internal_control_write: Handle writes to the
// control registers and EOF updates
@@ -421,8 +408,10 @@ void atari_vad_device::update_parameter(uint16_t newword)
// rowscrolling.
//-------------------------------------------------
-void atari_vad_device::update_tilerow(emu_timer &timer, int scanline)
+TIMER_CALLBACK_MEMBER(atari_vad_device::update_tilerow)
{
+ int scanline = param;
+
// skip if out of bounds, or not enabled
if (scanline <= screen().visible_area().bottom() && (m_control[0x0a] & 0x2000) != 0 && m_alpha_tilemap != nullptr)
{
@@ -446,7 +435,7 @@ void atari_vad_device::update_tilerow(emu_timer &timer, int scanline)
scanline += ((m_control[0x0a] & 0x2000) != 0) ? 1 : 8;
if (scanline >= screen().height())
scanline = 0;
- timer.adjust(screen().time_until_pos(scanline), scanline);
+ m_tilerow_update_timer->adjust(screen().time_until_pos(scanline), scanline);
}
@@ -456,7 +445,7 @@ void atari_vad_device::update_tilerow(emu_timer &timer, int scanline)
// every refresh.
//-------------------------------------------------
-void atari_vad_device::eof_update(emu_timer &timer)
+TIMER_CALLBACK_MEMBER(atari_vad_device::eof_update)
{
// echo all the commands to the video controller
for (int i = 0; i < 0x1c; i++)
@@ -472,7 +461,7 @@ void atari_vad_device::eof_update(emu_timer &timer)
m_playfield_tilemap->set_scrolly(0, m_pf0_yscroll);
if (m_playfield2_tilemap != nullptr)
m_playfield2_tilemap->set_scrolly(0, m_pf1_yscroll);*/
- timer.adjust(screen().time_until_pos(0));
+ m_eof_timer->adjust(screen().time_until_pos(0));
// use this for debugging the video controller values
#if 0
diff --git a/src/mame/video/atarivad.h b/src/mame/video/atarivad.h
index d2027d28b5b..e1f214adda2 100644
--- a/src/mame/video/atarivad.h
+++ b/src/mame/video/atarivad.h
@@ -61,23 +61,15 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
private:
- // timer IDs
- enum
- {
- TID_SCANLINE_INT,
- TID_TILEROW_UPDATE,
- TID_EOF
- };
-
// internal helpers
void internal_control_write(offs_t offset, uint16_t newword);
void update_pf_xscrolls();
void update_parameter(uint16_t newword);
- void update_tilerow(emu_timer &timer, int scanline);
- void eof_update(emu_timer &timer);
+ TIMER_CALLBACK_MEMBER(scanline_int);
+ TIMER_CALLBACK_MEMBER(update_tilerow);
+ TIMER_CALLBACK_MEMBER(eof_update);
// configuration state
devcb_write_line m_scanline_int_cb;
diff --git a/src/mame/video/avgdvg.cpp b/src/mame/video/avgdvg.cpp
index 43e53a13a9e..ba3ddff0d11 100644
--- a/src/mame/video/avgdvg.cpp
+++ b/src/mame/video/avgdvg.cpp
@@ -1303,8 +1303,8 @@ void avgdvg_device_base::device_start()
if (!m_vector->started())
throw device_missing_dependencies();
- m_vg_halt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(avgdvg_device_base::vg_set_halt_callback), this));
- m_vg_run_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(avgdvg_device_base::run_state_machine), this));
+ m_vg_halt_timer = timer_alloc(FUNC(avgdvg_device_base::vg_set_halt_callback), this);
+ m_vg_run_timer = timer_alloc(FUNC(avgdvg_device_base::run_state_machine), this);
m_flip_x = m_flip_y = false;
diff --git a/src/mame/video/blstroid.cpp b/src/mame/video/blstroid.cpp
index 27ae443cdef..7f34a71dd7b 100644
--- a/src/mame/video/blstroid.cpp
+++ b/src/mame/video/blstroid.cpp
@@ -70,8 +70,8 @@ const atari_motion_objects_config blstroid_state::s_mob_config =
void blstroid_state::video_start()
{
- m_irq_off_timer = timer_alloc(TIMER_IRQ_OFF);
- m_irq_on_timer = timer_alloc(TIMER_IRQ_ON);
+ m_irq_off_timer = timer_alloc(FUNC(blstroid_state::irq_off), this);
+ m_irq_on_timer = timer_alloc(FUNC(blstroid_state::irq_on), this);
m_scanline_int_state = false;
@@ -86,22 +86,14 @@ void blstroid_state::video_start()
*
*************************************/
-void blstroid_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(blstroid_state::irq_off)
{
- switch (id)
- {
- case TIMER_IRQ_OFF:
- /* clear the interrupt */
- m_maincpu->set_input_line(M68K_IRQ_1, CLEAR_LINE);
- break;
- case TIMER_IRQ_ON:
- /* generate the interrupt */
- m_maincpu->set_input_line(M68K_IRQ_1, ASSERT_LINE);
- break;
- default:
- atarigen_state::device_timer(timer, id, param);
- break;
- }
+ m_maincpu->set_input_line(M68K_IRQ_1, CLEAR_LINE);
+}
+
+TIMER_CALLBACK_MEMBER(blstroid_state::irq_on)
+{
+ m_maincpu->set_input_line(M68K_IRQ_1, ASSERT_LINE);
}
diff --git a/src/mame/video/changela.cpp b/src/mame/video/changela.cpp
index 5c2f57e3f1f..5adc0a90218 100644
--- a/src/mame/video/changela.cpp
+++ b/src/mame/video/changela.cpp
@@ -29,7 +29,7 @@ void changela_state::video_start()
m_screen->register_screen_bitmap(m_tree0_bitmap);
m_screen->register_screen_bitmap(m_tree1_bitmap);
- m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(changela_state::changela_scanline_callback),this));
+ m_scanline_timer = timer_alloc(FUNC(changela_state::changela_scanline_callback), this);
m_scanline_timer->adjust(m_screen->time_until_pos(30), 30);
save_pointer(NAME(m_memory_devices), 4 * 0x800);
diff --git a/src/mame/video/dcheese.cpp b/src/mame/video/dcheese.cpp
index 71219b87109..d61e8dec27d 100644
--- a/src/mame/video/dcheese.cpp
+++ b/src/mame/video/dcheese.cpp
@@ -64,20 +64,10 @@ void dcheese_state::update_scanline_irq()
}
-void dcheese_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(dcheese_state::blitter_done)
{
- switch (id)
- {
- case TIMER_BLITTER_SCANLINE:
- signal_irq(3);
- update_scanline_irq();
- break;
- case TIMER_SIGNAL_IRQ:
- signal_irq(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in dcheese_state::device_timer");
- }
+ signal_irq(3);
+ update_scanline_irq();
}
@@ -96,8 +86,8 @@ void dcheese_state::video_start()
m_dstbitmap = std::make_unique<bitmap_ind16>(DSTBITMAP_WIDTH, DSTBITMAP_HEIGHT);
// create timers
- m_blitter_timer = timer_alloc(TIMER_BLITTER_SCANLINE);
- m_signal_irq_timer = timer_alloc(TIMER_SIGNAL_IRQ);
+ m_blitter_timer = timer_alloc(FUNC(dcheese_state::blitter_done), this);
+ m_signal_irq_timer = timer_alloc(FUNC(dcheese_state::signal_irq), this);
// register for saving
save_item(NAME(m_blitter_color));
diff --git a/src/mame/video/dday.cpp b/src/mame/video/dday.cpp
index 3643fb5e793..33e4912edf1 100644
--- a/src/mame/video/dday.cpp
+++ b/src/mame/video/dday.cpp
@@ -214,7 +214,7 @@ void dday_state::video_start()
m_fg_tilemap->set_transparent_pen(0);
m_text_tilemap->set_transparent_pen(0);
- m_countdown_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(dday_state::countdown_timer_callback), this));
+ m_countdown_timer = timer_alloc(FUNC(dday_state::countdown_timer_callback), this);
start_countdown_timer();
}
diff --git a/src/mame/video/dkong.cpp b/src/mame/video/dkong.cpp
index ae2991b65ad..252defdcd51 100644
--- a/src/mame/video/dkong.cpp
+++ b/src/mame/video/dkong.cpp
@@ -935,7 +935,7 @@ VIDEO_START_MEMBER(dkong_state,dkong)
{
VIDEO_START_CALL_MEMBER(dkong_base);
- m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(dkong_state::scanline_callback),this));
+ m_scanline_timer = timer_alloc(FUNC(dkong_state::scanline_callback), this);
m_scanline_timer->adjust(m_screen->time_until_pos(0));
switch (m_hardware_type)
diff --git a/src/mame/video/electron.cpp b/src/mame/video/electron.cpp
index 549ab4dc3ff..45ed01f42ee 100644
--- a/src/mame/video/electron.cpp
+++ b/src/mame/video/electron.cpp
@@ -64,7 +64,7 @@ void electron_state::video_start()
m_map4[i] = ( ( i & 0x10 ) >> 3 ) | ( i & 0x01 );
m_map16[i] = ( ( i & 0x40 ) >> 3 ) | ( ( i & 0x10 ) >> 2 ) | ( ( i & 0x04 ) >> 1 ) | ( i & 0x01 );
}
- m_scanline_timer = timer_alloc(TIMER_SCANLINE_INTERRUPT);
+ m_scanline_timer = timer_alloc(FUNC(electron_state::electron_scanline_interrupt), this);
m_scanline_timer->adjust( m_screen->time_until_pos(0), 0, m_screen->scan_period() );
}
diff --git a/src/mame/video/esripsys.cpp b/src/mame/video/esripsys.cpp
index fa83a01c997..65091fff251 100644
--- a/src/mame/video/esripsys.cpp
+++ b/src/mame/video/esripsys.cpp
@@ -71,8 +71,8 @@ void esripsys_state::video_start()
line_buffer[1].priority_buf = std::make_unique<uint8_t[]>(512);
/* Create and initialise the HBLANK timers */
- m_hblank_start_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(esripsys_state::hblank_start_callback),this));
- m_hblank_end_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(esripsys_state::hblank_end_callback),this));
+ m_hblank_start_timer = timer_alloc(FUNC(esripsys_state::hblank_start_callback), this);
+ m_hblank_end_timer = timer_alloc(FUNC(esripsys_state::hblank_end_callback), this);
m_hblank_start_timer->adjust(m_screen->time_until_pos(0, ESRIPSYS_HBLANK_START));
/* Create the sprite scaling table */
diff --git a/src/mame/video/exidy440.cpp b/src/mame/video/exidy440.cpp
index 2106e4ac16e..3c4aab7e827 100644
--- a/src/mame/video/exidy440.cpp
+++ b/src/mame/video/exidy440.cpp
@@ -52,8 +52,8 @@ void exidy440_state::video_start()
m_local_paletteram = std::make_unique<uint8_t[]>(512 * 2);
memset(m_local_paletteram.get(), 0, 512 * 2);
- m_beam_firq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(exidy440_state::beam_firq_callback), this));
- m_collide_firq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(exidy440_state::collide_firq_callback), this));
+ m_beam_firq_timer = timer_alloc(FUNC(exidy440_state::beam_firq_callback), this);
+ m_collide_firq_timer = timer_alloc(FUNC(exidy440_state::collide_firq_callback), this);
}
diff --git a/src/mame/video/fmtowns.cpp b/src/mame/video/fmtowns.cpp
index ca059576275..268ea13dd6a 100644
--- a/src/mame/video/fmtowns.cpp
+++ b/src/mame/video/fmtowns.cpp
@@ -977,7 +977,7 @@ void towns_state::render_sprite_16(uint32_t poffset, uint16_t x, uint16_t y, boo
}
}
-void towns_state::draw_sprites()
+TIMER_CALLBACK_MEMBER(towns_state::draw_sprites)
{
uint16_t sprite_limit = (m_video.towns_sprite_reg[0] | (m_video.towns_sprite_reg[1] << 8)) & 0x3ff;
uint16_t xoff = (m_video.towns_sprite_reg[2] | (m_video.towns_sprite_reg[3] << 8)) & 0x1ff;
@@ -1483,7 +1483,7 @@ INTERRUPT_GEN_MEMBER(towns_state::towns_vsync_irq)
m_pic_slave->ir3_w(1); // IRQ11 = VSync
if(IRQ_LOG) logerror("PIC: IRQ11 (VSync) set high\n");
m_video.towns_vblank_flag = 1;
- machine().scheduler().timer_set(m_screen->time_until_vblank_end(), timer_expired_delegate(FUNC(towns_state::towns_vblank_end),this));
+ m_video.vblank_end_timer->adjust(m_screen->time_until_vblank_end());
if(m_video.towns_tvram_enable)
draw_text_layer();
if((m_video.towns_sprite_reg[1] & 0x80) && !m_video.towns_sprite_flag)
@@ -1506,7 +1506,8 @@ void towns_state::video_start()
{
m_video.towns_vram_wplane = 0x00;
m_video.towns_sprite_page = 0;
- m_video.sprite_timer = timer_alloc(TIMER_SPRITES);
+ m_video.sprite_timer = timer_alloc(FUNC(towns_state::draw_sprites), this);
+ m_video.vblank_end_timer = timer_alloc(FUNC(towns_state::towns_vblank_end), this);
}
uint32_t towns_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
diff --git a/src/mame/video/fromance.cpp b/src/mame/video/fromance.cpp
index 902f2c4cf1a..672138bb38c 100644
--- a/src/mame/video/fromance.cpp
+++ b/src/mame/video/fromance.cpp
@@ -68,7 +68,7 @@ void fromance_state::init_common( )
m_fg_tilemap->set_transparent_pen(15);
/* reset the timer */
- m_crtc_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(fromance_state::crtc_interrupt_gen),this));
+ m_crtc_timer = timer_alloc(FUNC(fromance_state::crtc_interrupt_gen), this);
/* state save */
save_item(NAME(m_selected_videoram));
diff --git a/src/mame/video/fuukifg3.cpp b/src/mame/video/fuukifg3.cpp
index 8ecad90d570..7709e19a815 100644
--- a/src/mame/video/fuukifg3.cpp
+++ b/src/mame/video/fuukifg3.cpp
@@ -99,7 +99,7 @@ u16 fuuki32_state::sprram_r(offs_t offset)
return m_spriteram[offset];
}
-void fuuki32_state::fuuki32_tile_cb(u32 &code)
+void fuuki32_state::tile_cb(u32 &code)
{
const u32 bank = (code & 0xc000) >> 14;
@@ -108,7 +108,7 @@ void fuuki32_state::fuuki32_tile_cb(u32 &code)
code += bank_lookedup * 0x4000;
}
-void fuuki32_state::fuuki32_colpri_cb(u32 &colour, u32 &pri_mask)
+void fuuki32_state::colpri_cb(u32 &colour, u32 &pri_mask)
{
const u8 priority = (colour >> 6) & 3;
switch (priority)
diff --git a/src/mame/video/galaxold.cpp b/src/mame/video/galaxold.cpp
index 2f198f8319e..b2c43177759 100644
--- a/src/mame/video/galaxold.cpp
+++ b/src/mame/video/galaxold.cpp
@@ -1231,8 +1231,8 @@ void galaxold_state::galaxold_init_stars(int colors_offset)
m_stars_on = 0;
m_stars_blink_state = 0;
- m_stars_blink_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(galaxold_state::stars_blink_callback),this));
- m_stars_scroll_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(galaxold_state::stars_scroll_callback),this));
+ m_stars_blink_timer = timer_alloc(FUNC(galaxold_state::stars_blink_callback), this);
+ m_stars_scroll_timer = timer_alloc(FUNC(galaxold_state::stars_scroll_callback), this);
m_timer_adjusted = 0;
m_stars_colors_start = colors_offset;
diff --git a/src/mame/video/galaxy.cpp b/src/mame/video/galaxy.cpp
index ab6428a993b..ba18fc8b5ac 100644
--- a/src/mame/video/galaxy.cpp
+++ b/src/mame/video/galaxy.cpp
@@ -106,7 +106,7 @@ void galaxy_state::machine_start()
{
m_gal_cnt = 0;
- m_gal_video_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(galaxy_state::gal_video),this));
+ m_gal_video_timer = timer_alloc(FUNC(galaxy_state::gal_video), this);
m_gal_video_timer->adjust(attotime::zero, 0, attotime::never);
m_screen->register_screen_bitmap(m_bitmap);
diff --git a/src/mame/video/gamecom.cpp b/src/mame/video/gamecom.cpp
index 792cf197acc..54287e3d406 100644
--- a/src/mame/video/gamecom.cpp
+++ b/src/mame/video/gamecom.cpp
@@ -68,7 +68,7 @@ TIMER_CALLBACK_MEMBER(gamecom_state::gamecom_scanline)
void gamecom_state::video_start()
{
- m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gamecom_state::gamecom_scanline),this));
+ m_scanline_timer = timer_alloc(FUNC(gamecom_state::gamecom_scanline), this);
m_scanline_timer->adjust(m_screen->time_until_pos(0), 0, m_screen->scan_period());
m_screen->register_screen_bitmap(m_bitmap);
diff --git a/src/mame/video/gameplan.cpp b/src/mame/video/gameplan.cpp
index 815c0428403..e5174674689 100644
--- a/src/mame/video/gameplan.cpp
+++ b/src/mame/video/gameplan.cpp
@@ -33,29 +33,6 @@ driver by Chris Moore
/*************************************
*
- * Timer handling
- *
- *************************************/
-
-void gameplan_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_CLEAR_SCREEN_DONE:
- clear_screen_done_callback(param);
- break;
- case TIMER_VIA_IRQ_DELAYED:
- via_irq_delayed(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in gameplan_state::device_timer");
- }
-}
-
-
-
-/*************************************
- *
* Palette handling
*
*************************************/
@@ -220,7 +197,7 @@ WRITE_LINE_MEMBER(gameplan_state::video_command_trigger_w)
/* set a timer for an arbitrarily short period.
The real time it takes to clear to screen is not
important to the software */
- synchronize(TIMER_CLEAR_SCREEN_DONE);
+ m_clear_done_timer->adjust(attotime::zero);
break;
}
@@ -228,21 +205,6 @@ WRITE_LINE_MEMBER(gameplan_state::video_command_trigger_w)
}
-TIMER_CALLBACK_MEMBER(gameplan_state::via_irq_delayed)
-{
- m_maincpu->set_input_line(0, param);
-}
-
-
-WRITE_LINE_MEMBER(gameplan_state::via_irq)
-{
- /* Kaos sits in a tight loop polling the VIA irq flags register, but that register is
- cleared by the irq handler. Therefore, I wait a bit before triggering the irq to
- leave time for the program to see the flag change. */
- timer_set(attotime::from_usec(50), TIMER_VIA_IRQ_DELAYED, state);
-}
-
-
/*************************************
*
* Start
@@ -254,6 +216,8 @@ void gameplan_state::video_start()
m_videoram_size = (HBSTART - HBEND) * (VBSTART - VBEND);
m_videoram = std::make_unique<uint8_t[]>(m_videoram_size);
+ m_clear_done_timer = timer_alloc(FUNC(gameplan_state::clear_screen_done_callback), this);
+
/* register for save states */
save_pointer(NAME(m_videoram), m_videoram_size);
}
diff --git a/src/mame/video/gic.cpp b/src/mame/video/gic.cpp
index 951de465997..287c55cb9e2 100644
--- a/src/mame/video/gic.cpp
+++ b/src/mame/video/gic.cpp
@@ -114,7 +114,7 @@ void gic_device::device_start()
// Let the screen create our temporary bitmap with the screen's dimensions
screen().register_screen_bitmap(m_bitmap);
- m_vblank_timer = timer_alloc(TIMER_VBLANK);
+ m_vblank_timer = timer_alloc(FUNC(gic_device::vblank_tick), this);
m_vblank_timer->adjust( screen().time_until_pos(1, END_ACTIVE_SCAN + 18 ), 0, screen().scan_period() );
// allocate the audio stream
@@ -239,15 +239,10 @@ uint32_t gic_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap,
/* AUDIO SECTION */
-void gic_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(gic_device::vblank_tick)
{
- switch ( id )
- {
- case TIMER_VBLANK:
- //flag the audio to reset
- m_audioreset = 1;//phase need to reset! on next clock/228
- break;
- }
+ //flag the audio to reset
+ m_audioreset = 1;//phase need to reset! on next clock/228
}
#define GIC_AUDIO_BYTE 0x96
diff --git a/src/mame/video/gic.h b/src/mame/video/gic.h
index 498e64dd922..5e939b0a2b0 100644
--- a/src/mame/video/gic.h
+++ b/src/mame/video/gic.h
@@ -68,7 +68,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// optional information overrides
virtual const tiny_rom_entry *device_rom_region() const override;
@@ -77,7 +76,7 @@ protected:
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
/* timers */
- static const device_timer_id TIMER_VBLANK = 0;
+ TIMER_CALLBACK_MEMBER(vblank_tick);
void draw_char_left (int x, int y, uint8_t code, bitmap_ind16 &bitmap);
void draw_char_right(int x, int y, uint8_t code, bitmap_ind16 &bitmap,int bg_col);
diff --git a/src/mame/video/gime.cpp b/src/mame/video/gime.cpp
index db038c8ea01..b444be4045d 100644
--- a/src/mame/video/gime.cpp
+++ b/src/mame/video/gime.cpp
@@ -159,7 +159,7 @@ gime_device::gime_device(const machine_config &mconfig, device_type type, const
// device_start - device-specific startup
//-------------------------------------------------
-void gime_device::device_start(void)
+void gime_device::device_start()
{
if (!m_ram->started())
throw device_missing_dependencies();
@@ -180,7 +180,7 @@ void gime_device::device_start(void)
m_firq = 0x00;
// allocate timer
- m_gime_clock_timer = timer_alloc(TIMER_GIME_CLOCK);
+ m_gime_clock_timer = timer_alloc(FUNC(gime_device::timer_elapsed), this);
// setup banks
assert(std::size(m_read_banks) == std::size(m_write_banks));
@@ -228,7 +228,7 @@ void gime_device::device_start(void)
// update_rgb_palette
//-------------------------------------------------
-void gime_device::update_rgb_palette(void)
+void gime_device::update_rgb_palette()
{
for (int color = 0; color < 64; color++)
{
@@ -242,7 +242,7 @@ void gime_device::update_rgb_palette(void)
// update_composite_palette
//-------------------------------------------------
-void gime_device::update_composite_palette(void)
+void gime_device::update_composite_palette()
{
for (int color = 0; color < 64; color++)
{
@@ -304,7 +304,7 @@ inline gime_device::pixel_t gime_device::get_rgb_color(int color)
// device_reset - device-specific reset
//-------------------------------------------------
-void gime_device::device_reset(void)
+void gime_device::device_reset()
{
/* Tepolt verifies that the GIME registers are all cleared on initialization */
memset(m_gime_registers, 0, sizeof(m_gime_registers));
@@ -341,26 +341,6 @@ void gime_device::device_reset(void)
//-------------------------------------------------
-// device_timer - handle timer callbacks
-//-------------------------------------------------
-
-void gime_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch(id)
- {
- case TIMER_GIME_CLOCK:
- timer_elapsed();
- break;
-
- default:
- super::device_timer(timer, id, param);
- break;
- }
-}
-
-
-
-//-------------------------------------------------
// device_pre_save - device-specific pre save
//-------------------------------------------------
@@ -426,7 +406,7 @@ ioport_constructor gime_device::device_input_ports() const
// timer_type
//-------------------------------------------------
-gime_device::timer_type_t gime_device::timer_type(void)
+gime_device::timer_type_t gime_device::timer_type()
{
// wraps the GIME register access and returns an enumeration
return (m_gime_registers[0x01] & 0x20) ? GIME_TIMER_279NSEC : GIME_TIMER_63USEC;
@@ -438,7 +418,7 @@ gime_device::timer_type_t gime_device::timer_type(void)
// timer_type_string
//-------------------------------------------------
-const char *gime_device::timer_type_string(void)
+const char *gime_device::timer_type_string()
{
const char *result;
switch(timer_type())
@@ -461,7 +441,7 @@ const char *gime_device::timer_type_string(void)
// timer_elapsed
//-------------------------------------------------
-void gime_device::timer_elapsed(void)
+TIMER_CALLBACK_MEMBER(gime_device::timer_elapsed)
{
/* reset the timer; give her another run! */
reset_timer();
@@ -480,7 +460,7 @@ void gime_device::timer_elapsed(void)
// reset_timer
//-------------------------------------------------
-void gime_device::reset_timer(void)
+void gime_device::reset_timer()
{
/* value is from 0-4095 */
m_timer_value = ((m_gime_registers[0x04] & 0x0F) << 8) | m_gime_registers[0x05];
@@ -522,7 +502,7 @@ void gime_device::reset_timer(void)
// update_memory
//-------------------------------------------------
-inline void gime_device::update_memory(void)
+inline void gime_device::update_memory()
{
for (int bank = 0; bank <= 8; bank++)
{
@@ -662,7 +642,7 @@ void gime_device::pia_write(offs_t offset, uint8_t data)
// update_cart_rom
//-------------------------------------------------
-void gime_device::update_cart_rom(void)
+void gime_device::update_cart_rom()
{
m_cart_rom = m_cart_device->get_cart_base();
m_cart_size = m_cart_device->get_cart_size();
@@ -775,7 +755,7 @@ inline uint8_t gime_device::read_palette_register(offs_t offset)
// read_floating_bus
//-------------------------------------------------
-inline uint8_t gime_device::read_floating_bus(void)
+inline uint8_t gime_device::read_floating_bus()
{
return m_read_floating_bus(0);
}
@@ -1225,7 +1205,7 @@ void gime_device::change_gime_firq(uint8_t data)
// John Kowalski confirms this behavior
//-------------------------------------------------
-inline offs_t gime_device::get_video_base(void)
+inline offs_t gime_device::get_video_base()
{
offs_t result;
uint8_t ff9d_mask, ff9e_mask;
@@ -1257,10 +1237,10 @@ inline offs_t gime_device::get_video_base(void)
// new_frame
//-------------------------------------------------
-void gime_device::new_frame(void)
+TIMER_CALLBACK_MEMBER(gime_device::new_frame)
{
/* call inherited function */
- super::new_frame();
+ super::new_frame(param);
/* latch in legacy video value */
bool legacy_video_changed = update_value(&m_legacy_video, m_gime_registers[0] & 0x80 ? true : false);
@@ -1280,9 +1260,9 @@ void gime_device::new_frame(void)
// horizontal_sync_changed
//-------------------------------------------------
-void gime_device::horizontal_sync_changed(bool line)
+TIMER_CALLBACK_MEMBER(gime_device::horizontal_sync_changed)
{
- set_interrupt_value(INTERRUPT_HBORD, line);
+ set_interrupt_value(INTERRUPT_HBORD, (bool)param);
}
@@ -1291,7 +1271,7 @@ void gime_device::horizontal_sync_changed(bool line)
// enter_bottom_border
//-------------------------------------------------
-void gime_device::enter_bottom_border(void)
+void gime_device::enter_bottom_border()
{
set_interrupt_value(INTERRUPT_VBORD, true);
set_interrupt_value(INTERRUPT_VBORD, false);
@@ -1354,7 +1334,7 @@ void gime_device::record_border_scanline(uint16_t physical_scanline)
// get_lines_per_row
//-------------------------------------------------
-inline uint16_t gime_device::get_lines_per_row(void)
+inline uint16_t gime_device::get_lines_per_row()
{
uint16_t lines_per_row;
if (m_legacy_video)
@@ -1652,7 +1632,7 @@ void gime_device::record_partial_body_scanline(uint16_t physical_scanline, uint1
// update_geometry
//-------------------------------------------------
-void gime_device::update_geometry(void)
+void gime_device::update_geometry()
{
uint16_t top_border_scanlines, body_scanlines;
diff --git a/src/mame/video/gime.h b/src/mame/video/gime.h
index c09aa5b6e49..bd77fb68738 100644
--- a/src/mame/video/gime.h
+++ b/src/mame/video/gime.h
@@ -37,13 +37,13 @@ public:
void write(offs_t offset, uint8_t data);
// used to turn on/off reading/writing to $FF40-$FF5F
- bool spare_chip_select_enabled(void) { return m_gime_registers[0] & 0x04 ? true : false; }
+ bool spare_chip_select_enabled() { return m_gime_registers[0] & 0x04 ? true : false; }
// the GIME seems to intercept writes to $FF22 (not precisely sure how)
void pia_write(offs_t offset, uint8_t data);
// updates the cart ROM
- void update_cart_rom(void);
+ void update_cart_rom();
/* updates the screen -- this will call begin_update(),
followed by update_row() repeatedly and after all row
@@ -64,17 +64,16 @@ protected:
gime_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, const uint8_t *fontdata);
// device-level overrides
- virtual void device_start(void) override;
- virtual void device_reset(void) override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
- virtual void device_pre_save(void) override;
- virtual void device_post_load(void) override;
+ virtual void device_start() override;
+ virtual void device_reset() override;
+ virtual void device_pre_save() override;
+ virtual void device_post_load() override;
virtual ioport_constructor device_input_ports() const override;
// other overrides
- virtual void new_frame(void) override;
- virtual void horizontal_sync_changed(bool line) override;
- virtual void enter_bottom_border(void) override;
+ virtual TIMER_CALLBACK_MEMBER(new_frame) override;
+ virtual TIMER_CALLBACK_MEMBER(horizontal_sync_changed) override;
+ virtual void enter_bottom_border() override;
virtual void record_border_scanline(uint16_t physical_scanline) override;
virtual void record_body_scanline(uint16_t physical_scanline, uint16_t logical_scanline) override;
virtual void record_partial_body_scanline(uint16_t physical_scanline, uint16_t logical_scanline, int32_t start_clock, int32_t end_clock) override;
@@ -126,9 +125,6 @@ protected:
GIME_TIMER_279NSEC
};
- // timer constants
- static const device_timer_id TIMER_GIME_CLOCK = 4;
-
// statics
static const uint8_t hires_font[128][12];
@@ -177,25 +173,18 @@ protected:
pixel_t m_rgb_palette[64];
uint8_t m_dummy_bank[0x2000];
- // timer constants
- static const device_timer_id TIMER_FRAME = 0;
- static const device_timer_id TIMER_HSYNC_OFF = 1;
- static const device_timer_id TIMER_HSYNC_ON = 2;
- static const device_timer_id TIMER_FSYNC_OFF = 3;
- static const device_timer_id TIMER_FSYNC_ON = 4;
-
// read/write
uint8_t read_gime_register(offs_t offset);
uint8_t read_mmu_register(offs_t offset);
uint8_t read_palette_register(offs_t offset);
- uint8_t read_floating_bus(void);
+ uint8_t read_floating_bus();
void write_gime_register(offs_t offset, uint8_t data);
void write_mmu_register(offs_t offset, uint8_t data);
void write_palette_register(offs_t offset, uint8_t data);
void write_sam_register(offs_t offset);
// memory
- void update_memory(void);
+ void update_memory();
void update_memory(int bank);
uint8_t *memory_pointer(uint32_t address);
@@ -223,21 +212,21 @@ protected:
}
// timer
- timer_type_t timer_type(void);
- const char *timer_type_string(void);
- void reset_timer(void);
- void timer_elapsed(void);
+ timer_type_t timer_type();
+ const char *timer_type_string();
+ void reset_timer();
+ TIMER_CALLBACK_MEMBER(timer_elapsed);
// video
bool update_screen(bitmap_rgb32 &bitmap, const rectangle &cliprect, const pixel_t *palette);
- void update_geometry(void);
- void update_rgb_palette(void);
- void update_composite_palette(void);
+ void update_geometry();
+ void update_rgb_palette();
+ void update_composite_palette();
void update_border(uint16_t physical_scanline);
pixel_t get_composite_color(int color);
pixel_t get_rgb_color(int color);
- offs_t get_video_base(void);
- uint16_t get_lines_per_row(void);
+ offs_t get_video_base();
+ uint16_t get_lines_per_row();
uint32_t get_data_mc6847(uint32_t video_position, uint8_t *data, uint8_t *mode);
uint32_t get_data_without_attributes(uint32_t video_position, uint8_t *data, uint8_t *mode);
uint32_t get_data_with_attributes(uint32_t video_position, uint8_t *data, uint8_t *mode);
diff --git a/src/mame/video/gp9001.cpp b/src/mame/video/gp9001.cpp
index b2ba965f086..dabe10276b9 100644
--- a/src/mame/video/gp9001.cpp
+++ b/src/mame/video/gp9001.cpp
@@ -280,7 +280,7 @@ void gp9001vdp_device::device_start()
m_gp9001_cb.resolve();
m_vint_out_cb.resolve();
- m_raise_irq_timer = timer_alloc(TIMER_RAISE_IRQ);
+ m_raise_irq_timer = timer_alloc(FUNC(gp9001vdp_device::raise_irq), this);
save_item(NAME(m_scroll_reg));
save_item(NAME(m_voffs));
@@ -890,14 +890,7 @@ void gp9001vdp_device::screen_eof(void)
}
-void gp9001vdp_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(gp9001vdp_device::raise_irq)
{
- switch (id)
- {
- case TIMER_RAISE_IRQ:
- m_vint_out_cb(1);
- break;
- default:
- throw emu_fatalerror("Unknown id in gp9001vdp_device::device_timer");
- }
+ m_vint_out_cb(1);
}
diff --git a/src/mame/video/gp9001.h b/src/mame/video/gp9001.h
index c404e455b2c..157dfd3cc6f 100644
--- a/src/mame/video/gp9001.h
+++ b/src/mame/video/gp9001.h
@@ -14,11 +14,6 @@ class gp9001vdp_device : public device_t,
public device_video_interface,
public device_memory_interface
{
- enum
- {
- TIMER_RAISE_IRQ
- };
-
public:
typedef device_delegate<void (u8 layer, u32 &code)> gp9001_cb_delegate;
@@ -66,10 +61,11 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual space_config_vector memory_space_config() const override;
+ TIMER_CALLBACK_MEMBER(raise_irq);
+
address_space_config m_space_config;
template<int Layer> TILE_GET_INFO_MEMBER(get_tile_info);
diff --git a/src/mame/video/hyhoo.cpp b/src/mame/video/hyhoo.cpp
index 5c31004fa71..25cdb37dc52 100644
--- a/src/mame/video/hyhoo.cpp
+++ b/src/mame/video/hyhoo.cpp
@@ -53,16 +53,9 @@ void hyhoo_state::hyhoo_romsel_w(uint8_t data)
}
}
-void hyhoo_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(hyhoo_state::clear_busy_flag)
{
- switch (id)
- {
- case TIMER_BLITTER:
- m_nb1413m3->busyflag_w(1);
- break;
- default:
- throw emu_fatalerror("Unknown id in hyhoo_state::device_timer");
- }
+ m_nb1413m3->busyflag_w(1);
}
void hyhoo_state::hyhoo_gfxdraw()
@@ -221,7 +214,7 @@ void hyhoo_state::hyhoo_gfxdraw()
void hyhoo_state::video_start()
{
- m_blitter_timer = timer_alloc(TIMER_BLITTER);
+ m_blitter_timer = timer_alloc(FUNC(hyhoo_state::clear_busy_flag), this);
m_screen->register_screen_bitmap(m_tmpbitmap);
save_item(NAME(m_blitter_destx));
diff --git a/src/mame/video/itech32.cpp b/src/mame/video/itech32.cpp
index f6554ee483a..d730da5a5ca 100644
--- a/src/mame/video/itech32.cpp
+++ b/src/mame/video/itech32.cpp
@@ -194,7 +194,7 @@ void itech32_state::video_start()
/* reset statics */
std::fill_n(&m_video[0], m_video.bytes() >> 1, 0);
- m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(itech32_state::scanline_interrupt),this));
+ m_scanline_timer = timer_alloc(FUNC(itech32_state::scanline_interrupt), this);
m_enable_latch[0] = 1;
m_enable_latch[1] = (m_planes > 1) ? 1 : 0;
@@ -211,7 +211,7 @@ void itech32_state::video_start()
void shoottv_state::video_start()
{
itech32_state::video_start();
- m_gun_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(shoottv_state::gun_interrupt),this));
+ m_gun_timer = timer_alloc(FUNC(shoottv_state::gun_interrupt), this);
m_gun_timer->adjust(m_screen->time_until_pos(0));
}
diff --git a/src/mame/video/itech8.cpp b/src/mame/video/itech8.cpp
index f0b27c88e3c..6be782028ab 100644
--- a/src/mame/video/itech8.cpp
+++ b/src/mame/video/itech8.cpp
@@ -541,20 +541,7 @@ void grmatch_state::xscroll_w(uint8_t data)
}
-void grmatch_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_PALETTE:
- palette_update();
- break;
- default:
- itech8_state::device_timer(timer, id, param);
- break;
- }
-}
-
-void grmatch_state::palette_update()
+TIMER_CALLBACK_MEMBER(grmatch_state::palette_update)
{
/* if the high bit is set, we are supposed to latch the palette values */
if (m_palcontrol & 0x80)
diff --git a/src/mame/video/jag_blitter.cpp b/src/mame/video/jag_blitter.cpp
index bda83ece51d..64343259ba4 100644
--- a/src/mame/video/jag_blitter.cpp
+++ b/src/mame/video/jag_blitter.cpp
@@ -68,7 +68,7 @@ void jag_blitter_device::device_start()
save_item(NAME(m_a1.xstep));
save_item(NAME(m_a1.ystep));
- m_command_timer = timer_alloc(0);
+ m_command_timer = timer_alloc(FUNC(jag_blitter_device::command_run), this);
}
@@ -131,7 +131,7 @@ inline void jag_blitter_device::command_start()
m_command_timer->adjust(attotime::from_ticks(m_count_lines * m_count_pixels, this->clock()));
}
-inline void jag_blitter_device::command_run()
+TIMER_CALLBACK_MEMBER(jag_blitter_device::command_run)
{
// TODO: need to single step, have different timings between pixel and phrase modes,
// calculate collision detection, delay a bit the kickoff due of bus chain requests,
@@ -153,11 +153,6 @@ inline void jag_blitter_device::command_done()
// ...
}
-void jag_blitter_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- command_run();
-}
-
//**************************************************************************
// READ/WRITE HANDLERS
//**************************************************************************
diff --git a/src/mame/video/jag_blitter.h b/src/mame/video/jag_blitter.h
index ccf391cbb6b..10d062a6b3b 100644
--- a/src/mame/video/jag_blitter.h
+++ b/src/mame/video/jag_blitter.h
@@ -41,7 +41,6 @@ protected:
//virtual void device_validity_check(validity_checker &valid) const override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual space_config_vector memory_space_config() const override;
const address_space_config m_space_config;
@@ -61,8 +60,8 @@ private:
// timer setups
emu_timer *m_command_timer = nullptr;
+ TIMER_CALLBACK_MEMBER(command_run);
inline void command_start();
- inline void command_run();
inline void command_done();
// functional switches
diff --git a/src/mame/video/jaguar.cpp b/src/mame/video/jaguar.cpp
index 9f47f313116..0aa82800e52 100644
--- a/src/mame/video/jaguar.cpp
+++ b/src/mame/video/jaguar.cpp
@@ -569,7 +569,7 @@ void jaguar_state::blitter_w(offs_t offset, uint32_t data, uint32_t mem_mask)
m_blitter_status = 0;
int inner_count = m_blitter_regs[B_COUNT] & 0xffff;
int outer_count = m_blitter_regs[B_COUNT] >> 16;
- timer_set(attotime::from_ticks(inner_count * outer_count, m_gpu->clock()), TID_BLITTER_DONE);
+ m_blitter_done_timer->adjust(attotime::from_ticks(inner_count * outer_count, m_gpu->clock()));
blitter_run();
}
@@ -639,7 +639,7 @@ void jaguar_state::tom_regs_w(offs_t offset, uint16_t data, uint16_t mem_mask)
if (m_gpu_regs[PIT0] && m_gpu_regs[PIT0] != 0xffff) //FIXME: avoid too much small timers for now
{
sample_period = attotime::from_ticks((1+m_gpu_regs[PIT0]) * (1+m_gpu_regs[PIT1]), m_gpu->clock()/2);
- timer_set(sample_period, TID_PIT);
+ m_pit_timer->adjust(sample_period);
}
break;
@@ -732,41 +732,30 @@ uint32_t jaguar_state::cojag_gun_input_r(offs_t offset)
*
*************************************/
-void jaguar_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(jaguar_state::blitter_done)
{
- switch (id)
- {
- case TID_SCANLINE:
- scanline_update(param);
- break;
-
- case TID_BLITTER_DONE:
- m_blitter_status = 1;
- break;
-
- case TID_PIT:
- if (m_gpu_regs[INT1] & 0x8)
- trigger_host_cpu_irq(3);
- if (m_gpu_regs[PIT0] != 0)
- {
- attotime sample_period = attotime::from_ticks((1+m_gpu_regs[PIT0]) * (1+m_gpu_regs[PIT1]), m_gpu->clock()/2);
- timer_set(sample_period, TID_PIT);
- }
- break;
-
- case TID_SERIAL:
- serial_update();
- break;
+ m_blitter_status = 1;
+}
- case TID_GPU_SYNC:
- // if a command is still pending, and we haven't maxed out our timer, set a new one
- if (m_gpu_command_pending && param < 1000)
- timer_set(attotime::from_usec(50), TID_GPU_SYNC, ++param);
- break;
+TIMER_CALLBACK_MEMBER(jaguar_state::pit_update)
+{
+ if (m_gpu_regs[INT1] & 0x8)
+ trigger_host_cpu_irq(3);
+ if (m_gpu_regs[PIT0] != 0)
+ {
+ attotime sample_period = attotime::from_ticks((1+m_gpu_regs[PIT0]) * (1+m_gpu_regs[PIT1]), m_gpu->clock()/2);
+ m_pit_timer->adjust(sample_period);
}
}
-void jaguar_state::scanline_update(int param)
+TIMER_CALLBACK_MEMBER(jaguar_state::gpu_sync)
+{
+ // if a command is still pending, and we haven't maxed out our timer, set a new one
+ if (m_gpu_command_pending && param < 1000)
+ m_gpu_sync_timer->adjust(attotime::from_usec(50), ++param);
+}
+
+TIMER_CALLBACK_MEMBER(jaguar_state::scanline_update)
{
int vc = param & 0xffff;
int hdb = param >> 16;
@@ -832,8 +821,15 @@ void jaguar_state::video_start()
memset(&m_gpu_regs, 0, sizeof(m_gpu_regs));
m_cpu_irq_state = 0;
- m_object_timer = timer_alloc(TID_SCANLINE);
+ m_object_timer = timer_alloc(FUNC(jaguar_state::scanline_update), this);
+ m_blitter_done_timer = timer_alloc(FUNC(jaguar_state::blitter_done), this);
+ m_pit_timer = timer_alloc(FUNC(jaguar_state::pit_update), this);
+ m_gpu_sync_timer = timer_alloc(FUNC(jaguar_state::gpu_sync), this);
+
adjust_object_timer(0);
+ m_blitter_done_timer->adjust(attotime::never);
+ m_pit_timer->adjust(attotime::never);
+ m_gpu_sync_timer->adjust(attotime::never);
m_screen_bitmap.allocate(760, 512);
diff --git a/src/mame/video/k051960.cpp b/src/mame/video/k051960.cpp
index 42fa9627bd5..900fd6ebab2 100644
--- a/src/mame/video/k051960.cpp
+++ b/src/mame/video/k051960.cpp
@@ -188,7 +188,7 @@ void k051960_device::device_start()
m_k051960_cb.resolve();
// allocate scanline timer and start at first scanline
- m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(k051960_device::scanline_callback), this));
+ m_scanline_timer = timer_alloc(FUNC(k051960_device::scanline_callback), this);
m_scanline_timer->adjust(screen().time_until_pos(0));
decode_gfx();
diff --git a/src/mame/video/k053250_ps.cpp b/src/mame/video/k053250_ps.cpp
index 1327990599b..071f92564b5 100644
--- a/src/mame/video/k053250_ps.cpp
+++ b/src/mame/video/k053250_ps.cpp
@@ -77,7 +77,7 @@ void k053250ps_device::device_start()
save_item(NAME(m_dmairq_on));
m_dmairq_cb.resolve_safe();
- m_timer_lvcdma = timer_alloc(0);
+ m_timer_lvcdma = timer_alloc(FUNC(k053250ps_device::handle_od_wait), this);
}
void k053250ps_device::device_reset()
@@ -498,7 +498,7 @@ uint16_t k053250ps_device::reg_r(offs_t offset)
}
-void k053250ps_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(k053250ps_device::handle_od_wait)
{
switch(m_timer_lvcdma_state)
{
diff --git a/src/mame/video/k053250_ps.h b/src/mame/video/k053250_ps.h
index c548e03fdea..10f61e936e7 100644
--- a/src/mame/video/k053250_ps.h
+++ b/src/mame/video/k053250_ps.h
@@ -45,10 +45,11 @@ public:
protected:
// device-level overrides
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
virtual void device_start() override;
virtual void device_reset() override;
+ TIMER_CALLBACK_MEMBER(handle_od_wait);
+
private:
enum {
diff --git a/src/mame/video/k1ge.cpp b/src/mame/video/k1ge.cpp
index 0dec7b55d8a..d7f2b416568 100644
--- a/src/mame/video/k1ge.cpp
+++ b/src/mame/video/k1ge.cpp
@@ -795,8 +795,8 @@ void k1ge_device::device_start()
m_vblank_pin_w.resolve();
m_hblank_pin_w.resolve();
- m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(k1ge_device::timer_callback), this));
- m_hblank_on_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(k1ge_device::hblank_on_timer_callback), this));
+ m_timer = timer_alloc(FUNC(k1ge_device::timer_callback), this);
+ m_hblank_on_timer = timer_alloc(FUNC(k1ge_device::hblank_on_timer_callback), this);
m_vram = make_unique_clear<uint8_t[]>(0x4000);
m_bitmap = std::make_unique<bitmap_ind16>(screen().width(), screen().height() );
diff --git a/src/mame/video/leland.cpp b/src/mame/video/leland.cpp
index 6a8b3d065c0..33a3b93e516 100644
--- a/src/mame/video/leland.cpp
+++ b/src/mame/video/leland.cpp
@@ -102,7 +102,7 @@ void leland_state::video_start()
m_video_ram = make_unique_clear<u8[]>(VRAM_SIZE);
/* scanline timer */
- m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(leland_state::scanline_callback),this));
+ m_scanline_timer = timer_alloc(FUNC(leland_state::scanline_callback), this);
m_scanline_timer->adjust(m_screen->time_until_pos(0));
save_item(NAME(m_gfx_control));
diff --git a/src/mame/video/lethalj.cpp b/src/mame/video/lethalj.cpp
index 1cab4bb0e60..0b201eb89e9 100644
--- a/src/mame/video/lethalj.cpp
+++ b/src/mame/video/lethalj.cpp
@@ -91,7 +91,7 @@ void lethalj_state::video_start()
/* predetermine blitter info */
m_blitter_rows = m_blitter_base.length() / BLITTER_SOURCE_WIDTH;
- m_gen_ext1_int_timer = timer_alloc(TIMER_GEN_EXT1_INT);
+ m_gen_ext1_int_timer = timer_alloc(FUNC(lethalj_state::gen_ext1_int), this);
m_vispage = 0;
}
@@ -104,16 +104,9 @@ void lethalj_state::video_start()
*
*************************************/
-void lethalj_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(lethalj_state::gen_ext1_int)
{
- switch (id)
- {
- case TIMER_GEN_EXT1_INT:
- m_maincpu->set_input_line(0, ASSERT_LINE);
- break;
- default:
- throw emu_fatalerror("Unknown id in lethalj_state::device_timer");
- }
+ m_maincpu->set_input_line(0, ASSERT_LINE);
}
diff --git a/src/mame/video/lockon.cpp b/src/mame/video/lockon.cpp
index f3513693800..7fcb470eb8d 100644
--- a/src/mame/video/lockon.cpp
+++ b/src/mame/video/lockon.cpp
@@ -873,10 +873,10 @@ void lockon_state::video_start()
m_obj_pal_ram = std::make_unique<uint8_t[]>(2048);
/* Timer for ground display list callback */
- m_bufend_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(lockon_state::bufend_callback),this));
+ m_bufend_timer = timer_alloc(FUNC(lockon_state::bufend_callback), this);
/* Timer for the CRTC cursor pulse */
- m_cursor_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(lockon_state::cursor_callback),this));
+ m_cursor_timer = timer_alloc(FUNC(lockon_state::cursor_callback), this);
m_cursor_timer->adjust(m_screen->time_until_pos(CURSOR_YPOS, CURSOR_XPOS));
save_item(NAME(*m_back_buffer));
diff --git a/src/mame/video/m92.cpp b/src/mame/video/m92.cpp
index aaef4a2c6fa..f2fe172d673 100644
--- a/src/mame/video/m92.cpp
+++ b/src/mame/video/m92.cpp
@@ -46,17 +46,10 @@
/*****************************************************************************/
-void m92_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(m92_state::spritebuffer_done)
{
- switch (id)
- {
- case TIMER_SPRITEBUFFER:
- m_sprite_buffer_busy = 1;
- m_upd71059c->ir1_w(1);
- break;
- default:
- throw emu_fatalerror("Unknown id in m92_state::device_timer");
- }
+ m_sprite_buffer_busy = 1;
+ m_upd71059c->ir1_w(1);
}
@@ -243,7 +236,7 @@ void m92_state::master_control_w(offs_t offset, uint16_t data, uint16_t mem_mask
VIDEO_START_MEMBER(m92_state,m92)
{
- m_spritebuffer_timer = timer_alloc(TIMER_SPRITEBUFFER);
+ m_spritebuffer_timer = timer_alloc(FUNC(m92_state::spritebuffer_done), this);
memset(m_pf_master_control, 0, sizeof(m_pf_master_control));
m_videocontrol = 0;
diff --git a/src/mame/video/mcd212.cpp b/src/mame/video/mcd212.cpp
index e438350c9f8..128c3398b1d 100644
--- a/src/mame/video/mcd212.cpp
+++ b/src/mame/video/mcd212.cpp
@@ -1489,9 +1489,9 @@ void mcd212_device::device_start()
save_item(NAME(m_weight_factor[0]));
save_item(NAME(m_weight_factor[1]));
- m_dca_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mcd212_device::dca_tick), this));
+ m_dca_timer = timer_alloc(FUNC(mcd212_device::dca_tick), this);
m_dca_timer->adjust(attotime::never);
- m_ica_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mcd212_device::ica_tick), this));
+ m_ica_timer = timer_alloc(FUNC(mcd212_device::ica_tick), this);
m_ica_timer->adjust(attotime::never);
}
diff --git a/src/mame/video/metro.cpp b/src/mame/video/metro.cpp
index 03c918b4b05..72efe876ffb 100644
--- a/src/mame/video/metro.cpp
+++ b/src/mame/video/metro.cpp
@@ -30,7 +30,7 @@ TILE_GET_INFO_MEMBER(metro_state::k053936_gstrik2_get_tile_info)
0);
}
-void metro_state::k053936_w(offs_t offset, uint16_t data, uint16_t mem_mask)
+void metro_state::k053936_w(offs_t offset, u16 data, u16 mem_mask)
{
COMBINE_DATA(&m_k053936_ram[offset]);
m_k053936_tilemap->mark_tile_dirty(offset);
diff --git a/src/mame/video/midtunit.cpp b/src/mame/video/midtunit.cpp
index b4189bd1d55..7d777751e48 100644
--- a/src/mame/video/midtunit.cpp
+++ b/src/mame/video/midtunit.cpp
@@ -182,7 +182,7 @@ void midtunit_video_device::device_start()
m_logged_rom.reset();
m_log_png = false;
- m_dma_timer = timer_alloc(TIMER_DMA);
+ m_dma_timer = timer_alloc(FUNC(midtunit_video_device::dma_done), this);
/* reset all the globals */
m_gfxbank_offset[0] = 0x000000;
@@ -617,17 +617,10 @@ DEFINE_TEMPLATED_DMA_DRAW_GROUP(false, false);
*
*************************************/
-void midtunit_video_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(midtunit_video_device::dma_done)
{
- switch (id)
- {
- case TIMER_DMA:
- m_dma_register[DMA_COMMAND] &= ~0x8000; /* tell the cpu we're done */
- m_maincpu->set_input_line(0, ASSERT_LINE);
- break;
- default:
- throw emu_fatalerror("Unknown id in midtunit_video_device::device_timer");
- }
+ m_dma_register[DMA_COMMAND] &= ~0x8000; /* tell the cpu we're done */
+ m_maincpu->set_input_line(0, ASSERT_LINE);
}
diff --git a/src/mame/video/midtunit.h b/src/mame/video/midtunit.h
index 971a2254982..a335eb395cf 100644
--- a/src/mame/video/midtunit.h
+++ b/src/mame/video/midtunit.h
@@ -64,9 +64,8 @@ protected:
midtunit_video_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock = 0);
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
- static const device_timer_id TIMER_DMA = 0;
+ TIMER_CALLBACK_MEMBER(dma_done);
required_device<tms340x0_device> m_maincpu;
required_device<palette_device> m_palette;
diff --git a/src/mame/video/midvunit.cpp b/src/mame/video/midvunit.cpp
index 53407d46963..7e7b486290b 100644
--- a/src/mame/video/midvunit.cpp
+++ b/src/mame/video/midvunit.cpp
@@ -36,36 +36,22 @@ midvunit_renderer::midvunit_renderer(midvunit_state &state)
*
*************************************/
-void midvunit_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(midvunit_state::scanline_timer_cb)
{
- switch (id)
- {
- case TIMER_SCANLINE:
- scanline_timer_cb(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in midvunit_state::device_timer");
- }
+ m_maincpu->set_input_line(0, ASSERT_LINE);
+ m_scanline_timer->adjust(m_screen->time_until_pos(param + 1), param);
+ m_eoi_timer->adjust(attotime::from_hz(25000000), -1);
}
-TIMER_CALLBACK_MEMBER(midvunit_state::scanline_timer_cb)
+TIMER_CALLBACK_MEMBER(midvunit_state::eoi_timer_cb)
{
- int scanline = param;
-
- if (scanline != -1)
- {
- m_maincpu->set_input_line(0, ASSERT_LINE);
- m_scanline_timer->adjust(m_screen->time_until_pos(scanline + 1), scanline);
- timer_set(attotime::from_hz(25000000), TIMER_SCANLINE, -1);
- }
- else
- m_maincpu->set_input_line(0, CLEAR_LINE);
+ m_maincpu->set_input_line(0, CLEAR_LINE);
}
-
void midvunit_state::video_start()
{
- m_scanline_timer = timer_alloc(TIMER_SCANLINE);
+ m_scanline_timer = timer_alloc(FUNC(midvunit_state::scanline_timer_cb), this);
+ m_eoi_timer = timer_alloc(FUNC(midvunit_state::eoi_timer_cb), this);
m_poly = std::make_unique<midvunit_renderer>(*this);
diff --git a/src/mame/video/midyunit.cpp b/src/mame/video/midyunit.cpp
index 104d000bc1c..21a4cf02e29 100644
--- a/src/mame/video/midyunit.cpp
+++ b/src/mame/video/midyunit.cpp
@@ -48,8 +48,8 @@ VIDEO_START_MEMBER(midyunit_state,common)
m_nvram->set_base(m_cmos_ram.get(), 0x2000 * 4);
- m_dma_timer = timer_alloc(TIMER_DMA);
- m_autoerase_line_timer = timer_alloc(TIMER_AUTOERASE_LINE);
+ m_dma_timer = timer_alloc(FUNC(midyunit_state::dma_callback), this);
+ m_autoerase_line_timer = timer_alloc(FUNC(midyunit_state::autoerase_line), this);
/* reset all the globals */
m_cmos_page = 0;
@@ -381,21 +381,6 @@ void midyunit_state::dma_draw(uint16_t command)
*
*************************************/
-void midyunit_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_DMA:
- dma_callback(param);
- break;
- case TIMER_AUTOERASE_LINE:
- autoerase_line(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in midyunit_state::device_timer");
- }
-}
-
TIMER_CALLBACK_MEMBER(midyunit_state::dma_callback)
{
m_dma_register[DMA_COMMAND] &= ~0x8000; /* tell the cpu we're done */
diff --git a/src/mame/video/mystston.cpp b/src/mame/video/mystston.cpp
index f6953237227..c65b21799db 100644
--- a/src/mame/video/mystston.cpp
+++ b/src/mame/video/mystston.cpp
@@ -214,7 +214,7 @@ void mystston_state::video_start()
m_fg_tilemap->set_transparent_pen(0);
// create the interrupt timer
- m_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mystston_state::interrupt_callback), this));
+ m_interrupt_timer = timer_alloc(FUNC(mystston_state::interrupt_callback), this);
}
diff --git a/src/mame/video/n8080.cpp b/src/mame/video/n8080.cpp
index b8e16bf5cf8..6f90fbd8811 100644
--- a/src/mame/video/n8080.cpp
+++ b/src/mame/video/n8080.cpp
@@ -81,7 +81,7 @@ void helifire_state::next_line()
void spacefev_state::video_start()
{
- m_cannon_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(spacefev_state::stop_red_cannon),this));
+ m_cannon_timer = timer_alloc(FUNC(spacefev_state::stop_red_cannon), this);
flip_screen_set(0);
diff --git a/src/mame/video/namcona1.cpp b/src/mame/video/namcona1.cpp
index 6cedb59394a..2096cdf91f1 100644
--- a/src/mame/video/namcona1.cpp
+++ b/src/mame/video/namcona1.cpp
@@ -111,7 +111,7 @@ void namcona1_state::videoram_w(offs_t offset, u16 data, u16 mem_mask)
/*************************************************************************/
-void namcona1_state::UpdatePalette(int offset)
+void namcona1_state::update_palette(int offset)
{
const u16 data = m_paletteram[offset]; /* -RRRRRGG GGGBBBBB */
/**
@@ -133,7 +133,7 @@ void namcona1_state::paletteram_w(offs_t offset, u16 data, u16 mem_mask)
COMBINE_DATA(&m_paletteram[offset]);
if (m_vreg[0x8e / 2])
{ /* graphics enabled; update palette immediately */
- UpdatePalette(offset);
+ update_palette(offset);
}
else
{
@@ -566,7 +566,7 @@ u32 namcona1_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c
/* palette updates are delayed when graphics are disabled */
for (int which = 0; which < 0x1000; which++)
{
- UpdatePalette(which);
+ update_palette(which);
}
m_palette_is_dirty = 0;
}
diff --git a/src/mame/video/namcos22.cpp b/src/mame/video/namcos22.cpp
index 9fd33e69ac9..160ec3df5db 100644
--- a/src/mame/video/namcos22.cpp
+++ b/src/mame/video/namcos22.cpp
@@ -2572,7 +2572,7 @@ void namcos22_state::video_start()
m_is_ss22 = (m_iomcu == nullptr);
init_tables();
- m_posirq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(namcos22_state::posirq_callback),this));
+ m_posirq_timer = timer_alloc(FUNC(namcos22_state::posirq_callback), this);
m_mix_bitmap = std::make_unique<bitmap_ind16>(640, 480);
m_bgtilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(namcos22_state::get_text_tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 64, 64);
diff --git a/src/mame/video/nbmj8688.cpp b/src/mame/video/nbmj8688.cpp
index 23a7948b56a..93efa108a4f 100644
--- a/src/mame/video/nbmj8688.cpp
+++ b/src/mame/video/nbmj8688.cpp
@@ -261,16 +261,9 @@ void nbmj8688_state::writeram_high(int x, int y, int color)
update_pixel(x, y);
}
-void nbmj8688_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nbmj8688_state::clear_busy_flag)
{
- switch (id)
- {
- case TIMER_BLITTER:
- m_nb1413m3->busyflag_w(1);
- break;
- default:
- throw emu_fatalerror("Unknown id in nbmj8688_state::device_timer");
- }
+ m_nb1413m3->busyflag_w(1);
}
void nbmj8688_state::gfxdraw(int gfxtype)
@@ -541,7 +534,7 @@ void nbmj8688_state::gfxdraw(int gfxtype)
void nbmj8688_state::common_video_start()
{
- m_blitter_timer = timer_alloc(TIMER_BLITTER);
+ m_blitter_timer = timer_alloc(FUNC(nbmj8688_state::clear_busy_flag), this);
m_tmpbitmap = std::make_unique<bitmap_ind16>(512, 256);
m_videoram = make_unique_clear<uint16_t[]>(512 * 256);
diff --git a/src/mame/video/nbmj8891.cpp b/src/mame/video/nbmj8891.cpp
index 5a831b91088..eb344890e0a 100644
--- a/src/mame/video/nbmj8891.cpp
+++ b/src/mame/video/nbmj8891.cpp
@@ -305,16 +305,9 @@ void nbmj8891_state::update_pixel1(int x, int y)
m_tmpbitmap1.pix(y, x) = (color == 0x7f) ? 0xff : color;
}
-void nbmj8891_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nbmj8891_state::clear_busy_flag)
{
- switch (id)
- {
- case TIMER_BLITTER:
- m_nb1413m3->busyflag_w(1);
- break;
- default:
- throw emu_fatalerror("Unknown id in nbmj8891_state::device_timer");
- }
+ m_nb1413m3->busyflag_w(1);
}
void nbmj8891_state::gfxdraw()
@@ -485,7 +478,7 @@ VIDEO_START_MEMBER( nbmj8891_state, _1layer )
int width = m_screen->width();
int height = m_screen->height();
- m_blitter_timer = timer_alloc(TIMER_BLITTER);
+ m_blitter_timer = timer_alloc(FUNC(nbmj8891_state::clear_busy_flag), this);
m_screen->register_screen_bitmap(m_tmpbitmap0);
m_videoram0 = std::make_unique<uint8_t[]>(width * height);
m_palette_ptr = std::make_unique<uint8_t[]>(0x200);
@@ -517,7 +510,7 @@ void nbmj8891_state::video_start()
int width = m_screen->width();
int height = m_screen->height();
- m_blitter_timer = timer_alloc(TIMER_BLITTER);
+ m_blitter_timer = timer_alloc(FUNC(nbmj8891_state::clear_busy_flag), this);
m_screen->register_screen_bitmap(m_tmpbitmap0);
m_screen->register_screen_bitmap(m_tmpbitmap1);
m_videoram0 = std::make_unique<uint8_t[]>(width * height);
diff --git a/src/mame/video/nbmj8900.cpp b/src/mame/video/nbmj8900.cpp
index d993300b007..76bd0caf9e2 100644
--- a/src/mame/video/nbmj8900.cpp
+++ b/src/mame/video/nbmj8900.cpp
@@ -194,16 +194,9 @@ void nbmj8900_state::update_pixel1(int x, int y)
m_tmpbitmap1.pix(y, x) = m_palette->pen(color);
}
-void nbmj8900_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nbmj8900_state::clear_busy_flag)
{
- switch (id)
- {
- case TIMER_BLITTER:
- m_nb1413m3->busyflag_w(1);
- break;
- default:
- throw emu_fatalerror("Unknown id in nbmj8900_state::device_timer");
- }
+ m_nb1413m3->busyflag_w(1);
}
void nbmj8900_state::gfxdraw()
@@ -366,7 +359,7 @@ void nbmj8900_state::video_start()
m_screen_width = m_screen->width();
m_screen_height = m_screen->height();
- m_blitter_timer = timer_alloc(TIMER_BLITTER);
+ m_blitter_timer = timer_alloc(FUNC(nbmj8900_state::clear_busy_flag), this);
m_screen->register_screen_bitmap(m_tmpbitmap0);
m_screen->register_screen_bitmap(m_tmpbitmap1);
diff --git a/src/mame/video/nbmj8991.cpp b/src/mame/video/nbmj8991.cpp
index 80110bd1485..a632c75914d 100644
--- a/src/mame/video/nbmj8991.cpp
+++ b/src/mame/video/nbmj8991.cpp
@@ -163,16 +163,9 @@ void nbmj8991_state::update_pixel(int x, int y)
m_tmpbitmap.pix(y, x) = color;
}
-void nbmj8991_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nbmj8991_state::clear_busy_flag)
{
- switch (id)
- {
- case TIMER_BLITTER:
- m_nb1413m3->busyflag_w(1);
- break;
- default:
- throw emu_fatalerror("Unknown id in nbmj8991_state::device_timer");
- }
+ m_nb1413m3->busyflag_w(1);
}
void nbmj8991_state::gfxdraw()
@@ -286,7 +279,7 @@ void nbmj8991_state::gfxdraw()
******************************************************************************/
void nbmj8991_state::video_start()
{
- m_blitter_timer = timer_alloc(TIMER_BLITTER);
+ m_blitter_timer = timer_alloc(FUNC(nbmj8991_state::clear_busy_flag), this);
int width = m_screen->width();
int height = m_screen->height();
diff --git a/src/mame/video/nbmj9195.cpp b/src/mame/video/nbmj9195.cpp
index 16c54ca27b1..c3d09c7dbb0 100644
--- a/src/mame/video/nbmj9195.cpp
+++ b/src/mame/video/nbmj9195.cpp
@@ -178,16 +178,9 @@ void nbmj9195_state::update_pixel(int vram, int x, int y)
m_tmpbitmap[vram].pix(y, x) = color;
}
-void nbmj9195_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nbmj9195_state::clear_busy_flag)
{
- switch (id)
- {
- case TIMER_BLITTER:
- m_nb19010_busyflag = 1;
- break;
- default:
- throw emu_fatalerror("Unknown id in nbmj9195_state::device_timer");
- }
+ m_nb19010_busyflag = 1;
}
void nbmj9195_state::gfxdraw(int vram)
@@ -371,7 +364,7 @@ VIDEO_START_MEMBER(nbmj9195_state,_1layer)
int width = m_screen->width();
int height = m_screen->height();
- m_blitter_timer = timer_alloc(TIMER_BLITTER);
+ m_blitter_timer = timer_alloc(FUNC(nbmj9195_state::clear_busy_flag), this);
m_screen->register_screen_bitmap(m_tmpbitmap[0]);
m_videoram[0] = make_unique_clear<uint16_t[]>(width * height);
@@ -411,7 +404,7 @@ void nbmj9195_state::video_start()
int width = m_screen->width();
int height = m_screen->height();
- m_blitter_timer = timer_alloc(TIMER_BLITTER);
+ m_blitter_timer = timer_alloc(FUNC(nbmj9195_state::clear_busy_flag), this);
m_screen->register_screen_bitmap(m_tmpbitmap[0]);
m_screen->register_screen_bitmap(m_tmpbitmap[1]);
diff --git a/src/mame/video/neogeo_spr.cpp b/src/mame/video/neogeo_spr.cpp
index f65609a1c93..f3c3472112d 100644
--- a/src/mame/video/neogeo_spr.cpp
+++ b/src/mame/video/neogeo_spr.cpp
@@ -151,7 +151,7 @@ TIMER_CALLBACK_MEMBER(neosprite_base_device::auto_animation_timer_callback)
void neosprite_base_device::create_auto_animation_timer()
{
- m_auto_animation_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(neosprite_base_device::auto_animation_timer_callback),this));
+ m_auto_animation_timer = timer_alloc(FUNC(neosprite_base_device::auto_animation_timer_callback), this);
}
@@ -536,7 +536,7 @@ TIMER_CALLBACK_MEMBER(neosprite_base_device::sprite_line_timer_callback)
void neosprite_base_device::create_sprite_line_timer()
{
- m_sprite_line_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(neosprite_base_device::sprite_line_timer_callback),this));
+ m_sprite_line_timer = timer_alloc(FUNC(neosprite_base_device::sprite_line_timer_callback), this);
}
diff --git a/src/mame/video/newbrain.cpp b/src/mame/video/newbrain.cpp
index 93d970ba87d..1124c427603 100644
--- a/src/mame/video/newbrain.cpp
+++ b/src/mame/video/newbrain.cpp
@@ -64,7 +64,7 @@ void newbrain_state::tvtl_w(uint8_t data)
void newbrain_state::video_start()
{
// set timer
- m_clkint_timer = timer_alloc(TIMER_ID_CLKINT);
+ m_clkint_timer = timer_alloc(FUNC(newbrain_state::clear_clkint), this);
m_clkint_timer->adjust(attotime::zero, 0, attotime::from_hz(50));
// state saving
diff --git a/src/mame/video/nick.cpp b/src/mame/video/nick.cpp
index 49c77e35db7..905d6195ade 100644
--- a/src/mame/video/nick.cpp
+++ b/src/mame/video/nick.cpp
@@ -140,7 +140,7 @@ void nick_device::device_start()
m_write_virq.resolve_safe();
// allocate timers
- m_timer_scanline = timer_alloc();
+ m_timer_scanline = timer_alloc(FUNC(nick_device::scanline_tick), this);
m_timer_scanline->adjust(screen().time_until_pos(0, 0), 0, screen().scan_period());
// state saving
@@ -182,10 +182,10 @@ void nick_device::device_reset()
//-------------------------------------------------
-// device_timer - handler timer events
+// scanline_tick - generate a scanline
//-------------------------------------------------
-void nick_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(nick_device::scanline_tick)
{
int scanline = screen().vpos();
diff --git a/src/mame/video/nick.h b/src/mame/video/nick.h
index 332ffb6c04c..9420142c37e 100644
--- a/src/mame/video/nick.h
+++ b/src/mame/video/nick.h
@@ -79,11 +79,12 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_memory_interface overrides
virtual space_config_vector memory_space_config() const override;
+ TIMER_CALLBACK_MEMBER(scanline_tick);
+
uint8_t vram_r(offs_t offset);
void vram_w(offs_t offset, uint8_t data);
diff --git a/src/mame/video/niyanpai.cpp b/src/mame/video/niyanpai.cpp
index 988580697c1..f35c5faa5df 100644
--- a/src/mame/video/niyanpai.cpp
+++ b/src/mame/video/niyanpai.cpp
@@ -162,16 +162,9 @@ void niyanpai_state::update_pixel(int vram, int x, int y)
m_tmpbitmap[vram].pix(y, x) = color;
}
-void niyanpai_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(niyanpai_state::clear_busy_flag)
{
- switch (id)
- {
- case TIMER_BLITTER:
- m_nb19010_busyflag = 1;
- break;
- default:
- throw emu_fatalerror("Unknown id in niyanpai_state::device_timer");
- }
+ m_nb19010_busyflag = 1;
}
void niyanpai_state::gfxdraw(int vram)
@@ -372,7 +365,7 @@ void niyanpai_state::video_start()
m_clut[1] = std::make_unique<uint8_t[]>(0x1000);
m_clut[2] = std::make_unique<uint8_t[]>(0x1000);
m_nb19010_busyflag = 1;
- m_blitter_timer = timer_alloc(TIMER_BLITTER);
+ m_blitter_timer = timer_alloc(FUNC(niyanpai_state::clear_busy_flag), this);
save_item(NAME(m_scrollx));
save_item(NAME(m_scrolly));
diff --git a/src/mame/video/nmk16.cpp b/src/mame/video/nmk16.cpp
index f48b9207bdf..7f4542a16b1 100644
--- a/src/mame/video/nmk16.cpp
+++ b/src/mame/video/nmk16.cpp
@@ -81,7 +81,7 @@ void nmk16_state::video_init()
m_bgbank = 0;
m_mustang_bg_xscroll = 0;
- m_dma_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(nmk16_state::dma_callback),this));
+ m_dma_timer = timer_alloc(FUNC(nmk16_state::dma_callback), this);
save_pointer(NAME(m_spriteram_old), 0x1000/2);
save_pointer(NAME(m_spriteram_old2), 0x1000/2);
save_item(NAME(m_bgbank));
diff --git a/src/mame/video/pastelg.cpp b/src/mame/video/pastelg.cpp
index 4297bb9b52d..86e22eb1c54 100644
--- a/src/mame/video/pastelg.cpp
+++ b/src/mame/video/pastelg.cpp
@@ -258,7 +258,7 @@ void pastelg_common_state::video_start()
m_videoram = make_unique_clear<uint8_t[]>(width * height);
- m_blitter_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pastelg_state::blitter_timer_callback), this));
+ m_blitter_timer = timer_alloc(FUNC(pastelg_state::blitter_timer_callback), this);
save_item(NAME(m_blitter_desty));
save_item(NAME(m_blitter_sizex));
diff --git a/src/mame/video/pc4.cpp b/src/mame/video/pc4.cpp
index 850980bb8aa..77594620f26 100644
--- a/src/mame/video/pc4.cpp
+++ b/src/mame/video/pc4.cpp
@@ -58,18 +58,14 @@ uint32_t pc4_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c
}
-void pc4_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(pc4_state::clear_busy_flag)
{
- switch(id)
- {
- case BUSY_TIMER:
- m_busy_flag = 0;
- break;
+ m_busy_flag = 0;
+}
- case BLINKING_TIMER:
- m_blink = !m_blink;
- break;
- }
+TIMER_CALLBACK_MEMBER(pc4_state::blink_tick)
+{
+ m_blink = !m_blink;
}
void pc4_state::lcd_control_w(uint8_t data)
diff --git a/src/mame/video/pecom.cpp b/src/mame/video/pecom.cpp
index 3c2280c335b..904f7907518 100644
--- a/src/mame/video/pecom.cpp
+++ b/src/mame/video/pecom.cpp
@@ -82,6 +82,6 @@ void pecom_state::machine_start()
save_item(NAME(m_reset));
save_item(NAME(m_dma));
save_pointer(NAME(m_charram), 0x0800);
- m_reset_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pecom_state::reset_tick),this));
+ m_reset_timer = timer_alloc(FUNC(pecom_state::reset_tick), this);
}
diff --git a/src/mame/video/powervr2.cpp b/src/mame/video/powervr2.cpp
index 667142f55ec..3d6a215e070 100644
--- a/src/mame/video/powervr2.cpp
+++ b/src/mame/video/powervr2.cpp
@@ -1900,19 +1900,19 @@ void powervr2_device::process_ta_fifo()
switch (tafifo_listtype)
{
case DISPLAY_LIST_OPAQUE:
- machine().scheduler().timer_set(attotime::from_usec(100), timer_expired_delegate(FUNC(powervr2_device::transfer_opaque_list_irq), this));
+ opaque_irq_timer->adjust(attotime::from_usec(100));
break;
case DISPLAY_LIST_OPAQUE_MOD:
- machine().scheduler().timer_set(attotime::from_usec(100), timer_expired_delegate(FUNC(powervr2_device::transfer_opaque_modifier_volume_list_irq), this));
+ opaque_modifier_volume_irq_timer->adjust(attotime::from_usec(100));
break;
case DISPLAY_LIST_TRANS:
- machine().scheduler().timer_set(attotime::from_usec(100), timer_expired_delegate(FUNC(powervr2_device::transfer_translucent_list_irq), this));
+ translucent_irq_timer->adjust(attotime::from_usec(100));
break;
case DISPLAY_LIST_TRANS_MOD:
- machine().scheduler().timer_set(attotime::from_usec(100), timer_expired_delegate(FUNC(powervr2_device::transfer_translucent_modifier_volume_list_irq), this));
+ translucent_modifier_volume_irq_timer->adjust(attotime::from_usec(100));
break;
case DISPLAY_LIST_PUNCH_THROUGH:
- machine().scheduler().timer_set(attotime::from_usec(100), timer_expired_delegate(FUNC(powervr2_device::transfer_punch_through_list_irq), this));
+ punch_through_irq_timer->adjust(attotime::from_usec(100));
break;
}
tafifo_listtype = DISPLAY_LIST_NONE; // no list being received
@@ -3879,10 +3879,7 @@ void powervr2_device::pvr_dma_execute(address_space &space)
/* Note: do not update the params, since this DMA type doesn't support it. */
// TODO: accurate timing
- machine().scheduler().timer_set(
- state->m_maincpu->cycles_to_attotime(m_pvr_dma.size/4),
- timer_expired_delegate(FUNC(powervr2_device::pvr_dma_irq), this)
- );
+ dma_irq_timer->adjust(state->m_maincpu->cycles_to_attotime(m_pvr_dma.size/4));
}
INPUT_PORTS_START( powervr2 )
@@ -3918,14 +3915,21 @@ void powervr2_device::device_start()
computedilated();
-// vbout_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(powervr2_device::vbout),this));
-// vbin_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(powervr2_device::vbin),this));
- hbin_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(powervr2_device::hbin),this));
- yuv_timer_end = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(powervr2_device::yuv_convert_end),this));
-
- endofrender_timer_isp = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(powervr2_device::endofrender_isp),this));
- endofrender_timer_tsp = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(powervr2_device::endofrender_tsp),this));
- endofrender_timer_video = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(powervr2_device::endofrender_video),this));
+// vbout_timer = timer_alloc(FUNC(powervr2_device::vbout), this);
+// vbin_timer = timer_alloc(FUNC(powervr2_device::vbin), this);
+ hbin_timer = timer_alloc(FUNC(powervr2_device::hbin), this);
+ yuv_timer_end = timer_alloc(FUNC(powervr2_device::yuv_convert_end), this);
+
+ endofrender_timer_isp = timer_alloc(FUNC(powervr2_device::endofrender_isp), this);
+ endofrender_timer_tsp = timer_alloc(FUNC(powervr2_device::endofrender_tsp), this);
+ endofrender_timer_video = timer_alloc(FUNC(powervr2_device::endofrender_video), this);
+
+ opaque_irq_timer = timer_alloc(FUNC(powervr2_device::transfer_opaque_list_irq), this);
+ opaque_modifier_volume_irq_timer = timer_alloc(FUNC(powervr2_device::transfer_opaque_modifier_volume_list_irq), this);
+ translucent_irq_timer = timer_alloc(FUNC(powervr2_device::transfer_translucent_list_irq), this);
+ translucent_modifier_volume_irq_timer = timer_alloc(FUNC(powervr2_device::transfer_translucent_modifier_volume_list_irq), this);
+ punch_through_irq_timer = timer_alloc(FUNC(powervr2_device::transfer_punch_through_list_irq), this);
+ dma_irq_timer = timer_alloc(FUNC(powervr2_device::pvr_dma_irq), this);
fake_accumulationbuffer_bitmap = std::make_unique<bitmap_rgb32>(2048,2048);
diff --git a/src/mame/video/powervr2.h b/src/mame/video/powervr2.h
index 2e4e0ebc21a..a5457206c03 100644
--- a/src/mame/video/powervr2.h
+++ b/src/mame/video/powervr2.h
@@ -374,6 +374,14 @@ private:
// PD DMA registers
uint32_t sb_pdstap, sb_pdstar, sb_pdlen, sb_pddir, sb_pdtsel, sb_pden, sb_pdst, sb_pdapro;
+ // Timer callbacks
+ emu_timer *opaque_irq_timer = nullptr;
+ emu_timer *opaque_modifier_volume_irq_timer = nullptr;
+ emu_timer *translucent_irq_timer = nullptr;
+ emu_timer *translucent_modifier_volume_irq_timer = nullptr;
+ emu_timer *punch_through_irq_timer = nullptr;
+ emu_timer *dma_irq_timer = nullptr;
+
static uint32_t (*const blend_functions[64])(uint32_t s, uint32_t d);
static int uv_wrap(float uv, int size);
diff --git a/src/mame/video/rollerg.cpp b/src/mame/video/rollerg.cpp
index cda4d00aa09..92bcf58a1fa 100644
--- a/src/mame/video/rollerg.cpp
+++ b/src/mame/video/rollerg.cpp
@@ -43,7 +43,7 @@ K051316_CB_MEMBER(rollerg_state::zoom_callback)
***************************************************************************/
-uint32_t rollerg_state::screen_update_rollerg(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+uint32_t rollerg_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
int bg_colorbase = 16;
diff --git a/src/mame/video/rpunch.cpp b/src/mame/video/rpunch.cpp
index 02e7dcfbd28..ba98cfe31f5 100644
--- a/src/mame/video/rpunch.cpp
+++ b/src/mame/video/rpunch.cpp
@@ -77,7 +77,7 @@ VIDEO_START_MEMBER(rpunch_state,rpunch)
m_pixmap->fill(0xf, pixmap_rect);
/* reset the timer */
- m_crtc_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(rpunch_state::crtc_interrupt_gen),this));
+ m_crtc_timer = timer_alloc(FUNC(rpunch_state::crtc_interrupt_gen), this);
save_item(NAME(*m_pixmap));
}
diff --git a/src/mame/video/saturn.cpp b/src/mame/video/saturn.cpp
index f924aba4ef7..9bb18ef972e 100644
--- a/src/mame/video/saturn.cpp
+++ b/src/mame/video/saturn.cpp
@@ -2044,7 +2044,7 @@ void saturn_state::stv_vdp1_process_list( void )
/* TODO: what's the exact formula? Guess it should be a mix between number of pixels written and actual command data fetched. */
// if spritecount = 10000 don't send a vdp1 draw end
// if(spritecount < 10000)
- machine().scheduler().timer_set(m_maincpu->cycles_to_attotime(spritecount*16), timer_expired_delegate(FUNC(saturn_state::vdp1_draw_end),this));
+ m_vdp1.draw_end_timer->adjust(m_maincpu->cycles_to_attotime(spritecount*16));
if (VDP1_LOG) logerror ("End of list processing!\n");
}
@@ -2193,6 +2193,7 @@ int saturn_state::stv_vdp1_start ( void )
/* Kidou Senshi Z Gundam - Zenpen Zeta no Kodou loves to use the user cliprect vars in an undefined state ... */
m_vdp1.user_cliprect.set(0, 512, 0, 256);
+ m_vdp1.draw_end_timer = timer_alloc(FUNC(saturn_state::vdp1_draw_end), this);
// save state
save_pointer(NAME(m_vdp1_regs), 0x020/2);
save_pointer(NAME(m_vdp1_vram), 0x100000/4);
diff --git a/src/mame/video/segag80r.cpp b/src/mame/video/segag80r.cpp
index 1acd43f7ba3..62aa237283f 100644
--- a/src/mame/video/segag80r.cpp
+++ b/src/mame/video/segag80r.cpp
@@ -21,16 +21,9 @@ enum { spaceod_bg_detect_tile_color = 1 };
*
*************************************/
-void segag80r_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(segag80r_state::vblank_latch_clear)
{
- switch (id)
- {
- case TIMER_VBLANK_LATCH_CLEAR:
- m_vblank_latch = 0;
- break;
- default:
- throw emu_fatalerror("Unknown id in segag80r_state::device_timer");
- }
+ m_vblank_latch = 0;
}
diff --git a/src/mame/video/segaic16.cpp b/src/mame/video/segaic16.cpp
index 2c060d0c947..5039ff145dd 100644
--- a/src/mame/video/segaic16.cpp
+++ b/src/mame/video/segaic16.cpp
@@ -1258,7 +1258,7 @@ void segaic16_video_device::tilemap_init(int which, int type, int colorbase, int
info->numpages = 16;
info->draw_layer = tilemap_16b_draw_layer;
info->reset = tilemap_16b_reset;
- info->latch_timer = machine().scheduler().timer_alloc( timer_expired_delegate(FUNC(segaic16_video_device::tilemap_16b_latch_values),this) );
+ info->latch_timer = timer_alloc(FUNC(segaic16_video_device::tilemap_16b_latch_values), this);
break;
case TILEMAP_16B_ALT:
@@ -1267,7 +1267,7 @@ void segaic16_video_device::tilemap_init(int which, int type, int colorbase, int
info->numpages = 16;
info->draw_layer = tilemap_16b_draw_layer;
info->reset = tilemap_16b_reset;
- info->latch_timer = machine().scheduler().timer_alloc( timer_expired_delegate(FUNC(segaic16_video_device::tilemap_16b_latch_values),this) );
+ info->latch_timer = timer_alloc(FUNC(segaic16_video_device::tilemap_16b_latch_values), this);
break;
default:
diff --git a/src/mame/video/segas32.cpp b/src/mame/video/segas32.cpp
index 108c54120d0..942b387f578 100644
--- a/src/mame/video/segas32.cpp
+++ b/src/mame/video/segas32.cpp
@@ -240,8 +240,8 @@ void segas32_state::device_start()
if (!m_gfxdecode->started())
throw device_missing_dependencies();
- m_vblank_end_int_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(segas32_state::end_of_vblank_int), this));
- m_update_sprites_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(segas32_state::update_sprites), this));
+ m_vblank_end_int_timer = timer_alloc(FUNC(segas32_state::end_of_vblank_int), this);
+ m_update_sprites_timer = timer_alloc(FUNC(segas32_state::update_sprites), this);
/* allocate a copy of spriteram in 32-bit format */
m_spriteram_32bit = std::make_unique<uint32_t[]>(0x20000/4);
diff --git a/src/mame/video/seta2.cpp b/src/mame/video/seta2.cpp
index 063b5b1b2ce..6072579fda0 100644
--- a/src/mame/video/seta2.cpp
+++ b/src/mame/video/seta2.cpp
@@ -889,7 +889,7 @@ void seta2_state::video_start()
m_realtilenumber[i] = i % m_spritegfx->elements();
}
- m_raster_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(seta2_state::raster_timer_done), this));
+ m_raster_timer = timer_alloc(FUNC(seta2_state::raster_timer_done), this);
save_pointer(NAME(m_private_spriteram), 0x1000 / 2);
}
diff --git a/src/mame/video/sgi_re2.cpp b/src/mame/video/sgi_re2.cpp
index b1595fe574e..3a831608884 100644
--- a/src/mame/video/sgi_re2.cpp
+++ b/src/mame/video/sgi_re2.cpp
@@ -78,7 +78,7 @@ void sgi_re2_device::device_start()
set_rdy(true);
set_drq(false);
- m_step = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sgi_re2_device::step), this));
+ m_step = timer_alloc(FUNC(sgi_re2_device::step), this);
}
void sgi_re2_device::device_reset()
diff --git a/src/mame/video/simpsons.cpp b/src/mame/video/simpsons.cpp
index bd7c5776ad6..8c5d47df531 100644
--- a/src/mame/video/simpsons.cpp
+++ b/src/mame/video/simpsons.cpp
@@ -45,17 +45,17 @@ K053246_CB_MEMBER(simpsons_state::sprite_callback)
***************************************************************************/
-uint8_t simpsons_state::simpsons_k052109_r(offs_t offset)
+uint8_t simpsons_state::k052109_r(offs_t offset)
{
return m_k052109->read(offset + 0x2000);
}
-void simpsons_state::simpsons_k052109_w(offs_t offset, uint8_t data)
+void simpsons_state::k052109_w(offs_t offset, uint8_t data)
{
m_k052109->write(offset + 0x2000, data);
}
-uint8_t simpsons_state::simpsons_k053247_r(offs_t offset)
+uint8_t simpsons_state::k053247_r(offs_t offset)
{
int offs = offset >> 1;
@@ -65,7 +65,7 @@ uint8_t simpsons_state::simpsons_k053247_r(offs_t offset)
return(m_spriteram[offs] >> 8);
}
-void simpsons_state::simpsons_k053247_w(offs_t offset, uint8_t data)
+void simpsons_state::k053247_w(offs_t offset, uint8_t data)
{
int offs = offset >> 1;
@@ -75,7 +75,7 @@ void simpsons_state::simpsons_k053247_w(offs_t offset, uint8_t data)
m_spriteram[offs] = (m_spriteram[offs] & 0x00ff) | (data << 8);
}
-void simpsons_state::simpsons_video_banking( int bank )
+void simpsons_state::video_bank_select( int bank )
{
if(bank & 1)
m_palette_view.select(0);
@@ -92,7 +92,7 @@ void simpsons_state::simpsons_video_banking( int bank )
***************************************************************************/
-uint32_t simpsons_state::screen_update_simpsons(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+uint32_t simpsons_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
int layer[3], bg_colorbase;
diff --git a/src/mame/video/spectrum.cpp b/src/mame/video/spectrum.cpp
index 3bb40efe737..70ecf5249ed 100644
--- a/src/mame/video/spectrum.cpp
+++ b/src/mame/video/spectrum.cpp
@@ -24,7 +24,8 @@
***************************************************************************/
void spectrum_state::video_start()
{
- m_irq_off_timer = timer_alloc(TIMER_IRQ_OFF);
+ m_irq_on_timer = timer_alloc(FUNC(spectrum_state::irq_on), this);
+ m_irq_off_timer = timer_alloc(FUNC(spectrum_state::irq_off), this);
m_frame_invert_count = 16;
m_screen_location = m_video_ram;
diff --git a/src/mame/video/sprint8.cpp b/src/mame/video/sprint8.cpp
index 724d9f4f1ab..5de26f55658 100644
--- a/src/mame/video/sprint8.cpp
+++ b/src/mame/video/sprint8.cpp
@@ -117,7 +117,7 @@ void sprint8_state::video_start()
m_tilemap1->set_scrolly(0, +24);
m_tilemap2->set_scrolly(0, +24);
- m_collision_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sprint8_state::collision_callback),this));
+ m_collision_timer = timer_alloc(FUNC(sprint8_state::collision_callback), this);
}
diff --git a/src/mame/video/starfire.cpp b/src/mame/video/starfire.cpp
index b87e215dfd5..07c28fbe23c 100644
--- a/src/mame/video/starfire.cpp
+++ b/src/mame/video/starfire.cpp
@@ -20,7 +20,7 @@
void starfire_base_state::video_start()
{
m_screen->register_screen_bitmap(m_screen_bitmap);
- m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(starfire_base_state::scanline_callback),this));
+ m_scanline_timer = timer_alloc(FUNC(starfire_base_state::scanline_callback), this);
m_scanline_timer->adjust(m_screen->time_until_pos(STARFIRE_VBEND), STARFIRE_VBEND);
/* register for state saving */
diff --git a/src/mame/video/tank8.cpp b/src/mame/video/tank8.cpp
index 6d23ad8cd7a..6ad9375d745 100644
--- a/src/mame/video/tank8.cpp
+++ b/src/mame/video/tank8.cpp
@@ -98,7 +98,7 @@ TILE_GET_INFO_MEMBER(tank8_state::get_tile_info)
void tank8_state::video_start()
{
- m_collision_timer = timer_alloc(TIMER_COLLISION);
+ m_collision_timer = timer_alloc(FUNC(tank8_state::set_collision), this);
m_screen->register_screen_bitmap(m_helper1);
m_screen->register_screen_bitmap(m_helper2);
@@ -166,19 +166,6 @@ void tank8_state::draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect)
}
-void tank8_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_COLLISION:
- set_collision(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in tank8_state::device_timer");
- }
-}
-
-
uint32_t tank8_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
set_pens();
diff --git a/src/mame/video/tc0180vcu.cpp b/src/mame/video/tc0180vcu.cpp
index 379075b829f..c4bfb9d1485 100644
--- a/src/mame/video/tc0180vcu.cpp
+++ b/src/mame/video/tc0180vcu.cpp
@@ -101,7 +101,7 @@ void tc0180vcu_device::device_start()
m_framebuffer[1] = std::make_unique<bitmap_ind16>(512, 256);
screen().register_vblank_callback(vblank_state_delegate(&tc0180vcu_device::vblank_callback, this));
- m_intl_timer = timer_alloc(TIMER_INTL);
+ m_intl_timer = timer_alloc(FUNC(tc0180vcu_device::update_intl), this);
save_item(NAME(m_bg_rambank));
save_item(NAME(m_fg_rambank));
@@ -162,19 +162,13 @@ void tc0180vcu_device::vblank_callback(screen_device &screen, bool state)
}
//-------------------------------------------------
-// device_timer - called whenever a device timer
-// fires
+// update_intl
//-------------------------------------------------
-void tc0180vcu_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(tc0180vcu_device::update_intl)
{
- switch (id)
- {
- case TIMER_INTL:
- m_inth_callback(CLEAR_LINE);
- m_intl_callback(ASSERT_LINE);
- break;
- }
+ m_inth_callback(CLEAR_LINE);
+ m_intl_callback(ASSERT_LINE);
}
diff --git a/src/mame/video/tc0180vcu.h b/src/mame/video/tc0180vcu.h
index dafd02598a8..4074742e582 100644
--- a/src/mame/video/tc0180vcu.h
+++ b/src/mame/video/tc0180vcu.h
@@ -36,13 +36,10 @@ protected:
virtual void device_resolve_objects() override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-private:
- enum {
- TIMER_INTL
- };
+ TIMER_CALLBACK_MEMBER(update_intl);
+private:
void vblank_callback(screen_device &screen, bool state);
void vblank_update();
diff --git a/src/mame/video/thomson.cpp b/src/mame/video/thomson.cpp
index 3898033180f..521f15f666d 100644
--- a/src/mame/video/thomson.cpp
+++ b/src/mame/video/thomson.cpp
@@ -1166,15 +1166,15 @@ void thomson_state::video_start()
m_thom_video_timer = machine().scheduler().timer_alloc(timer_expired_delegate());
- m_thom_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(thomson_state::thom_scanline_start),this));
+ m_thom_scanline_timer = timer_alloc(FUNC(thomson_state::thom_scanline_start), this);
m_thom_lightpen_nb = 0;
m_thom_lightpen_cb = nullptr;
- m_thom_lightpen_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(thomson_state::thom_lightpen_step),this));
+ m_thom_lightpen_timer = timer_alloc(FUNC(thomson_state::thom_lightpen_step), this);
save_item(NAME(m_thom_lightpen_nb));
m_thom_init_cb = nullptr;
- m_thom_init_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(thomson_state::thom_set_init),this));
+ m_thom_init_timer = timer_alloc(FUNC(thomson_state::thom_set_init), this);
m_thom_bwidth = 0;
m_thom_bheight = 0;
diff --git a/src/mame/video/timex.cpp b/src/mame/video/timex.cpp
index e3c92ee88c4..bb289a2073c 100644
--- a/src/mame/video/timex.cpp
+++ b/src/mame/video/timex.cpp
@@ -29,7 +29,8 @@ inline void tc2048_state::spectrum_plot_pixel(bitmap_ind16 &bitmap, int x, int y
/* Update FLASH status for ts2068. Assumes flash update every 1/2s. */
void ts2068_state::video_start()
{
- m_irq_off_timer = timer_alloc(TIMER_IRQ_OFF);
+ m_irq_on_timer = timer_alloc(FUNC(ts2068_state::irq_on), this);
+ m_irq_off_timer = timer_alloc(FUNC(ts2068_state::irq_off), this);
m_frame_invert_count = 30;
m_screen_location = m_video_ram;
diff --git a/src/mame/video/triplhnt.cpp b/src/mame/video/triplhnt.cpp
index c28028a2570..bd9a1566596 100644
--- a/src/mame/video/triplhnt.cpp
+++ b/src/mame/video/triplhnt.cpp
@@ -24,7 +24,7 @@ void triplhnt_state::video_start()
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(triplhnt_state::get_tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 16, 16);
- m_hit_timer = timer_alloc(TIMER_HIT);
+ m_hit_timer = timer_alloc(FUNC(triplhnt_state::set_collision), this);
save_item(NAME(m_cmos));
save_item(NAME(m_da_latch));
@@ -35,19 +35,6 @@ void triplhnt_state::video_start()
}
-void triplhnt_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_HIT:
- set_collision(param);
- break;
- default:
- throw emu_fatalerror("Unknown id in triplhnt_state::device_timer");
- }
-}
-
-
void triplhnt_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
int hit_line = 999;
diff --git a/src/mame/video/tubep.cpp b/src/mame/video/tubep.cpp
index 93785f7dbc9..8590a3e606f 100644
--- a/src/mame/video/tubep.cpp
+++ b/src/mame/video/tubep.cpp
@@ -133,7 +133,7 @@
***************************************************************************/
-void tubep_state::tubep_palette(palette_device &palette)
+void tubep_state::palette_init(palette_device &palette)
{
const uint8_t *color_prom = memregion("proms")->base();
@@ -328,7 +328,7 @@ void tubep_state::video_start()
{
m_spritemap = std::make_unique<uint8_t[]>(256*256*2);
- m_sprite_timer = timer_alloc(TIMER_SPRITE);
+ m_sprite_timer = timer_alloc(FUNC(tubep_state::assert_sprite_int), this);
/* Set up save state */
save_item(NAME(m_romD_addr));
@@ -409,13 +409,13 @@ WRITE_LINE_MEMBER(tubep_state::colorproms_A4_line_w)
}
-void tubep_state::tubep_background_a000_w(uint8_t data)
+void tubep_state::background_a000_w(uint8_t data)
{
m_ls175_b7 = ((data & 0x0f) ^ 0x0f) | 0xf0;
}
-void tubep_state::tubep_background_c000_w(uint8_t data)
+void tubep_state::background_c000_w(uint8_t data)
{
m_ls175_e8 = ((data & 0x0f) ^ 0x0f);
}
@@ -490,7 +490,7 @@ void tubep_state::draw_sprite()
}
-void tubep_state::tubep_sprite_control_w(offs_t offset, uint8_t data)
+void tubep_state::sprite_control_w(offs_t offset, uint8_t data)
{
if (offset < 10)
{
@@ -557,7 +557,7 @@ void tubep_state::tubep_sprite_control_w(offs_t offset, uint8_t data)
}
}
-void tubep_state::tubep_vblank_end()
+void tubep_state::vblank_end()
{
m_DISP = m_DISP ^ 1;
/* logerror("EOF: DISP after this is=%i, and clearing it now.\n", m_DISP); */
@@ -566,7 +566,7 @@ void tubep_state::tubep_vblank_end()
}
-uint32_t tubep_state::screen_update_tubep(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+uint32_t tubep_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
int DISP_ = m_DISP^1;
@@ -686,7 +686,7 @@ uint32_t tubep_state::screen_update_tubep(screen_device &screen, bitmap_ind16 &b
***************************************************************************/
-void rjammer_state::rjammer_palette(palette_device &palette) const
+void rjammer_state::palette_init(palette_device &palette) const
{
uint8_t const *color_prom = memregion("proms")->base();
@@ -726,19 +726,19 @@ void rjammer_state::rjammer_palette(palette_device &palette) const
}
-void rjammer_state::rjammer_background_LS377_w(uint8_t data)
+void rjammer_state::background_ls377_w(uint8_t data)
{
m_ls377_data = data & 0xff;
}
-void rjammer_state::rjammer_background_page_w(uint8_t data)
+void rjammer_state::background_page_w(uint8_t data)
{
m_page = (data & 1) * 0x200;
}
-uint32_t rjammer_state::screen_update_rjammer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+uint32_t rjammer_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
int DISP_ = m_DISP^1;
diff --git a/src/mame/video/twin16.cpp b/src/mame/video/twin16.cpp
index d64d6824edc..898f525f148 100644
--- a/src/mame/video/twin16.cpp
+++ b/src/mame/video/twin16.cpp
@@ -447,7 +447,7 @@ void twin16_state::video_start()
memset(m_sprite_buffer,0xff,0x800*sizeof(uint16_t));
m_video_register = 0;
m_sprite_busy = 0;
- m_sprite_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(twin16_state::sprite_tick),this));
+ m_sprite_timer = timer_alloc(FUNC(twin16_state::sprite_tick),this);
m_sprite_timer->adjust(attotime::never);
/* register for savestates */
diff --git a/src/mame/video/tx1.cpp b/src/mame/video/tx1.cpp
index fd89b9c96a1..1581cc90320 100644
--- a/src/mame/video/tx1.cpp
+++ b/src/mame/video/tx1.cpp
@@ -1102,7 +1102,7 @@ VIDEO_START_MEMBER(tx1_state,tx1)
m_rod_bmp = std::make_unique<uint8_t[]>(256 * 3 * 240);
/* Set a timer to run the interrupts */
- m_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tx1_state::interrupt_callback),this));
+ m_interrupt_timer = timer_alloc(FUNC(tx1_state::interrupt_callback),this);
/* /CUDISP CRTC interrupt */
m_interrupt_timer->adjust(m_screen->time_until_pos(CURSOR_YPOS, CURSOR_XPOS));
@@ -2986,7 +2986,7 @@ VIDEO_START_MEMBER(tx1_state,buggyboy)
m_rod_bmp = std::make_unique<uint8_t[]>(3 * 256 * 240);
/* Set a timer to run the interrupts */
- m_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tx1_state::interrupt_callback),this));
+ m_interrupt_timer = timer_alloc(FUNC(tx1_state::interrupt_callback),this);
/* /CUDISP CRTC interrupt */
m_interrupt_timer->adjust(m_screen->time_until_pos(CURSOR_YPOS, CURSOR_XPOS));
@@ -3000,7 +3000,7 @@ VIDEO_START_MEMBER(tx1_state,buggybjr)
m_rod_bmp = std::make_unique<uint8_t[]>(256 * 240);
/* Set a timer to run the interrupts */
- m_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tx1_state::interrupt_callback),this));
+ m_interrupt_timer = timer_alloc(FUNC(tx1_state::interrupt_callback),this);
/* /CUDISP CRTC interrupt */
m_interrupt_timer->adjust(m_screen->time_until_pos(CURSOR_YPOS, CURSOR_XPOS));
diff --git a/src/mame/video/uv201.cpp b/src/mame/video/uv201.cpp
index 4d36dbe0356..56b670247b3 100644
--- a/src/mame/video/uv201.cpp
+++ b/src/mame/video/uv201.cpp
@@ -9,15 +9,13 @@
#include "emu.h"
#include "uv201.h"
-
+#define VERBOSE (1)
+#include "logmacro.h"
//**************************************************************************
// MACROS / CONSTANTS
//**************************************************************************
-#define LOG 1
-
-
// screen parameters
#define SCREEN_WIDTH 232
#define SCREEN_HEIGHT 262
@@ -119,10 +117,10 @@ void uv201_device::device_start()
m_read_db.resolve_safe(0);
// allocate timers
- m_timer_y_odd = timer_alloc(TIMER_Y_ODD);
- m_timer_y_even = timer_alloc(TIMER_Y_EVEN);
- m_timer_hblank_on = timer_alloc(TIMER_HBLANK_ON);
- m_timer_hblank_off = timer_alloc(TIMER_HBLANK_OFF);
+ m_timer_y_odd = timer_alloc(FUNC(uv201_device::y_update_tick), this);
+ m_timer_y_even = timer_alloc(FUNC(uv201_device::y_update_tick), this);
+ m_timer_hblank_on = timer_alloc(FUNC(uv201_device::hblank_on), this);
+ m_timer_hblank_off = timer_alloc(FUNC(uv201_device::hblank_off), this);
initialize_palette();
@@ -161,40 +159,33 @@ void uv201_device::device_reset()
//-------------------------------------------------
-// device_timer - handle timer events
+// timer events
//-------------------------------------------------
-void uv201_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(uv201_device::y_update_tick)
{
- int scanline = screen().vpos();
-
- switch (id)
+ if ((m_cmd & COMMAND_INT) && !(m_cmd & COMMAND_FRZ))
{
- case TIMER_Y_ODD:
- case TIMER_Y_EVEN:
- if ((m_cmd & COMMAND_INT) && !(m_cmd & COMMAND_FRZ))
- {
- if (LOG) logerror("Y-Interrupt at scanline %u\n", scanline);
-
- m_freeze_y = scanline;
-
- m_write_ext_int(ASSERT_LINE);
- m_write_ext_int(CLEAR_LINE);
- }
- break;
+ int scanline = screen().vpos();
+ LOG("Y-Interrupt at scanline %u\n", scanline);
- case TIMER_HBLANK_ON:
- m_write_hblank(1);
+ m_freeze_y = scanline;
- m_timer_hblank_off->adjust(attotime::from_ticks( HBLANK_WIDTH, m_clock ) );
- break;
+ m_write_ext_int(ASSERT_LINE);
+ m_write_ext_int(CLEAR_LINE);
+ }
+}
- case TIMER_HBLANK_OFF:
- m_write_hblank(0);
+TIMER_CALLBACK_MEMBER(uv201_device::hblank_on)
+{
+ m_write_hblank(1);
+ m_timer_hblank_off->adjust(attotime::from_ticks(HBLANK_WIDTH, m_clock));
+}
- m_timer_hblank_on->adjust(attotime::from_ticks( VISAREA_WIDTH, m_clock ) );
- break;
- }
+TIMER_CALLBACK_MEMBER(uv201_device::hblank_off)
+{
+ m_write_hblank(0);
+ m_timer_hblank_on->adjust(attotime::from_ticks(VISAREA_WIDTH, m_clock));
}
@@ -287,7 +278,7 @@ void uv201_device::do_partial_update()
{
int vpos = screen().vpos();
- if (LOG) logerror("Partial screen update at scanline %u\n", vpos);
+ LOG("Partial screen update at scanline %u\n", vpos);
screen().update_partial(vpos);
}
@@ -306,13 +297,13 @@ uint8_t uv201_device::read(offs_t offset)
case REGISTER_X_FREEZE:
data = m_freeze_x;
- if (LOG) logerror("X-Freeze %02x\n", data);
+ LOG("X-Freeze %02x\n", data);
break;
case REGISTER_Y_FREEZE_LOW:
data = m_freeze_y & 0xff;
- if (LOG) logerror("Y-Freeze Low %02x\n", data);
+ LOG("Y-Freeze Low %02x\n", data);
break;
case REGISTER_Y_FREEZE_HIGH:
@@ -333,20 +324,20 @@ uint8_t uv201_device::read(offs_t offset)
data = (get_field() << 7) | (BIT(get_field_vpos(), 8) << 1) | BIT(m_freeze_y, 8);
- if (LOG) logerror("Y-Freeze High %02x\n", data);
+ LOG("Y-Freeze High %02x\n", data);
break;
case REGISTER_CURRENT_Y_LOW:
data = get_field_vpos() & 0xff;
- if (LOG) logerror("Current-Y Low %02x\n", data);
+ LOG("Current-Y Low %02x\n", data);
break;
default:
if (offset < 0x90)
data = m_ram[offset];
else
- if (LOG) logerror("Unknown VLSI read from %02x!\n", offset);
+ LOG("Unknown VLSI read from %02x!\n", offset);
}
return data;
@@ -362,7 +353,7 @@ void uv201_device::write(offs_t offset, uint8_t data)
switch (offset)
{
case REGISTER_Y_INTERRUPT:
- if (LOG) logerror("Y-Interrupt %02x\n", data);
+ LOG("Y-Interrupt %02x\n", data);
if (m_y_int != data)
{
@@ -387,7 +378,7 @@ void uv201_device::write(offs_t offset, uint8_t data)
*/
- if (LOG) logerror("Final Modifier %02x\n", data);
+ LOG("Final Modifier %02x\n", data);
do_partial_update();
m_fmod = data & 0x1f;
@@ -409,7 +400,7 @@ void uv201_device::write(offs_t offset, uint8_t data)
*/
- if (LOG) logerror("Background %02x\n", data);
+ LOG("Background %02x\n", data);
do_partial_update();
m_bg = data & 0x1f;
@@ -431,7 +422,7 @@ void uv201_device::write(offs_t offset, uint8_t data)
*/
- if (LOG) logerror("Command %02x\n", data);
+ LOG("Command %02x\n", data);
if (IS_CHANGED(COMMAND_YINT_H_O))
{
@@ -521,7 +512,7 @@ uint32_t uv201_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap
int xcopy = BIT(dx_int_xcopy, 7);
uint8_t x = RAM_XORD(RAM_X);
- if (LOG) logerror("Object %u xord %u y %u x %u dy %u dx %u xcopy %u color %u rp %04x\n", i, xord, y, x, dy, dx, xcopy, color, rp);
+ LOG("Object %u xord %u y %u x %u dy %u dx %u xcopy %u color %u rp %04x\n", i, xord, y, x, dy, dx, xcopy, color, rp);
if (rp == 0) continue;
if (y > SCREEN_HEIGHT) continue;
diff --git a/src/mame/video/uv201.h b/src/mame/video/uv201.h
index 91d5b0135b6..e3cd03b2af6 100644
--- a/src/mame/video/uv201.h
+++ b/src/mame/video/uv201.h
@@ -89,17 +89,12 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
-private:
- enum
- {
- TIMER_Y_ODD,
- TIMER_Y_EVEN,
- TIMER_HBLANK_ON,
- TIMER_HBLANK_OFF
- };
+ TIMER_CALLBACK_MEMBER(y_update_tick);
+ TIMER_CALLBACK_MEMBER(hblank_on);
+ TIMER_CALLBACK_MEMBER(hblank_off);
+private:
void initialize_palette();
int get_field_vpos();
int get_field();
diff --git a/src/mame/video/vectrex.cpp b/src/mame/video/vectrex.cpp
index 4bd797320aa..37c929102d1 100644
--- a/src/mame/video/vectrex.cpp
+++ b/src/mame/video/vectrex.cpp
@@ -73,12 +73,12 @@ TIMER_CALLBACK_MEMBER(vectrex_base_state::lightpen_trigger)
*********************************************************************/
-uint8_t vectrex_base_state::vectrex_via_r(offs_t offset)
+uint8_t vectrex_base_state::via_r(offs_t offset)
{
return m_via6522_0->read(offset);
}
-void vectrex_base_state::vectrex_via_w(offs_t offset, uint8_t data)
+void vectrex_base_state::via_w(offs_t offset, uint8_t data)
{
attotime period;
@@ -96,10 +96,7 @@ void vectrex_base_state::vectrex_via_w(offs_t offset, uint8_t data)
if (m_reset_refresh)
m_refresh->adjust(period, 0, period);
else
- m_refresh->adjust(
- std::min(period, m_refresh->remaining()),
- 0,
- period);
+ m_refresh->adjust(std::min(period, m_refresh->remaining()), 0, period);
break;
}
m_via6522_0->write(offset, data);
@@ -112,7 +109,7 @@ void vectrex_base_state::vectrex_via_w(offs_t offset, uint8_t data)
*********************************************************************/
-TIMER_CALLBACK_MEMBER(vectrex_base_state::vectrex_refresh)
+TIMER_CALLBACK_MEMBER(vectrex_base_state::refresh)
{
/* Refresh only marks the range of vectors which will be drawn
* during the next screen_update. */
@@ -121,9 +118,9 @@ TIMER_CALLBACK_MEMBER(vectrex_base_state::vectrex_refresh)
}
-uint32_t vectrex_base_state::screen_update_vectrex(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
+uint32_t vectrex_base_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
- vectrex_configuration();
+ screen_configuration();
/* start black */
m_vector->add_point(m_points[m_display_start].x,
@@ -151,7 +148,7 @@ uint32_t vectrex_base_state::screen_update_vectrex(screen_device &screen, bitmap
*********************************************************************/
-void vectrex_base_state::vectrex_add_point(int x, int y, rgb_t color, int intensity)
+void vectrex_base_state::add_point(int x, int y, rgb_t color, int intensity)
{
vectrex_point *newpoint;
@@ -165,22 +162,16 @@ void vectrex_base_state::vectrex_add_point(int x, int y, rgb_t color, int intens
}
-void vectrex_base_state::vectrex_add_point_stereo(int x, int y, rgb_t color, int intensity)
+void vectrex_base_state::add_point_stereo(int x, int y, rgb_t color, int intensity)
{
if (m_imager_status == 2) /* left = 1, right = 2 */
- vectrex_add_point((int)(y * M_SQRT1_2)+ m_x_center,
- (int)(((m_x_max - x) * M_SQRT1_2)),
- color,
- intensity);
+ add_point((int)(y * M_SQRT1_2)+ m_x_center, (int)(((m_x_max - x) * M_SQRT1_2)), color, intensity);
else
- vectrex_add_point((int)(y * M_SQRT1_2),
- (int)((m_x_max - x) * M_SQRT1_2),
- color,
- intensity);
+ add_point((int)(y * M_SQRT1_2), (int)((m_x_max - x) * M_SQRT1_2), color, intensity);
}
-TIMER_CALLBACK_MEMBER(vectrex_base_state::vectrex_zero_integrators)
+TIMER_CALLBACK_MEMBER(vectrex_base_state::zero_integrators)
{
m_x_int = m_x_center + (m_analog[A_ZR] * INT_PER_CLOCK);
m_y_int = m_y_center + (m_analog[A_ZR] * INT_PER_CLOCK);
@@ -237,9 +228,12 @@ void vectrex_base_state::video_start()
m_x_max = visarea.max_x << 16;
m_y_max = visarea.max_y << 16;
- vector_add_point_function = &vectrex_base_state::vectrex_add_point;
+ vector_add_point_function = &vectrex_base_state::add_point;
- m_refresh = timer_alloc(TIMER_VECTREX_REFRESH);
+ m_refresh = timer_alloc(FUNC(vectrex_base_state::refresh), this);
+ m_zero_integrators_timer = timer_alloc(FUNC(vectrex_base_state::zero_integrators), this);
+ m_update_blank_timer = timer_alloc(FUNC(vectrex_base_state::update_blank), this);
+ m_update_mux_enable_timer = timer_alloc(FUNC(vectrex_base_state::update_mux_enable), this);
m_display_start = 0;
m_display_end = 0;
@@ -257,10 +251,19 @@ void vectrex_state::video_start()
m_imager_freq = 1;
- m_imager_timer = timer_alloc(TIMER_VECTREX_IMAGER_EYE);
- m_imager_timer->adjust(attotime::from_hz(m_imager_freq), 2, attotime::from_hz(m_imager_freq));
+ m_imager_eye_timer = timer_alloc(FUNC(vectrex_state::imager_eye), this);
+ m_imager_index_timer = timer_alloc(FUNC(vectrex_state::imager_index), this);
+ m_imager_index_timer->adjust(attotime::from_hz(m_imager_freq), 2, attotime::from_hz(m_imager_freq));
- m_lp_t = timer_alloc(TIMER_LIGHTPEN_TRIGGER);
+ for (int i = 0; i < 3; i++)
+ {
+ m_imager_color_timers[i] = timer_alloc(FUNC(vectrex_state::imager_change_color), this);
+ m_imager_color_timers[i]->adjust(attotime::never);
+ }
+
+ m_imager_level_timer = timer_alloc(FUNC(vectrex_state::update_level), this);
+
+ m_lp_t = timer_alloc(FUNC(vectrex_state::lightpen_trigger), this);
}
@@ -270,16 +273,16 @@ void vectrex_state::video_start()
*********************************************************************/
-void vectrex_base_state::vectrex_multiplexer(int mux)
+void vectrex_base_state::multiplexer(int mux)
{
- timer_set(attotime::from_nsec(ANALOG_DELAY), TIMER_UPDATE_ANALOG, mux);
+ machine().scheduler().timer_set(attotime::from_nsec(ANALOG_DELAY), timer_expired_delegate(FUNC(vectrex_base_state::update_analog), this), mux);
if (mux == A_AUDIO)
m_dac->write(m_via_out[PORTA] ^ 0x80); // not gate shown on schematic
}
-void vectrex_base_state::v_via_pb_w(uint8_t data)
+void vectrex_base_state::via_pb_w(uint8_t data)
{
if (!(data & 0x80))
{
@@ -327,7 +330,7 @@ void vectrex_base_state::v_via_pb_w(uint8_t data)
if (!(data & 0x1) && (m_via_out[PORTB] & 0x1))
{
/* MUX has been enabled */
- timer_set(attotime::from_nsec(ANALOG_DELAY), TIMER_UPDATE_MUX_ENABLE);
+ m_update_mux_enable_timer->adjust(attotime::from_nsec(ANALOG_DELAY));
}
}
else
@@ -355,35 +358,33 @@ void vectrex_base_state::v_via_pb_w(uint8_t data)
}
if (!(data & 0x1) && (m_via_out[PORTB] & 0x1))
- vectrex_multiplexer((data >> 1) & 0x3);
+ multiplexer((data >> 1) & 0x3);
m_via_out[PORTB] = data;
- timer_set(attotime::from_nsec(ANALOG_DELAY), TIMER_UPDATE_RAMP, data & 0x80);
+ machine().scheduler().timer_set(attotime::from_nsec(ANALOG_DELAY), timer_expired_delegate(FUNC(vectrex_base_state::update_ramp), this), data & 0x80);
}
-void vectrex_base_state::v_via_pa_w(uint8_t data)
+void vectrex_base_state::via_pa_w(uint8_t data)
{
/* DAC output always goes to Y integrator */
m_via_out[PORTA] = data;
- timer_set(attotime::from_nsec(ANALOG_DELAY), TIMER_UPDATE_ANALOG, A_Y);
+ machine().scheduler().timer_set(attotime::from_nsec(ANALOG_DELAY), timer_expired_delegate(FUNC(vectrex_base_state::update_analog), this), A_Y);
if (!(m_via_out[PORTB] & 0x1))
- vectrex_multiplexer((m_via_out[PORTB] >> 1) & 0x3);
+ multiplexer((m_via_out[PORTB] >> 1) & 0x3);
}
-WRITE_LINE_MEMBER(vectrex_base_state::v_via_ca2_w)
+WRITE_LINE_MEMBER(vectrex_base_state::via_ca2_w)
{
if (state == 0)
- timer_set(attotime::from_nsec(ANALOG_DELAY), TIMER_VECTREX_ZERO_INTEGRATORS);
+ m_zero_integrators_timer->adjust(attotime::from_nsec(ANALOG_DELAY));
}
-WRITE_LINE_MEMBER(vectrex_base_state::v_via_cb2_w)
+WRITE_LINE_MEMBER(vectrex_base_state::via_cb2_w)
{
- int dx, dy;
-
if (m_cb2 != state)
{
/* Check lightpen */
@@ -396,14 +397,14 @@ WRITE_LINE_MEMBER(vectrex_base_state::v_via_cb2_w)
m_pen_x = ioport("LPENX")->read() * (m_x_max / 0xff);
m_pen_y = ioport("LPENY")->read() * (m_y_max / 0xff);
- dx = abs(m_pen_x - m_x_int);
- dy = abs(m_pen_y - m_y_int);
+ int dx = abs(m_pen_x - m_x_int);
+ int dy = abs(m_pen_y - m_y_int);
if (dx < 500000 && dy < 500000 && state > 0)
- timer_set(attotime::zero, TIMER_LIGHTPEN_TRIGGER);
+ m_lp_t->adjust(attotime::zero);
}
}
- timer_set(attotime::zero, TIMER_UPDATE_BLANK, state);
+ m_update_blank_timer->adjust(attotime::zero, state);
m_cb2 = state;
}
}
diff --git a/src/mame/video/victory.cpp b/src/mame/video/victory.cpp
index c8179b29e18..638e061df6f 100644
--- a/src/mame/video/victory.cpp
+++ b/src/mame/video/victory.cpp
@@ -48,7 +48,7 @@ void victory_state::video_start()
m_video_control = 0;
memset(&m_micro, 0, sizeof(m_micro));
m_micro.timer = machine().scheduler().timer_alloc(timer_expired_delegate());
- m_bgcoll_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(victory_state::bgcoll_irq_callback), this));
+ m_bgcoll_irq_timer = timer_alloc(FUNC(victory_state::bgcoll_irq_callback), this);
/* register for state saving */
save_item(NAME(m_paletteram));
diff --git a/src/mame/video/vtvideo.cpp b/src/mame/video/vtvideo.cpp
index 7480691e83b..8afe52f9b82 100644
--- a/src/mame/video/vtvideo.cpp
+++ b/src/mame/video/vtvideo.cpp
@@ -111,11 +111,11 @@ void vt100_video_device::device_start()
m_write_lba7.resolve_safe();
// LBA7 is scan line frequency update
- m_lba7_change_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vt100_video_device::lba7_change), this));
+ m_lba7_change_timer = timer_alloc(FUNC(vt100_video_device::lba7_change), this);
m_lba7_change_timer->adjust(clocks_to_attotime(765), 0, clocks_to_attotime(765));
// LBA3 and LBA4 are first two stages of divide-by-17 counter
- m_lba3_change_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vt100_video_device::lba3_change), this));
+ m_lba3_change_timer = timer_alloc(FUNC(vt100_video_device::lba3_change), this);
screen().register_vblank_callback(vblank_state_delegate(&vt100_video_device::vblank_callback, this));
diff --git a/src/mame/video/wswan.cpp b/src/mame/video/wswan.cpp
index a88d6463b0d..7825e9a48cb 100644
--- a/src/mame/video/wswan.cpp
+++ b/src/mame/video/wswan.cpp
@@ -90,7 +90,7 @@ void wswan_video_device::device_start()
{
screen().register_screen_bitmap(m_bitmap);
- m_timer = timer_alloc(TIMER_SCANLINE);
+ m_timer = timer_alloc(FUNC(wswan_video_device::scanline_interrupt), this);
m_timer->adjust(attotime::from_ticks(256, clock()), 0, attotime::from_ticks(256, clock()));
// bind callbacks
@@ -167,17 +167,6 @@ void wswan_video_device::device_reset()
}
-void wswan_video_device::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_SCANLINE:
- scanline_interrupt();
- break;
- }
-}
-
-
void wswan_video_device::setup_palettes()
{
if (m_color_mode)
@@ -1115,7 +1104,7 @@ void wswan_video_device::reg_w(offs_t offset, u16 data, u16 mem_mask)
}
-void wswan_video_device::scanline_interrupt()
+TIMER_CALLBACK_MEMBER(wswan_video_device::scanline_interrupt)
{
if (m_current_line < 144)
refresh_scanline();
diff --git a/src/mame/video/wswan.h b/src/mame/video/wswan.h
index 1ca7e77b91d..8231573bbdd 100644
--- a/src/mame/video/wswan.h
+++ b/src/mame/video/wswan.h
@@ -52,7 +52,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
void setup_palettes();
void draw_background();
@@ -61,7 +60,7 @@ protected:
void draw_foreground_3();
void handle_sprites(int mask);
void refresh_scanline();
- void scanline_interrupt();
+ TIMER_CALLBACK_MEMBER(scanline_interrupt);
void common_save();
u16 swap_bytes(u16 word);
@@ -121,9 +120,6 @@ protected:
devcb_write8 m_icons_cb;
- // timer IDs
- static constexpr device_timer_id TIMER_SCANLINE = 0;
-
// interrupt flags
// these are the same as the wswan.h ones
static constexpr u8 WSWAN_VIDEO_IFLAG_LCMP = 0x10;
diff --git a/src/mame/video/x68k_crtc.cpp b/src/mame/video/x68k_crtc.cpp
index 72697c3b430..92480bc35ef 100644
--- a/src/mame/video/x68k_crtc.cpp
+++ b/src/mame/video/x68k_crtc.cpp
@@ -70,11 +70,11 @@ void x68k_crtc_device::device_resolve_objects()
void x68k_crtc_device::device_start()
{
- m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x68k_crtc_device::hsync), this));
- m_operation_end_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x68k_crtc_device::operation_end), this));
- m_raster_end_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x68k_crtc_device::raster_end), this));
- m_raster_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x68k_crtc_device::raster_irq), this));
- m_vblank_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x68k_crtc_device::vblank_irq), this));
+ m_scanline_timer = timer_alloc(FUNC(x68k_crtc_device::hsync), this);
+ m_operation_end_timer = timer_alloc(FUNC(x68k_crtc_device::operation_end), this);
+ m_raster_end_timer = timer_alloc(FUNC(x68k_crtc_device::raster_end), this);
+ m_raster_irq_timer = timer_alloc(FUNC(x68k_crtc_device::raster_irq), this);
+ m_vblank_irq_timer = timer_alloc(FUNC(x68k_crtc_device::vblank_irq), this);
// save state
save_item(NAME(m_reg));
diff --git a/src/mame/video/ygv608.cpp b/src/mame/video/ygv608.cpp
index b07273a0641..e8d08639717 100644
--- a/src/mame/video/ygv608.cpp
+++ b/src/mame/video/ygv608.cpp
@@ -483,8 +483,8 @@ void ygv608_device::device_start()
// TODO: tagging configuration
m_vblank_handler.resolve();
m_raster_handler.resolve();
- m_vblank_timer = timer_alloc(VBLANK_TIMER);
- m_raster_timer = timer_alloc(RASTER_TIMER);
+ m_vblank_timer = timer_alloc(FUNC(ygv608_device::update_vblank_flag), this);
+ m_raster_timer = timer_alloc(FUNC(ygv608_device::update_raster_flag), this);
register_state_save();
}
@@ -513,31 +513,22 @@ inline void ygv608_device::raster_irq_check()
m_raster_handler(ASSERT_LINE);
}
+TIMER_CALLBACK_MEMBER(ygv608_device::update_vblank_flag)
+{
+ m_screen_status |= 8; // FV
+ vblank_irq_check();
+}
-void ygv608_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(ygv608_device::update_raster_flag)
{
- switch(id)
- {
- case VBLANK_TIMER:
- {
- m_screen_status |= 8; // FV
- vblank_irq_check();
- break;
- }
- case RASTER_TIMER:
- {
- m_screen_status |= 0x10; // FP
- raster_irq_check();
+ m_screen_status |= 0x10; // FP
+ raster_irq_check();
- // adjust for next one shot
- m_raster_timer->reset();
- m_raster_timer->adjust(raster_sync_offset(), 0);
- break;
- }
- }
+ // adjust for next one shot
+ m_raster_timer->reset();
+ m_raster_timer->adjust(raster_sync_offset(), 0);
}
-
void ygv608_device::set_gfxbank(uint8_t gfxbank)
{
m_namcond1_gfxbank = gfxbank;
diff --git a/src/mame/video/ygv608.h b/src/mame/video/ygv608.h
index b0d21957f43..99ade70c34c 100644
--- a/src/mame/video/ygv608.h
+++ b/src/mame/video/ygv608.h
@@ -105,7 +105,9 @@ protected:
virtual uint32_t palette_entries() const override { return 256; }
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
+ TIMER_CALLBACK_MEMBER(update_vblank_flag);
+ TIMER_CALLBACK_MEMBER(update_raster_flag);
+
address_space *m_iospace;
private:
diff --git a/src/mame/video/zx.cpp b/src/mame/video/zx.cpp
index 6bb70c706b8..6ec6545623b 100644
--- a/src/mame/video/zx.cpp
+++ b/src/mame/video/zx.cpp
@@ -22,23 +22,7 @@
#include "includes/zx.h"
-void zx_state::device_timer(emu_timer &timer, device_timer_id id, int param)
-{
- switch (id)
- {
- case TIMER_TAPE_INPUT:
- zx_tape_input();
- break;
- case TIMER_ULA_HSYNC:
- zx_ula_hsync();
- break;
- default:
- throw emu_fatalerror("Unknown id in zx_state::device_timer");
- }
-}
-
-
-void zx_state::zx_ula_hsync()
+TIMER_CALLBACK_MEMBER(zx_state::zx_ula_hsync)
{
m_hsync_active = !m_hsync_active;
if(m_hsync_active)
@@ -136,7 +120,7 @@ uint8_t zx_state::ula_high_r(offs_t offset)
void zx_state::video_start()
{
- m_ula_hsync = timer_alloc(TIMER_ULA_HSYNC);
+ m_ula_hsync = timer_alloc(FUNC(zx_state::zx_ula_hsync), this);
m_ula_char_buffer = 0xffff;
m_bitmap_render = std::make_unique<bitmap_ind16>(384, 311);
diff --git a/src/mame/video/zx8301.cpp b/src/mame/video/zx8301.cpp
index 68b19a33e1c..419412c0476 100644
--- a/src/mame/video/zx8301.cpp
+++ b/src/mame/video/zx8301.cpp
@@ -137,8 +137,8 @@ void zx8301_device::device_start()
m_write_vsync.resolve_safe();
// allocate timers
- m_vsync_timer = timer_alloc(TIMER_VSYNC);
- m_flash_timer = timer_alloc(TIMER_FLASH);
+ m_vsync_timer = timer_alloc(FUNC(zx8301_device::output_vsync), this);
+ m_flash_timer = timer_alloc(FUNC(zx8301_device::toggle_flash), this);
// adjust timer periods
m_vsync_timer->adjust(attotime::zero, 0, attotime::from_hz(50));
@@ -155,22 +155,18 @@ void zx8301_device::device_start()
//-------------------------------------------------
-// device_timer - handler timer events
+// timer events
//-------------------------------------------------
-void zx8301_device::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(zx8301_device::output_vsync)
{
- switch (id)
- {
- case TIMER_VSYNC:
- //m_vsync = !m_vsync;
- m_write_vsync(m_vsync);
- break;
-
- case TIMER_FLASH:
- m_flash = !m_flash;
- break;
- }
+ //m_vsync = !m_vsync;
+ m_write_vsync(m_vsync);
+}
+
+TIMER_CALLBACK_MEMBER(zx8301_device::toggle_flash)
+{
+ m_flash = !m_flash;
}
diff --git a/src/mame/video/zx8301.h b/src/mame/video/zx8301.h
index 1677f6948db..86c722a80dc 100644
--- a/src/mame/video/zx8301.h
+++ b/src/mame/video/zx8301.h
@@ -67,7 +67,6 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
// device_config_memory_interface overrides
virtual space_config_vector memory_space_config() const override;
@@ -75,6 +74,9 @@ protected:
// address space configurations
const address_space_config m_space_config;
+ TIMER_CALLBACK_MEMBER(output_vsync);
+ TIMER_CALLBACK_MEMBER(toggle_flash);
+
inline uint8_t readbyte(offs_t address);
inline void writebyte(offs_t address, uint8_t data);
@@ -82,12 +84,6 @@ protected:
void draw_line_mode8(bitmap_rgb32 &bitmap, int y, uint16_t da);
private:
- enum
- {
- TIMER_VSYNC,
- TIMER_FLASH
- };
-
required_device<cpu_device> m_cpu;
devcb_write_line m_write_vsync;
diff --git a/src/osd/osdnet.cpp b/src/osd/osdnet.cpp
index 97b37366a4d..39f0da3b343 100644
--- a/src/osd/osdnet.cpp
+++ b/src/osd/osdnet.cpp
@@ -38,7 +38,7 @@ class osd_netdev *open_netdev(int id, class device_network_interface *ifdev, int
osd_netdev::osd_netdev(class device_network_interface *ifdev, int rate)
{
m_dev = ifdev;
- m_timer = ifdev->device().machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(osd_netdev::recv), this));
+ m_timer = ifdev->device().timer_alloc(FUNC(osd_netdev::recv), this);
m_timer->adjust(attotime::from_hz(rate), 0, attotime::from_hz(rate));
}