Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Shell C VHDL Assembly C++
branch: master

README

LX9R3-BASED USB MEGADRIVE DEVKIT

You'll need an lx9/r3 board:

  https://github.com/makestuff/lx9/tree/r3

...and a umdkv2-lx9/r1 board:

  https://github.com/makestuff/umdkv2-lx9/tree/r1

Preparation:

  sudo apt-get install build-essential libreadline-dev libusb-1.0-0-dev python-yaml
  mkdir $HOME/20140311
  cd $HOME/20140311
  wget -qO- http://makestuff.eu/bil | tar zxf -
  cd makestuff/
  scripts/msget.sh makestuff/hdlmake/20140311
  cd hdlmake/apps
  ../bin/hdlmake.py -g makestuff/umdkv2
  cd makestuff/umdkv2

You can build the loader & tracer like this:

  cd loader
  make deps
  cd ../logread
  make deps

You can build the VHDL like this:

  cd ../vhdl
  ../../../../bin/hdlmake.py -t ../templates/fx2min/vhdl -b lx9r3 -p fpga

You can verify the SDRAM like this:

  # Load microcontroller & FPGA:
  ../loader/lin.x64/rel/loader -i 04b4:8613 -v 1d50:602b:0002 -p J:A7A0A3A1:fpga.xsvf

  # Load random data:
  dd if=/dev/urandom of=random.bin bs=1024 count=16384
  ../loader/lin.x64/rel/loader -v 1d50:602b:0002 -f random.bin

  # Verify it
  ../loader/lin.x64/rel/loader -v 1d50:602b:0002 -f random.bin -c

You can run a game like this:

  # Load ROM & start it running:
  ../loader/lin.x64/rel/loader -v 1d50:602b:0002 -f sonic1.bin -s

You can verify the ROM data of a running game against the original ROM file like this:

  ../loader/lin.x64/rel/loader -v 1d50:602b:0002 -f sonic1.bin -c

You can get an execution-trace like this:

  ../loader/lin.x64/rel/loader -v 1d50:602b:0002 -t trace.bin
  ../logread/lin.x64/rel/logread sonic1.bin trace.bin | less

You can build the "dis68" utility to make sense of the execution trace

  scripts/build-gdb.sh
  /usr/local/bin/dis68 sonic1.bin 0x206 10

You can also do everything at a lower level using flcli from the FPGALink project:

  dd if=/dev/urandom of=random.bin bs=1024 count=16384
  flcli -v 1d50:602b:0002 -p J:A7A0A3A1:fpga.xsvf
  flcli -v 1d50:602b:0002 -a 'w0 0000000080800000;w0 "random.bin"' -b
  flcli -v 1d50:602b:0002 -a 'w0 0000000040800000;r0 1000000 "out.bin"' -b
  diff out.bin random.bin

The ROM load/save and reset-control functionality may be used from flcli too:

  # Load Sonic image and verify
  flcli -v 1d50:602b:0002 -a 'w0 0000000080040000;w0 "sonic1.bin"' -b
  flcli -v 1d50:602b:0002 -a 'w0 0000000040040000;r0 80000 "out.bin"' -b
  diff out.bin sonic1.bin

  # Release the MD from reset
  flcli -v 1d50:602b:0002 -a 'w1 00'

  # Put the MD back in reset
  flcli -v 1d50:602b:0002 -a 'w1 01'

Note that the initial memory-controller command specifies a data-length in 16-bit words, not bytes.

You can build and test the GDB bridge as follows. Note that this assumes you've built the VHDL and
installed, and that you've installed NASM with sudo apt-get install nasm, and that your computer is
capable of building x86 code (Starscream uses x86 assembler, so you can only run it on x86
machines):

make -C m68k/example
cd gdb-bridge
../scripts/build-star.sh
make MACHINE=x86
Something went wrong with that request. Please try again.