Commits on Feb 12, 2017
  1. Fix Windows build (I hope).

    MBilderbeek committed Feb 12, 2017
Commits on Feb 11, 2017
  1. Added emulation of Tecall_MSX_RAMFILE_TM220

    This is a cartridge with 16kB ROM (though 2nd half of the ROM is filled with
    0xff) and 16kB RAM. The RAM is powered by a battery. It adds BASIC CALL
    commands to load/save files to a small RAM disk. See manual for much more
    The implementation of this cartridge is relatively straight-forward, EXCEPT for
    the /WE signal of the RAM. This signal is computed from 3 output bits of a
    shift-register. The data-input of this shift-register is a combination of 2
    data-bits of the msx cartridge slot. And the clock-input of the shift-register
    is calculated from the M1 and slot-select cartridge slot signals. Short summary
    (see comments in code for details): the TM220 monitors which instructions are
    fetched from ROM, only after a specific sequence it allows to write to RAM.
    So to emulate this cartridge correctly it's important to have an accurate
    emulation of the M1 signal. See previous patch for more details on that.
    Thanks to 'Quibus' and 'l_oliveira' for measuring and reverse-engineering the
    TM220 hardware schematic.
    'Quibus' also implemented the initial emulation of this cartridge. I only
    tweaked it a little and added the M1-write-enable stuff.
    m9710797 committed Jan 25, 2017
Commits on Feb 9, 2017
  1. Implemented accurate M1 cycle emulation

    This is a preparation for the next patch which will add emulation of the
    Tecall_MSX_RAMFILE_TM220 cartridge. So far the only user of the
    MSXCPU::isM1Cycle() method was, and that one was fine with a
    crude M1 cycle approximation. Though for TM220 it needs to be accurate.
    Roughly speaking the M1 pin on the MSX cartridge slot becomes active on every
    fetch of the first byte of an instruction (and also prefix bytes, see code for
    full details).
    One possible implementation would be to remember the address of the last fetch
    which has M1 active. The readMem() method of an MSXDevice can then check
    whether the address that's being read matches with the stored M1 address. This
    is a very simple change, but it does add some overhead on each emulated
    instruction, and most msx devices _by_far_ don't need this information.
    Instead the current implementation re-uses the existing PC register as the
    address of the last M1 cycle fetch. To make this work, the PC register is now
    no longer updated during the execution of an instruction but instead updated
    only once at the end of the instruction. (And slightly more complex for
    instructions with prefix bytes, see comments in code for details). OTOH the
    real Z80 does update PC during the instruction, so to make this difference
    invisible we have to be careful in instructions like CALL, RST, JR that make
    use of the (updated) PC register value.
    It turns out that this new implementation not only doesn't introduce any
    overhead, but it is also faster than the old (less accurate) implementation! At
    least when measuring the "COMPUTED_GOTO" variant of the Z80 emulation. There
    emulating 16700s MSX time now takes 39.5s real time vs 41.2s before (4% faster,
    420x real-time speed). When measuring the non-COMPUTED_GOTO variant the results
    are less clear, there it goes from 55.4 to 55.1 (1% slower, I did repeat
    measurement 5x and took the fastest result for both, but the difference is
    still within measurement error margin).
    The previous paragraph also shows that the COMPUTED_GOTO variant is a lot
    faster than the normal variant. Currently COMPUTED_GOTO is only enabled by the
    "super-opt" build flavour. The motivation for this was that older compilers
    and/or machines with insufficient memory couldn't handle the COMPUTED_GOTO
    variant well. Though that was 8 years ago, maybe it's time to revisit that
    m9710797 committed Feb 9, 2017
Commits on Jan 16, 2017
  1. Updated some info.

    MBilderbeek committed Jan 16, 2017
Commits on Jan 14, 2017
  1. Fixed worker thread join in CliConnection

    It is possible for an instance of a CliConnection subclass to be
    destructed without the start() method ever being called. In that case
    the worker thread was never created and calling join() on the thread
    object would throw system_error.
    We now check whether the thread is joinable before calling join() on
    it. The code that calls join() was moved from the subclasses to the
    base class. This has several advantages:
    - avoid duplicate code now that it's no longer a single statement
    - more symmetry between start() and end()
    - the 'thread' member is now private to the base class
    - it avoids a double join() if SocketConnection::output() initiates
      a connection shutdown on I/O error
    mthuurne committed Jan 14, 2017
Commits on Jan 2, 2017
  1. Sanitize the way Dingux platform is detected.

    Use a more fitting name for the variables at the same time...
    MBilderbeek committed Jan 2, 2017
  2. Use proper way to detect Android platform.

    Same method was used in reverse.tcl.
    MBilderbeek committed Jan 2, 2017
Commits on Dec 31, 2016
  1. Small tweaks (e.g. make constants static)

    Found while going over the "clang-tidy check=clang-analyzer-*" output.
    All actual clang-analyzer warnings were false-positives, but likely because
    I've already run the old "clang-analyzer" tool several times in the past (and
    fixed the real issues then).
    m9710797 committed Dec 31, 2016
  2. Silince "clang-tidy -check=misc-string-integer-assignment"

    Nothing wrong with this code, but add casts to silence the warning.
    This warning tries to catch bugs like
       myString += someInt
    where you meant
       myString += toString(someInt)
    so having this check warning-free is worth the extra (useless) casts.
    m9710797 committed Dec 30, 2016
  3. Bug fix in DirAsDSK

    Only the first few bytes instead of the whole FAT were copied.
    Classic "memcpy(dst, src, sizeof(dst))"-bug, discovered by
      clang-tidy -check=misc-sizeof-container
    m9710797 committed Dec 30, 2016
  4. Fix some "clang-tidy -check=misc-*" warnings

    More in detail: fixed most of these:
      misc-misplaced-widening-cast  (only some)
    m9710797 committed Dec 27, 2016
  5. Fix some "clang-tidy -check=readability*" warnings

    More in detail: fixed most of these:
    m9710797 committed Dec 26, 2016
  6. Fix most "clang-tidy -check=modernize-pass-by-value" warnings

    The idea here is that 'sink' parameters (those that will be copied by the
    callee) should be passed by value rather than by const-reference. And then the
    callee should move the parameter rather copy it.
    Because the parameter is passed by value it's now possible the caller needs to
    make a copy of it. In that case we trade one copy in the callee for one copy in
    the caller and we gain nothing. But it's also possible the callee has an rvalue
    that can be moved instead of copied. In that case a copy is replaced by a move.
    This all assumes that moves are cheaper than copies. Very often this is indeed
    the case. An exception is our TclObject class, there the copy and move
    constructors are equally expensive (or equally cheap). So passing those by
    const-reference is still better than passing by value, and I didn't follow the
    clang-tidy suggestion.
    m9710797 committed Dec 24, 2016
  7. Fixed some "clang-tidy modernize-raw-string-literal" warnings

    E.g. replace the complicated string literal
    both mean exactly the same, but the latter has less confusing escaping.
    There were _many_ more warnings about stuff like:
       string err = "Invalid option: \"" + option + "\".";
    Though personally I prefer this over the suggested alternative:
       string err = R"(Invalid option: ")" + option + R"(".)";
    Maybe I'll change my mind later when I'm more used to the new
    raw-string-literal syntax.
    While going over these warnings I also tweaked some calls to
       myStringRef.starts_with("-") -> myStringRef.starts_with('-')
    m9710797 committed Dec 24, 2016
  8. Fix all "clang-tidy -check=modernize-use-default" warnings

    This warning suggests to replace explicitly empty implemented
    constructor/destructor like e.g.
    with '=default' declared constructor/destructors, e.g.
    	Foo::~Foo = default;
    See here for how this is different and why the latter is (theoretically) better
    Where possible I also moved destructors from the .cc to the .hh file. This
    sometimes allows the compiler to make better inlining decisions.
    I doubt this change will have a measurable speed impact for openMSX. But even
    if there's no speed benefit at all, it's a nice cleanup (removes ~300 lines of
    code). And it's always good to have less warnings from static code analyzers
    like clang-tidy.
    m9710797 committed Dec 24, 2016
Commits on Dec 28, 2016
  1. Fixed copy-paste error in ROM id of ML-F120.

    Thanks to FRS for reporting this.
    Fixes #1048.
    MBilderbeek committed Dec 28, 2016
Commits on Dec 7, 2016
Commits on Nov 30, 2016
  1. Remove suggestion to change sound_driver... it's obsolete now, there's only one real driver supported.
    MBilderbeek committed Nov 30, 2016
Commits on Nov 29, 2016
  1. Remove DirectX sound driver

    This driver was performing worse than the SDL sound driver in tests,
    so there was no value in keeping it around. It also uses native
    window handles, which make it harder to port to SDL2, so there is
    value in removing it.
    mthuurne committed Nov 29, 2016
  2. Don't set time on symlinks when extracting 3rdparty package

    Doing so will set the time on the target file, which might not exist
    or be located outside the build dir.
    mthuurne committed Nov 29, 2016
  3. Use explicit timestamp file to record 3rdparty package extraction

    Previously we used the source directory, but if extraction fails the
    directory might exist and be considered up-to-date. In that case,
    next build attempt would try to configure and build an incomplete
    source tree.
    mthuurne committed Nov 29, 2016
  4. Fixed 3rdparty installing ALSA before configuring SDL

    The previous Makefile suggested that ALSA was installed first, but the
    INSTALL_ALSA variable was undefined.
    mthuurne committed Nov 29, 2016
Commits on Nov 28, 2016
  1. Removed DirectX 7 dev package from 3rdparty

    Recent mingw-w64 releases include the DirectSound headers and link
    library, so we don't have to download those separately.
    We're planning to drop the DirectX sound driver altogether, but this
    cleanup can already be done before dropping the driver.
    mthuurne committed Nov 28, 2016
  2. Work around "near" and "far" being macros on Windows

    This does not cause problems with compilation at the moment, but
    I don't want to leave the code in a state where a small #include
    change might break it.
    mthuurne committed Nov 8, 2016