Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - FRS' SMS page WIP

Reply to topic
Author Message
  • Joined: 04 Oct 2015
  • Posts: 17
Reply with quote
FRS' SMS page WIP
Post Posted: Sun May 05, 2019 7:44 pm
Hello! I'm FRS from the MSX community. I'm not sure if you remember me, but I released a port of Gunstar Heroes to the SMS some time ago.

I've opened this thread to announce my releases from time to time, similar to the thread I have there on MSX.org.

The first announcement is an enhancement patch for the game Lion King:


  • The soundtrack is now played at the correct tempo in NTSC mode (60Hz)
  • Fixed a bug that caused the curb to stop rotating on acrobatics
  • The VRAM writing routines were optimized, making the game run smoother.
  • Mega drive controller support

    • START = pause
    • Button-A = slash (adult only)
    • Button-B = jump
    • Button-C = roar

  • You can now press a button to skip the "Lion King over the sun" title screen
  • Turbofixed the stampede stage


You can download the patch at this page.

  View user's profile Send private message Visit poster's website
  • Joined: 09 Dec 2013
  • Posts: 228
  • Location: detroit
Reply with quote
Post Posted: Mon May 06, 2019 11:30 am
Hi FRS,
Welcome, and thankyou for the excellent patches, with Gradius 2+smooth scrolling is quite legendary on MSX :)
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14689
  • Location: London
Reply with quote
Post Posted: Mon May 06, 2019 4:44 pm
As with the previous patch, I'm very interested in the technical details. How did you speed up the VRAM writes? What's the turbo fix in the SMS context?
  View user's profile Send private message Visit poster's website
  • Joined: 04 Oct 2015
  • Posts: 17
Reply with quote
Post Posted: Tue May 07, 2019 9:56 pm
Maxim wrote
As with the previous patch, I'm very interested in the technical details. How did you speed up the VRAM writes?


I made this patch more than 2 years ago and only now I could find time to release it, so I don't remember all the details, sorry...

What I remember is that the routines that updated the name table when scrolling were not very efficient and could be optimised.


Quote
What's the turbo fix in the SMS context?


Wait for some news that I'll release soon. ;)
  View user's profile Send private message Visit poster's website
  • Joined: 04 Oct 2015
  • Posts: 17
Reply with quote
Three more patches
Post Posted: Wed May 08, 2019 11:19 pm
Last edited by sdsnatcher on Fri May 10, 2019 8:48 pm; edited 2 times in total
Here are three more patches for you. I hope you like them. :)


1) Montezuma's Revenge joyfix patch

This patch fix the game to support Mega drive joypads. The START button can also be used to pause the game.


2) Penguin Land joyfix patch

This patch fix the game to support Mega drive joypads. The START button can also be used to pause the game.

It also enhances the pause routine. Once paused, it's now possible to scroll the stage up and down to analyse it.

3) Wonder Boy III fix patch

This patch does many enhancements to the game Wonder Boy 3:
  • Fix the FM detection to work on western consoles
  • The WB-III English logo is always shown
  • Added mega drive joypad support (START = pause)
  • Set border color to 0 (the game didn't initialize the border). This fixed the incorrect border color when started on flash carts


EDIT: Somehow the "Added mega drive joypad support" got replaced by "VRAM access optimisation" in the WB3 list. I fixed it now.
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 08 Jul 2001
  • Posts: 8644
  • Location: Paris, France
Reply with quote
Post Posted: Thu May 09, 2019 9:30 am
sdsnatcher wrote
This patch does many enhancements to the game Wonder Boy 3:
[*]The VRAM writing routines were optimized, making the game run smoother.


Interesting. Could you clarify what are the noticeable effect of your changes?
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 3763
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Thu May 09, 2019 10:26 am
I'm also interested in that specific optimization, can you elaborate on that? does your updated code still complies with VRAM timings (if applicable)?
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 08 Jul 2001
  • Posts: 8644
  • Location: Paris, France
Reply with quote
Post Posted: Thu May 09, 2019 12:56 pm
Wonder Boy III runs at 30 FPS, refreshing visual every two vsyncs and afaik doesn't miss more frames than that, so I am curious as to which change would make it run "smoother", other than a full blown 30>60 Hz hack (the sort I did with the remake).
  View user's profile Send private message Visit poster's website
  • Joined: 28 Feb 2016
  • Posts: 502
  • Location: Barcelona
Reply with quote
Post Posted: Thu May 09, 2019 8:38 pm
Hello FRS, thankyou for those hacks.

We are awatting about more technical info, thankyou again.
  View user's profile Send private message
  • Joined: 04 Oct 2015
  • Posts: 17
Reply with quote
Post Posted: Fri May 10, 2019 8:48 pm
sverx wrote
I'm also interested in that specific optimization, can you elaborate on that? does your updated code still complies with VRAM timings (if applicable)?


I have no idea how the "Added mega drive joypad support" got replaced by "VRAM access optimisation" in the WB3 list in the original announcement, but I fixed it now, sorry.


The VRAM access timings were optimised only on Lion King. Yes, they respect the real hardware timings and work fine on my real NTSC SMS.

I would like to have time to explain everything in detail, but, sorry, all my projects were concluded more than 2 years ago. RealLife (TM) got very complicated since then, and I have been waiting for when I would have time to make nice announcements for them.

But instead, things got even more complicated this year. I then had to decide to just flush out all the releases as fast as I could, even if it would look a bit clumsy, or just forget about releasing them. I'm sacrificing some precious bed time for that, but I hope it's worth it.
  View user's profile Send private message Visit poster's website
  • Joined: 04 Oct 2015
  • Posts: 17
Reply with quote
How to install a real turbo on your SMS
Post Posted: Sat May 11, 2019 12:17 am
The last news is hardware related.

But first, some context is necessary:

As you all know, the SMS and the MSX are *very* close siblings. It was even a pleasure to code the patches I released here, because of how similar the two architectures are.

On the software side, the main difference I would mention is that on the MSX it's highly recommended to program using the BIOS as it acts as an abstraction layer and this also saves you quite some time and (game) ROM space since so many routines are already present. On the SMS, OTOH, everything has to be coded from scratch.


On the hardware side, things are also very similar. A lot of hardware projects from the MSX seem to be very easy to adapt for the SMS. I don't know if you're aware, but even the original MSX1 BIOS+BASIC ROM boots on the SMS without any modification. Some video glitches might show up, and it obviously can't do anything because there's no keyboard, and there's no sound too, but it's pure nerd fun to see it booting. ;)

So I decided to try to install a turbo kit from the MSX on the SMS. And guess what? It works like a charm!

The SMS is very well designed and can go all the way up to 10.74MHz (3x), and all original cartridges seem to support this just fine. But, curiously, the only cartridge that can't run at that speed is the one designed in the 21st century: the Master Everdrive!

So I lowered the speed down to 7.14MHz. This is exactly twice the original SMS speed, and the Master Everdrive doesn't complain. But then it loads games *way* quicker, and folder browsing is much better too.

Needless to say, CPU intensive games run like a dream, without slowdowns: R-Type, Aleste, Lion King, Robocop vs Terminator, Earth Worm Jim etc etc etc

The FM sound also works just fine.

Some very few games have one or another oddities:
- Some few games misdetect NTSC as PAL. You just have to enable the turbo after the game has booted to avoid this
- Some very few games have split screen/raster effect issues. Lion King was one of them, but it's now fixed by my patch.

Such games seem to be very easy to receive turbofix patches in order to not need workarounds anymore.

Please note that this is a real turbo upgrade for the SMS, and not just some lazy/hasty overclock. This is why it works stable as a rock and allows much higher CPU frequencies.

The recipe to install a turbo on your SMS is described below. It's very clean and straightforward:

1) Parts needed:

1a) Get yourself an MSX SuperTurbo 3.0 kit
1b) A Z84C010PEG or Z84C010PEC CPU. But be very careful where you buy it, since there are *a lot* of counterfeits out there. They'll only will cause you headaches. I also do not recommend the Z84C020 since those have some very strict PCB design requirements that the SMS doesn't conform.
1c) A good quality 40-pin turned-pin socket (those with round holes)
1d) Two 5-pin SIP 4K7 resistor-networks
1e) A 7.15909MHz crystal for the turbo if you want to use the Master Everdrive, or a 10.738635 MHz crystal if you only want to use original cartridges
1f) A two-position switch to enable/disable the turbo

2) Solder the turbo crystal to the MSX SuperTurbo 3.0 PCB. Remember that it must be 7.14MHz if you want to use the Master Everdrive.

3) Remove the old Z80 4MHz NMOS from your SMS. Unless you're *very* experienced with desoldering, don't even think to try to salvage the old CPU: just cut its pins with a sharp cutting plier (specific for electronic work) and then remove the pins one by one with a soldering iron and some tweezers.

4) Clean the surface of all PCB holes of where the Z80 was with isopropyl alcohol and a cotton swab to remove all the varnish residue from the metal. Be careful not to spill the isopropyl to the rest of the PCB.

6) Solder the turned-pin socket were the Z80 once was, but leave the pins 7 to 15 unsoldered for now. Be very sure that the socket is very well sit on the PCB, without any slack, before soldering its pins. For that, solder only the pins 1, 20, 21 and 40 beforehand. Then press firmly the socket against the pcb and reheat each one those pins again until the solder melts and you hear a "click" of the socket sitting on that place. Without this procedure, the PCB tracks of the underside might get broken when you insert the CPU afterwards. After you have confirmed that the socket is well sit on its place, proceed to solder the rest of the pins (remember: leave the pins 7 to 15 unsoldered for now! Better mark them on the PCB with some paper tape beforehand so you don't forget)

7) On the underside of the PCB, solder the two resistor-networks as described below. Pay attention because the pin-1 is marked on the resistor-network and has a specific function. If you solder this pin-1 incorrectly the CPU will behave erratically.

7a) The pin-1 of the 1st resistor-network must be carefully connected to the pin-11 of the Z80 socket, and the pins-2 to 5 must be connected to the pins 12 to 15 of the Z80 socket respectively. But don't solder its pin-1 just it yet. Solder only the pins 2 to 5 of this resistor network for now. Make sure that the respective Z80 socket pins also get properly soldered to the PCB now, of course.

7b) Now, carefully put the 2nd resistor-network in its place. Its pin-1 also must be connected to the pin-11 of the Z80 socket, and the pins-2 to 5 must be connected to the pins 10 to 7 respectively. Now you can solder all the pins of this resistor-network, and the pin-1 of the 1st resistor network too, since both pins-1 must be interconnected to the Z80 socket pin-11. Again, make sure that the respective Z80 socket pins are also properly soldered to the PCB.

8) Now place the Z80C0010 CPU in its socket, but gently lift up the pin-6 (CLK) just enough so it doesn't go into the respective socket hole.

9) Solder a wire to connect the lifted pin-6 of the Z80C0010 CPU to the MSX SuperTurbo 3.0 clock output pin.

10) On the underside, solder a wire to connect the pin-6 of the Z80 socket to the non-turbo clock input of the MSX SuperTurbo 3.0. Instead of the pin-6 of the socket, you might also try to find a closer hole on the PCB that has this clock by using a multimeter. Usually there's such a PCB hole close to the cartridge slot.

11) Solder a wire to connect the underside pin-20 (/IORQ) of the Z80 socket to one of the /BREAK inputs of the MSX SuperTurbo. Again, you might want instead a multimeter and find/use a hole close to the cartridge slot where this signal is present too. (same deal for the /M1 signal below)

Note: Some newer MSX SuperTurbos (>3.0) have specific /IORQ and /M1 input pins, to allow much faster interrupt request responses. If that's the case, then connect the pin-20 of the Z80 socket to the specific /IORQ input instead. In this case, you'll also need to solder a wire from the Z80 pin-27 (/M1) to the /M1 input of the SuperTurbo too.

12) Place the turbo switch at the back of your SMS. One of the pins of the switch must be connected to any closely accessible GND point. The other pin of the switch must be connected to one of the /BREAK inputs of the SuperTurbo. If your SuperTurbo has a specific switch input pin, use it instead.

13) For 10.74MHz, you might need to replace the main-RAM chip of the SMS from a XRAM to a SRAM with the same pinout (any low-power 6164 DIP compatible SRAM will do). But note that many SMS models already have SRAM for the main RAM, so be sure to double check it. Be sure to install a socket here too, for easy chip replacement when needed.

Now it's time for the testing:

1) First, try to power up the SMS and see if the firmware and any internal games run fine either with the turbo enabled or disabled. You can turn on/off the turbo on the fly without any problem.

2) Now, connect a cartridge to the slot and check if it runs fine either with the turbo enabled or disabled. Try some games with FM support too.

3) If only the turbo mode doesn't work, the main-RAM chip of your SMS might be too slow. Try to replace it with an SRAM as described on the step-13.

If any of the tests fail, check all the steps and connections again with a multimeter. If all of them are fine, suspect that the CPU you got is counterfeit and try the original one (if you could save it), but obviously only with the turbo disabled. If the original CPU works fine, you'll got a fake Z84C0010 CPU. Also suspect the same if the Z84C0010 CPU works fine without the turbo, but glitches when the turbo is enabled.

That's it. I hope you have plenty of fun and smooth gaming with your turbo SMS. :)

Remember: this is a homebrew/DIY project. I don't take any responsibility for any damage that happens to your hardware. If you decided to try, do it at your own risk.
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14689
  • Location: London
Reply with quote
Post Posted: Sat May 11, 2019 7:18 pm
For those who don't know, the MSX Turbo mod runs the Z80 at a higher rate until it detects something likely to have some timing limitations - typically, accessing the I/O ports - and then switches back to the normal clock rate for some period of time. Thus you don't access the video chip too fast, for example, and the video chip continues to use the original clock. However it can be tricky to cover all timing cases.

Typically, games designed to a slow frame rate (eg Out Run) won't get any faster, but games with slowdown/lag may get better.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 3763
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Mon May 13, 2019 9:31 am
sdsnatcher wrote
- Some few games misdetect NTSC as PAL.


They're probably counting cycles between v-blanks. devkitSMS doesn't do that so SMS Test Suite *should* detect TV type properly.

I'm just curious: do you really need to replace the CPU to make it go faster? Can't simply the chip already in the SMS go at faster (double?) speed?
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14689
  • Location: London
Reply with quote
Post Posted: Mon May 13, 2019 12:00 pm
I think stock Z80s are rated up to 4MHz.
  View user's profile Send private message Visit poster's website
  • Joined: 14 Jul 2008
  • Posts: 157
Reply with quote
Post Posted: Sun May 19, 2019 1:50 am
sdsnatcher wrote
Hello! I'm FRS from the MSX community. I'm not sure if you remember me, but I released a port of Gunstar Heroes to the SMS some time ago.


Hello sdsnatcher. Glad you are back here. Speaking about Gunstar Heroes, could you please check out this if possible?

http://www.smspower.org/forums/14742-GameGearToMasterSystemHacks?start=900#10268...
  View user's profile Send private message
Reply to topic



Back to the top of this page

Back to SMS Power!