Skip to content
S0urceror edited this page Jun 14, 2022 · 2 revisions

MSXVR reverse engineering

Following extensive tracing with Logic Analyzers and Ghidra reverse engineering I was able to reverse engineer the workings of the MSXVR machine.

I have nothing but admiration for the quality of the hardware. Yes using a RPI3 to do the heavy lifting. But the PCB has all the MSX ports you can imagine, plus more. And the injection moulded case with mechanical switched keyboard really complete it for me.

On the software side of things it is a mixed bag. The breath of the included software is immense. An underlying MSXVR kernel with a GUI that can run your own apps, a reimagining of DOS called VR-DOS, it's own VR-BASIC, a handful of Apps and of course there is the MSX Emulator that tightly integrates with the hardware and can run most original HW and SW. Plus it can also run specifically programmed MSXVR apps in VR-SCRIPT. A fully object-oriented language with access to the Internet, new graphic modes and OpenGL like concepts.

Looking at all this functionality the software is great. Looking at the slow performance, the fact it introduces new concepts that are neither MSX and neither in line with modern thinking it starts to become a bit problematic. Not that I can blame the team about this. This is a humongous task to build something like this.

Unfortunately, even though I have a lot of love for the system, I cannot do anything about this because the hardware and software is closed. You cannot update or improve the software. You can of course install your own flavour of Linux on the RPI but then you have no access to the hardware.

Until now that is.

I hope that with this information and accompanying libraries people will be able to run the emulator of their choice, like a special build of OpenMSX, VICE, etc.

Or why not step into the modern world and build C++, Rust, NodeJS or Python to program against the VR hardware. Or create PICO-8 games and run them from a physical cartridge? The possibilities are endless and the original MSXVR hardware could be used in much wider retro-machine flavoured concepts.

SDK

The SDK I developed taps into the VR hardware and abstracts all the underlying details in a straightforward way. I am releasing a C++ version first but will create a Python library for this as well.

OpenMSX build for VR

I used the VR SDK and integrated it in OpenMSX. The most versatile and used open-source MSX emulator that aims for perfection. At least that is their slogan.

This build enables you to activate special MSXVR features in the configuration file. All optional so you can choose how much of the hardware you want to emulate and how much you want to be real. The result is a nice hybrid of emulator and original hardware, like cartridges, joysticks, cassette recorder, leds and switches.

The following features are now supported:

  • LEDS - power, caps, pause, kana, fdd, 4 user defined ones, plus cartridge VCC.
  • Switches - power, reset, pause, VCC on/off.
  • Joysticks - two fully functional joystick ports to be selected under Hardware/Connectors/Joystick.
  • Cassetteport - selected as pluggable under Hardware/Connectors/Cassette.
  • 4 cartridge ports - that can be selected to any primary or secondary slot you want.

N.B. the striked-through portions are on my wish list but not yet supported in this release.

Example configuration file

Below an example OpenMSX configuration file based on my beloved Philips NMS8250 machine.

<?xml version="1.0" ?>
<!DOCTYPE msxconfig SYSTEM 'msxconfig2.dtd'>
<msxconfig>

  <info>
    <manufacturer>Philips</manufacturer>
    <code>NMS 8250 (MSXVR)</code>
    <release_year>1986</release_year>
    <description>A popular MSX2 machine in the Netherlands.</description>
    <type>MSX2</type>
  </info>

  <MapperReadBackBits>largest</MapperReadBackBits>

  <CassettePort/>

  <!-- this main config item serves as the toggle switch for all MSXVR features -->
  <!-- enables LEDS, Switches, Cartridge and Joystick ports -->
  <MSXVR/>

  <devices>
    <primary slot="0">
      <ROM id="MSX BIOS with BASIC ROM">
        <mem base="0x0000" size="0x8000"/>
        <rom>
          <sha1>6103b39f1e38d1aa2d84b1c3219c44f1abb5436e</sha1>
          <filename>MSX2.ROM</filename>
        </rom>
      </ROM>
    </primary>

    <!-- you can add any MSXVR physical cartridge slot to a primary slot in the emulator -->
    <primary slot="1" external="true">
      <MSXVRSlot physical_slot="1">
        <!-- full address range -->
        <mem base="0x0000" size="0x10000"/>
      </MSXVRSlot>
    </primary>

    <primary slot="2" external="true" />

    <primary slot="3">
      <secondary slot="0">
        <ROM id="MSX Sub ROM">
          <mem base="0x0000" size="0x10000"/>
          <rom>
            <sha1>5c1f9c7fb655e43d38e5dd1fcc6b942b2ff68b02</sha1> 
            <filename>MSX2EXT.ROM</filename>
          </rom>
        </ROM>
      </secondary>

      <secondary slot="2">
        <MemoryMapper id="Main RAM">
          <mem base="0x0000" size="0x10000"/>
          <size>128</size>
          <initialContent encoding="gz-base64">eNpj+M8wouEI9z4DAJBx/wE=</initialContent> 
        </MemoryMapper>
      </secondary>

      <secondary slot="3">
        <WD2793 id="Memory Mapped FDC">
          <connectionstyle>Philips</connectionstyle>
          <mem base="0x0000" size="0x10000"/>
          <!-- Verified on a real 8250 and 8280: FDC registers are visible
               in all 4 pages, rom only in page 1. This is handled internally
               in the WD2793 device -->
          <rom>
            <sha1>dab3e6f36843392665b71b04178aadd8762c6589</sha1>
            <sha1>c3efedda7ab947a06d9345f7b8261076fa7ceeef</sha1>
            <sha1>8625c6b633d9cca2875e4dc33404fb98653379d7</sha1>
            <sha1>94b3c862625710660961d9886ae305e74b2c01ae</sha1>
            <filename>DISK.ROM</filename>
          </rom>
          <drives>1</drives>
        </WD2793>
      </secondary>
    </primary>

    <PPI id="ppi">
      <io base="0xA8" num="4"/>
      <sound>
        <volume>16000</volume>
      </sound>
      <keyboard_type>int</keyboard_type>
      <has_keypad>true</has_keypad>
      <key_ghosting_sgc_protected>true</key_ghosting_sgc_protected>
      <code_kana_locks>false</code_kana_locks>
      <graph_locks>false</graph_locks>
    </PPI>

    <VDP id="VDP">
      <version>V9958</version>
      <vram>128</vram>
      <io base="0x98" num="4" type="O"/>
      <io base="0x98" num="2" type="I"/>
    </VDP>

    <PSG id="PSG">
      <type>YM2149</type> <!-- in S-3527 MSX-ENGINE -->
      <io base="0xA0" num="2" type="O"/>
      <io base="0xA2" num="1" type="I"/>
      <sound>
        <volume>21000</volume>
      </sound>
      <ignorePortDirections>true</ignorePortDirections>
    </PSG>

    <RTC id="Real time clock">
      <io base="0xB4" num="2" type="O"/>
      <io base="0xB5" num="1" type="I"/>
      <sramname>nms8250.cmos</sramname>
    </RTC>

    <PrinterPort id="Printer Port">
      <io base="0x90" num="2"/>
    </PrinterPort>

    <CH376s id="ch376s">
      <io base="0x20" num="1" type="IO"/>
      <io base="0x21" num="1" type="IO"/>
      <io base="0x22" num="1" type="IO"/>
      <io base="0x23" num="1" type="IO"/>
    </CH376s>

  </devices>

</msxconfig>
Clone this wiki locally