summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/machine
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2017-05-07 23:18:47 +1000
committer Vas Crabb <vas@vastheman.com>2017-05-14 21:44:11 +1000
commit0f0d39ef81562c75e79176dd3bebb1e491ca39d5 (patch)
tree201cee7fdf55ee800f83859a92efd2cfe66cf2b3 /src/devices/machine
parente6c4be2b4d71c7a6c95be0bae111eb416ff0f9e7 (diff)
Move static data out of devices into the device types. This is a significant change, so please pay attention.
The core changes are: * Short name, full name and source file are no longer members of device_t, they are part of the device type * MACHINE_COFIG_START no longer needs a driver class * MACHINE_CONFIG_DERIVED_CLASS is no longer necessary * Specify the state class you want in the GAME/COMP/CONS line * The compiler will work out the base class where the driver init member is declared * There is one static device type object per driver rather than one per machine configuration Use DECLARE_DEVICE_TYPE or DECLARE_DEVICE_TYPE_NS to declare device type. * DECLARE_DEVICE_TYPE forward-declares teh device type and class, and declares extern object finders. * DECLARE_DEVICE_TYPE_NS is for devices classes in namespaces - it doesn't forward-declare the device type. Use DEFINE_DEVICE_TYPE or DEFINE_DEVICE_TYPE_NS to define device types. * These macros declare storage for the static data, and instantiate the device type and device finder templates. The rest of the changes are mostly just moving stuff out of headers that shouldn't be there, renaming stuff for consistency, and scoping stuff down where appropriate. Things I've actually messed with substantially: * More descriptive names for a lot of devices * Untangled the fantasy sound from the driver state, which necessitates breaking up sound/flip writes * Changed DECO BSMT2000 ready callback into a device delegate * Untangled Microprose 3D noise from driver state * Used object finders for CoCo multipak, KC85 D002, and Irem sound subdevices * Started to get TI-99 stuff out of the TI-990 directory and arrange bus devices properly * Started to break out common parts of Samsung ARM SoC devices * Turned some of FM, SID, SCSP DSP, EPIC12 and Voodoo cores into something resmbling C++ * Tried to make Z180 table allocation/setup a bit safer * Converted generic keyboard/terminal to not use WRITE8 - space/offset aren't relevant * Dynamically allocate generic terminal buffer so derived devices (e.g. teleprinter) can specify size * Imporved encapsulation of Z80DART channels * Refactored the SPC7110 bit table generator loop to make it more readable * Added wrappers for SNES PPU operations so members can be made protected * Factored out some boilerplate for YM chips with PSG * toaplan2 gfx * stic/intv resolution * Video System video * Out Run/Y-board sprite alignment * GIC video hookup * Amstrad CPC ROM box members * IQ151 ROM cart region * MSX cart IRQ callback resolution time * SMS passthrough control devices starting subslots I've smoke-tested several drivers, but I've probably missed something. Things I've missed will likely blow up spectacularly with failure to bind errors and the like. Let me know if there's more subtle breakage (could have happened in FM or Voodoo). And can everyone please, please try to keep stuff clean. In particular, please stop polluting the global namespace. Keep things out of headers that don't need to be there, and use things that can be scoped down rather than macros. It feels like an uphill battle trying to get this stuff under control while more of it's added.
Diffstat (limited to 'src/devices/machine')
-rw-r--r--src/devices/machine/40105.cpp4
-rw-r--r--src/devices/machine/40105.h17
-rw-r--r--src/devices/machine/53c7xx.cpp49
-rw-r--r--src/devices/machine/53c7xx.h64
-rw-r--r--src/devices/machine/53c810.cpp8
-rw-r--r--src/devices/machine/53c810.h40
-rw-r--r--src/devices/machine/64h156.cpp42
-rw-r--r--src/devices/machine/64h156.h19
-rw-r--r--src/devices/machine/6522via.cpp4
-rw-r--r--src/devices/machine/6522via.h78
-rw-r--r--src/devices/machine/6525tpi.cpp4
-rw-r--r--src/devices/machine/6525tpi.h31
-rw-r--r--src/devices/machine/6532riot.cpp4
-rw-r--r--src/devices/machine/6532riot.h2
-rw-r--r--src/devices/machine/68153bim.cpp46
-rw-r--r--src/devices/machine/68153bim.h33
-rw-r--r--src/devices/machine/6821pia.cpp7
-rw-r--r--src/devices/machine/6821pia.h13
-rw-r--r--src/devices/machine/68230pit.cpp53
-rw-r--r--src/devices/machine/68230pit.h106
-rw-r--r--src/devices/machine/68307.cpp145
-rw-r--r--src/devices/machine/68307.h131
-rw-r--r--src/devices/machine/68307bus.cpp150
-rw-r--r--src/devices/machine/68307bus.h20
-rw-r--r--src/devices/machine/68307sim.cpp294
-rw-r--r--src/devices/machine/68307sim.h59
-rw-r--r--src/devices/machine/68307tmu.cpp198
-rw-r--r--src/devices/machine/68307tmu.h41
-rw-r--r--src/devices/machine/68340.cpp77
-rw-r--r--src/devices/machine/68340.h55
-rw-r--r--src/devices/machine/68340dma.cpp32
-rw-r--r--src/devices/machine/68340dma.h11
-rw-r--r--src/devices/machine/68340ser.cpp31
-rw-r--r--src/devices/machine/68340ser.h11
-rw-r--r--src/devices/machine/68340sim.cpp453
-rw-r--r--src/devices/machine/68340sim.h56
-rw-r--r--src/devices/machine/68340tmu.cpp32
-rw-r--r--src/devices/machine/68340tmu.h11
-rw-r--r--src/devices/machine/6840ptm.cpp54
-rw-r--r--src/devices/machine/6840ptm.h16
-rw-r--r--src/devices/machine/6850acia.cpp68
-rw-r--r--src/devices/machine/6850acia.h21
-rw-r--r--src/devices/machine/68561mpcc.cpp28
-rw-r--r--src/devices/machine/68561mpcc.h49
-rw-r--r--src/devices/machine/7200fifo.cpp4
-rw-r--r--src/devices/machine/7200fifo.h17
-rw-r--r--src/devices/machine/7400.cpp4
-rw-r--r--src/devices/machine/7400.h19
-rw-r--r--src/devices/machine/7404.cpp4
-rw-r--r--src/devices/machine/7404.h23
-rw-r--r--src/devices/machine/74123.cpp20
-rw-r--r--src/devices/machine/74123.h13
-rw-r--r--src/devices/machine/74145.cpp4
-rw-r--r--src/devices/machine/74145.h32
-rw-r--r--src/devices/machine/74148.cpp19
-rw-r--r--src/devices/machine/74148.h10
-rw-r--r--src/devices/machine/74153.cpp7
-rw-r--r--src/devices/machine/74153.h14
-rw-r--r--src/devices/machine/74157.cpp12
-rw-r--r--src/devices/machine/74157.h18
-rw-r--r--src/devices/machine/74161.cpp20
-rw-r--r--src/devices/machine/74161.h35
-rw-r--r--src/devices/machine/74175.cpp12
-rw-r--r--src/devices/machine/74175.h37
-rw-r--r--src/devices/machine/74181.cpp4
-rw-r--r--src/devices/machine/74181.h11
-rw-r--r--src/devices/machine/7474.cpp4
-rw-r--r--src/devices/machine/7474.h16
-rw-r--r--src/devices/machine/8042kbdc.cpp4
-rw-r--r--src/devices/machine/8042kbdc.h36
-rw-r--r--src/devices/machine/82s129.cpp12
-rw-r--r--src/devices/machine/82s129.h26
-rw-r--r--src/devices/machine/8364_paula.cpp15
-rw-r--r--src/devices/machine/8364_paula.h19
-rw-r--r--src/devices/machine/8530scc.cpp5
-rw-r--r--src/devices/machine/8530scc.h10
-rw-r--r--src/devices/machine/aakart.cpp8
-rw-r--r--src/devices/machine/aakart.h40
-rw-r--r--src/devices/machine/adc0808.cpp7
-rw-r--r--src/devices/machine/adc0808.h79
-rw-r--r--src/devices/machine/adc083x.cpp28
-rw-r--r--src/devices/machine/adc083x.h33
-rw-r--r--src/devices/machine/adc1038.cpp5
-rw-r--r--src/devices/machine/adc1038.h22
-rw-r--r--src/devices/machine/adc1213x.cpp19
-rw-r--r--src/devices/machine/adc1213x.h28
-rw-r--r--src/devices/machine/aicartc.cpp8
-rw-r--r--src/devices/machine/aicartc.h25
-rw-r--r--src/devices/machine/akiko.cpp4
-rw-r--r--src/devices/machine/akiko.h37
-rw-r--r--src/devices/machine/am2847.cpp16
-rw-r--r--src/devices/machine/am2847.h18
-rw-r--r--src/devices/machine/am53cf96.cpp6
-rw-r--r--src/devices/machine/am53cf96.h56
-rw-r--r--src/devices/machine/am9517a.cpp201
-rw-r--r--src/devices/machine/am9517a.h86
-rw-r--r--src/devices/machine/amigafdc.cpp91
-rw-r--r--src/devices/machine/amigafdc.h18
-rw-r--r--src/devices/machine/appldriv.cpp8
-rw-r--r--src/devices/machine/appldriv.h20
-rw-r--r--src/devices/machine/applefdc.cpp12
-rw-r--r--src/devices/machine/applefdc.h14
-rw-r--r--src/devices/machine/at28c16.cpp18
-rw-r--r--src/devices/machine/at28c16.h17
-rw-r--r--src/devices/machine/at29x.cpp33
-rw-r--r--src/devices/machine/at29x.h51
-rw-r--r--src/devices/machine/at45dbxx.cpp22
-rw-r--r--src/devices/machine/at45dbxx.h22
-rw-r--r--src/devices/machine/at_keybc.cpp5
-rw-r--r--src/devices/machine/at_keybc.h23
-rw-r--r--src/devices/machine/atadev.cpp5
-rw-r--r--src/devices/machine/atadev.h17
-rw-r--r--src/devices/machine/ataflash.cpp20
-rw-r--r--src/devices/machine/ataflash.h23
-rw-r--r--src/devices/machine/atahle.cpp7
-rw-r--r--src/devices/machine/atahle.h14
-rw-r--r--src/devices/machine/ataintf.cpp30
-rw-r--r--src/devices/machine/ataintf.h27
-rw-r--r--src/devices/machine/atapicdr.cpp12
-rw-r--r--src/devices/machine/atapicdr.h19
-rw-r--r--src/devices/machine/atapihle.cpp4
-rw-r--r--src/devices/machine/atapihle.h17
-rw-r--r--src/devices/machine/autoconfig.h8
-rw-r--r--src/devices/machine/ay31015.cpp12
-rw-r--r--src/devices/machine/ay31015.h52
-rw-r--r--src/devices/machine/bankdev.cpp4
-rw-r--r--src/devices/machine/bankdev.h12
-rw-r--r--src/devices/machine/bcreader.cpp4
-rw-r--r--src/devices/machine/bcreader.h8
-rw-r--r--src/devices/machine/buffer.cpp6
-rw-r--r--src/devices/machine/buffer.h8
-rw-r--r--src/devices/machine/cdp1852.cpp7
-rw-r--r--src/devices/machine/cdp1852.h22
-rw-r--r--src/devices/machine/cdp1871.cpp4
-rw-r--r--src/devices/machine/cdp1871.h38
-rw-r--r--src/devices/machine/cdp1879.cpp4
-rw-r--r--src/devices/machine/cdp1879.h10
-rw-r--r--src/devices/machine/clock.cpp4
-rw-r--r--src/devices/machine/clock.h10
-rw-r--r--src/devices/machine/com8116.cpp17
-rw-r--r--src/devices/machine/com8116.h18
-rw-r--r--src/devices/machine/corvushd.cpp209
-rw-r--r--src/devices/machine/corvushd.h177
-rw-r--r--src/devices/machine/cr511b.cpp4
-rw-r--r--src/devices/machine/cr511b.h34
-rw-r--r--src/devices/machine/cr589.cpp8
-rw-r--r--src/devices/machine/cr589.h11
-rw-r--r--src/devices/machine/cs4031.cpp84
-rw-r--r--src/devices/machine/cs4031.h37
-rw-r--r--src/devices/machine/cs8221.cpp25
-rw-r--r--src/devices/machine/cs8221.h11
-rw-r--r--src/devices/machine/cxd1095.cpp8
-rw-r--r--src/devices/machine/cxd1095.h14
-rw-r--r--src/devices/machine/diablo_hd.cpp193
-rw-r--r--src/devices/machine/diablo_hd.h19
-rw-r--r--src/devices/machine/dm9334.cpp4
-rw-r--r--src/devices/machine/dm9334.h29
-rw-r--r--src/devices/machine/dmac.cpp134
-rw-r--r--src/devices/machine/dmac.h70
-rw-r--r--src/devices/machine/dp8390.cpp34
-rw-r--r--src/devices/machine/dp8390.h40
-rw-r--r--src/devices/machine/ds1204.cpp8
-rw-r--r--src/devices/machine/ds1204.h13
-rw-r--r--src/devices/machine/ds1205.cpp8
-rw-r--r--src/devices/machine/ds1205.h13
-rw-r--r--src/devices/machine/ds128x.cpp4
-rw-r--r--src/devices/machine/ds128x.h8
-rw-r--r--src/devices/machine/ds1302.cpp27
-rw-r--r--src/devices/machine/ds1302.h12
-rw-r--r--src/devices/machine/ds1315.cpp4
-rw-r--r--src/devices/machine/ds1315.h28
-rw-r--r--src/devices/machine/ds1386.cpp12
-rw-r--r--src/devices/machine/ds1386.h32
-rw-r--r--src/devices/machine/ds2401.cpp6
-rw-r--r--src/devices/machine/ds2401.h10
-rw-r--r--src/devices/machine/ds2404.cpp4
-rw-r--r--src/devices/machine/ds2404.h15
-rw-r--r--src/devices/machine/ds75160a.cpp4
-rw-r--r--src/devices/machine/ds75160a.h18
-rw-r--r--src/devices/machine/ds75161a.cpp4
-rw-r--r--src/devices/machine/ds75161a.h44
-rw-r--r--src/devices/machine/e0516.cpp8
-rw-r--r--src/devices/machine/e0516.h15
-rw-r--r--src/devices/machine/e05a03.cpp4
-rw-r--r--src/devices/machine/e05a03.h22
-rw-r--r--src/devices/machine/e05a30.cpp12
-rw-r--r--src/devices/machine/e05a30.h29
-rw-r--r--src/devices/machine/eeprom.cpp14
-rw-r--r--src/devices/machine/eeprom.h16
-rw-r--r--src/devices/machine/eeprompar.cpp13
-rw-r--r--src/devices/machine/eeprompar.h22
-rw-r--r--src/devices/machine/eepromser.cpp174
-rw-r--r--src/devices/machine/eepromser.h40
-rw-r--r--src/devices/machine/er2055.cpp4
-rw-r--r--src/devices/machine/er2055.h11
-rw-r--r--src/devices/machine/f3853.cpp15
-rw-r--r--src/devices/machine/f3853.h25
-rw-r--r--src/devices/machine/fdc37c665gt.cpp4
-rw-r--r--src/devices/machine/fdc37c665gt.h8
-rw-r--r--src/devices/machine/fdc_pll.h12
-rw-r--r--src/devices/machine/fga002.cpp28
-rw-r--r--src/devices/machine/fga002.h44
-rw-r--r--src/devices/machine/gayle.cpp4
-rw-r--r--src/devices/machine/gayle.h30
-rw-r--r--src/devices/machine/gen_latch.cpp22
-rw-r--r--src/devices/machine/gen_latch.h30
-rw-r--r--src/devices/machine/genpc.cpp31
-rw-r--r--src/devices/machine/genpc.h20
-rw-r--r--src/devices/machine/gt64xxx.cpp309
-rw-r--r--src/devices/machine/gt64xxx.h170
-rw-r--r--src/devices/machine/hd63450.cpp22
-rw-r--r--src/devices/machine/hd63450.h77
-rw-r--r--src/devices/machine/hd64610.cpp29
-rw-r--r--src/devices/machine/hd64610.h15
-rw-r--r--src/devices/machine/hdc92x4.cpp41
-rw-r--r--src/devices/machine/hdc92x4.h80
-rw-r--r--src/devices/machine/hp_taco.cpp86
-rw-r--r--src/devices/machine/hp_taco.h47
-rw-r--r--src/devices/machine/i2cmem.cpp8
-rw-r--r--src/devices/machine/i2cmem.h10
-rw-r--r--src/devices/machine/i6300esb.cpp8
-rw-r--r--src/devices/machine/i6300esb.h10
-rw-r--r--src/devices/machine/i80130.cpp4
-rw-r--r--src/devices/machine/i80130.h24
-rw-r--r--src/devices/machine/i8155.cpp4
-rw-r--r--src/devices/machine/i8155.h24
-rw-r--r--src/devices/machine/i8212.cpp27
-rw-r--r--src/devices/machine/i8212.h38
-rw-r--r--src/devices/machine/i8214.cpp27
-rw-r--r--src/devices/machine/i8214.h19
-rw-r--r--src/devices/machine/i82371sb.cpp4
-rw-r--r--src/devices/machine/i82371sb.h12
-rw-r--r--src/devices/machine/i8243.cpp9
-rw-r--r--src/devices/machine/i8243.h14
-rw-r--r--src/devices/machine/i82439hx.cpp4
-rw-r--r--src/devices/machine/i82439hx.h10
-rw-r--r--src/devices/machine/i82439tx.cpp4
-rw-r--r--src/devices/machine/i82439tx.h10
-rw-r--r--src/devices/machine/i8251.cpp29
-rw-r--r--src/devices/machine/i8251.h37
-rw-r--r--src/devices/machine/i82541.cpp4
-rw-r--r--src/devices/machine/i82541.h8
-rw-r--r--src/devices/machine/i8255.cpp63
-rw-r--r--src/devices/machine/i8255.h25
-rw-r--r--src/devices/machine/i8257.cpp30
-rw-r--r--src/devices/machine/i8257.h47
-rw-r--r--src/devices/machine/i8271.cpp4
-rw-r--r--src/devices/machine/i8271.h19
-rw-r--r--src/devices/machine/i8279.cpp13
-rw-r--r--src/devices/machine/i8279.h26
-rw-r--r--src/devices/machine/i82875p.cpp12
-rw-r--r--src/devices/machine/i82875p.h16
-rw-r--r--src/devices/machine/i8355.cpp16
-rw-r--r--src/devices/machine/i8355.h20
-rw-r--r--src/devices/machine/idectrl.cpp41
-rw-r--r--src/devices/machine/idectrl.h62
-rw-r--r--src/devices/machine/idehd.cpp13
-rw-r--r--src/devices/machine/idehd.h21
-rw-r--r--src/devices/machine/ie15.cpp48
-rw-r--r--src/devices/machine/ie15.h13
-rw-r--r--src/devices/machine/ie15_kbd.cpp12
-rw-r--r--src/devices/machine/ie15_kbd.h70
-rw-r--r--src/devices/machine/im6402.cpp34
-rw-r--r--src/devices/machine/im6402.h23
-rw-r--r--src/devices/machine/input_merger.cpp13
-rw-r--r--src/devices/machine/input_merger.h35
-rw-r--r--src/devices/machine/ins8154.cpp81
-rw-r--r--src/devices/machine/ins8154.h20
-rw-r--r--src/devices/machine/ins8250.cpp56
-rw-r--r--src/devices/machine/ins8250.h54
-rw-r--r--src/devices/machine/intelfsh.cpp140
-rw-r--r--src/devices/machine/intelfsh.h93
-rw-r--r--src/devices/machine/jvsdev.cpp4
-rw-r--r--src/devices/machine/jvsdev.h12
-rw-r--r--src/devices/machine/jvshost.cpp4
-rw-r--r--src/devices/machine/jvshost.h13
-rw-r--r--src/devices/machine/k033906.cpp4
-rw-r--r--src/devices/machine/k033906.h11
-rw-r--r--src/devices/machine/k053252.cpp4
-rw-r--r--src/devices/machine/k053252.h12
-rw-r--r--src/devices/machine/k054321.cpp4
-rw-r--r--src/devices/machine/k054321.h10
-rw-r--r--src/devices/machine/k056230.cpp4
-rw-r--r--src/devices/machine/k056230.h12
-rw-r--r--src/devices/machine/kb3600.cpp13
-rw-r--r--src/devices/machine/kb3600.h50
-rw-r--r--src/devices/machine/keyboard.cpp43
-rw-r--r--src/devices/machine/keyboard.h70
-rw-r--r--src/devices/machine/keyboard.ipp6
-rw-r--r--src/devices/machine/kr2376.cpp8
-rw-r--r--src/devices/machine/kr2376.h47
-rw-r--r--src/devices/machine/laserdsc.cpp20
-rw-r--r--src/devices/machine/laserdsc.h37
-rw-r--r--src/devices/machine/latch.cpp112
-rw-r--r--src/devices/machine/latch.h59
-rw-r--r--src/devices/machine/latch8.cpp41
-rw-r--r--src/devices/machine/latch8.h77
-rw-r--r--src/devices/machine/lc89510.cpp6
-rw-r--r--src/devices/machine/lc89510.h10
-rw-r--r--src/devices/machine/ldp1000.cpp6
-rw-r--r--src/devices/machine/ldp1000.h20
-rw-r--r--src/devices/machine/ldp1450.cpp6
-rw-r--r--src/devices/machine/ldp1450.h22
-rw-r--r--src/devices/machine/ldpr8210.cpp23
-rw-r--r--src/devices/machine/ldpr8210.h47
-rw-r--r--src/devices/machine/ldstub.cpp16
-rw-r--r--src/devices/machine/ldstub.h18
-rw-r--r--src/devices/machine/ldv1000.cpp4
-rw-r--r--src/devices/machine/ldv1000.h13
-rw-r--r--src/devices/machine/ldvp931.cpp4
-rw-r--r--src/devices/machine/ldvp931.h11
-rw-r--r--src/devices/machine/legscsi.cpp20
-rw-r--r--src/devices/machine/legscsi.h12
-rw-r--r--src/devices/machine/lh5810.cpp38
-rw-r--r--src/devices/machine/lh5810.h45
-rw-r--r--src/devices/machine/linflash.cpp28
-rw-r--r--src/devices/machine/linflash.h22
-rw-r--r--src/devices/machine/lpc-acpi.cpp4
-rw-r--r--src/devices/machine/lpc-acpi.h10
-rw-r--r--src/devices/machine/lpc-pit.cpp4
-rw-r--r--src/devices/machine/lpc-pit.h10
-rw-r--r--src/devices/machine/lpc-rtc.cpp4
-rw-r--r--src/devices/machine/lpc-rtc.h10
-rw-r--r--src/devices/machine/lpc.cpp9
-rw-r--r--src/devices/machine/lpc.h13
-rw-r--r--src/devices/machine/lpci.cpp22
-rw-r--r--src/devices/machine/lpci.h10
-rw-r--r--src/devices/machine/m6m80011ap.cpp12
-rw-r--r--src/devices/machine/m6m80011ap.h44
-rw-r--r--src/devices/machine/mb14241.cpp4
-rw-r--r--src/devices/machine/mb14241.h14
-rw-r--r--src/devices/machine/mb3773.cpp4
-rw-r--r--src/devices/machine/mb3773.h13
-rw-r--r--src/devices/machine/mb8421.cpp4
-rw-r--r--src/devices/machine/mb8421.h14
-rw-r--r--src/devices/machine/mb87078.cpp4
-rw-r--r--src/devices/machine/mb87078.h15
-rw-r--r--src/devices/machine/mb8795.cpp10
-rw-r--r--src/devices/machine/mb8795.h15
-rw-r--r--src/devices/machine/mb89352.cpp43
-rw-r--r--src/devices/machine/mb89352.h51
-rw-r--r--src/devices/machine/mb89363b.cpp5
-rw-r--r--src/devices/machine/mb89363b.h44
-rw-r--r--src/devices/machine/mb89371.cpp6
-rw-r--r--src/devices/machine/mb89371.h11
-rw-r--r--src/devices/machine/mc146818.cpp33
-rw-r--r--src/devices/machine/mc146818.h20
-rw-r--r--src/devices/machine/mc2661.cpp24
-rw-r--r--src/devices/machine/mc2661.h28
-rw-r--r--src/devices/machine/mc68328.cpp376
-rw-r--r--src/devices/machine/mc68328.h761
-rw-r--r--src/devices/machine/mc6843.cpp92
-rw-r--r--src/devices/machine/mc6843.h13
-rw-r--r--src/devices/machine/mc6846.cpp59
-rw-r--r--src/devices/machine/mc6846.h23
-rw-r--r--src/devices/machine/mc6852.cpp36
-rw-r--r--src/devices/machine/mc6852.h20
-rw-r--r--src/devices/machine/mc6854.cpp115
-rw-r--r--src/devices/machine/mc6854.h40
-rw-r--r--src/devices/machine/mc68681.cpp41
-rw-r--r--src/devices/machine/mc68681.h42
-rw-r--r--src/devices/machine/mc68901.cpp151
-rw-r--r--src/devices/machine/mc68901.h30
-rw-r--r--src/devices/machine/mccs1850.cpp38
-rw-r--r--src/devices/machine/mccs1850.h18
-rw-r--r--src/devices/machine/mcf5206e.cpp4
-rw-r--r--src/devices/machine/mcf5206e.h63
-rw-r--r--src/devices/machine/microtch.cpp19
-rw-r--r--src/devices/machine/microtch.h18
-rw-r--r--src/devices/machine/mm5740.cpp4
-rw-r--r--src/devices/machine/mm5740.h85
-rw-r--r--src/devices/machine/mm58167.cpp4
-rw-r--r--src/devices/machine/mm58167.h12
-rw-r--r--src/devices/machine/mm58274c.cpp8
-rw-r--r--src/devices/machine/mm58274c.h10
-rw-r--r--src/devices/machine/mm74c922.cpp21
-rw-r--r--src/devices/machine/mm74c922.h24
-rw-r--r--src/devices/machine/mos6526.cpp32
-rw-r--r--src/devices/machine/mos6526.h39
-rw-r--r--src/devices/machine/mos6529.cpp29
-rw-r--r--src/devices/machine/mos6529.h24
-rw-r--r--src/devices/machine/mos6530.cpp4
-rw-r--r--src/devices/machine/mos6530.h44
-rw-r--r--src/devices/machine/mos6530n.cpp345
-rw-r--r--src/devices/machine/mos6530n.h197
-rw-r--r--src/devices/machine/mos6551.cpp32
-rw-r--r--src/devices/machine/mos6551.h20
-rw-r--r--src/devices/machine/mos6702.cpp13
-rw-r--r--src/devices/machine/mos6702.h17
-rw-r--r--src/devices/machine/mos8706.cpp13
-rw-r--r--src/devices/machine/mos8706.h15
-rw-r--r--src/devices/machine/mos8722.cpp14
-rw-r--r--src/devices/machine/mos8722.h22
-rw-r--r--src/devices/machine/mos8726.cpp13
-rw-r--r--src/devices/machine/mos8726.h16
-rw-r--r--src/devices/machine/mpu401.cpp4
-rw-r--r--src/devices/machine/mpu401.h28
-rw-r--r--src/devices/machine/msm5832.cpp30
-rw-r--r--src/devices/machine/msm5832.h18
-rw-r--r--src/devices/machine/msm58321.cpp35
-rw-r--r--src/devices/machine/msm58321.h16
-rw-r--r--src/devices/machine/msm6242.cpp61
-rw-r--r--src/devices/machine/msm6242.h36
-rw-r--r--src/devices/machine/msm6253.cpp16
-rw-r--r--src/devices/machine/msm6253.h32
-rw-r--r--src/devices/machine/ncr5380.cpp26
-rw-r--r--src/devices/machine/ncr5380.h12
-rw-r--r--src/devices/machine/ncr5380n.cpp13
-rw-r--r--src/devices/machine/ncr5380n.h14
-rw-r--r--src/devices/machine/ncr5390.cpp11
-rw-r--r--src/devices/machine/ncr5390.h14
-rw-r--r--src/devices/machine/ncr539x.cpp132
-rw-r--r--src/devices/machine/ncr539x.h20
-rw-r--r--src/devices/machine/netlist.cpp611
-rw-r--r--src/devices/machine/netlist.h259
-rw-r--r--src/devices/machine/nmc9306.cpp33
-rw-r--r--src/devices/machine/nmc9306.h22
-rw-r--r--src/devices/machine/nsc810.cpp90
-rw-r--r--src/devices/machine/nsc810.h31
-rw-r--r--src/devices/machine/nscsi_bus.cpp20
-rw-r--r--src/devices/machine/nscsi_bus.h34
-rw-r--r--src/devices/machine/nscsi_cb.cpp4
-rw-r--r--src/devices/machine/nscsi_cb.h30
-rw-r--r--src/devices/machine/nscsi_cd.cpp4
-rw-r--r--src/devices/machine/nscsi_cd.h10
-rw-r--r--src/devices/machine/nscsi_hd.cpp8
-rw-r--r--src/devices/machine/nscsi_hd.h13
-rw-r--r--src/devices/machine/nscsi_s1410.cpp4
-rw-r--r--src/devices/machine/nscsi_s1410.h10
-rw-r--r--src/devices/machine/nvram.cpp8
-rw-r--r--src/devices/machine/nvram.h28
-rw-r--r--src/devices/machine/pc_fdc.cpp12
-rw-r--r--src/devices/machine/pc_fdc.h24
-rw-r--r--src/devices/machine/pc_lpt.cpp4
-rw-r--r--src/devices/machine/pc_lpt.h12
-rw-r--r--src/devices/machine/pccard.cpp4
-rw-r--r--src/devices/machine/pccard.h13
-rw-r--r--src/devices/machine/pcf8593.cpp8
-rw-r--r--src/devices/machine/pcf8593.h10
-rw-r--r--src/devices/machine/pci-apic.cpp4
-rw-r--r--src/devices/machine/pci-apic.h10
-rw-r--r--src/devices/machine/pci-ide.cpp4
-rw-r--r--src/devices/machine/pci-ide.h13
-rw-r--r--src/devices/machine/pci-sata.cpp4
-rw-r--r--src/devices/machine/pci-sata.h10
-rw-r--r--src/devices/machine/pci-smbus.cpp4
-rw-r--r--src/devices/machine/pci-smbus.h8
-rw-r--r--src/devices/machine/pci-usb.cpp12
-rw-r--r--src/devices/machine/pci-usb.h14
-rw-r--r--src/devices/machine/pci.cpp37
-rw-r--r--src/devices/machine/pci.h67
-rw-r--r--src/devices/machine/pci9050.cpp4
-rw-r--r--src/devices/machine/pci9050.h18
-rw-r--r--src/devices/machine/pckeybrd.cpp81
-rw-r--r--src/devices/machine/pckeybrd.h49
-rw-r--r--src/devices/machine/pdc.cpp4
-rw-r--r--src/devices/machine/pdc.h17
-rw-r--r--src/devices/machine/phi.cpp21
-rw-r--r--src/devices/machine/phi.h25
-rw-r--r--src/devices/machine/pic8259.cpp84
-rw-r--r--src/devices/machine/pic8259.h18
-rw-r--r--src/devices/machine/pit8253.cpp19
-rw-r--r--src/devices/machine/pit8253.h22
-rw-r--r--src/devices/machine/pla.cpp23
-rw-r--r--src/devices/machine/pla.h67
-rw-r--r--src/devices/machine/r10696.cpp17
-rw-r--r--src/devices/machine/r10696.h20
-rw-r--r--src/devices/machine/r10788.cpp55
-rw-r--r--src/devices/machine/r10788.h18
-rw-r--r--src/devices/machine/ra17xx.cpp21
-rw-r--r--src/devices/machine/ra17xx.h29
-rw-r--r--src/devices/machine/ram.cpp8
-rw-r--r--src/devices/machine/ram.h17
-rw-r--r--src/devices/machine/rescap.h6
-rw-r--r--src/devices/machine/rf5c296.cpp4
-rw-r--r--src/devices/machine/rf5c296.h10
-rw-r--r--src/devices/machine/roc10937.cpp66
-rw-r--r--src/devices/machine/roc10937.h65
-rw-r--r--src/devices/machine/rp5c01.cpp4
-rw-r--r--src/devices/machine/rp5c01.h14
-rw-r--r--src/devices/machine/rp5c15.cpp38
-rw-r--r--src/devices/machine/rp5c15.h16
-rw-r--r--src/devices/machine/rp5h01.cpp4
-rw-r--r--src/devices/machine/rp5h01.h20
-rw-r--r--src/devices/machine/rtc4543.cpp80
-rw-r--r--src/devices/machine/rtc4543.h29
-rw-r--r--src/devices/machine/rtc65271.cpp8
-rw-r--r--src/devices/machine/rtc65271.h30
-rw-r--r--src/devices/machine/rtc9701.cpp18
-rw-r--r--src/devices/machine/rtc9701.h59
-rw-r--r--src/devices/machine/s2636.cpp6
-rw-r--r--src/devices/machine/s2636.h27
-rw-r--r--src/devices/machine/s3520cf.cpp7
-rw-r--r--src/devices/machine/s3520cf.h47
-rw-r--r--src/devices/machine/s3c2400.cpp170
-rw-r--r--src/devices/machine/s3c2400.h554
-rw-r--r--src/devices/machine/s3c2410.cpp236
-rw-r--r--src/devices/machine/s3c2410.h649
-rw-r--r--src/devices/machine/s3c2440.cpp241
-rw-r--r--src/devices/machine/s3c2440.h624
-rw-r--r--src/devices/machine/s3c24xx.cpp190
-rw-r--r--src/devices/machine/s3c24xx.h309
-rw-r--r--src/devices/machine/s3c24xx.hxx1661
-rw-r--r--src/devices/machine/s3c44b0.cpp206
-rw-r--r--src/devices/machine/s3c44b0.h845
-rw-r--r--src/devices/machine/scnxx562.cpp614
-rw-r--r--src/devices/machine/scnxx562.h100
-rw-r--r--src/devices/machine/serflash.cpp20
-rw-r--r--src/devices/machine/serflash.h43
-rw-r--r--src/devices/machine/smartmed.cpp73
-rw-r--r--src/devices/machine/smartmed.h231
-rw-r--r--src/devices/machine/smc91c9x.cpp14
-rw-r--r--src/devices/machine/smc91c9x.h43
-rw-r--r--src/devices/machine/sonydriv.cpp7
-rw-r--r--src/devices/machine/sonydriv.h23
-rw-r--r--src/devices/machine/spchrom.cpp4
-rw-r--r--src/devices/machine/spchrom.h11
-rw-r--r--src/devices/machine/steppers.cpp12
-rw-r--r--src/devices/machine/steppers.h37
-rw-r--r--src/devices/machine/strata.cpp9
-rw-r--r--src/devices/machine/strata.h14
-rw-r--r--src/devices/machine/t10mmc.h8
-rw-r--r--src/devices/machine/t10sbc.h8
-rw-r--r--src/devices/machine/t10spc.h10
-rw-r--r--src/devices/machine/tc009xlvc.cpp4
-rw-r--r--src/devices/machine/tc009xlvc.h33
-rw-r--r--src/devices/machine/terminal.cpp54
-rw-r--r--src/devices/machine/terminal.h39
-rw-r--r--src/devices/machine/timekpr.cpp28
-rw-r--r--src/devices/machine/timekpr.h34
-rw-r--r--src/devices/machine/tmc0430.cpp8
-rw-r--r--src/devices/machine/tmc0430.h20
-rw-r--r--src/devices/machine/tmp68301.cpp4
-rw-r--r--src/devices/machine/tmp68301.h39
-rw-r--r--src/devices/machine/tms1024.cpp21
-rw-r--r--src/devices/machine/tms1024.h57
-rw-r--r--src/devices/machine/tms5501.cpp4
-rw-r--r--src/devices/machine/tms5501.h19
-rw-r--r--src/devices/machine/tms6100.cpp22
-rw-r--r--src/devices/machine/tms6100.h18
-rw-r--r--src/devices/machine/tms9901.cpp275
-rw-r--r--src/devices/machine/tms9901.h141
-rw-r--r--src/devices/machine/tms9902.cpp102
-rw-r--r--src/devices/machine/tms9902.h90
-rw-r--r--src/devices/machine/upd1990a.cpp53
-rw-r--r--src/devices/machine/upd1990a.h26
-rw-r--r--src/devices/machine/upd4701.cpp7
-rw-r--r--src/devices/machine/upd4701.h15
-rw-r--r--src/devices/machine/upd4992.cpp7
-rw-r--r--src/devices/machine/upd4992.h24
-rw-r--r--src/devices/machine/upd7002.cpp4
-rw-r--r--src/devices/machine/upd7002.h28
-rw-r--r--src/devices/machine/upd71071.cpp534
-rw-r--r--src/devices/machine/upd71071.h147
-rw-r--r--src/devices/machine/upd765.cpp54
-rw-r--r--src/devices/machine/upd765.h53
-rw-r--r--src/devices/machine/v3021.cpp6
-rw-r--r--src/devices/machine/v3021.h33
-rw-r--r--src/devices/machine/vrc4373.cpp147
-rw-r--r--src/devices/machine/vrc4373.h76
-rw-r--r--src/devices/machine/vrc5074.cpp110
-rw-r--r--src/devices/machine/vrc5074.h123
-rw-r--r--src/devices/machine/vt82c496.cpp6
-rw-r--r--src/devices/machine/vt82c496.h11
-rw-r--r--src/devices/machine/vt83c461.cpp17
-rw-r--r--src/devices/machine/vt83c461.h14
-rw-r--r--src/devices/machine/watchdog.cpp10
-rw-r--r--src/devices/machine/watchdog.h10
-rw-r--r--src/devices/machine/wd11c00_17.cpp75
-rw-r--r--src/devices/machine/wd11c00_17.h34
-rw-r--r--src/devices/machine/wd2010.cpp105
-rw-r--r--src/devices/machine/wd2010.h41
-rw-r--r--src/devices/machine/wd33c93.cpp21
-rw-r--r--src/devices/machine/wd33c93.h97
-rw-r--r--src/devices/machine/wd7600.cpp34
-rw-r--r--src/devices/machine/wd7600.h28
-rw-r--r--src/devices/machine/wd_fdc.cpp320
-rw-r--r--src/devices/machine/wd_fdc.h198
-rw-r--r--src/devices/machine/wozfdc.cpp33
-rw-r--r--src/devices/machine/wozfdc.h62
-rw-r--r--src/devices/machine/x2212.cpp39
-rw-r--r--src/devices/machine/x2212.h20
-rw-r--r--src/devices/machine/x76f041.cpp4
-rw-r--r--src/devices/machine/x76f041.h10
-rw-r--r--src/devices/machine/x76f100.cpp4
-rw-r--r--src/devices/machine/x76f100.h17
-rw-r--r--src/devices/machine/ym2148.cpp6
-rw-r--r--src/devices/machine/ym2148.h22
-rw-r--r--src/devices/machine/z80ctc.cpp4
-rw-r--r--src/devices/machine/z80ctc.h18
-rw-r--r--src/devices/machine/z80dart.cpp293
-rw-r--r--src/devices/machine/z80dart.h127
-rw-r--r--src/devices/machine/z80dma.cpp147
-rw-r--r--src/devices/machine/z80dma.h23
-rw-r--r--src/devices/machine/z80pio.cpp5
-rw-r--r--src/devices/machine/z80pio.h25
-rw-r--r--src/devices/machine/z80scc.cpp118
-rw-r--r--src/devices/machine/z80scc.h120
-rw-r--r--src/devices/machine/z80sio.cpp84
-rw-r--r--src/devices/machine/z80sio.h215
-rw-r--r--src/devices/machine/z80sti.cpp122
-rw-r--r--src/devices/machine/z80sti.h28
-rw-r--r--src/devices/machine/z8536.cpp186
-rw-r--r--src/devices/machine/z8536.h26
604 files changed, 13586 insertions, 15498 deletions
diff --git a/src/devices/machine/40105.cpp b/src/devices/machine/40105.cpp
index 6c7490a43af..dbeb7e2f45c 100644
--- a/src/devices/machine/40105.cpp
+++ b/src/devices/machine/40105.cpp
@@ -32,7 +32,7 @@
// DEVICE DEFINITIONS
//**************************************************************************
-const device_type CD40105 = device_creator<cmos_40105_device>;
+DEFINE_DEVICE_TYPE(CD40105, cmos_40105_device, "cd40105", "40105 FIFO")
const device_type HC40105 = CD40105;
@@ -45,7 +45,7 @@ const device_type HC40105 = CD40105;
//-------------------------------------------------
cmos_40105_device::cmos_40105_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : device_t(mconfig, CD40105, "40105 FIFO", tag, owner, clock, "cd40105", __FILE__),
+ : device_t(mconfig, CD40105, tag, owner, clock),
m_write_dir(*this),
m_write_dor(*this),
m_write_q(*this),
diff --git a/src/devices/machine/40105.h b/src/devices/machine/40105.h
index e65fb31f381..2197fddbf8b 100644
--- a/src/devices/machine/40105.h
+++ b/src/devices/machine/40105.h
@@ -17,10 +17,10 @@
**********************************************************************/
-#pragma once
+#ifndef MAME_MACHINE_40105_H
+#define MAME_MACHINE_40105_H
-#ifndef __CMOS_40105__
-#define __CMOS_40105__
+#pragma once
#include <queue>
@@ -53,9 +53,9 @@ public:
// construction/destruction
cmos_40105_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
- template<class _dir> devcb_base &set_dir_callback(_dir dir) { return m_write_dir.set_callback(dir); }
- template<class _dor> devcb_base &set_dor_callback(_dor dor) { return m_write_dor.set_callback(dor); }
- template<class _out> devcb_base &set_data_out_callback(_out out) { return m_write_q.set_callback(out); }
+ template <class Object> devcb_base &set_dir_callback(Object &&dir) { return m_write_dir.set_callback(std::forward<Object>(dir)); }
+ template <class Object> devcb_base &set_dor_callback(Object &&dor) { return m_write_dor.set_callback(std::forward<Object>(dor)); }
+ template <class Object> devcb_base &set_data_out_callback(Object &&out) { return m_write_q.set_callback(std::forward<Object>(out)); }
u8 read();
void write(u8 data);
@@ -95,8 +95,7 @@ private:
// device type definition
-extern const device_type CD40105;
+DECLARE_DEVICE_TYPE(CD40105, cmos_40105_device)
extern const device_type HC40105;
-
-#endif
+#endif // MAME_MACHINE_40105_H
diff --git a/src/devices/machine/53c7xx.cpp b/src/devices/machine/53c7xx.cpp
index e84c4358901..2d215f198b0 100644
--- a/src/devices/machine/53c7xx.cpp
+++ b/src/devices/machine/53c7xx.cpp
@@ -49,17 +49,62 @@ static void ATTR_PRINTF(3,4) verbose_log(running_machine &machine, int level, co
//**************************************************************************
+// REGISTER DEFINES (INCOMPLETE)
+//**************************************************************************
+
+#define SCNTL0_TRG 0x01
+#define SCNTL0_AAP 0x02
+#define SCNTL0_EPG 0x04
+#define SCNTL0_EPC 0x08
+#define SCNTL0_WATN 0x10
+#define SCNTL0_START 0x20
+#define SCNTL0_ARB_MASK 3
+#define SCNTL0_ARB_SHIFT 6
+
+#define SSTAT0_PAR 0x01
+#define SSTAT0_RST 0x02
+#define SSTAT0_UDC 0x04
+#define SSTAT0_SGE 0x08
+#define SSTAT0_SEL 0x10
+#define SSTAT0_STO 0x20
+#define SSTAT0_CMP 0x40
+#define SSTAT0_MA 0x80
+
+#define SSTAT1_SDP 0x01
+#define SSTAT1_RST 0x02
+#define SSTAT1_WOA 0x04
+#define SSTAT1_LOA 0x08
+#define SSTAT1_AIP 0x10
+#define SSTAT1_ORF 0x20
+#define SSTAT1_OLF 0x40
+#define SSTAT1_ILF 0x80
+
+#define ISTAT_DIP 0x01
+#define ISTAT_SIP 0x02
+#define ISTAT_PRE 0x04
+#define ISTAT_CON 0x08
+#define ISTAT_ABRT 0x80
+
+#define DSTAT_OPC 0x01
+#define DSTAT_WTD 0x02
+#define DSTAT_SIR 0x04
+#define DSTAT_SSI 0x08
+#define DSTAT_ABRT 0x10
+#define DSTAT_DFE 0x80
+
+
+//**************************************************************************
// LIVE DEVICE
//**************************************************************************
-const device_type NCR53C7XX = device_creator<ncr53c7xx_device>;
+DEFINE_DEVICE_TYPE(NCR53C7XX, ncr53c7xx_device, "ncr537xx", "NCR 53C7xx SCSI")
//-------------------------------------------------
// ncr53c7xx_device - constructor/destructor
//-------------------------------------------------
ncr53c7xx_device::ncr53c7xx_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : nscsi_device(mconfig, NCR53C7XX, "53C7xx SCSI", tag, owner, clock, "ncr537xx", __FILE__),
+ : nscsi_device(mconfig, NCR53C7XX, tag, owner, clock),
device_execute_interface(mconfig, *this),
m_icount(0),
m_irq_handler(*this),
diff --git a/src/devices/machine/53c7xx.h b/src/devices/machine/53c7xx.h
index f343f8472dc..7dff86c2256 100644
--- a/src/devices/machine/53c7xx.h
+++ b/src/devices/machine/53c7xx.h
@@ -8,55 +8,13 @@
*********************************************************************/
-#ifndef _NCR53C7XX_H_
-#define _NCR53C7XX_H_
+#ifndef MAME_MACHINE_53C7XX_H
+#define MAME_MACHINE_53C7XX_H
-#include "machine/nscsi_bus.h"
+#pragma once
+#include "machine/nscsi_bus.h"
-//**************************************************************************
-// REGISTER DEFINES (INCOMPLETE)
-//**************************************************************************
-
-#define SCNTL0_TRG 0x01
-#define SCNTL0_AAP 0x02
-#define SCNTL0_EPG 0x04
-#define SCNTL0_EPC 0x08
-#define SCNTL0_WATN 0x10
-#define SCNTL0_START 0x20
-#define SCNTL0_ARB_MASK 3
-#define SCNTL0_ARB_SHIFT 6
-
-#define SSTAT0_PAR 0x01
-#define SSTAT0_RST 0x02
-#define SSTAT0_UDC 0x04
-#define SSTAT0_SGE 0x08
-#define SSTAT0_SEL 0x10
-#define SSTAT0_STO 0x20
-#define SSTAT0_CMP 0x40
-#define SSTAT0_MA 0x80
-
-#define SSTAT1_SDP 0x01
-#define SSTAT1_RST 0x02
-#define SSTAT1_WOA 0x04
-#define SSTAT1_LOA 0x08
-#define SSTAT1_AIP 0x10
-#define SSTAT1_ORF 0x20
-#define SSTAT1_OLF 0x40
-#define SSTAT1_ILF 0x80
-
-#define ISTAT_DIP 0x01
-#define ISTAT_SIP 0x02
-#define ISTAT_PRE 0x04
-#define ISTAT_CON 0x08
-#define ISTAT_ABRT 0x80
-
-#define DSTAT_OPC 0x01
-#define DSTAT_WTD 0x02
-#define DSTAT_SIR 0x04
-#define DSTAT_SSI 0x08
-#define DSTAT_ABRT 0x10
-#define DSTAT_DFE 0x80
#define MCFG_NCR53C7XX_IRQ_HANDLER(_devcb) \
devcb = &ncr53c7xx_device::set_irq_handler(*device, DEVCB_##_devcb);
@@ -67,17 +25,16 @@
#define MCFG_NCR53C7XX_HOST_READ(_devcb) \
devcb = &ncr53c7xx_device::set_host_read(*device, DEVCB_##_devcb);
-class ncr53c7xx_device : public nscsi_device,
- public device_execute_interface
+class ncr53c7xx_device : public nscsi_device, public device_execute_interface
{
public:
// construction/destruction
ncr53c7xx_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// static configuration helpers
- template<class _Object> static devcb_base &set_irq_handler(device_t &device, _Object object) { return downcast<ncr53c7xx_device &>(device).m_irq_handler.set_callback(object); }
- template<class _Object> static devcb_base &set_host_write(device_t &device, _Object object) { return downcast<ncr53c7xx_device &>(device).m_host_write.set_callback(object); }
- template<class _Object> static devcb_base &set_host_read(device_t &device, _Object object) { return downcast<ncr53c7xx_device &>(device).m_host_read.set_callback(object); }
+ template <class Object> static devcb_base &set_irq_handler(device_t &device, Object &&cb) { return downcast<ncr53c7xx_device &>(device).m_irq_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_host_write(device_t &device, Object &&cb) { return downcast<ncr53c7xx_device &>(device).m_host_write.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_host_read(device_t &device, Object &&cb) { return downcast<ncr53c7xx_device &>(device).m_host_read.set_callback(std::forward<Object>(cb)); }
// our API
DECLARE_READ32_MEMBER(read);
@@ -225,5 +182,6 @@ private:
};
// device type definition
-extern const device_type NCR53C7XX;
-#endif
+DECLARE_DEVICE_TYPE(NCR53C7XX, ncr53c7xx_device)
+
+#endif // MAME_MACHINE_53C7XX_H
diff --git a/src/devices/machine/53c810.cpp b/src/devices/machine/53c810.cpp
index 5564525869d..87165da1cfd 100644
--- a/src/devices/machine/53c810.cpp
+++ b/src/devices/machine/53c810.cpp
@@ -394,7 +394,7 @@ void lsi53c810_device::dma_exec()
}
}
-uint8_t lsi53c810_device::lsi53c810_reg_r( int offset )
+uint8_t lsi53c810_device::reg_r(int offset)
{
// logerror("53c810: read reg %d:0x%x (PC=%x)\n", offset, offset, space.device().safe_pc());
switch(offset)
@@ -477,7 +477,7 @@ uint8_t lsi53c810_device::lsi53c810_reg_r( int offset )
//return 0;
}
-void lsi53c810_device::lsi53c810_reg_w(int offset, uint8_t data)
+void lsi53c810_device::reg_w(int offset, uint8_t data)
{
// logerror("53c810: %02x to reg %d:0x%x (PC=%x)\n", data, offset, offset, space.device().safe_pc());
switch(offset)
@@ -622,7 +622,7 @@ void lsi53c810_device::add_opcode(uint8_t op, uint8_t mask, opcode_handler_deleg
}
lsi53c810_device::lsi53c810_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : legacy_scsi_host_adapter(mconfig, LSI53C810, "53C810 SCSI", tag, owner, clock, "lsi53c810", __FILE__)
+ : legacy_scsi_host_adapter(mconfig, LSI53C810, tag, owner, clock)
{
}
@@ -813,4 +813,4 @@ unsigned lsi53c810_device::lsi53c810_dasm(char *buf, uint32_t pc)
return result;
}
-const device_type LSI53C810 = device_creator<lsi53c810_device>;
+DEFINE_DEVICE_TYPE(LSI53C810, lsi53c810_device, "lsi53c810", "LSI 53C810 SCSI")
diff --git a/src/devices/machine/53c810.h b/src/devices/machine/53c810.h
index b00bf57e8ed..d8115dfb10c 100644
--- a/src/devices/machine/53c810.h
+++ b/src/devices/machine/53c810.h
@@ -1,32 +1,33 @@
// license:BSD-3-Clause
// copyright-holders:smf
-#ifndef LSI53C810_H
-#define LSI53C810_H
+#ifndef MAME_MACHINE_53C810_H
+#define MAME_MACHINE_53C810_H
+
+#pragma once
#include "legscsi.h"
-typedef device_delegate<void (int state)> lsi53c810_irq_delegate;
#define LSI53C810_IRQ_CB(name) void name(int state)
-
-typedef device_delegate<void (uint32_t src, uint32_t dst, int length, int byteswap)> lsi53c810_dma_delegate;
#define LSI53C810_DMA_CB(name) void name(uint32_t src, uint32_t dst, int length, int byteswap)
-
-typedef device_delegate<uint32_t (uint32_t dsp)> lsi53c810_fetch_delegate;
#define LSI53C810_FETCH_CB(name) uint32_t name(uint32_t dsp)
class lsi53c810_device : public legacy_scsi_host_adapter
{
public:
+ typedef device_delegate<void (int state)> irq_delegate;
+ typedef device_delegate<void (uint32_t src, uint32_t dst, int length, int byteswap)> dma_delegate;
+ typedef device_delegate<uint32_t (uint32_t dsp)> fetch_delegate;
+
// construction/destruction
lsi53c810_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- static void set_irq_callback(device_t &device, lsi53c810_irq_delegate callback) { downcast<lsi53c810_device &>(device).m_irq_cb = callback; }
- static void set_dma_callback(device_t &device, lsi53c810_dma_delegate callback) { downcast<lsi53c810_device &>(device).m_dma_cb = callback; }
- static void set_fetch_callback(device_t &device, lsi53c810_fetch_delegate callback) { downcast<lsi53c810_device &>(device).m_fetch_cb = callback; }
+ static void set_irq_callback(device_t &device, irq_delegate &&callback) { downcast<lsi53c810_device &>(device).m_irq_cb = std::move(callback); }
+ static void set_dma_callback(device_t &device, dma_delegate &&callback) { downcast<lsi53c810_device &>(device).m_dma_cb = std::move(callback); }
+ static void set_fetch_callback(device_t &device, fetch_delegate &&callback) { downcast<lsi53c810_device &>(device).m_fetch_cb = std::move(callback); }
- uint8_t lsi53c810_reg_r( int offset );
- void lsi53c810_reg_w(int offset, uint8_t data);
+ uint8_t reg_r(int offset);
+ void reg_w(int offset, uint8_t data);
protected:
// device-level overrides
@@ -36,9 +37,9 @@ private:
typedef delegate<void (void)> opcode_handler_delegate;
opcode_handler_delegate dma_opcode[256];
- lsi53c810_irq_delegate m_irq_cb;
- lsi53c810_dma_delegate m_dma_cb;
- lsi53c810_fetch_delegate m_fetch_cb;
+ irq_delegate m_irq_cb;
+ dma_delegate m_dma_cb;
+ fetch_delegate m_fetch_cb;
uint32_t FETCH();
void dmaop_invalid();
@@ -99,15 +100,16 @@ private:
// device type definition
extern const device_type LSI53C810;
+DECLARE_DEVICE_TYPE(LSI53C810, lsi53c810_device)
#define MCFG_LSI53C810_IRQ_CB(_class, _method) \
- lsi53c810_device::set_irq_callback(*device, lsi53c810_irq_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
+ lsi53c810_device::set_irq_callback(*device, lsi53c810_device::irq_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
#define MCFG_LSI53C810_DMA_CB(_class, _method) \
- lsi53c810_device::set_dma_callback(*device, lsi53c810_dma_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
+ lsi53c810_device::set_dma_callback(*device, lsi53c810_device::dma_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
#define MCFG_LSI53C810_FETCH_CB(_class, _method) \
- lsi53c810_device::set_fetch_callback(*device, lsi53c810_fetch_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
+ lsi53c810_device::set_fetch_callback(*device, lsi53c810_device::fetch_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
-#endif
+#endif // MAME_MACHINE_53C810_H
diff --git a/src/devices/machine/64h156.cpp b/src/devices/machine/64h156.cpp
index 93532565b3e..4b2cd724dca 100644
--- a/src/devices/machine/64h156.cpp
+++ b/src/devices/machine/64h156.cpp
@@ -27,14 +27,14 @@
#include "emu.h"
#include "64h156.h"
+//#define VERBOSE 1
+#include "logmacro.h"
//**************************************************************************
// MACROS / CONSTANTS
//**************************************************************************
-#define LOG 0
-
#define CYCLES_UNTIL_ANALOG_DESYNC 288 // 18 us
@@ -43,7 +43,7 @@
// DEVICE DEFINITIONS
//**************************************************************************
-const device_type C64H156 = device_creator<c64h156_device>;
+DEFINE_DEVICE_TYPE(C64H156, c64h156_device, "c64h156", "Commodore 64H156")
@@ -56,7 +56,7 @@ const device_type C64H156 = device_creator<c64h156_device>;
//-------------------------------------------------
c64h156_device::c64h156_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, C64H156, "64H156", tag, owner, clock, "c64h156", __FILE__),
+ device_t(mconfig, C64H156, tag, owner, clock),
m_write_atn(*this),
m_write_sync(*this),
m_write_byte(*this),
@@ -200,7 +200,7 @@ bool c64h156_device::write_next_bit(bool bit, const attotime &limit)
if(bit && cur_live.write_position < ARRAY_LENGTH(cur_live.write_buffer))
cur_live.write_buffer[cur_live.write_position++] = cur_live.tm - m_period;
- if (LOG) logerror("%s write bit %u (%u)\n", cur_live.tm.as_string(), cur_live.bit_counter, bit);
+ LOG("%s write bit %u (%u)\n", cur_live.tm.as_string(), cur_live.bit_counter, bit);
return false;
}
@@ -210,7 +210,7 @@ void c64h156_device::commit(const attotime &tm)
if(cur_live.write_start_time.is_never() || tm == cur_live.write_start_time || !cur_live.write_position)
return;
- if (LOG) logerror("%s committing %u transitions since %s\n", tm.as_string(), cur_live.write_position, cur_live.write_start_time.as_string());
+ LOG("%s committing %u transitions since %s\n", tm.as_string(), cur_live.write_position, cur_live.write_start_time.as_string());
m_floppy->write_flux(cur_live.write_start_time, tm, cur_live.write_position, cur_live.write_buffer);
@@ -307,7 +307,7 @@ void c64h156_device::live_run(const attotime &limit)
cur_live.shift_reg |= !(BIT(cur_live.cell_counter, 3) || BIT(cur_live.cell_counter, 2));
cur_live.shift_reg &= 0x3ff;
- if (LOG) logerror("%s read bit %u (%u) >> %03x, oe=%u soe=%u sync=%u byte=%u\n", cur_live.tm.as_string(), cur_live.bit_counter,
+ LOG("%s read bit %u (%u) >> %03x, oe=%u soe=%u sync=%u byte=%u\n", cur_live.tm.as_string(), cur_live.bit_counter,
!(BIT(cur_live.cell_counter, 3) || BIT(cur_live.cell_counter, 2)), cur_live.shift_reg, cur_live.oe, cur_live.soe, cur_live.sync, cur_live.byte);
syncpoint = true;
@@ -332,21 +332,21 @@ void c64h156_device::live_run(const attotime &limit)
if (!load) {
if (cur_live.oe) {
cur_live.shift_reg_write = cur_live.shift_reg;
- if (LOG) logerror("%s load write shift register from read shift register %02x\n",cur_live.tm.as_string(),cur_live.shift_reg_write);
+ LOG("%s load write shift register from read shift register %02x\n",cur_live.tm.as_string(),cur_live.shift_reg_write);
} else {
cur_live.shift_reg_write = cur_live.yb;
- if (LOG) logerror("%s load write shift register from YB %02x\n",cur_live.tm.as_string(),cur_live.shift_reg_write);
+ LOG("%s load write shift register from YB %02x\n",cur_live.tm.as_string(),cur_live.shift_reg_write);
}
} else if (!BIT(cell_counter, 1) && BIT(cur_live.cell_counter, 1)) {
cur_live.shift_reg_write <<= 1;
cur_live.shift_reg_write &= 0xff;
- if (LOG) logerror("%s shift write register << %02x\n", cur_live.tm.as_string(), cur_live.shift_reg_write);
+ LOG("%s shift write register << %02x\n", cur_live.tm.as_string(), cur_live.shift_reg_write);
}
// update signals
if (byte != cur_live.byte) {
if (!byte || !cur_live.accl) {
- if (LOG) logerror("%s BYTE %02x\n", cur_live.tm.as_string(), cur_live.shift_reg & 0xff);
+ LOG("%s BYTE %02x\n", cur_live.tm.as_string(), cur_live.shift_reg & 0xff);
cur_live.byte = byte;
syncpoint = true;
}
@@ -356,7 +356,7 @@ void c64h156_device::live_run(const attotime &limit)
}
if (sync != cur_live.sync) {
- if (LOG) logerror("%s SYNC %u\n", cur_live.tm.as_string(),sync);
+ LOG("%s SYNC %u\n", cur_live.tm.as_string(),sync);
cur_live.sync = sync;
syncpoint = true;
}
@@ -444,7 +444,7 @@ WRITE8_MEMBER( c64h156_device::yb_w )
live_sync();
m_yb = cur_live.yb = data;
checkpoint();
- if (LOG) logerror("%s YB %02x\n", machine().time().as_string(), data);
+ LOG("%s YB %02x\n", machine().time().as_string(), data);
live_run();
}
@@ -471,7 +471,7 @@ WRITE_LINE_MEMBER( c64h156_device::accl_w )
live_sync();
m_accl = cur_live.accl = state;
checkpoint();
- if (LOG) logerror("%s ACCL %u\n", machine().time().as_string(), state);
+ LOG("%s ACCL %u\n", machine().time().as_string(), state);
live_run();
}
}
@@ -492,7 +492,7 @@ WRITE_LINE_MEMBER( c64h156_device::ted_w )
}
m_ted = state;
checkpoint();
- if (LOG) logerror("%s TED %u\n", machine().time().as_string(), state);
+ LOG("%s TED %u\n", machine().time().as_string(), state);
live_run();
}
}
@@ -508,7 +508,7 @@ WRITE_LINE_MEMBER( c64h156_device::mtr_w )
{
live_sync();
m_mtr = state;
- if (LOG) logerror("%s MTR %u\n", machine().time().as_string(), state);
+ LOG("%s MTR %u\n", machine().time().as_string(), state);
m_floppy->mon_w(!state);
checkpoint();
@@ -541,7 +541,7 @@ WRITE_LINE_MEMBER( c64h156_device::oe_w )
start_writing(machine().time());
}
checkpoint();
- if (LOG) logerror("%s OE %u\n", machine().time().as_string(), state);
+ LOG("%s OE %u\n", machine().time().as_string(), state);
live_run();
}
}
@@ -558,7 +558,7 @@ WRITE_LINE_MEMBER( c64h156_device::soe_w )
live_sync();
m_soe = cur_live.soe = state;
checkpoint();
- if (LOG) logerror("%s SOE %u\n", machine().time().as_string(), state);
+ LOG("%s SOE %u\n", machine().time().as_string(), state);
live_run();
}
}
@@ -570,7 +570,7 @@ WRITE_LINE_MEMBER( c64h156_device::soe_w )
WRITE_LINE_MEMBER( c64h156_device::atni_w )
{
- if (LOG) logerror("ATNI %u\n", state);
+ LOG("ATNI %u\n", state);
m_atni = state;
@@ -584,7 +584,7 @@ WRITE_LINE_MEMBER( c64h156_device::atni_w )
WRITE_LINE_MEMBER( c64h156_device::atna_w )
{
- if (LOG) logerror("ATNA %u\n", state);
+ LOG("ATNA %u\n", state);
m_atna = state;
@@ -657,7 +657,7 @@ void c64h156_device::ds_w(int ds)
live_sync();
m_ds = cur_live.ds = ds;
checkpoint();
- if (LOG) logerror("%s DS %u\n", machine().time().as_string(), ds);
+ LOG("%s DS %u\n", machine().time().as_string(), ds);
live_run();
}
}
diff --git a/src/devices/machine/64h156.h b/src/devices/machine/64h156.h
index 35b1320f920..0964f85558a 100644
--- a/src/devices/machine/64h156.h
+++ b/src/devices/machine/64h156.h
@@ -54,10 +54,10 @@
**********************************************************************/
-#pragma once
+#ifndef MAME_MACHINE_64H156_H
+#define MAME_MACHINE_64H156_H
-#ifndef __C64H156__
-#define __C64H156__
+#pragma once
#include "imagedev/floppy.h"
#include "formats/d64_dsk.h"
@@ -93,9 +93,9 @@ public:
// construction/destruction
c64h156_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- template<class _Object> static devcb_base &set_atn_wr_callback(device_t &device, _Object object) { return downcast<c64h156_device &>(device).m_write_atn.set_callback(object); }
- template<class _Object> static devcb_base &set_sync_wr_callback(device_t &device, _Object object) { return downcast<c64h156_device &>(device).m_write_sync.set_callback(object); }
- template<class _Object> static devcb_base &set_byte_wr_callback(device_t &device, _Object object) { return downcast<c64h156_device &>(device).m_write_byte.set_callback(object); }
+ template <class Object> static devcb_base &set_atn_wr_callback(device_t &device, Object &&cb) { return downcast<c64h156_device &>(device).m_write_atn.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_sync_wr_callback(device_t &device, Object &&cb) { return downcast<c64h156_device &>(device).m_write_sync.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_byte_wr_callback(device_t &device, Object &&cb) { return downcast<c64h156_device &>(device).m_write_byte.set_callback(std::forward<Object>(cb)); }
DECLARE_READ8_MEMBER( yb_r );
DECLARE_WRITE8_MEMBER( yb_w );
@@ -196,10 +196,7 @@ private:
};
-
// device type definition
-extern const device_type C64H156;
-
-
+DECLARE_DEVICE_TYPE(C64H156, c64h156_device)
-#endif
+#endif // MAME_MACHINE_64H156_H
diff --git a/src/devices/machine/6522via.cpp b/src/devices/machine/6522via.cpp
index c407c05e59a..f2d1dacf6e2 100644
--- a/src/devices/machine/6522via.cpp
+++ b/src/devices/machine/6522via.cpp
@@ -148,7 +148,7 @@ uint16_t via6522_device::get_counter1_value()
//**************************************************************************
// device type definition
-const device_type VIA6522 = device_creator<via6522_device>;
+DEFINE_DEVICE_TYPE(VIA6522, via6522_device, "via6522", "6522 VIA")
DEVICE_ADDRESS_MAP_START( map, 8, via6522_device )
AM_RANGE(0x00, 0x0f) AM_READWRITE(read, write)
@@ -159,7 +159,7 @@ ADDRESS_MAP_END
//-------------------------------------------------
via6522_device::via6522_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, VIA6522, "6522 VIA", tag, owner, clock, "via6522", __FILE__),
+ : device_t(mconfig, VIA6522, tag, owner, clock),
m_in_a_handler(*this),
m_in_b_handler(*this),
m_out_a_handler(*this),
diff --git a/src/devices/machine/6522via.h b/src/devices/machine/6522via.h
index 87fed27d9a3..8dd3616778d 100644
--- a/src/devices/machine/6522via.h
+++ b/src/devices/machine/6522via.h
@@ -13,10 +13,10 @@
**********************************************************************/
-#pragma once
+#ifndef MAME_MACHINE_6522VIA_H
+#define MAME_MACHINE_6522VIA_H
-#ifndef __6522VIA_H__
-#define __6522VIA_H__
+#pragma once
//**************************************************************************
// INTERFACE CONFIGURATION MACROS
@@ -56,24 +56,44 @@
// ======================> via6522_device
-class via6522_device : public device_t
+class via6522_device : public device_t
{
public:
+ enum
+ {
+ VIA_PB = 0,
+ VIA_PA = 1,
+ VIA_DDRB = 2,
+ VIA_DDRA = 3,
+ VIA_T1CL = 4,
+ VIA_T1CH = 5,
+ VIA_T1LL = 6,
+ VIA_T1LH = 7,
+ VIA_T2CL = 8,
+ VIA_T2CH = 9,
+ VIA_SR = 10,
+ VIA_ACR = 11,
+ VIA_PCR = 12,
+ VIA_IFR = 13,
+ VIA_IER = 14,
+ VIA_PANH = 15
+ };
+
// construction/destruction
via6522_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// TODO: REMOVE THESE
- template<class _Object> static devcb_base &set_readpa_handler(device_t &device, _Object object) { return downcast<via6522_device &>(device).m_in_a_handler.set_callback(object); }
- template<class _Object> static devcb_base &set_readpb_handler(device_t &device, _Object object) { return downcast<via6522_device &>(device).m_in_b_handler.set_callback(object); }
+ template <class Object> static devcb_base &set_readpa_handler(device_t &device, Object &&cb) { return downcast<via6522_device &>(device).m_in_a_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_readpb_handler(device_t &device, Object &&cb) { return downcast<via6522_device &>(device).m_in_b_handler.set_callback(std::forward<Object>(cb)); }
// TODO: CONVERT THESE TO WRITE LINE
- template<class _Object> static devcb_base &set_writepa_handler(device_t &device, _Object object) { return downcast<via6522_device &>(device).m_out_a_handler.set_callback(object); }
- template<class _Object> static devcb_base &set_writepb_handler(device_t &device, _Object object) { return downcast<via6522_device &>(device).m_out_b_handler.set_callback(object); }
+ template <class Object> static devcb_base &set_writepa_handler(device_t &device, Object &&cb) { return downcast<via6522_device &>(device).m_out_a_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_writepb_handler(device_t &device, Object &&cb) { return downcast<via6522_device &>(device).m_out_b_handler.set_callback(std::forward<Object>(cb)); }
- template<class _Object> static devcb_base &set_ca2_handler(device_t &device, _Object object) { return downcast<via6522_device &>(device).m_ca2_handler.set_callback(object); }
- template<class _Object> static devcb_base &set_cb1_handler(device_t &device, _Object object) { return downcast<via6522_device &>(device).m_cb1_handler.set_callback(object); }
- template<class _Object> static devcb_base &set_cb2_handler(device_t &device, _Object object) { return downcast<via6522_device &>(device).m_cb2_handler.set_callback(object); }
- template<class _Object> static devcb_base &set_irq_handler(device_t &device, _Object object) { return downcast<via6522_device &>(device).m_irq_handler.set_callback(object); }
+ template <class Object> static devcb_base &set_ca2_handler(device_t &device, Object &&cb) { return downcast<via6522_device &>(device).m_ca2_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_cb1_handler(device_t &device, Object &&cb) { return downcast<via6522_device &>(device).m_cb1_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_cb2_handler(device_t &device, Object &&cb) { return downcast<via6522_device &>(device).m_cb2_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_irq_handler(device_t &device, Object &&cb) { return downcast<via6522_device &>(device).m_irq_handler.set_callback(std::forward<Object>(cb)); }
virtual DECLARE_ADDRESS_MAP(map, 8);
@@ -104,26 +124,6 @@ public:
DECLARE_WRITE_LINE_MEMBER( write_cb1 );
DECLARE_WRITE_LINE_MEMBER( write_cb2 );
- enum
- {
- VIA_PB = 0,
- VIA_PA = 1,
- VIA_DDRB = 2,
- VIA_DDRA = 3,
- VIA_T1CL = 4,
- VIA_T1CH = 5,
- VIA_T1LL = 6,
- VIA_T1LH = 7,
- VIA_T2CL = 8,
- VIA_T2CH = 9,
- VIA_SR = 10,
- VIA_ACR = 11,
- VIA_PCR = 12,
- VIA_IFR = 13,
- VIA_IER = 14,
- VIA_PANH = 15
- };
-
protected:
// device-level overrides
virtual void device_start() override;
@@ -131,11 +131,11 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
private:
- static const device_timer_id TIMER_SHIFT = 0;
- static const device_timer_id TIMER_T1 = 1;
- static const device_timer_id TIMER_T2 = 2;
- static const device_timer_id TIMER_CA2 = 3;
- static const device_timer_id TIMER_SHIFT_IRQ = 4;
+ 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;
uint16_t get_counter1_value();
@@ -213,7 +213,7 @@ private:
// device type definition
-extern const device_type VIA6522;
+DECLARE_DEVICE_TYPE(VIA6522, via6522_device)
-#endif /* __6522VIA_H__ */
+#endif // MAME_MACHINE_6522VIA_H
diff --git a/src/devices/machine/6525tpi.cpp b/src/devices/machine/6525tpi.cpp
index be33b929b6b..a82b09d104c 100644
--- a/src/devices/machine/6525tpi.cpp
+++ b/src/devices/machine/6525tpi.cpp
@@ -104,10 +104,10 @@
#define CB_MANUAL_LEVEL ((m_cr & 0x40) ? 1 : 0)
-const device_type TPI6525 = device_creator<tpi6525_device>;
+DEFINE_DEVICE_TYPE(TPI6525, tpi6525_device, "tpi6525", "6525 TPI")
tpi6525_device::tpi6525_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, TPI6525, "6525 TPI", tag, owner, clock, "tpi6525", __FILE__),
+ : device_t(mconfig, TPI6525, tag, owner, clock),
m_out_irq_cb(*this),
m_in_pa_cb(*this),
m_out_pa_cb(*this),
diff --git a/src/devices/machine/6525tpi.h b/src/devices/machine/6525tpi.h
index ed927d2e11a..1164e3b31d5 100644
--- a/src/devices/machine/6525tpi.h
+++ b/src/devices/machine/6525tpi.h
@@ -28,8 +28,10 @@
*
****************************************************************************/
-#ifndef __TPI6525_H__
-#define __TPI6525_H__
+#ifndef MAME_MACHINE_6525TPI_H
+#define MAME_MACHINE_6525TPI_H
+
+#pragma once
/***************************************************************************
@@ -40,17 +42,16 @@ class tpi6525_device : public device_t
{
public:
tpi6525_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- ~tpi6525_device() {}
-
- template<class _Object> static devcb_base &set_out_irq_callback(device_t &device, _Object object) { return downcast<tpi6525_device &>(device).m_out_irq_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_in_pa_callback(device_t &device, _Object object) { return downcast<tpi6525_device &>(device).m_in_pa_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_out_pa_callback(device_t &device, _Object object) { return downcast<tpi6525_device &>(device).m_out_pa_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_in_pb_callback(device_t &device, _Object object) { return downcast<tpi6525_device &>(device).m_in_pb_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_out_pb_callback(device_t &device, _Object object) { return downcast<tpi6525_device &>(device).m_out_pb_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_in_pc_callback(device_t &device, _Object object) { return downcast<tpi6525_device &>(device).m_in_pc_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_out_pc_callback(device_t &device, _Object object) { return downcast<tpi6525_device &>(device).m_out_pc_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_out_ca_callback(device_t &device, _Object object) { return downcast<tpi6525_device &>(device).m_out_ca_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_out_cb_callback(device_t &device, _Object object) { return downcast<tpi6525_device &>(device).m_out_cb_cb.set_callback(object); }
+
+ template <class Object> static devcb_base &set_out_irq_callback(device_t &device, Object &&cb) { return downcast<tpi6525_device &>(device).m_out_irq_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_in_pa_callback(device_t &device, Object &&cb) { return downcast<tpi6525_device &>(device).m_in_pa_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_out_pa_callback(device_t &device, Object &&cb) { return downcast<tpi6525_device &>(device).m_out_pa_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_in_pb_callback(device_t &device, Object &&cb) { return downcast<tpi6525_device &>(device).m_in_pb_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_out_pb_callback(device_t &device, Object &&cb) { return downcast<tpi6525_device &>(device).m_out_pb_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_in_pc_callback(device_t &device, Object &&cb) { return downcast<tpi6525_device &>(device).m_in_pc_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_out_pc_callback(device_t &device, Object &&cb) { return downcast<tpi6525_device &>(device).m_out_pc_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_out_ca_callback(device_t &device, Object &&cb) { return downcast<tpi6525_device &>(device).m_out_ca_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_out_cb_callback(device_t &device, Object &&cb) { return downcast<tpi6525_device &>(device).m_out_cb_cb.set_callback(std::forward<Object>(cb)); }
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
@@ -120,7 +121,7 @@ private:
static void port_line_w(uint8_t &port, int line, int state);
};
-extern const device_type TPI6525;
+DECLARE_DEVICE_TYPE(TPI6525, tpi6525_device)
#define MCFG_TPI6525_OUT_IRQ_CB(_devcb) \
@@ -151,4 +152,4 @@ extern const device_type TPI6525;
devcb = &tpi6525_device::set_out_cb_callback(*device, DEVCB_##_devcb);
-#endif /* __TPI6525_H__ */
+#endif // MAME_MACHINE_6525TPI_H
diff --git a/src/devices/machine/6532riot.cpp b/src/devices/machine/6532riot.cpp
index 1ef406a1a73..a04cac9fd79 100644
--- a/src/devices/machine/6532riot.cpp
+++ b/src/devices/machine/6532riot.cpp
@@ -22,7 +22,7 @@ The timer seems to follow these rules:
//**************************************************************************
// device type definition
-const device_type RIOT6532 = device_creator<riot6532_device>;
+DEFINE_DEVICE_TYPE(RIOT6532, riot6532_device, "riot6532", "6532 RIOT")
enum
{
@@ -387,7 +387,7 @@ uint8_t riot6532_device::portb_out_get()
//-------------------------------------------------
riot6532_device::riot6532_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, RIOT6532, "6532 RIOT", tag, owner, clock, "riot6532", __FILE__),
+ : device_t(mconfig, RIOT6532, tag, owner, clock),
m_in_pa_cb(*this),
m_out_pa_cb(*this),
m_in_pb_cb(*this),
diff --git a/src/devices/machine/6532riot.h b/src/devices/machine/6532riot.h
index b4d558cbcc6..36df16dbe73 100644
--- a/src/devices/machine/6532riot.h
+++ b/src/devices/machine/6532riot.h
@@ -121,6 +121,6 @@ private:
// device type definition
-extern const device_type RIOT6532;
+DECLARE_DEVICE_TYPE(RIOT6532, riot6532_device)
#endif
diff --git a/src/devices/machine/68153bim.cpp b/src/devices/machine/68153bim.cpp
index 4d9bd20d07a..85682cdeb31 100644
--- a/src/devices/machine/68153bim.cpp
+++ b/src/devices/machine/68153bim.cpp
@@ -59,9 +59,9 @@
// DEVICE DEFINITIONS
//**************************************************************************
// device type definition
-const device_type MC68153_CHANNEL = device_creator<bim68153_channel>;
-const device_type MC68153 = device_creator<bim68153_device>;
-const device_type EI68C153 = device_creator<ei68c153_device>;
+DEFINE_DEVICE_TYPE(MC68153_CHANNEL, bim68153_channel, "bim68153_channel", "68153 BIM channel")
+DEFINE_DEVICE_TYPE(MC68153, bim68153_device, "m68153bim", "Motorola MC68153 BIM")
+DEFINE_DEVICE_TYPE(EI68C153, ei68c153_device, "ei68c153", "EPIC EI68C153 BIM")
//-------------------------------------------------
// device_mconfig_additions -
@@ -86,35 +86,29 @@ machine_config_constructor bim68153_device::device_mconfig_additions() const
//-------------------------------------------------
// bim68153_device - constructor
//-------------------------------------------------
-bim68153_device::bim68153_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, uint32_t variant, const char *shortname, const char *source)
- : device_t(mconfig, type, name, tag, owner, clock, shortname, source)
- ,m_chn{{*this, CHN0_TAG}, {*this, CHN1_TAG}, {*this, CHN2_TAG}, {*this, CHN3_TAG}}
- ,m_out_int_cb(*this)
- ,m_out_intal0_cb(*this)
- ,m_out_intal1_cb(*this)
- ,m_out_iackout_cb(*this)
- ,m_iackin(ASSERT_LINE)
- ,m_irq_level(0)
+bim68153_device::bim68153_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint32_t variant)
+ : device_t(mconfig, type, tag, owner, clock)
+ , m_chn{{*this, CHN0_TAG}, {*this, CHN1_TAG}, {*this, CHN2_TAG}, {*this, CHN3_TAG}}
+ , m_out_int_cb(*this)
+ , m_out_intal0_cb(*this)
+ , m_out_intal1_cb(*this)
+ , m_out_iackout_cb(*this)
+ , m_iackin(ASSERT_LINE)
+ , m_irq_level(0)
{
+ // FIXME: is the unused 'variant' parameter supposed to be useful for something?
LOG("%s\n", FUNCNAME);
}
bim68153_device::bim68153_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, MC68153, "Motorola MC68153 BIM", tag, owner, clock, "m68153bim", __FILE__)
- ,m_chn{{*this, CHN0_TAG}, {*this, CHN1_TAG}, {*this, CHN2_TAG}, {*this, CHN3_TAG}}
- ,m_out_int_cb(*this)
- ,m_out_intal0_cb(*this)
- ,m_out_intal1_cb(*this)
- ,m_out_iackout_cb(*this)
- ,m_iackin(ASSERT_LINE)
- ,m_irq_level(0)
+ : bim68153_device(mconfig, MC68153, tag, owner, clock, TYPE_MC68153)
{
LOG("%s\n", FUNCNAME);
}
/* The EPIC EI68C153 is a CMOS implementation that is fully compatible with the bipolar MC68153 from Motorola */
ei68c153_device::ei68c153_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : bim68153_device(mconfig, EI68C153, "EPIC EI68C153 BIM", tag, owner, clock, TYPE_EI68C153, "ei68c153", __FILE__)
+ : bim68153_device(mconfig, EI68C153, tag, owner, clock, TYPE_EI68C153)
{
LOG("%s\n", FUNCNAME);
}
@@ -329,11 +323,11 @@ WRITE8_MEMBER( bim68153_device::write )
//**************************************************************************
bim68153_channel::bim68153_channel(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, MC68153_CHANNEL, "BIM channel", tag, owner, clock, "bim68153_channel", __FILE__)
- ,m_out_iack_cb(*this)
- ,m_int_state(NONE)
- ,m_control(0)
- ,m_vector(0)
+ : device_t(mconfig, MC68153_CHANNEL, tag, owner, clock)
+ , m_out_iack_cb(*this)
+ , m_int_state(NONE)
+ , m_control(0)
+ , m_vector(0)
{
LOG("%s\n",FUNCNAME);
}
diff --git a/src/devices/machine/68153bim.h b/src/devices/machine/68153bim.h
index ab59c94c1c1..4d7b22b6e3e 100644
--- a/src/devices/machine/68153bim.h
+++ b/src/devices/machine/68153bim.h
@@ -28,10 +28,10 @@
*
**********************************************************************/
-#pragma once
+#ifndef MAME_MACHINE_68153BIM_H
+#define MAME_MACHINE_68153BIM_H
-#ifndef MC68153BIM_H
-#define MC68153BIM_H
+#pragma once
//**************************************************************************
@@ -128,27 +128,26 @@ protected:
};
-class bim68153_device : public device_t
+class bim68153_device : public device_t
{
friend class bim68153_channel;
public:
// construction/destruction
- bim68153_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, uint32_t variant, const char *shortname, const char *source);
bim68153_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
IRQ_CALLBACK_MEMBER(iack);
int acknowledge();
int get_irq_level();
- template<class _Object> static devcb_base &set_out_int_callback(device_t &device, _Object object) { return downcast<bim68153_device &>(device).m_out_int_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_out_intal0_callback(device_t &device, _Object object) { return downcast<bim68153_device &>(device).m_out_intal0_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_out_intal1_callback(device_t &device, _Object object) { return downcast<bim68153_device &>(device).m_out_intal1_cb.set_callback(object); }
+ template <class Object> static devcb_base &set_out_int_callback(device_t &device, Object &&cb) { return downcast<bim68153_device &>(device).m_out_int_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_out_intal0_callback(device_t &device, Object &&cb) { return downcast<bim68153_device &>(device).m_out_intal0_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_out_intal1_callback(device_t &device, Object &&cb) { return downcast<bim68153_device &>(device).m_out_intal1_cb.set_callback(std::forward<Object>(cb)); }
- template<class _Object> static devcb_base &set_out_iack0_callback(device_t &device, _Object object) { return downcast<bim68153_device &>(device).m_chn[CHN_0]->m_out_iack_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_out_iack1_callback(device_t &device, _Object object) { return downcast<bim68153_device &>(device).m_chn[CHN_1]->m_out_iack_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_out_iack2_callback(device_t &device, _Object object) { return downcast<bim68153_device &>(device).m_chn[CHN_2]->m_out_iack_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_out_iack4_callback(device_t &device, _Object object) { return downcast<bim68153_device &>(device).m_chn[CHN_3]->m_out_iack_cb.set_callback(object); }
+ template <class Object> static devcb_base &set_out_iack0_callback(device_t &device, Object &&cb) { return downcast<bim68153_device &>(device).m_chn[CHN_0]->m_out_iack_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_out_iack1_callback(device_t &device, Object &&cb) { return downcast<bim68153_device &>(device).m_chn[CHN_1]->m_out_iack_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_out_iack2_callback(device_t &device, Object &&cb) { return downcast<bim68153_device &>(device).m_chn[CHN_2]->m_out_iack_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_out_iack4_callback(device_t &device, Object &&cb) { return downcast<bim68153_device &>(device).m_chn[CHN_3]->m_out_iack_cb.set_callback(std::forward<Object>(cb)); }
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
@@ -161,6 +160,8 @@ public:
DECLARE_WRITE_LINE_MEMBER( int3_w ) { m_chn[CHN_3]->int_w(state); }
protected:
+ bim68153_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;
@@ -217,8 +218,8 @@ public :
};
// device type definition
-extern const device_type MC68153;
-extern const device_type EI68C153;
-extern const device_type MC68153_CHANNEL;
+DECLARE_DEVICE_TYPE(MC68153, bim68153_device)
+DECLARE_DEVICE_TYPE(EI68C153, ei68c153_device)
+DECLARE_DEVICE_TYPE(MC68153_CHANNEL, bim68153_channel)
-#endif /* MC68153BIM_H */
+#endif // MAME_MACHINE_68153BIM_H
diff --git a/src/devices/machine/6821pia.cpp b/src/devices/machine/6821pia.cpp
index 489391e043f..5b8dcbe03f0 100644
--- a/src/devices/machine/6821pia.cpp
+++ b/src/devices/machine/6821pia.cpp
@@ -40,10 +40,7 @@
//**************************************************************************
// device type definition
-const device_type PIA6821 = device_creator<pia6821_device>;
-
-template class device_finder<pia6821_device, false>;
-template class device_finder<pia6821_device, true>;
+DEFINE_DEVICE_TYPE(PIA6821, pia6821_device, "pia6821", "6821 PIA")
//-------------------------------------------------
@@ -51,7 +48,7 @@ template class device_finder<pia6821_device, true>;
//-------------------------------------------------
pia6821_device::pia6821_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, PIA6821, "6821 PIA", tag, owner, clock, "pia6821", __FILE__),
+ : device_t(mconfig, PIA6821, tag, owner, clock),
m_in_a_handler(*this),
m_in_b_handler(*this),
m_in_ca1_handler(*this),
diff --git a/src/devices/machine/6821pia.h b/src/devices/machine/6821pia.h
index 8c017b786fb..fb3cbb3a371 100644
--- a/src/devices/machine/6821pia.h
+++ b/src/devices/machine/6821pia.h
@@ -19,10 +19,10 @@
**********************************************************************/
-#pragma once
+#ifndef MAME_DEVICES_MACHINE_6821PIA_H
+#define MAME_DEVICES_MACHINE_6821PIA_H
-#ifndef __6821PIA_H__
-#define __6821PIA_H__
+#pragma once
@@ -241,10 +241,7 @@ private:
// device type definition
-extern const device_type PIA6821;
-
-extern template class device_finder<pia6821_device, false>;
-extern template class device_finder<pia6821_device, true>;
+DECLARE_DEVICE_TYPE(PIA6821, pia6821_device)
-#endif /* __6821PIA_H__ */
+#endif // MAME_DEVICES_MACHINE_6821PIA_H
diff --git a/src/devices/machine/68230pit.cpp b/src/devices/machine/68230pit.cpp
index bf5cfec90b7..f704a4ddd9a 100644
--- a/src/devices/machine/68230pit.cpp
+++ b/src/devices/machine/68230pit.cpp
@@ -58,25 +58,25 @@
// DEVICE TYPE DEFINITIONS
//**************************************************************************
-const device_type PIT68230 = device_creator<pit68230_device>;
+DEFINE_DEVICE_TYPE(PIT68230, pit68230_device, "pit68230", "MC68230 PI/T")
//-------------------------------------------------
// pit68230_device - constructors
//-------------------------------------------------
-pit68230_device::pit68230_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, uint32_t variant, const char *shortname, const char *source)
- : device_t (mconfig, type, name, tag, owner, clock, shortname, source)
+pit68230_device::pit68230_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint32_t variant)
+ : device_t(mconfig, type, tag, owner, clock)
, m_pa_out_cb(*this)
, m_pa_in_cb(*this)
, m_pb_out_cb(*this)
, m_pb_in_cb(*this)
, m_pc_out_cb(*this)
, m_pc_in_cb(*this)
- , m_h1_out_cb (*this)
- , m_h2_out_cb (*this)
- , m_h3_out_cb (*this)
- , m_h4_out_cb (*this)
- , m_tirq_out_cb (*this)
- , m_pirq_out_cb (*this)
+ , m_h1_out_cb(*this)
+ , m_h2_out_cb(*this)
+ , m_h3_out_cb(*this)
+ , m_h4_out_cb(*this)
+ , m_tirq_out_cb(*this)
+ , m_pirq_out_cb(*this)
, m_pgcr(0)
, m_psrr(0)
, m_paddr(0)
@@ -98,43 +98,12 @@ pit68230_device::pit68230_device(const machine_config &mconfig, device_type type
, m_cntr(0)
, m_tsr(0)
{
+ // FIXME: is the unused variant parameter supposed to be useful for something?
}
pit68230_device::pit68230_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t (mconfig, PIT68230, "PIT68230", tag, owner, clock, "pit68230", __FILE__)
- , m_pa_out_cb (*this)
- , m_pa_in_cb(*this)
- , m_pb_out_cb(*this)
- , m_pb_in_cb(*this)
- , m_pc_out_cb(*this)
- , m_pc_in_cb(*this)
- , m_h1_out_cb(*this)
- , m_h2_out_cb(*this)
- , m_h3_out_cb(*this)
- , m_h4_out_cb(*this)
- , m_tirq_out_cb (*this)
- , m_pirq_out_cb (*this)
- , m_pgcr(0)
- , m_psrr(0)
- , m_paddr(0)
- , m_pbddr(0)
- , m_pcddr(0)
- , m_pivr(0)
- , m_pacr(0)
- , m_pbcr(0)
- , m_padr(0)
- , m_pbdr(0)
- , m_pcdr(0)
- , m_psr(0)
- , m_tcr(0)
- , m_tivr(0)
- , m_cpr(0)
- // , m_cprh(0) // Collectivelly handled by m_cpr
- // , m_cprm(0) // Collectivelly handled by m_cpr
- // , m_cprl(0) // Collectivelly handled by m_cpr
- , m_cntr(0)
- , m_tsr(0)
+ : pit68230_device (mconfig, PIT68230, tag, owner, clock, 0)
{
}
diff --git a/src/devices/machine/68230pit.h b/src/devices/machine/68230pit.h
index 80614f926cb..14b71943cd6 100644
--- a/src/devices/machine/68230pit.h
+++ b/src/devices/machine/68230pit.h
@@ -32,10 +32,10 @@
*
**********************************************************************/
-#pragma once
+#ifndef MAME_MACHIEN_68230PIT_H
+#define MAME_MACHIEN_68230PIT_H
-#ifndef __68230PIT_H__
-#define __68230PIT_H__
+#pragma once
//**************************************************************************
@@ -110,29 +110,29 @@
//**************************************************************************
class pit68230_device : public device_t//, public device_execute_interface
{
- public:
+public:
// construction/destruction
- pit68230_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, uint32_t variant, const char *shortname, const char *source);
pit68230_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- template<class _Object> static devcb_base &set_pa_in_callback (device_t &device, _Object object){ return downcast<pit68230_device &>(device).m_pa_in_cb.set_callback (object); }
- template<class _Object> static devcb_base &set_pa_out_callback (device_t &device, _Object object){ return downcast<pit68230_device &>(device).m_pa_out_cb.set_callback (object); }
- template<class _Object> static devcb_base &set_pb_in_callback (device_t &device, _Object object){ return downcast<pit68230_device &>(device).m_pb_in_cb.set_callback (object); }
- template<class _Object> static devcb_base &set_pb_out_callback (device_t &device, _Object object){ return downcast<pit68230_device &>(device).m_pb_out_cb.set_callback (object); }
- template<class _Object> static devcb_base &set_pc_in_callback (device_t &device, _Object object){ return downcast<pit68230_device &>(device).m_pc_in_cb.set_callback (object); }
- template<class _Object> static devcb_base &set_pc_out_callback (device_t &device, _Object object){ return downcast<pit68230_device &>(device).m_pc_out_cb.set_callback (object); }
- template<class _Object> static devcb_base &set_h1_out_callback (device_t &device, _Object object){ return downcast<pit68230_device &>(device).m_h1_out_cb.set_callback (object); }
- template<class _Object> static devcb_base &set_h2_out_callback (device_t &device, _Object object){ return downcast<pit68230_device &>(device).m_h2_out_cb.set_callback (object); }
- template<class _Object> static devcb_base &set_h3_out_callback (device_t &device, _Object object){ return downcast<pit68230_device &>(device).m_h3_out_cb.set_callback (object); }
- template<class _Object> static devcb_base &set_h4_out_callback (device_t &device, _Object object){ return downcast<pit68230_device &>(device).m_h4_out_cb.set_callback (object); }
- template<class _Object> static devcb_base &set_tirq_out_callback (device_t &device, _Object object){ return downcast<pit68230_device &>(device).m_tirq_out_cb.set_callback (object); }
- template<class _Object> static devcb_base &set_pirq_out_callback (device_t &device, _Object object){ return downcast<pit68230_device &>(device).m_pirq_out_cb.set_callback (object); }
+
+ template <class Object> static devcb_base &set_pa_in_callback (device_t &device, Object &&cb){ return downcast<pit68230_device &>(device).m_pa_in_cb.set_callback (std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_pa_out_callback (device_t &device, Object &&cb){ return downcast<pit68230_device &>(device).m_pa_out_cb.set_callback (std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_pb_in_callback (device_t &device, Object &&cb){ return downcast<pit68230_device &>(device).m_pb_in_cb.set_callback (std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_pb_out_callback (device_t &device, Object &&cb){ return downcast<pit68230_device &>(device).m_pb_out_cb.set_callback (std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_pc_in_callback (device_t &device, Object &&cb){ return downcast<pit68230_device &>(device).m_pc_in_cb.set_callback (std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_pc_out_callback (device_t &device, Object &&cb){ return downcast<pit68230_device &>(device).m_pc_out_cb.set_callback (std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_h1_out_callback (device_t &device, Object &&cb){ return downcast<pit68230_device &>(device).m_h1_out_cb.set_callback (std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_h2_out_callback (device_t &device, Object &&cb){ return downcast<pit68230_device &>(device).m_h2_out_cb.set_callback (std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_h3_out_callback (device_t &device, Object &&cb){ return downcast<pit68230_device &>(device).m_h3_out_cb.set_callback (std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_h4_out_callback (device_t &device, Object &&cb){ return downcast<pit68230_device &>(device).m_h4_out_cb.set_callback (std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_tirq_out_callback (device_t &device, Object &&cb){ return downcast<pit68230_device &>(device).m_tirq_out_cb.set_callback (std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_pirq_out_callback (device_t &device, Object &&cb){ return downcast<pit68230_device &>(device).m_pirq_out_cb.set_callback (std::forward<Object>(cb)); }
DECLARE_WRITE8_MEMBER (write);
DECLARE_READ8_MEMBER (read);
// TODO: remove these methods and replace it with a call to methods below in force68k.cpp
- void h1_set (uint8_t state){ if (state) m_psr |= 1; else m_psr &= ~1; }
- void portb_setbit (uint8_t bit, uint8_t state);
+ void h1_set(uint8_t state) { if (state) m_psr |= 1; else m_psr &= ~1; }
+ void portb_setbit(uint8_t bit, uint8_t state);
// Bit updaters
void pa_update_bit(uint8_t bit, uint8_t state);
@@ -145,34 +145,34 @@ class pit68230_device : public device_t//, public device_execute_interface
DECLARE_WRITE_LINE_MEMBER( h3_w );
DECLARE_WRITE_LINE_MEMBER( h4_w );
- DECLARE_WRITE_LINE_MEMBER( pa0_w ){ pa_update_bit(0, state); }
- DECLARE_WRITE_LINE_MEMBER( pa1_w ){ pa_update_bit(1, state); }
- DECLARE_WRITE_LINE_MEMBER( pa2_w ){ pa_update_bit(2, state); }
- DECLARE_WRITE_LINE_MEMBER( pa3_w ){ pa_update_bit(3, state); }
- DECLARE_WRITE_LINE_MEMBER( pa4_w ){ pa_update_bit(4, state); }
- DECLARE_WRITE_LINE_MEMBER( pa5_w ){ pa_update_bit(5, state); }
- DECLARE_WRITE_LINE_MEMBER( pa6_w ){ pa_update_bit(6, state); }
- DECLARE_WRITE_LINE_MEMBER( pa7_w ){ pa_update_bit(7, state); }
-
- DECLARE_WRITE_LINE_MEMBER( pb0_w ){ pb_update_bit(0, state); }
- DECLARE_WRITE_LINE_MEMBER( pb1_w ){ pb_update_bit(1, state); }
- DECLARE_WRITE_LINE_MEMBER( pb2_w ){ pb_update_bit(2, state); }
- DECLARE_WRITE_LINE_MEMBER( pb3_w ){ pb_update_bit(3, state); }
- DECLARE_WRITE_LINE_MEMBER( pb4_w ){ pb_update_bit(4, state); }
- DECLARE_WRITE_LINE_MEMBER( pb5_w ){ pb_update_bit(5, state); }
- DECLARE_WRITE_LINE_MEMBER( pb6_w ){ pb_update_bit(6, state); }
- DECLARE_WRITE_LINE_MEMBER( pb7_w ){ pb_update_bit(7, state); }
-
- DECLARE_WRITE_LINE_MEMBER( pc0_w ){ pc_update_bit(0, state); }
- DECLARE_WRITE_LINE_MEMBER( pc1_w ){ pc_update_bit(1, state); }
- DECLARE_WRITE_LINE_MEMBER( pc2_w ){ pc_update_bit(2, state); }
- DECLARE_WRITE_LINE_MEMBER( pc3_w ){ pc_update_bit(3, state); }
- DECLARE_WRITE_LINE_MEMBER( pc4_w ){ pc_update_bit(4, state); }
- DECLARE_WRITE_LINE_MEMBER( pc5_w ){ pc_update_bit(5, state); }
- DECLARE_WRITE_LINE_MEMBER( pc6_w ){ pc_update_bit(6, state); }
- DECLARE_WRITE_LINE_MEMBER( pc7_w ){ pc_update_bit(7, state); }
-
- private:
+ DECLARE_WRITE_LINE_MEMBER( pa0_w ) { pa_update_bit(0, state); }
+ DECLARE_WRITE_LINE_MEMBER( pa1_w ) { pa_update_bit(1, state); }
+ DECLARE_WRITE_LINE_MEMBER( pa2_w ) { pa_update_bit(2, state); }
+ DECLARE_WRITE_LINE_MEMBER( pa3_w ) { pa_update_bit(3, state); }
+ DECLARE_WRITE_LINE_MEMBER( pa4_w ) { pa_update_bit(4, state); }
+ DECLARE_WRITE_LINE_MEMBER( pa5_w ) { pa_update_bit(5, state); }
+ DECLARE_WRITE_LINE_MEMBER( pa6_w ) { pa_update_bit(6, state); }
+ DECLARE_WRITE_LINE_MEMBER( pa7_w ) { pa_update_bit(7, state); }
+
+ DECLARE_WRITE_LINE_MEMBER( pb0_w ) { pb_update_bit(0, state); }
+ DECLARE_WRITE_LINE_MEMBER( pb1_w ) { pb_update_bit(1, state); }
+ DECLARE_WRITE_LINE_MEMBER( pb2_w ) { pb_update_bit(2, state); }
+ DECLARE_WRITE_LINE_MEMBER( pb3_w ) { pb_update_bit(3, state); }
+ DECLARE_WRITE_LINE_MEMBER( pb4_w ) { pb_update_bit(4, state); }
+ DECLARE_WRITE_LINE_MEMBER( pb5_w ) { pb_update_bit(5, state); }
+ DECLARE_WRITE_LINE_MEMBER( pb6_w ) { pb_update_bit(6, state); }
+ DECLARE_WRITE_LINE_MEMBER( pb7_w ) { pb_update_bit(7, state); }
+
+ DECLARE_WRITE_LINE_MEMBER( pc0_w ) { pc_update_bit(0, state); }
+ DECLARE_WRITE_LINE_MEMBER( pc1_w ) { pc_update_bit(1, state); }
+ DECLARE_WRITE_LINE_MEMBER( pc2_w ) { pc_update_bit(2, state); }
+ DECLARE_WRITE_LINE_MEMBER( pc3_w ) { pc_update_bit(3, state); }
+ DECLARE_WRITE_LINE_MEMBER( pc4_w ) { pc_update_bit(4, state); }
+ DECLARE_WRITE_LINE_MEMBER( pc5_w ) { pc_update_bit(5, state); }
+ DECLARE_WRITE_LINE_MEMBER( pc6_w ) { pc_update_bit(6, state); }
+ DECLARE_WRITE_LINE_MEMBER( pc7_w ) { pc_update_bit(7, state); }
+
+private:
void wr_pitreg_pgcr(uint8_t data);
void wr_pitreg_psrr(uint8_t data);
void wr_pitreg_paddr(uint8_t data);
@@ -311,10 +311,12 @@ protected:
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, void *ptr) override;
+ virtual void device_start() override;
+ virtual void device_reset() override;
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
// Interrupt methods
void trigger_interrupt(int source);
@@ -375,6 +377,6 @@ protected:
};
// device type definition
-extern const device_type PIT68230;
+DECLARE_DEVICE_TYPE(PIT68230, pit68230_device)
-#endif /* __68230PIT_H__ */
+#endif // MAME_MACHIEN_68230PIT_H
diff --git a/src/devices/machine/68307.cpp b/src/devices/machine/68307.cpp
index fbbf8400ad7..cb51fca82fe 100644
--- a/src/devices/machine/68307.cpp
+++ b/src/devices/machine/68307.cpp
@@ -4,8 +4,11 @@
#include "emu.h"
#include "68307.h"
+#include "68307bus.h"
+#include "68307sim.h"
+#include "68307tmu.h"
-const device_type M68307 = device_creator<m68307cpu_device>;
+DEFINE_DEVICE_TYPE(M68307, m68307_cpu_device, "mc68307", "MC68307")
/* 68307 SERIAL Module */
@@ -18,24 +21,24 @@ const device_type M68307 = device_creator<m68307cpu_device>;
a custom verson here, that may change later if subtle differences exist.
*/
-READ8_MEMBER( m68307cpu_device::m68307_internal_serial_r )
+READ8_MEMBER( m68307_cpu_device::m68307_internal_serial_r )
{
- m68307cpu_device *m68k = this;
+ m68307_cpu_device *m68k = this;
if (offset&1) return m_duart->read(*m68k->program, offset>>1);
return 0x0000;
}
-WRITE8_MEMBER(m68307cpu_device::m68307_internal_serial_w)
+WRITE8_MEMBER(m68307_cpu_device::m68307_internal_serial_w)
{
- m68307cpu_device *m68k = this;
+ m68307_cpu_device *m68k = this;
if (offset & 1) m_duart->write(*m68k->program, offset >> 1, data);
}
-static ADDRESS_MAP_START( m68307_internal_map, AS_PROGRAM, 16, m68307cpu_device )
+static ADDRESS_MAP_START( m68307_internal_map, AS_PROGRAM, 16, m68307_cpu_device )
AM_RANGE(0x000000f0, 0x000000ff) AM_READWRITE(m68307_internal_base_r, m68307_internal_base_w)
ADDRESS_MAP_END
@@ -43,21 +46,21 @@ ADDRESS_MAP_END
static MACHINE_CONFIG_FRAGMENT( 68307fragment )
MCFG_MC68681_ADD("internal68681", 16000000/4) // ?? Mhz - should be specified in inline config
- MCFG_MC68681_IRQ_CALLBACK(WRITELINE(m68307cpu_device, m68307_duart_irq_handler))
- MCFG_MC68681_A_TX_CALLBACK(WRITELINE(m68307cpu_device, m68307_duart_txa))
- MCFG_MC68681_B_TX_CALLBACK(WRITELINE(m68307cpu_device, m68307_duart_txb))
- MCFG_MC68681_INPORT_CALLBACK(READ8(m68307cpu_device, m68307_duart_input_r))
- MCFG_MC68681_OUTPORT_CALLBACK(WRITE8(m68307cpu_device, m68307_duart_output_w))
+ MCFG_MC68681_IRQ_CALLBACK(WRITELINE(m68307_cpu_device, m68307_duart_irq_handler))
+ MCFG_MC68681_A_TX_CALLBACK(WRITELINE(m68307_cpu_device, m68307_duart_txa))
+ MCFG_MC68681_B_TX_CALLBACK(WRITELINE(m68307_cpu_device, m68307_duart_txb))
+ MCFG_MC68681_INPORT_CALLBACK(READ8(m68307_cpu_device, m68307_duart_input_r))
+ MCFG_MC68681_OUTPORT_CALLBACK(WRITE8(m68307_cpu_device, m68307_duart_output_w))
MACHINE_CONFIG_END
-machine_config_constructor m68307cpu_device::device_mconfig_additions() const
+machine_config_constructor m68307_cpu_device::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( 68307fragment );
}
-m68307cpu_device::m68307cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : m68000_device(mconfig, "MC68307", tag, owner, clock, M68307, 16,24, ADDRESS_MAP_NAME(m68307_internal_map), "mc68307", __FILE__),
+m68307_cpu_device::m68307_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : m68000_device(mconfig, tag, owner, clock, M68307, 16, 24, ADDRESS_MAP_NAME(m68307_internal_map)),
write_irq(*this),
write_a_tx(*this),
write_b_tx(*this),
@@ -79,7 +82,7 @@ m68307cpu_device::m68307cpu_device(const machine_config &mconfig, const char *ta
-void m68307cpu_device::device_reset()
+void m68307_cpu_device::device_reset()
{
m68000_device::device_reset();
@@ -98,100 +101,102 @@ void m68307cpu_device::device_reset()
and install handlers? Going through this logic for every memory access is
very slow */
-int m68307_calc_cs(m68307cpu_device *m68k, offs_t address)
+inline int m68307_cpu_device::calc_cs(offs_t address) const
{
- m68307_sim* sim = m68k->m68307SIM;
-
- for (int i=0;i<4;i++)
+ m68307_sim const &sim = *m68307SIM;
+ for (int i=0; i < 4; i++)
{
- int br,amask,bra;
- br = sim->m_br[i] & 1;
- amask = ((sim->m_or[i]&0x1ffc)<<11);
- bra = ((sim->m_br[i] & 0x1ffc)<<11);
- if ((br) && ((address & amask) == bra)) return i+1;
+ int const br = sim.m_br[i] & 1;
+ int const amask = (sim.m_or[i] & 0x1ffc) << 11;
+ int const bra = (sim.m_br[i] & 0x1ffc) << 11;
+ if (br && ((address & amask) == bra)) return i + 1;
}
return 0;
}
-uint16_t m68307cpu_device::simple_read_immediate_16_m68307(offs_t address)
+uint16_t m68307_cpu_device::simple_read_immediate_16_m68307(offs_t address)
{
-// m68307_currentcs = m68307_calc_cs(this, address);
+// m68307_currentcs = calc_cs(address);
return m_direct->read_word(address);
}
-uint8_t m68307cpu_device::read_byte_m68307(offs_t address)
+uint8_t m68307_cpu_device::read_byte_m68307(offs_t address)
{
-// m68307_currentcs = m68307_calc_cs(this, address);
+// m68307_currentcs = calc_cs(address);
return m_space->read_byte(address);
}
-uint16_t m68307cpu_device::read_word_m68307(offs_t address)
+uint16_t m68307_cpu_device::read_word_m68307(offs_t address)
{
-// m68307_currentcs = m68307_calc_cs(this, address);
+// m68307_currentcs = calc_cs(address);
return m_space->read_word(address);
}
-uint32_t m68307cpu_device::read_dword_m68307(offs_t address)
+uint32_t m68307_cpu_device::read_dword_m68307(offs_t address)
{
-// m68307_currentcs = m68307_calc_cs(this, address);
+// m68307_currentcs = calc_cs(address);
return m_space->read_dword(address);
}
-void m68307cpu_device::write_byte_m68307(offs_t address, uint8_t data)
+void m68307_cpu_device::write_byte_m68307(offs_t address, uint8_t data)
{
-// m68307_currentcs = m68307_calc_cs(this, address);
+// m68307_currentcs = calc_cs(address);
m_space->write_byte(address, data);
}
-void m68307cpu_device::write_word_m68307(offs_t address, uint16_t data)
+void m68307_cpu_device::write_word_m68307(offs_t address, uint16_t data)
{
-// m68307_currentcs = m68307_calc_cs(this, address);
+// m68307_currentcs = calc_cs(address);
m_space->write_word(address, data);
}
-void m68307cpu_device::write_dword_m68307(offs_t address, uint32_t data)
+void m68307_cpu_device::write_dword_m68307(offs_t address, uint32_t data)
{
-// m68307_currentcs = m68307_calc_cs(this, address);
+// m68307_currentcs = calc_cs(address);
m_space->write_dword(address, data);
}
-void m68307cpu_device::init16_m68307(address_space &space)
+void m68307_cpu_device::init16_m68307(address_space &space)
{
m_space = &space;
m_direct = &space.direct();
opcode_xor = 0;
- readimm16 = m68k_readimm16_delegate(&m68307cpu_device::simple_read_immediate_16_m68307, this);
- read8 = m68k_read8_delegate(&m68307cpu_device::read_byte_m68307, this);
- read16 = m68k_read16_delegate(&m68307cpu_device::read_word_m68307, this);
- read32 = m68k_read32_delegate(&m68307cpu_device::read_dword_m68307, this);
- write8 = m68k_write8_delegate(&m68307cpu_device::write_byte_m68307, this);
- write16 = m68k_write16_delegate(&m68307cpu_device::write_word_m68307, this);
- write32 = m68k_write32_delegate(&m68307cpu_device::write_dword_m68307, this);
+ readimm16 = m68k_readimm16_delegate(&m68307_cpu_device::simple_read_immediate_16_m68307, this);
+ read8 = m68k_read8_delegate(&m68307_cpu_device::read_byte_m68307, this);
+ read16 = m68k_read16_delegate(&m68307_cpu_device::read_word_m68307, this);
+ read32 = m68k_read32_delegate(&m68307_cpu_device::read_dword_m68307, this);
+ write8 = m68k_write8_delegate(&m68307_cpu_device::write_byte_m68307, this);
+ write16 = m68k_write16_delegate(&m68307_cpu_device::write_word_m68307, this);
+ write32 = m68k_write32_delegate(&m68307_cpu_device::write_dword_m68307, this);
}
-void m68307cpu_device::set_port_callbacks(m68307_porta_read_delegate porta_r, m68307_porta_write_delegate porta_w, m68307_portb_read_delegate portb_r, m68307_portb_write_delegate portb_w)
+void m68307_cpu_device::set_port_callbacks(
+ porta_read_delegate &&porta_r,
+ porta_write_delegate &&porta_w,
+ portb_read_delegate &&portb_r,
+ portb_write_delegate &&portb_w)
{
- m_m68307_porta_r = porta_r;
- m_m68307_porta_w = porta_w;
- m_m68307_portb_r = portb_r;
- m_m68307_portb_w = portb_w;
+ m_porta_r = std::move(porta_r);
+ m_porta_w = std::move(porta_w);
+ m_portb_r = std::move(portb_r);
+ m_portb_w = std::move(portb_w);
}
-uint16_t m68307cpu_device::get_cs(offs_t address)
+uint16_t m68307_cpu_device::get_cs(offs_t address)
{
- m68307_currentcs = m68307_calc_cs(this, address);
+ m68307_currentcs = calc_cs(address);
return m68307_currentcs;
}
@@ -199,19 +204,19 @@ uint16_t m68307cpu_device::get_cs(offs_t address)
/* 68307 specifics - MOVE */
-void m68307cpu_device::set_interrupt(int level, int vector)
+void m68307_cpu_device::set_interrupt(int level, int vector)
{
set_input_line_and_vector(level, HOLD_LINE, vector);
}
-void m68307cpu_device::timer0_interrupt()
+void m68307_cpu_device::timer0_interrupt()
{
int prioritylevel = (m68307SIM->m_picr & 0x7000)>>12;
int vector = (m68307SIM->m_pivr & 0x00f0) | 0xa;
set_interrupt(prioritylevel, vector);
}
-void m68307cpu_device::timer1_interrupt()
+void m68307_cpu_device::timer1_interrupt()
{
int prioritylevel = (m68307SIM->m_picr & 0x0700)>>8;
int vector = (m68307SIM->m_pivr & 0x00f0) | 0xb;
@@ -219,13 +224,13 @@ void m68307cpu_device::timer1_interrupt()
}
-void m68307cpu_device::serial_interrupt(int vector)
+void m68307_cpu_device::serial_interrupt(int vector)
{
int prioritylevel = (m68307SIM->m_picr & 0x0070)>>4;
set_interrupt(prioritylevel, vector);
}
-WRITE_LINE_MEMBER(m68307cpu_device::m68307_duart_irq_handler)
+WRITE_LINE_MEMBER(m68307_cpu_device::m68307_duart_irq_handler)
{
if (state == ASSERT_LINE)
{
@@ -233,14 +238,14 @@ WRITE_LINE_MEMBER(m68307cpu_device::m68307_duart_irq_handler)
}
}
-void m68307cpu_device::mbus_interrupt()
+void m68307_cpu_device::mbus_interrupt()
{
int prioritylevel = (m68307SIM->m_picr & 0x0007)>>0;
int vector = (m68307SIM->m_pivr & 0x00f0) | 0xd;
set_interrupt(prioritylevel, vector);
}
-void m68307cpu_device::licr2_interrupt()
+void m68307_cpu_device::licr2_interrupt()
{
int prioritylevel = (m68307SIM->m_licr2 & 0x0007)>>0;
int vector = (m68307SIM->m_pivr & 0x00f0) | 0x9;
@@ -250,7 +255,7 @@ void m68307cpu_device::licr2_interrupt()
set_interrupt(prioritylevel, vector);
}
-void m68307cpu_device::device_start()
+void m68307_cpu_device::device_start()
{
init_cpu_m68000();
@@ -281,14 +286,14 @@ void m68307cpu_device::device_start()
read_inport.resolve();
write_outport.resolve_safe();
- set_port_callbacks(m68307_porta_read_delegate(),m68307_porta_write_delegate(),m68307_portb_read_delegate(),m68307_portb_write_delegate());
+ set_port_callbacks(porta_read_delegate(), porta_write_delegate(), portb_read_delegate(), portb_write_delegate());
}
-READ16_MEMBER( m68307cpu_device::m68307_internal_base_r )
+READ16_MEMBER( m68307_cpu_device::m68307_internal_base_r )
{
- m68307cpu_device *m68k = this;
+ m68307_cpu_device *m68k = this;
int pc = space.device().safe_pc();
logerror("%08x m68307_internal_base_r %08x, (%04x)\n", pc, offset*2,mem_mask);
@@ -305,9 +310,9 @@ READ16_MEMBER( m68307cpu_device::m68307_internal_base_r )
return 0x0000;
}
-WRITE16_MEMBER( m68307cpu_device::m68307_internal_base_w )
+WRITE16_MEMBER( m68307_cpu_device::m68307_internal_base_w )
{
- m68307cpu_device *m68k = this;
+ m68307_cpu_device *m68k = this;
int pc = space.device().safe_pc();
logerror("%08x m68307_internal_base_w %08x, %04x (%04x)\n", pc, offset*2,data,mem_mask);
@@ -333,10 +338,10 @@ WRITE16_MEMBER( m68307cpu_device::m68307_internal_base_w )
base = (m68k->m68307_base & 0x0fff) << 12;
//mask = (m68k->m68307_base & 0xe000) >> 13;
//if ( m68k->m68307_base & 0x1000 ) mask |= 7;
- m68k->internal->install_readwrite_handler(base + 0x000, base + 0x04f, read16_delegate(FUNC(m68307cpu_device::m68307_internal_sim_r),this), write16_delegate(FUNC(m68307cpu_device::m68307_internal_sim_w),this));
- m68k->internal->install_readwrite_handler(base + 0x100, base + 0x11f, read8_delegate(FUNC(m68307cpu_device::m68307_internal_serial_r),this), write8_delegate(FUNC(m68307cpu_device::m68307_internal_serial_w),this), 0xffff);
- m68k->internal->install_readwrite_handler(base + 0x120, base + 0x13f, read16_delegate(FUNC(m68307cpu_device::m68307_internal_timer_r),this), write16_delegate(FUNC(m68307cpu_device::m68307_internal_timer_w),this));
- m68k->internal->install_readwrite_handler(base + 0x140, base + 0x149, read8_delegate(FUNC(m68307cpu_device::m68307_internal_mbus_r),this), write8_delegate(FUNC(m68307cpu_device::m68307_internal_mbus_w),this), 0xffff);
+ m68k->internal->install_readwrite_handler(base + 0x000, base + 0x04f, read16_delegate(FUNC(m68307_cpu_device::m68307_internal_sim_r),this), write16_delegate(FUNC(m68307_cpu_device::m68307_internal_sim_w),this));
+ m68k->internal->install_readwrite_handler(base + 0x100, base + 0x11f, read8_delegate(FUNC(m68307_cpu_device::m68307_internal_serial_r),this), write8_delegate(FUNC(m68307_cpu_device::m68307_internal_serial_w),this), 0xffff);
+ m68k->internal->install_readwrite_handler(base + 0x120, base + 0x13f, read16_delegate(FUNC(m68307_cpu_device::m68307_internal_timer_r),this), write16_delegate(FUNC(m68307_cpu_device::m68307_internal_timer_w),this));
+ m68k->internal->install_readwrite_handler(base + 0x140, base + 0x149, read8_delegate(FUNC(m68307_cpu_device::m68307_internal_mbus_r),this), write8_delegate(FUNC(m68307_cpu_device::m68307_internal_mbus_w),this), 0xffff);
break;
diff --git a/src/devices/machine/68307.h b/src/devices/machine/68307.h
index c3ea6ea9286..e6ba1afcf44 100644
--- a/src/devices/machine/68307.h
+++ b/src/devices/machine/68307.h
@@ -1,61 +1,52 @@
// license:BSD-3-Clause
// copyright-holders:David Haywood
/* 68307 */
-
+#ifndef MAME_MACHINE_68307_H
+#define MAME_MACHINE_68307_H
#pragma once
-#ifndef __M68307_H__
-#define __M68307_H__
#include "cpu/m68000/m68000.h"
-
-#include "68307sim.h"
-#include "68307bus.h"
-#include "68307tmu.h"
#include "machine/mc68681.h"
-typedef device_delegate<uint8_t (address_space &space, bool dedicated, uint8_t line_mask)> m68307_porta_read_delegate;
-typedef device_delegate<void (address_space &space, bool dedicated, uint8_t data, uint8_t line_mask)> m68307_porta_write_delegate;
-typedef device_delegate<uint16_t (address_space &space, bool dedicated, uint16_t line_mask)> m68307_portb_read_delegate;
-typedef device_delegate<void (address_space &space, bool dedicated, uint16_t data, uint16_t line_mask)> m68307_portb_write_delegate;
-
-
/* trampolines so we can specify the 68681 serial configuration when adding the CPU */
#define MCFG_MC68307_SERIAL_A_TX_CALLBACK(_cb) \
- devcb = &m68307cpu_device::set_a_tx_cb(*device, DEVCB_##_cb);
+ devcb = &m68307_cpu_device::set_a_tx_cb(*device, DEVCB_##_cb);
#define MCFG_MC68307_SERIAL_B_TX_CALLBACK(_cb) \
- devcb = &m68307cpu_device::set_b_tx_cb(*device, DEVCB_##_cb);
+ devcb = &m68307_cpu_device::set_b_tx_cb(*device, DEVCB_##_cb);
// deprecated: use ipX_w() instead
#define MCFG_MC68307_SERIAL_INPORT_CALLBACK(_cb) \
- devcb = &m68307cpu_device::set_inport_cb(*device, DEVCB_##_cb);
+ devcb = &m68307_cpu_device::set_inport_cb(*device, DEVCB_##_cb);
#define MCFG_MC68307_SERIAL_OUTPORT_CALLBACK(_cb) \
- devcb = &m68307cpu_device::set_outport_cb(*device, DEVCB_##_cb);
+ devcb = &m68307_cpu_device::set_outport_cb(*device, DEVCB_##_cb);
-class m68307cpu_device : public m68000_device {
+class m68307_cpu_device : public m68000_device
+{
public:
- m68307cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ typedef device_delegate<uint8_t (address_space &space, bool dedicated, uint8_t line_mask)> porta_read_delegate;
+ typedef device_delegate<void (address_space &space, bool dedicated, uint8_t data, uint8_t line_mask)> porta_write_delegate;
+ typedef device_delegate<uint16_t (address_space &space, bool dedicated, uint16_t line_mask)> portb_read_delegate;
+ typedef device_delegate<void (address_space &space, bool dedicated, uint16_t data, uint16_t line_mask)> portb_write_delegate;
+
+ m68307_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
/* trampolines so we can specify the 68681 serial configuration when adding the CPU */
- template<class _Object> static devcb_base &set_irq_cb(device_t &device, _Object object) { return downcast<m68307cpu_device &>(device).write_irq.set_callback(object); }
- template<class _Object> static devcb_base &set_a_tx_cb(device_t &device, _Object object) { return downcast<m68307cpu_device &>(device).write_a_tx.set_callback(object); }
- template<class _Object> static devcb_base &set_b_tx_cb(device_t &device, _Object object) { return downcast<m68307cpu_device &>(device).write_b_tx.set_callback(object); }
- template<class _Object> static devcb_base &set_inport_cb(device_t &device, _Object object) { return downcast<m68307cpu_device &>(device).read_inport.set_callback(object); }
- template<class _Object> static devcb_base &set_outport_cb(device_t &device, _Object object) { return downcast<m68307cpu_device &>(device).write_outport.set_callback(object); }
+ template <class Object> static devcb_base &set_irq_cb(device_t &device, Object &&cb) { return downcast<m68307_cpu_device &>(device).write_irq.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_a_tx_cb(device_t &device, Object &&cb) { return downcast<m68307_cpu_device &>(device).write_a_tx.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_b_tx_cb(device_t &device, Object &&cb) { return downcast<m68307_cpu_device &>(device).write_b_tx.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_inport_cb(device_t &device, Object &&cb) { return downcast<m68307_cpu_device &>(device).read_inport.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_outport_cb(device_t &device, Object &&cb) { return downcast<m68307_cpu_device &>(device).write_outport.set_callback(std::forward<Object>(cb)); }
DECLARE_WRITE_LINE_MEMBER(m68307_duart_irq_handler);
- DECLARE_WRITE_LINE_MEMBER(m68307_duart_txa){ write_a_tx(state); }
- DECLARE_WRITE_LINE_MEMBER(m68307_duart_txb){ write_b_tx(state); }
- DECLARE_READ8_MEMBER(m68307_duart_input_r){ return read_inport(); }
- DECLARE_WRITE8_MEMBER(m68307_duart_output_w){ write_outport(data); }
- devcb_write_line write_irq, write_a_tx, write_b_tx;
- devcb_read8 read_inport;
- devcb_write8 write_outport;
-
+ DECLARE_WRITE_LINE_MEMBER(m68307_duart_txa) { write_a_tx(state); }
+ DECLARE_WRITE_LINE_MEMBER(m68307_duart_txb) { write_b_tx(state); }
+ DECLARE_READ8_MEMBER(m68307_duart_input_r) { return read_inport(); }
+ DECLARE_WRITE8_MEMBER(m68307_duart_output_w) { write_outport(data); }
uint16_t simple_read_immediate_16_m68307(offs_t address);
@@ -66,20 +57,6 @@ public:
void write_word_m68307(offs_t address, uint16_t data);
void write_dword_m68307(offs_t address, uint32_t data);
-
- /* 68307 peripheral modules */
- m68307_sim* m68307SIM;
- m68307_mbus* m68307MBUS;
-// m68307_serial* m68307SERIAL;
- m68307_timer* m68307TIMER;
-
- uint16_t m68307_base;
- uint16_t m68307_scrhigh;
- uint16_t m68307_scrlow;
-
- int m68307_currentcs;
-
-
DECLARE_READ16_MEMBER( m68307_internal_base_r );
DECLARE_WRITE16_MEMBER( m68307_internal_base_w );
DECLARE_READ16_MEMBER( m68307_internal_timer_r );
@@ -91,38 +68,60 @@ public:
DECLARE_READ8_MEMBER( m68307_internal_mbus_r );
DECLARE_WRITE8_MEMBER( m68307_internal_mbus_w );
-
/* callbacks for internal ports */
- void set_port_callbacks(m68307_porta_read_delegate porta_r, m68307_porta_write_delegate porta_w, m68307_portb_read_delegate portb_r, m68307_portb_write_delegate portb_w);
- void set_interrupt(int level, int vector);
+ void set_port_callbacks(porta_read_delegate &&porta_r, porta_write_delegate &&porta_w, portb_read_delegate &&portb_r, portb_write_delegate &&portb_w);
uint16_t get_cs(offs_t address);
+ void licr2_interrupt();
+
+protected:
+ class m68307_sim;
+ class m68307_mbus;
+ class m68307_timer;
+
+ virtual void device_start() override;
+ virtual void device_reset() override;
+ virtual machine_config_constructor device_mconfig_additions() const override;
+
+ virtual uint32_t disasm_min_opcode_bytes() const override { return 2; }
+ virtual uint32_t disasm_max_opcode_bytes() const override { return 10; }
+
+ virtual uint32_t execute_min_cycles() const override { return 4; }
+ virtual uint32_t execute_max_cycles() const override { return 158; }
+
+ void set_interrupt(int level, int vector);
void timer0_interrupt();
void timer1_interrupt();
void serial_interrupt(int vector);
void mbus_interrupt();
- void licr2_interrupt();
-
- m68307_porta_read_delegate m_m68307_porta_r;
- m68307_porta_write_delegate m_m68307_porta_w;
- m68307_portb_read_delegate m_m68307_portb_r;
- m68307_portb_write_delegate m_m68307_portb_w;
void init16_m68307(address_space &space);
- virtual uint32_t disasm_min_opcode_bytes() const override { return 2; };
- virtual uint32_t disasm_max_opcode_bytes() const override { return 10; };
+ int calc_cs(offs_t address) const;
- virtual uint32_t execute_min_cycles() const override { return 4; };
- virtual uint32_t execute_max_cycles() const override { return 158; };
+ devcb_write_line write_irq, write_a_tx, write_b_tx;
+ devcb_read8 read_inport;
+ devcb_write8 write_outport;
+
+ /* 68307 peripheral modules */
+ m68307_sim* m68307SIM;
+ m68307_mbus* m68307MBUS;
+// m68307_serial* m68307SERIAL;
+ m68307_timer* m68307TIMER;
+
+ uint16_t m68307_base;
+ uint16_t m68307_scrhigh;
+ uint16_t m68307_scrlow;
+
+ int m68307_currentcs;
+
+ porta_read_delegate m_porta_r;
+ porta_write_delegate m_porta_w;
+ portb_read_delegate m_portb_r;
+ portb_write_delegate m_portb_w;
required_device<mc68681_device> m_duart;
-protected:
- virtual machine_config_constructor device_mconfig_additions() const override;
- virtual void device_start() override;
- virtual void device_reset() override;
};
-extern const device_type M68307;
-
+DECLARE_DEVICE_TYPE(M68307, m68307_cpu_device)
-#endif
+#endif // MAME_MACHINE_68307_H
diff --git a/src/devices/machine/68307bus.cpp b/src/devices/machine/68307bus.cpp
index 91c193f2d4e..3eea5a0811d 100644
--- a/src/devices/machine/68307bus.cpp
+++ b/src/devices/machine/68307bus.cpp
@@ -4,109 +4,107 @@
/* all ports on this are 8-bit? */
#include "emu.h"
-#include "68307.h"
+#include "68307bus.h"
-READ8_MEMBER( m68307cpu_device::m68307_internal_mbus_r )
+#define m68307BUS_MADR (0x01)
+#define m68307BUS_MFDR (0x03)
+#define m68307BUS_MBCR (0x05)
+#define m68307BUS_MBSR (0x07)
+#define m68307BUS_MBDR (0x09)
+
+READ8_MEMBER( m68307_cpu_device::m68307_internal_mbus_r )
{
- m68307cpu_device *m68k = this;
- m68307_mbus* mbus = m68k->m68307MBUS;
- assert(mbus != nullptr);
+ assert(m68307MBUS);
+ m68307_mbus &mbus = *m68307MBUS;
uint8_t retval;
- if (mbus)
- {
- int pc = space.device().safe_pc();
-
-
- switch (offset)
- {
- case m68307BUS_MADR:
- logerror("%08x m68307_internal_mbus_r %08x (MADR - M-Bus Address Register)\n", pc, offset);
- return space.machine().rand();
-
- case m68307BUS_MFDR:
- logerror("%08x m68307_internal_mbus_r %08x (MFDR - M-Bus Frequency Divider Register)\n", pc, offset);
- return space.machine().rand();
-
- case m68307BUS_MBCR:
- logerror("%08x m68307_internal_mbus_r %08x (MFCR - M-Bus Control Register)\n", pc, offset);
- return mbus->m_MFCR;//space.machine().rand();
+ int pc = space.device().safe_pc();
- case m68307BUS_MBSR:
- logerror("%08x m68307_internal_mbus_r %08x (MBSR - M-Bus Status Register)\n", pc, offset);
- retval = 0;
- if (mbus->m_busy) retval |= 0x20;
- if (mbus->m_intpend) retval |= 0x02;
- return retval;
-
- case m68307BUS_MBDR:
- logerror("%08x m68307_internal_mbus_r %08x (MBDR - M-Bus Data I/O Register)\n", pc, offset);
- mbus->m_intpend = true;
- return 0xff;//space.machine().rand();
-
- default:
- logerror("%08x m68307_internal_mbus_r %08x (UNKNOWN / ILLEGAL)\n", pc, offset);
- return 0x00;
- }
+ switch (offset)
+ {
+ case m68307BUS_MADR:
+ logerror("%08x m68307_internal_mbus_r %08x (MADR - M-Bus Address Register)\n", pc, offset);
+ return space.machine().rand();
+
+ case m68307BUS_MFDR:
+ logerror("%08x m68307_internal_mbus_r %08x (MFDR - M-Bus Frequency Divider Register)\n", pc, offset);
+ return space.machine().rand();
+
+ case m68307BUS_MBCR:
+ logerror("%08x m68307_internal_mbus_r %08x (MFCR - M-Bus Control Register)\n", pc, offset);
+ return mbus.m_MFCR;//space.machine().rand();
+
+ case m68307BUS_MBSR:
+ logerror("%08x m68307_internal_mbus_r %08x (MBSR - M-Bus Status Register)\n", pc, offset);
+ retval = 0;
+ if (mbus.m_busy) retval |= 0x20;
+ if (mbus.m_intpend) retval |= 0x02;
+
+ return retval;
+
+ case m68307BUS_MBDR:
+ logerror("%08x m68307_internal_mbus_r %08x (MBDR - M-Bus Data I/O Register)\n", pc, offset);
+ mbus.m_intpend = true;
+ return 0xff;//space.machine().rand();
+
+ default:
+ logerror("%08x m68307_internal_mbus_r %08x (UNKNOWN / ILLEGAL)\n", pc, offset);
+ return 0x00;
}
return 0xff;
}
-WRITE8_MEMBER( m68307cpu_device::m68307_internal_mbus_w )
+WRITE8_MEMBER( m68307_cpu_device::m68307_internal_mbus_w )
{
- m68307cpu_device *m68k = this;
- m68307_mbus* mbus = m68k->m68307MBUS;
- assert(mbus != nullptr);
+ assert(m68307MBUS);
+ m68307_mbus &mbus = *m68307MBUS;
- if (mbus)
- {
- int pc = space.device().safe_pc();
+ int pc = space.device().safe_pc();
- switch (offset)
- {
- case m68307BUS_MADR:
- logerror("%08x m68307_internal_mbus_w %08x, %02x (MADR - M-Bus Address Register)\n", pc, offset,data);
- break;
+ switch (offset)
+ {
+ case m68307BUS_MADR:
+ logerror("%08x m68307_internal_mbus_w %08x, %02x (MADR - M-Bus Address Register)\n", pc, offset,data);
+ break;
- case m68307BUS_MFDR:
- logerror("%08x m68307_internal_mbus_w %08x, %02x (MFDR - M-Bus Frequency Divider Register)\n", pc, offset,data);
- break;
+ case m68307BUS_MFDR:
+ logerror("%08x m68307_internal_mbus_w %08x, %02x (MFDR - M-Bus Frequency Divider Register)\n", pc, offset,data);
+ break;
- case m68307BUS_MBCR:
- logerror("%08x m68307_internal_mbus_w %08x, %02x (MFCR - M-Bus Control Register)\n", pc, offset,data);
+ case m68307BUS_MBCR:
+ logerror("%08x m68307_internal_mbus_w %08x, %02x (MFCR - M-Bus Control Register)\n", pc, offset,data);
- mbus->m_MFCR = data;
- if (data & 0x80)
- {
- mbus->m_busy = false;
- mbus->m_intpend = false;
- }
- if (data & 0x20) mbus->m_busy = true;
+ mbus.m_MFCR = data;
+ if (data & 0x80)
+ {
+ mbus.m_busy = false;
+ mbus.m_intpend = false;
+ }
+ if (data & 0x20) mbus.m_busy = true;
- break;
+ break;
- case m68307BUS_MBSR:
- logerror("%08x m68307_internal_mbus_w %08x, %02x (MBSR - M-Bus Status Register)\n", pc, offset,data);
- break;
+ case m68307BUS_MBSR:
+ logerror("%08x m68307_internal_mbus_w %08x, %02x (MBSR - M-Bus Status Register)\n", pc, offset,data);
+ break;
- case m68307BUS_MBDR:
- logerror("%08x m68307_internal_mbus_w %08x, %02x (MBDR - M-Bus Data I/O Register)\n", pc, offset,data);
+ case m68307BUS_MBDR:
+ logerror("%08x m68307_internal_mbus_w %08x, %02x (MBDR - M-Bus Data I/O Register)\n", pc, offset,data);
- mbus->m_intpend = true;
+ mbus.m_intpend = true;
- break;
+ break;
- default:
- logerror("%08x m68307_internal_mbus_w %08x, %02x (UNKNOWN / ILLEGAL)\n", pc, offset,data);
- break;
- }
+ default:
+ logerror("%08x m68307_internal_mbus_w %08x, %02x (UNKNOWN / ILLEGAL)\n", pc, offset,data);
+ break;
}
}
-void m68307_mbus::reset(void)
+void m68307_cpu_device::m68307_mbus::reset()
{
m_busy = false;
}
diff --git a/src/devices/machine/68307bus.h b/src/devices/machine/68307bus.h
index eb6db9811ae..e927979c034 100644
--- a/src/devices/machine/68307bus.h
+++ b/src/devices/machine/68307bus.h
@@ -1,22 +1,22 @@
// license:BSD-3-Clause
// copyright-holders:David Haywood
-#include "cpu/m68000/m68000.h"
+#ifndef MAME_MACHINE_68307_BUS_H
+#define MAME_MACHINE_68307_BUS_H
-#define m68307BUS_MADR (0x01)
-#define m68307BUS_MFDR (0x03)
-#define m68307BUS_MBCR (0x05)
-#define m68307BUS_MBSR (0x07)
-#define m68307BUS_MBDR (0x09)
+#pragma once
+#include "68307.h"
-class m68307_mbus
-{
- public:
+class m68307_cpu_device::m68307_mbus
+{
+public:
uint16_t m_MFCR;
bool m_busy;
bool m_intpend;
- void reset(void);
+ void reset();
};
+
+#endif // MAME_MACHINE_68307_BUS_H
diff --git a/src/devices/machine/68307sim.cpp b/src/devices/machine/68307sim.cpp
index 47479cae1da..2913d64e0a5 100644
--- a/src/devices/machine/68307sim.cpp
+++ b/src/devices/machine/68307sim.cpp
@@ -3,167 +3,181 @@
/* 68307 SIM module */
#include "emu.h"
-#include "68307.h"
-
-
-READ16_MEMBER( m68307cpu_device::m68307_internal_sim_r )
+#include "68307sim.h"
+
+/* ports */
+#define m68307SIM_PACNT (0x10)
+#define m68307SIM_PADDR (0x12)
+#define m68307SIM_PADAT (0x14)
+#define m68307SIM_PBCNT (0x16)
+#define m68307SIM_PBDDR (0x18)
+#define m68307SIM_PBDAT (0x1a)
+
+
+/* interrupt logic */
+#define m68307SIM_LICR1 (0x20)
+#define m68307SIM_LICR2 (0x22)
+#define m68307SIM_PICR (0x24)
+#define m68307SIM_PIVR (0x26)
+
+/* used for the CS logic */
+#define m68307SIM_BR0 (0x40)
+#define m68307SIM_OR0 (0x42)
+#define m68307SIM_BR1 (0x44)
+#define m68307SIM_OR1 (0x46)
+#define m68307SIM_BR2 (0x48)
+#define m68307SIM_OR2 (0x4a)
+#define m68307SIM_BR3 (0x4c)
+#define m68307SIM_OR3 (0x4e)
+
+READ16_MEMBER( m68307_cpu_device::m68307_internal_sim_r )
{
- m68307cpu_device *m68k = this;
- m68307_sim* sim = m68k->m68307SIM;
- assert(sim != nullptr);
+ assert(m68307SIM);
+ m68307_sim &sim = *m68307SIM;
int pc = space.device().safe_pc();
- if (sim)
+ switch (offset<<1)
{
- switch (offset<<1)
- {
- case m68307SIM_PADAT: return sim->read_padat(this, space, mem_mask);
- case m68307SIM_PBDAT: return sim->read_pbdat(this, space, mem_mask);
-
- case m68307SIM_LICR2: return (sim->m_licr2);
-
- case m68307SIM_BR0: return (sim->m_br[0]);
- case m68307SIM_OR0: return (sim->m_or[0]);
- case m68307SIM_BR1: return (sim->m_br[1]);
- case m68307SIM_OR1: return (sim->m_or[1]);
- case m68307SIM_BR2: return (sim->m_br[2]);
- case m68307SIM_OR2: return (sim->m_or[2]);
- case m68307SIM_BR3: return (sim->m_br[3]);
- case m68307SIM_OR3: return (sim->m_or[3]);
-
- default:
- logerror("%08x m68307_internal_sim_r %08x, (%04x)\n", pc, offset*2,mem_mask);
- return 0xff;
-
- }
+ case m68307SIM_PADAT: return sim.read_padat(this, space, mem_mask);
+ case m68307SIM_PBDAT: return sim.read_pbdat(this, space, mem_mask);
+
+ case m68307SIM_LICR2: return sim.m_licr2;
+
+ case m68307SIM_BR0: return sim.m_br[0];
+ case m68307SIM_OR0: return sim.m_or[0];
+ case m68307SIM_BR1: return sim.m_br[1];
+ case m68307SIM_OR1: return sim.m_or[1];
+ case m68307SIM_BR2: return sim.m_br[2];
+ case m68307SIM_OR2: return sim.m_or[2];
+ case m68307SIM_BR3: return sim.m_br[3];
+ case m68307SIM_OR3: return sim.m_or[3];
+
+ default:
+ logerror("%08x m68307_internal_sim_r %08x, (%04x)\n", pc, offset*2, mem_mask);
+ return 0xff;
}
return 0x0000;
}
-WRITE16_MEMBER( m68307cpu_device::m68307_internal_sim_w )
+WRITE16_MEMBER( m68307_cpu_device::m68307_internal_sim_w )
{
- m68307cpu_device *m68k = this;
- m68307_sim* sim = m68k->m68307SIM;
- assert(sim != nullptr);
+ assert(m68307SIM);
+ m68307_sim &sim = *m68307SIM;
int pc = space.device().safe_pc();
- if (sim)
+ switch (offset<<1)
{
- switch (offset<<1)
- {
- case m68307SIM_PACNT:
- logerror("%08x m68307_internal_sim_w %08x, %04x (%04x) (Port A (8-bit) Control Register - PACNT)\n", pc, offset*2,data,mem_mask);
- sim->write_pacnt(data,mem_mask);
- break;
-
- case m68307SIM_PADDR:
- logerror("%08x m68307_internal_sim_w %08x, %04x (%04x) (Port A (8-bit) Direction Register - PADDR)\n", pc, offset*2,data,mem_mask);
- sim->write_paddr(data,mem_mask);
- break;
-
- case m68307SIM_PADAT:
- sim->write_padat(this, space, data,mem_mask);
- break;
-
- case m68307SIM_PBCNT:
- logerror("%08x m68307_internal_sim_w %08x, %04x (%04x) (Port B (16-bit) Control Register - PBCNT)\n", pc, offset*2,data,mem_mask);
- sim->write_pbcnt(data,mem_mask);
- break;
-
- case m68307SIM_PBDDR:
- logerror("%08x m68307_internal_sim_w %08x, %04x (%04x) (Port B (16-bit) Direction Register - PBDDR)\n", pc, offset*2,data,mem_mask);
- sim->write_pbddr(data,mem_mask);
- break;
-
- case m68307SIM_PBDAT:
- sim->write_pbdat(this, space, data, mem_mask);
- break;
-
-
- case m68307SIM_LICR1:
- logerror("%08x m68307_internal_sim_w %08x, %04x (%04x) (Latched Interrupt Control Register 1 - LICR1)\n", pc, offset*2,data,mem_mask);
- sim->write_licr1(this,data,mem_mask);
- break;
-
- case m68307SIM_LICR2:
- logerror("%08x m68307_internal_sim_w %08x, %04x (%04x) (Latched Interrupt Control Register 2 - LICR2)\n", pc, offset*2,data,mem_mask);
- sim->write_licr2(this,data,mem_mask);
- break;
-
- case m68307SIM_PICR:
- logerror("%08x m68307_internal_sim_w %08x, %04x (%04x) (Peripheral Interrupt Control Register - PICR)\n", pc, offset*2,data,mem_mask);
- sim->write_picr(this,data,mem_mask);
- break;
-
- case m68307SIM_PIVR:
- logerror("%08x m68307_internal_sim_w %08x, %04x (%04x) (Peripheral Interrupt Vector Register - PIVR)\n", pc, offset*2,data,mem_mask);
- sim->write_pivr(this,data,mem_mask);
- break;
-
- case m68307SIM_BR0:
- COMBINE_DATA(&sim->m_br[0]);
- break;
- case m68307SIM_OR0:
- COMBINE_DATA(&sim->m_or[0]);
- break;
- case m68307SIM_BR1:
- COMBINE_DATA(&sim->m_br[1]);
- break;
- case m68307SIM_OR1:
- COMBINE_DATA(&sim->m_or[1]);
- break;
- case m68307SIM_BR2:
- COMBINE_DATA(&sim->m_br[2]);
- break;
- case m68307SIM_OR2:
- COMBINE_DATA(&sim->m_or[2]);
- break;
- case m68307SIM_BR3:
- COMBINE_DATA(&sim->m_br[3]);
- break;
- case m68307SIM_OR3:
- COMBINE_DATA(&sim->m_or[3]);
- break;
-
-
-
- default :
- logerror("%08x m68307_internal_sim_w %08x, %04x (%04x)\n", pc, offset*2,data,mem_mask);
- break;
-
- }
+ case m68307SIM_PACNT:
+ logerror("%08x m68307_internal_sim_w %08x, %04x (%04x) (Port A (8-bit) Control Register - PACNT)\n", pc, offset*2,data,mem_mask);
+ sim.write_pacnt(data,mem_mask);
+ break;
+
+ case m68307SIM_PADDR:
+ logerror("%08x m68307_internal_sim_w %08x, %04x (%04x) (Port A (8-bit) Direction Register - PADDR)\n", pc, offset*2,data,mem_mask);
+ sim.write_paddr(data,mem_mask);
+ break;
+
+ case m68307SIM_PADAT:
+ sim.write_padat(this, space, data,mem_mask);
+ break;
+
+ case m68307SIM_PBCNT:
+ logerror("%08x m68307_internal_sim_w %08x, %04x (%04x) (Port B (16-bit) Control Register - PBCNT)\n", pc, offset*2,data,mem_mask);
+ sim.write_pbcnt(data,mem_mask);
+ break;
+
+ case m68307SIM_PBDDR:
+ logerror("%08x m68307_internal_sim_w %08x, %04x (%04x) (Port B (16-bit) Direction Register - PBDDR)\n", pc, offset*2,data,mem_mask);
+ sim.write_pbddr(data,mem_mask);
+ break;
+
+ case m68307SIM_PBDAT:
+ sim.write_pbdat(this, space, data, mem_mask);
+ break;
+
+
+ case m68307SIM_LICR1:
+ logerror("%08x m68307_internal_sim_w %08x, %04x (%04x) (Latched Interrupt Control Register 1 - LICR1)\n", pc, offset*2,data,mem_mask);
+ sim.write_licr1(this,data,mem_mask);
+ break;
+
+ case m68307SIM_LICR2:
+ logerror("%08x m68307_internal_sim_w %08x, %04x (%04x) (Latched Interrupt Control Register 2 - LICR2)\n", pc, offset*2,data,mem_mask);
+ sim.write_licr2(this,data,mem_mask);
+ break;
+
+ case m68307SIM_PICR:
+ logerror("%08x m68307_internal_sim_w %08x, %04x (%04x) (Peripheral Interrupt Control Register - PICR)\n", pc, offset*2,data,mem_mask);
+ sim.write_picr(this,data,mem_mask);
+ break;
+
+ case m68307SIM_PIVR:
+ logerror("%08x m68307_internal_sim_w %08x, %04x (%04x) (Peripheral Interrupt Vector Register - PIVR)\n", pc, offset*2,data,mem_mask);
+ sim.write_pivr(this,data,mem_mask);
+ break;
+
+ case m68307SIM_BR0:
+ COMBINE_DATA(&sim.m_br[0]);
+ break;
+ case m68307SIM_OR0:
+ COMBINE_DATA(&sim.m_or[0]);
+ break;
+ case m68307SIM_BR1:
+ COMBINE_DATA(&sim.m_br[1]);
+ break;
+ case m68307SIM_OR1:
+ COMBINE_DATA(&sim.m_or[1]);
+ break;
+ case m68307SIM_BR2:
+ COMBINE_DATA(&sim.m_br[2]);
+ break;
+ case m68307SIM_OR2:
+ COMBINE_DATA(&sim.m_or[2]);
+ break;
+ case m68307SIM_BR3:
+ COMBINE_DATA(&sim.m_br[3]);
+ break;
+ case m68307SIM_OR3:
+ COMBINE_DATA(&sim.m_or[3]);
+ break;
+
+
+
+ default :
+ logerror("%08x m68307_internal_sim_w %08x, %04x (%04x)\n", pc, offset*2,data,mem_mask);
+ break;
}
}
-void m68307_sim::write_pacnt(uint16_t data, uint16_t mem_mask)
+void m68307_cpu_device::m68307_sim::write_pacnt(uint16_t data, uint16_t mem_mask)
{
COMBINE_DATA(&m_pacnt);
}
-void m68307_sim::write_paddr(uint16_t data, uint16_t mem_mask)
+void m68307_cpu_device::m68307_sim::write_paddr(uint16_t data, uint16_t mem_mask)
{
COMBINE_DATA(&m_paddr);
}
-uint16_t m68307_sim::read_padat(m68307cpu_device* m68k, address_space &space, uint16_t mem_mask)
+uint16_t m68307_cpu_device::m68307_sim::read_padat(m68307_cpu_device* m68k, address_space &space, uint16_t mem_mask)
{
int pc = space.device().safe_pc();
- if (!m68k->m_m68307_porta_r.isnull())
+ if (!m68k->m_porta_r.isnull())
{
// for general purpose bits, if configured as 'output' then anything output gets latched
// and anything configured as input is read from the port
uint8_t outputbits = m_paddr;
uint8_t inputbits = ~m_paddr;
uint8_t general_purpose_bits = ~m_pacnt;
- uint8_t indat = m68k->m_m68307_porta_r(space, false, (inputbits & general_purpose_bits)&mem_mask) & ((inputbits & general_purpose_bits) & mem_mask); // read general purpose input lines
- indat |= m68k->m_m68307_porta_r(space, true, (inputbits & ~general_purpose_bits)&mem_mask) & ((inputbits & ~general_purpose_bits)& mem_mask); // read dedicated input lines
+ uint8_t indat = m68k->m_porta_r(space, false, (inputbits & general_purpose_bits)&mem_mask) & ((inputbits & general_purpose_bits) & mem_mask); // read general purpose input lines
+ indat |= m68k->m_porta_r(space, true, (inputbits & ~general_purpose_bits)&mem_mask) & ((inputbits & ~general_purpose_bits)& mem_mask); // read dedicated input lines
uint8_t outdat = (m_padat & outputbits) & general_purpose_bits; // read general purpose output lines (reads latched data)
return (indat | outdat);
@@ -177,14 +191,14 @@ uint16_t m68307_sim::read_padat(m68307cpu_device* m68k, address_space &space, ui
}
-void m68307_sim::write_padat(m68307cpu_device* m68k, address_space &space, uint16_t data, uint16_t mem_mask)
+void m68307_cpu_device::m68307_sim::write_padat(m68307_cpu_device* m68k, address_space &space, uint16_t data, uint16_t mem_mask)
{
int pc = space.device().safe_pc();
COMBINE_DATA(&m_padat);
- if (!m68k->m_m68307_porta_w.isnull())
+ if (!m68k->m_porta_w.isnull())
{
- m68k->m_m68307_porta_w(space, false, data, 0xff);
+ m68k->m_porta_w(space, false, data, 0xff);
}
else
{
@@ -192,21 +206,21 @@ void m68307_sim::write_padat(m68307cpu_device* m68k, address_space &space, uint1
}
}
-void m68307_sim::write_pbcnt(uint16_t data, uint16_t mem_mask)
+void m68307_cpu_device::m68307_sim::write_pbcnt(uint16_t data, uint16_t mem_mask)
{
COMBINE_DATA(&m_pbcnt);
}
-void m68307_sim::write_pbddr(uint16_t data, uint16_t mem_mask)
+void m68307_cpu_device::m68307_sim::write_pbddr(uint16_t data, uint16_t mem_mask)
{
COMBINE_DATA(&m_pbddr);
}
-uint16_t m68307_sim::read_pbdat(m68307cpu_device* m68k, address_space &space, uint16_t mem_mask)
+uint16_t m68307_cpu_device::m68307_sim::read_pbdat(m68307_cpu_device* m68k, address_space &space, uint16_t mem_mask)
{
int pc = space.device().safe_pc();
- if (!m68k->m_m68307_portb_r.isnull())
+ if (!m68k->m_portb_r.isnull())
{
// for general purpose bits, if configured as 'output' then anything output gets latched
// and anything configured as input is read from the port
@@ -214,8 +228,8 @@ uint16_t m68307_sim::read_pbdat(m68307cpu_device* m68k, address_space &space, ui
uint16_t inputbits = ~m_pbddr;
uint16_t general_purpose_bits = ~m_pbcnt;
- uint16_t indat = m68k->m_m68307_portb_r(space, false, (inputbits & general_purpose_bits)&mem_mask) & ((inputbits & general_purpose_bits) & mem_mask); // read general purpose input lines
- indat |= m68k->m_m68307_portb_r(space, true, (inputbits & ~general_purpose_bits)&mem_mask) & ((inputbits & ~general_purpose_bits)& mem_mask); // read dedicated input lines
+ uint16_t indat = m68k->m_portb_r(space, false, (inputbits & general_purpose_bits)&mem_mask) & ((inputbits & general_purpose_bits) & mem_mask); // read general purpose input lines
+ indat |= m68k->m_portb_r(space, true, (inputbits & ~general_purpose_bits)&mem_mask) & ((inputbits & ~general_purpose_bits)& mem_mask); // read dedicated input lines
uint16_t outdat = (m_pbdat & outputbits) & general_purpose_bits; // read general purpose output lines (reads latched data)
return (indat | outdat);
@@ -228,14 +242,14 @@ uint16_t m68307_sim::read_pbdat(m68307cpu_device* m68k, address_space &space, ui
}
-void m68307_sim::write_pbdat(m68307cpu_device* m68k, address_space &space, uint16_t data, uint16_t mem_mask)
+void m68307_cpu_device::m68307_sim::write_pbdat(m68307_cpu_device* m68k, address_space &space, uint16_t data, uint16_t mem_mask)
{
int pc = space.device().safe_pc();
COMBINE_DATA(&m_pbdat);
- if (!m68k->m_m68307_portb_w.isnull())
+ if (!m68k->m_portb_w.isnull())
{
- m68k->m_m68307_portb_w(space, false, data, mem_mask);
+ m68k->m_portb_w(space, false, data, mem_mask);
}
else
{
@@ -243,7 +257,7 @@ void m68307_sim::write_pbdat(m68307cpu_device* m68k, address_space &space, uint1
}
}
-void m68307_sim::write_licr1(m68307cpu_device* m68k, uint16_t data, uint16_t mem_mask)
+void m68307_cpu_device::m68307_sim::write_licr1(m68307_cpu_device* m68k, uint16_t data, uint16_t mem_mask)
{
COMBINE_DATA(&m_licr1);
data = m_licr1;
@@ -259,7 +273,7 @@ void m68307_sim::write_licr1(m68307cpu_device* m68k, uint16_t data, uint16_t mem
m68k->logerror("\n");
}
-void m68307_sim::write_licr2(m68307cpu_device* m68k, uint16_t data, uint16_t mem_mask)
+void m68307_cpu_device::m68307_sim::write_licr2(m68307_cpu_device* m68k, uint16_t data, uint16_t mem_mask)
{
COMBINE_DATA(&m_licr2);
uint16_t newdata = m_licr2;
@@ -283,7 +297,7 @@ void m68307_sim::write_licr2(m68307cpu_device* m68k, uint16_t data, uint16_t mem
}
-void m68307_sim::write_picr(m68307cpu_device* m68k, uint16_t data, uint16_t mem_mask)
+void m68307_cpu_device::m68307_sim::write_picr(m68307_cpu_device* m68k, uint16_t data, uint16_t mem_mask)
{
COMBINE_DATA(&m_picr);
data = m_picr;
@@ -295,7 +309,7 @@ void m68307_sim::write_picr(m68307cpu_device* m68k, uint16_t data, uint16_t mem_
m68k->logerror("\n");
}
-void m68307_sim::write_pivr(m68307cpu_device* m68k, uint16_t data, uint16_t mem_mask)
+void m68307_cpu_device::m68307_sim::write_pivr(m68307_cpu_device* m68k, uint16_t data, uint16_t mem_mask)
{
COMBINE_DATA(&m_pivr);
data = m_pivr;
@@ -304,7 +318,7 @@ void m68307_sim::write_pivr(m68307cpu_device* m68k, uint16_t data, uint16_t mem_
m68k->logerror("high vector %01x\n", (data>>4)&0xf);
}
-void m68307_sim::reset(void)
+void m68307_cpu_device::m68307_sim::reset()
{
for (int i=0;i<4;i++)
{
diff --git a/src/devices/machine/68307sim.h b/src/devices/machine/68307sim.h
index 0d7c5ceea1a..e709f11a96f 100644
--- a/src/devices/machine/68307sim.h
+++ b/src/devices/machine/68307sim.h
@@ -1,41 +1,17 @@
// license:BSD-3-Clause
// copyright-holders:David Haywood
/* 68307 SIM module */
+#ifndef MAME_MACHINE_68307SIM_H
+#define MAME_MACHINE_68307SIM_H
-#include "cpu/m68000/m68000.h"
+#pragma once
-class m68307cpu_device;
+#include "68307.h"
-/* ports */
-#define m68307SIM_PACNT (0x10)
-#define m68307SIM_PADDR (0x12)
-#define m68307SIM_PADAT (0x14)
-#define m68307SIM_PBCNT (0x16)
-#define m68307SIM_PBDDR (0x18)
-#define m68307SIM_PBDAT (0x1a)
-
-
-/* interrupt logic */
-#define m68307SIM_LICR1 (0x20)
-#define m68307SIM_LICR2 (0x22)
-#define m68307SIM_PICR (0x24)
-#define m68307SIM_PIVR (0x26)
-
-/* used for the CS logic */
-#define m68307SIM_BR0 (0x40)
-#define m68307SIM_OR0 (0x42)
-#define m68307SIM_BR1 (0x44)
-#define m68307SIM_OR1 (0x46)
-#define m68307SIM_BR2 (0x48)
-#define m68307SIM_OR2 (0x4a)
-#define m68307SIM_BR3 (0x4c)
-#define m68307SIM_OR3 (0x4e)
-
-class m68307_sim
+class m68307_cpu_device::m68307_sim
{
- public:
-
+public:
uint16_t m_pacnt; // 8-bit
uint16_t m_paddr; // 8-bit
uint16_t m_padat; // 8-bit
@@ -52,23 +28,22 @@ class m68307_sim
uint16_t m_licr1;
uint16_t m_licr2;
-
void write_pacnt(uint16_t data, uint16_t mem_mask);
void write_paddr(uint16_t data, uint16_t mem_mask);
- uint16_t read_padat(m68307cpu_device* m68k, address_space &space, uint16_t mem_mask);
- void write_padat(m68307cpu_device* m68k, address_space &space, uint16_t data, uint16_t mem_mask);
+ uint16_t read_padat(m68307_cpu_device* m68k, address_space &space, uint16_t mem_mask);
+ void write_padat(m68307_cpu_device* m68k, address_space &space, uint16_t data, uint16_t mem_mask);
void write_pbcnt(uint16_t data, uint16_t mem_mask);
void write_pbddr(uint16_t data, uint16_t mem_mask);
- uint16_t read_pbdat(m68307cpu_device* m68k, address_space &space, uint16_t mem_mask);
- void write_pbdat(m68307cpu_device* m68k, address_space &space, uint16_t data, uint16_t mem_mask);
-
+ uint16_t read_pbdat(m68307_cpu_device* m68k, address_space &space, uint16_t mem_mask);
+ void write_pbdat(m68307_cpu_device* m68k, address_space &space, uint16_t data, uint16_t mem_mask);
+ void write_licr1(m68307_cpu_device* m68k, uint16_t data, uint16_t mem_mask);
+ void write_licr2(m68307_cpu_device* m68k, uint16_t data, uint16_t mem_mask);
+ void write_picr(m68307_cpu_device* m68k, uint16_t data, uint16_t mem_mask);
+ void write_pivr(m68307_cpu_device* m68k, uint16_t data, uint16_t mem_mask);
- void write_licr1(m68307cpu_device* m68k, uint16_t data, uint16_t mem_mask);
- void write_licr2(m68307cpu_device* m68k, uint16_t data, uint16_t mem_mask);
- void write_picr(m68307cpu_device* m68k, uint16_t data, uint16_t mem_mask);
- void write_pivr(m68307cpu_device* m68k, uint16_t data, uint16_t mem_mask);
-
- void reset(void);
+ void reset();
};
+
+#endif // MAME_MACHINE_68307SIM_H
diff --git a/src/devices/machine/68307tmu.cpp b/src/devices/machine/68307tmu.cpp
index 5deb48a9f85..c83a0855f29 100644
--- a/src/devices/machine/68307tmu.cpp
+++ b/src/devices/machine/68307tmu.cpp
@@ -4,105 +4,105 @@
// 2x timers
#include "emu.h"
-#include "68307.h"
-
-READ16_MEMBER( m68307cpu_device::m68307_internal_timer_r )
+#include "68307tmu.h"
+
+#define m68307TIMER_TMR (0x0)
+#define m68307TIMER_TRR (0x1)
+#define m68307TIMER_TCR (0x2)
+#define m68307TIMER_TCN (0x3)
+#define m68307TIMER_TER (0x4)
+#define m68307TIMER_WRR (0x5)
+#define m68307TIMER_WCR (0x6)
+#define m68307TIMER_XXX (0x7)
+
+READ16_MEMBER( m68307_cpu_device::m68307_internal_timer_r )
{
- m68307cpu_device *m68k = this;
- m68307_timer* timer = m68k->m68307TIMER;
- assert(timer != nullptr);
+ assert(m68307TIMER);
+ m68307_timer &timer = *m68307TIMER;
+
+ int pc = space.device().safe_pc();
+ int which = offset & 0x8;
- if (timer)
+ switch (offset&0x7)
{
- int pc = space.device().safe_pc();
- int which = offset & 0x8;
-
- switch (offset&0x7)
- {
- case m68307TIMER_TCN: /* 0x3 (0x126 / 0x136) */
- //if (pc!=0x2182e) logerror("%08x m68307_internal_timer_r %08x (%04x) (TCN - Timer Counter for timer %d)\n", pc, offset*2,mem_mask, which);
- return timer->read_tcn(mem_mask, which);
-
- default:
- logerror("%08x m68307_internal_timer_r %08x, (%04x)\n", pc, offset*2,mem_mask);
- break;
- }
+ case m68307TIMER_TCN: /* 0x3 (0x126 / 0x136) */
+ //if (pc!=0x2182e) logerror("%08x m68307_internal_timer_r %08x (%04x) (TCN - Timer Counter for timer %d)\n", pc, offset*2,mem_mask, which);
+ return timer.read_tcn(mem_mask, which);
+
+ default:
+ logerror("%08x m68307_internal_timer_r %08x, (%04x)\n", pc, offset*2,mem_mask);
+ break;
}
return 0x0000;
}
-WRITE16_MEMBER( m68307cpu_device::m68307_internal_timer_w )
+WRITE16_MEMBER( m68307_cpu_device::m68307_internal_timer_w )
{
- m68307cpu_device *m68k = this;
- m68307_timer* timer = m68k->m68307TIMER;
- assert(timer != nullptr);
+ assert(m68307TIMER);
+ m68307_timer &timer = *m68307TIMER;
+
+ int pc = space.device().safe_pc();
+ int which = offset & 0x8;
- if (timer)
+ switch (offset&0x7)
{
- int pc = space.device().safe_pc();
- int which = offset & 0x8;
-
- switch (offset&0x7)
- {
- case m68307TIMER_TMR: /* 0x0 (0x120 / 0x130) */
- logerror("%08x m68307_internal_timer_w %08x, %04x (%04x) (TMR - Timer Mode Register for timer %d)\n", pc, offset*2,data,mem_mask, which);
- timer->write_tmr(data, mem_mask, which);
- break;
-
- case m68307TIMER_TRR: /* 0x1 (0x122 / 0x132) */
- logerror("%08x m68307_internal_timer_w %08x, %04x (%04x) (TRR - Timer Reference Register for timer %d)\n", pc, offset*2,data,mem_mask, which);
- timer->write_trr(data, mem_mask, which);
- break;
-
- case m68307TIMER_TCR: /* 0x2 (0x124 / 0x134) */
- logerror("%08x m68307_internal_timer_w %08x, %04x (%04x) (TCR - Timer Capture Register for timer %d) (illegal, read-only)\n", pc, offset*2,data,mem_mask, which);
- break;
-
- case m68307TIMER_TCN: /* 0x3 (0x126 / 0x136) */
- logerror("%08x m68307_internal_timer_w %08x, %04x (%04x) (TCN - Timer Counter for timer %d)\n", pc, offset*2,data,mem_mask, which);
- break;
-
- case m68307TIMER_TER: /* 0x4 (0x128 / 0x138) */
- /* 8-bit only!! */
- //logerror("%08x m68307_internal_timer_w %08x, %04x (%04x) (TER - Timer Event Register for timer %d)\n", pc, offset*2,data,mem_mask, which);
- timer->write_ter(data, mem_mask, which);
- break;
-
- case m68307TIMER_WRR: /* 0x5 (0x12a / 0x13a) */
- if (which==0)
- {
- logerror("%08x m68307_internal_timer_w %08x, %04x (%04x) (WRR - Watchdog Reference Register)\n", pc, offset*2,data,mem_mask);
- }
- else
- {
- logerror("%08x m68307_internal_timer_w %08x, %04x (%04x) (illegal)\n", pc, offset*2,data,mem_mask);
- }
- break;
-
- case m68307TIMER_WCR: /* 0x6 (0x12c / 0x13c) */
- if (which==0)
- {
- logerror("%08x m68307_internal_timer_w %08x, %04x (%04x) (WRR - Watchdog Counter Register)\n", pc, offset*2,data,mem_mask);
- }
- else
- {
- logerror("%08x m68307_internal_timer_w %08x, %04x (%04x) (illegal)\n", pc, offset*2,data,mem_mask);
- }
- break;
-
- case m68307TIMER_XXX: /* 0x7 (0x12e / 0x13e) */
+ case m68307TIMER_TMR: /* 0x0 (0x120 / 0x130) */
+ logerror("%08x m68307_internal_timer_w %08x, %04x (%04x) (TMR - Timer Mode Register for timer %d)\n", pc, offset*2,data,mem_mask, which);
+ timer.write_tmr(data, mem_mask, which);
+ break;
+
+ case m68307TIMER_TRR: /* 0x1 (0x122 / 0x132) */
+ logerror("%08x m68307_internal_timer_w %08x, %04x (%04x) (TRR - Timer Reference Register for timer %d)\n", pc, offset*2,data,mem_mask, which);
+ timer.write_trr(data, mem_mask, which);
+ break;
+
+ case m68307TIMER_TCR: /* 0x2 (0x124 / 0x134) */
+ logerror("%08x m68307_internal_timer_w %08x, %04x (%04x) (TCR - Timer Capture Register for timer %d) (illegal, read-only)\n", pc, offset*2,data,mem_mask, which);
+ break;
+
+ case m68307TIMER_TCN: /* 0x3 (0x126 / 0x136) */
+ logerror("%08x m68307_internal_timer_w %08x, %04x (%04x) (TCN - Timer Counter for timer %d)\n", pc, offset*2,data,mem_mask, which);
+ break;
+
+ case m68307TIMER_TER: /* 0x4 (0x128 / 0x138) */
+ /* 8-bit only!! */
+ //logerror("%08x m68307_internal_timer_w %08x, %04x (%04x) (TER - Timer Event Register for timer %d)\n", pc, offset*2,data,mem_mask, which);
+ timer.write_ter(data, mem_mask, which);
+ break;
+
+ case m68307TIMER_WRR: /* 0x5 (0x12a / 0x13a) */
+ if (which==0)
+ {
+ logerror("%08x m68307_internal_timer_w %08x, %04x (%04x) (WRR - Watchdog Reference Register)\n", pc, offset*2,data,mem_mask);
+ }
+ else
+ {
logerror("%08x m68307_internal_timer_w %08x, %04x (%04x) (illegal)\n", pc, offset*2,data,mem_mask);
- break;
+ }
+ break;
+
+ case m68307TIMER_WCR: /* 0x6 (0x12c / 0x13c) */
+ if (which==0)
+ {
+ logerror("%08x m68307_internal_timer_w %08x, %04x (%04x) (WRR - Watchdog Counter Register)\n", pc, offset*2,data,mem_mask);
+ }
+ else
+ {
+ logerror("%08x m68307_internal_timer_w %08x, %04x (%04x) (illegal)\n", pc, offset*2,data,mem_mask);
+ }
+ break;
- }
+ case m68307TIMER_XXX: /* 0x7 (0x12e / 0x13e) */
+ logerror("%08x m68307_internal_timer_w %08x, %04x (%04x) (illegal)\n", pc, offset*2,data,mem_mask);
+ break;
}
}
-TIMER_CALLBACK_MEMBER(m68307_timer::timer0_callback )
+TIMER_CALLBACK_MEMBER(m68307_cpu_device::m68307_timer::timer0_callback )
{
- m68307cpu_device* m68k = (m68307cpu_device *)ptr;
- m68307_single_timer* tptr = &m68k->m68307TIMER->singletimer[0];
+ m68307_cpu_device* m68k = (m68307_cpu_device *)ptr;
+ single_timer* tptr = &m68k->m68307TIMER->singletimer[0];
tptr->regs[m68307TIMER_TMR] |= 0x2;
m68k->timer0_interrupt();
@@ -110,10 +110,10 @@ TIMER_CALLBACK_MEMBER(m68307_timer::timer0_callback )
tptr->mametimer->adjust(m68k->cycles_to_attotime(20000));
}
-TIMER_CALLBACK_MEMBER(m68307_timer::timer1_callback )
+TIMER_CALLBACK_MEMBER(m68307_cpu_device::m68307_timer::timer1_callback )
{
- m68307cpu_device* m68k = (m68307cpu_device *)ptr;
- m68307_single_timer* tptr = &m68k->m68307TIMER->singletimer[1];
+ m68307_cpu_device* m68k = (m68307_cpu_device *)ptr;
+ single_timer* tptr = &m68k->m68307TIMER->singletimer[1];
tptr->regs[m68307TIMER_TMR] |= 0x2;
m68k->timer1_interrupt();
@@ -122,16 +122,16 @@ TIMER_CALLBACK_MEMBER(m68307_timer::timer1_callback )
}
-TIMER_CALLBACK_MEMBER(m68307_timer::wd_timer_callback )
+TIMER_CALLBACK_MEMBER(m68307_cpu_device::m68307_timer::wd_timer_callback )
{
printf("wd timer\n");
}
-void m68307_timer::init(m68307cpu_device *device)
+void m68307_cpu_device::m68307_timer::init(m68307_cpu_device *device)
{
parent = device;
- m68307_single_timer* tptr;
+ single_timer* tptr;
tptr = &singletimer[0];
tptr->mametimer = device->machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(m68307_timer::timer0_callback),this), parent);
@@ -142,7 +142,7 @@ void m68307_timer::init(m68307cpu_device *device)
wd_mametimer = device->machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(m68307_timer::wd_timer_callback),this), parent);
}
-uint16_t m68307_timer::read_tcn(uint16_t mem_mask, int which)
+uint16_t m68307_cpu_device::m68307_timer::read_tcn(uint16_t mem_mask, int which)
{
// we should return the current timer value by
// calculating what it should be based on the time
@@ -150,18 +150,18 @@ uint16_t m68307_timer::read_tcn(uint16_t mem_mask, int which)
return 0x3a98;
}
-void m68307_timer::write_ter(uint16_t data, uint16_t mem_mask, int which)
+void m68307_cpu_device::m68307_timer::write_ter(uint16_t data, uint16_t mem_mask, int which)
{
assert(which >= 0 && which < ARRAY_LENGTH(singletimer));
- m68307_single_timer* tptr = &singletimer[which];
+ single_timer* tptr = &singletimer[which];
if (data & 0x2) tptr->regs[m68307TIMER_TMR] &= ~0x2;
}
-void m68307_timer::write_tmr(uint16_t data, uint16_t mem_mask, int which)
+void m68307_cpu_device::m68307_timer::write_tmr(uint16_t data, uint16_t mem_mask, int which)
{
- m68307cpu_device* m68k = parent;
+ m68307_cpu_device* m68k = parent;
assert(which >= 0 && which < ARRAY_LENGTH(singletimer));
- m68307_single_timer* tptr = &singletimer[which];
+ single_timer* tptr = &singletimer[which];
COMBINE_DATA(&tptr->regs[m68307TIMER_TMR]);
@@ -208,21 +208,21 @@ void m68307_timer::write_tmr(uint16_t data, uint16_t mem_mask, int which)
}
-void m68307_timer::write_trr(uint16_t data, uint16_t mem_mask, int which)
+void m68307_cpu_device::m68307_timer::write_trr(uint16_t data, uint16_t mem_mask, int which)
{
assert(which >= 0 && which < ARRAY_LENGTH(singletimer));
- m68307_single_timer* tptr = &singletimer[which];
+ single_timer* tptr = &singletimer[which];
COMBINE_DATA(&tptr->regs[m68307TIMER_TRR]);
}
-void m68307_timer::reset(void)
+void m68307_cpu_device::m68307_timer::reset()
{
for (auto & elem : singletimer)
{
- m68307_single_timer* tptr = &elem;
+ single_timer* tptr = &elem;
tptr->regs[m68307TIMER_TMR] = 0x0000;
tptr->regs[m68307TIMER_TRR] = 0xffff;
@@ -237,6 +237,4 @@ void m68307_timer::reset(void)
}
wd_mametimer->adjust(attotime::never);
-
-
}
diff --git a/src/devices/machine/68307tmu.h b/src/devices/machine/68307tmu.h
index 8ecdfa8a86f..25b782fcacb 100644
--- a/src/devices/machine/68307tmu.h
+++ b/src/devices/machine/68307tmu.h
@@ -1,45 +1,40 @@
// license:BSD-3-Clause
// copyright-holders:David Haywood
+#ifndef MAME_MACHINE_68307TMU_H
+#define MAME_MACHINE_68307TMU_H
-#include "cpu/m68000/m68000.h"
+#pragma once
-class m68307cpu_device;
+#include "68307.h"
-#define m68307TIMER_TMR (0x0)
-#define m68307TIMER_TRR (0x1)
-#define m68307TIMER_TCR (0x2)
-#define m68307TIMER_TCN (0x3)
-#define m68307TIMER_TER (0x4)
-#define m68307TIMER_WRR (0x5)
-#define m68307TIMER_WCR (0x6)
-#define m68307TIMER_XXX (0x7)
-
-struct m68307_single_timer
+class m68307_cpu_device::m68307_timer
{
- uint16_t regs[0x8];
- bool enabled;
- emu_timer *mametimer;
-};
+public:
+ struct single_timer
+ {
+ uint16_t regs[0x8];
+ bool enabled;
+ emu_timer *mametimer;
+ };
-class m68307_timer
-{
- public:
- m68307_single_timer singletimer[2];
+ single_timer singletimer[2];
emu_timer *wd_mametimer;
- m68307cpu_device *parent;
+ m68307_cpu_device *parent;
void write_tmr(uint16_t data, uint16_t mem_mask, int which);
void write_trr(uint16_t data, uint16_t mem_mask, int which);
void write_ter(uint16_t data, uint16_t mem_mask, int which);
uint16_t read_tcn(uint16_t mem_mask, int which);
- void init(m68307cpu_device *device);
- void reset(void);
+ void init(m68307_cpu_device *device);
+ void reset();
TIMER_CALLBACK_MEMBER(timer0_callback);
TIMER_CALLBACK_MEMBER(timer1_callback);
TIMER_CALLBACK_MEMBER(wd_timer_callback);
};
+
+#endif // MAME_MACHINE_68307TMU_H
diff --git a/src/devices/machine/68340.cpp b/src/devices/machine/68340.cpp
index 36d42b869fa..3dc8f2e5c83 100644
--- a/src/devices/machine/68340.cpp
+++ b/src/devices/machine/68340.cpp
@@ -5,24 +5,22 @@
#include "emu.h"
#include "68340.h"
-const device_type M68340 = device_creator<m68340cpu_device>;
+DEFINE_DEVICE_TYPE(M68340, m68340_cpu_device, "mc68340", "MC68340")
-int m68340_calc_cs(m68340cpu_device *m68k, offs_t address)
+int m68340_cpu_device::calc_cs(offs_t address) const
{
- m68340_sim* sim = m68k->m68340SIM;
-
- if ( !(sim->m_ba[0] & 1) ) return 1;
+ if ( !(m68340SIM->m_ba[0] & 1) ) return 1;
for (int i=0;i<4;i++)
{
- if (sim->m_ba[i] & 1)
+ if (m68340SIM->m_ba[i] & 1)
{
- int mask = ((sim->m_am[i]&0xffffff00) | 0xff);
- int base = sim->m_ba[i] & 0xffffff00;
- int fcmask = (sim->m_am[i] & 0xf0);
- int fcbase = (sim->m_ba[i] & 0xf0) & ~(sim->m_am[i] & 0xf0);
- int fc = m68k->mmu_tmp_fc;
+ int mask = ((m68340SIM->m_am[i]&0xffffff00) | 0xff);
+ int base = m68340SIM->m_ba[i] & 0xffffff00;
+ int fcmask = (m68340SIM->m_am[i] & 0xf0);
+ int fcbase = (m68340SIM->m_ba[i] & 0xf0) & ~(m68340SIM->m_am[i] & 0xf0);
+ int fc = mmu_tmp_fc;
if ((address & ~mask) == base && ((fc << 4) & ~fcmask ) == fcbase ) return i+1;
}
@@ -33,61 +31,58 @@ int m68340_calc_cs(m68340cpu_device *m68k, offs_t address)
-uint16_t m68340cpu_device::get_cs(offs_t address)
+uint16_t m68340_cpu_device::get_cs(offs_t address)
{
- m68340_currentcs = m68340_calc_cs(this, address);
+ m_currentcs = calc_cs(address);
- return m68340_currentcs;
+ return m_currentcs;
}
/* 68340 specifics - MOVE */
-READ32_MEMBER( m68340cpu_device::m68340_internal_base_r )
+READ32_MEMBER( m68340_cpu_device::m68340_internal_base_r )
{
- m68340cpu_device *m68k = this;
int pc = space.device().safe_pc();
logerror("%08x m68340_internal_base_r %08x, (%08x)\n", pc, offset*4,mem_mask);
- return m68k->m68340_base;
+ return m68340_base;
}
-WRITE32_MEMBER( m68340cpu_device::m68340_internal_base_w )
+WRITE32_MEMBER( m68340_cpu_device::m68340_internal_base_w )
{
- m68340cpu_device *m68k = this;
-
int pc = space.device().safe_pc();
logerror("%08x m68340_internal_base_w %08x, %08x (%08x)\n", pc, offset*4,data,mem_mask);
// other conditions?
- if (m68k->dfc==0x7)
+ if (dfc==0x7)
{
// unmap old modules
- if (m68k->m68340_base&1)
+ if (m68340_base&1)
{
- int base = m68k->m68340_base & 0xfffff000;
+ int base = m68340_base & 0xfffff000;
- m68k->internal->unmap_readwrite(base + 0x000, base + 0x05f);
- m68k->internal->unmap_readwrite(base + 0x600, base + 0x67f);
- m68k->internal->unmap_readwrite(base + 0x700, base + 0x723);
- m68k->internal->unmap_readwrite(base + 0x780, base + 0x7bf);
+ internal->unmap_readwrite(base + 0x000, base + 0x05f);
+ internal->unmap_readwrite(base + 0x600, base + 0x67f);
+ internal->unmap_readwrite(base + 0x700, base + 0x723);
+ internal->unmap_readwrite(base + 0x780, base + 0x7bf);
}
- COMBINE_DATA(&m68k->m68340_base);
+ COMBINE_DATA(&m68340_base);
logerror("%08x m68340_internal_base_w %08x, %08x (%08x) (m68340_base write)\n", pc, offset*4,data,mem_mask);
// map new modules
- if (m68k->m68340_base&1)
+ if (m68340_base&1)
{
- int base = m68k->m68340_base & 0xfffff000;
+ int base = m68340_base & 0xfffff000;
- m68k->internal->install_readwrite_handler(base + 0x000, base + 0x03f, read16_delegate(FUNC(m68340cpu_device::m68340_internal_sim_r),this), write16_delegate(FUNC(m68340cpu_device::m68340_internal_sim_w),this),0xffffffff);
- m68k->internal->install_readwrite_handler(base + 0x010, base + 0x01f, read8_delegate(FUNC(m68340cpu_device::m68340_internal_sim_ports_r),this),write8_delegate(FUNC(m68340cpu_device::m68340_internal_sim_ports_w),this),0xffffffff);
- m68k->internal->install_readwrite_handler(base + 0x040, base + 0x05f, read32_delegate(FUNC(m68340cpu_device::m68340_internal_sim_cs_r),this), write32_delegate(FUNC(m68340cpu_device::m68340_internal_sim_cs_w),this));
- m68k->internal->install_readwrite_handler(base + 0x600, base + 0x67f, read32_delegate(FUNC(m68340cpu_device::m68340_internal_timer_r),this), write32_delegate(FUNC(m68340cpu_device::m68340_internal_timer_w),this));
- m68k->internal->install_readwrite_handler(base + 0x700, base + 0x723, read32_delegate(FUNC(m68340cpu_device::m68340_internal_serial_r),this), write32_delegate(FUNC(m68340cpu_device::m68340_internal_serial_w),this));
- m68k->internal->install_readwrite_handler(base + 0x780, base + 0x7bf, read32_delegate(FUNC(m68340cpu_device::m68340_internal_dma_r),this), write32_delegate(FUNC(m68340cpu_device::m68340_internal_dma_w),this));
+ internal->install_readwrite_handler(base + 0x000, base + 0x03f, read16_delegate(FUNC(m68340_cpu_device::m68340_internal_sim_r),this), write16_delegate(FUNC(m68340_cpu_device::m68340_internal_sim_w),this),0xffffffff);
+ internal->install_readwrite_handler(base + 0x010, base + 0x01f, read8_delegate(FUNC(m68340_cpu_device::m68340_internal_sim_ports_r),this),write8_delegate(FUNC(m68340_cpu_device::m68340_internal_sim_ports_w),this),0xffffffff);
+ internal->install_readwrite_handler(base + 0x040, base + 0x05f, read32_delegate(FUNC(m68340_cpu_device::m68340_internal_sim_cs_r),this), write32_delegate(FUNC(m68340_cpu_device::m68340_internal_sim_cs_w),this));
+ internal->install_readwrite_handler(base + 0x600, base + 0x67f, read32_delegate(FUNC(m68340_cpu_device::m68340_internal_timer_r),this), write32_delegate(FUNC(m68340_cpu_device::m68340_internal_timer_w),this));
+ internal->install_readwrite_handler(base + 0x700, base + 0x723, read32_delegate(FUNC(m68340_cpu_device::m68340_internal_serial_r),this), write32_delegate(FUNC(m68340_cpu_device::m68340_internal_serial_w),this));
+ internal->install_readwrite_handler(base + 0x780, base + 0x7bf, read32_delegate(FUNC(m68340_cpu_device::m68340_internal_dma_r),this), write32_delegate(FUNC(m68340_cpu_device::m68340_internal_dma_w),this));
}
@@ -102,7 +97,7 @@ WRITE32_MEMBER( m68340cpu_device::m68340_internal_base_w )
}
-static ADDRESS_MAP_START( m68340_internal_map, AS_PROGRAM, 32, m68340cpu_device )
+static ADDRESS_MAP_START( m68340_internal_map, AS_PROGRAM, 32, m68340_cpu_device )
AM_RANGE(0x0003ff00, 0x0003ff03) AM_READWRITE( m68340_internal_base_r, m68340_internal_base_w)
ADDRESS_MAP_END
@@ -110,8 +105,8 @@ ADDRESS_MAP_END
-m68340cpu_device::m68340cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : fscpu32_device(mconfig, "MC68340", tag, owner, clock, M68340, 32,32, ADDRESS_MAP_NAME(m68340_internal_map), "mc68340", __FILE__)
+m68340_cpu_device::m68340_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : fscpu32_device(mconfig, tag, owner, clock, M68340, 32,32, ADDRESS_MAP_NAME(m68340_internal_map))
{
m68340SIM = nullptr;
m68340DMA = nullptr;
@@ -125,13 +120,13 @@ m68340cpu_device::m68340cpu_device(const machine_config &mconfig, const char *ta
-void m68340cpu_device::device_reset()
+void m68340_cpu_device::device_reset()
{
fscpu32_device::device_reset();
}
-void m68340cpu_device::device_start()
+void m68340_cpu_device::device_start()
{
fscpu32_device::device_start();
diff --git a/src/devices/machine/68340.h b/src/devices/machine/68340.h
index 350021100a3..3c9b2ef96a4 100644
--- a/src/devices/machine/68340.h
+++ b/src/devices/machine/68340.h
@@ -1,11 +1,11 @@
// license:BSD-3-Clause
// copyright-holders:David Haywood
/* 68340 */
-
+#ifndef MAME_MACHINE_68340_H
+#define MAME_MACHINE_68340_H
#pragma once
-#ifndef __M68340_H__
-#define __M68340_H__
+
#include "cpu/m68000/m68000.h"
@@ -15,25 +15,10 @@
#include "68340tmu.h"
-class m68340cpu_device : public fscpu32_device
+class m68340_cpu_device : public fscpu32_device
{
public:
- m68340cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
-
- int m68340_currentcs;
-
- /* 68340 peripheral modules */
- m68340_sim* m68340SIM;
- m68340_dma* m68340DMA;
- m68340_serial* m68340SERIAL;
- m68340_timer* m68340TIMER;
-
- uint32_t m68340_base;
-
- uint16_t m_avr;
- uint16_t m_picr;
- uint16_t m_pitr;
+ m68340_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
uint16_t get_cs(offs_t address);
@@ -52,17 +37,33 @@ public:
READ32_MEMBER( m68340_internal_timer_r );
WRITE32_MEMBER( m68340_internal_timer_w );
- emu_timer *m_irq_timer;
- TIMER_CALLBACK_MEMBER(periodic_interrupt_timer_callback);
- void start_68340_sim(void);
- void do_timer_irq(void);
-
protected:
virtual void device_start() override;
virtual void device_reset() override;
+ TIMER_CALLBACK_MEMBER(periodic_interrupt_timer_callback);
+ void start_68340_sim();
+ void do_timer_irq();
+
+ int calc_cs(offs_t address) const;
+
+ int m_currentcs;
+
+ /* 68340 peripheral modules */
+ m68340_sim* m68340SIM;
+ m68340_dma* m68340DMA;
+ m68340_serial* m68340SERIAL;
+ m68340_timer* m68340TIMER;
+
+ uint32_t m68340_base;
+
+ uint16_t m_avr;
+ uint16_t m_picr;
+ uint16_t m_pitr;
+
+ emu_timer *m_irq_timer;
};
-extern const device_type M68340;
+DECLARE_DEVICE_TYPE(M68340, m68340_cpu_device)
-#endif
+#endif // MAME_MACHINE_68340_H
diff --git a/src/devices/machine/68340dma.cpp b/src/devices/machine/68340dma.cpp
index 84f17f6c1cb..e37e573e5e6 100644
--- a/src/devices/machine/68340dma.cpp
+++ b/src/devices/machine/68340dma.cpp
@@ -6,34 +6,26 @@
#include "68340.h"
-READ32_MEMBER( m68340cpu_device::m68340_internal_dma_r )
+READ32_MEMBER( m68340_cpu_device::m68340_internal_dma_r )
{
- m68340cpu_device *m68k = this;
- m68340_dma* dma = m68k->m68340DMA;
- assert(dma != nullptr);
+ assert(m68340DMA);
+ //m68340_dma &dma = *m68340DMA;
- if (dma)
- {
- int pc = space.device().safe_pc();
- logerror("%08x m68340_internal_dma_r %08x, (%08x)\n", pc, offset*4,mem_mask);
- }
+ int pc = space.device().safe_pc();
+ logerror("%08x m68340_internal_dma_r %08x, (%08x)\n", pc, offset*4,mem_mask);
return 0x00000000;
}
-WRITE32_MEMBER( m68340cpu_device::m68340_internal_dma_w )
+WRITE32_MEMBER( m68340_cpu_device::m68340_internal_dma_w )
{
- m68340cpu_device *m68k = this;
- m68340_dma* dma = m68k->m68340DMA;
- assert(dma != nullptr);
-
- if (dma)
- {
- int pc = space.device().safe_pc();
- logerror("%08x m68340_internal_dma_w %08x, %08x (%08x)\n", pc, offset*4,data,mem_mask);
- }
+ assert(m68340DMA);
+ //m68340_dma &dma = *m68340DMA;
+
+ int pc = space.device().safe_pc();
+ logerror("%08x m68340_internal_dma_w %08x, %08x (%08x)\n", pc, offset*4,data,mem_mask);
}
-void m68340_dma::reset(void)
+void m68340_dma::reset()
{
}
diff --git a/src/devices/machine/68340dma.h b/src/devices/machine/68340dma.h
index 56d8228fa2d..3a92b4e9a49 100644
--- a/src/devices/machine/68340dma.h
+++ b/src/devices/machine/68340dma.h
@@ -1,10 +1,15 @@
// license:BSD-3-Clause
// copyright-holders:David Haywood
+#ifndef MAME_MACHINE_68340DMA_H
+#define MAME_MACHINE_68340DMA_H
+
+#pragma once
-#include "cpu/m68000/m68000.h"
class m68340_dma
{
- public:
- void reset(void);
+public:
+ void reset();
};
+
+#endif // MAME_MACHINE_68340DMA_H
diff --git a/src/devices/machine/68340ser.cpp b/src/devices/machine/68340ser.cpp
index 230b6c7a71b..8a26975cd87 100644
--- a/src/devices/machine/68340ser.cpp
+++ b/src/devices/machine/68340ser.cpp
@@ -6,35 +6,26 @@
#include "68340.h"
-READ32_MEMBER( m68340cpu_device::m68340_internal_serial_r )
+READ32_MEMBER( m68340_cpu_device::m68340_internal_serial_r )
{
- m68340cpu_device *m68k = this;
- m68340_serial* serial = m68k->m68340SERIAL;
- assert(serial != nullptr);
+ assert(m68340SERIAL);
+ //m68340_serial &serial = *m68340SERIAL;
- if (serial)
- {
- int pc = space.device().safe_pc();
- logerror("%08x m68340_internal_serial_r %08x, (%08x)\n", pc, offset*4,mem_mask);
- }
+ int pc = space.device().safe_pc();
+ logerror("%08x m68340_internal_serial_r %08x, (%08x)\n", pc, offset*4,mem_mask);
return 0x00000000;
}
-WRITE32_MEMBER( m68340cpu_device::m68340_internal_serial_w )
+WRITE32_MEMBER( m68340_cpu_device::m68340_internal_serial_w )
{
- m68340cpu_device *m68k = this;
- m68340_serial* serial = m68k->m68340SERIAL;
- assert(serial != nullptr);
-
- if (serial)
- {
- int pc = space.device().safe_pc();
- logerror("%08x m68340_internal_serial_w %08x, %08x (%08x)\n", pc, offset*4,data,mem_mask);
- }
+ assert(m68340SERIAL);
+ //m68340_serial &serial = *m68340SERIAL;
+ int pc = space.device().safe_pc();
+ logerror("%08x m68340_internal_serial_w %08x, %08x (%08x)\n", pc, offset*4,data,mem_mask);
}
-void m68340_serial::reset(void)
+void m68340_serial::reset()
{
}
diff --git a/src/devices/machine/68340ser.h b/src/devices/machine/68340ser.h
index 0fda812ff0a..c5fcd028bdd 100644
--- a/src/devices/machine/68340ser.h
+++ b/src/devices/machine/68340ser.h
@@ -1,10 +1,15 @@
// license:BSD-3-Clause
// copyright-holders:David Haywood
+#ifndef MAME_MACHINE_68340SER_H
+#define MAME_MACHINE_68340SER_H
+
+#pragma once
-#include "cpu/m68000/m68000.h"
class m68340_serial
{
- public:
- void reset(void);
+public:
+ void reset();
};
+
+#endif // MAME_MACHINE_68340SER_H
diff --git a/src/devices/machine/68340sim.cpp b/src/devices/machine/68340sim.cpp
index f1d346e880b..fda96a762b1 100644
--- a/src/devices/machine/68340sim.cpp
+++ b/src/devices/machine/68340sim.cpp
@@ -6,310 +6,319 @@
#include "68340.h"
-
-READ16_MEMBER( m68340cpu_device::m68340_internal_sim_r )
+#define m68340SIM_MCR (0x00)
+// (0x02)
+#define m68340SIM_SYNCR (0x04)
+#define m68340SIM_AVR_RSR (0x06)
+// (0x08)
+// (0x0a)
+// (0x0c)
+// (0x0e)
+#define m68340SIM_PORTA (0x11)
+#define m68340SIM_DDRA (0x13)
+#define m68340SIM_PPRA1 (0x15)
+#define m68340SIM_PPRA2 (0x17)
+#define m68340SIM_PORTB (0x19)
+#define m68340SIM_PORTB1 (0x1b)
+#define m68340SIM_DDRB (0x1d)
+#define m68340SIM_PPARB (0x1f)
+#define m68340SIM_SWIV_SYPCR (0x20)
+#define m68340SIM_PICR (0x22)
+#define m68340SIM_PITR (0x24)
+#define m68340SIM_SWSR (0x26)
+// (0x28)
+// (0x2a)
+// (0x2c)
+// (0x2e)
+// (0x30)
+// (0x32)
+// (0x34)
+// (0x36)
+// (0x38)
+// (0x3a)
+// (0x3c)
+// (0x3e)
+#define m68340SIM_AM_CS0 (0x40)
+#define m68340SIM_BA_CS0 (0x44)
+#define m68340SIM_AM_CS1 (0x48)
+#define m68340SIM_BA_CS1 (0x4c)
+#define m68340SIM_AM_CS2 (0x50)
+#define m68340SIM_BA_CS2 (0x54)
+#define m68340SIM_AM_CS3 (0x58)
+#define m68340SIM_BA_CS3 (0x5c)
+
+
+
+READ16_MEMBER( m68340_cpu_device::m68340_internal_sim_r )
{
- m68340cpu_device *m68k = this;
- m68340_sim* sim = m68k->m68340SIM;
- assert(sim != nullptr);
-
- if (sim)
- {
- int pc = space.device().safe_pc();
-
- switch (offset<<1)
- {
- case m68340SIM_MCR:
- logerror("%08x m68340_internal_sim_r %04x, (%04x) (MCR - Module Configuration Register)\n", pc, offset*2,mem_mask);
- return space.machine().rand();
+ assert(m68340SIM);
+ //m68340_sim &sim = *m68340SIM;
- case m68340SIM_SYNCR:
- logerror("%08x m68340_internal_sim_r %04x, (%04x) (SYNCR - Clock Synthesizer Register)\n", pc, offset*2,mem_mask);
- return space.machine().rand();
+ int pc = space.device().safe_pc();
- case m68340SIM_AVR_RSR:
- logerror("%08x m68340_internal_sim_r %04x, (%04x) (AVR, RSR - Auto Vector Register, Reset Status Register)\n", pc, offset*2,mem_mask);
- return space.machine().rand();
+ switch (offset<<1)
+ {
+ case m68340SIM_MCR:
+ logerror("%08x m68340_internal_sim_r %04x, (%04x) (MCR - Module Configuration Register)\n", pc, offset*2,mem_mask);
+ return space.machine().rand();
- case m68340SIM_SWIV_SYPCR:
- logerror("%08x m68340_internal_sim_r %04x, (%04x) (SWIV_SYPCR - Software Interrupt Vector, System Protection Control Register)\n", pc, offset*2,mem_mask);
- return space.machine().rand();
+ case m68340SIM_SYNCR:
+ logerror("%08x m68340_internal_sim_r %04x, (%04x) (SYNCR - Clock Synthesizer Register)\n", pc, offset*2,mem_mask);
+ return space.machine().rand();
- case m68340SIM_PICR:
- logerror("%08x m68340_internal_sim_r %04x, (%04x) (PICR - Periodic Interrupt Control Register)\n", pc, offset*2,mem_mask);
- return space.machine().rand();
+ case m68340SIM_AVR_RSR:
+ logerror("%08x m68340_internal_sim_r %04x, (%04x) (AVR, RSR - Auto Vector Register, Reset Status Register)\n", pc, offset*2,mem_mask);
+ return space.machine().rand();
- case m68340SIM_PITR:
- logerror("%08x m68340_internal_sim_r %04x, (%04x) (PITR - Periodic Interrupt Timer Register)\n", pc, offset*2,mem_mask);
- return space.machine().rand();
+ case m68340SIM_SWIV_SYPCR:
+ logerror("%08x m68340_internal_sim_r %04x, (%04x) (SWIV_SYPCR - Software Interrupt Vector, System Protection Control Register)\n", pc, offset*2,mem_mask);
+ return space.machine().rand();
- case m68340SIM_SWSR:
- logerror("%08x m68340_internal_sim_r %04x, (%04x) (SWSR - Software Service)\n", pc, offset*2,mem_mask);
- return space.machine().rand();
+ case m68340SIM_PICR:
+ logerror("%08x m68340_internal_sim_r %04x, (%04x) (PICR - Periodic Interrupt Control Register)\n", pc, offset*2,mem_mask);
+ return space.machine().rand();
- default:
- logerror("%08x m68340_internal_sim_r %04x, (%04x)\n", pc, offset*2,mem_mask);
+ case m68340SIM_PITR:
+ logerror("%08x m68340_internal_sim_r %04x, (%04x) (PITR - Periodic Interrupt Timer Register)\n", pc, offset*2,mem_mask);
+ return space.machine().rand();
+ case m68340SIM_SWSR:
+ logerror("%08x m68340_internal_sim_r %04x, (%04x) (SWSR - Software Service)\n", pc, offset*2,mem_mask);
+ return space.machine().rand();
- }
+ default:
+ logerror("%08x m68340_internal_sim_r %04x, (%04x)\n", pc, offset*2,mem_mask);
}
return 0x0000;
}
-READ8_MEMBER( m68340cpu_device::m68340_internal_sim_ports_r )
+READ8_MEMBER( m68340_cpu_device::m68340_internal_sim_ports_r )
{
offset += 0x10;
- m68340cpu_device *m68k = this;
- m68340_sim* sim = m68k->m68340SIM;
- assert(sim != nullptr);
+ assert(m68340SIM);
+ //m68340_sim &sim = *m68340SIM;
- if (sim)
- {
- int pc = space.device().safe_pc();
+ int pc = space.device().safe_pc();
- switch (offset)
- {
- case m68340SIM_PORTA:
- logerror("%08x m68340_internal_sim_r %04x (PORTA - Port A Data)\n", pc, offset);
- return space.machine().rand();
-
- case m68340SIM_DDRA:
- logerror("%08x m68340_internal_sim_r %04x (DDRA - Port A Data Direction)\n", pc, offset);
- return space.machine().rand();
+ switch (offset)
+ {
+ case m68340SIM_PORTA:
+ logerror("%08x m68340_internal_sim_r %04x (PORTA - Port A Data)\n", pc, offset);
+ return space.machine().rand();
- case m68340SIM_PPRA1:
- logerror("%08x m68340_internal_sim_r %04x (PPRA1 - Port A Pin Assignment 1)\n", pc, offset);
- return space.machine().rand();
+ case m68340SIM_DDRA:
+ logerror("%08x m68340_internal_sim_r %04x (DDRA - Port A Data Direction)\n", pc, offset);
+ return space.machine().rand();
- case m68340SIM_PPRA2:
- logerror("%08x m68340_internal_sim_r %04x (PPRA2 - Port A Pin Assignment 2)\n", pc, offset);
- return space.machine().rand();
+ case m68340SIM_PPRA1:
+ logerror("%08x m68340_internal_sim_r %04x (PPRA1 - Port A Pin Assignment 1)\n", pc, offset);
+ return space.machine().rand();
- case m68340SIM_PORTB:
- logerror("%08x m68340_internal_sim_r %04x (PORTB - Port B Data 0)\n", pc, offset);
- return space.machine().rand();
+ case m68340SIM_PPRA2:
+ logerror("%08x m68340_internal_sim_r %04x (PPRA2 - Port A Pin Assignment 2)\n", pc, offset);
+ return space.machine().rand();
- case m68340SIM_PORTB1:
- logerror("%08x m68340_internal_sim_r %04x (PORTB1 - Port B Data 1)\n", pc, offset);
- return space.machine().rand();
+ case m68340SIM_PORTB:
+ logerror("%08x m68340_internal_sim_r %04x (PORTB - Port B Data 0)\n", pc, offset);
+ return space.machine().rand();
- case m68340SIM_DDRB:
- logerror("%08x m68340_internal_sim_r %04x (DDR - Port B Data Direction)\n", pc, offset);
- return space.machine().rand();
+ case m68340SIM_PORTB1:
+ logerror("%08x m68340_internal_sim_r %04x (PORTB1 - Port B Data 1)\n", pc, offset);
+ return space.machine().rand();
- case m68340SIM_PPARB:
- logerror("%08x m68340_internal_sim_r %04x (PPARB - Port B Pin Assignment)\n", pc, offset);
- return space.machine().rand();
+ case m68340SIM_DDRB:
+ logerror("%08x m68340_internal_sim_r %04x (DDR - Port B Data Direction)\n", pc, offset);
+ return space.machine().rand();
- default:
- logerror("%08x m68340_internal_sim_r %04x (ILLEGAL?)\n", pc, offset);
- return space.machine().rand();
+ case m68340SIM_PPARB:
+ logerror("%08x m68340_internal_sim_r %04x (PPARB - Port B Pin Assignment)\n", pc, offset);
+ return space.machine().rand();
- }
+ default:
+ logerror("%08x m68340_internal_sim_r %04x (ILLEGAL?)\n", pc, offset);
+ return space.machine().rand();
}
-
- return 0x00;
}
-READ32_MEMBER( m68340cpu_device::m68340_internal_sim_cs_r )
+READ32_MEMBER( m68340_cpu_device::m68340_internal_sim_cs_r )
{
offset += m68340SIM_AM_CS0>>2;
- m68340cpu_device *m68k = this;
- m68340_sim* sim = m68k->m68340SIM;
- assert(sim != nullptr);
+ assert(m68340SIM);
+ m68340_sim &sim = *m68340SIM;
- if (sim)
- {
- int pc = space.device().safe_pc();
-
- switch (offset<<2)
- {
- case m68340SIM_AM_CS0: return sim->m_am[0];
- case m68340SIM_BA_CS0: return sim->m_ba[0];
- case m68340SIM_AM_CS1: return sim->m_am[1];
- case m68340SIM_BA_CS1: return sim->m_ba[1];
- case m68340SIM_AM_CS2: return sim->m_am[2];
- case m68340SIM_BA_CS2: return sim->m_ba[2];
- case m68340SIM_AM_CS3: return sim->m_am[3];
- case m68340SIM_BA_CS3: return sim->m_ba[3];
-
- default:
- logerror("%08x m68340_internal_sim_r %08x, (%08x)\n", pc, offset*4,mem_mask);
+ int pc = space.device().safe_pc();
- }
+ switch (offset<<2)
+ {
+ case m68340SIM_AM_CS0: return sim.m_am[0];
+ case m68340SIM_BA_CS0: return sim.m_ba[0];
+ case m68340SIM_AM_CS1: return sim.m_am[1];
+ case m68340SIM_BA_CS1: return sim.m_ba[1];
+ case m68340SIM_AM_CS2: return sim.m_am[2];
+ case m68340SIM_BA_CS2: return sim.m_ba[2];
+ case m68340SIM_AM_CS3: return sim.m_am[3];
+ case m68340SIM_BA_CS3: return sim.m_ba[3];
+
+ default:
+ logerror("%08x m68340_internal_sim_r %08x, (%08x)\n", pc, offset*4,mem_mask);
}
return 0x00000000;
}
-WRITE16_MEMBER( m68340cpu_device::m68340_internal_sim_w )
+WRITE16_MEMBER( m68340_cpu_device::m68340_internal_sim_w )
{
- m68340cpu_device *m68k = this;
- m68340_sim* sim = m68k->m68340SIM;
- assert(sim != nullptr);
+ assert(m68340SIM);
+ //m68340_sim &sim = *m68340SIM;
- if (sim)
- {
- int pc = space.device().safe_pc();
+ int pc = space.device().safe_pc();
- switch (offset<<1)
- {
- case m68340SIM_MCR:
- logerror("%08x m68340_internal_sim_w %04x, %04x (%04x) (MCR - Module Configuration Register)\n", pc, offset*2,data,mem_mask);
- break;
+ switch (offset<<1)
+ {
+ case m68340SIM_MCR:
+ logerror("%08x m68340_internal_sim_w %04x, %04x (%04x) (MCR - Module Configuration Register)\n", pc, offset*2,data,mem_mask);
+ break;
- case m68340SIM_SYNCR:
- logerror("%08x m68340_internal_sim_w %04x, %04x (%04x) (SYNCR - Clock Synthesizer Register)\n", pc, offset*2,data,mem_mask);
- break;
+ case m68340SIM_SYNCR:
+ logerror("%08x m68340_internal_sim_w %04x, %04x (%04x) (SYNCR - Clock Synthesizer Register)\n", pc, offset*2,data,mem_mask);
+ break;
- case m68340SIM_AVR_RSR:
- logerror("%08x m68340_internal_sim_w %04x, %04x (%04x) (AVR, RSR - Auto Vector Register, Reset Status Register)\n", pc, offset*2,data,mem_mask);
- COMBINE_DATA(&m_avr);
- break;
+ case m68340SIM_AVR_RSR:
+ logerror("%08x m68340_internal_sim_w %04x, %04x (%04x) (AVR, RSR - Auto Vector Register, Reset Status Register)\n", pc, offset*2,data,mem_mask);
+ COMBINE_DATA(&m_avr);
+ break;
- case m68340SIM_SWIV_SYPCR:
- logerror("%08x m68340_internal_sim_w %04x, %04x (%04x) (SWIV_SYPCR - Software Interrupt Vector, System Protection Control Register)\n", pc, offset*2,data,mem_mask);
- break;
+ case m68340SIM_SWIV_SYPCR:
+ logerror("%08x m68340_internal_sim_w %04x, %04x (%04x) (SWIV_SYPCR - Software Interrupt Vector, System Protection Control Register)\n", pc, offset*2,data,mem_mask);
+ break;
- case m68340SIM_PICR:
- logerror("%08x m68340_internal_sim_w %04x, %04x (%04x) (PICR - Periodic Interrupt Control Register)\n", pc, offset*2,data,mem_mask);
- COMBINE_DATA(&m_picr);
- break;
+ case m68340SIM_PICR:
+ logerror("%08x m68340_internal_sim_w %04x, %04x (%04x) (PICR - Periodic Interrupt Control Register)\n", pc, offset*2,data,mem_mask);
+ COMBINE_DATA(&m_picr);
+ break;
- case m68340SIM_PITR:
- logerror("%08x m68340_internal_sim_w %04x, %04x (%04x) (PITR - Periodic Interrupt Timer Register)\n", pc, offset*2,data,mem_mask);
- COMBINE_DATA(&m_pitr);
- if (m_pitr !=0 ) // hack
- {
- //logerror("timer set\n");
- m_irq_timer->adjust(cycles_to_attotime(20000)); // hack
- }
+ case m68340SIM_PITR:
+ logerror("%08x m68340_internal_sim_w %04x, %04x (%04x) (PITR - Periodic Interrupt Timer Register)\n", pc, offset*2,data,mem_mask);
+ COMBINE_DATA(&m_pitr);
+ if (m_pitr !=0 ) // hack
+ {
+ //logerror("timer set\n");
+ m_irq_timer->adjust(cycles_to_attotime(20000)); // hack
+ }
- break;
+ break;
- case m68340SIM_SWSR:
- // basically watchdog, you must write an alternating pattern of 0x55 / 0xaa to keep the watchdog from resetting the system
- //logerror("%08x m68340_internal_sim_w %04x, %04x (%04x) (SWSR - Software Service)\n", pc, offset*2,data,mem_mask);
- break;
+ case m68340SIM_SWSR:
+ // basically watchdog, you must write an alternating pattern of 0x55 / 0xaa to keep the watchdog from resetting the system
+ //logerror("%08x m68340_internal_sim_w %04x, %04x (%04x) (SWSR - Software Service)\n", pc, offset*2,data,mem_mask);
+ break;
- default:
- logerror("%08x m68340_internal_sim_w %04x, %04x (%04x)\n", pc, offset*2,data,mem_mask);
+ default:
+ logerror("%08x m68340_internal_sim_w %04x, %04x (%04x)\n", pc, offset*2,data,mem_mask);
- }
}
}
-WRITE8_MEMBER( m68340cpu_device::m68340_internal_sim_ports_w )
+WRITE8_MEMBER( m68340_cpu_device::m68340_internal_sim_ports_w )
{
offset += 0x10;
- m68340cpu_device *m68k = this;
- m68340_sim* sim = m68k->m68340SIM;
- assert(sim != nullptr);
-
- if (sim)
- {
- int pc = space.device().safe_pc();
+ assert(m68340SIM);
+ //m68340_sim &sim = *m68340SIM;
- switch (offset)
- {
- case m68340SIM_PORTA:
- logerror("%08x m68340_internal_sim_w %04x, %02x (PORTA - Port A Data)\n", pc, offset,data);
- break;
+ int pc = space.device().safe_pc();
- case m68340SIM_DDRA:
- logerror("%08x m68340_internal_sim_w %04x, %02x (DDRA - Port A Data Direction)\n", pc, offset,data);
- break;
+ switch (offset)
+ {
+ case m68340SIM_PORTA:
+ logerror("%08x m68340_internal_sim_w %04x, %02x (PORTA - Port A Data)\n", pc, offset,data);
+ break;
- case m68340SIM_PPRA1:
- logerror("%08x m68340_internal_sim_w %04x, %02x (PPRA1 - Port A Pin Assignment 1)\n", pc, offset,data);
- break;
+ case m68340SIM_DDRA:
+ logerror("%08x m68340_internal_sim_w %04x, %02x (DDRA - Port A Data Direction)\n", pc, offset,data);
+ break;
- case m68340SIM_PPRA2:
- logerror("%08x m68340_internal_sim_w %04x, %02x (PPRA2 - Port A Pin Assignment 2)\n", pc, offset,data);
- break;
+ case m68340SIM_PPRA1:
+ logerror("%08x m68340_internal_sim_w %04x, %02x (PPRA1 - Port A Pin Assignment 1)\n", pc, offset,data);
+ break;
- case m68340SIM_PORTB:
- logerror("%08x m68340_internal_sim_w %04x, %02x (PORTB - Port B Data)\n", pc, offset,data);
- break;
+ case m68340SIM_PPRA2:
+ logerror("%08x m68340_internal_sim_w %04x, %02x (PPRA2 - Port A Pin Assignment 2)\n", pc, offset,data);
+ break;
- case m68340SIM_PORTB1:
- logerror("%08x m68340_internal_sim_w %04x, %02x (PORTB1 - Port B Data - mirror)\n", pc, offset,data);
- break;
+ case m68340SIM_PORTB:
+ logerror("%08x m68340_internal_sim_w %04x, %02x (PORTB - Port B Data)\n", pc, offset,data);
+ break;
- case m68340SIM_DDRB:
- logerror("%08x m68340_internal_sim_w %04x, %02x (DDR - Port B Data Direction)\n", pc, offset,data);
- break;
+ case m68340SIM_PORTB1:
+ logerror("%08x m68340_internal_sim_w %04x, %02x (PORTB1 - Port B Data - mirror)\n", pc, offset,data);
+ break;
- case m68340SIM_PPARB:
- logerror("%08x m68340_internal_sim_w %04x, %02x (PPARB - Port B Pin Assignment)\n", pc, offset,data);
- break;
+ case m68340SIM_DDRB:
+ logerror("%08x m68340_internal_sim_w %04x, %02x (DDR - Port B Data Direction)\n", pc, offset,data);
+ break;
- default:
- logerror("%08x m68340_internal_sim_w %04x, %02x (ILLEGAL?)\n", pc, offset,data);
- break;
+ case m68340SIM_PPARB:
+ logerror("%08x m68340_internal_sim_w %04x, %02x (PPARB - Port B Pin Assignment)\n", pc, offset,data);
+ break;
- }
+ default:
+ logerror("%08x m68340_internal_sim_w %04x, %02x (ILLEGAL?)\n", pc, offset,data);
+ break;
}
}
-WRITE32_MEMBER( m68340cpu_device::m68340_internal_sim_cs_w )
+WRITE32_MEMBER( m68340_cpu_device::m68340_internal_sim_cs_w )
{
offset += m68340SIM_AM_CS0>>2;
- m68340cpu_device *m68k = this;
- m68340_sim* sim = m68k->m68340SIM;
- assert(sim != nullptr);
-
- if (sim)
- {
- int pc = space.device().safe_pc();
+ assert(m68340SIM);
+ m68340_sim &sim = *m68340SIM;
- switch (offset<<2)
- {
- case m68340SIM_AM_CS0:
- COMBINE_DATA(&sim->m_am[0]);
- break;
+ int pc = space.device().safe_pc();
- case m68340SIM_BA_CS0:
- COMBINE_DATA(&sim->m_ba[0]);
- break;
+ switch (offset<<2)
+ {
+ case m68340SIM_AM_CS0:
+ COMBINE_DATA(&sim.m_am[0]);
+ break;
- case m68340SIM_AM_CS1:
- COMBINE_DATA(&sim->m_am[1]);
- break;
+ case m68340SIM_BA_CS0:
+ COMBINE_DATA(&sim.m_ba[0]);
+ break;
- case m68340SIM_BA_CS1:
- COMBINE_DATA(&sim->m_ba[1]);
- break;
+ case m68340SIM_AM_CS1:
+ COMBINE_DATA(&sim.m_am[1]);
+ break;
- case m68340SIM_AM_CS2:
- COMBINE_DATA(&sim->m_am[2]);
- break;
+ case m68340SIM_BA_CS1:
+ COMBINE_DATA(&sim.m_ba[1]);
+ break;
- case m68340SIM_BA_CS2:
- COMBINE_DATA(&sim->m_ba[2]);
- break;
+ case m68340SIM_AM_CS2:
+ COMBINE_DATA(&sim.m_am[2]);
+ break;
- case m68340SIM_AM_CS3:
- COMBINE_DATA(&sim->m_am[3]);
- break;
+ case m68340SIM_BA_CS2:
+ COMBINE_DATA(&sim.m_ba[2]);
+ break;
- case m68340SIM_BA_CS3:
- COMBINE_DATA(&sim->m_ba[3]);
- break;
+ case m68340SIM_AM_CS3:
+ COMBINE_DATA(&sim.m_am[3]);
+ break;
- default:
- logerror("%08x m68340_internal_sim_w %08x, %08x (%08x)\n", pc, offset*4,data,mem_mask);
- break;
+ case m68340SIM_BA_CS3:
+ COMBINE_DATA(&sim.m_ba[3]);
+ break;
- }
+ default:
+ logerror("%08x m68340_internal_sim_w %08x, %08x (%08x)\n", pc, offset*4,data,mem_mask);
+ break;
}
-
}
-void m68340cpu_device::do_timer_irq(void)
+void m68340_cpu_device::do_timer_irq()
{
//logerror("do_timer_irq\n");
int timer_irq_level = (m_picr & 0x0700)>>8;
@@ -333,17 +342,17 @@ void m68340cpu_device::do_timer_irq(void)
}
}
-TIMER_CALLBACK_MEMBER(m68340cpu_device::periodic_interrupt_timer_callback)
+TIMER_CALLBACK_MEMBER(m68340_cpu_device::periodic_interrupt_timer_callback)
{
do_timer_irq();
m_irq_timer->adjust(cycles_to_attotime(20000)); // hack
}
-void m68340cpu_device::start_68340_sim(void)
+void m68340_cpu_device::start_68340_sim()
{
- m_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(m68340cpu_device::periodic_interrupt_timer_callback),this));
+ m_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(m68340_cpu_device::periodic_interrupt_timer_callback),this));
}
-void m68340_sim::reset(void)
+void m68340_sim::reset()
{
}
diff --git a/src/devices/machine/68340sim.h b/src/devices/machine/68340sim.h
index 821de60b319..203930d0466 100644
--- a/src/devices/machine/68340sim.h
+++ b/src/devices/machine/68340sim.h
@@ -1,60 +1,18 @@
// license:BSD-3-Clause
// copyright-holders:David Haywood
+#ifndef MAME_MACHINE_68340SIM_H
+#define MAME_MACHINE_68340SIM_H
-#include "cpu/m68000/m68000.h"
-
-#define m68340SIM_MCR (0x00)
-// (0x02)
-#define m68340SIM_SYNCR (0x04)
-#define m68340SIM_AVR_RSR (0x06)
-// (0x08)
-// (0x0a)
-// (0x0c)
-// (0x0e)
-#define m68340SIM_PORTA (0x11)
-#define m68340SIM_DDRA (0x13)
-#define m68340SIM_PPRA1 (0x15)
-#define m68340SIM_PPRA2 (0x17)
-#define m68340SIM_PORTB (0x19)
-#define m68340SIM_PORTB1 (0x1b)
-#define m68340SIM_DDRB (0x1d)
-#define m68340SIM_PPARB (0x1f)
-#define m68340SIM_SWIV_SYPCR (0x20)
-#define m68340SIM_PICR (0x22)
-#define m68340SIM_PITR (0x24)
-#define m68340SIM_SWSR (0x26)
-// (0x28)
-// (0x2a)
-// (0x2c)
-// (0x2e)
-// (0x30)
-// (0x32)
-// (0x34)
-// (0x36)
-// (0x38)
-// (0x3a)
-// (0x3c)
-// (0x3e)
-#define m68340SIM_AM_CS0 (0x40)
-#define m68340SIM_BA_CS0 (0x44)
-#define m68340SIM_AM_CS1 (0x48)
-#define m68340SIM_BA_CS1 (0x4c)
-#define m68340SIM_AM_CS2 (0x50)
-#define m68340SIM_BA_CS2 (0x54)
-#define m68340SIM_AM_CS3 (0x58)
-#define m68340SIM_BA_CS3 (0x5c)
-
-
-
-
+#pragma once
class m68340_sim
{
- public:
-
+public:
uint32_t m_am[4];
uint32_t m_ba[4];
- void reset(void);
+ void reset();
};
+
+#endif // MAME_MACHINE_68340SIM_H
diff --git a/src/devices/machine/68340tmu.cpp b/src/devices/machine/68340tmu.cpp
index faffb9d1181..92014401a34 100644
--- a/src/devices/machine/68340tmu.cpp
+++ b/src/devices/machine/68340tmu.cpp
@@ -6,34 +6,26 @@
#include "68340.h"
-READ32_MEMBER( m68340cpu_device::m68340_internal_timer_r )
+READ32_MEMBER( m68340_cpu_device::m68340_internal_timer_r )
{
- m68340cpu_device *m68k = this;
- m68340_timer* timer = m68k->m68340TIMER;
- assert(timer != nullptr);
+ assert(m68340TIMER);
+ //m68340_timer &timer = *m68340TIMER;
- if (timer)
- {
- int pc = space.device().safe_pc();
- logerror("%08x m68340_internal_timer_r %08x, (%08x)\n", pc, offset*4,mem_mask);
- }
+ int pc = space.device().safe_pc();
+ logerror("%08x m68340_internal_timer_r %08x, (%08x)\n", pc, offset*4,mem_mask);
return 0x00000000;
}
-WRITE32_MEMBER( m68340cpu_device::m68340_internal_timer_w )
+WRITE32_MEMBER( m68340_cpu_device::m68340_internal_timer_w )
{
- m68340cpu_device *m68k = this;
- m68340_timer* timer = m68k->m68340TIMER;
- assert(timer != nullptr);
-
- if (timer)
- {
- int pc = space.device().safe_pc();
- logerror("%08x m68340_internal_timer_w %08x, %08x (%08x)\n", pc, offset*4,data,mem_mask);
- }
+ assert(m68340TIMER);
+ //m68340_timer &timer = *m68340TIMER;
+
+ int pc = space.device().safe_pc();
+ logerror("%08x m68340_internal_timer_w %08x, %08x (%08x)\n", pc, offset*4,data,mem_mask);
}
-void m68340_timer::reset(void)
+void m68340_timer::reset()
{
}
diff --git a/src/devices/machine/68340tmu.h b/src/devices/machine/68340tmu.h
index a892e2792d8..911a079c520 100644
--- a/src/devices/machine/68340tmu.h
+++ b/src/devices/machine/68340tmu.h
@@ -1,10 +1,15 @@
// license:BSD-3-Clause
// copyright-holders:David Haywood
-#include "cpu/m68000/m68000.h"
+#ifndef MAME_MACHINE_68340TMU_H
+#define MAME_MACHINE_68340TMU_H
+
+#pragma once
class m68340_timer
{
- public:
- void reset(void);
+public:
+ void reset();
};
+
+#endif // MAME_MACHINE_68340TMU_H
diff --git a/src/devices/machine/6840ptm.cpp b/src/devices/machine/6840ptm.cpp
index 883821cb039..8921c50201c 100644
--- a/src/devices/machine/6840ptm.cpp
+++ b/src/devices/machine/6840ptm.cpp
@@ -38,9 +38,9 @@
#include "emu.h"
#include "6840ptm.h"
+//#define VERBOSE 1
+#include "logmacro.h"
-#define PTMVERBOSE 0
-#define PLOG(x) do { if (PTMVERBOSE) logerror x; } while (0)
/***************************************************************************
LOCAL VARIABLES
@@ -63,18 +63,18 @@ const char *const ptm6840_device::opmode[] =
***************************************************************************/
// device type definition
-const device_type PTM6840 = device_creator<ptm6840_device>;
+DEFINE_DEVICE_TYPE(PTM6840, ptm6840_device, "ptm6840", "MC6840 PTM")
//-------------------------------------------------
// ptm6840_device - constructor
//-------------------------------------------------
ptm6840_device::ptm6840_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, PTM6840, "6840 PTM", tag, owner, clock, "ptm6840", __FILE__),
- m_out_cb{*this, *this, *this},
- m_irq_cb(*this)
+ : device_t(mconfig, PTM6840, tag, owner, clock)
+ , m_external_clock{ 0.0, 0.0, 0.0 }
+ , m_out_cb{*this, *this, *this}
+ , m_irq_cb(*this)
{
- m_external_clock[0] = m_external_clock[1] = m_external_clock[2] = 0.0;
}
//-------------------------------------------------
@@ -300,7 +300,7 @@ uint16_t ptm6840_device::compute_counter( int counter ) const
// If there's no timer, return the count
if (!m_enabled[counter])
{
- PLOG(("MC6840 #%s: read counter(%d): %d\n", tag(), counter, m_counter[counter]));
+ LOG("MC6840: read counter(%d): %d\n", counter, m_counter[counter]);
return m_counter[counter];
}
@@ -308,12 +308,12 @@ uint16_t ptm6840_device::compute_counter( int counter ) const
if (m_control_reg[counter] & INTERNAL_CLK_EN)
{
clk = static_cast<double>(clock());
- PLOG(("MC6840 #%s: %d internal clock freq %f \n", tag(), counter, clk));
+ LOG("MC6840: %d internal clock freq %f \n", counter, clk);
}
else
{
clk = m_external_clock[counter];
- PLOG(("MC6840 #%s: %d external clock freq %f \n", tag(), counter, clk));
+ LOG("MC6840: %d external clock freq %f \n", counter, clk);
}
// See how many are left
int remaining = (m_timer[counter]->remaining() * clk).as_double();
@@ -326,7 +326,7 @@ uint16_t ptm6840_device::compute_counter( int counter ) const
int lsb = remaining % divisor;
remaining = (msb << 8) | lsb;
}
- PLOG(("MC6840 #%s: read counter(%d): %d\n", tag(), counter, remaining));
+ LOG("MC6840: read counter(%d): %d\n", counter, remaining);
return remaining;
}
@@ -351,12 +351,12 @@ void ptm6840_device::reload_count(int idx)
if (m_control_reg[idx] & INTERNAL_CLK_EN)
{
clk = static_cast<double> (clock());
- PLOG(("MC6840 #%s: %d internal clock freq %f \n", tag(), idx, clk));
+ LOG("MC6840: %d internal clock freq %f \n", idx, clk);
}
else
{
clk = m_external_clock[idx];
- PLOG(("MC6840 #%s: %d external clock freq %f \n", tag(), idx, clk));
+ LOG("MC6840: %d external clock freq %f \n", idx, clk);
}
// Determine the number of clock periods before we expire
@@ -379,7 +379,7 @@ void ptm6840_device::reload_count(int idx)
}
// Set the timer
- PLOG(("MC6840 #%s: reload_count(%d): clock = %f count = %d\n", tag(), idx, clk, count));
+ LOG("MC6840: reload_count(%d): clock = %f count = %d\n", idx, clk, count);
attotime duration = attotime::from_hz(clk) * count;
if (idx == 2)
@@ -387,7 +387,7 @@ void ptm6840_device::reload_count(int idx)
duration *= m_t3_divisor;
}
- PLOG(("MC6840 #%s: reload_count(%d): output = %f\n", tag(), idx, duration.as_double()));
+ LOG("MC6840: reload_count(%d): output = %f\n", idx, duration.as_double());
#if 0
if (!(m_control_reg[idx] & INTERNAL_CLK_EN))
@@ -427,7 +427,7 @@ READ8_MEMBER( ptm6840_device::read )
case PTM_6840_STATUS:
{
- PLOG(("%s: MC6840 #%s: Status read = %04X\n", machine().describe_context(), tag(), m_status_reg));
+ LOG("%s: MC6840: Status read = %04X\n", machine().describe_context(), m_status_reg);
m_status_read_since_int |= m_status_reg & 0x07;
val = m_status_reg;
break;
@@ -449,7 +449,7 @@ READ8_MEMBER( ptm6840_device::read )
m_lsb_buffer = result & 0xff;
- PLOG(("%s: MC6840 #%s: Counter %d read = %04X\n", machine().describe_context(), tag(), idx, result >> 8));
+ LOG("%s: MC6840: Counter %d read = %04X\n", machine().describe_context(), idx, result >> 8);
val = result >> 8;
break;
}
@@ -490,10 +490,10 @@ WRITE8_MEMBER( ptm6840_device::write )
m_mode[idx] = (data >> 3) & 0x07;
m_control_reg[idx] = data;
- PLOG(("MC6840 #%s : Control register %d selected\n", tag(), idx));
- PLOG(("operation mode = %s\n", opmode[ m_mode[idx] ]));
- PLOG(("value = %04X\n", m_control_reg[idx]));
- PLOG(("t3divisor = %d\n", m_t3_divisor));
+ LOG("MC6840: Control register %d selected\n", idx);
+ LOG("operation mode = %s\n", opmode[m_mode[idx]]);
+ LOG("value = %04X\n", m_control_reg[idx]);
+ LOG("t3divisor = %d\n", m_t3_divisor);
if (diffs & INTERRUPT_EN)
update_interrupts();
@@ -510,7 +510,7 @@ WRITE8_MEMBER( ptm6840_device::write )
// Holding reset down
if (data & RESET_TIMERS)
{
- PLOG(("MC6840 #%s : Timer reset\n", tag()));
+ LOG("MC6840: Timer reset\n");
for (int i = 0; i < 3; i++)
{
m_timer[i]->enable(false);
@@ -542,7 +542,7 @@ WRITE8_MEMBER( ptm6840_device::write )
case PTM_6840_MSBBUF2:
case PTM_6840_MSBBUF3:
{
- PLOG(("MC6840 #%s msbbuf%d = %02X\n", tag(), offset / 2, data));
+ LOG("MC6840 msbbuf%d = %02X\n", offset / 2, data);
m_msb_buffer = data;
break;
}
@@ -564,7 +564,7 @@ WRITE8_MEMBER( ptm6840_device::write )
reload_count(idx);
}
- PLOG(("%s:MC6840 #%s: Counter %d latch = %04X\n", machine().describe_context(), tag(), idx, m_latch[idx]));
+ LOG("%s:MC6840: Counter %d latch = %04X\n", machine().describe_context(), idx, m_latch[idx]);
break;
}
}
@@ -577,7 +577,7 @@ WRITE8_MEMBER( ptm6840_device::write )
void ptm6840_device::timeout(int idx)
{
- PLOG(("**ptm6840 %s t%d timeout**\n", tag(), idx));
+ LOG("**ptm6840 t%d timeout**\n", idx);
// Set the interrupt flag
m_status_reg |= (1 << idx);
@@ -591,7 +591,7 @@ void ptm6840_device::timeout(int idx)
case 0:
case 2:
m_output[idx] = m_output[idx] ^ 1;
- PLOG(("**ptm6840 %s t%d output %d **\n", tag(), idx, m_output[idx]));
+ LOG("**ptm6840 t%d output %d **\n", idx, m_output[idx]);
m_out_cb[idx](m_output[idx]);
break;
@@ -600,7 +600,7 @@ void ptm6840_device::timeout(int idx)
if (!m_fired[idx])
{
m_output[idx] = 1;
- PLOG(("**ptm6840 %s t%d output %d **\n", tag(), idx, m_output[idx]));
+ LOG("**ptm6840 t%d output %d **\n", idx, m_output[idx]);
m_out_cb[idx](m_output[idx]);
diff --git a/src/devices/machine/6840ptm.h b/src/devices/machine/6840ptm.h
index 0ee38b0be4f..832f511179b 100644
--- a/src/devices/machine/6840ptm.h
+++ b/src/devices/machine/6840ptm.h
@@ -8,11 +8,10 @@
***************************************************************************/
-#pragma once
-
-#ifndef __6840PTM_H__
-#define __6840PTM_H__
+#ifndef MAME_MACHINE_6840PTM_H
+#define MAME_MACHINE_6840PTM_H
+#pragma once
@@ -48,8 +47,8 @@ public:
ptm6840_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
static void set_external_clocks(device_t &device, double clock0, double clock1, double clock2) { downcast<ptm6840_device &>(device).m_external_clock[0] = clock0; downcast<ptm6840_device &>(device).m_external_clock[1] = clock1; downcast<ptm6840_device &>(device).m_external_clock[2] = clock2; }
- template<class _Object> static devcb_base &set_out_callback(device_t &device, int index, _Object object) { return downcast<ptm6840_device &>(device).m_out_cb[index].set_callback(object); }
- template<class _Object> static devcb_base &set_irq_callback(device_t &device, _Object object) { return downcast<ptm6840_device &>(device).m_irq_cb.set_callback(object); }
+ template <class Object> static devcb_base &set_out_callback(device_t &device, int index, Object &&cb) { return downcast<ptm6840_device &>(device).m_out_cb[index].set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_irq_callback(device_t &device, Object &&cb) { return downcast<ptm6840_device &>(device).m_irq_cb.set_callback(std::forward<Object>(cb)); }
int status(int clock) const { return m_enabled[clock]; } // get whether timer is enabled
int irq_state() const { return m_irq; } // get IRQ state
@@ -151,7 +150,6 @@ private:
// device type definition
-extern const device_type PTM6840;
-
+DECLARE_DEVICE_TYPE(PTM6840, ptm6840_device)
-#endif /* __6840PTM_H__ */
+#endif // MAME_MACHINE_6840PTM_H
diff --git a/src/devices/machine/6850acia.cpp b/src/devices/machine/6850acia.cpp
index 567a0af6e9f..64624699e9b 100644
--- a/src/devices/machine/6850acia.cpp
+++ b/src/devices/machine/6850acia.cpp
@@ -58,60 +58,38 @@ const int acia6850_device::transmitter_control[4][3] =
***************************************************************************/
// device type definition
-const device_type ACIA6850 = device_creator<acia6850_device>;
-
-template class device_finder<acia6850_device, false>;
-template class device_finder<acia6850_device, true>;
+DEFINE_DEVICE_TYPE(ACIA6850, acia6850_device, "acia6850", "MC6850 ACIA")
//-------------------------------------------------
// acia6850_device - constructor
//-------------------------------------------------
acia6850_device::acia6850_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, ACIA6850, "6850 ACIA", tag, owner, clock, "acia6850", __FILE__),
- m_txd_handler(*this),
- m_rts_handler(*this),
- m_irq_handler(*this),
- m_status(SR_TDRE),
- m_tdr(0),
- m_first_master_reset(true),
- m_dcd_irq_pending(false),
- m_overrun_pending(false),
- m_divide(0),
- m_rts(0),
- m_dcd(0),
- m_irq(0),
- m_txc(0),
- m_txd(0),
- m_tx_counter(0),
- m_tx_irq_enable(false),
- m_rxc(0),
- m_rxd(1),
- m_rx_irq_enable(false)
+ : acia6850_device(mconfig, ACIA6850, tag, owner, clock)
{
}
-acia6850_device::acia6850_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source)
- : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
- m_txd_handler(*this),
- m_rts_handler(*this),
- m_irq_handler(*this),
- m_status(SR_TDRE),
- m_tdr(0),
- m_first_master_reset(true),
- m_dcd_irq_pending(false),
- m_overrun_pending(false),
- m_divide(0),
- m_rts(0),
- m_dcd(0),
- m_irq(0),
- m_txc(0),
- m_txd(0),
- m_tx_counter(0),
- m_tx_irq_enable(false),
- m_rxc(0),
- m_rxd(1),
- m_rx_irq_enable(false)
+acia6850_device::acia6850_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_txd_handler(*this)
+ , m_rts_handler(*this)
+ , m_irq_handler(*this)
+ , m_status(SR_TDRE)
+ , m_tdr(0)
+ , m_first_master_reset(true)
+ , m_dcd_irq_pending(false)
+ , m_overrun_pending(false)
+ , m_divide(0)
+ , m_rts(0)
+ , m_dcd(0)
+ , m_irq(0)
+ , m_txc(0)
+ , m_txd(0)
+ , m_tx_counter(0)
+ , m_tx_irq_enable(false)
+ , m_rxc(0)
+ , m_rxd(1)
+ , m_rx_irq_enable(false)
{
}
diff --git a/src/devices/machine/6850acia.h b/src/devices/machine/6850acia.h
index ebf7594aeec..8ec75cf5e6e 100644
--- a/src/devices/machine/6850acia.h
+++ b/src/devices/machine/6850acia.h
@@ -8,10 +8,10 @@
*********************************************************************/
-#pragma once
+#ifndef MAME_MACHINE_6850ACIA_H
+#define MAME_MACHINE_6850ACIA_H
-#ifndef __ACIA6850_H__
-#define __ACIA6850_H__
+#pragma once
#define MCFG_ACIA6850_TXD_HANDLER(_devcb) \
@@ -30,9 +30,9 @@ public:
acia6850_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// static configuration helpers
- template<class _Object> static devcb_base &set_txd_handler(device_t &device, _Object object) { return downcast<acia6850_device &>(device).m_txd_handler.set_callback(object); }
- template<class _Object> static devcb_base &set_rts_handler(device_t &device, _Object object) { return downcast<acia6850_device &>(device).m_rts_handler.set_callback(object); }
- template<class _Object> static devcb_base &set_irq_handler(device_t &device, _Object object) { return downcast<acia6850_device &>(device).m_irq_handler.set_callback(object); }
+ template <class Object> static devcb_base &set_txd_handler(device_t &device, Object &&cb) { return downcast<acia6850_device &>(device).m_txd_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_rts_handler(device_t &device, Object &&cb) { return downcast<acia6850_device &>(device).m_rts_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_irq_handler(device_t &device, Object &&cb) { return downcast<acia6850_device &>(device).m_irq_handler.set_callback(std::forward<Object>(cb)); }
DECLARE_WRITE8_MEMBER( control_w );
DECLARE_READ8_MEMBER( status_r );
@@ -46,7 +46,7 @@ public:
DECLARE_WRITE_LINE_MEMBER( write_txc );
protected:
- acia6850_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source);
+ acia6850_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;
@@ -140,9 +140,6 @@ private:
};
// device type definition
-extern const device_type ACIA6850;
-
-extern template class device_finder<acia6850_device, false>;
-extern template class device_finder<acia6850_device, true>;
+DECLARE_DEVICE_TYPE(ACIA6850, acia6850_device)
-#endif /* __ACIA6850_H__ */
+#endif // MAME_MACHINE_6850ACIA_H
diff --git a/src/devices/machine/68561mpcc.cpp b/src/devices/machine/68561mpcc.cpp
index b783e436758..92f45df9e0e 100644
--- a/src/devices/machine/68561mpcc.cpp
+++ b/src/devices/machine/68561mpcc.cpp
@@ -86,18 +86,18 @@ FEATURES
// DEVICE DEFINITIONS
//**************************************************************************
// device type definition
-const device_type MPCC = device_creator<mpcc_device>;
-const device_type MPCC68560 = device_creator<mpcc68560_device>;
-const device_type MPCC68560A = device_creator<mpcc68560A_device>;
-const device_type MPCC68561 = device_creator<mpcc68561_device>;
-const device_type MPCC68561A = device_creator<mpcc68561A_device>;
+DEFINE_DEVICE_TYPE(MPCC, mpcc_device, "mpcc", "Rockwell MPCC")
+DEFINE_DEVICE_TYPE(MPCC68560, mpcc68560_device, "mpcc68560", "MPCC 68560")
+DEFINE_DEVICE_TYPE(MPCC68560A, mpcc68560a_device, "mpcc68560a", "MPCC 68560A")
+DEFINE_DEVICE_TYPE(MPCC68561, mpcc68561_device, "mpcc68561", "MPCC 68561")
+DEFINE_DEVICE_TYPE(MPCC68561A, mpcc68561a_device, "mpcc68561a", "MPCC 68561A")
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
-mpcc_device::mpcc_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, uint32_t variant, const char *shortname, const char *source)
- : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
+mpcc_device::mpcc_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint32_t variant)
+ : device_t(mconfig, type, tag, owner, clock),
device_serial_interface(mconfig, *this),
m_irq(CLEAR_LINE),
m_variant(variant),
@@ -141,27 +141,27 @@ mpcc_device::mpcc_device(const machine_config &mconfig, device_type type, const
}
mpcc_device::mpcc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : mpcc_device(mconfig, MPCC, "Rockwell MPCC", tag, owner, clock, TYPE_MPCC, "mpcc", __FILE__)
+ : mpcc_device(mconfig, MPCC, tag, owner, clock, TYPE_MPCC)
{
}
mpcc68560_device::mpcc68560_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : mpcc_device(mconfig, MPCC68560, "MPCC 68560", tag, owner, clock, TYPE_MPCC68560, "mpcc68560", __FILE__)
+ : mpcc_device(mconfig, MPCC68560, tag, owner, clock, TYPE_MPCC68560)
{
}
-mpcc68560A_device::mpcc68560A_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : mpcc_device(mconfig, MPCC68560A, "MPCC 68560A", tag, owner, clock, TYPE_MPCC68560A, "mpcc68560a", __FILE__)
+mpcc68560a_device::mpcc68560a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : mpcc_device(mconfig, MPCC68560A, tag, owner, clock, TYPE_MPCC68560A)
{
}
mpcc68561_device::mpcc68561_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : mpcc_device(mconfig, MPCC68561, "MPCC 68561", tag, owner, clock, TYPE_MPCC68561, "mpcc68561", __FILE__)
+ : mpcc_device(mconfig, MPCC68561, tag, owner, clock, TYPE_MPCC68561)
{
}
-mpcc68561A_device::mpcc68561A_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : mpcc_device(mconfig, MPCC68561A, "MPCC 68561A", tag, owner, clock, TYPE_MPCC68561A, "mpcc68561a", __FILE__)
+mpcc68561a_device::mpcc68561a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : mpcc_device(mconfig, MPCC68561A, tag, owner, clock, TYPE_MPCC68561A)
{
}
diff --git a/src/devices/machine/68561mpcc.h b/src/devices/machine/68561mpcc.h
index f9832be6c11..031d60bdef4 100644
--- a/src/devices/machine/68561mpcc.h
+++ b/src/devices/machine/68561mpcc.h
@@ -35,8 +35,8 @@
***************************************************************************/
-#ifndef MPCC68561_H
-#define MPCC68561_H
+#ifndef MAME_MACHINE_68561MPCC_H
+#define MAME_MACHINE_68561MPCC_H
/* Variant ADD macros - use the right one to enable the right feature set! */
@@ -89,21 +89,19 @@
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
-class mpcc_device : public device_t,
- public device_serial_interface
+class mpcc_device : public device_t, public device_serial_interface
{
public:
// construction/destruction
- mpcc_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, uint32_t variant, const char *shortname, const char *source);
mpcc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- template<class _Object> static devcb_base &set_out_txd_callback(device_t &device, _Object object) { return downcast<mpcc_device &>(device).m_out_txd_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_out_dtr_callback(device_t &device, _Object object) { return downcast<mpcc_device &>(device).m_out_dtr_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_out_rts_callback(device_t &device, _Object object) { return downcast<mpcc_device &>(device).m_out_rts_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_out_rtxc_callback(device_t &device, _Object object) { return downcast<mpcc_device &>(device).m_out_rtxc_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_out_trxc_callback(device_t &device, _Object object) { return downcast<mpcc_device &>(device).m_out_trxc_cb.set_callback(object); }
+ template <class Object> static devcb_base &set_out_txd_callback(device_t &device, Object &&cb) { return downcast<mpcc_device &>(device).m_out_txd_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_out_dtr_callback(device_t &device, Object &&cb) { return downcast<mpcc_device &>(device).m_out_dtr_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_out_rts_callback(device_t &device, Object &&cb) { return downcast<mpcc_device &>(device).m_out_rts_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_out_rtxc_callback(device_t &device, Object &&cb) { return downcast<mpcc_device &>(device).m_out_rtxc_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_out_trxc_callback(device_t &device, Object &&cb) { return downcast<mpcc_device &>(device).m_out_trxc_cb.set_callback(std::forward<Object>(cb)); }
- template<class _Object> static devcb_base &set_out_int_callback(device_t &device, _Object object) { return downcast<mpcc_device &>(device).m_out_int_cb.set_callback(object); }
+ template <class Object> static devcb_base &set_out_int_callback(device_t &device, Object &&cb) { return downcast<mpcc_device &>(device).m_out_int_cb.set_callback(std::forward<Object>(cb)); }
static void configure_clocks(device_t &device, int rxc, int txc)
{
@@ -127,6 +125,8 @@ public:
DECLARE_WRITE_LINE_MEMBER( txc_w ) {} // { m_chanA->txc_w(state); }
protected:
+ mpcc_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;
@@ -197,10 +197,9 @@ protected:
TYPE_MPCC68560A = 0x004,
TYPE_MPCC68561 = 0x008,
TYPE_MPCC68561A = 0x010,
+ SET_TYPE_A = TYPE_MPCC68560A | TYPE_MPCC68561A
};
-#define SET_TYPE_A ( mpcc_device::TYPE_MPCC68560A | mpcc_device::TYPE_MPCC68561A )
-
// State variables
uint32_t m_irq;
uint32_t m_variant;
@@ -454,16 +453,16 @@ protected:
};
+class mpcc68560_device : public mpcc_device { public: mpcc68560_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); };
+class mpcc68560a_device : public mpcc_device { public: mpcc68560a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); };
+class mpcc68561_device : public mpcc_device { public: mpcc68561_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); };
+class mpcc68561a_device : public mpcc_device { public: mpcc68561a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); };
+
// device type definition
-extern const device_type MPCC;
-extern const device_type MPCC68560;
-extern const device_type MPCC68560A;
-extern const device_type MPCC68561;
-extern const device_type MPCC68561A;
-
-class mpcc68560_device : public mpcc_device { public : mpcc68560_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); };
-class mpcc68560A_device : public mpcc_device { public : mpcc68560A_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); };
-class mpcc68561_device : public mpcc_device { public : mpcc68561_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); };
-class mpcc68561A_device : public mpcc_device { public : mpcc68561A_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); };
-
-#endif // MPCC68561_H
+DECLARE_DEVICE_TYPE(MPCC, mpcc_device)
+DECLARE_DEVICE_TYPE(MPCC68560, mpcc68560_device)
+DECLARE_DEVICE_TYPE(MPCC68560A, mpcc68560a_device)
+DECLARE_DEVICE_TYPE(MPCC68561, mpcc68561_device)
+DECLARE_DEVICE_TYPE(MPCC68561A, mpcc68561a_device)
+
+#endif // MAME_MACHINE_68561MPCC_H
diff --git a/src/devices/machine/7200fifo.cpp b/src/devices/machine/7200fifo.cpp
index ff2c9205f91..05ba0f686d4 100644
--- a/src/devices/machine/7200fifo.cpp
+++ b/src/devices/machine/7200fifo.cpp
@@ -14,14 +14,14 @@
#include "machine/7200fifo.h"
-const device_type FIFO7200 = device_creator<fifo7200_device>;
+DEFINE_DEVICE_TYPE(FIFO7200, fifo7200_device, "fifo7200", "IDT7200 FIFO")
//-------------------------------------------------
// fifo7200_device - constructor
//-------------------------------------------------
fifo7200_device::fifo7200_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, FIFO7200, "IDT7200 FIFO", tag, owner, clock, "fifo7200", __FILE__),
+ : device_t(mconfig, FIFO7200, tag, owner, clock),
m_ram_size(0), m_read_ptr(0), m_write_ptr(0), m_ef(0), m_ff(0), m_hf(0),
m_ef_handler(*this),
m_ff_handler(*this),
diff --git a/src/devices/machine/7200fifo.h b/src/devices/machine/7200fifo.h
index c1ebf2d36e5..b9d2a01009c 100644
--- a/src/devices/machine/7200fifo.h
+++ b/src/devices/machine/7200fifo.h
@@ -45,10 +45,10 @@ The following chips are functionally equivalent and pin-compatible.
**********************************************************************/
-#pragma once
+#ifndef MAME_MACHINE_7200FIFO_H
+#define MAME_MACHINE_7200FIFO_H
-#ifndef _7200FIFO_H
-#define _7200FIFO_H
+#pragma once
@@ -83,9 +83,9 @@ public:
fifo7200_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// static configuration helpers
- template<class _Object> static devcb_base &set_ef_handler(device_t &device, _Object object) { return downcast<fifo7200_device &>(device).m_ef_handler.set_callback(object); }
- template<class _Object> static devcb_base &set_ff_handler(device_t &device, _Object object) { return downcast<fifo7200_device &>(device).m_ff_handler.set_callback(object); }
- template<class _Object> static devcb_base &set_hf_handler(device_t &device, _Object object) { return downcast<fifo7200_device &>(device).m_hf_handler.set_callback(object); }
+ template <class Object> static devcb_base &set_ef_handler(device_t &device, Object &&cb) { return downcast<fifo7200_device &>(device).m_ef_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_ff_handler(device_t &device, Object &&cb) { return downcast<fifo7200_device &>(device).m_ff_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_hf_handler(device_t &device, Object &&cb) { return downcast<fifo7200_device &>(device).m_hf_handler.set_callback(std::forward<Object>(cb)); }
static void set_ram_size(device_t &device, int size) { downcast<fifo7200_device &>(device).m_ram_size = size; }
DECLARE_READ_LINE_MEMBER( ef_r ) { return !m_ef; } // _EF
@@ -125,7 +125,6 @@ private:
};
// device type definition
-extern const device_type FIFO7200;
-
+DECLARE_DEVICE_TYPE(FIFO7200, fifo7200_device)
-#endif /* _7200FIFO_H */
+#endif // MAME_MACHINE_7200FIFO_H
diff --git a/src/devices/machine/7400.cpp b/src/devices/machine/7400.cpp
index fa189e91a7d..595ce09ac32 100644
--- a/src/devices/machine/7400.cpp
+++ b/src/devices/machine/7400.cpp
@@ -9,10 +9,10 @@
#include "emu.h"
#include "7400.h"
-const device_type TTL7400 = device_creator<ttl7400_device>;
+DEFINE_DEVICE_TYPE(TTL7400, ttl7400_device, "7400", "7400 Quad 2-Input NAND Gate")
ttl7400_device::ttl7400_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, TTL7400, "7400 Quad 2-Input NAND Gate", tag, owner, clock, "7400", __FILE__)
+ : device_t(mconfig, TTL7400, tag, owner, clock)
, m_y1_func(*this)
, m_y2_func(*this)
, m_y3_func(*this)
diff --git a/src/devices/machine/7400.h b/src/devices/machine/7400.h
index 69ddaa2685a..a202a85d466 100644
--- a/src/devices/machine/7400.h
+++ b/src/devices/machine/7400.h
@@ -28,10 +28,10 @@
**********************************************************************/
-#pragma once
+#ifndef MAME_MACHINE_7400_H
+#define MAME_MACHINE_7400_H
-#ifndef TTL7400_H
-#define TTL7400_H
+#pragma once
#define MCFG_7400_Y1_CB(_devcb) \
@@ -56,10 +56,10 @@ public:
ttl7400_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// static configuration helpers
- template<class _Object> static devcb_base &set_y1_cb(device_t &device, _Object object) { return downcast<ttl7400_device &>(device).m_y1_func.set_callback(object); }
- template<class _Object> static devcb_base &set_y2_cb(device_t &device, _Object object) { return downcast<ttl7400_device &>(device).m_y2_func.set_callback(object); }
- template<class _Object> static devcb_base &set_y3_cb(device_t &device, _Object object) { return downcast<ttl7400_device &>(device).m_y3_func.set_callback(object); }
- template<class _Object> static devcb_base &set_y4_cb(device_t &device, _Object object) { return downcast<ttl7400_device &>(device).m_y4_func.set_callback(object); }
+ template <class Object> static devcb_base &set_y1_cb(device_t &device, Object &&cb) { return downcast<ttl7400_device &>(device).m_y1_func.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_y2_cb(device_t &device, Object &&cb) { return downcast<ttl7400_device &>(device).m_y2_func.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_y3_cb(device_t &device, Object &&cb) { return downcast<ttl7400_device &>(device).m_y3_func.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_y4_cb(device_t &device, Object &&cb) { return downcast<ttl7400_device &>(device).m_y4_func.set_callback(std::forward<Object>(cb)); }
// public interfaces
DECLARE_WRITE_LINE_MEMBER( a1_w );
@@ -104,7 +104,6 @@ private:
};
// device type definition
-extern const device_type TTL7400;
-
+DECLARE_DEVICE_TYPE(TTL7400, ttl7400_device)
-#endif /* TTL7400_H */
+#endif // MAME_MACHINE_7400_H
diff --git a/src/devices/machine/7404.cpp b/src/devices/machine/7404.cpp
index 09251088c87..1c056c4ccc0 100644
--- a/src/devices/machine/7404.cpp
+++ b/src/devices/machine/7404.cpp
@@ -9,10 +9,10 @@
#include "emu.h"
#include "7404.h"
-const device_type TTL7404 = device_creator<ttl7404_device>;
+DEFINE_DEVICE_TYPE(TTL7404, ttl7404_device, "7404", "5/7404 Hex Inverters")
ttl7404_device::ttl7404_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, TTL7404, "5/7404 Hex Inverters", tag, owner, clock, "7404", __FILE__)
+ : device_t(mconfig, TTL7404, tag, owner, clock)
, m_y1_func(*this)
, m_y2_func(*this)
, m_y3_func(*this)
diff --git a/src/devices/machine/7404.h b/src/devices/machine/7404.h
index f7192b802e9..b2be5e5182c 100644
--- a/src/devices/machine/7404.h
+++ b/src/devices/machine/7404.h
@@ -55,10 +55,10 @@
**********************************************************************/
-#pragma once
+#ifndef MAME_MACHINE_7404_H
+#define MAME_MACHINE_7404_H
-#ifndef TTL7404_H
-#define TTL7404_H
+#pragma once
#define MCFG_7404_Y1_CB(_devcb) \
@@ -89,12 +89,12 @@ public:
ttl7404_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// static configuration helpers
- template<class _Object> static devcb_base &set_y1_cb(device_t &device, _Object object) { return downcast<ttl7404_device &>(device).m_y1_func.set_callback(object); }
- template<class _Object> static devcb_base &set_y2_cb(device_t &device, _Object object) { return downcast<ttl7404_device &>(device).m_y2_func.set_callback(object); }
- template<class _Object> static devcb_base &set_y3_cb(device_t &device, _Object object) { return downcast<ttl7404_device &>(device).m_y3_func.set_callback(object); }
- template<class _Object> static devcb_base &set_y4_cb(device_t &device, _Object object) { return downcast<ttl7404_device &>(device).m_y4_func.set_callback(object); }
- template<class _Object> static devcb_base &set_y5_cb(device_t &device, _Object object) { return downcast<ttl7404_device &>(device).m_y5_func.set_callback(object); }
- template<class _Object> static devcb_base &set_y6_cb(device_t &device, _Object object) { return downcast<ttl7404_device &>(device).m_y6_func.set_callback(object); }
+ template <class Object> static devcb_base &set_y1_cb(device_t &device, Object &&cb) { return downcast<ttl7404_device &>(device).m_y1_func.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_y2_cb(device_t &device, Object &&cb) { return downcast<ttl7404_device &>(device).m_y2_func.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_y3_cb(device_t &device, Object &&cb) { return downcast<ttl7404_device &>(device).m_y3_func.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_y4_cb(device_t &device, Object &&cb) { return downcast<ttl7404_device &>(device).m_y4_func.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_y5_cb(device_t &device, Object &&cb) { return downcast<ttl7404_device &>(device).m_y5_func.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_y6_cb(device_t &device, Object &&cb) { return downcast<ttl7404_device &>(device).m_y6_func.set_callback(std::forward<Object>(cb)); }
// public interfaces
DECLARE_WRITE_LINE_MEMBER( a1_w );
@@ -139,7 +139,6 @@ private:
};
// device type definition
-extern const device_type TTL7404;
-
+DECLARE_DEVICE_TYPE(TTL7404, ttl7404_device)
-#endif /* TTL7404_H */
+#endif // MAME_MACHINE_7404_H
diff --git a/src/devices/machine/74123.cpp b/src/devices/machine/74123.cpp
index 7fde031e7aa..5efb34ec085 100644
--- a/src/devices/machine/74123.cpp
+++ b/src/devices/machine/74123.cpp
@@ -12,9 +12,8 @@
#include "machine/74123.h"
#include "machine/rescap.h"
-
-#define LOG (0)
-
+//#define VERBOSE 1
+#include "logmacro.h"
//**************************************************************************
@@ -22,14 +21,15 @@
//**************************************************************************
// device type definition
-const device_type TTL74123 = device_creator<ttl74123_device>;
+DEFINE_DEVICE_TYPE(TTL74123, ttl74123_device, "ttl74123", "74123 TTL")
//-------------------------------------------------
// ttl74123_device - constructor
//-------------------------------------------------
ttl74123_device::ttl74123_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, TTL74123, "74123 TTL", tag, owner, clock, "ttl74123", __FILE__), m_timer(nullptr),
+ : device_t(mconfig, TTL74123, tag, owner, clock),
+ m_timer(nullptr),
m_connection_type(TTL74123_NOT_GROUNDED_NO_DIODE),
m_res(1.0),
m_cap(1.0),
@@ -135,7 +135,7 @@ void ttl74123_device::set_output()
machine().scheduler().timer_set( attotime::zero, timer_expired_delegate(FUNC(ttl74123_device::output_callback ),this), output);
- if (LOG) logerror("74123 %s: Output: %d\n", tag(), output);
+ LOG("74123: Output: %d\n", output);
}
@@ -167,11 +167,11 @@ void ttl74123_device::start_pulse()
{
m_timer->adjust(duration);
- if (LOG) logerror("74123 %s: Retriggering pulse. Duration: %f\n", tag(), duration.as_double());
+ LOG("74123: Retriggering pulse. Duration: %f\n", duration.as_double());
}
else
{
- if (LOG) logerror("74123 %s: Retriggering failed.\n", tag());
+ LOG("74123: Retriggering failed.\n");
}
}
else
@@ -181,7 +181,7 @@ void ttl74123_device::start_pulse()
set_output();
- if (LOG) logerror("74123 %s: Starting pulse. Duration: %f\n", tag(), duration.as_double());
+ LOG("74123: Starting pulse. Duration: %f\n", duration.as_double());
}
}
@@ -233,7 +233,7 @@ WRITE8_MEMBER( ttl74123_device::clear_w)
{
m_timer->adjust(attotime::zero);
- if (LOG) logerror("74123 #%s: Cleared\n", tag() );
+ LOG("74123: Cleared\n");
}
m_clear = data;
}
diff --git a/src/devices/machine/74123.h b/src/devices/machine/74123.h
index 6019369e05a..0da73384cef 100644
--- a/src/devices/machine/74123.h
+++ b/src/devices/machine/74123.h
@@ -45,10 +45,10 @@
*****************************************************************************/
-#pragma once
+#ifndef MAME_MACHINE_74123_H
+#define MAME_MACHINE_74123_H
-#ifndef __TTL74123_H__
-#define __TTL74123_H__
+#pragma once
@@ -103,7 +103,7 @@ public:
static void set_a_pin_value(device_t &device, int value) { downcast<ttl74123_device &>(device).m_a = value; }
static void set_b_pin_value(device_t &device, int value) { downcast<ttl74123_device &>(device).m_b = value; }
static void set_clear_pin_value(device_t &device, int value) { downcast<ttl74123_device &>(device).m_clear = value; }
- template<class _Object> static devcb_base &set_output_changed_callback(device_t &device, _Object object) { return downcast<ttl74123_device &>(device).m_output_changed_cb.set_callback(object); }
+ template <class Object> static devcb_base &set_output_changed_callback(device_t &device, Object &&cb) { return downcast<ttl74123_device &>(device).m_output_changed_cb.set_callback(std::forward<Object>(cb)); }
DECLARE_WRITE8_MEMBER(a_w);
DECLARE_WRITE8_MEMBER(b_w);
@@ -121,7 +121,6 @@ protected:
TIMER_CALLBACK_MEMBER( clear_callback );
private:
-
int timer_running();
void start_pulse();
void set_output();
@@ -139,6 +138,6 @@ private:
// device type definition
-extern const device_type TTL74123;
+DECLARE_DEVICE_TYPE(TTL74123, ttl74123_device)
-#endif
+#endif // MAME_MACHINE_74123_H
diff --git a/src/devices/machine/74145.cpp b/src/devices/machine/74145.cpp
index 4f6b3e2a7be..e6fdd674f97 100644
--- a/src/devices/machine/74145.cpp
+++ b/src/devices/machine/74145.cpp
@@ -50,7 +50,7 @@
#include "coreutil.h"
-const device_type TTL74145 = device_creator<ttl74145_device>;
+DEFINE_DEVICE_TYPE(TTL74145, ttl74145_device, "ttl74145", "TTL74145")
/***************************************************************************
DEVICE INTERFACE
@@ -60,7 +60,7 @@ const device_type TTL74145 = device_creator<ttl74145_device>;
//-------------------------------------------------
ttl74145_device::ttl74145_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, TTL74145, "TTL74145", tag, owner, clock, "ttl74145", __FILE__)
+ : device_t(mconfig, TTL74145, tag, owner, clock)
, m_output_line_0_cb(*this)
, m_output_line_1_cb(*this)
, m_output_line_2_cb(*this)
diff --git a/src/devices/machine/74145.h b/src/devices/machine/74145.h
index 8f44de45bb1..d7747b66707 100644
--- a/src/devices/machine/74145.h
+++ b/src/devices/machine/74145.h
@@ -8,8 +8,11 @@
***************************************************************************/
-#ifndef __TTL74145_H__
-#define __TTL74145_H__
+#ifndef MAME_MACHINE_74145_H
+#define MAME_MACHINE_74145_H
+
+#pragma once
+
//**************************************************************************
// INTERFACE CONFIGURATION MACROS
@@ -56,19 +59,20 @@ public:
// construction/destruction
ttl74145_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- template<class _Object> static devcb_base &set_output_line_0_callback(device_t &device, _Object object) { return downcast<ttl74145_device &>(device).m_output_line_0_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_output_line_1_callback(device_t &device, _Object object) { return downcast<ttl74145_device &>(device).m_output_line_1_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_output_line_2_callback(device_t &device, _Object object) { return downcast<ttl74145_device &>(device).m_output_line_2_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_output_line_3_callback(device_t &device, _Object object) { return downcast<ttl74145_device &>(device).m_output_line_3_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_output_line_4_callback(device_t &device, _Object object) { return downcast<ttl74145_device &>(device).m_output_line_4_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_output_line_5_callback(device_t &device, _Object object) { return downcast<ttl74145_device &>(device).m_output_line_5_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_output_line_6_callback(device_t &device, _Object object) { return downcast<ttl74145_device &>(device).m_output_line_6_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_output_line_7_callback(device_t &device, _Object object) { return downcast<ttl74145_device &>(device).m_output_line_7_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_output_line_8_callback(device_t &device, _Object object) { return downcast<ttl74145_device &>(device).m_output_line_8_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_output_line_9_callback(device_t &device, _Object object) { return downcast<ttl74145_device &>(device).m_output_line_9_cb.set_callback(object); }
+ template <class Object> static devcb_base &set_output_line_0_callback(device_t &device, Object &&cb) { return downcast<ttl74145_device &>(device).m_output_line_0_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_output_line_1_callback(device_t &device, Object &&cb) { return downcast<ttl74145_device &>(device).m_output_line_1_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_output_line_2_callback(device_t &device, Object &&cb) { return downcast<ttl74145_device &>(device).m_output_line_2_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_output_line_3_callback(device_t &device, Object &&cb) { return downcast<ttl74145_device &>(device).m_output_line_3_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_output_line_4_callback(device_t &device, Object &&cb) { return downcast<ttl74145_device &>(device).m_output_line_4_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_output_line_5_callback(device_t &device, Object &&cb) { return downcast<ttl74145_device &>(device).m_output_line_5_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_output_line_6_callback(device_t &device, Object &&cb) { return downcast<ttl74145_device &>(device).m_output_line_6_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_output_line_7_callback(device_t &device, Object &&cb) { return downcast<ttl74145_device &>(device).m_output_line_7_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_output_line_8_callback(device_t &device, Object &&cb) { return downcast<ttl74145_device &>(device).m_output_line_8_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_output_line_9_callback(device_t &device, Object &&cb) { return downcast<ttl74145_device &>(device).m_output_line_9_cb.set_callback(std::forward<Object>(cb)); }
uint16_t read();
void write(uint8_t data);
+
protected:
// device-level overrides
virtual void device_start() override;
@@ -91,6 +95,6 @@ private:
};
// device type definition
-extern const device_type TTL74145;
+DECLARE_DEVICE_TYPE(TTL74145, ttl74145_device)
-#endif /* TTL74145 */
+#endif // MAME_MACHINE_74145_H
diff --git a/src/devices/machine/74148.cpp b/src/devices/machine/74148.cpp
index 79a74f16a40..1b8033bc297 100644
--- a/src/devices/machine/74148.cpp
+++ b/src/devices/machine/74148.cpp
@@ -44,17 +44,18 @@
#include "machine/74148.h"
-const device_type TTL74148 = device_creator<ttl74148_device>;
+DEFINE_DEVICE_TYPE(TTL74148, ttl74148_device, "74148", "74148 TTL")
+
ttl74148_device::ttl74148_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, TTL74148, "74148 TTL", tag, owner, clock, "74148", __FILE__),
- m_enable_input(0),
- m_output(0),
- m_output_valid(0),
- m_enable_output(0),
- m_last_output(0),
- m_last_output_valid(0),
- m_last_enable_output(0)
+ : device_t(mconfig, TTL74148, tag, owner, clock)
+ , m_enable_input(0)
+ , m_output(0)
+ , m_output_valid(0)
+ , m_enable_output(0)
+ , m_last_output(0)
+ , m_last_output_valid(0)
+ , m_last_enable_output(0)
{
for (auto & elem : m_input_lines)
elem = 0;
diff --git a/src/devices/machine/74148.h b/src/devices/machine/74148.h
index c7301e11588..a3f70b703a1 100644
--- a/src/devices/machine/74148.h
+++ b/src/devices/machine/74148.h
@@ -40,8 +40,10 @@
*****************************************************************************/
-#ifndef TTL74148_H
-#define TTL74148_H
+#ifndef MAME_DEVICES_MACHINE_74148_H
+#define MAME_DEVICES_MACHINE_74148_H
+
+#pragma once
typedef device_delegate<void (void)> ttl74148_output_delegate;
@@ -89,11 +91,11 @@ private:
int m_last_enable_output;
};
-extern const device_type TTL74148;
+DECLARE_DEVICE_TYPE(TTL74148, ttl74148_device)
#define MCFG_74148_OUTPUT_CB(_class, _method) \
ttl74148_device::set_output_callback(*device, ttl74148_output_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
-#endif
+#endif // MAME_DEVICES_MACHINE_74148_H
diff --git a/src/devices/machine/74153.cpp b/src/devices/machine/74153.cpp
index 143a5b07fea..427432fc9cc 100644
--- a/src/devices/machine/74153.cpp
+++ b/src/devices/machine/74153.cpp
@@ -7,15 +7,16 @@
***************************************************************************/
#include "emu.h"
-#include <algorithm>
#include "74153.h"
+#include <algorithm>
+
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
-const device_type TTL153 = device_creator<ttl153_device>;
+DEFINE_DEVICE_TYPE(TTL153, ttl153_device, "ttl153", "SN54/74153")
//**************************************************************************
@@ -27,7 +28,7 @@ const device_type TTL153 = device_creator<ttl153_device>;
//-------------------------------------------------
ttl153_device::ttl153_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, TTL153, "SN54/74153", tag, owner, clock, "ttl153", __FILE__),
+ device_t(mconfig, TTL153, tag, owner, clock),
m_za_cb(*this),
m_zb_cb(*this),
m_s{ false, false },
diff --git a/src/devices/machine/74153.h b/src/devices/machine/74153.h
index 63ed5abcf2e..508b4e2b158 100644
--- a/src/devices/machine/74153.h
+++ b/src/devices/machine/74153.h
@@ -18,11 +18,11 @@
***************************************************************************/
-#pragma once
-
#ifndef MAME_DEVICES_MACHINE_74153_H
#define MAME_DEVICES_MACHINE_74153_H
+#pragma once
+
//**************************************************************************
@@ -50,11 +50,11 @@ public:
ttl153_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// configuration
- template<class _Object> static devcb_base &set_za_callback(device_t &device, _Object object)
- { return downcast<ttl153_device &>(device).m_za_cb.set_callback(object); }
+ template <class Object> static devcb_base &set_za_callback(device_t &device, Object &&cb)
+ { return downcast<ttl153_device &>(device).m_za_cb.set_callback(std::forward<Object>(cb)); }
- template<class _Object> static devcb_base &set_zb_callback(device_t &device, _Object object)
- { return downcast<ttl153_device &>(device).m_zb_cb.set_callback(object); }
+ template <class Object> static devcb_base &set_zb_callback(device_t &device, Object &&cb)
+ { return downcast<ttl153_device &>(device).m_zb_cb.set_callback(std::forward<Object>(cb)); }
// select
DECLARE_WRITE_LINE_MEMBER(s0_w);
@@ -93,6 +93,6 @@ private:
};
// device type definition
-extern const device_type TTL153;
+DECLARE_DEVICE_TYPE(TTL153, ttl153_device)
#endif // MAME_DEVICES_MACHINE_74153_H
diff --git a/src/devices/machine/74157.cpp b/src/devices/machine/74157.cpp
index b68dc1472e6..7320c97ba91 100644
--- a/src/devices/machine/74157.cpp
+++ b/src/devices/machine/74157.cpp
@@ -20,19 +20,19 @@
// 74LS157 DEVICE
//**************************************************************************
-const device_type LS157 = device_creator<ls157_device>;
+DEFINE_DEVICE_TYPE(LS157, ls157_device, "74ls157", "74LS157 Quad 2-to-1 Multiplexer")
//-------------------------------------------------
// ls157_device - constructor
//-------------------------------------------------
ls157_device::ls157_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : ls157_device(mconfig, LS157, "74LS157 Quad 2-to-1 Multiplexer", tag, owner, clock, "74ls157", __FILE__)
+ : ls157_device(mconfig, LS157, tag, owner, clock)
{
}
-ls157_device::ls157_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, const char *shortname, const char *source)
- : device_t(mconfig, type, name, tag, owner, clock, shortname, source)
+ls157_device::ls157_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock)
+ : device_t(mconfig, type, tag, owner, clock)
, m_out_cb(*this)
{
m_a = 0;
@@ -211,9 +211,9 @@ void ls157_device::update_output()
// 74HCT157 DEVICE
//**************************************************************************
-const device_type HCT157 = device_creator<hct157_device>;
+DEFINE_DEVICE_TYPE(HCT157, hct157_device, "74hct157", "74HCT157 Quad 2-to-1 Multiplexer")
hct157_device::hct157_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : ls157_device(mconfig, HCT157, "74HCT157 Quad 2-to-1 Multiplexer", tag, owner, clock, "74hct157", __FILE__)
+ : ls157_device(mconfig, HCT157, tag, owner, clock)
{
}
diff --git a/src/devices/machine/74157.h b/src/devices/machine/74157.h
index d88ca452133..fa1150036f5 100644
--- a/src/devices/machine/74157.h
+++ b/src/devices/machine/74157.h
@@ -18,10 +18,10 @@
***************************************************************************/
-#pragma once
+#ifndef MAME_MACHINE_74157_H
+#define MAME_MACHINE_74157_H
-#ifndef DEVICES_MACHINE_74157_H
-#define DEVICES_MACHINE_74157_H
+#pragma once
@@ -44,10 +44,9 @@ class ls157_device : public device_t
public:
// construction/destruction
ls157_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
- ls157_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, const char *shortname, const char *source);
// static configuration
- template<class _Object> static devcb_base &set_out_callback(device_t &device, _Object object) { return downcast<ls157_device &>(device).m_out_cb.set_callback(object); }
+ template <class Object> static devcb_base &set_out_callback(device_t &device, Object &&cb) { return downcast<ls157_device &>(device).m_out_cb.set_callback(std::forward<Object>(cb)); }
// data writes
DECLARE_WRITE8_MEMBER(a_w);
@@ -66,6 +65,8 @@ public:
DECLARE_WRITE_LINE_MEMBER(strobe_w);
protected:
+ ls157_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
+
// device-level overrides
virtual void device_start() override;
@@ -96,8 +97,7 @@ public:
//**************************************************************************
// device type definition
-extern const device_type LS157;
-extern const device_type HCT157;
-
+DECLARE_DEVICE_TYPE(LS157, ls157_device)
+DECLARE_DEVICE_TYPE(HCT157, hct157_device)
-#endif
+#endif // MAME_MACHINE_74157_H
diff --git a/src/devices/machine/74161.cpp b/src/devices/machine/74161.cpp
index 2c81cdfcb1a..a866052d83d 100644
--- a/src/devices/machine/74161.cpp
+++ b/src/devices/machine/74161.cpp
@@ -9,13 +9,13 @@
#include "emu.h"
#include "74161.h"
-const device_type TTL74160 = device_creator<ttl74160_device>;
-const device_type TTL74161 = device_creator<ttl74161_device>;
-const device_type TTL74162 = device_creator<ttl74162_device>;
-const device_type TTL74163 = device_creator<ttl74163_device>;
+DEFINE_DEVICE_TYPE(TTL74160, ttl74160_device, "ttl74160", "54/74160 Decade Counter")
+DEFINE_DEVICE_TYPE(TTL74161, ttl74161_device, "ttl74161", "54/74161 Binary Counter")
+DEFINE_DEVICE_TYPE(TTL74162, ttl74162_device, "ttl74162", "54/74162 Decade Counter")
+DEFINE_DEVICE_TYPE(TTL74163, ttl74163_device, "ttl74163", "54/74163 Binary Counter")
-ttl7416x_device::ttl7416x_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, bool synchronous_reset, uint8_t limit)
- : device_t(mconfig, type, name, tag, owner, clock, shortname, __FILE__)
+ttl7416x_device::ttl7416x_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, bool synchronous_reset, uint8_t limit)
+ : device_t(mconfig, type, tag, owner, clock)
, m_qa_func(*this)
, m_qb_func(*this)
, m_qc_func(*this)
@@ -36,22 +36,22 @@ ttl7416x_device::ttl7416x_device(const machine_config &mconfig, device_type type
}
ttl74160_device::ttl74160_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : ttl7416x_device(mconfig, TTL74160, "54/74160 Decade Counter", tag, owner, clock, "ttl74160", false, 10)
+ : ttl7416x_device(mconfig, TTL74160, tag, owner, clock, false, 10)
{
}
ttl74161_device::ttl74161_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : ttl7416x_device(mconfig, TTL74160, "54/74160 Decade Counter", tag, owner, clock, "ttl74160", false, 16)
+ : ttl7416x_device(mconfig, TTL74161, tag, owner, clock, false, 16)
{
}
ttl74162_device::ttl74162_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : ttl7416x_device(mconfig, TTL74160, "54/74160 Decade Counter", tag, owner, clock, "ttl74160", true, 10)
+ : ttl7416x_device(mconfig, TTL74162, tag, owner, clock, true, 10)
{
}
ttl74163_device::ttl74163_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : ttl7416x_device(mconfig, TTL74160, "54/74160 Decade Counter", tag, owner, clock, "ttl74160", true, 16)
+ : ttl7416x_device(mconfig, TTL74163, tag, owner, clock, true, 16)
{
}
diff --git a/src/devices/machine/74161.h b/src/devices/machine/74161.h
index da975c09205..f73be684edc 100644
--- a/src/devices/machine/74161.h
+++ b/src/devices/machine/74161.h
@@ -52,10 +52,10 @@
**********************************************************************/
-#pragma once
+#ifndef MAME_MACHINE_74161_H
+#define MAME_MACHINE_74161_H
-#ifndef TTL74161_H
-#define TTL74161_H
+#pragma once
#define MCFG_7416x_QA_CB(_devcb) \
@@ -91,16 +91,13 @@
class ttl7416x_device : public device_t
{
public:
- // construction/destruction
- ttl7416x_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, bool synchronous_reset, uint8_t limit);
-
// static configuration helpers
- template<class _Object> static devcb_base &set_qa_cb(device_t &device, _Object object) { return downcast<ttl7416x_device &>(device).m_qa_func.set_callback(object); }
- template<class _Object> static devcb_base &set_qb_cb(device_t &device, _Object object) { return downcast<ttl7416x_device &>(device).m_qb_func.set_callback(object); }
- template<class _Object> static devcb_base &set_qc_cb(device_t &device, _Object object) { return downcast<ttl7416x_device &>(device).m_qc_func.set_callback(object); }
- template<class _Object> static devcb_base &set_qd_cb(device_t &device, _Object object) { return downcast<ttl7416x_device &>(device).m_qd_func.set_callback(object); }
- template<class _Object> static devcb_base &set_output_cb(device_t &device, _Object object) { return downcast<ttl7416x_device &>(device).m_output_func.set_callback(object); }
- template<class _Object> static devcb_base &set_tc_cb(device_t &device, _Object object) { return downcast<ttl7416x_device &>(device).m_tc_func.set_callback(object); }
+ template <class Object> static devcb_base &set_qa_cb(device_t &device, Object &&cb) { return downcast<ttl7416x_device &>(device).m_qa_func.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_qb_cb(device_t &device, Object &&cb) { return downcast<ttl7416x_device &>(device).m_qb_func.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_qc_cb(device_t &device, Object &&cb) { return downcast<ttl7416x_device &>(device).m_qc_func.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_qd_cb(device_t &device, Object &&cb) { return downcast<ttl7416x_device &>(device).m_qd_func.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_output_cb(device_t &device, Object &&cb) { return downcast<ttl7416x_device &>(device).m_output_func.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_tc_cb(device_t &device, Object &&cb) { return downcast<ttl7416x_device &>(device).m_tc_func.set_callback(std::forward<Object>(cb)); }
// public interfaces
DECLARE_WRITE_LINE_MEMBER( clear_w );
@@ -118,6 +115,9 @@ public:
DECLARE_READ_LINE_MEMBER( tc_r );
protected:
+ // construction/destruction
+ ttl7416x_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, bool synchronous_reset, uint8_t limit);
+
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
@@ -176,10 +176,9 @@ public:
};
// device type definition
-extern const device_type TTL74160;
-extern const device_type TTL74161;
-extern const device_type TTL74162;
-extern const device_type TTL74163;
-
+DECLARE_DEVICE_TYPE(TTL74160, ttl74160_device)
+DECLARE_DEVICE_TYPE(TTL74161, ttl74161_device)
+DECLARE_DEVICE_TYPE(TTL74162, ttl74162_device)
+DECLARE_DEVICE_TYPE(TTL74163, ttl74163_device)
-#endif /* TTL74161_H */
+#endif // MAME_MACHINE_74161_H
diff --git a/src/devices/machine/74175.cpp b/src/devices/machine/74175.cpp
index 7c8135f4450..28d3152dbeb 100644
--- a/src/devices/machine/74175.cpp
+++ b/src/devices/machine/74175.cpp
@@ -9,11 +9,11 @@
#include "emu.h"
#include "74175.h"
-const device_type TTL74174 = device_creator<ttl74174_device>;
-const device_type TTL74175 = device_creator<ttl74175_device>;
+DEFINE_DEVICE_TYPE(TTL74174, ttl74174_device, "ttl74174", "54/74174 Hex D Flip-Flops with Clear")
+DEFINE_DEVICE_TYPE(TTL74175, ttl74175_device, "ttl74175", "54/74175 Quad D Flip-Flops with Clear")
-ttl741745_device::ttl741745_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname)
- : device_t(mconfig, type, name, tag, owner, clock, shortname, __FILE__)
+ttl741745_device::ttl741745_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_q1_func(*this)
, m_q2_func(*this)
, m_q3_func(*this)
@@ -32,7 +32,7 @@ ttl741745_device::ttl741745_device(const machine_config &mconfig, device_type ty
}
ttl74174_device::ttl74174_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : ttl741745_device(mconfig, TTL74174, "54/74174 Hex D Flip-Flops with Clear", tag, owner, clock, "ttl74174")
+ : ttl741745_device(mconfig, TTL74174, tag, owner, clock)
, m_q5_func(*this)
, m_q6_func(*this)
, m_d5(0)
@@ -43,7 +43,7 @@ ttl74174_device::ttl74174_device(const machine_config &mconfig, const char *tag,
}
ttl74175_device::ttl74175_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : ttl741745_device(mconfig, TTL74175, "54/74175 Quad D Flip-Flops with Clear", tag, owner, clock, "ttl74175")
+ : ttl741745_device(mconfig, TTL74175, tag, owner, clock)
, m_not_q1_func(*this)
, m_not_q2_func(*this)
, m_not_q3_func(*this)
diff --git a/src/devices/machine/74175.h b/src/devices/machine/74175.h
index c22aa05747f..a5f019c3298 100644
--- a/src/devices/machine/74175.h
+++ b/src/devices/machine/74175.h
@@ -42,10 +42,10 @@
**********************************************************************/
-#pragma once
+#ifndef MAME_MACHINE_74175_H
+#define MAME_MACHINE_74175_H
-#ifndef TTL74175_H
-#define TTL74175_H
+#pragma once
#define MCFG_74174_Q1_CB(_devcb) \
@@ -99,12 +99,10 @@
class ttl741745_device : public device_t
{
public:
- ttl741745_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname);
-
- template<class _Object> static devcb_base &set_q1_cb(device_t &device, _Object object) { return downcast<ttl741745_device &>(device).m_q1_func.set_callback(object); }
- template<class _Object> static devcb_base &set_q2_cb(device_t &device, _Object object) { return downcast<ttl741745_device &>(device).m_q2_func.set_callback(object); }
- template<class _Object> static devcb_base &set_q3_cb(device_t &device, _Object object) { return downcast<ttl741745_device &>(device).m_q3_func.set_callback(object); }
- template<class _Object> static devcb_base &set_q4_cb(device_t &device, _Object object) { return downcast<ttl741745_device &>(device).m_q4_func.set_callback(object); }
+ template <class Object> static devcb_base &set_q1_cb(device_t &device, Object &&cb) { return downcast<ttl741745_device &>(device).m_q1_func.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_q2_cb(device_t &device, Object &&cb) { return downcast<ttl741745_device &>(device).m_q2_func.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_q3_cb(device_t &device, Object &&cb) { return downcast<ttl741745_device &>(device).m_q3_func.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_q4_cb(device_t &device, Object &&cb) { return downcast<ttl741745_device &>(device).m_q4_func.set_callback(std::forward<Object>(cb)); }
DECLARE_WRITE_LINE_MEMBER( clear_w );
DECLARE_WRITE_LINE_MEMBER( d1_w );
@@ -116,6 +114,8 @@ public:
uint8_t q_w();
protected:
+ ttl741745_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;
@@ -146,8 +146,8 @@ class ttl74174_device : public ttl741745_device
public:
ttl74174_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- template<class _Object> static devcb_base &set_q5_cb(device_t &device, _Object object) { return downcast<ttl74174_device &>(device).m_q5_func.set_callback(object); }
- template<class _Object> static devcb_base &set_q6_cb(device_t &device, _Object object) { return downcast<ttl74174_device &>(device).m_q6_func.set_callback(object); }
+ template <class Object> static devcb_base &set_q5_cb(device_t &device, Object &&cb) { return downcast<ttl74174_device &>(device).m_q5_func.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_q6_cb(device_t &device, Object &&cb) { return downcast<ttl74174_device &>(device).m_q6_func.set_callback(std::forward<Object>(cb)); }
DECLARE_WRITE_LINE_MEMBER( d5_w );
DECLARE_WRITE_LINE_MEMBER( d6_w );
@@ -174,10 +174,10 @@ class ttl74175_device : public ttl741745_device
public:
ttl74175_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- template<class _Object> static devcb_base &set_not_q1_cb(device_t &device, _Object object) { return downcast<ttl74175_device &>(device).m_not_q1_func.set_callback(object); }
- template<class _Object> static devcb_base &set_not_q2_cb(device_t &device, _Object object) { return downcast<ttl74175_device &>(device).m_not_q2_func.set_callback(object); }
- template<class _Object> static devcb_base &set_not_q3_cb(device_t &device, _Object object) { return downcast<ttl74175_device &>(device).m_not_q3_func.set_callback(object); }
- template<class _Object> static devcb_base &set_not_q4_cb(device_t &device, _Object object) { return downcast<ttl74175_device &>(device).m_not_q4_func.set_callback(object); }
+ template <class Object> static devcb_base &set_not_q1_cb(device_t &device, Object &&cb) { return downcast<ttl74175_device &>(device).m_not_q1_func.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_not_q2_cb(device_t &device, Object &&cb) { return downcast<ttl74175_device &>(device).m_not_q2_func.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_not_q3_cb(device_t &device, Object &&cb) { return downcast<ttl74175_device &>(device).m_not_q3_func.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_not_q4_cb(device_t &device, Object &&cb) { return downcast<ttl74175_device &>(device).m_not_q4_func.set_callback(std::forward<Object>(cb)); }
protected:
virtual void device_start() override;
@@ -197,8 +197,7 @@ private:
};
// device type definition
-extern const device_type TTL74174;
-extern const device_type TTL74175;
-
+DECLARE_DEVICE_TYPE(TTL74174, ttl74174_device)
+DECLARE_DEVICE_TYPE(TTL74175, ttl74175_device)
-#endif /* TTL74175_H */
+#endif // MAME_MACHINE_74175_H
diff --git a/src/devices/machine/74181.cpp b/src/devices/machine/74181.cpp
index bcd2b8db332..66901510b32 100644
--- a/src/devices/machine/74181.cpp
+++ b/src/devices/machine/74181.cpp
@@ -16,7 +16,7 @@
// DEVICE DEFINITIONS
//**************************************************************************
-const device_type TTL74181 = device_creator<ttl74181_device>;
+DEFINE_DEVICE_TYPE(TTL74181, ttl74181_device, "ttl74181", "74181 TTL")
//**************************************************************************
@@ -28,7 +28,7 @@ const device_type TTL74181 = device_creator<ttl74181_device>;
//-------------------------------------------------
ttl74181_device::ttl74181_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, TTL74181, "74181 TTL", tag, owner, clock, "ttl74181", __FILE__),
+ device_t(mconfig, TTL74181, tag, owner, clock),
m_a(0),
m_b(0),
m_s(0),
diff --git a/src/devices/machine/74181.h b/src/devices/machine/74181.h
index b6aed4bb0c2..67ba714eacf 100644
--- a/src/devices/machine/74181.h
+++ b/src/devices/machine/74181.h
@@ -8,10 +8,10 @@
***************************************************************************/
-#pragma once
+#ifndef MAME_MACHINE_74181_H
+#define MAME_MACHINE_74181_H
-#ifndef __74181_H__
-#define __74181_H__
+#pragma once
@@ -73,7 +73,6 @@ private:
// device type definition
-extern const device_type TTL74181;
-
+DECLARE_DEVICE_TYPE(TTL74181, ttl74181_device)
-#endif /* __74181_H__ */
+#endif // MAME_MACHINE_74181_H
diff --git a/src/devices/machine/7474.cpp b/src/devices/machine/7474.cpp
index 69178d9f57c..ea2f315c72f 100644
--- a/src/devices/machine/7474.cpp
+++ b/src/devices/machine/7474.cpp
@@ -49,14 +49,14 @@
//**************************************************************************
// device type definition
-const device_type TTL7474 = device_creator<ttl7474_device>;
+DEFINE_DEVICE_TYPE(TTL7474, ttl7474_device, "7474", "7474 TTL")
//-------------------------------------------------
// ttl7474_device - constructor
//-------------------------------------------------
ttl7474_device::ttl7474_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, TTL7474, "7474 TTL", tag, owner, clock, "7474", __FILE__),
+ : device_t(mconfig, TTL7474, tag, owner, clock),
m_output_func(*this),
m_comp_output_func(*this)
{
diff --git a/src/devices/machine/7474.h b/src/devices/machine/7474.h
index a58fc46c854..3b0b604958d 100644
--- a/src/devices/machine/7474.h
+++ b/src/devices/machine/7474.h
@@ -39,10 +39,10 @@
*****************************************************************************/
-#pragma once
+#ifndef MAME_MACHINE_TTL7474_H
+#define MAME_MACHINE_TTL7474_H
-#ifndef __TTL7474_H__
-#define __TTL7474_H__
+#pragma once
@@ -71,8 +71,8 @@ public:
ttl7474_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// static configuration helpers
- template<class _Object> static devcb_base &set_output_cb(device_t &device, _Object object) { return downcast<ttl7474_device &>(device).m_output_func.set_callback(object); }
- template<class _Object> static devcb_base &set_comp_output_cb(device_t &device, _Object object) { return downcast<ttl7474_device &>(device).m_comp_output_func.set_callback(object); }
+ template <class Object> static devcb_base &set_output_cb(device_t &device, Object &&cb) { return downcast<ttl7474_device &>(device).m_output_func.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_comp_output_cb(device_t &device, Object &&cb) { return downcast<ttl7474_device &>(device).m_comp_output_func.set_callback(std::forward<Object>(cb)); }
// public interfaces
DECLARE_WRITE_LINE_MEMBER( clear_w );
@@ -88,6 +88,7 @@ protected:
virtual void device_reset() override;
virtual void device_post_load() override { }
virtual void device_clock_changed() override { }
+
private:
// callbacks
devcb_write_line m_output_func;
@@ -114,7 +115,6 @@ private:
// device type definition
-extern const device_type TTL7474;
-
+DECLARE_DEVICE_TYPE(TTL7474, ttl7474_device)
-#endif /* __TTL7474_H__ */
+#endif // MAME_MACHINE_TTL7474_H
diff --git a/src/devices/machine/8042kbdc.cpp b/src/devices/machine/8042kbdc.cpp
index 8c7d4b70dcd..98b1161b902 100644
--- a/src/devices/machine/8042kbdc.cpp
+++ b/src/devices/machine/8042kbdc.cpp
@@ -191,14 +191,14 @@
#define LOG_KEYBOARD 0
#define LOG_ACCESSES 0
-const device_type KBDC8042 = device_creator<kbdc8042_device>;
+DEFINE_DEVICE_TYPE(KBDC8042, kbdc8042_device, "kbdc8042", "8042 Keyboard Controller")
//-------------------------------------------------
// kbdc8042_device - constructor
//-------------------------------------------------
kbdc8042_device::kbdc8042_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, KBDC8042, "8042 Keyboard Controller", tag, owner, clock, "kbdc8042", __FILE__)
+ : device_t(mconfig, KBDC8042, tag, owner, clock)
, m_keyboard_dev(*this, "at_keyboard")
, m_system_reset_cb(*this)
, m_gate_a20_cb(*this)
diff --git a/src/devices/machine/8042kbdc.h b/src/devices/machine/8042kbdc.h
index 491672dd3e7..52bad435551 100644
--- a/src/devices/machine/8042kbdc.h
+++ b/src/devices/machine/8042kbdc.h
@@ -9,24 +9,19 @@
**********************************************************************/
-#ifndef KBDC8042_H
-#define KBDC8042_H
+#ifndef MAME_MACHINE_8042KBDC_H
+#define MAME_MACHINE_8042KBDC_H
-#include "machine/pckeybrd.h"
+#pragma once
-enum kbdc8042_type_t
-{
- KBDC8042_STANDARD,
- KBDC8042_PS2, /* another timing of integrated controller */
- KBDC8042_AT386 /* hack for at386 driver */
-};
+#include "machine/pckeybrd.h"
//**************************************************************************
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
#define MCFG_KBDC8042_KEYBOARD_TYPE(_kbdt) \
- kbdc8042_device::set_keyboard_type(*device, _kbdt);
+ kbdc8042_device::set_keyboard_type(*device, kbdc8042_device::_kbdt);
#define MCFG_KBDC8042_SYSTEM_RESET_CB(_devcb) \
devcb = &kbdc8042_device::set_system_reset_callback(*device, DEVCB_##_devcb);
@@ -52,17 +47,24 @@ enum kbdc8042_type_t
class kbdc8042_device : public device_t
{
public:
+ enum kbdc8042_type_t
+ {
+ KBDC8042_STANDARD,
+ KBDC8042_PS2, /* another timing of integrated controller */
+ KBDC8042_AT386 /* hack for at386 driver */
+ };
+
// construction/destruction
kbdc8042_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual machine_config_constructor device_mconfig_additions() const override;
static void set_keyboard_type(device_t &device, kbdc8042_type_t keybtype) { downcast<kbdc8042_device &>(device).m_keybtype = keybtype; }
- template<class _Object> static devcb_base &set_system_reset_callback(device_t &device, _Object object) { return downcast<kbdc8042_device &>(device).m_system_reset_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_gate_a20_callback(device_t &device, _Object object) { return downcast<kbdc8042_device &>(device).m_gate_a20_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_input_buffer_full_callback(device_t &device, _Object object) { return downcast<kbdc8042_device &>(device).m_input_buffer_full_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_output_buffer_empty_callback(device_t &device, _Object object) { return downcast<kbdc8042_device &>(device).m_output_buffer_empty_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_speaker_callback(device_t &device, _Object object) { return downcast<kbdc8042_device &>(device).m_speaker_cb.set_callback(object); }
+ template <class Object> static devcb_base &set_system_reset_callback(device_t &device, Object &&cb) { return downcast<kbdc8042_device &>(device).m_system_reset_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_gate_a20_callback(device_t &device, Object &&cb) { return downcast<kbdc8042_device &>(device).m_gate_a20_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_input_buffer_full_callback(device_t &device, Object &&cb) { return downcast<kbdc8042_device &>(device).m_input_buffer_full_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_output_buffer_empty_callback(device_t &device, Object &&cb) { return downcast<kbdc8042_device &>(device).m_output_buffer_empty_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_speaker_callback(device_t &device, Object &&cb) { return downcast<kbdc8042_device &>(device).m_speaker_cb.set_callback(std::forward<Object>(cb)); }
DECLARE_READ8_MEMBER( data_r );
DECLARE_WRITE8_MEMBER( data_w );
@@ -120,6 +122,6 @@ protected:
// device type definition
extern const device_type KBDC8042;
+DECLARE_DEVICE_TYPE(KBDC8042, kbdc8042_device)
-
-#endif /* KBDC8042_H */
+#endif // MAME_MACHINE_8042KBDC_H
diff --git a/src/devices/machine/82s129.cpp b/src/devices/machine/82s129.cpp
index b705bd6e29e..afa31ad1fda 100644
--- a/src/devices/machine/82s129.cpp
+++ b/src/devices/machine/82s129.cpp
@@ -11,11 +11,11 @@
const uint32_t prom82s129_base_device::PROM_SIZE = 256;
-const device_type PROM82S126 = device_creator<prom82s126_device>;
-const device_type PROM82S129 = device_creator<prom82s129_device>;
+DEFINE_DEVICE_TYPE(PROM82S126, prom82s126_device, "82s126", "82S126 1K-bit bipolar PROM")
+DEFINE_DEVICE_TYPE(PROM82S129, prom82s129_device, "82s129", "82S129 1K-bit bipolar PROM")
-prom82s129_base_device::prom82s129_base_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname)
- : device_t(mconfig, type, name, tag, owner, clock, shortname, __FILE__)
+prom82s129_base_device::prom82s129_base_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_region(*this, DEVICE_SELF)
, m_out_func(*this)
, m_o1_func(*this)
@@ -30,12 +30,12 @@ prom82s129_base_device::prom82s129_base_device(const machine_config &mconfig, de
}
prom82s126_device::prom82s126_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : prom82s129_base_device(mconfig, PROM82S126, "82S126 1K-bit TTL bipolar PROM", tag, owner, clock, "82s126")
+ : prom82s129_base_device(mconfig, PROM82S126, tag, owner, clock)
{
}
prom82s129_device::prom82s129_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : prom82s129_base_device(mconfig, PROM82S126, "82S129 1K-bit TTL bipolar PROM", tag, owner, clock, "82s129")
+ : prom82s129_base_device(mconfig, PROM82S129, tag, owner, clock)
{
}
diff --git a/src/devices/machine/82s129.h b/src/devices/machine/82s129.h
index 604645b9c2d..568a3a5b0d4 100644
--- a/src/devices/machine/82s129.h
+++ b/src/devices/machine/82s129.h
@@ -40,10 +40,10 @@
**********************************************************************/
-#pragma once
+#ifndef MAME_MACHINE_82S129_H
+#define MAME_MACHINE_82S129_H
-#ifndef PROM82S129_H
-#define PROM82S129_H
+#pragma once
#define MCFG_82S126_OUTPUT_CB(_devcb) \
@@ -85,15 +85,12 @@
class prom82s129_base_device : public device_t
{
public:
- // construction/destruction
- prom82s129_base_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname);
-
// static configuration helpers
- template<class _Object> static devcb_base &set_out_cb(device_t &device, _Object object) { return downcast<prom82s129_base_device &>(device).m_out_func.set_callback(object); }
- template<class _Object> static devcb_base &set_o1_cb(device_t &device, _Object object) { return downcast<prom82s129_base_device &>(device).m_o1_func.set_callback(object); }
- template<class _Object> static devcb_base &set_o2_cb(device_t &device, _Object object) { return downcast<prom82s129_base_device &>(device).m_o2_func.set_callback(object); }
- template<class _Object> static devcb_base &set_o3_cb(device_t &device, _Object object) { return downcast<prom82s129_base_device &>(device).m_o3_func.set_callback(object); }
- template<class _Object> static devcb_base &set_o4_cb(device_t &device, _Object object) { return downcast<prom82s129_base_device &>(device).m_o4_func.set_callback(object); }
+ template <class Object> static devcb_base &set_out_cb(device_t &device, Object &&cb) { return downcast<prom82s129_base_device &>(device).m_out_func.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_o1_cb(device_t &device, Object &&cb) { return downcast<prom82s129_base_device &>(device).m_o1_func.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_o2_cb(device_t &device, Object &&cb) { return downcast<prom82s129_base_device &>(device).m_o2_func.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_o3_cb(device_t &device, Object &&cb) { return downcast<prom82s129_base_device &>(device).m_o3_func.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_o4_cb(device_t &device, Object &&cb) { return downcast<prom82s129_base_device &>(device).m_o4_func.set_callback(std::forward<Object>(cb)); }
DECLARE_WRITE_LINE_MEMBER( ce1_w );
DECLARE_WRITE_LINE_MEMBER( ce2_w );
@@ -117,6 +114,9 @@ public:
uint8_t get_output() const { return m_out; }
protected:
+ // construction/destruction
+ prom82s129_base_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;
@@ -164,5 +164,7 @@ public:
// device type definition
extern const device_type PROM82S126;
extern const device_type PROM82S129;
+DECLARE_DEVICE_TYPE(PROM82S126, prom82s126_device)
+DECLARE_DEVICE_TYPE(PROM82S129, prom82s129_device)
-#endif /* PROM82S129_H */
+#endif // MAME_MACHINE_82S129_H
diff --git a/src/devices/machine/8364_paula.cpp b/src/devices/machine/8364_paula.cpp
index da535b75627..594b95e96f0 100644
--- a/src/devices/machine/8364_paula.cpp
+++ b/src/devices/machine/8364_paula.cpp
@@ -9,20 +9,15 @@
#include "emu.h"
#include "8364_paula.h"
-
-//**************************************************************************
-// CONSTANTS / MACROS
-//**************************************************************************
-
-#define VERBOSE 0
-#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
+//#define VERBOSE 1
+#include "logmacro.h"
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
-const device_type PAULA_8364 = device_creator<paula_8364_device>;
+DEFINE_DEVICE_TYPE(PAULA_8364, paula_8364_device, "paula_8364", "8364 Paula")
//*************************************************************************
@@ -34,7 +29,7 @@ const device_type PAULA_8364 = device_creator<paula_8364_device>;
//-------------------------------------------------
paula_8364_device::paula_8364_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, PAULA_8364, "8364 Paula", tag, owner, clock, "paula_8364", __FILE__),
+ : device_t(mconfig, PAULA_8364, tag, owner, clock),
device_sound_interface(mconfig, *this),
m_mem_r(*this), m_int_w(*this),
m_dmacon(0), m_adkcon(0),
@@ -160,7 +155,7 @@ void paula_8364_device::dma_reload(audio_channel *chan)
chan->curlength = chan->len;
chan->irq_timer->adjust(attotime::from_hz(15750), chan->index); // clock() / 227
- LOG(("dma_reload(%d): offs=%05X len=%04X\n", chan->index, chan->curlocation, chan->curlength));
+ LOG("dma_reload(%d): offs=%05X len=%04X\n", chan->index, chan->curlocation, chan->curlength);
}
//-------------------------------------------------
diff --git a/src/devices/machine/8364_paula.h b/src/devices/machine/8364_paula.h
index 4dbd041c93f..8e20b6f813a 100644
--- a/src/devices/machine/8364_paula.h
+++ b/src/devices/machine/8364_paula.h
@@ -37,10 +37,10 @@
***************************************************************************/
-#pragma once
+#ifndef MAME_MACHINE_8364_PAULA_H
+#define MAME_MACHINE_8364_PAULA_H
-#ifndef MAME_DEVICES_MACHINE_8364_PAULA_H
-#define MAME_DEVICES_MACHINE_8364_PAULA_H
+#pragma once
@@ -65,14 +65,13 @@ class paula_8364_device : public device_t, public device_sound_interface
{
public:
paula_8364_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- ~paula_8364_device() {}
// configuration
- template<class _Object> static devcb_base &set_mem_r_callback(device_t &device, _Object object)
- { return downcast<paula_8364_device &>(device).m_mem_r.set_callback(object); }
+ template <class Object> static devcb_base &set_mem_r_callback(device_t &device, Object &&cb)
+ { return downcast<paula_8364_device &>(device).m_mem_r.set_callback(std::forward<Object>(cb)); }
- template<class _Object> static devcb_base &set_int_w_callback(device_t &device, _Object object)
- { return downcast<paula_8364_device &>(device).m_int_w.set_callback(object); }
+ template <class Object> static devcb_base &set_int_w_callback(device_t &device, Object &&cb)
+ { return downcast<paula_8364_device &>(device).m_int_w.set_callback(std::forward<Object>(cb)); }
DECLARE_READ16_MEMBER(reg_r);
DECLARE_WRITE16_MEMBER(reg_w);
@@ -128,7 +127,7 @@ private:
REG_AUD3DAT = 0xda/2
};
- static const int CLOCK_DIVIDER = 16;
+ static constexpr int CLOCK_DIVIDER = 16;
struct audio_channel
{
@@ -166,6 +165,6 @@ private:
};
// device type definition
-extern const device_type PAULA_8364;
+DECLARE_DEVICE_TYPE(PAULA_8364, paula_8364_device)
#endif // MAME_DEVICES_MACHINE_8364_PAULA_H
diff --git a/src/devices/machine/8530scc.cpp b/src/devices/machine/8530scc.cpp
index 7e042049e7c..465fd609fc7 100644
--- a/src/devices/machine/8530scc.cpp
+++ b/src/devices/machine/8530scc.cpp
@@ -12,7 +12,7 @@
#include "emu.h"
#include "8530scc.h"
-const device_type SCC8530 = device_creator<scc8530_t>;
+DEFINE_DEVICE_TYPE(SCC8530, scc8530_t, "scc8530l", "Zilog 8530 SCC (legacy)")
/***************************************************************************
@@ -26,7 +26,8 @@ const device_type SCC8530 = device_creator<scc8530_t>;
***************************************************************************/
scc8530_t::scc8530_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, SCC8530, "Zilog 8530 SCC (Legacy)", tag, owner, clock, "scc8530l", __FILE__), mode(0), reg(0), status(0), IRQV(0), MasterIRQEnable(0), lastIRQStat(0), IRQType(),
+ device_t(mconfig, SCC8530, tag, owner, clock),
+ mode(0), reg(0), status(0), IRQV(0), MasterIRQEnable(0), lastIRQStat(0), IRQType(),
intrq_cb(*this)
{
}
diff --git a/src/devices/machine/8530scc.h b/src/devices/machine/8530scc.h
index a13f102d1ac..7a8a5cf107e 100644
--- a/src/devices/machine/8530scc.h
+++ b/src/devices/machine/8530scc.h
@@ -8,8 +8,8 @@
*********************************************************************/
-#ifndef __8530SCC_H__
-#define __8530SCC_H__
+#ifndef MAME_MACHINE_8530SCC_H
+#define MAME_MACHINE_8530SCC_H
#define MCFG_Z8530_INTRQ_CALLBACK(_write) \
devcb = &scc8530_t::set_intrq_wr_callback(*device, DEVCB_##_write);
@@ -31,7 +31,7 @@ public:
scc8530_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- template<class _Object> static devcb_base &set_intrq_wr_callback(device_t &device, _Object object) { return downcast<scc8530_t &>(device).intrq_cb.set_callback(object); }
+ template <class Object> static devcb_base &set_intrq_wr_callback(device_t &device, Object &&cb) { return downcast<scc8530_t &>(device).intrq_cb.set_callback(std::forward<Object>(cb)); }
uint8_t get_reg_a(int reg);
uint8_t get_reg_b(int reg);
@@ -101,6 +101,6 @@ private:
MACROS
***************************************************************************/
-extern const device_type SCC8530;
+DECLARE_DEVICE_TYPE(SCC8530, scc8530_t)
-#endif /* __8530SCC_H__ */
+#endif // MAME_MACHINE_8530SCC_H
diff --git a/src/devices/machine/aakart.cpp b/src/devices/machine/aakart.cpp
index 6608ba32a3c..09924675a9d 100644
--- a/src/devices/machine/aakart.cpp
+++ b/src/devices/machine/aakart.cpp
@@ -19,7 +19,7 @@ TODO:
//**************************************************************************
// device type definition
-const device_type AAKART = device_creator<aakart_device>;
+DEFINE_DEVICE_TYPE(AAKART, aakart_device, "aakart", "Acorn Archimedes KART")
#define HRST 0xff
#define RAK1 0xfe
@@ -40,9 +40,11 @@ const device_type AAKART = device_creator<aakart_device>;
//-------------------------------------------------
aakart_device::aakart_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, AAKART, "AAKART", tag, owner, clock, "aakart", __FILE__), m_rxtimer(nullptr), m_txtimer(nullptr), m_mousetimer(nullptr), m_keybtimer(nullptr),
+ : device_t(mconfig, AAKART, tag, owner, clock), m_rxtimer(nullptr),
+ m_txtimer(nullptr), m_mousetimer(nullptr), m_keybtimer(nullptr),
m_out_tx_cb(*this),
- m_out_rx_cb(*this), m_tx_latch(0), m_rx(0), m_new_command(0), m_status(0), m_mouse_enable(0), m_keyb_enable(0)
+ m_out_rx_cb(*this),
+ m_tx_latch(0), m_rx(0), m_new_command(0), m_status(0), m_mouse_enable(0), m_keyb_enable(0)
{
}
diff --git a/src/devices/machine/aakart.h b/src/devices/machine/aakart.h
index 43972200b21..7d5ba02eecf 100644
--- a/src/devices/machine/aakart.h
+++ b/src/devices/machine/aakart.h
@@ -6,10 +6,10 @@ Acorn Archimedes KART interface
***************************************************************************/
-#pragma once
+#ifndef MAME_MACHINE_AAKART_H
+#define MAME_MACHINE_AAKART_H
-#ifndef __AAKARTDEV_H__
-#define __AAKARTDEV_H__
+#pragma once
@@ -24,15 +24,6 @@ Acorn Archimedes KART interface
devcb = &aakart_device::set_out_rx_callback(*device, DEVCB_##_devcb);
-enum{
- STATUS_NORMAL = 0,
- STATUS_KEYUP,
- STATUS_KEYDOWN,
- STATUS_MOUSE,
- STATUS_HRST,
- STATUS_UNDEFINED
-};
-
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -45,8 +36,8 @@ public:
// construction/destruction
aakart_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- template<class _Object> static devcb_base &set_out_tx_callback(device_t &device, _Object object) { return downcast<aakart_device &>(device).m_out_tx_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_out_rx_callback(device_t &device, _Object object) { return downcast<aakart_device &>(device).m_out_rx_cb.set_callback(object); }
+ template <class Object> static devcb_base &set_out_tx_callback(device_t &device, Object &&cb) { return downcast<aakart_device &>(device).m_out_tx_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_out_rx_callback(device_t &device, Object &&cb) { return downcast<aakart_device &>(device).m_out_rx_cb.set_callback(std::forward<Object>(cb)); }
// I/O operations
DECLARE_WRITE8_MEMBER( write );
@@ -63,6 +54,15 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
private:
+ enum {
+ STATUS_NORMAL = 0,
+ STATUS_KEYUP,
+ STATUS_KEYDOWN,
+ STATUS_MOUSE,
+ STATUS_HRST,
+ STATUS_UNDEFINED
+ };
+
static const device_timer_id RX_TIMER = 1;
static const device_timer_id TX_TIMER = 2;
static const device_timer_id MOUSE_TIMER = 3;
@@ -87,14 +87,6 @@ private:
// device type definition
-extern const device_type AAKART;
-
-
-
-//**************************************************************************
-// GLOBAL VARIABLES
-//**************************************************************************
-
-
+DECLARE_DEVICE_TYPE(AAKART, aakart_device)
-#endif
+#endif // MAME_MACHINE_AAKART_H
diff --git a/src/devices/machine/adc0808.cpp b/src/devices/machine/adc0808.cpp
index acc5704662d..d279850f32e 100644
--- a/src/devices/machine/adc0808.cpp
+++ b/src/devices/machine/adc0808.cpp
@@ -21,21 +21,22 @@
//**************************************************************************
// device type definition
-const device_type ADC0808 = device_creator<adc0808_device>;
+DEFINE_DEVICE_TYPE(ADC0808, adc0808_device, "adc0808", "ADC0808")
//-------------------------------------------------
// adc0808_device - constructor
//-------------------------------------------------
adc0808_device::adc0808_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, ADC0808, "ADC0808", tag, owner, clock, "adc0808", __FILE__),
+ : device_t(mconfig, ADC0808, tag, owner, clock),
m_out_eoc_cb(*this),
m_address(0),
m_start(0),
m_eoc(0),
m_next_eoc(0), m_sar(0),
m_cycle(0),
- m_bit(0), m_cycle_timer(nullptr)
+ m_bit(0),
+ m_cycle_timer(nullptr)
{
}
diff --git a/src/devices/machine/adc0808.h b/src/devices/machine/adc0808.h
index 78aea540e05..1a63e78c184 100644
--- a/src/devices/machine/adc0808.h
+++ b/src/devices/machine/adc0808.h
@@ -23,10 +23,10 @@
**********************************************************************/
-#pragma once
+#ifndef MAME_MACHINE_ADC0808_H
+#define MAME_MACHINE_ADC0808_H
-#ifndef __ADC0808__
-#define __ADC0808__
+#pragma once
@@ -36,7 +36,6 @@
// ======================> adc0808_analog_read
-typedef device_delegate<double ()> adc0808_analog_read_delegate;
#define ADC0808_ANALOG_READ_CB(name) double name()
@@ -44,54 +43,56 @@ typedef device_delegate<double ()> adc0808_analog_read_delegate;
devcb = &adc0808_device::set_out_eoc_callback(*device, DEVCB_##_devcb);
#define MCFG_ADC0808_IN_VREF_POS_CB(_class, _method) \
- adc0808_device::set_in_vref_pos_callback(*device, adc0808_analog_read_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
+ adc0808_device::set_in_vref_pos_callback(*device, adc0808_device::analog_read_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
#define MCFG_ADC0808_IN_VREF_NEG_CB(_class, _method) \
- adc0808_device::set_in_vref_neg_callback(*device, adc0808_analog_read_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
+ adc0808_device::set_in_vref_neg_callback(*device, adc0808_device::analog_read_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
#define MCFG_ADC0808_IN_IN_0_CB(_class, _method) \
- adc0808_device::set_in_in_0_callback(*device, adc0808_analog_read_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
+ adc0808_device::set_in_in_0_callback(*device, adc0808_device::analog_read_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
#define MCFG_ADC0808_IN_IN_1_CB(_class, _method) \
- adc0808_device::set_in_in_1_callback(*device, adc0808_analog_read_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
+ adc0808_device::set_in_in_1_callback(*device, adc0808_device::analog_read_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
#define MCFG_ADC0808_IN_IN_2_CB(_class, _method) \
- adc0808_device::set_in_in_2_callback(*device, adc0808_analog_read_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
+ adc0808_device::set_in_in_2_callback(*device, adc0808_device::analog_read_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
#define MCFG_ADC0808_IN_IN_3_CB(_class, _method) \
- adc0808_device::set_in_in_3_callback(*device, adc0808_analog_read_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
+ adc0808_device::set_in_in_3_callback(*device, adc0808_device::analog_read_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
#define MCFG_ADC0808_IN_IN_4_CB(_class, _method) \
- adc0808_device::set_in_in_4_callback(*device, adc0808_analog_read_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
+ adc0808_device::set_in_in_4_callback(*device, adc0808_device::analog_read_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
#define MCFG_ADC0808_IN_IN_5_CB(_class, _method) \
- adc0808_device::set_in_in_5_callback(*device, adc0808_analog_read_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
+ adc0808_device::set_in_in_5_callback(*device, adc0808_device::analog_read_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
#define MCFG_ADC0808_IN_IN_6_CB(_class, _method) \
- adc0808_device::set_in_in_6_callback(*device, adc0808_analog_read_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
+ adc0808_device::set_in_in_6_callback(*device, adc0808_device::analog_read_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
#define MCFG_ADC0808_IN_IN_7_CB(_class, _method) \
- adc0808_device::set_in_in_7_callback(*device, adc0808_analog_read_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
+ adc0808_device::set_in_in_7_callback(*device, adc0808_device::analog_read_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
// ======================> adc0808_device
class adc0808_device : public device_t
{
public:
+ typedef device_delegate<double ()> analog_read_delegate;
+
// construction/destruction
adc0808_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- template<class _Object> static devcb_base &set_out_eoc_callback(device_t &device, _Object object) { return downcast<adc0808_device &>(device).m_out_eoc_cb.set_callback(object); }
- static void set_in_vref_pos_callback(device_t &device, adc0808_analog_read_delegate callback) { downcast<adc0808_device &>(device).m_in_vref_pos_cb = callback; }
- static void set_in_vref_neg_callback(device_t &device, adc0808_analog_read_delegate callback) { downcast<adc0808_device &>(device).m_in_vref_neg_cb = callback; }
- static void set_in_in_0_callback(device_t &device, adc0808_analog_read_delegate callback) { downcast<adc0808_device &>(device).m_in_in_0_cb = callback; }
- static void set_in_in_1_callback(device_t &device, adc0808_analog_read_delegate callback) { downcast<adc0808_device &>(device).m_in_in_1_cb = callback; }
- static void set_in_in_2_callback(device_t &device, adc0808_analog_read_delegate callback) { downcast<adc0808_device &>(device).m_in_in_2_cb = callback; }
- static void set_in_in_3_callback(device_t &device, adc0808_analog_read_delegate callback) { downcast<adc0808_device &>(device).m_in_in_3_cb = callback; }
- static void set_in_in_4_callback(device_t &device, adc0808_analog_read_delegate callback) { downcast<adc0808_device &>(device).m_in_in_4_cb = callback; }
- static void set_in_in_5_callback(device_t &device, adc0808_analog_read_delegate callback) { downcast<adc0808_device &>(device).m_in_in_5_cb = callback; }
- static void set_in_in_6_callback(device_t &device, adc0808_analog_read_delegate callback) { downcast<adc0808_device &>(device).m_in_in_6_cb = callback; }
- static void set_in_in_7_callback(device_t &device, adc0808_analog_read_delegate callback) { downcast<adc0808_device &>(device).m_in_in_7_cb = callback; }
+ template <class Object> static devcb_base &set_out_eoc_callback(device_t &device, Object &&cb) { return downcast<adc0808_device &>(device).m_out_eoc_cb.set_callback(std::forward<Object>(cb)); }
+ static void set_in_vref_pos_callback(device_t &device, analog_read_delegate &&cb) { downcast<adc0808_device &>(device).m_in_vref_pos_cb = std::move(cb); }
+ static void set_in_vref_neg_callback(device_t &device, analog_read_delegate &&cb) { downcast<adc0808_device &>(device).m_in_vref_neg_cb = std::move(cb); }
+ static void set_in_in_0_callback(device_t &device, analog_read_delegate &&cb) { downcast<adc0808_device &>(device).m_in_in_0_cb = std::move(cb); }
+ static void set_in_in_1_callback(device_t &device, analog_read_delegate &&cb) { downcast<adc0808_device &>(device).m_in_in_1_cb = std::move(cb); }
+ static void set_in_in_2_callback(device_t &device, analog_read_delegate &&cb) { downcast<adc0808_device &>(device).m_in_in_2_cb = std::move(cb); }
+ static void set_in_in_3_callback(device_t &device, analog_read_delegate &&cb) { downcast<adc0808_device &>(device).m_in_in_3_cb = std::move(cb); }
+ static void set_in_in_4_callback(device_t &device, analog_read_delegate &&cb) { downcast<adc0808_device &>(device).m_in_in_4_cb = std::move(cb); }
+ static void set_in_in_5_callback(device_t &device, analog_read_delegate &&cb) { downcast<adc0808_device &>(device).m_in_in_5_cb = std::move(cb); }
+ static void set_in_in_6_callback(device_t &device, analog_read_delegate &&cb) { downcast<adc0808_device &>(device).m_in_in_6_cb = std::move(cb); }
+ static void set_in_in_7_callback(device_t &device, analog_read_delegate &&cb) { downcast<adc0808_device &>(device).m_in_in_7_cb = std::move(cb); }
DECLARE_READ8_MEMBER( data_r );
DECLARE_WRITE8_MEMBER( ale_w );
@@ -104,17 +105,17 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
private:
- devcb_write_line m_out_eoc_cb;
- adc0808_analog_read_delegate m_in_vref_pos_cb;
- adc0808_analog_read_delegate m_in_vref_neg_cb;
- adc0808_analog_read_delegate m_in_in_0_cb;
- adc0808_analog_read_delegate m_in_in_1_cb;
- adc0808_analog_read_delegate m_in_in_2_cb;
- adc0808_analog_read_delegate m_in_in_3_cb;
- adc0808_analog_read_delegate m_in_in_4_cb;
- adc0808_analog_read_delegate m_in_in_5_cb;
- adc0808_analog_read_delegate m_in_in_6_cb;
- adc0808_analog_read_delegate m_in_in_7_cb;
+ devcb_write_line m_out_eoc_cb;
+ analog_read_delegate m_in_vref_pos_cb;
+ analog_read_delegate m_in_vref_neg_cb;
+ analog_read_delegate m_in_in_0_cb;
+ analog_read_delegate m_in_in_1_cb;
+ analog_read_delegate m_in_in_2_cb;
+ analog_read_delegate m_in_in_3_cb;
+ analog_read_delegate m_in_in_4_cb;
+ analog_read_delegate m_in_in_5_cb;
+ analog_read_delegate m_in_in_6_cb;
+ analog_read_delegate m_in_in_7_cb;
int m_address; // analog channel address
int m_start; // start conversion pin
@@ -132,8 +133,6 @@ private:
// device type definition
-extern const device_type ADC0808;
-
-
+DECLARE_DEVICE_TYPE(ADC0808, adc0808_device)
-#endif
+#endif // MAME_MACHINE_ADC0808_H
diff --git a/src/devices/machine/adc083x.cpp b/src/devices/machine/adc083x.cpp
index d1666967f78..317e2dbb18a 100644
--- a/src/devices/machine/adc083x.cpp
+++ b/src/devices/machine/adc083x.cpp
@@ -46,13 +46,14 @@ enum
TYPE DEFINITIONS
***************************************************************************/
-const device_type ADC0831 = device_creator<adc0831_device>;
-const device_type ADC0832 = device_creator<adc0832_device>;
-const device_type ADC0834 = device_creator<adc0834_device>;
-const device_type ADC0838 = device_creator<adc0838_device>;
-
-adc083x_device::adc083x_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source)
- : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
+DEFINE_DEVICE_TYPE(ADC0831, adc0831_device, "adc0831", "ADC0831")
+DEFINE_DEVICE_TYPE(ADC0832, adc0832_device, "adc0832", "ADC0832")
+DEFINE_DEVICE_TYPE(ADC0834, adc0834_device, "adc0834", "ADC0834")
+DEFINE_DEVICE_TYPE(ADC0838, adc0838_device, "adc0838", "ADC0838")
+
+adc083x_device::adc083x_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint32_t mux_bits)
+ : device_t(mconfig, type, tag, owner, clock),
+ m_mux_bits(mux_bits),
m_cs(0),
m_clk(0),
m_di(0),
@@ -69,27 +70,23 @@ adc083x_device::adc083x_device(const machine_config &mconfig, device_type type,
}
adc0831_device::adc0831_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : adc083x_device(mconfig, ADC0831, "ADC0831", tag, owner, clock, "adc0831", __FILE__)
+ : adc083x_device(mconfig, ADC0831, tag, owner, clock, 0)
{
- m_mux_bits = 0;
}
adc0832_device::adc0832_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : adc083x_device(mconfig, ADC0832, "ADC0832", tag, owner, clock, "adc0832", __FILE__)
+ : adc083x_device(mconfig, ADC0832, tag, owner, clock, 2)
{
- m_mux_bits = 2;
}
adc0834_device::adc0834_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : adc083x_device(mconfig, ADC0834, "ADC0834", tag, owner, clock, "adc0834", __FILE__)
+ : adc083x_device(mconfig, ADC0834, tag, owner, clock, 3)
{
- m_mux_bits = 3;
}
adc0838_device::adc0838_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : adc083x_device(mconfig, ADC0838, "ADC0838", tag, owner, clock, "adc0838", __FILE__)
+ : adc083x_device(mconfig, ADC0838, tag, owner, clock, 4)
{
- m_mux_bits = 4;
}
/*-------------------------------------------------
@@ -117,7 +114,6 @@ void adc083x_device::device_start()
save_item( NAME(m_state) );
save_item( NAME(m_bit) );
save_item( NAME(m_output) );
- save_item( NAME(m_mux_bits) );
}
/*-------------------------------------------------
diff --git a/src/devices/machine/adc083x.h b/src/devices/machine/adc083x.h
index dd26370bf3f..5af0e02cbb5 100644
--- a/src/devices/machine/adc083x.h
+++ b/src/devices/machine/adc083x.h
@@ -8,19 +8,20 @@
***************************************************************************/
-#ifndef __ADC083X_H__
-#define __ADC083X_H__
+#ifndef MAME_MACHINE_ADC083X_H
+#define MAME_MACHINE_ADC083X_H
+
+#pragma once
/***************************************************************************
TYPE DEFINITIONS
***************************************************************************/
-typedef device_delegate<double (uint8_t input)> adc083x_input_delegate;
#define ADC083X_INPUT_CB(name) double name(uint8_t input)
#define MCFG_ADC083X_INPUT_CB(_class, _method) \
- adc083x_device::set_input_callback(*device, adc083x_input_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
+ adc083x_device::set_input_callback(*device, adc083x_device::input_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
/***************************************************************************
CONSTANTS
@@ -45,10 +46,10 @@ typedef device_delegate<double (uint8_t input)> adc083x_input_delegate;
class adc083x_device : public device_t
{
public:
- adc083x_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source);
+ typedef device_delegate<double (uint8_t input)> input_delegate;
// static configuration helpers
- static void set_input_callback(device_t &device, adc083x_input_delegate input_callback) { downcast<adc083x_device &>(device).m_input_callback = input_callback; }
+ static void set_input_callback(device_t &device, input_delegate &&cb) { downcast<adc083x_device &>(device).m_input_callback = std::move(cb); }
DECLARE_WRITE_LINE_MEMBER( cs_write );
DECLARE_WRITE_LINE_MEMBER( clk_write );
@@ -58,10 +59,12 @@ public:
DECLARE_READ_LINE_MEMBER( do_read );
protected:
+ adc083x_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint32_t mux_bits);
+
// device-level overrides
virtual void device_start() override;
- int32_t m_mux_bits;
+ const int32_t m_mux_bits;
private:
uint8_t conversion();
@@ -83,17 +86,16 @@ private:
int32_t m_bit;
int32_t m_output;
- adc083x_input_delegate m_input_callback;
+ input_delegate m_input_callback;
};
+
class adc0831_device : public adc083x_device
{
public:
adc0831_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
};
-extern const device_type ADC0831;
-
class adc0832_device : public adc083x_device
{
@@ -101,8 +103,6 @@ public:
adc0832_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
};
-extern const device_type ADC0832;
-
class adc0834_device : public adc083x_device
{
@@ -110,8 +110,6 @@ public:
adc0834_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
};
-extern const device_type ADC0834;
-
class adc0838_device : public adc083x_device
{
@@ -119,7 +117,10 @@ public:
adc0838_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
};
-extern const device_type ADC0838;
+DECLARE_DEVICE_TYPE(ADC0831, adc0831_device)
+DECLARE_DEVICE_TYPE(ADC0832, adc0832_device)
+DECLARE_DEVICE_TYPE(ADC0834, adc0834_device)
+DECLARE_DEVICE_TYPE(ADC0838, adc0838_device)
-#endif /* __ADC083X_H__ */
+#endif // MAME_MACHINE_ADC083X_H
diff --git a/src/devices/machine/adc1038.cpp b/src/devices/machine/adc1038.cpp
index 66f65878b65..409090bba4d 100644
--- a/src/devices/machine/adc1038.cpp
+++ b/src/devices/machine/adc1038.cpp
@@ -13,10 +13,11 @@
#include "adc1038.h"
-const device_type ADC1038 = device_creator<adc1038_device>;
+DEFINE_DEVICE_TYPE(ADC1038, adc1038_device, "adc1038", "ADC1038")
adc1038_device::adc1038_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, ADC1038, "ADC1038", tag, owner, clock, "adc1038", __FILE__), m_cycle(0), m_clk(0), m_adr(0), m_data_in(0), m_data_out(0), m_adc_data(0), m_sars(0),
+ : device_t(mconfig, ADC1038, tag, owner, clock),
+ m_cycle(0), m_clk(0), m_adr(0), m_data_in(0), m_data_out(0), m_adc_data(0), m_sars(0),
m_gticlub_hack(0)
{
}
diff --git a/src/devices/machine/adc1038.h b/src/devices/machine/adc1038.h
index f3b74bd0290..32787e36181 100644
--- a/src/devices/machine/adc1038.h
+++ b/src/devices/machine/adc1038.h
@@ -9,14 +9,16 @@
***************************************************************************/
-#ifndef __ADC1038_H__
-#define __ADC1038_H__
+#ifndef MAME_MACHINE_ADC1038_H
+#define MAME_MACHINE_ADC1038_H
+
+#pragma once
+
/***************************************************************************
TYPE DEFINITIONS
***************************************************************************/
-typedef device_delegate<int (int input)> adc1038_input_delegate;
#define ADC1038_INPUT_CB(name) int name(int input)
/***************************************************************************
@@ -26,10 +28,11 @@ typedef device_delegate<int (int input)> adc1038_input_delegate;
class adc1038_device : public device_t
{
public:
+ typedef device_delegate<int (int input)> input_delegate;
+
adc1038_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- ~adc1038_device() {}
- static void set_input_callback(device_t &device, adc1038_input_delegate callback) { downcast<adc1038_device &>(device).m_input_cb = callback; }
+ static void set_input_callback(device_t &device, input_delegate &&callback) { downcast<adc1038_device &>(device).m_input_cb = std::move(callback); }
static void set_gti_club_hack(device_t &device, int hack) { downcast<adc1038_device &>(device).m_gticlub_hack = hack; }
DECLARE_READ_LINE_MEMBER( do_read );
@@ -53,17 +56,16 @@ private:
int m_sars;
int m_gticlub_hack;
- adc1038_input_delegate m_input_cb;
+ input_delegate m_input_cb;
};
-extern const device_type ADC1038;
+DECLARE_DEVICE_TYPE(ADC1038, adc1038_device)
#define MCFG_ADC1038_INPUT_CB(_class, _method) \
- adc1038_device::set_input_callback(*device, adc1038_input_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
+ adc1038_device::set_input_callback(*device, adc1038_device::input_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
#define MCFG_ADC1038_GTIHACK(_hack) \
adc1038_device::set_gti_club_hack(*device, _hack);
-
-#endif /* __ADC1038_H__ */
+#endif // MAME_MACHINE_ADC1038_H
diff --git a/src/devices/machine/adc1213x.cpp b/src/devices/machine/adc1213x.cpp
index d3c39ba036e..889162bcd3a 100644
--- a/src/devices/machine/adc1213x.cpp
+++ b/src/devices/machine/adc1213x.cpp
@@ -34,30 +34,29 @@
-const device_type ADC12130 = device_creator<adc12130_device>;
+DEFINE_DEVICE_TYPE(ADC12130, adc12130_device, "adc12130", "ADC12130")
+DEFINE_DEVICE_TYPE(ADC12132, adc12132_device, "adc12132", "ADC12132")
+DEFINE_DEVICE_TYPE(ADC12138, adc12138_device, "adc12138", "ADC12138")
+
adc12130_device::adc12130_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : adc12138_device(mconfig, ADC12130, "ADC12130", tag, owner, clock, "adc12130", __FILE__)
+ : adc12138_device(mconfig, ADC12130, tag, owner, clock)
{
}
-const device_type ADC12132 = device_creator<adc12132_device>;
-
adc12132_device::adc12132_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : adc12138_device(mconfig, ADC12132, "ADC12132", tag, owner, clock, "adc12132", __FILE__)
+ : adc12138_device(mconfig, ADC12132, tag, owner, clock)
{
}
-const device_type ADC12138 = device_creator<adc12138_device>;
-
adc12138_device::adc12138_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, ADC12138, "ADC12138", tag, owner, clock, "adc12138", __FILE__)
+ : adc12138_device(mconfig, ADC12138, tag, owner, clock)
{
}
-adc12138_device::adc12138_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source)
- : device_t(mconfig, type, name, tag, owner, clock, shortname, source)
+adc12138_device::adc12138_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
+ : device_t(mconfig, type, tag, owner, clock)
{
}
diff --git a/src/devices/machine/adc1213x.h b/src/devices/machine/adc1213x.h
index 56251fdae91..9f2eb7552fd 100644
--- a/src/devices/machine/adc1213x.h
+++ b/src/devices/machine/adc1213x.h
@@ -9,15 +9,16 @@
***************************************************************************/
-#ifndef __ADC1213X_H__
-#define __ADC1213X_H__
+#ifndef MAME_MACHINE_ADC1213X_H
+#define MAME_MACHINE_ADC1213X_H
+
+#pragma once
/***************************************************************************
TYPE DEFINITIONS
***************************************************************************/
-typedef device_delegate<double (uint8_t input)> adc1213x_ipt_convert_delegate;
#define ADC12138_IPT_CONVERT_CB(name) double name(uint8_t input)
/***************************************************************************
@@ -27,11 +28,11 @@ typedef device_delegate<double (uint8_t input)> adc1213x_ipt_convert_delegate;
class adc12138_device : public device_t
{
public:
+ typedef device_delegate<double (uint8_t input)> ipt_convert_delegate;
+
adc12138_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- adc12138_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source);
- ~adc12138_device() {}
- static void set_ipt_convert_callback(device_t &device, adc1213x_ipt_convert_delegate callback) { downcast<adc12138_device &>(device).m_ipt_read_cb = callback; }
+ static void set_ipt_convert_callback(device_t &device, ipt_convert_delegate &&cb) { downcast<adc12138_device &>(device).m_ipt_read_cb = std::move(cb); }
DECLARE_WRITE8_MEMBER( di_w );
DECLARE_WRITE8_MEMBER( cs_w );
@@ -41,13 +42,15 @@ public:
DECLARE_READ8_MEMBER( eoc_r );
protected:
+ adc12138_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;
void convert(int channel, int bits16, int lsbfirst);
- adc1213x_ipt_convert_delegate m_ipt_read_cb;
+ ipt_convert_delegate m_ipt_read_cb;
private:
// internal state
@@ -64,7 +67,6 @@ private:
int m_end_conv;
};
-extern const device_type ADC12138;
class adc12130_device : public adc12138_device
{
@@ -72,7 +74,6 @@ public:
adc12130_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
};
-extern const device_type ADC12130;
class adc12132_device : public adc12138_device
{
@@ -80,10 +81,13 @@ public:
adc12132_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
};
-extern const device_type ADC12132;
+
+DECLARE_DEVICE_TYPE(ADC12138, adc12138_device)
+DECLARE_DEVICE_TYPE(ADC12130, adc12130_device)
+DECLARE_DEVICE_TYPE(ADC12132, adc12132_device)
#define MCFG_ADC1213X_IPT_CONVERT_CB(_class, _method) \
- adc12138_device::set_ipt_convert_callback(*device, adc1213x_ipt_convert_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
+ adc12138_device::set_ipt_convert_callback(*device, adc12138_device::ipt_convert_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
-#endif /* __ADC1213X_H__ */
+#endif // MAME_MACHINE_ADC1213X_H
diff --git a/src/devices/machine/aicartc.cpp b/src/devices/machine/aicartc.cpp
index 864c9e5ced9..c6d5beb5a45 100644
--- a/src/devices/machine/aicartc.cpp
+++ b/src/devices/machine/aicartc.cpp
@@ -19,7 +19,7 @@
//**************************************************************************
// device type definition
-const device_type AICARTC = device_creator<aicartc_device>;
+DEFINE_DEVICE_TYPE(AICARTC, aicartc_device, "aicartc", "AICA RTC")
//**************************************************************************
@@ -31,8 +31,10 @@ const device_type AICARTC = device_creator<aicartc_device>;
//-------------------------------------------------
aicartc_device::aicartc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, AICARTC, "AICA RTC", tag, owner, clock, "aicartc", __FILE__),
- device_rtc_interface(mconfig, *this), m_rtc_reg_lo(0), m_rtc_reg_hi(0), m_rtc_tick(0), m_we(0), m_clock_timer(nullptr)
+ : device_t(mconfig, AICARTC, tag, owner, clock)
+ , device_rtc_interface(mconfig, *this)
+ , m_rtc_reg_lo(0), m_rtc_reg_hi(0), m_rtc_tick(0), m_we(0)
+ , m_clock_timer(nullptr)
{
}
diff --git a/src/devices/machine/aicartc.h b/src/devices/machine/aicartc.h
index ba06de45db2..757c0a58c1d 100644
--- a/src/devices/machine/aicartc.h
+++ b/src/devices/machine/aicartc.h
@@ -1,16 +1,10 @@
// license:BSD-3-Clause
// copyright-holders:Angelo Salese
-/***************************************************************************
-
-Template for skeleton device
-
-***************************************************************************/
+#ifndef MAME_MACHINE_AICARTC_H
+#define MAME_MACHINE_AICARTC_H
#pragma once
-#ifndef __AICARTCDEV_H__
-#define __AICARTCDEV_H__
-
#include "dirtc.h"
@@ -27,8 +21,7 @@ Template for skeleton device
// ======================> aicartc_device
-class aicartc_device : public device_t,
- public device_rtc_interface
+class aicartc_device : public device_t, public device_rtc_interface
{
public:
// construction/destruction
@@ -60,14 +53,6 @@ private:
// device type definition
-extern const device_type AICARTC;
-
-
-
-//**************************************************************************
-// GLOBAL VARIABLES
-//**************************************************************************
-
-
+DECLARE_DEVICE_TYPE(AICARTC, aicartc_device)
-#endif
+#endif // MAME_MACHINE_AICARTC_H
diff --git a/src/devices/machine/akiko.cpp b/src/devices/machine/akiko.cpp
index e464f70431f..95887f648f1 100644
--- a/src/devices/machine/akiko.cpp
+++ b/src/devices/machine/akiko.cpp
@@ -31,7 +31,7 @@
// DEVICE DEFINITIONS
//**************************************************************************
-const device_type AKIKO = device_creator<akiko_device>;
+DEFINE_DEVICE_TYPE(AKIKO, akiko_device, "akiko", "CBM AKIKO")
//-------------------------------------------------
// machine_config_additions - device-specific
@@ -56,7 +56,7 @@ machine_config_constructor akiko_device::device_mconfig_additions() const
//-------------------------------------------------
akiko_device::akiko_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, AKIKO, "CBM AKIKO", tag, owner, clock, "akiko", __FILE__),
+ : device_t(mconfig, AKIKO, tag, owner, clock),
m_c2p_input_index(0),
m_c2p_output_index(0),
m_i2c_scl_out(0),
diff --git a/src/devices/machine/akiko.h b/src/devices/machine/akiko.h
index 23a33cd38c9..692f8c66154 100644
--- a/src/devices/machine/akiko.h
+++ b/src/devices/machine/akiko.h
@@ -12,10 +12,10 @@
***************************************************************************/
-#pragma once
+#ifndef MAME_MACHINE_AKIKO_H
+#define MAME_MACHINE_AKIKO_H
-#ifndef __AKIKO_H__
-#define __AKIKO_H__
+#pragma once
#include "cdrom.h"
#include "sound/cdda.h"
@@ -57,26 +57,25 @@ class akiko_device : public device_t
{
public:
akiko_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- ~akiko_device() {}
// callbacks
- template<class _Object> static devcb_base &set_mem_r_callback(device_t &device, _Object object)
- { return downcast<akiko_device &>(device).m_mem_r.set_callback(object); }
+ template <class Object> static devcb_base &set_mem_r_callback(device_t &device, Object &&cb)
+ { return downcast<akiko_device &>(device).m_mem_r.set_callback(std::forward<Object>(cb)); }
- template<class _Object> static devcb_base &set_mem_w_callback(device_t &device, _Object object)
- { return downcast<akiko_device &>(device).m_mem_w.set_callback(object); }
+ template <class Object> static devcb_base &set_mem_w_callback(device_t &device, Object &&cb)
+ { return downcast<akiko_device &>(device).m_mem_w.set_callback(std::forward<Object>(cb)); }
- template<class _Object> static devcb_base &set_int_w_callback(device_t &device, _Object object)
- { return downcast<akiko_device &>(device).m_int_w.set_callback(object); }
+ template <class Object> static devcb_base &set_int_w_callback(device_t &device, Object &&cb)
+ { return downcast<akiko_device &>(device).m_int_w.set_callback(std::forward<Object>(cb)); }
- template<class _Object> static devcb_base &set_scl_handler(device_t &device, _Object object)
- { return downcast<akiko_device &>(device).m_scl_w.set_callback(object); }
+ template <class Object> static devcb_base &set_scl_handler(device_t &device, Object &&cb)
+ { return downcast<akiko_device &>(device).m_scl_w.set_callback(std::forward<Object>(cb)); }
- template<class _Object> static devcb_base &set_sda_read_handler(device_t &device, _Object object)
- { return downcast<akiko_device &>(device).m_sda_r.set_callback(object); }
+ template <class Object> static devcb_base &set_sda_read_handler(device_t &device, Object &&cb)
+ { return downcast<akiko_device &>(device).m_sda_r.set_callback(std::forward<Object>(cb)); }
- template<class _Object> static devcb_base &set_sda_write_handler(device_t &device, _Object object)
- { return downcast<akiko_device &>(device).m_sda_w.set_callback(object); }
+ template <class Object> static devcb_base &set_sda_write_handler(device_t &device, Object &&cb)
+ { return downcast<akiko_device &>(device).m_sda_w.set_callback(std::forward<Object>(cb)); }
DECLARE_READ32_MEMBER( read );
DECLARE_WRITE32_MEMBER( write );
@@ -90,7 +89,7 @@ protected:
private:
// 1X CDROM sector time in msec (300KBps)
- static const int CD_SECTOR_TIME = (1000/((150*1024)/2048));
+ static constexpr int CD_SECTOR_TIME = (1000/((150*1024)/2048));
// chunky to planar converter
uint32_t m_c2p_input_buffer[8];
@@ -164,6 +163,6 @@ private:
};
// device type definition
-extern const device_type AKIKO;
+DECLARE_DEVICE_TYPE(AKIKO, akiko_device)
-#endif
+#endif // MAME_MACHINE_AKIKO_H
diff --git a/src/devices/machine/am2847.cpp b/src/devices/machine/am2847.cpp
index 93c288c6b68..7e7992a2e85 100644
--- a/src/devices/machine/am2847.cpp
+++ b/src/devices/machine/am2847.cpp
@@ -9,12 +9,12 @@
#include "emu.h"
#include "am2847.h"
-const device_type AM2847 = device_creator<am2847_device>;
-const device_type AM2849 = device_creator<am2849_device>;
-const device_type TMS3409 = device_creator<tms3409_device>;
+DEFINE_DEVICE_TYPE(AM2847, am2847_device, "am2847", "AMD Am2847 80-bit Static Shift Register")
+DEFINE_DEVICE_TYPE(AM2849, am2849_device, "am2849", "AMD Am2849 96-bit Static Shift Register")
+DEFINE_DEVICE_TYPE(TMS3409, tms3409_device, "tms3409", "TI TMS3409 80-bit Static Shift Register")
-am2847_base_device::am2847_base_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, size_t size)
- : device_t(mconfig, type, name, tag, owner, clock, shortname, __FILE__)
+am2847_base_device::am2847_base_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, size_t size)
+ : device_t(mconfig, type, tag, owner, clock)
, m_in(0)
, m_out(0)
, m_rc(0)
@@ -24,17 +24,17 @@ am2847_base_device::am2847_base_device(const machine_config &mconfig, device_typ
}
am2847_device::am2847_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : am2847_base_device(mconfig, AM2847, "AMD Am2847 80-bit Static Shift Register", tag, owner, clock, "am2847", 5)
+ : am2847_base_device(mconfig, AM2847, tag, owner, clock, 5)
{
}
am2849_device::am2849_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : am2847_base_device(mconfig, AM2849, "AMD Am2849 96-bit Static Shift Register", tag, owner, clock, "am2847", 6)
+ : am2847_base_device(mconfig, AM2849, tag, owner, clock, 6)
{
}
tms3409_device::tms3409_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : am2847_base_device(mconfig, TMS3409, "TI TMS3409 80-bit Static Shift Register", tag, owner, clock, "am2847", 5)
+ : am2847_base_device(mconfig, TMS3409, tag, owner, clock, 5)
{
}
diff --git a/src/devices/machine/am2847.h b/src/devices/machine/am2847.h
index 0e70d2bf37f..88d63342d8f 100644
--- a/src/devices/machine/am2847.h
+++ b/src/devices/machine/am2847.h
@@ -40,10 +40,10 @@
**********************************************************************/
-#pragma once
+#ifndef MAME_MACHINE_AM2847_H
+#define MAME_MACHINE_AM2847_H
-#ifndef AM2847_H
-#define AM2847_H
+#pragma once
#define MCFG_AM2847_ADD(_tag) \
@@ -58,8 +58,6 @@
class am2847_base_device : public device_t
{
public:
- am2847_base_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, size_t size);
-
DECLARE_WRITE_LINE_MEMBER( in_a_w );
DECLARE_WRITE_LINE_MEMBER( in_b_w );
DECLARE_WRITE_LINE_MEMBER( in_c_w );
@@ -77,6 +75,8 @@ public:
uint8_t out_r() const { return m_out; }
protected:
+ am2847_base_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, size_t size);
+
virtual void device_start() override;
virtual void device_reset() override;
@@ -126,8 +126,8 @@ public:
};
// device type definition
-extern const device_type AM2847;
-extern const device_type AM2849;
-extern const device_type TMS3409;
+DECLARE_DEVICE_TYPE(AM2847, am2847_device)
+DECLARE_DEVICE_TYPE(AM2849, am2849_device)
+DECLARE_DEVICE_TYPE(TMS3409, tms3409_device)
-#endif // AM2847_H
+#endif // MAME_MACHINE_AM2847_H
diff --git a/src/devices/machine/am53cf96.cpp b/src/devices/machine/am53cf96.cpp
index d2770b383ce..edd2ca72fee 100644
--- a/src/devices/machine/am53cf96.cpp
+++ b/src/devices/machine/am53cf96.cpp
@@ -18,7 +18,7 @@
READ8_MEMBER( am53cf96_device::read )
{
int rv;
- static const int states[] = { 0, 0, 1, 1, 2, 3, 4, 5, 6, 7, 0 };
+ static constexpr int states[] = { 0, 0, 1, 1, 2, 3, 4, 5, 6, 7, 0 };
if (offset == REG_STATUS)
{
@@ -147,7 +147,7 @@ WRITE8_MEMBER( am53cf96_device::write )
}
am53cf96_device::am53cf96_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- legacy_scsi_host_adapter(mconfig, AM53CF96, "53CF96 SCSI", tag, owner, clock, "am53cf96", __FILE__),
+ legacy_scsi_host_adapter(mconfig, AM53CF96, tag, owner, clock),
m_irq_handler(*this)
{
}
@@ -191,4 +191,4 @@ void am53cf96_device::dma_write_data(int bytes, uint8_t *pData)
write_data(pData, bytes);
}
-const device_type AM53CF96 = device_creator<am53cf96_device>;
+DEFINE_DEVICE_TYPE(AM53CF96, am53cf96_device, "am53cf96", "AMD 53CF96 SCSI")
diff --git a/src/devices/machine/am53cf96.h b/src/devices/machine/am53cf96.h
index ec2697bab5b..f269ec34384 100644
--- a/src/devices/machine/am53cf96.h
+++ b/src/devices/machine/am53cf96.h
@@ -5,8 +5,8 @@
*
*/
-#ifndef _AM53CF96_H_
-#define _AM53CF96_H_
+#ifndef MAME_MACHINE_AM53CF96_H
+#define MAME_MACHINE_AM53CF96_H
#pragma once
@@ -15,28 +15,6 @@
#define MCFG_AM53CF96_IRQ_HANDLER(_devcb) \
devcb = &am53cf96_device::set_irq_handler(*device, DEVCB_##_devcb);
-// 53CF96 register set
-enum
-{
- REG_XFERCNTLOW = 0, // read = current xfer count lo byte, write = set xfer count lo byte
- REG_XFERCNTMID, // read = current xfer count mid byte, write = set xfer count mid byte
- REG_FIFO, // read/write = FIFO
- REG_COMMAND, // read/write = command
-
- REG_STATUS, // read = status, write = destination SCSI ID (4)
- REG_IRQSTATE, // read = IRQ status, write = timeout (5)
- REG_INTSTATE, // read = internal state, write = sync xfer period (6)
- REG_FIFOSTATE, // read = FIFO status, write = sync offset
- REG_CTRL1, // read/write = control 1
- REG_CLOCKFCTR, // clock factor (write only)
- REG_TESTMODE, // test mode (write only)
- REG_CTRL2, // read/write = control 2
- REG_CTRL3, // read/write = control 3
- REG_CTRL4, // read/write = control 4
- REG_XFERCNTHI, // read = current xfer count hi byte, write = set xfer count hi byte
- REG_DATAALIGN // data alignment (write only)
-};
-
class am53cf96_device : public legacy_scsi_host_adapter
{
public:
@@ -44,7 +22,7 @@ public:
am53cf96_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// static configuration helpers
- template<class _Object> static devcb_base &set_irq_handler(device_t &device, _Object object) { return downcast<am53cf96_device &>(device).m_irq_handler.set_callback(object); }
+ template <class Object> static devcb_base &set_irq_handler(device_t &device, Object &&cb) { return downcast<am53cf96_device &>(device).m_irq_handler.set_callback(std::forward<Object>(cb)); }
DECLARE_READ8_MEMBER(read);
DECLARE_WRITE8_MEMBER(write);
@@ -53,12 +31,34 @@ public:
void dma_write_data(int bytes, uint8_t *pData);
protected:
+ // 53CF96 register set
+ enum
+ {
+ REG_XFERCNTLOW = 0, // read = current xfer count lo byte, write = set xfer count lo byte
+ REG_XFERCNTMID, // read = current xfer count mid byte, write = set xfer count mid byte
+ REG_FIFO, // read/write = FIFO
+ REG_COMMAND, // read/write = command
+
+ REG_STATUS, // read = status, write = destination SCSI ID (4)
+ REG_IRQSTATE, // read = IRQ status, write = timeout (5)
+ REG_INTSTATE, // read = internal state, write = sync xfer period (6)
+ REG_FIFOSTATE, // read = FIFO status, write = sync offset
+ REG_CTRL1, // read/write = control 1
+ REG_CLOCKFCTR, // clock factor (write only)
+ REG_TESTMODE, // test mode (write only)
+ REG_CTRL2, // read/write = control 2
+ REG_CTRL3, // read/write = control 3
+ REG_CTRL4, // read/write = control 4
+ REG_XFERCNTHI, // read = current xfer count hi byte, write = set xfer count hi byte
+ REG_DATAALIGN // data alignment (write only)
+ };
+
// device-level overrides
virtual void device_start() override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
private:
- static const device_timer_id TIMER_TRANSFER = 0;
+ static constexpr device_timer_id TIMER_TRANSFER = 0;
uint8_t scsi_regs[32];
uint8_t fifo[16];
@@ -71,6 +71,6 @@ private:
};
// device type definition
-extern const device_type AM53CF96;
+DECLARE_DEVICE_TYPE(AM53CF96, am53cf96_device)
-#endif
+#endif // MAME_MACHINE_AM53CF96_H
diff --git a/src/devices/machine/am9517a.cpp b/src/devices/machine/am9517a.cpp
index b29fdf7b13a..b39ab007252 100644
--- a/src/devices/machine/am9517a.cpp
+++ b/src/devices/machine/am9517a.cpp
@@ -42,23 +42,24 @@
#include "emu.h"
#include "am9517a.h"
+//#define VERBOSE 1
+#include "logmacro.h"
+
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
-const device_type AM9517A = device_creator<am9517a_device>;
-const device_type V53_DMAU = device_creator<upd71071_v53_device>;
-const device_type PCXPORT_DMAC = device_creator<pcxport_dmac_device>;
+DEFINE_DEVICE_TYPE(AM9517A, am9517a_device, "am9517a", "AM9517A")
+DEFINE_DEVICE_TYPE(V53_DMAU, upd71071_v53_device, "v53_dmau", "V53 DMAU")
+DEFINE_DEVICE_TYPE(PCXPORT_DMAC, pcxport_dmac_device, "pcx_dmac", "PC Transporter DMAC")
//**************************************************************************
// MACROS / CONSTANTS
//**************************************************************************
-#define LOG 0
-
enum
{
@@ -133,7 +134,7 @@ enum
inline void am9517a_device::dma_request(int channel, int state)
{
- if (LOG) logerror("AM9517A '%s' Channel %u DMA Request: %u\n", tag(), channel, state);
+ LOG("AM9517A Channel %u DMA Request: %u\n", channel, state);
if (state ^ COMMAND_DREQ_ACTIVE_LOW)
{
@@ -190,50 +191,10 @@ inline void am9517a_device::set_dack()
{
for (int channel = 0; channel < 4; channel++)
{
- if (channel == 0)
- {
- if ((channel == m_current_channel) && !COMMAND_MEM_TO_MEM)
- {
- m_out_dack_0_cb(COMMAND_DACK_ACTIVE_HIGH);
- }
- else
- {
- m_out_dack_0_cb(!COMMAND_DACK_ACTIVE_HIGH);
- }
- }
- else if (channel == 1)
- {
- if ((channel == m_current_channel) && !COMMAND_MEM_TO_MEM)
- {
- m_out_dack_1_cb(COMMAND_DACK_ACTIVE_HIGH);
- }
- else
- {
- m_out_dack_1_cb(!COMMAND_DACK_ACTIVE_HIGH);
- }
- }
- else if (channel == 2)
- {
- if ((channel == m_current_channel) && !COMMAND_MEM_TO_MEM)
- {
- m_out_dack_2_cb(COMMAND_DACK_ACTIVE_HIGH);
- }
- else
- {
- m_out_dack_2_cb(!COMMAND_DACK_ACTIVE_HIGH);
- }
- }
- else if (channel == 3)
- {
- if ((channel == m_current_channel) && !COMMAND_MEM_TO_MEM)
- {
- m_out_dack_3_cb(COMMAND_DACK_ACTIVE_HIGH);
- }
- else
- {
- m_out_dack_3_cb(!COMMAND_DACK_ACTIVE_HIGH);
- }
- }
+ if ((channel == m_current_channel) && !COMMAND_MEM_TO_MEM)
+ m_out_dack_cb[channel](COMMAND_DACK_ACTIVE_HIGH);
+ else
+ m_out_dack_cb[channel](!COMMAND_DACK_ACTIVE_HIGH);
}
}
@@ -282,21 +243,7 @@ inline void am9517a_device::dma_read()
{
case MODE_TRANSFER_VERIFY:
case MODE_TRANSFER_WRITE:
- switch(m_current_channel)
- {
- case 0:
- m_temp = m_in_ior_0_cb(offset);
- break;
- case 1:
- m_temp = m_in_ior_1_cb(offset);
- break;
- case 2:
- m_temp = m_in_ior_2_cb(offset);
- break;
- case 3:
- m_temp = m_in_ior_3_cb(offset);
- break;
- }
+ m_temp = m_in_ior_cb[m_current_channel](offset);
break;
case MODE_TRANSFER_READ:
@@ -316,33 +263,20 @@ inline void am9517a_device::dma_write()
switch (MODE_TRANSFER_MASK)
{
- case MODE_TRANSFER_VERIFY: {
- uint8_t v1 = m_in_memr_cb(offset);
- if(0 && m_temp != v1)
- logerror("%s: verify error %02x vs. %02x\n", tag(), m_temp, v1);
+ case MODE_TRANSFER_VERIFY:
+ {
+ uint8_t v1 = m_in_memr_cb(offset);
+ if(0 && m_temp != v1)
+ logerror("verify error %02x vs. %02x\n", m_temp, v1);
+ }
break;
- }
case MODE_TRANSFER_WRITE:
m_out_memw_cb(offset, m_temp);
break;
case MODE_TRANSFER_READ:
- switch(m_current_channel)
- {
- case 0:
- m_out_iow_0_cb(offset, m_temp);
- break;
- case 1:
- m_out_iow_1_cb(offset, m_temp);
- break;
- case 2:
- m_out_iow_2_cb(offset, m_temp);
- break;
- case 3:
- m_out_iow_3_cb(offset, m_temp);
- break;
- }
+ m_out_iow_cb[m_current_channel](offset, m_temp);
break;
}
}
@@ -473,8 +407,8 @@ void am9517a_device::end_of_process()
//-------------------------------------------------
-am9517a_device::am9517a_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname)
- : device_t(mconfig, type, name, tag, owner, clock, shortname, __FILE__),
+am9517a_device::am9517a_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_execute_interface(mconfig, *this),
m_icount(0),
m_hack(0),
@@ -484,56 +418,25 @@ am9517a_device::am9517a_device(const machine_config &mconfig, device_type type,
m_out_eop_cb(*this),
m_in_memr_cb(*this),
m_out_memw_cb(*this),
- m_in_ior_0_cb(*this),
- m_in_ior_1_cb(*this),
- m_in_ior_2_cb(*this),
- m_in_ior_3_cb(*this),
- m_out_iow_0_cb(*this),
- m_out_iow_1_cb(*this),
- m_out_iow_2_cb(*this),
- m_out_iow_3_cb(*this),
- m_out_dack_0_cb(*this),
- m_out_dack_1_cb(*this),
- m_out_dack_2_cb(*this),
- m_out_dack_3_cb(*this)
+ m_in_ior_cb{ { *this }, { *this }, { *this }, { *this } },
+ m_out_iow_cb{ { *this }, { *this }, { *this }, { *this } },
+ m_out_dack_cb{ { *this }, { *this }, { *this }, { *this } }
{
}
am9517a_device::am9517a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, AM9517A, "AM9517A", tag, owner, clock, "am9517a", __FILE__),
- device_execute_interface(mconfig, *this),
- m_icount(0),
- m_hack(0),
- m_ready(1),
- m_command(0),
- m_out_hreq_cb(*this),
- m_out_eop_cb(*this),
- m_in_memr_cb(*this),
- m_out_memw_cb(*this),
- m_in_ior_0_cb(*this),
- m_in_ior_1_cb(*this),
- m_in_ior_2_cb(*this),
- m_in_ior_3_cb(*this),
- m_out_iow_0_cb(*this),
- m_out_iow_1_cb(*this),
- m_out_iow_2_cb(*this),
- m_out_iow_3_cb(*this),
- m_out_dack_0_cb(*this),
- m_out_dack_1_cb(*this),
- m_out_dack_2_cb(*this),
- m_out_dack_3_cb(*this)
-
+ : am9517a_device(mconfig, AM9517A, tag, owner, clock)
{
}
upd71071_v53_device::upd71071_v53_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : am9517a_device(mconfig, V53_DMAU, "V53 DMAU", tag, owner, clock, "v53_dmau")
+ : am9517a_device(mconfig, V53_DMAU, tag, owner, clock)
{
}
pcxport_dmac_device::pcxport_dmac_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : am9517a_device(mconfig, PCXPORT_DMAC, "PC Transporter DMAC", tag, owner, clock, "pcx_dmac")
+ : am9517a_device(mconfig, PCXPORT_DMAC, tag, owner, clock)
{
}
@@ -551,20 +454,14 @@ void am9517a_device::device_start()
m_out_eop_cb.resolve_safe();
m_in_memr_cb.resolve_safe(0);
m_out_memw_cb.resolve_safe();
- m_in_ior_0_cb.resolve_safe(0);
- m_in_ior_1_cb.resolve_safe(0);
- m_in_ior_2_cb.resolve_safe(0);
- m_in_ior_3_cb.resolve_safe(0);
- m_out_iow_0_cb.resolve_safe();
- m_out_iow_1_cb.resolve_safe();
- m_out_iow_2_cb.resolve_safe();
- m_out_iow_3_cb.resolve_safe();
- m_out_dack_0_cb.resolve_safe();
- m_out_dack_1_cb.resolve_safe();
- m_out_dack_2_cb.resolve_safe();
- m_out_dack_3_cb.resolve_safe();
-
- for (auto & elem : m_channel)
+ for(auto &cb : m_in_ior_cb)
+ cb.resolve_safe(0);
+ for(auto &cb : m_out_iow_cb)
+ cb.resolve_safe();
+ for(auto &cb : m_out_dack_cb)
+ cb.resolve_safe();
+
+ for(auto &elem : m_channel)
{
elem.m_address = 0;
elem.m_count = 0;
@@ -894,7 +791,7 @@ WRITE8_MEMBER( am9517a_device::write )
m_channel[channel].m_address = (m_channel[channel].m_address & 0xff00) | data;
}
- if (LOG) logerror("AM9517A '%s' Channel %u Base Address: %04x\n", tag(), channel, m_channel[channel].m_base_address);
+ LOG("AM9517A Channel %u Base Address: %04x\n", channel, m_channel[channel].m_base_address);
break;
case REGISTER_WORD_COUNT:
@@ -909,7 +806,7 @@ WRITE8_MEMBER( am9517a_device::write )
m_channel[channel].m_count = (m_channel[channel].m_count & 0xff00) | data;
}
- if (LOG) logerror("AM9517A '%s' Channel %u Base Word Count: %04x\n", tag(), channel, m_channel[channel].m_base_count);
+ LOG("AM9517A Channel %u Base Word Count: %04x\n", channel, m_channel[channel].m_base_count);
break;
}
@@ -922,7 +819,7 @@ WRITE8_MEMBER( am9517a_device::write )
case REGISTER_COMMAND:
m_command = data;
- if (LOG) logerror("AM9517A '%s' Command Register: %02x\n", tag(), m_command);
+ LOG("AM9517A Command Register: %02x\n", m_command);
break;
case REGISTER_REQUEST:
@@ -942,7 +839,7 @@ WRITE8_MEMBER( am9517a_device::write )
m_request &= ~(1 << (channel + 4));
}
- if (LOG) logerror("AM9517A '%s' Request Register: %01x\n", tag(), m_request);
+ LOG("AM9517A Request Register: %01x\n", m_request);
}
break;
@@ -959,7 +856,7 @@ WRITE8_MEMBER( am9517a_device::write )
m_mask &= ~(1 << channel);
}
- if (LOG) logerror("AM9517A '%s' Mask Register: %01x\n", tag(), m_mask);
+ LOG("AM9517A Mask Register: %01x\n", m_mask);
}
break;
@@ -972,24 +869,24 @@ WRITE8_MEMBER( am9517a_device::write )
// clear terminal count
m_status &= ~(1 << channel);
- if (LOG) logerror("AM9517A '%s' Channel %u Mode: %02x\n", tag(), channel, data & 0xfc);
+ LOG("AM9517A Channel %u Mode: %02x\n", channel, data & 0xfc);
}
break;
case REGISTER_BYTE_POINTER:
- if (LOG) logerror("AM9517A '%s' Clear Byte Pointer Flip-Flop\n", tag());
+ LOG("AM9517A Clear Byte Pointer Flip-Flop\n");
m_msb = 0;
break;
case REGISTER_MASTER_CLEAR:
- if (LOG) logerror("AM9517A '%s' Master Clear\n", tag());
+ LOG("AM9517A Master Clear\n");
device_reset();
break;
case REGISTER_CLEAR_MASK:
- if (LOG) logerror("AM9517A '%s' Clear Mask Register\n", tag());
+ LOG("AM9517A Clear Mask Register\n");
m_mask = 0;
break;
@@ -997,7 +894,7 @@ WRITE8_MEMBER( am9517a_device::write )
case REGISTER_MASK:
m_mask = data & 0x0f;
- if (LOG) logerror("AM9517A '%s' Mask Register: %01x\n", tag(), m_mask);
+ LOG("AM9517A Mask Register: %01x\n", m_mask);
break;
}
}
@@ -1011,7 +908,7 @@ WRITE8_MEMBER( am9517a_device::write )
WRITE_LINE_MEMBER( am9517a_device::hack_w )
{
- if (LOG) logerror("AM9517A '%s' Hold Acknowledge: %u\n", tag(), state);
+ LOG("AM9517A Hold Acknowledge: %u\n", state);
m_hack = state;
trigger(1);
@@ -1024,7 +921,7 @@ WRITE_LINE_MEMBER( am9517a_device::hack_w )
WRITE_LINE_MEMBER( am9517a_device::ready_w )
{
- if (LOG) logerror("AM9517A '%s' Ready: %u\n", tag(), state);
+ LOG("AM9517A Ready: %u\n", state);
m_ready = state;
}
@@ -1036,7 +933,7 @@ WRITE_LINE_MEMBER( am9517a_device::ready_w )
WRITE_LINE_MEMBER( am9517a_device::eop_w )
{
- if (LOG) logerror("AM9517A '%s' End of Process: %u\n", tag(), state);
+ LOG("AM9517A End of Process: %u\n", state);
}
@@ -1109,7 +1006,7 @@ READ8_MEMBER(upd71071_v53_device::read)
uint8_t ret = 0;
int channel = m_selected_channel;
- if (LOG) logerror("DMA: read from register %02x\n",offset);
+ LOG("DMA: read from register %02x\n",offset);
switch (offset)
{
diff --git a/src/devices/machine/am9517a.h b/src/devices/machine/am9517a.h
index 955467fbfba..7e92a5ed38e 100644
--- a/src/devices/machine/am9517a.h
+++ b/src/devices/machine/am9517a.h
@@ -29,10 +29,10 @@
***************************************************************************/
-#pragma once
+#ifndef MAME_MACHINE_AM9517_H
+#define MAME_MACHINE_AM9517_H
-#ifndef __AM9517A__
-#define __AM9517A__
+#pragma once
@@ -49,29 +49,17 @@ class am9517a_device : public device_t,
public:
// construction/destruction
- am9517a_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname);
am9517a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- template<class _Object> static devcb_base &set_out_hreq_callback(device_t &device, _Object object) { return downcast<am9517a_device &>(device).m_out_hreq_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_out_eop_callback(device_t &device, _Object object) { return downcast<am9517a_device &>(device).m_out_eop_cb.set_callback(object); }
-
- template<class _Object> static devcb_base &set_in_memr_callback(device_t &device, _Object object) { return downcast<am9517a_device &>(device).m_in_memr_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_out_memw_callback(device_t &device, _Object object) { return downcast<am9517a_device &>(device).m_out_memw_cb.set_callback(object); }
+ template <class Object> static devcb_base &set_out_hreq_callback(device_t &device, Object &&cb) { return downcast<am9517a_device &>(device).m_out_hreq_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_out_eop_callback(device_t &device, Object &&cb) { return downcast<am9517a_device &>(device).m_out_eop_cb.set_callback(std::forward<Object>(cb)); }
- template<class _Object> static devcb_base &set_in_ior_0_callback(device_t &device, _Object object) { return downcast<am9517a_device &>(device).m_in_ior_0_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_in_ior_1_callback(device_t &device, _Object object) { return downcast<am9517a_device &>(device).m_in_ior_1_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_in_ior_2_callback(device_t &device, _Object object) { return downcast<am9517a_device &>(device).m_in_ior_2_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_in_ior_3_callback(device_t &device, _Object object) { return downcast<am9517a_device &>(device).m_in_ior_3_cb.set_callback(object); }
+ template <class Object> static devcb_base &set_in_memr_callback(device_t &device, Object &&cb) { return downcast<am9517a_device &>(device).m_in_memr_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_out_memw_callback(device_t &device, Object &&cb) { return downcast<am9517a_device &>(device).m_out_memw_cb.set_callback(std::forward<Object>(cb)); }
- template<class _Object> static devcb_base &set_out_iow_0_callback(device_t &device, _Object object) { return downcast<am9517a_device &>(device).m_out_iow_0_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_out_iow_1_callback(device_t &device, _Object object) { return downcast<am9517a_device &>(device).m_out_iow_1_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_out_iow_2_callback(device_t &device, _Object object) { return downcast<am9517a_device &>(device).m_out_iow_2_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_out_iow_3_callback(device_t &device, _Object object) { return downcast<am9517a_device &>(device).m_out_iow_3_cb.set_callback(object); }
-
- template<class _Object> static devcb_base &set_out_dack_0_callback(device_t &device, _Object object) { return downcast<am9517a_device &>(device).m_out_dack_0_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_out_dack_1_callback(device_t &device, _Object object) { return downcast<am9517a_device &>(device).m_out_dack_1_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_out_dack_2_callback(device_t &device, _Object object) { return downcast<am9517a_device &>(device).m_out_dack_2_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_out_dack_3_callback(device_t &device, _Object object) { return downcast<am9517a_device &>(device).m_out_dack_3_cb.set_callback(object); }
+ template <unsigned C, class Object> static devcb_base &set_in_ior_callback(device_t &device, Object &&cb) { return downcast<am9517a_device &>(device).m_in_ior_cb[C].set_callback(std::forward<Object>(cb)); }
+ template <unsigned C, class Object> static devcb_base &set_out_iow_callback(device_t &device, Object &&cb) { return downcast<am9517a_device &>(device).m_out_iow_cb[C].set_callback(std::forward<Object>(cb)); }
+ template <unsigned C, class Object> static devcb_base &set_out_dack_callback(device_t &device, Object &&cb) { return downcast<am9517a_device &>(device).m_out_dack_cb[C].set_callback(std::forward<Object>(cb)); }
virtual DECLARE_READ8_MEMBER( read );
virtual DECLARE_WRITE8_MEMBER( write );
@@ -86,6 +74,8 @@ public:
DECLARE_WRITE_LINE_MEMBER( dreq3_w );
protected:
+ am9517a_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;
@@ -137,23 +127,9 @@ private:
devcb_read8 m_in_memr_cb;
devcb_write8 m_out_memw_cb;
- devcb_read8 m_in_ior_0_cb;
- devcb_read8 m_in_ior_1_cb;
- devcb_read8 m_in_ior_2_cb;
- devcb_read8 m_in_ior_3_cb;
- devcb_write8 m_out_iow_0_cb;
- devcb_write8 m_out_iow_1_cb;
- devcb_write8 m_out_iow_2_cb;
- devcb_write8 m_out_iow_3_cb;
- devcb_write_line m_out_dack_0_cb;
- devcb_write_line m_out_dack_1_cb;
- devcb_write_line m_out_dack_2_cb;
- devcb_write_line m_out_dack_3_cb;
-
-
-
-
-
+ devcb_read8 m_in_ior_cb[4];
+ devcb_write8 m_out_iow_cb[4];
+ devcb_write_line m_out_dack_cb[4];
};
@@ -193,9 +169,9 @@ protected:
// device type definition
-extern const device_type AM9517A;
-extern const device_type V53_DMAU;
-extern const device_type PCXPORT_DMAC;
+DECLARE_DEVICE_TYPE(AM9517A, am9517a_device)
+DECLARE_DEVICE_TYPE(V53_DMAU, upd71071_v53_device)
+DECLARE_DEVICE_TYPE(PCXPORT_DMAC, pcxport_dmac_device)
/***************************************************************************
@@ -215,40 +191,40 @@ extern const device_type PCXPORT_DMAC;
devcb = &am9517a_device::set_out_memw_callback(*device, DEVCB_##_devcb);
#define MCFG_AM9517A_IN_IOR_0_CB(_devcb) \
- devcb = &am9517a_device::set_in_ior_0_callback(*device, DEVCB_##_devcb);
+ devcb = &am9517a_device::set_in_ior_callback<0>(*device, DEVCB_##_devcb);
#define MCFG_AM9517A_IN_IOR_1_CB(_devcb) \
- devcb = &am9517a_device::set_in_ior_1_callback(*device, DEVCB_##_devcb);
+ devcb = &am9517a_device::set_in_ior_callback<1>(*device, DEVCB_##_devcb);
#define MCFG_AM9517A_IN_IOR_2_CB(_devcb) \
- devcb = &am9517a_device::set_in_ior_2_callback(*device, DEVCB_##_devcb);
+ devcb = &am9517a_device::set_in_ior_callback<2>(*device, DEVCB_##_devcb);
#define MCFG_AM9517A_IN_IOR_3_CB(_devcb) \
- devcb = &am9517a_device::set_in_ior_3_callback(*device, DEVCB_##_devcb);
+ devcb = &am9517a_device::set_in_ior_callback<3>(*device, DEVCB_##_devcb);
#define MCFG_AM9517A_OUT_IOW_0_CB(_devcb) \
- devcb = &am9517a_device::set_out_iow_0_callback(*device, DEVCB_##_devcb);
+ devcb = &am9517a_device::set_out_iow_callback<0>(*device, DEVCB_##_devcb);
#define MCFG_AM9517A_OUT_IOW_1_CB(_devcb) \
- devcb = &am9517a_device::set_out_iow_1_callback(*device, DEVCB_##_devcb);
+ devcb = &am9517a_device::set_out_iow_callback<1>(*device, DEVCB_##_devcb);
#define MCFG_AM9517A_OUT_IOW_2_CB(_devcb) \
- devcb = &am9517a_device::set_out_iow_2_callback(*device, DEVCB_##_devcb);
+ devcb = &am9517a_device::set_out_iow_callback<2>(*device, DEVCB_##_devcb);
#define MCFG_AM9517A_OUT_IOW_3_CB(_devcb) \
- devcb = &am9517a_device::set_out_iow_3_callback(*device, DEVCB_##_devcb);
+ devcb = &am9517a_device::set_out_iow_callback<3>(*device, DEVCB_##_devcb);
#define MCFG_AM9517A_OUT_DACK_0_CB(_devcb) \
- devcb = &am9517a_device::set_out_dack_0_callback(*device, DEVCB_##_devcb);
+ devcb = &am9517a_device::set_out_dack_callback<0>(*device, DEVCB_##_devcb);
#define MCFG_AM9517A_OUT_DACK_1_CB(_devcb) \
- devcb = &am9517a_device::set_out_dack_1_callback(*device, DEVCB_##_devcb);
+ devcb = &am9517a_device::set_out_dack_callback<1>(*device, DEVCB_##_devcb);
#define MCFG_AM9517A_OUT_DACK_2_CB(_devcb) \
- devcb = &am9517a_device::set_out_dack_2_callback(*device, DEVCB_##_devcb);
+ devcb = &am9517a_device::set_out_dack_callback<2>(*device, DEVCB_##_devcb);
#define MCFG_AM9517A_OUT_DACK_3_CB(_devcb) \
- devcb = &am9517a_device::set_out_dack_3_callback(*device, DEVCB_##_devcb);
+ devcb = &am9517a_device::set_out_dack_callback<3>(*device, DEVCB_##_devcb);
#define MCFG_I8237_OUT_HREQ_CB MCFG_AM9517A_OUT_HREQ_CB
#define MCFG_I8237_OUT_EOP_CB MCFG_AM9517A_OUT_EOP_CB
@@ -267,4 +243,4 @@ extern const device_type PCXPORT_DMAC;
#define MCFG_I8237_OUT_DACK_2_CB MCFG_AM9517A_OUT_DACK_2_CB
#define MCFG_I8237_OUT_DACK_3_CB MCFG_AM9517A_OUT_DACK_3_CB
-#endif
+#endif // MAME_MACHINE_AM9517_H
diff --git a/src/devices/machine/amigafdc.cpp b/src/devices/machine/amigafdc.cpp
index 188221d0052..8f8fc47c337 100644
--- a/src/devices/machine/amigafdc.cpp
+++ b/src/devices/machine/amigafdc.cpp
@@ -12,19 +12,20 @@
#include "formats/ami_dsk.h"
#include "amigafdc.h"
-const device_type AMIGA_FDC = device_creator<amiga_fdc>;
+DEFINE_DEVICE_TYPE(AMIGA_FDC, amiga_fdc_device, "amiga_fdc", "Amiga FDC")
-FLOPPY_FORMATS_MEMBER( amiga_fdc::floppy_formats )
+FLOPPY_FORMATS_MEMBER( amiga_fdc_device::floppy_formats )
FLOPPY_ADF_FORMAT
FLOPPY_FORMATS_END
-amiga_fdc::amiga_fdc(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, AMIGA_FDC, "Amiga FDC", tag, owner, clock, "amiga_fdc", __FILE__),
- m_write_index(*this), floppy(nullptr), t_gen(nullptr), dsklen(0), pre_dsklen(0), dsksync(0), dskbyt(0), adkcon(0), dmacon(0), dskpt(0), dma_value(0), dma_state(0)
+amiga_fdc_device::amiga_fdc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ device_t(mconfig, AMIGA_FDC, tag, owner, clock),
+ m_write_index(*this),
+ floppy(nullptr), t_gen(nullptr), dsklen(0), pre_dsklen(0), dsksync(0), dskbyt(0), adkcon(0), dmacon(0), dskpt(0), dma_value(0), dma_state(0)
{
}
-void amiga_fdc::device_start()
+void amiga_fdc_device::device_start()
{
m_write_index.resolve_safe();
@@ -43,7 +44,7 @@ void amiga_fdc::device_start()
}
-void amiga_fdc::device_reset()
+void amiga_fdc_device::device_reset()
{
floppy = nullptr;
dsklen = 0x4000;
@@ -59,7 +60,7 @@ void amiga_fdc::device_reset()
live_abort();
}
-void amiga_fdc::dma_done()
+void amiga_fdc_device::dma_done()
{
amiga_state *state = machine().driver_data<amiga_state>();
if(dskbyt & 0x2000) {
@@ -71,7 +72,7 @@ void amiga_fdc::dma_done()
state->custom_chip_w(REG_INTREQ, INTENA_SETCLR | INTENA_DSKBLK);
}
-void amiga_fdc::dma_write(uint16_t value)
+void amiga_fdc_device::dma_write(uint16_t value)
{
amiga_state *state = machine().driver_data<amiga_state>();
state->chip_ram_w(dskpt, value);
@@ -85,7 +86,7 @@ void amiga_fdc::dma_write(uint16_t value)
dma_done();
}
-uint16_t amiga_fdc::dma_read()
+uint16_t amiga_fdc_device::dma_read()
{
amiga_state *state = machine().driver_data<amiga_state>();
uint16_t res = state->chip_ram_r(dskpt);
@@ -102,7 +103,7 @@ uint16_t amiga_fdc::dma_read()
return res;
}
-void amiga_fdc::live_start()
+void amiga_fdc_device::live_start()
{
cur_live.tm = machine().time();
cur_live.state = RUNNING;
@@ -116,25 +117,25 @@ void amiga_fdc::live_start()
live_run();
}
-void amiga_fdc::checkpoint()
+void amiga_fdc_device::checkpoint()
{
cur_live.pll.commit(floppy, cur_live.tm);
checkpoint_live = cur_live;
}
-void amiga_fdc::rollback()
+void amiga_fdc_device::rollback()
{
cur_live = checkpoint_live;
}
-void amiga_fdc::live_delay(int state)
+void amiga_fdc_device::live_delay(int state)
{
cur_live.next_state = state;
if(cur_live.tm != machine().time())
t_gen->adjust(cur_live.tm - machine().time());
}
-void amiga_fdc::live_sync()
+void amiga_fdc_device::live_sync()
{
if(!cur_live.tm.is_never()) {
if(cur_live.tm > machine().time()) {
@@ -159,7 +160,7 @@ void amiga_fdc::live_sync()
}
}
-void amiga_fdc::live_abort()
+void amiga_fdc_device::live_abort()
{
if(!cur_live.tm.is_never() && cur_live.tm > machine().time()) {
rollback();
@@ -172,7 +173,7 @@ void amiga_fdc::live_abort()
cur_live.next_state = -1;
}
-void amiga_fdc::live_run(const attotime &limit)
+void amiga_fdc_device::live_run(const attotime &limit)
{
amiga_state *state = machine().driver_data<amiga_state>();
@@ -199,7 +200,7 @@ void amiga_fdc::live_run(const attotime &limit)
}
if(cur_live.bit_counter > 8)
- fatalerror("amiga_fdc::live_run - cur_live.bit_counter > 8\n");
+ fatalerror("amiga_fdc_device::live_run - cur_live.bit_counter > 8\n");
if(cur_live.bit_counter == 8) {
live_delay(RUNNING_SYNCPOINT);
@@ -222,7 +223,7 @@ void amiga_fdc::live_run(const attotime &limit)
return;
cur_live.bit_counter++;
if(cur_live.bit_counter > 8)
- fatalerror("amiga_fdc::live_run - cur_live.bit_counter > 8\n");
+ fatalerror("amiga_fdc_device::live_run - cur_live.bit_counter > 8\n");
if(cur_live.bit_counter == 8) {
live_delay(RUNNING_SYNCPOINT);
@@ -284,7 +285,7 @@ void amiga_fdc::live_run(const attotime &limit)
}
} else {
if(cur_live.bit_counter != 8)
- fatalerror("amiga_fdc::live_run - cur_live.bit_counter != 8\n");
+ fatalerror("amiga_fdc_device::live_run - cur_live.bit_counter != 8\n");
cur_live.bit_counter = 0;
switch(dma_state) {
@@ -311,12 +312,12 @@ void amiga_fdc::live_run(const attotime &limit)
}
}
-bool amiga_fdc::dma_enabled()
+bool amiga_fdc_device::dma_enabled()
{
return (dsklen & 0x8000) && ((dmacon & 0x0210) == 0x0210);
}
-void amiga_fdc::dma_check()
+void amiga_fdc_device::dma_check()
{
bool was_writing = dskbyt & 0x2000;
dskbyt &= 0x9fff;
@@ -347,19 +348,19 @@ void amiga_fdc::dma_check()
}
-void amiga_fdc::adkcon_set(uint16_t data)
+void amiga_fdc_device::adkcon_set(uint16_t data)
{
live_sync();
adkcon = data;
live_run();
}
-uint16_t amiga_fdc::adkcon_r(void)
+uint16_t amiga_fdc_device::adkcon_r(void)
{
return adkcon;
}
-void amiga_fdc::dsklen_w(uint16_t data)
+void amiga_fdc_device::dsklen_w(uint16_t data)
{
live_sync();
if(!(data & 0x8000) || (data == pre_dsklen)) {
@@ -371,38 +372,38 @@ void amiga_fdc::dsklen_w(uint16_t data)
live_run();
}
-void amiga_fdc::dskpth_w(uint16_t data)
+void amiga_fdc_device::dskpth_w(uint16_t data)
{
live_sync();
dskpt = (dskpt & 0xffff) | (data << 16);
live_run();
}
-void amiga_fdc::dskptl_w(uint16_t data)
+void amiga_fdc_device::dskptl_w(uint16_t data)
{
live_sync();
dskpt = (dskpt & 0xffff0000) | data;
live_run();
}
-uint16_t amiga_fdc::dskpth_r()
+uint16_t amiga_fdc_device::dskpth_r()
{
return dskpt >> 16;
}
-uint16_t amiga_fdc::dskptl_r()
+uint16_t amiga_fdc_device::dskptl_r()
{
return dskpt;
}
-void amiga_fdc::dsksync_w(uint16_t data)
+void amiga_fdc_device::dsksync_w(uint16_t data)
{
live_sync();
dsksync = data;
live_run();
}
-void amiga_fdc::dmacon_set(uint16_t data)
+void amiga_fdc_device::dmacon_set(uint16_t data)
{
live_sync();
dmacon = data;
@@ -410,20 +411,20 @@ void amiga_fdc::dmacon_set(uint16_t data)
live_run();
}
-uint16_t amiga_fdc::dskbytr_r()
+uint16_t amiga_fdc_device::dskbytr_r()
{
uint16_t res = dskbyt;
dskbyt &= 0x7fff;
return res;
}
-void amiga_fdc::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+void amiga_fdc_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
live_sync();
live_run();
}
-void amiga_fdc::setup_leds()
+void amiga_fdc_device::setup_leds()
{
if(floppy) {
int drive =
@@ -442,7 +443,7 @@ void amiga_fdc::setup_leds()
}
}
-WRITE8_MEMBER( amiga_fdc::ciaaprb_w )
+WRITE8_MEMBER( amiga_fdc_device::ciaaprb_w )
{
floppy_image_device *old_floppy = floppy;
@@ -463,7 +464,7 @@ WRITE8_MEMBER( amiga_fdc::ciaaprb_w )
if(old_floppy)
old_floppy->setup_index_pulse_cb(floppy_image_device::index_pulse_cb());
if(floppy)
- floppy->setup_index_pulse_cb(floppy_image_device::index_pulse_cb(&amiga_fdc::index_callback, this));
+ floppy->setup_index_pulse_cb(floppy_image_device::index_pulse_cb(&amiga_fdc_device::index_callback, this));
}
if(floppy) {
@@ -484,7 +485,7 @@ WRITE8_MEMBER( amiga_fdc::ciaaprb_w )
live_run();
}
-uint8_t amiga_fdc::ciaapra_r()
+uint8_t amiga_fdc_device::ciaapra_r()
{
uint8_t ret = 0x3c;
if(floppy) {
@@ -501,19 +502,19 @@ uint8_t amiga_fdc::ciaapra_r()
return ret;
}
-void amiga_fdc::index_callback(floppy_image_device *floppy, int state)
+void amiga_fdc_device::index_callback(floppy_image_device *floppy, int state)
{
/* Issue a index pulse when a disk revolution completes */
m_write_index(!state);
}
-void amiga_fdc::pll_t::set_clock(const attotime &period)
+void amiga_fdc_device::pll_t::set_clock(const attotime &period)
{
for(int i=0; i<38; i++)
delays[i] = period*(i+1);
}
-void amiga_fdc::pll_t::reset(const attotime &when)
+void amiga_fdc_device::pll_t::reset(const attotime &when)
{
counter = 0;
increment = 146;
@@ -527,7 +528,7 @@ void amiga_fdc::pll_t::reset(const attotime &when)
freq_sub = 0x00;
}
-int amiga_fdc::pll_t::get_next_bit(attotime &tm, floppy_image_device *floppy, const attotime &limit)
+int amiga_fdc_device::pll_t::get_next_bit(attotime &tm, floppy_image_device *floppy, const attotime &limit)
{
attotime when = floppy ? floppy->get_next_transition(ctime) : attotime::never;
@@ -601,19 +602,19 @@ int amiga_fdc::pll_t::get_next_bit(attotime &tm, floppy_image_device *floppy, co
return bit;
}
-void amiga_fdc::pll_t::start_writing(const attotime & tm)
+void amiga_fdc_device::pll_t::start_writing(const attotime & tm)
{
write_start_time = tm;
write_position = 0;
}
-void amiga_fdc::pll_t::stop_writing(floppy_image_device *floppy, const attotime &tm)
+void amiga_fdc_device::pll_t::stop_writing(floppy_image_device *floppy, const attotime &tm)
{
commit(floppy, tm);
write_start_time = attotime::never;
}
-bool amiga_fdc::pll_t::write_next_bit(bool bit, attotime &tm, floppy_image_device *floppy, const attotime &limit)
+bool amiga_fdc_device::pll_t::write_next_bit(bool bit, attotime &tm, floppy_image_device *floppy, const attotime &limit)
{
if(write_start_time.is_never()) {
write_start_time = ctime;
@@ -644,7 +645,7 @@ bool amiga_fdc::pll_t::write_next_bit(bool bit, attotime &tm, floppy_image_devic
}
-void amiga_fdc::pll_t::commit(floppy_image_device *floppy, const attotime &tm)
+void amiga_fdc_device::pll_t::commit(floppy_image_device *floppy, const attotime &tm)
{
if(write_start_time.is_never() || tm == write_start_time)
return;
diff --git a/src/devices/machine/amigafdc.h b/src/devices/machine/amigafdc.h
index 0d3846301df..b0e18debc69 100644
--- a/src/devices/machine/amigafdc.h
+++ b/src/devices/machine/amigafdc.h
@@ -1,18 +1,20 @@
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert
-#ifndef AMIGAFDC_H
-#define AMIGAFDC_H
+#ifndef MAME_MACHINE_AMIGAFDC_H
+#define MAME_MACHINE_AMIGAFDC_H
+
+#pragma once
#include "imagedev/floppy.h"
#define MCFG_AMIGA_FDC_INDEX_CALLBACK(_write) \
- devcb = &amiga_fdc::set_index_wr_callback(*device, DEVCB_##_write);
+ devcb = &amiga_fdc_device::set_index_wr_callback(*device, DEVCB_##_write);
-class amiga_fdc : public device_t {
+class amiga_fdc_device : public device_t {
public:
- amiga_fdc(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ amiga_fdc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- template<class _Object> static devcb_base &set_index_wr_callback(device_t &device, _Object object) { return downcast<amiga_fdc &>(device).m_write_index.set_callback(object); }
+ template <class Object> static devcb_base &set_index_wr_callback(device_t &device, Object &&cb) { return downcast<amiga_fdc_device &>(device).m_write_index.set_callback(std::forward<Object>(cb)); }
DECLARE_WRITE8_MEMBER(ciaaprb_w);
@@ -115,6 +117,6 @@ private:
void live_run(const attotime &limit = attotime::never);
};
-extern const device_type AMIGA_FDC;
+DECLARE_DEVICE_TYPE(AMIGA_FDC, amiga_fdc_device)
-#endif /* AMIGAFDC_H */
+#endif // MAME_MACHINE_AMIGAFDC_H
diff --git a/src/devices/machine/appldriv.cpp b/src/devices/machine/appldriv.cpp
index ef6a46dfb6d..1d207a9ab0b 100644
--- a/src/devices/machine/appldriv.cpp
+++ b/src/devices/machine/appldriv.cpp
@@ -24,7 +24,7 @@ static inline apple525_floppy_image_device *get_device(device_t *device)
assert(device != nullptr);
assert(device->type() == FLOPPY_APPLE);
- return (apple525_floppy_image_device *) downcast<apple525_floppy_image_device *>(device);
+ return downcast<apple525_floppy_image_device *>(device);
}
static int apple525_enable_mask = 1;
@@ -56,7 +56,7 @@ device_t *apple525_get_device_by_type(device_t *device, int ftype, int drive)
return nullptr;
}
-void apple525_set_enable_lines(device_t *device,int enable_mask)
+void apple525_set_enable_lines(device_t *device, int enable_mask)
{
apple525_enable_mask = enable_mask;
}
@@ -291,14 +291,14 @@ int apple525_read_status(device_t *device)
}
// device type definition
-const device_type FLOPPY_APPLE = device_creator<apple525_floppy_image_device>;
+DEFINE_DEVICE_TYPE(FLOPPY_APPLE, apple525_floppy_image_device, "floppy_apple", "Apple Disk II")
//-------------------------------------------------
// apple525_floppy_image_device - constructor
//-------------------------------------------------
apple525_floppy_image_device::apple525_floppy_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : legacy_floppy_image_device(mconfig, FLOPPY_APPLE, "Apple Disk II", tag, owner, clock, "floppy_apple", __FILE__)
+ : legacy_floppy_image_device(mconfig, FLOPPY_APPLE, tag, owner, clock)
{
}
diff --git a/src/devices/machine/appldriv.h b/src/devices/machine/appldriv.h
index acb85020189..3765705f625 100644
--- a/src/devices/machine/appldriv.h
+++ b/src/devices/machine/appldriv.h
@@ -8,21 +8,23 @@
*********************************************************************/
-#ifndef APPLDRIV_H
-#define APPLDRIV_H
+#ifndef MAME_MACHINE_APPLDRIV_H
+#define MAME_MACHINE_APPLDRIV_H
+
+#pragma once
#include "imagedev/flopdrv.h"
#include "formats/ap2_dsk.h"
-void apple525_set_lines(device_t *device,uint8_t lines);
-void apple525_set_enable_lines(device_t *device,int enable_mask);
+void apple525_set_lines(device_t *device, uint8_t lines);
+void apple525_set_enable_lines(device_t *device, int enable_mask);
uint8_t apple525_read_data(device_t *device);
-void apple525_write_data(device_t *device,uint8_t data);
+void apple525_write_data(device_t *device, uint8_t data);
int apple525_read_status(device_t *device);
int apple525_get_count(running_machine &machine);
-class apple525_floppy_image_device : public legacy_floppy_image_device
+class apple525_floppy_image_device : public legacy_floppy_image_device
{
public:
// construction/destruction
@@ -30,7 +32,7 @@ public:
virtual image_init_result call_load() override;
virtual void call_unload() override;
- void set_params(int dividend, int divisor) { m_dividend = dividend; m_divisor = divisor;}
+ void set_params(int dividend, int divisor) { m_dividend = dividend; m_divisor = divisor; }
int get_dividend() { return m_dividend; }
int get_divisor() { return m_divisor; }
@@ -53,7 +55,7 @@ private:
};
// device type definition
-extern const device_type FLOPPY_APPLE;
+DECLARE_DEVICE_TYPE(FLOPPY_APPLE, apple525_floppy_image_device)
#define MCFG_LEGACY_FLOPPY_APPLE_PARAMS(_dividend,_divisor) \
downcast<apple525_floppy_image_device *>(device)->set_params(_dividend,_divisor);
@@ -84,4 +86,4 @@ extern const device_type FLOPPY_APPLE;
MCFG_DEVICE_REMOVE(FLOPPY_0) \
MCFG_DEVICE_REMOVE(FLOPPY_1)
-#endif /* APPLDRIV_H */
+#endif // MAME_MACHINE_APPLDRIV_H
diff --git a/src/devices/machine/applefdc.cpp b/src/devices/machine/applefdc.cpp
index 6d9d10fbd13..681dcc525ed 100644
--- a/src/devices/machine/applefdc.cpp
+++ b/src/devices/machine/applefdc.cpp
@@ -106,8 +106,8 @@ enum
// ctor
//-------------------------------------------------
-applefdc_base_device::applefdc_base_device(applefdc_base_device::applefdc_t fdc_type, const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source)
- : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
+applefdc_base_device::applefdc_base_device(applefdc_base_device::applefdc_t fdc_type, const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
+ : device_t(mconfig, type, tag, owner, clock),
m_type(fdc_type),
m_interface(nullptr)
{
@@ -565,10 +565,10 @@ uint8_t applefdc_base_device::get_lines()
APPLE FDC - Used on Apple II
***************************************************************************/
-const device_type APPLEFDC = device_creator<applefdc_device>;
+DEFINE_DEVICE_TYPE(APPLEFDC, applefdc_device, "apple_fdc", "Apple FDC")
applefdc_device::applefdc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : applefdc_base_device(APPLEFDC_APPLE2, mconfig, APPLEFDC, "Apple FDC", tag, owner, clock, "apple_fdc", __FILE__)
+ : applefdc_base_device(APPLEFDC_APPLE2, mconfig, APPLEFDC, tag, owner, clock)
{
}
@@ -578,9 +578,9 @@ applefdc_device::applefdc_device(const machine_config &mconfig, const char *tag,
IWM - Used on early Macs
***************************************************************************/
-const device_type IWM = device_creator<iwm_device>;
+DEFINE_DEVICE_TYPE(IWM, iwm_device, "iwm", "Apple IWM (Integrated Woz Machine)")
iwm_device::iwm_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : applefdc_base_device(APPLEFDC_IWM, mconfig, IWM, "Apple IWM (Integrated Woz Machine)", tag, owner, clock, "iwm", __FILE__)
+ : applefdc_base_device(APPLEFDC_IWM, mconfig, IWM, tag, owner, clock)
{
}
diff --git a/src/devices/machine/applefdc.h b/src/devices/machine/applefdc.h
index dd0e1279b08..f6f9f05fcf9 100644
--- a/src/devices/machine/applefdc.h
+++ b/src/devices/machine/applefdc.h
@@ -14,9 +14,10 @@
*********************************************************************/
-#ifndef __APPLEFDC_H__
-#define __APPLEFDC_H__
+#ifndef MAME_MACHINE_APPLEFDC_H
+#define MAME_MACHINE_APPLEFDC_H
+#pragma once
@@ -29,9 +30,8 @@
#define APPLEFDC_PH2 0x04
#define APPLEFDC_PH3 0x08
-extern const device_type APPLEFDC;
-extern const device_type IWM;
-extern const device_type SWIM;
+DECLARE_DEVICE_TYPE(APPLEFDC, applefdc_device)
+DECLARE_DEVICE_TYPE(IWM, iwm_device)
@@ -83,7 +83,7 @@ protected:
};
// constructor
- applefdc_base_device(applefdc_t fdc_type, const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source);
+ applefdc_base_device(applefdc_t fdc_type, const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
virtual void device_start() override;
@@ -166,4 +166,4 @@ public:
MCFG_APPLEFDC_CONFIG(_intrf)
-#endif /* __APPLEFDC_H__ */
+#endif // MAME_MACHINE_APPLEFDC_H
diff --git a/src/devices/machine/at28c16.cpp b/src/devices/machine/at28c16.cpp
index 1ee69769c6f..06188c190be 100644
--- a/src/devices/machine/at28c16.cpp
+++ b/src/devices/machine/at28c16.cpp
@@ -33,20 +33,20 @@ ADDRESS_MAP_END
//**************************************************************************
// device type definition
-const device_type AT28C16 = device_creator<at28c16_device>;
+DEFINE_DEVICE_TYPE(AT28C16, at28c16_device, "at28c16", "AT28C16 2Kx8 EEPROM")
//-------------------------------------------------
// at28c16_device - constructor
//-------------------------------------------------
-at28c16_device::at28c16_device( const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock )
- : device_t(mconfig, AT28C16, "AT28C16", tag, owner, clock, "at28c16", __FILE__),
+at28c16_device::at28c16_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : device_t(mconfig, AT28C16, tag, owner, clock),
device_memory_interface(mconfig, *this),
device_nvram_interface(mconfig, *this),
- m_space_config("at28c16", ENDIANNESS_BIG, 8, 12, 0, *ADDRESS_MAP_NAME( at28c16_map8 )),
- m_a9_12v( 0 ),
- m_oe_12v( 0 ),
- m_last_write( -1 ),
+ m_space_config("at28c16", ENDIANNESS_BIG, 8, 12, 0, *ADDRESS_MAP_NAME(at28c16_map8)),
+ m_a9_12v(0),
+ m_oe_12v(0),
+ m_last_write(-1),
m_default_data(*this, DEVICE_SELF, AT28C16_DATA_BYTES)
{
}
@@ -57,9 +57,9 @@ at28c16_device::at28c16_device( const machine_config &mconfig, const char *tag,
// any address spaces owned by this device
//-------------------------------------------------
-const address_space_config *at28c16_device::memory_space_config( address_spacenum spacenum ) const
+const address_space_config *at28c16_device::memory_space_config(address_spacenum spacenum) const
{
- return ( spacenum == 0 ) ? &m_space_config : nullptr;
+ return (spacenum == AS_0) ? &m_space_config : nullptr;
}
diff --git a/src/devices/machine/at28c16.h b/src/devices/machine/at28c16.h
index 1d985e5d680..1339a7ce85c 100644
--- a/src/devices/machine/at28c16.h
+++ b/src/devices/machine/at28c16.h
@@ -8,10 +8,10 @@
***************************************************************************/
-#pragma once
+#ifndef MAME_MACHINE_AT28C16_H
+#define MAME_MACHINE_AT28C16_H
-#ifndef __AT28C16_H__
-#define __AT28C16_H__
+#pragma once
//**************************************************************************
@@ -35,7 +35,7 @@ class at28c16_device :
{
public:
// construction/destruction
- at28c16_device( const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock );
+ at28c16_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// I/O operations
DECLARE_WRITE8_MEMBER( write );
@@ -49,12 +49,12 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
// device_memory_interface overrides
- virtual const address_space_config *memory_space_config( address_spacenum spacenum = AS_0 ) const override;
+ virtual const address_space_config *memory_space_config(address_spacenum spacenum) const override;
// device_nvram_interface overrides
virtual void nvram_default() override;
- virtual void nvram_read( emu_file &file ) override;
- virtual void nvram_write( emu_file &file ) override;
+ virtual void nvram_read(emu_file &file) override;
+ virtual void nvram_write(emu_file &file) override;
// internal state
address_space_config m_space_config;
@@ -68,5 +68,6 @@ protected:
// device type definition
extern const device_type AT28C16;
+DECLARE_DEVICE_TYPE(AT28C16, at28c16_device)
-#endif
+#endif // MAME_MACHINE_AT28C16_H
diff --git a/src/devices/machine/at29x.cpp b/src/devices/machine/at29x.cpp
index 2c56a1c45c2..5ca0735649d 100644
--- a/src/devices/machine/at29x.cpp
+++ b/src/devices/machine/at29x.cpp
@@ -55,13 +55,13 @@ enum
Constructor for all variants
*/
-at29x_device::at29x_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source)
- : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
+at29x_device::at29x_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int memory_size, int device_id, int sector_size)
+ : device_t(mconfig, type, tag, owner, clock),
device_nvram_interface(mconfig, *this),
- m_memory_size(0), // bytes
+ m_memory_size(memory_size), // bytes
m_word_width(8),
- m_device_id(0),
- m_sector_size(0),
+ m_device_id(device_id),
+ m_sector_size(sector_size),
m_cycle_time(10), // ms
m_boot_block_size(16*1024),
m_version(0)
@@ -72,33 +72,24 @@ at29x_device::at29x_device(const machine_config &mconfig, device_type type, cons
Constructor for AT29C020
*/
at29c020_device::at29c020_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : at29x_device(mconfig, AT29C020, "ATMEL 29C020 256K x 8 FEEPROM", tag, owner, clock, "at29c020", __FILE__)
+ : at29x_device(mconfig, AT29C020, tag, owner, clock, 256*1024, 0xda, 256)
{
- m_memory_size = 256*1024;
- m_device_id = 0xda;
- m_sector_size = 256;
}
/*
Constructor for AT29C040
*/
at29c040_device::at29c040_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : at29x_device(mconfig, AT29C040, "ATMEL 29C040 512K x 8 FEEPROM", tag, owner, clock, "at29c040", __FILE__)
+ : at29x_device(mconfig, AT29C040, tag, owner, clock, 512*1024, 0x5b, 512)
{
- m_memory_size = 512*1024;
- m_device_id = 0x5b;
- m_sector_size = 512;
}
/*
Constructor for AT29C040A
*/
at29c040a_device::at29c040a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : at29x_device(mconfig, AT29C040A, "ATMEL 29C040A 512K x 8 FEEPROM", tag, owner, clock, "at29c040a", __FILE__)
+ : at29x_device(mconfig, AT29C040A, tag, owner, clock, 512*1024, 0xa4, 256)
{
- m_memory_size = 512*1024;
- m_device_id = 0xa4;
- m_sector_size = 256;
}
@@ -478,7 +469,7 @@ WRITE8_MEMBER( at29x_device::write )
}
}
-void at29x_device::device_start(void)
+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);
@@ -521,6 +512,6 @@ void at29x_device::device_reset(void)
m_programming_last_offset = 0;
}
-const device_type AT29C020 = device_creator<at29c020_device>;
-const device_type AT29C040 = device_creator<at29c040_device>;
-const device_type AT29C040A = device_creator<at29c040a_device>;
+DEFINE_DEVICE_TYPE(AT29C020, at29c020_device, "at29c020", "ATMEL 29C020 256Kx8 FEEPROM")
+DEFINE_DEVICE_TYPE(AT29C040, at29c040_device, "at29c040", "ATMEL 29C040 512Kx8 FEEPROM")
+DEFINE_DEVICE_TYPE(AT29C040A, at29c040a_device, "at29c040a", "ATMEL 29C040A 512Kx8 FEEPROM")
diff --git a/src/devices/machine/at29x.h b/src/devices/machine/at29x.h
index da9b1d8b3e1..bb7711458bf 100644
--- a/src/devices/machine/at29x.h
+++ b/src/devices/machine/at29x.h
@@ -7,37 +7,25 @@
August 2015
*/
-#ifndef __AT29X__
-#define __AT29X__
+#ifndef MAME_MACHINE_AT29X_H
+#define MAME_MACHINE_AT29X_H
+#pragma once
-extern const device_type AT29C020;
-extern const device_type AT29C040;
-extern const device_type AT29C040A;
-enum s_cmd_t
-{
- CMD_0 = 0,
- CMD_1,
- CMD_2
-};
-
-enum s_pgm_t
-{
- PGM_0 = 0,
- PGM_1,
- PGM_2,
- PGM_3
-};
+DECLARE_DEVICE_TYPE(AT29C020, at29c020_device)
+DECLARE_DEVICE_TYPE(AT29C040, at29c040_device)
+DECLARE_DEVICE_TYPE(AT29C040A, at29c040a_device)
class at29x_device : public device_t, public device_nvram_interface
{
public:
- at29x_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source);
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
protected:
+ at29x_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int memory_size, int device_id, int sector_size);
+
virtual void device_start(void) override;
virtual void device_reset(void) override;
virtual void device_stop(void) override;
@@ -49,10 +37,10 @@ protected:
int get_sector_number(offs_t address) { return address / m_sector_size; }
- int m_memory_size; // bytes
+ const int m_memory_size; // bytes
int m_word_width;
- int m_device_id;
- int m_sector_size;
+ const int m_device_id;
+ const int m_sector_size;
int m_cycle_time; // ms
int m_boot_block_size;
int m_version;
@@ -60,6 +48,21 @@ protected:
int m_sector_mask;
private:
+ enum s_cmd_t
+ {
+ CMD_0 = 0,
+ CMD_1,
+ CMD_2
+ };
+
+ enum s_pgm_t
+ {
+ PGM_0 = 0,
+ PGM_1,
+ PGM_2,
+ PGM_3
+ };
+
void sync_flags(void);
std::unique_ptr<uint8_t[]> m_eememory;
@@ -112,4 +115,4 @@ public:
#define MCFG_AT29C040A_ADD(_tag ) \
MCFG_DEVICE_ADD(_tag, AT29C040A, 0)
-#endif
+#endif // MAME_MACHINE_AT29X_H
diff --git a/src/devices/machine/at45dbxx.cpp b/src/devices/machine/at45dbxx.cpp
index e1b44c4ee0e..74fc06b4413 100644
--- a/src/devices/machine/at45dbxx.cpp
+++ b/src/devices/machine/at45dbxx.cpp
@@ -33,9 +33,9 @@
//**************************************************************************
// device type definition
-const device_type AT45DB041 = device_creator<at45db041_device>;
-const device_type AT45DB081 = device_creator<at45db081_device>;
-const device_type AT45DB161 = device_creator<at45db161_device>;
+DEFINE_DEVICE_TYPE(AT45DB041, at45db041_device, "at45db041", "AT45DB041")
+DEFINE_DEVICE_TYPE(AT45DB081, at45db081_device, "at45db081", "AT45DB081")
+DEFINE_DEVICE_TYPE(AT45DB161, at45db161_device, "at45db161", "AT45DB161")
//**************************************************************************
@@ -47,29 +47,27 @@ const device_type AT45DB161 = device_creator<at45db161_device>;
//-------------------------------------------------
at45db041_device::at45db041_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, AT45DB041, "AT45DB041", tag, owner, clock, "at45db041", __FILE__),
- device_nvram_interface(mconfig, *this),
- write_so(*this)
+ : at45db041_device(mconfig, AT45DB041, tag, owner, clock)
{
}
-at45db041_device::at45db041_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source)
- : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
- device_nvram_interface(mconfig, *this),
- write_so(*this)
+at45db041_device::at45db041_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_nvram_interface(mconfig, *this)
+ , write_so(*this)
{
}
at45db081_device::at45db081_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : at45db041_device(mconfig, AT45DB081, "AT45DB081", tag, owner, clock, "at45db081", __FILE__)
+ : at45db041_device(mconfig, AT45DB081, tag, owner, clock)
{
}
at45db161_device::at45db161_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : at45db041_device(mconfig, AT45DB161, "AT45DB161", tag, owner, clock, "at45db161", __FILE__)
+ : at45db041_device(mconfig, AT45DB161, tag, owner, clock)
{
}
diff --git a/src/devices/machine/at45dbxx.h b/src/devices/machine/at45dbxx.h
index 058672d457d..2c26916d2e5 100644
--- a/src/devices/machine/at45dbxx.h
+++ b/src/devices/machine/at45dbxx.h
@@ -12,9 +12,10 @@
*/
-#ifndef _AT45DBXX_H_
-#define _AT45DBXX_H_
+#ifndef MAME_MACHINE_AT45DBXX_H
+#define MAME_MACHINE_AT45DBXX_H
+#pragma once
//**************************************************************************
@@ -41,7 +42,6 @@ class at45db041_device : public device_t,
{
public:
at45db041_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- at45db041_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source);
DECLARE_WRITE_LINE_MEMBER(cs_w);
DECLARE_WRITE_LINE_MEMBER(sck_w);
@@ -50,10 +50,11 @@ public:
uint8_t *get_ptr() { return &m_data[0]; }
- template<class _Object> static devcb_base &set_so_cb(device_t &device, _Object object) { return downcast<at45db041_device &>(device).write_so.set_callback(object); }
- devcb_write_line write_so;
+ template <class Object> static devcb_base &set_so_cb(device_t &device, Object &&cb) { return downcast<at45db041_device &>(device).write_so.set_callback(std::forward<Object>(cb)); }
protected:
+ at45db041_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;
@@ -63,7 +64,6 @@ protected:
virtual void nvram_read(emu_file &file) override;
virtual void nvram_write(emu_file &file) override;
-protected:
virtual int num_pages() const { return 2048; }
virtual int page_size() const { return 264; }
virtual uint8_t device_id() const { return 0x18; }
@@ -74,6 +74,8 @@ protected:
virtual uint32_t flash_get_byte_addr();
void write_byte(uint8_t data);
+ devcb_write_line write_so;
+
// internal state
std::vector<uint8_t> m_data;
uint32_t m_size;
@@ -144,8 +146,8 @@ protected:
// device type definition
-extern const device_type AT45DB041;
-extern const device_type AT45DB081;
-extern const device_type AT45DB161;
+DECLARE_DEVICE_TYPE(AT45DB041, at45db041_device)
+DECLARE_DEVICE_TYPE(AT45DB081, at45db081_device)
+DECLARE_DEVICE_TYPE(AT45DB161, at45db161_device)
-#endif
+#endif // MAME_MACHINE_AT45DBXX_H
diff --git a/src/devices/machine/at_keybc.cpp b/src/devices/machine/at_keybc.cpp
index 2f2b528cb6e..eb43d0003ad 100644
--- a/src/devices/machine/at_keybc.cpp
+++ b/src/devices/machine/at_keybc.cpp
@@ -8,14 +8,13 @@
#include "emu.h"
#include "at_keybc.h"
-#include "cpu/mcs48/mcs48.h"
//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
-const device_type AT_KEYBOARD_CONTROLLER = device_creator<at_keyboard_controller_device>;
+DEFINE_DEVICE_TYPE(AT_KEYBOARD_CONTROLLER, at_keyboard_controller_device, "at_keybc", "AT Keyboard Controller")
static INPUT_PORTS_START( at_keybc )
PORT_START("DSW")
@@ -55,7 +54,7 @@ ROM_END
//-------------------------------------------------
at_keyboard_controller_device::at_keyboard_controller_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, AT_KEYBOARD_CONTROLLER, "AT Keyboard Controller", tag, owner, clock, "at_keybc", __FILE__),
+ : device_t(mconfig, AT_KEYBOARD_CONTROLLER, tag, owner, clock),
m_cpu(nullptr),
m_system_reset_cb(*this),
m_gate_a20_cb(*this),
diff --git a/src/devices/machine/at_keybc.h b/src/devices/machine/at_keybc.h
index 7827517c4b5..7775a836755 100644
--- a/src/devices/machine/at_keybc.h
+++ b/src/devices/machine/at_keybc.h
@@ -6,10 +6,10 @@
***************************************************************************/
-#pragma once
+#ifndef MAME_MACHINE_AT_KEYBC_H
+#define MAME_MACHINE_AT_KEYBC_H
-#ifndef __AT_KEYBC_H__
-#define __AT_KEYBC_H__
+#pragma once
#include "cpu/mcs48/mcs48.h"
@@ -48,12 +48,12 @@ public:
// construction/destruction
at_keyboard_controller_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- template<class _Object> static devcb_base &set_system_reset_callback(device_t &device, _Object object) { return downcast<at_keyboard_controller_device &>(device).m_system_reset_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_gate_a20_callback(device_t &device, _Object object) { return downcast<at_keyboard_controller_device &>(device).m_gate_a20_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_input_buffer_full_callback(device_t &device, _Object object) { return downcast<at_keyboard_controller_device &>(device).m_input_buffer_full_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_output_buffer_empty_callback(device_t &device, _Object object) { return downcast<at_keyboard_controller_device &>(device).m_output_buffer_empty_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_keyboard_clock_callback(device_t &device, _Object object) { return downcast<at_keyboard_controller_device &>(device).m_keyboard_clock_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_keyboard_data_callback(device_t &device, _Object object) { return downcast<at_keyboard_controller_device &>(device).m_keyboard_data_cb.set_callback(object); }
+ template <class Object> static devcb_base &set_system_reset_callback(device_t &device, Object &&cb) { return downcast<at_keyboard_controller_device &>(device).m_system_reset_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_gate_a20_callback(device_t &device, Object &&cb) { return downcast<at_keyboard_controller_device &>(device).m_gate_a20_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_input_buffer_full_callback(device_t &device, Object &&cb) { return downcast<at_keyboard_controller_device &>(device).m_input_buffer_full_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_output_buffer_empty_callback(device_t &device, Object &&cb) { return downcast<at_keyboard_controller_device &>(device).m_output_buffer_empty_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_keyboard_clock_callback(device_t &device, Object &&cb) { return downcast<at_keyboard_controller_device &>(device).m_keyboard_clock_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_keyboard_data_callback(device_t &device, Object &&cb) { return downcast<at_keyboard_controller_device &>(device).m_keyboard_data_cb.set_callback(std::forward<Object>(cb)); }
// internal 8042 interface
DECLARE_READ_LINE_MEMBER( t0_r );
@@ -101,7 +101,6 @@ private:
// device type definition
-extern const device_type AT_KEYBOARD_CONTROLLER;
-
+DECLARE_DEVICE_TYPE(AT_KEYBOARD_CONTROLLER, at_keyboard_controller_device)
-#endif /* __AT_KEYBC__ */
+#endif // MAME_MACHINE_AT_KEYBC_H
diff --git a/src/devices/machine/atadev.cpp b/src/devices/machine/atadev.cpp
index f2f5686c690..03cae8a67ed 100644
--- a/src/devices/machine/atadev.cpp
+++ b/src/devices/machine/atadev.cpp
@@ -10,10 +10,11 @@
#include "atadev.h"
//-------------------------------------------------
-// ata_device_interface - constructor
+// device_ata_interface - constructor
//-------------------------------------------------
-ata_device_interface::ata_device_interface(const machine_config &mconfig, device_t &device) :
+device_ata_interface::device_ata_interface(const machine_config &mconfig, device_t &device) :
+ device_slot_card_interface(mconfig, device),
m_irq_handler(device),
m_dmarq_handler(device),
m_dasp_handler(device),
diff --git a/src/devices/machine/atadev.h b/src/devices/machine/atadev.h
index 8115a6e4dc1..6bd8bc7fde0 100644
--- a/src/devices/machine/atadev.h
+++ b/src/devices/machine/atadev.h
@@ -8,19 +8,21 @@
***************************************************************************/
+#ifndef MAME_MACHINE_ATADEV_H
+#define MAME_MACHINE_ATADEV_H
+
#pragma once
-#ifndef __ATADEV_H__
-#define __ATADEV_H__
+// ======================> device_ata_interface
-// ======================> ata_device_interface
+class ata_interface_device;
-class ata_device_interface
+class device_ata_interface : public device_slot_card_interface
{
+ friend class ata_interface_device;
public:
- ata_device_interface(const machine_config &mconfig, device_t &device);
- virtual ~ata_device_interface() {}
+ device_ata_interface(const machine_config &mconfig, device_t &device);
virtual uint16_t read_dma() = 0;
virtual DECLARE_READ16_MEMBER(read_cs0) = 0;
@@ -34,10 +36,11 @@ public:
virtual DECLARE_WRITE_LINE_MEMBER(write_dasp) = 0;
virtual DECLARE_WRITE_LINE_MEMBER(write_pdiag) = 0;
+protected:
devcb_write_line m_irq_handler;
devcb_write_line m_dmarq_handler;
devcb_write_line m_dasp_handler;
devcb_write_line m_pdiag_handler;
};
-#endif
+#endif // MAME_MACHINE_ATADEV_H
diff --git a/src/devices/machine/ataflash.cpp b/src/devices/machine/ataflash.cpp
index a8e67c06fd5..f3aff7df8c3 100644
--- a/src/devices/machine/ataflash.cpp
+++ b/src/devices/machine/ataflash.cpp
@@ -3,15 +3,15 @@
#include "emu.h"
#include "ataflash.h"
-const device_type ATA_FLASH_PCCARD = device_creator<ata_flash_pccard_device>;
+DEFINE_DEVICE_TYPE(ATA_FLASH_PCCARD, ata_flash_pccard_device, "ataflash", "ATA Flash PC Card")
ata_flash_pccard_device::ata_flash_pccard_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- ide_hdd_device(mconfig, ATA_FLASH_PCCARD, "ATA Flash PCCARD", tag, owner, clock, "ataflash", __FILE__)
+ ata_flash_pccard_device(mconfig, ATA_FLASH_PCCARD, tag, owner, clock)
{
}
-ata_flash_pccard_device::ata_flash_pccard_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source)
- : ide_hdd_device(mconfig, type, name, tag, owner, clock, shortname, source)
+ata_flash_pccard_device::ata_flash_pccard_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
+ : ide_hdd_device(mconfig, type, tag, owner, clock)
{
}
@@ -117,10 +117,10 @@ attotime ata_flash_pccard_device::seek_time()
}
-const device_type TAITO_PCCARD1 = device_creator<taito_pccard1_device>;
+DEFINE_DEVICE_TYPE(TAITO_PCCARD1, taito_pccard1_device, "taito_pccard1", "Taito PC Card (Type 1)")
taito_pccard1_device::taito_pccard1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- ata_flash_pccard_device(mconfig, TAITO_PCCARD1, "Taito PC-CARD (Type 1)", tag, owner, clock, "taito_pccard1", __FILE__),
+ ata_flash_pccard_device(mconfig, TAITO_PCCARD1, tag, owner, clock),
m_locked(0)
{
}
@@ -208,10 +208,10 @@ bool taito_pccard1_device::is_ready()
return m_locked == 0;
}
-const device_type TAITO_PCCARD2 = device_creator<taito_pccard2_device>;
+DEFINE_DEVICE_TYPE(TAITO_PCCARD2, taito_pccard2_device, "taito_pccard2", "Taito PC Card (Type 2)")
taito_pccard2_device::taito_pccard2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- ata_flash_pccard_device(mconfig, TAITO_PCCARD2, "Taito PC-CARD (Type 2)", tag, owner, clock, "taito_pccard2", __FILE__),
+ ata_flash_pccard_device(mconfig, TAITO_PCCARD2, tag, owner, clock),
m_locked(false)
{
}
@@ -307,10 +307,10 @@ bool taito_pccard2_device::is_ready()
return !m_locked;
}
-const device_type TAITO_COMPACT_FLASH = device_creator<taito_compact_flash_device>;
+DEFINE_DEVICE_TYPE(TAITO_COMPACT_FLASH, taito_compact_flash_device, "taito_cf", "Taito Compact Flash")
taito_compact_flash_device::taito_compact_flash_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- ata_flash_pccard_device(mconfig, TAITO_COMPACT_FLASH, "Taito Compact Flash", tag, owner, clock, "taito_cf", __FILE__),
+ ata_flash_pccard_device(mconfig, TAITO_COMPACT_FLASH, tag, owner, clock),
m_locked(false)
{
}
diff --git a/src/devices/machine/ataflash.h b/src/devices/machine/ataflash.h
index 55e46ff1c1c..ecf610ae4a3 100644
--- a/src/devices/machine/ataflash.h
+++ b/src/devices/machine/ataflash.h
@@ -1,21 +1,20 @@
// license:BSD-3-Clause
// copyright-holders:smf
-#pragma once
+#ifndef MAME_MACHINE_ATAFLASH_H
+#define MAME_MACHINE_ATAFLASH_H
-#ifndef __ATAFLASH_H__
-#define __ATAFLASH_H__
+#pragma once
#include "pccard.h"
#include "machine/idehd.h"
extern const device_type ATA_FLASH_PCCARD;
+DECLARE_DEVICE_TYPE(ATA_FLASH_PCCARD, ata_flash_pccard_device)
-class ata_flash_pccard_device : public ide_hdd_device,
- public pccard_interface
+class ata_flash_pccard_device : public ide_hdd_device, public pccard_interface
{
public:
ata_flash_pccard_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- ata_flash_pccard_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source);
virtual DECLARE_READ16_MEMBER(read_memory) override;
virtual DECLARE_WRITE16_MEMBER(write_memory) override;
@@ -23,6 +22,8 @@ public:
virtual DECLARE_WRITE16_MEMBER(write_reg) override;
protected:
+ ata_flash_pccard_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
+
// device-level overrides
virtual void device_reset() override;
@@ -35,7 +36,7 @@ private:
uint8_t m_pin_replacement;
};
-extern const device_type TAITO_PCCARD1;
+DECLARE_DEVICE_TYPE(TAITO_PCCARD1, taito_pccard1_device)
class taito_pccard1_device : public ata_flash_pccard_device
{
@@ -56,7 +57,7 @@ private:
uint16_t m_locked;
};
-extern const device_type TAITO_PCCARD2;
+DECLARE_DEVICE_TYPE(TAITO_PCCARD2, taito_pccard2_device)
class taito_pccard2_device : public ata_flash_pccard_device
{
@@ -78,7 +79,7 @@ private:
bool m_locked;
};
-extern const device_type TAITO_COMPACT_FLASH;
+DECLARE_DEVICE_TYPE(TAITO_COMPACT_FLASH, taito_compact_flash_device)
class taito_compact_flash_device : public ata_flash_pccard_device
{
@@ -91,11 +92,11 @@ protected:
virtual void process_command() override;
virtual bool is_ready() override;
- static const int IDE_COMMAND_TAITO_COMPACT_FLASH_UNLOCK = 0x0f;
+ static constexpr int IDE_COMMAND_TAITO_COMPACT_FLASH_UNLOCK = 0x0f;
private:
uint8_t m_key[5];
bool m_locked;
};
-#endif
+#endif // MAME_MACHINE_ATAFLASH_H
diff --git a/src/devices/machine/atahle.cpp b/src/devices/machine/atahle.cpp
index ad94f6a4f69..b93826e35de 100644
--- a/src/devices/machine/atahle.cpp
+++ b/src/devices/machine/atahle.cpp
@@ -40,10 +40,9 @@ enum
#define DEVICE1_PDIAG_TIME (attotime::from_msec(2))
#define DIAGNOSTIC_TIME (attotime::from_msec(2))
-ata_hle_device::ata_hle_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock,const char *shortname, const char *source)
- : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
- ata_device_interface(mconfig, *this),
- device_slot_card_interface(mconfig, *this),
+ata_hle_device::ata_hle_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_ata_interface(mconfig, *this),
m_buffer_offset(0),
m_buffer_size(0),
m_error(0),
diff --git a/src/devices/machine/atahle.h b/src/devices/machine/atahle.h
index dfa39af8da5..d8a676e562c 100644
--- a/src/devices/machine/atahle.h
+++ b/src/devices/machine/atahle.h
@@ -8,16 +8,14 @@
***************************************************************************/
-#pragma once
+#ifndef MAME_MACHINE_ATAHLE_H
+#define MAME_MACHINE_ATAHLE_H
-#ifndef __ATAHLE_H__
-#define __ATAHLE_H__
+#pragma once
#include "atadev.h"
-class ata_hle_device : public device_t,
- public ata_device_interface,
- public device_slot_card_interface
+class ata_hle_device : public device_t, public device_ata_interface
{
public:
virtual uint16_t read_dma() override;
@@ -33,7 +31,7 @@ public:
virtual DECLARE_WRITE_LINE_MEMBER(write_pdiag) override;
protected:
- ata_hle_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source);
+ ata_hle_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;
@@ -218,4 +216,4 @@ private:
emu_timer *m_buffer_empty_timer;
};
-#endif
+#endif // MAME_MACHINE_ATAHLE_H
diff --git a/src/devices/machine/ataintf.cpp b/src/devices/machine/ataintf.cpp
index 09ca1a04e8d..df3e127dd52 100644
--- a/src/devices/machine/ataintf.cpp
+++ b/src/devices/machine/ataintf.cpp
@@ -10,9 +10,12 @@
#include "emu.h"
#include "ataintf.h"
-#include "debugger.h"
-#include "idehd.h"
+
#include "atapicdr.h"
+#include "idehd.h"
+
+#include "debugger.h"
+
void ata_interface_device::set_irq(int state)
{
@@ -71,7 +74,7 @@ WRITE_LINE_MEMBER( ata_interface_device::dasp1_write_line )
{
m_dasp[1] = state;
- ata_device_interface *dev = m_slot[0]->dev();
+ device_ata_interface *dev = m_slot[0]->dev();
if (dev != nullptr)
dev->write_dasp(state);
@@ -110,7 +113,7 @@ WRITE_LINE_MEMBER( ata_interface_device::pdiag1_write_line )
{
m_pdiag[1] = state;
- ata_device_interface *dev = m_slot[0]->dev();
+ device_ata_interface *dev = m_slot[0]->dev();
if (dev != nullptr)
dev->write_pdiag(state);
}
@@ -207,21 +210,18 @@ SLOT_INTERFACE_START(ata_devices)
SLOT_INTERFACE("cdrom", ATAPI_CDROM)
SLOT_INTERFACE_END
-ata_interface_device::ata_interface_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source) :
- device_t(mconfig, type, name, tag, owner, clock, shortname, source),
+ata_interface_device::ata_interface_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_irq_handler(*this),
m_dmarq_handler(*this),
m_dasp_handler(*this){
}
-const device_type ATA_INTERFACE = device_creator<ata_interface_device>;
+DEFINE_DEVICE_TYPE(ATA_INTERFACE, ata_interface_device, "ata_interface", "ATA Interface")
ata_interface_device::ata_interface_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, ATA_INTERFACE, "ATA Interface", tag, owner, clock, "ata_interface", __FILE__),
- m_irq_handler(*this),
- m_dmarq_handler(*this),
- m_dasp_handler(*this)
+ ata_interface_device(mconfig, ATA_INTERFACE, tag, owner, clock)
{
}
@@ -246,7 +246,7 @@ void ata_interface_device::device_start()
m_dasp[i] = 0;
m_pdiag[i] = 0;
- ata_device_interface *dev = m_slot[i]->dev();
+ device_ata_interface *dev = m_slot[i]->dev();
if (dev != nullptr)
{
if (i == 0)
@@ -290,14 +290,14 @@ machine_config_constructor ata_interface_device::device_mconfig_additions() cons
//**************************************************************************
// device type definition
-const device_type ATA_SLOT = device_creator<ata_slot_device>;
+DEFINE_DEVICE_TYPE(ATA_SLOT, ata_slot_device, "ata_slot", "ATA Connector")
//-------------------------------------------------
// ata_slot_device - constructor
//-------------------------------------------------
ata_slot_device::ata_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, ATA_SLOT, "ATA Connector", tag, owner, clock, "ata_slot", __FILE__),
+ : device_t(mconfig, ATA_SLOT, tag, owner, clock),
device_slot_interface(mconfig, *this),
m_dev(nullptr)
{
@@ -311,7 +311,7 @@ ata_slot_device::ata_slot_device(const machine_config &mconfig, const char *tag,
void ata_slot_device::device_config_complete()
{
- m_dev = dynamic_cast<ata_device_interface *>(get_card_device());
+ m_dev = dynamic_cast<device_ata_interface *>(get_card_device());
}
//-------------------------------------------------
diff --git a/src/devices/machine/ataintf.h b/src/devices/machine/ataintf.h
index 018796414ff..2d8533810e5 100644
--- a/src/devices/machine/ataintf.h
+++ b/src/devices/machine/ataintf.h
@@ -8,10 +8,10 @@
***************************************************************************/
-#pragma once
+#ifndef MAME_MACHINE_ATAINTF_H
+#define MAME_MACHINE_ATAINTF_H
-#ifndef __ATAINTF_H__
-#define __ATAINTF_H__
+#pragma once
#include "atadev.h"
@@ -28,18 +28,19 @@ public:
// construction/destruction
ata_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- ata_device_interface *dev() { return m_dev; }
+ device_ata_interface *dev() { return m_dev; }
+
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_config_complete() override;
private:
- ata_device_interface *m_dev;
+ device_ata_interface *m_dev;
};
// device type definition
-extern const device_type ATA_SLOT;
+DECLARE_DEVICE_TYPE(ATA_SLOT, ata_slot_device)
/***************************************************************************
TYPE DEFINITIONS
@@ -78,12 +79,12 @@ class ata_interface_device : public device_t
{
public:
ata_interface_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- ata_interface_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source);
// static configuration helpers
- template<class _Object> static devcb_base &set_irq_handler(device_t &device, _Object object) { return downcast<ata_interface_device &>(device).m_irq_handler.set_callback(object); }
- template<class _Object> static devcb_base &set_dmarq_handler(device_t &device, _Object object) { return downcast<ata_interface_device &>(device).m_dmarq_handler.set_callback(object); }
- template<class _Object> static devcb_base &set_dasp_handler(device_t &device, _Object object) { return downcast<ata_interface_device &>(device).m_dasp_handler.set_callback(object); }
+ template <class Object> static devcb_base &set_irq_handler(device_t &device, Object &&cb) { return downcast<ata_interface_device &>(device).m_irq_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_dmarq_handler(device_t &device, Object &&cb) { return downcast<ata_interface_device &>(device).m_dmarq_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_dasp_handler(device_t &device, Object &&cb) { return downcast<ata_interface_device &>(device).m_dasp_handler.set_callback(std::forward<Object>(cb)); }
+
uint16_t read_dma();
virtual DECLARE_READ16_MEMBER(read_cs0);
virtual DECLARE_READ16_MEMBER(read_cs1);
@@ -94,6 +95,8 @@ public:
DECLARE_WRITE_LINE_MEMBER(write_dmack);
protected:
+ ata_interface_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 machine_config_constructor device_mconfig_additions() const override;
@@ -124,6 +127,6 @@ private:
devcb_write_line m_dasp_handler;
};
-extern const device_type ATA_INTERFACE;
+DECLARE_DEVICE_TYPE(ATA_INTERFACE, ata_interface_device)
-#endif /* __ATAINTF_H__ */
+#endif // MAME_MACHINE_ATAINTF_H
diff --git a/src/devices/machine/atapicdr.cpp b/src/devices/machine/atapicdr.cpp
index a7aa4449517..bee622ed4c1 100644
--- a/src/devices/machine/atapicdr.cpp
+++ b/src/devices/machine/atapicdr.cpp
@@ -8,21 +8,21 @@
#define T10MMC_GET_EVENT_STATUS_NOTIFICATION 0x4a
// device type definition
-const device_type ATAPI_CDROM = device_creator<atapi_cdrom_device>;
-const device_type ATAPI_FIXED_CDROM = device_creator<atapi_fixed_cdrom_device>;
+DEFINE_DEVICE_TYPE(ATAPI_CDROM, atapi_cdrom_device, "cdrom", "ATAPI CD-ROM")
+DEFINE_DEVICE_TYPE(ATAPI_FIXED_CDROM, atapi_fixed_cdrom_device, "cdrom_fixed", "ATAPI fixed CD-ROM")
atapi_cdrom_device::atapi_cdrom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- atapi_hle_device(mconfig, ATAPI_CDROM, "ATAPI CDROM", tag, owner, clock, "cdrom", __FILE__)
+ atapi_cdrom_device(mconfig, ATAPI_CDROM, tag, owner, clock)
{
}
-atapi_cdrom_device::atapi_cdrom_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source) :
- atapi_hle_device(mconfig, type, name, tag, owner, clock, shortname, source)
+atapi_cdrom_device::atapi_cdrom_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) :
+ atapi_hle_device(mconfig, type, tag, owner, clock)
{
}
atapi_fixed_cdrom_device::atapi_fixed_cdrom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- atapi_cdrom_device(mconfig, ATAPI_FIXED_CDROM, "ATAPI fixed CDROM", tag, owner, clock, "cdrom_fixed", __FILE__)
+ atapi_cdrom_device(mconfig, ATAPI_FIXED_CDROM, tag, owner, clock)
{
}
diff --git a/src/devices/machine/atapicdr.h b/src/devices/machine/atapicdr.h
index 1105506c84f..778197a2f24 100644
--- a/src/devices/machine/atapicdr.h
+++ b/src/devices/machine/atapicdr.h
@@ -8,24 +8,24 @@
***************************************************************************/
-#pragma once
+#ifndef MAME_MACHINE_ATAPICDR_H
+#define MAME_MACHINE_ATAPICDR_H
-#ifndef __ATAPICDR_H__
-#define __ATAPICDR_H__
+#pragma once
#include "atapihle.h"
#include "t10mmc.h"
-class atapi_cdrom_device : public atapi_hle_device,
- public t10mmc
+class atapi_cdrom_device : public atapi_hle_device, public t10mmc
{
public:
atapi_cdrom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- atapi_cdrom_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock,const char *shortname, const char *source);
uint16_t *identify_device_buffer() { return m_identify_buffer; }
protected:
+ atapi_cdrom_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;
@@ -42,12 +42,13 @@ class atapi_fixed_cdrom_device : public atapi_cdrom_device
{
public:
atapi_fixed_cdrom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
protected:
virtual void device_reset() override;
};
// device type definition
-extern const device_type ATAPI_CDROM;
-extern const device_type ATAPI_FIXED_CDROM;
+DECLARE_DEVICE_TYPE(ATAPI_CDROM, atapi_cdrom_device)
+DECLARE_DEVICE_TYPE(ATAPI_FIXED_CDROM, atapi_fixed_cdrom_device)
-#endif
+#endif // MAME_MACHINE_ATAPICDR_H
diff --git a/src/devices/machine/atapihle.cpp b/src/devices/machine/atapihle.cpp
index 24d2c901f74..8bbc779ea23 100644
--- a/src/devices/machine/atapihle.cpp
+++ b/src/devices/machine/atapihle.cpp
@@ -3,8 +3,8 @@
#include "emu.h"
#include "atapihle.h"
-atapi_hle_device::atapi_hle_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock,const char *shortname, const char *source)
- : ata_hle_device(mconfig, type, name, tag, owner, clock, shortname, source),
+atapi_hle_device::atapi_hle_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
+ : ata_hle_device(mconfig, type, tag, owner, clock),
m_packet(0),
m_data_size(0)
{
diff --git a/src/devices/machine/atapihle.h b/src/devices/machine/atapihle.h
index 2e44816a2ca..d01447e5830 100644
--- a/src/devices/machine/atapihle.h
+++ b/src/devices/machine/atapihle.h
@@ -8,20 +8,17 @@
***************************************************************************/
-#pragma once
+#ifndef MAME_MACHINE_ATAPIHLE_H
+#define MAME_MACHINE_ATAPIHLE_H
-#ifndef __ATAPIHLE_H__
-#define __ATAPIHLE_H__
+#pragma once
#include "atahle.h"
#include "t10spc.h"
-class atapi_hle_device : public ata_hle_device,
- public virtual t10spc
+class atapi_hle_device : public ata_hle_device, public virtual t10spc
{
public:
- atapi_hle_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock,const char *shortname, const char *source);
-
enum atapi_features_flag_t
{
ATAPI_FEATURES_FLAG_DMA = 0x01,
@@ -50,6 +47,8 @@ public:
};
protected:
+ atapi_hle_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;
@@ -72,7 +71,7 @@ private:
int m_packet;
int m_data_size;
- static const int ATAPI_BUFFER_LENGTH = 0xf800;
+ static constexpr int ATAPI_BUFFER_LENGTH = 0xf800;
};
-#endif
+#endif // MAME_MACHINE_ATAPIHLE_H
diff --git a/src/devices/machine/autoconfig.h b/src/devices/machine/autoconfig.h
index a5c4279153e..409f21b4eb9 100644
--- a/src/devices/machine/autoconfig.h
+++ b/src/devices/machine/autoconfig.h
@@ -6,10 +6,10 @@
***************************************************************************/
-#pragma once
+#ifndef MAME_MACHINE_AUTOCONFIG_H
+#define MAME_MACHINE_AUTOCONFIG_H
-#ifndef __AUTOCONFIG_H__
-#define __AUTOCONFIG_H__
+#pragma once
class amiga_autoconfig
@@ -70,4 +70,4 @@ private:
uint16_t m_cfg[0x40];
};
-#endif // __AUTOCONFIG_H__
+#endif // MAME_MACHINE_AUTOCONFIG_H
diff --git a/src/devices/machine/ay31015.cpp b/src/devices/machine/ay31015.cpp
index 74b61bef1cf..aba1e284156 100644
--- a/src/devices/machine/ay31015.cpp
+++ b/src/devices/machine/ay31015.cpp
@@ -94,11 +94,11 @@ Start bit (low), Bit 0, Bit 1... highest bit, Parity bit (if enabled), 1-2 stop
-const device_type AY31015 = device_creator<ay31015_device>;
-const device_type AY51013 = device_creator<ay51013_device>;
+DEFINE_DEVICE_TYPE(AY31015, ay31015_device, "ay31015", "AY-3-1015")
+DEFINE_DEVICE_TYPE(AY51013, ay51013_device, "ay51013", "AY-5-1013")
-ay31015_device::ay31015_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source)
- : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
+ay31015_device::ay31015_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_control_reg(0),
m_status_reg(0),
m_second_stop_bit(0),
@@ -126,12 +126,12 @@ ay31015_device::ay31015_device(const machine_config &mconfig, device_type type,
}
ay31015_device::ay31015_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : ay31015_device(mconfig, AY31015, "AY-3-1015", tag, owner, clock, "ay31015", __FILE__)
+ : ay31015_device(mconfig, AY31015, tag, owner, clock)
{
}
ay51013_device::ay51013_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : ay31015_device(mconfig, AY51013, "AY-5-1013", tag, owner, clock, "ay51013", __FILE__)
+ : ay31015_device(mconfig, AY51013, tag, owner, clock)
{
}
diff --git a/src/devices/machine/ay31015.h b/src/devices/machine/ay31015.h
index a58e4379208..d7211e9a1f0 100644
--- a/src/devices/machine/ay31015.h
+++ b/src/devices/machine/ay31015.h
@@ -6,8 +6,10 @@
*/
-#ifndef __AY31015_H_
-#define __AY31015_H_
+#ifndef MAME_MACHINE_AY31015_H
+#define MAME_MACHINE_AY31015_H
+
+#pragma once
/***************************************************************************
TYPE DEFINITIONS
@@ -45,31 +47,27 @@ enum ay31015_output_pin_t
DEVICE INTERFACE
***************************************************************************/
-enum state_t
-{
- IDLE,
- START_BIT,
- PROCESSING,
- PARITY_BIT,
- FIRST_STOP_BIT,
- SECOND_STOP_BIT,
- PREP_TIME
-};
-
-ALLOW_SAVE_TYPE(state_t);
-
class ay31015_device : public device_t
{
public:
+ enum state_t
+ {
+ IDLE,
+ START_BIT,
+ PROCESSING,
+ PARITY_BIT,
+ FIRST_STOP_BIT,
+ SECOND_STOP_BIT,
+ PREP_TIME
+ };
+
ay31015_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- ay31015_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source);
- ~ay31015_device() {}
static void set_tx_clock(device_t &device, double tx_clock) { downcast<ay31015_device &>(device).m_tx_clock = tx_clock; }
static void set_rx_clock(device_t &device, double rx_clock) { downcast<ay31015_device &>(device).m_rx_clock = rx_clock; }
- template<class _Object> static devcb_base &set_read_si_callback(device_t &device, _Object object) { return downcast<ay31015_device &>(device).m_read_si_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_write_so_callback(device_t &device, _Object object) { return downcast<ay31015_device &>(device).m_write_so_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_status_changed_callback(device_t &device, _Object object) { return downcast<ay31015_device &>(device).m_status_changed_cb.set_callback(object); }
+ template <class Object> static devcb_base &set_read_si_callback(device_t &device, Object &&cb) { return downcast<ay31015_device &>(device).m_read_si_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_write_so_callback(device_t &device, Object &&cb) { return downcast<ay31015_device &>(device).m_write_so_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_status_changed_callback(device_t &device, Object &&cb) { return downcast<ay31015_device &>(device).m_status_changed_cb.set_callback(std::forward<Object>(cb)); }
/* Set an input pin */
void set_input_pin( ay31015_input_pin_t pin, int data );
@@ -95,8 +93,10 @@ public:
void tx_process();
protected:
- static const device_timer_id TIMER_RX = 0;
- static const device_timer_id TIMER_TX = 1;
+ static constexpr device_timer_id TIMER_RX = 0;
+ static constexpr device_timer_id TIMER_TX = 1;
+
+ ay31015_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;
@@ -154,8 +154,10 @@ protected:
};
-extern const device_type AY31015; // For AY-3-1014A, AY-3-1015(D) and HD6402 variants
-extern const device_type AY51013; // For AY-3-1014, AY-5-1013 and AY-6-1013 variants
+ALLOW_SAVE_TYPE(ay31015_device::state_t);
+
+DECLARE_DEVICE_TYPE(AY31015, ay31015_device) // For AY-3-1014A, AY-3-1015(D) and HD6402 variants
+DECLARE_DEVICE_TYPE(AY51013, ay51013_device) // For AY-3-1014, AY-5-1013 and AY-6-1013 variants
@@ -195,4 +197,4 @@ extern const device_type AY51013; // For AY-3-1014, AY-5-1013 and AY-6-1013 va
#define MCFG_AY51013_STATUS_CHANGED_CB(_devcb) \
devcb = &ay51013_device::set_status_changed_callback(*device, DEVCB_##_devcb);
-#endif
+#endif // MAME_MACHINE_AY31015_H
diff --git a/src/devices/machine/bankdev.cpp b/src/devices/machine/bankdev.cpp
index 8197f502c79..50000e8942f 100644
--- a/src/devices/machine/bankdev.cpp
+++ b/src/devices/machine/bankdev.cpp
@@ -4,10 +4,10 @@
#include "bankdev.h"
// device type definition
-const device_type ADDRESS_MAP_BANK = device_creator<address_map_bank_device>;
+DEFINE_DEVICE_TYPE(ADDRESS_MAP_BANK, address_map_bank_device, "address_map_bank", "Address Map Bank")
address_map_bank_device::address_map_bank_device( const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock )
- : device_t(mconfig, ADDRESS_MAP_BANK, "Address Map Bank", tag, owner, clock, "address_map_bank", __FILE__),
+ : device_t(mconfig, ADDRESS_MAP_BANK, tag, owner, clock),
device_memory_interface(mconfig, *this),
m_endianness(ENDIANNESS_NATIVE),
m_databus_width(0),
diff --git a/src/devices/machine/bankdev.h b/src/devices/machine/bankdev.h
index ce692c8b319..5fb049fd3af 100644
--- a/src/devices/machine/bankdev.h
+++ b/src/devices/machine/bankdev.h
@@ -1,9 +1,9 @@
// license:BSD-3-Clause
// copyright-holders:smf
-#pragma once
+#ifndef MAME_DEVICES_MACHINE_BANKDEV_H
+#define MAME_DEVICES_MACHINE_BANKDEV_H
-#ifndef __BANKDEV_H__
-#define __BANKDEV_H__
+#pragma once
#define MCFG_ADDRESS_MAP_BANK_ENDIANNESS(_endianness) \
@@ -24,7 +24,7 @@ class address_map_bank_device :
{
public:
// construction/destruction
- address_map_bank_device( const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock );
+ address_map_bank_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// static configuration helpers
static void set_endianness(device_t &device, endianness_t endianness) { downcast<address_map_bank_device &>(device).m_endianness = endianness; }
@@ -69,6 +69,6 @@ private:
// device type definition
-extern const device_type ADDRESS_MAP_BANK;
+DECLARE_DEVICE_TYPE(ADDRESS_MAP_BANK, address_map_bank_device)
-#endif
+#endif // MAME_DEVICES_MACHINE_BANKDEV_H
diff --git a/src/devices/machine/bcreader.cpp b/src/devices/machine/bcreader.cpp
index 55cca371322..a94c488583c 100644
--- a/src/devices/machine/bcreader.cpp
+++ b/src/devices/machine/bcreader.cpp
@@ -53,14 +53,14 @@
#include "bcreader.h"
// device type definition
-const device_type BARCODE_READER = device_creator<barcode_reader_device>;
+DEFINE_DEVICE_TYPE(BARCODE_READER, barcode_reader_device, "bcreader", "Barcode Reader")
//-------------------------------------------------
// barcode_reader_device - constructor
//-------------------------------------------------
barcode_reader_device::barcode_reader_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, BARCODE_READER, "Barcode Reader", tag, owner, clock, "bcreader", __FILE__)
+ : device_t(mconfig, BARCODE_READER, tag, owner, clock)
, m_byte_length(0)
, m_pixel_length(0)
, m_byte_count(0)
diff --git a/src/devices/machine/bcreader.h b/src/devices/machine/bcreader.h
index 3be7c2d6d9d..b687c19363b 100644
--- a/src/devices/machine/bcreader.h
+++ b/src/devices/machine/bcreader.h
@@ -8,8 +8,8 @@
*********************************************************************/
-#ifndef __BCREADER_H_
-#define __BCREADER_H_
+#ifndef MAME_DEVICES_MACHINE_BCREADER_H
+#define MAME_DEVICES_MACHINE_BCREADER_H
#define MCFG_BARCODE_READER_ADD( _tag ) \
MCFG_DEVICE_ADD( _tag, BARCODE_READER, 0 )
@@ -51,10 +51,10 @@ protected:
// device type definition
-extern const device_type BARCODE_READER;
+DECLARE_DEVICE_TYPE(BARCODE_READER, barcode_reader_device)
// device type iterator
typedef device_type_iterator<barcode_reader_device> barcode_reader_device_iterator;
-#endif
+#endif // MAME_DEVICES_MACHINE_BCREADER_H
diff --git a/src/devices/machine/buffer.cpp b/src/devices/machine/buffer.cpp
index b5d0839af5e..b1a93df8fb7 100644
--- a/src/devices/machine/buffer.cpp
+++ b/src/devices/machine/buffer.cpp
@@ -3,11 +3,11 @@
#include "emu.h"
#include "buffer.h"
-const device_type INPUT_BUFFER = device_creator<input_buffer_device>;
+DEFINE_DEVICE_TYPE(INPUT_BUFFER, input_buffer_device, "input_buffer", "Input Buffer")
input_buffer_device::input_buffer_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, INPUT_BUFFER, "Input Buffer", tag, owner, clock, "input_buffer", __FILE__),
- m_input_data(0xff)
+ : device_t(mconfig, INPUT_BUFFER, tag, owner, clock)
+ , m_input_data(0xff)
{
}
diff --git a/src/devices/machine/buffer.h b/src/devices/machine/buffer.h
index 812f9f89f78..7f5724ad48b 100644
--- a/src/devices/machine/buffer.h
+++ b/src/devices/machine/buffer.h
@@ -1,7 +1,7 @@
// license:BSD-3-Clause
// copyright-holders:smf
-#ifndef __BUFFER_H__
-#define __BUFFER_H__
+#ifndef MAME_DEVICES_MACHINE_BUFFER_H
+#define MAME_DEVICES_MACHINE_BUFFER_H
class input_buffer_device : public device_t
{
@@ -26,6 +26,6 @@ protected:
uint8_t m_input_data;
};
-extern const device_type INPUT_BUFFER;
+DECLARE_DEVICE_TYPE(INPUT_BUFFER, input_buffer_device)
-#endif
+#endif // MAME_DEVICES_MACHINE_BUFFER_H
diff --git a/src/devices/machine/cdp1852.cpp b/src/devices/machine/cdp1852.cpp
index 422d3ff5fe2..b6dbb80410e 100644
--- a/src/devices/machine/cdp1852.cpp
+++ b/src/devices/machine/cdp1852.cpp
@@ -15,7 +15,7 @@
// DEVICE DEFINITIONS
//**************************************************************************
-const device_type CDP1852 = device_creator<cdp1852_device>;
+DEFINE_DEVICE_TYPE(CDP1852, cdp1852_device, "cdp1852", "RCA CDP1852 I/O")
@@ -40,11 +40,12 @@ enum
//-------------------------------------------------
cdp1852_device::cdp1852_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, CDP1852, "CDP1852 I/O", tag, owner, clock, "cdp1852", __FILE__),
+ device_t(mconfig, CDP1852, tag, owner, clock),
m_read_mode(*this),
m_write_sr(*this),
m_read_data(*this),
- m_write_data(*this), m_new_data(0), m_data(0), m_next_data(0), m_sr(0), m_next_sr(0), m_scan_timer(nullptr)
+ m_write_data(*this),
+ m_new_data(0), m_data(0), m_next_data(0), m_sr(0), m_next_sr(0), m_scan_timer(nullptr)
{
}
diff --git a/src/devices/machine/cdp1852.h b/src/devices/machine/cdp1852.h
index 61ab5092001..d017aaa2482 100644
--- a/src/devices/machine/cdp1852.h
+++ b/src/devices/machine/cdp1852.h
@@ -21,10 +21,10 @@
**********************************************************************/
-#pragma once
+#ifndef MAME_MACHINE_CDP1852_H
+#define MAME_MACHINE_CDP1852_H
-#ifndef __CDP1852__
-#define __CDP1852__
+#pragma once
@@ -53,16 +53,16 @@
// ======================> cdp1852_device
-class cdp1852_device : public device_t
+class cdp1852_device : public device_t
{
public:
// construction/destruction
cdp1852_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- template<class _Object> static devcb_base &set_mode_rd_callback(device_t &device, _Object object) { return downcast<cdp1852_device &>(device).m_read_mode.set_callback(object); }
- template<class _Object> static devcb_base &set_sr_wr_callback(device_t &device, _Object object) { return downcast<cdp1852_device &>(device).m_write_sr.set_callback(object); }
- template<class _Object> static devcb_base &set_data_rd_callback(device_t &device, _Object object) { return downcast<cdp1852_device &>(device).m_read_data.set_callback(object); }
- template<class _Object> static devcb_base &set_data_wr_callback(device_t &device, _Object object) { return downcast<cdp1852_device &>(device).m_write_data.set_callback(object); }
+ template <class Object> static devcb_base &set_mode_rd_callback(device_t &device, Object &&cb) { return downcast<cdp1852_device &>(device).m_read_mode.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_sr_wr_callback(device_t &device, Object &&cb) { return downcast<cdp1852_device &>(device).m_write_sr.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_data_rd_callback(device_t &device, Object &&cb) { return downcast<cdp1852_device &>(device).m_read_data.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_data_wr_callback(device_t &device, Object &&cb) { return downcast<cdp1852_device &>(device).m_write_data.set_callback(std::forward<Object>(cb)); }
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
@@ -94,8 +94,6 @@ private:
// device type definition
-extern const device_type CDP1852;
-
-
+DECLARE_DEVICE_TYPE(CDP1852, cdp1852_device)
-#endif
+#endif // MAME_MACHINE_CDP1852_H
diff --git a/src/devices/machine/cdp1871.cpp b/src/devices/machine/cdp1871.cpp
index 586597ce41b..600c1e6ee3c 100644
--- a/src/devices/machine/cdp1871.cpp
+++ b/src/devices/machine/cdp1871.cpp
@@ -15,7 +15,7 @@
// DEVICE DEFINITIONS
//**************************************************************************
-const device_type CDP1871 = device_creator<cdp1871_device>;
+DEFINE_DEVICE_TYPE(CDP1871, cdp1871_device, "cdp1871", "RCA CDP1871 Keyboard Encoder")
@@ -97,7 +97,7 @@ const uint8_t cdp1871_device::key_codes[4][11][8] =
//-------------------------------------------------
cdp1871_device::cdp1871_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, CDP1871, "RCA CDP1871", tag, owner, clock, "cdp1871", __FILE__),
+ device_t(mconfig, CDP1871, tag, owner, clock),
m_read_d1(*this),
m_read_d2(*this),
m_read_d3(*this),
diff --git a/src/devices/machine/cdp1871.h b/src/devices/machine/cdp1871.h
index eb939aa92e9..b83ca6d3166 100644
--- a/src/devices/machine/cdp1871.h
+++ b/src/devices/machine/cdp1871.h
@@ -29,10 +29,10 @@
**********************************************************************/
-#pragma once
+#ifndef MAME_MACHINE_CDP1871_H
+#define MAME_MACHINE_CDP1871_H
-#ifndef __CDP1871__
-#define __CDP1871__
+#pragma once
@@ -94,19 +94,19 @@ public:
// construction/destruction
cdp1871_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- template<class _Object> static devcb_base &set_d1_rd_callback(device_t &device, _Object object) { return downcast<cdp1871_device &>(device).m_read_d1.set_callback(object); }
- template<class _Object> static devcb_base &set_d2_rd_callback(device_t &device, _Object object) { return downcast<cdp1871_device &>(device).m_read_d2.set_callback(object); }
- template<class _Object> static devcb_base &set_d3_rd_callback(device_t &device, _Object object) { return downcast<cdp1871_device &>(device).m_read_d3.set_callback(object); }
- template<class _Object> static devcb_base &set_d4_rd_callback(device_t &device, _Object object) { return downcast<cdp1871_device &>(device).m_read_d4.set_callback(object); }
- template<class _Object> static devcb_base &set_d5_rd_callback(device_t &device, _Object object) { return downcast<cdp1871_device &>(device).m_read_d5.set_callback(object); }
- template<class _Object> static devcb_base &set_d6_rd_callback(device_t &device, _Object object) { return downcast<cdp1871_device &>(device).m_read_d6.set_callback(object); }
- template<class _Object> static devcb_base &set_d7_rd_callback(device_t &device, _Object object) { return downcast<cdp1871_device &>(device).m_read_d7.set_callback(object); }
- template<class _Object> static devcb_base &set_d8_rd_callback(device_t &device, _Object object) { return downcast<cdp1871_device &>(device).m_read_d8.set_callback(object); }
- template<class _Object> static devcb_base &set_d9_rd_callback(device_t &device, _Object object) { return downcast<cdp1871_device &>(device).m_read_d9.set_callback(object); }
- template<class _Object> static devcb_base &set_d10_rd_callback(device_t &device, _Object object) { return downcast<cdp1871_device &>(device).m_read_d10.set_callback(object); }
- template<class _Object> static devcb_base &set_d11_rd_callback(device_t &device, _Object object) { return downcast<cdp1871_device &>(device).m_read_d11.set_callback(object); }
- template<class _Object> static devcb_base &set_da_wr_callback(device_t &device, _Object object) { return downcast<cdp1871_device &>(device).m_write_da.set_callback(object); }
- template<class _Object> static devcb_base &set_rpt_wr_callback(device_t &device, _Object object) { return downcast<cdp1871_device &>(device).m_write_rpt.set_callback(object); }
+ template <class Object> static devcb_base &set_d1_rd_callback(device_t &device, Object &&cb) { return downcast<cdp1871_device &>(device).m_read_d1.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_d2_rd_callback(device_t &device, Object &&cb) { return downcast<cdp1871_device &>(device).m_read_d2.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_d3_rd_callback(device_t &device, Object &&cb) { return downcast<cdp1871_device &>(device).m_read_d3.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_d4_rd_callback(device_t &device, Object &&cb) { return downcast<cdp1871_device &>(device).m_read_d4.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_d5_rd_callback(device_t &device, Object &&cb) { return downcast<cdp1871_device &>(device).m_read_d5.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_d6_rd_callback(device_t &device, Object &&cb) { return downcast<cdp1871_device &>(device).m_read_d6.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_d7_rd_callback(device_t &device, Object &&cb) { return downcast<cdp1871_device &>(device).m_read_d7.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_d8_rd_callback(device_t &device, Object &&cb) { return downcast<cdp1871_device &>(device).m_read_d8.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_d9_rd_callback(device_t &device, Object &&cb) { return downcast<cdp1871_device &>(device).m_read_d9.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_d10_rd_callback(device_t &device, Object &&cb) { return downcast<cdp1871_device &>(device).m_read_d10.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_d11_rd_callback(device_t &device, Object &&cb) { return downcast<cdp1871_device &>(device).m_read_d11.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_da_wr_callback(device_t &device, Object &&cb) { return downcast<cdp1871_device &>(device).m_write_da.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_rpt_wr_callback(device_t &device, Object &&cb) { return downcast<cdp1871_device &>(device).m_write_rpt.set_callback(std::forward<Object>(cb)); }
DECLARE_READ8_MEMBER( read );
@@ -164,8 +164,6 @@ private:
// device type definition
-extern const device_type CDP1871;
-
-
+DECLARE_DEVICE_TYPE(CDP1871, cdp1871_device)
-#endif
+#endif // MAME_MACHINE_CDP1871_H
diff --git a/src/devices/machine/cdp1879.cpp b/src/devices/machine/cdp1879.cpp
index c7a566848e8..c42a6120b4d 100644
--- a/src/devices/machine/cdp1879.cpp
+++ b/src/devices/machine/cdp1879.cpp
@@ -15,14 +15,14 @@
//**************************************************************************
// device type definition
-const device_type CDP1879 = device_creator<cdp1879_device>;
+DEFINE_DEVICE_TYPE(CDP1879, cdp1879_device, "cdp1879", "RCA CDP1879 RTC")
//-------------------------------------------------
// cdp1879_device - constructor
//-------------------------------------------------
cdp1879_device::cdp1879_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, CDP1879, "RCA CDP1879", tag, owner, clock, "cdp1879", __FILE__),
+ : device_t(mconfig, CDP1879, tag, owner, clock),
device_rtc_interface(mconfig, *this),
m_irq_w(*this)
{
diff --git a/src/devices/machine/cdp1879.h b/src/devices/machine/cdp1879.h
index 1a5a68389b7..bd87a228b65 100644
--- a/src/devices/machine/cdp1879.h
+++ b/src/devices/machine/cdp1879.h
@@ -6,10 +6,10 @@
**********************************************************************/
-#pragma once
+#ifndef MAME_MACHINE_CDP1879_H
+#define MAME_MACHINE_CDP1879_H
-#ifndef __CDP1879_H__
-#define __CDP1879_H__
+#pragma once
#include "dirtc.h"
@@ -79,6 +79,6 @@ private:
};
// device type definition
-extern const device_type CDP1879;
+DECLARE_DEVICE_TYPE(CDP1879, cdp1879_device)
-#endif
+#endif // MAME_MACHINE_CDP1879_H
diff --git a/src/devices/machine/clock.cpp b/src/devices/machine/clock.cpp
index c1e291300db..927a0aecbf5 100644
--- a/src/devices/machine/clock.cpp
+++ b/src/devices/machine/clock.cpp
@@ -3,10 +3,10 @@
#include "emu.h"
#include "clock.h"
-const device_type CLOCK = device_creator<clock_device>;
+DEFINE_DEVICE_TYPE(CLOCK, clock_device, "clock", "Clock")
clock_device::clock_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, CLOCK, "Clock", tag, owner, clock, "clock", __FILE__),
+ : device_t(mconfig, CLOCK, tag, owner, clock),
m_signal(0),
m_timer(nullptr),
m_signal_handler(*this)
diff --git a/src/devices/machine/clock.h b/src/devices/machine/clock.h
index 0f11c6b1173..3d361cd0d75 100644
--- a/src/devices/machine/clock.h
+++ b/src/devices/machine/clock.h
@@ -1,7 +1,7 @@
// license:BSD-3-Clause
// copyright-holders:smf
-#ifndef __CLOCK_H__
-#define __CLOCK_H__
+#ifndef MAME_MACHINE_CLOCK_H
+#define MAME_MACHINE_CLOCK_H
#pragma once
@@ -17,7 +17,7 @@ class clock_device : public device_t
public:
clock_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- template<class _Object> static devcb_base &set_signal_handler(device_t &device, _Object object) { return downcast<clock_device &>(device).m_signal_handler.set_callback(object); }
+ template <class Object> static devcb_base &set_signal_handler(device_t &device, Object &&cb) { return downcast<clock_device &>(device).m_signal_handler.set_callback(std::forward<Object>(cb)); }
protected:
virtual void device_start() override;
@@ -34,6 +34,6 @@ private:
devcb_write_line m_signal_handler;
};
-extern const device_type CLOCK;
+DECLARE_DEVICE_TYPE(CLOCK, clock_device)
-#endif
+#endif // MAME_MACHINE_CLOCK_H
diff --git a/src/devices/machine/com8116.cpp b/src/devices/machine/com8116.cpp
index db1fa072f14..cbc10280125 100644
--- a/src/devices/machine/com8116.cpp
+++ b/src/devices/machine/com8116.cpp
@@ -9,13 +9,8 @@
#include "emu.h"
#include "com8116.h"
-
-
-//**************************************************************************
-// MACROS / CONSTANTS
-//**************************************************************************
-
-#define LOG 0
+//#define VERBOSE 1
+#include "logmacro.h"
@@ -24,7 +19,7 @@
//**************************************************************************
// device type definition
-const device_type COM8116 = device_creator<com8116_device>;
+DEFINE_DEVICE_TYPE(COM8116, com8116_device, "com8116", "COM8116 Dual BRG")
// Parts with T after the number do not have an internal oscillator and require an external clock source
// The SMC/COM 5xxx parts are all dual 5v/12v parts, while the 8xxx parts are 5v only
@@ -89,7 +84,7 @@ const int com8116_device::divisors_16X_4_9152MHz_SY2661_2[] =
//-------------------------------------------------
com8116_device::com8116_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, COM8116, "COM8116", tag, owner, clock, "com8116", __FILE__),
+ device_t(mconfig, COM8116, tag, owner, clock),
m_fx4_handler(*this),
m_fr_handler(*this),
m_ft_handler(*this)
@@ -171,7 +166,7 @@ void com8116_device::str_w(uint8_t data)
int fr_divider = data & 0x0f;
int fr_clock = clock() / m_fr_divisors[fr_divider];
- if (LOG) logerror("COM8116 '%s' Receiver Divisor Select %01x: %u (%u Hz)\n", tag(), data & 0x0f, m_fr_divisors[fr_divider], fr_clock);
+ LOG("COM8116 Receiver Divisor Select %01x: %u (%u Hz)\n", data & 0x0f, m_fr_divisors[fr_divider], fr_clock);
m_fr_timer->adjust(attotime::from_nsec(3500), 0, attotime::from_hz(fr_clock * 2));
}
@@ -191,7 +186,7 @@ void com8116_device::stt_w(uint8_t data)
int ft_divider = data & 0x0f;
int ft_clock = clock() / m_ft_divisors[ft_divider];
- if (LOG) logerror("COM8116 '%s' Transmitter Divisor Select %01x: %u (%u Hz)\n", tag(), data & 0x0f, m_ft_divisors[ft_divider], ft_clock);
+ LOG("COM8116 Transmitter Divisor Select %01x: %u (%u Hz)\n", data & 0x0f, m_ft_divisors[ft_divider], ft_clock);
m_ft_timer->adjust(attotime::from_nsec(3500), 0, attotime::from_hz(ft_clock * 2));
}
diff --git a/src/devices/machine/com8116.h b/src/devices/machine/com8116.h
index 4cd3feddb8f..7d06cc3426d 100644
--- a/src/devices/machine/com8116.h
+++ b/src/devices/machine/com8116.h
@@ -21,10 +21,10 @@
**********************************************************************/
-#pragma once
+#ifndef MAME_MACHINE_COM8116_H
+#define MAME_MACHINE_COM8116_H
-#ifndef __COM8116__
-#define __COM8116__
+#pragma once
@@ -55,15 +55,16 @@ public:
// construction/destruction
com8116_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- template<class _Object> static devcb_base &set_fx4_handler(device_t &device, _Object object) { return downcast<com8116_device &>(device).m_fx4_handler.set_callback(object); }
- template<class _Object> static devcb_base &set_fr_handler(device_t &device, _Object object) { return downcast<com8116_device &>(device).m_fr_handler.set_callback(object); }
- template<class _Object> static devcb_base &set_ft_handler(device_t &device, _Object object) { return downcast<com8116_device &>(device).m_ft_handler.set_callback(object); }
+ template <class Object> static devcb_base &set_fx4_handler(device_t &device, Object &&cb) { return downcast<com8116_device &>(device).m_fx4_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_fr_handler(device_t &device, Object &&cb) { return downcast<com8116_device &>(device).m_fr_handler.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_ft_handler(device_t &device, Object &&cb) { return downcast<com8116_device &>(device).m_ft_handler.set_callback(std::forward<Object>(cb)); }
void str_w(uint8_t data);
DECLARE_WRITE8_MEMBER( str_w );
void stt_w(uint8_t data);
DECLARE_WRITE8_MEMBER( stt_w );
+protected:
static const int divisors_16X_5_0688MHz[];
static const int divisors_16X_6_01835MHz[];
static const int divisors_16X_4_9152MHz[];
@@ -74,7 +75,6 @@ public:
static const int divisors_16X_4_9152MHz_SY2661_1[];
static const int divisors_16X_4_9152MHz_SY2661_2[];
-protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
@@ -107,6 +107,6 @@ private:
// device type definition
-extern const device_type COM8116;
+DECLARE_DEVICE_TYPE(COM8116, com8116_device)
-#endif
+#endif // MAME_MACHINE_COM8116_H
diff --git a/src/devices/machine/corvushd.cpp b/src/devices/machine/corvushd.cpp
index fa64568ce37..38ae9a45e82 100644
--- a/src/devices/machine/corvushd.cpp
+++ b/src/devices/machine/corvushd.cpp
@@ -65,15 +65,166 @@
//
#include "emu.h"
-#include "imagedev/harddriv.h"
#include "machine/corvushd.h"
-#include <ctype.h>
-const device_type CORVUS_HDC = device_creator<corvus_hdc_t>;
-
-corvus_hdc_t::corvus_hdc_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, CORVUS_HDC, "Corvus Flat Cable HDC", tag, owner, clock, "corvus_hdc", __FILE__),
+//
+// Controller Commands
+//
+
+// Read/Write Commands
+
+#define READ_SECTOR_256 0x02
+#define WRITE_SECTOR_256 0x03
+#define READ_CHUNK_128 0x12
+#define READ_CHUNK_256 0x22
+#define READ_CHUNK_512 0x32
+#define WRITE_CHUNK_128 0x13
+#define WRITE_CHUNK_256 0x23
+#define WRITE_CHUNK_512 0x33
+
+// Semaphore Commands
+
+#define SEMAPHORE_LOCK_CODE 0x0b
+#define SEMAPHORE_LOCK_MOD 0x01
+#define SEMAPHORE_UNLOCK_CODE 0x0b
+#define SEMAPHORE_UNLOCK_MOD 0x11
+#define SEMAPHORE_INIT_CODE 0x1a
+#define SEMAPHORE_INIT_MOD 0x10
+#define SEMAPHORE_STATUS_CODE 0x1a
+#define SEMAPHORE_STATUS_MOD 0x41
+
+// Pipe Commands
+
+#define PIPE_READ_CODE 0x1a
+#define PIPE_READ_MOD 0x20
+#define PIPE_WRITE_CODE 0x1a
+#define PIPE_WRITE_MOD 0x21
+#define PIPE_CLOSE_CODE 0x1a
+#define PIPE_CLOSE_MOD 0x40
+#define PIPE_STATUS_CODE 0x1a
+#define PIPE_STATUS_MOD 0x41
+#define PIPE_OPEN_WRITE_CODE 0x1b
+#define PIPE_OPEN_WRITE_MOD 0x80
+#define PIPE_AREA_INIT_CODE 0x1b
+#define PIPE_AREA_INIT_MOD 0xa0
+#define PIPE_OPEN_READ_CODE 0x1b
+#define PIPE_OPEN_READ_MOD 0xc0
+
+// Active User Table Commands
+
+#define ADDACTIVE_CODE 0x34
+#define ADDACTIVE_MOD 0x03
+#define DELACTIVEUSR_REVBH_CODE 0x34
+#define DELACTIVEUSR_REVBH_MOD 0x00
+#define DELACTIVENUM_OMNI_CODE 0x34
+#define DELACTIVENUM_OMNI_MOD 0x00
+#define DELACTIVEUSR_OMNI_CODE 0x34
+#define DELACTIVEUSR_OMNI_MOD 0x31
+#define FINDACTIVE_CODE 0x34
+#define FINDACTIVE_MOD 0x05
+#define READTEMPBLOCK 0xc4
+#define WRITETEMPBLOCK 0xb4
+
+// Miscellaneous Commands
+
+#define BOOT 0x14
+#define READ_BOOT_BLOCK 0x44
+#define GET_DRIVE_PARAMETERS 0x10
+#define PARK_HEADS_REVH 0x11
+#define PARK_HEADS_OMNI 0x80
+#define ECHO 0xf4
+
+// Put drive in Prep Mode
+
+#define PREP_MODE_SELECT 0x11
+
+// Prep Mode Commands
+
+#define PREP_RESET_DRIVE 0x00
+#define PREP_FORMAT_DRIVE 0x01
+#define PREP_FILL_DRIVE_OMNI 0x81
+#define PREP_VERIFY 0x07
+#define PREP_READ_FIRMWARE 0x32
+#define PREP_WRITE_FIRMWARE 0x33
+
+//
+// Controller Status Codes
+//
+
+// Disk status codes
+
+#define STAT_SUCCESS 0x00
+
+#define STAT_HEADER_FAULT 0x00
+#define STAT_SEEK_TIMEOUT 0x01
+#define STAT_SEEK_FAULT 0x02
+#define STAT_SEEK_ERROR 0x03
+#define STAT_HEADER_CRC_ERROR 0x04
+#define STAT_REZERO_FAULT 0x05
+#define STAT_REZERO_TIMEOUT 0x06
+#define STAT_DRIVE_NOT_ONLINE 0x07
+#define STAT_WRITE_FAULT 0x08
+#define STAT_NOT_USED 0x09
+#define STAT_READ_DATA_FAULT 0x0a
+#define STAT_DATA_CRC_ERROR 0x0b
+#define STAT_SECTOR_LOCATE_ERR 0x0c
+#define STAT_WRITE_PROTECTED 0x0d
+#define STAT_ILL_SECTOR_ADDRESS 0x0e
+#define STAT_ILL_CMD_OP_CODE 0x0f
+#define STAT_DRIVE_NOT_ACK 0x10
+#define STAT_ACK_STUCK_ACTIVE 0x11
+#define STAT_TIMEOUT 0x12
+#define STAT_FAULT 0x13
+#define STAT_CRC 0x14
+#define STAT_SEEK 0x15
+#define STAT_VERIFICATION 0x16
+#define STAT_SPEED_ERROR 0x17
+#define STAT_ILL_ADDRESS 0x18
+#define STAT_RW_FAULT_ERROR 0x19
+#define STAT_SERVO_ERROR 0x1a
+#define STAT_GUARD_BAND 0x1b
+#define STAT_PLO_ERROR 0x1c
+#define STAT_RW_UNSAFE 0x1d
+
+// Disk status modifiers (added to status code)
+
+#define STAT_RECOVERABLE_ERR 0x20
+#define STAT_VERIFY_ERR 0x40
+#define STAT_FATAL_ERR 0x80
+
+// Semaphore status codes
+
+#define SEM_PRIOR_STATE_NOT_SET 0x00
+#define SEM_PRIOR_STATE_SET 0x80
+#define SEM_TABLE_FULL 0xfd
+#define SEM_DISK_ERROR 0xfe
+
+// Pipe Status codes
+
+#define PIPE_REQ_SUCCESSFUL 0x00
+#define PIPE_EMPTY_PIPE_READ 0x08
+#define PIPE_NOT_OPEN 0x09
+#define PIPE_WRITE_TO_FULL_PIPE 0x0a
+#define PIPE_OPEN_OPEN_PIPE 0x0b
+#define PIPE_PIPE_NOT_EXIST 0x0c
+#define PIPE_NO_ROOM_FOR_NEW 0x0d
+#define PIPE_ILLEGAL_COMMAND 0x0e
+#define PIPE_AREA_NOT_INIT 0x0f
+
+// Pipe State codes
+
+#define PIPE_OPEN_WRITE_EMPTY 0x01
+#define PIPE_OPEN_READ_EMPTY 0x02
+#define PIPE_NOT_OPEN_FULL 0x80
+#define PIPE_OPEN_WRITE_FULL 0x81
+#define PIPE_OPEN_READ_FULL 0x82
+
+
+DEFINE_DEVICE_TYPE(CORVUS_HDC, corvus_hdc_device, "corvus_hdc", "Corvus Flat Cable HDC")
+
+corvus_hdc_device::corvus_hdc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ device_t(mconfig, CORVUS_HDC, tag, owner, clock),
m_status(0),
m_prep_mode(false),
m_prep_drv(0),
@@ -120,7 +271,7 @@ corvus_hdc_t::corvus_hdc_t(const machine_config &mconfig, const char *tag, devic
// Returns:
// nada
//
-void corvus_hdc_t::dump_buffer(uint8_t *buffer, uint16_t length) {
+void corvus_hdc_device::dump_buffer(uint8_t *buffer, uint16_t length) {
uint16_t offset;
char ascii_dump[16];
@@ -160,7 +311,7 @@ void corvus_hdc_t::dump_buffer(uint8_t *buffer, uint16_t length) {
// Returns:
// Whether the command was invalid or not (true = invalid command)
//
-bool corvus_hdc_t::parse_hdc_command(uint8_t data) {
+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));
@@ -266,7 +417,7 @@ bool corvus_hdc_t::parse_hdc_command(uint8_t data) {
// Returns:
// status: Command status
//
-uint8_t corvus_hdc_t::corvus_write_sector(uint8_t drv, uint32_t sector, uint8_t *buffer, int len) {
+uint8_t corvus_hdc_device::corvus_write_sector(uint8_t drv, uint32_t sector, uint8_t *buffer, int len) {
hard_disk_file
*disk; // Structures for interface to CHD routines
uint8_t tbuffer[512]; // Buffer to hold an entire sector
@@ -324,7 +475,7 @@ uint8_t corvus_hdc_t::corvus_write_sector(uint8_t drv, uint32_t sector, uint8_t
// Returns:
// status: Corvus status
//
-uint8_t corvus_hdc_t::corvus_write_logical_sector(dadr_t *dadr, uint8_t *buffer, int len) {
+uint8_t corvus_hdc_device::corvus_write_logical_sector(dadr_t *dadr, uint8_t *buffer, int len) {
uint8_t status; // Status returned from Physical Sector read
uint8_t drv; // Corvus drive id (1..15)
uint32_t sector; // Sector number on drive
@@ -374,7 +525,7 @@ uint8_t corvus_hdc_t::corvus_write_logical_sector(dadr_t *dadr, uint8_t *buffer,
// Returns:
// status: Corvus status
//
-uint8_t corvus_hdc_t::corvus_read_sector(uint8_t drv, uint32_t sector, uint8_t *buffer, int len) {
+uint8_t corvus_hdc_device::corvus_read_sector(uint8_t drv, uint32_t sector, uint8_t *buffer, int len) {
hard_disk_file
*disk; // Structures for interface to CHD routines
uint8_t tbuffer[512]; // Buffer to store full sector results in
@@ -421,7 +572,7 @@ uint8_t corvus_hdc_t::corvus_read_sector(uint8_t drv, uint32_t sector, uint8_t *
// Returns:
// status: Corvus status
//
-uint8_t corvus_hdc_t::corvus_read_logical_sector(dadr_t *dadr, uint8_t *buffer, int len) {
+uint8_t corvus_hdc_device::corvus_read_logical_sector(dadr_t *dadr, uint8_t *buffer, int len) {
uint8_t status; // Status returned from Physical Sector read
uint8_t drv; // Corvus drive id (1..15)
uint32_t sector; // Sector number on drive
@@ -472,7 +623,7 @@ uint8_t corvus_hdc_t::corvus_read_logical_sector(dadr_t *dadr, uint8_t *buffer,
// Side-effects:
// Fills in the semaphore result code
//
-uint8_t corvus_hdc_t::corvus_lock_semaphore(uint8_t *name) {
+uint8_t corvus_hdc_device::corvus_lock_semaphore(uint8_t *name) {
semaphore_table_block_t
semaphore_table;
uint8_t offset = 0;
@@ -547,7 +698,7 @@ uint8_t corvus_hdc_t::corvus_lock_semaphore(uint8_t *name) {
// Side-effects:
// Fills in the semaphore result code
//
-uint8_t corvus_hdc_t::corvus_unlock_semaphore(uint8_t *name) {
+uint8_t corvus_hdc_device::corvus_unlock_semaphore(uint8_t *name) {
semaphore_table_block_t
semaphore_table;
uint8_t offset = 0;
@@ -612,7 +763,7 @@ uint8_t corvus_hdc_t::corvus_unlock_semaphore(uint8_t *name) {
// Disk status
//
//
-uint8_t corvus_hdc_t::corvus_init_semaphore_table() {
+uint8_t corvus_hdc_device::corvus_init_semaphore_table() {
semaphore_table_block_t
semaphore_table;
uint8_t status;
@@ -641,7 +792,7 @@ uint8_t corvus_hdc_t::corvus_init_semaphore_table() {
// Returns:
// Status of command
//
-uint8_t corvus_hdc_t::corvus_get_drive_parameters(uint8_t drv) {
+uint8_t corvus_hdc_device::corvus_get_drive_parameters(uint8_t drv) {
uint16_t capacity; // Number of usable 512-byte blocks
uint16_t raw_capacity; // Number of actual 512-byte blocks
union {
@@ -755,7 +906,7 @@ uint8_t corvus_hdc_t::corvus_get_drive_parameters(uint8_t drv) {
// Returns:
// status: Status of read operation
//
-uint8_t corvus_hdc_t::corvus_read_boot_block(uint8_t block) {
+uint8_t corvus_hdc_device::corvus_read_boot_block(uint8_t 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);
@@ -792,7 +943,7 @@ uint8_t corvus_hdc_t::corvus_read_boot_block(uint8_t block) {
// Returns:
// Status of command
//
-uint8_t corvus_hdc_t::corvus_enter_prep_mode(uint8_t drv, uint8_t *prep_block) {
+uint8_t corvus_hdc_device::corvus_enter_prep_mode(uint8_t drv, uint8_t *prep_block) {
// on rev b/h drives, sending the "put drive into prep mode"
// command when already in prep mode is an error.
if (m_prep_mode) {
@@ -824,7 +975,7 @@ uint8_t corvus_hdc_t::corvus_enter_prep_mode(uint8_t drv, uint8_t *prep_block) {
// Returns:
// Status of command (always success)
//
-uint8_t corvus_hdc_t::corvus_exit_prep_mode() {
+uint8_t corvus_hdc_device::corvus_exit_prep_mode() {
LOG(("corvus_exit_prep_mode: Prep mode exited\n"));
m_prep_mode = false;
m_prep_drv = 0;
@@ -845,7 +996,7 @@ uint8_t corvus_hdc_t::corvus_exit_prep_mode() {
// Returns:
// Status of command
//
-uint8_t corvus_hdc_t::corvus_read_firmware_block(uint8_t head, uint8_t sector) {
+uint8_t corvus_hdc_device::corvus_read_firmware_block(uint8_t head, uint8_t sector) {
uint16_t relative_sector; // Relative sector on drive for Physical Read
uint8_t status;
@@ -873,7 +1024,7 @@ uint8_t corvus_hdc_t::corvus_read_firmware_block(uint8_t head, uint8_t sector) {
// Returns:
// Status of command
//
-uint8_t corvus_hdc_t::corvus_write_firmware_block(uint8_t head, uint8_t sector, uint8_t *buffer) {
+uint8_t corvus_hdc_device::corvus_write_firmware_block(uint8_t head, uint8_t sector, uint8_t *buffer) {
uint16_t relative_sector; // Relative sector on drive for Physical Write
uint8_t status;
@@ -899,7 +1050,7 @@ uint8_t corvus_hdc_t::corvus_write_firmware_block(uint8_t head, uint8_t sector,
// Returns:
// Status of command
//
-uint8_t corvus_hdc_t::corvus_format_drive(uint8_t *pattern, uint16_t len) {
+uint8_t corvus_hdc_device::corvus_format_drive(uint8_t *pattern, uint16_t len) {
uint32_t sector;
uint32_t max_sector;
uint8_t status = 0;
@@ -946,7 +1097,7 @@ uint8_t corvus_hdc_t::corvus_format_drive(uint8_t *pattern, uint16_t len) {
// Returns:
// hard_disk_file object
//
-hard_disk_file *corvus_hdc_t::corvus_hdc_file(int drv) {
+hard_disk_file *corvus_hdc_device::corvus_hdc_file(int drv) {
static const char *const tags[] = {
"harddisk1", "harddisk2", "harddisk3", "harddisk4"
};
@@ -991,7 +1142,7 @@ hard_disk_file *corvus_hdc_t::corvus_hdc_file(int drv) {
// Returns:
// Nothing
//
-void corvus_hdc_t::corvus_process_command_packet(bool invalid_command_flag) {
+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"));
@@ -1166,7 +1317,7 @@ void corvus_hdc_t::corvus_process_command_packet(bool invalid_command_flag) {
// Returns:
// Nothing
//
-void corvus_hdc_t::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+void corvus_hdc_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
int function = param;
@@ -1224,7 +1375,7 @@ void corvus_hdc_t::device_timer(emu_timer &timer, device_timer_id id, int param,
// Returns:
// nullptr if there's no file to attach to
//
-void corvus_hdc_t::device_start() {
+void corvus_hdc_device::device_start() {
m_status &= ~(CONTROLLER_DIRECTION | CONTROLLER_BUSY); // Host-to-controller mode, Idle (awaiting command from Host mode)
m_prep_mode = false; // We're not in Prep Mode
m_offset = 0; // Buffer is empty
@@ -1351,7 +1502,7 @@ void corvus_hdc_t::device_start() {
// Returns:
// Value in the controller status register
//
-READ8_MEMBER ( corvus_hdc_t::status_r ) {
+READ8_MEMBER ( corvus_hdc_device::status_r ) {
return m_status;
}
@@ -1370,7 +1521,7 @@ READ8_MEMBER ( corvus_hdc_t::status_r ) {
// Returns:
// Value in the controller data register
//
-READ8_MEMBER ( corvus_hdc_t::read ) {
+READ8_MEMBER ( corvus_hdc_device::read ) {
uint8_t result;
if((m_status & CONTROLLER_DIRECTION) == 0) { // Check to see if we're in Controller-to-Host mode
@@ -1418,7 +1569,7 @@ READ8_MEMBER ( corvus_hdc_t::read ) {
// Returns:
// Nothing
//
-WRITE8_MEMBER ( corvus_hdc_t::write ) {
+WRITE8_MEMBER ( corvus_hdc_device::write ) {
//
// Received a byte -- check to see if we should really respond
//
diff --git a/src/devices/machine/corvushd.h b/src/devices/machine/corvushd.h
index 129cbfcf3e9..22a8c4a1f10 100644
--- a/src/devices/machine/corvushd.h
+++ b/src/devices/machine/corvushd.h
@@ -12,176 +12,23 @@
*
****************************************************************************/
-#ifndef CORVUSHD_H_
-#define CORVUSHD_H_
+#ifndef MAME_MACHINE_CORVUSHD_H
+#define MAME_MACHINE_CORVUSHD_H
+
+#pragma once
#include "imagedev/harddriv.h"
#include <ctype.h>
-//
-// Controller Commands
-//
-
-// Read/Write Commands
-
-#define READ_SECTOR_256 0x02
-#define WRITE_SECTOR_256 0x03
-#define READ_CHUNK_128 0x12
-#define READ_CHUNK_256 0x22
-#define READ_CHUNK_512 0x32
-#define WRITE_CHUNK_128 0x13
-#define WRITE_CHUNK_256 0x23
-#define WRITE_CHUNK_512 0x33
-
-// Semaphore Commands
-
-#define SEMAPHORE_LOCK_CODE 0x0b
-#define SEMAPHORE_LOCK_MOD 0x01
-#define SEMAPHORE_UNLOCK_CODE 0x0b
-#define SEMAPHORE_UNLOCK_MOD 0x11
-#define SEMAPHORE_INIT_CODE 0x1a
-#define SEMAPHORE_INIT_MOD 0x10
-#define SEMAPHORE_STATUS_CODE 0x1a
-#define SEMAPHORE_STATUS_MOD 0x41
-
-// Pipe Commands
-
-#define PIPE_READ_CODE 0x1a
-#define PIPE_READ_MOD 0x20
-#define PIPE_WRITE_CODE 0x1a
-#define PIPE_WRITE_MOD 0x21
-#define PIPE_CLOSE_CODE 0x1a
-#define PIPE_CLOSE_MOD 0x40
-#define PIPE_STATUS_CODE 0x1a
-#define PIPE_STATUS_MOD 0x41
-#define PIPE_OPEN_WRITE_CODE 0x1b
-#define PIPE_OPEN_WRITE_MOD 0x80
-#define PIPE_AREA_INIT_CODE 0x1b
-#define PIPE_AREA_INIT_MOD 0xa0
-#define PIPE_OPEN_READ_CODE 0x1b
-#define PIPE_OPEN_READ_MOD 0xc0
-
-// Active User Table Commands
-
-#define ADDACTIVE_CODE 0x34
-#define ADDACTIVE_MOD 0x03
-#define DELACTIVEUSR_REVBH_CODE 0x34
-#define DELACTIVEUSR_REVBH_MOD 0x00
-#define DELACTIVENUM_OMNI_CODE 0x34
-#define DELACTIVENUM_OMNI_MOD 0x00
-#define DELACTIVEUSR_OMNI_CODE 0x34
-#define DELACTIVEUSR_OMNI_MOD 0x31
-#define FINDACTIVE_CODE 0x34
-#define FINDACTIVE_MOD 0x05
-#define READTEMPBLOCK 0xc4
-#define WRITETEMPBLOCK 0xb4
-
-// Miscellaneous Commands
-
-#define BOOT 0x14
-#define READ_BOOT_BLOCK 0x44
-#define GET_DRIVE_PARAMETERS 0x10
-#define PARK_HEADS_REVH 0x11
-#define PARK_HEADS_OMNI 0x80
-#define ECHO 0xf4
-
-// Put drive in Prep Mode
-
-#define PREP_MODE_SELECT 0x11
-
-// Prep Mode Commands
-
-#define PREP_RESET_DRIVE 0x00
-#define PREP_FORMAT_DRIVE 0x01
-#define PREP_FILL_DRIVE_OMNI 0x81
-#define PREP_VERIFY 0x07
-#define PREP_READ_FIRMWARE 0x32
-#define PREP_WRITE_FIRMWARE 0x33
-
-//
-// Controller Status Codes
-//
-
-// Disk status codes
-
-#define STAT_SUCCESS 0x00
-
-#define STAT_HEADER_FAULT 0x00
-#define STAT_SEEK_TIMEOUT 0x01
-#define STAT_SEEK_FAULT 0x02
-#define STAT_SEEK_ERROR 0x03
-#define STAT_HEADER_CRC_ERROR 0x04
-#define STAT_REZERO_FAULT 0x05
-#define STAT_REZERO_TIMEOUT 0x06
-#define STAT_DRIVE_NOT_ONLINE 0x07
-#define STAT_WRITE_FAULT 0x08
-#define STAT_NOT_USED 0x09
-#define STAT_READ_DATA_FAULT 0x0a
-#define STAT_DATA_CRC_ERROR 0x0b
-#define STAT_SECTOR_LOCATE_ERR 0x0c
-#define STAT_WRITE_PROTECTED 0x0d
-#define STAT_ILL_SECTOR_ADDRESS 0x0e
-#define STAT_ILL_CMD_OP_CODE 0x0f
-#define STAT_DRIVE_NOT_ACK 0x10
-#define STAT_ACK_STUCK_ACTIVE 0x11
-#define STAT_TIMEOUT 0x12
-#define STAT_FAULT 0x13
-#define STAT_CRC 0x14
-#define STAT_SEEK 0x15
-#define STAT_VERIFICATION 0x16
-#define STAT_SPEED_ERROR 0x17
-#define STAT_ILL_ADDRESS 0x18
-#define STAT_RW_FAULT_ERROR 0x19
-#define STAT_SERVO_ERROR 0x1a
-#define STAT_GUARD_BAND 0x1b
-#define STAT_PLO_ERROR 0x1c
-#define STAT_RW_UNSAFE 0x1d
-
-// Disk status modifiers (added to status code)
-
-#define STAT_RECOVERABLE_ERR 0x20
-#define STAT_VERIFY_ERR 0x40
-#define STAT_FATAL_ERR 0x80
-
-// Semaphore status codes
-
-#define SEM_PRIOR_STATE_NOT_SET 0x00
-#define SEM_PRIOR_STATE_SET 0x80
-#define SEM_TABLE_FULL 0xfd
-#define SEM_DISK_ERROR 0xfe
-
-// Pipe Status codes
-
-#define PIPE_REQ_SUCCESSFUL 0x00
-#define PIPE_EMPTY_PIPE_READ 0x08
-#define PIPE_NOT_OPEN 0x09
-#define PIPE_WRITE_TO_FULL_PIPE 0x0a
-#define PIPE_OPEN_OPEN_PIPE 0x0b
-#define PIPE_PIPE_NOT_EXIST 0x0c
-#define PIPE_NO_ROOM_FOR_NEW 0x0d
-#define PIPE_ILLEGAL_COMMAND 0x0e
-#define PIPE_AREA_NOT_INIT 0x0f
-
-// Pipe State codes
-
-#define PIPE_OPEN_WRITE_EMPTY 0x01
-#define PIPE_OPEN_READ_EMPTY 0x02
-#define PIPE_NOT_OPEN_FULL 0x80
-#define PIPE_OPEN_WRITE_FULL 0x81
-#define PIPE_OPEN_READ_FULL 0x82
-
-// Status Register Bits
-
-#define CONTROLLER_BUSY 0x80 // Set = Busy, Clear = Ready
-#define CONTROLLER_DIRECTION 0x40 // Set = Controller->Host, Clear = Host->Controller
-
-#define MAX_COMMAND_SIZE 4096 // The maximum size of a command packet (the controller only has 5K of RAM...)
-
-class corvus_hdc_t : public device_t
+class corvus_hdc_device : public device_t
{
public:
+ // Status Register Bits
+ static constexpr uint8_t CONTROLLER_BUSY = 0x80; // Set = Busy, Clear = Ready
+ static constexpr uint8_t CONTROLLER_DIRECTION = 0x40; // Set = Controller->Host, Clear = Host->Controller
+
// construction/destruction
- corvus_hdc_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ corvus_hdc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
@@ -193,6 +40,8 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
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,
@@ -526,4 +375,4 @@ private:
// device type definition
extern const device_type CORVUS_HDC;
-#endif /* CORVUSHD_H_ */
+#endif // MAME_MACHINE_CORVUSHD_H
diff --git a/src/devices/machine/cr511b.cpp b/src/devices/machine/cr511b.cpp
index 11b084a3b7b..ef5b39b13b4 100644
--- a/src/devices/machine/cr511b.cpp
+++ b/src/devices/machine/cr511b.cpp
@@ -17,7 +17,7 @@
// DEVICE DEFINITIONS
//**************************************************************************
-const device_type CR511B = device_creator<cr511b_device>;
+DEFINE_DEVICE_TYPE(CR511B, cr511b_device, "cr511b", "CR-511-B CD-ROM drive")
//-------------------------------------------------
// machine_config_additions - device-specific
@@ -47,7 +47,7 @@ machine_config_constructor cr511b_device::device_mconfig_additions() const
//-------------------------------------------------
cr511b_device::cr511b_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, CR511B, "CR-511-B CD-ROM drive", tag, owner, clock, "cr511b", __FILE__),
+ device_t(mconfig, CR511B, tag, owner, clock),
m_cdrom(*this, "cdrom"),
m_cdda(*this, "cdda"),
m_stch_handler(*this),
diff --git a/src/devices/machine/cr511b.h b/src/devices/machine/cr511b.h
index 90119d70b82..546dcf51266 100644
--- a/src/devices/machine/cr511b.h
+++ b/src/devices/machine/cr511b.h
@@ -30,10 +30,10 @@
***************************************************************************/
-#pragma once
+#ifndef MAME_MACHINE_CR511B_H
+#define MAME_MACHINE_CR511B_H
-#ifndef __CR511B_H__
-#define __CR511B_H__
+#pragma once
#include "imagedev/chd_cd.h"
#include "sound/cdda.h"
@@ -77,23 +77,23 @@ public:
cr511b_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// callbacks
- template<class _Object> static devcb_base &set_stch_handler(device_t &device, _Object object)
- { return downcast<cr511b_device &>(device).m_stch_handler.set_callback(object); }
+ template <class Object> static devcb_base &set_stch_handler(device_t &device, Object &&cb)
+ { return downcast<cr511b_device &>(device).m_stch_handler.set_callback(std::forward<Object>(cb)); }
- template<class _Object> static devcb_base &set_sten_handler(device_t &device, _Object object)
- { return downcast<cr511b_device &>(device).m_sten_handler.set_callback(object); }
+ template <class Object> static devcb_base &set_sten_handler(device_t &device, Object &&cb)
+ { return downcast<cr511b_device &>(device).m_sten_handler.set_callback(std::forward<Object>(cb)); }
- template<class _Object> static devcb_base &set_drq_handler(device_t &device, _Object object)
- { return downcast<cr511b_device &>(device).m_drq_handler.set_callback(object); }
+ template <class Object> static devcb_base &set_drq_handler(device_t &device, Object &&cb)
+ { return downcast<cr511b_device &>(device).m_drq_handler.set_callback(std::forward<Object>(cb)); }
- template<class _Object> static devcb_base &set_dten_handler(device_t &device, _Object object)
- { return downcast<cr511b_device &>(device).m_dten_handler.set_callback(object); }
+ template <class Object> static devcb_base &set_dten_handler(device_t &device, Object &&cb)
+ { return downcast<cr511b_device &>(device).m_dten_handler.set_callback(std::forward<Object>(cb)); }
- template<class _Object> static devcb_base &set_scor_handler(device_t &device, _Object object)
- { return downcast<cr511b_device &>(device).m_scor_handler.set_callback(object); }
+ template <class Object> static devcb_base &set_scor_handler(device_t &device, Object &&cb)
+ { return downcast<cr511b_device &>(device).m_scor_handler.set_callback(std::forward<Object>(cb)); }
- template<class _Object> static devcb_base &set_xaen_handler(device_t &device, _Object object)
- { return downcast<cr511b_device &>(device).m_xaen_handler.set_callback(object); }
+ template <class Object> static devcb_base &set_xaen_handler(device_t &device, Object &&cb)
+ { return downcast<cr511b_device &>(device).m_xaen_handler.set_callback(std::forward<Object>(cb)); }
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER ( write );
@@ -144,6 +144,6 @@ private:
};
// device type definition
-extern const device_type CR511B;
+DECLARE_DEVICE_TYPE(CR511B, cr511b_device)
-#endif
+#endif // MAME_MACHINE_CR511B_H
diff --git a/src/devices/machine/cr589.cpp b/src/devices/machine/cr589.cpp
index 99f90c257ce..6142f75ee7a 100644
--- a/src/devices/machine/cr589.cpp
+++ b/src/devices/machine/cr589.cpp
@@ -4,8 +4,8 @@
#include "cr589.h"
-static const int identity_offset = 0x3ab;
-static const char download_identity[] = "MATSHITA CD98Q4 DOWNLOADGS0N";
+static constexpr int identity_offset = 0x3ab;
+static constexpr char download_identity[] = "MATSHITA CD98Q4 DOWNLOADGS0N";
//-------------------------------------------------
// nvram_default - called to initialize NVRAM to
@@ -138,10 +138,10 @@ void matsushita_cr589_device::WriteData( uint8_t *data, int dataLength )
}
// device type definition
-const device_type CR589 = device_creator<matsushita_cr589_device>;
+DEFINE_DEVICE_TYPE(CR589, matsushita_cr589_device, "cr589", "Matsushita CR589 CD-ROM Drive")
matsushita_cr589_device::matsushita_cr589_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- atapi_cdrom_device(mconfig, CR589, "Matsushita CR589 CD-ROM Drive", tag, owner, clock, "cr589", __FILE__),
+ atapi_cdrom_device(mconfig, CR589, tag, owner, clock),
device_nvram_interface(mconfig, *this)
{
}
diff --git a/src/devices/machine/cr589.h b/src/devices/machine/cr589.h
index b35537b305b..8d94d5739b9 100644
--- a/src/devices/machine/cr589.h
+++ b/src/devices/machine/cr589.h
@@ -8,13 +8,12 @@
***************************************************************************/
-#pragma once
+#ifndef MAME_MACHINE_CR589_H
+#define MAME_MACHINE_CR589_H
-#ifndef __CR589_H__
-#define __CR589_H__
+#pragma once
#include "atapicdr.h"
-#include "t10mmc.h"
class matsushita_cr589_device : public atapi_cdrom_device,
public device_nvram_interface
@@ -45,6 +44,6 @@ private:
};
// device type definition
-extern const device_type CR589;
+DECLARE_DEVICE_TYPE(CR589, matsushita_cr589_device)
-#endif
+#endif // MAME_MACHINE_CR589_H
diff --git a/src/devices/machine/cs4031.cpp b/src/devices/machine/cs4031.cpp
index 40cbb94ddbb..84b331c05bd 100644
--- a/src/devices/machine/cs4031.cpp
+++ b/src/devices/machine/cs4031.cpp
@@ -26,27 +26,32 @@
***************************************************************************/
#include "emu.h"
-#include "machine/ram.h"
#include "machine/cs4031.h"
+#include "machine/ram.h"
-//**************************************************************************
-// MACROS/CONSTANTS
-//**************************************************************************
+#define LOG_GENERAL (1U << 0)
+#define LOG_REGISTER (1U << 1)
+#define LOG_MEMORY (1U << 2)
+#define LOG_IO (1U << 3)
+#define LOG_KEYBOARD (1U << 4)
+
+#define VERBOSE (LOG_REGISTER | LOG_MEMORY | LOG_IO /*| LOG_KEYBOARD*/)
+#include "logmacro.h"
-#define LOG_REGISTER 1
-#define LOG_MEMORY 1
-#define LOG_IO 1
-#define LOG_KEYBOARD 0
+#define LOGREGISTER(...) LOGMASKED(LOG_REGISTER, __VA_ARGS__)
+#define LOGMEMORY(...) LOGMASKED(LOG_MEMORY, __VA_ARGS__)
+#define LOGIO(...) LOGMASKED(LOG_IO, __VA_ARGS__)
+#define LOGKEYBOARD(...) LOGMASKED(LOG_KEYBOARD, __VA_ARGS__)
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
-const device_type CS4031 = device_creator<cs4031_device>;
+DEFINE_DEVICE_TYPE(CS4031, cs4031_device, "cs4031", "CS4031")
-const char* cs4031_device::m_register_names[] =
+const char* const cs4031_device::m_register_names[] =
{
/* 00 */ "RESERVED",
/* 01 */ "DMA WAIT STATE CONTROL",
@@ -155,7 +160,7 @@ machine_config_constructor cs4031_device::device_mconfig_additions() const
//-------------------------------------------------
cs4031_device::cs4031_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, CS4031, "CS4031", tag, owner, clock, "cs4031", __FILE__),
+ device_t(mconfig, CS4031, tag, owner, clock),
m_read_ior(*this),
m_write_iow(*this),
m_write_tc(*this),
@@ -458,8 +463,7 @@ WRITE_LINE_MEMBER( cs4031_device::rtc_irq_w )
WRITE_LINE_MEMBER( cs4031_device::iochck_w )
{
- if (LOG_IO)
- logerror("cs4031_device::iochck_w: %u\n", state);
+ LOGIO("cs4031_device::iochck_w: %u\n", state);
if (BIT(m_portb, 3) == 0)
{
@@ -508,8 +512,7 @@ READ8_MEMBER( cs4031_device::config_data_r )
if (m_address_valid)
{
- if (LOG_REGISTER)
- logerror("cs4031_device: read %s = %02x\n", m_register_names[m_address], m_registers[m_address]);
+ LOGREGISTER("cs4031_device: read %s = %02x\n", m_register_names[m_address], m_registers[m_address]);
result = m_registers[m_address];
}
@@ -524,8 +527,7 @@ WRITE8_MEMBER( cs4031_device::config_data_w )
{
if (m_address_valid)
{
- if (LOG_REGISTER)
- logerror("cs4031_device: write %s = %02x\n", m_register_names[m_address], data);
+ LOGREGISTER("cs4031_device: write %s = %02x\n", m_register_names[m_address], data);
// update register with new data
m_registers[m_address] = data;
@@ -589,32 +591,28 @@ void cs4031_device::update_read_region(int index, const char *region, offs_t sta
{
if (!BIT(m_registers[SHADOW_READ], index) && BIT(m_registers[ROMCS], index))
{
- if (LOG_MEMORY)
- logerror("ROM read from %x to %x\n", start, end);
+ LOGMEMORY("ROM read from %x to %x\n", start, end);
m_space->install_read_bank(start, end, region);
machine().root_device().membank(region)->set_base(m_bios + start);
}
else if (!BIT(m_registers[SHADOW_READ], index) && !BIT(m_registers[ROMCS], index))
{
- if (LOG_MEMORY)
- logerror("ISA read from %x to %x\n", start, end);
+ LOGMEMORY("ISA read from %x to %x\n", start, end);
m_space->install_read_bank(start, end, region);
machine().root_device().membank(region)->set_base(m_isa + start - 0xc0000);
}
else if (BIT(m_registers[SHADOW_READ], index))
{
- if (LOG_MEMORY)
- logerror("RAM read from %x to %x\n", start, end);
+ LOGMEMORY("RAM read from %x to %x\n", start, end);
m_space->install_read_bank(start, end, region);
machine().root_device().membank(region)->set_base(m_ram + start);
}
else
{
- if (LOG_MEMORY)
- logerror("NOP read from %x to %x\n", start, end);
+ LOGMEMORY("NOP read from %x to %x\n", start, end);
m_space->nop_read(start, end);
}
@@ -624,32 +622,28 @@ void cs4031_device::update_write_region(int index, const char *region, offs_t st
{
if (!BIT(m_registers[SHADOW_WRITE], index) && BIT(m_registers[ROMCS], index) && BIT(m_registers[ROMCS], 7))
{
- if (LOG_MEMORY)
- logerror("ROM write from %x to %x\n", start, end);
+ LOGMEMORY("ROM write from %x to %x\n", start, end);
m_space->install_write_bank(start, end, region);
machine().root_device().membank(region)->set_base(m_bios + start);
}
else if (!BIT(m_registers[SHADOW_WRITE], index) && !BIT(m_registers[ROMCS], index))
{
- if (LOG_MEMORY)
- logerror("ISA write from %x to %x\n", start, end);
+ LOGMEMORY("ISA write from %x to %x\n", start, end);
m_space->install_write_bank(start, end, region);
machine().root_device().membank(region)->set_base(m_isa + start - 0xc0000);
}
else if (BIT(m_registers[SHADOW_WRITE], index))
{
- if (LOG_MEMORY)
- logerror("RAM write from %x to %x\n", start, end);
+ LOGMEMORY("RAM write from %x to %x\n", start, end);
m_space->install_write_bank(start, end, region);
machine().root_device().membank(region)->set_base(m_ram + start);
}
else
{
- if (LOG_MEMORY)
- logerror("NOP write from %x to %x\n", start, end);
+ LOGMEMORY("NOP write from %x to %x\n", start, end);
m_space->nop_write(start, end);
}
@@ -724,8 +718,7 @@ void cs4031_device::keyboard_gatea20(int state)
READ8_MEMBER( cs4031_device::keyb_status_r )
{
- if (LOG_KEYBOARD)
- logerror("cs4031_device::keyb_status_r\n");
+ LOGKEYBOARD("cs4031_device::keyb_status_r\n");
return m_keybc->status_r(space, 0);
}
@@ -739,8 +732,7 @@ WRITE8_MEMBER( cs4031_device::keyb_command_blocked_w )
WRITE8_MEMBER( cs4031_device::keyb_command_w )
{
- if (LOG_KEYBOARD)
- logerror("cs4031_device::keyb_command_w: %02x\n", data);
+ LOGKEYBOARD("cs4031_device::keyb_command_w: %02x\n", data);
m_keybc_d1_written = false;
@@ -811,16 +803,14 @@ WRITE8_MEMBER( cs4031_device::keyb_command_w )
READ8_MEMBER( cs4031_device::keyb_data_r )
{
- if (LOG_KEYBOARD)
- logerror("cs4031_device::keyb_data_r\n");
+ LOGKEYBOARD("cs4031_device::keyb_data_r\n");
return m_keybc->data_r(space, 0);
}
WRITE8_MEMBER( cs4031_device::keyb_data_w )
{
- if (LOG_KEYBOARD)
- logerror("cs4031_device::keyb_data_w: %02x\n", data);
+ LOGKEYBOARD("cs4031_device::keyb_data_w: %02x\n", data);
// data is blocked only for d1 command
if (BIT(m_registers[SOFT_RESET_AND_GATEA20], 7) && m_keybc_d1_written)
@@ -838,16 +828,14 @@ WRITE8_MEMBER( cs4031_device::keyb_data_w )
WRITE_LINE_MEMBER( cs4031_device::gatea20_w )
{
- if (LOG_KEYBOARD)
- logerror("cs4031_device::gatea20_w: %u\n", state);
+ LOGKEYBOARD("cs4031_device::gatea20_w: %u\n", state);
keyboard_gatea20(state);
}
WRITE_LINE_MEMBER( cs4031_device::kbrst_w )
{
- if (LOG_KEYBOARD)
- logerror("cs4031_device::kbrst_w: %u\n", state);
+ LOGKEYBOARD("cs4031_device::kbrst_w: %u\n", state);
// convert to active low signal (gets inverted in at_keybc.c)
state = (state == ASSERT_LINE ? 0 : 1);
@@ -875,8 +863,7 @@ WRITE_LINE_MEMBER( cs4031_device::kbrst_w )
*/
WRITE8_MEMBER( cs4031_device::sysctrl_w )
{
- if (LOG_IO)
- logerror("cs4031_device::sysctrl_w: %u\n", data);
+ LOGIO("cs4031_device::sysctrl_w: %u\n", data);
fast_gatea20(BIT(data, 1));
@@ -897,8 +884,7 @@ READ8_MEMBER( cs4031_device::sysctrl_r )
result |= m_cpureset << 0;
result |= m_fast_gatea20 << 1;
- if (LOG_IO)
- logerror("cs4031_device::sysctrl_r: %u\n", result);
+ LOGIO("cs4031_device::sysctrl_r: %u\n", result);
return result;
}
diff --git a/src/devices/machine/cs4031.h b/src/devices/machine/cs4031.h
index d57d14e0a0a..f3b43961c46 100644
--- a/src/devices/machine/cs4031.h
+++ b/src/devices/machine/cs4031.h
@@ -20,10 +20,10 @@
***************************************************************************/
-#pragma once
+#ifndef MAME_MACHINE_CS4031_H
+#define MAME_MACHINE_CS4031_H
-#ifndef __CS4031_H__
-#define __CS4031_H__
+#pragma once
#include "machine/am9517a.h"
#include "machine/pic8259.h"
@@ -87,15 +87,15 @@ public:
virtual machine_config_constructor device_mconfig_additions() const override;
// callbacks
- template<class _ior> devcb_base &set_ior_callback(_ior ior) { return m_read_ior.set_callback(ior); }
- template<class _iow> devcb_base &set_iow_callback(_iow iow) { return m_write_iow.set_callback(iow); }
- template<class _tc> devcb_base &set_tc_callback(_tc tc) { return m_write_tc.set_callback(tc); }
- template<class _hold> devcb_base &set_hold_callback(_hold hold) { return m_write_hold.set_callback(hold); }
- template<class _cpureset> devcb_base &set_cpureset_callback(_cpureset cpureset) { return m_write_cpureset.set_callback(cpureset); }
- template<class _nmi> devcb_base &set_nmi_callback(_nmi nmi) { return m_write_nmi.set_callback(nmi); }
- template<class _intr> devcb_base &set_intr_callback(_intr intr) { return m_write_intr.set_callback(intr); }
- template<class _a20m> devcb_base &set_a20m_callback(_a20m a20m) { return m_write_a20m.set_callback(a20m); }
- template<class _spkr> devcb_base &set_spkr_callback(_spkr spkr) { return m_write_spkr.set_callback(spkr); }
+ template <class Obj> devcb_base &set_ior_callback(Obj &&ior) { return m_read_ior.set_callback(std::forward<Obj>(ior)); }
+ template <class Obj> devcb_base &set_iow_callback(Obj &&iow) { return m_write_iow.set_callback(std::forward<Obj>(iow)); }
+ template <class Obj> devcb_base &set_tc_callback(Obj &&tc) { return m_write_tc.set_callback(std::forward<Obj>(tc)); }
+ template <class Obj> devcb_base &set_hold_callback(Obj &&hold) { return m_write_hold.set_callback(std::forward<Obj>(hold)); }
+ template <class Obj> devcb_base &set_cpureset_callback(Obj &&cpureset) { return m_write_cpureset.set_callback(std::forward<Obj>(cpureset)); }
+ template <class Obj> devcb_base &set_nmi_callback(Obj &&nmi) { return m_write_nmi.set_callback(std::forward<Obj>(nmi)); }
+ template <class Obj> devcb_base &set_intr_callback(Obj &&intr) { return m_write_intr.set_callback(std::forward<Obj>(intr)); }
+ template <class Obj> devcb_base &set_a20m_callback(Obj &&a20m) { return m_write_a20m.set_callback(std::forward<Obj>(a20m)); }
+ template <class Obj> devcb_base &set_spkr_callback(Obj &&spkr) { return m_write_spkr.set_callback(std::forward<Obj>(spkr)); }
// not really public
DECLARE_READ8_MEMBER( dma_read_byte );
@@ -107,9 +107,9 @@ public:
DECLARE_READ8_MEMBER( dma1_ior1_r ) { return m_read_ior(1); }
DECLARE_READ8_MEMBER( dma1_ior2_r ) { return m_read_ior(2); }
DECLARE_READ8_MEMBER( dma1_ior3_r ) { return m_read_ior(3); }
- DECLARE_READ8_MEMBER( dma2_ior1_r ) { uint16_t result = m_read_ior(5); m_dma_high_byte = result >> 8; return result; }
- DECLARE_READ8_MEMBER( dma2_ior2_r ) { uint16_t result = m_read_ior(6); m_dma_high_byte = result >> 8; return result; }
- DECLARE_READ8_MEMBER( dma2_ior3_r ) { uint16_t result = m_read_ior(7); m_dma_high_byte = result >> 8; return result; }
+ DECLARE_READ8_MEMBER( dma2_ior1_r ) { uint16_t const result = m_read_ior(5); m_dma_high_byte = result >> 8; return result; }
+ DECLARE_READ8_MEMBER( dma2_ior2_r ) { uint16_t const result = m_read_ior(6); m_dma_high_byte = result >> 8; return result; }
+ DECLARE_READ8_MEMBER( dma2_ior3_r ) { uint16_t const result = m_read_ior(7); m_dma_high_byte = result >> 8; return result; }
DECLARE_WRITE8_MEMBER( dma1_iow0_w ) { m_write_iow(0, data, 0xffff); }
DECLARE_WRITE8_MEMBER( dma1_iow1_w ) { m_write_iow(1, data, 0xffff); }
DECLARE_WRITE8_MEMBER( dma1_iow2_w ) { m_write_iow(2, data, 0xffff); }
@@ -260,7 +260,7 @@ private:
bool m_keybc_data_blocked;
// chipset configuration
- static const char* m_register_names[];
+ static const char* const m_register_names[];
static const float m_dma_clock_divider[];
enum
@@ -283,7 +283,6 @@ private:
// device type definition
-extern const device_type CS4031;
-
+DECLARE_DEVICE_TYPE(CS4031, cs4031_device)
-#endif /* __CS4031_H__ */
+#endif // MAME_MACHINE_CS4031_H
diff --git a/src/devices/machine/cs8221.cpp b/src/devices/machine/cs8221.cpp
index bc94f1e19af..61676abad65 100644
--- a/src/devices/machine/cs8221.cpp
+++ b/src/devices/machine/cs8221.cpp
@@ -16,18 +16,21 @@
***************************************************************************/
#include "emu.h"
-#include "machine/ram.h"
#include "machine/cs8221.h"
+#include "machine/ram.h"
+#define LOG_GENERAL (1U << 0)
+#define LOG_REGISTER (1U << 1)
+#define LOG_MEMORY (1U << 2)
-//**************************************************************************
-// GLOBAL VARIABLES
-//**************************************************************************
+#define VERBOSE (LOG_REGISTER | LOG_MEMORY)
+#include "logmacro.h"
+
+#define LOGREGISTER(...) LOGMASKED(LOG_REGISTER, __VA_ARGS__)
+#define LOGMEMORY(...) LOGMASKED(LOG_MEMORY, __VA_ARGS__)
-#define LOG_REGISTER 1
-#define LOG_MEMORY 1
-const device_type CS8221 = device_creator<cs8221_device>;
+DEFINE_DEVICE_TYPE(CS8221, cs8221_device, "cs8221", "CS8221 NEAT")
static const char *const register_names[] =
@@ -59,7 +62,7 @@ static const char *const register_names[] =
//-------------------------------------------------
cs8221_device::cs8221_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, CS8221, "CS8221", tag, owner, clock, "cs8221", __FILE__),
+ : device_t(mconfig, CS8221, tag, owner, clock),
m_address(0),
m_address_valid(false)
{
@@ -122,8 +125,7 @@ READ8_MEMBER( cs8221_device::data_r )
if (m_address_valid)
{
- if (LOG_REGISTER)
- logerror("cs8221_device: read %s = %02x\n", register_names[m_address & 0x0f], m_registers[m_address & 0x0f]);
+ LOGREGISTER("cs8221_device: read %s = %02x\n", register_names[m_address & 0x0f], m_registers[m_address & 0x0f]);
result = m_registers[m_address & 0x0f];
}
@@ -138,8 +140,7 @@ WRITE8_MEMBER( cs8221_device::data_w )
{
if (m_address_valid)
{
- if (LOG_REGISTER)
- logerror("cs8221_device: write %s = %02x\n", register_names[m_address & 0x0f], data);
+ LOGREGISTER("cs8221_device: write %s = %02x\n", register_names[m_address & 0x0f], data);
// update register with new data
m_registers[m_address & 0x0f] = data;
diff --git a/src/devices/machine/cs8221.h b/src/devices/machine/cs8221.h
index 7ec94963eec..3354ebfdeef 100644
--- a/src/devices/machine/cs8221.h
+++ b/src/devices/machine/cs8221.h
@@ -15,10 +15,10 @@
***************************************************************************/
-#pragma once
+#ifndef MAME_MACHINE_CS8221_H
+#define MAME_MACHINE_CS8221_H
-#ifndef __CS8221_H__
-#define __CS8221_H__
+#pragma once
@@ -82,7 +82,6 @@ private:
// device type definition
-extern const device_type CS8221;
-
+DECLARE_DEVICE_TYPE(CS8221, cs8221_device)
-#endif /* __CS8221_H__ */
+#endif // MAME_MACHINE_CS8221_H
diff --git a/src/devices/machine/cxd1095.cpp b/src/devices/machine/cxd1095.cpp
index 5aaf3a14ad3..bb39a440bed 100644
--- a/src/devices/machine/cxd1095.cpp
+++ b/src/devices/machine/cxd1095.cpp
@@ -23,7 +23,7 @@
// GLOBAL VARIABLES
//**************************************************************************
-const device_type CXD1095 = device_creator<cxd1095_device>;
+DEFINE_DEVICE_TYPE(CXD1095, cxd1095_device, "cxd1095", "CXD1095 I/O Expander")
//**************************************************************************
// DEVICE DEFINITION
@@ -34,9 +34,9 @@ const device_type CXD1095 = device_creator<cxd1095_device>;
//-------------------------------------------------
cxd1095_device::cxd1095_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : device_t(mconfig, CXD1095, "CXD1095 I/O Expander", tag, owner, clock, "cxd1095", __FILE__),
- m_input_cb{{*this}, {*this}, {*this}, {*this}, {*this}},
- m_output_cb{{*this}, {*this}, {*this}, {*this}, {*this}}
+ : device_t(mconfig, CXD1095, tag, owner, clock)
+ , m_input_cb{{*this}, {*this}, {*this}, {*this}, {*this}}
+ , m_output_cb{{*this}, {*this}, {*this}, {*this}, {*this}}
{
}
diff --git a/src/devices/machine/cxd1095.h b/src/devices/machine/cxd1095.h
index 2fce5fced2a..10405d8fd93 100644
--- a/src/devices/machine/cxd1095.h
+++ b/src/devices/machine/cxd1095.h
@@ -39,10 +39,10 @@
**********************************************************************/
-#pragma once
+#ifndef MAME_MACHINE_CXD1095_H
+#define MAME_MACHINE_CXD1095_H
-#ifndef DEVICES_MACHINE_CXD1095_H
-#define DEVICES_MACHINE_CXD1095_H
+#pragma once
//**************************************************************************
// CONFIGURATION MACROS
@@ -83,13 +83,13 @@ public:
cxd1095_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
// static configuration
- template<class Object>
+ template <class Object>
static devcb_base &set_input_cb(device_t &device, int p, Object &&obj)
{
assert(p >= 0 && p < 5);
return downcast<cxd1095_device &>(device).m_input_cb[p].set_callback(std::forward<Object>(obj));
}
- template<class Object>
+ template <class Object>
static devcb_base &set_output_cb(device_t &device, int p, Object &&obj)
{
assert(p >= 0 && p < 5);
@@ -116,6 +116,6 @@ private:
};
// device type definition
-extern const device_type CXD1095;
+DECLARE_DEVICE_TYPE(CXD1095, cxd1095_device)
-#endif
+#endif // MAME_MACHINE_CXD1095_H
diff --git a/src/devices/machine/diablo_hd.cpp b/src/devices/machine/diablo_hd.cpp
index c49ce231005..a31d309bf2b 100644
--- a/src/devices/machine/diablo_hd.cpp
+++ b/src/devices/machine/diablo_hd.cpp
@@ -58,11 +58,16 @@
* </PRE>
*/
+#ifndef DIABLO_DEBUG
+#define DIABLO_DEBUG 1 //!< set to 1 to enable debug log output
+#endif
+
+#define LOG_DRIVE(...) do { if (DIABLO_DEBUG) logprintf(__VA_ARGS__); } while (0)
+
+
diablo_hd_device::diablo_hd_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, DIABLO_HD, "Diablo Disk", tag, owner, clock, "diablo_hd", __FILE__),
-#if DIABLO_DEBUG
+ device_t(mconfig, DIABLO_HD, tag, owner, clock),
m_log_level(8),
-#endif
m_diablo31(true),
m_unit(0),
m_packs(1),
@@ -111,20 +116,18 @@ diablo_hd_device::~diablo_hd_device()
{
}
-#if DIABLO_DEBUG
template <typename Format, typename... Params>
void diablo_hd_device::logprintf(int level, Format &&fmt, Params &&... args)
{
if (level <= m_log_level)
logerror(std::forward<Format>(fmt), std::forward<Params>(args)...);
}
-#endif
void diablo_hd_device::set_sector_callback(void *cookie, void (*callback)(void *, int))
{
if (m_sector_callback_cookie == cookie && m_sector_callback == callback)
return;
- LOG_DRIVE((0,"[DHD%u] cookie=%p callback=%p\n", m_unit, cookie, (void *)callback));
+ LOG_DRIVE(0,"[DHD%u] cookie=%p callback=%p\n", m_unit, cookie, (void *)callback);
m_sector_callback_cookie = cookie;
m_sector_callback = callback;
}
@@ -277,22 +280,22 @@ void diablo_hd_device::read_sector()
{
/* If there's no drive, just reset the page number */
if (!m_image) {
- LOG_DRIVE((0,"[DHD%u] CHS:%03d/%d/%02d => no image\n", m_unit, m_cylinder, m_head, m_sector));
+ LOG_DRIVE(0,"[DHD%u] CHS:%03d/%d/%02d => no image\n", m_unit, m_cylinder, m_head, m_sector);
m_page = -1;
return;
}
if (m_cylinder < 0 || m_cylinder >= m_cylinders) {
- LOG_DRIVE((0,"[DHD%u] CHS:%03d/%d/%02d => invalid cylinder\n", m_unit, m_cylinder, m_head, m_sector));
+ LOG_DRIVE(0,"[DHD%u] CHS:%03d/%d/%02d => invalid cylinder\n", m_unit, m_cylinder, m_head, m_sector);
m_page = -1;
return;
}
if (m_head < 0 || m_head >= DIABLO_HEADS) {
- LOG_DRIVE((0,"[DHD%u] CHS:%03d/%d/%02d => invalid head\n", m_unit, m_cylinder, m_head, m_sector));
+ LOG_DRIVE(0,"[DHD%u] CHS:%03d/%d/%02d => invalid head\n", m_unit, m_cylinder, m_head, m_sector);
m_page = -1;
return;
}
if (m_sector < 0 || m_sector >= DIABLO_SPT) {
- LOG_DRIVE((0,"[DHD%u] CHS:%03d/%d/%02d => invalid sector\n", m_unit, m_cylinder, m_head, m_sector));
+ LOG_DRIVE(0,"[DHD%u] CHS:%03d/%d/%02d => invalid sector\n", m_unit, m_cylinder, m_head, m_sector);
m_page = -1;
return;
}
@@ -301,7 +304,7 @@ void diablo_hd_device::read_sector()
// already have the sector image?
if (m_cache[m_page]) {
- LOG_DRIVE((9,"[DHD%u] CHS:%03d/%d/%02d => page:%d is cached\n", m_unit, m_cylinder, m_head, m_sector, m_page));
+ LOG_DRIVE(9,"[DHD%u] CHS:%03d/%d/%02d => page:%d is cached\n", m_unit, m_cylinder, m_head, m_sector, m_page);
return;
}
@@ -310,13 +313,13 @@ void diablo_hd_device::read_sector()
m_cache[m_page] = std::make_unique<uint8_t[]>(sizeof(diablo_sector_t));
// and read the page from the hard_disk image
if (hard_disk_read(m_disk, m_page, m_cache[m_page].get())) {
- LOG_DRIVE((2,"[DHD%u] CHS:%03d/%d/%02d => page:%d loaded\n", m_unit, m_cylinder, m_head, m_sector, m_page));
+ LOG_DRIVE(2,"[DHD%u] CHS:%03d/%d/%02d => page:%d loaded\n", m_unit, m_cylinder, m_head, m_sector, m_page);
} else {
- LOG_DRIVE((0,"[DHD%u] CHS:%03d/%d/%02d => page:%d read failed\n", m_unit, m_cylinder, m_head, m_sector, m_page));
+ LOG_DRIVE(0,"[DHD%u] CHS:%03d/%d/%02d => page:%d read failed\n", m_unit, m_cylinder, m_head, m_sector, m_page);
m_cache[m_page] = nullptr;
}
} else {
- LOG_DRIVE((2,"[DHD%u] no disk\n", m_unit));
+ LOG_DRIVE(2,"[DHD%u] no disk\n", m_unit);
}
}
@@ -435,7 +438,7 @@ uint32_t* diablo_hd_device::expand_sector()
/* allocate a sector buffer */
if (!m_cache[m_page]) {
- LOG_DRIVE((0,"[DHD%u] no image for page #%d\n", m_unit, m_page));
+ LOG_DRIVE(0,"[DHD%u] no image for page #%d\n", m_unit, m_page);
return nullptr;
}
diablo_sector_t *s = reinterpret_cast<diablo_sector_t *>(m_cache[m_page].get());
@@ -482,26 +485,26 @@ uint32_t* diablo_hd_device::expand_sector()
}
m_bits[m_page] = bits;
- LOG_DRIVE((0,"[DHD%u] CHS:%03d/%d/%02d #%5d bits\n", m_unit, m_cylinder, m_head, m_sector, dst));
-#if DIABLO_DEBUG
- dump_record(s->pageno, 0, sizeof(s->pageno), "pageno", 0);
- dump_record(s->header, 0, sizeof(s->header), "header", 0);
- dump_record(s->label, 0, sizeof(s->label), "label", 0);
- dump_record(s->data, 0, sizeof(s->data), "data", 1);
-#endif
+ LOG_DRIVE(0,"[DHD%u] CHS:%03d/%d/%02d #%5d bits\n", m_unit, m_cylinder, m_head, m_sector, dst);
+ if (DIABLO_DEBUG)
+ {
+ dump_record(s->pageno, 0, sizeof(s->pageno), "pageno", 0);
+ dump_record(s->header, 0, sizeof(s->header), "header", 0);
+ dump_record(s->label, 0, sizeof(s->label), "label", 0);
+ dump_record(s->data, 0, sizeof(s->data), "data", 1);
+ }
return bits;
}
-#if DIABLO_DEBUG
void diablo_hd_device::dump_ascii(uint8_t *src, size_t size)
{
size_t offs;
- LOG_DRIVE((0," ["));
+ LOG_DRIVE(0," [");
for (offs = 0; offs < size; offs++) {
- char ch = (char)src[offs ^ 1];
- LOG_DRIVE((0, "%c", ch < 32 || ch > 126 ? '.' : ch));
+ char ch = char(src[offs ^ 1]);
+ LOG_DRIVE(0, "%c", ch < 32 || ch > 126 ? '.' : ch);
}
- LOG_DRIVE((0,"]\n"));
+ LOG_DRIVE(0,"]\n");
}
@@ -515,15 +518,15 @@ void diablo_hd_device::dump_ascii(uint8_t *src, size_t size)
size_t diablo_hd_device::dump_record(uint8_t *src, size_t addr, size_t size, const char *name, int cr)
{
size_t offs;
- LOG_DRIVE((0,"%s:", name));
+ LOG_DRIVE(0,"%s:", name);
for (offs = 0; offs < size; offs += 2) {
int word = src[offs] + 256 * src[offs + 1];
if (offs % 16) {
- LOG_DRIVE((0," %06o", word));
+ LOG_DRIVE(0," %06o", word);
} else {
if (offs > 0)
dump_ascii(&src[offs-16], 16);
- LOG_DRIVE((0,"\t%05o: %06o", (addr + offs) / 2, word));
+ LOG_DRIVE(0,"\t%05o: %06o", (addr + offs) / 2, word);
}
}
if (offs % 16) {
@@ -532,11 +535,10 @@ size_t diablo_hd_device::dump_record(uint8_t *src, size_t addr, size_t size, con
dump_ascii(&src[offs-16], 16);
}
if (cr) {
- LOG_DRIVE((0,"\n"));
+ LOG_DRIVE(0,"\n");
}
return size;
}
-#endif
/**
* @brief find a sync bit in an array of clock and data bits
@@ -570,7 +572,7 @@ size_t diablo_hd_device::squeeze_sync(uint32_t *bits, size_t src, size_t size)
}
}
/* return if no sync found within size*32 clock and data bits */
- LOG_DRIVE((0,"[DHD%u] no sync within %d words\n", m_unit, size));
+ LOG_DRIVE(0,"[DHD%u] no sync within %d words\n", m_unit, size);
return src;
}
@@ -605,7 +607,7 @@ size_t diablo_hd_device::squeeze_unsync(uint32_t *bits, size_t src, size_t size)
}
}
/* return if no sync found within size*32 clock and data bits */
- LOG_DRIVE((0,"[DHD%u] no unsync within %d words\n", m_unit, size));
+ LOG_DRIVE(0,"[DHD%u] no unsync within %d words\n", m_unit, size);
return src;
}
@@ -678,8 +680,8 @@ void diablo_hd_device::squeeze_sector()
int cksum_header, cksum_label, cksum_data;
if (m_rdfirst >= 0) {
- LOG_DRIVE((0, "[DHD%u] READ CHS:%03d/%d/%02d bit#%d ... bit#%d\n",
- m_unit, m_cylinder, m_head, m_sector, m_rdfirst, m_rdlast));
+ LOG_DRIVE(0, "[DHD%u] READ CHS:%03d/%d/%02d bit#%d ... bit#%d\n",
+ m_unit, m_cylinder, m_head, m_sector, m_rdfirst, m_rdlast);
}
m_rdfirst = -1;
m_rdlast = -1;
@@ -699,25 +701,25 @@ void diablo_hd_device::squeeze_sector()
}
if (m_wrfirst >= 0) {
- LOG_DRIVE((0, "[DHD%u] WRITE CHS:%03d/%d/%02d bit#%d ... bit#%d\n",
- m_unit, m_cylinder, m_head, m_sector, m_wrfirst, m_wrlast));
+ LOG_DRIVE(0, "[DHD%u] WRITE CHS:%03d/%d/%02d bit#%d ... bit#%d\n",
+ m_unit, m_cylinder, m_head, m_sector, m_wrfirst, m_wrlast);
}
m_wrfirst = -1;
m_wrlast = -1;
if (m_page < 0 || m_page >= m_pages) {
- LOG_DRIVE((0,"[DHD%u] page not set\n", m_unit));
+ LOG_DRIVE(0,"[DHD%u] page not set\n", m_unit);
return;
}
if (!m_cache[m_page]) {
- LOG_DRIVE((0,"[DHD%u] no image\n", m_unit));
+ LOG_DRIVE(0,"[DHD%u] no image\n", m_unit);
return;
}
/* no bits to write? */
if (!m_bits[m_page]) {
- LOG_DRIVE((0,"[DHD%u] no bits\n", m_unit));
+ LOG_DRIVE(0,"[DHD%u] no bits\n", m_unit);
return;
}
uint32_t *bits = m_bits[m_page];
@@ -731,34 +733,31 @@ void diablo_hd_device::squeeze_sector()
src = MFRRDL * 32;
src = squeeze_unsync(bits, src, 40); // skip first words and garbage until 0 bits are coming in
src = squeeze_sync(bits, src, 40); // sync on header preamble
- LOG_DRIVE((0,"[DHD%u] header sync bit #%5d\n", m_unit, src));
+ LOG_DRIVE(0,"[DHD%u] header sync bit #%5d\n", m_unit, src);
src = squeeze_record(bits, src, s->header, sizeof(s->header));
- LOG_DRIVE((0,"[DHD%u] header CRC bit #%5d\n", m_unit, src));
+ LOG_DRIVE(0,"[DHD%u] header CRC bit #%5d\n", m_unit, src);
src = squeeze_cksum(bits, src, &cksum_header);
-#if DIABLO_DEBUG
- dump_record(s->header, 0, sizeof(s->header), "header", 0);
-#endif
+ if (DIABLO_DEBUG)
+ dump_record(s->header, 0, sizeof(s->header), "header", 0);
src = squeeze_unsync(bits, src, 40); // skip garbage until 0 bits are coming in
src = squeeze_sync(bits, src, 40); // sync on label preamble
- LOG_DRIVE((0,"[DHD%u] label sync bit #%5d\n", m_unit, src));
+ LOG_DRIVE(0,"[DHD%u] label sync bit #%5d\n", m_unit, src);
src = squeeze_record(bits, src, s->label, sizeof(s->label));
- LOG_DRIVE((0,"[DHD%u] label CRC bit #%5d\n", m_unit, src));
+ LOG_DRIVE(0,"[DHD%u] label CRC bit #%5d\n", m_unit, src);
src = squeeze_cksum(bits, src, &cksum_label);
-#if DIABLO_DEBUG
- dump_record(s->label, 0, sizeof(s->label), "label", 0);
-#endif
+ if (DIABLO_DEBUG)
+ dump_record(s->label, 0, sizeof(s->label), "label", 0);
src = squeeze_unsync(bits, src, 40); // skip garbage until 0 bits are coming in
src = squeeze_sync(bits, src, 40); // sync on data preamble
- LOG_DRIVE((0,"[DHD%u] data sync bit #%5d\n", m_unit, src));
+ LOG_DRIVE(0,"[DHD%u] data sync bit #%5d\n", m_unit, src);
src = squeeze_record(bits, src, s->data, sizeof(s->data));
- LOG_DRIVE((0,"[DHD%u] data CRC bit #%5d\n", m_unit, src));
+ LOG_DRIVE(0,"[DHD%u] data CRC bit #%5d\n", m_unit, src);
src = squeeze_cksum(bits, src, &cksum_data);
-#if DIABLO_DEBUG
- dump_record(s->data, 0, sizeof(s->data), "data", 1);
-#endif
- LOG_DRIVE((0,"[DHD%u] postamble bit #%5d\n", m_unit, src));
+ if (DIABLO_DEBUG)
+ dump_record(s->data, 0, sizeof(s->data), "data", 1);
+ LOG_DRIVE(0,"[DHD%u] postamble bit #%5d\n", m_unit, src);
/* The checksum start value always seems to be 0521 */
cksum_header ^= cksum(s->header, sizeof(s->header), 0521);
@@ -766,19 +765,17 @@ void diablo_hd_device::squeeze_sector()
cksum_data ^= cksum(s->data, sizeof(s->data), 0521);
if (cksum_header || cksum_label || cksum_data) {
-#if DIABLO_DEBUG
- LOG_DRIVE((0,"[DHD%u] cksum check - header:%06o label:%06o data:%06o\n", m_unit, cksum_header, cksum_label, cksum_data));
-#endif
+ LOG_DRIVE(0,"[DHD%u] cksum check - header:%06o label:%06o data:%06o\n", m_unit, cksum_header, cksum_label, cksum_data);
}
auto_free(machine(), m_bits[m_page]);
m_bits[m_page] = nullptr;
if (m_disk) {
if (!hard_disk_write(m_disk, m_page, m_cache[m_page].get())) {
- LOG_DRIVE((0,"[DHD%u] write failed for page #%d\n", m_unit, m_page));
+ LOG_DRIVE(0,"[DHD%u] write failed for page #%d\n", m_unit, m_page);
}
} else {
- LOG_DRIVE((2,"[DHD%u] no disk\n", m_unit));
+ LOG_DRIVE(2,"[DHD%u] no disk\n", m_unit);
}
}
@@ -984,14 +981,14 @@ void diablo_hd_device::select(int unit)
m_s_r_w_0 = 0; // and can take seek/read/write commands
m_addx_acknowledge_0 = 0; // assert address acknowledge (?)
m_log_addx_interlock_0 = 1; // deassert log address interlock (?)
- LOG_DRIVE((1,"[DHD%u] select unit:%d ready\n", m_unit, unit));
+ LOG_DRIVE(1,"[DHD%u] select unit:%d ready\n", m_unit, unit);
read_sector();
} else {
m_ready_0 = 1; // it is not ready (?)
m_s_r_w_0 = 1; // can't take seek/read/write commands (?)
m_addx_acknowledge_0 = 0; // assert address acknowledge (?)
m_log_addx_interlock_0 = 1; // deassert log address interlock (?)
- LOG_DRIVE((1,"[DHD%u] select unit:%d not ready (no image)\n", m_unit, unit));
+ LOG_DRIVE(1,"[DHD%u] select unit:%d not ready (no image)\n", m_unit, unit);
}
}
@@ -1003,7 +1000,7 @@ void diablo_hd_device::set_head(int head)
{
if ((head & DIABLO_HEAD_MASK) != m_head) {
m_head = head & DIABLO_HEAD_MASK;
- LOG_DRIVE((0,"[DHD%u] select head:%d\n", m_unit, m_head));
+ LOG_DRIVE(0,"[DHD%u] select head:%d\n", m_unit, m_head);
}
}
@@ -1019,7 +1016,7 @@ void diablo_hd_device::set_cylinder(int cylinder)
{
if ((cylinder & DIABLO_CYLINDER_MASK) != m_seekto) {
m_seekto = cylinder & DIABLO_CYLINDER_MASK;
- LOG_DRIVE((0,"[DHD%u] seek to cylinder:%d\n", m_unit, m_seekto));
+ LOG_DRIVE(0,"[DHD%u] seek to cylinder:%d\n", m_unit, m_seekto);
}
}
@@ -1036,7 +1033,7 @@ void diablo_hd_device::set_restore(int restore)
{
if ((restore & 1) != m_restore) {
m_restore = restore & 1;
- LOG_DRIVE((0,"[DHD%u] restore:%d\n", m_unit, m_restore));
+ LOG_DRIVE(0,"[DHD%u] restore:%d\n", m_unit, m_restore);
}
}
@@ -1052,7 +1049,7 @@ void diablo_hd_device::set_strobe(int strobe)
{
int seekto = m_restore ? 0 : m_seekto;
if (strobe) {
- LOG_DRIVE((1,"[DHD%u] STROBE end of interlock\n", m_unit));
+ LOG_DRIVE(1,"[DHD%u] STROBE end of interlock\n", m_unit);
// deassert the log address interlock
m_log_addx_interlock_0 = 1;
return;
@@ -1062,7 +1059,7 @@ void diablo_hd_device::set_strobe(int strobe)
m_log_addx_interlock_0 = 0;
if (seekto == m_cylinder) {
- LOG_DRIVE((1,"[DHD%u] STROBE to cylinder %d acknowledge\n", m_unit, seekto));
+ LOG_DRIVE(1,"[DHD%u] STROBE to cylinder %d acknowledge\n", m_unit, seekto);
m_addx_acknowledge_0 = 0; // address acknowledge, if cylinder is reached
m_seek_incomplete_0 = 1; // reset seek incomplete
return;
@@ -1087,7 +1084,7 @@ void diablo_hd_device::set_strobe(int strobe)
}
}
if (complete) {
- LOG_DRIVE((1,"[DHD%u] STROBE to cylinder %d (now %d) - interlock\n", m_unit, seekto, m_cylinder));
+ LOG_DRIVE(1,"[DHD%u] STROBE to cylinder %d (now %d) - interlock\n", m_unit, seekto, m_cylinder);
m_addx_acknowledge_0 = 1; // deassert address acknowledge signal
m_seek_incomplete_0 = 1; // deassert seek incomplete signal
read_sector();
@@ -1095,7 +1092,7 @@ void diablo_hd_device::set_strobe(int strobe)
m_log_addx_interlock_0 = 0; // deassert the log address interlock signal
m_seek_incomplete_0 = 1; // deassert seek incomplete signal
m_addx_acknowledge_0 = 0; // assert address acknowledge signal
- LOG_DRIVE((1,"[DHD%u] STROBE to cylinder %d incomplete\n", m_unit, seekto));
+ LOG_DRIVE(1,"[DHD%u] STROBE to cylinder %d incomplete\n", m_unit, seekto);
}
}
@@ -1146,30 +1143,30 @@ void diablo_hd_device::set_rdgate(int gate)
void diablo_hd_device::wr_data(int index, int wrdata)
{
if (m_wrgate_0) {
- LOG_DRIVE((0,"[DHD%u] index=%d wrgate not asserted\n", m_unit, index));
+ LOG_DRIVE(0,"[DHD%u] index=%d wrgate not asserted\n", m_unit, index);
return; // write gate is not asserted (active 0)
}
if (index < 0 || index >= bits_per_sector()) {
- LOG_DRIVE((0,"[DHD%u] index=%d out of range\n", m_unit, index));
+ LOG_DRIVE(0,"[DHD%u] index=%d out of range\n", m_unit, index);
return; // don't write before or beyond the sector
}
if (-1 == m_page) {
- LOG_DRIVE((0,"[DHD%u] invalid page\n", m_unit));
+ LOG_DRIVE(0,"[DHD%u] invalid page\n", m_unit);
return; // invalid page
}
uint32_t *bits = expand_sector();
if (!bits) {
- LOG_DRIVE((0,"[DHD%u] no bits\n", m_unit));
+ LOG_DRIVE(0,"[DHD%u] no bits\n", m_unit);
return; // invalid unit
}
if (-1 == m_wrfirst)
m_wrfirst = index;
- LOG_DRIVE((9,"[DHD%u] CHS:%03d/%d/%02d index #%d bit:%d\n", m_unit, m_cylinder, m_head, m_sector, index, wrdata));
+ LOG_DRIVE(9,"[DHD%u] CHS:%03d/%d/%02d index #%d bit:%d\n", m_unit, m_cylinder, m_head, m_sector, index, wrdata);
if (index < GUARD_ZONE_BITS) {
/* don't write in the guard zone (?) */
@@ -1193,28 +1190,28 @@ int diablo_hd_device::rd_data(int index)
int bit = 0;
if (m_rdgate_0) {
- LOG_DRIVE((1,"[DHD%u] index=%d rdgate not asserted\n", m_unit, index));
+ LOG_DRIVE(1,"[DHD%u] index=%d rdgate not asserted\n", m_unit, index);
return 0; // read gate is not asserted (active 0)
}
if (index < 0 || index >= bits_per_sector()) {
- LOG_DRIVE((0,"[DHD%u] index=%d out of range\n", m_unit, index));
+ LOG_DRIVE(0,"[DHD%u] index=%d out of range\n", m_unit, index);
return 1; // don't read before or beyond the sector
}
if (0 == m_sector_mark_0) {
- LOG_DRIVE((0,"[DHD%u] read while sector mark is asserted\n", m_unit));
+ LOG_DRIVE(0,"[DHD%u] read while sector mark is asserted\n", m_unit);
return 1; // no data while sector mark is asserted
}
if (-1 == m_page) {
- LOG_DRIVE((0,"[DHD%u] invalid page\n", m_unit));
+ LOG_DRIVE(0,"[DHD%u] invalid page\n", m_unit);
return 1; // invalid unit
}
uint32_t *bits = expand_sector();
if (!bits) {
- LOG_DRIVE((0,"[DHD%u] no bits\n", m_unit));
+ LOG_DRIVE(0,"[DHD%u] no bits\n", m_unit);
return 1; // invalid page
}
@@ -1222,7 +1219,7 @@ int diablo_hd_device::rd_data(int index)
m_rdfirst = index;
RDBIT(bits,index,bit);
- LOG_DRIVE((9,"[DHD%u] CHS:%03d/%d/%02d index #%d bit:%d\n", m_unit, m_cylinder, m_head, m_sector, index, bit));
+ LOG_DRIVE(9,"[DHD%u] CHS:%03d/%d/%02d index #%d bit:%d\n", m_unit, m_cylinder, m_head, m_sector, index, bit);
m_rdlast = index;
return bit;
}
@@ -1241,23 +1238,23 @@ int diablo_hd_device::rd_clock(int index)
int clk = 0;
if (index < 0 || index >= bits_per_sector()) {
- LOG_DRIVE((0,"[DHD%u] index out of range (%d)\n", m_unit, index));
+ LOG_DRIVE(0,"[DHD%u] index out of range (%d)\n", m_unit, index);
return 1; // don't read before or beyond the sector
}
if (0 == m_sector_mark_0) {
- LOG_DRIVE((0,"[DHD%u] read while sector mark is asserted\n", m_unit));
+ LOG_DRIVE(0,"[DHD%u] read while sector mark is asserted\n", m_unit);
return 1; // no clock while sector mark is low (?)
}
if (-1 == m_page) {
- LOG_DRIVE((0,"[DHD%u] invalid page\n", m_unit));
+ LOG_DRIVE(0,"[DHD%u] invalid page\n", m_unit);
return 1; // invalid page
}
uint32_t *bits = expand_sector();
if (!bits) {
- LOG_DRIVE((0,"[DHD%u] no bits\n", m_unit));
+ LOG_DRIVE(0,"[DHD%u] no bits\n", m_unit);
return 1; // invalid unit
}
@@ -1272,7 +1269,7 @@ int diablo_hd_device::rd_clock(int index)
} else {
clk = 0;
}
- LOG_DRIVE((9,"[DHD%u] CHS:%03d/%d/%02d index #%d clk:%d\n", m_unit, m_cylinder, m_head, m_sector, index, clk));
+ LOG_DRIVE(9,"[DHD%u] CHS:%03d/%d/%02d index #%d clk:%d\n", m_unit, m_cylinder, m_head, m_sector, index, clk);
m_rdlast = index;
return clk ^ 1;
}
@@ -1283,7 +1280,7 @@ int diablo_hd_device::rd_clock(int index)
*/
void diablo_hd_device::sector_mark_1()
{
- LOG_DRIVE((9,"[DHD%u] CHS:%03d/%d/%02d sector_mark_0=1\n", m_unit, m_cylinder, m_head, m_sector));
+ LOG_DRIVE(9,"[DHD%u] CHS:%03d/%d/%02d sector_mark_0=1\n", m_unit, m_cylinder, m_head, m_sector);
m_sector_mark_0 = 1; // deassert sector mark (set to 1)
}
@@ -1297,7 +1294,7 @@ void diablo_hd_device::sector_mark_1()
*/
void diablo_hd_device::sector_mark_0()
{
- LOG_DRIVE((9,"[DHD%u] CHS:%03d/%d/%02d sector_mark_0=0\n", m_unit, m_cylinder, m_head, m_sector));
+ LOG_DRIVE(9,"[DHD%u] CHS:%03d/%d/%02d sector_mark_0=0\n", m_unit, m_cylinder, m_head, m_sector);
// HACK: deassert wrgate
// m_wrgate_0 = 1;
@@ -1362,13 +1359,13 @@ void diablo_hd_device::device_reset()
m_cylinders = 2 * DIABLO_CYLINDERS;
m_pages = 2 * DIABLO_PAGES;
}
- LOG_DRIVE((0,"[DHD%u] m_handle : %p\n", m_unit, m_handle));
- LOG_DRIVE((0,"[DHD%u] m_disk : %p\n", m_unit, m_disk));
- LOG_DRIVE((0,"[DHD%u] rotation time : %.0fns\n", m_unit, m_rotation_time.as_double() * ATTOSECONDS_PER_NANOSECOND));
- LOG_DRIVE((0,"[DHD%u] sector time : %.0fns\n", m_unit, m_sector_time.as_double() * ATTOSECONDS_PER_NANOSECOND));
- LOG_DRIVE((0,"[DHD%u] sector mark 0 time : %.0fns\n", m_unit, m_sector_mark_0_time.as_double() * ATTOSECONDS_PER_NANOSECOND));
- LOG_DRIVE((0,"[DHD%u] sector mark 1 time : %.0fns\n", m_unit, m_sector_mark_1_time.as_double() * ATTOSECONDS_PER_NANOSECOND));
- LOG_DRIVE((0,"[DHD%u] bit time : %.0fns\n", m_unit, m_bit_time.as_double() * ATTOSECONDS_PER_NANOSECOND));
+ LOG_DRIVE(0,"[DHD%u] m_handle : %p\n", m_unit, m_handle);
+ LOG_DRIVE(0,"[DHD%u] m_disk : %p\n", m_unit, m_disk);
+ LOG_DRIVE(0,"[DHD%u] rotation time : %.0fns\n", m_unit, m_rotation_time.as_double() * ATTOSECONDS_PER_NANOSECOND);
+ LOG_DRIVE(0,"[DHD%u] sector time : %.0fns\n", m_unit, m_sector_time.as_double() * ATTOSECONDS_PER_NANOSECOND);
+ LOG_DRIVE(0,"[DHD%u] sector mark 0 time : %.0fns\n", m_unit, m_sector_mark_0_time.as_double() * ATTOSECONDS_PER_NANOSECOND);
+ LOG_DRIVE(0,"[DHD%u] sector mark 1 time : %.0fns\n", m_unit, m_sector_mark_1_time.as_double() * ATTOSECONDS_PER_NANOSECOND);
+ LOG_DRIVE(0,"[DHD%u] bit time : %.0fns\n", m_unit, m_bit_time.as_double() * ATTOSECONDS_PER_NANOSECOND);
m_s_r_w_0 = 1; // deassert seek/read/write ready
m_ready_0 = 1; // deassert drive ready
@@ -1418,7 +1415,7 @@ void diablo_hd_device::device_reset()
*/
void diablo_hd_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
- LOG_DRIVE((9,"[DHD%u] TIMER id=%d param=%d ptr=%p @%.0fns\n", m_unit, id, param, ptr, timer.elapsed().as_double() * ATTOSECONDS_PER_NANOSECOND));
+ LOG_DRIVE(9,"[DHD%u] TIMER id=%d param=%d ptr=%p @%.0fns\n", m_unit, id, param, ptr, timer.elapsed().as_double() * ATTOSECONDS_PER_NANOSECOND);
if (!m_disk)
return;
@@ -1454,4 +1451,4 @@ machine_config_constructor diablo_hd_device::device_mconfig_additions() const
return MACHINE_CONFIG_NAME( diablo_drive );
}
-const device_type DIABLO_HD = device_creator<diablo_hd_device>;
+DEFINE_DEVICE_TYPE(DIABLO_HD, diablo_hd_device, "diablo_hd", "Diablo Disk")
diff --git a/src/devices/machine/diablo_hd.h b/src/devices/machine/diablo_hd.h
index 4f2fc5da1b5..f39063b3426 100644
--- a/src/devices/machine/diablo_hd.h
+++ b/src/devices/machine/diablo_hd.h
@@ -4,14 +4,12 @@
* DIABLO31 and DIABLO44 hard drive support
**********************************************************/
-#if !defined(_DIABLO_HD_DEVICE_)
-#define _DIABLO_HD_DEVICE_
+#ifndef MAME_MACHINE_DIABLO_HD_H
+#define MAME_MACHINE_DIABLO_HD_H
-#include "imagedev/diablo.h"
+#pragma once
-#ifndef DIABLO_DEBUG
-#define DIABLO_DEBUG 1 //!< set to 1 to enable debug log output
-#endif
+#include "imagedev/diablo.h"
#define DIABLO_HD_0 "diablo0"
#define DIABLO_HD_1 "diablo1"
@@ -73,14 +71,9 @@ protected:
virtual machine_config_constructor device_mconfig_additions() const override;
private:
-#if DIABLO_DEBUG
- int m_log_level;
template <typename Format, typename... Params> void logprintf(int level, Format &&fmt, Params &&... args);
-# define LOG_DRIVE(x) logprintf x
-#else
-# define LOG_DRIVE(x)
-#endif
+ int m_log_level;
bool m_diablo31; //!< true, if this is a DIABLO31 drive
int m_unit; //!< drive unit number (0 or 1)
char m_description[32]; //!< description of the drive(s)
@@ -141,13 +134,11 @@ private:
//! expand a sector into an array of clock and data bits
uint32_t* expand_sector();
-#if DIABLO_DEBUG
//! dump a number of words as ASCII characters
void dump_ascii(uint8_t *src, size_t size);
//! dump a record's contents
size_t dump_record(uint8_t *src, size_t addr, size_t size, const char *name, int cr);
-#endif
//! find a sync bit in an array of clock and data bits
size_t squeeze_sync(uint32_t *bits, size_t src, size_t size);
diff --git a/src/devices/machine/dm9334.cpp b/src/devices/machine/dm9334.cpp
index 5a673f7cf24..b4693ad7545 100644
--- a/src/devices/machine/dm9334.cpp
+++ b/src/devices/machine/dm9334.cpp
@@ -9,10 +9,10 @@
#include "emu.h"
#include "dm9334.h"
-const device_type DM9334 = device_creator<dm9334_device>;
+DEFINE_DEVICE_TYPE(DM9334, dm9334_device, "dm9934", "NS [DM]9934 8-bit Addressable Latch")
dm9334_device::dm9334_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, DM9334, "National Semiconductor 9334/DM9334 8-Bit Addressable Latch", tag, owner, clock, "dm9334", __FILE__)
+ : device_t(mconfig, DM9334, tag, owner, clock)
, m_out_func(*this)
, m_q0_func(*this)
, m_q1_func(*this)
diff --git a/src/devices/machine/dm9334.h b/src/devices/machine/dm9334.h
index 708aa89c782..cc71862e686 100644
--- a/src/devices/machine/dm9334.h
+++ b/src/devices/machine/dm9334.h
@@ -65,10 +65,10 @@
**********************************************************************/
-#pragma once
+#ifndef MAME_MACHINE_DM9334_H
+#define MAME_MACHINE_DM9334_H
-#ifndef DM9334_H
-#define DM9334_H
+#pragma once
#define MCFG_DM9334_OUTPUT_CB(_devcb) \
@@ -108,15 +108,15 @@ public:
dm9334_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// static configuration helpers
- template<class _Object> static devcb_base &set_out_cb(device_t &device, _Object object) { return downcast<dm9334_device &>(device).m_out_func.set_callback(object); }
- template<class _Object> static devcb_base &set_q0_cb(device_t &device, _Object object) { return downcast<dm9334_device &>(device).m_q0_func.set_callback(object); }
- template<class _Object> static devcb_base &set_q1_cb(device_t &device, _Object object) { return downcast<dm9334_device &>(device).m_q1_func.set_callback(object); }
- template<class _Object> static devcb_base &set_q2_cb(device_t &device, _Object object) { return downcast<dm9334_device &>(device).m_q2_func.set_callback(object); }
- template<class _Object> static devcb_base &set_q3_cb(device_t &device, _Object object) { return downcast<dm9334_device &>(device).m_q3_func.set_callback(object); }
- template<class _Object> static devcb_base &set_q4_cb(device_t &device, _Object object) { return downcast<dm9334_device &>(device).m_q4_func.set_callback(object); }
- template<class _Object> static devcb_base &set_q5_cb(device_t &device, _Object object) { return downcast<dm9334_device &>(device).m_q5_func.set_callback(object); }
- template<class _Object> static devcb_base &set_q6_cb(device_t &device, _Object object) { return downcast<dm9334_device &>(device).m_q6_func.set_callback(object); }
- template<class _Object> static devcb_base &set_q7_cb(device_t &device, _Object object) { return downcast<dm9334_device &>(device).m_q7_func.set_callback(object); }
+ template <class Object> static devcb_base &set_out_cb(device_t &device, Object &&cb) { return downcast<dm9334_device &>(device).m_out_func.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_q0_cb(device_t &device, Object &&cb) { return downcast<dm9334_device &>(device).m_q0_func.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_q1_cb(device_t &device, Object &&cb) { return downcast<dm9334_device &>(device).m_q1_func.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_q2_cb(device_t &device, Object &&cb) { return downcast<dm9334_device &>(device).m_q2_func.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_q3_cb(device_t &device, Object &&cb) { return downcast<dm9334_device &>(device).m_q3_func.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_q4_cb(device_t &device, Object &&cb) { return downcast<dm9334_device &>(device).m_q4_func.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_q5_cb(device_t &device, Object &&cb) { return downcast<dm9334_device &>(device).m_q5_func.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_q6_cb(device_t &device, Object &&cb) { return downcast<dm9334_device &>(device).m_q6_func.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_q7_cb(device_t &device, Object &&cb) { return downcast<dm9334_device &>(device).m_q7_func.set_callback(std::forward<Object>(cb)); }
DECLARE_WRITE_LINE_MEMBER( e_w );
DECLARE_WRITE_LINE_MEMBER( c_w );
@@ -177,7 +177,6 @@ private:
};
// device type definition
-extern const device_type DM9334;
-
+DECLARE_DEVICE_TYPE(DM9334, dm9334_device)
-#endif /* DM9334_H */
+#endif // MAME_MACHINE_DM9334_H
diff --git a/src/devices/machine/dmac.cpp b/src/devices/machine/dmac.cpp
index cd0911f9995..88762d95237 100644
--- a/src/devices/machine/dmac.cpp
+++ b/src/devices/machine/dmac.cpp
@@ -15,19 +15,15 @@ BOARDS:
#include "emu.h"
#include "dmac.h"
-
-//**************************************************************************
-// CONSTANTS / MACROS
-//**************************************************************************
-
#define VERBOSE 1
+#include "logmacro.h"
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
-const device_type DMAC = device_creator<dmac_device>;
+DEFINE_DEVICE_TYPE(AMIGA_DMAC, amiga_dmac_device, "amiga_dmac", "Amiga DMAC DMA Controller")
//**************************************************************************
@@ -35,11 +31,11 @@ const device_type DMAC = device_creator<dmac_device>;
//**************************************************************************
//-------------------------------------------------
-// dmac_device - constructor
+// amiga_dmac_device - constructor
//-------------------------------------------------
-dmac_device::dmac_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, DMAC, "DMAC DMA Controller", tag, owner, clock, "dmac", __FILE__),
+amiga_dmac_device::amiga_dmac_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ device_t(mconfig, AMIGA_DMAC, tag, owner, clock),
amiga_autoconfig(),
m_cfgout_handler(*this),
m_int_handler(*this),
@@ -66,7 +62,7 @@ dmac_device::dmac_device(const machine_config &mconfig, const char *tag, device_
// device_start - device-specific startup
//-------------------------------------------------
-void dmac_device::device_start()
+void amiga_dmac_device::device_start()
{
// resolve callbacks
m_cfgout_handler.resolve_safe();
@@ -82,21 +78,19 @@ void dmac_device::device_start()
// device_reset - device-specific reset
//-------------------------------------------------
-void dmac_device::device_reset()
+void amiga_dmac_device::device_reset()
{
// fifo empty
m_istr |= ISTR_FE_FLG;
}
-void dmac_device::autoconfig_base_address(offs_t address)
+void amiga_dmac_device::autoconfig_base_address(offs_t address)
{
- if (VERBOSE)
- logerror("%s('%s'): autoconfig_base_address received: 0x%06x\n", shortname(), basetag(), address);
+ LOG("%s('%s'): autoconfig_base_address received: 0x%06x\n", shortname(), basetag(), address);
if (!m_configured && m_ram_size > 0)
{
- if (VERBOSE)
- logerror("-> installing ram (%d bytes)\n", m_ram_size);
+ LOG("-> installing ram (%d bytes)\n", m_ram_size);
// install access to the ram space
if (address)
@@ -115,13 +109,12 @@ void dmac_device::autoconfig_base_address(offs_t address)
}
else
{
- if (VERBOSE)
- logerror("-> installing dmac\n");
+ LOG("-> installing dmac\n");
// internal dmac registers
m_space->install_readwrite_handler(address, address + 0xff,
- read16_delegate(FUNC(dmac_device::register_read), this),
- write16_delegate(FUNC(dmac_device::register_write), this), 0xffff);
+ read16_delegate(FUNC(amiga_dmac_device::register_read), this),
+ write16_delegate(FUNC(amiga_dmac_device::register_write), this), 0xffff);
// install access to the rom space
if (m_rom)
@@ -138,7 +131,7 @@ void dmac_device::autoconfig_base_address(offs_t address)
}
}
-void dmac_device::check_interrupts()
+void amiga_dmac_device::check_interrupts()
{
// interrupts enabled?
if (m_cntr & CNTR_INTEN)
@@ -156,14 +149,14 @@ void dmac_device::check_interrupts()
m_int_handler((m_istr & ISTR_INT_P) ? 1 : 0);
}
-void dmac_device::stop_dma()
+void amiga_dmac_device::stop_dma()
{
m_dma_active = false;
m_istr &= ~ISTR_E_INT;
check_interrupts();
}
-void dmac_device::start_dma()
+void amiga_dmac_device::start_dma()
{
m_dma_active = true;
}
@@ -173,7 +166,7 @@ void dmac_device::start_dma()
// IMPLEMENTATION
//**************************************************************************
-READ16_MEMBER( dmac_device::register_read )
+READ16_MEMBER( amiga_dmac_device::register_read )
{
uint16_t data = 0xffff;
@@ -190,16 +183,14 @@ READ16_MEMBER( dmac_device::register_read )
m_istr &= ~0x0f;
check_interrupts();
- if (VERBOSE)
- logerror("%s('%s'): read istr %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask);
+ LOG("%s('%s'): read istr %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask);
break;
case 0x21:
data = m_cntr;
- if (VERBOSE)
- logerror("%s('%s'): read cntr %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask);
+ LOG("%s('%s'): read cntr %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask);
break;
@@ -207,8 +198,7 @@ READ16_MEMBER( dmac_device::register_read )
case 0x49:
data = m_scsi_read_handler(offset);
- if (VERBOSE)
- logerror("%s('%s'): read scsi register @ %02x %04x [mask = %04x]\n", shortname(), basetag(), offset, data, mem_mask);
+ LOG("%s('%s'): read scsi register @ %02x %04x [mask = %04x]\n", shortname(), basetag(), offset, data, mem_mask);
break;
@@ -216,28 +206,24 @@ READ16_MEMBER( dmac_device::register_read )
case 0x51:
case 0x52:
case 0x53:
- if (VERBOSE)
- logerror("%s('%s'): read xt register @ %02x %04x [mask = %04x]\n", shortname(), basetag(), offset, data, mem_mask);
+ LOG("%s('%s'): read xt register @ %02x %04x [mask = %04x]\n", shortname(), basetag(), offset, data, mem_mask);
break;
case 0x70:
- if (VERBOSE)
- logerror("%s('%s'): read dma start strobe %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask);
+ LOG("%s('%s'): read dma start strobe %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask);
start_dma();
break;
case 0x71:
- if (VERBOSE)
- logerror("%s('%s'): read dma stop strobe %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask);
+ LOG("%s('%s'): read dma stop strobe %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask);
stop_dma();
break;
case 0x72:
- if (VERBOSE)
- logerror("%s('%s'): read clear irq strobe %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask);
+ LOG("%s('%s'): read clear irq strobe %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask);
// clear all interrupts
m_istr &= ~ISTR_INT_MASK;
@@ -245,73 +231,64 @@ READ16_MEMBER( dmac_device::register_read )
break;
case 0x74:
- if (VERBOSE)
- logerror("%s('%s'): read flush fifo strobe %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask);
+ LOG("%s('%s'): read flush fifo strobe %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask);
m_istr |= ISTR_FE_FLG;
break;
default:
- if (VERBOSE)
- logerror("%s('%s'): register_read %04x @ %02x [mask = %04x]\n", shortname(), basetag(), data, offset, mem_mask);
+ LOG("%s('%s'): register_read %04x @ %02x [mask = %04x]\n", shortname(), basetag(), data, offset, mem_mask);
}
return data;
}
-WRITE16_MEMBER( dmac_device::register_write )
+WRITE16_MEMBER( amiga_dmac_device::register_write )
{
switch (offset)
{
case 0x21:
- if (VERBOSE)
- logerror("%s('%s'): write cntr %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask);
+ LOG("%s('%s'): write cntr %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask);
m_cntr = data;
check_interrupts();
break;
case 0x40:
- if (VERBOSE)
- logerror("%s('%s'): write wtc hi %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask);
+ LOG("%s('%s'): write wtc hi %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask);
m_wtc &= 0x0000ffff;
m_wtc |= ((uint32_t) data) << 16;
break;
case 0x41:
- if (VERBOSE)
- logerror("%s('%s'): write wtc lo %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask);
+ LOG("%s('%s'): write wtc lo %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask);
m_wtc &= 0xffff0000;
m_wtc |= data;
break;
case 0x42:
- if (VERBOSE)
- logerror("%s('%s'): write acr hi %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask);
+ LOG("%s('%s'): write acr hi %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask);
m_acr &= 0x0000ffff;
m_acr |= ((uint32_t) data) << 16;
break;
case 0x43:
- if (VERBOSE)
- logerror("%s('%s'): write acr lo %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask);
+ LOG("%s('%s'): write acr lo %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask);
m_acr &= 0xffff0000;
m_acr |= data;
break;
case 0x47:
- if (VERBOSE)
- logerror("%s('%s'): write dawr %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask);
+ LOG("%s('%s'): write dawr %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask);
break;
case 0x48:
case 0x49:
- if (VERBOSE)
- logerror("%s('%s'): write scsi register @ %02x %04x [mask = %04x]\n", shortname(), basetag(), offset, data, mem_mask);
+ LOG("%s('%s'): write scsi register @ %02x %04x [mask = %04x]\n", shortname(), basetag(), offset, data, mem_mask);
m_scsi_write_handler(offset, data, 0xff);