The global_alloc/global_free functions have outlived their usefulness.
They don't allow consistently overriding the default memory allocation
behaviour because they aren't used consistently, and we don't have
standard library allocator wrappers for them that we'd need to use them
consistently with all the standard library containers we're using. If
you need to change the default allocator behaviour, you can override the
new/delete operators, and there are ways to get more fine-grained
control that way. We're already doing that to pre-fill memory in debug
builds.
Code was already starting to depend on global_alloc/global_free wrapping
new/delete. For example some parts of the code (including the UI and
Windows debugger) was putting the result of global_alloc in a
std::unique_ptr wrappers without custom deleters, and the SPU sound
device was assuming it could use global_free to release memory allocated
with operator new. There was also code misunderstanding the behaviour
of global_alloc, for example the GROM port cartridge code was checking
for nullptr when a failure will actually throw std::bad_alloc.
As well as substituting new/delete, I've made several things use smart
pointers to reduce the chance of leaks, and fixed a couple of leaks,
too.
* Under cirtum circumstances the splitter would create "ghost" solvers
consisting of terminals already used in another and complete
solver. This may impact all netlist which use opamps and thus
is committed early in the cycle.
* This commit adds functionality to instruct the splitter code to
include terminals which will not create matrix elements into
the parsing of net groups for solvers.
* Devices like BJTs and FETs which are defined but not used will now
cause an error.
* An unused device will create an additional solver with a singular
matrix.
- This is adding unnecessary performance overhead.
- It complicates debugging because the unused device will cause an
arithmetic signal if used with --fperr (nltool).
* Fixed all validation errors.
Made const-qualified pixel accessors (pix, pixt, raw_pixptr) return
const-qualified references/pointers to pixesl, and added non-const
versions. This makes bitmap more like standard library containers where
const protects the content as well as the dimensions.
Made the templated pixt accessor protected - having it public makes it
too easy to inadvertently get a pointer to the wrong location.
Removed the pix(8|16|32|64) accessors from the specific bitmaps. You
could only use the "correct" one anyway, and having the "incorrect" ones
available prevented explicit instantiations of the class template
because the static assertions would fail. You can still see the pixel
type in the bitmap class names, and you can't assign the result of
&pix(y, x) to the wrong kind of pointer without a cast.
Added fill member functions to the specific bitmap template, and added
a explicit instantiations. This allows the bitmap size check to be
skipped on most bitmap fills, although the clipping check is still
there. Also fixed a couple of places that were trying to fill an
indexed 16-bit bitmap with rgb_t::black() exposed by this (replaced with
zero to get the same net effect). The explicit template instantiations
in the .cpp file mean the compiler can inline the function if necessary,
but don't need to generate a local out-of-line body if it chooses not
to.
Extended the size of the fill value parameter in the base bitmap class
to 64 bits so it works correctly for 64-bit bitmaps.
Fixed places where IE15 and VGM visualiser weren't accounting for row
bytes potentially being larger than width.
Fixed an off-by-one in an HP-DIO card where it was treating the Topcat
cursor right edge as exclusive.
Updated everything to work with the API changes, reduced the scope of
many variables, added more const, and replaced a few fill/copy loops
with stuff from <algorithm>.
* a number of minor fixes leading to an increase of 570% to 588% on
pongf.
* admittedly micro optimization.
* Includes some comments why certain decisions have been taken.
* length reports the number of character codes in the string
* size reports the size in memory units
* Reminder: Set PSTRING_USE_STD_STRING to 1 in pstring.h and get
native std::string
* pstrings are compatible to std::string but only support a limited
subset of functionality.
* By default (always like this) utf8 is supported and thus length
reports the number of multi-byte characters.
* Document that for performance reasons pushes to queue are
allowed even if they may not change state and are filtered
out during process.
* Provide alternative code path. This is currently not used.
This adds support for the mini digital cassette recorder that can be
found inside a P2000t. This implementation is based on documentation
that can be found in https://github.com/p2000t/documentation.
In memory of NPM Jansen, who taught me all the magic of bits and bytes.
* Removed device and macro header files.
* All of those can be generated automatically so going forward there is
no need for these any longer.
* Introduced the modules concept. Modules are netlists for which
automatic lib entries are generated.
* Going forward you just store them in macro/modules and they will be
automatically registered as device elements.
* You need to do a "make generated" is src/lib/netlist/build
* Some_device.cpp still needs to be added to netlist.lua
* Added documentation on how to add devices to netlist.
* Please refer to adding_devices.md for more information.
* rename some misleading type names
* remove callback_t and replace by better scalable approach
* hide implementations details
* move sources classes from putil.h to psources.h
* reduce code complexity
* improve parsing performance, parsing netlists now is twice as fast.
* fix issues around multi-byte string support
* moved psplit into pstrutil.h
The previous behaviour was unintuitive - parsing an XML file and writing
it out immediately would produce invalid XML if the file contained any
characters that needed escaping. It makes far more sense to escape on
writing rather than expecting the user to escape input.
-Add preliminary support for visibility toggles to artwork system.
This allows the user to show/hide related elements in a view, with
nesting. The view can specify whether elements are shown or hidden by
default. Settings are saved per host window/screen per view. There is
no way to set the initial visibility state on the command line. Legacy
"Space Invaders cabinet model" layers are mapped onto visibility
toggles.
This is not stable yet. In particular, the XML element/attribute names
have not been finalised. The new features have not been added to
complay.py to prevent them from being used before they're finalised.
The option is called skip_warnings, and it must be set in ui.ini (it can
be set using the internal UI). Red warnings cannot be skipped; yellow
warning can be skipped under certain circumstances.
For a yellow warning to be skipped, the system must have been launched
in a way that allows warnings to be displayed, in a configuration with
the same set of devices flagged with unemulated/imperfect features,
within the last seven days, and the warning must have been displayed
within the past 14 days.
Also fixed a bug with display of the MACHINE_NO_COCKTAIL flag in the
internal UI, and increased the size of XML integer attributes to 64
bits.
- Add wavfile support for reading/writing tapes, for more accuracy. The currently supported K7 file type misses timing data.
- VG5000µ adds a wait cycle after the second T state of the M1 cycle of the Z80. Because it was not emulated, the timings were off, especially in the sensible cassette read/write routines.
- With wavfile support added and timings fixed, the emulation can now read/write cassette at 1200 and 2400 bauds.
- Still keeping the MACHINE_NOT_WORKING flag, as real hardware tests need to be complete.
Certain things are not considered "creative works" under copyright law,
making them ineligible for copyright protection. This includes pinouts
(facts), descriptions of circuits (utilitarian), integrated circuit
lithography masks (utilitarian, but there's a separate field of IP law
protecting them), and character shapes (utilitarian).
However, many of these descriptions are substantial enough to be treated
creative works. A number of them include suggested applications. There
are situations where reproducing the descriptions may be permitted, for
example:
* The publisher may permit reproducing the entire datasheet for
reference.
* In some jurisdictions, fair use doctrine may allow the description to
be quoted in its entirety in a larger creative work (e.g. in a
research paper, patent application, or an original description of a
circuit utilising the device).
* Some jurisdictions allow reproduction of no more than 50% of a
creative work for inclusion in teaching materials.
I am not confident that these soure code comments qualify as a situation
where the long-form descriptions can be copied verbatim lawfully,
especially without reproducing copyright notices for them. If you want
long form plain language descriptions in the comments, you need to write
them yourself. That way, you will be the copyright holder of the
creative work, and you can make it availble under a permissive or
"copyleft" license.
* also made nld_devinc.h srcclean friendly.
* nld_devinc.h and lib_entries.hxx are currently not used. You can try
the automated build by changing NL_AUTO_DEVICES in setup.h to 1.
* removed include directory src/lib/netlist from various genie files to
avoid potential issues.
* Code using netlist should use #include "netlist/*".
* Updated includes.
* Fixed standalone makefile depend target to properly deal with relative
paths.
* On windows a simple make is now enough to build.
* Devices, macro and tests folders now included with wildcard.
* No more makefile changes if a device is added.
* Moved nld_devinc.h to generated folder
* Added to python scripts to create nld_devinc.h and lib_entries.hxx
* TEST MODE: these two files are created automatically but are not used
currently. Once I get feedback that the python scripts work in different
environments I will remove header files from devices and macro and start
using these files in production.
* Exposing sub-device members is not best practice.
* The need for sub-devices is a clear indication that a netlist language
implementation would be a better solution.
Sound and other improvements to Sega G-80 games: [Aaron Giles, couriersud]
* Added netlist-based sound to Eliminator, Zektor, Space Fury, and Astro Blaster.
* Split the Sega Universal Sound Board and Speech Boards into their own separate files.
* Improved Universal Sound Board implementation for better accuracy in Star Trek and Tac/Scan.
* Wrote netlist-based backend for Universal Sound Board; currently disabled due to limitations in the system.
* Wrote netlist-based backend for Speech Board; currently disabled pending future sound system changes.
* Implemented wait states and the vector DRAW flag to help improve timing.
SP0250 Improvements: [Aaron Giles]
* Matched clock divider to real chip measurements.
* Fixed behavior when not fed enough data; addresses "gapping" in speech in Sega games.
* Implemented accurate LFR noise generator according to real chip measurements.
* Added pulse-width modulation DAC output mode for future consumption by netlist.
Netlist additions: [Aaron Giles]
* Added compile-time option to record nltool-compatible CSV files.
* Improved CD4020 implementation.
* Fixed CD4053 behavior.
* Added 74139 device.
* Added TL082 device.
8253 PIT changes: [Aaron Giles]
* Added explicit synchronization to all writes.
* Cleaned up some timing calculations to avoid double<->attotime conversions.
* moved dead code into examples/lostfound.cpp
* This work didn't improve performance but still may serve as examples
for complex truth table implementations.
* sspeedr: new netlist audio implementation
Netlist-based audio implementation for sspeedr (Super Speed Race, 1979)
derived from Midway audio schematics, and based on that used for
280zzzap (280-ZZZAP) and lagunar (Laguna Racer) in the mw8080bw driver.
The Super Speed Race audio circuits are clearly derived from those games;
the biggest difference is the use of a linear feedback shift register
for noise generation.
* Updated netlist static solvers with recent netlist changes.
* Each parameter to set now has a dedicated buffered_param_setter
device.
* This allows different sample times per device
* Updated netlist.cpp for new approach
* buffered_param_setter is a template. The template parameter is a class
which is expected to support the [] operator. The value passed to []
operator is the requested sample number.
Added Laguna Racer to the 280-ZZZAP netlist audio driver, with
conditional changes to the netlist for the circuitry differences
between the two games.
Adjust some netlist components that apparently changed from the
280-ZZZAP schematic to production machines.
Removed the driver's private MC3340 netlist, using the equivalent
one in the netlist library instead.
* Separated tokenizing and reading of tokens.
* This enables caching of parsing results on the token level.
* Implemented caching of token stream.
* Overall this significantly improves parsing performance (~10x)
* Next step towards a bare-bone nltool which does not depend on macro
devices.
* Header files will disappear and only nld_devinc.h which is can be
created by nltool will stay.
* These commits ensure that the documentation is preserved when the
header files are deleted at some point in the future
* Updated 7450, 7473/7473A, 7474, 7475/7477 devices to use DIP macros
instead of C++ DIPs.
* Reworked 7475/7477 more in the style of 7474, leveraging system signal
activation and edge detection.
* Move DIPs for 82S16, 82S115, and 2102A devices into nlm_proms
* Moved 7448 DIP to a macro. Replaced 7442 with truthtable and macro.
* Moved 74LS629 DIP into macro.
* Expand truthtable to handle 10 outputs.
Add legacy floppy image support which is currently required for the
mc6843 FDC emulator and used by the EXORset which run XDOS a variant
of MDOS.
Add support for 5.25 inch XDOS floppy drive formats as used by the
EXORset.
Make some of the identity tests more permissive to work with observer
disks. The date day and month are reversed on some disks, and the boot
rib cluster is lower.
* Example: PARAM(Solver.Solver_0.METHOD, "GMRES")
* Will use the GMRES solver instead of the default MAT_CR solver.
* Same applies to all Solver parameters.
* Please use with care. If you change your netlist (e.g. using
frontiers) the allocation of nets to solvers and the number of solvers
may change. Thus this type of tweaking should only be used after the
netlist completely works.
* The GMRES solver for larger matrices (>>100) can outperform Gaussian
elimination. Including it so it gets wider attention.
* As far as I know netlist is the only SPICE-like circuit simulation
providing a GMRES solver.
* All solver scheduling is now handled by nld_solver.
* Previously, for dynamic timestepping the sub solvers would be
responsible for their scheduling themselves.
- This prevented any attemps to use parallel execution of solvers.
* Now the route is free towards experiments to use parallel execution of
solvers.
* Uses ptimed_queue_linear in solver scheduling
* Improved netlist queue implementation (template now)
* Added const delegates.
* Added subsolver stats
* Removed dead code.
mw8080bw: improvements to 280zzzap netlist audio
* Noise-based sound effects corrected. The original strength of the
zener noise voltage was about three orders of magnitude too low
for the current being passed through a zener of this type. This
prevented the noise generator from working as designed and made
the noise far too weak for the noise-based sound effects to work
properly. Those effects now sound much closer to the real hardware.
* Implemented faster high-level emulation version of noise generator.
(Credit to couriersud for suggesting this.) The corrected noise
voltage made the component-level emulation of the noise generator
much too demanding on the minimum timestep needed to produce
accurate results without unrealistic voltage spikes, and so will
not run accurately at reasonable emulation speeds. But by replacing
it with a simple but effective AFUNC()-based comparator, we get a
functionally similar noise signal generator that produces
effectively identical output while still being able to run with
48 kHz static timestepping. So we get both decent emulation speed
and correct-sounding noise effects.
* Added output voltage clipping on post-crash sound to remove
voltage spikes, resulting in a smoother, more accurate sound.
(Credit to Aaron Giles for suggesting this clipping method.)
* Changed output to be taken from second LM3900 output opamp
(inverted signal) for smoother waveform and better tone quality.
* Added master volume potentiometer which can be user-set, set to
midpoint by default. Adjusted output scaling and offset to match.
* Various explanatory comments expanded or corrected.
* Added netlist simulations for the following games: Space War, Barrier, Star Hawk, Speed Freak, Star Castle, War of the Worlds, Sundance, Tail Gunner, Rip Off, Armor Attack, Warrior, Solar Quest, Boxing Bugs. Removed previous samples-based sound. [Aaron Giles, Couriersud]
* Added built-in minimal artwork for Warrior. [Aaron Giles]
* Changed speaker maximum sample tracking to be based on new compile-time define SPEAKER_TRACK_MAX_SAMPLE instead of MAME_DEBUG. [Aaron Giles]
* Modernized 74164 and 74393 netlist TTL devices. [Aaron Giles]
* Removed update and NETLIB_UPDATE completely.
* Startup initialization order may change.
* This may cause regression tests to trigger. This is expected. Logic
TTL devices do not have a defined power-up state. That's why reset
circuits exist which create a reset signal *after* all power supply
lines are stable.
Model for transistors adjusted, replacing default NPN transistor
model with a high-gain NPN transistor type that more closely
resembles those used by the real Gun Fight sound circuits. This
has a quite obvious effect on the shot sounds, and it seems the
circuits were designed for this effect.
Made all volume potentiometers user-adjustable; previously fixed
at 50%.
Replaced abstract model of noise generator with component-level
one, including a model of the generator's zener diode. Zener
noise is provided by an associated Gaussian white noise source
running off a 48 kHz clock. Both the zener diode and Gaussian
white noise source are component models recently added to the
netlist library.
Supply voltage to amplifying transistors tweaked downward from
16.5 volts to 16 volts, determined by properly analyzing power
supply circuit and confirmed with a documented reference.
Much more commentary describing the sound circuits' function and
modeling issues.
If TRIG and TRESH are connected overshoot compensation will be enabled.
The approach is raw but delivers results (at 5 to 10 steps per
discharge/charge) within a couple of percent. Please take into account
that any datasheet formulas are idealistic. Neither capacitor, resistor,
internal resistor tolerances are taken into account. Nor are ambient
temperature and chip temperature.