PiTrex baremetal: Download

Pitrex baremetal FAQ: PiTrexBM_FAQ.txt

ZIP-File containing a complete baremetal distribution

A zip file containing all files necessary to start the PiTrex baremetal with some “demos”.

Easiest way:

  • format a SD card to FAT32
  • copy all files from the zip file to the sd drive
  • insert into PiTrex
  • switch the vectrex on

To format on Mac OSX the graphical disk tool is of no use. You have to do it “manually”.
1) check your disk drives, with command line:
diskutil list

This will list all your drives – check which one is your SD drive

2) From command line format the drive with:
sudo diskutil eraseDisk FAT32 BAREMETAL MBRFormat /dev/disk3

Where “BAREMETAL” will be the name of the SD, and /dev/disk3 must be replaced with the correct path to the SD drive (you got from the “list” command).

To use the arcade emulations, you still must copy the correct romsets to the SD-card. (See: FAQ)

3071 Downloads

SD-card image (zipped) (16 GB)


The image file is a “deep copy” of the COMPLETE SD card. To use it, you have to create a SD card with that image. For this special programs are necessary.

The means to do so are explained here: create-image-sd-card (although the site is ad contaminated – it contains useful information).


(if the “ZIP-File” has a more current date – just copy its contents over to created SD card)

To use the arcade emulations, you still must copy the correct romsets to the SD-card. (See: FAQ)

1506 Downloads


Source code

The Source code to all above (binary) programs is available in the current Virtual Box image (next page: PiTrex baremetal: Quick start), or contained in the following “zip”:
(this one is usually more up to date – so if you “work” with the Ubuntu image – copy these files over the ones contained there!)

The most current sources can now be found on the github repository at: https://github.com/malbanGit/pitrex-baremetal


Changelog:

22th of December 2021

  • small changed / bugfixes
    Vectorblade did not start anymore
    Vecmania had “problems” with joystick access

21th of December 2021

  • some days ago, fixed bankswitching in vectrex emulator for 64k
  • added options to invert joystick y-direction (common ini)
    (each individual ini file can now have the option (INVERT_Y_AXIS = 1/0)
  • added “analog” scroll for vectrex exact selection of files
  • added VOOM
  • added lineArt demo!
  • added Rebel Defender (no sound)
  • thought about adding: icbm3d, xinv3d, xlander
    but these are not my kind of games, I don’t like them, unless someone “begs” to add them
    I leave them be, sources can be found under “new.not_done”


14th of December 2021

  • added support for PiZero2
  • changed menu system to only display “machines” not different emulators
  • added quite a few icons
  • added Star Wars SBT version, with also added performance tuning and first sounds
  • added BattleZone 2 (beta) (Peter Hirschberg) not optimized yet and without sound, this is another c++ program easily ported to baremetal!
  • added WW Vi (beta), sounds are only played via samples, using for the first time the vectrex library’s mixing feature. Sounds terrible!
  • added for Warrior and Armor Attack virtual overlays
  • source code started restructuring – the bare metal part, to get rid of the different GPIO/BCM access functions
  • due to support for PiZero2 all images are now TWICE on the SD card – in subdirectories PiZero1 and PiZero2
  • booting should work out of the box with both Pi’s (copy the COMPLETE files, you need the newest “start.elf, fixup.dat and bootcode.bin”

15th of June 2021

As many changes as I remember…

  • z80 emulation is now working in AAE
  • 68000 emulation is now working in AAE
  • except (I think) two games all of the original AAE games are now working, loadable and sometimes playable
  • sound and beautifying was NOT done
  • “general” input methods were implemented (input.c) – if the emulators support these, than they can be played, in general:
    START 1 = joystick 1 button 1+2 at the same time
    START 2 = joystick 2 button 1+2 at the same time
    COIN 1 = joystick 1 button 3+4 at the same time
    COIN 2 = joystick 2 button 3+4 at the same time
    player 1 buttons 1-4 = joystick 1 button 1-4
    player 2 buttons 1-4 = joystick 2 button 1-4
    player 1 digital UP/DOWN/LEFT RIGHT = joystick 1
    player 2 digital UP/DOWN/LEFT RIGHT = joystick 2
    player 1 analog UP/DOWN/LEFT RIGHT = joystick 1
    player 2 analog UP/DOWN/LEFT RIGHT = joystick 2
  • Asteroids (SBT) two player mode fixed (the emulation did not support the RAMSWP flag), also the explosions now differ slightly
  • Elite (a new kind) is in beta state.
    It should be completely playable (except bugs). To play one NEEDS a keyboard attached to the PiTrex.
    The game is fully controllable via keyboard, but steering/shooting can also be done via joystick 1.
    The keyboard layout is as described in “elite_readme.txt”.
    I have not tested the complete game, as it contains MANY faccets – feedback/reports welcome.
    The game could use some overlay, since not all screen elements are self explanatory in the vectrex version.

    Left side:
    FS: Front shield
    AS: Aft shield
    FU: Fuel
    CT: Cabin temperature
    LT: Laser Temperature
    AL: Altitude
    Missiles (up to 4), green, yellow, red

    Right side:
    SP: Speed
    RL: Roll
    DC: Climb
    1: Energy banks 1
    2: Energy banks 2
    3: Energy banks 3
    4: Energy banks 4
    E – ECM active
    S – Station (is in range)

    Scanner upper right:
    Radar, where your target is
  • Internal changes/additions to the vectrexInterface.
    – a new “widget” Itemlist, Elite now uses this quite a lot (inspired by Thomas…)
  • It seems to be a “bad” idea to configure USB keyboard twice in the same program, therefore keyboard support in the “loader” has been disabled.
  • I started supporting bi-directional strings, this is theoretically working, but I do not use them, and would like to keep it that way, they always seem to “fork” near the edges – and I can’t get rid of it. There are 4 new configuration items in the settings, but since I don’t use this – these are also useless :-).

7th of May 2021

  • added GS BASIC (https://vectrex32.com/)
  • BASIC starts in the directory “/basic” – since no directory changes can be done from BASIC, this is the BASIC “home”
  • gsbasic.ini for some “option”, more information in the file:
    GS_BASIC.txtm OtherTitle.txt VXTRON.txt
  • GS BASIC Copyright (c) 2021 Robert E. Alexander
    Usage and distribution is granted under the MIT licence, see MIT_licence.txt
    THX! Bob!
  • also included (amongst others) is VxTRON
    VxTron32 (c) 2020, Jaymz Julian
    in s slightly modified version
  • added support of USB keyboards (see source code distribution: usb_readme.txt)
  • I started the USB keyboard thing, because I wanted to control “Elite a new Kind” via keyboard, rather than invent tricky button double/tripple usages.
  • “Elite a new Kind” is as of now only included as a “demo” version (start screen), since GS BASIC came along an stole my time 🙂 – actually the whole game is compiled, but I haven’t configured the keyboard in, and didn’t look at/fix any of the non vector gfx yet
  • I started porting the MAME z80 processor emulation to be used in AAE, it compiles now without flaws, but I have as yet not changed the API to fit AAE. Once I have done, almost all SEGA games should work.
  • I am also thinking about (as a quick hack) to add USB keyboard to AAE, than the default key mapping
    settings should work for all games out of the box, and they would be playable via keyboard – not optimal, but better than “waiting” to manually configuring each and every game to the vectrex controls
  • Asteroids (sbt) can now in the ini file be configured to use/not use samples
  • during the above changes… some bugs were discovered and fixed in the vectrexInterface, can’t remember them all
  • osWrapper.c is “wrappier” than before 🙂 e.g. if keyboard is configured you can use fgetc() to “wait” for keyboard input, also added a “good”malloc() implementation, but as of now I am not using it. I rely on the stdlib, after implementing a rudimentary sbrk(). C++ new() and delete() should that way work also ok.
  • vectrexInterface can be configured to use two sample channels, these will be mixed. Default this is “off” – but it DOES work!
  • started looking at bitmaps again, one of the next things will be to add bitmap output to the IRQMode (as of now, this os not yet supported)
  • changed the “structure” of the baremetal directories, vectrexInterface (and others) are now build as libraries, not several object files. All Makefiles were changed (slightly)
  • GS BASIC is written in c++, thus c++ is now supported to be built.
    As an example look at GS BASIC. For now, the global/static constructors must be called “manually” in the main() function (6 lines of code), if you intend to program c++, these lines must be copied!
  • also implemented the afore mentioned “persitent vectors”, but as of now they are configured “out”. With GS BASIC I could not use them afterall. These are not completely debugged, so I am not sure that they work under all circumstances.
  • added emulation of the TMS5220 to sample out (Star Wars), although since star wars is to slow, the output is rather choppy

12th of April 2021

  • added the possibilty to play samples alongside vectordisplay
    (digitized sound will be barely audiable on noBuzz vectrex – there is nothing I can do about it!)
  • added for asteroids 2 samples (explosions)
  • tweaked battlezone, for “english” settings output might be smoother than before (other languages not supported yet)
  • added “1 joystick mode” for battlezone, this is the new default
  • for battlezone added dipswitches
  • for battlezone highscore saving/loading added
  • added sound to battlezone (except the engine sound)
  • added the start of AAE emulation the aae emulator can be access from the menu (last arcade emulator)
  • then you can chose which game to “play”
  • loadable and with “input”: Star Wars (6809) and Major Havoc (6502), but I have not really tried optimizing them – and one can see that!
  • Cinematronics games (ccpu) are loadable as well, but I have not configured input
  • I forgott to switch IRQ mode on for the AAE emulator, so if configured right, there would be a probably more than 20% speed increase
  • I am still waiting on feedback in relation to the Z80 CPU. Once I get a working copy, probably all SEGA games can be supported as well.
  • AAE roms are not included – and I don’t know what version you need, but “clues” can be found in the readme in the ROM directory
  • many tweaks to the vectrexInterface…

26th of March 2021

  • default calibration is back to zero, on the todo list -> calibration for noBuzz vectrex
  • added configuration (ini file) for input settings, as of now asteroids only, look at the ini file
  • added dipswitch settings (ini file), as of now asteroids only, look at ini file, in game these can be called with button 1+4 on joypad 1
  • fixed asteroids output to accomodate the 4 different languages
  • fixed a “calibration 0” bug with in the vectrex library, y pos could be always “0” after calibration (visible with asteroids shots)
  • fixed “speedy vectrex” raster output
  • added ini setting “IN_GAME_SETTINGS” which enables or disables Button 2 of Joypad 2 to invoke settings menu. Per default this is OFF
  • vectrex save state, if enabled (ini setting HANDLE_STATES), it asks you whether to save or not, also shows a “SAVING…”.
    Saving seems to take sometimes up to 18 seconds (with my SD cart, less than a second…)

I have to further evaluate the “speed”.
I have measured the piZero speed, and as far as I can measure:
1 Mhz timer is pretty exact
Cycle timer is pretty exact
Vectrex T2 timer is pretty exact
The reason I mention this… although “programmatically” and reports during game support this… the games are running all at the correct speed.
However …

  • if I compare the games with MAME or the VecFever – it seems they are to slow
  • Kevin mentioned ZBlast as being to slow
  • the sample tests… seem output of the samples are to slow

I am at a loss what may cause that. As said timing measurements are correct – somehow I must be doing something wrong here… but measuring speed with several timers, is not really THAT complicated, that one would easily mess it up…


24th of March 2021

  • IRQ mode implemented, vectrex output about 20% faster
  • if you are a PiTrex baremetal programmer, contact me, to get notified of changes you have to be aware of!
  • game update frequency is disjunct from the vectrex display frequency
  • asteroids now has a “hyperjump” button
  • asteroids saves / loads highscores
  • XSH delay is now correctly implemented, that should “correct” the last seen screen garbles on some vectrex

15th of March 2021

  • removed all settings files
  • removed all “old” ini files
  • the “main” ini file is now vectrexInterface.ini
  • Settings can be changed from the menu, if reached via the menu, the settings will be saved to sd drive
  • settings “in game” can be called by pressing button 2 of joystick 2, these will be active but not saved (yet)
  • games/ emulators can still have own ini files, but I did not create default ones
  • all games/emulators have now sensible default values to start with
  • Settings are now applied in following order
    a) Settings from vectrexInterface.ini
    b) default settings inside the emulator
    c) Settings from the emulator specific ini file
  • Navigation within the “settings”:
    Joystick port one:
    UP/DOWN – change configuration item
    LEFT/RIGHT – change the settings for the current item
    Button 1 – show help for the current selected item
    Button 2 – change the shown vector list
    Button 4 – exit (and save)
    Button 2+3 together – reset current configuration item to default settings
    Button 3+Joystick – move vector list
    Button 2+Joystick LEFT/RIGHT – change settings value in larger steps
  • vectorblade bugfix (emulation, not vector blade)
  • added config to battle zone (see battlezone.ini)
  • corrected after “calibration” weirdness
  • corrected “after dot move”
  • added config to leave dots in there list position
  • added clipping to some emulators
  • changed the intro + “bouncing PiTrex”

Settings explained here:

11th of March 2021

  • added additional logging on save state of vectrex – pls test that again and send me the output
  • additionally on vectrex Joypad 2- button 1 saves the state, Button 4 loads the state.
    Does this also crash? – Pls report back!
  • the pipeline “timing” in vectrex interface was changed from using the pi TIMER to using the pi cycle timer, which is much more exact (100 times!). Thus internally seemingly a lot changed!
  • I spent much time with improving asteroids.
    The display should be much more stable. The Asteroids should move much smoother!
    The display should not shake or wobble (as much) when a UFO appears, bright shots are fired or the “PUSH START” appears. Still left to do: speed up (so the game over text appears flicker free), save highscores.
    This – although it cannot really be seen – proved to be not really “simple” – but this also layed the ground work for improving other emulators. We now have the ability to identify vector clusters and react to them “outside” of the emulation. As a showcase for that, you can configure in the ini file whether you want to see the atari copyright in game or not.
  • added the before only on raspbian available game “ZBLAST”, including high score save, sound and background music. The music was given to me by Roald Strauss, who also has a website (IndieGameMusic.com), where he offers free – and royalty based – music scores of different kinds. From chip tunes and mod files to MP3. Thank you!
  • added the before only on raspbian available game “Hyperoids”, including sound.
  • both additions would not have been possible without the vectrexInterface / svgalib interface programmed by Kevin Koster. Using his base it was a matter of a couple of hours to support these two games.
  • added several “icons” to the menu.

02nd of March 2021

  • I have completed the dumb/stupid/boring task, to change ALL needed arcade emulation roms to MAME compatible roms (I tested loading with MAME roms 201 and 229, so “everything” newer than 2 years old should work)
  • also supported are ZIP files, thus – just copying MAME roms to the “roms” folder is enough to get started with arcade emulations
  • This means to run arcade emulation, you MUST provide new zip/rom files!
  • I have added all “current” emulators that appear to at least run a little bit. I have not found many “cinematronics” emulations that run really well.
  • best is probably tailgunner, starhawk, barrier…
  • also added all “sim” emulators most of them boot up and are actually playable – although without sound
  • I am astonished, that the “sim” asteroids emulation actually crashes after a while… there must still be something wrong in the 6502 emulation core… (the roms are identical to to sbt version)
  • “icons” for those are missing… I have to get some more podcast to star drawing again… this will be put off for a time
  • all emulators support now “ini” files, these can also be specific for each emulated rom
  • I added a new option to the ini file “LOG_OUTPUT=1; if different than 0 – than log all “printf” outputs also to SD”, once you can test the new version and the
  • screen still goes black upon returning – I hope the captured output can help me identify the problem 
  • for the “atari”/sim emulators I added “sensible” ini files

27 thoughts on “PiTrex baremetal: Download

  1. auburn3020

    Can you describe the correct ROM set for Asteroids (.zip contents, any dependency files)? I’m getting a “ROM LOAD ERROR” when I try to launch it, I’ve tried files from several different MAME versions including the current (0.229). Thanks…

    1. Malban Post author

      Yea, sorry, the Asteroid one may be trickier.
      Thing is the SBT version was done with what is now called “asteroid2.zip”.

      MAME sets come in different flavors, I think FULL, MERGED and SPLIT.

      What and where exactly is what… I do not know.
      What you need is (in my terms) a “full Asteroid2.zip” – an complete without needing anything else Asteroids2 rom set.

      I think if you have split (or merged???) than the files that are the “same” in all Asteroids versions are only contained in the “asteroid.zip” – as to not double those files.
      If you have roms of that category you will need BOTH asteroids.zip and asteroid2.zip.

      To make it a bid easier I support both versions…

      The thing is if you have the “wrong” asteroid2.zip, than the files from asteroid.zip are missing.
      If you only have asteroid.zip, than the files from asteroid2.zip are missing….

  2. Caleb

    Where do you need to place the Star Wars and Major Havoc ROMs for them to load? I tried them in the AAE but got nothing but a black screen

    1. Malban Post author

      roms/aae/ …
      If they don’t load, they are probably “wrong”. You can look at the messages, by enabling the file logging.
      In the ini file write:
      LOG_OUTPUT = 1
      Than a log file will be written, which contains messages about the rom loading.
      (don’t forget to switch the logging off, since it slows everything down)

  3. John Reder

    In the Vectrex emulator I noticed that the second joystick is configured for functions related to state. Is there currently a way to use it as a normal port for games with the spinner mod or 2nd player games?

      1. John Reder

        Thanks, that explains a lot! Sadly, no matter what I set the HANDLE_STATES = value to 1, 0, I even tried 3 to see it it would error, in the vectrex.ini or creating a specific ini for the game itself, it always brings up the save state 1 skip 4 menu the moment I plug in or turn the spinner, I press 4 to skip but this repeats in a loop until I unplug the spinner from port 2. I looked through the .c and .h source but cannot seem find the file where this value is read in. It’s no big deal if the spinner support isn’t there I can use another multi-cart to play those, but I’m posting this in case there is something obvious I might be missing. Thanks again, just looking over all that code made me realize just how much work you’ve put into this!!!

        1. Malban Post author

          It is in the file main.c and ser.c in the directory vectrexBase.
          The vectrex.ini file should read:
          ATTENTION!!! The section (VECTREX_EXACT) must be given!!!

          [VECTREX_EXACT]
          HANDLE_STATES = 0

          The code that actually is responsible for the save can be found in the main.c in function:
          static void emuloop(void)

          within that function….

          if (doStates==1)
          {
          printf("Starting to save to: %s\r\n", stateName);
          vecx_save(stateName);
          printf("Save done: %s\r\n", stateName);
          }

  4. John Reder

    Thanks, after looking this over I think this is working correctly, I believe I want to focus on figuring out a way to make BUTTON 1 JOYPAD 2 somehow not bring up the save state screen. perhaps this is loaded before the Vectrex emulator, perhaps loaderMain.c ? I see in the vectrexinterface.ini where you can disable the settings menu button 2 on joypad 2 with IN_GAME_SETTINGS = 0, I need something similar for button 1 to allow the spinner to function without launching the save state option screen. A setting something like IN_GAME_SAVE = 0

  5. Ed

    just got my pitrex in the mail and was getting everything set up via the faq, but had one question i couldnt find an answer to: in the US with US vectrex, should i set REFRESH_HZ to 60? or is this separate from the old pal vs ntsc days and i should leave it at 50?

    sorry if this is the wrong place to ask lol

    1. Malban Post author

      No need to change anything.

      PAL/NTSC/SECAM… are television standards. These are not standards for CRTs per se…

      Vectrex is no television – so these do not apply 🙂

      1. Ed

        got it, makes sense. its the first vector monitor ive ever owned and i guess i never really thought about it lol

        thanks for the quick reply! (also this thing is VERY COOL)

  6. Jürgen Oster

    Version 22.12.2021: Fantastic package – now everything’s running fluidly (had some problems with the navigation through the menus)! After a short test on my machine (non-buzz): the speech intro can be heard – that’s great. Clean Sweep and Mr. Boston can only be controlled by the buttons – not by the joystick (maybe something that can be configured manually?). Again: thanks for your great work!

    1. Malban Post author

      I am not at home right now, pls bug me again in a week or so in regard to the Clean Sweep thing. Lest I forget to look after it…

  7. Phill @NES4Life

    Hey Malban, absolutely loving the 22.12.2021 PiTrex build. I got it working fine with the full SD card image (img.zip) cloned using BalanaEtcher but had no joy with just dragging the files from the other ‘SD_DRIVE…zip’ file.
    Vector Blade is a great game indeed!
    Is there a YM player for PiTrex?

    1. Malban Post author

      No, I never did one – but actually should not really be a problem.
      I think I looked at it once and I didn’t find a good open source unpack routine for LZH.
      If you can share one – I can make a ym player in no time.

  8. Gregg Woodcock

    AAE Roms are:
    Directory \roms\aae
    11.12.2005 19:24 7.044 asteroib.zip
    11.02.2006 11:14 7.020 asteroid.zip
    11.02.2006 11:14 7.020 asteroidb.zip
    14.10.2007 14:48 6.978 astropal.zip
    17.09.2006 18:09 5.390 clowns.zip
    01.01.2006 16:31 17.779 deltrace.zip
    11.02.2006 14:03 5.553 gmissile.zip
    11.02.2006 16:21 8.741 invad2ct.zip
    17.09.2006 18:09 8.320 invaddlx.zip
    09.01.2006 20:00 5.364 invaders.zip
    17.09.2006 18:09 8.769 invadpt2.zip
    11.02.2006 16:22 7.490 ipminvad.zip
    17.09.2006 18:08 9.836 lrescue.zip
    11.01.2007 19:10 19.606 lunarba1.zip
    11.01.2007 19:10 20.828 lunarbat.zip
    11.02.2006 18:40 11.297 lupin3.zip
    12.02.2006 02:19 6.981 meteorts.zip
    12.02.2006 02:23 15.386 milliped.zip
    12.02.2006 02:23 10.728 missile.zip
    13.02.2006 06:11 5.721 sicv.zip
    17.09.2006 18:08 6.009 sitv.zip
    13.02.2006 10:19 12.998 solarq.zip
    13.02.2006 15:43 3.821 suprmatk.zip
    14.02.2006 06:36 10.860 warlords.zip

  9. Andrew

    Hi Malban, received my Pitrex and set everything up however having issues with the controller when playing Vectrex games (exact or speedy modes), particularly with games that require up and down movement like Berzerk when you press up or down the character moves diagonally. This is with the 22/12/2021 build however I flashed the 26/03/21 img and there is no issue with up or down movement, I’m using a Raspberry Pi Zero.

    1. Malban Post author

      I startet using GIT a little bit later, so I don’t know exactly what changes I did.
      Pls contact me using my email directly (see contact) if interested in further examiniation – I’d have to try different things to get to the gist of the problem. Obviously I need your help, since I can not recreate your problem with my Vectrex.

      Some questions now:
      – is it the same using an analog and a digital joystick?
      – what “diagonals” (up/left or up/right, down/left or down/right)
      – does changing the value of “CYCLE_EQUIVALENT” (in the ini files of pitrex / or vectrex) change anything?

  10. John Reder

    I noticed in Cavern Rescue the joystick only rotates the ship in one direction no matter which way you move it. Other games seem okay, its still very playable but wondered if there was a way to resolve that.

    1. Malban Post author

      I can confirm that is a bug in the last PiTrex release.
      It had been fixed quite some time ago – but I never released the fix.
      If you need that fix – please write me an email and I’ll send you a vectrexExact.img file.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.