Apparently the SMS is better than everything

Discussion of development of software for any "obsolete" computer or video game system.
User avatar
TmEE
Posts: 747
Joined: Wed Feb 13, 2008 9:10 am
Location: Estonia, Rapla city (50 and 60Hz compatible :P)
Contact:

Re: Apparently the SMS is better than everything

Post by TmEE » Wed Jan 08, 2020 12:15 am

PSG should have been clocked at half speed, lack of bass notes is what hurts it the most but that wouldn't make it match NES in any way, there's still only 3 types of sounds possible (50% sq, 6.25% sq, white noise) while NES can do much much more. YM2413 was underutilized, most games used music data of PSG for the FM, leaving most of the chip unused pretty much and none did anything fancy with the instruments either.

65x vs Z80, I haven't actually written anything for 65x but I get the impression I need to write many more instructions to do the same tasks compared to Z80 (or most other CPUs I know of). I would probably have lesser productivity with 65k, more code to write and go through.

tepples
Posts: 21980
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Apparently the SMS is better than everything

Post by tepples » Wed Jan 08, 2020 8:57 am

lidnariq wrote:
Tue Jan 07, 2020 6:48 pm
Z80 is roughly equal to 6502 when clocked two to three times as fast (and in practice it always is), with a lot of variation depending on specific workload.
And the SMS is just barely on the low side of that clock rate margin.
turboxray wrote:
Tue Jan 07, 2020 10:12 pm
z80 is strong at sequential reading, which made it pretty decent for doing planar compositing in realtime (see Golden Axe, Altered Beast, etc), but it's pretty slow for random access and LUTs compared to the 65x.
When asked about how to cope with lack of random access to properties of an actor struct, the reply that I usually get out of Z80 and SM83 programmers is to the effect: "You should write down the order of accesses on paper or on a whiteboard before writing any code and then, based on this anticipated order of access, design the struct that represents the properties of your game actors. Afterward, if changes to your code cause the anticipated order of access not to match the actual order of access, rewrite all your code to correspond to the new order of access." Yet they also discourage implementing most of the game in another programming language in order to prototype the order of accesses and then demaking the lot once the PC prototype is half done.
turboxray wrote:
Tue Jan 07, 2020 10:12 pm
In general though, I'm pretty sure there are more examples of SMS games running at 30fps than the NES.
Some late SMS support was a byproduct of Game Gear development, and I seem to remember some Game Gear games intentionally ran at 30 fps for the same reason that some Game Boy games did: to accommodate the motion blur of early LCDs.

Some other examples of slowdown on SMS and GG are because of software sprite flipping, as mentioned before. Others were due to lack of mid-screen vertical scroll changes. Road Rash and other driving games with hills are a slideshow because of software rendering to compensate for this. Other Game Gear games using a non-sprite status bar also have to counterscroll the tiles in the status bar to compensate for its scrolling being fixed to playfield scrolling.
turboxray wrote:
Tue Jan 07, 2020 10:12 pm
And being slower paced than NES games (not sure if that's by design or by limitation - real or imagined by the developer).
The Game Gear's 160-pixel-wide display meant that games had to compensate using similar design techniques to Game Boy games. Otherwise, games ended up with blind jump hell, with particularly nasty cases in Balloon Kid for Game Boy and Sonic 2 for Game Gear. One compensation was to make everything tiny, as in Super Mario Land and Batman. The other was to slow down the game's overall pace, as in the Wario Land series. And I imagine some of these GG games ended up backported to SMS without any pacing change, as it's not terribly practical to redraw all the graphics at 1.5x magnification on a tile-based system.
TmEE wrote:
Wed Jan 08, 2020 12:15 am
YM2413 was underutilized
YM2413 in SMS didn't even exist outside Japan [ ⏺ ]
TmEE wrote:
Wed Jan 08, 2020 12:15 am
none did anything fancy with the instruments either.
It didn't help that the YM2413 had enough RAM for only one custom patch at a time, the rest coming from ROM. It's the same problem with VRC7 in FamiTracker, as VRC7 embeds a six-channel YM2413 with a different preset patch set.
TmEE wrote:
Wed Jan 08, 2020 12:15 am
65x vs Z80, I haven't actually written anything for 65x but I get the impression I need to write many more instructions to do the same tasks compared to Z80 (or most other CPUs I know of).
The 8080 family's focus on sequential access makes certain things nice except for game logic code, which often needs random access to read and write a bunch of properties. This includes enemies that behave differently based on things like position relative to the player, animation frame, animation timers, health, whether (and where) the enemy took damage in the last frame. On Z80 (SMS), you'd normally put the base of an actor struct in register IX, and access through IX is half the speed of 6502 indexed mode even if the Z80 is clocked twice as fast. On 8080-based arcade platforms and on SM83 (Game Boy CPU), you end up having to tie up DE with the pointer to the base of the actor struct and HL with the effective address.

psycopathicteen
Posts: 2935
Joined: Wed May 19, 2010 6:12 pm

Re: Apparently the SMS is better than everything

Post by psycopathicteen » Wed Jan 08, 2020 10:39 am

Now that I think about it, the fact that VRAM is always available to the CPU is the does help a lot with reversing sprites, because you don't have to buffer everything in RAM first.

lidnariq
Posts: 9403
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Apparently the SMS is better than everything

Post by lidnariq » Wed Jan 08, 2020 3:25 pm

tepples wrote:
Wed Jan 08, 2020 8:57 am
The Game Gear's 160-pixel-wide display meant that games had to compensate using similar design techniques to Game Boy games. [...] I imagine some of these GG games ended up backported to SMS without any pacing change, as it's not terribly practical to redraw all the graphics at 1.5x magnification on a tile-based system.
The Game Gear actually supports two different video modes, depending on whether one pin (/GG) on the cartridge connector is tied low or allowed to float.

If tied low, the display shows the expected 20x18 8x8 pixel 6:5 PAR tiles with 12bpp color. If allowed to float, the display instead shows 30 columns of 5.33-pixel wide tiles with the original 6bpp color. In this "zoomed out" mode, the vertical scaling factor apparently depends on how many scanlines it's trying to draw.

User avatar
TmEE
Posts: 747
Joined: Wed Feb 13, 2008 9:10 am
Location: Estonia, Rapla city (50 and 60Hz compatible :P)
Contact:

Re: Apparently the SMS is better than everything

Post by TmEE » Wed Jan 08, 2020 7:23 pm

There's no "new" video mode as far as VDP goes though, the VDP still outputs full NTSC image. When the !GG pin is put low a chip that does IO ports stuff applies new palette to the image and also a border (you need to manually turn rendering off outside the LCD area to get extra VRAM bandwidth) and scales in for the LCD, changes IO mapping to match that of GG and applies stereo to the PSG output.

User avatar
tokumaru
Posts: 11702
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Apparently the SMS is better than everything

Post by tokumaru » Sat Jan 11, 2020 12:30 am

Wait, so the GG VDP is still the same as the SMS VDP, and all upgrades are implemented externally? Doesn't the VDP output RGB? How can a new palette be applied?

lidnariq
Posts: 9403
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Apparently the SMS is better than everything

Post by lidnariq » Sat Jan 11, 2020 12:52 am

The GG VDP is mostly just an incremental upgrade from the SMS2 VDP, gated behind an external switch:

* If the external pin configures it for "SMS" mode, it scales its output down for the GG's screen, in a way that hasn't entirely been reverse-engineered yet. (I suspect the interface to the CSTN screen in the GG is not purely digital, so a simple logic analyzer may be insufficient. )

* If the external pin configures it for "GG" mode, it instead provides a zoom to the center 160x144 pixels of the screen, greater palette depth, and everything else TµEE said. (Some more things, but I haven't yet found a single list of the non-VDP changes. SMSwiki:Gear2Gear port SMSwiki:GameGear start button SMSwiki:GameGear stereo SMSwiki:GameGear VDP).

In both modes, legacy TMS9918 modes are still supported, but the game much be patched to configure palette colors.

User avatar
TmEE
Posts: 747
Joined: Wed Feb 13, 2008 9:10 am
Location: Estonia, Rapla city (50 and 60Hz compatible :P)
Contact:

Re: Apparently the SMS is better than everything

Post by TmEE » Sat Jan 11, 2020 5:25 am

GG VDP outputs 5 bit digital RGB (4 index + 1 palette bit) and couple support signals to tell when something starts and ends, plus each PSG channel on its own pin. Palette and other stuff is applied externally by the second chip on early versions (later ones integrate everything into single chip).
There's also some level of VRAM bandwidth enhancement since when CPU is overclocked it takes a while before graphical corruption starts vs what happens with real SMS. I got to 9MHz before games started to glitch out.
Fun fact : all GGs have 32KB PSRAM for video memory, but one address bit is permanently tied to specific state... Sega could have easily added banking like on one SMS VDP based arcade board...

Data going to screen is purely digital, with analog side only having to do biasing and power supply. GG RGB modifications actually tap into this interface to get digital RGB with palette already applied.

TOUKO
Posts: 289
Joined: Mon Mar 30, 2015 10:14 am

Re: Apparently the SMS is better than everything

Post by TOUKO » Sat Jan 11, 2020 7:03 am

The comparison with PCE is funny too,because the autor seems to mean that the SMS can have some advantages over the PCE, even on the CPU side,saying that the Z80 can be assimiled to a 8/16 bits CPU and the PCE one is a 8 bits only.
Frankly the PCE destroy the SMS in every possible way,the only common thing is the 4bpp display .
About the SMS ,there is nothing about the V-LOCK .

Strangely, there is no comparison with the atari lynx, which is also a 8 bits system .

User avatar
tokumaru
Posts: 11702
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Apparently the SMS is better than everything

Post by tokumaru » Sat Jan 11, 2020 7:34 pm

I asked about the Game Gear enhancements because for a moment there it sounded like it would be possible to modify a Master System to play Game Gear games on a TV, which would be great! But I guess that's not the case...

User avatar
TmEE
Posts: 747
Joined: Wed Feb 13, 2008 9:10 am
Location: Estonia, Rapla city (50 and 60Hz compatible :P)
Contact:

Re: Apparently the SMS is better than everything

Post by TmEE » Sat Jan 11, 2020 11:48 pm

To play GG games on a TV you're better off using one of the GG TV modifications on a GG itself. GG mode changes how controller input works and few other tidbits like NMI no longer is pause but communications interrupt instead and SMS hardware cannot do any of it, all of the SMS stuff needs to get replaced pretty much.

User avatar
za909
Posts: 207
Joined: Fri Jan 24, 2014 9:05 am
Location: Hungary

Re: Apparently the SMS is better than everything

Post by za909 » Thu Mar 05, 2020 11:47 am

To join in on the audio discussion part, I mostly agree that a lot of soundtracks sound same-ey. Especially when it comes to percussion, since the "lazy way" was to use the available noise pitches, of which there are only three, the fourth setting takes the divider from the third square channel. Changing noise pitch ALWAYS resets the LFSR to a state that starts out with the 6.25% pulse, and then a few variations of it follow before anything "truly random sounding" is heard, and this gives the noise channel a very thin, firecracker like "cough". This is also true for Gameboy, but regarding the SMS it's much more destructive to the overall "oomph" of the audio in my opinion. Add on top of that that many developes did nothing more than program very basic fading notes, and you've got yourself a generic-sounding, high-treble low-bass soundtrack. I tried to get a slightly beefier sound out of the system with an original song.

Some of the tricks I used, and others I would suggest using to make the system sound more interesting would be the following:
- Use the sound in the same way as an AY chip, as if it was a 3-channel chip to utilize low 6.25% pulses and combined noise + square drums.
- Deliberate reset for the noise LFSR every x frames, which produces an electric sound similar to the NES periodic noise.
- Combining two squares one octave apart to produce a 25% pulse via interference.
- More focus on simulated echo using the volume levels
- Avoid the initial noise LFSR pattern by setting the upcoming pitch value prematurely (even one frame is enough to get past the crackly part).
- Where possible, use the 3 pitches that do not depend on Square 3 to get the 6.25% pulse across three octaves with the note A, or line up your required 6.25% pulse with a not too high-sounding square (the square pitch translates to a 6.25% pulse 4 octaves below). This sounds like combining the saw envelopes with high tones on the AY chip.
- If more CPU time is available for sound, use the scanline IRQ to drive low-effort sample playback (4-bits) or looping arbitrary waveforms. This will be affected by the logarithmic volume curve though.

User avatar
TmEE
Posts: 747
Joined: Wed Feb 13, 2008 9:10 am
Location: Estonia, Rapla city (50 and 60Hz compatible :P)
Contact:

Re: Apparently the SMS is better than everything

Post by TmEE » Thu Mar 05, 2020 12:08 pm

I have actually found that "cough" giving a nice percussive quality to the noise rather than just a hiss like TI PSG which has a much "mellower" and "steadier" noise quality. 6.6667% duty cycle it produces when feedback is disabled is a problem for music since it isn't exactly some octaves different from tones but a fractional value. This is a headache for me when I eventually work more on my SC3000/SG1000 game, which I'd also like to sound nice on SMS and MarkIII and the 6.666 vs 6.25% problem has to be addressed.

That track you made is pretty cool ~

Post Reply