Extreme Vectrex – reproduction of BadApple

You may have noticed, that in the last 2 months I have been busy with vectrex things again. This includes but is not limited to surfing the internet and looking what other people have been up to.

Quite some time ago I found an interesting page:

Sprites mods – Extreme Vectrex multicard

Really fascinating, what other people can do with a soldering iron… I have been – and always will be – a software guy, nonetheless “Sprites mods” – I am very impressed and full of awe and respect for your achievment.

The software stuff he created and some descriptions are all online available, so naturally I was quite intrigued to try some things on my own.

I have produced a Vide “runnable” version of BadApple, that was not as “easy” going as I would have expected, but nonetheless achievable. Here I will write some of my stumbling blocks and how I navigated around them.
(I did everything on a 2011 IMac, running El Capitan)

  1. Download stuff from above page you will get a “veccart.tgz” which contains all sources you need
  2. Download “any” version of BadApple from YouTube, the version I got was 13.464.02 bytes, MP4 and plays 5:23
  3. You need free software for whatever system you are running on as follows:
  4. MPlayer (home)
    Here the first “trouble” started, the script uses a command line version. I tried searching the net, but I think NOWHERE can you download a simple command line version. BUT, here it is nice to have some insights about how Mac Apps work. You don’t have to!
    I used the standard installation of MPlayerX, than went to my application folder (ok, you better have copy paste ready):


    I copied that entire directory to my BadApple working dir, and made sure to have the mplayer executable in my path.

  5. ImageMagick (home)
    Again we are led to belive everything would work straight out of the box, that was not the case for me.
    Downloading the Mac stuff worked alright. I set up a working directory, a batch (shell) script, that set all needed paths, but the darn thing still would not work. It always complained about wanting to have a libpng15.15.dylib – which did not come with the installer. Sad thing is – I can’t remember what all the steps were which I took and which ones in combination led to finaly working. I am pretty sure that at one stage I installed “MacPorts” and “Homebrew” and installed stuff till, lib png was “correctly” installed in /usr/local/lib.
    Since it still didn’t work I established a symbolic link from the 16 version of the library to the 15 (which I needed), I think that finally did the trick, but I tried many steps and I am not sure if that was all that was really needed.
  6. Potrace (home)
    This one is nice and easy, download it, place it, where you can access it -> done.
  7. Sox (home)
  8. ASM6809 (home)
  9. For vecx (a special version of the emulator is needed later) we also need SDL 2.0 (Framework), I am pretty sure one must copy that by hand to “/Library/Framework”, I did also install via “Homebrew”, while you are at it, also get the packages “image” and “gfx” you will need them.
  10. Now back to the “veccart.tgz”, obviously – unpack it somewhere.
  11. The directory we are interested in now is: “badapple”, copy the mp4 from step 2 to that directory and name it: “Touhou-Bad_Apple.mp4”, to get a short version of what I am writing out here – read the “README.txt”
  12. If the files “convert.sh” and “combine.php” are not executable, flag them such!
  13. I edited “convert.sh” to setup paths etc for the above binaries, the start of my batch looks like:
    # Script to convert a mp4 file into a raw audio file and a bunch of vector files
    # Needs mplayer, imagemagick, potrace and sox
    export MAGICK_HOME="$(pwd)/ImageMagick"
    export PATH="$MAGICK_HOME/bin:$PATH"
    if [ "$1" = "clean" ]; then
     rm -rf png pnm vec
    if [ ! -e png ] || [ ! -e audiodump.wav ]; then
     mkdir png
     cd png
     ../mplayer/mplayer -ao pcm:fast -vo png "../$mp4" -benchmark
     mv audiodump.wav ..
     cd ..
  14. If your unpacker is as stupid as mine, you might check your files. In some of the directories of “veccart.tgz” there are links to files in other directories. Make sure the links are either correct, correct them, or just copy the files. You may have doubles, but it will work ok.
  15. Go to the vecx directory, type make -> and you will see some errors :-).
    The gist of these errors is (I think) that SpritesMods did the package after Doom, not after BadApple, so the files are “configured” for doom. But we (at least I) want BadApple!
  16. Find the file “cart.c” (and if you have doubles, than all of them) In the method cartWrite() comment out the line starting with “voomVectrexFrame(“, we don’t need that and it throws an error.
  17. Also, since we later want sound, in the same function find the (commented) lines:
    if (addr==0) printf(“DBG: 0 %02x\n”, data);
    if (addr==1) cHi=data<<8;
    if (addr==2) printf(“DBG: 1 %04x\n”, data|cHi);
    and uncomment them (oh well addr 0 is not important, but the other two). These lines are later necessary for vecx to generate “sync” information for the digitized sound.
  18. If I haven’t forgotten anything and all installs are correct, you might try a “make” in the vecx directory, if you have troubles > solve them.
  19. going back to the BadApple directory, last thing befor we start a “real” try. Edit the file “combine.php”, scroll way down, in line 41x something you see:
    “$log=fopen(“timing.log”, “r”);”
    For now comment that line. Otherwise an error message is written to stdout. But stdout is where all our output goes (our generated bin file!). So if you do not have timing information yet -> the bin file will start with an error!
    But befor we start in earnest, we come back to edit this file again…
  20. We will now try actually doing something! Run the script “convert.sh”, if you have troubles > solve them.
  21. After one of the stages of building images or such, you may “break” the script, since befor we actually have a good try we need to know how many images are generated. mplayer should have generated a few thousand images in the new “directory” png. Go there, count them! (or just look at the highest number!).
    Take that number and edit the file “combine.php” again. In the top there is a line like:
    //Amount of frames in the movie
    $framect=7777; (or any other number, 7777 is mine!)
    Enter your number there! Scroll down to the end, somewhere arround 41x is a line:
    Enter that number there as well.
  22. Save it.
  23. Delete the newly generated directories (or at least the ones that did not “finish” their job), run convert again.
  24. If everything is alright after 1-2 Minutes, the script will exit and you have a vec.bin (mine is about 12MB, but that depends on the mp4 file you actually chose).
  25. Copy that to the badapple-vec directory
    Make sure the rom.dat is correct and that you have access to AS6809 and vecx.
    Type make!
    If everything was ok, you see vecx playing the movie as a vector movie and stuttering non discernable sound.
    Let it play all through. After everything is finished press “ESC” there should be a file called “timing.log” (mine is about 140 MB). Take that and copy it back to the badapple directory – and go there!
  26. edit combine.php again, and uncomment the above line
    “$log=fopen(“timing.log”, “r”);”
  27. Run it again.
  28. DONE!

Now you have a 12 MB vectrex binary!

a) To run it, you must tell your emulator to run badapple.bin.
b) The file vec.bin must be in the same directory
c) The emulator must be able to do so!
If it is vecx based there are only a couple of lines to change:
1) the function
unsigned char read8 (unsigned address) /write8 (unsigned address)

must be enhanced with two or three lines (see source) and the file cart.c/h must be included.

Vide runs badapple just fine!


(was easy, wasn’t it?)

Tagged on: , ,

4 thoughts on “Extreme Vectrex – reproduction of BadApple

  1. GeoAnas

    I was toying with the same idea, since I first time visited the site you mentioned above. I was writing to Thomas about this. He also mailed me some info of how to do it, but I have to admit it is a rather complicated process to a semi newb like me 🙂
    Video I was eager to convert is ‘La Linea 110’ ( https://www.youtube.com/watch?v=Qs7k5WWOZIM ). There is already a nice demo running on C64, inspired from that ( https://csdb.dk/release/?id=4358 ). I only wish for someone to make an easy to use tool to somehow simplify those conversions… then to enjoy them on our VecFever! 🙂 …and again…Well Done!

    1. Malban Post author

      I just tried.
      It does not look so good. This is due to the fact, that my scripts are still all based on SpritesMods scripts. And they use “potrace” to generate the vectordata.
      Potrace uses “outline tracing” – for a good result for La Linea you would need “centerline tracing” – potrace does not support that.
      I would need to generate a whole new set of scripts based on (e.g.) autotrace (which supports center line tracing).

      The outline tracing results in all vectors being doubled (out line of a line -> two lines).
      This results (obviously) in the double amount of vectors – which sometimes heavily decreases the “resolution” available.

Leave a Reply

Your email address will not be published. Required fields are marked *