summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatarGravatar Olivier Galibert <galibert@pobox.com>2015-04-12 22:53:48 +0200
committerGravatarGravatar Olivier Galibert <galibert@pobox.com>2015-04-14 19:58:17 +0200
commit278cf84e5503d1829e837e21dc8c238bc8cab577 (patch) (github)
tree5d1f529f01fdfe3615879d3482bc9cf8294ec5d7
parent75e8861950d520e83740b7b5747735f0286df145 (diff)
downloadmame-278cf84e5503d1829e837e21dc8c238bc8cab577.tar.bz2
mame-278cf84e5503d1829e837e21dc8c238bc8cab577.zip
Replace dynamic_array with std::vector [O. Galibert]
-rw-r--r--src/emu/bus/a7800/a78_slot.c2
-rw-r--r--src/emu/bus/a7800/a78_slot.h8
-rw-r--r--src/emu/bus/a800/a800_slot.c12
-rw-r--r--src/emu/bus/a800/a800_slot.h8
-rw-r--r--src/emu/bus/amiga/zorro/a2052.c2
-rw-r--r--src/emu/bus/amiga/zorro/a2052.h2
-rw-r--r--src/emu/bus/amiga/zorro/a590.c2
-rw-r--r--src/emu/bus/apf/slot.h4
-rw-r--r--src/emu/bus/astrocde/ram.c4
-rw-r--r--src/emu/bus/chanf/rom.c4
-rw-r--r--src/emu/bus/chanf/slot.h4
-rw-r--r--src/emu/bus/cpc/symbfac2.c10
-rw-r--r--src/emu/bus/gameboy/gb_slot.c6
-rw-r--r--src/emu/bus/gameboy/gb_slot.h4
-rw-r--r--src/emu/bus/gameboy/mbc.c44
-rw-r--r--src/emu/bus/gameboy/rom.c4
-rw-r--r--src/emu/bus/gba/gba_slot.c4
-rw-r--r--src/emu/bus/gba/gba_slot.h6
-rw-r--r--src/emu/bus/gba/rom.c4
-rw-r--r--src/emu/bus/generic/ram.c8
-rw-r--r--src/emu/bus/generic/rom.c4
-rw-r--r--src/emu/bus/generic/slot.h4
-rw-r--r--src/emu/bus/intv/ecs.c2
-rw-r--r--src/emu/bus/intv/ecs.h4
-rw-r--r--src/emu/bus/intv/rom.h8
-rw-r--r--src/emu/bus/intv/slot.c2
-rw-r--r--src/emu/bus/intv/slot.h4
-rw-r--r--src/emu/bus/isa/3c505.c8
-rw-r--r--src/emu/bus/isa/3c505.h6
-rw-r--r--src/emu/bus/isa/cga.c6
-rw-r--r--src/emu/bus/isa/gus.c3
-rw-r--r--src/emu/bus/isa/hdc.c8
-rw-r--r--src/emu/bus/isa/mda.c4
-rw-r--r--src/emu/bus/isa/omti8621.c24
-rw-r--r--src/emu/bus/isa/s3virge.c3
-rw-r--r--src/emu/bus/isa/sc499.c20
-rw-r--r--src/emu/bus/isa/sc499.h2
-rw-r--r--src/emu/bus/isa/trident.c3
-rw-r--r--src/emu/bus/megadrive/md_slot.c6
-rw-r--r--src/emu/bus/megadrive/md_slot.h6
-rw-r--r--src/emu/bus/msx_cart/cartridge.c12
-rw-r--r--src/emu/bus/msx_cart/cartridge.h16
-rw-r--r--src/emu/bus/msx_cart/konami.c2
-rw-r--r--src/emu/bus/msx_slot/cartridge.c2
-rw-r--r--src/emu/bus/msx_slot/panasonic08.c4
-rw-r--r--src/emu/bus/msx_slot/ram.h2
-rw-r--r--src/emu/bus/msx_slot/ram_mm.c6
-rw-r--r--src/emu/bus/msx_slot/ram_mm.h2
-rw-r--r--src/emu/bus/neogeo/bootleg_prot.c118
-rw-r--r--src/emu/bus/neogeo/cmc_prot.c6
-rw-r--r--src/emu/bus/neogeo/kof2002_prot.c16
-rw-r--r--src/emu/bus/neogeo/kof98_prot.c2
-rw-r--r--src/emu/bus/neogeo/kog_prot.c14
-rw-r--r--src/emu/bus/neogeo/neogeo_helper.c4
-rw-r--r--src/emu/bus/neogeo/neogeo_helper.h2
-rw-r--r--src/emu/bus/neogeo/neogeo_intf.h70
-rw-r--r--src/emu/bus/neogeo/neogeo_slot.h4
-rw-r--r--src/emu/bus/neogeo/pcm2_prot.c6
-rw-r--r--src/emu/bus/neogeo/pvc_prot.c8
-rw-r--r--src/emu/bus/nes/aladdin.c2
-rw-r--r--src/emu/bus/nes/bandai.c8
-rw-r--r--src/emu/bus/nes/bootleg.c4
-rw-r--r--src/emu/bus/nes/konami.c16
-rw-r--r--src/emu/bus/nes/mmc1.c48
-rw-r--r--src/emu/bus/nes/mmc3.c16
-rw-r--r--src/emu/bus/nes/mmc3_clones.c2
-rw-r--r--src/emu/bus/nes/mmc5.c38
-rw-r--r--src/emu/bus/nes/namcot.c16
-rw-r--r--src/emu/bus/nes/nes_ines.inc6
-rw-r--r--src/emu/bus/nes/nes_pcb.inc10
-rw-r--r--src/emu/bus/nes/nes_slot.c40
-rw-r--r--src/emu/bus/nes/nes_slot.h14
-rw-r--r--src/emu/bus/nes/nes_unif.inc12
-rw-r--r--src/emu/bus/nes/pirate.c8
-rw-r--r--src/emu/bus/nes/sunsoft.c32
-rw-r--r--src/emu/bus/nes/sunsoft_dcs.c16
-rw-r--r--src/emu/bus/nubus/nubus.c25
-rw-r--r--src/emu/bus/nubus/nubus_48gc.c6
-rw-r--r--src/emu/bus/nubus/nubus_cb264.c4
-rw-r--r--src/emu/bus/nubus/nubus_m2hires.c4
-rw-r--r--src/emu/bus/nubus/nubus_m2video.c4
-rw-r--r--src/emu/bus/nubus/nubus_radiustpd.c4
-rw-r--r--src/emu/bus/nubus/nubus_spec8.c4
-rw-r--r--src/emu/bus/nubus/nubus_specpdq.c10
-rw-r--r--src/emu/bus/nubus/nubus_vikbw.c6
-rw-r--r--src/emu/bus/nubus/nubus_wsportrait.c4
-rw-r--r--src/emu/bus/nubus/pds30_30hr.c4
-rw-r--r--src/emu/bus/nubus/pds30_cb264.c4
-rw-r--r--src/emu/bus/nubus/pds30_mc30.c4
-rw-r--r--src/emu/bus/nubus/pds30_procolor816.c4
-rw-r--r--src/emu/bus/nubus/pds30_sigmalview.c4
-rw-r--r--src/emu/bus/odyssey2/slot.h4
-rw-r--r--src/emu/bus/pce/pce_rom.c8
-rw-r--r--src/emu/bus/pce/pce_slot.c4
-rw-r--r--src/emu/bus/pce/pce_slot.h4
-rw-r--r--src/emu/bus/saturn/bram.c6
-rw-r--r--src/emu/bus/saturn/bram.h4
-rw-r--r--src/emu/bus/saturn/dram.c8
-rw-r--r--src/emu/bus/saturn/sat_slot.h16
-rw-r--r--src/emu/bus/scsi/s1410.c4
-rw-r--r--src/emu/bus/scv/slot.c4
-rw-r--r--src/emu/bus/scv/slot.h4
-rw-r--r--src/emu/bus/sega8/rom.c26
-rw-r--r--src/emu/bus/sega8/sega8_slot.c4
-rw-r--r--src/emu/bus/sega8/sega8_slot.h4
-rw-r--r--src/emu/bus/snes/event.c8
-rw-r--r--src/emu/bus/snes/event.h4
-rw-r--r--src/emu/bus/snes/sa1.c12
-rw-r--r--src/emu/bus/snes/snes_slot.c22
-rw-r--r--src/emu/bus/snes/snes_slot.h16
-rw-r--r--src/emu/bus/snes/upd.c24
-rw-r--r--src/emu/bus/snes/upd.h12
-rw-r--r--src/emu/bus/ti99_peb/tn_usbsm.h2
-rw-r--r--src/emu/bus/vboy/slot.h6
-rw-r--r--src/emu/bus/vc4000/rom.c8
-rw-r--r--src/emu/bus/vc4000/slot.h4
-rwxr-xr-xsrc/emu/bus/vcs/rom.c60
-rwxr-xr-xsrc/emu/bus/vcs/vcs_slot.c4
-rwxr-xr-xsrc/emu/bus/vcs/vcs_slot.h4
-rw-r--r--src/emu/bus/vectrex/slot.c4
-rw-r--r--src/emu/bus/vidbrain/exp.c8
-rw-r--r--src/emu/bus/vtech/memexp/memory.c10
-rw-r--r--src/emu/bus/vtech/memexp/memory.h8
-rw-r--r--src/emu/bus/wswan/rom.c4
-rw-r--r--src/emu/bus/wswan/slot.c4
-rw-r--r--src/emu/bus/wswan/slot.h4
-rw-r--r--src/emu/clifront.c26
-rw-r--r--src/emu/cpu/drcfe.h2
-rw-r--r--src/emu/cpu/drcuml.c2
-rw-r--r--src/emu/cpu/drcuml.h2
-rw-r--r--src/emu/cpu/esrip/esrip.h2
-rw-r--r--src/emu/cpu/mips/r3000.c6
-rw-r--r--src/emu/cpu/mips/r3000.h4
-rw-r--r--src/emu/cpu/tms0980/tms0980.c21
-rw-r--r--src/emu/cpu/tms0980/tms0980.h6
-rw-r--r--src/emu/cpu/vtlb.c28
-rw-r--r--src/emu/debug/debugcmd.c12
-rw-r--r--src/emu/debug/debugcpu.c19
-rw-r--r--src/emu/debug/debugcpu.h4
-rw-r--r--src/emu/debug/debugvw.h4
-rw-r--r--src/emu/debug/dvbpoints.c16
-rw-r--r--src/emu/debug/dvbpoints.h2
-rw-r--r--src/emu/debug/dvdisasm.c16
-rw-r--r--src/emu/debug/dvdisasm.h4
-rw-r--r--src/emu/debug/dvmemory.c2
-rw-r--r--src/emu/debug/dvstate.c2
-rw-r--r--src/emu/debug/dvtext.c2
-rw-r--r--src/emu/debug/dvwpoints.c14
-rw-r--r--src/emu/debug/dvwpoints.h2
-rw-r--r--src/emu/devfind.h6
-rw-r--r--src/emu/digfx.c8
-rw-r--r--src/emu/diimage.c9
-rw-r--r--src/emu/disound.h2
-rw-r--r--src/emu/drawgfx.c20
-rw-r--r--src/emu/drawgfx.h14
-rw-r--r--src/emu/drivenum.c12
-rw-r--r--src/emu/drivenum.h6
-rw-r--r--src/emu/emualloc.c3
-rw-r--r--src/emu/emualloc.h2
-rw-r--r--src/emu/emupal.c6
-rw-r--r--src/emu/emupal.h15
-rw-r--r--src/emu/fileio.c32
-rw-r--r--src/emu/imagedev/floppy.c44
-rw-r--r--src/emu/imagedev/floppy.h5
-rw-r--r--src/emu/ioport.c20
-rw-r--r--src/emu/ioport.h8
-rw-r--r--src/emu/machine/7200fifo.h2
-rw-r--r--src/emu/machine/at28c16.c4
-rw-r--r--src/emu/machine/at45dbxx.c18
-rw-r--r--src/emu/machine/at45dbxx.h2
-rw-r--r--src/emu/machine/atapihle.c6
-rw-r--r--src/emu/machine/dp8390.c2
-rw-r--r--src/emu/machine/eeprom.c4
-rw-r--r--src/emu/machine/i2cmem.c4
-rw-r--r--src/emu/machine/i82875p.h2
-rw-r--r--src/emu/machine/idehd.c10
-rw-r--r--src/emu/machine/intelfsh.c4
-rw-r--r--src/emu/machine/laserdsc.c10
-rw-r--r--src/emu/machine/laserdsc.h2
-rw-r--r--src/emu/machine/mc146818.c6
-rw-r--r--src/emu/machine/nscsi_s1410.c4
-rw-r--r--src/emu/machine/pci.c14
-rw-r--r--src/emu/machine/pci.h4
-rw-r--r--src/emu/machine/pla.h2
-rw-r--r--src/emu/machine/ram.c3
-rw-r--r--src/emu/machine/ram.h2
-rw-r--r--src/emu/machine/s2636.c3
-rw-r--r--src/emu/machine/serflash.c4
-rw-r--r--src/emu/machine/smc92x4.c16
-rw-r--r--src/emu/machine/stvcd.c8
-rw-r--r--src/emu/machine/timekpr.c44
-rw-r--r--src/emu/machine/vrc4373.h4
-rw-r--r--src/emu/memarray.h4
-rw-r--r--src/emu/memory.c37
-rw-r--r--src/emu/memory.h6
-rw-r--r--src/emu/render.c2
-rw-r--r--src/emu/render.h2
-rw-r--r--src/emu/rendfont.c64
-rw-r--r--src/emu/rendfont.h6
-rw-r--r--src/emu/rendlay.h2
-rw-r--r--src/emu/romload.c2
-rw-r--r--src/emu/save.h6
-rw-r--r--src/emu/softlist.c8
-rw-r--r--src/emu/softlist.h4
-rw-r--r--src/emu/sound.c72
-rw-r--r--src/emu/sound.h22
-rw-r--r--src/emu/sound/ay8910.c2
-rw-r--r--src/emu/sound/discrete.c6
-rw-r--r--src/emu/sound/discrete.h26
-rw-r--r--src/emu/sound/samples.c22
-rw-r--r--src/emu/sound/samples.h6
-rw-r--r--src/emu/sound/spu.c5
-rw-r--r--src/emu/sound/wavwrite.c24
-rw-r--r--src/emu/sprite.h2
-rw-r--r--src/emu/tilemap.c14
-rw-r--r--src/emu/tilemap.h14
-rw-r--r--src/emu/ui/selgame.h2
-rw-r--r--src/emu/video/bufsprite.h8
-rw-r--r--src/emu/video/pc_vga.c6
-rw-r--r--src/emu/video/resnet.c6
-rw-r--r--src/emu/video/resnet.h2
-rw-r--r--src/lib/formats/ap2_dsk.c39
-rw-r--r--src/lib/formats/apridisk.c6
-rw-r--r--src/lib/formats/cassimg.c32
-rw-r--r--src/lib/formats/cassimg.h4
-rw-r--r--src/lib/formats/ccvf_dsk.c12
-rw-r--r--src/lib/formats/coco_dsk.c4
-rw-r--r--src/lib/formats/cqm_dsk.c2
-rw-r--r--src/lib/formats/csw_cas.c16
-rw-r--r--src/lib/formats/d64_dsk.c7
-rw-r--r--src/lib/formats/dfi_dsk.c8
-rw-r--r--src/lib/formats/dmk_dsk.c29
-rw-r--r--src/lib/formats/flopimg.c433
-rw-r--r--src/lib/formats/flopimg.h74
-rw-r--r--src/lib/formats/g64_dsk.c20
-rw-r--r--src/lib/formats/hxcmfm_dsk.c4
-rw-r--r--src/lib/formats/imd_dsk.c12
-rw-r--r--src/lib/formats/ipf_dsk.c111
-rw-r--r--src/lib/formats/ipf_dsk.h38
-rw-r--r--src/lib/formats/kc_cas.c8
-rw-r--r--src/lib/formats/mfi_dsk.c17
-rw-r--r--src/lib/formats/oric_dsk.c23
-rw-r--r--src/lib/formats/pasti_dsk.c152
-rw-r--r--src/lib/formats/pasti_dsk.h10
-rw-r--r--src/lib/formats/td0_dsk.c4
-rw-r--r--src/lib/formats/ti99_dsk.c66
-rw-r--r--src/lib/formats/upd765_dsk.c28
-rw-r--r--src/lib/formats/upd765_dsk.h2
-rw-r--r--src/lib/formats/victor9k_dsk.c6
-rw-r--r--src/lib/formats/wd177x_dsk.c28
-rw-r--r--src/lib/formats/wd177x_dsk.h2
-rw-r--r--src/lib/formats/z80ne_dsk.c23
-rw-r--r--src/lib/util/avhuff.c6
-rw-r--r--src/lib/util/avhuff.h2
-rw-r--r--src/lib/util/chd.c93
-rw-r--r--src/lib/util/chd.h4
-rw-r--r--src/lib/util/chdcodec.c8
-rw-r--r--src/lib/util/corefile.c4
-rw-r--r--src/lib/util/coretmpl.h84
-rw-r--r--src/lib/util/huffman.c14
-rw-r--r--src/lib/util/palette.c5
-rw-r--r--src/lib/util/palette.h20
-rw-r--r--src/mame/drivers/4enlinea.c2
-rw-r--r--src/mame/drivers/8080bw.c4
-rw-r--r--src/mame/drivers/alg.c6
-rw-r--r--src/mame/drivers/arkanoid.c2
-rw-r--r--src/mame/drivers/astrafr.c4
-rw-r--r--src/mame/drivers/backfire.c2
-rw-r--r--src/mame/drivers/bfcobra.c2
-rw-r--r--src/mame/drivers/bfm_sc45_helper.c46
-rw-r--r--src/mame/drivers/blktiger.c2
-rw-r--r--src/mame/drivers/cave.c6
-rw-r--r--src/mame/drivers/coinmstr.c2
-rw-r--r--src/mame/drivers/cps2.c4
-rw-r--r--src/mame/drivers/crimfght.c2
-rw-r--r--src/mame/drivers/darkmist.c8
-rw-r--r--src/mame/drivers/dassault.c8
-rw-r--r--src/mame/drivers/ddayjlc.c2
-rw-r--r--src/mame/drivers/deco156.c2
-rw-r--r--src/mame/drivers/deco32.c16
-rw-r--r--src/mame/drivers/deco_mlc.c2
-rw-r--r--src/mame/drivers/dynax.c6
-rw-r--r--src/mame/drivers/exerion.c4
-rw-r--r--src/mame/drivers/fcombat.c10
-rw-r--r--src/mame/drivers/flyball.c2
-rw-r--r--src/mame/drivers/forte2.c2
-rw-r--r--src/mame/drivers/funworld.c14
-rw-r--r--src/mame/drivers/gaiden.c8
-rw-r--r--src/mame/drivers/galaxian.c4
-rw-r--r--src/mame/drivers/galaxold.c4
-rw-r--r--src/mame/drivers/gauntlet.c2
-rw-r--r--src/mame/drivers/goldstar.c4
-rw-r--r--src/mame/drivers/halleys.c4
-rw-r--r--src/mame/drivers/hng64.c6
-rw-r--r--src/mame/drivers/igs011.c12
-rw-r--r--src/mame/drivers/igs017.c6
-rw-r--r--src/mame/drivers/igs_m027.c8
-rw-r--r--src/mame/drivers/igspoker.c2
-rw-r--r--src/mame/drivers/jclub2.c2
-rw-r--r--src/mame/drivers/kas89.c2
-rw-r--r--src/mame/drivers/legionna.c2
-rw-r--r--src/mame/drivers/megasys1.c6
-rw-r--r--src/mame/drivers/meyc8088.c4
-rw-r--r--src/mame/drivers/mitchell.c2
-rw-r--r--src/mame/drivers/multfish.c34
-rw-r--r--src/mame/drivers/multigam.c6
-rw-r--r--src/mame/drivers/namcos86.c4
-rw-r--r--src/mame/drivers/ninjakd2.c2
-rw-r--r--src/mame/drivers/nmk16.c2
-rw-r--r--src/mame/drivers/nova2001.c2
-rw-r--r--src/mame/drivers/panicr.c4
-rw-r--r--src/mame/drivers/pengadvb.c2
-rw-r--r--src/mame/drivers/pirates.c10
-rw-r--r--src/mame/drivers/popeye.c4
-rw-r--r--src/mame/drivers/popobear.c2
-rw-r--r--src/mame/drivers/r2dx_v33.c2
-rw-r--r--src/mame/drivers/segag80r.c2
-rw-r--r--src/mame/drivers/segas16b.c12
-rw-r--r--src/mame/drivers/seta.c4
-rw-r--r--src/mame/drivers/sigmab98.c14
-rw-r--r--src/mame/drivers/simpl156.c2
-rw-r--r--src/mame/drivers/snowbros.c6
-rw-r--r--src/mame/drivers/speedbal.c4
-rw-r--r--src/mame/drivers/tcl.c2
-rw-r--r--src/mame/drivers/tmnt.c8
-rw-r--r--src/mame/drivers/toki.c8
-rw-r--r--src/mame/drivers/travrusa.c2
-rw-r--r--src/mame/drivers/tumbleb.c8
-rw-r--r--src/mame/drivers/vendetta.c2
-rw-r--r--src/mame/drivers/wecleman.c8
-rw-r--r--src/mame/drivers/wink.c2
-rw-r--r--src/mame/includes/blockhl.h2
-rw-r--r--src/mame/includes/crimfght.h2
-rw-r--r--src/mame/includes/flstory.h4
-rw-r--r--src/mame/includes/hng64.h2
-rw-r--r--src/mame/includes/ladyfrog.h4
-rw-r--r--src/mame/includes/m92.h2
-rw-r--r--src/mame/includes/mitchell.h4
-rw-r--r--src/mame/includes/namcona1.h2
-rw-r--r--src/mame/includes/neogeo.h2
-rw-r--r--src/mame/includes/nycaptor.h4
-rw-r--r--src/mame/includes/segag80r.h2
-rw-r--r--src/mame/includes/speedspn.h2
-rw-r--r--src/mame/includes/spy.h2
-rw-r--r--src/mame/includes/stv.h2
-rw-r--r--src/mame/includes/vendetta.h2
-rw-r--r--src/mame/machine/atarigen.c4
-rw-r--r--src/mame/machine/bfm_comn.c2
-rw-r--r--src/mame/machine/deco102.c4
-rw-r--r--src/mame/machine/deco156.c6
-rw-r--r--src/mame/machine/decocrpt.c4
-rw-r--r--src/mame/machine/fd1089.c6
-rw-r--r--src/mame/machine/fd1089.h4
-rw-r--r--src/mame/machine/fd1094.c10
-rw-r--r--src/mame/machine/fd1094.h2
-rw-r--r--src/mame/machine/jalcrpt.c6
-rw-r--r--src/mame/machine/kaneko_calc3.c2
-rw-r--r--src/mame/machine/neocrypt.c4
-rw-r--r--src/mame/machine/pgmprot_igs027a_type1.c14
-rw-r--r--src/mame/machine/pgmprot_igs027a_type3.c8
-rw-r--r--src/mame/machine/scramble.c4
-rw-r--r--src/mame/machine/segaic16.c6
-rw-r--r--src/mame/machine/segaic16.h4
-rw-r--r--src/mame/machine/segas32.c2
-rw-r--r--src/mame/video/aeroboto.c2
-rw-r--r--src/mame/video/atarimo.h12
-rw-r--r--src/mame/video/atarirle.h2
-rw-r--r--src/mame/video/atarisy1.c10
-rw-r--r--src/mame/video/bfm_adr2.c4
-rw-r--r--src/mame/video/c116.c12
-rw-r--r--src/mame/video/c116.h6
-rw-r--r--src/mame/video/carjmbre.c4
-rw-r--r--src/mame/video/dkong.c8
-rw-r--r--src/mame/video/gauntlet.c4
-rw-r--r--src/mame/video/hng64_3d.c4
-rw-r--r--src/mame/video/k051316.c3
-rw-r--r--src/mame/video/k051316.h2
-rw-r--r--src/mame/video/k053250.c4
-rw-r--r--src/mame/video/k053250.h2
-rw-r--r--src/mame/video/k054156_k054157_k056832.c3
-rw-r--r--src/mame/video/k054156_k054157_k056832.h2
-rw-r--r--src/mame/video/m62.c26
-rw-r--r--src/mame/video/mario.c4
-rw-r--r--src/mame/video/model1.c16
-rw-r--r--src/mame/video/namcona1.c2
-rw-r--r--src/mame/video/neogeo.c3
-rw-r--r--src/mame/video/neogeo_spr.c2
-rw-r--r--src/mame/video/neogeo_spr.h2
-rw-r--r--src/mame/video/phoenix.c6
-rw-r--r--src/mame/video/popeye.c8
-rw-r--r--src/mame/video/popper.c4
-rw-r--r--src/mame/video/skyfox.c4
-rw-r--r--src/mame/video/speedspn.c5
-rw-r--r--src/mame/video/tagteam.c4
-rw-r--r--src/mame/video/tc0150rod.c3
-rw-r--r--src/mame/video/tc0150rod.h2
-rw-r--r--src/mame/video/tc0480scp.c59
-rw-r--r--src/mame/video/tc0480scp.h2
-rw-r--r--src/mame/video/tceptor.c2
-rw-r--r--src/mame/video/wpc_dmd.c20
-rw-r--r--src/mame/video/wpc_dmd.h2
-rw-r--r--src/mess/drivers/abc80.c2
-rw-r--r--src/mess/drivers/amiga.c4
-rw-r--r--src/mess/drivers/beta.c6
-rw-r--r--src/mess/drivers/binbug.c2
-rw-r--r--src/mess/drivers/casloopy.c4
-rw-r--r--src/mess/drivers/cd2650.c2
-rw-r--r--src/mess/drivers/d6800.c2
-rw-r--r--src/mess/drivers/homelab.c2
-rw-r--r--src/mess/drivers/hp16500.c2
-rw-r--r--src/mess/drivers/instruct.c2
-rw-r--r--src/mess/drivers/lynx.c2
-rw-r--r--src/mess/drivers/megadriv.c10
-rw-r--r--src/mess/drivers/pcd.c2
-rw-r--r--src/mess/drivers/pegasus.c2
-rw-r--r--src/mess/drivers/pipbug.c2
-rw-r--r--src/mess/drivers/psx.c4
-rw-r--r--src/mess/drivers/ravens.c2
-rw-r--r--src/mess/drivers/rex6000.c2
-rw-r--r--src/mess/drivers/supracan.c2
-rw-r--r--src/mess/drivers/ti99_4p.c4
-rw-r--r--src/mess/drivers/timex.c2
-rw-r--r--src/mess/drivers/uzebox.c6
-rw-r--r--src/mess/drivers/vc4000.c2
-rw-r--r--src/mess/drivers/vii.c12
-rw-r--r--src/mess/drivers/x68k.c4
-rw-r--r--src/mess/includes/imds2.h2
-rw-r--r--src/mess/includes/x68k.h8
-rw-r--r--src/mess/machine/amstrad.c14
-rw-r--r--src/mess/machine/cbm_snqk.c2
-rw-r--r--src/mess/machine/cybiko.c2
-rw-r--r--src/mess/machine/kc.c2
-rw-r--r--src/mess/machine/lviv.c6
-rw-r--r--src/mess/machine/megacd.c2
-rw-r--r--src/mess/machine/megacd.h2
-rw-r--r--src/mess/machine/microtan.c10
-rw-r--r--src/mess/machine/msx_matsushita.c6
-rw-r--r--src/mess/machine/primo.c10
-rw-r--r--src/mess/machine/spec_snqk.c32
-rw-r--r--src/mess/machine/svi318.c6
-rw-r--r--src/mess/machine/ti85.c6
-rw-r--r--src/mess/machine/ti99/gromport.c6
-rw-r--r--src/mess/machine/x68k_hdc.c7
-rw-r--r--src/mess/tools/imgtool/iflopimg.c8
-rw-r--r--src/mess/tools/imgtool/imghd.c5
-rw-r--r--src/mess/tools/imgtool/main.c8
-rw-r--r--src/mess/tools/imgtool/modules/os9.c72
-rw-r--r--src/mess/tools/imgtool/modules/psion.c4
-rw-r--r--src/mess/video/advision.c3
-rw-r--r--src/mess/video/wswan_video.c10
-rw-r--r--src/mess/video/x68k.c20
-rw-r--r--src/osd/modules/lib/osdobj_common.c26
-rw-r--r--src/osd/modules/lib/osdobj_common.h4
-rw-r--r--src/osd/windows/winmain.c2
-rw-r--r--src/tools/chdman.c62
-rw-r--r--src/tools/ldresample.c22
-rw-r--r--src/tools/ldverify.c8
457 files changed, 2465 insertions, 2492 deletions
diff --git a/src/emu/bus/a7800/a78_slot.c b/src/emu/bus/a7800/a78_slot.c
index 9dc1a9040bf..2db5871323f 100644
--- a/src/emu/bus/a7800/a78_slot.c
+++ b/src/emu/bus/a7800/a78_slot.c
@@ -539,7 +539,7 @@ void a78_cart_slot_device::get_default_card_software(astring &result)
int type = A78_TYPE0, mapper;
// Load and check the header
- core_fread(m_file, head, 128);
+ core_fread(m_file, &head[0], 128);
// let's try to auto-fix some common errors in the header
mapper = validate_header((head[53] << 8) | head[54], FALSE);
diff --git a/src/emu/bus/a7800/a78_slot.h b/src/emu/bus/a7800/a78_slot.h
index 528c8932c04..5fdecfc0c45 100644
--- a/src/emu/bus/a7800/a78_slot.h
+++ b/src/emu/bus/a7800/a78_slot.h
@@ -57,11 +57,11 @@ public:
void ram_alloc(UINT32 size);
void nvram_alloc(UINT32 size);
UINT8* get_rom_base() { return m_rom; }
- UINT8* get_ram_base() { return m_ram; }
- UINT8* get_nvram_base() { return m_nvram; }
+ UINT8* get_ram_base() { return &m_ram[0]; }
+ UINT8* get_nvram_base() { return &m_nvram[0]; }
UINT32 get_rom_size() { return m_rom_size; }
- UINT32 get_ram_size() { return m_ram.bytes(); }
- UINT32 get_nvram_size() { return m_nvram.bytes(); }
+ UINT32 get_ram_size() { return m_ram.size(); }
+ UINT32 get_nvram_size() { return m_nvram.size(); }
protected:
// internal state
diff --git a/src/emu/bus/a800/a800_slot.c b/src/emu/bus/a800/a800_slot.c
index 566b4475380..650ba7a02d6 100644
--- a/src/emu/bus/a800/a800_slot.c
+++ b/src/emu/bus/a800/a800_slot.c
@@ -420,8 +420,8 @@ void a800_cart_slot_device::get_default_card_software(astring &result)
// check whether there is an header, to identify the cart type
if ((len % 0x1000) == 0x10)
{
- core_fread(m_file, head, 0x10);
- type = identify_cart_type(head);
+ core_fread(m_file, &head[0], 0x10);
+ type = identify_cart_type(&head[0]);
}
else // otherwise try to guess based on size
{
@@ -457,8 +457,8 @@ void a5200_cart_slot_device::get_default_card_software(astring &result)
// check whether there is an header, to identify the cart type
if ((len % 0x1000) == 0x10)
{
- core_fread(m_file, head, 0x10);
- type = identify_cart_type(head);
+ core_fread(m_file, &head[0], 0x10);
+ type = identify_cart_type(&head[0]);
astring info;
if (hashfile_extrainfo(*this, info) && info == "A13MIRRORING")
@@ -490,8 +490,8 @@ void xegs_cart_slot_device::get_default_card_software(astring &result)
// check whether there is an header, to identify the cart type
if ((len % 0x1000) == 0x10)
{
- core_fread(m_file, head, 0x10);
- type = identify_cart_type(head);
+ core_fread(m_file, &head[0], 0x10);
+ type = identify_cart_type(&head[0]);
}
if (type != A800_XEGS)
{
diff --git a/src/emu/bus/a800/a800_slot.h b/src/emu/bus/a800/a800_slot.h
index b9e4f491d73..491daa03e60 100644
--- a/src/emu/bus/a800/a800_slot.h
+++ b/src/emu/bus/a800/a800_slot.h
@@ -60,11 +60,11 @@ public:
void ram_alloc(UINT32 size);
void nvram_alloc(UINT32 size);
UINT8* get_rom_base() { return m_rom; }
- UINT8* get_ram_base() { return m_ram; }
- UINT8* get_nvram_base() { return m_nvram; }
+ UINT8* get_ram_base() { return &m_ram[0]; }
+ UINT8* get_nvram_base() { return &m_nvram[0]; }
UINT32 get_rom_size() { return m_rom_size; }
- UINT32 get_ram_size() { return m_ram.bytes(); }
- UINT32 get_nvram_size() { return m_nvram.bytes(); }
+ UINT32 get_ram_size() { return m_ram.size(); }
+ UINT32 get_nvram_size() { return m_nvram.size(); }
protected:
// internal state
diff --git a/src/emu/bus/amiga/zorro/a2052.c b/src/emu/bus/amiga/zorro/a2052.c
index 7ce9d1653d9..e152e58ebd1 100644
--- a/src/emu/bus/amiga/zorro/a2052.c
+++ b/src/emu/bus/amiga/zorro/a2052.c
@@ -84,7 +84,7 @@ void a2052_device::autoconfig_base_address(offs_t address)
m_slot->m_space->unmap_readwrite(0xe80000, 0xe8007f);
// install access to the rom space
- m_slot->m_space->install_ram(address, address + m_ram.bytes() - 1, m_ram);
+ m_slot->m_space->install_ram(address, address + m_ram.size()*2 - 1, &m_ram[0]);
// we're done
m_slot->cfgout_w(0);
diff --git a/src/emu/bus/amiga/zorro/a2052.h b/src/emu/bus/amiga/zorro/a2052.h
index 18f7fcd43e6..939ed7e3bbc 100644
--- a/src/emu/bus/amiga/zorro/a2052.h
+++ b/src/emu/bus/amiga/zorro/a2052.h
@@ -43,7 +43,7 @@ protected:
private:
required_ioport m_config;
- dynamic_array<UINT16> m_ram;
+ std::vector<UINT16> m_ram;
};
// device type definition
diff --git a/src/emu/bus/amiga/zorro/a590.c b/src/emu/bus/amiga/zorro/a590.c
index 57ed4e6a22c..b929d93f9e7 100644
--- a/src/emu/bus/amiga/zorro/a590.c
+++ b/src/emu/bus/amiga/zorro/a590.c
@@ -279,7 +279,7 @@ void dmac_hdc_device::resize_ram(int config)
break;
}
- m_dmac->set_ram(m_ram);
+ m_dmac->set_ram(&m_ram[0]);
}
void a590_device::device_reset()
diff --git a/src/emu/bus/apf/slot.h b/src/emu/bus/apf/slot.h
index e40894b2cbe..ab0c054cf2b 100644
--- a/src/emu/bus/apf/slot.h
+++ b/src/emu/bus/apf/slot.h
@@ -35,9 +35,9 @@ public:
void rom_alloc(UINT32 size, const char *tag);
void ram_alloc(UINT32 size);
UINT8* get_rom_base() { return m_rom; }
- UINT8* get_ram_base() { return m_ram; }
+ UINT8* get_ram_base() { return &m_ram[0]; }
UINT32 get_rom_size() { return m_rom_size; }
- UINT32 get_ram_size() { return m_ram.count(); }
+ UINT32 get_ram_size() { return m_ram.size(); }
void save_ram() { device().save_item(NAME(m_ram)); }
diff --git a/src/emu/bus/astrocde/ram.c b/src/emu/bus/astrocde/ram.c
index 4aae888cba6..a116be14d77 100644
--- a/src/emu/bus/astrocde/ram.c
+++ b/src/emu/bus/astrocde/ram.c
@@ -153,7 +153,7 @@ ioport_constructor astrocade_rl64ram_device::device_input_ports() const
// Blue RAM expansions have RAM starting at 0x6000, up to the RAM size
READ8_MEMBER(astrocade_blueram_4k_device::read)
{
- if (offset >= 0x1000 && offset < 0x1000 + m_ram.bytes())
+ if (offset >= 0x1000 && offset < 0x1000 + m_ram.size())
return m_ram[offset - 0x1000];
else
return 0;
@@ -161,7 +161,7 @@ READ8_MEMBER(astrocade_blueram_4k_device::read)
WRITE8_MEMBER(astrocade_blueram_4k_device::write)
{
- if (offset >= 0x1000 && offset < 0x1000 + m_ram.bytes() && !m_write_prot->read())
+ if (offset >= 0x1000 && offset < 0x1000 + m_ram.size() && !m_write_prot->read())
m_ram[offset - 0x1000] = data;
}
diff --git a/src/emu/bus/chanf/rom.c b/src/emu/bus/chanf/rom.c
index d2b946269b7..cfd60eaedab 100644
--- a/src/emu/bus/chanf/rom.c
+++ b/src/emu/bus/chanf/rom.c
@@ -200,7 +200,7 @@ void chanf_rom_device::common_write_2102(UINT32 offset, UINT8 data)
// These are shared among Schach & Multigame cart types (not directly used by base chanf_rom_device)
UINT8 chanf_rom_device::common_read_3853(UINT32 offset)
{
- if (offset < m_ram.count())
+ if (offset < m_ram.size())
return m_ram[offset];
else
return 0xff;
@@ -208,7 +208,7 @@ UINT8 chanf_rom_device::common_read_3853(UINT32 offset)
void chanf_rom_device::common_write_3853(UINT32 offset, UINT8 data)
{
- if (offset < m_ram.count())
+ if (offset < m_ram.size())
m_ram[offset] = data;
}
diff --git a/src/emu/bus/chanf/slot.h b/src/emu/bus/chanf/slot.h
index 161eef039f8..123e3a4fafd 100644
--- a/src/emu/bus/chanf/slot.h
+++ b/src/emu/bus/chanf/slot.h
@@ -38,9 +38,9 @@ public:
void rom_alloc(UINT32 size, const char *tag);
void ram_alloc(UINT32 size);
UINT8* get_rom_base() { return m_rom; }
- UINT8* get_ram_base() { return m_ram; }
+ UINT8* get_ram_base() { return &m_ram[0]; }
UINT32 get_rom_size() { return m_rom_size; }
- UINT32 get_ram_size() { return m_ram.count(); }
+ UINT32 get_ram_size() { return m_ram.size(); }
void save_ram() { device().save_item(NAME(m_ram)); }
diff --git a/src/emu/bus/cpc/symbfac2.c b/src/emu/bus/cpc/symbfac2.c
index ccbc700f38d..2a671684500 100644
--- a/src/emu/bus/cpc/symbfac2.c
+++ b/src/emu/bus/cpc/symbfac2.c
@@ -102,7 +102,7 @@ void cpc_symbiface2_device::device_start()
// 32 banks of 16kB (512kB)
m_rom_space.resize(32*16384);
- m_nvram->set_base(m_rom_space,m_rom_space.bytes());
+ m_nvram->set_base(&m_rom_space[0],m_rom_space.size());
save_item(NAME(m_rom_space));
}
@@ -275,10 +275,10 @@ READ8_MEMBER(cpc_symbiface2_device::rom_rewrite_r)
m_4xxx_ptr_w = (UINT8*)machine().root_device().membank("bank11")->base();
m_6xxx_ptr_r = (UINT8*)machine().root_device().membank("bank4")->base();
m_6xxx_ptr_w = (UINT8*)machine().root_device().membank("bank12")->base();
- machine().root_device().membank("bank3")->set_base((UINT8*)m_rom_space+(bank*16384));
- machine().root_device().membank("bank4")->set_base((UINT8*)m_rom_space+(bank*16384+8192));
- machine().root_device().membank("bank11")->set_base((UINT8*)m_rom_space+(bank*16384));
- machine().root_device().membank("bank12")->set_base((UINT8*)m_rom_space+(bank*16384+8192));
+ machine().root_device().membank("bank3")->set_base(&m_rom_space[bank*16384]);
+ machine().root_device().membank("bank4")->set_base(&m_rom_space[bank*16384+8192]);
+ machine().root_device().membank("bank11")->set_base(&m_rom_space[bank*16384]);
+ machine().root_device().membank("bank12")->set_base(&m_rom_space[bank*16384+8192]);
return 0xff;
}
diff --git a/src/emu/bus/gameboy/gb_slot.c b/src/emu/bus/gameboy/gb_slot.c
index 996f91f6c3f..0348efb6b65 100644
--- a/src/emu/bus/gameboy/gb_slot.c
+++ b/src/emu/bus/gameboy/gb_slot.c
@@ -609,15 +609,15 @@ void base_gb_cart_slot_device::get_default_card_software(astring &result)
dynamic_buffer rom(len);
int type;
- core_fread(m_file, rom, len);
+ core_fread(m_file, &rom[0], len);
if ((len % 0x4000) == 512)
offset = 512;
- if (get_mmm01_candidate(rom + offset, len - offset))
+ if (get_mmm01_candidate(&rom[offset], len - offset))
offset += (len - 0x8000);
- type = get_cart_type(rom + offset, len - offset);
+ type = get_cart_type(&rom[offset], len - offset);
slot_string = gb_get_slot(type);
//printf("type: %s\n", slot_string);
diff --git a/src/emu/bus/gameboy/gb_slot.h b/src/emu/bus/gameboy/gb_slot.h
index 921a8707d4b..7e01ce1e374 100644
--- a/src/emu/bus/gameboy/gb_slot.h
+++ b/src/emu/bus/gameboy/gb_slot.h
@@ -62,9 +62,9 @@ public:
void rom_alloc(UINT32 size, const char *tag);
void ram_alloc(UINT32 size);
UINT8* get_rom_base() { return m_rom; }
- UINT8* get_ram_base() { return m_ram; }
+ UINT8* get_ram_base() { return &m_ram[0]; }
UINT32 get_rom_size() { return m_rom_size; }
- UINT32 get_ram_size() { return m_ram.count(); }
+ UINT32 get_ram_size() { return m_ram.size(); }
void rom_map_setup(UINT32 size);
void ram_map_setup(UINT8 banks);
diff --git a/src/emu/bus/gameboy/mbc.c b/src/emu/bus/gameboy/mbc.c
index 7969468fe7c..ff6d6c794ab 100644
--- a/src/emu/bus/gameboy/mbc.c
+++ b/src/emu/bus/gameboy/mbc.c
@@ -291,7 +291,7 @@ READ8_MEMBER(gb_rom_mbc_device::read_rom)
READ8_MEMBER(gb_rom_mbc_device::read_ram)
{
- if (m_ram)
+ if (!m_ram.empty())
return m_ram[ram_bank_map[m_ram_bank] * 0x2000 + offset];
else
return 0xff;
@@ -299,7 +299,7 @@ READ8_MEMBER(gb_rom_mbc_device::read_ram)
WRITE8_MEMBER(gb_rom_mbc_device::write_ram)
{
- if (m_ram)
+ if (!m_ram.empty())
m_ram[ram_bank_map[m_ram_bank] * 0x2000 + offset] = data;
}
@@ -342,7 +342,7 @@ WRITE8_MEMBER(gb_rom_mbc1_device::write_bank)
READ8_MEMBER(gb_rom_mbc1_device::read_ram)
{
- if (m_ram && m_ram_enable)
+ if (!m_ram.empty() && m_ram_enable)
{
int bank = (m_mode == MODE_4M_256k) ? m_ram_bank : 0;
return m_ram[ram_bank_map[bank] * 0x2000 + offset];
@@ -353,7 +353,7 @@ READ8_MEMBER(gb_rom_mbc1_device::read_ram)
WRITE8_MEMBER(gb_rom_mbc1_device::write_ram)
{
- if (m_ram && m_ram_enable)
+ if (!m_ram.empty() && m_ram_enable)
{
int bank = (m_mode == MODE_4M_256k) ? m_ram_bank : 0;
m_ram[ram_bank_map[bank] * 0x2000 + offset] = data;
@@ -392,7 +392,7 @@ WRITE8_MEMBER(gb_rom_mbc2_device::write_bank)
// 1 bank only??
READ8_MEMBER(gb_rom_mbc2_device::read_ram)
{
- if (m_ram && m_ram_enable)
+ if (!m_ram.empty() && m_ram_enable)
return m_ram[ram_bank_map[m_ram_bank] * 0x2000 + (offset & 0x1fff)];
else
return 0xff;
@@ -400,7 +400,7 @@ READ8_MEMBER(gb_rom_mbc2_device::read_ram)
WRITE8_MEMBER(gb_rom_mbc2_device::write_ram)
{
- if (m_ram && m_ram_enable)
+ if (!m_ram.empty() && m_ram_enable)
m_ram[ram_bank_map[m_ram_bank] * 0x2000 + (offset & 0x1fff)] = data;
}
@@ -451,7 +451,7 @@ READ8_MEMBER(gb_rom_mbc3_device::read_ram)
{
if (m_ram_bank < 4 && m_ram_enable)
{ // RAM
- if (m_ram)
+ if (!m_ram.empty())
return m_ram[ram_bank_map[m_ram_bank] * 0x2000 + (offset & 0x1fff)];
}
if (m_ram_bank >= 0x8 && m_ram_bank <= 0xc)
@@ -466,7 +466,7 @@ WRITE8_MEMBER(gb_rom_mbc3_device::write_ram)
{
if (m_ram_bank < 4 && m_ram_enable)
{ // RAM
- if (m_ram)
+ if (!m_ram.empty())
m_ram[ram_bank_map[m_ram_bank] * 0x2000 + (offset & 0x1fff)] = data;
}
if (m_ram_bank >= 0x8 && m_ram_bank <= 0xc)
@@ -515,7 +515,7 @@ WRITE8_MEMBER(gb_rom_mbc5_device::write_bank)
READ8_MEMBER(gb_rom_mbc5_device::read_ram)
{
- if (m_ram && m_ram_enable)
+ if (!m_ram.empty() && m_ram_enable)
return m_ram[ram_bank_map[m_ram_bank] * 0x2000 + (offset & 0x1fff)];
else
return 0xff;
@@ -523,7 +523,7 @@ READ8_MEMBER(gb_rom_mbc5_device::read_ram)
WRITE8_MEMBER(gb_rom_mbc5_device::write_ram)
{
- if (m_ram && m_ram_enable)
+ if (!m_ram.empty() && m_ram_enable)
m_ram[ram_bank_map[m_ram_bank] * 0x2000 + (offset & 0x1fff)] = data;
}
@@ -563,7 +563,7 @@ WRITE8_MEMBER(gb_rom_mbc6_device::write_bank)
READ8_MEMBER(gb_rom_mbc6_device::read_ram)
{
- if (m_ram)
+ if (!m_ram.empty())
return m_ram[ram_bank_map[m_ram_bank] * 0x2000 + (offset & 0x1fff)];
else
return 0xff;
@@ -571,7 +571,7 @@ READ8_MEMBER(gb_rom_mbc6_device::read_ram)
WRITE8_MEMBER(gb_rom_mbc6_device::write_ram)
{
- if (m_ram)
+ if (!m_ram.empty())
m_ram[ram_bank_map[m_ram_bank] * 0x2000 + (offset & 0x1fff)] = data;
}
@@ -620,7 +620,7 @@ WRITE8_MEMBER(gb_rom_mbc7_device::write_bank)
READ8_MEMBER(gb_rom_mbc7_device::read_ram)
{
- if (m_ram)
+ if (!m_ram.empty())
return m_ram[ram_bank_map[m_ram_bank] * 0x2000 + (offset & 0x1fff)];
else
return 0xff;
@@ -628,7 +628,7 @@ READ8_MEMBER(gb_rom_mbc7_device::read_ram)
WRITE8_MEMBER(gb_rom_mbc7_device::write_ram)
{
- if (m_ram)
+ if (!m_ram.empty())
m_ram[ram_bank_map[m_ram_bank] * 0x2000 + (offset & 0x1fff)] = data;
}
@@ -910,7 +910,7 @@ WRITE8_MEMBER(gb_rom_sintax_device::write_bank)
READ8_MEMBER(gb_rom_sintax_device::read_ram)
{
- if (m_ram && m_ram_enable)
+ if (!m_ram.empty() && m_ram_enable)
return m_ram[ram_bank_map[m_ram_bank] * 0x2000 + (offset & 0x1fff)];
else
return 0xff;
@@ -918,7 +918,7 @@ READ8_MEMBER(gb_rom_sintax_device::read_ram)
WRITE8_MEMBER(gb_rom_sintax_device::write_ram)
{
- if (m_ram && m_ram_enable)
+ if (!m_ram.empty() && m_ram_enable)
m_ram[ram_bank_map[m_ram_bank] * 0x2000 + (offset & 0x1fff)] = data;
}
@@ -977,7 +977,7 @@ WRITE8_MEMBER(gb_rom_digimon_device::write_bank)
READ8_MEMBER(gb_rom_digimon_device::read_ram)
{
- if (m_ram && m_ram_enable)
+ if (!m_ram.empty() && m_ram_enable)
return m_ram[ram_bank_map[m_ram_bank] * 0x2000 + (offset & 0x1fff)];
else
return 0xff;
@@ -985,7 +985,7 @@ READ8_MEMBER(gb_rom_digimon_device::read_ram)
WRITE8_MEMBER(gb_rom_digimon_device::write_ram)
{
- if (m_ram && m_ram_enable)
+ if (!m_ram.empty() && m_ram_enable)
m_ram[ram_bank_map[m_ram_bank] * 0x2000 + (offset & 0x1fff)] = data;
}
@@ -1019,7 +1019,7 @@ WRITE8_MEMBER(gb_rom_rockman8_device::write_bank)
READ8_MEMBER(gb_rom_rockman8_device::read_ram)
{
- if (m_ram)
+ if (!m_ram.empty())
return m_ram[offset];
else
return 0xff;
@@ -1027,7 +1027,7 @@ READ8_MEMBER(gb_rom_rockman8_device::read_ram)
WRITE8_MEMBER(gb_rom_rockman8_device::write_ram)
{
- if (m_ram)
+ if (!m_ram.empty())
m_ram[offset] = data;
}
@@ -1127,7 +1127,7 @@ WRITE8_MEMBER(gb_rom_sm3sp_device::write_bank)
READ8_MEMBER(gb_rom_sm3sp_device::read_ram)
{
- if (m_ram)
+ if (!m_ram.empty())
return m_ram[offset];
else
return 0xff;
@@ -1135,6 +1135,6 @@ READ8_MEMBER(gb_rom_sm3sp_device::read_ram)
WRITE8_MEMBER(gb_rom_sm3sp_device::write_ram)
{
- if (m_ram)
+ if (!m_ram.empty())
m_ram[offset] = data;
}
diff --git a/src/emu/bus/gameboy/rom.c b/src/emu/bus/gameboy/rom.c
index 1ec6258710a..bb5a10039b7 100644
--- a/src/emu/bus/gameboy/rom.c
+++ b/src/emu/bus/gameboy/rom.c
@@ -153,7 +153,7 @@ READ8_MEMBER(gb_rom_device::read_rom)
READ8_MEMBER(gb_rom_device::read_ram)
{
- if (m_ram)
+ if (!m_ram.empty())
return m_ram[ram_bank_map[m_ram_bank] * 0x2000 + offset];
else
return 0xff;
@@ -161,7 +161,7 @@ READ8_MEMBER(gb_rom_device::read_ram)
WRITE8_MEMBER(gb_rom_device::write_ram)
{
- if (m_ram)
+ if (!m_ram.empty())
m_ram[ram_bank_map[m_ram_bank] * 0x2000 + offset] = data;
}
diff --git a/src/emu/bus/gba/gba_slot.c b/src/emu/bus/gba/gba_slot.c
index 64906667b53..30f50201a3f 100644
--- a/src/emu/bus/gba/gba_slot.c
+++ b/src/emu/bus/gba/gba_slot.c
@@ -408,9 +408,9 @@ void gba_cart_slot_device::get_default_card_software(astring &result)
dynamic_buffer rom(len);
int type;
- core_fread(m_file, rom, len);
+ core_fread(m_file, &rom[0], len);
- type = get_cart_type(rom, len);
+ type = get_cart_type(&rom[0], len);
slot_string = gba_get_slot(type);
//printf("type: %s\n", slot_string);
diff --git a/src/emu/bus/gba/gba_slot.h b/src/emu/bus/gba/gba_slot.h
index 79ac615d25e..ede5f7321f8 100644
--- a/src/emu/bus/gba/gba_slot.h
+++ b/src/emu/bus/gba/gba_slot.h
@@ -37,9 +37,9 @@ public:
void rom_alloc(UINT32 size, const char *tag);
void nvram_alloc(UINT32 size);
UINT32* get_rom_base() { return m_rom; }
- UINT32* get_nvram_base() { return m_nvram; }
+ UINT32* get_nvram_base() { return &m_nvram[0]; }
UINT32 get_rom_size() { return m_rom_size; }
- UINT32 get_nvram_size() { return m_nvram.bytes(); }
+ UINT32 get_nvram_size() { return m_nvram.size()*sizeof(UINT32); }
void set_rom_size(UINT32 val) { m_rom_size = val; }
void save_nvram() { device().save_item(NAME(m_nvram)); }
@@ -47,7 +47,7 @@ public:
// internal state
UINT32 *m_rom; // this points to the cart rom region
UINT32 m_rom_size; // this is the actual game size, not the rom region size!
- dynamic_array<UINT32> m_nvram;
+ std::vector<UINT32> m_nvram;
};
diff --git a/src/emu/bus/gba/rom.c b/src/emu/bus/gba/rom.c
index 69f2b6b94b7..19f08405259 100644
--- a/src/emu/bus/gba/rom.c
+++ b/src/emu/bus/gba/rom.c
@@ -116,7 +116,7 @@ void gba_rom_eeprom64_device::device_start()
READ32_MEMBER(gba_rom_sram_device::read_ram)
{
- if (m_nvram && offset < m_nvram.count())
+ if (!m_nvram.empty() && offset < m_nvram.size())
return m_nvram[offset];
else // this cannot actually happen...
return 0xffffffff;
@@ -124,7 +124,7 @@ READ32_MEMBER(gba_rom_sram_device::read_ram)
WRITE32_MEMBER(gba_rom_sram_device::write_ram)
{
- if (m_nvram && offset < m_nvram.count())
+ if (!m_nvram.empty() && offset < m_nvram.size())
COMBINE_DATA(&m_nvram[offset]);
}
diff --git a/src/emu/bus/generic/ram.c b/src/emu/bus/generic/ram.c
index 4632c614cbc..16289689cbf 100644
--- a/src/emu/bus/generic/ram.c
+++ b/src/emu/bus/generic/ram.c
@@ -99,7 +99,7 @@ void generic_ram_linear_device::device_start()
READ8_MEMBER(generic_ram_plain_device::read_ram)
{
- if (offset < m_ram.bytes())
+ if (offset < m_ram.size())
return m_ram[offset];
else
return 0xff;
@@ -107,17 +107,17 @@ READ8_MEMBER(generic_ram_plain_device::read_ram)
WRITE8_MEMBER(generic_ram_plain_device::write_ram)
{
- if (offset < m_ram.bytes())
+ if (offset < m_ram.size())
m_ram[offset] = data;
}
READ8_MEMBER(generic_ram_linear_device::read_ram)
{
- return m_ram[offset % m_ram.bytes()];
+ return m_ram[offset % m_ram.size()];
}
WRITE8_MEMBER(generic_ram_linear_device::write_ram)
{
- m_ram[offset % m_ram.bytes()] = data;
+ m_ram[offset % m_ram.size()] = data;
}
diff --git a/src/emu/bus/generic/rom.c b/src/emu/bus/generic/rom.c
index fd2107eb798..5520e7c6d5f 100644
--- a/src/emu/bus/generic/rom.c
+++ b/src/emu/bus/generic/rom.c
@@ -109,7 +109,7 @@ READ32_MEMBER(generic_rom_linear_device::read32_rom)
READ8_MEMBER(generic_romram_plain_device::read_ram)
{
- if (offset < m_ram.bytes())
+ if (offset < m_ram.size())
return m_ram[offset];
else
return 0xff;
@@ -117,6 +117,6 @@ READ8_MEMBER(generic_romram_plain_device::read_ram)
WRITE8_MEMBER(generic_romram_plain_device::write_ram)
{
- if (offset < m_ram.bytes())
+ if (offset < m_ram.size())
m_ram[offset] = data;
}
diff --git a/src/emu/bus/generic/slot.h b/src/emu/bus/generic/slot.h
index a93d7d8904e..7223a388d45 100644
--- a/src/emu/bus/generic/slot.h
+++ b/src/emu/bus/generic/slot.h
@@ -31,8 +31,8 @@ public:
UINT8* get_rom_base() { return m_rom; }
UINT32 get_rom_size() { return m_rom_size; }
- UINT8* get_ram_base() { return m_ram; }
- UINT32 get_ram_size() { return m_ram.count(); }
+ UINT8* get_ram_base() { return &m_ram[0]; }
+ UINT32 get_ram_size() { return m_ram.size(); }
void save_ram() { device().save_item(NAME(m_ram)); }
diff --git a/src/emu/bus/intv/ecs.c b/src/emu/bus/intv/ecs.c
index fd953808e56..7862b1cc1e2 100644
--- a/src/emu/bus/intv/ecs.c
+++ b/src/emu/bus/intv/ecs.c
@@ -57,7 +57,7 @@ void intv_ecs_device::device_start()
astring region_tag;
m_rom = memregion(region_tag.cpy(tag()).cat(":ecs").c_str())->base();
}
- if (!m_ram.count())
+ if (m_ram.empty())
{
m_ram.resize(0x800);
}
diff --git a/src/emu/bus/intv/ecs.h b/src/emu/bus/intv/ecs.h
index 52ca99b76e5..7f92230064f 100644
--- a/src/emu/bus/intv/ecs.h
+++ b/src/emu/bus/intv/ecs.h
@@ -31,8 +31,8 @@ public:
virtual DECLARE_READ16_MEMBER(read_rome0);
virtual DECLARE_READ16_MEMBER(read_romf0);
// RAM
- virtual DECLARE_READ16_MEMBER(read_ram) { return (int)m_ram[offset & (m_ram.count() - 1)]; }
- virtual DECLARE_WRITE16_MEMBER(write_ram) { m_ram[offset & (m_ram.count() - 1)] = data & 0xff; }
+ virtual DECLARE_READ16_MEMBER(read_ram) { return (int)m_ram[offset & (m_ram.size() - 1)]; }
+ virtual DECLARE_WRITE16_MEMBER(write_ram) { m_ram[offset & (m_ram.size() - 1)] = data & 0xff; }
// AY8914
virtual DECLARE_READ16_MEMBER(read_ay);
virtual DECLARE_WRITE16_MEMBER(write_ay);
diff --git a/src/emu/bus/intv/rom.h b/src/emu/bus/intv/rom.h
index cb6947b833c..b78663bb47b 100644
--- a/src/emu/bus/intv/rom.h
+++ b/src/emu/bus/intv/rom.h
@@ -45,8 +45,8 @@ public:
intv_ram_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
// reading and writing
- virtual DECLARE_READ16_MEMBER(read_ram) { return (int)m_ram[offset & (m_ram.count() - 1)]; }
- virtual DECLARE_WRITE16_MEMBER(write_ram) { m_ram[offset & (m_ram.count() - 1)] = data & 0xff; }
+ virtual DECLARE_READ16_MEMBER(read_ram) { return (int)m_ram[offset & (m_ram.size() - 1)]; }
+ virtual DECLARE_WRITE16_MEMBER(write_ram) { m_ram[offset & (m_ram.size() - 1)] = data & 0xff; }
};
// ======================> intv_gfact_device
@@ -58,8 +58,8 @@ public:
intv_gfact_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
// reading and writing
- virtual DECLARE_READ16_MEMBER(read_ram) { return (int)m_ram[offset & (m_ram.count() - 1)]; }
- virtual DECLARE_WRITE16_MEMBER(write_ram) { m_ram[offset & (m_ram.count() - 1)] = data & 0xff; }
+ virtual DECLARE_READ16_MEMBER(read_ram) { return (int)m_ram[offset & (m_ram.size() - 1)]; }
+ virtual DECLARE_WRITE16_MEMBER(write_ram) { m_ram[offset & (m_ram.size() - 1)] = data & 0xff; }
};
// ======================> intv_wsmlb_device
diff --git a/src/emu/bus/intv/slot.c b/src/emu/bus/intv/slot.c
index 155cb308824..2702247554b 100644
--- a/src/emu/bus/intv/slot.c
+++ b/src/emu/bus/intv/slot.c
@@ -468,7 +468,7 @@ void intv_cart_slot_device::get_default_card_software(astring &result)
dynamic_buffer rom(len);
int type = INTV_STD;
- core_fread(m_file, rom, len);
+ core_fread(m_file, &rom[0], len);
if (rom[0] == 0xa8 && (rom[1] == (rom[2] ^ 0xff)))
{
diff --git a/src/emu/bus/intv/slot.h b/src/emu/bus/intv/slot.h
index 03b3792349b..4cdcc444b4b 100644
--- a/src/emu/bus/intv/slot.h
+++ b/src/emu/bus/intv/slot.h
@@ -67,9 +67,9 @@ public:
void rom_alloc(UINT32 size, const char *tag);
void ram_alloc(UINT32 size);
UINT8* get_rom_base() { return m_rom; }
- UINT8* get_ram_base() { return m_ram; }
+ UINT8* get_ram_base() { return &m_ram[0]; }
UINT32 get_rom_size() { return m_rom_size; }
- UINT32 get_ram_size() { return m_ram.count(); }
+ UINT32 get_ram_size() { return m_ram.size(); }
void save_ram() { device().save_item(NAME(m_ram)); }
virtual void late_subslot_setup() {}
diff --git a/src/emu/bus/isa/3c505.c b/src/emu/bus/isa/3c505.c
index 8ef8a479c71..83e25f3643c 100644
--- a/src/emu/bus/isa/3c505.c
+++ b/src/emu/bus/isa/3c505.c
@@ -435,14 +435,14 @@ void threecom3c505_device::data_buffer::reset()
void threecom3c505_device::data_buffer::copy(data_buffer *db) const
{
- db->m_data.resize(m_data.count());
+ db->m_data.resize(m_data.size());
db->m_length = m_length;
- memcpy(db->m_data, m_data, m_data.count());
+ memcpy(&db->m_data[0], &m_data[0], m_data.size());
}
int threecom3c505_device::data_buffer::append(UINT8 data)
{
- if (m_length >= m_data.count())
+ if (m_length >= m_data.size())
{
return 0;
}
@@ -532,7 +532,7 @@ int threecom3c505_device::data_buffer_fifo::put(const UINT8 data[], const int le
}
else
{
- memcpy(m_db[m_put_index]->m_data, data, length);
+ memcpy(&m_db[m_put_index]->m_data[0], data, length);
m_db[m_put_index]->m_length = length;
m_put_index = next_index;
m_count++;
diff --git a/src/emu/bus/isa/3c505.h b/src/emu/bus/isa/3c505.h
index 15b5a67b48b..d37ad051ea2 100644
--- a/src/emu/bus/isa/3c505.h
+++ b/src/emu/bus/isa/3c505.h
@@ -168,10 +168,10 @@ private:
UINT8 get(int i) { return m_data[i]; };
UINT16 get_word(int i) { return (m_data[i*2+1] << 8) + m_data[i*2]; };
int is_empty() {return m_length == 0; };
- int is_full() {return m_length >= m_data.count(); };
+ int is_full() {return m_length >= m_data.size(); };
UINT16 get_length() { return m_length; };
- UINT16 get_size() { return m_data.count(); };
- UINT8 *get_data() { return m_data; };
+ UINT16 get_size() { return m_data.size(); };
+ UINT8 *get_data() { return &m_data[0]; };
void copy(data_buffer *db) const;
void log(const char *title) const;
diff --git a/src/emu/bus/isa/cga.c b/src/emu/bus/isa/cga.c
index a9efd79de45..da5591d1a2c 100644
--- a/src/emu/bus/isa/cga.c
+++ b/src/emu/bus/isa/cga.c
@@ -339,7 +339,7 @@ void isa8_cga_device::device_start()
set_isa_device();
m_vram.resize(m_vram_size);
m_isa->install_device(0x3d0, 0x3df, 0, 0, read8_delegate( FUNC(isa8_cga_device::io_read), this ), write8_delegate( FUNC(isa8_cga_device::io_write), this ) );
- m_isa->install_bank(0xb8000, 0xb8000 + MIN(0x8000,m_vram_size) - 1, 0, m_vram_size & 0x4000, "bank_cga", m_vram);
+ m_isa->install_bank(0xb8000, 0xb8000 + MIN(0x8000,m_vram_size) - 1, 0, m_vram_size & 0x4000, "bank_cga", &m_vram[0]);
/* Initialise the cga palette */
int i;
@@ -1552,7 +1552,7 @@ void isa8_cga_pc1512_device::device_start()
isa8_cga_device::device_start();
m_isa->install_device(0x3d0, 0x3df, 0, 0, read8_delegate( FUNC(isa8_cga_pc1512_device::io_read), this ), write8_delegate( FUNC(isa8_cga_pc1512_device::io_write), this ) );
- m_isa->install_bank(0xb8000, 0xbbfff, 0, 0, "bank1", m_vram);
+ m_isa->install_bank(0xb8000, 0xbbfff, 0, 0, "bank1", &m_vram[0]);
address_space &space = machine().firstcpu->space( AS_PROGRAM );
@@ -1787,7 +1787,7 @@ WRITE8_MEMBER( isa8_ec1841_0002_device::io_write )
read8_delegate( FUNC(isa8_ec1841_0002_device::char_ram_read), this),
write8_delegate(FUNC(isa8_ec1841_0002_device::char_ram_write), this) );
} else {
- m_isa->install_bank(0xb8000, 0xb8000 + MIN(0x8000,m_vram_size) - 1, 0, m_vram_size & 0x4000, "bank_cga", m_vram);
+ m_isa->install_bank(0xb8000, 0xb8000 + MIN(0x8000,m_vram_size) - 1, 0, m_vram_size & 0x4000, "bank_cga", &m_vram[0]);
}
break;
default:
diff --git a/src/emu/bus/isa/gus.c b/src/emu/bus/isa/gus.c
index 0de369223e3..ede6f8fccd7 100644
--- a/src/emu/bus/isa/gus.c
+++ b/src/emu/bus/isa/gus.c
@@ -389,7 +389,8 @@ void gf1_device::device_start()
m_nmi_handler.resolve_safe();
// TODO: make DRAM size configurable. Can be 256k, 512k, 768k, or 1024k
- m_wave_ram.resize_and_clear(1024*1024);
+ m_wave_ram.resize(1024*1024);
+ memset(&m_wave_ram[0], 0, 1024*1024);
m_stream = stream_alloc(0,2,44100);
diff --git a/src/emu/bus/isa/hdc.c b/src/emu/bus/isa/hdc.c
index c2176f66c42..9376ab65952 100644
--- a/src/emu/bus/isa/hdc.c
+++ b/src/emu/bus/isa/hdc.c
@@ -582,7 +582,7 @@ void isa8_hdc_device::hdc_command()
csb = 0x00;
error = 0;
- buffer_ptr = buffer;
+ buffer_ptr = &buffer[0];
cmd = buffer[0];
get_drive();
@@ -716,7 +716,7 @@ void isa8_hdc_device::pc_hdc_data_w(int data)
if (LOG_HDC_DATA)
logerror("hdc_data_w $%02x: ", data);
- buffer_ptr = buffer;
+ buffer_ptr = &buffer[0];
data_cnt = 6; /* expect 6 bytes including this one */
status &= ~STA_READY;
status &= ~STA_INPUT;
@@ -792,8 +792,8 @@ void isa8_hdc_device::pc_hdc_reset_w(int data)
sector[0] = sector[1] = 0;
csb = 0;
status = STA_COMMAND | STA_READY;
- memset(buffer, 0, buffer.count());
- buffer_ptr = buffer;
+ memset(&buffer[0], 0, buffer.size());
+ buffer_ptr = &buffer[0];
data_cnt = 0;
}
diff --git a/src/emu/bus/isa/mda.c b/src/emu/bus/isa/mda.c
index 48a2a8a9243..f50b03602d7 100644
--- a/src/emu/bus/isa/mda.c
+++ b/src/emu/bus/isa/mda.c
@@ -176,7 +176,7 @@ void isa8_mda_device::device_start()
set_isa_device();
m_videoram.resize(0x1000);
m_isa->install_device(0x3b0, 0x3bf, 0, 0, read8_delegate( FUNC(isa8_mda_device::io_read), this ), write8_delegate( FUNC(isa8_mda_device::io_write), this ) );
- m_isa->install_bank(0xb0000, 0xb0fff, 0, 0x07000, "bank_mda", m_videoram);
+ m_isa->install_bank(0xb0000, 0xb0fff, 0, 0x07000, "bank_mda", &m_videoram[0]);
/* Initialise the mda palette */
for(int i = 0; i < 4; i++)
@@ -596,7 +596,7 @@ void isa8_hercules_device::device_start()
m_videoram.resize(0x10000);
set_isa_device();
m_isa->install_device(0x3b0, 0x3bf, 0, 0, read8_delegate( FUNC(isa8_hercules_device::io_read), this ), write8_delegate( FUNC(isa8_hercules_device::io_write), this ) );
- m_isa->install_bank(0xb0000, 0xbffff, 0, 0, "bank_hercules", m_videoram);
+ m_isa->install_bank(0xb0000, 0xbffff, 0, 0, "bank_hercules", &m_videoram[0]);
/* Initialise the mda palette */
for(int i = 0; i < (sizeof(mda_palette) / 3); i++)
diff --git a/src/emu/bus/isa/omti8621.c b/src/emu/bus/isa/omti8621.c
index 1e0e697e4d0..8f9b126d053 100644
--- a/src/emu/bus/isa/omti8621.c
+++ b/src/emu/bus/isa/omti8621.c
@@ -339,8 +339,8 @@ void omti8621_device::device_reset()
// default the sector data buffer with model and status information
// (i.e. set sector data buffer for cmd=0x0e READ SECTOR BUFFER)
- memset(sector_buffer, 0, OMTI_DISK_SECTOR_SIZE);
- memcpy(sector_buffer, "8621VB.4060487xx", 0x10);
+ memset(&sector_buffer[0], 0, OMTI_DISK_SECTOR_SIZE);
+ memcpy(&sector_buffer[0], "8621VB.4060487xx", 0x10);
sector_buffer[0x10] = 0; // ROM Checksum error
sector_buffer[0x11] = 0; // Processor Register error
sector_buffer[0x12] = 0; // Buffer RAM error
@@ -543,7 +543,7 @@ void omti8621_device::set_data_transfer(UINT8 *data, UINT16 length)
void omti8621_device::read_sectors_from_disk(INT32 diskaddr, UINT8 count, UINT8 lun)
{
- UINT8 *data_buffer = sector_buffer;
+ UINT8 *data_buffer = &sector_buffer[0];
device_image_interface *image = our_disks[lun]->m_image;
while (count-- > 0) {
@@ -563,7 +563,7 @@ void omti8621_device::read_sectors_from_disk(INT32 diskaddr, UINT8 count, UINT8
void omti8621_device::write_sectors_to_disk(INT32 diskaddr, UINT8 count, UINT8 lun)
{
- UINT8 *data_buffer = sector_buffer;
+ UINT8 *data_buffer = &sector_buffer[0];
device_image_interface *image = our_disks[lun]->m_image;
while (count-- > 0) {
@@ -594,10 +594,10 @@ void omti8621_device::copy_sectors(INT32 dst_addr, INT32 src_addr, UINT8 count,
while (count-- > 0) {
image->fseek( src_addr * OMTI_DISK_SECTOR_SIZE, SEEK_SET);
- image->fread( sector_buffer, OMTI_DISK_SECTOR_SIZE);
+ image->fread( &sector_buffer[0], OMTI_DISK_SECTOR_SIZE);
image->fseek( dst_addr * OMTI_DISK_SECTOR_SIZE, SEEK_SET);
- image->fwrite( sector_buffer, OMTI_DISK_SECTOR_SIZE);
+ image->fwrite( &sector_buffer[0], OMTI_DISK_SECTOR_SIZE);
if (dst_addr == diskaddr_ecc_error) {
// reset previous ECC error
@@ -641,7 +641,7 @@ void omti8621_device::format_track(const UINT8 * cdb)
if (check_disk_address(cdb) ) {
if ((cdb[5] & 0x40) == 0) {
- memset(sector_buffer, 0x6C, OMTI_DISK_SECTOR_SIZE * our_disks[lun]->m_sectors);
+ memset(&sector_buffer[0], 0x6C, OMTI_DISK_SECTOR_SIZE * our_disks[lun]->m_sectors);
}
write_sectors_to_disk(disk_addr, our_disks[lun]->m_sectors, lun);
}
@@ -840,7 +840,7 @@ void omti8621_device::do_command(const UINT8 cdb[], const UINT16 cdb_length)
if (check_disk_address(cdb)) {
// read data from controller
read_sectors_from_disk(get_disk_address(cdb), cdb[4], lun);
- set_data_transfer(sector_buffer, OMTI_DISK_SECTOR_SIZE*cdb[4]);
+ set_data_transfer(&sector_buffer[0], OMTI_DISK_SECTOR_SIZE*cdb[4]);
}
break;
@@ -856,7 +856,7 @@ void omti8621_device::do_command(const UINT8 cdb[], const UINT16 cdb_length)
break;
case OMTI_CMD_READ_SECTOR_BUFFER: // 0x0E
- set_data_transfer(sector_buffer, OMTI_DISK_SECTOR_SIZE*cdb[4]);
+ set_data_transfer(&sector_buffer[0], OMTI_DISK_SECTOR_SIZE*cdb[4]);
break;
case OMTI_CMD_WRITE_SECTOR_BUFFER: // 0x0F
@@ -909,7 +909,7 @@ void omti8621_device::do_command(const UINT8 cdb[], const UINT16 cdb_length)
if (check_disk_address(cdb)) {
// read data from controller
read_sectors_from_disk(get_disk_address(cdb), cdb[4], lun);
- set_data_transfer(sector_buffer, OMTI_DISK_SECTOR_SIZE+6);
+ set_data_transfer(&sector_buffer[0], OMTI_DISK_SECTOR_SIZE+6);
}
break;
@@ -1050,7 +1050,7 @@ WRITE8_MEMBER(omti8621_device::write8)
// TODO: check diskaddr
// Fall through
case OMTI_CMD_WRITE_SECTOR_BUFFER: // 0x0F
- set_data_transfer(sector_buffer,
+ set_data_transfer(&sector_buffer[0],
OMTI_DISK_SECTOR_SIZE * command_buffer[4]);
status_port &= ~OMTI_STATUS_IO;
break;
@@ -1062,7 +1062,7 @@ WRITE8_MEMBER(omti8621_device::write8)
case OMTI_CMD_WRITE_LONG: // 0xE6
// TODO: check diskaddr
- set_data_transfer(sector_buffer,
+ set_data_transfer(&sector_buffer[0],
(OMTI_DISK_SECTOR_SIZE +6) * command_buffer[4]);
status_port &= ~OMTI_STATUS_IO;
break;
diff --git a/src/emu/bus/isa/s3virge.c b/src/emu/bus/isa/s3virge.c
index fdd4c3b8ed7..ffc9bdaa935 100644
--- a/src/emu/bus/isa/s3virge.c
+++ b/src/emu/bus/isa/s3virge.c
@@ -60,7 +60,8 @@ void s3virge_vga_device::device_start()
vga.svga_intf.seq_regcount = 0x1c;
vga.svga_intf.crtc_regcount = 0x19;
vga.svga_intf.vram_size = 0x400000;
- vga.memory.resize_and_clear(vga.svga_intf.vram_size);
+ vga.memory.resize(vga.svga_intf.vram_size);
+ memset(&vga.memory[0], 0, vga.svga_intf.vram_size);
save_item(vga.memory,"Video RAM");
save_pointer(vga.crtc.data,"CRTC Registers",0x100);
save_pointer(vga.sequencer.data,"Sequencer Registers",0x100);
diff --git a/src/emu/bus/isa/sc499.c b/src/emu/bus/isa/sc499.c
index 1ca3859d41c..ec5ea575dc6 100644
--- a/src/emu/bus/isa/sc499.c
+++ b/src/emu/bus/isa/sc499.c
@@ -1187,7 +1187,7 @@ void sc499_device::read_block()
}
else
{
- memcpy(m_ctape_block_buffer, tape, SC499_CTAPE_BLOCK_SIZE);
+ memcpy(&m_ctape_block_buffer[0], tape, SC499_CTAPE_BLOCK_SIZE);
// if (verbose > 1 || m_tape_pos % 100 == 0)
{
@@ -1238,7 +1238,7 @@ void sc499_device::write_block()
check_tape();
}
- m_image->write_block(m_tape_pos, m_ctape_block_buffer);
+ m_image->write_block(m_tape_pos, &m_ctape_block_buffer[0]);
m_ctape_block_count = m_tape_pos;
m_ctape_block_index = 0;
m_tape_pos++;
@@ -1255,8 +1255,8 @@ int sc499_device::block_is_filemark()
{
static const UINT8 fm_pattern[] = {0xDE, 0xAF, 0xFA, 0xED};
- int is_filemark = memcmp(m_ctape_block_buffer, fm_pattern, 4) == 0 &&
- memcmp(m_ctape_block_buffer, m_ctape_block_buffer+4, SC499_CTAPE_BLOCK_SIZE-4) == 0;
+ int is_filemark = memcmp(&m_ctape_block_buffer[0], fm_pattern, 4) == 0 &&
+ memcmp(&m_ctape_block_buffer[0], &m_ctape_block_buffer[4], SC499_CTAPE_BLOCK_SIZE-4) == 0;
LOG3(("block_is_filemark for block %d = %d", m_tape_pos-1, is_filemark));
return is_filemark;
@@ -1271,7 +1271,7 @@ void sc499_device::block_set_filemark()
static const UINT8 fm_pattern[] = {0xDE, 0xAF, 0xFA, 0xED};
for (int i = 0; i < SC499_CTAPE_BLOCK_SIZE; i += 4)
{
- memcpy(m_ctape_block_buffer + i, fm_pattern, 4);
+ memcpy(&m_ctape_block_buffer[i], fm_pattern, 4);
}
}
@@ -1294,16 +1294,16 @@ void sc499_ctape_image_device::device_config_complete()
UINT8 *sc499_ctape_image_device::read_block(int block_num)
{
// access beyond end of tape cart
- if (m_ctape_data.bytes() <= (block_num + 1) * SC499_CTAPE_BLOCK_SIZE)
+ if (m_ctape_data.size() <= (block_num + 1) * SC499_CTAPE_BLOCK_SIZE)
return NULL;
else
- return m_ctape_data + (block_num * SC499_CTAPE_BLOCK_SIZE);
+ return &m_ctape_data[block_num * SC499_CTAPE_BLOCK_SIZE];
}
void sc499_ctape_image_device::write_block(int block_num, UINT8 *ptr)
{
- if (!(m_ctape_data.bytes() <= (block_num + 1) * SC499_CTAPE_BLOCK_SIZE))
- memcpy(m_ctape_data + (block_num * SC499_CTAPE_BLOCK_SIZE), ptr, SC499_CTAPE_BLOCK_SIZE);
+ if (!(m_ctape_data.size() <= (block_num + 1) * SC499_CTAPE_BLOCK_SIZE))
+ memcpy(&m_ctape_data[block_num * SC499_CTAPE_BLOCK_SIZE], ptr, SC499_CTAPE_BLOCK_SIZE);
}
bool sc499_ctape_image_device::call_load()
@@ -1317,7 +1317,7 @@ bool sc499_ctape_image_device::call_load()
size = io_generic_size(&io);
m_ctape_data.resize(size);
- io_generic_read(&io, m_ctape_data, 0, size);
+ io_generic_read(&io, &m_ctape_data[0], 0, size);
return IMAGE_INIT_PASS;
}
diff --git a/src/emu/bus/isa/sc499.h b/src/emu/bus/isa/sc499.h
index 2db4b28e4c7..dce05873fce 100644
--- a/src/emu/bus/isa/sc499.h
+++ b/src/emu/bus/isa/sc499.h
@@ -46,7 +46,7 @@ public:
UINT8 *read_block(int block_num);
void write_block(int block_num, UINT8 *ptr);
- UINT64 tapelen() { return m_ctape_data.bytes(); }
+ UINT64 tapelen() { return m_ctape_data.size(); }
protected:
// device-level overrides
diff --git a/src/emu/bus/isa/trident.c b/src/emu/bus/isa/trident.c
index 0d8b2134808..971d627068b 100644
--- a/src/emu/bus/isa/trident.c
+++ b/src/emu/bus/isa/trident.c
@@ -169,7 +169,8 @@ void trident_vga_device::device_start()
vga.read_dipswitch = read8_delegate(); //read_dipswitch;
vga.svga_intf.vram_size = 0x200000;
- vga.memory.resize_and_clear(vga.svga_intf.vram_size);
+ vga.memory.resize(vga.svga_intf.vram_size);
+ memset(&vga.memory[0], 0, vga.svga_intf.vram_size);
save_item(NAME(vga.memory));
save_pointer(vga.crtc.data,"CRTC Registers",0x100);
save_pointer(vga.sequencer.data,"Sequencer Registers",0x100);
diff --git a/src/emu/bus/megadrive/md_slot.c b/src/emu/bus/megadrive/md_slot.c
index 8b07d773fc1..383912da695 100644
--- a/src/emu/bus/megadrive/md_slot.c
+++ b/src/emu/bus/megadrive/md_slot.c
@@ -471,7 +471,7 @@ int base_md_cart_slot_device::load_nonlist()
dynamic_buffer tmpROM(tmplen);
// STEP 1: store a (possibly headered) copy of the file and determine its type (SMD? MD? BIN?)
- fread(tmpROM, tmplen);
+ fread(&tmpROM[0], tmplen);
is_smd = genesis_is_SMD(&tmpROM[0x200], tmplen - 0x200);
is_md = (tmpROM[0x80] == 'E') && (tmpROM[0x81] == 'A') && (tmpROM[0x82] == 'M' || tmpROM[0x82] == 'G');
@@ -909,12 +909,12 @@ void base_md_cart_slot_device::get_default_card_software(astring &result)
dynamic_buffer rom(len);
int type;
- core_fread(m_file, rom, len);
+ core_fread(m_file, &rom[0], len);
if (genesis_is_SMD(&rom[0x200], len - 0x200))
offset = 0x200;
- type = get_cart_type(rom + offset, len - offset);
+ type = get_cart_type(&rom[offset], len - offset);
slot_string = md_get_slot(type);
clear();
diff --git a/src/emu/bus/megadrive/md_slot.h b/src/emu/bus/megadrive/md_slot.h
index a55ada17e9b..8aa7e10987e 100644
--- a/src/emu/bus/megadrive/md_slot.h
+++ b/src/emu/bus/megadrive/md_slot.h
@@ -103,9 +103,9 @@ public:
virtual void rom_alloc(size_t size, const char *tag);
virtual void nvram_alloc(size_t size);
virtual UINT16* get_rom_base() { return m_rom; };
- virtual UINT16* get_nvram_base() { return m_nvram; };
+ virtual UINT16* get_nvram_base() { return &m_nvram[0]; };
virtual UINT32 get_rom_size() { return m_rom_size; };
- virtual UINT32 get_nvram_size() { return m_nvram.bytes(); };
+ virtual UINT32 get_nvram_size() { return m_nvram.size()*sizeof(UINT16); };
virtual void set_bank_to_rom(const char *banktag, UINT32 offset) {};
void save_nvram() { device().save_item(NAME(m_nvram)); }
@@ -124,7 +124,7 @@ public:
// internal state
UINT16 *m_rom;
UINT32 m_rom_size;
- dynamic_array<UINT16> m_nvram;
+ std::vector<UINT16> m_nvram;
UINT8 rom_bank_map[128]; // 64K chunks of rom
};
diff --git a/src/emu/bus/msx_cart/cartridge.c b/src/emu/bus/msx_cart/cartridge.c
index 9d85a187b01..ae962d41d7b 100644
--- a/src/emu/bus/msx_cart/cartridge.c
+++ b/src/emu/bus/msx_cart/cartridge.c
@@ -70,22 +70,26 @@ msx_cart_interface::msx_cart_interface(const machine_config &mconfig, device_t &
void msx_cart_interface::rom_alloc(UINT32 size)
{
- m_rom.resize_and_clear(size, 0xff);
+ m_rom.resize(size);
+ memset(&m_rom[0], 0xff, size);
}
void msx_cart_interface::rom_vlm5030_alloc(UINT32 size)
{
- m_rom_vlm5030.resize_and_clear(size, 0xff);
+ m_rom_vlm5030.resize(size);
+ memset(&m_rom_vlm5030[0], 0xff, size);
}
void msx_cart_interface::ram_alloc(UINT32 size)
{
- m_ram.resize_and_clear(size);
+ m_ram.resize(size);
+ memset(&m_ram[0], 0x00, size);
}
void msx_cart_interface::sram_alloc(UINT32 size)
{
- m_sram.resize_and_clear(size);
+ m_sram.resize(size);
+ memset(&m_sram[0], 0x00, size);
}
diff --git a/src/emu/bus/msx_cart/cartridge.h b/src/emu/bus/msx_cart/cartridge.h
index ebaee3f6e56..f256299159b 100644
--- a/src/emu/bus/msx_cart/cartridge.h
+++ b/src/emu/bus/msx_cart/cartridge.h
@@ -29,14 +29,14 @@ public:
void rom_vlm5030_alloc(UINT32 size);
void sram_alloc(UINT32 size);
- UINT8* get_rom_base() { return m_rom; }
- UINT8* get_rom_vlm5030_base() { return m_rom_vlm5030; }
- UINT8* get_ram_base() { return m_ram; }
- UINT8* get_sram_base() { return m_sram; }
- UINT32 get_rom_size() { return m_rom.count(); }
- UINT32 get_rom_vlm5030_size() { return m_rom_vlm5030.count(); }
- UINT32 get_ram_size() { return m_ram.count(); }
- UINT32 get_sram_size() { return m_sram.count(); }
+ UINT8* get_rom_base() { return &m_rom[0]; }
+ UINT8* get_rom_vlm5030_base() { return &m_rom_vlm5030[0]; }
+ UINT8* get_ram_base() { return &m_ram[0]; }
+ UINT8* get_sram_base() { return &m_sram[0]; }
+ UINT32 get_rom_size() { return m_rom.size(); }
+ UINT32 get_rom_vlm5030_size() { return m_rom_vlm5030.size(); }
+ UINT32 get_ram_size() { return m_ram.size(); }
+ UINT32 get_sram_size() { return m_sram.size(); }
protected:
dynamic_buffer m_rom;
diff --git a/src/emu/bus/msx_cart/konami.c b/src/emu/bus/msx_cart/konami.c
index f8fe82d4ffb..e09f04768c1 100644
--- a/src/emu/bus/msx_cart/konami.c
+++ b/src/emu/bus/msx_cart/konami.c
@@ -907,7 +907,7 @@ void msx_cart_keyboard_master::initialize_cartridge()
{
fatalerror("keyboard_master: Invalid ROM size\n");
}
- m_vlm5030->set_rom(m_rom_vlm5030);
+ m_vlm5030->set_rom(&m_rom_vlm5030[0]);
}
diff --git a/src/emu/bus/msx_slot/cartridge.c b/src/emu/bus/msx_slot/cartridge.c
index 57b2a668ac5..091bb9345f2 100644
--- a/src/emu/bus/msx_slot/cartridge.c
+++ b/src/emu/bus/msx_slot/cartridge.c
@@ -326,7 +326,7 @@ void msx_slot_cartridge_device::get_default_card_software(astring &result)
if (type == NOMAPPER)
{
// Not identified through hashfile, try automatic detection
- type = get_cart_type(rom, length);
+ type = get_cart_type(&rom[0], length);
}
if (type > NOMAPPER)
diff --git a/src/emu/bus/msx_slot/panasonic08.c b/src/emu/bus/msx_slot/panasonic08.c
index 67df2832734..e0dd880221b 100644
--- a/src/emu/bus/msx_slot/panasonic08.c
+++ b/src/emu/bus/msx_slot/panasonic08.c
@@ -69,7 +69,7 @@ void msx_slot_panasonic08_device::device_start()
m_sram.resize(0x4000);
- m_nvram->set_base((UINT8*)m_sram, 0x4000);
+ m_nvram->set_base(&m_sram[0], 0x4000);
m_rom = m_rom_region->base() + m_region_offset;
@@ -87,7 +87,7 @@ void msx_slot_panasonic08_device::map_bank(int bank)
if (m_selected_bank[bank] >= 0x80 && m_selected_bank[bank] < 0x84) // Are these banks were sram is present? Mirroring?
{
logerror("panasonic08: mapping bank %d to sram\n", bank);
- m_bank_base[bank] = m_sram + (((m_selected_bank[bank] & 0x7f) * 0x2000) & 0x3fff);
+ m_bank_base[bank] = &m_sram[((m_selected_bank[bank] & 0x7f) * 0x2000) & 0x3fff];
}
else
{
diff --git a/src/emu/bus/msx_slot/ram.h b/src/emu/bus/msx_slot/ram.h
index a861d0697b6..73cbfebdb62 100644
--- a/src/emu/bus/msx_slot/ram.h
+++ b/src/emu/bus/msx_slot/ram.h
@@ -24,7 +24,7 @@ public:
virtual DECLARE_WRITE8_MEMBER(write);
private:
- dynamic_array<UINT8> m_ram;
+ std::vector<UINT8> m_ram;
};
diff --git a/src/emu/bus/msx_slot/ram_mm.c b/src/emu/bus/msx_slot/ram_mm.c
index 2dc9c4c8e65..14ef2b0d29e 100644
--- a/src/emu/bus/msx_slot/ram_mm.c
+++ b/src/emu/bus/msx_slot/ram_mm.c
@@ -32,7 +32,7 @@ void msx_slot_ram_mm_device::device_start()
for ( int i = 0; i < 4; i++ )
{
m_bank_selected[i] = 3 -i;
- m_bank_base[i] = m_ram + 0x4000 * m_bank_selected[i];
+ m_bank_base[i] = &m_ram[0x4000 * m_bank_selected[i]];
}
save_item(NAME(m_ram));
@@ -50,7 +50,7 @@ void msx_slot_ram_mm_device::restore_banks()
{
for ( int i = 0; i < 3; i++ )
{
- m_bank_base[i] = m_ram + 0x4000 * ( m_bank_selected[i] & m_bank_mask );
+ m_bank_base[i] = &m_ram[0x4000 * ( m_bank_selected[i] & m_bank_mask )];
}
}
@@ -74,5 +74,5 @@ WRITE8_MEMBER(msx_slot_ram_mm_device::write_mapper_bank)
offset &= 3;
m_bank_selected[offset] = data;
- m_bank_base[offset] = m_ram + 0x4000 * ( m_bank_selected[offset] & m_bank_mask );
+ m_bank_base[offset] = &m_ram[0x4000 * ( m_bank_selected[offset] & m_bank_mask )];
}
diff --git a/src/emu/bus/msx_slot/ram_mm.h b/src/emu/bus/msx_slot/ram_mm.h
index 89399bc2608..52b09028159 100644
--- a/src/emu/bus/msx_slot/ram_mm.h
+++ b/src/emu/bus/msx_slot/ram_mm.h
@@ -30,7 +30,7 @@ public:
void restore_banks();
private:
- dynamic_array<UINT8> m_ram;
+ std::vector<UINT8> m_ram;
UINT32 m_total_size;
UINT8 m_bank_mask;
UINT8 m_bank_selected[4];
diff --git a/src/emu/bus/neogeo/bootleg_prot.c b/src/emu/bus/neogeo/bootleg_prot.c
index 67d344bdda9..24306d43520 100644
--- a/src/emu/bus/neogeo/bootleg_prot.c
+++ b/src/emu/bus/neogeo/bootleg_prot.c
@@ -54,7 +54,7 @@ void ngbootleg_prot_device::neogeo_bootleg_cx_decrypt(UINT8*sprrom, UINT32 sprro
UINT8 *rom = sprrom;
dynamic_buffer buf( cx_size );
- memcpy( buf, rom, cx_size );
+ memcpy( &buf[0], rom, cx_size );
for( i = 0; i < cx_size / 0x40; i++ ){
memcpy( &rom[ i * 0x40 ], &buf[ (i ^ 1) * 0x40 ], 0x40 );
@@ -71,7 +71,7 @@ void ngbootleg_prot_device::neogeo_bootleg_sx_decrypt(UINT8* fixed, UINT32 fixed
if (value == 1)
{
dynamic_buffer buf( sx_size );
- memcpy( buf, rom, sx_size );
+ memcpy( &buf[0], rom, sx_size );
for( i = 0; i < sx_size; i += 0x10 )
{
@@ -93,14 +93,14 @@ void ngbootleg_prot_device::neogeo_bootleg_sx_decrypt(UINT8* fixed, UINT32 fixed
void ngbootleg_prot_device::kof97oro_px_decode(UINT8* cpurom, UINT32 cpurom_size)
{
int i;
- dynamic_array<UINT16> tmp( 0x500000 );
+ std::vector<UINT16> tmp( 0x500000 );
UINT16 *src = (UINT16*)cpurom;
for (i = 0; i < 0x500000/2; i++) {
tmp[i] = src[i ^ 0x7ffef];
}
- memcpy (src, tmp, 0x500000);
+ memcpy (src, &tmp[0], 0x500000);
}
@@ -175,8 +175,8 @@ void ngbootleg_prot_device::decrypt_kof10th(UINT8* cpurom, UINT32 cpurom_size)
dynamic_buffer dst(0x900000);
UINT8 *src = cpurom;
- memcpy(dst + 0x000000, src + 0x700000, 0x100000); // Correct (Verified in Uni-bios)
- memcpy(dst + 0x100000, src + 0x000000, 0x800000);
+ memcpy(&dst[0x000000], src + 0x700000, 0x100000); // Correct (Verified in Uni-bios)
+ memcpy(&dst[0x100000], src + 0x000000, 0x800000);
for (i = 0; i < 0x900000; i++) {
j = BITSWAP24(i,23,22,21,20,19,18,17,16,15,14,13,12,11,2,9,8,7,1,5,4,3,10,6,0);
@@ -200,7 +200,7 @@ void ngbootleg_prot_device::decrypt_kof10th(UINT8* cpurom, UINT32 cpurom_size)
void ngbootleg_prot_device::kf10thep_px_decrypt(UINT8* cpurom, UINT32 cpurom_size)
{
UINT16 *rom = (UINT16*)cpurom;
- dynamic_array<UINT16> buf(0x100000/2);
+ std::vector<UINT16> buf(0x100000/2);
memcpy(&buf[0x000000/2], &rom[0x060000/2], 0x20000);
memcpy(&buf[0x020000/2], &rom[0x100000/2], 0x20000);
@@ -212,7 +212,7 @@ void ngbootleg_prot_device::kf10thep_px_decrypt(UINT8* cpurom, UINT32 cpurom_siz
memcpy(&buf[0x0e0000/2], &rom[0x1a0000/2], 0x20000);
memcpy(&buf[0x0002e0/2], &rom[0x0402e0/2], 0x6a); // copy banked code to a new memory region
memcpy(&buf[0x0f92bc/2], &rom[0x0492bc/2], 0xb9e); // copy banked code to a new memory region
- memcpy(rom, buf, 0x100000);
+ memcpy(rom, &buf[0], 0x100000);
for (int i = 0xf92bc/2; i < 0xf9e58/2; i++)
{
@@ -239,9 +239,9 @@ void ngbootleg_prot_device::kf2k5uni_px_decrypt(UINT8* cpurom, UINT32 cpurom_siz
for (j = 0; j < 0x80; j+=2)
{
ofst = BITSWAP8(j, 0, 3, 4, 5, 6, 1, 2, 7);
- memcpy(dst + j, src + i + ofst, 2);
+ memcpy(&dst[j], src + i + ofst, 2);
}
- memcpy(src + i, dst, 0x80);
+ memcpy(src + i, &dst[0], 0x80);
}
memcpy(src, src + 0x600000, 0x100000); // Seems to be the same as kof10th
@@ -295,13 +295,13 @@ void ngbootleg_prot_device::kof2002b_gfx_decrypt(UINT8 *src, int size)
for ( i = 0; i < size; i+=0x10000 )
{
- memcpy( dst, src+i, 0x10000 );
+ memcpy( &dst[0], src+i, 0x10000 );
for ( j = 0; j < 0x200; j++ )
{
int n = (j & 0x38) >> 3;
int ofst = BITSWAP16(j, 15, 14, 13, 12, 11, 10, 9, t[n][0], t[n][1], t[n][2], 5, 4, 3, t[n][3], t[n][4], t[n][5]);
- memcpy( src+i+ofst*128, dst+j*128, 128 );
+ memcpy( src+i+ofst*128, &dst[j*128], 128 );
}
}
}
@@ -339,11 +339,11 @@ void ngbootleg_prot_device::kf2k2mp2_px_decrypt(UINT8* cpurom, UINT32 cpurom_siz
UINT8 *src = cpurom;
dynamic_buffer dst(0x600000);
- memcpy (dst + 0x000000, src + 0x1C0000, 0x040000);
- memcpy (dst + 0x040000, src + 0x140000, 0x080000);
- memcpy (dst + 0x0C0000, src + 0x100000, 0x040000);
- memcpy (dst + 0x100000, src + 0x200000, 0x400000);
- memcpy (src + 0x000000, dst + 0x000000, 0x600000);
+ memcpy (&dst[0x000000], &src[0x1C0000], 0x040000);
+ memcpy (&dst[0x040000], &src[0x140000], 0x080000);
+ memcpy (&dst[0x0C0000], &src[0x100000], 0x040000);
+ memcpy (&dst[0x100000], &src[0x200000], 0x400000);
+ memcpy (&src[0x000000], &dst[0x000000], 0x600000);
}
@@ -366,9 +366,9 @@ void ngbootleg_prot_device::cthd2003_neogeo_gfx_address_fix_do(UINT8* sprrom, UI
+(((j&4)>>2)<<bit2shift)
+(((j&8)>>3)<<bit3shift);
- memcpy(rom+j*tilesize, realrom+offset*tilesize, tilesize);
+ memcpy(&rom[j*tilesize], realrom+offset*tilesize, tilesize);
}
- memcpy(realrom,rom,tilesize*16);
+ memcpy(realrom,&rom[0],tilesize*16);
realrom+=16*tilesize;
}
}
@@ -412,18 +412,18 @@ void ngbootleg_prot_device::decrypt_cthd2003(UINT8* sprrom, UINT32 sprrom_size,
UINT8 *romdata = fixedrom;
dynamic_buffer tmp(8*128*128);
- memcpy(tmp+8*0*128, romdata+8*0*128, 8*32*128);
- memcpy(tmp+8*32*128, romdata+8*64*128, 8*32*128);
- memcpy(tmp+8*64*128, romdata+8*32*128, 8*32*128);
- memcpy(tmp+8*96*128, romdata+8*96*128, 8*32*128);
- memcpy(romdata, tmp, 8*128*128);
+ memcpy(&tmp[8*0*128], romdata+8*0*128, 8*32*128);
+ memcpy(&tmp[8*32*128], romdata+8*64*128, 8*32*128);
+ memcpy(&tmp[8*64*128], romdata+8*32*128, 8*32*128);
+ memcpy(&tmp[8*96*128], romdata+8*96*128, 8*32*128);
+ memcpy(romdata, &tmp[0], 8*128*128);
romdata = audiorom+0x10000;
- memcpy(tmp+8*0*128, romdata+8*0*128, 8*32*128);
- memcpy(tmp+8*32*128, romdata+8*64*128, 8*32*128);
- memcpy(tmp+8*64*128, romdata+8*32*128, 8*32*128);
- memcpy(tmp+8*96*128, romdata+8*96*128, 8*32*128);
- memcpy(romdata, tmp, 8*128*128);
+ memcpy(&tmp[8*0*128], romdata+8*0*128, 8*32*128);
+ memcpy(&tmp[8*32*128], romdata+8*64*128, 8*32*128);
+ memcpy(&tmp[8*64*128], romdata+8*32*128, 8*32*128);
+ memcpy(&tmp[8*96*128], romdata+8*96*128, 8*32*128);
+ memcpy(romdata, &tmp[0], 8*128*128);
memcpy(romdata-0x10000,romdata,0x10000);
@@ -498,7 +498,7 @@ void ngbootleg_prot_device::ct2k3sp_sx_decrypt( UINT8* fixedrom, UINT32 fixedrom
int i;
int ofst;
- memcpy( buf, rom, rom_size );
+ memcpy( &buf[0], rom, rom_size );
for( i = 0; i < rom_size; i++ ){
ofst = BITSWAP24( (i & 0x1ffff), 23, 22, 21, 20, 19, 18, 17, 3,
@@ -510,7 +510,7 @@ void ngbootleg_prot_device::ct2k3sp_sx_decrypt( UINT8* fixedrom, UINT32 fixedrom
rom[ i ] = buf[ ofst ];
}
- memcpy( buf, rom, rom_size );
+ memcpy( &buf[0], rom, rom_size );
memcpy( &rom[ 0x08000 ], &buf[ 0x10000 ], 0x8000 );
memcpy( &rom[ 0x10000 ], &buf[ 0x08000 ], 0x8000 );
@@ -522,11 +522,11 @@ void ngbootleg_prot_device::decrypt_ct2k3sp(UINT8* sprrom, UINT32 sprrom_size, U
{
UINT8 *romdata = audiorom+0x10000;
dynamic_buffer tmp(8*128*128);
- memcpy(tmp+8*0*128, romdata+8*0*128, 8*32*128);
- memcpy(tmp+8*32*128, romdata+8*64*128, 8*32*128);
- memcpy(tmp+8*64*128, romdata+8*32*128, 8*32*128);
- memcpy(tmp+8*96*128, romdata+8*96*128, 8*32*128);
- memcpy(romdata, tmp, 8*128*128);
+ memcpy(&tmp[8*0*128], romdata+8*0*128, 8*32*128);
+ memcpy(&tmp[8*32*128], romdata+8*64*128, 8*32*128);
+ memcpy(&tmp[8*64*128], romdata+8*32*128, 8*32*128);
+ memcpy(&tmp[8*96*128], romdata+8*96*128, 8*32*128);
+ memcpy(romdata, &tmp[0], 8*128*128);
memcpy(romdata-0x10000,romdata,0x10000);
ct2k3sp_sx_decrypt(fixedrom, fixedrom_size);
@@ -541,11 +541,11 @@ void ngbootleg_prot_device::decrypt_ct2k3sa(UINT8* sprrom, UINT32 sprrom_size, U
{
UINT8 *romdata = audiorom+0x10000;
dynamic_buffer tmp(8*128*128);
- memcpy(tmp+8*0*128, romdata+8*0*128, 8*32*128);
- memcpy(tmp+8*32*128, romdata+8*64*128, 8*32*128);
- memcpy(tmp+8*64*128, romdata+8*32*128, 8*32*128);
- memcpy(tmp+8*96*128, romdata+8*96*128, 8*32*128);
- memcpy(romdata, tmp, 8*128*128);
+ memcpy(&tmp[8*0*128], romdata+8*0*128, 8*32*128);
+ memcpy(&tmp[8*32*128], romdata+8*64*128, 8*32*128);
+ memcpy(&tmp[8*64*128], romdata+8*32*128, 8*32*128);
+ memcpy(&tmp[8*96*128], romdata+8*96*128, 8*32*128);
+ memcpy(romdata, &tmp[0], 8*128*128);
memcpy(romdata-0x10000,romdata,0x10000);
cthd2003_c(sprrom,sprrom_size, 0);
@@ -600,11 +600,11 @@ void ngbootleg_prot_device::decrypt_kof2k4se_68k(UINT8* cpurom, UINT32 cpurom_si
dynamic_buffer dst(0x400000);
int i;
static const int sec[] = {0x300000,0x200000,0x100000,0x000000};
- memcpy(dst,src,0x400000);
+ memcpy(&dst[0],src,0x400000);
for(i = 0; i < 4; ++i)
{
- memcpy(src+i*0x100000,dst+sec[i],0x100000);
+ memcpy(src+i*0x100000,&dst[sec[i]],0x100000);
}
}
@@ -632,12 +632,12 @@ void ngbootleg_prot_device::lans2004_decrypt_68k(UINT8* cpurom, UINT32 cpurom_si
dynamic_buffer dst(0x600000);
for (i = 0; i < 8; i++)
- memcpy (dst + i * 0x20000, src + sec[i] * 0x20000, 0x20000);
+ memcpy (&dst[i * 0x20000], src + sec[i] * 0x20000, 0x20000);
- memcpy (dst + 0x0BBB00, src + 0x045B00, 0x001710);
- memcpy (dst + 0x02FFF0, src + 0x1A92BE, 0x000010);
- memcpy (dst + 0x100000, src + 0x200000, 0x400000);
- memcpy (src, dst, 0x600000);
+ memcpy (&dst[0x0BBB00], src + 0x045B00, 0x001710);
+ memcpy (&dst[0x02FFF0], src + 0x1A92BE, 0x000010);
+ memcpy (&dst[0x100000], src + 0x200000, 0x400000);
+ memcpy (src, &dst[0], 0x600000);
}
for (i = 0xBBB00/2; i < 0xBE000/2; i++) {
@@ -737,7 +737,7 @@ void ngbootleg_prot_device::svcboot_cx_decrypt(UINT8*sprrom, UINT32 sprrom_size)
UINT8 *src = sprrom;
dynamic_buffer dst( size );
int ofst;
- memcpy( dst, src, size );
+ memcpy( &dst[0], src, size );
for( i = 0; i < size / 0x80; i++ ){
int idx = idx_tbl[ (i & 0xf00) >> 8 ];
int bit0 = bitswap4_tbl[ idx ][ 0 ];
@@ -764,7 +764,7 @@ void ngbootleg_prot_device::svcplus_px_decrypt(UINT8* cpurom, UINT32 cpurom_size
dynamic_buffer dst( size );
int i;
int ofst;
- memcpy( dst, src, size );
+ memcpy( &dst[0], src, size );
for( i = 0; i < size / 2; i++ ){
ofst = BITSWAP24( (i & 0xfffff), 0x17, 0x16, 0x15, 0x14, 0x13, 0x00, 0x01, 0x02,
0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08,
@@ -773,7 +773,7 @@ void ngbootleg_prot_device::svcplus_px_decrypt(UINT8* cpurom, UINT32 cpurom_size
ofst += (i & 0xff00000);
memcpy( &src[ i * 0x02 ], &dst[ ofst * 0x02 ], 0x02 );
}
- memcpy( dst, src, size );
+ memcpy( &dst[0], src, size );
for( i = 0; i < 6; i++ ){
memcpy( &src[ i * 0x100000 ], &dst[ sec[ i ] * 0x100000 ], 0x100000 );
}
@@ -799,7 +799,7 @@ void ngbootleg_prot_device::svcplusa_px_decrypt(UINT8* cpurom, UINT32 cpurom_siz
int size = cpurom_size;
UINT8 *src = cpurom;
dynamic_buffer dst( size );
- memcpy( dst, src, size );
+ memcpy( &dst[0], src, size );
for( i = 0; i < 6; i++ ){
memcpy( &src[ i * 0x100000 ], &dst[ sec[ i ] * 0x100000 ], 0x100000 );
}
@@ -819,7 +819,7 @@ void ngbootleg_prot_device::svcsplus_px_decrypt(UINT8* cpurom, UINT32 cpurom_siz
dynamic_buffer dst( size );
int i;
int ofst;
- memcpy( dst, src, size );
+ memcpy( &dst[0], src, size );
for( i = 0; i < size / 2; i++ ){
ofst = BITSWAP16( (i & 0x007fff), 0x0f, 0x00, 0x08, 0x09, 0x0b, 0x0a, 0x0c, 0x0d,
0x04, 0x03, 0x01, 0x07, 0x06, 0x02, 0x05, 0x0e );
@@ -898,7 +898,7 @@ void ngbootleg_prot_device::kf2k3bl_px_decrypt(UINT8* cpurom, UINT32 cpurom_size
int rom_size = 0x800000;
UINT8 *rom = cpurom;
dynamic_buffer buf( rom_size );
- memcpy( buf, rom, rom_size );
+ memcpy( &buf[0], rom, rom_size );
for( i = 0; i < rom_size / 0x100000; i++ ){
memcpy( &rom[ i * 0x100000 ], &buf[ sec[ i ] * 0x100000 ], 0x100000 );
@@ -922,14 +922,14 @@ void ngbootleg_prot_device::kf2k3bl_install_protection(cpu_device* maincpu, neog
void ngbootleg_prot_device::kf2k3pl_px_decrypt(UINT8* cpurom, UINT32 cpurom_size)
{
- dynamic_array<UINT16> tmp(0x100000/2);
+ std::vector<UINT16> tmp(0x100000/2);
UINT16*rom16 = (UINT16*)cpurom;
int j;
int i;
for (i = 0;i < 0x700000/2;i+=0x100000/2)
{
- memcpy(tmp,&rom16[i],0x100000);
+ memcpy(&tmp[0],&rom16[i],0x100000);
for (j = 0;j < 0x100000/2;j++)
rom16[i+j] = tmp[BITSWAP24(j,23,22,21,20,19,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18)];
}
@@ -989,7 +989,7 @@ void ngbootleg_prot_device::samsho5b_px_decrypt(UINT8* cpurom, UINT32 cpurom_siz
int ofst;
int i;
- memcpy( buf, rom, px_size );
+ memcpy( &buf[0], rom, px_size );
for( i = 0; i < px_size / 2; i++ ){
ofst = BITSWAP8( (i & 0x000ff), 7, 6, 5, 4, 3, 0, 1, 2 );
@@ -999,7 +999,7 @@ void ngbootleg_prot_device::samsho5b_px_decrypt(UINT8* cpurom, UINT32 cpurom_siz
memcpy( &rom[ i * 2 ], &buf[ ofst * 2 ], 0x02 );
}
- memcpy( buf, rom, px_size );
+ memcpy( &buf[0], rom, px_size );
memcpy( &rom[ 0x000000 ], &buf[ 0x700000 ], 0x100000 );
memcpy( &rom[ 0x100000 ], &buf[ 0x000000 ], 0x700000 );
@@ -1028,7 +1028,7 @@ void ngbootleg_prot_device::matrimbl_decrypt(UINT8* sprrom, UINT32 sprrom_size,
UINT8 *rom = audiorom+0x10000;
dynamic_buffer buf( 0x20000 );
int i, j=0;
- memcpy( buf, rom, 0x20000 );
+ memcpy( &buf[0], rom, 0x20000 );
for( i=0x00000; i<0x20000; i++ )
{
if ( i&0x10000 )
diff --git a/src/emu/bus/neogeo/cmc_prot.c b/src/emu/bus/neogeo/cmc_prot.c
index b56c03ed491..e390d865473 100644
--- a/src/emu/bus/neogeo/cmc_prot.c
+++ b/src/emu/bus/neogeo/cmc_prot.c
@@ -504,8 +504,8 @@ void cmc_prot_device::neogeo_gfx_decrypt(UINT8* rom, UINT32 rom_size, int extra_
// Data xor
for (rpos = 0;rpos < rom_size/4;rpos++)
{
- decrypt(buf+4*rpos+0, buf+4*rpos+3, rom[4*rpos+0], rom[4*rpos+3], type0_t03, type0_t12, type1_t03, rpos, (rpos>>8) & 1);
- decrypt(buf+4*rpos+1, buf+4*rpos+2, rom[4*rpos+1], rom[4*rpos+2], type0_t12, type0_t03, type1_t12, rpos, ((rpos>>16) ^ address_16_23_xor2[(rpos>>8) & 0xff]) & 1);
+ decrypt(&buf[4*rpos+0], &buf[4*rpos+3], rom[4*rpos+0], rom[4*rpos+3], type0_t03, type0_t12, type1_t03, rpos, (rpos>>8) & 1);
+ decrypt(&buf[4*rpos+1], &buf[4*rpos+2], rom[4*rpos+1], rom[4*rpos+2], type0_t12, type0_t03, type1_t12, rpos, ((rpos>>16) ^ address_16_23_xor2[(rpos>>8) & 0xff]) & 1);
}
// Address xor
@@ -747,7 +747,7 @@ void cmc_prot_device::neogeo_cmc50_m1_decrypt(UINT8* romcrypt, UINT32 romcrypt_s
buffer[i] = rom[m1_address_scramble(i,key)];
}
- memcpy(rom,buffer,rom_size);
+ memcpy(rom,&buffer[0],rom_size);
memcpy(rom2,rom,0x10000);
memcpy(rom2+0x10000,rom,0x80000);
diff --git a/src/emu/bus/neogeo/kof2002_prot.c b/src/emu/bus/neogeo/kof2002_prot.c
index f236439d889..0f6749e0c0e 100644
--- a/src/emu/bus/neogeo/kof2002_prot.c
+++ b/src/emu/bus/neogeo/kof2002_prot.c
@@ -29,10 +29,10 @@ void kof2002_prot_device::kof2002_decrypt_68k(UINT8* cpurom, UINT32 cpurom_size)
static const int sec[]={0x100000,0x280000,0x300000,0x180000,0x000000,0x380000,0x200000,0x080000};
UINT8 *src = cpurom+0x100000;
dynamic_buffer dst(0x400000);
- memcpy( dst, src, 0x400000 );
+ memcpy( &dst[0], src, 0x400000 );
for( i=0; i<8; ++i )
{
- memcpy( src+i*0x80000, dst+sec[i], 0x80000 );
+ memcpy( src+i*0x80000, &dst[sec[i]], 0x80000 );
}
}
@@ -43,10 +43,10 @@ void kof2002_prot_device::matrim_decrypt_68k(UINT8* cpurom, UINT32 cpurom_size)
static const int sec[]={0x100000,0x280000,0x300000,0x180000,0x000000,0x380000,0x200000,0x080000};
UINT8 *src = cpurom+0x100000;
dynamic_buffer dst(0x400000);
- memcpy( dst, src, 0x400000);
+ memcpy( &dst[0], src, 0x400000);
for( i=0; i<8; ++i )
{
- memcpy( src+i*0x80000, dst+sec[i], 0x80000 );
+ memcpy( src+i*0x80000, &dst[sec[i]], 0x80000 );
}
}
@@ -58,10 +58,10 @@ void kof2002_prot_device::samsho5_decrypt_68k(UINT8* cpurom, UINT32 cpurom_size)
UINT8 *src = cpurom;
dynamic_buffer dst(0x800000);
- memcpy( dst, src, 0x800000 );
+ memcpy( &dst[0], src, 0x800000 );
for( i=0; i<16; ++i )
{
- memcpy( src+i*0x80000, dst+sec[i], 0x80000 );
+ memcpy( src+i*0x80000, &dst[sec[i]], 0x80000 );
}
}
@@ -73,9 +73,9 @@ void kof2002_prot_device::samsh5sp_decrypt_68k(UINT8* cpurom, UINT32 cpurom_size
UINT8 *src = cpurom;
dynamic_buffer dst(0x800000);
- memcpy( dst, src, 0x800000 );
+ memcpy( &dst[0], src, 0x800000 );
for( i=0; i<16; ++i )
{
- memcpy( src+i*0x80000, dst+sec[i], 0x80000 );
+ memcpy( src+i*0x80000, &dst[sec[i]], 0x80000 );
}
}
diff --git a/src/emu/bus/neogeo/kof98_prot.c b/src/emu/bus/neogeo/kof98_prot.c
index 8fbb2538969..c6b1ecb72bf 100644
--- a/src/emu/bus/neogeo/kof98_prot.c
+++ b/src/emu/bus/neogeo/kof98_prot.c
@@ -33,7 +33,7 @@ void kof98_prot_device::kof98_decrypt_68k(UINT8* cpurom, UINT32 cpurom_size)
static const UINT32 sec[]={0x000000,0x100000,0x000004,0x100004,0x10000a,0x00000a,0x10000e,0x00000e};
static const UINT32 pos[]={0x000,0x004,0x00a,0x00e};
- memcpy( dst, src, 0x200000);
+ memcpy( &dst[0], src, 0x200000);
for( i=0x800; i<0x100000; i+=0x200 )
{
for( j=0; j<0x100; j+=0x10 )
diff --git a/src/emu/bus/neogeo/kog_prot.c b/src/emu/bus/neogeo/kog_prot.c
index e33b932374d..54de00b4ea5 100644
--- a/src/emu/bus/neogeo/kog_prot.c
+++ b/src/emu/bus/neogeo/kog_prot.c
@@ -49,15 +49,15 @@ void kog_prot_device::kog_px_decrypt(UINT8* cpurom, UINT32 cpurom_size)
static const int sec[] = { 0x3, 0x8, 0x7, 0xC, 0x1, 0xA, 0x6, 0xD };
for (i = 0; i < 8; i++){
- memcpy (dst + i * 0x20000, src + sec[i] * 0x20000, 0x20000);
+ memcpy (&dst[i * 0x20000], src + sec[i] * 0x20000, 0x20000);
}
- memcpy (dst + 0x0007A6, src + 0x0407A6, 0x000006);
- memcpy (dst + 0x0007C6, src + 0x0407C6, 0x000006);
- memcpy (dst + 0x0007E6, src + 0x0407E6, 0x000006);
- memcpy (dst + 0x090000, src + 0x040000, 0x004000);
- memcpy (dst + 0x100000, src + 0x200000, 0x400000);
- memcpy (src, dst, 0x600000);
+ memcpy (&dst[0x0007A6], src + 0x0407A6, 0x000006);
+ memcpy (&dst[0x0007C6], src + 0x0407C6, 0x000006);
+ memcpy (&dst[0x0007E6], src + 0x0407E6, 0x000006);
+ memcpy (&dst[0x090000], src + 0x040000, 0x004000);
+ memcpy (&dst[0x100000], src + 0x200000, 0x400000);
+ memcpy (src, &dst[0], 0x600000);
for (i = 0x90000/2; i < 0x94000/2; i++){
if (((rom[i]&0xFFBF) == 0x4EB9 || rom[i] == 0x43F9) && !rom[i + 1])
diff --git a/src/emu/bus/neogeo/neogeo_helper.c b/src/emu/bus/neogeo/neogeo_helper.c
index 2be8007af04..b31927cfee8 100644
--- a/src/emu/bus/neogeo/neogeo_helper.c
+++ b/src/emu/bus/neogeo/neogeo_helper.c
@@ -23,7 +23,7 @@ static UINT32 get_region_mask(UINT8* rgn, UINT32 rgn_size)
return mask;
}
-UINT32 neogeohelper_optimize_sprite_data(dynamic_array<UINT8> &spritegfx, UINT8* region_sprites, UINT32 region_sprites_size)
+UINT32 neogeohelper_optimize_sprite_data(std::vector<UINT8> &spritegfx, UINT8* region_sprites, UINT32 region_sprites_size)
{
/* convert the sprite graphics data into a format that
allows faster blitting */
@@ -36,7 +36,7 @@ UINT32 neogeohelper_optimize_sprite_data(dynamic_array<UINT8> &spritegfx, UINT8*
UINT32 spritegfx_address_mask = mask;
src = region_sprites;
- dest = spritegfx;
+ dest = &spritegfx[0];
for (unsigned i = 0; i < region_sprites_size; i += 0x80, src += 0x80)
{
diff --git a/src/emu/bus/neogeo/neogeo_helper.h b/src/emu/bus/neogeo/neogeo_helper.h
index 77da4f00230..6d6701f3bb5 100644
--- a/src/emu/bus/neogeo/neogeo_helper.h
+++ b/src/emu/bus/neogeo/neogeo_helper.h
@@ -1,2 +1,2 @@
-extern UINT32 neogeohelper_optimize_sprite_data(dynamic_array<UINT8> &spritegfx, UINT8* region_sprites, UINT32 region_sprites_size);
+extern UINT32 neogeohelper_optimize_sprite_data(std::vector<UINT8> &spritegfx, UINT8* region_sprites, UINT32 region_sprites_size);
diff --git a/src/emu/bus/neogeo/neogeo_intf.h b/src/emu/bus/neogeo/neogeo_intf.h
index 07c60c12c54..eac0f4f5f3c 100644
--- a/src/emu/bus/neogeo/neogeo_intf.h
+++ b/src/emu/bus/neogeo/neogeo_intf.h
@@ -23,44 +23,44 @@ public:
virtual void decrypt_all(DECRYPT_ALL_PARAMS) { };
virtual int get_fixed_bank_type(void) { return 0; }
- void rom_alloc(UINT32 size) { if (m_rom == NULL) m_rom.resize(size/sizeof(UINT16)); }
- UINT16* get_rom_base() { return m_rom; }
- UINT32 get_rom_size() { return m_rom.bytes(); }
-
- void fixed_alloc(UINT32 size) { if (m_fixed == NULL) m_fixed.resize(size/sizeof(UINT8)); }
- UINT8* get_fixed_base() { return m_fixed; }
- UINT32 get_fixed_size() { return m_fixed.bytes(); }
-
- void audio_alloc(UINT32 size) { if (m_audio == NULL) m_audio.resize(size/sizeof(UINT8)); }
- UINT8* get_audio_base() { return m_audio; }
- UINT32 get_audio_size() { return m_audio.bytes(); }
-
- void audiocrypt_alloc(UINT32 size) { if (m_audiocrypt == NULL) m_audiocrypt.resize(size/sizeof(UINT8)); }
- UINT8* get_audiocrypt_base() { return m_audiocrypt; }
- UINT32 get_audiocrypt_size() { return m_audiocrypt.bytes(); }
-
- void sprites_alloc(UINT32 size) { if (m_sprites == NULL) m_sprites.resize(size/sizeof(UINT8)); }
- UINT8* get_sprites_base() { return m_sprites; }
- UINT32 get_sprites_size() { return m_sprites.bytes(); }
- UINT8* get_sprites_optimized() { return m_sprites_optimized; }
+ void rom_alloc(UINT32 size) { m_rom.resize(size/sizeof(UINT16)); }
+ UINT16* get_rom_base() { return &m_rom[0]; }
+ UINT32 get_rom_size() { return m_rom.size()*sizeof(UINT16); }
+
+ void fixed_alloc(UINT32 size) { m_fixed.resize(size); }
+ UINT8* get_fixed_base() { return &m_fixed[0]; }
+ UINT32 get_fixed_size() { return m_fixed.size(); }
+
+ void audio_alloc(UINT32 size) { m_audio.resize(size); }
+ UINT8* get_audio_base() { return &m_audio[0]; }
+ UINT32 get_audio_size() { return m_audio.size(); }
+
+ void audiocrypt_alloc(UINT32 size) { m_audiocrypt.resize(size); }
+ UINT8* get_audiocrypt_base() { return &m_audiocrypt[0]; }
+ UINT32 get_audiocrypt_size() { return m_audiocrypt.size(); }
+
+ void sprites_alloc(UINT32 size) { m_sprites.resize(size); }
+ UINT8* get_sprites_base() { return &m_sprites[0]; }
+ UINT32 get_sprites_size() { return m_sprites.size(); }
+ UINT8* get_sprites_optimized() { return &m_sprites_optimized[0]; }
UINT32 get_sprites_addrmask() { return m_sprite_gfx_address_mask; }
- dynamic_array<UINT8>& get_sprites_optimized_arr() { return m_sprites_optimized; }
+ std::vector<UINT8>& get_sprites_optimized_arr() { return m_sprites_optimized; }
- void ym_alloc(UINT32 size) { if (m_ym == NULL) m_ym.resize(size/sizeof(UINT8)); }
- UINT8* get_ym_base() { return m_ym; }
- UINT32 get_ym_size() { return m_ym.bytes(); }
+ void ym_alloc(UINT32 size) { m_ym.resize(size); }
+ UINT8* get_ym_base() { return &m_ym[0]; }
+ UINT32 get_ym_size() { return m_ym.size(); }
- void ymdelta_alloc(UINT32 size) { if (m_ymdelta == NULL) m_ymdelta.resize(size/sizeof(UINT8)); }
- UINT8* get_ymdelta_base() { return m_ymdelta; }
- UINT32 get_ymdelta_size() { return m_ymdelta.bytes(); }
+ void ymdelta_alloc(UINT32 size) { m_ymdelta.resize(size); }
+ UINT8* get_ymdelta_base() { return &m_ymdelta[0]; }
+ UINT32 get_ymdelta_size() { return m_ymdelta.size(); }
- dynamic_array<UINT16> m_rom;
- dynamic_array<UINT8> m_fixed;
- dynamic_array<UINT8> m_sprites;
- dynamic_array<UINT8> m_sprites_optimized;
- dynamic_array<UINT8> m_audio;
- dynamic_array<UINT8> m_ym;
- dynamic_array<UINT8> m_ymdelta;
+ std::vector<UINT16> m_rom;
+ std::vector<UINT8> m_fixed;
+ std::vector<UINT8> m_sprites;
+ std::vector<UINT8> m_sprites_optimized;
+ std::vector<UINT8> m_audio;
+ std::vector<UINT8> m_ym;
+ std::vector<UINT8> m_ymdelta;
UINT32 m_sprite_gfx_address_mask;
@@ -68,7 +68,7 @@ public:
protected:
// internal state
- dynamic_array<UINT8> m_audiocrypt;
+ std::vector<UINT8> m_audiocrypt;
};
diff --git a/src/emu/bus/neogeo/neogeo_slot.h b/src/emu/bus/neogeo/neogeo_slot.h
index 2fe4523623e..8104ca9bc09 100644
--- a/src/emu/bus/neogeo/neogeo_slot.h
+++ b/src/emu/bus/neogeo/neogeo_slot.h
@@ -45,9 +45,9 @@ public:
virtual DECLARE_READ16_MEMBER(read_rom);
UINT16* get_rom_base() { if (m_cart) { return m_cart->get_rom_base(); } else { return 0; } }
- UINT32 get_rom_size() { if (m_cart) { return m_cart->m_rom.bytes(); } else { return 0; } }
+ UINT32 get_rom_size() { if (m_cart) { return m_cart->get_rom_size()*sizeof(UINT16); } else { return 0; } }
UINT8* get_fixed_base() { if (m_cart) { return m_cart->get_fixed_base(); } else { return 0; } }
- UINT32 get_fixed_size() { if (m_cart) { return m_cart->m_fixed.bytes(); } else { return 0; } }
+ UINT32 get_fixed_size() { if (m_cart) { return m_cart->get_fixed_size(); } else { return 0; } }
UINT8* get_sprites_base() { if (m_cart) { return m_cart->get_sprites_base(); } else { return 0; } }
UINT32 get_sprites_size() { if (m_cart) { return m_cart->get_sprites_size(); } else { return 0; } }
UINT8* get_sprites_optimized() { if (m_cart) { return m_cart->get_sprites_optimized(); } else { return 0; } }
diff --git a/src/emu/bus/neogeo/pcm2_prot.c b/src/emu/bus/neogeo/pcm2_prot.c
index d14ac3c5791..309b75d81a9 100644
--- a/src/emu/bus/neogeo/pcm2_prot.c
+++ b/src/emu/bus/neogeo/pcm2_prot.c
@@ -38,11 +38,11 @@ void pcm2_prot_device::neo_pcm2_snk_1999(UINT8* ymrom, UINT32 ymsize, int value)
if( rom != NULL )
{ /* swap address lines on the whole ROMs */
- dynamic_array<UINT16> buffer(value / 2);
+ std::vector<UINT16> buffer(value / 2);
for( i = 0; i < size / 2; i += ( value / 2 ) )
{
- memcpy( buffer, &rom[ i ], value );
+ memcpy( &buffer[0], &rom[ i ], value );
for( j = 0; j < (value / 2); j++ )
{
rom[ i + j ] = buffer[ j ^ (value/4) ];
@@ -75,7 +75,7 @@ void pcm2_prot_device::neo_pcm2_swap(UINT8* ymrom, UINT32 ymsize, int value)
dynamic_buffer buf(0x1000000);
int i, j, d;
UINT8* src = ymrom;
- memcpy(buf,src,0x1000000);
+ memcpy(&buf[0],src,0x1000000);
for (i=0;i<0x1000000;i++)
{
j=BITSWAP24(i,23,22,21,20,19,18,17,0,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,16);
diff --git a/src/emu/bus/neogeo/pvc_prot.c b/src/emu/bus/neogeo/pvc_prot.c
index 8ea32050908..728b50bca9f 100644
--- a/src/emu/bus/neogeo/pvc_prot.c
+++ b/src/emu/bus/neogeo/pvc_prot.c
@@ -124,7 +124,7 @@ void pvc_prot_device::mslug5_decrypt_68k(UINT8* rom, UINT32 size)
rom[BYTE_XOR_LE(i+1)] = rom16&0xff;
rom[BYTE_XOR_LE(i+2)] = rom16>>8;
}
- memcpy( buf, rom, rom_size );
+ memcpy( &buf[0], rom, rom_size );
for( i = 0; i < 0x0100000 / 0x10000; i++ )
{
ofst = (i & 0xf0) + BITSWAP8( (i & 0x0f), 7, 6, 5, 4, 1, 0, 3, 2 );
@@ -135,7 +135,7 @@ void pvc_prot_device::mslug5_decrypt_68k(UINT8* rom, UINT32 size)
ofst = (i & 0xf000ff) + ((i & 0x000f00) ^ 0x00700) + (BITSWAP8( ((i & 0x0ff000) >> 12), 5, 4, 7, 6, 1, 0, 3, 2 ) << 12);
memcpy( &rom[ i ], &buf[ ofst ], 0x100 );
}
- memcpy( buf, rom, rom_size );
+ memcpy( &buf[0], rom, rom_size );
memcpy( &rom[ 0x100000 ], &buf[ 0x700000 ], 0x100000 );
memcpy( &rom[ 0x200000 ], &buf[ 0x100000 ], 0x600000 );
}
@@ -167,7 +167,7 @@ void pvc_prot_device::svc_px_decrypt(UINT8* rom, UINT32 size)
rom[BYTE_XOR_LE(i+1)] = rom16&0xff;
rom[BYTE_XOR_LE(i+2)] = rom16>>8;
}
- memcpy( buf, rom, rom_size );
+ memcpy( &buf[0], rom, rom_size );
for( i = 0; i < 0x0100000 / 0x10000; i++ )
{
ofst = (i & 0xf0) + BITSWAP8( (i & 0x0f), 7, 6, 5, 4, 2, 3, 0, 1 );
@@ -178,7 +178,7 @@ void pvc_prot_device::svc_px_decrypt(UINT8* rom, UINT32 size)
ofst = (i & 0xf000ff) + ((i & 0x000f00) ^ 0x00a00) + (BITSWAP8( ((i & 0x0ff000) >> 12), 4, 5, 6, 7, 1, 0, 3, 2 ) << 12);
memcpy( &rom[ i ], &buf[ ofst ], 0x100 );
}
- memcpy( buf, rom, rom_size );
+ memcpy( &buf[0], rom, rom_size );
memcpy( &rom[ 0x100000 ], &buf[ 0x700000 ], 0x100000 );
memcpy( &rom[ 0x200000 ], &buf[ 0x100000 ], 0x600000 );
}
diff --git a/src/emu/bus/nes/aladdin.c b/src/emu/bus/nes/aladdin.c
index 210dcfb6c27..1c6b97219eb 100644
--- a/src/emu/bus/nes/aladdin.c
+++ b/src/emu/bus/nes/aladdin.c
@@ -150,7 +150,7 @@ void nes_aladdin_slot_device::get_default_card_software(astring &result)
dynamic_buffer rom(len);
UINT8 mapper;
- core_fread(m_file, rom, len);
+ core_fread(m_file, &rom[0], len);
mapper = (rom[6] & 0xf0) >> 4;
mapper |= rom[7] & 0xf0;
diff --git a/src/emu/bus/nes/bandai.c b/src/emu/bus/nes/bandai.c
index e8ab8609aba..758dcfd037e 100644
--- a/src/emu/bus/nes/bandai.c
+++ b/src/emu/bus/nes/bandai.c
@@ -355,9 +355,9 @@ WRITE8_MEMBER(nes_fcg_device::write_m)
{
LOG_MMC(("lz93d50 write_m, offset: %04x, data: %02x\n", offset, data));
- if (!m_battery && !m_prgram)
+ if (m_battery.empty() && m_prgram.empty())
fcg_write(space, offset & 0x0f, data, mem_mask);
- else if (m_battery)
+ else if (!m_battery.empty())
m_battery[offset] = data;
else
m_prgram[offset] = data;
@@ -447,13 +447,13 @@ void nes_fjump2_device::set_prg()
READ8_MEMBER(nes_fjump2_device::read_m)
{
LOG_MMC(("fjump2 read_m, offset: %04x\n", offset));
- return m_battery[offset & (m_battery.count() - 1)];
+ return m_battery[offset & (m_battery.size() - 1)];
}
WRITE8_MEMBER(nes_fjump2_device::write_m)
{
LOG_MMC(("fjump2 write_m, offset: %04x, data: %02x\n", offset, data));
- m_battery[offset & (m_battery.count() - 1)] = data;
+ m_battery[offset & (m_battery.size() - 1)] = data;
}
WRITE8_MEMBER(nes_fjump2_device::write_h)
diff --git a/src/emu/bus/nes/bootleg.c b/src/emu/bus/nes/bootleg.c
index c5156af394d..2d85f78ac87 100644
--- a/src/emu/bus/nes/bootleg.c
+++ b/src/emu/bus/nes/bootleg.c
@@ -1537,7 +1537,7 @@ READ8_MEMBER(nes_mmalee_device::read_m)
if (offset < 0x0800)
return m_prg[0x8000 + offset];
- else if (m_prgram && offset >= 0x1000 && offset < 0x1800) // WRAM only in these 2K
+ else if (!m_prgram.empty() && offset >= 0x1000 && offset < 0x1800) // WRAM only in these 2K
return m_prgram[offset & 0x7ff];
return ((offset + 0x6000) & 0xff00) >> 8;
@@ -1547,7 +1547,7 @@ WRITE8_MEMBER(nes_mmalee_device::write_m)
{
LOG_MMC(("mmalee write_m, offset: %04x, data: %02x\n", offset, data));
- if (m_prgram && offset >= 0x1000 && offset < 0x1800) // WRAM only in these 2K
+ if (!m_prgram.empty() && offset >= 0x1000 && offset < 0x1800) // WRAM only in these 2K
m_prgram[offset & 0x7ff] = data;
}
diff --git a/src/emu/bus/nes/konami.c b/src/emu/bus/nes/konami.c
index dc0f17b8b47..993717b06e4 100644
--- a/src/emu/bus/nes/konami.c
+++ b/src/emu/bus/nes/konami.c
@@ -288,10 +288,10 @@ READ8_MEMBER(nes_konami_vrc2_device::read_m)
{
LOG_MMC(("VRC-2 read_m, offset: %04x\n", offset));
- if (m_battery)
- return m_battery[offset & (m_battery.count() - 1)];
- else if (m_prgram)
- return m_prgram[offset & (m_prgram.count() - 1)];
+ if (!m_battery.empty())
+ return m_battery[offset & (m_battery.size() - 1)];
+ else if (!m_prgram.empty())
+ return m_prgram[offset & (m_prgram.size() - 1)];
else // sort of protection? it returns open bus in $7000-$7fff and (open bus & 0xfe) | m_latch in $6000-$6fff
return (offset < 0x1000) ? ((m_open_bus & 0xfe) | (m_latch & 1)) : m_open_bus;
}
@@ -300,10 +300,10 @@ WRITE8_MEMBER(nes_konami_vrc2_device::write_m)
{
LOG_MMC(("VRC-2 write_m, offset: %04x, data: %02x\n", offset, data));
- if (m_battery)
- m_battery[offset & (m_battery.count() - 1)] = data;
- else if (m_prgram)
- m_prgram[offset & (m_prgram.count() - 1)] = data;
+ if (!m_battery.empty())
+ m_battery[offset & (m_battery.size() - 1)] = data;
+ else if (!m_prgram.empty())
+ m_prgram[offset & (m_prgram.size() - 1)] = data;
else if (offset < 0x1000)
m_latch = data;
}
diff --git a/src/emu/bus/nes/mmc1.c b/src/emu/bus/nes/mmc1.c
index 104e416d9bd..ad3e0175e16 100644
--- a/src/emu/bus/nes/mmc1.c
+++ b/src/emu/bus/nes/mmc1.c
@@ -273,10 +273,10 @@ WRITE8_MEMBER(nes_sxrom_device::write_m)
if (!BIT(m_reg[3], 4)) // WRAM enabled
{
- if (m_battery)
- m_battery[((bank * 0x2000) + offset) & (m_battery.count() - 1)] = data;
- if (m_prgram)
- m_prgram[((bank * 0x2000) + offset) & (m_prgram.count() - 1)] = data;
+ if (!m_battery.empty())
+ m_battery[((bank * 0x2000) + offset) & (m_battery.size() - 1)] = data;
+ if (!m_prgram.empty())
+ m_prgram[((bank * 0x2000) + offset) & (m_prgram.size() - 1)] = data;
}
}
@@ -287,10 +287,10 @@ READ8_MEMBER(nes_sxrom_device::read_m)
if (!BIT(m_reg[3], 4)) // WRAM enabled
{
- if (m_battery)
- return m_battery[((bank * 0x2000) + offset) & (m_battery.count() - 1)];
- if (m_prgram)
- return m_prgram[((bank * 0x2000) + offset) & (m_prgram.count() - 1)];
+ if (!m_battery.empty())
+ return m_battery[((bank * 0x2000) + offset) & (m_battery.size() - 1)];
+ if (!m_prgram.empty())
+ return m_prgram[((bank * 0x2000) + offset) & (m_prgram.size() - 1)];
}
return m_open_bus; // open bus
@@ -305,9 +305,9 @@ WRITE8_MEMBER(nes_sorom_device::write_m)
if (!BIT(m_reg[3], 4)) // WRAM enabled
{
if (type)
- m_battery[offset & (m_battery.count() - 1)] = data;
+ m_battery[offset & (m_battery.size() - 1)] = data;
else
- m_prgram[offset & (m_prgram.count() - 1)] = data;
+ m_prgram[offset & (m_prgram.size() - 1)] = data;
}
}
@@ -319,9 +319,9 @@ READ8_MEMBER(nes_sorom_device::read_m)
if (!BIT(m_reg[3], 4)) // WRAM enabled
{
if (type)
- return m_battery[offset & (m_battery.count() - 1)];
+ return m_battery[offset & (m_battery.size() - 1)];
else
- return m_prgram[offset & (m_prgram.count() - 1)];
+ return m_prgram[offset & (m_prgram.size() - 1)];
}
return m_open_bus; // open bus
@@ -333,10 +333,10 @@ WRITE8_MEMBER(nes_sxrom_a_device::write_m)
UINT8 bank = (m_reg[1] >> 2) & 3;
LOG_MMC(("sxrom_a write_m, offset: %04x, data: %02x\n", offset, data));
- if (m_battery)
- m_battery[((bank * 0x2000) + offset) & (m_battery.count() - 1)] = data;
- if (m_prgram)
- m_prgram[((bank * 0x2000) + offset) & (m_prgram.count() - 1)] = data;
+ if (!m_battery.empty())
+ m_battery[((bank * 0x2000) + offset) & (m_battery.size() - 1)] = data;
+ if (!m_prgram.empty())
+ m_prgram[((bank * 0x2000) + offset) & (m_prgram.size() - 1)] = data;
}
READ8_MEMBER(nes_sxrom_a_device::read_m)
@@ -344,10 +344,10 @@ READ8_MEMBER(nes_sxrom_a_device::read_m)
UINT8 bank = (m_reg[1] >> 2) & 3;
LOG_MMC(("sxrom_a read_m, offset: %04x\n", offset));
- if (m_battery)
- return m_battery[((bank * 0x2000) + offset) & (m_battery.count() - 1)];
- if (m_prgram)
- return m_prgram[((bank * 0x2000) + offset) & (m_prgram.count() - 1)];
+ if (!m_battery.empty())
+ return m_battery[((bank * 0x2000) + offset) & (m_battery.size() - 1)];
+ if (!m_prgram.empty())
+ return m_prgram[((bank * 0x2000) + offset) & (m_prgram.size() - 1)];
return m_open_bus; // open bus
}
@@ -358,9 +358,9 @@ WRITE8_MEMBER(nes_sorom_a_device::write_m)
LOG_MMC(("sorom_a write_m, offset: %04x, data: %02x\n", offset, data));
if (type)
- m_battery[offset & (m_battery.count() - 1)] = data;
+ m_battery[offset & (m_battery.size() - 1)] = data;
else
- m_prgram[offset & (m_prgram.count() - 1)] = data;
+ m_prgram[offset & (m_prgram.size() - 1)] = data;
}
READ8_MEMBER(nes_sorom_a_device::read_m)
@@ -369,7 +369,7 @@ READ8_MEMBER(nes_sorom_a_device::read_m)
LOG_MMC(("sorom_a read_m, offset: %04x\n", offset));
if (type)
- return m_battery[offset & (m_battery.count() - 1)];
+ return m_battery[offset & (m_battery.size() - 1)];
else
- return m_prgram[offset & (m_prgram.count() - 1)];
+ return m_prgram[offset & (m_prgram.size() - 1)];
}
diff --git a/src/emu/bus/nes/mmc3.c b/src/emu/bus/nes/mmc3.c
index 09bdf499124..aee892535bb 100644
--- a/src/emu/bus/nes/mmc3.c
+++ b/src/emu/bus/nes/mmc3.c
@@ -320,10 +320,10 @@ WRITE8_MEMBER(nes_txrom_device::write_m)
if (BIT(m_wram_protect, 7) && !BIT(m_wram_protect, 6))
{
- if (m_battery)
- m_battery[offset & (m_battery.count() - 1)] = data;
- if (m_prgram)
- m_prgram[offset & (m_prgram.count() - 1)] = data;
+ if (!m_battery.empty())
+ m_battery[offset & (m_battery.size() - 1)] = data;
+ if (!m_prgram.empty())
+ m_prgram[offset & (m_prgram.size() - 1)] = data;
}
}
@@ -333,10 +333,10 @@ READ8_MEMBER(nes_txrom_device::read_m)
if (BIT(m_wram_protect, 7))
{
- if (m_battery)
- return m_battery[offset & (m_battery.count() - 1)];
- if (m_prgram)
- return m_prgram[offset & (m_prgram.count() - 1)];
+ if (!m_battery.empty())
+ return m_battery[offset & (m_battery.size() - 1)];
+ if (!m_prgram.empty())
+ return m_prgram[offset & (m_prgram.size() - 1)];
}
return m_open_bus; // open bus
diff --git a/src/emu/bus/nes/mmc3_clones.c b/src/emu/bus/nes/mmc3_clones.c
index 777c8e5a268..ef75d45c329 100644
--- a/src/emu/bus/nes/mmc3_clones.c
+++ b/src/emu/bus/nes/mmc3_clones.c
@@ -2077,7 +2077,7 @@ WRITE8_MEMBER(nes_bmc_hik8_device::write_m)
/* This bit is the "register lock". Once register are locked, writes go to WRAM
and there is no way to unlock them (except by resetting the machine) */
- if ((m_reg[3] & 0x40) && m_prgram)
+ if ((m_reg[3] & 0x40) && !m_prgram.empty())
m_prgram[offset] = data;
else
{
diff --git a/src/emu/bus/nes/mmc5.c b/src/emu/bus/nes/mmc5.c
index d442673666b..7d20c1e6846 100644
--- a/src/emu/bus/nes/mmc5.c
+++ b/src/emu/bus/nes/mmc5.c
@@ -622,17 +622,17 @@ WRITE8_MEMBER(nes_exrom_device::write_l)
READ8_MEMBER(nes_exrom_device::read_m)
{
LOG_MMC(("exrom read_m, offset: %04x\n", offset));
- if (m_battery && m_prgram) // 2 chips present: first is BWRAM, second is WRAM
+ if (!m_battery.empty() && !m_prgram.empty()) // 2 chips present: first is BWRAM, second is WRAM
{
if (m_wram_base & 0x04)
- return m_prgram[(offset + (m_wram_base & 0x03) * 0x2000) & (m_prgram.count() - 1)];
+ return m_prgram[(offset + (m_wram_base & 0x03) * 0x2000) & (m_prgram.size() - 1)];
else
- return m_battery[(offset + (m_wram_base & 0x03) * 0x2000) & (m_battery.count() - 1)];
+ return m_battery[(offset + (m_wram_base & 0x03) * 0x2000) & (m_battery.size() - 1)];
}
- else if (m_prgram) // 1 chip, WRAM
- return m_prgram[(offset + (m_wram_base & 0x03) * 0x2000) & (m_prgram.count() - 1)];
- else if (m_battery) // 1 chip, BWRAM
- return m_battery[(offset + (m_wram_base & 0x03) * 0x2000) & (m_battery.count() - 1)];
+ else if (!m_prgram.empty()) // 1 chip, WRAM
+ return m_prgram[(offset + (m_wram_base & 0x03) * 0x2000) & (m_prgram.size() - 1)];
+ else if (!m_battery.empty()) // 1 chip, BWRAM
+ return m_battery[(offset + (m_wram_base & 0x03) * 0x2000) & (m_battery.size() - 1)];
else
return m_open_bus;
}
@@ -643,10 +643,10 @@ WRITE8_MEMBER(nes_exrom_device::write_m)
if (m_wram_protect_1 != 0x02 || m_wram_protect_2 != 0x01)
return;
- if (m_battery && m_wram_base < 4)
- m_battery[(offset + m_wram_base * 0x2000) & (m_battery.count() - 1)] = data;
- else if (m_prgram)
- m_prgram[(offset + (m_wram_base & 0x03) * 0x2000) & (m_prgram.count() - 1)] = data;
+ if (!m_battery.empty() && m_wram_base < 4)
+ m_battery[(offset + m_wram_base * 0x2000) & (m_battery.size() - 1)] = data;
+ else if (!m_prgram.empty())
+ m_prgram[(offset + (m_wram_base & 0x03) * 0x2000) & (m_prgram.size() - 1)] = data;
}
// some games (e.g. Bandit Kings of Ancient China) write to PRG-RAM through 0x8000-0xdfff
@@ -657,10 +657,10 @@ READ8_MEMBER(nes_exrom_device::read_h)
if (bank < 3 && offset >= bank * 0x2000 && offset < (bank + 1) * 0x2000 && m_prg_ram_mapped[bank])
{
- if (m_battery && m_ram_hi_banks[bank] < 4)
- return m_battery[((m_ram_hi_banks[bank] * 0x2000) + (offset & 0x1fff)) & (m_battery.count() - 1)];
- else if (m_prgram)
- return m_prgram[(((m_ram_hi_banks[bank] & 3) * 0x2000) + (offset & 0x1fff)) & (m_prgram.count() - 1)];
+ if (!m_battery.empty() && m_ram_hi_banks[bank] < 4)
+ return m_battery[((m_ram_hi_banks[bank] * 0x2000) + (offset & 0x1fff)) & (m_battery.size() - 1)];
+ else if (!m_prgram.empty())
+ return m_prgram[(((m_ram_hi_banks[bank] & 3) * 0x2000) + (offset & 0x1fff)) & (m_prgram.size() - 1)];
}
return hi_access_rom(offset);
@@ -673,8 +673,8 @@ WRITE8_MEMBER(nes_exrom_device::write_h)
if (m_wram_protect_1 != 0x02 || m_wram_protect_2 != 0x01 || bank == 3 || !m_prg_ram_mapped[bank])
return;
- if (m_battery && m_ram_hi_banks[bank] < 4)
- m_battery[((m_ram_hi_banks[bank] * 0x2000) + (offset & 0x1fff)) & (m_battery.count() - 1)] = data;
- else if (m_prgram)
- m_prgram[(((m_ram_hi_banks[bank] & 3) * 0x2000) + (offset & 0x1fff)) & (m_prgram.count() - 1)] = data;
+ if (!m_battery.empty() && m_ram_hi_banks[bank] < 4)
+ m_battery[((m_ram_hi_banks[bank] * 0x2000) + (offset & 0x1fff)) & (m_battery.size() - 1)] = data;
+ else if (!m_prgram.empty())
+ m_prgram[(((m_ram_hi_banks[bank] & 3) * 0x2000) + (offset & 0x1fff)) & (m_prgram.size() - 1)] = data;
}
diff --git a/src/emu/bus/nes/namcot.c b/src/emu/bus/nes/namcot.c
index 0b62a23578d..43573a627a0 100644
--- a/src/emu/bus/nes/namcot.c
+++ b/src/emu/bus/nes/namcot.c
@@ -512,8 +512,8 @@ READ8_MEMBER(nes_namcot175_device::read_m)
{
// the only game supporting this is Family Circuit '91, and it has 2KB of battery
// but it's mirrored up to 8KB (see Sprint Race -> Back Up menu breakage if not)
- if (m_battery && !m_wram_protect)
- return m_battery[offset & (m_battery.count() - 1)];
+ if (!m_battery.empty() && !m_wram_protect)
+ return m_battery[offset & (m_battery.size() - 1)];
return m_open_bus; // open bus
}
@@ -522,8 +522,8 @@ WRITE8_MEMBER(nes_namcot175_device::write_m)
{
// the only game supporting this is Family Circuit '91, and it has 2KB of battery
// but it's mirrored up to 8KB (see Sprint Race -> Back Up menu breakage if not)
- if (m_battery && !m_wram_protect)
- m_battery[offset & (m_battery.count() - 1)] = data;
+ if (!m_battery.empty() && !m_wram_protect)
+ m_battery[offset & (m_battery.size() - 1)] = data;
}
WRITE8_MEMBER(nes_namcot175_device::write_h)
@@ -595,8 +595,8 @@ READ8_MEMBER(nes_namcot163_device::chr_r)
READ8_MEMBER(nes_namcot163_device::read_m)
{
- if (m_battery && offset < m_battery.count())
- return m_battery[offset & (m_battery.count() - 1)];
+ if (!m_battery.empty() && offset < m_battery.size())
+ return m_battery[offset & (m_battery.size() - 1)];
return m_open_bus; // open bus
}
@@ -605,8 +605,8 @@ WRITE8_MEMBER(nes_namcot163_device::write_m)
{
// the pcb can separately protect each 2KB chunk of the external wram from writes
int bank = (offset & 0x1800) >> 11;
- if (m_battery && !BIT(m_wram_protect, bank))
- m_battery[offset & (m_battery.count() - 1)] = data;
+ if (!m_battery.empty() && !BIT(m_wram_protect, bank))
+ m_battery[offset & (m_battery.size() - 1)] = data;
}
WRITE8_MEMBER(nes_namcot163_device::write_l)
diff --git a/src/emu/bus/nes/nes_ines.inc b/src/emu/bus/nes/nes_ines.inc
index 1fb4119618f..07b48cd7629 100644
--- a/src/emu/bus/nes/nes_ines.inc
+++ b/src/emu/bus/nes/nes_ines.inc
@@ -797,15 +797,15 @@ void nes_cart_slot_device::call_load_ines()
{
UINT32 tot_size = battery_size + mapper_sram_size;
dynamic_buffer temp_nvram(tot_size);
- battery_load(temp_nvram, tot_size, 0x00);
+ battery_load(&temp_nvram[0], tot_size, 0x00);
if (battery_size)
{
//printf("here %d\n", battery_size);
m_cart->battery_alloc(battery_size);
- memcpy(m_cart->get_battery_base(), temp_nvram, battery_size);
+ memcpy(m_cart->get_battery_base(), &temp_nvram[0], battery_size);
}
if (mapper_sram_size)
- memcpy(m_cart->get_mapper_sram_base(), temp_nvram + battery_size, m_cart->get_mapper_sram_size());
+ memcpy(m_cart->get_mapper_sram_base(), &temp_nvram[battery_size], m_cart->get_mapper_sram_size());
}
}
diff --git a/src/emu/bus/nes/nes_pcb.inc b/src/emu/bus/nes/nes_pcb.inc
index ba38fafc4c5..8674f6a1b6c 100644
--- a/src/emu/bus/nes/nes_pcb.inc
+++ b/src/emu/bus/nes/nes_pcb.inc
@@ -588,20 +588,20 @@ void nes_cart_slot_device::call_load_pcb()
// and we use the info from xml here to prepare a default NVRAM
dynamic_buffer default_nvram(tot_size);
if (battery_size)
- memcpy(default_nvram, get_software_region("bwram"), battery_size);
+ memcpy(&default_nvram[0], get_software_region("bwram"), battery_size);
if (mapper_sram_size)
- memset(default_nvram + battery_size, 0, mapper_sram_size);
+ memset(&default_nvram[battery_size], 0, mapper_sram_size);
// load battery (using default if no battery exists)
- battery_load(temp_nvram, tot_size, default_nvram);
+ battery_load(&temp_nvram[0], tot_size, &default_nvram[0]);
// copy battery into PCB arrays
if (battery_size)
{
m_cart->battery_alloc(battery_size);
- memcpy(m_cart->get_battery_base(), temp_nvram, battery_size);
+ memcpy(m_cart->get_battery_base(), &temp_nvram[0], battery_size);
}
if (mapper_sram_size)
- memcpy(m_cart->get_mapper_sram_base(), temp_nvram + battery_size, mapper_sram_size);
+ memcpy(m_cart->get_mapper_sram_base(), &temp_nvram[battery_size], mapper_sram_size);
}
}
diff --git a/src/emu/bus/nes/nes_slot.c b/src/emu/bus/nes/nes_slot.c
index aad722536dd..5d8af191412 100644
--- a/src/emu/bus/nes/nes_slot.c
+++ b/src/emu/bus/nes/nes_slot.c
@@ -368,7 +368,7 @@ void device_nes_cart_interface::prg8_x(int start, int bank)
inline void device_nes_cart_interface::chr_sanity_check( int source )
{
- if (source == CHRRAM && m_vram == NULL)
+ if (source == CHRRAM && m_vram.empty())
fatalerror("CHRRAM bankswitch with no VRAM\n");
if (source == CHRROM && m_vrom == NULL)
@@ -484,7 +484,7 @@ void device_nes_cart_interface::set_nt_page(int page, int source, int bank, int
switch (source)
{
case CART_NTRAM:
- base_ptr = m_ext_ntram;
+ base_ptr = &m_ext_ntram[0];
break;
case VROM:
bank &= ((m_vrom_chunks << 3) - 1);
@@ -546,7 +546,7 @@ void device_nes_cart_interface::set_nt_mirroring(int mirroring)
break;
case PPU_MIRROR_4SCREEN:
- if (!m_ext_ntram) fatalerror("4-screen mirroring without on-cart NTRAM!\n");
+ if (m_ext_ntram.empty()) fatalerror("4-screen mirroring without on-cart NTRAM!\n");
set_nt_page(0, CART_NTRAM, 0, 1);
set_nt_page(1, CART_NTRAM, 1, 1);
set_nt_page(2, CART_NTRAM, 2, 1);
@@ -643,10 +643,10 @@ READ8_MEMBER(device_nes_cart_interface::read_l)
READ8_MEMBER(device_nes_cart_interface::read_m)
{
- if (m_battery)
- return m_battery[offset & (m_battery.count() - 1)];
- if (m_prgram)
- return m_prgram[offset & (m_prgram.count() - 1)];
+ if (!m_battery.empty())
+ return m_battery[offset & (m_battery.size() - 1)];
+ if (!m_prgram.empty())
+ return m_prgram[offset & (m_prgram.size() - 1)];
return m_open_bus;
}
@@ -657,10 +657,10 @@ WRITE8_MEMBER(device_nes_cart_interface::write_l)
WRITE8_MEMBER(device_nes_cart_interface::write_m)
{
- if (m_battery)
- m_battery[offset & (m_battery.count() - 1)] = data;
- if (m_prgram)
- m_prgram[offset & (m_prgram.count() - 1)] = data;
+ if (!m_battery.empty())
+ m_battery[offset & (m_battery.size() - 1)] = data;
+ if (!m_prgram.empty())
+ m_prgram[offset & (m_prgram.size() - 1)] = data;
}
WRITE8_MEMBER(device_nes_cart_interface::write_h)
@@ -709,11 +709,11 @@ void device_nes_cart_interface::pcb_start(running_machine &machine, UINT8 *ciram
set_nt_mirroring(m_mirroring);
// save the on-cart RAM pointers
- if (m_prgram.count())
+ if (!m_prgram.empty())
device().save_item(NAME(m_prgram));
- if (m_vram.bytes())
+ if (!m_vram.empty())
device().save_item(NAME(m_vram));
- if (m_battery.count())
+ if (!m_battery.empty())
device().save_item(NAME(m_battery));
}
@@ -888,11 +888,11 @@ void nes_cart_slot_device::call_unload()
UINT32 tot_size = m_cart->get_battery_size() + m_cart->get_mapper_sram_size();
dynamic_buffer temp_nvram(tot_size);
if (m_cart->get_battery_size())
- memcpy(temp_nvram, m_cart->get_battery_base(), m_cart->get_battery_size());
+ memcpy(&temp_nvram[0], m_cart->get_battery_base(), m_cart->get_battery_size());
if (m_cart->get_mapper_sram_size())
- memcpy(temp_nvram + m_cart->get_battery_size(), m_cart->get_mapper_sram_base(), m_cart->get_mapper_sram_size());
+ memcpy(&temp_nvram[m_cart->get_battery_size()], m_cart->get_mapper_sram_base(), m_cart->get_mapper_sram_size());
- battery_save(temp_nvram, tot_size);
+ battery_save(&temp_nvram[0], tot_size);
}
}
}
@@ -920,13 +920,13 @@ void nes_cart_slot_device::get_default_card_software(astring &result)
UINT32 len = core_fsize(m_file);
dynamic_buffer rom(len);
- core_fread(m_file, rom, len);
+ core_fread(m_file, &rom[0], len);
if ((rom[0] == 'N') && (rom[1] == 'E') && (rom[2] == 'S'))
- slot_string = get_default_card_ines(rom, len);
+ slot_string = get_default_card_ines(&rom[0], len);
if ((rom[0] == 'U') && (rom[1] == 'N') && (rom[2] == 'I') && (rom[3] == 'F'))
- slot_string = get_default_card_unif(rom, len);
+ slot_string = get_default_card_unif(&rom[0], len);
clear();
diff --git a/src/emu/bus/nes/nes_slot.h b/src/emu/bus/nes/nes_slot.h
index de504c15eea..d946825ec63 100644
--- a/src/emu/bus/nes/nes_slot.h
+++ b/src/emu/bus/nes/nes_slot.h
@@ -198,17 +198,17 @@ public:
void set_open_bus(UINT8 val) { m_open_bus = val; }
UINT8* get_prg_base() { return m_prg; }
- UINT8* get_prgram_base() { return m_prgram; }
+ UINT8* get_prgram_base() { return &m_prgram[0]; }
UINT8* get_vrom_base() { return m_vrom; }
- UINT8* get_vram_base() { return m_vram; }
- UINT8* get_battery_base() { return m_battery; }
+ UINT8* get_vram_base() { return &m_vram[0]; }
+ UINT8* get_battery_base() { return &m_battery[0]; }
UINT8* get_mapper_sram_base() { return m_mapper_sram; }
UINT32 get_prg_size() { return m_prg_size; }
- UINT32 get_prgram_size() { return m_prgram.bytes(); }
+ UINT32 get_prgram_size() { return m_prgram.size(); }
UINT32 get_vrom_size() { return m_vrom_size; }
- UINT32 get_vram_size() { return m_vram.bytes(); }
- UINT32 get_battery_size() { return m_battery.bytes(); }
+ UINT32 get_vram_size() { return m_vram.size(); }
+ UINT32 get_battery_size() { return m_battery.size(); }
UINT32 get_mapper_sram_size() { return m_mapper_sram_size; }
virtual void ppu_latch(offs_t offset) {}
@@ -320,7 +320,7 @@ protected:
void set_nt_page(int page, int source, int bank, int writable);
void set_nt_mirroring(int mirroring);
- dynamic_array<UINT16> m_prg_bank_map;
+ std::vector<UINT16> m_prg_bank_map;
};
void nes_partialhash(hash_collection &dest, const unsigned char *data, unsigned long length, const char *functions);
diff --git a/src/emu/bus/nes/nes_unif.inc b/src/emu/bus/nes/nes_unif.inc
index dcbf58a0c68..c7ec91c8fee 100644
--- a/src/emu/bus/nes/nes_unif.inc
+++ b/src/emu/bus/nes/nes_unif.inc
@@ -467,13 +467,13 @@ void nes_cart_slot_device::call_load_unif()
if (prg_size == 0x4000)
{
m_cart->prg_alloc(0x8000, tag());
- memcpy(m_cart->get_prg_base(), temp_prg, 0x4000);
+ memcpy(m_cart->get_prg_base(), &temp_prg[0], 0x4000);
memcpy(m_cart->get_prg_base() + 0x4000, m_cart->get_prg_base(), 0x4000);
}
else
{
m_cart->prg_alloc(prg_size, tag());
- memcpy(m_cart->get_prg_base(), temp_prg, prg_size);
+ memcpy(m_cart->get_prg_base(), &temp_prg[0], prg_size);
}
if (small_prg) // This is not supported yet, so warn users about this
@@ -482,7 +482,7 @@ void nes_cart_slot_device::call_load_unif()
if (vrom_size)
{
m_cart->vrom_alloc(vrom_size, tag());
- memcpy(m_cart->get_vrom_base(), temp_chr, vrom_size);
+ memcpy(m_cart->get_vrom_base(), &temp_chr[0], vrom_size);
}
#if SPLIT_PRG
@@ -530,14 +530,14 @@ void nes_cart_slot_device::call_load_unif()
{
UINT32 tot_size = battery_size + mapper_sram_size;
dynamic_buffer temp_nvram(tot_size);
- battery_load(temp_nvram, tot_size, 0x00);
+ battery_load(&temp_nvram[0], tot_size, 0x00);
if (battery_size)
{
m_cart->battery_alloc(battery_size);
- memcpy(m_cart->get_battery_base(), temp_nvram, battery_size);
+ memcpy(m_cart->get_battery_base(), &temp_nvram[0], battery_size);
}
if (mapper_sram_size)
- memcpy(m_cart->get_mapper_sram_base(), temp_nvram + battery_size, mapper_sram_size);
+ memcpy(m_cart->get_mapper_sram_base(), &temp_nvram[battery_size], mapper_sram_size);
}
logerror("UNIF support is only very preliminary.\n");
diff --git a/src/emu/bus/nes/pirate.c b/src/emu/bus/nes/pirate.c
index d6855e72597..e8c4762b1a8 100644
--- a/src/emu/bus/nes/pirate.c
+++ b/src/emu/bus/nes/pirate.c
@@ -551,13 +551,13 @@ READ8_MEMBER(nes_fukutake_device::read_l)
WRITE8_MEMBER(nes_fukutake_device::write_m)
{
LOG_MMC(("fukutake write_m, offset: %04x, data: %02x\n", offset, data));
- m_prgram[((m_latch * 0x2000) + offset) & (m_prgram.count() - 1)] = data;
+ m_prgram[((m_latch * 0x2000) + offset) & (m_prgram.size() - 1)] = data;
}
READ8_MEMBER(nes_fukutake_device::read_m)
{
LOG_MMC(("fukutake read_m, offset: %04x\n", offset));
- return m_prgram[((m_latch * 0x2000) + offset) & (m_prgram.count() - 1)];
+ return m_prgram[((m_latch * 0x2000) + offset) & (m_prgram.size() - 1)];
}
/*-------------------------------------------------
@@ -871,13 +871,13 @@ WRITE8_MEMBER(nes_edu2k_device::write_h)
WRITE8_MEMBER(nes_edu2k_device::write_m)
{
LOG_MMC(("edu2k write_m, offset: %04x, data: %02x\n", offset, data));
- m_prgram[((m_latch * 0x2000) + offset) & (m_prgram.count() - 1)] = data;
+ m_prgram[((m_latch * 0x2000) + offset) & (m_prgram.size() - 1)] = data;
}
READ8_MEMBER(nes_edu2k_device::read_m)
{
LOG_MMC(("edu2k read_m, offset: %04x\n", offset));
- return m_prgram[((m_latch * 0x2000) + offset) & (m_prgram.count() - 1)];
+ return m_prgram[((m_latch * 0x2000) + offset) & (m_prgram.size() - 1)];
}
/*-------------------------------------------------
diff --git a/src/emu/bus/nes/sunsoft.c b/src/emu/bus/nes/sunsoft.c
index 36ddbb65659..a927df2f3eb 100644
--- a/src/emu/bus/nes/sunsoft.c
+++ b/src/emu/bus/nes/sunsoft.c
@@ -428,20 +428,20 @@ WRITE8_MEMBER(nes_sunsoft_4_device::write_m)
{
LOG_MMC(("Sunsoft 4 write_m, offset: %04x, data: %02x\n", offset, data));
- if (m_battery && m_wram_enable)
- m_battery[offset & (m_battery.count() - 1)] = data;
- if (m_prgram && m_wram_enable)
- m_prgram[offset & (m_prgram.count() - 1)] = data;
+ if (!m_battery.empty() && m_wram_enable)
+ m_battery[offset & (m_battery.size() - 1)] = data;
+ if (!m_prgram.empty() && m_wram_enable)
+ m_prgram[offset & (m_prgram.size() - 1)] = data;
}
READ8_MEMBER(nes_sunsoft_4_device::read_m)
{
LOG_MMC(("Sunsoft 4 read_m, offset: %04x\n", offset));
- if (m_battery && m_wram_enable)
- return m_battery[offset & (m_battery.count() - 1)];
- if (m_prgram && m_wram_enable)
- return m_prgram[offset & (m_prgram.count() - 1)];
+ if (!m_battery.empty() && m_wram_enable)
+ return m_battery[offset & (m_battery.size() - 1)];
+ if (!m_prgram.empty() && m_wram_enable)
+ return m_prgram[offset & (m_prgram.size() - 1)];
return m_open_bus; // open bus
}
@@ -542,10 +542,10 @@ WRITE8_MEMBER(nes_sunsoft_fme7_device::write_m)
return;
else if (m_wram_bank & 0x80) // is PRG RAM
{
- if (m_battery)
- m_battery[((bank * 0x2000) + offset) & (m_battery.count() - 1)] = data;
- if (m_prgram)
- m_prgram[((bank * 0x2000) + offset) & (m_prgram.count() - 1)] = data;
+ if (!m_battery.empty())
+ m_battery[((bank * 0x2000) + offset) & (m_battery.size() - 1)] = data;
+ if (!m_prgram.empty())
+ m_prgram[((bank * 0x2000) + offset) & (m_prgram.size() - 1)] = data;
}
}
@@ -558,10 +558,10 @@ READ8_MEMBER(nes_sunsoft_fme7_device::read_m)
return m_prg[((bank * 0x2000) + offset) & (m_prg_size - 1)];
else if (m_wram_bank & 0x80) // is PRG RAM
{
- if (m_battery)
- return m_battery[((bank * 0x2000) + offset) & (m_battery.count() - 1)];
- if (m_prgram)
- return m_prgram[((bank * 0x2000) + offset) & (m_prgram.count() - 1)];
+ if (!m_battery.empty())
+ return m_battery[((bank * 0x2000) + offset) & (m_battery.size() - 1)];
+ if (!m_prgram.empty())
+ return m_prgram[((bank * 0x2000) + offset) & (m_prgram.size() - 1)];
}
return m_open_bus; // open bus
diff --git a/src/emu/bus/nes/sunsoft_dcs.c b/src/emu/bus/nes/sunsoft_dcs.c
index 6b6d2cacc02..b290e9611a8 100644
--- a/src/emu/bus/nes/sunsoft_dcs.c
+++ b/src/emu/bus/nes/sunsoft_dcs.c
@@ -254,10 +254,10 @@ WRITE8_MEMBER(nes_sunsoft_dcs_device::write_m)
{
LOG_MMC(("Sunsoft DCS write_m, offset: %04x, data: %02x\n", offset, data));
- if (m_battery && m_wram_enable)
- m_battery[offset & (m_battery.count() - 1)] = data;
- if (m_prgram && m_wram_enable)
- m_prgram[offset & (m_prgram.count() - 1)] = data;
+ if (!m_battery.empty() && m_wram_enable)
+ m_battery[offset & (m_battery.size() - 1)] = data;
+ if (!m_prgram.empty() && m_wram_enable)
+ m_prgram[offset & (m_prgram.size() - 1)] = data;
if (!m_wram_enable && !m_timer_on)
{
m_timer_on = 1;
@@ -270,10 +270,10 @@ READ8_MEMBER(nes_sunsoft_dcs_device::read_m)
{
LOG_MMC(("Sunsoft DCS read_m, offset: %04x\n", offset));
- if (m_battery && m_wram_enable)
- return m_battery[offset & (m_battery.count() - 1)];
- if (m_prgram && m_wram_enable)
- return m_prgram[offset & (m_prgram.count() - 1)];
+ if (!m_battery.empty() && m_wram_enable)
+ return m_battery[offset & (m_battery.size() - 1)];
+ if (!m_prgram.empty() && m_wram_enable)
+ return m_prgram[offset & (m_prgram.size() - 1)];
return m_open_bus; // open bus
}
diff --git a/src/emu/bus/nubus/nubus.c b/src/emu/bus/nubus/nubus.c
index f41088292ee..c2f929cea59 100644
--- a/src/emu/bus/nubus/nubus.c
+++ b/src/emu/bus/nubus/nubus.c
@@ -371,7 +371,8 @@ void device_nubus_card_interface::install_declaration_rom(device_t *dev, const c
break;
case 0xe1: // lane 0 only
- m_declaration_rom.resize_and_clear(romlen*4);
+ m_declaration_rom.resize(romlen*4);
+ memset(&m_declaration_rom[0], 0, romlen*4);
for (int i = 0; i < romlen; i++)
{
m_declaration_rom[BYTE4_XOR_BE(i*4)] = rom[i];
@@ -380,7 +381,8 @@ void device_nubus_card_interface::install_declaration_rom(device_t *dev, const c
break;
case 0xd2: // lane 1 only
- m_declaration_rom.resize_and_clear(romlen*4);
+ m_declaration_rom.resize(romlen*4);
+ memset(&m_declaration_rom[0], 0, romlen*4);
for (int i = 0; i < romlen; i++)
{
m_declaration_rom[BYTE4_XOR_BE((i*4)+1)] = rom[i];
@@ -389,7 +391,8 @@ void device_nubus_card_interface::install_declaration_rom(device_t *dev, const c
break;
case 0xb4: // lane 2 only
- m_declaration_rom.resize_and_clear(romlen*4);
+ m_declaration_rom.resize(romlen*4);
+ memset(&m_declaration_rom[0], 0, romlen*4);
for (int i = 0; i < romlen; i++)
{
m_declaration_rom[BYTE4_XOR_BE((i*4)+2)] = rom[i];
@@ -398,7 +401,8 @@ void device_nubus_card_interface::install_declaration_rom(device_t *dev, const c
break;
case 0x78: // lane 3 only
- m_declaration_rom.resize_and_clear(romlen*4);
+ m_declaration_rom.resize(romlen*4);
+ memset(&m_declaration_rom[0], 0, romlen*4);
for (int i = 0; i < romlen; i++)
{
m_declaration_rom[BYTE4_XOR_BE((i*4)+3)] = rom[i];
@@ -407,7 +411,8 @@ void device_nubus_card_interface::install_declaration_rom(device_t *dev, const c
break;
case 0xc3: // lanes 0, 1
- m_declaration_rom.resize_and_clear(romlen*2);
+ m_declaration_rom.resize(romlen*2);
+ memset(&m_declaration_rom[0], 0, romlen*4);
for (int i = 0; i < romlen/2; i++)
{
m_declaration_rom[BYTE4_XOR_BE((i*4)+0)] = rom[(i*2)];
@@ -417,7 +422,8 @@ void device_nubus_card_interface::install_declaration_rom(device_t *dev, const c
break;
case 0xa5: // lanes 0, 2
- m_declaration_rom.resize_and_clear(romlen*2);
+ m_declaration_rom.resize(romlen*2);
+ memset(&m_declaration_rom[0], 0, romlen*4);
for (int i = 0; i < romlen/2; i++)
{
m_declaration_rom[BYTE4_XOR_BE((i*4)+0)] = rom[(i*2)];
@@ -427,7 +433,8 @@ void device_nubus_card_interface::install_declaration_rom(device_t *dev, const c
break;
case 0x3c: // lanes 2,3
- m_declaration_rom.resize_and_clear(romlen*2);
+ m_declaration_rom.resize(romlen*2);
+ memset(&m_declaration_rom[0], 0, romlen*4);
for (int i = 0; i < romlen/2; i++)
{
m_declaration_rom[BYTE4_XOR_BE((i*4)+2)] = rom[(i*2)];
@@ -458,10 +465,10 @@ void device_nubus_card_interface::install_declaration_rom(device_t *dev, const c
// printf("Installing ROM at %x, length %x\n", addr, romlen);
if (mirror_all_mb) // mirror the declaration ROM across all 16 megs of the slot space
{
- m_nubus->install_bank(addr, addr+romlen-1, 0, 0x00f00000, bankname, m_declaration_rom);
+ m_nubus->install_bank(addr, addr+romlen-1, 0, 0x00f00000, bankname, &m_declaration_rom[0]);
}
else
{
- m_nubus->install_bank(addr, addr+romlen-1, 0, 0, bankname, m_declaration_rom);
+ m_nubus->install_bank(addr, addr+romlen-1, 0, 0, bankname, &m_declaration_rom[0]);
}
}
diff --git a/src/emu/bus/nubus/nubus_48gc.c b/src/emu/bus/nubus/nubus_48gc.c
index 635fab6c611..e6a1283708b 100644
--- a/src/emu/bus/nubus/nubus_48gc.c
+++ b/src/emu/bus/nubus/nubus_48gc.c
@@ -112,7 +112,7 @@ void jmfb_device::device_start()
// printf("[JMFB %p] slotspace = %x\n", this, slotspace);
m_vram.resize(VRAM_SIZE);
- install_bank(slotspace, slotspace+VRAM_SIZE-1, 0, 0, "bank_48gc", m_vram);
+ install_bank(slotspace, slotspace+VRAM_SIZE-1, 0, 0, "bank_48gc", &m_vram[0]);
m_nubus->install_device(slotspace+0x200000, slotspace+0x2003ff, read32_delegate(FUNC(jmfb_device::mac_48gc_r), this), write32_delegate(FUNC(jmfb_device::mac_48gc_w), this));
@@ -135,7 +135,7 @@ void jmfb_device::device_reset()
m_xres = 640;
m_yres = 480;
m_mode = 0;
- memset(m_vram, 0, VRAM_SIZE);
+ memset(&m_vram[0], 0, VRAM_SIZE);
memset(m_palette, 0, sizeof(m_palette));
}
@@ -159,7 +159,7 @@ UINT32 jmfb_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, c
{
UINT32 *scanline, *base;
int x, y;
- UINT8 *vram8 = (UINT8 *)m_vram;
+ UINT8 *vram8 = &m_vram[0];
UINT8 pixels;
// first time? kick off the VBL timer
diff --git a/src/emu/bus/nubus/nubus_cb264.c b/src/emu/bus/nubus/nubus_cb264.c
index 143813a3951..9beb5085ea3 100644
--- a/src/emu/bus/nubus/nubus_cb264.c
+++ b/src/emu/bus/nubus/nubus_cb264.c
@@ -96,7 +96,7 @@ void nubus_cb264_device::device_start()
// printf("[cb264 %p] slotspace = %x\n", this, slotspace);
m_vram.resize(VRAM_SIZE);
- install_bank(slotspace, slotspace+VRAM_SIZE-1, 0, 0, "bank_cb264", m_vram);
+ install_bank(slotspace, slotspace+VRAM_SIZE-1, 0, 0, "bank_cb264", &m_vram[0]);
m_nubus->install_device(slotspace+0xff6000, slotspace+0xff60ff, read32_delegate(FUNC(nubus_cb264_device::cb264_r), this), write32_delegate(FUNC(nubus_cb264_device::cb264_w), this));
m_nubus->install_device(slotspace+0xff7000, slotspace+0xff70ff, read32_delegate(FUNC(nubus_cb264_device::cb264_ramdac_r), this), write32_delegate(FUNC(nubus_cb264_device::cb264_ramdac_w), this));
@@ -113,7 +113,7 @@ void nubus_cb264_device::device_reset()
m_clutoffs = 0;
m_cb264_vbl_disable = 1;
m_cb264_mode = 0;
- memset(m_vram, 0, VRAM_SIZE);
+ memset(&m_vram[0], 0, VRAM_SIZE);
memset(m_palette, 0, sizeof(m_palette));
}
diff --git a/src/emu/bus/nubus/nubus_m2hires.c b/src/emu/bus/nubus/nubus_m2hires.c
index 73b9f0c0682..3827b033ebc 100644
--- a/src/emu/bus/nubus/nubus_m2hires.c
+++ b/src/emu/bus/nubus/nubus_m2hires.c
@@ -118,7 +118,7 @@ void nubus_m2hires_device::device_reset()
m_clutoffs = 0;
m_vbl_disable = 1;
m_mode = 0;
- memset(m_vram, 0, VRAM_SIZE);
+ memset(&m_vram[0], 0, VRAM_SIZE);
memset(m_palette, 0, sizeof(m_palette));
m_palette[0] = rgb_t(255, 255, 255);
@@ -148,7 +148,7 @@ UINT32 nubus_m2hires_device::screen_update(screen_device &screen, bitmap_rgb32 &
int x, y;
UINT8 pixels, *vram;
- vram = m_vram + 0x20;
+ vram = &m_vram[0x20];
switch (m_mode)
{
diff --git a/src/emu/bus/nubus/nubus_m2video.c b/src/emu/bus/nubus/nubus_m2video.c
index f0351d3780c..da461776532 100644
--- a/src/emu/bus/nubus/nubus_m2video.c
+++ b/src/emu/bus/nubus/nubus_m2video.c
@@ -119,7 +119,7 @@ void nubus_m2video_device::device_reset()
m_clutoffs = 0;
m_vbl_disable = 1;
m_mode = 0;
- memset(m_vram, 0, VRAM_SIZE);
+ memset(&m_vram[0], 0, VRAM_SIZE);
memset(m_palette, 0, sizeof(m_palette));
m_palette[0] = rgb_t(255, 255, 255);
@@ -149,7 +149,7 @@ UINT32 nubus_m2video_device::screen_update(screen_device &screen, bitmap_rgb32 &
int x, y;
UINT8 pixels, *vram;
- vram = m_vram + 0x20;
+ vram = &m_vram[0x20];
switch (m_mode)
{
diff --git a/src/emu/bus/nubus/nubus_radiustpd.c b/src/emu/bus/nubus/nubus_radiustpd.c
index 7d94e2083c7..d78afdc8cf8 100644
--- a/src/emu/bus/nubus/nubus_radiustpd.c
+++ b/src/emu/bus/nubus/nubus_radiustpd.c
@@ -119,7 +119,7 @@ void nubus_radiustpd_device::device_reset()
m_clutoffs = 0;
m_vbl_disable = 1;
m_mode = 0;
- memset(m_vram, 0, VRAM_SIZE);
+ memset(&m_vram[0], 0, VRAM_SIZE);
memset(m_palette, 0, sizeof(m_palette));
m_palette[1] = rgb_t(255, 255, 255);
@@ -149,7 +149,7 @@ UINT32 nubus_radiustpd_device::screen_update(screen_device &screen, bitmap_rgb32
int x, y;
UINT8 pixels, *vram;
- vram = m_vram + 0x200;
+ vram = &m_vram[0x200];
for (y = 0; y < 880; y++)
{
diff --git a/src/emu/bus/nubus/nubus_spec8.c b/src/emu/bus/nubus/nubus_spec8.c
index 238fc7d9384..7d691129800 100644
--- a/src/emu/bus/nubus/nubus_spec8.c
+++ b/src/emu/bus/nubus/nubus_spec8.c
@@ -121,7 +121,7 @@ void nubus_spec8s3_device::device_reset()
m_mode = 0;
m_vbl_pending = false;
m_parameter = 0;
- memset(m_vram, 0, VRAM_SIZE);
+ memset(&m_vram[0], 0, VRAM_SIZE);
memset(m_palette, 0, sizeof(m_palette));
m_palette[0] = rgb_t(255, 255, 255);
@@ -152,7 +152,7 @@ UINT32 nubus_spec8s3_device::screen_update(screen_device &screen, bitmap_rgb32 &
int x, y;
UINT8 pixels, *vram;
- vram = m_vram + 0x400;
+ vram = &m_vram[0x400];
switch (m_mode)
{
diff --git a/src/emu/bus/nubus/nubus_specpdq.c b/src/emu/bus/nubus/nubus_specpdq.c
index 72c3bf5acdd..582cd04262d 100644
--- a/src/emu/bus/nubus/nubus_specpdq.c
+++ b/src/emu/bus/nubus/nubus_specpdq.c
@@ -135,7 +135,7 @@ void nubus_specpdq_device::device_reset()
m_clutoffs = 0;
m_vbl_disable = 1;
m_mode = 0;
- memset(m_vram, 0, VRAM_SIZE);
+ memset(&m_vram[0], 0, VRAM_SIZE);
memset(m_palette_val, 0, sizeof(m_palette_val));
m_palette_val[0] = rgb_t(255, 255, 255);
@@ -166,7 +166,7 @@ UINT32 nubus_specpdq_device::screen_update(screen_device &screen, bitmap_rgb32 &
UINT8 pixels, *vram;
// first time? kick off the VBL timer
- vram = m_vram + 0x9000;
+ vram = &m_vram[0x9000];
switch (m_mode)
{
@@ -424,7 +424,7 @@ WRITE32_MEMBER( nubus_specpdq_device::specpdq_w )
if (data == 2)
{
int x, y;
- UINT8 *vram = m_vram + m_vram_addr + m_patofsx; // m_vram_addr is missing the low 2 bits, we add them back here
+ UINT8 *vram = &m_vram[m_vram_addr + m_patofsx]; // m_vram_addr is missing the low 2 bits, we add them back here
// printf("Fill rectangle with %02x %02x %02x %02x, width %d height %d\n", m_fillbytes[0], m_fillbytes[1], m_fillbytes[2], m_fillbytes[3], m_width, m_height);
@@ -439,8 +439,8 @@ WRITE32_MEMBER( nubus_specpdq_device::specpdq_w )
else if ((data == 0x101) || (data == 0x100))
{
int x, y;
- UINT8 *vram = m_vram + m_vram_addr;
- UINT8 *vramsrc = m_vram + m_vram_src;
+ UINT8 *vram = &m_vram[m_vram_addr];
+ UINT8 *vramsrc = &m_vram[m_vram_src];
// printf("Copy rectangle, width %d height %d src %x dst %x\n", m_width, m_height, m_vram_addr, m_vram_src);
diff --git a/src/emu/bus/nubus/nubus_vikbw.c b/src/emu/bus/nubus/nubus_vikbw.c
index 1b2170b1ba3..5424335e36a 100644
--- a/src/emu/bus/nubus/nubus_vikbw.c
+++ b/src/emu/bus/nubus/nubus_vikbw.c
@@ -92,8 +92,8 @@ void nubus_vikbw_device::device_start()
// printf("[vikbw %p] slotspace = %x\n", this, slotspace);
m_vram.resize(VRAM_SIZE);
- install_bank(slotspace+0x40000, slotspace+0x40000+VRAM_SIZE-1, 0, 0, "bank_vikbw", m_vram);
- install_bank(slotspace+0x940000, slotspace+0x940000+VRAM_SIZE-1, 0, 0, "bank_vikbw2", m_vram);
+ install_bank(slotspace+0x40000, slotspace+0x40000+VRAM_SIZE-1, 0, 0, "bank_vikbw", &m_vram[0]);
+ install_bank(slotspace+0x940000, slotspace+0x940000+VRAM_SIZE-1, 0, 0, "bank_vikbw2", &m_vram[0]);
m_nubus->install_device(slotspace, slotspace+3, read32_delegate(FUNC(nubus_vikbw_device::viking_enable_r), this), write32_delegate(FUNC(nubus_vikbw_device::viking_disable_w), this));
m_nubus->install_device(slotspace+0x80000, slotspace+0x80000+3, read32_delegate(FUNC(nubus_vikbw_device::viking_ack_r), this), write32_delegate(FUNC(nubus_vikbw_device::viking_ack_w), this));
@@ -106,7 +106,7 @@ void nubus_vikbw_device::device_start()
void nubus_vikbw_device::device_reset()
{
m_vbl_disable = 1;
- memset(m_vram, 0, VRAM_SIZE);
+ memset(&m_vram[0], 0, VRAM_SIZE);
m_palette[0] = rgb_t(255, 255, 255);
m_palette[1] = rgb_t(0, 0, 0);
diff --git a/src/emu/bus/nubus/nubus_wsportrait.c b/src/emu/bus/nubus/nubus_wsportrait.c
index 7e5b44e8ed9..30a2a6e4bbb 100644
--- a/src/emu/bus/nubus/nubus_wsportrait.c
+++ b/src/emu/bus/nubus/nubus_wsportrait.c
@@ -121,7 +121,7 @@ void nubus_wsportrait_device::device_reset()
m_clutoffs = 0;
m_vbl_disable = 1;
m_mode = 0;
- memset(m_vram, 0, VRAM_SIZE);
+ memset(&m_vram[0], 0, VRAM_SIZE);
memset(m_palette, 0, sizeof(m_palette));
}
@@ -149,7 +149,7 @@ UINT32 nubus_wsportrait_device::screen_update(screen_device &screen, bitmap_rgb3
UINT8 pixels, *vram;
// first time? kick off the VBL timer
- vram = m_vram + 0x80;
+ vram = &m_vram[0x80];
switch (m_mode)
{
diff --git a/src/emu/bus/nubus/pds30_30hr.c b/src/emu/bus/nubus/pds30_30hr.c
index be7cb26a48c..a92044d1b98 100644
--- a/src/emu/bus/nubus/pds30_30hr.c
+++ b/src/emu/bus/nubus/pds30_30hr.c
@@ -120,7 +120,7 @@ void nubus_xceed30hr_device::device_reset()
m_clutoffs = 0;
m_vbl_disable = 1;
m_mode = 0;
- memset(m_vram, 0, VRAM_SIZE);
+ memset(&m_vram[0], 0, VRAM_SIZE);
memset(m_palette, 0, sizeof(m_palette));
m_palette[0] = rgb_t(255, 255, 255);
@@ -150,7 +150,7 @@ UINT32 nubus_xceed30hr_device::screen_update(screen_device &screen, bitmap_rgb32
int x, y;
UINT8 pixels, *vram;
- vram = m_vram + 1024;
+ vram = &m_vram[1024];
switch (m_mode)
{
diff --git a/src/emu/bus/nubus/pds30_cb264.c b/src/emu/bus/nubus/pds30_cb264.c
index 68779a1a577..0497ed86531 100644
--- a/src/emu/bus/nubus/pds30_cb264.c
+++ b/src/emu/bus/nubus/pds30_cb264.c
@@ -113,7 +113,7 @@ void nubus_cb264se30_device::device_reset()
m_clutoffs = 0;
m_vbl_disable = 1;
m_mode = 4;
- memset(m_vram, 0, VRAM_SIZE);
+ memset(&m_vram[0], 0, VRAM_SIZE);
memset(m_palette, 0, sizeof(m_palette));
m_palette[0] = rgb_t(255, 255, 255);
@@ -143,7 +143,7 @@ UINT32 nubus_cb264se30_device::screen_update(screen_device &screen, bitmap_rgb32
int x, y;
UINT8 pixels, *vram;
- vram = m_vram + (8*1024);
+ vram = &m_vram[8*1024];
switch (m_mode)
{
diff --git a/src/emu/bus/nubus/pds30_mc30.c b/src/emu/bus/nubus/pds30_mc30.c
index 0b53c441acc..0179589c9dd 100644
--- a/src/emu/bus/nubus/pds30_mc30.c
+++ b/src/emu/bus/nubus/pds30_mc30.c
@@ -116,7 +116,7 @@ void nubus_xceedmc30_device::device_reset()
m_clutoffs = 0;
m_vbl_disable = 1;
m_mode = 0;
- memset(m_vram, 0, VRAM_SIZE);
+ memset(&m_vram[0], 0, VRAM_SIZE);
memset(m_palette, 0, sizeof(m_palette));
m_palette[0] = rgb_t(255, 255, 255);
@@ -146,7 +146,7 @@ UINT32 nubus_xceedmc30_device::screen_update(screen_device &screen, bitmap_rgb32
int x, y;
UINT8 pixels, *vram;
- vram = m_vram + (4*1024);
+ vram = &m_vram[4*1024];
switch (m_mode)
{
diff --git a/src/emu/bus/nubus/pds30_procolor816.c b/src/emu/bus/nubus/pds30_procolor816.c
index 2693a4f6bb1..7d09328632a 100644
--- a/src/emu/bus/nubus/pds30_procolor816.c
+++ b/src/emu/bus/nubus/pds30_procolor816.c
@@ -120,7 +120,7 @@ void nubus_procolor816_device::device_reset()
m_clutoffs = 0;
m_vbl_disable = 1;
m_mode = 3;
- memset(m_vram, 0, VRAM_SIZE);
+ memset(&m_vram[0], 0, VRAM_SIZE);
memset(m_palette, 0, sizeof(m_palette));
m_palette[0] = rgb_t(255, 255, 255);
@@ -150,7 +150,7 @@ UINT32 nubus_procolor816_device::screen_update(screen_device &screen, bitmap_rgb
int x, y;
UINT8 pixels, *vram;
- vram = m_vram + 4;
+ vram = &m_vram[4];
switch (m_mode)
{
diff --git a/src/emu/bus/nubus/pds30_sigmalview.c b/src/emu/bus/nubus/pds30_sigmalview.c
index 73698f5a374..78dbb29f58e 100644
--- a/src/emu/bus/nubus/pds30_sigmalview.c
+++ b/src/emu/bus/nubus/pds30_sigmalview.c
@@ -112,7 +112,7 @@ void nubus_lview_device::device_reset()
{
m_vbl_disable = 1;
m_protstate = 0;
- memset(m_vram, 0, VRAM_SIZE);
+ memset(&m_vram[0], 0, VRAM_SIZE);
memset(m_palette, 0, sizeof(m_palette));
m_palette[0] = rgb_t(255, 255, 255);
@@ -142,7 +142,7 @@ UINT32 nubus_lview_device::screen_update(screen_device &screen, bitmap_rgb32 &bi
int x, y;
UINT8 pixels, *vram;
- vram = m_vram + 0x20;
+ vram = &m_vram[0x20];
for (y = 0; y < 600; y++)
{
diff --git a/src/emu/bus/odyssey2/slot.h b/src/emu/bus/odyssey2/slot.h
index fad028fc10a..9ca22730bbe 100644
--- a/src/emu/bus/odyssey2/slot.h
+++ b/src/emu/bus/odyssey2/slot.h
@@ -39,9 +39,9 @@ public:
void rom_alloc(UINT32 size, const char *tag);
void ram_alloc(UINT32 size);
UINT8* get_rom_base() { return m_rom; }
- UINT8* get_ram_base() { return m_ram; }
+ UINT8* get_ram_base() { return &m_ram[0]; }
UINT32 get_rom_size() { return m_rom_size; }
- UINT32 get_ram_size() { return m_ram.count(); }
+ UINT32 get_ram_size() { return m_ram.size(); }
protected:
// internal state
diff --git a/src/emu/bus/pce/pce_rom.c b/src/emu/bus/pce/pce_rom.c
index 57b7a6a76bb..f210ad6a225 100644
--- a/src/emu/bus/pce/pce_rom.c
+++ b/src/emu/bus/pce/pce_rom.c
@@ -80,7 +80,7 @@ READ8_MEMBER(pce_rom_device::read_cart)
READ8_MEMBER(pce_cdsys3_device::read_cart)
{
int bank = offset / 0x20000;
- if (m_ram && offset >= 0xd0000)
+ if (!m_ram.empty() && offset >= 0xd0000)
return m_ram[offset - 0xd0000];
return m_rom[rom_bank_map[bank] * 0x20000 + (offset & 0x1ffff)];
@@ -88,7 +88,7 @@ READ8_MEMBER(pce_cdsys3_device::read_cart)
WRITE8_MEMBER(pce_cdsys3_device::write_cart)
{
- if (m_ram && offset >= 0xd0000)
+ if (!m_ram.empty() && offset >= 0xd0000)
m_ram[offset - 0xd0000] = data;
}
@@ -96,7 +96,7 @@ WRITE8_MEMBER(pce_cdsys3_device::write_cart)
READ8_MEMBER(pce_populous_device::read_cart)
{
int bank = offset / 0x20000;
- if (m_ram && offset >= 0x80000 && offset < 0x88000)
+ if (!m_ram.empty() && offset >= 0x80000 && offset < 0x88000)
return m_ram[offset & 0x7fff];
return m_rom[rom_bank_map[bank] * 0x20000 + (offset & 0x1ffff)];
@@ -104,7 +104,7 @@ READ8_MEMBER(pce_populous_device::read_cart)
WRITE8_MEMBER(pce_populous_device::write_cart)
{
- if (m_ram && offset >= 0x80000 && offset < 0x88000)
+ if (!m_ram.empty() && offset >= 0x80000 && offset < 0x88000)
m_ram[offset & 0x7fff] = data;
}
diff --git a/src/emu/bus/pce/pce_slot.c b/src/emu/bus/pce/pce_slot.c
index 38b99125d88..f5c07c2780e 100644
--- a/src/emu/bus/pce/pce_slot.c
+++ b/src/emu/bus/pce/pce_slot.c
@@ -348,9 +348,9 @@ void pce_cart_slot_device::get_default_card_software(astring &result)
dynamic_buffer rom(len);
int type;
- core_fread(m_file, rom, len);
+ core_fread(m_file, &rom[0], len);
- type = get_cart_type(rom, len);
+ type = get_cart_type(&rom[0], len);
slot_string = pce_get_slot(type);
//printf("type: %s\n", slot_string);
diff --git a/src/emu/bus/pce/pce_slot.h b/src/emu/bus/pce/pce_slot.h
index 6dad213d70e..542151964fc 100644
--- a/src/emu/bus/pce/pce_slot.h
+++ b/src/emu/bus/pce/pce_slot.h
@@ -33,9 +33,9 @@ public:
void rom_alloc(UINT32 size, const char *tag);
void ram_alloc(UINT32 size);
UINT8* get_rom_base() { return m_rom; }
- UINT8* get_ram_base() { return m_ram; }
+ UINT8* get_ram_base() { return &m_ram[0]; }
UINT32 get_rom_size() { return m_rom_size; }
- UINT32 get_ram_size() { return m_ram.count(); }
+ UINT32 get_ram_size() { return m_ram.size(); }
// internal state
UINT8 *m_rom;
diff --git a/src/emu/bus/saturn/bram.c b/src/emu/bus/saturn/bram.c
index 79ebd34b482..92357c44e0b 100644
--- a/src/emu/bus/saturn/bram.c
+++ b/src/emu/bus/saturn/bram.c
@@ -67,7 +67,7 @@ void saturn_bram_device::nvram_default()
{
static const UINT8 init[16] =
{ 'B', 'a', 'c', 'k', 'U', 'p', 'R', 'a', 'm', ' ', 'F', 'o', 'r', 'm', 'a', 't' };
- memset(m_ext_bram, 0, m_ext_bram.bytes());
+ memset(&m_ext_bram[0], 0, m_ext_bram.size());
for (int i = 0; i < 32; i++)
{
@@ -85,7 +85,7 @@ void saturn_bram_device::nvram_default()
READ32_MEMBER(saturn_bram_device::read_ext_bram)
{
- if (offset < m_ext_bram.bytes()/2)
+ if (offset < m_ext_bram.size()/2)
return (m_ext_bram[offset * 2] << 16) | m_ext_bram[offset * 2 + 1];
else
{
@@ -96,7 +96,7 @@ READ32_MEMBER(saturn_bram_device::read_ext_bram)
WRITE32_MEMBER(saturn_bram_device::write_ext_bram)
{
- if (offset < m_ext_bram.bytes()/2)
+ if (offset < m_ext_bram.size()/2)
{
if (ACCESSING_BITS_16_23)
m_ext_bram[offset * 2 + 0] = (data & 0x00ff0000) >> 16;
diff --git a/src/emu/bus/saturn/bram.h b/src/emu/bus/saturn/bram.h
index 1d15acd5440..972cd9e7081 100644
--- a/src/emu/bus/saturn/bram.h
+++ b/src/emu/bus/saturn/bram.h
@@ -20,8 +20,8 @@ public:
// device_nvram_interface overrides
virtual void nvram_default();
- virtual void nvram_read(emu_file &file) { if (m_ext_bram != NULL) { file.read(m_ext_bram, m_ext_bram.bytes()); } }
- virtual void nvram_write(emu_file &file) { if (m_ext_bram != NULL) { file.write(m_ext_bram, m_ext_bram.bytes()); } }
+ virtual void nvram_read(emu_file &file) { if (!m_ext_bram.empty()) file.read(&m_ext_bram[0], m_ext_bram.size()); }
+ virtual void nvram_write(emu_file &file) { if (!m_ext_bram.empty()) file.write(&m_ext_bram[0], m_ext_bram.size()); }
// reading and writing
virtual DECLARE_READ32_MEMBER(read_ext_bram);
diff --git a/src/emu/bus/saturn/dram.c b/src/emu/bus/saturn/dram.c
index f4d7689918c..37f963ebf07 100644
--- a/src/emu/bus/saturn/dram.c
+++ b/src/emu/bus/saturn/dram.c
@@ -58,7 +58,7 @@ void saturn_dram_device::device_reset()
READ32_MEMBER(saturn_dram_device::read_ext_dram0)
{
if (offset < (0x400000/2)/4)
- return m_ext_dram0[offset % m_ext_dram0.count()];
+ return m_ext_dram0[offset % m_ext_dram0.size()];
else
{
popmessage("DRAM0 read beyond its boundary! offs: %X\n", offset);
@@ -69,7 +69,7 @@ READ32_MEMBER(saturn_dram_device::read_ext_dram0)
READ32_MEMBER(saturn_dram_device::read_ext_dram1)
{
if (offset < (0x400000/2)/4)
- return m_ext_dram1[offset % m_ext_dram1.count()];
+ return m_ext_dram1[offset % m_ext_dram1.size()];
else
{
popmessage("DRAM1 read beyond its boundary! offs: %X\n", offset);
@@ -80,7 +80,7 @@ READ32_MEMBER(saturn_dram_device::read_ext_dram1)
WRITE32_MEMBER(saturn_dram_device::write_ext_dram0)
{
if (offset < (0x400000/2)/4)
- COMBINE_DATA(&m_ext_dram0[offset % m_ext_dram0.count()]);
+ COMBINE_DATA(&m_ext_dram0[offset % m_ext_dram0.size()]);
else
popmessage("DRAM0 write beyond its boundary! offs: %X data: %X\n", offset, data);
}
@@ -88,7 +88,7 @@ WRITE32_MEMBER(saturn_dram_device::write_ext_dram0)
WRITE32_MEMBER(saturn_dram_device::write_ext_dram1)
{
if (offset < (0x400000/2)/4)
- COMBINE_DATA(&m_ext_dram1[offset % m_ext_dram1.count()]);
+ COMBINE_DATA(&m_ext_dram1[offset % m_ext_dram1.size()]);
else
popmessage("DRAM1 write beyond its boundary! offs: %X data: %X\n", offset, data);
}
diff --git a/src/emu/bus/saturn/sat_slot.h b/src/emu/bus/saturn/sat_slot.h
index 37f7f5d6477..04dc190c1d3 100644
--- a/src/emu/bus/saturn/sat_slot.h
+++ b/src/emu/bus/saturn/sat_slot.h
@@ -34,13 +34,13 @@ public:
void dram0_alloc(UINT32 size);
void dram1_alloc(UINT32 size);
UINT32* get_rom_base() { return m_rom; }
- UINT32* get_ext_dram0_base() { return m_ext_dram0; }
- UINT32* get_ext_dram1_base() { return m_ext_dram1; }
- UINT8* get_ext_bram_base() { return m_ext_bram; }
+ UINT32* get_ext_dram0_base() { return &m_ext_dram0[0]; }
+ UINT32* get_ext_dram1_base() { return &m_ext_dram1[0]; }
+ UINT8* get_ext_bram_base() { return &m_ext_bram[0]; }
UINT32 get_rom_size() { return m_rom_size; }
- UINT32 get_ext_dram0_size() { return m_ext_dram0.bytes(); }
- UINT32 get_ext_dram1_size() { return m_ext_dram1.bytes(); }
- UINT32 get_ext_bram_size() { return m_ext_bram.bytes(); }
+ UINT32 get_ext_dram0_size() { return m_ext_dram0.size()*sizeof(UINT32); }
+ UINT32 get_ext_dram1_size() { return m_ext_dram1.size()*sizeof(UINT32); }
+ UINT32 get_ext_bram_size() { return m_ext_bram.size(); }
protected:
int m_cart_type;
@@ -48,8 +48,8 @@ protected:
// internal state
UINT32 *m_rom;
UINT32 m_rom_size;
- dynamic_array<UINT32> m_ext_dram0;
- dynamic_array<UINT32> m_ext_dram1;
+ std::vector<UINT32> m_ext_dram0;
+ std::vector<UINT32> m_ext_dram1;
dynamic_buffer m_ext_bram;
};
diff --git a/src/emu/bus/scsi/s1410.c b/src/emu/bus/scsi/s1410.c
index 35e62e161f9..6672c0bd9a7 100644
--- a/src/emu/bus/scsi/s1410.c
+++ b/src/emu/bus/scsi/s1410.c
@@ -260,11 +260,11 @@ void s1410_device::ExecCommand()
if ((m_disk) && (m_blocks))
{
dynamic_buffer data(m_sector_bytes);
- memset(data, 0xc6, m_sector_bytes);
+ memset(&data[0], 0xc6, m_sector_bytes);
while (m_blocks > 0)
{
- if (!hard_disk_write(m_disk, m_lba, data))
+ if (!hard_disk_write(m_disk, m_lba, &data[0]))
{
logerror("S1410: HD write error!\n");
}
diff --git a/src/emu/bus/scv/slot.c b/src/emu/bus/scv/slot.c
index d41508e8781..bfad094a2ad 100644
--- a/src/emu/bus/scv/slot.c
+++ b/src/emu/bus/scv/slot.c
@@ -270,9 +270,9 @@ void scv_cart_slot_device::get_default_card_software(astring &result)
dynamic_buffer rom(len);
int type;
- core_fread(m_file, rom, len);
+ core_fread(m_file, &rom[0], len);
- type = get_cart_type(rom, len);
+ type = get_cart_type(&rom[0], len);
slot_string = scv_get_slot(type);
//printf("type: %s\n", slot_string);
diff --git a/src/emu/bus/scv/slot.h b/src/emu/bus/scv/slot.h
index 7db8b6eee9e..5d637275425 100644
--- a/src/emu/bus/scv/slot.h
+++ b/src/emu/bus/scv/slot.h
@@ -38,9 +38,9 @@ public:
void rom_alloc(UINT32 size, const char *tag);
void ram_alloc(UINT32 size);
UINT8* get_rom_base() { return m_rom; }
- UINT8* get_ram_base() { return m_ram; }
+ UINT8* get_ram_base() { return &m_ram[0]; }
UINT32 get_rom_size() { return m_rom_size; }
- UINT32 get_ram_size() { return m_ram.count(); }
+ UINT32 get_ram_size() { return m_ram.size(); }
void save_ram() { device().save_item(NAME(m_ram)); }
diff --git a/src/emu/bus/sega8/rom.c b/src/emu/bus/sega8/rom.c
index 33ebe932e07..116f7d14ee3 100644
--- a/src/emu/bus/sega8/rom.c
+++ b/src/emu/bus/sega8/rom.c
@@ -332,8 +332,8 @@ READ8_MEMBER(sega8_rom_device::read_cart)
{
int bank = offset / 0x4000;
- if (bank == 2 && m_ram && m_ram_enabled)
- return m_ram[(m_ram_base * 0x4000 + (offset & 0x3fff)) % m_ram.count()];
+ if (bank == 2 && !m_ram.empty() && m_ram_enabled)
+ return m_ram[(m_ram_base * 0x4000 + (offset & 0x3fff)) % m_ram.size()];
if (offset < 0x400) // first 1k is hardcoded
return m_rom[offset];
@@ -345,8 +345,8 @@ WRITE8_MEMBER(sega8_rom_device::write_cart)
{
int bank = offset / 0x4000;
- if (bank == 2 && m_ram && m_ram_enabled)
- m_ram[(m_ram_base * 0x4000 + (offset & 0x3fff)) % m_ram.count()] = data;
+ if (bank == 2 && !m_ram.empty() && m_ram_enabled)
+ m_ram[(m_ram_base * 0x4000 + (offset & 0x3fff)) % m_ram.size()] = data;
}
WRITE8_MEMBER(sega8_rom_device::write_mapper)
@@ -717,8 +717,8 @@ READ8_MEMBER(sega8_codemasters_device::read_cart)
{
int bank = offset / 0x2000;
- if (bank == 5 && m_ram && m_ram_enabled)
- return m_ram[(m_ram_base * 0x2000 + (offset & 0x1fff)) % m_ram.count()];
+ if (bank == 5 && !m_ram.empty() && m_ram_enabled)
+ return m_ram[(m_ram_base * 0x2000 + (offset & 0x1fff)) % m_ram.size()];
return m_rom[m_rom_bank_base[bank/2] * 0x4000 + (offset & 0x3fff)];
}
@@ -749,8 +749,8 @@ WRITE8_MEMBER(sega8_codemasters_device::write_cart)
break;
}
- if (bank == 5 && m_ram && m_ram_enabled)
- m_ram[(m_ram_base * 0x2000 + (offset & 0x1fff)) % m_ram.count()] = data;
+ if (bank == 5 && !m_ram.empty() && m_ram_enabled)
+ m_ram[(m_ram_base * 0x2000 + (offset & 0x1fff)) % m_ram.size()] = data;
}
/*-------------------------------------------------
@@ -799,8 +799,8 @@ READ8_MEMBER(sega8_zemina_device::read_cart)
{
int bank = offset / 0x2000;
- if (bank >= 4 && m_ram && m_ram_enabled)
- return m_ram[(m_ram_base * 0x2000 + (offset & 0x1fff)) % m_ram.count()];
+ if (bank >= 4 && !m_ram.empty() && m_ram_enabled)
+ return m_ram[(m_ram_base * 0x2000 + (offset & 0x1fff)) % m_ram.size()];
return m_rom[m_rom_bank_base[bank] * 0x2000 + (offset & 0x1fff)];
}
@@ -809,8 +809,8 @@ WRITE8_MEMBER(sega8_zemina_device::write_cart)
{
int bank = offset / 0x2000;
- if (bank >= 4 && m_ram && m_ram_enabled)
- m_ram[(m_ram_base * 0x2000 + (offset & 0x1fff)) % m_ram.count()] = data;
+ if (bank >= 4 && !m_ram.empty() && m_ram_enabled)
+ m_ram[(m_ram_base * 0x2000 + (offset & 0x1fff)) % m_ram.size()] = data;
if (offset < 4)
{
@@ -930,7 +930,7 @@ WRITE8_MEMBER(sega8_korean_device::write_cart)
{
int bank = offset / 0x4000;
- if (bank == 2 && m_ram && m_ram_enabled)
+ if (bank == 2 && !m_ram.empty() && m_ram_enabled)
m_ram[m_ram_base * 0x4000 + (offset & 0x3fff)] = data;
if (offset == 0xa000)
diff --git a/src/emu/bus/sega8/sega8_slot.c b/src/emu/bus/sega8/sega8_slot.c
index fef84a6b084..95eb98037d3 100644
--- a/src/emu/bus/sega8/sega8_slot.c
+++ b/src/emu/bus/sega8/sega8_slot.c
@@ -612,12 +612,12 @@ void sega8_cart_slot_device::get_default_card_software(astring &result)
dynamic_buffer rom(len);
int type;
- core_fread(m_file, rom, len);
+ core_fread(m_file, &rom[0], len);
if ((len % 0x4000) == 512)
offset = 512;
- type = get_cart_type(rom + offset, len - offset);
+ type = get_cart_type(&rom[offset], len - offset);
slot_string = sega8_get_slot(type);
//printf("type: %s\n", slot_string);
diff --git a/src/emu/bus/sega8/sega8_slot.h b/src/emu/bus/sega8/sega8_slot.h
index 8a1caf8df9f..6409d7d5796 100644
--- a/src/emu/bus/sega8/sega8_slot.h
+++ b/src/emu/bus/sega8/sega8_slot.h
@@ -65,9 +65,9 @@ public:
//protected:
UINT8* get_rom_base() { return m_rom; }
- UINT8* get_ram_base() { return m_ram; }
+ UINT8* get_ram_base() { return &m_ram[0]; }
UINT32 get_rom_size() { return m_rom_size; }
- UINT32 get_ram_size() { return m_ram.count(); }
+ UINT32 get_ram_size() { return m_ram.size(); }
void rom_map_setup(UINT32 size);
void ram_map_setup(UINT8 banks);
diff --git a/src/emu/bus/snes/event.c b/src/emu/bus/snes/event.c
index b6890241abc..80cf69bcd98 100644
--- a/src/emu/bus/snes/event.c
+++ b/src/emu/bus/snes/event.c
@@ -171,8 +171,8 @@ void sns_pfest94_device::speedup_addon_bios_access()
{
m_upd7725->space(AS_PROGRAM).install_read_bank(0x0000, 0x07ff, "dsp_prg");
m_upd7725->space(AS_DATA).install_read_bank(0x0000, 0x03ff, "dsp_data");
- membank("dsp_prg")->set_base(m_dsp_prg);
- membank("dsp_data")->set_base(m_dsp_data);
+ membank("dsp_prg")->set_base(&m_dsp_prg[0]);
+ membank("dsp_data")->set_base(&m_dsp_data[0]);
// copy data in the correct format
for (int x = 0; x < 0x800; x++)
m_dsp_prg[x] = (m_bios[x * 4] << 24) | (m_bios[x * 4 + 1] << 16) | (m_bios[x * 4 + 2] << 8) | 0x00;
@@ -184,12 +184,12 @@ void sns_pfest94_device::speedup_addon_bios_access()
// DSP dump contains prg at offset 0 and data at offset 0x2000
READ32_MEMBER( sns_pfest94_device::necdsp_prg_r )
{
- return get_prg(m_bios, offset);
+ return get_prg(&m_bios[0], offset);
}
READ16_MEMBER( sns_pfest94_device::necdsp_data_r )
{
- return get_data(m_bios, offset + 0x2000/2);
+ return get_data(&m_bios[0], offset + 0x2000/2);
}
diff --git a/src/emu/bus/snes/event.h b/src/emu/bus/snes/event.h
index 6660ec38997..ad115655a8e 100644
--- a/src/emu/bus/snes/event.h
+++ b/src/emu/bus/snes/event.h
@@ -41,8 +41,8 @@ private:
UINT8 m_status;
UINT32 m_count;
- dynamic_array<UINT32> m_dsp_prg;
- dynamic_array<UINT16> m_dsp_data;
+ std::vector<UINT32> m_dsp_prg;
+ std::vector<UINT16> m_dsp_data;
static const device_timer_id TIMER_EVENT = 0;
emu_timer *pfest94_timer;
diff --git a/src/emu/bus/snes/sa1.c b/src/emu/bus/snes/sa1.c
index 9b715d135e8..a7979bf64d8 100644
--- a/src/emu/bus/snes/sa1.c
+++ b/src/emu/bus/snes/sa1.c
@@ -823,11 +823,11 @@ UINT8 sns_sa1_device::read_bwram(UINT32 offset)
int shift = 0;
UINT8 mask = 0xff;
- if (!m_nvram)
+ if (m_nvram.empty())
return 0xff; // this should probably never happen, or are there SA-1 games with no BWRAM?
if (offset < 0x100000)
- return m_nvram[offset & (m_nvram.count() - 1)];
+ return m_nvram[offset & (m_nvram.size() - 1)];
// Bitmap BWRAM
offset -= 0x100000;
@@ -848,19 +848,19 @@ UINT8 sns_sa1_device::read_bwram(UINT32 offset)
}
// only return the correct bits
- return (m_nvram[offset & (m_nvram.count() - 1)] >> shift) & mask;
+ return (m_nvram[offset & (m_nvram.size() - 1)] >> shift) & mask;
}
void sns_sa1_device::write_bwram(UINT32 offset, UINT8 data)
{
UINT8 mask = 0xff;
- if (!m_nvram)
+ if (m_nvram.empty())
return; // this should probably never happen, or are there SA-1 games with no BWRAM?
if (offset < 0x100000)
{
- m_nvram[offset & (m_nvram.count() - 1)] = data;
+ m_nvram[offset & (m_nvram.size() - 1)] = data;
return;
}
@@ -883,7 +883,7 @@ void sns_sa1_device::write_bwram(UINT32 offset, UINT8 data)
}
// only change the correct bits, keeping the rest untouched
- m_nvram[offset & (m_nvram.count() - 1)] = (m_nvram[offset & (m_nvram.count() - 1)] & ~mask) | data;
+ m_nvram[offset & (m_nvram.size() - 1)] = (m_nvram[offset & (m_nvram.size() - 1)] & ~mask) | data;
}
diff --git a/src/emu/bus/snes/snes_slot.c b/src/emu/bus/snes/snes_slot.c
index 52878ecbe65..760f1b1e19d 100644
--- a/src/emu/bus/snes/snes_slot.c
+++ b/src/emu/bus/snes/snes_slot.c
@@ -613,8 +613,8 @@ bool base_sns_cart_slot_device::call_load()
{
UINT32 tmplen = length();
dynamic_buffer tmpROM(tmplen);
- fread(tmpROM, tmplen);
- offset = snes_skip_header(tmpROM, tmplen);
+ fread(&tmpROM[0], tmplen);
+ offset = snes_skip_header(&tmpROM[0], tmplen);
fseek(offset, SEEK_SET);
}
@@ -666,11 +666,11 @@ bool base_sns_cart_slot_device::call_load()
{
UINT32 tot_size = m_cart->get_nvram_size() + m_cart->get_rtc_ram_size();
dynamic_buffer temp_nvram(tot_size);
- battery_load(temp_nvram, tot_size, 0xff);
+ battery_load(&temp_nvram[0], tot_size, 0xff);
if (m_cart->get_nvram_size())
- memcpy(m_cart->get_nvram_base(), temp_nvram, m_cart->get_nvram_size());
+ memcpy(m_cart->get_nvram_base(), &temp_nvram[0], m_cart->get_nvram_size());
if (m_cart->get_rtc_ram_size())
- memcpy(m_cart->get_rtc_ram_base(), temp_nvram + m_cart->get_nvram_size(), m_cart->get_rtc_ram_size());
+ memcpy(m_cart->get_rtc_ram_base(), &temp_nvram[m_cart->get_nvram_size()], m_cart->get_rtc_ram_size());
}
//printf("Type %d\n", m_type);
@@ -697,11 +697,11 @@ void base_sns_cart_slot_device::call_unload()
UINT32 tot_size = m_cart->get_nvram_size() + m_cart->get_rtc_ram_size();
dynamic_buffer temp_nvram(tot_size);
if (m_cart->get_nvram_size())
- memcpy(temp_nvram, m_cart->get_nvram_base(), m_cart->get_nvram_size());
+ memcpy(&temp_nvram[0], m_cart->get_nvram_base(), m_cart->get_nvram_size());
if (m_cart->get_rtc_ram_size())
- memcpy(temp_nvram + m_cart->get_nvram_size(), m_cart->get_rtc_ram_base(), m_cart->get_rtc_ram_size());
+ memcpy(&temp_nvram[m_cart->get_nvram_size()], m_cart->get_rtc_ram_base(), m_cart->get_rtc_ram_size());
- battery_save(temp_nvram, tot_size);
+ battery_save(&temp_nvram[0], tot_size);
}
}
}
@@ -1011,11 +1011,11 @@ void base_sns_cart_slot_device::get_default_card_software(astring &result)
dynamic_buffer rom(len);
int type = 0, addon = 0;
- core_fread(m_file, rom, len);
+ core_fread(m_file, &rom[0], len);
- offset = snes_skip_header(rom, len);
+ offset = snes_skip_header(&rom[0], len);
- get_cart_type_addon(rom + offset, len - offset, type, addon);
+ get_cart_type_addon(&rom[offset], len - offset, type, addon);
// here we're from fullpath, so check if it's a DSP game which needs legacy device (i.e. it has no appended DSP dump)
switch (addon)
{
diff --git a/src/emu/bus/snes/snes_slot.h b/src/emu/bus/snes/snes_slot.h
index 7d440437eaa..eafba459ef0 100644
--- a/src/emu/bus/snes/snes_slot.h
+++ b/src/emu/bus/snes/snes_slot.h
@@ -103,10 +103,10 @@ public:
// reading and writing
virtual DECLARE_READ8_MEMBER(read_l) { return 0xff; } // ROM access in range [00-7f]
virtual DECLARE_READ8_MEMBER(read_h) { return 0xff; } // ROM access in range [80-ff]
- virtual DECLARE_READ8_MEMBER(read_ram) { if (m_nvram) { UINT32 mask = m_nvram.count() - 1; return m_nvram[offset & mask]; } else return 0xff; } // NVRAM access
+ virtual DECLARE_READ8_MEMBER(read_ram) { if (!m_nvram.empty()) return m_nvram[offset & (m_nvram.size()-1)]; else return 0xff; } // NVRAM access
virtual DECLARE_WRITE8_MEMBER(write_l) {} // used by carts with subslots
virtual DECLARE_WRITE8_MEMBER(write_h) {} // used by carts with subslots
- virtual DECLARE_WRITE8_MEMBER(write_ram) { if (m_nvram) { UINT32 mask = m_nvram.count() - 1; m_nvram[offset & mask] = data; return; } } // NVRAM access
+ virtual DECLARE_WRITE8_MEMBER(write_ram) { if (!m_nvram.empty()) m_nvram[offset & (m_nvram.size()-1)] = data; } // NVRAM access
virtual DECLARE_READ8_MEMBER(chip_read) { return 0xff; }
virtual DECLARE_WRITE8_MEMBER(chip_write) {}
virtual void speedup_addon_bios_access() {};
@@ -116,13 +116,13 @@ public:
void rtc_ram_alloc(UINT32 size);
void addon_bios_alloc(UINT32 size);
UINT8* get_rom_base() { return m_rom; };
- UINT8* get_nvram_base() { return m_nvram; };
- UINT8* get_addon_bios_base() { return m_bios; };
- UINT8* get_rtc_ram_base() { return m_rtc_ram; };
+ UINT8* get_nvram_base() { return &m_nvram[0]; };
+ UINT8* get_addon_bios_base() { return &m_bios[0]; };
+ UINT8* get_rtc_ram_base() { return &m_rtc_ram[0]; };
UINT32 get_rom_size() { return m_rom_size; };
- UINT32 get_nvram_size() { return m_nvram.count(); };
- UINT32 get_addon_bios_size() { return m_bios.count(); };
- UINT32 get_rtc_ram_size() { return m_rtc_ram.count(); };
+ UINT32 get_nvram_size() { return m_nvram.size(); };
+ UINT32 get_addon_bios_size() { return m_bios.size(); };
+ UINT32 get_rtc_ram_size() { return m_rtc_ram.size(); };
void rom_map_setup(UINT32 size);
void save_nvram() { device().save_item(NAME(m_nvram)); }
diff --git a/src/emu/bus/snes/upd.c b/src/emu/bus/snes/upd.c
index 4cbd08b7e2b..808bcabdbf5 100644
--- a/src/emu/bus/snes/upd.c
+++ b/src/emu/bus/snes/upd.c
@@ -105,12 +105,12 @@ void sns_rom_setadsp_device::device_start()
// DSP dump contains prg at offset 0 and data at offset 0x2000
READ32_MEMBER( sns_rom20_necdsp_device::necdsp_prg_r )
{
- return get_prg(m_bios, offset);
+ return get_prg(&m_bios[0], offset);
}
READ16_MEMBER( sns_rom20_necdsp_device::necdsp_data_r )
{
- return get_data(m_bios, offset + 0x2000/2);
+ return get_data(&m_bios[0], offset + 0x2000/2);
}
@@ -171,12 +171,12 @@ WRITE8_MEMBER( sns_rom20_necdsp_device::chip_write )
// DSP dump contains prg at offset 0 and data at offset 0x2000
READ32_MEMBER( sns_rom21_necdsp_device::necdsp_prg_r )
{
- return get_prg(m_bios, offset);
+ return get_prg(&m_bios[0], offset);
}
READ16_MEMBER( sns_rom21_necdsp_device::necdsp_data_r )
{
- return get_data(m_bios, offset + 0x2000/2);
+ return get_data(&m_bios[0], offset + 0x2000/2);
}
@@ -290,12 +290,12 @@ WRITE8_MEMBER( sns_rom_setadsp_device::chip_write )
// DSP dump contains prg at offset 0 and data at offset 0x10000
READ32_MEMBER( sns_rom_setadsp_device::setadsp_prg_r )
{
- return get_prg(m_bios, offset);
+ return get_prg(&m_bios[0], offset);
}
READ16_MEMBER( sns_rom_setadsp_device::setadsp_data_r )
{
- return get_data(m_bios, offset + 0x10000/2);
+ return get_data(&m_bios[0], offset + 0x10000/2);
}
@@ -359,8 +359,8 @@ void sns_rom20_necdsp_device::speedup_addon_bios_access()
{
m_upd7725->space(AS_PROGRAM).install_read_bank(0x0000, 0x07ff, "dsp_prg");
m_upd7725->space(AS_DATA).install_read_bank(0x0000, 0x03ff, "dsp_data");
- membank("dsp_prg")->set_base(m_dsp_prg);
- membank("dsp_data")->set_base(m_dsp_data);
+ membank("dsp_prg")->set_base(&m_dsp_prg[0]);
+ membank("dsp_data")->set_base(&m_dsp_data[0]);
// copy data in the correct format
for (int x = 0; x < 0x800; x++)
m_dsp_prg[x] = (m_bios[x * 4] << 24) | (m_bios[x * 4 + 1] << 16) | (m_bios[x * 4 + 2] << 8) | 0x00;
@@ -372,8 +372,8 @@ void sns_rom21_necdsp_device::speedup_addon_bios_access()
{
m_upd7725->space(AS_PROGRAM).install_read_bank(0x0000, 0x07ff, "dsp_prg");
m_upd7725->space(AS_DATA).install_read_bank(0x0000, 0x03ff, "dsp_data");
- membank("dsp_prg")->set_base(m_dsp_prg);
- membank("dsp_data")->set_base(m_dsp_data);
+ membank("dsp_prg")->set_base(&m_dsp_prg[0]);
+ membank("dsp_data")->set_base(&m_dsp_data[0]);
// copy data in the correct format
for (int x = 0; x < 0x800; x++)
m_dsp_prg[x] = (m_bios[x * 4] << 24) | (m_bios[x * 4 + 1] << 16) | (m_bios[x * 4 + 2] << 8) | 0x00;
@@ -385,8 +385,8 @@ void sns_rom_setadsp_device::speedup_addon_bios_access()
{
m_upd96050->space(AS_PROGRAM).install_read_bank(0x0000, 0x3fff, "dsp_prg");
m_upd96050->space(AS_DATA).install_read_bank(0x0000, 0x07ff, "dsp_data");
- membank("dsp_prg")->set_base(m_dsp_prg);
- membank("dsp_data")->set_base(m_dsp_data);
+ membank("dsp_prg")->set_base(&m_dsp_prg[0]);
+ membank("dsp_data")->set_base(&m_dsp_data[0]);
// copy data in the correct format
for (int x = 0; x < 0x3fff; x++)
m_dsp_prg[x] = (m_bios[x * 4] << 24) | (m_bios[x * 4 + 1] << 16) | (m_bios[x * 4 + 2] << 8) | 0x00;
diff --git a/src/emu/bus/snes/upd.h b/src/emu/bus/snes/upd.h
index f9ce1e53d9e..919cb1b1cb9 100644
--- a/src/emu/bus/snes/upd.h
+++ b/src/emu/bus/snes/upd.h
@@ -29,8 +29,8 @@ public:
virtual DECLARE_READ32_MEMBER(necdsp_prg_r);
virtual DECLARE_READ16_MEMBER(necdsp_data_r);
- dynamic_array<UINT32> m_dsp_prg;
- dynamic_array<UINT16> m_dsp_data;
+ std::vector<UINT32> m_dsp_prg;
+ std::vector<UINT16> m_dsp_data;
};
// ======================> sns_rom21_necdsp_device
@@ -56,8 +56,8 @@ public:
virtual DECLARE_READ32_MEMBER(necdsp_prg_r);
virtual DECLARE_READ16_MEMBER(necdsp_data_r);
- dynamic_array<UINT32> m_dsp_prg;
- dynamic_array<UINT16> m_dsp_data;
+ std::vector<UINT32> m_dsp_prg;
+ std::vector<UINT16> m_dsp_data;
};
// ======================> sns_rom_setadsp_device
@@ -81,8 +81,8 @@ public:
virtual DECLARE_READ32_MEMBER(setadsp_prg_r);
virtual DECLARE_READ16_MEMBER(setadsp_data_r);
- dynamic_array<UINT32> m_dsp_prg;
- dynamic_array<UINT16> m_dsp_data;
+ std::vector<UINT32> m_dsp_prg;
+ std::vector<UINT16> m_dsp_data;
};
// ======================> sns_rom_seta10dsp_device
diff --git a/src/emu/bus/ti99_peb/tn_usbsm.h b/src/emu/bus/ti99_peb/tn_usbsm.h
index f796ca33867..40469335234 100644
--- a/src/emu/bus/ti99_peb/tn_usbsm.h
+++ b/src/emu/bus/ti99_peb/tn_usbsm.h
@@ -51,7 +51,7 @@ private:
UINT16 m_input_latch;
UINT16 m_output_latch;
- dynamic_array<UINT16> m_ram;
+ std::vector<UINT16> m_ram;
required_device<smartmedia_image_device> m_smartmedia;
required_device<strataflash_device> m_flash;
diff --git a/src/emu/bus/vboy/slot.h b/src/emu/bus/vboy/slot.h
index afa33c600d4..9661716ce14 100644
--- a/src/emu/bus/vboy/slot.h
+++ b/src/emu/bus/vboy/slot.h
@@ -33,9 +33,9 @@ public:
void rom_alloc(UINT32 size, const char *tag);
void eeprom_alloc(UINT32 size);
UINT32* get_rom_base() { return m_rom; }
- UINT32* get_eeprom_base() { return m_eeprom; }
+ UINT32* get_eeprom_base() { return &m_eeprom[0]; }
UINT32 get_rom_size() { return m_rom_size; }
- UINT32 get_eeprom_size() { return m_eeprom.count(); }
+ UINT32 get_eeprom_size() { return m_eeprom.size(); }
void save_eeprom() { device().save_item(NAME(m_eeprom)); }
@@ -44,7 +44,7 @@ protected:
UINT32 *m_rom;
UINT32 m_rom_size;
UINT32 m_rom_mask;
- dynamic_array<UINT32> m_eeprom;
+ std::vector<UINT32> m_eeprom;
};
diff --git a/src/emu/bus/vc4000/rom.c b/src/emu/bus/vc4000/rom.c
index ebca01360f8..cb0cc577fe7 100644
--- a/src/emu/bus/vc4000/rom.c
+++ b/src/emu/bus/vc4000/rom.c
@@ -241,12 +241,12 @@ READ8_MEMBER(vc4000_rom_device::read_rom)
READ8_MEMBER(vc4000_ram1k_device::read_ram)
{
- return m_ram[offset & (m_ram.count() - 1)];
+ return m_ram[offset & (m_ram.size() - 1)];
}
WRITE8_MEMBER(vc4000_ram1k_device::write_ram)
{
- m_ram[offset & (m_ram.count() - 1)] = data;
+ m_ram[offset & (m_ram.size() - 1)] = data;
}
@@ -260,10 +260,10 @@ READ8_MEMBER(vc4000_chess2_device::extra_rom)
READ8_MEMBER(vc4000_chess2_device::read_ram)
{
- return m_ram[offset & (m_ram.count() - 1)];
+ return m_ram[offset & (m_ram.size() - 1)];
}
WRITE8_MEMBER(vc4000_chess2_device::write_ram)
{
- m_ram[offset & (m_ram.count() - 1)] = data;
+ m_ram[offset & (m_ram.size() - 1)] = data;
}
diff --git a/src/emu/bus/vc4000/slot.h b/src/emu/bus/vc4000/slot.h
index d965d13d0ba..3749801d4b6 100644
--- a/src/emu/bus/vc4000/slot.h
+++ b/src/emu/bus/vc4000/slot.h
@@ -36,9 +36,9 @@ public:
void rom_alloc(UINT32 size, const char *tag);
void ram_alloc(UINT32 size);
UINT8* get_rom_base() { return m_rom; }
- UINT8* get_ram_base() { return m_ram; }
+ UINT8* get_ram_base() { return &m_ram[0]; }
UINT32 get_rom_size() { return m_rom_size; }
- UINT32 get_ram_size() { return m_ram.count(); }
+ UINT32 get_ram_size() { return m_ram.size(); }
void save_ram() { device().save_item(NAME(m_ram)); }
diff --git a/src/emu/bus/vcs/rom.c b/src/emu/bus/vcs/rom.c
index f9cc271b316..5444e5f5534 100755
--- a/src/emu/bus/vcs/rom.c
+++ b/src/emu/bus/vcs/rom.c
@@ -327,9 +327,9 @@ void a26_rom_32in1_device::device_reset()
READ8_MEMBER(a26_rom_2k_device::read_rom)
{
// Super Chip RAM reads are mapped in 0x1080-0x10ff
- if (m_ram && offset >= 0x80 && offset < 0x100)
+ if (!m_ram.empty() && offset >= 0x80 && offset < 0x100)
{
- return m_ram[offset & (m_ram.count() - 1)];
+ return m_ram[offset & (m_ram.size() - 1)];
}
return m_rom[offset & (m_rom_size - 1)];
@@ -346,9 +346,9 @@ READ8_MEMBER(a26_rom_2k_device::read_rom)
READ8_MEMBER(a26_rom_f4_device::read_rom)
{
// Super Chip RAM reads are mapped in 0x1080-0x10ff
- if (m_ram && offset >= 0x80 && offset < 0x100)
+ if (!m_ram.empty() && offset >= 0x80 && offset < 0x100)
{
- return m_ram[offset & (m_ram.count() - 1)];
+ return m_ram[offset & (m_ram.size() - 1)];
}
// update banks
@@ -375,9 +375,9 @@ READ8_MEMBER(a26_rom_f4_device::read_rom)
WRITE8_MEMBER(a26_rom_f4_device::write_bank)
{
// Super Chip RAM writes are mapped in 0x1000-0x107f
- if (m_ram && offset < 0x80)
+ if (!m_ram.empty() && offset < 0x80)
{
- m_ram[offset & (m_ram.count() - 1)] = data;
+ m_ram[offset & (m_ram.size() - 1)] = data;
return;
}
@@ -412,9 +412,9 @@ WRITE8_MEMBER(a26_rom_f4_device::write_bank)
READ8_MEMBER(a26_rom_f6_device::read_rom)
{
// Super Chip RAM reads are mapped in 0x1080-0x10ff
- if (m_ram && offset >= 0x80 && offset < 0x100)
+ if (!m_ram.empty() && offset >= 0x80 && offset < 0x100)
{
- return m_ram[offset & (m_ram.count() - 1)];
+ return m_ram[offset & (m_ram.size() - 1)];
}
// update banks
@@ -437,9 +437,9 @@ READ8_MEMBER(a26_rom_f6_device::read_rom)
WRITE8_MEMBER(a26_rom_f6_device::write_bank)
{
// Super Chip RAM writes are mapped in 0x1000-0x107f
- if (m_ram && offset < 0x80)
+ if (!m_ram.empty() && offset < 0x80)
{
- m_ram[offset & (m_ram.count() - 1)] = data;
+ m_ram[offset & (m_ram.size() - 1)] = data;
return;
}
@@ -480,9 +480,9 @@ DIRECT_UPDATE_MEMBER(a26_rom_f6_device::cart_opbase)
READ8_MEMBER(a26_rom_f8_device::read_rom)
{
// Super Chip RAM reads are mapped in 0x1080-0x10ff
- if (m_ram && offset >= 0x80 && offset < 0x100)
+ if (!m_ram.empty() && offset >= 0x80 && offset < 0x100)
{
- return m_ram[offset & (m_ram.count() - 1)];
+ return m_ram[offset & (m_ram.size() - 1)];
}
// update banks
@@ -503,9 +503,9 @@ READ8_MEMBER(a26_rom_f8_device::read_rom)
WRITE8_MEMBER(a26_rom_f8_device::write_bank)
{
// Super Chip RAM writes are mapped in 0x1000-0x107f
- if (m_ram && offset < 0x80)
+ if (!m_ram.empty() && offset < 0x80)
{
- m_ram[offset & (m_ram.count() - 1)] = data;
+ m_ram[offset & (m_ram.size() - 1)] = data;
return;
}
@@ -536,9 +536,9 @@ WRITE8_MEMBER(a26_rom_f8_device::write_bank)
READ8_MEMBER(a26_rom_fa_device::read_rom)
{
// CBS RAM+ reads are mapped in 0x1100-0x11ff
- if (m_ram && offset >= 0x100 && offset < 0x200)
+ if (!m_ram.empty() && offset >= 0x100 && offset < 0x200)
{
- return m_ram[offset & (m_ram.count() - 1)];
+ return m_ram[offset & (m_ram.size() - 1)];
}
// update banks
@@ -560,9 +560,9 @@ READ8_MEMBER(a26_rom_fa_device::read_rom)
WRITE8_MEMBER(a26_rom_fa_device::write_bank)
{
// CBS RAM+ writes are mapped in 0x1000-0x10ff
- if (m_ram && offset < 0x100)
+ if (!m_ram.empty() && offset < 0x100)
{
- m_ram[offset & (m_ram.count() - 1)] = data;
+ m_ram[offset & (m_ram.size() - 1)] = data;
}
switch (offset)
@@ -603,9 +603,9 @@ READ8_MEMBER(a26_rom_fe_device::read_rom)
UINT8 data;
// Super Chip RAM reads are mapped in 0x1080-0x10ff
- if (m_ram && offset >= 0x80 && offset < 0x100)
+ if (!m_ram.empty() && offset >= 0x80 && offset < 0x100)
{
- return m_ram[offset & (m_ram.count() - 1)];
+ return m_ram[offset & (m_ram.size() - 1)];
}
data = m_rom[offset + (m_base_bank * 0x1000)];
@@ -625,9 +625,9 @@ READ8_MEMBER(a26_rom_fe_device::read_rom)
WRITE8_MEMBER(a26_rom_fe_device::write_ram)
{
// Super Chip RAM writes are mapped in 0x1000-0x107f
- if (m_ram && offset < 0x80)
+ if (!m_ram.empty() && offset < 0x80)
{
- m_ram[offset & (m_ram.count() - 1)] = data;
+ m_ram[offset & (m_ram.size() - 1)] = data;
}
}
@@ -678,7 +678,7 @@ WRITE8_MEMBER(a26_rom_fe_device::write_bank)
READ8_MEMBER(a26_rom_3e_device::read_rom)
{
- if (m_ram && m_ram_enable && offset < 0x400)
+ if (!m_ram.empty() && m_ram_enable && offset < 0x400)
return m_ram[offset + (m_ram_bank * 0x400)];
if (offset >= 0x800)
@@ -703,7 +703,7 @@ WRITE8_MEMBER(a26_rom_3e_device::write_bank)
WRITE8_MEMBER(a26_rom_3e_device::write_ram)
{
- if (m_ram && m_ram_enable && offset >= 0x400 && offset < 0x800)
+ if (!m_ram.empty() && m_ram_enable && offset >= 0x400 && offset < 0x800)
m_ram[(offset & 0x3ff) + (m_ram_bank * 0x400)] = data;
}
@@ -792,7 +792,7 @@ READ8_MEMBER(a26_rom_e7_device::read_rom)
m_ram_bank = offset - 0xfe8;
}
- if (m_ram)
+ if (!m_ram.empty())
{
// 1K of RAM
if (m_base_bank == 0x07 && offset >= 0x400 && offset < 0x800)
@@ -818,7 +818,7 @@ WRITE8_MEMBER(a26_rom_e7_device::write_bank)
if (offset >= 0xfe8 && offset <= 0xfeb)
m_ram_bank = offset - 0xfe8;
- if (m_ram)
+ if (!m_ram.empty())
{
// 1K of RAM
if (m_base_bank == 0x07 && offset < 0x400)
@@ -874,9 +874,9 @@ WRITE8_MEMBER(a26_rom_ua_device::write_bank)
READ8_MEMBER(a26_rom_cv_device::read_rom)
{
- if (m_ram && offset < 0x400)
+ if (!m_ram.empty() && offset < 0x400)
{
- return m_ram[offset & (m_ram.count() - 1)];
+ return m_ram[offset & (m_ram.size() - 1)];
}
// games shall not read from 0x1400-0x17ff (RAM write)
@@ -886,9 +886,9 @@ READ8_MEMBER(a26_rom_cv_device::read_rom)
WRITE8_MEMBER(a26_rom_cv_device::write_bank)
{
- if (m_ram && offset >= 0x400 && offset < 0x800)
+ if (!m_ram.empty() && offset >= 0x400 && offset < 0x800)
{
- m_ram[offset & (m_ram.count() - 1)] = data;
+ m_ram[offset & (m_ram.size() - 1)] = data;
}
}
diff --git a/src/emu/bus/vcs/vcs_slot.c b/src/emu/bus/vcs/vcs_slot.c
index dfcf8bd9a63..26086333a9a 100755
--- a/src/emu/bus/vcs/vcs_slot.c
+++ b/src/emu/bus/vcs/vcs_slot.c
@@ -788,9 +788,9 @@ void vcs_cart_slot_device::get_default_card_software(astring &result)
dynamic_buffer rom(len);
int type;
- core_fread(m_file, rom, len);
+ core_fread(m_file, &rom[0], len);
- type = identify_cart_type(rom, len);
+ type = identify_cart_type(&rom[0], len);
slot_string = vcs_get_slot(type);
clear();
diff --git a/src/emu/bus/vcs/vcs_slot.h b/src/emu/bus/vcs/vcs_slot.h
index 3d393395f5a..e9a6b2ba60b 100755
--- a/src/emu/bus/vcs/vcs_slot.h
+++ b/src/emu/bus/vcs/vcs_slot.h
@@ -62,9 +62,9 @@ public:
void rom_alloc(UINT32 size, const char *tag);
void ram_alloc(UINT32 size);
UINT8* get_rom_base() { return m_rom; }
- UINT8* get_ram_base() { return m_ram; }
+ UINT8* get_ram_base() { return &m_ram[0]; }
UINT32 get_rom_size() { return m_rom_size; }
- UINT32 get_ram_size() { return m_ram.bytes(); }
+ UINT32 get_ram_size() { return m_ram.size(); }
protected:
// internal state
diff --git a/src/emu/bus/vectrex/slot.c b/src/emu/bus/vectrex/slot.c
index 16120b850ca..6af9228f56c 100644
--- a/src/emu/bus/vectrex/slot.c
+++ b/src/emu/bus/vectrex/slot.c
@@ -228,9 +228,9 @@ void vectrex_cart_slot_device::get_default_card_software(astring &result)
dynamic_buffer rom(size);
int type = VECTREX_STD;
- core_fread(m_file, rom, size);
+ core_fread(m_file, &rom[0], size);
- if (!memcmp(rom + 0x06, "SRAM", 4))
+ if (!memcmp(&rom[0x06], "SRAM", 4))
type = VECTREX_SRAM;
if (size > 0x8000)
type = VECTREX_64K;
diff --git a/src/emu/bus/vidbrain/exp.c b/src/emu/bus/vidbrain/exp.c
index e470023800c..eaac1a18155 100644
--- a/src/emu/bus/vidbrain/exp.c
+++ b/src/emu/bus/vidbrain/exp.c
@@ -52,14 +52,14 @@ device_videobrain_expansion_card_interface::device_videobrain_expansion_card_int
UINT8* device_videobrain_expansion_card_interface::videobrain_rom_pointer(running_machine &machine, size_t size)
{
- if (m_rom.count() == 0)
+ if (m_rom.empty())
{
m_rom.resize(size);
m_rom_mask = size - 1;
}
- return m_rom;
+ return &m_rom[0];
}
@@ -69,14 +69,14 @@ UINT8* device_videobrain_expansion_card_interface::videobrain_rom_pointer(runnin
UINT8* device_videobrain_expansion_card_interface::videobrain_ram_pointer(running_machine &machine, size_t size)
{
- if (m_ram.count() == 0)
+ if (m_ram.empty())
{
m_ram.resize(size);
m_ram_mask = size - 1;
}
- return m_ram;
+ return &m_ram[0];
}
diff --git a/src/emu/bus/vtech/memexp/memory.c b/src/emu/bus/vtech/memexp/memory.c
index 0d52e18ab0d..11f1aeaaf4c 100644
--- a/src/emu/bus/vtech/memexp/memory.c
+++ b/src/emu/bus/vtech/memexp/memory.c
@@ -49,7 +49,7 @@ void laser110_16k_device::device_start()
void laser110_16k_device::device_reset()
{
- m_slot->m_program->install_ram(0x8000, 0xbfff, m_ram);
+ m_slot->m_program->install_ram(0x8000, 0xbfff, &m_ram[0]);
}
@@ -82,7 +82,7 @@ void laser210_16k_device::device_start()
void laser210_16k_device::device_reset()
{
- m_slot->m_program->install_ram(0x9000, 0xcfff, m_ram);
+ m_slot->m_program->install_ram(0x9000, 0xcfff, &m_ram[0]);
}
@@ -115,7 +115,7 @@ void laser310_16k_device::device_start()
void laser310_16k_device::device_reset()
{
- m_slot->m_program->install_ram(0xb800, 0xf7ff, m_ram);
+ m_slot->m_program->install_ram(0xb800, 0xf7ff, &m_ram[0]);
}
@@ -149,12 +149,12 @@ void laser_64k_device::device_start()
void laser_64k_device::device_reset()
{
// fixed first bank
- m_slot->m_program->install_ram(0x8000, 0xbfff, m_ram);
+ m_slot->m_program->install_ram(0x8000, 0xbfff, &m_ram[0]);
// other banks
m_slot->m_program->install_readwrite_bank(0xc000, 0xffff, tag());
- membank(tag())->configure_entries(0, 4, m_ram, 0x4000);
+ membank(tag())->configure_entries(0, 4, &m_ram[0], 0x4000);
membank(tag())->set_entry(1);
// bank switch
diff --git a/src/emu/bus/vtech/memexp/memory.h b/src/emu/bus/vtech/memexp/memory.h
index 37b77126e1a..b51bdeb60e0 100644
--- a/src/emu/bus/vtech/memexp/memory.h
+++ b/src/emu/bus/vtech/memexp/memory.h
@@ -33,7 +33,7 @@ protected:
virtual void device_reset();
private:
- dynamic_array<UINT8> m_ram;
+ std::vector<UINT8> m_ram;
};
// ======================> laser210_16k_device
@@ -49,7 +49,7 @@ protected:
virtual void device_reset();
private:
- dynamic_array<UINT8> m_ram;
+ std::vector<UINT8> m_ram;
};
// ======================> laser310_16k_device
@@ -65,7 +65,7 @@ protected:
virtual void device_reset();
private:
- dynamic_array<UINT8> m_ram;
+ std::vector<UINT8> m_ram;
};
// ======================> laser_64k_device
@@ -83,7 +83,7 @@ protected:
virtual void device_reset();
private:
- dynamic_array<UINT8> m_ram;
+ std::vector<UINT8> m_ram;
};
// device type definition
diff --git a/src/emu/bus/wswan/rom.c b/src/emu/bus/wswan/rom.c
index 1bac91a4a5d..480df9bce35 100644
--- a/src/emu/bus/wswan/rom.c
+++ b/src/emu/bus/wswan/rom.c
@@ -125,7 +125,7 @@ void ws_rom_eeprom_device::device_reset()
m_eeprom_command = 0;
m_eeprom_start = 0;
m_eeprom_write_enabled = 0;
- switch (m_nvram.count())
+ switch (m_nvram.size())
{
case 0x80:
m_eeprom_mode = EEPROM_1K;
@@ -343,7 +343,7 @@ WRITE8_MEMBER(ws_rom_sram_device::write_io)
switch (offset)
{
case 0x01: // SRAM bank to select
- m_nvram_base = (data * 0x10000) & (m_nvram.count() - 1);
+ m_nvram_base = (data * 0x10000) & (m_nvram.size() - 1);
default:
ws_rom_device::write_io(space, offset, data);
break;
diff --git a/src/emu/bus/wswan/slot.c b/src/emu/bus/wswan/slot.c
index d64aa84f3ca..6acc8292d18 100644
--- a/src/emu/bus/wswan/slot.c
+++ b/src/emu/bus/wswan/slot.c
@@ -316,10 +316,10 @@ void ws_cart_slot_device::get_default_card_software(astring &result)
int type;
UINT32 nvram;
- core_fread(m_file, rom, size);
+ core_fread(m_file, &rom[0], size);
// nvram size is not really used here, but we set it up nevertheless
- type = get_cart_type(rom, size, nvram);
+ type = get_cart_type(&rom[0], size, nvram);
slot_string = ws_get_slot(type);
//printf("type: %s\n", slot_string);
diff --git a/src/emu/bus/wswan/slot.h b/src/emu/bus/wswan/slot.h
index 97e838be793..94c093d0b05 100644
--- a/src/emu/bus/wswan/slot.h
+++ b/src/emu/bus/wswan/slot.h
@@ -36,9 +36,9 @@ public:
void rom_alloc(UINT32 size, const char *tag);
void nvram_alloc(UINT32 size);
UINT8* get_rom_base() { return m_rom; }
- UINT8* get_nvram_base() { return m_nvram; }
+ UINT8* get_nvram_base() { return &m_nvram[0]; }
UINT32 get_rom_size() { return m_rom_size; }
- UINT32 get_nvram_size() { return m_nvram.count(); }
+ UINT32 get_nvram_size() { return m_nvram.size(); }
void save_nvram() { device().save_item(NAME(m_nvram)); }
void set_has_rtc(bool val) { m_has_rtc = val; }
diff --git a/src/emu/clifront.c b/src/emu/clifront.c
index b52b54b7d25..da44830a67c 100644
--- a/src/emu/clifront.c
+++ b/src/emu/clifront.c
@@ -584,15 +584,15 @@ void cli_frontend::listdevices(const char *gamename)
// build a list of devices
device_iterator iter(drivlist.config().root_device());
- dynamic_array<device_t *> device_list;
+ std::vector<device_t *> device_list;
for (device_t *device = iter.first(); device != NULL; device = iter.next())
- device_list.append(device);
+ device_list.push_back(device);
// sort them by tag
- qsort(&device_list[0], device_list.count(), sizeof(device_list[0]), compare_devices);
+ qsort(&device_list[0], device_list.size(), sizeof(device_list[0]), compare_devices);
// dump the results
- for (int index = 0; index < device_list.count(); index++)
+ for (unsigned int index = 0; index < device_list.size(); index++)
{
device_t *device = device_list[index];
@@ -1708,11 +1708,11 @@ void media_identifier::identify(const char *filename)
const CSzFileItem *f = _7z->db.db.Files + i;
_7z->curr_file_idx = i;
int namelen = SzArEx_GetFileNameUtf16(&_7z->db, i, NULL);
- dynamic_array<UINT16> temp(namelen);
+ std::vector<UINT16> temp(namelen);
dynamic_buffer temp2(namelen+1);
- UINT8* temp3 = (UINT8*)temp2;
+ UINT8* temp3 = &temp2[0];
memset(temp3, 0x00, namelen);
- SzArEx_GetFileNameUtf16(&_7z->db, i, temp);
+ SzArEx_GetFileNameUtf16(&_7z->db, i, &temp[0]);
// crude, need real UTF16->UTF8 conversion ideally
for (int j=0;j<namelen;j++)
{
@@ -1723,9 +1723,9 @@ void media_identifier::identify(const char *filename)
{
// decompress data into RAM and identify it
dynamic_buffer data(f->Size);
- _7zerr = _7z_file_decompress(_7z, data, f->Size);
+ _7zerr = _7z_file_decompress(_7z, &data[0], f->Size);
if (_7zerr == _7ZERR_NONE)
- identify_data((const char*)&temp2[0], data, f->Size);
+ identify_data((const char*)&temp2[0], &data[0], f->Size);
}
}
@@ -1749,9 +1749,9 @@ void media_identifier::identify(const char *filename)
{
// decompress data into RAM and identify it
dynamic_buffer data(entry->uncompressed_length);
- ziperr = zip_file_decompress(zip, data, entry->uncompressed_length);
+ ziperr = zip_file_decompress(zip, &data[0], entry->uncompressed_length);
if (ziperr == ZIPERR_NONE)
- identify_data(entry->filename, data, entry->uncompressed_length);
+ identify_data(entry->filename, &data[0], entry->uncompressed_length);
}
// close up
@@ -1844,8 +1844,8 @@ void media_identifier::identify_data(const char *name, const UINT8 *data, int le
// now determine the new data length and allocate temporary memory for it
length = jedbin_output(&jed, NULL, 0);
tempjed.resize(length);
- jedbin_output(&jed, tempjed, length);
- data = tempjed;
+ jedbin_output(&jed, &tempjed[0], length);
+ data = &tempjed[0];
}
// compute the hash of the data
diff --git a/src/emu/cpu/drcfe.h b/src/emu/cpu/drcfe.h
index 24438ff4f61..67c67067221 100644
--- a/src/emu/cpu/drcfe.h
+++ b/src/emu/cpu/drcfe.h
@@ -157,7 +157,7 @@ private:
// opcode descriptor arrays
simple_list<opcode_desc> m_desc_live_list; // list of live descriptions
fixed_allocator<opcode_desc> m_desc_allocator; // fixed allocator for descriptions
- dynamic_array<opcode_desc *> m_desc_array; // array of descriptions in PC order
+ std::vector<opcode_desc *> m_desc_array; // array of descriptions in PC order
};
diff --git a/src/emu/cpu/drcuml.c b/src/emu/cpu/drcuml.c
index 7537d220ae4..6d698e265b3 100644
--- a/src/emu/cpu/drcuml.c
+++ b/src/emu/cpu/drcuml.c
@@ -340,7 +340,7 @@ void drcuml_block::end()
disassemble();
// generate the code via the back-end
- m_drcuml.generate(*this, m_inst, m_nextinst);
+ m_drcuml.generate(*this, &m_inst[0], m_nextinst);
// block is no longer in use
m_inuse = false;
diff --git a/src/emu/cpu/drcuml.h b/src/emu/cpu/drcuml.h
index aef1f5c76ff..98074e2424f 100644
--- a/src/emu/cpu/drcuml.h
+++ b/src/emu/cpu/drcuml.h
@@ -128,7 +128,7 @@ private:
drcuml_block * m_next; // pointer to next block
UINT32 m_nextinst; // next instruction to fill in the cache
UINT32 m_maxinst; // maximum number of instructions
- dynamic_array<uml::instruction> m_inst; // pointer to the instruction list
+ std::vector<uml::instruction> m_inst; // pointer to the instruction list
bool m_inuse; // this block is in use
};
diff --git a/src/emu/cpu/esrip/esrip.h b/src/emu/cpu/esrip/esrip.h
index 04f581050db..d772d37b093 100644
--- a/src/emu/cpu/esrip/esrip.h
+++ b/src/emu/cpu/esrip/esrip.h
@@ -200,7 +200,7 @@ protected:
UINT8 m_optable[65536];
- dynamic_array<UINT16> m_ipt_ram;
+ std::vector<UINT16> m_ipt_ram;
UINT8 *m_lbrm;
address_space *m_program;
diff --git a/src/emu/cpu/mips/r3000.c b/src/emu/cpu/mips/r3000.c
index 851c6075268..4214857f5b9 100644
--- a/src/emu/cpu/mips/r3000.c
+++ b/src/emu/cpu/mips/r3000.c
@@ -257,7 +257,7 @@ void r3000_device::device_start()
m_icache.resize(m_icache_size/4);
m_dcache.resize(m_dcache_size/4);
- m_cache = m_dcache;
+ m_cache = &m_dcache[0];
m_cache_size = m_dcache_size;
// set up memory handlers
@@ -712,9 +712,9 @@ inline void r3000_device::set_cop0_reg(int idx, UINT32 val)
if (diff & SR_SwC)
{
if (val & SR_SwC)
- m_cache = m_icache, m_cache_size = m_icache_size;
+ m_cache = &m_icache[0], m_cache_size = m_icache_size;
else
- m_cache = m_dcache, m_cache_size = m_dcache_size;
+ m_cache = &m_dcache[0], m_cache_size = m_dcache_size;
}
m_cpr[0][idx] = val;
diff --git a/src/emu/cpu/mips/r3000.h b/src/emu/cpu/mips/r3000.h
index d0ed29db2ae..cfcc4e1e0f1 100644
--- a/src/emu/cpu/mips/r3000.h
+++ b/src/emu/cpu/mips/r3000.h
@@ -249,8 +249,8 @@ protected:
// cache memory
UINT32 * m_cache;
- dynamic_array<UINT32> m_icache;
- dynamic_array<UINT32> m_dcache;
+ std::vector<UINT32> m_icache;
+ std::vector<UINT32> m_dcache;
size_t m_cache_size;
size_t m_icache_size;
size_t m_dcache_size;
diff --git a/src/emu/cpu/tms0980/tms0980.c b/src/emu/cpu/tms0980/tms0980.c
index e6119848883..93111b88dba 100644
--- a/src/emu/cpu/tms0980/tms0980.c
+++ b/src/emu/cpu/tms0980/tms0980.c
@@ -593,8 +593,10 @@ void tms1000_cpu_device::device_reset()
tms1xxx_cpu_device::device_reset();
// pre-decode instructionset
- m_fixed_decode.resize_and_clear(0x100);
- m_micro_decode.resize_and_clear(0x100);
+ m_fixed_decode.resize(0x100);
+ memset(&m_fixed_decode[0], 0, 0x100*sizeof(UINT32));
+ m_micro_decode.resize(0x100);
+ memset(&m_micro_decode[0], 0, 0x100*sizeof(UINT32));
for (int op = 0; op < 0x100; op++)
{
@@ -653,8 +655,10 @@ void tms0970_cpu_device::device_reset()
tms1xxx_cpu_device::device_reset();
// pre-decode instructionset
- m_fixed_decode.resize_and_clear(0x100);
- m_micro_decode.resize_and_clear(0x100);
+ m_fixed_decode.resize(0x100);
+ memset(&m_fixed_decode[0], 0, 0x100*sizeof(UINT32));
+ m_micro_decode.resize(0x100);
+ memset(&m_micro_decode[0], 0, 0x100*sizeof(UINT32));
for (int op = 0; op < 0x100; op++)
{
@@ -717,8 +721,10 @@ void tms0980_cpu_device::device_reset()
tms1xxx_cpu_device::device_reset();
// pre-decode instructionset
- m_fixed_decode.resize_and_clear(0x200);
- m_micro_decode.resize_and_clear(0x200);
+ m_fixed_decode.resize(0x200);
+ memset(&m_fixed_decode[0], 0, 0x200*sizeof(UINT32));
+ m_micro_decode.resize(0x200);
+ memset(&m_micro_decode[0], 0, 0x200*sizeof(UINT32));
for (int op = 0; op < 0x200; op++)
{
@@ -741,7 +747,8 @@ void tms0980_cpu_device::device_reset()
// like on TMS0970, one of the terms directly select a microinstruction index (via R4-R8),
// but it can't be pre-determined when it's active
- m_micro_direct.resize_and_clear(0x40);
+ m_micro_direct.resize(0x40);
+ memset(&m_micro_decode[0], 0, 0x40*sizeof(UINT32));
for (int op = 0; op < 0x40; op++)
m_micro_direct[op] = decode_micro(op);
diff --git a/src/emu/cpu/tms0980/tms0980.h b/src/emu/cpu/tms0980/tms0980.h
index 4e9cba6e114..a5407e8cf62 100644
--- a/src/emu/cpu/tms0980/tms0980.h
+++ b/src/emu/cpu/tms0980/tms0980.h
@@ -198,9 +198,9 @@ protected:
UINT32 m_x_mask;
// lookup tables
- dynamic_array<UINT32> m_fixed_decode;
- dynamic_array<UINT32> m_micro_decode;
- dynamic_array<UINT32> m_micro_direct;
+ std::vector<UINT32> m_fixed_decode;
+ std::vector<UINT32> m_micro_decode;
+ std::vector<UINT32> m_micro_direct;
};
diff --git a/src/emu/cpu/vtlb.c b/src/emu/cpu/vtlb.c
index 151d0b054ae..f5a488100f7 100644
--- a/src/emu/cpu/vtlb.c
+++ b/src/emu/cpu/vtlb.c
@@ -35,9 +35,9 @@ struct vtlb_state
int dynindex; /* index of next dynamic entry */
int pageshift; /* bits to shift to get page index */
int addrwidth; /* logical address bus width */
- dynamic_array<offs_t> live; /* array of live entries by table index */
- dynamic_array<int> fixedpages; /* number of pages each fixed entry covers */
- dynamic_array<vtlb_entry> table; /* table of entries by address */
+ std::vector<offs_t> live; /* array of live entries by table index */
+ std::vector<int> fixedpages; /* number of pages each fixed entry covers */
+ std::vector<vtlb_entry> table; /* table of entries by address */
};
@@ -73,17 +73,20 @@ vtlb_state *vtlb_alloc(device_t *cpu, address_spacenum space, int fixed_entries,
assert(vtlb->addrwidth > vtlb->pageshift);
/* allocate the entry array */
- vtlb->live.resize_and_clear(fixed_entries + dynamic_entries);
+ vtlb->live.resize(fixed_entries + dynamic_entries);
+ memset(&vtlb->live[0], 0, vtlb->live.size()*sizeof(vtlb->live[0]));
cpu->save_item(NAME(vtlb->live));
/* allocate the lookup table */
- vtlb->table.resize_and_clear((size_t) 1 << (vtlb->addrwidth - vtlb->pageshift));
+ vtlb->table.resize((size_t) 1 << (vtlb->addrwidth - vtlb->pageshift));
+ memset(&vtlb->table[0], 0, vtlb->table.size()*sizeof(vtlb->table[0]));
cpu->save_item(NAME(vtlb->table));
/* allocate the fixed page count array */
if (fixed_entries > 0)
{
- vtlb->fixedpages.resize_and_clear(fixed_entries);
+ vtlb->fixedpages.resize(fixed_entries);
+ memset(&vtlb->fixedpages[0], 0, fixed_entries*sizeof(vtlb->fixedpages[0]));
cpu->save_item(NAME(vtlb->fixedpages));
}
return vtlb;
@@ -96,17 +99,6 @@ vtlb_state *vtlb_alloc(device_t *cpu, address_spacenum space, int fixed_entries,
void vtlb_free(vtlb_state *vtlb)
{
- /* free the fixed pages if allocated */
- if (vtlb->fixedpages != NULL)
- auto_free(vtlb->cpudevice->machine(), vtlb->fixedpages);
-
- /* free the table and array if they exist */
- if (vtlb->live != NULL)
- auto_free(vtlb->cpudevice->machine(), vtlb->live);
- if (vtlb->table != NULL)
- auto_free(vtlb->cpudevice->machine(), vtlb->table);
-
- /* and then the VTLB object itself */
auto_free(vtlb->cpudevice->machine(), vtlb);
}
@@ -314,5 +306,5 @@ void vtlb_flush_address(vtlb_state *vtlb, offs_t address)
const vtlb_entry *vtlb_table(vtlb_state *vtlb)
{
- return vtlb->table;
+ return &vtlb->table[0];
}
diff --git a/src/emu/debug/debugcmd.c b/src/emu/debug/debugcmd.c
index 0b0d2cffdfd..37383915e4c 100644
--- a/src/emu/debug/debugcmd.c
+++ b/src/emu/debug/debugcmd.c
@@ -55,7 +55,7 @@ struct cheat_system
{
char cpu[2];
UINT8 width;
- dynamic_array<cheat_map> cheatmap;
+ std::vector<cheat_map> cheatmap;
UINT8 undo;
UINT8 signed_cheat;
UINT8 swapped_cheat;
@@ -2050,8 +2050,8 @@ static void execute_cheatinit(running_machine &machine, int ref, int params, con
if (!debug_command_parameter_cpu_space(machine, cheat.cpu, AS_PROGRAM, space))
return;
- active_cheat = cheat.cheatmap.count();
- cheat.cheatmap.resize_keep(cheat.cheatmap.count() + real_length);
+ active_cheat = cheat.cheatmap.size();
+ cheat.cheatmap.resize(cheat.cheatmap.size() + real_length);
}
/* initialize cheatmap in the selected space */
@@ -2148,7 +2148,7 @@ static void execute_cheatnext(running_machine &machine, int ref, int params, con
cheat.undo++;
/* execute the search */
- for (cheatindex = 0; cheatindex < (UINT64)cheat.cheatmap.count(); cheatindex += 1)
+ for (cheatindex = 0; cheatindex < cheat.cheatmap.size(); cheatindex += 1)
if (cheat.cheatmap[cheatindex].state == 1)
{
UINT64 cheat_value = cheat_read_extended(&cheat, *space, cheat.cheatmap[cheatindex].offset);
@@ -2293,7 +2293,7 @@ static void execute_cheatlist(running_machine &machine, int ref, int params, con
}
/* write the cheat list */
- for (cheatindex = 0; cheatindex < (UINT64)cheat.cheatmap.count(); cheatindex += 1)
+ for (cheatindex = 0; cheatindex < cheat.cheatmap.size(); cheatindex += 1)
{
if (cheat.cheatmap[cheatindex].state == 1)
{
@@ -2329,7 +2329,7 @@ static void execute_cheatundo(running_machine &machine, int ref, int params, con
if (cheat.undo > 0)
{
- for (cheatindex = 0; cheatindex < (UINT64)cheat.cheatmap.count(); cheatindex += 1)
+ for (cheatindex = 0; cheatindex < cheat.cheatmap.size(); cheatindex += 1)
{
if (cheat.cheatmap[cheatindex].undo == cheat.undo)
{
diff --git a/src/emu/debug/debugcpu.c b/src/emu/debug/debugcpu.c
index 81380a7e5fb..29a4d759552 100644
--- a/src/emu/debug/debugcpu.c
+++ b/src/emu/debug/debugcpu.c
@@ -1979,7 +1979,7 @@ void device_debug::memory_read_hook(address_space &space, offs_t address, UINT64
watchpoint_check(space, WATCHPOINT_READ, address, 0, mem_mask);
// check hotspots
- if (m_hotspots.count() > 0)
+ if (!m_hotspots.empty())
hotspot_check(space, address);
}
@@ -2542,13 +2542,14 @@ void device_debug::registerpoint_enable_all(bool enable)
void device_debug::hotspot_track(int numspots, int threshhold)
{
// if we already have tracking enabled, kill it
- m_hotspots.reset();
+ m_hotspots.clear();
// only start tracking if we have a non-zero count
if (numspots > 0)
{
// allocate memory for hotspots
- m_hotspots.resize_and_clear(numspots, 0xff);
+ m_hotspots.resize(numspots);
+ memset(&m_hotspots[0], 0xff, numspots*sizeof(m_hotspots[0]));
// fill in the info
m_hotspot_threshhold = threshhold;
@@ -2951,7 +2952,7 @@ void device_debug::watchpoint_update_flags(address_space &space)
{
// if hotspots are enabled, turn on all reads
bool enableread = false;
- if (m_hotspots.count() > 0)
+ if (!m_hotspots.empty())
enableread = true;
// see if there are any enabled breakpoints
@@ -3079,21 +3080,21 @@ void device_debug::hotspot_check(address_space &space, offs_t address)
offs_t curpc = pc();
// see if we have a match in our list
- int hotindex;
- for (hotindex = 0; hotindex < m_hotspots.count(); hotindex++)
+ unsigned int hotindex;
+ for (hotindex = 0; hotindex < m_hotspots.size(); hotindex++)
if (m_hotspots[hotindex].m_access == address && m_hotspots[hotindex].m_pc == curpc && m_hotspots[hotindex].m_space == &space)
break;
// if we didn't find any, make a new entry
- if (hotindex == m_hotspots.count())
+ if (hotindex == m_hotspots.size())
{
// if the bottom of the list is over the threshhold, print it
- hotspot_entry &spot = m_hotspots[m_hotspots.count() - 1];
+ hotspot_entry &spot = m_hotspots[m_hotspots.size() - 1];
if (spot.m_count > m_hotspot_threshhold)
debug_console_printf(space.machine(), "Hotspot @ %s %08X (PC=%08X) hit %d times (fell off bottom)\n", space.name(), spot.m_access, spot.m_pc, spot.m_count);
// move everything else down and insert this one at the top
- memmove(&m_hotspots[1], &m_hotspots[0], sizeof(m_hotspots[0]) * (m_hotspots.count() - 1));
+ memmove(&m_hotspots[1], &m_hotspots[0], sizeof(m_hotspots[0]) * (m_hotspots.size() - 1));
m_hotspots[0].m_access = address;
m_hotspots[0].m_pc = curpc;
m_hotspots[0].m_space = &space;
diff --git a/src/emu/debug/debugcpu.h b/src/emu/debug/debugcpu.h
index d08d333ef5f..cf92fda6f7c 100644
--- a/src/emu/debug/debugcpu.h
+++ b/src/emu/debug/debugcpu.h
@@ -236,7 +236,7 @@ public:
void registerpoint_enable_all(bool enable = true );
// hotspots
- bool hotspot_tracking_enabled() const { return (m_hotspots != NULL); }
+ bool hotspot_tracking_enabled() const { return !m_hotspots.empty(); }
void hotspot_track(int numspots, int threshhold);
// comments
@@ -370,7 +370,7 @@ private:
address_space * m_space; // space where the access occurred
UINT32 m_count; // number of hits
};
- dynamic_array<hotspot_entry> m_hotspots; // hotspot list
+ std::vector<hotspot_entry> m_hotspots; // hotspot list
int m_hotspot_threshhold; // threshhold for the number of hits to print
// pc tracking
diff --git a/src/emu/debug/debugvw.h b/src/emu/debug/debugvw.h
index 29fe543e9f4..462316a19e4 100644
--- a/src/emu/debug/debugvw.h
+++ b/src/emu/debug/debugvw.h
@@ -150,7 +150,7 @@ public:
running_machine &machine() const { return m_machine; }
debug_view *next() const { return m_next; }
debug_view_type type() const { return m_type; }
- const debug_view_char *viewdata() const { return m_viewdata; }
+ const debug_view_char *viewdata() const { return &m_viewdata[0]; }
debug_view_xy total_size() { flush_updates(); return m_total; }
debug_view_xy visible_size() { flush_updates(); return m_visible; }
debug_view_xy visible_position() { flush_updates(); return m_topleft; }
@@ -216,7 +216,7 @@ protected:
UINT8 m_update_level; // update level; updates when this hits 0
bool m_update_pending; // true if there is a pending update
bool m_osd_update_pending; // true if there is a pending update
- dynamic_array<debug_view_char> m_viewdata; // current array of view data
+ std::vector<debug_view_char> m_viewdata; // current array of view data
private:
running_machine & m_machine; // machine associated with this view
diff --git a/src/emu/debug/dvbpoints.c b/src/emu/debug/dvbpoints.c
index 4edd18ebebc..db393556639 100644
--- a/src/emu/debug/dvbpoints.c
+++ b/src/emu/debug/dvbpoints.c
@@ -171,8 +171,8 @@ void debug_view_breakpoints::view_click(const int button, const debug_view_xy& p
// Gather a sorted list of all the breakpoints for all the CPUs
gather_breakpoints();
- int const bpIndex = pos.y - 1;
- if ((bpIndex >= m_buffer.count()) || (bpIndex < 0))
+ int bpIndex = pos.y - 1;
+ if ((bpIndex >= m_buffer.size()) || (bpIndex < 0))
return;
// Enable / disable
@@ -209,12 +209,12 @@ void debug_view_breakpoints::gather_breakpoints()
// Collect
device_debug &debugInterface = *source->device()->debug();
for (device_debug::breakpoint *bp = debugInterface.breakpoint_first(); bp != NULL; bp = bp->next())
- m_buffer.append() = bp;
+ m_buffer.push_back(bp);
}
// And now for the sort
- if (m_buffer.count() > 0)
- qsort(&m_buffer[0], m_buffer.count(), sizeof(device_debug::breakpoint *), m_sortType);
+ if (!m_buffer.empty())
+ qsort(&m_buffer[0], m_buffer.size(), sizeof(device_debug::breakpoint *), m_sortType);
}
@@ -230,12 +230,12 @@ void debug_view_breakpoints::view_update()
// Set the view region so the scroll bars update
m_total.x = tableBreaks[ARRAY_LENGTH(tableBreaks) - 1];
- m_total.y = m_buffer.count() + 1;
+ m_total.y = m_buffer.size() + 1;
if (m_total.y < 10)
m_total.y = 10;
// Draw
- debug_view_char *dest = m_viewdata;
+ debug_view_char *dest = &m_viewdata[0];
astring linebuf;
// Header
@@ -278,7 +278,7 @@ void debug_view_breakpoints::view_update()
{
// Breakpoints
int bpi = row + m_topleft.y - 1;
- if ((bpi < m_buffer.count()) && (bpi >= 0))
+ if ((bpi < m_buffer.size()) && (bpi >= 0))
{
device_debug::breakpoint *const bp = m_buffer[bpi];
diff --git a/src/emu/debug/dvbpoints.h b/src/emu/debug/dvbpoints.h
index 83a36ed965b..59a446f8a03 100644
--- a/src/emu/debug/dvbpoints.h
+++ b/src/emu/debug/dvbpoints.h
@@ -52,7 +52,7 @@ private:
// internal state
int (*m_sortType)(void const *, void const *);
- dynamic_array<device_debug::breakpoint *> m_buffer;
+ std::vector<device_debug::breakpoint *> m_buffer;
};
diff --git a/src/emu/debug/dvdisasm.c b/src/emu/debug/dvdisasm.c
index 2dfb2536b1e..79453127662 100644
--- a/src/emu/debug/dvdisasm.c
+++ b/src/emu/debug/dvdisasm.c
@@ -167,7 +167,7 @@ void debug_view_disasm::view_char(int chval)
offs_t pc = source.m_space.address_to_byte(source.m_device.safe_pc()) & source.m_space.logbytemask();
// figure out which row the pc is on
- for (int curline = 0; curline < m_byteaddress.count(); curline++)
+ for (unsigned int curline = 0; curline < m_byteaddress.size(); curline++)
if (m_byteaddress[curline] == pc)
m_cursor.y = curline;
break;
@@ -464,12 +464,12 @@ void debug_view_disasm::view_update()
// see if the new result is an address we already have
UINT32 row;
- for (row = 0; row < m_byteaddress.count(); row++)
+ for (row = 0; row < m_byteaddress.size(); row++)
if (m_byteaddress[row] == resultbyte)
break;
// if we didn't find it, or if it's really close to the bottom, recompute
- if (row == m_byteaddress.count() || row >= m_total.y - m_visible.y)
+ if (row == m_byteaddress.size() || row >= m_total.y - m_visible.y)
m_recompute = true;
// otherwise, if it's not visible, adjust the view so it is
@@ -491,7 +491,7 @@ recompute:
if (m_recompute)
{
// recompute the view
- if (m_byteaddress.count() > 0 && m_last_change_count != source.m_device.debug()->comment_change_count())
+ if (!m_byteaddress.empty() && m_last_change_count != source.m_device.debug()->comment_change_count())
{
// smoosh us against the left column, but not the top row
m_topleft.x = 0;
@@ -520,7 +520,7 @@ recompute:
for (UINT32 row = 0; row < m_visible.y; row++)
{
UINT32 effrow = m_topleft.y + row;
- if (effrow >= m_byteaddress.count())
+ if (effrow >= m_byteaddress.size())
break;
if (pcbyte == m_byteaddress[effrow])
{
@@ -541,8 +541,8 @@ recompute:
}
// loop over visible rows
- debug_view_char *dest = m_viewdata;
- int row_width = m_dasm.count() / m_byteaddress.count();
+ debug_view_char *dest = &m_viewdata[0];
+ int row_width = m_dasm.size() / m_byteaddress.size();
for (UINT32 row = 0; row < m_visible.y; row++)
{
UINT32 effrow = m_topleft.y + row;
@@ -550,7 +550,7 @@ recompute:
// if this visible row is valid, add it to the buffer
UINT8 attrib = DCA_NORMAL;
- if (effrow < m_byteaddress.count())
+ if (effrow < m_byteaddress.size())
{
// if we're on the line with the PC, recompute and hilight it
if (pcbyte == m_byteaddress[effrow])
diff --git a/src/emu/debug/dvdisasm.h b/src/emu/debug/dvdisasm.h
index 2eee80c32f8..6f1c911aaeb 100644
--- a/src/emu/debug/dvdisasm.h
+++ b/src/emu/debug/dvdisasm.h
@@ -104,8 +104,8 @@ private:
int m_divider1, m_divider2; // left and right divider columns
int m_divider3; // comment divider column
debug_view_expression m_expression; // expression-related information
- dynamic_array<offs_t> m_byteaddress; // addresses of the instructions
- dynamic_array<char> m_dasm; // disassembled instructions
+ std::vector<offs_t> m_byteaddress; // addresses of the instructions
+ std::vector<char> m_dasm; // disassembled instructions
// constants
static const int DEFAULT_DASM_LINES = 1000;
diff --git a/src/emu/debug/dvmemory.c b/src/emu/debug/dvmemory.c
index fc30971c033..7ccea671324 100644
--- a/src/emu/debug/dvmemory.c
+++ b/src/emu/debug/dvmemory.c
@@ -217,7 +217,7 @@ void debug_view_memory::view_update()
// loop over visible rows
for (UINT32 row = 0; row < m_visible.y; row++)
{
- debug_view_char *destmin = m_viewdata + row * m_visible.x;
+ debug_view_char *destmin = &m_viewdata[row * m_visible.x];
debug_view_char *destmax = destmin + m_visible.x;
debug_view_char *destrow = destmin - m_topleft.x;
UINT32 effrow = m_topleft.y + row;
diff --git a/src/emu/debug/dvstate.c b/src/emu/debug/dvstate.c
index 432895fce86..4d5ab739d00 100644
--- a/src/emu/debug/dvstate.c
+++ b/src/emu/debug/dvstate.c
@@ -212,7 +212,7 @@ void debug_view_state::view_update()
// loop over visible rows
screen_device *screen = machine().first_screen();
- debug_view_char *dest = m_viewdata;
+ debug_view_char *dest = &m_viewdata[0];
for (UINT32 row = 0; row < m_visible.y; row++)
{
UINT32 col = 0;
diff --git a/src/emu/debug/dvtext.c b/src/emu/debug/dvtext.c
index 607d648edec..80f1aa7982c 100644
--- a/src/emu/debug/dvtext.c
+++ b/src/emu/debug/dvtext.c
@@ -72,7 +72,7 @@ void debug_view_textbuf::view_update()
m_topleft.y = curseq - text_buffer_line_index_to_seqnum(&m_textbuf, 0);
// loop over visible rows
- debug_view_char *dest = m_viewdata;
+ debug_view_char *dest = &m_viewdata[0];
for (UINT32 row = 0; row < m_visible.y; row++)
{
const char *line = text_buffer_get_seqnum_line(&m_textbuf, curseq++);
diff --git a/src/emu/debug/dvwpoints.c b/src/emu/debug/dvwpoints.c
index 8a03b4a5501..d8b447a568a 100644
--- a/src/emu/debug/dvwpoints.c
+++ b/src/emu/debug/dvwpoints.c
@@ -198,7 +198,7 @@ void debug_view_watchpoints::view_click(const int button, const debug_view_xy& p
gather_watchpoints();
int const wpIndex = pos.y - 1;
- if ((wpIndex >= m_buffer.count()) || (wpIndex < 0))
+ if ((wpIndex >= m_buffer.size()) || (wpIndex < 0))
return;
// Enable / disable
@@ -235,13 +235,13 @@ void debug_view_watchpoints::gather_watchpoints()
for (address_spacenum spacenum = AS_0; spacenum < ADDRESS_SPACES; spacenum++)
{
for (device_debug::watchpoint *wp = debugInterface.watchpoint_first(spacenum); wp != NULL; wp = wp->next())
- m_buffer.append() = wp;
+ m_buffer.push_back(wp);
}
}
// And now for the sort
- if (m_buffer.count() > 0)
- qsort(&m_buffer[0], m_buffer.count(), sizeof(device_debug::watchpoint *), m_sortType);
+ if (!m_buffer.empty())
+ qsort(&m_buffer[0], m_buffer.size(), sizeof(device_debug::watchpoint *), m_sortType);
}
@@ -257,12 +257,12 @@ void debug_view_watchpoints::view_update()
// Set the view region so the scroll bars update
m_total.x = tableBreaks[ARRAY_LENGTH(tableBreaks) - 1];
- m_total.y = m_buffer.count() + 1;
+ m_total.y = m_buffer.size() + 1;
if (m_total.y < 10)
m_total.y = 10;
// Draw
- debug_view_char *dest = m_viewdata;
+ debug_view_char *dest = &m_viewdata[0];
astring linebuf;
// Header
@@ -313,7 +313,7 @@ void debug_view_watchpoints::view_update()
{
// watchpoints
int const wpi = row + m_topleft.y - 1;
- if ((wpi < m_buffer.count()) && wpi >= 0)
+ if ((wpi < m_buffer.size()) && wpi >= 0)
{
static char const *const types[] = { "unkn ", "read ", "write", "r/w " };
device_debug::watchpoint *const wp = m_buffer[wpi];
diff --git a/src/emu/debug/dvwpoints.h b/src/emu/debug/dvwpoints.h
index b714a168ecd..fc6b641effc 100644
--- a/src/emu/debug/dvwpoints.h
+++ b/src/emu/debug/dvwpoints.h
@@ -48,7 +48,7 @@ private:
// internal state
int (*m_sortType)(void const *, void const *);
- dynamic_array<device_debug::watchpoint *> m_buffer;
+ std::vector<device_debug::watchpoint *> m_buffer;
};
diff --git a/src/emu/devfind.h b/src/emu/devfind.h
index 69dbec203e8..38f7705ca0a 100644
--- a/src/emu/devfind.h
+++ b/src/emu/devfind.h
@@ -384,9 +384,9 @@ public:
// dynamic allocation of a shared pointer
void allocate(UINT32 entries)
{
- assert(m_allocated.count() == 0);
+ assert(m_allocated.empty());
m_allocated.resize(entries);
- this->m_target = m_allocated;
+ this->m_target = &m_allocated[0];
m_bytes = entries * sizeof(_PointerType);
this->m_base.save_item(this->m_allocated, this->m_tag);
}
@@ -403,7 +403,7 @@ protected:
// internal state
size_t m_bytes;
UINT8 m_width;
- dynamic_array<_PointerType> m_allocated;
+ std::vector<_PointerType> m_allocated;
};
// optional shared pointer finder
diff --git a/src/emu/digfx.c b/src/emu/digfx.c
index d3673aa6179..b3bd0edb770 100644
--- a/src/emu/digfx.c
+++ b/src/emu/digfx.c
@@ -121,8 +121,8 @@ void device_gfx_interface::decode_gfx(const gfx_decode_entry *gfxdecodeinfo)
// local variables to hold mutable copies of gfx layout data
gfx_layout glcopy;
- dynamic_array<UINT32> extxoffs(0);
- dynamic_array<UINT32> extyoffs(0);
+ std::vector<UINT32> extxoffs(0);
+ std::vector<UINT32> extyoffs(0);
// loop over all elements
for (int curgfx = 0; curgfx < MAX_GFX_ELEMENTS && gfxdecodeinfo[curgfx].gfxlayout != NULL; curgfx++)
@@ -206,8 +206,8 @@ void device_gfx_interface::decode_gfx(const gfx_decode_entry *gfxdecodeinfo)
memcpy(&extyoffs[0], (glcopy.extyoffs != NULL) ? glcopy.extyoffs : glcopy.yoffset, glcopy.height * sizeof(UINT32));
// always use the extended offsets here
- glcopy.extxoffs = extxoffs;
- glcopy.extyoffs = extyoffs;
+ glcopy.extxoffs = &extxoffs[0];
+ glcopy.extyoffs = &extyoffs[0];
// expand X and Y by the scale factors
if (xscale > 1)
diff --git a/src/emu/diimage.c b/src/emu/diimage.c
index bb483af9d91..42799b68c0b 100644
--- a/src/emu/diimage.c
+++ b/src/emu/diimage.c
@@ -431,16 +431,17 @@ void device_image_interface::run_hash(void (*partialhash)(hash_collection &, con
hashes.reset();
size = (UINT32) length();
- buf.resize_and_clear(size);
+ buf.resize(size);
+ memset(&buf[0], 0, size);
/* read the file */
fseek(0, SEEK_SET);
- fread(buf, size);
+ fread(&buf[0], size);
if (partialhash)
- partialhash(hashes, buf, size, types);
+ partialhash(hashes, &buf[0], size, types);
else
- hashes.compute(buf, size, types);
+ hashes.compute(&buf[0], size, types);
/* cleanup */
fseek(0, SEEK_SET);
diff --git a/src/emu/disound.h b/src/emu/disound.h
index 7028dd818c0..3dd3737b35f 100644
--- a/src/emu/disound.h
+++ b/src/emu/disound.h
@@ -146,7 +146,7 @@ protected:
// internal state
UINT8 m_outputs; // number of outputs
- dynamic_array<UINT8> m_outputmap; // map of inputs to outputs
+ std::vector<UINT8> m_outputmap; // map of inputs to outputs
sound_stream * m_mixer_stream; // mixing stream
};
diff --git a/src/emu/drawgfx.c b/src/emu/drawgfx.c
index f985456c786..27ab70a88ce 100644
--- a/src/emu/drawgfx.c
+++ b/src/emu/drawgfx.c
@@ -190,10 +190,10 @@ void gfx_element::set_layout(const gfx_layout &gl, const UINT8 *srcdata)
if (m_layout_is_raw)
{
// RAW layouts don't need these arrays
- m_layout_planeoffset.reset();
- m_layout_xoffset.reset();
- m_layout_yoffset.reset();
- m_gfxdata_allocated.reset();
+ m_layout_planeoffset.clear();
+ m_layout_xoffset.clear();
+ m_layout_yoffset.clear();
+ m_gfxdata_allocated.clear();
// modulos are determined for us by the layout
m_line_modulo = gl.yoffs(0) / 8;
@@ -229,13 +229,14 @@ void gfx_element::set_layout(const gfx_layout &gl, const UINT8 *srcdata)
}
// mark everything dirty
- m_dirty.resize_and_clear(m_total_elements, 1);
+ m_dirty.resize(m_total_elements);
+ memset(&m_dirty[0], 1, m_total_elements);
// allocate a pen usage array for entries with 32 pens or less
if (m_color_depth <= 32)
m_pen_usage.resize(m_total_elements);
else
- m_pen_usage.reset();
+ m_pen_usage.clear();
}
@@ -264,7 +265,7 @@ void gfx_element::set_raw_layout(const UINT8 *srcdata, UINT32 width, UINT32 heig
void gfx_element::set_source(const UINT8 *source)
{
m_srcdata = source;
- memset(m_dirty, 1, elements());
+ memset(&m_dirty[0], 1, elements());
if (m_layout_is_raw) m_gfxdata = const_cast<UINT8 *>(source);
}
@@ -280,7 +281,8 @@ void gfx_element::set_source_and_total(const UINT8 *source, UINT32 total)
m_total_elements = total;
// mark everything dirty
- m_dirty.resize_and_clear(m_total_elements, 1);
+ m_dirty.resize(m_total_elements);
+ memset(&m_dirty[0], 1, m_total_elements);
// allocate a pen usage array for entries with 32 pens or less
if (m_color_depth <= 32)
@@ -353,7 +355,7 @@ void gfx_element::decode(UINT32 code)
}
// (re)compute pen usage
- if (code < m_pen_usage.count())
+ if (code < m_pen_usage.size())
{
// iterate over data, creating a bitmask of live pens
const UINT8 *dp = m_gfxdata + code * m_char_modulo;
diff --git a/src/emu/drawgfx.h b/src/emu/drawgfx.h
index e63e095f0ef..b7949b3a9e6 100644
--- a/src/emu/drawgfx.h
+++ b/src/emu/drawgfx.h
@@ -164,7 +164,7 @@ public:
UINT16 granularity() const { return m_color_granularity; }
UINT32 colors() const { return m_total_colors; }
UINT32 rowbytes() const { return m_line_modulo; }
- bool has_pen_usage() const { return (m_pen_usage.count() > 0); }
+ bool has_pen_usage() const { return !m_pen_usage.empty(); }
// used by tilemaps
UINT32 dirtyseq() const { return m_dirtyseq; }
@@ -188,13 +188,13 @@ public:
const UINT8 *get_data(UINT32 code)
{
assert(code < elements());
- if (code < m_dirty.count() && m_dirty[code]) decode(code);
+ if (code < m_dirty.size() && m_dirty[code]) decode(code);
return m_gfxdata + code * m_char_modulo + m_starty * m_line_modulo + m_startx;
}
UINT32 pen_usage(UINT32 code)
{
- assert(code < m_pen_usage.count());
+ assert(code < m_pen_usage.size());
if (m_dirty[code]) decode(code);
return m_pen_usage[code];
}
@@ -293,15 +293,15 @@ private:
UINT8 * m_gfxdata; // pointer to decoded pixel data, 8bpp
dynamic_buffer m_gfxdata_allocated; // allocated decoded pixel data, 8bpp
dynamic_buffer m_dirty; // dirty array for detecting chars that need decoding
- dynamic_array<UINT32> m_pen_usage; // bitmask of pens that are used (pens 0-31 only)
+ std::vector<UINT32> m_pen_usage; // bitmask of pens that are used (pens 0-31 only)
bool m_layout_is_raw; // raw layout?
UINT8 m_layout_planes; // bit planes in the layout
UINT32 m_layout_xormask; // xor mask applied to each bit offset
UINT32 m_layout_charincrement; // per-character increment in source data
- dynamic_array<UINT32> m_layout_planeoffset;// plane offsets
- dynamic_array<UINT32> m_layout_xoffset; // X offsets
- dynamic_array<UINT32> m_layout_yoffset; // Y offsets
+ std::vector<UINT32> m_layout_planeoffset;// plane offsets
+ std::vector<UINT32> m_layout_xoffset; // X offsets
+ std::vector<UINT32> m_layout_yoffset; // Y offsets
};
diff --git a/src/emu/drivenum.c b/src/emu/drivenum.c
index 918310fade2..c1649f51d7f 100644
--- a/src/emu/drivenum.c
+++ b/src/emu/drivenum.c
@@ -132,7 +132,7 @@ driver_enumerator::driver_enumerator(emu_options &options)
m_filtered_count(0),
m_options(options),
m_included(s_driver_count, 0),
- m_config(s_driver_count, 0)
+ m_config(s_driver_count, NULL)
{
include_all();
}
@@ -143,7 +143,7 @@ driver_enumerator::driver_enumerator(emu_options &options, const char *string)
m_filtered_count(0),
m_options(options),
m_included(s_driver_count, 0),
- m_config(s_driver_count, 0)
+ m_config(s_driver_count, NULL)
{
filter(string);
}
@@ -154,7 +154,7 @@ driver_enumerator::driver_enumerator(emu_options &options, const game_driver &dr
m_filtered_count(0),
m_options(options),
m_included(s_driver_count, 0),
- m_config(s_driver_count, 0)
+ m_config(s_driver_count, NULL)
{
filter(driver);
}
@@ -242,7 +242,7 @@ int driver_enumerator::filter(const game_driver &driver)
void driver_enumerator::include_all()
{
- memset(m_included, 1, sizeof(m_included[0]) * s_driver_count);
+ memset(&m_included[0], 1, sizeof(m_included[0]) * s_driver_count);
m_filtered_count = s_driver_count;
// always exclude the empty driver
@@ -316,7 +316,7 @@ void driver_enumerator::find_approximate_matches(const char *string, int count,
srand(osd_ticks());
// allocate a temporary list
- dynamic_array<int> templist(m_filtered_count);
+ std::vector<int> templist(m_filtered_count);
int arrayindex = 0;
for (int index = 0; index < s_driver_count; index++)
if (m_included[index])
@@ -340,7 +340,7 @@ void driver_enumerator::find_approximate_matches(const char *string, int count,
}
// allocate memory to track the penalty value
- dynamic_array<int> penalty(count);
+ std::vector<int> penalty(count);
// initialize everyone's states
for (int matchnum = 0; matchnum < count; matchnum++)
diff --git a/src/emu/drivenum.h b/src/emu/drivenum.h
index cb23b96b34b..672c24d2c3e 100644
--- a/src/emu/drivenum.h
+++ b/src/emu/drivenum.h
@@ -106,7 +106,7 @@ public:
int filter(const char *string = NULL);
int filter(const game_driver &driver);
void include_all();
- void exclude_all() { memset(m_included, 0, sizeof(m_included[0]) * s_driver_count); m_filtered_count = 0; }
+ void exclude_all() { memset(&m_included[0], 0, sizeof(m_included[0]) * s_driver_count); m_filtered_count = 0; }
void reset() { m_current = -1; }
bool next();
bool next_excluded();
@@ -146,8 +146,8 @@ private:
int m_current;
int m_filtered_count;
emu_options & m_options;
- dynamic_array<UINT8> m_included;
- mutable dynamic_array<machine_config *> m_config;
+ std::vector<UINT8> m_included;
+ mutable std::vector<machine_config *> m_config;
mutable simple_list<config_entry> m_config_cache;
};
diff --git a/src/emu/emualloc.c b/src/emu/emualloc.c
index e3dd52deb9b..566176ce39a 100644
--- a/src/emu/emualloc.c
+++ b/src/emu/emualloc.c
@@ -40,10 +40,11 @@ UINT64 resource_pool::s_id = 0;
resource_pool::resource_pool(int hash_size)
: m_hash_size(hash_size),
m_listlock(osd_lock_alloc()),
- m_hash(hash_size, 0),
+ m_hash(hash_size),
m_ordered_head(NULL),
m_ordered_tail(NULL)
{
+ memset(&m_hash[0], 0, hash_size*sizeof(m_hash[0]));
}
diff --git a/src/emu/emualloc.h b/src/emu/emualloc.h
index e128322ac96..3a47180b517 100644
--- a/src/emu/emualloc.h
+++ b/src/emu/emualloc.h
@@ -142,7 +142,7 @@ public:
private:
int m_hash_size;
osd_lock * m_listlock;
- dynamic_array<resource_pool_item *> m_hash;
+ std::vector<resource_pool_item *> m_hash;
resource_pool_item * m_ordered_head;
resource_pool_item * m_ordered_tail;
static UINT64 s_id;
diff --git a/src/emu/emupal.c b/src/emu/emupal.c
index 91cf944911e..b5f0c128f6a 100644
--- a/src/emu/emupal.c
+++ b/src/emu/emupal.c
@@ -117,7 +117,7 @@ void palette_device::set_indirect_color(int index, rgb_t rgb)
m_indirect_colors[index] = rgb;
// update the palette for any colortable entries that reference it
- for (UINT32 pen = 0; pen < m_indirect_pens.count(); pen++)
+ for (UINT32 pen = 0; pen < m_indirect_pens.size(); pen++)
if (m_indirect_pens[pen] == index)
m_palette->entry_set_color(pen, rgb);
}
@@ -150,11 +150,11 @@ UINT32 palette_device::transpen_mask(gfx_element &gfx, int color, int transcolor
UINT32 entry = gfx.colorbase() + (color % gfx.colors()) * gfx.granularity();
// make sure we are in range
- assert(entry < m_indirect_pens.count());
+ assert(entry < m_indirect_pens.size());
assert(gfx.depth() <= 32);
// either gfx->color_depth entries or as many as we can get up until the end
- int count = MIN(gfx.depth(), m_indirect_pens.count() - entry);
+ int count = MIN(gfx.depth(), m_indirect_pens.size() - entry);
// set a bit anywhere the transcolor matches
UINT32 mask = 0;
diff --git a/src/emu/emupal.h b/src/emu/emupal.h
index e11510745b0..a8879ba4730 100644
--- a/src/emu/emupal.h
+++ b/src/emu/emupal.h
@@ -361,6 +361,7 @@ public:
void set_pen_color(pen_t pen, rgb_t rgb) { m_palette->entry_set_color(pen, rgb); }
void set_pen_color(pen_t pen, UINT8 r, UINT8 g, UINT8 b) { m_palette->entry_set_color(pen, rgb_t(r, g, b)); }
void set_pen_colors(pen_t color_base, const rgb_t *colors, int color_count) { while (color_count--) set_pen_color(color_base++, *colors++); }
+ void set_pen_colors(pen_t color_base, const std::vector<rgb_t> &colors) { for(unsigned int i=0; i != colors.size(); i++) set_pen_color(color_base+i, colors[i]); }
void set_pen_contrast(pen_t pen, double bright) { m_palette->entry_set_contrast(pen, bright); }
// indirection (aka colortables)
@@ -447,8 +448,8 @@ private:
pen_t m_black_pen; // precomputed black pen value
// indirection state
- dynamic_array<rgb_t> m_indirect_colors; // actual colors set for indirection
- dynamic_array<UINT16> m_indirect_pens; // indirection values
+ std::vector<rgb_t> m_indirect_colors; // actual colors set for indirection
+ std::vector<UINT16> m_indirect_pens; // indirection values
struct shadow_table_data
{
@@ -460,12 +461,12 @@ private:
};
shadow_table_data m_shadow_tables[MAX_SHADOW_PRESETS]; // array of shadow table data
- dynamic_array<pen_t> m_save_pen; // pens for save/restore
- dynamic_array<float> m_save_contrast; // brightness for save/restore
+ std::vector<pen_t> m_save_pen; // pens for save/restore
+ std::vector<float> m_save_contrast; // brightness for save/restore
- dynamic_array<pen_t> m_pen_array;
- dynamic_array<pen_t> m_shadow_array;
- dynamic_array<pen_t> m_hilight_array;
+ std::vector<pen_t> m_pen_array;
+ std::vector<pen_t> m_shadow_array;
+ std::vector<pen_t> m_hilight_array;
palette_init_delegate m_init;
};
diff --git a/src/emu/fileio.c b/src/emu/fileio.c
index b88e191d376..a19368d7065 100644
--- a/src/emu/fileio.c
+++ b/src/emu/fileio.c
@@ -239,15 +239,15 @@ hash_collection &emu_file::hashes(const char *types)
return m_hashes;
// if we have ZIP data, just hash that directly
- if (m__7zdata.count() != 0)
+ if (!m__7zdata.empty())
{
- m_hashes.compute(m__7zdata, m__7zdata.count(), needed.c_str());
+ m_hashes.compute(&m__7zdata[0], m__7zdata.size(), needed.c_str());
return m_hashes;
}
- if (m_zipdata.count() != 0)
+ if (!m_zipdata.empty())
{
- m_hashes.compute(m_zipdata, m_zipdata.count(), needed.c_str());
+ m_hashes.compute(&m_zipdata[0], m_zipdata.size(), needed.c_str());
return m_hashes;
}
@@ -409,8 +409,8 @@ void emu_file::close()
core_fclose(m_file);
m_file = NULL;
- m__7zdata.reset();
- m_zipdata.reset();
+ m__7zdata.clear();
+ m_zipdata.clear();
if (m_remove_on_close)
osd_rmfile(m_fullpath.c_str());
@@ -751,25 +751,25 @@ file_error emu_file::attempt_zipped()
file_error emu_file::load_zipped_file()
{
assert(m_file == NULL);
- assert(m_zipdata.count() == 0);
+ assert(m_zipdata.empty());
assert(m_zipfile != NULL);
// allocate some memory
m_zipdata.resize(m_ziplength);
// read the data into our buffer and return
- zip_error ziperr = zip_file_decompress(m_zipfile, m_zipdata, m_zipdata.count());
+ zip_error ziperr = zip_file_decompress(m_zipfile, &m_zipdata[0], m_zipdata.size());
if (ziperr != ZIPERR_NONE)
{
- m_zipdata.reset();
+ m_zipdata.clear();
return FILERR_FAILURE;
}
// convert to RAM file
- file_error filerr = core_fopen_ram(m_zipdata, m_zipdata.count(), m_openflags, &m_file);
+ file_error filerr = core_fopen_ram(&m_zipdata[0], m_zipdata.size(), m_openflags, &m_file);
if (filerr != FILERR_NONE)
{
- m_zipdata.reset();
+ m_zipdata.clear();
return FILERR_FAILURE;
}
@@ -880,25 +880,25 @@ file_error emu_file::attempt__7zped()
file_error emu_file::load__7zped_file()
{
assert(m_file == NULL);
- assert(m__7zdata.count() == 0);
+ assert(m__7zdata.empty());
assert(m__7zfile != NULL);
// allocate some memory
m__7zdata.resize(m__7zlength);
// read the data into our buffer and return
- _7z_error _7zerr = _7z_file_decompress(m__7zfile, m__7zdata, m__7zdata.count());
+ _7z_error _7zerr = _7z_file_decompress(m__7zfile, &m__7zdata[0], m__7zdata.size());
if (_7zerr != _7ZERR_NONE)
{
- m__7zdata.reset();
+ m__7zdata.clear();
return FILERR_FAILURE;
}
// convert to RAM file
- file_error filerr = core_fopen_ram(m__7zdata, m__7zdata.count(), m_openflags, &m_file);
+ file_error filerr = core_fopen_ram(&m__7zdata[0], m__7zdata.size(), m_openflags, &m_file);
if (filerr != FILERR_NONE)
{
- m__7zdata.reset();
+ m__7zdata.clear();
return FILERR_FAILURE;
}
diff --git a/src/emu/imagedev/floppy.c b/src/emu/imagedev/floppy.c
index 780bdf2d5b7..ddee7047dda 100644
--- a/src/emu/imagedev/floppy.c
+++ b/src/emu/imagedev/floppy.c
@@ -596,18 +596,18 @@ void floppy_image_device::seek_phase_w(int phases)
dskchg = 1;
}
-int floppy_image_device::find_index(UINT32 position, const UINT32 *buf, int buf_size)
+int floppy_image_device::find_index(UINT32 position, const std::vector<UINT32> &buf)
{
- int spos = (buf_size >> 1)-1;
+ int spos = (buf.size() >> 1)-1;
int step;
- for(step=1; step<buf_size+1; step<<=1);
+ for(step=1; step<buf.size()+1; step<<=1);
step >>= 1;
for(;;) {
- if(spos >= buf_size || (spos > 0 && (buf[spos] & floppy_image::TIME_MASK) > position)) {
+ if(spos >= buf.size() || (spos > 0 && (buf[spos] & floppy_image::TIME_MASK) > position)) {
spos -= step;
step >>= 1;
- } else if(spos < 0 || (spos < buf_size-1 && (buf[spos+1] & floppy_image::TIME_MASK) <= position)) {
+ } else if(spos < 0 || (spos < buf.size()-1 && (buf[spos+1] & floppy_image::TIME_MASK) <= position)) {
spos += step;
step >>= 1;
} else
@@ -637,15 +637,15 @@ attotime floppy_image_device::get_next_transition(const attotime &from_when)
if(!image || mon)
return attotime::never;
- int cells = image->get_track_size(cyl, ss, subcyl);
+ std::vector<UINT32> &buf = image->get_buffer(cyl, ss, subcyl);
+ UINT32 cells = buf.size();
if(cells <= 1)
return attotime::never;
attotime base;
UINT32 position = find_position(base, from_when);
- const UINT32 *buf = image->get_buffer(cyl, ss, subcyl);
- int index = find_index(position, buf, cells);
+ int index = find_index(position, buf);
if(index == -1)
return attotime::never;
@@ -671,21 +671,18 @@ void floppy_image_device::write_flux(const attotime &start, const attotime &end,
int start_pos = find_position(base, start);
int end_pos = find_position(base, end);
- dynamic_array<int> trans_pos(transition_count);
+ std::vector<int> trans_pos(transition_count);
for(int i=0; i != transition_count; i++)
trans_pos[i] = find_position(base, transitions[i]);
- int cells = image->get_track_size(cyl, ss, subcyl);
- UINT32 *buf = image->get_buffer(cyl, ss, subcyl);
+ std::vector<UINT32> &buf = image->get_buffer(cyl, ss, subcyl);
int index;
- if(cells)
- index = find_index(start_pos, buf, cells);
+ if(!buf.empty())
+ index = find_index(start_pos, buf);
else {
index = 0;
- image->set_track_size(cyl, ss, 1, subcyl);
- buf = image->get_buffer(cyl, ss, subcyl);
- buf[cells++] = floppy_image::MG_N;
+ buf.push_back(floppy_image::MG_N);
}
if(index && (buf[index] & floppy_image::TIME_MASK) == start_pos)
@@ -697,28 +694,27 @@ void floppy_image_device::write_flux(const attotime &start, const attotime &end,
UINT32 pos = start_pos;
int ti = 0;
+ int cells = buf.size();
while(pos != end_pos) {
- if(image->get_track_size(cyl, ss, subcyl) < cells+10) {
- image->set_track_size(cyl, ss, cells+200, subcyl);
- buf = image->get_buffer(cyl, ss, subcyl);
- }
+ if(buf.size() < cells+10)
+ buf.resize(cells+200);
UINT32 next_pos;
if(ti != transition_count)
next_pos = trans_pos[ti++];
else
next_pos = end_pos;
if(next_pos > pos)
- write_zone(buf, cells, index, pos, next_pos, cur_mg);
+ write_zone(&buf[0], cells, index, pos, next_pos, cur_mg);
else {
- write_zone(buf, cells, index, pos, 200000000, cur_mg);
+ write_zone(&buf[0], cells, index, pos, 200000000, cur_mg);
index = 0;
- write_zone(buf, cells, index, 0, next_pos, cur_mg);
+ write_zone(&buf[0], cells, index, 0, next_pos, cur_mg);
}
pos = next_pos;
cur_mg = cur_mg == floppy_image::MG_A ? floppy_image::MG_B : floppy_image::MG_A;
}
- image->set_track_size(cyl, ss, cells, subcyl);
+ buf.resize(cells);
}
void floppy_image_device::write_zone(UINT32 *buf, int &cells, int &index, UINT32 spos, UINT32 epos, UINT32 mg)
diff --git a/src/emu/imagedev/floppy.h b/src/emu/imagedev/floppy.h
index 4497896c5ef..17efab51cf8 100644
--- a/src/emu/imagedev/floppy.h
+++ b/src/emu/imagedev/floppy.h
@@ -93,8 +93,7 @@ public:
void setup_ready_cb(ready_cb cb);
void setup_wpt_cb(wpt_cb cb);
- UINT32* get_buffer() { return image->get_buffer(cyl, ss); }
- UINT32 get_len() { return image->get_track_size(cyl, ss); }
+ std::vector<UINT32> &get_buffer() { return image->get_buffer(cyl, ss, subcyl); }
int get_cyl() { return cyl; }
void mon_w(int state);
@@ -181,7 +180,7 @@ protected:
wpt_cb cur_wpt_cb;
UINT32 find_position(attotime &base, const attotime &when);
- int find_index(UINT32 position, const UINT32 *buf, int buf_size);
+ int find_index(UINT32 position, const std::vector<UINT32> &buf);
void write_zone(UINT32 *buf, int &cells, int &index, UINT32 spos, UINT32 epos, UINT32 mg);
void commit_image();
};
diff --git a/src/emu/ioport.c b/src/emu/ioport.c
index 66743cb4c21..507ac6206ac 100644
--- a/src/emu/ioport.c
+++ b/src/emu/ioport.c
@@ -1097,7 +1097,7 @@ void natural_keyboard::build_codes(ioport_manager &manager)
newcode.field[1] = field;
}
newcode.ch = code;
- m_keycode_map.append(newcode);
+ m_keycode_map.push_back(newcode);
if (LOG_NATURAL_KEYBOARD)
{
@@ -1190,9 +1190,9 @@ void natural_keyboard::internal_post(unicode_char ch)
// add to the buffer, resizing if necessary
m_buffer[m_bufend++] = ch;
- if ((m_bufend + 1) % m_buffer.count() == m_bufbegin)
- m_buffer.resize_keep(m_buffer.count() + KEY_BUFFER_SIZE);
- m_bufend %= m_buffer.count();
+ if ((m_bufend + 1) % m_buffer.size() == m_bufbegin)
+ m_buffer.resize(m_buffer.size() + KEY_BUFFER_SIZE);
+ m_bufend %= m_buffer.size();
}
@@ -1208,7 +1208,7 @@ void natural_keyboard::timer(void *ptr, int param)
{
while (!empty() && m_queue_chars(&m_buffer[m_bufbegin], 1))
{
- m_bufbegin = (m_bufbegin + 1) % m_buffer.count();
+ m_bufbegin = (m_bufbegin + 1) % m_buffer.size();
if (m_current_rate != attotime::zero)
break;
}
@@ -1218,7 +1218,7 @@ void natural_keyboard::timer(void *ptr, int param)
else
{
if (m_status_keydown)
- m_bufbegin = (m_bufbegin + 1) % m_buffer.count();
+ m_bufbegin = (m_bufbegin + 1) % m_buffer.size();
m_status_keydown = !m_status_keydown;
}
@@ -1274,7 +1274,7 @@ const char *natural_keyboard::unicode_to_string(astring &buffer, unicode_char ch
const natural_keyboard::keycode_map_entry *natural_keyboard::find_code(unicode_char ch) const
{
- for (int index = 0; index < m_keycode_map.count(); index++)
+ for (unsigned int index = 0; index < m_keycode_map.size(); index++)
{
if (m_keycode_map[index].ch == ch)
return &m_keycode_map[index];
@@ -1341,7 +1341,7 @@ astring natural_keyboard::dump()
const size_t left_column_width = 24;
// loop through all codes
- for (int index = 0; index < m_keycode_map.count(); index++)
+ for (unsigned int index = 0; index < m_keycode_map.size(); index++)
{
// describe the character code
const natural_keyboard::keycode_map_entry &code = m_keycode_map[index];
@@ -3031,8 +3031,8 @@ void ioport_manager::load_remap_table(xml_data_node *parentnode)
if (count > 0)
{
// allocate tables
- dynamic_array<input_code> oldtable(count);
- dynamic_array<input_code> newtable(count);
+ std::vector<input_code> oldtable(count);
+ std::vector<input_code> newtable(count);
// build up the remap table
count = 0;
diff --git a/src/emu/ioport.h b/src/emu/ioport.h
index 55a30c39782..49058ab061d 100644
--- a/src/emu/ioport.h
+++ b/src/emu/ioport.h
@@ -816,8 +816,8 @@ public:
// getters and queries
running_machine &machine() const { return m_machine; }
bool empty() const { return (m_bufbegin == m_bufend); }
- bool full() const { return ((m_bufend + 1) % m_buffer.count()) == m_bufbegin; }
- bool can_post() const { return (!m_queue_chars.isnull() || m_keycode_map.count() != 0); }
+ bool full() const { return ((m_bufend + 1) % m_buffer.size()) == m_bufbegin; }
+ bool can_post() const { return (!m_queue_chars.isnull() || !m_keycode_map.empty()); }
bool is_posting() const { return (!empty() || (!m_charqueue_empty.isnull() && !m_charqueue_empty())); }
// configuration
@@ -857,7 +857,7 @@ private:
running_machine & m_machine; // reference to our machine
UINT32 m_bufbegin; // index of starting character
UINT32 m_bufend; // index of ending character
- dynamic_array<unicode_char> m_buffer; // actual buffer
+ std::vector<unicode_char> m_buffer; // actual buffer
bool m_status_keydown; // current keydown status
bool m_last_cr; // was the last char a CR?
emu_timer * m_timer; // timer for posting characters
@@ -865,7 +865,7 @@ private:
ioport_queue_chars_delegate m_queue_chars; // queue characters callback
ioport_accept_char_delegate m_accept_char; // accept character callback
ioport_charqueue_empty_delegate m_charqueue_empty; // character queue empty callback
- dynamic_array<keycode_map_entry> m_keycode_map; // keycode map
+ std::vector<keycode_map_entry> m_keycode_map; // keycode map
};
diff --git a/src/emu/machine/7200fifo.h b/src/emu/machine/7200fifo.h
index 937a6e96978..65256fc0e33 100644
--- a/src/emu/machine/7200fifo.h
+++ b/src/emu/machine/7200fifo.h
@@ -113,7 +113,7 @@ private:
void fifo_write(UINT16 data);
UINT16 fifo_read();
- dynamic_array<UINT16> m_buffer;
+ std::vector<UINT16> m_buffer;
int m_ram_size;
int m_read_ptr;
diff --git a/src/emu/machine/at28c16.c b/src/emu/machine/at28c16.c
index cd773f61073..ed0ec69ed09 100644
--- a/src/emu/machine/at28c16.c
+++ b/src/emu/machine/at28c16.c
@@ -147,7 +147,7 @@ void at28c16_device::nvram_read( emu_file &file )
{
dynamic_buffer buffer( AT28C16_TOTAL_BYTES );
- file.read( buffer, AT28C16_TOTAL_BYTES );
+ file.read( &buffer[0], AT28C16_TOTAL_BYTES );
for( offs_t offs = 0; offs < AT28C16_TOTAL_BYTES; offs++ )
{
@@ -169,7 +169,7 @@ void at28c16_device::nvram_write( emu_file &file )
buffer[ offs ] = m_addrspace[ 0 ]->read_byte( offs );
}
- file.write( buffer, AT28C16_TOTAL_BYTES );
+ file.write( &buffer[0], AT28C16_TOTAL_BYTES );
}
diff --git a/src/emu/machine/at45dbxx.c b/src/emu/machine/at45dbxx.c
index 657ce88f008..f482b147773 100644
--- a/src/emu/machine/at45dbxx.c
+++ b/src/emu/machine/at45dbxx.c
@@ -140,7 +140,7 @@ void at45db041_device::device_reset()
void at45db041_device::nvram_default()
{
- m_data.clear(0xff);
+ memset(&m_data[0], 0xff, m_data.size());
if (region() != NULL)
{
@@ -148,7 +148,7 @@ void at45db041_device::nvram_default()
if (bytes > m_size)
bytes = m_size;
- memcpy(m_data, region()->base(), bytes);
+ memcpy(&m_data[0], region()->base(), bytes);
}
}
@@ -159,7 +159,7 @@ void at45db041_device::nvram_default()
void at45db041_device::nvram_read(emu_file &file)
{
- file.read(m_data, m_size);
+ file.read(&m_data[0], m_size);
}
//-------------------------------------------------
@@ -169,7 +169,7 @@ void at45db041_device::nvram_read(emu_file &file)
void at45db041_device::nvram_write(emu_file &file)
{
- file.write(m_data, m_size);
+ file.write(&m_data[0], m_size);
}
UINT8 at45db041_device::read_byte()
@@ -255,7 +255,7 @@ void at45db041_device::write_byte(UINT8 data)
UINT8 comp;
page = flash_get_page_addr();
_logerror( 1, ("at45dbxx opcode %02X - main memory page to buffer 1 compare [%04X]\n", opcode, page));
- comp = memcmp( m_data + page * page_size(), m_buffer1, page_size()) == 0 ? 0 : 1;
+ comp = memcmp( &m_data[page * page_size()], &m_buffer1[0], page_size()) == 0 ? 0 : 1;
if (comp) m_status |= 0x40; else m_status &= ~0x40;
_logerror( 1, ("at45dbxx page compare %s\n", comp ? "failure" : "success"));
m_mode = FLASH_MODE_SI;
@@ -273,7 +273,7 @@ void at45db041_device::write_byte(UINT8 data)
page = flash_get_page_addr();
byte = flash_get_byte_addr();
_logerror( 1, ("at45dbxx opcode %02X - main memory page read [%04X/%04X]\n", opcode, page, byte));
- flash_set_io(m_data + page * page_size(), page_size(), byte);
+ flash_set_io(&m_data[page * page_size()], page_size(), byte);
m_mode = FLASH_MODE_SO;
m_cmd.size = 8;
}
@@ -289,8 +289,8 @@ void at45db041_device::write_byte(UINT8 data)
page = flash_get_page_addr();
byte = flash_get_byte_addr();
_logerror( 1, ("at45dbxx opcode %02X - main memory page program through buffer 1 [%04X/%04X]\n",opcode, page, byte));
- flash_set_io(m_buffer1, page_size(), byte);
- m_buffer1.clear(0xFF);
+ flash_set_io(&m_buffer1[0], page_size(), byte);
+ memset(&m_buffer1[0], 0xff, m_buffer1.size());
m_mode = FLASH_MODE_SI;
m_cmd.size = 8;
}
@@ -342,7 +342,7 @@ WRITE_LINE_MEMBER(at45db041_device::cs_w)
page = flash_get_page_addr();
byte = flash_get_byte_addr();
_logerror( 1, ("at45dbxx - program data stored in buffer 1 into selected page in main memory [%04X/%04X]\n", page, byte));
- memcpy( m_data + page * page_size(), m_buffer1, page_size());
+ memcpy( &m_data[page * page_size()], &m_buffer1[0], page_size());
}
// reset
at45db041_device::device_reset();
diff --git a/src/emu/machine/at45dbxx.h b/src/emu/machine/at45dbxx.h
index 5e2131c1508..10ec5a3f36a 100644
--- a/src/emu/machine/at45dbxx.h
+++ b/src/emu/machine/at45dbxx.h
@@ -47,7 +47,7 @@ public:
DECLARE_WRITE_LINE_MEMBER(si_w);
DECLARE_READ_LINE_MEMBER(so_r);
- UINT8 *get_ptr() { return m_data; }
+ UINT8 *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;
diff --git a/src/emu/machine/atapihle.c b/src/emu/machine/atapihle.c
index bf38db0aae8..746a28a6a08 100644
--- a/src/emu/machine/atapihle.c
+++ b/src/emu/machine/atapihle.c
@@ -32,7 +32,7 @@ void atapi_hle_device::process_buffer()
m_error = 0; // HACK: This might not be the right place, but firebeat needs this cleared at some point
- SetCommand(m_buffer, m_buffer_size);
+ SetCommand(&m_buffer[0], m_buffer_size);
ExecCommand();
GetLength(&m_data_size);
@@ -79,7 +79,7 @@ void atapi_hle_device::process_buffer()
switch (m_command)
{
case IDE_COMMAND_PACKET:
- WriteData( m_buffer, m_buffer_size );
+ WriteData( &m_buffer[0], m_buffer_size );
m_data_size -= m_buffer_size;
wait_buffer();
@@ -107,7 +107,7 @@ void atapi_hle_device::fill_buffer()
if (m_buffer_size > 0)
{
- ReadData( m_buffer, m_buffer_size );
+ ReadData( &m_buffer[0], m_buffer_size );
m_data_size -= m_buffer_size;
m_status |= IDE_STATUS_DRQ;
diff --git a/src/emu/machine/dp8390.c b/src/emu/machine/dp8390.c
index a589d8465fb..27b4afb98b4 100644
--- a/src/emu/machine/dp8390.c
+++ b/src/emu/machine/dp8390.c
@@ -78,7 +78,7 @@ void dp8390_device::do_tx() {
buf.resize(m_regs.tbcr);
for(i = 0; i < m_regs.tbcr; i++) buf[i] = m_mem_read_cb(high16 + (m_regs.tpsr << 8) + i);
- if(send(buf, m_regs.tbcr)) {
+ if(send(&buf[0], m_regs.tbcr)) {
m_regs.tsr = 1;
m_regs.isr |= 2;
} else {
diff --git a/src/emu/machine/eeprom.c b/src/emu/machine/eeprom.c
index d1418bd860d..a0e8886e7f4 100644
--- a/src/emu/machine/eeprom.c
+++ b/src/emu/machine/eeprom.c
@@ -326,7 +326,7 @@ void eeprom_base_device::nvram_read(emu_file &file)
UINT32 eeprom_bytes = eeprom_length * m_data_bits / 8;
dynamic_buffer buffer(eeprom_bytes);
- file.read(buffer, eeprom_bytes);
+ file.read(&buffer[0], eeprom_bytes);
for (offs_t offs = 0; offs < eeprom_bytes; offs++)
m_addrspace[0]->write_byte(offs, buffer[offs]);
}
@@ -345,7 +345,7 @@ void eeprom_base_device::nvram_write(emu_file &file)
dynamic_buffer buffer(eeprom_bytes);
for (offs_t offs = 0; offs < eeprom_bytes; offs++)
buffer[offs] = m_addrspace[0]->read_byte(offs);
- file.write(buffer, eeprom_bytes);
+ file.write(&buffer[0], eeprom_bytes);
}
diff --git a/src/emu/machine/i2cmem.c b/src/emu/machine/i2cmem.c
index 3c09adc9fbd..119d57eb226 100644
--- a/src/emu/machine/i2cmem.c
+++ b/src/emu/machine/i2cmem.c
@@ -208,7 +208,7 @@ void i2cmem_device::nvram_read( emu_file &file )
int i2cmem_bytes = m_data_size;
dynamic_buffer buffer ( i2cmem_bytes );
- file.read( buffer, i2cmem_bytes );
+ file.read( &buffer[0], i2cmem_bytes );
for( offs_t offs = 0; offs < i2cmem_bytes; offs++ )
{
@@ -231,7 +231,7 @@ void i2cmem_device::nvram_write( emu_file &file )
buffer[ offs ] = m_addrspace[ 0 ]->read_byte( offs );
}
- file.write( buffer, i2cmem_bytes );
+ file.write( &buffer[0], i2cmem_bytes );
}
diff --git a/src/emu/machine/i82875p.h b/src/emu/machine/i82875p.h
index 2fa14253b66..26aed95967b 100644
--- a/src/emu/machine/i82875p.h
+++ b/src/emu/machine/i82875p.h
@@ -86,7 +86,7 @@ private:
const char *cpu_tag;
int ram_size;
cpu_device *cpu;
- dynamic_array<UINT32> ram;
+ std::vector<UINT32> ram;
UINT8 agpm, fpllcont, pam[8], smram, esmramc;
UINT8 apsize, amtt, lptt;
diff --git a/src/emu/machine/idehd.c b/src/emu/machine/idehd.c
index 0abc90563f7..f7744352a61 100644
--- a/src/emu/machine/idehd.c
+++ b/src/emu/machine/idehd.c
@@ -408,7 +408,7 @@ void ata_mass_storage_device::finished_read()
set_dasp(CLEAR_LINE);
/* now do the read */
- count = read_sector(lba, m_buffer);
+ count = read_sector(lba, &m_buffer[0]);
/* if we succeeded, advance to the next sector and set the nice bits */
if (count == 1)
@@ -477,12 +477,12 @@ void ata_mass_storage_device::process_buffer()
{
if (m_command == IDE_COMMAND_SECURITY_UNLOCK)
{
- if (m_user_password_enable && memcmp(m_buffer, m_user_password, 2 + 32) == 0)
+ if (m_user_password_enable && memcmp(&m_buffer[0], m_user_password, 2 + 32) == 0)
{
LOGPRINT(("IDE Unlocked user password\n"));
m_user_password_enable = 0;
}
- if (m_master_password_enable && memcmp(m_buffer, m_master_password, 2 + 32) == 0)
+ if (m_master_password_enable && memcmp(&m_buffer[0], m_master_password, 2 + 32) == 0)
{
LOGPRINT(("IDE Unlocked master password\n"));
m_master_password_enable = 0;
@@ -538,7 +538,7 @@ void ata_mass_storage_device::finished_write()
set_dasp(CLEAR_LINE);
/* now do the write */
- count = write_sector(lba, m_buffer);
+ count = write_sector(lba, &m_buffer[0]);
/* if we succeeded, advance to the next sector and set the nice bits */
if (count == 1)
@@ -790,7 +790,7 @@ void ide_hdd_device::device_reset()
// build the features page
UINT32 metalength;
- if (m_handle->read_metadata (HARD_DISK_IDENT_METADATA_TAG, 0, m_buffer, 512, metalength) == CHDERR_NONE)
+ if (m_handle->read_metadata (HARD_DISK_IDENT_METADATA_TAG, 0, &m_buffer[0], 512, metalength) == CHDERR_NONE)
{
for( int w = 0; w < 256; w++ )
{
diff --git a/src/emu/machine/intelfsh.c b/src/emu/machine/intelfsh.c
index 5495678d525..64cc63ef7de 100644
--- a/src/emu/machine/intelfsh.c
+++ b/src/emu/machine/intelfsh.c
@@ -548,7 +548,7 @@ void intelfsh_device::nvram_default()
void intelfsh_device::nvram_read(emu_file &file)
{
dynamic_buffer buffer(m_size);
- file.read(buffer, m_size);
+ file.read(&buffer[0], m_size);
for (int byte = 0; byte < m_size; byte++)
m_addrspace[0]->write_byte(byte, buffer[byte]);
}
@@ -564,7 +564,7 @@ void intelfsh_device::nvram_write(emu_file &file)
dynamic_buffer buffer(m_size);
for (int byte = 0; byte < m_size; byte++)
buffer[byte] = m_addrspace[0]->read_byte(byte);
- file.write(buffer, m_size);
+ file.write(&buffer[0], m_size);
}
diff --git a/src/emu/machine/laserdsc.c b/src/emu/machine/laserdsc.c
index 9966ae39964..809422871a4 100644
--- a/src/emu/machine/laserdsc.c
+++ b/src/emu/machine/laserdsc.c
@@ -436,8 +436,8 @@ void laserdisc_device::sound_stream_update(sound_stream &stream, stream_sample_t
// otherwise, stream from our buffer
else
{
- INT16 *buffer0 = m_audiobuffer[0];
- INT16 *buffer1 = m_audiobuffer[1];
+ INT16 *buffer0 = &m_audiobuffer[0][0];
+ INT16 *buffer1 = &m_audiobuffer[1][0];
int sampout = m_audiobufout;
// copy samples, clearing behind us as we go
@@ -777,7 +777,7 @@ void laserdisc_device::init_disc()
// allocate memory for the precomputed per-frame metadata
err = m_disc->read_metadata(AV_LD_METADATA_TAG, 0, m_vbidata);
- if (err != CHDERR_NONE || m_vbidata.count() != totalhunks * VBI_PACKED_BYTES)
+ if (err != CHDERR_NONE || m_vbidata.size() != totalhunks * VBI_PACKED_BYTES)
throw emu_fatalerror("Precomputed VBI metadata missing or incorrect size");
}
m_maxtrack = MAX(m_maxtrack, VIRTUAL_LEAD_IN_TRACKS + VIRTUAL_LEAD_OUT_TRACKS + m_chdtracks);
@@ -993,7 +993,7 @@ void laserdisc_device::read_track_data()
// cheat and look up the metadata we are about to retrieve
vbi_metadata vbidata = { 0 };
- if (m_vbidata.count() != 0)
+ if (!m_vbidata.empty())
vbi_metadata_unpack(&vbidata, NULL, &m_vbidata[readhunk * VBI_PACKED_BYTES]);
// if we're in the lead-in area, force the VBI data to be standard lead-in
@@ -1044,7 +1044,7 @@ void laserdisc_device::read_track_data()
m_audiocursamples = 0;
// set the VBI data for the new field from our precomputed data
- if (m_vbidata.count() != 0)
+ if (!m_vbidata.empty())
{
UINT32 vbiframe;
vbi_metadata_unpack(&m_metadata[m_fieldnum], &vbiframe, &m_vbidata[readhunk * VBI_PACKED_BYTES]);
diff --git a/src/emu/machine/laserdsc.h b/src/emu/machine/laserdsc.h
index e5a724120ad..55d4aeda1b3 100644
--- a/src/emu/machine/laserdsc.h
+++ b/src/emu/machine/laserdsc.h
@@ -328,7 +328,7 @@ private:
// audio data
sound_stream * m_stream;
- dynamic_array<INT16> m_audiobuffer[2]; // buffer for audio samples
+ std::vector<INT16> m_audiobuffer[2]; // buffer for audio samples
UINT32 m_audiobufsize; // size of buffer
UINT32 m_audiobufin; // input index
UINT32 m_audiobufout; // output index
diff --git a/src/emu/machine/mc146818.c b/src/emu/machine/mc146818.c
index 46d61c2565b..268a7020eef 100644
--- a/src/emu/machine/mc146818.c
+++ b/src/emu/machine/mc146818.c
@@ -190,7 +190,7 @@ void mc146818_device::nvram_default()
if (bytes > data_size())
bytes = data_size();
- memcpy(m_data, m_region->base(), bytes);
+ memcpy(&m_data[0], m_region->base(), bytes);
}
else
{
@@ -210,7 +210,7 @@ void mc146818_device::nvram_default()
void mc146818_device::nvram_read(emu_file &file)
{
- file.read(m_data, data_size());
+ file.read(&m_data[0], data_size());
set_base_datetime();
update_timer();
@@ -225,7 +225,7 @@ void mc146818_device::nvram_read(emu_file &file)
void mc146818_device::nvram_write(emu_file &file)
{
- file.write(m_data, data_size());
+ file.write(&m_data[0], data_size());
}
diff --git a/src/emu/machine/nscsi_s1410.c b/src/emu/machine/nscsi_s1410.c
index ce9db745f45..883fd1bb2d8 100644
--- a/src/emu/machine/nscsi_s1410.c
+++ b/src/emu/machine/nscsi_s1410.c
@@ -59,9 +59,9 @@ void nscsi_s1410_device::scsi_command()
int track_length = blocks*bytes_per_sector;
dynamic_buffer data(track_length);
- memset(data, 0xc6, track_length);
+ memset(&data[0], 0xc6, track_length);
- if(!hard_disk_write(harddisk, lba, data)) {
+ if(!hard_disk_write(harddisk, lba, &data[0])) {
logerror("%s: HD WRITE ERROR !\n", tag());
scsi_status_complete(SS_FORMAT_ERROR);
} else {
diff --git a/src/emu/machine/pci.c b/src/emu/machine/pci.c
index cc2ee6b0f65..f4681aaaf9e 100644
--- a/src/emu/machine/pci.c
+++ b/src/emu/machine/pci.c
@@ -401,7 +401,7 @@ device_t *pci_bridge_device::bus_root()
void pci_bridge_device::set_remap_cb(mapper_cb _remap_cb)
{
remap_cb = _remap_cb;
- for(int i=0; i != all_devices.count(); i++)
+ for(unsigned int i=0; i != all_devices.size(); i++)
if(all_devices[i] != this)
all_devices[i]->set_remap_cb(_remap_cb);
}
@@ -430,13 +430,13 @@ void pci_bridge_device::device_start()
if((i & 7) && sub_devices[i & ~7])
sub_devices[i & ~7]->set_multifunction_device(true);
- all_devices.append(sub_devices[i]);
+ all_devices.push_back(sub_devices[i]);
if(sub_devices[i] != this) {
sub_devices[i]->remap_config_cb = cf_cb;
sub_devices[i]->set_remap_cb(remap_cb);
pci_bridge_device *bridge = dynamic_cast<pci_bridge_device *>(sub_devices[i]);
if(bridge)
- all_bridges.append(bridge);
+ all_bridges.push_back(bridge);
}
}
}
@@ -456,7 +456,7 @@ void pci_bridge_device::reset_all_mappings()
{
pci_device::reset_all_mappings();
- for(int i=0; i != all_devices.count(); i++)
+ for(unsigned int i=0; i != all_devices.size(); i++)
if(all_devices[i] != this)
all_devices[i]->reset_all_mappings();
@@ -475,7 +475,7 @@ void pci_bridge_device::reset_all_mappings()
void pci_bridge_device::map_device(UINT64 memory_window_start, UINT64 memory_window_end, UINT64 memory_offset, address_space *memory_space,
UINT64 io_window_start, UINT64 io_window_end, UINT64 io_offset, address_space *io_space)
{
- for(int i = all_devices.count()-1; i>=0; i--)
+ for(int i = int(all_devices.size())-1; i>=0; i--)
if(all_devices[i] != this)
all_devices[i]->map_device(memory_window_start, memory_window_end, memory_offset, memory_space,
io_window_start, io_window_end, io_offset, io_space);
@@ -507,7 +507,7 @@ UINT32 pci_bridge_device::do_config_read(UINT8 bus, UINT8 device, UINT16 reg, UI
UINT32 pci_bridge_device::propagate_config_read(UINT8 bus, UINT8 device, UINT16 reg, UINT32 mem_mask)
{
UINT32 data = 0xffffffff;
- for(int i=0; i != all_bridges.count(); i++)
+ for(unsigned int i=0; i != all_bridges.size(); i++)
data &= all_bridges[i]->config_read(bus, device, reg, mem_mask);
return data;
}
@@ -533,7 +533,7 @@ void pci_bridge_device::do_config_write(UINT8 bus, UINT8 device, UINT16 reg, UIN
void pci_bridge_device::propagate_config_write(UINT8 bus, UINT8 device, UINT16 reg, UINT32 data, UINT32 mem_mask)
{
- for(int i=0; i != all_bridges.count(); i++)
+ for(unsigned int i=0; i != all_bridges.size(); i++)
all_bridges[i]->config_write(bus, device, reg, data, mem_mask);
}
diff --git a/src/emu/machine/pci.h b/src/emu/machine/pci.h
index f14cb87a891..67aad0e0038 100644
--- a/src/emu/machine/pci.h
+++ b/src/emu/machine/pci.h
@@ -190,8 +190,8 @@ public:
protected:
pci_device *sub_devices[32*8];
- dynamic_array<pci_device *> all_devices;
- dynamic_array<pci_bridge_device *> all_bridges;
+ std::vector<pci_device *> all_devices;
+ std::vector<pci_bridge_device *> all_bridges;
UINT32 prefetch_baseu, prefetch_limitu;
UINT16 bridge_control, memory_base, memory_limit, prefetch_base, prefetch_limit, iobaseu, iolimitu;
diff --git a/src/emu/machine/pla.h b/src/emu/machine/pla.h
index 411b1bec15b..a84ab2612a6 100644
--- a/src/emu/machine/pla.h
+++ b/src/emu/machine/pla.h
@@ -121,7 +121,7 @@ private:
UINT64 m_xor;
int m_cache_size;
- dynamic_array<UINT32> m_cache;
+ std::vector<UINT32> m_cache;
UINT64 m_cache2[CACHE2_SIZE];
UINT8 m_cache2_ptr;
diff --git a/src/emu/machine/ram.c b/src/emu/machine/ram.c
index 5a82254d994..47d53a48082 100644
--- a/src/emu/machine/ram.c
+++ b/src/emu/machine/ram.c
@@ -61,7 +61,8 @@ void ram_device::device_start()
m_size = default_size();
/* allocate space for the ram */
- m_pointer.resize_and_clear(m_size, m_default_value);
+ m_pointer.resize(m_size);
+ memset(&m_pointer[0], m_default_value, m_size);
/* register for state saving */
save_item(NAME(m_size));
diff --git a/src/emu/machine/ram.h b/src/emu/machine/ram.h
index a1d34805c45..7f4a20471ec 100644
--- a/src/emu/machine/ram.h
+++ b/src/emu/machine/ram.h
@@ -57,7 +57,7 @@ public:
// accessors
UINT32 size(void) const { return m_size; }
UINT32 mask(void) const { return m_size - 1; }
- UINT8 *pointer(void) { return m_pointer; }
+ UINT8 *pointer(void) { return &m_pointer[0]; }
static UINT32 parse_string(const char *s);
UINT32 default_size(void) const;
const char *extra_options(void) const { return m_extra_options; }
diff --git a/src/emu/machine/s2636.c b/src/emu/machine/s2636.c
index 01a01e9038f..3931d85aa97 100644
--- a/src/emu/machine/s2636.c
+++ b/src/emu/machine/s2636.c
@@ -112,7 +112,8 @@ void s2636_device::device_start()
int width = m_screen->width();
int height = m_screen->height();
- m_work_ram.resize_and_clear(m_work_ram_size);
+ m_work_ram.resize(m_work_ram_size);
+ memset(&m_work_ram[0], 0, m_work_ram_size);
m_bitmap.resize(width, height);
m_collision_bitmap.resize(width, height);
diff --git a/src/emu/machine/serflash.c b/src/emu/machine/serflash.c
index f4014da10c2..8ea9a4445ea 100644
--- a/src/emu/machine/serflash.c
+++ b/src/emu/machine/serflash.c
@@ -37,8 +37,8 @@ void serflash_device::device_start()
m_length = machine().root_device().memregion( tag() )->bytes();
m_region = machine().root_device().memregion( tag() )->base();
- m_flashwritemap.resize_and_clear(m_length / FLASH_PAGE_SIZE);
-
+ m_flashwritemap.resize(m_length / FLASH_PAGE_SIZE);
+ memset(&m_flashwritemap[0], 0, m_length / FLASH_PAGE_SIZE);
}
void serflash_device::device_reset()
diff --git a/src/emu/machine/smc92x4.c b/src/emu/machine/smc92x4.c
index c5e4698d6c0..a6581dd6baf 100644
--- a/src/emu/machine/smc92x4.c
+++ b/src/emu/machine/smc92x4.c
@@ -773,12 +773,12 @@ void smc92x4_device::data_transfer_read(chrn_id_hd id, int transfer_enable)
if (m_selected_drive_type & TYPE_FLOPPY)
{
- m_drive->floppy_drive_read_sector_data(id.H, sector_data_id, buf, sector_len);
+ m_drive->floppy_drive_read_sector_data(id.H, sector_data_id, &buf[0], sector_len);
}
else
{
// TODO: Should we get the sector length from the harddisk?
- m_harddisk->read_sector(id.C, id.H, id.R, buf);
+ m_harddisk->read_sector(id.C, id.H, id.R, &buf[0]);
}
sync_status_in();
@@ -867,11 +867,11 @@ void smc92x4_device::data_transfer_write(chrn_id_hd id, int deldata, int redcur,
if (m_selected_drive_type & TYPE_FLOPPY)
{
if (VERBOSE>4) LOG("smc92x4 info: write sector CHS=(%d,%d,%d)\n", id.C, id.H, id.R);
- m_drive->floppy_drive_write_sector_data(id.H, sector_data_id, buf, sector_len, false);
+ m_drive->floppy_drive_write_sector_data(id.H, sector_data_id, &buf[0], sector_len, false);
}
else
{
- m_harddisk->write_sector(id.C, id.H, id.R, buf);
+ m_harddisk->write_sector(id.C, id.H, id.R, &buf[0]);
}
sync_status_in();
@@ -1476,7 +1476,7 @@ void smc92x4_device::format_floppy_track(int flags)
memset(&buffer[index], gap_byte, gap4);
index += gap4;
- m_drive->floppy_drive_write_track_data_info_buffer(m_register_w[DESIRED_HEAD]&0x0f, buffer, &data_count);
+ m_drive->floppy_drive_write_track_data_info_buffer(m_register_w[DESIRED_HEAD]&0x0f, &buffer[0], &data_count);
sync_status_in();
}
@@ -1573,7 +1573,7 @@ void smc92x4_device::format_harddisk_track(int flags)
for (i=0; i < gap4; i++) buffer[index++] = gap_byte;
// Now write the whole track
- m_harddisk->write_track(m_register_w[DESIRED_HEAD]&0x0f, buffer, data_count);
+ m_harddisk->write_track(m_register_w[DESIRED_HEAD]&0x0f, &buffer[0], data_count);
sync_status_in();
}
@@ -1622,7 +1622,7 @@ void smc92x4_device::read_floppy_track(bool transfer_only_ids)
buffer.resize(data_count);
- m_drive->floppy_drive_read_track_data_info_buffer(m_register_w[DESIRED_HEAD]&0x0f, (char *)(UINT8 *)buffer, &data_count);
+ m_drive->floppy_drive_read_track_data_info_buffer(m_register_w[DESIRED_HEAD]&0x0f, (char *)&buffer[0], &data_count);
sync_status_in();
// Transfer the buffer to the external memory. We assume the memory
@@ -1654,7 +1654,7 @@ void smc92x4_device::read_harddisk_track(bool transfer_only_ids)
buffer.resize(data_count);
/* buffer and data_count are allocated and set by the function. */
- m_harddisk->read_track(m_register_w[DESIRED_HEAD]&0x0f, buffer);
+ m_harddisk->read_track(m_register_w[DESIRED_HEAD]&0x0f, &buffer[0]);
sync_status_in();
if (!(m_register_r[DRIVE_STATUS] & DS_READY))
diff --git a/src/emu/machine/stvcd.c b/src/emu/machine/stvcd.c
index 16f02612b9a..2735a9c5fd2 100644
--- a/src/emu/machine/stvcd.c
+++ b/src/emu/machine/stvcd.c
@@ -1429,7 +1429,7 @@ void saturn_state::stvcd_reset( void )
cd_stat |= CD_STAT_PERI;
cur_track = 0xff;
- curdir.reset();
+ curdir.clear();
xfertype = XFERTYPE_INVALID;
xfertype32 = XFERTYPE32_INVALID;
@@ -2140,7 +2140,7 @@ void saturn_state::make_dir_current(UINT32 fad)
dynamic_buffer sect(MAX_DIR_SIZE);
direntryT *curentry;
- memset(sect, 0, MAX_DIR_SIZE);
+ memset(&sect[0], 0, MAX_DIR_SIZE);
if(sectlenin != 2048)
popmessage("Sector Length %d, contact MAMEdev (1)",sectlenin);
@@ -2165,7 +2165,7 @@ void saturn_state::make_dir_current(UINT32 fad)
}
curdir.resize(numentries);
- curentry = curdir;
+ curentry = &curdir[0];
numfiles = numentries;
nextent = 0;
@@ -2233,7 +2233,7 @@ void saturn_state::make_dir_current(UINT32 fad)
void saturn_state::stvcd_exit( void )
{
- curdir.reset();
+ curdir.clear();
if (cdrom)
{
diff --git a/src/emu/machine/timekpr.c b/src/emu/machine/timekpr.c
index b32eddb1db5..64d90ffc42e 100644
--- a/src/emu/machine/timekpr.c
+++ b/src/emu/machine/timekpr.c
@@ -257,28 +257,28 @@ void timekeeper_device::device_reset() { }
void timekeeper_device::counters_to_ram()
{
- counter_to_ram( m_data, m_offset_control, m_control );
- counter_to_ram( m_data, m_offset_seconds, m_seconds );
- counter_to_ram( m_data, m_offset_minutes, m_minutes );
- counter_to_ram( m_data, m_offset_hours, m_hours );
- counter_to_ram( m_data, m_offset_day, m_day );
- counter_to_ram( m_data, m_offset_date, m_date );
- counter_to_ram( m_data, m_offset_month, m_month );
- counter_to_ram( m_data, m_offset_year, m_year );
- counter_to_ram( m_data, m_offset_century, m_century );
+ counter_to_ram( &m_data[0], m_offset_control, m_control );
+ counter_to_ram( &m_data[0], m_offset_seconds, m_seconds );
+ counter_to_ram( &m_data[0], m_offset_minutes, m_minutes );
+ counter_to_ram( &m_data[0], m_offset_hours, m_hours );
+ counter_to_ram( &m_data[0], m_offset_day, m_day );
+ counter_to_ram( &m_data[0], m_offset_date, m_date );
+ counter_to_ram( &m_data[0], m_offset_month, m_month );
+ counter_to_ram( &m_data[0], m_offset_year, m_year );
+ counter_to_ram( &m_data[0], m_offset_century, m_century );
}
void timekeeper_device::counters_from_ram()
{
- m_control = counter_from_ram( m_data, m_offset_control );
- m_seconds = counter_from_ram( m_data, m_offset_seconds );
- m_minutes = counter_from_ram( m_data, m_offset_minutes );
- m_hours = counter_from_ram( m_data, m_offset_hours );
- m_day = counter_from_ram( m_data, m_offset_day );
- m_date = counter_from_ram( m_data, m_offset_date );
- m_month = counter_from_ram( m_data, m_offset_month );
- m_year = counter_from_ram( m_data, m_offset_year );
- m_century = counter_from_ram( m_data, m_offset_century );
+ m_control = counter_from_ram( &m_data[0], m_offset_control );
+ m_seconds = counter_from_ram( &m_data[0], m_offset_seconds );
+ m_minutes = counter_from_ram( &m_data[0], m_offset_minutes );
+ m_hours = counter_from_ram( &m_data[0], m_offset_hours );
+ m_day = counter_from_ram( &m_data[0], m_offset_day );
+ m_date = counter_from_ram( &m_data[0], m_offset_date );
+ m_month = counter_from_ram( &m_data[0], m_offset_month );
+ m_year = counter_from_ram( &m_data[0], m_offset_year );
+ m_century = counter_from_ram( &m_data[0], m_offset_century );
}
void timekeeper_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
@@ -398,11 +398,11 @@ void timekeeper_device::nvram_default()
{
if( m_default_data != NULL )
{
- memcpy( m_data, m_default_data, m_size );
+ memcpy( &m_data[0], m_default_data, m_size );
}
else
{
- m_data.clear( 0xff );
+ memset( &m_data[0], 0xff, m_data.size());
}
if ( m_offset_flags >= 0 )
@@ -418,7 +418,7 @@ void timekeeper_device::nvram_default()
void timekeeper_device::nvram_read(emu_file &file)
{
- file.read( m_data, m_size );
+ file.read( &m_data[0], m_size );
counters_to_ram();
}
@@ -431,5 +431,5 @@ void timekeeper_device::nvram_read(emu_file &file)
void timekeeper_device::nvram_write(emu_file &file)
{
- file.write( m_data, m_size );
+ file.write( &m_data[0], m_size );
}
diff --git a/src/emu/machine/vrc4373.h b/src/emu/machine/vrc4373.h
index 919a04e0064..51c774d4f9a 100644
--- a/src/emu/machine/vrc4373.h
+++ b/src/emu/machine/vrc4373.h
@@ -109,11 +109,11 @@ private:
UINT32 m_ram_size;
UINT32 m_ram_base;
- dynamic_array<UINT32> m_ram;
+ std::vector<UINT32> m_ram;
UINT32 m_simm_size;
UINT32 m_simm_base;
- dynamic_array<UINT32> m_simm;
+ std::vector<UINT32> m_simm;
UINT32 m_cpu_regs[0x7c];
diff --git a/src/emu/memarray.h b/src/emu/memarray.h
index 2be61daa1eb..bea5bb19912 100644
--- a/src/emu/memarray.h
+++ b/src/emu/memarray.h
@@ -45,14 +45,14 @@ public:
// construction/destruction
memory_array();
memory_array(void *base, UINT32 bytes, int membits, endianness_t endianness, int bpe) { set(base, bytes, membits, endianness, bpe); }
- template <typename _Type> memory_array(dynamic_array<_Type> &array, endianness_t endianness, int bpe) { set(array, endianness, bpe); }
+ template <typename _Type> memory_array(std::vector<_Type> &array, endianness_t endianness, int bpe) { set(array, endianness, bpe); }
memory_array(const address_space &space, void *base, UINT32 bytes, int bpe) { set(space, base, bytes, bpe); }
memory_array(const memory_share &share, int bpe) { set(share, bpe); }
memory_array(const memory_array &array) { set(array); }
// configuration
void set(void *base, UINT32 bytes, int membits, endianness_t endianness, int bpe);
- template <typename _Type> void set(dynamic_array<_Type> &array, endianness_t endianness, int bpe) { set(&array[0], array.count(), 8*sizeof(_Type), endianness, bpe); }
+ template <typename _Type> void set(std::vector<_Type> &array, endianness_t endianness, int bpe) { set(&array[0], array.size(), 8*sizeof(_Type), endianness, bpe); }
void set(const address_space &space, void *base, UINT32 bytes, int bpe);
void set(const memory_share &share, int bpe);
void set(const memory_array &array);
diff --git a/src/emu/memory.c b/src/emu/memory.c
index da2c9c18b87..c802d428e9a 100644
--- a/src/emu/memory.c
+++ b/src/emu/memory.c
@@ -586,7 +586,7 @@ protected:
UINT16 *subtable_ptr(UINT16 entry) { return &m_table[level2_index(entry, 0)]; }
// internal state
- dynamic_array<UINT16> m_table; // pointer to base of table
+ std::vector<UINT16> m_table; // pointer to base of table
UINT16 * m_live_lookup; // current lookup
address_space & m_space; // pointer back to the space
bool m_large; // large memory model?
@@ -604,7 +604,7 @@ protected:
UINT32 m_checksum; // checksum over all the bytes
UINT32 m_usecount; // number of times this has been used
};
- dynamic_array<subtable_data> m_subtable; // info about each subtable
+ std::vector<subtable_data> m_subtable; // info about each subtable
UINT16 m_subtable_alloc; // number of subtables allocated
// static global read-only watchpoint table
@@ -698,7 +698,7 @@ private:
m_space.device().debug()->memory_read_hook(m_space, offset * sizeof(_UintType), mask);
UINT16 *oldtable = m_live_lookup;
- m_live_lookup = m_table;
+ m_live_lookup = &m_table[0];
_UintType result;
if (sizeof(_UintType) == 1) result = m_space.read_byte(offset);
if (sizeof(_UintType) == 2) result = m_space.read_word(offset << 1, mask);
@@ -768,7 +768,7 @@ private:
m_space.device().debug()->memory_write_hook(m_space, offset * sizeof(_UintType), data, mask);
UINT16 *oldtable = m_live_lookup;
- m_live_lookup = m_table;
+ m_live_lookup = &m_table[0];
if (sizeof(_UintType) == 1) m_space.write_byte(offset, data);
if (sizeof(_UintType) == 2) m_space.write_word(offset << 1, data, mask);
if (sizeof(_UintType) == 4) m_space.write_dword(offset << 2, data, mask);
@@ -2702,12 +2702,13 @@ memory_bank &address_space::bank_find_or_allocate(const char *tag, offs_t addrst
address_table::address_table(address_space &space, bool large)
: m_table(1 << LEVEL1_BITS),
- m_live_lookup(m_table),
m_space(space),
m_large(large),
m_subtable(SUBTABLE_COUNT),
m_subtable_alloc(0)
{
+ m_live_lookup = &m_table[0];
+
// make our static table all watchpoints
if (s_watchpoint_table[0] != STATIC_WATCHPOINT)
for (unsigned int i=0; i != ARRAY_LENGTH(s_watchpoint_table); i++)
@@ -3297,10 +3298,12 @@ UINT16 address_table::subtable_alloc()
m_subtable_alloc += SUBTABLE_ALLOC;
UINT32 newsize = (1 << LEVEL1_BITS) + (m_subtable_alloc << level2_bits());
- bool was_live = (m_live_lookup == m_table);
- m_table.resize_keep_and_clear_new(newsize);
+ bool was_live = (m_live_lookup == &m_table[0]);
+ int oldsize = m_table.size();
+ m_table.resize(newsize);
+ memset(&m_table[oldsize], 0, (newsize-oldsize)*sizeof(m_table[0]));
if (was_live)
- m_live_lookup = m_table;
+ m_live_lookup = &m_table[0];
}
// bump the usecount and return
m_subtable[subindex].m_usecount++;
@@ -3849,12 +3852,14 @@ memory_block::memory_block(address_space &space, offs_t bytestart, offs_t byteen
offs_t length = byteend + 1 - bytestart;
if (length < 4096)
{
- m_allocated.resize_and_clear(length);
- m_data = m_allocated;
+ m_allocated.resize(length);
+ memset(&m_allocated[0], 0, length);
+ m_data = &m_allocated[0];
}
else
{
- m_allocated.resize_and_clear(length + 0xfff);
+ m_allocated.resize(length + 0xfff);
+ memset(&m_allocated[0], 0, length + 0xfff);
m_data = reinterpret_cast<UINT8 *>((reinterpret_cast<FPTR>(&m_allocated[0]) + 0xfff) & ~0xfff);
}
}
@@ -4019,7 +4024,7 @@ void memory_bank::set_entry(int entrynum)
// validate
if (m_anonymous)
throw emu_fatalerror("memory_bank::set_entry called for anonymous bank");
- if (entrynum < 0 || entrynum >= m_entry.count())
+ if (entrynum < 0 || entrynum >= int(m_entry.size()))
throw emu_fatalerror("memory_bank::set_entry called with out-of-range entry %d", entrynum);
if (m_entry[entrynum].m_raw == NULL)
throw emu_fatalerror("memory_bank::set_entry called for bank '%s' with invalid bank entry %d", m_tag.c_str(), entrynum);
@@ -4042,7 +4047,9 @@ void memory_bank::set_entry(int entrynum)
void memory_bank::expand_entries(int entrynum)
{
// allocate a new array and copy from the old one; zero out the new entries
- m_entry.resize_keep_and_clear_new(entrynum + 1);
+ int old_size = m_entry.size();
+ m_entry.resize(entrynum + 1);
+ memset(&m_entry[old_size], 0, (entrynum+1-old_size)*sizeof(m_entry[0]));
}
@@ -4057,7 +4064,7 @@ void memory_bank::configure_entry(int entrynum, void *base)
throw emu_fatalerror("memory_bank::configure_entry called with out-of-range entry %d", entrynum);
// if we haven't allocated this many entries yet, expand our array
- if (entrynum >= m_entry.count())
+ if (entrynum >= int(m_entry.size()))
expand_entries(entrynum);
// set the entry
@@ -4093,7 +4100,7 @@ void memory_bank::configure_decrypted_entry(int entrynum, void *base)
throw emu_fatalerror("memory_bank::configure_decrypted_entry called with out-of-range entry %d", entrynum);
// if we haven't allocated this many entries yet, expand our array
- if (entrynum >= m_entry.count())
+ if (entrynum >= int(m_entry.size()))
expand_entries(entrynum);
// set the entry
diff --git a/src/emu/memory.h b/src/emu/memory.h
index 128538e0735..fff49dd6d0c 100644
--- a/src/emu/memory.h
+++ b/src/emu/memory.h
@@ -626,7 +626,7 @@ private:
offs_t m_bytestart; // byte-adjusted start offset
offs_t m_byteend; // byte-adjusted end offset
int m_curentry; // current entry
- dynamic_array<bank_entry> m_entry; // array of entries (dynamically allocated)
+ std::vector<bank_entry> m_entry; // array of entries (dynamically allocated)
astring m_name; // friendly name for this bank
astring m_tag; // tag for this bank
simple_list<bank_reference> m_reflist; // linked list of address spaces referencing this bank
@@ -693,8 +693,8 @@ public:
running_machine &machine() const { return m_machine; }
memory_region *next() const { return m_next; }
UINT8 *base() { return (this != NULL) ? &m_buffer[0] : NULL; }
- UINT8 *end() { return (this != NULL) ? base() + m_buffer.count() : NULL; }
- UINT32 bytes() const { return (this != NULL) ? m_buffer.count() : 0; }
+ UINT8 *end() { return (this != NULL) ? base() + m_buffer.size() : NULL; }
+ UINT32 bytes() const { return (this != NULL) ? m_buffer.size() : 0; }
const char *name() const { return m_name.c_str(); }
// flag expansion
diff --git a/src/emu/render.c b/src/emu/render.c
index a510a6fd7b8..ed4a7b7d1a0 100644
--- a/src/emu/render.c
+++ b/src/emu/render.c
@@ -729,7 +729,7 @@ const rgb_t *render_container::bcg_lookup_table(int texformat, palette_t *palett
recompute_lookups();
}
assert (palette == &m_palclient->palette());
- return m_bcglookup;
+ return &m_bcglookup[0];
case TEXFORMAT_RGB32:
case TEXFORMAT_ARGB32:
diff --git a/src/emu/render.h b/src/emu/render.h
index bf058258577..8598a565be2 100644
--- a/src/emu/render.h
+++ b/src/emu/render.h
@@ -575,7 +575,7 @@ private:
bitmap_argb32 * m_overlaybitmap; // overlay bitmap
render_texture * m_overlaytexture; // overlay texture
auto_pointer<palette_client> m_palclient; // client to the screen palette
- dynamic_array<rgb_t> m_bcglookup; // copy of screen palette with bcg adjustment
+ std::vector<rgb_t> m_bcglookup; // copy of screen palette with bcg adjustment
rgb_t m_bcglookup256[0x400]; // lookup table for brightness/contrast/gamma
};
diff --git a/src/emu/rendfont.c b/src/emu/rendfont.c
index b4070dc45ec..62a0581f9ab 100644
--- a/src/emu/rendfont.c
+++ b/src/emu/rendfont.c
@@ -53,9 +53,9 @@ inline render_font::glyph &render_font::get_char(unicode_char chnum)
static glyph dummy_glyph;
// grab the table; if none, return the dummy character
- if (m_glyphs[chnum / 256].count() == 0 && m_format == FF_OSD)
- m_glyphs[chnum / 256].resize(256);
- if (m_glyphs[chnum / 256].count() == 0)
+ if (!m_glyphs[chnum / 256] && m_format == FF_OSD)
+ m_glyphs[chnum / 256] = new glyph[256];
+ if (!m_glyphs[chnum / 256])
return dummy_glyph;
// if the character isn't generated yet, do it now
@@ -86,6 +86,8 @@ render_font::render_font(render_manager &manager, const char *filename)
m_rawsize(0),
m_osdfont(NULL)
{
+ memset(m_glyphs, 0, sizeof(m_glyphs));
+
// if this is an OSD font, we're done
if (filename != NULL)
{
@@ -127,10 +129,14 @@ render_font::~render_font()
{
// free all the subtables
for (int tablenum = 0; tablenum < 256; tablenum++)
- for (int charnum = 0; charnum < m_glyphs[tablenum].count(); charnum++)
+ if (m_glyphs[tablenum])
{
- glyph &gl = m_glyphs[tablenum][charnum];
- m_manager.texture_free(gl.texture);
+ for (unsigned int charnum = 0; charnum < 256; charnum++)
+ {
+ glyph &gl = m_glyphs[tablenum][charnum];
+ m_manager.texture_free(gl.texture);
+ }
+ delete[] m_glyphs[tablenum];
}
// release the OSD font
@@ -378,7 +384,7 @@ bool render_font::load_cached_bdf(const char *filename)
m_rawdata.resize(m_rawsize + 1);
// read the first chunk
- UINT32 bytes = file.read(m_rawdata, MIN(CACHED_BDF_HASH_SIZE, m_rawsize));
+ UINT32 bytes = file.read(&m_rawdata[0], MIN(CACHED_BDF_HASH_SIZE, m_rawsize));
if (bytes != MIN(CACHED_BDF_HASH_SIZE, m_rawsize))
return false;
@@ -411,10 +417,10 @@ bool render_font::load_cached_bdf(const char *filename)
// read in the rest of the font
if (bytes < m_rawsize)
{
- UINT32 read = file.read(m_rawdata + bytes, m_rawsize - bytes);
+ UINT32 read = file.read(&m_rawdata[bytes], m_rawsize - bytes);
if (read != m_rawsize - bytes)
{
- m_rawdata.reset();
+ m_rawdata.clear();
return false;
}
}
@@ -445,7 +451,7 @@ bool render_font::load_bdf()
// first find the FONTBOUNDINGBOX tag
const char *ptr;
- for (ptr = m_rawdata; ptr != NULL; ptr = next_line(ptr))
+ for (ptr = &m_rawdata[0]; ptr != NULL; ptr = next_line(ptr))
{
// we only care about a tiny few fields
if (strncmp(ptr, "FONTBOUNDINGBOX ", 16) == 0)
@@ -514,8 +520,8 @@ bool render_font::load_bdf()
if (charnum >= 0 && charnum < 65536 && rawdata != NULL && bmwidth >= 0 && bmheight >= 0)
{
// if we don't have a subtable yet, make one
- if (m_glyphs[charnum / 256].count() == 0)
- m_glyphs[charnum / 256].resize(256);
+ if (!m_glyphs[charnum / 256])
+ m_glyphs[charnum / 256] = new glyph[256];
// fill in the entry
glyph &gl = m_glyphs[charnum / 256][charnum % 256];
@@ -534,7 +540,7 @@ bool render_font::load_bdf()
}
// make sure all the numbers are the same width
- if (m_glyphs[0].count() > '9')
+ if (m_glyphs[0])
{
int maxwidth = 0;
for (int ch = '0'; ch <= '9'; ch++)
@@ -577,10 +583,10 @@ bool render_font::load_cached(emu_file &file, UINT32 hash)
// now read the rest of the data
m_rawdata.resize(filesize - CACHED_HEADER_SIZE);
- bytes_read = file.read(m_rawdata, filesize - CACHED_HEADER_SIZE);
+ bytes_read = file.read(&m_rawdata[0], filesize - CACHED_HEADER_SIZE);
if (bytes_read != filesize - CACHED_HEADER_SIZE)
{
- m_rawdata.reset();
+ m_rawdata.clear();
return false;
}
@@ -592,8 +598,8 @@ bool render_font::load_cached(emu_file &file, UINT32 hash)
int chnum = (info[0] << 8) | info[1];
// if we don't have a subtable yet, make one
- if (m_glyphs[chnum / 256].count() == 0)
- m_glyphs[chnum / 256].resize(256);
+ if (!m_glyphs[chnum / 256])
+ m_glyphs[chnum / 256] = new glyph[256];
// fill in the entry
glyph &gl = m_glyphs[chnum / 256][chnum % 256];
@@ -602,13 +608,13 @@ bool render_font::load_cached(emu_file &file, UINT32 hash)
gl.yoffs = (INT16)((info[6] << 8) | info[7]);
gl.bmwidth = (info[8] << 8) | info[9];
gl.bmheight = (info[10] << 8) | info[11];
- gl.rawdata = (char *)m_rawdata + offset;
+ gl.rawdata = &m_rawdata[offset];
// advance the offset past the character
offset += (gl.bmwidth * gl.bmheight + 7) / 8;
if (offset > filesize - CACHED_HEADER_SIZE)
{
- m_rawdata.reset();
+ m_rawdata.clear();
return false;
}
}
@@ -637,7 +643,7 @@ bool render_font::save_cached(const char *filename, UINT32 hash)
int numchars = 0;
for (int chnum = 0; chnum < 65536; chnum++)
{
- if (m_glyphs[chnum / 256].count() > 0)
+ if (m_glyphs[chnum / 256])
{
glyph &gl = m_glyphs[chnum / 256][chnum % 256];
if (gl.width > 0)
@@ -654,7 +660,7 @@ bool render_font::save_cached(const char *filename, UINT32 hash)
dynamic_buffer tempbuffer(65536);
// write the header
- UINT8 *dest = tempbuffer;
+ UINT8 *dest = &tempbuffer[0];
*dest++ = 'f';
*dest++ = 'o';
*dest++ = 'n';
@@ -671,13 +677,13 @@ bool render_font::save_cached(const char *filename, UINT32 hash)
*dest++ = numchars >> 16;
*dest++ = numchars >> 8;
*dest++ = numchars & 0xff;
- assert(dest - tempbuffer == CACHED_HEADER_SIZE);
- UINT32 bytes_written = file.write(tempbuffer, dest - tempbuffer);
- if (bytes_written != dest - tempbuffer)
+ assert(dest == &tempbuffer[CACHED_HEADER_SIZE]);
+ UINT32 bytes_written = file.write(&tempbuffer[0], CACHED_HEADER_SIZE);
+ if (bytes_written != dest - &tempbuffer[0])
throw emu_fatalerror("Error writing cached file");
// write the empty table to the beginning of the file
- bytes_written = file.write(chartable, numchars * CACHED_CHAR_SIZE);
+ bytes_written = file.write(&chartable[0], numchars * CACHED_CHAR_SIZE);
if (bytes_written != numchars * CACHED_CHAR_SIZE)
throw emu_fatalerror("Error writing cached file");
@@ -692,7 +698,7 @@ bool render_font::save_cached(const char *filename, UINT32 hash)
if (gl.bitmap.valid())
{
// write the data to the tempbuffer
- dest = tempbuffer;
+ dest = &tempbuffer[0];
UINT8 accum = 0;
UINT8 accbit = 7;
@@ -719,8 +725,8 @@ bool render_font::save_cached(const char *filename, UINT32 hash)
*dest++ = accum;
// write the data
- bytes_written = file.write(tempbuffer, dest - tempbuffer);
- if (bytes_written != dest - tempbuffer)
+ bytes_written = file.write(&tempbuffer[0], dest - &tempbuffer[0]);
+ if (bytes_written != dest - &tempbuffer[0])
throw emu_fatalerror("Error writing cached file");
// free the bitmap and texture
@@ -748,7 +754,7 @@ bool render_font::save_cached(const char *filename, UINT32 hash)
// seek back to the beginning and rewrite the table
file.seek(CACHED_HEADER_SIZE, SEEK_SET);
- bytes_written = file.write(chartable, numchars * CACHED_CHAR_SIZE);
+ bytes_written = file.write(&chartable[0], numchars * CACHED_CHAR_SIZE);
if (bytes_written != numchars * CACHED_CHAR_SIZE)
throw emu_fatalerror("Error writing cached file");
return true;
diff --git a/src/emu/rendfont.h b/src/emu/rendfont.h
index 4db45ca0a90..13d06be7dd9 100644
--- a/src/emu/rendfont.h
+++ b/src/emu/rendfont.h
@@ -90,10 +90,10 @@ private:
int m_height; // height of the font, from ascent to descent
int m_yoffs; // y offset from baseline to descent
float m_scale; // 1 / height precomputed
- dynamic_array<glyph> m_glyphs[256]; // array of glyph subtables
- dynamic_array<char> m_rawdata; // pointer to the raw data for the font
+ glyph *m_glyphs[256]; // array of glyph subtables
+ std::vector<char> m_rawdata; // pointer to the raw data for the font
UINT64 m_rawsize; // size of the raw font data
- osd_font *m_osdfont; // handle to the OSD font
+ osd_font *m_osdfont; // handle to the OSD font
// constants
static const int CACHED_CHAR_SIZE = 12;
diff --git a/src/emu/rendlay.h b/src/emu/rendlay.h
index 91cd7a00dc0..5d59be7e08e 100644
--- a/src/emu/rendlay.h
+++ b/src/emu/rendlay.h
@@ -176,7 +176,7 @@ private:
simple_list<component> m_complist; // list of components
int m_defstate; // default state of this element
int m_maxstate; // maximum state value for all components
- dynamic_array<texture> m_elemtex; // array of element textures used for managing the scaled bitmaps
+ std::vector<texture> m_elemtex; // array of element textures used for managing the scaled bitmaps
};
diff --git a/src/emu/romload.c b/src/emu/romload.c
index fa99559ca9a..5dd7c641ab9 100644
--- a/src/emu/romload.c
+++ b/src/emu/romload.c
@@ -800,7 +800,7 @@ static int read_rom_data(romload_private *romdata, const rom_entry *parent_regio
{
int evengroupcount = (tempbufsize / groupsize) * groupsize;
int bytesleft = (numbytes > evengroupcount) ? evengroupcount : numbytes;
- UINT8 *bufptr = tempbuf;
+ UINT8 *bufptr = &tempbuf[0];
/* read as much as we can */
LOG((" Reading %X bytes into buffer\n", bytesleft));
diff --git a/src/emu/save.h b/src/emu/save.h
index 4b026ed9ad2..8b6e0d4f167 100644
--- a/src/emu/save.h
+++ b/src/emu/save.h
@@ -48,10 +48,10 @@ typedef delegate<void ()> save_prepost_delegate;
#define ALLOW_SAVE_TYPE(TYPE) \
template<> struct save_manager::type_checker<TYPE> { static const bool is_atom = true; static const bool is_pointer = false; }
-// use this as above, but also to declare that dynamic_array<TYPE> is safe as well
+// use this as above, but also to declare that std::vector<TYPE> is safe as well
#define ALLOW_SAVE_TYPE_AND_ARRAY(TYPE) \
ALLOW_SAVE_TYPE(TYPE); \
- template<> inline void save_manager::save_item(device_t *device, const char *module, const char *tag, int index, dynamic_array<TYPE> &value, const char *name) { save_memory(device, module, tag, index, name, &value[0], sizeof(TYPE), value.count()); }
+ template<> inline void save_manager::save_item(device_t *device, const char *module, const char *tag, int index, std::vector<TYPE> &value, const char *name) { save_memory(device, module, tag, index, name, &value[0], sizeof(TYPE), value.size()); }
// register items with explicit tags
@@ -209,7 +209,7 @@ private:
// template specializations to enumerate the fundamental atomic types you are allowed to save
ALLOW_SAVE_TYPE_AND_ARRAY(char);
-ALLOW_SAVE_TYPE_AND_ARRAY(bool);
+ALLOW_SAVE_TYPE (bool); // std::vector<bool> may be packed internally
ALLOW_SAVE_TYPE_AND_ARRAY(INT8);
ALLOW_SAVE_TYPE_AND_ARRAY(UINT8);
ALLOW_SAVE_TYPE_AND_ARRAY(INT16);
diff --git a/src/emu/softlist.c b/src/emu/softlist.c
index d2ac76aceb9..1528304339d 100644
--- a/src/emu/softlist.c
+++ b/src/emu/softlist.c
@@ -328,7 +328,7 @@ void software_list_device::find_approx_matches(const char *name, int matches, so
return;
// initialize everyone's states
- dynamic_array<int> penalty(matches);
+ std::vector<int> penalty(matches);
for (int matchnum = 0; matchnum < matches; matchnum++)
{
penalty[matchnum] = 9999;
@@ -781,17 +781,19 @@ void softlist_parser::add_rom_entry(const char *name, const char *hashdata, UINT
// make sure we don't add duplicate regions
if (name != NULL && (flags & ROMENTRY_TYPEMASK) == ROMENTRYTYPE_REGION)
- for (int romentry = 0; romentry < m_current_part->m_romdata.count(); romentry++)
+ for (unsigned int romentry = 0; romentry < m_current_part->m_romdata.size(); romentry++)
if (m_current_part->m_romdata[romentry]._name != NULL && strcmp(m_current_part->m_romdata[romentry]._name, name) == 0)
parse_error("Duplicated dataarea %s in software %s", name, infoname());
// create the new entry and append it
- rom_entry &entry = m_current_part->m_romdata.append();
+ rom_entry entry;
entry._name = m_list.add_string(name);
entry._hashdata = m_list.add_string(hashdata);
entry._offset = offset;
entry._length = length;
entry._flags = flags;
+
+ m_current_part->m_romdata.push_back(entry);
}
diff --git a/src/emu/softlist.h b/src/emu/softlist.h
index ee800b4f4c8..7e6abc19246 100644
--- a/src/emu/softlist.h
+++ b/src/emu/softlist.h
@@ -111,7 +111,7 @@ public:
const char *name() const { return m_name; }
const char *interface() const { return m_interface; }
feature_list_item *featurelist() const { return m_featurelist.first(); }
- rom_entry *romdata(int index = 0) { return (index < m_romdata.count()) ? &m_romdata[index] : NULL; }
+ rom_entry *romdata(unsigned int index = 0) { return (index < m_romdata.size()) ? &m_romdata[index] : NULL; }
// helpers
bool is_compatible(const software_list_device &swlist) const;
@@ -125,7 +125,7 @@ private:
const char * m_name;
const char * m_interface;
simple_list<feature_list_item> m_featurelist;
- dynamic_array<rom_entry> m_romdata;
+ std::vector<rom_entry> m_romdata;
};
diff --git a/src/emu/sound.c b/src/emu/sound.c
index 895224d2dd6..6c8f4b74da2 100644
--- a/src/emu/sound.c
+++ b/src/emu/sound.c
@@ -81,12 +81,12 @@ sound_stream::sound_stream(device_t &device, int inputs, int outputs, int sample
m_device.machine().save().register_postload(save_prepost_delegate(FUNC(sound_stream::postload), this));
// save the gain of each input and output
- for (int inputnum = 0; inputnum < m_input.count(); inputnum++)
+ for (unsigned int inputnum = 0; inputnum < m_input.size(); inputnum++)
{
m_device.machine().save().save_item(&m_device, "stream", state_tag.c_str(), inputnum, NAME(m_input[inputnum].m_gain));
m_device.machine().save().save_item(&m_device, "stream", state_tag.c_str(), inputnum, NAME(m_input[inputnum].m_user_gain));
}
- for (int outputnum = 0; outputnum < m_output.count(); outputnum++)
+ for (unsigned int outputnum = 0; outputnum < m_output.size(); outputnum++)
{
m_output[outputnum].m_stream = this;
m_device.machine().save().save_item(&m_device, "stream", state_tag.c_str(), outputnum, NAME(m_output[outputnum].m_gain));
@@ -129,7 +129,7 @@ attotime sound_stream::sample_time() const
float sound_stream::user_gain(int inputnum) const
{
- assert(inputnum >= 0 && inputnum < m_input.count());
+ assert(inputnum >= 0 && inputnum < m_input.size());
return float(m_input[inputnum].m_user_gain) / 256.0f;
}
@@ -141,7 +141,7 @@ float sound_stream::user_gain(int inputnum) const
float sound_stream::input_gain(int inputnum) const
{
- assert(inputnum >= 0 && inputnum < m_input.count());
+ assert(inputnum >= 0 && inputnum < m_input.size());
return float(m_input[inputnum].m_gain) / 256.0f;
}
@@ -153,7 +153,7 @@ float sound_stream::input_gain(int inputnum) const
float sound_stream::output_gain(int outputnum) const
{
- assert(outputnum >= 0 && outputnum < m_output.count());
+ assert(outputnum >= 0 && outputnum < m_output.size());
return float(m_output[outputnum].m_gain) / 256.0f;
}
@@ -166,7 +166,7 @@ float sound_stream::output_gain(int outputnum) const
const char *sound_stream::input_name(int inputnum, astring &str) const
{
// start with our device name and tag
- assert(inputnum >= 0 && inputnum < m_input.count());
+ assert(inputnum >= 0 && inputnum < m_input.size());
str.printf("%s '%s': ", m_device.name(), m_device.tag());
// if we have a source, indicate where the sound comes from by device name and tag
@@ -202,7 +202,7 @@ const char *sound_stream::input_name(int inputnum, astring &str) const
device_t *sound_stream::input_source_device(int inputnum) const
{
- assert(inputnum >= 0 && inputnum < m_input.count());
+ assert(inputnum >= 0 && inputnum < m_input.size());
return (m_input[inputnum].m_source != NULL) ? &m_input[inputnum].m_source->m_stream->device() : NULL;
}
@@ -214,7 +214,7 @@ device_t *sound_stream::input_source_device(int inputnum) const
int sound_stream::input_source_outputnum(int inputnum) const
{
- assert(inputnum >= 0 && inputnum < m_input.count());
+ assert(inputnum >= 0 && inputnum < m_input.size());
return (m_input[inputnum].m_source != NULL) ? (m_input[inputnum].m_source - &m_input[inputnum].m_source->m_stream->m_output[0]) : -1;
}
@@ -228,12 +228,12 @@ void sound_stream::set_input(int index, sound_stream *input_stream, int output_i
VPRINTF(("stream_set_input(%p, '%s', %d, %p, %d, %f)\n", this, m_device.tag(), index, input_stream, output_index, gain));
// make sure it's a valid input
- if (index >= m_input.count())
- fatalerror("Fatal error: stream_set_input attempted to configure non-existant input %d (%d max)\n", index, m_input.count());
+ if (index >= m_input.size())
+ fatalerror("Fatal error: stream_set_input attempted to configure non-existant input %d (%d max)\n", index, int(m_input.size()));
// make sure it's a valid output
- if (input_stream != NULL && output_index >= input_stream->m_output.count())
- fatalerror("Fatal error: stream_set_input attempted to use a non-existant output %d (%d max)\n", output_index, m_output.count());
+ if (input_stream != NULL && output_index >= input_stream->m_output.size())
+ fatalerror("Fatal error: stream_set_input attempted to use a non-existant output %d (%d max)\n", output_index, int(m_output.size()));
// if this input is already wired, update the dependent info
stream_input &input = m_input[index];
@@ -339,7 +339,7 @@ void sound_stream::set_sample_rate(int new_rate)
void sound_stream::set_user_gain(int inputnum, float gain)
{
update();
- assert(inputnum >= 0 && inputnum < m_input.count());
+ assert(inputnum >= 0 && inputnum < m_input.size());
m_input[inputnum].m_user_gain = int(0x100 * gain);
}
@@ -352,7 +352,7 @@ void sound_stream::set_user_gain(int inputnum, float gain)
void sound_stream::set_input_gain(int inputnum, float gain)
{
update();
- assert(inputnum >= 0 && inputnum < m_input.count());
+ assert(inputnum >= 0 && inputnum < m_input.size());
m_input[inputnum].m_gain = int(0x100 * gain);
}
@@ -365,7 +365,7 @@ void sound_stream::set_input_gain(int inputnum, float gain)
void sound_stream::set_output_gain(int outputnum, float gain)
{
update();
- assert(outputnum >= 0 && outputnum < m_output.count());
+ assert(outputnum >= 0 && outputnum < m_output.size());
m_output[outputnum].m_gain = int(0x100 * gain);
}
@@ -401,7 +401,7 @@ void sound_stream::update_with_accounting(bool second_tick)
{
// if we have samples to move, do so for each output
if (output_bufindex > 0)
- for (int outputnum = 0; outputnum < m_output.count(); outputnum++)
+ for (unsigned int outputnum = 0; outputnum < m_output.size(); outputnum++)
{
stream_output &output = m_output[outputnum];
memmove(&output.m_buffer[0], &output.m_buffer[samples_to_lose], sizeof(output.m_buffer[0]) * (output_bufindex - samples_to_lose));
@@ -439,7 +439,7 @@ void sound_stream::apply_sample_rate_changes()
m_output_base_sampindex = m_output_sampindex - m_max_samples_per_update;
// clear out the buffer
- for (int outputnum = 0; outputnum < m_output.count(); outputnum++)
+ for (unsigned int outputnum = 0; outputnum < m_output.size(); outputnum++)
memset(&m_output[outputnum].m_buffer[0], 0, m_max_samples_per_update * sizeof(m_output[outputnum].m_buffer[0]));
}
@@ -456,7 +456,7 @@ void sound_stream::recompute_sample_rate_data()
{
m_sample_rate = 0;
// When synchronous, pick the sample rate for the inputs, if any
- for (int inputnum = 0; inputnum < m_input.count(); inputnum++)
+ for (unsigned int inputnum = 0; inputnum < m_input.size(); inputnum++)
{
stream_input &input = m_input[inputnum];
if (input.m_source != NULL)
@@ -482,7 +482,7 @@ void sound_stream::recompute_sample_rate_data()
allocate_output_buffers();
// iterate over each input
- for (int inputnum = 0; inputnum < m_input.count(); inputnum++)
+ for (unsigned int inputnum = 0; inputnum < m_input.size(); inputnum++)
{
// if we have a source, see if its sample rate changed
stream_input &input = m_input[inputnum];
@@ -536,8 +536,11 @@ void sound_stream::allocate_resample_buffers()
m_resample_bufalloc = bufsize;
// iterate over outputs and realloc their buffers
- for (int inputnum = 0; inputnum < m_input.count(); inputnum++)
- m_input[inputnum].m_resample.resize_keep_and_clear_new(m_resample_bufalloc);
+ for (unsigned int inputnum = 0; inputnum < m_input.size(); inputnum++) {
+ unsigned int old_size = m_input[inputnum].m_resample.size();
+ m_input[inputnum].m_resample.resize(m_resample_bufalloc);
+ memset(&m_input[inputnum].m_resample[old_size], 0, (m_resample_bufalloc - old_size)*sizeof(m_input[inputnum].m_resample[0]));
+ }
}
}
@@ -557,8 +560,11 @@ void sound_stream::allocate_output_buffers()
m_output_bufalloc = bufsize;
// iterate over outputs and realloc their buffers
- for (int outputnum = 0; outputnum < m_output.count(); outputnum++)
- m_output[outputnum].m_buffer.resize_keep_and_clear_new(m_output_bufalloc);
+ for (unsigned int outputnum = 0; outputnum < m_output.size(); outputnum++) {
+ unsigned int old_size = m_output[outputnum].m_buffer.size();
+ m_output[outputnum].m_buffer.resize(m_output_bufalloc);
+ memset(&m_output[outputnum].m_buffer[old_size], 0, (m_output_bufalloc - old_size)*sizeof(m_output[outputnum].m_buffer[0]));
+ }
}
}
@@ -573,8 +579,8 @@ void sound_stream::postload()
recompute_sample_rate_data();
// make sure our output buffers are fully cleared
- for (int outputnum = 0; outputnum < m_output.count(); outputnum++)
- memset(m_output[outputnum].m_buffer, 0, m_output_bufalloc * sizeof(m_output[outputnum].m_buffer[0]));
+ for (unsigned int outputnum = 0; outputnum < m_output.size(); outputnum++)
+ memset(&m_output[outputnum].m_buffer[0], 0, m_output_bufalloc * sizeof(m_output[outputnum].m_buffer[0]));
// recompute the sample indexes to make sense
m_output_sampindex = m_device.machine().sound().last_update().attoseconds / m_attoseconds_per_sample;
@@ -599,7 +605,7 @@ void sound_stream::generate_samples(int samples)
VPRINTF(("generate_samples(%p, %d)\n", this, samples));
// ensure all inputs are up to date and generate resampled data
- for (int inputnum = 0; inputnum < m_input.count(); inputnum++)
+ for (unsigned int inputnum = 0; inputnum < m_input.size(); inputnum++)
{
// update the stream to the current time
stream_input &input = m_input[inputnum];
@@ -611,7 +617,7 @@ void sound_stream::generate_samples(int samples)
}
// loop over all outputs and compute the output pointer
- for (int outputnum = 0; outputnum < m_output.count(); outputnum++)
+ for (unsigned int outputnum = 0; outputnum < m_output.size(); outputnum++)
{
stream_output &output = m_output[outputnum];
m_output_array[outputnum] = &output.m_buffer[m_output_sampindex - m_output_base_sampindex];
@@ -619,7 +625,7 @@ void sound_stream::generate_samples(int samples)
// run the callback
VPRINTF((" callback(%p, %d)\n", this, samples));
- m_callback(*this, m_input_array, m_output_array, samples);
+ m_callback(*this, &m_input_array[0], &m_output_array[0], samples);
VPRINTF((" callback done\n"));
}
@@ -632,11 +638,11 @@ void sound_stream::generate_samples(int samples)
stream_sample_t *sound_stream::generate_resampled_data(stream_input &input, UINT32 numsamples)
{
// if we don't have an output to pull data from, generate silence
- stream_sample_t *dest = input.m_resample;
+ stream_sample_t *dest = &input.m_resample[0];
if (input.m_source == NULL)
{
memset(dest, 0, numsamples * sizeof(*dest));
- return input.m_resample;
+ return &input.m_resample[0];
}
// grab data from the output
@@ -740,7 +746,7 @@ stream_sample_t *sound_stream::generate_resampled_data(stream_input &input, UINT
}
}
- return input.m_resample;
+ return &input.m_resample[0];
}
@@ -1022,12 +1028,12 @@ void sound_manager::update(void *ptr, int param)
int samples_this_update = 0;
speaker_device_iterator iter(machine().root_device());
for (speaker_device *speaker = iter.first(); speaker != NULL; speaker = iter.next())
- speaker->mix(m_leftmix, m_rightmix, samples_this_update, (m_muted & MUTE_REASON_SYSTEM));
+ speaker->mix(&m_leftmix[0], &m_rightmix[0], samples_this_update, (m_muted & MUTE_REASON_SYSTEM));
// now downmix the final result
UINT32 finalmix_step = machine().video().speed_factor();
UINT32 finalmix_offset = 0;
- INT16 *finalmix = m_finalmix;
+ INT16 *finalmix = &m_finalmix[0];
int sample;
for (sample = m_finalmix_leftover; sample < samples_this_update * 1000; sample += finalmix_step)
{
diff --git a/src/emu/sound.h b/src/emu/sound.h
index 74d558b5d81..f025f70787d 100644
--- a/src/emu/sound.h
+++ b/src/emu/sound.h
@@ -67,7 +67,7 @@ class sound_stream
// internal state
sound_stream * m_stream; // owning stream
- dynamic_array<stream_sample_t> m_buffer; // output buffer
+ std::vector<stream_sample_t> m_buffer; // output buffer
int m_dependents; // number of dependents
INT16 m_gain; // gain to apply to the output
};
@@ -82,7 +82,7 @@ class sound_stream
// internal state
stream_output * m_source; // pointer to the sound_output for this source
- dynamic_array<stream_sample_t> m_resample; // buffer for resampling to the stream's sample rate
+ std::vector<stream_sample_t> m_resample; // buffer for resampling to the stream's sample rate
attoseconds_t m_latency_attoseconds; // latency between this stream and the input stream
INT16 m_gain; // gain to apply to this input
INT16 m_user_gain; // user-controlled gain to apply to this input
@@ -104,8 +104,8 @@ public:
int sample_rate() const { return (m_new_sample_rate != 0) ? m_new_sample_rate : m_sample_rate; }
attotime sample_time() const;
attotime sample_period() const { return attotime(0, m_attoseconds_per_sample); }
- int input_count() const { return m_input.count(); }
- int output_count() const { return m_output.count(); }
+ int input_count() const { return m_input.size(); }
+ int output_count() const { return m_output.size(); }
const char *input_name(int inputnum, astring &str) const;
device_t *input_source_device(int inputnum) const;
int input_source_outputnum(int inputnum) const;
@@ -153,15 +153,15 @@ private:
emu_timer * m_sync_timer; // update timer for synchronous streams
// input information
- dynamic_array<stream_input> m_input; // list of streams we directly depend upon
- dynamic_array<stream_sample_t *> m_input_array; // array of inputs for passing to the callback
+ std::vector<stream_input> m_input; // list of streams we directly depend upon
+ std::vector<stream_sample_t *> m_input_array; // array of inputs for passing to the callback
// resample buffer information
UINT32 m_resample_bufalloc; // allocated size of each resample buffer
// output information
- dynamic_array<stream_output> m_output; // list of streams which directly depend upon us
- dynamic_array<stream_sample_t *> m_output_array; // array of outputs for passing to the callback
+ std::vector<stream_output> m_output; // list of streams which directly depend upon us
+ std::vector<stream_sample_t *> m_output_array; // array of outputs for passing to the callback
// output buffer information
UINT32 m_output_bufalloc; // allocated size of each output buffer
@@ -232,9 +232,9 @@ private:
emu_timer * m_update_timer; // timer to drive periodic updates
UINT32 m_finalmix_leftover;
- dynamic_array<INT16> m_finalmix;
- dynamic_array<INT32> m_leftmix;
- dynamic_array<INT32> m_rightmix;
+ std::vector<INT16> m_finalmix;
+ std::vector<INT32> m_leftmix;
+ std::vector<INT32> m_rightmix;
UINT8 m_muted;
int m_attenuation;
diff --git a/src/emu/sound/ay8910.c b/src/emu/sound/ay8910.c
index 7ebd22d1080..7e30de56eb6 100644
--- a/src/emu/sound/ay8910.c
+++ b/src/emu/sound/ay8910.c
@@ -433,7 +433,7 @@ INLINE void build_3D_table(double rl, const ay8910_device::ay_ym_param *par, con
{
double min = 10.0, max = 0.0;
- dynamic_array<double> temp(8*32*32*32, 0);
+ std::vector<double> temp(8*32*32*32, 0);
for (int e=0; e < 8; e++)
{
diff --git a/src/emu/sound/discrete.c b/src/emu/sound/discrete.c
index 53401b401fd..e0acc5ef484 100644
--- a/src/emu/sound/discrete.c
+++ b/src/emu/sound/discrete.c
@@ -117,7 +117,7 @@ public:
node_step_list_t step_list;
/* list of source nodes */
- dynamic_array_t<input_buffer> source_list; /* discrete_source_node */
+ vector_t<input_buffer> source_list; /* discrete_source_node */
int task_group;
@@ -137,7 +137,7 @@ protected:
void check(discrete_task *dest_task);
void prepare_for_queue(int samples);
- dynamic_array_t<output_buffer> m_buffers;
+ vector_t<output_buffer> m_buffers;
discrete_device & m_device;
private:
@@ -525,7 +525,7 @@ void discrete_device::discrete_build_list(const discrete_block *intf, sound_bloc
}
else if (intf[node_count].type == DSO_DELETE)
{
- dynamic_array_t<int> deletethem;
+ vector_t<int> deletethem;
for (int i=0; i<block_list.count(); i++)
{
diff --git a/src/emu/sound/discrete.h b/src/emu/sound/discrete.h
index 9848cdf5f93..621ad77749c 100644
--- a/src/emu/sound/discrete.h
+++ b/src/emu/sound/discrete.h
@@ -3751,21 +3751,21 @@ enum
* add and delete may be slow - the focus is on access!
*/
- // TODO: replace with dynamic_array from utils
-template<class _ElementType> struct dynamic_array_t
+ // TODO: replace with vector from utils
+template<class _ElementType> struct vector_t
{
public:
- dynamic_array_t(int initial) {
+ vector_t(int initial) {
m_count = 0;
m_allocated = initial;
m_arr = global_alloc_array_clear(_ElementType, m_allocated);
}
- dynamic_array_t() {
+ vector_t() {
m_count = 0;
m_allocated = 16;
m_arr = global_alloc_array_clear(_ElementType, m_allocated);
}
- ~dynamic_array_t() {
+ ~vector_t() {
global_free_array(m_arr);
}
_ElementType& operator [] (unsigned int index) const // get array item
@@ -3773,7 +3773,7 @@ public:
return m_arr[index];
}
- dynamic_array_t(const dynamic_array_t &a) // copy constructor
+ vector_t(const vector_t &a) // copy constructor
{
m_allocated = a.count();
if (m_allocated < 16)
@@ -3783,7 +3783,7 @@ public:
for (int i=0; i < m_count; i++)
m_arr[i] = a[i];
}
- dynamic_array_t& operator = (const dynamic_array_t &a) // assignment operator
+ vector_t& operator = (const vector_t &a) // assignment operator
{
if (this == &a) return *this;
m_allocated = a.count();
@@ -4185,9 +4185,9 @@ class discrete_task;
class discrete_base_node;
class discrete_dss_input_stream_node;
class discrete_device;
-typedef dynamic_array_t<discrete_base_node *> node_list_t;
-typedef dynamic_array_t<discrete_dss_input_stream_node *> istream_node_list_t;
-typedef dynamic_array_t<discrete_task *> task_list_t;
+typedef vector_t<discrete_base_node *> node_list_t;
+typedef vector_t<discrete_dss_input_stream_node *> istream_node_list_t;
+typedef vector_t<discrete_task *> task_list_t;
/*************************************
@@ -4216,7 +4216,7 @@ struct discrete_block
const char * name; /* Node Name */
const char * mod_name; /* Module / class name */
};
-typedef dynamic_array_t<const discrete_block *> sound_block_list_t;
+typedef vector_t<const discrete_block *> sound_block_list_t;
/*************************************
*
@@ -4233,7 +4233,7 @@ public:
osd_ticks_t run_time;
discrete_base_node * self;
};
-typedef dynamic_array_t<discrete_step_interface *> node_step_list_t;
+typedef vector_t<discrete_step_interface *> node_step_list_t;
class discrete_input_interface
{
@@ -4271,7 +4271,7 @@ public:
//**************************************************************************
class discrete_sound_output_interface;
-typedef dynamic_array_t<discrete_sound_output_interface *> node_output_list_t;
+typedef vector_t<discrete_sound_output_interface *> node_output_list_t;
// ======================> discrete_device
diff --git a/src/emu/sound/samples.c b/src/emu/sound/samples.c
index 568d68e536c..5a47e5d27da 100644
--- a/src/emu/sound/samples.c
+++ b/src/emu/sound/samples.c
@@ -73,10 +73,10 @@ samples_device::samples_device(const machine_config &mconfig, device_type type,
void samples_device::start(UINT8 channel, UINT32 samplenum, bool loop)
{
// if samples are disabled, just return quietly
- if (m_sample.count() == 0)
+ if (m_sample.empty())
return;
- assert(samplenum < m_sample.count());
+ assert(samplenum < m_sample.size());
assert(channel < m_channels);
// force an update before we start
@@ -85,8 +85,8 @@ void samples_device::start(UINT8 channel, UINT32 samplenum, bool loop)
// update the parameters
sample_t &sample = m_sample[samplenum];
- chan.source = sample.data;
- chan.source_length = sample.data.count();
+ chan.source = &sample.data[0];
+ chan.source_length = sample.data.size();
chan.source_num = (chan.source_length > 0) ? samplenum : -1;
chan.pos = 0;
chan.frac = 0;
@@ -292,12 +292,12 @@ void samples_device::device_post_load()
{
// attach any samples that were loaded and playing
channel_t &chan = m_channel[channel];
- if (chan.source_num >= 0 && chan.source_num < m_sample.count())
+ if (chan.source_num >= 0 && chan.source_num < m_sample.size())
{
sample_t &sample = m_sample[chan.source_num];
- chan.source = sample.data;
- chan.source_length = sample.data.count();
- if (sample.data == NULL)
+ chan.source = &sample.data[0];
+ chan.source_length = sample.data.size();
+ if (sample.data.empty())
chan.source_num = -1;
}
@@ -540,7 +540,7 @@ bool samples_device::read_wav_sample(emu_file &file, sample_t &sample)
if (bits == 8)
{
sample.data.resize(length);
- file.read(sample.data, length);
+ file.read(&sample.data[0], length);
// convert 8-bit data to signed samples
UINT8 *tempptr = reinterpret_cast<UINT8 *>(&sample.data[0]);
@@ -551,7 +551,7 @@ bool samples_device::read_wav_sample(emu_file &file, sample_t &sample)
{
// 16-bit data is fine as-is
sample.data.resize(length / 2);
- file.read(sample.data, length);
+ file.read(&sample.data[0], length);
// swap high/low on big-endian systems
if (ENDIANNESS_NATIVE != ENDIANNESS_LITTLE)
@@ -583,7 +583,7 @@ bool samples_device::read_flac_sample(emu_file &file, sample_t &sample)
// resize the array and read
sample.data.resize(decoder.total_samples());
- if (!decoder.decode_interleaved(sample.data, sample.data.count()))
+ if (!decoder.decode_interleaved(&sample.data[0], sample.data.size()))
return false;
// finish up and clean up
diff --git a/src/emu/sound/samples.h b/src/emu/sound/samples.h
index cb436329a0e..45770e127ed 100644
--- a/src/emu/sound/samples.h
+++ b/src/emu/sound/samples.h
@@ -71,7 +71,7 @@ public:
sample_t &operator=(const sample_t &rhs) { assert(false); return *this; }
UINT32 frequency; // frequency of the sample
- dynamic_array<INT16> data; // 16-bit signed data
+ std::vector<INT16> data; // 16-bit signed data
};
static bool read_sample(emu_file &file, sample_t &sample);
@@ -114,8 +114,8 @@ private:
void load_samples();
// internal state
- dynamic_array<channel_t> m_channel;
- dynamic_array<sample_t> m_sample;
+ std::vector<channel_t> m_channel;
+ std::vector<sample_t> m_sample;
// internal constants
static const UINT8 FRAC_BITS = 24;
diff --git a/src/emu/sound/spu.c b/src/emu/sound/spu.c
index f6ee4e95a49..496c50265c6 100644
--- a/src/emu/sound/spu.c
+++ b/src/emu/sound/spu.c
@@ -494,7 +494,8 @@ public:
marker_tail(NULL)
{
buffer_size=sector_size*num_sectors;
- buffer.resize_and_clear(buffer_size);
+ buffer.resize(buffer_size);
+ memset(&buffer[0], 0, buffer_size);
}
~stream_buffer()
@@ -518,7 +519,7 @@ public:
}
marker_tail=xam;
- unsigned char *ret=buffer+head;
+ unsigned char *ret=&buffer[head];
head=(head+sector_size)%buffer_size;
in+=sector_size;
return ret;
diff --git a/src/emu/sound/wavwrite.c b/src/emu/sound/wavwrite.c
index 4e4a5677c51..34e3ef559c3 100644
--- a/src/emu/sound/wavwrite.c
+++ b/src/emu/sound/wavwrite.c
@@ -122,15 +122,13 @@ void wav_add_data_16(wav_file *wav, INT16 *data, int samples)
void wav_add_data_32(wav_file *wav, INT32 *data, int samples, int shift)
{
- dynamic_array<INT16> temp;
+ std::vector<INT16> temp;
int i;
- if (!wav) return;
+ if (!wav || !samples) return;
/* resize dynamic array */
temp.resize(samples);
- if (!temp)
- return;
/* clamp */
for (i = 0; i < samples; i++)
@@ -140,44 +138,40 @@ void wav_add_data_32(wav_file *wav, INT32 *data, int samples, int shift)
}
/* write and flush */
- fwrite(temp, 2, samples, wav->file);
+ fwrite(&temp[0], 2, samples, wav->file);
fflush(wav->file);
}
void wav_add_data_16lr(wav_file *wav, INT16 *left, INT16 *right, int samples)
{
- dynamic_array<INT16> temp;
+ std::vector<INT16> temp;
int i;
- if (!wav) return;
+ if (!wav || !samples) return;
/* resize dynamic array */
temp.resize(samples * 2);
- if (!temp)
- return;
/* interleave */
for (i = 0; i < samples * 2; i++)
temp[i] = (i & 1) ? right[i / 2] : left[i / 2];
/* write and flush */
- fwrite(temp, 4, samples, wav->file);
+ fwrite(&temp[0], 4, samples, wav->file);
fflush(wav->file);
}
void wav_add_data_32lr(wav_file *wav, INT32 *left, INT32 *right, int samples, int shift)
{
- dynamic_array<INT16> temp;
+ std::vector<INT16> temp;
int i;
- if (!wav) return;
+ if (!wav || !samples) return;
/* resize dynamic array */
temp.resize(samples);
- if (!temp)
- return;
/* interleave */
for (i = 0; i < samples * 2; i++)
@@ -188,6 +182,6 @@ void wav_add_data_32lr(wav_file *wav, INT32 *left, INT32 *right, int samples, in
}
/* write and flush */
- fwrite(temp, 4, samples, wav->file);
+ fwrite(&temp[0], 4, samples, wav->file);
fflush(wav->file);
}
diff --git a/src/emu/sprite.h b/src/emu/sprite.h
index f712e8f8302..b2bd9cb7f0c 100644
--- a/src/emu/sprite.h
+++ b/src/emu/sprite.h
@@ -194,7 +194,7 @@ private:
// memory pointers and buffers
_SpriteRAMType * m_spriteram; // pointer to spriteram pointer
INT32 m_spriteram_bytes; // size of sprite RAM in bytes
- dynamic_array<_SpriteRAMType> m_buffer; // buffered spriteram for those that use it
+ std::vector<_SpriteRAMType> m_buffer; // buffered spriteram for those that use it
// bitmaps
_BitmapType m_bitmap; // live bitmap
diff --git a/src/emu/tilemap.c b/src/emu/tilemap.c
index 4492dd23d95..4d1ec2cba5f 100644
--- a/src/emu/tilemap.c
+++ b/src/emu/tilemap.c
@@ -378,8 +378,10 @@ tilemap_t &tilemap_t::init(tilemap_manager &manager, device_gfx_interface &decod
// reset scroll information
m_scrollrows = 1;
m_scrollcols = 1;
- m_rowscroll.resize_and_clear(m_height);
- m_colscroll.resize_and_clear(m_width);
+ m_rowscroll.resize(m_height);
+ memset(&m_rowscroll[0], 0, m_height*sizeof(m_rowscroll[0]));
+ m_colscroll.resize(m_width);
+ memset(&m_colscroll[0], 0, m_width*sizeof(m_colscroll[0]));
m_dx = 0;
m_dx_flipped = 0;
m_dy = 0;
@@ -442,7 +444,7 @@ tilemap_t::~tilemap_t()
void tilemap_t::mark_tile_dirty(tilemap_memory_index memindex)
{
// only mark if within range
- if (memindex < m_memory_to_logical.count())
+ if (memindex < m_memory_to_logical.size())
{
// there may be no logical index for a given memory index
logical_index logindex = m_memory_to_logical[memindex];
@@ -660,10 +662,10 @@ void tilemap_t::mappings_create()
void tilemap_t::mappings_update()
{
// initialize all the mappings to invalid values
- memset(&m_memory_to_logical[0], 0xff, m_memory_to_logical.count() * sizeof(m_memory_to_logical[0]));
+ memset(&m_memory_to_logical[0], 0xff, m_memory_to_logical.size() * sizeof(m_memory_to_logical[0]));
// now iterate over all logical indexes and populate the memory index
- for (logical_index logindex = 0; logindex < m_logical_to_memory.count(); logindex++)
+ for (logical_index logindex = 0; logindex < m_logical_to_memory.size(); logindex++)
{
UINT32 logical_col = logindex % m_cols;
UINT32 logical_row = logindex / m_cols;
@@ -697,7 +699,7 @@ inline void tilemap_t::realize_all_dirty_tiles()
// flush the dirty status to all tiles
if (m_all_tiles_dirty || gfx_elements_changed())
{
- memset(&m_tileflags[0], TILE_FLAG_DIRTY, m_tileflags.count());
+ memset(&m_tileflags[0], TILE_FLAG_DIRTY, m_tileflags.size());
m_all_tiles_dirty = false;
m_gfx_used = 0;
}
diff --git a/src/emu/tilemap.h b/src/emu/tilemap.h
index a0051139e9c..55fa4d5769a 100644
--- a/src/emu/tilemap.h
+++ b/src/emu/tilemap.h
@@ -512,7 +512,7 @@ public:
int scrolly(int which = 0) const { return (which < m_scrollcols) ? m_colscroll[which] : 0; }
bitmap_ind16 &pixmap() { pixmap_update(); return m_pixmap; }
bitmap_ind8 &flagsmap() { pixmap_update(); return m_flagsmap; }
- UINT8 *tile_flags() { pixmap_update(); return m_tileflags; }
+ UINT8 *tile_flags() { pixmap_update(); return &m_tileflags[0]; }
tilemap_memory_index memory_index(UINT32 col, UINT32 row) { return m_mapper(col, row, m_cols, m_rows); }
// setters
@@ -639,9 +639,9 @@ private:
UINT32 m_height; // height of the full tilemap in pixels
// logical <-> memory mappings
- tilemap_mapper_delegate m_mapper; // callback to map a row/column to a memory index
- dynamic_array<logical_index> m_memory_to_logical; // map from memory index to logical index
- dynamic_array<tilemap_memory_index> m_logical_to_memory; // map from logical index to memory index
+ tilemap_mapper_delegate m_mapper; // callback to map a row/column to a memory index
+ std::vector<logical_index> m_memory_to_logical; // map from memory index to logical index
+ std::vector<tilemap_memory_index> m_logical_to_memory; // map from logical index to memory index
// callback to interpret video RAM for the tilemap
tilemap_get_info_delegate m_tile_get_info; // callback to get information about a tile
@@ -659,8 +659,8 @@ private:
// scroll information
UINT32 m_scrollrows; // number of independently scrolled rows
UINT32 m_scrollcols; // number of independently scrolled columns
- dynamic_array<INT32> m_rowscroll; // array of rowscroll values
- dynamic_array<INT32> m_colscroll; // array of colscroll values
+ std::vector<INT32> m_rowscroll; // array of rowscroll values
+ std::vector<INT32> m_colscroll; // array of colscroll values
INT32 m_dx; // global horizontal scroll offset
INT32 m_dx_flipped; // global horizontal scroll offset when flipped
INT32 m_dy; // global vertical scroll offset
@@ -671,7 +671,7 @@ private:
// transparency mapping
bitmap_ind8 m_flagsmap; // per-pixel flags
- dynamic_array<UINT8> m_tileflags; // per-tile flags
+ std::vector<UINT8> m_tileflags; // per-tile flags
UINT8 m_pen_to_flags[MAX_PEN_TO_FLAGS * TILEMAP_NUM_GROUPS]; // mapping of pens to flags
};
diff --git a/src/emu/ui/selgame.h b/src/emu/ui/selgame.h
index 940a195721b..bae669c3040 100644
--- a/src/emu/ui/selgame.h
+++ b/src/emu/ui/selgame.h
@@ -35,7 +35,7 @@ private:
UINT8 m_rerandomize;
char m_search[40];
int m_matchlist[VISIBLE_GAMES_IN_LIST];
- dynamic_array<const game_driver *> m_driverlist;
+ std::vector<const game_driver *> m_driverlist;
auto_pointer<driver_enumerator> m_drivlist;
// internal methods
diff --git a/src/emu/video/bufsprite.h b/src/emu/video/bufsprite.h
index a3f9fc41366..86fb699085a 100644
--- a/src/emu/video/bufsprite.h
+++ b/src/emu/video/bufsprite.h
@@ -59,7 +59,7 @@ public:
// getters
_Type *live() const { return m_spriteram; }
- _Type *buffer() { return m_buffered; }
+ _Type *buffer() { return &m_buffered[0]; }
UINT32 bytes() const { return m_spriteram.bytes(); }
// operations
@@ -67,8 +67,8 @@ public:
{
assert(m_spriteram != NULL);
if (m_spriteram != NULL)
- memcpy(m_buffered, m_spriteram + srcoffset, MIN(srclength, m_spriteram.bytes() / sizeof(_Type) - srcoffset) * sizeof(_Type));
- return m_buffered;
+ memcpy(&m_buffered[0], m_spriteram + srcoffset, MIN(srclength, m_spriteram.bytes() / sizeof(_Type) - srcoffset) * sizeof(_Type));
+ return &m_buffered[0];
}
// read/write handlers
@@ -92,7 +92,7 @@ protected:
private:
// internal state
required_shared_ptr<_Type> m_spriteram;
- dynamic_array<_Type> m_buffered;
+ std::vector<_Type> m_buffered;
};
diff --git a/src/emu/video/pc_vga.c b/src/emu/video/pc_vga.c
index 39bc25a1e6e..92e1e4fe130 100644
--- a/src/emu/video/pc_vga.c
+++ b/src/emu/video/pc_vga.c
@@ -256,7 +256,8 @@ void vga_device::device_start()
vga.svga_intf.crtc_regcount = 0x19;
vga.svga_intf.vram_size = 0x100000;
- vga.memory.resize_and_clear(vga.svga_intf.vram_size);
+ vga.memory.resize(vga.svga_intf.vram_size);
+ memset(&vga.memory[0], 0, vga.svga_intf.vram_size);
save_item(NAME(vga.memory));
save_pointer(vga.crtc.data,"CRTC Registers",0x100);
save_pointer(vga.sequencer.data,"Sequencer Registers",0x100);
@@ -288,7 +289,8 @@ void cirrus_gd5428_device::device_start()
vga.svga_intf.crtc_regcount = 0x2d;
vga.svga_intf.vram_size = 0x200000;
- vga.memory.resize_and_clear(vga.svga_intf.vram_size);
+ vga.memory.resize(vga.svga_intf.vram_size);
+ memset(&vga.memory[0], 0, vga.svga_intf.vram_size);
save_item(NAME(vga.memory));
save_pointer(vga.crtc.data,"CRTC Registers",0x100);
save_pointer(vga.sequencer.data,"Sequencer Registers",0x100);
diff --git a/src/emu/video/resnet.c b/src/emu/video/resnet.c
index 59e2b3b9420..e9b5a247070 100644
--- a/src/emu/video/resnet.c
+++ b/src/emu/video/resnet.c
@@ -256,8 +256,8 @@ double compute_resistor_net_outputs(
/* parse input parameters */
- dynamic_array<double> o((1<<MAX_RES_PER_NET) * MAX_NETS);
- dynamic_array<double> os((1<<MAX_RES_PER_NET) * MAX_NETS);
+ std::vector<double> o((1<<MAX_RES_PER_NET) * MAX_NETS);
+ std::vector<double> os((1<<MAX_RES_PER_NET) * MAX_NETS);
networks_no = 0;
for (n = 0; n < MAX_NETS; n++)
@@ -693,7 +693,7 @@ int compute_res_net(int inputs, int channel, const res_net_info &di)
return (int) (v * 255 / vcc + 0.4);
}
-void compute_res_net_all(dynamic_array<rgb_t> &rgb, const UINT8 *prom, const res_net_decode_info &rdi, const res_net_info &di)
+void compute_res_net_all(std::vector<rgb_t> &rgb, const UINT8 *prom, const res_net_decode_info &rdi, const res_net_info &di)
{
UINT8 r,g,b;
int i,j,k;
diff --git a/src/emu/video/resnet.h b/src/emu/video/resnet.h
index 3dae2bbb11f..233db9198ed 100644
--- a/src/emu/video/resnet.h
+++ b/src/emu/video/resnet.h
@@ -157,7 +157,7 @@ int compute_res_net(int inputs, int channel, const res_net_info &di);
/* compute all values */
-void compute_res_net_all(dynamic_array<rgb_t> &rgb, const UINT8 *prom, const res_net_decode_info &rdi, const res_net_info &di);
+void compute_res_net_all(std::vector<rgb_t> &rgb, const UINT8 *prom, const res_net_decode_info &rdi, const res_net_info &di);
/* legacy interface */
diff --git a/src/lib/formats/ap2_dsk.c b/src/lib/formats/ap2_dsk.c
index c62033eb2ff..b7ad6885ab4 100644
--- a/src/lib/formats/ap2_dsk.c
+++ b/src/lib/formats/ap2_dsk.c
@@ -607,9 +607,8 @@ bool a2_16sect_format::load(io_generic *io, UINT32 form_factor, floppy_image *im
int fpos = 0;
for(int track=0; track < 35; track++) {
- UINT32 track_data[51090*2];
+ std::vector<UINT32> track_data;
UINT8 sector_data[256*16];
- int offset = 0;
static const unsigned char pascal_block1[4] = { 0x08, 0xa5, 0x0f, 0x29 };
static const unsigned char pascal2_block1[4] = { 0xff, 0xa2, 0x00, 0x8e };
static const unsigned char dos33_block1[4] = { 0xa2, 0x02, 0x8e, 0x52 };
@@ -668,7 +667,7 @@ bool a2_16sect_format::load(io_generic *io, UINT32 form_factor, floppy_image *im
fpos += 256*16;
for(int i=0; i<51; i++)
- raw_w(track_data, offset, 10, 0x3fc);
+ raw_w(track_data, 10, 0x3fc);
for(int i=0; i<16; i++) {
int sector;
@@ -683,20 +682,20 @@ bool a2_16sect_format::load(io_generic *io, UINT32 form_factor, floppy_image *im
const UINT8 *sdata = sector_data + 256 * sector;
for(int j=0; j<20; j++)
- raw_w(track_data, offset, 10, 0x3fc);
- raw_w(track_data, offset, 8, 0xff);
- raw_w(track_data, offset, 24, 0xd5aa96);
- raw_w(track_data, offset, 16, gcr4_encode(0xfe));
- raw_w(track_data, offset, 16, gcr4_encode(track));
- raw_w(track_data, offset, 16, gcr4_encode(i));
- raw_w(track_data, offset, 16, gcr4_encode(0xfe ^ track ^ i));
- raw_w(track_data, offset, 24, 0xdeaaeb);
+ raw_w(track_data, 10, 0x3fc);
+ raw_w(track_data, 8, 0xff);
+ raw_w(track_data, 24, 0xd5aa96);
+ raw_w(track_data, 16, gcr4_encode(0xfe));
+ raw_w(track_data, 16, gcr4_encode(track));
+ raw_w(track_data, 16, gcr4_encode(i));
+ raw_w(track_data, 16, gcr4_encode(0xfe ^ track ^ i));
+ raw_w(track_data, 24, 0xdeaaeb);
for(int j=0; j<4; j++)
- raw_w(track_data, offset, 10, 0x3fc);
+ raw_w(track_data, 10, 0x3fc);
- raw_w(track_data, offset, 9, 0x01fe);
- raw_w(track_data, offset, 24, 0xd5aaad);
+ raw_w(track_data, 9, 0x01fe);
+ raw_w(track_data, 24, 0xd5aaad);
UINT8 pval = 0x00;
for(int i=0; i<342; i++) {
@@ -714,16 +713,16 @@ bool a2_16sect_format::load(io_generic *io, UINT32 form_factor, floppy_image *im
((sdata[i+0xac] & 0x01) << 5) |
((sdata[i+0xac] & 0x02) << 3);
}
- raw_w(track_data, offset, 8, translate6[nval ^ pval]);
+ raw_w(track_data, 8, translate6[nval ^ pval]);
pval = nval;
}
- raw_w(track_data, offset, 8, translate6[pval]);
- raw_w(track_data, offset, 24, 0xdeaaeb);
+ raw_w(track_data, 8, translate6[pval]);
+ raw_w(track_data, 24, 0xdeaaeb);
}
- raw_w(track_data, offset, 4, 0xff);
- assert(offset == 51090);
+ raw_w(track_data, 4, 0xff);
+ assert(track_data.size() == 51090);
- generate_track_from_levels(track, 0, track_data, 51090, 0, image);
+ generate_track_from_levels(track, 0, track_data, 0, image);
}
return true;
}
diff --git a/src/lib/formats/apridisk.c b/src/lib/formats/apridisk.c
index 0416add4405..e835d169210 100644
--- a/src/lib/formats/apridisk.c
+++ b/src/lib/formats/apridisk.c
@@ -182,10 +182,10 @@ FLOPPY_CONSTRUCT( apridisk_construct )
UINT16 length;
UINT8 value;
- floppy_image_read(floppy, buffer, pos, data_size);
+ floppy_image_read(floppy, &buffer[0], pos, data_size);
- length = pick_integer_le(buffer, 0, 2);
- value = pick_integer_le(buffer, 2, 1);
+ length = pick_integer_le(&buffer[0], 0, 2);
+ value = pick_integer_le(&buffer[0], 2, 1);
/* not sure if this is possible */
if (length != 512) {
diff --git a/src/lib/formats/cassimg.c b/src/lib/formats/cassimg.c
index 7de195315ef..fefcabe1cb6 100644
--- a/src/lib/formats/cassimg.c
+++ b/src/lib/formats/cassimg.c
@@ -276,7 +276,7 @@ void cassette_close(cassette_image *cassette)
{
if ((cassette->flags & CASSETTE_FLAG_DIRTY) && (cassette->flags & CASSETTE_FLAG_SAVEONEXIT))
cassette_save(cassette);
- for (int i = 0; i < cassette->blocks.count(); i++)
+ for (unsigned int i = 0; i < cassette->blocks.size(); i++)
global_free(cassette->blocks[i]);
global_free(cassette);
}
@@ -377,8 +377,11 @@ static casserr_t lookup_sample(cassette_image *cassette, int channel, size_t sam
size_t sample_index = sample % SAMPLES_PER_BLOCK;
/* is this block beyond the edge of our waveform? */
- if (sample_blocknum >= cassette->blocks.count())
- cassette->blocks.resize_keep_and_clear_new(sample_blocknum + 1);
+ if (sample_blocknum >= cassette->blocks.size()) {
+ size_t osize = cassette->blocks.size();
+ cassette->blocks.resize(sample_blocknum + 1);
+ memset(&cassette->blocks[osize], 0, (cassette->blocks.size()-osize)*sizeof(cassette->blocks[0]));
+ }
if (cassette->blocks[sample_blocknum] == NULL)
cassette->blocks[sample_blocknum] = global_alloc(sample_block);
@@ -386,8 +389,11 @@ static casserr_t lookup_sample(cassette_image *cassette, int channel, size_t sam
sample_block &block = *cassette->blocks[sample_blocknum];
/* is this sample access off the current block? */
- if (sample_index >= block.count())
- block.resize_keep_and_clear_new(SAMPLES_PER_BLOCK);
+ if (sample_index >= block.size()) {
+ size_t osize = block.size();
+ block.resize(SAMPLES_PER_BLOCK);
+ memset(&block[osize], 0, (SAMPLES_PER_BLOCK-osize)*sizeof(block[0]));
+ }
*ptr = &block[sample_index];
return CASSETTE_ERROR_SUCCESS;
@@ -857,7 +863,7 @@ casserr_t cassette_legacy_construct(cassette_image *cassette,
int sample_count;
dynamic_buffer bytes;
dynamic_buffer chunk;
- dynamic_array<INT16> samples;
+ std::vector<INT16> samples;
int pos = 0;
UINT64 offset = 0;
UINT64 size;
@@ -892,8 +898,8 @@ casserr_t cassette_legacy_construct(cassette_image *cassette,
}
bytes.resize(size);
- cassette_image_read(cassette, bytes, 0, size);
- sample_count = args.chunk_sample_calc(bytes, (int)size);
+ cassette_image_read(cassette, &bytes[0], 0, size);
+ sample_count = args.chunk_sample_calc(&bytes[0], (int)size);
if (args.header_samples < 0)
args.header_samples = sample_count;
@@ -911,7 +917,7 @@ casserr_t cassette_legacy_construct(cassette_image *cassette,
/* if there has to be a header */
if (args.header_samples > 0)
{
- length = args.fill_wave(samples + pos, sample_count - pos, CODE_HEADER);
+ length = args.fill_wave(&samples[pos], sample_count - pos, CODE_HEADER);
if (length < 0)
{
err = CASSETTE_ERROR_INVALIDIMAGE;
@@ -923,10 +929,10 @@ casserr_t cassette_legacy_construct(cassette_image *cassette,
/* convert the file data to samples */
while((pos < sample_count) && (offset < size))
{
- cassette_image_read(cassette, chunk, offset, args.chunk_size);
+ cassette_image_read(cassette, &chunk[0], offset, args.chunk_size);
offset += args.chunk_size;
- length = args.fill_wave(samples + pos, sample_count - pos, chunk);
+ length = args.fill_wave(&samples[pos], sample_count - pos, &chunk[0]);
if (length < 0)
{
err = CASSETTE_ERROR_INVALIDIMAGE;
@@ -940,7 +946,7 @@ casserr_t cassette_legacy_construct(cassette_image *cassette,
/* if there has to be a trailer */
if (args.trailer_samples > 0)
{
- length = args.fill_wave(samples + pos, sample_count - pos, CODE_TRAILER);
+ length = args.fill_wave(&samples[pos], sample_count - pos, CODE_TRAILER);
if (length < 0)
{
err = CASSETTE_ERROR_INVALIDIMAGE;
@@ -951,7 +957,7 @@ casserr_t cassette_legacy_construct(cassette_image *cassette,
/* specify the wave */
err = cassette_put_samples(cassette, 0, 0.0, ((double) pos) / args.sample_frequency,
- pos, 2, samples, CASSETTE_WAVEFORM_16BIT);
+ pos, 2, &samples[0], CASSETTE_WAVEFORM_16BIT);
if (err)
goto done;
diff --git a/src/lib/formats/cassimg.h b/src/lib/formats/cassimg.h
index bd7fc68db93..6b4199e14fc 100644
--- a/src/lib/formats/cassimg.h
+++ b/src/lib/formats/cassimg.h
@@ -69,7 +69,7 @@ typedef enum
}
casserr_t;
-typedef dynamic_array<INT32> sample_block;
+typedef std::vector<INT32> sample_block;
struct CassetteOptions
{
@@ -95,7 +95,7 @@ struct cassette_image
int flags;
UINT32 sample_frequency;
- dynamic_array<sample_block *> blocks;
+ std::vector<sample_block *> blocks;
size_t sample_count;
};
diff --git a/src/lib/formats/ccvf_dsk.c b/src/lib/formats/ccvf_dsk.c
index 115fabccfe6..03ee6fd0dbc 100644
--- a/src/lib/formats/ccvf_dsk.c
+++ b/src/lib/formats/ccvf_dsk.c
@@ -91,7 +91,7 @@ bool ccvf_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
UINT64 size = io_generic_size(io);
dynamic_buffer img(size);
- io_generic_read(io, img, 0, size);
+ io_generic_read(io, &img[0], 0, size);
astring ccvf = astring((const char *)&img[0], size);
dynamic_buffer bytes(78720);
@@ -119,24 +119,24 @@ bool ccvf_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
int total_size = 200000000/f.cell_size;
for(int track=0; track < f.track_count; track++) {
- dynamic_array<UINT32> buffer(total_size);
+ std::vector<UINT32> buffer;
int offset = 0;
for (int i=0; i<1920 && pos<size; i++, pos++) {
for (int bit=0; bit<8; bit++) {
- bit_w(buffer, offset++, BIT(bytes[pos], bit), f.cell_size);
+ bit_w(buffer, BIT(bytes[pos], bit), f.cell_size);
}
}
if (offset < total_size) {
// pad the remainder of the track with sync
- int count = (total_size-offset);
+ int count = total_size-buffer.size();
for (int i=0; i<count;i++) {
- bit_w(buffer, offset++, (track > 0) ? 1 : 0, f.cell_size);
+ bit_w(buffer, (track > 0) ? 1 : 0, f.cell_size);
}
}
- generate_track_from_levels(track, 0, buffer, total_size, 0, image);
+ generate_track_from_levels(track, 0, buffer, 0, image);
}
image->set_variant(f.variant);
diff --git a/src/lib/formats/coco_dsk.c b/src/lib/formats/coco_dsk.c
index 00b785d3e8b..c94cc74d57a 100644
--- a/src/lib/formats/coco_dsk.c
+++ b/src/lib/formats/coco_dsk.c
@@ -720,7 +720,7 @@ static floperr_t coco_dmk_format_track(floppy_image_legacy *floppy, int head, in
UINT8 *track_data;
void *track_data_v;
UINT32 max_track_size;
- dynamic_array<int> sector_map;
+ std::vector<int> sector_map;
sectors = option_resolution_lookup_int(params, PARAM_SECTORS);
sector_length = option_resolution_lookup_int(params, PARAM_SECTOR_LENGTH);
@@ -747,7 +747,7 @@ static floperr_t coco_dmk_format_track(floppy_image_legacy *floppy, int head, in
track_data = (UINT8 *) track_data_v;
/* set up sector map */
- sector_map.resize_and_clear(sectors, 0xFF);
+ memset(&sector_map[0], 0xff, sectors*sizeof(int));
physical_sector = 0;
for (logical_sector = 0; logical_sector < sectors; logical_sector++)
diff --git a/src/lib/formats/cqm_dsk.c b/src/lib/formats/cqm_dsk.c
index 0061af8c869..f30749f9e9b 100644
--- a/src/lib/formats/cqm_dsk.c
+++ b/src/lib/formats/cqm_dsk.c
@@ -317,7 +317,7 @@ bool cqm_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
int cqm_size = io_generic_size(io);
dynamic_buffer cqmbuf(cqm_size);
- io_generic_read(io, cqmbuf, 0, cqm_size);
+ io_generic_read(io, &cqmbuf[0], 0, cqm_size);
// decode the RLE data
for (int s = 0, pos = CQM_HEADER_SIZE + comment_size; pos < cqm_size; )
diff --git a/src/lib/formats/csw_cas.c b/src/lib/formats/csw_cas.c
index e6b51b78c1e..b328a35f572 100644
--- a/src/lib/formats/csw_cas.c
+++ b/src/lib/formats/csw_cas.c
@@ -104,7 +104,7 @@ static int csw_cas_to_wav_size( const UINT8 *casdata, int caslen )
d_stream.avail_in = caslen - ( in_ptr - casdata );
d_stream.total_in=0;
- d_stream.next_out = gz_ptr;
+ d_stream.next_out = &gz_ptr[0];
d_stream.avail_out = 1;
d_stream.total_out=0;
@@ -124,7 +124,7 @@ static int csw_cas_to_wav_size( const UINT8 *casdata, int caslen )
total_size=1;
do
{
- d_stream.next_out = gz_ptr;
+ d_stream.next_out = &gz_ptr[0];
d_stream.avail_out=1;
err=inflate( &d_stream, Z_SYNC_FLUSH );
if (err==Z_OK)
@@ -133,9 +133,9 @@ static int csw_cas_to_wav_size( const UINT8 *casdata, int caslen )
if (bsize==0)
{
d_stream.avail_out=4;
- d_stream.next_out = gz_ptr;
+ d_stream.next_out = &gz_ptr[0];
err=inflate( &d_stream, Z_SYNC_FLUSH );
- bsize=get_leuint32(gz_ptr);
+ bsize=get_leuint32(&gz_ptr[0]);
}
total_size=total_size+bsize;
}
@@ -212,7 +212,7 @@ static int csw_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes )
d_stream.avail_in = mycaslen - ( in_ptr - bytes );
d_stream.total_in=0;
- d_stream.next_out = gz_ptr;
+ d_stream.next_out = &gz_ptr[0];
d_stream.avail_out = 1;
d_stream.total_out=0;
@@ -232,7 +232,7 @@ static int csw_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes )
do
{
- d_stream.next_out = gz_ptr;
+ d_stream.next_out = &gz_ptr[0];
d_stream.avail_out=1;
err=inflate( &d_stream, Z_SYNC_FLUSH );
if (err==Z_OK)
@@ -241,9 +241,9 @@ static int csw_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes )
if (bsize==0)
{
d_stream.avail_out=4;
- d_stream.next_out = gz_ptr;
+ d_stream.next_out = &gz_ptr[0];
err=inflate( &d_stream, Z_SYNC_FLUSH );
- bsize=get_leuint32(gz_ptr);
+ bsize=get_leuint32(&gz_ptr[0]);
}
for (i=0;i<bsize;i++)
{
diff --git a/src/lib/formats/d64_dsk.c b/src/lib/formats/d64_dsk.c
index 5eff8fd08a6..3bcbee87727 100644
--- a/src/lib/formats/d64_dsk.c
+++ b/src/lib/formats/d64_dsk.c
@@ -199,13 +199,14 @@ bool d64_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
dynamic_buffer img;
if(size == (UINT32)f.sector_count*f.sector_base_size) {
- img.resize_and_clear(size + f.sector_count, ERROR_00);
+ img.resize(size + f.sector_count);
+ memset(&img[0], ERROR_00, size + f.sector_count);
}
else {
img.resize(size);
}
- io_generic_read(io, img, 0, size);
+ io_generic_read(io, &img[0], 0, size);
int track_offset = 0, error_offset = f.sector_count*f.sector_base_size;
@@ -230,7 +231,7 @@ bool d64_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
desc_s sectors[40];
- build_sector_description(f, img, track_offset, error_offset, sectors, sector_count);
+ build_sector_description(f, &img[0], track_offset, error_offset, sectors, sector_count);
generate_track(desc, physical_track, head, sectors, sector_count, total_size, image);
track_offset += track_size;
diff --git a/src/lib/formats/dfi_dsk.c b/src/lib/formats/dfi_dsk.c
index 16341f55b26..ce89e02f31a 100644
--- a/src/lib/formats/dfi_dsk.c
+++ b/src/lib/formats/dfi_dsk.c
@@ -90,7 +90,7 @@ bool dfi_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
data.resize(tsize);
pos += 10; // skip the header, we already read it
- io_generic_read(io, data, pos, tsize);
+ io_generic_read(io, &data[0], pos, tsize);
pos += tsize; // for next time we read, increment to the beginning of next header
int index_time = 0; // what point the last index happened
@@ -149,7 +149,8 @@ bool dfi_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
if(!index_time)
index_time = total_time;
- image->set_track_size(track, head, tsize);
+ std::vector<UINT32> &buf = image->get_buffer(track, head);
+ buf.resize(tsize);
int cur_time = 0;
int prev_time = 0;
@@ -162,7 +163,6 @@ bool dfi_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
index_count = 0;
//index_polarity = 0;
UINT32 mg = floppy_image::MG_A;
- UINT32 *buf = image->get_buffer(track, head);
int tpos = 0;
buf[tpos++] = mg;
for(int i=0; i<tsize; i++) {
@@ -218,7 +218,7 @@ bool dfi_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
fprintf(stderr,"\n");
#endif
index_count = 0;
- image->set_track_size(track, head, tpos);
+ buf.resize(tpos);
}
return true;
diff --git a/src/lib/formats/dmk_dsk.c b/src/lib/formats/dmk_dsk.c
index 1c87d268b48..aea4954f115 100644
--- a/src/lib/formats/dmk_dsk.c
+++ b/src/lib/formats/dmk_dsk.c
@@ -121,15 +121,14 @@ bool dmk_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
{
for (int head = 0; head < heads; head++)
{
- dynamic_array<UINT8> track_data(track_size);
- dynamic_array<UINT32> raw_track_data(raw_track_size);
+ std::vector<UINT8> track_data(track_size);
+ std::vector<UINT32> raw_track_data;
int iam_location = -1;
int idam_location[64];
int dam_location[64];
- int tpos = 0;
// Read track
- io_generic_read(io, track_data, header_size + ( heads * track + head ) * track_size, track_size);
+ io_generic_read(io, &track_data[0], header_size + ( heads * track + head ) * track_size, track_size);
for (int i = 0; i < 64; i++)
{
@@ -179,34 +178,34 @@ bool dmk_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
if (offset == iam_location)
{
// Write IAM
- raw_w(raw_track_data, tpos, 16, 0x5224);
- raw_w(raw_track_data, tpos, 16, 0x5224);
- raw_w(raw_track_data, tpos, 16, 0x5224);
+ raw_w(raw_track_data, 16, 0x5224);
+ raw_w(raw_track_data, 16, 0x5224);
+ raw_w(raw_track_data, 16, 0x5224);
offset += 3;
}
if (offset == idam_location[idam_index])
{
- raw_w(raw_track_data, tpos, 16, 0x4489);
- raw_w(raw_track_data, tpos, 16, 0x4489);
- raw_w(raw_track_data, tpos, 16, 0x4489);
+ raw_w(raw_track_data, 16, 0x4489);
+ raw_w(raw_track_data, 16, 0x4489);
+ raw_w(raw_track_data, 16, 0x4489);
idam_index += 1;
offset += 3;
}
if (offset == dam_location[dam_index])
{
- raw_w(raw_track_data, tpos, 16, 0x4489);
- raw_w(raw_track_data, tpos, 16, 0x4489);
- raw_w(raw_track_data, tpos, 16, 0x4489);
+ raw_w(raw_track_data, 16, 0x4489);
+ raw_w(raw_track_data, 16, 0x4489);
+ raw_w(raw_track_data, 16, 0x4489);
dam_index += 1;
offset += 3;
}
- mfm_w(raw_track_data, tpos, 8, track_data[offset]);
+ mfm_w(raw_track_data, 8, track_data[offset]);
}
- generate_track_from_levels(track, head, raw_track_data, raw_track_size, 0, image);
+ generate_track_from_levels(track, head, raw_track_data, 0, image);
}
}
diff --git a/src/lib/formats/flopimg.c b/src/lib/formats/flopimg.c
index 5b9e5f7ee03..72fca547df7 100644
--- a/src/lib/formats/flopimg.c
+++ b/src/lib/formats/flopimg.c
@@ -489,7 +489,7 @@ static floperr_t floppy_readwrite_sector(floppy_image_legacy *floppy, int head,
alloc_buf.resize(sector_length);
/* read the sector (we need to do this even when writing */
- err = read_sector(floppy, head, track, sector, alloc_buf, sector_length);
+ err = read_sector(floppy, head, track, sector, &alloc_buf[0], sector_length);
if (err)
goto done;
@@ -497,15 +497,15 @@ static floperr_t floppy_readwrite_sector(floppy_image_legacy *floppy, int head,
if (writing)
{
- memcpy(alloc_buf + offset, buffer_ptr, this_buffer_len);
+ memcpy(&alloc_buf[offset], buffer_ptr, this_buffer_len);
- err = write_sector(floppy, head, track, sector, alloc_buf, sector_length, ddam);
+ err = write_sector(floppy, head, track, sector, &alloc_buf[0], sector_length, ddam);
if (err)
goto done;
}
else
{
- memcpy(buffer_ptr, alloc_buf + offset, this_buffer_len);
+ memcpy(buffer_ptr, &alloc_buf[offset], this_buffer_len);
}
offset += this_buffer_len;
offset %= sector_length;
@@ -968,7 +968,7 @@ void floppy_image::get_actual_geometry(int &_tracks, int &_heads)
while(maxt >= 0) {
for(int i=0; i<=maxh; i++)
- if(track_array[maxt][i].track_size)
+ if(!track_array[maxt][i].cell_data.empty())
goto track_done;
maxt--;
}
@@ -976,7 +976,7 @@ void floppy_image::get_actual_geometry(int &_tracks, int &_heads)
if(maxt >= 0)
while(maxh >= 0) {
for(int i=0; i<=maxt; i++)
- if(track_array[i][maxh].track_size)
+ if(!track_array[i][maxh].cell_data.empty())
goto head_done;
maxh--;
}
@@ -990,7 +990,7 @@ int floppy_image::get_resolution() const
int mask = 0;
for(int i=0; i<=(tracks-1)*4; i++)
for(int j=0; j<heads; j++)
- if(track_array[i][j].track_size)
+ if(!track_array[i][j].cell_data.empty())
mask |= 1 << (i & 3);
if(mask & 0xa)
return 2;
@@ -999,13 +999,6 @@ int floppy_image::get_resolution() const
return 0;
}
-void floppy_image::ensure_alloc(int track, int head)
-{
- track_info &tr = track_array[track][head];
- if(tr.track_size > tr.cell_data.count())
- tr.cell_data.resize_keep_and_clear_new(tr.track_size);
-}
-
const char *floppy_image::get_variant_name(UINT32 form_factor, UINT32 variant)
{
switch(variant) {
@@ -1145,12 +1138,12 @@ int floppy_image_format_t::crc_cells_size(int type) const
}
}
-bool floppy_image_format_t::bit_r(const UINT32 *buffer, int offset)
+bool floppy_image_format_t::bit_r(const std::vector<UINT32> &buffer, int offset)
{
return (buffer[offset] & floppy_image::MG_MASK) == MG_1;
}
-UINT32 floppy_image_format_t::bitn_r(const UINT32 *buffer, int offset, int count)
+UINT32 floppy_image_format_t::bitn_r(const std::vector<UINT32> &buffer, int offset, int count)
{
UINT32 r = 0;
for(int i=0; i<count; i++)
@@ -1158,18 +1151,40 @@ UINT32 floppy_image_format_t::bitn_r(const UINT32 *buffer, int offset, int count
return r;
}
-void floppy_image_format_t::bit_w(UINT32 *buffer, int offset, bool val, UINT32 size)
+void floppy_image_format_t::bit_w(std::vector<UINT32> &buffer, bool val, UINT32 size, int offset)
{
buffer[offset] = (val ? MG_1 : MG_0) | size;
}
-void floppy_image_format_t::raw_w(UINT32 *buffer, int &offset, int n, UINT32 val, UINT32 size)
+void floppy_image_format_t::bit_w(std::vector<UINT32> &buffer, bool val, UINT32 size)
+{
+ buffer.push_back((val ? MG_1 : MG_0) | size);
+}
+
+void floppy_image_format_t::raw_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size)
+{
+ for(int i=n-1; i>=0; i--)
+ bit_w(buffer, (val >> i) & 1, size);
+}
+
+void floppy_image_format_t::raw_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size, int offset)
{
for(int i=n-1; i>=0; i--)
- bit_w(buffer, offset++, (val >> i) & 1, size);
+ bit_w(buffer, (val >> i) & 1, size, offset);
}
-void floppy_image_format_t::mfm_w(UINT32 *buffer, int &offset, int n, UINT32 val, UINT32 size)
+void floppy_image_format_t::mfm_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size)
+{
+ int prec = buffer.empty() ? 0 : bit_r(buffer, buffer.size()-1);
+ for(int i=n-1; i>=0; i--) {
+ int bit = (val >> i) & 1;
+ bit_w(buffer, !(prec || bit), size);
+ bit_w(buffer, bit, size);
+ prec = bit;
+ }
+}
+
+void floppy_image_format_t::mfm_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size, int offset)
{
int prec = offset ? bit_r(buffer, offset-1) : 0;
for(int i=n-1; i>=0; i--) {
@@ -1180,68 +1195,83 @@ void floppy_image_format_t::mfm_w(UINT32 *buffer, int &offset, int n, UINT32 val
}
}
-void floppy_image_format_t::fm_w(UINT32 *buffer, int &offset, int n, UINT32 val, UINT32 size)
+void floppy_image_format_t::fm_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size)
{
for(int i=n-1; i>=0; i--) {
int bit = (val >> i) & 1;
- bit_w(buffer, offset++, true);
- bit_w(buffer, offset++, bit, size);
+ bit_w(buffer, true, size);
+ bit_w(buffer, bit, size);
}
}
-void floppy_image_format_t::mfm_half_w(UINT32 *buffer, int &offset, int start_bit, UINT32 val, UINT32 size)
+void floppy_image_format_t::fm_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size, int offset)
{
- int prec = offset ? bit_r(buffer, offset-1) : 0;
+ for(int i=n-1; i>=0; i--) {
+ int bit = (val >> i) & 1;
+ bit_w(buffer, true, size, offset++);
+ bit_w(buffer, bit, size, offset++);
+ }
+}
+
+void floppy_image_format_t::mfm_half_w(std::vector<UINT32> &buffer, int start_bit, UINT32 val, UINT32 size)
+{
+ int prec = buffer.empty() ? 0 : bit_r(buffer, buffer.size()-1);
for(int i=start_bit; i>=0; i-=2) {
int bit = (val >> i) & 1;
- bit_w(buffer, offset++, !(prec || bit), size);
- bit_w(buffer, offset++, bit, size);
+ bit_w(buffer, !(prec || bit), size);
+ bit_w(buffer, bit, size);
prec = bit;
}
}
-void floppy_image_format_t::gcr5_w(UINT32 *buffer, int &offset, int n, UINT32 val, UINT32 size)
+void floppy_image_format_t::gcr5_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size)
{
UINT32 e0 = gcr5fw_tb[val >> 4];
UINT32 e1 = gcr5fw_tb[val & 0x0f];
- raw_w(buffer, offset, 5, e0, size);
- raw_w(buffer, offset, 5, e1, size);
+ raw_w(buffer, 5, e0, size);
+ raw_w(buffer, 5, e1, size);
}
-void floppy_image_format_t::_8n1_w(UINT32 *buffer, int &offset, int n, UINT32 val, UINT32 size)
+void floppy_image_format_t::gcr5_w(std::vector<UINT32> &buffer, int start_bit, int n, UINT32 val, UINT32 size)
{
- bit_w(buffer, offset++, 0);
+ UINT32 e0 = gcr5fw_tb[val >> 4];
+ UINT32 e1 = gcr5fw_tb[val & 0x0f];
+ raw_w(buffer, 5, e0, size, start_bit);
+ raw_w(buffer, 5, e1, size, start_bit+5);
+}
+
+void floppy_image_format_t::_8n1_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size)
+{
+ bit_w(buffer, 0, size);
for(int i=n-1; i>=0; i--) {
int bit = (val >> i) & 1;
- bit_w(buffer, offset++, bit, size);
+ bit_w(buffer, bit, size);
}
- bit_w(buffer, offset++, 1);
+ bit_w(buffer, 1, size);
}
-void floppy_image_format_t::fixup_crc_amiga(UINT32 *buffer, const gen_crc_info *crc)
+void floppy_image_format_t::fixup_crc_amiga(std::vector<UINT32> &buffer, const gen_crc_info *crc)
{
UINT16 res = 0;
int size = crc->end - crc->start;
for(int i=1; i<size; i+=2)
if(bit_r(buffer, crc->start + i))
res = res ^ (0x8000 >> ((i >> 1) & 15));
- int offset = crc->write;
- mfm_w(buffer, offset, 16, 0);
- mfm_w(buffer, offset, 16, res);
+ mfm_w(buffer, 16, 0, 1000, crc->write);
+ mfm_w(buffer, 16, res, 1000, crc->write+16);
}
-void floppy_image_format_t::fixup_crc_cbm(UINT32 *buffer, const gen_crc_info *crc)
+void floppy_image_format_t::fixup_crc_cbm(std::vector<UINT32> &buffer, const gen_crc_info *crc)
{
UINT8 v = 0;
for(int o = crc->start; o < crc->end; o+=10) {
v = v ^ (gcr5bw_tb[bitn_r(buffer, o, 5)] << 4);
v = v ^ gcr5bw_tb[bitn_r(buffer, o+5, 5)];
}
- int offset = crc->write;
- gcr5_w(buffer, offset, 10, v);
+ gcr5_w(buffer, 10, v, 1000, crc->write);
}
-UINT16 floppy_image_format_t::calc_crc_ccitt(const UINT32 *buffer, int start, int end)
+UINT16 floppy_image_format_t::calc_crc_ccitt(const std::vector<UINT32> &buffer, int start, int end)
{
UINT32 res = 0xffff;
int size = end - start;
@@ -1255,54 +1285,47 @@ UINT16 floppy_image_format_t::calc_crc_ccitt(const UINT32 *buffer, int start, in
return res;
}
-void floppy_image_format_t::fixup_crc_ccitt(UINT32 *buffer, const gen_crc_info *crc)
+void floppy_image_format_t::fixup_crc_ccitt(std::vector<UINT32> &buffer, const gen_crc_info *crc)
{
- int offset = crc->write;
- mfm_w(buffer, offset, 16, calc_crc_ccitt(buffer, crc->start, crc->end));
+ mfm_w(buffer, 16, calc_crc_ccitt(buffer, crc->start, crc->end), 1000, crc->write);
}
-void floppy_image_format_t::fixup_crc_ccitt_fm(UINT32 *buffer, const gen_crc_info *crc)
+void floppy_image_format_t::fixup_crc_ccitt_fm(std::vector<UINT32> &buffer, const gen_crc_info *crc)
{
- int offset = crc->write;
- fm_w(buffer, offset, 16, calc_crc_ccitt(buffer, crc->start, crc->end));
+ fm_w(buffer, 16, calc_crc_ccitt(buffer, crc->start, crc->end), 1000, crc->write);
}
-void floppy_image_format_t::fixup_crc_machead(UINT32 *buffer, const gen_crc_info *crc)
+void floppy_image_format_t::fixup_crc_machead(std::vector<UINT32> &buffer, const gen_crc_info *crc)
{
UINT8 v = 0;
for(int o = crc->start; o < crc->end; o+=8)
v = v ^ gcr6bw_tb[bitn_r(buffer, o, 8)];
- int offset = crc->write;
- raw_w(buffer, offset, 8, gcr6fw_tb[v]);
+ raw_w(buffer, 8, gcr6fw_tb[v], 1000, crc->write);
}
-void floppy_image_format_t::fixup_crc_fcs(UINT32 *buffer, const gen_crc_info *crc)
+void floppy_image_format_t::fixup_crc_fcs(std::vector<UINT32> &buffer, const gen_crc_info *crc)
{
// TODO
}
-void floppy_image_format_t::fixup_crc_victor_header(UINT32 *buffer, const gen_crc_info *crc)
+void floppy_image_format_t::fixup_crc_victor_header(std::vector<UINT32> &buffer, const gen_crc_info *crc)
{
UINT8 v = 0;
- for(int o = crc->start; o < crc->end; o+=10) {
+ for(int o = crc->start; o < crc->end; o+=10)
v += ((gcr5bw_tb[bitn_r(buffer, o, 5)] << 4) | gcr5bw_tb[bitn_r(buffer, o+5, 5)]);
- }
- int offset = crc->write;
- gcr5_w(buffer, offset, 10, v);
+ gcr5_w(buffer, 10, v, 1000, crc->write);
}
-void floppy_image_format_t::fixup_crc_victor_data(UINT32 *buffer, const gen_crc_info *crc)
+void floppy_image_format_t::fixup_crc_victor_data(std::vector<UINT32> &buffer, const gen_crc_info *crc)
{
UINT16 v = 0;
- for(int o = crc->start; o < crc->end; o+=10) {
+ for(int o = crc->start; o < crc->end; o+=10)
v += ((gcr5bw_tb[bitn_r(buffer, o, 5)] << 4) | gcr5bw_tb[bitn_r(buffer, o+5, 5)]);
- }
- int offset = crc->write;
- gcr5_w(buffer, offset, 10, v & 0xff);
- gcr5_w(buffer, offset, 10, v >> 8);
+ gcr5_w(buffer, 10, v & 0xff, 1000, crc->write);
+ gcr5_w(buffer, 10, v >> 8, 1000, crc->write+10);
}
-void floppy_image_format_t::fixup_crcs(UINT32 *buffer, gen_crc_info *crcs)
+void floppy_image_format_t::fixup_crcs(std::vector<UINT32> &buffer, gen_crc_info *crcs)
{
for(int i=0; i != MAX_CRC_COUNT; i++)
if(crcs[i].write != -1) {
@@ -1381,12 +1404,11 @@ int floppy_image_format_t::calc_sector_index(int num, int interleave, int skew,
void floppy_image_format_t::generate_track(const desc_e *desc, int track, int head, const desc_s *sect, int sect_count, int track_size, floppy_image *image)
{
- dynamic_array<UINT32> buffer(track_size);
+ std::vector<UINT32> buffer;
gen_crc_info crcs[MAX_CRC_COUNT];
collect_crcs(desc, crcs);
- int offset = 0;
int index = 0;
int sector_loop_start = 0;
int sector_idx = 0;
@@ -1396,120 +1418,119 @@ void floppy_image_format_t::generate_track(const desc_e *desc, int track, int he
int sector_skew = 0;
while(desc[index].type != END) {
- // printf("%d.%d.%d (%d) - %d %d\n", desc[index].type, desc[index].p1, desc[index].p2, index, offset, offset/8);
switch(desc[index].type) {
case FM:
for(int i=0; i<desc[index].p2; i++)
- fm_w(buffer, offset, 8, desc[index].p1);
+ fm_w(buffer, 8, desc[index].p1);
break;
case MFM:
for(int i=0; i<desc[index].p2; i++)
- mfm_w(buffer, offset, 8, desc[index].p1);
+ mfm_w(buffer, 8, desc[index].p1);
break;
case MFMBITS:
- mfm_w(buffer, offset, desc[index].p2, desc[index].p1);
+ mfm_w(buffer, desc[index].p2, desc[index].p1);
break;
case GCR5:
for(int i=0; i<desc[index].p2; i++)
- gcr5_w(buffer, offset, 10, desc[index].p1);
+ gcr5_w(buffer, 10, desc[index].p1);
break;
case _8N1:
for(int i=0; i<desc[index].p2; i++)
- _8n1_w(buffer, offset, 8, desc[index].p1);
+ _8n1_w(buffer, 8, desc[index].p1);
break;
case RAW:
for(int i=0; i<desc[index].p2; i++)
- raw_w(buffer, offset, 16, desc[index].p1);
+ raw_w(buffer, 16, desc[index].p1);
break;
case RAWBYTE:
for(int i=0; i<desc[index].p2; i++)
- raw_w(buffer, offset, 8, desc[index].p1);
+ raw_w(buffer, 8, desc[index].p1);
break;
case RAWBITS:
- raw_w(buffer, offset, desc[index].p2, desc[index].p1);
+ raw_w(buffer, desc[index].p2, desc[index].p1);
break;
case SYNC_GCR5:
for(int i=0; i<desc[index].p1; i++)
- raw_w(buffer, offset, 10, 0xffff);
+ raw_w(buffer, 10, 0xffff);
break;
case TRACK_ID:
- mfm_w(buffer, offset, 8, track);
+ mfm_w(buffer, 8, track);
break;
case TRACK_ID_FM:
- fm_w(buffer, offset, 8, track);
+ fm_w(buffer, 8, track);
break;
case TRACK_ID_DOS2_GCR5:
- gcr5_w(buffer, offset, 10, 1 + (track >> 1) + (head * 35));
+ gcr5_w(buffer, 10, 1 + (track >> 1) + (head * 35));
break;
case TRACK_ID_DOS25_GCR5:
- gcr5_w(buffer, offset, 10, 1 + track + (head * 77));
+ gcr5_w(buffer, 10, 1 + track + (head * 77));
break;
case TRACK_ID_GCR6:
- raw_w(buffer, offset, 8, gcr6fw_tb[track & 0x3f]);
+ raw_w(buffer, 8, gcr6fw_tb[track & 0x3f]);
break;
case TRACK_ID_8N1:
- _8n1_w(buffer, offset, 8, track);
+ _8n1_w(buffer, 8, track);
break;
case TRACK_ID_VICTOR_GCR5:
- gcr5_w(buffer, offset, 10, track + (head * 0x80));
+ gcr5_w(buffer, 10, track + (head * 0x80));
break;
case HEAD_ID:
- mfm_w(buffer, offset, 8, head);
+ mfm_w(buffer, 8, head);
break;
case HEAD_ID_FM:
- fm_w(buffer, offset, 8, head);
+ fm_w(buffer, 8, head);
break;
case HEAD_ID_SWAP:
- mfm_w(buffer, offset, 8, !head);
+ mfm_w(buffer, 8, !head);
break;
case TRACK_HEAD_ID_GCR6:
- raw_w(buffer, offset, 8, gcr6fw_tb[(track & 0x40 ? 1 : 0) | (head ? 0x20 : 0)]);
+ raw_w(buffer, 8, gcr6fw_tb[(track & 0x40 ? 1 : 0) | (head ? 0x20 : 0)]);
break;
case SECTOR_ID:
- mfm_w(buffer, offset, 8, sect[sector_idx].sector_id);
+ mfm_w(buffer, 8, sect[sector_idx].sector_id);
break;
case SECTOR_ID_FM:
- fm_w(buffer, offset, 8, sect[sector_idx].sector_id);
+ fm_w(buffer, 8, sect[sector_idx].sector_id);
break;
case SECTOR_ID_GCR5:
- gcr5_w(buffer, offset, 10, sect[sector_idx].sector_id);
+ gcr5_w(buffer, 10, sect[sector_idx].sector_id);
break;
case SECTOR_ID_GCR6:
- raw_w(buffer, offset, 8, gcr6fw_tb[sect[sector_idx].sector_id]);
+ raw_w(buffer, 8, gcr6fw_tb[sect[sector_idx].sector_id]);
break;
case SECTOR_ID_8N1:
- _8n1_w(buffer, offset, 8, sect[sector_idx].sector_id);
+ _8n1_w(buffer, 8, sect[sector_idx].sector_id);
break;
case SIZE_ID: {
int size = sect[sector_idx].size;
int id;
for(id = 0; size > 128; size >>=1, id++);
- mfm_w(buffer, offset, 8, id);
+ mfm_w(buffer, 8, id);
break;
}
@@ -1517,36 +1538,36 @@ void floppy_image_format_t::generate_track(const desc_e *desc, int track, int he
int size = sect[sector_idx].size;
int id;
for(id = 0; size > 128; size >>=1, id++);
- fm_w(buffer, offset, 8, id);
+ fm_w(buffer, 8, id);
break;
}
case SECTOR_INFO_GCR6:
- raw_w(buffer, offset, 8, gcr6fw_tb[sect[sector_idx].sector_info]);
+ raw_w(buffer, 8, gcr6fw_tb[sect[sector_idx].sector_info]);
break;
case OFFSET_ID_O:
- mfm_half_w(buffer, offset, 7, track*2+head);
+ mfm_half_w(buffer, 7, track*2+head);
break;
case OFFSET_ID_E:
- mfm_half_w(buffer, offset, 6, track*2+head);
+ mfm_half_w(buffer, 6, track*2+head);
break;
case SECTOR_ID_O:
- mfm_half_w(buffer, offset, 7, sector_idx);
+ mfm_half_w(buffer, 7, sector_idx);
break;
case SECTOR_ID_E:
- mfm_half_w(buffer, offset, 6, sector_idx);
+ mfm_half_w(buffer, 6, sector_idx);
break;
case REMAIN_O:
- mfm_half_w(buffer, offset, 7, desc[index].p1 - sector_idx);
+ mfm_half_w(buffer, 7, desc[index].p1 - sector_idx);
break;
case REMAIN_E:
- mfm_half_w(buffer, offset, 6, desc[index].p1 - sector_idx);
+ mfm_half_w(buffer, 6, desc[index].p1 - sector_idx);
break;
case SECTOR_LOOP_START:
@@ -1580,50 +1601,50 @@ void floppy_image_format_t::generate_track(const desc_e *desc, int track, int he
case CRC_FCS_START:
case CRC_VICTOR_HDR_START:
case CRC_VICTOR_DATA_START:
- crcs[desc[index].p1].start = offset;
+ crcs[desc[index].p1].start = buffer.size();
break;
case CRC_END:
- crcs[desc[index].p1].end = offset;
+ crcs[desc[index].p1].end = buffer.size();
break;
case CRC:
- crcs[desc[index].p1].write = offset;
- offset += crc_cells_size(crcs[desc[index].p1].type);
+ crcs[desc[index].p1].write = buffer.size();
+ buffer.resize(buffer.size() + crc_cells_size(crcs[desc[index].p1].type));
break;
case SECTOR_DATA: {
const desc_s *csect = sect + (desc[index].p1 >= 0 ? desc[index].p1 : sector_idx);
for(int i=0; i != csect->size; i++)
- mfm_w(buffer, offset, 8, csect->data[i]);
+ mfm_w(buffer, 8, csect->data[i]);
break;
}
case SECTOR_DATA_FM: {
const desc_s *csect = sect + (desc[index].p1 >= 0 ? desc[index].p1 : sector_idx);
for(int i=0; i != csect->size; i++)
- fm_w(buffer, offset, 8, csect->data[i]);
+ fm_w(buffer, 8, csect->data[i]);
break;
}
case SECTOR_DATA_O: {
const desc_s *csect = sect + (desc[index].p1 >= 0 ? desc[index].p1 : sector_idx);
for(int i=0; i != csect->size; i++)
- mfm_half_w(buffer, offset, 7, csect->data[i]);
+ mfm_half_w(buffer, 7, csect->data[i]);
break;
}
case SECTOR_DATA_E: {
const desc_s *csect = sect + (desc[index].p1 >= 0 ? desc[index].p1 : sector_idx);
for(int i=0; i != csect->size; i++)
- mfm_half_w(buffer, offset, 6, csect->data[i]);
+ mfm_half_w(buffer, 6, csect->data[i]);
break;
}
case SECTOR_DATA_GCR5: {
const desc_s *csect = sect + (desc[index].p1 >= 0 ? desc[index].p1 : sector_idx);
for(int i=0; i != csect->size; i++)
- gcr5_w(buffer, offset, 10, csect->data[i]);
+ gcr5_w(buffer, 10, csect->data[i]);
break;
}
@@ -1649,16 +1670,16 @@ void floppy_image_format_t::generate_track(const desc_e *desc, int track, int he
vc = vc ^ cb;
int nb = dt > 2 ? 32 : dt > 1 ? 24 : 16;
- raw_w(buffer, offset, nb, gcr6_encode(va, vb, vc) >> (32-nb));
+ raw_w(buffer, nb, gcr6_encode(va, vb, vc) >> (32-nb));
}
- raw_w(buffer, offset, 32, gcr6_encode(ca, cb, cc));
+ raw_w(buffer, 32, gcr6_encode(ca, cb, cc));
break;
}
case SECTOR_DATA_8N1: {
const desc_s *csect = sect + (desc[index].p1 >= 0 ? desc[index].p1 : sector_idx);
for(int i=0; i != csect->size; i++)
- _8n1_w(buffer, offset, 8, csect->data[i]);
+ _8n1_w(buffer, 8, csect->data[i]);
break;
}
@@ -1669,22 +1690,22 @@ void floppy_image_format_t::generate_track(const desc_e *desc, int track, int he
index++;
}
- if(offset != track_size)
- throw emu_fatalerror("Wrong track size in generate_track, expected %d, got %d\n", track_size, offset);
+ if(int(buffer.size()) != track_size)
+ throw emu_fatalerror("Wrong track size in generate_track, expected %d, got %d\n", track_size, int(buffer.size()));
fixup_crcs(buffer, crcs);
- generate_track_from_levels(track, head, buffer, track_size, 0, image);
+ generate_track_from_levels(track, head, buffer, 0, image);
}
-void floppy_image_format_t::normalize_times(UINT32 *buffer, int bitlen)
+void floppy_image_format_t::normalize_times(std::vector<UINT32> &buffer)
{
unsigned int total_sum = 0;
- for(int i=0; i != bitlen; i++)
+ for(unsigned int i=0; i != buffer.size(); i++)
total_sum += buffer[i] & floppy_image::TIME_MASK;
unsigned int current_sum = 0;
- for(int i=0; i != bitlen; i++) {
+ for(unsigned int i=0; i != buffer.size(); i++) {
UINT32 time = buffer[i] & floppy_image::TIME_MASK;
buffer[i] = (buffer[i] & floppy_image::MG_MASK) | (200000000ULL * current_sum / total_sum);
current_sum += time;
@@ -1694,33 +1715,30 @@ void floppy_image_format_t::normalize_times(UINT32 *buffer, int bitlen)
void floppy_image_format_t::generate_track_from_bitstream(int track, int head, const UINT8 *trackbuf, int track_size, floppy_image *image, int subtrack)
{
// Maximal number of cells which happens when the buffer is all 1
- image->set_track_size(track, head, track_size+1, subtrack);
- UINT32 *dest = image->get_buffer(track, head, subtrack);
- UINT32 *base = dest;
+ std::vector<UINT32> &dest = image->get_buffer(track, head, subtrack);
+ dest.clear();
UINT32 cbit = floppy_image::MG_A;
UINT32 count = 0;
for(int i=0; i != track_size; i++)
if(trackbuf[i >> 3] & (0x80 >> (i & 7))) {
- *dest++ = cbit | (count+1);
+ dest.push_back(cbit | (count+1));
cbit = cbit == floppy_image::MG_A ? floppy_image::MG_B : floppy_image::MG_A;
count = 1;
} else
count += 2;
if(count)
- *dest++ = cbit | count;
+ dest.push_back(cbit | count);
- int size = dest - base;
- normalize_times(base, size);
- image->set_track_size(track, head, size, subtrack);
+ normalize_times(dest);
image->set_write_splice_position(track, head, 0, subtrack);
}
-void floppy_image_format_t::generate_track_from_levels(int track, int head, UINT32 *trackbuf, int track_size, int splice_pos, floppy_image *image)
+void floppy_image_format_t::generate_track_from_levels(int track, int head, std::vector<UINT32> &trackbuf, int splice_pos, floppy_image *image)
{
// Retrieve the angular splice pos before messing with the data
- splice_pos = splice_pos % track_size;
+ splice_pos = splice_pos % trackbuf.size();
UINT32 splice_angular_pos = trackbuf[splice_pos] & floppy_image::TIME_MASK;
// Check if we need to invert a cell to get an even number of
@@ -1729,7 +1747,7 @@ void floppy_image_format_t::generate_track_from_levels(int track, int head, UINT
// Also check if all MG values are valid
int transition_count = 0;
- for(int i=0; i<track_size; i++) {
+ for(unsigned int i=0; i<trackbuf.size(); i++) {
switch(trackbuf[i] & floppy_image::MG_MASK) {
case MG_1:
transition_count++;
@@ -1754,7 +1772,7 @@ void floppy_image_format_t::generate_track_from_levels(int track, int head, UINT
int pos = splice_pos;
while((trackbuf[pos] & floppy_image::MG_MASK) != MG_0 && (trackbuf[pos] & floppy_image::MG_MASK) != MG_1) {
pos++;
- if(pos == track_size)
+ if(pos == int(trackbuf.size()))
pos = 0;
if(pos == splice_pos)
goto meh;
@@ -1770,13 +1788,12 @@ void floppy_image_format_t::generate_track_from_levels(int track, int head, UINT
}
// Maximal number of cells which happens when the buffer is all MG_1/MG_N alternated, which would be 3/2
- image->set_track_size(track, head, track_size*2);
- UINT32 *dest = image->get_buffer(track, head);
- UINT32 *base = dest;
+ std::vector<UINT32> &dest = image->get_buffer(track, head);
+ dest.clear();
UINT32 cbit = floppy_image::MG_A;
UINT32 count = 0;
- for(int i=0; i<track_size; i++) {
+ for(unsigned int i=0; i<trackbuf.size(); i++) {
UINT32 bit = trackbuf[i] & floppy_image::MG_MASK;
UINT32 time = trackbuf[i] & floppy_image::TIME_MASK;
if(bit == MG_0) {
@@ -1785,22 +1802,20 @@ void floppy_image_format_t::generate_track_from_levels(int track, int head, UINT
}
if(bit == MG_1) {
count += time >> 1;
- *dest++ = cbit | count;
+ dest.push_back(cbit | count);
cbit = cbit == floppy_image::MG_A ? floppy_image::MG_B : floppy_image::MG_A;
count = time - (time >> 1);
continue;
}
- *dest++ = cbit | count;
- *dest++ = trackbuf[i];
+ dest.push_back(cbit | count);
+ dest.push_back(trackbuf[i]);
count = 0;
}
if(count)
- *dest++ = cbit | count;
+ dest.push_back(cbit | count);
- int size = dest - base;
- normalize_times(base, size);
- image->set_track_size(track, head, size);
+ normalize_times(dest);
image->set_write_splice_position(track, head, splice_angular_pos);
}
@@ -2212,8 +2227,8 @@ const floppy_image_format_t::desc_e floppy_image_format_t::amiga_22[] = {
void floppy_image_format_t::generate_bitstream_from_track(int track, int head, int cell_size, UINT8 *trackbuf, int &track_size, floppy_image *image, int subtrack)
{
- int tsize = image->get_track_size(track, head, subtrack);
- if(!tsize || tsize == 1) {
+ std::vector<UINT32> &tbuf = image->get_buffer(track, head, subtrack);
+ if(tbuf.size() <= 1) {
// Unformatted track
track_size = 200000000/cell_size;
memset(trackbuf, 0, (track_size+7)/8);
@@ -2221,11 +2236,10 @@ void floppy_image_format_t::generate_bitstream_from_track(int track, int head, i
}
// Start at the write splice
- const UINT32 *tbuf = image->get_buffer(track, head, subtrack);
UINT32 splice = image->get_write_splice_position(track, head, subtrack);
int cur_pos = splice;
int cur_entry = 0;
- while(cur_entry < tsize-1 && (tbuf[cur_entry+1] & floppy_image::TIME_MASK) < cur_pos)
+ while(cur_entry < int(tbuf.size())-1 && (tbuf[cur_entry+1] & floppy_image::TIME_MASK) < cur_pos)
cur_entry++;
int cur_bit = 0;
@@ -2297,14 +2311,14 @@ void floppy_image_format_t::generate_bitstream_from_track(int track, int head, i
cur_pos -= 200000000;
cur_entry = 0;
}
- while(cur_entry < tsize-1 && (tbuf[cur_entry] & floppy_image::TIME_MASK) < cur_pos)
+ while(cur_entry < int(tbuf.size())-1 && (tbuf[cur_entry] & floppy_image::TIME_MASK) < cur_pos)
cur_entry++;
// Wrap around
- if(cur_entry == tsize-1 &&
+ if(cur_entry == int(tbuf.size())-1 &&
(tbuf[cur_entry] & floppy_image::TIME_MASK) < cur_pos) {
// Wrap to index 0 or 1 depending on whether there is a transition exactly at the index hole
- cur_entry = (tbuf[tsize-1] & floppy_image::MG_MASK) != (tbuf[0] & floppy_image::MG_MASK) ?
+ cur_entry = (tbuf[int(tbuf.size())-1] & floppy_image::MG_MASK) != (tbuf[0] & floppy_image::MG_MASK) ?
0 : 1;
}
}
@@ -2642,23 +2656,21 @@ void floppy_image_format_t::build_wd_track_mfm(int track, int head, floppy_image
void floppy_image_format_t::build_pc_track_fm(int track, int head, floppy_image *image, int cell_count, int sector_count, const desc_pc_sector *sects, int gap_3, int gap_4a, int gap_1, int gap_2)
{
- dynamic_array<UINT32> track_data(cell_count+10000);
- int tpos = 0;
+ std::vector<UINT32> track_data;
// gap 4a , IAM and gap 1
if(gap_4a != -1) {
- for(int i=0; i<gap_4a; i++) fm_w(track_data, tpos, 8, 0xff);
- for(int i=0; i< 6; i++) fm_w(track_data, tpos, 8, 0x00);
- raw_w(track_data, tpos, 16, 0xf77a);
+ for(int i=0; i<gap_4a; i++) fm_w(track_data, 8, 0xff);
+ for(int i=0; i< 6; i++) fm_w(track_data, 8, 0x00);
+ raw_w(track_data, 16, 0xf77a);
}
- for(int i=0; i<gap_1; i++) fm_w(track_data, tpos, 8, 0xff);
+ for(int i=0; i<gap_1; i++) fm_w(track_data, 8, 0xff);
int total_size = 0;
for(int i=0; i<sector_count; i++)
total_size += sects[i].actual_size;
- int etpos = tpos;
- etpos += (sector_count*(6+5+2+gap_2+6+1+2) + total_size)*16;
+ unsigned int etpos = track_data.size() + (sector_count*(6+5+2+gap_2+6+1+2) + total_size)*16;
if(etpos > cell_count)
throw emu_fatalerror("Incorrect layout on track %d head %d, expected_size=%d, current_size=%d", track, head, cell_count, etpos);
@@ -2668,66 +2680,64 @@ void floppy_image_format_t::build_pc_track_fm(int track, int head, floppy_image
// Build the track
for(int i=0; i<sector_count; i++) {
- int cpos;
UINT16 crc;
// sync and IDAM and gap 2
- for(int j=0; j< 6; j++) fm_w(track_data, tpos, 8, 0x00);
- cpos = tpos;
- raw_w(track_data, tpos, 16, 0xf57e);
- fm_w (track_data, tpos, 8, sects[i].track);
- fm_w (track_data, tpos, 8, sects[i].head);
- fm_w (track_data, tpos, 8, sects[i].sector);
- fm_w (track_data, tpos, 8, sects[i].size);
- crc = calc_crc_ccitt(track_data, cpos, tpos);
- fm_w (track_data, tpos, 16, crc);
- for(int j=0; j<gap_2; j++) fm_w(track_data, tpos, 8, 0xff);
+ for(int j=0; j< 6; j++) fm_w(track_data, 8, 0x00);
+
+ unsigned int cpos = track_data.size();
+ raw_w(track_data, 16, 0xf57e);
+ fm_w (track_data, 8, sects[i].track);
+ fm_w (track_data, 8, sects[i].head);
+ fm_w (track_data, 8, sects[i].sector);
+ fm_w (track_data, 8, sects[i].size);
+ crc = calc_crc_ccitt(track_data, cpos, track_data.size());
+ fm_w (track_data, 16, crc);
+ for(int j=0; j<gap_2; j++) fm_w(track_data, 8, 0xff);
if(!sects[i].data)
- for(int j=0; j<6+1+sects[i].actual_size+2+(i != sector_count-1 ? gap_3 : 0); j++) fm_w(track_data, tpos, 8, 0xff);
+ for(int j=0; j<6+1+sects[i].actual_size+2+(i != sector_count-1 ? gap_3 : 0); j++) fm_w(track_data, 8, 0xff);
else {
// sync, DAM, data and gap 3
- for(int j=0; j< 6; j++) fm_w(track_data, tpos, 8, 0x00);
- cpos = tpos;
- raw_w(track_data, tpos, 16, sects[i].deleted ? 0xf56a : 0xf56f);
- for(int j=0; j<sects[i].actual_size; j++) fm_w(track_data, tpos, 8, sects[i].data[j]);
- crc = calc_crc_ccitt(track_data, cpos, tpos);
+ for(int j=0; j< 6; j++) fm_w(track_data, 8, 0x00);
+ cpos = track_data.size();
+ raw_w(track_data, 16, sects[i].deleted ? 0xf56a : 0xf56f);
+ for(int j=0; j<sects[i].actual_size; j++) fm_w(track_data, 8, sects[i].data[j]);
+ crc = calc_crc_ccitt(track_data, cpos, track_data.size());
if(sects[i].bad_crc)
crc = 0xffff^crc;
- fm_w(track_data, tpos, 16, crc);
+ fm_w(track_data, 16, crc);
if(i != sector_count-1)
- for(int j=0; j<gap_3; j++) fm_w(track_data, tpos, 8, 0xff);
+ for(int j=0; j<gap_3; j++) fm_w(track_data, 8, 0xff);
}
}
// Gap 4b
- while(tpos < cell_count-15) fm_w(track_data, tpos, 8, 0xff);
- raw_w(track_data, tpos, cell_count-tpos, 0xffff >> (16+tpos-cell_count));
+ while(int(track_data.size()) < cell_count-15) fm_w(track_data, 8, 0xff);
+ raw_w(track_data, cell_count-int(track_data.size()), 0xffff >> (16+int(track_data.size())-cell_count));
- generate_track_from_levels(track, head, track_data, cell_count, 0, image);
+ generate_track_from_levels(track, head, track_data, 0, image);
}
void floppy_image_format_t::build_pc_track_mfm(int track, int head, floppy_image *image, int cell_count, int sector_count, const desc_pc_sector *sects, int gap_3, int gap_4a, int gap_1, int gap_2)
{
- dynamic_array<UINT32> track_data(cell_count+10000);
- int tpos = 0;
+ std::vector<UINT32> track_data;
// gap 4a , IAM and gap 1
if(gap_4a != -1) {
- for(int i=0; i<gap_4a; i++) mfm_w(track_data, tpos, 8, 0x4e);
- for(int i=0; i<12; i++) mfm_w(track_data, tpos, 8, 0x00);
- for(int i=0; i< 3; i++) raw_w(track_data, tpos, 16, 0x5224);
- mfm_w(track_data, tpos, 8, 0xfc);
+ for(int i=0; i<gap_4a; i++) mfm_w(track_data, 8, 0x4e);
+ for(int i=0; i<12; i++) mfm_w(track_data, 8, 0x00);
+ for(int i=0; i< 3; i++) raw_w(track_data, 16, 0x5224);
+ mfm_w(track_data, 8, 0xfc);
}
- for(int i=0; i<gap_1; i++) mfm_w(track_data, tpos, 8, 0x4e);
+ for(int i=0; i<gap_1; i++) mfm_w(track_data, 8, 0x4e);
int total_size = 0;
for(int i=0; i<sector_count; i++)
total_size += sects[i].actual_size;
- int etpos = tpos;
- etpos += (sector_count*(12+3+5+2+gap_2+12+3+1+2) + total_size)*16;
+ int etpos = int(track_data.size()) + (sector_count*(12+3+5+2+gap_2+12+3+1+2) + total_size)*16;
if(etpos > cell_count)
throw emu_fatalerror("Incorrect layout on track %d head %d, expected_size=%d, current_size=%d", track, head, cell_count, etpos);
@@ -2737,44 +2747,43 @@ void floppy_image_format_t::build_pc_track_mfm(int track, int head, floppy_image
// Build the track
for(int i=0; i<sector_count; i++) {
- int cpos;
UINT16 crc;
// sync and IDAM and gap 2
- for(int j=0; j<12; j++) mfm_w(track_data, tpos, 8, 0x00);
- cpos = tpos;
- for(int j=0; j< 3; j++) raw_w(track_data, tpos, 16, 0x4489);
- mfm_w(track_data, tpos, 8, 0xfe);
- mfm_w(track_data, tpos, 8, sects[i].track);
- mfm_w(track_data, tpos, 8, sects[i].head);
- mfm_w(track_data, tpos, 8, sects[i].sector);
- mfm_w(track_data, tpos, 8, sects[i].size);
- crc = calc_crc_ccitt(track_data, cpos, tpos);
- mfm_w(track_data, tpos, 16, crc);
- for(int j=0; j<gap_2; j++) mfm_w(track_data, tpos, 8, 0x4e);
+ for(int j=0; j<12; j++) mfm_w(track_data, 8, 0x00);
+ unsigned int cpos = track_data.size();
+ for(int j=0; j< 3; j++) raw_w(track_data, 16, 0x4489);
+ mfm_w(track_data, 8, 0xfe);
+ mfm_w(track_data, 8, sects[i].track);
+ mfm_w(track_data, 8, sects[i].head);
+ mfm_w(track_data, 8, sects[i].sector);
+ mfm_w(track_data, 8, sects[i].size);
+ crc = calc_crc_ccitt(track_data, cpos, track_data.size());
+ mfm_w(track_data, 16, crc);
+ for(int j=0; j<gap_2; j++) mfm_w(track_data, 8, 0x4e);
if(!sects[i].data)
- for(int j=0; j<12+4+sects[i].actual_size+2+(i != sector_count-1 ? gap_3 : 0); j++) mfm_w(track_data, tpos, 8, 0x4e);
+ for(int j=0; j<12+4+sects[i].actual_size+2+(i != sector_count-1 ? gap_3 : 0); j++) mfm_w(track_data, 8, 0x4e);
else {
// sync, DAM, data and gap 3
- for(int j=0; j<12; j++) mfm_w(track_data, tpos, 8, 0x00);
- cpos = tpos;
- for(int j=0; j< 3; j++) raw_w(track_data, tpos, 16, 0x4489);
- mfm_w(track_data, tpos, 8, sects[i].deleted ? 0xf8 : 0xfb);
- for(int j=0; j<sects[i].actual_size; j++) mfm_w(track_data, tpos, 8, sects[i].data[j]);
- crc = calc_crc_ccitt(track_data, cpos, tpos);
+ for(int j=0; j<12; j++) mfm_w(track_data, 8, 0x00);
+ cpos = track_data.size();
+ for(int j=0; j< 3; j++) raw_w(track_data, 16, 0x4489);
+ mfm_w(track_data, 8, sects[i].deleted ? 0xf8 : 0xfb);
+ for(int j=0; j<sects[i].actual_size; j++) mfm_w(track_data, 8, sects[i].data[j]);
+ crc = calc_crc_ccitt(track_data, cpos, track_data.size());
if(sects[i].bad_crc)
crc = 0xffff^crc;
- mfm_w(track_data, tpos, 16, crc);
+ mfm_w(track_data, 16, crc);
if(i != sector_count-1)
- for(int j=0; j<gap_3; j++) mfm_w(track_data, tpos, 8, 0x4e);
+ for(int j=0; j<gap_3; j++) mfm_w(track_data, 8, 0x4e);
}
}
// Gap 4b
- while(tpos < cell_count-15) mfm_w(track_data, tpos, 8, 0x4e);
- raw_w(track_data, tpos, cell_count-tpos, 0x9254 >> (16+tpos-cell_count));
+ while(int(track_data.size()) < cell_count-15) mfm_w(track_data, 8, 0x4e);
+ raw_w(track_data, cell_count-int(track_data.size()), 0x9254 >> (16+int(track_data.size())-cell_count));
- generate_track_from_levels(track, head, track_data, cell_count, 0, image);
+ generate_track_from_levels(track, head, track_data, 0, image);
}
diff --git a/src/lib/formats/flopimg.h b/src/lib/formats/flopimg.h
index 30562e0371e..f4d4953d7ef 100644
--- a/src/lib/formats/flopimg.h
+++ b/src/lib/formats/flopimg.h
@@ -402,10 +402,10 @@ protected:
know. trackbuf may be modified at that position or after.
@param image
*/
- void generate_track_from_levels(int track, int head, UINT32 *trackbuf, int track_size, int splice_pos, floppy_image *image);
+ void generate_track_from_levels(int track, int head, std::vector<UINT32> &trackbuf, int splice_pos, floppy_image *image);
//! Normalize the times in a cell buffer to sum up to 200000000
- void normalize_times(UINT32 *buffer, int bitlen);
+ void normalize_times(std::vector<UINT32> &buffer);
// Some conversion tables for gcr
static const UINT8 gcr5fw_tb[0x10], gcr5bw_tb[0x20];
@@ -538,25 +538,30 @@ protected:
void get_track_data_fm_pc(int track, int head, floppy_image *image, int cell_size, int sector_size, int sector_count, UINT8 *sectdata);
//! Look up a bit in a level-type stream.
- bool bit_r(const UINT32 *buffer, int offset);
+ bool bit_r(const std::vector<UINT32> &buffer, int offset);
//! Look up multiple bits
- UINT32 bitn_r(const UINT32 *buffer, int offset, int count);
+ UINT32 bitn_r(const std::vector<UINT32> &buffer, int offset, int count);
//! Write a bit with a given size.
- void bit_w(UINT32 *buffer, int offset, bool val, UINT32 size = 1000);
+ void bit_w(std::vector<UINT32> &buffer, bool val, UINT32 size = 1000);
+ void bit_w(std::vector<UINT32> &buffer, bool val, UINT32 size, int offset);
//! Calculate a CCITT-type CRC.
- UINT16 calc_crc_ccitt(const UINT32 *buffer, int start, int end);
- //! Write a series of (raw) bits and increment the offset.
- void raw_w(UINT32 *buffer, int &offset, int n, UINT32 val, UINT32 size = 1000);
+ UINT16 calc_crc_ccitt(const std::vector<UINT32> &buffer, int start, int end);
+ //! Write a series of (raw) bits
+ void raw_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size = 1000);
+ void raw_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size, int offset);
//! FM-encode and write a series of bits
- void fm_w(UINT32 *buffer, int &offset, int n, UINT32 val, UINT32 size = 1000);
+ void fm_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size = 1000);
+ void fm_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size, int offset);
//! MFM-encode and write a series of bits
- void mfm_w(UINT32 *buffer, int &offset, int n, UINT32 val, UINT32 size = 1000);
+ void mfm_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size = 1000);
+ void mfm_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size, int offset);
//! MFM-encode every two bits and write
- void mfm_half_w(UINT32 *buffer, int &offset, int start_bit, UINT32 val, UINT32 size = 1000);
+ void mfm_half_w(std::vector<UINT32> &buffer, int start_bit, UINT32 val, UINT32 size = 1000);
//! GCR5-encode and write a series of bits
- void gcr5_w(UINT32 *buffer, int &offset, int n, UINT32 val, UINT32 size = 1000);
+ void gcr5_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size = 1000);
+ void gcr5_w(std::vector<UINT32> &buffer, int offset, int n, UINT32 val, UINT32 size = 1000);
//! 8N1-encode and write a series of bits
- void _8n1_w(UINT32 *buffer, int &offset, int n, UINT32 val, UINT32 size = 1000);
+ void _8n1_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size = 1000);
//! GCR4 encode (Apple II sector header)
UINT16 gcr4_encode(UINT8 va);
//! GCR4 decode
@@ -585,15 +590,15 @@ private:
bool type_data_mfm(int type, int p1, const gen_crc_info *crcs) const;
int crc_cells_size(int type) const;
- void fixup_crc_amiga(UINT32 *buffer, const gen_crc_info *crc);
- void fixup_crc_cbm(UINT32 *buffer, const gen_crc_info *crc);
- void fixup_crc_ccitt(UINT32 *buffer, const gen_crc_info *crc);
- void fixup_crc_ccitt_fm(UINT32 *buffer, const gen_crc_info *crc);
- void fixup_crc_machead(UINT32 *buffer, const gen_crc_info *crc);
- void fixup_crc_fcs(UINT32 *buffer, const gen_crc_info *crc);
- void fixup_crc_victor_header(UINT32 *buffer, const gen_crc_info *crc);
- void fixup_crc_victor_data(UINT32 *buffer, const gen_crc_info *crc);
- void fixup_crcs(UINT32 *buffer, gen_crc_info *crcs);
+ void fixup_crc_amiga(std::vector<UINT32> &buffer, const gen_crc_info *crc);
+ void fixup_crc_cbm(std::vector<UINT32> &buffer, const gen_crc_info *crc);
+ void fixup_crc_ccitt(std::vector<UINT32> &buffer, const gen_crc_info *crc);
+ void fixup_crc_ccitt_fm(std::vector<UINT32> &buffer, const gen_crc_info *crc);
+ void fixup_crc_machead(std::vector<UINT32> &buffer, const gen_crc_info *crc);
+ void fixup_crc_fcs(std::vector<UINT32> &buffer, const gen_crc_info *crc);
+ void fixup_crc_victor_header(std::vector<UINT32> &buffer, const gen_crc_info *crc);
+ void fixup_crc_victor_data(std::vector<UINT32> &buffer, const gen_crc_info *crc);
+ void fixup_crcs(std::vector<UINT32> &buffer, gen_crc_info *crcs);
void collect_crcs(const desc_e *desc, gen_crc_info *crcs);
int sbit_r(const UINT8 *bitstream, int pos);
@@ -717,24 +722,10 @@ public:
/*!
@param track
@param subtrack
- @param head
- @param size size of this track
- */
- void set_track_size(int track, int head, UINT32 size, int subtrack = 0) { track_array[track*4+subtrack][head].track_size = size; ensure_alloc(track*4+subtrack, head); }
-
- /*!
- @param track
- @param subtrack
@param head head number
@return a pointer to the data buffer for this track and head
*/
- UINT32 *get_buffer(int track, int head, int subtrack = 0) { return track_array[track*4+subtrack][head].cell_data; }
-
- //! @return the track size
- //! @param track
- //! @param subtrack
- //! @param head
- UINT32 get_track_size(int track, int head, int subtrack = 0) { return track_array[track*4+subtrack][head].track_size; }
+ std::vector<UINT32> &get_buffer(int track, int head, int subtrack = 0) { return track_array[track*4+subtrack][head].cell_data; }
//! Sets the write splice position.
//! The "track splice" information indicates where to start writing
@@ -772,18 +763,15 @@ private:
UINT32 form_factor, variant;
struct track_info {
- dynamic_array<UINT32> cell_data;
- UINT32 track_size;
+ std::vector<UINT32> cell_data;
UINT32 write_splice;
- track_info() { track_size = write_splice = 0; }
+ track_info() { write_splice = 0; }
};
// track number multiplied by 4 then head
// last array size may be bigger than actual track size
- dynamic_array<dynamic_array<track_info> > track_array;
-
- void ensure_alloc(int track, int head);
+ std::vector<std::vector<track_info> > track_array;
};
#endif /* FLOPIMG_H */
diff --git a/src/lib/formats/g64_dsk.c b/src/lib/formats/g64_dsk.c
index a2500b473cd..b4b9f057f1b 100644
--- a/src/lib/formats/g64_dsk.c
+++ b/src/lib/formats/g64_dsk.c
@@ -42,7 +42,7 @@ bool g64_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
{
UINT64 size = io_generic_size(io);
dynamic_buffer img(size);
- io_generic_read(io, img, 0, size);
+ io_generic_read(io, &img[0], 0, size);
if (img[VERSION]) {
throw emu_fatalerror("g64_format: Unsupported version %u", img[VERSION]);
@@ -53,7 +53,7 @@ bool g64_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
for (int track = 0; track < track_count; track++)
{
- UINT32 track_offset = pick_integer_le(img, TRACK_OFFSET + (track * 4), 4);
+ UINT32 track_offset = pick_integer_le(&img[0], TRACK_OFFSET + (track * 4), 4);
if (!track_offset)
continue;
@@ -61,12 +61,12 @@ bool g64_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
if (track_offset > size)
throw emu_fatalerror("g64_format: Track %u offset %06x out of bounds", track, track_offset);
- UINT32 speed_zone = pick_integer_le(img, SPEED_ZONE + (track * 4), 4);
+ UINT32 speed_zone = pick_integer_le(&img[0], SPEED_ZONE + (track * 4), 4);
if (speed_zone > 3)
throw emu_fatalerror("g64_format: Unsupported variable speed zones on track %d", track);
- UINT16 track_bytes = pick_integer_le(img, track_offset, 2);
+ UINT16 track_bytes = pick_integer_le(&img[0], track_offset, 2);
int track_size = track_bytes * 8;
LOG_FORMATS("track %u size %u cell %ld\n", track, track_size, 200000000L/track_size);
@@ -109,17 +109,17 @@ bool g64_format::save(io_generic *io, floppy_image *image)
io_generic_write_filler(io, 0x00, tpos, 4);
io_generic_write_filler(io, 0x00, spos, 4);
- if (image->get_track_size(track, head) <= 1)
+ if (image->get_buffer(track, head).size() <= 1)
continue;
int track_size;
int speed_zone;
// figure out the cell size and speed zone from the track data
- if ((speed_zone = generate_bitstream(track, head, 3, trackbuf, track_size, image)) == -1)
- if ((speed_zone = generate_bitstream(track, head, 2, trackbuf, track_size, image)) == -1)
- if ((speed_zone = generate_bitstream(track, head, 1, trackbuf, track_size, image)) == -1)
- if ((speed_zone = generate_bitstream(track, head, 0, trackbuf, track_size, image)) == -1)
+ if ((speed_zone = generate_bitstream(track, head, 3, &trackbuf[0], track_size, image)) == -1)
+ if ((speed_zone = generate_bitstream(track, head, 2, &trackbuf[0], track_size, image)) == -1)
+ if ((speed_zone = generate_bitstream(track, head, 1, &trackbuf[0], track_size, image)) == -1)
+ if ((speed_zone = generate_bitstream(track, head, 0, &trackbuf[0], track_size, image)) == -1)
throw emu_fatalerror("g64_format: Cannot determine speed zone for track %u", track);
LOG_FORMATS("track %u size %u cell %u\n", track, track_size, c1541_cell_size[speed_zone]);
@@ -136,7 +136,7 @@ bool g64_format::save(io_generic *io, floppy_image *image)
io_generic_write(io, speed_offset, spos, 4);
io_generic_write_filler(io, 0xff, dpos, TRACK_LENGTH);
io_generic_write(io, track_length, dpos, 2);
- io_generic_write(io, trackbuf, dpos + 2, track_size);
+ io_generic_write(io, &trackbuf[0], dpos + 2, track_size);
tracks_written++;
}
diff --git a/src/lib/formats/hxcmfm_dsk.c b/src/lib/formats/hxcmfm_dsk.c
index 0203f8f7e26..fe25f9158c9 100644
--- a/src/lib/formats/hxcmfm_dsk.c
+++ b/src/lib/formats/hxcmfm_dsk.c
@@ -85,9 +85,9 @@ bool mfm_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
trackbuf.resize(trackdesc.mfmtracksize);
// actual data read
- io_generic_read(io, trackbuf, trackdesc.mfmtrackoffset, trackdesc.mfmtracksize);
+ io_generic_read(io, &trackbuf[0], trackdesc.mfmtrackoffset, trackdesc.mfmtracksize);
- generate_track_from_bitstream(track, side, trackbuf, trackdesc.mfmtracksize*8, image);
+ generate_track_from_bitstream(track, side, &trackbuf[0], trackdesc.mfmtracksize*8, image);
counter++;
}
diff --git a/src/lib/formats/imd_dsk.c b/src/lib/formats/imd_dsk.c
index 78f073fef1d..463b5b771d2 100644
--- a/src/lib/formats/imd_dsk.c
+++ b/src/lib/formats/imd_dsk.c
@@ -336,7 +336,7 @@ bool imd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
{
UINT64 size = io_generic_size(io);
dynamic_buffer img(size);
- io_generic_read(io, img, 0, size);
+ io_generic_read(io, &img[0], 0, size);
UINT64 pos;
for(pos=0; pos < size && img[pos] != 0x1a; pos++);
@@ -363,12 +363,12 @@ bool imd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
int rpm = form_factor == floppy_image::FF_8 || (form_factor == floppy_image::FF_525 && rate >= 300000) ? 360 : 300;
int cell_count = (fm ? 1 : 2)*rate*60/rpm;
- const UINT8 *snum = img+pos;
+ const UINT8 *snum = &img[pos];
pos += sector_count;
- const UINT8 *tnum = head & 0x80 ? img+pos : NULL;
+ const UINT8 *tnum = head & 0x80 ? &img[pos] : NULL;
if(tnum)
pos += sector_count;
- const UINT8 *hnum = head & 0x40 ? img+pos : NULL;
+ const UINT8 *hnum = head & 0x40 ? &img[pos] : NULL;
if(hnum)
pos += sector_count;
@@ -398,7 +398,7 @@ bool imd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
memset(sects[i].data, img[pos++], actual_size);
} else {
- sects[i].data = img + pos;
+ sects[i].data = &img[pos];
pos += actual_size;
}
}
@@ -410,7 +410,7 @@ bool imd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
build_pc_track_mfm(track, head, image, cell_count, sector_count, sects, gap_3);
for(int i=0; i<sector_count; i++)
- if(sects[i].data && (sects[i].data < img || sects[i].data >= img+size))
+ if(sects[i].data && (sects[i].data < &img[0] || sects[i].data >= &img[size]))
global_free_array(sects[i].data);
}
diff --git a/src/lib/formats/ipf_dsk.c b/src/lib/formats/ipf_dsk.c
index 3cbd46dcb5a..edaea40181f 100644
--- a/src/lib/formats/ipf_dsk.c
+++ b/src/lib/formats/ipf_dsk.c
@@ -43,8 +43,8 @@ bool ipf_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
{
UINT64 size = io_generic_size(io);
dynamic_buffer data(size);
- io_generic_read(io, data, 0, size);
- bool res = parse(data, size, image);
+ io_generic_read(io, &data[0], 0, size);
+ bool res = parse(data, image);
return res;
}
@@ -77,12 +77,12 @@ UINT32 ipf_format::crc32r(const UINT8 *data, UINT32 size)
return ~crc;
}
-bool ipf_format::parse(UINT8 *data, UINT32 size, floppy_image *image)
+bool ipf_format::parse(dynamic_buffer &data, floppy_image *image)
{
image->set_variant(floppy_image::DSDD); // Not handling anything else yet
tcount = 84*2+1; // Usual max
tinfos = global_alloc_array_clear(track_info, tcount);
- bool res = scan_all_tags(data, size);
+ bool res = scan_all_tags(data);
if(res)
res = generate_tracks(image);
global_free_array(tinfos);
@@ -179,13 +179,13 @@ bool ipf_format::parse_data(const UINT8 *data, UINT32 &pos, UINT32 max_extra_siz
return true;
}
-bool ipf_format::scan_one_tag(UINT8 *data, UINT32 size, UINT32 &pos, UINT8 *&tag, UINT32 &tsize)
+bool ipf_format::scan_one_tag(dynamic_buffer &data, UINT32 &pos, UINT8 *&tag, UINT32 &tsize)
{
- if(size-pos < 12)
+ if(data.size()-pos < 12)
return false;
- tag = data+pos;
+ tag = &data[pos];
tsize = r32(tag+4);
- if(size-pos < tsize)
+ if(data.size()-pos < tsize)
return false;
UINT32 crc = r32(tag+8);
tag[8] = tag[9] = tag[10] = tag[11] = 0;
@@ -195,14 +195,15 @@ bool ipf_format::scan_one_tag(UINT8 *data, UINT32 size, UINT32 &pos, UINT8 *&tag
return true;
}
-bool ipf_format::scan_all_tags(UINT8 *data, UINT32 size)
+bool ipf_format::scan_all_tags(dynamic_buffer &data)
{
UINT32 pos = 0;
+ UINT32 size = data.size();
while(pos != size) {
UINT8 *tag;
UINT32 tsize;
- if(!scan_one_tag(data, size, pos, tag, tsize))
+ if(!scan_one_tag(data, pos, tag, tsize))
return false;
switch(r32(tag)) {
@@ -253,7 +254,7 @@ bool ipf_format::generate_tracks(floppy_image *image)
return true;
}
-void ipf_format::rotate(UINT32 *track, UINT32 offset, UINT32 size)
+void ipf_format::rotate(std::vector<UINT32> &track, UINT32 offset, UINT32 size)
{
UINT32 done = 0;
for(UINT32 bpos=0; done < size; bpos++) {
@@ -274,7 +275,7 @@ void ipf_format::rotate(UINT32 *track, UINT32 offset, UINT32 size)
}
}
-void ipf_format::mark_track_splice(UINT32 *track, UINT32 offset, UINT32 size)
+void ipf_format::mark_track_splice(std::vector<UINT32> &track, UINT32 offset, UINT32 size)
{
for(int i=0; i<3; i++) {
UINT32 pos = (offset + i) % size;
@@ -287,13 +288,13 @@ void ipf_format::mark_track_splice(UINT32 *track, UINT32 offset, UINT32 size)
}
}
-void ipf_format::timing_set(UINT32 *track, UINT32 start, UINT32 end, UINT32 time)
+void ipf_format::timing_set(std::vector<UINT32> &track, UINT32 start, UINT32 end, UINT32 time)
{
for(UINT32 i=start; i != end; i++)
track[i] = (track[i] & floppy_image::MG_MASK) | time;
}
-bool ipf_format::generate_timings(track_info *t, UINT32 *track, const UINT32 *data_pos, const UINT32 *gap_pos)
+bool ipf_format::generate_timings(track_info *t, std::vector<UINT32> &track, const std::vector<UINT32> &data_pos, const std::vector<UINT32> &gap_pos)
{
timing_set(track, 0, t->size_cells, 2000);
@@ -387,10 +388,10 @@ bool ipf_format::generate_track(track_info *t, floppy_image *image)
if(t->index_cells >= t->size_cells)
return false;
- dynamic_array<UINT32> track(t->size_cells);
- dynamic_array<UINT32> data_pos(t->block_count+1);
- dynamic_array<UINT32> gap_pos(t->block_count);
- dynamic_array<UINT32> splice_pos(t->block_count);
+ std::vector<UINT32> track(t->size_cells);
+ std::vector<UINT32> data_pos(t->block_count+1);
+ std::vector<UINT32> gap_pos(t->block_count);
+ std::vector<UINT32> splice_pos(t->block_count);
bool context = false;
UINT32 pos = 0;
@@ -414,40 +415,40 @@ bool ipf_format::generate_track(track_info *t, floppy_image *image)
if(t->index_cells)
rotate(track, t->size_cells - t->index_cells, t->size_cells);
- generate_track_from_levels(t->cylinder, t->head, track, t->size_cells, splice_pos[t->block_count-1] + t->index_cells, image);
+ generate_track_from_levels(t->cylinder, t->head, track, splice_pos[t->block_count-1] + t->index_cells, image);
return true;
}
-void ipf_format::track_write_raw(UINT32 *&track, const UINT8 *data, UINT32 cells, bool &context)
+void ipf_format::track_write_raw(std::vector<UINT32>::iterator &tpos, const UINT8 *data, UINT32 cells, bool &context)
{
for(UINT32 i=0; i != cells; i++)
- *track++ = data[i>>3] & (0x80 >> (i & 7)) ? MG_1 : MG_0;
+ *tpos++ = data[i>>3] & (0x80 >> (i & 7)) ? MG_1 : MG_0;
if(cells)
- context = track[-1] == MG_1;
+ context = tpos[-1] == MG_1;
}
-void ipf_format::track_write_mfm(UINT32 *&track, const UINT8 *data, UINT32 start_offset, UINT32 patlen, UINT32 cells, bool &context)
+void ipf_format::track_write_mfm(std::vector<UINT32>::iterator &tpos, const UINT8 *data, UINT32 start_offset, UINT32 patlen, UINT32 cells, bool &context)
{
patlen *= 2;
for(UINT32 i=0; i != cells; i++) {
UINT32 pos = (i + start_offset) % patlen;
bool bit = data[pos>>4] & (0x80 >> ((pos >> 1) & 7));
if(pos & 1) {
- *track++ = bit ? MG_1 : MG_0;
+ *tpos++ = bit ? MG_1 : MG_0;
context = bit;
} else
- *track++ = context || bit ? MG_0 : MG_1;
+ *tpos++ = context || bit ? MG_0 : MG_1;
}
}
-void ipf_format::track_write_weak(UINT32 *&track, UINT32 cells)
+void ipf_format::track_write_weak(std::vector<UINT32>::iterator &tpos, UINT32 cells)
{
for(UINT32 i=0; i != cells; i++)
- *track++ = floppy_image::MG_N;
+ *tpos++ = floppy_image::MG_N;
}
-bool ipf_format::generate_block_data(const UINT8 *data, const UINT8 *dlimit, UINT32 *track, UINT32 *tlimit, bool &context)
+bool ipf_format::generate_block_data(const UINT8 *data, const UINT8 *dlimit, std::vector<UINT32>::iterator tpos, std::vector<UINT32>::iterator tlimit, bool &context)
{
for(;;) {
if(data >= dlimit)
@@ -456,7 +457,7 @@ bool ipf_format::generate_block_data(const UINT8 *data, const UINT8 *dlimit, UIN
if((val >> 5) > dlimit-data)
return false;
UINT32 param = rb(data, val >> 5);
- UINT32 tleft = tlimit - track;
+ UINT32 tleft = tlimit - tpos;
switch(val & 0x1f) {
case 0: // End of description
return !tleft;
@@ -464,7 +465,7 @@ bool ipf_format::generate_block_data(const UINT8 *data, const UINT8 *dlimit, UIN
case 1: // Raw bytes
if(8*param > tleft)
return false;
- track_write_raw(track, data, 8*param, context);
+ track_write_raw(tpos, data, 8*param, context);
data += param;
break;
@@ -472,14 +473,14 @@ bool ipf_format::generate_block_data(const UINT8 *data, const UINT8 *dlimit, UIN
case 3: // MFM-decoded gap bytes
if(16*param > tleft)
return false;
- track_write_mfm(track, data, 0, 8*param, 16*param, context);
+ track_write_mfm(tpos, data, 0, 8*param, 16*param, context);
data += param;
break;
case 5: // Weak bytes
if(16*param > tleft)
return false;
- track_write_weak(track, 16*param);
+ track_write_weak(tpos, 16*param);
context = 0;
break;
@@ -489,16 +490,16 @@ bool ipf_format::generate_block_data(const UINT8 *data, const UINT8 *dlimit, UIN
}
}
-bool ipf_format::generate_block_gap_0(UINT32 gap_cells, UINT8 pattern, UINT32 &spos, UINT32 ipos, UINT32 *track, bool &context)
+bool ipf_format::generate_block_gap_0(UINT32 gap_cells, UINT8 pattern, UINT32 &spos, UINT32 ipos, std::vector<UINT32>::iterator &tpos, bool &context)
{
spos = ipos >= 16 && ipos+16 <= gap_cells ? ipos : gap_cells >> 1;
- track_write_mfm(track, &pattern, 0, 8, spos, context);
+ track_write_mfm(tpos, &pattern, 0, 8, spos, context);
UINT32 delta = 0;
if(gap_cells & 1) {
- *track++ = MG_0;
+ *tpos++ = MG_0;
delta++;
}
- track_write_mfm(track, &pattern, spos+delta-gap_cells, 8, gap_cells-spos-delta, context);
+ track_write_mfm(tpos, &pattern, spos+delta-gap_cells, 8, gap_cells-spos-delta, context);
return true;
}
@@ -527,7 +528,7 @@ bool ipf_format::gap_description_to_reserved_size(const UINT8 *&data, const UINT
}
}
-bool ipf_format::generate_gap_from_description(const UINT8 *&data, const UINT8 *dlimit, UINT32 *track, UINT32 size, bool pre, bool &context)
+bool ipf_format::generate_gap_from_description(const UINT8 *&data, const UINT8 *dlimit, std::vector<UINT32>::iterator tpos, UINT32 size, bool pre, bool &context)
{
const UINT8 *data1 = data;
UINT32 res_size;
@@ -577,7 +578,7 @@ bool ipf_format::generate_gap_from_description(const UINT8 *&data, const UINT8 *
if(pos + block_size > size)
return false;
// printf("pat=%02x size=%d pre\n", pattern[0], block_size);
- track_write_mfm(track, pattern, 0, pattern_size, block_size, context);
+ track_write_mfm(tpos, pattern, 0, pattern_size, block_size, context);
pos += block_size;
} else {
if(pos == 0 && block_size && res_size != size)
@@ -587,7 +588,7 @@ bool ipf_format::generate_gap_from_description(const UINT8 *&data, const UINT8 *
if(pos + block_size > size)
return false;
// printf("pat=%02x block_size=%d size=%d res_size=%d post\n", pattern[0], block_size, size, res_size);
- track_write_mfm(track, pattern, -block_size, pattern_size, block_size, context);
+ track_write_mfm(tpos, pattern, -block_size, pattern_size, block_size, context);
pos += block_size;
}
block_size = 0;
@@ -597,25 +598,25 @@ bool ipf_format::generate_gap_from_description(const UINT8 *&data, const UINT8 *
}
-bool ipf_format::generate_block_gap_1(UINT32 gap_cells, UINT32 &spos, UINT32 ipos, const UINT8 *data, const UINT8 *dlimit, UINT32 *track, bool &context)
+bool ipf_format::generate_block_gap_1(UINT32 gap_cells, UINT32 &spos, UINT32 ipos, const UINT8 *data, const UINT8 *dlimit, std::vector<UINT32>::iterator &tpos, bool &context)
{
if(ipos >= 16 && ipos < gap_cells-16)
spos = ipos;
else
spos = 0;
- return generate_gap_from_description(data, dlimit, track, gap_cells, true, context);
+ return generate_gap_from_description(data, dlimit, tpos, gap_cells, true, context);
}
-bool ipf_format::generate_block_gap_2(UINT32 gap_cells, UINT32 &spos, UINT32 ipos, const UINT8 *data, const UINT8 *dlimit, UINT32 *track, bool &context)
+bool ipf_format::generate_block_gap_2(UINT32 gap_cells, UINT32 &spos, UINT32 ipos, const UINT8 *data, const UINT8 *dlimit, std::vector<UINT32>::iterator &tpos, bool &context)
{
if(ipos >= 16 && ipos < gap_cells-16)
spos = ipos;
else
spos = gap_cells;
- return generate_gap_from_description(data, dlimit, track, gap_cells, false, context);
+ return generate_gap_from_description(data, dlimit, tpos, gap_cells, false, context);
}
-bool ipf_format::generate_block_gap_3(UINT32 gap_cells, UINT32 &spos, UINT32 ipos, const UINT8 *data, const UINT8 *dlimit, UINT32 *track, bool &context)
+bool ipf_format::generate_block_gap_3(UINT32 gap_cells, UINT32 &spos, UINT32 ipos, const UINT8 *data, const UINT8 *dlimit, std::vector<UINT32>::iterator &tpos, bool &context)
{
if(ipos >= 16 && ipos < gap_cells-16)
spos = ipos;
@@ -631,34 +632,34 @@ bool ipf_format::generate_block_gap_3(UINT32 gap_cells, UINT32 &spos, UINT32 ipo
spos = presize + (gap_cells - presize - postsize)/2;
}
- if(!generate_gap_from_description(data, dlimit, track, spos, true, context))
+ if(!generate_gap_from_description(data, dlimit, tpos, spos, true, context))
return false;
UINT32 delta = 0;
if(gap_cells & 1) {
- track[spos] = MG_0;
+ tpos[spos] = MG_0;
delta++;
}
- return generate_gap_from_description(data, dlimit, track+spos+delta, gap_cells - spos - delta, false, context);
+ return generate_gap_from_description(data, dlimit, tpos+spos+delta, gap_cells - spos - delta, false, context);
}
-bool ipf_format::generate_block_gap(UINT32 gap_type, UINT32 gap_cells, UINT8 pattern, UINT32 &spos, UINT32 ipos, const UINT8 *data, const UINT8 *dlimit, UINT32 *track, bool &context)
+bool ipf_format::generate_block_gap(UINT32 gap_type, UINT32 gap_cells, UINT8 pattern, UINT32 &spos, UINT32 ipos, const UINT8 *data, const UINT8 *dlimit, std::vector<UINT32>::iterator tpos, bool &context)
{
switch(gap_type) {
case 0:
- return generate_block_gap_0(gap_cells, pattern, spos, ipos, track, context);
+ return generate_block_gap_0(gap_cells, pattern, spos, ipos, tpos, context);
case 1:
- return generate_block_gap_1(gap_cells, spos, ipos, data, dlimit, track, context);
+ return generate_block_gap_1(gap_cells, spos, ipos, data, dlimit, tpos, context);
case 2:
- return generate_block_gap_2(gap_cells, spos, ipos, data, dlimit, track, context);
+ return generate_block_gap_2(gap_cells, spos, ipos, data, dlimit, tpos, context);
case 3:
- return generate_block_gap_3(gap_cells, spos, ipos, data, dlimit, track, context);
+ return generate_block_gap_3(gap_cells, spos, ipos, data, dlimit, tpos, context);
default:
return false;
}
}
-bool ipf_format::generate_block(track_info *t, UINT32 idx, UINT32 ipos, UINT32 *track, UINT32 &pos, UINT32 &dpos, UINT32 &gpos, UINT32 &spos, bool &context)
+bool ipf_format::generate_block(track_info *t, UINT32 idx, UINT32 ipos, std::vector<UINT32> &track, UINT32 &pos, UINT32 &dpos, UINT32 &gpos, UINT32 &spos, bool &context)
{
const UINT8 *data = t->data;
const UINT8 *data_end = t->data + t->data_size;
@@ -681,9 +682,9 @@ bool ipf_format::generate_block(track_info *t, UINT32 idx, UINT32 ipos, UINT32 *
pos = gpos + gap_cells;
if(pos > t->size_cells)
return false;
- if(!generate_block_data(data + r32(thead+28), data_end, track+dpos, track+gpos, context))
+ if(!generate_block_data(data + r32(thead+28), data_end, track.begin()+dpos, track.begin()+gpos, context))
return false;
- if(!generate_block_gap(r32(thead+20), gap_cells, r32(thead+24), spos, ipos > gpos ? ipos-gpos : 0, data + r32(thead+8), data_end, track+gpos, context))
+ if(!generate_block_gap(r32(thead+20), gap_cells, r32(thead+24), spos, ipos > gpos ? ipos-gpos : 0, data + r32(thead+8), data_end, track.begin()+gpos, context))
return false;
spos += gpos;
diff --git a/src/lib/formats/ipf_dsk.h b/src/lib/formats/ipf_dsk.h
index be7756967b3..172478ef038 100644
--- a/src/lib/formats/ipf_dsk.h
+++ b/src/lib/formats/ipf_dsk.h
@@ -48,38 +48,38 @@ private:
bool parse_imge(const UINT8 *imge);
bool parse_data(const UINT8 *data, UINT32 &pos, UINT32 max_extra_size);
- bool scan_one_tag(UINT8 *data, UINT32 size, UINT32 &pos, UINT8 *&tag, UINT32 &tsize);
- bool scan_all_tags(UINT8 *data, UINT32 size);
+ bool scan_one_tag(dynamic_buffer &data, UINT32 &pos, UINT8 *&tag, UINT32 &tsize);
+ bool scan_all_tags(dynamic_buffer &data);
static UINT32 r32(const UINT8 *p);
static UINT32 rb(const UINT8 *&p, int count);
track_info *get_index(UINT32 idx);
- void track_write_raw(UINT32 *&track, const UINT8 *data, UINT32 cells, bool &context);
- void track_write_mfm(UINT32 *&track, const UINT8 *data, UINT32 start_offset, UINT32 patlen, UINT32 cells, bool &context);
- void track_write_weak(UINT32 *&track, UINT32 cells);
- bool generate_block_data(const UINT8 *data, const UINT8 *dlimit, UINT32 *track, UINT32 *tlimit, bool &context);
+ void track_write_raw(std::vector<UINT32>::iterator &tpos, const UINT8 *data, UINT32 cells, bool &context);
+ void track_write_mfm(std::vector<UINT32>::iterator &tpos, const UINT8 *data, UINT32 start_offset, UINT32 patlen, UINT32 cells, bool &context);
+ void track_write_weak(std::vector<UINT32>::iterator &tpos, UINT32 cells);
+ bool generate_block_data(const UINT8 *data, const UINT8 *dlimit, std::vector<UINT32>::iterator tpos, std::vector<UINT32>::iterator tlimit, bool &context);
bool gap_description_to_reserved_size(const UINT8 *&data, const UINT8 *dlimit, UINT32 &res_size);
- bool generate_gap_from_description(const UINT8 *&data, const UINT8 *dlimit, UINT32 *track, UINT32 size, bool pre, bool &context);
- bool generate_block_gap_0(UINT32 gap_cells, UINT8 pattern, UINT32 &spos, UINT32 ipos, UINT32 *track, bool &context);
- bool generate_block_gap_1(UINT32 gap_cells, UINT32 &spos, UINT32 ipos, const UINT8 *data, const UINT8 *dlimit, UINT32 *track, bool &context);
- bool generate_block_gap_2(UINT32 gap_cells, UINT32 &spos, UINT32 ipos, const UINT8 *data, const UINT8 *dlimit, UINT32 *track, bool &context);
- bool generate_block_gap_3(UINT32 gap_cells, UINT32 &spos, UINT32 ipos, const UINT8 *data, const UINT8 *dlimit, UINT32 *track, bool &context);
- bool generate_block_gap(UINT32 gap_type, UINT32 gap_cells, UINT8 pattern, UINT32 &spos, UINT32 ipos, const UINT8 *data, const UINT8 *dlimit, UINT32 *track, bool &context);
-
- bool generate_block(track_info *t, UINT32 idx, UINT32 ipos, UINT32 *track, UINT32 &pos, UINT32 &dpos, UINT32 &gpos, UINT32 &spos, bool &context);
+ bool generate_gap_from_description(const UINT8 *&data, const UINT8 *dlimit, std::vector<UINT32>::iterator tpos, UINT32 size, bool pre, bool &context);
+ bool generate_block_gap_0(UINT32 gap_cells, UINT8 pattern, UINT32 &spos, UINT32 ipos, std::vector<UINT32>::iterator &tpos, bool &context);
+ bool generate_block_gap_1(UINT32 gap_cells, UINT32 &spos, UINT32 ipos, const UINT8 *data, const UINT8 *dlimit, std::vector<UINT32>::iterator &tpos, bool &context);
+ bool generate_block_gap_2(UINT32 gap_cells, UINT32 &spos, UINT32 ipos, const UINT8 *data, const UINT8 *dlimit, std::vector<UINT32>::iterator &tpos, bool &context);
+ bool generate_block_gap_3(UINT32 gap_cells, UINT32 &spos, UINT32 ipos, const UINT8 *data, const UINT8 *dlimit, std::vector<UINT32>::iterator &tpos, bool &context);
+ bool generate_block_gap(UINT32 gap_type, UINT32 gap_cells, UINT8 pattern, UINT32 &spos, UINT32 ipos, const UINT8 *data, const UINT8 *dlimit, std::vector<UINT32>::iterator tpos, bool &context);
+
+ bool generate_block(track_info *t, UINT32 idx, UINT32 ipos, std::vector<UINT32> &track, UINT32 &pos, UINT32 &dpos, UINT32 &gpos, UINT32 &spos, bool &context);
UINT32 block_compute_real_size(track_info *t);
- void timing_set(UINT32 *track, UINT32 start, UINT32 end, UINT32 time);
- bool generate_timings(track_info *t, UINT32 *track, const UINT32 *data_pos, const UINT32 *gap_pos);
+ void timing_set(std::vector<UINT32> &track, UINT32 start, UINT32 end, UINT32 time);
+ bool generate_timings(track_info *t, std::vector<UINT32> &track, const std::vector<UINT32> &data_pos, const std::vector<UINT32> &gap_pos);
- void rotate(UINT32 *track, UINT32 offset, UINT32 size);
- void mark_track_splice(UINT32 *track, UINT32 offset, UINT32 size);
+ void rotate(std::vector<UINT32> &track, UINT32 offset, UINT32 size);
+ void mark_track_splice(std::vector<UINT32> &track, UINT32 offset, UINT32 size);
bool generate_track(track_info *t, floppy_image *image);
bool generate_tracks(floppy_image *image);
- bool parse(UINT8 *data, UINT32 size, floppy_image *image);
+ bool parse(dynamic_buffer &data, floppy_image *image);
};
extern const floppy_format_type FLOPPY_IPF_FORMAT;
diff --git a/src/lib/formats/kc_cas.c b/src/lib/formats/kc_cas.c
index 7791afd2e7a..32d7901cad5 100644
--- a/src/lib/formats/kc_cas.c
+++ b/src/lib/formats/kc_cas.c
@@ -215,14 +215,14 @@ static int kc_handle_sss(INT16 *buffer, const UINT8 *casdata)
dynamic_buffer sss(kc_image_size + 11);
// tries to generate the missing head
- memset(sss + 0, 0xd3, 3);
- memset(sss + 3, 0x20, 8);
- memcpy(sss + 11, casdata, kc_image_size);
+ memset(&sss[0], 0xd3, 3);
+ memset(&sss[3], 0x20, 8);
+ memcpy(&sss[11], casdata, kc_image_size);
// set an arbitrary filename
sss[3] = 'A';
- int retval = kc_handle_cass(buffer, sss, KC_IMAGE_KCC);
+ int retval = kc_handle_cass(buffer, &sss[0], KC_IMAGE_KCC);
return retval;
}
diff --git a/src/lib/formats/mfi_dsk.c b/src/lib/formats/mfi_dsk.c
index 2bd4b326501..043d61b0d3d 100644
--- a/src/lib/formats/mfi_dsk.c
+++ b/src/lib/formats/mfi_dsk.c
@@ -128,21 +128,21 @@ bool mfi_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
if(ent->uncompressed_size == 0) {
// Unformatted track
- image->set_track_size(cyl >> 2, head, 0, cyl & 3);
+ image->get_buffer(cyl >> 2, head, cyl & 3).clear();
ent++;
continue;
}
compressed.resize(ent->compressed_size);
- io_generic_read(io, compressed, ent->offset, ent->compressed_size);
+ io_generic_read(io, &compressed[0], ent->offset, ent->compressed_size);
unsigned int cell_count = ent->uncompressed_size/4;
- image->set_track_size(cyl >> 2, head, cell_count, cyl & 3);
- UINT32 *trackbuf = image->get_buffer(cyl >> 2, head, cyl & 3);
+ std::vector<UINT32> &trackbuf = image->get_buffer(cyl >> 2, head, cyl & 3);;
+ trackbuf.resize(cell_count);
uLongf size = ent->uncompressed_size;
- if(uncompress((Bytef *)trackbuf, &size, compressed, ent->compressed_size) != Z_OK)
+ if(uncompress((Bytef *)&trackbuf[0], &size, &compressed[0], ent->compressed_size) != Z_OK)
return false;
UINT32 cur_time = 0;
@@ -168,7 +168,7 @@ bool mfi_format::save(io_generic *io, floppy_image *image)
int max_track_size = 0;
for(int track=0; track <= (tracks-1) << 2; track += 4 >> resolution)
for(int head=0; head<heads; head++) {
- int tsize = image->get_track_size(track >> 2, head, track & 3);
+ int tsize = image->get_buffer(track >> 2, head, track & 3).size();
if(tsize > max_track_size)
max_track_size = tsize;
}
@@ -192,13 +192,14 @@ bool mfi_format::save(io_generic *io, floppy_image *image)
for(int track=0; track <= (tracks-1) << 2; track += 4 >> resolution)
for(int head=0; head<heads; head++) {
- int tsize = image->get_track_size(track >> 2, head, track & 3);
+ std::vector<UINT32> &buffer = image->get_buffer(track >> 2, head, track & 3);
+ int tsize = buffer.size();
if(!tsize) {
epos++;
continue;
}
- memcpy(precomp, image->get_buffer(track >> 2, head, track & 3), tsize*4);
+ memcpy(precomp, &buffer[0], tsize*4);
for(int j=0; j<tsize-1; j++)
precomp[j] = (precomp[j] & floppy_image::MG_MASK) |
((precomp[j+1] & floppy_image::TIME_MASK) -
diff --git a/src/lib/formats/oric_dsk.c b/src/lib/formats/oric_dsk.c
index 340fb507c2d..5d3071e77c1 100644
--- a/src/lib/formats/oric_dsk.c
+++ b/src/lib/formats/oric_dsk.c
@@ -58,7 +58,6 @@ bool oric_dsk_format::load(io_generic *io, UINT32 form_factor, floppy_image *ima
{
UINT8 h[256];
UINT8 t[6250+3];
- UINT32 stream[100000];
t[6250] = t[6251] = t[6252] = 0;
io_generic_read(io, h, 0, 256);
@@ -69,38 +68,36 @@ bool oric_dsk_format::load(io_generic *io, UINT32 form_factor, floppy_image *ima
for(int side=0; side<sides; side++)
for(int track=0; track<tracks; track++) {
io_generic_read(io, t, 256+6400*(tracks*side + track), 6250);
- int pos = 0;
+ std::vector<UINT32> stream;
int sector_size = 128;
for(int i=0; i<6250; i++) {
if(t[i] == 0xc2 && t[i+1] == 0xc2 && t[i+2] == 0xc2) {
- raw_w(stream, pos, 16, 0x5224);
- raw_w(stream, pos, 16, 0x5224);
- raw_w(stream, pos, 16, 0x5224);
+ raw_w(stream, 16, 0x5224);
+ raw_w(stream, 16, 0x5224);
+ raw_w(stream, 16, 0x5224);
i += 2;
continue;
}
if(t[i] == 0xa1 && t[i+1] == 0xa1 && t[i+2] == 0xa1) {
- raw_w(stream, pos, 16, 0x4489);
- raw_w(stream, pos, 16, 0x4489);
- raw_w(stream, pos, 16, 0x4489);
+ raw_w(stream, 16, 0x4489);
+ raw_w(stream, 16, 0x4489);
+ raw_w(stream, 16, 0x4489);
int copy;
if(t[i+3] == 0xfe) {
copy = 7;
sector_size = 128 << (t[i+7] & 3);
- logerror("%02x %x - %02x %02x %02x %02x\n",
- track, side, t[i+4], t[i+5], t[i+6], t[i+7]);
} else if(t[i+3] == 0xfb)
copy = sector_size+3;
else
copy = 0;
for(int j=0; j<copy; j++)
- mfm_w(stream, pos, 8, t[i+3+j]);
+ mfm_w(stream, 8, t[i+3+j]);
i += 2+copy;
continue;
}
- mfm_w(stream, pos, 8, t[i]);
+ mfm_w(stream, 8, t[i]);
}
- generate_track_from_levels(track, side, stream, 100000, 0, image);
+ generate_track_from_levels(track, side, stream, 0, image);
}
return true;
diff --git a/src/lib/formats/pasti_dsk.c b/src/lib/formats/pasti_dsk.c
index c39954490b8..9329600b1fd 100644
--- a/src/lib/formats/pasti_dsk.c
+++ b/src/lib/formats/pasti_dsk.c
@@ -86,10 +86,10 @@ bool pasti_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
raw_track.resize(entry_len-16);
- io_generic_read(io, raw_track, pos+16, entry_len-16);
+ io_generic_read(io, &raw_track[0], pos+16, entry_len-16);
- UINT8 *fuzz = fuzz_len ? raw_track+16*sect : 0;
- UINT8 *bdata = fuzz ? fuzz+fuzz_len : raw_track+16*sect;
+ UINT8 *fuzz = fuzz_len ? &raw_track[16*sect] : 0;
+ UINT8 *bdata = fuzz ? fuzz+fuzz_len : &raw_track[16*sect];
UINT8 *tdata = bdata;
int syncpos = -1;
@@ -109,7 +109,7 @@ bool pasti_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
printf("Track %2d.%d: el=%d fl=%d sect=%d flags=%04x tlen=%d/%d tnum=%d flags2=%02x sync=%x\n",
track, head,
entry_len, fuzz_len, sect, flags, track_len, tsize, track_num, flags2, syncpos);
- hexdump(raw_track+16*sect, entry_len-16-16*sect);
+ hexdump(&raw_track[16*sect], entry_len-16-16*sect);
}
if(0 && tdata) {
@@ -124,7 +124,7 @@ bool pasti_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
}
for(int s=0; s<sect; s++) {
- UINT8 *sh = raw_track+16*s;
+ UINT8 *sh = &raw_track[16*s];
int s_off = sh[0] | (sh[1] << 8) | (sh[2] << 16) | (sh[3] << 24);
int s_pos = sh[4] | (sh[5] << 8);
int s_time = sh[6] | (sh[7] << 8);
@@ -168,7 +168,7 @@ void pasti_format::wd_generate_track_from_observations(int track, int head, flop
wd_generate_track_from_sectors_and_track(track, head, image, obs);
}
-void pasti_format::wd_generate_unsynced_gap(UINT32 *track, int &pos, const wd_obs &obs, int tstart, int tend, UINT32 cell_size)
+void pasti_format::wd_generate_unsynced_gap(std::vector<UINT32> &track, const wd_obs &obs, int tstart, int tend, UINT32 cell_size)
{
for(int i=tstart; i != tend;) {
unsigned char v = obs.track_data[i];
@@ -176,7 +176,7 @@ void pasti_format::wd_generate_unsynced_gap(UINT32 *track, int &pos, const wd_ob
for(j=i+1; j != tend && obs.track_data[j] == v; j++);
int size = j-i;
if(size < 4) {
- mfm_w(track, pos, 8, v, cell_size);
+ mfm_w(track, 8, v, cell_size);
i++;
continue;
}
@@ -189,32 +189,32 @@ void pasti_format::wd_generate_unsynced_gap(UINT32 *track, int &pos, const wd_ob
if((v == 0 || v == 0x4e) && j != tend)
size++;
for(j=0; j != size; j++)
- mfm_w(track, pos, 8, v, cell_size);
+ mfm_w(track, 8, v, cell_size);
i += size;
}
}
-void pasti_format::wd_generate_synced_gap(UINT32 *track, int &pos, const wd_obs &obs, int tstart, int tend, UINT32 cell_size)
+void pasti_format::wd_generate_synced_gap(std::vector<UINT32> &track, const wd_obs &obs, int tstart, int tend, UINT32 cell_size)
{
for(int i = tstart; i != tend; i++) {
unsigned char v = obs.track_data[i];
if((v == 0x14 || v == 0xa1 || v == 0xc2) && i+2 < tend && obs.track_data[i+1] == 0xa1 && obs.track_data[i+2] == 0xa1) {
- raw_w(track, pos, 16, 0x4489, cell_size);
- raw_w(track, pos, 16, 0x4489, cell_size);
- raw_w(track, pos, 16, 0x4489, cell_size);
+ raw_w(track, 16, 0x4489, cell_size);
+ raw_w(track, 16, 0x4489, cell_size);
+ raw_w(track, 16, 0x4489, cell_size);
i += 2;
- } else if(pos && i != tend-1 && (((v == 0x14 || v == 0xc2) && (track[pos-1] & 0x1f) == 10) || (v == 0xa1 && (track[pos-1] & 0x1f) != 10)))
- raw_w(track, pos, 16, 0x4489, cell_size);
+ } else if(!track.empty() && i != tend-1 && (((v == 0x14 || v == 0xc2) && (track.back() & 0x1f) == 10) || (v == 0xa1 && (track.back() & 0x1f) != 10)))
+ raw_w(track, 16, 0x4489, cell_size);
else if(i != tend-1 && (v == 0x14 || v == 0xc2))
- raw_w(track, pos, 16, 0x5224, cell_size);
+ raw_w(track, 16, 0x5224, cell_size);
else
- mfm_w(track, pos, 8, v, cell_size);
+ mfm_w(track, 8, v, cell_size);
}
}
-void pasti_format::wd_generate_gap(UINT32 *track, int &pos, const wd_obs &obs, int tstart, int tend, bool synced, UINT32 cell_size_start, UINT32 cell_size_end)
+void pasti_format::wd_generate_gap(std::vector<UINT32> &track, const wd_obs &obs, int tstart, int tend, bool synced, UINT32 cell_size_start, UINT32 cell_size_end)
{
- int spos = pos;
+ unsigned int spos = track.size();
if(!synced) {
int sync = -1;
for(int i = tstart; sync == -1 && i != tend; i++)
@@ -222,18 +222,18 @@ void pasti_format::wd_generate_gap(UINT32 *track, int &pos, const wd_obs &obs, i
sync = i;
if(sync == -1)
sync = tend;
- wd_generate_unsynced_gap(track, pos, obs, tstart, sync, cell_size_start);
+ wd_generate_unsynced_gap(track, obs, tstart, sync, cell_size_start);
tstart = sync;
}
if(tstart != tend)
- wd_generate_synced_gap(track, pos, obs, tstart, tend, cell_size_start);
+ wd_generate_synced_gap(track, obs, tstart, tend, cell_size_start);
if(cell_size_end != cell_size_start) {
INT32 total_size = 0;
- for(int i=spos; i != pos; i++)
+ for(unsigned int i=spos; i != track.size(); i++)
total_size += track[i] & floppy_image::TIME_MASK;
INT64 cur_size = 0;
- for(int i=spos; i != pos; i++) {
+ for(unsigned int i=spos; i != track.size(); i++) {
cur_size += track[i] & floppy_image::TIME_MASK;
track[i] = (track[i] & floppy_image::MG_MASK) |
(cur_size*int(cell_size_end-cell_size_start)/total_size + cell_size_start);
@@ -241,36 +241,35 @@ void pasti_format::wd_generate_gap(UINT32 *track, int &pos, const wd_obs &obs, i
}
}
-void pasti_format::wd_generate_sector_header(UINT32 *track, int &pos, const wd_obs &obs, int sector, int tstart, UINT32 cell_size)
+void pasti_format::wd_generate_sector_header(std::vector<UINT32> &track, const wd_obs &obs, int sector, int tstart, UINT32 cell_size)
{
- raw_w(track, pos, 16, 0x4489, cell_size);
- raw_w(track, pos, 16, 0x4489, cell_size);
- raw_w(track, pos, 16, 0x4489, cell_size);
- mfm_w(track, pos, 8, obs.track_data[tstart+3], cell_size);
+ raw_w(track, 16, 0x4489, cell_size);
+ raw_w(track, 16, 0x4489, cell_size);
+ raw_w(track, 16, 0x4489, cell_size);
+ mfm_w(track, 8, obs.track_data[tstart+3], cell_size);
for(int i=0; i != 6; i++)
- mfm_w(track, pos, 8, obs.sectors[sector].id[i], cell_size);
+ mfm_w(track, 8, obs.sectors[sector].id[i], cell_size);
}
-void pasti_format::wd_generate_sector_data(UINT32 *track, int &pos, const wd_obs &obs, int sector, int tstart, UINT32 cell_size)
+void pasti_format::wd_generate_sector_data(std::vector<UINT32> &track, const wd_obs &obs, int sector, int tstart, UINT32 cell_size)
{
const wd_sect &s = obs.sectors[sector];
- raw_w(track, pos, 16, 0x4489, cell_size);
- raw_w(track, pos, 16, 0x4489, cell_size);
- raw_w(track, pos, 16, 0x4489, cell_size);
- mfm_w(track, pos, 8, obs.track_data[tstart+3], cell_size);
+ raw_w(track, 16, 0x4489, cell_size);
+ raw_w(track, 16, 0x4489, cell_size);
+ raw_w(track, 16, 0x4489, cell_size);
+ mfm_w(track, 8, obs.track_data[tstart+3], cell_size);
for(int i=0; i<128 << (s.id[3] & 3); i++)
- mfm_w(track, pos, 8, s.data[i], cell_size);
- UINT16 crc = calc_crc_ccitt(track, pos - (2048 << (s.id[3] & 3)) - 16*4, pos);
- mfm_w(track, pos, 8, crc >> 8, cell_size);
- mfm_w(track, pos, 8, crc, cell_size);
+ mfm_w(track, 8, s.data[i], cell_size);
+ UINT16 crc = calc_crc_ccitt(track, track.size() - (2048 << (s.id[3] & 3)) - 16*4, track.size());
+ mfm_w(track, 8, crc >> 8, cell_size);
+ mfm_w(track, 8, crc, cell_size);
}
void pasti_format::wd_generate_track_from_sectors_and_track(int track, int head, floppy_image *image, wd_obs &obs)
{
if(0)
printf("Track %d head %d sectors %d\n", track, head, obs.sector_count);
- dynamic_array<UINT32> trackbuf(200000);
- int pos = 0;
+ std::vector<UINT32> trackbuf;
wd_sect_info sect_infos[256];
@@ -306,7 +305,7 @@ void pasti_format::wd_generate_track_from_sectors_and_track(int track, int head,
}
UINT32 cell_size = UINT32(obs.sectors[0].time_ratio * 1000+0.5);
- wd_generate_gap(trackbuf, pos, obs, 0, sect_infos[0].hstart, false, cell_size, cell_size);
+ wd_generate_gap(trackbuf, obs, 0, sect_infos[0].hstart, false, cell_size, cell_size);
for(int i=0; i != obs.sector_count; i++) {
wd_sect_info *s = sect_infos + i;
@@ -319,28 +318,28 @@ void pasti_format::wd_generate_track_from_sectors_and_track(int track, int head,
UINT32 ncell_size = UINT32(obs.sectors[i+1 != obs.sector_count ? i+1 : 0].time_ratio * 1000+0.5);
- wd_generate_sector_header(trackbuf, pos, obs, i, s->hstart, cell_size);
+ wd_generate_sector_header(trackbuf, obs, i, s->hstart, cell_size);
if(s->dstart == -1) {
if(i == obs.sector_count-1)
- wd_generate_gap(trackbuf, pos, obs, s->hend, obs.track_size, s->hsynced, cell_size, ncell_size);
+ wd_generate_gap(trackbuf, obs, s->hend, obs.track_size, s->hsynced, cell_size, ncell_size);
else
- wd_generate_gap(trackbuf, pos, obs, s->hend, s[1].hstart, s->hsynced, cell_size, ncell_size);
+ wd_generate_gap(trackbuf, obs, s->hend, s[1].hstart, s->hsynced, cell_size, ncell_size);
} else {
- wd_generate_gap(trackbuf, pos, obs, s->hend, s->dstart, s->hsynced, cell_size, cell_size);
- wd_generate_sector_data(trackbuf, pos, obs, i, s->dstart, cell_size);
+ wd_generate_gap(trackbuf, obs, s->hend, s->dstart, s->hsynced, cell_size, cell_size);
+ wd_generate_sector_data(trackbuf, obs, i, s->dstart, cell_size);
if(i == obs.sector_count-1)
- wd_generate_gap(trackbuf, pos, obs, s->dend, obs.track_size, s->dsynced, cell_size, ncell_size);
+ wd_generate_gap(trackbuf, obs, s->dend, obs.track_size, s->dsynced, cell_size, ncell_size);
else
- wd_generate_gap(trackbuf, pos, obs, s->dend, s[1].hstart, s->dsynced, cell_size, ncell_size);
+ wd_generate_gap(trackbuf, obs, s->dend, s[1].hstart, s->dsynced, cell_size, ncell_size);
}
cell_size = ncell_size;
}
} else
- wd_generate_gap(trackbuf, pos, obs, 0, obs.track_size, false, 1000, 1000);
+ wd_generate_gap(trackbuf, obs, 0, obs.track_size, false, 1000, 1000);
- generate_track_from_levels(track, head, trackbuf, pos, 0, image);
+ generate_track_from_levels(track, head, trackbuf, 0, image);
}
void pasti_format::wd_generate_track_from_sectors_only(int track, int head, floppy_image *image, wd_obs &obs)
@@ -360,63 +359,62 @@ void pasti_format::wd_generate_track_from_sectors_only(int track, int head, flop
}
}
- UINT32 *tdata = global_alloc_array(UINT32, 200000);
- int pos = 0;
+ std::vector<UINT32> tdata;
for(int i=0; i != obs.sector_count; i++) {
const wd_sect &s = obs.sectors[i];
if(i+1 != obs.sector_count && obs.sectors[i+1].position < s.position+10+44+4+(128 << (s.id[3] & 3))) {
logerror("pasti: Unsupported sector data sharing, track %d head %d\n", track, head);
return;
}
- if(pos >> 4 < s.position - 12) {
- int count = s.position - 12 - (pos >> 4);
+ if(tdata.size() >> 4 < s.position - 12) {
+ int count = s.position - 12 - (tdata.size() >> 4);
if(count & 1) {
- mfm_w(tdata, pos, 8, 0x4e);
+ mfm_w(tdata, 8, 0x4e);
count--;
}
for(int j=0; j<count; j+=2)
- mfm_w(tdata, pos, 8, 0x4e);
+ mfm_w(tdata, 8, 0x4e);
}
- if(pos < s.position*16) {
- int count = s.position - (pos >> 4);
+ if(tdata.size() < s.position*16) {
+ int count = s.position - (tdata.size() >> 4);
if(count & 1) {
- mfm_w(tdata, pos, 8, 0x00);
+ mfm_w(tdata, 8, 0x00);
count--;
}
for(int j=0; j<count; j+=2)
- mfm_w(tdata, pos, 8, 0x00);
+ mfm_w(tdata, 8, 0x00);
}
- raw_w(tdata, pos, 16, 0x4489);
- raw_w(tdata, pos, 16, 0x4489);
- raw_w(tdata, pos, 16, 0x4489);
- mfm_w(tdata, pos, 8, 0xfe);
+ raw_w(tdata, 16, 0x4489);
+ raw_w(tdata, 16, 0x4489);
+ raw_w(tdata, 16, 0x4489);
+ mfm_w(tdata, 8, 0xfe);
for(int j=0; j<6; j++)
- mfm_w(tdata, pos, 8, s.id[j]);
+ mfm_w(tdata, 8, s.id[j]);
if(!s.data)
continue;
for(int j=0; j<22; j++)
- mfm_w(tdata, pos, 8, 0x4e);
+ mfm_w(tdata, 8, 0x4e);
for(int j=0; j<12; j++)
- mfm_w(tdata, pos, 8, 0x00);
+ mfm_w(tdata, 8, 0x00);
- raw_w(tdata, pos, 16, 0x4489);
- raw_w(tdata, pos, 16, 0x4489);
- raw_w(tdata, pos, 16, 0x4489);
- mfm_w(tdata, pos, 8, 0xfb);
+ raw_w(tdata, 16, 0x4489);
+ raw_w(tdata, 16, 0x4489);
+ raw_w(tdata, 16, 0x4489);
+ mfm_w(tdata, 8, 0xfb);
for(int j=0; j<128 << (s.id[3] & 3); j++)
- mfm_w(tdata, pos, 8, s.data[j]);
- UINT16 crc = calc_crc_ccitt(tdata, pos - (2048 << (s.id[3] & 3)) - 16*4, pos);
- mfm_w(tdata, pos, 8, crc >> 8);
- mfm_w(tdata, pos, 8, crc);
+ mfm_w(tdata, 8, s.data[j]);
+ UINT16 crc = calc_crc_ccitt(tdata, tdata.size() - (2048 << (s.id[3] & 3)) - 16*4, tdata.size());
+ mfm_w(tdata, 8, crc >> 8);
+ mfm_w(tdata, 8, crc);
}
- int count = (100015 - pos) >> 16;
+ int count = (100015 - tdata.size()) >> 16;
for(int i=0; i<count; i++)
- mfm_w(tdata, pos, 8, 0x4e);
+ mfm_w(tdata, 8, 0x4e);
- generate_track_from_levels(track, head, tdata, pos, 0, image);
+ generate_track_from_levels(track, head, tdata, 0, image);
}
UINT16 pasti_format::byte_to_mfm(UINT8 data, bool context)
diff --git a/src/lib/formats/pasti_dsk.h b/src/lib/formats/pasti_dsk.h
index 16c56d53463..104efa1f6bf 100644
--- a/src/lib/formats/pasti_dsk.h
+++ b/src/lib/formats/pasti_dsk.h
@@ -48,11 +48,11 @@ private:
UINT16 byte_to_mfm(UINT8 data, bool context);
UINT16 calc_crc(const UINT8 *data, int size, UINT16 crc);
- void wd_generate_unsynced_gap(UINT32 *track, int &pos, const wd_obs &obs, int tstart, int tend, UINT32 cell_size);
- void wd_generate_synced_gap(UINT32 *track, int &pos, const wd_obs &obs, int tstart, int tend, UINT32 cell_size);
- void wd_generate_gap(UINT32 *track, int &pos, const wd_obs &obs, int tstart, int tend, bool synced, UINT32 cell_size_start, UINT32 cell_size_end);
- void wd_generate_sector_header(UINT32 *track, int &pos, const wd_obs &obs, int sector, int tstart, UINT32 cell_size);
- void wd_generate_sector_data(UINT32 *track, int &pos, const wd_obs &obs, int sector, int tstart, UINT32 cell_size);
+ void wd_generate_unsynced_gap(std::vector<UINT32> &track, const wd_obs &obs, int tstart, int tend, UINT32 cell_size);
+ void wd_generate_synced_gap(std::vector<UINT32> &track, const wd_obs &obs, int tstart, int tend, UINT32 cell_size);
+ void wd_generate_gap(std::vector<UINT32> &track, const wd_obs &obs, int tstart, int tend, bool synced, UINT32 cell_size_start, UINT32 cell_size_end);
+ void wd_generate_sector_header(std::vector<UINT32> &track, const wd_obs &obs, int sector, int tstart, UINT32 cell_size);
+ void wd_generate_sector_data(std::vector<UINT32> &track, const wd_obs &obs, int sector, int tstart, UINT32 cell_size);
void wd_generate_track_from_sectors_and_track(int track, int head, floppy_image *image, wd_obs &obs);
void wd_generate_track_from_sectors_only(int track, int head, floppy_image *image, wd_obs &obs);
};
diff --git a/src/lib/formats/td0_dsk.c b/src/lib/formats/td0_dsk.c
index a9a7ed702a1..a4df2524344 100644
--- a/src/lib/formats/td0_dsk.c
+++ b/src/lib/formats/td0_dsk.c
@@ -833,10 +833,10 @@ bool td0_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
disk_decode.floppy_file = io;
disk_decode.init_Decode();
disk_decode.floppy_file_offset = 12;
- disk_decode.Decode(imagebuf, max_size);
+ disk_decode.Decode(&imagebuf[0], max_size);
}
else
- io_generic_read(io, imagebuf, 12, io_generic_size(io));
+ io_generic_read(io, &imagebuf[0], 12, io_generic_size(io));
if(header[7] & 0x80)
offset = 10 + imagebuf[2] + (imagebuf[3] << 8);
diff --git a/src/lib/formats/ti99_dsk.c b/src/lib/formats/ti99_dsk.c
index d18ef3c4192..f0688634d9f 100644
--- a/src/lib/formats/ti99_dsk.c
+++ b/src/lib/formats/ti99_dsk.c
@@ -284,7 +284,7 @@ bool ti99_floppy_format::save(io_generic *io, floppy_image *image)
void ti99_floppy_format::generate_track_fm(int track, int head, int cell_size, UINT8* trackdata, floppy_image *image)
{
int track_size_cells = 200000000/cell_size;
- UINT32 *buffer = global_alloc_array_clear(UINT32, 200000000/cell_size);
+ std::vector<UINT32> buffer;
// The TDF has a long track lead-out that makes the track length sum up
// to 3253; this is too long for the number of cells in the real track.
@@ -299,14 +299,12 @@ void ti99_floppy_format::generate_track_fm(int track, int head, int cell_size, U
int track_size = track_size_cells / 16;
- int offset = 0;
short crc1, crc2, found_crc;
int start = 16;
if (check_for_address_marks(trackdata, floppy_image::FM)==false)
{
if (head==0 && track==0) logerror("ti99_dsk: Cannot find FM address marks on track %d, head %d; likely broken or unformatted.\n", track, head);
- global_free_array(buffer);
return;
}
@@ -323,14 +321,14 @@ void ti99_floppy_format::generate_track_fm(int track, int head, int cell_size, U
if (((i-start-6)%334==0) && (i < start + 9*334))
{
// IDAM
- raw_w(buffer, offset, 16, 0xf57e);
+ raw_w(buffer, 16, 0xf57e);
}
else
{
if (((i-start-30)%334==0) && (i < start + 9*334))
{
// DAM
- raw_w(buffer, offset, 16, 0xf56f);
+ raw_w(buffer, 16, 0xf56f);
}
else
{
@@ -374,20 +372,18 @@ void ti99_floppy_format::generate_track_fm(int track, int head, int cell_size, U
}
}
}
- fm_w(buffer, offset, 8, trackdata[i]);
+ fm_w(buffer, 8, trackdata[i]);
}
}
}
- generate_track_from_levels(track, head, buffer, track_size_cells, 0, image);
-
- global_free_array(buffer);
+ generate_track_from_levels(track, head, buffer, 0, image);
}
void ti99_floppy_format::generate_track_mfm(int track, int head, int cell_size, UINT8* trackdata, floppy_image *image)
{
int track_size_cells = 200000000/cell_size;
- UINT32 *buffer = global_alloc_array_clear(UINT32, 200000000/cell_size);
+ std::vector<UINT32> buffer;
// See above
// We limit the track size to cell_number / 16, which means 6250 for MFM
@@ -395,14 +391,12 @@ void ti99_floppy_format::generate_track_mfm(int track, int head, int cell_size,
// (not 712 as specified in the TDF format)
int track_size = track_size_cells / 16;
- int offset = 0;
short crc1, crc2, found_crc;
int start = 40;
if (check_for_address_marks(trackdata, floppy_image::MFM)==false)
{
if (track==0 && head==0) logerror("ti99_dsk: Cannot find MFM address marks on track %d, head %d; likely broken or unformatted.\n", track, head);
- global_free_array(buffer);
return;
}
@@ -420,8 +414,8 @@ void ti99_floppy_format::generate_track_mfm(int track, int head, int cell_size,
{
// IDAM
for (int j=0; j < 3; j++)
- raw_w(buffer, offset, 16, 0x4489); // 3 times A1
- mfm_w(buffer, offset, 8, 0xfe);
+ raw_w(buffer, 16, 0x4489); // 3 times A1
+ mfm_w(buffer, 8, 0xfe);
i += 3;
}
else
@@ -430,8 +424,8 @@ void ti99_floppy_format::generate_track_mfm(int track, int head, int cell_size,
{
// DAM
for (int j=0; j < 3; j++)
- raw_w(buffer, offset, 16, 0x4489); // 3 times A1
- mfm_w(buffer, offset, 8, 0xfb);
+ raw_w(buffer, 16, 0x4489); // 3 times A1
+ mfm_w(buffer, 8, 0xfb);
i += 3;
}
else
@@ -476,14 +470,12 @@ void ti99_floppy_format::generate_track_mfm(int track, int head, int cell_size,
}
}
}
- mfm_w(buffer, offset, 8, trackdata[i]);
+ mfm_w(buffer, 8, trackdata[i]);
}
}
}
- generate_track_from_levels(track, head, buffer, track_size_cells, 0, image);
-
- global_free_array(buffer);
+ generate_track_from_levels(track, head, buffer, 0, image);
}
// States for decoding the bitstream
@@ -2551,11 +2543,11 @@ static floperr_t ti99_tdf_read_sector(floppy_image_legacy *floppy, int head, int
imgtrack = track / 2;
}
- err = ti99_tdf_read_track_internal(floppy, head, imgtrack, 0, track_data, tag->track_size);
+ err = ti99_tdf_read_track_internal(floppy, head, imgtrack, 0, &track_data[0], tag->track_size);
if (err)
return err;
- err = ti99_tdf_seek_sector_in_track(floppy, head, imgtrack, sector, track_data, &sector_data);
+ err = ti99_tdf_seek_sector_in_track(floppy, head, imgtrack, sector, &track_data[0], &sector_data);
if (err)
return err;
/* verify CRC? */
@@ -2635,7 +2627,7 @@ static floperr_t ti99_tdf_write_indexed_sector(floppy_image_legacy *floppy, int
imgtrack = track / 2;
}
- err = ti99_tdf_read_track_internal(floppy, head, imgtrack, 0, track_data, tag->track_size);
+ err = ti99_tdf_read_track_internal(floppy, head, imgtrack, 0, &track_data[0], tag->track_size);
if (err)
{
return err;
@@ -2644,7 +2636,7 @@ static floperr_t ti99_tdf_write_indexed_sector(floppy_image_legacy *floppy, int
/* Search for the sector_index-th sector. */
if (tag->first_idam==0) /* should we check for every track? */
{
- if (determine_offset(tag->format, track_data, &tag->first_idam)==FLOPPY_ERROR_SEEKERROR)
+ if (determine_offset(tag->format, &track_data[0], &tag->first_idam)==FLOPPY_ERROR_SEEKERROR)
{
return FLOPPY_ERROR_SEEKERROR;
}
@@ -2654,7 +2646,7 @@ static floperr_t ti99_tdf_write_indexed_sector(floppy_image_legacy *floppy, int
i=0;
while (i < tag->track_size && sector_index>=0)
{
- byte = read_byte(tag->format, tag->first_idam, track_data, i);
+ byte = read_byte(tag->format, tag->first_idam, &track_data[0], i);
if (byte == TI99_IDAM)
{
sector_index--;
@@ -2672,7 +2664,7 @@ static floperr_t ti99_tdf_write_indexed_sector(floppy_image_legacy *floppy, int
/* Find the DAM. */
while (i < tag->track_size)
{
- byte = read_byte(tag->format, tag->first_idam, track_data, i);
+ byte = read_byte(tag->format, tag->first_idam, &track_data[0], i);
if (byte == TI99_DAM)
break;
else
@@ -2693,7 +2685,7 @@ static floperr_t ti99_tdf_write_indexed_sector(floppy_image_legacy *floppy, int
if (err)
return err;
- offset = track_offset + (sector_data - track_data);
+ offset = track_offset + (sector_data - &track_data[0]);
/* Write the sector data at that position. */
floppy_image_write(floppy, buffer, offset, SECTOR_SIZE);
@@ -2725,7 +2717,7 @@ static floperr_t ti99_tdf_find_indexed_sector(floppy_image_legacy *floppy, int h
imgtrack = track / 2;
}
- err = ti99_tdf_read_track_internal(floppy, head, imgtrack, 0, track_data, tag->track_size);
+ err = ti99_tdf_read_track_internal(floppy, head, imgtrack, 0, &track_data[0], tag->track_size);
if (err)
{
return err;
@@ -2735,7 +2727,7 @@ static floperr_t ti99_tdf_find_indexed_sector(floppy_image_legacy *floppy, int h
if (tag->first_idam==0) /* should we check for every track? */
{
- if (determine_offset(tag->format, track_data, &tag->first_idam)==FLOPPY_ERROR_SEEKERROR)
+ if (determine_offset(tag->format, &track_data[0], &tag->first_idam)==FLOPPY_ERROR_SEEKERROR)
{
return FLOPPY_ERROR_SEEKERROR;
}
@@ -2745,7 +2737,7 @@ static floperr_t ti99_tdf_find_indexed_sector(floppy_image_legacy *floppy, int h
sector_index = sector_index+1;
while (i++ < tag->track_size && sector_index>0)
{
- byte = read_byte(tag->format, tag->first_idam, track_data, i);
+ byte = read_byte(tag->format, tag->first_idam, &track_data[0], i);
if (byte == TI99_IDAM)
{
sector_index--;
@@ -2788,7 +2780,7 @@ static floperr_t ti99_tdf_find_indexed_sector(floppy_image_legacy *floppy, int h
{
while (i++ < tag->track_size)
{
- byte = read_byte(tag->format, tag->first_idam, track_data, i);
+ byte = read_byte(tag->format, tag->first_idam, &track_data[0], i);
if (byte == TI99_DAM)
break;
}
@@ -2866,12 +2858,12 @@ static int ti99_tdf_guess_geometry(floppy_image_legacy *floppy, UINT64 size,
else
geometry = &dummy_geometry;
- floppy_image_read(floppy, track_data, 0, 13000);
+ floppy_image_read(floppy, &track_data[0], 0, 13000);
- if (determine_offset(TI99_MFM, track_data, &first_idam)==FLOPPY_ERROR_SEEKERROR)
+ if (determine_offset(TI99_MFM, &track_data[0], &first_idam)==FLOPPY_ERROR_SEEKERROR)
{
/* MFM failed. */
- if (determine_offset(TI99_FM, track_data, &first_idam)==FLOPPY_ERROR_SEEKERROR)
+ if (determine_offset(TI99_FM, &track_data[0], &first_idam)==FLOPPY_ERROR_SEEKERROR)
{
LOG_FORMATS("IDAM not found. Unformatted disk.\n");
@@ -2976,7 +2968,7 @@ static int ti99_tdf_guess_geometry(floppy_image_legacy *floppy, UINT64 size,
while (i++ < 13000 && head == 0 && track == 0)
{
- byte = read_byte(format, first_idam, track_data, i);
+ byte = read_byte(format, first_idam, &track_data[0], i);
switch (state)
{
case 0:
@@ -3016,8 +3008,8 @@ static int ti99_tdf_guess_geometry(floppy_image_legacy *floppy, UINT64 size,
// head 0 or for head 1.
geometry->sides = 1;
- floppy_image_read(floppy, track_data, size-tracklength, tracklength);
- if (determine_offset(format, track_data, &first_idam)==FLOPPY_ERROR_SEEKERROR)
+ floppy_image_read(floppy, &track_data[0], size-tracklength, tracklength);
+ if (determine_offset(format, &track_data[0], &first_idam)==FLOPPY_ERROR_SEEKERROR)
{
/* error ... what now? */
LOG_FORMATS("Error when reading last track. Image broken.\n");
diff --git a/src/lib/formats/upd765_dsk.c b/src/lib/formats/upd765_dsk.c
index b26da4c2d98..45a05d37b86 100644
--- a/src/lib/formats/upd765_dsk.c
+++ b/src/lib/formats/upd765_dsk.c
@@ -236,7 +236,7 @@ bool upd765_format::save(io_generic *io, floppy_image *image)
// Allocate the storage for the list of testable formats for a
// given cell size
- dynamic_array<int> candidates(formats_count);
+ std::vector<int> candidates;
// Format we're finally choosing
int chosen_candidate = -1;
@@ -246,16 +246,16 @@ bool upd765_format::save(io_generic *io, floppy_image *image)
for(;;) {
// Build the list of all formats for the immediatly superior cell size
int cur_cell_size = 0;
- int candidates_count = 0;
+ candidates.clear();
for(int i=0; i != formats_count; i++) {
if(image->get_form_factor() == floppy_image::FF_UNKNOWN ||
image->get_form_factor() == formats[i].form_factor) {
if(formats[i].cell_size == cur_cell_size)
- candidates[candidates_count++] = i;
+ candidates.push_back(i);
else if((!cur_cell_size || formats[i].cell_size < cur_cell_size) &&
formats[i].cell_size > min_cell_size) {
- candidates[0] = i;
- candidates_count = 1;
+ candidates.clear();
+ candidates.push_back(i);
cur_cell_size = formats[i].cell_size;
}
}
@@ -265,21 +265,21 @@ bool upd765_format::save(io_generic *io, floppy_image *image)
// No candidates with a cell size bigger than the previously
// tested one, we're done
- if(!candidates_count)
+ if(candidates.empty())
break;
// Filter with track 0 head 0
- check_compatibility(image, candidates, candidates_count);
+ check_compatibility(image, candidates);
// Nobody matches, try with the next cell size
- if(!candidates_count)
+ if(candidates.empty())
continue;
// We have a match at that cell size, we just need to find the
// best one given the geometry
// If there's only one, we're done
- if(candidates_count == 1) {
+ if(candidates.size() == 1) {
chosen_candidate = candidates[0];
break;
}
@@ -288,7 +288,7 @@ bool upd765_format::save(io_generic *io, floppy_image *image)
int tracks, heads;
image->get_actual_geometry(tracks, heads);
chosen_candidate = candidates[0];
- for(int i=1; i != candidates_count; i++) {
+ for(unsigned int i=1; i != candidates.size(); i++) {
const format &cc = formats[chosen_candidate];
const format &cn = formats[candidates[i]];
@@ -344,7 +344,7 @@ bool upd765_format::save(io_generic *io, floppy_image *image)
return true;
}
-void upd765_format::check_compatibility(floppy_image *image, int *candidates, int &candidates_count)
+void upd765_format::check_compatibility(floppy_image *image, std::vector<int> &candidates)
{
UINT8 bitstream[500000/8];
UINT8 sectdata[50000];
@@ -365,8 +365,8 @@ void upd765_format::check_compatibility(floppy_image *image, int *candidates, in
}
// Check compatibility with every candidate, copy in-place
- int *ok_cands = candidates;
- for(int i=0; i != candidates_count; i++) {
+ int *ok_cands = &candidates[0];
+ for(unsigned int i=0; i != candidates.size(); i++) {
const format &f = formats[candidates[i]];
int ns = 0;
for(int j=0; j<256; j++)
@@ -394,7 +394,7 @@ void upd765_format::check_compatibility(floppy_image *image, int *candidates, in
fail:
;
}
- candidates_count = ok_cands - candidates;
+ candidates.resize(ok_cands - &candidates[0]);
}
diff --git a/src/lib/formats/upd765_dsk.h b/src/lib/formats/upd765_dsk.h
index e19818b3678..18b9f968d60 100644
--- a/src/lib/formats/upd765_dsk.h
+++ b/src/lib/formats/upd765_dsk.h
@@ -47,7 +47,7 @@ protected:
int find_size(io_generic *io, UINT32 form_factor);
int compute_track_size(const format &f) const;
virtual void build_sector_description(const format &d, UINT8 *sectdata, desc_s *sectors, int track, int head) const;
- void check_compatibility(floppy_image *image, int *candidates, int &candidates_count);
+ void check_compatibility(floppy_image *image, std::vector<int> &candidates);
void extract_sectors(floppy_image *image, const format &f, desc_s *sdesc, int track, int head);
private:
diff --git a/src/lib/formats/victor9k_dsk.c b/src/lib/formats/victor9k_dsk.c
index 020c4af46b3..7376b3208a7 100644
--- a/src/lib/formats/victor9k_dsk.c
+++ b/src/lib/formats/victor9k_dsk.c
@@ -260,9 +260,9 @@ bool victor9k_format::load(io_generic *io, UINT32 form_factor, floppy_image *ima
dynamic_buffer img;
img.resize(size);
- io_generic_read(io, img, 0, size);
+ io_generic_read(io, &img[0], 0, size);
- log_boot_sector(img);
+ log_boot_sector(&img[0]);
int track_offset = 0;
@@ -286,7 +286,7 @@ bool victor9k_format::load(io_generic *io, UINT32 form_factor, floppy_image *ima
desc_s sectors[40];
- build_sector_description(f, img, track_offset, sectors, sector_count);
+ build_sector_description(f, &img[0], track_offset, sectors, sector_count);
generate_track(desc, track, head, sectors, sector_count, total_size, image);
track_offset += track_size;
diff --git a/src/lib/formats/wd177x_dsk.c b/src/lib/formats/wd177x_dsk.c
index 8ced951fd51..0816da1d295 100644
--- a/src/lib/formats/wd177x_dsk.c
+++ b/src/lib/formats/wd177x_dsk.c
@@ -226,7 +226,7 @@ bool wd177x_format::save(io_generic *io, floppy_image *image)
// Allocate the storage for the list of testable formats for a
// given cell size
- dynamic_array<int> candidates(formats_count);
+ std::vector<int> candidates;
// Format we're finally choosing
int chosen_candidate = -1;
@@ -236,16 +236,16 @@ bool wd177x_format::save(io_generic *io, floppy_image *image)
for(;;) {
// Build the list of all formats for the immediatly superior cell size
int cur_cell_size = 0;
- int candidates_count = 0;
+ candidates.clear();
for(int i=0; i != formats_count; i++) {
if(image->get_form_factor() == floppy_image::FF_UNKNOWN ||
image->get_form_factor() == formats[i].form_factor) {
if(formats[i].cell_size == cur_cell_size)
- candidates[candidates_count++] = i;
+ candidates.push_back(i);
else if((!cur_cell_size || formats[i].cell_size < cur_cell_size) &&
formats[i].cell_size > min_cell_size) {
- candidates[0] = i;
- candidates_count = 1;
+ candidates.clear();
+ candidates.push_back(i);
cur_cell_size = formats[i].cell_size;
}
}
@@ -255,21 +255,21 @@ bool wd177x_format::save(io_generic *io, floppy_image *image)
// No candidates with a cell size bigger than the previously
// tested one, we're done
- if(!candidates_count)
+ if(candidates.empty())
break;
// Filter with track 0 head 0
- check_compatibility(image, candidates, candidates_count);
+ check_compatibility(image, candidates);
// Nobody matches, try with the next cell size
- if(!candidates_count)
+ if(candidates.empty())
continue;
// We have a match at that cell size, we just need to find the
// best one given the geometry
// If there's only one, we're done
- if(candidates_count == 1) {
+ if(candidates.size() == 1) {
chosen_candidate = candidates[0];
break;
}
@@ -278,7 +278,7 @@ bool wd177x_format::save(io_generic *io, floppy_image *image)
int tracks, heads;
image->get_actual_geometry(tracks, heads);
chosen_candidate = candidates[0];
- for(int i=1; i != candidates_count; i++) {
+ for(unsigned int i=1; i != candidates.size(); i++) {
const format &cc = formats[chosen_candidate];
const format &cn = formats[candidates[i]];
@@ -343,7 +343,7 @@ int wd177x_format::get_image_offset(const format &f, int head, int track)
return (track * f.head_count + head) * compute_track_size(f);
}
-void wd177x_format::check_compatibility(floppy_image *image, int *candidates, int &candidates_count)
+void wd177x_format::check_compatibility(floppy_image *image, std::vector<int> &candidates)
{
UINT8 bitstream[500000/8];
UINT8 sectdata[50000];
@@ -364,8 +364,8 @@ void wd177x_format::check_compatibility(floppy_image *image, int *candidates, in
}
// Check compatibility with every candidate, copy in-place
- int *ok_cands = candidates;
- for(int i=0; i != candidates_count; i++) {
+ int *ok_cands = &candidates[0];
+ for(unsigned int i=0; i != candidates.size(); i++) {
const format &f = formats[candidates[i]];
int ns = 0;
for(int j=0; j<256; j++)
@@ -393,7 +393,7 @@ void wd177x_format::check_compatibility(floppy_image *image, int *candidates, in
fail:
;
}
- candidates_count = ok_cands - candidates;
+ candidates.resize(ok_cands - &candidates[0]);
}
void wd177x_format::extract_sectors(floppy_image *image, const format &f, desc_s *sdesc, int track, int head)
diff --git a/src/lib/formats/wd177x_dsk.h b/src/lib/formats/wd177x_dsk.h
index 6bd1519aaaf..20b42927bf0 100644
--- a/src/lib/formats/wd177x_dsk.h
+++ b/src/lib/formats/wd177x_dsk.h
@@ -49,7 +49,7 @@ protected:
int compute_track_size(const format &f) const;
void build_sector_description(const format &d, UINT8 *sectdata, desc_s *sectors) const;
- void check_compatibility(floppy_image *image, int *candidates, int &candidates_count);
+ void check_compatibility(floppy_image *image, std::vector<int> &candidates);
void extract_sectors(floppy_image *image, const format &f, desc_s *sdesc, int track, int head);
};
diff --git a/src/lib/formats/z80ne_dsk.c b/src/lib/formats/z80ne_dsk.c
index 967fecd27f5..d399c1ac441 100644
--- a/src/lib/formats/z80ne_dsk.c
+++ b/src/lib/formats/z80ne_dsk.c
@@ -177,7 +177,7 @@ static floperr_t z80ne_dmk_format_track(floppy_image_legacy *floppy, int head, i
UINT8 *track_data;
void *track_data_v;
UINT32 max_track_size;
- dynamic_array<int> sector_map;
+ std::vector<int> sector_map;
dynamic_buffer local_sector;
int local_sector_size;
int sector_position;
@@ -208,7 +208,8 @@ static floperr_t z80ne_dmk_format_track(floppy_image_legacy *floppy, int head, i
track_data = (UINT8 *) track_data_v;
/* set up sector map */
- sector_map.resize_and_clear(sectors, 0xFF);
+ sector_map.resize(sectors);
+ memset(&sector_map, 0xff, sectors);
physical_sector = 0;
for (logical_sector = 0; logical_sector < sectors; logical_sector++)
@@ -231,7 +232,8 @@ static floperr_t z80ne_dmk_format_track(floppy_image_legacy *floppy, int head, i
sector_length +
DMK_DATA_CRC_LEN +
DMK_DATA_GAP_LEN);
- local_sector.resize_and_clear(local_sector_size);
+ local_sector.resize(local_sector_size);
+ memset(&local_sector, 0, local_sector_size);
/* set up track table of contents */
physical_sector = 0;
@@ -391,7 +393,8 @@ static floperr_t z80ne_dmk_seek_sector_in_track(floppy_image_legacy *floppy, int
DMK_ID_GAP_LEN +
DMK_DAM_LEN +
DMK_DATA_GAP_LEN);
- local_idam.resize_and_clear(local_idam_size);
+ local_idam.resize(local_idam_size);
+ memset(&local_idam[0], 0, local_idam_size);
/* search for matching IDAM */
for (i = 0; i < DMK_TOC_LEN / 2; i++)
@@ -570,7 +573,8 @@ static floperr_t internal_z80ne_dmk_read_sector(floppy_image_legacy *floppy, int
/* set up a local physical sector space (DAM + data + crc + GAP) */
local_sector_size = (DMK_DAM_LEN + sector_length + DMK_DATA_CRC_LEN + DMK_DATA_GAP_LEN);
- local_sector.resize_and_clear(local_sector_size);
+ local_sector.resize(local_sector_size);
+ memset(&local_sector, 0, local_sector_size);
/* get sector data */
/* create a local copy of sector data including DAM (for crc calculation) */
@@ -582,7 +586,7 @@ static floperr_t internal_z80ne_dmk_read_sector(floppy_image_legacy *floppy, int
crc_on_disk += local_sector[sector_length + 1 + 1];
/* crc calculated including DAM */
- calculated_crc = ccitt_crc16(0xffff, local_sector, sector_length+1);
+ calculated_crc = ccitt_crc16(0xffff, &local_sector[0], sector_length+1);
if (calculated_crc != crc_on_disk)
{
err = FLOPPY_ERROR_INVALIDIMAGE;
@@ -590,7 +594,7 @@ static floperr_t internal_z80ne_dmk_read_sector(floppy_image_legacy *floppy, int
}
/* copy local sector data excluding DAM */
- memcpy(buffer, local_sector+1, MIN(sector_length, buflen));
+ memcpy(buffer, &local_sector[1], MIN(sector_length, buflen));
done:
return err;
@@ -615,7 +619,8 @@ static floperr_t internal_z80ne_dmk_write_sector(floppy_image_legacy *floppy, in
/* set up a local physical sector space */
local_sector_size = (DMK_DAM_LEN + sector_length + DMK_DATA_CRC_LEN + DMK_DATA_GAP_LEN);
- local_sector.resize_and_clear(local_sector_size);
+ local_sector.resize(local_sector_size);
+ memset(&local_sector[0], 0, local_sector_size);
if(!ddam)
local_sector[0] = 0xFB;
else
@@ -629,7 +634,7 @@ static floperr_t internal_z80ne_dmk_write_sector(floppy_image_legacy *floppy, in
memcpy(&local_sector[1], buffer, buflen);
- crc = ccitt_crc16(0xffff, local_sector, DMK_DAM_LEN + sector_length);
+ crc = ccitt_crc16(0xffff, &local_sector[0], DMK_DAM_LEN + sector_length);
local_sector[DMK_DAM_LEN + sector_length + 0] = crc >> 8;
local_sector[DMK_DAM_LEN + sector_length + 1] = crc >> 0;
diff --git a/src/lib/util/avhuff.c b/src/lib/util/avhuff.c
index 6684c6d7ae9..dd589c6abdd 100644
--- a/src/lib/util/avhuff.c
+++ b/src/lib/util/avhuff.c
@@ -308,7 +308,7 @@ avhuff_error avhuff_encoder::assemble_data(dynamic_buffer &buffer, bitmap_yuy16
// fill in the header
buffer.resize(12 + metadatasize + numsamples * channels * 2 + bitmap.width() * bitmap.height() * 2);
- UINT8 *dest = buffer;
+ UINT8 *dest = &buffer[0];
*dest++ = 'c';
*dest++ = 'h';
*dest++ = 'a';
@@ -549,7 +549,7 @@ UINT16 *avhuff_encoder::deltarle_encoder::rle_and_histo_bitmap(const UINT8 *sour
{
// resize our RLE buffer
m_rlebuffer.resize(items_per_row * row_count);
- UINT16 *dest = m_rlebuffer;
+ UINT16 *dest = &m_rlebuffer[0];
// iterate over rows
m_encoder.histo_reset();
@@ -599,7 +599,7 @@ UINT16 *avhuff_encoder::deltarle_encoder::rle_and_histo_bitmap(const UINT8 *sour
// compute the tree for our histogram
m_encoder.compute_tree_from_histo();
- return m_rlebuffer;
+ return &m_rlebuffer[0];
}
diff --git a/src/lib/util/avhuff.h b/src/lib/util/avhuff.h
index efc3c71a3e3..26873292fdc 100644
--- a/src/lib/util/avhuff.h
+++ b/src/lib/util/avhuff.h
@@ -113,7 +113,7 @@ private:
// internal state
int m_rlecount;
huffman_encoder<256 + 16> m_encoder;
- dynamic_array<UINT16> m_rlebuffer;
+ std::vector<UINT16> m_rlebuffer;
};
// internal helpers
diff --git a/src/lib/util/chd.c b/src/lib/util/chd.c
index c56465b48a2..9c5674e7559 100644
--- a/src/lib/util/chd.c
+++ b/src/lib/util/chd.c
@@ -379,7 +379,7 @@ chd_error chd_file::hunk_info(UINT32 hunknum, chd_codec_type &compressor, UINT32
// v3/v4 map entries
case 3:
case 4:
- rawmap = m_rawmap + 16 * hunknum;
+ rawmap = &m_rawmap[16 * hunknum];
switch (rawmap[15] & V34_MAP_ENTRY_FLAG_TYPE_MASK)
{
case V34_MAP_ENTRY_TYPE_COMPRESSED:
@@ -411,7 +411,7 @@ chd_error chd_file::hunk_info(UINT32 hunknum, chd_codec_type &compressor, UINT32
// v5 map entries
case 5:
- rawmap = m_rawmap + m_mapentrybytes * hunknum;
+ rawmap = &m_rawmap[m_mapentrybytes * hunknum];
// uncompressed case
if (!compressed())
@@ -704,7 +704,7 @@ void chd_file::close()
// reset map information
m_mapentrybytes = 0;
- m_rawmap.reset();
+ m_rawmap.clear();
// reset compression management
for (int decompnum = 0; decompnum < ARRAY_LENGTH(m_decompressor); decompnum++)
@@ -712,10 +712,10 @@ void chd_file::close()
delete m_decompressor[decompnum];
m_decompressor[decompnum] = NULL;
}
- m_compressed.reset();
+ m_compressed.clear();
// reset caching
- m_cache.reset();
+ m_cache.clear();
m_cachehunk = ~0;
}
@@ -748,15 +748,15 @@ chd_error chd_file::read_hunk(UINT32 hunknum, void *buffer)
// v3/v4 map entries
case 3:
case 4:
- rawmap = m_rawmap + 16 * hunknum;
+ rawmap = &m_rawmap[16 * hunknum];
blockoffs = be_read(&rawmap[0], 8);
blockcrc = be_read(&rawmap[8], 4);
switch (rawmap[15] & V34_MAP_ENTRY_FLAG_TYPE_MASK)
{
case V34_MAP_ENTRY_TYPE_COMPRESSED:
blocklen = be_read(&rawmap[12], 2) + (rawmap[14] << 16);
- file_read(blockoffs, m_compressed, blocklen);
- m_decompressor[0]->decompress(m_compressed, blocklen, dest, m_hunkbytes);
+ file_read(blockoffs, &m_compressed[0], blocklen);
+ m_decompressor[0]->decompress(&m_compressed[0], blocklen, dest, m_hunkbytes);
if (!(rawmap[15] & V34_MAP_ENTRY_FLAG_NO_CRC) && dest != NULL && crc32_creator::simple(dest, m_hunkbytes) != blockcrc)
throw CHDERR_DECOMPRESSION_ERROR;
return CHDERR_NONE;
@@ -787,7 +787,7 @@ chd_error chd_file::read_hunk(UINT32 hunknum, void *buffer)
// v5 map entries
case 5:
- rawmap = m_rawmap + m_mapentrybytes * hunknum;
+ rawmap = &m_rawmap[m_mapentrybytes * hunknum];
// uncompressed case
if (!compressed())
@@ -814,11 +814,11 @@ chd_error chd_file::read_hunk(UINT32 hunknum, void *buffer)
case COMPRESSION_TYPE_1:
case COMPRESSION_TYPE_2:
case COMPRESSION_TYPE_3:
- file_read(blockoffs, m_compressed, blocklen);
- m_decompressor[rawmap[0]]->decompress(m_compressed, blocklen, dest, m_hunkbytes);
+ file_read(blockoffs, &m_compressed[0], blocklen);
+ m_decompressor[rawmap[0]]->decompress(&m_compressed[0], blocklen, dest, m_hunkbytes);
if (!m_decompressor[rawmap[0]]->lossy() && dest != NULL && crc16_creator::simple(dest, m_hunkbytes) != blockcrc)
throw CHDERR_DECOMPRESSION_ERROR;
- if (m_decompressor[rawmap[0]]->lossy() && crc16_creator::simple(m_compressed, blocklen) != blockcrc)
+ if (m_decompressor[rawmap[0]]->lossy() && crc16_creator::simple(&m_compressed[0], blocklen) != blockcrc)
throw CHDERR_DECOMPRESSION_ERROR;
return CHDERR_NONE;
@@ -877,7 +877,7 @@ chd_error chd_file::write_hunk(UINT32 hunknum, const void *buffer)
throw CHDERR_FILE_NOT_WRITEABLE;
// see if we have allocated the space on disk for this hunk
- UINT8 *rawmap = m_rawmap + hunknum * 4;
+ UINT8 *rawmap = &m_rawmap[hunknum * 4];
UINT32 rawentry = be_read(rawmap, 4);
// if not, allocate one now
@@ -905,8 +905,8 @@ chd_error chd_file::write_hunk(UINT32 hunknum, const void *buffer)
file_write(m_mapoffset + hunknum * 4, rawmap, 4);
// update the cached hunk if we just wrote it
- if (hunknum == m_cachehunk && buffer != m_cache)
- memcpy(m_cache, buffer, m_hunkbytes);
+ if (hunknum == m_cachehunk && buffer != &m_cache[0])
+ memcpy(&m_cache[0], buffer, m_hunkbytes);
}
// otherwise, just overwrite
@@ -972,7 +972,7 @@ chd_error chd_file::read_bytes(UINT64 offset, void *buffer, UINT32 bytes)
{
if (curhunk != m_cachehunk)
{
- err = read_hunk(curhunk, m_cache);
+ err = read_hunk(curhunk, &m_cache[0]);
if (err != CHDERR_NONE)
return err;
m_cachehunk = curhunk;
@@ -1016,13 +1016,13 @@ chd_error chd_file::write_bytes(UINT64 offset, const void *buffer, UINT32 bytes)
{
if (curhunk != m_cachehunk)
{
- err = read_hunk(curhunk, m_cache);
+ err = read_hunk(curhunk, &m_cache[0]);
if (err != CHDERR_NONE)
return err;
m_cachehunk = curhunk;
}
memcpy(&m_cache[startoffs], source, endoffs + 1 - startoffs);
- err = write_hunk(curhunk, m_cache);
+ err = write_hunk(curhunk, &m_cache[0]);
}
// handle errors and advance
@@ -1078,7 +1078,7 @@ chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex
// read the metadata
output.resize(metaentry.length);
- file_read(metaentry.offset + METADATA_HEADER_SIZE, output, metaentry.length);
+ file_read(metaentry.offset + METADATA_HEADER_SIZE, &output[0], metaentry.length);
return CHDERR_NONE;
}
@@ -1124,7 +1124,7 @@ chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex
// read the metadata
output.resize(metaentry.length);
- file_read(metaentry.offset + METADATA_HEADER_SIZE, output, metaentry.length);
+ file_read(metaentry.offset + METADATA_HEADER_SIZE, &output[0], metaentry.length);
resulttag = metaentry.metatag;
resultflags = metaentry.flags;
return CHDERR_NONE;
@@ -1259,10 +1259,10 @@ chd_error chd_file::clone_all_metadata(chd_file &source)
{
// read the metadata item
filedata.resize(metaentry.length);
- source.file_read(metaentry.offset + METADATA_HEADER_SIZE, filedata, metaentry.length);
+ source.file_read(metaentry.offset + METADATA_HEADER_SIZE, &filedata[0], metaentry.length);
// write it to the destination
- chd_error err = write_metadata(metaentry.metatag, (UINT32)-1, filedata, metaentry.length, metaentry.flags);
+ chd_error err = write_metadata(metaentry.metatag, (UINT32)-1, &filedata[0], metaentry.length, metaentry.flags);
if (err != CHDERR_NONE)
throw err;
}
@@ -1291,7 +1291,7 @@ sha1_t chd_file::compute_overall_sha1(sha1_t rawsha1)
// iterate over metadata
dynamic_buffer filedata;
- dynamic_array<metadata_hash> hasharray;
+ std::vector<metadata_hash> hasharray;
metadata_entry metaentry;
for (bool has_data = metadata_find(CHDMETATAG_WILDCARD, 0, metaentry); has_data; has_data = metadata_find(CHDMETATAG_WILDCARD, 0, metaentry, true))
{
@@ -1301,24 +1301,24 @@ sha1_t chd_file::compute_overall_sha1(sha1_t rawsha1)
// allocate memory and read the data
filedata.resize(metaentry.length);
- file_read(metaentry.offset + METADATA_HEADER_SIZE, filedata, metaentry.length);
+ file_read(metaentry.offset + METADATA_HEADER_SIZE, &filedata[0], metaentry.length);
// create an entry for this metadata and add it
metadata_hash hashentry;
be_write(hashentry.tag, metaentry.metatag, 4);
- hashentry.sha1 = sha1_creator::simple(filedata, metaentry.length);
- hasharray.append(hashentry);
+ hashentry.sha1 = sha1_creator::simple(&filedata[0], metaentry.length);
+ hasharray.push_back(hashentry);
}
// sort the array
- if (hasharray.count() != 0)
- qsort(&hasharray[0], hasharray.count(), sizeof(hasharray[0]), metadata_hash_compare);
+ if (!hasharray.empty())
+ qsort(&hasharray[0], hasharray.size(), sizeof(hasharray[0]), metadata_hash_compare);
// read the raw data hash from our header and start a new SHA1 with that data
sha1_creator overall_sha1;
overall_sha1.append(&rawsha1, sizeof(rawsha1));
- if (hasharray.count() != 0)
- overall_sha1.append(&hasharray[0], hasharray.count() * sizeof(hasharray[0]));
+ if (!hasharray.empty())
+ overall_sha1.append(&hasharray[0], hasharray.size() * sizeof(hasharray[0]));
return overall_sha1.finish();
}
@@ -1586,11 +1586,11 @@ chd_error chd_file::compress_v5_map()
try
{
// first get a CRC-16 of the original rawmap
- crc16_t mapcrc = crc16_creator::simple(m_rawmap, m_hunkcount * 12);
+ crc16_t mapcrc = crc16_creator::simple(&m_rawmap[0], m_hunkcount * 12);
// create a buffer to hold the RLE data
dynamic_buffer compression_rle(m_hunkcount);
- UINT8 *dest = compression_rle;
+ UINT8 *dest = &compression_rle[0];
// use a huffman encoder for 16 different codes, maximum length is 8 bits
huffman_encoder<16, 8> encoder;
@@ -1673,7 +1673,7 @@ chd_error chd_file::compress_v5_map()
// compute a tree and export it to the buffer
dynamic_buffer compressed(m_hunkcount * 6);
- bitstream_out bitbuf(&compressed[16], compressed.count() - 16);
+ bitstream_out bitbuf(&compressed[16], compressed.size() - 16);
huffman_error err = encoder.compute_tree_from_histo();
if (err != HUFFERR_NONE)
throw CHDERR_COMPRESSION_ERROR;
@@ -1682,7 +1682,7 @@ chd_error chd_file::compress_v5_map()
throw CHDERR_COMPRESSION_ERROR;
// encode the data
- for (UINT8 *src = compression_rle; src < dest; src++)
+ for (UINT8 *src = &compression_rle[0]; src < dest; src++)
encoder.encode_one(bitbuf, *src);
// determine the number of bits we need to hold the a length
@@ -1694,7 +1694,7 @@ chd_error chd_file::compress_v5_map()
// for each compression type, output the relevant data
lastcomp = 0;
count = 0;
- UINT8 *src = compression_rle;
+ UINT8 *src = &compression_rle[0];
UINT64 firstoffs = 0;
for (int hunknum = 0; hunknum < m_hunkcount; hunknum++)
{
@@ -1768,7 +1768,7 @@ chd_error chd_file::compress_v5_map()
compressed[15] = 0;
// write the result
- m_mapoffset = file_append(compressed, complen + 16);
+ m_mapoffset = file_append(&compressed[0], complen + 16);
// then write the map offset
UINT8 rawbuf[sizeof(UINT64)];
@@ -1792,7 +1792,7 @@ void chd_file::decompress_v5_map()
// if no offset, we haven't written it yet
if (m_mapoffset == 0)
{
- memset(m_rawmap, 0xff, m_rawmap.count());
+ memset(&m_rawmap[0], 0xff, m_rawmap.size());
return;
}
@@ -1808,8 +1808,8 @@ void chd_file::decompress_v5_map()
// now read the map
dynamic_buffer compressed(mapbytes);
- file_read(m_mapoffset + 16, compressed, mapbytes);
- bitstream_in bitbuf(compressed, compressed.count());
+ file_read(m_mapoffset + 16, &compressed[0], mapbytes);
+ bitstream_in bitbuf(&compressed[0], compressed.size());
// first decode the compression types
huffman_decoder<16, 8> decoder;
@@ -1896,7 +1896,7 @@ void chd_file::decompress_v5_map()
}
// verify the final CRC
- if (crc16_creator::simple(m_rawmap, m_hunkcount * 12) != mapcrc)
+ if (crc16_creator::simple(&m_rawmap[0], m_hunkcount * 12) != mapcrc)
throw CHDERR_DECOMPRESSION_ERROR;
}
@@ -2084,7 +2084,7 @@ void chd_file::create_open_common()
if (m_version >= 5 && compressed())
decompress_v5_map();
else
- file_read(m_mapoffset, m_rawmap, m_rawmap.count());
+ file_read(m_mapoffset, &m_rawmap[0], m_rawmap.size());
// allocate the temporary compressed buffer and a buffer for caching
m_compressed.resize(m_hunkbytes);
@@ -2369,14 +2369,15 @@ void chd_file_compressor::compress_begin()
m_read_error = false;
// reset work item state
- m_work_buffer.resize_and_clear(hunk_bytes() * (WORK_BUFFER_HUNKS + 1));
+ m_work_buffer.resize(hunk_bytes() * (WORK_BUFFER_HUNKS + 1));
+ memset(&m_work_buffer[0], 0, m_work_buffer.size());
m_compressed_buffer.resize(hunk_bytes() * WORK_BUFFER_HUNKS);
for (int itemnum = 0; itemnum < WORK_BUFFER_HUNKS; itemnum++)
{
work_item &item = m_work_item[itemnum];
item.m_compressor = this;
- item.m_data = m_work_buffer + hunk_bytes() * itemnum;
- item.m_compressed = m_compressed_buffer + hunk_bytes() * itemnum;
+ item.m_data = &m_work_buffer[hunk_bytes() * itemnum];
+ item.m_compressed = &m_compressed_buffer[hunk_bytes() * itemnum];
item.m_hash.resize(hunk_bytes() / unit_bytes());
}
@@ -2626,8 +2627,8 @@ void chd_file_compressor::async_read()
try
{
// do the read
- UINT8 *dest = m_work_buffer + (m_read_done_offset % work_buffer_bytes);
- assert(dest == m_work_buffer || dest == m_work_buffer + work_buffer_bytes/2);
+ UINT8 *dest = &m_work_buffer[0] + (m_read_done_offset % work_buffer_bytes);
+ assert(dest == &m_work_buffer[0] || dest == &m_work_buffer[work_buffer_bytes/2]);
UINT64 end_offset = m_read_done_offset + numbytes;
// if walking the parent, read in hunks from the parent CHD
diff --git a/src/lib/util/chd.h b/src/lib/util/chd.h
index a04b8cff2ff..5062ca9c23a 100644
--- a/src/lib/util/chd.h
+++ b/src/lib/util/chd.h
@@ -353,7 +353,7 @@ public:
chd_error read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, dynamic_buffer &output, chd_metadata_tag &resulttag, UINT8 &resultflags);
chd_error write_metadata(chd_metadata_tag metatag, UINT32 metaindex, const void *inputbuf, UINT32 inputlen, UINT8 flags = CHD_MDFLAGS_CHECKSUM);
chd_error write_metadata(chd_metadata_tag metatag, UINT32 metaindex, const astring &input, UINT8 flags = CHD_MDFLAGS_CHECKSUM) { return write_metadata(metatag, metaindex, input.c_str(), input.len() + 1, flags); }
- chd_error write_metadata(chd_metadata_tag metatag, UINT32 metaindex, const dynamic_buffer &input, UINT8 flags = CHD_MDFLAGS_CHECKSUM) { return write_metadata(metatag, metaindex, input, input.count(), flags); }
+ chd_error write_metadata(chd_metadata_tag metatag, UINT32 metaindex, const dynamic_buffer &input, UINT8 flags = CHD_MDFLAGS_CHECKSUM) { return write_metadata(metatag, metaindex, &input[0], input.size(), flags); }
chd_error delete_metadata(chd_metadata_tag metatag, UINT32 metaindex);
chd_error clone_all_metadata(chd_file &source);
@@ -539,7 +539,7 @@ private:
UINT32 m_complen; // compressed data length
INT8 m_compression; // type of compression used
chd_compressor_group *m_codecs; // codec instance
- dynamic_array<hash_pair> m_hash; // array of hashes
+ std::vector<hash_pair> m_hash; // array of hashes
};
// internal helpers
diff --git a/src/lib/util/chdcodec.c b/src/lib/util/chdcodec.c
index 8a43c79ea80..df253489f7e 100644
--- a/src/lib/util/chdcodec.c
+++ b/src/lib/util/chdcodec.c
@@ -670,7 +670,7 @@ INT8 chd_compressor_group::find_best_compressor(const UINT8 *src, UINT8 *compres
try
{
// if this is the best one, copy the data into the permanent buffer
- UINT32 compbytes = m_compressor[codecnum]->compress(src, m_hunkbytes, m_compress_test);
+ UINT32 compbytes = m_compressor[codecnum]->compress(src, m_hunkbytes, &m_compress_test[0]);
#if CHDCODEC_VERIFY_COMPRESSION
try
{
@@ -699,7 +699,7 @@ printf(" codec%d=%d bytes \n", codecnum, compbytes);
{
compression = codecnum;
complen = compbytes;
- memcpy(compressed, m_compress_test, compbytes);
+ memcpy(compressed, &m_compress_test[0], compbytes);
}
}
catch (...) { }
@@ -1425,7 +1425,7 @@ UINT32 chd_cd_flac_compressor::compress(const UINT8 *src, UINT32 srclen, UINT8 *
// reset and encode the audio portion
m_encoder.reset(dest, hunkbytes());
- UINT8 *buffer = m_buffer;
+ UINT8 *buffer = &m_buffer[0];
if (!m_encoder.encode_interleaved(reinterpret_cast<INT16 *>(buffer), frames * CD_MAX_SECTOR_DATA/4, m_swap_endian))
throw CHDERR_COMPRESSION_ERROR;
@@ -1525,7 +1525,7 @@ void chd_cd_flac_decompressor::decompress(const UINT8 *src, UINT32 complen, UINT
UINT32 frames = destlen / CD_FRAME_SIZE;
if (!m_decoder.reset(44100, 2, chd_cd_flac_compressor::blocksize(frames * CD_MAX_SECTOR_DATA), src, complen))
throw CHDERR_DECOMPRESSION_ERROR;
- UINT8 *buffer = m_buffer;
+ UINT8 *buffer = &m_buffer[0];
if (!m_decoder.decode_interleaved(reinterpret_cast<INT16 *>(buffer), frames * CD_MAX_SECTOR_DATA/4, m_swap_endian))
throw CHDERR_DECOMPRESSION_ERROR;
diff --git a/src/lib/util/corefile.c b/src/lib/util/corefile.c
index abba0a6b5b9..491c35cacbf 100644
--- a/src/lib/util/corefile.c
+++ b/src/lib/util/corefile.c
@@ -750,10 +750,10 @@ file_error core_fload(const char *filename, dynamic_buffer &data)
data.resize(size);
/* read the data */
- if (core_fread(file, data, size) != size)
+ if (core_fread(file, &data[0], size) != size)
{
core_fclose(file);
- data.reset();
+ data.clear();
return FILERR_FAILURE;
}
diff --git a/src/lib/util/coretmpl.h b/src/lib/util/coretmpl.h
index 93c71f0c84b..e3d2eeb34c6 100644
--- a/src/lib/util/coretmpl.h
+++ b/src/lib/util/coretmpl.h
@@ -16,6 +16,8 @@
#include "osdcore.h"
#include "corealloc.h"
+#include <vector>
+
// TEMPORARY helper to catch is_pod assertions in the debugger
#if 0
#undef assert
@@ -57,88 +59,8 @@ private:
};
-// ======================> dynamic_array
-
-// an array that is dynamically sized and can optionally auto-expand
-template<class _ElementType>
-class dynamic_array
-{
-private:
- // we don't support deep copying
- dynamic_array(const dynamic_array &);
- dynamic_array &operator=(const dynamic_array &);
-
-public:
- // construction/destruction
- dynamic_array(int initial = 0, int clearvalue = -1)
- : m_array(NULL),
- m_count(0),
- m_allocated(0) { if (initial != 0) expand_internal(initial); m_count = initial; if (clearvalue != -1) clear(clearvalue); }
- virtual ~dynamic_array() { reset(); }
-
- // operators
- operator _ElementType *() { return &m_array[0]; }
- operator const _ElementType *() const { return &m_array[0]; }
- _ElementType &operator[](int index) { assert(index < m_count); return m_array[index]; }
- const _ElementType &operator[](int index) const { assert(index < m_count); return m_array[index]; }
-
- // simple getters
- int count() const { return m_count; }
- int bytes() const { return m_count * sizeof(_ElementType); }
-
- // core operations
- _ElementType &append() { if (m_count == m_allocated) expand_and_keep_internal((m_allocated == 0) ? 16 : (m_allocated << 1)); return m_array[m_count++]; }
- const _ElementType &append(const _ElementType &element) { return (append() = element); }
- void reset() { global_free_array(m_array); m_array = NULL; m_count = m_allocated = 0; }
- void resize(int count) { if (count > m_allocated) expand_internal(count); m_count = count; }
- void resize_keep(int count) { if (count > m_allocated) expand_and_keep_internal(count); m_count = count; }
- void clear(UINT8 data = 0) { clear_internal(0, m_count, data); }
-
- // compound operations
- void resize_and_clear(int count, UINT8 data = 0) { resize(count); clear(data); }
- void resize_keep_and_clear_new(int count, UINT8 data = 0) { int oldcount = m_count; resize_keep(count); if (oldcount < m_count) clear_internal(oldcount, m_count - oldcount, data); }
-
- // batch operations
- void copyfrom(const dynamic_array<_ElementType> &source)
- {
- resize(source.count());
- for (int i=0; i < source.count(); i++)
- m_array[i] = source[i];
- }
-
-private:
- // internal helpers
- void expand_internal(int count)
- {
- global_free_array(m_array);
- m_array = global_alloc_array(_ElementType, count);
- m_allocated = count;
- }
-
- void expand_and_keep_internal(int count)
- {
- _ElementType *oldarray = m_array;
- int oldcount = m_count;
- m_array = global_alloc_array(_ElementType, count);
- m_allocated = count;
- for (int index = 0; index < oldcount; index++)
- m_array[index] = oldarray[index];
- global_free_array(oldarray);
- }
-
-#if defined(__GNUC__) && !defined(SDLMAME_MACOSX)
- void clear_internal(UINT32 start, UINT32 count, UINT8 data) { assert(__is_pod(_ElementType)); memset((void *)&m_array[start], data, count * sizeof(*m_array)); }
-#else
- void clear_internal(UINT32 start, UINT32 count, UINT8 data) { memset(&m_array[start], data, count * sizeof(*m_array)); }
-#endif
-
- // internal state
- _ElementType * m_array; // allocated array
- int m_count; // number of objects accessed in the list
- int m_allocated; // amount of space allocated for the array
-};
-typedef dynamic_array<UINT8> dynamic_buffer;
+typedef std::vector<UINT8> dynamic_buffer;
// ======================> simple_list
diff --git a/src/lib/util/huffman.c b/src/lib/util/huffman.c
index 2da37df8194..7e6d1906456 100644
--- a/src/lib/util/huffman.c
+++ b/src/lib/util/huffman.c
@@ -317,9 +317,9 @@ huffman_error huffman_context_base::export_tree_huffman(bitstream_out &bitbuf)
{
// first RLE compress the lengths of all the nodes
dynamic_buffer rle_data(m_numcodes);
- UINT8 *dest = rle_data;
- dynamic_array<UINT16> rle_lengths(m_numcodes/3);
- UINT16 *lengths = rle_lengths;
+ UINT8 *dest = &rle_data[0];
+ std::vector<UINT16> rle_lengths(m_numcodes/3);
+ UINT16 *lengths = &rle_lengths[0];
int last = ~0;
int repcount = 0;
@@ -393,8 +393,8 @@ huffman_error huffman_context_base::export_tree_huffman(bitstream_out &bitbuf)
temp >>= 1, rlefullbits++;
// now encode the RLE data
- lengths = rle_lengths;
- for (UINT8 *src = rle_data; src < dest; src++)
+ lengths = &rle_lengths[0];
+ for (UINT8 *src = &rle_data[0]; src < dest; src++)
{
// encode the data
UINT8 data = *src;
@@ -523,7 +523,7 @@ int CLIB_DECL huffman_context_base::tree_node_compare(const void *item1, const v
int huffman_context_base::build_tree(UINT32 totaldata, UINT32 totalweight)
{
// make a list of all non-zero nodes
- dynamic_array<node_t *> list(m_numcodes * 2);
+ std::vector<node_t *> list(m_numcodes * 2);
int listitems = 0;
memset(m_huffnode, 0, m_numcodes * sizeof(m_huffnode[0]));
for (int curcode = 0; curcode < m_numcodes; curcode++)
@@ -545,7 +545,7 @@ int huffman_context_base::build_tree(UINT32 totaldata, UINT32 totalweight)
}
*/
// sort the list by weight, largest weight first
- qsort(list, listitems, sizeof(list[0]), tree_node_compare);
+ qsort(&list[0], listitems, sizeof(list[0]), tree_node_compare);
/*
fprintf(stderr, "Post-sort:\n");
for (int i = 0; i < listitems; i++) {
diff --git a/src/lib/util/palette.c b/src/lib/util/palette.c
index 4be66ee9f7b..321f5ebca72 100644
--- a/src/lib/util/palette.c
+++ b/src/lib/util/palette.c
@@ -79,7 +79,8 @@ void palette_client::dirty_state::resize(UINT32 colors)
{
// resize to the correct number of dwords and mark all entries dirty
UINT32 dirty_dwords = (colors + 31) / 32;
- m_dirty.resize_and_clear(dirty_dwords, 0xff);
+ m_dirty.resize(dirty_dwords);
+ memset(&m_dirty[0], 0xff, dirty_dwords*4);
// mark all entries dirty
m_dirty[dirty_dwords - 1] &= (1 << (colors % 32)) - 1;
@@ -111,7 +112,7 @@ void palette_client::dirty_state::reset()
{
// erase relevant entries in the new live one
memset(&m_dirty[m_mindirty / 32], 0, ((m_maxdirty / 32) + 1 - (m_mindirty / 32)) * sizeof(UINT32));
- m_mindirty = m_dirty.count() * 32 - 1;
+ m_mindirty = m_dirty.size() * 32 - 1;
m_maxdirty = 0;
}
diff --git a/src/lib/util/palette.h b/src/lib/util/palette.h
index 939138e613d..57bdd1f54a4 100644
--- a/src/lib/util/palette.h
+++ b/src/lib/util/palette.h
@@ -118,7 +118,7 @@ private:
private:
// internal state
- dynamic_array<UINT32> m_dirty; // bitmap of dirty entries
+ std::vector<UINT32> m_dirty; // bitmap of dirty entries
UINT32 m_mindirty; // minimum dirty entry
UINT32 m_maxdirty; // minimum dirty entry
};
@@ -169,9 +169,9 @@ public:
void entry_set_contrast(UINT32 index, float contrast);
// entry list getters
- const rgb_t *entry_list_raw() const { return m_entry_color; }
- const rgb_t *entry_list_adjusted() const { return m_adjusted_color; }
- const rgb_t *entry_list_adjusted_rgb15() const { return m_adjusted_rgb15; }
+ const rgb_t *entry_list_raw() const { return &m_entry_color[0]; }
+ const rgb_t *entry_list_adjusted() const { return &m_adjusted_color[0]; }
+ const rgb_t *entry_list_adjusted_rgb15() const { return &m_adjusted_rgb15[0]; }
// group adjustments
void group_set_brightness(UINT32 group, float brightness);
@@ -199,13 +199,13 @@ private:
float m_gamma; // overall gamma value
UINT8 m_gamma_map[256]; // gamma map
- dynamic_array<rgb_t> m_entry_color; // array of raw colors
- dynamic_array<float> m_entry_contrast; // contrast value for each entry
- dynamic_array<rgb_t> m_adjusted_color; // array of adjusted colors
- dynamic_array<rgb_t> m_adjusted_rgb15; // array of adjusted colors as RGB15
+ std::vector<rgb_t> m_entry_color; // array of raw colors
+ std::vector<float> m_entry_contrast; // contrast value for each entry
+ std::vector<rgb_t> m_adjusted_color; // array of adjusted colors
+ std::vector<rgb_t> m_adjusted_rgb15; // array of adjusted colors as RGB15
- dynamic_array<float> m_group_bright; // brightness value for each group
- dynamic_array<float> m_group_contrast; // contrast value for each group
+ std::vector<float> m_group_bright; // brightness value for each group
+ std::vector<float> m_group_contrast; // contrast value for each group
palette_client *m_client_list; // list of clients for this palette
};
diff --git a/src/mame/drivers/4enlinea.c b/src/mame/drivers/4enlinea.c
index 5380cdf6588..004f8b4902d 100644
--- a/src/mame/drivers/4enlinea.c
+++ b/src/mame/drivers/4enlinea.c
@@ -297,7 +297,7 @@ void isa8_cga_4enlinea_device::device_start()
//m_isa->install_device(0x3bf, 0x3bf, 0, 0, NULL, write8_delegate( FUNC(isa8_cga_4enlinea_device::_4enlinea_mode_control_w), this ) );
m_isa->install_device(0x3d0, 0x3df, 0, 0, read8_delegate( FUNC(isa8_cga_4enlinea_device::_4enlinea_io_read), this ), write8_delegate( FUNC(isa8_cga_device::io_write), this ) );
- m_isa->install_bank(0x8000, 0xbfff, 0, 0, "bank1", m_vram);
+ m_isa->install_bank(0x8000, 0xbfff, 0, 0, "bank1", &m_vram[0]);
/* Initialise the cga palette */
int i;
diff --git a/src/mame/drivers/8080bw.c b/src/mame/drivers/8080bw.c
index 70bb3cffdc4..2c2b9a70b7e 100644
--- a/src/mame/drivers/8080bw.c
+++ b/src/mame/drivers/8080bw.c
@@ -2740,7 +2740,7 @@ DRIVER_INIT_MEMBER(_8080bw_state,vortex)
buf1[addr] = rom[x];
}
- memcpy(rom, buf1, length);
+ memcpy(rom, &buf1[0], length);
}
@@ -3120,7 +3120,7 @@ DRIVER_INIT_MEMBER(_8080bw_state,attackfc)
for (int i = 0; i < len; i++)
buffer[BITSWAP16(i, 15,14,13,12,11,10,8,9, 7,6,5,4,3,2,1,0)] = rom[i];
- memcpy(rom, buffer, len);
+ memcpy(rom, &buffer[0], len);
}
diff --git a/src/mame/drivers/alg.c b/src/mame/drivers/alg.c
index 8537f0682bc..bd674b5fb79 100644
--- a/src/mame/drivers/alg.c
+++ b/src/mame/drivers/alg.c
@@ -690,7 +690,7 @@ DRIVER_INIT_MEMBER(alg_state,palr1)
dynamic_buffer original(length);
UINT32 srcaddr;
- memcpy(original, rom, length);
+ memcpy(&original[0], rom, length);
for (srcaddr = 0; srcaddr < length; srcaddr++)
{
UINT32 dstaddr = srcaddr;
@@ -709,7 +709,7 @@ DRIVER_INIT_MEMBER(alg_state,palr3)
dynamic_buffer original(length);
UINT32 srcaddr;
- memcpy(original, rom, length);
+ memcpy(&original[0], rom, length);
for (srcaddr = 0; srcaddr < length; srcaddr++)
{
UINT32 dstaddr = srcaddr;
@@ -727,7 +727,7 @@ DRIVER_INIT_MEMBER(alg_state,palr6)
dynamic_buffer original(length);
UINT32 srcaddr;
- memcpy(original, rom, length);
+ memcpy(&original[0], rom, length);
for (srcaddr = 0; srcaddr < length; srcaddr++)
{
UINT32 dstaddr = srcaddr;
diff --git a/src/mame/drivers/arkanoid.c b/src/mame/drivers/arkanoid.c
index 7ad631dcaa2..4c668b57101 100644
--- a/src/mame/drivers/arkanoid.c
+++ b/src/mame/drivers/arkanoid.c
@@ -1936,7 +1936,7 @@ DRIVER_INIT_MEMBER(arkanoid_state,block2)
memcpy(&buffer[tile * 8], &srcgfx[srctile * 8], 8);
}
- memcpy(srcgfx, buffer, 0x18000);
+ memcpy(srcgfx, &buffer[0], 0x18000);
m_bootleg_id = BLOCK2;
arkanoid_bootleg_init();
diff --git a/src/mame/drivers/astrafr.c b/src/mame/drivers/astrafr.c
index b6d6f532a76..ea7d0b81999 100644
--- a/src/mame/drivers/astrafr.c
+++ b/src/mame/drivers/astrafr.c
@@ -2090,7 +2090,7 @@ ROM_END
void astra_addresslines( UINT16* src, size_t srcsize, int small )
{
- dynamic_array<UINT16> dst(srcsize/2);
+ std::vector<UINT16> dst(srcsize/2);
int blocksize;
@@ -2106,7 +2106,7 @@ void astra_addresslines( UINT16* src, size_t srcsize, int small )
}
}
- memcpy(src,dst, srcsize);
+ memcpy(src,&dst[0], srcsize);
}
diff --git a/src/mame/drivers/backfire.c b/src/mame/drivers/backfire.c
index f1453ef8ab7..637656d11d3 100644
--- a/src/mame/drivers/backfire.c
+++ b/src/mame/drivers/backfire.c
@@ -700,7 +700,7 @@ void backfire_state::descramble_sound()
buf1[addr] = rom[x];
}
- memcpy(rom, buf1, length);
+ memcpy(rom, &buf1[0], length);
}
READ32_MEMBER(backfire_state::backfire_speedup_r)
diff --git a/src/mame/drivers/bfcobra.c b/src/mame/drivers/bfcobra.c
index 8d3acb9f8eb..ef9cbb56427 100644
--- a/src/mame/drivers/bfcobra.c
+++ b/src/mame/drivers/bfcobra.c
@@ -1665,7 +1665,7 @@ DRIVER_INIT_MEMBER(bfcobra_state,bfcobra)
dynamic_buffer tmp(0x8000);
rom = memregion("audiocpu")->base() + 0x8000;
- memcpy(tmp, rom, 0x8000);
+ memcpy(&tmp[0], rom, 0x8000);
for (i = 0; i < 0x8000; i++)
{
diff --git a/src/mame/drivers/bfm_sc45_helper.c b/src/mame/drivers/bfm_sc45_helper.c
index 791c4f17ec7..d46afca2d12 100644
--- a/src/mame/drivers/bfm_sc45_helper.c
+++ b/src/mame/drivers/bfm_sc45_helper.c
@@ -782,7 +782,7 @@ int find_reel_strings(running_machine &machine)
int startblock = -1;
int endblock = -1;
- dynamic_array<int> reelsizes;
+ std::vector<int> reelsizes;
// these are for sc4dnd ONLY, need to work out how the code calculates them
@@ -790,37 +790,37 @@ int find_reel_strings(running_machine &machine)
// code that points at these is likely to be complex because it's conditional on the game code / mode..
if (!strcmp(machine.system().name, "sc4dnd"))
{
- reelsizes.append(16);
- reelsizes.append(16);
- reelsizes.append(16);
- reelsizes.append(16);
- reelsizes.append(12);
- reelsizes.append(16);
- reelsizes.append(16);
+ reelsizes.push_back(16);
+ reelsizes.push_back(16);
+ reelsizes.push_back(16);
+ reelsizes.push_back(16);
+ reelsizes.push_back(12);
+ reelsizes.push_back(16);
+ reelsizes.push_back(16);
startblock = 0x8d74c;
}
else if (!strcmp(machine.system().name, "sc4dndtp"))
{
- reelsizes.append(16);
- reelsizes.append(16);
- reelsizes.append(16);
- reelsizes.append(12);
- reelsizes.append(16);
- reelsizes.append(16);
- reelsizes.append(16);
+ reelsizes.push_back(16);
+ reelsizes.push_back(16);
+ reelsizes.push_back(16);
+ reelsizes.push_back(12);
+ reelsizes.push_back(16);
+ reelsizes.push_back(16);
+ reelsizes.push_back(16);
startblock = 0x9d252;
}
else if (!strcmp(machine.system().name, "sc4dnddw"))
{
- reelsizes.append(16);
- reelsizes.append(16);
- reelsizes.append(16);
- reelsizes.append(12);
- reelsizes.append(20);
- reelsizes.append(20);
- reelsizes.append(20);
+ reelsizes.push_back(16);
+ reelsizes.push_back(16);
+ reelsizes.push_back(16);
+ reelsizes.push_back(12);
+ reelsizes.push_back(20);
+ reelsizes.push_back(20);
+ reelsizes.push_back(20);
startblock = 0x9b8c8;
}
@@ -828,7 +828,7 @@ int find_reel_strings(running_machine &machine)
int total_reel_symbols = 0;
- for (int i = 0; i < reelsizes.count(); i++)
+ for (unsigned int i = 0; i < reelsizes.size(); i++)
{
total_reel_symbols += reelsizes[i];
}
diff --git a/src/mame/drivers/blktiger.c b/src/mame/drivers/blktiger.c
index 6d80adc6821..e10a34b37f6 100644
--- a/src/mame/drivers/blktiger.c
+++ b/src/mame/drivers/blktiger.c
@@ -610,7 +610,7 @@ DRIVER_INIT_MEMBER(blktiger_state,blktigerb3)
}
- memcpy(src, buffer, len);
+ memcpy(src, &buffer[0], len);
}
GAME( 1987, blktiger, 0, blktiger, blktiger, driver_device, 0, ROT0, "Capcom", "Black Tiger", GAME_SUPPORTS_SAVE )
GAME( 1987, blktigera, blktiger, blktiger, blktiger, driver_device, 0, ROT0, "Capcom", "Black Tiger (older)", GAME_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/cave.c b/src/mame/drivers/cave.c
index 2646f315900..2e8c996f9d9 100644
--- a/src/mame/drivers/cave.c
+++ b/src/mame/drivers/cave.c
@@ -4818,7 +4818,7 @@ DRIVER_INIT_MEMBER(cave_state,mazinger)
int i;
for (i = 0; i < len; i++)
buffer[i ^ 0xdf88] = src[BITSWAP24(i,23,22,21,20,19,9,7,3,15,4,17,14,18,2,16,5,11,8,6,13,1,10,12,0)];
- memcpy(src, buffer, len);
+ memcpy(src, &buffer[0], len);
}
unpack_sprites("sprites0");
@@ -4885,7 +4885,7 @@ DRIVER_INIT_MEMBER(cave_state,pwrinst2j)
buffer[j ^ 7] = (src[i] >> 4) | (src[i] << 4);
}
- memcpy(src,buffer,len);
+ memcpy(src,&buffer[0],len);
}
unpack_sprites("sprites0");
@@ -4933,7 +4933,7 @@ DRIVER_INIT_MEMBER(cave_state,sailormn)
int i;
for (i = 0; i < len; i++)
buffer[i ^ 0x950c4] = src[BITSWAP24(i,23,22,21,20,15,10,12,6,11,1,13,3,16,17,2,5,14,7,18,8,4,19,9,0)];
- memcpy(src, buffer, len);
+ memcpy(src, &buffer[0], len);
}
sailormn_unpack_tiles("layer2");
diff --git a/src/mame/drivers/coinmstr.c b/src/mame/drivers/coinmstr.c
index c9dbbf41822..52e8037adb9 100644
--- a/src/mame/drivers/coinmstr.c
+++ b/src/mame/drivers/coinmstr.c
@@ -1746,7 +1746,7 @@ DRIVER_INIT_MEMBER(coinmstr_state,coinmstr)
dynamic_buffer buf(length);
int i;
- memcpy(buf,rom,length);
+ memcpy(&buf[0],rom,length);
for(i = 0; i < length; i++)
{
diff --git a/src/mame/drivers/cps2.c b/src/mame/drivers/cps2.c
index f0ea66d2582..db2af7c6cf5 100644
--- a/src/mame/drivers/cps2.c
+++ b/src/mame/drivers/cps2.c
@@ -8646,9 +8646,9 @@ void cps_state::gigaman2_gfx_reorder()
int i;
int length = memregion( "gfx" )->bytes();
UINT16 *rom = (UINT16 *)memregion("gfx")->base();
- dynamic_array<UINT16> buf( length );
+ std::vector<UINT16> buf( length );
- memcpy (buf, rom, length);
+ memcpy (&buf[0], rom, length);
for (i = 0; i < length/2; i++) {
rom[i] = buf[((i & ~7) >> 2) | ((i & 4) << 18) | ((i & 2) >> 1) | ((i & 1) << 21)];
diff --git a/src/mame/drivers/crimfght.c b/src/mame/drivers/crimfght.c
index abc1fe85cb3..e37e69afe05 100644
--- a/src/mame/drivers/crimfght.c
+++ b/src/mame/drivers/crimfght.c
@@ -237,7 +237,7 @@ WRITE8_MEMBER( crimfght_state::banking_callback )
{
m_maincpu->space(AS_PROGRAM).install_read_bank(0x0000, 0x03ff, "bank3");
m_maincpu->space(AS_PROGRAM).install_write_handler(0x0000, 0x03ff, write8_delegate(FUNC(palette_device::write), m_palette.target()));
- membank("bank3")->set_base(m_paletteram);
+ membank("bank3")->set_base(&m_paletteram[0]);
}
else
m_maincpu->space(AS_PROGRAM).install_readwrite_bank(0x0000, 0x03ff, "bank1"); /* RAM */
diff --git a/src/mame/drivers/darkmist.c b/src/mame/drivers/darkmist.c
index 3b18e306571..88220bb8625 100644
--- a/src/mame/drivers/darkmist.c
+++ b/src/mame/drivers/darkmist.c
@@ -436,7 +436,7 @@ DRIVER_INIT_MEMBER(darkmist_state,darkmist)
/* adr line swaps */
ROM = memregion("user1")->base();
len = memregion("user1")->bytes();
- memcpy( buffer, ROM, len );
+ memcpy( &buffer[0], ROM, len );
for(i=0;i<len;i++)
{
@@ -445,7 +445,7 @@ DRIVER_INIT_MEMBER(darkmist_state,darkmist)
ROM = memregion("user2")->base();
len = memregion("user2")->bytes();
- memcpy( buffer, ROM, len );
+ memcpy( &buffer[0], ROM, len );
for(i=0;i<len;i++)
{
ROM[i]=buffer[BITSWAP24(i,23,22,21,20,19,18,17,16,15,6,5,4,3,2,14,13,12,11,8,7,1,0,10,9)];
@@ -453,7 +453,7 @@ DRIVER_INIT_MEMBER(darkmist_state,darkmist)
ROM = memregion("user3")->base();
len = memregion("user3")->bytes();
- memcpy( buffer, ROM, len );
+ memcpy( &buffer[0], ROM, len );
for(i=0;i<len;i++)
{
ROM[i]=buffer[BITSWAP24(i,23,22,21,20,19,18,17,16,15,14 ,5,4,3,2,11,10,9,8,13,12,1,0,7,6)];
@@ -461,7 +461,7 @@ DRIVER_INIT_MEMBER(darkmist_state,darkmist)
ROM = memregion("user4")->base();
len = memregion("user4")->bytes();
- memcpy( buffer, ROM, len );
+ memcpy( &buffer[0], ROM, len );
for(i=0;i<len;i++)
{
ROM[i]=buffer[BITSWAP24(i,23,22,21,20,19,18,17,16,15,14 ,5,4,3,2,11,10,9,8,13,12,1,0,7,6)];
diff --git a/src/mame/drivers/dassault.c b/src/mame/drivers/dassault.c
index 6ed22a1c85b..61d66b8d640 100644
--- a/src/mame/drivers/dassault.c
+++ b/src/mame/drivers/dassault.c
@@ -979,8 +979,8 @@ DRIVER_INIT_MEMBER(dassault_state,dassault)
/* Playfield 4 also has access to the char graphics, make things easier
by just copying the chars to both banks (if I just used a different gfx
bank then the colours would be wrong). */
- memcpy(tmp + 0x000000, dst + 0x80000, 0x80000);
- memcpy(dst + 0x090000, tmp + 0x00000, 0x80000);
+ memcpy(&tmp[0x000000], dst + 0x80000, 0x80000);
+ memcpy(dst + 0x090000, &tmp[0x00000], 0x80000);
memcpy(dst + 0x080000, src + 0x00000, 0x10000);
memcpy(dst + 0x110000, src + 0x10000, 0x10000);
}
@@ -994,8 +994,8 @@ DRIVER_INIT_MEMBER(dassault_state,thndzone)
/* Playfield 4 also has access to the char graphics, make things easier
by just copying the chars to both banks (if I just used a different gfx
bank then the colours would be wrong). */
- memcpy(tmp + 0x000000, dst + 0x80000, 0x80000);
- memcpy(dst + 0x090000, tmp + 0x00000, 0x80000);
+ memcpy(&tmp[0x000000], dst + 0x80000, 0x80000);
+ memcpy(dst + 0x090000, &tmp[0x00000], 0x80000);
memcpy(dst + 0x080000, src + 0x00000, 0x10000);
memcpy(dst + 0x110000, src + 0x10000, 0x10000);
}
diff --git a/src/mame/drivers/ddayjlc.c b/src/mame/drivers/ddayjlc.c
index 664c564b396..5bba011e391 100644
--- a/src/mame/drivers/ddayjlc.c
+++ b/src/mame/drivers/ddayjlc.c
@@ -662,7 +662,7 @@ DRIVER_INIT_MEMBER(ddayjlc_state,ddayjlc)
UINT32 oldaddr, newadr, length,j;
UINT8 *src, *dst;
dynamic_buffer temp(0x10000);
- src = temp;
+ src = &temp[0];
dst = memregion("gfx1")->base();
length = memregion("gfx1")->bytes();
memcpy(src, dst, length);
diff --git a/src/mame/drivers/deco156.c b/src/mame/drivers/deco156.c
index 19de26d0249..6790bf98ae8 100644
--- a/src/mame/drivers/deco156.c
+++ b/src/mame/drivers/deco156.c
@@ -653,7 +653,7 @@ void deco156_state::descramble_sound( const char *tag )
buf1[addr] = rom[x];
}
- memcpy(rom,buf1,length);
+ memcpy(rom,&buf1[0],length);
}
DRIVER_INIT_MEMBER(deco156_state,hvysmsh)
diff --git a/src/mame/drivers/deco32.c b/src/mame/drivers/deco32.c
index 962b68bae97..859ccc328bb 100644
--- a/src/mame/drivers/deco32.c
+++ b/src/mame/drivers/deco32.c
@@ -3699,14 +3699,14 @@ DRIVER_INIT_MEMBER(deco32_state,tattass)
dynamic_buffer tmp(0x80000);
/* Reorder bitplanes to make decoding easier */
- memcpy(tmp,RAM+0x80000,0x80000);
+ memcpy(&tmp[0],RAM+0x80000,0x80000);
memcpy(RAM+0x80000,RAM+0x100000,0x80000);
- memcpy(RAM+0x100000,tmp,0x80000);
+ memcpy(RAM+0x100000,&tmp[0],0x80000);
RAM = memregion("gfx2")->base();
- memcpy(tmp,RAM+0x80000,0x80000);
+ memcpy(&tmp[0],RAM+0x80000,0x80000);
memcpy(RAM+0x80000,RAM+0x100000,0x80000);
- memcpy(RAM+0x100000,tmp,0x80000);
+ memcpy(RAM+0x100000,&tmp[0],0x80000);
deco56_decrypt_gfx(machine(), "gfx1"); /* 141 */
deco56_decrypt_gfx(machine(), "gfx2"); /* 141 */
@@ -3718,14 +3718,14 @@ DRIVER_INIT_MEMBER(deco32_state,nslasher)
dynamic_buffer tmp(0x80000);
/* Reorder bitplanes to make decoding easier */
- memcpy(tmp,RAM+0x80000,0x80000);
+ memcpy(&tmp[0],RAM+0x80000,0x80000);
memcpy(RAM+0x80000,RAM+0x100000,0x80000);
- memcpy(RAM+0x100000,tmp,0x80000);
+ memcpy(RAM+0x100000,&tmp[0],0x80000);
RAM = memregion("gfx2")->base();
- memcpy(tmp,RAM+0x80000,0x80000);
+ memcpy(&tmp[0],RAM+0x80000,0x80000);
memcpy(RAM+0x80000,RAM+0x100000,0x80000);
- memcpy(RAM+0x100000,tmp,0x80000);
+ memcpy(RAM+0x100000,&tmp[0],0x80000);
deco56_decrypt_gfx(machine(), "gfx1"); /* 141 */
deco74_decrypt_gfx(machine(), "gfx2");
diff --git a/src/mame/drivers/deco_mlc.c b/src/mame/drivers/deco_mlc.c
index c221cd083a4..0e67d45d7f3 100644
--- a/src/mame/drivers/deco_mlc.c
+++ b/src/mame/drivers/deco_mlc.c
@@ -819,7 +819,7 @@ void deco_mlc_state::descramble_sound( )
buf1[addr] = rom[x];
}
- memcpy(rom,buf1,length);
+ memcpy(rom,&buf1[0],length);
}
READ32_MEMBER(deco_mlc_state::avengrgs_speedup_r)
diff --git a/src/mame/drivers/dynax.c b/src/mame/drivers/dynax.c
index a565d8b502c..6abb317316e 100644
--- a/src/mame/drivers/dynax.c
+++ b/src/mame/drivers/dynax.c
@@ -5458,7 +5458,7 @@ DRIVER_INIT_MEMBER(dynax_state,maya)
/* Address lines scrambling on the blitter data roms */
{
dynamic_buffer rom(0xc0000);
- memcpy(rom, gfx, 0xc0000);
+ memcpy(&rom[0], gfx, 0xc0000);
for (i = 0; i < 0xc0000; i++)
gfx[i] = rom[BITSWAP24(i,23,22,21,20,19,18,14,15, 16,17,13,12,11,10,9,8, 7,6,5,4,3,2,1,0)];
}
@@ -6290,7 +6290,7 @@ DRIVER_INIT_MEMBER(dynax_state,mjelct3)
size_t size = memregion("maincpu")->bytes();
dynamic_buffer rom1(size);
- memcpy(rom1, rom, size);
+ memcpy(&rom1[0], rom, size);
for (i = 0; i < size; i++)
rom[i] = BITSWAP8(rom1[BITSWAP24(i,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8, 1,6,5,4,3,2,7, 0)], 7,6, 1,4,3,2,5,0);
}
@@ -6302,7 +6302,7 @@ DRIVER_INIT_MEMBER(dynax_state,mjelct3a)
size_t size = memregion("maincpu")->bytes();
dynamic_buffer rom1(size);
- memcpy(rom1, rom, size);
+ memcpy(&rom1[0], rom, size);
for (i = 0; i < size; i++)
{
j = i & ~0x7e00;
diff --git a/src/mame/drivers/exerion.c b/src/mame/drivers/exerion.c
index b01ffcdf4cd..bd15e7834b7 100644
--- a/src/mame/drivers/exerion.c
+++ b/src/mame/drivers/exerion.c
@@ -513,7 +513,7 @@ DRIVER_INIT_MEMBER(exerion_state,exerion)
dynamic_buffer temp(0x10000);
/* make a temporary copy of the character data */
- src = temp;
+ src = &temp[0];
dst = memregion("gfx1")->base();
length = memregion("gfx1")->bytes();
memcpy(src, dst, length);
@@ -531,7 +531,7 @@ DRIVER_INIT_MEMBER(exerion_state,exerion)
}
/* make a temporary copy of the sprite data */
- src = temp;
+ src = &temp[0];
dst = memregion("gfx2")->base();
length = memregion("gfx2")->bytes();
memcpy(src, dst, length);
diff --git a/src/mame/drivers/fcombat.c b/src/mame/drivers/fcombat.c
index 96f2743d93e..616da0691ed 100644
--- a/src/mame/drivers/fcombat.c
+++ b/src/mame/drivers/fcombat.c
@@ -328,7 +328,7 @@ DRIVER_INIT_MEMBER(fcombat_state,fcombat)
dynamic_buffer temp(0x10000);
/* make a temporary copy of the character data */
- src = temp;
+ src = &temp[0];
dst = memregion("gfx1")->base();
length = memregion("gfx1")->bytes();
memcpy(src, dst, length);
@@ -346,7 +346,7 @@ DRIVER_INIT_MEMBER(fcombat_state,fcombat)
}
/* make a temporary copy of the sprite data */
- src = temp;
+ src = &temp[0];
dst = memregion("gfx2")->base();
length = memregion("gfx2")->bytes();
memcpy(src, dst, length);
@@ -367,7 +367,7 @@ DRIVER_INIT_MEMBER(fcombat_state,fcombat)
}
/* make a temporary copy of the character data */
- src = temp;
+ src = &temp[0];
dst = memregion("gfx3")->base();
length = memregion("gfx3")->bytes();
memcpy(src, dst, length);
@@ -386,7 +386,7 @@ DRIVER_INIT_MEMBER(fcombat_state,fcombat)
dst[newaddr] = src[oldaddr];
}
- src = temp;
+ src = &temp[0];
dst = memregion("user1")->base();
length = memregion("user1")->bytes();
memcpy(src, dst, length);
@@ -398,7 +398,7 @@ DRIVER_INIT_MEMBER(fcombat_state,fcombat)
}
- src = temp;
+ src = &temp[0];
dst = memregion("user2")->base();
length = memregion("user2")->bytes();
memcpy(src, dst, length);
diff --git a/src/mame/drivers/flyball.c b/src/mame/drivers/flyball.c
index 4d06d03db9f..d60b1dcdbc2 100644
--- a/src/mame/drivers/flyball.c
+++ b/src/mame/drivers/flyball.c
@@ -427,7 +427,7 @@ void flyball_state::machine_start()
dynamic_buffer buf(len);
for (int i = 0; i < len; i++)
buf[i ^ 0x1ff] = ROM[i];
- memcpy(ROM, buf, len);
+ memcpy(ROM, &buf[0], len);
m_pot_clear_timer = timer_alloc(TIMER_POT_CLEAR);
m_quarter_timer = timer_alloc(TIMER_QUARTER);
diff --git a/src/mame/drivers/forte2.c b/src/mame/drivers/forte2.c
index c6e74670df4..2fcd243e912 100644
--- a/src/mame/drivers/forte2.c
+++ b/src/mame/drivers/forte2.c
@@ -140,7 +140,7 @@ DRIVER_INIT_MEMBER(forte2_state,pesadelo)
// address line swap
dynamic_buffer buf(memsize);
- memcpy(buf, mem, memsize);
+ memcpy(&buf[0], mem, memsize);
for ( i = 0; i < memsize; i++ )
{
mem[BITSWAP16(i,11,9,8,13,14,15,12,7,6,5,4,3,2,1,0,10)] = buf[i];
diff --git a/src/mame/drivers/funworld.c b/src/mame/drivers/funworld.c
index f27c3e12cfb..71aef33b480 100644
--- a/src/mame/drivers/funworld.c
+++ b/src/mame/drivers/funworld.c
@@ -5883,7 +5883,7 @@ DRIVER_INIT_MEMBER(funworld_state, saloon)
{
dynamic_buffer buffer(size);
- memcpy(buffer, rom, size);
+ memcpy(&buffer[0], rom, size);
/* address lines swap: fedcba9876543210 -> fedcba9820134567 */
@@ -5902,7 +5902,7 @@ DRIVER_INIT_MEMBER(funworld_state, saloon)
{
dynamic_buffer buffer(sizeg);
- memcpy(buffer, gfxrom, sizeg);
+ memcpy(&buffer[0], gfxrom, sizeg);
/* address lines swap: fedcba9876543210 -> fedcb67584a39012 */
@@ -5927,7 +5927,7 @@ DRIVER_INIT_MEMBER(funworld_state, saloon)
{
dynamic_buffer buffer(sizep);
- memcpy(buffer, prom, sizep);
+ memcpy(&buffer[0], prom, sizep);
/* address lines swap: fedcba9876543210 -> fedcba9487652013 */
@@ -6068,7 +6068,7 @@ DRIVER_INIT_MEMBER(funworld_state, dino4)
{
dynamic_buffer buffer(size);
- memcpy(buffer, rom, size);
+ memcpy(&buffer[0], rom, size);
/* address lines swap: fedcba9876543210 -> fedcba9867543210 */
@@ -6087,7 +6087,7 @@ DRIVER_INIT_MEMBER(funworld_state, dino4)
{
dynamic_buffer buffer(sizeg);
- memcpy(buffer, gfxrom, sizeg);
+ memcpy(&buffer[0], gfxrom, sizeg);
/* address lines swap: fedcba9876543210 -> fedcb67584a39012 */
@@ -6172,7 +6172,7 @@ static void decrypt_rcdino4(UINT8 *rom, int size, UINT8 *gfxrom, int sizeg, UINT
{
dynamic_buffer buffer(size);
- memcpy(buffer, rom, size);
+ memcpy(&buffer[0], rom, size);
/* address lines swap: fedcba9876543210 -> fedcba9867543210 */
@@ -6191,7 +6191,7 @@ static void decrypt_rcdino4(UINT8 *rom, int size, UINT8 *gfxrom, int sizeg, UINT
{
dynamic_buffer buffer(sizeg);
- memcpy(buffer, gfxrom, sizeg);
+ memcpy(&buffer[0], gfxrom, sizeg);
/* address lines swap: fedcba9876543210 -> fedcb67584a39012 */
diff --git a/src/mame/drivers/gaiden.c b/src/mame/drivers/gaiden.c
index 0ae049adba3..ffd18e4b22c 100644
--- a/src/mame/drivers/gaiden.c
+++ b/src/mame/drivers/gaiden.c
@@ -1561,7 +1561,7 @@ void gaiden_state::descramble_drgnbowl(int descramble_cpu)
{
dynamic_buffer buffer(size);
- memcpy(buffer, ROM, size);
+ memcpy(&buffer[0], ROM, size);
for( i = 0; i < size; i++ )
{
ROM[i] = buffer[BITSWAP24(i,23,22,21,20,
@@ -1578,7 +1578,7 @@ void gaiden_state::descramble_drgnbowl(int descramble_cpu)
{
dynamic_buffer buffer(size);
- memcpy(buffer,ROM,size);
+ memcpy(&buffer[0],ROM,size);
for( i = 0; i < size; i++ )
{
ROM[i] = buffer[BITSWAP24(i,23,22,21,20,
@@ -1623,7 +1623,7 @@ void gaiden_state::descramble_mastninj_gfx(UINT8* src)
7,6,4,
3,2,1,0)];
}
- memcpy(src, buffer, len);
+ memcpy(src, &buffer[0], len);
}
{
@@ -1639,7 +1639,7 @@ void gaiden_state::descramble_mastninj_gfx(UINT8* src)
7,5,4,
3,2,1,0)];
}
- memcpy(src, buffer, len);
+ memcpy(src, &buffer[0], len);
}
}
diff --git a/src/mame/drivers/galaxian.c b/src/mame/drivers/galaxian.c
index da85af50ecb..8975398f84c 100644
--- a/src/mame/drivers/galaxian.c
+++ b/src/mame/drivers/galaxian.c
@@ -5767,7 +5767,7 @@ void galaxian_state::decode_anteater_gfx()
dynamic_buffer scratch(romlength);
UINT32 offs;
- memcpy(scratch, rombase, romlength);
+ memcpy(&scratch[0], rombase, romlength);
for (offs = 0; offs < romlength; offs++)
{
UINT32 srcoffs = offs & 0x9bf;
@@ -5786,7 +5786,7 @@ void galaxian_state::decode_losttomb_gfx()
dynamic_buffer scratch(romlength);
UINT32 offs;
- memcpy(scratch, rombase, romlength);
+ memcpy(&scratch[0], rombase, romlength);
for (offs = 0; offs < romlength; offs++)
{
UINT32 srcoffs = offs & 0xa7f;
diff --git a/src/mame/drivers/galaxold.c b/src/mame/drivers/galaxold.c
index a6d5313c763..6f58a9f0582 100644
--- a/src/mame/drivers/galaxold.c
+++ b/src/mame/drivers/galaxold.c
@@ -3019,11 +3019,11 @@ DRIVER_INIT_MEMBER(galaxold_state,ckonggx)
for (int i=0;i<88;i++)
{
- memcpy(buffer+i*0x100, rom+ckonggx_remap[i], 0x100);
+ memcpy(&buffer[i*0x100], rom+ckonggx_remap[i], 0x100);
}
- memcpy(rom, buffer, 0x5800);
+ memcpy(rom, &buffer[0], 0x5800);
}
diff --git a/src/mame/drivers/gauntlet.c b/src/mame/drivers/gauntlet.c
index ef8253a71d5..3bf38312812 100644
--- a/src/mame/drivers/gauntlet.c
+++ b/src/mame/drivers/gauntlet.c
@@ -1673,7 +1673,7 @@ DRIVER_INIT_MEMBER(gauntlet_state,vindctr2)
/* highly strange -- the address bits on the chip at 2J (and only that
chip) are scrambled -- this is verified on the schematics! */
- memcpy(data, &gfx2_base[0x88000], 0x8000);
+ memcpy(&data[0], &gfx2_base[0x88000], 0x8000);
for (i = 0; i < 0x8000; i++)
{
int srcoffs = (i & 0x4000) | ((i << 11) & 0x3800) | ((i >> 3) & 0x07ff);
diff --git a/src/mame/drivers/goldstar.c b/src/mame/drivers/goldstar.c
index 9bf3b2ebb08..cf6c19225cd 100644
--- a/src/mame/drivers/goldstar.c
+++ b/src/mame/drivers/goldstar.c
@@ -12424,12 +12424,12 @@ void cb3_state::do_blockswaps(UINT8* ROM)
};
dynamic_buffer buffer(0x10000);
- memcpy(buffer,ROM,0x10000);
+ memcpy(&buffer[0],ROM,0x10000);
// swap some 0x800 blocks around..
for (A =0;A<32; A++)
{
- memcpy(ROM+A*0x800,buffer+cherry_swaptables[A],0x800);
+ memcpy(ROM+A*0x800,&buffer[cherry_swaptables[A]],0x800);
}
}
diff --git a/src/mame/drivers/halleys.c b/src/mame/drivers/halleys.c
index f78536c7245..2296988e3a7 100644
--- a/src/mame/drivers/halleys.c
+++ b/src/mame/drivers/halleys.c
@@ -246,7 +246,7 @@ public:
emu_timer *m_blitter_reset_timer;
offs_t m_collision_detection;
int m_latch_delay;
- dynamic_array<UINT8> m_paletteram;
+ std::vector<UINT8> m_paletteram;
DECLARE_WRITE8_MEMBER(bgtile_w);
DECLARE_READ8_MEMBER(blitter_status_r);
@@ -1191,7 +1191,7 @@ void halleys_state::halleys_decode_rgb(UINT32 *r, UINT32 *g, UINT32 *b, int addr
int bit0, bit1, bit2, bit3, bit4;
// the four 16x4-bit SN74S189 SRAM chips are assumed be the game's 32-byte palette RAM
- sram_189 = m_paletteram;
+ sram_189 = &m_paletteram[0];
// each of the three 32-byte 6330 PROM is wired to an RGB component output
prom_6330 = memregion("proms")->base();
diff --git a/src/mame/drivers/hng64.c b/src/mame/drivers/hng64.c
index c467840648d..057be66d485 100644
--- a/src/mame/drivers/hng64.c
+++ b/src/mame/drivers/hng64.c
@@ -1396,11 +1396,11 @@ static void hng64_reorder( UINT8* gfxregion, size_t gfxregionsize)
for (i=0;i<gfxregionsize/2;i+=tilesize)
{
- memcpy((buffer+i*2)+tilesize, gfxregion+i, tilesize);
- memcpy((buffer+i*2), gfxregion+i+(gfxregionsize/2), tilesize);
+ memcpy(&buffer[i*2+tilesize], gfxregion+i, tilesize);
+ memcpy(&buffer[i*2], gfxregion+i+(gfxregionsize/2), tilesize);
}
- memcpy(gfxregion, buffer, gfxregionsize);
+ memcpy(gfxregion, &buffer[0], gfxregionsize);
}
DRIVER_INIT_MEMBER(hng64_state,hng64_reorder_gfx)
diff --git a/src/mame/drivers/igs011.c b/src/mame/drivers/igs011.c
index 666714e6289..b658c727382 100644
--- a/src/mame/drivers/igs011.c
+++ b/src/mame/drivers/igs011.c
@@ -792,7 +792,7 @@ void igs011_state::lhb2_decrypt()
int i,j;
int rom_size = 0x80000;
UINT16 *src = (UINT16 *) (memregion("maincpu")->base());
- dynamic_array<UINT16> result_data(rom_size/2);
+ std::vector<UINT16> result_data(rom_size/2);
for (i=0; i<rom_size/2; i++)
{
@@ -812,7 +812,7 @@ void igs011_state::lhb2_decrypt()
result_data[j] = x;
}
- memcpy(src,result_data,rom_size);
+ memcpy(src,&result_data[0],rom_size);
}
@@ -822,7 +822,7 @@ void igs011_state::nkishusp_decrypt()
int i,j;
int rom_size = 0x80000;
UINT16 *src = (UINT16 *) (memregion("maincpu")->base());
- dynamic_array<UINT16> result_data(rom_size/2);
+ std::vector<UINT16> result_data(rom_size/2);
for (i=0; i<rom_size/2; i++)
{
@@ -850,7 +850,7 @@ void igs011_state::nkishusp_decrypt()
result_data[j] = x;
}
- memcpy(src,result_data,rom_size);
+ memcpy(src,&result_data[0],rom_size);
}
@@ -979,7 +979,7 @@ void igs011_state::lhb2_decrypt_gfx()
for (i=0; i<rom_size; i++)
result_data[i] = src[BITSWAP24(i, 23,22,21,20, 19, 17,16,15, 13,12, 10,9,8,7,6,5,4, 2,1, 3, 11, 14, 18, 0)];
- memcpy(src,result_data,rom_size);
+ memcpy(src,&result_data[0],rom_size);
}
void igs011_state::drgnwrld_gfx_decrypt()
@@ -992,7 +992,7 @@ void igs011_state::drgnwrld_gfx_decrypt()
for (i=0; i<rom_size; i++)
result_data[i] = src[BITSWAP24(i, 23,22,21,20,19,18,17,16,15, 12, 13, 14, 11,10,9,8,7,6,5,4,3,2,1,0)];
- memcpy(src,result_data,rom_size);
+ memcpy(src,&result_data[0],rom_size);
}
diff --git a/src/mame/drivers/igs017.c b/src/mame/drivers/igs017.c
index d8e6375005a..47b39ec78f7 100644
--- a/src/mame/drivers/igs017.c
+++ b/src/mame/drivers/igs017.c
@@ -689,7 +689,7 @@ void igs017_state::mgcs_decrypt_tiles()
dynamic_buffer tmp(length);
int i;
- memcpy(tmp,rom,length);
+ memcpy(&tmp[0],rom,length);
for (i = 0;i < length;i++)
{
int addr = (i & ~0xffff) | BITSWAP16(i,15,14,13,12,11,10,6,7,8,9,5,4,3,2,1,0);
@@ -983,7 +983,7 @@ void igs017_state::lhzb2_decrypt_tiles()
int i;
int addr;
- memcpy(tmp, rom, length);
+ memcpy(&tmp[0], rom, length);
for (i = 0; i < length; i++)
{
addr = (i & ~0xffffff) | BITSWAP24(i,23,22,21,20,19,18,17,1,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,0);
@@ -1207,7 +1207,7 @@ void igs017_state::slqz2_decrypt_tiles()
dynamic_buffer tmp(length);
int i;
- memcpy(tmp,rom,length);
+ memcpy(&tmp[0],rom,length);
for (i = 0;i < length;i++)
{
int addr = (i & ~0xff) | BITSWAP8(i,7,4,5,6,3,2,1,0);
diff --git a/src/mame/drivers/igs_m027.c b/src/mame/drivers/igs_m027.c
index a352f0e4c53..75649925892 100644
--- a/src/mame/drivers/igs_m027.c
+++ b/src/mame/drivers/igs_m027.c
@@ -296,10 +296,10 @@ void igs_m027_state::sdwx_gfx_decrypt()
for (i=0; i<rom_size; i+=0x200)
{
- memcpy(src+i+0x000,result_data+i+0x000,0x80);
- memcpy(src+i+0x080,result_data+i+0x100,0x80);
- memcpy(src+i+0x100,result_data+i+0x080,0x80);
- memcpy(src+i+0x180,result_data+i+0x180,0x80);
+ memcpy(src+i+0x000,&result_data[i+0x000],0x80);
+ memcpy(src+i+0x080,&result_data[i+0x100],0x80);
+ memcpy(src+i+0x100,&result_data[i+0x080],0x80);
+ memcpy(src+i+0x180,&result_data[i+0x180],0x80);
}
}
diff --git a/src/mame/drivers/igspoker.c b/src/mame/drivers/igspoker.c
index f692235f18d..85b1e1df752 100644
--- a/src/mame/drivers/igspoker.c
+++ b/src/mame/drivers/igspoker.c
@@ -2328,7 +2328,7 @@ DRIVER_INIT_MEMBER(igspoker_state,number10)
rom = memregion("gfx1")->base();
length = memregion("gfx1")->bytes();
dynamic_buffer tmp(length);
- memcpy(tmp,rom,length);
+ memcpy(&tmp[0],rom,length);
for (A = 0;A < length;A++)
{
int addr = (A & ~0xffff) | BITSWAP16(A,15,14,13,12,11,10,9,8,7,6,5,4,3,0,1,2);
diff --git a/src/mame/drivers/jclub2.c b/src/mame/drivers/jclub2.c
index 6af6dbfb098..acd9a37614f 100644
--- a/src/mame/drivers/jclub2.c
+++ b/src/mame/drivers/jclub2.c
@@ -1320,7 +1320,7 @@ DRIVER_INIT_MEMBER(darkhors_state,darkhors)
for (i = 0; i < len; i++)
temp[i] = eeprom[BITSWAP8(i,7,5,4,3,2,1,0,6)];
- memcpy(eeprom, temp, len);
+ memcpy(eeprom, &temp[0], len);
}
}
diff --git a/src/mame/drivers/kas89.c b/src/mame/drivers/kas89.c
index 9992ba69903..4a03d908eec 100644
--- a/src/mame/drivers/kas89.c
+++ b/src/mame/drivers/kas89.c
@@ -854,7 +854,7 @@ DRIVER_INIT_MEMBER(kas89_state,kas89)
/* Unscrambling address lines */
dynamic_buffer buf(memsize);
- memcpy(buf, mem, memsize);
+ memcpy(&buf[0], mem, memsize);
for ( i = 0; i < memsize; i++ )
{
mem[BITSWAP16(i,15,14,5,6,3,0,12,1,9,13,4,7,10,8,2,11)] = buf[i];
diff --git a/src/mame/drivers/legionna.c b/src/mame/drivers/legionna.c
index e4ea67f214b..8afd6b11889 100644
--- a/src/mame/drivers/legionna.c
+++ b/src/mame/drivers/legionna.c
@@ -1073,7 +1073,7 @@ void legionna_state::descramble_legionnaire_gfx(UINT8* src)
7,4,
3,2,1,0)];
}
- memcpy(src,buffer,len);
+ memcpy(src,&buffer[0],len);
}
}
diff --git a/src/mame/drivers/megasys1.c b/src/mame/drivers/megasys1.c
index f31aad63bc7..7de200b7b7b 100644
--- a/src/mame/drivers/megasys1.c
+++ b/src/mame/drivers/megasys1.c
@@ -3692,7 +3692,7 @@ void megasys1_state::rodlandj_gfx_unmangle(const char *region)
dynamic_buffer buffer(size);
- memcpy(buffer,rom,size);
+ memcpy(&buffer[0],rom,size);
/* address lines swap: ..dcba9876543210 -> ..acb8937654d210 */
for (i = 0;i < size;i++)
@@ -3718,7 +3718,7 @@ void megasys1_state::jitsupro_gfx_unmangle(const char *region)
dynamic_buffer buffer(size);
- memcpy(buffer,rom,size);
+ memcpy(&buffer[0],rom,size);
/* address lines swap: fedcba9876543210 -> fe8cb39d7654a210 */
for (i = 0;i < size;i++)
@@ -3742,7 +3742,7 @@ void megasys1_state::stdragona_gfx_unmangle(const char *region)
dynamic_buffer buffer(size);
- memcpy(buffer,rom,size);
+ memcpy(&buffer[0],rom,size);
/* address lines swap: fedcba9876543210 -> fe3cbd9a76548210 */
for (i = 0;i < size;i++)
diff --git a/src/mame/drivers/meyc8088.c b/src/mame/drivers/meyc8088.c
index 0dd86cea5cf..c60d5c7ca46 100644
--- a/src/mame/drivers/meyc8088.c
+++ b/src/mame/drivers/meyc8088.c
@@ -122,10 +122,10 @@ static const res_net_info meyc8088_net_info =
PALETTE_INIT_MEMBER(meyc8088_state, meyc8088)
{
const UINT8 *color_prom = memregion("proms")->base();
- dynamic_array<rgb_t> rgb;
+ std::vector<rgb_t> rgb;
compute_res_net_all(rgb, color_prom, meyc8088_decode_info, meyc8088_net_info);
- palette.set_pen_colors(0, rgb, 32);
+ palette.set_pen_colors(0, rgb);
}
UINT32 meyc8088_state::screen_update_meyc8088(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
diff --git a/src/mame/drivers/mitchell.c b/src/mame/drivers/mitchell.c
index 786ffbcbae1..a644b367dff 100644
--- a/src/mame/drivers/mitchell.c
+++ b/src/mame/drivers/mitchell.c
@@ -2249,7 +2249,7 @@ DRIVER_INIT_MEMBER(mitchell_state,mstworld)
/* bank f */12, 12,
};
- memcpy(source, dst, len);
+ memcpy(&source[0], dst, len);
for (x = 0; x < 40; x += 2)
{
if (tablebank[x] != -1)
diff --git a/src/mame/drivers/multfish.c b/src/mame/drivers/multfish.c
index 7808cd2a711..0161743c926 100644
--- a/src/mame/drivers/multfish.c
+++ b/src/mame/drivers/multfish.c
@@ -474,7 +474,7 @@ A12 <-> A13
memcpy(&temprom[j*0x40],&igrosoft_gamble_gfx[romoffset+(jscr*0x40)],0x40);
}
- memcpy(&igrosoft_gamble_gfx[romoffset],temprom,igrosoft_gamble_ROM_SIZE);
+ memcpy(&igrosoft_gamble_gfx[romoffset],&temprom[0],igrosoft_gamble_ROM_SIZE);
}
}
@@ -507,14 +507,14 @@ static void lottery_decode(running_machine &machine, UINT8 xor12, UINT8 xor34, U
dynamic_buffer temprom(igrosoft_gamble_ROM_SIZE);
/* ROMs decode */
- rom_decodel(&igrosoft_gamble_gfx[0x000000], temprom, xor12, xor_addr);
- rom_decodel(&igrosoft_gamble_gfx[0x100000], temprom, xor12, xor_addr);
- rom_decodel(&igrosoft_gamble_gfx[0x200000], temprom, xor34, xor_addr);
- rom_decodel(&igrosoft_gamble_gfx[0x300000], temprom, xor34, xor_addr);
- rom_decodeh(&igrosoft_gamble_gfx[0x080000], temprom, xor56, xor_addr);
- rom_decodeh(&igrosoft_gamble_gfx[0x180000], temprom, xor56, xor_addr);
- rom_decodeh(&igrosoft_gamble_gfx[0x280000], temprom, xor78, xor_addr);
- rom_decodeh(&igrosoft_gamble_gfx[0x380000], temprom, xor78, xor_addr);
+ rom_decodel(&igrosoft_gamble_gfx[0x000000], &temprom[0], xor12, xor_addr);
+ rom_decodel(&igrosoft_gamble_gfx[0x100000], &temprom[0], xor12, xor_addr);
+ rom_decodel(&igrosoft_gamble_gfx[0x200000], &temprom[0], xor34, xor_addr);
+ rom_decodel(&igrosoft_gamble_gfx[0x300000], &temprom[0], xor34, xor_addr);
+ rom_decodeh(&igrosoft_gamble_gfx[0x080000], &temprom[0], xor56, xor_addr);
+ rom_decodeh(&igrosoft_gamble_gfx[0x180000], &temprom[0], xor56, xor_addr);
+ rom_decodeh(&igrosoft_gamble_gfx[0x280000], &temprom[0], xor78, xor_addr);
+ rom_decodeh(&igrosoft_gamble_gfx[0x380000], &temprom[0], xor78, xor_addr);
}
INLINE void roment_decodel(UINT8 *romptr, UINT8 *tmprom, UINT8 xor_data, UINT32 xor_add)
@@ -546,14 +546,14 @@ static void ent_decode(running_machine &machine, UINT8 xor12, UINT8 xor34, UINT8
dynamic_buffer temprom(igrosoft_gamble_ROM_SIZE);
/* ROMs decode */
- roment_decodel(&igrosoft_gamble_gfx[0x000000], temprom, xor12, xor_addr);
- roment_decodel(&igrosoft_gamble_gfx[0x100000], temprom, xor12, xor_addr);
- roment_decodel(&igrosoft_gamble_gfx[0x200000], temprom, xor34, xor_addr);
- roment_decodel(&igrosoft_gamble_gfx[0x300000], temprom, xor34, xor_addr);
- roment_decodeh(&igrosoft_gamble_gfx[0x080000], temprom, xor56, xor_addr);
- roment_decodeh(&igrosoft_gamble_gfx[0x180000], temprom, xor56, xor_addr);
- roment_decodeh(&igrosoft_gamble_gfx[0x280000], temprom, xor78, xor_addr);
- roment_decodeh(&igrosoft_gamble_gfx[0x380000], temprom, xor78, xor_addr);
+ roment_decodel(&igrosoft_gamble_gfx[0x000000], &temprom[0], xor12, xor_addr);
+ roment_decodel(&igrosoft_gamble_gfx[0x100000], &temprom[0], xor12, xor_addr);
+ roment_decodel(&igrosoft_gamble_gfx[0x200000], &temprom[0], xor34, xor_addr);
+ roment_decodel(&igrosoft_gamble_gfx[0x300000], &temprom[0], xor34, xor_addr);
+ roment_decodeh(&igrosoft_gamble_gfx[0x080000], &temprom[0], xor56, xor_addr);
+ roment_decodeh(&igrosoft_gamble_gfx[0x180000], &temprom[0], xor56, xor_addr);
+ roment_decodeh(&igrosoft_gamble_gfx[0x280000], &temprom[0], xor78, xor_addr);
+ roment_decodeh(&igrosoft_gamble_gfx[0x380000], &temprom[0], xor78, xor_addr);
}
DRIVER_INIT_MEMBER(igrosoft_gamble_state,island2l)
diff --git a/src/mame/drivers/multigam.c b/src/mame/drivers/multigam.c
index 099e1e79bf2..4389a0d3e7f 100644
--- a/src/mame/drivers/multigam.c
+++ b/src/mame/drivers/multigam.c
@@ -1456,7 +1456,7 @@ DRIVER_INIT_MEMBER(multigam_state,multigmt)
rom = memregion("maincpu")->base();
size = 0x8000;
- memcpy(buf, rom, size);
+ memcpy(&buf[0], rom, size);
for (i = 0; i < size; i++)
{
addr = BITSWAP24(i,23,22,21,20,19,18,17,16,15,14,13,8,11,12,10,9,7,6,5,4,3,2,1,0);
@@ -1465,7 +1465,7 @@ DRIVER_INIT_MEMBER(multigam_state,multigmt)
rom = memregion("user1")->base();
size = 0x80000;
- memcpy(buf, rom, size);
+ memcpy(&buf[0], rom, size);
for (i = 0; i < size; i++)
{
addr = BITSWAP24(i,23,22,21,20,19,18,17,16,15,14,13,8,11,12,10,9,7,6,5,4,3,2,1,0);
@@ -1473,7 +1473,7 @@ DRIVER_INIT_MEMBER(multigam_state,multigmt)
}
rom = memregion("gfx1")->base();
size = 0x80000;
- memcpy(buf, rom, size);
+ memcpy(&buf[0], rom, size);
for (i = 0; i < size; i++)
{
addr = BITSWAP24(i,23,22,21,20,19,18,17,15,16,11,10,12,13,14,8,9,1,3,5,7,6,4,2,0);
diff --git a/src/mame/drivers/namcos86.c b/src/mame/drivers/namcos86.c
index 73267a307bc..5e327f459b8 100644
--- a/src/mame/drivers/namcos86.c
+++ b/src/mame/drivers/namcos86.c
@@ -1516,7 +1516,7 @@ DRIVER_INIT_MEMBER(namcos86_state,namco86)
UINT8 *mono = gfx + size;
int i;
- memcpy( buffer, gfx, size );
+ memcpy( &buffer[0], gfx, size );
for ( i = 0; i < size; i += 2 )
{
@@ -1539,7 +1539,7 @@ DRIVER_INIT_MEMBER(namcos86_state,namco86)
UINT8 *mono = gfx + size;
int i;
- memcpy( buffer, gfx, size );
+ memcpy( &buffer[0], gfx, size );
for ( i = 0; i < size; i += 2 )
{
diff --git a/src/mame/drivers/ninjakd2.c b/src/mame/drivers/ninjakd2.c
index 4515dcb116d..828cbd8a7be 100644
--- a/src/mame/drivers/ninjakd2.c
+++ b/src/mame/drivers/ninjakd2.c
@@ -1454,7 +1454,7 @@ void ninjakd2_state::lineswap_gfx_roms(const char *region, const int bit)
temp[da] = src[sa];
}
- memcpy(src, temp, length);
+ memcpy(src, &temp[0], length);
}
void ninjakd2_state::gfx_unscramble()
diff --git a/src/mame/drivers/nmk16.c b/src/mame/drivers/nmk16.c
index 90288a0a51e..29548021a32 100644
--- a/src/mame/drivers/nmk16.c
+++ b/src/mame/drivers/nmk16.c
@@ -5235,7 +5235,7 @@ static void decryptcode( running_machine &machine, int a23, int a22, int a21, in
size_t size = machine.root_device().memregion( "maincpu" )->bytes();
dynamic_buffer buffer( size );
- memcpy( buffer, RAM, size );
+ memcpy( &buffer[0], RAM, size );
for( i = 0; i < size; i++ )
{
RAM[ i ] = buffer[ BITSWAP24( i, a23, a22, a21, a20, a19, a18, a17, a16, a15, a14, a13, a12,
diff --git a/src/mame/drivers/nova2001.c b/src/mame/drivers/nova2001.c
index 229291b514e..8e7acaf6787 100644
--- a/src/mame/drivers/nova2001.c
+++ b/src/mame/drivers/nova2001.c
@@ -963,7 +963,7 @@ void nova2001_state::lineswap_gfx_roms(const char *region, const int bit)
temp[da] = src[sa];
}
- memcpy(src, temp, length);
+ memcpy(src, &temp[0], length);
}
diff --git a/src/mame/drivers/panicr.c b/src/mame/drivers/panicr.c
index ae834e3326b..0942416f5ac 100644
--- a/src/mame/drivers/panicr.c
+++ b/src/mame/drivers/panicr.c
@@ -797,7 +797,7 @@ DRIVER_INIT_MEMBER(panicr_state,panicr)
//rearrange bg tilemaps a bit....
rom = memregion("user1")->base();
size = memregion("user1")->bytes();
- memcpy(buf,rom, size);
+ memcpy(&buf[0],rom, size);
for(j=0;j<16;j++)
{
@@ -809,7 +809,7 @@ DRIVER_INIT_MEMBER(panicr_state,panicr)
rom = memregion("user2")->base();
size = memregion("user2")->bytes();
- memcpy(buf,rom, size);
+ memcpy(&buf[0],rom, size);
for(j=0;j<16;j++)
{
diff --git a/src/mame/drivers/pengadvb.c b/src/mame/drivers/pengadvb.c
index c51ff8f2a47..00e66b8e7a0 100644
--- a/src/mame/drivers/pengadvb.c
+++ b/src/mame/drivers/pengadvb.c
@@ -296,7 +296,7 @@ void pengadvb_state::pengadvb_decrypt(const char* region)
// address line swap
dynamic_buffer buf(memsize);
- memcpy(buf, mem, memsize);
+ memcpy(&buf[0], mem, memsize);
for (int i = 0; i < memsize; i++)
{
mem[i] = buf[BITSWAP24(i,23,22,21,20,19,18,17,16,15,14,13,5,11,10,9,8,7,6,12,4,3,2,1,0)];
diff --git a/src/mame/drivers/pirates.c b/src/mame/drivers/pirates.c
index c37d2cb58e6..dcd1b83ebe3 100644
--- a/src/mame/drivers/pirates.c
+++ b/src/mame/drivers/pirates.c
@@ -327,9 +327,9 @@ void pirates_state::decrypt_68k()
{
UINT16 *rom = (UINT16 *)memregion("maincpu")->base();
size_t rom_size = memregion("maincpu")->bytes();
- dynamic_array<UINT16> buf(rom_size/2);
+ std::vector<UINT16> buf(rom_size/2);
- memcpy (buf, rom, rom_size);
+ memcpy (&buf[0], rom, rom_size);
for (int i=0; i<rom_size/2; i++)
{
@@ -357,7 +357,7 @@ void pirates_state::decrypt_p()
dynamic_buffer buf(rom_size);
rom = memregion("gfx1")->base();
- memcpy (buf, rom, rom_size);
+ memcpy (&buf[0], rom, rom_size);
for (i=0; i<rom_size/4; i++)
{
@@ -380,7 +380,7 @@ void pirates_state::decrypt_s()
dynamic_buffer buf(rom_size);
rom = memregion("gfx2")->base();
- memcpy (buf, rom, rom_size);
+ memcpy (&buf[0], rom, rom_size);
for (i=0; i<rom_size/4; i++)
{
@@ -404,7 +404,7 @@ void pirates_state::decrypt_oki()
dynamic_buffer buf(rom_size);
rom = memregion("oki")->base();
- memcpy (buf, rom, rom_size);
+ memcpy (&buf[0], rom, rom_size);
for (i=0; i<rom_size; i++)
{
diff --git a/src/mame/drivers/popeye.c b/src/mame/drivers/popeye.c
index e9437e5ed6c..62014c4b811 100644
--- a/src/mame/drivers/popeye.c
+++ b/src/mame/drivers/popeye.c
@@ -670,7 +670,7 @@ DRIVER_INIT_MEMBER(popeye_state,skyskipr)
int i;
for (i = 0;i < len; i++)
buffer[i] = BITSWAP8(rom[BITSWAP16(i,15,14,13,12,11,10,8,7,0,1,2,4,5,9,3,6) ^ 0xfc],3,4,2,5,1,6,0,7);
- memcpy(rom,buffer,len);
+ memcpy(rom,&buffer[0],len);
}
save_item(NAME(m_prot0));
@@ -689,7 +689,7 @@ DRIVER_INIT_MEMBER(popeye_state,popeye)
int i;
for (i = 0;i < len; i++)
buffer[i] = BITSWAP8(rom[BITSWAP16(i,15,14,13,12,11,10,8,7,6,3,9,5,4,2,1,0) ^ 0x3f],3,4,2,5,1,6,0,7);
- memcpy(rom,buffer,len);
+ memcpy(rom,&buffer[0],len);
}
save_item(NAME(m_prot0));
diff --git a/src/mame/drivers/popobear.c b/src/mame/drivers/popobear.c
index e0801be11b4..4d1599c590d 100644
--- a/src/mame/drivers/popobear.c
+++ b/src/mame/drivers/popobear.c
@@ -108,7 +108,7 @@ public:
optional_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
- dynamic_array<UINT16> m_vram_rearranged;
+ std::vector<UINT16> m_vram_rearranged;
int tilemap_base[4];
diff --git a/src/mame/drivers/r2dx_v33.c b/src/mame/drivers/r2dx_v33.c
index 0629c202ce3..a4514535c2c 100644
--- a/src/mame/drivers/r2dx_v33.c
+++ b/src/mame/drivers/r2dx_v33.c
@@ -889,7 +889,7 @@ DRIVER_INIT_MEMBER(r2dx_v33_state,zerotm2k)
int i;
for (i = 0; i < len; i ++)
buffer[i] = src[BITSWAP32(i,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,5,6,4,3,2,1,0)];
- memcpy(src, buffer, len);
+ memcpy(src, &buffer[0], len);
}
/*
diff --git a/src/mame/drivers/segag80r.c b/src/mame/drivers/segag80r.c
index a39edd4bf04..ea0f834432a 100644
--- a/src/mame/drivers/segag80r.c
+++ b/src/mame/drivers/segag80r.c
@@ -1392,7 +1392,7 @@ void segag80r_state::monsterb_expand_gfx(const char *region)
/* banking */
dest = memregion(region)->base();
dynamic_buffer temp(0x4000);
- memcpy(temp, dest, 0x4000);
+ memcpy(&temp[0], dest, 0x4000);
/* 16 effective total banks */
for (i = 0; i < 16; i++)
diff --git a/src/mame/drivers/segas16b.c b/src/mame/drivers/segas16b.c
index 1d4da2a6b7b..6b2206f5bbf 100644
--- a/src/mame/drivers/segas16b.c
+++ b/src/mame/drivers/segas16b.c
@@ -7431,22 +7431,22 @@ DRIVER_INIT_MEMBER(isgsm_state,isgsm)
DRIVER_INIT_CALL(generic_5521);
// decrypt the bios...
- dynamic_array<UINT16> temp(0x20000/2);
+ std::vector<UINT16> temp(0x20000/2);
UINT16 *rom = (UINT16 *)memregion("bios")->base();
for (int addr = 0; addr < 0x20000/2; addr++)
temp[addr ^ 0x4127] = BITSWAP16(rom[addr], 6, 14, 4, 2, 12, 10, 8, 0, 1, 9, 11, 13, 3, 5, 7, 15);
- memcpy(rom, temp, 0x20000);
+ memcpy(rom, &temp[0], 0x20000);
}
DRIVER_INIT_MEMBER(isgsm_state,shinfz)
{
init_isgsm();
- dynamic_array<UINT16> temp(0x200000/2);
+ std::vector<UINT16> temp(0x200000/2);
UINT16 *rom = (UINT16 *)memregion("gamecart_rgn")->base();
for (int addr = 0; addr < 0x200000/2; addr++)
temp[addr ^ 0x68956] = BITSWAP16(rom[addr], 8, 4, 12, 3, 6, 7, 1, 0, 15, 11, 5, 14, 10, 2, 9, 13);
- memcpy(rom, temp, 0x200000);
+ memcpy(rom, &temp[0], 0x200000);
m_read_xor = 0x66;
m_security_callback = security_callback_delegate(FUNC(isgsm_state::shinfz_security), this);
@@ -7456,11 +7456,11 @@ DRIVER_INIT_MEMBER(isgsm_state,tetrbx)
{
init_isgsm();
- dynamic_array<UINT16> temp(0x80000/2);
+ std::vector<UINT16> temp(0x80000/2);
UINT16 *rom = (UINT16 *)memregion("gamecart_rgn")->base();
for (int addr = 0; addr < 0x80000/2; addr++)
temp[addr ^ 0x2A6E6] = BITSWAP16(rom[addr], 4, 0, 12, 5, 7, 3, 1, 14, 10, 11, 9, 6, 15, 2, 13, 8);
- memcpy(rom, temp, 0x80000);
+ memcpy(rom, &temp[0], 0x80000);
m_read_xor = 0x73;
m_security_callback = security_callback_delegate(FUNC(isgsm_state::tetrbx_security), this);
diff --git a/src/mame/drivers/seta.c b/src/mame/drivers/seta.c
index ea9a9540297..0037bb4a2cf 100644
--- a/src/mame/drivers/seta.c
+++ b/src/mame/drivers/seta.c
@@ -11427,7 +11427,7 @@ DRIVER_INIT_MEMBER(seta_state,blandia)
buf[rpos] = rom[rpos*2+1];
}
- memcpy( rom, buf, rom_size );
+ memcpy( rom, &buf[0], rom_size );
rom = memregion("gfx3")->base() + 0x40000;
@@ -11436,7 +11436,7 @@ DRIVER_INIT_MEMBER(seta_state,blandia)
buf[rpos] = rom[rpos*2+1];
}
- memcpy( rom, buf, rom_size );
+ memcpy( rom, &buf[0], rom_size );
}
diff --git a/src/mame/drivers/sigmab98.c b/src/mame/drivers/sigmab98.c
index 1b82f2ab847..d7b93f5a1dd 100644
--- a/src/mame/drivers/sigmab98.c
+++ b/src/mame/drivers/sigmab98.c
@@ -134,7 +134,7 @@ public:
required_shared_ptr<UINT8> m_nvram;
required_device<eeprom_serial_93cxx_device> m_eeprom;
required_device<gfxdecode_device> m_gfxdecode;
- dynamic_array<UINT8> m_paletteram;
+ std::vector<UINT8> m_paletteram;
required_device<screen_device> m_screen;
required_device<palette_device> m_palette;
@@ -1509,8 +1509,8 @@ WRITE8_MEMBER(sigmab98_state::itazuram_rambank_w)
m_rambank = data;
switch (data)
{
- case 0x52: membank("palbank")->set_base(m_nvram); break;
- case 0x64: membank("palbank")->set_base(m_paletteram); break;
+ case 0x52: membank("palbank")->set_base(m_nvram); break;
+ case 0x64: membank("palbank")->set_base(&m_paletteram[0]); break;
default:
logerror("%s: unknown ram bank = %02x, reg2 = %02x\n", machine().describe_context(), data, m_r