ben Posted April 14, 2012 Report Share Posted April 14, 2012 I finally got my Sega Master System working on the Papilio Plus !To get the attached bit file running, you'll need :- a joystick wing on AL, with a two-button joystick (I bought a vintage SMS joypad, but a Megadrive one should be ok)- a VGA wing on AH (that outputs only 8 colors... graphics look crappy)- a SD wing on BL, and a fat16 formatted SD with a few roms- an audio wing on BH- for a future version : a led/switch wing for the pause and reset buttons (not implemented yet)[Hopefully, the new Arcade Megawing will have all this included with nicer VGA output, so you'll just need a joystick wing to play seriously.]Load the bit file : the bootloader shows the content of your SD card. Pick a rom and it gets loaded into the SRAM, and the system boots it : you're ready to go !Most of the SMS hardware is implemented, though with a few bugs here and there. The only major one I found is the HBL irq, which is totally off. Apart from the few games that use this one, all roms I tried seem playable (although pause is sorely missing).All source is on GitHub, at https://github.com/b...o-Master-SystemBenfinal.zip Link to comment Share on other sites More sharing options...
Jack Gassett Posted April 14, 2012 Report Share Posted April 14, 2012 Woaaaahhh! Sweet, I'm going to finish up what I was doing and then hopefully check this out! Jack. Link to comment Share on other sites More sharing options...
ben Posted April 15, 2012 Author Report Share Posted April 15, 2012 Just for fun : I was checking the pinouts for the LightPhaser gun (http://en.wikipedia.org/wiki/File:SMS-Light-Phaser.jpg), it uses pin #7 of the db 9 connector... the one that is not connected on the Joystick wing. It only worked with cathodic displays, anyway. So, forget about playing those shoot them all games. The good thing is, I'll be focusing on solving the serious issues rather than trying to get exotic hardware to work ;-) Unless I do something about those 3d glasses (http://en.wikipedia.org/wiki/File:Sega-Masters-Sys-3D-Glasses.jpg), of course... Link to comment Share on other sites More sharing options...
Jack Gassett Posted April 16, 2012 Report Share Posted April 16, 2012 Hey Ben, I'm looking at the notes for the Wing design and it looks like pin 7 is connected to 5V to power things like repeating fire etc. We can probably do away with that and connect GPIO instead with the next revision of the joystick. I think it is better to replace the series limiting resistors, which are there only in case 5V is drawn and sent back out, with pull up resistors. I also envision joystick Wings for other styles like the NES joysticks. So I just gave the bit file a spin and I'm excited to see video output, but it looks like it does not like my sd card. I'm getting an error message: "SMS bootloader v0.92. Could not initialize sd card" I have uSD wing on BL and it has fat16 with a rom file in the root (both sms and smd extensions). I'm wondering if maybe the sd card itself is a problem? It is a pqi 2GB sd card, maybe I should get the same one you have? Any ideas? This is way to cool! Jack. Link to comment Share on other sites More sharing options...
ben Posted April 16, 2012 Author Report Share Posted April 16, 2012 I'm not that sursprised. My SD protocol implementation is quite crude.Try the attached bit file, it has debugging enabled: connect a terminal (9600 8n1) to see the log.and, just in case : what I call bl is on the side of the usb connector (so the sd wing should be next to the vga wing)i'll put up with something to load a rom into the sram file through uart, and a version of the bootloader that allows to boot directly the sram. it's not as cool, but definitely more reliable.final.zip Link to comment Share on other sites More sharing options...
Jack Gassett Posted April 16, 2012 Report Share Posted April 16, 2012 Ok, I loaded the debug bit file and captured the serial output which is: cmd0:01 cmd8:7f And I think we are talking about the same wingslot, next to VGA Wing. Jack. Link to comment Share on other sites More sharing options...
ben Posted April 16, 2012 Author Report Share Posted April 16, 2012 Ok, your SD card is alive. As far as I can remember, cmd8 is used to test for sdhc (4gb and more): it took me quite a while to figure this bit out, and I might have made a quick fix that made these cards work but broke the other ones... (not sure, that was months ago) I'll look into it, so the bootloader accepts standard SD cards, but this might take a while... In other words, you might want to try with a bigger card in the meantime. Link to comment Share on other sites More sharing options...
Jack Gassett Posted April 16, 2012 Report Share Posted April 16, 2012 Well, I need a bigger card anyway, I'll see if I can pick one up tomorrow. Jack. Link to comment Share on other sites More sharing options...
ben Posted April 16, 2012 Author Report Share Posted April 16, 2012 As far as I can remember, cmd8 is used to test for sdhc (4gb and more): it took me quite a while to figure this bit out, and I might have made a quick fix that made these cards work but broke the other ones... (not sure, that was months ago) Just checked my code: it indeed requires that the card accepts cmd8, whereas it is mandatory only for SD v2 and sdhc... The good news is, the fix is easy (ignore the error and do not check for high capacity) : i'll post it tonight. Link to comment Share on other sites More sharing options...
ben Posted April 16, 2012 Author Report Share Posted April 16, 2012 The good news is, the fix is easy (ignore the error and do not check for high capacity) : i'll post it tonight.here it is, but i could not check it works (all my micro SDs are V2).still in "debug" mode, which makes it *way* slower.final.zip Link to comment Share on other sites More sharing options...
Jack Gassett Posted April 16, 2012 Report Share Posted April 16, 2012 Well, its still failing, here is the new error codes: cmd0:00 cmd0:7f cmd0:01 cmd8:7f cmd41:3f MMC Link to comment Share on other sites More sharing options...
Jack Gassett Posted April 16, 2012 Report Share Posted April 16, 2012 I found a 4GB card and get the following message: cmd0:01 cmd8:7f cmd41:3f MMC Link to comment Share on other sites More sharing options...
ben Posted April 17, 2012 Author Report Share Posted April 17, 2012 I found a 4GB card and get the following message: cmd0:01 cmd8:7f cmd41:3f MMC That's weird. Both your multi-gigabyte cards would be multimedia cards ? Can you give me the references ? I have to admit I was too lazy to check the spec for supposedly outdated cards, I put a no-go on mmc in my code. I'll do something about it. Link to comment Share on other sites More sharing options...
Jack Gassett Posted April 17, 2012 Report Share Posted April 17, 2012 They must both be really cheap cards. The 4GB card says it is MicroSD HC it must not be the same as V2 HS card though. At this point in development I think instead of spending a bunch of time supporting these old cards I should just go buy a new, non MMC card. Will try to do so today. Jack. Link to comment Share on other sites More sharing options...
Jack Gassett Posted April 17, 2012 Report Share Posted April 17, 2012 I just tried an 8GB Sandisk card which is also marked as HC and it is not working either. Shows up as MMC in the serial output. I guess I better try and get the same brand card you have. I'm also wondering if this method of bootstrapping resources into SRAM could be used? This would allow people with the first version of the Arcade MegaWing to play Sega Master System games when the Papilio Plus is available. Jack. Link to comment Share on other sites More sharing options...
ben Posted April 18, 2012 Author Report Share Posted April 18, 2012 I just tried an 8GB Sandisk card which is also marked as HC and it is not working either. Shows up as MMC in the serial output. I guess I better try and get the same brand card you have. How frustrating. I'll have to get my hands back on the doc about SD specs that I used to code the boolader, to see what is going on (it might just be a matter of trying again the right command a few times...) For the record, I use Kingston cards, one branded as "2 Gb Micro SD" and the ohter one "4Gb MicroSDHC" (which works fine but is formatted as fat32) I'm also wondering if this method of bootstrapping resources into SRAM could be used? This would allow people with the first version of the Arcade MegaWing to play Sega Master System games when the Papilio Plus is available. Yes, that's my plan. I even included a "boot from SRAM" option in the latest firmware, so you can skip the whole SD thing. All I need now is a small sketch to get UART data in the SRAM. I intended to write a quick and dirty script, but then you would be stuck with a problem of getting it to work on other people's machines (especially since I use Linux, unlike most users around here) Do you think there's any chance of using papilio-loader for that ? (like we use it to program the rom) That would be pretty standard: at this point, I use the low bytes of the SRAM, with no fuss in the addressing. I could change it a bit to match a more standard map (use 0L, 0H, 1L, 1H etc rather than 0L, 1L etc.) Link to comment Share on other sites More sharing options...
ben Posted April 18, 2012 Author Report Share Posted April 18, 2012 I just tried an 8GB Sandisk card which is also marked as HC and it is not working either. Shows up as MMC in the serial output. I guess I better try and get the same brand card you have.Reading some other SD code on the internet, I added a few "wait" cycles here and there. It might help... Note: I also attach the _bd.bmm file, so I can just upload the mem file next time.I'll leave this for now, and concentrate on uploading a file over UART. I'll try with papilio-prog, and revert to an AVR8 sketch+custom client if I can't get it to work.vga.zip Link to comment Share on other sites More sharing options...
Jack Gassett Posted April 19, 2012 Report Share Posted April 19, 2012 Ahhhh! It's so close now! It got past sd card initialized but now it says: error while loading mbr could not initialize fat system Any ideas? It seems like the delays you added made a difference. Jack. Link to comment Share on other sites More sharing options...
ben Posted April 20, 2012 Author Report Share Posted April 20, 2012 it seems that the sd initialization is ok, but that it cannot load data. The good thing is: the delays were the problem. The bad thing is: I put them everywhere, except on CMD17 ("load sector")...how about this one ?I'm working on a script to load mem files into the SRAM but I have trouble with the UART on the AVR8... output is scrambled. Seems the timing is off. Any ideas ? I might rewrite the whole thing in VHDL eventually (to speed it up)vga.zip Link to comment Share on other sites More sharing options...
Jack Gassett Posted April 23, 2012 Report Share Posted April 23, 2012 OK! We are getting super close now! The SD card is initialized and I can browse the ROMs and select one. It goes through and loads the game, counting up to 8000. Then it says something like, "Booting ROM" and it just hangs there indefinitely. Any ideas? It seems so close now that I can taste it. Jack Link to comment Share on other sites More sharing options...
ben Posted April 24, 2012 Author Report Share Posted April 24, 2012 OK! We are getting super close now! The SD card is initialized and I can browse the ROMs and select one. It goes through and loads the game, counting up to 8000. Then it says something like, "Booting ROM" and it just hangs there indefinitely. Any ideas? It seems so close now that I can taste it. You're not close, you're there ! There are still some bugs... some games work fine, some have glitches, and some won't even boot. Seems you found one of them. Which rom is it ? Known to work: psycho fox, Alex kidd in miracle world, Alex kidd in shinobi world, shinobi, ghost house, mickey mouse castle of illusion. Link to comment Share on other sites More sharing options...
Jack Gassett Posted April 25, 2012 Report Share Posted April 25, 2012 Yes! It's working now! Great work, now we just need to get better graphics with the new Arcade MegaWing. I just got a delivery notice from the Post Office and I think it is the new Arcade MegaWing. So I might be able to get one shipped out to you pretty quickly. Jack. Link to comment Share on other sites More sharing options...
ben Posted April 28, 2012 Author Report Share Posted April 28, 2012 Yes! It's working now! Great work, now we just need to get better graphics with the new Arcade MegaWing. Great ! What game did you try it with ? The graphics are indeed crappy (I recently added the "dither through flicker" thing to render the intermediate colors, but this is really a pain to look at for more than a minute) I'm working on getting the TV version to work again (right now, the games won't boot -- there must be a oscure issue with line counting or vbl irq trigger) I'm planning to release several versions: - a regular Arcade Megawing version, that has to be hooked to a PC to load the roms (see below) - a new Arcade Megawing+Joystick wing version - a "wings-only" version for TV (optional SD+TV+joystick) I just got a delivery notice from the Post Office and I think it is the new Arcade MegaWing. So I might be able to get one shipped out to you pretty quickly. I'd be glad to try it out. In the meantime, I just finished a first working version of papilio-prog that allows to program the SRAM through JTAG. See http://www.gadgetfactory.net/gadgetforum/index.php?topic=454.0 That means we can use the regular Arcade MegaWing: I'll post the corresponding bit file shortly. Ben Link to comment Share on other sites More sharing options...
Jack Gassett Posted April 30, 2012 Report Share Posted April 30, 2012 Excellent, I loaded up Shinobi which was a game that I spent countless hours, and quarters, playing at a local gas station when I was a kid. Was just like I remembered! I will try out the new papilio-programmer version, the solution should be useful for a lot of different things so I'm happy to see you put that together. The package that arrived was indeed the new Arcade MegaWing, but I have not been able to put any together yet. I'll post a followup once I do. Jack. Link to comment Share on other sites More sharing options...
Jack Gassett Posted May 3, 2012 Report Share Posted May 3, 2012 I just realized last night that with the changes you made to papilio-prog it should be possible to support the Arcade MegaWing on the Papilio Plus now? Do you have an Arcade MegaWing? Here is a ucf that should work: # UCF file for the Papilio LX board # Generated by pin_converter, written by Kevin Lindsey # https://github.com/thelonious/papilio_pins/tree/development/pin_converter # Main board wing pin [] to FPGA pin Pxx map # -------C------- -------B------- -------A------- # [GND] [C00] P114 [GND] [B00] P99 P100 [A15] # [2V5] [C01] P115 [2V5] [B01] P97 P98 [A14] # [3V3] [C02] P116 [3V3] [B02] P92 P93 [A13] # [5V0] [C03] P117 [5V0] [B03] P87 P88 [A12] # [C04] P118 [B04] P84 P85 [A11] [5V0] # [C05] P119 [B05] P82 P83 [A10] [3V3] # [C06] P120 [B06] P80 P81 [A09] [2V5] # [C07] P121 [B07] P78 P79 [A08] [GND] # [GND] [C08] P123 [GND] [B08] P74 P75 [A07] # [2V5] [C09] P124 [2V5] [B09] P95 P67 [A06] # [3V3] [C10] P126 [3V3] [B10] P62 P66 [A05] # [5V0] [C11] P127 [5V0] [B11] P59 P61 [A04] # [C12] P131 [B12] P57 P58 [A03] [5V0] # [C13] P132 [B13] P55 P56 [A02] [3V3] # [C14] P133 [B14] P50 P51 [A01] [2V5] # [C15] P134 [B15] P47 P48 [A00] [GND] ## Prohibit the automatic placement of pins that are connected to VCC or GND for configuration. CONFIG PROHIBIT=P144; CONFIG PROHIBIT=P69; CONFIG PROHIBIT=P60; CONFIG PART=XC6SLX9-TQG144-2; NET CLK LOC="P94" | IOSTANDARD=LVTTL | PERIOD=31.25ns; # CLK NET RX LOC="P101" | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST; # RX NET TX LOC="P105" | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST | PULLUP; # TX #NET A0 LOC="P48" | IOSTANDARD=LVTTL; # A0 #NET A1 LOC="P51" | IOSTANDARD=LVTTL; # A1 #NET A2 LOC="P56" | IOSTANDARD=LVTTL; # A2 #NET A3 LOC="P58" | IOSTANDARD=LVTTL; # A3 #NET A4 LOC="P61" | IOSTANDARD=LVTTL; # A4 #NET A5 LOC="P66" | IOSTANDARD=LVTTL; # A5 #NET A6 LOC="P67" | IOSTANDARD=LVTTL; # A6 #NET A7 LOC="P75" | IOSTANDARD=LVTTL; # A7 #NET A8 LOC="P79" | IOSTANDARD=LVTTL; # A8 #NET A9 LOC="P81" | IOSTANDARD=LVTTL; # A9 #NET A10 LOC="P83" | IOSTANDARD=LVTTL; # A10 NET I_RESET LOC="P85" | IOSTANDARD=LVTTL; # A11 #NET A12 LOC="P88" | IOSTANDARD=LVTTL; # A12 #NET A13 LOC="P93" | IOSTANDARD=LVTTL; # A13 NET O_AUDIO_L LOC="P98" | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST; # A14 NET O_AUDIO_R LOC="P100" | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST; # A15 NET O_VIDEO_B(0) LOC="P99" | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST; # B0 NET O_VIDEO_B(1) LOC="P97" | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST; # B1 NET O_VIDEO_B(2) LOC="P92" | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST; # B2 NET O_VIDEO_B(3) LOC="P87" | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST; # B3 NET O_VIDEO_G(0) LOC="P84" | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST; # B4 NET O_VIDEO_G(1) LOC="P82" | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST; # B5 NET O_VIDEO_G(2) LOC="P80" | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST; # B6 NET O_VIDEO_G(3) LOC="P78" | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST; # B7 NET I_SW(0) LOC="P74" | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST; # B8 NET I_SW(1) LOC="P95" | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST; # B9 NET I_SW(2) LOC="P62" | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST; # B10 NET I_SW(3) LOC="P59" | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST; # B11 NET B(12) LOC="P57" | IOSTANDARD=LVCMOS33; # B12 NET B(13) LOC="P55" | IOSTANDARD=LVCMOS33; # B13 NET B(14) LOC="P50" | IOSTANDARD=LVCMOS33; # B14 NET B(15) LOC="P47" | IOSTANDARD=LVCMOS33; # B15 #NET C0 LOC="P114" | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST; # C0 #NET C1 LOC="P115" | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST; # C1 NET O_VSYNC LOC="P116" | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST; # C2 NET O_HSYNC LOC="P117" | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST; # C3 NET O_VIDEO_R(0) LOC="P118" | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST; # C4 NET O_VIDEO_R(1) LOC="P119" | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST; # C5 NET O_VIDEO_R(2) LOC="P120" | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST; # C6 NET O_VIDEO_R(3) LOC="P121" | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST; # C7 NET I_JOYSTICK(0) LOC="P123" | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST | PULLUP; # C8 #NET C9 LOC="P124" | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST; # C9 NET I_JOYSTICK(1) LOC="P126" | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST | PULLUP; # C10 NET I_JOYSTICK(2) LOC="P127" | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST | PULLUP; # C11 NET JOYSTICK_GND LOC="P131" | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST; # C12 NET I_JOYSTICK(3) LOC="P132" | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST | PULLUP; # C13 NET C(14) LOC="P133" | IOSTANDARD=LVCMOS33; # C14 NET C(15) LOC="P134" | IOSTANDARD=LVCMOS33; # C15 NET JTAG_TMS LOC="P107" | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST; # JTAG_TMS NET JTAG_TCK LOC="P109" | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST; # JTAG_TCK NET JTAG_TDI LOC="P110" | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST; # JTAG_TDI NET JTAG_TDO LOC="P106" | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST; # JTAG_TDO NET FLASH_CS LOC="P38" | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST; # FLASH_CS NET FLASH_CK LOC="P70" | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST; # FLASH_CK NET FLASH_SI LOC="P64" | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST; # FLASH_SI NET FLASH_SO LOC="P65" | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST | PULLUP; # FLASH_SO Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.