# MiSTer FPGA (computer/console/arcade hardware simulation)

Discussion in 'Retro & Arcade' started by elvis, Oct 14, 2018.

1. ### MUTMANMember

Joined:
Jun 27, 2001
Messages:
6,021
Location:
4109
All right. A fist of add-ons added. Ram (tests ok at 167) an IO board and the sorgelig USB board
Software
Ive run the update on the updater and now have an sd card loaded with cores
Galaga is much harder without the fast shoot hack. Ive had a 300k high score with the hack on, level 60 or something. No hack and i managed a 90k score on lvl 14
Im about to get friendly with the rom injector me thinks

Hardware
I'll be getting someone at work with a 3d printer to make the MiSTer v5.2 and USB base cases to contain the cables and add some protection.
Anyone got a link to a good sd card extender cable ? Not sure it's essential but it cant hurt.

Output
I should of kept one of my two 21" sony trinitron's...16x12 @ 85hz... Oh well. But i do have a old 17" vga monitor to roll out this weekend, so I'll get my electron bombarded phosphorus fix soon

So far im very impressed. This thing is really quite polished considering the nature of the project and the early stages its at.
I can see this wont die out easily now, the updates are increasimg in number each day. Good times (and arthritis wrists) ahead

Vanne, flain, Fitzi and 1 other person like this.
2. OP

### elvisOld school old fool

Joined:
Jun 27, 2001
Messages:
36,000
Location:
Brisbane
I don't have anything to sell, but I bought from https://misteraddons.com/ run by PorkChopExpress from the Atari Forums.

The storefront was easy to use, and postage was very reasonably priced. From when I clicked buy to items ready to ship was less than a day. Everything arrived well packed and in working order.

Joined:
Oct 10, 2011
Messages:
943
Location:
Australia
MUTMAN likes this.
4. OP

### elvisOld school old fool

Joined:
Jun 27, 2001
Messages:
36,000
Location:
Brisbane
Well, I mucked around for an hour today trying to compile NFS kernel modules in for the MiSTer supplied Linux kernel, but no dice. Got a cross-compile toolchain working, got the kernel modules compiled, but getting symbol errors on insmod. Might leave that for another day and actually have a bit of a play instead.

Later this week I'm going to see if I can script up a way to extract ROMs from a MAME set to prepare them for MiSTer.

Last edited: Mar 14, 2019
MUTMAN likes this.
5. ### flainMember

Joined:
Oct 5, 2005
Messages:
2,268
Location:
Sydney
I had a good play with the smokemonster tools but did find that i was always missing roms when i ran them against my old rom collections and also had lots of roms not known to his tools. Also as good as the smokemonster set is he is missing a lot of games in the Atari ST set (for example he has R-Type II but no R-Type I). I think this is because he is working from the TOSEC set that is also missing a lot, so i guess it's all still work in progress for his tools + MiSTer sets.

One thing i do really like is his layout and the fact the sets are nicely presented so you don't have to scroll through every single different language version of a game. For SNES/Genesis a lot of work went into those sets so they are very nicely organised.

MUTMAN likes this.
6. OP

### elvisOld school old fool

Joined:
Jun 27, 2001
Messages:
36,000
Location:
Brisbane
His tools also look for the pre-bundled arcade ROMs. So if you've got MAME ROMs, it won't find them, as it's looking for when you've run build_rom and created the MiSTer compatible file from your MAME set.

But that's cool. I'll try and write something in the middle that generates the ROMs from a MAME set. Would be best if it could look up the current list of arcade projects MiSTer supports and guess the MAME name equivalent, but that might be more work than I'm willing to put in.

7. ### MUTMANMember

Joined:
Jun 27, 2001
Messages:
6,021
Location:
4109
If you order the DE10nano from digikey it will arrive a week earlier and let you play around with some of the cores. depends on your needs for speeds i guess
edit - and can echo Elvis's thoughts on mister addons, seems to be well made. my RAM module tested at 167 mhz for 30 minutes (i stopped it at that time so i could play )

The new injecter script is really good, version 1.2 (?), and you can keep the ROMs in the folder and just grab the updated batch files
I guess it makes for a somewhat intense update routine.
I'll have to look at dropping the files in over the network. I'm assuming a need to ssh in ? and ??? and then good to go

8. OP

### elvisOld school old fool

Joined:
Jun 27, 2001
Messages:
36,000
Location:
Brisbane
Enable ssh through the scripts, and you get a root login with the default password of "1".

You can drop ssh keys on there too make it passwordless, and there's an old version of rsync on there which means rsync over ssh works (zlib doesn't, so don't use the -z flag).

Rsyncing lots and lots of data around is my whole career, so despite no NFS mount support, rsync over SSH made me happy.

MUTMAN likes this.
9. ### MUTMANMember

Joined:
Jun 27, 2001
Messages:
6,021
Location:
4109
Wanta write a quick and dirty guide for that ?
"Pretend" im a clueless windows jockey

Edit - not now that is. No real hurry cheers

greencamel65 and elvis like this.
10. OP

### elvisOld school old fool

Joined:
Jun 27, 2001
Messages:
36,000
Location:
Brisbane
Super dirty guide. Didn't check, didn't edit, tell me if something is broken.

First up, this is a standard "SSH with keys" guide that works on anything running Linux. Works as well on a RaspberryPi / RetroPie setup as well as MiSTer. If you want to git gud on Linux in general, read stuff I wrote here. If you don't care, follow this guide rote, but you should learn Linux because it's good for you (both learning, and Linux).

General concept is you are setting up a asymmetric key based authentication, consisting of a public key (that everyone can see, because it's public) and a private key (that only you can see, because it's private). You keep your private key safe, and put your public key on every Linux box you want to log in to without a password.

I'm not going to go into SSH agents and encrypting your private key. Consider that homework. BUT, if your private key is stolen, anyone can log on to any server that you've configured for key based authentication. So if you're not familiar with this stuff, don't go putting it on important or internet/cloud facing servers.

Enough security warnings, on with the guide. As requested, doing a Windows guide. Linux/Mac people, the ideas are the same, and there's a million guides you can google to use native tools.

https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

Putty will come as a full installer, puttygen is just a self contained executable.

* Open puttygen.exe

* Click Key -> Generate key pair. An SSH-2 RSA key is fine for our purposes here.

* A green bar will start to grow. Wiggle your mouse in the blank space below it. This generates entropy (randomness) which will seed the cryptography. You don't need to understand any of this for this guide, but it's fun, so Wikipedia it one day.

* A window appears with a bunch of stuff:

First up, the public key bit in the window is the bit we need to paste into our MiSTer. So leave this window open, and install Putty.

Fire up your MiSTer, plug in a network card, use the scripts to enable SSH and disable the firewall (I'm assuming this is on your home network, and not exposed directly to the Internet), and reboot it. Pressing the middle button should bring up a menu with your IP address handed out by DHCP (or check your DHCP logs).

Via Putty, log in as "root", verify the key fingerprint (just hit OK), use password "1". You'll get a Linux command shell with just a "#" prompt. Type in (and press enter after each commmand):

Code:
cd ~
mkdir .ssh
chmod 700 .ssh
cd .ssh
touch authorized_keys
chmod 600 authrized_keys
nano authorized_keys

What these commands will do is:
* cd ~ (change dir to your home directory, designated by the "~" shortcut)
* mkdir .ssh - make a directory called ".ssh" , the dot at the front is important
* chmod 700 .ssh - change the modifications of the .ssh directory to only be accessible by the owner, and nobody else
* cd .ssh - change into the .ssh directory
* touch authorized_keys - make a blank file called "authorized_keys" (US spelling), in which our PUBLIC key will live
* chmod 600 authorized_keys - change the modifications of the file so that it is only accessible by the owner (if you want to know why 700 above and 600 here, that's homework)
* nano authorized_keys - open the "nano" editor to edit the blank "authorized_keys" file

From here, copy all of the "Pubic key for pasting into OpenSSH authorized_keys file" stuff from your puttygen windows, and paste it into your Putty/nano window. It should paste in as one long line. Once done, press "Control+X" to exit. It'll ask if you want to save, press "Y" for yes. It'll ask what the filename should be. Just accept the default and hit return.

The MiSTer component is now done. Type "exit" to log out.

Now you want to export your private key. I say again, this is PRIVATE. Don't give this to anyone, don't lose it. Encrypt it if you like, however that means you need to use an agent to cache the password, or put in a password every time you use it. That's homework if you want to do so, however I'm assuming you'll use this key only for MiSTer, and nothing important, so I'm going with an unencrypted (and potentially unsafe) PRIVATE key.

In puttygen.exe Hit "Save private key". Save the resulting file out with a "ppk" extension. This is a Putty format private key. Quite a few Windows based programs will accept this, however some may need an OpenSSH format private key. So click "Conversions -> Export OpenSSH key". Save this file out (typically this file is named id_rsa without an extension, but call it whatever you want).

If you need the public key again at any time, you can hit the "Load" button, point it to your PRIVATE .ppk file, and it will extract the PUBLIC key for you to copy/paste again, as above.

From here, you can use your PRIVATE key in any SSH, SCP or SFTP compatible Windows software to log in to your MiSTer without a password. For example:

In Putty, go down Connection -> SSH -> Auth, and where it says "Private Key", browse to your .ppk file. Go back to your connection. Username "root", no password as you have the key. You can save this session with a name, and either log in via the command line using "putty @sessionname", or save it as default settings so putty will always have everything ready to go.

On login you'll go straight in, and see a note that you were authorised via the key.

Ditto for a drag-and-drop tool like WinSCP:

At the login window, put in the username "root", your MiSTer IP address (I have a full DNS set up, so my MiSTer gets a hostname called "mister", but you will likely need to put in an IP address here), and under "Advanced" point to your ppk key.

MobaXTerm is another hybrid console/GUI SSH and SFTP tool:
https://mobaxterm.mobatek.net/

Same thing again - start a new session, point to your private key (it'll take either ppk format or id_rsa format), and you can log in passwordless without problems.

cwrsync is yet another:
https://itefix.net/cwrsync

This is a command line only bundle of Cygwin (Windows/GNU toolkit) and rsync. Cygwin "mounts" virtual drives under /cygdrive/c for C:\, /cygdrive/d for D:\ , etc.

From the command line, you can treat cwrsync like native Linux rsync. A command like:

Code:
cwrsync -e "ssh -i /cygdrive/c/path/to/id_rsa" -avrhP /cygdrive/c/path/to/roms/Gameboy/ root@misterip:/media/fat/Gameboy/

Would sync everything in c:\path\to\roms\Gameboy into your MiSTer's Gameboy ROMs path. (Remembering that rsync, ssh and Linux are case sensitive).

Lots of options, lots of tools that can talk over SSH to Linux via a Windows GUI. Try them all out, see if your private key (either ppk or id_rsa format) works. Whatever you like best, report back here for others to try.

Good luck!

Last edited: Mar 17, 2019
MUTMAN likes this.
11. ### MUTMANMember

Joined:
Jun 27, 2001
Messages:
6,021
Location:
4109
hey thanks elvis
mammoth guide, i'll work my way through it (later) and report back.
again, many thanks

12. ### flainMember

Joined:
Oct 5, 2005
Messages:
2,268
Location:
Sydney
Elvis has posted some best practice ssh stuff, but don't feel too bad if you just skip the key generation stuff and just login with root / 1. Which is what i do, because after all my MiSTer is usually only powered on when i'm using it and inbound ssh connections only work if you're on my LAN

To find the IP address of MiSTer read it off the screen you have it plugged into (when network is up the IP is shown on the menu screen).

MUTMAN likes this.
13. ### MUTMANMember

Joined:
Jun 27, 2001
Messages:
6,021
Location:
4109
I'm familiar with putty/ssh, but I'm lazy on the security bit. I will pick up my game on this front, way too many rPi's and other little IOT devices on my network.
the rsync command line is where I'm going to struggle ... I'll have a crack and see how I go
Thanks

14. OP

### elvisOld school old fool

Joined:
Jun 27, 2001
Messages:
36,000
Location:
Brisbane
Keys are good security if you use them right, but more than that are convenient for things like passwordless access.

That in turn is great for scripted updates, quick syncing of files, etc.

pscp.exe and psftp.exe (both on the putty download site) can be used in simple batch files to copy stuff to your MiSTer quickly.

Last edited: Mar 18, 2019
flain and MUTMAN like this.
15. ### MUTMANMember

Joined:
Jun 27, 2001
Messages:
6,021
Location:
4109
MiSTer AddOns site is 50% off on the older v1 case
He is clearing stock to make way for the new v2 case (which looks mint)
but shipping is, err, rather expensive

anyway, just letting you know

edit - SmokeMonster is using this keyboard
Rii mini i8+ smart TV Keyboard with touchpad BACKLIT for PC android box
and it has volume control supported in the MiSTer core

16. ### MUTMANMember

Joined:
Jun 27, 2001
Messages:
6,021
Location:
4109
Well my eyes are bleeding. I've had a full afternoon of "MiSTering"
Did anyone else catch the SmokeMonster release for 1943 ? It looks really really good The core isn't released just yet, and smoke was dropping many many hints that some cool new features would be released soon ...
I did the full update and rebuild of my arcade cores using the MAG 0.24 injecter.
MAG looks to use 0.158 roms, but i have 0.139u1. So i used that anyway :<

I now have all injected .rbf's except -
1943 - rbf not released yet....
Eeekk! - I dont have this rom ..
crazy kong II set 1 - rom fail - cant build manually ??? bit lost, but will try a different ROM set
GnG US set - rom fail - built OK manually with the batch file
scramble - rom fail - built OK manually with the batch file
zigzag - rom fail- looks like i need the right rom for that one - "zigzagb" ??

so with the exception of those 6 above, everything tested so far (30%) is really very smooth.
One game I've gotten back into is Xevious. It has, in my hands, always been a difficult game to play.
On emulators its a hot mess of lag and audio sync issues.
On MiSTer, well its almost smoother than the old machines I remember .... incredible !!

anyway, for those that want to compare with the a.XXX.rom method, I've made a copy of the injected rbf's on a google drive

17. ### flainMember

Joined:
Oct 5, 2005
Messages:
2,268
Location:
Sydney
MUTMAN likes this.
18. OP

### elvisOld school old fool

Joined:
Jun 27, 2001
Messages:
36,000
Location:
Brisbane
Mucked around a bit with my setup these last few days, concentrating mostly on console hardware I'm more familiar with. Some random musings from my setup (MiSTer, 240p analogue out via YPbPr to a 30" all-analogue chassis TV, audio to an old 90s Marantz amp and 70s Marantz speakers):

* Atari 2600 doesn't work properly via analogue out, either 240p60 (NTSC) or 288p50 (PAL). The screen is off centre and "sprites" (the Atari didn't really have sprites, but you know what I mean) don't line up. Something weird going on that I'll have to test via HDMI out to see if it's the core in general, or something to do with the modes its generating. I'll test tomorrow via HDMI.

* Gameboy doesn't work at all over 240p analogue out. The dev said flat out he's not interested in that, as the original hardware mode of the Gameboy wasn't TV compatible. Even so, Gamegear stuff works fine via the Master System core by just adding blank lines above and below, so I kind of wish they'd do the same with Gameboy. Playing GB on a Gamecube via the Gameboy Player and Gameboy Interface software to a CRT is superb. I'll switch my setup around tomorrow and try both HDMI and VGA (either direct, or through a HDMI to VGA converter box I have) to see how that goes.

* The Megadrive/Genesis audio filters are pretty damned good. The "Model 1" filter sounds VERY similar to my real model 1, including the cutoff that makes it sound a little muddy. The "minimal" filter sounds similar to what I've heard people doing with the Crystal Clear Audio Mod and Mega Amp, and with a good audio system sounds far better than a model 1 Megadrive to me. Totall unflitered has high ranges that are too loud, but I think that would go well if you had an equaliser in the middle you could fiddle with to your taste.

* The Master System core has an option to change the sprites-per-line limit from the default (16 I think) to 128. That makes it "inaccurate" compared to real hardware, but removes sprite flicker in most games. I've turned this on, and it's brought a whole new lease on life for some of my favourite 8 bit titles. I hear the PC Engine core has the same option (I've not tried it), but apparently it's too difficult for the NES core.

* The SNES audio is spot on. I spent quite some time listening to a handful of games I'm *very* familiar with, and they sounded excellent to me. SNES audio always loses out with emulation (even Nintendo's own SNES mini), so I was very happy to hear it at this level of quality that's not a real SNES.

* SNES 1-chip models are sought after for their picture quality, whereas the 2-chip models tend to be a bit muddier. For games like Star Fox / Starwing that use a lot of dithering, I actually subjectively prefer the 2-chip look. However, the MiSTer is sharp as can be of course, so you get that 1-chip razor sharp image. Best of all, there's no audio interference on a white screen like a lot of SNES models have (some even with good cables, as it occurs in the unit itself).

* Commodore 64, Master System, Genesis/Megadrive cores of course all have no "jailbars" or banding, which is stunning to see. I don't have any RGB amp/bypass going on my Sega consoles, but the native RGB out of my Megadrive model 1 and modded RGB (with simple resistor/capacitor coupling inline) out of my SMS2 don't look anywhere as good as the MiSTer.

* Looks like folks are starting to contribute CIFS/SMB mount scripts, so I'm not going to bother with automount, NFS and other stuff. That'll do nicely for me.

MUTMAN likes this.
19. OP

### elvisOld school old fool

Joined:
Jun 27, 2001
Messages:
36,000
Location:
Brisbane
I did a little more reading - the Gameboy Color extensions to the core only came to life recently. Looks like there was a big release in December 2018, and a few more across Feb/March 2019. It seems a lot of GBC stuff is still quite broken (I was testing a few GB games tonight on both a VGA CRT and via HDMI to a 1080p LCD screen on the GBC core, and things are a bit broken). Shantae in particular (my favourite GBC game of all time) doesn't even boot on the latest public release. Link's Awakening DX (GBC re-release) works fine.

First gen Gameboy seems to work better than GBC, although the dev says there's a lot of stuff to fix still.

MUTMAN likes this.
20. OP

### elvisOld school old fool

Joined:
Jun 27, 2001
Messages:
36,000
Location:
Brisbane
A tweet from Smokemonster clears up some confusion on how vsync and framebuffering currently work.

All references to settings are from MiSTer.ini, which should live in /media/fat on your MiSTer install (you can ssh in to your MiSTer, change these, and type "reboot" to reboot and apply):
https://github.com/MiSTer-devel/Main_MiSTer/blob/master/MiSTer.ini

misteraddons.com has a guide on some of the settings you can configure if you're using analogue out via the IO board (scroll down to "Analogue Video Settings for IO Board"):

Worth noting that a lot of old consoles didn't use video-standard scan rates, and had weird refresh rates like 59.91Hz (Megadrive/Genesis), 60.08Hz (SNES), etc. Old analogue CRTs didn't care, and would happily sync to these. We talk a lot about all of this in the Retro Display FAQ, and the challenges these present on modern TVs that expect perfect 50.00Hz/60.00Hz modes.

In this post I'll mention "analogue out", which is either VGA, RGB/SCART or YPbPr ("component") out of the DE15 "VGA" connector on the IO board you have to purchase separately. (The system does colour conversion internally, and the IO board offers sync-on-green for component and RGBS via a hardware switch, so all video mode calculations are the same regardless of colour space or signal encoding).

When I talk about HDMI, I'm talking about the native HDMI out of the DE10-Nano board itself.

Analogue out:

If you choose the 240p mode via analogue out (this is an approximation, and is not exactly 240p for all cores), most of the cores (not Gameboy - see above, but anything that originally connected to a TV back in the day) will send the real video modes to your screen. No scalers will be used, and you'll get the exact same, zero-display-lag picture of the original console.

If you choose a "scandoubled" 480p mode via analogue out, and leave the scaler in your core set to "internal", it simply doubles the scanrate of the old console. This is great for analogue TVs, PVMs/BVMs or PC VGA/SVGA CRTs that can take a 31KHz (640x480@60Hz) or higher signal. You'll get a perfect 2x scaling with real scanlines (you'll see each line doubled), zero display lag and zero screen tearing.

You can send higher resolutions as well as a scaled (not scandoubled) mode through VGA-out by setting the "vga_scaler=1" option. All of those will act the same as the HDMI stuff below. I personally think doing so is pointless - stick with 240p or 480p-scandoubled if you're using analogue out, unless you have no choice and have some weird 720p screen that can only take a VGA or component input (in which case, I'd go hunting for a better screen).

HDMI (digital) out:

All other modes via HDMI go through a scaler (including 480p over HDMI). From here, things get tricky. You'll generally end up with two crappy options:

1) A picture that has no vsync, and screen tearing as a result

2) A picture that has vsync but adds a frame or two of lag for buffering.

Smokemonster details the options here:

Three options for "vsync_adjust" when you choose a HDMI out video mode.

2 attempts to just scale the image and use the native refresh rate of the console. Your HDMI screen (TV, monitor, whatever) may or may not like this. Some won't sync, and you'll get a black screen. Some will sync and show a picture, but you'll get tearing due to vsync mismatch.

1 attempts to use the native refresh of the console, but triple-buffers it. So it should knock a bit of the tearing out for most displays, although you'll get 1-2 frames display lag.

And finally attempts to 0 forces the HDMI out to 60.00Hz (note: the core doesn't run at this rate), and uses triple buffering. It's by far the "worst" for display lag, however guarantees compatibility with even the pickiest of screens. (The "display lag" here is still less than what you'd get playing on any emulator).

So if you care about reducing display lag via HDMI output, choose "vsync_adjust=2". You'll get tearing, but lag will be minimal. If that bothers you, try 1, and finally 0 as your very last resort.

As of yet there are no cores that support adjusting the clock to a perfect 60.00Hz like the Analogue Super Nt and Mega Sg can. That would change the speed of games ever so slightly (a few seconds difference over hours of play, so not noticeable), but would allow dispay-lag-free, tear-free gameplay. Reading chatter on the atari-forums, it sounds like this isn't a straight-forward thing to achieve, and can break many cores. That's not to say it'll never happen, but right now MiSTer video output via HDMI has one less option than Analogue's offerings do.

Last edited: Mar 31, 2019
MUTMAN likes this.